| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 "use strict"; 2 var wp; 3 (wp ||= {}).editSite = (() => { 4 var __create = Object.create; 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __getProtoOf = Object.getPrototypeOf; 9 var __hasOwnProp = Object.prototype.hasOwnProperty; 10 var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, { 11 get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2] 12 }) : x2)(function(x2) { 13 if (typeof require !== "undefined") return require.apply(this, arguments); 14 throw Error('Dynamic require of "' + x2 + '" is not supported'); 15 }); 16 var __commonJS = (cb, mod) => function __require4() { 17 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 18 }; 19 var __export = (target, all) => { 20 for (var name2 in all) 21 __defProp(target, name2, { get: all[name2], enumerable: true }); 22 }; 23 var __copyProps = (to2, from, except, desc) => { 24 if (from && typeof from === "object" || typeof from === "function") { 25 for (let key of __getOwnPropNames(from)) 26 if (!__hasOwnProp.call(to2, key) && key !== except) 27 __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 28 } 29 return to2; 30 }; 31 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 32 // If the importer is in node compatibility mode or this is not an ESM 33 // file that has been converted to a CommonJS file using a Babel- 34 // compatible transform (i.e. "__esModule" has not been set), then set 35 // "default" to the CommonJS "module.exports" for node compatibility. 36 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 37 mod 38 )); 39 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 40 41 // package-external:@wordpress/blocks 42 var require_blocks = __commonJS({ 43 "package-external:@wordpress/blocks"(exports, module) { 44 module.exports = window.wp.blocks; 45 } 46 }); 47 48 // package-external:@wordpress/block-library 49 var require_block_library = __commonJS({ 50 "package-external:@wordpress/block-library"(exports, module) { 51 module.exports = window.wp.blockLibrary; 52 } 53 }); 54 55 // package-external:@wordpress/data 56 var require_data = __commonJS({ 57 "package-external:@wordpress/data"(exports, module) { 58 module.exports = window.wp.data; 59 } 60 }); 61 62 // package-external:@wordpress/deprecated 63 var require_deprecated = __commonJS({ 64 "package-external:@wordpress/deprecated"(exports, module) { 65 module.exports = window.wp.deprecated; 66 } 67 }); 68 69 // package-external:@wordpress/element 70 var require_element = __commonJS({ 71 "package-external:@wordpress/element"(exports, module) { 72 module.exports = window.wp.element; 73 } 74 }); 75 76 // package-external:@wordpress/editor 77 var require_editor = __commonJS({ 78 "package-external:@wordpress/editor"(exports, module) { 79 module.exports = window.wp.editor; 80 } 81 }); 82 83 // package-external:@wordpress/preferences 84 var require_preferences = __commonJS({ 85 "package-external:@wordpress/preferences"(exports, module) { 86 module.exports = window.wp.preferences; 87 } 88 }); 89 90 // package-external:@wordpress/widgets 91 var require_widgets = __commonJS({ 92 "package-external:@wordpress/widgets"(exports, module) { 93 module.exports = window.wp.widgets; 94 } 95 }); 96 97 // package-external:@wordpress/core-data 98 var require_core_data = __commonJS({ 99 "package-external:@wordpress/core-data"(exports, module) { 100 module.exports = window.wp.coreData; 101 } 102 }); 103 104 // package-external:@wordpress/block-editor 105 var require_block_editor = __commonJS({ 106 "package-external:@wordpress/block-editor"(exports, module) { 107 module.exports = window.wp.blockEditor; 108 } 109 }); 110 111 // package-external:@wordpress/i18n 112 var require_i18n = __commonJS({ 113 "package-external:@wordpress/i18n"(exports, module) { 114 module.exports = window.wp.i18n; 115 } 116 }); 117 118 // package-external:@wordpress/patterns 119 var require_patterns = __commonJS({ 120 "package-external:@wordpress/patterns"(exports, module) { 121 module.exports = window.wp.patterns; 122 } 123 }); 124 125 // package-external:@wordpress/private-apis 126 var require_private_apis = __commonJS({ 127 "package-external:@wordpress/private-apis"(exports, module) { 128 module.exports = window.wp.privateApis; 129 } 130 }); 131 132 // package-external:@wordpress/router 133 var require_router = __commonJS({ 134 "package-external:@wordpress/router"(exports, module) { 135 module.exports = window.wp.router; 136 } 137 }); 138 139 // vendor-external:react 140 var require_react = __commonJS({ 141 "vendor-external:react"(exports, module) { 142 module.exports = window.React; 143 } 144 }); 145 146 // vendor-external:react/jsx-runtime 147 var require_jsx_runtime = __commonJS({ 148 "vendor-external:react/jsx-runtime"(exports, module) { 149 module.exports = window.ReactJSXRuntime; 150 } 151 }); 152 153 // vendor-external:react-dom 154 var require_react_dom = __commonJS({ 155 "vendor-external:react-dom"(exports, module) { 156 module.exports = window.ReactDOM; 157 } 158 }); 159 160 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 161 var require_use_sync_external_store_shim_development = __commonJS({ 162 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 163 "use strict"; 164 (function() { 165 function is2(x2, y2) { 166 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 167 } 168 function useSyncExternalStore$2(subscribe3, getSnapshot) { 169 didWarnOld18Alpha || void 0 === React62.startTransition || (didWarnOld18Alpha = true, console.error( 170 "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." 171 )); 172 var value = getSnapshot(); 173 if (!didWarnUncachedGetSnapshot) { 174 var cachedValue = getSnapshot(); 175 objectIs(value, cachedValue) || (console.error( 176 "The result of getSnapshot should be cached to avoid an infinite loop" 177 ), didWarnUncachedGetSnapshot = true); 178 } 179 cachedValue = useState88({ 180 inst: { value, getSnapshot } 181 }); 182 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 183 useLayoutEffect11( 184 function() { 185 inst.value = value; 186 inst.getSnapshot = getSnapshot; 187 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 188 }, 189 [subscribe3, value, getSnapshot] 190 ); 191 useEffect69( 192 function() { 193 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 194 return subscribe3(function() { 195 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 196 }); 197 }, 198 [subscribe3] 199 ); 200 useDebugValue2(value); 201 return value; 202 } 203 function checkIfSnapshotChanged(inst) { 204 var latestGetSnapshot = inst.getSnapshot; 205 inst = inst.value; 206 try { 207 var nextValue = latestGetSnapshot(); 208 return !objectIs(inst, nextValue); 209 } catch (error2) { 210 return true; 211 } 212 } 213 function useSyncExternalStore$1(subscribe3, getSnapshot) { 214 return getSnapshot(); 215 } 216 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 217 var React62 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is2, useState88 = React62.useState, useEffect69 = React62.useEffect, useLayoutEffect11 = React62.useLayoutEffect, useDebugValue2 = React62.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 218 exports.useSyncExternalStore = void 0 !== React62.useSyncExternalStore ? React62.useSyncExternalStore : shim; 219 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 220 })(); 221 } 222 }); 223 224 // node_modules/use-sync-external-store/shim/index.js 225 var require_shim = __commonJS({ 226 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 227 "use strict"; 228 if (false) { 229 module.exports = null; 230 } else { 231 module.exports = require_use_sync_external_store_shim_development(); 232 } 233 } 234 }); 235 236 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 237 var require_with_selector_development = __commonJS({ 238 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 239 "use strict"; 240 (function() { 241 function is2(x2, y2) { 242 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 243 } 244 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 245 var React62 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is2, useSyncExternalStore3 = shim.useSyncExternalStore, useRef75 = React62.useRef, useEffect69 = React62.useEffect, useMemo94 = React62.useMemo, useDebugValue2 = React62.useDebugValue; 246 exports.useSyncExternalStoreWithSelector = function(subscribe3, getSnapshot, getServerSnapshot, selector2, isEqual2) { 247 var instRef = useRef75(null); 248 if (null === instRef.current) { 249 var inst = { hasValue: false, value: null }; 250 instRef.current = inst; 251 } else inst = instRef.current; 252 instRef = useMemo94( 253 function() { 254 function memoizedSelector(nextSnapshot) { 255 if (!hasMemo) { 256 hasMemo = true; 257 memoizedSnapshot = nextSnapshot; 258 nextSnapshot = selector2(nextSnapshot); 259 if (void 0 !== isEqual2 && inst.hasValue) { 260 var currentSelection = inst.value; 261 if (isEqual2(currentSelection, nextSnapshot)) 262 return memoizedSelection = currentSelection; 263 } 264 return memoizedSelection = nextSnapshot; 265 } 266 currentSelection = memoizedSelection; 267 if (objectIs(memoizedSnapshot, nextSnapshot)) 268 return currentSelection; 269 var nextSelection = selector2(nextSnapshot); 270 if (void 0 !== isEqual2 && isEqual2(currentSelection, nextSelection)) 271 return memoizedSnapshot = nextSnapshot, currentSelection; 272 memoizedSnapshot = nextSnapshot; 273 return memoizedSelection = nextSelection; 274 } 275 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 276 return [ 277 function() { 278 return memoizedSelector(getSnapshot()); 279 }, 280 null === maybeGetServerSnapshot ? void 0 : function() { 281 return memoizedSelector(maybeGetServerSnapshot()); 282 } 283 ]; 284 }, 285 [getSnapshot, getServerSnapshot, selector2, isEqual2] 286 ); 287 var value = useSyncExternalStore3(subscribe3, instRef[0], instRef[1]); 288 useEffect69( 289 function() { 290 inst.hasValue = true; 291 inst.value = value; 292 }, 293 [value] 294 ); 295 useDebugValue2(value); 296 return value; 297 }; 298 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 299 })(); 300 } 301 }); 302 303 // node_modules/use-sync-external-store/shim/with-selector.js 304 var require_with_selector = __commonJS({ 305 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 306 "use strict"; 307 if (false) { 308 module.exports = null; 309 } else { 310 module.exports = require_with_selector_development(); 311 } 312 } 313 }); 314 315 // package-external:@wordpress/a11y 316 var require_a11y = __commonJS({ 317 "package-external:@wordpress/a11y"(exports, module) { 318 module.exports = window.wp.a11y; 319 } 320 }); 321 322 // package-external:@wordpress/primitives 323 var require_primitives = __commonJS({ 324 "package-external:@wordpress/primitives"(exports, module) { 325 module.exports = window.wp.primitives; 326 } 327 }); 328 329 // package-external:@wordpress/compose 330 var require_compose = __commonJS({ 331 "package-external:@wordpress/compose"(exports, module) { 332 module.exports = window.wp.compose; 333 } 334 }); 335 336 // package-external:@wordpress/theme 337 var require_theme = __commonJS({ 338 "package-external:@wordpress/theme"(exports, module) { 339 module.exports = window.wp.theme; 340 } 341 }); 342 343 // package-external:@wordpress/components 344 var require_components = __commonJS({ 345 "package-external:@wordpress/components"(exports, module) { 346 module.exports = window.wp.components; 347 } 348 }); 349 350 // package-external:@wordpress/plugins 351 var require_plugins = __commonJS({ 352 "package-external:@wordpress/plugins"(exports, module) { 353 module.exports = window.wp.plugins; 354 } 355 }); 356 357 // package-external:@wordpress/notices 358 var require_notices = __commonJS({ 359 "package-external:@wordpress/notices"(exports, module) { 360 module.exports = window.wp.notices; 361 } 362 }); 363 364 // package-external:@wordpress/html-entities 365 var require_html_entities = __commonJS({ 366 "package-external:@wordpress/html-entities"(exports, module) { 367 module.exports = window.wp.htmlEntities; 368 } 369 }); 370 371 // package-external:@wordpress/commands 372 var require_commands = __commonJS({ 373 "package-external:@wordpress/commands"(exports, module) { 374 module.exports = window.wp.commands; 375 } 376 }); 377 378 // package-external:@wordpress/keycodes 379 var require_keycodes = __commonJS({ 380 "package-external:@wordpress/keycodes"(exports, module) { 381 module.exports = window.wp.keycodes; 382 } 383 }); 384 385 // package-external:@wordpress/url 386 var require_url = __commonJS({ 387 "package-external:@wordpress/url"(exports, module) { 388 module.exports = window.wp.url; 389 } 390 }); 391 392 // package-external:@wordpress/dom 393 var require_dom = __commonJS({ 394 "package-external:@wordpress/dom"(exports, module) { 395 module.exports = window.wp.dom; 396 } 397 }); 398 399 // package-external:@wordpress/keyboard-shortcuts 400 var require_keyboard_shortcuts = __commonJS({ 401 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 402 module.exports = window.wp.keyboardShortcuts; 403 } 404 }); 405 406 // package-external:@wordpress/api-fetch 407 var require_api_fetch = __commonJS({ 408 "package-external:@wordpress/api-fetch"(exports, module) { 409 module.exports = window.wp.apiFetch; 410 } 411 }); 412 413 // package-external:@wordpress/style-engine 414 var require_style_engine = __commonJS({ 415 "package-external:@wordpress/style-engine"(exports, module) { 416 module.exports = window.wp.styleEngine; 417 } 418 }); 419 420 // node_modules/fast-deep-equal/es6/index.js 421 var require_es6 = __commonJS({ 422 "node_modules/fast-deep-equal/es6/index.js"(exports, module) { 423 "use strict"; 424 module.exports = function equal(a2, b2) { 425 if (a2 === b2) return true; 426 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") { 427 if (a2.constructor !== b2.constructor) return false; 428 var length, i2, keys; 429 if (Array.isArray(a2)) { 430 length = a2.length; 431 if (length != b2.length) return false; 432 for (i2 = length; i2-- !== 0; ) 433 if (!equal(a2[i2], b2[i2])) return false; 434 return true; 435 } 436 if (a2 instanceof Map && b2 instanceof Map) { 437 if (a2.size !== b2.size) return false; 438 for (i2 of a2.entries()) 439 if (!b2.has(i2[0])) return false; 440 for (i2 of a2.entries()) 441 if (!equal(i2[1], b2.get(i2[0]))) return false; 442 return true; 443 } 444 if (a2 instanceof Set && b2 instanceof Set) { 445 if (a2.size !== b2.size) return false; 446 for (i2 of a2.entries()) 447 if (!b2.has(i2[0])) return false; 448 return true; 449 } 450 if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) { 451 length = a2.length; 452 if (length != b2.length) return false; 453 for (i2 = length; i2-- !== 0; ) 454 if (a2[i2] !== b2[i2]) return false; 455 return true; 456 } 457 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags; 458 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf(); 459 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString(); 460 keys = Object.keys(a2); 461 length = keys.length; 462 if (length !== Object.keys(b2).length) return false; 463 for (i2 = length; i2-- !== 0; ) 464 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false; 465 for (i2 = length; i2-- !== 0; ) { 466 var key = keys[i2]; 467 if (!equal(a2[key], b2[key])) return false; 468 } 469 return true; 470 } 471 return a2 !== a2 && b2 !== b2; 472 }; 473 } 474 }); 475 476 // node_modules/deepmerge/dist/cjs.js 477 var require_cjs = __commonJS({ 478 "node_modules/deepmerge/dist/cjs.js"(exports, module) { 479 "use strict"; 480 var isMergeableObject = function isMergeableObject2(value) { 481 return isNonNullObject(value) && !isSpecial(value); 482 }; 483 function isNonNullObject(value) { 484 return !!value && typeof value === "object"; 485 } 486 function isSpecial(value) { 487 var stringValue = Object.prototype.toString.call(value); 488 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value); 489 } 490 var canUseSymbol = typeof Symbol === "function" && Symbol.for; 491 var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103; 492 function isReactElement(value) { 493 return value.$$typeof === REACT_ELEMENT_TYPE; 494 } 495 function emptyTarget(val) { 496 return Array.isArray(val) ? [] : {}; 497 } 498 function cloneUnlessOtherwiseSpecified(value, options) { 499 return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value; 500 } 501 function defaultArrayMerge(target, source, options) { 502 return target.concat(source).map(function(element) { 503 return cloneUnlessOtherwiseSpecified(element, options); 504 }); 505 } 506 function getMergeFunction(key, options) { 507 if (!options.customMerge) { 508 return deepmerge2; 509 } 510 var customMerge = options.customMerge(key); 511 return typeof customMerge === "function" ? customMerge : deepmerge2; 512 } 513 function getEnumerableOwnPropertySymbols(target) { 514 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol3) { 515 return Object.propertyIsEnumerable.call(target, symbol3); 516 }) : []; 517 } 518 function getKeys2(target) { 519 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); 520 } 521 function propertyIsOnObject(object, property) { 522 try { 523 return property in object; 524 } catch (_) { 525 return false; 526 } 527 } 528 function propertyIsUnsafe(target, key) { 529 return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key)); 530 } 531 function mergeObject(target, source, options) { 532 var destination = {}; 533 if (options.isMergeableObject(target)) { 534 getKeys2(target).forEach(function(key) { 535 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 536 }); 537 } 538 getKeys2(source).forEach(function(key) { 539 if (propertyIsUnsafe(target, key)) { 540 return; 541 } 542 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 543 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 544 } else { 545 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 546 } 547 }); 548 return destination; 549 } 550 function deepmerge2(target, source, options) { 551 options = options || {}; 552 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 553 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 554 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 555 var sourceIsArray = Array.isArray(source); 556 var targetIsArray = Array.isArray(target); 557 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 558 if (!sourceAndTargetTypesMatch) { 559 return cloneUnlessOtherwiseSpecified(source, options); 560 } else if (sourceIsArray) { 561 return options.arrayMerge(target, source, options); 562 } else { 563 return mergeObject(target, source, options); 564 } 565 } 566 deepmerge2.all = function deepmergeAll(array, options) { 567 if (!Array.isArray(array)) { 568 throw new Error("first argument should be an array"); 569 } 570 return array.reduce(function(prev, next) { 571 return deepmerge2(prev, next, options); 572 }, {}); 573 }; 574 var deepmerge_1 = deepmerge2; 575 module.exports = deepmerge_1; 576 } 577 }); 578 579 // package-external:@wordpress/date 580 var require_date = __commonJS({ 581 "package-external:@wordpress/date"(exports, module) { 582 module.exports = window.wp.date; 583 } 584 }); 585 586 // package-external:@wordpress/blob 587 var require_blob = __commonJS({ 588 "package-external:@wordpress/blob"(exports, module) { 589 module.exports = window.wp.blob; 590 } 591 }); 592 593 // node_modules/remove-accents/index.js 594 var require_remove_accents = __commonJS({ 595 "node_modules/remove-accents/index.js"(exports, module) { 596 var characterMap = { 597 "\xC0": "A", 598 "\xC1": "A", 599 "\xC2": "A", 600 "\xC3": "A", 601 "\xC4": "A", 602 "\xC5": "A", 603 "\u1EA4": "A", 604 "\u1EAE": "A", 605 "\u1EB2": "A", 606 "\u1EB4": "A", 607 "\u1EB6": "A", 608 "\xC6": "AE", 609 "\u1EA6": "A", 610 "\u1EB0": "A", 611 "\u0202": "A", 612 "\u1EA2": "A", 613 "\u1EA0": "A", 614 "\u1EA8": "A", 615 "\u1EAA": "A", 616 "\u1EAC": "A", 617 "\xC7": "C", 618 "\u1E08": "C", 619 "\xC8": "E", 620 "\xC9": "E", 621 "\xCA": "E", 622 "\xCB": "E", 623 "\u1EBE": "E", 624 "\u1E16": "E", 625 "\u1EC0": "E", 626 "\u1E14": "E", 627 "\u1E1C": "E", 628 "\u0206": "E", 629 "\u1EBA": "E", 630 "\u1EBC": "E", 631 "\u1EB8": "E", 632 "\u1EC2": "E", 633 "\u1EC4": "E", 634 "\u1EC6": "E", 635 "\xCC": "I", 636 "\xCD": "I", 637 "\xCE": "I", 638 "\xCF": "I", 639 "\u1E2E": "I", 640 "\u020A": "I", 641 "\u1EC8": "I", 642 "\u1ECA": "I", 643 "\xD0": "D", 644 "\xD1": "N", 645 "\xD2": "O", 646 "\xD3": "O", 647 "\xD4": "O", 648 "\xD5": "O", 649 "\xD6": "O", 650 "\xD8": "O", 651 "\u1ED0": "O", 652 "\u1E4C": "O", 653 "\u1E52": "O", 654 "\u020E": "O", 655 "\u1ECE": "O", 656 "\u1ECC": "O", 657 "\u1ED4": "O", 658 "\u1ED6": "O", 659 "\u1ED8": "O", 660 "\u1EDC": "O", 661 "\u1EDE": "O", 662 "\u1EE0": "O", 663 "\u1EDA": "O", 664 "\u1EE2": "O", 665 "\xD9": "U", 666 "\xDA": "U", 667 "\xDB": "U", 668 "\xDC": "U", 669 "\u1EE6": "U", 670 "\u1EE4": "U", 671 "\u1EEC": "U", 672 "\u1EEE": "U", 673 "\u1EF0": "U", 674 "\xDD": "Y", 675 "\xE0": "a", 676 "\xE1": "a", 677 "\xE2": "a", 678 "\xE3": "a", 679 "\xE4": "a", 680 "\xE5": "a", 681 "\u1EA5": "a", 682 "\u1EAF": "a", 683 "\u1EB3": "a", 684 "\u1EB5": "a", 685 "\u1EB7": "a", 686 "\xE6": "ae", 687 "\u1EA7": "a", 688 "\u1EB1": "a", 689 "\u0203": "a", 690 "\u1EA3": "a", 691 "\u1EA1": "a", 692 "\u1EA9": "a", 693 "\u1EAB": "a", 694 "\u1EAD": "a", 695 "\xE7": "c", 696 "\u1E09": "c", 697 "\xE8": "e", 698 "\xE9": "e", 699 "\xEA": "e", 700 "\xEB": "e", 701 "\u1EBF": "e", 702 "\u1E17": "e", 703 "\u1EC1": "e", 704 "\u1E15": "e", 705 "\u1E1D": "e", 706 "\u0207": "e", 707 "\u1EBB": "e", 708 "\u1EBD": "e", 709 "\u1EB9": "e", 710 "\u1EC3": "e", 711 "\u1EC5": "e", 712 "\u1EC7": "e", 713 "\xEC": "i", 714 "\xED": "i", 715 "\xEE": "i", 716 "\xEF": "i", 717 "\u1E2F": "i", 718 "\u020B": "i", 719 "\u1EC9": "i", 720 "\u1ECB": "i", 721 "\xF0": "d", 722 "\xF1": "n", 723 "\xF2": "o", 724 "\xF3": "o", 725 "\xF4": "o", 726 "\xF5": "o", 727 "\xF6": "o", 728 "\xF8": "o", 729 "\u1ED1": "o", 730 "\u1E4D": "o", 731 "\u1E53": "o", 732 "\u020F": "o", 733 "\u1ECF": "o", 734 "\u1ECD": "o", 735 "\u1ED5": "o", 736 "\u1ED7": "o", 737 "\u1ED9": "o", 738 "\u1EDD": "o", 739 "\u1EDF": "o", 740 "\u1EE1": "o", 741 "\u1EDB": "o", 742 "\u1EE3": "o", 743 "\xF9": "u", 744 "\xFA": "u", 745 "\xFB": "u", 746 "\xFC": "u", 747 "\u1EE7": "u", 748 "\u1EE5": "u", 749 "\u1EED": "u", 750 "\u1EEF": "u", 751 "\u1EF1": "u", 752 "\xFD": "y", 753 "\xFF": "y", 754 "\u0100": "A", 755 "\u0101": "a", 756 "\u0102": "A", 757 "\u0103": "a", 758 "\u0104": "A", 759 "\u0105": "a", 760 "\u0106": "C", 761 "\u0107": "c", 762 "\u0108": "C", 763 "\u0109": "c", 764 "\u010A": "C", 765 "\u010B": "c", 766 "\u010C": "C", 767 "\u010D": "c", 768 "C\u0306": "C", 769 "c\u0306": "c", 770 "\u010E": "D", 771 "\u010F": "d", 772 "\u0110": "D", 773 "\u0111": "d", 774 "\u0112": "E", 775 "\u0113": "e", 776 "\u0114": "E", 777 "\u0115": "e", 778 "\u0116": "E", 779 "\u0117": "e", 780 "\u0118": "E", 781 "\u0119": "e", 782 "\u011A": "E", 783 "\u011B": "e", 784 "\u011C": "G", 785 "\u01F4": "G", 786 "\u011D": "g", 787 "\u01F5": "g", 788 "\u011E": "G", 789 "\u011F": "g", 790 "\u0120": "G", 791 "\u0121": "g", 792 "\u0122": "G", 793 "\u0123": "g", 794 "\u0124": "H", 795 "\u0125": "h", 796 "\u0126": "H", 797 "\u0127": "h", 798 "\u1E2A": "H", 799 "\u1E2B": "h", 800 "\u0128": "I", 801 "\u0129": "i", 802 "\u012A": "I", 803 "\u012B": "i", 804 "\u012C": "I", 805 "\u012D": "i", 806 "\u012E": "I", 807 "\u012F": "i", 808 "\u0130": "I", 809 "\u0131": "i", 810 "\u0132": "IJ", 811 "\u0133": "ij", 812 "\u0134": "J", 813 "\u0135": "j", 814 "\u0136": "K", 815 "\u0137": "k", 816 "\u1E30": "K", 817 "\u1E31": "k", 818 "K\u0306": "K", 819 "k\u0306": "k", 820 "\u0139": "L", 821 "\u013A": "l", 822 "\u013B": "L", 823 "\u013C": "l", 824 "\u013D": "L", 825 "\u013E": "l", 826 "\u013F": "L", 827 "\u0140": "l", 828 "\u0141": "l", 829 "\u0142": "l", 830 "\u1E3E": "M", 831 "\u1E3F": "m", 832 "M\u0306": "M", 833 "m\u0306": "m", 834 "\u0143": "N", 835 "\u0144": "n", 836 "\u0145": "N", 837 "\u0146": "n", 838 "\u0147": "N", 839 "\u0148": "n", 840 "\u0149": "n", 841 "N\u0306": "N", 842 "n\u0306": "n", 843 "\u014C": "O", 844 "\u014D": "o", 845 "\u014E": "O", 846 "\u014F": "o", 847 "\u0150": "O", 848 "\u0151": "o", 849 "\u0152": "OE", 850 "\u0153": "oe", 851 "P\u0306": "P", 852 "p\u0306": "p", 853 "\u0154": "R", 854 "\u0155": "r", 855 "\u0156": "R", 856 "\u0157": "r", 857 "\u0158": "R", 858 "\u0159": "r", 859 "R\u0306": "R", 860 "r\u0306": "r", 861 "\u0212": "R", 862 "\u0213": "r", 863 "\u015A": "S", 864 "\u015B": "s", 865 "\u015C": "S", 866 "\u015D": "s", 867 "\u015E": "S", 868 "\u0218": "S", 869 "\u0219": "s", 870 "\u015F": "s", 871 "\u0160": "S", 872 "\u0161": "s", 873 "\u0162": "T", 874 "\u0163": "t", 875 "\u021B": "t", 876 "\u021A": "T", 877 "\u0164": "T", 878 "\u0165": "t", 879 "\u0166": "T", 880 "\u0167": "t", 881 "T\u0306": "T", 882 "t\u0306": "t", 883 "\u0168": "U", 884 "\u0169": "u", 885 "\u016A": "U", 886 "\u016B": "u", 887 "\u016C": "U", 888 "\u016D": "u", 889 "\u016E": "U", 890 "\u016F": "u", 891 "\u0170": "U", 892 "\u0171": "u", 893 "\u0172": "U", 894 "\u0173": "u", 895 "\u0216": "U", 896 "\u0217": "u", 897 "V\u0306": "V", 898 "v\u0306": "v", 899 "\u0174": "W", 900 "\u0175": "w", 901 "\u1E82": "W", 902 "\u1E83": "w", 903 "X\u0306": "X", 904 "x\u0306": "x", 905 "\u0176": "Y", 906 "\u0177": "y", 907 "\u0178": "Y", 908 "Y\u0306": "Y", 909 "y\u0306": "y", 910 "\u0179": "Z", 911 "\u017A": "z", 912 "\u017B": "Z", 913 "\u017C": "z", 914 "\u017D": "Z", 915 "\u017E": "z", 916 "\u017F": "s", 917 "\u0192": "f", 918 "\u01A0": "O", 919 "\u01A1": "o", 920 "\u01AF": "U", 921 "\u01B0": "u", 922 "\u01CD": "A", 923 "\u01CE": "a", 924 "\u01CF": "I", 925 "\u01D0": "i", 926 "\u01D1": "O", 927 "\u01D2": "o", 928 "\u01D3": "U", 929 "\u01D4": "u", 930 "\u01D5": "U", 931 "\u01D6": "u", 932 "\u01D7": "U", 933 "\u01D8": "u", 934 "\u01D9": "U", 935 "\u01DA": "u", 936 "\u01DB": "U", 937 "\u01DC": "u", 938 "\u1EE8": "U", 939 "\u1EE9": "u", 940 "\u1E78": "U", 941 "\u1E79": "u", 942 "\u01FA": "A", 943 "\u01FB": "a", 944 "\u01FC": "AE", 945 "\u01FD": "ae", 946 "\u01FE": "O", 947 "\u01FF": "o", 948 "\xDE": "TH", 949 "\xFE": "th", 950 "\u1E54": "P", 951 "\u1E55": "p", 952 "\u1E64": "S", 953 "\u1E65": "s", 954 "X\u0301": "X", 955 "x\u0301": "x", 956 "\u0403": "\u0413", 957 "\u0453": "\u0433", 958 "\u040C": "\u041A", 959 "\u045C": "\u043A", 960 "A\u030B": "A", 961 "a\u030B": "a", 962 "E\u030B": "E", 963 "e\u030B": "e", 964 "I\u030B": "I", 965 "i\u030B": "i", 966 "\u01F8": "N", 967 "\u01F9": "n", 968 "\u1ED2": "O", 969 "\u1ED3": "o", 970 "\u1E50": "O", 971 "\u1E51": "o", 972 "\u1EEA": "U", 973 "\u1EEB": "u", 974 "\u1E80": "W", 975 "\u1E81": "w", 976 "\u1EF2": "Y", 977 "\u1EF3": "y", 978 "\u0200": "A", 979 "\u0201": "a", 980 "\u0204": "E", 981 "\u0205": "e", 982 "\u0208": "I", 983 "\u0209": "i", 984 "\u020C": "O", 985 "\u020D": "o", 986 "\u0210": "R", 987 "\u0211": "r", 988 "\u0214": "U", 989 "\u0215": "u", 990 "B\u030C": "B", 991 "b\u030C": "b", 992 "\u010C\u0323": "C", 993 "\u010D\u0323": "c", 994 "\xCA\u030C": "E", 995 "\xEA\u030C": "e", 996 "F\u030C": "F", 997 "f\u030C": "f", 998 "\u01E6": "G", 999 "\u01E7": "g", 1000 "\u021E": "H", 1001 "\u021F": "h", 1002 "J\u030C": "J", 1003 "\u01F0": "j", 1004 "\u01E8": "K", 1005 "\u01E9": "k", 1006 "M\u030C": "M", 1007 "m\u030C": "m", 1008 "P\u030C": "P", 1009 "p\u030C": "p", 1010 "Q\u030C": "Q", 1011 "q\u030C": "q", 1012 "\u0158\u0329": "R", 1013 "\u0159\u0329": "r", 1014 "\u1E66": "S", 1015 "\u1E67": "s", 1016 "V\u030C": "V", 1017 "v\u030C": "v", 1018 "W\u030C": "W", 1019 "w\u030C": "w", 1020 "X\u030C": "X", 1021 "x\u030C": "x", 1022 "Y\u030C": "Y", 1023 "y\u030C": "y", 1024 "A\u0327": "A", 1025 "a\u0327": "a", 1026 "B\u0327": "B", 1027 "b\u0327": "b", 1028 "\u1E10": "D", 1029 "\u1E11": "d", 1030 "\u0228": "E", 1031 "\u0229": "e", 1032 "\u0190\u0327": "E", 1033 "\u025B\u0327": "e", 1034 "\u1E28": "H", 1035 "\u1E29": "h", 1036 "I\u0327": "I", 1037 "i\u0327": "i", 1038 "\u0197\u0327": "I", 1039 "\u0268\u0327": "i", 1040 "M\u0327": "M", 1041 "m\u0327": "m", 1042 "O\u0327": "O", 1043 "o\u0327": "o", 1044 "Q\u0327": "Q", 1045 "q\u0327": "q", 1046 "U\u0327": "U", 1047 "u\u0327": "u", 1048 "X\u0327": "X", 1049 "x\u0327": "x", 1050 "Z\u0327": "Z", 1051 "z\u0327": "z", 1052 "\u0439": "\u0438", 1053 "\u0419": "\u0418", 1054 "\u0451": "\u0435", 1055 "\u0401": "\u0415" 1056 }; 1057 var chars = Object.keys(characterMap).join("|"); 1058 var allAccents = new RegExp(chars, "g"); 1059 var firstAccent = new RegExp(chars, ""); 1060 function matcher(match3) { 1061 return characterMap[match3]; 1062 } 1063 var removeAccents3 = function(string) { 1064 return string.replace(allAccents, matcher); 1065 }; 1066 var hasAccents = function(string) { 1067 return !!string.match(firstAccent); 1068 }; 1069 module.exports = removeAccents3; 1070 module.exports.has = hasAccents; 1071 module.exports.remove = removeAccents3; 1072 } 1073 }); 1074 1075 // package-external:@wordpress/warning 1076 var require_warning = __commonJS({ 1077 "package-external:@wordpress/warning"(exports, module) { 1078 module.exports = window.wp.warning; 1079 } 1080 }); 1081 1082 // package-external:@wordpress/media-utils 1083 var require_media_utils = __commonJS({ 1084 "package-external:@wordpress/media-utils"(exports, module) { 1085 module.exports = window.wp.mediaUtils; 1086 } 1087 }); 1088 1089 // packages/edit-site/build-module/index.mjs 1090 var index_exports = {}; 1091 __export(index_exports, { 1092 PluginMoreMenuItem: () => PluginMoreMenuItem, 1093 PluginSidebar: () => PluginSidebar, 1094 PluginSidebarMoreMenuItem: () => PluginSidebarMoreMenuItem, 1095 PluginTemplateSettingPanel: () => plugin_template_setting_panel_default, 1096 initializeEditor: () => initializeEditor, 1097 reinitializeEditor: () => reinitializeEditor, 1098 store: () => store 1099 }); 1100 var import_blocks15 = __toESM(require_blocks(), 1); 1101 var import_block_library4 = __toESM(require_block_library(), 1); 1102 var import_data90 = __toESM(require_data(), 1); 1103 var import_deprecated6 = __toESM(require_deprecated(), 1); 1104 var import_element196 = __toESM(require_element(), 1); 1105 var import_editor46 = __toESM(require_editor(), 1); 1106 var import_preferences13 = __toESM(require_preferences(), 1); 1107 var import_widgets = __toESM(require_widgets(), 1); 1108 1109 // packages/edit-site/build-module/store/index.mjs 1110 var import_data3 = __toESM(require_data(), 1); 1111 1112 // packages/edit-site/build-module/store/reducer.mjs 1113 var import_data = __toESM(require_data(), 1); 1114 function settings(state = {}, action) { 1115 switch (action.type) { 1116 case "UPDATE_SETTINGS": 1117 return { 1118 ...state, 1119 ...action.settings 1120 }; 1121 } 1122 return state; 1123 } 1124 function editedPost(state = {}, action) { 1125 switch (action.type) { 1126 case "SET_EDITED_POST": 1127 return { 1128 postType: action.postType, 1129 id: action.id, 1130 context: action.context 1131 }; 1132 case "SET_EDITED_POST_CONTEXT": 1133 return { 1134 ...state, 1135 context: action.context 1136 }; 1137 } 1138 return state; 1139 } 1140 function saveViewPanel(state = false, action) { 1141 switch (action.type) { 1142 case "SET_IS_SAVE_VIEW_OPENED": 1143 return action.isOpen; 1144 } 1145 return state; 1146 } 1147 function routes(state = [], action) { 1148 switch (action.type) { 1149 case "REGISTER_ROUTE": 1150 return [...state, action.route]; 1151 case "UNREGISTER_ROUTE": 1152 return state.filter((route) => route.name !== action.name); 1153 } 1154 return state; 1155 } 1156 var reducer_default = (0, import_data.combineReducers)({ 1157 settings, 1158 editedPost, 1159 saveViewPanel, 1160 routes 1161 }); 1162 1163 // packages/edit-site/build-module/store/actions.mjs 1164 var actions_exports = {}; 1165 __export(actions_exports, { 1166 __experimentalSetPreviewDeviceType: () => __experimentalSetPreviewDeviceType, 1167 addTemplate: () => addTemplate, 1168 closeGeneralSidebar: () => closeGeneralSidebar, 1169 openGeneralSidebar: () => openGeneralSidebar, 1170 openNavigationPanelToMenu: () => openNavigationPanelToMenu, 1171 removeTemplate: () => removeTemplate, 1172 revertTemplate: () => revertTemplate, 1173 setEditedEntity: () => setEditedEntity, 1174 setEditedPostContext: () => setEditedPostContext, 1175 setHasPageContentFocus: () => setHasPageContentFocus, 1176 setHomeTemplateId: () => setHomeTemplateId, 1177 setIsInserterOpened: () => setIsInserterOpened, 1178 setIsListViewOpened: () => setIsListViewOpened, 1179 setIsNavigationPanelOpened: () => setIsNavigationPanelOpened, 1180 setIsSaveViewOpened: () => setIsSaveViewOpened, 1181 setNavigationMenu: () => setNavigationMenu, 1182 setNavigationPanelActiveMenu: () => setNavigationPanelActiveMenu, 1183 setPage: () => setPage, 1184 setTemplate: () => setTemplate, 1185 setTemplatePart: () => setTemplatePart, 1186 switchEditorMode: () => switchEditorMode, 1187 toggleDistractionFree: () => toggleDistractionFree, 1188 toggleFeature: () => toggleFeature, 1189 updateSettings: () => updateSettings 1190 }); 1191 var import_blocks = __toESM(require_blocks(), 1); 1192 var import_deprecated = __toESM(require_deprecated(), 1); 1193 var import_core_data = __toESM(require_core_data(), 1); 1194 var import_block_editor = __toESM(require_block_editor(), 1); 1195 var import_editor = __toESM(require_editor(), 1); 1196 var import_preferences = __toESM(require_preferences(), 1); 1197 1198 // packages/edit-site/build-module/utils/constants.mjs 1199 var import_i18n = __toESM(require_i18n(), 1); 1200 var import_patterns = __toESM(require_patterns(), 1); 1201 1202 // packages/edit-site/build-module/lock-unlock.mjs 1203 var import_private_apis = __toESM(require_private_apis(), 1); 1204 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 1205 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 1206 "@wordpress/edit-site" 1207 ); 1208 1209 // packages/edit-site/build-module/utils/constants.mjs 1210 var ATTACHMENT_POST_TYPE = "attachment"; 1211 var NAVIGATION_POST_TYPE = "wp_navigation"; 1212 var TEMPLATE_POST_TYPE = "wp_template"; 1213 var TEMPLATE_PART_POST_TYPE = "wp_template_part"; 1214 var TEMPLATE_ORIGINS = { 1215 custom: "custom", 1216 theme: "theme", 1217 plugin: "plugin" 1218 }; 1219 var TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized"; 1220 var TEMPLATE_PART_ALL_AREAS_CATEGORY = "all-parts"; 1221 var { 1222 PATTERN_TYPES, 1223 PATTERN_DEFAULT_CATEGORY, 1224 PATTERN_USER_CATEGORY, 1225 EXCLUDED_PATTERN_SOURCES, 1226 PATTERN_SYNC_TYPES 1227 } = unlock(import_patterns.privateApis); 1228 var FOCUSABLE_ENTITIES = [ 1229 TEMPLATE_PART_POST_TYPE, 1230 NAVIGATION_POST_TYPE, 1231 PATTERN_TYPES.user 1232 ]; 1233 var POST_TYPE_LABELS = { 1234 [TEMPLATE_POST_TYPE]: (0, import_i18n.__)("Template"), 1235 [TEMPLATE_PART_POST_TYPE]: (0, import_i18n.__)("Template part"), 1236 [PATTERN_TYPES.user]: (0, import_i18n.__)("Pattern"), 1237 [NAVIGATION_POST_TYPE]: (0, import_i18n.__)("Navigation") 1238 }; 1239 var LAYOUT_LIST = "list"; 1240 var OPERATOR_IS = "is"; 1241 var OPERATOR_IS_ANY = "isAny"; 1242 var OPERATOR_IS_NONE = "isNone"; 1243 var OPERATOR_BEFORE = "before"; 1244 var OPERATOR_AFTER = "after"; 1245 1246 // packages/edit-site/build-module/store/actions.mjs 1247 var { interfaceStore } = unlock(import_editor.privateApis); 1248 function toggleFeature(featureName) { 1249 return function({ registry }) { 1250 (0, import_deprecated.default)( 1251 "dispatch( 'core/edit-site' ).toggleFeature( featureName )", 1252 { 1253 since: "6.0", 1254 alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )" 1255 } 1256 ); 1257 registry.dispatch(import_preferences.store).toggle("core/edit-site", featureName); 1258 }; 1259 } 1260 var __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => { 1261 (0, import_deprecated.default)( 1262 "dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType", 1263 { 1264 since: "6.5", 1265 version: "6.7", 1266 hint: "registry.dispatch( editorStore ).setDeviceType" 1267 } 1268 ); 1269 registry.dispatch(import_editor.store).setDeviceType(deviceType); 1270 }; 1271 function setTemplate() { 1272 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setTemplate", { 1273 since: "6.5", 1274 version: "6.8", 1275 hint: "The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically." 1276 }); 1277 return { 1278 type: "NOTHING" 1279 }; 1280 } 1281 var addTemplate = (template) => async ({ dispatch: dispatch2, registry }) => { 1282 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).addTemplate", { 1283 since: "6.5", 1284 version: "6.8", 1285 hint: "use saveEntityRecord directly" 1286 }); 1287 const newTemplate = await registry.dispatch(import_core_data.store).saveEntityRecord("postType", TEMPLATE_POST_TYPE, template); 1288 if (template.content) { 1289 registry.dispatch(import_core_data.store).editEntityRecord( 1290 "postType", 1291 TEMPLATE_POST_TYPE, 1292 newTemplate.id, 1293 { blocks: (0, import_blocks.parse)(template.content) }, 1294 { undoIgnore: true } 1295 ); 1296 } 1297 dispatch2({ 1298 type: "SET_EDITED_POST", 1299 postType: TEMPLATE_POST_TYPE, 1300 id: newTemplate.id 1301 }); 1302 }; 1303 var removeTemplate = (template) => ({ registry }) => { 1304 return unlock(registry.dispatch(import_editor.store)).removeTemplates([ 1305 template 1306 ]); 1307 }; 1308 function setTemplatePart(templatePartId) { 1309 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setTemplatePart", { 1310 since: "6.8" 1311 }); 1312 return { 1313 type: "SET_EDITED_POST", 1314 postType: TEMPLATE_PART_POST_TYPE, 1315 id: templatePartId 1316 }; 1317 } 1318 function setNavigationMenu(navigationMenuId) { 1319 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setNavigationMenu", { 1320 since: "6.8" 1321 }); 1322 return { 1323 type: "SET_EDITED_POST", 1324 postType: NAVIGATION_POST_TYPE, 1325 id: navigationMenuId 1326 }; 1327 } 1328 function setEditedEntity(postType2, postId, context) { 1329 return { 1330 type: "SET_EDITED_POST", 1331 postType: postType2, 1332 id: postId, 1333 context 1334 }; 1335 } 1336 function setHomeTemplateId() { 1337 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setHomeTemplateId", { 1338 since: "6.2", 1339 version: "6.4" 1340 }); 1341 return { 1342 type: "NOTHING" 1343 }; 1344 } 1345 function setEditedPostContext(context) { 1346 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setEditedPostContext", { 1347 since: "6.8" 1348 }); 1349 return { 1350 type: "SET_EDITED_POST_CONTEXT", 1351 context 1352 }; 1353 } 1354 function setPage() { 1355 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setPage", { 1356 since: "6.5", 1357 version: "6.8", 1358 hint: "The setPage is not needed anymore, the correct entity is resolved from the URL automatically." 1359 }); 1360 return { type: "NOTHING" }; 1361 } 1362 function setNavigationPanelActiveMenu() { 1363 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", { 1364 since: "6.2", 1365 version: "6.4" 1366 }); 1367 return { type: "NOTHING" }; 1368 } 1369 function openNavigationPanelToMenu() { 1370 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", { 1371 since: "6.2", 1372 version: "6.4" 1373 }); 1374 return { type: "NOTHING" }; 1375 } 1376 function setIsNavigationPanelOpened() { 1377 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", { 1378 since: "6.2", 1379 version: "6.4" 1380 }); 1381 return { type: "NOTHING" }; 1382 } 1383 var setIsInserterOpened = (value) => ({ registry }) => { 1384 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setIsInserterOpened", { 1385 since: "6.5", 1386 alternative: "dispatch( 'core/editor').setIsInserterOpened" 1387 }); 1388 registry.dispatch(import_editor.store).setIsInserterOpened(value); 1389 }; 1390 var setIsListViewOpened = (isOpen) => ({ registry }) => { 1391 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setIsListViewOpened", { 1392 since: "6.5", 1393 alternative: "dispatch( 'core/editor').setIsListViewOpened" 1394 }); 1395 registry.dispatch(import_editor.store).setIsListViewOpened(isOpen); 1396 }; 1397 function updateSettings(settings2) { 1398 return { 1399 type: "UPDATE_SETTINGS", 1400 settings: settings2 1401 }; 1402 } 1403 function setIsSaveViewOpened(isOpen) { 1404 return { 1405 type: "SET_IS_SAVE_VIEW_OPENED", 1406 isOpen 1407 }; 1408 } 1409 var revertTemplate = (template, options) => ({ registry }) => { 1410 return unlock(registry.dispatch(import_editor.store)).revertTemplate( 1411 template, 1412 options 1413 ); 1414 }; 1415 var openGeneralSidebar = (name2) => ({ registry }) => { 1416 registry.dispatch(interfaceStore).enableComplementaryArea("core", name2); 1417 }; 1418 var closeGeneralSidebar = () => ({ registry }) => { 1419 registry.dispatch(interfaceStore).disableComplementaryArea("core"); 1420 }; 1421 var switchEditorMode = (mode) => ({ registry }) => { 1422 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).switchEditorMode", { 1423 since: "6.6", 1424 alternative: "dispatch( 'core/editor').switchEditorMode" 1425 }); 1426 registry.dispatch(import_editor.store).switchEditorMode(mode); 1427 }; 1428 var setHasPageContentFocus = (hasPageContentFocus2) => ({ dispatch: dispatch2, registry }) => { 1429 (0, import_deprecated.default)(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, { 1430 since: "6.5" 1431 }); 1432 if (hasPageContentFocus2) { 1433 registry.dispatch(import_block_editor.store).clearSelectedBlock(); 1434 } 1435 dispatch2({ 1436 type: "SET_HAS_PAGE_CONTENT_FOCUS", 1437 hasPageContentFocus: hasPageContentFocus2 1438 }); 1439 }; 1440 var toggleDistractionFree = () => ({ registry }) => { 1441 (0, import_deprecated.default)("dispatch( 'core/edit-site' ).toggleDistractionFree", { 1442 since: "6.6", 1443 alternative: "dispatch( 'core/editor').toggleDistractionFree" 1444 }); 1445 registry.dispatch(import_editor.store).toggleDistractionFree(); 1446 }; 1447 1448 // packages/edit-site/build-module/store/private-actions.mjs 1449 var private_actions_exports = {}; 1450 __export(private_actions_exports, { 1451 registerRoute: () => registerRoute, 1452 unregisterRoute: () => unregisterRoute 1453 }); 1454 function registerRoute(route) { 1455 return { 1456 type: "REGISTER_ROUTE", 1457 route 1458 }; 1459 } 1460 function unregisterRoute(name2) { 1461 return { 1462 type: "UNREGISTER_ROUTE", 1463 name: name2 1464 }; 1465 } 1466 1467 // packages/edit-site/build-module/store/selectors.mjs 1468 var selectors_exports = {}; 1469 __export(selectors_exports, { 1470 __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint, 1471 __experimentalGetPreviewDeviceType: () => __experimentalGetPreviewDeviceType, 1472 getCanUserCreateMedia: () => getCanUserCreateMedia, 1473 getCurrentTemplateNavigationPanelSubMenu: () => getCurrentTemplateNavigationPanelSubMenu, 1474 getCurrentTemplateTemplateParts: () => getCurrentTemplateTemplateParts, 1475 getEditedPostContext: () => getEditedPostContext, 1476 getEditedPostId: () => getEditedPostId, 1477 getEditedPostType: () => getEditedPostType, 1478 getEditorMode: () => getEditorMode, 1479 getHomeTemplateId: () => getHomeTemplateId, 1480 getNavigationPanelActiveMenu: () => getNavigationPanelActiveMenu, 1481 getPage: () => getPage, 1482 getReusableBlocks: () => getReusableBlocks, 1483 getSettings: () => getSettings, 1484 hasPageContentFocus: () => hasPageContentFocus, 1485 isFeatureActive: () => isFeatureActive, 1486 isInserterOpened: () => isInserterOpened, 1487 isListViewOpened: () => isListViewOpened, 1488 isNavigationOpened: () => isNavigationOpened, 1489 isPage: () => isPage, 1490 isSaveViewOpened: () => isSaveViewOpened 1491 }); 1492 var import_core_data2 = __toESM(require_core_data(), 1); 1493 var import_data2 = __toESM(require_data(), 1); 1494 var import_deprecated2 = __toESM(require_deprecated(), 1); 1495 var import_preferences2 = __toESM(require_preferences(), 1); 1496 var import_editor2 = __toESM(require_editor(), 1); 1497 var import_block_editor2 = __toESM(require_block_editor(), 1); 1498 1499 // packages/edit-site/build-module/utils/get-filtered-template-parts.mjs 1500 var import_blocks2 = __toESM(require_blocks(), 1); 1501 var EMPTY_ARRAY = []; 1502 function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) { 1503 const templatePartsById = templateParts ? ( 1504 // Key template parts by their ID. 1505 templateParts.reduce( 1506 (newTemplateParts, part) => ({ 1507 ...newTemplateParts, 1508 [part.id]: part 1509 }), 1510 {} 1511 ) 1512 ) : {}; 1513 const result = []; 1514 const stack = [...blocks]; 1515 while (stack.length) { 1516 const { innerBlocks, ...block } = stack.shift(); 1517 stack.unshift(...innerBlocks); 1518 if ((0, import_blocks2.isTemplatePart)(block)) { 1519 const { 1520 attributes: { theme, slug } 1521 } = block; 1522 const templatePartId = `$theme}//${slug}`; 1523 const templatePart = templatePartsById[templatePartId]; 1524 if (templatePart) { 1525 result.push({ 1526 templatePart, 1527 block 1528 }); 1529 } 1530 } 1531 } 1532 return result; 1533 } 1534 1535 // packages/edit-site/build-module/store/selectors.mjs 1536 var isFeatureActive = (0, import_data2.createRegistrySelector)( 1537 (select4) => (_, featureName) => { 1538 (0, import_deprecated2.default)(`select( 'core/edit-site' ).isFeatureActive`, { 1539 since: "6.0", 1540 alternative: `select( 'core/preferences' ).get` 1541 }); 1542 return !!select4(import_preferences2.store).get( 1543 "core/edit-site", 1544 featureName 1545 ); 1546 } 1547 ); 1548 var __experimentalGetPreviewDeviceType = (0, import_data2.createRegistrySelector)( 1549 (select4) => () => { 1550 (0, import_deprecated2.default)( 1551 `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, 1552 { 1553 since: "6.5", 1554 version: "6.7", 1555 alternative: `select( 'core/editor' ).getDeviceType` 1556 } 1557 ); 1558 return select4(import_editor2.store).getDeviceType(); 1559 } 1560 ); 1561 var getCanUserCreateMedia = (0, import_data2.createRegistrySelector)( 1562 (select4) => () => { 1563 (0, import_deprecated2.default)( 1564 `wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`, 1565 { 1566 since: "6.7", 1567 alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )` 1568 } 1569 ); 1570 return select4(import_core_data2.store).canUser("create", "media"); 1571 } 1572 ); 1573 var getReusableBlocks = (0, import_data2.createRegistrySelector)((select4) => () => { 1574 (0, import_deprecated2.default)(`select( 'core/edit-site' ).getReusableBlocks()`, { 1575 since: "6.5", 1576 version: "6.8", 1577 alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )` 1578 }); 1579 return select4(import_core_data2.store).getEntityRecords("postType", "wp_block", { 1580 per_page: -1 1581 }); 1582 }); 1583 function getSettings(state) { 1584 return state.settings; 1585 } 1586 function getHomeTemplateId() { 1587 (0, import_deprecated2.default)("select( 'core/edit-site' ).getHomeTemplateId", { 1588 since: "6.2", 1589 version: "6.4" 1590 }); 1591 } 1592 function getEditedPostType(state) { 1593 (0, import_deprecated2.default)("select( 'core/edit-site' ).getEditedPostType", { 1594 since: "6.8", 1595 alternative: "select( 'core/editor' ).getCurrentPostType" 1596 }); 1597 return state.editedPost.postType; 1598 } 1599 function getEditedPostId(state) { 1600 (0, import_deprecated2.default)("select( 'core/edit-site' ).getEditedPostId", { 1601 since: "6.8", 1602 alternative: "select( 'core/editor' ).getCurrentPostId" 1603 }); 1604 return state.editedPost.id; 1605 } 1606 function getEditedPostContext(state) { 1607 (0, import_deprecated2.default)("select( 'core/edit-site' ).getEditedPostContext", { 1608 since: "6.8" 1609 }); 1610 return state.editedPost.context; 1611 } 1612 function getPage(state) { 1613 (0, import_deprecated2.default)("select( 'core/edit-site' ).getPage", { 1614 since: "6.8" 1615 }); 1616 return { context: state.editedPost.context }; 1617 } 1618 var isInserterOpened = (0, import_data2.createRegistrySelector)((select4) => () => { 1619 (0, import_deprecated2.default)(`select( 'core/edit-site' ).isInserterOpened`, { 1620 since: "6.5", 1621 alternative: `select( 'core/editor' ).isInserterOpened` 1622 }); 1623 return select4(import_editor2.store).isInserterOpened(); 1624 }); 1625 var __experimentalGetInsertionPoint = (0, import_data2.createRegistrySelector)( 1626 (select4) => () => { 1627 (0, import_deprecated2.default)( 1628 `select( 'core/edit-site' ).__experimentalGetInsertionPoint`, 1629 { 1630 since: "6.5", 1631 version: "6.7" 1632 } 1633 ); 1634 return unlock(select4(import_editor2.store)).getInserter(); 1635 } 1636 ); 1637 var isListViewOpened = (0, import_data2.createRegistrySelector)((select4) => () => { 1638 (0, import_deprecated2.default)(`select( 'core/edit-site' ).isListViewOpened`, { 1639 since: "6.5", 1640 alternative: `select( 'core/editor' ).isListViewOpened` 1641 }); 1642 return select4(import_editor2.store).isListViewOpened(); 1643 }); 1644 function isSaveViewOpened(state) { 1645 return state.saveViewPanel; 1646 } 1647 function getBlocksAndTemplateParts(select4) { 1648 const templateParts = select4(import_core_data2.store).getEntityRecords( 1649 "postType", 1650 TEMPLATE_PART_POST_TYPE, 1651 { per_page: -1 } 1652 ); 1653 const { getBlocksByName, getBlocksByClientId } = select4(import_block_editor2.store); 1654 const clientIds = getBlocksByName("core/template-part"); 1655 const blocks = getBlocksByClientId(clientIds); 1656 return [blocks, templateParts]; 1657 } 1658 var getCurrentTemplateTemplateParts = (0, import_data2.createRegistrySelector)( 1659 (select4) => (0, import_data2.createSelector)( 1660 () => { 1661 (0, import_deprecated2.default)( 1662 `select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`, 1663 { 1664 since: "6.7", 1665 version: "6.9", 1666 alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )` 1667 } 1668 ); 1669 return getFilteredTemplatePartBlocks( 1670 ...getBlocksAndTemplateParts(select4) 1671 ); 1672 }, 1673 () => getBlocksAndTemplateParts(select4) 1674 ) 1675 ); 1676 var getEditorMode = (0, import_data2.createRegistrySelector)((select4) => () => { 1677 return select4(import_preferences2.store).get("core", "editorMode"); 1678 }); 1679 function getCurrentTemplateNavigationPanelSubMenu() { 1680 (0, import_deprecated2.default)( 1681 "dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu", 1682 { 1683 since: "6.2", 1684 version: "6.4" 1685 } 1686 ); 1687 } 1688 function getNavigationPanelActiveMenu() { 1689 (0, import_deprecated2.default)("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", { 1690 since: "6.2", 1691 version: "6.4" 1692 }); 1693 } 1694 function isNavigationOpened() { 1695 (0, import_deprecated2.default)("dispatch( 'core/edit-site' ).isNavigationOpened", { 1696 since: "6.2", 1697 version: "6.4" 1698 }); 1699 } 1700 function isPage(state) { 1701 (0, import_deprecated2.default)("select( 'core/edit-site' ).isPage", { 1702 since: "6.8", 1703 alternative: "select( 'core/editor' ).getCurrentPostType" 1704 }); 1705 return !!state.editedPost.context?.postId; 1706 } 1707 function hasPageContentFocus() { 1708 (0, import_deprecated2.default)(`select( 'core/edit-site' ).hasPageContentFocus`, { 1709 since: "6.5" 1710 }); 1711 return false; 1712 } 1713 1714 // packages/edit-site/build-module/store/private-selectors.mjs 1715 var private_selectors_exports = {}; 1716 __export(private_selectors_exports, { 1717 getRoutes: () => getRoutes 1718 }); 1719 function getRoutes(state) { 1720 return state.routes; 1721 } 1722 1723 // packages/edit-site/build-module/store/constants.mjs 1724 var STORE_NAME = "core/edit-site"; 1725 1726 // packages/edit-site/build-module/store/index.mjs 1727 var storeConfig = { 1728 reducer: reducer_default, 1729 actions: actions_exports, 1730 selectors: selectors_exports 1731 }; 1732 var store = (0, import_data3.createReduxStore)(STORE_NAME, storeConfig); 1733 (0, import_data3.register)(store); 1734 unlock(store).registerPrivateSelectors(private_selectors_exports); 1735 unlock(store).registerPrivateActions(private_actions_exports); 1736 1737 // packages/edit-site/build-module/components/app/index.mjs 1738 var import_data89 = __toESM(require_data(), 1); 1739 var import_router38 = __toESM(require_router(), 1); 1740 var import_element195 = __toESM(require_element(), 1); 1741 var import_core_data70 = __toESM(require_core_data(), 1); 1742 1743 // node_modules/clsx/dist/clsx.mjs 1744 function r(e2) { 1745 var t3, f2, n2 = ""; 1746 if ("string" == typeof e2 || "number" == typeof e2) n2 += e2; 1747 else if ("object" == typeof e2) if (Array.isArray(e2)) { 1748 var o3 = e2.length; 1749 for (t3 = 0; t3 < o3; t3++) e2[t3] && (f2 = r(e2[t3])) && (n2 && (n2 += " "), n2 += f2); 1750 } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2); 1751 return n2; 1752 } 1753 function clsx() { 1754 for (var e2, t3, f2 = 0, n2 = "", o3 = arguments.length; f2 < o3; f2++) (e2 = arguments[f2]) && (t3 = r(e2)) && (n2 && (n2 += " "), n2 += t3); 1755 return n2; 1756 } 1757 var clsx_default = clsx; 1758 1759 // packages/ui/build-module/badge/badge.mjs 1760 var import_element11 = __toESM(require_element(), 1); 1761 1762 // node_modules/@base-ui/utils/esm/useControlled.js 1763 var React = __toESM(require_react(), 1); 1764 1765 // node_modules/@base-ui/utils/esm/error.js 1766 var set; 1767 if (true) { 1768 set = /* @__PURE__ */ new Set(); 1769 } 1770 function error(...messages) { 1771 if (true) { 1772 const messageKey = messages.join(" "); 1773 if (!set.has(messageKey)) { 1774 set.add(messageKey); 1775 console.error(`Base UI: $messageKey}`); 1776 } 1777 } 1778 } 1779 1780 // node_modules/@base-ui/utils/esm/useControlled.js 1781 function useControlled({ 1782 controlled, 1783 default: defaultProp, 1784 name: name2, 1785 state = "value" 1786 }) { 1787 const { 1788 current: isControlled 1789 } = React.useRef(controlled !== void 0); 1790 const [valueState, setValue] = React.useState(defaultProp); 1791 const value = isControlled ? controlled : valueState; 1792 if (true) { 1793 React.useEffect(() => { 1794 if (isControlled !== (controlled !== void 0)) { 1795 error([`A component is changing the $isControlled ? "" : "un"}controlled $state} 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")); 1796 } 1797 }, [state, name2, controlled]); 1798 const { 1799 current: defaultValue2 1800 } = React.useRef(defaultProp); 1801 React.useEffect(() => { 1802 if (!isControlled && serializeToDevModeString(defaultValue2) !== serializeToDevModeString(defaultProp)) { 1803 error([`A component is changing the default $state} state of an uncontrolled $name2} after being initialized. To suppress this warning opt to use a controlled $name2}.`].join("\n")); 1804 } 1805 }, [defaultProp]); 1806 } 1807 const setValueIfUncontrolled = React.useCallback((newValue) => { 1808 if (!isControlled) { 1809 setValue(newValue); 1810 } 1811 }, []); 1812 return [value, setValueIfUncontrolled]; 1813 } 1814 function serializeToDevModeString(input) { 1815 let nextId2 = 0; 1816 const seen = /* @__PURE__ */ new WeakMap(); 1817 try { 1818 const result = JSON.stringify(input, function replacer(key, value) { 1819 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { 1820 return void 0; 1821 } 1822 if (typeof value === "bigint") { 1823 return `__bigint__:$value}`; 1824 } 1825 if (value !== null && typeof value === "object") { 1826 const id = seen.get(value); 1827 if (id !== void 0) { 1828 return `__object__:$id}`; 1829 } 1830 seen.set(value, nextId2); 1831 nextId2 += 1; 1832 } 1833 return value; 1834 }); 1835 return result ?? `__top__:$typeof input}`; 1836 } catch { 1837 return "__unserializable__"; 1838 } 1839 } 1840 1841 // node_modules/@base-ui/utils/esm/safeReact.js 1842 var React2 = __toESM(require_react(), 1); 1843 var SafeReact = { 1844 ...React2 1845 }; 1846 1847 // node_modules/@base-ui/utils/esm/useRefWithInit.js 1848 var React3 = __toESM(require_react(), 1); 1849 var UNINITIALIZED = {}; 1850 function useRefWithInit(init2, initArg) { 1851 const ref = React3.useRef(UNINITIALIZED); 1852 if (ref.current === UNINITIALIZED) { 1853 ref.current = init2(initArg); 1854 } 1855 return ref; 1856 } 1857 1858 // node_modules/@base-ui/utils/esm/useStableCallback.js 1859 var useInsertionEffect = SafeReact.useInsertionEffect; 1860 var useSafeInsertionEffect = ( 1861 // React 17 doesn't have useInsertionEffect. 1862 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 1863 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 1864 ); 1865 function useStableCallback(callback) { 1866 const stable = useRefWithInit(createStableCallback).current; 1867 stable.next = callback; 1868 useSafeInsertionEffect(stable.effect); 1869 return stable.trampoline; 1870 } 1871 function createStableCallback() { 1872 const stable = { 1873 next: void 0, 1874 callback: assertNotCalled, 1875 trampoline: (...args) => stable.callback?.(...args), 1876 effect: () => { 1877 stable.callback = stable.next; 1878 } 1879 }; 1880 return stable; 1881 } 1882 function assertNotCalled() { 1883 if (true) { 1884 throw ( 1885 /* minify-error-disabled */ 1886 new Error("Base UI: Cannot call an event handler while rendering.") 1887 ); 1888 } 1889 } 1890 1891 // node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js 1892 var React4 = __toESM(require_react(), 1); 1893 var noop = () => { 1894 }; 1895 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; 1896 1897 // node_modules/@base-ui/utils/esm/warn.js 1898 var set2; 1899 if (true) { 1900 set2 = /* @__PURE__ */ new Set(); 1901 } 1902 function warn(...messages) { 1903 if (true) { 1904 const messageKey = messages.join(" "); 1905 if (!set2.has(messageKey)) { 1906 set2.add(messageKey); 1907 console.warn(`Base UI: $messageKey}`); 1908 } 1909 } 1910 } 1911 1912 // node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js 1913 var React5 = __toESM(require_react(), 1); 1914 var DirectionContext = /* @__PURE__ */ React5.createContext(void 0); 1915 if (true) DirectionContext.displayName = "DirectionContext"; 1916 function useDirection() { 1917 const context = React5.useContext(DirectionContext); 1918 return context?.direction ?? "ltr"; 1919 } 1920 1921 // node_modules/@base-ui/react/esm/internals/useRenderElement.js 1922 var React8 = __toESM(require_react(), 1); 1923 1924 // node_modules/@base-ui/utils/esm/useMergedRefs.js 1925 function useMergedRefs(a2, b2, c6, d2) { 1926 const forkRef = useRefWithInit(createForkRef).current; 1927 if (didChange(forkRef, a2, b2, c6, d2)) { 1928 update(forkRef, [a2, b2, c6, d2]); 1929 } 1930 return forkRef.callback; 1931 } 1932 function useMergedRefsN(refs) { 1933 const forkRef = useRefWithInit(createForkRef).current; 1934 if (didChangeN(forkRef, refs)) { 1935 update(forkRef, refs); 1936 } 1937 return forkRef.callback; 1938 } 1939 function createForkRef() { 1940 return { 1941 callback: null, 1942 cleanup: null, 1943 refs: [] 1944 }; 1945 } 1946 function didChange(forkRef, a2, b2, c6, d2) { 1947 return forkRef.refs[0] !== a2 || forkRef.refs[1] !== b2 || forkRef.refs[2] !== c6 || forkRef.refs[3] !== d2; 1948 } 1949 function didChangeN(forkRef, newRefs) { 1950 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 1951 } 1952 function update(forkRef, refs) { 1953 forkRef.refs = refs; 1954 if (refs.every((ref) => ref == null)) { 1955 forkRef.callback = null; 1956 return; 1957 } 1958 forkRef.callback = (instance) => { 1959 if (forkRef.cleanup) { 1960 forkRef.cleanup(); 1961 forkRef.cleanup = null; 1962 } 1963 if (instance != null) { 1964 const cleanupCallbacks = Array(refs.length).fill(null); 1965 for (let i2 = 0; i2 < refs.length; i2 += 1) { 1966 const ref = refs[i2]; 1967 if (ref == null) { 1968 continue; 1969 } 1970 switch (typeof ref) { 1971 case "function": { 1972 const refCleanup = ref(instance); 1973 if (typeof refCleanup === "function") { 1974 cleanupCallbacks[i2] = refCleanup; 1975 } 1976 break; 1977 } 1978 case "object": { 1979 ref.current = instance; 1980 break; 1981 } 1982 default: 1983 } 1984 } 1985 forkRef.cleanup = () => { 1986 for (let i2 = 0; i2 < refs.length; i2 += 1) { 1987 const ref = refs[i2]; 1988 if (ref == null) { 1989 continue; 1990 } 1991 switch (typeof ref) { 1992 case "function": { 1993 const cleanupCallback = cleanupCallbacks[i2]; 1994 if (typeof cleanupCallback === "function") { 1995 cleanupCallback(); 1996 } else { 1997 ref(null); 1998 } 1999 break; 2000 } 2001 case "object": { 2002 ref.current = null; 2003 break; 2004 } 2005 default: 2006 } 2007 } 2008 }; 2009 } 2010 }; 2011 } 2012 2013 // node_modules/@base-ui/utils/esm/getReactElementRef.js 2014 var React7 = __toESM(require_react(), 1); 2015 2016 // node_modules/@base-ui/utils/esm/reactVersion.js 2017 var React6 = __toESM(require_react(), 1); 2018 var majorVersion = parseInt(React6.version, 10); 2019 function isReactVersionAtLeast(reactVersionToCheck) { 2020 return majorVersion >= reactVersionToCheck; 2021 } 2022 2023 // node_modules/@base-ui/utils/esm/getReactElementRef.js 2024 function getReactElementRef(element) { 2025 if (!/* @__PURE__ */ React7.isValidElement(element)) { 2026 return null; 2027 } 2028 const reactElement = element; 2029 const propsWithRef = reactElement.props; 2030 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 2031 } 2032 2033 // node_modules/@base-ui/utils/esm/mergeObjects.js 2034 function mergeObjects(a2, b2) { 2035 if (a2 && !b2) { 2036 return a2; 2037 } 2038 if (!a2 && b2) { 2039 return b2; 2040 } 2041 if (a2 || b2) { 2042 return { 2043 ...a2, 2044 ...b2 2045 }; 2046 } 2047 return void 0; 2048 } 2049 2050 // node_modules/@base-ui/utils/esm/empty.js 2051 function NOOP() { 2052 } 2053 var EMPTY_ARRAY2 = Object.freeze([]); 2054 var EMPTY_OBJECT = Object.freeze({}); 2055 2056 // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js 2057 function getStateAttributesProps(state, customMapping) { 2058 const props = {}; 2059 for (const key in state) { 2060 const value = state[key]; 2061 if (customMapping?.hasOwnProperty(key)) { 2062 const customProps = customMapping[key](value); 2063 if (customProps != null) { 2064 Object.assign(props, customProps); 2065 } 2066 continue; 2067 } 2068 if (value === true) { 2069 props[`data-$key.toLowerCase()}`] = ""; 2070 } else if (value) { 2071 props[`data-$key.toLowerCase()}`] = value.toString(); 2072 } 2073 } 2074 return props; 2075 } 2076 2077 // node_modules/@base-ui/react/esm/utils/resolveClassName.js 2078 function resolveClassName(className, state) { 2079 return typeof className === "function" ? className(state) : className; 2080 } 2081 2082 // node_modules/@base-ui/react/esm/utils/resolveStyle.js 2083 function resolveStyle(style, state) { 2084 return typeof style === "function" ? style(state) : style; 2085 } 2086 2087 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js 2088 var EMPTY_PROPS = {}; 2089 function mergeProps(a2, b2, c6, d2, e2) { 2090 if (!c6 && !d2 && !e2 && !a2) { 2091 return createInitialMergedProps(b2); 2092 } 2093 let merged = createInitialMergedProps(a2); 2094 if (b2) { 2095 merged = mergeInto(merged, b2); 2096 } 2097 if (c6) { 2098 merged = mergeInto(merged, c6); 2099 } 2100 if (d2) { 2101 merged = mergeInto(merged, d2); 2102 } 2103 if (e2) { 2104 merged = mergeInto(merged, e2); 2105 } 2106 return merged; 2107 } 2108 function mergePropsN(props) { 2109 if (props.length === 0) { 2110 return EMPTY_PROPS; 2111 } 2112 if (props.length === 1) { 2113 return createInitialMergedProps(props[0]); 2114 } 2115 let merged = createInitialMergedProps(props[0]); 2116 for (let i2 = 1; i2 < props.length; i2 += 1) { 2117 merged = mergeInto(merged, props[i2]); 2118 } 2119 return merged; 2120 } 2121 function createInitialMergedProps(inputProps) { 2122 if (isPropsGetter(inputProps)) { 2123 return { 2124 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 2125 }; 2126 } 2127 return copyInitialProps(inputProps); 2128 } 2129 function mergeInto(merged, inputProps) { 2130 if (isPropsGetter(inputProps)) { 2131 return resolvePropsGetter(inputProps, merged); 2132 } 2133 return mutablyMergeInto(merged, inputProps); 2134 } 2135 function copyInitialProps(inputProps) { 2136 const copiedProps = { 2137 ...inputProps 2138 }; 2139 for (const propName in copiedProps) { 2140 const propValue = copiedProps[propName]; 2141 if (isEventHandler(propName, propValue)) { 2142 copiedProps[propName] = wrapEventHandler(propValue); 2143 } 2144 } 2145 return copiedProps; 2146 } 2147 function mutablyMergeInto(mergedProps, externalProps) { 2148 if (!externalProps) { 2149 return mergedProps; 2150 } 2151 for (const propName in externalProps) { 2152 const externalPropValue = externalProps[propName]; 2153 switch (propName) { 2154 case "style": { 2155 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 2156 break; 2157 } 2158 case "className": { 2159 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 2160 break; 2161 } 2162 default: { 2163 if (isEventHandler(propName, externalPropValue)) { 2164 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 2165 } else { 2166 mergedProps[propName] = externalPropValue; 2167 } 2168 } 2169 } 2170 } 2171 return mergedProps; 2172 } 2173 function isEventHandler(key, value) { 2174 const code0 = key.charCodeAt(0); 2175 const code1 = key.charCodeAt(1); 2176 const code2 = key.charCodeAt(2); 2177 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 2178 } 2179 function isPropsGetter(inputProps) { 2180 return typeof inputProps === "function"; 2181 } 2182 function resolvePropsGetter(inputProps, previousProps) { 2183 if (isPropsGetter(inputProps)) { 2184 return inputProps(previousProps); 2185 } 2186 return inputProps ?? EMPTY_PROPS; 2187 } 2188 function mergeEventHandlers(ourHandler, theirHandler) { 2189 if (!theirHandler) { 2190 return ourHandler; 2191 } 2192 if (!ourHandler) { 2193 return wrapEventHandler(theirHandler); 2194 } 2195 return (...args) => { 2196 const event = args[0]; 2197 if (isSyntheticEvent(event)) { 2198 const baseUIEvent = event; 2199 makeEventPreventable(baseUIEvent); 2200 const result2 = theirHandler(...args); 2201 if (!baseUIEvent.baseUIHandlerPrevented) { 2202 ourHandler?.(...args); 2203 } 2204 return result2; 2205 } 2206 const result = theirHandler(...args); 2207 ourHandler?.(...args); 2208 return result; 2209 }; 2210 } 2211 function wrapEventHandler(handler) { 2212 if (!handler) { 2213 return handler; 2214 } 2215 return (...args) => { 2216 const event = args[0]; 2217 if (isSyntheticEvent(event)) { 2218 makeEventPreventable(event); 2219 } 2220 return handler(...args); 2221 }; 2222 } 2223 function makeEventPreventable(event) { 2224 event.preventBaseUIHandler = () => { 2225 event.baseUIHandlerPrevented = true; 2226 }; 2227 return event; 2228 } 2229 function mergeClassNames(ourClassName, theirClassName) { 2230 if (theirClassName) { 2231 if (ourClassName) { 2232 return theirClassName + " " + ourClassName; 2233 } 2234 return theirClassName; 2235 } 2236 return ourClassName; 2237 } 2238 function isSyntheticEvent(event) { 2239 return event != null && typeof event === "object" && "nativeEvent" in event; 2240 } 2241 2242 // node_modules/@base-ui/react/esm/internals/useRenderElement.js 2243 var import_react = __toESM(require_react(), 1); 2244 function useRenderElement(element, componentProps, params = {}) { 2245 const renderProp = componentProps.render; 2246 const outProps = useRenderElementProps(componentProps, params); 2247 if (params.enabled === false) { 2248 return null; 2249 } 2250 const state = params.state ?? EMPTY_OBJECT; 2251 return evaluateRenderProp(element, renderProp, outProps, state); 2252 } 2253 function useRenderElementProps(componentProps, params = {}) { 2254 const { 2255 className: classNameProp, 2256 style: styleProp, 2257 render: renderProp 2258 } = componentProps; 2259 const { 2260 state = EMPTY_OBJECT, 2261 ref, 2262 props, 2263 stateAttributesMapping: stateAttributesMapping4, 2264 enabled = true 2265 } = params; 2266 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 2267 const style = enabled ? resolveStyle(styleProp, state) : void 0; 2268 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping4) : EMPTY_OBJECT; 2269 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 2270 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 2271 if (typeof document !== "undefined") { 2272 if (!enabled) { 2273 useMergedRefs(null, null); 2274 } else if (Array.isArray(ref)) { 2275 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 2276 } else { 2277 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 2278 } 2279 } 2280 if (!enabled) { 2281 return EMPTY_OBJECT; 2282 } 2283 if (className !== void 0) { 2284 outProps.className = mergeClassNames(outProps.className, className); 2285 } 2286 if (style !== void 0) { 2287 outProps.style = mergeObjects(outProps.style, style); 2288 } 2289 return outProps; 2290 } 2291 function resolveRenderFunctionProps(props) { 2292 if (Array.isArray(props)) { 2293 return mergePropsN(props); 2294 } 2295 return mergeProps(void 0, props); 2296 } 2297 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 2298 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 2299 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 2300 function evaluateRenderProp(element, render4, props, state) { 2301 if (render4) { 2302 if (typeof render4 === "function") { 2303 if (true) { 2304 warnIfRenderPropLooksLikeComponent(render4); 2305 } 2306 return render4(props, state); 2307 } 2308 const mergedProps = mergeProps(props, render4.props); 2309 mergedProps.ref = props.ref; 2310 let newElement = render4; 2311 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 2312 const children = React8.Children.toArray(render4); 2313 newElement = children[0]; 2314 } 2315 if (true) { 2316 if (!/* @__PURE__ */ React8.isValidElement(newElement)) { 2317 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")); 2318 } 2319 } 2320 return /* @__PURE__ */ React8.cloneElement(newElement, mergedProps); 2321 } 2322 if (element) { 2323 if (typeof element === "string") { 2324 return renderTag(element, props); 2325 } 2326 } 2327 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 2328 } 2329 function warnIfRenderPropLooksLikeComponent(renderFn) { 2330 const functionName = renderFn.name; 2331 if (functionName.length === 0) { 2332 return; 2333 } 2334 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 2335 return; 2336 } 2337 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 2338 return; 2339 } 2340 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"); 2341 } 2342 function renderTag(Tag, props) { 2343 if (Tag === "button") { 2344 return /* @__PURE__ */ (0, import_react.createElement)("button", { 2345 type: "button", 2346 ...props, 2347 key: props.key 2348 }); 2349 } 2350 if (Tag === "img") { 2351 return /* @__PURE__ */ (0, import_react.createElement)("img", { 2352 alt: "", 2353 ...props, 2354 key: props.key 2355 }); 2356 } 2357 return /* @__PURE__ */ React8.createElement(Tag, props); 2358 } 2359 2360 // node_modules/@base-ui/react/esm/internals/reason-parts.js 2361 var reason_parts_exports = {}; 2362 __export(reason_parts_exports, { 2363 cancelOpen: () => cancelOpen, 2364 chipRemovePress: () => chipRemovePress, 2365 clearPress: () => clearPress, 2366 closePress: () => closePress, 2367 closeWatcher: () => closeWatcher, 2368 decrementPress: () => decrementPress, 2369 disabled: () => disabled, 2370 drag: () => drag, 2371 escapeKey: () => escapeKey, 2372 focusOut: () => focusOut, 2373 imperativeAction: () => imperativeAction, 2374 incrementPress: () => incrementPress, 2375 initial: () => initial, 2376 inputBlur: () => inputBlur, 2377 inputChange: () => inputChange, 2378 inputClear: () => inputClear, 2379 inputPaste: () => inputPaste, 2380 inputPress: () => inputPress, 2381 itemPress: () => itemPress, 2382 keyboard: () => keyboard, 2383 linkPress: () => linkPress, 2384 listNavigation: () => listNavigation, 2385 missing: () => missing, 2386 none: () => none, 2387 outsidePress: () => outsidePress, 2388 pointer: () => pointer, 2389 scrub: () => scrub, 2390 siblingOpen: () => siblingOpen, 2391 swipe: () => swipe, 2392 trackPress: () => trackPress, 2393 triggerFocus: () => triggerFocus, 2394 triggerHover: () => triggerHover, 2395 triggerPress: () => triggerPress, 2396 wheel: () => wheel, 2397 windowResize: () => windowResize 2398 }); 2399 var none = "none"; 2400 var triggerPress = "trigger-press"; 2401 var triggerHover = "trigger-hover"; 2402 var triggerFocus = "trigger-focus"; 2403 var outsidePress = "outside-press"; 2404 var itemPress = "item-press"; 2405 var closePress = "close-press"; 2406 var linkPress = "link-press"; 2407 var clearPress = "clear-press"; 2408 var chipRemovePress = "chip-remove-press"; 2409 var trackPress = "track-press"; 2410 var incrementPress = "increment-press"; 2411 var decrementPress = "decrement-press"; 2412 var inputChange = "input-change"; 2413 var inputClear = "input-clear"; 2414 var inputBlur = "input-blur"; 2415 var inputPaste = "input-paste"; 2416 var inputPress = "input-press"; 2417 var focusOut = "focus-out"; 2418 var escapeKey = "escape-key"; 2419 var closeWatcher = "close-watcher"; 2420 var listNavigation = "list-navigation"; 2421 var keyboard = "keyboard"; 2422 var pointer = "pointer"; 2423 var drag = "drag"; 2424 var wheel = "wheel"; 2425 var scrub = "scrub"; 2426 var cancelOpen = "cancel-open"; 2427 var siblingOpen = "sibling-open"; 2428 var disabled = "disabled"; 2429 var missing = "missing"; 2430 var initial = "initial"; 2431 var imperativeAction = "imperative-action"; 2432 var swipe = "swipe"; 2433 var windowResize = "window-resize"; 2434 2435 // node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js 2436 function createChangeEventDetails(reason, event, trigger, customProperties) { 2437 let canceled = false; 2438 let allowPropagation = false; 2439 const custom = customProperties ?? EMPTY_OBJECT; 2440 const details = { 2441 reason, 2442 event: event ?? new Event("base-ui"), 2443 cancel() { 2444 canceled = true; 2445 }, 2446 allowPropagation() { 2447 allowPropagation = true; 2448 }, 2449 get isCanceled() { 2450 return canceled; 2451 }, 2452 get isPropagationAllowed() { 2453 return allowPropagation; 2454 }, 2455 trigger, 2456 ...custom 2457 }; 2458 return details; 2459 } 2460 2461 // node_modules/@base-ui/utils/esm/useId.js 2462 var React9 = __toESM(require_react(), 1); 2463 var globalId = 0; 2464 function useGlobalId(idOverride, prefix2 = "mui") { 2465 const [defaultId, setDefaultId] = React9.useState(idOverride); 2466 const id = idOverride || defaultId; 2467 React9.useEffect(() => { 2468 if (defaultId == null) { 2469 globalId += 1; 2470 setDefaultId(`$prefix2}-$globalId}`); 2471 } 2472 }, [defaultId, prefix2]); 2473 return id; 2474 } 2475 var maybeReactUseId = SafeReact.useId; 2476 function useId(idOverride, prefix2) { 2477 if (maybeReactUseId !== void 0) { 2478 const reactId = maybeReactUseId(); 2479 return idOverride ?? (prefix2 ? `$prefix2}-$reactId}` : reactId); 2480 } 2481 return useGlobalId(idOverride, prefix2); 2482 } 2483 2484 // node_modules/@base-ui/react/esm/internals/useBaseUiId.js 2485 function useBaseUiId(idOverride) { 2486 return useId(idOverride, "base-ui"); 2487 } 2488 2489 // node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js 2490 var React12 = __toESM(require_react(), 1); 2491 2492 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js 2493 var React11 = __toESM(require_react(), 1); 2494 2495 // node_modules/@base-ui/utils/esm/useOnMount.js 2496 var React10 = __toESM(require_react(), 1); 2497 var EMPTY = []; 2498 function useOnMount(fn) { 2499 React10.useEffect(fn, EMPTY); 2500 } 2501 2502 // node_modules/@base-ui/utils/esm/useAnimationFrame.js 2503 var EMPTY2 = null; 2504 var LAST_RAF = globalThis.requestAnimationFrame; 2505 var Scheduler = class { 2506 /* This implementation uses an array as a backing data-structure for frame callbacks. 2507 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 2508 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 2509 * be much more efficient if there is a call pattern that alterns as 2510 * "request-cancel-request-cancel-…". 2511 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 2512 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 2513 callbacks = []; 2514 callbacksCount = 0; 2515 nextId = 1; 2516 startId = 1; 2517 isScheduled = false; 2518 tick = (timestamp) => { 2519 this.isScheduled = false; 2520 const currentCallbacks = this.callbacks; 2521 const currentCallbacksCount = this.callbacksCount; 2522 this.callbacks = []; 2523 this.callbacksCount = 0; 2524 this.startId = this.nextId; 2525 if (currentCallbacksCount > 0) { 2526 for (let i2 = 0; i2 < currentCallbacks.length; i2 += 1) { 2527 currentCallbacks[i2]?.(timestamp); 2528 } 2529 } 2530 }; 2531 request(fn) { 2532 const id = this.nextId; 2533 this.nextId += 1; 2534 this.callbacks.push(fn); 2535 this.callbacksCount += 1; 2536 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 2537 if (!this.isScheduled || didRAFChange) { 2538 requestAnimationFrame(this.tick); 2539 this.isScheduled = true; 2540 } 2541 return id; 2542 } 2543 cancel(id) { 2544 const index2 = id - this.startId; 2545 if (index2 < 0 || index2 >= this.callbacks.length) { 2546 return; 2547 } 2548 this.callbacks[index2] = null; 2549 this.callbacksCount -= 1; 2550 } 2551 }; 2552 var scheduler = new Scheduler(); 2553 var AnimationFrame = class _AnimationFrame { 2554 static create() { 2555 return new _AnimationFrame(); 2556 } 2557 static request(fn) { 2558 return scheduler.request(fn); 2559 } 2560 static cancel(id) { 2561 return scheduler.cancel(id); 2562 } 2563 currentId = EMPTY2; 2564 /** 2565 * Executes `fn` after `delay`, clearing any previously scheduled call. 2566 */ 2567 request(fn) { 2568 this.cancel(); 2569 this.currentId = scheduler.request(() => { 2570 this.currentId = EMPTY2; 2571 fn(); 2572 }); 2573 } 2574 cancel = () => { 2575 if (this.currentId !== EMPTY2) { 2576 scheduler.cancel(this.currentId); 2577 this.currentId = EMPTY2; 2578 } 2579 }; 2580 disposeEffect = () => { 2581 return this.cancel; 2582 }; 2583 }; 2584 function useAnimationFrame() { 2585 const timeout = useRefWithInit(AnimationFrame.create).current; 2586 useOnMount(timeout.disposeEffect); 2587 return timeout; 2588 } 2589 2590 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js 2591 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { 2592 const [transitionStatus, setTransitionStatus] = React11.useState(open && enableIdleState ? "idle" : void 0); 2593 const [mounted, setMounted] = React11.useState(open); 2594 if (open && !mounted) { 2595 setMounted(true); 2596 setTransitionStatus("starting"); 2597 } 2598 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { 2599 setTransitionStatus("ending"); 2600 } 2601 if (!open && !mounted && transitionStatus === "ending") { 2602 setTransitionStatus(void 0); 2603 } 2604 useIsoLayoutEffect(() => { 2605 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { 2606 const frame = AnimationFrame.request(() => { 2607 setTransitionStatus("ending"); 2608 }); 2609 return () => { 2610 AnimationFrame.cancel(frame); 2611 }; 2612 } 2613 return void 0; 2614 }, [open, mounted, transitionStatus, deferEndingState]); 2615 useIsoLayoutEffect(() => { 2616 if (!open || enableIdleState) { 2617 return void 0; 2618 } 2619 const frame = AnimationFrame.request(() => { 2620 setTransitionStatus(void 0); 2621 }); 2622 return () => { 2623 AnimationFrame.cancel(frame); 2624 }; 2625 }, [enableIdleState, open]); 2626 useIsoLayoutEffect(() => { 2627 if (!open || !enableIdleState) { 2628 return void 0; 2629 } 2630 if (open && mounted && transitionStatus !== "idle") { 2631 setTransitionStatus("starting"); 2632 } 2633 const frame = AnimationFrame.request(() => { 2634 setTransitionStatus("idle"); 2635 }); 2636 return () => { 2637 AnimationFrame.cancel(frame); 2638 }; 2639 }, [enableIdleState, open, mounted, transitionStatus]); 2640 return { 2641 mounted, 2642 setMounted, 2643 transitionStatus 2644 }; 2645 } 2646 2647 // node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js 2648 function useCollapsibleRoot(parameters) { 2649 const { 2650 open: openParam, 2651 defaultOpen, 2652 onOpenChange, 2653 disabled: disabled2 2654 } = parameters; 2655 const [open, setOpen] = useControlled({ 2656 controlled: openParam, 2657 default: defaultOpen, 2658 name: "Collapsible", 2659 state: "open" 2660 }); 2661 const { 2662 mounted, 2663 setMounted, 2664 transitionStatus 2665 } = useTransitionStatus(open, true, true); 2666 const defaultPanelId = useBaseUiId(); 2667 const [panelIdState, setPanelIdState] = React12.useState(); 2668 const panelId = panelIdState ?? defaultPanelId; 2669 const handleTrigger = useStableCallback((event) => { 2670 const nextOpen = !open; 2671 const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent); 2672 onOpenChange(nextOpen, eventDetails); 2673 if (eventDetails.isCanceled) { 2674 return; 2675 } 2676 setOpen(nextOpen); 2677 }); 2678 return React12.useMemo(() => ({ 2679 disabled: disabled2, 2680 handleTrigger, 2681 mounted, 2682 open, 2683 panelId, 2684 setMounted, 2685 setOpen, 2686 setPanelIdState, 2687 transitionStatus 2688 }), [disabled2, handleTrigger, mounted, open, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]); 2689 } 2690 2691 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRootContext.js 2692 var React13 = __toESM(require_react(), 1); 2693 var CollapsibleRootContext = /* @__PURE__ */ React13.createContext(void 0); 2694 if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext"; 2695 function useCollapsibleRootContext() { 2696 const context = React13.useContext(CollapsibleRootContext); 2697 if (context === void 0) { 2698 throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15)); 2699 } 2700 return context; 2701 } 2702 2703 // node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js 2704 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { 2705 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; 2706 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; 2707 return TransitionStatusDataAttributes2; 2708 })({}); 2709 var STARTING_HOOK = { 2710 [TransitionStatusDataAttributes.startingStyle]: "" 2711 }; 2712 var ENDING_HOOK = { 2713 [TransitionStatusDataAttributes.endingStyle]: "" 2714 }; 2715 var transitionStatusMapping = { 2716 transitionStatus(value) { 2717 if (value === "starting") { 2718 return STARTING_HOOK; 2719 } 2720 if (value === "ending") { 2721 return ENDING_HOOK; 2722 } 2723 return null; 2724 } 2725 }; 2726 2727 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelDataAttributes.js 2728 var CollapsiblePanelDataAttributes = (function(CollapsiblePanelDataAttributes2) { 2729 CollapsiblePanelDataAttributes2["open"] = "data-open"; 2730 CollapsiblePanelDataAttributes2["closed"] = "data-closed"; 2731 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 2732 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 2733 return CollapsiblePanelDataAttributes2; 2734 })({}); 2735 2736 // node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTriggerDataAttributes.js 2737 var CollapsibleTriggerDataAttributes = /* @__PURE__ */ (function(CollapsibleTriggerDataAttributes2) { 2738 CollapsibleTriggerDataAttributes2["panelOpen"] = "data-panel-open"; 2739 return CollapsibleTriggerDataAttributes2; 2740 })({}); 2741 2742 // node_modules/@base-ui/react/esm/utils/collapsibleOpenStateMapping.js 2743 var PANEL_OPEN_HOOK = { 2744 [CollapsiblePanelDataAttributes.open]: "" 2745 }; 2746 var PANEL_CLOSED_HOOK = { 2747 [CollapsiblePanelDataAttributes.closed]: "" 2748 }; 2749 var triggerOpenStateMapping = { 2750 open(value) { 2751 if (value) { 2752 return { 2753 [CollapsibleTriggerDataAttributes.panelOpen]: "" 2754 }; 2755 } 2756 return null; 2757 } 2758 }; 2759 var collapsibleOpenStateMapping = { 2760 open(value) { 2761 if (value) { 2762 return PANEL_OPEN_HOOK; 2763 } 2764 return PANEL_CLOSED_HOOK; 2765 } 2766 }; 2767 2768 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js 2769 var React16 = __toESM(require_react(), 1); 2770 2771 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 2772 function hasWindow() { 2773 return typeof window !== "undefined"; 2774 } 2775 function getNodeName(node) { 2776 if (isNode(node)) { 2777 return (node.nodeName || "").toLowerCase(); 2778 } 2779 return "#document"; 2780 } 2781 function getWindow(node) { 2782 var _node$ownerDocument; 2783 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 2784 } 2785 function getDocumentElement(node) { 2786 var _ref; 2787 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 2788 } 2789 function isNode(value) { 2790 if (!hasWindow()) { 2791 return false; 2792 } 2793 return value instanceof Node || value instanceof getWindow(value).Node; 2794 } 2795 function isElement(value) { 2796 if (!hasWindow()) { 2797 return false; 2798 } 2799 return value instanceof Element || value instanceof getWindow(value).Element; 2800 } 2801 function isHTMLElement(value) { 2802 if (!hasWindow()) { 2803 return false; 2804 } 2805 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 2806 } 2807 function isShadowRoot(value) { 2808 if (!hasWindow() || typeof ShadowRoot === "undefined") { 2809 return false; 2810 } 2811 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 2812 } 2813 function isOverflowElement(element) { 2814 const { 2815 overflow, 2816 overflowX, 2817 overflowY, 2818 display 2819 } = getComputedStyle2(element); 2820 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 2821 } 2822 function isTableElement(element) { 2823 return /^(table|td|th)$/.test(getNodeName(element)); 2824 } 2825 function isTopLayer(element) { 2826 try { 2827 if (element.matches(":popover-open")) { 2828 return true; 2829 } 2830 } catch (_e) { 2831 } 2832 try { 2833 return element.matches(":modal"); 2834 } catch (_e) { 2835 return false; 2836 } 2837 } 2838 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 2839 var containRe = /paint|layout|strict|content/; 2840 var isNotNone = (value) => !!value && value !== "none"; 2841 var isWebKitValue; 2842 function isContainingBlock(elementOrCss) { 2843 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 2844 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 || ""); 2845 } 2846 function getContainingBlock(element) { 2847 let currentNode = getParentNode(element); 2848 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 2849 if (isContainingBlock(currentNode)) { 2850 return currentNode; 2851 } else if (isTopLayer(currentNode)) { 2852 return null; 2853 } 2854 currentNode = getParentNode(currentNode); 2855 } 2856 return null; 2857 } 2858 function isWebKit() { 2859 if (isWebKitValue == null) { 2860 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 2861 } 2862 return isWebKitValue; 2863 } 2864 function isLastTraversableNode(node) { 2865 return /^(html|body|#document)$/.test(getNodeName(node)); 2866 } 2867 function getComputedStyle2(element) { 2868 return getWindow(element).getComputedStyle(element); 2869 } 2870 function getNodeScroll(element) { 2871 if (isElement(element)) { 2872 return { 2873 scrollLeft: element.scrollLeft, 2874 scrollTop: element.scrollTop 2875 }; 2876 } 2877 return { 2878 scrollLeft: element.scrollX, 2879 scrollTop: element.scrollY 2880 }; 2881 } 2882 function getParentNode(node) { 2883 if (getNodeName(node) === "html") { 2884 return node; 2885 } 2886 const result = ( 2887 // Step into the shadow DOM of the parent of a slotted node. 2888 node.assignedSlot || // DOM Element detected. 2889 node.parentNode || // ShadowRoot detected. 2890 isShadowRoot(node) && node.host || // Fallback. 2891 getDocumentElement(node) 2892 ); 2893 return isShadowRoot(result) ? result.host : result; 2894 } 2895 function getNearestOverflowAncestor(node) { 2896 const parentNode = getParentNode(node); 2897 if (isLastTraversableNode(parentNode)) { 2898 return node.ownerDocument ? node.ownerDocument.body : node.body; 2899 } 2900 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 2901 return parentNode; 2902 } 2903 return getNearestOverflowAncestor(parentNode); 2904 } 2905 function getOverflowAncestors(node, list, traverseIframes) { 2906 var _node$ownerDocument2; 2907 if (list === void 0) { 2908 list = []; 2909 } 2910 if (traverseIframes === void 0) { 2911 traverseIframes = true; 2912 } 2913 const scrollableAncestor = getNearestOverflowAncestor(node); 2914 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 2915 const win = getWindow(scrollableAncestor); 2916 if (isBody) { 2917 const frameElement = getFrameElement(win); 2918 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 2919 } else { 2920 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 2921 } 2922 } 2923 function getFrameElement(win) { 2924 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 2925 } 2926 2927 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js 2928 var React14 = __toESM(require_react(), 1); 2929 var CompositeRootContext = /* @__PURE__ */ React14.createContext(void 0); 2930 if (true) CompositeRootContext.displayName = "CompositeRootContext"; 2931 function useCompositeRootContext(optional = false) { 2932 const context = React14.useContext(CompositeRootContext); 2933 if (context === void 0 && !optional) { 2934 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); 2935 } 2936 return context; 2937 } 2938 2939 // node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js 2940 var React15 = __toESM(require_react(), 1); 2941 function useFocusableWhenDisabled(parameters) { 2942 const { 2943 focusableWhenDisabled, 2944 disabled: disabled2, 2945 composite = false, 2946 tabIndex: tabIndexProp = 0, 2947 isNativeButton 2948 } = parameters; 2949 const isFocusableComposite = composite && focusableWhenDisabled !== false; 2950 const isNonFocusableComposite = composite && focusableWhenDisabled === false; 2951 const props = React15.useMemo(() => { 2952 const additionalProps = { 2953 // allow Tabbing away from focusableWhenDisabled elements 2954 onKeyDown(event) { 2955 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { 2956 event.preventDefault(); 2957 } 2958 } 2959 }; 2960 if (!composite) { 2961 additionalProps.tabIndex = tabIndexProp; 2962 if (!isNativeButton && disabled2) { 2963 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; 2964 } 2965 } 2966 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { 2967 additionalProps["aria-disabled"] = disabled2; 2968 } 2969 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { 2970 additionalProps.disabled = disabled2; 2971 } 2972 return additionalProps; 2973 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); 2974 return { 2975 props 2976 }; 2977 } 2978 2979 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js 2980 function useButton(parameters = {}) { 2981 const { 2982 disabled: disabled2 = false, 2983 focusableWhenDisabled, 2984 tabIndex = 0, 2985 native: isNativeButton = true, 2986 composite: compositeProp 2987 } = parameters; 2988 const elementRef = React16.useRef(null); 2989 const compositeRootContext = useCompositeRootContext(true); 2990 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; 2991 const { 2992 props: focusableWhenDisabledProps 2993 } = useFocusableWhenDisabled({ 2994 focusableWhenDisabled, 2995 disabled: disabled2, 2996 composite: isCompositeItem, 2997 tabIndex, 2998 isNativeButton 2999 }); 3000 if (true) { 3001 React16.useEffect(() => { 3002 if (!elementRef.current) { 3003 return; 3004 } 3005 const isButtonTag = isButtonElement(elementRef.current); 3006 if (isNativeButton) { 3007 if (!isButtonTag) { 3008 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 3009 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`."; 3010 error(`$message2}$ownerStackMessage}`); 3011 } 3012 } else if (isButtonTag) { 3013 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 3014 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`."; 3015 error(`$message2}$ownerStackMessage}`); 3016 } 3017 }, [isNativeButton]); 3018 } 3019 const updateDisabled = React16.useCallback(() => { 3020 const element = elementRef.current; 3021 if (!isButtonElement(element)) { 3022 return; 3023 } 3024 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { 3025 element.disabled = false; 3026 } 3027 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); 3028 useIsoLayoutEffect(updateDisabled, [updateDisabled]); 3029 const getButtonProps = React16.useCallback((externalProps = {}) => { 3030 const { 3031 onClick: externalOnClick, 3032 onMouseDown: externalOnMouseDown, 3033 onKeyUp: externalOnKeyUp, 3034 onKeyDown: externalOnKeyDown, 3035 onPointerDown: externalOnPointerDown, 3036 ...otherExternalProps 3037 } = externalProps; 3038 return mergeProps({ 3039 onClick(event) { 3040 if (disabled2) { 3041 event.preventDefault(); 3042 return; 3043 } 3044 externalOnClick?.(event); 3045 }, 3046 onMouseDown(event) { 3047 if (!disabled2) { 3048 externalOnMouseDown?.(event); 3049 } 3050 }, 3051 onKeyDown(event) { 3052 if (disabled2) { 3053 return; 3054 } 3055 makeEventPreventable(event); 3056 externalOnKeyDown?.(event); 3057 if (event.baseUIHandlerPrevented) { 3058 return; 3059 } 3060 const isCurrentTarget = event.target === event.currentTarget; 3061 const currentTarget = event.currentTarget; 3062 const isButton2 = isButtonElement(currentTarget); 3063 const isLink = !isNativeButton && isValidLinkElement(currentTarget); 3064 const shouldClick = isCurrentTarget && (isNativeButton ? isButton2 : !isLink); 3065 const isEnterKey = event.key === "Enter"; 3066 const isSpaceKey = event.key === " "; 3067 const role = currentTarget.getAttribute("role"); 3068 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; 3069 if (isCurrentTarget && isCompositeItem && isSpaceKey) { 3070 if (event.defaultPrevented && isTextNavigationRole) { 3071 return; 3072 } 3073 event.preventDefault(); 3074 if (isLink || isNativeButton && isButton2) { 3075 currentTarget.click(); 3076 event.preventBaseUIHandler(); 3077 } else if (shouldClick) { 3078 externalOnClick?.(event); 3079 event.preventBaseUIHandler(); 3080 } 3081 return; 3082 } 3083 if (shouldClick) { 3084 if (!isNativeButton && (isSpaceKey || isEnterKey)) { 3085 event.preventDefault(); 3086 } 3087 if (!isNativeButton && isEnterKey) { 3088 externalOnClick?.(event); 3089 } 3090 } 3091 }, 3092 onKeyUp(event) { 3093 if (disabled2) { 3094 return; 3095 } 3096 makeEventPreventable(event); 3097 externalOnKeyUp?.(event); 3098 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { 3099 event.preventDefault(); 3100 return; 3101 } 3102 if (event.baseUIHandlerPrevented) { 3103 return; 3104 } 3105 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") { 3106 externalOnClick?.(event); 3107 } 3108 }, 3109 onPointerDown(event) { 3110 if (disabled2) { 3111 event.preventDefault(); 3112 return; 3113 } 3114 externalOnPointerDown?.(event); 3115 } 3116 }, isNativeButton ? { 3117 type: "button" 3118 } : { 3119 role: "button" 3120 }, focusableWhenDisabledProps, otherExternalProps); 3121 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); 3122 const buttonRef = useStableCallback((element) => { 3123 elementRef.current = element; 3124 updateDisabled(); 3125 }); 3126 return { 3127 getButtonProps, 3128 buttonRef 3129 }; 3130 } 3131 function isButtonElement(elem) { 3132 return isHTMLElement(elem) && elem.tagName === "BUTTON"; 3133 } 3134 function isValidLinkElement(elem) { 3135 return Boolean(elem?.tagName === "A" && elem?.href); 3136 } 3137 3138 // node_modules/@base-ui/utils/esm/detectBrowser.js 3139 var hasNavigator = typeof navigator !== "undefined"; 3140 var nav = getNavigatorData(); 3141 var platform = getPlatform(); 3142 var userAgent = getUserAgent(); 3143 var isWebKit2 = typeof CSS === "undefined" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter:none"); 3144 var isIOS = ( 3145 // iPads can claim to be MacIntel 3146 nav.platform === "MacIntel" && nav.maxTouchPoints > 1 ? true : /iP(hone|ad|od)|iOS/.test(nav.platform) 3147 ); 3148 var isFirefox = hasNavigator && /firefox/i.test(userAgent); 3149 var isSafari = hasNavigator && /apple/i.test(navigator.vendor); 3150 var isEdge = hasNavigator && /Edg/i.test(userAgent); 3151 var isAndroid = hasNavigator && /android/i.test(platform) || /android/i.test(userAgent); 3152 var isMac = hasNavigator && platform.toLowerCase().startsWith("mac") && !navigator.maxTouchPoints; 3153 var isJSDOM = userAgent.includes("jsdom/"); 3154 function getNavigatorData() { 3155 if (!hasNavigator) { 3156 return { 3157 platform: "", 3158 maxTouchPoints: -1 3159 }; 3160 } 3161 const uaData = navigator.userAgentData; 3162 if (uaData?.platform) { 3163 return { 3164 platform: uaData.platform, 3165 maxTouchPoints: navigator.maxTouchPoints 3166 }; 3167 } 3168 return { 3169 platform: navigator.platform ?? "", 3170 maxTouchPoints: navigator.maxTouchPoints ?? -1 3171 }; 3172 } 3173 function getUserAgent() { 3174 if (!hasNavigator) { 3175 return ""; 3176 } 3177 const uaData = navigator.userAgentData; 3178 if (uaData && Array.isArray(uaData.brands)) { 3179 return uaData.brands.map(({ 3180 brand, 3181 version: version2 3182 }) => `$brand}/$version2}`).join(" "); 3183 } 3184 return navigator.userAgent; 3185 } 3186 function getPlatform() { 3187 if (!hasNavigator) { 3188 return ""; 3189 } 3190 const uaData = navigator.userAgentData; 3191 if (uaData?.platform) { 3192 return uaData.platform; 3193 } 3194 return navigator.platform ?? ""; 3195 } 3196 3197 // node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js 3198 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 3199 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 3200 3201 // node_modules/@base-ui/react/esm/internals/shadowDom.js 3202 function activeElement(doc) { 3203 let element = doc.activeElement; 3204 while (element?.shadowRoot?.activeElement != null) { 3205 element = element.shadowRoot.activeElement; 3206 } 3207 return element; 3208 } 3209 function contains(parent, child) { 3210 if (!parent || !child) { 3211 return false; 3212 } 3213 const rootNode = child.getRootNode?.(); 3214 if (parent.contains(child)) { 3215 return true; 3216 } 3217 if (rootNode && isShadowRoot(rootNode)) { 3218 let next = child; 3219 while (next) { 3220 if (parent === next) { 3221 return true; 3222 } 3223 next = next.parentNode || next.host; 3224 } 3225 } 3226 return false; 3227 } 3228 function getTarget(event) { 3229 if ("composedPath" in event) { 3230 return event.composedPath()[0]; 3231 } 3232 return event.target; 3233 } 3234 3235 // node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js 3236 function isTargetInsideEnabledTrigger(target, triggerElements) { 3237 if (!isElement(target)) { 3238 return false; 3239 } 3240 const targetElement = target; 3241 if (triggerElements.hasElement(targetElement)) { 3242 return !targetElement.hasAttribute("data-trigger-disabled"); 3243 } 3244 for (const [, trigger] of triggerElements.entries()) { 3245 if (contains(trigger, targetElement)) { 3246 return !trigger.hasAttribute("data-trigger-disabled"); 3247 } 3248 } 3249 return false; 3250 } 3251 function isEventTargetWithin(event, node) { 3252 if (node == null) { 3253 return false; 3254 } 3255 if ("composedPath" in event) { 3256 return event.composedPath().includes(node); 3257 } 3258 const eventAgain = event; 3259 return eventAgain.target != null && node.contains(eventAgain.target); 3260 } 3261 function isRootElement(element) { 3262 return element.matches("html,body"); 3263 } 3264 function isTypeableElement(element) { 3265 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 3266 } 3267 function isInteractiveElement(element) { 3268 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 3269 } 3270 function matchesFocusVisible(element) { 3271 if (!element || isJSDOM) { 3272 return true; 3273 } 3274 try { 3275 return element.matches(":focus-visible"); 3276 } catch (_e) { 3277 return true; 3278 } 3279 } 3280 3281 // node_modules/@base-ui/react/esm/floating-ui-react/utils/nodes.js 3282 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 3283 const directChildren = nodes.filter((node) => node.parentId === id); 3284 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 3285 } 3286 3287 // node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js 3288 function isReactEvent(event) { 3289 return "nativeEvent" in event; 3290 } 3291 function isMouseLikePointerType(pointerType, strict) { 3292 const values = ["mouse", "pen"]; 3293 if (!strict) { 3294 values.push("", void 0); 3295 } 3296 return values.includes(pointerType); 3297 } 3298 function isClickLikeEvent(event) { 3299 const type = event.type; 3300 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 3301 } 3302 3303 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 3304 var sides = ["top", "right", "bottom", "left"]; 3305 var min = Math.min; 3306 var max = Math.max; 3307 var round = Math.round; 3308 var floor = Math.floor; 3309 var createCoords = (v2) => ({ 3310 x: v2, 3311 y: v2 3312 }); 3313 var oppositeSideMap = { 3314 left: "right", 3315 right: "left", 3316 bottom: "top", 3317 top: "bottom" 3318 }; 3319 function clamp(start2, value, end) { 3320 return max(start2, min(value, end)); 3321 } 3322 function evaluate(value, param) { 3323 return typeof value === "function" ? value(param) : value; 3324 } 3325 function getSide(placement) { 3326 return placement.split("-")[0]; 3327 } 3328 function getAlignment(placement) { 3329 return placement.split("-")[1]; 3330 } 3331 function getOppositeAxis(axis) { 3332 return axis === "x" ? "y" : "x"; 3333 } 3334 function getAxisLength(axis) { 3335 return axis === "y" ? "height" : "width"; 3336 } 3337 function getSideAxis(placement) { 3338 const firstChar = placement[0]; 3339 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 3340 } 3341 function getAlignmentAxis(placement) { 3342 return getOppositeAxis(getSideAxis(placement)); 3343 } 3344 function getAlignmentSides(placement, rects, rtl) { 3345 if (rtl === void 0) { 3346 rtl = false; 3347 } 3348 const alignment = getAlignment(placement); 3349 const alignmentAxis = getAlignmentAxis(placement); 3350 const length = getAxisLength(alignmentAxis); 3351 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 3352 if (rects.reference[length] > rects.floating[length]) { 3353 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 3354 } 3355 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 3356 } 3357 function getExpandedPlacements(placement) { 3358 const oppositePlacement = getOppositePlacement(placement); 3359 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 3360 } 3361 function getOppositeAlignmentPlacement(placement) { 3362 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 3363 } 3364 var lrPlacement = ["left", "right"]; 3365 var rlPlacement = ["right", "left"]; 3366 var tbPlacement = ["top", "bottom"]; 3367 var btPlacement = ["bottom", "top"]; 3368 function getSideList(side, isStart, rtl) { 3369 switch (side) { 3370 case "top": 3371 case "bottom": 3372 if (rtl) return isStart ? rlPlacement : lrPlacement; 3373 return isStart ? lrPlacement : rlPlacement; 3374 case "left": 3375 case "right": 3376 return isStart ? tbPlacement : btPlacement; 3377 default: 3378 return []; 3379 } 3380 } 3381 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 3382 const alignment = getAlignment(placement); 3383 let list = getSideList(getSide(placement), direction === "start", rtl); 3384 if (alignment) { 3385 list = list.map((side) => side + "-" + alignment); 3386 if (flipAlignment) { 3387 list = list.concat(list.map(getOppositeAlignmentPlacement)); 3388 } 3389 } 3390 return list; 3391 } 3392 function getOppositePlacement(placement) { 3393 const side = getSide(placement); 3394 return oppositeSideMap[side] + placement.slice(side.length); 3395 } 3396 function expandPaddingObject(padding) { 3397 return { 3398 top: 0, 3399 right: 0, 3400 bottom: 0, 3401 left: 0, 3402 ...padding 3403 }; 3404 } 3405 function getPaddingObject(padding) { 3406 return typeof padding !== "number" ? expandPaddingObject(padding) : { 3407 top: padding, 3408 right: padding, 3409 bottom: padding, 3410 left: padding 3411 }; 3412 } 3413 function rectToClientRect(rect) { 3414 const { 3415 x: x2, 3416 y: y2, 3417 width, 3418 height 3419 } = rect; 3420 return { 3421 width, 3422 height, 3423 top: y2, 3424 left: x2, 3425 right: x2 + width, 3426 bottom: y2 + height, 3427 x: x2, 3428 y: y2 3429 }; 3430 } 3431 3432 // node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js 3433 function isHiddenByStyles(styles) { 3434 return styles.visibility === "hidden" || styles.visibility === "collapse"; 3435 } 3436 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 3437 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 3438 return false; 3439 } 3440 if (typeof element.checkVisibility === "function") { 3441 return element.checkVisibility(); 3442 } 3443 return styles.display !== "none" && styles.display !== "contents"; 3444 } 3445 3446 // node_modules/@base-ui/utils/esm/owner.js 3447 function ownerDocument(node) { 3448 return node?.ownerDocument || document; 3449 } 3450 3451 // node_modules/@base-ui/react/esm/floating-ui-react/utils/tabbable.js 3452 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 3453 function getParentElement(element) { 3454 const assignedSlot = element.assignedSlot; 3455 if (assignedSlot) { 3456 return assignedSlot; 3457 } 3458 if (element.parentElement) { 3459 return element.parentElement; 3460 } 3461 const rootNode = element.getRootNode(); 3462 return isShadowRoot(rootNode) ? rootNode.host : null; 3463 } 3464 function getDetailsSummary(details) { 3465 for (const child of Array.from(details.children)) { 3466 if (getNodeName(child) === "summary") { 3467 return child; 3468 } 3469 } 3470 return null; 3471 } 3472 function isWithinOpenDetailsSummary(element, details) { 3473 const summary = getDetailsSummary(details); 3474 return !!summary && (element === summary || contains(summary, element)); 3475 } 3476 function isFocusableCandidate(element) { 3477 const nodeName = element ? getNodeName(element) : ""; 3478 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"); 3479 } 3480 function isFocusableElement(element) { 3481 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 3482 return false; 3483 } 3484 for (let current = element; current; current = getParentElement(current)) { 3485 const isAncestor = current !== element; 3486 const isSlot = getNodeName(current) === "slot"; 3487 if (current.hasAttribute("inert")) { 3488 return false; 3489 } 3490 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 3491 return false; 3492 } 3493 } 3494 return true; 3495 } 3496 function isVisibleInTabbableTree(element, isAncestor) { 3497 const styles = getComputedStyle2(element); 3498 if (!isAncestor) { 3499 return isElementVisible(element, styles); 3500 } 3501 return styles.display !== "none"; 3502 } 3503 function getTabIndex(element) { 3504 const tabIndex = element.tabIndex; 3505 if (tabIndex < 0) { 3506 const nodeName = getNodeName(element); 3507 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 3508 return 0; 3509 } 3510 } 3511 return tabIndex; 3512 } 3513 function getNamedRadioInput(element) { 3514 if (getNodeName(element) !== "input") { 3515 return null; 3516 } 3517 const input = element; 3518 return input.type === "radio" && input.name !== "" ? input : null; 3519 } 3520 function isTabbableRadio(element, candidates) { 3521 const input = getNamedRadioInput(element); 3522 if (!input) { 3523 return true; 3524 } 3525 const checkedRadio = candidates.find((candidate) => { 3526 const radio = getNamedRadioInput(candidate); 3527 return radio?.name === input.name && radio.form === input.form && radio.checked; 3528 }); 3529 if (checkedRadio) { 3530 return checkedRadio === input; 3531 } 3532 return candidates.find((candidate) => { 3533 const radio = getNamedRadioInput(candidate); 3534 return radio?.name === input.name && radio.form === input.form; 3535 }) === input; 3536 } 3537 function getComposedChildren(container) { 3538 if (isHTMLElement(container) && getNodeName(container) === "slot") { 3539 const assignedElements = container.assignedElements({ 3540 flatten: true 3541 }); 3542 if (assignedElements.length > 0) { 3543 return assignedElements; 3544 } 3545 } 3546 if (isHTMLElement(container) && container.shadowRoot) { 3547 return Array.from(container.shadowRoot.children); 3548 } 3549 return Array.from(container.children); 3550 } 3551 function appendCandidates(container, list) { 3552 getComposedChildren(container).forEach((child) => { 3553 if (isFocusableCandidate(child)) { 3554 list.push(child); 3555 } 3556 appendCandidates(child, list); 3557 }); 3558 } 3559 function appendMatchingElements(container, selector2, list) { 3560 getComposedChildren(container).forEach((child) => { 3561 if (isHTMLElement(child) && child.matches(selector2)) { 3562 list.push(child); 3563 } 3564 appendMatchingElements(child, selector2, list); 3565 }); 3566 } 3567 function focusable(container) { 3568 const candidates = []; 3569 appendCandidates(container, candidates); 3570 return candidates.filter(isFocusableElement); 3571 } 3572 function tabbable(container) { 3573 const candidates = focusable(container); 3574 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 3575 } 3576 function getTabbableIn(container, dir) { 3577 const list = tabbable(container); 3578 const len = list.length; 3579 if (len === 0) { 3580 return void 0; 3581 } 3582 const active = activeElement(ownerDocument(container)); 3583 const index2 = list.indexOf(active); 3584 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 3585 return list[nextIndex]; 3586 } 3587 function getNextTabbable(referenceElement) { 3588 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 3589 } 3590 function getPreviousTabbable(referenceElement) { 3591 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 3592 } 3593 function isOutsideEvent(event, container) { 3594 const containerElement = container || event.currentTarget; 3595 const relatedTarget = event.relatedTarget; 3596 return !relatedTarget || !contains(containerElement, relatedTarget); 3597 } 3598 function disableFocusInside(container) { 3599 const tabbableElements = tabbable(container); 3600 tabbableElements.forEach((element) => { 3601 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 3602 element.setAttribute("tabindex", "-1"); 3603 }); 3604 } 3605 function enableFocusInside(container) { 3606 const elements2 = []; 3607 appendMatchingElements(container, "[data-tabindex]", elements2); 3608 elements2.forEach((element) => { 3609 const tabindex = element.dataset.tabindex; 3610 delete element.dataset.tabindex; 3611 if (tabindex) { 3612 element.setAttribute("tabindex", tabindex); 3613 } else { 3614 element.removeAttribute("tabindex"); 3615 } 3616 }); 3617 } 3618 3619 // node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js 3620 var React18 = __toESM(require_react(), 1); 3621 3622 // node_modules/@base-ui/utils/esm/addEventListener.js 3623 function addEventListener(target, type, listener, options) { 3624 target.addEventListener(type, listener, options); 3625 return () => { 3626 target.removeEventListener(type, listener, options); 3627 }; 3628 } 3629 3630 // node_modules/@base-ui/utils/esm/useValueAsRef.js 3631 function useValueAsRef(value) { 3632 const latest = useRefWithInit(createLatestRef, value).current; 3633 latest.next = value; 3634 useIsoLayoutEffect(latest.effect); 3635 return latest; 3636 } 3637 function createLatestRef(value) { 3638 const latest = { 3639 current: value, 3640 next: value, 3641 effect: () => { 3642 latest.current = latest.next; 3643 } 3644 }; 3645 return latest; 3646 } 3647 3648 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js 3649 var React17 = __toESM(require_react(), 1); 3650 3651 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js 3652 var ReactDOM = __toESM(require_react_dom(), 1); 3653 3654 // node_modules/@base-ui/react/esm/utils/resolveRef.js 3655 function resolveRef(maybeRef) { 3656 if (maybeRef == null) { 3657 return maybeRef; 3658 } 3659 return "current" in maybeRef ? maybeRef.current : maybeRef; 3660 } 3661 3662 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js 3663 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { 3664 const frame = useAnimationFrame(); 3665 return useStableCallback((fnToExecute, signal = null) => { 3666 frame.cancel(); 3667 const element = resolveRef(elementOrRef); 3668 if (element == null) { 3669 return; 3670 } 3671 const resolvedElement = element; 3672 const done = () => { 3673 ReactDOM.flushSync(fnToExecute); 3674 }; 3675 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 3676 fnToExecute(); 3677 return; 3678 } 3679 function exec() { 3680 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 3681 if (!signal?.aborted) { 3682 done(); 3683 } 3684 }).catch(() => { 3685 if (treatAbortedAsFinished) { 3686 if (!signal?.aborted) { 3687 done(); 3688 } 3689 return; 3690 } 3691 const currentAnimations = resolvedElement.getAnimations(); 3692 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 3693 exec(); 3694 } 3695 }); 3696 } 3697 if (waitForStartingStyleRemoved) { 3698 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; 3699 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 3700 frame.request(exec); 3701 return; 3702 } 3703 const attributeObserver = new MutationObserver(() => { 3704 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 3705 attributeObserver.disconnect(); 3706 exec(); 3707 } 3708 }); 3709 attributeObserver.observe(resolvedElement, { 3710 attributes: true, 3711 attributeFilter: [startingStyleAttribute] 3712 }); 3713 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 3714 once: true 3715 }); 3716 return; 3717 } 3718 frame.request(exec); 3719 }); 3720 } 3721 3722 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js 3723 function useOpenChangeComplete(parameters) { 3724 const { 3725 enabled = true, 3726 open, 3727 ref, 3728 onComplete: onCompleteParam 3729 } = parameters; 3730 const onComplete = useStableCallback(onCompleteParam); 3731 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); 3732 React17.useEffect(() => { 3733 if (!enabled) { 3734 return void 0; 3735 } 3736 const abortController = new AbortController(); 3737 runOnceAnimationsFinish(onComplete, abortController.signal); 3738 return () => { 3739 abortController.abort(); 3740 }; 3741 }, [enabled, open, onComplete, runOnceAnimationsFinish]); 3742 } 3743 3744 // node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js 3745 var EMPTY_DIMENSIONS = { 3746 height: void 0, 3747 width: void 0 3748 }; 3749 function useCollapsiblePanel(parameters) { 3750 const { 3751 externalRef, 3752 hiddenUntilFound, 3753 id: idParam, 3754 keepMounted, 3755 mounted, 3756 onOpenChange, 3757 open, 3758 setMounted, 3759 setOpen, 3760 transitionStatus 3761 } = parameters; 3762 const panelRef = React18.useRef(null); 3763 const animationTypeRef = React18.useRef(null); 3764 const [dimensions, setDimensionsUnwrapped] = React18.useState(EMPTY_DIMENSIONS); 3765 const lastMeasuredDimensionsRef = React18.useRef(EMPTY_DIMENSIONS); 3766 const shouldSkipNextOpenRef = React18.useRef(false); 3767 const shouldPreventMountAnimationRef = React18.useRef(open); 3768 const shouldPreventActivityResumeAnimationRef = React18.useRef(false); 3769 const [forcePanelIdle, setForcePanelIdle] = React18.useState(false); 3770 const pendingTemporaryStyleRestoreRef = React18.useRef(null); 3771 const mergedPanelRef = useMergedRefs(externalRef, panelRef); 3772 const latestStateRef = useValueAsRef({ 3773 mounted, 3774 open 3775 }); 3776 const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef, false, false); 3777 const hidden = !open && !mounted; 3778 const panelTransitionStatus = forcePanelIdle ? "idle" : transitionStatus; 3779 const shouldPreventOpenAnimation = open && // These 2 refs are safe to read in render, they are only written from committed 3780 // layout/effect paths and gate one-shot motion suppression for the next open 3781 // lifecycle. They intentionally expose the last committed motion snapshot. 3782 (shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current); 3783 const renderedDimensions = !open && mounted && // These 2 refs are also safe to read in render, both hold the last committed 3784 // animation mode and measurement. This fallback only restores a previously 3785 // measured pixel size after the live dimensions state has been reset back to `auto`. 3786 animationTypeRef.current === "css-animation" && dimensions.height === void 0 && dimensions.width === void 0 ? lastMeasuredDimensionsRef.current : dimensions; 3787 const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== "css-animation"; 3788 const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => { 3789 if (shouldCacheMeasurement) { 3790 lastMeasuredDimensionsRef.current = nextDimensions; 3791 } 3792 setDimensionsUnwrapped(nextDimensions); 3793 }); 3794 const restorePendingTemporaryStyle = useStableCallback(() => { 3795 pendingTemporaryStyleRestoreRef.current?.(); 3796 pendingTemporaryStyleRestoreRef.current = null; 3797 }); 3798 const setPendingTemporaryStyleRestore = useStableCallback((restore) => { 3799 restorePendingTemporaryStyle(); 3800 pendingTemporaryStyleRestoreRef.current = () => { 3801 pendingTemporaryStyleRestoreRef.current = null; 3802 restore(); 3803 }; 3804 }); 3805 const markActivityResumeAnimationSuppressed = useStableCallback(() => { 3806 if (open && mounted && animationTypeRef.current === "css-animation") { 3807 shouldPreventActivityResumeAnimationRef.current = true; 3808 } 3809 }); 3810 useIsoLayoutEffect(() => { 3811 if (!forcePanelIdle || transitionStatus === "starting") { 3812 return; 3813 } 3814 setForcePanelIdle(false); 3815 }, [forcePanelIdle, transitionStatus]); 3816 React18.useEffect(() => { 3817 return () => { 3818 markActivityResumeAnimationSuppressed(); 3819 restorePendingTemporaryStyle(); 3820 }; 3821 }, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]); 3822 useIsoLayoutEffect(() => { 3823 const panel = panelRef.current; 3824 if (!panel) { 3825 return void 0; 3826 } 3827 if (!open && pendingTemporaryStyleRestoreRef.current) { 3828 restorePendingTemporaryStyle(); 3829 } 3830 const animationType = getAnimationType(panel, shouldPreventOpenAnimation); 3831 animationTypeRef.current = animationType; 3832 if (open && transitionStatus === "idle" && shouldPreventMountAnimationRef.current && animationType === "css-animation") { 3833 lastMeasuredDimensionsRef.current = getDimensions(panel); 3834 return void 0; 3835 } 3836 if (open && transitionStatus === "starting") { 3837 const skipNextOpen = shouldSkipNextOpenRef.current; 3838 shouldSkipNextOpenRef.current = false; 3839 if (animationType === "none") { 3840 setDimensions(getDimensions(panel)); 3841 setForcePanelIdle(true); 3842 return void 0; 3843 } 3844 if (animationType === "css-transition") { 3845 const restoreLayoutStyles = resetLayoutStyles(panel); 3846 setDimensions(getDimensions(panel)); 3847 if (!skipNextOpen) { 3848 return restoreLayoutStyles; 3849 } 3850 const restoreTransitionDuration = setTemporaryStyle(panel, "transition-duration", "0s"); 3851 setPendingTemporaryStyleRestore(restoreTransitionDuration); 3852 setForcePanelIdle(true); 3853 return restoreLayoutStyles; 3854 } 3855 if (animationType === "css-animation") { 3856 setDimensions(getDimensions(panel)); 3857 if (!skipNextOpen) { 3858 const restoreAnimationName2 = setTemporaryStyle(panel, "animation-name", "none"); 3859 restoreAnimationName2(); 3860 return void 0; 3861 } 3862 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none"); 3863 const restoreAnimationDuration = setTemporaryStyle(panel, "animation-duration", "0s"); 3864 restoreAnimationName(); 3865 setPendingTemporaryStyleRestore(restoreAnimationDuration); 3866 setForcePanelIdle(true); 3867 return void 0; 3868 } 3869 } 3870 if (!open && mounted && (transitionStatus === "idle" || transitionStatus === "starting")) { 3871 if (animationType === "none") { 3872 setDimensions(EMPTY_DIMENSIONS, false); 3873 setMounted(false); 3874 return void 0; 3875 } 3876 if (animationType === "css-animation") { 3877 shouldPreventMountAnimationRef.current = false; 3878 shouldPreventActivityResumeAnimationRef.current = false; 3879 } 3880 setDimensions(getDimensions(panel)); 3881 return void 0; 3882 } 3883 if (transitionStatus !== "ending") { 3884 return void 0; 3885 } 3886 if (animationType === "none") { 3887 setMounted(false); 3888 return void 0; 3889 } 3890 const nextDimensions = getDimensions(panel); 3891 const hasMeasuredSize = (nextDimensions.height ?? 0) > 0 || (nextDimensions.width ?? 0) > 0; 3892 if (!hasMeasuredSize) { 3893 setMounted(false); 3894 return void 0; 3895 } 3896 setDimensions(nextDimensions); 3897 if (animationType === "css-animation") { 3898 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none"); 3899 restoreAnimationName(); 3900 } 3901 return void 0; 3902 }, [mounted, open, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]); 3903 useOpenChangeComplete({ 3904 enabled: open && mounted && panelTransitionStatus === "idle", 3905 open: true, 3906 ref: panelRef, 3907 onComplete() { 3908 if (!open) { 3909 return; 3910 } 3911 setDimensions(EMPTY_DIMENSIONS, false); 3912 } 3913 }); 3914 React18.useEffect(() => { 3915 if (open || !mounted || panelTransitionStatus !== "ending") { 3916 return void 0; 3917 } 3918 const panel = panelRef.current; 3919 if (!panel) { 3920 return void 0; 3921 } 3922 const abortController = new AbortController(); 3923 let endingStyleFrame = -1; 3924 function handleComplete() { 3925 if (latestStateRef.current.open) { 3926 return; 3927 } 3928 setMounted(false); 3929 setDimensions(EMPTY_DIMENSIONS, false); 3930 } 3931 endingStyleFrame = AnimationFrame.request(() => { 3932 if (!abortController.signal.aborted) { 3933 runOnceCloseAnimationsFinish(handleComplete, abortController.signal); 3934 } 3935 }); 3936 return () => { 3937 AnimationFrame.cancel(endingStyleFrame); 3938 abortController.abort(); 3939 }; 3940 }, [latestStateRef, mounted, open, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]); 3941 useIsoLayoutEffect(() => { 3942 const panel = panelRef.current; 3943 if (!panel || !hiddenUntilFound || !hidden) { 3944 return; 3945 } 3946 panel.setAttribute("hidden", "until-found"); 3947 }, [hidden, hiddenUntilFound]); 3948 React18.useEffect(function registerBeforeMatchListener() { 3949 const panel = panelRef.current; 3950 if (!panel) { 3951 return void 0; 3952 } 3953 function handleBeforeMatch(event) { 3954 shouldSkipNextOpenRef.current = true; 3955 setOpen(true); 3956 onOpenChange(true, createChangeEventDetails(reason_parts_exports.none, event)); 3957 } 3958 return addEventListener(panel, "beforematch", handleBeforeMatch); 3959 }, [onOpenChange, setOpen]); 3960 const shouldRender = keepMounted || hiddenUntilFound || mounted || open; 3961 return { 3962 height: renderedDimensions.height, 3963 props: { 3964 ...shouldPersistHiddenTransitionStyles ? { 3965 [CollapsiblePanelDataAttributes.startingStyle]: "" 3966 } : void 0, 3967 hidden, 3968 id: idParam 3969 }, 3970 ref: mergedPanelRef, 3971 shouldPreventOpenAnimation, 3972 shouldRender, 3973 transitionStatus: panelTransitionStatus, 3974 width: renderedDimensions.width 3975 }; 3976 } 3977 function getDimensions(element) { 3978 return { 3979 height: element.scrollHeight, 3980 width: element.scrollWidth 3981 }; 3982 } 3983 function getAnimationType(element, hasSuppressedMountAnimation = false) { 3984 const panelStyles = getWindow(element).getComputedStyle(element); 3985 const hasAnimation = (panelStyles.animationName.split(",").map((name2) => name2.trim()).some((name2) => name2 !== "" && name2 !== "none") || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration); 3986 const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration); 3987 if (hasAnimation && hasTransition) { 3988 if (true) { 3989 warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used."); 3990 } 3991 return "css-transition"; 3992 } 3993 if (hasTransition) { 3994 return "css-transition"; 3995 } 3996 if (hasAnimation) { 3997 return "css-animation"; 3998 } 3999 return "none"; 4000 } 4001 function hasNonZeroDuration(value) { 4002 return value.split(",").map((part) => part.trim()).some((part) => part !== "" && Number.parseFloat(part) > 0); 4003 } 4004 function setTemporaryStyle(element, property, value) { 4005 const previousValue = element.style.getPropertyValue(property); 4006 const previousPriority = element.style.getPropertyPriority(property); 4007 element.style.setProperty(property, value); 4008 return () => { 4009 if (previousValue === "") { 4010 element.style.removeProperty(property); 4011 return; 4012 } 4013 element.style.setProperty(property, previousValue, previousPriority); 4014 }; 4015 } 4016 function resetLayoutStyles(element) { 4017 const originalLayoutStyles = { 4018 "justify-content": element.style.justifyContent, 4019 "align-items": element.style.alignItems, 4020 "align-content": element.style.alignContent, 4021 "justify-items": element.style.justifyItems 4022 }; 4023 Object.keys(originalLayoutStyles).forEach((key) => { 4024 element.style.setProperty(key, "initial", "important"); 4025 }); 4026 function restoreLayoutStyles() { 4027 Object.entries(originalLayoutStyles).forEach(([key, value]) => { 4028 if (value === "") { 4029 element.style.removeProperty(key); 4030 return; 4031 } 4032 element.style.setProperty(key, value); 4033 }); 4034 } 4035 const frame = AnimationFrame.request(restoreLayoutStyles); 4036 return () => { 4037 AnimationFrame.cancel(frame); 4038 restoreLayoutStyles(); 4039 }; 4040 } 4041 4042 // node_modules/@base-ui/utils/esm/useOnFirstRender.js 4043 var React19 = __toESM(require_react(), 1); 4044 function useOnFirstRender(fn) { 4045 const ref = React19.useRef(true); 4046 if (ref.current) { 4047 ref.current = false; 4048 fn(); 4049 } 4050 } 4051 4052 // node_modules/@base-ui/utils/esm/useTimeout.js 4053 var EMPTY3 = 0; 4054 var Timeout = class _Timeout { 4055 static create() { 4056 return new _Timeout(); 4057 } 4058 currentId = EMPTY3; 4059 /** 4060 * Executes `fn` after `delay`, clearing any previously scheduled call. 4061 */ 4062 start(delay, fn) { 4063 this.clear(); 4064 this.currentId = setTimeout(() => { 4065 this.currentId = EMPTY3; 4066 fn(); 4067 }, delay); 4068 } 4069 isStarted() { 4070 return this.currentId !== EMPTY3; 4071 } 4072 clear = () => { 4073 if (this.currentId !== EMPTY3) { 4074 clearTimeout(this.currentId); 4075 this.currentId = EMPTY3; 4076 } 4077 }; 4078 disposeEffect = () => { 4079 return this.clear; 4080 }; 4081 }; 4082 function useTimeout() { 4083 const timeout = useRefWithInit(Timeout.create).current; 4084 useOnMount(timeout.disposeEffect); 4085 return timeout; 4086 } 4087 4088 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js 4089 var React20 = __toESM(require_react(), 1); 4090 4091 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverShared.js 4092 function resolveValue(value, pointerType) { 4093 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 4094 return 0; 4095 } 4096 if (typeof value === "function") { 4097 return value(); 4098 } 4099 return value; 4100 } 4101 function getDelay(value, prop, pointerType) { 4102 const result = resolveValue(value, pointerType); 4103 if (typeof result === "number") { 4104 return result; 4105 } 4106 return result?.[prop]; 4107 } 4108 function getRestMs(value) { 4109 if (typeof value === "function") { 4110 return value(); 4111 } 4112 return value; 4113 } 4114 function isClickLikeOpenEvent(openEventType, interactedInside) { 4115 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 4116 } 4117 function isHoverOpenEvent(openEventType) { 4118 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 4119 } 4120 4121 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js 4122 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 4123 var FloatingDelayGroupContext = /* @__PURE__ */ React20.createContext({ 4124 hasProvider: false, 4125 timeoutMs: 0, 4126 delayRef: { 4127 current: 0 4128 }, 4129 initialDelayRef: { 4130 current: 0 4131 }, 4132 timeout: new Timeout(), 4133 currentIdRef: { 4134 current: null 4135 }, 4136 currentContextRef: { 4137 current: null 4138 } 4139 }); 4140 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 4141 function FloatingDelayGroup(props) { 4142 const { 4143 children, 4144 delay, 4145 timeoutMs = 0 4146 } = props; 4147 const delayRef = React20.useRef(delay); 4148 const initialDelayRef = React20.useRef(delay); 4149 const currentIdRef = React20.useRef(null); 4150 const currentContextRef = React20.useRef(null); 4151 const timeout = useTimeout(); 4152 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { 4153 value: React20.useMemo(() => ({ 4154 hasProvider: true, 4155 delayRef, 4156 initialDelayRef, 4157 currentIdRef, 4158 timeoutMs, 4159 currentContextRef, 4160 timeout 4161 }), [timeoutMs, timeout]), 4162 children 4163 }); 4164 } 4165 function useDelayGroup(context, options = { 4166 open: false 4167 }) { 4168 const { 4169 open 4170 } = options; 4171 const store2 = "rootStore" in context ? context.rootStore : context; 4172 const floatingId = store2.useState("floatingId"); 4173 const groupContext = React20.useContext(FloatingDelayGroupContext); 4174 const { 4175 currentIdRef, 4176 delayRef, 4177 timeoutMs, 4178 initialDelayRef, 4179 currentContextRef, 4180 hasProvider, 4181 timeout 4182 } = groupContext; 4183 const [isInstantPhase, setIsInstantPhase] = React20.useState(false); 4184 useIsoLayoutEffect(() => { 4185 function unset() { 4186 setIsInstantPhase(false); 4187 currentContextRef.current?.setIsInstantPhase(false); 4188 currentIdRef.current = null; 4189 currentContextRef.current = null; 4190 delayRef.current = initialDelayRef.current; 4191 } 4192 if (!currentIdRef.current) { 4193 return void 0; 4194 } 4195 if (!open && currentIdRef.current === floatingId) { 4196 setIsInstantPhase(false); 4197 if (timeoutMs) { 4198 const closingId = floatingId; 4199 timeout.start(timeoutMs, () => { 4200 if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 4201 return; 4202 } 4203 unset(); 4204 }); 4205 return () => { 4206 timeout.clear(); 4207 }; 4208 } 4209 unset(); 4210 } 4211 return void 0; 4212 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]); 4213 useIsoLayoutEffect(() => { 4214 if (!open) { 4215 return; 4216 } 4217 const prevContext = currentContextRef.current; 4218 const prevId = currentIdRef.current; 4219 timeout.clear(); 4220 currentContextRef.current = { 4221 onOpenChange: store2.setOpen, 4222 setIsInstantPhase 4223 }; 4224 currentIdRef.current = floatingId; 4225 delayRef.current = { 4226 open: 0, 4227 close: getDelay(initialDelayRef.current, "close") 4228 }; 4229 if (prevId !== null && prevId !== floatingId) { 4230 setIsInstantPhase(true); 4231 prevContext?.setIsInstantPhase(true); 4232 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 4233 } else { 4234 setIsInstantPhase(false); 4235 prevContext?.setIsInstantPhase(false); 4236 } 4237 }, [open, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 4238 useIsoLayoutEffect(() => { 4239 return () => { 4240 currentContextRef.current = null; 4241 }; 4242 }, [currentContextRef]); 4243 return React20.useMemo(() => ({ 4244 hasProvider, 4245 delayRef, 4246 isInstantPhase 4247 }), [hasProvider, delayRef, isInstantPhase]); 4248 } 4249 4250 // node_modules/@base-ui/utils/esm/mergeCleanups.js 4251 function mergeCleanups(...cleanups) { 4252 return () => { 4253 for (let i2 = 0; i2 < cleanups.length; i2 += 1) { 4254 const cleanup = cleanups[i2]; 4255 if (cleanup) { 4256 cleanup(); 4257 } 4258 } 4259 }; 4260 } 4261 4262 // node_modules/@base-ui/react/esm/utils/FocusGuard.js 4263 var React21 = __toESM(require_react(), 1); 4264 4265 // node_modules/@base-ui/utils/esm/visuallyHidden.js 4266 var visuallyHiddenBase = { 4267 clipPath: "inset(50%)", 4268 overflow: "hidden", 4269 whiteSpace: "nowrap", 4270 border: 0, 4271 padding: 0, 4272 width: 1, 4273 height: 1, 4274 margin: -1 4275 }; 4276 var visuallyHidden = { 4277 ...visuallyHiddenBase, 4278 position: "fixed", 4279 top: 0, 4280 left: 0 4281 }; 4282 var visuallyHiddenInput = { 4283 ...visuallyHiddenBase, 4284 position: "absolute" 4285 }; 4286 4287 // node_modules/@base-ui/react/esm/utils/FocusGuard.js 4288 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 4289 var FocusGuard = /* @__PURE__ */ React21.forwardRef(function FocusGuard2(props, ref) { 4290 const [role, setRole] = React21.useState(); 4291 useIsoLayoutEffect(() => { 4292 if (isSafari) { 4293 setRole("button"); 4294 } 4295 }, []); 4296 const restProps = { 4297 tabIndex: 0, 4298 // Role is only for VoiceOver 4299 role 4300 }; 4301 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { 4302 ...props, 4303 ref, 4304 style: visuallyHidden, 4305 "aria-hidden": role ? void 0 : true, 4306 ...restProps, 4307 "data-base-ui-focus-guard": "" 4308 }); 4309 }); 4310 if (true) FocusGuard.displayName = "FocusGuard"; 4311 4312 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createAttribute.js 4313 function createAttribute(name2) { 4314 return `data-base-ui-$name2}`; 4315 } 4316 4317 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js 4318 var React22 = __toESM(require_react(), 1); 4319 var ReactDOM2 = __toESM(require_react_dom(), 1); 4320 4321 // node_modules/@base-ui/react/esm/internals/constants.js 4322 var DISABLED_TRANSITIONS_STYLE = { 4323 style: { 4324 transition: "none" 4325 } 4326 }; 4327 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 4328 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 4329 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 4330 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 4331 var POPUP_COLLISION_AVOIDANCE = { 4332 fallbackAxisSide: "end" 4333 }; 4334 var ownerVisuallyHidden = { 4335 clipPath: "inset(50%)", 4336 position: "fixed", 4337 top: 0, 4338 left: 0 4339 }; 4340 4341 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js 4342 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 4343 var PortalContext = /* @__PURE__ */ React22.createContext(null); 4344 if (true) PortalContext.displayName = "PortalContext"; 4345 var usePortalContext = () => React22.useContext(PortalContext); 4346 var attr = createAttribute("portal"); 4347 function useFloatingPortalNode(props = {}) { 4348 const { 4349 ref, 4350 container: containerProp, 4351 componentProps = EMPTY_OBJECT, 4352 elementProps 4353 } = props; 4354 const uniqueId = useId(); 4355 const portalContext = usePortalContext(); 4356 const parentPortalNode = portalContext?.portalNode; 4357 const [containerElement, setContainerElement] = React22.useState(null); 4358 const [portalNode, setPortalNode] = React22.useState(null); 4359 const setPortalNodeRef = useStableCallback((node) => { 4360 if (node !== null) { 4361 setPortalNode(node); 4362 } 4363 }); 4364 const containerRef = React22.useRef(null); 4365 useIsoLayoutEffect(() => { 4366 if (containerProp === null) { 4367 if (containerRef.current) { 4368 containerRef.current = null; 4369 setPortalNode(null); 4370 setContainerElement(null); 4371 } 4372 return; 4373 } 4374 if (uniqueId == null) { 4375 return; 4376 } 4377 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 4378 if (resolvedContainer == null) { 4379 if (containerRef.current) { 4380 containerRef.current = null; 4381 setPortalNode(null); 4382 setContainerElement(null); 4383 } 4384 return; 4385 } 4386 if (containerRef.current !== resolvedContainer) { 4387 containerRef.current = resolvedContainer; 4388 setPortalNode(null); 4389 setContainerElement(resolvedContainer); 4390 } 4391 }, [containerProp, parentPortalNode, uniqueId]); 4392 const portalElement = useRenderElement("div", componentProps, { 4393 ref: [ref, setPortalNodeRef], 4394 props: [{ 4395 id: uniqueId, 4396 [attr]: "" 4397 }, elementProps] 4398 }); 4399 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 4400 return { 4401 portalNode, 4402 portalSubtree 4403 }; 4404 } 4405 var FloatingPortal = /* @__PURE__ */ React22.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 4406 const { 4407 render: render4, 4408 className, 4409 style, 4410 children, 4411 container, 4412 renderGuards, 4413 ...elementProps 4414 } = componentProps; 4415 const { 4416 portalNode, 4417 portalSubtree 4418 } = useFloatingPortalNode({ 4419 container, 4420 ref: forwardedRef, 4421 componentProps, 4422 elementProps 4423 }); 4424 const beforeOutsideRef = React22.useRef(null); 4425 const afterOutsideRef = React22.useRef(null); 4426 const beforeInsideRef = React22.useRef(null); 4427 const afterInsideRef = React22.useRef(null); 4428 const [focusManagerState, setFocusManagerState] = React22.useState(null); 4429 const focusInsideDisabledRef = React22.useRef(false); 4430 const modal = focusManagerState?.modal; 4431 const open = focusManagerState?.open; 4432 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 4433 React22.useEffect(() => { 4434 if (!portalNode || modal) { 4435 return void 0; 4436 } 4437 function onFocus(event) { 4438 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 4439 if (event.type === "focusin") { 4440 if (focusInsideDisabledRef.current) { 4441 enableFocusInside(portalNode); 4442 focusInsideDisabledRef.current = false; 4443 } 4444 } else { 4445 disableFocusInside(portalNode); 4446 focusInsideDisabledRef.current = true; 4447 } 4448 } 4449 } 4450 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 4451 }, [portalNode, modal]); 4452 React22.useEffect(() => { 4453 if (!portalNode || open !== false) { 4454 return; 4455 } 4456 enableFocusInside(portalNode); 4457 focusInsideDisabledRef.current = false; 4458 }, [open, portalNode]); 4459 const portalContextValue = React22.useMemo(() => ({ 4460 beforeOutsideRef, 4461 afterOutsideRef, 4462 beforeInsideRef, 4463 afterInsideRef, 4464 portalNode, 4465 setFocusManagerState 4466 }), [portalNode]); 4467 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React22.Fragment, { 4468 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { 4469 value: portalContextValue, 4470 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 4471 "data-type": "outside", 4472 ref: beforeOutsideRef, 4473 onFocus: (event) => { 4474 if (isOutsideEvent(event, portalNode)) { 4475 beforeInsideRef.current?.focus(); 4476 } else { 4477 const domReference = focusManagerState ? focusManagerState.domReference : null; 4478 const prevTabbable = getPreviousTabbable(domReference); 4479 prevTabbable?.focus(); 4480 } 4481 } 4482 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { 4483 "aria-owns": portalNode.id, 4484 style: ownerVisuallyHidden 4485 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 4486 "data-type": "outside", 4487 ref: afterOutsideRef, 4488 onFocus: (event) => { 4489 if (isOutsideEvent(event, portalNode)) { 4490 afterInsideRef.current?.focus(); 4491 } else { 4492 const domReference = focusManagerState ? focusManagerState.domReference : null; 4493 const nextTabbable = getNextTabbable(domReference); 4494 nextTabbable?.focus(); 4495 if (focusManagerState?.closeOnFocusOut) { 4496 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 4497 } 4498 } 4499 } 4500 })] 4501 })] 4502 }); 4503 }); 4504 if (true) FloatingPortal.displayName = "FloatingPortal"; 4505 4506 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js 4507 var React23 = __toESM(require_react(), 1); 4508 4509 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createEventEmitter.js 4510 function createEventEmitter() { 4511 const map = /* @__PURE__ */ new Map(); 4512 return { 4513 emit(event, data) { 4514 map.get(event)?.forEach((listener) => listener(data)); 4515 }, 4516 on(event, listener) { 4517 if (!map.has(event)) { 4518 map.set(event, /* @__PURE__ */ new Set()); 4519 } 4520 map.get(event).add(listener); 4521 }, 4522 off(event, listener) { 4523 map.get(event)?.delete(listener); 4524 } 4525 }; 4526 } 4527 4528 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js 4529 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 4530 var FloatingNodeContext = /* @__PURE__ */ React23.createContext(null); 4531 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 4532 var FloatingTreeContext = /* @__PURE__ */ React23.createContext(null); 4533 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 4534 var useFloatingParentNodeId = () => React23.useContext(FloatingNodeContext)?.id || null; 4535 var useFloatingTree = (externalTree) => { 4536 const contextTree = React23.useContext(FloatingTreeContext); 4537 return externalTree ?? contextTree; 4538 }; 4539 4540 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClientPoint.js 4541 var React24 = __toESM(require_react(), 1); 4542 function createVirtualElement(domElement, data) { 4543 let offsetX = null; 4544 let offsetY = null; 4545 let isAutoUpdateEvent = false; 4546 return { 4547 contextElement: domElement || void 0, 4548 getBoundingClientRect() { 4549 const domRect = domElement?.getBoundingClientRect() || { 4550 width: 0, 4551 height: 0, 4552 x: 0, 4553 y: 0 4554 }; 4555 const isXAxis = data.axis === "x" || data.axis === "both"; 4556 const isYAxis = data.axis === "y" || data.axis === "both"; 4557 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 4558 let width = domRect.width; 4559 let height = domRect.height; 4560 let x2 = domRect.x; 4561 let y2 = domRect.y; 4562 if (offsetX == null && data.x && isXAxis) { 4563 offsetX = domRect.x - data.x; 4564 } 4565 if (offsetY == null && data.y && isYAxis) { 4566 offsetY = domRect.y - data.y; 4567 } 4568 x2 -= offsetX || 0; 4569 y2 -= offsetY || 0; 4570 width = 0; 4571 height = 0; 4572 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 4573 width = data.axis === "y" ? domRect.width : 0; 4574 height = data.axis === "x" ? domRect.height : 0; 4575 x2 = isXAxis && data.x != null ? data.x : x2; 4576 y2 = isYAxis && data.y != null ? data.y : y2; 4577 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 4578 height = data.axis === "x" ? domRect.height : height; 4579 width = data.axis === "y" ? domRect.width : width; 4580 } 4581 isAutoUpdateEvent = true; 4582 return { 4583 width, 4584 height, 4585 x: x2, 4586 y: y2, 4587 top: y2, 4588 right: x2 + width, 4589 bottom: y2 + height, 4590 left: x2 4591 }; 4592 } 4593 }; 4594 } 4595 function isMouseBasedEvent(event) { 4596 return event != null && event.clientX != null; 4597 } 4598 function useClientPoint(context, props = {}) { 4599 const { 4600 enabled = true, 4601 axis = "both" 4602 } = props; 4603 const store2 = "rootStore" in context ? context.rootStore : context; 4604 const open = store2.useState("open"); 4605 const floating = store2.useState("floatingElement"); 4606 const domReference = store2.useState("domReferenceElement"); 4607 const dataRef = store2.context.dataRef; 4608 const initialRef = React24.useRef(false); 4609 const cleanupListenerRef = React24.useRef(null); 4610 const [pointerType, setPointerType] = React24.useState(); 4611 const [reactive, setReactive] = React24.useState([]); 4612 const resetReference = useStableCallback((reference2) => { 4613 store2.set("positionReference", reference2); 4614 }); 4615 const setReference = useStableCallback((newX, newY, referenceElement) => { 4616 if (initialRef.current) { 4617 return; 4618 } 4619 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 4620 return; 4621 } 4622 store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 4623 x: newX, 4624 y: newY, 4625 axis, 4626 dataRef, 4627 pointerType 4628 })); 4629 }); 4630 const handleReferenceEnterOrMove = useStableCallback((event) => { 4631 if (!open) { 4632 setReference(event.clientX, event.clientY, event.currentTarget); 4633 } else if (!cleanupListenerRef.current) { 4634 setReference(event.clientX, event.clientY, event.currentTarget); 4635 setReactive([]); 4636 } 4637 }); 4638 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 4639 React24.useEffect(() => { 4640 if (!enabled) { 4641 resetReference(domReference); 4642 return void 0; 4643 } 4644 if (!openCheck) { 4645 return void 0; 4646 } 4647 function cleanupListener() { 4648 cleanupListenerRef.current?.(); 4649 cleanupListenerRef.current = null; 4650 } 4651 const win = getWindow(floating); 4652 function handleMouseMove(event) { 4653 const target = getTarget(event); 4654 if (!contains(floating, target)) { 4655 setReference(event.clientX, event.clientY); 4656 } else { 4657 cleanupListener(); 4658 } 4659 } 4660 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 4661 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 4662 } else { 4663 resetReference(domReference); 4664 } 4665 return cleanupListener; 4666 }, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]); 4667 React24.useEffect(() => () => { 4668 store2.set("positionReference", null); 4669 }, [store2]); 4670 React24.useEffect(() => { 4671 if (enabled && !floating) { 4672 initialRef.current = false; 4673 } 4674 }, [enabled, floating]); 4675 React24.useEffect(() => { 4676 if (!enabled && open) { 4677 initialRef.current = true; 4678 } 4679 }, [enabled, open]); 4680 const reference = React24.useMemo(() => { 4681 function setPointerTypeRef(event) { 4682 setPointerType(event.pointerType); 4683 } 4684 return { 4685 onPointerDown: setPointerTypeRef, 4686 onPointerEnter: setPointerTypeRef, 4687 onMouseMove: handleReferenceEnterOrMove, 4688 onMouseEnter: handleReferenceEnterOrMove 4689 }; 4690 }, [handleReferenceEnterOrMove]); 4691 return React24.useMemo(() => enabled ? { 4692 reference, 4693 trigger: reference 4694 } : {}, [enabled, reference]); 4695 } 4696 4697 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useDismiss.js 4698 var React25 = __toESM(require_react(), 1); 4699 var bubbleHandlerKeys = { 4700 intentional: "onClick", 4701 sloppy: "onPointerDown" 4702 }; 4703 function alwaysFalse() { 4704 return false; 4705 } 4706 function normalizeProp(normalizable) { 4707 return { 4708 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 4709 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 4710 }; 4711 } 4712 function useDismiss(context, props = {}) { 4713 const { 4714 enabled = true, 4715 escapeKey: escapeKey2 = true, 4716 outsidePress: outsidePressProp = true, 4717 outsidePressEvent = "sloppy", 4718 referencePress = alwaysFalse, 4719 referencePressEvent = "sloppy", 4720 bubbles, 4721 externalTree 4722 } = props; 4723 const store2 = "rootStore" in context ? context.rootStore : context; 4724 const open = store2.useState("open"); 4725 const floatingElement = store2.useState("floatingElement"); 4726 const { 4727 dataRef 4728 } = store2.context; 4729 const tree = useFloatingTree(externalTree); 4730 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 4731 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 4732 const outsidePressEnabled = outsidePress2 !== false; 4733 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 4734 const { 4735 escapeKey: escapeKeyBubbles, 4736 outsidePress: outsidePressBubbles 4737 } = normalizeProp(bubbles); 4738 const pressStartedInsideRef = React25.useRef(false); 4739 const pressStartPreventedRef = React25.useRef(false); 4740 const suppressNextOutsideClickRef = React25.useRef(false); 4741 const isComposingRef = React25.useRef(false); 4742 const currentPointerTypeRef = React25.useRef(""); 4743 const touchStateRef = React25.useRef(null); 4744 const cancelDismissOnEndTimeout = useTimeout(); 4745 const clearInsideReactTreeTimeout = useTimeout(); 4746 const clearInsideReactTree = useStableCallback(() => { 4747 clearInsideReactTreeTimeout.clear(); 4748 dataRef.current.insideReactTree = false; 4749 }); 4750 const hasBlockingChild = useStableCallback((bubbleKey) => { 4751 const nodeId = dataRef.current.floatingContext?.nodeId; 4752 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 4753 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 4754 }); 4755 const isEventWithinOwnElements = useStableCallback((event) => { 4756 return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")); 4757 }); 4758 const closeOnReferencePress = useStableCallback((event) => { 4759 if (!referencePress()) { 4760 return; 4761 } 4762 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 4763 }); 4764 const closeOnEscapeKeyDown = useStableCallback((event) => { 4765 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { 4766 return; 4767 } 4768 if (isComposingRef.current) { 4769 return; 4770 } 4771 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 4772 return; 4773 } 4774 const native = isReactEvent(event) ? event.nativeEvent : event; 4775 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 4776 store2.setOpen(false, eventDetails); 4777 if (!eventDetails.isCanceled) { 4778 event.preventDefault(); 4779 } 4780 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 4781 event.stopPropagation(); 4782 } 4783 }); 4784 const markInsideReactTree = useStableCallback(() => { 4785 dataRef.current.insideReactTree = true; 4786 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 4787 }); 4788 const markPressStartedInsideReactTree = useStableCallback((event) => { 4789 if (!open || !enabled || event.button !== 0) { 4790 return; 4791 } 4792 const target = getTarget(event.nativeEvent); 4793 if (!contains(store2.select("floatingElement"), target)) { 4794 return; 4795 } 4796 if (!pressStartedInsideRef.current) { 4797 pressStartedInsideRef.current = true; 4798 pressStartPreventedRef.current = false; 4799 } 4800 }); 4801 const markInsidePressStartPrevented = useStableCallback((event) => { 4802 if (!open || !enabled) { 4803 return; 4804 } 4805 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 4806 return; 4807 } 4808 if (pressStartedInsideRef.current) { 4809 pressStartPreventedRef.current = true; 4810 } 4811 }); 4812 React25.useEffect(() => { 4813 if (!open || !enabled) { 4814 return void 0; 4815 } 4816 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 4817 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 4818 const compositionTimeout = new Timeout(); 4819 const preventedPressSuppressionTimeout = new Timeout(); 4820 function handleCompositionStart() { 4821 compositionTimeout.clear(); 4822 isComposingRef.current = true; 4823 } 4824 function handleCompositionEnd() { 4825 compositionTimeout.start( 4826 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 4827 // Only apply to WebKit for the test to remain 0ms. 4828 isWebKit() ? 5 : 0, 4829 () => { 4830 isComposingRef.current = false; 4831 } 4832 ); 4833 } 4834 function suppressImmediateOutsideClickAfterPreventedStart() { 4835 suppressNextOutsideClickRef.current = true; 4836 preventedPressSuppressionTimeout.start(0, () => { 4837 suppressNextOutsideClickRef.current = false; 4838 }); 4839 } 4840 function resetPressStartState() { 4841 pressStartedInsideRef.current = false; 4842 pressStartPreventedRef.current = false; 4843 } 4844 function getOutsidePressEvent() { 4845 const type = currentPointerTypeRef.current; 4846 const computedType = type === "pen" || !type ? "mouse" : type; 4847 const outsidePressEventValue = getOutsidePressEventProp(); 4848 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 4849 if (typeof resolved === "string") { 4850 return resolved; 4851 } 4852 return resolved[computedType]; 4853 } 4854 function shouldIgnoreEvent(event) { 4855 const computedOutsidePressEvent = getOutsidePressEvent(); 4856 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 4857 } 4858 function isEventWithinFloatingTree(event) { 4859 const nodeId = dataRef.current.floatingContext?.nodeId; 4860 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 4861 return isEventWithinOwnElements(event) || targetIsInsideChildren; 4862 } 4863 function closeOnPressOutside(event) { 4864 if (shouldIgnoreEvent(event)) { 4865 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 4866 preventedPressSuppressionTimeout.clear(); 4867 suppressNextOutsideClickRef.current = false; 4868 } 4869 clearInsideReactTree(); 4870 return; 4871 } 4872 if (dataRef.current.insideReactTree) { 4873 clearInsideReactTree(); 4874 return; 4875 } 4876 const target = getTarget(event); 4877 const inertSelector = `[$createAttribute("inert")}]`; 4878 const targetRoot = isElement(target) ? target.getRootNode() : null; 4879 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector)); 4880 const triggers = store2.context.triggerElements; 4881 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 4882 return; 4883 } 4884 let targetRootAncestor = isElement(target) ? target : null; 4885 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 4886 const nextParent = getParentNode(targetRootAncestor); 4887 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 4888 break; 4889 } 4890 targetRootAncestor = nextParent; 4891 } 4892 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 4893 !contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the 4894 // element was injected after the floating element rendered. 4895 markers.every((marker) => !contains(targetRootAncestor, marker))) { 4896 return; 4897 } 4898 if (isHTMLElement(target) && !("touches" in event)) { 4899 const lastTraversableNode = isLastTraversableNode(target); 4900 const style = getComputedStyle2(target); 4901 const scrollRe = /auto|scroll/; 4902 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 4903 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 4904 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 4905 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 4906 const isRTL23 = style.direction === "rtl"; 4907 const pressedVerticalScrollbar = canScrollY && (isRTL23 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 4908 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 4909 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 4910 return; 4911 } 4912 } 4913 if (isEventWithinFloatingTree(event)) { 4914 return; 4915 } 4916 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { 4917 preventedPressSuppressionTimeout.clear(); 4918 suppressNextOutsideClickRef.current = false; 4919 return; 4920 } 4921 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 4922 return; 4923 } 4924 if (hasBlockingChild("__outsidePressBubbles")) { 4925 return; 4926 } 4927 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 4928 clearInsideReactTree(); 4929 } 4930 function handlePointerDown(event) { 4931 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 4932 return; 4933 } 4934 closeOnPressOutside(event); 4935 } 4936 function handleTouchStart(event) { 4937 if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { 4938 return; 4939 } 4940 const touch = event.touches[0]; 4941 if (touch) { 4942 touchStateRef.current = { 4943 startTime: Date.now(), 4944 startX: touch.clientX, 4945 startY: touch.clientY, 4946 dismissOnTouchEnd: false, 4947 dismissOnMouseDown: true 4948 }; 4949 cancelDismissOnEndTimeout.start(1e3, () => { 4950 if (touchStateRef.current) { 4951 touchStateRef.current.dismissOnTouchEnd = false; 4952 touchStateRef.current.dismissOnMouseDown = false; 4953 } 4954 }); 4955 } 4956 } 4957 function addTargetEventListenerOnce(event, listener) { 4958 const target = getTarget(event); 4959 if (!target) { 4960 return; 4961 } 4962 const unsubscribe2 = addEventListener(target, event.type, () => { 4963 listener(event); 4964 unsubscribe2(); 4965 }); 4966 } 4967 function handleTouchStartCapture(event) { 4968 currentPointerTypeRef.current = "touch"; 4969 addTargetEventListenerOnce(event, handleTouchStart); 4970 } 4971 function closeOnPressOutsideCapture(event) { 4972 cancelDismissOnEndTimeout.clear(); 4973 if (event.type === "pointerdown") { 4974 currentPointerTypeRef.current = event.pointerType; 4975 } 4976 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 4977 return; 4978 } 4979 addTargetEventListenerOnce(event, (targetEvent) => { 4980 if (targetEvent.type === "pointerdown") { 4981 handlePointerDown(targetEvent); 4982 } else { 4983 closeOnPressOutside(targetEvent); 4984 } 4985 }); 4986 } 4987 function handlePressEndCapture(event) { 4988 if (!pressStartedInsideRef.current) { 4989 return; 4990 } 4991 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 4992 resetPressStartState(); 4993 if (getOutsidePressEvent() !== "intentional") { 4994 return; 4995 } 4996 if (event.type === "pointercancel") { 4997 if (pressStartedInsideDefaultPrevented) { 4998 suppressImmediateOutsideClickAfterPreventedStart(); 4999 } 5000 return; 5001 } 5002 if (isEventWithinFloatingTree(event)) { 5003 return; 5004 } 5005 if (pressStartedInsideDefaultPrevented) { 5006 suppressImmediateOutsideClickAfterPreventedStart(); 5007 return; 5008 } 5009 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 5010 return; 5011 } 5012 preventedPressSuppressionTimeout.clear(); 5013 suppressNextOutsideClickRef.current = true; 5014 clearInsideReactTree(); 5015 } 5016 function handleTouchMove(event) { 5017 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 5018 return; 5019 } 5020 const touch = event.touches[0]; 5021 if (!touch) { 5022 return; 5023 } 5024 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 5025 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 5026 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 5027 if (distance > 5) { 5028 touchStateRef.current.dismissOnTouchEnd = true; 5029 } 5030 if (distance > 10) { 5031 closeOnPressOutside(event); 5032 cancelDismissOnEndTimeout.clear(); 5033 touchStateRef.current = null; 5034 } 5035 } 5036 function handleTouchMoveCapture(event) { 5037 addTargetEventListenerOnce(event, handleTouchMove); 5038 } 5039 function handleTouchEnd(event) { 5040 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 5041 return; 5042 } 5043 if (touchStateRef.current.dismissOnTouchEnd) { 5044 closeOnPressOutside(event); 5045 } 5046 cancelDismissOnEndTimeout.clear(); 5047 touchStateRef.current = null; 5048 } 5049 function handleTouchEndCapture(event) { 5050 addTargetEventListenerOnce(event, handleTouchEnd); 5051 } 5052 const doc = ownerDocument(floatingElement); 5053 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))); 5054 return () => { 5055 unsubscribe(); 5056 compositionTimeout.clear(); 5057 preventedPressSuppressionTimeout.clear(); 5058 resetPressStartState(); 5059 suppressNextOutsideClickRef.current = false; 5060 }; 5061 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]); 5062 React25.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); 5063 const reference = React25.useMemo(() => ({ 5064 onKeyDown: closeOnEscapeKeyDown, 5065 [bubbleHandlerKeys[referencePressEvent]]: closeOnReferencePress, 5066 ...referencePressEvent !== "intentional" && { 5067 onClick: closeOnReferencePress 5068 } 5069 }), [closeOnEscapeKeyDown, closeOnReferencePress, referencePressEvent]); 5070 const floating = React25.useMemo(() => ({ 5071 onKeyDown: closeOnEscapeKeyDown, 5072 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 5073 // `onPointerDown`, such as with <NumberField.ScrubArea>. 5074 // See https://github.com/mui/base-ui/pull/3379 5075 onPointerDown: markInsidePressStartPrevented, 5076 onMouseDown: markInsidePressStartPrevented, 5077 onClickCapture: markInsideReactTree, 5078 onMouseDownCapture(event) { 5079 markInsideReactTree(); 5080 markPressStartedInsideReactTree(event); 5081 }, 5082 onPointerDownCapture(event) { 5083 markInsideReactTree(); 5084 markPressStartedInsideReactTree(event); 5085 }, 5086 onMouseUpCapture: markInsideReactTree, 5087 onTouchEndCapture: markInsideReactTree, 5088 onTouchMoveCapture: markInsideReactTree 5089 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 5090 return React25.useMemo(() => enabled ? { 5091 reference, 5092 floating, 5093 trigger: reference 5094 } : {}, [enabled, reference, floating]); 5095 } 5096 5097 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js 5098 var React32 = __toESM(require_react(), 1); 5099 5100 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 5101 function computeCoordsFromPlacement(_ref, placement, rtl) { 5102 let { 5103 reference, 5104 floating 5105 } = _ref; 5106 const sideAxis = getSideAxis(placement); 5107 const alignmentAxis = getAlignmentAxis(placement); 5108 const alignLength = getAxisLength(alignmentAxis); 5109 const side = getSide(placement); 5110 const isVertical = sideAxis === "y"; 5111 const commonX = reference.x + reference.width / 2 - floating.width / 2; 5112 const commonY = reference.y + reference.height / 2 - floating.height / 2; 5113 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 5114 let coords; 5115 switch (side) { 5116 case "top": 5117 coords = { 5118 x: commonX, 5119 y: reference.y - floating.height 5120 }; 5121 break; 5122 case "bottom": 5123 coords = { 5124 x: commonX, 5125 y: reference.y + reference.height 5126 }; 5127 break; 5128 case "right": 5129 coords = { 5130 x: reference.x + reference.width, 5131 y: commonY 5132 }; 5133 break; 5134 case "left": 5135 coords = { 5136 x: reference.x - floating.width, 5137 y: commonY 5138 }; 5139 break; 5140 default: 5141 coords = { 5142 x: reference.x, 5143 y: reference.y 5144 }; 5145 } 5146 switch (getAlignment(placement)) { 5147 case "start": 5148 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 5149 break; 5150 case "end": 5151 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 5152 break; 5153 } 5154 return coords; 5155 } 5156 async function detectOverflow(state, options) { 5157 var _await$platform$isEle; 5158 if (options === void 0) { 5159 options = {}; 5160 } 5161 const { 5162 x: x2, 5163 y: y2, 5164 platform: platform3, 5165 rects, 5166 elements: elements2, 5167 strategy 5168 } = state; 5169 const { 5170 boundary = "clippingAncestors", 5171 rootBoundary = "viewport", 5172 elementContext = "floating", 5173 altBoundary = false, 5174 padding = 0 5175 } = evaluate(options, state); 5176 const paddingObject = getPaddingObject(padding); 5177 const altContext = elementContext === "floating" ? "reference" : "floating"; 5178 const element = elements2[altBoundary ? altContext : elementContext]; 5179 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 5180 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)), 5181 boundary, 5182 rootBoundary, 5183 strategy 5184 })); 5185 const rect = elementContext === "floating" ? { 5186 x: x2, 5187 y: y2, 5188 width: rects.floating.width, 5189 height: rects.floating.height 5190 } : rects.reference; 5191 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements2.floating)); 5192 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 5193 x: 1, 5194 y: 1 5195 } : { 5196 x: 1, 5197 y: 1 5198 }; 5199 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 5200 elements: elements2, 5201 rect, 5202 offsetParent, 5203 strategy 5204 }) : rect); 5205 return { 5206 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 5207 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 5208 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 5209 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 5210 }; 5211 } 5212 var MAX_RESET_COUNT = 50; 5213 var computePosition = async (reference, floating, config2) => { 5214 const { 5215 placement = "bottom", 5216 strategy = "absolute", 5217 middleware = [], 5218 platform: platform3 5219 } = config2; 5220 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 5221 ...platform3, 5222 detectOverflow 5223 }; 5224 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 5225 let rects = await platform3.getElementRects({ 5226 reference, 5227 floating, 5228 strategy 5229 }); 5230 let { 5231 x: x2, 5232 y: y2 5233 } = computeCoordsFromPlacement(rects, placement, rtl); 5234 let statefulPlacement = placement; 5235 let resetCount = 0; 5236 const middlewareData = {}; 5237 for (let i2 = 0; i2 < middleware.length; i2++) { 5238 const currentMiddleware = middleware[i2]; 5239 if (!currentMiddleware) { 5240 continue; 5241 } 5242 const { 5243 name: name2, 5244 fn 5245 } = currentMiddleware; 5246 const { 5247 x: nextX, 5248 y: nextY, 5249 data, 5250 reset 5251 } = await fn({ 5252 x: x2, 5253 y: y2, 5254 initialPlacement: placement, 5255 placement: statefulPlacement, 5256 strategy, 5257 middlewareData, 5258 rects, 5259 platform: platformWithDetectOverflow, 5260 elements: { 5261 reference, 5262 floating 5263 } 5264 }); 5265 x2 = nextX != null ? nextX : x2; 5266 y2 = nextY != null ? nextY : y2; 5267 middlewareData[name2] = { 5268 ...middlewareData[name2], 5269 ...data 5270 }; 5271 if (reset && resetCount < MAX_RESET_COUNT) { 5272 resetCount++; 5273 if (typeof reset === "object") { 5274 if (reset.placement) { 5275 statefulPlacement = reset.placement; 5276 } 5277 if (reset.rects) { 5278 rects = reset.rects === true ? await platform3.getElementRects({ 5279 reference, 5280 floating, 5281 strategy 5282 }) : reset.rects; 5283 } 5284 ({ 5285 x: x2, 5286 y: y2 5287 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 5288 } 5289 i2 = -1; 5290 } 5291 } 5292 return { 5293 x: x2, 5294 y: y2, 5295 placement: statefulPlacement, 5296 strategy, 5297 middlewareData 5298 }; 5299 }; 5300 var flip = function(options) { 5301 if (options === void 0) { 5302 options = {}; 5303 } 5304 return { 5305 name: "flip", 5306 options, 5307 async fn(state) { 5308 var _middlewareData$arrow, _middlewareData$flip; 5309 const { 5310 placement, 5311 middlewareData, 5312 rects, 5313 initialPlacement, 5314 platform: platform3, 5315 elements: elements2 5316 } = state; 5317 const { 5318 mainAxis: checkMainAxis = true, 5319 crossAxis: checkCrossAxis = true, 5320 fallbackPlacements: specifiedFallbackPlacements, 5321 fallbackStrategy = "bestFit", 5322 fallbackAxisSideDirection = "none", 5323 flipAlignment = true, 5324 ...detectOverflowOptions 5325 } = evaluate(options, state); 5326 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 5327 return {}; 5328 } 5329 const side = getSide(placement); 5330 const initialSideAxis = getSideAxis(initialPlacement); 5331 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 5332 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)); 5333 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 5334 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 5335 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 5336 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 5337 } 5338 const placements2 = [initialPlacement, ...fallbackPlacements]; 5339 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5340 const overflows = []; 5341 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 5342 if (checkMainAxis) { 5343 overflows.push(overflow[side]); 5344 } 5345 if (checkCrossAxis) { 5346 const sides2 = getAlignmentSides(placement, rects, rtl); 5347 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 5348 } 5349 overflowsData = [...overflowsData, { 5350 placement, 5351 overflows 5352 }]; 5353 if (!overflows.every((side2) => side2 <= 0)) { 5354 var _middlewareData$flip2, _overflowsData$filter; 5355 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 5356 const nextPlacement = placements2[nextIndex]; 5357 if (nextPlacement) { 5358 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 5359 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 5360 // overflows the main axis. 5361 overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : true)) { 5362 return { 5363 data: { 5364 index: nextIndex, 5365 overflows: overflowsData 5366 }, 5367 reset: { 5368 placement: nextPlacement 5369 } 5370 }; 5371 } 5372 } 5373 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a2, b2) => a2.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 5374 if (!resetPlacement) { 5375 switch (fallbackStrategy) { 5376 case "bestFit": { 5377 var _overflowsData$filter2; 5378 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => { 5379 if (hasFallbackAxisSideDirection) { 5380 const currentSideAxis = getSideAxis(d2.placement); 5381 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 5382 // reading directions favoring greater width. 5383 currentSideAxis === "y"; 5384 } 5385 return true; 5386 }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; 5387 if (placement2) { 5388 resetPlacement = placement2; 5389 } 5390 break; 5391 } 5392 case "initialPlacement": 5393 resetPlacement = initialPlacement; 5394 break; 5395 } 5396 } 5397 if (placement !== resetPlacement) { 5398 return { 5399 reset: { 5400 placement: resetPlacement 5401 } 5402 }; 5403 } 5404 } 5405 return {}; 5406 } 5407 }; 5408 }; 5409 function getSideOffsets(overflow, rect) { 5410 return { 5411 top: overflow.top - rect.height, 5412 right: overflow.right - rect.width, 5413 bottom: overflow.bottom - rect.height, 5414 left: overflow.left - rect.width 5415 }; 5416 } 5417 function isAnySideFullyClipped(overflow) { 5418 return sides.some((side) => overflow[side] >= 0); 5419 } 5420 var hide = function(options) { 5421 if (options === void 0) { 5422 options = {}; 5423 } 5424 return { 5425 name: "hide", 5426 options, 5427 async fn(state) { 5428 const { 5429 rects, 5430 platform: platform3 5431 } = state; 5432 const { 5433 strategy = "referenceHidden", 5434 ...detectOverflowOptions 5435 } = evaluate(options, state); 5436 switch (strategy) { 5437 case "referenceHidden": { 5438 const overflow = await platform3.detectOverflow(state, { 5439 ...detectOverflowOptions, 5440 elementContext: "reference" 5441 }); 5442 const offsets = getSideOffsets(overflow, rects.reference); 5443 return { 5444 data: { 5445 referenceHiddenOffsets: offsets, 5446 referenceHidden: isAnySideFullyClipped(offsets) 5447 } 5448 }; 5449 } 5450 case "escaped": { 5451 const overflow = await platform3.detectOverflow(state, { 5452 ...detectOverflowOptions, 5453 altBoundary: true 5454 }); 5455 const offsets = getSideOffsets(overflow, rects.floating); 5456 return { 5457 data: { 5458 escapedOffsets: offsets, 5459 escaped: isAnySideFullyClipped(offsets) 5460 } 5461 }; 5462 } 5463 default: { 5464 return {}; 5465 } 5466 } 5467 } 5468 }; 5469 }; 5470 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 5471 async function convertValueToCoords(state, options) { 5472 const { 5473 placement, 5474 platform: platform3, 5475 elements: elements2 5476 } = state; 5477 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)); 5478 const side = getSide(placement); 5479 const alignment = getAlignment(placement); 5480 const isVertical = getSideAxis(placement) === "y"; 5481 const mainAxisMulti = originSides.has(side) ? -1 : 1; 5482 const crossAxisMulti = rtl && isVertical ? -1 : 1; 5483 const rawValue = evaluate(options, state); 5484 let { 5485 mainAxis, 5486 crossAxis, 5487 alignmentAxis 5488 } = typeof rawValue === "number" ? { 5489 mainAxis: rawValue, 5490 crossAxis: 0, 5491 alignmentAxis: null 5492 } : { 5493 mainAxis: rawValue.mainAxis || 0, 5494 crossAxis: rawValue.crossAxis || 0, 5495 alignmentAxis: rawValue.alignmentAxis 5496 }; 5497 if (alignment && typeof alignmentAxis === "number") { 5498 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 5499 } 5500 return isVertical ? { 5501 x: crossAxis * crossAxisMulti, 5502 y: mainAxis * mainAxisMulti 5503 } : { 5504 x: mainAxis * mainAxisMulti, 5505 y: crossAxis * crossAxisMulti 5506 }; 5507 } 5508 var offset = function(options) { 5509 if (options === void 0) { 5510 options = 0; 5511 } 5512 return { 5513 name: "offset", 5514 options, 5515 async fn(state) { 5516 var _middlewareData$offse, _middlewareData$arrow; 5517 const { 5518 x: x2, 5519 y: y2, 5520 placement, 5521 middlewareData 5522 } = state; 5523 const diffCoords = await convertValueToCoords(state, options); 5524 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 5525 return {}; 5526 } 5527 return { 5528 x: x2 + diffCoords.x, 5529 y: y2 + diffCoords.y, 5530 data: { 5531 ...diffCoords, 5532 placement 5533 } 5534 }; 5535 } 5536 }; 5537 }; 5538 var shift = function(options) { 5539 if (options === void 0) { 5540 options = {}; 5541 } 5542 return { 5543 name: "shift", 5544 options, 5545 async fn(state) { 5546 const { 5547 x: x2, 5548 y: y2, 5549 placement, 5550 platform: platform3 5551 } = state; 5552 const { 5553 mainAxis: checkMainAxis = true, 5554 crossAxis: checkCrossAxis = false, 5555 limiter = { 5556 fn: (_ref) => { 5557 let { 5558 x: x3, 5559 y: y3 5560 } = _ref; 5561 return { 5562 x: x3, 5563 y: y3 5564 }; 5565 } 5566 }, 5567 ...detectOverflowOptions 5568 } = evaluate(options, state); 5569 const coords = { 5570 x: x2, 5571 y: y2 5572 }; 5573 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5574 const crossAxis = getSideAxis(getSide(placement)); 5575 const mainAxis = getOppositeAxis(crossAxis); 5576 let mainAxisCoord = coords[mainAxis]; 5577 let crossAxisCoord = coords[crossAxis]; 5578 if (checkMainAxis) { 5579 const minSide = mainAxis === "y" ? "top" : "left"; 5580 const maxSide = mainAxis === "y" ? "bottom" : "right"; 5581 const min2 = mainAxisCoord + overflow[minSide]; 5582 const max2 = mainAxisCoord - overflow[maxSide]; 5583 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 5584 } 5585 if (checkCrossAxis) { 5586 const minSide = crossAxis === "y" ? "top" : "left"; 5587 const maxSide = crossAxis === "y" ? "bottom" : "right"; 5588 const min2 = crossAxisCoord + overflow[minSide]; 5589 const max2 = crossAxisCoord - overflow[maxSide]; 5590 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 5591 } 5592 const limitedCoords = limiter.fn({ 5593 ...state, 5594 [mainAxis]: mainAxisCoord, 5595 [crossAxis]: crossAxisCoord 5596 }); 5597 return { 5598 ...limitedCoords, 5599 data: { 5600 x: limitedCoords.x - x2, 5601 y: limitedCoords.y - y2, 5602 enabled: { 5603 [mainAxis]: checkMainAxis, 5604 [crossAxis]: checkCrossAxis 5605 } 5606 } 5607 }; 5608 } 5609 }; 5610 }; 5611 var limitShift = function(options) { 5612 if (options === void 0) { 5613 options = {}; 5614 } 5615 return { 5616 options, 5617 fn(state) { 5618 const { 5619 x: x2, 5620 y: y2, 5621 placement, 5622 rects, 5623 middlewareData 5624 } = state; 5625 const { 5626 offset: offset4 = 0, 5627 mainAxis: checkMainAxis = true, 5628 crossAxis: checkCrossAxis = true 5629 } = evaluate(options, state); 5630 const coords = { 5631 x: x2, 5632 y: y2 5633 }; 5634 const crossAxis = getSideAxis(placement); 5635 const mainAxis = getOppositeAxis(crossAxis); 5636 let mainAxisCoord = coords[mainAxis]; 5637 let crossAxisCoord = coords[crossAxis]; 5638 const rawOffset = evaluate(offset4, state); 5639 const computedOffset = typeof rawOffset === "number" ? { 5640 mainAxis: rawOffset, 5641 crossAxis: 0 5642 } : { 5643 mainAxis: 0, 5644 crossAxis: 0, 5645 ...rawOffset 5646 }; 5647 if (checkMainAxis) { 5648 const len = mainAxis === "y" ? "height" : "width"; 5649 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 5650 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 5651 if (mainAxisCoord < limitMin) { 5652 mainAxisCoord = limitMin; 5653 } else if (mainAxisCoord > limitMax) { 5654 mainAxisCoord = limitMax; 5655 } 5656 } 5657 if (checkCrossAxis) { 5658 var _middlewareData$offse, _middlewareData$offse2; 5659 const len = mainAxis === "y" ? "width" : "height"; 5660 const isOriginSide = originSides.has(getSide(placement)); 5661 const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); 5662 const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); 5663 if (crossAxisCoord < limitMin) { 5664 crossAxisCoord = limitMin; 5665 } else if (crossAxisCoord > limitMax) { 5666 crossAxisCoord = limitMax; 5667 } 5668 } 5669 return { 5670 [mainAxis]: mainAxisCoord, 5671 [crossAxis]: crossAxisCoord 5672 }; 5673 } 5674 }; 5675 }; 5676 var size = function(options) { 5677 if (options === void 0) { 5678 options = {}; 5679 } 5680 return { 5681 name: "size", 5682 options, 5683 async fn(state) { 5684 var _state$middlewareData, _state$middlewareData2; 5685 const { 5686 placement, 5687 rects, 5688 platform: platform3, 5689 elements: elements2 5690 } = state; 5691 const { 5692 apply = () => { 5693 }, 5694 ...detectOverflowOptions 5695 } = evaluate(options, state); 5696 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5697 const side = getSide(placement); 5698 const alignment = getAlignment(placement); 5699 const isYAxis = getSideAxis(placement) === "y"; 5700 const { 5701 width, 5702 height 5703 } = rects.floating; 5704 let heightSide; 5705 let widthSide; 5706 if (side === "top" || side === "bottom") { 5707 heightSide = side; 5708 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements2.floating)) ? "start" : "end") ? "left" : "right"; 5709 } else { 5710 widthSide = side; 5711 heightSide = alignment === "end" ? "top" : "bottom"; 5712 } 5713 const maximumClippingHeight = height - overflow.top - overflow.bottom; 5714 const maximumClippingWidth = width - overflow.left - overflow.right; 5715 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 5716 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 5717 const noShift = !state.middlewareData.shift; 5718 let availableHeight = overflowAvailableHeight; 5719 let availableWidth = overflowAvailableWidth; 5720 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 5721 availableWidth = maximumClippingWidth; 5722 } 5723 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 5724 availableHeight = maximumClippingHeight; 5725 } 5726 if (noShift && !alignment) { 5727 const xMin = max(overflow.left, 0); 5728 const xMax = max(overflow.right, 0); 5729 const yMin = max(overflow.top, 0); 5730 const yMax = max(overflow.bottom, 0); 5731 if (isYAxis) { 5732 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 5733 } else { 5734 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 5735 } 5736 } 5737 await apply({ 5738 ...state, 5739 availableWidth, 5740 availableHeight 5741 }); 5742 const nextDimensions = await platform3.getDimensions(elements2.floating); 5743 if (width !== nextDimensions.width || height !== nextDimensions.height) { 5744 return { 5745 reset: { 5746 rects: true 5747 } 5748 }; 5749 } 5750 return {}; 5751 } 5752 }; 5753 }; 5754 5755 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 5756 function getCssDimensions(element) { 5757 const css = getComputedStyle2(element); 5758 let width = parseFloat(css.width) || 0; 5759 let height = parseFloat(css.height) || 0; 5760 const hasOffset = isHTMLElement(element); 5761 const offsetWidth = hasOffset ? element.offsetWidth : width; 5762 const offsetHeight = hasOffset ? element.offsetHeight : height; 5763 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 5764 if (shouldFallback) { 5765 width = offsetWidth; 5766 height = offsetHeight; 5767 } 5768 return { 5769 width, 5770 height, 5771 $: shouldFallback 5772 }; 5773 } 5774 function unwrapElement(element) { 5775 return !isElement(element) ? element.contextElement : element; 5776 } 5777 function getScale(element) { 5778 const domElement = unwrapElement(element); 5779 if (!isHTMLElement(domElement)) { 5780 return createCoords(1); 5781 } 5782 const rect = domElement.getBoundingClientRect(); 5783 const { 5784 width, 5785 height, 5786 $: $2 5787 } = getCssDimensions(domElement); 5788 let x2 = ($2 ? round(rect.width) : rect.width) / width; 5789 let y2 = ($2 ? round(rect.height) : rect.height) / height; 5790 if (!x2 || !Number.isFinite(x2)) { 5791 x2 = 1; 5792 } 5793 if (!y2 || !Number.isFinite(y2)) { 5794 y2 = 1; 5795 } 5796 return { 5797 x: x2, 5798 y: y2 5799 }; 5800 } 5801 var noOffsets = /* @__PURE__ */ createCoords(0); 5802 function getVisualOffsets(element) { 5803 const win = getWindow(element); 5804 if (!isWebKit() || !win.visualViewport) { 5805 return noOffsets; 5806 } 5807 return { 5808 x: win.visualViewport.offsetLeft, 5809 y: win.visualViewport.offsetTop 5810 }; 5811 } 5812 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 5813 if (isFixed === void 0) { 5814 isFixed = false; 5815 } 5816 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 5817 return false; 5818 } 5819 return isFixed; 5820 } 5821 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 5822 if (includeScale === void 0) { 5823 includeScale = false; 5824 } 5825 if (isFixedStrategy === void 0) { 5826 isFixedStrategy = false; 5827 } 5828 const clientRect = element.getBoundingClientRect(); 5829 const domElement = unwrapElement(element); 5830 let scale = createCoords(1); 5831 if (includeScale) { 5832 if (offsetParent) { 5833 if (isElement(offsetParent)) { 5834 scale = getScale(offsetParent); 5835 } 5836 } else { 5837 scale = getScale(element); 5838 } 5839 } 5840 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 5841 let x2 = (clientRect.left + visualOffsets.x) / scale.x; 5842 let y2 = (clientRect.top + visualOffsets.y) / scale.y; 5843 let width = clientRect.width / scale.x; 5844 let height = clientRect.height / scale.y; 5845 if (domElement) { 5846 const win = getWindow(domElement); 5847 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 5848 let currentWin = win; 5849 let currentIFrame = getFrameElement(currentWin); 5850 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 5851 const iframeScale = getScale(currentIFrame); 5852 const iframeRect = currentIFrame.getBoundingClientRect(); 5853 const css = getComputedStyle2(currentIFrame); 5854 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 5855 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 5856 x2 *= iframeScale.x; 5857 y2 *= iframeScale.y; 5858 width *= iframeScale.x; 5859 height *= iframeScale.y; 5860 x2 += left; 5861 y2 += top; 5862 currentWin = getWindow(currentIFrame); 5863 currentIFrame = getFrameElement(currentWin); 5864 } 5865 } 5866 return rectToClientRect({ 5867 width, 5868 height, 5869 x: x2, 5870 y: y2 5871 }); 5872 } 5873 function getWindowScrollBarX(element, rect) { 5874 const leftScroll = getNodeScroll(element).scrollLeft; 5875 if (!rect) { 5876 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 5877 } 5878 return rect.left + leftScroll; 5879 } 5880 function getHTMLOffset(documentElement, scroll) { 5881 const htmlRect = documentElement.getBoundingClientRect(); 5882 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 5883 const y2 = htmlRect.top + scroll.scrollTop; 5884 return { 5885 x: x2, 5886 y: y2 5887 }; 5888 } 5889 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 5890 let { 5891 elements: elements2, 5892 rect, 5893 offsetParent, 5894 strategy 5895 } = _ref; 5896 const isFixed = strategy === "fixed"; 5897 const documentElement = getDocumentElement(offsetParent); 5898 const topLayer = elements2 ? isTopLayer(elements2.floating) : false; 5899 if (offsetParent === documentElement || topLayer && isFixed) { 5900 return rect; 5901 } 5902 let scroll = { 5903 scrollLeft: 0, 5904 scrollTop: 0 5905 }; 5906 let scale = createCoords(1); 5907 const offsets = createCoords(0); 5908 const isOffsetParentAnElement = isHTMLElement(offsetParent); 5909 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 5910 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 5911 scroll = getNodeScroll(offsetParent); 5912 } 5913 if (isOffsetParentAnElement) { 5914 const offsetRect = getBoundingClientRect(offsetParent); 5915 scale = getScale(offsetParent); 5916 offsets.x = offsetRect.x + offsetParent.clientLeft; 5917 offsets.y = offsetRect.y + offsetParent.clientTop; 5918 } 5919 } 5920 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 5921 return { 5922 width: rect.width * scale.x, 5923 height: rect.height * scale.y, 5924 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 5925 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 5926 }; 5927 } 5928 function getClientRects(element) { 5929 return Array.from(element.getClientRects()); 5930 } 5931 function getDocumentRect(element) { 5932 const html = getDocumentElement(element); 5933 const scroll = getNodeScroll(element); 5934 const body = element.ownerDocument.body; 5935 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 5936 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 5937 let x2 = -scroll.scrollLeft + getWindowScrollBarX(element); 5938 const y2 = -scroll.scrollTop; 5939 if (getComputedStyle2(body).direction === "rtl") { 5940 x2 += max(html.clientWidth, body.clientWidth) - width; 5941 } 5942 return { 5943 width, 5944 height, 5945 x: x2, 5946 y: y2 5947 }; 5948 } 5949 var SCROLLBAR_MAX = 25; 5950 function getViewportRect(element, strategy) { 5951 const win = getWindow(element); 5952 const html = getDocumentElement(element); 5953 const visualViewport = win.visualViewport; 5954 let width = html.clientWidth; 5955 let height = html.clientHeight; 5956 let x2 = 0; 5957 let y2 = 0; 5958 if (visualViewport) { 5959 width = visualViewport.width; 5960 height = visualViewport.height; 5961 const visualViewportBased = isWebKit(); 5962 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 5963 x2 = visualViewport.offsetLeft; 5964 y2 = visualViewport.offsetTop; 5965 } 5966 } 5967 const windowScrollbarX = getWindowScrollBarX(html); 5968 if (windowScrollbarX <= 0) { 5969 const doc = html.ownerDocument; 5970 const body = doc.body; 5971 const bodyStyles = getComputedStyle(body); 5972 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 5973 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 5974 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 5975 width -= clippingStableScrollbarWidth; 5976 } 5977 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 5978 width += windowScrollbarX; 5979 } 5980 return { 5981 width, 5982 height, 5983 x: x2, 5984 y: y2 5985 }; 5986 } 5987 function getInnerBoundingClientRect(element, strategy) { 5988 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 5989 const top = clientRect.top + element.clientTop; 5990 const left = clientRect.left + element.clientLeft; 5991 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 5992 const width = element.clientWidth * scale.x; 5993 const height = element.clientHeight * scale.y; 5994 const x2 = left * scale.x; 5995 const y2 = top * scale.y; 5996 return { 5997 width, 5998 height, 5999 x: x2, 6000 y: y2 6001 }; 6002 } 6003 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 6004 let rect; 6005 if (clippingAncestor === "viewport") { 6006 rect = getViewportRect(element, strategy); 6007 } else if (clippingAncestor === "document") { 6008 rect = getDocumentRect(getDocumentElement(element)); 6009 } else if (isElement(clippingAncestor)) { 6010 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 6011 } else { 6012 const visualOffsets = getVisualOffsets(element); 6013 rect = { 6014 x: clippingAncestor.x - visualOffsets.x, 6015 y: clippingAncestor.y - visualOffsets.y, 6016 width: clippingAncestor.width, 6017 height: clippingAncestor.height 6018 }; 6019 } 6020 return rectToClientRect(rect); 6021 } 6022 function hasFixedPositionAncestor(element, stopNode) { 6023 const parentNode = getParentNode(element); 6024 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 6025 return false; 6026 } 6027 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 6028 } 6029 function getClippingElementAncestors(element, cache) { 6030 const cachedResult = cache.get(element); 6031 if (cachedResult) { 6032 return cachedResult; 6033 } 6034 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 6035 let currentContainingBlockComputedStyle = null; 6036 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 6037 let currentNode = elementIsFixed ? getParentNode(element) : element; 6038 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 6039 const computedStyle = getComputedStyle2(currentNode); 6040 const currentNodeIsContaining = isContainingBlock(currentNode); 6041 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 6042 currentContainingBlockComputedStyle = null; 6043 } 6044 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 6045 if (shouldDropCurrentNode) { 6046 result = result.filter((ancestor) => ancestor !== currentNode); 6047 } else { 6048 currentContainingBlockComputedStyle = computedStyle; 6049 } 6050 currentNode = getParentNode(currentNode); 6051 } 6052 cache.set(element, result); 6053 return result; 6054 } 6055 function getClippingRect(_ref) { 6056 let { 6057 element, 6058 boundary, 6059 rootBoundary, 6060 strategy 6061 } = _ref; 6062 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 6063 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 6064 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 6065 let top = firstRect.top; 6066 let right = firstRect.right; 6067 let bottom = firstRect.bottom; 6068 let left = firstRect.left; 6069 for (let i2 = 1; i2 < clippingAncestors.length; i2++) { 6070 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i2], strategy); 6071 top = max(rect.top, top); 6072 right = min(rect.right, right); 6073 bottom = min(rect.bottom, bottom); 6074 left = max(rect.left, left); 6075 } 6076 return { 6077 width: right - left, 6078 height: bottom - top, 6079 x: left, 6080 y: top 6081 }; 6082 } 6083 function getDimensions2(element) { 6084 const { 6085 width, 6086 height 6087 } = getCssDimensions(element); 6088 return { 6089 width, 6090 height 6091 }; 6092 } 6093 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 6094 const isOffsetParentAnElement = isHTMLElement(offsetParent); 6095 const documentElement = getDocumentElement(offsetParent); 6096 const isFixed = strategy === "fixed"; 6097 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 6098 let scroll = { 6099 scrollLeft: 0, 6100 scrollTop: 0 6101 }; 6102 const offsets = createCoords(0); 6103 function setLeftRTLScrollbarOffset() { 6104 offsets.x = getWindowScrollBarX(documentElement); 6105 } 6106 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 6107 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 6108 scroll = getNodeScroll(offsetParent); 6109 } 6110 if (isOffsetParentAnElement) { 6111 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 6112 offsets.x = offsetRect.x + offsetParent.clientLeft; 6113 offsets.y = offsetRect.y + offsetParent.clientTop; 6114 } else if (documentElement) { 6115 setLeftRTLScrollbarOffset(); 6116 } 6117 } 6118 if (isFixed && !isOffsetParentAnElement && documentElement) { 6119 setLeftRTLScrollbarOffset(); 6120 } 6121 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 6122 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 6123 const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 6124 return { 6125 x: x2, 6126 y: y2, 6127 width: rect.width, 6128 height: rect.height 6129 }; 6130 } 6131 function isStaticPositioned(element) { 6132 return getComputedStyle2(element).position === "static"; 6133 } 6134 function getTrueOffsetParent(element, polyfill) { 6135 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 6136 return null; 6137 } 6138 if (polyfill) { 6139 return polyfill(element); 6140 } 6141 let rawOffsetParent = element.offsetParent; 6142 if (getDocumentElement(element) === rawOffsetParent) { 6143 rawOffsetParent = rawOffsetParent.ownerDocument.body; 6144 } 6145 return rawOffsetParent; 6146 } 6147 function getOffsetParent(element, polyfill) { 6148 const win = getWindow(element); 6149 if (isTopLayer(element)) { 6150 return win; 6151 } 6152 if (!isHTMLElement(element)) { 6153 let svgOffsetParent = getParentNode(element); 6154 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 6155 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 6156 return svgOffsetParent; 6157 } 6158 svgOffsetParent = getParentNode(svgOffsetParent); 6159 } 6160 return win; 6161 } 6162 let offsetParent = getTrueOffsetParent(element, polyfill); 6163 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 6164 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 6165 } 6166 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 6167 return win; 6168 } 6169 return offsetParent || getContainingBlock(element) || win; 6170 } 6171 var getElementRects = async function(data) { 6172 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 6173 const getDimensionsFn = this.getDimensions; 6174 const floatingDimensions = await getDimensionsFn(data.floating); 6175 return { 6176 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 6177 floating: { 6178 x: 0, 6179 y: 0, 6180 width: floatingDimensions.width, 6181 height: floatingDimensions.height 6182 } 6183 }; 6184 }; 6185 function isRTL(element) { 6186 return getComputedStyle2(element).direction === "rtl"; 6187 } 6188 var platform2 = { 6189 convertOffsetParentRelativeRectToViewportRelativeRect, 6190 getDocumentElement, 6191 getClippingRect, 6192 getOffsetParent, 6193 getElementRects, 6194 getClientRects, 6195 getDimensions: getDimensions2, 6196 getScale, 6197 isElement, 6198 isRTL 6199 }; 6200 function rectsAreEqual(a2, b2) { 6201 return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height; 6202 } 6203 function observeMove(element, onMove) { 6204 let io = null; 6205 let timeoutId; 6206 const root = getDocumentElement(element); 6207 function cleanup() { 6208 var _io; 6209 clearTimeout(timeoutId); 6210 (_io = io) == null || _io.disconnect(); 6211 io = null; 6212 } 6213 function refresh(skip, threshold) { 6214 if (skip === void 0) { 6215 skip = false; 6216 } 6217 if (threshold === void 0) { 6218 threshold = 1; 6219 } 6220 cleanup(); 6221 const elementRectForRootMargin = element.getBoundingClientRect(); 6222 const { 6223 left, 6224 top, 6225 width, 6226 height 6227 } = elementRectForRootMargin; 6228 if (!skip) { 6229 onMove(); 6230 } 6231 if (!width || !height) { 6232 return; 6233 } 6234 const insetTop = floor(top); 6235 const insetRight = floor(root.clientWidth - (left + width)); 6236 const insetBottom = floor(root.clientHeight - (top + height)); 6237 const insetLeft = floor(left); 6238 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 6239 const options = { 6240 rootMargin, 6241 threshold: max(0, min(1, threshold)) || 1 6242 }; 6243 let isFirstUpdate = true; 6244 function handleObserve(entries) { 6245 const ratio = entries[0].intersectionRatio; 6246 if (ratio !== threshold) { 6247 if (!isFirstUpdate) { 6248 return refresh(); 6249 } 6250 if (!ratio) { 6251 timeoutId = setTimeout(() => { 6252 refresh(false, 1e-7); 6253 }, 1e3); 6254 } else { 6255 refresh(false, ratio); 6256 } 6257 } 6258 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 6259 refresh(); 6260 } 6261 isFirstUpdate = false; 6262 } 6263 try { 6264 io = new IntersectionObserver(handleObserve, { 6265 ...options, 6266 // Handle <iframe>s 6267 root: root.ownerDocument 6268 }); 6269 } catch (_e) { 6270 io = new IntersectionObserver(handleObserve, options); 6271 } 6272 io.observe(element); 6273 } 6274 refresh(true); 6275 return cleanup; 6276 } 6277 function autoUpdate(reference, floating, update4, options) { 6278 if (options === void 0) { 6279 options = {}; 6280 } 6281 const { 6282 ancestorScroll = true, 6283 ancestorResize = true, 6284 elementResize = typeof ResizeObserver === "function", 6285 layoutShift = typeof IntersectionObserver === "function", 6286 animationFrame = false 6287 } = options; 6288 const referenceEl = unwrapElement(reference); 6289 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 6290 ancestors.forEach((ancestor) => { 6291 ancestorScroll && ancestor.addEventListener("scroll", update4, { 6292 passive: true 6293 }); 6294 ancestorResize && ancestor.addEventListener("resize", update4); 6295 }); 6296 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update4) : null; 6297 let reobserveFrame = -1; 6298 let resizeObserver = null; 6299 if (elementResize) { 6300 resizeObserver = new ResizeObserver((_ref) => { 6301 let [firstEntry] = _ref; 6302 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 6303 resizeObserver.unobserve(floating); 6304 cancelAnimationFrame(reobserveFrame); 6305 reobserveFrame = requestAnimationFrame(() => { 6306 var _resizeObserver; 6307 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 6308 }); 6309 } 6310 update4(); 6311 }); 6312 if (referenceEl && !animationFrame) { 6313 resizeObserver.observe(referenceEl); 6314 } 6315 if (floating) { 6316 resizeObserver.observe(floating); 6317 } 6318 } 6319 let frameId; 6320 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 6321 if (animationFrame) { 6322 frameLoop2(); 6323 } 6324 function frameLoop2() { 6325 const nextRefRect = getBoundingClientRect(reference); 6326 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 6327 update4(); 6328 } 6329 prevRefRect = nextRefRect; 6330 frameId = requestAnimationFrame(frameLoop2); 6331 } 6332 update4(); 6333 return () => { 6334 var _resizeObserver2; 6335 ancestors.forEach((ancestor) => { 6336 ancestorScroll && ancestor.removeEventListener("scroll", update4); 6337 ancestorResize && ancestor.removeEventListener("resize", update4); 6338 }); 6339 cleanupIo == null || cleanupIo(); 6340 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 6341 resizeObserver = null; 6342 if (animationFrame) { 6343 cancelAnimationFrame(frameId); 6344 } 6345 }; 6346 } 6347 var offset2 = offset; 6348 var shift2 = shift; 6349 var flip2 = flip; 6350 var size2 = size; 6351 var hide2 = hide; 6352 var limitShift2 = limitShift; 6353 var computePosition2 = (reference, floating, options) => { 6354 const cache = /* @__PURE__ */ new Map(); 6355 const mergedOptions = { 6356 platform: platform2, 6357 ...options 6358 }; 6359 const platformWithCache = { 6360 ...mergedOptions.platform, 6361 _c: cache 6362 }; 6363 return computePosition(reference, floating, { 6364 ...mergedOptions, 6365 platform: platformWithCache 6366 }); 6367 }; 6368 6369 // node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 6370 var React26 = __toESM(require_react(), 1); 6371 var import_react2 = __toESM(require_react(), 1); 6372 var ReactDOM3 = __toESM(require_react_dom(), 1); 6373 var isClient = typeof document !== "undefined"; 6374 var noop2 = function noop3() { 6375 }; 6376 var index = isClient ? import_react2.useLayoutEffect : noop2; 6377 function deepEqual(a2, b2) { 6378 if (a2 === b2) { 6379 return true; 6380 } 6381 if (typeof a2 !== typeof b2) { 6382 return false; 6383 } 6384 if (typeof a2 === "function" && a2.toString() === b2.toString()) { 6385 return true; 6386 } 6387 let length; 6388 let i2; 6389 let keys; 6390 if (a2 && b2 && typeof a2 === "object") { 6391 if (Array.isArray(a2)) { 6392 length = a2.length; 6393 if (length !== b2.length) return false; 6394 for (i2 = length; i2-- !== 0; ) { 6395 if (!deepEqual(a2[i2], b2[i2])) { 6396 return false; 6397 } 6398 } 6399 return true; 6400 } 6401 keys = Object.keys(a2); 6402 length = keys.length; 6403 if (length !== Object.keys(b2).length) { 6404 return false; 6405 } 6406 for (i2 = length; i2-- !== 0; ) { 6407 if (!{}.hasOwnProperty.call(b2, keys[i2])) { 6408 return false; 6409 } 6410 } 6411 for (i2 = length; i2-- !== 0; ) { 6412 const key = keys[i2]; 6413 if (key === "_owner" && a2.$$typeof) { 6414 continue; 6415 } 6416 if (!deepEqual(a2[key], b2[key])) { 6417 return false; 6418 } 6419 } 6420 return true; 6421 } 6422 return a2 !== a2 && b2 !== b2; 6423 } 6424 function getDPR(element) { 6425 if (typeof window === "undefined") { 6426 return 1; 6427 } 6428 const win = element.ownerDocument.defaultView || window; 6429 return win.devicePixelRatio || 1; 6430 } 6431 function roundByDPR(element, value) { 6432 const dpr = getDPR(element); 6433 return Math.round(value * dpr) / dpr; 6434 } 6435 function useLatestRef(value) { 6436 const ref = React26.useRef(value); 6437 index(() => { 6438 ref.current = value; 6439 }); 6440 return ref; 6441 } 6442 function useFloating(options) { 6443 if (options === void 0) { 6444 options = {}; 6445 } 6446 const { 6447 placement = "bottom", 6448 strategy = "absolute", 6449 middleware = [], 6450 platform: platform3, 6451 elements: { 6452 reference: externalReference, 6453 floating: externalFloating 6454 } = {}, 6455 transform = true, 6456 whileElementsMounted, 6457 open 6458 } = options; 6459 const [data, setData] = React26.useState({ 6460 x: 0, 6461 y: 0, 6462 strategy, 6463 placement, 6464 middlewareData: {}, 6465 isPositioned: false 6466 }); 6467 const [latestMiddleware, setLatestMiddleware] = React26.useState(middleware); 6468 if (!deepEqual(latestMiddleware, middleware)) { 6469 setLatestMiddleware(middleware); 6470 } 6471 const [_reference, _setReference] = React26.useState(null); 6472 const [_floating, _setFloating] = React26.useState(null); 6473 const setReference = React26.useCallback((node) => { 6474 if (node !== referenceRef.current) { 6475 referenceRef.current = node; 6476 _setReference(node); 6477 } 6478 }, []); 6479 const setFloating = React26.useCallback((node) => { 6480 if (node !== floatingRef.current) { 6481 floatingRef.current = node; 6482 _setFloating(node); 6483 } 6484 }, []); 6485 const referenceEl = externalReference || _reference; 6486 const floatingEl = externalFloating || _floating; 6487 const referenceRef = React26.useRef(null); 6488 const floatingRef = React26.useRef(null); 6489 const dataRef = React26.useRef(data); 6490 const hasWhileElementsMounted = whileElementsMounted != null; 6491 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 6492 const platformRef = useLatestRef(platform3); 6493 const openRef = useLatestRef(open); 6494 const update4 = React26.useCallback(() => { 6495 if (!referenceRef.current || !floatingRef.current) { 6496 return; 6497 } 6498 const config2 = { 6499 placement, 6500 strategy, 6501 middleware: latestMiddleware 6502 }; 6503 if (platformRef.current) { 6504 config2.platform = platformRef.current; 6505 } 6506 computePosition2(referenceRef.current, floatingRef.current, config2).then((data2) => { 6507 const fullData = { 6508 ...data2, 6509 // The floating element's position may be recomputed while it's closed 6510 // but still mounted (such as when transitioning out). To ensure 6511 // `isPositioned` will be `false` initially on the next open, avoid 6512 // setting it to `true` when `open === false` (must be specified). 6513 isPositioned: openRef.current !== false 6514 }; 6515 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 6516 dataRef.current = fullData; 6517 ReactDOM3.flushSync(() => { 6518 setData(fullData); 6519 }); 6520 } 6521 }); 6522 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 6523 index(() => { 6524 if (open === false && dataRef.current.isPositioned) { 6525 dataRef.current.isPositioned = false; 6526 setData((data2) => ({ 6527 ...data2, 6528 isPositioned: false 6529 })); 6530 } 6531 }, [open]); 6532 const isMountedRef = React26.useRef(false); 6533 index(() => { 6534 isMountedRef.current = true; 6535 return () => { 6536 isMountedRef.current = false; 6537 }; 6538 }, []); 6539 index(() => { 6540 if (referenceEl) referenceRef.current = referenceEl; 6541 if (floatingEl) floatingRef.current = floatingEl; 6542 if (referenceEl && floatingEl) { 6543 if (whileElementsMountedRef.current) { 6544 return whileElementsMountedRef.current(referenceEl, floatingEl, update4); 6545 } 6546 update4(); 6547 } 6548 }, [referenceEl, floatingEl, update4, whileElementsMountedRef, hasWhileElementsMounted]); 6549 const refs = React26.useMemo(() => ({ 6550 reference: referenceRef, 6551 floating: floatingRef, 6552 setReference, 6553 setFloating 6554 }), [setReference, setFloating]); 6555 const elements2 = React26.useMemo(() => ({ 6556 reference: referenceEl, 6557 floating: floatingEl 6558 }), [referenceEl, floatingEl]); 6559 const floatingStyles = React26.useMemo(() => { 6560 const initialStyles = { 6561 position: strategy, 6562 left: 0, 6563 top: 0 6564 }; 6565 if (!elements2.floating) { 6566 return initialStyles; 6567 } 6568 const x2 = roundByDPR(elements2.floating, data.x); 6569 const y2 = roundByDPR(elements2.floating, data.y); 6570 if (transform) { 6571 return { 6572 ...initialStyles, 6573 transform: "translate(" + x2 + "px, " + y2 + "px)", 6574 ...getDPR(elements2.floating) >= 1.5 && { 6575 willChange: "transform" 6576 } 6577 }; 6578 } 6579 return { 6580 position: strategy, 6581 left: x2, 6582 top: y2 6583 }; 6584 }, [strategy, transform, elements2.floating, data.x, data.y]); 6585 return React26.useMemo(() => ({ 6586 ...data, 6587 update: update4, 6588 refs, 6589 elements: elements2, 6590 floatingStyles 6591 }), [data, update4, refs, elements2, floatingStyles]); 6592 } 6593 var offset3 = (options, deps) => { 6594 const result = offset2(options); 6595 return { 6596 name: result.name, 6597 fn: result.fn, 6598 options: [options, deps] 6599 }; 6600 }; 6601 var shift3 = (options, deps) => { 6602 const result = shift2(options); 6603 return { 6604 name: result.name, 6605 fn: result.fn, 6606 options: [options, deps] 6607 }; 6608 }; 6609 var limitShift3 = (options, deps) => { 6610 const result = limitShift2(options); 6611 return { 6612 fn: result.fn, 6613 options: [options, deps] 6614 }; 6615 }; 6616 var flip3 = (options, deps) => { 6617 const result = flip2(options); 6618 return { 6619 name: result.name, 6620 fn: result.fn, 6621 options: [options, deps] 6622 }; 6623 }; 6624 var size3 = (options, deps) => { 6625 const result = size2(options); 6626 return { 6627 name: result.name, 6628 fn: result.fn, 6629 options: [options, deps] 6630 }; 6631 }; 6632 var hide3 = (options, deps) => { 6633 const result = hide2(options); 6634 return { 6635 name: result.name, 6636 fn: result.fn, 6637 options: [options, deps] 6638 }; 6639 }; 6640 6641 // node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js 6642 var React31 = __toESM(require_react(), 1); 6643 6644 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js 6645 var React30 = __toESM(require_react(), 1); 6646 6647 // node_modules/@base-ui/utils/esm/store/createSelector.js 6648 var createSelector2 = (a2, b2, c6, d2, e2, f2, ...other) => { 6649 if (other.length > 0) { 6650 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); 6651 } 6652 let selector2; 6653 if (a2 && b2 && c6 && d2 && e2 && f2) { 6654 selector2 = (state, a1, a22, a3) => { 6655 const va = a2(state, a1, a22, a3); 6656 const vb = b2(state, a1, a22, a3); 6657 const vc = c6(state, a1, a22, a3); 6658 const vd = d2(state, a1, a22, a3); 6659 const ve = e2(state, a1, a22, a3); 6660 return f2(va, vb, vc, vd, ve, a1, a22, a3); 6661 }; 6662 } else if (a2 && b2 && c6 && d2 && e2) { 6663 selector2 = (state, a1, a22, a3) => { 6664 const va = a2(state, a1, a22, a3); 6665 const vb = b2(state, a1, a22, a3); 6666 const vc = c6(state, a1, a22, a3); 6667 const vd = d2(state, a1, a22, a3); 6668 return e2(va, vb, vc, vd, a1, a22, a3); 6669 }; 6670 } else if (a2 && b2 && c6 && d2) { 6671 selector2 = (state, a1, a22, a3) => { 6672 const va = a2(state, a1, a22, a3); 6673 const vb = b2(state, a1, a22, a3); 6674 const vc = c6(state, a1, a22, a3); 6675 return d2(va, vb, vc, a1, a22, a3); 6676 }; 6677 } else if (a2 && b2 && c6) { 6678 selector2 = (state, a1, a22, a3) => { 6679 const va = a2(state, a1, a22, a3); 6680 const vb = b2(state, a1, a22, a3); 6681 return c6(va, vb, a1, a22, a3); 6682 }; 6683 } else if (a2 && b2) { 6684 selector2 = (state, a1, a22, a3) => { 6685 const va = a2(state, a1, a22, a3); 6686 return b2(va, a1, a22, a3); 6687 }; 6688 } else if (a2) { 6689 selector2 = a2; 6690 } else { 6691 throw ( 6692 /* minify-error-disabled */ 6693 new Error("Missing arguments") 6694 ); 6695 } 6696 return selector2; 6697 }; 6698 6699 // node_modules/@base-ui/utils/esm/store/useStore.js 6700 var React28 = __toESM(require_react(), 1); 6701 var import_shim = __toESM(require_shim(), 1); 6702 var import_with_selector = __toESM(require_with_selector(), 1); 6703 6704 // node_modules/@base-ui/utils/esm/fastHooks.js 6705 var React27 = __toESM(require_react(), 1); 6706 var hooks = []; 6707 var currentInstance = void 0; 6708 function getInstance() { 6709 return currentInstance; 6710 } 6711 function register2(hook) { 6712 hooks.push(hook); 6713 } 6714 function fastComponent(fn) { 6715 const FastComponent = (props, forwardedRef) => { 6716 const instance = useRefWithInit(createInstance).current; 6717 let result; 6718 try { 6719 currentInstance = instance; 6720 for (const hook of hooks) { 6721 hook.before(instance); 6722 } 6723 result = fn(props, forwardedRef); 6724 for (const hook of hooks) { 6725 hook.after(instance); 6726 } 6727 instance.didInitialize = true; 6728 } finally { 6729 currentInstance = void 0; 6730 } 6731 return result; 6732 }; 6733 FastComponent.displayName = fn.displayName || fn.name; 6734 return FastComponent; 6735 } 6736 function fastComponentRef(fn) { 6737 return /* @__PURE__ */ React27.forwardRef(fastComponent(fn)); 6738 } 6739 function createInstance() { 6740 return { 6741 didInitialize: false 6742 }; 6743 } 6744 6745 // node_modules/@base-ui/utils/esm/store/useStore.js 6746 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 6747 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 6748 function useStore(store2, selector2, a1, a2, a3) { 6749 return useStoreImplementation(store2, selector2, a1, a2, a3); 6750 } 6751 function useStoreR19(store2, selector2, a1, a2, a3) { 6752 const getSelection = React28.useCallback(() => selector2(store2.getSnapshot(), a1, a2, a3), [store2, selector2, a1, a2, a3]); 6753 return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection); 6754 } 6755 register2({ 6756 before(instance) { 6757 instance.syncIndex = 0; 6758 if (!instance.didInitialize) { 6759 instance.syncTick = 1; 6760 instance.syncHooks = []; 6761 instance.didChangeStore = true; 6762 instance.getSnapshot = () => { 6763 let didChange2 = false; 6764 for (let i2 = 0; i2 < instance.syncHooks.length; i2 += 1) { 6765 const hook = instance.syncHooks[i2]; 6766 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 6767 if (hook.didChange || !Object.is(hook.value, value)) { 6768 didChange2 = true; 6769 hook.value = value; 6770 hook.didChange = false; 6771 } 6772 } 6773 if (didChange2) { 6774 instance.syncTick += 1; 6775 } 6776 return instance.syncTick; 6777 }; 6778 } 6779 }, 6780 after(instance) { 6781 if (instance.syncHooks.length > 0) { 6782 if (instance.didChangeStore) { 6783 instance.didChangeStore = false; 6784 instance.subscribe = (onStoreChange) => { 6785 const stores = /* @__PURE__ */ new Set(); 6786 for (const hook of instance.syncHooks) { 6787 stores.add(hook.store); 6788 } 6789 const unsubscribes = []; 6790 for (const store2 of stores) { 6791 unsubscribes.push(store2.subscribe(onStoreChange)); 6792 } 6793 return () => { 6794 for (const unsubscribe of unsubscribes) { 6795 unsubscribe(); 6796 } 6797 }; 6798 }; 6799 } 6800 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 6801 } 6802 } 6803 }); 6804 function useStoreFast(store2, selector2, a1, a2, a3) { 6805 const instance = getInstance(); 6806 if (!instance) { 6807 return useStoreR19(store2, selector2, a1, a2, a3); 6808 } 6809 const index2 = instance.syncIndex; 6810 instance.syncIndex += 1; 6811 let hook; 6812 if (!instance.didInitialize) { 6813 hook = { 6814 store: store2, 6815 selector: selector2, 6816 a1, 6817 a2, 6818 a3, 6819 value: selector2(store2.getSnapshot(), a1, a2, a3), 6820 didChange: false 6821 }; 6822 instance.syncHooks.push(hook); 6823 } else { 6824 hook = instance.syncHooks[index2]; 6825 if (hook.store !== store2 || hook.selector !== selector2 || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 6826 if (hook.store !== store2) { 6827 instance.didChangeStore = true; 6828 } 6829 hook.store = store2; 6830 hook.selector = selector2; 6831 hook.a1 = a1; 6832 hook.a2 = a2; 6833 hook.a3 = a3; 6834 hook.didChange = true; 6835 } 6836 } 6837 return hook.value; 6838 } 6839 function useStoreLegacy(store2, selector2, a1, a2, a3) { 6840 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector2(state, a1, a2, a3)); 6841 } 6842 6843 // node_modules/@base-ui/utils/esm/store/Store.js 6844 var Store = class { 6845 /** 6846 * The current state of the store. 6847 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 6848 * 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). 6849 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 6850 * 6851 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 6852 */ 6853 // Internal state to handle recursive `setState()` calls 6854 constructor(state) { 6855 this.state = state; 6856 this.listeners = /* @__PURE__ */ new Set(); 6857 this.updateTick = 0; 6858 } 6859 /** 6860 * Registers a listener that will be called whenever the store's state changes. 6861 * 6862 * @param fn The listener function to be called on state changes. 6863 * @returns A function to unsubscribe the listener. 6864 */ 6865 subscribe = (fn) => { 6866 this.listeners.add(fn); 6867 return () => { 6868 this.listeners.delete(fn); 6869 }; 6870 }; 6871 /** 6872 * Returns the current state of the store. 6873 */ 6874 getSnapshot = () => { 6875 return this.state; 6876 }; 6877 /** 6878 * Updates the entire store's state and notifies all registered listeners. 6879 * 6880 * @param newState The new state to set for the store. 6881 */ 6882 setState(newState) { 6883 if (this.state === newState) { 6884 return; 6885 } 6886 this.state = newState; 6887 this.updateTick += 1; 6888 const currentTick = this.updateTick; 6889 for (const listener of this.listeners) { 6890 if (currentTick !== this.updateTick) { 6891 return; 6892 } 6893 listener(newState); 6894 } 6895 } 6896 /** 6897 * Merges the provided changes into the current state and notifies listeners if there are changes. 6898 * 6899 * @param changes An object containing the changes to apply to the current state. 6900 */ 6901 update(changes) { 6902 for (const key in changes) { 6903 if (!Object.is(this.state[key], changes[key])) { 6904 this.setState({ 6905 ...this.state, 6906 ...changes 6907 }); 6908 return; 6909 } 6910 } 6911 } 6912 /** 6913 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 6914 * 6915 * @param key The key in the store's state to update. 6916 * @param value The new value to set for the specified key. 6917 */ 6918 set(key, value) { 6919 if (!Object.is(this.state[key], value)) { 6920 this.setState({ 6921 ...this.state, 6922 [key]: value 6923 }); 6924 } 6925 } 6926 /** 6927 * Gives the state a new reference and updates all registered listeners. 6928 */ 6929 notifyAll() { 6930 const newState = { 6931 ...this.state 6932 }; 6933 this.setState(newState); 6934 } 6935 use(selector2, a1, a2, a3) { 6936 return useStore(this, selector2, a1, a2, a3); 6937 } 6938 }; 6939 6940 // node_modules/@base-ui/utils/esm/store/ReactStore.js 6941 var React29 = __toESM(require_react(), 1); 6942 var ReactStore = class extends Store { 6943 /** 6944 * Creates a new ReactStore instance. 6945 * 6946 * @param state Initial state of the store. 6947 * @param context Non-reactive context values. 6948 * @param selectors Optional selectors for use with `useState`. 6949 */ 6950 constructor(state, context = {}, selectors3) { 6951 super(state); 6952 this.context = context; 6953 this.selectors = selectors3; 6954 } 6955 /** 6956 * Non-reactive values such as refs, callbacks, etc. 6957 */ 6958 /** 6959 * Synchronizes a single external value into the store. 6960 * 6961 * Note that the while the value in `state` is updated immediately, the value returned 6962 * by `useState` is updated before the next render (similarly to React's `useState`). 6963 */ 6964 useSyncedValue(key, value) { 6965 React29.useDebugValue(key); 6966 const store2 = this; 6967 useIsoLayoutEffect(() => { 6968 if (store2.state[key] !== value) { 6969 store2.set(key, value); 6970 } 6971 }, [store2, key, value]); 6972 } 6973 /** 6974 * Synchronizes a single external value into the store and 6975 * cleans it up (sets to `undefined`) on unmount. 6976 * 6977 * Note that the while the value in `state` is updated immediately, the value returned 6978 * by `useState` is updated before the next render (similarly to React's `useState`). 6979 */ 6980 useSyncedValueWithCleanup(key, value) { 6981 const store2 = this; 6982 useIsoLayoutEffect(() => { 6983 if (store2.state[key] !== value) { 6984 store2.set(key, value); 6985 } 6986 return () => { 6987 store2.set(key, void 0); 6988 }; 6989 }, [store2, key, value]); 6990 } 6991 /** 6992 * Synchronizes multiple external values into the store. 6993 * 6994 * Note that the while the values in `state` are updated immediately, the values returned 6995 * by `useState` are updated before the next render (similarly to React's `useState`). 6996 */ 6997 useSyncedValues(statePart) { 6998 const store2 = this; 6999 if (true) { 7000 React29.useDebugValue(statePart, (p3) => Object.keys(p3)); 7001 const keys = React29.useRef(Object.keys(statePart)).current; 7002 const nextKeys = Object.keys(statePart); 7003 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 7004 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 7005 } 7006 } 7007 const dependencies = Object.values(statePart); 7008 useIsoLayoutEffect(() => { 7009 store2.update(statePart); 7010 }, [store2, ...dependencies]); 7011 } 7012 /** 7013 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 7014 * is non-undefined, the store's state at `key` is updated to match `controlled`. 7015 */ 7016 useControlledProp(key, controlled) { 7017 React29.useDebugValue(key); 7018 const store2 = this; 7019 const isControlled = controlled !== void 0; 7020 useIsoLayoutEffect(() => { 7021 if (isControlled && !Object.is(store2.state[key], controlled)) { 7022 store2.setState({ 7023 ...store2.state, 7024 [key]: controlled 7025 }); 7026 } 7027 }, [store2, key, controlled, isControlled]); 7028 if (true) { 7029 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 7030 if (!cache.has(key)) { 7031 cache.set(key, isControlled); 7032 } 7033 const previouslyControlled = cache.get(key); 7034 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 7035 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).`); 7036 } 7037 } 7038 } 7039 /** Gets the current value from the store using a selector with the provided key. 7040 * 7041 * @param key Key of the selector to use. 7042 */ 7043 select(key, a1, a2, a3) { 7044 const selector2 = this.selectors[key]; 7045 return selector2(this.state, a1, a2, a3); 7046 } 7047 /** 7048 * Returns a value from the store's state using a selector function. 7049 * Used to subscribe to specific parts of the state. 7050 * This methods causes a rerender whenever the selected state changes. 7051 * 7052 * @param key Key of the selector to use. 7053 */ 7054 useState(key, a1, a2, a3) { 7055 React29.useDebugValue(key); 7056 return useStore(this, this.selectors[key], a1, a2, a3); 7057 } 7058 /** 7059 * Wraps a function with `useStableCallback` to ensure it has a stable reference 7060 * and assigns it to the context. 7061 * 7062 * @param key Key of the event callback. Must be a function in the context. 7063 * @param fn Function to assign. 7064 */ 7065 useContextCallback(key, fn) { 7066 React29.useDebugValue(key); 7067 const stableFunction = useStableCallback(fn ?? NOOP); 7068 this.context[key] = stableFunction; 7069 } 7070 /** 7071 * Returns a stable setter function for a specific key in the store's state. 7072 * It's commonly used to pass as a ref callback to React elements. 7073 * 7074 * @param key Key of the state to set. 7075 */ 7076 useStateSetter(key) { 7077 const ref = React29.useRef(void 0); 7078 if (ref.current === void 0) { 7079 ref.current = (value) => { 7080 this.set(key, value); 7081 }; 7082 } 7083 return ref.current; 7084 } 7085 /** 7086 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 7087 * 7088 * @param key Key of the selector to observe. 7089 * @param listener Listener function called when the selector result changes. 7090 */ 7091 observe(selector2, listener) { 7092 let selectFn; 7093 if (typeof selector2 === "function") { 7094 selectFn = selector2; 7095 } else { 7096 selectFn = this.selectors[selector2]; 7097 } 7098 let prevValue = selectFn(this.state); 7099 listener(prevValue, prevValue, this); 7100 return this.subscribe((nextState) => { 7101 const nextValue = selectFn(nextState); 7102 if (!Object.is(prevValue, nextValue)) { 7103 const oldValue = prevValue; 7104 prevValue = nextValue; 7105 listener(nextValue, oldValue, this); 7106 } 7107 }); 7108 } 7109 }; 7110 7111 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingRootStore.js 7112 var selectors = { 7113 open: createSelector2((state) => state.open), 7114 transitionStatus: createSelector2((state) => state.transitionStatus), 7115 domReferenceElement: createSelector2((state) => state.domReferenceElement), 7116 referenceElement: createSelector2((state) => state.positionReference ?? state.referenceElement), 7117 floatingElement: createSelector2((state) => state.floatingElement), 7118 floatingId: createSelector2((state) => state.floatingId) 7119 }; 7120 var FloatingRootStore = class extends ReactStore { 7121 constructor(options) { 7122 const { 7123 syncOnly, 7124 nested, 7125 onOpenChange, 7126 triggerElements, 7127 ...initialState 7128 } = options; 7129 super({ 7130 ...initialState, 7131 positionReference: initialState.referenceElement, 7132 domReferenceElement: initialState.referenceElement 7133 }, { 7134 onOpenChange, 7135 dataRef: { 7136 current: {} 7137 }, 7138 events: createEventEmitter(), 7139 nested, 7140 triggerElements 7141 }, selectors); 7142 this.syncOnly = syncOnly; 7143 } 7144 /** 7145 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 7146 */ 7147 syncOpenEvent = (newOpen, event) => { 7148 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 7149 // click events to upgrade a hover-open. 7150 event != null && isClickLikeEvent(event)) { 7151 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 7152 } 7153 }; 7154 /** 7155 * Runs the root-owned side effects for an open state change. 7156 */ 7157 dispatchOpenChange = (newOpen, eventDetails) => { 7158 this.syncOpenEvent(newOpen, eventDetails.event); 7159 const details = { 7160 open: newOpen, 7161 reason: eventDetails.reason, 7162 nativeEvent: eventDetails.event, 7163 nested: this.context.nested, 7164 triggerElement: eventDetails.trigger 7165 }; 7166 this.context.events.emit("openchange", details); 7167 }; 7168 /** 7169 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 7170 * 7171 * @param newOpen The new open state. 7172 * @param eventDetails Details about the event that triggered the open state change. 7173 */ 7174 setOpen = (newOpen, eventDetails) => { 7175 if (this.syncOnly) { 7176 this.context.onOpenChange?.(newOpen, eventDetails); 7177 return; 7178 } 7179 this.dispatchOpenChange(newOpen, eventDetails); 7180 this.context.onOpenChange?.(newOpen, eventDetails); 7181 }; 7182 }; 7183 7184 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js 7185 function useSyncedFloatingRootContext(options) { 7186 const { 7187 popupStore, 7188 treatPopupAsFloatingElement = false, 7189 floatingRootContext: floatingRootContextProp, 7190 floatingId, 7191 nested, 7192 onOpenChange 7193 } = options; 7194 const open = popupStore.useState("open"); 7195 const referenceElement = popupStore.useState("activeTriggerElement"); 7196 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 7197 const triggerElements = popupStore.context.triggerElements; 7198 const handleOpenChange = onOpenChange; 7199 const internalStoreRef = React30.useRef(null); 7200 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { 7201 internalStoreRef.current = new FloatingRootStore({ 7202 open, 7203 transitionStatus: void 0, 7204 referenceElement, 7205 floatingElement, 7206 triggerElements, 7207 onOpenChange: handleOpenChange, 7208 floatingId, 7209 syncOnly: true, 7210 nested 7211 }); 7212 } 7213 const store2 = floatingRootContextProp ?? internalStoreRef.current; 7214 popupStore.useSyncedValue("floatingId", floatingId); 7215 useIsoLayoutEffect(() => { 7216 const valuesToSync = { 7217 open, 7218 floatingId, 7219 referenceElement, 7220 floatingElement 7221 }; 7222 if (isElement(referenceElement)) { 7223 valuesToSync.domReferenceElement = referenceElement; 7224 } 7225 if (store2.state.positionReference === store2.state.referenceElement) { 7226 valuesToSync.positionReference = referenceElement; 7227 } 7228 store2.update(valuesToSync); 7229 }, [open, floatingId, referenceElement, floatingElement, store2]); 7230 store2.context.onOpenChange = handleOpenChange; 7231 store2.context.nested = nested; 7232 return store2; 7233 } 7234 7235 // node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js 7236 var FOCUSABLE_POPUP_PROPS = { 7237 tabIndex: -1, 7238 [FOCUSABLE_ATTRIBUTE]: "" 7239 }; 7240 function usePopupStore(externalStore, createStore2, treatPopupAsFloatingElement = false) { 7241 const floatingId = useId(); 7242 const nested = useFloatingParentNodeId() != null; 7243 const internalStoreRef = React31.useRef(null); 7244 if (externalStore === void 0 && internalStoreRef.current === null) { 7245 internalStoreRef.current = createStore2(floatingId, nested); 7246 } 7247 const store2 = externalStore ?? internalStoreRef.current; 7248 useSyncedFloatingRootContext({ 7249 popupStore: store2, 7250 treatPopupAsFloatingElement, 7251 floatingRootContext: store2.state.floatingRootContext, 7252 floatingId, 7253 nested, 7254 onOpenChange: store2.setOpen 7255 }); 7256 return { 7257 store: store2, 7258 internalStore: internalStoreRef.current 7259 }; 7260 } 7261 function useTriggerRegistration(id, store2) { 7262 const registeredElementIdRef = React31.useRef(null); 7263 const registeredElementRef = React31.useRef(null); 7264 return React31.useCallback((element) => { 7265 if (id === void 0) { 7266 return; 7267 } 7268 let shouldSyncTriggerCount = false; 7269 if (registeredElementIdRef.current !== null) { 7270 const registeredId = registeredElementIdRef.current; 7271 const registeredElement = registeredElementRef.current; 7272 const currentElement = store2.context.triggerElements.getById(registeredId); 7273 if (registeredElement && currentElement === registeredElement) { 7274 store2.context.triggerElements.delete(registeredId); 7275 shouldSyncTriggerCount = true; 7276 } 7277 registeredElementIdRef.current = null; 7278 registeredElementRef.current = null; 7279 } 7280 if (element !== null) { 7281 registeredElementIdRef.current = id; 7282 registeredElementRef.current = element; 7283 store2.context.triggerElements.add(id, element); 7284 shouldSyncTriggerCount = true; 7285 } 7286 if (shouldSyncTriggerCount) { 7287 const triggerCount = store2.context.triggerElements.size; 7288 if (store2.select("open") && store2.state.triggerCount !== triggerCount) { 7289 store2.set("triggerCount", triggerCount); 7290 } 7291 } 7292 }, [store2, id]); 7293 } 7294 function setOpenTriggerState(state, open, trigger) { 7295 const triggerId = trigger?.id ?? null; 7296 if (triggerId || open) { 7297 state.activeTriggerId = triggerId; 7298 state.activeTriggerElement = trigger ?? null; 7299 } 7300 } 7301 function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) { 7302 const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId); 7303 const baseRegisterTrigger = useTriggerRegistration(triggerId, store2); 7304 const registerTrigger = useStableCallback((element) => { 7305 baseRegisterTrigger(element); 7306 if (!element) { 7307 return; 7308 } 7309 const open = store2.select("open"); 7310 const activeTriggerId = store2.select("activeTriggerId"); 7311 if (activeTriggerId === triggerId) { 7312 store2.update({ 7313 activeTriggerElement: element, 7314 ...open ? stateUpdates : null 7315 }); 7316 return; 7317 } 7318 if (activeTriggerId == null && open) { 7319 store2.update({ 7320 activeTriggerId: triggerId, 7321 activeTriggerElement: element, 7322 ...stateUpdates 7323 }); 7324 } 7325 }); 7326 useIsoLayoutEffect(() => { 7327 if (isMountedByThisTrigger) { 7328 store2.update({ 7329 activeTriggerElement: triggerElementRef.current, 7330 ...stateUpdates 7331 }); 7332 } 7333 }, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]); 7334 return { 7335 registerTrigger, 7336 isMountedByThisTrigger 7337 }; 7338 } 7339 function useImplicitActiveTrigger(store2) { 7340 const open = store2.useState("open"); 7341 const reactiveTriggerCount = store2.useState("triggerCount"); 7342 useIsoLayoutEffect(() => { 7343 if (!open) { 7344 if (store2.state.triggerCount !== 0) { 7345 store2.set("triggerCount", 0); 7346 } 7347 return; 7348 } 7349 const triggerCount = store2.context.triggerElements.size; 7350 const stateUpdates = {}; 7351 if (store2.state.triggerCount !== triggerCount) { 7352 stateUpdates.triggerCount = triggerCount; 7353 } 7354 if (!store2.select("activeTriggerId") && triggerCount === 1) { 7355 const iteratorResult = store2.context.triggerElements.entries().next(); 7356 if (!iteratorResult.done) { 7357 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 7358 stateUpdates.activeTriggerId = implicitTriggerId; 7359 stateUpdates.activeTriggerElement = implicitTriggerElement; 7360 } 7361 } 7362 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0) { 7363 store2.update(stateUpdates); 7364 } 7365 }, [open, store2, reactiveTriggerCount]); 7366 } 7367 function useOpenStateTransitions(open, store2, onUnmount) { 7368 const { 7369 mounted, 7370 setMounted, 7371 transitionStatus 7372 } = useTransitionStatus(open); 7373 store2.useSyncedValues({ 7374 mounted, 7375 transitionStatus 7376 }); 7377 const forceUnmount = useStableCallback(() => { 7378 setMounted(false); 7379 store2.update({ 7380 activeTriggerId: null, 7381 activeTriggerElement: null, 7382 mounted: false, 7383 preventUnmountingOnClose: false 7384 }); 7385 onUnmount?.(); 7386 store2.context.onOpenChangeComplete?.(false); 7387 }); 7388 const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose"); 7389 useOpenChangeComplete({ 7390 enabled: mounted && !open && !preventUnmountingOnClose, 7391 open, 7392 ref: store2.context.popupRef, 7393 onComplete() { 7394 if (!open) { 7395 forceUnmount(); 7396 } 7397 } 7398 }); 7399 return { 7400 forceUnmount, 7401 transitionStatus 7402 }; 7403 } 7404 function usePopupInteractionProps(store2, statePart) { 7405 store2.useSyncedValues(statePart); 7406 useIsoLayoutEffect(() => () => { 7407 store2.update({ 7408 activeTriggerProps: EMPTY_OBJECT, 7409 inactiveTriggerProps: EMPTY_OBJECT, 7410 popupProps: EMPTY_OBJECT 7411 }); 7412 }, [store2]); 7413 } 7414 7415 // node_modules/@base-ui/react/esm/utils/popups/popupTriggerMap.js 7416 var PopupTriggerMap = class { 7417 constructor() { 7418 this.elementsSet = /* @__PURE__ */ new Set(); 7419 this.idMap = /* @__PURE__ */ new Map(); 7420 } 7421 /** 7422 * Adds a trigger element with the given ID. 7423 * 7424 * Note: The provided element is assumed to not be registered under multiple IDs. 7425 */ 7426 add(id, element) { 7427 const existingElement = this.idMap.get(id); 7428 if (existingElement === element) { 7429 return; 7430 } 7431 if (existingElement !== void 0) { 7432 this.elementsSet.delete(existingElement); 7433 } 7434 this.elementsSet.add(element); 7435 this.idMap.set(id, element); 7436 if (true) { 7437 if (this.elementsSet.size !== this.idMap.size) { 7438 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 7439 } 7440 } 7441 } 7442 /** 7443 * Removes the trigger element with the given ID. 7444 */ 7445 delete(id) { 7446 const element = this.idMap.get(id); 7447 if (element) { 7448 this.elementsSet.delete(element); 7449 this.idMap.delete(id); 7450 } 7451 } 7452 /** 7453 * Whether the given element is registered as a trigger. 7454 */ 7455 hasElement(element) { 7456 return this.elementsSet.has(element); 7457 } 7458 /** 7459 * Whether there is a registered trigger element matching the given predicate. 7460 */ 7461 hasMatchingElement(predicate) { 7462 for (const element of this.elementsSet) { 7463 if (predicate(element)) { 7464 return true; 7465 } 7466 } 7467 return false; 7468 } 7469 /** 7470 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 7471 */ 7472 getById(id) { 7473 return this.idMap.get(id); 7474 } 7475 /** 7476 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 7477 */ 7478 entries() { 7479 return this.idMap.entries(); 7480 } 7481 /** 7482 * Returns an iterable of all registered trigger elements. 7483 */ 7484 elements() { 7485 return this.elementsSet.values(); 7486 } 7487 /** 7488 * Returns the number of registered trigger elements. 7489 */ 7490 get size() { 7491 return this.idMap.size; 7492 } 7493 }; 7494 7495 // node_modules/@base-ui/react/esm/floating-ui-react/utils/getEmptyRootContext.js 7496 function getEmptyRootContext() { 7497 return new FloatingRootStore({ 7498 open: false, 7499 transitionStatus: void 0, 7500 floatingElement: null, 7501 referenceElement: null, 7502 triggerElements: new PopupTriggerMap(), 7503 floatingId: void 0, 7504 syncOnly: false, 7505 nested: false, 7506 onOpenChange: void 0 7507 }); 7508 } 7509 7510 // node_modules/@base-ui/react/esm/utils/popups/store.js 7511 function createInitialPopupStoreState() { 7512 return { 7513 open: false, 7514 openProp: void 0, 7515 mounted: false, 7516 transitionStatus: void 0, 7517 floatingRootContext: getEmptyRootContext(), 7518 floatingId: void 0, 7519 triggerCount: 0, 7520 preventUnmountingOnClose: false, 7521 payload: void 0, 7522 activeTriggerId: null, 7523 activeTriggerElement: null, 7524 triggerIdProp: void 0, 7525 popupElement: null, 7526 positionerElement: null, 7527 activeTriggerProps: EMPTY_OBJECT, 7528 inactiveTriggerProps: EMPTY_OBJECT, 7529 popupProps: EMPTY_OBJECT 7530 }; 7531 } 7532 function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) { 7533 return new FloatingRootStore({ 7534 open: false, 7535 transitionStatus: void 0, 7536 floatingElement: null, 7537 referenceElement: null, 7538 triggerElements, 7539 floatingId, 7540 syncOnly: true, 7541 nested, 7542 onOpenChange: void 0 7543 }); 7544 } 7545 var activeTriggerIdSelector = createSelector2((state) => state.triggerIdProp ?? state.activeTriggerId); 7546 var openSelector = createSelector2((state) => state.openProp ?? state.open); 7547 var popupIdSelector = createSelector2((state) => { 7548 const popupId = state.popupElement?.id ?? state.floatingId; 7549 return popupId || void 0; 7550 }); 7551 function triggerOwnsOpenPopup(state, triggerId) { 7552 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; 7553 } 7554 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { 7555 if (triggerOwnsOpenPopup(state, triggerId)) { 7556 return true; 7557 } 7558 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; 7559 } 7560 var popupStoreSelectors = { 7561 open: openSelector, 7562 mounted: createSelector2((state) => state.mounted), 7563 transitionStatus: createSelector2((state) => state.transitionStatus), 7564 floatingRootContext: createSelector2((state) => state.floatingRootContext), 7565 triggerCount: createSelector2((state) => state.triggerCount), 7566 preventUnmountingOnClose: createSelector2((state) => state.preventUnmountingOnClose), 7567 payload: createSelector2((state) => state.payload), 7568 activeTriggerId: activeTriggerIdSelector, 7569 activeTriggerElement: createSelector2((state) => state.mounted ? state.activeTriggerElement : null), 7570 popupId: popupIdSelector, 7571 /** 7572 * Whether the trigger with the given ID was used to open the popup. 7573 */ 7574 isTriggerActive: createSelector2((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), 7575 /** 7576 * Whether the popup is open and was activated by a trigger with the given ID. 7577 */ 7578 isOpenedByTrigger: createSelector2((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)), 7579 /** 7580 * Whether the popup is mounted and was activated by a trigger with the given ID. 7581 */ 7582 isMountedByTrigger: createSelector2((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), 7583 triggerProps: createSelector2((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), 7584 /** 7585 * Popup id for the trigger that currently owns the open popup. 7586 */ 7587 triggerPopupId: createSelector2((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0), 7588 popupProps: createSelector2((state) => state.popupProps), 7589 popupElement: createSelector2((state) => state.popupElement), 7590 positionerElement: createSelector2((state) => state.positionerElement) 7591 }; 7592 7593 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js 7594 function useFloatingRootContext(options) { 7595 const { 7596 open = false, 7597 onOpenChange, 7598 elements: elements2 = {} 7599 } = options; 7600 const floatingId = useId(); 7601 const nested = useFloatingParentNodeId() != null; 7602 if (true) { 7603 const optionDomReference = elements2.reference; 7604 if (optionDomReference && !isElement(optionDomReference)) { 7605 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); 7606 } 7607 } 7608 const store2 = useRefWithInit(() => new FloatingRootStore({ 7609 open, 7610 transitionStatus: void 0, 7611 onOpenChange, 7612 referenceElement: elements2.reference ?? null, 7613 floatingElement: elements2.floating ?? null, 7614 triggerElements: new PopupTriggerMap(), 7615 floatingId, 7616 syncOnly: false, 7617 nested 7618 })).current; 7619 useIsoLayoutEffect(() => { 7620 const valuesToSync = { 7621 open, 7622 floatingId 7623 }; 7624 if (elements2.reference !== void 0) { 7625 valuesToSync.referenceElement = elements2.reference; 7626 valuesToSync.domReferenceElement = isElement(elements2.reference) ? elements2.reference : null; 7627 } 7628 if (elements2.floating !== void 0) { 7629 valuesToSync.floatingElement = elements2.floating; 7630 } 7631 store2.update(valuesToSync); 7632 }, [open, floatingId, elements2.reference, elements2.floating, store2]); 7633 store2.context.onOpenChange = onOpenChange; 7634 store2.context.nested = nested; 7635 return store2; 7636 } 7637 7638 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js 7639 function useFloating2(options = {}) { 7640 const { 7641 nodeId, 7642 externalTree 7643 } = options; 7644 const internalStore = useFloatingRootContext(options); 7645 const store2 = options.rootContext || internalStore; 7646 const referenceElement = store2.useState("referenceElement"); 7647 const floatingElement = store2.useState("floatingElement"); 7648 const domReferenceElement = store2.useState("domReferenceElement"); 7649 const open = store2.useState("open"); 7650 const floatingId = store2.useState("floatingId"); 7651 const [positionReference, setPositionReferenceRaw] = React32.useState(null); 7652 const [localDomReference, setLocalDomReference] = React32.useState(void 0); 7653 const [localFloatingElement, setLocalFloatingElement] = React32.useState(void 0); 7654 const domReferenceRef = React32.useRef(null); 7655 const tree = useFloatingTree(externalTree); 7656 const storeElements = React32.useMemo(() => ({ 7657 reference: referenceElement, 7658 floating: floatingElement, 7659 domReference: domReferenceElement 7660 }), [referenceElement, floatingElement, domReferenceElement]); 7661 const position = useFloating({ 7662 ...options, 7663 elements: { 7664 ...storeElements, 7665 ...positionReference && { 7666 reference: positionReference 7667 } 7668 } 7669 }); 7670 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 7671 const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement; 7672 store2.useSyncedValue("referenceElement", localDomReference ?? null); 7673 store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); 7674 store2.useSyncedValue("floatingElement", syncedFloatingElement); 7675 const setPositionReference = React32.useCallback((node) => { 7676 const computedPositionReference = isElement(node) ? { 7677 getBoundingClientRect: () => node.getBoundingClientRect(), 7678 getClientRects: () => node.getClientRects(), 7679 contextElement: node 7680 } : node; 7681 setPositionReferenceRaw(computedPositionReference); 7682 position.refs.setReference(computedPositionReference); 7683 }, [position.refs]); 7684 const setReference = React32.useCallback((node) => { 7685 if (isElement(node) || node === null) { 7686 domReferenceRef.current = node; 7687 setLocalDomReference(node); 7688 } 7689 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 7690 // `null` to support `positionReference` + an unstable `reference` 7691 // callback ref. 7692 node !== null && !isElement(node)) { 7693 position.refs.setReference(node); 7694 } 7695 }, [position.refs, setLocalDomReference]); 7696 const setFloating = React32.useCallback((node) => { 7697 setLocalFloatingElement(node); 7698 position.refs.setFloating(node); 7699 }, [position.refs]); 7700 const refs = React32.useMemo(() => ({ 7701 ...position.refs, 7702 setReference, 7703 setFloating, 7704 setPositionReference, 7705 domReference: domReferenceRef 7706 }), [position.refs, setReference, setFloating, setPositionReference]); 7707 const elements2 = React32.useMemo(() => ({ 7708 ...position.elements, 7709 domReference: domReferenceElement 7710 }), [position.elements, domReferenceElement]); 7711 const context = React32.useMemo(() => ({ 7712 ...position, 7713 dataRef: store2.context.dataRef, 7714 open, 7715 onOpenChange: store2.setOpen, 7716 events: store2.context.events, 7717 floatingId, 7718 refs, 7719 elements: elements2, 7720 nodeId, 7721 rootStore: store2 7722 }), [position, refs, elements2, nodeId, store2, open, floatingId]); 7723 useIsoLayoutEffect(() => { 7724 if (domReferenceElement) { 7725 domReferenceRef.current = domReferenceElement; 7726 } 7727 }, [domReferenceElement]); 7728 useIsoLayoutEffect(() => { 7729 store2.context.dataRef.current.floatingContext = context; 7730 const node = tree?.nodesRef.current.find((n2) => n2.id === nodeId); 7731 if (node) { 7732 node.context = context; 7733 } 7734 }); 7735 return React32.useMemo(() => ({ 7736 ...position, 7737 context, 7738 refs, 7739 elements: elements2, 7740 rootStore: store2 7741 }), [position, refs, elements2, context, store2]); 7742 } 7743 7744 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js 7745 var React33 = __toESM(require_react(), 1); 7746 var isMacSafari = isMac && isSafari; 7747 function useFocus(context, props = {}) { 7748 const { 7749 enabled = true, 7750 delay 7751 } = props; 7752 const store2 = "rootStore" in context ? context.rootStore : context; 7753 const { 7754 events, 7755 dataRef 7756 } = store2.context; 7757 const blockFocusRef = React33.useRef(false); 7758 const blockedReferenceRef = React33.useRef(null); 7759 const keyboardModalityRef = React33.useRef(true); 7760 const timeout = useTimeout(); 7761 React33.useEffect(() => { 7762 const domReference = store2.select("domReferenceElement"); 7763 if (!enabled) { 7764 return void 0; 7765 } 7766 const win = getWindow(domReference); 7767 function onBlur() { 7768 const currentDomReference = store2.select("domReferenceElement"); 7769 if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 7770 blockFocusRef.current = true; 7771 } 7772 } 7773 function onKeyDown() { 7774 keyboardModalityRef.current = true; 7775 } 7776 function onPointerDown() { 7777 keyboardModalityRef.current = false; 7778 } 7779 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 7780 }, [store2, enabled]); 7781 React33.useEffect(() => { 7782 if (!enabled) { 7783 return void 0; 7784 } 7785 function onOpenChangeLocal(details) { 7786 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 7787 const referenceElement = store2.select("domReferenceElement"); 7788 if (isElement(referenceElement)) { 7789 blockedReferenceRef.current = referenceElement; 7790 blockFocusRef.current = true; 7791 } 7792 } 7793 } 7794 events.on("openchange", onOpenChangeLocal); 7795 return () => { 7796 events.off("openchange", onOpenChangeLocal); 7797 }; 7798 }, [events, enabled, store2]); 7799 const reference = React33.useMemo(() => { 7800 function resetBlockedFocus() { 7801 blockFocusRef.current = false; 7802 blockedReferenceRef.current = null; 7803 } 7804 return { 7805 onMouseLeave() { 7806 resetBlockedFocus(); 7807 }, 7808 onFocus(event) { 7809 const focusTarget = event.currentTarget; 7810 if (blockFocusRef.current) { 7811 if (blockedReferenceRef.current === focusTarget) { 7812 return; 7813 } 7814 resetBlockedFocus(); 7815 } 7816 const target = getTarget(event.nativeEvent); 7817 if (isElement(target)) { 7818 if (isMacSafari && !event.relatedTarget) { 7819 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 7820 return; 7821 } 7822 } else if (!matchesFocusVisible(target)) { 7823 return; 7824 } 7825 } 7826 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements); 7827 const { 7828 nativeEvent, 7829 currentTarget 7830 } = event; 7831 const delayValue = typeof delay === "function" ? delay() : delay; 7832 if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 7833 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 7834 return; 7835 } 7836 timeout.start(delayValue, () => { 7837 if (blockFocusRef.current) { 7838 return; 7839 } 7840 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 7841 }); 7842 }, 7843 onBlur(event) { 7844 resetBlockedFocus(); 7845 const relatedTarget = event.relatedTarget; 7846 const nativeEvent = event.nativeEvent; 7847 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 7848 timeout.start(0, () => { 7849 const domReference = store2.select("domReferenceElement"); 7850 const activeEl = activeElement(ownerDocument(domReference)); 7851 if (!relatedTarget && activeEl === domReference) { 7852 return; 7853 } 7854 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 7855 return; 7856 } 7857 const nextFocusedElement = relatedTarget ?? activeEl; 7858 if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) { 7859 return; 7860 } 7861 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 7862 }); 7863 } 7864 }; 7865 }, [dataRef, delay, store2, timeout]); 7866 return React33.useMemo(() => enabled ? { 7867 reference, 7868 trigger: reference 7869 } : {}, [enabled, reference]); 7870 } 7871 7872 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js 7873 var React34 = __toESM(require_react(), 1); 7874 7875 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js 7876 var HoverInteraction = class _HoverInteraction { 7877 constructor() { 7878 this.pointerType = void 0; 7879 this.interactedInside = false; 7880 this.handler = void 0; 7881 this.blockMouseMove = true; 7882 this.performedPointerEventsMutation = false; 7883 this.pointerEventsScopeElement = null; 7884 this.pointerEventsReferenceElement = null; 7885 this.pointerEventsFloatingElement = null; 7886 this.restTimeoutPending = false; 7887 this.openChangeTimeout = new Timeout(); 7888 this.restTimeout = new Timeout(); 7889 this.handleCloseOptions = void 0; 7890 } 7891 static create() { 7892 return new _HoverInteraction(); 7893 } 7894 dispose = () => { 7895 this.openChangeTimeout.clear(); 7896 this.restTimeout.clear(); 7897 }; 7898 disposeEffect = () => { 7899 return this.dispose; 7900 }; 7901 }; 7902 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 7903 function clearSafePolygonPointerEventsMutation(instance) { 7904 if (!instance.performedPointerEventsMutation) { 7905 return; 7906 } 7907 const scopeElement = instance.pointerEventsScopeElement; 7908 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 7909 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 7910 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 7911 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 7912 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 7913 } 7914 instance.performedPointerEventsMutation = false; 7915 instance.pointerEventsScopeElement = null; 7916 instance.pointerEventsReferenceElement = null; 7917 instance.pointerEventsFloatingElement = null; 7918 } 7919 function applySafePolygonPointerEventsMutation(instance, options) { 7920 const { 7921 scopeElement, 7922 referenceElement, 7923 floatingElement 7924 } = options; 7925 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 7926 if (existingOwner && existingOwner !== instance) { 7927 clearSafePolygonPointerEventsMutation(existingOwner); 7928 } 7929 clearSafePolygonPointerEventsMutation(instance); 7930 instance.performedPointerEventsMutation = true; 7931 instance.pointerEventsScopeElement = scopeElement; 7932 instance.pointerEventsReferenceElement = referenceElement; 7933 instance.pointerEventsFloatingElement = floatingElement; 7934 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 7935 scopeElement.style.pointerEvents = "none"; 7936 referenceElement.style.pointerEvents = "auto"; 7937 floatingElement.style.pointerEvents = "auto"; 7938 } 7939 function useHoverInteractionSharedState(store2) { 7940 const data = store2.context.dataRef.current; 7941 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 7942 if (!data.hoverInteractionState) { 7943 data.hoverInteractionState = instance; 7944 } 7945 useOnMount(data.hoverInteractionState.disposeEffect); 7946 return data.hoverInteractionState; 7947 } 7948 7949 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js 7950 function useHoverFloatingInteraction(context, parameters = {}) { 7951 const { 7952 enabled = true, 7953 closeDelay: closeDelayProp = 0, 7954 nodeId: nodeIdProp 7955 } = parameters; 7956 const store2 = "rootStore" in context ? context.rootStore : context; 7957 const open = store2.useState("open"); 7958 const floatingElement = store2.useState("floatingElement"); 7959 const domReferenceElement = store2.useState("domReferenceElement"); 7960 const { 7961 dataRef 7962 } = store2.context; 7963 const tree = useFloatingTree(); 7964 const parentId = useFloatingParentNodeId(); 7965 const instance = useHoverInteractionSharedState(store2); 7966 const childClosedTimeout = useTimeout(); 7967 const isClickLikeOpenEvent2 = useStableCallback(() => { 7968 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 7969 }); 7970 const isHoverOpen = useStableCallback(() => { 7971 return isHoverOpenEvent(dataRef.current.openEvent?.type); 7972 }); 7973 const clearPointerEvents = useStableCallback(() => { 7974 clearSafePolygonPointerEventsMutation(instance); 7975 }); 7976 useIsoLayoutEffect(() => { 7977 if (!open) { 7978 instance.pointerType = void 0; 7979 instance.restTimeoutPending = false; 7980 instance.interactedInside = false; 7981 clearPointerEvents(); 7982 } 7983 }, [open, instance, clearPointerEvents]); 7984 React34.useEffect(() => { 7985 return clearPointerEvents; 7986 }, [clearPointerEvents]); 7987 useIsoLayoutEffect(() => { 7988 if (!enabled) { 7989 return void 0; 7990 } 7991 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 7992 const ref = domReferenceElement; 7993 const floatingEl = floatingElement; 7994 const doc = ownerDocument(floatingElement); 7995 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 7996 if (parentFloating) { 7997 parentFloating.style.pointerEvents = ""; 7998 } 7999 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 8000 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 8001 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; 8002 applySafePolygonPointerEventsMutation(instance, { 8003 scopeElement, 8004 referenceElement: ref, 8005 floatingElement: floatingEl 8006 }); 8007 return () => { 8008 clearPointerEvents(); 8009 }; 8010 } 8011 return void 0; 8012 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 8013 React34.useEffect(() => { 8014 if (!enabled) { 8015 return void 0; 8016 } 8017 function hasParentChildren() { 8018 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 8019 } 8020 function closeWithDelay(event) { 8021 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 8022 const close = () => { 8023 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8024 tree?.events.emit("floating.closed", event); 8025 }; 8026 if (closeDelay) { 8027 instance.openChangeTimeout.start(closeDelay, close); 8028 } else { 8029 instance.openChangeTimeout.clear(); 8030 close(); 8031 } 8032 } 8033 function handleInteractInside(event) { 8034 const target = getTarget(event); 8035 if (!isInteractiveElement(target)) { 8036 instance.interactedInside = false; 8037 return; 8038 } 8039 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 8040 } 8041 function onFloatingMouseEnter() { 8042 instance.openChangeTimeout.clear(); 8043 childClosedTimeout.clear(); 8044 tree?.events.off("floating.closed", onNodeClosed); 8045 clearPointerEvents(); 8046 } 8047 function onFloatingMouseLeave(event) { 8048 if (hasParentChildren() && tree) { 8049 tree.events.on("floating.closed", onNodeClosed); 8050 return; 8051 } 8052 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 8053 return; 8054 } 8055 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 8056 const relatedTarget = event.relatedTarget; 8057 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 8058 if (isMovingIntoDescendantFloating) { 8059 return; 8060 } 8061 if (instance.handler) { 8062 instance.handler(event); 8063 return; 8064 } 8065 clearPointerEvents(); 8066 if (!isClickLikeOpenEvent2()) { 8067 closeWithDelay(event); 8068 } 8069 } 8070 function onNodeClosed(event) { 8071 if (!tree || !parentId || hasParentChildren()) { 8072 return; 8073 } 8074 childClosedTimeout.start(0, () => { 8075 tree.events.off("floating.closed", onNodeClosed); 8076 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8077 tree.events.emit("floating.closed", event); 8078 }); 8079 } 8080 const floating = floatingElement; 8081 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 8082 tree?.events.off("floating.closed", onNodeClosed); 8083 }); 8084 }, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 8085 } 8086 8087 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js 8088 var React35 = __toESM(require_react(), 1); 8089 var ReactDOM4 = __toESM(require_react_dom(), 1); 8090 var EMPTY_REF = { 8091 current: null 8092 }; 8093 function useHoverReferenceInteraction(context, props = {}) { 8094 const { 8095 enabled = true, 8096 delay = 0, 8097 handleClose = null, 8098 mouseOnly = false, 8099 restMs = 0, 8100 move = true, 8101 triggerElementRef = EMPTY_REF, 8102 externalTree, 8103 isActiveTrigger = true, 8104 getHandleCloseContext, 8105 isClosing, 8106 shouldOpen: shouldOpenProp 8107 } = props; 8108 const store2 = "rootStore" in context ? context.rootStore : context; 8109 const { 8110 dataRef, 8111 events 8112 } = store2.context; 8113 const tree = useFloatingTree(externalTree); 8114 const instance = useHoverInteractionSharedState(store2); 8115 const isHoverCloseActiveRef = React35.useRef(false); 8116 const handleCloseRef = useValueAsRef(handleClose); 8117 const delayRef = useValueAsRef(delay); 8118 const restMsRef = useValueAsRef(restMs); 8119 const enabledRef = useValueAsRef(enabled); 8120 const shouldOpenRef = useValueAsRef(shouldOpenProp); 8121 const isClosingRef = useValueAsRef(isClosing); 8122 const isClickLikeOpenEvent2 = useStableCallback(() => { 8123 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 8124 }); 8125 const checkShouldOpen = useStableCallback(() => { 8126 return shouldOpenRef.current?.() !== false; 8127 }); 8128 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 8129 const allTriggers = store2.context.triggerElements; 8130 if (allTriggers.hasElement(currentTarget)) { 8131 return !currentDomReference || !contains(currentDomReference, currentTarget); 8132 } 8133 if (!isElement(target)) { 8134 return false; 8135 } 8136 const targetElement = target; 8137 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 8138 }); 8139 const cleanupMouseMoveHandler = useStableCallback(() => { 8140 if (!instance.handler) { 8141 return; 8142 } 8143 const doc = ownerDocument(store2.select("domReferenceElement")); 8144 doc.removeEventListener("mousemove", instance.handler); 8145 instance.handler = void 0; 8146 }); 8147 const clearPointerEvents = useStableCallback(() => { 8148 clearSafePolygonPointerEventsMutation(instance); 8149 }); 8150 if (isActiveTrigger) { 8151 instance.handleCloseOptions = handleCloseRef.current?.__options; 8152 } 8153 React35.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 8154 React35.useEffect(() => { 8155 if (!enabled) { 8156 return void 0; 8157 } 8158 function onOpenChangeLocal(details) { 8159 if (!details.open) { 8160 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 8161 cleanupMouseMoveHandler(); 8162 instance.openChangeTimeout.clear(); 8163 instance.restTimeout.clear(); 8164 instance.blockMouseMove = true; 8165 instance.restTimeoutPending = false; 8166 } else { 8167 isHoverCloseActiveRef.current = false; 8168 } 8169 } 8170 events.on("openchange", onOpenChangeLocal); 8171 return () => { 8172 events.off("openchange", onOpenChangeLocal); 8173 }; 8174 }, [enabled, events, instance, cleanupMouseMoveHandler]); 8175 React35.useEffect(() => { 8176 if (!enabled) { 8177 return void 0; 8178 } 8179 function closeWithDelay(event, runElseBranch = true) { 8180 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 8181 if (closeDelay) { 8182 instance.openChangeTimeout.start(closeDelay, () => { 8183 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8184 tree?.events.emit("floating.closed", event); 8185 }); 8186 } else if (runElseBranch) { 8187 instance.openChangeTimeout.clear(); 8188 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8189 tree?.events.emit("floating.closed", event); 8190 } 8191 } 8192 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null); 8193 if (!isElement(trigger)) { 8194 return void 0; 8195 } 8196 function onMouseEnter(event) { 8197 instance.openChangeTimeout.clear(); 8198 instance.blockMouseMove = false; 8199 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 8200 return; 8201 } 8202 const restMsValue = getRestMs(restMsRef.current); 8203 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 8204 const eventTarget = getTarget(event); 8205 const currentTarget = event.currentTarget ?? null; 8206 const currentDomReference = store2.select("domReferenceElement"); 8207 let triggerNode = currentTarget; 8208 if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) { 8209 for (const triggerElement of store2.context.triggerElements.elements()) { 8210 if (contains(triggerElement, eventTarget)) { 8211 triggerNode = triggerElement; 8212 break; 8213 } 8214 } 8215 } 8216 if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 8217 triggerNode = currentDomReference; 8218 } 8219 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 8220 const isOpen = store2.select("open"); 8221 const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending"; 8222 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 8223 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 8224 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 8225 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 8226 const shouldOpen = !isOpen || isOverInactive; 8227 if (shouldOpenImmediately) { 8228 if (checkShouldOpen()) { 8229 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8230 } 8231 return; 8232 } 8233 if (isRestOnlyDelay) { 8234 return; 8235 } 8236 if (openDelay) { 8237 instance.openChangeTimeout.start(openDelay, () => { 8238 if (shouldOpen && checkShouldOpen()) { 8239 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8240 } 8241 }); 8242 } else if (shouldOpen) { 8243 if (checkShouldOpen()) { 8244 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8245 } 8246 } 8247 } 8248 function onMouseLeave(event) { 8249 if (isClickLikeOpenEvent2()) { 8250 clearPointerEvents(); 8251 return; 8252 } 8253 cleanupMouseMoveHandler(); 8254 const domReferenceElement = store2.select("domReferenceElement"); 8255 const doc = ownerDocument(domReferenceElement); 8256 instance.restTimeout.clear(); 8257 instance.restTimeoutPending = false; 8258 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 8259 if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { 8260 return; 8261 } 8262 if (handleCloseRef.current && handleCloseContextBase) { 8263 if (!store2.select("open")) { 8264 instance.openChangeTimeout.clear(); 8265 } 8266 const currentTrigger = triggerElementRef.current; 8267 instance.handler = handleCloseRef.current({ 8268 ...handleCloseContextBase, 8269 tree, 8270 x: event.clientX, 8271 y: event.clientY, 8272 onClose() { 8273 clearPointerEvents(); 8274 cleanupMouseMoveHandler(); 8275 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) { 8276 closeWithDelay(event, true); 8277 } 8278 } 8279 }); 8280 doc.addEventListener("mousemove", instance.handler); 8281 instance.handler(event); 8282 return; 8283 } 8284 const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true; 8285 if (shouldClose) { 8286 closeWithDelay(event); 8287 } 8288 } 8289 if (move) { 8290 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 8291 once: true 8292 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 8293 } 8294 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 8295 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]); 8296 return React35.useMemo(() => { 8297 if (!enabled) { 8298 return void 0; 8299 } 8300 function setPointerRef(event) { 8301 instance.pointerType = event.pointerType; 8302 } 8303 return { 8304 onPointerDown: setPointerRef, 8305 onPointerEnter: setPointerRef, 8306 onMouseMove(event) { 8307 const { 8308 nativeEvent 8309 } = event; 8310 const trigger = event.currentTarget; 8311 const currentDomReference = store2.select("domReferenceElement"); 8312 const currentOpen = store2.select("open"); 8313 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 8314 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 8315 return; 8316 } 8317 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 8318 const floatingElement = store2.select("floatingElement"); 8319 if (floatingElement) { 8320 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 8321 applySafePolygonPointerEventsMutation(instance, { 8322 scopeElement, 8323 referenceElement: trigger, 8324 floatingElement 8325 }); 8326 } 8327 } 8328 const restMsValue = getRestMs(restMsRef.current); 8329 if (currentOpen && !isOverInactive || restMsValue === 0) { 8330 return; 8331 } 8332 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 8333 return; 8334 } 8335 instance.restTimeout.clear(); 8336 function handleMouseMove() { 8337 instance.restTimeoutPending = false; 8338 if (isClickLikeOpenEvent2()) { 8339 return; 8340 } 8341 const latestOpen = store2.select("open"); 8342 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 8343 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 8344 } 8345 } 8346 if (instance.pointerType === "touch") { 8347 ReactDOM4.flushSync(() => { 8348 handleMouseMove(); 8349 }); 8350 } else if (isOverInactive && currentOpen) { 8351 handleMouseMove(); 8352 } else { 8353 instance.restTimeoutPending = true; 8354 instance.restTimeout.start(restMsValue, handleMouseMove); 8355 } 8356 } 8357 }; 8358 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]); 8359 } 8360 8361 // node_modules/@base-ui/react/esm/floating-ui-react/safePolygon.js 8362 var CURSOR_SPEED_THRESHOLD = 0.1; 8363 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 8364 var POLYGON_BUFFER = 0.5; 8365 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 8366 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 8367 } 8368 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 8369 let isInsideValue = false; 8370 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 8371 isInsideValue = !isInsideValue; 8372 } 8373 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 8374 isInsideValue = !isInsideValue; 8375 } 8376 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 8377 isInsideValue = !isInsideValue; 8378 } 8379 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 8380 isInsideValue = !isInsideValue; 8381 } 8382 return isInsideValue; 8383 } 8384 function isInsideRect(pointX, pointY, rect) { 8385 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 8386 } 8387 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 8388 const minX = Math.min(x1, x2); 8389 const maxX = Math.max(x1, x2); 8390 const minY = Math.min(y1, y2); 8391 const maxY = Math.max(y1, y2); 8392 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 8393 } 8394 function safePolygon(options = {}) { 8395 const { 8396 blockPointerEvents = false 8397 } = options; 8398 const timeout = new Timeout(); 8399 const fn = ({ 8400 x: x2, 8401 y: y2, 8402 placement, 8403 elements: elements2, 8404 onClose, 8405 nodeId, 8406 tree 8407 }) => { 8408 const side = placement?.split("-")[0]; 8409 let hasLanded = false; 8410 let lastX = null; 8411 let lastY = null; 8412 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 8413 function isCursorMovingSlowly(nextX, nextY) { 8414 const currentTime = performance.now(); 8415 const elapsedTime = currentTime - lastCursorTime; 8416 if (lastX === null || lastY === null || elapsedTime === 0) { 8417 lastX = nextX; 8418 lastY = nextY; 8419 lastCursorTime = currentTime; 8420 return false; 8421 } 8422 const deltaX = nextX - lastX; 8423 const deltaY = nextY - lastY; 8424 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 8425 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 8426 lastX = nextX; 8427 lastY = nextY; 8428 lastCursorTime = currentTime; 8429 return distanceSquared < thresholdSquared; 8430 } 8431 function close() { 8432 timeout.clear(); 8433 onClose(); 8434 } 8435 return function onMouseMove(event) { 8436 timeout.clear(); 8437 const domReference = elements2.domReference; 8438 const floating = elements2.floating; 8439 if (!domReference || !floating || side == null || x2 == null || y2 == null) { 8440 return void 0; 8441 } 8442 const { 8443 clientX, 8444 clientY 8445 } = event; 8446 const target = getTarget(event); 8447 const isLeave = event.type === "mouseleave"; 8448 const isOverFloatingEl = contains(floating, target); 8449 const isOverReferenceEl = contains(domReference, target); 8450 if (isOverFloatingEl) { 8451 hasLanded = true; 8452 if (!isLeave) { 8453 return void 0; 8454 } 8455 } 8456 if (isOverReferenceEl) { 8457 hasLanded = false; 8458 if (!isLeave) { 8459 hasLanded = true; 8460 return void 0; 8461 } 8462 } 8463 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 8464 return void 0; 8465 } 8466 function hasOpenChildNode() { 8467 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 8468 } 8469 function closeIfNoOpenChild() { 8470 if (!hasOpenChildNode()) { 8471 close(); 8472 } 8473 } 8474 if (hasOpenChildNode()) { 8475 return void 0; 8476 } 8477 const refRect = domReference.getBoundingClientRect(); 8478 const rect = floating.getBoundingClientRect(); 8479 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2; 8480 const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2; 8481 const isFloatingWider = rect.width > refRect.width; 8482 const isFloatingTaller = rect.height > refRect.height; 8483 const left = (isFloatingWider ? refRect : rect).left; 8484 const right = (isFloatingWider ? refRect : rect).right; 8485 const top = (isFloatingTaller ? refRect : rect).top; 8486 const bottom = (isFloatingTaller ? refRect : rect).bottom; 8487 if (side === "top" && y2 >= refRect.bottom - 1 || side === "bottom" && y2 <= refRect.top + 1 || side === "left" && x2 >= refRect.right - 1 || side === "right" && x2 <= refRect.left + 1) { 8488 closeIfNoOpenChild(); 8489 return void 0; 8490 } 8491 let isInsideTroughRect = false; 8492 switch (side) { 8493 case "top": 8494 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 8495 break; 8496 case "bottom": 8497 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 8498 break; 8499 case "left": 8500 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 8501 break; 8502 case "right": 8503 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 8504 break; 8505 default: 8506 } 8507 if (isInsideTroughRect) { 8508 return void 0; 8509 } 8510 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 8511 closeIfNoOpenChild(); 8512 return void 0; 8513 } 8514 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 8515 closeIfNoOpenChild(); 8516 return void 0; 8517 } 8518 let isInsidePolygon = false; 8519 switch (side) { 8520 case "top": { 8521 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8522 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 8523 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 8524 const cursorPointY = y2 + POLYGON_BUFFER + 1; 8525 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 8526 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 8527 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 8528 break; 8529 } 8530 case "bottom": { 8531 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8532 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 8533 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 8534 const cursorPointY = y2 - POLYGON_BUFFER; 8535 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 8536 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 8537 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 8538 break; 8539 } 8540 case "left": { 8541 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8542 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 8543 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 8544 const cursorPointX = x2 + POLYGON_BUFFER + 1; 8545 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 8546 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 8547 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 8548 break; 8549 } 8550 case "right": { 8551 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8552 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 8553 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 8554 const cursorPointX = x2 - POLYGON_BUFFER; 8555 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 8556 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 8557 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 8558 break; 8559 } 8560 default: 8561 } 8562 if (!isInsidePolygon) { 8563 closeIfNoOpenChild(); 8564 } else if (!hasLanded) { 8565 timeout.start(40, closeIfNoOpenChild); 8566 } 8567 return void 0; 8568 }; 8569 }; 8570 fn.__options = { 8571 ...options, 8572 blockPointerEvents 8573 }; 8574 return fn; 8575 } 8576 8577 // node_modules/@base-ui/react/esm/utils/popupStateMapping.js 8578 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { 8579 CommonPopupDataAttributes2["open"] = "data-open"; 8580 CommonPopupDataAttributes2["closed"] = "data-closed"; 8581 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 8582 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 8583 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; 8584 CommonPopupDataAttributes2["side"] = "data-side"; 8585 CommonPopupDataAttributes2["align"] = "data-align"; 8586 return CommonPopupDataAttributes2; 8587 })({}); 8588 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { 8589 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; 8590 CommonTriggerDataAttributes2["pressed"] = "data-pressed"; 8591 return CommonTriggerDataAttributes2; 8592 })({}); 8593 var TRIGGER_HOOK = { 8594 [CommonTriggerDataAttributes.popupOpen]: "" 8595 }; 8596 var PRESSABLE_TRIGGER_HOOK = { 8597 [CommonTriggerDataAttributes.popupOpen]: "", 8598 [CommonTriggerDataAttributes.pressed]: "" 8599 }; 8600 var POPUP_OPEN_HOOK = { 8601 [CommonPopupDataAttributes.open]: "" 8602 }; 8603 var POPUP_CLOSED_HOOK = { 8604 [CommonPopupDataAttributes.closed]: "" 8605 }; 8606 var ANCHOR_HIDDEN_HOOK = { 8607 [CommonPopupDataAttributes.anchorHidden]: "" 8608 }; 8609 var triggerOpenStateMapping2 = { 8610 open(value) { 8611 if (value) { 8612 return TRIGGER_HOOK; 8613 } 8614 return null; 8615 } 8616 }; 8617 var popupStateMapping = { 8618 open(value) { 8619 if (value) { 8620 return POPUP_OPEN_HOOK; 8621 } 8622 return POPUP_CLOSED_HOOK; 8623 }, 8624 anchorHidden(value) { 8625 if (value) { 8626 return ANCHOR_HIDDEN_HOOK; 8627 } 8628 return null; 8629 } 8630 }; 8631 8632 // node_modules/@base-ui/utils/esm/inertValue.js 8633 function inertValue(value) { 8634 if (isReactVersionAtLeast(19)) { 8635 return value; 8636 } 8637 return value ? "true" : void 0; 8638 } 8639 8640 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js 8641 var React36 = __toESM(require_react(), 1); 8642 8643 // node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js 8644 var baseArrow = (options) => ({ 8645 name: "arrow", 8646 options, 8647 async fn(state) { 8648 const { 8649 x: x2, 8650 y: y2, 8651 placement, 8652 rects, 8653 platform: platform3, 8654 elements: elements2, 8655 middlewareData 8656 } = state; 8657 const { 8658 element, 8659 padding = 0, 8660 offsetParent = "real" 8661 } = evaluate(options, state) || {}; 8662 if (element == null) { 8663 return {}; 8664 } 8665 const paddingObject = getPaddingObject(padding); 8666 const coords = { 8667 x: x2, 8668 y: y2 8669 }; 8670 const axis = getAlignmentAxis(placement); 8671 const length = getAxisLength(axis); 8672 const arrowDimensions = await platform3.getDimensions(element); 8673 const isYAxis = axis === "y"; 8674 const minProp = isYAxis ? "top" : "left"; 8675 const maxProp = isYAxis ? "bottom" : "right"; 8676 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 8677 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 8678 const startDiff = coords[axis] - rects.reference[axis]; 8679 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements2.floating; 8680 let clientSize = elements2.floating[clientProp] || rects.floating[length]; 8681 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 8682 clientSize = elements2.floating[clientProp] || rects.floating[length]; 8683 } 8684 const centerToReference = endDiff / 2 - startDiff / 2; 8685 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 8686 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 8687 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 8688 const min2 = minPadding; 8689 const max2 = clientSize - arrowDimensions[length] - maxPadding; 8690 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 8691 const offset4 = clamp(min2, center, max2); 8692 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 8693 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 8694 return { 8695 [axis]: coords[axis] + alignmentOffset, 8696 data: { 8697 [axis]: offset4, 8698 centerOffset: center - offset4 - alignmentOffset, 8699 ...shouldAddOffset && { 8700 alignmentOffset 8701 } 8702 }, 8703 reset: shouldAddOffset 8704 }; 8705 } 8706 }); 8707 var arrow4 = (options, deps) => ({ 8708 ...baseArrow(options), 8709 options: [options, deps] 8710 }); 8711 8712 // node_modules/@base-ui/react/esm/utils/hideMiddleware.js 8713 var hide4 = { 8714 name: "hide", 8715 async fn(state) { 8716 const { 8717 width, 8718 height, 8719 x: x2, 8720 y: y2 8721 } = state.rects.reference; 8722 const anchorHidden = width === 0 && height === 0 && x2 === 0 && y2 === 0; 8723 const nativeHideResult = await hide3().fn(state); 8724 return { 8725 data: { 8726 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden 8727 } 8728 }; 8729 } 8730 }; 8731 8732 // node_modules/@base-ui/react/esm/utils/adaptiveOriginMiddleware.js 8733 var DEFAULT_SIDES = { 8734 sideX: "left", 8735 sideY: "top" 8736 }; 8737 var adaptiveOrigin = { 8738 name: "adaptiveOrigin", 8739 async fn(state) { 8740 const { 8741 x: rawX, 8742 y: rawY, 8743 rects: { 8744 floating: floatRect 8745 }, 8746 elements: { 8747 floating 8748 }, 8749 platform: platform3, 8750 strategy, 8751 placement 8752 } = state; 8753 const win = getWindow(floating); 8754 const styles = win.getComputedStyle(floating); 8755 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 8756 if (!hasTransition) { 8757 return { 8758 x: rawX, 8759 y: rawY, 8760 data: DEFAULT_SIDES 8761 }; 8762 } 8763 const offsetParent = await platform3.getOffsetParent?.(floating); 8764 let offsetDimensions = { 8765 width: 0, 8766 height: 0 8767 }; 8768 if (strategy === "fixed" && win?.visualViewport) { 8769 offsetDimensions = { 8770 width: win.visualViewport.width, 8771 height: win.visualViewport.height 8772 }; 8773 } else if (offsetParent === win) { 8774 const doc = ownerDocument(floating); 8775 offsetDimensions = { 8776 width: doc.documentElement.clientWidth, 8777 height: doc.documentElement.clientHeight 8778 }; 8779 } else if (await platform3.isElement?.(offsetParent)) { 8780 offsetDimensions = await platform3.getDimensions(offsetParent); 8781 } 8782 const currentSide = getSide(placement); 8783 let x2 = rawX; 8784 let y2 = rawY; 8785 if (currentSide === "left") { 8786 x2 = offsetDimensions.width - (rawX + floatRect.width); 8787 } 8788 if (currentSide === "top") { 8789 y2 = offsetDimensions.height - (rawY + floatRect.height); 8790 } 8791 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 8792 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 8793 return { 8794 x: x2, 8795 y: y2, 8796 data: { 8797 sideX, 8798 sideY 8799 } 8800 }; 8801 } 8802 }; 8803 8804 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js 8805 function getLogicalSide(sideParam, renderedSide, isRtl) { 8806 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 8807 const logicalRight = isRtl ? "inline-start" : "inline-end"; 8808 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 8809 return { 8810 top: "top", 8811 right: isLogicalSideParam ? logicalRight : "right", 8812 bottom: "bottom", 8813 left: isLogicalSideParam ? logicalLeft : "left" 8814 }[renderedSide]; 8815 } 8816 function getOffsetData(state, sideParam, isRtl) { 8817 const { 8818 rects, 8819 placement 8820 } = state; 8821 const data = { 8822 side: getLogicalSide(sideParam, getSide(placement), isRtl), 8823 align: getAlignment(placement) || "center", 8824 anchor: { 8825 width: rects.reference.width, 8826 height: rects.reference.height 8827 }, 8828 positioner: { 8829 width: rects.floating.width, 8830 height: rects.floating.height 8831 } 8832 }; 8833 return data; 8834 } 8835 function useAnchorPositioning(params) { 8836 const { 8837 // Public parameters 8838 anchor, 8839 positionMethod = "absolute", 8840 side: sideParam = "bottom", 8841 sideOffset = 0, 8842 align = "center", 8843 alignOffset = 0, 8844 collisionBoundary, 8845 collisionPadding: collisionPaddingParam = 5, 8846 sticky = false, 8847 arrowPadding = 5, 8848 disableAnchorTracking = false, 8849 inline: inlineMiddleware, 8850 // Private parameters 8851 keepMounted = false, 8852 floatingRootContext, 8853 mounted, 8854 collisionAvoidance, 8855 shiftCrossAxis = false, 8856 nodeId, 8857 adaptiveOrigin: adaptiveOrigin2, 8858 lazyFlip = false, 8859 externalTree 8860 } = params; 8861 const [mountSide, setMountSide] = React36.useState(null); 8862 if (!mounted && mountSide !== null) { 8863 setMountSide(null); 8864 } 8865 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 8866 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 8867 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 8868 const anchorFn = typeof anchor === "function" ? anchor : void 0; 8869 const anchorFnCallback = useStableCallback(anchorFn); 8870 const anchorDep = anchorFn ? anchorFnCallback : anchor; 8871 const anchorValueRef = useValueAsRef(anchor); 8872 const mountedRef = useValueAsRef(mounted); 8873 const direction = useDirection(); 8874 const isRtl = direction === "rtl"; 8875 const side = mountSide || { 8876 top: "top", 8877 right: "right", 8878 bottom: "bottom", 8879 left: "left", 8880 "inline-end": isRtl ? "left" : "right", 8881 "inline-start": isRtl ? "right" : "left" 8882 }[sideParam]; 8883 const placement = align === "center" ? side : `$side}-$align}`; 8884 let collisionPadding = collisionPaddingParam; 8885 const bias = 1; 8886 const biasTop = sideParam === "bottom" ? bias : 0; 8887 const biasBottom = sideParam === "top" ? bias : 0; 8888 const biasLeft = sideParam === "right" ? bias : 0; 8889 const biasRight = sideParam === "left" ? bias : 0; 8890 if (typeof collisionPadding === "number") { 8891 collisionPadding = { 8892 top: collisionPadding + biasTop, 8893 right: collisionPadding + biasRight, 8894 bottom: collisionPadding + biasBottom, 8895 left: collisionPadding + biasLeft 8896 }; 8897 } else if (collisionPadding) { 8898 collisionPadding = { 8899 top: (collisionPadding.top || 0) + biasTop, 8900 right: (collisionPadding.right || 0) + biasRight, 8901 bottom: (collisionPadding.bottom || 0) + biasBottom, 8902 left: (collisionPadding.left || 0) + biasLeft 8903 }; 8904 } 8905 const commonCollisionProps = { 8906 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 8907 padding: collisionPadding 8908 }; 8909 const arrowRef = React36.useRef(null); 8910 const sideOffsetRef = useValueAsRef(sideOffset); 8911 const alignOffsetRef = useValueAsRef(alignOffset); 8912 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 8913 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 8914 const middleware = []; 8915 if (inlineMiddleware) { 8916 middleware.push(inlineMiddleware); 8917 } 8918 middleware.push(offset3((state) => { 8919 const data = getOffsetData(state, sideParam, isRtl); 8920 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 8921 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 8922 return { 8923 mainAxis: sideAxis, 8924 crossAxis: alignAxis, 8925 alignmentAxis: alignAxis 8926 }; 8927 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 8928 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 8929 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 8930 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 8931 ...commonCollisionProps, 8932 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 8933 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 8934 padding: { 8935 top: collisionPadding.top + bias, 8936 right: collisionPadding.right + bias, 8937 bottom: collisionPadding.bottom + bias, 8938 left: collisionPadding.left + bias 8939 }, 8940 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 8941 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 8942 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 8943 }); 8944 const shiftMiddleware = shiftDisabled ? null : shift3((data) => { 8945 const html = ownerDocument(data.elements.floating).documentElement; 8946 return { 8947 ...commonCollisionProps, 8948 // Use the Layout Viewport to avoid shifting around when pinch-zooming 8949 // for context menus. 8950 rootBoundary: shiftCrossAxis ? { 8951 x: 0, 8952 y: 0, 8953 width: html.clientWidth, 8954 height: html.clientHeight 8955 } : void 0, 8956 mainAxis: collisionAvoidanceAlign !== "none", 8957 crossAxis: crossAxisShiftEnabled, 8958 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 8959 if (!arrowRef.current) { 8960 return {}; 8961 } 8962 const { 8963 width, 8964 height 8965 } = arrowRef.current.getBoundingClientRect(); 8966 const sideAxis = getSideAxis(getSide(limitData.placement)); 8967 const arrowSize = sideAxis === "y" ? width : height; 8968 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 8969 return { 8970 offset: arrowSize / 2 + offsetAmount / 2 8971 }; 8972 }) 8973 }; 8974 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); 8975 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 8976 middleware.push(shiftMiddleware, flipMiddleware); 8977 } else { 8978 middleware.push(flipMiddleware, shiftMiddleware); 8979 } 8980 middleware.push(size3({ 8981 ...commonCollisionProps, 8982 apply({ 8983 elements: { 8984 floating 8985 }, 8986 availableWidth, 8987 availableHeight, 8988 rects 8989 }) { 8990 if (!mountedRef.current) { 8991 return; 8992 } 8993 const floatingStyle = floating.style; 8994 floatingStyle.setProperty("--available-width", `$availableWidth}px`); 8995 floatingStyle.setProperty("--available-height", `$availableHeight}px`); 8996 const dpr = getWindow(floating).devicePixelRatio || 1; 8997 const { 8998 x: x3, 8999 y: y3, 9000 width, 9001 height 9002 } = rects.reference; 9003 const anchorWidth = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr; 9004 const anchorHeight = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr; 9005 floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`); 9006 floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`); 9007 } 9008 }), arrow4((state) => ({ 9009 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 9010 // we'll create a fake element. 9011 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), 9012 padding: arrowPadding, 9013 offsetParent: "floating" 9014 }), [arrowPadding]), { 9015 name: "transformOrigin", 9016 fn(state) { 9017 const { 9018 elements: elements3, 9019 middlewareData: middlewareData2, 9020 placement: renderedPlacement2, 9021 rects, 9022 y: y3 9023 } = state; 9024 const currentRenderedSide = getSide(renderedPlacement2); 9025 const currentRenderedAxis = getSideAxis(currentRenderedSide); 9026 const arrowEl = arrowRef.current; 9027 const arrowX = middlewareData2.arrow?.x || 0; 9028 const arrowY = middlewareData2.arrow?.y || 0; 9029 const arrowWidth = arrowEl?.clientWidth || 0; 9030 const arrowHeight = arrowEl?.clientHeight || 0; 9031 const transformX = arrowX + arrowWidth / 2; 9032 const transformY = arrowY + arrowHeight / 2; 9033 const shiftY = Math.abs(middlewareData2.shift?.y || 0); 9034 const halfAnchorHeight = rects.reference.height / 2; 9035 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 9036 const isOverlappingAnchor = shiftY > sideOffsetValue; 9037 const adjacentTransformOrigin = { 9038 top: `$transformX}px calc(100% + $sideOffsetValue}px)`, 9039 bottom: `$transformX}px ${-sideOffsetValue}px`, 9040 left: `calc(100% + $sideOffsetValue}px) $transformY}px`, 9041 right: `${-sideOffsetValue}px $transformY}px` 9042 }[currentRenderedSide]; 9043 const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y3}px`; 9044 elements3.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); 9045 return {}; 9046 } 9047 }, hide4, adaptiveOrigin2); 9048 useIsoLayoutEffect(() => { 9049 if (!mounted && floatingRootContext) { 9050 floatingRootContext.update({ 9051 referenceElement: null, 9052 floatingElement: null, 9053 domReferenceElement: null, 9054 positionReference: null 9055 }); 9056 } 9057 }, [mounted, floatingRootContext]); 9058 const autoUpdateOptions = React36.useMemo(() => ({ 9059 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 9060 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 9061 }), [disableAnchorTracking]); 9062 const { 9063 refs, 9064 elements: elements2, 9065 x: x2, 9066 y: y2, 9067 middlewareData, 9068 update: update4, 9069 placement: renderedPlacement, 9070 context, 9071 isPositioned, 9072 floatingStyles: originalFloatingStyles 9073 } = useFloating2({ 9074 rootContext: floatingRootContext, 9075 open: keepMounted ? mounted : void 0, 9076 placement, 9077 middleware, 9078 strategy: positionMethod, 9079 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 9080 nodeId, 9081 externalTree 9082 }); 9083 const { 9084 sideX, 9085 sideY 9086 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 9087 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 9088 const floatingStyles = React36.useMemo(() => { 9089 const base = adaptiveOrigin2 ? { 9090 position: resolvedPosition, 9091 [sideX]: x2, 9092 [sideY]: y2 9093 } : { 9094 position: resolvedPosition, 9095 ...originalFloatingStyles 9096 }; 9097 if (!isPositioned) { 9098 base.opacity = 0; 9099 } 9100 return base; 9101 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]); 9102 const registeredPositionReferenceRef = React36.useRef(null); 9103 useIsoLayoutEffect(() => { 9104 if (!mounted) { 9105 return; 9106 } 9107 const anchorValue = anchorValueRef.current; 9108 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 9109 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 9110 const finalAnchor = unwrappedElement || null; 9111 if (finalAnchor !== registeredPositionReferenceRef.current) { 9112 refs.setPositionReference(finalAnchor); 9113 registeredPositionReferenceRef.current = finalAnchor; 9114 } 9115 }, [mounted, refs, anchorDep, anchorValueRef]); 9116 React36.useEffect(() => { 9117 if (!mounted) { 9118 return; 9119 } 9120 const anchorValue = anchorValueRef.current; 9121 if (typeof anchorValue === "function") { 9122 return; 9123 } 9124 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 9125 refs.setPositionReference(anchorValue.current); 9126 registeredPositionReferenceRef.current = anchorValue.current; 9127 } 9128 }, [mounted, refs, anchorDep, anchorValueRef]); 9129 React36.useEffect(() => { 9130 if (keepMounted && mounted && elements2.domReference && elements2.floating) { 9131 return autoUpdate(elements2.domReference, elements2.floating, update4, autoUpdateOptions); 9132 } 9133 return void 0; 9134 }, [keepMounted, mounted, elements2, update4, autoUpdateOptions]); 9135 const renderedSide = getSide(renderedPlacement); 9136 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 9137 const renderedAlign = getAlignment(renderedPlacement) || "center"; 9138 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); 9139 useIsoLayoutEffect(() => { 9140 if (lazyFlip && mounted && isPositioned) { 9141 setMountSide(renderedSide); 9142 } 9143 }, [lazyFlip, mounted, isPositioned, renderedSide]); 9144 const arrowStyles = React36.useMemo(() => ({ 9145 position: "absolute", 9146 top: middlewareData.arrow?.y, 9147 left: middlewareData.arrow?.x 9148 }), [middlewareData.arrow]); 9149 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 9150 return React36.useMemo(() => ({ 9151 positionerStyles: floatingStyles, 9152 arrowStyles, 9153 arrowRef, 9154 arrowUncentered, 9155 side: logicalRenderedSide, 9156 align: renderedAlign, 9157 physicalSide: renderedSide, 9158 anchorHidden, 9159 refs, 9160 context, 9161 isPositioned, 9162 update: update4 9163 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update4]); 9164 } 9165 function isRef(param) { 9166 return param != null && "current" in param; 9167 } 9168 9169 // node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js 9170 function getDisabledMountTransitionStyles(transitionStatus) { 9171 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 9172 } 9173 9174 // node_modules/@base-ui/react/esm/utils/usePositioner.js 9175 function usePositioner(componentProps, state, { 9176 styles, 9177 transitionStatus, 9178 props, 9179 refs, 9180 hidden, 9181 inert = false 9182 }) { 9183 const style = { 9184 ...styles 9185 }; 9186 if (inert) { 9187 style.pointerEvents = "none"; 9188 } 9189 return useRenderElement("div", componentProps, { 9190 state, 9191 ref: refs, 9192 props: [{ 9193 role: "presentation", 9194 hidden, 9195 style 9196 }, getDisabledMountTransitionStyles(transitionStatus), props], 9197 stateAttributesMapping: popupStateMapping 9198 }); 9199 } 9200 9201 // node_modules/@base-ui/react/esm/collapsible/index.parts.js 9202 var index_parts_exports = {}; 9203 __export(index_parts_exports, { 9204 Panel: () => CollapsiblePanel, 9205 Root: () => CollapsibleRoot, 9206 Trigger: () => CollapsibleTrigger 9207 }); 9208 9209 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRoot.js 9210 var React37 = __toESM(require_react(), 1); 9211 9212 // node_modules/@base-ui/react/esm/collapsible/root/stateAttributesMapping.js 9213 var collapsibleStateAttributesMapping = { 9214 ...collapsibleOpenStateMapping, 9215 ...transitionStatusMapping 9216 }; 9217 9218 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRoot.js 9219 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 9220 var CollapsibleRoot = /* @__PURE__ */ React37.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) { 9221 const { 9222 render: render4, 9223 className, 9224 defaultOpen = false, 9225 disabled: disabled2 = false, 9226 onOpenChange: onOpenChangeProp, 9227 open, 9228 style, 9229 ...elementProps 9230 } = componentProps; 9231 const onOpenChange = useStableCallback(onOpenChangeProp); 9232 const collapsible = useCollapsibleRoot({ 9233 open, 9234 defaultOpen, 9235 onOpenChange, 9236 disabled: disabled2 9237 }); 9238 const state = React37.useMemo(() => ({ 9239 open: collapsible.open, 9240 disabled: collapsible.disabled, 9241 transitionStatus: collapsible.transitionStatus 9242 }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]); 9243 const contextValue = React37.useMemo(() => ({ 9244 ...collapsible, 9245 onOpenChange, 9246 state 9247 }), [collapsible, onOpenChange, state]); 9248 const element = useRenderElement("div", componentProps, { 9249 state, 9250 ref: forwardedRef, 9251 props: elementProps, 9252 stateAttributesMapping: collapsibleStateAttributesMapping 9253 }); 9254 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapsibleRootContext.Provider, { 9255 value: contextValue, 9256 children: element 9257 }); 9258 }); 9259 if (true) CollapsibleRoot.displayName = "CollapsibleRoot"; 9260 9261 // node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTrigger.js 9262 var React38 = __toESM(require_react(), 1); 9263 var stateAttributesMapping = { 9264 ...triggerOpenStateMapping, 9265 ...transitionStatusMapping 9266 }; 9267 var CollapsibleTrigger = /* @__PURE__ */ React38.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) { 9268 const { 9269 panelId, 9270 open, 9271 handleTrigger, 9272 state, 9273 disabled: contextDisabled 9274 } = useCollapsibleRootContext(); 9275 const { 9276 className, 9277 disabled: disabled2 = contextDisabled, 9278 id, 9279 render: render4, 9280 nativeButton = true, 9281 style, 9282 ...elementProps 9283 } = componentProps; 9284 const { 9285 getButtonProps, 9286 buttonRef 9287 } = useButton({ 9288 disabled: disabled2, 9289 focusableWhenDisabled: true, 9290 native: nativeButton 9291 }); 9292 const element = useRenderElement("button", componentProps, { 9293 state, 9294 ref: [forwardedRef, buttonRef], 9295 props: [{ 9296 "aria-controls": open ? panelId : void 0, 9297 "aria-expanded": open, 9298 onClick: handleTrigger 9299 }, elementProps, getButtonProps], 9300 stateAttributesMapping 9301 }); 9302 return element; 9303 }); 9304 if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger"; 9305 9306 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanel.js 9307 var React39 = __toESM(require_react(), 1); 9308 9309 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelCssVars.js 9310 var CollapsiblePanelCssVars = /* @__PURE__ */ (function(CollapsiblePanelCssVars2) { 9311 CollapsiblePanelCssVars2["collapsiblePanelHeight"] = "--collapsible-panel-height"; 9312 CollapsiblePanelCssVars2["collapsiblePanelWidth"] = "--collapsible-panel-width"; 9313 return CollapsiblePanelCssVars2; 9314 })({}); 9315 9316 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanel.js 9317 var CollapsiblePanel = /* @__PURE__ */ React39.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) { 9318 const { 9319 className, 9320 hiddenUntilFound: hiddenUntilFoundProp, 9321 keepMounted: keepMountedProp, 9322 render: render4, 9323 id: idProp, 9324 style, 9325 ...elementProps 9326 } = componentProps; 9327 if (true) { 9328 useIsoLayoutEffect(() => { 9329 if (hiddenUntilFoundProp && keepMountedProp === false) { 9330 warn("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed."); 9331 } 9332 }, [hiddenUntilFoundProp, keepMountedProp]); 9333 } 9334 const { 9335 mounted, 9336 onOpenChange, 9337 open, 9338 panelId, 9339 setMounted, 9340 setPanelIdState, 9341 setOpen, 9342 state, 9343 transitionStatus 9344 } = useCollapsibleRootContext(); 9345 const hiddenUntilFound = hiddenUntilFoundProp ?? false; 9346 const keepMounted = keepMountedProp ?? false; 9347 useIsoLayoutEffect(() => { 9348 if (idProp) { 9349 setPanelIdState(idProp); 9350 return () => { 9351 setPanelIdState(void 0); 9352 }; 9353 } 9354 return void 0; 9355 }, [idProp, setPanelIdState]); 9356 const { 9357 height, 9358 props, 9359 ref, 9360 shouldPreventOpenAnimation, 9361 shouldRender, 9362 transitionStatus: panelTransitionStatus, 9363 width 9364 } = useCollapsiblePanel({ 9365 externalRef: forwardedRef, 9366 hiddenUntilFound, 9367 id: panelId, 9368 keepMounted, 9369 mounted, 9370 onOpenChange, 9371 open, 9372 setMounted, 9373 setOpen, 9374 transitionStatus 9375 }); 9376 const panelState = { 9377 ...state, 9378 transitionStatus: panelTransitionStatus 9379 }; 9380 const resolvedStyle = resolveStyle(style, panelState); 9381 const element = useRenderElement("div", { 9382 ...componentProps, 9383 style: void 0 9384 }, { 9385 state: panelState, 9386 ref, 9387 props: [ 9388 props, 9389 { 9390 style: { 9391 [CollapsiblePanelCssVars.collapsiblePanelHeight]: height === void 0 ? "auto" : `$height}px`, 9392 [CollapsiblePanelCssVars.collapsiblePanelWidth]: width === void 0 ? "auto" : `$width}px` 9393 } 9394 }, 9395 elementProps, 9396 resolvedStyle ? { 9397 style: resolvedStyle 9398 } : void 0, 9399 // Resolve the public `style` prop so temporary `animationName: 'none'` 9400 // can still win after user's inline styles have been merged. 9401 shouldPreventOpenAnimation ? { 9402 style: { 9403 animationName: "none" 9404 } 9405 } : void 0 9406 ], 9407 stateAttributesMapping: collapsibleStateAttributesMapping 9408 }); 9409 if (!shouldRender) { 9410 return null; 9411 } 9412 return element; 9413 }); 9414 if (true) CollapsiblePanel.displayName = "CollapsiblePanel"; 9415 9416 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js 9417 var React42 = __toESM(require_react(), 1); 9418 var ReactDOM5 = __toESM(require_react_dom(), 1); 9419 9420 // node_modules/@base-ui/utils/esm/usePreviousValue.js 9421 var React40 = __toESM(require_react(), 1); 9422 function usePreviousValue(value) { 9423 const [state, setState] = React40.useState({ 9424 current: value, 9425 previous: null 9426 }); 9427 if (value !== state.current) { 9428 setState({ 9429 current: value, 9430 previous: state.current 9431 }); 9432 } 9433 return state.previous; 9434 } 9435 9436 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js 9437 var React41 = __toESM(require_react(), 1); 9438 9439 // node_modules/@base-ui/react/esm/utils/getCssDimensions.js 9440 function getCssDimensions2(element) { 9441 const css = getComputedStyle2(element); 9442 let width = parseFloat(css.width) || 0; 9443 let height = parseFloat(css.height) || 0; 9444 const hasOffset = isHTMLElement(element); 9445 const offsetWidth = hasOffset ? element.offsetWidth : width; 9446 const offsetHeight = hasOffset ? element.offsetHeight : height; 9447 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 9448 if (shouldFallback) { 9449 width = offsetWidth; 9450 height = offsetHeight; 9451 } 9452 return { 9453 width, 9454 height 9455 }; 9456 } 9457 9458 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js 9459 var DEFAULT_ENABLED = () => true; 9460 function usePopupAutoResize(parameters) { 9461 const { 9462 popupElement, 9463 positionerElement, 9464 content, 9465 mounted, 9466 enabled = DEFAULT_ENABLED, 9467 onMeasureLayout: onMeasureLayoutParam, 9468 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 9469 side, 9470 direction 9471 } = parameters; 9472 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); 9473 const animationFrame = useAnimationFrame(); 9474 const committedDimensionsRef = React41.useRef(null); 9475 const liveDimensionsRef = React41.useRef(null); 9476 const isInitialRenderRef = React41.useRef(true); 9477 const restoreAnchoringStylesRef = React41.useRef(NOOP); 9478 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 9479 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 9480 const anchoringStyles = React41.useMemo(() => { 9481 let isOriginSide = side === "top"; 9482 let isPhysicalLeft = side === "left"; 9483 if (direction === "rtl") { 9484 isOriginSide = isOriginSide || side === "inline-end"; 9485 isPhysicalLeft = isPhysicalLeft || side === "inline-end"; 9486 } else { 9487 isOriginSide = isOriginSide || side === "inline-start"; 9488 isPhysicalLeft = isPhysicalLeft || side === "inline-start"; 9489 } 9490 return isOriginSide ? { 9491 position: "absolute", 9492 [side === "top" ? "bottom" : "top"]: "0", 9493 [isPhysicalLeft ? "right" : "left"]: "0" 9494 } : EMPTY_OBJECT; 9495 }, [side, direction]); 9496 useIsoLayoutEffect(() => { 9497 if (!mounted || !enabled() || typeof ResizeObserver !== "function") { 9498 restoreAnchoringStylesRef.current = NOOP; 9499 isInitialRenderRef.current = true; 9500 committedDimensionsRef.current = null; 9501 liveDimensionsRef.current = null; 9502 return void 0; 9503 } 9504 if (!popupElement || !positionerElement) { 9505 return void 0; 9506 } 9507 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 9508 const observer = new ResizeObserver((entries) => { 9509 const entry = entries[0]; 9510 if (entry) { 9511 liveDimensionsRef.current = { 9512 width: Math.ceil(entry.borderBoxSize[0].inlineSize), 9513 height: Math.ceil(entry.borderBoxSize[0].blockSize) 9514 }; 9515 } 9516 }); 9517 observer.observe(popupElement); 9518 setPopupCssSize(popupElement, "auto"); 9519 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 9520 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 9521 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 9522 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 9523 "--available-width": "max-content", 9524 "--available-height": "max-content" 9525 }); 9526 function restoreMeasurementOverrides() { 9527 restorePopupPosition(); 9528 restorePopupTransform(); 9529 restorePositionerAvailableSize(); 9530 } 9531 function restoreMeasurementOverridesIncludingScale() { 9532 restoreMeasurementOverrides(); 9533 restorePopupScale(); 9534 } 9535 onMeasureLayout?.(); 9536 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 9537 setPositionerCssSize(positionerElement, "max-content"); 9538 const dimensions = getCssDimensions2(popupElement); 9539 committedDimensionsRef.current = dimensions; 9540 setPositionerCssSize(positionerElement, dimensions); 9541 restoreMeasurementOverridesIncludingScale(); 9542 onMeasureLayoutComplete?.(null, dimensions); 9543 isInitialRenderRef.current = false; 9544 return () => { 9545 observer.disconnect(); 9546 restoreAnchoringStylesRef.current(); 9547 restoreAnchoringStylesRef.current = NOOP; 9548 }; 9549 } 9550 setPopupCssSize(popupElement, "auto"); 9551 setPositionerCssSize(positionerElement, "max-content"); 9552 const previousDimensions = committedDimensionsRef.current ?? liveDimensionsRef.current; 9553 const newDimensions = getCssDimensions2(popupElement); 9554 committedDimensionsRef.current = newDimensions; 9555 if (!previousDimensions) { 9556 setPositionerCssSize(positionerElement, newDimensions); 9557 restoreMeasurementOverridesIncludingScale(); 9558 onMeasureLayoutComplete?.(null, newDimensions); 9559 return () => { 9560 observer.disconnect(); 9561 animationFrame.cancel(); 9562 restoreAnchoringStylesRef.current(); 9563 restoreAnchoringStylesRef.current = NOOP; 9564 }; 9565 } 9566 setPopupCssSize(popupElement, previousDimensions); 9567 restoreMeasurementOverridesIncludingScale(); 9568 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 9569 setPositionerCssSize(positionerElement, newDimensions); 9570 const abortController = new AbortController(); 9571 animationFrame.request(() => { 9572 setPopupCssSize(popupElement, newDimensions); 9573 runOnceAnimationsFinish(() => { 9574 popupElement.style.setProperty("--popup-width", "auto"); 9575 popupElement.style.setProperty("--popup-height", "auto"); 9576 }, abortController.signal); 9577 }); 9578 return () => { 9579 observer.disconnect(); 9580 abortController.abort(); 9581 animationFrame.cancel(); 9582 restoreAnchoringStylesRef.current(); 9583 restoreAnchoringStylesRef.current = NOOP; 9584 }; 9585 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, enabled, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 9586 } 9587 function overrideElementStyle(element, property, value) { 9588 const originalValue = element.style.getPropertyValue(property); 9589 element.style.setProperty(property, value); 9590 return () => { 9591 element.style.setProperty(property, originalValue); 9592 }; 9593 } 9594 function applyElementStyles(element, styles) { 9595 const restorers = []; 9596 for (const [key, value] of Object.entries(styles)) { 9597 restorers.push(overrideElementStyle(element, key, value)); 9598 } 9599 return restorers.length ? () => { 9600 restorers.forEach((restore) => restore()); 9601 } : NOOP; 9602 } 9603 function setPopupCssSize(popupElement, size4) { 9604 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 9605 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 9606 popupElement.style.setProperty("--popup-width", width); 9607 popupElement.style.setProperty("--popup-height", height); 9608 } 9609 function setPositionerCssSize(positionerElement, size4) { 9610 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 9611 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 9612 positionerElement.style.setProperty("--positioner-width", width); 9613 positionerElement.style.setProperty("--positioner-height", height); 9614 } 9615 9616 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js 9617 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 9618 function usePopupViewport(parameters) { 9619 const { 9620 store: store2, 9621 side, 9622 cssVars, 9623 children 9624 } = parameters; 9625 const direction = useDirection(); 9626 const activeTrigger = store2.useState("activeTriggerElement"); 9627 const activeTriggerId = store2.useState("activeTriggerId"); 9628 const open = store2.useState("open"); 9629 const payload = store2.useState("payload"); 9630 const mounted = store2.useState("mounted"); 9631 const popupElement = store2.useState("popupElement"); 9632 const positionerElement = store2.useState("positionerElement"); 9633 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); 9634 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 9635 const capturedNodeRef = React42.useRef(null); 9636 const [previousContentNode, setPreviousContentNode] = React42.useState(null); 9637 const [newTriggerOffset, setNewTriggerOffset] = React42.useState(null); 9638 const currentContainerRef = React42.useRef(null); 9639 const previousContainerRef = React42.useRef(null); 9640 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); 9641 const cleanupFrame = useAnimationFrame(); 9642 const [previousContentDimensions, setPreviousContentDimensions] = React42.useState(null); 9643 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React42.useState(false); 9644 useIsoLayoutEffect(() => { 9645 store2.set("hasViewport", true); 9646 return () => { 9647 store2.set("hasViewport", false); 9648 }; 9649 }, [store2]); 9650 const handleMeasureLayout = useStableCallback(() => { 9651 currentContainerRef.current?.style.setProperty("animation", "none"); 9652 currentContainerRef.current?.style.setProperty("transition", "none"); 9653 previousContainerRef.current?.style.setProperty("display", "none"); 9654 }); 9655 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 9656 currentContainerRef.current?.style.removeProperty("animation"); 9657 currentContainerRef.current?.style.removeProperty("transition"); 9658 previousContainerRef.current?.style.removeProperty("display"); 9659 if (previousDimensions) { 9660 setPreviousContentDimensions(previousDimensions); 9661 } 9662 }); 9663 const lastHandledTriggerRef = React42.useRef(null); 9664 useIsoLayoutEffect(() => { 9665 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 9666 setPreviousContentNode(capturedNodeRef.current); 9667 setShowStartingStyleAttribute(true); 9668 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 9669 setNewTriggerOffset(offset4); 9670 cleanupFrame.request(() => { 9671 ReactDOM5.flushSync(() => { 9672 setShowStartingStyleAttribute(false); 9673 }); 9674 onAnimationsFinished(() => { 9675 setPreviousContentNode(null); 9676 setPreviousContentDimensions(null); 9677 capturedNodeRef.current = null; 9678 }); 9679 }); 9680 lastHandledTriggerRef.current = activeTrigger; 9681 } 9682 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); 9683 useIsoLayoutEffect(() => { 9684 const source = currentContainerRef.current; 9685 if (!source) { 9686 return; 9687 } 9688 const wrapper = ownerDocument(source).createElement("div"); 9689 for (const child of Array.from(source.childNodes)) { 9690 wrapper.appendChild(child.cloneNode(true)); 9691 } 9692 capturedNodeRef.current = wrapper; 9693 }); 9694 const isTransitioning = previousContentNode != null; 9695 let childrenToRender; 9696 if (!isTransitioning) { 9697 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 9698 "data-current": true, 9699 ref: currentContainerRef, 9700 children 9701 }, currentContentKey); 9702 } else { 9703 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React42.Fragment, { 9704 children: [/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 9705 "data-previous": true, 9706 inert: inertValue(true), 9707 ref: previousContainerRef, 9708 style: { 9709 ...previousContentDimensions ? { 9710 [cssVars.popupWidth]: `$previousContentDimensions.width}px`, 9711 [cssVars.popupHeight]: `$previousContentDimensions.height}px` 9712 } : null, 9713 position: "absolute" 9714 }, 9715 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 9716 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 9717 "data-current": true, 9718 ref: currentContainerRef, 9719 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 9720 children 9721 }, currentContentKey)] 9722 }); 9723 } 9724 useIsoLayoutEffect(() => { 9725 const container = previousContainerRef.current; 9726 if (!container || !previousContentNode) { 9727 return; 9728 } 9729 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 9730 }, [previousContentNode]); 9731 usePopupAutoResize({ 9732 popupElement, 9733 positionerElement, 9734 mounted, 9735 content: payload, 9736 onMeasureLayout: handleMeasureLayout, 9737 onMeasureLayoutComplete: handleMeasureLayoutComplete, 9738 side, 9739 direction 9740 }); 9741 const state = { 9742 activationDirection: getActivationDirection(newTriggerOffset), 9743 transitioning: isTransitioning 9744 }; 9745 return { 9746 children: childrenToRender, 9747 state 9748 }; 9749 } 9750 function getActivationDirection(offset4) { 9751 if (!offset4) { 9752 return void 0; 9753 } 9754 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 9755 } 9756 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 9757 if (value > tolerance) { 9758 return positiveLabel; 9759 } 9760 if (value < -tolerance) { 9761 return negativeLabel; 9762 } 9763 return ""; 9764 } 9765 function calculateRelativePosition(from, to2) { 9766 const fromRect = from.getBoundingClientRect(); 9767 const toRect = to2.getBoundingClientRect(); 9768 const fromCenter = { 9769 x: fromRect.left + fromRect.width / 2, 9770 y: fromRect.top + fromRect.height / 2 9771 }; 9772 const toCenter = { 9773 x: toRect.left + toRect.width / 2, 9774 y: toRect.top + toRect.height / 2 9775 }; 9776 return { 9777 horizontal: toCenter.x - fromCenter.x, 9778 vertical: toCenter.y - fromCenter.y 9779 }; 9780 } 9781 function usePopupContentKey(activeTriggerId, payload) { 9782 const [contentKey, setContentKey] = React42.useState(0); 9783 const previousActiveTriggerIdRef = React42.useRef(activeTriggerId); 9784 const previousPayloadRef = React42.useRef(payload); 9785 const pendingPayloadUpdateRef = React42.useRef(false); 9786 useIsoLayoutEffect(() => { 9787 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 9788 const previousPayload = previousPayloadRef.current; 9789 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 9790 const payloadChanged = payload !== previousPayload; 9791 if (triggerIdChanged) { 9792 setContentKey((value) => value + 1); 9793 pendingPayloadUpdateRef.current = !payloadChanged; 9794 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 9795 setContentKey((value) => value + 1); 9796 pendingPayloadUpdateRef.current = false; 9797 } 9798 previousActiveTriggerIdRef.current = activeTriggerId; 9799 previousPayloadRef.current = payload; 9800 }, [activeTriggerId, payload]); 9801 return `$activeTriggerId ?? "current"}-$contentKey}`; 9802 } 9803 9804 // node_modules/@base-ui/react/esm/utils/FloatingPortalLite.js 9805 var React43 = __toESM(require_react(), 1); 9806 var ReactDOM6 = __toESM(require_react_dom(), 1); 9807 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 9808 var FloatingPortalLite = /* @__PURE__ */ React43.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 9809 const { 9810 children, 9811 container, 9812 className, 9813 render: render4, 9814 style, 9815 ...elementProps 9816 } = componentProps; 9817 const { 9818 portalNode, 9819 portalSubtree 9820 } = useFloatingPortalNode({ 9821 container, 9822 ref: forwardedRef, 9823 componentProps, 9824 elementProps 9825 }); 9826 if (!portalSubtree && !portalNode) { 9827 return null; 9828 } 9829 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React43.Fragment, { 9830 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM6.createPortal(children, portalNode)] 9831 }); 9832 }); 9833 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 9834 9835 // node_modules/@base-ui/react/esm/tooltip/index.parts.js 9836 var index_parts_exports2 = {}; 9837 __export(index_parts_exports2, { 9838 Arrow: () => TooltipArrow, 9839 Handle: () => TooltipHandle, 9840 Popup: () => TooltipPopup, 9841 Portal: () => TooltipPortal, 9842 Positioner: () => TooltipPositioner, 9843 Provider: () => TooltipProvider, 9844 Root: () => TooltipRoot, 9845 Trigger: () => TooltipTrigger, 9846 Viewport: () => TooltipViewport, 9847 createHandle: () => createTooltipHandle 9848 }); 9849 9850 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js 9851 var React46 = __toESM(require_react(), 1); 9852 9853 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRootContext.js 9854 var React44 = __toESM(require_react(), 1); 9855 var TooltipRootContext = /* @__PURE__ */ React44.createContext(void 0); 9856 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 9857 function useTooltipRootContext(optional) { 9858 const context = React44.useContext(TooltipRootContext); 9859 if (context === void 0 && !optional) { 9860 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 9861 } 9862 return context; 9863 } 9864 9865 // node_modules/@base-ui/react/esm/tooltip/store/TooltipStore.js 9866 var React45 = __toESM(require_react(), 1); 9867 var ReactDOM7 = __toESM(require_react_dom(), 1); 9868 var selectors2 = { 9869 ...popupStoreSelectors, 9870 disabled: createSelector2((state) => state.disabled), 9871 instantType: createSelector2((state) => state.instantType), 9872 isInstantPhase: createSelector2((state) => state.isInstantPhase), 9873 trackCursorAxis: createSelector2((state) => state.trackCursorAxis), 9874 disableHoverablePopup: createSelector2((state) => state.disableHoverablePopup), 9875 lastOpenChangeReason: createSelector2((state) => state.openChangeReason), 9876 closeOnClick: createSelector2((state) => state.closeOnClick), 9877 closeDelay: createSelector2((state) => state.closeDelay), 9878 hasViewport: createSelector2((state) => state.hasViewport) 9879 }; 9880 var TooltipStore = class _TooltipStore extends ReactStore { 9881 constructor(initialState, floatingId, nested = false) { 9882 const triggerElements = new PopupTriggerMap(); 9883 const state = { 9884 ...createInitialState(), 9885 ...initialState 9886 }; 9887 state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested); 9888 super(state, { 9889 popupRef: /* @__PURE__ */ React45.createRef(), 9890 onOpenChange: void 0, 9891 onOpenChangeComplete: void 0, 9892 triggerElements 9893 }, selectors2); 9894 } 9895 setOpen = (nextOpen, eventDetails) => { 9896 const reason = eventDetails.reason; 9897 const isHover = reason === reason_parts_exports.triggerHover; 9898 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 9899 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 9900 eventDetails.preventUnmountOnClose = () => { 9901 this.set("preventUnmountingOnClose", true); 9902 }; 9903 this.context.onOpenChange?.(nextOpen, eventDetails); 9904 if (eventDetails.isCanceled) { 9905 return; 9906 } 9907 this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 9908 const changeState = () => { 9909 const updatedState = { 9910 open: nextOpen, 9911 openChangeReason: reason 9912 }; 9913 if (isFocusOpen) { 9914 updatedState.instantType = "focus"; 9915 } else if (isDismissClose) { 9916 updatedState.instantType = "dismiss"; 9917 } else if (reason === reason_parts_exports.triggerHover) { 9918 updatedState.instantType = void 0; 9919 } 9920 setOpenTriggerState(updatedState, nextOpen, eventDetails.trigger); 9921 this.update(updatedState); 9922 }; 9923 if (isHover) { 9924 ReactDOM7.flushSync(changeState); 9925 } else { 9926 changeState(); 9927 } 9928 }; 9929 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 9930 cancelPendingOpen(event) { 9931 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 9932 } 9933 static useStore(externalStore, initialState) { 9934 const store2 = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store; 9935 return store2; 9936 } 9937 }; 9938 function createInitialState() { 9939 return { 9940 ...createInitialPopupStoreState(), 9941 disabled: false, 9942 instantType: void 0, 9943 isInstantPhase: false, 9944 trackCursorAxis: "none", 9945 disableHoverablePopup: false, 9946 openChangeReason: null, 9947 closeOnClick: true, 9948 closeDelay: 0, 9949 hasViewport: false 9950 }; 9951 } 9952 9953 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js 9954 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 9955 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 9956 const { 9957 disabled: disabled2 = false, 9958 defaultOpen = false, 9959 open: openProp, 9960 disableHoverablePopup = false, 9961 trackCursorAxis = "none", 9962 actionsRef, 9963 onOpenChange, 9964 onOpenChangeComplete, 9965 handle, 9966 triggerId: triggerIdProp, 9967 defaultTriggerId: defaultTriggerIdProp = null, 9968 children 9969 } = props; 9970 const store2 = TooltipStore.useStore(handle?.store, { 9971 open: defaultOpen, 9972 openProp, 9973 activeTriggerId: defaultTriggerIdProp, 9974 triggerIdProp 9975 }); 9976 useOnFirstRender(() => { 9977 if (openProp === void 0 && store2.state.open === false && defaultOpen === true) { 9978 store2.update({ 9979 open: true, 9980 activeTriggerId: defaultTriggerIdProp 9981 }); 9982 } 9983 }); 9984 store2.useControlledProp("openProp", openProp); 9985 store2.useControlledProp("triggerIdProp", triggerIdProp); 9986 store2.useContextCallback("onOpenChange", onOpenChange); 9987 store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 9988 const openState = store2.useState("open"); 9989 const open = !disabled2 && openState; 9990 const activeTriggerId = store2.useState("activeTriggerId"); 9991 const mounted = store2.useState("mounted"); 9992 const payload = store2.useState("payload"); 9993 store2.useSyncedValues({ 9994 trackCursorAxis, 9995 disableHoverablePopup 9996 }); 9997 store2.useSyncedValue("disabled", disabled2); 9998 useImplicitActiveTrigger(store2); 9999 const { 10000 forceUnmount, 10001 transitionStatus 10002 } = useOpenStateTransitions(open, store2); 10003 const isInstantPhase = store2.useState("isInstantPhase"); 10004 const instantType = store2.useState("instantType"); 10005 const lastOpenChangeReason = store2.useState("lastOpenChangeReason"); 10006 const previousInstantTypeRef = React46.useRef(null); 10007 useIsoLayoutEffect(() => { 10008 if (openState && disabled2) { 10009 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 10010 } 10011 }, [openState, disabled2, store2]); 10012 useIsoLayoutEffect(() => { 10013 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 10014 if (instantType !== "delay") { 10015 previousInstantTypeRef.current = instantType; 10016 } 10017 store2.set("instantType", "delay"); 10018 } else if (previousInstantTypeRef.current !== null) { 10019 store2.set("instantType", previousInstantTypeRef.current); 10020 previousInstantTypeRef.current = null; 10021 } 10022 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]); 10023 useIsoLayoutEffect(() => { 10024 if (open) { 10025 if (activeTriggerId == null) { 10026 store2.set("payload", void 0); 10027 } 10028 } 10029 }, [store2, activeTriggerId, open]); 10030 const handleImperativeClose = React46.useCallback(() => { 10031 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 10032 }, [store2]); 10033 React46.useImperativeHandle(actionsRef, () => ({ 10034 unmount: forceUnmount, 10035 close: handleImperativeClose 10036 }), [forceUnmount, handleImperativeClose]); 10037 const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none"; 10038 return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(TooltipRootContext.Provider, { 10039 value: store2, 10040 children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipInteractions, { 10041 store: store2, 10042 disabled: disabled2, 10043 trackCursorAxis 10044 }), typeof children === "function" ? children({ 10045 payload 10046 }) : children] 10047 }); 10048 }); 10049 if (true) TooltipRoot.displayName = "TooltipRoot"; 10050 function TooltipInteractions({ 10051 store: store2, 10052 disabled: disabled2, 10053 trackCursorAxis 10054 }) { 10055 const floatingRootContext = store2.useState("floatingRootContext"); 10056 const dismiss = useDismiss(floatingRootContext, { 10057 enabled: !disabled2, 10058 referencePress: () => store2.select("closeOnClick") 10059 }); 10060 const clientPoint = useClientPoint(floatingRootContext, { 10061 enabled: !disabled2 && trackCursorAxis !== "none", 10062 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 10063 }); 10064 const activeTriggerProps = React46.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 10065 const inactiveTriggerProps = React46.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]); 10066 const popupProps = React46.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]); 10067 usePopupInteractionProps(store2, { 10068 activeTriggerProps, 10069 inactiveTriggerProps, 10070 popupProps 10071 }); 10072 return null; 10073 } 10074 10075 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js 10076 var React48 = __toESM(require_react(), 1); 10077 10078 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProviderContext.js 10079 var React47 = __toESM(require_react(), 1); 10080 var TooltipProviderContext = /* @__PURE__ */ React47.createContext(void 0); 10081 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 10082 function useTooltipProviderContext() { 10083 return React47.useContext(TooltipProviderContext); 10084 } 10085 10086 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTriggerDataAttributes.js 10087 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { 10088 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; 10089 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; 10090 return TooltipTriggerDataAttributes2; 10091 })({}); 10092 10093 // node_modules/@base-ui/react/esm/tooltip/utils/constants.js 10094 var OPEN_DELAY = 600; 10095 10096 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js 10097 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 10098 function getTargetElement(event) { 10099 if ("composedPath" in event) { 10100 const path = event.composedPath(); 10101 for (let i2 = 0; i2 < path.length; i2 += 1) { 10102 const element = path[i2]; 10103 if (isElement(element)) { 10104 return element; 10105 } 10106 } 10107 } 10108 const target = event.target; 10109 if (isElement(target)) { 10110 return target; 10111 } 10112 return null; 10113 } 10114 function closestEnabledTooltipTrigger(element) { 10115 let current = element; 10116 while (current) { 10117 if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) { 10118 return current; 10119 } 10120 const parentElement = current.parentElement; 10121 if (parentElement) { 10122 current = parentElement; 10123 continue; 10124 } 10125 const root = current.getRootNode(); 10126 current = "host" in root && isElement(root.host) ? root.host : null; 10127 } 10128 return null; 10129 } 10130 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 10131 const { 10132 render: render4, 10133 className, 10134 style, 10135 handle, 10136 payload, 10137 disabled: disabledProp, 10138 delay, 10139 closeOnClick = true, 10140 closeDelay, 10141 id: idProp, 10142 ...elementProps 10143 } = componentProps; 10144 const rootContext = useTooltipRootContext(true); 10145 const store2 = handle?.store ?? rootContext; 10146 if (!store2) { 10147 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)); 10148 } 10149 const thisTriggerId = useBaseUiId(idProp); 10150 const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId); 10151 const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId); 10152 const floatingRootContext = store2.useState("floatingRootContext"); 10153 const triggerElementRef = React48.useRef(null); 10154 const delayWithDefault = delay ?? OPEN_DELAY; 10155 const closeDelayWithDefault = closeDelay ?? 0; 10156 const { 10157 registerTrigger, 10158 isMountedByThisTrigger 10159 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, { 10160 payload, 10161 closeOnClick, 10162 closeDelay: closeDelayWithDefault 10163 }); 10164 const providerContext = useTooltipProviderContext(); 10165 const { 10166 delayRef, 10167 isInstantPhase, 10168 hasProvider 10169 } = useDelayGroup(floatingRootContext, { 10170 open: isOpenedByThisTrigger 10171 }); 10172 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 10173 store2.useSyncedValue("isInstantPhase", isInstantPhase); 10174 const rootDisabled = store2.useState("disabled"); 10175 const disabled2 = disabledProp ?? rootDisabled; 10176 const disabledRef = useValueAsRef(disabled2); 10177 const trackCursorAxis = store2.useState("trackCursorAxis"); 10178 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 10179 const isNestedTriggerHoveredRef = React48.useRef(false); 10180 const nestedTriggerOpenTimeout = useTimeout(); 10181 const pointerTypeRef = React48.useRef(void 0); 10182 function getOpenDelay() { 10183 const providerDelay = providerContext?.delay; 10184 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; 10185 let computedOpenDelay = delayWithDefault; 10186 if (hasProvider) { 10187 if (groupOpenValue !== 0) { 10188 computedOpenDelay = delay ?? providerDelay ?? delayWithDefault; 10189 } else { 10190 computedOpenDelay = 0; 10191 } 10192 } 10193 return computedOpenDelay; 10194 } 10195 function isEnabledNestedTriggerTarget(target) { 10196 const triggerEl = triggerElementRef.current; 10197 if (!triggerEl || !target) { 10198 return false; 10199 } 10200 const nearestTrigger = closestEnabledTooltipTrigger(target); 10201 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 10202 } 10203 function detectNestedTriggerHover(target) { 10204 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 10205 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 10206 if (nestedTriggerHovered) { 10207 hoverInteraction.openChangeTimeout.clear(); 10208 hoverInteraction.restTimeout.clear(); 10209 hoverInteraction.restTimeoutPending = false; 10210 nestedTriggerOpenTimeout.clear(); 10211 } 10212 return nestedTriggerHovered; 10213 } 10214 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 10215 enabled: !disabled2, 10216 mouseOnly: true, 10217 move: false, 10218 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 10219 restMs: getOpenDelay, 10220 delay() { 10221 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; 10222 let computedCloseDelay = closeDelayWithDefault; 10223 if (closeDelay == null && hasProvider) { 10224 computedCloseDelay = closeValue; 10225 } 10226 return { 10227 close: computedCloseDelay 10228 }; 10229 }, 10230 triggerElementRef, 10231 isActiveTrigger: isTriggerActive, 10232 isClosing: () => store2.select("transitionStatus") === "ending", 10233 shouldOpen() { 10234 return !isNestedTriggerHoveredRef.current; 10235 } 10236 }); 10237 const focusProps = useFocus(floatingRootContext, { 10238 enabled: !disabled2 10239 }).reference; 10240 const handleNestedTriggerHover = (event) => { 10241 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 10242 const target = getTargetElement(event); 10243 const nestedTriggerHovered = detectNestedTriggerHover(target); 10244 const triggerEl = triggerElementRef.current; 10245 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 10246 if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 10247 store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 10248 return; 10249 } 10250 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 10251 isMouseLikePointerType(pointerTypeRef.current)) { 10252 const open = () => { 10253 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) { 10254 store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 10255 } 10256 }; 10257 const openDelay = getOpenDelay(); 10258 if (openDelay === 0) { 10259 nestedTriggerOpenTimeout.clear(); 10260 open(); 10261 } else { 10262 nestedTriggerOpenTimeout.start(openDelay, open); 10263 } 10264 } 10265 }; 10266 const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger); 10267 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; 10268 const state = { 10269 open: isOpenedByThisTrigger 10270 }; 10271 const element = useRenderElement("button", componentProps, { 10272 state, 10273 ref: [forwardedRef, registerTrigger, triggerElementRef], 10274 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { 10275 onMouseOver(event) { 10276 handleNestedTriggerHover(event.nativeEvent); 10277 }, 10278 onFocus(event) { 10279 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 10280 event.preventBaseUIHandler(); 10281 } 10282 }, 10283 onMouseLeave() { 10284 isNestedTriggerHoveredRef.current = false; 10285 nestedTriggerOpenTimeout.clear(); 10286 pointerTypeRef.current = void 0; 10287 }, 10288 onPointerEnter(event) { 10289 pointerTypeRef.current = event.pointerType; 10290 }, 10291 onPointerDown(event) { 10292 pointerTypeRef.current = event.pointerType; 10293 store2.set("closeOnClick", closeOnClick); 10294 if (closeOnClick && !store2.select("open")) { 10295 store2.cancelPendingOpen(event.nativeEvent); 10296 } 10297 }, 10298 onClick(event) { 10299 if (closeOnClick && !store2.select("open")) { 10300 store2.cancelPendingOpen(event.nativeEvent); 10301 } 10302 }, 10303 id: thisTriggerId, 10304 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0, 10305 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 10306 }, elementProps], 10307 stateAttributesMapping: triggerOpenStateMapping2 10308 }); 10309 return element; 10310 }); 10311 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 10312 10313 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js 10314 var React50 = __toESM(require_react(), 1); 10315 10316 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortalContext.js 10317 var React49 = __toESM(require_react(), 1); 10318 var TooltipPortalContext = /* @__PURE__ */ React49.createContext(void 0); 10319 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 10320 function useTooltipPortalContext() { 10321 const value = React49.useContext(TooltipPortalContext); 10322 if (value === void 0) { 10323 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 10324 } 10325 return value; 10326 } 10327 10328 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js 10329 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 10330 var TooltipPortal = /* @__PURE__ */ React50.forwardRef(function TooltipPortal2(props, forwardedRef) { 10331 const { 10332 keepMounted = false, 10333 ...portalProps 10334 } = props; 10335 const store2 = useTooltipRootContext(); 10336 const mounted = store2.useState("mounted"); 10337 const shouldRender = mounted || keepMounted; 10338 if (!shouldRender) { 10339 return null; 10340 } 10341 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPortalContext.Provider, { 10342 value: keepMounted, 10343 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FloatingPortalLite, { 10344 ref: forwardedRef, 10345 ...portalProps 10346 }) 10347 }); 10348 }); 10349 if (true) TooltipPortal.displayName = "TooltipPortal"; 10350 10351 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js 10352 var React52 = __toESM(require_react(), 1); 10353 10354 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositionerContext.js 10355 var React51 = __toESM(require_react(), 1); 10356 var TooltipPositionerContext = /* @__PURE__ */ React51.createContext(void 0); 10357 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 10358 function useTooltipPositionerContext() { 10359 const context = React51.useContext(TooltipPositionerContext); 10360 if (context === void 0) { 10361 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 10362 } 10363 return context; 10364 } 10365 10366 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js 10367 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 10368 var TooltipPositioner = /* @__PURE__ */ React52.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 10369 const { 10370 render: render4, 10371 className, 10372 anchor, 10373 positionMethod = "absolute", 10374 side = "top", 10375 align = "center", 10376 sideOffset = 0, 10377 alignOffset = 0, 10378 collisionBoundary = "clipping-ancestors", 10379 collisionPadding = 5, 10380 arrowPadding = 5, 10381 sticky = false, 10382 disableAnchorTracking = false, 10383 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 10384 style, 10385 ...elementProps 10386 } = componentProps; 10387 const store2 = useTooltipRootContext(); 10388 const keepMounted = useTooltipPortalContext(); 10389 const open = store2.useState("open"); 10390 const mounted = store2.useState("mounted"); 10391 const trackCursorAxis = store2.useState("trackCursorAxis"); 10392 const disableHoverablePopup = store2.useState("disableHoverablePopup"); 10393 const floatingRootContext = store2.useState("floatingRootContext"); 10394 const instantType = store2.useState("instantType"); 10395 const transitionStatus = store2.useState("transitionStatus"); 10396 const hasViewport = store2.useState("hasViewport"); 10397 const positioning = useAnchorPositioning({ 10398 anchor, 10399 positionMethod, 10400 floatingRootContext, 10401 mounted, 10402 side, 10403 sideOffset, 10404 align, 10405 alignOffset, 10406 collisionBoundary, 10407 collisionPadding, 10408 sticky, 10409 arrowPadding, 10410 disableAnchorTracking, 10411 keepMounted, 10412 collisionAvoidance, 10413 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 10414 }); 10415 const state = React52.useMemo(() => ({ 10416 open, 10417 side: positioning.side, 10418 align: positioning.align, 10419 anchorHidden: positioning.anchorHidden, 10420 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 10421 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 10422 const element = usePositioner(componentProps, state, { 10423 styles: positioning.positionerStyles, 10424 transitionStatus, 10425 props: elementProps, 10426 refs: [forwardedRef, store2.useStateSetter("positionerElement")], 10427 hidden: !mounted, 10428 inert: !open || trackCursorAxis === "both" || disableHoverablePopup 10429 }); 10430 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipPositionerContext.Provider, { 10431 value: positioning, 10432 children: element 10433 }); 10434 }); 10435 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 10436 10437 // node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js 10438 var React53 = __toESM(require_react(), 1); 10439 var stateAttributesMapping2 = { 10440 ...popupStateMapping, 10441 ...transitionStatusMapping 10442 }; 10443 var TooltipPopup = /* @__PURE__ */ React53.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 10444 const { 10445 render: render4, 10446 className, 10447 style, 10448 ...elementProps 10449 } = componentProps; 10450 const store2 = useTooltipRootContext(); 10451 const { 10452 side, 10453 align 10454 } = useTooltipPositionerContext(); 10455 const open = store2.useState("open"); 10456 const instantType = store2.useState("instantType"); 10457 const transitionStatus = store2.useState("transitionStatus"); 10458 const popupProps = store2.useState("popupProps"); 10459 const floatingContext = store2.useState("floatingRootContext"); 10460 const disabled2 = store2.useState("disabled"); 10461 const closeDelay = store2.useState("closeDelay"); 10462 useOpenChangeComplete({ 10463 open, 10464 ref: store2.context.popupRef, 10465 onComplete() { 10466 if (open) { 10467 store2.context.onOpenChangeComplete?.(true); 10468 } 10469 } 10470 }); 10471 useHoverFloatingInteraction(floatingContext, { 10472 enabled: !disabled2, 10473 closeDelay 10474 }); 10475 const setPopupElement = store2.useStateSetter("popupElement"); 10476 const state = { 10477 open, 10478 side, 10479 align, 10480 instant: instantType, 10481 transitionStatus 10482 }; 10483 const element = useRenderElement("div", componentProps, { 10484 state, 10485 ref: [forwardedRef, store2.context.popupRef, setPopupElement], 10486 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 10487 stateAttributesMapping: stateAttributesMapping2 10488 }); 10489 return element; 10490 }); 10491 if (true) TooltipPopup.displayName = "TooltipPopup"; 10492 10493 // node_modules/@base-ui/react/esm/tooltip/arrow/TooltipArrow.js 10494 var React54 = __toESM(require_react(), 1); 10495 var TooltipArrow = /* @__PURE__ */ React54.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 10496 const { 10497 render: render4, 10498 className, 10499 style, 10500 ...elementProps 10501 } = componentProps; 10502 const store2 = useTooltipRootContext(); 10503 const { 10504 arrowRef, 10505 side, 10506 align, 10507 arrowUncentered, 10508 arrowStyles 10509 } = useTooltipPositionerContext(); 10510 const open = store2.useState("open"); 10511 const instantType = store2.useState("instantType"); 10512 const state = { 10513 open, 10514 side, 10515 align, 10516 uncentered: arrowUncentered, 10517 instant: instantType 10518 }; 10519 const element = useRenderElement("div", componentProps, { 10520 state, 10521 ref: [forwardedRef, arrowRef], 10522 props: [{ 10523 style: arrowStyles, 10524 "aria-hidden": true 10525 }, elementProps], 10526 stateAttributesMapping: popupStateMapping 10527 }); 10528 return element; 10529 }); 10530 if (true) TooltipArrow.displayName = "TooltipArrow"; 10531 10532 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js 10533 var React55 = __toESM(require_react(), 1); 10534 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 10535 var TooltipProvider = function TooltipProvider2(props) { 10536 const { 10537 delay, 10538 closeDelay, 10539 timeout = 400 10540 } = props; 10541 const contextValue = React55.useMemo(() => ({ 10542 delay, 10543 closeDelay 10544 }), [delay, closeDelay]); 10545 const delayValue = React55.useMemo(() => ({ 10546 open: delay, 10547 close: closeDelay 10548 }), [delay, closeDelay]); 10549 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipProviderContext.Provider, { 10550 value: contextValue, 10551 children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FloatingDelayGroup, { 10552 delay: delayValue, 10553 timeoutMs: timeout, 10554 children: props.children 10555 }) 10556 }); 10557 }; 10558 if (true) TooltipProvider.displayName = "TooltipProvider"; 10559 10560 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js 10561 var React56 = __toESM(require_react(), 1); 10562 10563 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewportCssVars.js 10564 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { 10565 TooltipViewportCssVars2["popupWidth"] = "--popup-width"; 10566 TooltipViewportCssVars2["popupHeight"] = "--popup-height"; 10567 return TooltipViewportCssVars2; 10568 })({}); 10569 10570 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js 10571 var stateAttributesMapping3 = { 10572 activationDirection: (value) => value ? { 10573 "data-activation-direction": value 10574 } : null 10575 }; 10576 var TooltipViewport = /* @__PURE__ */ React56.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 10577 const { 10578 render: render4, 10579 className, 10580 style, 10581 children, 10582 ...elementProps 10583 } = componentProps; 10584 const store2 = useTooltipRootContext(); 10585 const positioner = useTooltipPositionerContext(); 10586 const instantType = store2.useState("instantType"); 10587 const { 10588 children: childrenToRender, 10589 state: viewportState 10590 } = usePopupViewport({ 10591 store: store2, 10592 side: positioner.side, 10593 cssVars: TooltipViewportCssVars, 10594 children 10595 }); 10596 const state = { 10597 activationDirection: viewportState.activationDirection, 10598 transitioning: viewportState.transitioning, 10599 instant: instantType 10600 }; 10601 return useRenderElement("div", componentProps, { 10602 state, 10603 ref: forwardedRef, 10604 props: [elementProps, { 10605 children: childrenToRender 10606 }], 10607 stateAttributesMapping: stateAttributesMapping3 10608 }); 10609 }); 10610 if (true) TooltipViewport.displayName = "TooltipViewport"; 10611 10612 // node_modules/@base-ui/react/esm/tooltip/store/TooltipHandle.js 10613 var TooltipHandle = class { 10614 /** 10615 * Internal store holding the tooltip state. 10616 * @internal 10617 */ 10618 constructor() { 10619 this.store = new TooltipStore(); 10620 } 10621 /** 10622 * Opens the tooltip and associates it with the trigger with the given ID. 10623 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. 10624 * 10625 * This method should only be called in an event handler or an effect (not during rendering). 10626 * 10627 * @param triggerId ID of the trigger to associate with the tooltip. 10628 */ 10629 open(triggerId) { 10630 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 10631 if (triggerId && !triggerElement) { 10632 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId)); 10633 } 10634 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 10635 } 10636 /** 10637 * Closes the tooltip. 10638 */ 10639 close() { 10640 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 10641 } 10642 /** 10643 * Indicates whether the tooltip is currently open. 10644 */ 10645 get isOpen() { 10646 return this.store.select("open"); 10647 } 10648 }; 10649 function createTooltipHandle() { 10650 return new TooltipHandle(); 10651 } 10652 10653 // node_modules/@base-ui/react/esm/use-render/useRender.js 10654 function useRender(params) { 10655 return useRenderElement(params.defaultTagName ?? "div", params, params); 10656 } 10657 10658 // packages/ui/build-module/text/text.mjs 10659 var import_element10 = __toESM(require_element(), 1); 10660 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 10661 function getRuntime() { 10662 const globalScope = globalThis; 10663 if (globalScope.__wpStyleRuntime) { 10664 return globalScope.__wpStyleRuntime; 10665 } 10666 globalScope.__wpStyleRuntime = { 10667 documents: /* @__PURE__ */ new Map(), 10668 styles: /* @__PURE__ */ new Map(), 10669 injectedStyles: /* @__PURE__ */ new WeakMap() 10670 }; 10671 if (typeof document !== "undefined") { 10672 registerDocument(document); 10673 } 10674 return globalScope.__wpStyleRuntime; 10675 } 10676 function documentContainsStyleHash(targetDocument, hash) { 10677 if (!targetDocument.head) { 10678 return false; 10679 } 10680 for (const style of targetDocument.head.querySelectorAll( 10681 `style[$STYLE_HASH_ATTRIBUTE}]` 10682 )) { 10683 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 10684 return true; 10685 } 10686 } 10687 return false; 10688 } 10689 function injectStyle(targetDocument, hash, css) { 10690 if (!targetDocument.head) { 10691 return; 10692 } 10693 const runtime = getRuntime(); 10694 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10695 if (!injectedStyles) { 10696 injectedStyles = /* @__PURE__ */ new Set(); 10697 runtime.injectedStyles.set(targetDocument, injectedStyles); 10698 } 10699 if (injectedStyles.has(hash)) { 10700 return; 10701 } 10702 if (documentContainsStyleHash(targetDocument, hash)) { 10703 injectedStyles.add(hash); 10704 return; 10705 } 10706 const style = targetDocument.createElement("style"); 10707 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 10708 style.appendChild(targetDocument.createTextNode(css)); 10709 targetDocument.head.appendChild(style); 10710 injectedStyles.add(hash); 10711 } 10712 function registerDocument(targetDocument) { 10713 const runtime = getRuntime(); 10714 runtime.documents.set( 10715 targetDocument, 10716 (runtime.documents.get(targetDocument) ?? 0) + 1 10717 ); 10718 for (const [hash, css] of runtime.styles) { 10719 injectStyle(targetDocument, hash, css); 10720 } 10721 return () => { 10722 const count = runtime.documents.get(targetDocument); 10723 if (count === void 0) { 10724 return; 10725 } 10726 if (count <= 1) { 10727 runtime.documents.delete(targetDocument); 10728 return; 10729 } 10730 runtime.documents.set(targetDocument, count - 1); 10731 }; 10732 } 10733 function registerStyle(hash, css) { 10734 const runtime = getRuntime(); 10735 runtime.styles.set(hash, css); 10736 for (const targetDocument of runtime.documents.keys()) { 10737 injectStyle(targetDocument, hash, css); 10738 } 10739 } 10740 if (typeof process === "undefined" || true) { 10741 registerStyle("0c5702ddca", '@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-medium,499);--_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-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_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-medium,499);--_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-medium,499);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-medium,499);--_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-medium,499);--_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-medium,499);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-regular,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-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,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-regular,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-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,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)}}}'); 10742 } 10743 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" }; 10744 if (typeof process === "undefined" || true) { 10745 registerStyle("d5c1b736fd", "._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-fg-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-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));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)}"); 10746 } 10747 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" }; 10748 var Text = (0, import_element10.forwardRef)(function Text2({ variant = "body-md", render: render4, className, ...props }, ref) { 10749 const element = useRender({ 10750 render: render4, 10751 defaultTagName: "span", 10752 ref, 10753 props: mergeProps(props, { 10754 className: clsx_default( 10755 style_default.text, 10756 global_css_defense_default.heading, 10757 global_css_defense_default.p, 10758 style_default[variant], 10759 className 10760 ) 10761 }) 10762 }); 10763 return element; 10764 }); 10765 10766 // packages/ui/build-module/badge/badge.mjs 10767 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 10768 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 10769 function getRuntime2() { 10770 const globalScope = globalThis; 10771 if (globalScope.__wpStyleRuntime) { 10772 return globalScope.__wpStyleRuntime; 10773 } 10774 globalScope.__wpStyleRuntime = { 10775 documents: /* @__PURE__ */ new Map(), 10776 styles: /* @__PURE__ */ new Map(), 10777 injectedStyles: /* @__PURE__ */ new WeakMap() 10778 }; 10779 if (typeof document !== "undefined") { 10780 registerDocument2(document); 10781 } 10782 return globalScope.__wpStyleRuntime; 10783 } 10784 function documentContainsStyleHash2(targetDocument, hash) { 10785 if (!targetDocument.head) { 10786 return false; 10787 } 10788 for (const style of targetDocument.head.querySelectorAll( 10789 `style[$STYLE_HASH_ATTRIBUTE2}]` 10790 )) { 10791 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 10792 return true; 10793 } 10794 } 10795 return false; 10796 } 10797 function injectStyle2(targetDocument, hash, css) { 10798 if (!targetDocument.head) { 10799 return; 10800 } 10801 const runtime = getRuntime2(); 10802 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10803 if (!injectedStyles) { 10804 injectedStyles = /* @__PURE__ */ new Set(); 10805 runtime.injectedStyles.set(targetDocument, injectedStyles); 10806 } 10807 if (injectedStyles.has(hash)) { 10808 return; 10809 } 10810 if (documentContainsStyleHash2(targetDocument, hash)) { 10811 injectedStyles.add(hash); 10812 return; 10813 } 10814 const style = targetDocument.createElement("style"); 10815 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 10816 style.appendChild(targetDocument.createTextNode(css)); 10817 targetDocument.head.appendChild(style); 10818 injectedStyles.add(hash); 10819 } 10820 function registerDocument2(targetDocument) { 10821 const runtime = getRuntime2(); 10822 runtime.documents.set( 10823 targetDocument, 10824 (runtime.documents.get(targetDocument) ?? 0) + 1 10825 ); 10826 for (const [hash, css] of runtime.styles) { 10827 injectStyle2(targetDocument, hash, css); 10828 } 10829 return () => { 10830 const count = runtime.documents.get(targetDocument); 10831 if (count === void 0) { 10832 return; 10833 } 10834 if (count <= 1) { 10835 runtime.documents.delete(targetDocument); 10836 return; 10837 } 10838 runtime.documents.set(targetDocument, count - 1); 10839 }; 10840 } 10841 function registerStyle2(hash, css) { 10842 const runtime = getRuntime2(); 10843 runtime.styles.set(hash, css); 10844 for (const targetDocument of runtime.documents.keys()) { 10845 injectStyle2(targetDocument, hash, css); 10846 } 10847 } 10848 if (typeof process === "undefined" || true) { 10849 registerStyle2("9d817a6077", "@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-bg-surface-error,#f6e6e3);color:var(--wpds-color-fg-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-bg-surface-warning,#fde6be);color:var(--wpds-color-fg-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-bg-surface-caution,#fee995);color:var(--wpds-color-fg-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-bg-surface-success,#c6f7cd);color:var(--wpds-color-fg-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-bg-surface-info,#deebfa);color:var(--wpds-color-fg-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-fg-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-fg-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))}}}"); 10850 } 10851 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" }; 10852 var Badge = (0, import_element11.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) { 10853 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 10854 Text, 10855 { 10856 ref, 10857 className: clsx_default( 10858 style_default2.badge, 10859 style_default2[`is-$intent}-intent`], 10860 className 10861 ), 10862 ...props, 10863 variant: "body-sm" 10864 } 10865 ); 10866 }); 10867 10868 // packages/ui/build-module/icon/icon.mjs 10869 var import_element12 = __toESM(require_element(), 1); 10870 var import_primitives = __toESM(require_primitives(), 1); 10871 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 10872 var Icon = (0, import_element12.forwardRef)(function Icon2({ icon, size: size4 = 24, ...restProps }, ref) { 10873 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 10874 import_primitives.SVG, 10875 { 10876 ref, 10877 fill: "currentColor", 10878 ...icon.props, 10879 ...restProps, 10880 width: size4, 10881 height: size4 10882 } 10883 ); 10884 }); 10885 10886 // packages/ui/build-module/card/index.mjs 10887 var card_exports = {}; 10888 __export(card_exports, { 10889 Content: () => Content, 10890 FullBleed: () => FullBleed, 10891 Header: () => Header, 10892 Root: () => Root, 10893 Title: () => Title 10894 }); 10895 10896 // packages/ui/build-module/card/root.mjs 10897 var import_element13 = __toESM(require_element(), 1); 10898 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 10899 function getRuntime3() { 10900 const globalScope = globalThis; 10901 if (globalScope.__wpStyleRuntime) { 10902 return globalScope.__wpStyleRuntime; 10903 } 10904 globalScope.__wpStyleRuntime = { 10905 documents: /* @__PURE__ */ new Map(), 10906 styles: /* @__PURE__ */ new Map(), 10907 injectedStyles: /* @__PURE__ */ new WeakMap() 10908 }; 10909 if (typeof document !== "undefined") { 10910 registerDocument3(document); 10911 } 10912 return globalScope.__wpStyleRuntime; 10913 } 10914 function documentContainsStyleHash3(targetDocument, hash) { 10915 if (!targetDocument.head) { 10916 return false; 10917 } 10918 for (const style of targetDocument.head.querySelectorAll( 10919 `style[$STYLE_HASH_ATTRIBUTE3}]` 10920 )) { 10921 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 10922 return true; 10923 } 10924 } 10925 return false; 10926 } 10927 function injectStyle3(targetDocument, hash, css) { 10928 if (!targetDocument.head) { 10929 return; 10930 } 10931 const runtime = getRuntime3(); 10932 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10933 if (!injectedStyles) { 10934 injectedStyles = /* @__PURE__ */ new Set(); 10935 runtime.injectedStyles.set(targetDocument, injectedStyles); 10936 } 10937 if (injectedStyles.has(hash)) { 10938 return; 10939 } 10940 if (documentContainsStyleHash3(targetDocument, hash)) { 10941 injectedStyles.add(hash); 10942 return; 10943 } 10944 const style = targetDocument.createElement("style"); 10945 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 10946 style.appendChild(targetDocument.createTextNode(css)); 10947 targetDocument.head.appendChild(style); 10948 injectedStyles.add(hash); 10949 } 10950 function registerDocument3(targetDocument) { 10951 const runtime = getRuntime3(); 10952 runtime.documents.set( 10953 targetDocument, 10954 (runtime.documents.get(targetDocument) ?? 0) + 1 10955 ); 10956 for (const [hash, css] of runtime.styles) { 10957 injectStyle3(targetDocument, hash, css); 10958 } 10959 return () => { 10960 const count = runtime.documents.get(targetDocument); 10961 if (count === void 0) { 10962 return; 10963 } 10964 if (count <= 1) { 10965 runtime.documents.delete(targetDocument); 10966 return; 10967 } 10968 runtime.documents.set(targetDocument, count - 1); 10969 }; 10970 } 10971 function registerStyle3(hash, css) { 10972 const runtime = getRuntime3(); 10973 runtime.styles.set(hash, css); 10974 for (const targetDocument of runtime.documents.keys()) { 10975 injectStyle3(targetDocument, hash, css); 10976 } 10977 } 10978 if (typeof process === "undefined" || true) { 10979 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 10980 } 10981 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 10982 if (typeof process === "undefined" || true) { 10983 registerStyle3("66ab1fd35b", "@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-bg-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-fg-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)}}}"); 10984 } 10985 var style_default3 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 10986 var Root = (0, import_element13.forwardRef)(function Card({ render: render4, ...restProps }, ref) { 10987 const mergedClassName = clsx_default(style_default3.root, resets_default["box-sizing"]); 10988 const element = useRender({ 10989 defaultTagName: "div", 10990 render: render4, 10991 ref, 10992 props: mergeProps({ className: mergedClassName }, restProps) 10993 }); 10994 return element; 10995 }); 10996 10997 // packages/ui/build-module/card/header.mjs 10998 var import_element14 = __toESM(require_element(), 1); 10999 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 11000 function getRuntime4() { 11001 const globalScope = globalThis; 11002 if (globalScope.__wpStyleRuntime) { 11003 return globalScope.__wpStyleRuntime; 11004 } 11005 globalScope.__wpStyleRuntime = { 11006 documents: /* @__PURE__ */ new Map(), 11007 styles: /* @__PURE__ */ new Map(), 11008 injectedStyles: /* @__PURE__ */ new WeakMap() 11009 }; 11010 if (typeof document !== "undefined") { 11011 registerDocument4(document); 11012 } 11013 return globalScope.__wpStyleRuntime; 11014 } 11015 function documentContainsStyleHash4(targetDocument, hash) { 11016 if (!targetDocument.head) { 11017 return false; 11018 } 11019 for (const style of targetDocument.head.querySelectorAll( 11020 `style[$STYLE_HASH_ATTRIBUTE4}]` 11021 )) { 11022 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 11023 return true; 11024 } 11025 } 11026 return false; 11027 } 11028 function injectStyle4(targetDocument, hash, css) { 11029 if (!targetDocument.head) { 11030 return; 11031 } 11032 const runtime = getRuntime4(); 11033 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11034 if (!injectedStyles) { 11035 injectedStyles = /* @__PURE__ */ new Set(); 11036 runtime.injectedStyles.set(targetDocument, injectedStyles); 11037 } 11038 if (injectedStyles.has(hash)) { 11039 return; 11040 } 11041 if (documentContainsStyleHash4(targetDocument, hash)) { 11042 injectedStyles.add(hash); 11043 return; 11044 } 11045 const style = targetDocument.createElement("style"); 11046 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 11047 style.appendChild(targetDocument.createTextNode(css)); 11048 targetDocument.head.appendChild(style); 11049 injectedStyles.add(hash); 11050 } 11051 function registerDocument4(targetDocument) { 11052 const runtime = getRuntime4(); 11053 runtime.documents.set( 11054 targetDocument, 11055 (runtime.documents.get(targetDocument) ?? 0) + 1 11056 ); 11057 for (const [hash, css] of runtime.styles) { 11058 injectStyle4(targetDocument, hash, css); 11059 } 11060 return () => { 11061 const count = runtime.documents.get(targetDocument); 11062 if (count === void 0) { 11063 return; 11064 } 11065 if (count <= 1) { 11066 runtime.documents.delete(targetDocument); 11067 return; 11068 } 11069 runtime.documents.set(targetDocument, count - 1); 11070 }; 11071 } 11072 function registerStyle4(hash, css) { 11073 const runtime = getRuntime4(); 11074 runtime.styles.set(hash, css); 11075 for (const targetDocument of runtime.documents.keys()) { 11076 injectStyle4(targetDocument, hash, css); 11077 } 11078 } 11079 if (typeof process === "undefined" || true) { 11080 registerStyle4("66ab1fd35b", "@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-bg-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-fg-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)}}}"); 11081 } 11082 var style_default4 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 11083 var Header = (0, import_element14.forwardRef)( 11084 function CardHeader({ render: render4, ...props }, ref) { 11085 const element = useRender({ 11086 defaultTagName: "div", 11087 render: render4, 11088 ref, 11089 props: mergeProps({ className: style_default4.header }, props) 11090 }); 11091 return element; 11092 } 11093 ); 11094 11095 // packages/ui/build-module/card/content.mjs 11096 var import_element15 = __toESM(require_element(), 1); 11097 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 11098 function getRuntime5() { 11099 const globalScope = globalThis; 11100 if (globalScope.__wpStyleRuntime) { 11101 return globalScope.__wpStyleRuntime; 11102 } 11103 globalScope.__wpStyleRuntime = { 11104 documents: /* @__PURE__ */ new Map(), 11105 styles: /* @__PURE__ */ new Map(), 11106 injectedStyles: /* @__PURE__ */ new WeakMap() 11107 }; 11108 if (typeof document !== "undefined") { 11109 registerDocument5(document); 11110 } 11111 return globalScope.__wpStyleRuntime; 11112 } 11113 function documentContainsStyleHash5(targetDocument, hash) { 11114 if (!targetDocument.head) { 11115 return false; 11116 } 11117 for (const style of targetDocument.head.querySelectorAll( 11118 `style[$STYLE_HASH_ATTRIBUTE5}]` 11119 )) { 11120 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 11121 return true; 11122 } 11123 } 11124 return false; 11125 } 11126 function injectStyle5(targetDocument, hash, css) { 11127 if (!targetDocument.head) { 11128 return; 11129 } 11130 const runtime = getRuntime5(); 11131 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11132 if (!injectedStyles) { 11133 injectedStyles = /* @__PURE__ */ new Set(); 11134 runtime.injectedStyles.set(targetDocument, injectedStyles); 11135 } 11136 if (injectedStyles.has(hash)) { 11137 return; 11138 } 11139 if (documentContainsStyleHash5(targetDocument, hash)) { 11140 injectedStyles.add(hash); 11141 return; 11142 } 11143 const style = targetDocument.createElement("style"); 11144 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 11145 style.appendChild(targetDocument.createTextNode(css)); 11146 targetDocument.head.appendChild(style); 11147 injectedStyles.add(hash); 11148 } 11149 function registerDocument5(targetDocument) { 11150 const runtime = getRuntime5(); 11151 runtime.documents.set( 11152 targetDocument, 11153 (runtime.documents.get(targetDocument) ?? 0) + 1 11154 ); 11155 for (const [hash, css] of runtime.styles) { 11156 injectStyle5(targetDocument, hash, css); 11157 } 11158 return () => { 11159 const count = runtime.documents.get(targetDocument); 11160 if (count === void 0) { 11161 return; 11162 } 11163 if (count <= 1) { 11164 runtime.documents.delete(targetDocument); 11165 return; 11166 } 11167 runtime.documents.set(targetDocument, count - 1); 11168 }; 11169 } 11170 function registerStyle5(hash, css) { 11171 const runtime = getRuntime5(); 11172 runtime.styles.set(hash, css); 11173 for (const targetDocument of runtime.documents.keys()) { 11174 injectStyle5(targetDocument, hash, css); 11175 } 11176 } 11177 if (typeof process === "undefined" || true) { 11178 registerStyle5("66ab1fd35b", "@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-bg-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-fg-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)}}}"); 11179 } 11180 var style_default5 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 11181 var Content = (0, import_element15.forwardRef)( 11182 function CardContent({ render: render4, ...props }, ref) { 11183 const element = useRender({ 11184 defaultTagName: "div", 11185 render: render4, 11186 ref, 11187 props: mergeProps({ className: style_default5.content }, props) 11188 }); 11189 return element; 11190 } 11191 ); 11192 11193 // packages/ui/build-module/card/full-bleed.mjs 11194 var import_element16 = __toESM(require_element(), 1); 11195 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 11196 function getRuntime6() { 11197 const globalScope = globalThis; 11198 if (globalScope.__wpStyleRuntime) { 11199 return globalScope.__wpStyleRuntime; 11200 } 11201 globalScope.__wpStyleRuntime = { 11202 documents: /* @__PURE__ */ new Map(), 11203 styles: /* @__PURE__ */ new Map(), 11204 injectedStyles: /* @__PURE__ */ new WeakMap() 11205 }; 11206 if (typeof document !== "undefined") { 11207 registerDocument6(document); 11208 } 11209 return globalScope.__wpStyleRuntime; 11210 } 11211 function documentContainsStyleHash6(targetDocument, hash) { 11212 if (!targetDocument.head) { 11213 return false; 11214 } 11215 for (const style of targetDocument.head.querySelectorAll( 11216 `style[$STYLE_HASH_ATTRIBUTE6}]` 11217 )) { 11218 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 11219 return true; 11220 } 11221 } 11222 return false; 11223 } 11224 function injectStyle6(targetDocument, hash, css) { 11225 if (!targetDocument.head) { 11226 return; 11227 } 11228 const runtime = getRuntime6(); 11229 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11230 if (!injectedStyles) { 11231 injectedStyles = /* @__PURE__ */ new Set(); 11232 runtime.injectedStyles.set(targetDocument, injectedStyles); 11233 } 11234 if (injectedStyles.has(hash)) { 11235 return; 11236 } 11237 if (documentContainsStyleHash6(targetDocument, hash)) { 11238 injectedStyles.add(hash); 11239 return; 11240 } 11241 const style = targetDocument.createElement("style"); 11242 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 11243 style.appendChild(targetDocument.createTextNode(css)); 11244 targetDocument.head.appendChild(style); 11245 injectedStyles.add(hash); 11246 } 11247 function registerDocument6(targetDocument) { 11248 const runtime = getRuntime6(); 11249 runtime.documents.set( 11250 targetDocument, 11251 (runtime.documents.get(targetDocument) ?? 0) + 1 11252 ); 11253 for (const [hash, css] of runtime.styles) { 11254 injectStyle6(targetDocument, hash, css); 11255 } 11256 return () => { 11257 const count = runtime.documents.get(targetDocument); 11258 if (count === void 0) { 11259 return; 11260 } 11261 if (count <= 1) { 11262 runtime.documents.delete(targetDocument); 11263 return; 11264 } 11265 runtime.documents.set(targetDocument, count - 1); 11266 }; 11267 } 11268 function registerStyle6(hash, css) { 11269 const runtime = getRuntime6(); 11270 runtime.styles.set(hash, css); 11271 for (const targetDocument of runtime.documents.keys()) { 11272 injectStyle6(targetDocument, hash, css); 11273 } 11274 } 11275 if (typeof process === "undefined" || true) { 11276 registerStyle6("66ab1fd35b", "@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-bg-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-fg-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)}}}"); 11277 } 11278 var style_default6 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 11279 var FullBleed = (0, import_element16.forwardRef)( 11280 function CardFullBleed({ render: render4, ...props }, ref) { 11281 const element = useRender({ 11282 defaultTagName: "div", 11283 render: render4, 11284 ref, 11285 props: mergeProps( 11286 { className: style_default6.fullbleed }, 11287 props 11288 ) 11289 }); 11290 return element; 11291 } 11292 ); 11293 11294 // packages/ui/build-module/card/title.mjs 11295 var import_element17 = __toESM(require_element(), 1); 11296 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 11297 var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {}); 11298 var Title = (0, import_element17.forwardRef)( 11299 function CardTitle({ render: render4 = DEFAULT_TAG, children, ...props }, ref) { 11300 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 11301 Text, 11302 { 11303 ref, 11304 variant: "heading-lg", 11305 render: render4, 11306 ...props, 11307 children 11308 } 11309 ); 11310 } 11311 ); 11312 11313 // packages/ui/build-module/collapsible/panel.mjs 11314 var import_element18 = __toESM(require_element(), 1); 11315 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 11316 var Panel = (0, import_element18.forwardRef)( 11317 function CollapsiblePanel3(props, forwardedRef) { 11318 return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props }); 11319 } 11320 ); 11321 11322 // packages/ui/build-module/collapsible/root.mjs 11323 var import_element19 = __toESM(require_element(), 1); 11324 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 11325 var Root2 = (0, import_element19.forwardRef)( 11326 function CollapsibleRoot3(props, forwardedRef) { 11327 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props }); 11328 } 11329 ); 11330 11331 // packages/ui/build-module/collapsible/trigger.mjs 11332 var import_element20 = __toESM(require_element(), 1); 11333 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 11334 var Trigger = (0, import_element20.forwardRef)( 11335 function CollapsibleTrigger3(props, forwardedRef) { 11336 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props }); 11337 } 11338 ); 11339 11340 // packages/ui/build-module/collapsible-card/index.mjs 11341 var collapsible_card_exports = {}; 11342 __export(collapsible_card_exports, { 11343 Content: () => Content2, 11344 Header: () => Header2, 11345 HeaderDescription: () => HeaderDescription, 11346 Root: () => Root3 11347 }); 11348 11349 // packages/ui/build-module/collapsible-card/root.mjs 11350 var import_element21 = __toESM(require_element(), 1); 11351 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 11352 var Root3 = (0, import_element21.forwardRef)( 11353 function CollapsibleCardRoot({ render: render4, ...restProps }, ref) { 11354 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 11355 Root2, 11356 { 11357 ref, 11358 render: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Root, { render: render4 }), 11359 ...restProps 11360 } 11361 ); 11362 } 11363 ); 11364 11365 // packages/ui/build-module/collapsible-card/header.mjs 11366 var import_element24 = __toESM(require_element(), 1); 11367 11368 // packages/icons/build-module/icon/index.mjs 11369 var import_element22 = __toESM(require_element(), 1); 11370 var icon_default = (0, import_element22.forwardRef)( 11371 ({ icon, size: size4 = 24, ...props }, ref) => { 11372 return (0, import_element22.cloneElement)(icon, { 11373 width: size4, 11374 height: size4, 11375 ...props, 11376 ref 11377 }); 11378 } 11379 ); 11380 11381 // packages/icons/build-module/library/archive.mjs 11382 var import_primitives2 = __toESM(require_primitives(), 1); 11383 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 11384 var archive_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime19.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" }) }); 11385 11386 // packages/icons/build-module/library/arrow-down.mjs 11387 var import_primitives3 = __toESM(require_primitives(), 1); 11388 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 11389 var arrow_down_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime20.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" }) }); 11390 11391 // packages/icons/build-module/library/arrow-left.mjs 11392 var import_primitives4 = __toESM(require_primitives(), 1); 11393 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 11394 var arrow_left_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime21.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" }) }); 11395 11396 // packages/icons/build-module/library/arrow-right.mjs 11397 var import_primitives5 = __toESM(require_primitives(), 1); 11398 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 11399 var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime22.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" }) }); 11400 11401 // packages/icons/build-module/library/arrow-up-left.mjs 11402 var import_primitives6 = __toESM(require_primitives(), 1); 11403 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 11404 var arrow_up_left_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives6.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) }); 11405 11406 // packages/icons/build-module/library/arrow-up-right.mjs 11407 var import_primitives7 = __toESM(require_primitives(), 1); 11408 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 11409 var arrow_up_right_default = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives7.Path, { d: "M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" }) }); 11410 11411 // packages/icons/build-module/library/arrow-up.mjs 11412 var import_primitives8 = __toESM(require_primitives(), 1); 11413 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 11414 var arrow_up_default = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives8.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) }); 11415 11416 // packages/icons/build-module/library/audio.mjs 11417 var import_primitives9 = __toESM(require_primitives(), 1); 11418 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 11419 var audio_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives9.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" }) }); 11420 11421 // packages/icons/build-module/library/backup.mjs 11422 var import_primitives10 = __toESM(require_primitives(), 1); 11423 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 11424 var backup_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives10.Path, { d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" }) }); 11425 11426 // packages/icons/build-module/library/block-meta.mjs 11427 var import_primitives11 = __toESM(require_primitives(), 1); 11428 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 11429 var block_meta_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives11.Path, { fillRule: "evenodd", d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z", clipRule: "evenodd" }) }); 11430 11431 // packages/icons/build-module/library/block-table.mjs 11432 var import_primitives12 = __toESM(require_primitives(), 1); 11433 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 11434 var block_table_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime29.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" }) }); 11435 11436 // packages/icons/build-module/library/calendar.mjs 11437 var import_primitives13 = __toESM(require_primitives(), 1); 11438 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 11439 var calendar_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives13.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-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" }) }); 11440 11441 // packages/icons/build-module/library/category.mjs 11442 var import_primitives14 = __toESM(require_primitives(), 1); 11443 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 11444 var category_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives14.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" }) }); 11445 11446 // packages/icons/build-module/library/check.mjs 11447 var import_primitives15 = __toESM(require_primitives(), 1); 11448 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 11449 var check_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives15.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); 11450 11451 // packages/icons/build-module/library/chevron-down.mjs 11452 var import_primitives16 = __toESM(require_primitives(), 1); 11453 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 11454 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives16.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); 11455 11456 // packages/icons/build-module/library/chevron-left-small.mjs 11457 var import_primitives17 = __toESM(require_primitives(), 1); 11458 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 11459 var chevron_left_small_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives17.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) }); 11460 11461 // packages/icons/build-module/library/chevron-left.mjs 11462 var import_primitives18 = __toESM(require_primitives(), 1); 11463 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 11464 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives18.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) }); 11465 11466 // packages/icons/build-module/library/chevron-right-small.mjs 11467 var import_primitives19 = __toESM(require_primitives(), 1); 11468 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 11469 var chevron_right_small_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives19.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) }); 11470 11471 // packages/icons/build-module/library/chevron-right.mjs 11472 var import_primitives20 = __toESM(require_primitives(), 1); 11473 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 11474 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives20.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) }); 11475 11476 // packages/icons/build-module/library/chevron-up.mjs 11477 var import_primitives21 = __toESM(require_primitives(), 1); 11478 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 11479 var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives21.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) }); 11480 11481 // packages/icons/build-module/library/close-small.mjs 11482 var import_primitives22 = __toESM(require_primitives(), 1); 11483 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 11484 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives22.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives22.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" }) }); 11485 11486 // packages/icons/build-module/library/cog.mjs 11487 var import_primitives23 = __toESM(require_primitives(), 1); 11488 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 11489 var cog_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives23.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives23.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" }) }); 11490 11491 // packages/icons/build-module/library/comment-author-avatar.mjs 11492 var import_primitives24 = __toESM(require_primitives(), 1); 11493 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 11494 var comment_author_avatar_default = /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives24.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives24.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" }) }); 11495 11496 // packages/icons/build-module/library/download.mjs 11497 var import_primitives25 = __toESM(require_primitives(), 1); 11498 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 11499 var download_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives25.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" }) }); 11500 11501 // packages/icons/build-module/library/drafts.mjs 11502 var import_primitives26 = __toESM(require_primitives(), 1); 11503 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 11504 var drafts_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives26.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives26.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" }) }); 11505 11506 // packages/icons/build-module/library/drawer-right.mjs 11507 var import_primitives27 = __toESM(require_primitives(), 1); 11508 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); 11509 var drawer_right_default = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives27.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives27.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" }) }); 11510 11511 // packages/icons/build-module/library/envelope.mjs 11512 var import_primitives28 = __toESM(require_primitives(), 1); 11513 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); 11514 var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives28.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives28.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" }) }); 11515 11516 // packages/icons/build-module/library/error.mjs 11517 var import_primitives29 = __toESM(require_primitives(), 1); 11518 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); 11519 var error_default = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives29.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives29.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" }) }); 11520 11521 // packages/icons/build-module/library/file.mjs 11522 var import_primitives30 = __toESM(require_primitives(), 1); 11523 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); 11524 var file_default = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives30.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives30.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" }) }); 11525 11526 // packages/icons/build-module/library/format-list-bullets-rtl.mjs 11527 var import_primitives31 = __toESM(require_primitives(), 1); 11528 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); 11529 var format_list_bullets_rtl_default = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives31.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives31.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" }) }); 11530 11531 // packages/icons/build-module/library/format-list-bullets.mjs 11532 var import_primitives32 = __toESM(require_primitives(), 1); 11533 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); 11534 var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives32.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives32.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" }) }); 11535 11536 // packages/icons/build-module/library/funnel.mjs 11537 var import_primitives33 = __toESM(require_primitives(), 1); 11538 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); 11539 var funnel_default = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives33.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives33.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) }); 11540 11541 // packages/icons/build-module/library/globe.mjs 11542 var import_primitives34 = __toESM(require_primitives(), 1); 11543 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); 11544 var globe_default = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives34.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives34.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" }) }); 11545 11546 // packages/icons/build-module/library/help.mjs 11547 var import_primitives35 = __toESM(require_primitives(), 1); 11548 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); 11549 var help_default = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives35.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives35.Path, { d: "M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z" }) }); 11550 11551 // packages/icons/build-module/library/home.mjs 11552 var import_primitives36 = __toESM(require_primitives(), 1); 11553 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); 11554 var home_default = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives36.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives36.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) }); 11555 11556 // packages/icons/build-module/library/layout.mjs 11557 var import_primitives37 = __toESM(require_primitives(), 1); 11558 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); 11559 var layout_default = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives37.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives37.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" }) }); 11560 11561 // packages/icons/build-module/library/link.mjs 11562 var import_primitives38 = __toESM(require_primitives(), 1); 11563 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); 11564 var link_default = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives38.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives38.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" }) }); 11565 11566 // packages/icons/build-module/library/list.mjs 11567 var import_primitives39 = __toESM(require_primitives(), 1); 11568 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); 11569 var list_default = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives39.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives39.Path, { d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" }) }); 11570 11571 // packages/icons/build-module/library/media.mjs 11572 var import_primitives40 = __toESM(require_primitives(), 1); 11573 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); 11574 var media_default = /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_primitives40.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 11575 /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives40.Path, { d: "m7 6.5 4 2.5-4 2.5z" }), 11576 /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives40.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z" }) 11577 ] }); 11578 11579 // packages/icons/build-module/library/mobile.mjs 11580 var import_primitives41 = __toESM(require_primitives(), 1); 11581 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); 11582 var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives41.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives41.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" }) }); 11583 11584 // packages/icons/build-module/library/more-vertical.mjs 11585 var import_primitives42 = __toESM(require_primitives(), 1); 11586 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); 11587 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives42.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives42.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 11588 11589 // packages/icons/build-module/library/navigation.mjs 11590 var import_primitives43 = __toESM(require_primitives(), 1); 11591 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); 11592 var navigation_default = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives43.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives43.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" }) }); 11593 11594 // packages/icons/build-module/library/next.mjs 11595 var import_primitives44 = __toESM(require_primitives(), 1); 11596 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); 11597 var next_default = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives44.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives44.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" }) }); 11598 11599 // packages/icons/build-module/library/not-allowed.mjs 11600 var import_primitives45 = __toESM(require_primitives(), 1); 11601 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); 11602 var not_allowed_default = /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives45.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives45.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" }) }); 11603 11604 // packages/icons/build-module/library/not-found.mjs 11605 var import_primitives46 = __toESM(require_primitives(), 1); 11606 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); 11607 var not_found_default = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives46.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives46.Path, { d: "M19 5c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V7c0-1.1.9-2 2-2zM5 6.5c-.3 0-.5.2-.5.5v10c0 .3.2.5.5.5h14c.3 0 .5-.2.5-.5V7c0-.3-.2-.5-.5-.5zm7.01 2.75q.711 0 1.24.364.533.364.824 1.012.296.645.296 1.488 0 .887-.296 1.556-.292.664-.824 1.036-.528.368-1.24.368-.708 0-1.24-.368-.527-.372-.824-1.036-.296-.668-.296-1.556 0-.848.296-1.492.296-.648.824-1.008a2.14 2.14 0 0 1 1.24-.364m-3.484 3.6h.72v.832h-.72v1.28h-.984v-1.28H4.75l3.08-4.32h.696zm9.522 0h.72v.832h-.72v1.28h-.983v-1.28h-2.793l3.08-4.32h.696zm-6.038-2.696q-.568 0-.952.48-.384.475-.384 1.48 0 .716.176 1.168.176.45.476.66.304.212.684.212t.68-.208q.304-.207.48-.656.176-.451.176-1.176 0-.996-.384-1.476-.38-.484-.952-.484M6.33 12.85h1.212v-1.722zm9.523 0h1.211v-1.722z" }) }); 11608 11609 // packages/icons/build-module/library/page.mjs 11610 var import_primitives47 = __toESM(require_primitives(), 1); 11611 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); 11612 var page_default = /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_primitives47.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 11613 /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives47.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }), 11614 /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives47.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" }) 11615 ] }); 11616 11617 // packages/icons/build-module/library/pages.mjs 11618 var import_primitives48 = __toESM(require_primitives(), 1); 11619 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); 11620 var pages_default = /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_primitives48.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [ 11621 /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives48.Path, { d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" }), 11622 /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives48.Path, { d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z" }), 11623 /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives48.Path, { d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" }) 11624 ] }); 11625 11626 // packages/icons/build-module/library/pencil.mjs 11627 var import_primitives49 = __toESM(require_primitives(), 1); 11628 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); 11629 var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives49.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives49.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); 11630 11631 // packages/icons/build-module/library/pending.mjs 11632 var import_primitives50 = __toESM(require_primitives(), 1); 11633 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); 11634 var pending_default = /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives50.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives50.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" }) }); 11635 11636 // packages/icons/build-module/library/pin.mjs 11637 var import_primitives51 = __toESM(require_primitives(), 1); 11638 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); 11639 var pin_default = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_primitives51.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_primitives51.Path, { d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" }) }); 11640 11641 // packages/icons/build-module/library/plugins.mjs 11642 var import_primitives52 = __toESM(require_primitives(), 1); 11643 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); 11644 var plugins_default = /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_primitives52.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_primitives52.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" }) }); 11645 11646 // packages/icons/build-module/library/post.mjs 11647 var import_primitives53 = __toESM(require_primitives(), 1); 11648 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); 11649 var post_default = /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_primitives53.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_primitives53.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" }) }); 11650 11651 // packages/icons/build-module/library/previous.mjs 11652 var import_primitives54 = __toESM(require_primitives(), 1); 11653 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); 11654 var previous_default = /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_primitives54.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_primitives54.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" }) }); 11655 11656 // packages/icons/build-module/library/published.mjs 11657 var import_primitives55 = __toESM(require_primitives(), 1); 11658 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); 11659 var published_default = /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_primitives55.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_primitives55.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" }) }); 11660 11661 // packages/icons/build-module/library/rotate-left.mjs 11662 var import_primitives56 = __toESM(require_primitives(), 1); 11663 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); 11664 var rotate_left_default = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_primitives56.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_primitives56.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" }) }); 11665 11666 // packages/icons/build-module/library/rotate-right.mjs 11667 var import_primitives57 = __toESM(require_primitives(), 1); 11668 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); 11669 var rotate_right_default = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_primitives57.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_primitives57.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" }) }); 11670 11671 // packages/icons/build-module/library/scheduled.mjs 11672 var import_primitives58 = __toESM(require_primitives(), 1); 11673 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); 11674 var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_primitives58.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_primitives58.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" }) }); 11675 11676 // packages/icons/build-module/library/search.mjs 11677 var import_primitives59 = __toESM(require_primitives(), 1); 11678 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); 11679 var search_default = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_primitives59.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_primitives59.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" }) }); 11680 11681 // packages/icons/build-module/library/seen.mjs 11682 var import_primitives60 = __toESM(require_primitives(), 1); 11683 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1); 11684 var seen_default = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_primitives60.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_primitives60.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" }) }); 11685 11686 // packages/icons/build-module/library/site-logo.mjs 11687 var import_primitives61 = __toESM(require_primitives(), 1); 11688 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1); 11689 var site_logo_default = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_primitives61.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_primitives61.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 1.5c3.4 0 6.2 2.7 6.5 6l-1.2-.6-.8-.4c-.1 0-.2 0-.3-.1H16c-.1-.2-.4-.2-.7 0l-2.9 2.1L9 11.3h-.7L5.5 13v-1.1c0-3.6 2.9-6.5 6.5-6.5Zm0 13c-2.7 0-5-1.7-6-4l2.8-1.7 3.5 1.2h.4s.2 0 .4-.2l2.9-2.1.4.2c.6.3 1.4.7 2.1 1.1-.5 3.1-3.2 5.4-6.4 5.4Z" }) }); 11690 11691 // packages/icons/build-module/library/styles.mjs 11692 var import_primitives62 = __toESM(require_primitives(), 1); 11693 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1); 11694 var styles_default = /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_primitives62.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_primitives62.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" }) }); 11695 11696 // packages/icons/build-module/library/symbol-filled.mjs 11697 var import_primitives63 = __toESM(require_primitives(), 1); 11698 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1); 11699 var symbol_filled_default = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_primitives63.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_primitives63.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" }) }); 11700 11701 // packages/icons/build-module/library/symbol.mjs 11702 var import_primitives64 = __toESM(require_primitives(), 1); 11703 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1); 11704 var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_primitives64.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_primitives64.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" }) }); 11705 11706 // packages/icons/build-module/library/tag.mjs 11707 var import_primitives65 = __toESM(require_primitives(), 1); 11708 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1); 11709 var tag_default = /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_primitives65.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_primitives65.Path, { d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }) }); 11710 11711 // packages/icons/build-module/library/trash.mjs 11712 var import_primitives66 = __toESM(require_primitives(), 1); 11713 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1); 11714 var trash_default = /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_primitives66.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_primitives66.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" }) }); 11715 11716 // packages/icons/build-module/library/unseen.mjs 11717 var import_primitives67 = __toESM(require_primitives(), 1); 11718 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1); 11719 var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_primitives67.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_primitives67.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" }) }); 11720 11721 // packages/icons/build-module/library/upload.mjs 11722 var import_primitives68 = __toESM(require_primitives(), 1); 11723 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1); 11724 var upload_default = /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_primitives68.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_primitives68.Path, { d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" }) }); 11725 11726 // packages/icons/build-module/library/verse.mjs 11727 var import_primitives69 = __toESM(require_primitives(), 1); 11728 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1); 11729 var verse_default = /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_primitives69.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_primitives69.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" }) }); 11730 11731 // packages/icons/build-module/library/video.mjs 11732 var import_primitives70 = __toESM(require_primitives(), 1); 11733 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1); 11734 var video_default = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_primitives70.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_primitives70.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" }) }); 11735 11736 // packages/icons/build-module/library/wordpress.mjs 11737 var import_primitives71 = __toESM(require_primitives(), 1); 11738 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1); 11739 var wordpress_default = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_primitives71.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_primitives71.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" }) }); 11740 11741 // packages/ui/build-module/collapsible-card/context.mjs 11742 var import_element23 = __toESM(require_element(), 1); 11743 var HeaderDescriptionIdContext = (0, import_element23.createContext)({ 11744 setDescriptionId: () => { 11745 } 11746 }); 11747 11748 // packages/ui/build-module/collapsible-card/header.mjs 11749 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1); 11750 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 11751 function getRuntime7() { 11752 const globalScope = globalThis; 11753 if (globalScope.__wpStyleRuntime) { 11754 return globalScope.__wpStyleRuntime; 11755 } 11756 globalScope.__wpStyleRuntime = { 11757 documents: /* @__PURE__ */ new Map(), 11758 styles: /* @__PURE__ */ new Map(), 11759 injectedStyles: /* @__PURE__ */ new WeakMap() 11760 }; 11761 if (typeof document !== "undefined") { 11762 registerDocument7(document); 11763 } 11764 return globalScope.__wpStyleRuntime; 11765 } 11766 function documentContainsStyleHash7(targetDocument, hash) { 11767 if (!targetDocument.head) { 11768 return false; 11769 } 11770 for (const style of targetDocument.head.querySelectorAll( 11771 `style[$STYLE_HASH_ATTRIBUTE7}]` 11772 )) { 11773 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 11774 return true; 11775 } 11776 } 11777 return false; 11778 } 11779 function injectStyle7(targetDocument, hash, css) { 11780 if (!targetDocument.head) { 11781 return; 11782 } 11783 const runtime = getRuntime7(); 11784 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11785 if (!injectedStyles) { 11786 injectedStyles = /* @__PURE__ */ new Set(); 11787 runtime.injectedStyles.set(targetDocument, injectedStyles); 11788 } 11789 if (injectedStyles.has(hash)) { 11790 return; 11791 } 11792 if (documentContainsStyleHash7(targetDocument, hash)) { 11793 injectedStyles.add(hash); 11794 return; 11795 } 11796 const style = targetDocument.createElement("style"); 11797 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 11798 style.appendChild(targetDocument.createTextNode(css)); 11799 targetDocument.head.appendChild(style); 11800 injectedStyles.add(hash); 11801 } 11802 function registerDocument7(targetDocument) { 11803 const runtime = getRuntime7(); 11804 runtime.documents.set( 11805 targetDocument, 11806 (runtime.documents.get(targetDocument) ?? 0) + 1 11807 ); 11808 for (const [hash, css] of runtime.styles) { 11809 injectStyle7(targetDocument, hash, css); 11810 } 11811 return () => { 11812 const count = runtime.documents.get(targetDocument); 11813 if (count === void 0) { 11814 return; 11815 } 11816 if (count <= 1) { 11817 runtime.documents.delete(targetDocument); 11818 return; 11819 } 11820 runtime.documents.set(targetDocument, count - 1); 11821 }; 11822 } 11823 function registerStyle7(hash, css) { 11824 const runtime = getRuntime7(); 11825 runtime.styles.set(hash, css); 11826 for (const targetDocument of runtime.documents.keys()) { 11827 injectStyle7(targetDocument, hash, css); 11828 } 11829 } 11830 if (typeof process === "undefined" || true) { 11831 registerStyle7("2072cdf420", "@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-fg-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._165c4572592944b2__overflowVisible{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)}}}}"); 11832 } 11833 var style_default7 = { "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", "overflowVisible": "_165c4572592944b2__overflowVisible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 11834 if (typeof process === "undefined" || true) { 11835 registerStyle7("d5c1b736fd", "._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-fg-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-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));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)}"); 11836 } 11837 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" }; 11838 if (typeof process === "undefined" || true) { 11839 registerStyle7("693cd16544", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid transparent;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.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,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),: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-brand,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-brand,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-brand,var(--wp-admin-theme-color,#3858e9))}}}"); 11840 } 11841 var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 11842 var Header2 = (0, import_element24.forwardRef)( 11843 function CollapsibleCardHeader({ children, className, render: render4, ...restProps }, ref) { 11844 const [descriptionId, setDescriptionId] = (0, import_element24.useState)(); 11845 const contextValue = (0, import_element24.useMemo)( 11846 () => ({ setDescriptionId }), 11847 [setDescriptionId] 11848 ); 11849 return useRender({ 11850 defaultTagName: "div", 11851 render: render4, 11852 ref, 11853 props: mergeProps(restProps, { 11854 className: clsx_default( 11855 global_css_defense_default2.heading, 11856 style_default7["heading-wrapper"], 11857 className 11858 ), 11859 children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)( 11860 Trigger, 11861 { 11862 className: style_default7.header, 11863 render: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Header, {}), 11864 nativeButton: false, 11865 "aria-describedby": descriptionId, 11866 children: [ 11867 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: style_default7["header-content"], children }), 11868 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)( 11869 "div", 11870 { 11871 className: clsx_default( 11872 style_default7["header-trigger-positioner"] 11873 ), 11874 children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)( 11875 "div", 11876 { 11877 className: clsx_default( 11878 style_default7["header-trigger-wrapper"], 11879 global_css_defense_default2.div, 11880 // While the interactive trigger element is the whole header, 11881 // the focus ring will be displayed only on the icon to visually 11882 // emulate it being the button. 11883 focus_default["outset-ring--focus-parent-visible"] 11884 ), 11885 children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)( 11886 Icon, 11887 { 11888 icon: chevron_down_default, 11889 className: style_default7["header-trigger"] 11890 } 11891 ) 11892 } 11893 ) 11894 } 11895 ) 11896 ] 11897 } 11898 ) }) 11899 }) 11900 }); 11901 } 11902 ); 11903 11904 // packages/ui/build-module/collapsible-card/header-description.mjs 11905 var import_element25 = __toESM(require_element(), 1); 11906 var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1); 11907 var HeaderDescription = (0, import_element25.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, ...restProps }, ref) { 11908 const descriptionId = (0, import_element25.useId)(); 11909 const { setDescriptionId } = (0, import_element25.useContext)(HeaderDescriptionIdContext); 11910 (0, import_element25.useEffect)(() => { 11911 setDescriptionId(descriptionId); 11912 return () => setDescriptionId(void 0); 11913 }, [descriptionId, setDescriptionId]); 11914 return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)( 11915 "div", 11916 { 11917 ref, 11918 id: descriptionId, 11919 "aria-hidden": "true", 11920 className, 11921 ...restProps, 11922 children 11923 } 11924 ); 11925 }); 11926 11927 // packages/ui/build-module/collapsible-card/content.mjs 11928 var import_element26 = __toESM(require_element(), 1); 11929 var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1); 11930 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; 11931 function getRuntime8() { 11932 const globalScope = globalThis; 11933 if (globalScope.__wpStyleRuntime) { 11934 return globalScope.__wpStyleRuntime; 11935 } 11936 globalScope.__wpStyleRuntime = { 11937 documents: /* @__PURE__ */ new Map(), 11938 styles: /* @__PURE__ */ new Map(), 11939 injectedStyles: /* @__PURE__ */ new WeakMap() 11940 }; 11941 if (typeof document !== "undefined") { 11942 registerDocument8(document); 11943 } 11944 return globalScope.__wpStyleRuntime; 11945 } 11946 function documentContainsStyleHash8(targetDocument, hash) { 11947 if (!targetDocument.head) { 11948 return false; 11949 } 11950 for (const style of targetDocument.head.querySelectorAll( 11951 `style[$STYLE_HASH_ATTRIBUTE8}]` 11952 )) { 11953 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { 11954 return true; 11955 } 11956 } 11957 return false; 11958 } 11959 function injectStyle8(targetDocument, hash, css) { 11960 if (!targetDocument.head) { 11961 return; 11962 } 11963 const runtime = getRuntime8(); 11964 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11965 if (!injectedStyles) { 11966 injectedStyles = /* @__PURE__ */ new Set(); 11967 runtime.injectedStyles.set(targetDocument, injectedStyles); 11968 } 11969 if (injectedStyles.has(hash)) { 11970 return; 11971 } 11972 if (documentContainsStyleHash8(targetDocument, hash)) { 11973 injectedStyles.add(hash); 11974 return; 11975 } 11976 const style = targetDocument.createElement("style"); 11977 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); 11978 style.appendChild(targetDocument.createTextNode(css)); 11979 targetDocument.head.appendChild(style); 11980 injectedStyles.add(hash); 11981 } 11982 function registerDocument8(targetDocument) { 11983 const runtime = getRuntime8(); 11984 runtime.documents.set( 11985 targetDocument, 11986 (runtime.documents.get(targetDocument) ?? 0) + 1 11987 ); 11988 for (const [hash, css] of runtime.styles) { 11989 injectStyle8(targetDocument, hash, css); 11990 } 11991 return () => { 11992 const count = runtime.documents.get(targetDocument); 11993 if (count === void 0) { 11994 return; 11995 } 11996 if (count <= 1) { 11997 runtime.documents.delete(targetDocument); 11998 return; 11999 } 12000 runtime.documents.set(targetDocument, count - 1); 12001 }; 12002 } 12003 function registerStyle8(hash, css) { 12004 const runtime = getRuntime8(); 12005 runtime.styles.set(hash, css); 12006 for (const targetDocument of runtime.documents.keys()) { 12007 injectStyle8(targetDocument, hash, css); 12008 } 12009 } 12010 if (typeof process === "undefined" || true) { 12011 registerStyle8("2072cdf420", "@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-fg-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._165c4572592944b2__overflowVisible{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)}}}}"); 12012 } 12013 var style_default8 = { "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", "overflowVisible": "_165c4572592944b2__overflowVisible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 12014 var Content2 = (0, import_element26.forwardRef)( 12015 function CollapsibleCardContent({ className, render: render4, children, hiddenUntilFound = true, ...restProps }, ref) { 12016 return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)( 12017 Panel, 12018 { 12019 ref, 12020 className: (state) => clsx_default( 12021 style_default8.content, 12022 state.open && state.transitionStatus === "idle" && style_default8.overflowVisible, 12023 className 12024 ), 12025 hiddenUntilFound, 12026 ...restProps, 12027 children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)( 12028 Content, 12029 { 12030 className: style_default8["content-inner"], 12031 render: render4, 12032 children 12033 } 12034 ) 12035 } 12036 ); 12037 } 12038 ); 12039 12040 // packages/ui/build-module/utils/render-slot-with-children.mjs 12041 var import_element27 = __toESM(require_element(), 1); 12042 function renderSlotWithChildren(slot, defaultSlot, children) { 12043 return (0, import_element27.cloneElement)(slot ?? defaultSlot, { children }); 12044 } 12045 12046 // packages/ui/build-module/lock-unlock.mjs 12047 var import_private_apis2 = __toESM(require_private_apis(), 1); 12048 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 12049 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 12050 "@wordpress/ui" 12051 ); 12052 12053 // packages/ui/build-module/stack/stack.mjs 12054 var import_element28 = __toESM(require_element(), 1); 12055 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; 12056 function getRuntime9() { 12057 const globalScope = globalThis; 12058 if (globalScope.__wpStyleRuntime) { 12059 return globalScope.__wpStyleRuntime; 12060 } 12061 globalScope.__wpStyleRuntime = { 12062 documents: /* @__PURE__ */ new Map(), 12063 styles: /* @__PURE__ */ new Map(), 12064 injectedStyles: /* @__PURE__ */ new WeakMap() 12065 }; 12066 if (typeof document !== "undefined") { 12067 registerDocument9(document); 12068 } 12069 return globalScope.__wpStyleRuntime; 12070 } 12071 function documentContainsStyleHash9(targetDocument, hash) { 12072 if (!targetDocument.head) { 12073 return false; 12074 } 12075 for (const style of targetDocument.head.querySelectorAll( 12076 `style[$STYLE_HASH_ATTRIBUTE9}]` 12077 )) { 12078 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { 12079 return true; 12080 } 12081 } 12082 return false; 12083 } 12084 function injectStyle9(targetDocument, hash, css) { 12085 if (!targetDocument.head) { 12086 return; 12087 } 12088 const runtime = getRuntime9(); 12089 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12090 if (!injectedStyles) { 12091 injectedStyles = /* @__PURE__ */ new Set(); 12092 runtime.injectedStyles.set(targetDocument, injectedStyles); 12093 } 12094 if (injectedStyles.has(hash)) { 12095 return; 12096 } 12097 if (documentContainsStyleHash9(targetDocument, hash)) { 12098 injectedStyles.add(hash); 12099 return; 12100 } 12101 const style = targetDocument.createElement("style"); 12102 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); 12103 style.appendChild(targetDocument.createTextNode(css)); 12104 targetDocument.head.appendChild(style); 12105 injectedStyles.add(hash); 12106 } 12107 function registerDocument9(targetDocument) { 12108 const runtime = getRuntime9(); 12109 runtime.documents.set( 12110 targetDocument, 12111 (runtime.documents.get(targetDocument) ?? 0) + 1 12112 ); 12113 for (const [hash, css] of runtime.styles) { 12114 injectStyle9(targetDocument, hash, css); 12115 } 12116 return () => { 12117 const count = runtime.documents.get(targetDocument); 12118 if (count === void 0) { 12119 return; 12120 } 12121 if (count <= 1) { 12122 runtime.documents.delete(targetDocument); 12123 return; 12124 } 12125 runtime.documents.set(targetDocument, count - 1); 12126 }; 12127 } 12128 function registerStyle9(hash, css) { 12129 const runtime = getRuntime9(); 12130 runtime.styles.set(hash, css); 12131 for (const targetDocument of runtime.documents.keys()) { 12132 injectStyle9(targetDocument, hash, css); 12133 } 12134 } 12135 if (typeof process === "undefined" || true) { 12136 registerStyle9("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 12137 } 12138 var style_default9 = { "stack": "_19ce0419607e1896__stack" }; 12139 var gapTokens = { 12140 xs: "var(--wpds-dimension-gap-xs, 4px)", 12141 sm: "var(--wpds-dimension-gap-sm, 8px)", 12142 md: "var(--wpds-dimension-gap-md, 12px)", 12143 lg: "var(--wpds-dimension-gap-lg, 16px)", 12144 xl: "var(--wpds-dimension-gap-xl, 24px)", 12145 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 12146 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 12147 }; 12148 var Stack = (0, import_element28.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) { 12149 const style = { 12150 gap: gap && gapTokens[gap], 12151 alignItems: align, 12152 justifyContent: justify, 12153 flexDirection: direction, 12154 flexWrap: wrap 12155 }; 12156 const element = useRender({ 12157 render: render4, 12158 ref, 12159 props: mergeProps(props, { style, className: style_default9.stack }) 12160 }); 12161 return element; 12162 }); 12163 12164 // packages/ui/build-module/tooltip/index.mjs 12165 var tooltip_exports = {}; 12166 __export(tooltip_exports, { 12167 Popup: () => Popup, 12168 Portal: () => Portal, 12169 Positioner: () => Positioner, 12170 Provider: () => Provider, 12171 Root: () => Root4, 12172 Trigger: () => Trigger2 12173 }); 12174 12175 // packages/ui/build-module/tooltip/popup.mjs 12176 var import_element31 = __toESM(require_element(), 1); 12177 var import_theme = __toESM(require_theme(), 1); 12178 12179 // packages/ui/build-module/tooltip/portal.mjs 12180 var import_element29 = __toESM(require_element(), 1); 12181 12182 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 12183 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; 12184 function getRuntime10() { 12185 const globalScope = globalThis; 12186 if (globalScope.__wpStyleRuntime) { 12187 return globalScope.__wpStyleRuntime; 12188 } 12189 globalScope.__wpStyleRuntime = { 12190 documents: /* @__PURE__ */ new Map(), 12191 styles: /* @__PURE__ */ new Map(), 12192 injectedStyles: /* @__PURE__ */ new WeakMap() 12193 }; 12194 if (typeof document !== "undefined") { 12195 registerDocument10(document); 12196 } 12197 return globalScope.__wpStyleRuntime; 12198 } 12199 function documentContainsStyleHash10(targetDocument, hash) { 12200 if (!targetDocument.head) { 12201 return false; 12202 } 12203 for (const style of targetDocument.head.querySelectorAll( 12204 `style[$STYLE_HASH_ATTRIBUTE10}]` 12205 )) { 12206 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { 12207 return true; 12208 } 12209 } 12210 return false; 12211 } 12212 function injectStyle10(targetDocument, hash, css) { 12213 if (!targetDocument.head) { 12214 return; 12215 } 12216 const runtime = getRuntime10(); 12217 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12218 if (!injectedStyles) { 12219 injectedStyles = /* @__PURE__ */ new Set(); 12220 runtime.injectedStyles.set(targetDocument, injectedStyles); 12221 } 12222 if (injectedStyles.has(hash)) { 12223 return; 12224 } 12225 if (documentContainsStyleHash10(targetDocument, hash)) { 12226 injectedStyles.add(hash); 12227 return; 12228 } 12229 const style = targetDocument.createElement("style"); 12230 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); 12231 style.appendChild(targetDocument.createTextNode(css)); 12232 targetDocument.head.appendChild(style); 12233 injectedStyles.add(hash); 12234 } 12235 function registerDocument10(targetDocument) { 12236 const runtime = getRuntime10(); 12237 runtime.documents.set( 12238 targetDocument, 12239 (runtime.documents.get(targetDocument) ?? 0) + 1 12240 ); 12241 for (const [hash, css] of runtime.styles) { 12242 injectStyle10(targetDocument, hash, css); 12243 } 12244 return () => { 12245 const count = runtime.documents.get(targetDocument); 12246 if (count === void 0) { 12247 return; 12248 } 12249 if (count <= 1) { 12250 runtime.documents.delete(targetDocument); 12251 return; 12252 } 12253 runtime.documents.set(targetDocument, count - 1); 12254 }; 12255 } 12256 function registerStyle10(hash, css) { 12257 const runtime = getRuntime10(); 12258 runtime.styles.set(hash, css); 12259 for (const targetDocument of runtime.documents.keys()) { 12260 injectStyle10(targetDocument, hash, css); 12261 } 12262 } 12263 if (typeof process === "undefined" || true) { 12264 registerStyle10("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}}}"); 12265 } 12266 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 12267 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 12268 function resolveOwnerDocument() { 12269 return typeof document === "undefined" ? null : document; 12270 } 12271 function isInWordPressEnvironment() { 12272 let topWp; 12273 try { 12274 topWp = window.top?.wp; 12275 } catch { 12276 } 12277 const wp = topWp ?? window.wp; 12278 return typeof wp?.components === "object" && wp.components !== null; 12279 } 12280 var cachedSlot = null; 12281 function createSlot(ownerDocument2) { 12282 const element = ownerDocument2.createElement("div"); 12283 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 12284 if (wp_compat_overlay_slot_default.slot) { 12285 element.classList.add(wp_compat_overlay_slot_default.slot); 12286 } 12287 ownerDocument2.body.appendChild(element); 12288 return element; 12289 } 12290 function getWpCompatOverlaySlot() { 12291 if (typeof window === "undefined") { 12292 return void 0; 12293 } 12294 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 12295 return void 0; 12296 } 12297 const ownerDocument2 = resolveOwnerDocument(); 12298 if (!ownerDocument2 || !ownerDocument2.body) { 12299 return void 0; 12300 } 12301 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 12302 return cachedSlot; 12303 } 12304 const existing = ownerDocument2.querySelector( 12305 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 12306 ); 12307 if (existing instanceof HTMLDivElement) { 12308 cachedSlot = existing; 12309 return existing; 12310 } 12311 if (cachedSlot?.isConnected) { 12312 cachedSlot.remove(); 12313 } 12314 cachedSlot = createSlot(ownerDocument2); 12315 return cachedSlot; 12316 } 12317 12318 // packages/ui/build-module/tooltip/portal.mjs 12319 var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1); 12320 var Portal = (0, import_element29.forwardRef)( 12321 function TooltipPortal3({ container, ...restProps }, ref) { 12322 return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( 12323 index_parts_exports2.Portal, 12324 { 12325 container: container ?? getWpCompatOverlaySlot(), 12326 ...restProps, 12327 ref 12328 } 12329 ); 12330 } 12331 ); 12332 12333 // packages/ui/build-module/tooltip/positioner.mjs 12334 var import_element30 = __toESM(require_element(), 1); 12335 var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1); 12336 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; 12337 function getRuntime11() { 12338 const globalScope = globalThis; 12339 if (globalScope.__wpStyleRuntime) { 12340 return globalScope.__wpStyleRuntime; 12341 } 12342 globalScope.__wpStyleRuntime = { 12343 documents: /* @__PURE__ */ new Map(), 12344 styles: /* @__PURE__ */ new Map(), 12345 injectedStyles: /* @__PURE__ */ new WeakMap() 12346 }; 12347 if (typeof document !== "undefined") { 12348 registerDocument11(document); 12349 } 12350 return globalScope.__wpStyleRuntime; 12351 } 12352 function documentContainsStyleHash11(targetDocument, hash) { 12353 if (!targetDocument.head) { 12354 return false; 12355 } 12356 for (const style of targetDocument.head.querySelectorAll( 12357 `style[$STYLE_HASH_ATTRIBUTE11}]` 12358 )) { 12359 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { 12360 return true; 12361 } 12362 } 12363 return false; 12364 } 12365 function injectStyle11(targetDocument, hash, css) { 12366 if (!targetDocument.head) { 12367 return; 12368 } 12369 const runtime = getRuntime11(); 12370 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12371 if (!injectedStyles) { 12372 injectedStyles = /* @__PURE__ */ new Set(); 12373 runtime.injectedStyles.set(targetDocument, injectedStyles); 12374 } 12375 if (injectedStyles.has(hash)) { 12376 return; 12377 } 12378 if (documentContainsStyleHash11(targetDocument, hash)) { 12379 injectedStyles.add(hash); 12380 return; 12381 } 12382 const style = targetDocument.createElement("style"); 12383 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); 12384 style.appendChild(targetDocument.createTextNode(css)); 12385 targetDocument.head.appendChild(style); 12386 injectedStyles.add(hash); 12387 } 12388 function registerDocument11(targetDocument) { 12389 const runtime = getRuntime11(); 12390 runtime.documents.set( 12391 targetDocument, 12392 (runtime.documents.get(targetDocument) ?? 0) + 1 12393 ); 12394 for (const [hash, css] of runtime.styles) { 12395 injectStyle11(targetDocument, hash, css); 12396 } 12397 return () => { 12398 const count = runtime.documents.get(targetDocument); 12399 if (count === void 0) { 12400 return; 12401 } 12402 if (count <= 1) { 12403 runtime.documents.delete(targetDocument); 12404 return; 12405 } 12406 runtime.documents.set(targetDocument, count - 1); 12407 }; 12408 } 12409 function registerStyle11(hash, css) { 12410 const runtime = getRuntime11(); 12411 runtime.styles.set(hash, css); 12412 for (const targetDocument of runtime.documents.keys()) { 12413 injectStyle11(targetDocument, hash, css); 12414 } 12415 } 12416 if (typeof process === "undefined" || true) { 12417 registerStyle11("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 12418 } 12419 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 12420 if (typeof process === "undefined" || true) { 12421 registerStyle11("4811d023d1", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-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}}}}'); 12422 } 12423 var style_default10 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 12424 var Positioner = (0, import_element30.forwardRef)( 12425 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 12426 return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)( 12427 index_parts_exports2.Positioner, 12428 { 12429 ref, 12430 align, 12431 side, 12432 sideOffset, 12433 ...props, 12434 className: clsx_default( 12435 resets_default2["box-sizing"], 12436 style_default10.positioner, 12437 className 12438 ) 12439 } 12440 ); 12441 } 12442 ); 12443 12444 // packages/ui/build-module/tooltip/popup.mjs 12445 var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1); 12446 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; 12447 function getRuntime12() { 12448 const globalScope = globalThis; 12449 if (globalScope.__wpStyleRuntime) { 12450 return globalScope.__wpStyleRuntime; 12451 } 12452 globalScope.__wpStyleRuntime = { 12453 documents: /* @__PURE__ */ new Map(), 12454 styles: /* @__PURE__ */ new Map(), 12455 injectedStyles: /* @__PURE__ */ new WeakMap() 12456 }; 12457 if (typeof document !== "undefined") { 12458 registerDocument12(document); 12459 } 12460 return globalScope.__wpStyleRuntime; 12461 } 12462 function documentContainsStyleHash12(targetDocument, hash) { 12463 if (!targetDocument.head) { 12464 return false; 12465 } 12466 for (const style of targetDocument.head.querySelectorAll( 12467 `style[$STYLE_HASH_ATTRIBUTE12}]` 12468 )) { 12469 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { 12470 return true; 12471 } 12472 } 12473 return false; 12474 } 12475 function injectStyle12(targetDocument, hash, css) { 12476 if (!targetDocument.head) { 12477 return; 12478 } 12479 const runtime = getRuntime12(); 12480 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12481 if (!injectedStyles) { 12482 injectedStyles = /* @__PURE__ */ new Set(); 12483 runtime.injectedStyles.set(targetDocument, injectedStyles); 12484 } 12485 if (injectedStyles.has(hash)) { 12486 return; 12487 } 12488 if (documentContainsStyleHash12(targetDocument, hash)) { 12489 injectedStyles.add(hash); 12490 return; 12491 } 12492 const style = targetDocument.createElement("style"); 12493 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); 12494 style.appendChild(targetDocument.createTextNode(css)); 12495 targetDocument.head.appendChild(style); 12496 injectedStyles.add(hash); 12497 } 12498 function registerDocument12(targetDocument) { 12499 const runtime = getRuntime12(); 12500 runtime.documents.set( 12501 targetDocument, 12502 (runtime.documents.get(targetDocument) ?? 0) + 1 12503 ); 12504 for (const [hash, css] of runtime.styles) { 12505 injectStyle12(targetDocument, hash, css); 12506 } 12507 return () => { 12508 const count = runtime.documents.get(targetDocument); 12509 if (count === void 0) { 12510 return; 12511 } 12512 if (count <= 1) { 12513 runtime.documents.delete(targetDocument); 12514 return; 12515 } 12516 runtime.documents.set(targetDocument, count - 1); 12517 }; 12518 } 12519 function registerStyle12(hash, css) { 12520 const runtime = getRuntime12(); 12521 runtime.styles.set(hash, css); 12522 for (const targetDocument of runtime.documents.keys()) { 12523 injectStyle12(targetDocument, hash, css); 12524 } 12525 } 12526 if (typeof process === "undefined" || true) { 12527 registerStyle12("4811d023d1", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-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}}}}'); 12528 } 12529 var style_default11 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 12530 var ThemeProvider = unlock2(import_theme.privateApis).ThemeProvider; 12531 var POPUP_COLOR = { background: "#1e1e1e" }; 12532 var Popup = (0, import_element31.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 12533 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)( 12534 index_parts_exports2.Popup, 12535 { 12536 ref, 12537 className: clsx_default(style_default11.popup, className), 12538 ...props, 12539 children 12540 } 12541 ) }); 12542 const positionedPopup = renderSlotWithChildren( 12543 positioner, 12544 /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Positioner, {}), 12545 popupContent 12546 ); 12547 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Portal, {}), positionedPopup); 12548 }); 12549 12550 // packages/ui/build-module/tooltip/trigger.mjs 12551 var import_element32 = __toESM(require_element(), 1); 12552 var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1); 12553 var Trigger2 = (0, import_element32.forwardRef)( 12554 function TooltipTrigger3(props, ref) { 12555 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(index_parts_exports2.Trigger, { ref, ...props }); 12556 } 12557 ); 12558 12559 // packages/ui/build-module/tooltip/root.mjs 12560 var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1); 12561 function Root4(props) { 12562 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(index_parts_exports2.Root, { ...props }); 12563 } 12564 12565 // packages/ui/build-module/tooltip/provider.mjs 12566 var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1); 12567 function Provider({ ...props }) { 12568 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(index_parts_exports2.Provider, { ...props }); 12569 } 12570 12571 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 12572 var import_element33 = __toESM(require_element(), 1); 12573 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; 12574 function getRuntime13() { 12575 const globalScope = globalThis; 12576 if (globalScope.__wpStyleRuntime) { 12577 return globalScope.__wpStyleRuntime; 12578 } 12579 globalScope.__wpStyleRuntime = { 12580 documents: /* @__PURE__ */ new Map(), 12581 styles: /* @__PURE__ */ new Map(), 12582 injectedStyles: /* @__PURE__ */ new WeakMap() 12583 }; 12584 if (typeof document !== "undefined") { 12585 registerDocument13(document); 12586 } 12587 return globalScope.__wpStyleRuntime; 12588 } 12589 function documentContainsStyleHash13(targetDocument, hash) { 12590 if (!targetDocument.head) { 12591 return false; 12592 } 12593 for (const style of targetDocument.head.querySelectorAll( 12594 `style[$STYLE_HASH_ATTRIBUTE13}]` 12595 )) { 12596 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { 12597 return true; 12598 } 12599 } 12600 return false; 12601 } 12602 function injectStyle13(targetDocument, hash, css) { 12603 if (!targetDocument.head) { 12604 return; 12605 } 12606 const runtime = getRuntime13(); 12607 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12608 if (!injectedStyles) { 12609 injectedStyles = /* @__PURE__ */ new Set(); 12610 runtime.injectedStyles.set(targetDocument, injectedStyles); 12611 } 12612 if (injectedStyles.has(hash)) { 12613 return; 12614 } 12615 if (documentContainsStyleHash13(targetDocument, hash)) { 12616 injectedStyles.add(hash); 12617 return; 12618 } 12619 const style = targetDocument.createElement("style"); 12620 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); 12621 style.appendChild(targetDocument.createTextNode(css)); 12622 targetDocument.head.appendChild(style); 12623 injectedStyles.add(hash); 12624 } 12625 function registerDocument13(targetDocument) { 12626 const runtime = getRuntime13(); 12627 runtime.documents.set( 12628 targetDocument, 12629 (runtime.documents.get(targetDocument) ?? 0) + 1 12630 ); 12631 for (const [hash, css] of runtime.styles) { 12632 injectStyle13(targetDocument, hash, css); 12633 } 12634 return () => { 12635 const count = runtime.documents.get(targetDocument); 12636 if (count === void 0) { 12637 return; 12638 } 12639 if (count <= 1) { 12640 runtime.documents.delete(targetDocument); 12641 return; 12642 } 12643 runtime.documents.set(targetDocument, count - 1); 12644 }; 12645 } 12646 function registerStyle13(hash, css) { 12647 const runtime = getRuntime13(); 12648 runtime.styles.set(hash, css); 12649 for (const targetDocument of runtime.documents.keys()) { 12650 injectStyle13(targetDocument, hash, css); 12651 } 12652 } 12653 if (typeof process === "undefined" || true) { 12654 registerStyle13("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}}}"); 12655 } 12656 var style_default12 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 12657 var VisuallyHidden = (0, import_element33.forwardRef)( 12658 function VisuallyHidden2({ render: render4, ...restProps }, ref) { 12659 const element = useRender({ 12660 render: render4, 12661 ref, 12662 props: mergeProps( 12663 { className: style_default12["visually-hidden"] }, 12664 restProps, 12665 { 12666 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 12667 "data-visually-hidden": "" 12668 } 12669 ) 12670 }); 12671 return element; 12672 } 12673 ); 12674 12675 // packages/admin-ui/build-module/navigable-region/index.mjs 12676 var import_element34 = __toESM(require_element(), 1); 12677 var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1); 12678 var NavigableRegion = (0, import_element34.forwardRef)( 12679 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 12680 return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)( 12681 Tag, 12682 { 12683 ref, 12684 className: clsx_default("admin-ui-navigable-region", className), 12685 "aria-label": ariaLabel, 12686 role: "region", 12687 tabIndex: "-1", 12688 ...props, 12689 children 12690 } 12691 ); 12692 } 12693 ); 12694 NavigableRegion.displayName = "NavigableRegion"; 12695 var navigable_region_default = NavigableRegion; 12696 12697 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs 12698 var import_components = __toESM(require_components(), 1); 12699 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components.createSlotFill)("SidebarToggle"); 12700 12701 // packages/admin-ui/build-module/page/header.mjs 12702 var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1); 12703 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; 12704 function getRuntime14() { 12705 const globalScope = globalThis; 12706 if (globalScope.__wpStyleRuntime) { 12707 return globalScope.__wpStyleRuntime; 12708 } 12709 globalScope.__wpStyleRuntime = { 12710 documents: /* @__PURE__ */ new Map(), 12711 styles: /* @__PURE__ */ new Map(), 12712 injectedStyles: /* @__PURE__ */ new WeakMap() 12713 }; 12714 if (typeof document !== "undefined") { 12715 registerDocument14(document); 12716 } 12717 return globalScope.__wpStyleRuntime; 12718 } 12719 function documentContainsStyleHash14(targetDocument, hash) { 12720 if (!targetDocument.head) { 12721 return false; 12722 } 12723 for (const style of targetDocument.head.querySelectorAll( 12724 `style[$STYLE_HASH_ATTRIBUTE14}]` 12725 )) { 12726 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { 12727 return true; 12728 } 12729 } 12730 return false; 12731 } 12732 function injectStyle14(targetDocument, hash, css) { 12733 if (!targetDocument.head) { 12734 return; 12735 } 12736 const runtime = getRuntime14(); 12737 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12738 if (!injectedStyles) { 12739 injectedStyles = /* @__PURE__ */ new Set(); 12740 runtime.injectedStyles.set(targetDocument, injectedStyles); 12741 } 12742 if (injectedStyles.has(hash)) { 12743 return; 12744 } 12745 if (documentContainsStyleHash14(targetDocument, hash)) { 12746 injectedStyles.add(hash); 12747 return; 12748 } 12749 const style = targetDocument.createElement("style"); 12750 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); 12751 style.appendChild(targetDocument.createTextNode(css)); 12752 targetDocument.head.appendChild(style); 12753 injectedStyles.add(hash); 12754 } 12755 function registerDocument14(targetDocument) { 12756 const runtime = getRuntime14(); 12757 runtime.documents.set( 12758 targetDocument, 12759 (runtime.documents.get(targetDocument) ?? 0) + 1 12760 ); 12761 for (const [hash, css] of runtime.styles) { 12762 injectStyle14(targetDocument, hash, css); 12763 } 12764 return () => { 12765 const count = runtime.documents.get(targetDocument); 12766 if (count === void 0) { 12767 return; 12768 } 12769 if (count <= 1) { 12770 runtime.documents.delete(targetDocument); 12771 return; 12772 } 12773 runtime.documents.set(targetDocument, count - 1); 12774 }; 12775 } 12776 function registerStyle14(hash, css) { 12777 const runtime = getRuntime14(); 12778 runtime.styles.set(hash, css); 12779 for (const targetDocument of runtime.documents.keys()) { 12780 injectStyle14(targetDocument, hash, css); 12781 } 12782 } 12783 if (typeof process === "undefined" || true) { 12784 registerStyle14("683dd16f2c", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-bg-surface-neutral,#fcfcfc);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:calc(var(--wpds-dimension-base, 4px)*8)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:calc(var(--wpds-dimension-base, 4px)*6);width:calc(var(--wpds-dimension-base, 4px)*6);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-fg-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 12785 } 12786 var style_default13 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 12787 function Header3({ 12788 headingLevel = 1, 12789 breadcrumbs, 12790 badges, 12791 visual, 12792 title, 12793 subTitle, 12794 actions, 12795 showSidebarToggle = true 12796 }) { 12797 const HeadingTag = `h$headingLevel}`; 12798 return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Stack, { direction: "column", className: style_default13.header, children: [ 12799 /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)( 12800 Stack, 12801 { 12802 className: style_default13["header-content"], 12803 direction: "row", 12804 gap: "sm", 12805 justify: "space-between", 12806 children: [ 12807 /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", justify: "start", children: [ 12808 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)( 12809 SidebarToggleSlot, 12810 { 12811 bubblesVirtually: true, 12812 className: style_default13["sidebar-toggle-slot"] 12813 } 12814 ), 12815 visual && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)( 12816 "div", 12817 { 12818 className: style_default13["header-visual"], 12819 "aria-hidden": "true", 12820 children: visual 12821 } 12822 ), 12823 title && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)( 12824 Text, 12825 { 12826 className: style_default13["header-title"], 12827 render: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(HeadingTag, {}), 12828 variant: "heading-lg", 12829 children: title 12830 } 12831 ), 12832 breadcrumbs, 12833 badges 12834 ] }), 12835 actions && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)( 12836 Stack, 12837 { 12838 align: "center", 12839 className: style_default13["header-actions"], 12840 direction: "row", 12841 gap: "sm", 12842 children: actions 12843 } 12844 ) 12845 ] 12846 } 12847 ), 12848 subTitle && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)( 12849 Text, 12850 { 12851 render: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", {}), 12852 variant: "body-md", 12853 className: style_default13["header-subtitle"], 12854 children: subTitle 12855 } 12856 ) 12857 ] }); 12858 } 12859 12860 // packages/admin-ui/build-module/page/index.mjs 12861 var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1); 12862 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; 12863 function getRuntime15() { 12864 const globalScope = globalThis; 12865 if (globalScope.__wpStyleRuntime) { 12866 return globalScope.__wpStyleRuntime; 12867 } 12868 globalScope.__wpStyleRuntime = { 12869 documents: /* @__PURE__ */ new Map(), 12870 styles: /* @__PURE__ */ new Map(), 12871 injectedStyles: /* @__PURE__ */ new WeakMap() 12872 }; 12873 if (typeof document !== "undefined") { 12874 registerDocument15(document); 12875 } 12876 return globalScope.__wpStyleRuntime; 12877 } 12878 function documentContainsStyleHash15(targetDocument, hash) { 12879 if (!targetDocument.head) { 12880 return false; 12881 } 12882 for (const style of targetDocument.head.querySelectorAll( 12883 `style[$STYLE_HASH_ATTRIBUTE15}]` 12884 )) { 12885 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { 12886 return true; 12887 } 12888 } 12889 return false; 12890 } 12891 function injectStyle15(targetDocument, hash, css) { 12892 if (!targetDocument.head) { 12893 return; 12894 } 12895 const runtime = getRuntime15(); 12896 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12897 if (!injectedStyles) { 12898 injectedStyles = /* @__PURE__ */ new Set(); 12899 runtime.injectedStyles.set(targetDocument, injectedStyles); 12900 } 12901 if (injectedStyles.has(hash)) { 12902 return; 12903 } 12904 if (documentContainsStyleHash15(targetDocument, hash)) { 12905 injectedStyles.add(hash); 12906 return; 12907 } 12908 const style = targetDocument.createElement("style"); 12909 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); 12910 style.appendChild(targetDocument.createTextNode(css)); 12911 targetDocument.head.appendChild(style); 12912 injectedStyles.add(hash); 12913 } 12914 function registerDocument15(targetDocument) { 12915 const runtime = getRuntime15(); 12916 runtime.documents.set( 12917 targetDocument, 12918 (runtime.documents.get(targetDocument) ?? 0) + 1 12919 ); 12920 for (const [hash, css] of runtime.styles) { 12921 injectStyle15(targetDocument, hash, css); 12922 } 12923 return () => { 12924 const count = runtime.documents.get(targetDocument); 12925 if (count === void 0) { 12926 return; 12927 } 12928 if (count <= 1) { 12929 runtime.documents.delete(targetDocument); 12930 return; 12931 } 12932 runtime.documents.set(targetDocument, count - 1); 12933 }; 12934 } 12935 function registerStyle15(hash, css) { 12936 const runtime = getRuntime15(); 12937 runtime.styles.set(hash, css); 12938 for (const targetDocument of runtime.documents.keys()) { 12939 injectStyle15(targetDocument, hash, css); 12940 } 12941 } 12942 if (typeof process === "undefined" || true) { 12943 registerStyle15("683dd16f2c", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-bg-surface-neutral,#fcfcfc);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:calc(var(--wpds-dimension-base, 4px)*8)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:calc(var(--wpds-dimension-base, 4px)*6);width:calc(var(--wpds-dimension-base, 4px)*6);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-fg-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 12944 } 12945 var style_default14 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 12946 function Page({ 12947 headingLevel, 12948 breadcrumbs, 12949 badges, 12950 visual, 12951 title, 12952 subTitle, 12953 children, 12954 className, 12955 actions, 12956 ariaLabel, 12957 hasPadding = false, 12958 showSidebarToggle = true 12959 }) { 12960 const classes = clsx_default(style_default14.page, className); 12961 const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : ""); 12962 return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [ 12963 (title || breadcrumbs || badges || actions || visual) && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)( 12964 Header3, 12965 { 12966 headingLevel, 12967 breadcrumbs, 12968 badges, 12969 visual, 12970 title, 12971 subTitle, 12972 actions, 12973 showSidebarToggle 12974 } 12975 ), 12976 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)( 12977 "div", 12978 { 12979 className: clsx_default( 12980 style_default14.content, 12981 style_default14["has-padding"] 12982 ), 12983 children 12984 } 12985 ) : children 12986 ] }); 12987 } 12988 Page.SidebarToggleFill = SidebarToggleFill; 12989 var page_default2 = Page; 12990 12991 // packages/admin-ui/build-module/admin-theme-colors/index.mjs 12992 var DEFAULT_THEME_COLORS = { 12993 primary: "#3858e9", 12994 background: "#25292b" 12995 }; 12996 var ADMIN_THEME_COLORS = /* @__PURE__ */ new Map([ 12997 ["fresh", DEFAULT_THEME_COLORS], 12998 ["modern", { primary: "#3858e9", background: "#222524" }], 12999 ["midnight", { primary: "#cf4339", background: "#3d4042" }], 13000 ["coffee", { primary: "#916745", background: "#5b534d" }], 13001 ["ocean", { primary: "#567958", background: "#5f787f" }], 13002 ["blue", { primary: "#437aa8", background: "#3876a8" }], 13003 ["ectoplasm", { primary: "#646c3e", background: "#4f386e" }], 13004 ["sunrise", { primary: "#ad631e", background: "#cc4541" }], 13005 ["light", { primary: "#007cba", background: "#eaeeed" }] 13006 ]); 13007 function getAdminThemeColors() { 13008 const scheme = document.body.className.match(/admin-color-([\w-]+)/)?.[1] ?? "fresh"; 13009 return ADMIN_THEME_COLORS.get(scheme) ?? DEFAULT_THEME_COLORS; 13010 } 13011 13012 // packages/edit-site/build-module/components/layout/index.mjs 13013 var import_components8 = __toESM(require_components(), 1); 13014 var import_compose2 = __toESM(require_compose(), 1); 13015 var import_i18n8 = __toESM(require_i18n(), 1); 13016 var import_element43 = __toESM(require_element(), 1); 13017 var import_editor6 = __toESM(require_editor(), 1); 13018 var import_router6 = __toESM(require_router(), 1); 13019 var import_theme2 = __toESM(require_theme(), 1); 13020 var import_plugins2 = __toESM(require_plugins(), 1); 13021 var import_notices = __toESM(require_notices(), 1); 13022 var import_data13 = __toESM(require_data(), 1); 13023 var import_preferences3 = __toESM(require_preferences(), 1); 13024 13025 // packages/edit-site/build-module/components/site-hub/index.mjs 13026 var import_data5 = __toESM(require_data(), 1); 13027 var import_components3 = __toESM(require_components(), 1); 13028 var import_i18n3 = __toESM(require_i18n(), 1); 13029 var import_core_data4 = __toESM(require_core_data(), 1); 13030 var import_html_entities = __toESM(require_html_entities(), 1); 13031 var import_element36 = __toESM(require_element(), 1); 13032 var import_commands = __toESM(require_commands(), 1); 13033 var import_keycodes = __toESM(require_keycodes(), 1); 13034 var import_url = __toESM(require_url(), 1); 13035 var import_router = __toESM(require_router(), 1); 13036 13037 // packages/edit-site/build-module/components/site-icon/index.mjs 13038 var import_data4 = __toESM(require_data(), 1); 13039 var import_components2 = __toESM(require_components(), 1); 13040 var import_i18n2 = __toESM(require_i18n(), 1); 13041 var import_core_data3 = __toESM(require_core_data(), 1); 13042 var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1); 13043 function SiteIcon({ className }) { 13044 const { isRequestingSite, siteIconUrl } = (0, import_data4.useSelect)((select4) => { 13045 const { getEntityRecord } = select4(import_core_data3.store); 13046 const siteData = getEntityRecord("root", "__unstableBase", void 0); 13047 return { 13048 isRequestingSite: !siteData, 13049 siteIconUrl: siteData?.site_icon_url 13050 }; 13051 }, []); 13052 if (isRequestingSite && !siteIconUrl) { 13053 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "edit-site-site-icon__image" }); 13054 } 13055 const icon = siteIconUrl ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)( 13056 "img", 13057 { 13058 className: "edit-site-site-icon__image", 13059 alt: (0, import_i18n2.__)("Site Icon"), 13060 src: siteIconUrl 13061 } 13062 ) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)( 13063 import_components2.Icon, 13064 { 13065 className: "edit-site-site-icon__icon", 13066 icon: wordpress_default, 13067 size: 48 13068 } 13069 ); 13070 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: clsx_default(className, "edit-site-site-icon"), children: icon }); 13071 } 13072 var site_icon_default = SiteIcon; 13073 13074 // packages/edit-site/build-module/components/sidebar/index.mjs 13075 var import_element35 = __toESM(require_element(), 1); 13076 var import_dom22 = __toESM(require_dom(), 1); 13077 var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1); 13078 var SidebarNavigationContext = (0, import_element35.createContext)(() => { 13079 }); 13080 SidebarNavigationContext.displayName = "SidebarNavigationContext"; 13081 function focusSidebarElement(el, direction, focusSelector) { 13082 let elementToFocus; 13083 if (direction === "back" && focusSelector) { 13084 elementToFocus = el.querySelector(focusSelector); 13085 } 13086 if (direction !== null && !elementToFocus) { 13087 const [firstTabbable] = import_dom22.focus.tabbable.find(el); 13088 elementToFocus = firstTabbable ?? el; 13089 } 13090 elementToFocus?.focus(); 13091 } 13092 function createNavState() { 13093 let state = { 13094 direction: null, 13095 focusSelector: null 13096 }; 13097 return { 13098 get() { 13099 return state; 13100 }, 13101 navigate(direction, focusSelector = null) { 13102 state = { 13103 direction, 13104 focusSelector: direction === "forward" && focusSelector ? focusSelector : state.focusSelector 13105 }; 13106 } 13107 }; 13108 } 13109 function SidebarContentWrapper({ children, shouldAnimate }) { 13110 const navState = (0, import_element35.useContext)(SidebarNavigationContext); 13111 const wrapperRef = (0, import_element35.useRef)(); 13112 const [navAnimation, setNavAnimation] = (0, import_element35.useState)(null); 13113 (0, import_element35.useLayoutEffect)(() => { 13114 const { direction, focusSelector } = navState.get(); 13115 focusSidebarElement(wrapperRef.current, direction, focusSelector); 13116 setNavAnimation(direction); 13117 }, [navState]); 13118 const wrapperCls = clsx_default( 13119 "edit-site-sidebar__screen-wrapper", 13120 /* 13121 * Some panes do not have sub-panes and therefore 13122 * should not animate when clicked on. 13123 */ 13124 shouldAnimate ? { 13125 "slide-from-left": navAnimation === "back", 13126 "slide-from-right": navAnimation === "forward" 13127 } : {} 13128 ); 13129 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { ref: wrapperRef, className: wrapperCls, children }); 13130 } 13131 function SidebarNavigationProvider({ children }) { 13132 const [navState] = (0, import_element35.useState)(createNavState); 13133 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SidebarNavigationContext.Provider, { value: navState, children }); 13134 } 13135 function SidebarContent({ routeKey, shouldAnimate, children }) { 13136 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "edit-site-sidebar__content", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)( 13137 SidebarContentWrapper, 13138 { 13139 shouldAnimate, 13140 children 13141 }, 13142 routeKey 13143 ) }); 13144 } 13145 13146 // packages/edit-site/build-module/components/site-hub/index.mjs 13147 var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1); 13148 var { useLocation, useHistory } = unlock(import_router.privateApis); 13149 var SiteHub = (0, import_element36.memo)( 13150 (0, import_element36.forwardRef)(({ isTransparent }, ref) => { 13151 const { dashboardLink, homeUrl, siteTitle } = (0, import_data5.useSelect)((select4) => { 13152 const { getSettings: getSettings7 } = unlock(select4(store)); 13153 const { getEntityRecord } = select4(import_core_data4.store); 13154 const _site = getEntityRecord("root", "site"); 13155 return { 13156 dashboardLink: getSettings7().__experimentalDashboardLink, 13157 homeUrl: getEntityRecord("root", "__unstableBase")?.home, 13158 siteTitle: !_site?.title && !!_site?.url ? (0, import_url.filterURLForDisplay)(_site?.url) : _site?.title 13159 }; 13160 }, []); 13161 const { open: openCommandCenter } = (0, import_data5.useDispatch)(import_commands.store); 13162 return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_components3.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [ 13163 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13164 "div", 13165 { 13166 className: clsx_default( 13167 "edit-site-site-hub__view-mode-toggle-container", 13168 { 13169 "has-transparent-background": isTransparent 13170 } 13171 ), 13172 children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13173 import_components3.Button, 13174 { 13175 __next40pxDefaultSize: true, 13176 ref, 13177 href: dashboardLink, 13178 label: (0, import_i18n3.__)("Go to the Dashboard"), 13179 className: "edit-site-layout__view-mode-toggle", 13180 style: { 13181 transform: "scale(0.5333) translateX(-4px)", 13182 // Offset to position the icon 12px from viewport edge 13183 borderRadius: 4 13184 }, 13185 children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" }) 13186 } 13187 ) 13188 } 13189 ), 13190 /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_components3.__experimentalHStack, { children: [ 13191 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)( 13192 import_components3.Button, 13193 { 13194 __next40pxDefaultSize: true, 13195 variant: "link", 13196 href: homeUrl, 13197 target: "_blank", 13198 children: [ 13199 (0, import_html_entities.decodeEntities)(siteTitle), 13200 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(VisuallyHidden, { 13201 render: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", {}), 13202 /* translators: accessibility text */ 13203 children: (0, import_i18n3.__)("(opens in a new tab)") 13204 }) 13205 ] 13206 } 13207 ) }), 13208 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13209 import_components3.__experimentalHStack, 13210 { 13211 spacing: 0, 13212 expanded: false, 13213 className: "edit-site-site-hub__actions", 13214 children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13215 import_components3.Button, 13216 { 13217 size: "compact", 13218 className: "edit-site-site-hub_toggle-command-center", 13219 icon: search_default, 13220 onClick: () => openCommandCenter(), 13221 label: (0, import_i18n3.__)("Open command palette"), 13222 shortcut: import_keycodes.displayShortcut.primary("k") 13223 } 13224 ) 13225 } 13226 ) 13227 ] }) 13228 ] }) }); 13229 }) 13230 ); 13231 var site_hub_default = SiteHub; 13232 var SiteHubMobile = (0, import_element36.memo)( 13233 (0, import_element36.forwardRef)(({ isTransparent }, ref) => { 13234 const { path } = useLocation(); 13235 const history = useHistory(); 13236 const { navigate } = (0, import_element36.useContext)(SidebarNavigationContext); 13237 const hasAdminBarInEditor = window.__experimentalAdminBarInEditor; 13238 const { 13239 dashboardLink, 13240 homeUrl, 13241 siteTitle, 13242 isBlockTheme, 13243 isClassicThemeWithStyleBookSupport: isClassicThemeWithStyleBookSupport2 13244 } = (0, import_data5.useSelect)((select4) => { 13245 const { getSettings: getSettings7 } = unlock(select4(store)); 13246 const { getEntityRecord, getCurrentTheme } = select4(import_core_data4.store); 13247 const _site = getEntityRecord("root", "site"); 13248 const currentTheme = getCurrentTheme(); 13249 const settings2 = getSettings7(); 13250 const supportsEditorStyles = currentTheme?.theme_supports["editor-styles"]; 13251 const hasThemeJson = settings2.supportsLayout; 13252 return { 13253 dashboardLink: settings2.__experimentalDashboardLink, 13254 homeUrl: getEntityRecord("root", "__unstableBase")?.home, 13255 siteTitle: !_site?.title && !!_site?.url ? (0, import_url.filterURLForDisplay)(_site?.url) : _site?.title, 13256 isBlockTheme: currentTheme?.is_block_theme, 13257 isClassicThemeWithStyleBookSupport: !currentTheme?.is_block_theme && (supportsEditorStyles || hasThemeJson) 13258 }; 13259 }, []); 13260 const { open: openCommandCenter } = (0, import_data5.useDispatch)(import_commands.store); 13261 let backPath; 13262 if (path !== "/") { 13263 if (isBlockTheme || isClassicThemeWithStyleBookSupport2) { 13264 backPath = "/"; 13265 } else if (path !== "/pattern") { 13266 backPath = "/pattern"; 13267 } 13268 } 13269 const backButtonProps = { 13270 href: !!backPath ? void 0 : dashboardLink, 13271 label: !!backPath ? (0, import_i18n3.__)("Go to Site Editor") : (0, import_i18n3.__)("Go to the Dashboard"), 13272 onClick: !!backPath ? () => { 13273 history.navigate(backPath); 13274 navigate("back"); 13275 } : void 0 13276 }; 13277 return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_components3.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [ 13278 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13279 "div", 13280 { 13281 className: clsx_default( 13282 "edit-site-site-hub__view-mode-toggle-container", 13283 { 13284 "has-transparent-background": isTransparent 13285 } 13286 ), 13287 children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13288 import_components3.Button, 13289 { 13290 __next40pxDefaultSize: true, 13291 ref, 13292 className: "edit-site-layout__view-mode-toggle", 13293 style: { 13294 transform: "scale(0.5)", 13295 borderRadius: 4 13296 }, 13297 ...backButtonProps, 13298 children: hasAdminBarInEditor ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13299 icon_default, 13300 { 13301 icon: (0, import_i18n3.isRTL)() ? arrow_up_right_default : arrow_up_left_default, 13302 size: 48 13303 } 13304 ) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" }) 13305 } 13306 ) 13307 } 13308 ), 13309 /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_components3.__experimentalHStack, { children: [ 13310 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13311 import_components3.Button, 13312 { 13313 __next40pxDefaultSize: true, 13314 variant: "link", 13315 href: homeUrl, 13316 target: "_blank", 13317 label: (0, import_i18n3.__)("View site (opens in a new tab)"), 13318 children: (0, import_html_entities.decodeEntities)(siteTitle) 13319 } 13320 ) }), 13321 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13322 import_components3.__experimentalHStack, 13323 { 13324 spacing: 0, 13325 expanded: false, 13326 className: "edit-site-site-hub__actions", 13327 children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 13328 import_components3.Button, 13329 { 13330 __next40pxDefaultSize: true, 13331 className: "edit-site-site-hub_toggle-command-center", 13332 icon: search_default, 13333 onClick: () => openCommandCenter(), 13334 label: (0, import_i18n3.__)("Open command palette"), 13335 shortcut: import_keycodes.displayShortcut.primary("k") 13336 } 13337 ) 13338 } 13339 ) 13340 ] }) 13341 ] }) }); 13342 }) 13343 ); 13344 13345 // packages/edit-site/build-module/components/resizable-frame/index.mjs 13346 var import_element37 = __toESM(require_element(), 1); 13347 var import_components4 = __toESM(require_components(), 1); 13348 var import_compose = __toESM(require_compose(), 1); 13349 var import_i18n4 = __toESM(require_i18n(), 1); 13350 var import_router2 = __toESM(require_router(), 1); 13351 var import_data6 = __toESM(require_data(), 1); 13352 var import_core_data5 = __toESM(require_core_data(), 1); 13353 var import_url2 = __toESM(require_url(), 1); 13354 var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1); 13355 var { useLocation: useLocation2, useHistory: useHistory2 } = unlock(import_router2.privateApis); 13356 var HANDLE_STYLES_OVERRIDE = { 13357 position: void 0, 13358 userSelect: void 0, 13359 cursor: void 0, 13360 width: void 0, 13361 height: void 0, 13362 top: void 0, 13363 right: void 0, 13364 bottom: void 0, 13365 left: void 0 13366 }; 13367 var FRAME_MIN_WIDTH = 320; 13368 var FRAME_REFERENCE_WIDTH = 1300; 13369 var FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; 13370 var SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200; 13371 var INITIAL_FRAME_SIZE = { width: "100%", height: "100%" }; 13372 function calculateNewHeight(width, initialAspectRatio) { 13373 const lerp = (a2, b2, amount) => { 13374 return a2 + (b2 - a2) * amount; 13375 }; 13376 const lerpFactor = 1 - Math.max( 13377 0, 13378 Math.min( 13379 1, 13380 (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH) 13381 ) 13382 ); 13383 const intermediateAspectRatio = lerp( 13384 initialAspectRatio, 13385 FRAME_TARGET_ASPECT_RATIO, 13386 lerpFactor 13387 ); 13388 return width / intermediateAspectRatio; 13389 } 13390 function ResizableFrame({ 13391 isFullWidth, 13392 isOversized, 13393 setIsOversized, 13394 isReady, 13395 children, 13396 /** The default (unresized) width/height of the frame, based on the space available in the viewport. */ 13397 defaultSize, 13398 innerContentStyle 13399 }) { 13400 const history = useHistory2(); 13401 const { path, query } = useLocation2(); 13402 const { canvas = "view" } = query; 13403 const disableMotion = (0, import_compose.useReducedMotion)(); 13404 const [frameSize, setFrameSize] = (0, import_element37.useState)(INITIAL_FRAME_SIZE); 13405 const [startingWidth, setStartingWidth] = (0, import_element37.useState)(); 13406 const [isResizing, setIsResizing] = (0, import_element37.useState)(false); 13407 const [shouldShowHandle, setShouldShowHandle] = (0, import_element37.useState)(false); 13408 const [resizeRatio, setResizeRatio] = (0, import_element37.useState)(1); 13409 const FRAME_TRANSITION = { type: "tween", duration: isResizing ? 0 : 0.5 }; 13410 const frameRef = (0, import_element37.useRef)(null); 13411 const resizableHandleHelpId = (0, import_compose.useInstanceId)( 13412 ResizableFrame, 13413 "edit-site-resizable-frame-handle-help" 13414 ); 13415 const defaultAspectRatio = defaultSize.width / defaultSize.height; 13416 const isBlockTheme = (0, import_data6.useSelect)((select4) => { 13417 const { getCurrentTheme } = select4(import_core_data5.store); 13418 return getCurrentTheme()?.is_block_theme; 13419 }, []); 13420 const handleResizeStart = (_event, _direction, ref) => { 13421 setStartingWidth(ref.offsetWidth); 13422 setIsResizing(true); 13423 }; 13424 const handleResize = (_event, _direction, _ref, delta) => { 13425 const normalizedDelta = delta.width / resizeRatio; 13426 const deltaAbs = Math.abs(normalizedDelta); 13427 const maxDoubledDelta = delta.width < 0 ? deltaAbs : (defaultSize.width - startingWidth) / 2; 13428 const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta); 13429 const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs; 13430 const singleSegment = 1 - doubleSegment; 13431 setResizeRatio(singleSegment + doubleSegment * 2); 13432 const updatedWidth = startingWidth + delta.width; 13433 setIsOversized(updatedWidth > defaultSize.width); 13434 setFrameSize({ 13435 height: isOversized ? "100%" : calculateNewHeight(updatedWidth, defaultAspectRatio) 13436 }); 13437 }; 13438 const handleResizeStop = (_event, _direction, ref) => { 13439 setIsResizing(false); 13440 if (!isOversized) { 13441 return; 13442 } 13443 setIsOversized(false); 13444 const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth; 13445 if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) { 13446 setFrameSize(INITIAL_FRAME_SIZE); 13447 } else { 13448 history.navigate( 13449 (0, import_url2.addQueryArgs)(path, { 13450 canvas: "edit" 13451 }), 13452 { 13453 transition: "canvas-mode-edit-transition" 13454 } 13455 ); 13456 } 13457 }; 13458 const handleResizableHandleKeyDown = (event) => { 13459 if (!["ArrowLeft", "ArrowRight"].includes(event.key)) { 13460 return; 13461 } 13462 event.preventDefault(); 13463 const step = 20 * (event.shiftKey ? 5 : 1); 13464 const delta = step * (event.key === "ArrowLeft" ? 1 : -1) * ((0, import_i18n4.isRTL)() ? -1 : 1); 13465 const newWidth = Math.min( 13466 Math.max( 13467 FRAME_MIN_WIDTH, 13468 frameRef.current.resizable.offsetWidth + delta 13469 ), 13470 defaultSize.width 13471 ); 13472 setFrameSize({ 13473 width: newWidth, 13474 height: calculateNewHeight(newWidth, defaultAspectRatio) 13475 }); 13476 }; 13477 const frameAnimationVariants = { 13478 default: { 13479 flexGrow: 0, 13480 height: frameSize.height 13481 }, 13482 fullWidth: { 13483 flexGrow: 1, 13484 height: frameSize.height 13485 } 13486 }; 13487 const resizeHandleVariants = { 13488 hidden: { 13489 opacity: 0, 13490 ...(0, import_i18n4.isRTL)() ? { right: 0 } : { left: 0 } 13491 }, 13492 visible: { 13493 opacity: 1, 13494 // Account for the handle's width. 13495 ...(0, import_i18n4.isRTL)() ? { right: -14 } : { left: -14 } 13496 }, 13497 active: { 13498 opacity: 1, 13499 // Account for the handle's width. 13500 ...(0, import_i18n4.isRTL)() ? { right: -14 } : { left: -14 }, 13501 scaleY: 1.3 13502 } 13503 }; 13504 const currentResizeHandleVariant = (() => { 13505 if (isResizing) { 13506 return "active"; 13507 } 13508 return shouldShowHandle ? "visible" : "hidden"; 13509 })(); 13510 return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)( 13511 import_components4.ResizableBox, 13512 { 13513 as: import_components4.__unstableMotion.div, 13514 ref: frameRef, 13515 initial: false, 13516 variants: frameAnimationVariants, 13517 animate: isFullWidth ? "fullWidth" : "default", 13518 onAnimationComplete: (definition) => { 13519 if (definition === "fullWidth") { 13520 setFrameSize({ width: "100%", height: "100%" }); 13521 } 13522 }, 13523 whileHover: canvas === "view" && isBlockTheme ? { 13524 scale: 1.005, 13525 transition: { 13526 duration: disableMotion ? 0 : 0.5, 13527 ease: "easeOut" 13528 } 13529 } : {}, 13530 transition: FRAME_TRANSITION, 13531 size: frameSize, 13532 enable: { 13533 top: false, 13534 bottom: false, 13535 // Resizing will be disabled until the editor content is loaded. 13536 ...(0, import_i18n4.isRTL)() ? { right: isReady, left: false } : { left: isReady, right: false }, 13537 topRight: false, 13538 bottomRight: false, 13539 bottomLeft: false, 13540 topLeft: false 13541 }, 13542 resizeRatio, 13543 handleClasses: void 0, 13544 handleStyles: { 13545 left: HANDLE_STYLES_OVERRIDE, 13546 right: HANDLE_STYLES_OVERRIDE 13547 }, 13548 minWidth: FRAME_MIN_WIDTH, 13549 maxWidth: isFullWidth ? "100%" : "150%", 13550 maxHeight: "100%", 13551 onFocus: () => setShouldShowHandle(true), 13552 onBlur: () => setShouldShowHandle(false), 13553 onMouseOver: () => setShouldShowHandle(true), 13554 onMouseOut: () => setShouldShowHandle(false), 13555 handleComponent: { 13556 [(0, import_i18n4.isRTL)() ? "right" : "left"]: canvas === "view" && /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(import_jsx_runtime104.Fragment, { children: [ 13557 /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(tooltip_exports.Root, { children: [ 13558 /* @__PURE__ */ (0, import_jsx_runtime104.jsx)( 13559 tooltip_exports.Trigger, 13560 { 13561 render: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)( 13562 import_components4.__unstableMotion.button, 13563 { 13564 role: "separator", 13565 "aria-orientation": "vertical", 13566 className: clsx_default( 13567 "edit-site-resizable-frame__handle", 13568 { "is-resizing": isResizing } 13569 ), 13570 variants: resizeHandleVariants, 13571 animate: currentResizeHandleVariant, 13572 "aria-label": (0, import_i18n4.__)("Drag to resize"), 13573 "aria-describedby": resizableHandleHelpId, 13574 "aria-valuenow": frameRef.current?.resizable?.offsetWidth || void 0, 13575 "aria-valuemin": FRAME_MIN_WIDTH, 13576 "aria-valuemax": defaultSize.width, 13577 onKeyDown: handleResizableHandleKeyDown, 13578 initial: "hidden", 13579 exit: "hidden", 13580 whileFocus: "active", 13581 whileHover: "active" 13582 }, 13583 "handle" 13584 ) 13585 } 13586 ), 13587 /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(tooltip_exports.Popup, { children: (0, import_i18n4.__)("Drag to resize") }) 13588 ] }), 13589 /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { hidden: true, id: resizableHandleHelpId, children: (0, import_i18n4.__)( 13590 "Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments." 13591 ) }) 13592 ] }) 13593 }, 13594 onResizeStart: handleResizeStart, 13595 onResize: handleResize, 13596 onResizeStop: handleResizeStop, 13597 className: clsx_default("edit-site-resizable-frame__inner", { 13598 "is-resizing": isResizing 13599 }), 13600 showHandle: false, 13601 children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)( 13602 "div", 13603 { 13604 className: "edit-site-resizable-frame__inner-content", 13605 style: innerContentStyle, 13606 children 13607 } 13608 ) 13609 } 13610 ); 13611 } 13612 var resizable_frame_default = ResizableFrame; 13613 13614 // packages/edit-site/build-module/components/save-keyboard-shortcut/index.mjs 13615 var import_element38 = __toESM(require_element(), 1); 13616 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); 13617 var import_i18n5 = __toESM(require_i18n(), 1); 13618 var import_data7 = __toESM(require_data(), 1); 13619 var import_core_data6 = __toESM(require_core_data(), 1); 13620 var import_editor3 = __toESM(require_editor(), 1); 13621 var shortcutName = "core/edit-site/save"; 13622 function SaveKeyboardShortcut() { 13623 const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = (0, import_data7.useSelect)(import_core_data6.store); 13624 const { hasNonPostEntityChanges, isPostSavingLocked } = (0, import_data7.useSelect)(import_editor3.store); 13625 const { savePost } = (0, import_data7.useDispatch)(import_editor3.store); 13626 const { setIsSaveViewOpened: setIsSaveViewOpened2 } = (0, import_data7.useDispatch)(store); 13627 const { registerShortcut, unregisterShortcut } = (0, import_data7.useDispatch)( 13628 import_keyboard_shortcuts.store 13629 ); 13630 (0, import_element38.useEffect)(() => { 13631 registerShortcut({ 13632 name: shortcutName, 13633 category: "global", 13634 description: (0, import_i18n5.__)("Save your changes."), 13635 keyCombination: { 13636 modifier: "primary", 13637 character: "s" 13638 } 13639 }); 13640 return () => { 13641 unregisterShortcut(shortcutName); 13642 }; 13643 }, [registerShortcut, unregisterShortcut]); 13644 (0, import_keyboard_shortcuts.useShortcut)("core/edit-site/save", (event) => { 13645 event.preventDefault(); 13646 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 13647 const hasDirtyEntities = !!dirtyEntityRecords.length; 13648 const isSaving = dirtyEntityRecords.some( 13649 (record) => isSavingEntityRecord(record.kind, record.name, record.key) 13650 ); 13651 if (!hasDirtyEntities || isSaving) { 13652 return; 13653 } 13654 if (hasNonPostEntityChanges()) { 13655 setIsSaveViewOpened2(true); 13656 } else if (!isPostSavingLocked()) { 13657 savePost(); 13658 } 13659 }); 13660 return null; 13661 } 13662 13663 // packages/edit-site/build-module/components/layout/hooks.mjs 13664 var import_element39 = __toESM(require_element(), 1); 13665 var import_data8 = __toESM(require_data(), 1); 13666 var import_core_data7 = __toESM(require_core_data(), 1); 13667 var MAX_LOADING_TIME = 1e4; 13668 var MAX_PAUSE_TIME = 100; 13669 function waitWhileSiteEditorLoading() { 13670 let pauseTimeout; 13671 const { promise, resolve } = Promise.withResolvers(); 13672 function finish() { 13673 unsubscribe(); 13674 clearTimeout(pauseTimeout); 13675 clearTimeout(maxTimeout); 13676 resolve(); 13677 } 13678 const maxTimeout = setTimeout(finish, MAX_LOADING_TIME); 13679 function checkResolving() { 13680 const isResolving = (0, import_data8.select)(import_core_data7.store).hasResolvingSelectors(); 13681 if (isResolving) { 13682 clearTimeout(pauseTimeout); 13683 pauseTimeout = void 0; 13684 return; 13685 } 13686 if (!pauseTimeout) { 13687 pauseTimeout = setTimeout(finish, MAX_PAUSE_TIME); 13688 } 13689 } 13690 const unsubscribe = (0, import_data8.subscribe)(checkResolving, import_core_data7.store); 13691 checkResolving(); 13692 function cancel() { 13693 unsubscribe(); 13694 clearTimeout(pauseTimeout); 13695 clearTimeout(maxTimeout); 13696 } 13697 return [promise, cancel]; 13698 } 13699 function useIsSiteEditorLoading() { 13700 const [loaded, setLoaded] = (0, import_element39.useState)(false); 13701 (0, import_element39.useEffect)(() => { 13702 const [promise, cancel] = waitWhileSiteEditorLoading(); 13703 promise.then(() => setLoaded(true)); 13704 return cancel; 13705 }, []); 13706 return !loaded; 13707 } 13708 13709 // node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.js 13710 var updateQueue = makeQueue(); 13711 var raf = (fn) => schedule(fn, updateQueue); 13712 var writeQueue = makeQueue(); 13713 raf.write = (fn) => schedule(fn, writeQueue); 13714 var onStartQueue = makeQueue(); 13715 raf.onStart = (fn) => schedule(fn, onStartQueue); 13716 var onFrameQueue = makeQueue(); 13717 raf.onFrame = (fn) => schedule(fn, onFrameQueue); 13718 var onFinishQueue = makeQueue(); 13719 raf.onFinish = (fn) => schedule(fn, onFinishQueue); 13720 var timeouts = []; 13721 raf.setTimeout = (handler, ms) => { 13722 let time = raf.now() + ms; 13723 let cancel = () => { 13724 let i2 = timeouts.findIndex((t3) => t3.cancel == cancel); 13725 if (~i2) timeouts.splice(i2, 1); 13726 pendingCount -= ~i2 ? 1 : 0; 13727 }; 13728 let timeout = { 13729 time, 13730 handler, 13731 cancel 13732 }; 13733 timeouts.splice(findTimeout(time), 0, timeout); 13734 pendingCount += 1; 13735 start(); 13736 return timeout; 13737 }; 13738 var findTimeout = (time) => ~(~timeouts.findIndex((t3) => t3.time > time) || ~timeouts.length); 13739 raf.cancel = (fn) => { 13740 onStartQueue.delete(fn); 13741 onFrameQueue.delete(fn); 13742 onFinishQueue.delete(fn); 13743 updateQueue.delete(fn); 13744 writeQueue.delete(fn); 13745 }; 13746 raf.sync = (fn) => { 13747 sync = true; 13748 raf.batchedUpdates(fn); 13749 sync = false; 13750 }; 13751 raf.throttle = (fn) => { 13752 let lastArgs; 13753 function queuedFn() { 13754 try { 13755 fn(...lastArgs); 13756 } finally { 13757 lastArgs = null; 13758 } 13759 } 13760 function throttled(...args) { 13761 lastArgs = args; 13762 raf.onStart(queuedFn); 13763 } 13764 throttled.handler = fn; 13765 throttled.cancel = () => { 13766 onStartQueue.delete(queuedFn); 13767 lastArgs = null; 13768 }; 13769 return throttled; 13770 }; 13771 var nativeRaf = typeof window != "undefined" ? window.requestAnimationFrame : () => { 13772 }; 13773 raf.use = (impl) => nativeRaf = impl; 13774 raf.now = typeof performance != "undefined" ? () => performance.now() : Date.now; 13775 raf.batchedUpdates = (fn) => fn(); 13776 raf.catch = console.error; 13777 raf.frameLoop = "always"; 13778 raf.advance = () => { 13779 if (raf.frameLoop !== "demand") { 13780 console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"); 13781 } else { 13782 update2(); 13783 } 13784 }; 13785 var ts = -1; 13786 var pendingCount = 0; 13787 var sync = false; 13788 function schedule(fn, queue) { 13789 if (sync) { 13790 queue.delete(fn); 13791 fn(0); 13792 } else { 13793 queue.add(fn); 13794 start(); 13795 } 13796 } 13797 function start() { 13798 if (ts < 0) { 13799 ts = 0; 13800 if (raf.frameLoop !== "demand") { 13801 nativeRaf(loop); 13802 } 13803 } 13804 } 13805 function stop() { 13806 ts = -1; 13807 } 13808 function loop() { 13809 if (~ts) { 13810 nativeRaf(loop); 13811 raf.batchedUpdates(update2); 13812 } 13813 } 13814 function update2() { 13815 let prevTs = ts; 13816 ts = raf.now(); 13817 let count = findTimeout(ts); 13818 if (count) { 13819 eachSafely(timeouts.splice(0, count), (t3) => t3.handler()); 13820 pendingCount -= count; 13821 } 13822 if (!pendingCount) { 13823 stop(); 13824 return; 13825 } 13826 onStartQueue.flush(); 13827 updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667); 13828 onFrameQueue.flush(); 13829 writeQueue.flush(); 13830 onFinishQueue.flush(); 13831 } 13832 function makeQueue() { 13833 let next = /* @__PURE__ */ new Set(); 13834 let current = next; 13835 return { 13836 add(fn) { 13837 pendingCount += current == next && !next.has(fn) ? 1 : 0; 13838 next.add(fn); 13839 }, 13840 delete(fn) { 13841 pendingCount -= current == next && next.has(fn) ? 1 : 0; 13842 return next.delete(fn); 13843 }, 13844 flush(arg) { 13845 if (current.size) { 13846 next = /* @__PURE__ */ new Set(); 13847 pendingCount -= current.size; 13848 eachSafely(current, (fn) => fn(arg) && next.add(fn)); 13849 pendingCount += next.size; 13850 current = next; 13851 } 13852 } 13853 }; 13854 } 13855 function eachSafely(values, each2) { 13856 values.forEach((value) => { 13857 try { 13858 each2(value); 13859 } catch (e2) { 13860 raf.catch(e2); 13861 } 13862 }); 13863 } 13864 13865 // node_modules/@react-spring/shared/dist/react-spring-shared.esm.js 13866 var import_react11 = __toESM(require_react()); 13867 function noop4() { 13868 } 13869 var defineHidden = (obj, key, value) => Object.defineProperty(obj, key, { 13870 value, 13871 writable: true, 13872 configurable: true 13873 }); 13874 var is = { 13875 arr: Array.isArray, 13876 obj: (a2) => !!a2 && a2.constructor.name === "Object", 13877 fun: (a2) => typeof a2 === "function", 13878 str: (a2) => typeof a2 === "string", 13879 num: (a2) => typeof a2 === "number", 13880 und: (a2) => a2 === void 0 13881 }; 13882 function isEqual(a2, b2) { 13883 if (is.arr(a2)) { 13884 if (!is.arr(b2) || a2.length !== b2.length) return false; 13885 for (let i2 = 0; i2 < a2.length; i2++) { 13886 if (a2[i2] !== b2[i2]) return false; 13887 } 13888 return true; 13889 } 13890 return a2 === b2; 13891 } 13892 var each = (obj, fn) => obj.forEach(fn); 13893 function eachProp(obj, fn, ctx9) { 13894 if (is.arr(obj)) { 13895 for (let i2 = 0; i2 < obj.length; i2++) { 13896 fn.call(ctx9, obj[i2], `$i2}`); 13897 } 13898 return; 13899 } 13900 for (const key in obj) { 13901 if (obj.hasOwnProperty(key)) { 13902 fn.call(ctx9, obj[key], key); 13903 } 13904 } 13905 } 13906 var toArray = (a2) => is.und(a2) ? [] : is.arr(a2) ? a2 : [a2]; 13907 function flush(queue, iterator) { 13908 if (queue.size) { 13909 const items = Array.from(queue); 13910 queue.clear(); 13911 each(items, iterator); 13912 } 13913 } 13914 var flushCalls = (queue, ...args) => flush(queue, (fn) => fn(...args)); 13915 var isSSR = () => typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent); 13916 var createStringInterpolator$1; 13917 var to; 13918 var colors$1 = null; 13919 var skipAnimation = false; 13920 var willAdvance = noop4; 13921 var assign = (globals2) => { 13922 if (globals2.to) to = globals2.to; 13923 if (globals2.now) raf.now = globals2.now; 13924 if (globals2.colors !== void 0) colors$1 = globals2.colors; 13925 if (globals2.skipAnimation != null) skipAnimation = globals2.skipAnimation; 13926 if (globals2.createStringInterpolator) createStringInterpolator$1 = globals2.createStringInterpolator; 13927 if (globals2.requestAnimationFrame) raf.use(globals2.requestAnimationFrame); 13928 if (globals2.batchedUpdates) raf.batchedUpdates = globals2.batchedUpdates; 13929 if (globals2.willAdvance) willAdvance = globals2.willAdvance; 13930 if (globals2.frameLoop) raf.frameLoop = globals2.frameLoop; 13931 }; 13932 var globals = /* @__PURE__ */ Object.freeze({ 13933 __proto__: null, 13934 get createStringInterpolator() { 13935 return createStringInterpolator$1; 13936 }, 13937 get to() { 13938 return to; 13939 }, 13940 get colors() { 13941 return colors$1; 13942 }, 13943 get skipAnimation() { 13944 return skipAnimation; 13945 }, 13946 get willAdvance() { 13947 return willAdvance; 13948 }, 13949 assign 13950 }); 13951 var startQueue = /* @__PURE__ */ new Set(); 13952 var currentFrame = []; 13953 var prevFrame = []; 13954 var priority = 0; 13955 var frameLoop = { 13956 get idle() { 13957 return !startQueue.size && !currentFrame.length; 13958 }, 13959 start(animation) { 13960 if (priority > animation.priority) { 13961 startQueue.add(animation); 13962 raf.onStart(flushStartQueue); 13963 } else { 13964 startSafely(animation); 13965 raf(advance); 13966 } 13967 }, 13968 advance, 13969 sort(animation) { 13970 if (priority) { 13971 raf.onFrame(() => frameLoop.sort(animation)); 13972 } else { 13973 const prevIndex = currentFrame.indexOf(animation); 13974 if (~prevIndex) { 13975 currentFrame.splice(prevIndex, 1); 13976 startUnsafely(animation); 13977 } 13978 } 13979 }, 13980 clear() { 13981 currentFrame = []; 13982 startQueue.clear(); 13983 } 13984 }; 13985 function flushStartQueue() { 13986 startQueue.forEach(startSafely); 13987 startQueue.clear(); 13988 raf(advance); 13989 } 13990 function startSafely(animation) { 13991 if (!currentFrame.includes(animation)) startUnsafely(animation); 13992 } 13993 function startUnsafely(animation) { 13994 currentFrame.splice(findIndex(currentFrame, (other) => other.priority > animation.priority), 0, animation); 13995 } 13996 function advance(dt) { 13997 const nextFrame = prevFrame; 13998 for (let i2 = 0; i2 < currentFrame.length; i2++) { 13999 const animation = currentFrame[i2]; 14000 priority = animation.priority; 14001 if (!animation.idle) { 14002 willAdvance(animation); 14003 animation.advance(dt); 14004 if (!animation.idle) { 14005 nextFrame.push(animation); 14006 } 14007 } 14008 } 14009 priority = 0; 14010 prevFrame = currentFrame; 14011 prevFrame.length = 0; 14012 currentFrame = nextFrame; 14013 return currentFrame.length > 0; 14014 } 14015 function findIndex(arr, test) { 14016 const index2 = arr.findIndex(test); 14017 return index2 < 0 ? arr.length : index2; 14018 } 14019 var colors = { 14020 transparent: 0, 14021 aliceblue: 4042850303, 14022 antiquewhite: 4209760255, 14023 aqua: 16777215, 14024 aquamarine: 2147472639, 14025 azure: 4043309055, 14026 beige: 4126530815, 14027 bisque: 4293182719, 14028 black: 255, 14029 blanchedalmond: 4293643775, 14030 blue: 65535, 14031 blueviolet: 2318131967, 14032 brown: 2771004159, 14033 burlywood: 3736635391, 14034 burntsienna: 3934150143, 14035 cadetblue: 1604231423, 14036 chartreuse: 2147418367, 14037 chocolate: 3530104575, 14038 coral: 4286533887, 14039 cornflowerblue: 1687547391, 14040 cornsilk: 4294499583, 14041 crimson: 3692313855, 14042 cyan: 16777215, 14043 darkblue: 35839, 14044 darkcyan: 9145343, 14045 darkgoldenrod: 3095792639, 14046 darkgray: 2846468607, 14047 darkgreen: 6553855, 14048 darkgrey: 2846468607, 14049 darkkhaki: 3182914559, 14050 darkmagenta: 2332068863, 14051 darkolivegreen: 1433087999, 14052 darkorange: 4287365375, 14053 darkorchid: 2570243327, 14054 darkred: 2332033279, 14055 darksalmon: 3918953215, 14056 darkseagreen: 2411499519, 14057 darkslateblue: 1211993087, 14058 darkslategray: 793726975, 14059 darkslategrey: 793726975, 14060 darkturquoise: 13554175, 14061 darkviolet: 2483082239, 14062 deeppink: 4279538687, 14063 deepskyblue: 12582911, 14064 dimgray: 1768516095, 14065 dimgrey: 1768516095, 14066 dodgerblue: 512819199, 14067 firebrick: 2988581631, 14068 floralwhite: 4294635775, 14069 forestgreen: 579543807, 14070 fuchsia: 4278255615, 14071 gainsboro: 3705462015, 14072 ghostwhite: 4177068031, 14073 gold: 4292280575, 14074 goldenrod: 3668254975, 14075 gray: 2155905279, 14076 green: 8388863, 14077 greenyellow: 2919182335, 14078 grey: 2155905279, 14079 honeydew: 4043305215, 14080 hotpink: 4285117695, 14081 indianred: 3445382399, 14082 indigo: 1258324735, 14083 ivory: 4294963455, 14084 khaki: 4041641215, 14085 lavender: 3873897215, 14086 lavenderblush: 4293981695, 14087 lawngreen: 2096890111, 14088 lemonchiffon: 4294626815, 14089 lightblue: 2916673279, 14090 lightcoral: 4034953471, 14091 lightcyan: 3774873599, 14092 lightgoldenrodyellow: 4210742015, 14093 lightgray: 3553874943, 14094 lightgreen: 2431553791, 14095 lightgrey: 3553874943, 14096 lightpink: 4290167295, 14097 lightsalmon: 4288707327, 14098 lightseagreen: 548580095, 14099 lightskyblue: 2278488831, 14100 lightslategray: 2005441023, 14101 lightslategrey: 2005441023, 14102 lightsteelblue: 2965692159, 14103 lightyellow: 4294959359, 14104 lime: 16711935, 14105 limegreen: 852308735, 14106 linen: 4210091775, 14107 magenta: 4278255615, 14108 maroon: 2147483903, 14109 mediumaquamarine: 1724754687, 14110 mediumblue: 52735, 14111 mediumorchid: 3126187007, 14112 mediumpurple: 2473647103, 14113 mediumseagreen: 1018393087, 14114 mediumslateblue: 2070474495, 14115 mediumspringgreen: 16423679, 14116 mediumturquoise: 1221709055, 14117 mediumvioletred: 3340076543, 14118 midnightblue: 421097727, 14119 mintcream: 4127193855, 14120 mistyrose: 4293190143, 14121 moccasin: 4293178879, 14122 navajowhite: 4292783615, 14123 navy: 33023, 14124 oldlace: 4260751103, 14125 olive: 2155872511, 14126 olivedrab: 1804477439, 14127 orange: 4289003775, 14128 orangered: 4282712319, 14129 orchid: 3664828159, 14130 palegoldenrod: 4008225535, 14131 palegreen: 2566625535, 14132 paleturquoise: 2951671551, 14133 palevioletred: 3681588223, 14134 papayawhip: 4293907967, 14135 peachpuff: 4292524543, 14136 peru: 3448061951, 14137 pink: 4290825215, 14138 plum: 3718307327, 14139 powderblue: 2967529215, 14140 purple: 2147516671, 14141 rebeccapurple: 1714657791, 14142 red: 4278190335, 14143 rosybrown: 3163525119, 14144 royalblue: 1097458175, 14145 saddlebrown: 2336560127, 14146 salmon: 4202722047, 14147 sandybrown: 4104413439, 14148 seagreen: 780883967, 14149 seashell: 4294307583, 14150 sienna: 2689740287, 14151 silver: 3233857791, 14152 skyblue: 2278484991, 14153 slateblue: 1784335871, 14154 slategray: 1887473919, 14155 slategrey: 1887473919, 14156 snow: 4294638335, 14157 springgreen: 16744447, 14158 steelblue: 1182971135, 14159 tan: 3535047935, 14160 teal: 8421631, 14161 thistle: 3636451583, 14162 tomato: 4284696575, 14163 turquoise: 1088475391, 14164 violet: 4001558271, 14165 wheat: 4125012991, 14166 white: 4294967295, 14167 whitesmoke: 4126537215, 14168 yellow: 4294902015, 14169 yellowgreen: 2597139199 14170 }; 14171 var NUMBER = "[-+]?\\d*\\.?\\d+"; 14172 var PERCENTAGE = NUMBER + "%"; 14173 function call(...parts) { 14174 return "\\(\\s*(" + parts.join(")\\s*,\\s*(") + ")\\s*\\)"; 14175 } 14176 var rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER)); 14177 var rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER)); 14178 var hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)); 14179 var hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); 14180 var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; 14181 var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; 14182 var hex6 = /^#([0-9a-fA-F]{6})$/; 14183 var hex8 = /^#([0-9a-fA-F]{8})$/; 14184 function normalizeColor(color) { 14185 let match3; 14186 if (typeof color === "number") { 14187 return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null; 14188 } 14189 if (match3 = hex6.exec(color)) return parseInt(match3[1] + "ff", 16) >>> 0; 14190 if (colors$1 && colors$1[color] !== void 0) { 14191 return colors$1[color]; 14192 } 14193 if (match3 = rgb.exec(color)) { 14194 return (parse255(match3[1]) << 24 | parse255(match3[2]) << 16 | parse255(match3[3]) << 8 | 255) >>> 0; 14195 } 14196 if (match3 = rgba.exec(color)) { 14197 return (parse255(match3[1]) << 24 | parse255(match3[2]) << 16 | parse255(match3[3]) << 8 | parse1(match3[4])) >>> 0; 14198 } 14199 if (match3 = hex3.exec(color)) { 14200 return parseInt(match3[1] + match3[1] + match3[2] + match3[2] + match3[3] + match3[3] + "ff", 16) >>> 0; 14201 } 14202 if (match3 = hex8.exec(color)) return parseInt(match3[1], 16) >>> 0; 14203 if (match3 = hex4.exec(color)) { 14204 return parseInt(match3[1] + match3[1] + match3[2] + match3[2] + match3[3] + match3[3] + match3[4] + match3[4], 16) >>> 0; 14205 } 14206 if (match3 = hsl.exec(color)) { 14207 return (hslToRgb(parse360(match3[1]), parsePercentage(match3[2]), parsePercentage(match3[3])) | 255) >>> 0; 14208 } 14209 if (match3 = hsla.exec(color)) { 14210 return (hslToRgb(parse360(match3[1]), parsePercentage(match3[2]), parsePercentage(match3[3])) | parse1(match3[4])) >>> 0; 14211 } 14212 return null; 14213 } 14214 function hue2rgb(p3, q, t3) { 14215 if (t3 < 0) t3 += 1; 14216 if (t3 > 1) t3 -= 1; 14217 if (t3 < 1 / 6) return p3 + (q - p3) * 6 * t3; 14218 if (t3 < 1 / 2) return q; 14219 if (t3 < 2 / 3) return p3 + (q - p3) * (2 / 3 - t3) * 6; 14220 return p3; 14221 } 14222 function hslToRgb(h2, s2, l2) { 14223 const q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2; 14224 const p3 = 2 * l2 - q; 14225 const r3 = hue2rgb(p3, q, h2 + 1 / 3); 14226 const g2 = hue2rgb(p3, q, h2); 14227 const b2 = hue2rgb(p3, q, h2 - 1 / 3); 14228 return Math.round(r3 * 255) << 24 | Math.round(g2 * 255) << 16 | Math.round(b2 * 255) << 8; 14229 } 14230 function parse255(str) { 14231 const int = parseInt(str, 10); 14232 if (int < 0) return 0; 14233 if (int > 255) return 255; 14234 return int; 14235 } 14236 function parse360(str) { 14237 const int = parseFloat(str); 14238 return (int % 360 + 360) % 360 / 360; 14239 } 14240 function parse1(str) { 14241 const num = parseFloat(str); 14242 if (num < 0) return 0; 14243 if (num > 1) return 255; 14244 return Math.round(num * 255); 14245 } 14246 function parsePercentage(str) { 14247 const int = parseFloat(str); 14248 if (int < 0) return 0; 14249 if (int > 100) return 1; 14250 return int / 100; 14251 } 14252 function colorToRgba(input) { 14253 let int32Color = normalizeColor(input); 14254 if (int32Color === null) return input; 14255 int32Color = int32Color || 0; 14256 let r3 = (int32Color & 4278190080) >>> 24; 14257 let g2 = (int32Color & 16711680) >>> 16; 14258 let b2 = (int32Color & 65280) >>> 8; 14259 let a2 = (int32Color & 255) / 255; 14260 return `rgba($r3}, $g2}, $b2}, $a2})`; 14261 } 14262 var createInterpolator = (range, output, extrapolate) => { 14263 if (is.fun(range)) { 14264 return range; 14265 } 14266 if (is.arr(range)) { 14267 return createInterpolator({ 14268 range, 14269 output, 14270 extrapolate 14271 }); 14272 } 14273 if (is.str(range.output[0])) { 14274 return createStringInterpolator$1(range); 14275 } 14276 const config2 = range; 14277 const outputRange = config2.output; 14278 const inputRange = config2.range || [0, 1]; 14279 const extrapolateLeft = config2.extrapolateLeft || config2.extrapolate || "extend"; 14280 const extrapolateRight = config2.extrapolateRight || config2.extrapolate || "extend"; 14281 const easing = config2.easing || ((t3) => t3); 14282 return (input) => { 14283 const range2 = findRange(input, inputRange); 14284 return interpolate(input, inputRange[range2], inputRange[range2 + 1], outputRange[range2], outputRange[range2 + 1], easing, extrapolateLeft, extrapolateRight, config2.map); 14285 }; 14286 }; 14287 function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { 14288 let result = map ? map(input) : input; 14289 if (result < inputMin) { 14290 if (extrapolateLeft === "identity") return result; 14291 else if (extrapolateLeft === "clamp") result = inputMin; 14292 } 14293 if (result > inputMax) { 14294 if (extrapolateRight === "identity") return result; 14295 else if (extrapolateRight === "clamp") result = inputMax; 14296 } 14297 if (outputMin === outputMax) return outputMin; 14298 if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; 14299 if (inputMin === -Infinity) result = -result; 14300 else if (inputMax === Infinity) result = result - inputMin; 14301 else result = (result - inputMin) / (inputMax - inputMin); 14302 result = easing(result); 14303 if (outputMin === -Infinity) result = -result; 14304 else if (outputMax === Infinity) result = result + outputMin; 14305 else result = result * (outputMax - outputMin) + outputMin; 14306 return result; 14307 } 14308 function findRange(input, inputRange) { 14309 for (var i2 = 1; i2 < inputRange.length - 1; ++i2) if (inputRange[i2] >= input) break; 14310 return i2 - 1; 14311 } 14312 function _extends() { 14313 _extends = Object.assign ? Object.assign.bind() : function(target) { 14314 for (var i2 = 1; i2 < arguments.length; i2++) { 14315 var source = arguments[i2]; 14316 for (var key in source) { 14317 if (Object.prototype.hasOwnProperty.call(source, key)) { 14318 target[key] = source[key]; 14319 } 14320 } 14321 } 14322 return target; 14323 }; 14324 return _extends.apply(this, arguments); 14325 } 14326 var $get = /* @__PURE__ */ Symbol.for("FluidValue.get"); 14327 var $observers = /* @__PURE__ */ Symbol.for("FluidValue.observers"); 14328 var hasFluidValue = (arg) => Boolean(arg && arg[$get]); 14329 var getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg; 14330 var getFluidObservers = (target) => target[$observers] || null; 14331 function callFluidObserver(observer, event) { 14332 if (observer.eventObserved) { 14333 observer.eventObserved(event); 14334 } else { 14335 observer(event); 14336 } 14337 } 14338 function callFluidObservers(target, event) { 14339 let observers = target[$observers]; 14340 if (observers) { 14341 observers.forEach((observer) => { 14342 callFluidObserver(observer, event); 14343 }); 14344 } 14345 } 14346 var FluidValue = class { 14347 constructor(get) { 14348 this[$get] = void 0; 14349 this[$observers] = void 0; 14350 if (!get && !(get = this.get)) { 14351 throw Error("Unknown getter"); 14352 } 14353 setFluidGetter(this, get); 14354 } 14355 }; 14356 var setFluidGetter = (target, get) => setHidden(target, $get, get); 14357 function addFluidObserver(target, observer) { 14358 if (target[$get]) { 14359 let observers = target[$observers]; 14360 if (!observers) { 14361 setHidden(target, $observers, observers = /* @__PURE__ */ new Set()); 14362 } 14363 if (!observers.has(observer)) { 14364 observers.add(observer); 14365 if (target.observerAdded) { 14366 target.observerAdded(observers.size, observer); 14367 } 14368 } 14369 } 14370 return observer; 14371 } 14372 function removeFluidObserver(target, observer) { 14373 let observers = target[$observers]; 14374 if (observers && observers.has(observer)) { 14375 const count = observers.size - 1; 14376 if (count) { 14377 observers.delete(observer); 14378 } else { 14379 target[$observers] = null; 14380 } 14381 if (target.observerRemoved) { 14382 target.observerRemoved(count, observer); 14383 } 14384 } 14385 } 14386 var setHidden = (target, key, value) => Object.defineProperty(target, key, { 14387 value, 14388 writable: true, 14389 configurable: true 14390 }); 14391 var numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; 14392 var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; 14393 var unitRegex = new RegExp(`($numberRegex.source})(%|[a-z]+)`, "i"); 14394 var rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi; 14395 var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/; 14396 var variableToRgba = (input) => { 14397 const [token, fallback] = parseCSSVariable(input); 14398 if (!token || isSSR()) { 14399 return input; 14400 } 14401 const value = window.getComputedStyle(document.documentElement).getPropertyValue(token); 14402 if (value) { 14403 return value.trim(); 14404 } else if (fallback && fallback.startsWith("--")) { 14405 const _value = window.getComputedStyle(document.documentElement).getPropertyValue(fallback); 14406 if (_value) { 14407 return _value; 14408 } else { 14409 return input; 14410 } 14411 } else if (fallback && cssVariableRegex.test(fallback)) { 14412 return variableToRgba(fallback); 14413 } else if (fallback) { 14414 return fallback; 14415 } 14416 return input; 14417 }; 14418 var parseCSSVariable = (current) => { 14419 const match3 = cssVariableRegex.exec(current); 14420 if (!match3) return [,]; 14421 const [, token, fallback] = match3; 14422 return [token, fallback]; 14423 }; 14424 var namedColorRegex; 14425 var rgbaRound = (_, p1, p22, p3, p4) => `rgba($Math.round(p1)}, $Math.round(p22)}, $Math.round(p3)}, $p4})`; 14426 var createStringInterpolator = (config2) => { 14427 if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`($Object.keys(colors$1).join("|")})(?!\\w)`, "g") : /^\b$/; 14428 const output = config2.output.map((value) => { 14429 return getFluidValue(value).replace(cssVariableRegex, variableToRgba).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba); 14430 }); 14431 const keyframes = output.map((value) => value.match(numberRegex).map(Number)); 14432 const outputRanges = keyframes[0].map((_, i2) => keyframes.map((values) => { 14433 if (!(i2 in values)) { 14434 throw Error('The arity of each "output" value must be equal'); 14435 } 14436 return values[i2]; 14437 })); 14438 const interpolators = outputRanges.map((output2) => createInterpolator(_extends({}, config2, { 14439 output: output2 14440 }))); 14441 return (input) => { 14442 var _output$find; 14443 const missingUnit = !unitRegex.test(output[0]) && ((_output$find = output.find((value) => unitRegex.test(value))) == null ? void 0 : _output$find.replace(numberRegex, "")); 14444 let i2 = 0; 14445 return output[0].replace(numberRegex, () => `$interpolators[i2++](input)}$missingUnit || ""}`).replace(rgbaRegex, rgbaRound); 14446 }; 14447 }; 14448 var prefix = "react-spring: "; 14449 var once = (fn) => { 14450 const func = fn; 14451 let called = false; 14452 if (typeof func != "function") { 14453 throw new TypeError(`$prefix}once requires a function parameter`); 14454 } 14455 return (...args) => { 14456 if (!called) { 14457 func(...args); 14458 called = true; 14459 } 14460 }; 14461 }; 14462 var warnInterpolate = once(console.warn); 14463 function deprecateInterpolate() { 14464 warnInterpolate(`$prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`); 14465 } 14466 var warnDirectCall = once(console.warn); 14467 function isAnimatedString(value) { 14468 return is.str(value) && (value[0] == "#" || /\d/.test(value) || !isSSR() && cssVariableRegex.test(value) || value in (colors$1 || {})); 14469 } 14470 var useIsomorphicLayoutEffect = isSSR() ? import_react11.useEffect : import_react11.useLayoutEffect; 14471 var useIsMounted = () => { 14472 const isMounted = (0, import_react11.useRef)(false); 14473 useIsomorphicLayoutEffect(() => { 14474 isMounted.current = true; 14475 return () => { 14476 isMounted.current = false; 14477 }; 14478 }, []); 14479 return isMounted; 14480 }; 14481 function useForceUpdate() { 14482 const update4 = (0, import_react11.useState)()[1]; 14483 const isMounted = useIsMounted(); 14484 return () => { 14485 if (isMounted.current) { 14486 update4(Math.random()); 14487 } 14488 }; 14489 } 14490 function useMemoOne(getResult, inputs) { 14491 const [initial2] = (0, import_react11.useState)(() => ({ 14492 inputs, 14493 result: getResult() 14494 })); 14495 const committed = (0, import_react11.useRef)(); 14496 const prevCache = committed.current; 14497 let cache = prevCache; 14498 if (cache) { 14499 const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs)); 14500 if (!useCache) { 14501 cache = { 14502 inputs, 14503 result: getResult() 14504 }; 14505 } 14506 } else { 14507 cache = initial2; 14508 } 14509 (0, import_react11.useEffect)(() => { 14510 committed.current = cache; 14511 if (prevCache == initial2) { 14512 initial2.inputs = initial2.result = void 0; 14513 } 14514 }, [cache]); 14515 return cache.result; 14516 } 14517 function areInputsEqual(next, prev) { 14518 if (next.length !== prev.length) { 14519 return false; 14520 } 14521 for (let i2 = 0; i2 < next.length; i2++) { 14522 if (next[i2] !== prev[i2]) { 14523 return false; 14524 } 14525 } 14526 return true; 14527 } 14528 var useOnce = (effect) => (0, import_react11.useEffect)(effect, emptyDeps); 14529 var emptyDeps = []; 14530 14531 // node_modules/@react-spring/core/dist/react-spring-core.esm.js 14532 var React58 = __toESM(require_react()); 14533 var import_react13 = __toESM(require_react()); 14534 14535 // node_modules/@react-spring/animated/dist/react-spring-animated.esm.js 14536 var React57 = __toESM(require_react()); 14537 var import_react12 = __toESM(require_react()); 14538 var $node = /* @__PURE__ */ Symbol.for("Animated:node"); 14539 var isAnimated = (value) => !!value && value[$node] === value; 14540 var getAnimated = (owner) => owner && owner[$node]; 14541 var setAnimated = (owner, node) => defineHidden(owner, $node, node); 14542 var getPayload = (owner) => owner && owner[$node] && owner[$node].getPayload(); 14543 var Animated = class { 14544 constructor() { 14545 this.payload = void 0; 14546 setAnimated(this, this); 14547 } 14548 getPayload() { 14549 return this.payload || []; 14550 } 14551 }; 14552 var AnimatedValue = class _AnimatedValue extends Animated { 14553 constructor(_value) { 14554 super(); 14555 this.done = true; 14556 this.elapsedTime = void 0; 14557 this.lastPosition = void 0; 14558 this.lastVelocity = void 0; 14559 this.v0 = void 0; 14560 this.durationProgress = 0; 14561 this._value = _value; 14562 if (is.num(this._value)) { 14563 this.lastPosition = this._value; 14564 } 14565 } 14566 static create(value) { 14567 return new _AnimatedValue(value); 14568 } 14569 getPayload() { 14570 return [this]; 14571 } 14572 getValue() { 14573 return this._value; 14574 } 14575 setValue(value, step) { 14576 if (is.num(value)) { 14577 this.lastPosition = value; 14578 if (step) { 14579 value = Math.round(value / step) * step; 14580 if (this.done) { 14581 this.lastPosition = value; 14582 } 14583 } 14584 } 14585 if (this._value === value) { 14586 return false; 14587 } 14588 this._value = value; 14589 return true; 14590 } 14591 reset() { 14592 const { 14593 done 14594 } = this; 14595 this.done = false; 14596 if (is.num(this._value)) { 14597 this.elapsedTime = 0; 14598 this.durationProgress = 0; 14599 this.lastPosition = this._value; 14600 if (done) this.lastVelocity = null; 14601 this.v0 = null; 14602 } 14603 } 14604 }; 14605 var AnimatedString = class _AnimatedString extends AnimatedValue { 14606 constructor(value) { 14607 super(0); 14608 this._string = null; 14609 this._toString = void 0; 14610 this._toString = createInterpolator({ 14611 output: [value, value] 14612 }); 14613 } 14614 static create(value) { 14615 return new _AnimatedString(value); 14616 } 14617 getValue() { 14618 let value = this._string; 14619 return value == null ? this._string = this._toString(this._value) : value; 14620 } 14621 setValue(value) { 14622 if (is.str(value)) { 14623 if (value == this._string) { 14624 return false; 14625 } 14626 this._string = value; 14627 this._value = 1; 14628 } else if (super.setValue(value)) { 14629 this._string = null; 14630 } else { 14631 return false; 14632 } 14633 return true; 14634 } 14635 reset(goal) { 14636 if (goal) { 14637 this._toString = createInterpolator({ 14638 output: [this.getValue(), goal] 14639 }); 14640 } 14641 this._value = 0; 14642 super.reset(); 14643 } 14644 }; 14645 var TreeContext = { 14646 dependencies: null 14647 }; 14648 var AnimatedObject = class extends Animated { 14649 constructor(source) { 14650 super(); 14651 this.source = source; 14652 this.setValue(source); 14653 } 14654 getValue(animated2) { 14655 const values = {}; 14656 eachProp(this.source, (source, key) => { 14657 if (isAnimated(source)) { 14658 values[key] = source.getValue(animated2); 14659 } else if (hasFluidValue(source)) { 14660 values[key] = getFluidValue(source); 14661 } else if (!animated2) { 14662 values[key] = source; 14663 } 14664 }); 14665 return values; 14666 } 14667 setValue(source) { 14668 this.source = source; 14669 this.payload = this._makePayload(source); 14670 } 14671 reset() { 14672 if (this.payload) { 14673 each(this.payload, (node) => node.reset()); 14674 } 14675 } 14676 _makePayload(source) { 14677 if (source) { 14678 const payload = /* @__PURE__ */ new Set(); 14679 eachProp(source, this._addToPayload, payload); 14680 return Array.from(payload); 14681 } 14682 } 14683 _addToPayload(source) { 14684 if (TreeContext.dependencies && hasFluidValue(source)) { 14685 TreeContext.dependencies.add(source); 14686 } 14687 const payload = getPayload(source); 14688 if (payload) { 14689 each(payload, (node) => this.add(node)); 14690 } 14691 } 14692 }; 14693 var AnimatedArray = class _AnimatedArray extends AnimatedObject { 14694 constructor(source) { 14695 super(source); 14696 } 14697 static create(source) { 14698 return new _AnimatedArray(source); 14699 } 14700 getValue() { 14701 return this.source.map((node) => node.getValue()); 14702 } 14703 setValue(source) { 14704 const payload = this.getPayload(); 14705 if (source.length == payload.length) { 14706 return payload.map((node, i2) => node.setValue(source[i2])).some(Boolean); 14707 } 14708 super.setValue(source.map(makeAnimated)); 14709 return true; 14710 } 14711 }; 14712 function makeAnimated(value) { 14713 const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue; 14714 return nodeType.create(value); 14715 } 14716 function getAnimatedType(value) { 14717 const parentNode = getAnimated(value); 14718 return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue; 14719 } 14720 function _extends2() { 14721 _extends2 = Object.assign ? Object.assign.bind() : function(target) { 14722 for (var i2 = 1; i2 < arguments.length; i2++) { 14723 var source = arguments[i2]; 14724 for (var key in source) { 14725 if (Object.prototype.hasOwnProperty.call(source, key)) { 14726 target[key] = source[key]; 14727 } 14728 } 14729 } 14730 return target; 14731 }; 14732 return _extends2.apply(this, arguments); 14733 } 14734 var withAnimated = (Component, host2) => { 14735 const hasInstance = !is.fun(Component) || Component.prototype && Component.prototype.isReactComponent; 14736 return (0, import_react12.forwardRef)((givenProps, givenRef) => { 14737 const instanceRef = (0, import_react12.useRef)(null); 14738 const ref = hasInstance && (0, import_react12.useCallback)((value) => { 14739 instanceRef.current = updateRef(givenRef, value); 14740 }, [givenRef]); 14741 const [props, deps] = getAnimatedState(givenProps, host2); 14742 const forceUpdate = useForceUpdate(); 14743 const callback = () => { 14744 const instance = instanceRef.current; 14745 if (hasInstance && !instance) { 14746 return; 14747 } 14748 const didUpdate = instance ? host2.applyAnimatedValues(instance, props.getValue(true)) : false; 14749 if (didUpdate === false) { 14750 forceUpdate(); 14751 } 14752 }; 14753 const observer = new PropsObserver(callback, deps); 14754 const observerRef = (0, import_react12.useRef)(); 14755 useIsomorphicLayoutEffect(() => { 14756 observerRef.current = observer; 14757 each(deps, (dep) => addFluidObserver(dep, observer)); 14758 return () => { 14759 if (observerRef.current) { 14760 each(observerRef.current.deps, (dep) => removeFluidObserver(dep, observerRef.current)); 14761 raf.cancel(observerRef.current.update); 14762 } 14763 }; 14764 }); 14765 (0, import_react12.useEffect)(callback, []); 14766 useOnce(() => () => { 14767 const observer2 = observerRef.current; 14768 each(observer2.deps, (dep) => removeFluidObserver(dep, observer2)); 14769 }); 14770 const usedProps = host2.getComponentProps(props.getValue()); 14771 return React57.createElement(Component, _extends2({}, usedProps, { 14772 ref 14773 })); 14774 }); 14775 }; 14776 var PropsObserver = class { 14777 constructor(update4, deps) { 14778 this.update = update4; 14779 this.deps = deps; 14780 } 14781 eventObserved(event) { 14782 if (event.type == "change") { 14783 raf.write(this.update); 14784 } 14785 } 14786 }; 14787 function getAnimatedState(props, host2) { 14788 const dependencies = /* @__PURE__ */ new Set(); 14789 TreeContext.dependencies = dependencies; 14790 if (props.style) props = _extends2({}, props, { 14791 style: host2.createAnimatedStyle(props.style) 14792 }); 14793 props = new AnimatedObject(props); 14794 TreeContext.dependencies = null; 14795 return [props, dependencies]; 14796 } 14797 function updateRef(ref, value) { 14798 if (ref) { 14799 if (is.fun(ref)) ref(value); 14800 else ref.current = value; 14801 } 14802 return value; 14803 } 14804 var cacheKey = /* @__PURE__ */ Symbol.for("AnimatedComponent"); 14805 var createHost = (components, { 14806 applyAnimatedValues: _applyAnimatedValues = () => false, 14807 createAnimatedStyle: _createAnimatedStyle = (style) => new AnimatedObject(style), 14808 getComponentProps: _getComponentProps = (props) => props 14809 } = {}) => { 14810 const hostConfig = { 14811 applyAnimatedValues: _applyAnimatedValues, 14812 createAnimatedStyle: _createAnimatedStyle, 14813 getComponentProps: _getComponentProps 14814 }; 14815 const animated2 = (Component) => { 14816 const displayName = getDisplayName(Component) || "Anonymous"; 14817 if (is.str(Component)) { 14818 Component = animated2[Component] || (animated2[Component] = withAnimated(Component, hostConfig)); 14819 } else { 14820 Component = Component[cacheKey] || (Component[cacheKey] = withAnimated(Component, hostConfig)); 14821 } 14822 Component.displayName = `Animated($displayName})`; 14823 return Component; 14824 }; 14825 eachProp(components, (Component, key) => { 14826 if (is.arr(components)) { 14827 key = getDisplayName(Component); 14828 } 14829 animated2[key] = animated2(Component); 14830 }); 14831 return { 14832 animated: animated2 14833 }; 14834 }; 14835 var getDisplayName = (arg) => is.str(arg) ? arg : arg && is.str(arg.displayName) ? arg.displayName : is.fun(arg) && arg.name || null; 14836 14837 // node_modules/@react-spring/core/dist/react-spring-core.esm.js 14838 function _extends3() { 14839 _extends3 = Object.assign ? Object.assign.bind() : function(target) { 14840 for (var i2 = 1; i2 < arguments.length; i2++) { 14841 var source = arguments[i2]; 14842 for (var key in source) { 14843 if (Object.prototype.hasOwnProperty.call(source, key)) { 14844 target[key] = source[key]; 14845 } 14846 } 14847 } 14848 return target; 14849 }; 14850 return _extends3.apply(this, arguments); 14851 } 14852 function callProp(value, ...args) { 14853 return is.fun(value) ? value(...args) : value; 14854 } 14855 var matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key))); 14856 var resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop; 14857 var getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0; 14858 var noopTransform = (value) => value; 14859 var getDefaultProps = (props, transform = noopTransform) => { 14860 let keys = DEFAULT_PROPS; 14861 if (props.default && props.default !== true) { 14862 props = props.default; 14863 keys = Object.keys(props); 14864 } 14865 const defaults2 = {}; 14866 for (const key of keys) { 14867 const value = transform(props[key], key); 14868 if (!is.und(value)) { 14869 defaults2[key] = value; 14870 } 14871 } 14872 return defaults2; 14873 }; 14874 var DEFAULT_PROPS = ["config", "onProps", "onStart", "onChange", "onPause", "onResume", "onRest"]; 14875 var RESERVED_PROPS = { 14876 config: 1, 14877 from: 1, 14878 to: 1, 14879 ref: 1, 14880 loop: 1, 14881 reset: 1, 14882 pause: 1, 14883 cancel: 1, 14884 reverse: 1, 14885 immediate: 1, 14886 default: 1, 14887 delay: 1, 14888 onProps: 1, 14889 onStart: 1, 14890 onChange: 1, 14891 onPause: 1, 14892 onResume: 1, 14893 onRest: 1, 14894 onResolve: 1, 14895 items: 1, 14896 trail: 1, 14897 sort: 1, 14898 expires: 1, 14899 initial: 1, 14900 enter: 1, 14901 update: 1, 14902 leave: 1, 14903 children: 1, 14904 onDestroyed: 1, 14905 keys: 1, 14906 callId: 1, 14907 parentId: 1 14908 }; 14909 function getForwardProps(props) { 14910 const forward = {}; 14911 let count = 0; 14912 eachProp(props, (value, prop) => { 14913 if (!RESERVED_PROPS[prop]) { 14914 forward[prop] = value; 14915 count++; 14916 } 14917 }); 14918 if (count) { 14919 return forward; 14920 } 14921 } 14922 function inferTo(props) { 14923 const to2 = getForwardProps(props); 14924 if (to2) { 14925 const out = { 14926 to: to2 14927 }; 14928 eachProp(props, (val, key) => key in to2 || (out[key] = val)); 14929 return out; 14930 } 14931 return _extends3({}, props); 14932 } 14933 function computeGoal(value) { 14934 value = getFluidValue(value); 14935 return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({ 14936 range: [0, 1], 14937 output: [value, value] 14938 })(1) : value; 14939 } 14940 function isAsyncTo(to2) { 14941 return is.fun(to2) || is.arr(to2) && is.obj(to2[0]); 14942 } 14943 var config = { 14944 default: { 14945 tension: 170, 14946 friction: 26 14947 }, 14948 gentle: { 14949 tension: 120, 14950 friction: 14 14951 }, 14952 wobbly: { 14953 tension: 180, 14954 friction: 12 14955 }, 14956 stiff: { 14957 tension: 210, 14958 friction: 20 14959 }, 14960 slow: { 14961 tension: 280, 14962 friction: 60 14963 }, 14964 molasses: { 14965 tension: 280, 14966 friction: 120 14967 } 14968 }; 14969 var c1 = 1.70158; 14970 var c2 = c1 * 1.525; 14971 var c3 = c1 + 1; 14972 var c4 = 2 * Math.PI / 3; 14973 var c5 = 2 * Math.PI / 4.5; 14974 var bounceOut = (x2) => { 14975 const n1 = 7.5625; 14976 const d1 = 2.75; 14977 if (x2 < 1 / d1) { 14978 return n1 * x2 * x2; 14979 } else if (x2 < 2 / d1) { 14980 return n1 * (x2 -= 1.5 / d1) * x2 + 0.75; 14981 } else if (x2 < 2.5 / d1) { 14982 return n1 * (x2 -= 2.25 / d1) * x2 + 0.9375; 14983 } else { 14984 return n1 * (x2 -= 2.625 / d1) * x2 + 0.984375; 14985 } 14986 }; 14987 var easings = { 14988 linear: (x2) => x2, 14989 easeInQuad: (x2) => x2 * x2, 14990 easeOutQuad: (x2) => 1 - (1 - x2) * (1 - x2), 14991 easeInOutQuad: (x2) => x2 < 0.5 ? 2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 2) / 2, 14992 easeInCubic: (x2) => x2 * x2 * x2, 14993 easeOutCubic: (x2) => 1 - Math.pow(1 - x2, 3), 14994 easeInOutCubic: (x2) => x2 < 0.5 ? 4 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 3) / 2, 14995 easeInQuart: (x2) => x2 * x2 * x2 * x2, 14996 easeOutQuart: (x2) => 1 - Math.pow(1 - x2, 4), 14997 easeInOutQuart: (x2) => x2 < 0.5 ? 8 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 4) / 2, 14998 easeInQuint: (x2) => x2 * x2 * x2 * x2 * x2, 14999 easeOutQuint: (x2) => 1 - Math.pow(1 - x2, 5), 15000 easeInOutQuint: (x2) => x2 < 0.5 ? 16 * x2 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 5) / 2, 15001 easeInSine: (x2) => 1 - Math.cos(x2 * Math.PI / 2), 15002 easeOutSine: (x2) => Math.sin(x2 * Math.PI / 2), 15003 easeInOutSine: (x2) => -(Math.cos(Math.PI * x2) - 1) / 2, 15004 easeInExpo: (x2) => x2 === 0 ? 0 : Math.pow(2, 10 * x2 - 10), 15005 easeOutExpo: (x2) => x2 === 1 ? 1 : 1 - Math.pow(2, -10 * x2), 15006 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, 15007 easeInCirc: (x2) => 1 - Math.sqrt(1 - Math.pow(x2, 2)), 15008 easeOutCirc: (x2) => Math.sqrt(1 - Math.pow(x2 - 1, 2)), 15009 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, 15010 easeInBack: (x2) => c3 * x2 * x2 * x2 - c1 * x2 * x2, 15011 easeOutBack: (x2) => 1 + c3 * Math.pow(x2 - 1, 3) + c1 * Math.pow(x2 - 1, 2), 15012 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, 15013 easeInElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : -Math.pow(2, 10 * x2 - 10) * Math.sin((x2 * 10 - 10.75) * c4), 15014 easeOutElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : Math.pow(2, -10 * x2) * Math.sin((x2 * 10 - 0.75) * c4) + 1, 15015 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, 15016 easeInBounce: (x2) => 1 - bounceOut(1 - x2), 15017 easeOutBounce: bounceOut, 15018 easeInOutBounce: (x2) => x2 < 0.5 ? (1 - bounceOut(1 - 2 * x2)) / 2 : (1 + bounceOut(2 * x2 - 1)) / 2 15019 }; 15020 var defaults = _extends3({}, config.default, { 15021 mass: 1, 15022 damping: 1, 15023 easing: easings.linear, 15024 clamp: false 15025 }); 15026 var AnimationConfig = class { 15027 constructor() { 15028 this.tension = void 0; 15029 this.friction = void 0; 15030 this.frequency = void 0; 15031 this.damping = void 0; 15032 this.mass = void 0; 15033 this.velocity = 0; 15034 this.restVelocity = void 0; 15035 this.precision = void 0; 15036 this.progress = void 0; 15037 this.duration = void 0; 15038 this.easing = void 0; 15039 this.clamp = void 0; 15040 this.bounce = void 0; 15041 this.decay = void 0; 15042 this.round = void 0; 15043 Object.assign(this, defaults); 15044 } 15045 }; 15046 function mergeConfig(config2, newConfig, defaultConfig) { 15047 if (defaultConfig) { 15048 defaultConfig = _extends3({}, defaultConfig); 15049 sanitizeConfig(defaultConfig, newConfig); 15050 newConfig = _extends3({}, defaultConfig, newConfig); 15051 } 15052 sanitizeConfig(config2, newConfig); 15053 Object.assign(config2, newConfig); 15054 for (const key in defaults) { 15055 if (config2[key] == null) { 15056 config2[key] = defaults[key]; 15057 } 15058 } 15059 let { 15060 mass, 15061 frequency, 15062 damping 15063 } = config2; 15064 if (!is.und(frequency)) { 15065 if (frequency < 0.01) frequency = 0.01; 15066 if (damping < 0) damping = 0; 15067 config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass; 15068 config2.friction = 4 * Math.PI * damping * mass / frequency; 15069 } 15070 return config2; 15071 } 15072 function sanitizeConfig(config2, props) { 15073 if (!is.und(props.decay)) { 15074 config2.duration = void 0; 15075 } else { 15076 const isTensionConfig = !is.und(props.tension) || !is.und(props.friction); 15077 if (isTensionConfig || !is.und(props.frequency) || !is.und(props.damping) || !is.und(props.mass)) { 15078 config2.duration = void 0; 15079 config2.decay = void 0; 15080 } 15081 if (isTensionConfig) { 15082 config2.frequency = void 0; 15083 } 15084 } 15085 } 15086 var emptyArray = []; 15087 var Animation = class { 15088 constructor() { 15089 this.changed = false; 15090 this.values = emptyArray; 15091 this.toValues = null; 15092 this.fromValues = emptyArray; 15093 this.to = void 0; 15094 this.from = void 0; 15095 this.config = new AnimationConfig(); 15096 this.immediate = false; 15097 } 15098 }; 15099 function scheduleProps(callId, { 15100 key, 15101 props, 15102 defaultProps, 15103 state, 15104 actions 15105 }) { 15106 return new Promise((resolve, reject) => { 15107 var _props$cancel; 15108 let delay; 15109 let timeout; 15110 let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key); 15111 if (cancel) { 15112 onStart(); 15113 } else { 15114 if (!is.und(props.pause)) { 15115 state.paused = matchProp(props.pause, key); 15116 } 15117 let pause = defaultProps == null ? void 0 : defaultProps.pause; 15118 if (pause !== true) { 15119 pause = state.paused || matchProp(pause, key); 15120 } 15121 delay = callProp(props.delay || 0, key); 15122 if (pause) { 15123 state.resumeQueue.add(onResume); 15124 actions.pause(); 15125 } else { 15126 actions.resume(); 15127 onResume(); 15128 } 15129 } 15130 function onPause() { 15131 state.resumeQueue.add(onResume); 15132 state.timeouts.delete(timeout); 15133 timeout.cancel(); 15134 delay = timeout.time - raf.now(); 15135 } 15136 function onResume() { 15137 if (delay > 0 && !globals.skipAnimation) { 15138 state.delayed = true; 15139 timeout = raf.setTimeout(onStart, delay); 15140 state.pauseQueue.add(onPause); 15141 state.timeouts.add(timeout); 15142 } else { 15143 onStart(); 15144 } 15145 } 15146 function onStart() { 15147 if (state.delayed) { 15148 state.delayed = false; 15149 } 15150 state.pauseQueue.delete(onPause); 15151 state.timeouts.delete(timeout); 15152 if (callId <= (state.cancelId || 0)) { 15153 cancel = true; 15154 } 15155 try { 15156 actions.start(_extends3({}, props, { 15157 callId, 15158 cancel 15159 }), resolve); 15160 } catch (err) { 15161 reject(err); 15162 } 15163 } 15164 }); 15165 } 15166 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)); 15167 var getNoopResult = (value) => ({ 15168 value, 15169 noop: true, 15170 finished: true, 15171 cancelled: false 15172 }); 15173 var getFinishedResult = (value, finished, cancelled = false) => ({ 15174 value, 15175 finished, 15176 cancelled 15177 }); 15178 var getCancelledResult = (value) => ({ 15179 value, 15180 cancelled: true, 15181 finished: false 15182 }); 15183 function runAsync(to2, props, state, target) { 15184 const { 15185 callId, 15186 parentId, 15187 onRest 15188 } = props; 15189 const { 15190 asyncTo: prevTo, 15191 promise: prevPromise 15192 } = state; 15193 if (!parentId && to2 === prevTo && !props.reset) { 15194 return prevPromise; 15195 } 15196 return state.promise = (async () => { 15197 state.asyncId = callId; 15198 state.asyncTo = to2; 15199 const defaultProps = getDefaultProps(props, (value, key) => key === "onRest" ? void 0 : value); 15200 let preventBail; 15201 let bail; 15202 const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject)); 15203 const bailIfEnded = (bailSignal) => { 15204 const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false); 15205 if (bailResult) { 15206 bailSignal.result = bailResult; 15207 bail(bailSignal); 15208 throw bailSignal; 15209 } 15210 }; 15211 const animate = (arg1, arg2) => { 15212 const bailSignal = new BailSignal(); 15213 const skipAnimationSignal = new SkipAniamtionSignal(); 15214 return (async () => { 15215 if (globals.skipAnimation) { 15216 stopAsync(state); 15217 skipAnimationSignal.result = getFinishedResult(target, false); 15218 bail(skipAnimationSignal); 15219 throw skipAnimationSignal; 15220 } 15221 bailIfEnded(bailSignal); 15222 const props2 = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, { 15223 to: arg1 15224 }); 15225 props2.parentId = callId; 15226 eachProp(defaultProps, (value, key) => { 15227 if (is.und(props2[key])) { 15228 props2[key] = value; 15229 } 15230 }); 15231 const result2 = await target.start(props2); 15232 bailIfEnded(bailSignal); 15233 if (state.paused) { 15234 await new Promise((resume) => { 15235 state.resumeQueue.add(resume); 15236 }); 15237 } 15238 return result2; 15239 })(); 15240 }; 15241 let result; 15242 if (globals.skipAnimation) { 15243 stopAsync(state); 15244 return getFinishedResult(target, false); 15245 } 15246 try { 15247 let animating; 15248 if (is.arr(to2)) { 15249 animating = (async (queue) => { 15250 for (const props2 of queue) { 15251 await animate(props2); 15252 } 15253 })(to2); 15254 } else { 15255 animating = Promise.resolve(to2(animate, target.stop.bind(target))); 15256 } 15257 await Promise.all([animating.then(preventBail), bailPromise]); 15258 result = getFinishedResult(target.get(), true, false); 15259 } catch (err) { 15260 if (err instanceof BailSignal) { 15261 result = err.result; 15262 } else if (err instanceof SkipAniamtionSignal) { 15263 result = err.result; 15264 } else { 15265 throw err; 15266 } 15267 } finally { 15268 if (callId == state.asyncId) { 15269 state.asyncId = parentId; 15270 state.asyncTo = parentId ? prevTo : void 0; 15271 state.promise = parentId ? prevPromise : void 0; 15272 } 15273 } 15274 if (is.fun(onRest)) { 15275 raf.batchedUpdates(() => { 15276 onRest(result, target, target.item); 15277 }); 15278 } 15279 return result; 15280 })(); 15281 } 15282 function stopAsync(state, cancelId) { 15283 flush(state.timeouts, (t3) => t3.cancel()); 15284 state.pauseQueue.clear(); 15285 state.resumeQueue.clear(); 15286 state.asyncId = state.asyncTo = state.promise = void 0; 15287 if (cancelId) state.cancelId = cancelId; 15288 } 15289 var BailSignal = class extends Error { 15290 constructor() { 15291 super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."); 15292 this.result = void 0; 15293 } 15294 }; 15295 var SkipAniamtionSignal = class extends Error { 15296 constructor() { 15297 super("SkipAnimationSignal"); 15298 this.result = void 0; 15299 } 15300 }; 15301 var isFrameValue = (value) => value instanceof FrameValue; 15302 var nextId$1 = 1; 15303 var FrameValue = class extends FluidValue { 15304 constructor(...args) { 15305 super(...args); 15306 this.id = nextId$1++; 15307 this.key = void 0; 15308 this._priority = 0; 15309 } 15310 get priority() { 15311 return this._priority; 15312 } 15313 set priority(priority2) { 15314 if (this._priority != priority2) { 15315 this._priority = priority2; 15316 this._onPriorityChange(priority2); 15317 } 15318 } 15319 get() { 15320 const node = getAnimated(this); 15321 return node && node.getValue(); 15322 } 15323 to(...args) { 15324 return globals.to(this, args); 15325 } 15326 interpolate(...args) { 15327 deprecateInterpolate(); 15328 return globals.to(this, args); 15329 } 15330 toJSON() { 15331 return this.get(); 15332 } 15333 observerAdded(count) { 15334 if (count == 1) this._attach(); 15335 } 15336 observerRemoved(count) { 15337 if (count == 0) this._detach(); 15338 } 15339 _attach() { 15340 } 15341 _detach() { 15342 } 15343 _onChange(value, idle = false) { 15344 callFluidObservers(this, { 15345 type: "change", 15346 parent: this, 15347 value, 15348 idle 15349 }); 15350 } 15351 _onPriorityChange(priority2) { 15352 if (!this.idle) { 15353 frameLoop.sort(this); 15354 } 15355 callFluidObservers(this, { 15356 type: "priority", 15357 parent: this, 15358 priority: priority2 15359 }); 15360 } 15361 }; 15362 var $P = /* @__PURE__ */ Symbol.for("SpringPhase"); 15363 var HAS_ANIMATED = 1; 15364 var IS_ANIMATING = 2; 15365 var IS_PAUSED = 4; 15366 var hasAnimated = (target) => (target[$P] & HAS_ANIMATED) > 0; 15367 var isAnimating = (target) => (target[$P] & IS_ANIMATING) > 0; 15368 var isPaused = (target) => (target[$P] & IS_PAUSED) > 0; 15369 var setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING; 15370 var setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED; 15371 var SpringValue = class extends FrameValue { 15372 constructor(arg1, arg2) { 15373 super(); 15374 this.key = void 0; 15375 this.animation = new Animation(); 15376 this.queue = void 0; 15377 this.defaultProps = {}; 15378 this._state = { 15379 paused: false, 15380 delayed: false, 15381 pauseQueue: /* @__PURE__ */ new Set(), 15382 resumeQueue: /* @__PURE__ */ new Set(), 15383 timeouts: /* @__PURE__ */ new Set() 15384 }; 15385 this._pendingCalls = /* @__PURE__ */ new Set(); 15386 this._lastCallId = 0; 15387 this._lastToId = 0; 15388 this._memoizedDuration = 0; 15389 if (!is.und(arg1) || !is.und(arg2)) { 15390 const props = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, { 15391 from: arg1 15392 }); 15393 if (is.und(props.default)) { 15394 props.default = true; 15395 } 15396 this.start(props); 15397 } 15398 } 15399 get idle() { 15400 return !(isAnimating(this) || this._state.asyncTo) || isPaused(this); 15401 } 15402 get goal() { 15403 return getFluidValue(this.animation.to); 15404 } 15405 get velocity() { 15406 const node = getAnimated(this); 15407 return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map((node2) => node2.lastVelocity || 0); 15408 } 15409 get hasAnimated() { 15410 return hasAnimated(this); 15411 } 15412 get isAnimating() { 15413 return isAnimating(this); 15414 } 15415 get isPaused() { 15416 return isPaused(this); 15417 } 15418 get isDelayed() { 15419 return this._state.delayed; 15420 } 15421 advance(dt) { 15422 let idle = true; 15423 let changed = false; 15424 const anim = this.animation; 15425 let { 15426 config: config2, 15427 toValues 15428 } = anim; 15429 const payload = getPayload(anim.to); 15430 if (!payload && hasFluidValue(anim.to)) { 15431 toValues = toArray(getFluidValue(anim.to)); 15432 } 15433 anim.values.forEach((node2, i2) => { 15434 if (node2.done) return; 15435 const to2 = node2.constructor == AnimatedString ? 1 : payload ? payload[i2].lastPosition : toValues[i2]; 15436 let finished = anim.immediate; 15437 let position = to2; 15438 if (!finished) { 15439 position = node2.lastPosition; 15440 if (config2.tension <= 0) { 15441 node2.done = true; 15442 return; 15443 } 15444 let elapsed = node2.elapsedTime += dt; 15445 const from = anim.fromValues[i2]; 15446 const v0 = node2.v0 != null ? node2.v0 : node2.v0 = is.arr(config2.velocity) ? config2.velocity[i2] : config2.velocity; 15447 let velocity; 15448 const precision = config2.precision || (from == to2 ? 5e-3 : Math.min(1, Math.abs(to2 - from) * 1e-3)); 15449 if (!is.und(config2.duration)) { 15450 let p3 = 1; 15451 if (config2.duration > 0) { 15452 if (this._memoizedDuration !== config2.duration) { 15453 this._memoizedDuration = config2.duration; 15454 if (node2.durationProgress > 0) { 15455 node2.elapsedTime = config2.duration * node2.durationProgress; 15456 elapsed = node2.elapsedTime += dt; 15457 } 15458 } 15459 p3 = (config2.progress || 0) + elapsed / this._memoizedDuration; 15460 p3 = p3 > 1 ? 1 : p3 < 0 ? 0 : p3; 15461 node2.durationProgress = p3; 15462 } 15463 position = from + config2.easing(p3) * (to2 - from); 15464 velocity = (position - node2.lastPosition) / dt; 15465 finished = p3 == 1; 15466 } else if (config2.decay) { 15467 const decay = config2.decay === true ? 0.998 : config2.decay; 15468 const e2 = Math.exp(-(1 - decay) * elapsed); 15469 position = from + v0 / (1 - decay) * (1 - e2); 15470 finished = Math.abs(node2.lastPosition - position) <= precision; 15471 velocity = v0 * e2; 15472 } else { 15473 velocity = node2.lastVelocity == null ? v0 : node2.lastVelocity; 15474 const restVelocity = config2.restVelocity || precision / 10; 15475 const bounceFactor = config2.clamp ? 0 : config2.bounce; 15476 const canBounce = !is.und(bounceFactor); 15477 const isGrowing = from == to2 ? node2.v0 > 0 : from < to2; 15478 let isMoving; 15479 let isBouncing = false; 15480 const step = 1; 15481 const numSteps = Math.ceil(dt / step); 15482 for (let n2 = 0; n2 < numSteps; ++n2) { 15483 isMoving = Math.abs(velocity) > restVelocity; 15484 if (!isMoving) { 15485 finished = Math.abs(to2 - position) <= precision; 15486 if (finished) { 15487 break; 15488 } 15489 } 15490 if (canBounce) { 15491 isBouncing = position == to2 || position > to2 == isGrowing; 15492 if (isBouncing) { 15493 velocity = -velocity * bounceFactor; 15494 position = to2; 15495 } 15496 } 15497 const springForce = -config2.tension * 1e-6 * (position - to2); 15498 const dampingForce = -config2.friction * 1e-3 * velocity; 15499 const acceleration = (springForce + dampingForce) / config2.mass; 15500 velocity = velocity + acceleration * step; 15501 position = position + velocity * step; 15502 } 15503 } 15504 node2.lastVelocity = velocity; 15505 if (Number.isNaN(position)) { 15506 console.warn(`Got NaN while animating:`, this); 15507 finished = true; 15508 } 15509 } 15510 if (payload && !payload[i2].done) { 15511 finished = false; 15512 } 15513 if (finished) { 15514 node2.done = true; 15515 } else { 15516 idle = false; 15517 } 15518 if (node2.setValue(position, config2.round)) { 15519 changed = true; 15520 } 15521 }); 15522 const node = getAnimated(this); 15523 const currVal = node.getValue(); 15524 if (idle) { 15525 const finalVal = getFluidValue(anim.to); 15526 if ((currVal !== finalVal || changed) && !config2.decay) { 15527 node.setValue(finalVal); 15528 this._onChange(finalVal); 15529 } else if (changed && config2.decay) { 15530 this._onChange(currVal); 15531 } 15532 this._stop(); 15533 } else if (changed) { 15534 this._onChange(currVal); 15535 } 15536 } 15537 set(value) { 15538 raf.batchedUpdates(() => { 15539 this._stop(); 15540 this._focus(value); 15541 this._set(value); 15542 }); 15543 return this; 15544 } 15545 pause() { 15546 this._update({ 15547 pause: true 15548 }); 15549 } 15550 resume() { 15551 this._update({ 15552 pause: false 15553 }); 15554 } 15555 finish() { 15556 if (isAnimating(this)) { 15557 const { 15558 to: to2, 15559 config: config2 15560 } = this.animation; 15561 raf.batchedUpdates(() => { 15562 this._onStart(); 15563 if (!config2.decay) { 15564 this._set(to2, false); 15565 } 15566 this._stop(); 15567 }); 15568 } 15569 return this; 15570 } 15571 update(props) { 15572 const queue = this.queue || (this.queue = []); 15573 queue.push(props); 15574 return this; 15575 } 15576 start(to2, arg2) { 15577 let queue; 15578 if (!is.und(to2)) { 15579 queue = [is.obj(to2) ? to2 : _extends3({}, arg2, { 15580 to: to2 15581 })]; 15582 } else { 15583 queue = this.queue || []; 15584 this.queue = []; 15585 } 15586 return Promise.all(queue.map((props) => { 15587 const up = this._update(props); 15588 return up; 15589 })).then((results) => getCombinedResult(this, results)); 15590 } 15591 stop(cancel) { 15592 const { 15593 to: to2 15594 } = this.animation; 15595 this._focus(this.get()); 15596 stopAsync(this._state, cancel && this._lastCallId); 15597 raf.batchedUpdates(() => this._stop(to2, cancel)); 15598 return this; 15599 } 15600 reset() { 15601 this._update({ 15602 reset: true 15603 }); 15604 } 15605 eventObserved(event) { 15606 if (event.type == "change") { 15607 this._start(); 15608 } else if (event.type == "priority") { 15609 this.priority = event.priority + 1; 15610 } 15611 } 15612 _prepareNode(props) { 15613 const key = this.key || ""; 15614 let { 15615 to: to2, 15616 from 15617 } = props; 15618 to2 = is.obj(to2) ? to2[key] : to2; 15619 if (to2 == null || isAsyncTo(to2)) { 15620 to2 = void 0; 15621 } 15622 from = is.obj(from) ? from[key] : from; 15623 if (from == null) { 15624 from = void 0; 15625 } 15626 const range = { 15627 to: to2, 15628 from 15629 }; 15630 if (!hasAnimated(this)) { 15631 if (props.reverse) [to2, from] = [from, to2]; 15632 from = getFluidValue(from); 15633 if (!is.und(from)) { 15634 this._set(from); 15635 } else if (!getAnimated(this)) { 15636 this._set(to2); 15637 } 15638 } 15639 return range; 15640 } 15641 _update(_ref, isLoop) { 15642 let props = _extends3({}, _ref); 15643 const { 15644 key, 15645 defaultProps 15646 } = this; 15647 if (props.default) Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value)); 15648 mergeActiveFn(this, props, "onProps"); 15649 sendEvent(this, "onProps", props, this); 15650 const range = this._prepareNode(props); 15651 if (Object.isFrozen(this)) { 15652 throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?"); 15653 } 15654 const state = this._state; 15655 return scheduleProps(++this._lastCallId, { 15656 key, 15657 props, 15658 defaultProps, 15659 state, 15660 actions: { 15661 pause: () => { 15662 if (!isPaused(this)) { 15663 setPausedBit(this, true); 15664 flushCalls(state.pauseQueue); 15665 sendEvent(this, "onPause", getFinishedResult(this, checkFinished(this, this.animation.to)), this); 15666 } 15667 }, 15668 resume: () => { 15669 if (isPaused(this)) { 15670 setPausedBit(this, false); 15671 if (isAnimating(this)) { 15672 this._resume(); 15673 } 15674 flushCalls(state.resumeQueue); 15675 sendEvent(this, "onResume", getFinishedResult(this, checkFinished(this, this.animation.to)), this); 15676 } 15677 }, 15678 start: this._merge.bind(this, range) 15679 } 15680 }).then((result) => { 15681 if (props.loop && result.finished && !(isLoop && result.noop)) { 15682 const nextProps = createLoopUpdate(props); 15683 if (nextProps) { 15684 return this._update(nextProps, true); 15685 } 15686 } 15687 return result; 15688 }); 15689 } 15690 _merge(range, props, resolve) { 15691 if (props.cancel) { 15692 this.stop(true); 15693 return resolve(getCancelledResult(this)); 15694 } 15695 const hasToProp = !is.und(range.to); 15696 const hasFromProp = !is.und(range.from); 15697 if (hasToProp || hasFromProp) { 15698 if (props.callId > this._lastToId) { 15699 this._lastToId = props.callId; 15700 } else { 15701 return resolve(getCancelledResult(this)); 15702 } 15703 } 15704 const { 15705 key, 15706 defaultProps, 15707 animation: anim 15708 } = this; 15709 const { 15710 to: prevTo, 15711 from: prevFrom 15712 } = anim; 15713 let { 15714 to: to2 = prevTo, 15715 from = prevFrom 15716 } = range; 15717 if (hasFromProp && !hasToProp && (!props.default || is.und(to2))) { 15718 to2 = from; 15719 } 15720 if (props.reverse) [to2, from] = [from, to2]; 15721 const hasFromChanged = !isEqual(from, prevFrom); 15722 if (hasFromChanged) { 15723 anim.from = from; 15724 } 15725 from = getFluidValue(from); 15726 const hasToChanged = !isEqual(to2, prevTo); 15727 if (hasToChanged) { 15728 this._focus(to2); 15729 } 15730 const hasAsyncTo = isAsyncTo(props.to); 15731 const { 15732 config: config2 15733 } = anim; 15734 const { 15735 decay, 15736 velocity 15737 } = config2; 15738 if (hasToProp || hasFromProp) { 15739 config2.velocity = 0; 15740 } 15741 if (props.config && !hasAsyncTo) { 15742 mergeConfig(config2, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0); 15743 } 15744 let node = getAnimated(this); 15745 if (!node || is.und(to2)) { 15746 return resolve(getFinishedResult(this, true)); 15747 } 15748 const reset = is.und(props.reset) ? hasFromProp && !props.default : !is.und(from) && matchProp(props.reset, key); 15749 const value = reset ? from : this.get(); 15750 const goal = computeGoal(to2); 15751 const isAnimatable = is.num(goal) || is.arr(goal) || isAnimatedString(goal); 15752 const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key)); 15753 if (hasToChanged) { 15754 const nodeType = getAnimatedType(to2); 15755 if (nodeType !== node.constructor) { 15756 if (immediate) { 15757 node = this._set(goal); 15758 } else throw Error(`Cannot animate between $node.constructor.name} and $nodeType.name}, as the "to" prop suggests`); 15759 } 15760 } 15761 const goalType = node.constructor; 15762 let started = hasFluidValue(to2); 15763 let finished = false; 15764 if (!started) { 15765 const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged; 15766 if (hasToChanged || hasValueChanged) { 15767 finished = isEqual(computeGoal(value), goal); 15768 started = !finished; 15769 } 15770 if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) { 15771 started = true; 15772 } 15773 } 15774 if (finished && isAnimating(this)) { 15775 if (anim.changed && !reset) { 15776 started = true; 15777 } else if (!started) { 15778 this._stop(prevTo); 15779 } 15780 } 15781 if (!hasAsyncTo) { 15782 if (started || hasFluidValue(prevTo)) { 15783 anim.values = node.getPayload(); 15784 anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal); 15785 } 15786 if (anim.immediate != immediate) { 15787 anim.immediate = immediate; 15788 if (!immediate && !reset) { 15789 this._set(prevTo); 15790 } 15791 } 15792 if (started) { 15793 const { 15794 onRest 15795 } = anim; 15796 each(ACTIVE_EVENTS, (type) => mergeActiveFn(this, props, type)); 15797 const result = getFinishedResult(this, checkFinished(this, prevTo)); 15798 flushCalls(this._pendingCalls, result); 15799 this._pendingCalls.add(resolve); 15800 if (anim.changed) raf.batchedUpdates(() => { 15801 anim.changed = !reset; 15802 onRest == null ? void 0 : onRest(result, this); 15803 if (reset) { 15804 callProp(defaultProps.onRest, result); 15805 } else { 15806 anim.onStart == null ? void 0 : anim.onStart(result, this); 15807 } 15808 }); 15809 } 15810 } 15811 if (reset) { 15812 this._set(value); 15813 } 15814 if (hasAsyncTo) { 15815 resolve(runAsync(props.to, props, this._state, this)); 15816 } else if (started) { 15817 this._start(); 15818 } else if (isAnimating(this) && !hasToChanged) { 15819 this._pendingCalls.add(resolve); 15820 } else { 15821 resolve(getNoopResult(value)); 15822 } 15823 } 15824 _focus(value) { 15825 const anim = this.animation; 15826 if (value !== anim.to) { 15827 if (getFluidObservers(this)) { 15828 this._detach(); 15829 } 15830 anim.to = value; 15831 if (getFluidObservers(this)) { 15832 this._attach(); 15833 } 15834 } 15835 } 15836 _attach() { 15837 let priority2 = 0; 15838 const { 15839 to: to2 15840 } = this.animation; 15841 if (hasFluidValue(to2)) { 15842 addFluidObserver(to2, this); 15843 if (isFrameValue(to2)) { 15844 priority2 = to2.priority + 1; 15845 } 15846 } 15847 this.priority = priority2; 15848 } 15849 _detach() { 15850 const { 15851 to: to2 15852 } = this.animation; 15853 if (hasFluidValue(to2)) { 15854 removeFluidObserver(to2, this); 15855 } 15856 } 15857 _set(arg, idle = true) { 15858 const value = getFluidValue(arg); 15859 if (!is.und(value)) { 15860 const oldNode = getAnimated(this); 15861 if (!oldNode || !isEqual(value, oldNode.getValue())) { 15862 const nodeType = getAnimatedType(value); 15863 if (!oldNode || oldNode.constructor != nodeType) { 15864 setAnimated(this, nodeType.create(value)); 15865 } else { 15866 oldNode.setValue(value); 15867 } 15868 if (oldNode) { 15869 raf.batchedUpdates(() => { 15870 this._onChange(value, idle); 15871 }); 15872 } 15873 } 15874 } 15875 return getAnimated(this); 15876 } 15877 _onStart() { 15878 const anim = this.animation; 15879 if (!anim.changed) { 15880 anim.changed = true; 15881 sendEvent(this, "onStart", getFinishedResult(this, checkFinished(this, anim.to)), this); 15882 } 15883 } 15884 _onChange(value, idle) { 15885 if (!idle) { 15886 this._onStart(); 15887 callProp(this.animation.onChange, value, this); 15888 } 15889 callProp(this.defaultProps.onChange, value, this); 15890 super._onChange(value, idle); 15891 } 15892 _start() { 15893 const anim = this.animation; 15894 getAnimated(this).reset(getFluidValue(anim.to)); 15895 if (!anim.immediate) { 15896 anim.fromValues = anim.values.map((node) => node.lastPosition); 15897 } 15898 if (!isAnimating(this)) { 15899 setActiveBit(this, true); 15900 if (!isPaused(this)) { 15901 this._resume(); 15902 } 15903 } 15904 } 15905 _resume() { 15906 if (globals.skipAnimation) { 15907 this.finish(); 15908 } else { 15909 frameLoop.start(this); 15910 } 15911 } 15912 _stop(goal, cancel) { 15913 if (isAnimating(this)) { 15914 setActiveBit(this, false); 15915 const anim = this.animation; 15916 each(anim.values, (node) => { 15917 node.done = true; 15918 }); 15919 if (anim.toValues) { 15920 anim.onChange = anim.onPause = anim.onResume = void 0; 15921 } 15922 callFluidObservers(this, { 15923 type: "idle", 15924 parent: this 15925 }); 15926 const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to)); 15927 flushCalls(this._pendingCalls, result); 15928 if (anim.changed) { 15929 anim.changed = false; 15930 sendEvent(this, "onRest", result, this); 15931 } 15932 } 15933 } 15934 }; 15935 function checkFinished(target, to2) { 15936 const goal = computeGoal(to2); 15937 const value = computeGoal(target.get()); 15938 return isEqual(value, goal); 15939 } 15940 function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) { 15941 let loopRet = callProp(loop2); 15942 if (loopRet) { 15943 const overrides = loopRet !== true && inferTo(loopRet); 15944 const reverse = (overrides || props).reverse; 15945 const reset = !overrides || overrides.reset; 15946 return createUpdate(_extends3({}, props, { 15947 loop: loop2, 15948 default: false, 15949 pause: void 0, 15950 to: !reverse || isAsyncTo(to2) ? to2 : void 0, 15951 from: reset ? props.from : void 0, 15952 reset 15953 }, overrides)); 15954 } 15955 } 15956 function createUpdate(props) { 15957 const { 15958 to: to2, 15959 from 15960 } = props = inferTo(props); 15961 const keys = /* @__PURE__ */ new Set(); 15962 if (is.obj(to2)) findDefined(to2, keys); 15963 if (is.obj(from)) findDefined(from, keys); 15964 props.keys = keys.size ? Array.from(keys) : null; 15965 return props; 15966 } 15967 function findDefined(values, keys) { 15968 eachProp(values, (value, key) => value != null && keys.add(key)); 15969 } 15970 var ACTIVE_EVENTS = ["onStart", "onRest", "onChange", "onPause", "onResume"]; 15971 function mergeActiveFn(target, props, type) { 15972 target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : void 0; 15973 } 15974 function sendEvent(target, type, ...args) { 15975 var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps; 15976 (_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args); 15977 (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args); 15978 } 15979 var BATCHED_EVENTS = ["onStart", "onChange", "onRest"]; 15980 var nextId = 1; 15981 var Controller = class { 15982 constructor(props, flush2) { 15983 this.id = nextId++; 15984 this.springs = {}; 15985 this.queue = []; 15986 this.ref = void 0; 15987 this._flush = void 0; 15988 this._initialProps = void 0; 15989 this._lastAsyncId = 0; 15990 this._active = /* @__PURE__ */ new Set(); 15991 this._changed = /* @__PURE__ */ new Set(); 15992 this._started = false; 15993 this._item = void 0; 15994 this._state = { 15995 paused: false, 15996 pauseQueue: /* @__PURE__ */ new Set(), 15997 resumeQueue: /* @__PURE__ */ new Set(), 15998 timeouts: /* @__PURE__ */ new Set() 15999 }; 16000 this._events = { 16001 onStart: /* @__PURE__ */ new Map(), 16002 onChange: /* @__PURE__ */ new Map(), 16003 onRest: /* @__PURE__ */ new Map() 16004 }; 16005 this._onFrame = this._onFrame.bind(this); 16006 if (flush2) { 16007 this._flush = flush2; 16008 } 16009 if (props) { 16010 this.start(_extends3({ 16011 default: true 16012 }, props)); 16013 } 16014 } 16015 get idle() { 16016 return !this._state.asyncTo && Object.values(this.springs).every((spring) => { 16017 return spring.idle && !spring.isDelayed && !spring.isPaused; 16018 }); 16019 } 16020 get item() { 16021 return this._item; 16022 } 16023 set item(item) { 16024 this._item = item; 16025 } 16026 get() { 16027 const values = {}; 16028 this.each((spring, key) => values[key] = spring.get()); 16029 return values; 16030 } 16031 set(values) { 16032 for (const key in values) { 16033 const value = values[key]; 16034 if (!is.und(value)) { 16035 this.springs[key].set(value); 16036 } 16037 } 16038 } 16039 update(props) { 16040 if (props) { 16041 this.queue.push(createUpdate(props)); 16042 } 16043 return this; 16044 } 16045 start(props) { 16046 let { 16047 queue 16048 } = this; 16049 if (props) { 16050 queue = toArray(props).map(createUpdate); 16051 } else { 16052 this.queue = []; 16053 } 16054 if (this._flush) { 16055 return this._flush(this, queue); 16056 } 16057 prepareKeys(this, queue); 16058 return flushUpdateQueue(this, queue); 16059 } 16060 stop(arg, keys) { 16061 if (arg !== !!arg) { 16062 keys = arg; 16063 } 16064 if (keys) { 16065 const springs = this.springs; 16066 each(toArray(keys), (key) => springs[key].stop(!!arg)); 16067 } else { 16068 stopAsync(this._state, this._lastAsyncId); 16069 this.each((spring) => spring.stop(!!arg)); 16070 } 16071 return this; 16072 } 16073 pause(keys) { 16074 if (is.und(keys)) { 16075 this.start({ 16076 pause: true 16077 }); 16078 } else { 16079 const springs = this.springs; 16080 each(toArray(keys), (key) => springs[key].pause()); 16081 } 16082 return this; 16083 } 16084 resume(keys) { 16085 if (is.und(keys)) { 16086 this.start({ 16087 pause: false 16088 }); 16089 } else { 16090 const springs = this.springs; 16091 each(toArray(keys), (key) => springs[key].resume()); 16092 } 16093 return this; 16094 } 16095 each(iterator) { 16096 eachProp(this.springs, iterator); 16097 } 16098 _onFrame() { 16099 const { 16100 onStart, 16101 onChange, 16102 onRest 16103 } = this._events; 16104 const active = this._active.size > 0; 16105 const changed = this._changed.size > 0; 16106 if (active && !this._started || changed && !this._started) { 16107 this._started = true; 16108 flush(onStart, ([onStart2, result]) => { 16109 result.value = this.get(); 16110 onStart2(result, this, this._item); 16111 }); 16112 } 16113 const idle = !active && this._started; 16114 const values = changed || idle && onRest.size ? this.get() : null; 16115 if (changed && onChange.size) { 16116 flush(onChange, ([onChange2, result]) => { 16117 result.value = values; 16118 onChange2(result, this, this._item); 16119 }); 16120 } 16121 if (idle) { 16122 this._started = false; 16123 flush(onRest, ([onRest2, result]) => { 16124 result.value = values; 16125 onRest2(result, this, this._item); 16126 }); 16127 } 16128 } 16129 eventObserved(event) { 16130 if (event.type == "change") { 16131 this._changed.add(event.parent); 16132 if (!event.idle) { 16133 this._active.add(event.parent); 16134 } 16135 } else if (event.type == "idle") { 16136 this._active.delete(event.parent); 16137 } else return; 16138 raf.onFrame(this._onFrame); 16139 } 16140 }; 16141 function flushUpdateQueue(ctrl, queue) { 16142 return Promise.all(queue.map((props) => flushUpdate(ctrl, props))).then((results) => getCombinedResult(ctrl, results)); 16143 } 16144 async function flushUpdate(ctrl, props, isLoop) { 16145 const { 16146 keys, 16147 to: to2, 16148 from, 16149 loop: loop2, 16150 onRest, 16151 onResolve 16152 } = props; 16153 const defaults2 = is.obj(props.default) && props.default; 16154 if (loop2) { 16155 props.loop = false; 16156 } 16157 if (to2 === false) props.to = null; 16158 if (from === false) props.from = null; 16159 const asyncTo = is.arr(to2) || is.fun(to2) ? to2 : void 0; 16160 if (asyncTo) { 16161 props.to = void 0; 16162 props.onRest = void 0; 16163 if (defaults2) { 16164 defaults2.onRest = void 0; 16165 } 16166 } else { 16167 each(BATCHED_EVENTS, (key) => { 16168 const handler = props[key]; 16169 if (is.fun(handler)) { 16170 const queue = ctrl["_events"][key]; 16171 props[key] = ({ 16172 finished, 16173 cancelled 16174 }) => { 16175 const result2 = queue.get(handler); 16176 if (result2) { 16177 if (!finished) result2.finished = false; 16178 if (cancelled) result2.cancelled = true; 16179 } else { 16180 queue.set(handler, { 16181 value: null, 16182 finished: finished || false, 16183 cancelled: cancelled || false 16184 }); 16185 } 16186 }; 16187 if (defaults2) { 16188 defaults2[key] = props[key]; 16189 } 16190 } 16191 }); 16192 } 16193 const state = ctrl["_state"]; 16194 if (props.pause === !state.paused) { 16195 state.paused = props.pause; 16196 flushCalls(props.pause ? state.pauseQueue : state.resumeQueue); 16197 } else if (state.paused) { 16198 props.pause = true; 16199 } 16200 const promises = (keys || Object.keys(ctrl.springs)).map((key) => ctrl.springs[key].start(props)); 16201 const cancel = props.cancel === true || getDefaultProp(props, "cancel") === true; 16202 if (asyncTo || cancel && state.asyncId) { 16203 promises.push(scheduleProps(++ctrl["_lastAsyncId"], { 16204 props, 16205 state, 16206 actions: { 16207 pause: noop4, 16208 resume: noop4, 16209 start(props2, resolve) { 16210 if (cancel) { 16211 stopAsync(state, ctrl["_lastAsyncId"]); 16212 resolve(getCancelledResult(ctrl)); 16213 } else { 16214 props2.onRest = onRest; 16215 resolve(runAsync(asyncTo, props2, state, ctrl)); 16216 } 16217 } 16218 } 16219 })); 16220 } 16221 if (state.paused) { 16222 await new Promise((resume) => { 16223 state.resumeQueue.add(resume); 16224 }); 16225 } 16226 const result = getCombinedResult(ctrl, await Promise.all(promises)); 16227 if (loop2 && result.finished && !(isLoop && result.noop)) { 16228 const nextProps = createLoopUpdate(props, loop2, to2); 16229 if (nextProps) { 16230 prepareKeys(ctrl, [nextProps]); 16231 return flushUpdate(ctrl, nextProps, true); 16232 } 16233 } 16234 if (onResolve) { 16235 raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item)); 16236 } 16237 return result; 16238 } 16239 function createSpring(key, observer) { 16240 const spring = new SpringValue(); 16241 spring.key = key; 16242 if (observer) { 16243 addFluidObserver(spring, observer); 16244 } 16245 return spring; 16246 } 16247 function prepareSprings(springs, props, create) { 16248 if (props.keys) { 16249 each(props.keys, (key) => { 16250 const spring = springs[key] || (springs[key] = create(key)); 16251 spring["_prepareNode"](props); 16252 }); 16253 } 16254 } 16255 function prepareKeys(ctrl, queue) { 16256 each(queue, (props) => { 16257 prepareSprings(ctrl.springs, props, (key) => { 16258 return createSpring(key, ctrl); 16259 }); 16260 }); 16261 } 16262 function _objectWithoutPropertiesLoose(source, excluded) { 16263 if (source == null) return {}; 16264 var target = {}; 16265 var sourceKeys = Object.keys(source); 16266 var key, i2; 16267 for (i2 = 0; i2 < sourceKeys.length; i2++) { 16268 key = sourceKeys[i2]; 16269 if (excluded.indexOf(key) >= 0) continue; 16270 target[key] = source[key]; 16271 } 16272 return target; 16273 } 16274 var _excluded$3 = ["children"]; 16275 var SpringContext = (_ref) => { 16276 let { 16277 children 16278 } = _ref, props = _objectWithoutPropertiesLoose(_ref, _excluded$3); 16279 const inherited = (0, import_react13.useContext)(ctx); 16280 const pause = props.pause || !!inherited.pause, immediate = props.immediate || !!inherited.immediate; 16281 props = useMemoOne(() => ({ 16282 pause, 16283 immediate 16284 }), [pause, immediate]); 16285 const { 16286 Provider: Provider2 16287 } = ctx; 16288 return React58.createElement(Provider2, { 16289 value: props 16290 }, children); 16291 }; 16292 var ctx = makeContext(SpringContext, {}); 16293 SpringContext.Provider = ctx.Provider; 16294 SpringContext.Consumer = ctx.Consumer; 16295 function makeContext(target, init2) { 16296 Object.assign(target, React58.createContext(init2)); 16297 target.Provider._context = target; 16298 target.Consumer._context = target; 16299 return target; 16300 } 16301 var TransitionPhase; 16302 (function(TransitionPhase2) { 16303 TransitionPhase2["MOUNT"] = "mount"; 16304 TransitionPhase2["ENTER"] = "enter"; 16305 TransitionPhase2["UPDATE"] = "update"; 16306 TransitionPhase2["LEAVE"] = "leave"; 16307 })(TransitionPhase || (TransitionPhase = {})); 16308 var Interpolation = class extends FrameValue { 16309 constructor(source, args) { 16310 super(); 16311 this.key = void 0; 16312 this.idle = true; 16313 this.calc = void 0; 16314 this._active = /* @__PURE__ */ new Set(); 16315 this.source = source; 16316 this.calc = createInterpolator(...args); 16317 const value = this._get(); 16318 const nodeType = getAnimatedType(value); 16319 setAnimated(this, nodeType.create(value)); 16320 } 16321 advance(_dt) { 16322 const value = this._get(); 16323 const oldValue = this.get(); 16324 if (!isEqual(value, oldValue)) { 16325 getAnimated(this).setValue(value); 16326 this._onChange(value, this.idle); 16327 } 16328 if (!this.idle && checkIdle(this._active)) { 16329 becomeIdle(this); 16330 } 16331 } 16332 _get() { 16333 const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source)); 16334 return this.calc(...inputs); 16335 } 16336 _start() { 16337 if (this.idle && !checkIdle(this._active)) { 16338 this.idle = false; 16339 each(getPayload(this), (node) => { 16340 node.done = false; 16341 }); 16342 if (globals.skipAnimation) { 16343 raf.batchedUpdates(() => this.advance()); 16344 becomeIdle(this); 16345 } else { 16346 frameLoop.start(this); 16347 } 16348 } 16349 } 16350 _attach() { 16351 let priority2 = 1; 16352 each(toArray(this.source), (source) => { 16353 if (hasFluidValue(source)) { 16354 addFluidObserver(source, this); 16355 } 16356 if (isFrameValue(source)) { 16357 if (!source.idle) { 16358 this._active.add(source); 16359 } 16360 priority2 = Math.max(priority2, source.priority + 1); 16361 } 16362 }); 16363 this.priority = priority2; 16364 this._start(); 16365 } 16366 _detach() { 16367 each(toArray(this.source), (source) => { 16368 if (hasFluidValue(source)) { 16369 removeFluidObserver(source, this); 16370 } 16371 }); 16372 this._active.clear(); 16373 becomeIdle(this); 16374 } 16375 eventObserved(event) { 16376 if (event.type == "change") { 16377 if (event.idle) { 16378 this.advance(); 16379 } else { 16380 this._active.add(event.parent); 16381 this._start(); 16382 } 16383 } else if (event.type == "idle") { 16384 this._active.delete(event.parent); 16385 } else if (event.type == "priority") { 16386 this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0); 16387 } 16388 } 16389 }; 16390 function isIdle(source) { 16391 return source.idle !== false; 16392 } 16393 function checkIdle(active) { 16394 return !active.size || Array.from(active).every(isIdle); 16395 } 16396 function becomeIdle(self2) { 16397 if (!self2.idle) { 16398 self2.idle = true; 16399 each(getPayload(self2), (node) => { 16400 node.done = true; 16401 }); 16402 callFluidObservers(self2, { 16403 type: "idle", 16404 parent: self2 16405 }); 16406 } 16407 } 16408 globals.assign({ 16409 createStringInterpolator, 16410 to: (source, args) => new Interpolation(source, args) 16411 }); 16412 var update3 = frameLoop.advance; 16413 16414 // node_modules/@react-spring/web/dist/react-spring-web.esm.js 16415 var import_react_dom4 = __toESM(require_react_dom()); 16416 function _objectWithoutPropertiesLoose2(source, excluded) { 16417 if (source == null) return {}; 16418 var target = {}; 16419 var sourceKeys = Object.keys(source); 16420 var key, i2; 16421 for (i2 = 0; i2 < sourceKeys.length; i2++) { 16422 key = sourceKeys[i2]; 16423 if (excluded.indexOf(key) >= 0) continue; 16424 target[key] = source[key]; 16425 } 16426 return target; 16427 } 16428 var _excluded$2 = ["style", "children", "scrollTop", "scrollLeft"]; 16429 var isCustomPropRE = /^--/; 16430 function dangerousStyleValue(name2, value) { 16431 if (value == null || typeof value === "boolean" || value === "") return ""; 16432 if (typeof value === "number" && value !== 0 && !isCustomPropRE.test(name2) && !(isUnitlessNumber.hasOwnProperty(name2) && isUnitlessNumber[name2])) return value + "px"; 16433 return ("" + value).trim(); 16434 } 16435 var attributeCache = {}; 16436 function applyAnimatedValues(instance, props) { 16437 if (!instance.nodeType || !instance.setAttribute) { 16438 return false; 16439 } 16440 const isFilterElement = instance.nodeName === "filter" || instance.parentNode && instance.parentNode.nodeName === "filter"; 16441 const _ref = props, { 16442 style, 16443 children, 16444 scrollTop, 16445 scrollLeft 16446 } = _ref, attributes = _objectWithoutPropertiesLoose2(_ref, _excluded$2); 16447 const values = Object.values(attributes); 16448 const names = Object.keys(attributes).map((name2) => isFilterElement || instance.hasAttribute(name2) ? name2 : attributeCache[name2] || (attributeCache[name2] = name2.replace(/([A-Z])/g, (n2) => "-" + n2.toLowerCase()))); 16449 if (children !== void 0) { 16450 instance.textContent = children; 16451 } 16452 for (let name2 in style) { 16453 if (style.hasOwnProperty(name2)) { 16454 const value = dangerousStyleValue(name2, style[name2]); 16455 if (isCustomPropRE.test(name2)) { 16456 instance.style.setProperty(name2, value); 16457 } else { 16458 instance.style[name2] = value; 16459 } 16460 } 16461 } 16462 names.forEach((name2, i2) => { 16463 instance.setAttribute(name2, values[i2]); 16464 }); 16465 if (scrollTop !== void 0) { 16466 instance.scrollTop = scrollTop; 16467 } 16468 if (scrollLeft !== void 0) { 16469 instance.scrollLeft = scrollLeft; 16470 } 16471 } 16472 var isUnitlessNumber = { 16473 animationIterationCount: true, 16474 borderImageOutset: true, 16475 borderImageSlice: true, 16476 borderImageWidth: true, 16477 boxFlex: true, 16478 boxFlexGroup: true, 16479 boxOrdinalGroup: true, 16480 columnCount: true, 16481 columns: true, 16482 flex: true, 16483 flexGrow: true, 16484 flexPositive: true, 16485 flexShrink: true, 16486 flexNegative: true, 16487 flexOrder: true, 16488 gridRow: true, 16489 gridRowEnd: true, 16490 gridRowSpan: true, 16491 gridRowStart: true, 16492 gridColumn: true, 16493 gridColumnEnd: true, 16494 gridColumnSpan: true, 16495 gridColumnStart: true, 16496 fontWeight: true, 16497 lineClamp: true, 16498 lineHeight: true, 16499 opacity: true, 16500 order: true, 16501 orphans: true, 16502 tabSize: true, 16503 widows: true, 16504 zIndex: true, 16505 zoom: true, 16506 fillOpacity: true, 16507 floodOpacity: true, 16508 stopOpacity: true, 16509 strokeDasharray: true, 16510 strokeDashoffset: true, 16511 strokeMiterlimit: true, 16512 strokeOpacity: true, 16513 strokeWidth: true 16514 }; 16515 var prefixKey = (prefix2, key) => prefix2 + key.charAt(0).toUpperCase() + key.substring(1); 16516 var prefixes = ["Webkit", "Ms", "Moz", "O"]; 16517 isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => { 16518 prefixes.forEach((prefix2) => acc[prefixKey(prefix2, prop)] = acc[prop]); 16519 return acc; 16520 }, isUnitlessNumber); 16521 var _excluded$1 = ["x", "y", "z"]; 16522 var domTransforms = /^(matrix|translate|scale|rotate|skew)/; 16523 var pxTransforms = /^(translate)/; 16524 var degTransforms = /^(rotate|skew)/; 16525 var addUnit = (value, unit) => is.num(value) && value !== 0 ? value + unit : value; 16526 var isValueIdentity = (value, id) => is.arr(value) ? value.every((v2) => isValueIdentity(v2, id)) : is.num(value) ? value === id : parseFloat(value) === id; 16527 var AnimatedStyle = class extends AnimatedObject { 16528 constructor(_ref) { 16529 let { 16530 x: x2, 16531 y: y2, 16532 z 16533 } = _ref, style = _objectWithoutPropertiesLoose2(_ref, _excluded$1); 16534 const inputs = []; 16535 const transforms = []; 16536 if (x2 || y2 || z) { 16537 inputs.push([x2 || 0, y2 || 0, z || 0]); 16538 transforms.push((xyz) => [`translate3d($xyz.map((v2) => addUnit(v2, "px")).join(",")})`, isValueIdentity(xyz, 0)]); 16539 } 16540 eachProp(style, (value, key) => { 16541 if (key === "transform") { 16542 inputs.push([value || ""]); 16543 transforms.push((transform) => [transform, transform === ""]); 16544 } else if (domTransforms.test(key)) { 16545 delete style[key]; 16546 if (is.und(value)) return; 16547 const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : ""; 16548 inputs.push(toArray(value)); 16549 transforms.push(key === "rotate3d" ? ([x3, y3, z2, deg]) => [`rotate3d($x3},$y3},$z2},$addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : (input) => [`$key}($input.map((v2) => addUnit(v2, unit)).join(",")})`, isValueIdentity(input, key.startsWith("scale") ? 1 : 0)]); 16550 } 16551 }); 16552 if (inputs.length) { 16553 style.transform = new FluidTransform(inputs, transforms); 16554 } 16555 super(style); 16556 } 16557 }; 16558 var FluidTransform = class extends FluidValue { 16559 constructor(inputs, transforms) { 16560 super(); 16561 this._value = null; 16562 this.inputs = inputs; 16563 this.transforms = transforms; 16564 } 16565 get() { 16566 return this._value || (this._value = this._get()); 16567 } 16568 _get() { 16569 let transform = ""; 16570 let identity2 = true; 16571 each(this.inputs, (input, i2) => { 16572 const arg1 = getFluidValue(input[0]); 16573 const [t3, id] = this.transforms[i2](is.arr(arg1) ? arg1 : input.map(getFluidValue)); 16574 transform += " " + t3; 16575 identity2 = identity2 && id; 16576 }); 16577 return identity2 ? "none" : transform; 16578 } 16579 observerAdded(count) { 16580 if (count == 1) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && addFluidObserver(value, this))); 16581 } 16582 observerRemoved(count) { 16583 if (count == 0) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && removeFluidObserver(value, this))); 16584 } 16585 eventObserved(event) { 16586 if (event.type == "change") { 16587 this._value = null; 16588 } 16589 callFluidObservers(this, event); 16590 } 16591 }; 16592 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"]; 16593 var _excluded = ["scrollTop", "scrollLeft"]; 16594 globals.assign({ 16595 batchedUpdates: import_react_dom4.unstable_batchedUpdates, 16596 createStringInterpolator, 16597 colors 16598 }); 16599 var host = createHost(primitives, { 16600 applyAnimatedValues, 16601 createAnimatedStyle: (style) => new AnimatedStyle(style), 16602 getComponentProps: (_ref) => { 16603 let props = _objectWithoutPropertiesLoose2(_ref, _excluded); 16604 return props; 16605 } 16606 }); 16607 var animated = host.animated; 16608 16609 // packages/edit-site/build-module/components/layout/animation.mjs 16610 var import_element40 = __toESM(require_element(), 1); 16611 function getAbsolutePosition(element) { 16612 return { 16613 top: element.offsetTop, 16614 left: element.offsetLeft 16615 }; 16616 } 16617 var ANIMATION_DURATION = 400; 16618 function useMovingAnimation({ triggerAnimationOnChange }) { 16619 const ref = (0, import_element40.useRef)(); 16620 const { previous, prevRect } = (0, import_element40.useMemo)( 16621 () => ({ 16622 previous: ref.current && getAbsolutePosition(ref.current), 16623 prevRect: ref.current && ref.current.getBoundingClientRect() 16624 }), 16625 [triggerAnimationOnChange] 16626 ); 16627 (0, import_element40.useLayoutEffect)(() => { 16628 if (!previous || !ref.current) { 16629 return; 16630 } 16631 const disableAnimation = window.matchMedia( 16632 "(prefers-reduced-motion: reduce)" 16633 ).matches; 16634 if (disableAnimation) { 16635 return; 16636 } 16637 const controller = new Controller({ 16638 x: 0, 16639 y: 0, 16640 width: prevRect.width, 16641 height: prevRect.height, 16642 config: { 16643 duration: ANIMATION_DURATION, 16644 easing: easings.easeInOutQuint 16645 }, 16646 onChange({ value }) { 16647 if (!ref.current) { 16648 return; 16649 } 16650 let { x: x22, y: y22, width: width2, height: height2 } = value; 16651 x22 = Math.round(x22); 16652 y22 = Math.round(y22); 16653 width2 = Math.round(width2); 16654 height2 = Math.round(height2); 16655 const finishedMoving = x22 === 0 && y22 === 0; 16656 ref.current.style.transformOrigin = "center center"; 16657 ref.current.style.transform = finishedMoving ? null : `translate3d($x22}px,$y22}px,0)`; 16658 ref.current.style.width = finishedMoving ? null : `$width2}px`; 16659 ref.current.style.height = finishedMoving ? null : `$height2}px`; 16660 } 16661 }); 16662 ref.current.style.transform = void 0; 16663 const destination = ref.current.getBoundingClientRect(); 16664 const x2 = Math.round(prevRect.left - destination.left); 16665 const y2 = Math.round(prevRect.top - destination.top); 16666 const width = destination.width; 16667 const height = destination.height; 16668 controller.start({ 16669 x: 0, 16670 y: 0, 16671 width, 16672 height, 16673 from: { x: x2, y: y2, width: prevRect.width, height: prevRect.height } 16674 }); 16675 return () => { 16676 controller.stop(); 16677 controller.set({ 16678 x: 0, 16679 y: 0, 16680 width: prevRect.width, 16681 height: prevRect.height 16682 }); 16683 }; 16684 }, [previous, prevRect]); 16685 return ref; 16686 } 16687 var animation_default = useMovingAnimation; 16688 16689 // packages/edit-site/build-module/components/save-hub/index.mjs 16690 var import_data10 = __toESM(require_data(), 1); 16691 var import_components6 = __toESM(require_components(), 1); 16692 var import_core_data9 = __toESM(require_core_data(), 1); 16693 16694 // packages/edit-site/build-module/components/save-button/index.mjs 16695 var import_data9 = __toESM(require_data(), 1); 16696 var import_components5 = __toESM(require_components(), 1); 16697 var import_i18n6 = __toESM(require_i18n(), 1); 16698 var import_core_data8 = __toESM(require_core_data(), 1); 16699 var import_keycodes2 = __toESM(require_keycodes(), 1); 16700 var import_router3 = __toESM(require_router(), 1); 16701 var import_editor4 = __toESM(require_editor(), 1); 16702 16703 // packages/edit-site/build-module/utils/is-previewing-theme.mjs 16704 var import_url3 = __toESM(require_url(), 1); 16705 function isPreviewingTheme() { 16706 return !!(0, import_url3.getQueryArg)(window.location.href, "wp_theme_preview"); 16707 } 16708 function currentlyPreviewingTheme() { 16709 if (isPreviewingTheme()) { 16710 return (0, import_url3.getQueryArg)(window.location.href, "wp_theme_preview"); 16711 } 16712 return null; 16713 } 16714 16715 // packages/edit-site/build-module/components/save-button/index.mjs 16716 var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1); 16717 var { useLocation: useLocation3 } = unlock(import_router3.privateApis); 16718 function SaveButton({ 16719 className = "edit-site-save-button__button", 16720 variant = "primary", 16721 showTooltip = true, 16722 showReviewMessage, 16723 icon, 16724 size: size4, 16725 __next40pxDefaultSize = false 16726 }) { 16727 const { params } = useLocation3(); 16728 const { setIsSaveViewOpened: setIsSaveViewOpened2 } = (0, import_data9.useDispatch)(store); 16729 const { saveDirtyEntities } = unlock((0, import_data9.useDispatch)(import_editor4.store)); 16730 const { dirtyEntityRecords } = (0, import_editor4.useEntitiesSavedStatesIsDirty)(); 16731 const { isSaving, isSaveViewOpen, previewingThemeName } = (0, import_data9.useSelect)( 16732 (select4) => { 16733 const { isSavingEntityRecord, isResolving } = select4(import_core_data8.store); 16734 const { isSaveViewOpened: isSaveViewOpened2 } = select4(store); 16735 const isActivatingTheme = isResolving("activateTheme"); 16736 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 16737 return { 16738 isSaving: dirtyEntityRecords.some( 16739 (record) => isSavingEntityRecord( 16740 record.kind, 16741 record.name, 16742 record.key 16743 ) 16744 ) || isActivatingTheme, 16745 isSaveViewOpen: isSaveViewOpened2(), 16746 // Do not call `getTheme` with null, it will cause a request to 16747 // the server. 16748 previewingThemeName: currentlyPreviewingThemeId ? select4(import_core_data8.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0 16749 }; 16750 }, 16751 [dirtyEntityRecords] 16752 ); 16753 const hasDirtyEntities = !!dirtyEntityRecords.length; 16754 let isOnlyCurrentEntityDirty; 16755 if (dirtyEntityRecords.length === 1) { 16756 if (params.postId) { 16757 isOnlyCurrentEntityDirty = `$dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType; 16758 } else if (params.path?.includes("wp_global_styles")) { 16759 isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === "globalStyles"; 16760 } 16761 } 16762 const disabled2 = isSaving || !hasDirtyEntities && !isPreviewingTheme(); 16763 const getLabel = () => { 16764 if (isPreviewingTheme()) { 16765 if (isSaving) { 16766 return (0, import_i18n6.sprintf)( 16767 /* translators: %s: The name of theme to be activated. */ 16768 (0, import_i18n6.__)("Activating %s"), 16769 previewingThemeName 16770 ); 16771 } else if (disabled2) { 16772 return (0, import_i18n6.__)("Saved"); 16773 } else if (hasDirtyEntities) { 16774 return (0, import_i18n6.sprintf)( 16775 /* translators: %s: The name of theme to be activated. */ 16776 (0, import_i18n6.__)("Activate %s & Save"), 16777 previewingThemeName 16778 ); 16779 } 16780 return (0, import_i18n6.sprintf)( 16781 /* translators: %s: The name of theme to be activated. */ 16782 (0, import_i18n6.__)("Activate %s"), 16783 previewingThemeName 16784 ); 16785 } 16786 if (isSaving) { 16787 return (0, import_i18n6.__)("Saving"); 16788 } 16789 if (disabled2) { 16790 return (0, import_i18n6.__)("Saved"); 16791 } 16792 if (!isOnlyCurrentEntityDirty && showReviewMessage) { 16793 return (0, import_i18n6.sprintf)( 16794 // translators: %d: number of unsaved changes (number). 16795 (0, import_i18n6._n)( 16796 "Review %d change\u2026", 16797 "Review %d changes\u2026", 16798 dirtyEntityRecords.length 16799 ), 16800 dirtyEntityRecords.length 16801 ); 16802 } 16803 return (0, import_i18n6.__)("Save"); 16804 }; 16805 const label = getLabel(); 16806 const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ dirtyEntityRecords }) : () => setIsSaveViewOpened2(true); 16807 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)( 16808 import_components5.Button, 16809 { 16810 variant, 16811 className, 16812 "aria-disabled": disabled2, 16813 "aria-expanded": isSaveViewOpen, 16814 isBusy: isSaving, 16815 onClick: disabled2 ? void 0 : onClick, 16816 label, 16817 shortcut: disabled2 ? void 0 : import_keycodes2.displayShortcut.primary("s"), 16818 showTooltip, 16819 icon, 16820 __next40pxDefaultSize, 16821 size: size4, 16822 children: label 16823 } 16824 ); 16825 } 16826 16827 // packages/edit-site/build-module/components/save-hub/index.mjs 16828 var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1); 16829 function SaveHub() { 16830 const { isDisabled, isSaving } = (0, import_data10.useSelect)((select4) => { 16831 const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = select4(import_core_data9.store); 16832 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 16833 const _isSaving = dirtyEntityRecords.some( 16834 (record) => isSavingEntityRecord(record.kind, record.name, record.key) 16835 ); 16836 return { 16837 isSaving: _isSaving, 16838 isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme() 16839 }; 16840 }, []); 16841 return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components6.__experimentalHStack, { className: "edit-site-save-hub", alignment: "right", spacing: 4, children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)( 16842 SaveButton, 16843 { 16844 className: "edit-site-save-hub__button", 16845 variant: isDisabled ? null : "primary", 16846 showTooltip: false, 16847 icon: isDisabled && !isSaving ? check_default : null, 16848 showReviewMessage: true, 16849 __next40pxDefaultSize: true 16850 } 16851 ) }); 16852 } 16853 16854 // packages/edit-site/build-module/components/save-panel/index.mjs 16855 var import_components7 = __toESM(require_components(), 1); 16856 var import_editor5 = __toESM(require_editor(), 1); 16857 var import_data12 = __toESM(require_data(), 1); 16858 var import_i18n7 = __toESM(require_i18n(), 1); 16859 var import_core_data11 = __toESM(require_core_data(), 1); 16860 var import_router5 = __toESM(require_router(), 1); 16861 var import_element42 = __toESM(require_element(), 1); 16862 16863 // packages/edit-site/build-module/utils/use-activate-theme.mjs 16864 var import_core_data10 = __toESM(require_core_data(), 1); 16865 var import_data11 = __toESM(require_data(), 1); 16866 var import_router4 = __toESM(require_router(), 1); 16867 var import_url4 = __toESM(require_url(), 1); 16868 var { useHistory: useHistory3, useLocation: useLocation4 } = unlock(import_router4.privateApis); 16869 function useActivateTheme() { 16870 const history = useHistory3(); 16871 const { path } = useLocation4(); 16872 const { startResolution, finishResolution } = (0, import_data11.useDispatch)(import_core_data10.store); 16873 return async () => { 16874 if (isPreviewingTheme()) { 16875 const activationURL = "themes.php?action=activate&stylesheet=" + currentlyPreviewingTheme() + "&_wpnonce=" + window.WP_BLOCK_THEME_ACTIVATE_NONCE; 16876 startResolution("activateTheme"); 16877 await window.fetch(activationURL); 16878 finishResolution("activateTheme"); 16879 history.navigate((0, import_url4.addQueryArgs)(path, { wp_theme_preview: "" })); 16880 } 16881 }; 16882 } 16883 16884 // packages/edit-site/build-module/utils/use-actual-current-theme.mjs 16885 var import_api_fetch = __toESM(require_api_fetch(), 1); 16886 var import_element41 = __toESM(require_element(), 1); 16887 var import_url5 = __toESM(require_url(), 1); 16888 var ACTIVE_THEMES_URL = "/wp/v2/themes?status=active"; 16889 function useActualCurrentTheme() { 16890 const [currentTheme, setCurrentTheme] = (0, import_element41.useState)(); 16891 (0, import_element41.useEffect)(() => { 16892 const path = (0, import_url5.addQueryArgs)(ACTIVE_THEMES_URL, { 16893 context: "edit", 16894 wp_theme_preview: "" 16895 }); 16896 (0, import_api_fetch.default)({ path }).then((activeThemes) => setCurrentTheme(activeThemes[0])).catch(() => { 16897 }); 16898 }, []); 16899 return currentTheme; 16900 } 16901 16902 // packages/edit-site/build-module/components/save-panel/index.mjs 16903 var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1); 16904 var { EntitiesSavedStatesExtensible } = unlock(import_editor5.privateApis); 16905 var { useLocation: useLocation5 } = unlock(import_router5.privateApis); 16906 var EntitiesSavedStatesForPreview = ({ 16907 onClose, 16908 renderDialog, 16909 variant 16910 }) => { 16911 const isDirtyProps = (0, import_editor5.useEntitiesSavedStatesIsDirty)(); 16912 let activateSaveLabel, successNoticeContent; 16913 if (isDirtyProps.isDirty) { 16914 activateSaveLabel = (0, import_i18n7.__)("Activate & Save"); 16915 successNoticeContent = (0, import_i18n7.__)("Theme activated and site updated."); 16916 } else { 16917 activateSaveLabel = (0, import_i18n7.__)("Activate"); 16918 successNoticeContent = (0, import_i18n7.__)("Theme activated."); 16919 } 16920 const currentTheme = useActualCurrentTheme(); 16921 const previewingTheme = (0, import_data12.useSelect)( 16922 (select4) => select4(import_core_data11.store).getCurrentTheme(), 16923 [] 16924 ); 16925 const additionalPrompt = /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("p", { children: (0, import_i18n7.sprintf)( 16926 /* translators: 1: The name of active theme, 2: The name of theme to be activated. */ 16927 (0, import_i18n7.__)( 16928 "Saving your changes will change your active theme from %1$s to %2$s." 16929 ), 16930 currentTheme?.name?.rendered ?? "...", 16931 previewingTheme?.name?.rendered ?? "..." 16932 ) }); 16933 const activateTheme = useActivateTheme(); 16934 const onSave = async (values) => { 16935 await activateTheme(); 16936 return values; 16937 }; 16938 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)( 16939 EntitiesSavedStatesExtensible, 16940 { 16941 ...{ 16942 ...isDirtyProps, 16943 additionalPrompt, 16944 close: onClose, 16945 onSave, 16946 saveEnabled: true, 16947 saveLabel: activateSaveLabel, 16948 renderDialog, 16949 variant, 16950 successNoticeContent 16951 } 16952 } 16953 ); 16954 }; 16955 var _EntitiesSavedStates = ({ onClose, renderDialog, variant }) => { 16956 if (isPreviewingTheme()) { 16957 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)( 16958 EntitiesSavedStatesForPreview, 16959 { 16960 onClose, 16961 renderDialog, 16962 variant 16963 } 16964 ); 16965 } 16966 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)( 16967 import_editor5.EntitiesSavedStates, 16968 { 16969 close: onClose, 16970 renderDialog, 16971 variant 16972 } 16973 ); 16974 }; 16975 function SavePanel() { 16976 const { query } = useLocation5(); 16977 const { canvas = "view" } = query; 16978 const { isSaveViewOpen, isDirty, isSaving } = (0, import_data12.useSelect)((select4) => { 16979 const { 16980 __experimentalGetDirtyEntityRecords, 16981 isSavingEntityRecord, 16982 isResolving 16983 } = select4(import_core_data11.store); 16984 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); 16985 const isActivatingTheme = isResolving("activateTheme"); 16986 const { isSaveViewOpened: isSaveViewOpened2 } = unlock(select4(store)); 16987 return { 16988 isSaveViewOpen: isSaveViewOpened2(), 16989 isDirty: dirtyEntityRecords.length > 0, 16990 isSaving: dirtyEntityRecords.some( 16991 (record) => isSavingEntityRecord(record.kind, record.name, record.key) 16992 ) || isActivatingTheme 16993 }; 16994 }, []); 16995 const { setIsSaveViewOpened: setIsSaveViewOpened2 } = (0, import_data12.useDispatch)(store); 16996 const onClose = () => setIsSaveViewOpened2(false); 16997 (0, import_element42.useEffect)(() => { 16998 setIsSaveViewOpened2(false); 16999 }, [canvas, setIsSaveViewOpened2]); 17000 if (canvas === "view") { 17001 return isSaveViewOpen ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)( 17002 import_components7.Modal, 17003 { 17004 className: "edit-site-save-panel__modal", 17005 onRequestClose: onClose, 17006 title: (0, import_i18n7.__)("Review changes"), 17007 size: "small", 17008 children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(_EntitiesSavedStates, { onClose, variant: "inline" }) 17009 } 17010 ) : null; 17011 } 17012 const activateSaveEnabled = isPreviewingTheme() || isDirty; 17013 const disabled2 = isSaving || !activateSaveEnabled; 17014 return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)( 17015 navigable_region_default, 17016 { 17017 className: clsx_default("edit-site-layout__actions", { 17018 "is-entity-save-view-open": isSaveViewOpen 17019 }), 17020 ariaLabel: (0, import_i18n7.__)("Save panel"), 17021 children: [ 17022 /* @__PURE__ */ (0, import_jsx_runtime107.jsx)( 17023 "div", 17024 { 17025 className: clsx_default("edit-site-editor__toggle-save-panel", { 17026 "screen-reader-text": isSaveViewOpen 17027 }), 17028 children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)( 17029 import_components7.Button, 17030 { 17031 __next40pxDefaultSize: true, 17032 variant: "secondary", 17033 className: "edit-site-editor__toggle-save-panel-button", 17034 onClick: () => setIsSaveViewOpened2(true), 17035 "aria-haspopup": "dialog", 17036 disabled: disabled2, 17037 accessibleWhenDisabled: true, 17038 children: (0, import_i18n7.__)("Open save panel") 17039 } 17040 ) 17041 } 17042 ), 17043 isSaveViewOpen && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(_EntitiesSavedStates, { onClose, renderDialog: true }) 17044 ] 17045 } 17046 ); 17047 } 17048 17049 // packages/edit-site/build-module/components/layout/index.mjs 17050 var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1); 17051 var { useLocation: useLocation6 } = unlock(import_router6.privateApis); 17052 var { useStyle, UploadProgressSnackbar } = unlock(import_editor6.privateApis); 17053 var { ThemeProvider: ThemeProvider2 } = unlock(import_theme2.privateApis); 17054 var ANIMATION_DURATION2 = 0.3; 17055 var CONTENT_COLOR = { background: "#ffffff" }; 17056 function Layout() { 17057 const { query, name: routeKey, areas: areas2, widths } = useLocation6(); 17058 const canvas = routeKey === "notfound" ? "view" : query?.canvas ?? "view"; 17059 const hasAdminBarInEditor = window.__experimentalAdminBarInEditor; 17060 const showDesktopSiteHub = !hasAdminBarInEditor; 17061 const showMobileSiteHub = !hasAdminBarInEditor || routeKey !== "home"; 17062 const hasMobileAreas = areas2.mobileSidebar || areas2.mobileContent || areas2.preview; 17063 const isMobileViewport = (0, import_compose2.useViewportMatch)("medium", "<"); 17064 const toggleRef = (0, import_element43.useRef)(); 17065 const navigateRegionsProps = (0, import_components8.__unstableUseNavigateRegions)(); 17066 const disableMotion = (0, import_compose2.useReducedMotion)(); 17067 const [canvasResizer, canvasSize] = (0, import_compose2.useResizeObserver)(); 17068 const isEditorLoading = useIsSiteEditorLoading(); 17069 const [isResizableFrameOversized, setIsResizableFrameOversized] = (0, import_element43.useState)(false); 17070 const animationRef = animation_default({ 17071 triggerAnimationOnChange: routeKey + "-" + canvas 17072 }); 17073 const { showIconLabels } = (0, import_data13.useSelect)((select4) => { 17074 return { 17075 showIconLabels: select4(import_preferences3.store).get( 17076 "core", 17077 "showIconLabels" 17078 ) 17079 }; 17080 }); 17081 const backgroundColor = useStyle("color.background"); 17082 const gradientValue = useStyle("color.gradient"); 17083 const previousCanvaMode = (0, import_compose2.usePrevious)(canvas); 17084 (0, import_element43.useEffect)(() => { 17085 if (previousCanvaMode === "edit") { 17086 toggleRef.current?.focus(); 17087 } 17088 }, [canvas]); 17089 return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_jsx_runtime108.Fragment, { children: [ 17090 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_editor6.UnsavedChangesWarning, {}), 17091 canvas === "view" && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SaveKeyboardShortcut, {}), 17092 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17093 "div", 17094 { 17095 ...navigateRegionsProps, 17096 ref: navigateRegionsProps.ref, 17097 className: clsx_default( 17098 "edit-site-layout", 17099 navigateRegionsProps.className, 17100 { 17101 "is-full-canvas": canvas === "edit", 17102 "show-icon-labels": showIconLabels 17103 } 17104 ), 17105 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "edit-site-layout__content", children: [ 17106 (!isMobileViewport || !hasMobileAreas) && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17107 navigable_region_default, 17108 { 17109 ariaLabel: (0, import_i18n8.__)("Navigation"), 17110 className: "edit-site-layout__sidebar-region", 17111 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_components8.__unstableAnimatePresence, { children: canvas === "view" && /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)( 17112 import_components8.__unstableMotion.div, 17113 { 17114 initial: { opacity: 0 }, 17115 animate: { opacity: 1 }, 17116 exit: { opacity: 0 }, 17117 transition: { 17118 type: "tween", 17119 duration: ( 17120 // Disable transition in mobile to emulate a full page transition. 17121 disableMotion || isMobileViewport ? 0 : ANIMATION_DURATION2 17122 ), 17123 ease: "easeOut" 17124 }, 17125 className: "edit-site-layout__sidebar", 17126 children: [ 17127 showDesktopSiteHub && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17128 site_hub_default, 17129 { 17130 ref: toggleRef, 17131 isTransparent: isResizableFrameOversized 17132 } 17133 ), 17134 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SidebarNavigationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17135 SidebarContent, 17136 { 17137 shouldAnimate: routeKey !== "styles" && routeKey !== "identity", 17138 routeKey, 17139 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_editor6.ErrorBoundary, { children: areas2.sidebar }) 17140 } 17141 ) }), 17142 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SaveHub, {}), 17143 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SavePanel, {}) 17144 ] 17145 } 17146 ) }) 17147 } 17148 ), 17149 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_notices.SnackbarNotices, { className: "edit-site-layout__snackbar" }), 17150 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(UploadProgressSnackbar, {}), 17151 isMobileViewport && hasMobileAreas && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "edit-site-layout__mobile", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SidebarNavigationProvider, { children: canvas !== "edit" ? /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_jsx_runtime108.Fragment, { children: [ 17152 showMobileSiteHub && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17153 SiteHubMobile, 17154 { 17155 ref: toggleRef, 17156 isTransparent: isResizableFrameOversized 17157 } 17158 ), 17159 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SidebarContent, { routeKey, children: areas2.mobileContent ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17160 ThemeProvider2, 17161 { 17162 color: CONTENT_COLOR, 17163 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "edit-site-layout__mobile-content", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_editor6.ErrorBoundary, { children: areas2.mobileContent }) }) 17164 } 17165 ) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_editor6.ErrorBoundary, { children: areas2.mobileSidebar }) }), 17166 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SaveHub, {}), 17167 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SavePanel, {}) 17168 ] }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ThemeProvider2, { color: CONTENT_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_editor6.ErrorBoundary, { children: areas2.preview }) }) }) }), 17169 !isMobileViewport && areas2.content && canvas !== "edit" && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17170 "div", 17171 { 17172 className: "edit-site-layout__area", 17173 style: { 17174 maxWidth: widths?.content 17175 }, 17176 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ThemeProvider2, { color: CONTENT_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_editor6.ErrorBoundary, { children: areas2.content }) }) 17177 } 17178 ), 17179 !isMobileViewport && areas2.edit && canvas !== "edit" && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17180 "div", 17181 { 17182 className: "edit-site-layout__area", 17183 style: { 17184 maxWidth: widths?.edit 17185 }, 17186 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ThemeProvider2, { color: CONTENT_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_editor6.ErrorBoundary, { children: areas2.edit }) }) 17187 } 17188 ), 17189 !isMobileViewport && areas2.preview && /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "edit-site-layout__canvas-container", children: [ 17190 canvasResizer, 17191 !!canvasSize.width && /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17192 "div", 17193 { 17194 className: clsx_default( 17195 "edit-site-layout__canvas", 17196 { 17197 "is-right-aligned": isResizableFrameOversized 17198 } 17199 ), 17200 ref: animationRef, 17201 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_editor6.ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17202 resizable_frame_default, 17203 { 17204 isReady: !isEditorLoading, 17205 isFullWidth: canvas === "edit", 17206 defaultSize: { 17207 width: canvasSize.width - 24, 17208 height: canvasSize.height 17209 }, 17210 isOversized: isResizableFrameOversized, 17211 setIsOversized: setIsResizableFrameOversized, 17212 innerContentStyle: { 17213 background: gradientValue ?? backgroundColor 17214 }, 17215 children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 17216 ThemeProvider2, 17217 { 17218 color: CONTENT_COLOR, 17219 children: areas2.preview 17220 } 17221 ) 17222 } 17223 ) }) 17224 } 17225 ) 17226 ] }) 17227 ] }) 17228 } 17229 ) 17230 ] }); 17231 } 17232 function LayoutWithGlobalStylesProvider(props) { 17233 const themeColors = (0, import_element43.useMemo)(getAdminThemeColors, []); 17234 const { createErrorNotice } = (0, import_data13.useDispatch)(import_notices.store); 17235 function onPluginAreaError(name2) { 17236 createErrorNotice( 17237 (0, import_i18n8.sprintf)( 17238 /* translators: %s: plugin name */ 17239 (0, import_i18n8.__)( 17240 'The "%s" plugin has encountered an error and cannot be rendered.' 17241 ), 17242 name2 17243 ) 17244 ); 17245 } 17246 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_components8.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(tooltip_exports.Provider, { children: [ 17247 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_plugins2.PluginArea, { onError: onPluginAreaError }), 17248 /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ThemeProvider2, { color: themeColors, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Layout, { ...props }) }) 17249 ] }) }); 17250 } 17251 17252 // packages/edit-site/build-module/hooks/commands/use-common-commands.mjs 17253 var import_element44 = __toESM(require_element(), 1); 17254 var import_data14 = __toESM(require_data(), 1); 17255 var import_i18n9 = __toESM(require_i18n(), 1); 17256 var import_commands2 = __toESM(require_commands(), 1); 17257 var import_router7 = __toESM(require_router(), 1); 17258 var import_preferences4 = __toESM(require_preferences(), 1); 17259 var import_core_data12 = __toESM(require_core_data(), 1); 17260 var import_editor7 = __toESM(require_editor(), 1); 17261 var { useHistory: useHistory4, useLocation: useLocation7 } = unlock(import_router7.privateApis); 17262 var { useGlobalStyles } = unlock(import_editor7.privateApis); 17263 var getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() { 17264 const { openGeneralSidebar: openGeneralSidebar2 } = unlock((0, import_data14.useDispatch)(store)); 17265 const { params } = useLocation7(); 17266 const { canvas = "view" } = params; 17267 const { set: set3 } = (0, import_data14.useDispatch)(import_preferences4.store); 17268 const history = useHistory4(); 17269 const isBlockBasedTheme = (0, import_data14.useSelect)((select4) => { 17270 return select4(import_core_data12.store).getCurrentTheme().is_block_theme; 17271 }, []); 17272 const commands = (0, import_element44.useMemo)(() => { 17273 if (!isBlockBasedTheme) { 17274 return []; 17275 } 17276 return [ 17277 { 17278 name: "core/edit-site/toggle-styles-welcome-guide", 17279 label: (0, import_i18n9.__)("Learn about styles"), 17280 callback: ({ close }) => { 17281 close(); 17282 if (canvas !== "edit") { 17283 history.navigate("/styles?canvas=edit", { 17284 transition: "canvas-mode-edit-transition" 17285 }); 17286 } 17287 openGeneralSidebar2("edit-site/global-styles"); 17288 set3("core/edit-site", "welcomeGuideStyles", true); 17289 setTimeout(() => { 17290 set3("core/edit-site", "welcomeGuideStyles", true); 17291 }, 500); 17292 }, 17293 icon: help_default 17294 } 17295 ]; 17296 }, [history, openGeneralSidebar2, canvas, isBlockBasedTheme, set3]); 17297 return { 17298 isLoading: false, 17299 commands 17300 }; 17301 }; 17302 var getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() { 17303 const { user, setUser } = useGlobalStyles(); 17304 const canReset = !!user && (Object.keys(user?.styles ?? {}).length > 0 || Object.keys(user?.settings ?? {}).length > 0); 17305 const commands = (0, import_element44.useMemo)(() => { 17306 if (!canReset) { 17307 return []; 17308 } 17309 return [ 17310 { 17311 name: "core/edit-site/reset-global-styles", 17312 label: (0, import_i18n9.__)("Reset styles"), 17313 icon: (0, import_i18n9.isRTL)() ? rotate_right_default : rotate_left_default, 17314 callback: ({ close }) => { 17315 close(); 17316 setUser({ styles: {}, settings: {} }); 17317 } 17318 } 17319 ]; 17320 }, [canReset, setUser]); 17321 return { 17322 isLoading: false, 17323 commands 17324 }; 17325 }; 17326 var getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() { 17327 const { openGeneralSidebar: openGeneralSidebar2 } = unlock((0, import_data14.useDispatch)(store)); 17328 const { setStylesPath } = unlock((0, import_data14.useDispatch)(import_editor7.store)); 17329 const { params } = useLocation7(); 17330 const { canvas = "view" } = params; 17331 const history = useHistory4(); 17332 const hasRevisions = (0, import_data14.useSelect)((select4) => { 17333 const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select4(import_core_data12.store); 17334 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 17335 const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0; 17336 return !!globalStyles?._links?.["version-history"]?.[0]?.count; 17337 }, []); 17338 const commands = (0, import_element44.useMemo)(() => { 17339 if (!hasRevisions) { 17340 return []; 17341 } 17342 return [ 17343 { 17344 name: "core/edit-site/open-styles-revisions", 17345 label: (0, import_i18n9.__)("Open style revisions"), 17346 icon: backup_default, 17347 callback: ({ close }) => { 17348 close(); 17349 if (canvas !== "edit") { 17350 history.navigate("/styles?canvas=edit", { 17351 transition: "canvas-mode-edit-transition" 17352 }); 17353 } 17354 openGeneralSidebar2("edit-site/global-styles"); 17355 setStylesPath("/revisions"); 17356 } 17357 } 17358 ]; 17359 }, [ 17360 history, 17361 openGeneralSidebar2, 17362 setStylesPath, 17363 hasRevisions, 17364 canvas 17365 ]); 17366 return { 17367 isLoading: false, 17368 commands 17369 }; 17370 }; 17371 function useCommonCommands() { 17372 (0, import_commands2.useCommandLoader)({ 17373 name: "core/edit-site/toggle-styles-welcome-guide", 17374 hook: getGlobalStylesToggleWelcomeGuideCommands() 17375 }); 17376 (0, import_commands2.useCommandLoader)({ 17377 name: "core/edit-site/reset-global-styles", 17378 hook: getGlobalStylesResetCommands() 17379 }); 17380 (0, import_commands2.useCommandLoader)({ 17381 name: "core/edit-site/open-styles-revisions", 17382 hook: getGlobalStylesOpenRevisionsCommands() 17383 }); 17384 } 17385 17386 // packages/edit-site/build-module/hooks/commands/use-set-command-context.mjs 17387 var import_data15 = __toESM(require_data(), 1); 17388 var import_commands3 = __toESM(require_commands(), 1); 17389 var import_block_editor3 = __toESM(require_block_editor(), 1); 17390 var import_router8 = __toESM(require_router(), 1); 17391 var { useCommandContext } = unlock(import_commands3.privateApis); 17392 var { useLocation: useLocation8 } = unlock(import_router8.privateApis); 17393 function useSetCommandContext() { 17394 const { query = {} } = useLocation8(); 17395 const { canvas = "view" } = query; 17396 const hasBlockSelected = (0, import_data15.useSelect)((select4) => { 17397 return select4(import_block_editor3.store).getBlockSelectionStart(); 17398 }, []); 17399 let commandContext = "site-editor"; 17400 if (canvas === "edit") { 17401 commandContext = "entity-edit"; 17402 } 17403 if (hasBlockSelected) { 17404 commandContext = "block-selection-edit"; 17405 } 17406 useCommandContext(commandContext); 17407 } 17408 17409 // packages/edit-site/build-module/components/site-editor-routes/index.mjs 17410 var import_data88 = __toESM(require_data(), 1); 17411 var import_element194 = __toESM(require_element(), 1); 17412 17413 // packages/edit-site/build-module/components/sidebar-navigation-screen-main/index.mjs 17414 var import_components72 = __toESM(require_components(), 1); 17415 var import_i18n61 = __toESM(require_i18n(), 1); 17416 var import_data31 = __toESM(require_data(), 1); 17417 var import_core_data25 = __toESM(require_core_data(), 1); 17418 17419 // packages/edit-site/build-module/components/sidebar-navigation-screen/index.mjs 17420 var import_components10 = __toESM(require_components(), 1); 17421 var import_i18n10 = __toESM(require_i18n(), 1); 17422 var import_core_data13 = __toESM(require_core_data(), 1); 17423 var import_data16 = __toESM(require_data(), 1); 17424 var import_router9 = __toESM(require_router(), 1); 17425 var import_element45 = __toESM(require_element(), 1); 17426 17427 // packages/edit-site/build-module/components/sidebar-button/index.mjs 17428 var import_components9 = __toESM(require_components(), 1); 17429 var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1); 17430 function SidebarButton(props) { 17431 return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)( 17432 import_components9.Button, 17433 { 17434 size: "compact", 17435 ...props, 17436 className: clsx_default("edit-site-sidebar-button", props.className) 17437 } 17438 ); 17439 } 17440 17441 // packages/edit-site/build-module/components/sidebar-navigation-screen/index.mjs 17442 var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1); 17443 var { useHistory: useHistory5, useLocation: useLocation9 } = unlock(import_router9.privateApis); 17444 function SidebarNavigationScreen({ 17445 isRoot, 17446 title, 17447 actions, 17448 content, 17449 footer, 17450 description, 17451 backPath: backPathProp 17452 }) { 17453 const { dashboardLink, dashboardLinkText, previewingThemeName } = (0, import_data16.useSelect)( 17454 (select4) => { 17455 const { getSettings: getSettings7 } = unlock(select4(store)); 17456 const currentlyPreviewingThemeId = currentlyPreviewingTheme(); 17457 return { 17458 dashboardLink: getSettings7().__experimentalDashboardLink, 17459 dashboardLinkText: getSettings7().__experimentalDashboardLinkText, 17460 // Do not call `getTheme` with null, it will cause a request to 17461 // the server. 17462 previewingThemeName: currentlyPreviewingThemeId ? select4(import_core_data13.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0 17463 }; 17464 }, 17465 [] 17466 ); 17467 const location = useLocation9(); 17468 const history = useHistory5(); 17469 const { navigate } = (0, import_element45.useContext)(SidebarNavigationContext); 17470 const backPath = backPathProp ?? location.state?.backPath; 17471 const icon = (0, import_i18n10.isRTL)() ? chevron_right_default : chevron_left_default; 17472 return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [ 17473 /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)( 17474 import_components10.__experimentalVStack, 17475 { 17476 className: clsx_default("edit-site-sidebar-navigation-screen__main", { 17477 "has-footer": !!footer 17478 }), 17479 spacing: 0, 17480 justify: "flex-start", 17481 children: [ 17482 /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)( 17483 import_components10.__experimentalHStack, 17484 { 17485 spacing: 3, 17486 alignment: "flex-start", 17487 className: "edit-site-sidebar-navigation-screen__title-icon", 17488 children: [ 17489 !isRoot && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)( 17490 SidebarButton, 17491 { 17492 onClick: () => { 17493 history.navigate(backPath); 17494 navigate("back"); 17495 }, 17496 icon, 17497 label: (0, import_i18n10.__)("Back"), 17498 showTooltip: false 17499 } 17500 ), 17501 isRoot && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)( 17502 SidebarButton, 17503 { 17504 icon, 17505 label: dashboardLinkText || (0, import_i18n10.__)("Go to the Dashboard"), 17506 href: dashboardLink 17507 } 17508 ), 17509 /* @__PURE__ */ (0, import_jsx_runtime110.jsx)( 17510 import_components10.__experimentalHeading, 17511 { 17512 className: "edit-site-sidebar-navigation-screen__title", 17513 level: 1, 17514 size: 20, 17515 children: !isPreviewingTheme() ? title : (0, import_i18n10.sprintf)( 17516 /* translators: 1: theme name. 2: title */ 17517 (0, import_i18n10.__)("Previewing %1$s: %2$s"), 17518 previewingThemeName, 17519 title 17520 ) 17521 } 17522 ), 17523 actions && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "edit-site-sidebar-navigation-screen__actions", children: actions }) 17524 ] 17525 } 17526 ), 17527 /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "edit-site-sidebar-navigation-screen__content", children: [ 17528 description && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "edit-site-sidebar-navigation-screen__description", children: description }), 17529 content 17530 ] }) 17531 ] 17532 } 17533 ), 17534 footer && /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("footer", { className: "edit-site-sidebar-navigation-screen__footer", children: footer }) 17535 ] }); 17536 } 17537 17538 // packages/edit-site/build-module/components/sidebar-navigation-item/index.mjs 17539 var import_components11 = __toESM(require_components(), 1); 17540 var import_i18n11 = __toESM(require_i18n(), 1); 17541 var import_router10 = __toESM(require_router(), 1); 17542 var import_element46 = __toESM(require_element(), 1); 17543 var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1); 17544 var { useHistory: useHistory6, useLink } = unlock(import_router10.privateApis); 17545 function SidebarNavigationItem({ 17546 className, 17547 icon, 17548 withChevron = false, 17549 suffix, 17550 uid, 17551 to: to2, 17552 onClick, 17553 children, 17554 ...props 17555 }) { 17556 const history = useHistory6(); 17557 const { navigate } = (0, import_element46.useContext)(SidebarNavigationContext); 17558 function handleClick(e2) { 17559 if (onClick) { 17560 onClick(e2); 17561 navigate("forward"); 17562 } else if (to2) { 17563 e2.preventDefault(); 17564 history.navigate(to2); 17565 navigate("forward", `[id="$uid}"]`); 17566 } 17567 } 17568 const linkProps = useLink(to2); 17569 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)( 17570 import_components11.__experimentalItem, 17571 { 17572 className: clsx_default( 17573 "edit-site-sidebar-navigation-item", 17574 { "with-suffix": !withChevron && suffix }, 17575 className 17576 ), 17577 id: uid, 17578 onClick: handleClick, 17579 href: to2 ? linkProps.href : void 0, 17580 ...props, 17581 children: /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_components11.__experimentalHStack, { justify: "flex-start", children: [ 17582 icon && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)( 17583 icon_default, 17584 { 17585 style: { fill: "currentcolor" }, 17586 icon, 17587 size: 24 17588 } 17589 ), 17590 /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_components11.FlexBlock, { children }), 17591 withChevron && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)( 17592 icon_default, 17593 { 17594 icon: (0, import_i18n11.isRTL)() ? chevron_left_small_default : chevron_right_small_default, 17595 className: "edit-site-sidebar-navigation-item__drilldown-indicator", 17596 size: 24 17597 } 17598 ), 17599 !withChevron && suffix 17600 ] }) 17601 } 17602 ); 17603 } 17604 17605 // packages/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.mjs 17606 var import_i18n59 = __toESM(require_i18n(), 1); 17607 var import_data30 = __toESM(require_data(), 1); 17608 var import_element79 = __toESM(require_element(), 1); 17609 var import_preferences5 = __toESM(require_preferences(), 1); 17610 var import_editor8 = __toESM(require_editor(), 1); 17611 var import_router11 = __toESM(require_router(), 1); 17612 var import_url7 = __toESM(require_url(), 1); 17613 17614 // packages/global-styles-ui/build-module/global-styles-ui.mjs 17615 var import_components70 = __toESM(require_components(), 1); 17616 var import_blocks8 = __toESM(require_blocks(), 1); 17617 var import_data29 = __toESM(require_data(), 1); 17618 var import_block_editor17 = __toESM(require_block_editor(), 1); 17619 var import_element78 = __toESM(require_element(), 1); 17620 var import_compose8 = __toESM(require_compose(), 1); 17621 17622 // packages/global-styles-engine/build-module/utils/object.mjs 17623 function setImmutably(object, path, value) { 17624 path = Array.isArray(path) ? [...path] : [path]; 17625 object = Array.isArray(object) ? [...object] : { ...object }; 17626 const leaf = path.pop(); 17627 let prev = object; 17628 for (const key of path) { 17629 const lvl = prev[key]; 17630 prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl }; 17631 } 17632 prev[leaf] = value; 17633 return object; 17634 } 17635 var getValueFromObjectPath = (object, path, defaultValue2) => { 17636 const arrayPath = Array.isArray(path) ? path : path.split("."); 17637 let value = object; 17638 arrayPath.forEach((fieldName) => { 17639 value = value?.[fieldName]; 17640 }); 17641 return value ?? defaultValue2; 17642 }; 17643 17644 // packages/global-styles-engine/build-module/settings/get-setting.mjs 17645 var VALID_SETTINGS = [ 17646 "appearanceTools", 17647 "useRootPaddingAwareAlignments", 17648 "background.backgroundImage", 17649 "background.backgroundRepeat", 17650 "background.backgroundSize", 17651 "background.backgroundPosition", 17652 "background.gradient", 17653 "border.color", 17654 "border.radius", 17655 "border.radiusSizes", 17656 "border.style", 17657 "border.width", 17658 "shadow.presets", 17659 "shadow.defaultPresets", 17660 "color.background", 17661 "color.button", 17662 "color.caption", 17663 "color.custom", 17664 "color.customDuotone", 17665 "color.customGradient", 17666 "color.defaultDuotone", 17667 "color.defaultGradients", 17668 "color.defaultPalette", 17669 "color.duotone", 17670 "color.gradients", 17671 "color.heading", 17672 "color.link", 17673 "color.palette", 17674 "color.text", 17675 "custom", 17676 "dimensions.aspectRatio", 17677 "dimensions.height", 17678 "dimensions.minHeight", 17679 "dimensions.minWidth", 17680 "dimensions.width", 17681 "dimensions.dimensionSizes", 17682 "layout.contentSize", 17683 "layout.definitions", 17684 "layout.wideSize", 17685 "lightbox.enabled", 17686 "lightbox.allowEditing", 17687 "position.fixed", 17688 "position.sticky", 17689 "spacing.customSpacingSize", 17690 "spacing.defaultSpacingSizes", 17691 "spacing.spacingSizes", 17692 "spacing.spacingScale", 17693 "spacing.blockGap", 17694 "spacing.margin", 17695 "spacing.padding", 17696 "spacing.units", 17697 "typography.fluid", 17698 "typography.customFontSize", 17699 "typography.defaultFontSizes", 17700 "typography.dropCap", 17701 "typography.fontFamilies", 17702 "typography.fontSizes", 17703 "typography.fontStyle", 17704 "typography.fontWeight", 17705 "typography.letterSpacing", 17706 "typography.lineHeight", 17707 "typography.textAlign", 17708 "typography.textColumns", 17709 "typography.textDecoration", 17710 "typography.textIndent", 17711 "typography.textTransform", 17712 "typography.writingMode" 17713 ]; 17714 function getSetting(globalStyles, path, blockName) { 17715 const appendedBlockPath = blockName ? ".blocks." + blockName : ""; 17716 const appendedPropertyPath = path ? "." + path : ""; 17717 const contextualPath = `settings$appendedBlockPath}$appendedPropertyPath}`; 17718 const globalPath = `settings$appendedPropertyPath}`; 17719 if (path) { 17720 return getValueFromObjectPath(globalStyles, contextualPath) ?? getValueFromObjectPath(globalStyles, globalPath); 17721 } 17722 let result = {}; 17723 VALID_SETTINGS.forEach((setting) => { 17724 const value = getValueFromObjectPath( 17725 globalStyles, 17726 `settings$appendedBlockPath}.$setting}` 17727 ) ?? getValueFromObjectPath(globalStyles, `settings.$setting}`); 17728 if (value !== void 0) { 17729 result = setImmutably(result, setting.split("."), value); 17730 } 17731 }); 17732 return result; 17733 } 17734 17735 // packages/global-styles-engine/build-module/settings/set-setting.mjs 17736 function setSetting(globalStyles, path, newValue, blockName) { 17737 const appendedBlockPath = blockName ? ".blocks." + blockName : ""; 17738 const appendedPropertyPath = path ? "." + path : ""; 17739 const finalPath = `settings$appendedBlockPath}$appendedPropertyPath}`; 17740 return setImmutably( 17741 globalStyles, 17742 finalPath.split("."), 17743 newValue 17744 ); 17745 } 17746 17747 // packages/global-styles-engine/build-module/utils/common.mjs 17748 var import_style_engine = __toESM(require_style_engine(), 1); 17749 17750 // packages/global-styles-engine/build-module/utils/fluid.mjs 17751 var DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px"; 17752 var DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px"; 17753 var DEFAULT_SCALE_FACTOR = 1; 17754 var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25; 17755 var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75; 17756 var DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px"; 17757 function getComputedFluidTypographyValue({ 17758 minimumFontSize, 17759 maximumFontSize, 17760 fontSize, 17761 minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH, 17762 maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH, 17763 scaleFactor = DEFAULT_SCALE_FACTOR, 17764 minimumFontSizeLimit 17765 }) { 17766 minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT; 17767 if (fontSize) { 17768 const fontSizeParsed = getTypographyValueAndUnit(fontSize); 17769 if (!fontSizeParsed?.unit || !fontSizeParsed?.value) { 17770 return null; 17771 } 17772 const minimumFontSizeLimitParsed = getTypographyValueAndUnit( 17773 minimumFontSizeLimit, 17774 { 17775 coerceTo: fontSizeParsed.unit 17776 } 17777 ); 17778 if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) { 17779 if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) { 17780 return null; 17781 } 17782 } 17783 if (!maximumFontSize) { 17784 maximumFontSize = `$fontSizeParsed.value}$fontSizeParsed.unit}`; 17785 } 17786 if (!minimumFontSize) { 17787 const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16; 17788 const minimumFontSizeFactor = Math.min( 17789 Math.max( 17790 1 - 0.075 * Math.log2(fontSizeValueInPx), 17791 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN 17792 ), 17793 DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX 17794 ); 17795 const calculatedMinimumFontSize = roundToPrecision( 17796 fontSizeParsed.value * minimumFontSizeFactor, 17797 3 17798 ); 17799 if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) { 17800 minimumFontSize = `$minimumFontSizeLimitParsed.value}$minimumFontSizeLimitParsed.unit}`; 17801 } else { 17802 minimumFontSize = `$calculatedMinimumFontSize}$fontSizeParsed.unit}`; 17803 } 17804 } 17805 } 17806 const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize); 17807 const fontSizeUnit = minimumFontSizeParsed?.unit || "rem"; 17808 const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, { 17809 coerceTo: fontSizeUnit 17810 }); 17811 if (!minimumFontSizeParsed || !maximumFontSizeParsed) { 17812 return null; 17813 } 17814 const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, { 17815 coerceTo: "rem" 17816 }); 17817 const maximumViewportWidthParsed = getTypographyValueAndUnit( 17818 maximumViewportWidth, 17819 { coerceTo: fontSizeUnit } 17820 ); 17821 const minimumViewportWidthParsed = getTypographyValueAndUnit( 17822 minimumViewportWidth, 17823 { coerceTo: fontSizeUnit } 17824 ); 17825 if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) { 17826 return null; 17827 } 17828 const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value; 17829 if (!linearDenominator) { 17830 return null; 17831 } 17832 const minViewportWidthOffsetValue = roundToPrecision( 17833 minimumViewportWidthParsed.value / 100, 17834 3 17835 ); 17836 const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit; 17837 const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator); 17838 const linearFactorScaled = roundToPrecision( 17839 (linearFactor || 1) * scaleFactor, 17840 3 17841 ); 17842 const fluidTargetFontSize = `$minimumFontSizeRem.value}$minimumFontSizeRem.unit} + ((1vw - $viewportWidthOffset}) * $linearFactorScaled})`; 17843 return `clamp($minimumFontSize}, $fluidTargetFontSize}, $maximumFontSize})`; 17844 } 17845 function getTypographyValueAndUnit(rawValue, options = {}) { 17846 if (typeof rawValue !== "string" && typeof rawValue !== "number") { 17847 return null; 17848 } 17849 if (isFinite(rawValue)) { 17850 rawValue = `$rawValue}px`; 17851 } 17852 const { coerceTo, rootSizeValue, acceptableUnits } = { 17853 coerceTo: "", 17854 // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`. 17855 rootSizeValue: 16, 17856 acceptableUnits: ["rem", "px", "em"], 17857 ...options 17858 }; 17859 const acceptableUnitsGroup = acceptableUnits?.join("|"); 17860 const regexUnits = new RegExp( 17861 `^(\\d*\\.?\\d+)($acceptableUnitsGroup}){1,1}$` 17862 ); 17863 const matches = rawValue.toString().match(regexUnits); 17864 if (!matches || matches.length < 3) { 17865 return null; 17866 } 17867 let [, value, unit] = matches; 17868 let returnValue = parseFloat(value); 17869 if ("px" === coerceTo && ("em" === unit || "rem" === unit)) { 17870 returnValue = returnValue * rootSizeValue; 17871 unit = coerceTo; 17872 } 17873 if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) { 17874 returnValue = returnValue / rootSizeValue; 17875 unit = coerceTo; 17876 } 17877 if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) { 17878 unit = coerceTo; 17879 } 17880 if (!unit) { 17881 return null; 17882 } 17883 return { 17884 value: roundToPrecision(returnValue, 3), 17885 unit 17886 }; 17887 } 17888 function roundToPrecision(value, digits = 3) { 17889 const base = Math.pow(10, digits); 17890 return Math.round(value * base) / base; 17891 } 17892 17893 // packages/global-styles-engine/build-module/utils/typography.mjs 17894 function isFluidTypographyEnabled(typographySettings) { 17895 const fluidSettings = typographySettings?.fluid; 17896 return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0; 17897 } 17898 function getFluidTypographyOptionsFromSettings(settings2) { 17899 const typographySettings = settings2?.typography ?? {}; 17900 const layoutSettings = settings2?.layout; 17901 const defaultMaxViewportWidth = getTypographyValueAndUnit( 17902 layoutSettings?.wideSize 17903 ) ? layoutSettings?.wideSize : null; 17904 return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? { 17905 fluid: { 17906 maxViewportWidth: defaultMaxViewportWidth, 17907 ...typeof typographySettings.fluid === "object" ? typographySettings.fluid : {} 17908 } 17909 } : { 17910 fluid: typographySettings?.fluid 17911 }; 17912 } 17913 function getTypographyFontSizeValue(preset, settings2) { 17914 const { size: defaultSize } = preset; 17915 if (!defaultSize || "0" === defaultSize || false === preset?.fluid) { 17916 return defaultSize; 17917 } 17918 if (!isFluidTypographyEnabled(settings2?.typography) && !isFluidTypographyEnabled(preset)) { 17919 return defaultSize; 17920 } 17921 const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings2)?.fluid ?? {}; 17922 const fluidFontSizeValue = getComputedFluidTypographyValue({ 17923 minimumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.min, 17924 maximumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.max, 17925 fontSize: defaultSize, 17926 minimumFontSizeLimit: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minFontSize : void 0, 17927 maximumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.maxViewportWidth : void 0, 17928 minimumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minViewportWidth : void 0 17929 }); 17930 if (!!fluidFontSizeValue) { 17931 return fluidFontSizeValue; 17932 } 17933 return defaultSize; 17934 } 17935 17936 // packages/global-styles-engine/build-module/utils/common.mjs 17937 var ROOT_BLOCK_SELECTOR = "body"; 17938 var ROOT_CSS_PROPERTIES_SELECTOR = ":root"; 17939 function splitSelectorList(selector2) { 17940 if (!selector2.includes(",")) { 17941 return [selector2]; 17942 } 17943 const selectors3 = []; 17944 let currentSelector = ""; 17945 let parenthesesDepth = 0; 17946 for (const char of selector2) { 17947 if (char === "(") { 17948 parenthesesDepth++; 17949 } else if (char === ")" && parenthesesDepth > 0) { 17950 parenthesesDepth--; 17951 } else if (char === "," && parenthesesDepth === 0) { 17952 selectors3.push(currentSelector); 17953 currentSelector = ""; 17954 continue; 17955 } 17956 currentSelector += char; 17957 } 17958 selectors3.push(currentSelector); 17959 return selectors3; 17960 } 17961 var PRESET_METADATA = [ 17962 { 17963 path: ["color", "palette"], 17964 valueKey: "color", 17965 cssVarInfix: "color", 17966 classes: [ 17967 { classSuffix: "color", propertyName: "color" }, 17968 { 17969 classSuffix: "background-color", 17970 propertyName: "background-color" 17971 }, 17972 { 17973 classSuffix: "border-color", 17974 propertyName: "border-color" 17975 } 17976 ] 17977 }, 17978 { 17979 path: ["color", "gradients"], 17980 valueKey: "gradient", 17981 cssVarInfix: "gradient", 17982 classes: [ 17983 { 17984 classSuffix: "gradient-background", 17985 propertyName: "background" 17986 } 17987 ] 17988 }, 17989 { 17990 path: ["color", "duotone"], 17991 valueKey: "colors", 17992 cssVarInfix: "duotone", 17993 valueFunc: ({ slug }) => `url( '#wp-duotone-$slug}' )`, 17994 classes: [] 17995 }, 17996 { 17997 path: ["shadow", "presets"], 17998 valueKey: "shadow", 17999 cssVarInfix: "shadow", 18000 classes: [] 18001 }, 18002 { 18003 path: ["typography", "fontSizes"], 18004 valueFunc: (preset, settings2) => getTypographyFontSizeValue(preset, settings2), 18005 valueKey: "size", 18006 cssVarInfix: "font-size", 18007 classes: [{ classSuffix: "font-size", propertyName: "font-size" }] 18008 }, 18009 { 18010 path: ["typography", "fontFamilies"], 18011 valueKey: "fontFamily", 18012 cssVarInfix: "font-family", 18013 classes: [ 18014 { classSuffix: "font-family", propertyName: "font-family" } 18015 ] 18016 }, 18017 { 18018 path: ["spacing", "spacingSizes"], 18019 valueKey: "size", 18020 cssVarInfix: "spacing", 18021 valueFunc: ({ size: size4 }) => size4, 18022 classes: [] 18023 }, 18024 { 18025 path: ["border", "radiusSizes"], 18026 valueKey: "size", 18027 cssVarInfix: "border-radius", 18028 classes: [] 18029 }, 18030 { 18031 path: ["dimensions", "dimensionSizes"], 18032 valueKey: "size", 18033 cssVarInfix: "dimension", 18034 classes: [] 18035 } 18036 ]; 18037 function scopeSelector(scope, selector2) { 18038 if (!scope || !selector2) { 18039 return selector2; 18040 } 18041 const scopes = splitSelectorList(scope); 18042 const selectors3 = splitSelectorList(selector2); 18043 const selectorsScoped = []; 18044 scopes.forEach((outer) => { 18045 selectors3.forEach((inner) => { 18046 selectorsScoped.push(`$outer.trim()} $inner.trim()}`); 18047 }); 18048 }); 18049 return selectorsScoped.join(", "); 18050 } 18051 function scopeFeatureSelectors(scope, selectors3) { 18052 if (!scope || !selectors3) { 18053 return; 18054 } 18055 const featureSelectors = {}; 18056 Object.entries(selectors3).forEach(([feature, selector2]) => { 18057 if (typeof selector2 === "string") { 18058 featureSelectors[feature] = scopeSelector(scope, selector2); 18059 } 18060 if (typeof selector2 === "object") { 18061 featureSelectors[feature] = {}; 18062 Object.entries(selector2).forEach( 18063 ([subfeature, subfeatureSelector]) => { 18064 featureSelectors[feature][subfeature] = scopeSelector( 18065 scope, 18066 subfeatureSelector 18067 ); 18068 } 18069 ); 18070 } 18071 }); 18072 return featureSelectors; 18073 } 18074 function appendToSelector(selector2, toAppend) { 18075 if (!selector2.includes(",")) { 18076 return selector2 + toAppend; 18077 } 18078 const selectors3 = splitSelectorList(selector2); 18079 const newSelectors = selectors3.map((sel) => sel + toAppend); 18080 return newSelectors.join(","); 18081 } 18082 function getBlockStyleVariationSelector(variation, blockSelector) { 18083 const variationClass = `.is-style-$variation}`; 18084 if (!blockSelector) { 18085 return variationClass; 18086 } 18087 const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/; 18088 const addVariationClass = (_match, group1, group2) => { 18089 return group1 + group2 + variationClass; 18090 }; 18091 const result = splitSelectorList(blockSelector).map( 18092 (part) => part.replace(ancestorRegex, addVariationClass) 18093 ); 18094 return result.join(","); 18095 } 18096 function getBlockStyleVariationFeatureSelector(variation, featureSelector) { 18097 const variationClass = `.is-style-$variation}`; 18098 const selectorParts = splitSelectorList(featureSelector).map( 18099 (selector2) => { 18100 const trimmedSelector = selector2.trim(); 18101 const prefix2 = `$variationClass} `; 18102 if (trimmedSelector.startsWith(prefix2)) { 18103 return trimmedSelector.slice(prefix2.length); 18104 } 18105 return trimmedSelector; 18106 } 18107 ); 18108 return getBlockStyleVariationSelector( 18109 variation, 18110 selectorParts.join(",") 18111 ); 18112 } 18113 function getResolvedRefValue(ruleValue, tree) { 18114 if (!ruleValue || !tree) { 18115 return ruleValue; 18116 } 18117 if (typeof ruleValue === "object" && "ref" in ruleValue && ruleValue?.ref) { 18118 const resolvedRuleValue = (0, import_style_engine.getCSSValueFromRawStyle)( 18119 getValueFromObjectPath(tree, ruleValue.ref) 18120 ); 18121 if (typeof resolvedRuleValue === "object" && resolvedRuleValue !== null && "ref" in resolvedRuleValue && resolvedRuleValue?.ref) { 18122 return void 0; 18123 } 18124 if (resolvedRuleValue === void 0) { 18125 return ruleValue; 18126 } 18127 return resolvedRuleValue; 18128 } 18129 return ruleValue; 18130 } 18131 function getResolvedThemeFilePath(file, themeFileURIs) { 18132 if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) { 18133 return file; 18134 } 18135 const uri = themeFileURIs.find( 18136 (themeFileUri) => themeFileUri?.name === file 18137 ); 18138 if (!uri?.href) { 18139 return file; 18140 } 18141 return uri?.href; 18142 } 18143 function getResolvedValue(ruleValue, tree) { 18144 if (!ruleValue || !tree) { 18145 return ruleValue; 18146 } 18147 const resolvedValue = getResolvedRefValue(ruleValue, tree); 18148 if (typeof resolvedValue === "object" && resolvedValue !== null && "url" in resolvedValue && resolvedValue?.url) { 18149 resolvedValue.url = getResolvedThemeFilePath( 18150 resolvedValue.url, 18151 tree?._links?.["wp:theme-file"] 18152 ); 18153 } 18154 return resolvedValue; 18155 } 18156 function findInPresetsBy(settings2, blockName, presetPath = [], presetProperty = "slug", presetValueValue) { 18157 const orderedPresetsByOrigin = [ 18158 blockName ? getValueFromObjectPath(settings2, [ 18159 "blocks", 18160 blockName, 18161 ...presetPath 18162 ]) : void 0, 18163 getValueFromObjectPath(settings2, presetPath) 18164 ].filter(Boolean); 18165 for (const presetByOrigin of orderedPresetsByOrigin) { 18166 if (presetByOrigin) { 18167 const origins = ["custom", "theme", "default"]; 18168 for (const origin of origins) { 18169 const presets = presetByOrigin[origin]; 18170 if (presets) { 18171 const presetObject = presets.find( 18172 (preset) => preset[presetProperty] === presetValueValue 18173 ); 18174 if (presetObject) { 18175 if (presetProperty === "slug") { 18176 return presetObject; 18177 } 18178 const highestPresetObjectWithSameSlug = findInPresetsBy( 18179 settings2, 18180 blockName, 18181 presetPath, 18182 "slug", 18183 presetObject.slug 18184 ); 18185 if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) { 18186 return presetObject; 18187 } 18188 return void 0; 18189 } 18190 } 18191 } 18192 } 18193 } 18194 } 18195 function getValueFromPresetVariable(features, blockName, variable, [presetType, slug] = []) { 18196 const metadata = PRESET_METADATA.find( 18197 (data) => data.cssVarInfix === presetType 18198 ); 18199 if (!metadata || !features.settings) { 18200 return variable; 18201 } 18202 const presetObject = findInPresetsBy( 18203 features.settings, 18204 blockName, 18205 metadata.path, 18206 "slug", 18207 slug 18208 ); 18209 if (presetObject) { 18210 const { valueKey } = metadata; 18211 const result = presetObject[valueKey]; 18212 return getValueFromVariable(features, blockName, result); 18213 } 18214 return variable; 18215 } 18216 function getValueFromCustomVariable(features, blockName, variable, path = []) { 18217 const result = (blockName ? getValueFromObjectPath(features?.settings ?? {}, [ 18218 "blocks", 18219 blockName, 18220 "custom", 18221 ...path 18222 ]) : void 0) ?? getValueFromObjectPath(features?.settings ?? {}, [ 18223 "custom", 18224 ...path 18225 ]); 18226 if (!result) { 18227 return variable; 18228 } 18229 return getValueFromVariable(features, blockName, result); 18230 } 18231 function getValueFromVariable(features, blockName, variable) { 18232 if (!variable || typeof variable !== "string") { 18233 if (typeof variable === "object" && variable !== null && "ref" in variable && typeof variable.ref === "string") { 18234 const resolvedVariable = getValueFromObjectPath( 18235 features, 18236 variable.ref 18237 ); 18238 if (!resolvedVariable || typeof resolvedVariable === "object" && "ref" in resolvedVariable) { 18239 return resolvedVariable; 18240 } 18241 variable = resolvedVariable; 18242 } else { 18243 return variable; 18244 } 18245 } 18246 const USER_VALUE_PREFIX = "var:"; 18247 const THEME_VALUE_PREFIX = "var(--wp--"; 18248 const THEME_VALUE_SUFFIX = ")"; 18249 let parsedVar; 18250 if (variable.startsWith(USER_VALUE_PREFIX)) { 18251 parsedVar = variable.slice(USER_VALUE_PREFIX.length).split("|"); 18252 } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) { 18253 parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split("--"); 18254 } else { 18255 return variable; 18256 } 18257 const [type, ...path] = parsedVar; 18258 if (type === "preset") { 18259 return getValueFromPresetVariable( 18260 features, 18261 blockName, 18262 variable, 18263 path 18264 ); 18265 } 18266 if (type === "custom") { 18267 return getValueFromCustomVariable( 18268 features, 18269 blockName, 18270 variable, 18271 path 18272 ); 18273 } 18274 return variable; 18275 } 18276 18277 // packages/global-styles-engine/build-module/settings/get-style.mjs 18278 function getStyle(globalStyles, path, blockName, shouldDecodeEncode = true) { 18279 const appendedPath = path ? "." + path : ""; 18280 const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`; 18281 if (!globalStyles) { 18282 return void 0; 18283 } 18284 const rawResult = getValueFromObjectPath(globalStyles, finalPath); 18285 const result = shouldDecodeEncode ? getValueFromVariable(globalStyles, blockName, rawResult) : rawResult; 18286 return result; 18287 } 18288 18289 // packages/global-styles-engine/build-module/settings/set-style.mjs 18290 function setStyle(globalStyles, path, newValue, blockName) { 18291 const appendedPath = path ? "." + path : ""; 18292 const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`; 18293 return setImmutably( 18294 globalStyles, 18295 finalPath.split("."), 18296 newValue 18297 ); 18298 } 18299 18300 // packages/global-styles-engine/build-module/core/equal.mjs 18301 var import_es6 = __toESM(require_es6(), 1); 18302 function areGlobalStylesEqual(original, variation) { 18303 if (typeof original !== "object" || typeof variation !== "object") { 18304 return original === variation; 18305 } 18306 return (0, import_es6.default)(original?.styles, variation?.styles) && (0, import_es6.default)(original?.settings, variation?.settings); 18307 } 18308 18309 // packages/global-styles-engine/build-module/core/merge.mjs 18310 var import_deepmerge = __toESM(require_cjs(), 1); 18311 18312 // node_modules/is-plain-object/dist/is-plain-object.mjs 18313 function isObject(o3) { 18314 return Object.prototype.toString.call(o3) === "[object Object]"; 18315 } 18316 function isPlainObject(o3) { 18317 var ctor, prot; 18318 if (isObject(o3) === false) return false; 18319 ctor = o3.constructor; 18320 if (ctor === void 0) return true; 18321 prot = ctor.prototype; 18322 if (isObject(prot) === false) return false; 18323 if (prot.hasOwnProperty("isPrototypeOf") === false) { 18324 return false; 18325 } 18326 return true; 18327 } 18328 18329 // packages/global-styles-engine/build-module/core/merge.mjs 18330 function mergeGlobalStyles(base, user) { 18331 return (0, import_deepmerge.default)(base, user, { 18332 /* 18333 * We only pass as arrays the presets, 18334 * in which case we want the new array of values 18335 * to override the old array (no merging). 18336 */ 18337 isMergeableObject: isPlainObject, 18338 /* 18339 * Exceptions to the above rule. 18340 * Background images should be replaced, not merged, 18341 * as they themselves are specific object definitions for the style. 18342 */ 18343 customMerge: (key) => { 18344 if (key === "backgroundImage") { 18345 return (baseConfig, userConfig) => userConfig ?? baseConfig; 18346 } 18347 return void 0; 18348 } 18349 }); 18350 } 18351 18352 // packages/global-styles-engine/build-module/core/render.mjs 18353 var import_blocks3 = __toESM(require_blocks(), 1); 18354 var import_style_engine2 = __toESM(require_style_engine(), 1); 18355 var import_data17 = __toESM(require_data(), 1); 18356 18357 // packages/global-styles-engine/build-module/core/selectors.mjs 18358 function getBlockSelector(blockType, target = "root", options = {}) { 18359 if (!target) { 18360 return null; 18361 } 18362 const { fallback = false } = options; 18363 const { name: name2, selectors: selectors3, supports } = blockType; 18364 const hasSelectors = selectors3 && Object.keys(selectors3).length > 0; 18365 const path = Array.isArray(target) ? target.join(".") : target; 18366 let rootSelector = null; 18367 if (hasSelectors && selectors3.root) { 18368 rootSelector = selectors3?.root; 18369 } else if (supports?.__experimentalSelector) { 18370 rootSelector = supports.__experimentalSelector; 18371 } else { 18372 rootSelector = ".wp-block-" + name2.replace("core/", "").replace("/", "-"); 18373 } 18374 if (path === "root") { 18375 return rootSelector; 18376 } 18377 const pathArray = Array.isArray(target) ? target : target.split("."); 18378 if (pathArray.length === 1) { 18379 const fallbackSelector = fallback ? rootSelector : null; 18380 if (hasSelectors) { 18381 const featureSelector2 = getValueFromObjectPath( 18382 selectors3, 18383 `$path}.root`, 18384 null 18385 ) || getValueFromObjectPath(selectors3, path, null); 18386 return featureSelector2 || fallbackSelector; 18387 } 18388 const featureSelector = supports ? getValueFromObjectPath( 18389 supports, 18390 `$path}.__experimentalSelector`, 18391 null 18392 ) : void 0; 18393 if (!featureSelector) { 18394 return fallbackSelector; 18395 } 18396 return scopeSelector(rootSelector, featureSelector); 18397 } 18398 let subfeatureSelector; 18399 if (hasSelectors) { 18400 subfeatureSelector = getValueFromObjectPath(selectors3, path, null); 18401 } 18402 if (subfeatureSelector) { 18403 return subfeatureSelector; 18404 } 18405 if (fallback) { 18406 return getBlockSelector(blockType, pathArray[0], options); 18407 } 18408 return null; 18409 } 18410 18411 // node_modules/colord/index.mjs 18412 var r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }; 18413 var t = function(r3) { 18414 return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3; 18415 }; 18416 var n = function(r3, t3, n2) { 18417 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = Math.pow(10, t3)), Math.round(n2 * r3) / n2 + 0; 18418 }; 18419 var e = function(r3, t3, n2) { 18420 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t3 ? r3 : t3; 18421 }; 18422 var u = function(r3) { 18423 return (r3 = isFinite(r3) ? r3 % 360 : 0) > 0 ? r3 : r3 + 360; 18424 }; 18425 var a = function(r3) { 18426 return { r: e(r3.r, 0, 255), g: e(r3.g, 0, 255), b: e(r3.b, 0, 255), a: e(r3.a) }; 18427 }; 18428 var o = function(r3) { 18429 return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) }; 18430 }; 18431 var i = /^#([0-9a-f]{3,8})$/i; 18432 var s = function(r3) { 18433 var t3 = r3.toString(16); 18434 return t3.length < 2 ? "0" + t3 : t3; 18435 }; 18436 var h = function(r3) { 18437 var t3 = r3.r, n2 = r3.g, e2 = r3.b, u2 = r3.a, a2 = Math.max(t3, n2, e2), o3 = a2 - Math.min(t3, n2, e2), i2 = o3 ? a2 === t3 ? (n2 - e2) / o3 : a2 === n2 ? 2 + (e2 - t3) / o3 : 4 + (t3 - n2) / o3 : 0; 18438 return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o3 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 }; 18439 }; 18440 var b = function(r3) { 18441 var t3 = r3.h, n2 = r3.s, e2 = r3.v, u2 = r3.a; 18442 t3 = t3 / 360 * 6, n2 /= 100, e2 /= 100; 18443 var a2 = Math.floor(t3), o3 = e2 * (1 - n2), i2 = e2 * (1 - (t3 - a2) * n2), s2 = e2 * (1 - (1 - t3 + a2) * n2), h2 = a2 % 6; 18444 return { r: 255 * [e2, i2, o3, o3, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o3, o3][h2], b: 255 * [o3, o3, s2, e2, e2, i2][h2], a: u2 }; 18445 }; 18446 var g = function(r3) { 18447 return { h: u(r3.h), s: e(r3.s, 0, 100), l: e(r3.l, 0, 100), a: e(r3.a) }; 18448 }; 18449 var d = function(r3) { 18450 return { h: n(r3.h), s: n(r3.s), l: n(r3.l), a: n(r3.a, 3) }; 18451 }; 18452 var f = function(r3) { 18453 return b((n2 = (t3 = r3).s, { h: t3.h, s: (n2 *= ((e2 = t3.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t3.a })); 18454 var t3, n2, e2; 18455 }; 18456 var c = function(r3) { 18457 return { h: (t3 = h(r3)).h, s: (u2 = (200 - (n2 = t3.s)) * (e2 = t3.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t3.a }; 18458 var t3, n2, e2, u2; 18459 }; 18460 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 18461 var p2 = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 18462 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 18463 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 18464 var y = { string: [[function(r3) { 18465 var t3 = i.exec(r3); 18466 return t3 ? (r3 = t3[1]).length <= 4 ? { r: parseInt(r3[0] + r3[0], 16), g: parseInt(r3[1] + r3[1], 16), b: parseInt(r3[2] + r3[2], 16), a: 4 === r3.length ? n(parseInt(r3[3] + r3[3], 16) / 255, 2) : 1 } : 6 === r3.length || 8 === r3.length ? { r: parseInt(r3.substr(0, 2), 16), g: parseInt(r3.substr(2, 2), 16), b: parseInt(r3.substr(4, 2), 16), a: 8 === r3.length ? n(parseInt(r3.substr(6, 2), 16) / 255, 2) : 1 } : null : null; 18467 }, "hex"], [function(r3) { 18468 var t3 = v.exec(r3) || m.exec(r3); 18469 return t3 ? t3[2] !== t3[4] || t3[4] !== t3[6] ? null : a({ r: Number(t3[1]) / (t3[2] ? 100 / 255 : 1), g: Number(t3[3]) / (t3[4] ? 100 / 255 : 1), b: Number(t3[5]) / (t3[6] ? 100 / 255 : 1), a: void 0 === t3[7] ? 1 : Number(t3[7]) / (t3[8] ? 100 : 1) }) : null; 18470 }, "rgb"], [function(t3) { 18471 var n2 = l.exec(t3) || p2.exec(t3); 18472 if (!n2) return null; 18473 var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r2[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) }); 18474 return f(a2); 18475 }, "hsl"]], object: [[function(r3) { 18476 var n2 = r3.r, e2 = r3.g, u2 = r3.b, o3 = r3.a, i2 = void 0 === o3 ? 1 : o3; 18477 return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null; 18478 }, "rgb"], [function(r3) { 18479 var n2 = r3.h, e2 = r3.s, u2 = r3.l, a2 = r3.a, o3 = void 0 === a2 ? 1 : a2; 18480 if (!t(n2) || !t(e2) || !t(u2)) return null; 18481 var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o3) }); 18482 return f(i2); 18483 }, "hsl"], [function(r3) { 18484 var n2 = r3.h, a2 = r3.s, o3 = r3.v, i2 = r3.a, s2 = void 0 === i2 ? 1 : i2; 18485 if (!t(n2) || !t(a2) || !t(o3)) return null; 18486 var h2 = (function(r4) { 18487 return { h: u(r4.h), s: e(r4.s, 0, 100), v: e(r4.v, 0, 100), a: e(r4.a) }; 18488 })({ h: Number(n2), s: Number(a2), v: Number(o3), a: Number(s2) }); 18489 return b(h2); 18490 }, "hsv"]] }; 18491 var N = function(r3, t3) { 18492 for (var n2 = 0; n2 < t3.length; n2++) { 18493 var e2 = t3[n2][0](r3); 18494 if (e2) return [e2, t3[n2][1]]; 18495 } 18496 return [null, void 0]; 18497 }; 18498 var x = function(r3) { 18499 return "string" == typeof r3 ? N(r3.trim(), y.string) : "object" == typeof r3 && null !== r3 ? N(r3, y.object) : [null, void 0]; 18500 }; 18501 var M = function(r3, t3) { 18502 var n2 = c(r3); 18503 return { h: n2.h, s: e(n2.s + 100 * t3, 0, 100), l: n2.l, a: n2.a }; 18504 }; 18505 var H = function(r3) { 18506 return (299 * r3.r + 587 * r3.g + 114 * r3.b) / 1e3 / 255; 18507 }; 18508 var $ = function(r3, t3) { 18509 var n2 = c(r3); 18510 return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t3, 0, 100), a: n2.a }; 18511 }; 18512 var j = (function() { 18513 function r3(r4) { 18514 this.parsed = x(r4)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; 18515 } 18516 return r3.prototype.isValid = function() { 18517 return null !== this.parsed; 18518 }, r3.prototype.brightness = function() { 18519 return n(H(this.rgba), 2); 18520 }, r3.prototype.isDark = function() { 18521 return H(this.rgba) < 0.5; 18522 }, r3.prototype.isLight = function() { 18523 return H(this.rgba) >= 0.5; 18524 }, r3.prototype.toHex = function() { 18525 return r4 = o(this.rgba), t3 = r4.r, e2 = r4.g, u2 = r4.b, i2 = (a2 = r4.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t3) + s(e2) + s(u2) + i2; 18526 var r4, t3, e2, u2, a2, i2; 18527 }, r3.prototype.toRgb = function() { 18528 return o(this.rgba); 18529 }, r3.prototype.toRgbString = function() { 18530 return r4 = o(this.rgba), t3 = r4.r, n2 = r4.g, e2 = r4.b, (u2 = r4.a) < 1 ? "rgba(" + t3 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t3 + ", " + n2 + ", " + e2 + ")"; 18531 var r4, t3, n2, e2, u2; 18532 }, r3.prototype.toHsl = function() { 18533 return d(c(this.rgba)); 18534 }, r3.prototype.toHslString = function() { 18535 return r4 = d(c(this.rgba)), t3 = r4.h, n2 = r4.s, e2 = r4.l, (u2 = r4.a) < 1 ? "hsla(" + t3 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t3 + ", " + n2 + "%, " + e2 + "%)"; 18536 var r4, t3, n2, e2, u2; 18537 }, r3.prototype.toHsv = function() { 18538 return r4 = h(this.rgba), { h: n(r4.h), s: n(r4.s), v: n(r4.v), a: n(r4.a, 3) }; 18539 var r4; 18540 }, r3.prototype.invert = function() { 18541 return w({ r: 255 - (r4 = this.rgba).r, g: 255 - r4.g, b: 255 - r4.b, a: r4.a }); 18542 var r4; 18543 }, r3.prototype.saturate = function(r4) { 18544 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, r4)); 18545 }, r3.prototype.desaturate = function(r4) { 18546 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, -r4)); 18547 }, r3.prototype.grayscale = function() { 18548 return w(M(this.rgba, -1)); 18549 }, r3.prototype.lighten = function(r4) { 18550 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, r4)); 18551 }, r3.prototype.darken = function(r4) { 18552 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, -r4)); 18553 }, r3.prototype.rotate = function(r4) { 18554 return void 0 === r4 && (r4 = 15), this.hue(this.hue() + r4); 18555 }, r3.prototype.alpha = function(r4) { 18556 return "number" == typeof r4 ? w({ r: (t3 = this.rgba).r, g: t3.g, b: t3.b, a: r4 }) : n(this.rgba.a, 3); 18557 var t3; 18558 }, r3.prototype.hue = function(r4) { 18559 var t3 = c(this.rgba); 18560 return "number" == typeof r4 ? w({ h: r4, s: t3.s, l: t3.l, a: t3.a }) : n(t3.h); 18561 }, r3.prototype.isEqual = function(r4) { 18562 return this.toHex() === w(r4).toHex(); 18563 }, r3; 18564 })(); 18565 var w = function(r3) { 18566 return r3 instanceof j ? r3 : new j(r3); 18567 }; 18568 var S = []; 18569 var k = function(r3) { 18570 r3.forEach(function(r4) { 18571 S.indexOf(r4) < 0 && (r4(j, y), S.push(r4)); 18572 }); 18573 }; 18574 18575 // packages/global-styles-engine/build-module/utils/duotone.mjs 18576 function getValuesFromColors(colors2 = []) { 18577 const values = { 18578 r: [], 18579 g: [], 18580 b: [], 18581 a: [] 18582 }; 18583 colors2.forEach((color) => { 18584 const rgbColor = w(color).toRgb(); 18585 values.r.push(rgbColor.r / 255); 18586 values.g.push(rgbColor.g / 255); 18587 values.b.push(rgbColor.b / 255); 18588 values.a.push(rgbColor.a); 18589 }); 18590 return values; 18591 } 18592 function getDuotoneFilter(id, colors2) { 18593 const values = getValuesFromColors(colors2); 18594 return ` 18595 <svg 18596 xmlns:xlink="http://www.w3.org/1999/xlink" 18597 viewBox="0 0 0 0" 18598 width="0" 18599 height="0" 18600 focusable="false" 18601 role="none" 18602 aria-hidden="true" 18603 style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;" 18604 > 18605 <defs> 18606 <filter id="$id}"> 18607 <!-- 18608 Use sRGB instead of linearRGB so transparency looks correct. 18609 Use perceptual brightness to convert to grayscale. 18610 --> 18611 <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> 18612 <!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. --> 18613 <feComponentTransfer color-interpolation-filters="sRGB"> 18614 <feFuncR type="table" tableValues="$values.r.join(" ")}"></feFuncR> 18615 <feFuncG type="table" tableValues="$values.g.join(" ")}"></feFuncG> 18616 <feFuncB type="table" tableValues="$values.b.join(" ")}"></feFuncB> 18617 <feFuncA type="table" tableValues="$values.a.join(" ")}"></feFuncA> 18618 </feComponentTransfer> 18619 <!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. --> 18620 <feComposite in2="SourceGraphic" operator="in"></feComposite> 18621 </filter> 18622 </defs> 18623 </svg>`; 18624 } 18625 18626 // packages/global-styles-engine/build-module/utils/string.mjs 18627 function kebabCase(str) { 18628 return str.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(); 18629 } 18630 18631 // packages/global-styles-engine/build-module/utils/spacing.mjs 18632 function getSpacingPresetCssVar(value) { 18633 if (!value) { 18634 return; 18635 } 18636 const slug = value.match(/var:preset\|spacing\|(.+)/); 18637 if (!slug) { 18638 return value; 18639 } 18640 return `var(--wp--preset--spacing--$slug[1]})`; 18641 } 18642 18643 // packages/global-styles-engine/build-module/utils/gap.mjs 18644 function getGapBoxControlValueFromStyle(blockGapValue) { 18645 if (!blockGapValue) { 18646 return null; 18647 } 18648 const isValueString = typeof blockGapValue === "string"; 18649 return { 18650 top: isValueString ? blockGapValue : blockGapValue?.top, 18651 left: isValueString ? blockGapValue : blockGapValue?.left 18652 }; 18653 } 18654 function getGapCSSValue(blockGapValue, defaultValue2 = "0") { 18655 const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); 18656 if (!blockGapBoxControlValue) { 18657 return null; 18658 } 18659 const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue2; 18660 const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue2; 18661 return row === column ? row : `$row} $column}`; 18662 } 18663 18664 // packages/global-styles-engine/build-module/utils/background.mjs 18665 var BACKGROUND_BLOCK_DEFAULT_VALUES = { 18666 backgroundSize: "cover", 18667 backgroundPosition: "50% 50%" 18668 // used only when backgroundSize is 'contain'. 18669 }; 18670 function setBackgroundStyleDefaults(backgroundStyle) { 18671 if (!backgroundStyle || // @ts-expect-error 18672 !backgroundStyle?.backgroundImage?.url) { 18673 return; 18674 } 18675 let backgroundStylesWithDefaults; 18676 if (!backgroundStyle?.backgroundSize) { 18677 backgroundStylesWithDefaults = { 18678 backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize 18679 }; 18680 } 18681 if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) { 18682 backgroundStylesWithDefaults = { 18683 backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition 18684 }; 18685 } 18686 return backgroundStylesWithDefaults; 18687 } 18688 18689 // packages/global-styles-engine/build-module/utils/layout.mjs 18690 var LAYOUT_DEFINITIONS = { 18691 default: { 18692 name: "default", 18693 slug: "flow", 18694 className: "is-layout-flow", 18695 baseStyles: [ 18696 { 18697 selector: " > .alignleft", 18698 rules: { 18699 float: "left", 18700 "margin-inline-start": "0", 18701 "margin-inline-end": "2em" 18702 } 18703 }, 18704 { 18705 selector: " > .alignright", 18706 rules: { 18707 float: "right", 18708 "margin-inline-start": "2em", 18709 "margin-inline-end": "0" 18710 } 18711 }, 18712 { 18713 selector: " > .aligncenter", 18714 rules: { 18715 "margin-left": "auto !important", 18716 "margin-right": "auto !important" 18717 } 18718 } 18719 ], 18720 spacingStyles: [ 18721 { 18722 selector: " > :first-child", 18723 rules: { 18724 "margin-block-start": "0" 18725 } 18726 }, 18727 { 18728 selector: " > :last-child", 18729 rules: { 18730 "margin-block-end": "0" 18731 } 18732 }, 18733 { 18734 selector: " > *", 18735 rules: { 18736 "margin-block-start": null, 18737 "margin-block-end": "0" 18738 } 18739 } 18740 ] 18741 }, 18742 constrained: { 18743 name: "constrained", 18744 slug: "constrained", 18745 className: "is-layout-constrained", 18746 baseStyles: [ 18747 { 18748 selector: " > .alignleft", 18749 rules: { 18750 float: "left", 18751 "margin-inline-start": "0", 18752 "margin-inline-end": "2em" 18753 } 18754 }, 18755 { 18756 selector: " > .alignright", 18757 rules: { 18758 float: "right", 18759 "margin-inline-start": "2em", 18760 "margin-inline-end": "0" 18761 } 18762 }, 18763 { 18764 selector: " > .aligncenter", 18765 rules: { 18766 "margin-left": "auto !important", 18767 "margin-right": "auto !important" 18768 } 18769 }, 18770 { 18771 selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))", 18772 rules: { 18773 "max-width": "var(--wp--style--global--content-size)", 18774 "margin-left": "auto !important", 18775 "margin-right": "auto !important" 18776 } 18777 }, 18778 { 18779 selector: " > .alignwide", 18780 rules: { 18781 "max-width": "var(--wp--style--global--wide-size)" 18782 } 18783 } 18784 ], 18785 spacingStyles: [ 18786 { 18787 selector: " > :first-child", 18788 rules: { 18789 "margin-block-start": "0" 18790 } 18791 }, 18792 { 18793 selector: " > :last-child", 18794 rules: { 18795 "margin-block-end": "0" 18796 } 18797 }, 18798 { 18799 selector: " > *", 18800 rules: { 18801 "margin-block-start": null, 18802 "margin-block-end": "0" 18803 } 18804 } 18805 ] 18806 }, 18807 flex: { 18808 name: "flex", 18809 slug: "flex", 18810 className: "is-layout-flex", 18811 displayMode: "flex", 18812 baseStyles: [ 18813 { 18814 selector: "", 18815 rules: { 18816 "flex-wrap": "wrap", 18817 "align-items": "center" 18818 } 18819 }, 18820 { 18821 selector: " > :is(*, div)", 18822 // :is(*, div) instead of just * increases the specificity by 001. 18823 rules: { 18824 margin: "0" 18825 } 18826 } 18827 ], 18828 spacingStyles: [ 18829 { 18830 selector: "", 18831 rules: { 18832 gap: null 18833 } 18834 } 18835 ] 18836 }, 18837 grid: { 18838 name: "grid", 18839 slug: "grid", 18840 className: "is-layout-grid", 18841 displayMode: "grid", 18842 baseStyles: [ 18843 { 18844 selector: " > :is(*, div)", 18845 // :is(*, div) instead of just * increases the specificity by 001. 18846 rules: { 18847 margin: "0" 18848 } 18849 } 18850 ], 18851 spacingStyles: [ 18852 { 18853 selector: "", 18854 rules: { 18855 gap: null 18856 } 18857 } 18858 ] 18859 } 18860 }; 18861 18862 // packages/global-styles-engine/build-module/core/render.mjs 18863 var ELEMENT_CLASS_NAMES = { 18864 button: "wp-element-button", 18865 caption: "wp-element-caption" 18866 }; 18867 var BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = { 18868 __experimentalBorder: "border", 18869 color: "color", 18870 dimensions: "dimensions", 18871 spacing: "spacing", 18872 typography: "typography" 18873 }; 18874 var VALID_BLOCK_PSEUDO_SELECTORS = { 18875 "core/button": [":hover", ":focus", ":focus-visible", ":active"], 18876 "core/navigation-link": [":hover", ":focus", ":focus-visible", ":active"] 18877 }; 18878 var VALID_ELEMENT_PSEUDO_SELECTORS = { 18879 link: [ 18880 ":link", 18881 ":any-link", 18882 ":visited", 18883 ":hover", 18884 ":focus", 18885 ":focus-visible", 18886 ":active" 18887 ], 18888 button: [ 18889 ":link", 18890 ":any-link", 18891 ":visited", 18892 ":hover", 18893 ":focus", 18894 ":focus-visible", 18895 ":active" 18896 ] 18897 }; 18898 var RESPONSIVE_BREAKPOINTS = { 18899 mobile: "@media (width <= 480px)", 18900 tablet: "@media (480px < width <= 782px)" 18901 }; 18902 function getPresetsClasses(blockSelector = "*", blockPresets = {}) { 18903 return PRESET_METADATA.reduce( 18904 (declarations, { path, cssVarInfix, classes }) => { 18905 if (!classes) { 18906 return declarations; 18907 } 18908 const presetByOrigin = getValueFromObjectPath( 18909 blockPresets, 18910 path, 18911 [] 18912 ); 18913 ["default", "theme", "custom"].forEach((origin) => { 18914 if (presetByOrigin[origin]) { 18915 presetByOrigin[origin].forEach( 18916 ({ slug }) => { 18917 classes.forEach( 18918 ({ 18919 classSuffix, 18920 propertyName 18921 }) => { 18922 const classSelectorToUse = `.has-$kebabCase( 18923 slug 18924 )}-$classSuffix}`; 18925 const selectorToUse = blockSelector.split(",").map( 18926 (selector2) => `$selector2}$classSelectorToUse}` 18927 ).join(","); 18928 const value = `var(--wp--preset--$cssVarInfix}--$kebabCase( 18929 slug 18930 )})`; 18931 declarations += `$selectorToUse}{$propertyName}: $value} !important;}`; 18932 } 18933 ); 18934 } 18935 ); 18936 } 18937 }); 18938 return declarations; 18939 }, 18940 "" 18941 ); 18942 } 18943 function getPresetsSvgFilters(blockPresets = {}) { 18944 return PRESET_METADATA.filter( 18945 // Duotone are the only type of filters for now. 18946 (metadata) => metadata.path.at(-1) === "duotone" 18947 ).flatMap((metadata) => { 18948 const presetByOrigin = getValueFromObjectPath( 18949 blockPresets, 18950 metadata.path, 18951 {} 18952 ); 18953 return ["default", "theme"].filter((origin) => presetByOrigin[origin]).flatMap( 18954 (origin) => presetByOrigin[origin].map( 18955 (preset) => getDuotoneFilter( 18956 `wp-duotone-$preset.slug}`, 18957 preset.colors 18958 ) 18959 ) 18960 ).join(""); 18961 }); 18962 } 18963 function flattenTree(input = {}, prefix2, token) { 18964 let result = []; 18965 Object.keys(input).forEach((key) => { 18966 const newKey = prefix2 + kebabCase(key.replace("/", "-")); 18967 const newLeaf = input[key]; 18968 if (newLeaf instanceof Object) { 18969 const newPrefix = newKey + token; 18970 result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; 18971 } else { 18972 result.push(`$newKey}: $newLeaf}`); 18973 } 18974 }); 18975 return result; 18976 } 18977 var updateParagraphTextIndentSelector = (featureDeclarations, settings2, blockName) => { 18978 if (blockName !== "core/paragraph") { 18979 return featureDeclarations; 18980 } 18981 const blockSettings = settings2?.blocks?.["core/paragraph"]; 18982 const textIndentSetting = blockSettings?.typography?.textIndent ?? settings2?.typography?.textIndent ?? "subsequent"; 18983 if (textIndentSetting !== "all") { 18984 return featureDeclarations; 18985 } 18986 const oldSelector = ".wp-block-paragraph + .wp-block-paragraph"; 18987 const newSelector = ".wp-block-paragraph"; 18988 if (oldSelector in featureDeclarations) { 18989 const declarations = featureDeclarations[oldSelector]; 18990 const updated = { ...featureDeclarations }; 18991 delete updated[oldSelector]; 18992 updated[newSelector] = declarations; 18993 return updated; 18994 } 18995 return featureDeclarations; 18996 }; 18997 var updateButtonWidthDeclarations = (featureDeclarations, settings2) => { 18998 const buttonSelector = ".wp-block-button"; 18999 if (!(buttonSelector in featureDeclarations)) { 19000 return featureDeclarations; 19001 } 19002 const updated = { ...featureDeclarations }; 19003 updated[buttonSelector] = updated[buttonSelector].map( 19004 (declaration) => { 19005 const match3 = declaration.match(/^width:\s*(.+)$/); 19006 if (!match3) { 19007 return declaration; 19008 } 19009 const value = match3[1]; 19010 let percentage = null; 19011 if (value.endsWith("%")) { 19012 percentage = parseFloat(value); 19013 } 19014 const presetPrefix = "var(--wp--preset--dimension--"; 19015 if (percentage === null && value.startsWith(presetPrefix) && value.endsWith(")")) { 19016 const slug = value.slice(presetPrefix.length, -1); 19017 const dimensionSizes = { 19018 ...settings2?.dimensions?.dimensionSizes ?? {}, 19019 ...settings2?.blocks?.["core/button"]?.dimensions?.dimensionSizes ?? {} 19020 }; 19021 for (const origin of Object.values(dimensionSizes)) { 19022 if (!Array.isArray(origin)) { 19023 continue; 19024 } 19025 for (const preset of origin) { 19026 if (preset.slug === slug && typeof preset.size === "string" && preset.size.endsWith("%")) { 19027 percentage = parseFloat(preset.size); 19028 break; 19029 } 19030 } 19031 if (percentage !== null) { 19032 break; 19033 } 19034 } 19035 } 19036 if (percentage === null || isNaN(percentage)) { 19037 return declaration; 19038 } 19039 return `width: calc($percentage} * 1% - (var(--wp--style--block-gap, 0.5em) * (1 - $percentage} / 100)))`; 19040 } 19041 ); 19042 return updated; 19043 }; 19044 var getFeatureDeclarations = (selectors3, styles) => { 19045 const declarations = {}; 19046 Object.entries(selectors3).forEach(([feature, selector2]) => { 19047 if (feature === "root" || !styles?.[feature]) { 19048 return; 19049 } 19050 const isShorthand = typeof selector2 === "string"; 19051 if (!isShorthand && typeof selector2 === "object" && selector2 !== null) { 19052 Object.entries(selector2).forEach( 19053 ([subfeature, subfeatureSelector]) => { 19054 if (subfeature === "root" || !styles?.[feature][subfeature]) { 19055 return; 19056 } 19057 const subfeatureStyles = { 19058 [feature]: { 19059 [subfeature]: styles[feature][subfeature] 19060 } 19061 }; 19062 const newDeclarations = getStylesDeclarations(subfeatureStyles); 19063 declarations[subfeatureSelector] = [ 19064 ...declarations[subfeatureSelector] || [], 19065 ...newDeclarations 19066 ]; 19067 delete styles[feature][subfeature]; 19068 } 19069 ); 19070 } 19071 if (isShorthand || typeof selector2 === "object" && selector2 !== null && "root" in selector2) { 19072 const featureSelector = isShorthand ? selector2 : selector2.root; 19073 const featureStyles = { [feature]: styles[feature] }; 19074 const newDeclarations = getStylesDeclarations(featureStyles); 19075 declarations[featureSelector] = [ 19076 ...declarations[featureSelector] || [], 19077 ...newDeclarations 19078 ]; 19079 delete styles[feature]; 19080 } 19081 }); 19082 return declarations; 19083 }; 19084 function getStylesDeclarations(blockStyles = {}, selector2 = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) { 19085 const isRoot = ROOT_BLOCK_SELECTOR === selector2; 19086 const output = Object.entries( 19087 import_blocks3.__EXPERIMENTAL_STYLE_PROPERTY 19088 ).reduce( 19089 (declarations, [key, { value, properties, useEngine, rootOnly }]) => { 19090 if (rootOnly && !isRoot) { 19091 return declarations; 19092 } 19093 const pathToValue = value; 19094 if (pathToValue[0] === "elements" || useEngine) { 19095 return declarations; 19096 } 19097 const styleValue = getValueFromObjectPath( 19098 blockStyles, 19099 pathToValue 19100 ); 19101 if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) { 19102 return declarations; 19103 } 19104 if (properties && typeof styleValue !== "string") { 19105 Object.entries(properties).forEach((entry) => { 19106 const [name2, prop] = entry; 19107 if (!getValueFromObjectPath(styleValue, [prop], false)) { 19108 return; 19109 } 19110 const cssProperty = name2.startsWith("--") ? name2 : kebabCase(name2); 19111 declarations.push( 19112 `$cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)( 19113 getValueFromObjectPath(styleValue, [prop]) 19114 )}` 19115 ); 19116 }); 19117 } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) { 19118 const cssProperty = key.startsWith("--") ? key : kebabCase(key); 19119 declarations.push( 19120 `$cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)( 19121 getValueFromObjectPath(blockStyles, pathToValue) 19122 )}` 19123 ); 19124 } 19125 return declarations; 19126 }, 19127 [] 19128 ); 19129 if (!!blockStyles.background) { 19130 if (blockStyles.background?.backgroundImage) { 19131 blockStyles.background.backgroundImage = getResolvedValue( 19132 blockStyles.background.backgroundImage, 19133 tree 19134 ); 19135 } 19136 if (!isRoot && !!blockStyles.background?.backgroundImage?.id) { 19137 blockStyles = { 19138 ...blockStyles, 19139 background: { 19140 ...blockStyles.background, 19141 ...setBackgroundStyleDefaults(blockStyles.background) 19142 } 19143 }; 19144 } 19145 } 19146 const extraRules = (0, import_style_engine2.getCSSRules)(blockStyles); 19147 extraRules.forEach((rule) => { 19148 if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) { 19149 return; 19150 } 19151 const cssProperty = rule.key.startsWith("--") ? rule.key : kebabCase(rule.key); 19152 let ruleValue = getResolvedValue(rule.value, tree); 19153 if (cssProperty === "font-size") { 19154 ruleValue = getTypographyFontSizeValue( 19155 { name: "", slug: "", size: ruleValue }, 19156 tree?.settings 19157 ); 19158 } 19159 if (cssProperty === "aspect-ratio") { 19160 output.push("min-height: unset"); 19161 } 19162 output.push(`$cssProperty}: $ruleValue}`); 19163 }); 19164 return output; 19165 } 19166 function getLayoutStyles({ 19167 layoutDefinitions = LAYOUT_DEFINITIONS, 19168 style, 19169 selector: selector2, 19170 hasBlockGapSupport, 19171 hasFallbackGapSupport, 19172 fallbackGapValue 19173 }) { 19174 let ruleset = ""; 19175 let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ""; 19176 if (hasFallbackGapSupport) { 19177 if (selector2 === ROOT_BLOCK_SELECTOR) { 19178 gapValue = !gapValue ? "0.5em" : gapValue; 19179 } else if (!hasBlockGapSupport && fallbackGapValue) { 19180 gapValue = fallbackGapValue; 19181 } 19182 } 19183 if (gapValue && layoutDefinitions) { 19184 Object.values(layoutDefinitions).forEach( 19185 ({ className, name: name2, spacingStyles }) => { 19186 if (!hasBlockGapSupport && "flex" !== name2 && "grid" !== name2) { 19187 return; 19188 } 19189 if (spacingStyles?.length) { 19190 spacingStyles.forEach((spacingStyle) => { 19191 const declarations = []; 19192 if (spacingStyle.rules) { 19193 Object.entries(spacingStyle.rules).forEach( 19194 ([cssProperty, cssValue]) => { 19195 declarations.push( 19196 `$cssProperty}: $cssValue ? cssValue : gapValue}` 19197 ); 19198 } 19199 ); 19200 } 19201 if (declarations.length) { 19202 let combinedSelector = ""; 19203 if (!hasBlockGapSupport) { 19204 combinedSelector = selector2 === ROOT_BLOCK_SELECTOR ? `:where(.$className}$spacingStyle?.selector || ""})` : `:where($selector2}.$className}$spacingStyle?.selector || ""})`; 19205 } else { 19206 combinedSelector = selector2 === ROOT_BLOCK_SELECTOR ? `:root :where(.$className})$spacingStyle?.selector || ""}` : `:root :where($selector2}-$className})$spacingStyle?.selector || ""}`; 19207 } 19208 ruleset += `$combinedSelector} { $declarations.join( 19209 "; " 19210 )}; }`; 19211 } 19212 }); 19213 } 19214 } 19215 ); 19216 if (selector2 === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { 19217 ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: $gapValue}; }`; 19218 } 19219 } 19220 if (selector2 === ROOT_BLOCK_SELECTOR && layoutDefinitions) { 19221 const validDisplayModes = ["block", "flex", "grid"]; 19222 Object.values(layoutDefinitions).forEach( 19223 ({ className, displayMode, baseStyles }) => { 19224 if (displayMode && validDisplayModes.includes(displayMode)) { 19225 ruleset += `$selector2} .$className} { display:$displayMode}; }`; 19226 } 19227 if (baseStyles?.length) { 19228 baseStyles.forEach((baseStyle) => { 19229 const declarations = []; 19230 if (baseStyle.rules) { 19231 Object.entries(baseStyle.rules).forEach( 19232 ([cssProperty, cssValue]) => { 19233 declarations.push( 19234 `$cssProperty}: $cssValue}` 19235 ); 19236 } 19237 ); 19238 } 19239 if (declarations.length) { 19240 const combinedSelector = `.$className}$baseStyle?.selector || ""}`; 19241 ruleset += `$combinedSelector} { $declarations.join( 19242 "; " 19243 )}; }`; 19244 } 19245 }); 19246 } 19247 } 19248 ); 19249 } 19250 return ruleset; 19251 } 19252 var STYLE_KEYS = [ 19253 "border", 19254 "color", 19255 "dimensions", 19256 "spacing", 19257 "typography", 19258 "filter", 19259 "outline", 19260 "shadow", 19261 "background" 19262 ]; 19263 function pickStyleKeys(treeToPickFrom) { 19264 return pickStyleAndPseudoKeys(treeToPickFrom); 19265 } 19266 function pickStyleAndPseudoKeys(treeToPickFrom, blockName) { 19267 if (!treeToPickFrom) { 19268 return {}; 19269 } 19270 const entries = Object.entries(treeToPickFrom); 19271 const allowedPseudoSelectors = blockName ? VALID_BLOCK_PSEUDO_SELECTORS[blockName] ?? [] : []; 19272 const pickedEntries = entries.filter( 19273 ([key]) => STYLE_KEYS.includes(key) || allowedPseudoSelectors.includes(key) || RESPONSIVE_BREAKPOINTS[key] 19274 ); 19275 const clonedEntries = pickedEntries.map(([key, style]) => [ 19276 key, 19277 JSON.parse(JSON.stringify(style)) 19278 ]); 19279 return Object.fromEntries(clonedEntries); 19280 } 19281 function getPseudoStyleNodes(node) { 19282 const { 19283 styles, 19284 selector: selector2, 19285 featureSelectors, 19286 name: name2, 19287 elementName, 19288 mediaQuery, 19289 variationName 19290 } = node; 19291 const pseudoSelectors = name2 ? VALID_BLOCK_PSEUDO_SELECTORS[name2] ?? [] : VALID_ELEMENT_PSEUDO_SELECTORS[elementName ?? ""] ?? []; 19292 if (!pseudoSelectors.length) { 19293 return []; 19294 } 19295 return pseudoSelectors.flatMap((pseudoSelector) => { 19296 const pseudoStyles = styles?.[pseudoSelector]; 19297 if (!pseudoStyles || typeof pseudoStyles !== "object") { 19298 return []; 19299 } 19300 return [ 19301 { 19302 styles: JSON.parse(JSON.stringify(pseudoStyles)), 19303 selector: selector2, 19304 selectorSuffix: pseudoSelector, 19305 mediaQuery, 19306 featureSelectors: featureSelectors && typeof featureSelectors !== "string" ? featureSelectors : void 0, 19307 name: name2, 19308 elementName, 19309 variationName 19310 } 19311 ]; 19312 }); 19313 } 19314 function getResponsiveStyleNodes(node) { 19315 const { 19316 styles, 19317 selector: selector2, 19318 featureSelectors, 19319 name: name2, 19320 elementName, 19321 isStyleVariation, 19322 variationName 19323 } = node; 19324 if (!name2 && !elementName) { 19325 return []; 19326 } 19327 return Object.entries(RESPONSIVE_BREAKPOINTS).flatMap( 19328 ([breakpointKey, mediaQuery]) => { 19329 const breakpointStyles = styles?.[breakpointKey]; 19330 if (!breakpointStyles || typeof breakpointStyles !== "object") { 19331 return []; 19332 } 19333 return [ 19334 { 19335 styles: JSON.parse(JSON.stringify(breakpointStyles)), 19336 selector: selector2, 19337 mediaQuery, 19338 featureSelectors: featureSelectors && typeof featureSelectors !== "string" ? featureSelectors : void 0, 19339 name: name2, 19340 elementName, 19341 isStyleVariation, 19342 variationName 19343 } 19344 ]; 19345 } 19346 ); 19347 } 19348 var getNodesWithStyles = (tree, blockSelectors) => { 19349 const nodes = []; 19350 if (!tree?.styles) { 19351 return nodes; 19352 } 19353 const styles = pickStyleKeys(tree.styles); 19354 if (styles) { 19355 nodes.push({ 19356 styles, 19357 selector: ROOT_BLOCK_SELECTOR, 19358 // Root selector (body) styles should not be wrapped in `:root where()` to keep 19359 // specificity at (0,0,1) and maintain backwards compatibility. 19360 skipSelectorWrapper: true 19361 }); 19362 } 19363 Object.entries(import_blocks3.__EXPERIMENTAL_ELEMENTS).forEach(([name2, selector2]) => { 19364 if (tree.styles?.elements?.[name2]) { 19365 nodes.push({ 19366 styles: tree.styles?.elements?.[name2] ?? {}, 19367 selector: selector2, 19368 elementName: name2, 19369 // Top level elements that don't use a class name should not receive the 19370 // `:root :where()` wrapper to maintain backwards compatibility. 19371 skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name2] 19372 }); 19373 } 19374 }); 19375 Object.entries(tree.styles?.blocks ?? {}).forEach( 19376 ([blockName, node]) => { 19377 const blockStyles = pickStyleAndPseudoKeys(node, blockName); 19378 const typedNode = node; 19379 const variationNodesToAdd = []; 19380 const variationStyleNodesToAdd = []; 19381 if (typedNode?.variations) { 19382 Object.entries(typedNode.variations).forEach( 19383 ([variationName, variation]) => { 19384 const typedVariation = variation; 19385 const variationStyles = pickStyleAndPseudoKeys( 19386 typedVariation, 19387 blockName 19388 ); 19389 if (typedVariation?.css) { 19390 variationStyles.css = typedVariation.css; 19391 } 19392 const variationSelector = typeof blockSelectors !== "string" ? blockSelectors[blockName]?.styleVariationSelectors?.[variationName] : void 0; 19393 if (variationSelector && typeof blockSelectors !== "string") { 19394 const blockSelector = blockSelectors[blockName]; 19395 variationStyleNodesToAdd.push({ 19396 styles: variationStyles, 19397 selector: variationSelector, 19398 featureSelectors: blockSelector?.featureSelectors, 19399 fallbackGapValue: blockSelector?.fallbackGapValue, 19400 hasLayoutSupport: blockSelector?.hasLayoutSupport, 19401 isStyleVariation: true, 19402 variationName, 19403 layoutSelector: variationSelector + blockSelector.selector, 19404 layoutHasBlockGapSupport: true, 19405 name: blockName 19406 }); 19407 } 19408 Object.entries( 19409 typedVariation?.elements ?? {} 19410 ).forEach(([element, elementStyles]) => { 19411 if (elementStyles && import_blocks3.__EXPERIMENTAL_ELEMENTS[element]) { 19412 variationNodesToAdd.push({ 19413 styles: elementStyles, 19414 selector: scopeSelector( 19415 variationSelector, 19416 import_blocks3.__EXPERIMENTAL_ELEMENTS[element] 19417 ), 19418 elementName: element, 19419 isStyleVariation: true 19420 }); 19421 } 19422 }); 19423 Object.entries(typedVariation?.blocks ?? {}).forEach( 19424 ([ 19425 variationBlockName, 19426 variationBlockStyles 19427 ]) => { 19428 const variationBlockSelector = typeof blockSelectors !== "string" ? scopeSelector( 19429 variationSelector, 19430 blockSelectors[variationBlockName]?.selector 19431 ) : void 0; 19432 const variationDuotoneSelector = typeof blockSelectors !== "string" ? scopeSelector( 19433 variationSelector, 19434 blockSelectors[variationBlockName]?.duotoneSelector 19435 ) : void 0; 19436 const variationFeatureSelectors = typeof blockSelectors !== "string" ? scopeFeatureSelectors( 19437 variationSelector, 19438 blockSelectors[variationBlockName]?.featureSelectors ?? {} 19439 ) : void 0; 19440 const variationBlockStyleNodes = pickStyleAndPseudoKeys( 19441 variationBlockStyles, 19442 variationBlockName 19443 ); 19444 if (variationBlockStyles?.css) { 19445 variationBlockStyleNodes.css = variationBlockStyles.css; 19446 } 19447 if (!variationBlockSelector || typeof blockSelectors === "string") { 19448 return; 19449 } 19450 variationNodesToAdd.push({ 19451 selector: variationBlockSelector, 19452 name: variationBlockName, 19453 isStyleVariation: true, 19454 duotoneSelector: variationDuotoneSelector, 19455 featureSelectors: variationFeatureSelectors, 19456 fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue, 19457 hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport, 19458 styles: variationBlockStyleNodes 19459 }); 19460 Object.entries( 19461 variationBlockStyles.elements ?? {} 19462 ).forEach( 19463 ([ 19464 variationBlockElement, 19465 variationBlockElementStyles 19466 ]) => { 19467 if (variationBlockElementStyles && import_blocks3.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) { 19468 variationNodesToAdd.push({ 19469 styles: variationBlockElementStyles, 19470 selector: scopeSelector( 19471 variationBlockSelector, 19472 import_blocks3.__EXPERIMENTAL_ELEMENTS[variationBlockElement] 19473 ), 19474 elementName: variationBlockElement, 19475 isStyleVariation: true 19476 }); 19477 } 19478 } 19479 ); 19480 } 19481 ); 19482 } 19483 ); 19484 } 19485 if (typeof blockSelectors !== "string" && blockSelectors?.[blockName]?.selector) { 19486 nodes.push({ 19487 duotoneSelector: blockSelectors[blockName].duotoneSelector, 19488 fallbackGapValue: blockSelectors[blockName].fallbackGapValue, 19489 hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport, 19490 selector: blockSelectors[blockName].selector, 19491 styles: blockStyles, 19492 featureSelectors: blockSelectors[blockName].featureSelectors, 19493 name: blockName 19494 }); 19495 } 19496 nodes.push(...variationStyleNodesToAdd); 19497 Object.entries(typedNode?.elements ?? {}).forEach( 19498 ([elementName, value]) => { 19499 if (typeof blockSelectors !== "string" && value && blockSelectors?.[blockName] && import_blocks3.__EXPERIMENTAL_ELEMENTS[elementName]) { 19500 nodes.push({ 19501 styles: value, 19502 selector: blockSelectors[blockName]?.selector.split(",").map((sel) => { 19503 const elementSelectors = import_blocks3.__EXPERIMENTAL_ELEMENTS[elementName].split(","); 19504 return elementSelectors.map( 19505 (elementSelector) => sel + " " + elementSelector 19506 ); 19507 }).join(","), 19508 elementName 19509 }); 19510 } 19511 } 19512 ); 19513 nodes.push(...variationNodesToAdd); 19514 } 19515 ); 19516 return nodes; 19517 }; 19518 var getNodesWithSettings = (tree, blockSelectors) => { 19519 const nodes = []; 19520 if (!tree?.settings) { 19521 return nodes; 19522 } 19523 const pickPresets = (treeToPickFrom) => { 19524 let presets2 = {}; 19525 PRESET_METADATA.forEach(({ path }) => { 19526 const value = getValueFromObjectPath(treeToPickFrom, path, false); 19527 if (value !== false) { 19528 presets2 = setImmutably(presets2, path, value); 19529 } 19530 }); 19531 return presets2; 19532 }; 19533 const presets = pickPresets(tree.settings); 19534 const custom = tree.settings?.custom; 19535 if (Object.keys(presets).length > 0 || custom) { 19536 nodes.push({ 19537 presets, 19538 custom, 19539 selector: ROOT_CSS_PROPERTIES_SELECTOR 19540 }); 19541 } 19542 Object.entries(tree.settings?.blocks ?? {}).forEach( 19543 ([blockName, node]) => { 19544 const blockCustom = node.custom; 19545 if (typeof blockSelectors === "string" || !blockSelectors[blockName]) { 19546 return; 19547 } 19548 const blockPresets = pickPresets(node); 19549 if (Object.keys(blockPresets).length > 0 || blockCustom) { 19550 nodes.push({ 19551 presets: blockPresets, 19552 custom: blockCustom, 19553 selector: blockSelectors[blockName]?.selector, 19554 featureSelectors: blockSelectors[blockName]?.featureSelectors 19555 }); 19556 } 19557 } 19558 ); 19559 return nodes; 19560 }; 19561 function resolveFeatureSelector(featureSelectors, featureKey, fallback) { 19562 if (!featureSelectors || typeof featureSelectors === "string") { 19563 return fallback; 19564 } 19565 const feature = featureSelectors[featureKey]; 19566 if (typeof feature === "string") { 19567 return feature; 19568 } 19569 if (typeof feature === "object" && feature.root) { 19570 return feature.root; 19571 } 19572 return fallback; 19573 } 19574 function getPresetVarDeclarations(presets, mergedSettings, { path, valueKey, valueFunc, cssVarInfix }) { 19575 const presetByOrigin = getValueFromObjectPath( 19576 presets, 19577 path, 19578 [] 19579 ); 19580 const declarations = []; 19581 for (const origin of ["default", "theme", "custom"]) { 19582 if (!presetByOrigin[origin]) { 19583 continue; 19584 } 19585 for (const value of presetByOrigin[origin]) { 19586 const slug = kebabCase(value.slug); 19587 if (valueKey && !valueFunc) { 19588 declarations.push( 19589 `--wp--preset--$cssVarInfix}--$slug}: $value[valueKey]}` 19590 ); 19591 } else if (valueFunc && typeof valueFunc === "function") { 19592 declarations.push( 19593 `--wp--preset--$cssVarInfix}--$slug}: $valueFunc( 19594 value, 19595 mergedSettings 19596 )}` 19597 ); 19598 } 19599 } 19600 } 19601 return declarations; 19602 } 19603 var generateCustomProperties = (tree, blockSelectors) => { 19604 const nodes = getNodesWithSettings(tree, blockSelectors); 19605 let ruleset = ""; 19606 for (const { presets, custom, selector: selector2, featureSelectors } of nodes) { 19607 const defaultSelector = selector2; 19608 const varsBySelector = { 19609 [defaultSelector]: [] 19610 }; 19611 if (tree?.settings) { 19612 for (const metadata of PRESET_METADATA) { 19613 const declarations = getPresetVarDeclarations( 19614 presets, 19615 tree.settings, 19616 metadata 19617 ); 19618 if (declarations.length === 0) { 19619 continue; 19620 } 19621 const target = resolveFeatureSelector( 19622 featureSelectors, 19623 metadata.path[0], 19624 defaultSelector 19625 ); 19626 if (!varsBySelector[target]) { 19627 varsBySelector[target] = []; 19628 } 19629 varsBySelector[target].push(...declarations); 19630 } 19631 } 19632 const customProps = flattenTree(custom, "--wp--custom--", "--"); 19633 if (customProps.length > 0) { 19634 varsBySelector[defaultSelector].push(...customProps); 19635 } 19636 for (const [ruleSelector, declarations] of Object.entries( 19637 varsBySelector 19638 )) { 19639 if (declarations.length > 0) { 19640 ruleset += `$ruleSelector}{$declarations.join(";")};}`; 19641 } 19642 } 19643 } 19644 return ruleset; 19645 }; 19646 function renderStylesNode(node, { 19647 tree, 19648 useRootPaddingAlign, 19649 disableLayoutStyles, 19650 hasBlockGapSupport, 19651 hasFallbackGapSupport, 19652 disableRootPadding 19653 }) { 19654 const { 19655 selector: selector2, 19656 selectorSuffix, 19657 mediaQuery, 19658 duotoneSelector, 19659 styles, 19660 fallbackGapValue, 19661 hasLayoutSupport, 19662 featureSelectors, 19663 layoutSelector, 19664 layoutHasBlockGapSupport, 19665 skipSelectorWrapper, 19666 name: name2, 19667 variationName 19668 } = node; 19669 let ruleset = ""; 19670 const effectiveSelector = selectorSuffix ? appendToSelector(selector2, selectorSuffix) : selector2; 19671 if (featureSelectors && typeof featureSelectors !== "string") { 19672 let featureDeclarations = getFeatureDeclarations( 19673 featureSelectors, 19674 styles 19675 ); 19676 featureDeclarations = updateParagraphTextIndentSelector( 19677 featureDeclarations, 19678 tree.settings, 19679 name2 19680 ); 19681 featureDeclarations = updateButtonWidthDeclarations( 19682 featureDeclarations, 19683 tree.settings 19684 ); 19685 Object.entries(featureDeclarations).forEach( 19686 ([featureSelector, declarations]) => { 19687 if (declarations.length) { 19688 let selectorForRule = variationName ? getBlockStyleVariationFeatureSelector( 19689 variationName, 19690 featureSelector 19691 ) : featureSelector; 19692 selectorForRule = selectorSuffix ? appendToSelector(selectorForRule, selectorSuffix) : selectorForRule; 19693 const rules = declarations.join(";"); 19694 ruleset += `:root :where($selectorForRule}){$rules};}`; 19695 } 19696 } 19697 ); 19698 } 19699 if (duotoneSelector) { 19700 const duotoneStyles = {}; 19701 if (styles?.filter) { 19702 duotoneStyles.filter = styles.filter; 19703 delete styles.filter; 19704 } 19705 const duotoneDeclarations = getStylesDeclarations(duotoneStyles); 19706 if (duotoneDeclarations.length) { 19707 ruleset += `$duotoneSelector}{$duotoneDeclarations.join( 19708 ";" 19709 )};}`; 19710 } 19711 } 19712 const selectorForLayout = layoutSelector ?? effectiveSelector; 19713 const hasBlockGapSupportForLayout = layoutHasBlockGapSupport ?? hasBlockGapSupport; 19714 if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selectorForLayout || hasLayoutSupport)) { 19715 ruleset += getLayoutStyles({ 19716 style: styles, 19717 selector: selectorForLayout, 19718 hasBlockGapSupport: hasBlockGapSupportForLayout, 19719 hasFallbackGapSupport, 19720 fallbackGapValue 19721 }); 19722 } 19723 const styleDeclarations = getStylesDeclarations( 19724 styles, 19725 effectiveSelector, 19726 useRootPaddingAlign, 19727 tree, 19728 disableRootPadding 19729 ); 19730 if (styleDeclarations?.length) { 19731 const generalSelector = skipSelectorWrapper ? effectiveSelector : `:root :where($effectiveSelector})`; 19732 ruleset += `$generalSelector}{$styleDeclarations.join(";")};}`; 19733 } 19734 if (styles?.css) { 19735 ruleset += processCSSNesting( 19736 styles.css, 19737 `:root :where($effectiveSelector})` 19738 ); 19739 } 19740 if (mediaQuery && ruleset) { 19741 return `$mediaQuery}{$ruleset}}`; 19742 } 19743 return ruleset; 19744 } 19745 var transformToStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = {}) => { 19746 const options = { 19747 blockGap: true, 19748 blockStyles: true, 19749 layoutStyles: true, 19750 marginReset: true, 19751 presets: true, 19752 rootPadding: true, 19753 variationStyles: false, 19754 ...styleOptions 19755 }; 19756 const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); 19757 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); 19758 const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments; 19759 const { contentSize, wideSize } = tree?.settings?.layout || {}; 19760 const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles; 19761 let ruleset = ""; 19762 if (options.presets && (contentSize || wideSize)) { 19763 ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} {`; 19764 ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: $contentSize};` : ruleset; 19765 ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: $wideSize};` : ruleset; 19766 ruleset += "}"; 19767 } 19768 if (hasBodyStyles) { 19769 ruleset += ":where(body) {margin: 0;"; 19770 if (options.rootPadding && useRootPaddingAlign) { 19771 ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } 19772 .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } 19773 .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } 19774 .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; } 19775 .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; 19776 `; 19777 } 19778 ruleset += "}"; 19779 } 19780 if (options.blockStyles) { 19781 nodesWithStyles.forEach((node) => { 19782 if (node.isStyleVariation && !options.variationStyles) { 19783 return; 19784 } 19785 const responsiveNodes = getResponsiveStyleNodes(node); 19786 [ 19787 node, 19788 ...responsiveNodes, 19789 ...getPseudoStyleNodes(node), 19790 ...responsiveNodes.flatMap(getPseudoStyleNodes) 19791 ].forEach((expandedNode) => { 19792 ruleset += renderStylesNode(expandedNode, { 19793 tree, 19794 useRootPaddingAlign, 19795 disableLayoutStyles, 19796 hasBlockGapSupport, 19797 hasFallbackGapSupport, 19798 disableRootPadding 19799 }); 19800 }); 19801 }); 19802 } 19803 if (options.layoutStyles) { 19804 ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }"; 19805 ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }"; 19806 ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"; 19807 } 19808 if (options.blockGap && hasBlockGapSupport) { 19809 const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || "0.5em"; 19810 ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: $gapValue}; margin-block-end: 0; }`; 19811 ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }"; 19812 ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"; 19813 } 19814 if (options.presets) { 19815 nodesWithSettings.forEach(({ selector: selector2, presets }) => { 19816 if (ROOT_BLOCK_SELECTOR === selector2 || ROOT_CSS_PROPERTIES_SELECTOR === selector2) { 19817 selector2 = ""; 19818 } 19819 const classes = getPresetsClasses(selector2, presets); 19820 if (classes.length > 0) { 19821 ruleset += classes; 19822 } 19823 }); 19824 } 19825 return ruleset; 19826 }; 19827 function generateSvgFilters(tree, blockSelectors) { 19828 const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); 19829 return nodesWithSettings.flatMap(({ presets }) => { 19830 return getPresetsSvgFilters(presets); 19831 }); 19832 } 19833 var getSelectorsConfig = (blockType, rootSelector) => { 19834 if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) { 19835 return blockType.selectors; 19836 } 19837 const config2 = { 19838 root: rootSelector 19839 }; 19840 Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach( 19841 ([featureKey, featureName]) => { 19842 const featureSelector = getBlockSelector(blockType, featureKey); 19843 if (featureSelector) { 19844 config2[featureName] = featureSelector; 19845 } 19846 } 19847 ); 19848 return config2; 19849 }; 19850 var getBlockSelectors = (blockTypes, variationInstanceId) => { 19851 const { getBlockStyles } = (0, import_data17.select)(import_blocks3.store); 19852 const result = {}; 19853 blockTypes.forEach((blockType) => { 19854 const name2 = blockType.name; 19855 const selector2 = getBlockSelector(blockType); 19856 if (!selector2) { 19857 return; 19858 } 19859 let duotoneSelector = getBlockSelector(blockType, "filter.duotone"); 19860 if (!duotoneSelector) { 19861 const rootSelector = getBlockSelector(blockType); 19862 const duotoneSupport = (0, import_blocks3.getBlockSupport)( 19863 blockType, 19864 "color.__experimentalDuotone", 19865 false 19866 ); 19867 if (typeof duotoneSupport === "string" && rootSelector) { 19868 duotoneSelector = scopeSelector(rootSelector, duotoneSupport); 19869 } 19870 } 19871 const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout; 19872 const fallbackGapValue = ( 19873 // @ts-expect-error 19874 blockType?.supports?.spacing?.blockGap?.__experimentalDefault 19875 ); 19876 const blockStyleVariations = getBlockStyles(name2); 19877 const styleVariationSelectors = {}; 19878 blockStyleVariations?.forEach((variation) => { 19879 const variationSuffix = variationInstanceId ? `-$variationInstanceId}` : ""; 19880 const variationName = `$variation.name}$variationSuffix}`; 19881 const styleVariationSelector = getBlockStyleVariationSelector( 19882 variationName, 19883 selector2 19884 ); 19885 styleVariationSelectors[variationName] = styleVariationSelector; 19886 }); 19887 const featureSelectors = getSelectorsConfig(blockType, selector2); 19888 result[name2] = { 19889 duotoneSelector: duotoneSelector ?? void 0, 19890 fallbackGapValue, 19891 featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0, 19892 hasLayoutSupport, 19893 name: name2, 19894 selector: selector2, 19895 styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0 19896 }; 19897 }); 19898 return result; 19899 }; 19900 function updateConfigWithSeparator(config2) { 19901 const blocks = config2.styles?.blocks; 19902 const separatorBlock = blocks?.["core/separator"]; 19903 const needsSeparatorStyleUpdate = separatorBlock && separatorBlock.color?.background && !separatorBlock.color?.text && !separatorBlock.border?.color; 19904 if (needsSeparatorStyleUpdate) { 19905 return { 19906 ...config2, 19907 styles: { 19908 ...config2.styles, 19909 blocks: { 19910 ...blocks, 19911 "core/separator": { 19912 ...separatorBlock, 19913 color: { 19914 ...separatorBlock.color, 19915 text: separatorBlock.color?.background 19916 } 19917 } 19918 } 19919 } 19920 }; 19921 } 19922 return config2; 19923 } 19924 function processCSSNesting(css, blockSelector) { 19925 let processedCSS = ""; 19926 if (!css || css.trim() === "") { 19927 return processedCSS; 19928 } 19929 const parts = css.split("&"); 19930 parts.forEach((part) => { 19931 if (!part || part.trim() === "") { 19932 return; 19933 } 19934 const isRootCss = !part.includes("{"); 19935 if (isRootCss) { 19936 processedCSS += `:root :where($blockSelector}){$part.trim()}}`; 19937 } else { 19938 const splitPart = part.replace("}", "").split("{"); 19939 if (splitPart.length !== 2) { 19940 return; 19941 } 19942 const [nestedSelector, cssValue] = splitPart; 19943 const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/); 19944 const pseudoPart = matches ? matches[1] : ""; 19945 const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim(); 19946 let combinedSelector; 19947 if (withoutPseudoElement === "") { 19948 combinedSelector = blockSelector; 19949 } else { 19950 combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement); 19951 } 19952 processedCSS += `:root :where($combinedSelector})$pseudoPart}{$cssValue.trim()}}`; 19953 } 19954 }); 19955 return processedCSS; 19956 } 19957 function generateGlobalStyles(config2 = {}, blockTypes = [], options = {}) { 19958 const { 19959 hasBlockGapSupport: hasBlockGapSupportOption, 19960 hasFallbackGapSupport: hasFallbackGapSupportOption, 19961 disableLayoutStyles = false, 19962 disableRootPadding = false, 19963 styleOptions = {} 19964 } = options; 19965 const blocks = blockTypes.length > 0 ? blockTypes : (0, import_blocks3.getBlockTypes)(); 19966 const blockGap = getSetting(config2, "spacing.blockGap"); 19967 const hasBlockGapSupport = hasBlockGapSupportOption ?? blockGap !== null; 19968 const hasFallbackGapSupport = hasFallbackGapSupportOption ?? !hasBlockGapSupport; 19969 if (!config2?.styles || !config2?.settings) { 19970 return [[], {}]; 19971 } 19972 const updatedConfig = updateConfigWithSeparator(config2); 19973 const blockSelectors = getBlockSelectors(blocks); 19974 const customProperties = generateCustomProperties( 19975 updatedConfig, 19976 blockSelectors 19977 ); 19978 const globalStyles = transformToStyles( 19979 updatedConfig, 19980 blockSelectors, 19981 hasBlockGapSupport, 19982 hasFallbackGapSupport, 19983 disableLayoutStyles, 19984 disableRootPadding, 19985 styleOptions 19986 ); 19987 const svgs = generateSvgFilters(updatedConfig, blockSelectors); 19988 const styles = [ 19989 { 19990 css: customProperties, 19991 isGlobalStyles: true 19992 }, 19993 { 19994 css: globalStyles, 19995 isGlobalStyles: true 19996 }, 19997 // 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. 19998 { 19999 css: updatedConfig?.styles?.css ?? "", 20000 isGlobalStyles: true 20001 }, 20002 { 20003 assets: svgs, 20004 __unstableType: "svgs", 20005 isGlobalStyles: true 20006 } 20007 ]; 20008 blocks.forEach((blockType) => { 20009 const blockStyles = updatedConfig?.styles?.blocks?.[blockType.name]; 20010 if (blockStyles?.css) { 20011 const { featureSelectors } = blockSelectors[blockType.name]; 20012 const cssFeatureSelector = typeof featureSelectors === "object" ? featureSelectors?.css : void 0; 20013 let resolvedCssSelector; 20014 if (typeof cssFeatureSelector === "string") { 20015 resolvedCssSelector = cssFeatureSelector; 20016 } else if (typeof cssFeatureSelector === "object") { 20017 resolvedCssSelector = cssFeatureSelector?.root; 20018 } 20019 const selector2 = resolvedCssSelector ?? blockSelectors[blockType.name].selector; 20020 styles.push({ 20021 css: processCSSNesting(blockStyles.css, selector2), 20022 isGlobalStyles: true 20023 }); 20024 } 20025 }); 20026 return [styles, updatedConfig.settings]; 20027 } 20028 20029 // packages/global-styles-ui/build-module/provider.mjs 20030 var import_element48 = __toESM(require_element(), 1); 20031 20032 // packages/global-styles-ui/build-module/context.mjs 20033 var import_element47 = __toESM(require_element(), 1); 20034 var GlobalStylesContext = (0, import_element47.createContext)({ 20035 user: { styles: {}, settings: {} }, 20036 base: { styles: {}, settings: {} }, 20037 merged: { styles: {}, settings: {} }, 20038 onChange: () => { 20039 }, 20040 fontLibraryEnabled: false 20041 }); 20042 20043 // packages/global-styles-ui/build-module/provider.mjs 20044 var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1); 20045 function GlobalStylesProvider({ 20046 children, 20047 value, 20048 baseValue, 20049 onChange, 20050 fontLibraryEnabled 20051 }) { 20052 const merged = (0, import_element48.useMemo)(() => { 20053 return mergeGlobalStyles(baseValue, value); 20054 }, [baseValue, value]); 20055 const contextValue = (0, import_element48.useMemo)( 20056 () => ({ 20057 user: value, 20058 base: baseValue, 20059 merged, 20060 onChange, 20061 fontLibraryEnabled 20062 }), 20063 [value, baseValue, merged, onChange, fontLibraryEnabled] 20064 ); 20065 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(GlobalStylesContext.Provider, { value: contextValue, children }); 20066 } 20067 20068 // packages/global-styles-ui/build-module/screen-root.mjs 20069 var import_components18 = __toESM(require_components(), 1); 20070 var import_i18n16 = __toESM(require_i18n(), 1); 20071 var import_data19 = __toESM(require_data(), 1); 20072 var import_core_data15 = __toESM(require_core_data(), 1); 20073 20074 // packages/global-styles-ui/build-module/icon-with-current-color.mjs 20075 var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1); 20076 function IconWithCurrentColor({ 20077 className, 20078 ...props 20079 }) { 20080 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)( 20081 icon_default, 20082 { 20083 className: clsx_default( 20084 className, 20085 "global-styles-ui-icon-with-current-color" 20086 ), 20087 ...props 20088 } 20089 ); 20090 } 20091 20092 // packages/global-styles-ui/build-module/navigation-button.mjs 20093 var import_components12 = __toESM(require_components(), 1); 20094 var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1); 20095 function GenericNavigationButton({ 20096 icon, 20097 children, 20098 ...props 20099 }) { 20100 return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_components12.__experimentalItem, { ...props, children: [ 20101 icon && /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_components12.__experimentalHStack, { justify: "flex-start", children: [ 20102 /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(IconWithCurrentColor, { icon, size: 24 }), 20103 /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_components12.FlexItem, { children }) 20104 ] }), 20105 !icon && children 20106 ] }); 20107 } 20108 function NavigationButtonAsItem(props) { 20109 return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_components12.Navigator.Button, { as: GenericNavigationButton, ...props }); 20110 } 20111 20112 // packages/global-styles-ui/build-module/root-menu.mjs 20113 var import_components13 = __toESM(require_components(), 1); 20114 var import_i18n14 = __toESM(require_i18n(), 1); 20115 var import_block_editor4 = __toESM(require_block_editor(), 1); 20116 20117 // node_modules/colord/plugins/a11y.mjs 20118 var o2 = function(o3) { 20119 var t3 = o3 / 255; 20120 return t3 < 0.04045 ? t3 / 12.92 : Math.pow((t3 + 0.055) / 1.055, 2.4); 20121 }; 20122 var t2 = function(t3) { 20123 return 0.2126 * o2(t3.r) + 0.7152 * o2(t3.g) + 0.0722 * o2(t3.b); 20124 }; 20125 function a11y_default(o3) { 20126 o3.prototype.luminance = function() { 20127 return o4 = t2(this.rgba), void 0 === (r3 = 2) && (r3 = 0), void 0 === n2 && (n2 = Math.pow(10, r3)), Math.round(n2 * o4) / n2 + 0; 20128 var o4, r3, n2; 20129 }, o3.prototype.contrast = function(r3) { 20130 void 0 === r3 && (r3 = "#FFF"); 20131 var n2, a2, i2, e2, v2, u2, d2, c6 = r3 instanceof o3 ? r3 : new o3(r3); 20132 return e2 = this.rgba, v2 = c6.toRgb(), u2 = t2(e2), d2 = t2(v2), n2 = u2 > d2 ? (u2 + 0.05) / (d2 + 0.05) : (d2 + 0.05) / (u2 + 0.05), void 0 === (a2 = 2) && (a2 = 0), void 0 === i2 && (i2 = Math.pow(10, a2)), Math.floor(i2 * n2) / i2 + 0; 20133 }, o3.prototype.isReadable = function(o4, t3) { 20134 return void 0 === o4 && (o4 = "#FFF"), void 0 === t3 && (t3 = {}), this.contrast(o4) >= (e2 = void 0 === (i2 = (r3 = t3).size) ? "normal" : i2, "AAA" === (a2 = void 0 === (n2 = r3.level) ? "AA" : n2) && "normal" === e2 ? 7 : "AA" === a2 && "large" === e2 ? 3 : 4.5); 20135 var r3, n2, a2, i2, e2; 20136 }; 20137 } 20138 20139 // packages/global-styles-ui/build-module/hooks.mjs 20140 var import_element49 = __toESM(require_element(), 1); 20141 var import_data18 = __toESM(require_data(), 1); 20142 var import_core_data14 = __toESM(require_core_data(), 1); 20143 var import_i18n13 = __toESM(require_i18n(), 1); 20144 20145 // packages/global-styles-ui/build-module/utils.mjs 20146 var import_i18n12 = __toESM(require_i18n(), 1); 20147 var VALID_ELEMENT_STATES = { 20148 link: [ 20149 { value: ":link", label: (0, import_i18n12.__)("Link") }, 20150 { value: ":any-link", label: (0, import_i18n12.__)("Any Link") }, 20151 { value: ":visited", label: (0, import_i18n12.__)("Visited") }, 20152 { value: ":hover", label: (0, import_i18n12.__)("Hover") }, 20153 { value: ":focus", label: (0, import_i18n12.__)("Focus") }, 20154 { value: ":focus-visible", label: (0, import_i18n12.__)("Focus-visible") }, 20155 { value: ":active", label: (0, import_i18n12.__)("Active") } 20156 ], 20157 button: [ 20158 { value: ":link", label: (0, import_i18n12.__)("Link") }, 20159 { value: ":any-link", label: (0, import_i18n12.__)("Any Link") }, 20160 { value: ":visited", label: (0, import_i18n12.__)("Visited") }, 20161 { value: ":hover", label: (0, import_i18n12.__)("Hover") }, 20162 { value: ":focus", label: (0, import_i18n12.__)("Focus") }, 20163 { value: ":focus-visible", label: (0, import_i18n12.__)("Focus-visible") }, 20164 { value: ":active", label: (0, import_i18n12.__)("Active") } 20165 ] 20166 }; 20167 var VALID_BLOCK_STATES = { 20168 "core/button": [ 20169 { value: ":hover", label: (0, import_i18n12.__)("Hover") }, 20170 { value: ":focus", label: (0, import_i18n12.__)("Focus") }, 20171 { value: ":focus-visible", label: (0, import_i18n12.__)("Focus-visible") }, 20172 { value: ":active", label: (0, import_i18n12.__)("Active") } 20173 ] 20174 }; 20175 var RESPONSIVE_STATES = [ 20176 { value: "tablet", label: (0, import_i18n12.__)("Tablet") }, 20177 { value: "mobile", label: (0, import_i18n12.__)("Mobile") } 20178 ]; 20179 function removePropertiesFromObject(object, properties) { 20180 if (!properties?.length) { 20181 return object; 20182 } 20183 if (typeof object !== "object" || !object || !Object.keys(object).length) { 20184 return object; 20185 } 20186 for (const key in object) { 20187 if (properties.includes(key)) { 20188 delete object[key]; 20189 } else if (typeof object[key] === "object") { 20190 removePropertiesFromObject(object[key], properties); 20191 } 20192 } 20193 return object; 20194 } 20195 var filterObjectByProperties = (object, properties) => { 20196 if (!object || !properties?.length) { 20197 return {}; 20198 } 20199 const newObject = {}; 20200 Object.keys(object).forEach((key) => { 20201 if (properties.includes(key)) { 20202 newObject[key] = object[key]; 20203 } else if (typeof object[key] === "object") { 20204 const newFilter = filterObjectByProperties( 20205 object[key], 20206 properties 20207 ); 20208 if (Object.keys(newFilter).length) { 20209 newObject[key] = newFilter; 20210 } 20211 } 20212 }); 20213 return newObject; 20214 }; 20215 function isVariationWithProperties(variation, properties) { 20216 const variationWithProperties = filterObjectByProperties( 20217 structuredClone(variation), 20218 properties 20219 ); 20220 return areGlobalStylesEqual(variationWithProperties, variation); 20221 } 20222 function getFontFamilyFromSetting(fontFamilies, setting) { 20223 if (!Array.isArray(fontFamilies) || !setting) { 20224 return null; 20225 } 20226 const fontFamilyVariable = setting.replace("var(", "").replace(")", ""); 20227 const fontFamilySlug = fontFamilyVariable?.split("--").slice(-1)[0]; 20228 return fontFamilies.find( 20229 (fontFamily) => fontFamily.slug === fontFamilySlug 20230 ); 20231 } 20232 function getFontFamilies(themeJson) { 20233 const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; 20234 const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom; 20235 let fontFamilies = []; 20236 if (themeFontFamilies && customFontFamilies) { 20237 fontFamilies = [...themeFontFamilies, ...customFontFamilies]; 20238 } else if (themeFontFamilies) { 20239 fontFamilies = themeFontFamilies; 20240 } else if (customFontFamilies) { 20241 fontFamilies = customFontFamilies; 20242 } 20243 const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily; 20244 const bodyFontFamily = getFontFamilyFromSetting( 20245 fontFamilies, 20246 bodyFontFamilySetting 20247 ); 20248 const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily; 20249 let headingFontFamily; 20250 if (!headingFontFamilySetting) { 20251 headingFontFamily = bodyFontFamily; 20252 } else { 20253 headingFontFamily = getFontFamilyFromSetting( 20254 fontFamilies, 20255 themeJson?.styles?.elements?.heading?.typography?.fontFamily 20256 ); 20257 } 20258 return [bodyFontFamily, headingFontFamily]; 20259 } 20260 20261 // packages/global-styles-ui/build-module/hooks.mjs 20262 k([a11y_default]); 20263 function useStyle2(path, blockName, readFrom = "merged", shouldDecodeEncode = true, state) { 20264 const { user, base, merged, onChange } = (0, import_element49.useContext)(GlobalStylesContext); 20265 const statePathParts = state?.split(".").filter(Boolean) ?? []; 20266 const pseudoSelectorState = statePathParts.find( 20267 (value) => value.startsWith(":") 20268 ); 20269 const statePathWithoutPseudo = statePathParts.filter((value) => !value.startsWith(":")).join("."); 20270 const stylePath = [path, statePathWithoutPseudo].filter(Boolean).join("."); 20271 let sourceValue = merged; 20272 if (readFrom === "base") { 20273 sourceValue = base; 20274 } else if (readFrom === "user") { 20275 sourceValue = user; 20276 } 20277 const styleValue = (0, import_element49.useMemo)(() => { 20278 const rawValue = getStyle( 20279 sourceValue, 20280 stylePath, 20281 blockName, 20282 shouldDecodeEncode 20283 ); 20284 if (pseudoSelectorState) { 20285 return rawValue?.[pseudoSelectorState] ?? {}; 20286 } 20287 return rawValue; 20288 }, [ 20289 sourceValue, 20290 stylePath, 20291 blockName, 20292 shouldDecodeEncode, 20293 pseudoSelectorState 20294 ]); 20295 const setStyleValue = (0, import_element49.useCallback)( 20296 (newValue) => { 20297 let valueToSet = newValue; 20298 if (pseudoSelectorState) { 20299 const fullCurrentValue = getStyle( 20300 user, 20301 stylePath, 20302 blockName, 20303 false 20304 ); 20305 valueToSet = { 20306 ...fullCurrentValue, 20307 [pseudoSelectorState]: newValue 20308 }; 20309 } 20310 const newGlobalStyles = setStyle( 20311 user, 20312 stylePath, 20313 valueToSet, 20314 blockName 20315 ); 20316 onChange(newGlobalStyles); 20317 }, 20318 [user, onChange, stylePath, blockName, pseudoSelectorState] 20319 ); 20320 return [styleValue, setStyleValue]; 20321 } 20322 function useSetting(path, blockName, readFrom = "merged") { 20323 const { user, base, merged, onChange } = (0, import_element49.useContext)(GlobalStylesContext); 20324 let sourceValue = merged; 20325 if (readFrom === "base") { 20326 sourceValue = base; 20327 } else if (readFrom === "user") { 20328 sourceValue = user; 20329 } 20330 const settingValue = (0, import_element49.useMemo)( 20331 () => getSetting(sourceValue, path, blockName), 20332 [sourceValue, path, blockName] 20333 ); 20334 const setSettingValue = (0, import_element49.useCallback)( 20335 (newValue) => { 20336 const newGlobalStyles = setSetting( 20337 user, 20338 path, 20339 newValue, 20340 blockName 20341 ); 20342 onChange(newGlobalStyles); 20343 }, 20344 [user, onChange, path, blockName] 20345 ); 20346 return [settingValue, setSettingValue]; 20347 } 20348 var EMPTY_ARRAY3 = []; 20349 function hasThemeVariation({ 20350 title, 20351 settings: settings2, 20352 styles 20353 }) { 20354 return title === (0, import_i18n13.__)("Default") || Object.keys(settings2 || {}).length > 0 || Object.keys(styles || {}).length > 0; 20355 } 20356 function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) { 20357 const { variationsFromTheme } = (0, import_data18.useSelect)((select4) => { 20358 const _variationsFromTheme = select4( 20359 import_core_data14.store 20360 ).__experimentalGetCurrentThemeGlobalStylesVariations?.(); 20361 return { 20362 variationsFromTheme: _variationsFromTheme || EMPTY_ARRAY3 20363 }; 20364 }, []); 20365 const { user: userVariation } = (0, import_element49.useContext)(GlobalStylesContext); 20366 return (0, import_element49.useMemo)(() => { 20367 const clonedUserVariation = structuredClone(userVariation); 20368 const userVariationWithoutProperties = removePropertiesFromObject( 20369 clonedUserVariation, 20370 properties 20371 ); 20372 userVariationWithoutProperties.title = (0, import_i18n13.__)("Default"); 20373 const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => { 20374 return isVariationWithProperties(variation, properties); 20375 }).map((variation) => { 20376 return mergeGlobalStyles( 20377 userVariationWithoutProperties, 20378 variation 20379 ); 20380 }); 20381 const variationsByProperties = [ 20382 userVariationWithoutProperties, 20383 ...variationsWithPropertiesAndBase 20384 ]; 20385 return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : []; 20386 }, [properties, userVariation, variationsFromTheme]); 20387 } 20388 20389 // packages/global-styles-ui/build-module/lock-unlock.mjs 20390 var import_private_apis3 = __toESM(require_private_apis(), 1); 20391 var { lock: lock3, unlock: unlock3 } = (0, import_private_apis3.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 20392 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 20393 "@wordpress/global-styles-ui" 20394 ); 20395 20396 // packages/global-styles-ui/build-module/root-menu.mjs 20397 var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1); 20398 var { 20399 useHasDimensionsPanel, 20400 useHasTypographyPanel, 20401 useHasColorPanel, 20402 useSettingsForBlockElement, 20403 useHasBackgroundPanel 20404 } = unlock3(import_block_editor4.privateApis); 20405 20406 // packages/global-styles-ui/build-module/preview-styles.mjs 20407 var import_components17 = __toESM(require_components(), 1); 20408 20409 // packages/global-styles-ui/build-module/preview-hooks.mjs 20410 function useStylesPreviewColors() { 20411 const [textColor = "black"] = useStyle2("color.text"); 20412 const [backgroundColor = "white"] = useStyle2("color.background"); 20413 const [headingColor = textColor] = useStyle2( 20414 "elements.h1.color.text" 20415 ); 20416 const [linkColor = headingColor] = useStyle2( 20417 "elements.link.color.text" 20418 ); 20419 const [buttonBackgroundColor = linkColor] = useStyle2( 20420 "elements.button.color.background" 20421 ); 20422 const [coreColors] = useSetting("color.palette.core") || []; 20423 const [themeColors] = useSetting("color.palette.theme") || []; 20424 const [customColors] = useSetting("color.palette.custom") || []; 20425 const paletteColors = (themeColors ?? []).concat(customColors ?? []).concat(coreColors ?? []); 20426 const textColorObject = paletteColors.filter( 20427 ({ color }) => color === textColor 20428 ); 20429 const buttonBackgroundColorObject = paletteColors.filter( 20430 ({ color }) => color === buttonBackgroundColor 20431 ); 20432 const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter( 20433 // we exclude these background color because it is already visible in the preview. 20434 ({ color }) => color !== backgroundColor 20435 ).slice(0, 2); 20436 return { 20437 paletteColors, 20438 highlightedColors 20439 }; 20440 } 20441 20442 // packages/global-styles-ui/build-module/typography-example.mjs 20443 var import_element50 = __toESM(require_element(), 1); 20444 var import_components14 = __toESM(require_components(), 1); 20445 var import_i18n15 = __toESM(require_i18n(), 1); 20446 20447 // packages/global-styles-ui/build-module/font-library/utils/preview-styles.mjs 20448 function findNearest(input, numbers) { 20449 if (numbers.length === 0) { 20450 return null; 20451 } 20452 numbers.sort((a2, b2) => Math.abs(input - a2) - Math.abs(input - b2)); 20453 return numbers[0]; 20454 } 20455 function extractFontWeights(fontFaces) { 20456 const result = []; 20457 fontFaces.forEach((face) => { 20458 const weights = String(face.fontWeight).split(" "); 20459 if (weights.length === 2) { 20460 const start2 = parseInt(weights[0]); 20461 const end = parseInt(weights[1]); 20462 for (let i2 = start2; i2 <= end; i2 += 100) { 20463 result.push(i2); 20464 } 20465 } else if (weights.length === 1) { 20466 result.push(parseInt(weights[0])); 20467 } 20468 }); 20469 return result; 20470 } 20471 function formatFontFamily(input) { 20472 const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/; 20473 const output = input.trim(); 20474 const formatItem = (item) => { 20475 item = item.trim(); 20476 if (item.match(regex)) { 20477 item = item.replace(/^["']|["']$/g, ""); 20478 return `"$item}"`; 20479 } 20480 return item; 20481 }; 20482 if (output.includes(",")) { 20483 return output.split(",").map(formatItem).filter((item) => item !== "").join(", "); 20484 } 20485 return formatItem(output); 20486 } 20487 function getFamilyPreviewStyle(family) { 20488 const style = { 20489 fontFamily: formatFontFamily(family.fontFamily) 20490 }; 20491 if (!("fontFace" in family) || !Array.isArray(family.fontFace)) { 20492 style.fontWeight = "400"; 20493 style.fontStyle = "normal"; 20494 return style; 20495 } 20496 if (family.fontFace) { 20497 const normalFaces = family.fontFace.filter( 20498 (face) => face?.fontStyle && face.fontStyle.toLowerCase() === "normal" 20499 ); 20500 if (normalFaces.length > 0) { 20501 style.fontStyle = "normal"; 20502 const normalWeights = extractFontWeights(normalFaces); 20503 const nearestWeight = findNearest(400, normalWeights); 20504 style.fontWeight = String(nearestWeight) || "400"; 20505 } else { 20506 style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || "normal"; 20507 style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || "400"; 20508 } 20509 } 20510 return style; 20511 } 20512 20513 // packages/global-styles-ui/build-module/typography-example.mjs 20514 var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1); 20515 function PreviewTypography({ 20516 fontSize, 20517 variation 20518 }) { 20519 const { base } = (0, import_element50.useContext)(GlobalStylesContext); 20520 let config2 = base; 20521 if (variation) { 20522 config2 = { ...base, ...variation }; 20523 } 20524 const [textColor] = useStyle2("color.text"); 20525 const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config2); 20526 const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {}; 20527 const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {}; 20528 if (textColor) { 20529 bodyPreviewStyle.color = textColor; 20530 headingPreviewStyle.color = textColor; 20531 } 20532 if (fontSize) { 20533 bodyPreviewStyle.fontSize = fontSize; 20534 headingPreviewStyle.fontSize = fontSize; 20535 } 20536 return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)( 20537 import_components14.__unstableMotion.div, 20538 { 20539 animate: { 20540 scale: 1, 20541 opacity: 1 20542 }, 20543 initial: { 20544 scale: 0.1, 20545 opacity: 0 20546 }, 20547 transition: { 20548 delay: 0.3, 20549 type: "tween" 20550 }, 20551 style: { 20552 textAlign: "center", 20553 lineHeight: 1 20554 }, 20555 children: [ 20556 /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { style: headingPreviewStyle, children: (0, import_i18n15._x)("A", "Uppercase letter A") }), 20557 /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { style: bodyPreviewStyle, children: (0, import_i18n15._x)("a", "Lowercase letter A") }) 20558 ] 20559 } 20560 ); 20561 } 20562 20563 // packages/global-styles-ui/build-module/highlighted-colors.mjs 20564 var import_components15 = __toESM(require_components(), 1); 20565 var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1); 20566 function HighlightedColors({ 20567 normalizedColorSwatchSize, 20568 ratio 20569 }) { 20570 const { highlightedColors } = useStylesPreviewColors(); 20571 const scaledSwatchSize = normalizedColorSwatchSize * ratio; 20572 return highlightedColors.map(({ slug, color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)( 20573 import_components15.__unstableMotion.div, 20574 { 20575 style: { 20576 height: scaledSwatchSize, 20577 width: scaledSwatchSize, 20578 background: color, 20579 borderRadius: scaledSwatchSize / 2 20580 }, 20581 animate: { 20582 scale: 1, 20583 opacity: 1 20584 }, 20585 initial: { 20586 scale: 0.1, 20587 opacity: 0 20588 }, 20589 transition: { 20590 delay: index2 === 1 ? 0.2 : 0.1 20591 } 20592 }, 20593 `$slug}-$index2}` 20594 )); 20595 } 20596 20597 // packages/global-styles-ui/build-module/preview-wrapper.mjs 20598 var import_components16 = __toESM(require_components(), 1); 20599 var import_compose3 = __toESM(require_compose(), 1); 20600 var import_element51 = __toESM(require_element(), 1); 20601 var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1); 20602 var normalizedWidth = 248; 20603 var normalizedHeight = 152; 20604 var THROTTLE_OPTIONS = { 20605 leading: true, 20606 trailing: true 20607 }; 20608 function PreviewWrapper({ 20609 children, 20610 label, 20611 isFocused, 20612 withHoverView 20613 }) { 20614 const [backgroundColor = "white"] = useStyle2("color.background"); 20615 const [gradientValue] = useStyle2("color.gradient"); 20616 const disableMotion = (0, import_compose3.useReducedMotion)(); 20617 const [isHovered, setIsHovered] = (0, import_element51.useState)(false); 20618 const [containerResizeListener, { width }] = (0, import_compose3.useResizeObserver)(); 20619 const [throttledWidth, setThrottledWidthState] = (0, import_element51.useState)(width); 20620 const [ratioState, setRatioState] = (0, import_element51.useState)(); 20621 const setThrottledWidth = (0, import_compose3.useThrottle)( 20622 setThrottledWidthState, 20623 250, 20624 THROTTLE_OPTIONS 20625 ); 20626 (0, import_element51.useLayoutEffect)(() => { 20627 if (width) { 20628 setThrottledWidth(width); 20629 } 20630 }, [width, setThrottledWidth]); 20631 (0, import_element51.useLayoutEffect)(() => { 20632 const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1; 20633 const ratioDiff = newRatio - (ratioState || 0); 20634 const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1; 20635 if (isRatioDiffBigEnough || !ratioState) { 20636 setRatioState(newRatio); 20637 } 20638 }, [throttledWidth, ratioState]); 20639 const fallbackRatio = width ? width / normalizedWidth : 1; 20640 const ratio = ratioState ? ratioState : fallbackRatio; 20641 const isReady = !!width; 20642 return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(import_jsx_runtime118.Fragment, { children: [ 20643 /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { style: { position: "relative" }, children: containerResizeListener }), 20644 isReady && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 20645 "div", 20646 { 20647 className: clsx_default("global-styles-ui-preview__wrapper", { 20648 "is-hoverable": withHoverView 20649 }), 20650 style: { 20651 height: normalizedHeight * ratio 20652 }, 20653 onMouseEnter: () => setIsHovered(true), 20654 onMouseLeave: () => setIsHovered(false), 20655 tabIndex: -1, 20656 children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 20657 import_components16.__unstableMotion.div, 20658 { 20659 style: { 20660 height: normalizedHeight * ratio, 20661 width: "100%", 20662 background: gradientValue ?? backgroundColor 20663 }, 20664 initial: "start", 20665 animate: (isHovered || isFocused) && !disableMotion && label ? "hover" : "start", 20666 children: [].concat(children).map( 20667 (child, key) => child({ ratio, key }) 20668 ) 20669 } 20670 ) 20671 } 20672 ) 20673 ] }); 20674 } 20675 var preview_wrapper_default = PreviewWrapper; 20676 20677 // packages/global-styles-ui/build-module/preview-styles.mjs 20678 var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1); 20679 var firstFrameVariants = { 20680 start: { 20681 scale: 1, 20682 opacity: 1 20683 }, 20684 hover: { 20685 scale: 0, 20686 opacity: 0 20687 } 20688 }; 20689 var midFrameVariants = { 20690 hover: { 20691 opacity: 1 20692 }, 20693 start: { 20694 opacity: 0.5 20695 } 20696 }; 20697 var secondFrameVariants = { 20698 hover: { 20699 scale: 1, 20700 opacity: 1 20701 }, 20702 start: { 20703 scale: 0, 20704 opacity: 0 20705 } 20706 }; 20707 function PreviewStyles({ 20708 label, 20709 isFocused, 20710 withHoverView, 20711 variation 20712 }) { 20713 const [fontWeight] = useStyle2("typography.fontWeight"); 20714 const [fontFamily = "serif"] = useStyle2( 20715 "typography.fontFamily" 20716 ); 20717 const [headingFontFamily = fontFamily] = useStyle2( 20718 "elements.h1.typography.fontFamily" 20719 ); 20720 const [headingFontWeight = fontWeight] = useStyle2( 20721 "elements.h1.typography.fontWeight" 20722 ); 20723 const [textColor = "black"] = useStyle2("color.text"); 20724 const [headingColor = textColor] = useStyle2( 20725 "elements.h1.color.text" 20726 ); 20727 const { paletteColors } = useStylesPreviewColors(); 20728 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)( 20729 preview_wrapper_default, 20730 { 20731 label, 20732 isFocused, 20733 withHoverView, 20734 children: [ 20735 ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20736 import_components17.__unstableMotion.div, 20737 { 20738 variants: firstFrameVariants, 20739 style: { 20740 height: "100%", 20741 overflow: "hidden" 20742 }, 20743 children: /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)( 20744 import_components17.__experimentalHStack, 20745 { 20746 spacing: 10 * ratio, 20747 justify: "center", 20748 style: { 20749 height: "100%", 20750 overflow: "hidden" 20751 }, 20752 children: [ 20753 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20754 PreviewTypography, 20755 { 20756 fontSize: 65 * ratio, 20757 variation 20758 } 20759 ), 20760 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_components17.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20761 HighlightedColors, 20762 { 20763 normalizedColorSwatchSize: 32, 20764 ratio 20765 } 20766 ) }) 20767 ] 20768 } 20769 ) 20770 }, 20771 key 20772 ), 20773 ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20774 import_components17.__unstableMotion.div, 20775 { 20776 variants: withHoverView ? midFrameVariants : void 0, 20777 style: { 20778 height: "100%", 20779 width: "100%", 20780 position: "absolute", 20781 top: 0, 20782 overflow: "hidden", 20783 filter: "blur(60px)", 20784 opacity: 0.1 20785 }, 20786 children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20787 import_components17.__experimentalHStack, 20788 { 20789 spacing: 0, 20790 justify: "flex-start", 20791 style: { 20792 height: "100%", 20793 overflow: "hidden" 20794 }, 20795 children: paletteColors.slice(0, 4).map(({ color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20796 "div", 20797 { 20798 style: { 20799 height: "100%", 20800 background: color, 20801 flexGrow: 1 20802 } 20803 }, 20804 index2 20805 )) 20806 } 20807 ) 20808 }, 20809 key 20810 ), 20811 ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20812 import_components17.__unstableMotion.div, 20813 { 20814 variants: secondFrameVariants, 20815 style: { 20816 height: "100%", 20817 width: "100%", 20818 overflow: "hidden", 20819 position: "absolute", 20820 top: 0 20821 }, 20822 children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20823 import_components17.__experimentalVStack, 20824 { 20825 spacing: 3 * ratio, 20826 justify: "center", 20827 style: { 20828 height: "100%", 20829 overflow: "hidden", 20830 padding: 10 * ratio, 20831 boxSizing: "border-box" 20832 }, 20833 children: label && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 20834 "div", 20835 { 20836 style: { 20837 fontSize: 40 * ratio, 20838 fontFamily: headingFontFamily, 20839 color: headingColor, 20840 fontWeight: headingFontWeight, 20841 lineHeight: "1em", 20842 textAlign: "center" 20843 }, 20844 children: label 20845 } 20846 ) 20847 } 20848 ) 20849 }, 20850 key 20851 ) 20852 ] 20853 } 20854 ); 20855 } 20856 var preview_styles_default = PreviewStyles; 20857 20858 // packages/global-styles-ui/build-module/screen-root.mjs 20859 var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1); 20860 20861 // packages/global-styles-ui/build-module/screen-block-list.mjs 20862 var import_blocks5 = __toESM(require_blocks(), 1); 20863 var import_i18n18 = __toESM(require_i18n(), 1); 20864 var import_components21 = __toESM(require_components(), 1); 20865 var import_data21 = __toESM(require_data(), 1); 20866 var import_element52 = __toESM(require_element(), 1); 20867 var import_block_editor6 = __toESM(require_block_editor(), 1); 20868 var import_compose4 = __toESM(require_compose(), 1); 20869 var import_a11y2 = __toESM(require_a11y(), 1); 20870 20871 // packages/global-styles-ui/build-module/variations/variations-panel.mjs 20872 var import_blocks4 = __toESM(require_blocks(), 1); 20873 var import_data20 = __toESM(require_data(), 1); 20874 var import_components19 = __toESM(require_components(), 1); 20875 var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1); 20876 function getFilteredBlockStyles(blockStyles, variations) { 20877 return blockStyles?.filter( 20878 (style) => style.source === "block" || variations.includes(style.name) 20879 ) || []; 20880 } 20881 function useBlockVariations(name2) { 20882 const blockStyles = (0, import_data20.useSelect)( 20883 (select4) => { 20884 const { getBlockStyles } = select4(import_blocks4.store); 20885 return getBlockStyles(name2); 20886 }, 20887 [name2] 20888 ); 20889 const [variations] = useStyle2("variations", name2); 20890 const variationNames = Object.keys(variations ?? {}); 20891 return getFilteredBlockStyles(blockStyles, variationNames); 20892 } 20893 20894 // packages/global-styles-ui/build-module/screen-header.mjs 20895 var import_components20 = __toESM(require_components(), 1); 20896 var import_i18n17 = __toESM(require_i18n(), 1); 20897 var import_block_editor5 = __toESM(require_block_editor(), 1); 20898 var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1); 20899 var { StateControl, StateControlBadges } = unlock3(import_block_editor5.privateApis); 20900 20901 // packages/global-styles-ui/build-module/screen-block-list.mjs 20902 var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1); 20903 var { 20904 useHasDimensionsPanel: useHasDimensionsPanel2, 20905 useHasTypographyPanel: useHasTypographyPanel2, 20906 useHasBorderPanel, 20907 useSettingsForBlockElement: useSettingsForBlockElement2, 20908 useHasColorPanel: useHasColorPanel2 20909 } = unlock3(import_block_editor6.privateApis); 20910 function useSortedBlockTypes() { 20911 const blockItems = (0, import_data21.useSelect)( 20912 (select4) => select4(import_blocks5.store).getBlockTypes(), 20913 [] 20914 ); 20915 const groupByType = (blocks, block) => { 20916 const { core, noncore } = blocks; 20917 const type = block.name.startsWith("core/") ? core : noncore; 20918 type.push(block); 20919 return blocks; 20920 }; 20921 const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce( 20922 groupByType, 20923 { core: [], noncore: [] } 20924 ); 20925 return [...coreItems, ...nonCoreItems]; 20926 } 20927 function useBlockHasGlobalStyles(blockName) { 20928 const [rawSettings] = useSetting("", blockName); 20929 const settings2 = useSettingsForBlockElement2(rawSettings, blockName); 20930 const hasTypographyPanel = useHasTypographyPanel2(settings2); 20931 const hasColorPanel = useHasColorPanel2(settings2); 20932 const hasBorderPanel = useHasBorderPanel(settings2); 20933 const hasDimensionsPanel = useHasDimensionsPanel2(settings2); 20934 const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel; 20935 const hasVariationsPanel = !!useBlockVariations(blockName)?.length; 20936 const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel; 20937 return hasGlobalStyles; 20938 } 20939 function BlockMenuItem({ block }) { 20940 const hasBlockMenuItem = useBlockHasGlobalStyles(block.name); 20941 if (!hasBlockMenuItem) { 20942 return null; 20943 } 20944 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 20945 NavigationButtonAsItem, 20946 { 20947 path: "/blocks/" + encodeURIComponent(block.name), 20948 children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_components21.__experimentalHStack, { justify: "flex-start", children: [ 20949 /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_block_editor6.BlockIcon, { icon: block.icon }), 20950 /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components21.FlexItem, { children: block.title }) 20951 ] }) 20952 } 20953 ); 20954 } 20955 function BlockList({ filterValue }) { 20956 const sortedBlockTypes = useSortedBlockTypes(); 20957 const debouncedSpeak = (0, import_compose4.useDebounce)(import_a11y2.speak, 500); 20958 const { isMatchingSearchTerm } = (0, import_data21.useSelect)(import_blocks5.store); 20959 const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter( 20960 (blockType) => isMatchingSearchTerm(blockType, filterValue) 20961 ); 20962 const blockTypesListRef = (0, import_element52.useRef)(null); 20963 (0, import_element52.useEffect)(() => { 20964 if (!filterValue) { 20965 return; 20966 } 20967 const count = blockTypesListRef.current?.childElementCount || 0; 20968 const resultsFoundMessage = (0, import_i18n18.sprintf)( 20969 /* translators: %d: number of results. */ 20970 (0, import_i18n18._n)("%d result found.", "%d results found.", count), 20971 count 20972 ); 20973 debouncedSpeak(resultsFoundMessage, "polite"); 20974 }, [filterValue, debouncedSpeak]); 20975 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 20976 "div", 20977 { 20978 ref: blockTypesListRef, 20979 className: "global-styles-ui-block-types-item-list", 20980 role: "list", 20981 children: filteredBlockTypes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components21.__experimentalText, { align: "center", as: "p", children: (0, import_i18n18.__)("No blocks found.") }) : filteredBlockTypes.map((block) => /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 20982 BlockMenuItem, 20983 { 20984 block 20985 }, 20986 "menu-itemblock-" + block.name 20987 )) 20988 } 20989 ); 20990 } 20991 var MemoizedBlockList = (0, import_element52.memo)(BlockList); 20992 20993 // packages/global-styles-ui/build-module/screen-block.mjs 20994 var import_blocks7 = __toESM(require_blocks(), 1); 20995 var import_block_editor8 = __toESM(require_block_editor(), 1); 20996 var import_element54 = __toESM(require_element(), 1); 20997 var import_data22 = __toESM(require_data(), 1); 20998 var import_core_data16 = __toESM(require_core_data(), 1); 20999 var import_components24 = __toESM(require_components(), 1); 21000 var import_i18n19 = __toESM(require_i18n(), 1); 21001 21002 // packages/global-styles-ui/build-module/block-preview-panel.mjs 21003 var import_block_editor7 = __toESM(require_block_editor(), 1); 21004 var import_blocks6 = __toESM(require_blocks(), 1); 21005 var import_components22 = __toESM(require_components(), 1); 21006 var import_element53 = __toESM(require_element(), 1); 21007 var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1); 21008 21009 // packages/global-styles-ui/build-module/subtitle.mjs 21010 var import_components23 = __toESM(require_components(), 1); 21011 var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1); 21012 function Subtitle({ children, level = 2 }) { 21013 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components23.__experimentalHeading, { className: "global-styles-ui-subtitle", level, children }); 21014 } 21015 21016 // packages/global-styles-ui/build-module/screen-block.mjs 21017 var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1); 21018 var { 21019 useHasDimensionsPanel: useHasDimensionsPanel3, 21020 useHasTypographyPanel: useHasTypographyPanel3, 21021 useHasBorderPanel: useHasBorderPanel2, 21022 useSettingsForBlockElement: useSettingsForBlockElement3, 21023 useHasColorPanel: useHasColorPanel3, 21024 useHasFiltersPanel, 21025 useHasImageSettingsPanel, 21026 useHasBackgroundPanel: useHasBackgroundPanel2, 21027 BackgroundPanel: StylesBackgroundPanel, 21028 BorderPanel: StylesBorderPanel, 21029 ColorPanel: StylesColorPanel, 21030 TypographyPanel: StylesTypographyPanel, 21031 DimensionsPanel: StylesDimensionsPanel, 21032 FiltersPanel: StylesFiltersPanel, 21033 ImageSettingsPanel, 21034 AdvancedPanel: StylesAdvancedPanel 21035 } = unlock3(import_block_editor8.privateApis); 21036 21037 // packages/global-styles-ui/build-module/screen-typography.mjs 21038 var import_i18n33 = __toESM(require_i18n(), 1); 21039 var import_components43 = __toESM(require_components(), 1); 21040 var import_element66 = __toESM(require_element(), 1); 21041 21042 // packages/global-styles-ui/build-module/screen-body.mjs 21043 var import_components25 = __toESM(require_components(), 1); 21044 var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1); 21045 21046 // packages/global-styles-ui/build-module/typography-elements.mjs 21047 var import_i18n20 = __toESM(require_i18n(), 1); 21048 var import_components26 = __toESM(require_components(), 1); 21049 var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1); 21050 21051 // packages/global-styles-ui/build-module/variations/variations-typography.mjs 21052 var import_components28 = __toESM(require_components(), 1); 21053 21054 // packages/global-styles-ui/build-module/preview-typography.mjs 21055 var import_components27 = __toESM(require_components(), 1); 21056 var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1); 21057 var StylesPreviewTypography = ({ 21058 variation, 21059 isFocused, 21060 withHoverView 21061 }) => { 21062 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 21063 preview_wrapper_default, 21064 { 21065 label: variation.title, 21066 isFocused, 21067 withHoverView, 21068 children: ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 21069 import_components27.__experimentalHStack, 21070 { 21071 spacing: 10 * ratio, 21072 justify: "center", 21073 style: { 21074 height: "100%", 21075 overflow: "hidden" 21076 }, 21077 children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 21078 PreviewTypography, 21079 { 21080 variation, 21081 fontSize: 85 * ratio 21082 } 21083 ) 21084 }, 21085 key 21086 ) 21087 } 21088 ); 21089 }; 21090 var preview_typography_default = StylesPreviewTypography; 21091 21092 // packages/global-styles-ui/build-module/variations/variation.mjs 21093 var import_element55 = __toESM(require_element(), 1); 21094 var import_keycodes3 = __toESM(require_keycodes(), 1); 21095 var import_i18n21 = __toESM(require_i18n(), 1); 21096 var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1); 21097 function Variation({ 21098 variation, 21099 children, 21100 isPill = false, 21101 properties, 21102 showTooltip = false 21103 }) { 21104 const [isFocused, setIsFocused] = (0, import_element55.useState)(false); 21105 const { 21106 base, 21107 user, 21108 onChange: setUserConfig 21109 } = (0, import_element55.useContext)(GlobalStylesContext); 21110 const context = (0, import_element55.useMemo)(() => { 21111 let merged = mergeGlobalStyles(base, variation); 21112 if (properties) { 21113 merged = filterObjectByProperties(merged, properties); 21114 } 21115 return { 21116 user: variation, 21117 base, 21118 merged, 21119 onChange: () => { 21120 } 21121 }; 21122 }, [variation, base, properties]); 21123 const selectVariation = () => setUserConfig(variation); 21124 const selectOnEnter = (event) => { 21125 if (event.keyCode === import_keycodes3.ENTER) { 21126 event.preventDefault(); 21127 selectVariation(); 21128 } 21129 }; 21130 const isActive = (0, import_element55.useMemo)( 21131 () => areGlobalStylesEqual(user, variation), 21132 [user, variation] 21133 ); 21134 let label = variation?.title; 21135 if (variation?.description) { 21136 label = (0, import_i18n21.sprintf)( 21137 /* translators: 1: variation title. 2: variation description. */ 21138 (0, import_i18n21._x)("%1$s (%2$s)", "variation label"), 21139 variation?.title, 21140 variation?.description 21141 ); 21142 } 21143 const content = /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 21144 "div", 21145 { 21146 className: clsx_default("global-styles-ui-variations_item", { 21147 "is-active": isActive 21148 }), 21149 role: "button", 21150 onClick: selectVariation, 21151 onKeyDown: selectOnEnter, 21152 tabIndex: 0, 21153 "aria-label": label, 21154 "aria-current": isActive, 21155 onFocus: () => setIsFocused(true), 21156 onBlur: () => setIsFocused(false), 21157 children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 21158 "div", 21159 { 21160 className: clsx_default("global-styles-ui-variations_item-preview", { 21161 "is-pill": isPill 21162 }), 21163 children: children(isFocused) 21164 } 21165 ) 21166 } 21167 ); 21168 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(GlobalStylesContext.Provider, { value: context, children: showTooltip ? /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(tooltip_exports.Root, { children: [ 21169 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(tooltip_exports.Trigger, { render: content }), 21170 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(tooltip_exports.Popup, { children: variation?.title }) 21171 ] }) : content }); 21172 } 21173 21174 // packages/global-styles-ui/build-module/variations/variations-typography.mjs 21175 var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1); 21176 var propertiesToFilter = ["typography"]; 21177 function TypographyVariations({ 21178 title, 21179 gap = 2 21180 }) { 21181 const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter); 21182 if (typographyVariations?.length <= 1) { 21183 return null; 21184 } 21185 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_components28.__experimentalVStack, { spacing: 3, children: [ 21186 title && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Subtitle, { level: 3, children: title }), 21187 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 21188 import_components28.__experimentalGrid, 21189 { 21190 columns: 3, 21191 gap, 21192 className: "global-styles-ui-style-variations-container", 21193 children: typographyVariations.map( 21194 (variation, index2) => { 21195 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 21196 Variation, 21197 { 21198 variation, 21199 properties: propertiesToFilter, 21200 showTooltip: true, 21201 children: () => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 21202 preview_typography_default, 21203 { 21204 variation 21205 } 21206 ) 21207 }, 21208 index2 21209 ); 21210 } 21211 ) 21212 } 21213 ) 21214 ] }); 21215 } 21216 21217 // packages/global-styles-ui/build-module/font-families.mjs 21218 var import_i18n31 = __toESM(require_i18n(), 1); 21219 var import_components41 = __toESM(require_components(), 1); 21220 var import_element65 = __toESM(require_element(), 1); 21221 21222 // packages/global-styles-ui/build-module/font-library/context.mjs 21223 var import_element56 = __toESM(require_element(), 1); 21224 var import_data23 = __toESM(require_data(), 1); 21225 var import_core_data18 = __toESM(require_core_data(), 1); 21226 var import_i18n23 = __toESM(require_i18n(), 1); 21227 21228 // packages/global-styles-ui/build-module/font-library/api.mjs 21229 var import_api_fetch2 = __toESM(require_api_fetch(), 1); 21230 var import_core_data17 = __toESM(require_core_data(), 1); 21231 21232 // packages/global-styles-ui/build-module/font-library/utils/index.mjs 21233 var import_components29 = __toESM(require_components(), 1); 21234 21235 // packages/global-styles-ui/build-module/font-library/utils/constants.mjs 21236 var import_i18n22 = __toESM(require_i18n(), 1); 21237 var FONT_WEIGHTS = { 21238 100: (0, import_i18n22._x)("Thin", "font weight"), 21239 200: (0, import_i18n22._x)("Extra-light", "font weight"), 21240 300: (0, import_i18n22._x)("Light", "font weight"), 21241 400: (0, import_i18n22._x)("Normal", "font weight"), 21242 500: (0, import_i18n22._x)("Medium", "font weight"), 21243 600: (0, import_i18n22._x)("Semi-bold", "font weight"), 21244 700: (0, import_i18n22._x)("Bold", "font weight"), 21245 800: (0, import_i18n22._x)("Extra-bold", "font weight"), 21246 900: (0, import_i18n22._x)("Black", "font weight") 21247 }; 21248 var FONT_STYLES = { 21249 normal: (0, import_i18n22._x)("Normal", "font style"), 21250 italic: (0, import_i18n22._x)("Italic", "font style") 21251 }; 21252 21253 // packages/global-styles-ui/build-module/font-library/utils/index.mjs 21254 var { File } = window; 21255 var { kebabCase: kebabCase2 } = unlock3(import_components29.privateApis); 21256 21257 // packages/global-styles-ui/build-module/font-library/context.mjs 21258 var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1); 21259 var FontLibraryContext = (0, import_element56.createContext)( 21260 {} 21261 ); 21262 FontLibraryContext.displayName = "FontLibraryContext"; 21263 21264 // packages/global-styles-ui/build-module/font-library/modal.mjs 21265 var import_i18n29 = __toESM(require_i18n(), 1); 21266 var import_components39 = __toESM(require_components(), 1); 21267 var import_core_data21 = __toESM(require_core_data(), 1); 21268 var import_data25 = __toESM(require_data(), 1); 21269 21270 // packages/global-styles-ui/build-module/font-library/installed-fonts.mjs 21271 var import_components33 = __toESM(require_components(), 1); 21272 var import_core_data19 = __toESM(require_core_data(), 1); 21273 var import_data24 = __toESM(require_data(), 1); 21274 var import_element60 = __toESM(require_element(), 1); 21275 var import_i18n25 = __toESM(require_i18n(), 1); 21276 21277 // packages/global-styles-ui/build-module/font-library/font-card.mjs 21278 var import_i18n24 = __toESM(require_i18n(), 1); 21279 var import_element58 = __toESM(require_element(), 1); 21280 var import_components31 = __toESM(require_components(), 1); 21281 21282 // packages/global-styles-ui/build-module/font-library/font-demo.mjs 21283 var import_components30 = __toESM(require_components(), 1); 21284 var import_element57 = __toESM(require_element(), 1); 21285 var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1); 21286 21287 // packages/global-styles-ui/build-module/font-library/font-card.mjs 21288 var import_jsx_runtime134 = __toESM(require_jsx_runtime(), 1); 21289 21290 // packages/global-styles-ui/build-module/font-library/library-font-variant.mjs 21291 var import_element59 = __toESM(require_element(), 1); 21292 var import_components32 = __toESM(require_components(), 1); 21293 var import_jsx_runtime135 = __toESM(require_jsx_runtime(), 1); 21294 21295 // packages/global-styles-ui/build-module/font-library/installed-fonts.mjs 21296 var import_jsx_runtime136 = __toESM(require_jsx_runtime(), 1); 21297 21298 // packages/global-styles-ui/build-module/font-library/font-collection.mjs 21299 var import_element62 = __toESM(require_element(), 1); 21300 var import_components36 = __toESM(require_components(), 1); 21301 var import_compose5 = __toESM(require_compose(), 1); 21302 var import_i18n27 = __toESM(require_i18n(), 1); 21303 var import_core_data20 = __toESM(require_core_data(), 1); 21304 21305 // packages/global-styles-ui/build-module/font-library/google-fonts-confirm-dialog.mjs 21306 var import_i18n26 = __toESM(require_i18n(), 1); 21307 var import_components34 = __toESM(require_components(), 1); 21308 var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1); 21309 21310 // packages/global-styles-ui/build-module/font-library/collection-font-variant.mjs 21311 var import_element61 = __toESM(require_element(), 1); 21312 var import_components35 = __toESM(require_components(), 1); 21313 var import_jsx_runtime138 = __toESM(require_jsx_runtime(), 1); 21314 21315 // packages/global-styles-ui/build-module/font-library/font-collection.mjs 21316 var import_jsx_runtime139 = __toESM(require_jsx_runtime(), 1); 21317 var DEFAULT_CATEGORY = { 21318 slug: "all", 21319 name: (0, import_i18n27._x)("All", "font categories") 21320 }; 21321 21322 // packages/global-styles-ui/build-module/font-library/upload-fonts.mjs 21323 var import_i18n28 = __toESM(require_i18n(), 1); 21324 var import_components38 = __toESM(require_components(), 1); 21325 var import_element63 = __toESM(require_element(), 1); 21326 21327 // packages/global-styles-ui/build-module/font-library/lib/unbrotli.mjs 21328 var __require2 = /* @__PURE__ */ ((x2) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x2, { 21329 get: (a2, b2) => (typeof __require !== "undefined" ? __require : a2)[b2] 21330 }) : x2)(function(x2) { 21331 if (typeof __require !== "undefined") return __require.apply(this, arguments); 21332 throw Error('Dynamic require of "' + x2 + '" is not supported'); 21333 }); 21334 var unbrotli_default = (function() { 21335 var define, module, exports; 21336 return (/* @__PURE__ */ (function() { 21337 function r3(e2, n2, t3) { 21338 function o3(i22, f2) { 21339 if (!n2[i22]) { 21340 if (!e2[i22]) { 21341 var c6 = "function" == typeof __require2 && __require2; 21342 if (!f2 && c6) return c6(i22, true); 21343 if (u2) return u2(i22, true); 21344 var a2 = new Error("Cannot find module '" + i22 + "'"); 21345 throw a2.code = "MODULE_NOT_FOUND", a2; 21346 } 21347 var p3 = n2[i22] = { exports: {} }; 21348 e2[i22][0].call( 21349 p3.exports, 21350 function(r22) { 21351 var n22 = e2[i22][1][r22]; 21352 return o3(n22 || r22); 21353 }, 21354 p3, 21355 p3.exports, 21356 r3, 21357 e2, 21358 n2, 21359 t3 21360 ); 21361 } 21362 return n2[i22].exports; 21363 } 21364 for (var u2 = "function" == typeof __require2 && __require2, i2 = 0; i2 < t3.length; i2++) 21365 o3(t3[i2]); 21366 return o3; 21367 } 21368 return r3; 21369 })())( 21370 { 21371 1: [ 21372 function(require2, module2, exports2) { 21373 var BROTLI_READ_SIZE = 4096; 21374 var BROTLI_IBUF_SIZE = 2 * BROTLI_READ_SIZE + 32; 21375 var BROTLI_IBUF_MASK = 2 * BROTLI_READ_SIZE - 1; 21376 var kBitMask = new Uint32Array([ 21377 0, 21378 1, 21379 3, 21380 7, 21381 15, 21382 31, 21383 63, 21384 127, 21385 255, 21386 511, 21387 1023, 21388 2047, 21389 4095, 21390 8191, 21391 16383, 21392 32767, 21393 65535, 21394 131071, 21395 262143, 21396 524287, 21397 1048575, 21398 2097151, 21399 4194303, 21400 8388607, 21401 16777215 21402 ]); 21403 function BrotliBitReader(input) { 21404 this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE); 21405 this.input_ = input; 21406 this.reset(); 21407 } 21408 BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE; 21409 BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK; 21410 BrotliBitReader.prototype.reset = function() { 21411 this.buf_ptr_ = 0; 21412 this.val_ = 0; 21413 this.pos_ = 0; 21414 this.bit_pos_ = 0; 21415 this.bit_end_pos_ = 0; 21416 this.eos_ = 0; 21417 this.readMoreInput(); 21418 for (var i2 = 0; i2 < 4; i2++) { 21419 this.val_ |= this.buf_[this.pos_] << 8 * i2; 21420 ++this.pos_; 21421 } 21422 return this.bit_end_pos_ > 0; 21423 }; 21424 BrotliBitReader.prototype.readMoreInput = function() { 21425 if (this.bit_end_pos_ > 256) { 21426 return; 21427 } else if (this.eos_) { 21428 if (this.bit_pos_ > this.bit_end_pos_) 21429 throw new Error( 21430 "Unexpected end of input " + this.bit_pos_ + " " + this.bit_end_pos_ 21431 ); 21432 } else { 21433 var dst = this.buf_ptr_; 21434 var bytes_read = this.input_.read( 21435 this.buf_, 21436 dst, 21437 BROTLI_READ_SIZE 21438 ); 21439 if (bytes_read < 0) { 21440 throw new Error("Unexpected end of input"); 21441 } 21442 if (bytes_read < BROTLI_READ_SIZE) { 21443 this.eos_ = 1; 21444 for (var p3 = 0; p3 < 32; p3++) 21445 this.buf_[dst + bytes_read + p3] = 0; 21446 } 21447 if (dst === 0) { 21448 for (var p3 = 0; p3 < 32; p3++) 21449 this.buf_[(BROTLI_READ_SIZE << 1) + p3] = this.buf_[p3]; 21450 this.buf_ptr_ = BROTLI_READ_SIZE; 21451 } else { 21452 this.buf_ptr_ = 0; 21453 } 21454 this.bit_end_pos_ += bytes_read << 3; 21455 } 21456 }; 21457 BrotliBitReader.prototype.fillBitWindow = function() { 21458 while (this.bit_pos_ >= 8) { 21459 this.val_ >>>= 8; 21460 this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24; 21461 ++this.pos_; 21462 this.bit_pos_ = this.bit_pos_ - 8 >>> 0; 21463 this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0; 21464 } 21465 }; 21466 BrotliBitReader.prototype.readBits = function(n_bits) { 21467 if (32 - this.bit_pos_ < n_bits) { 21468 this.fillBitWindow(); 21469 } 21470 var val = this.val_ >>> this.bit_pos_ & kBitMask[n_bits]; 21471 this.bit_pos_ += n_bits; 21472 return val; 21473 }; 21474 module2.exports = BrotliBitReader; 21475 }, 21476 {} 21477 ], 21478 2: [ 21479 function(require2, module2, exports2) { 21480 var CONTEXT_LSB6 = 0; 21481 var CONTEXT_MSB6 = 1; 21482 var CONTEXT_UTF8 = 2; 21483 var CONTEXT_SIGNED = 3; 21484 exports2.lookup = new Uint8Array([ 21485 /* CONTEXT_UTF8, last byte. */ 21486 /* ASCII range. */ 21487 0, 21488 0, 21489 0, 21490 0, 21491 0, 21492 0, 21493 0, 21494 0, 21495 0, 21496 4, 21497 4, 21498 0, 21499 0, 21500 4, 21501 0, 21502 0, 21503 0, 21504 0, 21505 0, 21506 0, 21507 0, 21508 0, 21509 0, 21510 0, 21511 0, 21512 0, 21513 0, 21514 0, 21515 0, 21516 0, 21517 0, 21518 0, 21519 8, 21520 12, 21521 16, 21522 12, 21523 12, 21524 20, 21525 12, 21526 16, 21527 24, 21528 28, 21529 12, 21530 12, 21531 32, 21532 12, 21533 36, 21534 12, 21535 44, 21536 44, 21537 44, 21538 44, 21539 44, 21540 44, 21541 44, 21542 44, 21543 44, 21544 44, 21545 32, 21546 32, 21547 24, 21548 40, 21549 28, 21550 12, 21551 12, 21552 48, 21553 52, 21554 52, 21555 52, 21556 48, 21557 52, 21558 52, 21559 52, 21560 48, 21561 52, 21562 52, 21563 52, 21564 52, 21565 52, 21566 48, 21567 52, 21568 52, 21569 52, 21570 52, 21571 52, 21572 48, 21573 52, 21574 52, 21575 52, 21576 52, 21577 52, 21578 24, 21579 12, 21580 28, 21581 12, 21582 12, 21583 12, 21584 56, 21585 60, 21586 60, 21587 60, 21588 56, 21589 60, 21590 60, 21591 60, 21592 56, 21593 60, 21594 60, 21595 60, 21596 60, 21597 60, 21598 56, 21599 60, 21600 60, 21601 60, 21602 60, 21603 60, 21604 56, 21605 60, 21606 60, 21607 60, 21608 60, 21609 60, 21610 24, 21611 12, 21612 28, 21613 12, 21614 0, 21615 /* UTF8 continuation byte range. */ 21616 0, 21617 1, 21618 0, 21619 1, 21620 0, 21621 1, 21622 0, 21623 1, 21624 0, 21625 1, 21626 0, 21627 1, 21628 0, 21629 1, 21630 0, 21631 1, 21632 0, 21633 1, 21634 0, 21635 1, 21636 0, 21637 1, 21638 0, 21639 1, 21640 0, 21641 1, 21642 0, 21643 1, 21644 0, 21645 1, 21646 0, 21647 1, 21648 0, 21649 1, 21650 0, 21651 1, 21652 0, 21653 1, 21654 0, 21655 1, 21656 0, 21657 1, 21658 0, 21659 1, 21660 0, 21661 1, 21662 0, 21663 1, 21664 0, 21665 1, 21666 0, 21667 1, 21668 0, 21669 1, 21670 0, 21671 1, 21672 0, 21673 1, 21674 0, 21675 1, 21676 0, 21677 1, 21678 0, 21679 1, 21680 2, 21681 3, 21682 2, 21683 3, 21684 2, 21685 3, 21686 2, 21687 3, 21688 2, 21689 3, 21690 2, 21691 3, 21692 2, 21693 3, 21694 2, 21695 3, 21696 2, 21697 3, 21698 2, 21699 3, 21700 2, 21701 3, 21702 2, 21703 3, 21704 2, 21705 3, 21706 2, 21707 3, 21708 2, 21709 3, 21710 2, 21711 3, 21712 2, 21713 3, 21714 2, 21715 3, 21716 2, 21717 3, 21718 2, 21719 3, 21720 2, 21721 3, 21722 2, 21723 3, 21724 2, 21725 3, 21726 2, 21727 3, 21728 2, 21729 3, 21730 2, 21731 3, 21732 2, 21733 3, 21734 2, 21735 3, 21736 2, 21737 3, 21738 2, 21739 3, 21740 2, 21741 3, 21742 2, 21743 3, 21744 /* ASCII range. */ 21745 0, 21746 0, 21747 0, 21748 0, 21749 0, 21750 0, 21751 0, 21752 0, 21753 0, 21754 0, 21755 0, 21756 0, 21757 0, 21758 0, 21759 0, 21760 0, 21761 0, 21762 0, 21763 0, 21764 0, 21765 0, 21766 0, 21767 0, 21768 0, 21769 0, 21770 0, 21771 0, 21772 0, 21773 0, 21774 0, 21775 0, 21776 0, 21777 0, 21778 1, 21779 1, 21780 1, 21781 1, 21782 1, 21783 1, 21784 1, 21785 1, 21786 1, 21787 1, 21788 1, 21789 1, 21790 1, 21791 1, 21792 1, 21793 2, 21794 2, 21795 2, 21796 2, 21797 2, 21798 2, 21799 2, 21800 2, 21801 2, 21802 2, 21803 1, 21804 1, 21805 1, 21806 1, 21807 1, 21808 1, 21809 1, 21810 2, 21811 2, 21812 2, 21813 2, 21814 2, 21815 2, 21816 2, 21817 2, 21818 2, 21819 2, 21820 2, 21821 2, 21822 2, 21823 2, 21824 2, 21825 2, 21826 2, 21827 2, 21828 2, 21829 2, 21830 2, 21831 2, 21832 2, 21833 2, 21834 2, 21835 2, 21836 1, 21837 1, 21838 1, 21839 1, 21840 1, 21841 1, 21842 3, 21843 3, 21844 3, 21845 3, 21846 3, 21847 3, 21848 3, 21849 3, 21850 3, 21851 3, 21852 3, 21853 3, 21854 3, 21855 3, 21856 3, 21857 3, 21858 3, 21859 3, 21860 3, 21861 3, 21862 3, 21863 3, 21864 3, 21865 3, 21866 3, 21867 3, 21868 1, 21869 1, 21870 1, 21871 1, 21872 0, 21873 /* UTF8 continuation byte range. */ 21874 0, 21875 0, 21876 0, 21877 0, 21878 0, 21879 0, 21880 0, 21881 0, 21882 0, 21883 0, 21884 0, 21885 0, 21886 0, 21887 0, 21888 0, 21889 0, 21890 0, 21891 0, 21892 0, 21893 0, 21894 0, 21895 0, 21896 0, 21897 0, 21898 0, 21899 0, 21900 0, 21901 0, 21902 0, 21903 0, 21904 0, 21905 0, 21906 0, 21907 0, 21908 0, 21909 0, 21910 0, 21911 0, 21912 0, 21913 0, 21914 0, 21915 0, 21916 0, 21917 0, 21918 0, 21919 0, 21920 0, 21921 0, 21922 0, 21923 0, 21924 0, 21925 0, 21926 0, 21927 0, 21928 0, 21929 0, 21930 0, 21931 0, 21932 0, 21933 0, 21934 0, 21935 0, 21936 0, 21937 0, 21938 0, 21939 0, 21940 0, 21941 0, 21942 0, 21943 0, 21944 0, 21945 0, 21946 0, 21947 0, 21948 0, 21949 0, 21950 0, 21951 0, 21952 0, 21953 0, 21954 0, 21955 0, 21956 0, 21957 0, 21958 0, 21959 0, 21960 0, 21961 0, 21962 0, 21963 0, 21964 0, 21965 0, 21966 0, 21967 0, 21968 0, 21969 0, 21970 2, 21971 2, 21972 2, 21973 2, 21974 2, 21975 2, 21976 2, 21977 2, 21978 2, 21979 2, 21980 2, 21981 2, 21982 2, 21983 2, 21984 2, 21985 2, 21986 2, 21987 2, 21988 2, 21989 2, 21990 2, 21991 2, 21992 2, 21993 2, 21994 2, 21995 2, 21996 2, 21997 2, 21998 2, 21999 2, 22000 2, 22001 2, 22002 0, 22003 1, 22004 1, 22005 1, 22006 1, 22007 1, 22008 1, 22009 1, 22010 1, 22011 1, 22012 1, 22013 1, 22014 1, 22015 1, 22016 1, 22017 1, 22018 2, 22019 2, 22020 2, 22021 2, 22022 2, 22023 2, 22024 2, 22025 2, 22026 2, 22027 2, 22028 2, 22029 2, 22030 2, 22031 2, 22032 2, 22033 2, 22034 2, 22035 2, 22036 2, 22037 2, 22038 2, 22039 2, 22040 2, 22041 2, 22042 2, 22043 2, 22044 2, 22045 2, 22046 2, 22047 2, 22048 2, 22049 2, 22050 2, 22051 2, 22052 2, 22053 2, 22054 2, 22055 2, 22056 2, 22057 2, 22058 2, 22059 2, 22060 2, 22061 2, 22062 2, 22063 2, 22064 2, 22065 2, 22066 3, 22067 3, 22068 3, 22069 3, 22070 3, 22071 3, 22072 3, 22073 3, 22074 3, 22075 3, 22076 3, 22077 3, 22078 3, 22079 3, 22080 3, 22081 3, 22082 3, 22083 3, 22084 3, 22085 3, 22086 3, 22087 3, 22088 3, 22089 3, 22090 3, 22091 3, 22092 3, 22093 3, 22094 3, 22095 3, 22096 3, 22097 3, 22098 3, 22099 3, 22100 3, 22101 3, 22102 3, 22103 3, 22104 3, 22105 3, 22106 3, 22107 3, 22108 3, 22109 3, 22110 3, 22111 3, 22112 3, 22113 3, 22114 3, 22115 3, 22116 3, 22117 3, 22118 3, 22119 3, 22120 3, 22121 3, 22122 3, 22123 3, 22124 3, 22125 3, 22126 3, 22127 3, 22128 3, 22129 3, 22130 4, 22131 4, 22132 4, 22133 4, 22134 4, 22135 4, 22136 4, 22137 4, 22138 4, 22139 4, 22140 4, 22141 4, 22142 4, 22143 4, 22144 4, 22145 4, 22146 4, 22147 4, 22148 4, 22149 4, 22150 4, 22151 4, 22152 4, 22153 4, 22154 4, 22155 4, 22156 4, 22157 4, 22158 4, 22159 4, 22160 4, 22161 4, 22162 4, 22163 4, 22164 4, 22165 4, 22166 4, 22167 4, 22168 4, 22169 4, 22170 4, 22171 4, 22172 4, 22173 4, 22174 4, 22175 4, 22176 4, 22177 4, 22178 4, 22179 4, 22180 4, 22181 4, 22182 4, 22183 4, 22184 4, 22185 4, 22186 4, 22187 4, 22188 4, 22189 4, 22190 4, 22191 4, 22192 4, 22193 4, 22194 5, 22195 5, 22196 5, 22197 5, 22198 5, 22199 5, 22200 5, 22201 5, 22202 5, 22203 5, 22204 5, 22205 5, 22206 5, 22207 5, 22208 5, 22209 5, 22210 5, 22211 5, 22212 5, 22213 5, 22214 5, 22215 5, 22216 5, 22217 5, 22218 5, 22219 5, 22220 5, 22221 5, 22222 5, 22223 5, 22224 5, 22225 5, 22226 5, 22227 5, 22228 5, 22229 5, 22230 5, 22231 5, 22232 5, 22233 5, 22234 5, 22235 5, 22236 5, 22237 5, 22238 5, 22239 5, 22240 5, 22241 5, 22242 6, 22243 6, 22244 6, 22245 6, 22246 6, 22247 6, 22248 6, 22249 6, 22250 6, 22251 6, 22252 6, 22253 6, 22254 6, 22255 6, 22256 6, 22257 7, 22258 /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */ 22259 0, 22260 8, 22261 8, 22262 8, 22263 8, 22264 8, 22265 8, 22266 8, 22267 8, 22268 8, 22269 8, 22270 8, 22271 8, 22272 8, 22273 8, 22274 8, 22275 16, 22276 16, 22277 16, 22278 16, 22279 16, 22280 16, 22281 16, 22282 16, 22283 16, 22284 16, 22285 16, 22286 16, 22287 16, 22288 16, 22289 16, 22290 16, 22291 16, 22292 16, 22293 16, 22294 16, 22295 16, 22296 16, 22297 16, 22298 16, 22299 16, 22300 16, 22301 16, 22302 16, 22303 16, 22304 16, 22305 16, 22306 16, 22307 16, 22308 16, 22309 16, 22310 16, 22311 16, 22312 16, 22313 16, 22314 16, 22315 16, 22316 16, 22317 16, 22318 16, 22319 16, 22320 16, 22321 16, 22322 16, 22323 24, 22324 24, 22325 24, 22326 24, 22327 24, 22328 24, 22329 24, 22330 24, 22331 24, 22332 24, 22333 24, 22334 24, 22335 24, 22336 24, 22337 24, 22338 24, 22339 24, 22340 24, 22341 24, 22342 24, 22343 24, 22344 24, 22345 24, 22346 24, 22347 24, 22348 24, 22349 24, 22350 24, 22351 24, 22352 24, 22353 24, 22354 24, 22355 24, 22356 24, 22357 24, 22358 24, 22359 24, 22360 24, 22361 24, 22362 24, 22363 24, 22364 24, 22365 24, 22366 24, 22367 24, 22368 24, 22369 24, 22370 24, 22371 24, 22372 24, 22373 24, 22374 24, 22375 24, 22376 24, 22377 24, 22378 24, 22379 24, 22380 24, 22381 24, 22382 24, 22383 24, 22384 24, 22385 24, 22386 24, 22387 32, 22388 32, 22389 32, 22390 32, 22391 32, 22392 32, 22393 32, 22394 32, 22395 32, 22396 32, 22397 32, 22398 32, 22399 32, 22400 32, 22401 32, 22402 32, 22403 32, 22404 32, 22405 32, 22406 32, 22407 32, 22408 32, 22409 32, 22410 32, 22411 32, 22412 32, 22413 32, 22414 32, 22415 32, 22416 32, 22417 32, 22418 32, 22419 32, 22420 32, 22421 32, 22422 32, 22423 32, 22424 32, 22425 32, 22426 32, 22427 32, 22428 32, 22429 32, 22430 32, 22431 32, 22432 32, 22433 32, 22434 32, 22435 32, 22436 32, 22437 32, 22438 32, 22439 32, 22440 32, 22441 32, 22442 32, 22443 32, 22444 32, 22445 32, 22446 32, 22447 32, 22448 32, 22449 32, 22450 32, 22451 40, 22452 40, 22453 40, 22454 40, 22455 40, 22456 40, 22457 40, 22458 40, 22459 40, 22460 40, 22461 40, 22462 40, 22463 40, 22464 40, 22465 40, 22466 40, 22467 40, 22468 40, 22469 40, 22470 40, 22471 40, 22472 40, 22473 40, 22474 40, 22475 40, 22476 40, 22477 40, 22478 40, 22479 40, 22480 40, 22481 40, 22482 40, 22483 40, 22484 40, 22485 40, 22486 40, 22487 40, 22488 40, 22489 40, 22490 40, 22491 40, 22492 40, 22493 40, 22494 40, 22495 40, 22496 40, 22497 40, 22498 40, 22499 48, 22500 48, 22501 48, 22502 48, 22503 48, 22504 48, 22505 48, 22506 48, 22507 48, 22508 48, 22509 48, 22510 48, 22511 48, 22512 48, 22513 48, 22514 56, 22515 /* CONTEXT_LSB6, last byte. */ 22516 0, 22517 1, 22518 2, 22519 3, 22520 4, 22521 5, 22522 6, 22523 7, 22524 8, 22525 9, 22526 10, 22527 11, 22528 12, 22529 13, 22530 14, 22531 15, 22532 16, 22533 17, 22534 18, 22535 19, 22536 20, 22537 21, 22538 22, 22539 23, 22540 24, 22541 25, 22542 26, 22543 27, 22544 28, 22545 29, 22546 30, 22547 31, 22548 32, 22549 33, 22550 34, 22551 35, 22552 36, 22553 37, 22554 38, 22555 39, 22556 40, 22557 41, 22558 42, 22559 43, 22560 44, 22561 45, 22562 46, 22563 47, 22564 48, 22565 49, 22566 50, 22567 51, 22568 52, 22569 53, 22570 54, 22571 55, 22572 56, 22573 57, 22574 58, 22575 59, 22576 60, 22577 61, 22578 62, 22579 63, 22580 0, 22581 1, 22582 2, 22583 3, 22584 4, 22585 5, 22586 6, 22587 7, 22588 8, 22589 9, 22590 10, 22591 11, 22592 12, 22593 13, 22594 14, 22595 15, 22596 16, 22597 17, 22598 18, 22599 19, 22600 20, 22601 21, 22602 22, 22603 23, 22604 24, 22605 25, 22606 26, 22607 27, 22608 28, 22609 29, 22610 30, 22611 31, 22612 32, 22613 33, 22614 34, 22615 35, 22616 36, 22617 37, 22618 38, 22619 39, 22620 40, 22621 41, 22622 42, 22623 43, 22624 44, 22625 45, 22626 46, 22627 47, 22628 48, 22629 49, 22630 50, 22631 51, 22632 52, 22633 53, 22634 54, 22635 55, 22636 56, 22637 57, 22638 58, 22639 59, 22640 60, 22641 61, 22642 62, 22643 63, 22644 0, 22645 1, 22646 2, 22647 3, 22648 4, 22649 5, 22650 6, 22651 7, 22652 8, 22653 9, 22654 10, 22655 11, 22656 12, 22657 13, 22658 14, 22659 15, 22660 16, 22661 17, 22662 18, 22663 19, 22664 20, 22665 21, 22666 22, 22667 23, 22668 24, 22669 25, 22670 26, 22671 27, 22672 28, 22673 29, 22674 30, 22675 31, 22676 32, 22677 33, 22678 34, 22679 35, 22680 36, 22681 37, 22682 38, 22683 39, 22684 40, 22685 41, 22686 42, 22687 43, 22688 44, 22689 45, 22690 46, 22691 47, 22692 48, 22693 49, 22694 50, 22695 51, 22696 52, 22697 53, 22698 54, 22699 55, 22700 56, 22701 57, 22702 58, 22703 59, 22704 60, 22705 61, 22706 62, 22707 63, 22708 0, 22709 1, 22710 2, 22711 3, 22712 4, 22713 5, 22714 6, 22715 7, 22716 8, 22717 9, 22718 10, 22719 11, 22720 12, 22721 13, 22722 14, 22723 15, 22724 16, 22725 17, 22726 18, 22727 19, 22728 20, 22729 21, 22730 22, 22731 23, 22732 24, 22733 25, 22734 26, 22735 27, 22736 28, 22737 29, 22738 30, 22739 31, 22740 32, 22741 33, 22742 34, 22743 35, 22744 36, 22745 37, 22746 38, 22747 39, 22748 40, 22749 41, 22750 42, 22751 43, 22752 44, 22753 45, 22754 46, 22755 47, 22756 48, 22757 49, 22758 50, 22759 51, 22760 52, 22761 53, 22762 54, 22763 55, 22764 56, 22765 57, 22766 58, 22767 59, 22768 60, 22769 61, 22770 62, 22771 63, 22772 /* CONTEXT_MSB6, last byte. */ 22773 0, 22774 0, 22775 0, 22776 0, 22777 1, 22778 1, 22779 1, 22780 1, 22781 2, 22782 2, 22783 2, 22784 2, 22785 3, 22786 3, 22787 3, 22788 3, 22789 4, 22790 4, 22791 4, 22792 4, 22793 5, 22794 5, 22795 5, 22796 5, 22797 6, 22798 6, 22799 6, 22800 6, 22801 7, 22802 7, 22803 7, 22804 7, 22805 8, 22806 8, 22807 8, 22808 8, 22809 9, 22810 9, 22811 9, 22812 9, 22813 10, 22814 10, 22815 10, 22816 10, 22817 11, 22818 11, 22819 11, 22820 11, 22821 12, 22822 12, 22823 12, 22824 12, 22825 13, 22826 13, 22827 13, 22828 13, 22829 14, 22830 14, 22831 14, 22832 14, 22833 15, 22834 15, 22835 15, 22836 15, 22837 16, 22838 16, 22839 16, 22840 16, 22841 17, 22842 17, 22843 17, 22844 17, 22845 18, 22846 18, 22847 18, 22848 18, 22849 19, 22850 19, 22851 19, 22852 19, 22853 20, 22854 20, 22855 20, 22856 20, 22857 21, 22858 21, 22859 21, 22860 21, 22861 22, 22862 22, 22863 22, 22864 22, 22865 23, 22866 23, 22867 23, 22868 23, 22869 24, 22870 24, 22871 24, 22872 24, 22873 25, 22874 25, 22875 25, 22876 25, 22877 26, 22878 26, 22879 26, 22880 26, 22881 27, 22882 27, 22883 27, 22884 27, 22885 28, 22886 28, 22887 28, 22888 28, 22889 29, 22890 29, 22891 29, 22892 29, 22893 30, 22894 30, 22895 30, 22896 30, 22897 31, 22898 31, 22899 31, 22900 31, 22901 32, 22902 32, 22903 32, 22904 32, 22905 33, 22906 33, 22907 33, 22908 33, 22909 34, 22910 34, 22911 34, 22912 34, 22913 35, 22914 35, 22915 35, 22916 35, 22917 36, 22918 36, 22919 36, 22920 36, 22921 37, 22922 37, 22923 37, 22924 37, 22925 38, 22926 38, 22927 38, 22928 38, 22929 39, 22930 39, 22931 39, 22932 39, 22933 40, 22934 40, 22935 40, 22936 40, 22937 41, 22938 41, 22939 41, 22940 41, 22941 42, 22942 42, 22943 42, 22944 42, 22945 43, 22946 43, 22947 43, 22948 43, 22949 44, 22950 44, 22951 44, 22952 44, 22953 45, 22954 45, 22955 45, 22956 45, 22957 46, 22958 46, 22959 46, 22960 46, 22961 47, 22962 47, 22963 47, 22964 47, 22965 48, 22966 48, 22967 48, 22968 48, 22969 49, 22970 49, 22971 49, 22972 49, 22973 50, 22974 50, 22975 50, 22976 50, 22977 51, 22978 51, 22979 51, 22980 51, 22981 52, 22982 52, 22983 52, 22984 52, 22985 53, 22986 53, 22987 53, 22988 53, 22989 54, 22990 54, 22991 54, 22992 54, 22993 55, 22994 55, 22995 55, 22996 55, 22997 56, 22998 56, 22999 56, 23000 56, 23001 57, 23002 57, 23003 57, 23004 57, 23005 58, 23006 58, 23007 58, 23008 58, 23009 59, 23010 59, 23011 59, 23012 59, 23013 60, 23014 60, 23015 60, 23016 60, 23017 61, 23018 61, 23019 61, 23020 61, 23021 62, 23022 62, 23023 62, 23024 62, 23025 63, 23026 63, 23027 63, 23028 63, 23029 /* CONTEXT_{M,L}SB6, second last byte, */ 23030 0, 23031 0, 23032 0, 23033 0, 23034 0, 23035 0, 23036 0, 23037 0, 23038 0, 23039 0, 23040 0, 23041 0, 23042 0, 23043 0, 23044 0, 23045 0, 23046 0, 23047 0, 23048 0, 23049 0, 23050 0, 23051 0, 23052 0, 23053 0, 23054 0, 23055 0, 23056 0, 23057 0, 23058 0, 23059 0, 23060 0, 23061 0, 23062 0, 23063 0, 23064 0, 23065 0, 23066 0, 23067 0, 23068 0, 23069 0, 23070 0, 23071 0, 23072 0, 23073 0, 23074 0, 23075 0, 23076 0, 23077 0, 23078 0, 23079 0, 23080 0, 23081 0, 23082 0, 23083 0, 23084 0, 23085 0, 23086 0, 23087 0, 23088 0, 23089 0, 23090 0, 23091 0, 23092 0, 23093 0, 23094 0, 23095 0, 23096 0, 23097 0, 23098 0, 23099 0, 23100 0, 23101 0, 23102 0, 23103 0, 23104 0, 23105 0, 23106 0, 23107 0, 23108 0, 23109 0, 23110 0, 23111 0, 23112 0, 23113 0, 23114 0, 23115 0, 23116 0, 23117 0, 23118 0, 23119 0, 23120 0, 23121 0, 23122 0, 23123 0, 23124 0, 23125 0, 23126 0, 23127 0, 23128 0, 23129 0, 23130 0, 23131 0, 23132 0, 23133 0, 23134 0, 23135 0, 23136 0, 23137 0, 23138 0, 23139 0, 23140 0, 23141 0, 23142 0, 23143 0, 23144 0, 23145 0, 23146 0, 23147 0, 23148 0, 23149 0, 23150 0, 23151 0, 23152 0, 23153 0, 23154 0, 23155 0, 23156 0, 23157 0, 23158 0, 23159 0, 23160 0, 23161 0, 23162 0, 23163 0, 23164 0, 23165 0, 23166 0, 23167 0, 23168 0, 23169 0, 23170 0, 23171 0, 23172 0, 23173 0, 23174 0, 23175 0, 23176 0, 23177 0, 23178 0, 23179 0, 23180 0, 23181 0, 23182 0, 23183 0, 23184 0, 23185 0, 23186 0, 23187 0, 23188 0, 23189 0, 23190 0, 23191 0, 23192 0, 23193 0, 23194 0, 23195 0, 23196 0, 23197 0, 23198 0, 23199 0, 23200 0, 23201 0, 23202 0, 23203 0, 23204 0, 23205 0, 23206 0, 23207 0, 23208 0, 23209 0, 23210 0, 23211 0, 23212 0, 23213 0, 23214 0, 23215 0, 23216 0, 23217 0, 23218 0, 23219 0, 23220 0, 23221 0, 23222 0, 23223 0, 23224 0, 23225 0, 23226 0, 23227 0, 23228 0, 23229 0, 23230 0, 23231 0, 23232 0, 23233 0, 23234 0, 23235 0, 23236 0, 23237 0, 23238 0, 23239 0, 23240 0, 23241 0, 23242 0, 23243 0, 23244 0, 23245 0, 23246 0, 23247 0, 23248 0, 23249 0, 23250 0, 23251 0, 23252 0, 23253 0, 23254 0, 23255 0, 23256 0, 23257 0, 23258 0, 23259 0, 23260 0, 23261 0, 23262 0, 23263 0, 23264 0, 23265 0, 23266 0, 23267 0, 23268 0, 23269 0, 23270 0, 23271 0, 23272 0, 23273 0, 23274 0, 23275 0, 23276 0, 23277 0, 23278 0, 23279 0, 23280 0, 23281 0, 23282 0, 23283 0, 23284 0, 23285 0 23286 ]); 23287 exports2.lookupOffsets = new Uint16Array([ 23288 /* CONTEXT_LSB6 */ 23289 1024, 23290 1536, 23291 1280, 23292 1536, 23293 0, 23294 256, 23295 768, 23296 512 23297 ]); 23298 }, 23299 {} 23300 ], 23301 3: [ 23302 function(require2, module2, exports2) { 23303 var BrotliInput = require2("./streams").BrotliInput; 23304 var BrotliOutput = require2("./streams").BrotliOutput; 23305 var BrotliBitReader = require2("./bit_reader"); 23306 var BrotliDictionary = require2("./dictionary"); 23307 var HuffmanCode = require2("./huffman").HuffmanCode; 23308 var BrotliBuildHuffmanTable = require2("./huffman").BrotliBuildHuffmanTable; 23309 var Context = require2("./context"); 23310 var Prefix = require2("./prefix"); 23311 var Transform = require2("./transform"); 23312 var kDefaultCodeLength = 8; 23313 var kCodeLengthRepeatCode = 16; 23314 var kNumLiteralCodes = 256; 23315 var kNumInsertAndCopyCodes = 704; 23316 var kNumBlockLengthCodes = 26; 23317 var kLiteralContextBits = 6; 23318 var kDistanceContextBits = 2; 23319 var HUFFMAN_TABLE_BITS = 8; 23320 var HUFFMAN_TABLE_MASK = 255; 23321 var HUFFMAN_MAX_TABLE_SIZE = 1080; 23322 var CODE_LENGTH_CODES = 18; 23323 var kCodeLengthCodeOrder = new Uint8Array([ 23324 1, 23325 2, 23326 3, 23327 4, 23328 0, 23329 5, 23330 17, 23331 6, 23332 16, 23333 7, 23334 8, 23335 9, 23336 10, 23337 11, 23338 12, 23339 13, 23340 14, 23341 15 23342 ]); 23343 var NUM_DISTANCE_SHORT_CODES = 16; 23344 var kDistanceShortCodeIndexOffset = new Uint8Array([ 23345 3, 23346 2, 23347 1, 23348 0, 23349 3, 23350 3, 23351 3, 23352 3, 23353 3, 23354 3, 23355 2, 23356 2, 23357 2, 23358 2, 23359 2, 23360 2 23361 ]); 23362 var kDistanceShortCodeValueOffset = new Int8Array([ 23363 0, 23364 0, 23365 0, 23366 0, 23367 -1, 23368 1, 23369 -2, 23370 2, 23371 -3, 23372 3, 23373 -1, 23374 1, 23375 -2, 23376 2, 23377 -3, 23378 3 23379 ]); 23380 var kMaxHuffmanTableSize = new Uint16Array([ 23381 256, 23382 402, 23383 436, 23384 468, 23385 500, 23386 534, 23387 566, 23388 598, 23389 630, 23390 662, 23391 694, 23392 726, 23393 758, 23394 790, 23395 822, 23396 854, 23397 886, 23398 920, 23399 952, 23400 984, 23401 1016, 23402 1048, 23403 1080 23404 ]); 23405 function DecodeWindowBits(br) { 23406 var n2; 23407 if (br.readBits(1) === 0) { 23408 return 16; 23409 } 23410 n2 = br.readBits(3); 23411 if (n2 > 0) { 23412 return 17 + n2; 23413 } 23414 n2 = br.readBits(3); 23415 if (n2 > 0) { 23416 return 8 + n2; 23417 } 23418 return 17; 23419 } 23420 function DecodeVarLenUint8(br) { 23421 if (br.readBits(1)) { 23422 var nbits = br.readBits(3); 23423 if (nbits === 0) { 23424 return 1; 23425 } else { 23426 return br.readBits(nbits) + (1 << nbits); 23427 } 23428 } 23429 return 0; 23430 } 23431 function MetaBlockLength() { 23432 this.meta_block_length = 0; 23433 this.input_end = 0; 23434 this.is_uncompressed = 0; 23435 this.is_metadata = false; 23436 } 23437 function DecodeMetaBlockLength(br) { 23438 var out = new MetaBlockLength(); 23439 var size_nibbles; 23440 var size_bytes; 23441 var i2; 23442 out.input_end = br.readBits(1); 23443 if (out.input_end && br.readBits(1)) { 23444 return out; 23445 } 23446 size_nibbles = br.readBits(2) + 4; 23447 if (size_nibbles === 7) { 23448 out.is_metadata = true; 23449 if (br.readBits(1) !== 0) 23450 throw new Error("Invalid reserved bit"); 23451 size_bytes = br.readBits(2); 23452 if (size_bytes === 0) return out; 23453 for (i2 = 0; i2 < size_bytes; i2++) { 23454 var next_byte = br.readBits(8); 23455 if (i2 + 1 === size_bytes && size_bytes > 1 && next_byte === 0) 23456 throw new Error("Invalid size byte"); 23457 out.meta_block_length |= next_byte << i2 * 8; 23458 } 23459 } else { 23460 for (i2 = 0; i2 < size_nibbles; ++i2) { 23461 var next_nibble = br.readBits(4); 23462 if (i2 + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0) 23463 throw new Error("Invalid size nibble"); 23464 out.meta_block_length |= next_nibble << i2 * 4; 23465 } 23466 } 23467 ++out.meta_block_length; 23468 if (!out.input_end && !out.is_metadata) { 23469 out.is_uncompressed = br.readBits(1); 23470 } 23471 return out; 23472 } 23473 function ReadSymbol(table, index2, br) { 23474 var start_index = index2; 23475 var nbits; 23476 br.fillBitWindow(); 23477 index2 += br.val_ >>> br.bit_pos_ & HUFFMAN_TABLE_MASK; 23478 nbits = table[index2].bits - HUFFMAN_TABLE_BITS; 23479 if (nbits > 0) { 23480 br.bit_pos_ += HUFFMAN_TABLE_BITS; 23481 index2 += table[index2].value; 23482 index2 += br.val_ >>> br.bit_pos_ & (1 << nbits) - 1; 23483 } 23484 br.bit_pos_ += table[index2].bits; 23485 return table[index2].value; 23486 } 23487 function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) { 23488 var symbol3 = 0; 23489 var prev_code_len = kDefaultCodeLength; 23490 var repeat = 0; 23491 var repeat_code_len = 0; 23492 var space = 32768; 23493 var table = []; 23494 for (var i2 = 0; i2 < 32; i2++) 23495 table.push(new HuffmanCode(0, 0)); 23496 BrotliBuildHuffmanTable( 23497 table, 23498 0, 23499 5, 23500 code_length_code_lengths, 23501 CODE_LENGTH_CODES 23502 ); 23503 while (symbol3 < num_symbols && space > 0) { 23504 var p3 = 0; 23505 var code_len; 23506 br.readMoreInput(); 23507 br.fillBitWindow(); 23508 p3 += br.val_ >>> br.bit_pos_ & 31; 23509 br.bit_pos_ += table[p3].bits; 23510 code_len = table[p3].value & 255; 23511 if (code_len < kCodeLengthRepeatCode) { 23512 repeat = 0; 23513 code_lengths[symbol3++] = code_len; 23514 if (code_len !== 0) { 23515 prev_code_len = code_len; 23516 space -= 32768 >> code_len; 23517 } 23518 } else { 23519 var extra_bits = code_len - 14; 23520 var old_repeat; 23521 var repeat_delta; 23522 var new_len = 0; 23523 if (code_len === kCodeLengthRepeatCode) { 23524 new_len = prev_code_len; 23525 } 23526 if (repeat_code_len !== new_len) { 23527 repeat = 0; 23528 repeat_code_len = new_len; 23529 } 23530 old_repeat = repeat; 23531 if (repeat > 0) { 23532 repeat -= 2; 23533 repeat <<= extra_bits; 23534 } 23535 repeat += br.readBits(extra_bits) + 3; 23536 repeat_delta = repeat - old_repeat; 23537 if (symbol3 + repeat_delta > num_symbols) { 23538 throw new Error( 23539 "[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols" 23540 ); 23541 } 23542 for (var x2 = 0; x2 < repeat_delta; x2++) 23543 code_lengths[symbol3 + x2] = repeat_code_len; 23544 symbol3 += repeat_delta; 23545 if (repeat_code_len !== 0) { 23546 space -= repeat_delta << 15 - repeat_code_len; 23547 } 23548 } 23549 } 23550 if (space !== 0) { 23551 throw new Error( 23552 "[ReadHuffmanCodeLengths] space = " + space 23553 ); 23554 } 23555 for (; symbol3 < num_symbols; symbol3++) 23556 code_lengths[symbol3] = 0; 23557 } 23558 function ReadHuffmanCode(alphabet_size, tables, table, br) { 23559 var table_size = 0; 23560 var simple_code_or_skip; 23561 var code_lengths = new Uint8Array(alphabet_size); 23562 br.readMoreInput(); 23563 simple_code_or_skip = br.readBits(2); 23564 if (simple_code_or_skip === 1) { 23565 var i2; 23566 var max_bits_counter = alphabet_size - 1; 23567 var max_bits = 0; 23568 var symbols = new Int32Array(4); 23569 var num_symbols = br.readBits(2) + 1; 23570 while (max_bits_counter) { 23571 max_bits_counter >>= 1; 23572 ++max_bits; 23573 } 23574 for (i2 = 0; i2 < num_symbols; ++i2) { 23575 symbols[i2] = br.readBits(max_bits) % alphabet_size; 23576 code_lengths[symbols[i2]] = 2; 23577 } 23578 code_lengths[symbols[0]] = 1; 23579 switch (num_symbols) { 23580 case 1: 23581 break; 23582 case 3: 23583 if (symbols[0] === symbols[1] || symbols[0] === symbols[2] || symbols[1] === symbols[2]) { 23584 throw new Error( 23585 "[ReadHuffmanCode] invalid symbols" 23586 ); 23587 } 23588 break; 23589 case 2: 23590 if (symbols[0] === symbols[1]) { 23591 throw new Error( 23592 "[ReadHuffmanCode] invalid symbols" 23593 ); 23594 } 23595 code_lengths[symbols[1]] = 1; 23596 break; 23597 case 4: 23598 if (symbols[0] === symbols[1] || symbols[0] === symbols[2] || symbols[0] === symbols[3] || symbols[1] === symbols[2] || symbols[1] === symbols[3] || symbols[2] === symbols[3]) { 23599 throw new Error( 23600 "[ReadHuffmanCode] invalid symbols" 23601 ); 23602 } 23603 if (br.readBits(1)) { 23604 code_lengths[symbols[2]] = 3; 23605 code_lengths[symbols[3]] = 3; 23606 } else { 23607 code_lengths[symbols[0]] = 2; 23608 } 23609 break; 23610 } 23611 } else { 23612 var i2; 23613 var code_length_code_lengths = new Uint8Array( 23614 CODE_LENGTH_CODES 23615 ); 23616 var space = 32; 23617 var num_codes = 0; 23618 var huff = [ 23619 new HuffmanCode(2, 0), 23620 new HuffmanCode(2, 4), 23621 new HuffmanCode(2, 3), 23622 new HuffmanCode(3, 2), 23623 new HuffmanCode(2, 0), 23624 new HuffmanCode(2, 4), 23625 new HuffmanCode(2, 3), 23626 new HuffmanCode(4, 1), 23627 new HuffmanCode(2, 0), 23628 new HuffmanCode(2, 4), 23629 new HuffmanCode(2, 3), 23630 new HuffmanCode(3, 2), 23631 new HuffmanCode(2, 0), 23632 new HuffmanCode(2, 4), 23633 new HuffmanCode(2, 3), 23634 new HuffmanCode(4, 5) 23635 ]; 23636 for (i2 = simple_code_or_skip; i2 < CODE_LENGTH_CODES && space > 0; ++i2) { 23637 var code_len_idx = kCodeLengthCodeOrder[i2]; 23638 var p3 = 0; 23639 var v2; 23640 br.fillBitWindow(); 23641 p3 += br.val_ >>> br.bit_pos_ & 15; 23642 br.bit_pos_ += huff[p3].bits; 23643 v2 = huff[p3].value; 23644 code_length_code_lengths[code_len_idx] = v2; 23645 if (v2 !== 0) { 23646 space -= 32 >> v2; 23647 ++num_codes; 23648 } 23649 } 23650 if (!(num_codes === 1 || space === 0)) 23651 throw new Error( 23652 "[ReadHuffmanCode] invalid num_codes or space" 23653 ); 23654 ReadHuffmanCodeLengths( 23655 code_length_code_lengths, 23656 alphabet_size, 23657 code_lengths, 23658 br 23659 ); 23660 } 23661 table_size = BrotliBuildHuffmanTable( 23662 tables, 23663 table, 23664 HUFFMAN_TABLE_BITS, 23665 code_lengths, 23666 alphabet_size 23667 ); 23668 if (table_size === 0) { 23669 throw new Error( 23670 "[ReadHuffmanCode] BuildHuffmanTable failed: " 23671 ); 23672 } 23673 return table_size; 23674 } 23675 function ReadBlockLength(table, index2, br) { 23676 var code; 23677 var nbits; 23678 code = ReadSymbol(table, index2, br); 23679 nbits = Prefix.kBlockLengthPrefixCode[code].nbits; 23680 return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits); 23681 } 23682 function TranslateShortCodes(code, ringbuffer, index2) { 23683 var val; 23684 if (code < NUM_DISTANCE_SHORT_CODES) { 23685 index2 += kDistanceShortCodeIndexOffset[code]; 23686 index2 &= 3; 23687 val = ringbuffer[index2] + kDistanceShortCodeValueOffset[code]; 23688 } else { 23689 val = code - NUM_DISTANCE_SHORT_CODES + 1; 23690 } 23691 return val; 23692 } 23693 function MoveToFront(v2, index2) { 23694 var value = v2[index2]; 23695 var i2 = index2; 23696 for (; i2; --i2) v2[i2] = v2[i2 - 1]; 23697 v2[0] = value; 23698 } 23699 function InverseMoveToFrontTransform(v2, v_len) { 23700 var mtf = new Uint8Array(256); 23701 var i2; 23702 for (i2 = 0; i2 < 256; ++i2) { 23703 mtf[i2] = i2; 23704 } 23705 for (i2 = 0; i2 < v_len; ++i2) { 23706 var index2 = v2[i2]; 23707 v2[i2] = mtf[index2]; 23708 if (index2) MoveToFront(mtf, index2); 23709 } 23710 } 23711 function HuffmanTreeGroup(alphabet_size, num_htrees) { 23712 this.alphabet_size = alphabet_size; 23713 this.num_htrees = num_htrees; 23714 this.codes = new Array( 23715 num_htrees + num_htrees * kMaxHuffmanTableSize[alphabet_size + 31 >>> 5] 23716 ); 23717 this.htrees = new Uint32Array(num_htrees); 23718 } 23719 HuffmanTreeGroup.prototype.decode = function(br) { 23720 var i2; 23721 var table_size; 23722 var next = 0; 23723 for (i2 = 0; i2 < this.num_htrees; ++i2) { 23724 this.htrees[i2] = next; 23725 table_size = ReadHuffmanCode( 23726 this.alphabet_size, 23727 this.codes, 23728 next, 23729 br 23730 ); 23731 next += table_size; 23732 } 23733 }; 23734 function DecodeContextMap(context_map_size, br) { 23735 var out = { num_htrees: null, context_map: null }; 23736 var use_rle_for_zeros; 23737 var max_run_length_prefix = 0; 23738 var table; 23739 var i2; 23740 br.readMoreInput(); 23741 var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1; 23742 var context_map = out.context_map = new Uint8Array( 23743 context_map_size 23744 ); 23745 if (num_htrees <= 1) { 23746 return out; 23747 } 23748 use_rle_for_zeros = br.readBits(1); 23749 if (use_rle_for_zeros) { 23750 max_run_length_prefix = br.readBits(4) + 1; 23751 } 23752 table = []; 23753 for (i2 = 0; i2 < HUFFMAN_MAX_TABLE_SIZE; i2++) { 23754 table[i2] = new HuffmanCode(0, 0); 23755 } 23756 ReadHuffmanCode( 23757 num_htrees + max_run_length_prefix, 23758 table, 23759 0, 23760 br 23761 ); 23762 for (i2 = 0; i2 < context_map_size; ) { 23763 var code; 23764 br.readMoreInput(); 23765 code = ReadSymbol(table, 0, br); 23766 if (code === 0) { 23767 context_map[i2] = 0; 23768 ++i2; 23769 } else if (code <= max_run_length_prefix) { 23770 var reps = 1 + (1 << code) + br.readBits(code); 23771 while (--reps) { 23772 if (i2 >= context_map_size) { 23773 throw new Error( 23774 "[DecodeContextMap] i >= context_map_size" 23775 ); 23776 } 23777 context_map[i2] = 0; 23778 ++i2; 23779 } 23780 } else { 23781 context_map[i2] = code - max_run_length_prefix; 23782 ++i2; 23783 } 23784 } 23785 if (br.readBits(1)) { 23786 InverseMoveToFrontTransform( 23787 context_map, 23788 context_map_size 23789 ); 23790 } 23791 return out; 23792 } 23793 function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) { 23794 var ringbuffer = tree_type * 2; 23795 var index2 = tree_type; 23796 var type_code = ReadSymbol( 23797 trees, 23798 tree_type * HUFFMAN_MAX_TABLE_SIZE, 23799 br 23800 ); 23801 var block_type; 23802 if (type_code === 0) { 23803 block_type = ringbuffers[ringbuffer + (indexes[index2] & 1)]; 23804 } else if (type_code === 1) { 23805 block_type = ringbuffers[ringbuffer + (indexes[index2] - 1 & 1)] + 1; 23806 } else { 23807 block_type = type_code - 2; 23808 } 23809 if (block_type >= max_block_type) { 23810 block_type -= max_block_type; 23811 } 23812 block_types[tree_type] = block_type; 23813 ringbuffers[ringbuffer + (indexes[index2] & 1)] = block_type; 23814 ++indexes[index2]; 23815 } 23816 function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) { 23817 var rb_size = ringbuffer_mask + 1; 23818 var rb_pos = pos & ringbuffer_mask; 23819 var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK; 23820 var nbytes; 23821 if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) { 23822 while (len-- > 0) { 23823 br.readMoreInput(); 23824 ringbuffer[rb_pos++] = br.readBits(8); 23825 if (rb_pos === rb_size) { 23826 output.write(ringbuffer, rb_size); 23827 rb_pos = 0; 23828 } 23829 } 23830 return; 23831 } 23832 if (br.bit_end_pos_ < 32) { 23833 throw new Error( 23834 "[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32" 23835 ); 23836 } 23837 while (br.bit_pos_ < 32) { 23838 ringbuffer[rb_pos] = br.val_ >>> br.bit_pos_; 23839 br.bit_pos_ += 8; 23840 ++rb_pos; 23841 --len; 23842 } 23843 nbytes = br.bit_end_pos_ - br.bit_pos_ >> 3; 23844 if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) { 23845 var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos; 23846 for (var x2 = 0; x2 < tail; x2++) 23847 ringbuffer[rb_pos + x2] = br.buf_[br_pos + x2]; 23848 nbytes -= tail; 23849 rb_pos += tail; 23850 len -= tail; 23851 br_pos = 0; 23852 } 23853 for (var x2 = 0; x2 < nbytes; x2++) 23854 ringbuffer[rb_pos + x2] = br.buf_[br_pos + x2]; 23855 rb_pos += nbytes; 23856 len -= nbytes; 23857 if (rb_pos >= rb_size) { 23858 output.write(ringbuffer, rb_size); 23859 rb_pos -= rb_size; 23860 for (var x2 = 0; x2 < rb_pos; x2++) 23861 ringbuffer[x2] = ringbuffer[rb_size + x2]; 23862 } 23863 while (rb_pos + len >= rb_size) { 23864 nbytes = rb_size - rb_pos; 23865 if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) { 23866 throw new Error( 23867 "[CopyUncompressedBlockToOutput] not enough bytes" 23868 ); 23869 } 23870 output.write(ringbuffer, rb_size); 23871 len -= nbytes; 23872 rb_pos = 0; 23873 } 23874 if (br.input_.read(ringbuffer, rb_pos, len) < len) { 23875 throw new Error( 23876 "[CopyUncompressedBlockToOutput] not enough bytes" 23877 ); 23878 } 23879 br.reset(); 23880 } 23881 function JumpToByteBoundary(br) { 23882 var new_bit_pos = br.bit_pos_ + 7 & ~7; 23883 var pad_bits = br.readBits(new_bit_pos - br.bit_pos_); 23884 return pad_bits == 0; 23885 } 23886 function BrotliDecompressedSize(buffer) { 23887 var input = new BrotliInput(buffer); 23888 var br = new BrotliBitReader(input); 23889 DecodeWindowBits(br); 23890 var out = DecodeMetaBlockLength(br); 23891 return out.meta_block_length; 23892 } 23893 exports2.BrotliDecompressedSize = BrotliDecompressedSize; 23894 function BrotliDecompressBuffer(buffer, output_size) { 23895 var input = new BrotliInput(buffer); 23896 if (output_size == null) { 23897 output_size = BrotliDecompressedSize(buffer); 23898 } 23899 var output_buffer = new Uint8Array(output_size); 23900 var output = new BrotliOutput(output_buffer); 23901 BrotliDecompress(input, output); 23902 if (output.pos < output.buffer.length) { 23903 output.buffer = output.buffer.subarray( 23904 0, 23905 output.pos 23906 ); 23907 } 23908 return output.buffer; 23909 } 23910 exports2.BrotliDecompressBuffer = BrotliDecompressBuffer; 23911 function BrotliDecompress(input, output) { 23912 var i2; 23913 var pos = 0; 23914 var input_end = 0; 23915 var window_bits = 0; 23916 var max_backward_distance; 23917 var max_distance = 0; 23918 var ringbuffer_size; 23919 var ringbuffer_mask; 23920 var ringbuffer; 23921 var ringbuffer_end; 23922 var dist_rb = [16, 15, 11, 4]; 23923 var dist_rb_idx = 0; 23924 var prev_byte1 = 0; 23925 var prev_byte2 = 0; 23926 var hgroup = [ 23927 new HuffmanTreeGroup(0, 0), 23928 new HuffmanTreeGroup(0, 0), 23929 new HuffmanTreeGroup(0, 0) 23930 ]; 23931 var block_type_trees; 23932 var block_len_trees; 23933 var br; 23934 var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE; 23935 br = new BrotliBitReader(input); 23936 window_bits = DecodeWindowBits(br); 23937 max_backward_distance = (1 << window_bits) - 16; 23938 ringbuffer_size = 1 << window_bits; 23939 ringbuffer_mask = ringbuffer_size - 1; 23940 ringbuffer = new Uint8Array( 23941 ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength 23942 ); 23943 ringbuffer_end = ringbuffer_size; 23944 block_type_trees = []; 23945 block_len_trees = []; 23946 for (var x2 = 0; x2 < 3 * HUFFMAN_MAX_TABLE_SIZE; x2++) { 23947 block_type_trees[x2] = new HuffmanCode(0, 0); 23948 block_len_trees[x2] = new HuffmanCode(0, 0); 23949 } 23950 while (!input_end) { 23951 var meta_block_remaining_len = 0; 23952 var is_uncompressed; 23953 var block_length = [1 << 28, 1 << 28, 1 << 28]; 23954 var block_type = [0]; 23955 var num_block_types = [1, 1, 1]; 23956 var block_type_rb = [0, 1, 0, 1, 0, 1]; 23957 var block_type_rb_index = [0]; 23958 var distance_postfix_bits; 23959 var num_direct_distance_codes; 23960 var distance_postfix_mask; 23961 var num_distance_codes; 23962 var context_map = null; 23963 var context_modes = null; 23964 var num_literal_htrees; 23965 var dist_context_map = null; 23966 var num_dist_htrees; 23967 var context_offset = 0; 23968 var context_map_slice = null; 23969 var literal_htree_index = 0; 23970 var dist_context_offset = 0; 23971 var dist_context_map_slice = null; 23972 var dist_htree_index = 0; 23973 var context_lookup_offset1 = 0; 23974 var context_lookup_offset2 = 0; 23975 var context_mode; 23976 var htree_command; 23977 for (i2 = 0; i2 < 3; ++i2) { 23978 hgroup[i2].codes = null; 23979 hgroup[i2].htrees = null; 23980 } 23981 br.readMoreInput(); 23982 var _out = DecodeMetaBlockLength(br); 23983 meta_block_remaining_len = _out.meta_block_length; 23984 if (pos + meta_block_remaining_len > output.buffer.length) { 23985 var tmp = new Uint8Array( 23986 pos + meta_block_remaining_len 23987 ); 23988 tmp.set(output.buffer); 23989 output.buffer = tmp; 23990 } 23991 input_end = _out.input_end; 23992 is_uncompressed = _out.is_uncompressed; 23993 if (_out.is_metadata) { 23994 JumpToByteBoundary(br); 23995 for (; meta_block_remaining_len > 0; --meta_block_remaining_len) { 23996 br.readMoreInput(); 23997 br.readBits(8); 23998 } 23999 continue; 24000 } 24001 if (meta_block_remaining_len === 0) { 24002 continue; 24003 } 24004 if (is_uncompressed) { 24005 br.bit_pos_ = br.bit_pos_ + 7 & ~7; 24006 CopyUncompressedBlockToOutput( 24007 output, 24008 meta_block_remaining_len, 24009 pos, 24010 ringbuffer, 24011 ringbuffer_mask, 24012 br 24013 ); 24014 pos += meta_block_remaining_len; 24015 continue; 24016 } 24017 for (i2 = 0; i2 < 3; ++i2) { 24018 num_block_types[i2] = DecodeVarLenUint8(br) + 1; 24019 if (num_block_types[i2] >= 2) { 24020 ReadHuffmanCode( 24021 num_block_types[i2] + 2, 24022 block_type_trees, 24023 i2 * HUFFMAN_MAX_TABLE_SIZE, 24024 br 24025 ); 24026 ReadHuffmanCode( 24027 kNumBlockLengthCodes, 24028 block_len_trees, 24029 i2 * HUFFMAN_MAX_TABLE_SIZE, 24030 br 24031 ); 24032 block_length[i2] = ReadBlockLength( 24033 block_len_trees, 24034 i2 * HUFFMAN_MAX_TABLE_SIZE, 24035 br 24036 ); 24037 block_type_rb_index[i2] = 1; 24038 } 24039 } 24040 br.readMoreInput(); 24041 distance_postfix_bits = br.readBits(2); 24042 num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits); 24043 distance_postfix_mask = (1 << distance_postfix_bits) - 1; 24044 num_distance_codes = num_direct_distance_codes + (48 << distance_postfix_bits); 24045 context_modes = new Uint8Array( 24046 num_block_types[0] 24047 ); 24048 for (i2 = 0; i2 < num_block_types[0]; ++i2) { 24049 br.readMoreInput(); 24050 context_modes[i2] = br.readBits(2) << 1; 24051 } 24052 var _o1 = DecodeContextMap( 24053 num_block_types[0] << kLiteralContextBits, 24054 br 24055 ); 24056 num_literal_htrees = _o1.num_htrees; 24057 context_map = _o1.context_map; 24058 var _o2 = DecodeContextMap( 24059 num_block_types[2] << kDistanceContextBits, 24060 br 24061 ); 24062 num_dist_htrees = _o2.num_htrees; 24063 dist_context_map = _o2.context_map; 24064 hgroup[0] = new HuffmanTreeGroup( 24065 kNumLiteralCodes, 24066 num_literal_htrees 24067 ); 24068 hgroup[1] = new HuffmanTreeGroup( 24069 kNumInsertAndCopyCodes, 24070 num_block_types[1] 24071 ); 24072 hgroup[2] = new HuffmanTreeGroup( 24073 num_distance_codes, 24074 num_dist_htrees 24075 ); 24076 for (i2 = 0; i2 < 3; ++i2) { 24077 hgroup[i2].decode(br); 24078 } 24079 context_map_slice = 0; 24080 dist_context_map_slice = 0; 24081 context_mode = context_modes[block_type[0]]; 24082 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 24083 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 24084 htree_command = hgroup[1].htrees[0]; 24085 while (meta_block_remaining_len > 0) { 24086 var cmd_code; 24087 var range_idx; 24088 var insert_code; 24089 var copy_code; 24090 var insert_length; 24091 var copy_length; 24092 var distance_code; 24093 var distance; 24094 var context; 24095 var j2; 24096 var copy_dst; 24097 br.readMoreInput(); 24098 if (block_length[1] === 0) { 24099 DecodeBlockType( 24100 num_block_types[1], 24101 block_type_trees, 24102 1, 24103 block_type, 24104 block_type_rb, 24105 block_type_rb_index, 24106 br 24107 ); 24108 block_length[1] = ReadBlockLength( 24109 block_len_trees, 24110 HUFFMAN_MAX_TABLE_SIZE, 24111 br 24112 ); 24113 htree_command = hgroup[1].htrees[block_type[1]]; 24114 } 24115 --block_length[1]; 24116 cmd_code = ReadSymbol( 24117 hgroup[1].codes, 24118 htree_command, 24119 br 24120 ); 24121 range_idx = cmd_code >> 6; 24122 if (range_idx >= 2) { 24123 range_idx -= 2; 24124 distance_code = -1; 24125 } else { 24126 distance_code = 0; 24127 } 24128 insert_code = Prefix.kInsertRangeLut[range_idx] + (cmd_code >> 3 & 7); 24129 copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7); 24130 insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + br.readBits( 24131 Prefix.kInsertLengthPrefixCode[insert_code].nbits 24132 ); 24133 copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + br.readBits( 24134 Prefix.kCopyLengthPrefixCode[copy_code].nbits 24135 ); 24136 prev_byte1 = ringbuffer[pos - 1 & ringbuffer_mask]; 24137 prev_byte2 = ringbuffer[pos - 2 & ringbuffer_mask]; 24138 for (j2 = 0; j2 < insert_length; ++j2) { 24139 br.readMoreInput(); 24140 if (block_length[0] === 0) { 24141 DecodeBlockType( 24142 num_block_types[0], 24143 block_type_trees, 24144 0, 24145 block_type, 24146 block_type_rb, 24147 block_type_rb_index, 24148 br 24149 ); 24150 block_length[0] = ReadBlockLength( 24151 block_len_trees, 24152 0, 24153 br 24154 ); 24155 context_offset = block_type[0] << kLiteralContextBits; 24156 context_map_slice = context_offset; 24157 context_mode = context_modes[block_type[0]]; 24158 context_lookup_offset1 = Context.lookupOffsets[context_mode]; 24159 context_lookup_offset2 = Context.lookupOffsets[context_mode + 1]; 24160 } 24161 context = Context.lookup[context_lookup_offset1 + prev_byte1] | Context.lookup[context_lookup_offset2 + prev_byte2]; 24162 literal_htree_index = context_map[context_map_slice + context]; 24163 --block_length[0]; 24164 prev_byte2 = prev_byte1; 24165 prev_byte1 = ReadSymbol( 24166 hgroup[0].codes, 24167 hgroup[0].htrees[literal_htree_index], 24168 br 24169 ); 24170 ringbuffer[pos & ringbuffer_mask] = prev_byte1; 24171 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 24172 output.write( 24173 ringbuffer, 24174 ringbuffer_size 24175 ); 24176 } 24177 ++pos; 24178 } 24179 meta_block_remaining_len -= insert_length; 24180 if (meta_block_remaining_len <= 0) break; 24181 if (distance_code < 0) { 24182 var context; 24183 br.readMoreInput(); 24184 if (block_length[2] === 0) { 24185 DecodeBlockType( 24186 num_block_types[2], 24187 block_type_trees, 24188 2, 24189 block_type, 24190 block_type_rb, 24191 block_type_rb_index, 24192 br 24193 ); 24194 block_length[2] = ReadBlockLength( 24195 block_len_trees, 24196 2 * HUFFMAN_MAX_TABLE_SIZE, 24197 br 24198 ); 24199 dist_context_offset = block_type[2] << kDistanceContextBits; 24200 dist_context_map_slice = dist_context_offset; 24201 } 24202 --block_length[2]; 24203 context = (copy_length > 4 ? 3 : copy_length - 2) & 255; 24204 dist_htree_index = dist_context_map[dist_context_map_slice + context]; 24205 distance_code = ReadSymbol( 24206 hgroup[2].codes, 24207 hgroup[2].htrees[dist_htree_index], 24208 br 24209 ); 24210 if (distance_code >= num_direct_distance_codes) { 24211 var nbits; 24212 var postfix; 24213 var offset4; 24214 distance_code -= num_direct_distance_codes; 24215 postfix = distance_code & distance_postfix_mask; 24216 distance_code >>= distance_postfix_bits; 24217 nbits = (distance_code >> 1) + 1; 24218 offset4 = (2 + (distance_code & 1) << nbits) - 4; 24219 distance_code = num_direct_distance_codes + (offset4 + br.readBits(nbits) << distance_postfix_bits) + postfix; 24220 } 24221 } 24222 distance = TranslateShortCodes( 24223 distance_code, 24224 dist_rb, 24225 dist_rb_idx 24226 ); 24227 if (distance < 0) { 24228 throw new Error( 24229 "[BrotliDecompress] invalid distance" 24230 ); 24231 } 24232 if (pos < max_backward_distance && max_distance !== max_backward_distance) { 24233 max_distance = pos; 24234 } else { 24235 max_distance = max_backward_distance; 24236 } 24237 copy_dst = pos & ringbuffer_mask; 24238 if (distance > max_distance) { 24239 if (copy_length >= BrotliDictionary.minDictionaryWordLength && copy_length <= BrotliDictionary.maxDictionaryWordLength) { 24240 var offset4 = BrotliDictionary.offsetsByLength[copy_length]; 24241 var word_id = distance - max_distance - 1; 24242 var shift4 = BrotliDictionary.sizeBitsByLength[copy_length]; 24243 var mask = (1 << shift4) - 1; 24244 var word_idx = word_id & mask; 24245 var transform_idx = word_id >> shift4; 24246 offset4 += word_idx * copy_length; 24247 if (transform_idx < Transform.kNumTransforms) { 24248 var len = Transform.transformDictionaryWord( 24249 ringbuffer, 24250 copy_dst, 24251 offset4, 24252 copy_length, 24253 transform_idx 24254 ); 24255 copy_dst += len; 24256 pos += len; 24257 meta_block_remaining_len -= len; 24258 if (copy_dst >= ringbuffer_end) { 24259 output.write( 24260 ringbuffer, 24261 ringbuffer_size 24262 ); 24263 for (var _x26 = 0; _x26 < copy_dst - ringbuffer_end; _x26++) 24264 ringbuffer[_x26] = ringbuffer[ringbuffer_end + _x26]; 24265 } 24266 } else { 24267 throw new Error( 24268 "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len 24269 ); 24270 } 24271 } else { 24272 throw new Error( 24273 "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len 24274 ); 24275 } 24276 } else { 24277 if (distance_code > 0) { 24278 dist_rb[dist_rb_idx & 3] = distance; 24279 ++dist_rb_idx; 24280 } 24281 if (copy_length > meta_block_remaining_len) { 24282 throw new Error( 24283 "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len 24284 ); 24285 } 24286 for (j2 = 0; j2 < copy_length; ++j2) { 24287 ringbuffer[pos & ringbuffer_mask] = ringbuffer[pos - distance & ringbuffer_mask]; 24288 if ((pos & ringbuffer_mask) === ringbuffer_mask) { 24289 output.write( 24290 ringbuffer, 24291 ringbuffer_size 24292 ); 24293 } 24294 ++pos; 24295 --meta_block_remaining_len; 24296 } 24297 } 24298 prev_byte1 = ringbuffer[pos - 1 & ringbuffer_mask]; 24299 prev_byte2 = ringbuffer[pos - 2 & ringbuffer_mask]; 24300 } 24301 pos &= 1073741823; 24302 } 24303 output.write(ringbuffer, pos & ringbuffer_mask); 24304 } 24305 exports2.BrotliDecompress = BrotliDecompress; 24306 BrotliDictionary.init(); 24307 }, 24308 { 24309 "./bit_reader": 1, 24310 "./context": 2, 24311 "./dictionary": 6, 24312 "./huffman": 7, 24313 "./prefix": 9, 24314 "./streams": 10, 24315 "./transform": 11 24316 } 24317 ], 24318 4: [ 24319 function(require2, module2, exports2) { 24320 var base64 = require2("base64-js"); 24321 exports2.init = function() { 24322 var BrotliDecompressBuffer = require2("./decode").BrotliDecompressBuffer; 24323 var compressed = base64.toByteArray( 24324 require2("./dictionary.bin.js") 24325 ); 24326 return BrotliDecompressBuffer(compressed); 24327 }; 24328 }, 24329 { "./decode": 3, "./dictionary.bin.js": 5, "base64-js": 8 } 24330 ], 24331 5: [ 24332 function(require2, module2, exports2) { 24333 module2.exports = "W5/fcQLn5gKf2XUbAiQ1XULX+TZz6ADToDsgqk6qVfeC0e4m6OO2wcQ1J76ZBVRV1fRkEsdu//62zQsFEZWSTCnMhcsQKlS2qOhuVYYMGCkV0fXWEoMFbESXrKEZ9wdUEsyw9g4bJlEt1Y6oVMxMRTEVbCIwZzJzboK5j8m4YH02qgXYhv1V+PM435sLVxyHJihaJREEhZGqL03txGFQLm76caGO/ovxKvzCby/3vMTtX/459f0igi7WutnKiMQ6wODSoRh/8Lx1V3Q99MvKtwB6bHdERYRY0hStJoMjNeTsNX7bn+Y7e4EQ3bf8xBc7L0BsyfFPK43dGSXpL6clYC/I328h54/VYrQ5i0648FgbGtl837svJ35L3Mot/+nPlNpWgKx1gGXQYqX6n+bbZ7wuyCHKcUok12Xjqub7NXZGzqBx0SD+uziNf87t7ve42jxSKQoW3nyxVrWIGlFShhCKxjpZZ5MeGna0+lBkk+kaN8F9qFBAFgEogyMBdcX/T1W/WnMOi/7ycWUQloEBKGeC48MkiwqJkJO+12eQiOFHMmck6q/IjWW3RZlany23TBm+cNr/84/oi5GGmGBZWrZ6j+zykVozz5fT/QH/Da6WTbZYYPynVNO7kxzuNN2kxKKWche5WveitPKAecB8YcAHz/+zXLjcLzkdDSktNIDwZE9J9X+tto43oJy65wApM3mDzYtCwX9lM+N5VR3kXYo0Z3t0TtXfgBFg7gU8oN0Dgl7fZlUbhNll+0uuohRVKjrEd8egrSndy5/Tgd2gqjA4CAVuC7ESUmL3DZoGnfhQV8uwnpi8EGvAVVsowNRxPudck7+oqAUDkwZopWqFnW1riss0t1z6iCISVKreYGNvQcXv+1L9+jbP8cd/dPUiqBso2q+7ZyFBvENCkkVr44iyPbtOoOoCecWsiuqMSML5lv+vN5MzUr+Dnh73G7Q1YnRYJVYXHRJaNAOByiaK6CusgFdBPE40r0rvqXV7tksKO2DrHYXBTv8P5ysqxEx8VDXUDDqkPH6NNOV/a2WH8zlkXRELSa8P+heNyJBBP7PgsG1EtWtNef6/i+lcayzQwQCsduidpbKfhWUDgAEmyhGu/zVTacI6RS0zTABrOYueemnVa19u9fT23N/Ta6RvTpof5DWygqreCqrDAgM4LID1+1T/taU6yTFVLqXOv+/MuQOFnaF8vLMKD7tKWDoBdALgxF33zQccCcdHx8fKIVdW69O7qHtXpeGr9jbbpFA+qRMWr5hp0s67FPc7HAiLV0g0/peZlW7hJPYEhZyhpSwahnf93/tZgfqZWXFdmdXBzqxGHLrQKxoAY6fRoBhgCRPmmGueYZ5JexTVDKUIXzkG/fqp/0U3hAgQdJ9zumutK6nqWbaqvm1pgu03IYR+G+8s0jDBBz8cApZFSBeuWasyqo2OMDKAZCozS+GWSvL/HsE9rHxooe17U3s/lTE+VZAk4j3dp6uIGaC0JMiqR5CUsabPyM0dOYDR7Ea7ip4USZlya38YfPtvrX/tBlhHilj55nZ1nfN24AOAi9BVtz/Mbn8AEDJCqJgsVUa6nQnSxv2Fs7l/NlCzpfYEjmPrNyib/+t0ei2eEMjvNhLkHCZlci4WhBe7ePZTmzYqlY9+1pxtS4GB+5lM1BHT9tS270EWUDYFq1I0yY/fNiAk4bk9yBgmef/f2k6AlYQZHsNFnW8wBQxCd68iWv7/35bXfz3JZmfGligWAKRjIs3IpzxQ27vAglHSiOzCYzJ9L9A1CdiyFvyR66ucA4jKifu5ehwER26yV7HjKqn5Mfozo7Coxxt8LWWPT47BeMxX8p0Pjb7hZn+6bw7z3Lw+7653j5sI8CLu5kThpMlj1m4c2ch3jGcP1FsT13vuK3qjecKTZk2kHcOZY40UX+qdaxstZqsqQqgXz+QGF99ZJLqr3VYu4aecl1Ab5GmqS8k/GV5b95zxQ5d4EfXUJ6kTS/CXF/aiqKDOT1T7Jz5z0PwDUcwr9clLN1OJGCiKfqvah+h3XzrBOiLOW8wvn8gW6qE8vPxi+Efv+UH55T7PQFVMh6cZ1pZQlzJpKZ7P7uWvwPGJ6DTlR6wbyj3Iv2HyefnRo/dv7dNx+qaa0N38iBsR++Uil7Wd4afwDNsrzDAK4fXZwvEY/jdKuIKXlfrQd2C39dW7ntnRbIp9OtGy9pPBn/V2ASoi/2UJZfS+xuGLH8bnLuPlzdTNS6zdyk8Dt/h6sfOW5myxh1f+zf3zZ3MX/mO9cQPp5pOx967ZA6/pqHvclNfnUFF+rq+Vd7alKr6KWPcIDhpn6v2K6NlUu6LrKo8b/pYpU/Gazfvtwhn7tEOUuXht5rUJdSf6sLjYf0VTYDgwJ81yaqKTUYej/tbHckSRb/HZicwGJqh1mAHB/IuNs9dc9yuvF3D5Xocm3elWFdq5oEy70dYFit79yaLiNjPj5UUcVmZUVhQEhW5V2Z6Cm4HVH/R8qlamRYwBileuh07CbEce3TXa2JmXWBf+ozt319psboobeZhVnwhMZzOeQJzhpTDbP71Tv8HuZxxUI/+ma3XW6DFDDs4+qmpERwHGBd2edxwUKlODRdUWZ/g0GOezrbzOZauFMai4QU6GVHV6aPNBiBndHSsV4IzpvUiiYyg6OyyrL4Dj5q/Lw3N5kAwftEVl9rNd7Jk5PDij2hTH6wIXnsyXkKePxbmHYgC8A6an5Fob/KH5GtC0l4eFso+VpxedtJHdHpNm+Bvy4C79yVOkrZsLrQ3OHCeB0Ra+kBIRldUGlDCEmq2RwXnfyh6Dz+alk6eftI2n6sastRrGwbwszBeDRS/Fa/KwRJkCzTsLr/JCs5hOPE/MPLYdZ1F1fv7D+VmysX6NpOC8aU9F4Qs6HvDyUy9PvFGDKZ/P5101TYHFl8pjj6wm/qyS75etZhhfg0UEL4OYmHk6m6dO192AzoIyPSV9QedDA4Ml23rRbqxMPMxf7FJnDc5FTElVS/PyqgePzmwVZ26NWhRDQ+oaT7ly7ell4s3DypS1s0g+tOr7XHrrkZj9+x/mJBttrLx98lFIaRZzHz4aC7r52/JQ4VjHahY2/YVXZn/QC2ztQb/sY3uRlyc5vQS8nLPGT/n27495i8HPA152z7Fh5aFpyn1GPJKHuPL8Iw94DuW3KjkURAWZXn4EQy89xiKEHN1mk/tkM4gYDBxwNoYvRfE6LFqsxWJtPrDGbsnLMap3Ka3MUoytW0cvieozOmdERmhcqzG+3HmZv2yZeiIeQTKGdRT4HHNxekm1tY+/n06rGmFleqLscSERzctTKM6G9P0Pc1RmVvrascIxaO1CQCiYPE15bD7c3xSeW7gXxYjgxcrUlcbIvO0r+Yplhx0kTt3qafDOmFyMjgGxXu73rddMHpV1wMubyAGcf/v5dLr5P72Ta9lBF+fzMJrMycwv+9vnU3ANIl1cH9tfW7af8u0/HG0vV47jNFXzFTtaha1xvze/s8KMtCYucXc1nzfd/MQydUXn/b72RBt5wO/3jRcMH9BdhC/yctKBIveRYPrNpDWqBsO8VMmP+WvRaOcA4zRMR1PvSoO92rS7pYEv+fZfEfTMzEdM+6X5tLlyxExhqLRkms5EuLovLfx66de5fL2/yX02H52FPVwahrPqmN/E0oVXnsCKhbi/yRxX83nRbUKWhzYceXOntfuXn51NszJ6MO73pQf5Pl4in3ec4JU8hF7ppV34+mm9r1LY0ee/i1O1wpd8+zfLztE0cqBxggiBi5Bu95v9l3r9r/U5hweLn+TbfxowrWDqdJauKd8+q/dH8sbPkc9ttuyO94f7/XK/nHX46MPFLEb5qQlNPvhJ50/59t9ft3LXu7uVaWaO2bDrDCnRSzZyWvFKxO1+vT8MwwunR3bX0CkfPjqb4K9O19tn5X50PvmYpEwHtiW9WtzuV/s76B1zvLLNkViNd8ySxIl/3orfqP90TyTGaf7/rx8jQzeHJXdmh/N6YDvbvmTBwCdxfEQ1NcL6wNMdSIXNq7b1EUzRy1/Axsyk5p22GMG1b+GxFgbHErZh92wuvco0AuOLXct9hvw2nw/LqIcDRRmJmmZzcgUa7JpM/WV/S9IUfbF56TL2orzqwebdRD8nIYNJ41D/hz37Fo11p2Y21wzPcn713qVGhqtevStYfGH4n69OEJtPvbbLYWvscDqc3Hgnu166+tAyLnxrX0Y5zoYjV++1sI7t5kMr02KT/+uwtkc+rZLOf/qn/s3nYCf13Dg8/sB2diJgjGqjQ+TLhxbzyue2Ob7X6/9lUwW7a+lbznHzOYy8LKW1C/uRPbQY3KW/0gO9LXunHLvPL97afba9bFtc9hmz7GAttjVYlCvQAiOwAk/gC5+hkLEs6tr3AZKxLJtOEwk2dLxTYWsIB/j/ToWtIWzo906FrSG8iaqqqqqqiIiIiAgzMzMzNz+AyK+01/zi8n8S+Y1MjoRaQ80WU/G8MBlO+53VPXANrWm4wzGUVZUjjBJZVdhpcfkjsmcWaO+UEldXi1e+zq+HOsCpknYshuh8pOLISJun7TN0EIGW2xTnlOImeecnoGW4raxe2G1T3HEvfYUYMhG+gAFOAwh5nK8mZhwJMmN7r224QVsNFvZ87Z0qatvknklyPDK3Hy45PgVKXji52Wen4d4PlFVVYGnNap+fSpFbK90rYnhUc6n91Q3AY9E0tJOFrcfZtm/491XbcG/jsViUPPX76qmeuiz+qY1Hk7/1VPM405zWVuoheLUimpWYdVzCmUdKHebMdzgrYrb8mL2eeLSnRWHdonfZa8RsOU9F37w+591l5FLYHiOqWeHtE/lWrBHcRKp3uhtr8yXm8LU/5ms+NM6ZKsqu90cFZ4o58+k4rdrtB97NADFbwmEG7lXqvirhOTOqU14xuUF2myIjURcPHrPOQ4lmM3PeMg7bUuk0nnZi67bXsU6H8lhqIo8TaOrEafCO1ARK9PjC0QOoq2BxmMdgYB9G/lIb9++fqNJ2s7BHGFyBNmZAR8J3KCo012ikaSP8BCrf6VI0X5xdnbhHIO+B5rbOyB54zXkzfObyJ4ecwxfqBJMLFc7m59rNcw7hoHnFZ0b00zee+gTqvjm61Pb4xn0kcDX4jvHM0rBXZypG3DCKnD/Waa/ZtHmtFPgO5eETx+k7RrVg3aSwm2YoNXnCs3XPQDhNn+Fia6IlOOuIG6VJH7TP6ava26ehKHQa2T4N0tcZ9dPCGo3ZdnNltsHQbeYt5vPnJezV/cAeNypdml1vCHI8M81nSRP5Qi2+mI8v/sxiZru9187nRtp3f/42NemcONa+4eVC3PCZzc88aZh851CqSsshe70uPxeN/dmYwlwb3trwMrN1Gq8jbnApcVDx/yDPeYs5/7r62tsQ6lLg+DiFXTEhzR9dHqv0iT4tgj825W+H3XiRUNUZT2kR9Ri0+lp+UM3iQtS8uOE23Ly4KYtvqH13jghUntJRAewuzNLDXp8RxdcaA3cMY6TO2IeSFRXezeWIjCqyhsUdMYuCgYTZSKpBype1zRfq8FshvfBPc6BAQWl7/QxIDp3VGo1J3vn42OEs3qznws+YLRXbymyB19a9XBx6n/owcyxlEYyFWCi+kG9F+EyD/4yn80+agaZ9P7ay2Dny99aK2o91FkfEOY8hBwyfi5uwx2y5SaHmG+oq/zl1FX/8irOf8Y3vAcX/6uLP6A6nvMO24edSGPjQc827Rw2atX+z2bKq0CmW9mOtYnr5/AfDa1ZfPaXnKtlWborup7QYx+Or2uWb+N3N//2+yDcXMqIJdf55xl7/vsj4WoPPlxLxtVrkJ4w/tTe3mLdATOOYwxcq52w5Wxz5MbPdVs5O8/lhfE7dPj0bIiPQ3QV0iqm4m3YX8hRfc6jQ3fWepevMqUDJd86Z4vwM40CWHnn+WphsGHfieF02D3tmZvpWD+kBpNCFcLnZhcmmrhpGzzbdA+sQ1ar18OJD87IOKOFoRNznaHPNHUfUNhvY1iU+uhvEvpKHaUn3qK3exVVyX4joipp3um7FmYJWmA+WbIDshRpbVRx5/nqstCgy87FGbfVB8yDGCqS+2qCsnRwnSAN6zgzxfdB2nBT/vZ4/6uxb6oH8b4VBRxiIB93wLa47hG3w2SL/2Z27yOXJFwZpSJaBYyvajA7vRRYNKqljXKpt/CFD/tSMr18DKKbwB0xggBePatl1nki0yvqW5zchlyZmJ0OTxJ3D+fsYJs/mxYN5+Le5oagtcl+YsVvy8kSjI2YGvGjvmpkRS9W2dtXqWnVuxUhURm1lKtou/hdEq19VBp9OjGvHEQSmrpuf2R24mXGheil8KeiANY8fW1VERUfBImb64j12caBZmRViZHbeVMjCrPDg9A90IXrtnsYCuZtRQ0PyrKDjBNOsPfKsg1pA02gHlVr0OXiFhtp6nJqXVzcbfM0KnzC3ggOENPE9VBdmHKN6LYaijb4wXxJn5A0FSDF5j+h1ooZx885Jt3ZKzO5n7Z5WfNEOtyyPqQEnn7WLv5Fis3PdgMshjF1FRydbNyeBbyKI1oN1TRVrVK7kgsb/zjX4NDPIRMctVeaxVB38Vh1x5KbeJbU138AM5KzmZu3uny0ErygxiJF7GVXUrPzFxrlx1uFdAaZFDN9cvIb74qD9tzBMo7L7WIEYK+sla1DVMHpF0F7b3+Y6S+zjvLeDMCpapmJo1weBWuxKF3rOocih1gun4BoJh1kWnV/Jmiq6uOhK3VfKxEHEkafjLgK3oujaPzY6SXg8phhL4TNR1xvJd1Wa0aYFfPUMLrNBDCh4AuGRTbtKMc6Z1Udj8evY/ZpCuMAUefdo69DZUngoqE1P9A3PJfOf7WixCEj+Y6t7fYeHbbxUAoFV3M89cCKfma3fc1+jKRe7MFWEbQqEfyzO2x/wrO2VYH7iYdQ9BkPyI8/3kXBpLaCpU7eC0Yv/am/tEDu7HZpqg0EvHo0nf/R/gRzUWy33/HXMJQeu1GylKmOkXzlCfGFruAcPPhaGqZOtu19zsJ1SO2Jz4Ztth5cBX6mRQwWmDwryG9FUMlZzNckMdK+IoMJv1rOWnBamS2w2KHiaPMPLC15hCZm4KTpoZyj4E2TqC/P6r7/EhnDMhKicZZ1ZwxuC7DPzDGs53q8gXaI9kFTK+2LTq7bhwsTbrMV8Rsfua5lMS0FwbTitUVnVa1yTb5IX51mmYnUcP9wPr8Ji1tiYJeJV9GZTrQhF7vvdU2OTU42ogJ9FDwhmycI2LIg++03C6scYhUyUuMV5tkw6kGUoL+mjNC38+wMdWNljn6tGPpRES7veqrSn5TRuv+dh6JVL/iDHU1db4c9WK3++OrH3PqziF916UMUKn8G67nN60GfWiHrXYhUG3yVWmyYak59NHj8t1smG4UDiWz2rPHNrKnN4Zo1LBbr2/eF9YZ0n0blx2nG4X+EKFxvS3W28JESD+FWk61VCD3z/URGHiJl++7TdBwkCj6tGOH3qDb0QqcOF9Kzpj0HUb/KyFW3Yhj2VMKJqGZleFBH7vqvf7WqLC3XMuHV8q8a4sTFuxUtkD/6JIBvKaVjv96ndgruKZ1k/BHzqf2K9fLk7HGXANyLDd1vxkK/i055pnzl+zw6zLnwXlVYVtfmacJgEpRP1hbGgrYPVN6v2lG+idQNGmwcKXu/8xEj/P6qe/sB2WmwNp6pp8jaISMkwdleFXYK55NHWLTTbutSUqjBfDGWo/Yg918qQ+8BRZSAHZbfuNZz2O0sov1Ue4CWlVg3rFhM3Kljj9ksGd/NUhk4nH+a5UN2+1i8+NM3vRNp7uQ6sqexSCukEVlVZriHNqFi5rLm9TMWa4qm3idJqppQACol2l4VSuvWLfta4JcXy3bROPNbXOgdOhG47LC0CwW/dMlSx4Jf17aEU3yA1x9p+Yc0jupXgcMuYNku64iYOkGToVDuJvlbEKlJqsmiHbvNrIVZEH+yFdF8DbleZ6iNiWwMqvtMp/mSpwx5KxRrT9p3MAPTHGtMbfvdFhyj9vhaKcn3At8Lc16Ai+vBcSp1ztXi7rCJZx/ql7TXcclq6Q76UeKWDy9boS0WHIjUuWhPG8LBmW5y2rhuTpM5vsLt+HOLh1Yf0DqXa9tsfC+kaKt2htA0ai/L2i7RKoNjEwztkmRU0GfgW1TxUvPFhg0V7DdfWJk5gfrccpYv+MA9M0dkGTLECeYwUixRzjRFdmjG7zdZIl3XKB9YliNKI31lfa7i2JG5C8Ss+rHe0D7Z696/V3DEAOWHnQ9yNahMUl5kENWS6pHKKp2D1BaSrrHdE1w2qNxIztpXgUIrF0bm15YML4b6V1k+GpNysTahKMVrrS85lTVo9OGJ96I47eAy5rYWpRf/mIzeoYU1DKaQCTUVwrhHeyNoDqHel+lLxr9WKzhSYw7vrR6+V5q0pfi2k3L1zqkubY6rrd9ZLvSuWNf0uqnkY+FpTvFzSW9Fp0b9l8JA7THV9eCi/PY/SCZIUYx3BU2alj7Cm3VV6eYpios4b6WuNOJdYXUK3zTqj5CVG2FqYM4Z7CuIU0qO05XR0d71FHM0YhZmJmTRfLlXEumN82BGtzdX0S19t1e+bUieK8zRmqpa4Qc5TSjifmaQsY2ETLjhI36gMR1+7qpjdXXHiceUekfBaucHShAOiFXmv3sNmGQyU5iVgnoocuonQXEPTFwslHtS8R+A47StI9wj0iSrtbi5rMysczFiImsQ+bdFClnFjjpXXwMy6O7qfjOr8Fb0a7ODItisjnn3EQO16+ypd1cwyaAW5Yzxz5QknfMO7643fXW/I9y3U2xH27Oapqr56Z/tEzglj6IbT6HEHjopiXqeRbe5mQQvxtcbDOVverN0ZgMdzqRYRjaXtMRd56Q4cZSmdPvZJdSrhJ1D9zNXPqAEqPIavPdfubt5oke2kmv0dztIszSv2VYuoyf1UuopbsYb+uX9h6WpwjpgtZ6fNNawNJ4q8O3CFoSbioAaOSZMx2GYaPYB+rEb6qjQiNRFQ76TvwNFVKD+BhH9VhcKGsXzmMI7BptU/CNWolM7YzROvpFAntsiWJp6eR2d3GarcYShVYSUqhmYOWj5E96NK2WvmYNTeY7Zs4RUEdv9h9QT4EseKt6LzLrqEOs3hxAY1MaNWpSa6zZx8F3YOVeCYMS88W+CYHDuWe4yoc6YK+djDuEOrBR5lvh0r+Q9uM88lrjx9x9AtgpQVNE8r+3O6Gvw59D+kBF/UMXyhliYUtPjmvXGY6Dk3x+kEOW+GtdMVC4EZTqoS/jmR0P0LS75DOc/w2vnri97M4SdbZ8qeU7gg8DVbERkU5geaMQO3mYrSYyAngeUQqrN0C0/vsFmcgWNXNeidsTAj7/4MncJR0caaBUpbLK1yBCBNRjEv6KvuVSdpPnEMJdsRRtqJ+U8tN1gXA4ePHc6ZT0eviI73UOJF0fEZ8YaneAQqQdGphNvwM4nIqPnXxV0xA0fnCT+oAhJuyw/q8jO0y8CjSteZExwBpIN6SvNp6A5G/abi6egeND/1GTguhuNjaUbbnSbGd4L8937Ezm34Eyi6n1maeOBxh3PI0jzJDf5mh/BsLD7F2GOKvlA/5gtvxI3/eV4sLfKW5Wy+oio+es/u6T8UU+nsofy57Icb/JlZHPFtCgd/x+bwt3ZT+xXTtTtTrGAb4QehC6X9G+8YT+ozcLxDsdCjsuOqwPFnrdLYaFc92Ui0m4fr39lYmlCaqTit7G6O/3kWDkgtXjNH4BiEm/+jegQnihOtfffn33WxsFjhfMd48HT+f6o6X65j7XR8WLSHMFkxbvOYsrRsF1bowDuSQ18Mkxk4qz2zoGPL5fu9h2Hqmt1asl3Q3Yu3szOc+spiCmX4AETBM3pLoTYSp3sVxahyhL8eC4mPN9k2x3o0xkiixIzM3CZFzf5oR4mecQ5+ax2wCah3/crmnHoqR0+KMaOPxRif1oEFRFOO/kTPPmtww+NfMXxEK6gn6iU32U6fFruIz8Q4WgljtnaCVTBgWx7diUdshC9ZEa5yKpRBBeW12r/iNc/+EgNqmhswNB8SBoihHXeDF7rrWDLcmt3V8GYYN7pXRy4DZjj4DJuUBL5iC3DQAaoo4vkftqVTYRGLS3mHZ7gdmdTTqbgNN/PTdTCOTgXolc88MhXAEUMdX0iy1JMuk5wLsgeu0QUYlz2S4skTWwJz6pOm/8ihrmgGfFgri+ZWUK2gAPHgbWa8jaocdSuM4FJYoKicYX/ZSENkg9Q1ZzJfwScfVnR2DegOGwCvmogaWJCLQepv9WNlU6QgsmOwICquU28Mlk3d9W5E81lU/5Ez0LcX6lwKMWDNluNKfBDUy/phJgBcMnfkh9iRxrdOzgs08JdPB85Lwo+GUSb4t3nC+0byqMZtO2fQJ4U2zGIr49t/28qmmGv2RanDD7a3FEcdtutkW8twwwlUSpb8QalodddbBfNHKDQ828BdE7OBgFdiKYohLawFYqpybQoxATZrheLhdI7+0Zlu9Q1myRcd15r9UIm8K2LGJxqTegntqNVMKnf1a8zQiyUR1rxoqjiFxeHxqFcYUTHfDu7rhbWng6qOxOsI+5A1p9mRyEPdVkTlE24vY54W7bWc6jMgZvNXdfC9/9q7408KDsbdL7Utz7QFSDetz2picArzrdpL8OaCHC9V26RroemtDZ5yNM/KGkWMyTmfnInEvwtSD23UcFcjhaE3VKzkoaEMKGBft4XbIO6forTY1lmGQwVmKicBCiArDzE+1oIxE08fWeviIOD5TznqH+OoHadvoOP20drMPe5Irg3XBQziW2XDuHYzjqQQ4wySssjXUs5H+t3FWYMHppUnBHMx/nYIT5d7OmjDbgD9F6na3m4l7KdkeSO3kTEPXafiWinogag7b52taiZhL1TSvBFmEZafFq2H8khQaZXuitCewT5FBgVtPK0j4xUHPfUz3Q28eac1Z139DAP23dgki94EC8vbDPTQC97HPPSWjUNG5tWKMsaxAEMKC0665Xvo1Ntd07wCLNf8Q56mrEPVpCxlIMVlQlWRxM3oAfpgIc+8KC3rEXUog5g06vt7zgXY8grH7hhwVSaeuvC06YYRAwpbyk/Unzj9hLEZNs2oxPQB9yc+GnL6zTgq7rI++KDJwX2SP8Sd6YzTuw5lV/kU6eQxRD12omfQAW6caTR4LikYkBB1CMOrvgRr/VY75+NSB40Cni6bADAtaK+vyxVWpf9NeKJxN2KYQ8Q2xPB3K1s7fuhvWbr2XpgW044VD6DRs0qXoqKf1NFsaGvKJc47leUV3pppP/5VTKFhaGuol4Esfjf5zyCyUHmHthChcYh4hYLQF+AFWsuq4t0wJyWgdwQVOZiV0efRHPoK5+E1vjz9wTJmVkITC9oEstAsyZSgE/dbicwKr89YUxKZI+owD205Tm5lnnmDRuP/JnzxX3gMtlrcX0UesZdxyQqYQuEW4R51vmQ5xOZteUd8SJruMlTUzhtVw/Nq7eUBcqN2/HVotgfngif60yKEtoUx3WYOZlVJuJOh8u59fzSDPFYtQgqDUAGyGhQOAvKroXMcOYY0qjnStJR/G3aP+Jt1sLVlGV8POwr/6OGsqetnyF3TmTqZjENfnXh51oxe9qVUw2M78EzAJ+IM8lZ1MBPQ9ZWSVc4J3mWSrLKrMHReA5qdGoz0ODRsaA+vwxXA2cAM4qlfzBJA6581m4hzxItQw5dxrrBL3Y6kCbUcFxo1S8jyV44q//+7ASNNudZ6xeaNOSIUffqMn4A9lIjFctYn2gpEPAb3f7p3iIBN8H14FUGQ9ct2hPsL+cEsTgUrR47uJVN4n4wt/wgfwwHuOnLd4yobkofy8JvxSQTA7rMpDIc608SlZFJfZYcmbT0tAHpPE8MrtQ42siTUNWxqvWZOmvu9f0JPoQmg+6l7sZWwyfi6PXkxJnwBraUG0MYG4zYHQz3igy/XsFkx5tNQxw43qvI9dU3f0DdhOUlHKjmi1VAr2Kiy0HZwD8VeEbhh0OiDdMYspolQsYdSwjCcjeowIXNZVUPmL2wwIkYhmXKhGozdCJ4lRKbsf4NBh/XnQoS92NJEWOVOFs2YhN8c5QZFeK0pRdAG40hqvLbmoSA8xQmzOOEc7wLcme9JOsjPCEgpCwUs9E2DohMHRhUeyGIN6TFvrbny8nDuilsDpzrH5mS76APoIEJmItS67sQJ+nfwddzmjPxcBEBBCw0kWDwd0EZCkNeOD7NNQhtBm7KHL9mRxj6U1yWU2puzlIDtpYxdH4ZPeXBJkTGAJfUr/oTCz/iypY6uXaR2V1doPxJYlrw2ghH0D5gbrhFcIxzYwi4a/4hqVdf2DdxBp6vGYDjavxMAAoy+1+3aiO6S3W/QAKNVXagDtvsNtx7Ks+HKgo6U21B+QSZgIogV5Bt+BnXisdVfy9VyXV+2P5fMuvdpAjM1o/K9Z+XnE4EOCrue+kcdYHqAQ0/Y/OmNlQ6OI33jH/uD1RalPaHpJAm2av0/xtpqdXVKNDrc9F2izo23Wu7firgbURFDNX9eGGeYBhiypyXZft2j3hTvzE6PMWKsod//rEILDkzBXfi7xh0eFkfb3/1zzPK/PI5Nk3FbZyTl4mq5BfBoVoqiPHO4Q4QKZAlrQ3MdNfi3oxIjvsM3kAFv3fdufurqYR3PSwX/mpGy/GFI/B2MNPiNdOppWVbs/gjF3YH+QA9jMhlAbhvasAHstB0IJew09iAkmXHl1/TEj+jvHOpOGrPRQXbPADM+Ig2/OEcUcpgPTItMtW4DdqgfYVI/+4hAFWYjUGpOP/UwNuB7+BbKOcALbjobdgzeBQfjgNSp2GOpxzGLj70Vvq5cw2AoYENwKLUtJUX8sGRox4dVa/TN4xKwaKcl9XawQR/uNus700Hf17pyNnezrUgaY9e4MADhEDBpsJT6y1gDJs1q6wlwGhuUzGR7C8kgpjPyHWwsvrf3yn1zJEIRa5eSxoLAZOCR9xbuztxFRJW9ZmMYfCFJ0evm9F2fVnuje92Rc4Pl6A8bluN8MZyyJGZ0+sNSb//DvAFxC2BqlEsFwccWeAl6CyBcQV1bx4mQMBP1Jxqk1EUADNLeieS2dUFbQ/c/kvwItbZ7tx0st16viqd53WsRmPTKv2AD8CUnhtPWg5aUegNpsYgasaw2+EVooeNKmrW3MFtj76bYHJm5K9gpAXZXsE5U8DM8XmVOSJ1F1WnLy6nQup+jx52bAb+rCq6y9WXl2B2oZDhfDkW7H3oYfT/4xx5VncBuxMXP2lNfhUVQjSSzSRbuZFE4vFawlzveXxaYKVs8LpvAb8IRYF3ZHiRnm0ADeNPWocwxSzNseG7NrSEVZoHdKWqaGEBz1N8Pt7kFbqh3LYmAbm9i1IChIpLpM5AS6mr6OAPHMwwznVy61YpBYX8xZDN/a+lt7n+x5j4bNOVteZ8lj3hpAHSx1VR8vZHec4AHO9XFCdjZ9eRkSV65ljMmZVzaej2qFn/qt1lvWzNZEfHxK3qOJrHL6crr0CRzMox5f2e8ALBB4UGFZKA3tN6F6IXd32GTJXGQ7DTi9j/dNcLF9jCbDcWGKxoKTYblIwbLDReL00LRcDPMcQuXLMh5YzgtfjkFK1DP1iDzzYYVZz5M/kWYRlRpig1htVRjVCknm+h1M5LiEDXOyHREhvzCGpFZjHS0RsK27o2avgdilrJkalWqPW3D9gmwV37HKmfM3F8YZj2ar+vHFvf3B8CRoH4kDHIK9mrAg+owiEwNjjd9V+FsQKYR8czJrUkf7Qoi2YaW6EVDZp5zYlqiYtuXOTHk4fAcZ7qBbdLDiJq0WNV1l2+Hntk1mMWvxrYmc8kIx8G3rW36J6Ra4lLrTOCgiOihmow+YnzUT19jbV2B3RWqSHyxkhmgsBqMYWvOcUom1jDQ436+fcbu3xf2bbeqU/ca+C4DOKE+e3qvmeMqW3AxejfzBRFVcwVYPq4L0APSWWoJu+5UYX4qg5U6YTioqQGPG9XrnuZ/BkxuYpe6Li87+18EskyQW/uA+uk2rpHpr6hut2TlVbKgWkFpx+AZffweiw2+VittkEyf/ifinS/0ItRL2Jq3tQOcxPaWO2xrG68GdFoUpZgFXaP2wYVtRc6xYCfI1CaBqyWpg4bx8OHBQwsV4XWMibZZ0LYjWEy2IxQ1mZrf1/UNbYCJplWu3nZ4WpodIGVA05d+RWSS+ET9tH3RfGGmNI1cIY7evZZq7o+a0bjjygpmR3mVfalkT/SZGT27Q8QGalwGlDOS9VHCyFAIL0a1Q7JiW3saz9gqY8lqKynFrPCzxkU4SIfLc9VfCI5edgRhDXs0edO992nhTKHriREP1NJC6SROMgQ0xO5kNNZOhMOIT99AUElbxqeZF8A3xrfDJsWtDnUenAHdYWSwAbYjFqQZ+D5gi3hNK8CSxU9i6f6ClL9IGlj1OPMQAsr84YG6ijsJpCaGWj75c3yOZKBB9mNpQNPUKkK0D6wgLH8MGoyRxTX6Y05Q4AnYNXMZwXM4eij/9WpsM/9CoRnFQXGR6MEaY+FXvXEO3RO0JaStk6OXuHVATHJE+1W+TU3bSZ2ksMtqjO0zfSJCdBv7y2d8DMx6TfVme3q0ZpTKMMu4YL/t7ciTNtdDkwPogh3Cnjx7qk08SHwf+dksZ7M2vCOlfsF0hQ6J4ehPCaHTNrM/zBSOqD83dBEBCW/F/LEmeh0nOHd7oVl3/Qo/9GUDkkbj7yz+9cvvu+dDAtx8NzCDTP4iKdZvk9MWiizvtILLepysflSvTLFBZ37RLwiriqyRxYv/zrgFd/9XVHh/OmzBvDX4mitMR/lUavs2Vx6cR94lzAkplm3IRNy4TFfu47tuYs9EQPIPVta4P64tV+sZ7n3ued3cgEx2YK+QL5+xms6osk8qQbTyuKVGdaX9FQqk6qfDnT5ykxk0VK7KZ62b6DNDUfQlqGHxSMKv1P0XN5BqMeKG1P4Wp5QfZDUCEldppoX0U6ss2jIko2XpURKCIhfaOqLPfShdtS37ZrT+jFRSH2xYVV1rmT/MBtRQhxiO4MQ3iAGlaZi+9PWBEIXOVnu9jN1f921lWLZky9bqbM3J2MAAI9jmuAx3gyoEUa6P2ivs0EeNv/OR+AX6q5SW6l5HaoFuS6jr6yg9limu+P0KYKzfMXWcQSfTXzpOzKEKpwI3YGXZpSSy2LTlMgfmFA3CF6R5c9xWEtRuCg2ZPUQ2Nb6dRFTNd4TfGHrnEWSKHPuRyiJSDAZ+KX0VxmSHjGPbQTLVpqixia2uyhQ394gBMt7C3ZAmxn/DJS+l1fBsAo2Eir/C0jG9csd4+/tp12pPc/BVJGaK9mfvr7M/CeztrmCO5qY06Edi4xAGtiEhnWAbzLy2VEyazE1J5nPmgU4RpW4Sa0TnOT6w5lgt3/tMpROigHHmexBGAMY0mdcDbDxWIz41NgdD6oxgHsJRgr5RnT6wZAkTOcStU4NMOQNemSO7gxGahdEsC+NRVGxMUhQmmM0llWRbbmFGHzEqLM4Iw0H7577Kyo+Zf+2cUFIOw93gEY171vQaM0HLwpjpdRR6Jz7V0ckE7XzYJ0TmY9znLdzkva0vNrAGGT5SUZ5uaHDkcGvI0ySpwkasEgZPMseYcu85w8HPdSNi+4T6A83iAwDbxgeFcB1ZM2iGXzFcEOUlYVrEckaOyodfvaYSQ7GuB4ISE0nYJc15X/1ciDTPbPCgYJK55VkEor4LvzL9S2WDy4xj+6FOqVyTAC2ZNowheeeSI5hA/02l8UYkv4nk9iaVn+kCVEUstgk5Hyq+gJm6R9vG3rhuM904he/hFmNQaUIATB1y3vw+OmxP4X5Yi6A5I5jJufHCjF9+AGNwnEllZjUco6XhsO5T5+R3yxz5yLVOnAn0zuS+6zdj0nTJbEZCbXJdtpfYZfCeCOqJHoE2vPPFS6eRLjIJlG69X93nfR0mxSFXzp1Zc0lt/VafDaImhUMtbnqWVb9M4nGNQLN68BHP7AR8Il9dkcxzmBv8PCZlw9guY0lurbBsmNYlwJZsA/B15/HfkbjbwPddaVecls/elmDHNW2r4crAx43feNkfRwsaNq/yyJ0d/p5hZ6AZajz7DBfUok0ZU62gCzz7x8eVfJTKA8IWn45vINLSM1q+HF9CV9qF3zP6Ml21kPPL3CXzkuYUlnSqT+Ij4tI/od5KwIs+tDajDs64owN7tOAd6eucGz+KfO26iNcBFpbWA5732bBNWO4kHNpr9D955L61bvHCF/mwSrz6eQaDjfDEANqGMkFc+NGxpKZzCD2sj/JrHd+zlPQ8Iz7Q+2JVIiVCuCKoK/hlAEHzvk/Piq3mRL1rT/fEh9hoT5GJmeYswg1otiKydizJ/fS2SeKHVu6Z3JEHjiW8NaTQgP5xdBli8nC57XiN9hrquBu99hn9zqwo92+PM2JXtpeVZS0PdqR5mDyDreMMtEws+CpwaRyyzoYtfcvt9PJIW0fJVNNi/FFyRsea7peLvJrL+5b4GOXJ8tAr+ATk9f8KmiIsRhqRy0vFzwRV3Z5dZ3QqIU8JQ/uQpkJbjMUMFj2F9sCFeaBjI4+fL/oN3+LQgjI4zuAfQ+3IPIPFQBccf0clJpsfpnBxD84atwtupkGqKvrH7cGNl/QcWcSi6wcVDML6ljOgYbo+2BOAWNNjlUBPiyitUAwbnhFvLbnqw42kR3Yp2kv2dMeDdcGOX5kT4S6M44KHEB/SpCfl7xgsUvs+JNY9G3O2X/6FEt9FyAn57lrbiu+tl83sCymSvq9eZbe9mchL7MTf/Ta78e80zSf0hYY5eUU7+ff14jv7Xy8qjzfzzzvaJnrIdvFb5BLWKcWGy5/w7+vV2cvIfwHqdTB+RuJK5oj9mbt0Hy94AmjMjjwYNZlNS6uiyxNnwNyt3gdreLb64p/3+08nXkb92LTkkRgFOwk1oGEVllcOj5lv1hfAZywDows0944U8vUFw+A/nuVq/UCygsrmWIBnHyU01d0XJPwriEOvx/ISK6Pk4y2w0gmojZs7lU8TtakBAdne4v/aNxmMpK4VcGMp7si0yqsiolXRuOi1Z1P7SqD3Zmp0CWcyK4Ubmp2SXiXuI5nGLCieFHKHNRIlcY3Pys2dwMTYCaqlyWSITwr2oGXvyU3h1Pf8eQ3w1bnD7ilocVjYDkcXR3Oo1BXgMLTUjNw2xMVwjtp99NhSVc5aIWrDQT5DHPKtCtheBP4zHcw4dz2eRdTMamhlHhtfgqJJHI7NGDUw1XL8vsSeSHyKqDtqoAmrQqsYwvwi7HW3ojWyhIa5oz5xJTaq14NAzFLjVLR12rRNUQ6xohDnrWFb5bG9yf8aCD8d5phoackcNJp+Dw3Due3RM+5Rid7EuIgsnwgpX0rUWh/nqPtByMhMZZ69NpgvRTKZ62ViZ+Q7Dp5r4K0d7EfJuiy06KuIYauRh5Ecrhdt2QpTS1k1AscEHvapNbU3HL1F2TFyR33Wxb5MvH5iZsrn3SDcsxlnnshO8PLwmdGN+paWnQuORtZGX37uhFT64SeuPsx8UOokY6ON85WdQ1dki5zErsJGazcBOddWJEKqNPiJpsMD1GrVLrVY+AOdPWQneTyyP1hRX/lMM4ZogGGOhYuAdr7F/DOiAoc++cn5vlf0zkMUJ40Z1rlgv9BelPqVOpxKeOpzKdF8maK+1Vv23MO9k/8+qpLoxrIGH2EDQlnGmH8CD31G8QqlyQIcpmR5bwmSVw9/Ns6IHgulCRehvZ/+VrM60Cu/r3AontFfrljew74skYe2uyn7JKQtFQBQRJ9ryGic/zQOsbS4scUBctA8cPToQ3x6ZBQu6DPu5m1bnCtP8TllLYA0UTQNVqza5nfew3Mopy1GPUwG5jsl0OVXniPmAcmLqO5HG8Hv3nSLecE9oOjPDXcsTxoCBxYyzBdj4wmnyEV4kvFDunipS8SSkvdaMnTBN9brHUR8xdmmEAp/Pdqk9uextp1t+JrtXwpN/MG2w/qhRMpSNxQ1uhg/kKO30eQ/FyHUDkWHT8V6gGRU4DhDMxZu7xXij9Ui6jlpWmQCqJg3FkOTq3WKneCRYZxBXMNAVLQgHXSCGSqNdjebY94oyIpVjMYehAiFx/tqzBXFHZaL5PeeD74rW5OysFoUXY8sebUZleFTUa/+zBKVTFDopTReXNuZq47QjkWnxjirCommO4L/GrFtVV21EpMyw8wyThL5Y59d88xtlx1g1ttSICDwnof6lt/6zliPzgVUL8jWBjC0o2D6Kg+jNuThkAlaDJsq/AG2aKA//A76avw2KNqtv223P+Wq3StRDDNKFFgtsFukYt1GFDWooFVXitaNhb3RCyJi4cMeNjROiPEDb4k+G3+hD8tsg+5hhmSc/8t2JTSwYoCzAI75doq8QTHe+E/Tw0RQSUDlU+6uBeNN3h6jJGX/mH8oj0i3caCNsjvTnoh73BtyZpsflHLq6AfwJNCDX4S98h4+pCOhGKDhV3rtkKHMa3EG4J9y8zFWI4UsfNzC/Rl5midNn7gwoN9j23HGCQQ+OAZpTTPMdiVow740gIyuEtd0qVxMyNXhHcnuXRKdw5wDUSL358ktjMXmAkvIB73BLa1vfF9BAUZInPYJiwxqFWQQBVk7gQH4ojfUQ/KEjn+A/WR6EEe4CtbpoLe1mzHkajgTIoE0SLDHVauKhrq12zrAXBGbPPWKCt4DGedq3JyGRbmPFW32bE7T20+73BatV/qQhhBWfWBFHfhYWXjALts38FemnoT+9bn1jDBMcUMmYgSc0e7GQjv2MUBwLU8ionCpgV+Qrhg7iUIfUY6JFxR0Y+ZTCPM+rVuq0GNLyJXX6nrUTt8HzFBRY1E/FIm2EeVA9NcXrj7S6YYIChVQCWr/m2fYUjC4j0XLkzZ8GCSLfmkW3PB/xq+nlXsKVBOj7vTvqKCOMq7Ztqr3cQ+N8gBnPaAps+oGwWOkbuxnRYj/x/WjiDclVrs22xMK4qArE1Ztk1456kiJriw6abkNeRHogaPRBgbgF9Z8i/tbzWELN4CvbqtrqV9TtGSnmPS2F9kqOIBaazHYaJ9bi3AoDBvlZasMluxt0BDXfhp02Jn411aVt6S4TUB8ZgFDkI6TP6gwPY85w+oUQSsjIeXVminrwIdK2ZAawb8Se6XOJbOaliQxHSrnAeONDLuCnFejIbp4YDtBcQCwMsYiRZfHefuEJqJcwKTTJ8sx5hjHmJI1sPFHOr6W9AhZ2NAod38mnLQk1gOz2LCAohoQbgMbUK9RMEA3LkiF7Sr9tLZp6lkciIGhE2V546w3Mam53VtVkGbB9w0Yk2XiRnCmbpxmHr2k4eSC0RuNbjNsUfDIfc8DZvRvgUDe1IlKdZTzcT4ZGEb53dp8VtsoZlyXzLHOdAbsp1LPTVaHvLA0GYDFMbAW/WUBfUAdHwqLFAV+3uHvYWrCfhUOR2i89qvCBoOb48usAGdcF2M4aKn79k/43WzBZ+xR1L0uZfia70XP9soQReeuhZiUnXFDG1T8/OXNmssTSnYO+3kVLAgeiY719uDwL9FQycgLPessNihMZbAKG7qwPZyG11G1+ZA3jAX2yddpYfmaKBlmfcK/V0mwIRUDC0nJSOPUl2KB8h13F4dlVZiRhdGY5farwN+f9hEb1cRi41ZcGDn6Xe9MMSTOY81ULJyXIHSWFIQHstVYLiJEiUjktlHiGjntN5/btB8Fu+vp28zl2fZXN+dJDyN6EXhS+0yzqpl/LSJNEUVxmu7BsNdjAY0jVsAhkNuuY0E1G48ej25mSt+00yPbQ4SRCVkIwb6ISvYtmJRPz9Zt5dk76blf+lJwAPH5KDF+vHAmACLoCdG2Adii6dOHnNJnTmZtoOGO8Q1jy1veMw6gbLFToQmfJa7nT7Al89mRbRkZZQxJTKgK5Kc9INzmTJFp0tpAPzNmyL/F08bX3nhCumM/cR/2RPn9emZ3VljokttZD1zVWXlUIqEU7SLk5I0lFRU0AcENXBYazNaVzsVHA/sD3o9hm42wbHIRb/BBQTKzAi8s3+bMtpOOZgLdQzCYPfX3UUxKd1WYVkGH7lh/RBBgMZZwXzU9+GYxdBqlGs0LP+DZ5g2BWNh6FAcR944B+K/JTWI3t9YyVyRhlP4CCoUk/mmF7+r2pilVBjxXBHFaBfBtr9hbVn2zDuI0kEOG3kBx8CGdPOjX1ph1POOZJUO1JEGG0jzUy2tK4X0CgVNYhmkqqQysRNtKuPdCJqK3WW57kaV17vXgiyPrl4KEEWgiGF1euI4QkSFHFf0TDroQiLNKJiLbdhH0YBhriRNCHPxSqJmNNoketaioohqMglh6wLtEGWSM1EZbQg72h0UJAIPVFCAJOThpQGGdKfFovcwEeiBuZHN2Ob4uVM7+gwZLz1D9E7ta4RmMZ24OBBAg7Eh6dLXGofZ4U2TFOCQMKjwhVckjrydRS+YaqCw1kYt6UexuzbNEDyYLTZnrY1PzsHZJT4U+awO2xlqTSYu6n/U29O2wPXgGOEKDMSq+zTUtyc8+6iLp0ivav4FKx+xxVy4FxhIF/pucVDqpsVe2jFOfdZhTzLz2QjtzvsTCvDPU7bzDH2eXVKUV9TZ+qFtaSSxnYgYdXKwVreIgvWhT9eGDB2OvnWyPLfIIIfNnfIxU8nW7MbcH05nhlsYtaW9EZRsxWcKdEqInq1DiZPKCz7iGmAU9/ccnnQud2pNgIGFYOTAWjhIrd63aPDgfj8/sdlD4l+UTlcxTI9jbaMqqN0gQxSHs60IAcW3cH4p3V1aSciTKB29L1tz2eUQhRiTgTvmqc+sGtBNh4ky0mQJGsdycBREP+fAaSs1EREDVo5gvgi5+aCN7NECw30owbCc1mSpjiahyNVwJd1jiGgzSwfTpzf2c5XJvG/g1n0fH88KHNnf+u7ZiRMlXueSIsloJBUtW9ezvsx9grfsX/FNxnbxU1Lvg0hLxixypHKGFAaPu0xCD8oDTeFSyfRT6s8109GMUZL8m2xXp8X2dpPCWWdX84iga4BrTlOfqox4shqEgh/Ht4qRst52cA1xOIUuOxgfUivp6v5f8IVyaryEdpVk72ERAwdT4aoY1usBgmP+0m06Q216H/nubtNYxHaOIYjcach3A8Ez/zc0KcShhel0HCYjFsA0FjYqyJ5ZUH1aZw3+zWC0hLpM6GDfcAdn9fq2orPmZbW6XXrf+Krc9RtvII5jeD3dFoT1KwZJwxfUMvc5KLfn8rROW23Jw89sJ2a5dpB3qWDUBWF2iX8OCuKprHosJ2mflBR+Wqs86VvgI/XMnsqb97+VlKdPVysczPj8Jhzf+WCvGBHijAqYlavbF60soMWlHbvKT+ScvhprgeTln51xX0sF+Eadc/l2s2a5BgkVbHYyz0E85p0LstqH+gEGiR84nBRRFIn8hLSZrGwqjZ3E29cuGi+5Z5bp7EM8MWFa9ssS/vy4VrDfECSv7DSU84DaP0sXI3Ap4lWznQ65nQoTKRWU30gd7Nn8ZowUvGIx4aqyXGwmA/PB4qN8msJUODezUHEl0VP9uo+cZ8vPFodSIB4C7lQYjEFj8yu49C2KIV3qxMFYTevG8KqAr0TPlkbzHHnTpDpvpzziAiNFh8xiT7C/TiyH0EguUw4vxAgpnE27WIypV+uFN2zW7xniF/n75trs9IJ5amB1zXXZ1LFkJ6GbS/dFokzl4cc2mamVwhL4XU0Av5gDWAl+aEWhAP7t2VIwU+EpvfOPDcLASX7H7lZpXA2XQfbSlD4qU18NffNPoAKMNSccBfO9YVVgmlW4RydBqfHAV7+hrZ84WJGho6bNT0YMhxxLdOx/dwGj0oyak9aAkNJ8lRJzUuA8sR+fPyiyTgUHio5+Pp+YaKlHrhR41jY5NESPS3x+zTMe0S2HnLOKCOQPpdxKyviBvdHrCDRqO+l96HhhNBLXWv4yEMuEUYo8kXnYJM8oIgVM4XJ+xXOev4YbWeqsvgq0lmw4/PiYr9sYLt+W5EAuYSFnJEan8CwJwbtASBfLBBpJZiRPor/aCJBZsM+MhvS7ZepyHvU8m5WSmaZnxuLts8ojl6KkS8oSAHkq5GWlCB/NgJ5W3rO2Cj1MK7ahxsCrbTT3a0V/QQH+sErxV4XUWDHx0kkFy25bPmBMBQ6BU3HoHhhYcJB9JhP6NXUWKxnE0raXHB6U9KHpWdQCQI72qevp5fMzcm+AvC85rsynVQhruDA9fp9COe7N56cg1UKGSas89vrN+WlGLYTwi5W+0xYdKEGtGCeNJwXKDU0XqU5uQYnWsMwTENLGtbQMvoGjIFIEMzCRal4rnBAg7D/CSn8MsCvS+FDJJAzoiioJEhZJgAp9n2+1Yznr7H+6eT4YkJ9Mpj60ImcW4i4iHDLn9RydB8dx3QYm3rsX6n4VRrZDsYK6DCGwkwd5n3/INFEpk16fYpP6JtMQpqEMzcOfQGAHXBTEGzuLJ03GYQL9bmV2/7ExDlRf+Uvf1sM2frRtCWmal12pMgtonvSCtR4n1CLUZRdTHDHP1Otwqd+rcdlavnKjUB/OYXQHUJzpNyFoKpQK+2OgrEKpGyIgIBgn2y9QHnTJihZOpEvOKIoHAMGAXHmj21Lym39Mbiow4IF+77xNuewziNVBxr6KD5e+9HzZSBIlUa/AmsDFJFXeyrQakR3FwowTGcADJHcEfhGkXYNGSYo4dh4bxwLM+28xjiqkdn0/3R4UEkvcBrBfn/SzBc1XhKM2VPlJgKSorjDac96V2UnQYXl1/yZPT4DVelgO+soMjexXwYO58VLl5xInQUZI8jc3H2CPnCNb9X05nOxIy4MlecasTqGK6s2az4RjpF2cQP2G28R+7wDPsZDZC/kWtjdoHC7SpdPmqQrUAhMwKVuxCmYTiD9q/O7GHtZvPSN0CAUQN/rymXZNniYLlJDE70bsk6Xxsh4kDOdxe7A2wo7P9F5YvqqRDI6brf79yPCSp4I0jVoO4YnLYtX5nzspR5WB4AKOYtR1ujXbOQpPyYDvfRE3FN5zw0i7reehdi7yV0YDRKRllGCGRk5Yz+Uv1fYl2ZwrnGsqsjgAVo0xEUba8ohjaNMJNwTwZA/wBDWFSCpg1eUH8MYL2zdioxRTqgGQrDZxQyNzyBJPXZF0+oxITJAbj7oNC5JwgDMUJaM5GqlGCWc//KCIrI+aclEe4IA0uzv7cuj6GCdaJONpi13O544vbtIHBF+A+JeDFUQNy61Gki3rtyQ4aUywn6ru314/dkGiP8Iwjo0J/2Txs49ZkwEl4mx+iYUUO55I6pJzU4P+7RRs+DXZkyKUYZqVWrPF4I94m4Wx1tXeE74o9GuX977yvJ/jkdak8+AmoHVjI15V+WwBdARFV2IPirJgVMdsg1Pez2VNHqa7EHWdTkl3XTcyjG9BiueWFvQfXI8aWSkuuRmqi/HUuzqyvLJfNfs0txMqldYYflWB1BS31WkuPJGGwXUCpjiQSktkuBMWwHjSkQxeehqw1Kgz0Trzm7QbtgxiEPDVmWCNCAeCfROTphd1ZNOhzLy6XfJyG6Xgd5MCAZw4xie0Sj5AnY1/akDgNS9YFl3Y06vd6FAsg2gVQJtzG7LVq1OH2frbXNHWH/NY89NNZ4QUSJqL2yEcGADbT38X0bGdukqYlSoliKOcsSTuqhcaemUeYLLoI8+MZor2RxXTRThF1LrHfqf/5LcLAjdl4EERgUysYS2geE+yFdasU91UgUDsc2cSQ1ZoT9+uLOwdgAmifwQqF028INc2IQEDfTmUw3eZxvz7Ud1z3xc1PQfeCvfKsB9jOhRj7rFyb9XcDWLcYj0bByosychMezMLVkFiYcdBBQtvI6K0KRuOZQH2kBsYHJaXTkup8F0eIhO1/GcIwWKpr2mouB7g5TUDJNvORXPXa/mU8bh27TAZYBe2sKx4NSv5OjnHIWD2RuysCzBlUfeNXhDd2jxnHoUlheJ3jBApzURy0fwm2FwwsSU0caQGl0Kv8hopRQE211NnvtLRsmCNrhhpEDoNiZEzD2QdJWKbRRWnaFedXHAELSN0t0bfsCsMf0ktfBoXBoNA+nZN9+pSlmuzspFevmsqqcMllzzvkyXrzoA+Ryo1ePXpdGOoJvhyru+EBRsmOp7MXZ0vNUMUqHLUoKglg1p73sWeZmPc+KAw0pE2zIsFFE5H4192KwDvDxdxEYoDBDNZjbg2bmADTeUKK57IPD4fTYF4c6EnXx/teYMORBDtIhPJneiZny7Nv/zG+YmekIKCoxr6kauE2bZtBLufetNG0BtBY7f+/ImUypMBvdWu/Q7vTMRzw5aQGZWuc1V0HEsItFYMIBnoKGZ0xcarba/TYZq50kCaflFysYjA4EDKHqGdpYWdKYmm+a7TADmW35yfnOYpZYrkpVEtiqF0EujI00aeplNs2k+qyFZNeE3CDPL9P6b4PQ/kataHkVpLSEVGK7EX6rAa7IVNrvZtFvOA6okKvBgMtFDAGZOx88MeBcJ8AR3AgUUeIznAN6tjCUipGDZONm1FjWJp4A3QIzSaIOmZ7DvF/ysYYbM/fFDOV0jntAjRdapxJxL0eThpEhKOjCDDq2ks+3GrwxqIFKLe1WdOzII8XIOPGnwy6LKXVfpSDOTEfaRsGujhpS4hBIsMOqHbl16PJxc4EkaVu9wpEYlF/84NSv5Zum4drMfp9yXbzzAOJqqS4YkI4cBrFrC7bMPiCfgI3nNZAqkk3QOZqR+yyqx+nDQKBBBZ7QKrfGMCL+XpqFaBJU0wpkBdAhbR4hJsmT5aynlvkouoxm/NjD5oe6BzVIO9uktM+/5dEC5P7vZvarmuO/lKXz4sBabVPIATuKTrwbJP8XUkdM6uEctHKXICUJGjaZIWRbZp8czquQYfY6ynBUCfIU+gG6wqSIBmYIm9pZpXdaL121V7q0VjDjmQnXvMe7ysoEZnZL15B0SpxS1jjd83uNIOKZwu5MPzg2NhOx3xMOPYwEn2CUzbSrwAs5OAtrz3GAaUkJOU74XwjaYUmGJdZBS1NJVkGYrToINLKDjxcuIlyfVsKQSG/G4DyiO2SlQvJ0d0Ot1uOG5IFSAkq+PRVMgVMDvOIJMdqjeCFKUGRWBW9wigYvcbU7CQL/7meF2KZAaWl+4y9uhowAX7elogAvItAAxo2+SFxGRsHGEW9BnhlTuWigYxRcnVUBRQHV41LV+Fr5CJYV7sHfeywswx4XMtUx6EkBhR+q8AXXUA8uPJ73Pb49i9KG9fOljvXeyFj9ixgbo6CcbAJ7WHWqKHy/h+YjBwp6VcN7M89FGzQ04qbrQtgrOFybg3gQRTYG5xn73ArkfQWjCJROwy3J38Dx/D7jOa6BBNsitEw1wGq780EEioOeD+ZGp2J66ADiVGMayiHYucMk8nTK2zzT9CnEraAk95kQjy4k0GRElLL5YAKLQErJ5rp1eay9O4Fb6yJGm9U4FaMwPGxtKD6odIIHKoWnhKo1U8KIpFC+MVn59ZXmc7ZTBZfsg6FQ8W10YfTr4u0nYrpHZbZ1jXiLmooF0cOm0+mPnJBXQtepc7n0BqOipNCqI6yyloTeRShNKH04FIo0gcMk0H/xThyN4pPAWjDDkEp3lNNPRNVfpMI44CWRlRgViP64eK0JSRp0WUvCWYumlW/c58Vcz/yMwVcW5oYb9+26TEhwvbxiNg48hl1VI1UXTU//Eta+BMKnGUivctfL5wINDD0giQL1ipt6U7C9cd4+lgqY2lMUZ02Uv6Prs+ZEZer7ZfWBXVghlfOOrClwsoOFKzWEfz6RZu1eCs+K8fLvkts5+BX0gyrFYve0C3qHrn5U/Oh6D/CihmWIrY7HUZRhJaxde+tldu6adYJ+LeXupQw0XExC36RETdNFxcq9glMu4cNQSX9cqR/GQYp+IxUkIcNGWVU7ZtGa6P3XAyodRt0XeS3Tp01AnCh0ZbUh4VrSZeV9RWfSoWyxnY3hzcZ30G/InDq4wxRrEejreBxnhIQbkxenxkaxl+k7eLUQkUR6vKJ2iDFNGX3WmVA1yaOH+mvhBd+sE6vacQzFobwY5BqEAFmejwW5ne7HtVNolOUgJc8CsUxmc/LBi8N5mu9VsIA5HyErnS6zeCz7VLI9+n/hbT6hTokMXTVyXJRKSG2hd2labXTbtmK4fNH3IZBPreSA4FMeVouVN3zG5x9CiGpLw/3pceo4qGqp+rVp+z+7yQ98oEf+nyH4F3+J9IheDBa94Wi63zJbLBCIZm7P0asHGpIJt3PzE3m0S4YIWyXBCVXGikj8MudDPB/6Nm2v4IxJ5gU0ii0guy5SUHqGUYzTP0jIJU5E82RHUXtX4lDdrihBLdP1YaG1AGUC12rQKuIaGvCpMjZC9bWSCYnjDlvpWbkdXMTNeBHLKiuoozMGIvkczmP0aRJSJ8PYnLCVNhKHXBNckH79e8Z8Kc2wUej4sQZoH8qDRGkg86maW/ZQWGNnLcXmq3FlXM6ssR/3P6E/bHMvm6HLrv1yRixit25JsH3/IOr2UV4BWJhxXW5BJ6Xdr07n9kF3ZNAk6/Xpc5MSFmYJ2R7bdL8Kk7q1OU9Elg/tCxJ8giT27wSTySF0GOxg4PbYJdi/Nyia9Nn89CGDulfJemm1aiEr/eleGSN+5MRrVJ4K6lgyTTIW3i9cQ0dAi6FHt0YMbH3wDSAtGLSAccezzxHitt1QdhW36CQgPcA8vIIBh3/JNjf/Obmc2yzpk8edSlS4lVdwgW5vzbYEyFoF4GCBBby1keVNueHAH+evi+H7oOVfS3XuPQSNTXOONAbzJeSb5stwdQHl1ZjrGoE49I8+A9j3t+ahhQj74FCSWpZrj7wRSFJJnnwi1T9HL5qrCFW/JZq6P62XkMWTb+u4lGpKfmmwiJWx178GOG7KbrZGqyWwmuyKWPkNswkZ1q8uptUlviIi+AXh2bOOTOLsrtNkfqbQJeh24reebkINLkjut5r4d9GR/r8CBa9SU0UQhsnZp5cP+RqWCixRm7i4YRFbtZ4EAkhtNa6jHb6gPYQv7MKqkPLRmX3dFsK8XsRLVZ6IEVrCbmNDc8o5mqsogjAQfoC9Bc7R6gfw03m+lQpv6kTfhxscDIX6s0w+fBxtkhjXAXr10UouWCx3C/p/FYwJRS/AXRKkjOb5CLmK4XRe0+xeDDwVkJPZau52bzLEDHCqV0f44pPgKOkYKgTZJ33fmk3Tu8SdxJ02SHM8Fem5SMsWqRyi2F1ynfRJszcFKykdWlNqgDA/L9lKYBmc7Zu/q9ii1FPF47VJkqhirUob53zoiJtVVRVwMR34gV9iqcBaHbRu9kkvqk3yMpfRFG49pKKjIiq7h/VpRwPGTHoY4cg05X5028iHsLvUW/uz+kjPyIEhhcKUwCkJAwbR9pIEGOn8z6svAO8i89sJ3dL5qDWFYbS+HGPRMxYwJItFQN86YESeJQhn2urGiLRffQeLptDl8dAgb+Tp47UQPxWOw17OeChLN1WnzlkPL1T5O+O3Menpn4C3IY5LEepHpnPeZHbvuWfeVtPlkH4LZjPbBrkJT3NoRJzBt86CO0Xq59oQ+8dsm0ymRcmQyn8w71mhmcuEI5byuF+C88VPYly2sEzjlzAQ3vdn/1+Hzguw6qFNNbqenhZGbdiG6RwZaTG7jTA2X9RdXjDN9yj1uQpyO4Lx8KRAcZcbZMafp4wPOd5MdXoFY52V1A8M9hi3sso93+uprE0qYNMjkE22CvK4HuUxqN7oIz5pWuETq1lQAjqlSlqdD2Rnr/ggp/TVkQYjn9lMfYelk2sH5HPdopYo7MHwlV1or9Bxf+QCyLzm92vzG2wjiIjC/ZHEJzeroJl6bdFPTpZho5MV2U86fLQqxNlGIMqCGy+9WYhJ8ob1r0+Whxde9L2PdysETv97O+xVw+VNN1TZSQN5I6l9m5Ip6pLIqLm4a1B1ffH6gHyqT9p82NOjntRWGIofO3bJz5GhkvSWbsXueTAMaJDou99kGLqDlhwBZNEQ4mKPuDvVwSK4WmLluHyhA97pZiVe8g+JxmnJF8IkV/tCs4Jq/HgOoAEGR9tCDsDbDmi3OviUQpG5D8XmKcSAUaFLRXb2lmJTNYdhtYyfjBYZQmN5qT5CNuaD3BVnlkCk7bsMW3AtXkNMMTuW4HjUERSJnVQ0vsBGa1wo3Qh7115XGeTF3NTz8w0440AgU7c3bSXO/KMINaIWXd0oLpoq/0/QJxCQSJ9XnYy1W7TYLBJpHsVWD1ahsA7FjNvRd6mxCiHsm8g6Z0pnzqIpF1dHUtP2ITU5Z1hZHbu+L3BEEStBbL9XYvGfEakv1bmf+bOZGnoiuHEdlBnaChxYKNzB23b8sw8YyT7Ajxfk49eJIAvdbVkdFCe2J0gMefhQ0bIZxhx3fzMIysQNiN8PgOUKxOMur10LduigREDRMZyP4oGWrP1GFY4t6groASsZ421os48wAdnrbovNhLt7ScNULkwZ5AIZJTrbaKYTLjA1oJ3sIuN/aYocm/9uoQHEIlacF1s/TM1fLcPTL38O9fOsjMEIwoPKfvt7opuI9G2Hf/PR4aCLDQ7wNmIdEuXJ/QNL72k5q4NejAldPfe3UVVqzkys8YZ/jYOGOp6c+YzRCrCuq0M11y7TiN6qk7YXRMn/gukxrEimbMQjr3jwRM6dKVZ4RUfWQr8noPXLJq6yh5R3EH1IVOHESst/LItbG2D2vRsZRkAObzvQAAD3mb3/G4NzopI0FAiHfbpq0X72adg6SRj+8OHMShtFxxLZlf/nLgRLbClwl5WmaYSs+yEjkq48tY7Z2bE0N91mJwt+ua0NlRJIDh0HikF4UvSVorFj2YVu9YeS5tfvlVjPSoNu/Zu6dEUfBOT555hahBdN3Sa5Xuj2Rvau1lQNIaC944y0RWj9UiNDskAK1WoL+EfXcC6IbBXFRyVfX/WKXxPAwUyIAGW8ggZ08hcijKTt1YKnUO6QPvcrmDVAb0FCLIXn5id4fD/Jx4tw/gbXs7WF9b2RgXtPhLBG9vF5FEkdHAKrQHZAJC/HWvk7nvzzDzIXZlfFTJoC3JpGgLPBY7SQTjGlUvG577yNutZ1hTfs9/1nkSXK9zzKLRZ3VODeKUovJe0WCq1zVMYxCJMenmNzPIU2S8TA4E7wWmbNkxq9rI2dd6v0VpcAPVMxnDsvWTWFayyqvKZO7Z08a62i/oH2/jxf8rpmfO64in3FLiL1GX8IGtVE9M23yGsIqJbxDTy+LtaMWDaPqkymb5VrQdzOvqldeU0SUi6IirG8UZ3jcpRbwHa1C0Dww9G/SFX3gPvTJQE+kyz+g1BeMILKKO+olcHzctOWgzxYHnOD7dpCRtuZEXACjgqesZMasoPgnuDC4nUviAAxDc5pngjoAITIkvhKwg5d608pdrZcA+qn5TMT6Uo/QzBaOxBCLTJX3Mgk85rMfsnWx86oLxf7p2PX5ONqieTa/qM3tPw4ZXvlAp83NSD8F7+ZgctK1TpoYwtiU2h02HCGioH5tkVCqNVTMH5p00sRy2JU1qyDBP2CII/Dg4WDsIl+zgeX7589srx6YORRQMBfKbodbB743Tl4WLKOEnwWUVBsm94SOlCracU72MSyj068wdpYjyz1FwC2bjQnxnB6Mp/pZ+yyZXtguEaYB+kqhjQ6UUmwSFazOb+rhYjLaoiM+aN9/8KKn0zaCTFpN9eKwWy7/u4EHzO46TdFSNjMfn2iPSJwDPCFHc0I1+vjdAZw5ZjqR/uzi9Zn20oAa5JnLEk/EA3VRWE7J/XrupfFJPtCUuqHPpnlL7ISJtRpSVcB8qsZCm2QEkWoROtCKKxUh3yEcMbWYJwk6DlEBG0bZP6eg06FL3v6RPb7odGuwm7FN8fG4woqtB8e7M5klPpo97GoObNwt+ludTAmxyC5hmcFx+dIvEZKI6igFKHqLH01iY1o7903VzG9QGetyVx5RNmBYUU+zIuSva/yIcECUi4pRmE3VkF2avqulQEUY4yZ/wmNboBzPmAPey3+dSYtBZUjeWWT0pPwCz4Vozxp9xeClIU60qvEFMQCaPvPaA70WlOP9f/ey39macvpGCVa+zfa8gO44wbxpJUlC8GN/pRMTQtzY8Z8/hiNrU+Zq64ZfFGIkdj7m7abcK1EBtws1X4J/hnqvasPvvDSDYWN+QcQVGMqXalkDtTad5rYY0TIR1Eqox3czwPMjKPvF5sFv17Thujr1IZ1Ytl4VX1J0vjXKmLY4lmXipRAro0qVGEcXxEVMMEl54jQMd4J7RjgomU0j1ptjyxY+cLiSyXPfiEcIS2lWDK3ISAy6UZ3Hb5vnPncA94411jcy75ay6B6DSTzK6UTCZR9uDANtPBrvIDgjsfarMiwoax2OlLxaSoYn4iRgkpEGqEkwox5tyI8aKkLlfZ12lO11TxsqRMY89j5JaO55XfPJPDL1LGSnC88Re9Ai+Nu5bZjtwRrvFITUFHPR4ZmxGslQMecgbZO7nHk32qHxYkdvWpup07ojcMCaVrpFAyFZJJbNvBpZfdf39Hdo2kPtT7v0/f8R/B5Nz4f1t9/3zNM/7n6SUHfcWk5dfQFJvcJMgPolGCpOFb/WC0FGWU2asuQyT+rm88ZKZ78Cei/CAh939CH0JYbpZIPtxc2ufXqjS3pHH9lnWK4iJ7OjR/EESpCo2R3MYKyE7rHfhTvWho4cL1QdN4jFTyR6syMwFm124TVDDRXMNveI1Dp/ntwdz8k8kxw7iFSx6+Yx6O+1LzMVrN0BBzziZi9kneZSzgollBnVwBh6oSOPHXrglrOj+QmR/AESrhDpKrWT+8/AiMDxS/5wwRNuGQPLlJ9ovomhJWn8sMLVItQ8N/7IXvtD8kdOoHaw+vBSbFImQsv/OCAIui99E+YSIOMlMvBXkAt+NAZK8wB9Jf8CPtB+TOUOR+z71d/AFXpPBT6+A5FLjxMjLIEoJzrQfquvxEIi+WoUzGR1IzQFNvbYOnxb2PyQ0kGdyXKzW2axQL8lNAXPk6NEjqrRD1oZtKLlFoofrXw0dCNWASHzy+7PSzOUJ3XtaPZsxLDjr+o41fKuKWNmjiZtfkOzItvlV2MDGSheGF0ma04qE3TUEfqJMrXFm7DpK+27DSvCUVf7rbNoljPhha5W7KBqVq0ShUSTbRmuqPtQreVWH4JET5yMhuqMoSd4r/N8sDmeQiQQvi1tcZv7Moc7dT5X5AtCD6kNEGZOzVcNYlpX4AbTsLgSYYliiPyVoniuYYySxsBy5cgb3pD+EK0Gpb0wJg031dPgaL8JZt6sIvzNPEHfVPOjXmaXj4bd4voXzpZ5GApMhILgMbCEWZ2zwgdeQgjNHLbPIt+KqxRwWPLTN6HwZ0Ouijj4UF+Sg0Au8XuIKW0WxlexdrFrDcZJ8Shauat3X0XmHygqgL1nAu2hrJFb4wZXkcS+i36KMyU1yFvYv23bQUJi/3yQpqr/naUOoiEWOxckyq/gq43dFou1DVDaYMZK9tho7+IXXokBCs5GRfOcBK7g3A+jXQ39K4YA8PBRW4m5+yR0ZAxWJncjRVbITvIAPHYRt1EJ3YLiUbqIvoKHtzHKtUy1ddRUQ0AUO41vonZDUOW+mrszw+SW/6Q/IUgNpcXFjkM7F4CSSQ2ExZg85otsMs7kqsQD4OxYeBNDcSpifjMoLb7GEbGWTwasVObmB/bfPcUlq0wYhXCYEDWRW02TP5bBrYsKTGWjnWDDJ1F7zWai0zW/2XsCuvBQjPFcTYaQX3tSXRSm8hsAoDdjArK/OFp6vcWYOE7lizP0Yc+8p16i7/NiXIiiQTp7c7Xus925VEtlKAjUdFhyaiLT7VxDagprMFwix4wZ05u0qj7cDWFd0W9OYHIu3JbJKMXRJ1aYNovugg+QqRN7fNHSi26VSgBpn+JfMuPo3aeqPWik/wI5Rz3BWarPQX4i5+dM0npwVOsX+KsOhC7vDg+OJsz4Q5zlnIeflUWL6QYMbf9WDfLmosLF4Qev3mJiOuHjoor/dMeBpA9iKDkMjYBNbRo414HCxjsHrB4EXNbHzNMDHCLuNBG6Sf+J4MZ/ElVsDSLxjIiGsTPhw8BPjxbfQtskj+dyNMKOOcUYIRBEIqbazz3lmjlRQhplxq673VklMMY6597vu+d89ec/zq7Mi4gQvh87ehYbpOuZEXj5g/Q7S7BFDAAB9DzG35SC853xtWVcnZQoH54jeOqYLR9NDuwxsVthTV7V99n/B7HSbAytbEyVTz/5NhJ8gGIjG0E5j3griULUd5Rg7tQR+90hJgNQKQH2btbSfPcaTOfIexc1db1BxUOhM1vWCpLaYuKr3FdNTt/T3PWCpEUWDKEtzYrjpzlL/wri3MITKsFvtF8QVV/NhVo97aKIBgdliNc10dWdXVDpVtsNn+2UIolrgqdWA4EY8so0YvB4a+aLzMXiMAuOHQrXY0tr+CL10JbvZzgjJJuB1cRkdT7DUqTvnswVUp5kkUSFVtIIFYK05+tQxT6992HHNWVhWxUsD1PkceIrlXuUVRogwmfdhyrf6zzaL8+c0L7GXMZOteAhAVQVwdJh+7nrX7x4LaIIfz2F2v7Dg/uDfz2Fa+4gFm2zHAor8UqimJG3VTJtZEoFXhnDYXvxMJFc6ku2bhbCxzij2z5UNuK0jmp1mnvkVNUfR+SEmj1Lr94Lym75PO7Fs0MIr3GdsWXRXSfgLTVY0FLqba97u1In8NAcY7IC6TjWLigwKEIm43NxTdaVTv9mcKkzuzBkKd8x/xt1p/9BbP7Wyb4bpo1K1gnOpbLvKz58pWl3B55RJ/Z5mRDLPtNQg14jdOEs9+h/V5UVpwrAI8kGbX8KPVPDIMfIqKDjJD9UyDOPhjZ3vFAyecwyq4akUE9mDOtJEK1hpDyi6Ae87sWAClXGTiwPwN7PXWwjxaR79ArHRIPeYKTunVW24sPr/3HPz2IwH8oKH4OlWEmt4BLM6W5g4kMcYbLwj2usodD1088stZA7VOsUSpEVl4w7NMb1EUHMRxAxLF0CIV+0L3iZb+ekB1vSDSFjAZ3hfLJf7gFaXrOKn+mhR+rWw/eTXIcAgl4HvFuBg1LOmOAwJH3eoVEjjwheKA4icbrQCmvAtpQ0mXG0agYp5mj4Rb6mdQ+RV4QBPbxMqh9C7o8nP0Wko2ocnCHeRGhN1XVyT2b9ACsL+6ylUy+yC3QEnaKRIJK91YtaoSrcWZMMwxuM0E9J68Z+YyjA0g8p1PfHAAIROy6Sa04VXOuT6A351FOWhKfTGsFJ3RTJGWYPoLk5FVK4OaYR9hkJvezwF9vQN1126r6isMGXWTqFW+3HL3I/jurlIdDWIVvYY+s6yq7lrFSPAGRdnU7PVwY/SvWbZGpXzy3BQ2LmAJlrONUsZs4oGkly0V267xbD5KMY8woNNsmWG1VVgLCra8aQBBcI4DP2BlNwxhiCtHlaz6OWFoCW0vMR3ErrG7JyMjTSCnvRcsEHgmPnwA6iNpJ2DrFb4gLlhKJyZGaWkA97H6FFdwEcLT6DRQQL++fOkVC4cYGW1TG/3iK5dShRSuiBulmihqgjR45Vi03o2RbQbP3sxt90VxQ6vzdlGfkXmmKmjOi080JSHkLntjvsBJnv7gKscOaTOkEaRQqAnCA4HWtB4XnMtOhpRmH2FH8tTXrIjAGNWEmudQLCkcVlGTQ965Kh0H6ixXbgImQP6b42B49sO5C8pc7iRlgyvSYvcnH9FgQ3azLbQG2cUW96SDojTQStxkOJyOuDGTHAnnWkz29aEwN9FT8EJ4yhXOg+jLTrCPKeEoJ9a7lDXOjEr8AgX4BmnMQ668oW0zYPyQiVMPxKRHtpfnEEyaKhdzNVThlxxDQNdrHeZiUFb6NoY2KwvSb7BnRcpJy+/g/zAYx3fYSN5QEaVD2Y1VsNWxB0BSO12MRsRY8JLfAezRMz5lURuLUnG1ToKk6Q30FughqWN6gBNcFxP/nY/iv+iaUQOa+2Nuym46wtI/DvSfzSp1jEi4SdYBE7YhTiVV5cX9gwboVDMVgZp5YBQlHOQvaDNfcCoCJuYhf5kz5kwiIKPjzgpcRJHPbOhJajeoeRL53cuMahhV8Z7IRr6M4hW0JzT7mzaMUzQpm866zwM7Cs07fJYXuWvjAMkbe5O6V4bu71sOG6JQ4oL8zIeXHheFVavzxmlIyBkgc9IZlEDplMPr8xlcyss4pVUdwK1e7CK2kTsSdq7g5SHRAl3pYUB9Ko4fsh4qleOyJv1z3KFSTSvwEcRO/Ew8ozEDYZSqpfoVW9uhJfYrNAXR0Z3VmeoAD+rVWtwP/13sE/3ICX3HhDG3CMc476dEEC0K3umSAD4j+ZQLVdFOsWL2C1TH5+4KiSWH+lMibo+B55hR3Gq40G1n25sGcN0mEcoU2wN9FCVyQLBhYOu9aHVLWjEKx2JIUZi5ySoHUAI9b8hGzaLMxCZDMLhv8MkcpTqEwz9KFDpCpqQhVmsGQN8m24wyB82FAKNmjgfKRsXRmsSESovAwXjBIoMKSG51p6Um8b3i7GISs7kjTq/PZoioCfJzfKdJTN0Q45kQEQuh9H88M3yEs3DbtRTKALraM0YC8laiMiOOe6ADmTcCiREeAWZelBaEXRaSuj2lx0xHaRYqF65O0Lo5OCFU18A8cMDE4MLYm9w2QSr9NgQAIcRxZsNpA7UJR0e71JL+VU+ISWFk5I97lra8uGg7GlQYhGd4Gc6rxsLFRiIeGO4abP4S4ekQ1fiqDCy87GZHd52fn5aaDGuvOmIofrzpVwMvtbreZ/855OaXTRcNiNE0wzGZSxbjg26v8ko8L537v/XCCWP2MFaArJpvnkep0pA+O86MWjRAZPQRfznZiSIaTppy6m3p6HrNSsY7fDtz7Cl4V/DJAjQDoyiL2uwf1UHVd2AIrzBUSlJaTj4k6NL97a/GqhWKU9RUmjnYKpm2r+JYUcrkCuZKvcYvrg8pDoUKQywY9GDWg03DUFSirlUXBS5SWn/KAntnf0IdHGL/7mwXqDG+LZYjbEdQmqUqq4y54TNmWUP7IgcAw5816YBzwiNIJiE9M4lPCzeI/FGBeYy3p6IAmH4AjXXmvQ4Iy0Y82NTobcAggT2Cdqz6Mx4TdGoq9fn2etrWKUNFyatAHydQTVUQ2S5OWVUlugcNvoUrlA8cJJz9MqOa/W3iVno4zDHfE7zhoY5f5lRTVZDhrQbR8LS4eRLz8iPMyBL6o4PiLlp89FjdokQLaSBmKHUwWp0na5fE3v9zny2YcDXG/jfI9sctulHRbdkI5a4GOPJx4oAJQzVZ/yYAado8KNZUdEFs9ZPiBsausotXMNebEgr0dyopuqfScFJ3ODNPHgclACPdccwv0YJGQdsN2lhoV4HVGBxcEUeUX/alr4nqpcc1CCR3vR7g40zteQg/JvWmFlUE4mAiTpHlYGrB7w+U2KdSwQz2QJKBe/5eiixWipmfP15AFWrK8Sh1GBBYLgzki1wTMhGQmagXqJ2+FuqJ8f0XzXCVJFHQdMAw8xco11HhM347alrAu+wmX3pDFABOvkC+WPX0Uhg1Z5MVHKNROxaR84YV3s12UcM+70cJ460SzEaKLyh472vOMD3XnaK7zxZcXlWqenEvcjmgGNR2OKbI1s8U+iwiW+HotHalp3e1MGDy6BMVIvajnAzkFHbeVsgjmJUkrP9OAwnEHYXVBqYx3q7LvXjoVR0mY8h+ZaOnh053pdsGkmbqhyryN01eVHySr+CkDYkSMeZ1xjPNVM+gVLTDKu2VGsMUJqWO4TwPDP0VOg2/8ITbAUaMGb4LjL7L+Pi11lEVMXTYIlAZ/QHmTENjyx3kDkBdfcvvQt6tKk6jYFM4EG5UXDTaF5+1ZjRz6W7MdJPC+wTkbDUim4p5QQH3b9kGk2Bkilyeur8Bc20wm5uJSBO95GfYDI1EZipoRaH7uVveneqz43tlTZGRQ4a7CNmMHgXyOQQOL6WQkgMUTQDT8vh21aSdz7ERiZT1jK9F+v6wgFvuEmGngSvIUR2CJkc5tx1QygfZnAruONobB1idCLB1FCfO7N1ZdRocT8/Wye+EnDiO9pzqIpnLDl4bkaRKW+ekBVwHn46Shw1X0tclt/0ROijuUB4kIInrVJU4buWf4YITJtjOJ6iKdr1u+flgQeFH70GxKjhdgt/MrwfB4K/sXczQ+9zYcrD4dhY6qZhZ010rrxggWA8JaZyg2pYij8ieYEg1aZJkZK9O1Re7sB0iouf60rK0Gd+AYlp7soqCBCDGwfKeUQhCBn0E0o0GS6PdmjLi0TtCYZeqazqwN+yNINIA8Lk3iPDnWUiIPLGNcHmZDxfeK0iAdxm/T7LnN+gemRL61hHIc0NCAZaiYJR+OHnLWSe8sLrK905B5eEJHNlWq4RmEXIaFTmo49f8w61+NwfEUyuJAwVqZCLFcyHBKAcIVj3sNzfEOXzVKIndxHw+AR93owhbCxUZf6Gs8cz6/1VdrFEPrv330+9s6BtMVPJ3zl/Uf9rUi0Z/opexfdL3ykF76e999GPfVv8fJv/Y/+/5hEMon1tqNFyVRevV9y9/uIvsG3dbB8GRRrgaEXfhx+2xeOFt+cEn3RZanNxdEe2+B6MHpNbrRE53PlDifPvFcp4kO78ILR0T4xyW/WGPyBsqGdoA7zJJCu1TKbGfhnqgnRbxbB2B3UZoeQ2bz2sTVnUwokTcTU21RxN1PYPS3Sar7T0eRIsyCNowr9amwoMU/od9s2APtiKNL6ENOlyKADstAEWKA+sdKDhrJ6BOhRJmZ+QJbAaZ3/5Fq0/lumCgEzGEbu3yi0Y4I4EgVAjqxh4HbuQn0GrRhOWyAfsglQJAVL1y/6yezS2k8RE2MstJLh92NOB3GCYgFXznF4d25qiP4ZCyI4RYGesut6FXK6GwPpKK8WHEkhYui0AyEmr5Ml3uBFtPFdnioI8RiCooa7Z1G1WuyIi3nSNglutc+xY8BkeW3JJXPK6jd2VIMpaSxpVtFq+R+ySK9J6WG5Qvt+C+QH1hyYUOVK7857nFmyDBYgZ/o+AnibzNVqyYCJQvyDXDTK+iXdkA71bY7TL3bvuLxLBQ8kbTvTEY9aqkQ3+MiLWbEgjLzOH+lXgco1ERgzd80rDCymlpaRQbOYnKG/ODoFl46lzT0cjM5FYVvv0qLUbD5lyJtMUaC1pFlTkNONx6lliaX9o0i/1vws5bNKn5OuENQEKmLlcP4o2ZmJjD4zzd3Fk32uQ4uRWkPSUqb4LBe3EXHdORNB2BWsws5daRnMfNVX7isPSb1hMQdAJi1/qmDMfRUlCU74pmnzjbXfL8PVG8NsW6IQM2Ne23iCPIpryJjYbVnm5hCvKpMa7HLViNiNc+xTfDIaKm3jctViD8A1M9YPJNk003VVr4Zo2MuGW8vil8SLaGpPXqG7I4DLdtl8a4Rbx1Lt4w5Huqaa1XzZBtj208EJVGcmKYEuaeN27zT9EE6a09JerXdEbpaNgNqYJdhP1NdqiPKsbDRUi86XvvNC7rME5mrSQtrzAZVndtSjCMqd8BmaeGR4l4YFULGRBeXIV9Y4yxLFdyoUNpiy2IhePSWzBofYPP0eIa2q5JP4j9G8at/AqoSsLAUuRXtvgsqX/zYwsE+of6oSDbUOo4RMJw+DOUTJq+hnqwKim9Yy/napyZNTc2rCq6V9jHtJbxGPDwlzWj/Sk3zF/BHOlT/fSjSq7FqlPI1q6J+ru8Aku008SFINXZfOfnZNOvGPMtEmn2gLPt+H4QLA+/SYe4j398auzhKIp2Pok3mPC5q1IN1HgR+mnEfc4NeeHYwd2/kpszR3cBn7ni9NbIqhtSWFW8xbUJuUPVOeeXu3j0IGZmFNiwaNZ6rH4/zQ2ODz6tFxRLsUYZu1bfd1uIvfQDt4YD/efKYv8VF8bHGDgK22w2Wqwpi43vNCOXFJZCGMqWiPbL8mil6tsmOTXAWCyMCw73e2rADZj2IK6rqksM3EXF2cbLb4vjB14wa/yXK5vwU+05MzERJ5nXsXsW21o7M+gO0js2OyKciP5uF2iXyb2DiptwQeHeqygkrNsqVCSlldxBMpwHi1vfc8RKpP/4L3Lmpq6DZcvhDDfxTCE3splacTcOtXdK2g303dIWBVe2wD/Gvja1cClFQ67gw0t1ZUttsUgQ1Veky8oOpS6ksYEc4bqseCbZy766SvL3FodmnahlWJRgVCNjPxhL/fk2wyvlKhITH/VQCipOI0dNcRa5B1M5HmOBjTLeZQJy237e2mobwmDyJNHePhdDmiknvLKaDbShL+Is1XTCJuLQd2wmdJL7+mKvs294whXQD+vtd88KKk0DXP8B1Xu9J+xo69VOuFgexgTrcvI6SyltuLix9OPuE6/iRJYoBMEXxU4shQMf4Fjqwf1PtnJ/wWSZd29rhZjRmTGgiGTAUQqRz+nCdjeMfYhsBD5Lv60KILWEvNEHfmsDs2L0A252351eUoYxAysVaCJVLdH9QFWAmqJDCODUcdoo12+gd6bW2boY0pBVHWL6LQDK5bYWh1V8vFvi0cRpfwv7cJiMX3AZNJuTddHehTIdU0YQ/sQ1dLoF2xQPcCuHKiuCWOY30DHe1OwcClLAhqAKyqlnIbH/8u9ScJpcS4kgp6HKDUdiOgRaRGSiUCRBjzI5gSksMZKqy7Sd51aeg0tgJ+x0TH9YH2Mgsap9N7ENZdEB0bey2DMTrBA1hn56SErNHf3tKtqyL9b6yXEP97/rc+jgD2N1LNUH6RM9AzP3kSipr06RkKOolR7HO768jjWiH1X92jA7dkg7gcNcjqsZCgfqWw0tPXdLg20cF6vnQypg7gLtkazrHAodyYfENPQZsdfnjMZiNu4nJO97D1/sQE+3vNFzrSDOKw+keLECYf7RJwVHeP/j79833oZ0egonYB2FlFE5qj02B/LVOMJQlsB8uNg3Leg4qtZwntsOSNidR0abbZmAK4sCzvt8Yiuz2yrNCJoH5O8XvX/vLeR/BBYTWj0sOPYM/jyxRd5+/JziKAABaPcw/34UA3aj/gLZxZgRCWN6m4m3demanNgsx0P237/Q+Ew5VYnJPkyCY0cIVHoFn2Ay/e7U4P19APbPFXEHX94N6KhEMPG7iwB3+I+O1jd5n6VSgHegxgaSawO6iQCYFgDsPSMsNOcUj4q3sF6KzGaH/0u5PQoAj/8zq6Uc9MoNrGqhYeb2jQo0WlGlXjxtanZLS24/OIN5Gx/2g684BPDQpwlqnkFcxpmP/osnOXrFuu4PqifouQH0eF5qCkvITQbJw/Zvy5mAHWC9oU+cTiYhJmSfKsCyt1cGVxisKu+NymEQIAyaCgud/V09qT3nk/9s/SWsYtha7yNpzBIMM40rCSGaJ9u6lEkl00vXBiEt7p9P5IBCiavynEOv7FgLqPdeqxRiCwuFVMolSIUBcoyfUC2e2FJSAUgYdVGFf0b0Kn2EZlK97yyxrT2MVgvtRikfdaAW8RwEEfN+B7/eK8bBdp7URpbqn1xcrC6d2UjdsKbzCjBFqkKkoZt7Mrhg6YagE7spkqj0jOrWM+UGQ0MUlG2evP1uE1p2xSv4dMK0dna6ENcNUF+xkaJ7B764NdxLCpuvhblltVRAf7vK5qPttJ/9RYFUUSGcLdibnz6mf7WkPO3MkUUhR2mAOuGv8IWw5XG1ZvoVMnjSAZe6T7WYA99GENxoHkMiKxHlCuK5Gd0INrISImHQrQmv6F4mqU/TTQ8nHMDzCRivKySQ8dqkpQgnUMnwIkaAuc6/FGq1hw3b2Sba398BhUwUZSAIO8XZvnuLdY2n6hOXws+gq9BHUKcKFA6kz6FDnpxLPICa3qGhnc97bo1FT/XJk48LrkHJ2CAtBv0RtN97N21plfpXHvZ8gMJb7Zc4cfI6MbPwsW7AilCSXMFIEUEmir8XLEklA0ztYbGpTTGqttp5hpFTTIqUyaAIqvMT9A/x+Ji5ejA4Bhxb/cl1pUdOD6epd3yilIdO6j297xInoiBPuEDW2/UfslDyhGkQs7Wy253bVnlT+SWg89zYIK/9KXFl5fe+jow2rd5FXv8zDPrmfMXiUPt9QBO/iK4QGbX5j/7Rx1c1vzsY8ONbP3lVIaPrhL4+1QrECTN3nyKavGG0gBBtHvTKhGoBHgMXHStFowN+HKrPriYu+OZ05Frn8okQrPaaxoKP1ULCS/cmKFN3gcH7HQlVjraCeQmtjg1pSQxeuqXiSKgLpxc/1OiZsU4+n4lz4hpahGyWBURLi4642n1gn9qz9bIsaCeEPJ0uJmenMWp2tJmIwLQ6VSgDYErOeBCfSj9P4G/vI7oIF+l/n5fp956QgxGvur77ynawAu3G9MdFbJbu49NZnWnnFcQHjxRuhUYvg1U/e84N4JTecciDAKb/KYIFXzloyuE1eYXf54MmhjTq7B/yBToDzzpx3tJCTo3HCmVPYfmtBRe3mPYEE/6RlTIxbf4fSOcaKFGk4gbaUWe44hVk9SZzhW80yfW5QWBHxmtUzvMhfVQli4gZTktIOZd9mjJ5hsbmzttaHQB29Am3dZkmx3g/qvYocyhZ2PXAWsNQiIaf+Q8W/MWPIK7/TjvCx5q2XRp4lVWydMc2wIQkhadDB0xsnw/kSEyGjLKjI4coVIwtubTF3E7MJ6LS6UOsJKj82XVAVPJJcepfewbzE91ivXZvOvYfsmMevwtPpfMzGmC7WJlyW2j0jh7AF1JLmwEJSKYwIvu6DHc3YnyLH9ZdIBnQ+nOVDRiP+REpqv++typYHIvoJyICGA40d8bR7HR2k7do6UQTHF4oriYeIQbxKe4Th6+/l1BjUtS9hqORh3MbgvYrStXTfSwaBOmAVQZzpYNqsAmQyjY56MUqty3c/xH6GuhNvNaG9vGbG6cPtBM8UA3e8r51D0AR9kozKuGGSMgLz3nAHxDNnc7GTwpLj7/6HeWp1iksDeTjwCLpxejuMtpMnGJgsiku1sOACwQ9ukzESiDRN77YNESxR5LphOlcASXA5uIts1LnBIcn1J7BLWs49DMALSnuz95gdOrTZr0u1SeYHinno/pE58xYoXbVO/S+FEMMs5qyWkMnp8Q3ClyTlZP52Y9nq7b8fITPuVXUk9ohG5EFHw4gAEcjFxfKb3xuAsEjx2z1wxNbSZMcgS9GKyW3R6KwJONgtA64LTyxWm8Bvudp0M1FdJPEGopM4Fvg7G/hsptkhCfHFegv4ENwxPeXmYhxwZy7js+BeM27t9ODBMynVCLJ7RWcBMteZJtvjOYHb5lOnCLYWNEMKC59BA7covu1cANa2PXL05iGdufOzkgFqqHBOrgQVUmLEc+Mkz4Rq8O6WkNr7atNkH4M8d+SD1t/tSzt3oFql+neVs+AwEI5JaBJaxARtY2Z4mKoUqxds4UpZ0sv3zIbNoo0J4fihldQTX3XNcuNcZmcrB5LTWMdzeRuAtBk3cZHYQF6gTi3PNuDJ0nmR+4LPLoHvxQIxRgJ9iNNXqf2SYJhcvCtJiVWo85TsyFOuq7EyBPJrAdhEgE0cTq16FQXhYPJFqSfiVn0IQnPOy0LbU4BeG94QjdYNB0CiQ3QaxQqD2ebSMiNjaVaw8WaM4Z5WnzcVDsr4eGweSLa2DE3BWViaxhZFIcSTjgxNCAfelg+hznVOYoe5VqTYs1g7WtfTm3e4/WduC6p+qqAM8H4ZyrJCGpewThTDPe6H7CzX/zQ8Tm+r65HeZn+MsmxUciEWPlAVaK/VBaQBWfoG/aRL/jSZIQfep/89GjasWmbaWzeEZ2R1FOjvyJT37O9B8046SRSKVEnXWlBqbkb5XCS3qFeuE9xb9+frEknxWB5h1D/hruz2iVDEAS7+qkEz5Ot5agHJc7WCdY94Ws61sURcX5nG8UELGBAHZ3i+3VulAyT0nKNNz4K2LBHBWJcTBX1wzf+//u/j/9+//v87+9/l9Lbh/L/uyNYiTsWV2LwsjaA6MxTuzFMqmxW8Jw/+IppdX8t/Clgi1rI1SN0UC/r6tX/4lUc2VV1OQReSeCsjUpKZchw4XUcjHfw6ryCV3R8s6VXm67vp4n+lcPV9gJwmbKQEsmrJi9c2vkwrm8HFbVYNTaRGq8D91t9n5+U+aD/hNtN3HjC/nC/vUoGFSCkXP+NlRcmLUqLbiUBl4LYf1U/CCvwtd3ryCH8gUmGITAxiH1O5rnGTz7y1LuFjmnFGQ1UWuM7HwfXtWl2fPFKklYwNUpF2IL/TmaRETjQiM5SJacI+3Gv5MBU8lP5Io6gWkawpyzNEVGqOdx4YlO1dCvjbWFZWbCmeiFKPSlMKtKcMFLs/KQxtgAHi7NZNCQ32bBAW2mbHflVZ8wXKi1JKVHkW20bnYnl3dKWJeWJOiX3oKPBD6Zbi0ZvSIuWktUHB8qDR8DMMh1ZfkBL9FS9x5r0hBGLJ8pUCJv3NYH+Ae8p40mZWd5m5fhobFjQeQvqTT4VKWIYfRL0tfaXKiVl75hHReuTJEcqVlug+eOIIc4bdIydtn2K0iNZPsYWQvQio2qbO3OqAlPHDDOB7DfjGEfVF51FqqNacd6QmgFKJpMfLp5DHTv4wXlONKVXF9zTJpDV4m1sYZqJPhotcsliZM8yksKkCkzpiXt+EcRQvSQqmBS9WdWkxMTJXPSw94jqI3varCjQxTazjlMH8jTS8ilaW8014/vwA/LNa+YiFoyyx3s/KswP3O8QW1jtq45yTM/DX9a8M4voTVaO2ebvw1EooDw/yg6Y1faY+WwrdVs5Yt0hQ5EwRfYXSFxray1YvSM+kYmlpLG2/9mm1MfmbKHXr44Ih8nVKb1M537ZANUkCtdsPZ80JVKVKabVHCadaLXg+IV8i5GSwpZti0h6diTaKs9sdpUKEpd7jDUpYmHtiX33SKiO3tuydkaxA7pEc9XIQEOfWJlszj5YpL5bKeQyT7aZSBOamvSHl8xsWvgo26IP/bqk+0EJUz+gkkcvlUlyPp2kdKFtt7y5aCdks9ZJJcFp5ZWeaWKgtnXMN3ORwGLBE0PtkEIek5FY2aVssUZHtsWIvnljMVJtuVIjpZup/5VL1yPOHWWHkOMc6YySWMckczD5jUj2mlLVquFaMU8leGVaqeXis+aRRL8zm4WuBk6cyWfGMxgtr8useQEx7k/PvRoZyd9nde1GUCV84gMX8Ogu/BWezYPSR27llzQnA97oo0pYyxobYUJfsj+ysTm9zJ+S4pk0TGo9VTG0KjqYhTmALfoDZVKla2b5yhv241PxFaLJs3i05K0AAIdcGxCJZmT3ZdT7CliR7q+kur7WdQjygYtOWRL9B8E4s4LI8KpAj7bE0dg7DLOaX+MGeAi0hMMSSWZEz+RudXbZCsGYS0QqiXjH9XQbd8sCB+nIVTq7/T/FDS+zWY9q7Z2fdq1tdLb6v3hKKVDAw5gjj6o9r1wHFROdHc18MJp4SJ2Ucvu+iQ9EgkekW8VCM+psM6y+/2SBy8tNN4a3L1MzP+OLsyvESo5gS7IQOnIqMmviJBVc6zbVG1n8eXiA3j46kmvvtJlewwNDrxk4SbJOtP/TV/lIVK9ueShNbbMHfwnLTLLhbZuO79ec5XvfgRwLFK+w1r5ZWW15rVFZrE+wKqNRv5KqsLNfpGgnoUU6Y71NxEmN7MyqwqAQqoIULOw/LbuUB2+uE75gJt+kq1qY4LoxV+qR/zalupea3D5+WMeaRIn0sAI6DDWDh158fqUb4YhAxhREbUN0qyyJYkBU4V2KARXDT65gW3gRsiv7xSPYEKLwzgriWcWgPr0sbZnv7m1XHNFW6xPdGNZUdxFiUYlmXNjDVWuu7LCkX/nVkrXaJhiYktBISC2xgBXQnNEP+cptWl1eG62a7CPXrnrkTQ5BQASbEqUZWMDiZUisKyHDeLFOaJILUo5f6iDt4ZO8MlqaKLto0AmTHVVbkGuyPa1R/ywZsWRoRDoRdNMMHwYTsklMVnlAd2S0282bgMI8fiJpDh69OSL6K3qbo20KfpNMurnYGQSr/stFqZ7hYsxKlLnKAKhsmB8AIpEQ4bd/NrTLTXefsE6ChRmKWjXKVgpGoPs8GAicgKVw4K0qgDgy1A6hFq1WRat3fHF+FkU+b6H4NWpOU3KXTxrIb2qSHAb+qhm8hiSROi/9ofapjxhyKxxntPpge6KL5Z4+WBMYkAcE6+0Hd3Yh2zBsK2MV3iW0Y6cvOCroXlRb2MMJtdWx+3dkFzGh2Pe3DZ9QpSqpaR/rE1ImOrHqYYyccpiLC22amJIjRWVAherTfpQLmo6/K2pna85GrDuQPlH1Tsar8isAJbXLafSwOof4gg9RkAGm/oYpBQQiPUoyDk2BCQ1k+KILq48ErFo4WSRhHLq/y7mgw3+L85PpP6xWr6cgp9sOjYjKagOrxF148uhuaWtjet953fh1IQiEzgC+d2IgBCcUZqgTAICm2bR8oCjDLBsmg+ThyhfD+zBalsKBY1Ce54Y/t9cwfbLu9SFwEgphfopNA3yNxgyDafUM3mYTovZNgPGdd4ZFFOj1vtfFW3u7N+iHEN1HkeesDMXKPyoCDCGVMo4GCCD6PBhQ3dRZIHy0Y/3MaE5zU9mTCrwwnZojtE+qNpMSkJSpmGe0EzLyFelMJqhfFQ7a50uXxZ8pCc2wxtAKWgHoeamR2O7R+bq7IbPYItO0esdRgoTaY38hZLJ5y02oIVwoPokGIzxAMDuanQ1vn2WDQ00Rh6o5QOaCRu99fwDbQcN0XAuqkFpxT/cfz3slGRVokrNU0iqiMAJFEbKScZdmSkTUznC0U+MfwFOGdLgsewRyPKwBZYSmy6U325iUhBQNxbAC3FLKDV9VSOuQpOOukJ/GAmu/tyEbX9DgEp6dv1zoU0IqzpG6gssSjIYRVPGgU1QAQYRgIT8gEV0EXr1sqeh2I6rXjtmoCYyEDCe/PkFEi/Q48FuT29p557iN+LCwk5CK/CZ2WdAdfQZh2Z9QGrzPLSNRj5igUWzl9Vi0rCqH8G1Kp4QMLkuwMCAypdviDXyOIk0AHTM8HBYKh3b0/F+DxoNj4ZdoZfCpQVdnZarqoMaHWnMLNVcyevytGsrXQEoIbubqWYNo7NRHzdc0zvT21fWVirj7g36iy6pxogfvgHp1xH1Turbz8QyyHnXeBJicpYUctbzApwzZ1HT+FPEXMAgUZetgeGMwt4G+DHiDT2Lu+PT21fjJCAfV16a/Wu1PqOkUHSTKYhWW6PhhHUlNtWzFnA7MbY+r64vkwdpfNB2JfWgWXAvkzd42K4lN9x7Wrg4kIKgXCb4mcW595MCPJ/cTfPAMQMFWwnqwde4w8HZYJFpQwcSMhjVz4B8p6ncSCN1X4klxoIH4BN2J6taBMj6lHkAOs8JJAmXq5xsQtrPIPIIp/HG6i21xMGcFgqDXSRF0xQg14d2uy6HgKE13LSvQe52oShF5Jx1R6avyL4thhXQZHfC94oZzuPUBKFYf1VvDaxIrtV6dNGSx7DO0i1p6CzBkuAmEqyWceQY7F9+U0ObYDzoa1iKao/cOD/v6Q9gHrrr1uCeOk8fST9MG23Ul0KmM3r+Wn6Hi6WAcL7gEeaykicvgjzkjSwFsAXIR81Zx4QJ6oosVyJkCcT+4xAldCcihqvTf94HHUPXYp3REIaR4dhpQF6+FK1H0i9i7Pvh8owu3lO4PT1iuqu+DkL2Bj9+kdfGAg2TXw03iNHyobxofLE2ibjsYDPgeEQlRMR7afXbSGQcnPjI2D+sdtmuQ771dbASUsDndU7t58jrrNGRzISvwioAlHs5FA+cBE5Ccznkd8NMV6BR6ksnKLPZnMUawRDU1MZ/ib3xCdkTblHKu4blNiylH5n213yM0zubEie0o4JhzcfAy3H5qh2l17uLooBNLaO+gzonTH2uF8PQu9EyH+pjGsACTMy4cHzsPdymUSXYJOMP3yTkXqvO/lpvt0cX5ekDEu9PUfBeZODkFuAjXCaGdi6ew4qxJ8PmFfwmPpkgQjQlWqomFY6UkjmcnAtJG75EVR+NpzGpP1Ef5qUUbfowrC3zcSLX3BxgWEgEx/v9cP8H8u1Mvt9/rMDYf6sjwU1xSOPBgzFEeJLMRVFtKo5QHsUYT8ZRLCah27599EuqoC9PYjYO6aoAMHB8X1OHwEAYouHfHB3nyb2B+SnZxM/vw/bCtORjLMSy5aZoEpvgdGvlJfNPFUu/p7Z4VVK1hiI0/UTuB3ZPq4ohEbm7Mntgc1evEtknaosgZSwnDC2BdMmibpeg48X8Ixl+/8+xXdbshQXUPPvx8jT3fkELivHSmqbhblfNFShWAyQnJ3WBU6SMYSIpTDmHjdLVAdlADdz9gCplZw6mTiHqDwIsxbm9ErGusiVpg2w8Q3khKV/R9Oj8PFeF43hmW/nSd99nZzhyjCX3QOZkkB6BsH4H866WGyv9E0hVAzPYah2tkRfQZMmP2rinfOeQalge0ovhduBjJs9a1GBwReerceify49ctOh5/65ATYuMsAkVltmvTLBk4oHpdl6i+p8DoNj4Fb2vhdFYer2JSEilEwPd5n5zNoGBXEjreg/wh2NFnNRaIUHSOXa4eJRwygZoX6vnWnqVdCRT1ARxeFrNBJ+tsdooMwqnYhE7zIxnD8pZH+P0Nu1wWxCPTADfNWmqx626IBJJq6NeapcGeOmbtXvl0TeWG0Y7OGGV4+EHTtNBIT5Wd0Bujl7inXgZgfXTM5efD3qDTJ54O9v3Bkv+tdIRlq1kXcVD0BEMirmFxglNPt5pedb1AnxuCYMChUykwsTIWqT23XDpvTiKEru1cTcEMeniB+HQDehxPXNmkotFdwUPnilB/u4Nx5Xc6l8J9jH1EgKZUUt8t8cyoZleDBEt8oibDmJRAoMKJ5Oe9CSWS5ZMEJvacsGVdXDWjp/Ype5x0p9PXB2PAwt2LRD3d+ftNgpuyvxlP8pB84oB1i73vAVpwyrmXW72hfW6Dzn9Jkj4++0VQ4d0KSx1AsDA4OtXXDo63/w+GD+zC7w5SJaxsmnlYRQ4dgdjA7tTl2KNLnpJ+mvkoDxtt1a4oPaX3EVqj96o9sRKBQqU7ZOiupeAIyLMD+Y3YwHx30XWHB5CQiw7q3mj1EDlP2eBsZbz79ayUMbyHQ7s8gu4Lgip1LiGJj7NQj905/+rgUYKAA5qdrlHKIknWmqfuR+PB8RdBkDg/NgnlT89G72h2NvySnj7UyBwD+mi/IWs1xWbxuVwUIVXun5cMqBtFbrccI+DILjsVQg6eeq0itiRfedn89CvyFtpkxaauEvSANuZmB1p8FGPbU94J9medwsZ9HkUYjmI7OH5HuxendLbxTaYrPuIfE2ffXFKhoNBUp33HsFAXmCV/Vxpq5AYgFoRr5Ay93ZLRlgaIPjhZjXZZChT+aE5iWAXMX0oSFQEtwjiuhQQItTQX5IYrKfKB+queTNplR1Hoflo5/I6aPPmACwQCE2jTOYo5Dz1cs7Sod0KTG/3kEDGk3kUaUCON19xSJCab3kNpWZhSWkO8l+SpW70Wn3g0ciOIJO5JXma6dbos6jyisuxXwUUhj2+1uGhcvuliKtWwsUTw4gi1c/diEEpZHoKoxTBeMDmhPhKTx7TXWRakV8imJR355DcIHkR9IREHxohP4TbyR5LtFU24umRPRmEYHbpe1LghyxPx7YgUHjNbbQFRQhh4KeU1EabXx8FS3JAxp2rwRDoeWkJgWRUSKw6gGP5U2PuO9V4ZuiKXGGzFQuRuf+tkSSsbBtRJKhCi3ENuLlXhPbjTKD4djXVnfXFds6Zb+1XiUrRfyayGxJq1+SYBEfbKlgjiSmk0orgTqzSS+DZ5rTqsJbttiNtp+KMqGE2AHGFw6jQqM5vD6vMptmXV9OAjq49Uf/Lx9Opam+Hn5O9p8qoBBAQixzQZ4eNVkO9sPzJAMyR1y4/RCQQ1s0pV5KAU5sKLw3tkcFbI/JqrjCsK4Mw+W8aod4lioYuawUiCyVWBE/qPaFi5bnkgpfu/ae47174rI1fqQoTbW0HrU6FAejq7ByM0V4zkZTg02/YJK2N7hUQRCeZ4BIgSEqgD8XsjzG6LIsSbuHoIdz/LhFzbNn1clci1NHWJ0/6/O8HJMdIpEZbqi1RrrFfoo/rI/7ufm2MPG5lUI0IYJ4MAiHRTSOFJ2oTverFHYXThkYFIoyFx6rMYFgaOKM4xNWdlOnIcKb/suptptgTOTdVIf4YgdaAjJnIAm4qNNHNQqqAzvi53GkyRCEoseUBrHohZsjUbkR8gfKtc/+Oa72lwxJ8Mq6HDfDATbfbJhzeIuFQJSiw1uZprHlzUf90WgqG76zO0eCB1WdPv1IT6sNxxh91GEL2YpgC97ikFHyoaH92ndwduqZ6IYjkg20DX33MWdoZk7QkcKUCgisIYslOaaLyvIIqRKWQj16jE1DlQWJJaPopWTJjXfixEjRJJo8g4++wuQjbq+WVYjsqCuNIQW3YjnxKe2M5ZKEqq+cX7ZVgnkbsU3RWIyXA1rxv4kGersYJjD//auldXGmcEbcfTeF16Y1708FB1HIfmWv6dSFi6oD4E+RIjCsEZ+kY7dKnwReJJw3xCjKvi3kGN42rvyhUlIz0Bp+fNSV5xwFiuBzG296e5s/oHoFtUyUplmPulIPl+e1CQIQVtjlzLzzzbV+D/OVQtYzo5ixtMi5BmHuG4N/uKfJk5UIREp7+12oZlKtPBomXSzAY0KgtbPzzZoHQxujnREUgBU+O/jKKhgxVhRPtbqyHiUaRwRpHv7pgRPyUrnE7fYkVblGmfTY28tFCvlILC04Tz3ivkNWVazA+OsYrxvRM/hiNn8Fc4bQBeUZABGx5S/xFf9Lbbmk298X7iFg2yeimvsQqqJ+hYbt6uq+Zf9jC+Jcwiccd61NKQtFvGWrgJiHB5lwi6fR8KzYS7EaEHf/ka9EC7H8D+WEa3TEACHBkNSj/cXxFeq4RllC+fUFm2xtstYLL2nos1DfzsC9vqDDdRVcPA3Ho95aEQHvExVThXPqym65llkKlfRXbPTRiDepdylHjmV9YTWAEjlD9DdQnCem7Aj/ml58On366392214B5zrmQz/9ySG2mFqEwjq5sFl5tYJPw5hNz8lyZPUTsr5E0F2C9VMPnZckWP7+mbwp/BiN7f4kf7vtGnZF2JGvjK/sDX1RtcFY5oPQnE4lIAYV49U3C9SP0LCY/9i/WIFK9ORjzM9kG/KGrAuwFmgdEpdLaiqQNpCTGZVuAO65afkY1h33hrqyLjZy92JK3/twdj9pafFcwfXONmPQWldPlMe7jlP24Js0v9m8bIJ9TgS2IuRvE9ZVRaCwSJYOtAfL5H/YS4FfzKWKbek+GFulheyKtDNlBtrdmr+KU+ibHTdalzFUmMfxw3f36x+3cQbJLItSilW9cuvZEMjKw987jykZRlsH/UI+HlKfo2tLwemBEeBFtmxF2xmItA/dAIfQ+rXnm88dqvXa+GapOYVt/2waFimXFx3TC2MUiOi5/Ml+3rj/YU6Ihx2hXgiDXFsUeQkRAD6wF3SCPi2flk7XwKAA4zboqynuELD312EJ88lmDEVOMa1W/K/a8tGylZRMrMoILyoMQzzbDJHNZrhH77L9qSC42HVmKiZ5S0016UTp83gOhCwz9XItK9fgXfK3F5d7nZCBUekoLxrutQaPHa16Rjsa0gTrzyjqTnmcIcrxg6X6dkKiucudc0DD5W4pJPf0vuDW8r5/uw24YfMuxFRpD2ovT2mFX79xH6Jf+MVdv2TYqR6/955QgVPe3JCD/WjAYcLA9tpXgFiEjge2J5ljeI/iUzg91KQuHkII4mmHZxC3XQORLAC6G7uFn5LOmlnXkjFdoO976moNTxElS8HdxWoPAkjjocDR136m2l+f5t6xaaNgdodOvTu0rievnhNAB79WNrVs6EsPgkgfahF9gSFzzAd+rJSraw5Mllit7vUP5YxA843lUpu6/5jAR0RvH4rRXkSg3nE+O5GFyfe+L0s5r3k05FyghSFnKo4TTgs07qj4nTLqOYj6qaW9knJTDkF5OFMYbmCP+8H16Ty482OjvERV6OFyw043L9w3hoJi408sR+SGo1WviXUu8d7qS+ehKjpKwxeCthsm2LBFSFeetx0x4AaKPxtp3CxdWqCsLrB1s/j5TAhc1jNZsXWl6tjo/WDoewxzg8T8NnhZ1niUwL/nhfygLanCnRwaFGDyLw+sfZhyZ1UtYTp8TYB6dE7R3VsKKH95CUxJ8u8N+9u2/9HUNKHW3x3w5GQrfOPafk2w5qZq8MaHT0ebeY3wIsp3rN9lrpIsW9c1ws3VNV+JwNz0Lo9+V7zZr6GD56We6gWVIvtmam5GPPkVAbr74r6SwhuL+TRXtW/0pgyX16VNl4/EAD50TnUPuwrW6OcUO2VlWXS0inq872kk7GUlW6o/ozFKq+Sip6LcTtSDfDrPTcCHhx75H8BeRon+KG2wRwzfDgWhALmiWOMO6h3pm1UCZEPEjScyk7tdLx6WrdA2N1QTPENvNnhCQjW6kl057/qv7IwRryHrZBCwVSbLLnFRiHdTwk8mlYixFt1slEcPD7FVht13HyqVeyD55HOXrh2ElAxJyinGeoFzwKA91zfrdLvDxJSjzmImfvTisreI25EDcVfGsmxLVbfU8PGe/7NmWWKjXcdTJ11jAlVIY/Bv/mcxg/Q10vCHwKG1GW/XbJq5nxDhyLqiorn7Wd7VEVL8UgVzpHMjQ+Z8DUgSukiVwWAKkeTlVVeZ7t1DGnCgJVIdBPZAEK5f8CDyDNo7tK4/5DBjdD5MPV86TaEhGsLVFPQSI68KlBYy84FievdU9gWh6XZrugvtCZmi9vfd6db6V7FmoEcRHnG36VZH8N4aZaldq9zZawt1uBFgxYYx+Gs/qW1jwANeFy+LCoymyM6zgG7j8bGzUyLhvrbJkTYAEdICEb4kMKusKT9V3eIwMLsjdUdgijMc+7iKrr+TxrVWG0U+W95SGrxnxGrE4eaJFfgvAjUM4SAy8UaRwE9j6ZQH5qYAWGtXByvDiLSDfOD0yFA3UCMKSyQ30fyy1mIRg4ZcgZHLNHWl+c9SeijOvbOJxoQy7lTN2r3Y8p6ovxvUY74aOYbuVezryqXA6U+fcp6wSV9X5/OZKP18tB56Ua0gMyxJI7XyNT7IrqN8GsB9rL/kP5KMrjXxgqKLDa+V5OCH6a5hmOWemMUsea9vQl9t5Oce76PrTyTv50ExOqngE3PHPfSL//AItPdB7kGnyTRhVUUFNdJJ2z7RtktZwgmQzhBG/G7QsjZmJfCE7k75EmdIKH7xlnmDrNM/XbTT6FzldcH/rcRGxlPrv4qDScqE7JSmQABJWqRT/TUcJSwoQM+1jvDigvrjjH8oeK2in1S+/yO1j8xAws/T5u0VnIvAPqaE1atNuN0cuRliLcH2j0nTL4JpcR7w9Qya0JoaHgsOiALLCCzRkl1UUESz+ze/gIXHGtDwgYrK6pCFKJ1webSDog4zTlPkgXZqxlQDiYMjhDpwTtBW2WxthWbov9dt2X9XFLFmcF+eEc1UaQ74gqZiZsdj63pH1qcv3Vy8JYciogIVKsJ8Yy3J9w/GhjWVSQAmrS0BPOWK+RKV+0lWqXgYMnIFwpcZVD7zPSp547i9HlflB8gVnSTGmmq1ClO081OW/UH11pEQMfkEdDFzjLC1Cdo/BdL3s7cXb8J++Hzz1rhOUVZFIPehRiZ8VYu6+7Er7j5PSZu9g/GBdmNzJmyCD9wiswj9BZw+T3iBrg81re36ihMLjoVLoWc+62a1U/7qVX5CpvTVF7rocSAKwv4cBVqZm7lLDS/qoXs4fMs/VQi6BtVbNA3uSzKpQfjH1o3x4LrvkOn40zhm6hjduDglzJUwA0POabgdXIndp9fzhOo23Pe+Rk9GSLX0d71Poqry8NQDTzNlsa+JTNG9+UrEf+ngxCjGEsDCc0bz+udVRyHQI1jmEO3S+IOQycEq7XwB6z3wfMfa73m8PVRp+iOgtZfeSBl01xn03vMaQJkyj7vnhGCklsCWVRUl4y+5oNUzQ63B2dbjDF3vikd/3RUMifPYnX5Glfuk2FsV/7RqjI9yKTbE8wJY+74p7qXO8+dIYgjtLD/N8TJtRh04N9tXJA4H59IkMmLElgvr0Q5OCeVfdAt+5hkh4pQgfRMHpL74XatLQpPiOyHRs/OdmHtBf8nOZcxVKzdGclIN16lE7kJ+pVMjspOI+5+TqLRO6m0ZpNXJoZRv9MPDRcAfJUtNZHyig/s2wwReakFgPPJwCQmu1I30/tcBbji+Na53i1W1N+BqoY7Zxo+U/M9XyJ4Ok2SSkBtoOrwuhAY3a03Eu6l8wFdIG1cN+e8hopTkiKF093KuH/BcB39rMiGDLn6XVhGKEaaT/vqb/lufuAdpGExevF1+J9itkFhCfymWr9vGb3BTK4j598zRH7+e+MU9maruZqb0pkGxRDRE1CD4Z8LV4vhgPidk5w2Bq816g3nHw1//j3JStz7NR9HIWELO8TMn3QrP/zZp//+Dv9p429/ogv+GATR+n/UdF+ns9xNkXZQJXY4t9jMkJNUFygAtzndXwjss+yWH9HAnLQQfhAskdZS2l01HLWv7L7us5uTH409pqitvfSOQg/c+Zt7k879P3K9+WV68n7+3cZfuRd/dDPP/03rn+d+/nBvWfgDlt8+LzjqJ/vx3CnNOwiXhho778C96iD+1TBvRZYeP+EH81LE0vVwOOrmCLB3iKzI1x+vJEsrPH4uF0UB4TJ4X3uDfOCo3PYpYe0MF4bouh0DQ/l43fxUF7Y+dpWuvTSffB0yO2UQUETI/LwCZE3BvnevJ7c9zUlY3H58xzke6DNFDQG8n0WtDN4LAYN4nogKav1ezOfK/z+t6tsCTp+dhx4ymjWuCJk1dEUifDP+HyS4iP/Vg9B2jTo9L4NbiBuDS4nuuHW6H+JDQn2JtqRKGkEQPEYE7uzazXIkcxIAqUq1esasZBETlEZY7y7Jo+RoV/IsjY9eIMkUvr42Hc0xqtsavZvhz1OLwSxMOTuqzlhb0WbdOwBH9EYiyBjatz40bUxTHbiWxqJ0uma19qhPruvcWJlbiSSH48OLDDpaHPszvyct41ZfTu10+vjox6kOqK6v0K/gEPphEvMl/vwSv+A4Hhm36JSP9IXTyCZDm4kKsqD5ay8b1Sad/vaiyO5N/sDfEV6Z4q95E+yfjxpqBoBETW2C7xl4pIO2bDODDFurUPwE7EWC2Uplq+AHmBHvir2PSgkR12/Ry65O0aZtQPeXi9mTlF/Wj5GQ+vFkYyhXsLTjrBSP9hwk4GPqDP5rBn5/l8b0mLRAvRSzXHc293bs3s8EsdE3m2exxidWVB4joHR+S+dz5/W+v00K3TqN14CDBth8eWcsTbiwXPsygHdGid0PEdy6HHm2v/IUuV5RVapYmzGsX90mpnIdNGcOOq64Dbc5GUbYpD9M7S+6cLY//QmjxFLP5cuTFRm3vA5rkFZroFnO3bjHF35uU3s8mvL7Tp9nyTc4mymTJ5sLIp7umSnGkO23faehtz3mmTS7fbVx5rP7x3HXIjRNeq/A3xCs9JNB08c9S9BF2O3bOur0ItslFxXgRPdaapBIi4dRpKGxVz7ir69t/bc9qTxjvtOyGOfiLGDhR4fYywHv1WdOplxIV87TpLBy3Wc0QP0P9s4G7FBNOdITS/tep3o3h1TEa5XDDii7fWtqRzUEReP2fbxz7bHWWJdbIOxOUJZtItNZpTFRfj6vm9sYjRxQVO+WTdiOhdPeTJ+8YirPvoeL88l5iLYOHd3b/Imkq+1ZN1El3UikhftuteEYxf1Wujof8Pr4ICTu5ezZyZ4tHQMxlzUHLYO2VMOoNMGL/20S5i2o2obfk+8qqdR7xzbRDbgU0lnuIgz4LelQ5XS7xbLuSQtNS95v3ZUOdaUx/Qd8qxCt6xf2E62yb/HukLO6RyorV8KgYl5YNc75y+KvefrxY+lc/64y9kvWP0a0bDz/rojq+RWjO06WeruWqNFU7r3HPIcLWRql8ICZsz2Ls/qOm/CLn6++X+Qf7mGspYCrZod/lpl6Rw4xN/yuq8gqV4B6aHk1hVE1SfILxWu5gvXqbfARYQpspcxKp1F/c8XOPzkZvmoSw+vEqBLdrq1fr3wAPv5NnM9i8F+jdAuxkP5Z71c6uhK3enlnGymr7UsWZKC12qgUiG8XXGQ9mxnqz4GSIlybF9eXmbqj2sHX+a1jf0gRoONHRdRSrIq03Ty89eQ1GbV/Bk+du4+V15zls+vvERvZ4E7ZbnxWTVjDjb4o/k8jlw44pTIrUGxxuJvBeO+heuhOjpFsO6lVJ/aXnJDa/bM0Ql1cLbXE/Pbv3EZ3vj3iVrB5irjupZTzlnv677NrI9UNYNqbPgp/HZXS+lJmk87wec+7YOxTDo2aw2l3NfDr34VNlvqWJBknuK7oSlZ6/T10zuOoPZOeoIk81N+sL843WJ2Q4Z0fZ3scsqC/JV2fuhWi1jGURSKZV637lf53Xnnx16/vKEXY89aVJ0fv91jGdfG+G4+sniwHes4hS+udOr4RfhFhG/F5gUG35QaU+McuLmclb5ZWmR+sG5V6nf+PxYzlrnFGxpZaK8eqqVo0NfmAWoGfXDiT/FnUbWvzGDOTr8aktOZWg4BYvz5YH12ZbfCcGtNk+dDAZNGWvHov+PIOnY9Prjg8h/wLRrT69suaMVZ5bNuK00lSVpnqSX1NON/81FoP92rYndionwgOiA8WMf4vc8l15KqEEG4yAm2+WAN5Brfu1sq9suWYqgoajgOYt/JCk1gC8wPkK+XKCtRX6TAtgvrnuBgNRmn6I8lVDipOVB9kX6Oxkp4ZKyd1M6Gj8/v2U7k+YQBL95Kb9PQENucJb0JlW3b5tObN7m/Z1j1ev388d7o15zgXsI9CikAGAViR6lkJv7nb4Ak40M2G8TJ447kN+pvfHiOFjSUSP6PM+QfbAywKJCBaxSVxpizHseZUyUBhq59vFwrkyGoRiHbo0apweEZeSLuNiQ+HAekOnarFg00dZNXaPeoHPTRR0FmEyqYExOVaaaO8c0uFUh7U4e/UxdBmthlBDgg257Q33j1hA7HTxSeTTSuVnPZbgW1nodwmG16aKBDKxEetv7D9OjO0JhrbJTnoe+kcGoDJazFSO8/fUN9Jy/g4XK5PUkw2dgPDGpJqBfhe7GA+cjzfE/EGsMM+FV9nj9IAhrSfT/J3QE5TEIYyk5UjsI6ZZcCPr6A8FZUF4g9nnpVmjX90MLSQysIPD0nFzqwCcSJmIb5mYv2Cmk+C1MDFkZQyCBq4c/Yai9LJ6xYkGS/x2s5/frIW2vmG2Wrv0APpCdgCA9snFvfpe8uc0OwdRs4G9973PGEBnQB5qKrCQ6m6X/H7NInZ7y/1674/ZXOVp7OeuCRk8JFS516VHrnH1HkIUIlTIljjHaQtEtkJtosYul77cVwjk3gW1Ajaa6zWeyHGLlpk3VHE2VFzT2yI/EvlGUSz2H9zYE1s4nsKMtMqNyKNtL/59CpFJki5Fou6VXGm8vWATEPwrUVOLvoA8jLuwOzVBCgHB2Cr5V6OwEWtJEKokJkfc87h+sNHTvMb0KVTp5284QTPupoWvQVUwUeogZR3kBMESYo0mfukewRVPKh5+rzLQb7HKjFFIgWhj1w3yN/qCNoPI8XFiUgBNT1hCHBsAz8L7Oyt8wQWUFj92ONn/APyJFg8hzueqoJdNj57ROrFbffuS/XxrSXLTRgj5uxZjpgQYceeMc2wJrahReSKpm3QjHfqExTLAB2ipVumE8pqcZv8LYXQiPHHsgb5BMW8zM5pvQit+mQx8XGaVDcfVbLyMTlY8xcfmm/RSAT/H09UQol5gIz7rESDmnrQ4bURIB4iRXMDQwxgex1GgtDxKp2HayIkR+E/aDmCttNm2C6lytWdfOVzD6X2SpDWjQDlMRvAp1symWv4my1bPCD+E1EmGnMGWhNwmycJnDV2WrQNxO45ukEb08AAffizYKVULp15I4vbNK5DzWwCSUADfmKhfGSUqii1L2UsE8rB7mLuHuUJZOx4+WiizHBJ/hwboaBzhpNOVvgFTf5cJsHef7L1HCI9dOUUbb+YxUJWn6dYOLz+THi91kzY5dtO5c+grX7v0jEbsuoOGnoIreDIg/sFMyG+TyCLIcAWd1IZ1UNFxE8Uie13ucm40U2fcxC0u3WLvLOxwu+F7MWUsHsdtFQZ7W+nlfCASiAKyh8rnP3EyDByvtJb6Kax6/HkLzT9SyEyTMVM1zPtM0MJY14DmsWh4MgD15Ea9Hd00AdkTZ0EiG5NAGuIBzQJJ0JR0na+OB7lQA6UKxMfihIQ7GCCnVz694QvykWXTxpS2soDu+smru1UdIxSvAszBFD1c8c6ZOobA8bJiJIvuycgIXBQIXWwhyTgZDQxJTRXgEwRNAawGSXO0a1DKjdihLVNp/taE/xYhsgwe+VpKEEB4LlraQyE84gEihxCnbfoyOuJIEXy2FIYw+JjRusybKlU2g/vhTSGTydvCvXhYBdtAXtS2v7LkHtmXh/8fly1do8FI/D0f8UbzVb5h+KRhMGSAmR2mhi0YG/uj7wgxcfzCrMvdjitUIpXDX8ae2JcF/36qUWIMwN6JsjaRGNj+jEteGDcFyTUb8X/NHSucKMJp7pduxtD6KuxVlyxxwaeiC1FbGBESO84lbyrAugYxdl+2N8/6AgWpo/IeoAOcsG35IA/b3AuSyoa55L7llBLlaWlEWvuCFd8f8NfcTUgzJv6CbB+6ohWwodlk9nGWFpBAOaz5uEW5xBvmjnHFeDsb0mXwayj3mdYq5gxxNf3H3/tnCgHwjSrpSgVxLmiTtuszdRUFIsn6LiMPjL808vL1uQhDbM7aA43mISXReqjSskynIRcHCJ9qeFopJfx9tqyUoGbSwJex/0aDE3plBPGtNBYgWbdLom3+Q/bjdizR2/AS/c/dH/d3G7pyl1qDXgtOFtEqidwLqxPYtrNEveasWq3vPUUtqTeu8gpov4bdOQRI2kneFvRNMrShyVeEupK1PoLDPMSfWMIJcs267mGB8X9CehQCF0gIyhpP10mbyM7lwW1e6TGvHBV1sg/UyTghHPGRqMyaebC6pbB1WKNCQtlai1GGvmq9zUKaUzLaXsXEBYtHxmFbEZ2kJhR164LhWW2Tlp1dhsGE7ZgIWRBOx3Zcu2DxgH+G83WTPceKG0TgQKKiiNNOlWgvqNEbnrk6fVD+AqRam2OguZb0YWSTX88N+i/ELSxbaUUpPx4vJUzYg/WonSeA8xUK6u7DPHgpqWpEe6D4cXg5uK9FIYVba47V/nb+wyOtk+zG8RrS4EA0ouwa04iByRLSvoJA2FzaobbZtXnq8GdbfqEp5I2dpfpj59TCVif6+E75p665faiX8gS213RqBxTZqfHP46nF6NSenOneuT+vgbLUbdTH2/t0REFXZJOEB6DHvx6N6g9956CYrY/AYcm9gELJXYkrSi+0F0geKDZgOCIYkLU/+GOW5aGj8mvLFgtFH5+XC8hvAE3CvHRfl4ofM/Qwk4x2A+R+nyc9gNu/9Tem7XW4XRnyRymf52z09cTOdr+PG6+P/Vb4QiXlwauc5WB1z3o+IJjlbxI8MyWtSzT+k4sKVbhF3xa+vDts3NxXa87iiu+xRH9cAprnOL2h6vV54iQRXuOAj1s8nLFK8gZ70ThIQcWdF19/2xaJmT0efrkNDkWbpAQPdo92Z8+Hn/aLjbOzB9AI/k12fPs9HhUNDJ1u6ax2VxD3R6PywN7BrLJ26z6s3QoMp76qzzwetrDABKSGkfW5PwS1GvYNUbK6uRqxfyVGNyFB0E+OugMM8kKwmJmupuRWO8XkXXXQECyRVw9UyIrtCtcc4oNqXqr7AURBmKn6Khz3eBN96LwIJrAGP9mr/59uTOSx631suyT+QujDd4beUFpZ0kJEEnjlP+X/Kr2kCKhnENTg4BsMTOmMqlj2WMFLRUlVG0fzdCBgUta9odrJfpVdFomTi6ak0tFjXTcdqqvWBAzjY6hVrH9sbt3Z9gn+AVDpTcQImefbB4edirjzrsNievve4ZT4EUZWV3TxEsIW+9MT/RJoKfZZYSRGfC1CwPG/9rdMOM8qR/LUYvw5f/emUSoD7YSFuOoqchdUg2UePd1eCtFSKgxLSZ764oy4lvRCIH6bowPxZWwxNFctksLeil47pfevcBipkkBIc4ngZG+kxGZ71a72KQ7VaZ6MZOZkQJZXM6kb/Ac0/XkJx8dvyfJcWbI3zONEaEPIW8GbkYjsZcwy+eMoKrYjDmvEEixHzkCSCRPRzhOfJZuLdcbx19EL23MA8rnjTZZ787FGMnkqnpuzB5/90w1gtUSRaWcb0eta8198VEeZMUSfIhyuc4/nywFQ9uqn7jdqXh+5wwv+RK9XouNPbYdoEelNGo34KyySwigsrfCe0v/PlWPvQvQg8R0KgHO18mTVThhQrlbEQ0Kp/JxPdjHyR7E1QPw/ut0r+HDDG7BwZFm9IqEUZRpv2WpzlMkOemeLcAt5CsrzskLGaVOAxyySzZV/D2EY7ydNZMf8e8VhHcKGHAWNszf1EOq8fNstijMY4JXyATwTdncFFqcNDfDo+mWFvxJJpc4sEZtjXyBdoFcxbUmniCoKq5jydUHNjYJxMqN1KzYV62MugcELVhS3Bnd+TLLOh7dws/zSXWzxEb4Nj4aFun5x4kDWLK5TUF/yCXB/cZYvI9kPgVsG2jShtXkxfgT+xzjJofXqPEnIXIQ1lnIdmVzBOM90EXvJUW6a0nZ/7XjJGl8ToO3H/fdxnxmTNKBZxnkpXLVgLXCZywGT3YyS75w/PAH5I/jMuRspej8xZObU9kREbRA+kqjmKRFaKGWAmFQspC+QLbKPf0RaK3OXvBSWqo46p70ws/eZpu6jCtZUgQy6r4tHMPUdAgWGGUYNbuv/1a6K+MVFsd3T183+T8capSo6m0+Sh57fEeG/95dykGJBQMj09DSW2bY0mUonDy9a8trLnnL5B5LW3Nl8rJZNysO8Zb+80zXxqUGFpud3Qzwb7bf+8mq6x0TAnJU9pDQR9YQmZhlna2xuxJt0aCO/f1SU8gblOrbIyMsxTlVUW69VJPzYU2HlRXcqE2lLLxnObZuz2tT9CivfTAUYfmzJlt/lOPgsR6VN64/xQd4Jlk/RV7UKVv2Gx/AWsmTAuCWKhdwC+4HmKEKYZh2Xis4KsUR1BeObs1c13wqFRnocdmuheaTV30gvVXZcouzHKK5zwrN52jXJEuX6dGx3BCpV/++4f3hyaW/cQJLFKqasjsMuO3B3WlMq2gyYfdK1e7L2pO/tRye2mwzwZPfdUMrl5wdLqdd2Kv/wVtnpyWYhd49L6rsOV+8HXPrWH2Kup89l2tz6bf80iYSd+V4LROSOHeamvexR524q4r43rTmtFzQvArpvWfLYFZrbFspBsXNUqqenjxNNsFXatZvlIhk7teUPfK+YL32F8McTnjv0BZNppb+vshoCrtLXjIWq3EJXpVXIlG6ZNL0dh6qEm2WMwDjD3LfOfkGh1/czYc/0qhiD2ozNnH4882MVVt3JbVFkbwowNCO3KL5IoYW5wlVeGCViOuv1svZx7FbzxKzA4zGqBlRRaRWCobXaVq4yYCWbZf8eiJwt3OY+MFiSJengcFP2t0JMfzOiJ7cECvpx7neg1Rc5x+7myPJOXt2FohVRyXtD+/rDoTOyGYInJelZMjolecVHUhUNqvdZWg2J2t0jPmiLFeRD/8fOT4o+NGILb+TufCo9ceBBm3JLVn+MO2675n7qiEX/6W+188cYg3Zn5NSTjgOKfWFSAANa6raCxSoVU851oJLY11WIoYK0du0ec5E4tCnAPoKh71riTsjVIp3gKvBbEYQiNYrmH22oLQWA2AdwMnID6PX9b58dR2QKo4qag1D1Z+L/FwEKTR7osOZPWECPJIHQqPUsM5i/CH5YupVPfFA5pHUBcsesh8eO5YhyWnaVRPZn/BmdXVumZWPxMP5e28zm2uqHgFoT9CymHYNNrzrrjlXZM06HnzDxYNlI5b/QosxLmmrqDFqmogQdqk0WLkUceoAvQxHgkIyvWU69BPFr24VB6+lx75Rna6dGtrmOxDnvBojvi1/4dHjVeg8owofPe1cOnxU1ioh016s/Vudv9mhV9f35At+Sh28h1bpp8xhr09+vf47Elx3Ms6hyp6QvB3t0vnLbOhwo660cp7K0vvepabK7YJfxEWWfrC2YzJfYOjygPwfwd/1amTqa0hZ5ueebhWYVMubRTwIjj+0Oq0ohU3zfRfuL8gt59XsHdwKtxTQQ4Y2qz6gisxnm2UdlmpEkgOsZz7iEk6QOt8BuPwr+NR01LTqXmJo1C76o1N274twJvl+I069TiLpenK/miRxhyY8jvYV6W1WuSwhH9q7kuwnJMtm7IWcqs7HsnyHSqWXLSpYtZGaR1V3t0gauninFPZGtWskF65rtti48UV9uV9KM8kfDYs0pgB00S+TlzTXV6P8mxq15b9En8sz3jWSszcifZa/NuufPNnNTb031pptt0+sRSH/7UG8pzbsgtt3OG3ut7B9JzDMt2mTZuyRNIV8D54TuTrpNcHtgmMlYJeiY9XS83NYJicjRjtJSf9BZLsQv629QdDsKQhTK5CnXhpk7vMNkHzPhm0ExW/VCGApHfPyBagtZQTQmPHx7g5IXXsrQDPzIVhv2LB6Ih138iSDww1JNHrDvzUxvp73MsQBVhW8EbrReaVUcLB1R3PUXyaYG4HpJUcLVxMgDxcPkVRQpL7VTAGabDzbKcvg12t5P8TSGQkrj/gOrpnbiDHwluA73xbXts/L7u468cRWSWRtgTwlQnA47EKg0OiZDgFxAKQQUcsbGomITgeXUAAyKe03eA7Mp4gnyKQmm0LXJtEk6ddksMJCuxDmmHzmVhO+XaN2A54MIh3niw5CF7PwiXFZrnA8wOdeHLvvhdoqIDG9PDI7UnWWHq526T8y6ixJPhkuVKZnoUruOpUgOOp3iIKBjk+yi1vHo5cItHXb1PIKzGaZlRS0g5d3MV2pD8FQdGYLZ73aae/eEIUePMc4NFz8pIUfLCrrF4jVWH5gQneN3S8vANBmUXrEcKGn6hIUN95y1vpsvLwbGpzV9L0ZKTan6TDXM05236uLJcIEMKVAxKNT0K8WljuwNny3BNQRfzovA85beI9zr1AGNYnYCVkR1aGngWURUrgqR+gRrQhxW81l3CHevjvGEPzPMTxdsIfB9dfGRbZU0cg/1mcubtECX4tvaedmNAvTxCJtc2QaoUalGfENCGK7IS/O8CRpdOVca8EWCRwv2sSWE8CJPW5PCugjCXPd3h6U60cPD+bdhtXZuYB6stcoveE7Sm5MM2yvfUHXFSW7KzLmi7/EeEWL0wqcOH9MOSKjhCHHmw+JGLcYE/7SBZQCRggox0ZZTAxrlzNNXYXL5fNIjkdT4YMqVUz6p8YDt049v4OXGdg3qTrtLBUXOZf7ahPlZAY/O+7Sp0bvGSHdyQ8B1LOsplqMb9Se8VAE7gIdSZvxbRSrfl+Lk5Qaqi5QJceqjitdErcHXg/3MryljPSIAMaaloFm1cVwBJ8DNmkDqoGROSHFetrgjQ5CahuKkdH5pRPigMrgTtlFI8ufJPJSUlGgTjbBSvpRc0zypiUn6U5KZqcRoyrtzhmJ7/caeZkmVRwJQeLOG8LY6vP5ChpKhc8Js0El+n6FXqbx9ItdtLtYP92kKfaTLtCi8StLZdENJa9Ex1nOoz1kQ7qxoiZFKRyLf4O4CHRT0T/0W9F8epNKVoeyxUXhy3sQMMsJjQJEyMOjmOhMFgOmmlscV4eFi1CldU92yjwleirEKPW3bPAuEhRZV7JsKV3Lr5cETAiFuX5Nw5UlF7d2HZ96Bh0sgFIL5KGaKSoVYVlvdKpZJVP5+NZ7xDEkQhmDgsDKciazJCXJ6ZN2B3FY2f6VZyGl/t4aunGIAk/BHaS+i+SpdRfnB/OktOvyjinWNfM9Ksr6WwtCa1hCmeRI6icpFM4o8quCLsikU0tMoZI/9EqXRMpKGaWzofl4nQuVQm17d5fU5qXCQeCDqVaL9XJ9qJ08n3G3EFZS28SHEb3cdRBdtO0YcTzil3QknNKEe/smQ1fTb0XbpyNB5xAeuIlf+5KWlEY0DqJbsnzJlQxJPOVyHiKMx5Xu9FcEv1Fbg6Fhm4t+Jyy5JC1W3YO8dYLsO0PXPbxodBgttTbH3rt9Cp1lJIk2r3O1Zqu94eRbnIz2f50lWolYzuKsj4PMok4abHLO8NAC884hiXx5Fy5pWKO0bWL7uEGXaJCtznhP67SlQ4xjWIfgq6EpZ28QMtuZK7JC0RGbl9nA4XtFLug/NLMoH1pGt9IonAJqcEDLyH6TDROcbsmGPaGIxMo41IUAnQVPMPGByp4mOmh9ZQMkBAcksUK55LsZj7E5z5XuZoyWCKu6nHmDq22xI/9Z8YdxJy4kWpD16jLVrpwGLWfyOD0Wd+cBzFBxVaGv7S5k9qwh/5t/LQEXsRqI3Q9Rm3QIoaZW9GlsDaKOUyykyWuhNOprSEi0s1G4rgoiX1V743EELti+pJu5og6X0g6oTynUqlhH9k6ezyRi05NGZHz0nvp3HOJr7ebrAUFrDjbkFBObEvdQWkkUbL0pEvMU46X58vF9j9F3j6kpyetNUBItrEubW9ZvMPM4qNqLlsSBJqOH3XbNwv/cXDXNxN8iFLzUhteisYY+RlHYOuP29/Cb+L+xv+35Rv7xudnZ6ohK4cMPfCG8KI7dNmjNk/H4e84pOxn/sZHK9psfvj8ncA8qJz7O8xqbxESDivGJOZzF7o5PJLQ7g34qAWoyuA+x3btU98LT6ZyGyceIXjrqob2CAVql4VOTQPUQYvHV/g4zAuCZGvYQBtf0wmd5lilrvuEn1BXLny01B4h4SMDlYsnNpm9d7m9h578ufpef9Z4WplqWQvqo52fyUA7J24eZD5av6SyGIV9kpmHNqyvdfzcpEMw97BvknV2fq+MFHun9BT3Lsf8pbzvisWiIQvYkng+8Vxk1V+dli1u56kY50LRjaPdotvT5BwqtwyF+emo/z9J3yVUVGfKrxQtJMOAQWoQii/4dp9wgybSa5mkucmRLtEQZ/pz0tL/NVcgWAd95nEQ3Tg6tNbuyn3Iepz65L3huMUUBntllWuu4DbtOFSMSbpILV4fy6wlM0SOvi6CpLh81c1LreIvKd61uEWBcDw1lUBUW1I0Z+m/PaRlX+PQ/oxg0Ye6KUiIiTF4ADNk59Ydpt5/rkxmq9tV5Kcp/eQLUVVmBzQNVuytQCP6Ezd0G8eLxWyHpmZWJ3bAzkWTtg4lZlw42SQezEmiUPaJUuR/qklVA/87S4ArFCpALdY3QRdUw3G3XbWUp6aq9z0zUizcPa7351p9JXOZyfdZBFnqt90VzQndXB/mwf8LC9STj5kenVpNuqOQQP3mIRJj7eV21FxG8VAxKrEn3c+XfmZ800EPb9/5lIlijscUbB6da0RQaMook0zug1G0tKi/JBC4rw7/D3m4ARzAkzMcVrDcT2SyFtUdWAsFlsPDFqV3N+EjyXaoEePwroaZCiLqEzb8MW+PNE9TmTC01EzWli51PzZvUqkmyuROU+V6ik+Le/9qT6nwzUzf9tP68tYei0YaDGx6kAd7jn1cKqOCuYbiELH9zYqcc4MnRJjkeGiqaGwLImhyeKs+xKJMBlOJ05ow9gGCKZ1VpnMKoSCTbMS+X+23y042zOb5MtcY/6oBeAo1Vy89OTyhpavFP78jXCcFH0t7Gx24hMEOm2gsEfGabVpQgvFqbQKMsknFRRmuPHcZu0Su/WMFphZvB2r/EGbG72rpGGho3h+Msz0uGzJ7hNK2uqQiE1qmn0zgacKYYZBCqsxV+sjbpoVdSilW/b94n2xNb648VmNIoizqEWhBnsen+d0kbCPmRItfWqSBeOd9Wne3c6bcd6uvXOJ6WdiSsuXq0ndhqrQ4QoWUjCjYtZ0EAhnSOP1m44xkf0O7jXghrzSJWxP4a/t72jU29Vu2rvu4n7HfHkkmQOMGSS+NPeLGO5I73mC2B7+lMiBQQZRM9/9liLIfowupUFAbPBbR+lxDM6M8Ptgh1paJq5Rvs7yEuLQv/7d1oU2woFSb3FMPWQOKMuCuJ7pDDjpIclus5TeEoMBy2YdVB4fxmesaCeMNsEgTHKS5WDSGyNUOoEpcC2OFWtIRf0w27ck34/DjxRTVIcc9+kqZE6iMSiVDsiKdP/Xz5XfEhm/sBhO50p1rvJDlkyyxuJ9SPgs7YeUJBjXdeAkE+P9OQJm6SZnn1svcduI78dYmbkE2mtziPrcjVisXG78spLvbZaSFx/Rks9zP4LKn0Cdz/3JsetkT06A8f/yCgMO6Mb1Hme0JJ7b2wZz1qleqTuKBGokhPVUZ0dVu+tnQYNEY1fmkZSz6+EGZ5EzL7657mreZGR3jUfaEk458PDniBzsSmBKhDRzfXameryJv9/D5m6HIqZ0R+ouCE54Dzp4IJuuD1e4Dc5i+PpSORJfG23uVgqixAMDvchMR0nZdH5brclYwRoJRWv/rlxGRI5ffD5NPGmIDt7vDE1434pYdVZIFh89Bs94HGGJbTwrN8T6lh1HZFTOB4lWzWj6EVqxSMvC0/ljWBQ3F2kc/mO2b6tWonT2JEqEwFts8rz2h+oWNds9ceR2cb7zZvJTDppHaEhK5avWqsseWa2Dt5BBhabdWSktS80oMQrL4TvAM9b5HMmyDnO+OkkbMXfUJG7eXqTIG6lqSOEbqVR+qYdP7uWb57WEJqzyh411GAVsDinPs7KvUeXItlcMdOUWzXBH6zscymV1LLVCtc8IePojzXHF9m5b5zGwBRdzcyUJkiu938ApmAayRdJrX1PmVguWUvt2ThQ62czItTyWJMW2An/hdDfMK7SiFQlGIdAbltHz3ycoh7j9V7GxNWBpbtcSdqm4XxRwTawc3cbZ+xfSv9qQfEkDKfZTwCkqWGI/ur250ItXlMlh6vUNWEYIg9A3GzbgmbqvTN8js2YMo87CU5y6nZ4dbJLDQJj9fc7yM7tZzJDZFtqOcU8+mZjYlq4VmifI23iHb1ZoT9E+kT2dolnP1AfiOkt7PQCSykBiXy5mv637IegWSKj9IKrYZf4Lu9+I7ub+mkRdlvYzehh/jaJ9n7HUH5b2IbgeNdkY7wx1yVzxS7pbvky6+nmVUtRllEFfweUQ0/nG017WoUYSxs+j2B4FV/F62EtHlMWZXYrjGHpthnNb1x66LKZ0Qe92INWHdfR/vqp02wMS8r1G4dJqHok8KmQ7947G13a4YXbsGgHcBvRuVu1eAi4/A5+ZixmdSXM73LupB/LH7O9yxLTVXJTyBbI1S49TIROrfVCOb/czZ9pM4JsZx8kUz8dQGv7gUWKxXvTH7QM/3J2OuXXgciUhqY+cgtaOliQQVOYthBLV3xpESZT3rmfEYNZxmpBbb24CRao86prn+i9TNOh8VxRJGXJfXHATJHs1T5txgc/opYrY8XjlGQQbRcoxIBcnVsMjmU1ymmIUL4dviJXndMAJ0Yet+c7O52/p98ytlmAsGBaTAmMhimAnvp1TWNGM9BpuitGj+t810CU2UhorrjPKGtThVC8WaXw04WFnT5fTjqmPyrQ0tN3CkLsctVy2xr0ZWgiWVZ1OrlFjjxJYsOiZv2cAoOvE+7sY0I/TwWcZqMoyIKNOftwP7w++Rfg67ljfovKYa50if3fzE/8aPYVey/Nq35+nH2sLPh/fP5TsylSKGOZ4k69d2PnH43+kq++sRXHQqGArWdwhx+hpwQC6JgT2uxehYU4Zbw7oNb6/HLikPyJROGK2ouyr+vzseESp9G50T4AyFrSqOQ0rroCYP4sMDFBrHn342EyZTMlSyk47rHSq89Y9/nI3zG5lX16Z5lxphguLOcZUndL8wNcrkyjH82jqg8Bo8OYkynrxZvbFno5lUS3OPr8Ko3mX9NoRPdYOKKjD07bvgFgpZ/RF+YzkWvJ/Hs/tUbfeGzGWLxNAjfDzHHMVSDwB5SabQLsIZHiBp43FjGkaienYoDd18hu2BGwOK7U3o70K/WY/kuuKdmdrykIBUdG2mvE91L1JtTbh20mOLbk1vCAamu7utlXeGU2ooVikbU/actcgmsC1FKk2qmj3GWeIWbj4tGIxE7BLcBWUvvcnd/lYxsMV4F917fWeFB/XbINN3qGvIyTpCalz1lVewdIGqeAS/gB8Mi+sA+BqDiX3VGD2eUunTRbSY+AuDy4E3Qx3hAhwnSXX+B0zuj3eQ1miS8Vux2z/l6/BkWtjKGU72aJkOCWhGcSf3+kFkkB15vGOsQrSdFr6qTj0gBYiOlnBO41170gOWHSUoBVRU2JjwppYdhIFDfu7tIRHccSNM5KZOFDPz0TGMAjzzEpeLwTWp+kn201kU6NjbiMQJx83+LX1e1tZ10kuChJZ/XBUQ1dwaBHjTDJDqOympEk8X2M3VtVw21JksChA8w1tTefO3RJ1FMbqZ01bHHkudDB/OhLfe7P5GOHaI28ZXKTMuqo0hLWQ4HabBsGG7NbP1RiXtETz074er6w/OerJWEqjmkq2y51q1BVI+JUudnVa3ogBpzdhFE7fC7kybrAt2Z6RqDjATAUEYeYK45WMupBKQRtQlU+uNsjnzj6ZmGrezA+ASrWxQ6LMkHRXqXwNq7ftv28dUx/ZSJciDXP2SWJsWaN0FjPX9Yko6LobZ7aYW/IdUktI9apTLyHS8DyWPyuoZyxN1TK/vtfxk3HwWh6JczZC8Ftn0bIJay2g+n5wd7lm9rEsKO+svqVmi+c1j88hSCxbzrg4+HEP0Nt1/B6YW1XVm09T1CpAKjc9n18hjqsaFGdfyva1ZG0Xu3ip6N6JGpyTSqY5h4BOlpLPaOnyw45PdXTN+DtAKg7DLrLFTnWusoSBHk3s0d7YouJHq85/R09Tfc37ENXZF48eAYLnq9GLioNcwDZrC6FW6godB8JnqYUPvn0pWLfQz0lM0Yy8Mybgn84Ds3Q9bDP10bLyOV+qzxa4Rd9Dhu7cju8mMaONXK3UqmBQ9qIg7etIwEqM/kECk/Dzja4Bs1xR+Q/tCbc8IKrSGsTdJJ0vge7IG20W687uVmK6icWQ6cD3lwFzgNMGtFvO5qyJeKflGLAAcQZOrkxVwy3cWvqlGpvjmf9Qe6Ap20MPbV92DPV0OhFM4kz8Yr0ffC2zLWSQ1kqY6QdQrttR3kh1YLtQd1kCEv5hVoPIRWl5ERcUTttBIrWp6Xs5Ehh5OUUwI5aEBvuiDmUoENmnVw1FohCrbRp1A1E+XSlWVOTi7ADW+5Ohb9z1vK4qx5R5lPdGCPBJZ00mC+Ssp8VUbgpGAvXWMuWQQRbCqI6Rr2jtxZxtfP7W/8onz+yz0Gs76LaT5HX9ecyiZCB/ZR/gFtMxPsDwohoeCRtiuLxE1GM1vUEUgBv86+eehL58/P56QFGQ/MqOe/vC76L63jzmeax4exd/OKTUvkXg+fOJUHych9xt/9goJMrapSgvXrj8+8vk/N80f22Sewj6cyGqt1B6mztoeklVHHraouhvHJaG/OuBz6DHKMpFmQULU1bRWlyYE0RPXYYkUycIemN7TLtgNCJX6BqdyxDKkegO7nJK5xQ7OVYDZTMf9bVHidtk6DQX9Et+V9M7esgbsYBdEeUpsB0Xvw2kd9+rI7V+m47u+O/tq7mw7262HU1WlS9uFzsV6JxIHNmUCy0QS9e077JGRFbG65z3/dOKB/Zk+yDdKpUmdXjn/aS3N5nv4fK7bMHHmPlHd4E2+iTbV5rpzScRnxk6KARuDTJ8Q1LpK2mP8gj1EbuJ9RIyY+EWK4hCiIDBAS1Tm2IEXAFfgKPgdL9O6mAa06wjCcUAL6EsxPQWO9VNegBPm/0GgkZbDxCynxujX/92vmGcjZRMAY45puak2sFLCLSwXpEsyy5fnF0jGJBhm+fNSHKKUUfy+276A7/feLOFxxUuHRNJI2Osenxyvf8DAGObT60pfTTlhEg9u/KKkhJqm5U1/+BEcSkpFDA5XeCqxwXmPac1jcuZ3JWQ+p0NdWzb/5v1ZvF8GtMTFFEdQjpLO0bwPb0BHNWnip3liDXI2fXf05jjvfJ0NpjLCUgfTh9CMFYVFKEd4Z/OG/2C+N435mnK+9t1gvCiVcaaH7rK4+PjCvpVNiz+t2QyqH1O8x3JKZVl6Q+Lp/XK8wMjVMslOq9FdSw5FtUs/CptXH9PW+wbWHgrV17R5jTVOtGtKFu3nb80T+E0tv9QkzW3J2dbaw/8ddAKZ0pxIaEqLjlPrji3VgJ3GvdFvlqD8075woxh4fVt0JZE0KVFsAvqhe0dqN9b35jtSpnYMXkU+vZq+IAHad3IHc2s/LYrnD1anfG46IFiMIr9oNbZDWvwthqYNqOigaKd/XlLU4XHfk/PXIjPsLy/9/kAtQ+/wKH+hI/IROWj5FPvTZAT9f7j4ZXQyG4M0TujMAFXYkKvEHv1xhySekgXGGqNxWeWKlf8dDAlLuB1cb/qOD+rk7cmwt+1yKpk9cudqBanTi6zTbXRtV8qylNtjyOVKy1HTz0GW9rjt6sSjAZcT5R+KdtyYb0zyqG9pSLuCw5WBwAn7fjBjKLLoxLXMI+52L9cLwIR2B6OllJZLHJ8vDxmWdtF+QJnmt1rsHPIWY20lftk8fYePkAIg6Hgn532QoIpegMxiWgAOfe5/U44APR8Ac0NeZrVh3gEhs12W+tVSiWiUQekf/YBECUy5fdYbA08dd7VzPAP9aiVcIB9k6tY7WdJ1wNV+bHeydNtmC6G5ICtFC1ZwmJU/j8hf0I8TRVKSiz5oYIa93EpUI78X8GYIAZabx47/n8LDAAJ0nNtP1rpROprqKMBRecShca6qXuTSI3jZBLOB3Vp381B5rCGhjSvh/NSVkYp2qIdP/Bg="; 24334 }, 24335 {} 24336 ], 24337 6: [ 24338 function(require2, module2, exports2) { 24339 var data = require2("./dictionary-browser"); 24340 exports2.init = function() { 24341 exports2.dictionary = data.init(); 24342 }; 24343 exports2.offsetsByLength = new Uint32Array([ 24344 0, 24345 0, 24346 0, 24347 0, 24348 0, 24349 4096, 24350 9216, 24351 21504, 24352 35840, 24353 44032, 24354 53248, 24355 63488, 24356 74752, 24357 87040, 24358 93696, 24359 100864, 24360 104704, 24361 106752, 24362 108928, 24363 113536, 24364 115968, 24365 118528, 24366 119872, 24367 121280, 24368 122016 24369 ]); 24370 exports2.sizeBitsByLength = new Uint8Array([ 24371 0, 24372 0, 24373 0, 24374 0, 24375 10, 24376 10, 24377 11, 24378 11, 24379 10, 24380 10, 24381 10, 24382 10, 24383 10, 24384 9, 24385 9, 24386 8, 24387 7, 24388 7, 24389 8, 24390 7, 24391 7, 24392 6, 24393 6, 24394 5, 24395 5 24396 ]); 24397 exports2.minDictionaryWordLength = 4; 24398 exports2.maxDictionaryWordLength = 24; 24399 }, 24400 { "./dictionary-browser": 4 } 24401 ], 24402 7: [ 24403 function(require2, module2, exports2) { 24404 function HuffmanCode(bits, value) { 24405 this.bits = bits; 24406 this.value = value; 24407 } 24408 exports2.HuffmanCode = HuffmanCode; 24409 var MAX_LENGTH = 15; 24410 function GetNextKey(key, len) { 24411 var step = 1 << len - 1; 24412 while (key & step) { 24413 step >>= 1; 24414 } 24415 return (key & step - 1) + step; 24416 } 24417 function ReplicateValue(table, i2, step, end, code) { 24418 do { 24419 end -= step; 24420 table[i2 + end] = new HuffmanCode( 24421 code.bits, 24422 code.value 24423 ); 24424 } while (end > 0); 24425 } 24426 function NextTableBitSize(count, len, root_bits) { 24427 var left = 1 << len - root_bits; 24428 while (len < MAX_LENGTH) { 24429 left -= count[len]; 24430 if (left <= 0) break; 24431 ++len; 24432 left <<= 1; 24433 } 24434 return len - root_bits; 24435 } 24436 exports2.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) { 24437 var start_table = table; 24438 var code; 24439 var len; 24440 var symbol3; 24441 var key; 24442 var step; 24443 var low; 24444 var mask; 24445 var table_bits; 24446 var table_size; 24447 var total_size; 24448 var sorted; 24449 var count = new Int32Array( 24450 MAX_LENGTH + 1 24451 ); 24452 var offset4 = new Int32Array( 24453 MAX_LENGTH + 1 24454 ); 24455 sorted = new Int32Array(code_lengths_size); 24456 for (symbol3 = 0; symbol3 < code_lengths_size; symbol3++) { 24457 count[code_lengths[symbol3]]++; 24458 } 24459 offset4[1] = 0; 24460 for (len = 1; len < MAX_LENGTH; len++) { 24461 offset4[len + 1] = offset4[len] + count[len]; 24462 } 24463 for (symbol3 = 0; symbol3 < code_lengths_size; symbol3++) { 24464 if (code_lengths[symbol3] !== 0) { 24465 sorted[offset4[code_lengths[symbol3]]++] = symbol3; 24466 } 24467 } 24468 table_bits = root_bits; 24469 table_size = 1 << table_bits; 24470 total_size = table_size; 24471 if (offset4[MAX_LENGTH] === 1) { 24472 for (key = 0; key < total_size; ++key) { 24473 root_table[table + key] = new HuffmanCode( 24474 0, 24475 sorted[0] & 65535 24476 ); 24477 } 24478 return total_size; 24479 } 24480 key = 0; 24481 symbol3 = 0; 24482 for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) { 24483 for (; count[len] > 0; --count[len]) { 24484 code = new HuffmanCode( 24485 len & 255, 24486 sorted[symbol3++] & 65535 24487 ); 24488 ReplicateValue( 24489 root_table, 24490 table + key, 24491 step, 24492 table_size, 24493 code 24494 ); 24495 key = GetNextKey(key, len); 24496 } 24497 } 24498 mask = total_size - 1; 24499 low = -1; 24500 for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) { 24501 for (; count[len] > 0; --count[len]) { 24502 if ((key & mask) !== low) { 24503 table += table_size; 24504 table_bits = NextTableBitSize( 24505 count, 24506 len, 24507 root_bits 24508 ); 24509 table_size = 1 << table_bits; 24510 total_size += table_size; 24511 low = key & mask; 24512 root_table[start_table + low] = new HuffmanCode( 24513 table_bits + root_bits & 255, 24514 table - start_table - low & 65535 24515 ); 24516 } 24517 code = new HuffmanCode( 24518 len - root_bits & 255, 24519 sorted[symbol3++] & 65535 24520 ); 24521 ReplicateValue( 24522 root_table, 24523 table + (key >> root_bits), 24524 step, 24525 table_size, 24526 code 24527 ); 24528 key = GetNextKey(key, len); 24529 } 24530 } 24531 return total_size; 24532 }; 24533 }, 24534 {} 24535 ], 24536 8: [ 24537 function(require2, module2, exports2) { 24538 "use strict"; 24539 exports2.byteLength = byteLength; 24540 exports2.toByteArray = toByteArray; 24541 exports2.fromByteArray = fromByteArray; 24542 var lookup = []; 24543 var revLookup = []; 24544 var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; 24545 var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 24546 for (var i2 = 0, len = code.length; i2 < len; ++i2) { 24547 lookup[i2] = code[i2]; 24548 revLookup[code.charCodeAt(i2)] = i2; 24549 } 24550 revLookup["-".charCodeAt(0)] = 62; 24551 revLookup["_".charCodeAt(0)] = 63; 24552 function getLens(b64) { 24553 var len2 = b64.length; 24554 if (len2 % 4 > 0) { 24555 throw new Error( 24556 "Invalid string. Length must be a multiple of 4" 24557 ); 24558 } 24559 var validLen = b64.indexOf("="); 24560 if (validLen === -1) validLen = len2; 24561 var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4; 24562 return [validLen, placeHoldersLen]; 24563 } 24564 function byteLength(b64) { 24565 var lens = getLens(b64); 24566 var validLen = lens[0]; 24567 var placeHoldersLen = lens[1]; 24568 return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; 24569 } 24570 function _byteLength(b64, validLen, placeHoldersLen) { 24571 return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; 24572 } 24573 function toByteArray(b64) { 24574 var tmp; 24575 var lens = getLens(b64); 24576 var validLen = lens[0]; 24577 var placeHoldersLen = lens[1]; 24578 var arr = new Arr( 24579 _byteLength(b64, validLen, placeHoldersLen) 24580 ); 24581 var curByte = 0; 24582 var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen; 24583 for (var i22 = 0; i22 < len2; i22 += 4) { 24584 tmp = revLookup[b64.charCodeAt(i22)] << 18 | revLookup[b64.charCodeAt(i22 + 1)] << 12 | revLookup[b64.charCodeAt(i22 + 2)] << 6 | revLookup[b64.charCodeAt(i22 + 3)]; 24585 arr[curByte++] = tmp >> 16 & 255; 24586 arr[curByte++] = tmp >> 8 & 255; 24587 arr[curByte++] = tmp & 255; 24588 } 24589 if (placeHoldersLen === 2) { 24590 tmp = revLookup[b64.charCodeAt(i22)] << 2 | revLookup[b64.charCodeAt(i22 + 1)] >> 4; 24591 arr[curByte++] = tmp & 255; 24592 } 24593 if (placeHoldersLen === 1) { 24594 tmp = revLookup[b64.charCodeAt(i22)] << 10 | revLookup[b64.charCodeAt(i22 + 1)] << 4 | revLookup[b64.charCodeAt(i22 + 2)] >> 2; 24595 arr[curByte++] = tmp >> 8 & 255; 24596 arr[curByte++] = tmp & 255; 24597 } 24598 return arr; 24599 } 24600 function tripletToBase64(num) { 24601 return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63]; 24602 } 24603 function encodeChunk(uint8, start2, end) { 24604 var tmp; 24605 var output = []; 24606 for (var i22 = start2; i22 < end; i22 += 3) { 24607 tmp = (uint8[i22] << 16 & 16711680) + (uint8[i22 + 1] << 8 & 65280) + (uint8[i22 + 2] & 255); 24608 output.push(tripletToBase64(tmp)); 24609 } 24610 return output.join(""); 24611 } 24612 function fromByteArray(uint8) { 24613 var tmp; 24614 var len2 = uint8.length; 24615 var extraBytes = len2 % 3; 24616 var parts = []; 24617 var maxChunkLength = 16383; 24618 for (var i22 = 0, len22 = len2 - extraBytes; i22 < len22; i22 += maxChunkLength) { 24619 parts.push( 24620 encodeChunk( 24621 uint8, 24622 i22, 24623 i22 + maxChunkLength > len22 ? len22 : i22 + maxChunkLength 24624 ) 24625 ); 24626 } 24627 if (extraBytes === 1) { 24628 tmp = uint8[len2 - 1]; 24629 parts.push( 24630 lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==" 24631 ); 24632 } else if (extraBytes === 2) { 24633 tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1]; 24634 parts.push( 24635 lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=" 24636 ); 24637 } 24638 return parts.join(""); 24639 } 24640 }, 24641 {} 24642 ], 24643 9: [ 24644 function(require2, module2, exports2) { 24645 function PrefixCodeRange(offset4, nbits) { 24646 this.offset = offset4; 24647 this.nbits = nbits; 24648 } 24649 exports2.kBlockLengthPrefixCode = [ 24650 new PrefixCodeRange(1, 2), 24651 new PrefixCodeRange(5, 2), 24652 new PrefixCodeRange(9, 2), 24653 new PrefixCodeRange(13, 2), 24654 new PrefixCodeRange(17, 3), 24655 new PrefixCodeRange(25, 3), 24656 new PrefixCodeRange(33, 3), 24657 new PrefixCodeRange(41, 3), 24658 new PrefixCodeRange(49, 4), 24659 new PrefixCodeRange(65, 4), 24660 new PrefixCodeRange(81, 4), 24661 new PrefixCodeRange(97, 4), 24662 new PrefixCodeRange(113, 5), 24663 new PrefixCodeRange(145, 5), 24664 new PrefixCodeRange(177, 5), 24665 new PrefixCodeRange(209, 5), 24666 new PrefixCodeRange(241, 6), 24667 new PrefixCodeRange(305, 6), 24668 new PrefixCodeRange(369, 7), 24669 new PrefixCodeRange(497, 8), 24670 new PrefixCodeRange(753, 9), 24671 new PrefixCodeRange(1265, 10), 24672 new PrefixCodeRange(2289, 11), 24673 new PrefixCodeRange(4337, 12), 24674 new PrefixCodeRange(8433, 13), 24675 new PrefixCodeRange(16625, 24) 24676 ]; 24677 exports2.kInsertLengthPrefixCode = [ 24678 new PrefixCodeRange(0, 0), 24679 new PrefixCodeRange(1, 0), 24680 new PrefixCodeRange(2, 0), 24681 new PrefixCodeRange(3, 0), 24682 new PrefixCodeRange(4, 0), 24683 new PrefixCodeRange(5, 0), 24684 new PrefixCodeRange(6, 1), 24685 new PrefixCodeRange(8, 1), 24686 new PrefixCodeRange(10, 2), 24687 new PrefixCodeRange(14, 2), 24688 new PrefixCodeRange(18, 3), 24689 new PrefixCodeRange(26, 3), 24690 new PrefixCodeRange(34, 4), 24691 new PrefixCodeRange(50, 4), 24692 new PrefixCodeRange(66, 5), 24693 new PrefixCodeRange(98, 5), 24694 new PrefixCodeRange(130, 6), 24695 new PrefixCodeRange(194, 7), 24696 new PrefixCodeRange(322, 8), 24697 new PrefixCodeRange(578, 9), 24698 new PrefixCodeRange(1090, 10), 24699 new PrefixCodeRange(2114, 12), 24700 new PrefixCodeRange(6210, 14), 24701 new PrefixCodeRange(22594, 24) 24702 ]; 24703 exports2.kCopyLengthPrefixCode = [ 24704 new PrefixCodeRange(2, 0), 24705 new PrefixCodeRange(3, 0), 24706 new PrefixCodeRange(4, 0), 24707 new PrefixCodeRange(5, 0), 24708 new PrefixCodeRange(6, 0), 24709 new PrefixCodeRange(7, 0), 24710 new PrefixCodeRange(8, 0), 24711 new PrefixCodeRange(9, 0), 24712 new PrefixCodeRange(10, 1), 24713 new PrefixCodeRange(12, 1), 24714 new PrefixCodeRange(14, 2), 24715 new PrefixCodeRange(18, 2), 24716 new PrefixCodeRange(22, 3), 24717 new PrefixCodeRange(30, 3), 24718 new PrefixCodeRange(38, 4), 24719 new PrefixCodeRange(54, 4), 24720 new PrefixCodeRange(70, 5), 24721 new PrefixCodeRange(102, 5), 24722 new PrefixCodeRange(134, 6), 24723 new PrefixCodeRange(198, 7), 24724 new PrefixCodeRange(326, 8), 24725 new PrefixCodeRange(582, 9), 24726 new PrefixCodeRange(1094, 10), 24727 new PrefixCodeRange(2118, 24) 24728 ]; 24729 exports2.kInsertRangeLut = [0, 0, 8, 8, 0, 16, 8, 16, 16]; 24730 exports2.kCopyRangeLut = [0, 8, 0, 8, 16, 0, 16, 8, 16]; 24731 }, 24732 {} 24733 ], 24734 10: [ 24735 function(require2, module2, exports2) { 24736 function BrotliInput(buffer) { 24737 this.buffer = buffer; 24738 this.pos = 0; 24739 } 24740 BrotliInput.prototype.read = function(buf, i2, count) { 24741 if (this.pos + count > this.buffer.length) { 24742 count = this.buffer.length - this.pos; 24743 } 24744 for (var p3 = 0; p3 < count; p3++) 24745 buf[i2 + p3] = this.buffer[this.pos + p3]; 24746 this.pos += count; 24747 return count; 24748 }; 24749 exports2.BrotliInput = BrotliInput; 24750 function BrotliOutput(buf) { 24751 this.buffer = buf; 24752 this.pos = 0; 24753 } 24754 BrotliOutput.prototype.write = function(buf, count) { 24755 if (this.pos + count > this.buffer.length) 24756 throw new Error( 24757 "Output buffer is not large enough" 24758 ); 24759 this.buffer.set(buf.subarray(0, count), this.pos); 24760 this.pos += count; 24761 return count; 24762 }; 24763 exports2.BrotliOutput = BrotliOutput; 24764 }, 24765 {} 24766 ], 24767 11: [ 24768 function(require2, module2, exports2) { 24769 var BrotliDictionary = require2("./dictionary"); 24770 var kIdentity = 0; 24771 var kOmitLast1 = 1; 24772 var kOmitLast2 = 2; 24773 var kOmitLast3 = 3; 24774 var kOmitLast4 = 4; 24775 var kOmitLast5 = 5; 24776 var kOmitLast6 = 6; 24777 var kOmitLast7 = 7; 24778 var kOmitLast8 = 8; 24779 var kOmitLast9 = 9; 24780 var kUppercaseFirst = 10; 24781 var kUppercaseAll = 11; 24782 var kOmitFirst1 = 12; 24783 var kOmitFirst2 = 13; 24784 var kOmitFirst3 = 14; 24785 var kOmitFirst4 = 15; 24786 var kOmitFirst5 = 16; 24787 var kOmitFirst6 = 17; 24788 var kOmitFirst7 = 18; 24789 var kOmitFirst8 = 19; 24790 var kOmitFirst9 = 20; 24791 function Transform(prefix2, transform, suffix) { 24792 this.prefix = new Uint8Array(prefix2.length); 24793 this.transform = transform; 24794 this.suffix = new Uint8Array(suffix.length); 24795 for (var i2 = 0; i2 < prefix2.length; i2++) 24796 this.prefix[i2] = prefix2.charCodeAt(i2); 24797 for (var i2 = 0; i2 < suffix.length; i2++) 24798 this.suffix[i2] = suffix.charCodeAt(i2); 24799 } 24800 var kTransforms = [ 24801 new Transform("", kIdentity, ""), 24802 new Transform("", kIdentity, " "), 24803 new Transform(" ", kIdentity, " "), 24804 new Transform("", kOmitFirst1, ""), 24805 new Transform("", kUppercaseFirst, " "), 24806 new Transform("", kIdentity, " the "), 24807 new Transform(" ", kIdentity, ""), 24808 new Transform("s ", kIdentity, " "), 24809 new Transform("", kIdentity, " of "), 24810 new Transform("", kUppercaseFirst, ""), 24811 new Transform("", kIdentity, " and "), 24812 new Transform("", kOmitFirst2, ""), 24813 new Transform("", kOmitLast1, ""), 24814 new Transform(", ", kIdentity, " "), 24815 new Transform("", kIdentity, ", "), 24816 new Transform(" ", kUppercaseFirst, " "), 24817 new Transform("", kIdentity, " in "), 24818 new Transform("", kIdentity, " to "), 24819 new Transform("e ", kIdentity, " "), 24820 new Transform("", kIdentity, '"'), 24821 new Transform("", kIdentity, "."), 24822 new Transform("", kIdentity, '">'), 24823 new Transform("", kIdentity, "\n"), 24824 new Transform("", kOmitLast3, ""), 24825 new Transform("", kIdentity, "]"), 24826 new Transform("", kIdentity, " for "), 24827 new Transform("", kOmitFirst3, ""), 24828 new Transform("", kOmitLast2, ""), 24829 new Transform("", kIdentity, " a "), 24830 new Transform("", kIdentity, " that "), 24831 new Transform(" ", kUppercaseFirst, ""), 24832 new Transform("", kIdentity, ". "), 24833 new Transform(".", kIdentity, ""), 24834 new Transform(" ", kIdentity, ", "), 24835 new Transform("", kOmitFirst4, ""), 24836 new Transform("", kIdentity, " with "), 24837 new Transform("", kIdentity, "'"), 24838 new Transform("", kIdentity, " from "), 24839 new Transform("", kIdentity, " by "), 24840 new Transform("", kOmitFirst5, ""), 24841 new Transform("", kOmitFirst6, ""), 24842 new Transform(" the ", kIdentity, ""), 24843 new Transform("", kOmitLast4, ""), 24844 new Transform("", kIdentity, ". The "), 24845 new Transform("", kUppercaseAll, ""), 24846 new Transform("", kIdentity, " on "), 24847 new Transform("", kIdentity, " as "), 24848 new Transform("", kIdentity, " is "), 24849 new Transform("", kOmitLast7, ""), 24850 new Transform("", kOmitLast1, "ing "), 24851 new Transform("", kIdentity, "\n "), 24852 new Transform("", kIdentity, ":"), 24853 new Transform(" ", kIdentity, ". "), 24854 new Transform("", kIdentity, "ed "), 24855 new Transform("", kOmitFirst9, ""), 24856 new Transform("", kOmitFirst7, ""), 24857 new Transform("", kOmitLast6, ""), 24858 new Transform("", kIdentity, "("), 24859 new Transform("", kUppercaseFirst, ", "), 24860 new Transform("", kOmitLast8, ""), 24861 new Transform("", kIdentity, " at "), 24862 new Transform("", kIdentity, "ly "), 24863 new Transform(" the ", kIdentity, " of "), 24864 new Transform("", kOmitLast5, ""), 24865 new Transform("", kOmitLast9, ""), 24866 new Transform(" ", kUppercaseFirst, ", "), 24867 new Transform("", kUppercaseFirst, '"'), 24868 new Transform(".", kIdentity, "("), 24869 new Transform("", kUppercaseAll, " "), 24870 new Transform("", kUppercaseFirst, '">'), 24871 new Transform("", kIdentity, '="'), 24872 new Transform(" ", kIdentity, "."), 24873 new Transform(".com/", kIdentity, ""), 24874 new Transform(" the ", kIdentity, " of the "), 24875 new Transform("", kUppercaseFirst, "'"), 24876 new Transform("", kIdentity, ". This "), 24877 new Transform("", kIdentity, ","), 24878 new Transform(".", kIdentity, " "), 24879 new Transform("", kUppercaseFirst, "("), 24880 new Transform("", kUppercaseFirst, "."), 24881 new Transform("", kIdentity, " not "), 24882 new Transform(" ", kIdentity, '="'), 24883 new Transform("", kIdentity, "er "), 24884 new Transform(" ", kUppercaseAll, " "), 24885 new Transform("", kIdentity, "al "), 24886 new Transform(" ", kUppercaseAll, ""), 24887 new Transform("", kIdentity, "='"), 24888 new Transform("", kUppercaseAll, '"'), 24889 new Transform("", kUppercaseFirst, ". "), 24890 new Transform(" ", kIdentity, "("), 24891 new Transform("", kIdentity, "ful "), 24892 new Transform(" ", kUppercaseFirst, ". "), 24893 new Transform("", kIdentity, "ive "), 24894 new Transform("", kIdentity, "less "), 24895 new Transform("", kUppercaseAll, "'"), 24896 new Transform("", kIdentity, "est "), 24897 new Transform(" ", kUppercaseFirst, "."), 24898 new Transform("", kUppercaseAll, '">'), 24899 new Transform(" ", kIdentity, "='"), 24900 new Transform("", kUppercaseFirst, ","), 24901 new Transform("", kIdentity, "ize "), 24902 new Transform("", kUppercaseAll, "."), 24903 new Transform("\xC2\xA0", kIdentity, ""), 24904 new Transform(" ", kIdentity, ","), 24905 new Transform("", kUppercaseFirst, '="'), 24906 new Transform("", kUppercaseAll, '="'), 24907 new Transform("", kIdentity, "ous "), 24908 new Transform("", kUppercaseAll, ", "), 24909 new Transform("", kUppercaseFirst, "='"), 24910 new Transform(" ", kUppercaseFirst, ","), 24911 new Transform(" ", kUppercaseAll, '="'), 24912 new Transform(" ", kUppercaseAll, ", "), 24913 new Transform("", kUppercaseAll, ","), 24914 new Transform("", kUppercaseAll, "("), 24915 new Transform("", kUppercaseAll, ". "), 24916 new Transform(" ", kUppercaseAll, "."), 24917 new Transform("", kUppercaseAll, "='"), 24918 new Transform(" ", kUppercaseAll, ". "), 24919 new Transform(" ", kUppercaseFirst, '="'), 24920 new Transform(" ", kUppercaseAll, "='"), 24921 new Transform(" ", kUppercaseFirst, "='") 24922 ]; 24923 exports2.kTransforms = kTransforms; 24924 exports2.kNumTransforms = kTransforms.length; 24925 function ToUpperCase(p3, i2) { 24926 if (p3[i2] < 192) { 24927 if (p3[i2] >= 97 && p3[i2] <= 122) { 24928 p3[i2] ^= 32; 24929 } 24930 return 1; 24931 } 24932 if (p3[i2] < 224) { 24933 p3[i2 + 1] ^= 32; 24934 return 2; 24935 } 24936 p3[i2 + 2] ^= 5; 24937 return 3; 24938 } 24939 exports2.transformDictionaryWord = function(dst, idx, word, len, transform) { 24940 var prefix2 = kTransforms[transform].prefix; 24941 var suffix = kTransforms[transform].suffix; 24942 var t3 = kTransforms[transform].transform; 24943 var skip = t3 < kOmitFirst1 ? 0 : t3 - (kOmitFirst1 - 1); 24944 var i2 = 0; 24945 var start_idx = idx; 24946 var uppercase; 24947 if (skip > len) { 24948 skip = len; 24949 } 24950 var prefix_pos = 0; 24951 while (prefix_pos < prefix2.length) { 24952 dst[idx++] = prefix2[prefix_pos++]; 24953 } 24954 word += skip; 24955 len -= skip; 24956 if (t3 <= kOmitLast9) { 24957 len -= t3; 24958 } 24959 for (i2 = 0; i2 < len; i2++) { 24960 dst[idx++] = BrotliDictionary.dictionary[word + i2]; 24961 } 24962 uppercase = idx - len; 24963 if (t3 === kUppercaseFirst) { 24964 ToUpperCase(dst, uppercase); 24965 } else if (t3 === kUppercaseAll) { 24966 while (len > 0) { 24967 var step = ToUpperCase(dst, uppercase); 24968 uppercase += step; 24969 len -= step; 24970 } 24971 } 24972 var suffix_pos = 0; 24973 while (suffix_pos < suffix.length) { 24974 dst[idx++] = suffix[suffix_pos++]; 24975 } 24976 return idx - start_idx; 24977 }; 24978 }, 24979 { "./dictionary": 6 } 24980 ], 24981 12: [ 24982 function(require2, module2, exports2) { 24983 module2.exports = require2("./dec/decode").BrotliDecompressBuffer; 24984 }, 24985 { "./dec/decode": 3 } 24986 ] 24987 }, 24988 {}, 24989 [12] 24990 )(12); 24991 })(); 24992 24993 // packages/global-styles-ui/build-module/font-library/lib/inflate.mjs 24994 var __require3 = /* @__PURE__ */ ((x2) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x2, { 24995 get: (a2, b2) => (typeof __require !== "undefined" ? __require : a2)[b2] 24996 }) : x2)(function(x2) { 24997 if (typeof __require !== "undefined") return __require.apply(this, arguments); 24998 throw Error('Dynamic require of "' + x2 + '" is not supported'); 24999 }); 25000 var inflate_default = (function() { 25001 var define, module, exports; 25002 return (/* @__PURE__ */ (function() { 25003 function r3(e2, n2, t3) { 25004 function o3(i22, f2) { 25005 if (!n2[i22]) { 25006 if (!e2[i22]) { 25007 var c6 = "function" == typeof __require3 && __require3; 25008 if (!f2 && c6) return c6(i22, true); 25009 if (u2) return u2(i22, true); 25010 var a2 = new Error("Cannot find module '" + i22 + "'"); 25011 throw a2.code = "MODULE_NOT_FOUND", a2; 25012 } 25013 var p3 = n2[i22] = { exports: {} }; 25014 e2[i22][0].call( 25015 p3.exports, 25016 function(r22) { 25017 var n22 = e2[i22][1][r22]; 25018 return o3(n22 || r22); 25019 }, 25020 p3, 25021 p3.exports, 25022 r3, 25023 e2, 25024 n2, 25025 t3 25026 ); 25027 } 25028 return n2[i22].exports; 25029 } 25030 for (var u2 = "function" == typeof __require3 && __require3, i2 = 0; i2 < t3.length; i2++) 25031 o3(t3[i2]); 25032 return o3; 25033 } 25034 return r3; 25035 })())( 25036 { 25037 1: [ 25038 function(require2, module2, exports2) { 25039 "use strict"; 25040 var TYPED_OK = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Int32Array !== "undefined"; 25041 function _has(obj, key) { 25042 return Object.prototype.hasOwnProperty.call(obj, key); 25043 } 25044 exports2.assign = function(obj) { 25045 var sources = Array.prototype.slice.call( 25046 arguments, 25047 1 25048 ); 25049 while (sources.length) { 25050 var source = sources.shift(); 25051 if (!source) { 25052 continue; 25053 } 25054 if (typeof source !== "object") { 25055 throw new TypeError( 25056 source + "must be non-object" 25057 ); 25058 } 25059 for (var p3 in source) { 25060 if (_has(source, p3)) { 25061 obj[p3] = source[p3]; 25062 } 25063 } 25064 } 25065 return obj; 25066 }; 25067 exports2.shrinkBuf = function(buf, size4) { 25068 if (buf.length === size4) { 25069 return buf; 25070 } 25071 if (buf.subarray) { 25072 return buf.subarray(0, size4); 25073 } 25074 buf.length = size4; 25075 return buf; 25076 }; 25077 var fnTyped = { 25078 arraySet: function(dest, src, src_offs, len, dest_offs) { 25079 if (src.subarray && dest.subarray) { 25080 dest.set( 25081 src.subarray(src_offs, src_offs + len), 25082 dest_offs 25083 ); 25084 return; 25085 } 25086 for (var i2 = 0; i2 < len; i2++) { 25087 dest[dest_offs + i2] = src[src_offs + i2]; 25088 } 25089 }, 25090 // Join array of chunks to single array. 25091 flattenChunks: function(chunks) { 25092 var i2, l2, len, pos, chunk2, result; 25093 len = 0; 25094 for (i2 = 0, l2 = chunks.length; i2 < l2; i2++) { 25095 len += chunks[i2].length; 25096 } 25097 result = new Uint8Array(len); 25098 pos = 0; 25099 for (i2 = 0, l2 = chunks.length; i2 < l2; i2++) { 25100 chunk2 = chunks[i2]; 25101 result.set(chunk2, pos); 25102 pos += chunk2.length; 25103 } 25104 return result; 25105 } 25106 }; 25107 var fnUntyped = { 25108 arraySet: function(dest, src, src_offs, len, dest_offs) { 25109 for (var i2 = 0; i2 < len; i2++) { 25110 dest[dest_offs + i2] = src[src_offs + i2]; 25111 } 25112 }, 25113 // Join array of chunks to single array. 25114 flattenChunks: function(chunks) { 25115 return [].concat.apply([], chunks); 25116 } 25117 }; 25118 exports2.setTyped = function(on) { 25119 if (on) { 25120 exports2.Buf8 = Uint8Array; 25121 exports2.Buf16 = Uint16Array; 25122 exports2.Buf32 = Int32Array; 25123 exports2.assign(exports2, fnTyped); 25124 } else { 25125 exports2.Buf8 = Array; 25126 exports2.Buf16 = Array; 25127 exports2.Buf32 = Array; 25128 exports2.assign(exports2, fnUntyped); 25129 } 25130 }; 25131 exports2.setTyped(TYPED_OK); 25132 }, 25133 {} 25134 ], 25135 2: [ 25136 function(require2, module2, exports2) { 25137 "use strict"; 25138 var utils = require2("./common"); 25139 var STR_APPLY_OK = true; 25140 var STR_APPLY_UIA_OK = true; 25141 try { 25142 String.fromCharCode.apply(null, [0]); 25143 } catch (__150) { 25144 STR_APPLY_OK = false; 25145 } 25146 try { 25147 String.fromCharCode.apply(null, new Uint8Array(1)); 25148 } catch (__150) { 25149 STR_APPLY_UIA_OK = false; 25150 } 25151 var _utf8len = new utils.Buf8(256); 25152 for (var q = 0; q < 256; q++) { 25153 _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1; 25154 } 25155 _utf8len[254] = _utf8len[254] = 1; 25156 exports2.string2buf = function(str) { 25157 var buf, c6, c22, m_pos, i2, str_len = str.length, buf_len = 0; 25158 for (m_pos = 0; m_pos < str_len; m_pos++) { 25159 c6 = str.charCodeAt(m_pos); 25160 if ((c6 & 64512) === 55296 && m_pos + 1 < str_len) { 25161 c22 = str.charCodeAt(m_pos + 1); 25162 if ((c22 & 64512) === 56320) { 25163 c6 = 65536 + (c6 - 55296 << 10) + (c22 - 56320); 25164 m_pos++; 25165 } 25166 } 25167 buf_len += c6 < 128 ? 1 : c6 < 2048 ? 2 : c6 < 65536 ? 3 : 4; 25168 } 25169 buf = new utils.Buf8(buf_len); 25170 for (i2 = 0, m_pos = 0; i2 < buf_len; m_pos++) { 25171 c6 = str.charCodeAt(m_pos); 25172 if ((c6 & 64512) === 55296 && m_pos + 1 < str_len) { 25173 c22 = str.charCodeAt(m_pos + 1); 25174 if ((c22 & 64512) === 56320) { 25175 c6 = 65536 + (c6 - 55296 << 10) + (c22 - 56320); 25176 m_pos++; 25177 } 25178 } 25179 if (c6 < 128) { 25180 buf[i2++] = c6; 25181 } else if (c6 < 2048) { 25182 buf[i2++] = 192 | c6 >>> 6; 25183 buf[i2++] = 128 | c6 & 63; 25184 } else if (c6 < 65536) { 25185 buf[i2++] = 224 | c6 >>> 12; 25186 buf[i2++] = 128 | c6 >>> 6 & 63; 25187 buf[i2++] = 128 | c6 & 63; 25188 } else { 25189 buf[i2++] = 240 | c6 >>> 18; 25190 buf[i2++] = 128 | c6 >>> 12 & 63; 25191 buf[i2++] = 128 | c6 >>> 6 & 63; 25192 buf[i2++] = 128 | c6 & 63; 25193 } 25194 } 25195 return buf; 25196 }; 25197 function buf2binstring(buf, len) { 25198 if (len < 65534) { 25199 if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) { 25200 return String.fromCharCode.apply( 25201 null, 25202 utils.shrinkBuf(buf, len) 25203 ); 25204 } 25205 } 25206 var result = ""; 25207 for (var i2 = 0; i2 < len; i2++) { 25208 result += String.fromCharCode(buf[i2]); 25209 } 25210 return result; 25211 } 25212 exports2.buf2binstring = function(buf) { 25213 return buf2binstring(buf, buf.length); 25214 }; 25215 exports2.binstring2buf = function(str) { 25216 var buf = new utils.Buf8(str.length); 25217 for (var i2 = 0, len = buf.length; i2 < len; i2++) { 25218 buf[i2] = str.charCodeAt(i2); 25219 } 25220 return buf; 25221 }; 25222 exports2.buf2string = function(buf, max2) { 25223 var i2, out, c6, c_len; 25224 var len = max2 || buf.length; 25225 var utf16buf = new Array(len * 2); 25226 for (out = 0, i2 = 0; i2 < len; ) { 25227 c6 = buf[i2++]; 25228 if (c6 < 128) { 25229 utf16buf[out++] = c6; 25230 continue; 25231 } 25232 c_len = _utf8len[c6]; 25233 if (c_len > 4) { 25234 utf16buf[out++] = 65533; 25235 i2 += c_len - 1; 25236 continue; 25237 } 25238 c6 &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7; 25239 while (c_len > 1 && i2 < len) { 25240 c6 = c6 << 6 | buf[i2++] & 63; 25241 c_len--; 25242 } 25243 if (c_len > 1) { 25244 utf16buf[out++] = 65533; 25245 continue; 25246 } 25247 if (c6 < 65536) { 25248 utf16buf[out++] = c6; 25249 } else { 25250 c6 -= 65536; 25251 utf16buf[out++] = 55296 | c6 >> 10 & 1023; 25252 utf16buf[out++] = 56320 | c6 & 1023; 25253 } 25254 } 25255 return buf2binstring(utf16buf, out); 25256 }; 25257 exports2.utf8border = function(buf, max2) { 25258 var pos; 25259 max2 = max2 || buf.length; 25260 if (max2 > buf.length) { 25261 max2 = buf.length; 25262 } 25263 pos = max2 - 1; 25264 while (pos >= 0 && (buf[pos] & 192) === 128) { 25265 pos--; 25266 } 25267 if (pos < 0) { 25268 return max2; 25269 } 25270 if (pos === 0) { 25271 return max2; 25272 } 25273 return pos + _utf8len[buf[pos]] > max2 ? pos : max2; 25274 }; 25275 }, 25276 { "./common": 1 } 25277 ], 25278 3: [ 25279 function(require2, module2, exports2) { 25280 "use strict"; 25281 function adler32(adler, buf, len, pos) { 25282 var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n2 = 0; 25283 while (len !== 0) { 25284 n2 = len > 2e3 ? 2e3 : len; 25285 len -= n2; 25286 do { 25287 s1 = s1 + buf[pos++] | 0; 25288 s2 = s2 + s1 | 0; 25289 } while (--n2); 25290 s1 %= 65521; 25291 s2 %= 65521; 25292 } 25293 return s1 | s2 << 16 | 0; 25294 } 25295 module2.exports = adler32; 25296 }, 25297 {} 25298 ], 25299 4: [ 25300 function(require2, module2, exports2) { 25301 "use strict"; 25302 module2.exports = { 25303 /* Allowed flush values; see deflate() and inflate() below for details */ 25304 Z_NO_FLUSH: 0, 25305 Z_PARTIAL_FLUSH: 1, 25306 Z_SYNC_FLUSH: 2, 25307 Z_FULL_FLUSH: 3, 25308 Z_FINISH: 4, 25309 Z_BLOCK: 5, 25310 Z_TREES: 6, 25311 /* Return codes for the compression/decompression functions. Negative values 25312 * are errors, positive values are used for special but normal events. 25313 */ 25314 Z_OK: 0, 25315 Z_STREAM_END: 1, 25316 Z_NEED_DICT: 2, 25317 Z_ERRNO: -1, 25318 Z_STREAM_ERROR: -2, 25319 Z_DATA_ERROR: -3, 25320 //Z_MEM_ERROR: -4, 25321 Z_BUF_ERROR: -5, 25322 //Z_VERSION_ERROR: -6, 25323 /* compression levels */ 25324 Z_NO_COMPRESSION: 0, 25325 Z_BEST_SPEED: 1, 25326 Z_BEST_COMPRESSION: 9, 25327 Z_DEFAULT_COMPRESSION: -1, 25328 Z_FILTERED: 1, 25329 Z_HUFFMAN_ONLY: 2, 25330 Z_RLE: 3, 25331 Z_FIXED: 4, 25332 Z_DEFAULT_STRATEGY: 0, 25333 /* Possible values of the data_type field (though see inflate()) */ 25334 Z_BINARY: 0, 25335 Z_TEXT: 1, 25336 //Z_ASCII: 1, // = Z_TEXT (deprecated) 25337 Z_UNKNOWN: 2, 25338 /* The deflate compression method */ 25339 Z_DEFLATED: 8 25340 //Z_NULL: null // Use -1 or null inline, depending on var type 25341 }; 25342 }, 25343 {} 25344 ], 25345 5: [ 25346 function(require2, module2, exports2) { 25347 "use strict"; 25348 function makeTable() { 25349 var c6, table = []; 25350 for (var n2 = 0; n2 < 256; n2++) { 25351 c6 = n2; 25352 for (var k2 = 0; k2 < 8; k2++) { 25353 c6 = c6 & 1 ? 3988292384 ^ c6 >>> 1 : c6 >>> 1; 25354 } 25355 table[n2] = c6; 25356 } 25357 return table; 25358 } 25359 var crcTable = makeTable(); 25360 function crc32(crc, buf, len, pos) { 25361 var t3 = crcTable, end = pos + len; 25362 crc ^= -1; 25363 for (var i2 = pos; i2 < end; i2++) { 25364 crc = crc >>> 8 ^ t3[(crc ^ buf[i2]) & 255]; 25365 } 25366 return crc ^ -1; 25367 } 25368 module2.exports = crc32; 25369 }, 25370 {} 25371 ], 25372 6: [ 25373 function(require2, module2, exports2) { 25374 "use strict"; 25375 function GZheader() { 25376 this.text = 0; 25377 this.time = 0; 25378 this.xflags = 0; 25379 this.os = 0; 25380 this.extra = null; 25381 this.extra_len = 0; 25382 this.name = ""; 25383 this.comment = ""; 25384 this.hcrc = 0; 25385 this.done = false; 25386 } 25387 module2.exports = GZheader; 25388 }, 25389 {} 25390 ], 25391 7: [ 25392 function(require2, module2, exports2) { 25393 "use strict"; 25394 var BAD = 30; 25395 var TYPE = 12; 25396 module2.exports = function inflate_fast(strm, start2) { 25397 var state; 25398 var _in; 25399 var last; 25400 var _out; 25401 var beg; 25402 var end; 25403 var dmax; 25404 var wsize; 25405 var whave; 25406 var wnext; 25407 var s_window; 25408 var hold; 25409 var bits; 25410 var lcode; 25411 var dcode; 25412 var lmask; 25413 var dmask; 25414 var here; 25415 var op; 25416 var len; 25417 var dist; 25418 var from; 25419 var from_source; 25420 var input, output; 25421 state = strm.state; 25422 _in = strm.next_in; 25423 input = strm.input; 25424 last = _in + (strm.avail_in - 5); 25425 _out = strm.next_out; 25426 output = strm.output; 25427 beg = _out - (start2 - strm.avail_out); 25428 end = _out + (strm.avail_out - 257); 25429 dmax = state.dmax; 25430 wsize = state.wsize; 25431 whave = state.whave; 25432 wnext = state.wnext; 25433 s_window = state.window; 25434 hold = state.hold; 25435 bits = state.bits; 25436 lcode = state.lencode; 25437 dcode = state.distcode; 25438 lmask = (1 << state.lenbits) - 1; 25439 dmask = (1 << state.distbits) - 1; 25440 top: do { 25441 if (bits < 15) { 25442 hold += input[_in++] << bits; 25443 bits += 8; 25444 hold += input[_in++] << bits; 25445 bits += 8; 25446 } 25447 here = lcode[hold & lmask]; 25448 dolen: for (; ; ) { 25449 op = here >>> 24; 25450 hold >>>= op; 25451 bits -= op; 25452 op = here >>> 16 & 255; 25453 if (op === 0) { 25454 output[_out++] = here & 65535; 25455 } else if (op & 16) { 25456 len = here & 65535; 25457 op &= 15; 25458 if (op) { 25459 if (bits < op) { 25460 hold += input[_in++] << bits; 25461 bits += 8; 25462 } 25463 len += hold & (1 << op) - 1; 25464 hold >>>= op; 25465 bits -= op; 25466 } 25467 if (bits < 15) { 25468 hold += input[_in++] << bits; 25469 bits += 8; 25470 hold += input[_in++] << bits; 25471 bits += 8; 25472 } 25473 here = dcode[hold & dmask]; 25474 dodist: for (; ; ) { 25475 op = here >>> 24; 25476 hold >>>= op; 25477 bits -= op; 25478 op = here >>> 16 & 255; 25479 if (op & 16) { 25480 dist = here & 65535; 25481 op &= 15; 25482 if (bits < op) { 25483 hold += input[_in++] << bits; 25484 bits += 8; 25485 if (bits < op) { 25486 hold += input[_in++] << bits; 25487 bits += 8; 25488 } 25489 } 25490 dist += hold & (1 << op) - 1; 25491 if (dist > dmax) { 25492 strm.msg = "invalid distance too far back"; 25493 state.mode = BAD; 25494 break top; 25495 } 25496 hold >>>= op; 25497 bits -= op; 25498 op = _out - beg; 25499 if (dist > op) { 25500 op = dist - op; 25501 if (op > whave) { 25502 if (state.sane) { 25503 strm.msg = "invalid distance too far back"; 25504 state.mode = BAD; 25505 break top; 25506 } 25507 } 25508 from = 0; 25509 from_source = s_window; 25510 if (wnext === 0) { 25511 from += wsize - op; 25512 if (op < len) { 25513 len -= op; 25514 do { 25515 output[_out++] = s_window[from++]; 25516 } while (--op); 25517 from = _out - dist; 25518 from_source = output; 25519 } 25520 } else if (wnext < op) { 25521 from += wsize + wnext - op; 25522 op -= wnext; 25523 if (op < len) { 25524 len -= op; 25525 do { 25526 output[_out++] = s_window[from++]; 25527 } while (--op); 25528 from = 0; 25529 if (wnext < len) { 25530 op = wnext; 25531 len -= op; 25532 do { 25533 output[_out++] = s_window[from++]; 25534 } while (--op); 25535 from = _out - dist; 25536 from_source = output; 25537 } 25538 } 25539 } else { 25540 from += wnext - op; 25541 if (op < len) { 25542 len -= op; 25543 do { 25544 output[_out++] = s_window[from++]; 25545 } while (--op); 25546 from = _out - dist; 25547 from_source = output; 25548 } 25549 } 25550 while (len > 2) { 25551 output[_out++] = from_source[from++]; 25552 output[_out++] = from_source[from++]; 25553 output[_out++] = from_source[from++]; 25554 len -= 3; 25555 } 25556 if (len) { 25557 output[_out++] = from_source[from++]; 25558 if (len > 1) { 25559 output[_out++] = from_source[from++]; 25560 } 25561 } 25562 } else { 25563 from = _out - dist; 25564 do { 25565 output[_out++] = output[from++]; 25566 output[_out++] = output[from++]; 25567 output[_out++] = output[from++]; 25568 len -= 3; 25569 } while (len > 2); 25570 if (len) { 25571 output[_out++] = output[from++]; 25572 if (len > 1) { 25573 output[_out++] = output[from++]; 25574 } 25575 } 25576 } 25577 } else if ((op & 64) === 0) { 25578 here = dcode[(here & 65535) + (hold & (1 << op) - 1)]; 25579 continue dodist; 25580 } else { 25581 strm.msg = "invalid distance code"; 25582 state.mode = BAD; 25583 break top; 25584 } 25585 break; 25586 } 25587 } else if ((op & 64) === 0) { 25588 here = lcode[(here & 65535) + (hold & (1 << op) - 1)]; 25589 continue dolen; 25590 } else if (op & 32) { 25591 state.mode = TYPE; 25592 break top; 25593 } else { 25594 strm.msg = "invalid literal/length code"; 25595 state.mode = BAD; 25596 break top; 25597 } 25598 break; 25599 } 25600 } while (_in < last && _out < end); 25601 len = bits >> 3; 25602 _in -= len; 25603 bits -= len << 3; 25604 hold &= (1 << bits) - 1; 25605 strm.next_in = _in; 25606 strm.next_out = _out; 25607 strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last); 25608 strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); 25609 state.hold = hold; 25610 state.bits = bits; 25611 return; 25612 }; 25613 }, 25614 {} 25615 ], 25616 8: [ 25617 function(require2, module2, exports2) { 25618 "use strict"; 25619 var utils = require2("../utils/common"); 25620 var adler32 = require2("./adler32"); 25621 var crc32 = require2("./crc32"); 25622 var inflate_fast = require2("./inffast"); 25623 var inflate_table = require2("./inftrees"); 25624 var CODES = 0; 25625 var LENS = 1; 25626 var DISTS = 2; 25627 var Z_FINISH = 4; 25628 var Z_BLOCK = 5; 25629 var Z_TREES = 6; 25630 var Z_OK = 0; 25631 var Z_STREAM_END = 1; 25632 var Z_NEED_DICT = 2; 25633 var Z_STREAM_ERROR = -2; 25634 var Z_DATA_ERROR = -3; 25635 var Z_MEM_ERROR = -4; 25636 var Z_BUF_ERROR = -5; 25637 var Z_DEFLATED = 8; 25638 var HEAD = 1; 25639 var FLAGS = 2; 25640 var TIME = 3; 25641 var OS = 4; 25642 var EXLEN = 5; 25643 var EXTRA = 6; 25644 var NAME = 7; 25645 var COMMENT = 8; 25646 var HCRC = 9; 25647 var DICTID = 10; 25648 var DICT = 11; 25649 var TYPE = 12; 25650 var TYPEDO = 13; 25651 var STORED = 14; 25652 var COPY_ = 15; 25653 var COPY = 16; 25654 var TABLE = 17; 25655 var LENLENS = 18; 25656 var CODELENS = 19; 25657 var LEN_ = 20; 25658 var LEN = 21; 25659 var LENEXT = 22; 25660 var DIST = 23; 25661 var DISTEXT = 24; 25662 var MATCH = 25; 25663 var LIT = 26; 25664 var CHECK = 27; 25665 var LENGTH = 28; 25666 var DONE = 29; 25667 var BAD = 30; 25668 var MEM = 31; 25669 var SYNC = 32; 25670 var ENOUGH_LENS = 852; 25671 var ENOUGH_DISTS = 592; 25672 var MAX_WBITS = 15; 25673 var DEF_WBITS = MAX_WBITS; 25674 function zswap32(q) { 25675 return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24); 25676 } 25677 function InflateState() { 25678 this.mode = 0; 25679 this.last = false; 25680 this.wrap = 0; 25681 this.havedict = false; 25682 this.flags = 0; 25683 this.dmax = 0; 25684 this.check = 0; 25685 this.total = 0; 25686 this.head = null; 25687 this.wbits = 0; 25688 this.wsize = 0; 25689 this.whave = 0; 25690 this.wnext = 0; 25691 this.window = null; 25692 this.hold = 0; 25693 this.bits = 0; 25694 this.length = 0; 25695 this.offset = 0; 25696 this.extra = 0; 25697 this.lencode = null; 25698 this.distcode = null; 25699 this.lenbits = 0; 25700 this.distbits = 0; 25701 this.ncode = 0; 25702 this.nlen = 0; 25703 this.ndist = 0; 25704 this.have = 0; 25705 this.next = null; 25706 this.lens = new utils.Buf16( 25707 320 25708 ); 25709 this.work = new utils.Buf16( 25710 288 25711 ); 25712 this.lendyn = null; 25713 this.distdyn = null; 25714 this.sane = 0; 25715 this.back = 0; 25716 this.was = 0; 25717 } 25718 function inflateResetKeep(strm) { 25719 var state; 25720 if (!strm || !strm.state) { 25721 return Z_STREAM_ERROR; 25722 } 25723 state = strm.state; 25724 strm.total_in = strm.total_out = state.total = 0; 25725 strm.msg = ""; 25726 if (state.wrap) { 25727 strm.adler = state.wrap & 1; 25728 } 25729 state.mode = HEAD; 25730 state.last = 0; 25731 state.havedict = 0; 25732 state.dmax = 32768; 25733 state.head = null; 25734 state.hold = 0; 25735 state.bits = 0; 25736 state.lencode = state.lendyn = new utils.Buf32( 25737 ENOUGH_LENS 25738 ); 25739 state.distcode = state.distdyn = new utils.Buf32( 25740 ENOUGH_DISTS 25741 ); 25742 state.sane = 1; 25743 state.back = -1; 25744 return Z_OK; 25745 } 25746 function inflateReset(strm) { 25747 var state; 25748 if (!strm || !strm.state) { 25749 return Z_STREAM_ERROR; 25750 } 25751 state = strm.state; 25752 state.wsize = 0; 25753 state.whave = 0; 25754 state.wnext = 0; 25755 return inflateResetKeep(strm); 25756 } 25757 function inflateReset2(strm, windowBits) { 25758 var wrap; 25759 var state; 25760 if (!strm || !strm.state) { 25761 return Z_STREAM_ERROR; 25762 } 25763 state = strm.state; 25764 if (windowBits < 0) { 25765 wrap = 0; 25766 windowBits = -windowBits; 25767 } else { 25768 wrap = (windowBits >> 4) + 1; 25769 if (windowBits < 48) { 25770 windowBits &= 15; 25771 } 25772 } 25773 if (windowBits && (windowBits < 8 || windowBits > 15)) { 25774 return Z_STREAM_ERROR; 25775 } 25776 if (state.window !== null && state.wbits !== windowBits) { 25777 state.window = null; 25778 } 25779 state.wrap = wrap; 25780 state.wbits = windowBits; 25781 return inflateReset(strm); 25782 } 25783 function inflateInit2(strm, windowBits) { 25784 var ret; 25785 var state; 25786 if (!strm) { 25787 return Z_STREAM_ERROR; 25788 } 25789 state = new InflateState(); 25790 strm.state = state; 25791 state.window = null; 25792 ret = inflateReset2(strm, windowBits); 25793 if (ret !== Z_OK) { 25794 strm.state = null; 25795 } 25796 return ret; 25797 } 25798 function inflateInit(strm) { 25799 return inflateInit2(strm, DEF_WBITS); 25800 } 25801 var virgin = true; 25802 var lenfix, distfix; 25803 function fixedtables(state) { 25804 if (virgin) { 25805 var sym; 25806 lenfix = new utils.Buf32(512); 25807 distfix = new utils.Buf32(32); 25808 sym = 0; 25809 while (sym < 144) { 25810 state.lens[sym++] = 8; 25811 } 25812 while (sym < 256) { 25813 state.lens[sym++] = 9; 25814 } 25815 while (sym < 280) { 25816 state.lens[sym++] = 7; 25817 } 25818 while (sym < 288) { 25819 state.lens[sym++] = 8; 25820 } 25821 inflate_table( 25822 LENS, 25823 state.lens, 25824 0, 25825 288, 25826 lenfix, 25827 0, 25828 state.work, 25829 { bits: 9 } 25830 ); 25831 sym = 0; 25832 while (sym < 32) { 25833 state.lens[sym++] = 5; 25834 } 25835 inflate_table( 25836 DISTS, 25837 state.lens, 25838 0, 25839 32, 25840 distfix, 25841 0, 25842 state.work, 25843 { bits: 5 } 25844 ); 25845 virgin = false; 25846 } 25847 state.lencode = lenfix; 25848 state.lenbits = 9; 25849 state.distcode = distfix; 25850 state.distbits = 5; 25851 } 25852 function updatewindow(strm, src, end, copy) { 25853 var dist; 25854 var state = strm.state; 25855 if (state.window === null) { 25856 state.wsize = 1 << state.wbits; 25857 state.wnext = 0; 25858 state.whave = 0; 25859 state.window = new utils.Buf8(state.wsize); 25860 } 25861 if (copy >= state.wsize) { 25862 utils.arraySet( 25863 state.window, 25864 src, 25865 end - state.wsize, 25866 state.wsize, 25867 0 25868 ); 25869 state.wnext = 0; 25870 state.whave = state.wsize; 25871 } else { 25872 dist = state.wsize - state.wnext; 25873 if (dist > copy) { 25874 dist = copy; 25875 } 25876 utils.arraySet( 25877 state.window, 25878 src, 25879 end - copy, 25880 dist, 25881 state.wnext 25882 ); 25883 copy -= dist; 25884 if (copy) { 25885 utils.arraySet( 25886 state.window, 25887 src, 25888 end - copy, 25889 copy, 25890 0 25891 ); 25892 state.wnext = copy; 25893 state.whave = state.wsize; 25894 } else { 25895 state.wnext += dist; 25896 if (state.wnext === state.wsize) { 25897 state.wnext = 0; 25898 } 25899 if (state.whave < state.wsize) { 25900 state.whave += dist; 25901 } 25902 } 25903 } 25904 return 0; 25905 } 25906 function inflate(strm, flush2) { 25907 var state; 25908 var input, output; 25909 var next; 25910 var put; 25911 var have, left; 25912 var hold; 25913 var bits; 25914 var _in, _out; 25915 var copy; 25916 var from; 25917 var from_source; 25918 var here = 0; 25919 var here_bits, here_op, here_val; 25920 var last_bits, last_op, last_val; 25921 var len; 25922 var ret; 25923 var hbuf = new utils.Buf8( 25924 4 25925 ); 25926 var opts; 25927 var n2; 25928 var order = ( 25929 /* permutation of code lengths */ 25930 [ 25931 16, 25932 17, 25933 18, 25934 0, 25935 8, 25936 7, 25937 9, 25938 6, 25939 10, 25940 5, 25941 11, 25942 4, 25943 12, 25944 3, 25945 13, 25946 2, 25947 14, 25948 1, 25949 15 25950 ] 25951 ); 25952 if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) { 25953 return Z_STREAM_ERROR; 25954 } 25955 state = strm.state; 25956 if (state.mode === TYPE) { 25957 state.mode = TYPEDO; 25958 } 25959 put = strm.next_out; 25960 output = strm.output; 25961 left = strm.avail_out; 25962 next = strm.next_in; 25963 input = strm.input; 25964 have = strm.avail_in; 25965 hold = state.hold; 25966 bits = state.bits; 25967 _in = have; 25968 _out = left; 25969 ret = Z_OK; 25970 inf_leave: for (; ; ) { 25971 switch (state.mode) { 25972 case HEAD: 25973 if (state.wrap === 0) { 25974 state.mode = TYPEDO; 25975 break; 25976 } 25977 while (bits < 16) { 25978 if (have === 0) { 25979 break inf_leave; 25980 } 25981 have--; 25982 hold += input[next++] << bits; 25983 bits += 8; 25984 } 25985 if (state.wrap & 2 && hold === 35615) { 25986 state.check = 0; 25987 hbuf[0] = hold & 255; 25988 hbuf[1] = hold >>> 8 & 255; 25989 state.check = crc32( 25990 state.check, 25991 hbuf, 25992 2, 25993 0 25994 ); 25995 hold = 0; 25996 bits = 0; 25997 state.mode = FLAGS; 25998 break; 25999 } 26000 state.flags = 0; 26001 if (state.head) { 26002 state.head.done = false; 26003 } 26004 if (!(state.wrap & 1) || (((hold & 255) << 8) + (hold >> 8)) % 31) { 26005 strm.msg = "incorrect header check"; 26006 state.mode = BAD; 26007 break; 26008 } 26009 if ((hold & 15) !== Z_DEFLATED) { 26010 strm.msg = "unknown compression method"; 26011 state.mode = BAD; 26012 break; 26013 } 26014 hold >>>= 4; 26015 bits -= 4; 26016 len = (hold & 15) + 8; 26017 if (state.wbits === 0) { 26018 state.wbits = len; 26019 } else if (len > state.wbits) { 26020 strm.msg = "invalid window size"; 26021 state.mode = BAD; 26022 break; 26023 } 26024 state.dmax = 1 << len; 26025 strm.adler = state.check = 1; 26026 state.mode = hold & 512 ? DICTID : TYPE; 26027 hold = 0; 26028 bits = 0; 26029 break; 26030 case FLAGS: 26031 while (bits < 16) { 26032 if (have === 0) { 26033 break inf_leave; 26034 } 26035 have--; 26036 hold += input[next++] << bits; 26037 bits += 8; 26038 } 26039 state.flags = hold; 26040 if ((state.flags & 255) !== Z_DEFLATED) { 26041 strm.msg = "unknown compression method"; 26042 state.mode = BAD; 26043 break; 26044 } 26045 if (state.flags & 57344) { 26046 strm.msg = "unknown header flags set"; 26047 state.mode = BAD; 26048 break; 26049 } 26050 if (state.head) { 26051 state.head.text = hold >> 8 & 1; 26052 } 26053 if (state.flags & 512) { 26054 hbuf[0] = hold & 255; 26055 hbuf[1] = hold >>> 8 & 255; 26056 state.check = crc32( 26057 state.check, 26058 hbuf, 26059 2, 26060 0 26061 ); 26062 } 26063 hold = 0; 26064 bits = 0; 26065 state.mode = TIME; 26066 /* falls through */ 26067 case TIME: 26068 while (bits < 32) { 26069 if (have === 0) { 26070 break inf_leave; 26071 } 26072 have--; 26073 hold += input[next++] << bits; 26074 bits += 8; 26075 } 26076 if (state.head) { 26077 state.head.time = hold; 26078 } 26079 if (state.flags & 512) { 26080 hbuf[0] = hold & 255; 26081 hbuf[1] = hold >>> 8 & 255; 26082 hbuf[2] = hold >>> 16 & 255; 26083 hbuf[3] = hold >>> 24 & 255; 26084 state.check = crc32( 26085 state.check, 26086 hbuf, 26087 4, 26088 0 26089 ); 26090 } 26091 hold = 0; 26092 bits = 0; 26093 state.mode = OS; 26094 /* falls through */ 26095 case OS: 26096 while (bits < 16) { 26097 if (have === 0) { 26098 break inf_leave; 26099 } 26100 have--; 26101 hold += input[next++] << bits; 26102 bits += 8; 26103 } 26104 if (state.head) { 26105 state.head.xflags = hold & 255; 26106 state.head.os = hold >> 8; 26107 } 26108 if (state.flags & 512) { 26109 hbuf[0] = hold & 255; 26110 hbuf[1] = hold >>> 8 & 255; 26111 state.check = crc32( 26112 state.check, 26113 hbuf, 26114 2, 26115 0 26116 ); 26117 } 26118 hold = 0; 26119 bits = 0; 26120 state.mode = EXLEN; 26121 /* falls through */ 26122 case EXLEN: 26123 if (state.flags & 1024) { 26124 while (bits < 16) { 26125 if (have === 0) { 26126 break inf_leave; 26127 } 26128 have--; 26129 hold += input[next++] << bits; 26130 bits += 8; 26131 } 26132 state.length = hold; 26133 if (state.head) { 26134 state.head.extra_len = hold; 26135 } 26136 if (state.flags & 512) { 26137 hbuf[0] = hold & 255; 26138 hbuf[1] = hold >>> 8 & 255; 26139 state.check = crc32( 26140 state.check, 26141 hbuf, 26142 2, 26143 0 26144 ); 26145 } 26146 hold = 0; 26147 bits = 0; 26148 } else if (state.head) { 26149 state.head.extra = null; 26150 } 26151 state.mode = EXTRA; 26152 /* falls through */ 26153 case EXTRA: 26154 if (state.flags & 1024) { 26155 copy = state.length; 26156 if (copy > have) { 26157 copy = have; 26158 } 26159 if (copy) { 26160 if (state.head) { 26161 len = state.head.extra_len - state.length; 26162 if (!state.head.extra) { 26163 state.head.extra = new Array( 26164 state.head.extra_len 26165 ); 26166 } 26167 utils.arraySet( 26168 state.head.extra, 26169 input, 26170 next, 26171 // extra field is limited to 65536 bytes 26172 // - no need for additional size check 26173 copy, 26174 /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ 26175 len 26176 ); 26177 } 26178 if (state.flags & 512) { 26179 state.check = crc32( 26180 state.check, 26181 input, 26182 copy, 26183 next 26184 ); 26185 } 26186 have -= copy; 26187 next += copy; 26188 state.length -= copy; 26189 } 26190 if (state.length) { 26191 break inf_leave; 26192 } 26193 } 26194 state.length = 0; 26195 state.mode = NAME; 26196 /* falls through */ 26197 case NAME: 26198 if (state.flags & 2048) { 26199 if (have === 0) { 26200 break inf_leave; 26201 } 26202 copy = 0; 26203 do { 26204 len = input[next + copy++]; 26205 if (state.head && len && state.length < 65536) { 26206 state.head.name += String.fromCharCode(len); 26207 } 26208 } while (len && copy < have); 26209 if (state.flags & 512) { 26210 state.check = crc32( 26211 state.check, 26212 input, 26213 copy, 26214 next 26215 ); 26216 } 26217 have -= copy; 26218 next += copy; 26219 if (len) { 26220 break inf_leave; 26221 } 26222 } else if (state.head) { 26223 state.head.name = null; 26224 } 26225 state.length = 0; 26226 state.mode = COMMENT; 26227 /* falls through */ 26228 case COMMENT: 26229 if (state.flags & 4096) { 26230 if (have === 0) { 26231 break inf_leave; 26232 } 26233 copy = 0; 26234 do { 26235 len = input[next + copy++]; 26236 if (state.head && len && state.length < 65536) { 26237 state.head.comment += String.fromCharCode(len); 26238 } 26239 } while (len && copy < have); 26240 if (state.flags & 512) { 26241 state.check = crc32( 26242 state.check, 26243 input, 26244 copy, 26245 next 26246 ); 26247 } 26248 have -= copy; 26249 next += copy; 26250 if (len) { 26251 break inf_leave; 26252 } 26253 } else if (state.head) { 26254 state.head.comment = null; 26255 } 26256 state.mode = HCRC; 26257 /* falls through */ 26258 case HCRC: 26259 if (state.flags & 512) { 26260 while (bits < 16) { 26261 if (have === 0) { 26262 break inf_leave; 26263 } 26264 have--; 26265 hold += input[next++] << bits; 26266 bits += 8; 26267 } 26268 if (hold !== (state.check & 65535)) { 26269 strm.msg = "header crc mismatch"; 26270 state.mode = BAD; 26271 break; 26272 } 26273 hold = 0; 26274 bits = 0; 26275 } 26276 if (state.head) { 26277 state.head.hcrc = state.flags >> 9 & 1; 26278 state.head.done = true; 26279 } 26280 strm.adler = state.check = 0; 26281 state.mode = TYPE; 26282 break; 26283 case DICTID: 26284 while (bits < 32) { 26285 if (have === 0) { 26286 break inf_leave; 26287 } 26288 have--; 26289 hold += input[next++] << bits; 26290 bits += 8; 26291 } 26292 strm.adler = state.check = zswap32(hold); 26293 hold = 0; 26294 bits = 0; 26295 state.mode = DICT; 26296 /* falls through */ 26297 case DICT: 26298 if (state.havedict === 0) { 26299 strm.next_out = put; 26300 strm.avail_out = left; 26301 strm.next_in = next; 26302 strm.avail_in = have; 26303 state.hold = hold; 26304 state.bits = bits; 26305 return Z_NEED_DICT; 26306 } 26307 strm.adler = state.check = 1; 26308 state.mode = TYPE; 26309 /* falls through */ 26310 case TYPE: 26311 if (flush2 === Z_BLOCK || flush2 === Z_TREES) { 26312 break inf_leave; 26313 } 26314 /* falls through */ 26315 case TYPEDO: 26316 if (state.last) { 26317 hold >>>= bits & 7; 26318 bits -= bits & 7; 26319 state.mode = CHECK; 26320 break; 26321 } 26322 while (bits < 3) { 26323 if (have === 0) { 26324 break inf_leave; 26325 } 26326 have--; 26327 hold += input[next++] << bits; 26328 bits += 8; 26329 } 26330 state.last = hold & 1; 26331 hold >>>= 1; 26332 bits -= 1; 26333 switch (hold & 3) { 26334 case 0: 26335 state.mode = STORED; 26336 break; 26337 case 1: 26338 fixedtables(state); 26339 state.mode = LEN_; 26340 if (flush2 === Z_TREES) { 26341 hold >>>= 2; 26342 bits -= 2; 26343 break inf_leave; 26344 } 26345 break; 26346 case 2: 26347 state.mode = TABLE; 26348 break; 26349 case 3: 26350 strm.msg = "invalid block type"; 26351 state.mode = BAD; 26352 } 26353 hold >>>= 2; 26354 bits -= 2; 26355 break; 26356 case STORED: 26357 hold >>>= bits & 7; 26358 bits -= bits & 7; 26359 while (bits < 32) { 26360 if (have === 0) { 26361 break inf_leave; 26362 } 26363 have--; 26364 hold += input[next++] << bits; 26365 bits += 8; 26366 } 26367 if ((hold & 65535) !== (hold >>> 16 ^ 65535)) { 26368 strm.msg = "invalid stored block lengths"; 26369 state.mode = BAD; 26370 break; 26371 } 26372 state.length = hold & 65535; 26373 hold = 0; 26374 bits = 0; 26375 state.mode = COPY_; 26376 if (flush2 === Z_TREES) { 26377 break inf_leave; 26378 } 26379 /* falls through */ 26380 case COPY_: 26381 state.mode = COPY; 26382 /* falls through */ 26383 case COPY: 26384 copy = state.length; 26385 if (copy) { 26386 if (copy > have) { 26387 copy = have; 26388 } 26389 if (copy > left) { 26390 copy = left; 26391 } 26392 if (copy === 0) { 26393 break inf_leave; 26394 } 26395 utils.arraySet( 26396 output, 26397 input, 26398 next, 26399 copy, 26400 put 26401 ); 26402 have -= copy; 26403 next += copy; 26404 left -= copy; 26405 put += copy; 26406 state.length -= copy; 26407 break; 26408 } 26409 state.mode = TYPE; 26410 break; 26411 case TABLE: 26412 while (bits < 14) { 26413 if (have === 0) { 26414 break inf_leave; 26415 } 26416 have--; 26417 hold += input[next++] << bits; 26418 bits += 8; 26419 } 26420 state.nlen = (hold & 31) + 257; 26421 hold >>>= 5; 26422 bits -= 5; 26423 state.ndist = (hold & 31) + 1; 26424 hold >>>= 5; 26425 bits -= 5; 26426 state.ncode = (hold & 15) + 4; 26427 hold >>>= 4; 26428 bits -= 4; 26429 if (state.nlen > 286 || state.ndist > 30) { 26430 strm.msg = "too many length or distance symbols"; 26431 state.mode = BAD; 26432 break; 26433 } 26434 state.have = 0; 26435 state.mode = LENLENS; 26436 /* falls through */ 26437 case LENLENS: 26438 while (state.have < state.ncode) { 26439 while (bits < 3) { 26440 if (have === 0) { 26441 break inf_leave; 26442 } 26443 have--; 26444 hold += input[next++] << bits; 26445 bits += 8; 26446 } 26447 state.lens[order[state.have++]] = hold & 7; 26448 hold >>>= 3; 26449 bits -= 3; 26450 } 26451 while (state.have < 19) { 26452 state.lens[order[state.have++]] = 0; 26453 } 26454 state.lencode = state.lendyn; 26455 state.lenbits = 7; 26456 opts = { bits: state.lenbits }; 26457 ret = inflate_table( 26458 CODES, 26459 state.lens, 26460 0, 26461 19, 26462 state.lencode, 26463 0, 26464 state.work, 26465 opts 26466 ); 26467 state.lenbits = opts.bits; 26468 if (ret) { 26469 strm.msg = "invalid code lengths set"; 26470 state.mode = BAD; 26471 break; 26472 } 26473 state.have = 0; 26474 state.mode = CODELENS; 26475 /* falls through */ 26476 case CODELENS: 26477 while (state.have < state.nlen + state.ndist) { 26478 for (; ; ) { 26479 here = state.lencode[hold & (1 << state.lenbits) - 1]; 26480 here_bits = here >>> 24; 26481 here_op = here >>> 16 & 255; 26482 here_val = here & 65535; 26483 if (here_bits <= bits) { 26484 break; 26485 } 26486 if (have === 0) { 26487 break inf_leave; 26488 } 26489 have--; 26490 hold += input[next++] << bits; 26491 bits += 8; 26492 } 26493 if (here_val < 16) { 26494 hold >>>= here_bits; 26495 bits -= here_bits; 26496 state.lens[state.have++] = here_val; 26497 } else { 26498 if (here_val === 16) { 26499 n2 = here_bits + 2; 26500 while (bits < n2) { 26501 if (have === 0) { 26502 break inf_leave; 26503 } 26504 have--; 26505 hold += input[next++] << bits; 26506 bits += 8; 26507 } 26508 hold >>>= here_bits; 26509 bits -= here_bits; 26510 if (state.have === 0) { 26511 strm.msg = "invalid bit length repeat"; 26512 state.mode = BAD; 26513 break; 26514 } 26515 len = state.lens[state.have - 1]; 26516 copy = 3 + (hold & 3); 26517 hold >>>= 2; 26518 bits -= 2; 26519 } else if (here_val === 17) { 26520 n2 = here_bits + 3; 26521 while (bits < n2) { 26522 if (have === 0) { 26523 break inf_leave; 26524 } 26525 have--; 26526 hold += input[next++] << bits; 26527 bits += 8; 26528 } 26529 hold >>>= here_bits; 26530 bits -= here_bits; 26531 len = 0; 26532 copy = 3 + (hold & 7); 26533 hold >>>= 3; 26534 bits -= 3; 26535 } else { 26536 n2 = here_bits + 7; 26537 while (bits < n2) { 26538 if (have === 0) { 26539 break inf_leave; 26540 } 26541 have--; 26542 hold += input[next++] << bits; 26543 bits += 8; 26544 } 26545 hold >>>= here_bits; 26546 bits -= here_bits; 26547 len = 0; 26548 copy = 11 + (hold & 127); 26549 hold >>>= 7; 26550 bits -= 7; 26551 } 26552 if (state.have + copy > state.nlen + state.ndist) { 26553 strm.msg = "invalid bit length repeat"; 26554 state.mode = BAD; 26555 break; 26556 } 26557 while (copy--) { 26558 state.lens[state.have++] = len; 26559 } 26560 } 26561 } 26562 if (state.mode === BAD) { 26563 break; 26564 } 26565 if (state.lens[256] === 0) { 26566 strm.msg = "invalid code -- missing end-of-block"; 26567 state.mode = BAD; 26568 break; 26569 } 26570 state.lenbits = 9; 26571 opts = { bits: state.lenbits }; 26572 ret = inflate_table( 26573 LENS, 26574 state.lens, 26575 0, 26576 state.nlen, 26577 state.lencode, 26578 0, 26579 state.work, 26580 opts 26581 ); 26582 state.lenbits = opts.bits; 26583 if (ret) { 26584 strm.msg = "invalid literal/lengths set"; 26585 state.mode = BAD; 26586 break; 26587 } 26588 state.distbits = 6; 26589 state.distcode = state.distdyn; 26590 opts = { bits: state.distbits }; 26591 ret = inflate_table( 26592 DISTS, 26593 state.lens, 26594 state.nlen, 26595 state.ndist, 26596 state.distcode, 26597 0, 26598 state.work, 26599 opts 26600 ); 26601 state.distbits = opts.bits; 26602 if (ret) { 26603 strm.msg = "invalid distances set"; 26604 state.mode = BAD; 26605 break; 26606 } 26607 state.mode = LEN_; 26608 if (flush2 === Z_TREES) { 26609 break inf_leave; 26610 } 26611 /* falls through */ 26612 case LEN_: 26613 state.mode = LEN; 26614 /* falls through */ 26615 case LEN: 26616 if (have >= 6 && left >= 258) { 26617 strm.next_out = put; 26618 strm.avail_out = left; 26619 strm.next_in = next; 26620 strm.avail_in = have; 26621 state.hold = hold; 26622 state.bits = bits; 26623 inflate_fast(strm, _out); 26624 put = strm.next_out; 26625 output = strm.output; 26626 left = strm.avail_out; 26627 next = strm.next_in; 26628 input = strm.input; 26629 have = strm.avail_in; 26630 hold = state.hold; 26631 bits = state.bits; 26632 if (state.mode === TYPE) { 26633 state.back = -1; 26634 } 26635 break; 26636 } 26637 state.back = 0; 26638 for (; ; ) { 26639 here = state.lencode[hold & (1 << state.lenbits) - 1]; 26640 here_bits = here >>> 24; 26641 here_op = here >>> 16 & 255; 26642 here_val = here & 65535; 26643 if (here_bits <= bits) { 26644 break; 26645 } 26646 if (have === 0) { 26647 break inf_leave; 26648 } 26649 have--; 26650 hold += input[next++] << bits; 26651 bits += 8; 26652 } 26653 if (here_op && (here_op & 240) === 0) { 26654 last_bits = here_bits; 26655 last_op = here_op; 26656 last_val = here_val; 26657 for (; ; ) { 26658 here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; 26659 here_bits = here >>> 24; 26660 here_op = here >>> 16 & 255; 26661 here_val = here & 65535; 26662 if (last_bits + here_bits <= bits) { 26663 break; 26664 } 26665 if (have === 0) { 26666 break inf_leave; 26667 } 26668 have--; 26669 hold += input[next++] << bits; 26670 bits += 8; 26671 } 26672 hold >>>= last_bits; 26673 bits -= last_bits; 26674 state.back += last_bits; 26675 } 26676 hold >>>= here_bits; 26677 bits -= here_bits; 26678 state.back += here_bits; 26679 state.length = here_val; 26680 if (here_op === 0) { 26681 state.mode = LIT; 26682 break; 26683 } 26684 if (here_op & 32) { 26685 state.back = -1; 26686 state.mode = TYPE; 26687 break; 26688 } 26689 if (here_op & 64) { 26690 strm.msg = "invalid literal/length code"; 26691 state.mode = BAD; 26692 break; 26693 } 26694 state.extra = here_op & 15; 26695 state.mode = LENEXT; 26696 /* falls through */ 26697 case LENEXT: 26698 if (state.extra) { 26699 n2 = state.extra; 26700 while (bits < n2) { 26701 if (have === 0) { 26702 break inf_leave; 26703 } 26704 have--; 26705 hold += input[next++] << bits; 26706 bits += 8; 26707 } 26708 state.length += hold & (1 << state.extra) - 1; 26709 hold >>>= state.extra; 26710 bits -= state.extra; 26711 state.back += state.extra; 26712 } 26713 state.was = state.length; 26714 state.mode = DIST; 26715 /* falls through */ 26716 case DIST: 26717 for (; ; ) { 26718 here = state.distcode[hold & (1 << state.distbits) - 1]; 26719 here_bits = here >>> 24; 26720 here_op = here >>> 16 & 255; 26721 here_val = here & 65535; 26722 if (here_bits <= bits) { 26723 break; 26724 } 26725 if (have === 0) { 26726 break inf_leave; 26727 } 26728 have--; 26729 hold += input[next++] << bits; 26730 bits += 8; 26731 } 26732 if ((here_op & 240) === 0) { 26733 last_bits = here_bits; 26734 last_op = here_op; 26735 last_val = here_val; 26736 for (; ; ) { 26737 here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; 26738 here_bits = here >>> 24; 26739 here_op = here >>> 16 & 255; 26740 here_val = here & 65535; 26741 if (last_bits + here_bits <= bits) { 26742 break; 26743 } 26744 if (have === 0) { 26745 break inf_leave; 26746 } 26747 have--; 26748 hold += input[next++] << bits; 26749 bits += 8; 26750 } 26751 hold >>>= last_bits; 26752 bits -= last_bits; 26753 state.back += last_bits; 26754 } 26755 hold >>>= here_bits; 26756 bits -= here_bits; 26757 state.back += here_bits; 26758 if (here_op & 64) { 26759 strm.msg = "invalid distance code"; 26760 state.mode = BAD; 26761 break; 26762 } 26763 state.offset = here_val; 26764 state.extra = here_op & 15; 26765 state.mode = DISTEXT; 26766 /* falls through */ 26767 case DISTEXT: 26768 if (state.extra) { 26769 n2 = state.extra; 26770 while (bits < n2) { 26771 if (have === 0) { 26772 break inf_leave; 26773 } 26774 have--; 26775 hold += input[next++] << bits; 26776 bits += 8; 26777 } 26778 state.offset += hold & (1 << state.extra) - 1; 26779 hold >>>= state.extra; 26780 bits -= state.extra; 26781 state.back += state.extra; 26782 } 26783 if (state.offset > state.dmax) { 26784 strm.msg = "invalid distance too far back"; 26785 state.mode = BAD; 26786 break; 26787 } 26788 state.mode = MATCH; 26789 /* falls through */ 26790 case MATCH: 26791 if (left === 0) { 26792 break inf_leave; 26793 } 26794 copy = _out - left; 26795 if (state.offset > copy) { 26796 copy = state.offset - copy; 26797 if (copy > state.whave) { 26798 if (state.sane) { 26799 strm.msg = "invalid distance too far back"; 26800 state.mode = BAD; 26801 break; 26802 } 26803 } 26804 if (copy > state.wnext) { 26805 copy -= state.wnext; 26806 from = state.wsize - copy; 26807 } else { 26808 from = state.wnext - copy; 26809 } 26810 if (copy > state.length) { 26811 copy = state.length; 26812 } 26813 from_source = state.window; 26814 } else { 26815 from_source = output; 26816 from = put - state.offset; 26817 copy = state.length; 26818 } 26819 if (copy > left) { 26820 copy = left; 26821 } 26822 left -= copy; 26823 state.length -= copy; 26824 do { 26825 output[put++] = from_source[from++]; 26826 } while (--copy); 26827 if (state.length === 0) { 26828 state.mode = LEN; 26829 } 26830 break; 26831 case LIT: 26832 if (left === 0) { 26833 break inf_leave; 26834 } 26835 output[put++] = state.length; 26836 left--; 26837 state.mode = LEN; 26838 break; 26839 case CHECK: 26840 if (state.wrap) { 26841 while (bits < 32) { 26842 if (have === 0) { 26843 break inf_leave; 26844 } 26845 have--; 26846 hold |= input[next++] << bits; 26847 bits += 8; 26848 } 26849 _out -= left; 26850 strm.total_out += _out; 26851 state.total += _out; 26852 if (_out) { 26853 strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/ 26854 state.flags ? crc32( 26855 state.check, 26856 output, 26857 _out, 26858 put - _out 26859 ) : adler32( 26860 state.check, 26861 output, 26862 _out, 26863 put - _out 26864 ); 26865 } 26866 _out = left; 26867 if ((state.flags ? hold : zswap32(hold)) !== state.check) { 26868 strm.msg = "incorrect data check"; 26869 state.mode = BAD; 26870 break; 26871 } 26872 hold = 0; 26873 bits = 0; 26874 } 26875 state.mode = LENGTH; 26876 /* falls through */ 26877 case LENGTH: 26878 if (state.wrap && state.flags) { 26879 while (bits < 32) { 26880 if (have === 0) { 26881 break inf_leave; 26882 } 26883 have--; 26884 hold += input[next++] << bits; 26885 bits += 8; 26886 } 26887 if (hold !== (state.total & 4294967295)) { 26888 strm.msg = "incorrect length check"; 26889 state.mode = BAD; 26890 break; 26891 } 26892 hold = 0; 26893 bits = 0; 26894 } 26895 state.mode = DONE; 26896 /* falls through */ 26897 case DONE: 26898 ret = Z_STREAM_END; 26899 break inf_leave; 26900 case BAD: 26901 ret = Z_DATA_ERROR; 26902 break inf_leave; 26903 case MEM: 26904 return Z_MEM_ERROR; 26905 case SYNC: 26906 /* falls through */ 26907 default: 26908 return Z_STREAM_ERROR; 26909 } 26910 } 26911 strm.next_out = put; 26912 strm.avail_out = left; 26913 strm.next_in = next; 26914 strm.avail_in = have; 26915 state.hold = hold; 26916 state.bits = bits; 26917 if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush2 !== Z_FINISH)) { 26918 if (updatewindow( 26919 strm, 26920 strm.output, 26921 strm.next_out, 26922 _out - strm.avail_out 26923 )) { 26924 state.mode = MEM; 26925 return Z_MEM_ERROR; 26926 } 26927 } 26928 _in -= strm.avail_in; 26929 _out -= strm.avail_out; 26930 strm.total_in += _in; 26931 strm.total_out += _out; 26932 state.total += _out; 26933 if (state.wrap && _out) { 26934 strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ 26935 state.flags ? crc32( 26936 state.check, 26937 output, 26938 _out, 26939 strm.next_out - _out 26940 ) : adler32( 26941 state.check, 26942 output, 26943 _out, 26944 strm.next_out - _out 26945 ); 26946 } 26947 strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); 26948 if ((_in === 0 && _out === 0 || flush2 === Z_FINISH) && ret === Z_OK) { 26949 ret = Z_BUF_ERROR; 26950 } 26951 return ret; 26952 } 26953 function inflateEnd(strm) { 26954 if (!strm || !strm.state) { 26955 return Z_STREAM_ERROR; 26956 } 26957 var state = strm.state; 26958 if (state.window) { 26959 state.window = null; 26960 } 26961 strm.state = null; 26962 return Z_OK; 26963 } 26964 function inflateGetHeader(strm, head2) { 26965 var state; 26966 if (!strm || !strm.state) { 26967 return Z_STREAM_ERROR; 26968 } 26969 state = strm.state; 26970 if ((state.wrap & 2) === 0) { 26971 return Z_STREAM_ERROR; 26972 } 26973 state.head = head2; 26974 head2.done = false; 26975 return Z_OK; 26976 } 26977 function inflateSetDictionary(strm, dictionary) { 26978 var dictLength = dictionary.length; 26979 var state; 26980 var dictid; 26981 var ret; 26982 if (!strm || !strm.state) { 26983 return Z_STREAM_ERROR; 26984 } 26985 state = strm.state; 26986 if (state.wrap !== 0 && state.mode !== DICT) { 26987 return Z_STREAM_ERROR; 26988 } 26989 if (state.mode === DICT) { 26990 dictid = 1; 26991 dictid = adler32( 26992 dictid, 26993 dictionary, 26994 dictLength, 26995 0 26996 ); 26997 if (dictid !== state.check) { 26998 return Z_DATA_ERROR; 26999 } 27000 } 27001 ret = updatewindow( 27002 strm, 27003 dictionary, 27004 dictLength, 27005 dictLength 27006 ); 27007 if (ret) { 27008 state.mode = MEM; 27009 return Z_MEM_ERROR; 27010 } 27011 state.havedict = 1; 27012 return Z_OK; 27013 } 27014 exports2.inflateReset = inflateReset; 27015 exports2.inflateReset2 = inflateReset2; 27016 exports2.inflateResetKeep = inflateResetKeep; 27017 exports2.inflateInit = inflateInit; 27018 exports2.inflateInit2 = inflateInit2; 27019 exports2.inflate = inflate; 27020 exports2.inflateEnd = inflateEnd; 27021 exports2.inflateGetHeader = inflateGetHeader; 27022 exports2.inflateSetDictionary = inflateSetDictionary; 27023 exports2.inflateInfo = "pako inflate (from Nodeca project)"; 27024 }, 27025 { 27026 "../utils/common": 1, 27027 "./adler32": 3, 27028 "./crc32": 5, 27029 "./inffast": 7, 27030 "./inftrees": 9 27031 } 27032 ], 27033 9: [ 27034 function(require2, module2, exports2) { 27035 "use strict"; 27036 var utils = require2("../utils/common"); 27037 var MAXBITS = 15; 27038 var ENOUGH_LENS = 852; 27039 var ENOUGH_DISTS = 592; 27040 var CODES = 0; 27041 var LENS = 1; 27042 var DISTS = 2; 27043 var lbase = [ 27044 /* Length codes 257..285 base */ 27045 3, 27046 4, 27047 5, 27048 6, 27049 7, 27050 8, 27051 9, 27052 10, 27053 11, 27054 13, 27055 15, 27056 17, 27057 19, 27058 23, 27059 27, 27060 31, 27061 35, 27062 43, 27063 51, 27064 59, 27065 67, 27066 83, 27067 99, 27068 115, 27069 131, 27070 163, 27071 195, 27072 227, 27073 258, 27074 0, 27075 0 27076 ]; 27077 var lext = [ 27078 /* Length codes 257..285 extra */ 27079 16, 27080 16, 27081 16, 27082 16, 27083 16, 27084 16, 27085 16, 27086 16, 27087 17, 27088 17, 27089 17, 27090 17, 27091 18, 27092 18, 27093 18, 27094 18, 27095 19, 27096 19, 27097 19, 27098 19, 27099 20, 27100 20, 27101 20, 27102 20, 27103 21, 27104 21, 27105 21, 27106 21, 27107 16, 27108 72, 27109 78 27110 ]; 27111 var dbase = [ 27112 /* Distance codes 0..29 base */ 27113 1, 27114 2, 27115 3, 27116 4, 27117 5, 27118 7, 27119 9, 27120 13, 27121 17, 27122 25, 27123 33, 27124 49, 27125 65, 27126 97, 27127 129, 27128 193, 27129 257, 27130 385, 27131 513, 27132 769, 27133 1025, 27134 1537, 27135 2049, 27136 3073, 27137 4097, 27138 6145, 27139 8193, 27140 12289, 27141 16385, 27142 24577, 27143 0, 27144 0 27145 ]; 27146 var dext = [ 27147 /* Distance codes 0..29 extra */ 27148 16, 27149 16, 27150 16, 27151 16, 27152 17, 27153 17, 27154 18, 27155 18, 27156 19, 27157 19, 27158 20, 27159 20, 27160 21, 27161 21, 27162 22, 27163 22, 27164 23, 27165 23, 27166 24, 27167 24, 27168 25, 27169 25, 27170 26, 27171 26, 27172 27, 27173 27, 27174 28, 27175 28, 27176 29, 27177 29, 27178 64, 27179 64 27180 ]; 27181 module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { 27182 var bits = opts.bits; 27183 var len = 0; 27184 var sym = 0; 27185 var min2 = 0, max2 = 0; 27186 var root = 0; 27187 var curr = 0; 27188 var drop = 0; 27189 var left = 0; 27190 var used = 0; 27191 var huff = 0; 27192 var incr; 27193 var fill; 27194 var low; 27195 var mask; 27196 var next; 27197 var base = null; 27198 var base_index = 0; 27199 var end; 27200 var count = new utils.Buf16(MAXBITS + 1); 27201 var offs = new utils.Buf16(MAXBITS + 1); 27202 var extra = null; 27203 var extra_index = 0; 27204 var here_bits, here_op, here_val; 27205 for (len = 0; len <= MAXBITS; len++) { 27206 count[len] = 0; 27207 } 27208 for (sym = 0; sym < codes; sym++) { 27209 count[lens[lens_index + sym]]++; 27210 } 27211 root = bits; 27212 for (max2 = MAXBITS; max2 >= 1; max2--) { 27213 if (count[max2] !== 0) { 27214 break; 27215 } 27216 } 27217 if (root > max2) { 27218 root = max2; 27219 } 27220 if (max2 === 0) { 27221 table[table_index++] = 1 << 24 | 64 << 16 | 0; 27222 table[table_index++] = 1 << 24 | 64 << 16 | 0; 27223 opts.bits = 1; 27224 return 0; 27225 } 27226 for (min2 = 1; min2 < max2; min2++) { 27227 if (count[min2] !== 0) { 27228 break; 27229 } 27230 } 27231 if (root < min2) { 27232 root = min2; 27233 } 27234 left = 1; 27235 for (len = 1; len <= MAXBITS; len++) { 27236 left <<= 1; 27237 left -= count[len]; 27238 if (left < 0) { 27239 return -1; 27240 } 27241 } 27242 if (left > 0 && (type === CODES || max2 !== 1)) { 27243 return -1; 27244 } 27245 offs[1] = 0; 27246 for (len = 1; len < MAXBITS; len++) { 27247 offs[len + 1] = offs[len] + count[len]; 27248 } 27249 for (sym = 0; sym < codes; sym++) { 27250 if (lens[lens_index + sym] !== 0) { 27251 work[offs[lens[lens_index + sym]]++] = sym; 27252 } 27253 } 27254 if (type === CODES) { 27255 base = extra = work; 27256 end = 19; 27257 } else if (type === LENS) { 27258 base = lbase; 27259 base_index -= 257; 27260 extra = lext; 27261 extra_index -= 257; 27262 end = 256; 27263 } else { 27264 base = dbase; 27265 extra = dext; 27266 end = -1; 27267 } 27268 huff = 0; 27269 sym = 0; 27270 len = min2; 27271 next = table_index; 27272 curr = root; 27273 drop = 0; 27274 low = -1; 27275 used = 1 << root; 27276 mask = used - 1; 27277 if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { 27278 return 1; 27279 } 27280 for (; ; ) { 27281 here_bits = len - drop; 27282 if (work[sym] < end) { 27283 here_op = 0; 27284 here_val = work[sym]; 27285 } else if (work[sym] > end) { 27286 here_op = extra[extra_index + work[sym]]; 27287 here_val = base[base_index + work[sym]]; 27288 } else { 27289 here_op = 32 + 64; 27290 here_val = 0; 27291 } 27292 incr = 1 << len - drop; 27293 fill = 1 << curr; 27294 min2 = fill; 27295 do { 27296 fill -= incr; 27297 table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; 27298 } while (fill !== 0); 27299 incr = 1 << len - 1; 27300 while (huff & incr) { 27301 incr >>= 1; 27302 } 27303 if (incr !== 0) { 27304 huff &= incr - 1; 27305 huff += incr; 27306 } else { 27307 huff = 0; 27308 } 27309 sym++; 27310 if (--count[len] === 0) { 27311 if (len === max2) { 27312 break; 27313 } 27314 len = lens[lens_index + work[sym]]; 27315 } 27316 if (len > root && (huff & mask) !== low) { 27317 if (drop === 0) { 27318 drop = root; 27319 } 27320 next += min2; 27321 curr = len - drop; 27322 left = 1 << curr; 27323 while (curr + drop < max2) { 27324 left -= count[curr + drop]; 27325 if (left <= 0) { 27326 break; 27327 } 27328 curr++; 27329 left <<= 1; 27330 } 27331 used += 1 << curr; 27332 if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { 27333 return 1; 27334 } 27335 low = huff & mask; 27336 table[low] = root << 24 | curr << 16 | next - table_index | 0; 27337 } 27338 } 27339 if (huff !== 0) { 27340 table[next + huff] = len - drop << 24 | 64 << 16 | 0; 27341 } 27342 opts.bits = root; 27343 return 0; 27344 }; 27345 }, 27346 { "../utils/common": 1 } 27347 ], 27348 10: [ 27349 function(require2, module2, exports2) { 27350 "use strict"; 27351 module2.exports = { 27352 2: "need dictionary", 27353 1: "stream end", 27354 0: "", 27355 "-1": "file error", 27356 "-2": "stream error", 27357 "-3": "data error", 27358 "-4": "insufficient memory", 27359 "-5": "buffer error", 27360 "-6": "incompatible version" 27361 }; 27362 }, 27363 {} 27364 ], 27365 11: [ 27366 function(require2, module2, exports2) { 27367 "use strict"; 27368 function ZStream() { 27369 this.input = null; 27370 this.next_in = 0; 27371 this.avail_in = 0; 27372 this.total_in = 0; 27373 this.output = null; 27374 this.next_out = 0; 27375 this.avail_out = 0; 27376 this.total_out = 0; 27377 this.msg = ""; 27378 this.state = null; 27379 this.data_type = 2; 27380 this.adler = 0; 27381 } 27382 module2.exports = ZStream; 27383 }, 27384 {} 27385 ], 27386 "/lib/inflate.js": [ 27387 function(require2, module2, exports2) { 27388 "use strict"; 27389 var zlib_inflate = require2("./zlib/inflate"); 27390 var utils = require2("./utils/common"); 27391 var strings = require2("./utils/strings"); 27392 var c6 = require2("./zlib/constants"); 27393 var msg = require2("./zlib/messages"); 27394 var ZStream = require2("./zlib/zstream"); 27395 var GZheader = require2("./zlib/gzheader"); 27396 var toString = Object.prototype.toString; 27397 function Inflate(options) { 27398 if (!(this instanceof Inflate)) 27399 return new Inflate(options); 27400 this.options = utils.assign( 27401 { 27402 chunkSize: 16384, 27403 windowBits: 0, 27404 to: "" 27405 }, 27406 options || {} 27407 ); 27408 var opt = this.options; 27409 if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) { 27410 opt.windowBits = -opt.windowBits; 27411 if (opt.windowBits === 0) { 27412 opt.windowBits = -15; 27413 } 27414 } 27415 if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) { 27416 opt.windowBits += 32; 27417 } 27418 if (opt.windowBits > 15 && opt.windowBits < 48) { 27419 if ((opt.windowBits & 15) === 0) { 27420 opt.windowBits |= 15; 27421 } 27422 } 27423 this.err = 0; 27424 this.msg = ""; 27425 this.ended = false; 27426 this.chunks = []; 27427 this.strm = new ZStream(); 27428 this.strm.avail_out = 0; 27429 var status = zlib_inflate.inflateInit2( 27430 this.strm, 27431 opt.windowBits 27432 ); 27433 if (status !== c6.Z_OK) { 27434 throw new Error(msg[status]); 27435 } 27436 this.header = new GZheader(); 27437 zlib_inflate.inflateGetHeader(this.strm, this.header); 27438 if (opt.dictionary) { 27439 if (typeof opt.dictionary === "string") { 27440 opt.dictionary = strings.string2buf( 27441 opt.dictionary 27442 ); 27443 } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { 27444 opt.dictionary = new Uint8Array( 27445 opt.dictionary 27446 ); 27447 } 27448 if (opt.raw) { 27449 status = zlib_inflate.inflateSetDictionary( 27450 this.strm, 27451 opt.dictionary 27452 ); 27453 if (status !== c6.Z_OK) { 27454 throw new Error(msg[status]); 27455 } 27456 } 27457 } 27458 } 27459 Inflate.prototype.push = function(data, mode) { 27460 var strm = this.strm; 27461 var chunkSize = this.options.chunkSize; 27462 var dictionary = this.options.dictionary; 27463 var status, _mode; 27464 var next_out_utf8, tail, utf8str; 27465 var allowBufError = false; 27466 if (this.ended) { 27467 return false; 27468 } 27469 _mode = mode === ~~mode ? mode : mode === true ? c6.Z_FINISH : c6.Z_NO_FLUSH; 27470 if (typeof data === "string") { 27471 strm.input = strings.binstring2buf(data); 27472 } else if (toString.call(data) === "[object ArrayBuffer]") { 27473 strm.input = new Uint8Array(data); 27474 } else { 27475 strm.input = data; 27476 } 27477 strm.next_in = 0; 27478 strm.avail_in = strm.input.length; 27479 do { 27480 if (strm.avail_out === 0) { 27481 strm.output = new utils.Buf8(chunkSize); 27482 strm.next_out = 0; 27483 strm.avail_out = chunkSize; 27484 } 27485 status = zlib_inflate.inflate( 27486 strm, 27487 c6.Z_NO_FLUSH 27488 ); 27489 if (status === c6.Z_NEED_DICT && dictionary) { 27490 status = zlib_inflate.inflateSetDictionary( 27491 this.strm, 27492 dictionary 27493 ); 27494 } 27495 if (status === c6.Z_BUF_ERROR && allowBufError === true) { 27496 status = c6.Z_OK; 27497 allowBufError = false; 27498 } 27499 if (status !== c6.Z_STREAM_END && status !== c6.Z_OK) { 27500 this.onEnd(status); 27501 this.ended = true; 27502 return false; 27503 } 27504 if (strm.next_out) { 27505 if (strm.avail_out === 0 || status === c6.Z_STREAM_END || strm.avail_in === 0 && (_mode === c6.Z_FINISH || _mode === c6.Z_SYNC_FLUSH)) { 27506 if (this.options.to === "string") { 27507 next_out_utf8 = strings.utf8border( 27508 strm.output, 27509 strm.next_out 27510 ); 27511 tail = strm.next_out - next_out_utf8; 27512 utf8str = strings.buf2string( 27513 strm.output, 27514 next_out_utf8 27515 ); 27516 strm.next_out = tail; 27517 strm.avail_out = chunkSize - tail; 27518 if (tail) { 27519 utils.arraySet( 27520 strm.output, 27521 strm.output, 27522 next_out_utf8, 27523 tail, 27524 0 27525 ); 27526 } 27527 this.onData(utf8str); 27528 } else { 27529 this.onData( 27530 utils.shrinkBuf( 27531 strm.output, 27532 strm.next_out 27533 ) 27534 ); 27535 } 27536 } 27537 } 27538 if (strm.avail_in === 0 && strm.avail_out === 0) { 27539 allowBufError = true; 27540 } 27541 } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c6.Z_STREAM_END); 27542 if (status === c6.Z_STREAM_END) { 27543 _mode = c6.Z_FINISH; 27544 } 27545 if (_mode === c6.Z_FINISH) { 27546 status = zlib_inflate.inflateEnd(this.strm); 27547 this.onEnd(status); 27548 this.ended = true; 27549 return status === c6.Z_OK; 27550 } 27551 if (_mode === c6.Z_SYNC_FLUSH) { 27552 this.onEnd(c6.Z_OK); 27553 strm.avail_out = 0; 27554 return true; 27555 } 27556 return true; 27557 }; 27558 Inflate.prototype.onData = function(chunk2) { 27559 this.chunks.push(chunk2); 27560 }; 27561 Inflate.prototype.onEnd = function(status) { 27562 if (status === c6.Z_OK) { 27563 if (this.options.to === "string") { 27564 this.result = this.chunks.join(""); 27565 } else { 27566 this.result = utils.flattenChunks( 27567 this.chunks 27568 ); 27569 } 27570 } 27571 this.chunks = []; 27572 this.err = status; 27573 this.msg = this.strm.msg; 27574 }; 27575 function inflate(input, options) { 27576 var inflator = new Inflate(options); 27577 inflator.push(input, true); 27578 if (inflator.err) { 27579 throw inflator.msg || msg[inflator.err]; 27580 } 27581 return inflator.result; 27582 } 27583 function inflateRaw(input, options) { 27584 options = options || {}; 27585 options.raw = true; 27586 return inflate(input, options); 27587 } 27588 exports2.Inflate = Inflate; 27589 exports2.inflate = inflate; 27590 exports2.inflateRaw = inflateRaw; 27591 exports2.ungzip = inflate; 27592 }, 27593 { 27594 "./utils/common": 1, 27595 "./utils/strings": 2, 27596 "./zlib/constants": 4, 27597 "./zlib/gzheader": 6, 27598 "./zlib/inflate": 8, 27599 "./zlib/messages": 10, 27600 "./zlib/zstream": 11 27601 } 27602 ] 27603 }, 27604 {}, 27605 [] 27606 )("/lib/inflate.js"); 27607 })(); 27608 27609 // packages/global-styles-ui/build-module/font-library/lib/lib-font.browser.mjs 27610 var fetchFunction = globalThis.fetch; 27611 var Event2 = class { 27612 constructor(type, detail = {}, msg) { 27613 this.type = type; 27614 this.detail = detail; 27615 this.msg = msg; 27616 Object.defineProperty(this, `__mayPropagate`, { 27617 enumerable: false, 27618 writable: true 27619 }); 27620 this.__mayPropagate = true; 27621 } 27622 preventDefault() { 27623 } 27624 stopPropagation() { 27625 this.__mayPropagate = false; 27626 } 27627 valueOf() { 27628 return this; 27629 } 27630 toString() { 27631 return this.msg ? `[$this.type} event]: $this.msg}` : `[$this.type} event]`; 27632 } 27633 }; 27634 var EventManager = class { 27635 constructor() { 27636 this.listeners = {}; 27637 } 27638 addEventListener(type, listener, useCapture) { 27639 let bin = this.listeners[type] || []; 27640 if (useCapture) bin.unshift(listener); 27641 else bin.push(listener); 27642 this.listeners[type] = bin; 27643 } 27644 removeEventListener(type, listener) { 27645 let bin = this.listeners[type] || []; 27646 let pos = bin.findIndex((e2) => e2 === listener); 27647 if (pos > -1) { 27648 bin.splice(pos, 1); 27649 this.listeners[type] = bin; 27650 } 27651 } 27652 dispatch(event) { 27653 let bin = this.listeners[event.type]; 27654 if (bin) { 27655 for (let l2 = 0, e2 = bin.length; l2 < e2; l2++) { 27656 if (!event.__mayPropagate) break; 27657 bin[l2](event); 27658 } 27659 } 27660 } 27661 }; 27662 var startDate = (/* @__PURE__ */ new Date(`1904-01-01T00:00:00+0000`)).getTime(); 27663 function asText(data) { 27664 return Array.from(data).map((v2) => String.fromCharCode(v2)).join(``); 27665 } 27666 var Parser = class { 27667 constructor(dict, dataview, name2) { 27668 this.name = (name2 || dict.tag || ``).trim(); 27669 this.length = dict.length; 27670 this.start = dict.offset; 27671 this.offset = 0; 27672 this.data = dataview; 27673 [ 27674 `getInt8`, 27675 `getUint8`, 27676 `getInt16`, 27677 `getUint16`, 27678 `getInt32`, 27679 `getUint32`, 27680 `getBigInt64`, 27681 `getBigUint64` 27682 ].forEach((name3) => { 27683 let fn = name3.replace(/get(Big)?/, "").toLowerCase(); 27684 let increment = parseInt(name3.replace(/[^\d]/g, "")) / 8; 27685 Object.defineProperty(this, fn, { 27686 get: () => this.getValue(name3, increment) 27687 }); 27688 }); 27689 } 27690 get currentPosition() { 27691 return this.start + this.offset; 27692 } 27693 set currentPosition(position) { 27694 this.start = position; 27695 this.offset = 0; 27696 } 27697 skip(n2 = 0, bits = 8) { 27698 this.offset += n2 * bits / 8; 27699 } 27700 getValue(type, increment) { 27701 let pos = this.start + this.offset; 27702 this.offset += increment; 27703 try { 27704 return this.data[type](pos); 27705 } catch (e2) { 27706 console.error(`parser`, type, increment, this); 27707 console.error(`parser`, this.start, this.offset); 27708 throw e2; 27709 } 27710 } 27711 flags(n2) { 27712 if (n2 === 8 || n2 === 16 || n2 === 32 || n2 === 64) { 27713 return this[`uint$n2}`].toString(2).padStart(n2, 0).split(``).map((v2) => v2 === "1"); 27714 } 27715 console.error( 27716 `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long` 27717 ); 27718 console.trace(); 27719 } 27720 get tag() { 27721 const t3 = this.uint32; 27722 return asText([ 27723 t3 >> 24 & 255, 27724 t3 >> 16 & 255, 27725 t3 >> 8 & 255, 27726 t3 & 255 27727 ]); 27728 } 27729 get fixed() { 27730 let major = this.int16; 27731 let minor = Math.round(1e3 * this.uint16 / 65356); 27732 return major + minor / 1e3; 27733 } 27734 get legacyFixed() { 27735 let major = this.uint16; 27736 let minor = this.uint16.toString(16).padStart(4, 0); 27737 return parseFloat(`$major}.$minor}`); 27738 } 27739 get uint24() { 27740 return (this.uint8 << 16) + (this.uint8 << 8) + this.uint8; 27741 } 27742 get uint128() { 27743 let value = 0; 27744 for (let i2 = 0; i2 < 5; i2++) { 27745 let byte = this.uint8; 27746 value = value * 128 + (byte & 127); 27747 if (byte < 128) break; 27748 } 27749 return value; 27750 } 27751 get longdatetime() { 27752 return new Date(startDate + 1e3 * parseInt(this.int64.toString())); 27753 } 27754 get fword() { 27755 return this.int16; 27756 } 27757 get ufword() { 27758 return this.uint16; 27759 } 27760 get Offset16() { 27761 return this.uint16; 27762 } 27763 get Offset32() { 27764 return this.uint32; 27765 } 27766 get F2DOT14() { 27767 const bits = p.uint16; 27768 const integer = [0, 1, -2, -1][bits >> 14]; 27769 const fraction = bits & 16383; 27770 return integer + fraction / 16384; 27771 } 27772 verifyLength() { 27773 if (this.offset != this.length) { 27774 console.error( 27775 `unexpected parsed table size ($this.offset}) for "$this.name}" (expected $this.length})` 27776 ); 27777 } 27778 } 27779 readBytes(n2 = 0, position = 0, bits = 8, signed = false) { 27780 n2 = n2 || this.length; 27781 if (n2 === 0) return []; 27782 if (position) this.currentPosition = position; 27783 const fn = `$signed ? `` : `u`}int$bits}`, slice = []; 27784 while (n2--) slice.push(this[fn]); 27785 return slice; 27786 } 27787 }; 27788 var ParsedData = class { 27789 constructor(parser) { 27790 const pGetter = { enumerable: false, get: () => parser }; 27791 Object.defineProperty(this, `parser`, pGetter); 27792 const start2 = parser.currentPosition; 27793 const startGetter = { enumerable: false, get: () => start2 }; 27794 Object.defineProperty(this, `start`, startGetter); 27795 } 27796 load(struct) { 27797 Object.keys(struct).forEach((p22) => { 27798 let props = Object.getOwnPropertyDescriptor(struct, p22); 27799 if (props.get) { 27800 this[p22] = props.get.bind(this); 27801 } else if (props.value !== void 0) { 27802 this[p22] = props.value; 27803 } 27804 }); 27805 if (this.parser.length) { 27806 this.parser.verifyLength(); 27807 } 27808 } 27809 }; 27810 var SimpleTable = class extends ParsedData { 27811 constructor(dict, dataview, name2) { 27812 const { parser, start: start2 } = super( 27813 new Parser(dict, dataview, name2) 27814 ); 27815 const pGetter = { enumerable: false, get: () => parser }; 27816 Object.defineProperty(this, `p`, pGetter); 27817 const startGetter = { enumerable: false, get: () => start2 }; 27818 Object.defineProperty(this, `tableStart`, startGetter); 27819 } 27820 }; 27821 function lazy$1(object, property, getter) { 27822 let val; 27823 Object.defineProperty(object, property, { 27824 get: () => { 27825 if (val) return val; 27826 val = getter(); 27827 return val; 27828 }, 27829 enumerable: true 27830 }); 27831 } 27832 var SFNT = class extends SimpleTable { 27833 constructor(font2, dataview, createTable2) { 27834 const { p: p22 } = super({ offset: 0, length: 12 }, dataview, `sfnt`); 27835 this.version = p22.uint32; 27836 this.numTables = p22.uint16; 27837 this.searchRange = p22.uint16; 27838 this.entrySelector = p22.uint16; 27839 this.rangeShift = p22.uint16; 27840 p22.verifyLength(); 27841 this.directory = [...new Array(this.numTables)].map( 27842 (_) => new TableRecord(p22) 27843 ); 27844 this.tables = {}; 27845 this.directory.forEach((entry) => { 27846 const getter = () => createTable2( 27847 this.tables, 27848 { 27849 tag: entry.tag, 27850 offset: entry.offset, 27851 length: entry.length 27852 }, 27853 dataview 27854 ); 27855 lazy$1(this.tables, entry.tag.trim(), getter); 27856 }); 27857 } 27858 }; 27859 var TableRecord = class { 27860 constructor(p22) { 27861 this.tag = p22.tag; 27862 this.checksum = p22.uint32; 27863 this.offset = p22.uint32; 27864 this.length = p22.uint32; 27865 } 27866 }; 27867 var gzipDecode = inflate_default.inflate || void 0; 27868 var nativeGzipDecode = void 0; 27869 var WOFF$1 = class extends SimpleTable { 27870 constructor(font2, dataview, createTable2) { 27871 const { p: p22 } = super({ offset: 0, length: 44 }, dataview, `woff`); 27872 this.signature = p22.tag; 27873 this.flavor = p22.uint32; 27874 this.length = p22.uint32; 27875 this.numTables = p22.uint16; 27876 p22.uint16; 27877 this.totalSfntSize = p22.uint32; 27878 this.majorVersion = p22.uint16; 27879 this.minorVersion = p22.uint16; 27880 this.metaOffset = p22.uint32; 27881 this.metaLength = p22.uint32; 27882 this.metaOrigLength = p22.uint32; 27883 this.privOffset = p22.uint32; 27884 this.privLength = p22.uint32; 27885 p22.verifyLength(); 27886 this.directory = [...new Array(this.numTables)].map( 27887 (_) => new WoffTableDirectoryEntry(p22) 27888 ); 27889 buildWoffLazyLookups(this, dataview, createTable2); 27890 } 27891 }; 27892 var WoffTableDirectoryEntry = class { 27893 constructor(p22) { 27894 this.tag = p22.tag; 27895 this.offset = p22.uint32; 27896 this.compLength = p22.uint32; 27897 this.origLength = p22.uint32; 27898 this.origChecksum = p22.uint32; 27899 } 27900 }; 27901 function buildWoffLazyLookups(woff, dataview, createTable2) { 27902 woff.tables = {}; 27903 woff.directory.forEach((entry) => { 27904 lazy$1(woff.tables, entry.tag.trim(), () => { 27905 let offset4 = 0; 27906 let view = dataview; 27907 if (entry.compLength !== entry.origLength) { 27908 const data = dataview.buffer.slice( 27909 entry.offset, 27910 entry.offset + entry.compLength 27911 ); 27912 let unpacked; 27913 if (gzipDecode) { 27914 unpacked = gzipDecode(new Uint8Array(data)); 27915 } else if (nativeGzipDecode) { 27916 unpacked = nativeGzipDecode(new Uint8Array(data)); 27917 } else { 27918 const msg = `no brotli decoder available to decode WOFF2 font`; 27919 if (font.onerror) font.onerror(msg); 27920 throw new Error(msg); 27921 } 27922 view = new DataView(unpacked.buffer); 27923 } else { 27924 offset4 = entry.offset; 27925 } 27926 return createTable2( 27927 woff.tables, 27928 { tag: entry.tag, offset: offset4, length: entry.origLength }, 27929 view 27930 ); 27931 }); 27932 }); 27933 } 27934 var brotliDecode = unbrotli_default; 27935 var nativeBrotliDecode = void 0; 27936 var WOFF2$1 = class extends SimpleTable { 27937 constructor(font2, dataview, createTable2) { 27938 const { p: p22 } = super({ offset: 0, length: 48 }, dataview, `woff2`); 27939 this.signature = p22.tag; 27940 this.flavor = p22.uint32; 27941 this.length = p22.uint32; 27942 this.numTables = p22.uint16; 27943 p22.uint16; 27944 this.totalSfntSize = p22.uint32; 27945 this.totalCompressedSize = p22.uint32; 27946 this.majorVersion = p22.uint16; 27947 this.minorVersion = p22.uint16; 27948 this.metaOffset = p22.uint32; 27949 this.metaLength = p22.uint32; 27950 this.metaOrigLength = p22.uint32; 27951 this.privOffset = p22.uint32; 27952 this.privLength = p22.uint32; 27953 p22.verifyLength(); 27954 this.directory = [...new Array(this.numTables)].map( 27955 (_) => new Woff2TableDirectoryEntry(p22) 27956 ); 27957 let dictOffset = p22.currentPosition; 27958 this.directory[0].offset = 0; 27959 this.directory.forEach((e2, i2) => { 27960 let next = this.directory[i2 + 1]; 27961 if (next) { 27962 next.offset = e2.offset + (e2.transformLength !== void 0 ? e2.transformLength : e2.origLength); 27963 } 27964 }); 27965 let decoded; 27966 let buffer = dataview.buffer.slice(dictOffset); 27967 if (brotliDecode) { 27968 decoded = brotliDecode(new Uint8Array(buffer)); 27969 } else if (nativeBrotliDecode) { 27970 decoded = new Uint8Array(nativeBrotliDecode(buffer)); 27971 } else { 27972 const msg = `no brotli decoder available to decode WOFF2 font`; 27973 if (font2.onerror) font2.onerror(msg); 27974 throw new Error(msg); 27975 } 27976 buildWoff2LazyLookups(this, decoded, createTable2); 27977 } 27978 }; 27979 var Woff2TableDirectoryEntry = class { 27980 constructor(p22) { 27981 this.flags = p22.uint8; 27982 const tagNumber = this.tagNumber = this.flags & 63; 27983 if (tagNumber === 63) { 27984 this.tag = p22.tag; 27985 } else { 27986 this.tag = getWOFF2Tag(tagNumber); 27987 } 27988 const transformVersion = this.transformVersion = (this.flags & 192) >> 6; 27989 let hasTransforms = transformVersion !== 0; 27990 if (this.tag === `glyf` || this.tag === `loca`) { 27991 hasTransforms = this.transformVersion !== 3; 27992 } 27993 this.origLength = p22.uint128; 27994 if (hasTransforms) { 27995 this.transformLength = p22.uint128; 27996 } 27997 } 27998 }; 27999 function buildWoff2LazyLookups(woff2, decoded, createTable2) { 28000 woff2.tables = {}; 28001 woff2.directory.forEach((entry) => { 28002 lazy$1(woff2.tables, entry.tag.trim(), () => { 28003 const start2 = entry.offset; 28004 const end = start2 + (entry.transformLength ? entry.transformLength : entry.origLength); 28005 const data = new DataView(decoded.slice(start2, end).buffer); 28006 try { 28007 return createTable2( 28008 woff2.tables, 28009 { tag: entry.tag, offset: 0, length: entry.origLength }, 28010 data 28011 ); 28012 } catch (e2) { 28013 console.error(e2); 28014 } 28015 }); 28016 }); 28017 } 28018 function getWOFF2Tag(flag) { 28019 return [ 28020 `cmap`, 28021 `head`, 28022 `hhea`, 28023 `hmtx`, 28024 `maxp`, 28025 `name`, 28026 `OS/2`, 28027 `post`, 28028 `cvt `, 28029 `fpgm`, 28030 `glyf`, 28031 `loca`, 28032 `prep`, 28033 `CFF `, 28034 `VORG`, 28035 `EBDT`, 28036 `EBLC`, 28037 `gasp`, 28038 `hdmx`, 28039 `kern`, 28040 `LTSH`, 28041 `PCLT`, 28042 `VDMX`, 28043 `vhea`, 28044 `vmtx`, 28045 `BASE`, 28046 `GDEF`, 28047 `GPOS`, 28048 `GSUB`, 28049 `EBSC`, 28050 `JSTF`, 28051 `MATH`, 28052 `CBDT`, 28053 `CBLC`, 28054 `COLR`, 28055 `CPAL`, 28056 `SVG `, 28057 `sbix`, 28058 `acnt`, 28059 `avar`, 28060 `bdat`, 28061 `bloc`, 28062 `bsln`, 28063 `cvar`, 28064 `fdsc`, 28065 `feat`, 28066 `fmtx`, 28067 `fvar`, 28068 `gvar`, 28069 `hsty`, 28070 `just`, 28071 `lcar`, 28072 `mort`, 28073 `morx`, 28074 `opbd`, 28075 `prop`, 28076 `trak`, 28077 `Zapf`, 28078 `Silf`, 28079 `Glat`, 28080 `Gloc`, 28081 `Feat`, 28082 `Sill` 28083 ][flag & 63]; 28084 } 28085 var tableClasses = {}; 28086 var tableClassesLoaded = false; 28087 Promise.all([ 28088 Promise.resolve().then(function() { 28089 return cmap$1; 28090 }), 28091 Promise.resolve().then(function() { 28092 return head$1; 28093 }), 28094 Promise.resolve().then(function() { 28095 return hhea$1; 28096 }), 28097 Promise.resolve().then(function() { 28098 return hmtx$1; 28099 }), 28100 Promise.resolve().then(function() { 28101 return maxp$1; 28102 }), 28103 Promise.resolve().then(function() { 28104 return name$1; 28105 }), 28106 Promise.resolve().then(function() { 28107 return OS2$1; 28108 }), 28109 Promise.resolve().then(function() { 28110 return post$1; 28111 }), 28112 Promise.resolve().then(function() { 28113 return BASE$1; 28114 }), 28115 Promise.resolve().then(function() { 28116 return GDEF$1; 28117 }), 28118 Promise.resolve().then(function() { 28119 return GSUB$1; 28120 }), 28121 Promise.resolve().then(function() { 28122 return GPOS$1; 28123 }), 28124 Promise.resolve().then(function() { 28125 return SVG$1; 28126 }), 28127 Promise.resolve().then(function() { 28128 return fvar$1; 28129 }), 28130 Promise.resolve().then(function() { 28131 return cvt$1; 28132 }), 28133 Promise.resolve().then(function() { 28134 return fpgm$1; 28135 }), 28136 Promise.resolve().then(function() { 28137 return gasp$1; 28138 }), 28139 Promise.resolve().then(function() { 28140 return glyf$1; 28141 }), 28142 Promise.resolve().then(function() { 28143 return loca$1; 28144 }), 28145 Promise.resolve().then(function() { 28146 return prep$1; 28147 }), 28148 Promise.resolve().then(function() { 28149 return CFF$1; 28150 }), 28151 Promise.resolve().then(function() { 28152 return CFF2$1; 28153 }), 28154 Promise.resolve().then(function() { 28155 return VORG$1; 28156 }), 28157 Promise.resolve().then(function() { 28158 return EBLC$1; 28159 }), 28160 Promise.resolve().then(function() { 28161 return EBDT$1; 28162 }), 28163 Promise.resolve().then(function() { 28164 return EBSC$1; 28165 }), 28166 Promise.resolve().then(function() { 28167 return CBLC$1; 28168 }), 28169 Promise.resolve().then(function() { 28170 return CBDT$1; 28171 }), 28172 Promise.resolve().then(function() { 28173 return sbix$1; 28174 }), 28175 Promise.resolve().then(function() { 28176 return COLR$1; 28177 }), 28178 Promise.resolve().then(function() { 28179 return CPAL$1; 28180 }), 28181 Promise.resolve().then(function() { 28182 return DSIG$1; 28183 }), 28184 Promise.resolve().then(function() { 28185 return hdmx$1; 28186 }), 28187 Promise.resolve().then(function() { 28188 return kern$1; 28189 }), 28190 Promise.resolve().then(function() { 28191 return LTSH$1; 28192 }), 28193 Promise.resolve().then(function() { 28194 return MERG$1; 28195 }), 28196 Promise.resolve().then(function() { 28197 return meta$1; 28198 }), 28199 Promise.resolve().then(function() { 28200 return PCLT$1; 28201 }), 28202 Promise.resolve().then(function() { 28203 return VDMX$1; 28204 }), 28205 Promise.resolve().then(function() { 28206 return vhea$1; 28207 }), 28208 Promise.resolve().then(function() { 28209 return vmtx$1; 28210 }) 28211 ]).then((data) => { 28212 data.forEach((e2) => { 28213 let name2 = Object.keys(e2)[0]; 28214 tableClasses[name2] = e2[name2]; 28215 }); 28216 tableClassesLoaded = true; 28217 }); 28218 function createTable(tables, dict, dataview) { 28219 let name2 = dict.tag.replace(/[^\w\d]/g, ``); 28220 let Type = tableClasses[name2]; 28221 if (Type) return new Type(dict, dataview, tables); 28222 console.warn( 28223 `lib-font has no definition for $name2}. The table was skipped.` 28224 ); 28225 return {}; 28226 } 28227 function loadTableClasses() { 28228 let count = 0; 28229 function checkLoaded(resolve, reject) { 28230 if (!tableClassesLoaded) { 28231 if (count > 10) { 28232 return reject(new Error(`loading took too long`)); 28233 } 28234 count++; 28235 return setTimeout(() => checkLoaded(resolve), 250); 28236 } 28237 resolve(createTable); 28238 } 28239 return new Promise((resolve, reject) => checkLoaded(resolve)); 28240 } 28241 function getFontCSSFormat(path, errorOnStyle) { 28242 let pos = path.lastIndexOf(`.`); 28243 let ext = (path.substring(pos + 1) || ``).toLowerCase(); 28244 let format6 = { 28245 ttf: `truetype`, 28246 otf: `opentype`, 28247 woff: `woff`, 28248 woff2: `woff2` 28249 }[ext]; 28250 if (format6) return format6; 28251 let msg = { 28252 eot: `The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.`, 28253 svg: `The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.`, 28254 fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`, 28255 ttc: `Based on the current CSS specification, font collections are not (yet?) supported.` 28256 }[ext]; 28257 if (!msg) msg = `$path} is not a known webfont format.`; 28258 if (errorOnStyle) { 28259 throw new Error(msg); 28260 } else { 28261 console.warn(`Could not load font: $msg}`); 28262 } 28263 } 28264 async function setupFontFace(name2, url, options = {}) { 28265 if (!globalThis.document) return; 28266 let format6 = getFontCSSFormat(url, options.errorOnStyle); 28267 if (!format6) return; 28268 let style = document.createElement(`style`); 28269 style.className = `injected-by-Font-js`; 28270 let rules = []; 28271 if (options.styleRules) { 28272 rules = Object.entries(options.styleRules).map( 28273 ([key, value]) => `$key}: $value};` 28274 ); 28275 } 28276 style.textContent = ` 28277 @font-face { 28278 font-family: "$name2}"; 28279 $rules.join( 28280 ` 28281 ` 28282 )} 28283 src: url("$url}") format("$format6}"); 28284 }`; 28285 globalThis.document.head.appendChild(style); 28286 return style; 28287 } 28288 var TTF = [0, 1, 0, 0]; 28289 var OTF = [79, 84, 84, 79]; 28290 var WOFF = [119, 79, 70, 70]; 28291 var WOFF2 = [119, 79, 70, 50]; 28292 function match(ar1, ar2) { 28293 if (ar1.length !== ar2.length) return; 28294 for (let i2 = 0; i2 < ar1.length; i2++) { 28295 if (ar1[i2] !== ar2[i2]) return; 28296 } 28297 return true; 28298 } 28299 function validFontFormat(dataview) { 28300 const LEAD_BYTES = [ 28301 dataview.getUint8(0), 28302 dataview.getUint8(1), 28303 dataview.getUint8(2), 28304 dataview.getUint8(3) 28305 ]; 28306 if (match(LEAD_BYTES, TTF) || match(LEAD_BYTES, OTF)) return `SFNT`; 28307 if (match(LEAD_BYTES, WOFF)) return `WOFF`; 28308 if (match(LEAD_BYTES, WOFF2)) return `WOFF2`; 28309 } 28310 function checkFetchResponseStatus(response) { 28311 if (!response.ok) { 28312 throw new Error( 28313 `HTTP $response.status} - $response.statusText}` 28314 ); 28315 } 28316 return response; 28317 } 28318 var Font = class extends EventManager { 28319 constructor(name2, options = {}) { 28320 super(); 28321 this.name = name2; 28322 this.options = options; 28323 this.metrics = false; 28324 } 28325 get src() { 28326 return this.__src; 28327 } 28328 set src(src) { 28329 this.__src = src; 28330 (async () => { 28331 if (globalThis.document && !this.options.skipStyleSheet) { 28332 await setupFontFace(this.name, src, this.options); 28333 } 28334 this.loadFont(src); 28335 })(); 28336 } 28337 async loadFont(url, filename) { 28338 fetch(url).then( 28339 (response) => checkFetchResponseStatus(response) && response.arrayBuffer() 28340 ).then( 28341 (buffer) => this.fromDataBuffer(buffer, filename || url) 28342 ).catch((err) => { 28343 const evt = new Event2( 28344 `error`, 28345 err, 28346 `Failed to load font at $filename || url}` 28347 ); 28348 this.dispatch(evt); 28349 if (this.onerror) this.onerror(evt); 28350 }); 28351 } 28352 async fromDataBuffer(buffer, filenameOrUrL) { 28353 this.fontData = new DataView(buffer); 28354 let type = validFontFormat(this.fontData); 28355 if (!type) { 28356 throw new Error( 28357 `$filenameOrUrL} is either an unsupported font format, or not a font at all.` 28358 ); 28359 } 28360 await this.parseBasicData(type); 28361 const evt = new Event2("load", { font: this }); 28362 this.dispatch(evt); 28363 if (this.onload) this.onload(evt); 28364 } 28365 async parseBasicData(type) { 28366 return loadTableClasses().then((createTable2) => { 28367 if (type === `SFNT`) { 28368 this.opentype = new SFNT(this, this.fontData, createTable2); 28369 } 28370 if (type === `WOFF`) { 28371 this.opentype = new WOFF$1(this, this.fontData, createTable2); 28372 } 28373 if (type === `WOFF2`) { 28374 this.opentype = new WOFF2$1(this, this.fontData, createTable2); 28375 } 28376 return this.opentype; 28377 }); 28378 } 28379 getGlyphId(char) { 28380 return this.opentype.tables.cmap.getGlyphId(char); 28381 } 28382 reverse(glyphid) { 28383 return this.opentype.tables.cmap.reverse(glyphid); 28384 } 28385 supports(char) { 28386 return this.getGlyphId(char) !== 0; 28387 } 28388 supportsVariation(variation) { 28389 return this.opentype.tables.cmap.supportsVariation(variation) !== false; 28390 } 28391 measureText(text, size4 = 16) { 28392 if (this.__unloaded) 28393 throw new Error( 28394 "Cannot measure text: font was unloaded. Please reload before calling measureText()" 28395 ); 28396 let d2 = document.createElement("div"); 28397 d2.textContent = text; 28398 d2.style.fontFamily = this.name; 28399 d2.style.fontSize = `$size4}px`; 28400 d2.style.color = `transparent`; 28401 d2.style.background = `transparent`; 28402 d2.style.top = `0`; 28403 d2.style.left = `0`; 28404 d2.style.position = `absolute`; 28405 document.body.appendChild(d2); 28406 let bbox = d2.getBoundingClientRect(); 28407 document.body.removeChild(d2); 28408 const OS22 = this.opentype.tables["OS/2"]; 28409 bbox.fontSize = size4; 28410 bbox.ascender = OS22.sTypoAscender; 28411 bbox.descender = OS22.sTypoDescender; 28412 return bbox; 28413 } 28414 unload() { 28415 if (this.styleElement.parentNode) { 28416 this.styleElement.parentNode.removeElement(this.styleElement); 28417 const evt = new Event2("unload", { font: this }); 28418 this.dispatch(evt); 28419 if (this.onunload) this.onunload(evt); 28420 } 28421 this._unloaded = true; 28422 } 28423 load() { 28424 if (this.__unloaded) { 28425 delete this.__unloaded; 28426 document.head.appendChild(this.styleElement); 28427 const evt = new Event2("load", { font: this }); 28428 this.dispatch(evt); 28429 if (this.onload) this.onload(evt); 28430 } 28431 } 28432 }; 28433 globalThis.Font = Font; 28434 var Subtable = class extends ParsedData { 28435 constructor(p22, plaformID, encodingID) { 28436 super(p22); 28437 this.plaformID = plaformID; 28438 this.encodingID = encodingID; 28439 } 28440 }; 28441 var Format0 = class extends Subtable { 28442 constructor(p22, platformID, encodingID) { 28443 super(p22, platformID, encodingID); 28444 this.format = 0; 28445 this.length = p22.uint16; 28446 this.language = p22.uint16; 28447 this.glyphIdArray = [...new Array(256)].map((_) => p22.uint8); 28448 } 28449 supports(charCode) { 28450 if (charCode.charCodeAt) { 28451 charCode = -1; 28452 console.warn( 28453 `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.` 28454 ); 28455 } 28456 return 0 <= charCode && charCode <= 255; 28457 } 28458 reverse(glyphID) { 28459 console.warn(`reverse not implemented for cmap subtable format 0`); 28460 return {}; 28461 } 28462 getSupportedCharCodes() { 28463 return [{ start: 1, end: 256 }]; 28464 } 28465 }; 28466 var Format2 = class extends Subtable { 28467 constructor(p22, platformID, encodingID) { 28468 super(p22, platformID, encodingID); 28469 this.format = 2; 28470 this.length = p22.uint16; 28471 this.language = p22.uint16; 28472 this.subHeaderKeys = [...new Array(256)].map((_) => p22.uint16); 28473 const subHeaderCount = Math.max(...this.subHeaderKeys); 28474 const subHeaderOffset = p22.currentPosition; 28475 lazy$1(this, `subHeaders`, () => { 28476 p22.currentPosition = subHeaderOffset; 28477 return [...new Array(subHeaderCount)].map( 28478 (_) => new SubHeader(p22) 28479 ); 28480 }); 28481 const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8; 28482 lazy$1(this, `glyphIndexArray`, () => { 28483 p22.currentPosition = glyphIndexOffset; 28484 return [...new Array(subHeaderCount)].map((_) => p22.uint16); 28485 }); 28486 } 28487 supports(charCode) { 28488 if (charCode.charCodeAt) { 28489 charCode = -1; 28490 console.warn( 28491 `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.` 28492 ); 28493 } 28494 const low = charCode && 255; 28495 const high = charCode && 65280; 28496 const subHeaderKey = this.subHeaders[high]; 28497 const subheader = this.subHeaders[subHeaderKey]; 28498 const first = subheader.firstCode; 28499 const last = first + subheader.entryCount; 28500 return first <= low && low <= last; 28501 } 28502 reverse(glyphID) { 28503 console.warn(`reverse not implemented for cmap subtable format 2`); 28504 return {}; 28505 } 28506 getSupportedCharCodes(preservePropNames = false) { 28507 if (preservePropNames) { 28508 return this.subHeaders.map((h2) => ({ 28509 firstCode: h2.firstCode, 28510 lastCode: h2.lastCode 28511 })); 28512 } 28513 return this.subHeaders.map((h2) => ({ 28514 start: h2.firstCode, 28515 end: h2.lastCode 28516 })); 28517 } 28518 }; 28519 var SubHeader = class { 28520 constructor(p22) { 28521 this.firstCode = p22.uint16; 28522 this.entryCount = p22.uint16; 28523 this.lastCode = this.first + this.entryCount; 28524 this.idDelta = p22.int16; 28525 this.idRangeOffset = p22.uint16; 28526 } 28527 }; 28528 var Format4 = class extends Subtable { 28529 constructor(p22, platformID, encodingID) { 28530 super(p22, platformID, encodingID); 28531 this.format = 4; 28532 this.length = p22.uint16; 28533 this.language = p22.uint16; 28534 this.segCountX2 = p22.uint16; 28535 this.segCount = this.segCountX2 / 2; 28536 this.searchRange = p22.uint16; 28537 this.entrySelector = p22.uint16; 28538 this.rangeShift = p22.uint16; 28539 const endCodePosition = p22.currentPosition; 28540 lazy$1( 28541 this, 28542 `endCode`, 28543 () => p22.readBytes(this.segCount, endCodePosition, 16) 28544 ); 28545 const startCodePosition = endCodePosition + 2 + this.segCountX2; 28546 lazy$1( 28547 this, 28548 `startCode`, 28549 () => p22.readBytes(this.segCount, startCodePosition, 16) 28550 ); 28551 const idDeltaPosition = startCodePosition + this.segCountX2; 28552 lazy$1( 28553 this, 28554 `idDelta`, 28555 () => p22.readBytes(this.segCount, idDeltaPosition, 16, true) 28556 ); 28557 const idRangePosition = idDeltaPosition + this.segCountX2; 28558 lazy$1( 28559 this, 28560 `idRangeOffset`, 28561 () => p22.readBytes(this.segCount, idRangePosition, 16) 28562 ); 28563 const glyphIdArrayPosition = idRangePosition + this.segCountX2; 28564 const glyphIdArrayLength = this.length - (glyphIdArrayPosition - this.tableStart); 28565 lazy$1( 28566 this, 28567 `glyphIdArray`, 28568 () => p22.readBytes(glyphIdArrayLength, glyphIdArrayPosition, 16) 28569 ); 28570 lazy$1( 28571 this, 28572 `segments`, 28573 () => this.buildSegments(idRangePosition, glyphIdArrayPosition, p22) 28574 ); 28575 } 28576 buildSegments(idRangePosition, glyphIdArrayPosition, p22) { 28577 const build = (_, i2) => { 28578 let startCode = this.startCode[i2], endCode = this.endCode[i2], idDelta = this.idDelta[i2], idRangeOffset = this.idRangeOffset[i2], idRangeOffsetPointer = idRangePosition + 2 * i2, glyphIDs = []; 28579 if (idRangeOffset === 0) { 28580 for (let i22 = startCode + idDelta, e2 = endCode + idDelta; i22 <= e2; i22++) { 28581 glyphIDs.push(i22); 28582 } 28583 } else { 28584 for (let i22 = 0, e2 = endCode - startCode; i22 <= e2; i22++) { 28585 p22.currentPosition = idRangeOffsetPointer + idRangeOffset + i22 * 2; 28586 glyphIDs.push(p22.uint16); 28587 } 28588 } 28589 return { 28590 startCode, 28591 endCode, 28592 idDelta, 28593 idRangeOffset, 28594 glyphIDs 28595 }; 28596 }; 28597 return [...new Array(this.segCount)].map(build); 28598 } 28599 reverse(glyphID) { 28600 let s2 = this.segments.find((v2) => v2.glyphIDs.includes(glyphID)); 28601 if (!s2) return {}; 28602 const code = s2.startCode + s2.glyphIDs.indexOf(glyphID); 28603 return { code, unicode: String.fromCodePoint(code) }; 28604 } 28605 getGlyphId(charCode) { 28606 if (charCode.charCodeAt) charCode = charCode.charCodeAt(0); 28607 if (55296 <= charCode && charCode <= 57343) return 0; 28608 if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535) 28609 return 0; 28610 let segment = this.segments.find( 28611 (s2) => s2.startCode <= charCode && charCode <= s2.endCode 28612 ); 28613 if (!segment) return 0; 28614 return segment.glyphIDs[charCode - segment.startCode]; 28615 } 28616 supports(charCode) { 28617 return this.getGlyphId(charCode) !== 0; 28618 } 28619 getSupportedCharCodes(preservePropNames = false) { 28620 if (preservePropNames) return this.segments; 28621 return this.segments.map((v2) => ({ 28622 start: v2.startCode, 28623 end: v2.endCode 28624 })); 28625 } 28626 }; 28627 var Format6 = class extends Subtable { 28628 constructor(p22, platformID, encodingID) { 28629 super(p22, platformID, encodingID); 28630 this.format = 6; 28631 this.length = p22.uint16; 28632 this.language = p22.uint16; 28633 this.firstCode = p22.uint16; 28634 this.entryCount = p22.uint16; 28635 this.lastCode = this.firstCode + this.entryCount - 1; 28636 const getter = () => [...new Array(this.entryCount)].map((_) => p22.uint16); 28637 lazy$1(this, `glyphIdArray`, getter); 28638 } 28639 supports(charCode) { 28640 if (charCode.charCodeAt) { 28641 charCode = -1; 28642 console.warn( 28643 `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.` 28644 ); 28645 } 28646 if (charCode < this.firstCode) return {}; 28647 if (charCode > this.firstCode + this.entryCount) return {}; 28648 const code = charCode - this.firstCode; 28649 return { code, unicode: String.fromCodePoint(code) }; 28650 } 28651 reverse(glyphID) { 28652 let pos = this.glyphIdArray.indexOf(glyphID); 28653 if (pos > -1) return this.firstCode + pos; 28654 } 28655 getSupportedCharCodes(preservePropNames = false) { 28656 if (preservePropNames) { 28657 return [{ firstCode: this.firstCode, lastCode: this.lastCode }]; 28658 } 28659 return [{ start: this.firstCode, end: this.lastCode }]; 28660 } 28661 }; 28662 var Format8 = class extends Subtable { 28663 constructor(p22, platformID, encodingID) { 28664 super(p22, platformID, encodingID); 28665 this.format = 8; 28666 p22.uint16; 28667 this.length = p22.uint32; 28668 this.language = p22.uint32; 28669 this.is32 = [...new Array(8192)].map((_) => p22.uint8); 28670 this.numGroups = p22.uint32; 28671 const getter = () => [...new Array(this.numGroups)].map( 28672 (_) => new SequentialMapGroup$1(p22) 28673 ); 28674 lazy$1(this, `groups`, getter); 28675 } 28676 supports(charCode) { 28677 if (charCode.charCodeAt) { 28678 charCode = -1; 28679 console.warn( 28680 `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.` 28681 ); 28682 } 28683 return this.groups.findIndex( 28684 (s2) => s2.startcharCode <= charCode && charCode <= s2.endcharCode 28685 ) !== -1; 28686 } 28687 reverse(glyphID) { 28688 console.warn(`reverse not implemented for cmap subtable format 8`); 28689 return {}; 28690 } 28691 getSupportedCharCodes(preservePropNames = false) { 28692 if (preservePropNames) return this.groups; 28693 return this.groups.map((v2) => ({ 28694 start: v2.startcharCode, 28695 end: v2.endcharCode 28696 })); 28697 } 28698 }; 28699 var SequentialMapGroup$1 = class { 28700 constructor(p22) { 28701 this.startcharCode = p22.uint32; 28702 this.endcharCode = p22.uint32; 28703 this.startGlyphID = p22.uint32; 28704 } 28705 }; 28706 var Format10 = class extends Subtable { 28707 constructor(p22, platformID, encodingID) { 28708 super(p22, platformID, encodingID); 28709 this.format = 10; 28710 p22.uint16; 28711 this.length = p22.uint32; 28712 this.language = p22.uint32; 28713 this.startCharCode = p22.uint32; 28714 this.numChars = p22.uint32; 28715 this.endCharCode = this.startCharCode + this.numChars; 28716 const getter = () => [...new Array(this.numChars)].map((_) => p22.uint16); 28717 lazy$1(this, `glyphs`, getter); 28718 } 28719 supports(charCode) { 28720 if (charCode.charCodeAt) { 28721 charCode = -1; 28722 console.warn( 28723 `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.` 28724 ); 28725 } 28726 if (charCode < this.startCharCode) return false; 28727 if (charCode > this.startCharCode + this.numChars) return false; 28728 return charCode - this.startCharCode; 28729 } 28730 reverse(glyphID) { 28731 console.warn(`reverse not implemented for cmap subtable format 10`); 28732 return {}; 28733 } 28734 getSupportedCharCodes(preservePropNames = false) { 28735 if (preservePropNames) { 28736 return [ 28737 { 28738 startCharCode: this.startCharCode, 28739 endCharCode: this.endCharCode 28740 } 28741 ]; 28742 } 28743 return [{ start: this.startCharCode, end: this.endCharCode }]; 28744 } 28745 }; 28746 var Format12 = class extends Subtable { 28747 constructor(p22, platformID, encodingID) { 28748 super(p22, platformID, encodingID); 28749 this.format = 12; 28750 p22.uint16; 28751 this.length = p22.uint32; 28752 this.language = p22.uint32; 28753 this.numGroups = p22.uint32; 28754 const getter = () => [...new Array(this.numGroups)].map( 28755 (_) => new SequentialMapGroup(p22) 28756 ); 28757 lazy$1(this, `groups`, getter); 28758 } 28759 supports(charCode) { 28760 if (charCode.charCodeAt) charCode = charCode.charCodeAt(0); 28761 if (55296 <= charCode && charCode <= 57343) return 0; 28762 if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535) 28763 return 0; 28764 return this.groups.findIndex( 28765 (s2) => s2.startCharCode <= charCode && charCode <= s2.endCharCode 28766 ) !== -1; 28767 } 28768 reverse(glyphID) { 28769 for (let group of this.groups) { 28770 let start2 = group.startGlyphID; 28771 if (start2 > glyphID) continue; 28772 if (start2 === glyphID) return group.startCharCode; 28773 let end = start2 + (group.endCharCode - group.startCharCode); 28774 if (end < glyphID) continue; 28775 const code = group.startCharCode + (glyphID - start2); 28776 return { code, unicode: String.fromCodePoint(code) }; 28777 } 28778 return {}; 28779 } 28780 getSupportedCharCodes(preservePropNames = false) { 28781 if (preservePropNames) return this.groups; 28782 return this.groups.map((v2) => ({ 28783 start: v2.startCharCode, 28784 end: v2.endCharCode 28785 })); 28786 } 28787 }; 28788 var SequentialMapGroup = class { 28789 constructor(p22) { 28790 this.startCharCode = p22.uint32; 28791 this.endCharCode = p22.uint32; 28792 this.startGlyphID = p22.uint32; 28793 } 28794 }; 28795 var Format13 = class extends Subtable { 28796 constructor(p22, platformID, encodingID) { 28797 super(p22, platformID, encodingID); 28798 this.format = 13; 28799 p22.uint16; 28800 this.length = p22.uint32; 28801 this.language = p22.uint32; 28802 this.numGroups = p22.uint32; 28803 const getter = [...new Array(this.numGroups)].map( 28804 (_) => new ConstantMapGroup(p22) 28805 ); 28806 lazy$1(this, `groups`, getter); 28807 } 28808 supports(charCode) { 28809 if (charCode.charCodeAt) charCode = charCode.charCodeAt(0); 28810 return this.groups.findIndex( 28811 (s2) => s2.startCharCode <= charCode && charCode <= s2.endCharCode 28812 ) !== -1; 28813 } 28814 reverse(glyphID) { 28815 console.warn(`reverse not implemented for cmap subtable format 13`); 28816 return {}; 28817 } 28818 getSupportedCharCodes(preservePropNames = false) { 28819 if (preservePropNames) return this.groups; 28820 return this.groups.map((v2) => ({ 28821 start: v2.startCharCode, 28822 end: v2.endCharCode 28823 })); 28824 } 28825 }; 28826 var ConstantMapGroup = class { 28827 constructor(p22) { 28828 this.startCharCode = p22.uint32; 28829 this.endCharCode = p22.uint32; 28830 this.glyphID = p22.uint32; 28831 } 28832 }; 28833 var Format14 = class extends Subtable { 28834 constructor(p22, platformID, encodingID) { 28835 super(p22, platformID, encodingID); 28836 this.subTableStart = p22.currentPosition; 28837 this.format = 14; 28838 this.length = p22.uint32; 28839 this.numVarSelectorRecords = p22.uint32; 28840 lazy$1( 28841 this, 28842 `varSelectors`, 28843 () => [...new Array(this.numVarSelectorRecords)].map( 28844 (_) => new VariationSelector(p22) 28845 ) 28846 ); 28847 } 28848 supports() { 28849 console.warn(`supports not implemented for cmap subtable format 14`); 28850 return 0; 28851 } 28852 getSupportedCharCodes() { 28853 console.warn( 28854 `getSupportedCharCodes not implemented for cmap subtable format 14` 28855 ); 28856 return []; 28857 } 28858 reverse(glyphID) { 28859 console.warn(`reverse not implemented for cmap subtable format 14`); 28860 return {}; 28861 } 28862 supportsVariation(variation) { 28863 let v2 = this.varSelector.find( 28864 (uvs) => uvs.varSelector === variation 28865 ); 28866 return v2 ? v2 : false; 28867 } 28868 getSupportedVariations() { 28869 return this.varSelectors.map((v2) => v2.varSelector); 28870 } 28871 }; 28872 var VariationSelector = class { 28873 constructor(p22) { 28874 this.varSelector = p22.uint24; 28875 this.defaultUVSOffset = p22.Offset32; 28876 this.nonDefaultUVSOffset = p22.Offset32; 28877 } 28878 }; 28879 function createSubTable(parser, platformID, encodingID) { 28880 const format6 = parser.uint16; 28881 if (format6 === 0) return new Format0(parser, platformID, encodingID); 28882 if (format6 === 2) return new Format2(parser, platformID, encodingID); 28883 if (format6 === 4) return new Format4(parser, platformID, encodingID); 28884 if (format6 === 6) return new Format6(parser, platformID, encodingID); 28885 if (format6 === 8) return new Format8(parser, platformID, encodingID); 28886 if (format6 === 10) return new Format10(parser, platformID, encodingID); 28887 if (format6 === 12) return new Format12(parser, platformID, encodingID); 28888 if (format6 === 13) return new Format13(parser, platformID, encodingID); 28889 if (format6 === 14) return new Format14(parser, platformID, encodingID); 28890 return {}; 28891 } 28892 var cmap = class extends SimpleTable { 28893 constructor(dict, dataview) { 28894 const { p: p22 } = super(dict, dataview); 28895 this.version = p22.uint16; 28896 this.numTables = p22.uint16; 28897 this.encodingRecords = [...new Array(this.numTables)].map( 28898 (_) => new EncodingRecord(p22, this.tableStart) 28899 ); 28900 } 28901 getSubTable(tableID) { 28902 return this.encodingRecords[tableID].table; 28903 } 28904 getSupportedEncodings() { 28905 return this.encodingRecords.map((r3) => ({ 28906 platformID: r3.platformID, 28907 encodingId: r3.encodingID 28908 })); 28909 } 28910 getSupportedCharCodes(platformID, encodingID) { 28911 const recordID = this.encodingRecords.findIndex( 28912 (r3) => r3.platformID === platformID && r3.encodingID === encodingID 28913 ); 28914 if (recordID === -1) return false; 28915 const subtable = this.getSubTable(recordID); 28916 return subtable.getSupportedCharCodes(); 28917 } 28918 reverse(glyphid) { 28919 for (let i2 = 0; i2 < this.numTables; i2++) { 28920 let code = this.getSubTable(i2).reverse(glyphid); 28921 if (code) return code; 28922 } 28923 } 28924 getGlyphId(char) { 28925 let last = 0; 28926 this.encodingRecords.some((_, tableID) => { 28927 let t3 = this.getSubTable(tableID); 28928 if (!t3.getGlyphId) return false; 28929 last = t3.getGlyphId(char); 28930 return last !== 0; 28931 }); 28932 return last; 28933 } 28934 supports(char) { 28935 return this.encodingRecords.some((_, tableID) => { 28936 const t3 = this.getSubTable(tableID); 28937 return t3.supports && t3.supports(char) !== false; 28938 }); 28939 } 28940 supportsVariation(variation) { 28941 return this.encodingRecords.some((_, tableID) => { 28942 const t3 = this.getSubTable(tableID); 28943 return t3.supportsVariation && t3.supportsVariation(variation) !== false; 28944 }); 28945 } 28946 }; 28947 var EncodingRecord = class { 28948 constructor(p22, tableStart) { 28949 const platformID = this.platformID = p22.uint16; 28950 const encodingID = this.encodingID = p22.uint16; 28951 const offset4 = this.offset = p22.Offset32; 28952 lazy$1(this, `table`, () => { 28953 p22.currentPosition = tableStart + offset4; 28954 return createSubTable(p22, platformID, encodingID); 28955 }); 28956 } 28957 }; 28958 var cmap$1 = Object.freeze({ __proto__: null, cmap }); 28959 var head = class extends SimpleTable { 28960 constructor(dict, dataview) { 28961 const { p: p22 } = super(dict, dataview); 28962 this.load({ 28963 majorVersion: p22.uint16, 28964 minorVersion: p22.uint16, 28965 fontRevision: p22.fixed, 28966 checkSumAdjustment: p22.uint32, 28967 magicNumber: p22.uint32, 28968 flags: p22.flags(16), 28969 unitsPerEm: p22.uint16, 28970 created: p22.longdatetime, 28971 modified: p22.longdatetime, 28972 xMin: p22.int16, 28973 yMin: p22.int16, 28974 xMax: p22.int16, 28975 yMax: p22.int16, 28976 macStyle: p22.flags(16), 28977 lowestRecPPEM: p22.uint16, 28978 fontDirectionHint: p22.uint16, 28979 indexToLocFormat: p22.uint16, 28980 glyphDataFormat: p22.uint16 28981 }); 28982 } 28983 }; 28984 var head$1 = Object.freeze({ __proto__: null, head }); 28985 var hhea = class extends SimpleTable { 28986 constructor(dict, dataview) { 28987 const { p: p22 } = super(dict, dataview); 28988 this.majorVersion = p22.uint16; 28989 this.minorVersion = p22.uint16; 28990 this.ascender = p22.fword; 28991 this.descender = p22.fword; 28992 this.lineGap = p22.fword; 28993 this.advanceWidthMax = p22.ufword; 28994 this.minLeftSideBearing = p22.fword; 28995 this.minRightSideBearing = p22.fword; 28996 this.xMaxExtent = p22.fword; 28997 this.caretSlopeRise = p22.int16; 28998 this.caretSlopeRun = p22.int16; 28999 this.caretOffset = p22.int16; 29000 p22.int16; 29001 p22.int16; 29002 p22.int16; 29003 p22.int16; 29004 this.metricDataFormat = p22.int16; 29005 this.numberOfHMetrics = p22.uint16; 29006 p22.verifyLength(); 29007 } 29008 }; 29009 var hhea$1 = Object.freeze({ __proto__: null, hhea }); 29010 var hmtx = class extends SimpleTable { 29011 constructor(dict, dataview, tables) { 29012 const { p: p22 } = super(dict, dataview); 29013 const numberOfHMetrics = tables.hhea.numberOfHMetrics; 29014 const numGlyphs = tables.maxp.numGlyphs; 29015 const metricsStart = p22.currentPosition; 29016 lazy$1(this, `hMetrics`, () => { 29017 p22.currentPosition = metricsStart; 29018 return [...new Array(numberOfHMetrics)].map( 29019 (_) => new LongHorMetric(p22.uint16, p22.int16) 29020 ); 29021 }); 29022 if (numberOfHMetrics < numGlyphs) { 29023 const lsbStart = metricsStart + numberOfHMetrics * 4; 29024 lazy$1(this, `leftSideBearings`, () => { 29025 p22.currentPosition = lsbStart; 29026 return [...new Array(numGlyphs - numberOfHMetrics)].map( 29027 (_) => p22.int16 29028 ); 29029 }); 29030 } 29031 } 29032 }; 29033 var LongHorMetric = class { 29034 constructor(w2, b2) { 29035 this.advanceWidth = w2; 29036 this.lsb = b2; 29037 } 29038 }; 29039 var hmtx$1 = Object.freeze({ __proto__: null, hmtx }); 29040 var maxp = class extends SimpleTable { 29041 constructor(dict, dataview) { 29042 const { p: p22 } = super(dict, dataview); 29043 this.version = p22.legacyFixed; 29044 this.numGlyphs = p22.uint16; 29045 if (this.version === 1) { 29046 this.maxPoints = p22.uint16; 29047 this.maxContours = p22.uint16; 29048 this.maxCompositePoints = p22.uint16; 29049 this.maxCompositeContours = p22.uint16; 29050 this.maxZones = p22.uint16; 29051 this.maxTwilightPoints = p22.uint16; 29052 this.maxStorage = p22.uint16; 29053 this.maxFunctionDefs = p22.uint16; 29054 this.maxInstructionDefs = p22.uint16; 29055 this.maxStackElements = p22.uint16; 29056 this.maxSizeOfInstructions = p22.uint16; 29057 this.maxComponentElements = p22.uint16; 29058 this.maxComponentDepth = p22.uint16; 29059 } 29060 p22.verifyLength(); 29061 } 29062 }; 29063 var maxp$1 = Object.freeze({ __proto__: null, maxp }); 29064 var name = class extends SimpleTable { 29065 constructor(dict, dataview) { 29066 const { p: p22 } = super(dict, dataview); 29067 this.format = p22.uint16; 29068 this.count = p22.uint16; 29069 this.stringOffset = p22.Offset16; 29070 this.nameRecords = [...new Array(this.count)].map( 29071 (_) => new NameRecord(p22, this) 29072 ); 29073 if (this.format === 1) { 29074 this.langTagCount = p22.uint16; 29075 this.langTagRecords = [...new Array(this.langTagCount)].map( 29076 (_) => new LangTagRecord(p22.uint16, p22.Offset16) 29077 ); 29078 } 29079 this.stringStart = this.tableStart + this.stringOffset; 29080 } 29081 get(nameID) { 29082 let record = this.nameRecords.find( 29083 (record2) => record2.nameID === nameID 29084 ); 29085 if (record) return record.string; 29086 } 29087 }; 29088 var LangTagRecord = class { 29089 constructor(length, offset4) { 29090 this.length = length; 29091 this.offset = offset4; 29092 } 29093 }; 29094 var NameRecord = class { 29095 constructor(p22, nameTable) { 29096 this.platformID = p22.uint16; 29097 this.encodingID = p22.uint16; 29098 this.languageID = p22.uint16; 29099 this.nameID = p22.uint16; 29100 this.length = p22.uint16; 29101 this.offset = p22.Offset16; 29102 lazy$1(this, `string`, () => { 29103 p22.currentPosition = nameTable.stringStart + this.offset; 29104 return decodeString(p22, this); 29105 }); 29106 } 29107 }; 29108 function decodeString(p22, record) { 29109 const { platformID, length } = record; 29110 if (length === 0) return ``; 29111 if (platformID === 0 || platformID === 3) { 29112 const str2 = []; 29113 for (let i2 = 0, e2 = length / 2; i2 < e2; i2++) 29114 str2[i2] = String.fromCharCode(p22.uint16); 29115 return str2.join(``); 29116 } 29117 const bytes = p22.readBytes(length); 29118 const str = []; 29119 bytes.forEach(function(b2, i2) { 29120 str[i2] = String.fromCharCode(b2); 29121 }); 29122 return str.join(``); 29123 } 29124 var name$1 = Object.freeze({ __proto__: null, name }); 29125 var OS2 = class extends SimpleTable { 29126 constructor(dict, dataview) { 29127 const { p: p22 } = super(dict, dataview); 29128 this.version = p22.uint16; 29129 this.xAvgCharWidth = p22.int16; 29130 this.usWeightClass = p22.uint16; 29131 this.usWidthClass = p22.uint16; 29132 this.fsType = p22.uint16; 29133 this.ySubscriptXSize = p22.int16; 29134 this.ySubscriptYSize = p22.int16; 29135 this.ySubscriptXOffset = p22.int16; 29136 this.ySubscriptYOffset = p22.int16; 29137 this.ySuperscriptXSize = p22.int16; 29138 this.ySuperscriptYSize = p22.int16; 29139 this.ySuperscriptXOffset = p22.int16; 29140 this.ySuperscriptYOffset = p22.int16; 29141 this.yStrikeoutSize = p22.int16; 29142 this.yStrikeoutPosition = p22.int16; 29143 this.sFamilyClass = p22.int16; 29144 this.panose = [...new Array(10)].map((_) => p22.uint8); 29145 this.ulUnicodeRange1 = p22.flags(32); 29146 this.ulUnicodeRange2 = p22.flags(32); 29147 this.ulUnicodeRange3 = p22.flags(32); 29148 this.ulUnicodeRange4 = p22.flags(32); 29149 this.achVendID = p22.tag; 29150 this.fsSelection = p22.uint16; 29151 this.usFirstCharIndex = p22.uint16; 29152 this.usLastCharIndex = p22.uint16; 29153 this.sTypoAscender = p22.int16; 29154 this.sTypoDescender = p22.int16; 29155 this.sTypoLineGap = p22.int16; 29156 this.usWinAscent = p22.uint16; 29157 this.usWinDescent = p22.uint16; 29158 if (this.version === 0) return p22.verifyLength(); 29159 this.ulCodePageRange1 = p22.flags(32); 29160 this.ulCodePageRange2 = p22.flags(32); 29161 if (this.version === 1) return p22.verifyLength(); 29162 this.sxHeight = p22.int16; 29163 this.sCapHeight = p22.int16; 29164 this.usDefaultChar = p22.uint16; 29165 this.usBreakChar = p22.uint16; 29166 this.usMaxContext = p22.uint16; 29167 if (this.version <= 4) return p22.verifyLength(); 29168 this.usLowerOpticalPointSize = p22.uint16; 29169 this.usUpperOpticalPointSize = p22.uint16; 29170 if (this.version === 5) return p22.verifyLength(); 29171 } 29172 }; 29173 var OS2$1 = Object.freeze({ __proto__: null, OS2 }); 29174 var post = class extends SimpleTable { 29175 constructor(dict, dataview) { 29176 const { p: p22 } = super(dict, dataview); 29177 this.version = p22.legacyFixed; 29178 this.italicAngle = p22.fixed; 29179 this.underlinePosition = p22.fword; 29180 this.underlineThickness = p22.fword; 29181 this.isFixedPitch = p22.uint32; 29182 this.minMemType42 = p22.uint32; 29183 this.maxMemType42 = p22.uint32; 29184 this.minMemType1 = p22.uint32; 29185 this.maxMemType1 = p22.uint32; 29186 if (this.version === 1 || this.version === 3) return p22.verifyLength(); 29187 this.numGlyphs = p22.uint16; 29188 if (this.version === 2) { 29189 this.glyphNameIndex = [...new Array(this.numGlyphs)].map( 29190 (_) => p22.uint16 29191 ); 29192 this.namesOffset = p22.currentPosition; 29193 this.glyphNameOffsets = [1]; 29194 for (let i2 = 0; i2 < this.numGlyphs; i2++) { 29195 let index2 = this.glyphNameIndex[i2]; 29196 if (index2 < macStrings.length) { 29197 this.glyphNameOffsets.push(this.glyphNameOffsets[i2]); 29198 continue; 29199 } 29200 let bytelength = p22.int8; 29201 p22.skip(bytelength); 29202 this.glyphNameOffsets.push( 29203 this.glyphNameOffsets[i2] + bytelength + 1 29204 ); 29205 } 29206 } 29207 if (this.version === 2.5) { 29208 this.offset = [...new Array(this.numGlyphs)].map( 29209 (_) => p22.int8 29210 ); 29211 } 29212 } 29213 getGlyphName(glyphid) { 29214 if (this.version !== 2) { 29215 console.warn( 29216 `post table version $this.version} does not support glyph name lookups` 29217 ); 29218 return ``; 29219 } 29220 let index2 = this.glyphNameIndex[glyphid]; 29221 if (index2 < 258) return macStrings[index2]; 29222 let offset4 = this.glyphNameOffsets[glyphid]; 29223 let next = this.glyphNameOffsets[glyphid + 1]; 29224 let len = next - offset4 - 1; 29225 if (len === 0) return `.notdef.`; 29226 this.parser.currentPosition = this.namesOffset + offset4; 29227 const data = this.parser.readBytes( 29228 len, 29229 this.namesOffset + offset4, 29230 8, 29231 true 29232 ); 29233 return data.map((b2) => String.fromCharCode(b2)).join(``); 29234 } 29235 }; 29236 var macStrings = [ 29237 `.notdef`, 29238 `.null`, 29239 `nonmarkingreturn`, 29240 `space`, 29241 `exclam`, 29242 `quotedbl`, 29243 `numbersign`, 29244 `dollar`, 29245 `percent`, 29246 `ampersand`, 29247 `quotesingle`, 29248 `parenleft`, 29249 `parenright`, 29250 `asterisk`, 29251 `plus`, 29252 `comma`, 29253 `hyphen`, 29254 `period`, 29255 `slash`, 29256 `zero`, 29257 `one`, 29258 `two`, 29259 `three`, 29260 `four`, 29261 `five`, 29262 `six`, 29263 `seven`, 29264 `eight`, 29265 `nine`, 29266 `colon`, 29267 `semicolon`, 29268 `less`, 29269 `equal`, 29270 `greater`, 29271 `question`, 29272 `at`, 29273 `A`, 29274 `B`, 29275 `C`, 29276 `D`, 29277 `E`, 29278 `F`, 29279 `G`, 29280 `H`, 29281 `I`, 29282 `J`, 29283 `K`, 29284 `L`, 29285 `M`, 29286 `N`, 29287 `O`, 29288 `P`, 29289 `Q`, 29290 `R`, 29291 `S`, 29292 `T`, 29293 `U`, 29294 `V`, 29295 `W`, 29296 `X`, 29297 `Y`, 29298 `Z`, 29299 `bracketleft`, 29300 `backslash`, 29301 `bracketright`, 29302 `asciicircum`, 29303 `underscore`, 29304 `grave`, 29305 `a`, 29306 `b`, 29307 `c`, 29308 `d`, 29309 `e`, 29310 `f`, 29311 `g`, 29312 `h`, 29313 `i`, 29314 `j`, 29315 `k`, 29316 `l`, 29317 `m`, 29318 `n`, 29319 `o`, 29320 `p`, 29321 `q`, 29322 `r`, 29323 `s`, 29324 `t`, 29325 `u`, 29326 `v`, 29327 `w`, 29328 `x`, 29329 `y`, 29330 `z`, 29331 `braceleft`, 29332 `bar`, 29333 `braceright`, 29334 `asciitilde`, 29335 `Adieresis`, 29336 `Aring`, 29337 `Ccedilla`, 29338 `Eacute`, 29339 `Ntilde`, 29340 `Odieresis`, 29341 `Udieresis`, 29342 `aacute`, 29343 `agrave`, 29344 `acircumflex`, 29345 `adieresis`, 29346 `atilde`, 29347 `aring`, 29348 `ccedilla`, 29349 `eacute`, 29350 `egrave`, 29351 `ecircumflex`, 29352 `edieresis`, 29353 `iacute`, 29354 `igrave`, 29355 `icircumflex`, 29356 `idieresis`, 29357 `ntilde`, 29358 `oacute`, 29359 `ograve`, 29360 `ocircumflex`, 29361 `odieresis`, 29362 `otilde`, 29363 `uacute`, 29364 `ugrave`, 29365 `ucircumflex`, 29366 `udieresis`, 29367 `dagger`, 29368 `degree`, 29369 `cent`, 29370 `sterling`, 29371 `section`, 29372 `bullet`, 29373 `paragraph`, 29374 `germandbls`, 29375 `registered`, 29376 `copyright`, 29377 `trademark`, 29378 `acute`, 29379 `dieresis`, 29380 `notequal`, 29381 `AE`, 29382 `Oslash`, 29383 `infinity`, 29384 `plusminus`, 29385 `lessequal`, 29386 `greaterequal`, 29387 `yen`, 29388 `mu`, 29389 `partialdiff`, 29390 `summation`, 29391 `product`, 29392 `pi`, 29393 `integral`, 29394 `ordfeminine`, 29395 `ordmasculine`, 29396 `Omega`, 29397 `ae`, 29398 `oslash`, 29399 `questiondown`, 29400 `exclamdown`, 29401 `logicalnot`, 29402 `radical`, 29403 `florin`, 29404 `approxequal`, 29405 `Delta`, 29406 `guillemotleft`, 29407 `guillemotright`, 29408 `ellipsis`, 29409 `nonbreakingspace`, 29410 `Agrave`, 29411 `Atilde`, 29412 `Otilde`, 29413 `OE`, 29414 `oe`, 29415 `endash`, 29416 `emdash`, 29417 `quotedblleft`, 29418 `quotedblright`, 29419 `quoteleft`, 29420 `quoteright`, 29421 `divide`, 29422 `lozenge`, 29423 `ydieresis`, 29424 `Ydieresis`, 29425 `fraction`, 29426 `currency`, 29427 `guilsinglleft`, 29428 `guilsinglright`, 29429 `fi`, 29430 `fl`, 29431 `daggerdbl`, 29432 `periodcentered`, 29433 `quotesinglbase`, 29434 `quotedblbase`, 29435 `perthousand`, 29436 `Acircumflex`, 29437 `Ecircumflex`, 29438 `Aacute`, 29439 `Edieresis`, 29440 `Egrave`, 29441 `Iacute`, 29442 `Icircumflex`, 29443 `Idieresis`, 29444 `Igrave`, 29445 `Oacute`, 29446 `Ocircumflex`, 29447 `apple`, 29448 `Ograve`, 29449 `Uacute`, 29450 `Ucircumflex`, 29451 `Ugrave`, 29452 `dotlessi`, 29453 `circumflex`, 29454 `tilde`, 29455 `macron`, 29456 `breve`, 29457 `dotaccent`, 29458 `ring`, 29459 `cedilla`, 29460 `hungarumlaut`, 29461 `ogonek`, 29462 `caron`, 29463 `Lslash`, 29464 `lslash`, 29465 `Scaron`, 29466 `scaron`, 29467 `Zcaron`, 29468 `zcaron`, 29469 `brokenbar`, 29470 `Eth`, 29471 `eth`, 29472 `Yacute`, 29473 `yacute`, 29474 `Thorn`, 29475 `thorn`, 29476 `minus`, 29477 `multiply`, 29478 `onesuperior`, 29479 `twosuperior`, 29480 `threesuperior`, 29481 `onehalf`, 29482 `onequarter`, 29483 `threequarters`, 29484 `franc`, 29485 `Gbreve`, 29486 `gbreve`, 29487 `Idotaccent`, 29488 `Scedilla`, 29489 `scedilla`, 29490 `Cacute`, 29491 `cacute`, 29492 `Ccaron`, 29493 `ccaron`, 29494 `dcroat` 29495 ]; 29496 var post$1 = Object.freeze({ __proto__: null, post }); 29497 var BASE = class extends SimpleTable { 29498 constructor(dict, dataview) { 29499 const { p: p22 } = super(dict, dataview); 29500 this.majorVersion = p22.uint16; 29501 this.minorVersion = p22.uint16; 29502 this.horizAxisOffset = p22.Offset16; 29503 this.vertAxisOffset = p22.Offset16; 29504 lazy$1( 29505 this, 29506 `horizAxis`, 29507 () => new AxisTable( 29508 { offset: dict.offset + this.horizAxisOffset }, 29509 dataview 29510 ) 29511 ); 29512 lazy$1( 29513 this, 29514 `vertAxis`, 29515 () => new AxisTable( 29516 { offset: dict.offset + this.vertAxisOffset }, 29517 dataview 29518 ) 29519 ); 29520 if (this.majorVersion === 1 && this.minorVersion === 1) { 29521 this.itemVarStoreOffset = p22.Offset32; 29522 lazy$1( 29523 this, 29524 `itemVarStore`, 29525 () => new AxisTable( 29526 { offset: dict.offset + this.itemVarStoreOffset }, 29527 dataview 29528 ) 29529 ); 29530 } 29531 } 29532 }; 29533 var AxisTable = class extends SimpleTable { 29534 constructor(dict, dataview) { 29535 const { p: p22 } = super(dict, dataview, `AxisTable`); 29536 this.baseTagListOffset = p22.Offset16; 29537 this.baseScriptListOffset = p22.Offset16; 29538 lazy$1( 29539 this, 29540 `baseTagList`, 29541 () => new BaseTagListTable( 29542 { offset: dict.offset + this.baseTagListOffset }, 29543 dataview 29544 ) 29545 ); 29546 lazy$1( 29547 this, 29548 `baseScriptList`, 29549 () => new BaseScriptListTable( 29550 { offset: dict.offset + this.baseScriptListOffset }, 29551 dataview 29552 ) 29553 ); 29554 } 29555 }; 29556 var BaseTagListTable = class extends SimpleTable { 29557 constructor(dict, dataview) { 29558 const { p: p22 } = super(dict, dataview, `BaseTagListTable`); 29559 this.baseTagCount = p22.uint16; 29560 this.baselineTags = [...new Array(this.baseTagCount)].map( 29561 (_) => p22.tag 29562 ); 29563 } 29564 }; 29565 var BaseScriptListTable = class extends SimpleTable { 29566 constructor(dict, dataview) { 29567 const { p: p22 } = super(dict, dataview, `BaseScriptListTable`); 29568 this.baseScriptCount = p22.uint16; 29569 const recordStart = p22.currentPosition; 29570 lazy$1(this, `baseScriptRecords`, () => { 29571 p22.currentPosition = recordStart; 29572 return [...new Array(this.baseScriptCount)].map( 29573 (_) => new BaseScriptRecord(this.start, p22) 29574 ); 29575 }); 29576 } 29577 }; 29578 var BaseScriptRecord = class { 29579 constructor(baseScriptListTableStart, p22) { 29580 this.baseScriptTag = p22.tag; 29581 this.baseScriptOffset = p22.Offset16; 29582 lazy$1(this, `baseScriptTable`, () => { 29583 p22.currentPosition = baseScriptListTableStart + this.baseScriptOffset; 29584 return new BaseScriptTable(p22); 29585 }); 29586 } 29587 }; 29588 var BaseScriptTable = class { 29589 constructor(p22) { 29590 this.start = p22.currentPosition; 29591 this.baseValuesOffset = p22.Offset16; 29592 this.defaultMinMaxOffset = p22.Offset16; 29593 this.baseLangSysCount = p22.uint16; 29594 this.baseLangSysRecords = [...new Array(this.baseLangSysCount)].map( 29595 (_) => new BaseLangSysRecord(this.start, p22) 29596 ); 29597 lazy$1(this, `baseValues`, () => { 29598 p22.currentPosition = this.start + this.baseValuesOffset; 29599 return new BaseValuesTable(p22); 29600 }); 29601 lazy$1(this, `defaultMinMax`, () => { 29602 p22.currentPosition = this.start + this.defaultMinMaxOffset; 29603 return new MinMaxTable(p22); 29604 }); 29605 } 29606 }; 29607 var BaseLangSysRecord = class { 29608 constructor(baseScriptTableStart, p22) { 29609 this.baseLangSysTag = p22.tag; 29610 this.minMaxOffset = p22.Offset16; 29611 lazy$1(this, `minMax`, () => { 29612 p22.currentPosition = baseScriptTableStart + this.minMaxOffset; 29613 return new MinMaxTable(p22); 29614 }); 29615 } 29616 }; 29617 var BaseValuesTable = class { 29618 constructor(p22) { 29619 this.parser = p22; 29620 this.start = p22.currentPosition; 29621 this.defaultBaselineIndex = p22.uint16; 29622 this.baseCoordCount = p22.uint16; 29623 this.baseCoords = [...new Array(this.baseCoordCount)].map( 29624 (_) => p22.Offset16 29625 ); 29626 } 29627 getTable(id) { 29628 this.parser.currentPosition = this.start + this.baseCoords[id]; 29629 return new BaseCoordTable(this.parser); 29630 } 29631 }; 29632 var MinMaxTable = class { 29633 constructor(p22) { 29634 this.minCoord = p22.Offset16; 29635 this.maxCoord = p22.Offset16; 29636 this.featMinMaxCount = p22.uint16; 29637 const recordStart = p22.currentPosition; 29638 lazy$1(this, `featMinMaxRecords`, () => { 29639 p22.currentPosition = recordStart; 29640 return [...new Array(this.featMinMaxCount)].map( 29641 (_) => new FeatMinMaxRecord(p22) 29642 ); 29643 }); 29644 } 29645 }; 29646 var FeatMinMaxRecord = class { 29647 constructor(p22) { 29648 this.featureTableTag = p22.tag; 29649 this.minCoord = p22.Offset16; 29650 this.maxCoord = p22.Offset16; 29651 } 29652 }; 29653 var BaseCoordTable = class { 29654 constructor(p22) { 29655 this.baseCoordFormat = p22.uint16; 29656 this.coordinate = p22.int16; 29657 if (this.baseCoordFormat === 2) { 29658 this.referenceGlyph = p22.uint16; 29659 this.baseCoordPoint = p22.uint16; 29660 } 29661 if (this.baseCoordFormat === 3) { 29662 this.deviceTable = p22.Offset16; 29663 } 29664 } 29665 }; 29666 var BASE$1 = Object.freeze({ __proto__: null, BASE }); 29667 var ClassDefinition = class { 29668 constructor(p22) { 29669 this.classFormat = p22.uint16; 29670 if (this.classFormat === 1) { 29671 this.startGlyphID = p22.uint16; 29672 this.glyphCount = p22.uint16; 29673 this.classValueArray = [...new Array(this.glyphCount)].map( 29674 (_) => p22.uint16 29675 ); 29676 } 29677 if (this.classFormat === 2) { 29678 this.classRangeCount = p22.uint16; 29679 this.classRangeRecords = [ 29680 ...new Array(this.classRangeCount) 29681 ].map((_) => new ClassRangeRecord(p22)); 29682 } 29683 } 29684 }; 29685 var ClassRangeRecord = class { 29686 constructor(p22) { 29687 this.startGlyphID = p22.uint16; 29688 this.endGlyphID = p22.uint16; 29689 this.class = p22.uint16; 29690 } 29691 }; 29692 var CoverageTable = class extends ParsedData { 29693 constructor(p22) { 29694 super(p22); 29695 this.coverageFormat = p22.uint16; 29696 if (this.coverageFormat === 1) { 29697 this.glyphCount = p22.uint16; 29698 this.glyphArray = [...new Array(this.glyphCount)].map( 29699 (_) => p22.uint16 29700 ); 29701 } 29702 if (this.coverageFormat === 2) { 29703 this.rangeCount = p22.uint16; 29704 this.rangeRecords = [...new Array(this.rangeCount)].map( 29705 (_) => new CoverageRangeRecord(p22) 29706 ); 29707 } 29708 } 29709 }; 29710 var CoverageRangeRecord = class { 29711 constructor(p22) { 29712 this.startGlyphID = p22.uint16; 29713 this.endGlyphID = p22.uint16; 29714 this.startCoverageIndex = p22.uint16; 29715 } 29716 }; 29717 var ItemVariationStoreTable = class { 29718 constructor(table, p22) { 29719 this.table = table; 29720 this.parser = p22; 29721 this.start = p22.currentPosition; 29722 this.format = p22.uint16; 29723 this.variationRegionListOffset = p22.Offset32; 29724 this.itemVariationDataCount = p22.uint16; 29725 this.itemVariationDataOffsets = [ 29726 ...new Array(this.itemVariationDataCount) 29727 ].map((_) => p22.Offset32); 29728 } 29729 }; 29730 var GDEF = class extends SimpleTable { 29731 constructor(dict, dataview) { 29732 const { p: p22 } = super(dict, dataview); 29733 this.majorVersion = p22.uint16; 29734 this.minorVersion = p22.uint16; 29735 this.glyphClassDefOffset = p22.Offset16; 29736 lazy$1(this, `glyphClassDefs`, () => { 29737 if (this.glyphClassDefOffset === 0) return void 0; 29738 p22.currentPosition = this.tableStart + this.glyphClassDefOffset; 29739 return new ClassDefinition(p22); 29740 }); 29741 this.attachListOffset = p22.Offset16; 29742 lazy$1(this, `attachList`, () => { 29743 if (this.attachListOffset === 0) return void 0; 29744 p22.currentPosition = this.tableStart + this.attachListOffset; 29745 return new AttachList(p22); 29746 }); 29747 this.ligCaretListOffset = p22.Offset16; 29748 lazy$1(this, `ligCaretList`, () => { 29749 if (this.ligCaretListOffset === 0) return void 0; 29750 p22.currentPosition = this.tableStart + this.ligCaretListOffset; 29751 return new LigCaretList(p22); 29752 }); 29753 this.markAttachClassDefOffset = p22.Offset16; 29754 lazy$1(this, `markAttachClassDef`, () => { 29755 if (this.markAttachClassDefOffset === 0) return void 0; 29756 p22.currentPosition = this.tableStart + this.markAttachClassDefOffset; 29757 return new ClassDefinition(p22); 29758 }); 29759 if (this.minorVersion >= 2) { 29760 this.markGlyphSetsDefOffset = p22.Offset16; 29761 lazy$1(this, `markGlyphSetsDef`, () => { 29762 if (this.markGlyphSetsDefOffset === 0) return void 0; 29763 p22.currentPosition = this.tableStart + this.markGlyphSetsDefOffset; 29764 return new MarkGlyphSetsTable(p22); 29765 }); 29766 } 29767 if (this.minorVersion === 3) { 29768 this.itemVarStoreOffset = p22.Offset32; 29769 lazy$1(this, `itemVarStore`, () => { 29770 if (this.itemVarStoreOffset === 0) return void 0; 29771 p22.currentPosition = this.tableStart + this.itemVarStoreOffset; 29772 return new ItemVariationStoreTable(p22); 29773 }); 29774 } 29775 } 29776 }; 29777 var AttachList = class extends ParsedData { 29778 constructor(p22) { 29779 super(p22); 29780 this.coverageOffset = p22.Offset16; 29781 this.glyphCount = p22.uint16; 29782 this.attachPointOffsets = [...new Array(this.glyphCount)].map( 29783 (_) => p22.Offset16 29784 ); 29785 } 29786 getPoint(pointID) { 29787 this.parser.currentPosition = this.start + this.attachPointOffsets[pointID]; 29788 return new AttachPoint(this.parser); 29789 } 29790 }; 29791 var AttachPoint = class { 29792 constructor(p22) { 29793 this.pointCount = p22.uint16; 29794 this.pointIndices = [...new Array(this.pointCount)].map( 29795 (_) => p22.uint16 29796 ); 29797 } 29798 }; 29799 var LigCaretList = class extends ParsedData { 29800 constructor(p22) { 29801 super(p22); 29802 this.coverageOffset = p22.Offset16; 29803 lazy$1(this, `coverage`, () => { 29804 p22.currentPosition = this.start + this.coverageOffset; 29805 return new CoverageTable(p22); 29806 }); 29807 this.ligGlyphCount = p22.uint16; 29808 this.ligGlyphOffsets = [...new Array(this.ligGlyphCount)].map( 29809 (_) => p22.Offset16 29810 ); 29811 } 29812 getLigGlyph(ligGlyphID) { 29813 this.parser.currentPosition = this.start + this.ligGlyphOffsets[ligGlyphID]; 29814 return new LigGlyph(this.parser); 29815 } 29816 }; 29817 var LigGlyph = class extends ParsedData { 29818 constructor(p22) { 29819 super(p22); 29820 this.caretCount = p22.uint16; 29821 this.caretValueOffsets = [...new Array(this.caretCount)].map( 29822 (_) => p22.Offset16 29823 ); 29824 } 29825 getCaretValue(caretID) { 29826 this.parser.currentPosition = this.start + this.caretValueOffsets[caretID]; 29827 return new CaretValue(this.parser); 29828 } 29829 }; 29830 var CaretValue = class { 29831 constructor(p22) { 29832 this.caretValueFormat = p22.uint16; 29833 if (this.caretValueFormat === 1) { 29834 this.coordinate = p22.int16; 29835 } 29836 if (this.caretValueFormat === 2) { 29837 this.caretValuePointIndex = p22.uint16; 29838 } 29839 if (this.caretValueFormat === 3) { 29840 this.coordinate = p22.int16; 29841 this.deviceOffset = p22.Offset16; 29842 } 29843 } 29844 }; 29845 var MarkGlyphSetsTable = class extends ParsedData { 29846 constructor(p22) { 29847 super(p22); 29848 this.markGlyphSetTableFormat = p22.uint16; 29849 this.markGlyphSetCount = p22.uint16; 29850 this.coverageOffsets = [...new Array(this.markGlyphSetCount)].map( 29851 (_) => p22.Offset32 29852 ); 29853 } 29854 getMarkGlyphSet(markGlyphSetID) { 29855 this.parser.currentPosition = this.start + this.coverageOffsets[markGlyphSetID]; 29856 return new CoverageTable(this.parser); 29857 } 29858 }; 29859 var GDEF$1 = Object.freeze({ __proto__: null, GDEF }); 29860 var ScriptList = class extends ParsedData { 29861 static EMPTY = { scriptCount: 0, scriptRecords: [] }; 29862 constructor(p22) { 29863 super(p22); 29864 this.scriptCount = p22.uint16; 29865 this.scriptRecords = [...new Array(this.scriptCount)].map( 29866 (_) => new ScriptRecord(p22) 29867 ); 29868 } 29869 }; 29870 var ScriptRecord = class { 29871 constructor(p22) { 29872 this.scriptTag = p22.tag; 29873 this.scriptOffset = p22.Offset16; 29874 } 29875 }; 29876 var ScriptTable = class extends ParsedData { 29877 constructor(p22) { 29878 super(p22); 29879 this.defaultLangSys = p22.Offset16; 29880 this.langSysCount = p22.uint16; 29881 this.langSysRecords = [...new Array(this.langSysCount)].map( 29882 (_) => new LangSysRecord(p22) 29883 ); 29884 } 29885 }; 29886 var LangSysRecord = class { 29887 constructor(p22) { 29888 this.langSysTag = p22.tag; 29889 this.langSysOffset = p22.Offset16; 29890 } 29891 }; 29892 var LangSysTable = class { 29893 constructor(p22) { 29894 this.lookupOrder = p22.Offset16; 29895 this.requiredFeatureIndex = p22.uint16; 29896 this.featureIndexCount = p22.uint16; 29897 this.featureIndices = [...new Array(this.featureIndexCount)].map( 29898 (_) => p22.uint16 29899 ); 29900 } 29901 }; 29902 var FeatureList = class extends ParsedData { 29903 static EMPTY = { featureCount: 0, featureRecords: [] }; 29904 constructor(p22) { 29905 super(p22); 29906 this.featureCount = p22.uint16; 29907 this.featureRecords = [...new Array(this.featureCount)].map( 29908 (_) => new FeatureRecord(p22) 29909 ); 29910 } 29911 }; 29912 var FeatureRecord = class { 29913 constructor(p22) { 29914 this.featureTag = p22.tag; 29915 this.featureOffset = p22.Offset16; 29916 } 29917 }; 29918 var FeatureTable = class extends ParsedData { 29919 constructor(p22) { 29920 super(p22); 29921 this.featureParams = p22.Offset16; 29922 this.lookupIndexCount = p22.uint16; 29923 this.lookupListIndices = [...new Array(this.lookupIndexCount)].map( 29924 (_) => p22.uint16 29925 ); 29926 } 29927 getFeatureParams() { 29928 if (this.featureParams > 0) { 29929 const p22 = this.parser; 29930 p22.currentPosition = this.start + this.featureParams; 29931 const tag = this.featureTag; 29932 if (tag === `size`) return new Size(p22); 29933 if (tag.startsWith(`cc`)) return new CharacterVariant(p22); 29934 if (tag.startsWith(`ss`)) return new StylisticSet(p22); 29935 } 29936 } 29937 }; 29938 var CharacterVariant = class { 29939 constructor(p22) { 29940 this.format = p22.uint16; 29941 this.featUiLabelNameId = p22.uint16; 29942 this.featUiTooltipTextNameId = p22.uint16; 29943 this.sampleTextNameId = p22.uint16; 29944 this.numNamedParameters = p22.uint16; 29945 this.firstParamUiLabelNameId = p22.uint16; 29946 this.charCount = p22.uint16; 29947 this.character = [...new Array(this.charCount)].map( 29948 (_) => p22.uint24 29949 ); 29950 } 29951 }; 29952 var Size = class { 29953 constructor(p22) { 29954 this.designSize = p22.uint16; 29955 this.subfamilyIdentifier = p22.uint16; 29956 this.subfamilyNameID = p22.uint16; 29957 this.smallEnd = p22.uint16; 29958 this.largeEnd = p22.uint16; 29959 } 29960 }; 29961 var StylisticSet = class { 29962 constructor(p22) { 29963 this.version = p22.uint16; 29964 this.UINameID = p22.uint16; 29965 } 29966 }; 29967 function undoCoverageOffsetParsing(instance) { 29968 instance.parser.currentPosition -= 2; 29969 delete instance.coverageOffset; 29970 delete instance.getCoverageTable; 29971 } 29972 var LookupType$1 = class extends ParsedData { 29973 constructor(p22) { 29974 super(p22); 29975 this.substFormat = p22.uint16; 29976 this.coverageOffset = p22.Offset16; 29977 } 29978 getCoverageTable() { 29979 let p22 = this.parser; 29980 p22.currentPosition = this.start + this.coverageOffset; 29981 return new CoverageTable(p22); 29982 } 29983 }; 29984 var SubstLookupRecord = class { 29985 constructor(p22) { 29986 this.glyphSequenceIndex = p22.uint16; 29987 this.lookupListIndex = p22.uint16; 29988 } 29989 }; 29990 var LookupType1$1 = class extends LookupType$1 { 29991 constructor(p22) { 29992 super(p22); 29993 this.deltaGlyphID = p22.int16; 29994 } 29995 }; 29996 var LookupType2$1 = class extends LookupType$1 { 29997 constructor(p22) { 29998 super(p22); 29999 this.sequenceCount = p22.uint16; 30000 this.sequenceOffsets = [...new Array(this.sequenceCount)].map( 30001 (_) => p22.Offset16 30002 ); 30003 } 30004 getSequence(index2) { 30005 let p22 = this.parser; 30006 p22.currentPosition = this.start + this.sequenceOffsets[index2]; 30007 return new SequenceTable(p22); 30008 } 30009 }; 30010 var SequenceTable = class { 30011 constructor(p22) { 30012 this.glyphCount = p22.uint16; 30013 this.substituteGlyphIDs = [...new Array(this.glyphCount)].map( 30014 (_) => p22.uint16 30015 ); 30016 } 30017 }; 30018 var LookupType3$1 = class extends LookupType$1 { 30019 constructor(p22) { 30020 super(p22); 30021 this.alternateSetCount = p22.uint16; 30022 this.alternateSetOffsets = [ 30023 ...new Array(this.alternateSetCount) 30024 ].map((_) => p22.Offset16); 30025 } 30026 getAlternateSet(index2) { 30027 let p22 = this.parser; 30028 p22.currentPosition = this.start + this.alternateSetOffsets[index2]; 30029 return new AlternateSetTable(p22); 30030 } 30031 }; 30032 var AlternateSetTable = class { 30033 constructor(p22) { 30034 this.glyphCount = p22.uint16; 30035 this.alternateGlyphIDs = [...new Array(this.glyphCount)].map( 30036 (_) => p22.uint16 30037 ); 30038 } 30039 }; 30040 var LookupType4$1 = class extends LookupType$1 { 30041 constructor(p22) { 30042 super(p22); 30043 this.ligatureSetCount = p22.uint16; 30044 this.ligatureSetOffsets = [...new Array(this.ligatureSetCount)].map( 30045 (_) => p22.Offset16 30046 ); 30047 } 30048 getLigatureSet(index2) { 30049 let p22 = this.parser; 30050 p22.currentPosition = this.start + this.ligatureSetOffsets[index2]; 30051 return new LigatureSetTable(p22); 30052 } 30053 }; 30054 var LigatureSetTable = class extends ParsedData { 30055 constructor(p22) { 30056 super(p22); 30057 this.ligatureCount = p22.uint16; 30058 this.ligatureOffsets = [...new Array(this.ligatureCount)].map( 30059 (_) => p22.Offset16 30060 ); 30061 } 30062 getLigature(index2) { 30063 let p22 = this.parser; 30064 p22.currentPosition = this.start + this.ligatureOffsets[index2]; 30065 return new LigatureTable(p22); 30066 } 30067 }; 30068 var LigatureTable = class { 30069 constructor(p22) { 30070 this.ligatureGlyph = p22.uint16; 30071 this.componentCount = p22.uint16; 30072 this.componentGlyphIDs = [ 30073 ...new Array(this.componentCount - 1) 30074 ].map((_) => p22.uint16); 30075 } 30076 }; 30077 var LookupType5$1 = class extends LookupType$1 { 30078 constructor(p22) { 30079 super(p22); 30080 if (this.substFormat === 1) { 30081 this.subRuleSetCount = p22.uint16; 30082 this.subRuleSetOffsets = [ 30083 ...new Array(this.subRuleSetCount) 30084 ].map((_) => p22.Offset16); 30085 } 30086 if (this.substFormat === 2) { 30087 this.classDefOffset = p22.Offset16; 30088 this.subClassSetCount = p22.uint16; 30089 this.subClassSetOffsets = [ 30090 ...new Array(this.subClassSetCount) 30091 ].map((_) => p22.Offset16); 30092 } 30093 if (this.substFormat === 3) { 30094 undoCoverageOffsetParsing(this); 30095 this.glyphCount = p22.uint16; 30096 this.substitutionCount = p22.uint16; 30097 this.coverageOffsets = [...new Array(this.glyphCount)].map( 30098 (_) => p22.Offset16 30099 ); 30100 this.substLookupRecords = [ 30101 ...new Array(this.substitutionCount) 30102 ].map((_) => new SubstLookupRecord(p22)); 30103 } 30104 } 30105 getSubRuleSet(index2) { 30106 if (this.substFormat !== 1) 30107 throw new Error( 30108 `lookup type 5.$this.substFormat} has no subrule sets.` 30109 ); 30110 let p22 = this.parser; 30111 p22.currentPosition = this.start + this.subRuleSetOffsets[index2]; 30112 return new SubRuleSetTable(p22); 30113 } 30114 getSubClassSet(index2) { 30115 if (this.substFormat !== 2) 30116 throw new Error( 30117 `lookup type 5.$this.substFormat} has no subclass sets.` 30118 ); 30119 let p22 = this.parser; 30120 p22.currentPosition = this.start + this.subClassSetOffsets[index2]; 30121 return new SubClassSetTable(p22); 30122 } 30123 getCoverageTable(index2) { 30124 if (this.substFormat !== 3 && !index2) 30125 return super.getCoverageTable(); 30126 if (!index2) 30127 throw new Error( 30128 `lookup type 5.$this.substFormat} requires an coverage table index.` 30129 ); 30130 let p22 = this.parser; 30131 p22.currentPosition = this.start + this.coverageOffsets[index2]; 30132 return new CoverageTable(p22); 30133 } 30134 }; 30135 var SubRuleSetTable = class extends ParsedData { 30136 constructor(p22) { 30137 super(p22); 30138 this.subRuleCount = p22.uint16; 30139 this.subRuleOffsets = [...new Array(this.subRuleCount)].map( 30140 (_) => p22.Offset16 30141 ); 30142 } 30143 getSubRule(index2) { 30144 let p22 = this.parser; 30145 p22.currentPosition = this.start + this.subRuleOffsets[index2]; 30146 return new SubRuleTable(p22); 30147 } 30148 }; 30149 var SubRuleTable = class { 30150 constructor(p22) { 30151 this.glyphCount = p22.uint16; 30152 this.substitutionCount = p22.uint16; 30153 this.inputSequence = [...new Array(this.glyphCount - 1)].map( 30154 (_) => p22.uint16 30155 ); 30156 this.substLookupRecords = [ 30157 ...new Array(this.substitutionCount) 30158 ].map((_) => new SubstLookupRecord(p22)); 30159 } 30160 }; 30161 var SubClassSetTable = class extends ParsedData { 30162 constructor(p22) { 30163 super(p22); 30164 this.subClassRuleCount = p22.uint16; 30165 this.subClassRuleOffsets = [ 30166 ...new Array(this.subClassRuleCount) 30167 ].map((_) => p22.Offset16); 30168 } 30169 getSubClass(index2) { 30170 let p22 = this.parser; 30171 p22.currentPosition = this.start + this.subClassRuleOffsets[index2]; 30172 return new SubClassRuleTable(p22); 30173 } 30174 }; 30175 var SubClassRuleTable = class extends SubRuleTable { 30176 constructor(p22) { 30177 super(p22); 30178 } 30179 }; 30180 var LookupType6$1 = class extends LookupType$1 { 30181 constructor(p22) { 30182 super(p22); 30183 if (this.substFormat === 1) { 30184 this.chainSubRuleSetCount = p22.uint16; 30185 this.chainSubRuleSetOffsets = [ 30186 ...new Array(this.chainSubRuleSetCount) 30187 ].map((_) => p22.Offset16); 30188 } 30189 if (this.substFormat === 2) { 30190 this.backtrackClassDefOffset = p22.Offset16; 30191 this.inputClassDefOffset = p22.Offset16; 30192 this.lookaheadClassDefOffset = p22.Offset16; 30193 this.chainSubClassSetCount = p22.uint16; 30194 this.chainSubClassSetOffsets = [ 30195 ...new Array(this.chainSubClassSetCount) 30196 ].map((_) => p22.Offset16); 30197 } 30198 if (this.substFormat === 3) { 30199 undoCoverageOffsetParsing(this); 30200 this.backtrackGlyphCount = p22.uint16; 30201 this.backtrackCoverageOffsets = [ 30202 ...new Array(this.backtrackGlyphCount) 30203 ].map((_) => p22.Offset16); 30204 this.inputGlyphCount = p22.uint16; 30205 this.inputCoverageOffsets = [ 30206 ...new Array(this.inputGlyphCount) 30207 ].map((_) => p22.Offset16); 30208 this.lookaheadGlyphCount = p22.uint16; 30209 this.lookaheadCoverageOffsets = [ 30210 ...new Array(this.lookaheadGlyphCount) 30211 ].map((_) => p22.Offset16); 30212 this.seqLookupCount = p22.uint16; 30213 this.seqLookupRecords = [ 30214 ...new Array(this.substitutionCount) 30215 ].map((_) => new SequenceLookupRecord(p22)); 30216 } 30217 } 30218 getChainSubRuleSet(index2) { 30219 if (this.substFormat !== 1) 30220 throw new Error( 30221 `lookup type 6.$this.substFormat} has no chainsubrule sets.` 30222 ); 30223 let p22 = this.parser; 30224 p22.currentPosition = this.start + this.chainSubRuleSetOffsets[index2]; 30225 return new ChainSubRuleSetTable(p22); 30226 } 30227 getChainSubClassSet(index2) { 30228 if (this.substFormat !== 2) 30229 throw new Error( 30230 `lookup type 6.$this.substFormat} has no chainsubclass sets.` 30231 ); 30232 let p22 = this.parser; 30233 p22.currentPosition = this.start + this.chainSubClassSetOffsets[index2]; 30234 return new ChainSubClassSetTable(p22); 30235 } 30236 getCoverageFromOffset(offset4) { 30237 if (this.substFormat !== 3) 30238 throw new Error( 30239 `lookup type 6.$this.substFormat} does not use contextual coverage offsets.` 30240 ); 30241 let p22 = this.parser; 30242 p22.currentPosition = this.start + offset4; 30243 return new CoverageTable(p22); 30244 } 30245 }; 30246 var ChainSubRuleSetTable = class extends ParsedData { 30247 constructor(p22) { 30248 super(p22); 30249 this.chainSubRuleCount = p22.uint16; 30250 this.chainSubRuleOffsets = [ 30251 ...new Array(this.chainSubRuleCount) 30252 ].map((_) => p22.Offset16); 30253 } 30254 getSubRule(index2) { 30255 let p22 = this.parser; 30256 p22.currentPosition = this.start + this.chainSubRuleOffsets[index2]; 30257 return new ChainSubRuleTable(p22); 30258 } 30259 }; 30260 var ChainSubRuleTable = class { 30261 constructor(p22) { 30262 this.backtrackGlyphCount = p22.uint16; 30263 this.backtrackSequence = [ 30264 ...new Array(this.backtrackGlyphCount) 30265 ].map((_) => p22.uint16); 30266 this.inputGlyphCount = p22.uint16; 30267 this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map( 30268 (_) => p22.uint16 30269 ); 30270 this.lookaheadGlyphCount = p22.uint16; 30271 this.lookAheadSequence = [ 30272 ...new Array(this.lookAheadGlyphCount) 30273 ].map((_) => p22.uint16); 30274 this.substitutionCount = p22.uint16; 30275 this.substLookupRecords = [...new Array(this.SubstCount)].map( 30276 (_) => new SubstLookupRecord(p22) 30277 ); 30278 } 30279 }; 30280 var ChainSubClassSetTable = class extends ParsedData { 30281 constructor(p22) { 30282 super(p22); 30283 this.chainSubClassRuleCount = p22.uint16; 30284 this.chainSubClassRuleOffsets = [ 30285 ...new Array(this.chainSubClassRuleCount) 30286 ].map((_) => p22.Offset16); 30287 } 30288 getSubClass(index2) { 30289 let p22 = this.parser; 30290 p22.currentPosition = this.start + this.chainSubRuleOffsets[index2]; 30291 return new ChainSubClassRuleTable(p22); 30292 } 30293 }; 30294 var ChainSubClassRuleTable = class { 30295 constructor(p22) { 30296 this.backtrackGlyphCount = p22.uint16; 30297 this.backtrackSequence = [ 30298 ...new Array(this.backtrackGlyphCount) 30299 ].map((_) => p22.uint16); 30300 this.inputGlyphCount = p22.uint16; 30301 this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map( 30302 (_) => p22.uint16 30303 ); 30304 this.lookaheadGlyphCount = p22.uint16; 30305 this.lookAheadSequence = [ 30306 ...new Array(this.lookAheadGlyphCount) 30307 ].map((_) => p22.uint16); 30308 this.substitutionCount = p22.uint16; 30309 this.substLookupRecords = [ 30310 ...new Array(this.substitutionCount) 30311 ].map((_) => new SequenceLookupRecord(p22)); 30312 } 30313 }; 30314 var SequenceLookupRecord = class extends ParsedData { 30315 constructor(p22) { 30316 super(p22); 30317 this.sequenceIndex = p22.uint16; 30318 this.lookupListIndex = p22.uint16; 30319 } 30320 }; 30321 var LookupType7$1 = class extends ParsedData { 30322 constructor(p22) { 30323 super(p22); 30324 this.substFormat = p22.uint16; 30325 this.extensionLookupType = p22.uint16; 30326 this.extensionOffset = p22.Offset32; 30327 } 30328 }; 30329 var LookupType8$1 = class extends LookupType$1 { 30330 constructor(p22) { 30331 super(p22); 30332 this.backtrackGlyphCount = p22.uint16; 30333 this.backtrackCoverageOffsets = [ 30334 ...new Array(this.backtrackGlyphCount) 30335 ].map((_) => p22.Offset16); 30336 this.lookaheadGlyphCount = p22.uint16; 30337 this.lookaheadCoverageOffsets = [ 30338 new Array(this.lookaheadGlyphCount) 30339 ].map((_) => p22.Offset16); 30340 this.glyphCount = p22.uint16; 30341 this.substituteGlyphIDs = [...new Array(this.glyphCount)].map( 30342 (_) => p22.uint16 30343 ); 30344 } 30345 }; 30346 var GSUBtables = { 30347 buildSubtable: function(type, p22) { 30348 const subtable = new [ 30349 void 0, 30350 LookupType1$1, 30351 LookupType2$1, 30352 LookupType3$1, 30353 LookupType4$1, 30354 LookupType5$1, 30355 LookupType6$1, 30356 LookupType7$1, 30357 LookupType8$1 30358 ][type](p22); 30359 subtable.type = type; 30360 return subtable; 30361 } 30362 }; 30363 var LookupType = class extends ParsedData { 30364 constructor(p22) { 30365 super(p22); 30366 } 30367 }; 30368 var LookupType1 = class extends LookupType { 30369 constructor(p22) { 30370 super(p22); 30371 console.log(`lookup type 1`); 30372 } 30373 }; 30374 var LookupType2 = class extends LookupType { 30375 constructor(p22) { 30376 super(p22); 30377 console.log(`lookup type 2`); 30378 } 30379 }; 30380 var LookupType3 = class extends LookupType { 30381 constructor(p22) { 30382 super(p22); 30383 console.log(`lookup type 3`); 30384 } 30385 }; 30386 var LookupType4 = class extends LookupType { 30387 constructor(p22) { 30388 super(p22); 30389 console.log(`lookup type 4`); 30390 } 30391 }; 30392 var LookupType5 = class extends LookupType { 30393 constructor(p22) { 30394 super(p22); 30395 console.log(`lookup type 5`); 30396 } 30397 }; 30398 var LookupType6 = class extends LookupType { 30399 constructor(p22) { 30400 super(p22); 30401 console.log(`lookup type 6`); 30402 } 30403 }; 30404 var LookupType7 = class extends LookupType { 30405 constructor(p22) { 30406 super(p22); 30407 console.log(`lookup type 7`); 30408 } 30409 }; 30410 var LookupType8 = class extends LookupType { 30411 constructor(p22) { 30412 super(p22); 30413 console.log(`lookup type 8`); 30414 } 30415 }; 30416 var LookupType9 = class extends LookupType { 30417 constructor(p22) { 30418 super(p22); 30419 console.log(`lookup type 9`); 30420 } 30421 }; 30422 var GPOStables = { 30423 buildSubtable: function(type, p22) { 30424 const subtable = new [ 30425 void 0, 30426 LookupType1, 30427 LookupType2, 30428 LookupType3, 30429 LookupType4, 30430 LookupType5, 30431 LookupType6, 30432 LookupType7, 30433 LookupType8, 30434 LookupType9 30435 ][type](p22); 30436 subtable.type = type; 30437 return subtable; 30438 } 30439 }; 30440 var LookupList = class extends ParsedData { 30441 static EMPTY = { lookupCount: 0, lookups: [] }; 30442 constructor(p22) { 30443 super(p22); 30444 this.lookupCount = p22.uint16; 30445 this.lookups = [...new Array(this.lookupCount)].map( 30446 (_) => p22.Offset16 30447 ); 30448 } 30449 }; 30450 var LookupTable = class extends ParsedData { 30451 constructor(p22, type) { 30452 super(p22); 30453 this.ctType = type; 30454 this.lookupType = p22.uint16; 30455 this.lookupFlag = p22.uint16; 30456 this.subTableCount = p22.uint16; 30457 this.subtableOffsets = [...new Array(this.subTableCount)].map( 30458 (_) => p22.Offset16 30459 ); 30460 this.markFilteringSet = p22.uint16; 30461 } 30462 get rightToLeft() { 30463 return this.lookupFlag & true; 30464 } 30465 get ignoreBaseGlyphs() { 30466 return this.lookupFlag & true; 30467 } 30468 get ignoreLigatures() { 30469 return this.lookupFlag & true; 30470 } 30471 get ignoreMarks() { 30472 return this.lookupFlag & true; 30473 } 30474 get useMarkFilteringSet() { 30475 return this.lookupFlag & true; 30476 } 30477 get markAttachmentType() { 30478 return this.lookupFlag & true; 30479 } 30480 getSubTable(index2) { 30481 const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables; 30482 this.parser.currentPosition = this.start + this.subtableOffsets[index2]; 30483 return builder.buildSubtable(this.lookupType, this.parser); 30484 } 30485 }; 30486 var CommonLayoutTable = class extends SimpleTable { 30487 constructor(dict, dataview, name2) { 30488 const { p: p22, tableStart } = super(dict, dataview, name2); 30489 this.majorVersion = p22.uint16; 30490 this.minorVersion = p22.uint16; 30491 this.scriptListOffset = p22.Offset16; 30492 this.featureListOffset = p22.Offset16; 30493 this.lookupListOffset = p22.Offset16; 30494 if (this.majorVersion === 1 && this.minorVersion === 1) { 30495 this.featureVariationsOffset = p22.Offset32; 30496 } 30497 const no_content = !(this.scriptListOffset || this.featureListOffset || this.lookupListOffset); 30498 lazy$1(this, `scriptList`, () => { 30499 if (no_content) return ScriptList.EMPTY; 30500 p22.currentPosition = tableStart + this.scriptListOffset; 30501 return new ScriptList(p22); 30502 }); 30503 lazy$1(this, `featureList`, () => { 30504 if (no_content) return FeatureList.EMPTY; 30505 p22.currentPosition = tableStart + this.featureListOffset; 30506 return new FeatureList(p22); 30507 }); 30508 lazy$1(this, `lookupList`, () => { 30509 if (no_content) return LookupList.EMPTY; 30510 p22.currentPosition = tableStart + this.lookupListOffset; 30511 return new LookupList(p22); 30512 }); 30513 if (this.featureVariationsOffset) { 30514 lazy$1(this, `featureVariations`, () => { 30515 if (no_content) return FeatureVariations.EMPTY; 30516 p22.currentPosition = tableStart + this.featureVariationsOffset; 30517 return new FeatureVariations(p22); 30518 }); 30519 } 30520 } 30521 getSupportedScripts() { 30522 return this.scriptList.scriptRecords.map((r3) => r3.scriptTag); 30523 } 30524 getScriptTable(scriptTag) { 30525 let record = this.scriptList.scriptRecords.find( 30526 (r3) => r3.scriptTag === scriptTag 30527 ); 30528 this.parser.currentPosition = this.scriptList.start + record.scriptOffset; 30529 let table = new ScriptTable(this.parser); 30530 table.scriptTag = scriptTag; 30531 return table; 30532 } 30533 ensureScriptTable(arg) { 30534 if (typeof arg === "string") { 30535 return this.getScriptTable(arg); 30536 } 30537 return arg; 30538 } 30539 getSupportedLangSys(scriptTable) { 30540 scriptTable = this.ensureScriptTable(scriptTable); 30541 const hasDefault = scriptTable.defaultLangSys !== 0; 30542 const supported = scriptTable.langSysRecords.map( 30543 (l2) => l2.langSysTag 30544 ); 30545 if (hasDefault) supported.unshift(`dflt`); 30546 return supported; 30547 } 30548 getDefaultLangSysTable(scriptTable) { 30549 scriptTable = this.ensureScriptTable(scriptTable); 30550 let offset4 = scriptTable.defaultLangSys; 30551 if (offset4 !== 0) { 30552 this.parser.currentPosition = scriptTable.start + offset4; 30553 let table = new LangSysTable(this.parser); 30554 table.langSysTag = ``; 30555 table.defaultForScript = scriptTable.scriptTag; 30556 return table; 30557 } 30558 } 30559 getLangSysTable(scriptTable, langSysTag = `dflt`) { 30560 if (langSysTag === `dflt`) 30561 return this.getDefaultLangSysTable(scriptTable); 30562 scriptTable = this.ensureScriptTable(scriptTable); 30563 let record = scriptTable.langSysRecords.find( 30564 (l2) => l2.langSysTag === langSysTag 30565 ); 30566 this.parser.currentPosition = scriptTable.start + record.langSysOffset; 30567 let table = new LangSysTable(this.parser); 30568 table.langSysTag = langSysTag; 30569 return table; 30570 } 30571 getFeatures(langSysTable) { 30572 return langSysTable.featureIndices.map( 30573 (index2) => this.getFeature(index2) 30574 ); 30575 } 30576 getFeature(indexOrTag) { 30577 let record; 30578 if (parseInt(indexOrTag) == indexOrTag) { 30579 record = this.featureList.featureRecords[indexOrTag]; 30580 } else { 30581 record = this.featureList.featureRecords.find( 30582 (f2) => f2.featureTag === indexOrTag 30583 ); 30584 } 30585 if (!record) return; 30586 this.parser.currentPosition = this.featureList.start + record.featureOffset; 30587 let table = new FeatureTable(this.parser); 30588 table.featureTag = record.featureTag; 30589 return table; 30590 } 30591 getLookups(featureTable) { 30592 return featureTable.lookupListIndices.map( 30593 (index2) => this.getLookup(index2) 30594 ); 30595 } 30596 getLookup(lookupIndex, type) { 30597 let lookupOffset = this.lookupList.lookups[lookupIndex]; 30598 this.parser.currentPosition = this.lookupList.start + lookupOffset; 30599 return new LookupTable(this.parser, type); 30600 } 30601 }; 30602 var GSUB = class extends CommonLayoutTable { 30603 constructor(dict, dataview) { 30604 super(dict, dataview, `GSUB`); 30605 } 30606 getLookup(lookupIndex) { 30607 return super.getLookup(lookupIndex, `GSUB`); 30608 } 30609 }; 30610 var GSUB$1 = Object.freeze({ __proto__: null, GSUB }); 30611 var GPOS = class extends CommonLayoutTable { 30612 constructor(dict, dataview) { 30613 super(dict, dataview, `GPOS`); 30614 } 30615 getLookup(lookupIndex) { 30616 return super.getLookup(lookupIndex, `GPOS`); 30617 } 30618 }; 30619 var GPOS$1 = Object.freeze({ __proto__: null, GPOS }); 30620 var SVG72 = class extends SimpleTable { 30621 constructor(dict, dataview) { 30622 const { p: p22 } = super(dict, dataview); 30623 this.version = p22.uint16; 30624 this.offsetToSVGDocumentList = p22.Offset32; 30625 p22.currentPosition = this.tableStart + this.offsetToSVGDocumentList; 30626 this.documentList = new SVGDocumentList(p22); 30627 } 30628 }; 30629 var SVGDocumentList = class extends ParsedData { 30630 constructor(p22) { 30631 super(p22); 30632 this.numEntries = p22.uint16; 30633 this.documentRecords = [...new Array(this.numEntries)].map( 30634 (_) => new SVGDocumentRecord(p22) 30635 ); 30636 } 30637 getDocument(documentID) { 30638 let record = this.documentRecords[documentID]; 30639 if (!record) return ""; 30640 let offset4 = this.start + record.svgDocOffset; 30641 this.parser.currentPosition = offset4; 30642 return this.parser.readBytes(record.svgDocLength); 30643 } 30644 getDocumentForGlyph(glyphID) { 30645 let id = this.documentRecords.findIndex( 30646 (d2) => d2.startGlyphID <= glyphID && glyphID <= d2.endGlyphID 30647 ); 30648 if (id === -1) return ""; 30649 return this.getDocument(id); 30650 } 30651 }; 30652 var SVGDocumentRecord = class { 30653 constructor(p22) { 30654 this.startGlyphID = p22.uint16; 30655 this.endGlyphID = p22.uint16; 30656 this.svgDocOffset = p22.Offset32; 30657 this.svgDocLength = p22.uint32; 30658 } 30659 }; 30660 var SVG$1 = Object.freeze({ __proto__: null, SVG: SVG72 }); 30661 var fvar = class extends SimpleTable { 30662 constructor(dict, dataview) { 30663 const { p: p22 } = super(dict, dataview); 30664 this.majorVersion = p22.uint16; 30665 this.minorVersion = p22.uint16; 30666 this.axesArrayOffset = p22.Offset16; 30667 p22.uint16; 30668 this.axisCount = p22.uint16; 30669 this.axisSize = p22.uint16; 30670 this.instanceCount = p22.uint16; 30671 this.instanceSize = p22.uint16; 30672 const axisStart = this.tableStart + this.axesArrayOffset; 30673 lazy$1(this, `axes`, () => { 30674 p22.currentPosition = axisStart; 30675 return [...new Array(this.axisCount)].map( 30676 (_) => new VariationAxisRecord(p22) 30677 ); 30678 }); 30679 const instanceStart = axisStart + this.axisCount * this.axisSize; 30680 lazy$1(this, `instances`, () => { 30681 let instances = []; 30682 for (let i2 = 0; i2 < this.instanceCount; i2++) { 30683 p22.currentPosition = instanceStart + i2 * this.instanceSize; 30684 instances.push( 30685 new InstanceRecord(p22, this.axisCount, this.instanceSize) 30686 ); 30687 } 30688 return instances; 30689 }); 30690 } 30691 getSupportedAxes() { 30692 return this.axes.map((a2) => a2.tag); 30693 } 30694 getAxis(name2) { 30695 return this.axes.find((a2) => a2.tag === name2); 30696 } 30697 }; 30698 var VariationAxisRecord = class { 30699 constructor(p22) { 30700 this.tag = p22.tag; 30701 this.minValue = p22.fixed; 30702 this.defaultValue = p22.fixed; 30703 this.maxValue = p22.fixed; 30704 this.flags = p22.flags(16); 30705 this.axisNameID = p22.uint16; 30706 } 30707 }; 30708 var InstanceRecord = class { 30709 constructor(p22, axisCount, size4) { 30710 let start2 = p22.currentPosition; 30711 this.subfamilyNameID = p22.uint16; 30712 p22.uint16; 30713 this.coordinates = [...new Array(axisCount)].map( 30714 (_) => p22.fixed 30715 ); 30716 if (p22.currentPosition - start2 < size4) { 30717 this.postScriptNameID = p22.uint16; 30718 } 30719 } 30720 }; 30721 var fvar$1 = Object.freeze({ __proto__: null, fvar }); 30722 var cvt = class extends SimpleTable { 30723 constructor(dict, dataview) { 30724 const { p: p22 } = super(dict, dataview); 30725 const n2 = dict.length / 2; 30726 lazy$1( 30727 this, 30728 `items`, 30729 () => [...new Array(n2)].map((_) => p22.fword) 30730 ); 30731 } 30732 }; 30733 var cvt$1 = Object.freeze({ __proto__: null, cvt }); 30734 var fpgm = class extends SimpleTable { 30735 constructor(dict, dataview) { 30736 const { p: p22 } = super(dict, dataview); 30737 lazy$1( 30738 this, 30739 `instructions`, 30740 () => [...new Array(dict.length)].map((_) => p22.uint8) 30741 ); 30742 } 30743 }; 30744 var fpgm$1 = Object.freeze({ __proto__: null, fpgm }); 30745 var gasp = class extends SimpleTable { 30746 constructor(dict, dataview) { 30747 const { p: p22 } = super(dict, dataview); 30748 this.version = p22.uint16; 30749 this.numRanges = p22.uint16; 30750 const getter = () => [...new Array(this.numRanges)].map( 30751 (_) => new GASPRange(p22) 30752 ); 30753 lazy$1(this, `gaspRanges`, getter); 30754 } 30755 }; 30756 var GASPRange = class { 30757 constructor(p22) { 30758 this.rangeMaxPPEM = p22.uint16; 30759 this.rangeGaspBehavior = p22.uint16; 30760 } 30761 }; 30762 var gasp$1 = Object.freeze({ __proto__: null, gasp }); 30763 var glyf = class extends SimpleTable { 30764 constructor(dict, dataview) { 30765 super(dict, dataview); 30766 } 30767 getGlyphData(offset4, length) { 30768 this.parser.currentPosition = this.tableStart + offset4; 30769 return this.parser.readBytes(length); 30770 } 30771 }; 30772 var glyf$1 = Object.freeze({ __proto__: null, glyf }); 30773 var loca = class extends SimpleTable { 30774 constructor(dict, dataview, tables) { 30775 const { p: p22 } = super(dict, dataview); 30776 const n2 = tables.maxp.numGlyphs + 1; 30777 if (tables.head.indexToLocFormat === 0) { 30778 this.x2 = true; 30779 lazy$1( 30780 this, 30781 `offsets`, 30782 () => [...new Array(n2)].map((_) => p22.Offset16) 30783 ); 30784 } else { 30785 lazy$1( 30786 this, 30787 `offsets`, 30788 () => [...new Array(n2)].map((_) => p22.Offset32) 30789 ); 30790 } 30791 } 30792 getGlyphDataOffsetAndLength(glyphID) { 30793 let offset4 = this.offsets[glyphID] * this.x2 ? 2 : 1; 30794 let nextOffset = this.offsets[glyphID + 1] * this.x2 ? 2 : 1; 30795 return { offset: offset4, length: nextOffset - offset4 }; 30796 } 30797 }; 30798 var loca$1 = Object.freeze({ __proto__: null, loca }); 30799 var prep = class extends SimpleTable { 30800 constructor(dict, dataview) { 30801 const { p: p22 } = super(dict, dataview); 30802 lazy$1( 30803 this, 30804 `instructions`, 30805 () => [...new Array(dict.length)].map((_) => p22.uint8) 30806 ); 30807 } 30808 }; 30809 var prep$1 = Object.freeze({ __proto__: null, prep }); 30810 var CFF = class extends SimpleTable { 30811 constructor(dict, dataview) { 30812 const { p: p22 } = super(dict, dataview); 30813 lazy$1(this, `data`, () => p22.readBytes()); 30814 } 30815 }; 30816 var CFF$1 = Object.freeze({ __proto__: null, CFF }); 30817 var CFF2 = class extends SimpleTable { 30818 constructor(dict, dataview) { 30819 const { p: p22 } = super(dict, dataview); 30820 lazy$1(this, `data`, () => p22.readBytes()); 30821 } 30822 }; 30823 var CFF2$1 = Object.freeze({ __proto__: null, CFF2 }); 30824 var VORG = class extends SimpleTable { 30825 constructor(dict, dataview) { 30826 const { p: p22 } = super(dict, dataview); 30827 this.majorVersion = p22.uint16; 30828 this.minorVersion = p22.uint16; 30829 this.defaultVertOriginY = p22.int16; 30830 this.numVertOriginYMetrics = p22.uint16; 30831 lazy$1( 30832 this, 30833 `vertORiginYMetrics`, 30834 () => [...new Array(this.numVertOriginYMetrics)].map( 30835 (_) => new VertOriginYMetric(p22) 30836 ) 30837 ); 30838 } 30839 }; 30840 var VertOriginYMetric = class { 30841 constructor(p22) { 30842 this.glyphIndex = p22.uint16; 30843 this.vertOriginY = p22.int16; 30844 } 30845 }; 30846 var VORG$1 = Object.freeze({ __proto__: null, VORG }); 30847 var BitmapSize = class { 30848 constructor(p22) { 30849 this.indexSubTableArrayOffset = p22.Offset32; 30850 this.indexTablesSize = p22.uint32; 30851 this.numberofIndexSubTables = p22.uint32; 30852 this.colorRef = p22.uint32; 30853 this.hori = new SbitLineMetrics(p22); 30854 this.vert = new SbitLineMetrics(p22); 30855 this.startGlyphIndex = p22.uint16; 30856 this.endGlyphIndex = p22.uint16; 30857 this.ppemX = p22.uint8; 30858 this.ppemY = p22.uint8; 30859 this.bitDepth = p22.uint8; 30860 this.flags = p22.int8; 30861 } 30862 }; 30863 var BitmapScale = class { 30864 constructor(p22) { 30865 this.hori = new SbitLineMetrics(p22); 30866 this.vert = new SbitLineMetrics(p22); 30867 this.ppemX = p22.uint8; 30868 this.ppemY = p22.uint8; 30869 this.substitutePpemX = p22.uint8; 30870 this.substitutePpemY = p22.uint8; 30871 } 30872 }; 30873 var SbitLineMetrics = class { 30874 constructor(p22) { 30875 this.ascender = p22.int8; 30876 this.descender = p22.int8; 30877 this.widthMax = p22.uint8; 30878 this.caretSlopeNumerator = p22.int8; 30879 this.caretSlopeDenominator = p22.int8; 30880 this.caretOffset = p22.int8; 30881 this.minOriginSB = p22.int8; 30882 this.minAdvanceSB = p22.int8; 30883 this.maxBeforeBL = p22.int8; 30884 this.minAfterBL = p22.int8; 30885 this.pad1 = p22.int8; 30886 this.pad2 = p22.int8; 30887 } 30888 }; 30889 var EBLC = class extends SimpleTable { 30890 constructor(dict, dataview, name2) { 30891 const { p: p22 } = super(dict, dataview, name2); 30892 this.majorVersion = p22.uint16; 30893 this.minorVersion = p22.uint16; 30894 this.numSizes = p22.uint32; 30895 lazy$1( 30896 this, 30897 `bitMapSizes`, 30898 () => [...new Array(this.numSizes)].map( 30899 (_) => new BitmapSize(p22) 30900 ) 30901 ); 30902 } 30903 }; 30904 var EBLC$1 = Object.freeze({ __proto__: null, EBLC }); 30905 var EBDT = class extends SimpleTable { 30906 constructor(dict, dataview, name2) { 30907 const { p: p22 } = super(dict, dataview, name2); 30908 this.majorVersion = p22.uint16; 30909 this.minorVersion = p22.uint16; 30910 } 30911 }; 30912 var EBDT$1 = Object.freeze({ __proto__: null, EBDT }); 30913 var EBSC = class extends SimpleTable { 30914 constructor(dict, dataview) { 30915 const { p: p22 } = super(dict, dataview); 30916 this.majorVersion = p22.uint16; 30917 this.minorVersion = p22.uint16; 30918 this.numSizes = p22.uint32; 30919 lazy$1( 30920 this, 30921 `bitmapScales`, 30922 () => [...new Array(this.numSizes)].map( 30923 (_) => new BitmapScale(p22) 30924 ) 30925 ); 30926 } 30927 }; 30928 var EBSC$1 = Object.freeze({ __proto__: null, EBSC }); 30929 var CBLC = class extends EBLC { 30930 constructor(dict, dataview) { 30931 super(dict, dataview, `CBLC`); 30932 } 30933 }; 30934 var CBLC$1 = Object.freeze({ __proto__: null, CBLC }); 30935 var CBDT = class extends EBDT { 30936 constructor(dict, dataview) { 30937 super(dict, dataview, `CBDT`); 30938 } 30939 }; 30940 var CBDT$1 = Object.freeze({ __proto__: null, CBDT }); 30941 var sbix = class extends SimpleTable { 30942 constructor(dict, dataview) { 30943 const { p: p22 } = super(dict, dataview); 30944 this.version = p22.uint16; 30945 this.flags = p22.flags(16); 30946 this.numStrikes = p22.uint32; 30947 lazy$1( 30948 this, 30949 `strikeOffsets`, 30950 () => [...new Array(this.numStrikes)].map((_) => p22.Offset32) 30951 ); 30952 } 30953 }; 30954 var sbix$1 = Object.freeze({ __proto__: null, sbix }); 30955 var COLR = class extends SimpleTable { 30956 constructor(dict, dataview) { 30957 const { p: p22 } = super(dict, dataview); 30958 this.version = p22.uint16; 30959 this.numBaseGlyphRecords = p22.uint16; 30960 this.baseGlyphRecordsOffset = p22.Offset32; 30961 this.layerRecordsOffset = p22.Offset32; 30962 this.numLayerRecords = p22.uint16; 30963 } 30964 getBaseGlyphRecord(glyphID) { 30965 let start2 = this.tableStart + this.baseGlyphRecordsOffset; 30966 this.parser.currentPosition = start2; 30967 let first = new BaseGlyphRecord(this.parser); 30968 let firstID = first.gID; 30969 let end = this.tableStart + this.layerRecordsOffset - 6; 30970 this.parser.currentPosition = end; 30971 let last = new BaseGlyphRecord(this.parser); 30972 let lastID = last.gID; 30973 if (firstID === glyphID) return first; 30974 if (lastID === glyphID) return last; 30975 while (true) { 30976 if (start2 === end) break; 30977 let mid = start2 + (end - start2) / 12; 30978 this.parser.currentPosition = mid; 30979 let middle = new BaseGlyphRecord(this.parser); 30980 let midID = middle.gID; 30981 if (midID === glyphID) return middle; 30982 else if (midID > glyphID) { 30983 end = mid; 30984 } else if (midID < glyphID) { 30985 start2 = mid; 30986 } 30987 } 30988 return false; 30989 } 30990 getLayers(glyphID) { 30991 let record = this.getBaseGlyphRecord(glyphID); 30992 this.parser.currentPosition = this.tableStart + this.layerRecordsOffset + 4 * record.firstLayerIndex; 30993 return [...new Array(record.numLayers)].map( 30994 (_) => new LayerRecord(p) 30995 ); 30996 } 30997 }; 30998 var BaseGlyphRecord = class { 30999 constructor(p22) { 31000 this.gID = p22.uint16; 31001 this.firstLayerIndex = p22.uint16; 31002 this.numLayers = p22.uint16; 31003 } 31004 }; 31005 var LayerRecord = class { 31006 constructor(p22) { 31007 this.gID = p22.uint16; 31008 this.paletteIndex = p22.uint16; 31009 } 31010 }; 31011 var COLR$1 = Object.freeze({ __proto__: null, COLR }); 31012 var CPAL = class extends SimpleTable { 31013 constructor(dict, dataview) { 31014 const { p: p22 } = super(dict, dataview); 31015 this.version = p22.uint16; 31016 this.numPaletteEntries = p22.uint16; 31017 const numPalettes = this.numPalettes = p22.uint16; 31018 this.numColorRecords = p22.uint16; 31019 this.offsetFirstColorRecord = p22.Offset32; 31020 this.colorRecordIndices = [...new Array(this.numPalettes)].map( 31021 (_) => p22.uint16 31022 ); 31023 lazy$1(this, `colorRecords`, () => { 31024 p22.currentPosition = this.tableStart + this.offsetFirstColorRecord; 31025 return [...new Array(this.numColorRecords)].map( 31026 (_) => new ColorRecord(p22) 31027 ); 31028 }); 31029 if (this.version === 1) { 31030 this.offsetPaletteTypeArray = p22.Offset32; 31031 this.offsetPaletteLabelArray = p22.Offset32; 31032 this.offsetPaletteEntryLabelArray = p22.Offset32; 31033 lazy$1(this, `paletteTypeArray`, () => { 31034 p22.currentPosition = this.tableStart + this.offsetPaletteTypeArray; 31035 return new PaletteTypeArray(p22, numPalettes); 31036 }); 31037 lazy$1(this, `paletteLabelArray`, () => { 31038 p22.currentPosition = this.tableStart + this.offsetPaletteLabelArray; 31039 return new PaletteLabelsArray(p22, numPalettes); 31040 }); 31041 lazy$1(this, `paletteEntryLabelArray`, () => { 31042 p22.currentPosition = this.tableStart + this.offsetPaletteEntryLabelArray; 31043 return new PaletteEntryLabelArray(p22, numPalettes); 31044 }); 31045 } 31046 } 31047 }; 31048 var ColorRecord = class { 31049 constructor(p22) { 31050 this.blue = p22.uint8; 31051 this.green = p22.uint8; 31052 this.red = p22.uint8; 31053 this.alpha = p22.uint8; 31054 } 31055 }; 31056 var PaletteTypeArray = class { 31057 constructor(p22, numPalettes) { 31058 this.paletteTypes = [...new Array(numPalettes)].map( 31059 (_) => p22.uint32 31060 ); 31061 } 31062 }; 31063 var PaletteLabelsArray = class { 31064 constructor(p22, numPalettes) { 31065 this.paletteLabels = [...new Array(numPalettes)].map( 31066 (_) => p22.uint16 31067 ); 31068 } 31069 }; 31070 var PaletteEntryLabelArray = class { 31071 constructor(p22, numPalettes) { 31072 this.paletteEntryLabels = [...new Array(numPalettes)].map( 31073 (_) => p22.uint16 31074 ); 31075 } 31076 }; 31077 var CPAL$1 = Object.freeze({ __proto__: null, CPAL }); 31078 var DSIG = class extends SimpleTable { 31079 constructor(dict, dataview) { 31080 const { p: p22 } = super(dict, dataview); 31081 this.version = p22.uint32; 31082 this.numSignatures = p22.uint16; 31083 this.flags = p22.uint16; 31084 this.signatureRecords = [...new Array(this.numSignatures)].map( 31085 (_) => new SignatureRecord(p22) 31086 ); 31087 } 31088 getData(signatureID) { 31089 const record = this.signatureRecords[signatureID]; 31090 this.parser.currentPosition = this.tableStart + record.offset; 31091 return new SignatureBlockFormat1(this.parser); 31092 } 31093 }; 31094 var SignatureRecord = class { 31095 constructor(p22) { 31096 this.format = p22.uint32; 31097 this.length = p22.uint32; 31098 this.offset = p22.Offset32; 31099 } 31100 }; 31101 var SignatureBlockFormat1 = class { 31102 constructor(p22) { 31103 p22.uint16; 31104 p22.uint16; 31105 this.signatureLength = p22.uint32; 31106 this.signature = p22.readBytes(this.signatureLength); 31107 } 31108 }; 31109 var DSIG$1 = Object.freeze({ __proto__: null, DSIG }); 31110 var hdmx = class extends SimpleTable { 31111 constructor(dict, dataview, tables) { 31112 const { p: p22 } = super(dict, dataview); 31113 const numGlyphs = tables.hmtx.numGlyphs; 31114 this.version = p22.uint16; 31115 this.numRecords = p22.int16; 31116 this.sizeDeviceRecord = p22.int32; 31117 this.records = [...new Array(numRecords)].map( 31118 (_) => new DeviceRecord(p22, numGlyphs) 31119 ); 31120 } 31121 }; 31122 var DeviceRecord = class { 31123 constructor(p22, numGlyphs) { 31124 this.pixelSize = p22.uint8; 31125 this.maxWidth = p22.uint8; 31126 this.widths = p22.readBytes(numGlyphs); 31127 } 31128 }; 31129 var hdmx$1 = Object.freeze({ __proto__: null, hdmx }); 31130 var kern = class extends SimpleTable { 31131 constructor(dict, dataview) { 31132 const { p: p22 } = super(dict, dataview); 31133 this.version = p22.uint16; 31134 this.nTables = p22.uint16; 31135 lazy$1(this, `tables`, () => { 31136 let offset4 = this.tableStart + 4; 31137 const tables = []; 31138 for (let i2 = 0; i2 < this.nTables; i2++) { 31139 p22.currentPosition = offset4; 31140 let subtable = new KernSubTable(p22); 31141 tables.push(subtable); 31142 offset4 += subtable; 31143 } 31144 return tables; 31145 }); 31146 } 31147 }; 31148 var KernSubTable = class { 31149 constructor(p22) { 31150 this.version = p22.uint16; 31151 this.length = p22.uint16; 31152 this.coverage = p22.flags(8); 31153 this.format = p22.uint8; 31154 if (this.format === 0) { 31155 this.nPairs = p22.uint16; 31156 this.searchRange = p22.uint16; 31157 this.entrySelector = p22.uint16; 31158 this.rangeShift = p22.uint16; 31159 lazy$1( 31160 this, 31161 `pairs`, 31162 () => [...new Array(this.nPairs)].map((_) => new Pair(p22)) 31163 ); 31164 } 31165 if (this.format === 2) { 31166 console.warn( 31167 `Kern subtable format 2 is not supported: this parser currently only parses universal table data.` 31168 ); 31169 } 31170 } 31171 get horizontal() { 31172 return this.coverage[0]; 31173 } 31174 get minimum() { 31175 return this.coverage[1]; 31176 } 31177 get crossstream() { 31178 return this.coverage[2]; 31179 } 31180 get override() { 31181 return this.coverage[3]; 31182 } 31183 }; 31184 var Pair = class { 31185 constructor(p22) { 31186 this.left = p22.uint16; 31187 this.right = p22.uint16; 31188 this.value = p22.fword; 31189 } 31190 }; 31191 var kern$1 = Object.freeze({ __proto__: null, kern }); 31192 var LTSH = class extends SimpleTable { 31193 constructor(dict, dataview) { 31194 const { p: p22 } = super(dict, dataview); 31195 this.version = p22.uint16; 31196 this.numGlyphs = p22.uint16; 31197 this.yPels = p22.readBytes(this.numGlyphs); 31198 } 31199 }; 31200 var LTSH$1 = Object.freeze({ __proto__: null, LTSH }); 31201 var MERG = class extends SimpleTable { 31202 constructor(dict, dataview) { 31203 const { p: p22 } = super(dict, dataview); 31204 this.version = p22.uint16; 31205 this.mergeClassCount = p22.uint16; 31206 this.mergeDataOffset = p22.Offset16; 31207 this.classDefCount = p22.uint16; 31208 this.offsetToClassDefOffsets = p22.Offset16; 31209 lazy$1( 31210 this, 31211 `mergeEntryMatrix`, 31212 () => [...new Array(this.mergeClassCount)].map( 31213 (_) => p22.readBytes(this.mergeClassCount) 31214 ) 31215 ); 31216 console.warn(`Full MERG parsing is currently not supported.`); 31217 console.warn( 31218 `If you need this table parsed, please file an issue, or better yet, a PR.` 31219 ); 31220 } 31221 }; 31222 var MERG$1 = Object.freeze({ __proto__: null, MERG }); 31223 var meta = class extends SimpleTable { 31224 constructor(dict, dataview) { 31225 const { p: p22 } = super(dict, dataview); 31226 this.version = p22.uint32; 31227 this.flags = p22.uint32; 31228 p22.uint32; 31229 this.dataMapsCount = p22.uint32; 31230 this.dataMaps = [...new Array(this.dataMapsCount)].map( 31231 (_) => new DataMap(this.tableStart, p22) 31232 ); 31233 } 31234 }; 31235 var DataMap = class { 31236 constructor(tableStart, p22) { 31237 this.tableStart = tableStart; 31238 this.parser = p22; 31239 this.tag = p22.tag; 31240 this.dataOffset = p22.Offset32; 31241 this.dataLength = p22.uint32; 31242 } 31243 getData() { 31244 this.parser.currentField = this.tableStart + this.dataOffset; 31245 return this.parser.readBytes(this.dataLength); 31246 } 31247 }; 31248 var meta$1 = Object.freeze({ __proto__: null, meta }); 31249 var PCLT = class extends SimpleTable { 31250 constructor(dict, dataview) { 31251 super(dict, dataview); 31252 console.warn( 31253 `This font uses a PCLT table, which is currently not supported by this parser.` 31254 ); 31255 console.warn( 31256 `If you need this table parsed, please file an issue, or better yet, a PR.` 31257 ); 31258 } 31259 }; 31260 var PCLT$1 = Object.freeze({ __proto__: null, PCLT }); 31261 var VDMX = class extends SimpleTable { 31262 constructor(dict, dataview) { 31263 const { p: p22 } = super(dict, dataview); 31264 this.version = p22.uint16; 31265 this.numRecs = p22.uint16; 31266 this.numRatios = p22.uint16; 31267 this.ratRanges = [...new Array(this.numRatios)].map( 31268 (_) => new RatioRange(p22) 31269 ); 31270 this.offsets = [...new Array(this.numRatios)].map( 31271 (_) => p22.Offset16 31272 ); 31273 this.VDMXGroups = [...new Array(this.numRecs)].map( 31274 (_) => new VDMXGroup(p22) 31275 ); 31276 } 31277 }; 31278 var RatioRange = class { 31279 constructor(p22) { 31280 this.bCharSet = p22.uint8; 31281 this.xRatio = p22.uint8; 31282 this.yStartRatio = p22.uint8; 31283 this.yEndRatio = p22.uint8; 31284 } 31285 }; 31286 var VDMXGroup = class { 31287 constructor(p22) { 31288 this.recs = p22.uint16; 31289 this.startsz = p22.uint8; 31290 this.endsz = p22.uint8; 31291 this.records = [...new Array(this.recs)].map( 31292 (_) => new vTable(p22) 31293 ); 31294 } 31295 }; 31296 var vTable = class { 31297 constructor(p22) { 31298 this.yPelHeight = p22.uint16; 31299 this.yMax = p22.int16; 31300 this.yMin = p22.int16; 31301 } 31302 }; 31303 var VDMX$1 = Object.freeze({ __proto__: null, VDMX }); 31304 var vhea = class extends SimpleTable { 31305 constructor(dict, dataview) { 31306 const { p: p22 } = super(dict, dataview); 31307 this.version = p22.fixed; 31308 this.ascent = this.vertTypoAscender = p22.int16; 31309 this.descent = this.vertTypoDescender = p22.int16; 31310 this.lineGap = this.vertTypoLineGap = p22.int16; 31311 this.advanceHeightMax = p22.int16; 31312 this.minTopSideBearing = p22.int16; 31313 this.minBottomSideBearing = p22.int16; 31314 this.yMaxExtent = p22.int16; 31315 this.caretSlopeRise = p22.int16; 31316 this.caretSlopeRun = p22.int16; 31317 this.caretOffset = p22.int16; 31318 this.reserved = p22.int16; 31319 this.reserved = p22.int16; 31320 this.reserved = p22.int16; 31321 this.reserved = p22.int16; 31322 this.metricDataFormat = p22.int16; 31323 this.numOfLongVerMetrics = p22.uint16; 31324 p22.verifyLength(); 31325 } 31326 }; 31327 var vhea$1 = Object.freeze({ __proto__: null, vhea }); 31328 var vmtx = class extends SimpleTable { 31329 constructor(dict, dataview, tables) { 31330 super(dict, dataview); 31331 const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics; 31332 const numGlyphs = tables.maxp.numGlyphs; 31333 const metricsStart = p.currentPosition; 31334 lazy(this, `vMetrics`, () => { 31335 p.currentPosition = metricsStart; 31336 return [...new Array(numOfLongVerMetrics)].map( 31337 (_) => new LongVertMetric(p.uint16, p.int16) 31338 ); 31339 }); 31340 if (numOfLongVerMetrics < numGlyphs) { 31341 const tsbStart = metricsStart + numOfLongVerMetrics * 4; 31342 lazy(this, `topSideBearings`, () => { 31343 p.currentPosition = tsbStart; 31344 return [...new Array(numGlyphs - numOfLongVerMetrics)].map( 31345 (_) => p.int16 31346 ); 31347 }); 31348 } 31349 } 31350 }; 31351 var LongVertMetric = class { 31352 constructor(h2, b2) { 31353 this.advanceHeight = h2; 31354 this.topSideBearing = b2; 31355 } 31356 }; 31357 var vmtx$1 = Object.freeze({ __proto__: null, vmtx }); 31358 31359 // packages/global-styles-ui/build-module/font-library/utils/make-families-from-faces.mjs 31360 var import_components37 = __toESM(require_components(), 1); 31361 var { kebabCase: kebabCase3 } = unlock3(import_components37.privateApis); 31362 31363 // packages/global-styles-ui/build-module/font-library/upload-fonts.mjs 31364 var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1); 31365 31366 // packages/global-styles-ui/build-module/font-library/modal.mjs 31367 var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1); 31368 var { Tabs } = unlock3(import_components39.privateApis); 31369 var DEFAULT_TAB = { 31370 id: "installed-fonts", 31371 title: (0, import_i18n29._x)("Library", "Font library") 31372 }; 31373 var UPLOAD_TAB = { 31374 id: "upload-fonts", 31375 title: (0, import_i18n29._x)("Upload", "noun") 31376 }; 31377 31378 // packages/global-styles-ui/build-module/font-family-item.mjs 31379 var import_i18n30 = __toESM(require_i18n(), 1); 31380 var import_components40 = __toESM(require_components(), 1); 31381 var import_element64 = __toESM(require_element(), 1); 31382 var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1); 31383 31384 // packages/global-styles-ui/build-module/font-families.mjs 31385 var import_jsx_runtime143 = __toESM(require_jsx_runtime(), 1); 31386 31387 // packages/global-styles-ui/build-module/font-sizes/font-sizes-count.mjs 31388 var import_i18n32 = __toESM(require_i18n(), 1); 31389 var import_components42 = __toESM(require_components(), 1); 31390 var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1); 31391 31392 // packages/global-styles-ui/build-module/screen-typography.mjs 31393 var import_jsx_runtime145 = __toESM(require_jsx_runtime(), 1); 31394 31395 // packages/global-styles-ui/build-module/screen-typography-element.mjs 31396 var import_i18n34 = __toESM(require_i18n(), 1); 31397 var import_components44 = __toESM(require_components(), 1); 31398 var import_element67 = __toESM(require_element(), 1); 31399 31400 // packages/global-styles-ui/build-module/typography-panel.mjs 31401 var import_block_editor9 = __toESM(require_block_editor(), 1); 31402 var import_jsx_runtime146 = __toESM(require_jsx_runtime(), 1); 31403 var { useSettingsForBlockElement: useSettingsForBlockElement4, TypographyPanel: StylesTypographyPanel2 } = unlock3(import_block_editor9.privateApis); 31404 31405 // packages/global-styles-ui/build-module/typography-preview.mjs 31406 var import_jsx_runtime147 = __toESM(require_jsx_runtime(), 1); 31407 31408 // packages/global-styles-ui/build-module/screen-typography-element.mjs 31409 var import_jsx_runtime148 = __toESM(require_jsx_runtime(), 1); 31410 var elements = { 31411 text: { 31412 description: (0, import_i18n34.__)("Manage the fonts used on the site."), 31413 title: (0, import_i18n34.__)("Text") 31414 }, 31415 link: { 31416 description: (0, import_i18n34.__)("Manage the fonts and typography used on the links."), 31417 title: (0, import_i18n34.__)("Links") 31418 }, 31419 heading: { 31420 description: (0, import_i18n34.__)("Manage the fonts and typography used on headings."), 31421 title: (0, import_i18n34.__)("Headings") 31422 }, 31423 caption: { 31424 description: (0, import_i18n34.__)("Manage the fonts and typography used on captions."), 31425 title: (0, import_i18n34.__)("Captions") 31426 }, 31427 button: { 31428 description: (0, import_i18n34.__)("Manage the fonts and typography used on buttons."), 31429 title: (0, import_i18n34.__)("Buttons") 31430 } 31431 }; 31432 31433 // packages/global-styles-ui/build-module/screen-colors.mjs 31434 var import_i18n36 = __toESM(require_i18n(), 1); 31435 var import_components47 = __toESM(require_components(), 1); 31436 var import_block_editor10 = __toESM(require_block_editor(), 1); 31437 31438 // packages/global-styles-ui/build-module/palette.mjs 31439 var import_components46 = __toESM(require_components(), 1); 31440 var import_i18n35 = __toESM(require_i18n(), 1); 31441 var import_element68 = __toESM(require_element(), 1); 31442 31443 // packages/global-styles-ui/build-module/color-indicator-wrapper.mjs 31444 var import_components45 = __toESM(require_components(), 1); 31445 var import_jsx_runtime149 = __toESM(require_jsx_runtime(), 1); 31446 31447 // packages/global-styles-ui/build-module/palette.mjs 31448 var import_jsx_runtime150 = __toESM(require_jsx_runtime(), 1); 31449 31450 // packages/global-styles-ui/build-module/screen-colors.mjs 31451 var import_jsx_runtime151 = __toESM(require_jsx_runtime(), 1); 31452 var { useSettingsForBlockElement: useSettingsForBlockElement5, ColorPanel: StylesColorPanel2 } = unlock3( 31453 import_block_editor10.privateApis 31454 ); 31455 31456 // packages/global-styles-ui/build-module/screen-color-palette.mjs 31457 var import_i18n39 = __toESM(require_i18n(), 1); 31458 var import_components52 = __toESM(require_components(), 1); 31459 31460 // packages/global-styles-ui/build-module/color-palette-panel.mjs 31461 var import_compose6 = __toESM(require_compose(), 1); 31462 var import_components50 = __toESM(require_components(), 1); 31463 var import_i18n37 = __toESM(require_i18n(), 1); 31464 31465 // packages/global-styles-ui/build-module/variations/variations-color.mjs 31466 var import_components49 = __toESM(require_components(), 1); 31467 31468 // packages/global-styles-ui/build-module/preview-colors.mjs 31469 var import_components48 = __toESM(require_components(), 1); 31470 31471 // packages/global-styles-ui/build-module/preset-colors.mjs 31472 var import_jsx_runtime152 = __toESM(require_jsx_runtime(), 1); 31473 function PresetColors() { 31474 const { paletteColors } = useStylesPreviewColors(); 31475 return paletteColors.slice(0, 4).map(({ slug, color }, index2) => /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 31476 "div", 31477 { 31478 style: { 31479 flexGrow: 1, 31480 height: "100%", 31481 background: color 31482 } 31483 }, 31484 `$slug}-$index2}` 31485 )); 31486 } 31487 31488 // packages/global-styles-ui/build-module/preview-colors.mjs 31489 var import_jsx_runtime153 = __toESM(require_jsx_runtime(), 1); 31490 var firstFrameVariants2 = { 31491 start: { 31492 scale: 1, 31493 opacity: 1 31494 }, 31495 hover: { 31496 scale: 0, 31497 opacity: 0 31498 } 31499 }; 31500 var StylesPreviewColors = ({ 31501 label, 31502 isFocused, 31503 withHoverView 31504 }) => { 31505 return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)( 31506 preview_wrapper_default, 31507 { 31508 label, 31509 isFocused, 31510 withHoverView, 31511 children: ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime153.jsx)( 31512 import_components48.__unstableMotion.div, 31513 { 31514 variants: firstFrameVariants2, 31515 style: { 31516 height: "100%", 31517 overflow: "hidden" 31518 }, 31519 children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)( 31520 import_components48.__experimentalHStack, 31521 { 31522 spacing: 0, 31523 justify: "center", 31524 style: { 31525 height: "100%", 31526 overflow: "hidden" 31527 }, 31528 children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(PresetColors, {}) 31529 } 31530 ) 31531 }, 31532 key 31533 ) 31534 } 31535 ); 31536 }; 31537 var preview_colors_default = StylesPreviewColors; 31538 31539 // packages/global-styles-ui/build-module/variations/variations-color.mjs 31540 var import_jsx_runtime154 = __toESM(require_jsx_runtime(), 1); 31541 var propertiesToFilter2 = ["color"]; 31542 function ColorVariations({ 31543 title, 31544 gap = 2 31545 }) { 31546 const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter2); 31547 if (colorVariations?.length <= 1) { 31548 return null; 31549 } 31550 return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(import_components49.__experimentalVStack, { spacing: 3, children: [ 31551 title && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Subtitle, { level: 3, children: title }), 31552 /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_components49.__experimentalGrid, { gap, children: colorVariations.map((variation, index2) => /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 31553 Variation, 31554 { 31555 variation, 31556 isPill: true, 31557 properties: propertiesToFilter2, 31558 showTooltip: true, 31559 children: () => /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(preview_colors_default, {}) 31560 }, 31561 index2 31562 )) }) 31563 ] }); 31564 } 31565 31566 // packages/global-styles-ui/build-module/color-palette-panel.mjs 31567 var import_jsx_runtime155 = __toESM(require_jsx_runtime(), 1); 31568 31569 // packages/global-styles-ui/build-module/gradients-palette-panel.mjs 31570 var import_compose7 = __toESM(require_compose(), 1); 31571 var import_components51 = __toESM(require_components(), 1); 31572 var import_i18n38 = __toESM(require_i18n(), 1); 31573 var import_jsx_runtime156 = __toESM(require_jsx_runtime(), 1); 31574 31575 // packages/global-styles-ui/build-module/screen-color-palette.mjs 31576 var import_jsx_runtime157 = __toESM(require_jsx_runtime(), 1); 31577 var { Tabs: Tabs2 } = unlock3(import_components52.privateApis); 31578 31579 // packages/global-styles-ui/build-module/screen-background.mjs 31580 var import_i18n40 = __toESM(require_i18n(), 1); 31581 var import_block_editor12 = __toESM(require_block_editor(), 1); 31582 var import_components53 = __toESM(require_components(), 1); 31583 31584 // packages/global-styles-ui/build-module/background-panel.mjs 31585 var import_block_editor11 = __toESM(require_block_editor(), 1); 31586 var import_jsx_runtime158 = __toESM(require_jsx_runtime(), 1); 31587 var { BackgroundPanel: StylesBackgroundPanel2 } = unlock3( 31588 import_block_editor11.privateApis 31589 ); 31590 31591 // packages/global-styles-ui/build-module/screen-background.mjs 31592 var import_jsx_runtime159 = __toESM(require_jsx_runtime(), 1); 31593 var { useHasBackgroundPanel: useHasBackgroundPanel3 } = unlock3(import_block_editor12.privateApis); 31594 31595 // packages/global-styles-ui/build-module/shadows-panel.mjs 31596 var import_components55 = __toESM(require_components(), 1); 31597 var import_i18n42 = __toESM(require_i18n(), 1); 31598 var import_element69 = __toESM(require_element(), 1); 31599 31600 // packages/global-styles-ui/build-module/confirm-reset-shadow-dialog.mjs 31601 var import_components54 = __toESM(require_components(), 1); 31602 var import_i18n41 = __toESM(require_i18n(), 1); 31603 var import_jsx_runtime160 = __toESM(require_jsx_runtime(), 1); 31604 31605 // packages/global-styles-ui/build-module/shadows-panel.mjs 31606 var import_jsx_runtime161 = __toESM(require_jsx_runtime(), 1); 31607 var { Menu } = unlock3(import_components55.privateApis); 31608 31609 // packages/global-styles-ui/build-module/shadows-edit-panel.mjs 31610 var import_components56 = __toESM(require_components(), 1); 31611 var import_i18n43 = __toESM(require_i18n(), 1); 31612 var import_element70 = __toESM(require_element(), 1); 31613 var import_jsx_runtime162 = __toESM(require_jsx_runtime(), 1); 31614 var { Menu: Menu2 } = unlock3(import_components56.privateApis); 31615 var customShadowMenuItems = [ 31616 { 31617 label: (0, import_i18n43.__)("Rename"), 31618 action: "rename" 31619 }, 31620 { 31621 label: (0, import_i18n43.__)("Delete"), 31622 action: "delete" 31623 } 31624 ]; 31625 var presetShadowMenuItems = [ 31626 { 31627 label: (0, import_i18n43.__)("Reset"), 31628 action: "reset" 31629 } 31630 ]; 31631 31632 // packages/global-styles-ui/build-module/screen-shadows.mjs 31633 var import_jsx_runtime163 = __toESM(require_jsx_runtime(), 1); 31634 31635 // packages/global-styles-ui/build-module/screen-layout.mjs 31636 var import_i18n44 = __toESM(require_i18n(), 1); 31637 var import_block_editor14 = __toESM(require_block_editor(), 1); 31638 31639 // packages/global-styles-ui/build-module/dimensions-panel.mjs 31640 var import_block_editor13 = __toESM(require_block_editor(), 1); 31641 var import_element71 = __toESM(require_element(), 1); 31642 var import_jsx_runtime164 = __toESM(require_jsx_runtime(), 1); 31643 var { useSettingsForBlockElement: useSettingsForBlockElement6, DimensionsPanel: StylesDimensionsPanel2 } = unlock3(import_block_editor13.privateApis); 31644 31645 // packages/global-styles-ui/build-module/screen-layout.mjs 31646 var import_jsx_runtime165 = __toESM(require_jsx_runtime(), 1); 31647 var { useHasDimensionsPanel: useHasDimensionsPanel4, useSettingsForBlockElement: useSettingsForBlockElement7 } = unlock3( 31648 import_block_editor14.privateApis 31649 ); 31650 31651 // packages/global-styles-ui/build-module/screen-style-variations.mjs 31652 var import_components59 = __toESM(require_components(), 1); 31653 var import_i18n47 = __toESM(require_i18n(), 1); 31654 31655 // packages/global-styles-ui/build-module/style-variations-content.mjs 31656 var import_i18n46 = __toESM(require_i18n(), 1); 31657 var import_components58 = __toESM(require_components(), 1); 31658 31659 // packages/global-styles-ui/build-module/style-variations-container.mjs 31660 var import_core_data22 = __toESM(require_core_data(), 1); 31661 var import_data26 = __toESM(require_data(), 1); 31662 var import_element72 = __toESM(require_element(), 1); 31663 var import_components57 = __toESM(require_components(), 1); 31664 var import_i18n45 = __toESM(require_i18n(), 1); 31665 var import_jsx_runtime166 = __toESM(require_jsx_runtime(), 1); 31666 function StyleVariationsContainer({ 31667 gap = 2 31668 }) { 31669 const { user } = (0, import_element72.useContext)(GlobalStylesContext); 31670 const userStyles = user?.styles; 31671 const variations = (0, import_data26.useSelect)((select4) => { 31672 const result = select4( 31673 import_core_data22.store 31674 ).__experimentalGetCurrentThemeGlobalStylesVariations(); 31675 return Array.isArray(result) ? result : void 0; 31676 }, []); 31677 const fullStyleVariations = variations?.filter( 31678 (variation) => { 31679 return !isVariationWithProperties(variation, ["color"]) && !isVariationWithProperties(variation, [ 31680 "typography", 31681 "spacing" 31682 ]); 31683 } 31684 ); 31685 const themeVariations = (0, import_element72.useMemo)(() => { 31686 const withEmptyVariation = [ 31687 { 31688 title: (0, import_i18n45.__)("Default"), 31689 settings: {}, 31690 styles: {} 31691 }, 31692 ...fullStyleVariations ?? [] 31693 ]; 31694 return [ 31695 ...withEmptyVariation.map((variation) => { 31696 const blockStyles = variation?.styles?.blocks ? { ...variation.styles.blocks } : {}; 31697 if (userStyles?.blocks) { 31698 Object.keys(userStyles.blocks).forEach((blockName) => { 31699 if (userStyles.blocks?.[blockName]?.css) { 31700 const variationBlockStyles = blockStyles[blockName] || {}; 31701 const customCSS = { 31702 css: `$blockStyles[blockName]?.css || ""} $userStyles.blocks?.[blockName]?.css?.trim() || ""}` 31703 }; 31704 blockStyles[blockName] = { 31705 ...variationBlockStyles, 31706 ...customCSS 31707 }; 31708 } 31709 }); 31710 } 31711 const css = userStyles?.css || variation.styles?.css ? { 31712 css: `$variation.styles?.css || ""} $userStyles?.css || ""}` 31713 } : {}; 31714 const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {}; 31715 const styles = { 31716 ...variation.styles, 31717 ...css, 31718 ...blocks 31719 }; 31720 return { 31721 ...variation, 31722 settings: variation.settings ?? {}, 31723 styles 31724 }; 31725 }) 31726 ]; 31727 }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]); 31728 if (!fullStyleVariations || fullStyleVariations.length < 1) { 31729 return null; 31730 } 31731 return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)( 31732 import_components57.__experimentalGrid, 31733 { 31734 columns: 2, 31735 className: "global-styles-ui-style-variations-container", 31736 gap, 31737 children: themeVariations.map( 31738 (variation, index2) => /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Variation, { variation, children: (isFocused) => /* @__PURE__ */ (0, import_jsx_runtime166.jsx)( 31739 preview_styles_default, 31740 { 31741 label: variation?.title, 31742 withHoverView: true, 31743 isFocused, 31744 variation 31745 } 31746 ) }, index2) 31747 ) 31748 } 31749 ); 31750 } 31751 var style_variations_container_default = StyleVariationsContainer; 31752 31753 // packages/global-styles-ui/build-module/style-variations-content.mjs 31754 var import_jsx_runtime167 = __toESM(require_jsx_runtime(), 1); 31755 31756 // packages/global-styles-ui/build-module/screen-style-variations.mjs 31757 var import_jsx_runtime168 = __toESM(require_jsx_runtime(), 1); 31758 31759 // packages/global-styles-ui/build-module/screen-css.mjs 31760 var import_i18n48 = __toESM(require_i18n(), 1); 31761 var import_components60 = __toESM(require_components(), 1); 31762 var import_block_editor15 = __toESM(require_block_editor(), 1); 31763 var import_jsx_runtime169 = __toESM(require_jsx_runtime(), 1); 31764 var { AdvancedPanel: StylesAdvancedPanel2 } = unlock3(import_block_editor15.privateApis); 31765 31766 // packages/global-styles-ui/build-module/screen-revisions/index.mjs 31767 var import_i18n51 = __toESM(require_i18n(), 1); 31768 var import_components63 = __toESM(require_components(), 1); 31769 var import_element74 = __toESM(require_element(), 1); 31770 31771 // packages/global-styles-ui/build-module/screen-revisions/use-global-styles-revisions.mjs 31772 var import_data27 = __toESM(require_data(), 1); 31773 var import_core_data23 = __toESM(require_core_data(), 1); 31774 var import_element73 = __toESM(require_element(), 1); 31775 var SITE_EDITOR_AUTHORS_QUERY = { 31776 per_page: -1, 31777 _fields: "id,name,avatar_urls", 31778 context: "view", 31779 capabilities: ["edit_theme_options"] 31780 }; 31781 var DEFAULT_QUERY = { per_page: 100, page: 1 }; 31782 var EMPTY_ARRAY4 = []; 31783 function useGlobalStylesRevisions({ 31784 query 31785 } = {}) { 31786 const { user: userConfig } = (0, import_element73.useContext)(GlobalStylesContext); 31787 const _query = (0, import_element73.useMemo)( 31788 () => ({ ...DEFAULT_QUERY, ...query }), 31789 [query] 31790 ); 31791 const { 31792 authors, 31793 currentUser, 31794 isDirty, 31795 revisions, 31796 isLoadingGlobalStylesRevisions, 31797 revisionsCount 31798 } = (0, import_data27.useSelect)( 31799 (select4) => { 31800 const { 31801 __experimentalGetDirtyEntityRecords, 31802 getCurrentUser, 31803 getUsers, 31804 getRevisions, 31805 __experimentalGetCurrentGlobalStylesId, 31806 getEntityRecord, 31807 isResolving 31808 } = select4(import_core_data23.store); 31809 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords() || []; 31810 const _currentUser = getCurrentUser(); 31811 const _isDirty = dirtyEntityRecords.length > 0; 31812 const globalStylesId = __experimentalGetCurrentGlobalStylesId(); 31813 const globalStyles = globalStylesId ? getEntityRecord( 31814 "root", 31815 "globalStyles", 31816 globalStylesId 31817 ) : void 0; 31818 const _revisionsCount = ( 31819 // @ts-expect-error - _links is not typed in GlobalStylesRevision 31820 globalStyles?._links?.["version-history"]?.[0]?.count ?? 0 31821 ); 31822 const globalStylesRevisions = globalStylesId ? getRevisions( 31823 "root", 31824 "globalStyles", 31825 globalStylesId, 31826 _query 31827 ) || EMPTY_ARRAY4 : EMPTY_ARRAY4; 31828 const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || EMPTY_ARRAY4; 31829 const _isResolving = globalStylesId ? isResolving("getRevisions", [ 31830 "root", 31831 "globalStyles", 31832 globalStylesId, 31833 _query 31834 ]) : false; 31835 return { 31836 authors: _authors, 31837 currentUser: _currentUser, 31838 isDirty: _isDirty, 31839 revisions: globalStylesRevisions, 31840 isLoadingGlobalStylesRevisions: _isResolving, 31841 revisionsCount: _revisionsCount 31842 }; 31843 }, 31844 [_query] 31845 ); 31846 return (0, import_element73.useMemo)(() => { 31847 if (!authors.length || isLoadingGlobalStylesRevisions) { 31848 return { 31849 revisions: EMPTY_ARRAY4, 31850 hasUnsavedChanges: isDirty, 31851 isLoading: true, 31852 revisionsCount 31853 }; 31854 } 31855 const _modifiedRevisions = revisions.map((revision) => { 31856 return { 31857 ...revision, 31858 author: authors.find( 31859 (author) => author.id === revision.author 31860 ) 31861 }; 31862 }); 31863 const fetchedRevisionsCount = revisions.length; 31864 if (fetchedRevisionsCount) { 31865 if (_modifiedRevisions[0].id !== "unsaved" && _query.page === 1) { 31866 _modifiedRevisions[0].isLatest = true; 31867 } 31868 if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) { 31869 const unsavedRevision = { 31870 id: "unsaved", 31871 styles: userConfig?.styles, 31872 settings: userConfig?.settings, 31873 _links: userConfig?._links, 31874 author: { 31875 name: currentUser?.name || "", 31876 // @ts-expect-error - avatar_urls is not typed in User 31877 avatar_urls: currentUser?.avatar_urls || {} 31878 }, 31879 modified: /* @__PURE__ */ new Date() 31880 }; 31881 _modifiedRevisions.unshift(unsavedRevision); 31882 } 31883 if (_query.per_page && _query.page === Math.ceil(revisionsCount / _query.per_page)) { 31884 _modifiedRevisions.push({ 31885 id: "parent", 31886 styles: {}, 31887 settings: {} 31888 }); 31889 } 31890 } 31891 return { 31892 revisions: _modifiedRevisions, 31893 hasUnsavedChanges: isDirty, 31894 isLoading: false, 31895 revisionsCount 31896 }; 31897 }, [ 31898 isDirty, 31899 revisions, 31900 currentUser, 31901 authors, 31902 userConfig, 31903 isLoadingGlobalStylesRevisions, 31904 revisionsCount, 31905 _query.page, 31906 _query.per_page 31907 ]); 31908 } 31909 31910 // packages/global-styles-ui/build-module/screen-revisions/revisions-buttons.mjs 31911 var import_i18n49 = __toESM(require_i18n(), 1); 31912 var import_components61 = __toESM(require_components(), 1); 31913 var import_date = __toESM(require_date(), 1); 31914 var import_core_data24 = __toESM(require_core_data(), 1); 31915 var import_data28 = __toESM(require_data(), 1); 31916 var import_keycodes4 = __toESM(require_keycodes(), 1); 31917 var import_jsx_runtime170 = __toESM(require_jsx_runtime(), 1); 31918 var DAY_IN_MILLISECONDS = 60 * 60 * 1e3 * 24; 31919 31920 // packages/global-styles-ui/build-module/pagination/index.mjs 31921 var import_components62 = __toESM(require_components(), 1); 31922 var import_i18n50 = __toESM(require_i18n(), 1); 31923 var import_jsx_runtime171 = __toESM(require_jsx_runtime(), 1); 31924 31925 // packages/global-styles-ui/build-module/screen-revisions/index.mjs 31926 var import_jsx_runtime172 = __toESM(require_jsx_runtime(), 1); 31927 31928 // packages/global-styles-ui/build-module/font-sizes/font-sizes.mjs 31929 var import_i18n53 = __toESM(require_i18n(), 1); 31930 var import_components65 = __toESM(require_components(), 1); 31931 var import_element75 = __toESM(require_element(), 1); 31932 31933 // packages/global-styles-ui/build-module/font-sizes/confirm-reset-font-sizes-dialog.mjs 31934 var import_components64 = __toESM(require_components(), 1); 31935 var import_i18n52 = __toESM(require_i18n(), 1); 31936 var import_jsx_runtime173 = __toESM(require_jsx_runtime(), 1); 31937 31938 // packages/global-styles-ui/build-module/font-sizes/font-sizes.mjs 31939 var import_jsx_runtime174 = __toESM(require_jsx_runtime(), 1); 31940 var { Menu: Menu3 } = unlock3(import_components65.privateApis); 31941 31942 // packages/global-styles-ui/build-module/font-sizes/font-size.mjs 31943 var import_i18n57 = __toESM(require_i18n(), 1); 31944 var import_components69 = __toESM(require_components(), 1); 31945 var import_element77 = __toESM(require_element(), 1); 31946 31947 // packages/global-styles-ui/build-module/font-sizes/font-size-preview.mjs 31948 var import_block_editor16 = __toESM(require_block_editor(), 1); 31949 var import_i18n54 = __toESM(require_i18n(), 1); 31950 var import_jsx_runtime175 = __toESM(require_jsx_runtime(), 1); 31951 31952 // packages/global-styles-ui/build-module/font-sizes/confirm-delete-font-size-dialog.mjs 31953 var import_components66 = __toESM(require_components(), 1); 31954 var import_i18n55 = __toESM(require_i18n(), 1); 31955 var import_jsx_runtime176 = __toESM(require_jsx_runtime(), 1); 31956 31957 // packages/global-styles-ui/build-module/font-sizes/rename-font-size-dialog.mjs 31958 var import_components67 = __toESM(require_components(), 1); 31959 var import_i18n56 = __toESM(require_i18n(), 1); 31960 var import_element76 = __toESM(require_element(), 1); 31961 var import_jsx_runtime177 = __toESM(require_jsx_runtime(), 1); 31962 31963 // packages/global-styles-ui/build-module/size-control/index.mjs 31964 var import_components68 = __toESM(require_components(), 1); 31965 var import_jsx_runtime178 = __toESM(require_jsx_runtime(), 1); 31966 31967 // packages/global-styles-ui/build-module/font-sizes/font-size.mjs 31968 var import_jsx_runtime179 = __toESM(require_jsx_runtime(), 1); 31969 var { Menu: Menu4 } = unlock3(import_components69.privateApis); 31970 31971 // packages/global-styles-ui/build-module/global-styles-ui.mjs 31972 var import_jsx_runtime180 = __toESM(require_jsx_runtime(), 1); 31973 31974 // packages/global-styles-ui/build-module/with-global-styles-provider.mjs 31975 var import_jsx_runtime181 = __toESM(require_jsx_runtime(), 1); 31976 function withGlobalStylesProvider(Component) { 31977 return function WrappedComponent({ 31978 value, 31979 baseValue, 31980 onChange, 31981 ...props 31982 }) { 31983 return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)( 31984 GlobalStylesProvider, 31985 { 31986 value, 31987 baseValue, 31988 onChange, 31989 children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(Component, { ...props }) 31990 } 31991 ); 31992 }; 31993 } 31994 31995 // packages/global-styles-ui/build-module/style-variations.mjs 31996 var StyleVariations = withGlobalStylesProvider(style_variations_container_default); 31997 31998 // packages/global-styles-ui/build-module/color-variations.mjs 31999 var ColorVariations2 = withGlobalStylesProvider(ColorVariations); 32000 32001 // packages/global-styles-ui/build-module/typography-variations.mjs 32002 var TypographyVariations2 = withGlobalStylesProvider(TypographyVariations); 32003 32004 // packages/global-styles-ui/build-module/font-library/font-library.mjs 32005 var import_jsx_runtime182 = __toESM(require_jsx_runtime(), 1); 32006 32007 // packages/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.mjs 32008 var import_i18n58 = __toESM(require_i18n(), 1); 32009 var import_url6 = __toESM(require_url(), 1); 32010 var import_components71 = __toESM(require_components(), 1); 32011 var import_jsx_runtime183 = __toESM(require_jsx_runtime(), 1); 32012 function SidebarNavigationScreenDetailsFooter({ 32013 record, 32014 revisionsCount, 32015 ...otherProps 32016 }) { 32017 const hrefProps = {}; 32018 const lastRevisionId = record?._links?.["predecessor-version"]?.[0]?.id ?? null; 32019 revisionsCount = revisionsCount || record?._links?.["version-history"]?.[0]?.count || 0; 32020 if (lastRevisionId && revisionsCount > 1) { 32021 hrefProps.href = (0, import_url6.addQueryArgs)("revision.php", { 32022 revision: record?._links["predecessor-version"][0].id 32023 }); 32024 hrefProps.as = "a"; 32025 } 32026 return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)( 32027 import_components71.__experimentalItemGroup, 32028 { 32029 size: "large", 32030 className: "edit-site-sidebar-navigation-screen-details-footer", 32031 children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)( 32032 SidebarNavigationItem, 32033 { 32034 icon: backup_default, 32035 ...hrefProps, 32036 ...otherProps, 32037 children: (0, import_i18n58.sprintf)( 32038 /* translators: %d: Number of Styles revisions. */ 32039 (0, import_i18n58._n)("%d Revision", "%d Revisions", revisionsCount), 32040 revisionsCount 32041 ) 32042 } 32043 ) 32044 } 32045 ); 32046 } 32047 32048 // packages/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.mjs 32049 var import_jsx_runtime184 = __toESM(require_jsx_runtime(), 1); 32050 var { useLocation: useLocation10, useHistory: useHistory7 } = unlock(import_router11.privateApis); 32051 function SidebarNavigationItemGlobalStyles(props) { 32052 const { name: name2 } = useLocation10(); 32053 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 32054 SidebarNavigationItem, 32055 { 32056 ...props, 32057 "aria-current": name2 === "styles" 32058 } 32059 ); 32060 } 32061 function SidebarNavigationScreenGlobalStyles() { 32062 const history = useHistory7(); 32063 const { path } = useLocation10(); 32064 const { 32065 revisions, 32066 isLoading: isLoadingRevisions, 32067 revisionsCount 32068 } = useGlobalStylesRevisions(); 32069 const { openGeneralSidebar: openGeneralSidebar2 } = (0, import_data30.useDispatch)(store); 32070 const { setStylesPath } = unlock((0, import_data30.useDispatch)(import_editor8.store)); 32071 const { set: setPreference } = (0, import_data30.useDispatch)(import_preferences5.store); 32072 const openGlobalStyles = (0, import_element79.useCallback)(async () => { 32073 history.navigate((0, import_url7.addQueryArgs)(path, { canvas: "edit" }), { 32074 transition: "canvas-mode-edit-transition" 32075 }); 32076 return Promise.all([ 32077 setPreference("core", "distractionFree", false), 32078 openGeneralSidebar2("edit-site/global-styles") 32079 ]); 32080 }, [path, history, openGeneralSidebar2, setPreference]); 32081 const openRevisions = (0, import_element79.useCallback)(async () => { 32082 await openGlobalStyles(); 32083 setStylesPath("/revisions"); 32084 }, [openGlobalStyles, setStylesPath]); 32085 const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions; 32086 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(import_jsx_runtime184.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 32087 SidebarNavigationScreen, 32088 { 32089 title: (0, import_i18n59.__)("Design"), 32090 isRoot: true, 32091 description: (0, import_i18n59.__)( 32092 "Customize the appearance of your website using the block editor." 32093 ), 32094 content: /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(MainSidebarNavigationContent, { activeItem: "styles-navigation-item" }), 32095 footer: shouldShowGlobalStylesFooter && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)( 32096 SidebarNavigationScreenDetailsFooter, 32097 { 32098 record: revisions?.[0], 32099 revisionsCount, 32100 onClick: openRevisions 32101 } 32102 ) 32103 } 32104 ) }); 32105 } 32106 32107 // packages/edit-site/build-module/components/sidebar-navigation-screen-identity/index.mjs 32108 var import_i18n60 = __toESM(require_i18n(), 1); 32109 var import_router12 = __toESM(require_router(), 1); 32110 var import_jsx_runtime185 = __toESM(require_jsx_runtime(), 1); 32111 var { useLocation: useLocation11 } = unlock(import_router12.privateApis); 32112 function SidebarNavigationItemIdentity(props) { 32113 const { name: name2 } = useLocation11(); 32114 return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)( 32115 SidebarNavigationItem, 32116 { 32117 ...props, 32118 "aria-current": name2 === "identity" 32119 } 32120 ); 32121 } 32122 function SidebarNavigationScreenIdentity() { 32123 return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)( 32124 SidebarNavigationScreen, 32125 { 32126 isRoot: true, 32127 title: (0, import_i18n60.__)("Design"), 32128 description: (0, import_i18n60.__)( 32129 "Customize the appearance of your website using the block editor." 32130 ), 32131 content: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(MainSidebarNavigationContent, {}) 32132 } 32133 ); 32134 } 32135 32136 // packages/edit-site/build-module/components/sidebar-navigation-screen-main/index.mjs 32137 var import_jsx_runtime186 = __toESM(require_jsx_runtime(), 1); 32138 function MainSidebarNavigationContent({ isBlockBasedTheme = true }) { 32139 return /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(import_components72.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-main", children: [ 32140 isBlockBasedTheme && /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(import_jsx_runtime186.Fragment, { children: [ 32141 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32142 SidebarNavigationItemGlobalStyles, 32143 { 32144 to: "/styles", 32145 uid: "global-styles-navigation-item", 32146 icon: styles_default, 32147 children: (0, import_i18n61.__)("Styles") 32148 } 32149 ), 32150 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32151 SidebarNavigationItem, 32152 { 32153 uid: "navigation-navigation-item", 32154 to: "/navigation", 32155 withChevron: true, 32156 icon: navigation_default, 32157 children: (0, import_i18n61.__)("Navigation") 32158 } 32159 ), 32160 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32161 SidebarNavigationItemIdentity, 32162 { 32163 to: "/identity", 32164 uid: "identity-navigation-item", 32165 icon: site_logo_default, 32166 children: (0, import_i18n61._x)("Identity", "site identity") 32167 } 32168 ), 32169 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32170 SidebarNavigationItem, 32171 { 32172 uid: "page-navigation-item", 32173 to: "/page", 32174 withChevron: true, 32175 icon: page_default, 32176 children: (0, import_i18n61.__)("Pages") 32177 } 32178 ), 32179 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32180 SidebarNavigationItem, 32181 { 32182 uid: "template-navigation-item", 32183 to: "/template", 32184 withChevron: true, 32185 icon: layout_default, 32186 children: (0, import_i18n61.__)("Templates") 32187 } 32188 ) 32189 ] }), 32190 !isBlockBasedTheme && /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32191 SidebarNavigationItem, 32192 { 32193 uid: "stylebook-navigation-item", 32194 to: "/stylebook", 32195 withChevron: true, 32196 icon: styles_default, 32197 children: (0, import_i18n61.__)("Styles") 32198 } 32199 ), 32200 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32201 SidebarNavigationItem, 32202 { 32203 uid: "patterns-navigation-item", 32204 to: "/pattern", 32205 withChevron: true, 32206 icon: symbol_default, 32207 children: (0, import_i18n61.__)("Patterns") 32208 } 32209 ) 32210 ] }); 32211 } 32212 function SidebarNavigationScreenMain({ customDescription }) { 32213 const isBlockBasedTheme = (0, import_data31.useSelect)( 32214 (select4) => select4(import_core_data25.store).getCurrentTheme()?.is_block_theme, 32215 [] 32216 ); 32217 let description; 32218 if (customDescription) { 32219 description = customDescription; 32220 } else if (isBlockBasedTheme) { 32221 description = (0, import_i18n61.__)( 32222 "Customize the appearance of your website using the block editor." 32223 ); 32224 } else { 32225 description = (0, import_i18n61.__)( 32226 "Explore block styles and patterns to refine your site." 32227 ); 32228 } 32229 return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32230 SidebarNavigationScreen, 32231 { 32232 isRoot: true, 32233 title: (0, import_i18n61.__)("Design"), 32234 description, 32235 content: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 32236 MainSidebarNavigationContent, 32237 { 32238 isBlockBasedTheme 32239 } 32240 ) 32241 } 32242 ); 32243 } 32244 32245 // packages/edit-site/build-module/components/sidebar-navigation-screen-unsupported/index.mjs 32246 var import_i18n62 = __toESM(require_i18n(), 1); 32247 var import_components73 = __toESM(require_components(), 1); 32248 var import_jsx_runtime187 = __toESM(require_jsx_runtime(), 1); 32249 function SidebarNavigationScreenUnsupported() { 32250 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_components73.__experimentalSpacer, { padding: 3, children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_components73.Notice, { status: "warning", isDismissible: false, children: (0, import_i18n62.__)( 32251 "The theme you are currently using does not support this screen." 32252 ) }) }); 32253 } 32254 32255 // packages/edit-site/build-module/components/editor/index.mjs 32256 var import_data48 = __toESM(require_data(), 1); 32257 var import_components81 = __toESM(require_components(), 1); 32258 var import_compose10 = __toESM(require_compose(), 1); 32259 var import_editor20 = __toESM(require_editor(), 1); 32260 var import_i18n72 = __toESM(require_i18n(), 1); 32261 var import_core_data34 = __toESM(require_core_data(), 1); 32262 var import_block_library = __toESM(require_block_library(), 1); 32263 var import_element88 = __toESM(require_element(), 1); 32264 var import_notices3 = __toESM(require_notices(), 1); 32265 var import_router19 = __toESM(require_router(), 1); 32266 var import_html_entities4 = __toESM(require_html_entities(), 1); 32267 var import_block_editor19 = __toESM(require_block_editor(), 1); 32268 var import_url11 = __toESM(require_url(), 1); 32269 32270 // packages/edit-site/build-module/components/welcome-guide/editor.mjs 32271 var import_data32 = __toESM(require_data(), 1); 32272 var import_components74 = __toESM(require_components(), 1); 32273 var import_i18n63 = __toESM(require_i18n(), 1); 32274 var import_element80 = __toESM(require_element(), 1); 32275 var import_preferences6 = __toESM(require_preferences(), 1); 32276 var import_core_data26 = __toESM(require_core_data(), 1); 32277 32278 // packages/edit-site/build-module/components/welcome-guide/image.mjs 32279 var import_jsx_runtime188 = __toESM(require_jsx_runtime(), 1); 32280 function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { 32281 return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("picture", { className: "edit-site-welcome-guide__image", children: [ 32282 /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 32283 "source", 32284 { 32285 srcSet: nonAnimatedSrc, 32286 media: "(prefers-reduced-motion: reduce)" 32287 } 32288 ), 32289 /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) 32290 ] }); 32291 } 32292 32293 // packages/edit-site/build-module/components/welcome-guide/editor.mjs 32294 var import_jsx_runtime189 = __toESM(require_jsx_runtime(), 1); 32295 function WelcomeGuideEditor() { 32296 const { toggle } = (0, import_data32.useDispatch)(import_preferences6.store); 32297 const { isActive, isBlockBasedTheme } = (0, import_data32.useSelect)((select4) => { 32298 return { 32299 isActive: !!select4(import_preferences6.store).get( 32300 "core/edit-site", 32301 "welcomeGuide" 32302 ), 32303 isBlockBasedTheme: select4(import_core_data26.store).getCurrentTheme()?.is_block_theme 32304 }; 32305 }, []); 32306 if (!isActive || !isBlockBasedTheme) { 32307 return null; 32308 } 32309 return /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32310 import_components74.Guide, 32311 { 32312 className: "edit-site-welcome-guide guide-editor", 32313 contentLabel: (0, import_i18n63.__)("Welcome to the site editor"), 32314 finishButtonText: (0, import_i18n63.__)("Get started"), 32315 onFinish: () => toggle("core/edit-site", "welcomeGuide"), 32316 pages: [ 32317 { 32318 image: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32319 WelcomeGuideImage, 32320 { 32321 nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1", 32322 animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1" 32323 } 32324 ), 32325 content: /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(import_jsx_runtime189.Fragment, { children: [ 32326 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0, import_i18n63.__)("Edit your site") }), 32327 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0, import_i18n63.__)( 32328 "Design everything on your site \u2014 from the header right down to the footer \u2014 using blocks." 32329 ) }), 32330 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0, import_element80.createInterpolateElement)( 32331 (0, import_i18n63.__)( 32332 "Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors." 32333 ), 32334 { 32335 StylesIconImage: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 32336 "img", 32337 { 32338 alt: (0, import_i18n63.__)("styles"), 32339 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A" 32340 } 32341 ) 32342 } 32343 ) }) 32344 ] }) 32345 } 32346 ] 32347 } 32348 ); 32349 } 32350 32351 // packages/edit-site/build-module/components/welcome-guide/page.mjs 32352 var import_data33 = __toESM(require_data(), 1); 32353 var import_components75 = __toESM(require_components(), 1); 32354 var import_i18n64 = __toESM(require_i18n(), 1); 32355 var import_preferences7 = __toESM(require_preferences(), 1); 32356 var import_jsx_runtime190 = __toESM(require_jsx_runtime(), 1); 32357 function WelcomeGuidePage() { 32358 const { toggle } = (0, import_data33.useDispatch)(import_preferences7.store); 32359 const isVisible2 = (0, import_data33.useSelect)((select4) => { 32360 const isPageActive = !!select4(import_preferences7.store).get( 32361 "core/edit-site", 32362 "welcomeGuidePage" 32363 ); 32364 const isEditorActive = !!select4(import_preferences7.store).get( 32365 "core/edit-site", 32366 "welcomeGuide" 32367 ); 32368 return isPageActive && !isEditorActive; 32369 }, []); 32370 if (!isVisible2) { 32371 return null; 32372 } 32373 const heading = (0, import_i18n64.__)("Editing a page"); 32374 return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 32375 import_components75.Guide, 32376 { 32377 className: "edit-site-welcome-guide guide-page", 32378 contentLabel: heading, 32379 finishButtonText: (0, import_i18n64.__)("Continue"), 32380 onFinish: () => toggle("core/edit-site", "welcomeGuidePage"), 32381 pages: [ 32382 { 32383 image: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 32384 "video", 32385 { 32386 className: "edit-site-welcome-guide__video", 32387 autoPlay: true, 32388 loop: true, 32389 muted: true, 32390 width: "312", 32391 height: "240", 32392 children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 32393 "source", 32394 { 32395 src: "https://s.w.org/images/block-editor/editing-your-page.mp4", 32396 type: "video/mp4" 32397 } 32398 ) 32399 } 32400 ), 32401 content: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [ 32402 /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }), 32403 /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0, import_i18n64.__)( 32404 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 32405 "It\u2019s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar." 32406 ) }) 32407 ] }) 32408 } 32409 ] 32410 } 32411 ); 32412 } 32413 32414 // packages/edit-site/build-module/components/welcome-guide/template.mjs 32415 var import_data34 = __toESM(require_data(), 1); 32416 var import_components76 = __toESM(require_components(), 1); 32417 var import_i18n65 = __toESM(require_i18n(), 1); 32418 var import_preferences8 = __toESM(require_preferences(), 1); 32419 var import_editor9 = __toESM(require_editor(), 1); 32420 var import_jsx_runtime191 = __toESM(require_jsx_runtime(), 1); 32421 function WelcomeGuideTemplate() { 32422 const { toggle } = (0, import_data34.useDispatch)(import_preferences8.store); 32423 const { isActive, hasPreviousEntity } = (0, import_data34.useSelect)((select4) => { 32424 const { getEditorSettings } = select4(import_editor9.store); 32425 const { get } = select4(import_preferences8.store); 32426 return { 32427 isActive: get("core/edit-site", "welcomeGuideTemplate"), 32428 hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord 32429 }; 32430 }, []); 32431 const isVisible2 = isActive && hasPreviousEntity; 32432 if (!isVisible2) { 32433 return null; 32434 } 32435 const heading = (0, import_i18n65.__)("Editing a template"); 32436 return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 32437 import_components76.Guide, 32438 { 32439 className: "edit-site-welcome-guide guide-template", 32440 contentLabel: heading, 32441 finishButtonText: (0, import_i18n65.__)("Continue"), 32442 onFinish: () => toggle("core/edit-site", "welcomeGuideTemplate"), 32443 pages: [ 32444 { 32445 image: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 32446 "video", 32447 { 32448 className: "edit-site-welcome-guide__video", 32449 autoPlay: true, 32450 loop: true, 32451 muted: true, 32452 width: "312", 32453 height: "240", 32454 children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 32455 "source", 32456 { 32457 src: "https://s.w.org/images/block-editor/editing-your-template.mp4", 32458 type: "video/mp4" 32459 } 32460 ) 32461 } 32462 ), 32463 content: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [ 32464 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }), 32465 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0, import_i18n65.__)( 32466 "Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the \u2018Back\u2019 button in the toolbar." 32467 ) }) 32468 ] }) 32469 } 32470 ] 32471 } 32472 ); 32473 } 32474 32475 // packages/edit-site/build-module/components/welcome-guide/index.mjs 32476 var import_jsx_runtime192 = __toESM(require_jsx_runtime(), 1); 32477 function WelcomeGuide({ postType: postType2 }) { 32478 return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(import_jsx_runtime192.Fragment, { children: [ 32479 /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(WelcomeGuideEditor, {}), 32480 postType2 === "page" && /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(WelcomeGuidePage, {}), 32481 postType2 === "wp_template" && /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(WelcomeGuideTemplate, {}) 32482 ] }); 32483 } 32484 32485 // packages/edit-site/build-module/components/canvas-loader/index.mjs 32486 var import_components77 = __toESM(require_components(), 1); 32487 var import_core_data27 = __toESM(require_core_data(), 1); 32488 var import_data35 = __toESM(require_data(), 1); 32489 var import_editor11 = __toESM(require_editor(), 1); 32490 var import_jsx_runtime193 = __toESM(require_jsx_runtime(), 1); 32491 var { Theme } = unlock(import_components77.privateApis); 32492 var { useStyle: useStyle3 } = unlock(import_editor11.privateApis); 32493 function CanvasLoader({ id }) { 32494 const textColor = useStyle3("color.text"); 32495 const backgroundColor = useStyle3("color.background"); 32496 const { elapsed, total } = (0, import_data35.useSelect)((select4) => { 32497 const selectorsByStatus = select4(import_core_data27.store).countSelectorsByStatus(); 32498 const resolving = selectorsByStatus.resolving ?? 0; 32499 const finished = selectorsByStatus.finished ?? 0; 32500 return { 32501 elapsed: finished, 32502 total: finished + resolving 32503 }; 32504 }, []); 32505 return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "edit-site-canvas-loader", children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(Theme, { accent: textColor, background: backgroundColor, children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(import_components77.ProgressBar, { id, max: total, value: elapsed }) }) }); 32506 } 32507 32508 // packages/edit-site/build-module/components/block-editor/use-site-editor-settings.mjs 32509 var import_data38 = __toESM(require_data(), 1); 32510 var import_element83 = __toESM(require_element(), 1); 32511 var import_router15 = __toESM(require_router(), 1); 32512 var import_compose9 = __toESM(require_compose(), 1); 32513 var import_editor14 = __toESM(require_editor(), 1); 32514 32515 // packages/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.mjs 32516 var import_data37 = __toESM(require_data(), 1); 32517 var import_router14 = __toESM(require_router(), 1); 32518 var import_element82 = __toESM(require_element(), 1); 32519 var import_url8 = __toESM(require_url(), 1); 32520 var import_core_data28 = __toESM(require_core_data(), 1); 32521 var import_editor13 = __toESM(require_editor(), 1); 32522 32523 // packages/edit-site/build-module/components/block-editor/use-viewport-sync.mjs 32524 var import_element81 = __toESM(require_element(), 1); 32525 var import_data36 = __toESM(require_data(), 1); 32526 var import_router13 = __toESM(require_router(), 1); 32527 var import_editor12 = __toESM(require_editor(), 1); 32528 var { useLocation: useLocation12 } = unlock(import_router13.privateApis); 32529 var DEFAULT_DEVICE_TYPE = "Desktop"; 32530 var VALID_DEVICE_TYPES = ["desktop", "tablet", "mobile"]; 32531 var capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1); 32532 function useViewportSync() { 32533 const { query } = useLocation12(); 32534 const { setDeviceType } = (0, import_data36.useDispatch)(import_editor12.store); 32535 (0, import_element81.useEffect)(() => { 32536 const viewport = query?.viewport?.toLowerCase(); 32537 const isValid2 = VALID_DEVICE_TYPES.includes(viewport); 32538 setDeviceType(isValid2 ? capitalize(viewport) : DEFAULT_DEVICE_TYPE); 32539 }, [query?.viewport, setDeviceType]); 32540 } 32541 function ViewportSync() { 32542 useViewportSync(); 32543 return null; 32544 } 32545 32546 // packages/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.mjs 32547 var { useHistory: useHistory8, useLocation: useLocation13 } = unlock(import_router14.privateApis); 32548 var VALID_VIEWPORTS = ["desktop", "tablet", "mobile"]; 32549 function useNavigateToEntityRecord() { 32550 const history = useHistory8(); 32551 const location = useLocation13(); 32552 const { query, path } = location; 32553 const registry = (0, import_data37.useRegistry)(); 32554 const currentDeviceType = (0, import_data37.useSelect)( 32555 (select4) => select4(import_editor13.store).getDeviceType(), 32556 [] 32557 ); 32558 const onNavigateToEntityRecord = (0, import_element82.useCallback)( 32559 (params) => { 32560 const currentPostType = registry.select(import_editor13.store).getCurrentPostType(); 32561 const currentPostId = registry.select(import_editor13.store).getCurrentPostId(); 32562 const entityEdits = registry.select(import_core_data28.store).getEntityRecordEdits( 32563 "postType", 32564 currentPostType, 32565 currentPostId 32566 ); 32567 const externalClientId = entityEdits?.selection?.selectionStart?.clientId; 32568 const urlUpdates = { ...query }; 32569 if (externalClientId) { 32570 urlUpdates.selectedBlock = externalClientId; 32571 } 32572 const requestedViewport = typeof params.viewport === "string" ? params.viewport.toLowerCase() : void 0; 32573 const isValidRequestedViewport = VALID_VIEWPORTS.includes(requestedViewport); 32574 if (isValidRequestedViewport) { 32575 const currentViewportLower = (currentDeviceType || DEFAULT_DEVICE_TYPE).toLowerCase(); 32576 if (currentViewportLower === DEFAULT_DEVICE_TYPE.toLowerCase()) { 32577 delete urlUpdates.viewport; 32578 } else { 32579 urlUpdates.viewport = currentViewportLower; 32580 } 32581 } 32582 const hasUpdatesToSave = externalClientId || isValidRequestedViewport; 32583 if (hasUpdatesToSave) { 32584 history.navigate((0, import_url8.addQueryArgs)(path, urlUpdates), { 32585 replace: true 32586 }); 32587 } 32588 const queryArgs = { 32589 canvas: "edit", 32590 focusMode: true 32591 }; 32592 if (isValidRequestedViewport) { 32593 queryArgs.viewport = requestedViewport; 32594 } 32595 const url = (0, import_url8.addQueryArgs)( 32596 `/$params.postType}/$params.postId}`, 32597 queryArgs 32598 ); 32599 history.navigate(url); 32600 }, 32601 [history, path, query, registry, currentDeviceType] 32602 ); 32603 return onNavigateToEntityRecord; 32604 } 32605 32606 // packages/edit-site/build-module/components/block-editor/use-site-editor-settings.mjs 32607 var { useLocation: useLocation14, useHistory: useHistory9 } = unlock(import_router15.privateApis); 32608 var { useGlobalStyles: useGlobalStyles2 } = unlock(import_editor14.privateApis); 32609 function useNavigateToPreviousEntityRecord() { 32610 const location = useLocation14(); 32611 const previousCanvas = (0, import_compose9.usePrevious)(location.query.canvas); 32612 const history = useHistory9(); 32613 const goBack = (0, import_element83.useMemo)(() => { 32614 const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType); 32615 const didComeFromEditorCanvas = previousCanvas === "edit"; 32616 const showBackButton = isFocusMode && didComeFromEditorCanvas; 32617 return showBackButton ? () => history.back() : void 0; 32618 }, [location, history, previousCanvas]); 32619 return goBack; 32620 } 32621 function useSpecificEditorSettings() { 32622 const { query } = useLocation14(); 32623 const { canvas = "view" } = query; 32624 const onNavigateToEntityRecord = useNavigateToEntityRecord(); 32625 const { merged: mergedConfig } = useGlobalStyles2(); 32626 const { settings: settings2, currentPostIsTrashed } = (0, import_data38.useSelect)((select4) => { 32627 const { getSettings: getSettings7 } = select4(store); 32628 const { getCurrentPostAttribute } = select4(import_editor14.store); 32629 return { 32630 settings: getSettings7(), 32631 currentPostIsTrashed: getCurrentPostAttribute("status") === "trash" 32632 }; 32633 }, []); 32634 const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord(); 32635 const [globalStyles, globalSettings] = (0, import_element83.useMemo)(() => { 32636 return generateGlobalStyles(mergedConfig, [], { 32637 disableRootPadding: false 32638 }); 32639 }, [mergedConfig]); 32640 const defaultEditorSettings = (0, import_element83.useMemo)(() => { 32641 const nonGlobalStyles = (settings2?.styles ?? []).filter( 32642 (style) => !style.isGlobalStyles 32643 ); 32644 return { 32645 ...settings2, 32646 styles: [ 32647 ...nonGlobalStyles, 32648 ...globalStyles, 32649 { 32650 // Forming a "block formatting context" to prevent margin collapsing. 32651 // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context 32652 css: canvas === "view" ? `body{min-height: 100vh; $currentPostIsTrashed ? "" : "cursor: pointer;"}}` : void 0 32653 } 32654 ], 32655 __experimentalFeatures: globalSettings, 32656 richEditingEnabled: true, 32657 supportsTemplateMode: true, 32658 focusMode: canvas !== "view", 32659 onNavigateToEntityRecord, 32660 onNavigateToPreviousEntityRecord, 32661 isPreviewMode: canvas === "view" 32662 }; 32663 }, [ 32664 settings2, 32665 globalStyles, 32666 globalSettings, 32667 canvas, 32668 currentPostIsTrashed, 32669 onNavigateToEntityRecord, 32670 onNavigateToPreviousEntityRecord 32671 ]); 32672 return defaultEditorSettings; 32673 } 32674 32675 // packages/edit-site/build-module/components/plugin-template-setting-panel/index.mjs 32676 var import_editor15 = __toESM(require_editor(), 1); 32677 var import_data39 = __toESM(require_data(), 1); 32678 var import_components78 = __toESM(require_components(), 1); 32679 var import_deprecated3 = __toESM(require_deprecated(), 1); 32680 var import_jsx_runtime194 = __toESM(require_jsx_runtime(), 1); 32681 var { Fill, Slot } = (0, import_components78.createSlotFill)("PluginTemplateSettingPanel"); 32682 var PluginTemplateSettingPanel = ({ children }) => { 32683 (0, import_deprecated3.default)("wp.editSite.PluginTemplateSettingPanel", { 32684 since: "6.6", 32685 version: "6.8", 32686 alternative: "wp.editor.PluginDocumentSettingPanel" 32687 }); 32688 const isCurrentEntityTemplate = (0, import_data39.useSelect)( 32689 (select4) => select4(import_editor15.store).getCurrentPostType() === "wp_template", 32690 [] 32691 ); 32692 if (!isCurrentEntityTemplate) { 32693 return null; 32694 } 32695 return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(Fill, { children }); 32696 }; 32697 PluginTemplateSettingPanel.Slot = Slot; 32698 var plugin_template_setting_panel_default = PluginTemplateSettingPanel; 32699 32700 // packages/edit-site/build-module/components/more-menu/index.mjs 32701 var import_editor16 = __toESM(require_editor(), 1); 32702 32703 // packages/edit-site/build-module/components/more-menu/site-export.mjs 32704 var import_i18n66 = __toESM(require_i18n(), 1); 32705 var import_components79 = __toESM(require_components(), 1); 32706 var import_api_fetch3 = __toESM(require_api_fetch(), 1); 32707 var import_data40 = __toESM(require_data(), 1); 32708 var import_blob = __toESM(require_blob(), 1); 32709 var import_core_data29 = __toESM(require_core_data(), 1); 32710 var import_notices2 = __toESM(require_notices(), 1); 32711 var import_jsx_runtime195 = __toESM(require_jsx_runtime(), 1); 32712 function SiteExport() { 32713 const canExport = (0, import_data40.useSelect)((select4) => { 32714 const targetHints = select4(import_core_data29.store).getCurrentTheme()?._links?.["wp:export-theme"]?.[0]?.targetHints ?? {}; 32715 return !!targetHints.allow?.includes("GET"); 32716 }, []); 32717 const { createErrorNotice } = (0, import_data40.useDispatch)(import_notices2.store); 32718 if (!canExport) { 32719 return null; 32720 } 32721 async function handleExport() { 32722 try { 32723 const response = await (0, import_api_fetch3.default)({ 32724 path: "/wp-block-editor/v1/export", 32725 parse: false, 32726 headers: { 32727 Accept: "application/zip" 32728 } 32729 }); 32730 const blob = await response.blob(); 32731 const contentDisposition = response.headers.get( 32732 "content-disposition" 32733 ); 32734 const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/); 32735 const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : "edit-site-export"; 32736 (0, import_blob.downloadBlob)(fileName + ".zip", blob, "application/zip"); 32737 } catch (errorResponse) { 32738 let error2 = {}; 32739 try { 32740 error2 = await errorResponse.json(); 32741 } catch { 32742 } 32743 const errorMessage = error2.message && error2.code !== "unknown_error" ? error2.message : (0, import_i18n66.__)("An error occurred while creating the site export."); 32744 createErrorNotice(errorMessage, { type: "snackbar" }); 32745 } 32746 } 32747 return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 32748 import_components79.MenuItem, 32749 { 32750 role: "menuitem", 32751 icon: download_default, 32752 onClick: handleExport, 32753 info: (0, import_i18n66.__)( 32754 "Download your theme with updated templates and styles." 32755 ), 32756 children: (0, import_i18n66._x)("Export", "site exporter menu item") 32757 } 32758 ); 32759 } 32760 32761 // packages/edit-site/build-module/components/more-menu/welcome-guide-menu-item.mjs 32762 var import_i18n67 = __toESM(require_i18n(), 1); 32763 var import_data41 = __toESM(require_data(), 1); 32764 var import_components80 = __toESM(require_components(), 1); 32765 var import_preferences9 = __toESM(require_preferences(), 1); 32766 var import_jsx_runtime196 = __toESM(require_jsx_runtime(), 1); 32767 function WelcomeGuideMenuItem() { 32768 const { toggle } = (0, import_data41.useDispatch)(import_preferences9.store); 32769 return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_components80.MenuItem, { onClick: () => toggle("core/edit-site", "welcomeGuide"), children: (0, import_i18n67.__)("Welcome Guide") }); 32770 } 32771 32772 // packages/edit-site/build-module/components/more-menu/index.mjs 32773 var import_jsx_runtime197 = __toESM(require_jsx_runtime(), 1); 32774 var { ToolsMoreMenuGroup, PreferencesModal } = unlock(import_editor16.privateApis); 32775 function MoreMenu() { 32776 return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(import_jsx_runtime197.Fragment, { children: [ 32777 /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(ToolsMoreMenuGroup, { children: [ 32778 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(SiteExport, {}), 32779 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(WelcomeGuideMenuItem, {}) 32780 ] }), 32781 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(PreferencesModal, {}) 32782 ] }); 32783 } 32784 32785 // packages/edit-site/build-module/components/block-editor/use-editor-iframe-props.mjs 32786 var import_data42 = __toESM(require_data(), 1); 32787 var import_keycodes5 = __toESM(require_keycodes(), 1); 32788 var import_element84 = __toESM(require_element(), 1); 32789 var import_i18n68 = __toESM(require_i18n(), 1); 32790 var import_editor17 = __toESM(require_editor(), 1); 32791 var import_router16 = __toESM(require_router(), 1); 32792 var import_url9 = __toESM(require_url(), 1); 32793 var { useLocation: useLocation15, useHistory: useHistory10 } = unlock(import_router16.privateApis); 32794 function useEditorIframeProps() { 32795 const { query, path } = useLocation15(); 32796 const history = useHistory10(); 32797 const { canvas = "view" } = query; 32798 const currentPostIsTrashed = (0, import_data42.useSelect)((select4) => { 32799 return select4(import_editor17.store).getCurrentPostAttribute("status") === "trash"; 32800 }, []); 32801 const [isFocused, setIsFocused] = (0, import_element84.useState)(false); 32802 (0, import_element84.useEffect)(() => { 32803 if (canvas === "edit") { 32804 setIsFocused(false); 32805 } 32806 }, [canvas]); 32807 const viewModeIframeProps = { 32808 "aria-label": (0, import_i18n68.__)("Edit"), 32809 "aria-disabled": currentPostIsTrashed, 32810 title: null, 32811 role: "button", 32812 tabIndex: 0, 32813 onFocus: () => setIsFocused(true), 32814 onBlur: () => setIsFocused(false), 32815 onKeyDown: (event) => { 32816 const { keyCode } = event; 32817 if ((keyCode === import_keycodes5.ENTER || keyCode === import_keycodes5.SPACE) && !currentPostIsTrashed) { 32818 event.preventDefault(); 32819 history.navigate((0, import_url9.addQueryArgs)(path, { canvas: "edit" }), { 32820 transition: "canvas-mode-edit-transition" 32821 }); 32822 } 32823 }, 32824 onClick: () => history.navigate((0, import_url9.addQueryArgs)(path, { canvas: "edit" }), { 32825 transition: "canvas-mode-edit-transition" 32826 }), 32827 onClickCapture: (event) => { 32828 if (currentPostIsTrashed) { 32829 event.preventDefault(); 32830 event.stopPropagation(); 32831 } 32832 }, 32833 readonly: true 32834 }; 32835 return { 32836 className: clsx_default("edit-site-visual-editor__editor-canvas", { 32837 "is-focused": isFocused && canvas === "view" 32838 }), 32839 ...canvas === "view" ? viewModeIframeProps : {} 32840 }; 32841 } 32842 32843 // packages/edit-site/build-module/components/editor/use-editor-title.mjs 32844 var import_i18n70 = __toESM(require_i18n(), 1); 32845 var import_data44 = __toESM(require_data(), 1); 32846 var import_core_data31 = __toESM(require_core_data(), 1); 32847 var import_html_entities3 = __toESM(require_html_entities(), 1); 32848 var import_editor18 = __toESM(require_editor(), 1); 32849 32850 // packages/edit-site/build-module/components/routes/use-title.mjs 32851 var import_element85 = __toESM(require_element(), 1); 32852 var import_data43 = __toESM(require_data(), 1); 32853 var import_core_data30 = __toESM(require_core_data(), 1); 32854 var import_i18n69 = __toESM(require_i18n(), 1); 32855 var import_a11y3 = __toESM(require_a11y(), 1); 32856 var import_html_entities2 = __toESM(require_html_entities(), 1); 32857 var import_router17 = __toESM(require_router(), 1); 32858 var { useLocation: useLocation16 } = unlock(import_router17.privateApis); 32859 function useTitle(title) { 32860 const location = useLocation16(); 32861 const siteTitle = (0, import_data43.useSelect)( 32862 (select4) => select4(import_core_data30.store).getEntityRecord("root", "site")?.title, 32863 [] 32864 ); 32865 const isInitialLocationRef = (0, import_element85.useRef)(true); 32866 (0, import_element85.useEffect)(() => { 32867 isInitialLocationRef.current = false; 32868 }, [location]); 32869 (0, import_element85.useEffect)(() => { 32870 if (isInitialLocationRef.current) { 32871 return; 32872 } 32873 if (title && siteTitle) { 32874 const formattedTitle = (0, import_i18n69.sprintf)( 32875 /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */ 32876 (0, import_i18n69.__)("%1$s \u2039 %2$s \u2039 Editor \u2014 WordPress"), 32877 (0, import_html_entities2.decodeEntities)(title), 32878 (0, import_html_entities2.decodeEntities)(siteTitle) 32879 ); 32880 document.title = formattedTitle; 32881 (0, import_a11y3.speak)(title, "assertive"); 32882 } 32883 }, [title, siteTitle, location]); 32884 } 32885 32886 // packages/edit-site/build-module/components/editor/use-editor-title.mjs 32887 var { getTemplateInfo } = unlock(import_editor18.privateApis); 32888 function useEditorTitle(postType2, postId) { 32889 const { title, isLoaded } = (0, import_data44.useSelect)( 32890 (select4) => { 32891 const { 32892 getEditedEntityRecord, 32893 getCurrentTheme, 32894 hasFinishedResolution 32895 } = select4(import_core_data31.store); 32896 if (!postId) { 32897 return { isLoaded: false }; 32898 } 32899 const _record = getEditedEntityRecord( 32900 "postType", 32901 postType2, 32902 postId 32903 ); 32904 const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {}; 32905 const templateInfo = getTemplateInfo({ 32906 template: _record, 32907 templateTypes 32908 }); 32909 const _isLoaded = hasFinishedResolution("getEditedEntityRecord", [ 32910 "postType", 32911 postType2, 32912 postId 32913 ]); 32914 return { 32915 title: templateInfo.title, 32916 isLoaded: _isLoaded 32917 }; 32918 }, 32919 [postType2, postId] 32920 ); 32921 let editorTitle; 32922 if (isLoaded) { 32923 editorTitle = (0, import_i18n70.sprintf)( 32924 // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part). 32925 (0, import_i18n70._x)("%1$s \u2039 %2$s", "breadcrumb trail"), 32926 (0, import_html_entities3.decodeEntities)(title), 32927 POST_TYPE_LABELS[postType2] ?? POST_TYPE_LABELS[TEMPLATE_POST_TYPE] 32928 ); 32929 } 32930 useTitle(isLoaded && editorTitle); 32931 } 32932 var use_editor_title_default = useEditorTitle; 32933 32934 // packages/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.mjs 32935 var import_data45 = __toESM(require_data(), 1); 32936 var import_block_editor18 = __toESM(require_block_editor(), 1); 32937 var import_editor19 = __toESM(require_editor(), 1); 32938 var import_element86 = __toESM(require_element(), 1); 32939 var import_preferences10 = __toESM(require_preferences(), 1); 32940 function useAdaptEditorToCanvas(canvas) { 32941 const { clearSelectedBlock } = (0, import_data45.useDispatch)(import_block_editor18.store); 32942 const { 32943 editPost, 32944 setDeviceType, 32945 closePublishSidebar, 32946 setIsListViewOpened: setIsListViewOpened2, 32947 setIsInserterOpened: setIsInserterOpened2 32948 } = (0, import_data45.useDispatch)(import_editor19.store); 32949 const { get: getPreference } = (0, import_data45.useSelect)(import_preferences10.store); 32950 const { getCurrentPost } = (0, import_data45.useSelect)(import_editor19.store); 32951 const registry = (0, import_data45.useRegistry)(); 32952 (0, import_element86.useLayoutEffect)(() => { 32953 const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches; 32954 registry.batch(() => { 32955 clearSelectedBlock(); 32956 if (getCurrentPost()?.type) { 32957 editPost({ selection: void 0 }, { undoIgnore: true }); 32958 } 32959 setDeviceType(DEFAULT_DEVICE_TYPE); 32960 closePublishSidebar(); 32961 setIsInserterOpened2(false); 32962 if (isMediumOrBigger && canvas === "edit" && getPreference("core", "showListViewByDefault") && !getPreference("core", "distractionFree")) { 32963 setIsListViewOpened2(true); 32964 } else { 32965 setIsListViewOpened2(false); 32966 } 32967 }); 32968 }, [ 32969 canvas, 32970 registry, 32971 clearSelectedBlock, 32972 editPost, 32973 setDeviceType, 32974 closePublishSidebar, 32975 setIsInserterOpened2, 32976 setIsListViewOpened2, 32977 getPreference, 32978 getCurrentPost 32979 ]); 32980 } 32981 32982 // packages/edit-site/build-module/components/editor/use-resolve-edited-entity.mjs 32983 var import_element87 = __toESM(require_element(), 1); 32984 var import_data46 = __toESM(require_data(), 1); 32985 var import_core_data32 = __toESM(require_core_data(), 1); 32986 var import_router18 = __toESM(require_router(), 1); 32987 var { useLocation: useLocation17 } = unlock(import_router18.privateApis); 32988 var postTypesWithoutParentTemplate = [ 32989 ATTACHMENT_POST_TYPE, 32990 TEMPLATE_POST_TYPE, 32991 TEMPLATE_PART_POST_TYPE, 32992 NAVIGATION_POST_TYPE, 32993 PATTERN_TYPES.user 32994 ]; 32995 var authorizedPostTypes = ["page", "post"]; 32996 function getPostType(name2) { 32997 let postType2; 32998 if (name2 === "navigation-item") { 32999 postType2 = NAVIGATION_POST_TYPE; 33000 } else if (name2 === "pattern-item") { 33001 postType2 = PATTERN_TYPES.user; 33002 } else if (name2 === "template-part-item") { 33003 postType2 = TEMPLATE_PART_POST_TYPE; 33004 } else if (name2 === "templates") { 33005 postType2 = TEMPLATE_POST_TYPE; 33006 } else if (name2 === "template-item") { 33007 postType2 = TEMPLATE_POST_TYPE; 33008 } else if (name2 === "page-item" || name2 === "pages") { 33009 postType2 = "page"; 33010 } else if (name2 === "post-item" || name2 === "posts") { 33011 postType2 = "post"; 33012 } 33013 return postType2; 33014 } 33015 function useResolveEditedEntity() { 33016 const { editEntityRecord } = (0, import_data46.useDispatch)(import_core_data32.store); 33017 const { hasEntityRecord } = (0, import_data46.useSelect)(import_core_data32.store); 33018 const { name: name2, params = {}, query } = useLocation17(); 33019 const { postId = query?.postId } = params; 33020 const postType2 = getPostType(name2, postId) ?? query?.postType; 33021 const { selectedBlock } = query; 33022 const appliedSelectionRef = (0, import_element87.useRef)(null); 33023 const homePage = (0, import_data46.useSelect)((select4) => { 33024 const { getHomePage } = unlock(select4(import_core_data32.store)); 33025 return getHomePage(); 33026 }, []); 33027 const resolvedTemplateId = (0, import_data46.useSelect)( 33028 (select4) => { 33029 if (postTypesWithoutParentTemplate.includes(postType2) && postId) { 33030 return; 33031 } 33032 if (postId && postId.includes(",")) { 33033 return; 33034 } 33035 const { getTemplateId } = unlock(select4(import_core_data32.store)); 33036 if (postType2 && postId && authorizedPostTypes.includes(postType2)) { 33037 return getTemplateId(postType2, postId); 33038 } 33039 if (homePage?.postType === "page") { 33040 return getTemplateId("page", homePage?.postId); 33041 } 33042 if (homePage?.postType === "wp_template") { 33043 return homePage?.postId; 33044 } 33045 }, 33046 [homePage, postId, postType2] 33047 ); 33048 const context = (0, import_element87.useMemo)(() => { 33049 if (postTypesWithoutParentTemplate.includes(postType2) && postId) { 33050 return {}; 33051 } 33052 if (postType2 && postId && authorizedPostTypes.includes(postType2)) { 33053 return { postType: postType2, postId }; 33054 } 33055 if (homePage?.postType === "page") { 33056 return { postType: "page", postId: homePage?.postId }; 33057 } 33058 return {}; 33059 }, [homePage, postType2, postId]); 33060 let entity; 33061 if (postTypesWithoutParentTemplate.includes(postType2) && postId) { 33062 entity = { isReady: true, postType: postType2, postId, context }; 33063 } else if (!!homePage) { 33064 entity = { 33065 isReady: resolvedTemplateId !== void 0, 33066 postType: TEMPLATE_POST_TYPE, 33067 postId: resolvedTemplateId, 33068 context 33069 }; 33070 } else { 33071 entity = { isReady: false }; 33072 } 33073 if (selectedBlock && entity.isReady && appliedSelectionRef.current !== selectedBlock) { 33074 const selectionPostType = entity.context?.postId ? entity.context.postType : entity.postType; 33075 const selectionPostId = entity.context?.postId ? entity.context.postId : entity.postId; 33076 if (hasEntityRecord("postType", selectionPostType, selectionPostId)) { 33077 editEntityRecord( 33078 "postType", 33079 selectionPostType, 33080 selectionPostId, 33081 { 33082 selection: { 33083 selectionStart: { clientId: selectedBlock }, 33084 selectionEnd: { clientId: selectedBlock } 33085 } 33086 }, 33087 { undoIgnore: true } 33088 ); 33089 appliedSelectionRef.current = selectedBlock; 33090 } 33091 } 33092 return entity; 33093 } 33094 function useSyncDeprecatedEntityIntoState({ 33095 postType: postType2, 33096 postId, 33097 context, 33098 isReady 33099 }) { 33100 const { setEditedEntity: setEditedEntity2 } = (0, import_data46.useDispatch)(store); 33101 (0, import_element87.useEffect)(() => { 33102 if (isReady) { 33103 setEditedEntity2(postType2, String(postId), context); 33104 } 33105 }, [isReady, postType2, postId, context, setEditedEntity2]); 33106 } 33107 33108 // packages/edit-site/build-module/components/editor/site-preview.mjs 33109 var import_i18n71 = __toESM(require_i18n(), 1); 33110 var import_data47 = __toESM(require_data(), 1); 33111 var import_core_data33 = __toESM(require_core_data(), 1); 33112 var import_dom23 = __toESM(require_dom(), 1); 33113 var import_url10 = __toESM(require_url(), 1); 33114 var import_jsx_runtime198 = __toESM(require_jsx_runtime(), 1); 33115 function SitePreview() { 33116 const siteUrl = (0, import_data47.useSelect)((select4) => { 33117 const { getEntityRecord } = select4(import_core_data33.store); 33118 const siteData = getEntityRecord("root", "__unstableBase"); 33119 return siteData?.home; 33120 }, []); 33121 return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 33122 "iframe", 33123 { 33124 src: (0, import_url10.addQueryArgs)(siteUrl, { 33125 // Parameter for hiding the admin bar. 33126 wp_site_preview: 1 33127 }), 33128 title: (0, import_i18n71.__)("Site Preview"), 33129 style: { 33130 display: "block", 33131 width: "100%", 33132 height: "100%", 33133 backgroundColor: "#fff" 33134 }, 33135 onLoad: (event) => { 33136 const document2 = event.target.contentDocument; 33137 const focusableElements = import_dom23.focus.focusable.find(document2); 33138 focusableElements.forEach((element) => { 33139 element.style.pointerEvents = "none"; 33140 element.tabIndex = -1; 33141 element.setAttribute("aria-hidden", "true"); 33142 }); 33143 } 33144 } 33145 ); 33146 } 33147 33148 // packages/edit-site/build-module/components/editor/index.mjs 33149 var import_jsx_runtime199 = __toESM(require_jsx_runtime(), 1); 33150 var { Editor, BackButton } = unlock(import_editor20.privateApis); 33151 var { useHistory: useHistory11, useLocation: useLocation18 } = unlock(import_router19.privateApis); 33152 var { BlockKeyboardShortcuts } = unlock(import_block_library.privateApis); 33153 var toggleHomeIconVariants = { 33154 edit: { 33155 opacity: 0, 33156 scale: 0.2 33157 }, 33158 hover: { 33159 opacity: 1, 33160 scale: 1, 33161 clipPath: "inset( 22% round 2px )" 33162 } 33163 }; 33164 var siteIconVariants = { 33165 edit: { 33166 clipPath: "inset(0% round 0px)" 33167 }, 33168 hover: { 33169 clipPath: "inset( 22% round 2px )" 33170 }, 33171 tap: { 33172 clipPath: "inset(0% round 0px)" 33173 } 33174 }; 33175 function getListPathForPostType(postType2) { 33176 switch (postType2) { 33177 case "navigation": 33178 return "/navigation"; 33179 case "wp_block": 33180 return "/pattern?postType=wp_block"; 33181 case "wp_template_part": 33182 return "/pattern?postType=wp_template_part"; 33183 case "wp_template": 33184 return "/template"; 33185 case "page": 33186 return "/page"; 33187 case "post": 33188 return "/"; 33189 } 33190 throw "Unknown post type"; 33191 } 33192 function getNavigationPath(location, postType2) { 33193 const { path, name: name2 } = location; 33194 if ([ 33195 "pattern-item", 33196 "template-part-item", 33197 "page-item", 33198 "template-item", 33199 "static-template-item", 33200 "post-item" 33201 ].includes(name2)) { 33202 return getListPathForPostType(postType2); 33203 } 33204 return (0, import_url11.addQueryArgs)(path, { canvas: void 0 }); 33205 } 33206 function EditSiteEditor({ isHomeRoute = false }) { 33207 const disableMotion = (0, import_compose10.useReducedMotion)(); 33208 const location = useLocation18(); 33209 const history = useHistory11(); 33210 const { canvas = "view" } = location.query; 33211 const isLoading = useIsSiteEditorLoading(); 33212 useAdaptEditorToCanvas(canvas); 33213 const entity = useResolveEditedEntity(); 33214 useSyncDeprecatedEntityIntoState(entity); 33215 const { postType: postType2, postId, context } = entity; 33216 const { isBlockBasedTheme, hasSiteIcon } = (0, import_data48.useSelect)((select4) => { 33217 const { getCurrentTheme, getEntityRecord } = select4(import_core_data34.store); 33218 const siteData = getEntityRecord("root", "__unstableBase", void 0); 33219 return { 33220 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 33221 hasSiteIcon: !!siteData?.site_icon_url 33222 }; 33223 }, []); 33224 const postWithTemplate = !!context?.postId; 33225 use_editor_title_default( 33226 postWithTemplate ? context.postType : postType2, 33227 postWithTemplate ? context.postId : postId 33228 ); 33229 const _isPreviewingTheme = isPreviewingTheme(); 33230 const iframeProps = useEditorIframeProps(); 33231 const isEditMode = canvas === "edit"; 33232 const loadingProgressId = (0, import_compose10.useInstanceId)( 33233 CanvasLoader, 33234 "edit-site-editor__loading-progress" 33235 ); 33236 const editorSettings = useSpecificEditorSettings(); 33237 const { resetZoomLevel } = unlock((0, import_data48.useDispatch)(import_block_editor19.store)); 33238 const { setCurrentRevisionId } = unlock((0, import_data48.useDispatch)(import_editor20.store)); 33239 const { createSuccessNotice } = (0, import_data48.useDispatch)(import_notices3.store); 33240 const onActionPerformed = (0, import_element88.useCallback)( 33241 (actionId, items) => { 33242 switch (actionId) { 33243 case "move-to-trash": 33244 case "delete-post": 33245 { 33246 history.navigate( 33247 getListPathForPostType( 33248 postWithTemplate ? context.postType : postType2 33249 ) 33250 ); 33251 } 33252 break; 33253 case "duplicate-post": 33254 { 33255 const newItem = items[0]; 33256 const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered; 33257 createSuccessNotice( 33258 (0, import_i18n72.sprintf)( 33259 // translators: %s: Title of the created post or template, e.g: "Hello world". 33260 (0, import_i18n72.__)('"%s" successfully created.'), 33261 (0, import_html_entities4.decodeEntities)(_title) || (0, import_i18n72.__)("(no title)") 33262 ), 33263 { 33264 type: "snackbar", 33265 id: "duplicate-post-action", 33266 actions: [ 33267 { 33268 label: (0, import_i18n72.__)("Edit"), 33269 onClick: () => { 33270 history.navigate( 33271 `/$newItem.type}/$newItem.id}?canvas=edit` 33272 ); 33273 } 33274 } 33275 ] 33276 } 33277 ); 33278 } 33279 break; 33280 } 33281 }, 33282 [ 33283 postType2, 33284 context?.postType, 33285 postWithTemplate, 33286 history, 33287 createSuccessNotice 33288 ] 33289 ); 33290 const isReady = !isLoading; 33291 const transition = { 33292 duration: disableMotion ? 0 : 0.2 33293 }; 33294 const hasAdminBarInEditor = window.__experimentalAdminBarInEditor; 33295 return !isBlockBasedTheme && isHomeRoute ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(SitePreview, {}) : /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_jsx_runtime199.Fragment, { children: [ 33296 /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_editor20.EditorKeyboardShortcutsRegister, {}), 33297 isEditMode && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(BlockKeyboardShortcuts, {}), 33298 !isReady ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(CanvasLoader, { id: loadingProgressId }) : null, 33299 isEditMode && isReady && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)( 33300 WelcomeGuide, 33301 { 33302 postType: postWithTemplate ? context.postType : postType2 33303 } 33304 ), 33305 isReady && /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)( 33306 Editor, 33307 { 33308 postType: postWithTemplate ? context.postType : postType2, 33309 postId: postWithTemplate ? context.postId : postId, 33310 templateId: postWithTemplate ? postId : void 0, 33311 settings: editorSettings, 33312 className: "edit-site-editor__editor-interface", 33313 customSaveButton: _isPreviewingTheme && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(SaveButton, { size: "compact" }), 33314 customSavePanel: _isPreviewingTheme && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(SavePanel, {}), 33315 iframeProps, 33316 onActionPerformed, 33317 extraSidebarPanels: !postWithTemplate && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(plugin_template_setting_panel_default.Slot, {}), 33318 children: [ 33319 isEditMode && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ViewportSync, {}), 33320 isEditMode && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)( 33321 import_components81.__unstableMotion.div, 33322 { 33323 className: "edit-site-editor__view-mode-toggle", 33324 transition, 33325 animate: "edit", 33326 initial: "edit", 33327 whileHover: "hover", 33328 whileTap: "tap", 33329 children: [ 33330 /* @__PURE__ */ (0, import_jsx_runtime199.jsx)( 33331 import_components81.Button, 33332 { 33333 __next40pxDefaultSize: true, 33334 label: (0, import_i18n72.__)("Open Navigation"), 33335 showTooltip: true, 33336 tooltipPosition: "middle right", 33337 onClick: () => { 33338 resetZoomLevel(); 33339 setCurrentRevisionId(null); 33340 history.navigate( 33341 getNavigationPath( 33342 location, 33343 postWithTemplate ? context.postType : postType2 33344 ), 33345 { 33346 transition: "canvas-mode-view-transition" 33347 } 33348 ); 33349 }, 33350 children: !hasAdminBarInEditor && /* @__PURE__ */ (0, import_jsx_runtime199.jsx)( 33351 import_components81.__unstableMotion.div, 33352 { 33353 variants: !disableMotion && siteIconVariants, 33354 children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(site_icon_default, { className: "edit-site-editor__view-mode-toggle-icon" }) 33355 } 33356 ) 33357 } 33358 ), 33359 hasAdminBarInEditor ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "edit-site-editor__back-icon", children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)( 33360 icon_default, 33361 { 33362 icon: (0, import_i18n72.isRTL)() ? arrow_up_right_default : arrow_up_left_default 33363 } 33364 ) }) : /* @__PURE__ */ (0, import_jsx_runtime199.jsx)( 33365 import_components81.__unstableMotion.div, 33366 { 33367 className: clsx_default( 33368 "edit-site-editor__back-icon", 33369 { 33370 "has-site-icon": hasSiteIcon 33371 } 33372 ), 33373 variants: !disableMotion && toggleHomeIconVariants, 33374 children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)( 33375 icon_default, 33376 { 33377 icon: (0, import_i18n72.isRTL)() ? arrow_up_right_default : arrow_up_left_default 33378 } 33379 ) 33380 } 33381 ) 33382 ] 33383 } 33384 ) }), 33385 /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(MoreMenu, {}) 33386 ] 33387 } 33388 ) 33389 ] }); 33390 } 33391 33392 // packages/edit-site/build-module/components/site-editor-routes/utils.mjs 33393 function isThemeDataLoaded(siteData) { 33394 return siteData.currentTheme !== void 0 && siteData.currentTheme !== null; 33395 } 33396 function isClassicThemeWithStyleBookSupport(siteData) { 33397 const isBlockTheme = siteData.currentTheme?.is_block_theme; 33398 const supportsEditorStyles = siteData.currentTheme?.theme_supports["editor-styles"]; 33399 const hasThemeJson = siteData.editorSettings?.supportsLayout; 33400 return !isBlockTheme && (supportsEditorStyles || hasThemeJson); 33401 } 33402 33403 // packages/edit-site/build-module/components/site-editor-routes/home.mjs 33404 var import_jsx_runtime200 = __toESM(require_jsx_runtime(), 1); 33405 var homeRoute = { 33406 name: "home", 33407 path: "/", 33408 areas: { 33409 sidebar({ siteData }) { 33410 if (!isThemeDataLoaded(siteData)) { 33411 return null; 33412 } 33413 return siteData.currentTheme.is_block_theme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(SidebarNavigationScreenUnsupported, {}); 33414 }, 33415 preview({ siteData }) { 33416 const isBlockTheme = siteData.currentTheme?.is_block_theme; 33417 return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(EditSiteEditor, { isHomeRoute: true }) : void 0; 33418 }, 33419 mobileSidebar({ siteData }) { 33420 if (!isThemeDataLoaded(siteData)) { 33421 return /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(import_jsx_runtime200.Fragment, {}); 33422 } 33423 return siteData.currentTheme.is_block_theme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(SidebarNavigationScreenUnsupported, {}); 33424 } 33425 } 33426 }; 33427 33428 // packages/edit-site/build-module/components/sidebar-identity/index.mjs 33429 var import_i18n123 = __toESM(require_i18n(), 1); 33430 var import_data55 = __toESM(require_data(), 1); 33431 var import_core_data36 = __toESM(require_core_data(), 1); 33432 33433 // packages/dataviews/build-module/dataviews/index.mjs 33434 var import_element145 = __toESM(require_element(), 1); 33435 var import_compose23 = __toESM(require_compose(), 1); 33436 33437 // packages/dataviews/build-module/components/dataviews-context/index.mjs 33438 var import_element89 = __toESM(require_element(), 1); 33439 33440 // packages/dataviews/build-module/constants.mjs 33441 var import_i18n73 = __toESM(require_i18n(), 1); 33442 var OPERATOR_IS_ANY2 = "isAny"; 33443 var OPERATOR_IS_NONE2 = "isNone"; 33444 var OPERATOR_IS_ALL = "isAll"; 33445 var OPERATOR_IS_NOT_ALL = "isNotAll"; 33446 var OPERATOR_BETWEEN = "between"; 33447 var OPERATOR_IN_THE_PAST = "inThePast"; 33448 var OPERATOR_OVER = "over"; 33449 var OPERATOR_IS2 = "is"; 33450 var OPERATOR_IS_NOT = "isNot"; 33451 var OPERATOR_LESS_THAN = "lessThan"; 33452 var OPERATOR_GREATER_THAN = "greaterThan"; 33453 var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual"; 33454 var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual"; 33455 var OPERATOR_BEFORE2 = "before"; 33456 var OPERATOR_AFTER2 = "after"; 33457 var OPERATOR_BEFORE_INC = "beforeInc"; 33458 var OPERATOR_AFTER_INC = "afterInc"; 33459 var OPERATOR_CONTAINS = "contains"; 33460 var OPERATOR_NOT_CONTAINS = "notContains"; 33461 var OPERATOR_STARTS_WITH = "startsWith"; 33462 var OPERATOR_ON = "on"; 33463 var OPERATOR_NOT_ON = "notOn"; 33464 var SORTING_DIRECTIONS = ["asc", "desc"]; 33465 var sortArrows = { asc: "\u2191", desc: "\u2193" }; 33466 var sortValues = { asc: "ascending", desc: "descending" }; 33467 var sortLabels = { 33468 asc: (0, import_i18n73.__)("Sort ascending"), 33469 desc: (0, import_i18n73.__)("Sort descending") 33470 }; 33471 var sortIcons = { 33472 asc: arrow_up_default, 33473 desc: arrow_down_default 33474 }; 33475 var LAYOUT_TABLE = "table"; 33476 var LAYOUT_GRID = "grid"; 33477 var LAYOUT_LIST2 = "list"; 33478 var LAYOUT_ACTIVITY = "activity"; 33479 var LAYOUT_PICKER_GRID = "pickerGrid"; 33480 var LAYOUT_PICKER_TABLE = "pickerTable"; 33481 var LAYOUT_PICKER_ACTIVITY = "pickerActivity"; 33482 33483 // packages/dataviews/build-module/components/dataviews-context/index.mjs 33484 var DataViewsContext = (0, import_element89.createContext)({ 33485 view: { type: LAYOUT_TABLE }, 33486 onChangeView: () => { 33487 }, 33488 fields: [], 33489 data: [], 33490 paginationInfo: { 33491 totalItems: 0, 33492 totalPages: 0 33493 }, 33494 selection: [], 33495 onChangeSelection: () => { 33496 }, 33497 setOpenedFilter: () => { 33498 }, 33499 openedFilter: null, 33500 getItemId: (item) => item.id, 33501 isItemClickable: () => true, 33502 renderItemLink: void 0, 33503 containerWidth: 0, 33504 containerRef: (0, import_element89.createRef)(), 33505 resizeObserverRef: () => { 33506 }, 33507 defaultLayouts: { list: {}, grid: {}, table: {} }, 33508 filters: [], 33509 isShowingFilter: false, 33510 setIsShowingFilter: () => { 33511 }, 33512 hasInitiallyLoaded: false, 33513 config: { 33514 perPageSizes: [] 33515 }, 33516 intersectionObserver: null 33517 }); 33518 DataViewsContext.displayName = "DataViewsContext"; 33519 var dataviews_context_default = DataViewsContext; 33520 33521 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs 33522 var import_i18n94 = __toESM(require_i18n(), 1); 33523 33524 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs 33525 var import_i18n81 = __toESM(require_i18n(), 1); 33526 var import_components87 = __toESM(require_components(), 1); 33527 var import_element97 = __toESM(require_element(), 1); 33528 var import_keycodes6 = __toESM(require_keycodes(), 1); 33529 33530 // packages/dataviews/build-module/components/dataviews-selection-checkbox/index.mjs 33531 var import_components82 = __toESM(require_components(), 1); 33532 var import_i18n74 = __toESM(require_i18n(), 1); 33533 var import_jsx_runtime201 = __toESM(require_jsx_runtime(), 1); 33534 function DataViewsSelectionCheckbox({ 33535 selection, 33536 onChangeSelection, 33537 item, 33538 getItemId: getItemId2, 33539 titleField, 33540 disabled: disabled2, 33541 ...extraProps 33542 }) { 33543 const id = getItemId2(item); 33544 const isInSelectionArray = selection.includes(id); 33545 const checked = !disabled2 && isInSelectionArray; 33546 const selectionLabel = titleField?.getValue?.({ item }) || (0, import_i18n74.__)("(no title)"); 33547 return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)( 33548 import_components82.CheckboxControl, 33549 { 33550 className: "dataviews-selection-checkbox", 33551 "aria-label": selectionLabel, 33552 "aria-disabled": disabled2, 33553 checked, 33554 onChange: () => { 33555 if (disabled2) { 33556 return; 33557 } 33558 onChangeSelection( 33559 isInSelectionArray ? selection.filter((itemId) => id !== itemId) : [...selection, id] 33560 ); 33561 }, 33562 ...extraProps 33563 } 33564 ); 33565 } 33566 33567 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs 33568 var import_components83 = __toESM(require_components(), 1); 33569 var import_i18n75 = __toESM(require_i18n(), 1); 33570 var import_element90 = __toESM(require_element(), 1); 33571 var import_data49 = __toESM(require_data(), 1); 33572 var import_compose11 = __toESM(require_compose(), 1); 33573 33574 // packages/dataviews/build-module/lock-unlock.mjs 33575 var import_private_apis4 = __toESM(require_private_apis(), 1); 33576 var { lock: lock4, unlock: unlock4 } = (0, import_private_apis4.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 33577 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 33578 "@wordpress/dataviews" 33579 ); 33580 33581 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs 33582 var import_jsx_runtime202 = __toESM(require_jsx_runtime(), 1); 33583 var { Menu: Menu5, kebabCase: kebabCase4 } = unlock4(import_components83.privateApis); 33584 function ButtonTrigger({ 33585 action, 33586 onClick, 33587 items, 33588 variant 33589 }) { 33590 const label = typeof action.label === "string" ? action.label : action.label(items); 33591 return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33592 import_components83.Button, 33593 { 33594 disabled: !!action.disabled, 33595 accessibleWhenDisabled: true, 33596 size: "compact", 33597 variant, 33598 onClick, 33599 children: label 33600 } 33601 ); 33602 } 33603 function MenuItemTrigger({ 33604 action, 33605 onClick, 33606 items 33607 }) { 33608 const label = typeof action.label === "string" ? action.label : action.label(items); 33609 return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(Menu5.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(Menu5.ItemLabel, { children: label }) }); 33610 } 33611 function ActionModal({ 33612 action, 33613 items, 33614 closeModal 33615 }) { 33616 const label = typeof action.label === "string" ? action.label : action.label(items); 33617 const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader; 33618 return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33619 import_components83.Modal, 33620 { 33621 title: modalHeader || label, 33622 __experimentalHideHeader: !!action.hideModalHeader, 33623 onRequestClose: closeModal, 33624 focusOnMount: action.modalFocusOnMount ?? true, 33625 size: action.modalSize || "medium", 33626 overlayClassName: `dataviews-action-modal dataviews-action-modal__$kebabCase4( 33627 action.id 33628 )}`, 33629 children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(action.RenderModal, { items, closeModal }) 33630 } 33631 ); 33632 } 33633 function ActionsMenuGroup({ 33634 actions, 33635 item, 33636 registry, 33637 setActiveModalAction 33638 }) { 33639 const { primaryActions, regularActions } = (0, import_element90.useMemo)(() => { 33640 return actions.reduce( 33641 (acc, action) => { 33642 (action.isPrimary ? acc.primaryActions : acc.regularActions).push(action); 33643 return acc; 33644 }, 33645 { 33646 primaryActions: [], 33647 regularActions: [] 33648 } 33649 ); 33650 }, [actions]); 33651 const renderActionGroup = (actionList) => actionList.map((action) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33652 MenuItemTrigger, 33653 { 33654 action, 33655 onClick: () => { 33656 if ("RenderModal" in action) { 33657 setActiveModalAction(action); 33658 return; 33659 } 33660 action.callback([item], { registry }); 33661 }, 33662 items: [item] 33663 }, 33664 action.id 33665 )); 33666 return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(Menu5.Group, { children: [ 33667 renderActionGroup(primaryActions), 33668 renderActionGroup(regularActions) 33669 ] }); 33670 } 33671 function ItemActions({ 33672 item, 33673 actions, 33674 isCompact 33675 }) { 33676 const registry = (0, import_data49.useRegistry)(); 33677 const { primaryActions, eligibleActions } = (0, import_element90.useMemo)(() => { 33678 const _eligibleActions = actions.filter( 33679 (action) => !action.isEligible || action.isEligible(item) 33680 ); 33681 const _primaryActions = _eligibleActions.filter( 33682 (action) => action.isPrimary 33683 ); 33684 return { 33685 primaryActions: _primaryActions, 33686 eligibleActions: _eligibleActions 33687 }; 33688 }, [actions, item]); 33689 const isMobileViewport = (0, import_compose11.useViewportMatch)("medium", "<"); 33690 if (isCompact) { 33691 return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33692 CompactItemActions, 33693 { 33694 item, 33695 actions: eligibleActions, 33696 isSmall: true, 33697 registry 33698 } 33699 ); 33700 } 33701 return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)( 33702 Stack, 33703 { 33704 direction: "row", 33705 justify: "flex-end", 33706 className: "dataviews-item-actions", 33707 style: { 33708 flexShrink: 0, 33709 width: "auto" 33710 }, 33711 children: [ 33712 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33713 PrimaryActions, 33714 { 33715 item, 33716 actions: primaryActions, 33717 registry 33718 } 33719 ), 33720 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu 33721 // there if there are any actions at all. 33722 isMobileViewport) && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33723 CompactItemActions, 33724 { 33725 item, 33726 actions: eligibleActions, 33727 registry 33728 } 33729 ) 33730 ] 33731 } 33732 ); 33733 } 33734 function CompactItemActions({ 33735 item, 33736 actions, 33737 isSmall, 33738 registry 33739 }) { 33740 const [activeModalAction, setActiveModalAction] = (0, import_element90.useState)( 33741 null 33742 ); 33743 return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(import_jsx_runtime202.Fragment, { children: [ 33744 /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(Menu5, { placement: "bottom-end", children: [ 33745 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33746 Menu5.TriggerButton, 33747 { 33748 render: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33749 import_components83.Button, 33750 { 33751 size: isSmall ? "small" : "compact", 33752 icon: more_vertical_default, 33753 label: (0, import_i18n75.__)("Actions"), 33754 accessibleWhenDisabled: true, 33755 disabled: !actions.length, 33756 className: "dataviews-all-actions-button" 33757 } 33758 ) 33759 } 33760 ), 33761 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(Menu5.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33762 ActionsMenuGroup, 33763 { 33764 actions, 33765 item, 33766 registry, 33767 setActiveModalAction 33768 } 33769 ) }) 33770 ] }), 33771 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33772 ActionModal, 33773 { 33774 action: activeModalAction, 33775 items: [item], 33776 closeModal: () => setActiveModalAction(null) 33777 } 33778 ) 33779 ] }); 33780 } 33781 function PrimaryActions({ 33782 item, 33783 actions, 33784 registry, 33785 buttonVariant 33786 }) { 33787 const [activeModalAction, setActiveModalAction] = (0, import_element90.useState)(null); 33788 const isMobileViewport = (0, import_compose11.useViewportMatch)("medium", "<"); 33789 if (isMobileViewport) { 33790 return null; 33791 } 33792 if (!Array.isArray(actions) || actions.length === 0) { 33793 return null; 33794 } 33795 return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(import_jsx_runtime202.Fragment, { children: [ 33796 actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33797 ButtonTrigger, 33798 { 33799 action, 33800 onClick: () => { 33801 if ("RenderModal" in action) { 33802 setActiveModalAction(action); 33803 return; 33804 } 33805 action.callback([item], { registry }); 33806 }, 33807 items: [item], 33808 variant: buttonVariant 33809 }, 33810 action.id 33811 )), 33812 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)( 33813 ActionModal, 33814 { 33815 action: activeModalAction, 33816 items: [item], 33817 closeModal: () => setActiveModalAction(null) 33818 } 33819 ) 33820 ] }); 33821 } 33822 33823 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs 33824 var import_components84 = __toESM(require_components(), 1); 33825 var import_i18n77 = __toESM(require_i18n(), 1); 33826 var import_element91 = __toESM(require_element(), 1); 33827 var import_data50 = __toESM(require_data(), 1); 33828 var import_compose12 = __toESM(require_compose(), 1); 33829 33830 // packages/dataviews/build-module/utils/get-footer-message.mjs 33831 var import_i18n76 = __toESM(require_i18n(), 1); 33832 function getFooterMessage(selectionCount, itemsCount, totalItems, onlyTotalCount = false) { 33833 if (selectionCount > 0) { 33834 return (0, import_i18n76.sprintf)( 33835 /* translators: %d: number of items. */ 33836 (0, import_i18n76._n)("%d Item selected", "%d Items selected", selectionCount), 33837 selectionCount 33838 ); 33839 } 33840 if (onlyTotalCount || totalItems <= itemsCount) { 33841 return (0, import_i18n76.sprintf)( 33842 /* translators: %d: number of items. */ 33843 (0, import_i18n76._n)("%d Item", "%d Items", totalItems), 33844 totalItems 33845 ); 33846 } 33847 return (0, import_i18n76.sprintf)( 33848 /* translators: %1$d: number of items. %2$d: total number of items. */ 33849 (0, import_i18n76._n)("%1$d of %2$d Item", "%1$d of %2$d Items", totalItems), 33850 itemsCount, 33851 totalItems 33852 ); 33853 } 33854 33855 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs 33856 var import_jsx_runtime203 = __toESM(require_jsx_runtime(), 1); 33857 function ActionWithModal({ 33858 action, 33859 items, 33860 ActionTriggerComponent 33861 }) { 33862 const [isModalOpen, setIsModalOpen] = (0, import_element91.useState)(false); 33863 const actionTriggerProps = { 33864 action, 33865 onClick: () => { 33866 setIsModalOpen(true); 33867 }, 33868 items 33869 }; 33870 return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(import_jsx_runtime203.Fragment, { children: [ 33871 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(ActionTriggerComponent, { ...actionTriggerProps }), 33872 isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 33873 ActionModal, 33874 { 33875 action, 33876 items, 33877 closeModal: () => setIsModalOpen(false) 33878 } 33879 ) 33880 ] }); 33881 } 33882 function useHasAPossibleBulkAction(actions, item) { 33883 return (0, import_element91.useMemo)(() => { 33884 return actions.some((action) => { 33885 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 33886 }); 33887 }, [actions, item]); 33888 } 33889 function useSomeItemHasAPossibleBulkAction(actions, data) { 33890 return (0, import_element91.useMemo)(() => { 33891 return data.some((item) => { 33892 return actions.some((action) => { 33893 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 33894 }); 33895 }); 33896 }, [actions, data]); 33897 } 33898 function BulkSelectionCheckbox({ 33899 selection, 33900 onChangeSelection, 33901 data, 33902 actions, 33903 getItemId: getItemId2, 33904 disableSelectAll = false 33905 }) { 33906 const selectableItems = (0, import_element91.useMemo)(() => { 33907 return data.filter((item) => { 33908 return actions.some( 33909 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item)) 33910 ); 33911 }); 33912 }, [data, actions]); 33913 const selectedItems = data.filter( 33914 (item) => selection.includes(getItemId2(item)) && selectableItems.includes(item) 33915 ); 33916 const hasSelection = selection.length > 0; 33917 const areAllSelected = selectedItems.length === selectableItems.length; 33918 if (disableSelectAll) { 33919 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 33920 import_components84.CheckboxControl, 33921 { 33922 className: "dataviews-view-table-selection-checkbox", 33923 checked: hasSelection, 33924 disabled: !hasSelection, 33925 onChange: () => { 33926 onChangeSelection([]); 33927 }, 33928 "aria-label": (0, import_i18n77.__)("Deselect all") 33929 } 33930 ); 33931 } 33932 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 33933 import_components84.CheckboxControl, 33934 { 33935 className: "dataviews-view-table-selection-checkbox", 33936 checked: areAllSelected, 33937 indeterminate: !areAllSelected && !!selectedItems.length, 33938 onChange: () => { 33939 if (areAllSelected) { 33940 onChangeSelection([]); 33941 } else { 33942 onChangeSelection( 33943 selectableItems.map((item) => getItemId2(item)) 33944 ); 33945 } 33946 }, 33947 "aria-label": areAllSelected ? (0, import_i18n77.__)("Deselect all") : (0, import_i18n77.__)("Select all") 33948 } 33949 ); 33950 } 33951 function ActionTrigger({ 33952 action, 33953 onClick, 33954 isBusy, 33955 items 33956 }) { 33957 const label = typeof action.label === "string" ? action.label : action.label(items); 33958 const isMobile = (0, import_compose12.useViewportMatch)("medium", "<"); 33959 if (isMobile) { 33960 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 33961 import_components84.Button, 33962 { 33963 disabled: isBusy, 33964 accessibleWhenDisabled: true, 33965 label, 33966 icon: action.icon, 33967 size: "compact", 33968 onClick, 33969 isBusy 33970 } 33971 ); 33972 } 33973 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 33974 import_components84.Button, 33975 { 33976 disabled: isBusy, 33977 accessibleWhenDisabled: true, 33978 size: "compact", 33979 onClick, 33980 isBusy, 33981 children: label 33982 } 33983 ); 33984 } 33985 var EMPTY_ARRAY5 = []; 33986 function ActionButton({ 33987 action, 33988 selectedItems, 33989 actionInProgress, 33990 setActionInProgress 33991 }) { 33992 const registry = (0, import_data50.useRegistry)(); 33993 const selectedEligibleItems = (0, import_element91.useMemo)(() => { 33994 return selectedItems.filter((item) => { 33995 return !action.isEligible || action.isEligible(item); 33996 }); 33997 }, [action, selectedItems]); 33998 if ("RenderModal" in action) { 33999 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 34000 ActionWithModal, 34001 { 34002 action, 34003 items: selectedEligibleItems, 34004 ActionTriggerComponent: ActionTrigger 34005 }, 34006 action.id 34007 ); 34008 } 34009 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 34010 ActionTrigger, 34011 { 34012 action, 34013 onClick: async () => { 34014 setActionInProgress(action.id); 34015 await action.callback(selectedItems, { 34016 registry 34017 }); 34018 setActionInProgress(null); 34019 }, 34020 items: selectedEligibleItems, 34021 isBusy: actionInProgress === action.id 34022 }, 34023 action.id 34024 ); 34025 } 34026 function renderFooterContent(data, actions, getItemId2, isInfiniteScroll, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection, paginationInfo) { 34027 const message2 = getFooterMessage( 34028 selection.length, 34029 data.length, 34030 paginationInfo.totalItems, 34031 isInfiniteScroll 34032 ); 34033 return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)( 34034 Stack, 34035 { 34036 direction: "row", 34037 className: "dataviews-bulk-actions-footer__container", 34038 gap: "md", 34039 align: "center", 34040 children: [ 34041 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 34042 BulkSelectionCheckbox, 34043 { 34044 selection, 34045 onChangeSelection, 34046 data, 34047 actions, 34048 getItemId: getItemId2, 34049 disableSelectAll: isInfiniteScroll 34050 } 34051 ), 34052 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message2 }), 34053 /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)( 34054 Stack, 34055 { 34056 direction: "row", 34057 className: "dataviews-bulk-actions-footer__action-buttons", 34058 gap: "xs", 34059 children: [ 34060 actionsToShow.map((action) => { 34061 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 34062 ActionButton, 34063 { 34064 action, 34065 selectedItems, 34066 actionInProgress, 34067 setActionInProgress 34068 }, 34069 action.id 34070 ); 34071 }), 34072 selectedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 34073 import_components84.Button, 34074 { 34075 icon: close_small_default, 34076 showTooltip: true, 34077 tooltipPosition: "top", 34078 size: "compact", 34079 label: (0, import_i18n77.__)("Cancel"), 34080 disabled: !!actionInProgress, 34081 accessibleWhenDisabled: false, 34082 onClick: () => { 34083 onChangeSelection(EMPTY_ARRAY5); 34084 } 34085 } 34086 ) 34087 ] 34088 } 34089 ) 34090 ] 34091 } 34092 ); 34093 } 34094 function FooterContent({ 34095 selection, 34096 actions, 34097 onChangeSelection, 34098 data, 34099 getItemId: getItemId2, 34100 isInfiniteScroll, 34101 paginationInfo 34102 }) { 34103 const [actionInProgress, setActionInProgress] = (0, import_element91.useState)( 34104 null 34105 ); 34106 const footerContentRef = (0, import_element91.useRef)(void 0); 34107 const isMobile = (0, import_compose12.useViewportMatch)("medium", "<"); 34108 const bulkActions = (0, import_element91.useMemo)( 34109 () => actions.filter((action) => action.supportsBulk), 34110 [actions] 34111 ); 34112 const selectableItems = (0, import_element91.useMemo)(() => { 34113 return data.filter((item) => { 34114 return bulkActions.some( 34115 (action) => !action.isEligible || action.isEligible(item) 34116 ); 34117 }); 34118 }, [data, bulkActions]); 34119 const selectedItems = (0, import_element91.useMemo)(() => { 34120 return data.filter( 34121 (item) => selection.includes(getItemId2(item)) && selectableItems.includes(item) 34122 ); 34123 }, [selection, data, getItemId2, selectableItems]); 34124 const actionsToShow = (0, import_element91.useMemo)( 34125 () => actions.filter((action) => { 34126 return action.supportsBulk && (!isMobile || action.icon) && selectedItems.some( 34127 (item) => !action.isEligible || action.isEligible(item) 34128 ); 34129 }), 34130 [actions, selectedItems, isMobile] 34131 ); 34132 if (!actionInProgress) { 34133 if (footerContentRef.current) { 34134 footerContentRef.current = void 0; 34135 } 34136 return renderFooterContent( 34137 data, 34138 actions, 34139 getItemId2, 34140 isInfiniteScroll, 34141 selection, 34142 actionsToShow, 34143 selectedItems, 34144 actionInProgress, 34145 setActionInProgress, 34146 onChangeSelection, 34147 paginationInfo 34148 ); 34149 } else if (!footerContentRef.current) { 34150 footerContentRef.current = renderFooterContent( 34151 data, 34152 actions, 34153 getItemId2, 34154 isInfiniteScroll, 34155 selection, 34156 actionsToShow, 34157 selectedItems, 34158 actionInProgress, 34159 setActionInProgress, 34160 onChangeSelection, 34161 paginationInfo 34162 ); 34163 } 34164 return footerContentRef.current; 34165 } 34166 function BulkActionsFooter() { 34167 const { 34168 data, 34169 selection, 34170 actions = EMPTY_ARRAY5, 34171 onChangeSelection, 34172 getItemId: getItemId2, 34173 paginationInfo, 34174 view 34175 } = (0, import_element91.useContext)(dataviews_context_default); 34176 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 34177 FooterContent, 34178 { 34179 selection, 34180 onChangeSelection, 34181 data, 34182 actions, 34183 getItemId: getItemId2, 34184 isInfiniteScroll: !!view.infiniteScrollEnabled, 34185 paginationInfo 34186 } 34187 ); 34188 } 34189 34190 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs 34191 var import_i18n78 = __toESM(require_i18n(), 1); 34192 var import_components85 = __toESM(require_components(), 1); 34193 var import_element92 = __toESM(require_element(), 1); 34194 34195 // packages/dataviews/build-module/utils/get-hideable-fields.mjs 34196 function getHideableFields(view, fields2) { 34197 const togglableFields = [ 34198 view?.titleField, 34199 view?.mediaField, 34200 view?.descriptionField 34201 ].filter(Boolean); 34202 return fields2.filter( 34203 (f2) => !togglableFields.includes(f2.id) && f2.type !== "media" && f2.enableHiding !== false 34204 ); 34205 } 34206 34207 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs 34208 var import_jsx_runtime204 = __toESM(require_jsx_runtime(), 1); 34209 var { Menu: Menu6 } = unlock4(import_components85.privateApis); 34210 function WithMenuSeparators({ children }) { 34211 return import_element92.Children.toArray(children).filter(Boolean).map((child, i2) => /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(import_element92.Fragment, { children: [ 34212 i2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.Separator, {}), 34213 child 34214 ] }, i2)); 34215 } 34216 var _HeaderMenu = (0, import_element92.forwardRef)(function HeaderMenu({ 34217 fieldId, 34218 view, 34219 fields: fields2, 34220 onChangeView, 34221 onHide, 34222 setOpenedFilter, 34223 canMove = true, 34224 canInsertLeft = true, 34225 canInsertRight = true 34226 }, ref) { 34227 const visibleFieldIds = view.fields ?? []; 34228 const index2 = visibleFieldIds?.indexOf(fieldId); 34229 const isSorted = view.sort?.field === fieldId; 34230 let isHidable = false; 34231 let isSortable = false; 34232 let canAddFilter = false; 34233 let operators = []; 34234 const field = fields2.find((f2) => f2.id === fieldId); 34235 const { setIsShowingFilter } = (0, import_element92.useContext)(dataviews_context_default); 34236 if (!field) { 34237 return null; 34238 } 34239 isHidable = field.enableHiding !== false; 34240 isSortable = field.enableSorting !== false; 34241 const header = field.header; 34242 operators = !!field.filterBy && field.filterBy?.operators || []; 34243 canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary; 34244 if (!isSortable && !canMove && !isHidable && !canAddFilter) { 34245 return header; 34246 } 34247 const hiddenFields = getHideableFields(view, fields2).filter( 34248 (f2) => !visibleFieldIds.includes(f2.id) 34249 ); 34250 const canInsert = (canInsertLeft || canInsertRight) && !!hiddenFields.length; 34251 const isRtl = (0, import_i18n78.isRTL)(); 34252 return /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(Menu6, { children: [ 34253 /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)( 34254 Menu6.TriggerButton, 34255 { 34256 render: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 34257 import_components85.Button, 34258 { 34259 size: "compact", 34260 className: "dataviews-view-table-header-button", 34261 ref, 34262 variant: "tertiary" 34263 } 34264 ), 34265 children: [ 34266 header, 34267 view.sort && isSorted && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] }) 34268 ] 34269 } 34270 ), 34271 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(WithMenuSeparators, { children: [ 34272 isSortable && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.Group, { children: SORTING_DIRECTIONS.map( 34273 (direction) => { 34274 const isChecked = view.sort && isSorted && view.sort.direction === direction; 34275 const value = `$fieldId}-$direction}`; 34276 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 34277 Menu6.RadioItem, 34278 { 34279 name: "view-table-sorting", 34280 value, 34281 checked: isChecked, 34282 onChange: () => { 34283 onChangeView({ 34284 ...view, 34285 sort: { 34286 field: fieldId, 34287 direction 34288 }, 34289 showLevels: false 34290 }); 34291 }, 34292 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: sortLabels[direction] }) 34293 }, 34294 value 34295 ); 34296 } 34297 ) }), 34298 canAddFilter && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 34299 Menu6.Item, 34300 { 34301 prefix: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(import_components85.Icon, { icon: funnel_default }), 34302 onClick: () => { 34303 setOpenedFilter(fieldId); 34304 setIsShowingFilter(true); 34305 onChangeView({ 34306 ...view, 34307 page: 1, 34308 filters: [ 34309 ...view.filters || [], 34310 { 34311 field: fieldId, 34312 value: void 0, 34313 operator: operators[0] 34314 } 34315 ] 34316 }); 34317 }, 34318 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: (0, import_i18n78.__)("Add filter") }) 34319 } 34320 ) }), 34321 (canMove || isHidable || canInsert) && field && /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(Menu6.Group, { children: [ 34322 canMove && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 34323 Menu6.Item, 34324 { 34325 prefix: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(import_components85.Icon, { icon: arrow_left_default }), 34326 disabled: isRtl ? index2 >= visibleFieldIds.length - 1 : index2 < 1, 34327 onClick: () => { 34328 const targetIndex = isRtl ? index2 + 1 : index2 - 1; 34329 const newFields = [ 34330 ...visibleFieldIds 34331 ]; 34332 newFields.splice(index2, 1); 34333 newFields.splice( 34334 targetIndex, 34335 0, 34336 fieldId 34337 ); 34338 onChangeView({ 34339 ...view, 34340 fields: newFields 34341 }); 34342 }, 34343 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: (0, import_i18n78.__)("Move left") }) 34344 } 34345 ), 34346 canMove && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 34347 Menu6.Item, 34348 { 34349 prefix: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(import_components85.Icon, { icon: arrow_right_default }), 34350 disabled: isRtl ? index2 < 1 : index2 >= visibleFieldIds.length - 1, 34351 onClick: () => { 34352 const targetIndex = isRtl ? index2 - 1 : index2 + 1; 34353 const newFields = [ 34354 ...visibleFieldIds 34355 ]; 34356 newFields.splice(index2, 1); 34357 newFields.splice( 34358 targetIndex, 34359 0, 34360 fieldId 34361 ); 34362 onChangeView({ 34363 ...view, 34364 fields: newFields 34365 }); 34366 }, 34367 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: (0, import_i18n78.__)("Move right") }) 34368 } 34369 ), 34370 canInsertLeft && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(Menu6, { children: [ 34371 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: (0, import_i18n78.__)("Insert left") }) }), 34372 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.Popover, { children: hiddenFields.map((hiddenField) => { 34373 const insertIndex = isRtl ? index2 + 1 : index2; 34374 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 34375 Menu6.Item, 34376 { 34377 onClick: () => { 34378 onChangeView({ 34379 ...view, 34380 fields: [ 34381 ...visibleFieldIds.slice( 34382 0, 34383 insertIndex 34384 ), 34385 hiddenField.id, 34386 ...visibleFieldIds.slice( 34387 insertIndex 34388 ) 34389 ] 34390 }); 34391 }, 34392 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: hiddenField.label }) 34393 }, 34394 hiddenField.id 34395 ); 34396 }) }) 34397 ] }), 34398 canInsertRight && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(Menu6, { children: [ 34399 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: (0, import_i18n78.__)("Insert right") }) }), 34400 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.Popover, { children: hiddenFields.map((hiddenField) => { 34401 const insertIndex = isRtl ? index2 : index2 + 1; 34402 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 34403 Menu6.Item, 34404 { 34405 onClick: () => { 34406 onChangeView({ 34407 ...view, 34408 fields: [ 34409 ...visibleFieldIds.slice( 34410 0, 34411 insertIndex 34412 ), 34413 hiddenField.id, 34414 ...visibleFieldIds.slice( 34415 insertIndex 34416 ) 34417 ] 34418 }); 34419 }, 34420 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: hiddenField.label }) 34421 }, 34422 hiddenField.id 34423 ); 34424 }) }) 34425 ] }), 34426 isHidable && field && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 34427 Menu6.Item, 34428 { 34429 prefix: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(import_components85.Icon, { icon: unseen_default }), 34430 onClick: () => { 34431 onHide(field); 34432 onChangeView({ 34433 ...view, 34434 fields: visibleFieldIds.filter( 34435 (id) => id !== fieldId 34436 ) 34437 }); 34438 }, 34439 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Menu6.ItemLabel, { children: (0, import_i18n78.__)("Hide column") }) 34440 } 34441 ) 34442 ] }) 34443 ] }) }) 34444 ] }); 34445 }); 34446 var ColumnHeaderMenu = _HeaderMenu; 34447 var column_header_menu_default = ColumnHeaderMenu; 34448 34449 // packages/dataviews/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs 34450 var import_element93 = __toESM(require_element(), 1); 34451 var import_jsx_runtime205 = __toESM(require_jsx_runtime(), 1); 34452 function getClickableItemProps({ 34453 item, 34454 isItemClickable, 34455 onClickItem, 34456 className 34457 }) { 34458 if (!isItemClickable(item) || !onClickItem) { 34459 return { className }; 34460 } 34461 return { 34462 className: className ? `$className} $className}--clickable` : void 0, 34463 role: "button", 34464 tabIndex: 0, 34465 onClick: (event) => { 34466 event.stopPropagation(); 34467 onClickItem(item); 34468 }, 34469 onKeyDown: (event) => { 34470 if (event.key === "Enter" || event.key === "" || event.key === " ") { 34471 event.stopPropagation(); 34472 onClickItem(item); 34473 } 34474 } 34475 }; 34476 } 34477 function ItemClickWrapper({ 34478 item, 34479 isItemClickable, 34480 onClickItem, 34481 renderItemLink, 34482 className, 34483 children, 34484 ...extraProps 34485 }) { 34486 if (!isItemClickable(item)) { 34487 return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("div", { className, ...extraProps, children }); 34488 } 34489 if (renderItemLink) { 34490 const renderedElement = renderItemLink({ 34491 item, 34492 className: `$className} $className}--clickable`, 34493 ...extraProps, 34494 children 34495 }); 34496 return (0, import_element93.cloneElement)(renderedElement, { 34497 onClick: (event) => { 34498 event.stopPropagation(); 34499 if (renderedElement.props.onClick) { 34500 renderedElement.props.onClick(event); 34501 } 34502 }, 34503 onKeyDown: (event) => { 34504 if (event.key === "Enter" || event.key === "" || event.key === " ") { 34505 event.stopPropagation(); 34506 if (renderedElement.props.onKeyDown) { 34507 renderedElement.props.onKeyDown(event); 34508 } 34509 } 34510 } 34511 }); 34512 } 34513 const clickProps = getClickableItemProps({ 34514 item, 34515 isItemClickable, 34516 onClickItem, 34517 className 34518 }); 34519 return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("div", { ...clickProps, ...extraProps, children }); 34520 } 34521 34522 // packages/dataviews/build-module/components/dataviews-layouts/table/column-primary.mjs 34523 var import_jsx_runtime206 = __toESM(require_jsx_runtime(), 1); 34524 function ColumnPrimary({ 34525 item, 34526 level, 34527 titleField, 34528 mediaField, 34529 descriptionField: descriptionField2, 34530 onClickItem, 34531 renderItemLink, 34532 isItemClickable 34533 }) { 34534 return /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(Stack, { direction: "row", gap: "md", align: "flex-start", justify: "flex-start", children: [ 34535 mediaField && /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 34536 ItemClickWrapper, 34537 { 34538 item, 34539 isItemClickable, 34540 onClickItem, 34541 renderItemLink, 34542 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", 34543 "aria-label": isItemClickable(item) && (!!onClickItem || !!renderItemLink) && !!titleField ? titleField.getValue?.({ item }) : void 0, 34544 children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 34545 mediaField.render, 34546 { 34547 item, 34548 field: mediaField, 34549 config: { sizes: "32px" } 34550 } 34551 ) 34552 } 34553 ), 34554 /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 34555 Stack, 34556 { 34557 direction: "column", 34558 align: "flex-start", 34559 className: "dataviews-view-table__primary-column-content", 34560 children: [ 34561 titleField && /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 34562 ItemClickWrapper, 34563 { 34564 item, 34565 isItemClickable, 34566 onClickItem, 34567 renderItemLink, 34568 className: "dataviews-view-table__cell-content-wrapper dataviews-title-field", 34569 children: [ 34570 level !== void 0 && level > 0 && /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("span", { className: "dataviews-view-table__level", children: [ 34571 Array(level).fill("\u2014").join(" "), 34572 "\xA0" 34573 ] }), 34574 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(titleField.render, { item, field: titleField }) 34575 ] 34576 } 34577 ), 34578 descriptionField2 && /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 34579 descriptionField2.render, 34580 { 34581 item, 34582 field: descriptionField2 34583 } 34584 ) 34585 ] 34586 } 34587 ) 34588 ] }); 34589 } 34590 var column_primary_default = ColumnPrimary; 34591 34592 // packages/dataviews/build-module/components/dataviews-layouts/table/use-scroll-state.mjs 34593 var import_element94 = __toESM(require_element(), 1); 34594 var import_i18n79 = __toESM(require_i18n(), 1); 34595 var isScrolledToEnd = (element) => { 34596 if ((0, import_i18n79.isRTL)()) { 34597 const scrollLeft = Math.abs(element.scrollLeft); 34598 return scrollLeft <= 1; 34599 } 34600 return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1; 34601 }; 34602 function useScrollState({ 34603 scrollContainerRef, 34604 enabledHorizontal = false 34605 }) { 34606 const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0, import_element94.useState)(false); 34607 const [isVerticallyScrolled, setIsVerticallyScrolled] = (0, import_element94.useState)(false); 34608 const handleScroll = (0, import_element94.useCallback)(() => { 34609 const scrollContainer = scrollContainerRef.current; 34610 if (!scrollContainer) { 34611 return; 34612 } 34613 if (enabledHorizontal) { 34614 setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer)); 34615 } 34616 setIsVerticallyScrolled(scrollContainer.scrollTop > 0); 34617 }, [scrollContainerRef, enabledHorizontal]); 34618 (0, import_element94.useEffect)(() => { 34619 if (typeof window === "undefined" || !scrollContainerRef.current) { 34620 return () => { 34621 }; 34622 } 34623 const scrollContainer = scrollContainerRef.current; 34624 handleScroll(); 34625 scrollContainer.addEventListener("scroll", handleScroll); 34626 window.addEventListener("resize", handleScroll); 34627 return () => { 34628 scrollContainer.removeEventListener("scroll", handleScroll); 34629 window.removeEventListener("resize", handleScroll); 34630 }; 34631 }, [scrollContainerRef, enabledHorizontal, handleScroll]); 34632 return { isHorizontalScrollEnd, isVerticallyScrolled }; 34633 } 34634 34635 // packages/dataviews/build-module/components/dataviews-layouts/utils/get-data-by-group.mjs 34636 function getDataByGroup(data, groupByField) { 34637 return data.reduce((groups, item) => { 34638 const groupName = groupByField.getValue({ item }); 34639 if (!groups.has(groupName)) { 34640 groups.set(groupName, []); 34641 } 34642 groups.get(groupName)?.push(item); 34643 return groups; 34644 }, /* @__PURE__ */ new Map()); 34645 } 34646 34647 // packages/dataviews/build-module/components/dataviews-view-config/properties-section.mjs 34648 var import_components86 = __toESM(require_components(), 1); 34649 var import_i18n80 = __toESM(require_i18n(), 1); 34650 var import_element95 = __toESM(require_element(), 1); 34651 var import_jsx_runtime207 = __toESM(require_jsx_runtime(), 1); 34652 function FieldItem({ 34653 field, 34654 isVisible: isVisible2, 34655 onToggleVisibility 34656 }) { 34657 return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_components86.__experimentalItem, { onClick: field.enableHiding ? onToggleVisibility : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(Stack, { direction: "row", gap: "sm", justify: "flex-start", align: "center", children: [ 34658 /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { style: { height: 24, width: 24 }, children: isVisible2 && /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_components86.Icon, { icon: check_default }) }), 34659 /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "dataviews-view-config__label", children: field.label }) 34660 ] }) }); 34661 } 34662 function isDefined(item) { 34663 return !!item; 34664 } 34665 function PropertiesSection({ 34666 showLabel = true 34667 }) { 34668 const { view, fields: fields2, onChangeView } = (0, import_element95.useContext)(dataviews_context_default); 34669 const regularFields = getHideableFields(view, fields2); 34670 if (!regularFields?.length) { 34671 return null; 34672 } 34673 const titleField = fields2.find((f2) => f2.id === view.titleField); 34674 const previewField3 = fields2.find((f2) => f2.id === view.mediaField); 34675 const descriptionField2 = fields2.find( 34676 (f2) => f2.id === view.descriptionField 34677 ); 34678 const lockedFields = [ 34679 { 34680 field: titleField, 34681 isVisibleFlag: "showTitle" 34682 }, 34683 { 34684 field: previewField3, 34685 isVisibleFlag: "showMedia" 34686 }, 34687 { 34688 field: descriptionField2, 34689 isVisibleFlag: "showDescription" 34690 } 34691 ].filter(({ field }) => isDefined(field)); 34692 const visibleFieldIds = view.fields ?? []; 34693 const visibleRegularFieldsCount = regularFields.filter( 34694 (f2) => visibleFieldIds.includes(f2.id) 34695 ).length; 34696 const visibleLockedFields = lockedFields.filter( 34697 ({ isVisibleFlag }) => ( 34698 // @ts-expect-error 34699 view[isVisibleFlag] ?? true 34700 ) 34701 ); 34702 const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount; 34703 const isSingleVisibleLockedField = totalVisibleFields === 1 && visibleLockedFields.length === 1; 34704 return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(Stack, { direction: "column", className: "dataviews-field-control", children: [ 34705 showLabel && /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_components86.BaseControl.VisualLabel, { children: (0, import_i18n80.__)("Properties") }), 34706 /* @__PURE__ */ (0, import_jsx_runtime207.jsx)( 34707 Stack, 34708 { 34709 direction: "column", 34710 className: "dataviews-view-config__properties", 34711 children: /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_components86.__experimentalItemGroup, { isBordered: true, isSeparated: true, size: "medium", children: [ 34712 lockedFields.map(({ field, isVisibleFlag }) => { 34713 const isVisible2 = view[isVisibleFlag] ?? true; 34714 const fieldToRender = isSingleVisibleLockedField && isVisible2 ? { ...field, enableHiding: false } : field; 34715 return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)( 34716 FieldItem, 34717 { 34718 field: fieldToRender, 34719 isVisible: isVisible2, 34720 onToggleVisibility: () => { 34721 onChangeView({ 34722 ...view, 34723 [isVisibleFlag]: !isVisible2 34724 }); 34725 } 34726 }, 34727 field.id 34728 ); 34729 }), 34730 regularFields.map((field) => { 34731 const isVisible2 = visibleFieldIds.includes(field.id); 34732 const fieldToRender = totalVisibleFields === 1 && isVisible2 ? { ...field, enableHiding: false } : field; 34733 return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)( 34734 FieldItem, 34735 { 34736 field: fieldToRender, 34737 isVisible: isVisible2, 34738 onToggleVisibility: () => { 34739 onChangeView({ 34740 ...view, 34741 fields: isVisible2 ? visibleFieldIds.filter( 34742 (fieldId) => fieldId !== field.id 34743 ) : [...visibleFieldIds, field.id] 34744 }); 34745 } 34746 }, 34747 field.id 34748 ); 34749 }) 34750 ] }) 34751 } 34752 ) 34753 ] }); 34754 } 34755 34756 // packages/dataviews/build-module/hooks/use-delayed-loading.mjs 34757 var import_element96 = __toESM(require_element(), 1); 34758 function useDelayedLoading(isLoading, options = { delay: 400 }) { 34759 const [showLoader, setShowLoader] = (0, import_element96.useState)(false); 34760 (0, import_element96.useEffect)(() => { 34761 if (!isLoading) { 34762 return; 34763 } 34764 const timeout = setTimeout(() => { 34765 setShowLoader(true); 34766 }, options.delay); 34767 return () => { 34768 clearTimeout(timeout); 34769 setShowLoader(false); 34770 }; 34771 }, [isLoading, options.delay]); 34772 return showLoader; 34773 } 34774 34775 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs 34776 var import_jsx_runtime208 = __toESM(require_jsx_runtime(), 1); 34777 function getEffectiveAlign(explicitAlign, fieldType) { 34778 if (explicitAlign) { 34779 return explicitAlign; 34780 } 34781 if (fieldType === "integer" || fieldType === "number") { 34782 return "end"; 34783 } 34784 return void 0; 34785 } 34786 function TableColumnField({ 34787 item, 34788 fields: fields2, 34789 column, 34790 align 34791 }) { 34792 const field = fields2.find((f2) => f2.id === column); 34793 if (!field) { 34794 return null; 34795 } 34796 const className = clsx_default("dataviews-view-table__cell-content-wrapper", { 34797 "dataviews-view-table__cell-align-end": align === "end", 34798 "dataviews-view-table__cell-align-center": align === "center" 34799 }); 34800 return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(field.render, { item, field }) }); 34801 } 34802 function TableRow({ 34803 hasBulkActions, 34804 item, 34805 level, 34806 actions, 34807 fields: fields2, 34808 id, 34809 view, 34810 titleField, 34811 mediaField, 34812 descriptionField: descriptionField2, 34813 selection, 34814 getItemId: getItemId2, 34815 isItemClickable, 34816 onClickItem, 34817 renderItemLink, 34818 onChangeSelection, 34819 isActionsColumnSticky, 34820 posinset 34821 }) { 34822 const { paginationInfo } = (0, import_element97.useContext)(dataviews_context_default); 34823 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); 34824 const isSelected2 = hasPossibleBulkAction && selection.includes(id); 34825 const { 34826 showTitle = true, 34827 showMedia = true, 34828 showDescription = true, 34829 infiniteScrollEnabled 34830 } = view; 34831 const isTouchDeviceRef = (0, import_element97.useRef)(false); 34832 const columns = view.fields ?? []; 34833 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription; 34834 return /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)( 34835 "tr", 34836 { 34837 className: clsx_default("dataviews-view-table__row", { 34838 "is-selected": hasPossibleBulkAction && isSelected2, 34839 "has-bulk-actions": hasPossibleBulkAction 34840 }), 34841 onTouchStart: () => { 34842 isTouchDeviceRef.current = true; 34843 }, 34844 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 34845 "aria-posinset": posinset, 34846 role: infiniteScrollEnabled ? "article" : void 0, 34847 onMouseDown: (event) => { 34848 const isMetaClick = (0, import_keycodes6.isAppleOS)() ? event.metaKey : event.ctrlKey; 34849 if (event.button === 0 && isMetaClick && window.navigator.userAgent.toLowerCase().includes("firefox")) { 34850 event?.preventDefault(); 34851 } 34852 }, 34853 onClick: (event) => { 34854 if (!hasPossibleBulkAction) { 34855 return; 34856 } 34857 const isModifierKeyPressed = (0, import_keycodes6.isAppleOS)() ? event.metaKey : event.ctrlKey; 34858 if (isModifierKeyPressed && !isTouchDeviceRef.current && document.getSelection()?.type !== "Range") { 34859 onChangeSelection( 34860 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id] 34861 ); 34862 } 34863 }, 34864 children: [ 34865 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 34866 DataViewsSelectionCheckbox, 34867 { 34868 item, 34869 selection, 34870 onChangeSelection, 34871 getItemId: getItemId2, 34872 titleField, 34873 disabled: !hasPossibleBulkAction 34874 } 34875 ) }) }), 34876 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 34877 column_primary_default, 34878 { 34879 item, 34880 level, 34881 titleField: showTitle ? titleField : void 0, 34882 mediaField: showMedia ? mediaField : void 0, 34883 descriptionField: showDescription ? descriptionField2 : void 0, 34884 isItemClickable, 34885 onClickItem, 34886 renderItemLink 34887 } 34888 ) }), 34889 columns.map((column) => { 34890 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 34891 const field = fields2.find((f2) => f2.id === column); 34892 const effectiveAlign = getEffectiveAlign(align, field?.type); 34893 return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 34894 "td", 34895 { 34896 style: { 34897 width, 34898 maxWidth, 34899 minWidth 34900 }, 34901 children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 34902 TableColumnField, 34903 { 34904 fields: fields2, 34905 item, 34906 column, 34907 align: effectiveAlign 34908 } 34909 ) 34910 }, 34911 column 34912 ); 34913 }), 34914 !!actions?.length && // Disable reason: we are not making the element interactive, 34915 // but preventing any click events from bubbling up to the 34916 // table row. This allows us to add a click handler to the row 34917 // itself (to toggle row selection) without erroneously 34918 // intercepting click events from ItemActions. 34919 /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 34920 "td", 34921 { 34922 className: clsx_default("dataviews-view-table__actions-column", { 34923 "dataviews-view-table__actions-column--sticky": true, 34924 "dataviews-view-table__actions-column--stuck": isActionsColumnSticky 34925 }), 34926 onClick: (e2) => e2.stopPropagation(), 34927 children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(ItemActions, { item, actions }) 34928 } 34929 ) 34930 ] 34931 } 34932 ); 34933 } 34934 function ViewTable({ 34935 actions, 34936 data, 34937 fields: fields2, 34938 getItemId: getItemId2, 34939 getItemLevel: getItemLevel2, 34940 isLoading = false, 34941 onChangeView, 34942 onChangeSelection, 34943 selection, 34944 setOpenedFilter, 34945 onClickItem, 34946 isItemClickable, 34947 renderItemLink, 34948 view, 34949 className, 34950 empty 34951 }) { 34952 const { containerRef } = (0, import_element97.useContext)(dataviews_context_default); 34953 const isDelayedLoading = useDelayedLoading(isLoading); 34954 const headerMenuRefs = (0, import_element97.useRef)(/* @__PURE__ */ new Map()); 34955 const headerMenuToFocusRef = (0, import_element97.useRef)(void 0); 34956 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element97.useState)(); 34957 const [contextMenuAnchor, setContextMenuAnchor] = (0, import_element97.useState)(null); 34958 (0, import_element97.useEffect)(() => { 34959 if (headerMenuToFocusRef.current) { 34960 headerMenuToFocusRef.current.focus(); 34961 headerMenuToFocusRef.current = void 0; 34962 } 34963 }); 34964 const tableNoticeId = (0, import_element97.useId)(); 34965 const { isHorizontalScrollEnd, isVerticallyScrolled } = useScrollState({ 34966 scrollContainerRef: containerRef, 34967 enabledHorizontal: !!actions?.length 34968 }); 34969 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 34970 if (nextHeaderMenuToFocus) { 34971 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 34972 setNextHeaderMenuToFocus(void 0); 34973 return; 34974 } 34975 const onHide = (field) => { 34976 const hidden = headerMenuRefs.current.get(field.id); 34977 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 34978 setNextHeaderMenuToFocus(fallback?.node); 34979 }; 34980 const handleHeaderContextMenu = (event) => { 34981 event.preventDefault(); 34982 event.stopPropagation(); 34983 const virtualAnchor = { 34984 getBoundingClientRect: () => ({ 34985 x: event.clientX, 34986 y: event.clientY, 34987 top: event.clientY, 34988 left: event.clientX, 34989 right: event.clientX, 34990 bottom: event.clientY, 34991 width: 0, 34992 height: 0, 34993 toJSON: () => ({}) 34994 }) 34995 }; 34996 window.requestAnimationFrame(() => { 34997 setContextMenuAnchor(virtualAnchor); 34998 }); 34999 }; 35000 const hasData = !!data?.length; 35001 const titleField = fields2.find((field) => field.id === view.titleField); 35002 const mediaField = fields2.find((field) => field.id === view.mediaField); 35003 const descriptionField2 = fields2.find( 35004 (field) => field.id === view.descriptionField 35005 ); 35006 const groupField = view.groupBy?.field ? fields2.find((f2) => f2.id === view.groupBy?.field) : null; 35007 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 35008 const { showTitle = true, showMedia = true, showDescription = true } = view; 35009 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription; 35010 const columns = view.fields ?? []; 35011 const headerMenuRef = (column, index2) => (node) => { 35012 if (node) { 35013 headerMenuRefs.current.set(column, { 35014 node, 35015 fallback: columns[index2 > 0 ? index2 - 1 : 1] 35016 }); 35017 } else { 35018 headerMenuRefs.current.delete(column); 35019 } 35020 }; 35021 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 35022 const isRtl = (0, import_i18n81.isRTL)(); 35023 if (!hasData) { 35024 return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35025 "div", 35026 { 35027 className: clsx_default("dataviews-no-results", { 35028 "is-refreshing": isDelayedLoading 35029 }), 35030 id: tableNoticeId, 35031 children: empty 35032 } 35033 ); 35034 } 35035 return /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)(import_jsx_runtime208.Fragment, { children: [ 35036 /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)( 35037 "table", 35038 { 35039 className: clsx_default("dataviews-view-table", className, { 35040 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 35041 view.layout.density 35042 ), 35043 "has-bulk-actions": hasBulkActions, 35044 "is-refreshing": !isInfiniteScroll && isDelayedLoading 35045 }), 35046 "aria-busy": isLoading, 35047 "aria-describedby": tableNoticeId, 35048 role: isInfiniteScroll ? "feed" : void 0, 35049 inert: !isInfiniteScroll && isLoading ? "true" : void 0, 35050 children: [ 35051 /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)("colgroup", { children: [ 35052 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("col", { className: "dataviews-view-table__col-checkbox" }), 35053 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("col", { className: "dataviews-view-table__col-first-data" }), 35054 columns.map((column, index2) => /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35055 "col", 35056 { 35057 className: clsx_default( 35058 `dataviews-view-table__col-$column}`, 35059 { 35060 "dataviews-view-table__col-expand": !hasPrimaryColumn && index2 === columns.length - 1 35061 } 35062 ) 35063 }, 35064 `col-$column}` 35065 )), 35066 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("col", { className: "dataviews-view-table__col-actions" }) 35067 ] }), 35068 contextMenuAnchor && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35069 import_components87.Popover, 35070 { 35071 anchor: contextMenuAnchor, 35072 onClose: () => setContextMenuAnchor(null), 35073 placement: "bottom-start", 35074 children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(PropertiesSection, { showLabel: false }) 35075 } 35076 ), 35077 /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35078 "thead", 35079 { 35080 className: clsx_default({ 35081 "dataviews-view-table__thead--stuck": isVerticallyScrolled 35082 }), 35083 onContextMenu: handleHeaderContextMenu, 35084 children: /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)("tr", { className: "dataviews-view-table__row", children: [ 35085 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35086 "th", 35087 { 35088 className: "dataviews-view-table__checkbox-column", 35089 scope: "col", 35090 onContextMenu: handleHeaderContextMenu, 35091 children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35092 BulkSelectionCheckbox, 35093 { 35094 selection, 35095 onChangeSelection, 35096 data, 35097 actions, 35098 getItemId: getItemId2 35099 } 35100 ) 35101 } 35102 ), 35103 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35104 column_header_menu_default, 35105 { 35106 ref: headerMenuRef( 35107 titleField.id, 35108 0 35109 ), 35110 fieldId: titleField.id, 35111 view, 35112 fields: fields2, 35113 onChangeView, 35114 onHide, 35115 setOpenedFilter, 35116 canMove: false, 35117 canInsertLeft: isRtl ? view.layout?.enableMoving ?? true : false, 35118 canInsertRight: isRtl ? false : view.layout?.enableMoving ?? true 35119 } 35120 ) }), 35121 columns.map((column, index2) => { 35122 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 35123 const field = fields2.find( 35124 (f2) => f2.id === column 35125 ); 35126 const effectiveAlign = getEffectiveAlign( 35127 align, 35128 field?.type 35129 ); 35130 const canInsertOrMove = view.layout?.enableMoving ?? true; 35131 return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35132 "th", 35133 { 35134 style: { 35135 width, 35136 maxWidth, 35137 minWidth, 35138 textAlign: effectiveAlign 35139 }, 35140 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 35141 scope: "col", 35142 children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35143 column_header_menu_default, 35144 { 35145 ref: headerMenuRef(column, index2), 35146 fieldId: column, 35147 view, 35148 fields: fields2, 35149 onChangeView, 35150 onHide, 35151 setOpenedFilter, 35152 canMove: canInsertOrMove, 35153 canInsertLeft: canInsertOrMove, 35154 canInsertRight: canInsertOrMove 35155 } 35156 ) 35157 }, 35158 column 35159 ); 35160 }), 35161 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35162 "th", 35163 { 35164 className: clsx_default( 35165 "dataviews-view-table__actions-column", 35166 { 35167 "dataviews-view-table__actions-column--sticky": true, 35168 "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd 35169 } 35170 ), 35171 children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("span", { className: "dataviews-view-table-header", children: (0, import_i18n81.__)("Actions") }) 35172 } 35173 ) 35174 ] }) 35175 } 35176 ), 35177 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 35178 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)("tbody", { children: [ 35179 /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35180 "td", 35181 { 35182 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0), 35183 className: "dataviews-view-table__group-header-cell", 35184 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n81.sprintf)( 35185 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 35186 (0, import_i18n81.__)("%1$s: %2$s"), 35187 groupField.label, 35188 groupName 35189 ) 35190 } 35191 ) }), 35192 groupItems.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35193 TableRow, 35194 { 35195 item, 35196 level: view.showLevels && typeof getItemLevel2 === "function" ? getItemLevel2(item) : void 0, 35197 hasBulkActions, 35198 actions, 35199 fields: fields2, 35200 id: getItemId2(item) || index2.toString(), 35201 view, 35202 titleField, 35203 mediaField, 35204 descriptionField: descriptionField2, 35205 selection, 35206 getItemId: getItemId2, 35207 onChangeSelection, 35208 onClickItem, 35209 renderItemLink, 35210 isItemClickable, 35211 isActionsColumnSticky: !isHorizontalScrollEnd 35212 }, 35213 getItemId2(item) 35214 )) 35215 ] }, `group-$groupName}`) 35216 ) : /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("tbody", { children: hasData && data.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 35217 TableRow, 35218 { 35219 item, 35220 level: view.showLevels && typeof getItemLevel2 === "function" ? getItemLevel2(item) : void 0, 35221 hasBulkActions, 35222 actions, 35223 fields: fields2, 35224 id: getItemId2(item) || index2.toString(), 35225 view, 35226 titleField, 35227 mediaField, 35228 descriptionField: descriptionField2, 35229 selection, 35230 getItemId: getItemId2, 35231 onChangeSelection, 35232 onClickItem, 35233 renderItemLink, 35234 isItemClickable, 35235 isActionsColumnSticky: !isHorizontalScrollEnd, 35236 posinset: isInfiniteScroll ? index2 + 1 : void 0 35237 }, 35238 getItemId2(item) 35239 )) }) 35240 ] 35241 } 35242 ), 35243 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("div", { className: "dataviews-loading", id: tableNoticeId, children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(import_components87.Spinner, {}) }) }) 35244 ] }); 35245 } 35246 var table_default = ViewTable; 35247 35248 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs 35249 var import_components90 = __toESM(require_components(), 1); 35250 var import_i18n84 = __toESM(require_i18n(), 1); 35251 35252 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs 35253 var import_components89 = __toESM(require_components(), 1); 35254 var import_i18n83 = __toESM(require_i18n(), 1); 35255 var import_compose13 = __toESM(require_compose(), 1); 35256 var import_keycodes7 = __toESM(require_keycodes(), 1); 35257 var import_element101 = __toESM(require_element(), 1); 35258 35259 // packages/dataviews/build-module/components/dataviews-layouts/grid/preview-size-picker.mjs 35260 var import_components88 = __toESM(require_components(), 1); 35261 var import_i18n82 = __toESM(require_i18n(), 1); 35262 var import_element98 = __toESM(require_element(), 1); 35263 var import_jsx_runtime209 = __toESM(require_jsx_runtime(), 1); 35264 var imageSizes = [ 35265 { 35266 value: 120, 35267 breakpoint: 1 35268 }, 35269 { 35270 value: 170, 35271 breakpoint: 1 35272 }, 35273 { 35274 value: 230, 35275 breakpoint: 1 35276 }, 35277 { 35278 value: 290, 35279 breakpoint: 1112 35280 // at minimum image width, 4 images display at this container size 35281 }, 35282 { 35283 value: 350, 35284 breakpoint: 1636 35285 // at minimum image width, 6 images display at this container size 35286 }, 35287 { 35288 value: 430, 35289 breakpoint: 588 35290 // at minimum image width, 2 images display at this container size 35291 } 35292 ]; 35293 var DEFAULT_PREVIEW_SIZE = imageSizes[2].value; 35294 function useGridColumns() { 35295 const context = (0, import_element98.useContext)(dataviews_context_default); 35296 const view = context.view; 35297 return (0, import_element98.useMemo)(() => { 35298 const containerWidth = context.containerWidth; 35299 const gap = 32; 35300 const previewSize = view.layout?.previewSize ?? DEFAULT_PREVIEW_SIZE; 35301 const columns = Math.floor( 35302 (containerWidth + gap) / (previewSize + gap) 35303 ); 35304 return Math.max(1, columns); 35305 }, [context.containerWidth, view.layout?.previewSize]); 35306 } 35307 35308 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-items.mjs 35309 var import_element99 = __toESM(require_element(), 1); 35310 var import_jsx_runtime210 = __toESM(require_jsx_runtime(), 1); 35311 var GridItems = (0, import_element99.forwardRef)(({ className, previewSize, ...props }, ref) => { 35312 return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)( 35313 "div", 35314 { 35315 ref, 35316 className: clsx_default("dataviews-view-grid-items", className), 35317 style: { 35318 gridTemplateColumns: previewSize && `repeat(auto-fill, minmax($previewSize}px, 1fr))` 35319 }, 35320 ...props 35321 } 35322 ); 35323 }); 35324 35325 // packages/dataviews/build-module/components/dataviews-layouts/utils/use-infinite-scroll.mjs 35326 var import_element100 = __toESM(require_element(), 1); 35327 function useIntersectionObserver(elementRef, posinset) { 35328 const { intersectionObserver } = (0, import_element100.useContext)(dataviews_context_default); 35329 (0, import_element100.useEffect)(() => { 35330 const element = elementRef.current; 35331 if (!element || posinset === void 0 || !intersectionObserver) { 35332 return; 35333 } 35334 intersectionObserver.observe(element); 35335 return () => { 35336 intersectionObserver.unobserve(element); 35337 }; 35338 }, [elementRef, intersectionObserver, posinset]); 35339 } 35340 function usePlaceholdersNeeded(data, isInfiniteScroll, gridColumns) { 35341 const hasData = !!data?.length; 35342 const firstItemPosition = hasData && isInfiniteScroll ? data[0].position : void 0; 35343 return firstItemPosition && gridColumns ? (firstItemPosition - 1) % gridColumns : 0; 35344 } 35345 35346 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs 35347 var import_jsx_runtime211 = __toESM(require_jsx_runtime(), 1); 35348 var { Badge: WCBadge } = unlock4(import_components89.privateApis); 35349 function chunk(array, size4) { 35350 const chunks = []; 35351 for (let i2 = 0, j2 = array.length; i2 < j2; i2 += size4) { 35352 chunks.push(array.slice(i2, i2 + size4)); 35353 } 35354 return chunks; 35355 } 35356 var GridItem = (0, import_element101.forwardRef)( 35357 function GridItem2({ 35358 view, 35359 selection, 35360 onChangeSelection, 35361 onClickItem, 35362 isItemClickable, 35363 renderItemLink, 35364 getItemId: getItemId2, 35365 item, 35366 actions, 35367 mediaField, 35368 titleField, 35369 descriptionField: descriptionField2, 35370 regularFields, 35371 badgeFields, 35372 hasBulkActions, 35373 config: config2, 35374 posinset, 35375 setsize, 35376 ...props 35377 }, forwardedRef) { 35378 const { 35379 showTitle = true, 35380 showMedia = true, 35381 showDescription = true 35382 } = view; 35383 const hasBulkAction = useHasAPossibleBulkAction(actions, item); 35384 const id = getItemId2(item); 35385 const elementRef = (0, import_element101.useRef)(null); 35386 const setRefs = (0, import_element101.useCallback)( 35387 (node) => { 35388 elementRef.current = node; 35389 if (typeof forwardedRef === "function") { 35390 forwardedRef(node); 35391 } else if (forwardedRef) { 35392 forwardedRef.current = node; 35393 } 35394 }, 35395 [forwardedRef] 35396 ); 35397 useIntersectionObserver(elementRef, posinset); 35398 const instanceId = (0, import_compose13.useInstanceId)(GridItem2); 35399 const isSelected2 = selection.includes(id); 35400 const mediaPlaceholder = /* @__PURE__ */ (0, import_jsx_runtime211.jsx)("span", { className: "dataviews-view-grid__media-placeholder" }); 35401 const rendersMediaField = showMedia && mediaField?.render; 35402 const renderedMediaField = rendersMediaField ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35403 mediaField.render, 35404 { 35405 item, 35406 field: mediaField, 35407 config: config2 35408 } 35409 ) : mediaPlaceholder; 35410 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(titleField.render, { item, field: titleField }) : null; 35411 let mediaA11yProps; 35412 let titleA11yProps; 35413 if (isItemClickable(item) && onClickItem) { 35414 if (renderedTitleField) { 35415 mediaA11yProps = { 35416 "aria-labelledby": `dataviews-view-grid__title-field-$instanceId}` 35417 }; 35418 titleA11yProps = { 35419 id: `dataviews-view-grid__title-field-$instanceId}` 35420 }; 35421 } else { 35422 mediaA11yProps = { 35423 "aria-label": (0, import_i18n83.__)("Navigate to item") 35424 }; 35425 } 35426 } 35427 return /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)( 35428 Stack, 35429 { 35430 direction: "column", 35431 ...props, 35432 ref: setRefs, 35433 "aria-setsize": setsize, 35434 "aria-posinset": posinset, 35435 className: clsx_default( 35436 props.className, 35437 "dataviews-view-grid__row__gridcell", 35438 "dataviews-view-grid__card", 35439 { 35440 "is-selected": hasBulkAction && isSelected2 35441 } 35442 ), 35443 onClickCapture: (event) => { 35444 props.onClickCapture?.(event); 35445 if ((0, import_keycodes7.isAppleOS)() ? event.metaKey : event.ctrlKey) { 35446 event.stopPropagation(); 35447 event.preventDefault(); 35448 if (!hasBulkAction) { 35449 return; 35450 } 35451 onChangeSelection( 35452 isSelected2 ? selection.filter( 35453 (itemId) => id !== itemId 35454 ) : [...selection, id] 35455 ); 35456 } 35457 }, 35458 children: [ 35459 /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35460 ItemClickWrapper, 35461 { 35462 item, 35463 isItemClickable, 35464 onClickItem, 35465 renderItemLink, 35466 className: clsx_default("dataviews-view-grid__media", { 35467 "dataviews-view-grid__media--placeholder": !rendersMediaField 35468 }), 35469 ...mediaA11yProps, 35470 children: renderedMediaField 35471 } 35472 ), 35473 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35474 DataViewsSelectionCheckbox, 35475 { 35476 item, 35477 selection, 35478 onChangeSelection, 35479 getItemId: getItemId2, 35480 titleField, 35481 disabled: !hasBulkAction 35482 } 35483 ), 35484 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35485 ItemActions, 35486 { 35487 item, 35488 actions, 35489 isCompact: true 35490 } 35491 ) }), 35492 showTitle && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)("div", { className: "dataviews-view-grid__title-actions", children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35493 ItemClickWrapper, 35494 { 35495 item, 35496 isItemClickable, 35497 onClickItem, 35498 renderItemLink, 35499 className: "dataviews-view-grid__title-field dataviews-title-field", 35500 ...titleA11yProps, 35501 title: titleField?.getValueFormatted({ 35502 item, 35503 field: titleField 35504 }) || void 0, 35505 children: renderedTitleField 35506 } 35507 ) }), 35508 /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 35509 showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35510 descriptionField2.render, 35511 { 35512 item, 35513 field: descriptionField2 35514 } 35515 ), 35516 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35517 Stack, 35518 { 35519 direction: "row", 35520 className: "dataviews-view-grid__badge-fields", 35521 gap: "sm", 35522 wrap: "wrap", 35523 align: "top", 35524 justify: "flex-start", 35525 children: badgeFields.map((field) => { 35526 return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35527 WCBadge, 35528 { 35529 className: "dataviews-view-grid__field-value", 35530 children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35531 field.render, 35532 { 35533 item, 35534 field 35535 } 35536 ) 35537 }, 35538 field.id 35539 ); 35540 }) 35541 } 35542 ), 35543 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35544 Stack, 35545 { 35546 direction: "column", 35547 className: "dataviews-view-grid__fields", 35548 gap: "xs", 35549 children: regularFields.map((field) => { 35550 return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35551 import_components89.Flex, 35552 { 35553 className: "dataviews-view-grid__field", 35554 gap: 1, 35555 justify: "flex-start", 35556 expanded: true, 35557 style: { height: "auto" }, 35558 direction: "row", 35559 children: /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(import_jsx_runtime211.Fragment, { children: [ 35560 /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(tooltip_exports.Root, { children: [ 35561 /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35562 tooltip_exports.Trigger, 35563 { 35564 render: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(import_components89.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) 35565 } 35566 ), 35567 /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(tooltip_exports.Popup, { children: field.label }) 35568 ] }), 35569 /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35570 import_components89.FlexItem, 35571 { 35572 className: "dataviews-view-grid__field-value", 35573 style: { maxHeight: "none" }, 35574 children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35575 field.render, 35576 { 35577 item, 35578 field 35579 } 35580 ) 35581 } 35582 ) 35583 ] }) 35584 }, 35585 field.id 35586 ); 35587 }) 35588 } 35589 ) 35590 ] }) 35591 ] 35592 } 35593 ); 35594 } 35595 ); 35596 function CompositeGrid({ 35597 data, 35598 isInfiniteScroll, 35599 className, 35600 inert, 35601 isLoading, 35602 view, 35603 fields: fields2, 35604 selection, 35605 onChangeSelection, 35606 onClickItem, 35607 isItemClickable, 35608 renderItemLink, 35609 getItemId: getItemId2, 35610 actions 35611 }) { 35612 const { paginationInfo, resizeObserverRef } = (0, import_element101.useContext)(dataviews_context_default); 35613 const gridColumns = useGridColumns(); 35614 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 35615 const titleField = fields2.find( 35616 (field) => field.id === view?.titleField 35617 ); 35618 const mediaField = fields2.find( 35619 (field) => field.id === view?.mediaField 35620 ); 35621 const descriptionField2 = fields2.find( 35622 (field) => field.id === view?.descriptionField 35623 ); 35624 const otherFields = view.fields ?? []; 35625 const { regularFields, badgeFields } = otherFields.reduce( 35626 (accumulator, fieldId) => { 35627 const field = fields2.find((f2) => f2.id === fieldId); 35628 if (!field) { 35629 return accumulator; 35630 } 35631 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 35632 accumulator[key].push(field); 35633 return accumulator; 35634 }, 35635 { regularFields: [], badgeFields: [] } 35636 ); 35637 const size4 = "900px"; 35638 const totalRows = Math.ceil(data.length / gridColumns); 35639 const placeholdersNeeded = usePlaceholdersNeeded( 35640 data, 35641 isInfiniteScroll, 35642 gridColumns 35643 ); 35644 return /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(import_jsx_runtime211.Fragment, { 35645 // Render infinite scroll layout (no rows, feed semantics) 35646 children: [ 35647 isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)( 35648 import_components89.Composite, 35649 { 35650 render: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35651 GridItems, 35652 { 35653 className: clsx_default( 35654 "dataviews-view-grid-infinite-scroll", 35655 className, 35656 { 35657 [`has-$view.layout?.density}-density`]: view.layout?.density && [ 35658 "compact", 35659 "comfortable" 35660 ].includes(view.layout.density) 35661 } 35662 ), 35663 previewSize: view.layout?.previewSize, 35664 "aria-busy": isLoading, 35665 ref: resizeObserverRef 35666 } 35667 ), 35668 role: "feed", 35669 focusWrap: true, 35670 inert, 35671 children: [ 35672 Array.from({ length: placeholdersNeeded }).map( 35673 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35674 import_components89.Composite.Item, 35675 { 35676 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35677 Stack, 35678 { 35679 ...props, 35680 direction: "column", 35681 role: "article", 35682 className: "dataviews-view-grid__row__gridcell dataviews-view-grid__card dataviews-view-grid__placeholder" 35683 } 35684 ), 35685 "aria-hidden": true, 35686 tabIndex: -1 35687 }, 35688 `placeholder-$index2}` 35689 ) 35690 ), 35691 data.map((item) => { 35692 const itemId = getItemId2(item); 35693 const stablePosition = item.position; 35694 return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35695 import_components89.Composite.Item, 35696 { 35697 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35698 GridItem, 35699 { 35700 ...props, 35701 id: itemId, 35702 role: "article", 35703 view, 35704 selection, 35705 onChangeSelection, 35706 onClickItem, 35707 isItemClickable, 35708 renderItemLink, 35709 getItemId: getItemId2, 35710 item, 35711 actions, 35712 mediaField, 35713 titleField, 35714 descriptionField: descriptionField2, 35715 regularFields, 35716 badgeFields, 35717 hasBulkActions, 35718 posinset: stablePosition, 35719 setsize: paginationInfo.totalItems, 35720 config: { 35721 sizes: size4 35722 } 35723 } 35724 ) 35725 }, 35726 itemId 35727 ); 35728 }) 35729 ] 35730 } 35731 ), 35732 // Render standard grid layout (with rows, grid semantics) 35733 !isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35734 import_components89.Composite, 35735 { 35736 role: "grid", 35737 className: clsx_default("dataviews-view-grid", className, { 35738 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 35739 view.layout.density 35740 ) 35741 }), 35742 focusWrap: true, 35743 "aria-busy": isLoading, 35744 "aria-rowcount": totalRows, 35745 ref: resizeObserverRef, 35746 inert, 35747 children: chunk(data, gridColumns).map((row, i2) => /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35748 import_components89.Composite.Row, 35749 { 35750 render: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35751 "div", 35752 { 35753 role: "row", 35754 "aria-rowindex": i2 + 1, 35755 "aria-label": (0, import_i18n83.sprintf)( 35756 /* translators: %d: The row number in the grid */ 35757 (0, import_i18n83.__)("Row %d"), 35758 i2 + 1 35759 ), 35760 className: "dataviews-view-grid__row", 35761 style: { 35762 gridTemplateColumns: `repeat( $gridColumns}, minmax(0, 1fr) )` 35763 } 35764 } 35765 ), 35766 children: row.map((item) => { 35767 const itemId = getItemId2(item); 35768 return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35769 import_components89.Composite.Item, 35770 { 35771 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 35772 GridItem, 35773 { 35774 ...props, 35775 id: itemId, 35776 role: "gridcell", 35777 view, 35778 selection, 35779 onChangeSelection, 35780 onClickItem, 35781 isItemClickable, 35782 renderItemLink, 35783 getItemId: getItemId2, 35784 item, 35785 actions, 35786 mediaField, 35787 titleField, 35788 descriptionField: descriptionField2, 35789 regularFields, 35790 badgeFields, 35791 hasBulkActions, 35792 config: { 35793 sizes: size4 35794 } 35795 } 35796 ) 35797 }, 35798 itemId 35799 ); 35800 }) 35801 }, 35802 i2 35803 )) 35804 } 35805 ) 35806 ] 35807 }); 35808 } 35809 35810 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs 35811 var import_jsx_runtime212 = __toESM(require_jsx_runtime(), 1); 35812 function ViewGrid({ 35813 actions, 35814 data, 35815 fields: fields2, 35816 getItemId: getItemId2, 35817 isLoading, 35818 onChangeSelection, 35819 onClickItem, 35820 isItemClickable, 35821 renderItemLink, 35822 selection, 35823 view, 35824 className, 35825 empty 35826 }) { 35827 const isDelayedLoading = useDelayedLoading(!!isLoading); 35828 const hasData = !!data?.length; 35829 const groupField = view.groupBy?.field ? fields2.find((f2) => f2.id === view.groupBy?.field) : null; 35830 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 35831 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 35832 if (!hasData) { 35833 return /* @__PURE__ */ (0, import_jsx_runtime212.jsx)( 35834 "div", 35835 { 35836 className: clsx_default("dataviews-no-results", { 35837 "is-refreshing": isDelayedLoading 35838 }), 35839 children: empty 35840 } 35841 ); 35842 } 35843 const gridProps = { 35844 className: clsx_default(className, { 35845 "is-refreshing": !isInfiniteScroll && isDelayedLoading 35846 }), 35847 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0, 35848 isLoading, 35849 view, 35850 fields: fields2, 35851 selection, 35852 onChangeSelection, 35853 onClickItem, 35854 isItemClickable, 35855 renderItemLink, 35856 getItemId: getItemId2, 35857 actions 35858 }; 35859 return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_jsx_runtime212.Fragment, { 35860 // Render multiple groups. 35861 children: [ 35862 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(Stack, { direction: "column", gap: "lg", children: Array.from(dataByGroup.entries()).map( 35863 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)( 35864 Stack, 35865 { 35866 direction: "column", 35867 gap: "sm", 35868 children: [ 35869 /* @__PURE__ */ (0, import_jsx_runtime212.jsx)("h3", { className: "dataviews-view-grid__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n84.sprintf)( 35870 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 35871 (0, import_i18n84.__)("%1$s: %2$s"), 35872 groupField.label, 35873 groupName 35874 ) }), 35875 /* @__PURE__ */ (0, import_jsx_runtime212.jsx)( 35876 CompositeGrid, 35877 { 35878 ...gridProps, 35879 data: groupItems, 35880 isInfiniteScroll: false 35881 } 35882 ) 35883 ] 35884 }, 35885 groupName 35886 ) 35887 ) }), 35888 // Render a single grid with all data. 35889 !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)( 35890 CompositeGrid, 35891 { 35892 ...gridProps, 35893 data, 35894 isInfiniteScroll: !!isInfiniteScroll 35895 } 35896 ), 35897 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(import_components90.Spinner, {}) }) 35898 ] 35899 }); 35900 } 35901 var grid_default = ViewGrid; 35902 35903 // packages/dataviews/build-module/components/dataviews-layouts/list/index.mjs 35904 var import_compose14 = __toESM(require_compose(), 1); 35905 var import_components91 = __toESM(require_components(), 1); 35906 var import_element102 = __toESM(require_element(), 1); 35907 var import_i18n85 = __toESM(require_i18n(), 1); 35908 var import_data51 = __toESM(require_data(), 1); 35909 var import_jsx_runtime213 = __toESM(require_jsx_runtime(), 1); 35910 var { Menu: Menu7 } = unlock4(import_components91.privateApis); 35911 function generateItemWrapperCompositeId(idPrefix) { 35912 return `$idPrefix}-item-wrapper`; 35913 } 35914 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 35915 return `$idPrefix}-primary-action-$primaryActionId}`; 35916 } 35917 function generateDropdownTriggerCompositeId(idPrefix) { 35918 return `$idPrefix}-dropdown`; 35919 } 35920 function PrimaryActionGridCell({ 35921 idPrefix, 35922 primaryAction, 35923 item 35924 }) { 35925 const registry = (0, import_data51.useRegistry)(); 35926 const [isModalOpen, setIsModalOpen] = (0, import_element102.useState)(false); 35927 const compositeItemId = generatePrimaryActionCompositeId( 35928 idPrefix, 35929 primaryAction.id 35930 ); 35931 const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]); 35932 return "RenderModal" in primaryAction ? /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 35933 import_components91.Composite.Item, 35934 { 35935 id: compositeItemId, 35936 render: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 35937 import_components91.Button, 35938 { 35939 disabled: !!primaryAction.disabled, 35940 accessibleWhenDisabled: true, 35941 text: label, 35942 size: "small", 35943 onClick: () => setIsModalOpen(true) 35944 } 35945 ), 35946 children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 35947 ActionModal, 35948 { 35949 action: primaryAction, 35950 items: [item], 35951 closeModal: () => setIsModalOpen(false) 35952 } 35953 ) 35954 } 35955 ) }, primaryAction.id) : /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 35956 import_components91.Composite.Item, 35957 { 35958 id: compositeItemId, 35959 render: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 35960 import_components91.Button, 35961 { 35962 disabled: !!primaryAction.disabled, 35963 accessibleWhenDisabled: true, 35964 size: "small", 35965 onClick: () => { 35966 primaryAction.callback([item], { registry }); 35967 }, 35968 children: label 35969 } 35970 ) 35971 } 35972 ) }, primaryAction.id); 35973 } 35974 function ListItem({ 35975 view, 35976 actions, 35977 idPrefix, 35978 isSelected: isSelected2, 35979 item, 35980 titleField, 35981 mediaField, 35982 descriptionField: descriptionField2, 35983 onSelect, 35984 otherFields, 35985 onDropdownTriggerKeyDown, 35986 posinset 35987 }) { 35988 const { 35989 showTitle = true, 35990 showMedia = true, 35991 showDescription = true, 35992 infiniteScrollEnabled 35993 } = view; 35994 const itemRef = (0, import_element102.useRef)(null); 35995 const labelId = `$idPrefix}-label`; 35996 const descriptionId = `$idPrefix}-description`; 35997 const registry = (0, import_data51.useRegistry)(); 35998 const [isHovered, setIsHovered] = (0, import_element102.useState)(false); 35999 const [activeModalAction, setActiveModalAction] = (0, import_element102.useState)( 36000 null 36001 ); 36002 const handleHover = ({ type }) => { 36003 const isHover = type === "mouseenter"; 36004 setIsHovered(isHover); 36005 }; 36006 const { paginationInfo } = (0, import_element102.useContext)(dataviews_context_default); 36007 (0, import_element102.useEffect)(() => { 36008 if (isSelected2) { 36009 itemRef.current?.scrollIntoView({ 36010 behavior: "auto", 36011 block: "nearest", 36012 inline: "nearest" 36013 }); 36014 } 36015 }, [isSelected2]); 36016 const { primaryAction, eligibleActions } = (0, import_element102.useMemo)(() => { 36017 const _eligibleActions = actions.filter( 36018 (action) => !action.isEligible || action.isEligible(item) 36019 ); 36020 const _primaryActions = _eligibleActions.filter( 36021 (action) => action.isPrimary 36022 ); 36023 return { 36024 primaryAction: _primaryActions[0], 36025 eligibleActions: _eligibleActions 36026 }; 36027 }, [actions, item]); 36028 const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; 36029 const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36030 mediaField.render, 36031 { 36032 item, 36033 field: mediaField, 36034 config: { sizes: "52px" } 36035 } 36036 ) }) : null; 36037 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(titleField.render, { item, field: titleField }) : null; 36038 const renderDescription = showDescription && descriptionField2?.render; 36039 const hasOnlyMediaAndTitle = !!renderedMediaField && !renderDescription && !otherFields.length; 36040 const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)( 36041 Stack, 36042 { 36043 direction: "row", 36044 gap: "md", 36045 className: "dataviews-view-list__item-actions", 36046 children: [ 36047 primaryAction && /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36048 PrimaryActionGridCell, 36049 { 36050 idPrefix, 36051 primaryAction, 36052 item 36053 } 36054 ), 36055 !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)("div", { role: "gridcell", children: [ 36056 /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(Menu7, { placement: "bottom-end", children: [ 36057 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36058 Menu7.TriggerButton, 36059 { 36060 render: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36061 import_components91.Composite.Item, 36062 { 36063 id: generateDropdownTriggerCompositeId( 36064 idPrefix 36065 ), 36066 render: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36067 import_components91.Button, 36068 { 36069 size: "small", 36070 icon: more_vertical_default, 36071 label: (0, import_i18n85.__)("Actions"), 36072 accessibleWhenDisabled: true, 36073 disabled: !actions.length, 36074 onKeyDown: onDropdownTriggerKeyDown 36075 } 36076 ) 36077 } 36078 ) 36079 } 36080 ), 36081 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(Menu7.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36082 ActionsMenuGroup, 36083 { 36084 actions: eligibleActions, 36085 item, 36086 registry, 36087 setActiveModalAction 36088 } 36089 ) }) 36090 ] }), 36091 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36092 ActionModal, 36093 { 36094 action: activeModalAction, 36095 items: [item], 36096 closeModal: () => setActiveModalAction(null) 36097 } 36098 ) 36099 ] }) 36100 ] 36101 } 36102 ); 36103 return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36104 import_components91.Composite.Row, 36105 { 36106 ref: itemRef, 36107 render: ( 36108 /* aria-posinset breaks Composite.Row if passed to it directly. */ 36109 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36110 "div", 36111 { 36112 "aria-posinset": posinset, 36113 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0 36114 } 36115 ) 36116 ), 36117 role: infiniteScrollEnabled ? "article" : "row", 36118 className: clsx_default({ 36119 "is-selected": isSelected2, 36120 "is-hovered": isHovered 36121 }), 36122 onMouseEnter: handleHover, 36123 onMouseLeave: handleHover, 36124 children: /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)( 36125 Stack, 36126 { 36127 direction: "row", 36128 className: "dataviews-view-list__item-wrapper", 36129 children: [ 36130 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36131 import_components91.Composite.Item, 36132 { 36133 id: generateItemWrapperCompositeId(idPrefix), 36134 "aria-pressed": isSelected2, 36135 "aria-labelledby": labelId, 36136 "aria-describedby": descriptionId, 36137 className: "dataviews-view-list__item", 36138 onClick: () => onSelect(item) 36139 } 36140 ) }), 36141 /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)( 36142 Stack, 36143 { 36144 direction: "row", 36145 gap: "md", 36146 justify: "start", 36147 align: hasOnlyMediaAndTitle ? "center" : "flex-start", 36148 style: { flex: 1, minWidth: 0 }, 36149 children: [ 36150 renderedMediaField, 36151 /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)( 36152 Stack, 36153 { 36154 direction: "column", 36155 gap: "xs", 36156 className: "dataviews-view-list__field-wrapper", 36157 children: [ 36158 /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(Stack, { direction: "row", align: "center", children: [ 36159 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36160 "div", 36161 { 36162 className: "dataviews-title-field dataviews-view-list__title-field", 36163 id: labelId, 36164 children: renderedTitleField 36165 } 36166 ), 36167 usedActions 36168 ] }), 36169 renderDescription && /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36170 descriptionField2.render, 36171 { 36172 item, 36173 field: descriptionField2 36174 } 36175 ) }), 36176 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36177 "div", 36178 { 36179 className: "dataviews-view-list__fields", 36180 id: descriptionId, 36181 children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)( 36182 "div", 36183 { 36184 className: "dataviews-view-list__field", 36185 children: [ 36186 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36187 VisuallyHidden, 36188 { 36189 className: "dataviews-view-list__field-label", 36190 render: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("span", {}), 36191 children: field.label 36192 } 36193 ), 36194 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36195 field.render, 36196 { 36197 item, 36198 field 36199 } 36200 ) }) 36201 ] 36202 }, 36203 field.id 36204 )) 36205 } 36206 ) 36207 ] 36208 } 36209 ) 36210 ] 36211 } 36212 ) 36213 ] 36214 } 36215 ) 36216 } 36217 ); 36218 } 36219 function isDefined2(item) { 36220 return !!item; 36221 } 36222 function ViewList(props) { 36223 const { 36224 actions, 36225 data, 36226 fields: fields2, 36227 getItemId: getItemId2, 36228 isLoading, 36229 onChangeSelection, 36230 selection, 36231 view, 36232 className, 36233 empty 36234 } = props; 36235 const baseId = (0, import_compose14.useInstanceId)(ViewList, "view-list"); 36236 const isDelayedLoading = useDelayedLoading(!!isLoading); 36237 const selectedItem = data?.findLast( 36238 (item) => selection.includes(getItemId2(item)) 36239 ); 36240 const titleField = fields2.find((field) => field.id === view.titleField); 36241 const mediaField = fields2.find((field) => field.id === view.mediaField); 36242 const descriptionField2 = fields2.find( 36243 (field) => field.id === view.descriptionField 36244 ); 36245 const otherFields = (view?.fields ?? []).map((fieldId) => fields2.find((f2) => fieldId === f2.id)).filter(isDefined2); 36246 const onSelect = (item) => onChangeSelection([getItemId2(item)]); 36247 const generateCompositeItemIdPrefix = (0, import_element102.useCallback)( 36248 (item) => `$baseId}-$getItemId2(item)}`, 36249 [baseId, getItemId2] 36250 ); 36251 const isActiveCompositeItem = (0, import_element102.useCallback)( 36252 (item, idToCheck) => { 36253 return idToCheck.startsWith( 36254 generateCompositeItemIdPrefix(item) 36255 ); 36256 }, 36257 [generateCompositeItemIdPrefix] 36258 ); 36259 const [activeCompositeId, setActiveCompositeId] = (0, import_element102.useState)(void 0); 36260 const compositeRef = (0, import_element102.useRef)(null); 36261 (0, import_element102.useEffect)(() => { 36262 if (selectedItem) { 36263 setActiveCompositeId( 36264 generateItemWrapperCompositeId( 36265 generateCompositeItemIdPrefix(selectedItem) 36266 ) 36267 ); 36268 } 36269 }, [selectedItem, generateCompositeItemIdPrefix]); 36270 const activeItemIndex = data.findIndex( 36271 (item) => isActiveCompositeItem(item, activeCompositeId ?? "") 36272 ); 36273 const previousActiveItemIndex = (0, import_compose14.usePrevious)(activeItemIndex); 36274 const isActiveIdInList = activeItemIndex !== -1; 36275 const selectCompositeItem = (0, import_element102.useCallback)( 36276 (targetIndex, generateCompositeId) => { 36277 const clampedIndex = Math.min( 36278 data.length - 1, 36279 Math.max(0, targetIndex) 36280 ); 36281 if (!data[clampedIndex]) { 36282 return; 36283 } 36284 const itemIdPrefix = generateCompositeItemIdPrefix( 36285 data[clampedIndex] 36286 ); 36287 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 36288 setActiveCompositeId(targetCompositeItemId); 36289 if (compositeRef.current?.contains( 36290 compositeRef.current.ownerDocument.activeElement 36291 )) { 36292 document.getElementById(targetCompositeItemId)?.focus(); 36293 } 36294 }, 36295 [data, generateCompositeItemIdPrefix] 36296 ); 36297 (0, import_element102.useEffect)(() => { 36298 const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1; 36299 if (!isActiveIdInList && wasActiveIdInList) { 36300 selectCompositeItem( 36301 previousActiveItemIndex, 36302 generateItemWrapperCompositeId 36303 ); 36304 } 36305 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 36306 const onDropdownTriggerKeyDown = (0, import_element102.useCallback)( 36307 (event) => { 36308 if (event.key === "ArrowDown") { 36309 event.preventDefault(); 36310 selectCompositeItem( 36311 activeItemIndex + 1, 36312 generateDropdownTriggerCompositeId 36313 ); 36314 } 36315 if (event.key === "ArrowUp") { 36316 event.preventDefault(); 36317 selectCompositeItem( 36318 activeItemIndex - 1, 36319 generateDropdownTriggerCompositeId 36320 ); 36321 } 36322 }, 36323 [selectCompositeItem, activeItemIndex] 36324 ); 36325 const hasData = !!data?.length; 36326 const groupField = view.groupBy?.field ? fields2.find((field) => field.id === view.groupBy?.field) : null; 36327 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null; 36328 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 36329 if (!hasData) { 36330 return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36331 "div", 36332 { 36333 className: clsx_default("dataviews-no-results", { 36334 "is-refreshing": isDelayedLoading 36335 }), 36336 children: empty 36337 } 36338 ); 36339 } 36340 if (hasData && groupField && dataByGroup) { 36341 return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36342 import_components91.Composite, 36343 { 36344 ref: compositeRef, 36345 id: `$baseId}`, 36346 render: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", {}), 36347 className: "dataviews-view-list__group", 36348 role: "grid", 36349 activeId: activeCompositeId, 36350 setActiveId: setActiveCompositeId, 36351 children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36352 Stack, 36353 { 36354 direction: "column", 36355 gap: "lg", 36356 className: clsx_default("dataviews-view-list", className), 36357 children: Array.from(dataByGroup.entries()).map( 36358 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)( 36359 Stack, 36360 { 36361 direction: "column", 36362 gap: "sm", 36363 children: [ 36364 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("h3", { className: "dataviews-view-list__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n85.sprintf)( 36365 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 36366 (0, import_i18n85.__)("%1$s: %2$s"), 36367 groupField.label, 36368 groupName 36369 ) }), 36370 groupItems.map((item) => { 36371 const id = generateCompositeItemIdPrefix(item); 36372 return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36373 ListItem, 36374 { 36375 view, 36376 idPrefix: id, 36377 actions, 36378 item, 36379 isSelected: item === selectedItem, 36380 onSelect, 36381 mediaField, 36382 titleField, 36383 descriptionField: descriptionField2, 36384 otherFields, 36385 onDropdownTriggerKeyDown 36386 }, 36387 id 36388 ); 36389 }) 36390 ] 36391 }, 36392 groupName 36393 ) 36394 ) 36395 } 36396 ) 36397 } 36398 ); 36399 } 36400 return /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(import_jsx_runtime213.Fragment, { children: [ 36401 /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36402 import_components91.Composite, 36403 { 36404 ref: compositeRef, 36405 id: baseId, 36406 render: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", {}), 36407 className: clsx_default("dataviews-view-list", className, { 36408 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 36409 view.layout.density 36410 ), 36411 "is-refreshing": !isInfiniteScroll && isDelayedLoading 36412 }), 36413 role: view.infiniteScrollEnabled ? "feed" : "grid", 36414 activeId: activeCompositeId, 36415 setActiveId: setActiveCompositeId, 36416 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0, 36417 children: data.map((item, index2) => { 36418 const id = generateCompositeItemIdPrefix(item); 36419 return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 36420 ListItem, 36421 { 36422 view, 36423 idPrefix: id, 36424 actions, 36425 item, 36426 isSelected: item === selectedItem, 36427 onSelect, 36428 mediaField, 36429 titleField, 36430 descriptionField: descriptionField2, 36431 otherFields, 36432 onDropdownTriggerKeyDown, 36433 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0 36434 }, 36435 id 36436 ); 36437 }) 36438 } 36439 ), 36440 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(import_components91.Spinner, {}) }) 36441 ] }); 36442 } 36443 36444 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs 36445 var import_components92 = __toESM(require_components(), 1); 36446 36447 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-group.mjs 36448 var import_i18n86 = __toESM(require_i18n(), 1); 36449 var import_element103 = __toESM(require_element(), 1); 36450 var import_jsx_runtime214 = __toESM(require_jsx_runtime(), 1); 36451 function ActivityGroup({ 36452 groupName, 36453 groupData, 36454 groupField, 36455 showLabel = true, 36456 children 36457 }) { 36458 const groupHeader = showLabel ? (0, import_element103.createInterpolateElement)( 36459 // translators: %s: The label of the field e.g. "Status". 36460 (0, import_i18n86.sprintf)((0, import_i18n86.__)("%s: <groupName />"), groupField.label).trim(), 36461 { 36462 groupName: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)( 36463 groupField.render, 36464 { 36465 item: groupData[0], 36466 field: groupField 36467 } 36468 ) 36469 } 36470 ) : /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(groupField.render, { item: groupData[0], field: groupField }); 36471 return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)( 36472 Stack, 36473 { 36474 direction: "column", 36475 className: "dataviews-view-activity__group", 36476 children: [ 36477 /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("h3", { className: "dataviews-view-activity__group-header", children: groupHeader }), 36478 children 36479 ] 36480 }, 36481 groupName 36482 ); 36483 } 36484 36485 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-item.mjs 36486 var import_element104 = __toESM(require_element(), 1); 36487 var import_data52 = __toESM(require_data(), 1); 36488 var import_compose15 = __toESM(require_compose(), 1); 36489 var import_jsx_runtime215 = __toESM(require_jsx_runtime(), 1); 36490 function ActivityItem(props) { 36491 const { 36492 view, 36493 actions, 36494 item, 36495 titleField, 36496 mediaField, 36497 descriptionField: descriptionField2, 36498 otherFields, 36499 posinset, 36500 onClickItem, 36501 renderItemLink, 36502 isItemClickable 36503 } = props; 36504 const { 36505 showTitle = true, 36506 showMedia = true, 36507 showDescription = true, 36508 infiniteScrollEnabled 36509 } = view; 36510 const itemRef = (0, import_element104.useRef)(null); 36511 const registry = (0, import_data52.useRegistry)(); 36512 const { paginationInfo } = (0, import_element104.useContext)(dataviews_context_default); 36513 const { primaryActions, eligibleActions } = (0, import_element104.useMemo)(() => { 36514 const _eligibleActions = actions.filter( 36515 (action) => !action.isEligible || action.isEligible(item) 36516 ); 36517 const _primaryActions = _eligibleActions.filter( 36518 (action) => action.isPrimary 36519 ); 36520 return { 36521 primaryActions: _primaryActions, 36522 eligibleActions: _eligibleActions 36523 }; 36524 }, [actions, item]); 36525 const isMobileViewport = (0, import_compose15.useViewportMatch)("medium", "<"); 36526 const density = view.layout?.density ?? "balanced"; 36527 const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36528 mediaField.render, 36529 { 36530 item, 36531 field: mediaField, 36532 config: { 36533 sizes: density === "comfortable" ? "32px" : "24px" 36534 } 36535 } 36536 ) : null; 36537 const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("div", { className: "dataviews-view-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36538 "span", 36539 { 36540 className: "dataviews-view-activity__item-bullet", 36541 "aria-hidden": "true" 36542 } 36543 ) }); 36544 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(titleField.render, { item, field: titleField }) : null; 36545 const verticalGap = (0, import_element104.useMemo)(() => { 36546 switch (density) { 36547 case "comfortable": 36548 return "md"; 36549 default: 36550 return "sm"; 36551 } 36552 }, [density]); 36553 return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36554 "div", 36555 { 36556 ref: itemRef, 36557 role: infiniteScrollEnabled ? "article" : void 0, 36558 "aria-posinset": posinset, 36559 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 36560 className: clsx_default( 36561 "dataviews-view-activity__item", 36562 density === "compact" && "is-compact", 36563 density === "balanced" && "is-balanced", 36564 density === "comfortable" && "is-comfortable" 36565 ), 36566 children: /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [ 36567 /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36568 Stack, 36569 { 36570 direction: "column", 36571 gap: "xs", 36572 align: "center", 36573 className: "dataviews-view-activity__item-type", 36574 children: renderedMediaField 36575 } 36576 ), 36577 /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)( 36578 Stack, 36579 { 36580 direction: "column", 36581 gap: verticalGap, 36582 align: "flex-start", 36583 className: "dataviews-view-activity__item-content", 36584 children: [ 36585 renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36586 ItemClickWrapper, 36587 { 36588 item, 36589 isItemClickable, 36590 onClickItem, 36591 renderItemLink, 36592 className: "dataviews-view-activity__item-title", 36593 children: renderedTitleField 36594 } 36595 ), 36596 showDescription && descriptionField2 && /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("div", { className: "dataviews-view-activity__item-description", children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36597 descriptionField2.render, 36598 { 36599 item, 36600 field: descriptionField2 36601 } 36602 ) }), 36603 /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("div", { className: "dataviews-view-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)( 36604 "div", 36605 { 36606 className: "dataviews-view-activity__item-field", 36607 children: [ 36608 /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36609 VisuallyHidden, 36610 { 36611 className: "dataviews-view-activity__item-field-label", 36612 render: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("span", {}), 36613 children: field.label 36614 } 36615 ), 36616 /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("span", { className: "dataviews-view-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36617 field.render, 36618 { 36619 item, 36620 field 36621 } 36622 ) }) 36623 ] 36624 }, 36625 field.id 36626 )) }), 36627 !!primaryActions?.length && /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36628 PrimaryActions, 36629 { 36630 item, 36631 actions: primaryActions, 36632 registry, 36633 buttonVariant: "secondary" 36634 } 36635 ) 36636 ] 36637 } 36638 ), 36639 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu 36640 // there if there are any actions at all. 36641 isMobileViewport && // At the same time, only show the menu if there are actions to show. 36642 eligibleActions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("div", { className: "dataviews-view-activity__item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 36643 ItemActions, 36644 { 36645 item, 36646 actions: eligibleActions, 36647 isCompact: true 36648 } 36649 ) }) 36650 ] }) 36651 } 36652 ); 36653 } 36654 var activity_item_default = ActivityItem; 36655 36656 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-items.mjs 36657 var import_react14 = __toESM(require_react(), 1); 36658 function isDefined3(item) { 36659 return !!item; 36660 } 36661 function ActivityItems(props) { 36662 const { data, fields: fields2, getItemId: getItemId2, view } = props; 36663 const titleField = fields2.find((field) => field.id === view.titleField); 36664 const mediaField = fields2.find((field) => field.id === view.mediaField); 36665 const descriptionField2 = fields2.find( 36666 (field) => field.id === view.descriptionField 36667 ); 36668 const otherFields = (view?.fields ?? []).map((fieldId) => fields2.find((f2) => fieldId === f2.id)).filter(isDefined3); 36669 return data.map((item, index2) => { 36670 return /* @__PURE__ */ (0, import_react14.createElement)( 36671 activity_item_default, 36672 { 36673 ...props, 36674 key: getItemId2(item), 36675 item, 36676 mediaField, 36677 titleField, 36678 descriptionField: descriptionField2, 36679 otherFields, 36680 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0 36681 } 36682 ); 36683 }); 36684 } 36685 36686 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs 36687 var import_jsx_runtime216 = __toESM(require_jsx_runtime(), 1); 36688 function ViewActivity(props) { 36689 const { empty, data, fields: fields2, isLoading, view, className } = props; 36690 const isDelayedLoading = useDelayedLoading(!!isLoading); 36691 const hasData = !!data?.length; 36692 const groupField = view.groupBy?.field ? fields2.find((field) => field.id === view.groupBy?.field) : null; 36693 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null; 36694 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 36695 if (!hasData) { 36696 return /* @__PURE__ */ (0, import_jsx_runtime216.jsx)( 36697 "div", 36698 { 36699 className: clsx_default("dataviews-no-results", { 36700 "is-refreshing": isDelayedLoading 36701 }), 36702 children: empty 36703 } 36704 ); 36705 } 36706 const isInert = !isInfiniteScroll && !!isLoading; 36707 const wrapperClassName = clsx_default("dataviews-view-activity", className, { 36708 "is-refreshing": !isInfiniteScroll && isDelayedLoading 36709 }); 36710 const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : []; 36711 if (hasData && groupField && dataByGroup) { 36712 return /* @__PURE__ */ (0, import_jsx_runtime216.jsx)( 36713 Stack, 36714 { 36715 direction: "column", 36716 gap: "sm", 36717 className: wrapperClassName, 36718 inert: isInert ? "true" : void 0, 36719 children: groupedEntries.map( 36720 ([groupName, groupData]) => /* @__PURE__ */ (0, import_jsx_runtime216.jsx)( 36721 ActivityGroup, 36722 { 36723 groupName, 36724 groupData, 36725 groupField, 36726 showLabel: view.groupBy?.showLabel !== false, 36727 children: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)( 36728 ActivityItems, 36729 { 36730 ...props, 36731 data: groupData 36732 } 36733 ) 36734 }, 36735 groupName 36736 ) 36737 ) 36738 } 36739 ); 36740 } 36741 return /* @__PURE__ */ (0, import_jsx_runtime216.jsxs)(import_jsx_runtime216.Fragment, { children: [ 36742 /* @__PURE__ */ (0, import_jsx_runtime216.jsx)( 36743 "div", 36744 { 36745 className: wrapperClassName, 36746 role: view.infiniteScrollEnabled ? "feed" : void 0, 36747 inert: isInert ? "true" : void 0, 36748 children: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(ActivityItems, { ...props }) 36749 } 36750 ), 36751 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime216.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(import_components92.Spinner, {}) }) 36752 ] }); 36753 } 36754 36755 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs 36756 var import_components95 = __toESM(require_components(), 1); 36757 var import_i18n89 = __toESM(require_i18n(), 1); 36758 var import_compose16 = __toESM(require_compose(), 1); 36759 var import_element107 = __toESM(require_element(), 1); 36760 36761 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs 36762 var import_components94 = __toESM(require_components(), 1); 36763 var import_data53 = __toESM(require_data(), 1); 36764 var import_element106 = __toESM(require_element(), 1); 36765 var import_i18n88 = __toESM(require_i18n(), 1); 36766 36767 // packages/dataviews/build-module/components/dataviews-pagination/index.mjs 36768 var import_components93 = __toESM(require_components(), 1); 36769 var import_element105 = __toESM(require_element(), 1); 36770 var import_i18n87 = __toESM(require_i18n(), 1); 36771 var import_jsx_runtime217 = __toESM(require_jsx_runtime(), 1); 36772 function DataViewsPagination() { 36773 const { 36774 view, 36775 onChangeView, 36776 paginationInfo: { totalItems = 0, totalPages } 36777 } = (0, import_element105.useContext)(dataviews_context_default); 36778 if (!totalItems || !totalPages || view.infiniteScrollEnabled) { 36779 return null; 36780 } 36781 const currentPage = view.page ?? 1; 36782 const pageSelectOptions = Array.from(Array(totalPages)).map( 36783 (_, i2) => { 36784 const page = i2 + 1; 36785 return { 36786 value: page.toString(), 36787 label: page.toString(), 36788 "aria-label": currentPage === page ? (0, import_i18n87.sprintf)( 36789 // translators: 1: current page number. 2: total number of pages. 36790 (0, import_i18n87.__)("Page %1$d of %2$d"), 36791 currentPage, 36792 totalPages 36793 ) : page.toString() 36794 }; 36795 } 36796 ); 36797 return !!totalItems && totalPages !== 1 && /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)( 36798 Stack, 36799 { 36800 direction: "row", 36801 className: "dataviews-pagination", 36802 justify: "end", 36803 align: "center", 36804 gap: "xl", 36805 children: [ 36806 /* @__PURE__ */ (0, import_jsx_runtime217.jsx)( 36807 Stack, 36808 { 36809 direction: "row", 36810 justify: "flex-start", 36811 align: "center", 36812 gap: "xs", 36813 className: "dataviews-pagination__page-select", 36814 children: (0, import_element105.createInterpolateElement)( 36815 (0, import_i18n87.sprintf)( 36816 // translators: 1: Current page number, 2: Total number of pages. 36817 (0, import_i18n87._x)( 36818 "<div>Page</div>%1$s<div>of %2$d</div>", 36819 "paging" 36820 ), 36821 "<CurrentPage />", 36822 totalPages 36823 ), 36824 { 36825 div: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)("div", { "aria-hidden": true }), 36826 // @ts-expect-error — Tag injected via sprintf argument, not visible in format string. 36827 CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)( 36828 import_components93.SelectControl, 36829 { 36830 "aria-label": (0, import_i18n87.__)("Current page"), 36831 value: currentPage.toString(), 36832 options: pageSelectOptions, 36833 onChange: (newValue) => { 36834 onChangeView({ 36835 ...view, 36836 page: +newValue 36837 }); 36838 }, 36839 size: "small", 36840 variant: "minimal" 36841 } 36842 ) 36843 } 36844 ) 36845 } 36846 ), 36847 /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)(Stack, { direction: "row", gap: "xs", align: "center", children: [ 36848 /* @__PURE__ */ (0, import_jsx_runtime217.jsx)( 36849 import_components93.Button, 36850 { 36851 onClick: () => onChangeView({ 36852 ...view, 36853 page: currentPage - 1 36854 }), 36855 disabled: currentPage === 1, 36856 accessibleWhenDisabled: true, 36857 label: (0, import_i18n87.__)("Previous page"), 36858 icon: (0, import_i18n87.isRTL)() ? next_default : previous_default, 36859 showTooltip: true, 36860 size: "compact", 36861 tooltipPosition: "top" 36862 } 36863 ), 36864 /* @__PURE__ */ (0, import_jsx_runtime217.jsx)( 36865 import_components93.Button, 36866 { 36867 onClick: () => onChangeView({ ...view, page: currentPage + 1 }), 36868 disabled: currentPage >= totalPages, 36869 accessibleWhenDisabled: true, 36870 label: (0, import_i18n87.__)("Next page"), 36871 icon: (0, import_i18n87.isRTL)() ? previous_default : next_default, 36872 showTooltip: true, 36873 size: "compact", 36874 tooltipPosition: "top" 36875 } 36876 ) 36877 ] }) 36878 ] 36879 } 36880 ); 36881 } 36882 var dataviews_pagination_default = (0, import_element105.memo)(DataViewsPagination); 36883 36884 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs 36885 var import_jsx_runtime218 = __toESM(require_jsx_runtime(), 1); 36886 function useIsMultiselectPicker(actions) { 36887 return (0, import_element106.useMemo)(() => { 36888 return actions?.every((action) => action.supportsBulk); 36889 }, [actions]); 36890 } 36891 36892 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs 36893 var import_jsx_runtime219 = __toESM(require_jsx_runtime(), 1); 36894 var { Badge: WCBadge2 } = unlock4(import_components95.privateApis); 36895 function GridItem3({ 36896 view, 36897 multiselect, 36898 selection, 36899 onChangeSelection, 36900 getItemId: getItemId2, 36901 item, 36902 mediaField, 36903 titleField, 36904 descriptionField: descriptionField2, 36905 regularFields, 36906 badgeFields, 36907 config: config2, 36908 posinset, 36909 setsize 36910 }) { 36911 const { showTitle = true, showMedia = true, showDescription = true } = view; 36912 const id = getItemId2(item); 36913 const elementRef = (0, import_element107.useRef)(null); 36914 const isSelected2 = selection.includes(id); 36915 useIntersectionObserver(elementRef, posinset); 36916 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 36917 mediaField.render, 36918 { 36919 item, 36920 field: mediaField, 36921 config: config2 36922 } 36923 ) : null; 36924 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(titleField.render, { item, field: titleField }) : null; 36925 return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)( 36926 import_components95.Composite.Item, 36927 { 36928 ref: elementRef, 36929 "aria-label": titleField ? titleField.getValue({ item }) || (0, import_i18n89.__)("(no title)") : void 0, 36930 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(Stack, { direction: "column", children, ...props }), 36931 role: "option", 36932 "aria-posinset": posinset, 36933 "aria-setsize": setsize, 36934 className: clsx_default("dataviews-view-picker-grid__card", { 36935 "is-selected": isSelected2 36936 }), 36937 "aria-selected": isSelected2, 36938 onClick: () => { 36939 if (isSelected2) { 36940 onChangeSelection( 36941 selection.filter((itemId) => id !== itemId) 36942 ); 36943 } else { 36944 const newSelection = multiselect ? [...selection, id] : [id]; 36945 onChangeSelection(newSelection); 36946 } 36947 }, 36948 children: [ 36949 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }), 36950 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 36951 DataViewsSelectionCheckbox, 36952 { 36953 item, 36954 selection, 36955 onChangeSelection, 36956 getItemId: getItemId2, 36957 titleField, 36958 disabled: false, 36959 "aria-hidden": true, 36960 tabIndex: -1 36961 } 36962 ), 36963 showTitle && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 36964 Stack, 36965 { 36966 direction: "row", 36967 justify: "space-between", 36968 className: "dataviews-view-picker-grid__title-actions", 36969 children: /* @__PURE__ */ (0, import_jsx_runtime219.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField }) 36970 } 36971 ), 36972 /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 36973 showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 36974 descriptionField2.render, 36975 { 36976 item, 36977 field: descriptionField2 36978 } 36979 ), 36980 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 36981 Stack, 36982 { 36983 direction: "row", 36984 className: "dataviews-view-picker-grid__badge-fields", 36985 gap: "sm", 36986 wrap: "wrap", 36987 align: "top", 36988 justify: "flex-start", 36989 children: badgeFields.map((field) => { 36990 return /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 36991 WCBadge2, 36992 { 36993 className: "dataviews-view-picker-grid__field-value", 36994 children: /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 36995 field.render, 36996 { 36997 item, 36998 field 36999 } 37000 ) 37001 }, 37002 field.id 37003 ); 37004 }) 37005 } 37006 ), 37007 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37008 Stack, 37009 { 37010 direction: "column", 37011 className: "dataviews-view-picker-grid__fields", 37012 gap: "xs", 37013 children: regularFields.map((field) => { 37014 return /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37015 import_components95.Flex, 37016 { 37017 className: "dataviews-view-picker-grid__field", 37018 gap: 1, 37019 justify: "flex-start", 37020 expanded: true, 37021 style: { height: "auto" }, 37022 direction: "row", 37023 children: /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(import_jsx_runtime219.Fragment, { children: [ 37024 /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(import_components95.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }), 37025 /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37026 import_components95.FlexItem, 37027 { 37028 className: "dataviews-view-picker-grid__field-value", 37029 style: { maxHeight: "none" }, 37030 children: /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37031 field.render, 37032 { 37033 item, 37034 field 37035 } 37036 ) 37037 } 37038 ) 37039 ] }) 37040 }, 37041 field.id 37042 ); 37043 }) 37044 } 37045 ) 37046 ] }) 37047 ] 37048 }, 37049 id 37050 ); 37051 } 37052 function GridGroup({ 37053 groupName, 37054 groupField, 37055 showLabel = true, 37056 children 37057 }) { 37058 const headerId = (0, import_compose16.useInstanceId)( 37059 GridGroup, 37060 "dataviews-view-picker-grid-group__header" 37061 ); 37062 return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)( 37063 Stack, 37064 { 37065 direction: "column", 37066 gap: "sm", 37067 role: "group", 37068 "aria-labelledby": headerId, 37069 children: [ 37070 /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37071 "h3", 37072 { 37073 className: "dataviews-view-picker-grid-group__header", 37074 id: headerId, 37075 children: showLabel ? (0, import_i18n89.sprintf)( 37076 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 37077 (0, import_i18n89.__)("%1$s: %2$s"), 37078 groupField.label, 37079 groupName 37080 ) : groupName 37081 } 37082 ), 37083 children 37084 ] 37085 }, 37086 groupName 37087 ); 37088 } 37089 function ViewPickerGrid({ 37090 actions, 37091 data, 37092 fields: fields2, 37093 getItemId: getItemId2, 37094 isLoading, 37095 onChangeSelection, 37096 selection, 37097 view, 37098 className, 37099 empty 37100 }) { 37101 const { resizeObserverRef, paginationInfo, itemListLabel } = (0, import_element107.useContext)(dataviews_context_default); 37102 const titleField = fields2.find( 37103 (field) => field.id === view?.titleField 37104 ); 37105 const mediaField = fields2.find( 37106 (field) => field.id === view?.mediaField 37107 ); 37108 const descriptionField2 = fields2.find( 37109 (field) => field.id === view?.descriptionField 37110 ); 37111 const otherFields = view.fields ?? []; 37112 const { regularFields, badgeFields } = otherFields.reduce( 37113 (accumulator, fieldId) => { 37114 const field = fields2.find((f2) => f2.id === fieldId); 37115 if (!field) { 37116 return accumulator; 37117 } 37118 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 37119 accumulator[key].push(field); 37120 return accumulator; 37121 }, 37122 { regularFields: [], badgeFields: [] } 37123 ); 37124 const hasData = !!data?.length; 37125 const usedPreviewSize = view.layout?.previewSize; 37126 const isMultiselect = useIsMultiselectPicker(actions); 37127 const size4 = "900px"; 37128 const groupField = view.groupBy?.field ? fields2.find((f2) => f2.id === view.groupBy?.field) : null; 37129 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 37130 const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false; 37131 const currentPage = view?.page ?? 1; 37132 const perPage = view?.perPage ?? 0; 37133 const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; 37134 const gridColumns = useGridColumns(); 37135 const placeholdersNeeded = usePlaceholdersNeeded( 37136 data, 37137 isInfiniteScroll, 37138 gridColumns 37139 ); 37140 return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(import_jsx_runtime219.Fragment, { 37141 // Render multiple groups. 37142 children: [ 37143 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37144 import_components95.Composite, 37145 { 37146 virtualFocus: true, 37147 orientation: "horizontal", 37148 role: "listbox", 37149 "aria-multiselectable": isMultiselect, 37150 className: clsx_default( 37151 "dataviews-view-picker-grid", 37152 className, 37153 { 37154 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 37155 view.layout.density 37156 ) 37157 } 37158 ), 37159 "aria-label": itemListLabel, 37160 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37161 Stack, 37162 { 37163 direction: "column", 37164 gap: "lg", 37165 children, 37166 ...props 37167 } 37168 ), 37169 children: Array.from(dataByGroup.entries()).map( 37170 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37171 GridGroup, 37172 { 37173 groupName, 37174 groupField, 37175 showLabel: view.groupBy?.showLabel !== false, 37176 children: /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37177 GridItems, 37178 { 37179 previewSize: usedPreviewSize, 37180 style: { 37181 gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax($usedPreviewSize}px, 1fr))` 37182 }, 37183 "aria-busy": isLoading, 37184 ref: resizeObserverRef, 37185 children: groupItems.map((item) => { 37186 const posInSet = item.position ?? (currentPage - 1) * perPage + data.indexOf(item) + 1; 37187 return /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37188 GridItem3, 37189 { 37190 view, 37191 multiselect: isMultiselect, 37192 selection, 37193 onChangeSelection, 37194 getItemId: getItemId2, 37195 item, 37196 mediaField, 37197 titleField, 37198 descriptionField: descriptionField2, 37199 regularFields, 37200 badgeFields, 37201 config: { 37202 sizes: size4 37203 }, 37204 posinset: posInSet, 37205 setsize: setSize 37206 }, 37207 getItemId2(item) 37208 ); 37209 }) 37210 } 37211 ) 37212 }, 37213 groupName 37214 ) 37215 ) 37216 } 37217 ), 37218 // Render a single grid with all data. 37219 hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)( 37220 import_components95.Composite, 37221 { 37222 render: /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37223 GridItems, 37224 { 37225 className: clsx_default( 37226 "dataviews-view-picker-grid", 37227 className, 37228 { 37229 [`has-$view.layout?.density}-density`]: view.layout?.density && [ 37230 "compact", 37231 "comfortable" 37232 ].includes(view.layout.density) 37233 } 37234 ), 37235 previewSize: usedPreviewSize, 37236 "aria-busy": isLoading, 37237 ref: resizeObserverRef 37238 } 37239 ), 37240 virtualFocus: true, 37241 orientation: "horizontal", 37242 role: "listbox", 37243 "aria-multiselectable": isMultiselect, 37244 "aria-label": itemListLabel, 37245 children: [ 37246 Array.from({ length: placeholdersNeeded }).map( 37247 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37248 import_components95.Composite.Item, 37249 { 37250 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37251 Stack, 37252 { 37253 direction: "column", 37254 children, 37255 ...props 37256 } 37257 ), 37258 role: "option", 37259 "aria-hidden": true, 37260 tabIndex: -1, 37261 className: "dataviews-view-picker-grid__card dataviews-view-picker-grid__placeholder" 37262 }, 37263 `placeholder-$index2}` 37264 ) 37265 ), 37266 data.map((item) => { 37267 const posinset = item.position; 37268 return /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37269 GridItem3, 37270 { 37271 view, 37272 multiselect: isMultiselect, 37273 selection, 37274 onChangeSelection, 37275 getItemId: getItemId2, 37276 item, 37277 mediaField, 37278 titleField, 37279 descriptionField: descriptionField2, 37280 regularFields, 37281 badgeFields, 37282 config: { 37283 sizes: size4 37284 }, 37285 posinset, 37286 setsize: setSize 37287 }, 37288 getItemId2(item) 37289 ); 37290 }) 37291 ] 37292 } 37293 ), 37294 // Render empty state. 37295 !hasData && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 37296 "div", 37297 { 37298 className: clsx_default({ 37299 "dataviews-loading": isLoading, 37300 "dataviews-no-results": !isLoading 37301 }), 37302 children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime219.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(import_components95.Spinner, {}) }) : empty 37303 } 37304 ), 37305 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime219.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(import_components95.Spinner, {}) }) 37306 ] 37307 }); 37308 } 37309 var picker_grid_default = ViewPickerGrid; 37310 37311 // packages/dataviews/build-module/components/dataviews-layouts/picker-table/index.mjs 37312 var import_i18n90 = __toESM(require_i18n(), 1); 37313 var import_components96 = __toESM(require_components(), 1); 37314 var import_element108 = __toESM(require_element(), 1); 37315 var import_jsx_runtime220 = __toESM(require_jsx_runtime(), 1); 37316 function TableColumnField2({ 37317 item, 37318 fields: fields2, 37319 column, 37320 align 37321 }) { 37322 const field = fields2.find((f2) => f2.id === column); 37323 if (!field) { 37324 return null; 37325 } 37326 const className = clsx_default("dataviews-view-table__cell-content-wrapper", { 37327 "dataviews-view-table__cell-align-end": align === "end", 37328 "dataviews-view-table__cell-align-center": align === "center" 37329 }); 37330 return /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(field.render, { item, field }) }); 37331 } 37332 function TableRow2({ 37333 item, 37334 fields: fields2, 37335 id, 37336 view, 37337 titleField, 37338 mediaField, 37339 descriptionField: descriptionField2, 37340 selection, 37341 getItemId: getItemId2, 37342 onChangeSelection, 37343 multiselect, 37344 posinset 37345 }) { 37346 const { paginationInfo } = (0, import_element108.useContext)(dataviews_context_default); 37347 const isSelected2 = selection.includes(id); 37348 const [isHovered, setIsHovered] = (0, import_element108.useState)(false); 37349 const elementRef = (0, import_element108.useRef)(null); 37350 useIntersectionObserver(elementRef, posinset); 37351 const { 37352 showTitle = true, 37353 showMedia = true, 37354 showDescription = true, 37355 infiniteScrollEnabled 37356 } = view; 37357 const handleMouseEnter = () => { 37358 setIsHovered(true); 37359 }; 37360 const handleMouseLeave = () => { 37361 setIsHovered(false); 37362 }; 37363 const columns = view.fields ?? []; 37364 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription; 37365 return /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)( 37366 import_components96.Composite.Item, 37367 { 37368 ref: elementRef, 37369 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37370 "tr", 37371 { 37372 className: clsx_default("dataviews-view-table__row", { 37373 "is-selected": isSelected2, 37374 "is-hovered": isHovered 37375 }), 37376 onMouseEnter: handleMouseEnter, 37377 onMouseLeave: handleMouseLeave, 37378 children, 37379 ...props 37380 } 37381 ), 37382 "aria-selected": isSelected2, 37383 "aria-setsize": paginationInfo.totalItems || void 0, 37384 "aria-posinset": posinset, 37385 role: infiniteScrollEnabled ? "article" : "option", 37386 onMouseDown: (event) => { 37387 if (event.button !== 0) { 37388 return; 37389 } 37390 event.currentTarget.parentElement?.focus({ 37391 preventScroll: true 37392 }); 37393 }, 37394 onClick: () => { 37395 if (isSelected2) { 37396 onChangeSelection( 37397 selection.filter((itemId) => id !== itemId) 37398 ); 37399 } else { 37400 const newSelection = multiselect ? [...selection, id] : [id]; 37401 onChangeSelection(newSelection); 37402 } 37403 }, 37404 children: [ 37405 /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37406 "td", 37407 { 37408 className: "dataviews-view-table__checkbox-column", 37409 role: "presentation", 37410 children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37411 DataViewsSelectionCheckbox, 37412 { 37413 item, 37414 selection, 37415 onChangeSelection, 37416 getItemId: getItemId2, 37417 titleField, 37418 disabled: false, 37419 "aria-hidden": true, 37420 tabIndex: -1 37421 } 37422 ) }) 37423 } 37424 ), 37425 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37426 "td", 37427 { 37428 role: "presentation", 37429 children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37430 column_primary_default, 37431 { 37432 item, 37433 titleField: showTitle ? titleField : void 0, 37434 mediaField: showMedia ? mediaField : void 0, 37435 descriptionField: showDescription ? descriptionField2 : void 0, 37436 isItemClickable: () => false 37437 } 37438 ) 37439 } 37440 ), 37441 columns.map((column) => { 37442 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 37443 return /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37444 "td", 37445 { 37446 style: { 37447 width, 37448 maxWidth, 37449 minWidth 37450 }, 37451 role: "presentation", 37452 children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37453 TableColumnField2, 37454 { 37455 fields: fields2, 37456 item, 37457 column, 37458 align 37459 } 37460 ) 37461 }, 37462 column 37463 ); 37464 }) 37465 ] 37466 }, 37467 id 37468 ); 37469 } 37470 function ViewPickerTable({ 37471 actions, 37472 data, 37473 fields: fields2, 37474 getItemId: getItemId2, 37475 isLoading = false, 37476 onChangeView, 37477 onChangeSelection, 37478 selection, 37479 setOpenedFilter, 37480 view, 37481 className, 37482 empty 37483 }) { 37484 const headerMenuRefs = (0, import_element108.useRef)(/* @__PURE__ */ new Map()); 37485 const headerMenuToFocusRef = (0, import_element108.useRef)(void 0); 37486 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element108.useState)(); 37487 const isMultiselect = useIsMultiselectPicker(actions) ?? false; 37488 (0, import_element108.useEffect)(() => { 37489 if (headerMenuToFocusRef.current) { 37490 headerMenuToFocusRef.current.focus(); 37491 headerMenuToFocusRef.current = void 0; 37492 } 37493 }); 37494 const groupField = view.groupBy?.field ? fields2.find((f2) => f2.id === view.groupBy?.field) : null; 37495 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 37496 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 37497 const tableNoticeId = (0, import_element108.useId)(); 37498 if (nextHeaderMenuToFocus) { 37499 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 37500 setNextHeaderMenuToFocus(void 0); 37501 return; 37502 } 37503 const onHide = (field) => { 37504 const hidden = headerMenuRefs.current.get(field.id); 37505 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 37506 setNextHeaderMenuToFocus(fallback?.node); 37507 }; 37508 const hasData = !!data?.length; 37509 const titleField = fields2.find((field) => field.id === view.titleField); 37510 const mediaField = fields2.find((field) => field.id === view.mediaField); 37511 const descriptionField2 = fields2.find( 37512 (field) => field.id === view.descriptionField 37513 ); 37514 const { showTitle = true, showMedia = true, showDescription = true } = view; 37515 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription; 37516 const columns = view.fields ?? []; 37517 const headerMenuRef = (column, index2) => (node) => { 37518 if (node) { 37519 headerMenuRefs.current.set(column, { 37520 node, 37521 fallback: columns[index2 > 0 ? index2 - 1 : 1] 37522 }); 37523 } else { 37524 headerMenuRefs.current.delete(column); 37525 } 37526 }; 37527 return /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)(import_jsx_runtime220.Fragment, { children: [ 37528 /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)( 37529 "table", 37530 { 37531 className: clsx_default( 37532 "dataviews-view-table", 37533 "dataviews-view-picker-table", 37534 className, 37535 { 37536 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 37537 view.layout.density 37538 ) 37539 } 37540 ), 37541 "aria-busy": isLoading, 37542 "aria-describedby": tableNoticeId, 37543 role: isInfiniteScroll ? "feed" : "listbox", 37544 children: [ 37545 /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("thead", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)( 37546 "tr", 37547 { 37548 className: "dataviews-view-table__row", 37549 role: "presentation", 37550 children: [ 37551 /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("th", { className: "dataviews-view-table__checkbox-column", children: isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37552 BulkSelectionCheckbox, 37553 { 37554 selection, 37555 onChangeSelection, 37556 data, 37557 actions, 37558 getItemId: getItemId2, 37559 disableSelectAll: isInfiniteScroll 37560 } 37561 ) }), 37562 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("th", { children: titleField && /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37563 column_header_menu_default, 37564 { 37565 ref: headerMenuRef( 37566 titleField.id, 37567 0 37568 ), 37569 fieldId: titleField.id, 37570 view, 37571 fields: fields2, 37572 onChangeView, 37573 onHide, 37574 setOpenedFilter, 37575 canMove: false 37576 } 37577 ) }), 37578 columns.map((column, index2) => { 37579 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 37580 return /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37581 "th", 37582 { 37583 style: { 37584 width, 37585 maxWidth, 37586 minWidth, 37587 textAlign: align 37588 }, 37589 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 37590 scope: "col", 37591 children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37592 column_header_menu_default, 37593 { 37594 ref: headerMenuRef(column, index2), 37595 fieldId: column, 37596 view, 37597 fields: fields2, 37598 onChangeView, 37599 onHide, 37600 setOpenedFilter, 37601 canMove: view.layout?.enableMoving ?? true 37602 } 37603 ) 37604 }, 37605 column 37606 ); 37607 }) 37608 ] 37609 } 37610 ) }), 37611 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 37612 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)( 37613 import_components96.Composite, 37614 { 37615 virtualFocus: true, 37616 orientation: "vertical", 37617 render: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("tbody", { role: "group" }), 37618 children: [ 37619 /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37620 "tr", 37621 { 37622 className: "dataviews-view-table__group-header-row", 37623 role: "presentation", 37624 children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37625 "td", 37626 { 37627 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + 1, 37628 className: "dataviews-view-table__group-header-cell", 37629 role: "presentation", 37630 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n90.sprintf)( 37631 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 37632 (0, import_i18n90.__)("%1$s: %2$s"), 37633 groupField.label, 37634 groupName 37635 ) 37636 } 37637 ) 37638 } 37639 ), 37640 groupItems.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37641 TableRow2, 37642 { 37643 item, 37644 fields: fields2, 37645 id: getItemId2(item) || index2.toString(), 37646 view, 37647 titleField, 37648 mediaField, 37649 descriptionField: descriptionField2, 37650 selection, 37651 getItemId: getItemId2, 37652 onChangeSelection, 37653 multiselect: isMultiselect 37654 }, 37655 getItemId2(item) 37656 )) 37657 ] 37658 }, 37659 `group-$groupName}` 37660 ) 37661 ) : /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37662 import_components96.Composite, 37663 { 37664 render: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("tbody", { role: "presentation" }), 37665 virtualFocus: true, 37666 orientation: "vertical", 37667 children: hasData && data.map((item, index2) => { 37668 const itemId = getItemId2(item); 37669 const posinset = item.position; 37670 return /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 37671 TableRow2, 37672 { 37673 item, 37674 fields: fields2, 37675 id: itemId || index2.toString(), 37676 view, 37677 titleField, 37678 mediaField, 37679 descriptionField: descriptionField2, 37680 selection, 37681 getItemId: getItemId2, 37682 onChangeSelection, 37683 multiselect: isMultiselect, 37684 posinset 37685 }, 37686 itemId 37687 ); 37688 }) 37689 } 37690 ) 37691 ] 37692 } 37693 ), 37694 /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)( 37695 "div", 37696 { 37697 className: clsx_default({ 37698 "dataviews-loading": isLoading, 37699 "dataviews-no-results": !hasData && !isLoading 37700 }), 37701 id: tableNoticeId, 37702 children: [ 37703 !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(import_components96.Spinner, {}) }) : empty), 37704 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(import_components96.Spinner, {}) }) 37705 ] 37706 } 37707 ) 37708 ] }); 37709 } 37710 var picker_table_default = ViewPickerTable; 37711 37712 // packages/dataviews/build-module/components/dataviews-layouts/picker-activity/index.mjs 37713 var import_components97 = __toESM(require_components(), 1); 37714 var import_element109 = __toESM(require_element(), 1); 37715 var import_compose17 = __toESM(require_compose(), 1); 37716 var import_i18n91 = __toESM(require_i18n(), 1); 37717 var import_jsx_runtime221 = __toESM(require_jsx_runtime(), 1); 37718 function isDefined4(item) { 37719 return !!item; 37720 } 37721 function PickerActivityItem({ 37722 view, 37723 multiselect, 37724 selection, 37725 onChangeSelection, 37726 getItemId: getItemId2, 37727 item, 37728 titleField, 37729 mediaField, 37730 descriptionField: descriptionField2, 37731 otherFields, 37732 posinset, 37733 setsize 37734 }) { 37735 const elementRef = (0, import_element109.useRef)(null); 37736 useIntersectionObserver(elementRef, posinset); 37737 const { showTitle = true, showMedia = true, showDescription = true } = view; 37738 const id = getItemId2(item); 37739 const isSelected2 = selection.includes(id); 37740 const density = view.layout?.density ?? "balanced"; 37741 const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37742 mediaField.render, 37743 { 37744 item, 37745 field: mediaField, 37746 config: { 37747 sizes: density === "comfortable" ? "32px" : "24px" 37748 } 37749 } 37750 ) : null; 37751 const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", { className: "dataviews-view-picker-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37752 "span", 37753 { 37754 className: "dataviews-view-picker-activity__item-bullet", 37755 "aria-hidden": "true" 37756 } 37757 ) }); 37758 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(titleField.render, { item, field: titleField }) : null; 37759 const renderedDescriptionField = showDescription && descriptionField2?.render ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(descriptionField2.render, { item, field: descriptionField2 }) : null; 37760 const verticalGap = (0, import_element109.useMemo)(() => { 37761 switch (density) { 37762 case "comfortable": 37763 return "md"; 37764 default: 37765 return "sm"; 37766 } 37767 }, [density]); 37768 return /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37769 import_components97.Composite.Item, 37770 { 37771 ref: elementRef, 37772 role: "option", 37773 "aria-label": titleField ? titleField.getValue({ item }) || void 0 : void 0, 37774 "aria-posinset": posinset, 37775 "aria-setsize": setsize, 37776 "aria-selected": isSelected2, 37777 className: clsx_default( 37778 "dataviews-view-picker-activity__item", 37779 density === "compact" && "is-compact", 37780 density === "balanced" && "is-balanced", 37781 density === "comfortable" && "is-comfortable", 37782 isSelected2 && "is-selected" 37783 ), 37784 onClick: () => { 37785 if (isSelected2) { 37786 onChangeSelection( 37787 selection.filter((itemId) => id !== itemId) 37788 ); 37789 } else { 37790 const newSelection = multiselect ? [...selection, id] : [id]; 37791 onChangeSelection(newSelection); 37792 } 37793 }, 37794 render: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", {}), 37795 children: /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [ 37796 /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37797 Stack, 37798 { 37799 direction: "column", 37800 gap: "xs", 37801 align: "center", 37802 className: "dataviews-view-picker-activity__item-type", 37803 children: renderedMediaField 37804 } 37805 ), 37806 /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)( 37807 Stack, 37808 { 37809 direction: "column", 37810 gap: verticalGap, 37811 align: "flex-start", 37812 className: "dataviews-view-picker-activity__item-content", 37813 children: [ 37814 renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", { className: "dataviews-view-picker-activity__item-title", children: renderedTitleField }), 37815 renderedDescriptionField && /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", { className: "dataviews-view-picker-activity__item-description", children: renderedDescriptionField }), 37816 /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", { className: "dataviews-view-picker-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)( 37817 "div", 37818 { 37819 className: "dataviews-view-picker-activity__item-field", 37820 children: [ 37821 /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37822 VisuallyHidden, 37823 { 37824 render: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("span", {}), 37825 className: "dataviews-view-picker-activity__item-field-label", 37826 children: field.label 37827 } 37828 ), 37829 /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("span", { className: "dataviews-view-picker-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37830 field.render, 37831 { 37832 item, 37833 field 37834 } 37835 ) }) 37836 ] 37837 }, 37838 field.id 37839 )) }) 37840 ] 37841 } 37842 ) 37843 ] }) 37844 } 37845 ); 37846 } 37847 function PickerActivityGroup({ 37848 groupName, 37849 groupField, 37850 showLabel = true, 37851 children 37852 }) { 37853 const headerId = (0, import_compose17.useInstanceId)( 37854 PickerActivityGroup, 37855 "dataviews-view-picker-activity-group__header" 37856 ); 37857 return /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)( 37858 Stack, 37859 { 37860 direction: "column", 37861 role: "group", 37862 "aria-labelledby": headerId, 37863 className: "dataviews-view-picker-activity-group", 37864 children: [ 37865 /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37866 "h3", 37867 { 37868 className: "dataviews-view-picker-activity-group__header", 37869 id: headerId, 37870 children: showLabel ? (0, import_i18n91.sprintf)( 37871 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 37872 (0, import_i18n91.__)("%1$s: %2$s"), 37873 groupField.label, 37874 groupName 37875 ) : groupName 37876 } 37877 ), 37878 children 37879 ] 37880 } 37881 ); 37882 } 37883 function ViewPickerActivity({ 37884 data, 37885 fields: fields2, 37886 getItemId: getItemId2, 37887 isLoading, 37888 onChangeSelection, 37889 selection, 37890 view, 37891 actions, 37892 className, 37893 empty 37894 }) { 37895 const { itemListLabel, paginationInfo } = (0, import_element109.useContext)(dataviews_context_default); 37896 const isMultiselect = useIsMultiselectPicker(actions); 37897 const titleField = fields2.find( 37898 (field) => field.id === view?.titleField 37899 ); 37900 const mediaField = fields2.find( 37901 (field) => field.id === view?.mediaField 37902 ); 37903 const descriptionField2 = fields2.find( 37904 (field) => field.id === view?.descriptionField 37905 ); 37906 const otherFields = (view?.fields ?? []).map((fieldId) => fields2.find((f2) => fieldId === f2.id)).filter(isDefined4); 37907 const groupField = view.groupBy?.field ? fields2.find((f2) => f2.id === view.groupBy?.field) : null; 37908 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 37909 const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false; 37910 const setsize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; 37911 const hasData = !!data?.length; 37912 const isGrouped = !!(groupField && dataByGroup); 37913 const renderItem = (item) => /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37914 PickerActivityItem, 37915 { 37916 view, 37917 multiselect: isMultiselect, 37918 selection, 37919 onChangeSelection, 37920 getItemId: getItemId2, 37921 item, 37922 titleField, 37923 mediaField, 37924 descriptionField: descriptionField2, 37925 otherFields, 37926 posinset: item.position, 37927 setsize 37928 }, 37929 getItemId2(item) 37930 ); 37931 if (!hasData) { 37932 return /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37933 "div", 37934 { 37935 className: clsx_default({ 37936 "dataviews-loading": isLoading, 37937 "dataviews-no-results": !isLoading 37938 }), 37939 children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(import_components97.Spinner, {}) }) : empty 37940 } 37941 ); 37942 } 37943 return /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(import_jsx_runtime221.Fragment, { children: [ 37944 /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37945 import_components97.Composite, 37946 { 37947 virtualFocus: true, 37948 orientation: "vertical", 37949 role: "listbox", 37950 "aria-multiselectable": isMultiselect, 37951 "aria-label": itemListLabel, 37952 "aria-busy": isLoading, 37953 render: isGrouped ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(Stack, { direction: "column", gap: "sm" }) : void 0, 37954 className: clsx_default( 37955 "dataviews-view-picker-activity", 37956 className 37957 ), 37958 children: isGrouped && dataByGroup ? Array.from(dataByGroup.entries()).map( 37959 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 37960 PickerActivityGroup, 37961 { 37962 groupName, 37963 groupField, 37964 showLabel: view.groupBy?.showLabel !== false, 37965 children: groupItems.map(renderItem) 37966 }, 37967 groupName 37968 ) 37969 ) : data.map(renderItem) 37970 } 37971 ), 37972 isLoading && /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(import_components97.Spinner, {}) }) 37973 ] }); 37974 } 37975 37976 // packages/dataviews/build-module/components/dataviews-layouts/utils/density-picker.mjs 37977 var import_components98 = __toESM(require_components(), 1); 37978 var import_i18n92 = __toESM(require_i18n(), 1); 37979 var import_element110 = __toESM(require_element(), 1); 37980 var import_jsx_runtime222 = __toESM(require_jsx_runtime(), 1); 37981 function DensityPicker() { 37982 const context = (0, import_element110.useContext)(dataviews_context_default); 37983 const view = context.view; 37984 return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)( 37985 import_components98.__experimentalToggleGroupControl, 37986 { 37987 size: "__unstable-large", 37988 label: (0, import_i18n92.__)("Density"), 37989 value: view.layout?.density || "balanced", 37990 onChange: (value) => { 37991 context.onChangeView({ 37992 ...view, 37993 layout: { 37994 ...view.layout, 37995 density: value 37996 } 37997 }); 37998 }, 37999 isBlock: true, 38000 children: [ 38001 /* @__PURE__ */ (0, import_jsx_runtime222.jsx)( 38002 import_components98.__experimentalToggleGroupControlOption, 38003 { 38004 value: "comfortable", 38005 label: (0, import_i18n92._x)( 38006 "Comfortable", 38007 "Density option for DataView layout" 38008 ) 38009 }, 38010 "comfortable" 38011 ), 38012 /* @__PURE__ */ (0, import_jsx_runtime222.jsx)( 38013 import_components98.__experimentalToggleGroupControlOption, 38014 { 38015 value: "balanced", 38016 label: (0, import_i18n92._x)("Balanced", "Density option for DataView layout") 38017 }, 38018 "balanced" 38019 ), 38020 /* @__PURE__ */ (0, import_jsx_runtime222.jsx)( 38021 import_components98.__experimentalToggleGroupControlOption, 38022 { 38023 value: "compact", 38024 label: (0, import_i18n92._x)("Compact", "Density option for DataView layout") 38025 }, 38026 "compact" 38027 ) 38028 ] 38029 } 38030 ); 38031 } 38032 38033 // packages/dataviews/build-module/components/dataviews-layouts/utils/preview-size-picker.mjs 38034 var import_components99 = __toESM(require_components(), 1); 38035 var import_i18n93 = __toESM(require_i18n(), 1); 38036 var import_element111 = __toESM(require_element(), 1); 38037 var import_jsx_runtime223 = __toESM(require_jsx_runtime(), 1); 38038 var imageSizes2 = [ 38039 { 38040 value: 120, 38041 breakpoint: 1 38042 }, 38043 { 38044 value: 170, 38045 breakpoint: 1 38046 }, 38047 { 38048 value: 230, 38049 breakpoint: 1 38050 }, 38051 { 38052 value: 290, 38053 breakpoint: 1112 38054 // at minimum image width, 4 images display at this container size 38055 }, 38056 { 38057 value: 350, 38058 breakpoint: 1636 38059 // at minimum image width, 6 images display at this container size 38060 }, 38061 { 38062 value: 430, 38063 breakpoint: 588 38064 // at minimum image width, 2 images display at this container size 38065 } 38066 ]; 38067 function PreviewSizePicker() { 38068 const context = (0, import_element111.useContext)(dataviews_context_default); 38069 const view = context.view; 38070 const breakValues = imageSizes2.filter((size4) => { 38071 return context.containerWidth >= size4.breakpoint; 38072 }); 38073 const layoutPreviewSize = view.layout?.previewSize ?? 230; 38074 const previewSizeToUse = breakValues.map((size4, index2) => ({ ...size4, index: index2 })).filter((size4) => size4.value <= layoutPreviewSize).sort((a2, b2) => b2.value - a2.value)[0]?.index ?? 0; 38075 const marks = breakValues.map((size4, index2) => { 38076 return { 38077 value: index2 38078 }; 38079 }); 38080 return /* @__PURE__ */ (0, import_jsx_runtime223.jsx)( 38081 import_components99.RangeControl, 38082 { 38083 __next40pxDefaultSize: true, 38084 showTooltip: false, 38085 label: (0, import_i18n93.__)("Preview size"), 38086 value: previewSizeToUse, 38087 min: 0, 38088 max: breakValues.length - 1, 38089 withInputField: false, 38090 onChange: (value = 0) => { 38091 context.onChangeView({ 38092 ...view, 38093 layout: { 38094 ...view.layout, 38095 previewSize: breakValues[value].value 38096 } 38097 }); 38098 }, 38099 step: 1, 38100 marks 38101 } 38102 ); 38103 } 38104 38105 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-config-options.mjs 38106 var import_jsx_runtime224 = __toESM(require_jsx_runtime(), 1); 38107 function GridConfigOptions() { 38108 return /* @__PURE__ */ (0, import_jsx_runtime224.jsxs)(import_jsx_runtime224.Fragment, { children: [ 38109 /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(DensityPicker, {}), 38110 /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(PreviewSizePicker, {}) 38111 ] }); 38112 } 38113 38114 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs 38115 var VIEW_LAYOUTS = [ 38116 { 38117 type: LAYOUT_TABLE, 38118 label: (0, import_i18n94.__)("Table"), 38119 component: table_default, 38120 icon: block_table_default, 38121 viewConfigOptions: DensityPicker 38122 }, 38123 { 38124 type: LAYOUT_GRID, 38125 label: (0, import_i18n94.__)("Grid"), 38126 component: grid_default, 38127 icon: category_default, 38128 viewConfigOptions: GridConfigOptions 38129 }, 38130 { 38131 type: LAYOUT_LIST2, 38132 label: (0, import_i18n94.__)("List"), 38133 component: ViewList, 38134 icon: (0, import_i18n94.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default, 38135 viewConfigOptions: DensityPicker 38136 }, 38137 { 38138 type: LAYOUT_ACTIVITY, 38139 label: (0, import_i18n94.__)("Activity"), 38140 component: ViewActivity, 38141 icon: scheduled_default, 38142 viewConfigOptions: DensityPicker 38143 }, 38144 { 38145 type: LAYOUT_PICKER_GRID, 38146 label: (0, import_i18n94.__)("Grid"), 38147 component: picker_grid_default, 38148 icon: category_default, 38149 viewConfigOptions: GridConfigOptions, 38150 isPicker: true 38151 }, 38152 { 38153 type: LAYOUT_PICKER_TABLE, 38154 label: (0, import_i18n94.__)("Table"), 38155 component: picker_table_default, 38156 icon: block_table_default, 38157 viewConfigOptions: DensityPicker, 38158 isPicker: true 38159 }, 38160 { 38161 type: LAYOUT_PICKER_ACTIVITY, 38162 label: (0, import_i18n94.__)("Activity"), 38163 component: ViewPickerActivity, 38164 icon: scheduled_default, 38165 viewConfigOptions: DensityPicker, 38166 isPicker: true 38167 } 38168 ]; 38169 38170 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs 38171 var import_element119 = __toESM(require_element(), 1); 38172 38173 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs 38174 var import_components102 = __toESM(require_components(), 1); 38175 var import_i18n97 = __toESM(require_i18n(), 1); 38176 var import_element116 = __toESM(require_element(), 1); 38177 38178 // node_modules/@ariakit/core/esm/__chunks/XMCVU3LR.js 38179 function noop5(..._) { 38180 } 38181 function applyState(argument, currentValue) { 38182 if (isUpdater(argument)) { 38183 const value = isLazyValue(currentValue) ? currentValue() : currentValue; 38184 return argument(value); 38185 } 38186 return argument; 38187 } 38188 function isUpdater(argument) { 38189 return typeof argument === "function"; 38190 } 38191 function isLazyValue(value) { 38192 return typeof value === "function"; 38193 } 38194 function hasOwnProperty(object, prop) { 38195 if (typeof Object.hasOwn === "function") { 38196 return Object.hasOwn(object, prop); 38197 } 38198 return Object.prototype.hasOwnProperty.call(object, prop); 38199 } 38200 function chain(...fns) { 38201 return (...args) => { 38202 for (const fn of fns) { 38203 if (typeof fn === "function") { 38204 fn(...args); 38205 } 38206 } 38207 }; 38208 } 38209 function normalizeString(str) { 38210 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 38211 } 38212 function omit(object, keys) { 38213 const result = { ...object }; 38214 for (const key of keys) { 38215 if (hasOwnProperty(result, key)) { 38216 delete result[key]; 38217 } 38218 } 38219 return result; 38220 } 38221 function pick(object, paths) { 38222 const result = {}; 38223 for (const key of paths) { 38224 if (hasOwnProperty(object, key)) { 38225 result[key] = object[key]; 38226 } 38227 } 38228 return result; 38229 } 38230 function identity(value) { 38231 return value; 38232 } 38233 function invariant(condition, message2) { 38234 if (condition) return; 38235 if (typeof message2 !== "string") throw new Error("Invariant failed"); 38236 throw new Error(message2); 38237 } 38238 function getKeys(obj) { 38239 return Object.keys(obj); 38240 } 38241 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 38242 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 38243 if (result == null) return false; 38244 return !result; 38245 } 38246 function disabledFromProps(props) { 38247 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 38248 } 38249 function removeUndefinedValues(obj) { 38250 const result = {}; 38251 for (const key in obj) { 38252 if (obj[key] !== void 0) { 38253 result[key] = obj[key]; 38254 } 38255 } 38256 return result; 38257 } 38258 function defaultValue(...values) { 38259 for (const value of values) { 38260 if (value !== void 0) return value; 38261 } 38262 return void 0; 38263 } 38264 38265 // node_modules/@ariakit/react-core/esm/__chunks/YXGXYGQX.js 38266 var import_react15 = __toESM(require_react(), 1); 38267 function setRef(ref, value) { 38268 if (typeof ref === "function") { 38269 ref(value); 38270 } else if (ref) { 38271 ref.current = value; 38272 } 38273 } 38274 function isValidElementWithRef(element) { 38275 if (!element) return false; 38276 if (!(0, import_react15.isValidElement)(element)) return false; 38277 if ("ref" in element.props) return true; 38278 if ("ref" in element) return true; 38279 return false; 38280 } 38281 function getRefProperty(element) { 38282 if (!isValidElementWithRef(element)) return null; 38283 const props = { ...element.props }; 38284 return props.ref || element.ref; 38285 } 38286 function mergeProps2(base, overrides) { 38287 const props = { ...base }; 38288 for (const key in overrides) { 38289 if (!hasOwnProperty(overrides, key)) continue; 38290 if (key === "className") { 38291 const prop = "className"; 38292 props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop]; 38293 continue; 38294 } 38295 if (key === "style") { 38296 const prop = "style"; 38297 props[prop] = base[prop] ? { ...base[prop], ...overrides[prop] } : overrides[prop]; 38298 continue; 38299 } 38300 const overrideValue = overrides[key]; 38301 if (typeof overrideValue === "function" && key.startsWith("on")) { 38302 const baseValue = base[key]; 38303 if (typeof baseValue === "function") { 38304 props[key] = (...args) => { 38305 overrideValue(...args); 38306 baseValue(...args); 38307 }; 38308 continue; 38309 } 38310 } 38311 props[key] = overrideValue; 38312 } 38313 return props; 38314 } 38315 38316 // node_modules/@ariakit/core/esm/__chunks/3DNM6L6E.js 38317 var canUseDOM = checkIsBrowser(); 38318 function checkIsBrowser() { 38319 var _a; 38320 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); 38321 } 38322 function getDocument(node) { 38323 if (!node) return document; 38324 if ("self" in node) return node.document; 38325 return node.ownerDocument || document; 38326 } 38327 function getActiveElement(node, activeDescendant = false) { 38328 var _a; 38329 const { activeElement: activeElement2 } = getDocument(node); 38330 if (!(activeElement2 == null ? void 0 : activeElement2.nodeName)) { 38331 return null; 38332 } 38333 if (isFrame(activeElement2) && ((_a = activeElement2.contentDocument) == null ? void 0 : _a.body)) { 38334 return getActiveElement( 38335 activeElement2.contentDocument.body, 38336 activeDescendant 38337 ); 38338 } 38339 if (activeDescendant) { 38340 const id = activeElement2.getAttribute("aria-activedescendant"); 38341 if (id) { 38342 const element = getDocument(activeElement2).getElementById(id); 38343 if (element) { 38344 return element; 38345 } 38346 } 38347 } 38348 return activeElement2; 38349 } 38350 function contains2(parent, child) { 38351 return parent === child || parent.contains(child); 38352 } 38353 function isFrame(element) { 38354 return element.tagName === "IFRAME"; 38355 } 38356 function isButton(element) { 38357 const tagName = element.tagName.toLowerCase(); 38358 if (tagName === "button") return true; 38359 if (tagName === "input" && element.type) { 38360 return buttonInputTypes.indexOf(element.type) !== -1; 38361 } 38362 return false; 38363 } 38364 var buttonInputTypes = [ 38365 "button", 38366 "color", 38367 "file", 38368 "image", 38369 "reset", 38370 "submit" 38371 ]; 38372 function isVisible(element) { 38373 if (typeof element.checkVisibility === "function") { 38374 return element.checkVisibility(); 38375 } 38376 const htmlElement = element; 38377 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 38378 } 38379 function isTextField(element) { 38380 try { 38381 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 38382 const isTextArea = element.tagName === "TEXTAREA"; 38383 return isTextInput || isTextArea || false; 38384 } catch (_error) { 38385 return false; 38386 } 38387 } 38388 function isTextbox(element) { 38389 return element.isContentEditable || isTextField(element); 38390 } 38391 function getTextboxValue(element) { 38392 if (isTextField(element)) { 38393 return element.value; 38394 } 38395 if (element.isContentEditable) { 38396 const range = getDocument(element).createRange(); 38397 range.selectNodeContents(element); 38398 return range.toString(); 38399 } 38400 return ""; 38401 } 38402 function getTextboxSelection(element) { 38403 let start2 = 0; 38404 let end = 0; 38405 if (isTextField(element)) { 38406 start2 = element.selectionStart || 0; 38407 end = element.selectionEnd || 0; 38408 } else if (element.isContentEditable) { 38409 const selection = getDocument(element).getSelection(); 38410 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains2(element, selection.anchorNode) && selection.focusNode && contains2(element, selection.focusNode)) { 38411 const range = selection.getRangeAt(0); 38412 const nextRange = range.cloneRange(); 38413 nextRange.selectNodeContents(element); 38414 nextRange.setEnd(range.startContainer, range.startOffset); 38415 start2 = nextRange.toString().length; 38416 nextRange.setEnd(range.endContainer, range.endOffset); 38417 end = nextRange.toString().length; 38418 } 38419 } 38420 return { start: start2, end }; 38421 } 38422 function getPopupRole(element, fallback) { 38423 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; 38424 const role = element == null ? void 0 : element.getAttribute("role"); 38425 if (role && allowedPopupRoles.indexOf(role) !== -1) { 38426 return role; 38427 } 38428 return fallback; 38429 } 38430 function getScrollingElement(element) { 38431 if (!element) return null; 38432 const isScrollableOverflow = (overflow) => { 38433 if (overflow === "auto") return true; 38434 if (overflow === "scroll") return true; 38435 return false; 38436 }; 38437 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 38438 const { overflowY } = getComputedStyle(element); 38439 if (isScrollableOverflow(overflowY)) return element; 38440 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 38441 const { overflowX } = getComputedStyle(element); 38442 if (isScrollableOverflow(overflowX)) return element; 38443 } 38444 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; 38445 } 38446 function setSelectionRange(element, ...args) { 38447 if (/text|search|password|tel|url/i.test(element.type)) { 38448 element.setSelectionRange(...args); 38449 } 38450 } 38451 function sortBasedOnDOMPosition(items, getElement) { 38452 const pairs = items.map((item, index2) => [index2, item]); 38453 let isOrderDifferent = false; 38454 pairs.sort(([indexA, a2], [indexB, b2]) => { 38455 const elementA = getElement(a2); 38456 const elementB = getElement(b2); 38457 if (elementA === elementB) return 0; 38458 if (!elementA || !elementB) return 0; 38459 if (isElementPreceding(elementA, elementB)) { 38460 if (indexA > indexB) { 38461 isOrderDifferent = true; 38462 } 38463 return -1; 38464 } 38465 if (indexA < indexB) { 38466 isOrderDifferent = true; 38467 } 38468 return 1; 38469 }); 38470 if (isOrderDifferent) { 38471 return pairs.map(([_, item]) => item); 38472 } 38473 return items; 38474 } 38475 function isElementPreceding(a2, b2) { 38476 return Boolean( 38477 b2.compareDocumentPosition(a2) & Node.DOCUMENT_POSITION_PRECEDING 38478 ); 38479 } 38480 38481 // node_modules/@ariakit/core/esm/__chunks/SNHYQNEZ.js 38482 function isTouchDevice() { 38483 return canUseDOM && !!navigator.maxTouchPoints; 38484 } 38485 function isApple() { 38486 if (!canUseDOM) return false; 38487 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 38488 } 38489 function isSafari2() { 38490 return canUseDOM && isApple() && /apple/i.test(navigator.vendor); 38491 } 38492 function isFirefox2() { 38493 return canUseDOM && /firefox\//i.test(navigator.userAgent); 38494 } 38495 38496 // node_modules/@ariakit/core/esm/utils/events.js 38497 function isPortalEvent(event) { 38498 return Boolean( 38499 event.currentTarget && !contains2(event.currentTarget, event.target) 38500 ); 38501 } 38502 function isSelfTarget(event) { 38503 return event.target === event.currentTarget; 38504 } 38505 function isOpeningInNewTab(event) { 38506 const element = event.currentTarget; 38507 if (!element) return false; 38508 const isAppleDevice = isApple(); 38509 if (isAppleDevice && !event.metaKey) return false; 38510 if (!isAppleDevice && !event.ctrlKey) return false; 38511 const tagName = element.tagName.toLowerCase(); 38512 if (tagName === "a") return true; 38513 if (tagName === "button" && element.type === "submit") return true; 38514 if (tagName === "input" && element.type === "submit") return true; 38515 return false; 38516 } 38517 function isDownloading(event) { 38518 const element = event.currentTarget; 38519 if (!element) return false; 38520 const tagName = element.tagName.toLowerCase(); 38521 if (!event.altKey) return false; 38522 if (tagName === "a") return true; 38523 if (tagName === "button" && element.type === "submit") return true; 38524 if (tagName === "input" && element.type === "submit") return true; 38525 return false; 38526 } 38527 function fireBlurEvent(element, eventInit) { 38528 const event = new FocusEvent("blur", eventInit); 38529 const defaultAllowed = element.dispatchEvent(event); 38530 const bubbleInit = { ...eventInit, bubbles: true }; 38531 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 38532 return defaultAllowed; 38533 } 38534 function fireKeyboardEvent(element, type, eventInit) { 38535 const event = new KeyboardEvent(type, eventInit); 38536 return element.dispatchEvent(event); 38537 } 38538 function fireClickEvent(element, eventInit) { 38539 const event = new MouseEvent("click", eventInit); 38540 return element.dispatchEvent(event); 38541 } 38542 function isFocusEventOutside(event, container) { 38543 const containerElement = container || event.currentTarget; 38544 const relatedTarget = event.relatedTarget; 38545 return !relatedTarget || !contains2(containerElement, relatedTarget); 38546 } 38547 function queueBeforeEvent(element, type, callback, timeout) { 38548 const createTimer = (callback2) => { 38549 if (timeout) { 38550 const timerId2 = setTimeout(callback2, timeout); 38551 return () => clearTimeout(timerId2); 38552 } 38553 const timerId = requestAnimationFrame(callback2); 38554 return () => cancelAnimationFrame(timerId); 38555 }; 38556 const cancelTimer = createTimer(() => { 38557 element.removeEventListener(type, callSync, true); 38558 callback(); 38559 }); 38560 const callSync = () => { 38561 cancelTimer(); 38562 callback(); 38563 }; 38564 element.addEventListener(type, callSync, { once: true, capture: true }); 38565 return cancelTimer; 38566 } 38567 function addGlobalEventListener(type, listener, options, scope = window) { 38568 const children = []; 38569 try { 38570 scope.document.addEventListener(type, listener, options); 38571 for (const frame of Array.from(scope.frames)) { 38572 children.push(addGlobalEventListener(type, listener, options, frame)); 38573 } 38574 } catch (e2) { 38575 } 38576 const removeEventListener = () => { 38577 try { 38578 scope.document.removeEventListener(type, listener, options); 38579 } catch (e2) { 38580 } 38581 for (const remove of children) { 38582 remove(); 38583 } 38584 }; 38585 return removeEventListener; 38586 } 38587 38588 // node_modules/@ariakit/react-core/esm/__chunks/KPHZR4MB.js 38589 var React59 = __toESM(require_react(), 1); 38590 var import_react16 = __toESM(require_react(), 1); 38591 var _React = { ...React59 }; 38592 var useReactId = _React.useId; 38593 var useReactDeferredValue = _React.useDeferredValue; 38594 var useReactInsertionEffect = _React.useInsertionEffect; 38595 var useSafeLayoutEffect = canUseDOM ? import_react16.useLayoutEffect : import_react16.useEffect; 38596 function useInitialValue(value) { 38597 const [initialValue] = (0, import_react16.useState)(value); 38598 return initialValue; 38599 } 38600 function useLiveRef(value) { 38601 const ref = (0, import_react16.useRef)(value); 38602 useSafeLayoutEffect(() => { 38603 ref.current = value; 38604 }); 38605 return ref; 38606 } 38607 function useEvent(callback) { 38608 const ref = (0, import_react16.useRef)(() => { 38609 throw new Error("Cannot call an event handler while rendering."); 38610 }); 38611 if (useReactInsertionEffect) { 38612 useReactInsertionEffect(() => { 38613 ref.current = callback; 38614 }); 38615 } else { 38616 ref.current = callback; 38617 } 38618 return (0, import_react16.useCallback)((...args) => { 38619 var _a; 38620 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); 38621 }, []); 38622 } 38623 function useTransactionState(callback) { 38624 const [state, setState] = (0, import_react16.useState)(null); 38625 useSafeLayoutEffect(() => { 38626 if (state == null) return; 38627 if (!callback) return; 38628 let prevState = null; 38629 callback((prev) => { 38630 prevState = prev; 38631 return state; 38632 }); 38633 return () => { 38634 callback(prevState); 38635 }; 38636 }, [state, callback]); 38637 return [state, setState]; 38638 } 38639 function useMergeRefs(...refs) { 38640 return (0, import_react16.useMemo)(() => { 38641 if (!refs.some(Boolean)) return; 38642 return (value) => { 38643 for (const ref of refs) { 38644 setRef(ref, value); 38645 } 38646 }; 38647 }, refs); 38648 } 38649 function useId7(defaultId) { 38650 if (useReactId) { 38651 const reactId = useReactId(); 38652 if (defaultId) return defaultId; 38653 return reactId; 38654 } 38655 const [id, setId] = (0, import_react16.useState)(defaultId); 38656 useSafeLayoutEffect(() => { 38657 if (defaultId || id) return; 38658 const random = Math.random().toString(36).slice(2, 8); 38659 setId(`id-$random}`); 38660 }, [defaultId, id]); 38661 return defaultId || id; 38662 } 38663 function useTagName(refOrElement, type) { 38664 const stringOrUndefined = (type2) => { 38665 if (typeof type2 !== "string") return; 38666 return type2; 38667 }; 38668 const [tagName, setTagName] = (0, import_react16.useState)(() => stringOrUndefined(type)); 38669 useSafeLayoutEffect(() => { 38670 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 38671 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); 38672 }, [refOrElement, type]); 38673 return tagName; 38674 } 38675 function useAttribute(refOrElement, attributeName, defaultValue2) { 38676 const initialValue = useInitialValue(defaultValue2); 38677 const [attribute, setAttribute] = (0, import_react16.useState)(initialValue); 38678 (0, import_react16.useEffect)(() => { 38679 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 38680 if (!element) return; 38681 const callback = () => { 38682 const value = element.getAttribute(attributeName); 38683 setAttribute(value == null ? initialValue : value); 38684 }; 38685 const observer = new MutationObserver(callback); 38686 observer.observe(element, { attributeFilter: [attributeName] }); 38687 callback(); 38688 return () => observer.disconnect(); 38689 }, [refOrElement, attributeName, initialValue]); 38690 return attribute; 38691 } 38692 function useUpdateEffect(effect, deps) { 38693 const mounted = (0, import_react16.useRef)(false); 38694 (0, import_react16.useEffect)(() => { 38695 if (mounted.current) { 38696 return effect(); 38697 } 38698 mounted.current = true; 38699 }, deps); 38700 (0, import_react16.useEffect)( 38701 () => () => { 38702 mounted.current = false; 38703 }, 38704 [] 38705 ); 38706 } 38707 function useUpdateLayoutEffect(effect, deps) { 38708 const mounted = (0, import_react16.useRef)(false); 38709 useSafeLayoutEffect(() => { 38710 if (mounted.current) { 38711 return effect(); 38712 } 38713 mounted.current = true; 38714 }, deps); 38715 useSafeLayoutEffect( 38716 () => () => { 38717 mounted.current = false; 38718 }, 38719 [] 38720 ); 38721 } 38722 function useForceUpdate2() { 38723 return (0, import_react16.useReducer)(() => [], []); 38724 } 38725 function useBooleanEvent(booleanOrCallback) { 38726 return useEvent( 38727 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback 38728 ); 38729 } 38730 function useWrapElement(props, callback, deps = []) { 38731 const wrapElement = (0, import_react16.useCallback)( 38732 (element) => { 38733 if (props.wrapElement) { 38734 element = props.wrapElement(element); 38735 } 38736 return callback(element); 38737 }, 38738 [...deps, props.wrapElement] 38739 ); 38740 return { ...props, wrapElement }; 38741 } 38742 function useMetadataProps(props, key, value) { 38743 const parent = props.onLoadedMetadataCapture; 38744 const onLoadedMetadataCapture = (0, import_react16.useMemo)(() => { 38745 return Object.assign(() => { 38746 }, { ...parent, [key]: value }); 38747 }, [parent, key, value]); 38748 return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }]; 38749 } 38750 var hasInstalledGlobalEventListeners = false; 38751 function useIsMouseMoving() { 38752 (0, import_react16.useEffect)(() => { 38753 if (hasInstalledGlobalEventListeners) return; 38754 addGlobalEventListener("mousemove", setMouseMoving, true); 38755 addGlobalEventListener("mousedown", resetMouseMoving, true); 38756 addGlobalEventListener("mouseup", resetMouseMoving, true); 38757 addGlobalEventListener("keydown", resetMouseMoving, true); 38758 addGlobalEventListener("scroll", resetMouseMoving, true); 38759 hasInstalledGlobalEventListeners = true; 38760 }, []); 38761 const isMouseMoving = useEvent(() => mouseMoving); 38762 return isMouseMoving; 38763 } 38764 var mouseMoving = false; 38765 var previousScreenX = 0; 38766 var previousScreenY = 0; 38767 function hasMouseMovement(event) { 38768 const movementX = event.movementX || event.screenX - previousScreenX; 38769 const movementY = event.movementY || event.screenY - previousScreenY; 38770 previousScreenX = event.screenX; 38771 previousScreenY = event.screenY; 38772 return movementX || movementY || false; 38773 } 38774 function setMouseMoving(event) { 38775 if (!hasMouseMovement(event)) return; 38776 mouseMoving = true; 38777 } 38778 function resetMouseMoving() { 38779 mouseMoving = false; 38780 } 38781 38782 // node_modules/@ariakit/react-core/esm/__chunks/GWSL6KNJ.js 38783 var React60 = __toESM(require_react(), 1); 38784 var import_jsx_runtime225 = __toESM(require_jsx_runtime(), 1); 38785 function forwardRef210(render4) { 38786 const Role = React60.forwardRef( 38787 // @ts-ignore Incompatible with React 19 types. Ignore for now. 38788 (props, ref) => render4({ ...props, ref }) 38789 ); 38790 Role.displayName = render4.displayName || render4.name; 38791 return Role; 38792 } 38793 function memo22(Component, propsAreEqual) { 38794 return React60.memo(Component, propsAreEqual); 38795 } 38796 function createElement5(Type, props) { 38797 const { wrapElement, render: render4, ...rest } = props; 38798 const mergedRef = useMergeRefs(props.ref, getRefProperty(render4)); 38799 let element; 38800 if (React60.isValidElement(render4)) { 38801 const renderProps = { 38802 // @ts-ignore Incompatible with React 19 types. Ignore for now. 38803 ...render4.props, 38804 ref: mergedRef 38805 }; 38806 element = React60.cloneElement(render4, mergeProps2(rest, renderProps)); 38807 } else if (render4) { 38808 element = render4(rest); 38809 } else { 38810 element = /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(Type, { ...rest }); 38811 } 38812 if (wrapElement) { 38813 return wrapElement(element); 38814 } 38815 return element; 38816 } 38817 function createHook(useProps) { 38818 const useRole = (props = {}) => { 38819 return useProps(props); 38820 }; 38821 useRole.displayName = useProps.name; 38822 return useRole; 38823 } 38824 function createStoreContext(providers = [], scopedProviders = []) { 38825 const context = React60.createContext(void 0); 38826 const scopedContext = React60.createContext(void 0); 38827 const useContext210 = () => React60.useContext(context); 38828 const useScopedContext = (onlyScoped = false) => { 38829 const scoped = React60.useContext(scopedContext); 38830 const store2 = useContext210(); 38831 if (onlyScoped) return scoped; 38832 return scoped || store2; 38833 }; 38834 const useProviderContext = () => { 38835 const scoped = React60.useContext(scopedContext); 38836 const store2 = useContext210(); 38837 if (scoped && scoped === store2) return; 38838 return store2; 38839 }; 38840 const ContextProvider = (props) => { 38841 return providers.reduceRight( 38842 (children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(Provider2, { ...props, children }), 38843 /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(context.Provider, { ...props }) 38844 ); 38845 }; 38846 const ScopedContextProvider = (props) => { 38847 return /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(ContextProvider, { ...props, children: scopedProviders.reduceRight( 38848 (children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(Provider2, { ...props, children }), 38849 /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(scopedContext.Provider, { ...props }) 38850 ) }); 38851 }; 38852 return { 38853 context, 38854 scopedContext, 38855 useContext: useContext210, 38856 useScopedContext, 38857 useProviderContext, 38858 ContextProvider, 38859 ScopedContextProvider 38860 }; 38861 } 38862 38863 // node_modules/@ariakit/react-core/esm/__chunks/SMPCIMZM.js 38864 var ctx2 = createStoreContext(); 38865 var useCollectionContext = ctx2.useContext; 38866 var useCollectionScopedContext = ctx2.useScopedContext; 38867 var useCollectionProviderContext = ctx2.useProviderContext; 38868 var CollectionContextProvider = ctx2.ContextProvider; 38869 var CollectionScopedContextProvider = ctx2.ScopedContextProvider; 38870 38871 // node_modules/@ariakit/react-core/esm/__chunks/AVVXDJMZ.js 38872 var import_react17 = __toESM(require_react(), 1); 38873 var ctx3 = createStoreContext( 38874 [CollectionContextProvider], 38875 [CollectionScopedContextProvider] 38876 ); 38877 var useCompositeContext = ctx3.useContext; 38878 var useCompositeScopedContext = ctx3.useScopedContext; 38879 var useCompositeProviderContext = ctx3.useProviderContext; 38880 var CompositeContextProvider = ctx3.ContextProvider; 38881 var CompositeScopedContextProvider = ctx3.ScopedContextProvider; 38882 var CompositeItemContext = (0, import_react17.createContext)( 38883 void 0 38884 ); 38885 var CompositeRowContext = (0, import_react17.createContext)( 38886 void 0 38887 ); 38888 38889 // node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js 38890 function findFirstEnabledItem(items, excludeId) { 38891 return items.find((item) => { 38892 if (excludeId) { 38893 return !item.disabled && item.id !== excludeId; 38894 } 38895 return !item.disabled; 38896 }); 38897 } 38898 function getEnabledItem(store2, id) { 38899 if (!id) return null; 38900 return store2.item(id) || null; 38901 } 38902 function groupItemsByRows(items) { 38903 const rows = []; 38904 for (const item of items) { 38905 const row = rows.find((currentRow) => { 38906 var _a; 38907 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 38908 }); 38909 if (row) { 38910 row.push(item); 38911 } else { 38912 rows.push([item]); 38913 } 38914 } 38915 return rows; 38916 } 38917 function selectTextField(element, collapseToEnd = false) { 38918 if (isTextField(element)) { 38919 element.setSelectionRange( 38920 collapseToEnd ? element.value.length : 0, 38921 element.value.length 38922 ); 38923 } else if (element.isContentEditable) { 38924 const selection = getDocument(element).getSelection(); 38925 selection == null ? void 0 : selection.selectAllChildren(element); 38926 if (collapseToEnd) { 38927 selection == null ? void 0 : selection.collapseToEnd(); 38928 } 38929 } 38930 } 38931 var FOCUS_SILENTLY = /* @__PURE__ */ Symbol("FOCUS_SILENTLY"); 38932 function focusSilently(element) { 38933 element[FOCUS_SILENTLY] = true; 38934 element.focus({ preventScroll: true }); 38935 } 38936 function silentlyFocused(element) { 38937 const isSilentlyFocused = element[FOCUS_SILENTLY]; 38938 delete element[FOCUS_SILENTLY]; 38939 return isSilentlyFocused; 38940 } 38941 function isItem(store2, element, exclude) { 38942 if (!element) return false; 38943 if (element === exclude) return false; 38944 const item = store2.item(element.id); 38945 if (!item) return false; 38946 if (exclude && item.element === exclude) return false; 38947 return true; 38948 } 38949 38950 // node_modules/@ariakit/react-core/esm/__chunks/Z2O3VLAQ.js 38951 var import_react18 = __toESM(require_react(), 1); 38952 var TagName = "div"; 38953 var useCollectionItem = createHook( 38954 function useCollectionItem2({ 38955 store: store2, 38956 shouldRegisterItem = true, 38957 getItem = identity, 38958 // @ts-expect-error This prop may come from a collection renderer. 38959 element, 38960 ...props 38961 }) { 38962 const context = useCollectionContext(); 38963 store2 = store2 || context; 38964 const id = useId7(props.id); 38965 const ref = (0, import_react18.useRef)(element); 38966 (0, import_react18.useEffect)(() => { 38967 const element2 = ref.current; 38968 if (!id) return; 38969 if (!element2) return; 38970 if (!shouldRegisterItem) return; 38971 const item = getItem({ id, element: element2 }); 38972 return store2 == null ? void 0 : store2.renderItem(item); 38973 }, [id, shouldRegisterItem, getItem, store2]); 38974 props = { 38975 ...props, 38976 ref: useMergeRefs(ref, props.ref) 38977 }; 38978 return removeUndefinedValues(props); 38979 } 38980 ); 38981 var CollectionItem = forwardRef210(function CollectionItem2(props) { 38982 const htmlProps = useCollectionItem(props); 38983 return createElement5(TagName, htmlProps); 38984 }); 38985 38986 // node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js 38987 var import_react19 = __toESM(require_react(), 1); 38988 var FocusableContext = (0, import_react19.createContext)(true); 38989 38990 // node_modules/@ariakit/core/esm/utils/focus.js 38991 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'])"; 38992 function isFocusable(element) { 38993 if (!element.matches(selector)) return false; 38994 if (!isVisible(element)) return false; 38995 if (element.closest("[inert]")) return false; 38996 return true; 38997 } 38998 function getClosestFocusable(element) { 38999 while (element && !isFocusable(element)) { 39000 element = element.closest(selector); 39001 } 39002 return element || null; 39003 } 39004 function hasFocus(element) { 39005 const activeElement2 = getActiveElement(element); 39006 if (!activeElement2) return false; 39007 if (activeElement2 === element) return true; 39008 const activeDescendant = activeElement2.getAttribute("aria-activedescendant"); 39009 if (!activeDescendant) return false; 39010 return activeDescendant === element.id; 39011 } 39012 function hasFocusWithin(element) { 39013 const activeElement2 = getActiveElement(element); 39014 if (!activeElement2) return false; 39015 if (contains2(element, activeElement2)) return true; 39016 const activeDescendant = activeElement2.getAttribute("aria-activedescendant"); 39017 if (!activeDescendant) return false; 39018 if (!("id" in element)) return false; 39019 if (activeDescendant === element.id) return true; 39020 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 39021 } 39022 function focusIfNeeded(element) { 39023 if (!hasFocusWithin(element) && isFocusable(element)) { 39024 element.focus(); 39025 } 39026 } 39027 function focusIntoView(element, options) { 39028 if (!("scrollIntoView" in element)) { 39029 element.focus(); 39030 } else { 39031 element.focus({ preventScroll: true }); 39032 element.scrollIntoView({ block: "nearest", inline: "nearest", ...options }); 39033 } 39034 } 39035 39036 // node_modules/@ariakit/react-core/esm/__chunks/U6HHPQDW.js 39037 var import_react20 = __toESM(require_react(), 1); 39038 var TagName2 = "div"; 39039 var isSafariBrowser = isSafari2(); 39040 var alwaysFocusVisibleInputTypes = [ 39041 "text", 39042 "search", 39043 "url", 39044 "tel", 39045 "email", 39046 "password", 39047 "number", 39048 "date", 39049 "month", 39050 "week", 39051 "time", 39052 "datetime", 39053 "datetime-local" 39054 ]; 39055 var safariFocusAncestorSymbol = /* @__PURE__ */ Symbol("safariFocusAncestor"); 39056 function markSafariFocusAncestor(element, value) { 39057 if (!element) return; 39058 element[safariFocusAncestorSymbol] = value; 39059 } 39060 function isAlwaysFocusVisible(element) { 39061 const { tagName, readOnly, type } = element; 39062 if (tagName === "TEXTAREA" && !readOnly) return true; 39063 if (tagName === "SELECT" && !readOnly) return true; 39064 if (tagName === "INPUT" && !readOnly) { 39065 return alwaysFocusVisibleInputTypes.includes(type); 39066 } 39067 if (element.isContentEditable) return true; 39068 const role = element.getAttribute("role"); 39069 if (role === "combobox" && element.dataset.name) { 39070 return true; 39071 } 39072 return false; 39073 } 39074 function getLabels(element) { 39075 if ("labels" in element) { 39076 return element.labels; 39077 } 39078 return null; 39079 } 39080 function isNativeCheckboxOrRadio(element) { 39081 const tagName = element.tagName.toLowerCase(); 39082 if (tagName === "input" && element.type) { 39083 return element.type === "radio" || element.type === "checkbox"; 39084 } 39085 return false; 39086 } 39087 function isNativeTabbable(tagName) { 39088 if (!tagName) return true; 39089 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 39090 } 39091 function supportsDisabledAttribute(tagName) { 39092 if (!tagName) return true; 39093 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 39094 } 39095 function getTabIndex2(focusable2, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { 39096 if (!focusable2) { 39097 return tabIndexProp; 39098 } 39099 if (trulyDisabled) { 39100 if (nativeTabbable && !supportsDisabled) { 39101 return -1; 39102 } 39103 return; 39104 } 39105 if (nativeTabbable) { 39106 return tabIndexProp; 39107 } 39108 return tabIndexProp || 0; 39109 } 39110 function useDisableEvent(onEvent, disabled2) { 39111 return useEvent((event) => { 39112 onEvent == null ? void 0 : onEvent(event); 39113 if (event.defaultPrevented) return; 39114 if (disabled2) { 39115 event.stopPropagation(); 39116 event.preventDefault(); 39117 } 39118 }); 39119 } 39120 var hasInstalledGlobalEventListeners2 = false; 39121 var isKeyboardModality = true; 39122 function onGlobalMouseDown(event) { 39123 const target = event.target; 39124 if (target && "hasAttribute" in target) { 39125 if (!target.hasAttribute("data-focus-visible")) { 39126 isKeyboardModality = false; 39127 } 39128 } 39129 } 39130 function onGlobalKeyDown(event) { 39131 if (event.metaKey) return; 39132 if (event.ctrlKey) return; 39133 if (event.altKey) return; 39134 isKeyboardModality = true; 39135 } 39136 var useFocusable = createHook( 39137 function useFocusable2({ 39138 focusable: focusable2 = true, 39139 accessibleWhenDisabled, 39140 autoFocus, 39141 onFocusVisible, 39142 ...props 39143 }) { 39144 const ref = (0, import_react20.useRef)(null); 39145 (0, import_react20.useEffect)(() => { 39146 if (!focusable2) return; 39147 if (hasInstalledGlobalEventListeners2) return; 39148 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 39149 addGlobalEventListener("keydown", onGlobalKeyDown, true); 39150 hasInstalledGlobalEventListeners2 = true; 39151 }, [focusable2]); 39152 if (isSafariBrowser) { 39153 (0, import_react20.useEffect)(() => { 39154 if (!focusable2) return; 39155 const element = ref.current; 39156 if (!element) return; 39157 if (!isNativeCheckboxOrRadio(element)) return; 39158 const labels = getLabels(element); 39159 if (!labels) return; 39160 const onMouseUp = () => queueMicrotask(() => element.focus()); 39161 for (const label of labels) { 39162 label.addEventListener("mouseup", onMouseUp); 39163 } 39164 return () => { 39165 for (const label of labels) { 39166 label.removeEventListener("mouseup", onMouseUp); 39167 } 39168 }; 39169 }, [focusable2]); 39170 } 39171 const disabled2 = focusable2 && disabledFromProps(props); 39172 const trulyDisabled = !!disabled2 && !accessibleWhenDisabled; 39173 const [focusVisible, setFocusVisible] = (0, import_react20.useState)(false); 39174 (0, import_react20.useEffect)(() => { 39175 if (!focusable2) return; 39176 if (trulyDisabled && focusVisible) { 39177 setFocusVisible(false); 39178 } 39179 }, [focusable2, trulyDisabled, focusVisible]); 39180 (0, import_react20.useEffect)(() => { 39181 if (!focusable2) return; 39182 if (!focusVisible) return; 39183 const element = ref.current; 39184 if (!element) return; 39185 if (typeof IntersectionObserver === "undefined") return; 39186 const observer = new IntersectionObserver(() => { 39187 if (!isFocusable(element)) { 39188 setFocusVisible(false); 39189 } 39190 }); 39191 observer.observe(element); 39192 return () => observer.disconnect(); 39193 }, [focusable2, focusVisible]); 39194 const onKeyPressCapture = useDisableEvent( 39195 props.onKeyPressCapture, 39196 disabled2 39197 ); 39198 const onMouseDownCapture = useDisableEvent( 39199 props.onMouseDownCapture, 39200 disabled2 39201 ); 39202 const onClickCapture = useDisableEvent(props.onClickCapture, disabled2); 39203 const onMouseDownProp = props.onMouseDown; 39204 const onMouseDown = useEvent((event) => { 39205 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 39206 if (event.defaultPrevented) return; 39207 if (!focusable2) return; 39208 const element = event.currentTarget; 39209 if (!isSafariBrowser) return; 39210 if (isPortalEvent(event)) return; 39211 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; 39212 let receivedFocus = false; 39213 const onFocus = () => { 39214 receivedFocus = true; 39215 }; 39216 const options = { capture: true, once: true }; 39217 element.addEventListener("focusin", onFocus, options); 39218 const focusableContainer = getClosestFocusable(element.parentElement); 39219 markSafariFocusAncestor(focusableContainer, true); 39220 queueBeforeEvent(element, "mouseup", () => { 39221 element.removeEventListener("focusin", onFocus, true); 39222 markSafariFocusAncestor(focusableContainer, false); 39223 if (receivedFocus) return; 39224 focusIfNeeded(element); 39225 }); 39226 }); 39227 const handleFocusVisible = (event, currentTarget) => { 39228 if (currentTarget) { 39229 event.currentTarget = currentTarget; 39230 } 39231 if (!focusable2) return; 39232 const element = event.currentTarget; 39233 if (!element) return; 39234 if (!hasFocus(element)) return; 39235 onFocusVisible == null ? void 0 : onFocusVisible(event); 39236 if (event.defaultPrevented) return; 39237 element.dataset.focusVisible = "true"; 39238 setFocusVisible(true); 39239 }; 39240 const onKeyDownCaptureProp = props.onKeyDownCapture; 39241 const onKeyDownCapture = useEvent((event) => { 39242 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); 39243 if (event.defaultPrevented) return; 39244 if (!focusable2) return; 39245 if (focusVisible) return; 39246 if (event.metaKey) return; 39247 if (event.altKey) return; 39248 if (event.ctrlKey) return; 39249 if (!isSelfTarget(event)) return; 39250 const element = event.currentTarget; 39251 const applyFocusVisible = () => handleFocusVisible(event, element); 39252 queueBeforeEvent(element, "focusout", applyFocusVisible); 39253 }); 39254 const onFocusCaptureProp = props.onFocusCapture; 39255 const onFocusCapture = useEvent((event) => { 39256 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 39257 if (event.defaultPrevented) return; 39258 if (!focusable2) return; 39259 if (!isSelfTarget(event)) { 39260 setFocusVisible(false); 39261 return; 39262 } 39263 const element = event.currentTarget; 39264 const applyFocusVisible = () => handleFocusVisible(event, element); 39265 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { 39266 queueBeforeEvent(event.target, "focusout", applyFocusVisible); 39267 } else { 39268 setFocusVisible(false); 39269 } 39270 }); 39271 const onBlurProp = props.onBlur; 39272 const onBlur = useEvent((event) => { 39273 onBlurProp == null ? void 0 : onBlurProp(event); 39274 if (!focusable2) return; 39275 if (!isFocusEventOutside(event)) return; 39276 event.currentTarget.removeAttribute("data-focus-visible"); 39277 setFocusVisible(false); 39278 }); 39279 const autoFocusOnShow = (0, import_react20.useContext)(FocusableContext); 39280 const autoFocusRef = useEvent((element) => { 39281 if (!focusable2) return; 39282 if (!autoFocus) return; 39283 if (!element) return; 39284 if (!autoFocusOnShow) return; 39285 queueMicrotask(() => { 39286 if (hasFocus(element)) return; 39287 if (!isFocusable(element)) return; 39288 element.focus(); 39289 }); 39290 }); 39291 const tagName = useTagName(ref); 39292 const nativeTabbable = focusable2 && isNativeTabbable(tagName); 39293 const supportsDisabled = focusable2 && supportsDisabledAttribute(tagName); 39294 const styleProp = props.style; 39295 const style = (0, import_react20.useMemo)(() => { 39296 if (trulyDisabled) { 39297 return { pointerEvents: "none", ...styleProp }; 39298 } 39299 return styleProp; 39300 }, [trulyDisabled, styleProp]); 39301 props = { 39302 "data-focus-visible": focusable2 && focusVisible || void 0, 39303 "data-autofocus": autoFocus || void 0, 39304 "aria-disabled": disabled2 || void 0, 39305 ...props, 39306 ref: useMergeRefs(ref, autoFocusRef, props.ref), 39307 style, 39308 tabIndex: getTabIndex2( 39309 focusable2, 39310 trulyDisabled, 39311 nativeTabbable, 39312 supportsDisabled, 39313 props.tabIndex 39314 ), 39315 disabled: supportsDisabled && trulyDisabled ? true : void 0, 39316 // TODO: Test Focusable contentEditable. 39317 contentEditable: disabled2 ? void 0 : props.contentEditable, 39318 onKeyPressCapture, 39319 onClickCapture, 39320 onMouseDownCapture, 39321 onMouseDown, 39322 onKeyDownCapture, 39323 onFocusCapture, 39324 onBlur 39325 }; 39326 return removeUndefinedValues(props); 39327 } 39328 ); 39329 var Focusable = forwardRef210(function Focusable2(props) { 39330 const htmlProps = useFocusable(props); 39331 return createElement5(TagName2, htmlProps); 39332 }); 39333 39334 // node_modules/@ariakit/react-core/esm/__chunks/PZ3OL7I2.js 39335 var import_react21 = __toESM(require_react(), 1); 39336 var TagName3 = "button"; 39337 function isNativeClick(event) { 39338 if (!event.isTrusted) return false; 39339 const element = event.currentTarget; 39340 if (event.key === "Enter") { 39341 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 39342 } 39343 if (event.key === " ") { 39344 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 39345 } 39346 return false; 39347 } 39348 var symbol = /* @__PURE__ */ Symbol("command"); 39349 var useCommand = createHook( 39350 function useCommand2({ clickOnEnter = true, clickOnSpace = true, ...props }) { 39351 const ref = (0, import_react21.useRef)(null); 39352 const [isNativeButton, setIsNativeButton] = (0, import_react21.useState)(false); 39353 (0, import_react21.useEffect)(() => { 39354 if (!ref.current) return; 39355 setIsNativeButton(isButton(ref.current)); 39356 }, []); 39357 const [active, setActive] = (0, import_react21.useState)(false); 39358 const activeRef = (0, import_react21.useRef)(false); 39359 const disabled2 = disabledFromProps(props); 39360 const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true); 39361 const onKeyDownProp = props.onKeyDown; 39362 const onKeyDown = useEvent((event) => { 39363 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 39364 const element = event.currentTarget; 39365 if (event.defaultPrevented) return; 39366 if (isDuplicate) return; 39367 if (disabled2) return; 39368 if (!isSelfTarget(event)) return; 39369 if (isTextField(element)) return; 39370 if (element.isContentEditable) return; 39371 const isEnter = clickOnEnter && event.key === "Enter"; 39372 const isSpace = clickOnSpace && event.key === " "; 39373 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 39374 const shouldPreventSpace = event.key === " " && !clickOnSpace; 39375 if (shouldPreventEnter || shouldPreventSpace) { 39376 event.preventDefault(); 39377 return; 39378 } 39379 if (isEnter || isSpace) { 39380 const nativeClick = isNativeClick(event); 39381 if (isEnter) { 39382 if (!nativeClick) { 39383 event.preventDefault(); 39384 const { view, ...eventInit } = event; 39385 const click = () => fireClickEvent(element, eventInit); 39386 if (isFirefox2()) { 39387 queueBeforeEvent(element, "keyup", click); 39388 } else { 39389 queueMicrotask(click); 39390 } 39391 } 39392 } else if (isSpace) { 39393 activeRef.current = true; 39394 if (!nativeClick) { 39395 event.preventDefault(); 39396 setActive(true); 39397 } 39398 } 39399 } 39400 }); 39401 const onKeyUpProp = props.onKeyUp; 39402 const onKeyUp = useEvent((event) => { 39403 onKeyUpProp == null ? void 0 : onKeyUpProp(event); 39404 if (event.defaultPrevented) return; 39405 if (isDuplicate) return; 39406 if (disabled2) return; 39407 if (event.metaKey) return; 39408 const isSpace = clickOnSpace && event.key === " "; 39409 if (activeRef.current && isSpace) { 39410 activeRef.current = false; 39411 if (!isNativeClick(event)) { 39412 event.preventDefault(); 39413 setActive(false); 39414 const element = event.currentTarget; 39415 const { view, ...eventInit } = event; 39416 queueMicrotask(() => fireClickEvent(element, eventInit)); 39417 } 39418 } 39419 }); 39420 props = { 39421 "data-active": active || void 0, 39422 type: isNativeButton ? "button" : void 0, 39423 ...metadataProps, 39424 ...props, 39425 ref: useMergeRefs(ref, props.ref), 39426 onKeyDown, 39427 onKeyUp 39428 }; 39429 props = useFocusable(props); 39430 return props; 39431 } 39432 ); 39433 var Command = forwardRef210(function Command2(props) { 39434 const htmlProps = useCommand(props); 39435 return createElement5(TagName3, htmlProps); 39436 }); 39437 39438 // node_modules/@ariakit/core/esm/__chunks/SXKM4CGU.js 39439 function getInternal(store2, key) { 39440 const internals = store2.__unstableInternals; 39441 invariant(internals, "Invalid store"); 39442 return internals[key]; 39443 } 39444 function createStore(initialState, ...stores) { 39445 let state = initialState; 39446 let prevStateBatch = state; 39447 let lastUpdate = /* @__PURE__ */ Symbol(); 39448 let destroy = noop5; 39449 const instances = /* @__PURE__ */ new Set(); 39450 const updatedKeys = /* @__PURE__ */ new Set(); 39451 const setups = /* @__PURE__ */ new Set(); 39452 const listeners = /* @__PURE__ */ new Set(); 39453 const batchListeners = /* @__PURE__ */ new Set(); 39454 const disposables = /* @__PURE__ */ new WeakMap(); 39455 const listenerKeys = /* @__PURE__ */ new WeakMap(); 39456 const storeSetup = (callback) => { 39457 setups.add(callback); 39458 return () => setups.delete(callback); 39459 }; 39460 const storeInit = () => { 39461 const initialized = instances.size; 39462 const instance = /* @__PURE__ */ Symbol(); 39463 instances.add(instance); 39464 const maybeDestroy = () => { 39465 instances.delete(instance); 39466 if (instances.size) return; 39467 destroy(); 39468 }; 39469 if (initialized) return maybeDestroy; 39470 const desyncs = getKeys(state).map( 39471 (key) => chain( 39472 ...stores.map((store2) => { 39473 var _a; 39474 const storeState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); 39475 if (!storeState) return; 39476 if (!hasOwnProperty(storeState, key)) return; 39477 return sync2(store2, [key], (state2) => { 39478 setState( 39479 key, 39480 state2[key], 39481 // @ts-expect-error - Not public API. This is just to prevent 39482 // infinite loops. 39483 true 39484 ); 39485 }); 39486 }) 39487 ) 39488 ); 39489 const teardowns = []; 39490 for (const setup2 of setups) { 39491 teardowns.push(setup2()); 39492 } 39493 const cleanups = stores.map(init); 39494 destroy = chain(...desyncs, ...teardowns, ...cleanups); 39495 return maybeDestroy; 39496 }; 39497 const sub = (keys, listener, set3 = listeners) => { 39498 set3.add(listener); 39499 listenerKeys.set(listener, keys); 39500 return () => { 39501 var _a; 39502 (_a = disposables.get(listener)) == null ? void 0 : _a(); 39503 disposables.delete(listener); 39504 listenerKeys.delete(listener); 39505 set3.delete(listener); 39506 }; 39507 }; 39508 const storeSubscribe = (keys, listener) => sub(keys, listener); 39509 const storeSync = (keys, listener) => { 39510 disposables.set(listener, listener(state, state)); 39511 return sub(keys, listener); 39512 }; 39513 const storeBatch = (keys, listener) => { 39514 disposables.set(listener, listener(state, prevStateBatch)); 39515 return sub(keys, listener, batchListeners); 39516 }; 39517 const storePick = (keys) => createStore(pick(state, keys), finalStore); 39518 const storeOmit = (keys) => createStore(omit(state, keys), finalStore); 39519 const getState = () => state; 39520 const setState = (key, value, fromStores = false) => { 39521 var _a; 39522 if (!hasOwnProperty(state, key)) return; 39523 const nextValue = applyState(value, state[key]); 39524 if (nextValue === state[key]) return; 39525 if (!fromStores) { 39526 for (const store2 of stores) { 39527 (_a = store2 == null ? void 0 : store2.setState) == null ? void 0 : _a.call(store2, key, nextValue); 39528 } 39529 } 39530 const prevState = state; 39531 state = { ...state, [key]: nextValue }; 39532 const thisUpdate = /* @__PURE__ */ Symbol(); 39533 lastUpdate = thisUpdate; 39534 updatedKeys.add(key); 39535 const run = (listener, prev, uKeys) => { 39536 var _a2; 39537 const keys = listenerKeys.get(listener); 39538 const updated = (k2) => uKeys ? uKeys.has(k2) : k2 === key; 39539 if (!keys || keys.some(updated)) { 39540 (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); 39541 disposables.set(listener, listener(state, prev)); 39542 } 39543 }; 39544 for (const listener of listeners) { 39545 run(listener, prevState); 39546 } 39547 queueMicrotask(() => { 39548 if (lastUpdate !== thisUpdate) return; 39549 const snapshot = state; 39550 for (const listener of batchListeners) { 39551 run(listener, prevStateBatch, updatedKeys); 39552 } 39553 prevStateBatch = snapshot; 39554 updatedKeys.clear(); 39555 }); 39556 }; 39557 const finalStore = { 39558 getState, 39559 setState, 39560 __unstableInternals: { 39561 setup: storeSetup, 39562 init: storeInit, 39563 subscribe: storeSubscribe, 39564 sync: storeSync, 39565 batch: storeBatch, 39566 pick: storePick, 39567 omit: storeOmit 39568 } 39569 }; 39570 return finalStore; 39571 } 39572 function setup(store2, ...args) { 39573 if (!store2) return; 39574 return getInternal(store2, "setup")(...args); 39575 } 39576 function init(store2, ...args) { 39577 if (!store2) return; 39578 return getInternal(store2, "init")(...args); 39579 } 39580 function subscribe2(store2, ...args) { 39581 if (!store2) return; 39582 return getInternal(store2, "subscribe")(...args); 39583 } 39584 function sync2(store2, ...args) { 39585 if (!store2) return; 39586 return getInternal(store2, "sync")(...args); 39587 } 39588 function batch(store2, ...args) { 39589 if (!store2) return; 39590 return getInternal(store2, "batch")(...args); 39591 } 39592 function omit2(store2, ...args) { 39593 if (!store2) return; 39594 return getInternal(store2, "omit")(...args); 39595 } 39596 function pick2(store2, ...args) { 39597 if (!store2) return; 39598 return getInternal(store2, "pick")(...args); 39599 } 39600 function mergeStore(...stores) { 39601 var _a; 39602 const initialState = {}; 39603 for (const store22 of stores) { 39604 const nextState = (_a = store22 == null ? void 0 : store22.getState) == null ? void 0 : _a.call(store22); 39605 if (nextState) { 39606 Object.assign(initialState, nextState); 39607 } 39608 } 39609 const store2 = createStore(initialState, ...stores); 39610 return Object.assign({}, ...stores, store2); 39611 } 39612 function throwOnConflictingProps(props, store2) { 39613 if (false) return; 39614 if (!store2) return; 39615 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { 39616 var _a; 39617 const stateKey = key.replace("default", ""); 39618 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`; 39619 }); 39620 if (!defaultKeys.length) return; 39621 const storeState = store2.getState(); 39622 const conflictingProps = defaultKeys.filter( 39623 (key) => hasOwnProperty(storeState, key) 39624 ); 39625 if (!conflictingProps.length) return; 39626 throw new Error( 39627 `Passing a store prop in conjunction with a default state is not supported. 39628 39629 const store = useSelectStore(); 39630 <SelectProvider store={store} defaultValue="Apple" /> 39631 ^ ^ 39632 39633 Instead, pass the default state to the topmost store: 39634 39635 const store = useSelectStore({ defaultValue: "Apple" }); 39636 <SelectProvider store={store} /> 39637 39638 See https://github.com/ariakit/ariakit/pull/2745 for more details. 39639 39640 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 39641 ` 39642 ); 39643 } 39644 39645 // node_modules/@ariakit/react-core/esm/__chunks/Q5W46E73.js 39646 var React61 = __toESM(require_react(), 1); 39647 var import_shim2 = __toESM(require_shim(), 1); 39648 var { useSyncExternalStore: useSyncExternalStore2 } = import_shim2.default; 39649 var noopSubscribe = () => () => { 39650 }; 39651 function useStoreState(store2, keyOrSelector = identity) { 39652 const storeSubscribe = React61.useCallback( 39653 (callback) => { 39654 if (!store2) return noopSubscribe(); 39655 return subscribe2(store2, null, callback); 39656 }, 39657 [store2] 39658 ); 39659 const getSnapshot = () => { 39660 const key = typeof keyOrSelector === "string" ? keyOrSelector : null; 39661 const selector2 = typeof keyOrSelector === "function" ? keyOrSelector : null; 39662 const state = store2 == null ? void 0 : store2.getState(); 39663 if (selector2) return selector2(state); 39664 if (!state) return; 39665 if (!key) return; 39666 if (!hasOwnProperty(state, key)) return; 39667 return state[key]; 39668 }; 39669 return useSyncExternalStore2(storeSubscribe, getSnapshot, getSnapshot); 39670 } 39671 function useStoreStateObject(store2, object) { 39672 const objRef = React61.useRef( 39673 {} 39674 ); 39675 const storeSubscribe = React61.useCallback( 39676 (callback) => { 39677 if (!store2) return noopSubscribe(); 39678 return subscribe2(store2, null, callback); 39679 }, 39680 [store2] 39681 ); 39682 const getSnapshot = () => { 39683 const state = store2 == null ? void 0 : store2.getState(); 39684 let updated = false; 39685 const obj = objRef.current; 39686 for (const prop in object) { 39687 const keyOrSelector = object[prop]; 39688 if (typeof keyOrSelector === "function") { 39689 const value = keyOrSelector(state); 39690 if (value !== obj[prop]) { 39691 obj[prop] = value; 39692 updated = true; 39693 } 39694 } 39695 if (typeof keyOrSelector === "string") { 39696 if (!state) continue; 39697 if (!hasOwnProperty(state, keyOrSelector)) continue; 39698 const value = state[keyOrSelector]; 39699 if (value !== obj[prop]) { 39700 obj[prop] = value; 39701 updated = true; 39702 } 39703 } 39704 } 39705 if (updated) { 39706 objRef.current = { ...obj }; 39707 } 39708 return objRef.current; 39709 }; 39710 return useSyncExternalStore2(storeSubscribe, getSnapshot, getSnapshot); 39711 } 39712 function useStoreProps(store2, props, key, setKey) { 39713 const value = hasOwnProperty(props, key) ? props[key] : void 0; 39714 const setValue = setKey ? props[setKey] : void 0; 39715 const propsRef = useLiveRef({ value, setValue }); 39716 useSafeLayoutEffect(() => { 39717 return sync2(store2, [key], (state, prev) => { 39718 const { value: value2, setValue: setValue2 } = propsRef.current; 39719 if (!setValue2) return; 39720 if (state[key] === prev[key]) return; 39721 if (state[key] === value2) return; 39722 setValue2(state[key]); 39723 }); 39724 }, [store2, key]); 39725 useSafeLayoutEffect(() => { 39726 if (value === void 0) return; 39727 store2.setState(key, value); 39728 return batch(store2, [key], () => { 39729 if (value === void 0) return; 39730 store2.setState(key, value); 39731 }); 39732 }); 39733 } 39734 function useStore2(createStore2, props) { 39735 const [store2, setStore] = React61.useState(() => createStore2(props)); 39736 useSafeLayoutEffect(() => init(store2), [store2]); 39737 const useState210 = React61.useCallback( 39738 (keyOrSelector) => useStoreState(store2, keyOrSelector), 39739 [store2] 39740 ); 39741 const memoizedStore = React61.useMemo( 39742 () => ({ ...store2, useState: useState210 }), 39743 [store2, useState210] 39744 ); 39745 const updateStore = useEvent(() => { 39746 setStore((store22) => createStore2({ ...props, ...store22.getState() })); 39747 }); 39748 return [memoizedStore, updateStore]; 39749 } 39750 39751 // node_modules/@ariakit/react-core/esm/__chunks/WZWDIE3S.js 39752 var import_react22 = __toESM(require_react(), 1); 39753 var import_jsx_runtime226 = __toESM(require_jsx_runtime(), 1); 39754 var TagName4 = "button"; 39755 function isEditableElement(element) { 39756 if (isTextbox(element)) return true; 39757 return element.tagName === "INPUT" && !isButton(element); 39758 } 39759 function getNextPageOffset(scrollingElement, pageUp = false) { 39760 const height = scrollingElement.clientHeight; 39761 const { top } = scrollingElement.getBoundingClientRect(); 39762 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 39763 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 39764 if (scrollingElement.tagName === "HTML") { 39765 return pageOffset + scrollingElement.scrollTop; 39766 } 39767 return pageOffset; 39768 } 39769 function getItemOffset(itemElement, pageUp = false) { 39770 const { top } = itemElement.getBoundingClientRect(); 39771 if (pageUp) { 39772 return top + itemElement.clientHeight; 39773 } 39774 return top; 39775 } 39776 function findNextPageItemId(element, store2, next, pageUp = false) { 39777 var _a; 39778 if (!store2) return; 39779 if (!next) return; 39780 const { renderedItems } = store2.getState(); 39781 const scrollingElement = getScrollingElement(element); 39782 if (!scrollingElement) return; 39783 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 39784 let id; 39785 let prevDifference; 39786 for (let i2 = 0; i2 < renderedItems.length; i2 += 1) { 39787 const previousId = id; 39788 id = next(i2); 39789 if (!id) break; 39790 if (id === previousId) continue; 39791 const itemElement = (_a = getEnabledItem(store2, id)) == null ? void 0 : _a.element; 39792 if (!itemElement) continue; 39793 const itemOffset = getItemOffset(itemElement, pageUp); 39794 const difference = itemOffset - nextPageOffset; 39795 const absDifference = Math.abs(difference); 39796 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 39797 if (prevDifference !== void 0 && prevDifference < absDifference) { 39798 id = previousId; 39799 } 39800 break; 39801 } 39802 prevDifference = absDifference; 39803 } 39804 return id; 39805 } 39806 function targetIsAnotherItem(event, store2) { 39807 if (isSelfTarget(event)) return false; 39808 return isItem(store2, event.target); 39809 } 39810 var useCompositeItem = createHook( 39811 function useCompositeItem2({ 39812 store: store2, 39813 rowId: rowIdProp, 39814 preventScrollOnKeyDown = false, 39815 moveOnKeyPress = true, 39816 tabbable: tabbable2 = false, 39817 getItem: getItemProp, 39818 "aria-setsize": ariaSetSizeProp, 39819 "aria-posinset": ariaPosInSetProp, 39820 ...props 39821 }) { 39822 const context = useCompositeContext(); 39823 store2 = store2 || context; 39824 const id = useId7(props.id); 39825 const ref = (0, import_react22.useRef)(null); 39826 const row = (0, import_react22.useContext)(CompositeRowContext); 39827 const disabled2 = disabledFromProps(props); 39828 const trulyDisabled = disabled2 && !props.accessibleWhenDisabled; 39829 const { 39830 rowId, 39831 baseElement, 39832 isActiveItem, 39833 ariaSetSize, 39834 ariaPosInSet, 39835 isTabbable 39836 } = useStoreStateObject(store2, { 39837 rowId(state) { 39838 if (rowIdProp) return rowIdProp; 39839 if (!state) return; 39840 if (!(row == null ? void 0 : row.baseElement)) return; 39841 if (row.baseElement !== state.baseElement) return; 39842 return row.id; 39843 }, 39844 baseElement(state) { 39845 return (state == null ? void 0 : state.baseElement) || void 0; 39846 }, 39847 isActiveItem(state) { 39848 return !!state && state.activeId === id; 39849 }, 39850 ariaSetSize(state) { 39851 if (ariaSetSizeProp != null) return ariaSetSizeProp; 39852 if (!state) return; 39853 if (!(row == null ? void 0 : row.ariaSetSize)) return; 39854 if (row.baseElement !== state.baseElement) return; 39855 return row.ariaSetSize; 39856 }, 39857 ariaPosInSet(state) { 39858 if (ariaPosInSetProp != null) return ariaPosInSetProp; 39859 if (!state) return; 39860 if (!(row == null ? void 0 : row.ariaPosInSet)) return; 39861 if (row.baseElement !== state.baseElement) return; 39862 const itemsInRow = state.renderedItems.filter( 39863 (item) => item.rowId === rowId 39864 ); 39865 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 39866 }, 39867 isTabbable(state) { 39868 if (!(state == null ? void 0 : state.renderedItems.length)) return true; 39869 if (state.virtualFocus) return false; 39870 if (tabbable2) return true; 39871 if (state.activeId === null) return false; 39872 const item = store2 == null ? void 0 : store2.item(state.activeId); 39873 if (item == null ? void 0 : item.disabled) return true; 39874 if (!(item == null ? void 0 : item.element)) return true; 39875 return state.activeId === id; 39876 } 39877 }); 39878 const getItem = (0, import_react22.useCallback)( 39879 (item) => { 39880 var _a; 39881 const nextItem = { 39882 ...item, 39883 id: id || item.id, 39884 rowId, 39885 disabled: !!trulyDisabled, 39886 children: (_a = item.element) == null ? void 0 : _a.textContent 39887 }; 39888 if (getItemProp) { 39889 return getItemProp(nextItem); 39890 } 39891 return nextItem; 39892 }, 39893 [id, rowId, trulyDisabled, getItemProp] 39894 ); 39895 const onFocusProp = props.onFocus; 39896 const hasFocusedComposite = (0, import_react22.useRef)(false); 39897 const onFocus = useEvent((event) => { 39898 onFocusProp == null ? void 0 : onFocusProp(event); 39899 if (event.defaultPrevented) return; 39900 if (isPortalEvent(event)) return; 39901 if (!id) return; 39902 if (!store2) return; 39903 if (targetIsAnotherItem(event, store2)) return; 39904 const { virtualFocus, baseElement: baseElement2 } = store2.getState(); 39905 store2.setActiveId(id); 39906 if (isTextbox(event.currentTarget)) { 39907 selectTextField(event.currentTarget); 39908 } 39909 if (!virtualFocus) return; 39910 if (!isSelfTarget(event)) return; 39911 if (isEditableElement(event.currentTarget)) return; 39912 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; 39913 if (isSafari2() && event.currentTarget.hasAttribute("data-autofocus")) { 39914 event.currentTarget.scrollIntoView({ 39915 block: "nearest", 39916 inline: "nearest" 39917 }); 39918 } 39919 hasFocusedComposite.current = true; 39920 const fromComposite = event.relatedTarget === baseElement2 || isItem(store2, event.relatedTarget); 39921 if (fromComposite) { 39922 focusSilently(baseElement2); 39923 } else { 39924 baseElement2.focus(); 39925 } 39926 }); 39927 const onBlurCaptureProp = props.onBlurCapture; 39928 const onBlurCapture = useEvent((event) => { 39929 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 39930 if (event.defaultPrevented) return; 39931 const state = store2 == null ? void 0 : store2.getState(); 39932 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { 39933 hasFocusedComposite.current = false; 39934 event.preventDefault(); 39935 event.stopPropagation(); 39936 } 39937 }); 39938 const onKeyDownProp = props.onKeyDown; 39939 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 39940 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 39941 const onKeyDown = useEvent((event) => { 39942 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 39943 if (event.defaultPrevented) return; 39944 if (!isSelfTarget(event)) return; 39945 if (!store2) return; 39946 const { currentTarget } = event; 39947 const state = store2.getState(); 39948 const item = store2.item(id); 39949 const isGrid2 = !!(item == null ? void 0 : item.rowId); 39950 const isVertical = state.orientation !== "horizontal"; 39951 const isHorizontal = state.orientation !== "vertical"; 39952 const canHomeEnd = () => { 39953 if (isGrid2) return true; 39954 if (isHorizontal) return true; 39955 if (!state.baseElement) return true; 39956 if (!isTextField(state.baseElement)) return true; 39957 return false; 39958 }; 39959 const keyMap = { 39960 ArrowUp: (isGrid2 || isVertical) && store2.up, 39961 ArrowRight: (isGrid2 || isHorizontal) && store2.next, 39962 ArrowDown: (isGrid2 || isVertical) && store2.down, 39963 ArrowLeft: (isGrid2 || isHorizontal) && store2.previous, 39964 Home: () => { 39965 if (!canHomeEnd()) return; 39966 if (!isGrid2 || event.ctrlKey) { 39967 return store2 == null ? void 0 : store2.first(); 39968 } 39969 return store2 == null ? void 0 : store2.previous(-1); 39970 }, 39971 End: () => { 39972 if (!canHomeEnd()) return; 39973 if (!isGrid2 || event.ctrlKey) { 39974 return store2 == null ? void 0 : store2.last(); 39975 } 39976 return store2 == null ? void 0 : store2.next(-1); 39977 }, 39978 PageUp: () => { 39979 return findNextPageItemId(currentTarget, store2, store2 == null ? void 0 : store2.up, true); 39980 }, 39981 PageDown: () => { 39982 return findNextPageItemId(currentTarget, store2, store2 == null ? void 0 : store2.down); 39983 } 39984 }; 39985 const action = keyMap[event.key]; 39986 if (action) { 39987 if (isTextbox(currentTarget)) { 39988 const selection = getTextboxSelection(currentTarget); 39989 const isLeft = isHorizontal && event.key === "ArrowLeft"; 39990 const isRight = isHorizontal && event.key === "ArrowRight"; 39991 const isUp = isVertical && event.key === "ArrowUp"; 39992 const isDown = isVertical && event.key === "ArrowDown"; 39993 if (isRight || isDown) { 39994 const { length: valueLength } = getTextboxValue(currentTarget); 39995 if (selection.end !== valueLength) return; 39996 } else if ((isLeft || isUp) && selection.start !== 0) return; 39997 } 39998 const nextId2 = action(); 39999 if (preventScrollOnKeyDownProp(event) || nextId2 !== void 0) { 40000 if (!moveOnKeyPressProp(event)) return; 40001 event.preventDefault(); 40002 store2.move(nextId2); 40003 } 40004 } 40005 }); 40006 const providerValue = (0, import_react22.useMemo)( 40007 () => ({ id, baseElement }), 40008 [id, baseElement] 40009 ); 40010 props = useWrapElement( 40011 props, 40012 (element) => /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), 40013 [providerValue] 40014 ); 40015 props = { 40016 id, 40017 "data-active-item": isActiveItem || void 0, 40018 ...props, 40019 ref: useMergeRefs(ref, props.ref), 40020 tabIndex: isTabbable ? props.tabIndex : -1, 40021 onFocus, 40022 onBlurCapture, 40023 onKeyDown 40024 }; 40025 props = useCommand(props); 40026 props = useCollectionItem({ 40027 store: store2, 40028 ...props, 40029 getItem, 40030 shouldRegisterItem: id ? props.shouldRegisterItem : false 40031 }); 40032 return removeUndefinedValues({ 40033 ...props, 40034 "aria-setsize": ariaSetSize, 40035 "aria-posinset": ariaPosInSet 40036 }); 40037 } 40038 ); 40039 var CompositeItem = memo22( 40040 forwardRef210(function CompositeItem2(props) { 40041 const htmlProps = useCompositeItem(props); 40042 return createElement5(TagName4, htmlProps); 40043 }) 40044 ); 40045 40046 // node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js 40047 function toArray2(arg) { 40048 if (Array.isArray(arg)) { 40049 return arg; 40050 } 40051 return typeof arg !== "undefined" ? [arg] : []; 40052 } 40053 function flatten2DArray(array) { 40054 const flattened = []; 40055 for (const row of array) { 40056 flattened.push(...row); 40057 } 40058 return flattened; 40059 } 40060 function reverseArray(array) { 40061 return array.slice().reverse(); 40062 } 40063 40064 // node_modules/@ariakit/react-core/esm/__chunks/ZMWF7ASR.js 40065 var import_react23 = __toESM(require_react(), 1); 40066 var import_jsx_runtime227 = __toESM(require_jsx_runtime(), 1); 40067 var TagName5 = "div"; 40068 function isGrid(items) { 40069 return items.some((item) => !!item.rowId); 40070 } 40071 function isPrintableKey(event) { 40072 const target = event.target; 40073 if (target && !isTextField(target)) return false; 40074 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 40075 } 40076 function isModifierKey(event) { 40077 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 40078 } 40079 function useKeyboardEventProxy(store2, onKeyboardEvent, previousElementRef) { 40080 return useEvent((event) => { 40081 var _a; 40082 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); 40083 if (event.defaultPrevented) return; 40084 if (event.isPropagationStopped()) return; 40085 if (!isSelfTarget(event)) return; 40086 if (isModifierKey(event)) return; 40087 if (isPrintableKey(event)) return; 40088 const state = store2.getState(); 40089 const activeElement2 = (_a = getEnabledItem(store2, state.activeId)) == null ? void 0 : _a.element; 40090 if (!activeElement2) return; 40091 const { view, ...eventInit } = event; 40092 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; 40093 if (activeElement2 !== previousElement) { 40094 activeElement2.focus(); 40095 } 40096 if (!fireKeyboardEvent(activeElement2, event.type, eventInit)) { 40097 event.preventDefault(); 40098 } 40099 if (event.currentTarget.contains(activeElement2)) { 40100 event.stopPropagation(); 40101 } 40102 }); 40103 } 40104 function findFirstEnabledItemInTheLastRow(items) { 40105 return findFirstEnabledItem( 40106 flatten2DArray(reverseArray(groupItemsByRows(items))) 40107 ); 40108 } 40109 function useScheduleFocus(store2) { 40110 const [scheduled, setScheduled] = (0, import_react23.useState)(false); 40111 const schedule2 = (0, import_react23.useCallback)(() => setScheduled(true), []); 40112 const activeItem = store2.useState( 40113 (state) => getEnabledItem(store2, state.activeId) 40114 ); 40115 (0, import_react23.useEffect)(() => { 40116 const activeElement2 = activeItem == null ? void 0 : activeItem.element; 40117 if (!scheduled) return; 40118 if (!activeElement2) return; 40119 setScheduled(false); 40120 activeElement2.focus({ preventScroll: true }); 40121 }, [activeItem, scheduled]); 40122 return schedule2; 40123 } 40124 var useComposite = createHook( 40125 function useComposite2({ 40126 store: store2, 40127 composite = true, 40128 focusOnMove = composite, 40129 moveOnKeyPress = true, 40130 ...props 40131 }) { 40132 const context = useCompositeProviderContext(); 40133 store2 = store2 || context; 40134 invariant( 40135 store2, 40136 "Composite must receive a `store` prop or be wrapped in a CompositeProvider component." 40137 ); 40138 const ref = (0, import_react23.useRef)(null); 40139 const previousElementRef = (0, import_react23.useRef)(null); 40140 const scheduleFocus = useScheduleFocus(store2); 40141 const moves = store2.useState("moves"); 40142 const [, setBaseElement] = useTransactionState( 40143 composite ? store2.setBaseElement : null 40144 ); 40145 (0, import_react23.useEffect)(() => { 40146 var _a; 40147 if (!store2) return; 40148 if (!moves) return; 40149 if (!composite) return; 40150 if (!focusOnMove) return; 40151 const { activeId: activeId2 } = store2.getState(); 40152 const itemElement = (_a = getEnabledItem(store2, activeId2)) == null ? void 0 : _a.element; 40153 if (!itemElement) return; 40154 focusIntoView(itemElement); 40155 }, [store2, moves, composite, focusOnMove]); 40156 useSafeLayoutEffect(() => { 40157 if (!store2) return; 40158 if (!moves) return; 40159 if (!composite) return; 40160 const { baseElement, activeId: activeId2 } = store2.getState(); 40161 const isSelfAcive = activeId2 === null; 40162 if (!isSelfAcive) return; 40163 if (!baseElement) return; 40164 const previousElement = previousElementRef.current; 40165 previousElementRef.current = null; 40166 if (previousElement) { 40167 fireBlurEvent(previousElement, { relatedTarget: baseElement }); 40168 } 40169 if (!hasFocus(baseElement)) { 40170 baseElement.focus(); 40171 } 40172 }, [store2, moves, composite]); 40173 const activeId = store2.useState("activeId"); 40174 const virtualFocus = store2.useState("virtualFocus"); 40175 useSafeLayoutEffect(() => { 40176 var _a; 40177 if (!store2) return; 40178 if (!composite) return; 40179 if (!virtualFocus) return; 40180 const previousElement = previousElementRef.current; 40181 previousElementRef.current = null; 40182 if (!previousElement) return; 40183 const activeElement2 = (_a = getEnabledItem(store2, activeId)) == null ? void 0 : _a.element; 40184 const relatedTarget = activeElement2 || getActiveElement(previousElement); 40185 if (relatedTarget === previousElement) return; 40186 fireBlurEvent(previousElement, { relatedTarget }); 40187 }, [store2, activeId, virtualFocus, composite]); 40188 const onKeyDownCapture = useKeyboardEventProxy( 40189 store2, 40190 props.onKeyDownCapture, 40191 previousElementRef 40192 ); 40193 const onKeyUpCapture = useKeyboardEventProxy( 40194 store2, 40195 props.onKeyUpCapture, 40196 previousElementRef 40197 ); 40198 const onFocusCaptureProp = props.onFocusCapture; 40199 const onFocusCapture = useEvent((event) => { 40200 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 40201 if (event.defaultPrevented) return; 40202 if (!store2) return; 40203 const { virtualFocus: virtualFocus2 } = store2.getState(); 40204 if (!virtualFocus2) return; 40205 const previousActiveElement = event.relatedTarget; 40206 const isSilentlyFocused = silentlyFocused(event.currentTarget); 40207 if (isSelfTarget(event) && isSilentlyFocused) { 40208 event.stopPropagation(); 40209 previousElementRef.current = previousActiveElement; 40210 } 40211 }); 40212 const onFocusProp = props.onFocus; 40213 const onFocus = useEvent((event) => { 40214 onFocusProp == null ? void 0 : onFocusProp(event); 40215 if (event.defaultPrevented) return; 40216 if (!composite) return; 40217 if (!store2) return; 40218 const { relatedTarget } = event; 40219 const { virtualFocus: virtualFocus2 } = store2.getState(); 40220 if (virtualFocus2) { 40221 if (isSelfTarget(event) && !isItem(store2, relatedTarget)) { 40222 queueMicrotask(scheduleFocus); 40223 } 40224 } else if (isSelfTarget(event)) { 40225 store2.setActiveId(null); 40226 } 40227 }); 40228 const onBlurCaptureProp = props.onBlurCapture; 40229 const onBlurCapture = useEvent((event) => { 40230 var _a; 40231 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 40232 if (event.defaultPrevented) return; 40233 if (!store2) return; 40234 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store2.getState(); 40235 if (!virtualFocus2) return; 40236 const activeElement2 = (_a = getEnabledItem(store2, activeId2)) == null ? void 0 : _a.element; 40237 const nextActiveElement = event.relatedTarget; 40238 const nextActiveElementIsItem = isItem(store2, nextActiveElement); 40239 const previousElement = previousElementRef.current; 40240 previousElementRef.current = null; 40241 if (isSelfTarget(event) && nextActiveElementIsItem) { 40242 if (nextActiveElement === activeElement2) { 40243 if (previousElement && previousElement !== nextActiveElement) { 40244 fireBlurEvent(previousElement, event); 40245 } 40246 } else if (activeElement2) { 40247 fireBlurEvent(activeElement2, event); 40248 } else if (previousElement) { 40249 fireBlurEvent(previousElement, event); 40250 } 40251 event.stopPropagation(); 40252 } else { 40253 const targetIsItem = isItem(store2, event.target); 40254 if (!targetIsItem && activeElement2) { 40255 fireBlurEvent(activeElement2, event); 40256 } 40257 } 40258 }); 40259 const onKeyDownProp = props.onKeyDown; 40260 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 40261 const onKeyDown = useEvent((event) => { 40262 var _a; 40263 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 40264 if (event.nativeEvent.isComposing) return; 40265 if (event.defaultPrevented) return; 40266 if (!store2) return; 40267 if (!isSelfTarget(event)) return; 40268 const { orientation, renderedItems, activeId: activeId2 } = store2.getState(); 40269 const activeItem = getEnabledItem(store2, activeId2); 40270 if ((_a = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a.isConnected) return; 40271 const isVertical = orientation !== "horizontal"; 40272 const isHorizontal = orientation !== "vertical"; 40273 const grid = isGrid(renderedItems); 40274 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; 40275 if (isHorizontalKey && isTextField(event.currentTarget)) return; 40276 const up = () => { 40277 if (grid) { 40278 const item = findFirstEnabledItemInTheLastRow(renderedItems); 40279 return item == null ? void 0 : item.id; 40280 } 40281 return store2 == null ? void 0 : store2.last(); 40282 }; 40283 const keyMap = { 40284 ArrowUp: (grid || isVertical) && up, 40285 ArrowRight: (grid || isHorizontal) && store2.first, 40286 ArrowDown: (grid || isVertical) && store2.first, 40287 ArrowLeft: (grid || isHorizontal) && store2.last, 40288 Home: store2.first, 40289 End: store2.last, 40290 PageUp: store2.first, 40291 PageDown: store2.last 40292 }; 40293 const action = keyMap[event.key]; 40294 if (action) { 40295 const id = action(); 40296 if (id !== void 0) { 40297 if (!moveOnKeyPressProp(event)) return; 40298 event.preventDefault(); 40299 store2.move(id); 40300 } 40301 } 40302 }); 40303 props = useWrapElement( 40304 props, 40305 (element) => /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(CompositeContextProvider, { value: store2, children: element }), 40306 [store2] 40307 ); 40308 const activeDescendant = store2.useState((state) => { 40309 var _a; 40310 if (!store2) return; 40311 if (!composite) return; 40312 if (!state.virtualFocus) return; 40313 return (_a = getEnabledItem(store2, state.activeId)) == null ? void 0 : _a.id; 40314 }); 40315 props = { 40316 "aria-activedescendant": activeDescendant, 40317 ...props, 40318 ref: useMergeRefs(ref, setBaseElement, props.ref), 40319 onKeyDownCapture, 40320 onKeyUpCapture, 40321 onFocusCapture, 40322 onFocus, 40323 onBlurCapture, 40324 onKeyDown 40325 }; 40326 const focusable2 = store2.useState( 40327 (state) => composite && (state.virtualFocus || state.activeId === null) 40328 ); 40329 props = useFocusable({ focusable: focusable2, ...props }); 40330 return props; 40331 } 40332 ); 40333 var Composite7 = forwardRef210(function Composite22(props) { 40334 const htmlProps = useComposite(props); 40335 return createElement5(TagName5, htmlProps); 40336 }); 40337 40338 // node_modules/@ariakit/react-core/esm/__chunks/LVDQFHCH.js 40339 var ctx4 = createStoreContext(); 40340 var useDisclosureContext = ctx4.useContext; 40341 var useDisclosureScopedContext = ctx4.useScopedContext; 40342 var useDisclosureProviderContext = ctx4.useProviderContext; 40343 var DisclosureContextProvider = ctx4.ContextProvider; 40344 var DisclosureScopedContextProvider = ctx4.ScopedContextProvider; 40345 40346 // node_modules/@ariakit/react-core/esm/__chunks/A62MDFCW.js 40347 var import_react24 = __toESM(require_react(), 1); 40348 var ctx5 = createStoreContext( 40349 [DisclosureContextProvider], 40350 [DisclosureScopedContextProvider] 40351 ); 40352 var useDialogContext = ctx5.useContext; 40353 var useDialogScopedContext = ctx5.useScopedContext; 40354 var useDialogProviderContext = ctx5.useProviderContext; 40355 var DialogContextProvider = ctx5.ContextProvider; 40356 var DialogScopedContextProvider = ctx5.ScopedContextProvider; 40357 var DialogHeadingContext = (0, import_react24.createContext)(void 0); 40358 var DialogDescriptionContext = (0, import_react24.createContext)(void 0); 40359 40360 // node_modules/@ariakit/react-core/esm/__chunks/6B3RXHKP.js 40361 var import_react25 = __toESM(require_react(), 1); 40362 var import_react_dom5 = __toESM(require_react_dom(), 1); 40363 var import_jsx_runtime228 = __toESM(require_jsx_runtime(), 1); 40364 var TagName6 = "div"; 40365 function afterTimeout(timeoutMs, cb) { 40366 const timeoutId = setTimeout(cb, timeoutMs); 40367 return () => clearTimeout(timeoutId); 40368 } 40369 function afterPaint2(cb) { 40370 let raf2 = requestAnimationFrame(() => { 40371 raf2 = requestAnimationFrame(cb); 40372 }); 40373 return () => cancelAnimationFrame(raf2); 40374 } 40375 function parseCSSTime(...times) { 40376 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { 40377 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; 40378 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; 40379 if (currentTime > longestTime) return currentTime; 40380 return longestTime; 40381 }, 0); 40382 } 40383 function isHidden(mounted, hidden, alwaysVisible) { 40384 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 40385 } 40386 var useDisclosureContent = createHook(function useDisclosureContent2({ store: store2, alwaysVisible, ...props }) { 40387 const context = useDisclosureProviderContext(); 40388 store2 = store2 || context; 40389 invariant( 40390 store2, 40391 "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component." 40392 ); 40393 const ref = (0, import_react25.useRef)(null); 40394 const id = useId7(props.id); 40395 const [transition, setTransition] = (0, import_react25.useState)(null); 40396 const open = store2.useState("open"); 40397 const mounted = store2.useState("mounted"); 40398 const animated2 = store2.useState("animated"); 40399 const contentElement = store2.useState("contentElement"); 40400 const otherElement = useStoreState(store2.disclosure, "contentElement"); 40401 useSafeLayoutEffect(() => { 40402 if (!ref.current) return; 40403 store2 == null ? void 0 : store2.setContentElement(ref.current); 40404 }, [store2]); 40405 useSafeLayoutEffect(() => { 40406 let previousAnimated; 40407 store2 == null ? void 0 : store2.setState("animated", (animated22) => { 40408 previousAnimated = animated22; 40409 return true; 40410 }); 40411 return () => { 40412 if (previousAnimated === void 0) return; 40413 store2 == null ? void 0 : store2.setState("animated", previousAnimated); 40414 }; 40415 }, [store2]); 40416 useSafeLayoutEffect(() => { 40417 if (!animated2) return; 40418 if (!(contentElement == null ? void 0 : contentElement.isConnected)) { 40419 setTransition(null); 40420 return; 40421 } 40422 return afterPaint2(() => { 40423 setTransition(open ? "enter" : mounted ? "leave" : null); 40424 }); 40425 }, [animated2, contentElement, open, mounted]); 40426 useSafeLayoutEffect(() => { 40427 if (!store2) return; 40428 if (!animated2) return; 40429 if (!transition) return; 40430 if (!contentElement) return; 40431 const stopAnimation = () => store2 == null ? void 0 : store2.setState("animating", false); 40432 const stopAnimationSync = () => (0, import_react_dom5.flushSync)(stopAnimation); 40433 if (transition === "leave" && open) return; 40434 if (transition === "enter" && !open) return; 40435 if (typeof animated2 === "number") { 40436 const timeout2 = animated2; 40437 return afterTimeout(timeout2, stopAnimationSync); 40438 } 40439 const { 40440 transitionDuration, 40441 animationDuration, 40442 transitionDelay, 40443 animationDelay 40444 } = getComputedStyle(contentElement); 40445 const { 40446 transitionDuration: transitionDuration2 = "0", 40447 animationDuration: animationDuration2 = "0", 40448 transitionDelay: transitionDelay2 = "0", 40449 animationDelay: animationDelay2 = "0" 40450 } = otherElement ? getComputedStyle(otherElement) : {}; 40451 const delay = parseCSSTime( 40452 transitionDelay, 40453 animationDelay, 40454 transitionDelay2, 40455 animationDelay2 40456 ); 40457 const duration = parseCSSTime( 40458 transitionDuration, 40459 animationDuration, 40460 transitionDuration2, 40461 animationDuration2 40462 ); 40463 const timeout = delay + duration; 40464 if (!timeout) { 40465 if (transition === "enter") { 40466 store2.setState("animated", false); 40467 } 40468 stopAnimation(); 40469 return; 40470 } 40471 const frameRate = 1e3 / 60; 40472 const maxTimeout = Math.max(timeout - frameRate, 0); 40473 return afterTimeout(maxTimeout, stopAnimationSync); 40474 }, [store2, animated2, contentElement, otherElement, open, transition]); 40475 props = useWrapElement( 40476 props, 40477 (element) => /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(DialogScopedContextProvider, { value: store2, children: element }), 40478 [store2] 40479 ); 40480 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 40481 const styleProp = props.style; 40482 const style = (0, import_react25.useMemo)(() => { 40483 if (hidden) { 40484 return { ...styleProp, display: "none" }; 40485 } 40486 return styleProp; 40487 }, [hidden, styleProp]); 40488 props = { 40489 id, 40490 "data-open": open || void 0, 40491 "data-enter": transition === "enter" || void 0, 40492 "data-leave": transition === "leave" || void 0, 40493 hidden, 40494 ...props, 40495 ref: useMergeRefs(id ? store2.setContentElement : null, ref, props.ref), 40496 style 40497 }; 40498 return removeUndefinedValues(props); 40499 }); 40500 var DisclosureContentImpl = forwardRef210(function DisclosureContentImpl2(props) { 40501 const htmlProps = useDisclosureContent(props); 40502 return createElement5(TagName6, htmlProps); 40503 }); 40504 var DisclosureContent = forwardRef210(function DisclosureContent2({ 40505 unmountOnHide, 40506 ...props 40507 }) { 40508 const context = useDisclosureProviderContext(); 40509 const store2 = props.store || context; 40510 const mounted = useStoreState( 40511 store2, 40512 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) 40513 ); 40514 if (mounted === false) return null; 40515 return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(DisclosureContentImpl, { ...props }); 40516 }); 40517 40518 // node_modules/@ariakit/core/esm/__chunks/75BJEVSH.js 40519 function createDisclosureStore(props = {}) { 40520 const store2 = mergeStore( 40521 props.store, 40522 omit2(props.disclosure, ["contentElement", "disclosureElement"]) 40523 ); 40524 throwOnConflictingProps(props, store2); 40525 const syncState = store2 == null ? void 0 : store2.getState(); 40526 const open = defaultValue( 40527 props.open, 40528 syncState == null ? void 0 : syncState.open, 40529 props.defaultOpen, 40530 false 40531 ); 40532 const animated2 = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); 40533 const initialState = { 40534 open, 40535 animated: animated2, 40536 animating: !!animated2 && open, 40537 mounted: open, 40538 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), 40539 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) 40540 }; 40541 const disclosure = createStore(initialState, store2); 40542 setup( 40543 disclosure, 40544 () => sync2(disclosure, ["animated", "animating"], (state) => { 40545 if (state.animated) return; 40546 disclosure.setState("animating", false); 40547 }) 40548 ); 40549 setup( 40550 disclosure, 40551 () => subscribe2(disclosure, ["open"], () => { 40552 if (!disclosure.getState().animated) return; 40553 disclosure.setState("animating", true); 40554 }) 40555 ); 40556 setup( 40557 disclosure, 40558 () => sync2(disclosure, ["open", "animating"], (state) => { 40559 disclosure.setState("mounted", state.open || state.animating); 40560 }) 40561 ); 40562 return { 40563 ...disclosure, 40564 disclosure: props.disclosure, 40565 setOpen: (value) => disclosure.setState("open", value), 40566 show: () => disclosure.setState("open", true), 40567 hide: () => disclosure.setState("open", false), 40568 toggle: () => disclosure.setState("open", (open2) => !open2), 40569 stopAnimation: () => disclosure.setState("animating", false), 40570 setContentElement: (value) => disclosure.setState("contentElement", value), 40571 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 40572 }; 40573 } 40574 40575 // node_modules/@ariakit/react-core/esm/__chunks/WLZ6H5FH.js 40576 function useDisclosureStoreProps(store2, update4, props) { 40577 useUpdateEffect(update4, [props.store, props.disclosure]); 40578 useStoreProps(store2, props, "open", "setOpen"); 40579 useStoreProps(store2, props, "mounted", "setMounted"); 40580 useStoreProps(store2, props, "animated"); 40581 return Object.assign(store2, { disclosure: props.disclosure }); 40582 } 40583 40584 // node_modules/@ariakit/react-core/esm/__chunks/JMU4N4M5.js 40585 var ctx6 = createStoreContext( 40586 [DialogContextProvider], 40587 [DialogScopedContextProvider] 40588 ); 40589 var usePopoverContext = ctx6.useContext; 40590 var usePopoverScopedContext = ctx6.useScopedContext; 40591 var usePopoverProviderContext = ctx6.useProviderContext; 40592 var PopoverContextProvider = ctx6.ContextProvider; 40593 var PopoverScopedContextProvider = ctx6.ScopedContextProvider; 40594 40595 // node_modules/@ariakit/core/esm/__chunks/N5XGANPW.js 40596 function getCommonParent(items) { 40597 var _a; 40598 const firstItem = items.find((item) => !!item.element); 40599 const lastItem = [...items].reverse().find((item) => !!item.element); 40600 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; 40601 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { 40602 const parent = parentElement; 40603 if (lastItem && parent.contains(lastItem.element)) { 40604 return parentElement; 40605 } 40606 parentElement = parentElement.parentElement; 40607 } 40608 return getDocument(parentElement).body; 40609 } 40610 function getPrivateStore(store2) { 40611 return store2 == null ? void 0 : store2.__unstablePrivateStore; 40612 } 40613 function createCollectionStore(props = {}) { 40614 var _a; 40615 throwOnConflictingProps(props, props.store); 40616 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 40617 const items = defaultValue( 40618 props.items, 40619 syncState == null ? void 0 : syncState.items, 40620 props.defaultItems, 40621 [] 40622 ); 40623 const itemsMap = new Map(items.map((item) => [item.id, item])); 40624 const initialState = { 40625 items, 40626 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) 40627 }; 40628 const syncPrivateStore = getPrivateStore(props.store); 40629 const privateStore = createStore( 40630 { items, renderedItems: initialState.renderedItems }, 40631 syncPrivateStore 40632 ); 40633 const collection = createStore(initialState, props.store); 40634 const sortItems = (renderedItems) => { 40635 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i2) => i2.element); 40636 privateStore.setState("renderedItems", sortedItems); 40637 collection.setState("renderedItems", sortedItems); 40638 }; 40639 setup(collection, () => init(privateStore)); 40640 setup(privateStore, () => { 40641 return batch(privateStore, ["items"], (state) => { 40642 collection.setState("items", state.items); 40643 }); 40644 }); 40645 setup(privateStore, () => { 40646 return batch(privateStore, ["renderedItems"], (state) => { 40647 let firstRun = true; 40648 let raf2 = requestAnimationFrame(() => { 40649 const { renderedItems } = collection.getState(); 40650 if (state.renderedItems === renderedItems) return; 40651 sortItems(state.renderedItems); 40652 }); 40653 if (typeof IntersectionObserver !== "function") { 40654 return () => cancelAnimationFrame(raf2); 40655 } 40656 const ioCallback = () => { 40657 if (firstRun) { 40658 firstRun = false; 40659 return; 40660 } 40661 cancelAnimationFrame(raf2); 40662 raf2 = requestAnimationFrame(() => sortItems(state.renderedItems)); 40663 }; 40664 const root = getCommonParent(state.renderedItems); 40665 const observer = new IntersectionObserver(ioCallback, { root }); 40666 for (const item of state.renderedItems) { 40667 if (!item.element) continue; 40668 observer.observe(item.element); 40669 } 40670 return () => { 40671 cancelAnimationFrame(raf2); 40672 observer.disconnect(); 40673 }; 40674 }); 40675 }); 40676 const mergeItem = (item, setItems, canDeleteFromMap = false) => { 40677 let prevItem; 40678 setItems((items2) => { 40679 const index2 = items2.findIndex(({ id }) => id === item.id); 40680 const nextItems = items2.slice(); 40681 if (index2 !== -1) { 40682 prevItem = items2[index2]; 40683 const nextItem = { ...prevItem, ...item }; 40684 nextItems[index2] = nextItem; 40685 itemsMap.set(item.id, nextItem); 40686 } else { 40687 nextItems.push(item); 40688 itemsMap.set(item.id, item); 40689 } 40690 return nextItems; 40691 }); 40692 const unmergeItem = () => { 40693 setItems((items2) => { 40694 if (!prevItem) { 40695 if (canDeleteFromMap) { 40696 itemsMap.delete(item.id); 40697 } 40698 return items2.filter(({ id }) => id !== item.id); 40699 } 40700 const index2 = items2.findIndex(({ id }) => id === item.id); 40701 if (index2 === -1) return items2; 40702 const nextItems = items2.slice(); 40703 nextItems[index2] = prevItem; 40704 itemsMap.set(item.id, prevItem); 40705 return nextItems; 40706 }); 40707 }; 40708 return unmergeItem; 40709 }; 40710 const registerItem = (item) => mergeItem( 40711 item, 40712 (getItems) => privateStore.setState("items", getItems), 40713 true 40714 ); 40715 return { 40716 ...collection, 40717 registerItem, 40718 renderItem: (item) => chain( 40719 registerItem(item), 40720 mergeItem( 40721 item, 40722 (getItems) => privateStore.setState("renderedItems", getItems) 40723 ) 40724 ), 40725 item: (id) => { 40726 if (!id) return null; 40727 let item = itemsMap.get(id); 40728 if (!item) { 40729 const { items: items2 } = privateStore.getState(); 40730 item = items2.find((item2) => item2.id === id); 40731 if (item) { 40732 itemsMap.set(id, item); 40733 } 40734 } 40735 return item || null; 40736 }, 40737 // @ts-expect-error Internal 40738 __unstablePrivateStore: privateStore 40739 }; 40740 } 40741 40742 // node_modules/@ariakit/react-core/esm/__chunks/GVAFFF2B.js 40743 function useCollectionStoreProps(store2, update4, props) { 40744 useUpdateEffect(update4, [props.store]); 40745 useStoreProps(store2, props, "items", "setItems"); 40746 return store2; 40747 } 40748 40749 // node_modules/@ariakit/core/esm/__chunks/RVTIKFRL.js 40750 var NULL_ITEM = { id: null }; 40751 function findFirstEnabledItem2(items, excludeId) { 40752 return items.find((item) => { 40753 if (excludeId) { 40754 return !item.disabled && item.id !== excludeId; 40755 } 40756 return !item.disabled; 40757 }); 40758 } 40759 function getEnabledItems(items, excludeId) { 40760 return items.filter((item) => { 40761 if (excludeId) { 40762 return !item.disabled && item.id !== excludeId; 40763 } 40764 return !item.disabled; 40765 }); 40766 } 40767 function getItemsInRow(items, rowId) { 40768 return items.filter((item) => item.rowId === rowId); 40769 } 40770 function flipItems(items, activeId, shouldInsertNullItem = false) { 40771 const index2 = items.findIndex((item) => item.id === activeId); 40772 return [ 40773 ...items.slice(index2 + 1), 40774 ...shouldInsertNullItem ? [NULL_ITEM] : [], 40775 ...items.slice(0, index2) 40776 ]; 40777 } 40778 function groupItemsByRows2(items) { 40779 const rows = []; 40780 for (const item of items) { 40781 const row = rows.find((currentRow) => { 40782 var _a; 40783 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 40784 }); 40785 if (row) { 40786 row.push(item); 40787 } else { 40788 rows.push([item]); 40789 } 40790 } 40791 return rows; 40792 } 40793 function getMaxRowLength(array) { 40794 let maxLength = 0; 40795 for (const { length } of array) { 40796 if (length > maxLength) { 40797 maxLength = length; 40798 } 40799 } 40800 return maxLength; 40801 } 40802 function createEmptyItem(rowId) { 40803 return { 40804 id: "__EMPTY_ITEM__", 40805 disabled: true, 40806 rowId 40807 }; 40808 } 40809 function normalizeRows(rows, activeId, focusShift) { 40810 const maxLength = getMaxRowLength(rows); 40811 for (const row of rows) { 40812 for (let i2 = 0; i2 < maxLength; i2 += 1) { 40813 const item = row[i2]; 40814 if (!item || focusShift && item.disabled) { 40815 const isFirst = i2 === 0; 40816 const previousItem = isFirst && focusShift ? findFirstEnabledItem2(row) : row[i2 - 1]; 40817 row[i2] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); 40818 } 40819 } 40820 } 40821 return rows; 40822 } 40823 function verticalizeItems(items) { 40824 const rows = groupItemsByRows2(items); 40825 const maxLength = getMaxRowLength(rows); 40826 const verticalized = []; 40827 for (let i2 = 0; i2 < maxLength; i2 += 1) { 40828 for (const row of rows) { 40829 const item = row[i2]; 40830 if (item) { 40831 verticalized.push({ 40832 ...item, 40833 // If there's no rowId, it means that it's not a grid composite, but 40834 // a single row instead. So, instead of verticalizing it, that is, 40835 // assigning a different rowId based on the column index, we keep it 40836 // undefined so they will be part of the same row. This is useful 40837 // when using up/down on one-dimensional composites. 40838 rowId: item.rowId ? `$i2}` : void 0 40839 }); 40840 } 40841 } 40842 } 40843 return verticalized; 40844 } 40845 function createCompositeStore(props = {}) { 40846 var _a; 40847 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 40848 const collection = createCollectionStore(props); 40849 const activeId = defaultValue( 40850 props.activeId, 40851 syncState == null ? void 0 : syncState.activeId, 40852 props.defaultActiveId 40853 ); 40854 const initialState = { 40855 ...collection.getState(), 40856 id: defaultValue( 40857 props.id, 40858 syncState == null ? void 0 : syncState.id, 40859 `id-$Math.random().toString(36).slice(2, 8)}` 40860 ), 40861 activeId, 40862 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), 40863 includesBaseElement: defaultValue( 40864 props.includesBaseElement, 40865 syncState == null ? void 0 : syncState.includesBaseElement, 40866 activeId === null 40867 ), 40868 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), 40869 orientation: defaultValue( 40870 props.orientation, 40871 syncState == null ? void 0 : syncState.orientation, 40872 "both" 40873 ), 40874 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), 40875 virtualFocus: defaultValue( 40876 props.virtualFocus, 40877 syncState == null ? void 0 : syncState.virtualFocus, 40878 false 40879 ), 40880 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), 40881 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), 40882 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) 40883 }; 40884 const composite = createStore(initialState, collection, props.store); 40885 setup( 40886 composite, 40887 () => sync2(composite, ["renderedItems", "activeId"], (state) => { 40888 composite.setState("activeId", (activeId2) => { 40889 var _a2; 40890 if (activeId2 !== void 0) return activeId2; 40891 return (_a2 = findFirstEnabledItem2(state.renderedItems)) == null ? void 0 : _a2.id; 40892 }); 40893 }) 40894 ); 40895 const getNextId = (direction = "next", options = {}) => { 40896 var _a2, _b; 40897 const defaultState = composite.getState(); 40898 const { 40899 skip = 0, 40900 activeId: activeId2 = defaultState.activeId, 40901 focusShift = defaultState.focusShift, 40902 focusLoop = defaultState.focusLoop, 40903 focusWrap = defaultState.focusWrap, 40904 includesBaseElement = defaultState.includesBaseElement, 40905 renderedItems = defaultState.renderedItems, 40906 rtl = defaultState.rtl 40907 } = options; 40908 const isVerticalDirection = direction === "up" || direction === "down"; 40909 const isNextDirection = direction === "next" || direction === "down"; 40910 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; 40911 const canShift = focusShift && !skip; 40912 let items = !isVerticalDirection ? renderedItems : flatten2DArray( 40913 normalizeRows(groupItemsByRows2(renderedItems), activeId2, canShift) 40914 ); 40915 items = canReverse ? reverseArray(items) : items; 40916 items = isVerticalDirection ? verticalizeItems(items) : items; 40917 if (activeId2 == null) { 40918 return (_a2 = findFirstEnabledItem2(items)) == null ? void 0 : _a2.id; 40919 } 40920 const activeItem = items.find((item) => item.id === activeId2); 40921 if (!activeItem) { 40922 return (_b = findFirstEnabledItem2(items)) == null ? void 0 : _b.id; 40923 } 40924 const isGrid2 = items.some((item) => item.rowId); 40925 const activeIndex = items.indexOf(activeItem); 40926 const nextItems = items.slice(activeIndex + 1); 40927 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 40928 if (skip) { 40929 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 40930 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. 40931 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; 40932 return nextItem2 == null ? void 0 : nextItem2.id; 40933 } 40934 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); 40935 const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); 40936 const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; 40937 if (canLoop) { 40938 const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId); 40939 const sortedItems = flipItems(loopItems, activeId2, hasNullItem); 40940 const nextItem2 = findFirstEnabledItem2(sortedItems, activeId2); 40941 return nextItem2 == null ? void 0 : nextItem2.id; 40942 } 40943 if (canWrap) { 40944 const nextItem2 = findFirstEnabledItem2( 40945 // We can use nextItems, which contains all the next items, including 40946 // items from other rows, to wrap between rows. However, if there is a 40947 // null item (the composite container), we'll only use the next items in 40948 // the row. So moving next from the last item will focus on the 40949 // composite container. On grid composites, horizontal navigation never 40950 // focuses on the composite container, only vertical. 40951 hasNullItem ? nextItemsInRow : nextItems, 40952 activeId2 40953 ); 40954 const nextId2 = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; 40955 return nextId2; 40956 } 40957 const nextItem = findFirstEnabledItem2(nextItemsInRow, activeId2); 40958 if (!nextItem && hasNullItem) { 40959 return null; 40960 } 40961 return nextItem == null ? void 0 : nextItem.id; 40962 }; 40963 return { 40964 ...collection, 40965 ...composite, 40966 setBaseElement: (element) => composite.setState("baseElement", element), 40967 setActiveId: (id) => composite.setState("activeId", id), 40968 move: (id) => { 40969 if (id === void 0) return; 40970 composite.setState("activeId", id); 40971 composite.setState("moves", (moves) => moves + 1); 40972 }, 40973 first: () => { 40974 var _a2; 40975 return (_a2 = findFirstEnabledItem2(composite.getState().renderedItems)) == null ? void 0 : _a2.id; 40976 }, 40977 last: () => { 40978 var _a2; 40979 return (_a2 = findFirstEnabledItem2(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; 40980 }, 40981 next: (options) => { 40982 if (options !== void 0 && typeof options === "number") { 40983 options = { skip: options }; 40984 } 40985 return getNextId("next", options); 40986 }, 40987 previous: (options) => { 40988 if (options !== void 0 && typeof options === "number") { 40989 options = { skip: options }; 40990 } 40991 return getNextId("previous", options); 40992 }, 40993 down: (options) => { 40994 if (options !== void 0 && typeof options === "number") { 40995 options = { skip: options }; 40996 } 40997 return getNextId("down", options); 40998 }, 40999 up: (options) => { 41000 if (options !== void 0 && typeof options === "number") { 41001 options = { skip: options }; 41002 } 41003 return getNextId("up", options); 41004 } 41005 }; 41006 } 41007 41008 // node_modules/@ariakit/react-core/esm/__chunks/IQYAUKXT.js 41009 function useCompositeStoreOptions(props) { 41010 const id = useId7(props.id); 41011 return { id, ...props }; 41012 } 41013 function useCompositeStoreProps(store2, update4, props) { 41014 store2 = useCollectionStoreProps(store2, update4, props); 41015 useStoreProps(store2, props, "activeId", "setActiveId"); 41016 useStoreProps(store2, props, "includesBaseElement"); 41017 useStoreProps(store2, props, "virtualFocus"); 41018 useStoreProps(store2, props, "orientation"); 41019 useStoreProps(store2, props, "rtl"); 41020 useStoreProps(store2, props, "focusLoop"); 41021 useStoreProps(store2, props, "focusWrap"); 41022 useStoreProps(store2, props, "focusShift"); 41023 return store2; 41024 } 41025 41026 // node_modules/@ariakit/react-core/esm/__chunks/CVCFNOHX.js 41027 var import_react26 = __toESM(require_react(), 1); 41028 var ComboboxListRoleContext = (0, import_react26.createContext)( 41029 void 0 41030 ); 41031 var ctx7 = createStoreContext( 41032 [PopoverContextProvider, CompositeContextProvider], 41033 [PopoverScopedContextProvider, CompositeScopedContextProvider] 41034 ); 41035 var useComboboxContext = ctx7.useContext; 41036 var useComboboxScopedContext = ctx7.useScopedContext; 41037 var useComboboxProviderContext = ctx7.useProviderContext; 41038 var ComboboxContextProvider = ctx7.ContextProvider; 41039 var ComboboxScopedContextProvider = ctx7.ScopedContextProvider; 41040 var ComboboxItemValueContext = (0, import_react26.createContext)( 41041 void 0 41042 ); 41043 var ComboboxItemCheckedContext = (0, import_react26.createContext)(false); 41044 41045 // node_modules/@ariakit/core/esm/__chunks/KMAUV3TY.js 41046 function createDialogStore(props = {}) { 41047 return createDisclosureStore(props); 41048 } 41049 41050 // node_modules/@ariakit/react-core/esm/__chunks/4NYSH4UO.js 41051 function useDialogStoreProps(store2, update4, props) { 41052 return useDisclosureStoreProps(store2, update4, props); 41053 } 41054 41055 // node_modules/@ariakit/core/esm/__chunks/BFGNM53A.js 41056 function createPopoverStore({ 41057 popover: otherPopover, 41058 ...props 41059 } = {}) { 41060 const store2 = mergeStore( 41061 props.store, 41062 omit2(otherPopover, [ 41063 "arrowElement", 41064 "anchorElement", 41065 "contentElement", 41066 "popoverElement", 41067 "disclosureElement" 41068 ]) 41069 ); 41070 throwOnConflictingProps(props, store2); 41071 const syncState = store2 == null ? void 0 : store2.getState(); 41072 const dialog = createDialogStore({ ...props, store: store2 }); 41073 const placement = defaultValue( 41074 props.placement, 41075 syncState == null ? void 0 : syncState.placement, 41076 "bottom" 41077 ); 41078 const initialState = { 41079 ...dialog.getState(), 41080 placement, 41081 currentPlacement: placement, 41082 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), 41083 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), 41084 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), 41085 rendered: /* @__PURE__ */ Symbol("rendered") 41086 }; 41087 const popover = createStore(initialState, dialog, store2); 41088 return { 41089 ...dialog, 41090 ...popover, 41091 setAnchorElement: (element) => popover.setState("anchorElement", element), 41092 setPopoverElement: (element) => popover.setState("popoverElement", element), 41093 setArrowElement: (element) => popover.setState("arrowElement", element), 41094 render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered")) 41095 }; 41096 } 41097 41098 // node_modules/@ariakit/react-core/esm/__chunks/B6FLPFJM.js 41099 function usePopoverStoreProps(store2, update4, props) { 41100 useUpdateEffect(update4, [props.popover]); 41101 useStoreProps(store2, props, "placement"); 41102 return useDialogStoreProps(store2, update4, props); 41103 } 41104 41105 // node_modules/@ariakit/react-core/esm/__chunks/4POTBZ2J.js 41106 var TagName7 = "div"; 41107 var usePopoverAnchor = createHook( 41108 function usePopoverAnchor2({ store: store2, ...props }) { 41109 const context = usePopoverProviderContext(); 41110 store2 = store2 || context; 41111 props = { 41112 ...props, 41113 ref: useMergeRefs(store2 == null ? void 0 : store2.setAnchorElement, props.ref) 41114 }; 41115 return props; 41116 } 41117 ); 41118 var PopoverAnchor = forwardRef210(function PopoverAnchor2(props) { 41119 const htmlProps = usePopoverAnchor(props); 41120 return createElement5(TagName7, htmlProps); 41121 }); 41122 41123 // node_modules/@ariakit/react-core/esm/__chunks/X6LNAU2F.js 41124 var import_react27 = __toESM(require_react(), 1); 41125 var TagName8 = "div"; 41126 function getMouseDestination(event) { 41127 const relatedTarget = event.relatedTarget; 41128 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { 41129 return relatedTarget; 41130 } 41131 return null; 41132 } 41133 function hoveringInside(event) { 41134 const nextElement = getMouseDestination(event); 41135 if (!nextElement) return false; 41136 return contains2(event.currentTarget, nextElement); 41137 } 41138 var symbol2 = /* @__PURE__ */ Symbol("composite-hover"); 41139 function movingToAnotherItem(event) { 41140 let dest = getMouseDestination(event); 41141 if (!dest) return false; 41142 do { 41143 if (hasOwnProperty(dest, symbol2) && dest[symbol2]) return true; 41144 dest = dest.parentElement; 41145 } while (dest); 41146 return false; 41147 } 41148 var useCompositeHover = createHook( 41149 function useCompositeHover2({ 41150 store: store2, 41151 focusOnHover = true, 41152 blurOnHoverEnd = !!focusOnHover, 41153 ...props 41154 }) { 41155 const context = useCompositeContext(); 41156 store2 = store2 || context; 41157 invariant( 41158 store2, 41159 "CompositeHover must be wrapped in a Composite component." 41160 ); 41161 const isMouseMoving = useIsMouseMoving(); 41162 const onMouseMoveProp = props.onMouseMove; 41163 const focusOnHoverProp = useBooleanEvent(focusOnHover); 41164 const onMouseMove = useEvent((event) => { 41165 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); 41166 if (event.defaultPrevented) return; 41167 if (!isMouseMoving()) return; 41168 if (!focusOnHoverProp(event)) return; 41169 if (!hasFocusWithin(event.currentTarget)) { 41170 const baseElement = store2 == null ? void 0 : store2.getState().baseElement; 41171 if (baseElement && !hasFocus(baseElement)) { 41172 baseElement.focus(); 41173 } 41174 } 41175 store2 == null ? void 0 : store2.setActiveId(event.currentTarget.id); 41176 }); 41177 const onMouseLeaveProp = props.onMouseLeave; 41178 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 41179 const onMouseLeave = useEvent((event) => { 41180 var _a; 41181 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); 41182 if (event.defaultPrevented) return; 41183 if (!isMouseMoving()) return; 41184 if (hoveringInside(event)) return; 41185 if (movingToAnotherItem(event)) return; 41186 if (!focusOnHoverProp(event)) return; 41187 if (!blurOnHoverEndProp(event)) return; 41188 store2 == null ? void 0 : store2.setActiveId(null); 41189 (_a = store2 == null ? void 0 : store2.getState().baseElement) == null ? void 0 : _a.focus(); 41190 }); 41191 const ref = (0, import_react27.useCallback)((element) => { 41192 if (!element) return; 41193 element[symbol2] = true; 41194 }, []); 41195 props = { 41196 ...props, 41197 ref: useMergeRefs(ref, props.ref), 41198 onMouseMove, 41199 onMouseLeave 41200 }; 41201 return removeUndefinedValues(props); 41202 } 41203 ); 41204 var CompositeHover = memo22( 41205 forwardRef210(function CompositeHover2(props) { 41206 const htmlProps = useCompositeHover(props); 41207 return createElement5(TagName8, htmlProps); 41208 }) 41209 ); 41210 41211 // node_modules/@ariakit/react-core/esm/combobox/combobox.js 41212 var import_react28 = __toESM(require_react(), 1); 41213 var TagName9 = "input"; 41214 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 41215 if (!autoSelect) return false; 41216 const firstItem = items.find((item) => !item.disabled && item.value); 41217 return (firstItem == null ? void 0 : firstItem.value) === activeValue; 41218 } 41219 function hasCompletionString(value, activeValue) { 41220 if (!activeValue) return false; 41221 if (value == null) return false; 41222 value = normalizeString(value); 41223 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0; 41224 } 41225 function isInputEvent(event) { 41226 return event.type === "input"; 41227 } 41228 function isAriaAutoCompleteValue(value) { 41229 return value === "inline" || value === "list" || value === "both" || value === "none"; 41230 } 41231 function getDefaultAutoSelectId(items) { 41232 const item = items.find((item2) => { 41233 var _a; 41234 if (item2.disabled) return false; 41235 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab"; 41236 }); 41237 return item == null ? void 0 : item.id; 41238 } 41239 var useCombobox = createHook( 41240 function useCombobox2({ 41241 store: store2, 41242 focusable: focusable2 = true, 41243 autoSelect: autoSelectProp = false, 41244 getAutoSelectId, 41245 setValueOnChange, 41246 showMinLength = 0, 41247 showOnChange, 41248 showOnMouseDown, 41249 showOnClick = showOnMouseDown, 41250 showOnKeyDown, 41251 showOnKeyPress = showOnKeyDown, 41252 blurActiveItemOnClick, 41253 setValueOnClick = true, 41254 moveOnKeyPress = true, 41255 autoComplete = "list", 41256 ...props 41257 }) { 41258 const context = useComboboxProviderContext(); 41259 store2 = store2 || context; 41260 invariant( 41261 store2, 41262 "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component." 41263 ); 41264 const ref = (0, import_react28.useRef)(null); 41265 const [valueUpdated, forceValueUpdate] = useForceUpdate2(); 41266 const canAutoSelectRef = (0, import_react28.useRef)(false); 41267 const composingRef = (0, import_react28.useRef)(false); 41268 const autoSelect = store2.useState( 41269 (state) => state.virtualFocus && autoSelectProp 41270 ); 41271 const inline4 = autoComplete === "inline" || autoComplete === "both"; 41272 const [canInline, setCanInline] = (0, import_react28.useState)(inline4); 41273 useUpdateLayoutEffect(() => { 41274 if (!inline4) return; 41275 setCanInline(true); 41276 }, [inline4]); 41277 const storeValue = store2.useState("value"); 41278 const prevSelectedValueRef = (0, import_react28.useRef)(void 0); 41279 (0, import_react28.useEffect)(() => { 41280 return sync2(store2, ["selectedValue", "activeId"], (_, prev) => { 41281 prevSelectedValueRef.current = prev.selectedValue; 41282 }); 41283 }, []); 41284 const inlineActiveValue = store2.useState((state) => { 41285 var _a; 41286 if (!inline4) return; 41287 if (!canInline) return; 41288 if (state.activeValue && Array.isArray(state.selectedValue)) { 41289 if (state.selectedValue.includes(state.activeValue)) return; 41290 if ((_a = prevSelectedValueRef.current) == null ? void 0 : _a.includes(state.activeValue)) return; 41291 } 41292 return state.activeValue; 41293 }); 41294 const items = store2.useState("renderedItems"); 41295 const open = store2.useState("open"); 41296 const contentElement = store2.useState("contentElement"); 41297 const value = (0, import_react28.useMemo)(() => { 41298 if (!inline4) return storeValue; 41299 if (!canInline) return storeValue; 41300 const firstItemAutoSelected = isFirstItemAutoSelected( 41301 items, 41302 inlineActiveValue, 41303 autoSelect 41304 ); 41305 if (firstItemAutoSelected) { 41306 if (hasCompletionString(storeValue, inlineActiveValue)) { 41307 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || ""; 41308 return storeValue + slice; 41309 } 41310 return storeValue; 41311 } 41312 return inlineActiveValue || storeValue; 41313 }, [inline4, canInline, items, inlineActiveValue, autoSelect, storeValue]); 41314 (0, import_react28.useEffect)(() => { 41315 const element = ref.current; 41316 if (!element) return; 41317 const onCompositeItemMove = () => setCanInline(true); 41318 element.addEventListener("combobox-item-move", onCompositeItemMove); 41319 return () => { 41320 element.removeEventListener("combobox-item-move", onCompositeItemMove); 41321 }; 41322 }, []); 41323 (0, import_react28.useEffect)(() => { 41324 if (!inline4) return; 41325 if (!canInline) return; 41326 if (!inlineActiveValue) return; 41327 const firstItemAutoSelected = isFirstItemAutoSelected( 41328 items, 41329 inlineActiveValue, 41330 autoSelect 41331 ); 41332 if (!firstItemAutoSelected) return; 41333 if (!hasCompletionString(storeValue, inlineActiveValue)) return; 41334 let cleanup = noop5; 41335 queueMicrotask(() => { 41336 const element = ref.current; 41337 if (!element) return; 41338 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 41339 const nextStart = storeValue.length; 41340 const nextEnd = inlineActiveValue.length; 41341 setSelectionRange(element, nextStart, nextEnd); 41342 cleanup = () => { 41343 if (!hasFocus(element)) return; 41344 const { start: start2, end } = getTextboxSelection(element); 41345 if (start2 !== nextStart) return; 41346 if (end !== nextEnd) return; 41347 setSelectionRange(element, prevStart, prevEnd); 41348 }; 41349 }); 41350 return () => cleanup(); 41351 }, [ 41352 valueUpdated, 41353 inline4, 41354 canInline, 41355 inlineActiveValue, 41356 items, 41357 autoSelect, 41358 storeValue 41359 ]); 41360 const scrollingElementRef = (0, import_react28.useRef)(null); 41361 const getAutoSelectIdProp = useEvent(getAutoSelectId); 41362 const autoSelectIdRef = (0, import_react28.useRef)(null); 41363 (0, import_react28.useEffect)(() => { 41364 if (!open) return; 41365 if (!contentElement) return; 41366 const scrollingElement = getScrollingElement(contentElement); 41367 if (!scrollingElement) return; 41368 scrollingElementRef.current = scrollingElement; 41369 const onUserScroll = () => { 41370 canAutoSelectRef.current = false; 41371 }; 41372 const onScroll = () => { 41373 if (!store2) return; 41374 if (!canAutoSelectRef.current) return; 41375 const { activeId } = store2.getState(); 41376 if (activeId === null) return; 41377 if (activeId === autoSelectIdRef.current) return; 41378 canAutoSelectRef.current = false; 41379 }; 41380 const options = { passive: true, capture: true }; 41381 scrollingElement.addEventListener("wheel", onUserScroll, options); 41382 scrollingElement.addEventListener("touchmove", onUserScroll, options); 41383 scrollingElement.addEventListener("scroll", onScroll, options); 41384 return () => { 41385 scrollingElement.removeEventListener("wheel", onUserScroll, true); 41386 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 41387 scrollingElement.removeEventListener("scroll", onScroll, true); 41388 }; 41389 }, [open, contentElement, store2]); 41390 useSafeLayoutEffect(() => { 41391 if (!storeValue) return; 41392 if (composingRef.current) return; 41393 canAutoSelectRef.current = true; 41394 }, [storeValue]); 41395 useSafeLayoutEffect(() => { 41396 if (autoSelect !== "always" && open) return; 41397 canAutoSelectRef.current = open; 41398 }, [autoSelect, open]); 41399 const resetValueOnSelect = store2.useState("resetValueOnSelect"); 41400 useUpdateEffect(() => { 41401 var _a, _b; 41402 const canAutoSelect = canAutoSelectRef.current; 41403 if (!store2) return; 41404 if (!open) return; 41405 if (!canAutoSelect && !resetValueOnSelect) return; 41406 const { baseElement, contentElement: contentElement2, activeId } = store2.getState(); 41407 if (baseElement && !hasFocus(baseElement)) return; 41408 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) { 41409 const observer = new MutationObserver(forceValueUpdate); 41410 observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); 41411 return () => observer.disconnect(); 41412 } 41413 if (autoSelect && canAutoSelect) { 41414 const userAutoSelectId = getAutoSelectIdProp(items); 41415 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a = getDefaultAutoSelectId(items)) != null ? _a : store2.first(); 41416 autoSelectIdRef.current = autoSelectId; 41417 store2.move(autoSelectId != null ? autoSelectId : null); 41418 } else { 41419 const element = (_b = store2.item(activeId || store2.first())) == null ? void 0 : _b.element; 41420 if (element && "scrollIntoView" in element) { 41421 element.scrollIntoView({ block: "nearest", inline: "nearest" }); 41422 } 41423 } 41424 return; 41425 }, [ 41426 store2, 41427 open, 41428 valueUpdated, 41429 storeValue, 41430 autoSelect, 41431 resetValueOnSelect, 41432 getAutoSelectIdProp, 41433 items 41434 ]); 41435 (0, import_react28.useEffect)(() => { 41436 if (!inline4) return; 41437 const combobox = ref.current; 41438 if (!combobox) return; 41439 const elements2 = [combobox, contentElement].filter( 41440 (value2) => !!value2 41441 ); 41442 const onBlur2 = (event) => { 41443 if (elements2.every((el) => isFocusEventOutside(event, el))) { 41444 store2 == null ? void 0 : store2.setValue(value); 41445 } 41446 }; 41447 for (const element of elements2) { 41448 element.addEventListener("focusout", onBlur2); 41449 } 41450 return () => { 41451 for (const element of elements2) { 41452 element.removeEventListener("focusout", onBlur2); 41453 } 41454 }; 41455 }, [inline4, contentElement, store2, value]); 41456 const canShow = (event) => { 41457 const currentTarget = event.currentTarget; 41458 return currentTarget.value.length >= showMinLength; 41459 }; 41460 const onChangeProp = props.onChange; 41461 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow); 41462 const setValueOnChangeProp = useBooleanEvent( 41463 // If the combobox is combined with tags, the value will be set by the tag 41464 // input component. 41465 setValueOnChange != null ? setValueOnChange : !store2.tag 41466 ); 41467 const onChange = useEvent((event) => { 41468 onChangeProp == null ? void 0 : onChangeProp(event); 41469 if (event.defaultPrevented) return; 41470 if (!store2) return; 41471 const currentTarget = event.currentTarget; 41472 const { value: value2, selectionStart, selectionEnd } = currentTarget; 41473 const nativeEvent = event.nativeEvent; 41474 canAutoSelectRef.current = true; 41475 if (isInputEvent(nativeEvent)) { 41476 if (nativeEvent.isComposing) { 41477 canAutoSelectRef.current = false; 41478 composingRef.current = true; 41479 } 41480 if (inline4) { 41481 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 41482 const caretAtEnd = selectionStart === value2.length; 41483 setCanInline(textInserted && caretAtEnd); 41484 } 41485 } 41486 if (setValueOnChangeProp(event)) { 41487 const isSameValue = value2 === store2.getState().value; 41488 store2.setValue(value2); 41489 queueMicrotask(() => { 41490 setSelectionRange(currentTarget, selectionStart, selectionEnd); 41491 }); 41492 if (inline4 && autoSelect && isSameValue) { 41493 forceValueUpdate(); 41494 } 41495 } 41496 if (showOnChangeProp(event)) { 41497 store2.show(); 41498 } 41499 if (!autoSelect || !canAutoSelectRef.current) { 41500 store2.setActiveId(null); 41501 } 41502 }); 41503 const onCompositionEndProp = props.onCompositionEnd; 41504 const onCompositionEnd = useEvent((event) => { 41505 canAutoSelectRef.current = true; 41506 composingRef.current = false; 41507 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event); 41508 if (event.defaultPrevented) return; 41509 if (!autoSelect) return; 41510 forceValueUpdate(); 41511 }); 41512 const onMouseDownProp = props.onMouseDown; 41513 const blurActiveItemOnClickProp = useBooleanEvent( 41514 blurActiveItemOnClick != null ? blurActiveItemOnClick : (() => !!(store2 == null ? void 0 : store2.getState().includesBaseElement)) 41515 ); 41516 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 41517 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow); 41518 const onMouseDown = useEvent((event) => { 41519 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 41520 if (event.defaultPrevented) return; 41521 if (event.button) return; 41522 if (event.ctrlKey) return; 41523 if (!store2) return; 41524 if (blurActiveItemOnClickProp(event)) { 41525 store2.setActiveId(null); 41526 } 41527 if (setValueOnClickProp(event)) { 41528 store2.setValue(value); 41529 } 41530 if (showOnClickProp(event)) { 41531 queueBeforeEvent(event.currentTarget, "mouseup", store2.show); 41532 } 41533 }); 41534 const onKeyDownProp = props.onKeyDown; 41535 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow); 41536 const onKeyDown = useEvent((event) => { 41537 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 41538 if (!event.repeat) { 41539 canAutoSelectRef.current = false; 41540 } 41541 if (event.defaultPrevented) return; 41542 if (event.ctrlKey) return; 41543 if (event.altKey) return; 41544 if (event.shiftKey) return; 41545 if (event.metaKey) return; 41546 if (!store2) return; 41547 const { open: open2 } = store2.getState(); 41548 if (open2) return; 41549 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 41550 if (showOnKeyPressProp(event)) { 41551 event.preventDefault(); 41552 store2.show(); 41553 } 41554 } 41555 }); 41556 const onBlurProp = props.onBlur; 41557 const onBlur = useEvent((event) => { 41558 canAutoSelectRef.current = false; 41559 onBlurProp == null ? void 0 : onBlurProp(event); 41560 if (event.defaultPrevented) return; 41561 }); 41562 const id = useId7(props.id); 41563 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 41564 const isActiveItem = store2.useState((state) => state.activeId === null); 41565 props = { 41566 id, 41567 role: "combobox", 41568 "aria-autocomplete": ariaAutoComplete, 41569 "aria-haspopup": getPopupRole(contentElement, "listbox"), 41570 "aria-expanded": open, 41571 "aria-controls": contentElement == null ? void 0 : contentElement.id, 41572 "data-active-item": isActiveItem || void 0, 41573 value, 41574 ...props, 41575 ref: useMergeRefs(ref, props.ref), 41576 onChange, 41577 onCompositionEnd, 41578 onMouseDown, 41579 onKeyDown, 41580 onBlur 41581 }; 41582 props = useComposite({ 41583 store: store2, 41584 focusable: focusable2, 41585 ...props, 41586 // Enable inline autocomplete when the user moves from the combobox input 41587 // to an item. 41588 moveOnKeyPress: (event) => { 41589 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 41590 if (inline4) setCanInline(true); 41591 return true; 41592 } 41593 }); 41594 props = usePopoverAnchor({ store: store2, ...props }); 41595 return { autoComplete: "off", ...props }; 41596 } 41597 ); 41598 var Combobox = forwardRef210(function Combobox2(props) { 41599 const htmlProps = useCombobox(props); 41600 return createElement5(TagName9, htmlProps); 41601 }); 41602 41603 // node_modules/@ariakit/react-core/esm/__chunks/IBXZ2LQC.js 41604 var import_react29 = __toESM(require_react(), 1); 41605 var import_jsx_runtime229 = __toESM(require_jsx_runtime(), 1); 41606 var TagName10 = "div"; 41607 function isSelected(storeValue, itemValue) { 41608 if (itemValue == null) return; 41609 if (storeValue == null) return false; 41610 if (Array.isArray(storeValue)) { 41611 return storeValue.includes(itemValue); 41612 } 41613 return storeValue === itemValue; 41614 } 41615 function getItemRole(popupRole) { 41616 var _a; 41617 const itemRoleByPopupRole = { 41618 menu: "menuitem", 41619 listbox: "option", 41620 tree: "treeitem" 41621 }; 41622 const key = popupRole; 41623 return (_a = itemRoleByPopupRole[key]) != null ? _a : "option"; 41624 } 41625 var useComboboxItem = createHook( 41626 function useComboboxItem2({ 41627 store: store2, 41628 value, 41629 hideOnClick, 41630 setValueOnClick, 41631 selectValueOnClick = true, 41632 resetValueOnSelect, 41633 focusOnHover = false, 41634 moveOnKeyPress = true, 41635 getItem: getItemProp, 41636 ...props 41637 }) { 41638 var _a; 41639 const context = useComboboxScopedContext(); 41640 store2 = store2 || context; 41641 invariant( 41642 store2, 41643 "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component." 41644 ); 41645 const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store2, { 41646 resetValueOnSelectState: "resetValueOnSelect", 41647 multiSelectable(state) { 41648 return Array.isArray(state.selectedValue); 41649 }, 41650 selected(state) { 41651 return isSelected(state.selectedValue, value); 41652 } 41653 }); 41654 const getItem = (0, import_react29.useCallback)( 41655 (item) => { 41656 const nextItem = { ...item, value }; 41657 if (getItemProp) { 41658 return getItemProp(nextItem); 41659 } 41660 return nextItem; 41661 }, 41662 [value, getItemProp] 41663 ); 41664 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable; 41665 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; 41666 const onClickProp = props.onClick; 41667 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 41668 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 41669 const resetValueOnSelectProp = useBooleanEvent( 41670 (_a = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a : multiSelectable 41671 ); 41672 const hideOnClickProp = useBooleanEvent(hideOnClick); 41673 const onClick = useEvent((event) => { 41674 onClickProp == null ? void 0 : onClickProp(event); 41675 if (event.defaultPrevented) return; 41676 if (isDownloading(event)) return; 41677 if (isOpeningInNewTab(event)) return; 41678 if (value != null) { 41679 if (selectValueOnClickProp(event)) { 41680 if (resetValueOnSelectProp(event)) { 41681 store2 == null ? void 0 : store2.resetValue(); 41682 } 41683 store2 == null ? void 0 : store2.setSelectedValue((prevValue) => { 41684 if (!Array.isArray(prevValue)) return value; 41685 if (prevValue.includes(value)) { 41686 return prevValue.filter((v2) => v2 !== value); 41687 } 41688 return [...prevValue, value]; 41689 }); 41690 } 41691 if (setValueOnClickProp(event)) { 41692 store2 == null ? void 0 : store2.setValue(value); 41693 } 41694 } 41695 if (hideOnClickProp(event)) { 41696 store2 == null ? void 0 : store2.hide(); 41697 } 41698 }); 41699 const onKeyDownProp = props.onKeyDown; 41700 const onKeyDown = useEvent((event) => { 41701 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 41702 if (event.defaultPrevented) return; 41703 const baseElement = store2 == null ? void 0 : store2.getState().baseElement; 41704 if (!baseElement) return; 41705 if (hasFocus(baseElement)) return; 41706 const printable = event.key.length === 1; 41707 if (printable || event.key === "Backspace" || event.key === "Delete") { 41708 queueMicrotask(() => baseElement.focus()); 41709 if (isTextField(baseElement)) { 41710 store2 == null ? void 0 : store2.setValue(baseElement.value); 41711 } 41712 } 41713 }); 41714 if (multiSelectable && selected != null) { 41715 props = { 41716 "aria-selected": selected, 41717 ...props 41718 }; 41719 } 41720 props = useWrapElement( 41721 props, 41722 (element) => /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }), 41723 [value, selected] 41724 ); 41725 const popupRole = (0, import_react29.useContext)(ComboboxListRoleContext); 41726 props = { 41727 role: getItemRole(popupRole), 41728 children: value, 41729 ...props, 41730 onClick, 41731 onKeyDown 41732 }; 41733 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 41734 props = useCompositeItem({ 41735 store: store2, 41736 ...props, 41737 getItem, 41738 // Dispatch a custom event on the combobox input when moving to an item 41739 // with the keyboard so the Combobox component can enable inline 41740 // autocompletion. 41741 moveOnKeyPress: (event) => { 41742 if (!moveOnKeyPressProp(event)) return false; 41743 const moveEvent = new Event("combobox-item-move"); 41744 const baseElement = store2 == null ? void 0 : store2.getState().baseElement; 41745 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent); 41746 return true; 41747 } 41748 }); 41749 props = useCompositeHover({ store: store2, focusOnHover, ...props }); 41750 return props; 41751 } 41752 ); 41753 var ComboboxItem = memo22( 41754 forwardRef210(function ComboboxItem2(props) { 41755 const htmlProps = useComboboxItem(props); 41756 return createElement5(TagName10, htmlProps); 41757 }) 41758 ); 41759 41760 // node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js 41761 var import_react30 = __toESM(require_react(), 1); 41762 var import_jsx_runtime230 = __toESM(require_jsx_runtime(), 1); 41763 var TagName11 = "span"; 41764 function normalizeValue(value) { 41765 return normalizeString(value).toLowerCase(); 41766 } 41767 function getOffsets(string, values) { 41768 const offsets = []; 41769 for (const value of values) { 41770 let pos = 0; 41771 const length = value.length; 41772 while (string.indexOf(value, pos) !== -1) { 41773 const index2 = string.indexOf(value, pos); 41774 if (index2 !== -1) { 41775 offsets.push([index2, length]); 41776 } 41777 pos = index2 + 1; 41778 } 41779 } 41780 return offsets; 41781 } 41782 function filterOverlappingOffsets(offsets) { 41783 return offsets.filter(([offset4, length], i2, arr) => { 41784 return !arr.some( 41785 ([o3, l2], j2) => j2 !== i2 && o3 <= offset4 && o3 + l2 >= offset4 + length 41786 ); 41787 }); 41788 } 41789 function sortOffsets(offsets) { 41790 return offsets.sort(([a2], [b2]) => a2 - b2); 41791 } 41792 function splitValue(itemValue, userValue) { 41793 if (!itemValue) return itemValue; 41794 if (!userValue) return itemValue; 41795 const userValues = toArray2(userValue).filter(Boolean).map(normalizeValue); 41796 const parts = []; 41797 const span = (value, autocomplete = false) => /* @__PURE__ */ (0, import_jsx_runtime230.jsx)( 41798 "span", 41799 { 41800 "data-autocomplete-value": autocomplete ? "" : void 0, 41801 "data-user-value": autocomplete ? void 0 : "", 41802 children: value 41803 }, 41804 parts.length 41805 ); 41806 const offsets = sortOffsets( 41807 filterOverlappingOffsets( 41808 // Convert userValues into a set to avoid duplicates 41809 getOffsets(normalizeValue(itemValue), new Set(userValues)) 41810 ) 41811 ); 41812 if (!offsets.length) { 41813 parts.push(span(itemValue, true)); 41814 return parts; 41815 } 41816 const [firstOffset] = offsets[0]; 41817 const values = [ 41818 itemValue.slice(0, firstOffset), 41819 ...offsets.flatMap(([offset4, length], i2) => { 41820 var _a; 41821 const value = itemValue.slice(offset4, offset4 + length); 41822 const nextOffset = (_a = offsets[i2 + 1]) == null ? void 0 : _a[0]; 41823 const nextValue = itemValue.slice(offset4 + length, nextOffset); 41824 return [value, nextValue]; 41825 }) 41826 ]; 41827 values.forEach((value, i2) => { 41828 if (!value) return; 41829 parts.push(span(value, i2 % 2 === 0)); 41830 }); 41831 return parts; 41832 } 41833 var useComboboxItemValue = createHook(function useComboboxItemValue2({ store: store2, value, userValue, ...props }) { 41834 const context = useComboboxScopedContext(); 41835 store2 = store2 || context; 41836 const itemContext = (0, import_react30.useContext)(ComboboxItemValueContext); 41837 const itemValue = value != null ? value : itemContext; 41838 const inputValue = useStoreState(store2, (state) => userValue != null ? userValue : state == null ? void 0 : state.value); 41839 const children = (0, import_react30.useMemo)(() => { 41840 if (!itemValue) return; 41841 if (!inputValue) return itemValue; 41842 return splitValue(itemValue, inputValue); 41843 }, [itemValue, inputValue]); 41844 props = { 41845 children, 41846 ...props 41847 }; 41848 return removeUndefinedValues(props); 41849 }); 41850 var ComboboxItemValue = forwardRef210(function ComboboxItemValue2(props) { 41851 const htmlProps = useComboboxItemValue(props); 41852 return createElement5(TagName11, htmlProps); 41853 }); 41854 41855 // node_modules/@ariakit/react-core/esm/combobox/combobox-label.js 41856 var TagName12 = "label"; 41857 var useComboboxLabel = createHook( 41858 function useComboboxLabel2({ store: store2, ...props }) { 41859 const context = useComboboxProviderContext(); 41860 store2 = store2 || context; 41861 invariant( 41862 store2, 41863 "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component." 41864 ); 41865 const comboboxId = store2.useState((state) => { 41866 var _a; 41867 return (_a = state.baseElement) == null ? void 0 : _a.id; 41868 }); 41869 props = { 41870 htmlFor: comboboxId, 41871 ...props 41872 }; 41873 return removeUndefinedValues(props); 41874 } 41875 ); 41876 var ComboboxLabel = memo22( 41877 forwardRef210(function ComboboxLabel2(props) { 41878 const htmlProps = useComboboxLabel(props); 41879 return createElement5(TagName12, htmlProps); 41880 }) 41881 ); 41882 41883 // node_modules/@ariakit/react-core/esm/__chunks/2G6YEJT4.js 41884 var import_react31 = __toESM(require_react(), 1); 41885 var import_jsx_runtime231 = __toESM(require_jsx_runtime(), 1); 41886 var TagName13 = "div"; 41887 var useComboboxList = createHook( 41888 function useComboboxList2({ store: store2, alwaysVisible, ...props }) { 41889 const scopedContext = useComboboxScopedContext(true); 41890 const context = useComboboxContext(); 41891 store2 = store2 || context; 41892 const scopedContextSameStore = !!store2 && store2 === scopedContext; 41893 invariant( 41894 store2, 41895 "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component." 41896 ); 41897 const ref = (0, import_react31.useRef)(null); 41898 const id = useId7(props.id); 41899 const mounted = store2.useState("mounted"); 41900 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 41901 const style = hidden ? { ...props.style, display: "none" } : props.style; 41902 const multiSelectable = store2.useState( 41903 (state) => Array.isArray(state.selectedValue) 41904 ); 41905 const role = useAttribute(ref, "role", props.role); 41906 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid"; 41907 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0; 41908 const [hasListboxInside, setHasListboxInside] = (0, import_react31.useState)(false); 41909 const contentElement = store2.useState("contentElement"); 41910 useSafeLayoutEffect(() => { 41911 if (!mounted) return; 41912 const element = ref.current; 41913 if (!element) return; 41914 if (contentElement !== element) return; 41915 const callback = () => { 41916 setHasListboxInside(!!element.querySelector("[role='listbox']")); 41917 }; 41918 const observer = new MutationObserver(callback); 41919 observer.observe(element, { 41920 subtree: true, 41921 childList: true, 41922 attributeFilter: ["role"] 41923 }); 41924 callback(); 41925 return () => observer.disconnect(); 41926 }, [mounted, contentElement]); 41927 if (!hasListboxInside) { 41928 props = { 41929 role: "listbox", 41930 "aria-multiselectable": ariaMultiSelectable, 41931 ...props 41932 }; 41933 } 41934 props = useWrapElement( 41935 props, 41936 (element) => /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(ComboboxScopedContextProvider, { value: store2, children: /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }), 41937 [store2, role] 41938 ); 41939 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store2.setContentElement : null; 41940 props = { 41941 id, 41942 hidden, 41943 ...props, 41944 ref: useMergeRefs(setContentElement, ref, props.ref), 41945 style 41946 }; 41947 return removeUndefinedValues(props); 41948 } 41949 ); 41950 var ComboboxList = forwardRef210(function ComboboxList2(props) { 41951 const htmlProps = useComboboxList(props); 41952 return createElement5(TagName13, htmlProps); 41953 }); 41954 41955 // node_modules/@ariakit/react-core/esm/__chunks/XSIEPKGA.js 41956 var import_react32 = __toESM(require_react(), 1); 41957 var TagValueContext = (0, import_react32.createContext)(null); 41958 var TagRemoveIdContext = (0, import_react32.createContext)( 41959 null 41960 ); 41961 var ctx8 = createStoreContext( 41962 [CompositeContextProvider], 41963 [CompositeScopedContextProvider] 41964 ); 41965 var useTagContext = ctx8.useContext; 41966 var useTagScopedContext = ctx8.useScopedContext; 41967 var useTagProviderContext = ctx8.useProviderContext; 41968 var TagContextProvider = ctx8.ContextProvider; 41969 var TagScopedContextProvider = ctx8.ScopedContextProvider; 41970 41971 // node_modules/@ariakit/core/esm/combobox/combobox-store.js 41972 var isTouchSafari = isSafari2() && isTouchDevice(); 41973 function createComboboxStore({ 41974 tag, 41975 ...props 41976 } = {}) { 41977 const store2 = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 41978 throwOnConflictingProps(props, store2); 41979 const tagState = tag == null ? void 0 : tag.getState(); 41980 const syncState = store2 == null ? void 0 : store2.getState(); 41981 const activeId = defaultValue( 41982 props.activeId, 41983 syncState == null ? void 0 : syncState.activeId, 41984 props.defaultActiveId, 41985 null 41986 ); 41987 const composite = createCompositeStore({ 41988 ...props, 41989 activeId, 41990 includesBaseElement: defaultValue( 41991 props.includesBaseElement, 41992 syncState == null ? void 0 : syncState.includesBaseElement, 41993 true 41994 ), 41995 orientation: defaultValue( 41996 props.orientation, 41997 syncState == null ? void 0 : syncState.orientation, 41998 "vertical" 41999 ), 42000 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), 42001 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), 42002 virtualFocus: defaultValue( 42003 props.virtualFocus, 42004 syncState == null ? void 0 : syncState.virtualFocus, 42005 true 42006 ) 42007 }); 42008 const popover = createPopoverStore({ 42009 ...props, 42010 placement: defaultValue( 42011 props.placement, 42012 syncState == null ? void 0 : syncState.placement, 42013 "bottom-start" 42014 ) 42015 }); 42016 const value = defaultValue( 42017 props.value, 42018 syncState == null ? void 0 : syncState.value, 42019 props.defaultValue, 42020 "" 42021 ); 42022 const selectedValue = defaultValue( 42023 props.selectedValue, 42024 syncState == null ? void 0 : syncState.selectedValue, 42025 tagState == null ? void 0 : tagState.values, 42026 props.defaultSelectedValue, 42027 "" 42028 ); 42029 const multiSelectable = Array.isArray(selectedValue); 42030 const initialState = { 42031 ...composite.getState(), 42032 ...popover.getState(), 42033 value, 42034 selectedValue, 42035 resetValueOnSelect: defaultValue( 42036 props.resetValueOnSelect, 42037 syncState == null ? void 0 : syncState.resetValueOnSelect, 42038 multiSelectable 42039 ), 42040 resetValueOnHide: defaultValue( 42041 props.resetValueOnHide, 42042 syncState == null ? void 0 : syncState.resetValueOnHide, 42043 multiSelectable && !tag 42044 ), 42045 activeValue: syncState == null ? void 0 : syncState.activeValue 42046 }; 42047 const combobox = createStore(initialState, composite, popover, store2); 42048 if (isTouchSafari) { 42049 setup( 42050 combobox, 42051 () => sync2(combobox, ["virtualFocus"], () => { 42052 combobox.setState("virtualFocus", false); 42053 }) 42054 ); 42055 } 42056 setup(combobox, () => { 42057 if (!tag) return; 42058 return chain( 42059 sync2(combobox, ["selectedValue"], (state) => { 42060 if (!Array.isArray(state.selectedValue)) return; 42061 tag.setValues(state.selectedValue); 42062 }), 42063 sync2(tag, ["values"], (state) => { 42064 combobox.setState("selectedValue", state.values); 42065 }) 42066 ); 42067 }); 42068 setup( 42069 combobox, 42070 () => sync2(combobox, ["resetValueOnHide", "mounted"], (state) => { 42071 if (!state.resetValueOnHide) return; 42072 if (state.mounted) return; 42073 combobox.setState("value", value); 42074 }) 42075 ); 42076 setup( 42077 combobox, 42078 () => sync2(combobox, ["open"], (state) => { 42079 if (state.open) return; 42080 combobox.setState("activeId", activeId); 42081 combobox.setState("moves", 0); 42082 }) 42083 ); 42084 setup( 42085 combobox, 42086 () => sync2(combobox, ["moves", "activeId"], (state, prevState) => { 42087 if (state.moves === prevState.moves) { 42088 combobox.setState("activeValue", void 0); 42089 } 42090 }) 42091 ); 42092 setup( 42093 combobox, 42094 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { 42095 if (state.moves === prev.moves) return; 42096 const { activeId: activeId2 } = combobox.getState(); 42097 const activeItem = composite.item(activeId2); 42098 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); 42099 }) 42100 ); 42101 return { 42102 ...popover, 42103 ...composite, 42104 ...combobox, 42105 tag, 42106 setValue: (value2) => combobox.setState("value", value2), 42107 resetValue: () => combobox.setState("value", initialState.value), 42108 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) 42109 }; 42110 } 42111 42112 // node_modules/@ariakit/react-core/esm/__chunks/SVN33SY6.js 42113 function useComboboxStoreOptions(props) { 42114 const tag = useTagContext(); 42115 props = { 42116 ...props, 42117 tag: props.tag !== void 0 ? props.tag : tag 42118 }; 42119 return useCompositeStoreOptions(props); 42120 } 42121 function useComboboxStoreProps(store2, update4, props) { 42122 useUpdateEffect(update4, [props.tag]); 42123 useStoreProps(store2, props, "value", "setValue"); 42124 useStoreProps(store2, props, "selectedValue", "setSelectedValue"); 42125 useStoreProps(store2, props, "resetValueOnHide"); 42126 useStoreProps(store2, props, "resetValueOnSelect"); 42127 return Object.assign( 42128 useCompositeStoreProps( 42129 usePopoverStoreProps(store2, update4, props), 42130 update4, 42131 props 42132 ), 42133 { tag: props.tag } 42134 ); 42135 } 42136 function useComboboxStore(props = {}) { 42137 props = useComboboxStoreOptions(props); 42138 const [store2, update4] = useStore2(createComboboxStore, props); 42139 return useComboboxStoreProps(store2, update4, props); 42140 } 42141 42142 // node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js 42143 var import_jsx_runtime232 = __toESM(require_jsx_runtime(), 1); 42144 function ComboboxProvider(props = {}) { 42145 const store2 = useComboboxStore(props); 42146 return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(ComboboxContextProvider, { value: store2, children: props.children }); 42147 } 42148 42149 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs 42150 var import_remove_accents = __toESM(require_remove_accents(), 1); 42151 var import_compose18 = __toESM(require_compose(), 1); 42152 var import_i18n95 = __toESM(require_i18n(), 1); 42153 var import_element113 = __toESM(require_element(), 1); 42154 var import_components100 = __toESM(require_components(), 1); 42155 42156 // packages/dataviews/build-module/components/dataviews-filters/utils.mjs 42157 var EMPTY_ARRAY6 = []; 42158 var getCurrentValue = (filterDefinition, currentFilter) => { 42159 if (filterDefinition.singleSelection) { 42160 return currentFilter?.value; 42161 } 42162 if (Array.isArray(currentFilter?.value)) { 42163 return currentFilter.value; 42164 } 42165 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 42166 return [currentFilter.value]; 42167 } 42168 return EMPTY_ARRAY6; 42169 }; 42170 42171 // packages/dataviews/build-module/hooks/use-elements.mjs 42172 var import_element112 = __toESM(require_element(), 1); 42173 var EMPTY_ARRAY7 = []; 42174 function useElements({ 42175 elements: elements2, 42176 getElements 42177 }) { 42178 const staticElements = Array.isArray(elements2) && elements2.length > 0 ? elements2 : EMPTY_ARRAY7; 42179 const [records, setRecords] = (0, import_element112.useState)(staticElements); 42180 const [isLoading, setIsLoading] = (0, import_element112.useState)(false); 42181 (0, import_element112.useEffect)(() => { 42182 if (!getElements) { 42183 setRecords(staticElements); 42184 return; 42185 } 42186 let cancelled = false; 42187 setIsLoading(true); 42188 getElements().then((fetchedElements) => { 42189 if (!cancelled) { 42190 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements; 42191 setRecords(dynamicElements); 42192 } 42193 }).catch(() => { 42194 if (!cancelled) { 42195 setRecords(staticElements); 42196 } 42197 }).finally(() => { 42198 if (!cancelled) { 42199 setIsLoading(false); 42200 } 42201 }); 42202 return () => { 42203 cancelled = true; 42204 }; 42205 }, [getElements, staticElements]); 42206 return { 42207 elements: records, 42208 isLoading 42209 }; 42210 } 42211 42212 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs 42213 var import_jsx_runtime233 = __toESM(require_jsx_runtime(), 1); 42214 function normalizeSearchInput(input = "") { 42215 return (0, import_remove_accents.default)(input.trim().toLowerCase()); 42216 } 42217 var getNewValue = (filterDefinition, currentFilter, value) => { 42218 if (filterDefinition.singleSelection) { 42219 return value; 42220 } 42221 if (Array.isArray(currentFilter?.value)) { 42222 return currentFilter.value.includes(value) ? currentFilter.value.filter((v2) => v2 !== value) : [...currentFilter.value, value]; 42223 } 42224 return [value]; 42225 }; 42226 function generateFilterElementCompositeItemId(prefix2, filterElementValue) { 42227 return `$prefix2}-$filterElementValue}`; 42228 } 42229 var MultiSelectionOption = ({ selected }) => { 42230 return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42231 "span", 42232 { 42233 className: clsx_default( 42234 "dataviews-filters__search-widget-listitem-multi-selection", 42235 { "is-selected": selected } 42236 ), 42237 children: selected && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(import_components100.Icon, { icon: check_default }) 42238 } 42239 ); 42240 }; 42241 var SingleSelectionOption = ({ selected }) => { 42242 return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42243 "span", 42244 { 42245 className: clsx_default( 42246 "dataviews-filters__search-widget-listitem-single-selection", 42247 { "is-selected": selected } 42248 ) 42249 } 42250 ); 42251 }; 42252 function ListBox({ view, filter, onChangeView }) { 42253 const baseId = (0, import_compose18.useInstanceId)(ListBox, "dataviews-filter-list-box"); 42254 const [activeCompositeId, setActiveCompositeId] = (0, import_element113.useState)( 42255 // When there are one or less operators, the first item is set as active 42256 // (by setting the initial `activeId` to `undefined`). 42257 // With 2 or more operators, the focus is moved on the operators control 42258 // (by setting the initial `activeId` to `null`), meaning that there won't 42259 // be an active item initially. Focus is then managed via the 42260 // `onFocusVisible` callback. 42261 filter.operators?.length === 1 ? void 0 : null 42262 ); 42263 const currentFilter = view.filters?.find( 42264 (f2) => f2.field === filter.field 42265 ); 42266 const currentValue = getCurrentValue(filter, currentFilter); 42267 return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42268 import_components100.Composite, 42269 { 42270 virtualFocus: true, 42271 focusLoop: true, 42272 activeId: activeCompositeId, 42273 setActiveId: setActiveCompositeId, 42274 role: "listbox", 42275 className: "dataviews-filters__search-widget-listbox", 42276 "aria-label": (0, import_i18n95.sprintf)( 42277 /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 42278 (0, import_i18n95.__)("List of: %1$s"), 42279 filter.name 42280 ), 42281 onFocusVisible: () => { 42282 if (!activeCompositeId && filter.elements.length) { 42283 setActiveCompositeId( 42284 generateFilterElementCompositeItemId( 42285 baseId, 42286 filter.elements[0].value 42287 ) 42288 ); 42289 } 42290 }, 42291 render: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(import_components100.Composite.Typeahead, {}), 42292 children: filter.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)( 42293 import_components100.Composite.Hover, 42294 { 42295 render: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42296 import_components100.Composite.Item, 42297 { 42298 id: generateFilterElementCompositeItemId( 42299 baseId, 42300 element.value 42301 ), 42302 render: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42303 "div", 42304 { 42305 "aria-label": element.label, 42306 role: "option", 42307 className: "dataviews-filters__search-widget-listitem" 42308 } 42309 ), 42310 onClick: () => { 42311 const newFilters = currentFilter ? [ 42312 ...(view.filters ?? []).map( 42313 (_filter) => { 42314 if (_filter.field === filter.field) { 42315 return { 42316 ..._filter, 42317 operator: currentFilter.operator || filter.operators[0], 42318 value: getNewValue( 42319 filter, 42320 currentFilter, 42321 element.value 42322 ) 42323 }; 42324 } 42325 return _filter; 42326 } 42327 ) 42328 ] : [ 42329 ...view.filters ?? [], 42330 { 42331 field: filter.field, 42332 operator: filter.operators[0], 42333 value: getNewValue( 42334 filter, 42335 currentFilter, 42336 element.value 42337 ) 42338 } 42339 ]; 42340 onChangeView({ 42341 ...view, 42342 page: 1, 42343 filters: newFilters 42344 }); 42345 } 42346 } 42347 ), 42348 children: [ 42349 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42350 SingleSelectionOption, 42351 { 42352 selected: currentValue === element.value 42353 } 42354 ), 42355 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42356 MultiSelectionOption, 42357 { 42358 selected: currentValue.includes(element.value) 42359 } 42360 ), 42361 /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42362 "span", 42363 { 42364 className: "dataviews-filters__search-widget-listitem-value", 42365 title: element.label, 42366 children: element.label 42367 } 42368 ) 42369 ] 42370 }, 42371 element.value 42372 )) 42373 } 42374 ); 42375 } 42376 function ComboboxList22({ view, filter, onChangeView }) { 42377 const [searchValue, setSearchValue] = (0, import_element113.useState)(""); 42378 const deferredSearchValue = (0, import_element113.useDeferredValue)(searchValue); 42379 const currentFilter = view.filters?.find( 42380 (_filter) => _filter.field === filter.field 42381 ); 42382 const currentValue = getCurrentValue(filter, currentFilter); 42383 const matches = (0, import_element113.useMemo)(() => { 42384 const normalizedSearch = normalizeSearchInput(deferredSearchValue); 42385 return filter.elements.filter( 42386 (item) => normalizeSearchInput(item.label).includes(normalizedSearch) 42387 ); 42388 }, [filter.elements, deferredSearchValue]); 42389 return /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)( 42390 ComboboxProvider, 42391 { 42392 selectedValue: currentValue, 42393 setSelectedValue: (value) => { 42394 const newFilters = currentFilter ? [ 42395 ...(view.filters ?? []).map((_filter) => { 42396 if (_filter.field === filter.field) { 42397 return { 42398 ..._filter, 42399 operator: currentFilter.operator || filter.operators[0], 42400 value 42401 }; 42402 } 42403 return _filter; 42404 }) 42405 ] : [ 42406 ...view.filters ?? [], 42407 { 42408 field: filter.field, 42409 operator: filter.operators[0], 42410 value 42411 } 42412 ]; 42413 onChangeView({ 42414 ...view, 42415 page: 1, 42416 filters: newFilters 42417 }); 42418 }, 42419 setValue: setSearchValue, 42420 children: [ 42421 /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [ 42422 /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(ComboboxLabel, {}), children: (0, import_i18n95.__)("Search items") }), 42423 /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42424 Combobox, 42425 { 42426 autoSelect: "always", 42427 placeholder: (0, import_i18n95.__)("Search"), 42428 className: "dataviews-filters__search-widget-filter-combobox__input" 42429 } 42430 ), 42431 /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(import_components100.Icon, { icon: search_default }) }) 42432 ] }), 42433 /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)( 42434 ComboboxList, 42435 { 42436 className: "dataviews-filters__search-widget-filter-combobox-list", 42437 alwaysVisible: true, 42438 children: [ 42439 matches.map((element) => { 42440 return /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)( 42441 ComboboxItem, 42442 { 42443 resetValueOnSelect: false, 42444 value: element.value, 42445 className: "dataviews-filters__search-widget-listitem", 42446 hideOnClick: false, 42447 setValueOnClick: false, 42448 focusOnHover: true, 42449 children: [ 42450 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42451 SingleSelectionOption, 42452 { 42453 selected: currentValue === element.value 42454 } 42455 ), 42456 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42457 MultiSelectionOption, 42458 { 42459 selected: currentValue.includes( 42460 element.value 42461 ) 42462 } 42463 ), 42464 /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)( 42465 "span", 42466 { 42467 className: "dataviews-filters__search-widget-listitem-value", 42468 title: element.label, 42469 children: [ 42470 /* @__PURE__ */ (0, import_jsx_runtime233.jsx)( 42471 ComboboxItemValue, 42472 { 42473 className: "dataviews-filters__search-widget-filter-combobox-item-value", 42474 value: element.label 42475 } 42476 ), 42477 !!element.description && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description }) 42478 ] 42479 } 42480 ) 42481 ] 42482 }, 42483 element.value 42484 ); 42485 }), 42486 !matches.length && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("p", { children: (0, import_i18n95.__)("No results found") }) 42487 ] 42488 } 42489 ) 42490 ] 42491 } 42492 ); 42493 } 42494 function SearchWidget(props) { 42495 const { elements: elements2, isLoading } = useElements({ 42496 elements: props.filter.elements, 42497 getElements: props.filter.getElements 42498 }); 42499 if (isLoading) { 42500 return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(import_components100.Spinner, {}) }); 42501 } 42502 if (elements2.length === 0) { 42503 return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0, import_i18n95.__)("No elements found") }); 42504 } 42505 const Widget = elements2.length > 10 ? ComboboxList22 : ListBox; 42506 return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(Widget, { ...props, filter: { ...props.filter, elements: elements2 } }); 42507 } 42508 42509 // packages/dataviews/build-module/components/dataviews-filters/input-widget.mjs 42510 var import_es62 = __toESM(require_es6(), 1); 42511 var import_compose19 = __toESM(require_compose(), 1); 42512 var import_element114 = __toESM(require_element(), 1); 42513 var import_components101 = __toESM(require_components(), 1); 42514 var import_jsx_runtime234 = __toESM(require_jsx_runtime(), 1); 42515 function InputWidget({ 42516 filter, 42517 view, 42518 onChangeView, 42519 fields: fields2 42520 }) { 42521 const currentFilter = view.filters?.find( 42522 (f2) => f2.field === filter.field 42523 ); 42524 const currentValue = getCurrentValue(filter, currentFilter); 42525 const field = (0, import_element114.useMemo)(() => { 42526 const currentField = fields2.find((f2) => f2.id === filter.field); 42527 if (currentField) { 42528 return { 42529 ...currentField, 42530 // Deactivate validation for filters. 42531 isValid: {}, 42532 // Filter controls are always enabled. 42533 isDisabled: () => false, 42534 // Filter controls are always visible. 42535 isVisible: () => true, 42536 // Configure getValue/setValue as if Item was a plain object. 42537 getValue: ({ item }) => item[currentField.id], 42538 setValue: ({ value }) => ({ 42539 [currentField.id]: value 42540 }) 42541 }; 42542 } 42543 return currentField; 42544 }, [fields2, filter.field]); 42545 const data = (0, import_element114.useMemo)(() => { 42546 return (view.filters ?? []).reduce( 42547 (acc, activeFilter) => { 42548 acc[activeFilter.field] = activeFilter.value; 42549 return acc; 42550 }, 42551 {} 42552 ); 42553 }, [view.filters]); 42554 const handleChange = (0, import_compose19.useEvent)((updatedData) => { 42555 if (!field || !currentFilter) { 42556 return; 42557 } 42558 const nextValue = field.getValue({ item: updatedData }); 42559 if ((0, import_es62.default)(nextValue, currentValue)) { 42560 return; 42561 } 42562 onChangeView({ 42563 ...view, 42564 filters: (view.filters ?? []).map( 42565 (_filter) => _filter.field === filter.field ? { 42566 ..._filter, 42567 operator: currentFilter.operator || filter.operators[0], 42568 // Consider empty strings as undefined: 42569 // 42570 // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records 42571 // - empty string as value means "search empty string": returns only the records that have an empty string as value 42572 // 42573 // In practice, this means the filter will not be able to find an empty string as the value. 42574 value: nextValue === "" ? void 0 : nextValue 42575 } : _filter 42576 ) 42577 }); 42578 }); 42579 if (!field || !field.Edit || !currentFilter) { 42580 return null; 42581 } 42582 return /* @__PURE__ */ (0, import_jsx_runtime234.jsx)( 42583 import_components101.Flex, 42584 { 42585 className: "dataviews-filters__user-input-widget", 42586 gap: 2.5, 42587 direction: "column", 42588 children: /* @__PURE__ */ (0, import_jsx_runtime234.jsx)( 42589 field.Edit, 42590 { 42591 hideLabelFromVision: true, 42592 data, 42593 field, 42594 operator: currentFilter.operator, 42595 onChange: handleChange 42596 } 42597 ) 42598 } 42599 ); 42600 } 42601 42602 // node_modules/date-fns/constants.js 42603 var daysInYear = 365.2425; 42604 var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3; 42605 var minTime = -maxTime; 42606 var millisecondsInWeek = 6048e5; 42607 var millisecondsInDay = 864e5; 42608 var secondsInHour = 3600; 42609 var secondsInDay = secondsInHour * 24; 42610 var secondsInWeek = secondsInDay * 7; 42611 var secondsInYear = secondsInDay * daysInYear; 42612 var secondsInMonth = secondsInYear / 12; 42613 var secondsInQuarter = secondsInMonth * 3; 42614 var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom"); 42615 42616 // node_modules/date-fns/constructFrom.js 42617 function constructFrom(date, value) { 42618 if (typeof date === "function") return date(value); 42619 if (date && typeof date === "object" && constructFromSymbol in date) 42620 return date[constructFromSymbol](value); 42621 if (date instanceof Date) return new date.constructor(value); 42622 return new Date(value); 42623 } 42624 42625 // node_modules/date-fns/toDate.js 42626 function toDate(argument, context) { 42627 return constructFrom(context || argument, argument); 42628 } 42629 42630 // node_modules/date-fns/addDays.js 42631 function addDays(date, amount, options) { 42632 const _date = toDate(date, options?.in); 42633 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 42634 if (!amount) return _date; 42635 _date.setDate(_date.getDate() + amount); 42636 return _date; 42637 } 42638 42639 // node_modules/date-fns/addMonths.js 42640 function addMonths(date, amount, options) { 42641 const _date = toDate(date, options?.in); 42642 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 42643 if (!amount) { 42644 return _date; 42645 } 42646 const dayOfMonth = _date.getDate(); 42647 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime()); 42648 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); 42649 const daysInMonth = endOfDesiredMonth.getDate(); 42650 if (dayOfMonth >= daysInMonth) { 42651 return endOfDesiredMonth; 42652 } else { 42653 _date.setFullYear( 42654 endOfDesiredMonth.getFullYear(), 42655 endOfDesiredMonth.getMonth(), 42656 dayOfMonth 42657 ); 42658 return _date; 42659 } 42660 } 42661 42662 // node_modules/date-fns/_lib/defaultOptions.js 42663 var defaultOptions = {}; 42664 function getDefaultOptions() { 42665 return defaultOptions; 42666 } 42667 42668 // node_modules/date-fns/startOfWeek.js 42669 function startOfWeek(date, options) { 42670 const defaultOptions2 = getDefaultOptions(); 42671 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 42672 const _date = toDate(date, options?.in); 42673 const day = _date.getDay(); 42674 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; 42675 _date.setDate(_date.getDate() - diff); 42676 _date.setHours(0, 0, 0, 0); 42677 return _date; 42678 } 42679 42680 // node_modules/date-fns/startOfISOWeek.js 42681 function startOfISOWeek(date, options) { 42682 return startOfWeek(date, { ...options, weekStartsOn: 1 }); 42683 } 42684 42685 // node_modules/date-fns/getISOWeekYear.js 42686 function getISOWeekYear(date, options) { 42687 const _date = toDate(date, options?.in); 42688 const year = _date.getFullYear(); 42689 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0); 42690 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); 42691 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); 42692 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); 42693 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0); 42694 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); 42695 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); 42696 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); 42697 if (_date.getTime() >= startOfNextYear.getTime()) { 42698 return year + 1; 42699 } else if (_date.getTime() >= startOfThisYear.getTime()) { 42700 return year; 42701 } else { 42702 return year - 1; 42703 } 42704 } 42705 42706 // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js 42707 function getTimezoneOffsetInMilliseconds(date) { 42708 const _date = toDate(date); 42709 const utcDate = new Date( 42710 Date.UTC( 42711 _date.getFullYear(), 42712 _date.getMonth(), 42713 _date.getDate(), 42714 _date.getHours(), 42715 _date.getMinutes(), 42716 _date.getSeconds(), 42717 _date.getMilliseconds() 42718 ) 42719 ); 42720 utcDate.setUTCFullYear(_date.getFullYear()); 42721 return +date - +utcDate; 42722 } 42723 42724 // node_modules/date-fns/_lib/normalizeDates.js 42725 function normalizeDates(context, ...dates) { 42726 const normalize = constructFrom.bind( 42727 null, 42728 context || dates.find((date) => typeof date === "object") 42729 ); 42730 return dates.map(normalize); 42731 } 42732 42733 // node_modules/date-fns/startOfDay.js 42734 function startOfDay(date, options) { 42735 const _date = toDate(date, options?.in); 42736 _date.setHours(0, 0, 0, 0); 42737 return _date; 42738 } 42739 42740 // node_modules/date-fns/differenceInCalendarDays.js 42741 function differenceInCalendarDays(laterDate, earlierDate, options) { 42742 const [laterDate_, earlierDate_] = normalizeDates( 42743 options?.in, 42744 laterDate, 42745 earlierDate 42746 ); 42747 const laterStartOfDay = startOfDay(laterDate_); 42748 const earlierStartOfDay = startOfDay(earlierDate_); 42749 const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay); 42750 const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay); 42751 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay); 42752 } 42753 42754 // node_modules/date-fns/startOfISOWeekYear.js 42755 function startOfISOWeekYear(date, options) { 42756 const year = getISOWeekYear(date, options); 42757 const fourthOfJanuary = constructFrom(options?.in || date, 0); 42758 fourthOfJanuary.setFullYear(year, 0, 4); 42759 fourthOfJanuary.setHours(0, 0, 0, 0); 42760 return startOfISOWeek(fourthOfJanuary); 42761 } 42762 42763 // node_modules/date-fns/addWeeks.js 42764 function addWeeks(date, amount, options) { 42765 return addDays(date, amount * 7, options); 42766 } 42767 42768 // node_modules/date-fns/addYears.js 42769 function addYears(date, amount, options) { 42770 return addMonths(date, amount * 12, options); 42771 } 42772 42773 // node_modules/date-fns/isDate.js 42774 function isDate(value) { 42775 return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"; 42776 } 42777 42778 // node_modules/date-fns/isValid.js 42779 function isValid(date) { 42780 return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date))); 42781 } 42782 42783 // node_modules/date-fns/startOfMonth.js 42784 function startOfMonth(date, options) { 42785 const _date = toDate(date, options?.in); 42786 _date.setDate(1); 42787 _date.setHours(0, 0, 0, 0); 42788 return _date; 42789 } 42790 42791 // node_modules/date-fns/startOfYear.js 42792 function startOfYear(date, options) { 42793 const date_ = toDate(date, options?.in); 42794 date_.setFullYear(date_.getFullYear(), 0, 1); 42795 date_.setHours(0, 0, 0, 0); 42796 return date_; 42797 } 42798 42799 // node_modules/date-fns/locale/en-US/_lib/formatDistance.js 42800 var formatDistanceLocale = { 42801 lessThanXSeconds: { 42802 one: "less than a second", 42803 other: "less than {{count}} seconds" 42804 }, 42805 xSeconds: { 42806 one: "1 second", 42807 other: "{{count}} seconds" 42808 }, 42809 halfAMinute: "half a minute", 42810 lessThanXMinutes: { 42811 one: "less than a minute", 42812 other: "less than {{count}} minutes" 42813 }, 42814 xMinutes: { 42815 one: "1 minute", 42816 other: "{{count}} minutes" 42817 }, 42818 aboutXHours: { 42819 one: "about 1 hour", 42820 other: "about {{count}} hours" 42821 }, 42822 xHours: { 42823 one: "1 hour", 42824 other: "{{count}} hours" 42825 }, 42826 xDays: { 42827 one: "1 day", 42828 other: "{{count}} days" 42829 }, 42830 aboutXWeeks: { 42831 one: "about 1 week", 42832 other: "about {{count}} weeks" 42833 }, 42834 xWeeks: { 42835 one: "1 week", 42836 other: "{{count}} weeks" 42837 }, 42838 aboutXMonths: { 42839 one: "about 1 month", 42840 other: "about {{count}} months" 42841 }, 42842 xMonths: { 42843 one: "1 month", 42844 other: "{{count}} months" 42845 }, 42846 aboutXYears: { 42847 one: "about 1 year", 42848 other: "about {{count}} years" 42849 }, 42850 xYears: { 42851 one: "1 year", 42852 other: "{{count}} years" 42853 }, 42854 overXYears: { 42855 one: "over 1 year", 42856 other: "over {{count}} years" 42857 }, 42858 almostXYears: { 42859 one: "almost 1 year", 42860 other: "almost {{count}} years" 42861 } 42862 }; 42863 var formatDistance = (token, count, options) => { 42864 let result; 42865 const tokenValue = formatDistanceLocale[token]; 42866 if (typeof tokenValue === "string") { 42867 result = tokenValue; 42868 } else if (count === 1) { 42869 result = tokenValue.one; 42870 } else { 42871 result = tokenValue.other.replace("{{count}}", count.toString()); 42872 } 42873 if (options?.addSuffix) { 42874 if (options.comparison && options.comparison > 0) { 42875 return "in " + result; 42876 } else { 42877 return result + " ago"; 42878 } 42879 } 42880 return result; 42881 }; 42882 42883 // node_modules/date-fns/locale/_lib/buildFormatLongFn.js 42884 function buildFormatLongFn(args) { 42885 return (options = {}) => { 42886 const width = options.width ? String(options.width) : args.defaultWidth; 42887 const format6 = args.formats[width] || args.formats[args.defaultWidth]; 42888 return format6; 42889 }; 42890 } 42891 42892 // node_modules/date-fns/locale/en-US/_lib/formatLong.js 42893 var dateFormats = { 42894 full: "EEEE, MMMM do, y", 42895 long: "MMMM do, y", 42896 medium: "MMM d, y", 42897 short: "MM/dd/yyyy" 42898 }; 42899 var timeFormats = { 42900 full: "h:mm:ss a zzzz", 42901 long: "h:mm:ss a z", 42902 medium: "h:mm:ss a", 42903 short: "h:mm a" 42904 }; 42905 var dateTimeFormats = { 42906 full: "{{date}} 'at' {{time}}", 42907 long: "{{date}} 'at' {{time}}", 42908 medium: "{{date}}, {{time}}", 42909 short: "{{date}}, {{time}}" 42910 }; 42911 var formatLong = { 42912 date: buildFormatLongFn({ 42913 formats: dateFormats, 42914 defaultWidth: "full" 42915 }), 42916 time: buildFormatLongFn({ 42917 formats: timeFormats, 42918 defaultWidth: "full" 42919 }), 42920 dateTime: buildFormatLongFn({ 42921 formats: dateTimeFormats, 42922 defaultWidth: "full" 42923 }) 42924 }; 42925 42926 // node_modules/date-fns/locale/en-US/_lib/formatRelative.js 42927 var formatRelativeLocale = { 42928 lastWeek: "'last' eeee 'at' p", 42929 yesterday: "'yesterday at' p", 42930 today: "'today at' p", 42931 tomorrow: "'tomorrow at' p", 42932 nextWeek: "eeee 'at' p", 42933 other: "P" 42934 }; 42935 var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token]; 42936 42937 // node_modules/date-fns/locale/_lib/buildLocalizeFn.js 42938 function buildLocalizeFn(args) { 42939 return (value, options) => { 42940 const context = options?.context ? String(options.context) : "standalone"; 42941 let valuesArray; 42942 if (context === "formatting" && args.formattingValues) { 42943 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; 42944 const width = options?.width ? String(options.width) : defaultWidth; 42945 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; 42946 } else { 42947 const defaultWidth = args.defaultWidth; 42948 const width = options?.width ? String(options.width) : args.defaultWidth; 42949 valuesArray = args.values[width] || args.values[defaultWidth]; 42950 } 42951 const index2 = args.argumentCallback ? args.argumentCallback(value) : value; 42952 return valuesArray[index2]; 42953 }; 42954 } 42955 42956 // node_modules/date-fns/locale/en-US/_lib/localize.js 42957 var eraValues = { 42958 narrow: ["B", "A"], 42959 abbreviated: ["BC", "AD"], 42960 wide: ["Before Christ", "Anno Domini"] 42961 }; 42962 var quarterValues = { 42963 narrow: ["1", "2", "3", "4"], 42964 abbreviated: ["Q1", "Q2", "Q3", "Q4"], 42965 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] 42966 }; 42967 var monthValues = { 42968 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], 42969 abbreviated: [ 42970 "Jan", 42971 "Feb", 42972 "Mar", 42973 "Apr", 42974 "May", 42975 "Jun", 42976 "Jul", 42977 "Aug", 42978 "Sep", 42979 "Oct", 42980 "Nov", 42981 "Dec" 42982 ], 42983 wide: [ 42984 "January", 42985 "February", 42986 "March", 42987 "April", 42988 "May", 42989 "June", 42990 "July", 42991 "August", 42992 "September", 42993 "October", 42994 "November", 42995 "December" 42996 ] 42997 }; 42998 var dayValues = { 42999 narrow: ["S", "M", "T", "W", "T", "F", "S"], 43000 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 43001 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 43002 wide: [ 43003 "Sunday", 43004 "Monday", 43005 "Tuesday", 43006 "Wednesday", 43007 "Thursday", 43008 "Friday", 43009 "Saturday" 43010 ] 43011 }; 43012 var dayPeriodValues = { 43013 narrow: { 43014 am: "a", 43015 pm: "p", 43016 midnight: "mi", 43017 noon: "n", 43018 morning: "morning", 43019 afternoon: "afternoon", 43020 evening: "evening", 43021 night: "night" 43022 }, 43023 abbreviated: { 43024 am: "AM", 43025 pm: "PM", 43026 midnight: "midnight", 43027 noon: "noon", 43028 morning: "morning", 43029 afternoon: "afternoon", 43030 evening: "evening", 43031 night: "night" 43032 }, 43033 wide: { 43034 am: "a.m.", 43035 pm: "p.m.", 43036 midnight: "midnight", 43037 noon: "noon", 43038 morning: "morning", 43039 afternoon: "afternoon", 43040 evening: "evening", 43041 night: "night" 43042 } 43043 }; 43044 var formattingDayPeriodValues = { 43045 narrow: { 43046 am: "a", 43047 pm: "p", 43048 midnight: "mi", 43049 noon: "n", 43050 morning: "in the morning", 43051 afternoon: "in the afternoon", 43052 evening: "in the evening", 43053 night: "at night" 43054 }, 43055 abbreviated: { 43056 am: "AM", 43057 pm: "PM", 43058 midnight: "midnight", 43059 noon: "noon", 43060 morning: "in the morning", 43061 afternoon: "in the afternoon", 43062 evening: "in the evening", 43063 night: "at night" 43064 }, 43065 wide: { 43066 am: "a.m.", 43067 pm: "p.m.", 43068 midnight: "midnight", 43069 noon: "noon", 43070 morning: "in the morning", 43071 afternoon: "in the afternoon", 43072 evening: "in the evening", 43073 night: "at night" 43074 } 43075 }; 43076 var ordinalNumber = (dirtyNumber, _options) => { 43077 const number = Number(dirtyNumber); 43078 const rem100 = number % 100; 43079 if (rem100 > 20 || rem100 < 10) { 43080 switch (rem100 % 10) { 43081 case 1: 43082 return number + "st"; 43083 case 2: 43084 return number + "nd"; 43085 case 3: 43086 return number + "rd"; 43087 } 43088 } 43089 return number + "th"; 43090 }; 43091 var localize = { 43092 ordinalNumber, 43093 era: buildLocalizeFn({ 43094 values: eraValues, 43095 defaultWidth: "wide" 43096 }), 43097 quarter: buildLocalizeFn({ 43098 values: quarterValues, 43099 defaultWidth: "wide", 43100 argumentCallback: (quarter) => quarter - 1 43101 }), 43102 month: buildLocalizeFn({ 43103 values: monthValues, 43104 defaultWidth: "wide" 43105 }), 43106 day: buildLocalizeFn({ 43107 values: dayValues, 43108 defaultWidth: "wide" 43109 }), 43110 dayPeriod: buildLocalizeFn({ 43111 values: dayPeriodValues, 43112 defaultWidth: "wide", 43113 formattingValues: formattingDayPeriodValues, 43114 defaultFormattingWidth: "wide" 43115 }) 43116 }; 43117 43118 // node_modules/date-fns/locale/_lib/buildMatchFn.js 43119 function buildMatchFn(args) { 43120 return (string, options = {}) => { 43121 const width = options.width; 43122 const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; 43123 const matchResult = string.match(matchPattern); 43124 if (!matchResult) { 43125 return null; 43126 } 43127 const matchedString = matchResult[0]; 43128 const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; 43129 const key = Array.isArray(parsePatterns) ? findIndex2(parsePatterns, (pattern) => pattern.test(matchedString)) : ( 43130 // [TODO] -- I challenge you to fix the type 43131 findKey(parsePatterns, (pattern) => pattern.test(matchedString)) 43132 ); 43133 let value; 43134 value = args.valueCallback ? args.valueCallback(key) : key; 43135 value = options.valueCallback ? ( 43136 // [TODO] -- I challenge you to fix the type 43137 options.valueCallback(value) 43138 ) : value; 43139 const rest = string.slice(matchedString.length); 43140 return { value, rest }; 43141 }; 43142 } 43143 function findKey(object, predicate) { 43144 for (const key in object) { 43145 if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) { 43146 return key; 43147 } 43148 } 43149 return void 0; 43150 } 43151 function findIndex2(array, predicate) { 43152 for (let key = 0; key < array.length; key++) { 43153 if (predicate(array[key])) { 43154 return key; 43155 } 43156 } 43157 return void 0; 43158 } 43159 43160 // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js 43161 function buildMatchPatternFn(args) { 43162 return (string, options = {}) => { 43163 const matchResult = string.match(args.matchPattern); 43164 if (!matchResult) return null; 43165 const matchedString = matchResult[0]; 43166 const parseResult = string.match(args.parsePattern); 43167 if (!parseResult) return null; 43168 let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; 43169 value = options.valueCallback ? options.valueCallback(value) : value; 43170 const rest = string.slice(matchedString.length); 43171 return { value, rest }; 43172 }; 43173 } 43174 43175 // node_modules/date-fns/locale/en-US/_lib/match.js 43176 var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; 43177 var parseOrdinalNumberPattern = /\d+/i; 43178 var matchEraPatterns = { 43179 narrow: /^(b|a)/i, 43180 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, 43181 wide: /^(before christ|before common era|anno domini|common era)/i 43182 }; 43183 var parseEraPatterns = { 43184 any: [/^b/i, /^(a|c)/i] 43185 }; 43186 var matchQuarterPatterns = { 43187 narrow: /^[1234]/i, 43188 abbreviated: /^q[1234]/i, 43189 wide: /^[1234](th|st|nd|rd)? quarter/i 43190 }; 43191 var parseQuarterPatterns = { 43192 any: [/1/i, /2/i, /3/i, /4/i] 43193 }; 43194 var matchMonthPatterns = { 43195 narrow: /^[jfmasond]/i, 43196 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, 43197 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i 43198 }; 43199 var parseMonthPatterns = { 43200 narrow: [ 43201 /^j/i, 43202 /^f/i, 43203 /^m/i, 43204 /^a/i, 43205 /^m/i, 43206 /^j/i, 43207 /^j/i, 43208 /^a/i, 43209 /^s/i, 43210 /^o/i, 43211 /^n/i, 43212 /^d/i 43213 ], 43214 any: [ 43215 /^ja/i, 43216 /^f/i, 43217 /^mar/i, 43218 /^ap/i, 43219 /^may/i, 43220 /^jun/i, 43221 /^jul/i, 43222 /^au/i, 43223 /^s/i, 43224 /^o/i, 43225 /^n/i, 43226 /^d/i 43227 ] 43228 }; 43229 var matchDayPatterns = { 43230 narrow: /^[smtwf]/i, 43231 short: /^(su|mo|tu|we|th|fr|sa)/i, 43232 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, 43233 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i 43234 }; 43235 var parseDayPatterns = { 43236 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], 43237 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] 43238 }; 43239 var matchDayPeriodPatterns = { 43240 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, 43241 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i 43242 }; 43243 var parseDayPeriodPatterns = { 43244 any: { 43245 am: /^a/i, 43246 pm: /^p/i, 43247 midnight: /^mi/i, 43248 noon: /^no/i, 43249 morning: /morning/i, 43250 afternoon: /afternoon/i, 43251 evening: /evening/i, 43252 night: /night/i 43253 } 43254 }; 43255 var match2 = { 43256 ordinalNumber: buildMatchPatternFn({ 43257 matchPattern: matchOrdinalNumberPattern, 43258 parsePattern: parseOrdinalNumberPattern, 43259 valueCallback: (value) => parseInt(value, 10) 43260 }), 43261 era: buildMatchFn({ 43262 matchPatterns: matchEraPatterns, 43263 defaultMatchWidth: "wide", 43264 parsePatterns: parseEraPatterns, 43265 defaultParseWidth: "any" 43266 }), 43267 quarter: buildMatchFn({ 43268 matchPatterns: matchQuarterPatterns, 43269 defaultMatchWidth: "wide", 43270 parsePatterns: parseQuarterPatterns, 43271 defaultParseWidth: "any", 43272 valueCallback: (index2) => index2 + 1 43273 }), 43274 month: buildMatchFn({ 43275 matchPatterns: matchMonthPatterns, 43276 defaultMatchWidth: "wide", 43277 parsePatterns: parseMonthPatterns, 43278 defaultParseWidth: "any" 43279 }), 43280 day: buildMatchFn({ 43281 matchPatterns: matchDayPatterns, 43282 defaultMatchWidth: "wide", 43283 parsePatterns: parseDayPatterns, 43284 defaultParseWidth: "any" 43285 }), 43286 dayPeriod: buildMatchFn({ 43287 matchPatterns: matchDayPeriodPatterns, 43288 defaultMatchWidth: "any", 43289 parsePatterns: parseDayPeriodPatterns, 43290 defaultParseWidth: "any" 43291 }) 43292 }; 43293 43294 // node_modules/date-fns/locale/en-US.js 43295 var enUS = { 43296 code: "en-US", 43297 formatDistance, 43298 formatLong, 43299 formatRelative, 43300 localize, 43301 match: match2, 43302 options: { 43303 weekStartsOn: 0, 43304 firstWeekContainsDate: 1 43305 } 43306 }; 43307 43308 // node_modules/date-fns/getDayOfYear.js 43309 function getDayOfYear(date, options) { 43310 const _date = toDate(date, options?.in); 43311 const diff = differenceInCalendarDays(_date, startOfYear(_date)); 43312 const dayOfYear = diff + 1; 43313 return dayOfYear; 43314 } 43315 43316 // node_modules/date-fns/getISOWeek.js 43317 function getISOWeek(date, options) { 43318 const _date = toDate(date, options?.in); 43319 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date); 43320 return Math.round(diff / millisecondsInWeek) + 1; 43321 } 43322 43323 // node_modules/date-fns/getWeekYear.js 43324 function getWeekYear(date, options) { 43325 const _date = toDate(date, options?.in); 43326 const year = _date.getFullYear(); 43327 const defaultOptions2 = getDefaultOptions(); 43328 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 43329 const firstWeekOfNextYear = constructFrom(options?.in || date, 0); 43330 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); 43331 firstWeekOfNextYear.setHours(0, 0, 0, 0); 43332 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options); 43333 const firstWeekOfThisYear = constructFrom(options?.in || date, 0); 43334 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); 43335 firstWeekOfThisYear.setHours(0, 0, 0, 0); 43336 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options); 43337 if (+_date >= +startOfNextYear) { 43338 return year + 1; 43339 } else if (+_date >= +startOfThisYear) { 43340 return year; 43341 } else { 43342 return year - 1; 43343 } 43344 } 43345 43346 // node_modules/date-fns/startOfWeekYear.js 43347 function startOfWeekYear(date, options) { 43348 const defaultOptions2 = getDefaultOptions(); 43349 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 43350 const year = getWeekYear(date, options); 43351 const firstWeek = constructFrom(options?.in || date, 0); 43352 firstWeek.setFullYear(year, 0, firstWeekContainsDate); 43353 firstWeek.setHours(0, 0, 0, 0); 43354 const _date = startOfWeek(firstWeek, options); 43355 return _date; 43356 } 43357 43358 // node_modules/date-fns/getWeek.js 43359 function getWeek(date, options) { 43360 const _date = toDate(date, options?.in); 43361 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options); 43362 return Math.round(diff / millisecondsInWeek) + 1; 43363 } 43364 43365 // node_modules/date-fns/_lib/addLeadingZeros.js 43366 function addLeadingZeros(number, targetLength) { 43367 const sign = number < 0 ? "-" : ""; 43368 const output = Math.abs(number).toString().padStart(targetLength, "0"); 43369 return sign + output; 43370 } 43371 43372 // node_modules/date-fns/_lib/format/lightFormatters.js 43373 var lightFormatters = { 43374 // Year 43375 y(date, token) { 43376 const signedYear = date.getFullYear(); 43377 const year = signedYear > 0 ? signedYear : 1 - signedYear; 43378 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); 43379 }, 43380 // Month 43381 M(date, token) { 43382 const month = date.getMonth(); 43383 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); 43384 }, 43385 // Day of the month 43386 d(date, token) { 43387 return addLeadingZeros(date.getDate(), token.length); 43388 }, 43389 // AM or PM 43390 a(date, token) { 43391 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; 43392 switch (token) { 43393 case "a": 43394 case "aa": 43395 return dayPeriodEnumValue.toUpperCase(); 43396 case "aaa": 43397 return dayPeriodEnumValue; 43398 case "aaaaa": 43399 return dayPeriodEnumValue[0]; 43400 case "aaaa": 43401 default: 43402 return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; 43403 } 43404 }, 43405 // Hour [1-12] 43406 h(date, token) { 43407 return addLeadingZeros(date.getHours() % 12 || 12, token.length); 43408 }, 43409 // Hour [0-23] 43410 H(date, token) { 43411 return addLeadingZeros(date.getHours(), token.length); 43412 }, 43413 // Minute 43414 m(date, token) { 43415 return addLeadingZeros(date.getMinutes(), token.length); 43416 }, 43417 // Second 43418 s(date, token) { 43419 return addLeadingZeros(date.getSeconds(), token.length); 43420 }, 43421 // Fraction of second 43422 S(date, token) { 43423 const numberOfDigits = token.length; 43424 const milliseconds = date.getMilliseconds(); 43425 const fractionalSeconds = Math.trunc( 43426 milliseconds * Math.pow(10, numberOfDigits - 3) 43427 ); 43428 return addLeadingZeros(fractionalSeconds, token.length); 43429 } 43430 }; 43431 43432 // node_modules/date-fns/_lib/format/formatters.js 43433 var dayPeriodEnum = { 43434 am: "am", 43435 pm: "pm", 43436 midnight: "midnight", 43437 noon: "noon", 43438 morning: "morning", 43439 afternoon: "afternoon", 43440 evening: "evening", 43441 night: "night" 43442 }; 43443 var formatters = { 43444 // Era 43445 G: function(date, token, localize2) { 43446 const era = date.getFullYear() > 0 ? 1 : 0; 43447 switch (token) { 43448 // AD, BC 43449 case "G": 43450 case "GG": 43451 case "GGG": 43452 return localize2.era(era, { width: "abbreviated" }); 43453 // A, B 43454 case "GGGGG": 43455 return localize2.era(era, { width: "narrow" }); 43456 // Anno Domini, Before Christ 43457 case "GGGG": 43458 default: 43459 return localize2.era(era, { width: "wide" }); 43460 } 43461 }, 43462 // Year 43463 y: function(date, token, localize2) { 43464 if (token === "yo") { 43465 const signedYear = date.getFullYear(); 43466 const year = signedYear > 0 ? signedYear : 1 - signedYear; 43467 return localize2.ordinalNumber(year, { unit: "year" }); 43468 } 43469 return lightFormatters.y(date, token); 43470 }, 43471 // Local week-numbering year 43472 Y: function(date, token, localize2, options) { 43473 const signedWeekYear = getWeekYear(date, options); 43474 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; 43475 if (token === "YY") { 43476 const twoDigitYear = weekYear % 100; 43477 return addLeadingZeros(twoDigitYear, 2); 43478 } 43479 if (token === "Yo") { 43480 return localize2.ordinalNumber(weekYear, { unit: "year" }); 43481 } 43482 return addLeadingZeros(weekYear, token.length); 43483 }, 43484 // ISO week-numbering year 43485 R: function(date, token) { 43486 const isoWeekYear = getISOWeekYear(date); 43487 return addLeadingZeros(isoWeekYear, token.length); 43488 }, 43489 // Extended year. This is a single number designating the year of this calendar system. 43490 // The main difference between `y` and `u` localizers are B.C. years: 43491 // | Year | `y` | `u` | 43492 // |------|-----|-----| 43493 // | AC 1 | 1 | 1 | 43494 // | BC 1 | 1 | 0 | 43495 // | BC 2 | 2 | -1 | 43496 // Also `yy` always returns the last two digits of a year, 43497 // while `uu` pads single digit years to 2 characters and returns other years unchanged. 43498 u: function(date, token) { 43499 const year = date.getFullYear(); 43500 return addLeadingZeros(year, token.length); 43501 }, 43502 // Quarter 43503 Q: function(date, token, localize2) { 43504 const quarter = Math.ceil((date.getMonth() + 1) / 3); 43505 switch (token) { 43506 // 1, 2, 3, 4 43507 case "Q": 43508 return String(quarter); 43509 // 01, 02, 03, 04 43510 case "QQ": 43511 return addLeadingZeros(quarter, 2); 43512 // 1st, 2nd, 3rd, 4th 43513 case "Qo": 43514 return localize2.ordinalNumber(quarter, { unit: "quarter" }); 43515 // Q1, Q2, Q3, Q4 43516 case "QQQ": 43517 return localize2.quarter(quarter, { 43518 width: "abbreviated", 43519 context: "formatting" 43520 }); 43521 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 43522 case "QQQQQ": 43523 return localize2.quarter(quarter, { 43524 width: "narrow", 43525 context: "formatting" 43526 }); 43527 // 1st quarter, 2nd quarter, ... 43528 case "QQQQ": 43529 default: 43530 return localize2.quarter(quarter, { 43531 width: "wide", 43532 context: "formatting" 43533 }); 43534 } 43535 }, 43536 // Stand-alone quarter 43537 q: function(date, token, localize2) { 43538 const quarter = Math.ceil((date.getMonth() + 1) / 3); 43539 switch (token) { 43540 // 1, 2, 3, 4 43541 case "q": 43542 return String(quarter); 43543 // 01, 02, 03, 04 43544 case "qq": 43545 return addLeadingZeros(quarter, 2); 43546 // 1st, 2nd, 3rd, 4th 43547 case "qo": 43548 return localize2.ordinalNumber(quarter, { unit: "quarter" }); 43549 // Q1, Q2, Q3, Q4 43550 case "qqq": 43551 return localize2.quarter(quarter, { 43552 width: "abbreviated", 43553 context: "standalone" 43554 }); 43555 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 43556 case "qqqqq": 43557 return localize2.quarter(quarter, { 43558 width: "narrow", 43559 context: "standalone" 43560 }); 43561 // 1st quarter, 2nd quarter, ... 43562 case "qqqq": 43563 default: 43564 return localize2.quarter(quarter, { 43565 width: "wide", 43566 context: "standalone" 43567 }); 43568 } 43569 }, 43570 // Month 43571 M: function(date, token, localize2) { 43572 const month = date.getMonth(); 43573 switch (token) { 43574 case "M": 43575 case "MM": 43576 return lightFormatters.M(date, token); 43577 // 1st, 2nd, ..., 12th 43578 case "Mo": 43579 return localize2.ordinalNumber(month + 1, { unit: "month" }); 43580 // Jan, Feb, ..., Dec 43581 case "MMM": 43582 return localize2.month(month, { 43583 width: "abbreviated", 43584 context: "formatting" 43585 }); 43586 // J, F, ..., D 43587 case "MMMMM": 43588 return localize2.month(month, { 43589 width: "narrow", 43590 context: "formatting" 43591 }); 43592 // January, February, ..., December 43593 case "MMMM": 43594 default: 43595 return localize2.month(month, { width: "wide", context: "formatting" }); 43596 } 43597 }, 43598 // Stand-alone month 43599 L: function(date, token, localize2) { 43600 const month = date.getMonth(); 43601 switch (token) { 43602 // 1, 2, ..., 12 43603 case "L": 43604 return String(month + 1); 43605 // 01, 02, ..., 12 43606 case "LL": 43607 return addLeadingZeros(month + 1, 2); 43608 // 1st, 2nd, ..., 12th 43609 case "Lo": 43610 return localize2.ordinalNumber(month + 1, { unit: "month" }); 43611 // Jan, Feb, ..., Dec 43612 case "LLL": 43613 return localize2.month(month, { 43614 width: "abbreviated", 43615 context: "standalone" 43616 }); 43617 // J, F, ..., D 43618 case "LLLLL": 43619 return localize2.month(month, { 43620 width: "narrow", 43621 context: "standalone" 43622 }); 43623 // January, February, ..., December 43624 case "LLLL": 43625 default: 43626 return localize2.month(month, { width: "wide", context: "standalone" }); 43627 } 43628 }, 43629 // Local week of year 43630 w: function(date, token, localize2, options) { 43631 const week = getWeek(date, options); 43632 if (token === "wo") { 43633 return localize2.ordinalNumber(week, { unit: "week" }); 43634 } 43635 return addLeadingZeros(week, token.length); 43636 }, 43637 // ISO week of year 43638 I: function(date, token, localize2) { 43639 const isoWeek = getISOWeek(date); 43640 if (token === "Io") { 43641 return localize2.ordinalNumber(isoWeek, { unit: "week" }); 43642 } 43643 return addLeadingZeros(isoWeek, token.length); 43644 }, 43645 // Day of the month 43646 d: function(date, token, localize2) { 43647 if (token === "do") { 43648 return localize2.ordinalNumber(date.getDate(), { unit: "date" }); 43649 } 43650 return lightFormatters.d(date, token); 43651 }, 43652 // Day of year 43653 D: function(date, token, localize2) { 43654 const dayOfYear = getDayOfYear(date); 43655 if (token === "Do") { 43656 return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); 43657 } 43658 return addLeadingZeros(dayOfYear, token.length); 43659 }, 43660 // Day of week 43661 E: function(date, token, localize2) { 43662 const dayOfWeek = date.getDay(); 43663 switch (token) { 43664 // Tue 43665 case "E": 43666 case "EE": 43667 case "EEE": 43668 return localize2.day(dayOfWeek, { 43669 width: "abbreviated", 43670 context: "formatting" 43671 }); 43672 // T 43673 case "EEEEE": 43674 return localize2.day(dayOfWeek, { 43675 width: "narrow", 43676 context: "formatting" 43677 }); 43678 // Tu 43679 case "EEEEEE": 43680 return localize2.day(dayOfWeek, { 43681 width: "short", 43682 context: "formatting" 43683 }); 43684 // Tuesday 43685 case "EEEE": 43686 default: 43687 return localize2.day(dayOfWeek, { 43688 width: "wide", 43689 context: "formatting" 43690 }); 43691 } 43692 }, 43693 // Local day of week 43694 e: function(date, token, localize2, options) { 43695 const dayOfWeek = date.getDay(); 43696 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 43697 switch (token) { 43698 // Numerical value (Nth day of week with current locale or weekStartsOn) 43699 case "e": 43700 return String(localDayOfWeek); 43701 // Padded numerical value 43702 case "ee": 43703 return addLeadingZeros(localDayOfWeek, 2); 43704 // 1st, 2nd, ..., 7th 43705 case "eo": 43706 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); 43707 case "eee": 43708 return localize2.day(dayOfWeek, { 43709 width: "abbreviated", 43710 context: "formatting" 43711 }); 43712 // T 43713 case "eeeee": 43714 return localize2.day(dayOfWeek, { 43715 width: "narrow", 43716 context: "formatting" 43717 }); 43718 // Tu 43719 case "eeeeee": 43720 return localize2.day(dayOfWeek, { 43721 width: "short", 43722 context: "formatting" 43723 }); 43724 // Tuesday 43725 case "eeee": 43726 default: 43727 return localize2.day(dayOfWeek, { 43728 width: "wide", 43729 context: "formatting" 43730 }); 43731 } 43732 }, 43733 // Stand-alone local day of week 43734 c: function(date, token, localize2, options) { 43735 const dayOfWeek = date.getDay(); 43736 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 43737 switch (token) { 43738 // Numerical value (same as in `e`) 43739 case "c": 43740 return String(localDayOfWeek); 43741 // Padded numerical value 43742 case "cc": 43743 return addLeadingZeros(localDayOfWeek, token.length); 43744 // 1st, 2nd, ..., 7th 43745 case "co": 43746 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); 43747 case "ccc": 43748 return localize2.day(dayOfWeek, { 43749 width: "abbreviated", 43750 context: "standalone" 43751 }); 43752 // T 43753 case "ccccc": 43754 return localize2.day(dayOfWeek, { 43755 width: "narrow", 43756 context: "standalone" 43757 }); 43758 // Tu 43759 case "cccccc": 43760 return localize2.day(dayOfWeek, { 43761 width: "short", 43762 context: "standalone" 43763 }); 43764 // Tuesday 43765 case "cccc": 43766 default: 43767 return localize2.day(dayOfWeek, { 43768 width: "wide", 43769 context: "standalone" 43770 }); 43771 } 43772 }, 43773 // ISO day of week 43774 i: function(date, token, localize2) { 43775 const dayOfWeek = date.getDay(); 43776 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; 43777 switch (token) { 43778 // 2 43779 case "i": 43780 return String(isoDayOfWeek); 43781 // 02 43782 case "ii": 43783 return addLeadingZeros(isoDayOfWeek, token.length); 43784 // 2nd 43785 case "io": 43786 return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" }); 43787 // Tue 43788 case "iii": 43789 return localize2.day(dayOfWeek, { 43790 width: "abbreviated", 43791 context: "formatting" 43792 }); 43793 // T 43794 case "iiiii": 43795 return localize2.day(dayOfWeek, { 43796 width: "narrow", 43797 context: "formatting" 43798 }); 43799 // Tu 43800 case "iiiiii": 43801 return localize2.day(dayOfWeek, { 43802 width: "short", 43803 context: "formatting" 43804 }); 43805 // Tuesday 43806 case "iiii": 43807 default: 43808 return localize2.day(dayOfWeek, { 43809 width: "wide", 43810 context: "formatting" 43811 }); 43812 } 43813 }, 43814 // AM or PM 43815 a: function(date, token, localize2) { 43816 const hours = date.getHours(); 43817 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 43818 switch (token) { 43819 case "a": 43820 case "aa": 43821 return localize2.dayPeriod(dayPeriodEnumValue, { 43822 width: "abbreviated", 43823 context: "formatting" 43824 }); 43825 case "aaa": 43826 return localize2.dayPeriod(dayPeriodEnumValue, { 43827 width: "abbreviated", 43828 context: "formatting" 43829 }).toLowerCase(); 43830 case "aaaaa": 43831 return localize2.dayPeriod(dayPeriodEnumValue, { 43832 width: "narrow", 43833 context: "formatting" 43834 }); 43835 case "aaaa": 43836 default: 43837 return localize2.dayPeriod(dayPeriodEnumValue, { 43838 width: "wide", 43839 context: "formatting" 43840 }); 43841 } 43842 }, 43843 // AM, PM, midnight, noon 43844 b: function(date, token, localize2) { 43845 const hours = date.getHours(); 43846 let dayPeriodEnumValue; 43847 if (hours === 12) { 43848 dayPeriodEnumValue = dayPeriodEnum.noon; 43849 } else if (hours === 0) { 43850 dayPeriodEnumValue = dayPeriodEnum.midnight; 43851 } else { 43852 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 43853 } 43854 switch (token) { 43855 case "b": 43856 case "bb": 43857 return localize2.dayPeriod(dayPeriodEnumValue, { 43858 width: "abbreviated", 43859 context: "formatting" 43860 }); 43861 case "bbb": 43862 return localize2.dayPeriod(dayPeriodEnumValue, { 43863 width: "abbreviated", 43864 context: "formatting" 43865 }).toLowerCase(); 43866 case "bbbbb": 43867 return localize2.dayPeriod(dayPeriodEnumValue, { 43868 width: "narrow", 43869 context: "formatting" 43870 }); 43871 case "bbbb": 43872 default: 43873 return localize2.dayPeriod(dayPeriodEnumValue, { 43874 width: "wide", 43875 context: "formatting" 43876 }); 43877 } 43878 }, 43879 // in the morning, in the afternoon, in the evening, at night 43880 B: function(date, token, localize2) { 43881 const hours = date.getHours(); 43882 let dayPeriodEnumValue; 43883 if (hours >= 17) { 43884 dayPeriodEnumValue = dayPeriodEnum.evening; 43885 } else if (hours >= 12) { 43886 dayPeriodEnumValue = dayPeriodEnum.afternoon; 43887 } else if (hours >= 4) { 43888 dayPeriodEnumValue = dayPeriodEnum.morning; 43889 } else { 43890 dayPeriodEnumValue = dayPeriodEnum.night; 43891 } 43892 switch (token) { 43893 case "B": 43894 case "BB": 43895 case "BBB": 43896 return localize2.dayPeriod(dayPeriodEnumValue, { 43897 width: "abbreviated", 43898 context: "formatting" 43899 }); 43900 case "BBBBB": 43901 return localize2.dayPeriod(dayPeriodEnumValue, { 43902 width: "narrow", 43903 context: "formatting" 43904 }); 43905 case "BBBB": 43906 default: 43907 return localize2.dayPeriod(dayPeriodEnumValue, { 43908 width: "wide", 43909 context: "formatting" 43910 }); 43911 } 43912 }, 43913 // Hour [1-12] 43914 h: function(date, token, localize2) { 43915 if (token === "ho") { 43916 let hours = date.getHours() % 12; 43917 if (hours === 0) hours = 12; 43918 return localize2.ordinalNumber(hours, { unit: "hour" }); 43919 } 43920 return lightFormatters.h(date, token); 43921 }, 43922 // Hour [0-23] 43923 H: function(date, token, localize2) { 43924 if (token === "Ho") { 43925 return localize2.ordinalNumber(date.getHours(), { unit: "hour" }); 43926 } 43927 return lightFormatters.H(date, token); 43928 }, 43929 // Hour [0-11] 43930 K: function(date, token, localize2) { 43931 const hours = date.getHours() % 12; 43932 if (token === "Ko") { 43933 return localize2.ordinalNumber(hours, { unit: "hour" }); 43934 } 43935 return addLeadingZeros(hours, token.length); 43936 }, 43937 // Hour [1-24] 43938 k: function(date, token, localize2) { 43939 let hours = date.getHours(); 43940 if (hours === 0) hours = 24; 43941 if (token === "ko") { 43942 return localize2.ordinalNumber(hours, { unit: "hour" }); 43943 } 43944 return addLeadingZeros(hours, token.length); 43945 }, 43946 // Minute 43947 m: function(date, token, localize2) { 43948 if (token === "mo") { 43949 return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" }); 43950 } 43951 return lightFormatters.m(date, token); 43952 }, 43953 // Second 43954 s: function(date, token, localize2) { 43955 if (token === "so") { 43956 return localize2.ordinalNumber(date.getSeconds(), { unit: "second" }); 43957 } 43958 return lightFormatters.s(date, token); 43959 }, 43960 // Fraction of second 43961 S: function(date, token) { 43962 return lightFormatters.S(date, token); 43963 }, 43964 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) 43965 X: function(date, token, _localize) { 43966 const timezoneOffset = date.getTimezoneOffset(); 43967 if (timezoneOffset === 0) { 43968 return "Z"; 43969 } 43970 switch (token) { 43971 // Hours and optional minutes 43972 case "X": 43973 return formatTimezoneWithOptionalMinutes(timezoneOffset); 43974 // Hours, minutes and optional seconds without `:` delimiter 43975 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 43976 // so this token always has the same output as `XX` 43977 case "XXXX": 43978 case "XX": 43979 return formatTimezone(timezoneOffset); 43980 // Hours, minutes and optional seconds with `:` delimiter 43981 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 43982 // so this token always has the same output as `XXX` 43983 case "XXXXX": 43984 case "XXX": 43985 // Hours and minutes with `:` delimiter 43986 default: 43987 return formatTimezone(timezoneOffset, ":"); 43988 } 43989 }, 43990 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) 43991 x: function(date, token, _localize) { 43992 const timezoneOffset = date.getTimezoneOffset(); 43993 switch (token) { 43994 // Hours and optional minutes 43995 case "x": 43996 return formatTimezoneWithOptionalMinutes(timezoneOffset); 43997 // Hours, minutes and optional seconds without `:` delimiter 43998 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 43999 // so this token always has the same output as `xx` 44000 case "xxxx": 44001 case "xx": 44002 return formatTimezone(timezoneOffset); 44003 // Hours, minutes and optional seconds with `:` delimiter 44004 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 44005 // so this token always has the same output as `xxx` 44006 case "xxxxx": 44007 case "xxx": 44008 // Hours and minutes with `:` delimiter 44009 default: 44010 return formatTimezone(timezoneOffset, ":"); 44011 } 44012 }, 44013 // Timezone (GMT) 44014 O: function(date, token, _localize) { 44015 const timezoneOffset = date.getTimezoneOffset(); 44016 switch (token) { 44017 // Short 44018 case "O": 44019 case "OO": 44020 case "OOO": 44021 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 44022 // Long 44023 case "OOOO": 44024 default: 44025 return "GMT" + formatTimezone(timezoneOffset, ":"); 44026 } 44027 }, 44028 // Timezone (specific non-location) 44029 z: function(date, token, _localize) { 44030 const timezoneOffset = date.getTimezoneOffset(); 44031 switch (token) { 44032 // Short 44033 case "z": 44034 case "zz": 44035 case "zzz": 44036 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 44037 // Long 44038 case "zzzz": 44039 default: 44040 return "GMT" + formatTimezone(timezoneOffset, ":"); 44041 } 44042 }, 44043 // Seconds timestamp 44044 t: function(date, token, _localize) { 44045 const timestamp = Math.trunc(+date / 1e3); 44046 return addLeadingZeros(timestamp, token.length); 44047 }, 44048 // Milliseconds timestamp 44049 T: function(date, token, _localize) { 44050 return addLeadingZeros(+date, token.length); 44051 } 44052 }; 44053 function formatTimezoneShort(offset4, delimiter = "") { 44054 const sign = offset4 > 0 ? "-" : "+"; 44055 const absOffset = Math.abs(offset4); 44056 const hours = Math.trunc(absOffset / 60); 44057 const minutes = absOffset % 60; 44058 if (minutes === 0) { 44059 return sign + String(hours); 44060 } 44061 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); 44062 } 44063 function formatTimezoneWithOptionalMinutes(offset4, delimiter) { 44064 if (offset4 % 60 === 0) { 44065 const sign = offset4 > 0 ? "-" : "+"; 44066 return sign + addLeadingZeros(Math.abs(offset4) / 60, 2); 44067 } 44068 return formatTimezone(offset4, delimiter); 44069 } 44070 function formatTimezone(offset4, delimiter = "") { 44071 const sign = offset4 > 0 ? "-" : "+"; 44072 const absOffset = Math.abs(offset4); 44073 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2); 44074 const minutes = addLeadingZeros(absOffset % 60, 2); 44075 return sign + hours + delimiter + minutes; 44076 } 44077 44078 // node_modules/date-fns/_lib/format/longFormatters.js 44079 var dateLongFormatter = (pattern, formatLong2) => { 44080 switch (pattern) { 44081 case "P": 44082 return formatLong2.date({ width: "short" }); 44083 case "PP": 44084 return formatLong2.date({ width: "medium" }); 44085 case "PPP": 44086 return formatLong2.date({ width: "long" }); 44087 case "PPPP": 44088 default: 44089 return formatLong2.date({ width: "full" }); 44090 } 44091 }; 44092 var timeLongFormatter = (pattern, formatLong2) => { 44093 switch (pattern) { 44094 case "p": 44095 return formatLong2.time({ width: "short" }); 44096 case "pp": 44097 return formatLong2.time({ width: "medium" }); 44098 case "ppp": 44099 return formatLong2.time({ width: "long" }); 44100 case "pppp": 44101 default: 44102 return formatLong2.time({ width: "full" }); 44103 } 44104 }; 44105 var dateTimeLongFormatter = (pattern, formatLong2) => { 44106 const matchResult = pattern.match(/(P+)(p+)?/) || []; 44107 const datePattern = matchResult[1]; 44108 const timePattern = matchResult[2]; 44109 if (!timePattern) { 44110 return dateLongFormatter(pattern, formatLong2); 44111 } 44112 let dateTimeFormat; 44113 switch (datePattern) { 44114 case "P": 44115 dateTimeFormat = formatLong2.dateTime({ width: "short" }); 44116 break; 44117 case "PP": 44118 dateTimeFormat = formatLong2.dateTime({ width: "medium" }); 44119 break; 44120 case "PPP": 44121 dateTimeFormat = formatLong2.dateTime({ width: "long" }); 44122 break; 44123 case "PPPP": 44124 default: 44125 dateTimeFormat = formatLong2.dateTime({ width: "full" }); 44126 break; 44127 } 44128 return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2)); 44129 }; 44130 var longFormatters = { 44131 p: timeLongFormatter, 44132 P: dateTimeLongFormatter 44133 }; 44134 44135 // node_modules/date-fns/_lib/protectedTokens.js 44136 var dayOfYearTokenRE = /^D+$/; 44137 var weekYearTokenRE = /^Y+$/; 44138 var throwTokens = ["D", "DD", "YY", "YYYY"]; 44139 function isProtectedDayOfYearToken(token) { 44140 return dayOfYearTokenRE.test(token); 44141 } 44142 function isProtectedWeekYearToken(token) { 44143 return weekYearTokenRE.test(token); 44144 } 44145 function warnOrThrowProtectedError(token, format6, input) { 44146 const _message = message(token, format6, input); 44147 console.warn(_message); 44148 if (throwTokens.includes(token)) throw new RangeError(_message); 44149 } 44150 function message(token, format6, input) { 44151 const subject = token[0] === "Y" ? "years" : "days of the month"; 44152 return `Use \`$token.toLowerCase()}\` instead of \`$token}\` (in \`$format6}\`) for formatting $subject} to the input \`$input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; 44153 } 44154 44155 // node_modules/date-fns/format.js 44156 var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; 44157 var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; 44158 var escapedStringRegExp = /^'([^]*?)'?$/; 44159 var doubleQuoteRegExp = /''/g; 44160 var unescapedLatinCharacterRegExp = /[a-zA-Z]/; 44161 function format(date, formatStr, options) { 44162 const defaultOptions2 = getDefaultOptions(); 44163 const locale = options?.locale ?? defaultOptions2.locale ?? enUS; 44164 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 44165 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 44166 const originalDate = toDate(date, options?.in); 44167 if (!isValid(originalDate)) { 44168 throw new RangeError("Invalid time value"); 44169 } 44170 let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => { 44171 const firstCharacter = substring[0]; 44172 if (firstCharacter === "p" || firstCharacter === "P") { 44173 const longFormatter = longFormatters[firstCharacter]; 44174 return longFormatter(substring, locale.formatLong); 44175 } 44176 return substring; 44177 }).join("").match(formattingTokensRegExp).map((substring) => { 44178 if (substring === "''") { 44179 return { isToken: false, value: "'" }; 44180 } 44181 const firstCharacter = substring[0]; 44182 if (firstCharacter === "'") { 44183 return { isToken: false, value: cleanEscapedString(substring) }; 44184 } 44185 if (formatters[firstCharacter]) { 44186 return { isToken: true, value: substring }; 44187 } 44188 if (firstCharacter.match(unescapedLatinCharacterRegExp)) { 44189 throw new RangeError( 44190 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" 44191 ); 44192 } 44193 return { isToken: false, value: substring }; 44194 }); 44195 if (locale.localize.preprocessor) { 44196 parts = locale.localize.preprocessor(originalDate, parts); 44197 } 44198 const formatterOptions = { 44199 firstWeekContainsDate, 44200 weekStartsOn, 44201 locale 44202 }; 44203 return parts.map((part) => { 44204 if (!part.isToken) return part.value; 44205 const token = part.value; 44206 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) { 44207 warnOrThrowProtectedError(token, formatStr, String(date)); 44208 } 44209 const formatter = formatters[token[0]]; 44210 return formatter(originalDate, token, locale.localize, formatterOptions); 44211 }).join(""); 44212 } 44213 function cleanEscapedString(input) { 44214 const matched = input.match(escapedStringRegExp); 44215 if (!matched) { 44216 return input; 44217 } 44218 return matched[1].replace(doubleQuoteRegExp, "'"); 44219 } 44220 44221 // node_modules/date-fns/subDays.js 44222 function subDays(date, amount, options) { 44223 return addDays(date, -amount, options); 44224 } 44225 44226 // node_modules/date-fns/subMonths.js 44227 function subMonths(date, amount, options) { 44228 return addMonths(date, -amount, options); 44229 } 44230 44231 // node_modules/date-fns/subWeeks.js 44232 function subWeeks(date, amount, options) { 44233 return addWeeks(date, -amount, options); 44234 } 44235 44236 // node_modules/date-fns/subYears.js 44237 function subYears(date, amount, options) { 44238 return addYears(date, -amount, options); 44239 } 44240 44241 // packages/dataviews/build-module/utils/operators.mjs 44242 var import_i18n96 = __toESM(require_i18n(), 1); 44243 var import_element115 = __toESM(require_element(), 1); 44244 var import_date2 = __toESM(require_date(), 1); 44245 var import_jsx_runtime235 = __toESM(require_jsx_runtime(), 1); 44246 var filterTextWrappers = { 44247 Name: /* @__PURE__ */ (0, import_jsx_runtime235.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }), 44248 Value: /* @__PURE__ */ (0, import_jsx_runtime235.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" }) 44249 }; 44250 function getRelativeDate(value, unit) { 44251 switch (unit) { 44252 case "days": 44253 return subDays(/* @__PURE__ */ new Date(), value); 44254 case "weeks": 44255 return subWeeks(/* @__PURE__ */ new Date(), value); 44256 case "months": 44257 return subMonths(/* @__PURE__ */ new Date(), value); 44258 case "years": 44259 return subYears(/* @__PURE__ */ new Date(), value); 44260 default: 44261 return /* @__PURE__ */ new Date(); 44262 } 44263 } 44264 var isNoneOperatorDefinition = { 44265 /* translators: DataViews operator name */ 44266 label: (0, import_i18n96.__)("Is none of"), 44267 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44268 (0, import_i18n96.sprintf)( 44269 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */ 44270 (0, import_i18n96.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"), 44271 filter.name, 44272 activeElements.map((element) => element.label).join(", ") 44273 ), 44274 filterTextWrappers 44275 ), 44276 filter: ((item, field, filterValue) => { 44277 if (!filterValue?.length) { 44278 return true; 44279 } 44280 const fieldValue = field.getValue({ item }); 44281 if (Array.isArray(fieldValue)) { 44282 return !filterValue.some( 44283 (fv) => fieldValue.includes(fv) 44284 ); 44285 } else if (typeof fieldValue === "string") { 44286 return !filterValue.includes(fieldValue); 44287 } 44288 return false; 44289 }), 44290 selection: "multi" 44291 }; 44292 var OPERATORS = [ 44293 { 44294 name: OPERATOR_IS_ANY2, 44295 /* translators: DataViews operator name */ 44296 label: (0, import_i18n96.__)("Includes"), 44297 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44298 (0, import_i18n96.sprintf)( 44299 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */ 44300 (0, import_i18n96.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"), 44301 filter.name, 44302 activeElements.map((element) => element.label).join(", ") 44303 ), 44304 filterTextWrappers 44305 ), 44306 filter(item, field, filterValue) { 44307 if (!filterValue?.length) { 44308 return true; 44309 } 44310 const fieldValue = field.getValue({ item }); 44311 if (Array.isArray(fieldValue)) { 44312 return filterValue.some( 44313 (fv) => fieldValue.includes(fv) 44314 ); 44315 } else if (typeof fieldValue === "string") { 44316 return filterValue.includes(fieldValue); 44317 } 44318 return false; 44319 }, 44320 selection: "multi" 44321 }, 44322 { 44323 name: OPERATOR_IS_NONE2, 44324 ...isNoneOperatorDefinition 44325 }, 44326 { 44327 name: OPERATOR_IS_ALL, 44328 /* translators: DataViews operator name */ 44329 label: (0, import_i18n96.__)("Includes all"), 44330 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44331 (0, import_i18n96.sprintf)( 44332 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */ 44333 (0, import_i18n96.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"), 44334 filter.name, 44335 activeElements.map((element) => element.label).join(", ") 44336 ), 44337 filterTextWrappers 44338 ), 44339 filter(item, field, filterValue) { 44340 if (!filterValue?.length) { 44341 return true; 44342 } 44343 return filterValue.every((value) => { 44344 return field.getValue({ item })?.includes(value); 44345 }); 44346 }, 44347 selection: "multi" 44348 }, 44349 { 44350 name: OPERATOR_IS_NOT_ALL, 44351 ...isNoneOperatorDefinition 44352 }, 44353 { 44354 name: OPERATOR_BETWEEN, 44355 /* translators: DataViews operator name */ 44356 label: (0, import_i18n96.__)("Between (inc)"), 44357 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44358 (0, import_i18n96.sprintf)( 44359 /* translators: 1: Filter name (e.g. "Item count"). 2: Filter value min. 3: Filter value max. e.g.: "Item count between (inc): 10 and 180". */ 44360 (0, import_i18n96.__)( 44361 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>" 44362 ), 44363 filter.name, 44364 activeElements[0].label[0], 44365 activeElements[0].label[1] 44366 ), 44367 filterTextWrappers 44368 ), 44369 filter(item, field, filterValue) { 44370 if (!Array.isArray(filterValue) || filterValue.length !== 2 || filterValue[0] === void 0 || filterValue[1] === void 0) { 44371 return true; 44372 } 44373 const fieldValue = field.getValue({ item }); 44374 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") { 44375 return fieldValue >= filterValue[0] && fieldValue <= filterValue[1]; 44376 } 44377 return false; 44378 }, 44379 selection: "custom" 44380 }, 44381 { 44382 name: OPERATOR_IN_THE_PAST, 44383 /* translators: DataViews operator name */ 44384 label: (0, import_i18n96.__)("In the past"), 44385 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44386 (0, import_i18n96.sprintf)( 44387 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */ 44388 (0, import_i18n96.__)( 44389 "<Name>%1$s is in the past: </Name><Value>%2$s</Value>" 44390 ), 44391 filter.name, 44392 `$activeElements[0].value.value} $activeElements[0].value.unit}` 44393 ), 44394 filterTextWrappers 44395 ), 44396 filter(item, field, filterValue) { 44397 if (filterValue?.value === void 0 || filterValue?.unit === void 0) { 44398 return true; 44399 } 44400 const targetDate = getRelativeDate( 44401 filterValue.value, 44402 filterValue.unit 44403 ); 44404 const fieldValue = (0, import_date2.getDate)(field.getValue({ item })); 44405 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date(); 44406 }, 44407 selection: "custom" 44408 }, 44409 { 44410 name: OPERATOR_OVER, 44411 /* translators: DataViews operator name */ 44412 label: (0, import_i18n96.__)("Over"), 44413 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44414 (0, import_i18n96.sprintf)( 44415 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */ 44416 (0, import_i18n96.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"), 44417 filter.name, 44418 `$activeElements[0].value.value} $activeElements[0].value.unit}` 44419 ), 44420 filterTextWrappers 44421 ), 44422 filter(item, field, filterValue) { 44423 if (filterValue?.value === void 0 || filterValue?.unit === void 0) { 44424 return true; 44425 } 44426 const targetDate = getRelativeDate( 44427 filterValue.value, 44428 filterValue.unit 44429 ); 44430 const fieldValue = (0, import_date2.getDate)(field.getValue({ item })); 44431 return fieldValue < targetDate; 44432 }, 44433 selection: "custom" 44434 }, 44435 { 44436 name: OPERATOR_IS2, 44437 /* translators: DataViews operator name */ 44438 label: (0, import_i18n96.__)("Is"), 44439 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44440 (0, import_i18n96.sprintf)( 44441 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */ 44442 (0, import_i18n96.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 44443 filter.name, 44444 activeElements[0].label 44445 ), 44446 filterTextWrappers 44447 ), 44448 filter(item, field, filterValue) { 44449 return filterValue === field.getValue({ item }) || filterValue === void 0; 44450 }, 44451 selection: "single" 44452 }, 44453 { 44454 name: OPERATOR_IS_NOT, 44455 /* translators: DataViews operator name */ 44456 label: (0, import_i18n96.__)("Is not"), 44457 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44458 (0, import_i18n96.sprintf)( 44459 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */ 44460 (0, import_i18n96.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 44461 filter.name, 44462 activeElements[0].label 44463 ), 44464 filterTextWrappers 44465 ), 44466 filter(item, field, filterValue) { 44467 return filterValue !== field.getValue({ item }); 44468 }, 44469 selection: "single" 44470 }, 44471 { 44472 name: OPERATOR_LESS_THAN, 44473 /* translators: DataViews operator name */ 44474 label: (0, import_i18n96.__)("Less than"), 44475 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44476 (0, import_i18n96.sprintf)( 44477 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */ 44478 (0, import_i18n96.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"), 44479 filter.name, 44480 activeElements[0].label 44481 ), 44482 filterTextWrappers 44483 ), 44484 filter(item, field, filterValue) { 44485 if (filterValue === void 0) { 44486 return true; 44487 } 44488 const fieldValue = field.getValue({ item }); 44489 return fieldValue < filterValue; 44490 }, 44491 selection: "single" 44492 }, 44493 { 44494 name: OPERATOR_GREATER_THAN, 44495 /* translators: DataViews operator name */ 44496 label: (0, import_i18n96.__)("Greater than"), 44497 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44498 (0, import_i18n96.sprintf)( 44499 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */ 44500 (0, import_i18n96.__)( 44501 "<Name>%1$s is greater than: </Name><Value>%2$s</Value>" 44502 ), 44503 filter.name, 44504 activeElements[0].label 44505 ), 44506 filterTextWrappers 44507 ), 44508 filter(item, field, filterValue) { 44509 if (filterValue === void 0) { 44510 return true; 44511 } 44512 const fieldValue = field.getValue({ item }); 44513 return fieldValue > filterValue; 44514 }, 44515 selection: "single" 44516 }, 44517 { 44518 name: OPERATOR_LESS_THAN_OR_EQUAL, 44519 /* translators: DataViews operator name */ 44520 label: (0, import_i18n96.__)("Less than or equal"), 44521 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44522 (0, import_i18n96.sprintf)( 44523 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */ 44524 (0, import_i18n96.__)( 44525 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>" 44526 ), 44527 filter.name, 44528 activeElements[0].label 44529 ), 44530 filterTextWrappers 44531 ), 44532 filter(item, field, filterValue) { 44533 if (filterValue === void 0) { 44534 return true; 44535 } 44536 const fieldValue = field.getValue({ item }); 44537 return fieldValue <= filterValue; 44538 }, 44539 selection: "single" 44540 }, 44541 { 44542 name: OPERATOR_GREATER_THAN_OR_EQUAL, 44543 /* translators: DataViews operator name */ 44544 label: (0, import_i18n96.__)("Greater than or equal"), 44545 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44546 (0, import_i18n96.sprintf)( 44547 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */ 44548 (0, import_i18n96.__)( 44549 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>" 44550 ), 44551 filter.name, 44552 activeElements[0].label 44553 ), 44554 filterTextWrappers 44555 ), 44556 filter(item, field, filterValue) { 44557 if (filterValue === void 0) { 44558 return true; 44559 } 44560 const fieldValue = field.getValue({ item }); 44561 return fieldValue >= filterValue; 44562 }, 44563 selection: "single" 44564 }, 44565 { 44566 name: OPERATOR_BEFORE2, 44567 /* translators: DataViews operator name */ 44568 label: (0, import_i18n96.__)("Before"), 44569 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44570 (0, import_i18n96.sprintf)( 44571 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */ 44572 (0, import_i18n96.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"), 44573 filter.name, 44574 activeElements[0].label 44575 ), 44576 filterTextWrappers 44577 ), 44578 filter(item, field, filterValue) { 44579 if (filterValue === void 0) { 44580 return true; 44581 } 44582 const filterDate = (0, import_date2.getDate)(filterValue); 44583 const fieldDate = (0, import_date2.getDate)(field.getValue({ item })); 44584 return fieldDate < filterDate; 44585 }, 44586 selection: "single" 44587 }, 44588 { 44589 name: OPERATOR_AFTER2, 44590 /* translators: DataViews operator name */ 44591 label: (0, import_i18n96.__)("After"), 44592 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44593 (0, import_i18n96.sprintf)( 44594 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */ 44595 (0, import_i18n96.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"), 44596 filter.name, 44597 activeElements[0].label 44598 ), 44599 filterTextWrappers 44600 ), 44601 filter(item, field, filterValue) { 44602 if (filterValue === void 0) { 44603 return true; 44604 } 44605 const filterDate = (0, import_date2.getDate)(filterValue); 44606 const fieldDate = (0, import_date2.getDate)(field.getValue({ item })); 44607 return fieldDate > filterDate; 44608 }, 44609 selection: "single" 44610 }, 44611 { 44612 name: OPERATOR_BEFORE_INC, 44613 /* translators: DataViews operator name */ 44614 label: (0, import_i18n96.__)("Before (inc)"), 44615 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44616 (0, import_i18n96.sprintf)( 44617 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */ 44618 (0, import_i18n96.__)( 44619 "<Name>%1$s is on or before: </Name><Value>%2$s</Value>" 44620 ), 44621 filter.name, 44622 activeElements[0].label 44623 ), 44624 filterTextWrappers 44625 ), 44626 filter(item, field, filterValue) { 44627 if (filterValue === void 0) { 44628 return true; 44629 } 44630 const filterDate = (0, import_date2.getDate)(filterValue); 44631 const fieldDate = (0, import_date2.getDate)(field.getValue({ item })); 44632 return fieldDate <= filterDate; 44633 }, 44634 selection: "single" 44635 }, 44636 { 44637 name: OPERATOR_AFTER_INC, 44638 /* translators: DataViews operator name */ 44639 label: (0, import_i18n96.__)("After (inc)"), 44640 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44641 (0, import_i18n96.sprintf)( 44642 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */ 44643 (0, import_i18n96.__)( 44644 "<Name>%1$s is on or after: </Name><Value>%2$s</Value>" 44645 ), 44646 filter.name, 44647 activeElements[0].label 44648 ), 44649 filterTextWrappers 44650 ), 44651 filter(item, field, filterValue) { 44652 if (filterValue === void 0) { 44653 return true; 44654 } 44655 const filterDate = (0, import_date2.getDate)(filterValue); 44656 const fieldDate = (0, import_date2.getDate)(field.getValue({ item })); 44657 return fieldDate >= filterDate; 44658 }, 44659 selection: "single" 44660 }, 44661 { 44662 name: OPERATOR_CONTAINS, 44663 /* translators: DataViews operator name */ 44664 label: (0, import_i18n96.__)("Contains"), 44665 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44666 (0, import_i18n96.sprintf)( 44667 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */ 44668 (0, import_i18n96.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"), 44669 filter.name, 44670 activeElements[0].label 44671 ), 44672 filterTextWrappers 44673 ), 44674 filter(item, field, filterValue) { 44675 if (filterValue === void 0) { 44676 return true; 44677 } 44678 const fieldValue = field.getValue({ item }); 44679 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); 44680 }, 44681 selection: "single" 44682 }, 44683 { 44684 name: OPERATOR_NOT_CONTAINS, 44685 /* translators: DataViews operator name */ 44686 label: (0, import_i18n96.__)("Doesn't contain"), 44687 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44688 (0, import_i18n96.sprintf)( 44689 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */ 44690 (0, import_i18n96.__)( 44691 "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>" 44692 ), 44693 filter.name, 44694 activeElements[0].label 44695 ), 44696 filterTextWrappers 44697 ), 44698 filter(item, field, filterValue) { 44699 if (filterValue === void 0) { 44700 return true; 44701 } 44702 const fieldValue = field.getValue({ item }); 44703 return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); 44704 }, 44705 selection: "single" 44706 }, 44707 { 44708 name: OPERATOR_STARTS_WITH, 44709 /* translators: DataViews operator name */ 44710 label: (0, import_i18n96.__)("Starts with"), 44711 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44712 (0, import_i18n96.sprintf)( 44713 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */ 44714 (0, import_i18n96.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"), 44715 filter.name, 44716 activeElements[0].label 44717 ), 44718 filterTextWrappers 44719 ), 44720 filter(item, field, filterValue) { 44721 if (filterValue === void 0) { 44722 return true; 44723 } 44724 const fieldValue = field.getValue({ item }); 44725 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase()); 44726 }, 44727 selection: "single" 44728 }, 44729 { 44730 name: OPERATOR_ON, 44731 /* translators: DataViews operator name */ 44732 label: (0, import_i18n96.__)("On"), 44733 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44734 (0, import_i18n96.sprintf)( 44735 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */ 44736 (0, import_i18n96.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 44737 filter.name, 44738 activeElements[0].label 44739 ), 44740 filterTextWrappers 44741 ), 44742 filter(item, field, filterValue) { 44743 if (filterValue === void 0) { 44744 return true; 44745 } 44746 const filterDate = (0, import_date2.getDate)(filterValue); 44747 const fieldDate = (0, import_date2.getDate)(field.getValue({ item })); 44748 return filterDate.getTime() === fieldDate.getTime(); 44749 }, 44750 selection: "single" 44751 }, 44752 { 44753 name: OPERATOR_NOT_ON, 44754 /* translators: DataViews operator name */ 44755 label: (0, import_i18n96.__)("Not on"), 44756 filterText: (filter, activeElements) => (0, import_element115.createInterpolateElement)( 44757 (0, import_i18n96.sprintf)( 44758 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */ 44759 (0, import_i18n96.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 44760 filter.name, 44761 activeElements[0].label 44762 ), 44763 filterTextWrappers 44764 ), 44765 filter(item, field, filterValue) { 44766 if (filterValue === void 0) { 44767 return true; 44768 } 44769 const filterDate = (0, import_date2.getDate)(filterValue); 44770 const fieldDate = (0, import_date2.getDate)(field.getValue({ item })); 44771 return filterDate.getTime() !== fieldDate.getTime(); 44772 }, 44773 selection: "single" 44774 } 44775 ]; 44776 var getOperatorByName = (name2) => OPERATORS.find((op) => op.name === name2); 44777 var getAllOperatorNames = () => OPERATORS.map((op) => op.name); 44778 var isSingleSelectionOperator = (name2) => OPERATORS.filter((op) => op.selection === "single").some( 44779 (op) => op.name === name2 44780 ); 44781 var isRegisteredOperator = (name2) => OPERATORS.some((op) => op.name === name2); 44782 44783 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs 44784 var import_jsx_runtime236 = __toESM(require_jsx_runtime(), 1); 44785 var ENTER4 = "Enter"; 44786 var SPACE3 = " "; 44787 var FilterText = ({ 44788 activeElements, 44789 filterInView, 44790 filter 44791 }) => { 44792 if (activeElements === void 0 || activeElements.length === 0) { 44793 return filter.name; 44794 } 44795 const operator = getOperatorByName(filterInView?.operator); 44796 if (operator !== void 0) { 44797 return operator.filterText(filter, activeElements); 44798 } 44799 return (0, import_i18n97.sprintf)( 44800 /* translators: 1: Filter name e.g.: "Unknown status for Author". */ 44801 (0, import_i18n97.__)("Unknown status for %1$s"), 44802 filter.name 44803 ); 44804 }; 44805 function OperatorSelector({ 44806 filter, 44807 view, 44808 onChangeView 44809 }) { 44810 const operatorOptions = filter.operators?.map((operator) => ({ 44811 value: operator, 44812 label: getOperatorByName(operator)?.label || operator 44813 })); 44814 const currentFilter = view.filters?.find( 44815 (_filter) => _filter.field === filter.field 44816 ); 44817 const value = currentFilter?.operator || filter.operators[0]; 44818 return operatorOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime236.jsxs)( 44819 Stack, 44820 { 44821 direction: "row", 44822 gap: "sm", 44823 justify: "flex-start", 44824 className: "dataviews-filters__summary-operators-container", 44825 align: "center", 44826 children: [ 44827 /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(import_components102.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }), 44828 /* @__PURE__ */ (0, import_jsx_runtime236.jsx)( 44829 import_components102.SelectControl, 44830 { 44831 className: "dataviews-filters__summary-operators-filter-select", 44832 label: (0, import_i18n97.__)("Conditions"), 44833 value, 44834 options: operatorOptions, 44835 onChange: (newValue) => { 44836 const newOperator = newValue; 44837 const currentOperator = currentFilter?.operator; 44838 const newFilters = currentFilter ? [ 44839 ...(view.filters ?? []).map( 44840 (_filter) => { 44841 if (_filter.field === filter.field) { 44842 const currentOpSelectionModel = getOperatorByName( 44843 currentOperator 44844 )?.selection; 44845 const newOpSelectionModel = getOperatorByName( 44846 newOperator 44847 )?.selection; 44848 const shouldResetValue = currentOpSelectionModel !== newOpSelectionModel || [ 44849 currentOpSelectionModel, 44850 newOpSelectionModel 44851 ].includes("custom"); 44852 return { 44853 ..._filter, 44854 value: shouldResetValue ? void 0 : _filter.value, 44855 operator: newOperator 44856 }; 44857 } 44858 return _filter; 44859 } 44860 ) 44861 ] : [ 44862 ...view.filters ?? [], 44863 { 44864 field: filter.field, 44865 operator: newOperator, 44866 value: void 0 44867 } 44868 ]; 44869 onChangeView({ 44870 ...view, 44871 page: 1, 44872 filters: newFilters 44873 }); 44874 }, 44875 size: "small", 44876 variant: "minimal", 44877 hideLabelFromVision: true 44878 } 44879 ) 44880 ] 44881 } 44882 ); 44883 } 44884 function Filter({ 44885 addFilterRef, 44886 openedFilter, 44887 fields: fields2, 44888 ...commonProps 44889 }) { 44890 const toggleRef = (0, import_element116.useRef)(null); 44891 const { filter, view, onChangeView } = commonProps; 44892 const filterInView = view.filters?.find( 44893 (f2) => f2.field === filter.field 44894 ); 44895 let activeElements = []; 44896 const field = (0, import_element116.useMemo)(() => { 44897 const currentField = fields2.find((f2) => f2.id === filter.field); 44898 if (currentField) { 44899 return { 44900 ...currentField, 44901 // Configure getValue as if Item was a plain object. 44902 // See related input-widget.tsx 44903 getValue: ({ item }) => item[currentField.id] 44904 }; 44905 } 44906 return currentField; 44907 }, [fields2, filter.field]); 44908 const { elements: elements2 } = useElements({ 44909 elements: filter.elements, 44910 getElements: filter.getElements 44911 }); 44912 if (elements2.length > 0) { 44913 activeElements = elements2.filter((element) => { 44914 if (filter.singleSelection) { 44915 return element.value === filterInView?.value; 44916 } 44917 return filterInView?.value?.includes(element.value); 44918 }); 44919 } else if (Array.isArray(filterInView?.value)) { 44920 const label = filterInView.value.map((v2) => { 44921 const formattedValue = field?.getValueFormatted({ 44922 item: { [field.id]: v2 }, 44923 field 44924 }); 44925 return formattedValue || String(v2); 44926 }); 44927 activeElements = [ 44928 { 44929 value: filterInView.value, 44930 // @ts-ignore 44931 label 44932 } 44933 ]; 44934 } else if (typeof filterInView?.value === "object") { 44935 activeElements = [ 44936 { value: filterInView.value, label: filterInView.value } 44937 ]; 44938 } else if (filterInView?.value !== void 0) { 44939 const label = field !== void 0 ? field.getValueFormatted({ 44940 item: { [field.id]: filterInView.value }, 44941 field 44942 }) : String(filterInView.value); 44943 activeElements = [ 44944 { 44945 value: filterInView.value, 44946 label 44947 } 44948 ]; 44949 } 44950 const isPrimary = filter.isPrimary; 44951 const isLocked = filterInView?.isLocked; 44952 const hasValues = !isLocked && filterInView?.value !== void 0; 44953 const canResetOrRemove = !isLocked && (!isPrimary || hasValues); 44954 const resetOrRemoveLabel = isPrimary ? (0, import_i18n97.__)("Reset") : (0, import_i18n97.__)("Remove"); 44955 return /* @__PURE__ */ (0, import_jsx_runtime236.jsx)( 44956 import_components102.Dropdown, 44957 { 44958 defaultOpen: openedFilter === filter.field, 44959 contentClassName: "dataviews-filters__summary-popover", 44960 popoverProps: { placement: "bottom-start", role: "dialog" }, 44961 onClose: () => { 44962 toggleRef.current?.focus(); 44963 }, 44964 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime236.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [ 44965 /* @__PURE__ */ (0, import_jsx_runtime236.jsxs)(tooltip_exports.Root, { children: [ 44966 /* @__PURE__ */ (0, import_jsx_runtime236.jsx)( 44967 tooltip_exports.Trigger, 44968 { 44969 render: /* @__PURE__ */ (0, import_jsx_runtime236.jsx)( 44970 "div", 44971 { 44972 className: clsx_default( 44973 "dataviews-filters__summary-chip", 44974 { 44975 "has-reset": canResetOrRemove, 44976 "has-values": hasValues, 44977 "is-not-clickable": isLocked 44978 } 44979 ), 44980 role: "button", 44981 tabIndex: isLocked ? -1 : 0, 44982 onClick: () => { 44983 if (!isLocked) { 44984 onToggle(); 44985 } 44986 }, 44987 onKeyDown: (event) => { 44988 if (!isLocked && [ENTER4, SPACE3].includes( 44989 event.key 44990 )) { 44991 onToggle(); 44992 event.preventDefault(); 44993 } 44994 }, 44995 "aria-disabled": isLocked, 44996 "aria-pressed": isOpen, 44997 "aria-expanded": isOpen, 44998 ref: toggleRef, 44999 children: /* @__PURE__ */ (0, import_jsx_runtime236.jsx)( 45000 FilterText, 45001 { 45002 activeElements, 45003 filterInView, 45004 filter 45005 } 45006 ) 45007 } 45008 ) 45009 } 45010 ), 45011 /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(tooltip_exports.Popup, { children: (0, import_i18n97.sprintf)( 45012 /* translators: 1: Filter name. */ 45013 (0, import_i18n97.__)("Filter by: %1$s"), 45014 filter.name.toLowerCase() 45015 ) }) 45016 ] }), 45017 canResetOrRemove && /* @__PURE__ */ (0, import_jsx_runtime236.jsxs)(tooltip_exports.Root, { children: [ 45018 /* @__PURE__ */ (0, import_jsx_runtime236.jsx)( 45019 tooltip_exports.Trigger, 45020 { 45021 render: /* @__PURE__ */ (0, import_jsx_runtime236.jsx)( 45022 "button", 45023 { 45024 className: clsx_default( 45025 "dataviews-filters__summary-chip-remove", 45026 { "has-values": hasValues } 45027 ), 45028 "aria-label": resetOrRemoveLabel, 45029 onClick: () => { 45030 onChangeView({ 45031 ...view, 45032 page: 1, 45033 filters: view.filters?.filter( 45034 (_filter) => _filter.field !== filter.field 45035 ) 45036 }); 45037 if (!isPrimary) { 45038 addFilterRef.current?.focus(); 45039 } else { 45040 toggleRef.current?.focus(); 45041 } 45042 }, 45043 children: /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(import_components102.Icon, { icon: close_small_default }) 45044 } 45045 ) 45046 } 45047 ), 45048 /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(tooltip_exports.Popup, { children: resetOrRemoveLabel }) 45049 ] }) 45050 ] }), 45051 renderContent: () => { 45052 return /* @__PURE__ */ (0, import_jsx_runtime236.jsxs)(Stack, { direction: "column", justify: "flex-start", children: [ 45053 /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(OperatorSelector, { ...commonProps }), 45054 commonProps.filter.hasElements ? /* @__PURE__ */ (0, import_jsx_runtime236.jsx)( 45055 SearchWidget, 45056 { 45057 ...commonProps, 45058 filter: { 45059 ...commonProps.filter, 45060 elements: elements2 45061 } 45062 } 45063 ) : /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(InputWidget, { ...commonProps, fields: fields2 }) 45064 ] }); 45065 } 45066 } 45067 ); 45068 } 45069 45070 // packages/dataviews/build-module/components/dataviews-filters/add-filter.mjs 45071 var import_components103 = __toESM(require_components(), 1); 45072 var import_i18n98 = __toESM(require_i18n(), 1); 45073 var import_element117 = __toESM(require_element(), 1); 45074 var import_jsx_runtime237 = __toESM(require_jsx_runtime(), 1); 45075 var { Menu: Menu8 } = unlock4(import_components103.privateApis); 45076 function AddFilterMenu({ 45077 filters, 45078 view, 45079 onChangeView, 45080 setOpenedFilter, 45081 triggerProps 45082 }) { 45083 const inactiveFilters = filters.filter((filter) => !filter.isVisible); 45084 return /* @__PURE__ */ (0, import_jsx_runtime237.jsxs)(Menu8, { children: [ 45085 /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(Menu8.TriggerButton, { ...triggerProps }), 45086 /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(Menu8.Popover, { children: inactiveFilters.map((filter) => { 45087 return /* @__PURE__ */ (0, import_jsx_runtime237.jsx)( 45088 Menu8.Item, 45089 { 45090 onClick: () => { 45091 setOpenedFilter(filter.field); 45092 onChangeView({ 45093 ...view, 45094 page: 1, 45095 filters: [ 45096 ...view.filters || [], 45097 { 45098 field: filter.field, 45099 value: void 0, 45100 operator: filter.operators[0] 45101 } 45102 ] 45103 }); 45104 }, 45105 children: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(Menu8.ItemLabel, { children: filter.name }) 45106 }, 45107 filter.field 45108 ); 45109 }) }) 45110 ] }); 45111 } 45112 function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) { 45113 if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) { 45114 return null; 45115 } 45116 const inactiveFilters = filters.filter((filter) => !filter.isVisible); 45117 return /* @__PURE__ */ (0, import_jsx_runtime237.jsx)( 45118 AddFilterMenu, 45119 { 45120 triggerProps: { 45121 render: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)( 45122 import_components103.Button, 45123 { 45124 accessibleWhenDisabled: true, 45125 size: "compact", 45126 className: "dataviews-filters-button", 45127 variant: "tertiary", 45128 disabled: !inactiveFilters.length, 45129 ref 45130 } 45131 ), 45132 children: (0, import_i18n98.__)("Add filter") 45133 }, 45134 ...{ filters, view, onChangeView, setOpenedFilter } 45135 } 45136 ); 45137 } 45138 var add_filter_default = (0, import_element117.forwardRef)(AddFilter); 45139 45140 // packages/dataviews/build-module/components/dataviews-filters/reset-filters.mjs 45141 var import_components104 = __toESM(require_components(), 1); 45142 var import_i18n99 = __toESM(require_i18n(), 1); 45143 var import_jsx_runtime238 = __toESM(require_jsx_runtime(), 1); 45144 function ResetFilter({ 45145 filters, 45146 view, 45147 onChangeView 45148 }) { 45149 const isPrimary = (field) => filters.some( 45150 (_filter) => _filter.field === field && _filter.isPrimary 45151 ); 45152 const isDisabled = !view.search && !view.filters?.some( 45153 (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field)) 45154 ); 45155 return /* @__PURE__ */ (0, import_jsx_runtime238.jsx)( 45156 import_components104.Button, 45157 { 45158 disabled: isDisabled, 45159 accessibleWhenDisabled: true, 45160 size: "compact", 45161 variant: "tertiary", 45162 className: "dataviews-filters__reset-button", 45163 onClick: () => { 45164 onChangeView({ 45165 ...view, 45166 page: 1, 45167 search: "", 45168 filters: view.filters?.filter((f2) => !!f2.isLocked) || [] 45169 }); 45170 }, 45171 children: (0, import_i18n99.__)("Reset") 45172 } 45173 ); 45174 } 45175 45176 // packages/dataviews/build-module/components/dataviews-filters/use-filters.mjs 45177 var import_element118 = __toESM(require_element(), 1); 45178 function useFilters(fields2, view) { 45179 return (0, import_element118.useMemo)(() => { 45180 const filters = []; 45181 fields2.forEach((field) => { 45182 if (field.filterBy === false || !field.hasElements && !field.Edit) { 45183 return; 45184 } 45185 const operators = field.filterBy.operators; 45186 const isPrimary = !!field.filterBy?.isPrimary; 45187 const isLocked = view.filters?.some( 45188 (f2) => f2.field === field.id && !!f2.isLocked 45189 ) ?? false; 45190 filters.push({ 45191 field: field.id, 45192 name: field.label, 45193 elements: field.elements, 45194 getElements: field.getElements, 45195 hasElements: field.hasElements, 45196 singleSelection: operators.some( 45197 (op) => isSingleSelectionOperator(op) 45198 ), 45199 operators, 45200 isVisible: isLocked || isPrimary || !!view.filters?.some( 45201 (f2) => f2.field === field.id && isRegisteredOperator(f2.operator) 45202 ), 45203 isPrimary, 45204 isLocked 45205 }); 45206 }); 45207 filters.sort((a2, b2) => { 45208 if (a2.isLocked && !b2.isLocked) { 45209 return -1; 45210 } 45211 if (!a2.isLocked && b2.isLocked) { 45212 return 1; 45213 } 45214 if (a2.isPrimary && !b2.isPrimary) { 45215 return -1; 45216 } 45217 if (!a2.isPrimary && b2.isPrimary) { 45218 return 1; 45219 } 45220 return a2.name.localeCompare(b2.name); 45221 }); 45222 return filters; 45223 }, [fields2, view]); 45224 } 45225 var use_filters_default = useFilters; 45226 45227 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs 45228 var import_jsx_runtime239 = __toESM(require_jsx_runtime(), 1); 45229 function Filters({ className }) { 45230 const { fields: fields2, view, onChangeView, openedFilter, setOpenedFilter } = (0, import_element119.useContext)(dataviews_context_default); 45231 const addFilterRef = (0, import_element119.useRef)(null); 45232 const filters = use_filters_default(fields2, view); 45233 const addFilter = /* @__PURE__ */ (0, import_jsx_runtime239.jsx)( 45234 add_filter_default, 45235 { 45236 filters, 45237 view, 45238 onChangeView, 45239 ref: addFilterRef, 45240 setOpenedFilter 45241 }, 45242 "add-filter" 45243 ); 45244 const visibleFilters = filters.filter((filter) => filter.isVisible); 45245 if (visibleFilters.length === 0) { 45246 return null; 45247 } 45248 const filterComponents = [ 45249 ...visibleFilters.map((filter) => { 45250 return /* @__PURE__ */ (0, import_jsx_runtime239.jsx)( 45251 Filter, 45252 { 45253 filter, 45254 view, 45255 fields: fields2, 45256 onChangeView, 45257 addFilterRef, 45258 openedFilter 45259 }, 45260 filter.field 45261 ); 45262 }), 45263 addFilter 45264 ]; 45265 filterComponents.push( 45266 /* @__PURE__ */ (0, import_jsx_runtime239.jsx)( 45267 ResetFilter, 45268 { 45269 filters, 45270 view, 45271 onChangeView 45272 }, 45273 "reset-filters" 45274 ) 45275 ); 45276 return /* @__PURE__ */ (0, import_jsx_runtime239.jsx)( 45277 Stack, 45278 { 45279 direction: "row", 45280 justify: "flex-start", 45281 gap: "sm", 45282 style: { width: "fit-content" }, 45283 wrap: "wrap", 45284 className, 45285 children: filterComponents 45286 } 45287 ); 45288 } 45289 var filters_default = (0, import_element119.memo)(Filters); 45290 45291 // packages/dataviews/build-module/components/dataviews-filters/toggle.mjs 45292 var import_element120 = __toESM(require_element(), 1); 45293 var import_components105 = __toESM(require_components(), 1); 45294 var import_i18n100 = __toESM(require_i18n(), 1); 45295 var import_jsx_runtime240 = __toESM(require_jsx_runtime(), 1); 45296 function FiltersToggle() { 45297 const { 45298 filters, 45299 view, 45300 onChangeView, 45301 setOpenedFilter, 45302 isShowingFilter, 45303 setIsShowingFilter 45304 } = (0, import_element120.useContext)(dataviews_context_default); 45305 const buttonRef = (0, import_element120.useRef)(null); 45306 const onChangeViewWithFilterVisibility = (0, import_element120.useCallback)( 45307 (_view) => { 45308 onChangeView(_view); 45309 setIsShowingFilter(true); 45310 }, 45311 [onChangeView, setIsShowingFilter] 45312 ); 45313 if (filters.length === 0) { 45314 return null; 45315 } 45316 const hasVisibleFilters = filters.some((filter) => filter.isVisible); 45317 const addFilterButtonProps = { 45318 label: (0, import_i18n100.__)("Add filter"), 45319 "aria-expanded": false, 45320 isPressed: false 45321 }; 45322 const toggleFiltersButtonProps = { 45323 label: (0, import_i18n100._x)("Filter", "verb"), 45324 "aria-expanded": isShowingFilter, 45325 isPressed: isShowingFilter, 45326 onClick: () => { 45327 if (!isShowingFilter) { 45328 setOpenedFilter(null); 45329 } 45330 setIsShowingFilter(!isShowingFilter); 45331 } 45332 }; 45333 const hasPrimaryOrLockedFilters = filters.some( 45334 (filter) => filter.isPrimary || filter.isLocked 45335 ); 45336 const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime240.jsx)( 45337 import_components105.Button, 45338 { 45339 ref: buttonRef, 45340 className: "dataviews-filters__visibility-toggle", 45341 size: "compact", 45342 icon: funnel_default, 45343 disabled: hasPrimaryOrLockedFilters, 45344 accessibleWhenDisabled: true, 45345 ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps 45346 } 45347 ); 45348 return /* @__PURE__ */ (0, import_jsx_runtime240.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0, import_jsx_runtime240.jsx)( 45349 AddFilterMenu, 45350 { 45351 filters, 45352 view, 45353 onChangeView: onChangeViewWithFilterVisibility, 45354 setOpenedFilter, 45355 triggerProps: { render: buttonComponent } 45356 } 45357 ) : /* @__PURE__ */ (0, import_jsx_runtime240.jsx)( 45358 FilterVisibilityToggle, 45359 { 45360 buttonRef, 45361 filtersCount: view.filters?.length, 45362 children: buttonComponent 45363 } 45364 ) }); 45365 } 45366 function FilterVisibilityToggle({ 45367 buttonRef, 45368 filtersCount, 45369 children 45370 }) { 45371 (0, import_element120.useEffect)( 45372 () => () => { 45373 buttonRef.current?.focus(); 45374 }, 45375 [buttonRef] 45376 ); 45377 return /* @__PURE__ */ (0, import_jsx_runtime240.jsxs)(import_jsx_runtime240.Fragment, { children: [ 45378 children, 45379 !!filtersCount && /* @__PURE__ */ (0, import_jsx_runtime240.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount }) 45380 ] }); 45381 } 45382 var toggle_default = FiltersToggle; 45383 45384 // packages/dataviews/build-module/components/dataviews-filters/filters-toggled.mjs 45385 var import_element121 = __toESM(require_element(), 1); 45386 var import_jsx_runtime241 = __toESM(require_jsx_runtime(), 1); 45387 function FiltersToggled(props) { 45388 const { isShowingFilter } = (0, import_element121.useContext)(dataviews_context_default); 45389 if (!isShowingFilter) { 45390 return null; 45391 } 45392 return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(filters_default, { ...props }); 45393 } 45394 var filters_toggled_default = FiltersToggled; 45395 45396 // packages/dataviews/build-module/components/dataviews-layout/index.mjs 45397 var import_element122 = __toESM(require_element(), 1); 45398 var import_components106 = __toESM(require_components(), 1); 45399 var import_i18n101 = __toESM(require_i18n(), 1); 45400 var import_jsx_runtime242 = __toESM(require_jsx_runtime(), 1); 45401 function DataViewsLayout({ className }) { 45402 const { 45403 actions = [], 45404 data, 45405 fields: fields2, 45406 getItemId: getItemId2, 45407 getItemLevel: getItemLevel2, 45408 hasInitiallyLoaded, 45409 isLoading, 45410 view, 45411 onChangeView, 45412 selection, 45413 onChangeSelection, 45414 setOpenedFilter, 45415 onClickItem, 45416 isItemClickable, 45417 renderItemLink, 45418 defaultLayouts: defaultLayouts2, 45419 containerRef, 45420 empty = /* @__PURE__ */ (0, import_jsx_runtime242.jsx)("p", { children: (0, import_i18n101.__)("No results") }) 45421 } = (0, import_element122.useContext)(dataviews_context_default); 45422 const isDelayedInitialLoading = useDelayedLoading(!hasInitiallyLoaded, { 45423 delay: 200 45424 }); 45425 if (!hasInitiallyLoaded) { 45426 if (!isDelayedInitialLoading) { 45427 return null; 45428 } 45429 return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)("div", { className: "dataviews-loading", children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(import_components106.Spinner, {}) }) }); 45430 } 45431 const ViewComponent = VIEW_LAYOUTS.find( 45432 (v2) => v2.type === view.type && defaultLayouts2[v2.type] 45433 )?.component; 45434 return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)("div", { className: "dataviews-layout__container", ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)( 45435 ViewComponent, 45436 { 45437 className, 45438 actions, 45439 data, 45440 fields: fields2, 45441 getItemId: getItemId2, 45442 getItemLevel: getItemLevel2, 45443 isLoading, 45444 onChangeView, 45445 onChangeSelection, 45446 selection, 45447 setOpenedFilter, 45448 onClickItem, 45449 renderItemLink, 45450 isItemClickable, 45451 view, 45452 empty 45453 } 45454 ) }); 45455 } 45456 45457 // packages/dataviews/build-module/components/dataviews-footer/index.mjs 45458 var import_element123 = __toESM(require_element(), 1); 45459 var import_jsx_runtime243 = __toESM(require_jsx_runtime(), 1); 45460 var EMPTY_ARRAY8 = []; 45461 function DataViewsFooter() { 45462 const { 45463 view, 45464 paginationInfo: { totalItems = 0, totalPages }, 45465 data, 45466 actions = EMPTY_ARRAY8, 45467 isLoading, 45468 hasInitiallyLoaded 45469 } = (0, import_element123.useContext)(dataviews_context_default); 45470 const isRefreshing = !!isLoading && hasInitiallyLoaded && !!data?.length; 45471 const isDelayedRefreshing = useDelayedLoading(!!isRefreshing); 45472 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [LAYOUT_TABLE, LAYOUT_GRID].includes(view.type); 45473 if (!isRefreshing && (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions)) { 45474 return null; 45475 } 45476 return (!!totalItems || isRefreshing) && /* @__PURE__ */ (0, import_jsx_runtime243.jsx)( 45477 "div", 45478 { 45479 className: "dataviews-footer", 45480 inert: isRefreshing ? "true" : void 0, 45481 children: /* @__PURE__ */ (0, import_jsx_runtime243.jsxs)( 45482 Stack, 45483 { 45484 direction: "row", 45485 justify: "end", 45486 align: "center", 45487 className: clsx_default("dataviews-footer__content", { 45488 "is-refreshing": isDelayedRefreshing 45489 }), 45490 gap: "sm", 45491 children: [ 45492 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(BulkActionsFooter, {}), 45493 /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(dataviews_pagination_default, {}) 45494 ] 45495 } 45496 ) 45497 } 45498 ); 45499 } 45500 45501 // packages/dataviews/build-module/components/dataviews-search/index.mjs 45502 var import_i18n102 = __toESM(require_i18n(), 1); 45503 var import_element124 = __toESM(require_element(), 1); 45504 var import_components107 = __toESM(require_components(), 1); 45505 var import_compose20 = __toESM(require_compose(), 1); 45506 var import_jsx_runtime244 = __toESM(require_jsx_runtime(), 1); 45507 var DataViewsSearch = (0, import_element124.memo)(function Search({ label }) { 45508 const { view, onChangeView } = (0, import_element124.useContext)(dataviews_context_default); 45509 const [search, setSearch, debouncedSearch] = (0, import_compose20.useDebouncedInput)( 45510 view.search 45511 ); 45512 (0, import_element124.useEffect)(() => { 45513 if (view.search !== debouncedSearch) { 45514 setSearch(view.search ?? ""); 45515 } 45516 }, [view.search, setSearch]); 45517 const onChangeViewRef = (0, import_element124.useRef)(onChangeView); 45518 const viewRef = (0, import_element124.useRef)(view); 45519 (0, import_element124.useEffect)(() => { 45520 onChangeViewRef.current = onChangeView; 45521 viewRef.current = view; 45522 }, [onChangeView, view]); 45523 (0, import_element124.useEffect)(() => { 45524 if (debouncedSearch !== viewRef.current?.search) { 45525 onChangeViewRef.current({ 45526 ...viewRef.current, 45527 page: view.page ? 1 : void 0, 45528 startPosition: view.startPosition ? 1 : void 0, 45529 search: debouncedSearch 45530 }); 45531 } 45532 }, [debouncedSearch]); 45533 const searchLabel = label || (0, import_i18n102.__)("Search"); 45534 return /* @__PURE__ */ (0, import_jsx_runtime244.jsx)( 45535 import_components107.SearchControl, 45536 { 45537 className: "dataviews-search", 45538 onChange: setSearch, 45539 value: search, 45540 label: searchLabel, 45541 placeholder: searchLabel, 45542 size: "compact" 45543 } 45544 ); 45545 }); 45546 var dataviews_search_default = DataViewsSearch; 45547 45548 // packages/dataviews/build-module/components/dataviews-view-config/index.mjs 45549 var import_components108 = __toESM(require_components(), 1); 45550 var import_i18n103 = __toESM(require_i18n(), 1); 45551 var import_element125 = __toESM(require_element(), 1); 45552 var import_warning = __toESM(require_warning(), 1); 45553 var import_compose21 = __toESM(require_compose(), 1); 45554 var import_jsx_runtime245 = __toESM(require_jsx_runtime(), 1); 45555 var { Menu: Menu9 } = unlock4(import_components108.privateApis); 45556 var DATAVIEWS_CONFIG_POPOVER_PROPS = { 45557 className: "dataviews-config__popover", 45558 placement: "bottom-end", 45559 offset: 9 45560 }; 45561 function ViewTypeMenu() { 45562 const { view, onChangeView, defaultLayouts: defaultLayouts2 } = (0, import_element125.useContext)(dataviews_context_default); 45563 const availableLayouts = Object.keys(defaultLayouts2); 45564 if (availableLayouts.length <= 1) { 45565 return null; 45566 } 45567 const activeView = VIEW_LAYOUTS.find((v2) => view.type === v2.type); 45568 return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(Menu9, { children: [ 45569 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45570 Menu9.TriggerButton, 45571 { 45572 render: /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45573 import_components108.Button, 45574 { 45575 size: "compact", 45576 icon: activeView?.icon, 45577 label: (0, import_i18n103.__)("Layout") 45578 } 45579 ) 45580 } 45581 ), 45582 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(Menu9.Popover, { children: availableLayouts.map((layout) => { 45583 const config2 = VIEW_LAYOUTS.find( 45584 (v2) => v2.type === layout 45585 ); 45586 if (!config2) { 45587 return null; 45588 } 45589 return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45590 Menu9.RadioItem, 45591 { 45592 value: layout, 45593 name: "view-actions-available-view", 45594 checked: layout === view.type, 45595 hideOnClick: true, 45596 onChange: (e2) => { 45597 switch (e2.target.value) { 45598 case "list": 45599 case "grid": 45600 case "table": 45601 case "pickerGrid": 45602 case "pickerTable": 45603 case "pickerActivity": 45604 case "activity": 45605 const viewWithoutLayout = { ...view }; 45606 if ("layout" in viewWithoutLayout) { 45607 delete viewWithoutLayout.layout; 45608 } 45609 return onChangeView({ 45610 ...viewWithoutLayout, 45611 type: e2.target.value, 45612 ...defaultLayouts2[e2.target.value] 45613 }); 45614 } 45615 (0, import_warning.default)("Invalid dataview"); 45616 }, 45617 children: /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(Menu9.ItemLabel, { children: config2.label }) 45618 }, 45619 layout 45620 ); 45621 }) }) 45622 ] }); 45623 } 45624 function SortFieldControl() { 45625 const { view, fields: fields2, onChangeView } = (0, import_element125.useContext)(dataviews_context_default); 45626 const orderOptions = (0, import_element125.useMemo)(() => { 45627 const sortableFields = fields2.filter( 45628 (field) => field.enableSorting !== false 45629 ); 45630 return sortableFields.map((field) => { 45631 return { 45632 label: field.label, 45633 value: field.id 45634 }; 45635 }); 45636 }, [fields2]); 45637 return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45638 import_components108.SelectControl, 45639 { 45640 __next40pxDefaultSize: true, 45641 label: (0, import_i18n103.__)("Sort by"), 45642 value: view.sort?.field, 45643 options: orderOptions, 45644 onChange: (value) => { 45645 onChangeView({ 45646 ...view, 45647 sort: { 45648 direction: view?.sort?.direction || "desc", 45649 field: value 45650 }, 45651 showLevels: false 45652 }); 45653 } 45654 } 45655 ); 45656 } 45657 function SortDirectionControl() { 45658 const { view, fields: fields2, onChangeView } = (0, import_element125.useContext)(dataviews_context_default); 45659 const sortableFields = fields2.filter( 45660 (field) => field.enableSorting !== false 45661 ); 45662 if (sortableFields.length === 0) { 45663 return null; 45664 } 45665 let value = view.sort?.direction; 45666 if (!value && view.sort?.field) { 45667 value = "desc"; 45668 } 45669 return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45670 import_components108.__experimentalToggleGroupControl, 45671 { 45672 className: "dataviews-view-config__sort-direction", 45673 __next40pxDefaultSize: true, 45674 isBlock: true, 45675 label: (0, import_i18n103.__)("Order"), 45676 value, 45677 onChange: (newDirection) => { 45678 if (newDirection === "asc" || newDirection === "desc") { 45679 onChangeView({ 45680 ...view, 45681 sort: { 45682 direction: newDirection, 45683 field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field. 45684 fields2.find( 45685 (field) => field.enableSorting !== false 45686 )?.id || "" 45687 }, 45688 showLevels: false 45689 }); 45690 return; 45691 } 45692 (0, import_warning.default)("Invalid direction"); 45693 }, 45694 children: SORTING_DIRECTIONS.map((direction) => { 45695 return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45696 import_components108.__experimentalToggleGroupControlOptionIcon, 45697 { 45698 value: direction, 45699 icon: sortIcons[direction], 45700 label: sortLabels[direction] 45701 }, 45702 direction 45703 ); 45704 }) 45705 } 45706 ); 45707 } 45708 function ItemsPerPageControl() { 45709 const { view, config: config2, onChangeView } = (0, import_element125.useContext)(dataviews_context_default); 45710 const { infiniteScrollEnabled } = view; 45711 if (!config2 || !config2.perPageSizes || config2.perPageSizes.length < 2 || config2.perPageSizes.length > 6 || infiniteScrollEnabled) { 45712 return null; 45713 } 45714 return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45715 import_components108.__experimentalToggleGroupControl, 45716 { 45717 __next40pxDefaultSize: true, 45718 isBlock: true, 45719 label: (0, import_i18n103.__)("Items per page"), 45720 value: view.perPage || 10, 45721 disabled: !view?.sort?.field, 45722 onChange: (newItemsPerPage) => { 45723 const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10); 45724 onChangeView({ 45725 ...view, 45726 perPage: newItemsPerPageNumber, 45727 page: 1 45728 }); 45729 }, 45730 children: config2.perPageSizes.map((value) => { 45731 return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45732 import_components108.__experimentalToggleGroupControlOption, 45733 { 45734 value, 45735 label: value.toString() 45736 }, 45737 value 45738 ); 45739 }) 45740 } 45741 ); 45742 } 45743 function ResetViewButton() { 45744 const { onReset } = (0, import_element125.useContext)(dataviews_context_default); 45745 if (onReset === void 0) { 45746 return null; 45747 } 45748 const isDisabled = onReset === false; 45749 return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45750 import_components108.Button, 45751 { 45752 variant: "tertiary", 45753 size: "compact", 45754 disabled: isDisabled, 45755 accessibleWhenDisabled: true, 45756 className: "dataviews-view-config__reset-button", 45757 onClick: () => { 45758 if (typeof onReset === "function") { 45759 onReset(); 45760 } 45761 }, 45762 children: (0, import_i18n103.__)("Reset view") 45763 } 45764 ); 45765 } 45766 function DataviewsViewConfigDropdown() { 45767 const { view, onReset } = (0, import_element125.useContext)(dataviews_context_default); 45768 const popoverId = (0, import_compose21.useInstanceId)( 45769 _DataViewsViewConfig, 45770 "dataviews-view-config-dropdown" 45771 ); 45772 const activeLayout = VIEW_LAYOUTS.find( 45773 (layout) => layout.type === view.type 45774 ); 45775 const isModified = typeof onReset === "function"; 45776 return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45777 import_components108.Dropdown, 45778 { 45779 expandOnMobile: true, 45780 popoverProps: { 45781 ...DATAVIEWS_CONFIG_POPOVER_PROPS, 45782 id: popoverId 45783 }, 45784 renderToggle: ({ onToggle, isOpen }) => { 45785 return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)("div", { className: "dataviews-view-config__toggle-wrapper", children: [ 45786 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45787 import_components108.Button, 45788 { 45789 size: "compact", 45790 icon: cog_default, 45791 label: (0, import_i18n103._x)( 45792 "View options", 45793 "View is used as a noun" 45794 ), 45795 onClick: onToggle, 45796 "aria-expanded": isOpen ? "true" : "false", 45797 "aria-controls": popoverId 45798 } 45799 ), 45800 isModified && /* @__PURE__ */ (0, import_jsx_runtime245.jsx)("span", { className: "dataviews-view-config__modified-indicator" }) 45801 ] }); 45802 }, 45803 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45804 import_components108.__experimentalDropdownContentWrapper, 45805 { 45806 paddingSize: "medium", 45807 className: "dataviews-config__popover-content-wrapper", 45808 children: /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)( 45809 Stack, 45810 { 45811 direction: "column", 45812 className: "dataviews-view-config", 45813 gap: "xl", 45814 children: [ 45815 /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)( 45816 Stack, 45817 { 45818 direction: "row", 45819 justify: "space-between", 45820 align: "center", 45821 className: "dataviews-view-config__header", 45822 children: [ 45823 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)( 45824 import_components108.__experimentalHeading, 45825 { 45826 level: 2, 45827 className: "dataviews-settings-section__title", 45828 children: (0, import_i18n103.__)("Appearance") 45829 } 45830 ), 45831 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ResetViewButton, {}) 45832 ] 45833 } 45834 ), 45835 /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 45836 /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)( 45837 Stack, 45838 { 45839 direction: "row", 45840 gap: "sm", 45841 className: "dataviews-view-config__sort-controls", 45842 children: [ 45843 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(SortFieldControl, {}), 45844 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(SortDirectionControl, {}) 45845 ] 45846 } 45847 ), 45848 !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(activeLayout.viewConfigOptions, {}), 45849 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ItemsPerPageControl, {}), 45850 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(PropertiesSection, {}) 45851 ] }) 45852 ] 45853 } 45854 ) 45855 } 45856 ) 45857 } 45858 ); 45859 } 45860 function _DataViewsViewConfig() { 45861 return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(import_jsx_runtime245.Fragment, { children: [ 45862 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ViewTypeMenu, {}), 45863 /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(DataviewsViewConfigDropdown, {}) 45864 ] }); 45865 } 45866 var DataViewsViewConfig = (0, import_element125.memo)(_DataViewsViewConfig); 45867 var dataviews_view_config_default = DataViewsViewConfig; 45868 45869 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs 45870 var import_components109 = __toESM(require_components(), 1); 45871 var import_element126 = __toESM(require_element(), 1); 45872 45873 // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs 45874 function getCustomValidity(isValid2, validity) { 45875 let customValidity; 45876 if (isValid2?.required && validity?.required) { 45877 customValidity = validity?.required?.message ? validity.required : void 0; 45878 } else if (isValid2?.pattern && validity?.pattern) { 45879 customValidity = validity.pattern; 45880 } else if (isValid2?.min && validity?.min) { 45881 customValidity = validity.min; 45882 } else if (isValid2?.max && validity?.max) { 45883 customValidity = validity.max; 45884 } else if (isValid2?.minLength && validity?.minLength) { 45885 customValidity = validity.minLength; 45886 } else if (isValid2?.maxLength && validity?.maxLength) { 45887 customValidity = validity.maxLength; 45888 } else if (isValid2?.elements && validity?.elements) { 45889 customValidity = validity.elements; 45890 } else if (validity?.custom) { 45891 customValidity = validity.custom; 45892 } 45893 return customValidity; 45894 } 45895 45896 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs 45897 var import_jsx_runtime246 = __toESM(require_jsx_runtime(), 1); 45898 var { ValidatedCheckboxControl } = unlock4(import_components109.privateApis); 45899 function Checkbox({ 45900 field, 45901 onChange, 45902 data, 45903 hideLabelFromVision, 45904 markWhenOptional, 45905 validity 45906 }) { 45907 const { getValue, setValue, label, description, isValid: isValid2 } = field; 45908 const disabled2 = field.isDisabled({ item: data, field }); 45909 const onChangeControl = (0, import_element126.useCallback)(() => { 45910 onChange( 45911 setValue({ item: data, value: !getValue({ item: data }) }) 45912 ); 45913 }, [data, getValue, onChange, setValue]); 45914 return /* @__PURE__ */ (0, import_jsx_runtime246.jsx)( 45915 ValidatedCheckboxControl, 45916 { 45917 required: !!field.isValid?.required, 45918 markWhenOptional, 45919 customValidity: getCustomValidity(isValid2, validity), 45920 hidden: hideLabelFromVision, 45921 label, 45922 help: description, 45923 checked: getValue({ item: data }), 45924 onChange: onChangeControl, 45925 disabled: disabled2 45926 } 45927 ); 45928 } 45929 45930 // packages/dataviews/build-module/components/dataform-controls/combobox.mjs 45931 var import_components110 = __toESM(require_components(), 1); 45932 var import_element127 = __toESM(require_element(), 1); 45933 var import_jsx_runtime247 = __toESM(require_jsx_runtime(), 1); 45934 var { ValidatedComboboxControl } = unlock4(import_components110.privateApis); 45935 function Combobox3({ 45936 data, 45937 field, 45938 onChange, 45939 hideLabelFromVision, 45940 validity 45941 }) { 45942 const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field; 45943 const value = getValue({ item: data }) ?? ""; 45944 const onChangeControl = (0, import_element127.useCallback)( 45945 (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })), 45946 [data, onChange, setValue] 45947 ); 45948 const { elements: elements2, isLoading } = useElements({ 45949 elements: field.elements, 45950 getElements: field.getElements 45951 }); 45952 if (isLoading) { 45953 return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(import_components110.Spinner, {}); 45954 } 45955 return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)( 45956 ValidatedComboboxControl, 45957 { 45958 required: !!field.isValid?.required, 45959 customValidity: getCustomValidity(isValid2, validity), 45960 label, 45961 value, 45962 help: description, 45963 placeholder, 45964 options: elements2, 45965 onChange: onChangeControl, 45966 hideLabelFromVision, 45967 allowReset: true, 45968 expandOnFocus: true 45969 } 45970 ); 45971 } 45972 45973 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs 45974 var import_components112 = __toESM(require_components(), 1); 45975 var import_element130 = __toESM(require_element(), 1); 45976 var import_i18n105 = __toESM(require_i18n(), 1); 45977 var import_date4 = __toESM(require_date(), 1); 45978 45979 // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs 45980 var import_components111 = __toESM(require_components(), 1); 45981 var import_element128 = __toESM(require_element(), 1); 45982 var import_i18n104 = __toESM(require_i18n(), 1); 45983 var import_jsx_runtime248 = __toESM(require_jsx_runtime(), 1); 45984 var TIME_UNITS_OPTIONS = { 45985 [OPERATOR_IN_THE_PAST]: [ 45986 { value: "days", label: (0, import_i18n104.__)("Days") }, 45987 { value: "weeks", label: (0, import_i18n104.__)("Weeks") }, 45988 { value: "months", label: (0, import_i18n104.__)("Months") }, 45989 { value: "years", label: (0, import_i18n104.__)("Years") } 45990 ], 45991 [OPERATOR_OVER]: [ 45992 { value: "days", label: (0, import_i18n104.__)("Days ago") }, 45993 { value: "weeks", label: (0, import_i18n104.__)("Weeks ago") }, 45994 { value: "months", label: (0, import_i18n104.__)("Months ago") }, 45995 { value: "years", label: (0, import_i18n104.__)("Years ago") } 45996 ] 45997 }; 45998 function RelativeDateControl({ 45999 className, 46000 data, 46001 field, 46002 onChange, 46003 hideLabelFromVision, 46004 operator 46005 }) { 46006 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"]; 46007 const { id, label, description, getValue, setValue } = field; 46008 const disabled2 = field.isDisabled({ item: data, field }); 46009 const fieldValue = getValue({ item: data }); 46010 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {}; 46011 const onChangeValue = (0, import_element128.useCallback)( 46012 (newValue) => onChange( 46013 setValue({ 46014 item: data, 46015 value: { value: Number(newValue), unit } 46016 }) 46017 ), 46018 [onChange, setValue, data, unit] 46019 ); 46020 const onChangeUnit = (0, import_element128.useCallback)( 46021 (newUnit) => onChange( 46022 setValue({ 46023 item: data, 46024 value: { value: relValue, unit: newUnit } 46025 }) 46026 ), 46027 [onChange, setValue, data, relValue] 46028 ); 46029 return /* @__PURE__ */ (0, import_jsx_runtime248.jsx)( 46030 import_components111.BaseControl, 46031 { 46032 id, 46033 className: clsx_default(className, "dataviews-controls__relative-date"), 46034 label, 46035 hideLabelFromVision, 46036 help: description, 46037 children: /* @__PURE__ */ (0, import_jsx_runtime248.jsxs)(Stack, { direction: "row", gap: "sm", children: [ 46038 /* @__PURE__ */ (0, import_jsx_runtime248.jsx)( 46039 import_components111.__experimentalNumberControl, 46040 { 46041 __next40pxDefaultSize: true, 46042 className: "dataviews-controls__relative-date-number", 46043 spinControls: "none", 46044 min: 1, 46045 step: 1, 46046 value: relValue, 46047 onChange: onChangeValue, 46048 disabled: disabled2 46049 } 46050 ), 46051 /* @__PURE__ */ (0, import_jsx_runtime248.jsx)( 46052 import_components111.SelectControl, 46053 { 46054 className: "dataviews-controls__relative-date-unit", 46055 __next40pxDefaultSize: true, 46056 label: (0, import_i18n104.__)("Unit"), 46057 value: unit, 46058 options, 46059 onChange: onChangeUnit, 46060 hideLabelFromVision: true, 46061 disabled: disabled2 46062 } 46063 ) 46064 ] }) 46065 } 46066 ); 46067 } 46068 46069 // packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs 46070 var import_element129 = __toESM(require_element(), 1); 46071 function useDisabledDateMatchers(isValid2, parseDateFn) { 46072 const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0; 46073 const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0; 46074 const disabledMatchers = (0, import_element129.useMemo)(() => { 46075 const matchers = []; 46076 if (minConstraint) { 46077 const minDate = parseDateFn(minConstraint); 46078 if (minDate) { 46079 matchers.push({ before: minDate }); 46080 } 46081 } 46082 if (maxConstraint) { 46083 const maxDate = parseDateFn(maxConstraint); 46084 if (maxDate) { 46085 matchers.push({ after: maxDate }); 46086 } 46087 } 46088 return matchers.length > 0 ? matchers : void 0; 46089 }, [minConstraint, maxConstraint, parseDateFn]); 46090 return { minConstraint, maxConstraint, disabledMatchers }; 46091 } 46092 46093 // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs 46094 var import_date3 = __toESM(require_date(), 1); 46095 function parseDateTime(dateTimeString) { 46096 if (!dateTimeString) { 46097 return null; 46098 } 46099 const parsed = (0, import_date3.getDate)(dateTimeString); 46100 return parsed && isValid(parsed) ? parsed : null; 46101 } 46102 46103 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs 46104 var import_jsx_runtime249 = __toESM(require_jsx_runtime(), 1); 46105 var { DateCalendar, ValidatedInputControl } = unlock4(import_components112.privateApis); 46106 var formatDateTime = (value) => { 46107 if (!value) { 46108 return ""; 46109 } 46110 return (0, import_date4.dateI18n)("Y-m-d\\TH:i", (0, import_date4.getDate)(value)); 46111 }; 46112 function CalendarDateTimeControl({ 46113 data, 46114 field, 46115 onChange, 46116 hideLabelFromVision, 46117 markWhenOptional, 46118 validity, 46119 config: config2 46120 }) { 46121 const { compact } = config2 || {}; 46122 const { id, label, description, setValue, getValue, isValid: isValid2 } = field; 46123 const disabled2 = field.isDisabled({ item: data, field }); 46124 const fieldValue = getValue({ item: data }); 46125 const value = typeof fieldValue === "string" ? fieldValue : void 0; 46126 const [calendarMonth, setCalendarMonth] = (0, import_element130.useState)(() => { 46127 const parsedDate = parseDateTime(value); 46128 return parsedDate || /* @__PURE__ */ new Date(); 46129 }); 46130 const inputControlRef = (0, import_element130.useRef)(null); 46131 const validationTimeoutRef = (0, import_element130.useRef)(void 0); 46132 const previousFocusRef = (0, import_element130.useRef)(null); 46133 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime); 46134 const onChangeCallback = (0, import_element130.useCallback)( 46135 (newValue) => onChange(setValue({ item: data, value: newValue })), 46136 [data, onChange, setValue] 46137 ); 46138 (0, import_element130.useEffect)(() => { 46139 return () => { 46140 if (validationTimeoutRef.current) { 46141 clearTimeout(validationTimeoutRef.current); 46142 } 46143 }; 46144 }, []); 46145 const onSelectDate = (0, import_element130.useCallback)( 46146 (newDate) => { 46147 let dateTimeValue; 46148 if (newDate) { 46149 const wpDate = (0, import_date4.dateI18n)("Y-m-d", newDate); 46150 let wpTime; 46151 if (value) { 46152 wpTime = (0, import_date4.dateI18n)("H:i", (0, import_date4.getDate)(value)); 46153 } else { 46154 wpTime = (0, import_date4.dateI18n)("H:i", newDate); 46155 } 46156 const finalDateTime = (0, import_date4.getDate)(`$wpDate}T$wpTime}`); 46157 dateTimeValue = finalDateTime.toISOString(); 46158 onChangeCallback(dateTimeValue); 46159 if (validationTimeoutRef.current) { 46160 clearTimeout(validationTimeoutRef.current); 46161 } 46162 } else { 46163 onChangeCallback(void 0); 46164 } 46165 previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement; 46166 validationTimeoutRef.current = setTimeout(() => { 46167 if (inputControlRef.current) { 46168 inputControlRef.current.focus(); 46169 inputControlRef.current.blur(); 46170 onChangeCallback(dateTimeValue); 46171 if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) { 46172 previousFocusRef.current.focus(); 46173 } 46174 } 46175 }, 0); 46176 }, 46177 [onChangeCallback, value] 46178 ); 46179 const handleManualDateTimeChange = (0, import_element130.useCallback)( 46180 (newValue) => { 46181 if (newValue) { 46182 const dateTime = (0, import_date4.getDate)(newValue); 46183 onChangeCallback(dateTime.toISOString()); 46184 const parsedDate = parseDateTime(dateTime.toISOString()); 46185 if (parsedDate) { 46186 setCalendarMonth(parsedDate); 46187 } 46188 } else { 46189 onChangeCallback(void 0); 46190 } 46191 }, 46192 [onChangeCallback] 46193 ); 46194 const { format: fieldFormat } = field; 46195 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek; 46196 const { 46197 timezone: { string: timezoneString } 46198 } = (0, import_date4.getSettings)(); 46199 let displayLabel = label; 46200 if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) { 46201 displayLabel = `$label} (${(0, import_i18n105.__)("Required")})`; 46202 } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) { 46203 displayLabel = `$label} (${(0, import_i18n105.__)("Optional")})`; 46204 } 46205 return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)( 46206 import_components112.BaseControl, 46207 { 46208 id, 46209 label: displayLabel, 46210 help: description, 46211 hideLabelFromVision, 46212 children: /* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 46213 /* @__PURE__ */ (0, import_jsx_runtime249.jsx)( 46214 ValidatedInputControl, 46215 { 46216 ref: inputControlRef, 46217 __next40pxDefaultSize: true, 46218 required: !!isValid2?.required, 46219 customValidity: getCustomValidity(isValid2, validity), 46220 type: "datetime-local", 46221 label: (0, import_i18n105.__)("Date time"), 46222 hideLabelFromVision: true, 46223 value: formatDateTime(value), 46224 onChange: handleManualDateTimeChange, 46225 disabled: disabled2, 46226 min: minConstraint ? formatDateTime(minConstraint) : void 0, 46227 max: maxConstraint ? formatDateTime(maxConstraint) : void 0 46228 } 46229 ), 46230 !compact && /* @__PURE__ */ (0, import_jsx_runtime249.jsx)( 46231 DateCalendar, 46232 { 46233 style: { width: "100%" }, 46234 selected: value ? parseDateTime(value) || void 0 : void 0, 46235 onSelect: onSelectDate, 46236 month: calendarMonth, 46237 onMonthChange: setCalendarMonth, 46238 timeZone: timezoneString || void 0, 46239 weekStartsOn, 46240 disabled: disabled2 || disabledMatchers 46241 } 46242 ) 46243 ] }) 46244 } 46245 ); 46246 } 46247 function DateTime({ 46248 data, 46249 field, 46250 onChange, 46251 hideLabelFromVision, 46252 markWhenOptional, 46253 operator, 46254 validity, 46255 config: config2 46256 }) { 46257 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 46258 return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)( 46259 RelativeDateControl, 46260 { 46261 className: "dataviews-controls__datetime", 46262 data, 46263 field, 46264 onChange, 46265 hideLabelFromVision, 46266 operator 46267 } 46268 ); 46269 } 46270 return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)( 46271 CalendarDateTimeControl, 46272 { 46273 data, 46274 field, 46275 onChange, 46276 hideLabelFromVision, 46277 markWhenOptional, 46278 validity, 46279 config: config2 46280 } 46281 ); 46282 } 46283 46284 // packages/dataviews/build-module/components/dataform-controls/date.mjs 46285 var import_components113 = __toESM(require_components(), 1); 46286 var import_element131 = __toESM(require_element(), 1); 46287 var import_i18n106 = __toESM(require_i18n(), 1); 46288 var import_date5 = __toESM(require_date(), 1); 46289 var import_jsx_runtime250 = __toESM(require_jsx_runtime(), 1); 46290 var { DateCalendar: DateCalendar2, DateRangeCalendar } = unlock4(import_components113.privateApis); 46291 var DATE_PRESETS = [ 46292 { 46293 id: "today", 46294 label: (0, import_i18n106.__)("Today"), 46295 getValue: () => (0, import_date5.getDate)(null) 46296 }, 46297 { 46298 id: "yesterday", 46299 label: (0, import_i18n106.__)("Yesterday"), 46300 getValue: () => { 46301 const today = (0, import_date5.getDate)(null); 46302 return subDays(today, 1); 46303 } 46304 }, 46305 { 46306 id: "past-week", 46307 label: (0, import_i18n106.__)("Past week"), 46308 getValue: () => { 46309 const today = (0, import_date5.getDate)(null); 46310 return subDays(today, 7); 46311 } 46312 }, 46313 { 46314 id: "past-month", 46315 label: (0, import_i18n106.__)("Past month"), 46316 getValue: () => { 46317 const today = (0, import_date5.getDate)(null); 46318 return subMonths(today, 1); 46319 } 46320 } 46321 ]; 46322 var DATE_RANGE_PRESETS = [ 46323 { 46324 id: "last-7-days", 46325 label: (0, import_i18n106.__)("Last 7 days"), 46326 getValue: () => { 46327 const today = (0, import_date5.getDate)(null); 46328 return [subDays(today, 7), today]; 46329 } 46330 }, 46331 { 46332 id: "last-30-days", 46333 label: (0, import_i18n106.__)("Last 30 days"), 46334 getValue: () => { 46335 const today = (0, import_date5.getDate)(null); 46336 return [subDays(today, 30), today]; 46337 } 46338 }, 46339 { 46340 id: "month-to-date", 46341 label: (0, import_i18n106.__)("Month to date"), 46342 getValue: () => { 46343 const today = (0, import_date5.getDate)(null); 46344 return [startOfMonth(today), today]; 46345 } 46346 }, 46347 { 46348 id: "last-year", 46349 label: (0, import_i18n106.__)("Last year"), 46350 getValue: () => { 46351 const today = (0, import_date5.getDate)(null); 46352 return [subYears(today, 1), today]; 46353 } 46354 }, 46355 { 46356 id: "year-to-date", 46357 label: (0, import_i18n106.__)("Year to date"), 46358 getValue: () => { 46359 const today = (0, import_date5.getDate)(null); 46360 return [startOfYear(today), today]; 46361 } 46362 } 46363 ]; 46364 var parseDate = (dateString) => { 46365 if (!dateString) { 46366 return null; 46367 } 46368 const parsed = (0, import_date5.getDate)(dateString); 46369 return parsed && isValid(parsed) ? parsed : null; 46370 }; 46371 var formatDate = (date) => { 46372 if (!date) { 46373 return ""; 46374 } 46375 return typeof date === "string" ? date : format(date, "yyyy-MM-dd"); 46376 }; 46377 function ValidatedDateControl({ 46378 field, 46379 validity, 46380 inputRefs, 46381 isTouched, 46382 setIsTouched, 46383 children 46384 }) { 46385 const { isValid: isValid2 } = field; 46386 const [customValidity, setCustomValidity] = (0, import_element131.useState)(void 0); 46387 const validateRefs = (0, import_element131.useCallback)(() => { 46388 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 46389 for (const ref of refs) { 46390 const input = ref.current; 46391 if (input && !input.validity.valid) { 46392 setCustomValidity({ 46393 type: "invalid", 46394 message: input.validationMessage 46395 }); 46396 return; 46397 } 46398 } 46399 setCustomValidity(void 0); 46400 }, [inputRefs]); 46401 (0, import_element131.useEffect)(() => { 46402 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 46403 const result = validity ? getCustomValidity(isValid2, validity) : void 0; 46404 for (const ref of refs) { 46405 const input = ref.current; 46406 if (input) { 46407 input.setCustomValidity( 46408 result?.type === "invalid" && result.message ? result.message : "" 46409 ); 46410 } 46411 } 46412 }, [inputRefs, isValid2, validity]); 46413 (0, import_element131.useEffect)(() => { 46414 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 46415 const handleInvalid = (event) => { 46416 event.preventDefault(); 46417 setIsTouched(true); 46418 }; 46419 for (const ref of refs) { 46420 ref.current?.addEventListener("invalid", handleInvalid); 46421 } 46422 return () => { 46423 for (const ref of refs) { 46424 ref.current?.removeEventListener("invalid", handleInvalid); 46425 } 46426 }; 46427 }, [inputRefs, setIsTouched]); 46428 (0, import_element131.useEffect)(() => { 46429 if (!isTouched) { 46430 return; 46431 } 46432 const result = validity ? getCustomValidity(isValid2, validity) : void 0; 46433 if (result) { 46434 setCustomValidity(result); 46435 } else { 46436 validateRefs(); 46437 } 46438 }, [isTouched, isValid2, validity, validateRefs]); 46439 const onBlur = (event) => { 46440 if (isTouched) { 46441 return; 46442 } 46443 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { 46444 setIsTouched(true); 46445 } 46446 }; 46447 return /* @__PURE__ */ (0, import_jsx_runtime250.jsxs)("div", { onBlur, children: [ 46448 children, 46449 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0, import_jsx_runtime250.jsxs)( 46450 "p", 46451 { 46452 className: clsx_default( 46453 "components-validated-control__indicator", 46454 customValidity.type === "invalid" ? "is-invalid" : void 0 46455 ), 46456 children: [ 46457 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46458 import_components113.Icon, 46459 { 46460 className: "components-validated-control__indicator-icon", 46461 icon: error_default, 46462 size: 16, 46463 fill: "currentColor" 46464 } 46465 ), 46466 customValidity.message 46467 ] 46468 } 46469 ) }) 46470 ] }); 46471 } 46472 function CalendarDateControl({ 46473 data, 46474 field, 46475 onChange, 46476 hideLabelFromVision, 46477 markWhenOptional, 46478 validity 46479 }) { 46480 const { 46481 id, 46482 label, 46483 description, 46484 setValue, 46485 getValue, 46486 isValid: isValid2, 46487 format: fieldFormat 46488 } = field; 46489 const disabled2 = field.isDisabled({ item: data, field }); 46490 const [selectedPresetId, setSelectedPresetId] = (0, import_element131.useState)( 46491 null 46492 ); 46493 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek; 46494 const fieldValue = getValue({ item: data }); 46495 const value = typeof fieldValue === "string" ? fieldValue : void 0; 46496 const [calendarMonth, setCalendarMonth] = (0, import_element131.useState)(() => { 46497 const parsedDate = parseDate(value); 46498 return parsedDate || /* @__PURE__ */ new Date(); 46499 }); 46500 const [isTouched, setIsTouched] = (0, import_element131.useState)(false); 46501 const validityTargetRef = (0, import_element131.useRef)(null); 46502 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate); 46503 const onChangeCallback = (0, import_element131.useCallback)( 46504 (newValue) => onChange(setValue({ item: data, value: newValue })), 46505 [data, onChange, setValue] 46506 ); 46507 const onSelectDate = (0, import_element131.useCallback)( 46508 (newDate) => { 46509 const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0; 46510 onChangeCallback(dateValue); 46511 setSelectedPresetId(null); 46512 setIsTouched(true); 46513 }, 46514 [onChangeCallback] 46515 ); 46516 const handlePresetClick = (0, import_element131.useCallback)( 46517 (preset) => { 46518 const presetDate = preset.getValue(); 46519 const dateValue = formatDate(presetDate); 46520 setCalendarMonth(presetDate); 46521 onChangeCallback(dateValue); 46522 setSelectedPresetId(preset.id); 46523 setIsTouched(true); 46524 }, 46525 [onChangeCallback] 46526 ); 46527 const handleManualDateChange = (0, import_element131.useCallback)( 46528 (newValue) => { 46529 onChangeCallback(newValue); 46530 if (newValue) { 46531 const parsedDate = parseDate(newValue); 46532 if (parsedDate) { 46533 setCalendarMonth(parsedDate); 46534 } 46535 } 46536 setSelectedPresetId(null); 46537 setIsTouched(true); 46538 }, 46539 [onChangeCallback] 46540 ); 46541 const { 46542 timezone: { string: timezoneString } 46543 } = (0, import_date5.getSettings)(); 46544 let displayLabel = label; 46545 if (isValid2?.required && !markWhenOptional) { 46546 displayLabel = `$label} (${(0, import_i18n106.__)("Required")})`; 46547 } else if (!isValid2?.required && markWhenOptional) { 46548 displayLabel = `$label} (${(0, import_i18n106.__)("Optional")})`; 46549 } 46550 return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46551 ValidatedDateControl, 46552 { 46553 field, 46554 validity, 46555 inputRefs: validityTargetRef, 46556 isTouched, 46557 setIsTouched, 46558 children: /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46559 import_components113.BaseControl, 46560 { 46561 id, 46562 className: "dataviews-controls__date", 46563 label: displayLabel, 46564 help: description, 46565 hideLabelFromVision, 46566 children: /* @__PURE__ */ (0, import_jsx_runtime250.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 46567 /* @__PURE__ */ (0, import_jsx_runtime250.jsxs)( 46568 Stack, 46569 { 46570 direction: "row", 46571 gap: "sm", 46572 wrap: "wrap", 46573 justify: "flex-start", 46574 children: [ 46575 DATE_PRESETS.map((preset) => { 46576 const isSelected2 = selectedPresetId === preset.id; 46577 return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46578 import_components113.Button, 46579 { 46580 className: "dataviews-controls__date-preset", 46581 variant: "tertiary", 46582 isPressed: isSelected2, 46583 size: "small", 46584 disabled: disabled2, 46585 accessibleWhenDisabled: true, 46586 onClick: () => handlePresetClick(preset), 46587 children: preset.label 46588 }, 46589 preset.id 46590 ); 46591 }), 46592 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46593 import_components113.Button, 46594 { 46595 className: "dataviews-controls__date-preset", 46596 variant: "tertiary", 46597 isPressed: !selectedPresetId, 46598 size: "small", 46599 disabled: !!selectedPresetId || disabled2, 46600 accessibleWhenDisabled: true, 46601 children: (0, import_i18n106.__)("Custom") 46602 } 46603 ) 46604 ] 46605 } 46606 ), 46607 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46608 import_components113.__experimentalInputControl, 46609 { 46610 __next40pxDefaultSize: true, 46611 ref: validityTargetRef, 46612 type: "date", 46613 label: (0, import_i18n106.__)("Date"), 46614 hideLabelFromVision: true, 46615 value, 46616 onChange: handleManualDateChange, 46617 required: !!field.isValid?.required, 46618 disabled: disabled2, 46619 min: minConstraint, 46620 max: maxConstraint 46621 } 46622 ), 46623 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46624 DateCalendar2, 46625 { 46626 style: { width: "100%" }, 46627 selected: value ? parseDate(value) || void 0 : void 0, 46628 onSelect: onSelectDate, 46629 month: calendarMonth, 46630 onMonthChange: setCalendarMonth, 46631 timeZone: timezoneString || void 0, 46632 weekStartsOn, 46633 disabled: disabled2 || disabledMatchers, 46634 disableNavigation: disabled2 46635 } 46636 ) 46637 ] }) 46638 } 46639 ) 46640 } 46641 ); 46642 } 46643 function CalendarDateRangeControl({ 46644 data, 46645 field, 46646 onChange, 46647 hideLabelFromVision, 46648 markWhenOptional, 46649 validity 46650 }) { 46651 const { 46652 id, 46653 label, 46654 description, 46655 getValue, 46656 setValue, 46657 isValid: isValid2, 46658 format: fieldFormat 46659 } = field; 46660 const disabled2 = field.isDisabled({ item: data, field }); 46661 let value; 46662 const fieldValue = getValue({ item: data }); 46663 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) { 46664 value = fieldValue; 46665 } 46666 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek; 46667 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate); 46668 const onChangeCallback = (0, import_element131.useCallback)( 46669 (newValue) => { 46670 onChange( 46671 setValue({ 46672 item: data, 46673 value: newValue 46674 }) 46675 ); 46676 }, 46677 [data, onChange, setValue] 46678 ); 46679 const [selectedPresetId, setSelectedPresetId] = (0, import_element131.useState)( 46680 null 46681 ); 46682 const selectedRange = (0, import_element131.useMemo)(() => { 46683 if (!value) { 46684 return { from: void 0, to: void 0 }; 46685 } 46686 const [from, to2] = value; 46687 return { 46688 from: parseDate(from) || void 0, 46689 to: parseDate(to2) || void 0 46690 }; 46691 }, [value]); 46692 const [calendarMonth, setCalendarMonth] = (0, import_element131.useState)(() => { 46693 return selectedRange.from || /* @__PURE__ */ new Date(); 46694 }); 46695 const [isTouched, setIsTouched] = (0, import_element131.useState)(false); 46696 const fromInputRef = (0, import_element131.useRef)(null); 46697 const toInputRef = (0, import_element131.useRef)(null); 46698 const updateDateRange = (0, import_element131.useCallback)( 46699 (fromDate, toDate2) => { 46700 if (fromDate && toDate2) { 46701 onChangeCallback([ 46702 formatDate(fromDate), 46703 formatDate(toDate2) 46704 ]); 46705 } else if (!fromDate && !toDate2) { 46706 onChangeCallback(void 0); 46707 } 46708 }, 46709 [onChangeCallback] 46710 ); 46711 const onSelectCalendarRange = (0, import_element131.useCallback)( 46712 (newRange) => { 46713 updateDateRange(newRange?.from, newRange?.to); 46714 setSelectedPresetId(null); 46715 setIsTouched(true); 46716 }, 46717 [updateDateRange] 46718 ); 46719 const handlePresetClick = (0, import_element131.useCallback)( 46720 (preset) => { 46721 const [startDate2, endDate] = preset.getValue(); 46722 setCalendarMonth(startDate2); 46723 updateDateRange(startDate2, endDate); 46724 setSelectedPresetId(preset.id); 46725 setIsTouched(true); 46726 }, 46727 [updateDateRange] 46728 ); 46729 const handleManualDateChange = (0, import_element131.useCallback)( 46730 (fromOrTo, newValue) => { 46731 const [currentFrom, currentTo] = value || [ 46732 void 0, 46733 void 0 46734 ]; 46735 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom; 46736 const updatedTo = fromOrTo === "to" ? newValue : currentTo; 46737 updateDateRange(updatedFrom, updatedTo); 46738 if (newValue) { 46739 const parsedDate = parseDate(newValue); 46740 if (parsedDate) { 46741 setCalendarMonth(parsedDate); 46742 } 46743 } 46744 setSelectedPresetId(null); 46745 setIsTouched(true); 46746 }, 46747 [value, updateDateRange] 46748 ); 46749 const { timezone } = (0, import_date5.getSettings)(); 46750 let displayLabel = label; 46751 if (field.isValid?.required && !markWhenOptional) { 46752 displayLabel = `$label} (${(0, import_i18n106.__)("Required")})`; 46753 } else if (!field.isValid?.required && markWhenOptional) { 46754 displayLabel = `$label} (${(0, import_i18n106.__)("Optional")})`; 46755 } 46756 return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46757 ValidatedDateControl, 46758 { 46759 field, 46760 validity, 46761 inputRefs: [fromInputRef, toInputRef], 46762 isTouched, 46763 setIsTouched, 46764 children: /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46765 import_components113.BaseControl, 46766 { 46767 id, 46768 className: "dataviews-controls__date", 46769 label: displayLabel, 46770 help: description, 46771 hideLabelFromVision, 46772 children: /* @__PURE__ */ (0, import_jsx_runtime250.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 46773 /* @__PURE__ */ (0, import_jsx_runtime250.jsxs)( 46774 Stack, 46775 { 46776 direction: "row", 46777 gap: "sm", 46778 wrap: "wrap", 46779 justify: "flex-start", 46780 children: [ 46781 DATE_RANGE_PRESETS.map((preset) => { 46782 const isSelected2 = selectedPresetId === preset.id; 46783 return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46784 import_components113.Button, 46785 { 46786 className: "dataviews-controls__date-preset", 46787 variant: "tertiary", 46788 isPressed: isSelected2, 46789 size: "small", 46790 disabled: disabled2, 46791 accessibleWhenDisabled: true, 46792 onClick: () => handlePresetClick(preset), 46793 children: preset.label 46794 }, 46795 preset.id 46796 ); 46797 }), 46798 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46799 import_components113.Button, 46800 { 46801 className: "dataviews-controls__date-preset", 46802 variant: "tertiary", 46803 isPressed: !selectedPresetId, 46804 size: "small", 46805 accessibleWhenDisabled: true, 46806 disabled: !!selectedPresetId || disabled2, 46807 children: (0, import_i18n106.__)("Custom") 46808 } 46809 ) 46810 ] 46811 } 46812 ), 46813 /* @__PURE__ */ (0, import_jsx_runtime250.jsxs)( 46814 Stack, 46815 { 46816 direction: "row", 46817 gap: "sm", 46818 justify: "space-between", 46819 className: "dataviews-controls__date-range-inputs", 46820 children: [ 46821 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46822 import_components113.__experimentalInputControl, 46823 { 46824 __next40pxDefaultSize: true, 46825 ref: fromInputRef, 46826 type: "date", 46827 label: (0, import_i18n106.__)("From"), 46828 hideLabelFromVision: true, 46829 value: value?.[0], 46830 onChange: (newValue) => handleManualDateChange("from", newValue), 46831 required: !!field.isValid?.required, 46832 disabled: disabled2, 46833 min: minConstraint, 46834 max: maxConstraint 46835 } 46836 ), 46837 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46838 import_components113.__experimentalInputControl, 46839 { 46840 __next40pxDefaultSize: true, 46841 ref: toInputRef, 46842 type: "date", 46843 label: (0, import_i18n106.__)("To"), 46844 hideLabelFromVision: true, 46845 value: value?.[1], 46846 onChange: (newValue) => handleManualDateChange("to", newValue), 46847 required: !!field.isValid?.required, 46848 disabled: disabled2, 46849 min: minConstraint, 46850 max: maxConstraint 46851 } 46852 ) 46853 ] 46854 } 46855 ), 46856 /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46857 DateRangeCalendar, 46858 { 46859 style: { width: "100%" }, 46860 selected: selectedRange, 46861 onSelect: onSelectCalendarRange, 46862 month: calendarMonth, 46863 onMonthChange: setCalendarMonth, 46864 timeZone: timezone.string || void 0, 46865 weekStartsOn, 46866 disabled: disabled2 || disabledMatchers 46867 } 46868 ) 46869 ] }) 46870 } 46871 ) 46872 } 46873 ); 46874 } 46875 function DateControl({ 46876 data, 46877 field, 46878 onChange, 46879 hideLabelFromVision, 46880 markWhenOptional, 46881 operator, 46882 validity 46883 }) { 46884 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 46885 return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46886 RelativeDateControl, 46887 { 46888 className: "dataviews-controls__date", 46889 data, 46890 field, 46891 onChange, 46892 hideLabelFromVision, 46893 operator 46894 } 46895 ); 46896 } 46897 if (operator === OPERATOR_BETWEEN) { 46898 return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46899 CalendarDateRangeControl, 46900 { 46901 data, 46902 field, 46903 onChange, 46904 hideLabelFromVision, 46905 markWhenOptional, 46906 validity 46907 } 46908 ); 46909 } 46910 return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)( 46911 CalendarDateControl, 46912 { 46913 data, 46914 field, 46915 onChange, 46916 hideLabelFromVision, 46917 markWhenOptional, 46918 validity 46919 } 46920 ); 46921 } 46922 46923 // packages/dataviews/build-module/components/dataform-controls/select.mjs 46924 var import_components114 = __toESM(require_components(), 1); 46925 var import_element132 = __toESM(require_element(), 1); 46926 var import_jsx_runtime251 = __toESM(require_jsx_runtime(), 1); 46927 var { ValidatedSelectControl } = unlock4(import_components114.privateApis); 46928 function Select({ 46929 data, 46930 field, 46931 onChange, 46932 hideLabelFromVision, 46933 markWhenOptional, 46934 validity 46935 }) { 46936 const { type, label, description, getValue, setValue, isValid: isValid2 } = field; 46937 const disabled2 = field.isDisabled({ item: data, field }); 46938 const isMultiple = type === "array"; 46939 const value = getValue({ item: data }) ?? (isMultiple ? [] : ""); 46940 const onChangeControl = (0, import_element132.useCallback)( 46941 (newValue) => onChange(setValue({ item: data, value: newValue })), 46942 [data, onChange, setValue] 46943 ); 46944 const { elements: elements2, isLoading } = useElements({ 46945 elements: field.elements, 46946 getElements: field.getElements 46947 }); 46948 if (isLoading) { 46949 return /* @__PURE__ */ (0, import_jsx_runtime251.jsx)(import_components114.Spinner, {}); 46950 } 46951 return /* @__PURE__ */ (0, import_jsx_runtime251.jsx)( 46952 ValidatedSelectControl, 46953 { 46954 required: !!field.isValid?.required, 46955 markWhenOptional, 46956 customValidity: getCustomValidity(isValid2, validity), 46957 label, 46958 value, 46959 help: description, 46960 options: elements2, 46961 onChange: onChangeControl, 46962 __next40pxDefaultSize: true, 46963 hideLabelFromVision, 46964 multiple: isMultiple, 46965 disabled: disabled2 46966 } 46967 ); 46968 } 46969 46970 // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs 46971 var import_jsx_runtime252 = __toESM(require_jsx_runtime(), 1); 46972 var ELEMENTS_THRESHOLD = 10; 46973 function AdaptiveSelect(props) { 46974 const { field } = props; 46975 const { elements: elements2 } = useElements({ 46976 elements: field.elements, 46977 getElements: field.getElements 46978 }); 46979 if (elements2.length >= ELEMENTS_THRESHOLD) { 46980 return /* @__PURE__ */ (0, import_jsx_runtime252.jsx)(Combobox3, { ...props }); 46981 } 46982 return /* @__PURE__ */ (0, import_jsx_runtime252.jsx)(Select, { ...props }); 46983 } 46984 46985 // packages/dataviews/build-module/components/dataform-controls/email.mjs 46986 var import_components116 = __toESM(require_components(), 1); 46987 46988 // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs 46989 var import_components115 = __toESM(require_components(), 1); 46990 var import_element133 = __toESM(require_element(), 1); 46991 var import_jsx_runtime253 = __toESM(require_jsx_runtime(), 1); 46992 var { ValidatedInputControl: ValidatedInputControl2 } = unlock4(import_components115.privateApis); 46993 function ValidatedText({ 46994 data, 46995 field, 46996 onChange, 46997 hideLabelFromVision, 46998 markWhenOptional, 46999 type, 47000 prefix: prefix2, 47001 suffix, 47002 validity 47003 }) { 47004 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 47005 const value = getValue({ item: data }); 47006 const disabled2 = field.isDisabled({ item: data, field }); 47007 const onChangeControl = (0, import_element133.useCallback)( 47008 (newValue) => onChange( 47009 setValue({ 47010 item: data, 47011 value: newValue 47012 }) 47013 ), 47014 [data, setValue, onChange] 47015 ); 47016 return /* @__PURE__ */ (0, import_jsx_runtime253.jsx)( 47017 ValidatedInputControl2, 47018 { 47019 required: !!isValid2.required, 47020 markWhenOptional, 47021 customValidity: getCustomValidity(isValid2, validity), 47022 label, 47023 placeholder, 47024 value: value ?? "", 47025 help: description, 47026 onChange: onChangeControl, 47027 hideLabelFromVision, 47028 type, 47029 prefix: prefix2, 47030 suffix, 47031 disabled: disabled2, 47032 pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0, 47033 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, 47034 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0, 47035 __next40pxDefaultSize: true 47036 } 47037 ); 47038 } 47039 47040 // packages/dataviews/build-module/components/dataform-controls/email.mjs 47041 var import_jsx_runtime254 = __toESM(require_jsx_runtime(), 1); 47042 function Email({ 47043 data, 47044 field, 47045 onChange, 47046 hideLabelFromVision, 47047 markWhenOptional, 47048 validity 47049 }) { 47050 return /* @__PURE__ */ (0, import_jsx_runtime254.jsx)( 47051 ValidatedText, 47052 { 47053 ...{ 47054 data, 47055 field, 47056 onChange, 47057 hideLabelFromVision, 47058 markWhenOptional, 47059 validity, 47060 type: "email", 47061 prefix: /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(import_components116.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(import_components116.Icon, { icon: envelope_default }) }) 47062 } 47063 } 47064 ); 47065 } 47066 47067 // packages/dataviews/build-module/components/dataform-controls/telephone.mjs 47068 var import_components117 = __toESM(require_components(), 1); 47069 var import_jsx_runtime255 = __toESM(require_jsx_runtime(), 1); 47070 function Telephone({ 47071 data, 47072 field, 47073 onChange, 47074 hideLabelFromVision, 47075 markWhenOptional, 47076 validity 47077 }) { 47078 return /* @__PURE__ */ (0, import_jsx_runtime255.jsx)( 47079 ValidatedText, 47080 { 47081 ...{ 47082 data, 47083 field, 47084 onChange, 47085 hideLabelFromVision, 47086 markWhenOptional, 47087 validity, 47088 type: "tel", 47089 prefix: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(import_components117.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(import_components117.Icon, { icon: mobile_default }) }) 47090 } 47091 } 47092 ); 47093 } 47094 47095 // packages/dataviews/build-module/components/dataform-controls/url.mjs 47096 var import_components118 = __toESM(require_components(), 1); 47097 var import_jsx_runtime256 = __toESM(require_jsx_runtime(), 1); 47098 function Url({ 47099 data, 47100 field, 47101 onChange, 47102 hideLabelFromVision, 47103 markWhenOptional, 47104 validity 47105 }) { 47106 return /* @__PURE__ */ (0, import_jsx_runtime256.jsx)( 47107 ValidatedText, 47108 { 47109 ...{ 47110 data, 47111 field, 47112 onChange, 47113 hideLabelFromVision, 47114 markWhenOptional, 47115 validity, 47116 type: "url", 47117 prefix: /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(import_components118.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(import_components118.Icon, { icon: link_default }) }) 47118 } 47119 } 47120 ); 47121 } 47122 47123 // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs 47124 var import_components119 = __toESM(require_components(), 1); 47125 var import_element134 = __toESM(require_element(), 1); 47126 var import_i18n107 = __toESM(require_i18n(), 1); 47127 var import_jsx_runtime257 = __toESM(require_jsx_runtime(), 1); 47128 var { ValidatedNumberControl } = unlock4(import_components119.privateApis); 47129 function toNumberOrEmpty(value) { 47130 if (value === "" || value === void 0) { 47131 return ""; 47132 } 47133 const number = Number(value); 47134 return Number.isFinite(number) ? number : ""; 47135 } 47136 function BetweenControls({ 47137 value, 47138 onChange, 47139 hideLabelFromVision, 47140 step 47141 }) { 47142 const [min2 = "", max2 = ""] = value; 47143 const onChangeMin = (0, import_element134.useCallback)( 47144 (newValue) => onChange([toNumberOrEmpty(newValue), max2]), 47145 [onChange, max2] 47146 ); 47147 const onChangeMax = (0, import_element134.useCallback)( 47148 (newValue) => onChange([min2, toNumberOrEmpty(newValue)]), 47149 [onChange, min2] 47150 ); 47151 return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)( 47152 import_components119.BaseControl, 47153 { 47154 help: (0, import_i18n107.__)("The max. value must be greater than the min. value."), 47155 children: /* @__PURE__ */ (0, import_jsx_runtime257.jsxs)(import_components119.Flex, { direction: "row", gap: 4, children: [ 47156 /* @__PURE__ */ (0, import_jsx_runtime257.jsx)( 47157 import_components119.__experimentalNumberControl, 47158 { 47159 label: (0, import_i18n107.__)("Min."), 47160 value: min2, 47161 max: max2 ? Number(max2) - step : void 0, 47162 onChange: onChangeMin, 47163 __next40pxDefaultSize: true, 47164 hideLabelFromVision, 47165 step 47166 } 47167 ), 47168 /* @__PURE__ */ (0, import_jsx_runtime257.jsx)( 47169 import_components119.__experimentalNumberControl, 47170 { 47171 label: (0, import_i18n107.__)("Max."), 47172 value: max2, 47173 min: min2 ? Number(min2) + step : void 0, 47174 onChange: onChangeMax, 47175 __next40pxDefaultSize: true, 47176 hideLabelFromVision, 47177 step 47178 } 47179 ) 47180 ] }) 47181 } 47182 ); 47183 } 47184 function ValidatedNumber({ 47185 data, 47186 field, 47187 onChange, 47188 hideLabelFromVision, 47189 markWhenOptional, 47190 operator, 47191 validity 47192 }) { 47193 const decimals = field.format?.decimals ?? 0; 47194 const step = Math.pow(10, Math.abs(decimals) * -1); 47195 const { label, description, getValue, setValue, isValid: isValid2 } = field; 47196 const value = getValue({ item: data }) ?? ""; 47197 const disabled2 = field.isDisabled({ item: data, field }); 47198 const onChangeControl = (0, import_element134.useCallback)( 47199 (newValue) => { 47200 onChange( 47201 setValue({ 47202 item: data, 47203 // Do not convert an empty string or undefined to a number, 47204 // otherwise there's a mismatch between the UI control (empty) 47205 // and the data relied by onChange (0). 47206 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue) 47207 }) 47208 ); 47209 }, 47210 [data, onChange, setValue] 47211 ); 47212 const onChangeBetweenControls = (0, import_element134.useCallback)( 47213 (newValue) => { 47214 onChange( 47215 setValue({ 47216 item: data, 47217 value: newValue 47218 }) 47219 ); 47220 }, 47221 [data, onChange, setValue] 47222 ); 47223 if (operator === OPERATOR_BETWEEN) { 47224 let valueBetween = ["", ""]; 47225 if (Array.isArray(value) && value.length === 2 && value.every( 47226 (element) => typeof element === "number" || element === "" 47227 )) { 47228 valueBetween = value; 47229 } 47230 return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)( 47231 BetweenControls, 47232 { 47233 value: valueBetween, 47234 onChange: onChangeBetweenControls, 47235 hideLabelFromVision, 47236 step 47237 } 47238 ); 47239 } 47240 return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)( 47241 ValidatedNumberControl, 47242 { 47243 required: !!isValid2.required, 47244 markWhenOptional, 47245 customValidity: getCustomValidity(isValid2, validity), 47246 label, 47247 help: description, 47248 value, 47249 onChange: onChangeControl, 47250 __next40pxDefaultSize: true, 47251 hideLabelFromVision, 47252 step, 47253 min: isValid2.min ? isValid2.min.constraint : void 0, 47254 max: isValid2.max ? isValid2.max.constraint : void 0, 47255 disabled: disabled2 47256 } 47257 ); 47258 } 47259 47260 // packages/dataviews/build-module/components/dataform-controls/integer.mjs 47261 var import_jsx_runtime258 = __toESM(require_jsx_runtime(), 1); 47262 function Integer(props) { 47263 return /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(ValidatedNumber, { ...props }); 47264 } 47265 47266 // packages/dataviews/build-module/components/dataform-controls/number.mjs 47267 var import_jsx_runtime259 = __toESM(require_jsx_runtime(), 1); 47268 function Number2(props) { 47269 return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(ValidatedNumber, { ...props }); 47270 } 47271 47272 // packages/dataviews/build-module/components/dataform-controls/radio.mjs 47273 var import_components120 = __toESM(require_components(), 1); 47274 var import_element135 = __toESM(require_element(), 1); 47275 var import_jsx_runtime260 = __toESM(require_jsx_runtime(), 1); 47276 var { ValidatedRadioControl } = unlock4(import_components120.privateApis); 47277 function Radio({ 47278 data, 47279 field, 47280 onChange, 47281 hideLabelFromVision, 47282 markWhenOptional, 47283 validity 47284 }) { 47285 const { label, description, getValue, setValue, isValid: isValid2 } = field; 47286 const disabled2 = field.isDisabled({ item: data, field }); 47287 const { elements: elements2, isLoading } = useElements({ 47288 elements: field.elements, 47289 getElements: field.getElements 47290 }); 47291 const value = getValue({ item: data }); 47292 const onChangeControl = (0, import_element135.useCallback)( 47293 (newValue) => onChange(setValue({ item: data, value: newValue })), 47294 [data, onChange, setValue] 47295 ); 47296 if (isLoading) { 47297 return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_components120.Spinner, {}); 47298 } 47299 return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)( 47300 ValidatedRadioControl, 47301 { 47302 required: !!field.isValid?.required, 47303 markWhenOptional, 47304 customValidity: getCustomValidity(isValid2, validity), 47305 label, 47306 help: description, 47307 onChange: onChangeControl, 47308 options: elements2, 47309 selected: value, 47310 hideLabelFromVision, 47311 disabled: disabled2 47312 } 47313 ); 47314 } 47315 47316 // packages/dataviews/build-module/components/dataform-controls/text.mjs 47317 var import_element136 = __toESM(require_element(), 1); 47318 var import_jsx_runtime261 = __toESM(require_jsx_runtime(), 1); 47319 function Text3({ 47320 data, 47321 field, 47322 onChange, 47323 hideLabelFromVision, 47324 markWhenOptional, 47325 config: config2, 47326 validity 47327 }) { 47328 const { prefix: prefix2, suffix } = config2 || {}; 47329 return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)( 47330 ValidatedText, 47331 { 47332 ...{ 47333 data, 47334 field, 47335 onChange, 47336 hideLabelFromVision, 47337 markWhenOptional, 47338 validity, 47339 prefix: prefix2 ? (0, import_element136.createElement)(prefix2) : void 0, 47340 suffix: suffix ? (0, import_element136.createElement)(suffix) : void 0 47341 } 47342 } 47343 ); 47344 } 47345 47346 // packages/dataviews/build-module/components/dataform-controls/toggle.mjs 47347 var import_components121 = __toESM(require_components(), 1); 47348 var import_element137 = __toESM(require_element(), 1); 47349 var import_jsx_runtime262 = __toESM(require_jsx_runtime(), 1); 47350 var { ValidatedToggleControl } = unlock4(import_components121.privateApis); 47351 function Toggle({ 47352 field, 47353 onChange, 47354 data, 47355 hideLabelFromVision, 47356 markWhenOptional, 47357 validity 47358 }) { 47359 const { label, description, getValue, setValue, isValid: isValid2 } = field; 47360 const disabled2 = field.isDisabled({ item: data, field }); 47361 const onChangeControl = (0, import_element137.useCallback)(() => { 47362 onChange( 47363 setValue({ item: data, value: !getValue({ item: data }) }) 47364 ); 47365 }, [onChange, setValue, data, getValue]); 47366 return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)( 47367 ValidatedToggleControl, 47368 { 47369 required: !!isValid2.required, 47370 markWhenOptional, 47371 customValidity: getCustomValidity(isValid2, validity), 47372 hidden: hideLabelFromVision, 47373 label, 47374 help: description, 47375 checked: getValue({ item: data }), 47376 onChange: onChangeControl, 47377 disabled: disabled2 47378 } 47379 ); 47380 } 47381 47382 // packages/dataviews/build-module/components/dataform-controls/textarea.mjs 47383 var import_components122 = __toESM(require_components(), 1); 47384 var import_element138 = __toESM(require_element(), 1); 47385 var import_jsx_runtime263 = __toESM(require_jsx_runtime(), 1); 47386 var { ValidatedTextareaControl } = unlock4(import_components122.privateApis); 47387 function Textarea({ 47388 data, 47389 field, 47390 onChange, 47391 hideLabelFromVision, 47392 markWhenOptional, 47393 config: config2, 47394 validity 47395 }) { 47396 const { rows = 4 } = config2 || {}; 47397 const disabled2 = field.isDisabled({ item: data, field }); 47398 const { label, placeholder, description, setValue, isValid: isValid2 } = field; 47399 const value = field.getValue({ item: data }); 47400 const onChangeControl = (0, import_element138.useCallback)( 47401 (newValue) => onChange(setValue({ item: data, value: newValue })), 47402 [data, onChange, setValue] 47403 ); 47404 return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)( 47405 ValidatedTextareaControl, 47406 { 47407 required: !!isValid2.required, 47408 markWhenOptional, 47409 customValidity: getCustomValidity(isValid2, validity), 47410 label, 47411 placeholder, 47412 value: value ?? "", 47413 help: description, 47414 onChange: onChangeControl, 47415 rows, 47416 disabled: disabled2, 47417 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, 47418 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0, 47419 __next40pxDefaultSize: true, 47420 hideLabelFromVision 47421 } 47422 ); 47423 } 47424 47425 // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs 47426 var import_components123 = __toESM(require_components(), 1); 47427 var import_element139 = __toESM(require_element(), 1); 47428 var import_jsx_runtime264 = __toESM(require_jsx_runtime(), 1); 47429 var { ValidatedToggleGroupControl } = unlock4(import_components123.privateApis); 47430 function ToggleGroup({ 47431 data, 47432 field, 47433 onChange, 47434 hideLabelFromVision, 47435 markWhenOptional, 47436 validity 47437 }) { 47438 const { getValue, setValue, isValid: isValid2 } = field; 47439 const disabled2 = field.isDisabled({ item: data, field }); 47440 const value = getValue({ item: data }); 47441 const onChangeControl = (0, import_element139.useCallback)( 47442 (newValue) => onChange(setValue({ item: data, value: newValue })), 47443 [data, onChange, setValue] 47444 ); 47445 const { elements: elements2, isLoading } = useElements({ 47446 elements: field.elements, 47447 getElements: field.getElements 47448 }); 47449 if (isLoading) { 47450 return /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(import_components123.Spinner, {}); 47451 } 47452 if (elements2.length === 0) { 47453 return null; 47454 } 47455 const selectedOption = elements2.find((el) => el.value === value); 47456 return /* @__PURE__ */ (0, import_jsx_runtime264.jsx)( 47457 ValidatedToggleGroupControl, 47458 { 47459 required: !!field.isValid?.required, 47460 markWhenOptional, 47461 customValidity: getCustomValidity(isValid2, validity), 47462 __next40pxDefaultSize: true, 47463 isBlock: true, 47464 label: field.label, 47465 help: selectedOption?.description || field.description, 47466 onChange: onChangeControl, 47467 value, 47468 hideLabelFromVision, 47469 children: elements2.map((el) => /* @__PURE__ */ (0, import_jsx_runtime264.jsx)( 47470 import_components123.__experimentalToggleGroupControlOption, 47471 { 47472 label: el.label, 47473 value: el.value, 47474 disabled: disabled2 47475 }, 47476 el.value 47477 )) 47478 } 47479 ); 47480 } 47481 47482 // packages/dataviews/build-module/components/dataform-controls/array.mjs 47483 var import_components124 = __toESM(require_components(), 1); 47484 var import_element140 = __toESM(require_element(), 1); 47485 var import_jsx_runtime265 = __toESM(require_jsx_runtime(), 1); 47486 var { ValidatedFormTokenField } = unlock4(import_components124.privateApis); 47487 function ArrayControl({ 47488 data, 47489 field, 47490 onChange, 47491 hideLabelFromVision, 47492 markWhenOptional, 47493 validity 47494 }) { 47495 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 47496 const value = getValue({ item: data }); 47497 const disabled2 = field.isDisabled({ item: data, field }); 47498 const { elements: elements2, isLoading } = useElements({ 47499 elements: field.elements, 47500 getElements: field.getElements 47501 }); 47502 const arrayValueAsElements = (0, import_element140.useMemo)( 47503 () => Array.isArray(value) ? value.map((token) => { 47504 const element = elements2?.find( 47505 (suggestion) => suggestion.value === token 47506 ); 47507 return element || { value: token, label: token }; 47508 }) : [], 47509 [value, elements2] 47510 ); 47511 const onChangeControl = (0, import_element140.useCallback)( 47512 (tokens) => { 47513 const valueTokens = tokens.map((token) => { 47514 if (typeof token === "object" && "value" in token) { 47515 return token.value; 47516 } 47517 return token; 47518 }); 47519 onChange(setValue({ item: data, value: valueTokens })); 47520 }, 47521 [onChange, setValue, data] 47522 ); 47523 if (isLoading) { 47524 return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_components124.Spinner, {}); 47525 } 47526 return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)( 47527 ValidatedFormTokenField, 47528 { 47529 required: !!isValid2?.required, 47530 markWhenOptional, 47531 customValidity: getCustomValidity(isValid2, validity), 47532 label: hideLabelFromVision ? void 0 : label, 47533 value: arrayValueAsElements, 47534 onChange: onChangeControl, 47535 placeholder, 47536 suggestions: elements2?.map((element) => element.value), 47537 disabled: disabled2, 47538 __experimentalValidateInput: (token) => { 47539 if (field.isValid?.elements && elements2) { 47540 return elements2.some( 47541 (element) => element.value === token || element.label === token 47542 ); 47543 } 47544 return true; 47545 }, 47546 __experimentalExpandOnFocus: elements2 && elements2.length > 0, 47547 help: description ?? (field.isValid?.elements ? "" : void 0), 47548 displayTransform: (token) => { 47549 if (typeof token === "object" && "label" in token) { 47550 return token.label; 47551 } 47552 if (typeof token === "string" && elements2) { 47553 const element = elements2.find( 47554 (el) => el.value === token 47555 ); 47556 return element?.label || token; 47557 } 47558 return token; 47559 }, 47560 __experimentalRenderItem: ({ item }) => { 47561 if (typeof item === "string" && elements2) { 47562 const element = elements2.find( 47563 (el) => el.value === item 47564 ); 47565 return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { children: element?.label || item }); 47566 } 47567 return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { children: item }); 47568 } 47569 } 47570 ); 47571 } 47572 47573 // packages/dataviews/build-module/components/dataform-controls/color.mjs 47574 var import_components125 = __toESM(require_components(), 1); 47575 var import_element141 = __toESM(require_element(), 1); 47576 var import_i18n108 = __toESM(require_i18n(), 1); 47577 var import_jsx_runtime266 = __toESM(require_jsx_runtime(), 1); 47578 var { ValidatedInputControl: ValidatedInputControl3 } = unlock4(import_components125.privateApis); 47579 var ColorPickerDropdown = ({ 47580 color, 47581 onColorChange, 47582 disabled: disabled2 47583 }) => { 47584 const validColor = color && w(color).isValid() ? color : "#ffffff"; 47585 return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)( 47586 import_components125.Dropdown, 47587 { 47588 className: "dataviews-controls__color-picker-dropdown", 47589 popoverProps: { resize: false }, 47590 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)( 47591 import_components125.Button, 47592 { 47593 onClick: onToggle, 47594 "aria-label": (0, import_i18n108.__)("Open color picker"), 47595 size: "small", 47596 disabled: disabled2, 47597 accessibleWhenDisabled: true, 47598 icon: () => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_components125.ColorIndicator, { colorValue: validColor }) 47599 } 47600 ), 47601 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_components125.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)( 47602 import_components125.ColorPicker, 47603 { 47604 color: validColor, 47605 onChange: onColorChange, 47606 enableAlpha: true 47607 } 47608 ) }) 47609 } 47610 ); 47611 }; 47612 function Color({ 47613 data, 47614 field, 47615 onChange, 47616 hideLabelFromVision, 47617 markWhenOptional, 47618 validity 47619 }) { 47620 const { label, placeholder, description, setValue, isValid: isValid2 } = field; 47621 const disabled2 = field.isDisabled({ item: data, field }); 47622 const value = field.getValue({ item: data }) || ""; 47623 const handleColorChange = (0, import_element141.useCallback)( 47624 (newColor) => { 47625 onChange(setValue({ item: data, value: newColor })); 47626 }, 47627 [data, onChange, setValue] 47628 ); 47629 const handleInputChange = (0, import_element141.useCallback)( 47630 (newValue) => { 47631 onChange(setValue({ item: data, value: newValue || "" })); 47632 }, 47633 [data, onChange, setValue] 47634 ); 47635 return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)( 47636 ValidatedInputControl3, 47637 { 47638 required: !!field.isValid?.required, 47639 markWhenOptional, 47640 customValidity: getCustomValidity(isValid2, validity), 47641 label, 47642 placeholder, 47643 value, 47644 help: description, 47645 onChange: handleInputChange, 47646 hideLabelFromVision, 47647 type: "text", 47648 disabled: disabled2, 47649 prefix: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_components125.__experimentalInputControlPrefixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)( 47650 ColorPickerDropdown, 47651 { 47652 color: value, 47653 onColorChange: handleColorChange, 47654 disabled: disabled2 47655 } 47656 ) }) 47657 } 47658 ); 47659 } 47660 47661 // packages/dataviews/build-module/components/dataform-controls/password.mjs 47662 var import_components126 = __toESM(require_components(), 1); 47663 var import_element142 = __toESM(require_element(), 1); 47664 var import_i18n109 = __toESM(require_i18n(), 1); 47665 var import_jsx_runtime267 = __toESM(require_jsx_runtime(), 1); 47666 function Password({ 47667 data, 47668 field, 47669 onChange, 47670 hideLabelFromVision, 47671 markWhenOptional, 47672 validity 47673 }) { 47674 const [isVisible2, setIsVisible] = (0, import_element142.useState)(false); 47675 const disabled2 = field.isDisabled({ item: data, field }); 47676 const toggleVisibility = (0, import_element142.useCallback)(() => { 47677 setIsVisible((prev) => !prev); 47678 }, []); 47679 return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)( 47680 ValidatedText, 47681 { 47682 ...{ 47683 data, 47684 field, 47685 onChange, 47686 hideLabelFromVision, 47687 markWhenOptional, 47688 validity, 47689 type: isVisible2 ? "text" : "password", 47690 suffix: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_components126.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)( 47691 import_components126.Button, 47692 { 47693 icon: isVisible2 ? unseen_default : seen_default, 47694 onClick: toggleVisibility, 47695 size: "small", 47696 label: isVisible2 ? (0, import_i18n109.__)("Hide password") : (0, import_i18n109.__)("Show password"), 47697 disabled: disabled2, 47698 accessibleWhenDisabled: true 47699 } 47700 ) }) 47701 } 47702 } 47703 ); 47704 } 47705 47706 // packages/dataviews/build-module/field-types/utils/has-elements.mjs 47707 function hasElements(field) { 47708 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function"; 47709 } 47710 47711 // packages/dataviews/build-module/components/dataform-controls/index.mjs 47712 var import_jsx_runtime268 = __toESM(require_jsx_runtime(), 1); 47713 var FORM_CONTROLS = { 47714 adaptiveSelect: AdaptiveSelect, 47715 array: ArrayControl, 47716 checkbox: Checkbox, 47717 color: Color, 47718 combobox: Combobox3, 47719 datetime: DateTime, 47720 date: DateControl, 47721 email: Email, 47722 telephone: Telephone, 47723 url: Url, 47724 integer: Integer, 47725 number: Number2, 47726 password: Password, 47727 radio: Radio, 47728 select: Select, 47729 text: Text3, 47730 toggle: Toggle, 47731 textarea: Textarea, 47732 toggleGroup: ToggleGroup 47733 }; 47734 function isEditConfig(value) { 47735 return value && typeof value === "object" && typeof value.control === "string"; 47736 } 47737 function createConfiguredControl(config2) { 47738 const { control, ...controlConfig } = config2; 47739 const BaseControlType = getControlByType(control); 47740 if (BaseControlType === null) { 47741 return null; 47742 } 47743 return function ConfiguredControl(props) { 47744 return /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(BaseControlType, { ...props, config: controlConfig }); 47745 }; 47746 } 47747 function getControl(field, fallback) { 47748 if (typeof field.Edit === "function") { 47749 return field.Edit; 47750 } 47751 if (typeof field.Edit === "string") { 47752 return getControlByType(field.Edit); 47753 } 47754 if (isEditConfig(field.Edit)) { 47755 return createConfiguredControl(field.Edit); 47756 } 47757 if (hasElements(field) && field.type !== "array") { 47758 return getControlByType("adaptiveSelect"); 47759 } 47760 if (fallback === null) { 47761 return null; 47762 } 47763 return getControlByType(fallback); 47764 } 47765 function getControlByType(type) { 47766 if (Object.keys(FORM_CONTROLS).includes(type)) { 47767 return FORM_CONTROLS[type]; 47768 } 47769 return null; 47770 } 47771 47772 // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs 47773 function getFilterBy(field, defaultOperators, validOperators) { 47774 if (field.filterBy === false) { 47775 return false; 47776 } 47777 const operators = field.filterBy?.operators?.filter( 47778 (op) => validOperators.includes(op) 47779 ) ?? defaultOperators; 47780 if (operators.length === 0) { 47781 return false; 47782 } 47783 return { 47784 isPrimary: !!field.filterBy?.isPrimary, 47785 operators 47786 }; 47787 } 47788 var get_filter_by_default = getFilterBy; 47789 47790 // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs 47791 var getValueFromId = (id) => ({ item }) => { 47792 const path = id.split("."); 47793 let value = item; 47794 for (const segment of path) { 47795 if (value.hasOwnProperty(segment)) { 47796 value = value[segment]; 47797 } else { 47798 value = void 0; 47799 } 47800 } 47801 return value; 47802 }; 47803 var get_value_from_id_default = getValueFromId; 47804 47805 // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs 47806 var setValueFromId = (id) => ({ value }) => { 47807 const path = id.split("."); 47808 const result = {}; 47809 let current = result; 47810 for (const segment of path.slice(0, -1)) { 47811 current[segment] = {}; 47812 current = current[segment]; 47813 } 47814 current[path.at(-1)] = value; 47815 return result; 47816 }; 47817 var set_value_from_id_default = setValueFromId; 47818 47819 // packages/dataviews/build-module/field-types/email.mjs 47820 var import_i18n110 = __toESM(require_i18n(), 1); 47821 47822 // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs 47823 function RenderFromElements({ 47824 item, 47825 field 47826 }) { 47827 const { elements: elements2, isLoading } = useElements({ 47828 elements: field.elements, 47829 getElements: field.getElements 47830 }); 47831 const value = field.getValue({ item }); 47832 if (isLoading) { 47833 return value; 47834 } 47835 if (elements2.length === 0) { 47836 return value; 47837 } 47838 return elements2?.find((element) => element.value === value)?.label || field.getValue({ item }); 47839 } 47840 47841 // packages/dataviews/build-module/field-types/utils/render-default.mjs 47842 var import_jsx_runtime269 = __toESM(require_jsx_runtime(), 1); 47843 function render({ 47844 item, 47845 field 47846 }) { 47847 if (field.hasElements) { 47848 return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(RenderFromElements, { item, field }); 47849 } 47850 return field.getValueFormatted({ item, field }); 47851 } 47852 47853 // packages/dataviews/build-module/field-types/utils/sort-text.mjs 47854 var sort_text_default = (a2, b2, direction) => { 47855 return direction === "asc" ? a2.localeCompare(b2) : b2.localeCompare(a2); 47856 }; 47857 47858 // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs 47859 function isValidRequired(item, field) { 47860 const value = field.getValue({ item }); 47861 return ![void 0, "", null].includes(value); 47862 } 47863 47864 // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs 47865 function isValidMinLength(item, field) { 47866 if (typeof field.isValid.minLength?.constraint !== "number") { 47867 return false; 47868 } 47869 const value = field.getValue({ item }); 47870 if ([void 0, "", null].includes(value)) { 47871 return true; 47872 } 47873 return String(value).length >= field.isValid.minLength.constraint; 47874 } 47875 47876 // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs 47877 function isValidMaxLength(item, field) { 47878 if (typeof field.isValid.maxLength?.constraint !== "number") { 47879 return false; 47880 } 47881 const value = field.getValue({ item }); 47882 if ([void 0, "", null].includes(value)) { 47883 return true; 47884 } 47885 return String(value).length <= field.isValid.maxLength.constraint; 47886 } 47887 47888 // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs 47889 function isValidPattern(item, field) { 47890 if (field.isValid.pattern?.constraint === void 0) { 47891 return true; 47892 } 47893 try { 47894 const regexp = new RegExp(field.isValid.pattern.constraint); 47895 const value = field.getValue({ item }); 47896 if ([void 0, "", null].includes(value)) { 47897 return true; 47898 } 47899 return regexp.test(String(value)); 47900 } catch { 47901 return false; 47902 } 47903 } 47904 47905 // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs 47906 function isValidElements(item, field) { 47907 const elements2 = field.elements ?? []; 47908 const validValues = elements2.map((el) => el.value); 47909 if (validValues.length === 0) { 47910 return true; 47911 } 47912 const value = field.getValue({ item }); 47913 return [].concat(value).every((v2) => validValues.includes(v2)); 47914 } 47915 47916 // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs 47917 function getValueFormatted({ 47918 item, 47919 field 47920 }) { 47921 return field.getValue({ item }); 47922 } 47923 var get_value_formatted_default_default = getValueFormatted; 47924 47925 // packages/dataviews/build-module/field-types/email.mjs 47926 var emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; 47927 function isValidCustom(item, field) { 47928 const value = field.getValue({ item }); 47929 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) { 47930 return (0, import_i18n110.__)("Value must be a valid email address."); 47931 } 47932 return null; 47933 } 47934 var email_default = { 47935 type: "email", 47936 render, 47937 Edit: "email", 47938 sort: sort_text_default, 47939 enableSorting: true, 47940 enableGlobalSearch: false, 47941 defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2], 47942 validOperators: [ 47943 OPERATOR_IS2, 47944 OPERATOR_IS_NOT, 47945 OPERATOR_CONTAINS, 47946 OPERATOR_NOT_CONTAINS, 47947 OPERATOR_STARTS_WITH, 47948 // Multiple selection 47949 OPERATOR_IS_ANY2, 47950 OPERATOR_IS_NONE2, 47951 OPERATOR_IS_ALL, 47952 OPERATOR_IS_NOT_ALL 47953 ], 47954 format: {}, 47955 getValueFormatted: get_value_formatted_default_default, 47956 validate: { 47957 required: isValidRequired, 47958 pattern: isValidPattern, 47959 minLength: isValidMinLength, 47960 maxLength: isValidMaxLength, 47961 elements: isValidElements, 47962 custom: isValidCustom 47963 } 47964 }; 47965 47966 // packages/dataviews/build-module/field-types/integer.mjs 47967 var import_i18n111 = __toESM(require_i18n(), 1); 47968 47969 // packages/dataviews/build-module/field-types/utils/sort-number.mjs 47970 var sort_number_default = (a2, b2, direction) => { 47971 return direction === "asc" ? a2 - b2 : b2 - a2; 47972 }; 47973 47974 // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs 47975 function isValidMin(item, field) { 47976 if (typeof field.isValid.min?.constraint !== "number") { 47977 return false; 47978 } 47979 const value = field.getValue({ item }); 47980 if ([void 0, "", null].includes(value)) { 47981 return true; 47982 } 47983 return Number(value) >= field.isValid.min.constraint; 47984 } 47985 47986 // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs 47987 function isValidMax(item, field) { 47988 if (typeof field.isValid.max?.constraint !== "number") { 47989 return false; 47990 } 47991 const value = field.getValue({ item }); 47992 if ([void 0, "", null].includes(value)) { 47993 return true; 47994 } 47995 return Number(value) <= field.isValid.max.constraint; 47996 } 47997 47998 // packages/dataviews/build-module/field-types/integer.mjs 47999 var format2 = { 48000 separatorThousand: "," 48001 }; 48002 function getValueFormatted2({ 48003 item, 48004 field 48005 }) { 48006 let value = field.getValue({ item }); 48007 if (value === null || value === void 0) { 48008 return ""; 48009 } 48010 value = Number(value); 48011 if (!Number.isFinite(value)) { 48012 return String(value); 48013 } 48014 let formatInteger; 48015 if (field.type !== "integer") { 48016 formatInteger = format2; 48017 } else { 48018 formatInteger = field.format; 48019 } 48020 const { separatorThousand } = formatInteger; 48021 const integerValue = Math.trunc(value); 48022 if (!separatorThousand) { 48023 return String(integerValue); 48024 } 48025 return String(integerValue).replace( 48026 /\B(?=(\d{3})+(?!\d))/g, 48027 separatorThousand 48028 ); 48029 } 48030 function isValidCustom2(item, field) { 48031 const value = field.getValue({ item }); 48032 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) { 48033 return (0, import_i18n111.__)("Value must be an integer."); 48034 } 48035 return null; 48036 } 48037 var integer_default = { 48038 type: "integer", 48039 render, 48040 Edit: "integer", 48041 sort: sort_number_default, 48042 enableSorting: true, 48043 enableGlobalSearch: false, 48044 defaultOperators: [ 48045 OPERATOR_IS2, 48046 OPERATOR_IS_NOT, 48047 OPERATOR_LESS_THAN, 48048 OPERATOR_GREATER_THAN, 48049 OPERATOR_LESS_THAN_OR_EQUAL, 48050 OPERATOR_GREATER_THAN_OR_EQUAL, 48051 OPERATOR_BETWEEN 48052 ], 48053 validOperators: [ 48054 // Single-selection 48055 OPERATOR_IS2, 48056 OPERATOR_IS_NOT, 48057 OPERATOR_LESS_THAN, 48058 OPERATOR_GREATER_THAN, 48059 OPERATOR_LESS_THAN_OR_EQUAL, 48060 OPERATOR_GREATER_THAN_OR_EQUAL, 48061 OPERATOR_BETWEEN, 48062 // Multiple-selection 48063 OPERATOR_IS_ANY2, 48064 OPERATOR_IS_NONE2, 48065 OPERATOR_IS_ALL, 48066 OPERATOR_IS_NOT_ALL 48067 ], 48068 format: format2, 48069 getValueFormatted: getValueFormatted2, 48070 validate: { 48071 required: isValidRequired, 48072 min: isValidMin, 48073 max: isValidMax, 48074 elements: isValidElements, 48075 custom: isValidCustom2 48076 } 48077 }; 48078 48079 // packages/dataviews/build-module/field-types/number.mjs 48080 var import_i18n112 = __toESM(require_i18n(), 1); 48081 var format3 = { 48082 separatorThousand: ",", 48083 separatorDecimal: ".", 48084 decimals: 2 48085 }; 48086 function getValueFormatted3({ 48087 item, 48088 field 48089 }) { 48090 let value = field.getValue({ item }); 48091 if (value === null || value === void 0) { 48092 return ""; 48093 } 48094 value = Number(value); 48095 if (!Number.isFinite(value)) { 48096 return String(value); 48097 } 48098 let formatNumber; 48099 if (field.type !== "number") { 48100 formatNumber = format3; 48101 } else { 48102 formatNumber = field.format; 48103 } 48104 const { separatorThousand, separatorDecimal, decimals } = formatNumber; 48105 const fixedValue = value.toFixed(decimals); 48106 const [integerPart, decimalPart] = fixedValue.split("."); 48107 const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart; 48108 return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart; 48109 } 48110 function isEmpty2(value) { 48111 return value === "" || value === void 0 || value === null; 48112 } 48113 function isValidCustom3(item, field) { 48114 const value = field.getValue({ item }); 48115 if (!isEmpty2(value) && !Number.isFinite(value)) { 48116 return (0, import_i18n112.__)("Value must be a number."); 48117 } 48118 return null; 48119 } 48120 var number_default = { 48121 type: "number", 48122 render, 48123 Edit: "number", 48124 sort: sort_number_default, 48125 enableSorting: true, 48126 enableGlobalSearch: false, 48127 defaultOperators: [ 48128 OPERATOR_IS2, 48129 OPERATOR_IS_NOT, 48130 OPERATOR_LESS_THAN, 48131 OPERATOR_GREATER_THAN, 48132 OPERATOR_LESS_THAN_OR_EQUAL, 48133 OPERATOR_GREATER_THAN_OR_EQUAL, 48134 OPERATOR_BETWEEN 48135 ], 48136 validOperators: [ 48137 // Single-selection 48138 OPERATOR_IS2, 48139 OPERATOR_IS_NOT, 48140 OPERATOR_LESS_THAN, 48141 OPERATOR_GREATER_THAN, 48142 OPERATOR_LESS_THAN_OR_EQUAL, 48143 OPERATOR_GREATER_THAN_OR_EQUAL, 48144 OPERATOR_BETWEEN, 48145 // Multiple-selection 48146 OPERATOR_IS_ANY2, 48147 OPERATOR_IS_NONE2, 48148 OPERATOR_IS_ALL, 48149 OPERATOR_IS_NOT_ALL 48150 ], 48151 format: format3, 48152 getValueFormatted: getValueFormatted3, 48153 validate: { 48154 required: isValidRequired, 48155 min: isValidMin, 48156 max: isValidMax, 48157 elements: isValidElements, 48158 custom: isValidCustom3 48159 } 48160 }; 48161 48162 // packages/dataviews/build-module/field-types/text.mjs 48163 var text_default = { 48164 type: "text", 48165 render, 48166 Edit: "text", 48167 sort: sort_text_default, 48168 enableSorting: true, 48169 enableGlobalSearch: false, 48170 defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2], 48171 validOperators: [ 48172 // Single selection 48173 OPERATOR_IS2, 48174 OPERATOR_IS_NOT, 48175 OPERATOR_CONTAINS, 48176 OPERATOR_NOT_CONTAINS, 48177 OPERATOR_STARTS_WITH, 48178 // Multiple selection 48179 OPERATOR_IS_ANY2, 48180 OPERATOR_IS_NONE2, 48181 OPERATOR_IS_ALL, 48182 OPERATOR_IS_NOT_ALL 48183 ], 48184 format: {}, 48185 getValueFormatted: get_value_formatted_default_default, 48186 validate: { 48187 required: isValidRequired, 48188 pattern: isValidPattern, 48189 minLength: isValidMinLength, 48190 maxLength: isValidMaxLength, 48191 elements: isValidElements 48192 } 48193 }; 48194 48195 // packages/dataviews/build-module/field-types/datetime.mjs 48196 var import_date8 = __toESM(require_date(), 1); 48197 48198 // packages/dataviews/build-module/field-types/utils/is-valid-date-boundary.mjs 48199 var import_date7 = __toESM(require_date(), 1); 48200 function parseDateLike(value) { 48201 if (!value) { 48202 return null; 48203 } 48204 if (!isValid(new Date(value))) { 48205 return null; 48206 } 48207 const parsed = (0, import_date7.getDate)(value); 48208 return parsed && isValid(parsed) ? parsed : null; 48209 } 48210 function validateDateLikeBoundary(item, field, boundary) { 48211 const constraint = field.isValid[boundary]?.constraint; 48212 if (typeof constraint !== "string") { 48213 return false; 48214 } 48215 const value = field.getValue({ item }); 48216 const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value; 48217 if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") { 48218 return true; 48219 } 48220 const parsedConstraint = parseDateLike(constraint); 48221 const parsedValue = parseDateLike(String(boundaryValue)); 48222 return !!parsedConstraint && !!parsedValue && (boundary === "min" ? parsedValue.getTime() >= parsedConstraint.getTime() : parsedValue.getTime() <= parsedConstraint.getTime()); 48223 } 48224 function isValidMinDate(item, field) { 48225 return validateDateLikeBoundary(item, field, "min"); 48226 } 48227 function isValidMaxDate(item, field) { 48228 return validateDateLikeBoundary(item, field, "max"); 48229 } 48230 48231 // packages/dataviews/build-module/field-types/datetime.mjs 48232 var format4 = { 48233 datetime: (0, import_date8.getSettings)().formats.datetime, 48234 weekStartsOn: (0, import_date8.getSettings)().l10n.startOfWeek 48235 }; 48236 function getValueFormatted4({ 48237 item, 48238 field 48239 }) { 48240 const value = field.getValue({ item }); 48241 if (["", void 0, null].includes(value)) { 48242 return ""; 48243 } 48244 let formatDatetime; 48245 if (field.type !== "datetime") { 48246 formatDatetime = format4; 48247 } else { 48248 formatDatetime = field.format; 48249 } 48250 return (0, import_date8.dateI18n)(formatDatetime.datetime, (0, import_date8.getDate)(value)); 48251 } 48252 var sort = (a2, b2, direction) => { 48253 const timeA = new Date(a2).getTime(); 48254 const timeB = new Date(b2).getTime(); 48255 return direction === "asc" ? timeA - timeB : timeB - timeA; 48256 }; 48257 var datetime_default = { 48258 type: "datetime", 48259 render, 48260 Edit: "datetime", 48261 sort, 48262 enableSorting: true, 48263 enableGlobalSearch: false, 48264 defaultOperators: [ 48265 OPERATOR_ON, 48266 OPERATOR_NOT_ON, 48267 OPERATOR_BEFORE2, 48268 OPERATOR_AFTER2, 48269 OPERATOR_BEFORE_INC, 48270 OPERATOR_AFTER_INC, 48271 OPERATOR_IN_THE_PAST, 48272 OPERATOR_OVER 48273 ], 48274 validOperators: [ 48275 OPERATOR_ON, 48276 OPERATOR_NOT_ON, 48277 OPERATOR_BEFORE2, 48278 OPERATOR_AFTER2, 48279 OPERATOR_BEFORE_INC, 48280 OPERATOR_AFTER_INC, 48281 OPERATOR_IN_THE_PAST, 48282 OPERATOR_OVER 48283 ], 48284 format: format4, 48285 getValueFormatted: getValueFormatted4, 48286 validate: { 48287 required: isValidRequired, 48288 elements: isValidElements, 48289 min: isValidMinDate, 48290 max: isValidMaxDate 48291 } 48292 }; 48293 48294 // packages/dataviews/build-module/field-types/date.mjs 48295 var import_date9 = __toESM(require_date(), 1); 48296 var format5 = { 48297 date: (0, import_date9.getSettings)().formats.date, 48298 weekStartsOn: (0, import_date9.getSettings)().l10n.startOfWeek 48299 }; 48300 function getValueFormatted5({ 48301 item, 48302 field 48303 }) { 48304 const value = field.getValue({ item }); 48305 if (["", void 0, null].includes(value)) { 48306 return ""; 48307 } 48308 let formatDate2; 48309 if (field.type !== "date") { 48310 formatDate2 = format5; 48311 } else { 48312 formatDate2 = field.format; 48313 } 48314 return (0, import_date9.dateI18n)(formatDate2.date, (0, import_date9.getDate)(value)); 48315 } 48316 var sort2 = (a2, b2, direction) => { 48317 const timeA = new Date(a2).getTime(); 48318 const timeB = new Date(b2).getTime(); 48319 return direction === "asc" ? timeA - timeB : timeB - timeA; 48320 }; 48321 var date_default = { 48322 type: "date", 48323 render, 48324 Edit: "date", 48325 sort: sort2, 48326 enableSorting: true, 48327 enableGlobalSearch: false, 48328 defaultOperators: [ 48329 OPERATOR_ON, 48330 OPERATOR_NOT_ON, 48331 OPERATOR_BEFORE2, 48332 OPERATOR_AFTER2, 48333 OPERATOR_BEFORE_INC, 48334 OPERATOR_AFTER_INC, 48335 OPERATOR_IN_THE_PAST, 48336 OPERATOR_OVER, 48337 OPERATOR_BETWEEN 48338 ], 48339 validOperators: [ 48340 OPERATOR_ON, 48341 OPERATOR_NOT_ON, 48342 OPERATOR_BEFORE2, 48343 OPERATOR_AFTER2, 48344 OPERATOR_BEFORE_INC, 48345 OPERATOR_AFTER_INC, 48346 OPERATOR_IN_THE_PAST, 48347 OPERATOR_OVER, 48348 OPERATOR_BETWEEN 48349 ], 48350 format: format5, 48351 getValueFormatted: getValueFormatted5, 48352 validate: { 48353 required: isValidRequired, 48354 elements: isValidElements, 48355 min: isValidMinDate, 48356 max: isValidMaxDate 48357 } 48358 }; 48359 48360 // packages/dataviews/build-module/field-types/boolean.mjs 48361 var import_i18n113 = __toESM(require_i18n(), 1); 48362 48363 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs 48364 function isValidRequiredForBool(item, field) { 48365 const value = field.getValue({ item }); 48366 return value === true; 48367 } 48368 48369 // packages/dataviews/build-module/field-types/boolean.mjs 48370 function getValueFormatted6({ 48371 item, 48372 field 48373 }) { 48374 const value = field.getValue({ item }); 48375 if (value === true) { 48376 return (0, import_i18n113.__)("True"); 48377 } 48378 if (value === false) { 48379 return (0, import_i18n113.__)("False"); 48380 } 48381 return ""; 48382 } 48383 function isValidCustom4(item, field) { 48384 const value = field.getValue({ item }); 48385 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) { 48386 return (0, import_i18n113.__)("Value must be true, false, or undefined"); 48387 } 48388 return null; 48389 } 48390 var sort3 = (a2, b2, direction) => { 48391 const boolA = Boolean(a2); 48392 const boolB = Boolean(b2); 48393 if (boolA === boolB) { 48394 return 0; 48395 } 48396 if (direction === "asc") { 48397 return boolA ? 1 : -1; 48398 } 48399 return boolA ? -1 : 1; 48400 }; 48401 var boolean_default = { 48402 type: "boolean", 48403 render, 48404 Edit: "checkbox", 48405 sort: sort3, 48406 validate: { 48407 required: isValidRequiredForBool, 48408 elements: isValidElements, 48409 custom: isValidCustom4 48410 }, 48411 enableSorting: true, 48412 enableGlobalSearch: false, 48413 defaultOperators: [OPERATOR_IS2, OPERATOR_IS_NOT], 48414 validOperators: [OPERATOR_IS2, OPERATOR_IS_NOT], 48415 format: {}, 48416 getValueFormatted: getValueFormatted6 48417 }; 48418 48419 // packages/dataviews/build-module/field-types/media.mjs 48420 var media_default2 = { 48421 type: "media", 48422 render: () => null, 48423 Edit: null, 48424 sort: () => 0, 48425 enableSorting: false, 48426 enableGlobalSearch: false, 48427 defaultOperators: [], 48428 validOperators: [], 48429 format: {}, 48430 getValueFormatted: get_value_formatted_default_default, 48431 // cannot validate any constraint, so 48432 // the only available validation for the field author 48433 // would be providing a custom validator. 48434 validate: {} 48435 }; 48436 48437 // packages/dataviews/build-module/field-types/array.mjs 48438 var import_i18n114 = __toESM(require_i18n(), 1); 48439 48440 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs 48441 function isValidRequiredForArray(item, field) { 48442 const value = field.getValue({ item }); 48443 return Array.isArray(value) && value.length > 0 && value.every( 48444 (element) => ![void 0, "", null].includes(element) 48445 ); 48446 } 48447 48448 // packages/dataviews/build-module/field-types/array.mjs 48449 function getValueFormatted7({ 48450 item, 48451 field 48452 }) { 48453 const value = field.getValue({ item }); 48454 const arr = Array.isArray(value) ? value : []; 48455 return arr.join(", "); 48456 } 48457 function render2({ item, field }) { 48458 return getValueFormatted7({ item, field }); 48459 } 48460 function isValidCustom5(item, field) { 48461 const value = field.getValue({ item }); 48462 if (![void 0, "", null].includes(value) && !Array.isArray(value)) { 48463 return (0, import_i18n114.__)("Value must be an array."); 48464 } 48465 if (!value.every((v2) => typeof v2 === "string")) { 48466 return (0, import_i18n114.__)("Every value must be a string."); 48467 } 48468 return null; 48469 } 48470 var sort4 = (a2, b2, direction) => { 48471 const arrA = Array.isArray(a2) ? a2 : []; 48472 const arrB = Array.isArray(b2) ? b2 : []; 48473 if (arrA.length !== arrB.length) { 48474 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length; 48475 } 48476 const joinedA = arrA.join(","); 48477 const joinedB = arrB.join(","); 48478 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA); 48479 }; 48480 var array_default = { 48481 type: "array", 48482 render: render2, 48483 Edit: "array", 48484 sort: sort4, 48485 enableSorting: true, 48486 enableGlobalSearch: false, 48487 defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2], 48488 validOperators: [ 48489 OPERATOR_IS_ANY2, 48490 OPERATOR_IS_NONE2, 48491 OPERATOR_IS_ALL, 48492 OPERATOR_IS_NOT_ALL 48493 ], 48494 format: {}, 48495 getValueFormatted: getValueFormatted7, 48496 validate: { 48497 required: isValidRequiredForArray, 48498 elements: isValidElements, 48499 custom: isValidCustom5 48500 } 48501 }; 48502 48503 // packages/dataviews/build-module/field-types/password.mjs 48504 function getValueFormatted8({ 48505 item, 48506 field 48507 }) { 48508 return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : ""; 48509 } 48510 var password_default = { 48511 type: "password", 48512 render, 48513 Edit: "password", 48514 sort: () => 0, 48515 // Passwords should not be sortable for security reasons 48516 enableSorting: false, 48517 enableGlobalSearch: false, 48518 defaultOperators: [], 48519 validOperators: [], 48520 format: {}, 48521 getValueFormatted: getValueFormatted8, 48522 validate: { 48523 required: isValidRequired, 48524 pattern: isValidPattern, 48525 minLength: isValidMinLength, 48526 maxLength: isValidMaxLength, 48527 elements: isValidElements 48528 } 48529 }; 48530 48531 // packages/dataviews/build-module/field-types/telephone.mjs 48532 var telephone_default = { 48533 type: "telephone", 48534 render, 48535 Edit: "telephone", 48536 sort: sort_text_default, 48537 enableSorting: true, 48538 enableGlobalSearch: false, 48539 defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2], 48540 validOperators: [ 48541 OPERATOR_IS2, 48542 OPERATOR_IS_NOT, 48543 OPERATOR_CONTAINS, 48544 OPERATOR_NOT_CONTAINS, 48545 OPERATOR_STARTS_WITH, 48546 // Multiple selection 48547 OPERATOR_IS_ANY2, 48548 OPERATOR_IS_NONE2, 48549 OPERATOR_IS_ALL, 48550 OPERATOR_IS_NOT_ALL 48551 ], 48552 format: {}, 48553 getValueFormatted: get_value_formatted_default_default, 48554 validate: { 48555 required: isValidRequired, 48556 pattern: isValidPattern, 48557 minLength: isValidMinLength, 48558 maxLength: isValidMaxLength, 48559 elements: isValidElements 48560 } 48561 }; 48562 48563 // packages/dataviews/build-module/field-types/color.mjs 48564 var import_i18n115 = __toESM(require_i18n(), 1); 48565 var import_jsx_runtime270 = __toESM(require_jsx_runtime(), 1); 48566 function render3({ item, field }) { 48567 if (field.hasElements) { 48568 return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(RenderFromElements, { item, field }); 48569 } 48570 const value = get_value_formatted_default_default({ item, field }); 48571 if (!value || !w(value).isValid()) { 48572 return value; 48573 } 48574 return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [ 48575 /* @__PURE__ */ (0, import_jsx_runtime270.jsx)( 48576 "div", 48577 { 48578 style: { 48579 width: "16px", 48580 height: "16px", 48581 borderRadius: "50%", 48582 backgroundColor: value, 48583 border: "1px solid #ddd", 48584 flexShrink: 0 48585 } 48586 } 48587 ), 48588 /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("span", { children: value }) 48589 ] }); 48590 } 48591 function isValidCustom6(item, field) { 48592 const value = field.getValue({ item }); 48593 if (![void 0, "", null].includes(value) && !w(value).isValid()) { 48594 return (0, import_i18n115.__)("Value must be a valid color."); 48595 } 48596 return null; 48597 } 48598 var sort5 = (a2, b2, direction) => { 48599 const colorA = w(a2); 48600 const colorB = w(b2); 48601 if (!colorA.isValid() && !colorB.isValid()) { 48602 return 0; 48603 } 48604 if (!colorA.isValid()) { 48605 return direction === "asc" ? 1 : -1; 48606 } 48607 if (!colorB.isValid()) { 48608 return direction === "asc" ? -1 : 1; 48609 } 48610 const hslA = colorA.toHsl(); 48611 const hslB = colorB.toHsl(); 48612 if (hslA.h !== hslB.h) { 48613 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h; 48614 } 48615 if (hslA.s !== hslB.s) { 48616 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s; 48617 } 48618 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l; 48619 }; 48620 var color_default = { 48621 type: "color", 48622 render: render3, 48623 Edit: "color", 48624 sort: sort5, 48625 enableSorting: true, 48626 enableGlobalSearch: false, 48627 defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2], 48628 validOperators: [ 48629 OPERATOR_IS2, 48630 OPERATOR_IS_NOT, 48631 OPERATOR_IS_ANY2, 48632 OPERATOR_IS_NONE2 48633 ], 48634 format: {}, 48635 getValueFormatted: get_value_formatted_default_default, 48636 validate: { 48637 required: isValidRequired, 48638 elements: isValidElements, 48639 custom: isValidCustom6 48640 } 48641 }; 48642 48643 // packages/dataviews/build-module/field-types/url.mjs 48644 var url_default = { 48645 type: "url", 48646 render, 48647 Edit: "url", 48648 sort: sort_text_default, 48649 enableSorting: true, 48650 enableGlobalSearch: false, 48651 defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2], 48652 validOperators: [ 48653 OPERATOR_IS2, 48654 OPERATOR_IS_NOT, 48655 OPERATOR_CONTAINS, 48656 OPERATOR_NOT_CONTAINS, 48657 OPERATOR_STARTS_WITH, 48658 // Multiple selection 48659 OPERATOR_IS_ANY2, 48660 OPERATOR_IS_NONE2, 48661 OPERATOR_IS_ALL, 48662 OPERATOR_IS_NOT_ALL 48663 ], 48664 format: {}, 48665 getValueFormatted: get_value_formatted_default_default, 48666 validate: { 48667 required: isValidRequired, 48668 pattern: isValidPattern, 48669 minLength: isValidMinLength, 48670 maxLength: isValidMaxLength, 48671 elements: isValidElements 48672 } 48673 }; 48674 48675 // packages/dataviews/build-module/field-types/no-type.mjs 48676 var sort6 = (a2, b2, direction) => { 48677 if (typeof a2 === "number" && typeof b2 === "number") { 48678 return sort_number_default(a2, b2, direction); 48679 } 48680 return sort_text_default(a2, b2, direction); 48681 }; 48682 var no_type_default = { 48683 // type: no type for this one 48684 render, 48685 Edit: null, 48686 sort: sort6, 48687 enableSorting: true, 48688 enableGlobalSearch: false, 48689 defaultOperators: [OPERATOR_IS2, OPERATOR_IS_NOT], 48690 validOperators: getAllOperatorNames(), 48691 format: {}, 48692 getValueFormatted: get_value_formatted_default_default, 48693 validate: { 48694 required: isValidRequired, 48695 elements: isValidElements 48696 } 48697 }; 48698 48699 // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs 48700 function supportsNumericRangeConstraint(type) { 48701 return type === "integer" || type === "number"; 48702 } 48703 function supportsDateRangeConstraint(type) { 48704 return type === "date" || type === "datetime"; 48705 } 48706 function normalizeRangeRule(value, fieldType, key) { 48707 const validator = fieldType.validate[key]; 48708 if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsDateRangeConstraint(fieldType.type))) { 48709 return { constraint: value, validate: validator }; 48710 } 48711 return void 0; 48712 } 48713 function getIsValid(field, fieldType) { 48714 const rules = field.isValid; 48715 let required; 48716 if (rules?.required === true && fieldType.validate.required !== void 0) { 48717 required = { 48718 constraint: true, 48719 validate: fieldType.validate.required 48720 }; 48721 } 48722 let elements2; 48723 if ((rules?.elements === true || // elements is enabled unless the field opts-out 48724 rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) { 48725 elements2 = { 48726 constraint: true, 48727 validate: fieldType.validate.elements 48728 }; 48729 } 48730 const min2 = normalizeRangeRule(rules?.min, fieldType, "min"); 48731 const max2 = normalizeRangeRule(rules?.max, fieldType, "max"); 48732 const minLengthValue = rules?.minLength; 48733 let minLength; 48734 if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) { 48735 minLength = { 48736 constraint: minLengthValue, 48737 validate: fieldType.validate.minLength 48738 }; 48739 } 48740 const maxLengthValue = rules?.maxLength; 48741 let maxLength; 48742 if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) { 48743 maxLength = { 48744 constraint: maxLengthValue, 48745 validate: fieldType.validate.maxLength 48746 }; 48747 } 48748 const patternValue = rules?.pattern; 48749 let pattern; 48750 if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) { 48751 pattern = { 48752 constraint: patternValue, 48753 validate: fieldType.validate.pattern 48754 }; 48755 } 48756 const custom = rules?.custom ?? fieldType.validate.custom; 48757 return { 48758 required, 48759 elements: elements2, 48760 min: min2, 48761 max: max2, 48762 minLength, 48763 maxLength, 48764 pattern, 48765 custom 48766 }; 48767 } 48768 48769 // packages/dataviews/build-module/field-types/utils/get-filter.mjs 48770 function getFilter(fieldType) { 48771 return fieldType.validOperators.reduce((accumulator, operator) => { 48772 const operatorObj = getOperatorByName(operator); 48773 if (operatorObj?.filter) { 48774 accumulator[operator] = operatorObj.filter; 48775 } 48776 return accumulator; 48777 }, {}); 48778 } 48779 48780 // packages/dataviews/build-module/field-types/utils/get-format.mjs 48781 function getFormat(field, fieldType) { 48782 return { 48783 ...fieldType.format, 48784 ...field.format 48785 }; 48786 } 48787 var get_format_default = getFormat; 48788 48789 // packages/dataviews/build-module/field-types/index.mjs 48790 function getFieldTypeByName(type) { 48791 const found = [ 48792 email_default, 48793 integer_default, 48794 number_default, 48795 text_default, 48796 datetime_default, 48797 date_default, 48798 boolean_default, 48799 media_default2, 48800 array_default, 48801 password_default, 48802 telephone_default, 48803 color_default, 48804 url_default 48805 ].find((fieldType) => fieldType?.type === type); 48806 if (!!found) { 48807 return found; 48808 } 48809 return no_type_default; 48810 } 48811 function normalizeFields(fields2) { 48812 return fields2.map((field) => { 48813 const fieldType = getFieldTypeByName(field.type); 48814 const getValue = field.getValue || get_value_from_id_default(field.id); 48815 const sort7 = function(a2, b2, direction) { 48816 const aValue = getValue({ item: a2 }); 48817 const bValue = getValue({ item: b2 }); 48818 return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction); 48819 }; 48820 return { 48821 id: field.id, 48822 label: field.label || field.id, 48823 header: field.header || field.label || field.id, 48824 description: field.description, 48825 placeholder: field.placeholder, 48826 getValue, 48827 setValue: field.setValue || set_value_from_id_default(field.id), 48828 elements: field.elements, 48829 getElements: field.getElements, 48830 hasElements: hasElements(field), 48831 isVisible: field.isVisible, 48832 isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled, 48833 enableHiding: field.enableHiding ?? true, 48834 readOnly: field.readOnly ?? false, 48835 // The type provides defaults for the following props 48836 type: fieldType.type, 48837 render: field.render ?? fieldType.render, 48838 Edit: getControl(field, fieldType.Edit), 48839 sort: sort7, 48840 enableSorting: field.enableSorting ?? fieldType.enableSorting, 48841 enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch, 48842 isValid: getIsValid(field, fieldType), 48843 filterBy: get_filter_by_default( 48844 field, 48845 fieldType.defaultOperators, 48846 fieldType.validOperators 48847 ), 48848 filter: getFilter(fieldType), 48849 format: get_format_default(field, fieldType), 48850 getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted 48851 }; 48852 }); 48853 } 48854 48855 // packages/dataviews/build-module/hooks/use-data.mjs 48856 var import_element143 = __toESM(require_element(), 1); 48857 function useData({ 48858 view, 48859 data: shownData, 48860 getItemId: getItemId2, 48861 isLoading, 48862 paginationInfo, 48863 selection 48864 }) { 48865 const isInfiniteScrollEnabled = view.infiniteScrollEnabled; 48866 const [hasInitiallyLoaded, setHasInitiallyLoaded] = (0, import_element143.useState)( 48867 !isLoading 48868 ); 48869 (0, import_element143.useEffect)(() => { 48870 if (!isLoading) { 48871 setHasInitiallyLoaded(true); 48872 } 48873 }, [isLoading]); 48874 const previousDataRef = (0, import_element143.useRef)(shownData); 48875 const previousPaginationInfoRef = (0, import_element143.useRef)(paginationInfo); 48876 (0, import_element143.useEffect)(() => { 48877 if (!isLoading) { 48878 previousDataRef.current = shownData; 48879 previousPaginationInfoRef.current = paginationInfo; 48880 } 48881 }, [shownData, isLoading, paginationInfo]); 48882 const [visibleEntries, setVisibleEntries] = (0, import_element143.useState)([]); 48883 const positionMapRef = (0, import_element143.useRef)(/* @__PURE__ */ new Map()); 48884 const allLoadedRecordsRef = (0, import_element143.useRef)([]); 48885 const prevViewParamsRef = (0, import_element143.useRef)({ 48886 search: void 0, 48887 filters: void 0, 48888 perPage: void 0 48889 }); 48890 const scrollDirectionRef = (0, import_element143.useRef)(void 0); 48891 const prevStartPositionRef = (0, import_element143.useRef)(void 0); 48892 const hasInitializedRef = (0, import_element143.useRef)(false); 48893 const allLoadedRecords = (0, import_element143.useMemo)(() => { 48894 if (view.startPosition !== void 0 && prevStartPositionRef.current !== void 0) { 48895 if (view.startPosition < prevStartPositionRef.current) { 48896 scrollDirectionRef.current = "up"; 48897 } else if (view.startPosition > prevStartPositionRef.current) { 48898 scrollDirectionRef.current = "down"; 48899 } 48900 } 48901 prevStartPositionRef.current = view.startPosition; 48902 const currentFiltersKey = JSON.stringify(view.filters ?? []); 48903 const prevFiltersKey = prevViewParamsRef.current.filters; 48904 const shouldReset = !hasInitializedRef.current || !view.infiniteScrollEnabled || view.search !== prevViewParamsRef.current.search || currentFiltersKey !== prevFiltersKey || view.perPage !== prevViewParamsRef.current.perPage; 48905 hasInitializedRef.current = true; 48906 prevViewParamsRef.current = { 48907 search: view.search, 48908 filters: currentFiltersKey, 48909 perPage: view.perPage 48910 }; 48911 if (shouldReset) { 48912 positionMapRef.current.clear(); 48913 scrollDirectionRef.current = void 0; 48914 const startPosition = view.search ? 1 : view.startPosition ?? 1; 48915 const records = shownData.map((record, index2) => { 48916 const position = startPosition + index2; 48917 positionMapRef.current.set(getItemId2(record), position); 48918 return { 48919 ...record, 48920 position 48921 }; 48922 }); 48923 allLoadedRecordsRef.current = records; 48924 return records; 48925 } 48926 const prev = allLoadedRecordsRef.current; 48927 const shownDataIds = new Set(shownData.map(getItemId2)); 48928 const scrollDirection = scrollDirectionRef.current; 48929 const basePosition = view.search ? 1 : view.startPosition ?? 1; 48930 const newRecords = shownData.map((record, index2) => { 48931 const itemId = getItemId2(record); 48932 const position = view.infiniteScrollEnabled ? basePosition + index2 : void 0; 48933 if (position !== void 0) { 48934 positionMapRef.current.set(itemId, position); 48935 } 48936 return { 48937 ...record, 48938 position 48939 }; 48940 }); 48941 if (newRecords.length === 0) { 48942 return prev; 48943 } 48944 const prevWithoutDuplicates = prev.filter( 48945 (record) => !shownDataIds.has(getItemId2(record)) 48946 ); 48947 const allRecords = scrollDirection === "up" ? [...newRecords, ...prevWithoutDuplicates] : [...prevWithoutDuplicates, ...newRecords]; 48948 allRecords.sort((a2, b2) => { 48949 const posA = a2.position; 48950 const posB = b2.position; 48951 return posA - posB; 48952 }); 48953 let result = allRecords; 48954 if (visibleEntries.length > 0) { 48955 const visibleMin = Math.min(...visibleEntries); 48956 const visibleMax = Math.max(...visibleEntries); 48957 const buffer = 20; 48958 const recordPositions = allRecords.map( 48959 (r3) => r3.position 48960 ); 48961 const minRecordPos = Math.min(...recordPositions); 48962 const maxRecordPos = Math.max(...recordPositions); 48963 const hasOverlap = !(maxRecordPos < visibleMin - buffer || minRecordPos > visibleMax + buffer); 48964 if (hasOverlap) { 48965 result = allRecords.filter((record) => { 48966 const itemId = getItemId2(record); 48967 const isSelected2 = selection?.includes(itemId); 48968 if (isSelected2) { 48969 return true; 48970 } 48971 const itemPosition = record.position; 48972 if (scrollDirection === "up") { 48973 return itemPosition <= visibleMax + buffer; 48974 } else if (scrollDirection === "down") { 48975 return itemPosition >= visibleMin - buffer; 48976 } 48977 return itemPosition >= visibleMin - buffer && itemPosition <= visibleMax + buffer; 48978 }); 48979 } 48980 } 48981 allLoadedRecordsRef.current = result; 48982 return result; 48983 }, [ 48984 shownData, 48985 view.search, 48986 view.filters, 48987 view.perPage, 48988 view.startPosition, 48989 view.infiniteScrollEnabled, 48990 visibleEntries, 48991 selection, 48992 getItemId2 48993 ]); 48994 if (!isInfiniteScrollEnabled) { 48995 const dataToReturn = isLoading && previousDataRef.current?.length ? previousDataRef.current : shownData; 48996 return { 48997 data: dataToReturn.map((item) => ({ 48998 ...item, 48999 position: void 0 49000 })), 49001 paginationInfo: isLoading && previousDataRef.current?.length ? previousPaginationInfoRef.current : paginationInfo, 49002 hasInitiallyLoaded, 49003 setVisibleEntries: void 0 49004 }; 49005 } 49006 return { 49007 data: allLoadedRecords, 49008 paginationInfo, 49009 hasInitiallyLoaded, 49010 setVisibleEntries 49011 }; 49012 } 49013 49014 // packages/dataviews/build-module/hooks/use-infinite-scroll.mjs 49015 var import_element144 = __toESM(require_element(), 1); 49016 var import_compose22 = __toESM(require_compose(), 1); 49017 function captureAnchorElement(container, anchorElementRef, direction) { 49018 const containerRect = container.getBoundingClientRect(); 49019 const centerY = containerRect.top + containerRect.height / 2; 49020 const items = Array.from(container.querySelectorAll("[aria-posinset]")); 49021 if (items.length === 0) { 49022 return false; 49023 } 49024 const bestAnchor = items.reduce((best, item) => { 49025 const itemRect = item.getBoundingClientRect(); 49026 const itemCenterY = itemRect.top + itemRect.height / 2; 49027 const distance = Math.abs(itemCenterY - centerY); 49028 const bestRect = best.getBoundingClientRect(); 49029 const bestCenterY = bestRect.top + bestRect.height / 2; 49030 const bestDistance = Math.abs(bestCenterY - centerY); 49031 return distance < bestDistance ? item : best; 49032 }); 49033 const posinset = Number(bestAnchor.getAttribute("aria-posinset")); 49034 const anchorRect = bestAnchor.getBoundingClientRect(); 49035 anchorElementRef.current = { 49036 posinset, 49037 viewportOffset: anchorRect.top - containerRect.top, 49038 direction 49039 }; 49040 return true; 49041 } 49042 function useInfiniteScroll({ 49043 view, 49044 onChangeView, 49045 isLoading, 49046 paginationInfo, 49047 containerRef, 49048 setVisibleEntries 49049 }) { 49050 const anchorElementRef = (0, import_element144.useRef)(null); 49051 const viewRef = (0, import_element144.useRef)(view); 49052 const isLoadingRef = (0, import_element144.useRef)(isLoading); 49053 const onChangeViewRef = (0, import_element144.useRef)(onChangeView); 49054 const totalItemsRef = (0, import_element144.useRef)(paginationInfo.totalItems); 49055 (0, import_element144.useLayoutEffect)(() => { 49056 viewRef.current = view; 49057 isLoadingRef.current = isLoading; 49058 onChangeViewRef.current = onChangeView; 49059 totalItemsRef.current = paginationInfo.totalItems; 49060 }, [view, isLoading, onChangeView, paginationInfo.totalItems]); 49061 const intersectionObserverCallback = (0, import_element144.useCallback)( 49062 (entries) => { 49063 if (!setVisibleEntries) { 49064 return; 49065 } 49066 setVisibleEntries((prev) => { 49067 const newVisibleEntries = new Set(prev); 49068 let hasChanged = false; 49069 entries.forEach((entry) => { 49070 const posInSet = Number( 49071 entry.target?.attributes?.getNamedItem( 49072 "aria-posinset" 49073 )?.value 49074 ); 49075 if (isNaN(posInSet)) { 49076 return; 49077 } 49078 if (entry.isIntersecting) { 49079 if (!newVisibleEntries.has(posInSet)) { 49080 newVisibleEntries.add(posInSet); 49081 hasChanged = true; 49082 } 49083 } else if (newVisibleEntries.has(posInSet)) { 49084 newVisibleEntries.delete(posInSet); 49085 hasChanged = true; 49086 } 49087 }); 49088 return hasChanged ? Array.from(newVisibleEntries).sort() : prev; 49089 }); 49090 }, 49091 [setVisibleEntries] 49092 ); 49093 (0, import_element144.useLayoutEffect)(() => { 49094 const container = containerRef.current; 49095 const anchor = anchorElementRef.current; 49096 if (!container || !view.infiniteScrollEnabled || !anchor || isLoading) { 49097 return; 49098 } 49099 const anchorElement = container.querySelector( 49100 `[aria-posinset="$anchor.posinset}"]` 49101 ); 49102 if (anchorElement) { 49103 const containerRect = container.getBoundingClientRect(); 49104 const anchorRect = anchorElement.getBoundingClientRect(); 49105 const currentOffset = anchorRect.top - containerRect.top; 49106 const scrollAdjustment = currentOffset - anchor.viewportOffset; 49107 if (Math.abs(scrollAdjustment) > 1) { 49108 container.scrollTop += scrollAdjustment; 49109 } 49110 } 49111 anchorElementRef.current = null; 49112 }, [containerRef, isLoading, view.infiniteScrollEnabled]); 49113 const intersectionObserverRef = (0, import_element144.useRef)( 49114 null 49115 ); 49116 (0, import_element144.useEffect)(() => { 49117 if (!view.infiniteScrollEnabled || !intersectionObserverCallback) { 49118 if (intersectionObserverRef.current) { 49119 intersectionObserverRef.current.disconnect(); 49120 intersectionObserverRef.current = null; 49121 } 49122 return; 49123 } 49124 intersectionObserverRef.current = new IntersectionObserver( 49125 intersectionObserverCallback, 49126 { root: null, rootMargin: "0px", threshold: 0.1 } 49127 ); 49128 return () => { 49129 if (intersectionObserverRef.current) { 49130 intersectionObserverRef.current.disconnect(); 49131 intersectionObserverRef.current = null; 49132 } 49133 }; 49134 }, [view.infiniteScrollEnabled, intersectionObserverCallback]); 49135 (0, import_element144.useEffect)(() => { 49136 if (!view.infiniteScrollEnabled || !containerRef.current) { 49137 return; 49138 } 49139 let lastScrollTop = 0; 49140 const BOTTOM_THRESHOLD = 600; 49141 const TOP_THRESHOLD = 800; 49142 const handleScroll = (0, import_compose22.throttle)((event) => { 49143 const currentView = viewRef.current; 49144 const totalItems = totalItemsRef.current; 49145 const target = event.target; 49146 const scrollTop = target.scrollTop; 49147 const scrollHeight = target.scrollHeight; 49148 const clientHeight = target.clientHeight; 49149 const scrollDirection = scrollTop > lastScrollTop ? "down" : "up"; 49150 lastScrollTop = scrollTop; 49151 if (isLoadingRef.current) { 49152 return; 49153 } 49154 const currentStartPosition = currentView.startPosition || 1; 49155 const batchSize = currentView.perPage || 10; 49156 const currentEndPosition = Math.min( 49157 currentStartPosition + batchSize, 49158 totalItems 49159 ); 49160 if (scrollDirection === "down" && scrollTop + clientHeight >= scrollHeight - BOTTOM_THRESHOLD) { 49161 if (currentEndPosition < totalItems) { 49162 const newStartPosition = currentEndPosition; 49163 captureAnchorElement(target, anchorElementRef, "down"); 49164 onChangeViewRef.current({ 49165 ...currentView, 49166 startPosition: newStartPosition 49167 }); 49168 } 49169 } 49170 if (scrollDirection === "up" && scrollTop <= TOP_THRESHOLD) { 49171 if (currentStartPosition > 1) { 49172 const calculatedStartPosition = currentStartPosition - batchSize; 49173 const newStartPosition = calculatedStartPosition < 6 ? 1 : calculatedStartPosition; 49174 captureAnchorElement(target, anchorElementRef, "up"); 49175 onChangeViewRef.current({ 49176 ...currentView, 49177 startPosition: newStartPosition 49178 }); 49179 } 49180 } 49181 }, 50); 49182 const container = containerRef.current; 49183 container.addEventListener("scroll", handleScroll); 49184 return () => { 49185 container.removeEventListener("scroll", handleScroll); 49186 handleScroll.cancel(); 49187 }; 49188 }, [containerRef, view.infiniteScrollEnabled]); 49189 return { 49190 intersectionObserver: intersectionObserverRef.current 49191 }; 49192 } 49193 49194 // packages/dataviews/build-module/dataviews/index.mjs 49195 var import_jsx_runtime271 = __toESM(require_jsx_runtime(), 1); 49196 var defaultGetItemId = (item) => item.id; 49197 var defaultIsItemClickable = () => true; 49198 var EMPTY_ARRAY9 = []; 49199 var DEFAULT_LAYOUTS = { table: {}, grid: {}, list: {} }; 49200 var dataViewsLayouts = VIEW_LAYOUTS.filter( 49201 (viewLayout) => !viewLayout.isPicker 49202 ); 49203 function DefaultUI({ 49204 header, 49205 search = true, 49206 searchLabel = void 0 49207 }) { 49208 const { view } = (0, import_element145.useContext)(dataviews_context_default); 49209 const isInfiniteScroll = view.infiniteScrollEnabled; 49210 return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_jsx_runtime271.Fragment, { children: [ 49211 /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)( 49212 Stack, 49213 { 49214 direction: "row", 49215 align: "top", 49216 justify: "space-between", 49217 className: clsx_default("dataviews__view-actions", { 49218 "dataviews__view-actions--infinite-scroll": isInfiniteScroll 49219 }), 49220 gap: "xs", 49221 children: [ 49222 /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)( 49223 Stack, 49224 { 49225 direction: "row", 49226 justify: "start", 49227 gap: "sm", 49228 className: "dataviews__search", 49229 children: [ 49230 search && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(dataviews_search_default, { label: searchLabel }), 49231 /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(toggle_default, {}) 49232 ] 49233 } 49234 ), 49235 /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: [ 49236 /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(dataviews_view_config_default, {}), 49237 header 49238 ] }) 49239 ] 49240 } 49241 ), 49242 /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }), 49243 /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(DataViewsLayout, {}), 49244 /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(DataViewsFooter, {}) 49245 ] }); 49246 } 49247 function DataViews({ 49248 view, 49249 onChangeView, 49250 fields: fields2, 49251 search = true, 49252 searchLabel = void 0, 49253 actions = EMPTY_ARRAY9, 49254 data, 49255 getItemId: getItemId2 = defaultGetItemId, 49256 getItemLevel: getItemLevel2, 49257 isLoading = false, 49258 paginationInfo, 49259 defaultLayouts: defaultLayoutsProperty = DEFAULT_LAYOUTS, 49260 selection: selectionProperty, 49261 onChangeSelection, 49262 onClickItem, 49263 renderItemLink, 49264 isItemClickable = defaultIsItemClickable, 49265 header, 49266 children, 49267 config: config2 = { perPageSizes: [10, 20, 50, 100] }, 49268 empty, 49269 onReset 49270 }) { 49271 const [selectionState, setSelectionState] = (0, import_element145.useState)([]); 49272 const isUncontrolled = selectionProperty === void 0 || onChangeSelection === void 0; 49273 const selection = isUncontrolled ? selectionState : selectionProperty; 49274 const { 49275 data: displayData, 49276 paginationInfo: displayPaginationInfo, 49277 hasInitiallyLoaded, 49278 setVisibleEntries 49279 } = useData({ 49280 view, 49281 data, 49282 getItemId: getItemId2, 49283 isLoading, 49284 selection, 49285 paginationInfo 49286 }); 49287 const containerRef = (0, import_element145.useRef)(null); 49288 const [containerWidth, setContainerWidth] = (0, import_element145.useState)(0); 49289 const resizeObserverRef = (0, import_compose23.useResizeObserver)( 49290 (resizeObserverEntries) => { 49291 setContainerWidth( 49292 resizeObserverEntries[0].borderBoxSize[0].inlineSize 49293 ); 49294 }, 49295 { box: "border-box" } 49296 ); 49297 const [openedFilter, setOpenedFilter] = (0, import_element145.useState)(null); 49298 function setSelectionWithChange(value) { 49299 const newValue = typeof value === "function" ? value(selection) : value; 49300 if (isUncontrolled) { 49301 setSelectionState(newValue); 49302 } 49303 if (onChangeSelection) { 49304 onChangeSelection(newValue); 49305 } 49306 } 49307 const _fields = (0, import_element145.useMemo)(() => normalizeFields(fields2), [fields2]); 49308 const _selection = (0, import_element145.useMemo)(() => { 49309 if (view.infiniteScrollEnabled) { 49310 return selection; 49311 } 49312 return selection.filter( 49313 (id) => data.some((item) => getItemId2(item) === id) 49314 ); 49315 }, [selection, data, getItemId2, view.infiniteScrollEnabled]); 49316 const filters = use_filters_default(_fields, view); 49317 const hasPrimaryOrLockedFilters = (0, import_element145.useMemo)( 49318 () => (filters || []).some( 49319 (filter) => filter.isPrimary || filter.isLocked 49320 ), 49321 [filters] 49322 ); 49323 const [isShowingFilter, setIsShowingFilter] = (0, import_element145.useState)( 49324 hasPrimaryOrLockedFilters 49325 ); 49326 const { intersectionObserver } = useInfiniteScroll({ 49327 view, 49328 onChangeView, 49329 isLoading, 49330 paginationInfo, 49331 containerRef, 49332 setVisibleEntries 49333 }); 49334 (0, import_element145.useEffect)(() => { 49335 if (hasPrimaryOrLockedFilters && !isShowingFilter) { 49336 setIsShowingFilter(true); 49337 } 49338 }, [hasPrimaryOrLockedFilters, isShowingFilter]); 49339 const defaultLayouts2 = (0, import_element145.useMemo)( 49340 () => Object.fromEntries( 49341 Object.entries(defaultLayoutsProperty).filter(([layoutType]) => { 49342 return dataViewsLayouts.some( 49343 (viewLayout) => viewLayout.type === layoutType 49344 ); 49345 }).map(([key, value]) => [ 49346 key, 49347 value === true ? {} : value 49348 ]) 49349 ), 49350 [defaultLayoutsProperty] 49351 ); 49352 if (!defaultLayouts2[view.type]) { 49353 return null; 49354 } 49355 return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)( 49356 dataviews_context_default.Provider, 49357 { 49358 value: { 49359 view, 49360 onChangeView, 49361 fields: _fields, 49362 actions, 49363 data: displayData, 49364 isLoading, 49365 paginationInfo: displayPaginationInfo, 49366 selection: _selection, 49367 onChangeSelection: setSelectionWithChange, 49368 openedFilter, 49369 setOpenedFilter, 49370 getItemId: getItemId2, 49371 getItemLevel: getItemLevel2, 49372 isItemClickable, 49373 onClickItem, 49374 renderItemLink, 49375 containerWidth, 49376 containerRef, 49377 resizeObserverRef, 49378 defaultLayouts: defaultLayouts2, 49379 filters, 49380 isShowingFilter, 49381 setIsShowingFilter, 49382 config: config2, 49383 empty, 49384 hasInitiallyLoaded, 49385 onReset, 49386 intersectionObserver 49387 }, 49388 children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "dataviews-wrapper", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)( 49389 DefaultUI, 49390 { 49391 header, 49392 search, 49393 searchLabel 49394 } 49395 ) }) 49396 } 49397 ); 49398 } 49399 var DataViewsSubComponents = DataViews; 49400 DataViewsSubComponents.BulkActionToolbar = BulkActionsFooter; 49401 DataViewsSubComponents.Filters = filters_default; 49402 DataViewsSubComponents.FiltersToggled = filters_toggled_default; 49403 DataViewsSubComponents.FiltersToggle = toggle_default; 49404 DataViewsSubComponents.Layout = DataViewsLayout; 49405 DataViewsSubComponents.LayoutSwitcher = ViewTypeMenu; 49406 DataViewsSubComponents.Pagination = DataViewsPagination; 49407 DataViewsSubComponents.Search = dataviews_search_default; 49408 DataViewsSubComponents.ViewConfig = DataviewsViewConfigDropdown; 49409 DataViewsSubComponents.Footer = DataViewsFooter; 49410 var dataviews_default = DataViewsSubComponents; 49411 49412 // packages/dataviews/build-module/dataform/index.mjs 49413 var import_element157 = __toESM(require_element(), 1); 49414 49415 // packages/dataviews/build-module/components/dataform-context/index.mjs 49416 var import_element146 = __toESM(require_element(), 1); 49417 var import_jsx_runtime272 = __toESM(require_jsx_runtime(), 1); 49418 var DataFormContext = (0, import_element146.createContext)({ 49419 fields: [] 49420 }); 49421 DataFormContext.displayName = "DataFormContext"; 49422 function DataFormProvider({ 49423 fields: fields2, 49424 children 49425 }) { 49426 return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(DataFormContext.Provider, { value: { fields: fields2 }, children }); 49427 } 49428 var dataform_context_default = DataFormContext; 49429 49430 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs 49431 var import_element156 = __toESM(require_element(), 1); 49432 49433 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs 49434 var import_element147 = __toESM(require_element(), 1); 49435 var import_components127 = __toESM(require_components(), 1); 49436 49437 // packages/dataviews/build-module/components/dataform-layouts/normalize-form.mjs 49438 var import_i18n116 = __toESM(require_i18n(), 1); 49439 var DEFAULT_LAYOUT = { 49440 type: "regular", 49441 labelPosition: "top" 49442 }; 49443 var normalizeCardSummaryField = (sum) => { 49444 if (typeof sum === "string") { 49445 return [{ id: sum, visibility: "when-collapsed" }]; 49446 } 49447 return sum.map((item) => { 49448 if (typeof item === "string") { 49449 return { id: item, visibility: "when-collapsed" }; 49450 } 49451 return { id: item.id, visibility: item.visibility }; 49452 }); 49453 }; 49454 function normalizeLayout(layout) { 49455 let normalizedLayout = DEFAULT_LAYOUT; 49456 if (layout?.type === "regular") { 49457 normalizedLayout = { 49458 type: "regular", 49459 labelPosition: layout?.labelPosition ?? "top" 49460 }; 49461 } else if (layout?.type === "panel") { 49462 const summary = layout.summary ?? []; 49463 const normalizedSummary = Array.isArray(summary) ? summary : [summary]; 49464 const openAs = layout?.openAs; 49465 let normalizedOpenAs; 49466 if (typeof openAs === "object" && openAs.type === "modal") { 49467 normalizedOpenAs = { 49468 type: "modal", 49469 applyLabel: openAs.applyLabel?.trim() || (0, import_i18n116.__)("Apply"), 49470 cancelLabel: openAs.cancelLabel?.trim() || (0, import_i18n116.__)("Cancel") 49471 }; 49472 } else if (openAs === "modal") { 49473 normalizedOpenAs = { 49474 type: "modal", 49475 applyLabel: (0, import_i18n116.__)("Apply"), 49476 cancelLabel: (0, import_i18n116.__)("Cancel") 49477 }; 49478 } else { 49479 normalizedOpenAs = { type: "dropdown" }; 49480 } 49481 normalizedLayout = { 49482 type: "panel", 49483 labelPosition: layout?.labelPosition ?? "side", 49484 openAs: normalizedOpenAs, 49485 summary: normalizedSummary, 49486 editVisibility: layout?.editVisibility ?? "on-hover" 49487 }; 49488 } else if (layout?.type === "card") { 49489 if (layout.withHeader === false) { 49490 normalizedLayout = { 49491 type: "card", 49492 withHeader: false, 49493 isOpened: true, 49494 summary: [], 49495 isCollapsible: false 49496 }; 49497 } else { 49498 const summary = layout.summary ?? []; 49499 normalizedLayout = { 49500 type: "card", 49501 withHeader: true, 49502 isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true, 49503 summary: normalizeCardSummaryField(summary), 49504 isCollapsible: layout.isCollapsible === void 0 ? true : layout.isCollapsible 49505 }; 49506 } 49507 } else if (layout?.type === "row") { 49508 normalizedLayout = { 49509 type: "row", 49510 alignment: layout?.alignment ?? "center", 49511 styles: layout?.styles ?? {} 49512 }; 49513 } else if (layout?.type === "details") { 49514 normalizedLayout = { 49515 type: "details", 49516 summary: layout?.summary ?? "" 49517 }; 49518 } 49519 return normalizedLayout; 49520 } 49521 function normalizeForm(form2) { 49522 const normalizedFormLayout = normalizeLayout(form2?.layout); 49523 const normalizedFields = (form2.fields ?? []).map( 49524 (field) => { 49525 if (typeof field === "string") { 49526 return { 49527 id: field, 49528 layout: normalizedFormLayout 49529 }; 49530 } 49531 const fieldLayout = field.layout ? normalizeLayout(field.layout) : normalizedFormLayout; 49532 return { 49533 id: field.id, 49534 layout: fieldLayout, 49535 ...!!field.label && { label: field.label }, 49536 ...!!field.description && { 49537 description: field.description 49538 }, 49539 ..."children" in field && Array.isArray(field.children) && { 49540 children: normalizeForm({ 49541 fields: field.children, 49542 layout: DEFAULT_LAYOUT 49543 }).fields 49544 } 49545 }; 49546 } 49547 ); 49548 return { 49549 layout: normalizedFormLayout, 49550 fields: normalizedFields 49551 }; 49552 } 49553 var normalize_form_default = normalizeForm; 49554 49555 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs 49556 var import_jsx_runtime273 = __toESM(require_jsx_runtime(), 1); 49557 function Header4({ title }) { 49558 return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)( 49559 Stack, 49560 { 49561 direction: "column", 49562 className: "dataforms-layouts-regular__header", 49563 gap: "lg", 49564 children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_components127.__experimentalHeading, { level: 2, size: 13, children: title }) }) 49565 } 49566 ); 49567 } 49568 function FormRegularField({ 49569 data, 49570 field, 49571 onChange, 49572 hideLabelFromVision, 49573 markWhenOptional, 49574 validity 49575 }) { 49576 const { fields: fields2 } = (0, import_element147.useContext)(dataform_context_default); 49577 const layout = field.layout; 49578 const form2 = (0, import_element147.useMemo)( 49579 () => ({ 49580 layout: DEFAULT_LAYOUT, 49581 fields: !!field.children ? field.children : [] 49582 }), 49583 [field] 49584 ); 49585 if (!!field.children) { 49586 return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(import_jsx_runtime273.Fragment, { children: [ 49587 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Header4, { title: field.label }), 49588 /* @__PURE__ */ (0, import_jsx_runtime273.jsx)( 49589 DataFormLayout, 49590 { 49591 data, 49592 form: form2, 49593 onChange, 49594 validity: validity?.children 49595 } 49596 ) 49597 ] }); 49598 } 49599 const labelPosition = layout.labelPosition; 49600 const fieldDefinition = fields2.find( 49601 (fieldDef) => fieldDef.id === field.id 49602 ); 49603 if (!fieldDefinition || !fieldDefinition.Edit) { 49604 return null; 49605 } 49606 if (labelPosition === "side") { 49607 return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)( 49608 Stack, 49609 { 49610 direction: "row", 49611 className: "dataforms-layouts-regular__field", 49612 gap: "sm", 49613 children: [ 49614 /* @__PURE__ */ (0, import_jsx_runtime273.jsx)( 49615 "div", 49616 { 49617 className: clsx_default( 49618 "dataforms-layouts-regular__field-label", 49619 `dataforms-layouts-regular__field-label--label-position-$labelPosition}` 49620 ), 49621 children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_components127.BaseControl.VisualLabel, { children: fieldDefinition.label }) 49622 } 49623 ), 49624 /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime273.jsx)( 49625 fieldDefinition.render, 49626 { 49627 item: data, 49628 field: fieldDefinition 49629 } 49630 ) : /* @__PURE__ */ (0, import_jsx_runtime273.jsx)( 49631 fieldDefinition.Edit, 49632 { 49633 data, 49634 field: fieldDefinition, 49635 onChange, 49636 hideLabelFromVision: true, 49637 markWhenOptional, 49638 validity 49639 }, 49640 fieldDefinition.id 49641 ) }) 49642 ] 49643 } 49644 ); 49645 } 49646 return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_jsx_runtime273.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(import_jsx_runtime273.Fragment, { children: [ 49647 !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_components127.BaseControl.VisualLabel, { children: fieldDefinition.label }), 49648 /* @__PURE__ */ (0, import_jsx_runtime273.jsx)( 49649 fieldDefinition.render, 49650 { 49651 item: data, 49652 field: fieldDefinition 49653 } 49654 ) 49655 ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime273.jsx)( 49656 fieldDefinition.Edit, 49657 { 49658 data, 49659 field: fieldDefinition, 49660 onChange, 49661 hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision, 49662 markWhenOptional, 49663 validity 49664 } 49665 ) }); 49666 } 49667 49668 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs 49669 var import_deepmerge3 = __toESM(require_cjs(), 1); 49670 var import_components130 = __toESM(require_components(), 1); 49671 var import_element152 = __toESM(require_element(), 1); 49672 var import_compose25 = __toESM(require_compose(), 1); 49673 49674 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs 49675 var import_components129 = __toESM(require_components(), 1); 49676 var import_i18n117 = __toESM(require_i18n(), 1); 49677 var import_compose24 = __toESM(require_compose(), 1); 49678 var import_element148 = __toESM(require_element(), 1); 49679 49680 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs 49681 function getLabelClassName(labelPosition, showError) { 49682 return clsx_default( 49683 "dataforms-layouts-panel__field-label", 49684 `dataforms-layouts-panel__field-label--label-position-$labelPosition}`, 49685 { "has-error": showError } 49686 ); 49687 } 49688 var get_label_classname_default = getLabelClassName; 49689 49690 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs 49691 var import_components128 = __toESM(require_components(), 1); 49692 var import_jsx_runtime274 = __toESM(require_jsx_runtime(), 1); 49693 function getLabelContent(showError, errorMessage, fieldLabel) { 49694 return showError ? /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(tooltip_exports.Root, { children: [ 49695 /* @__PURE__ */ (0, import_jsx_runtime274.jsx)( 49696 tooltip_exports.Trigger, 49697 { 49698 render: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [ 49699 /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_components128.Icon, { icon: error_default, size: 16 }), 49700 /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(VisuallyHidden, { children: [ 49701 errorMessage, 49702 ": " 49703 ] }), 49704 fieldLabel 49705 ] }) 49706 } 49707 ), 49708 /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(tooltip_exports.Popup, { children: errorMessage }) 49709 ] }) : fieldLabel; 49710 } 49711 var get_label_content_default = getLabelContent; 49712 49713 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs 49714 function getFirstValidationError(validity) { 49715 if (!validity) { 49716 return void 0; 49717 } 49718 const validityRules = Object.keys(validity).filter( 49719 (key) => key !== "children" 49720 ); 49721 for (const key of validityRules) { 49722 const rule = validity[key]; 49723 if (rule === void 0) { 49724 continue; 49725 } 49726 if (rule.type === "invalid") { 49727 if (rule.message) { 49728 return rule.message; 49729 } 49730 if (key === "required") { 49731 return "A required field is empty"; 49732 } 49733 return "Unidentified validation error"; 49734 } 49735 } 49736 if (validity.children) { 49737 for (const childValidity of Object.values(validity.children)) { 49738 const childError = getFirstValidationError(childValidity); 49739 if (childError) { 49740 return childError; 49741 } 49742 } 49743 } 49744 return void 0; 49745 } 49746 var get_first_validation_error_default = getFirstValidationError; 49747 49748 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs 49749 var import_jsx_runtime275 = __toESM(require_jsx_runtime(), 1); 49750 function SummaryButton({ 49751 data, 49752 field, 49753 fieldLabel, 49754 summaryFields, 49755 validity, 49756 touched, 49757 disabled: disabled2, 49758 onClick, 49759 "aria-expanded": ariaExpanded 49760 }) { 49761 const { labelPosition, editVisibility } = field.layout; 49762 const errorMessage = get_first_validation_error_default(validity); 49763 const showError = touched && !!errorMessage; 49764 const labelClassName = get_label_classname_default(labelPosition, showError); 49765 const labelContent = get_label_content_default(showError, errorMessage, fieldLabel); 49766 const className = clsx_default( 49767 "dataforms-layouts-panel__field-trigger", 49768 `dataforms-layouts-panel__field-trigger--label-$labelPosition}`, 49769 { 49770 "is-disabled": disabled2, 49771 "dataforms-layouts-panel__field-trigger--edit-always": editVisibility === "always" 49772 } 49773 ); 49774 const controlId = (0, import_compose24.useInstanceId)( 49775 SummaryButton, 49776 "dataforms-layouts-panel__field-control" 49777 ); 49778 const ariaLabel = showError ? (0, import_i18n117.sprintf)( 49779 // translators: %s: Field name. 49780 (0, import_i18n117._x)("Edit %s (has errors)", "field"), 49781 fieldLabel || "" 49782 ) : (0, import_i18n117.sprintf)( 49783 // translators: %s: Field name. 49784 (0, import_i18n117._x)("Edit %s", "field"), 49785 fieldLabel || "" 49786 ); 49787 const rowRef = (0, import_element148.useRef)(null); 49788 const handleRowClick = () => { 49789 const selection = rowRef.current?.ownerDocument.defaultView?.getSelection(); 49790 if (selection && selection.toString().length > 0) { 49791 return; 49792 } 49793 onClick(); 49794 }; 49795 const handleKeyDown = (event) => { 49796 if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) { 49797 event.preventDefault(); 49798 onClick(); 49799 } 49800 }; 49801 return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)( 49802 "div", 49803 { 49804 ref: rowRef, 49805 className, 49806 onClick: !disabled2 ? handleRowClick : void 0, 49807 onKeyDown: !disabled2 ? handleKeyDown : void 0, 49808 children: [ 49809 labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: labelClassName, children: labelContent }), 49810 labelPosition === "none" && showError && /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(tooltip_exports.Root, { children: [ 49811 /* @__PURE__ */ (0, import_jsx_runtime275.jsx)( 49812 tooltip_exports.Trigger, 49813 { 49814 render: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)( 49815 "span", 49816 { 49817 className: "dataforms-layouts-panel__field-label-error-content", 49818 role: "img", 49819 "aria-label": errorMessage, 49820 children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_components129.Icon, { icon: error_default, size: 16 }) 49821 } 49822 ) 49823 } 49824 ), 49825 /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(tooltip_exports.Popup, { children: errorMessage }) 49826 ] }), 49827 /* @__PURE__ */ (0, import_jsx_runtime275.jsx)( 49828 "span", 49829 { 49830 id: `$controlId}`, 49831 className: "dataforms-layouts-panel__field-control", 49832 children: summaryFields.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime275.jsx)( 49833 "span", 49834 { 49835 style: { 49836 display: "flex", 49837 flexDirection: "column", 49838 alignItems: "flex-start", 49839 width: "100%", 49840 gap: "2px" 49841 }, 49842 children: summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)( 49843 "span", 49844 { 49845 style: { width: "100%" }, 49846 children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)( 49847 summaryField.render, 49848 { 49849 item: data, 49850 field: summaryField 49851 } 49852 ) 49853 }, 49854 summaryField.id 49855 )) 49856 } 49857 ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)( 49858 summaryField.render, 49859 { 49860 item: data, 49861 field: summaryField 49862 }, 49863 summaryField.id 49864 )) 49865 } 49866 ), 49867 !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime275.jsx)( 49868 import_components129.Button, 49869 { 49870 className: "dataforms-layouts-panel__field-trigger-icon", 49871 label: ariaLabel, 49872 icon: pencil_default, 49873 size: "small", 49874 "aria-expanded": ariaExpanded, 49875 "aria-haspopup": "dialog", 49876 "aria-describedby": `$controlId}` 49877 } 49878 ) 49879 ] 49880 } 49881 ); 49882 } 49883 49884 // packages/dataviews/build-module/hooks/use-form-validity.mjs 49885 var import_deepmerge2 = __toESM(require_cjs(), 1); 49886 var import_es63 = __toESM(require_es6(), 1); 49887 var import_element149 = __toESM(require_element(), 1); 49888 var import_i18n118 = __toESM(require_i18n(), 1); 49889 function isFormValid(formValidity) { 49890 if (!formValidity) { 49891 return true; 49892 } 49893 return Object.values(formValidity).every((fieldValidation) => { 49894 return Object.entries(fieldValidation).every( 49895 ([key, validation]) => { 49896 if (key === "children" && validation && typeof validation === "object") { 49897 return isFormValid(validation); 49898 } 49899 return validation.type !== "invalid" && validation.type !== "validating"; 49900 } 49901 ); 49902 }); 49903 } 49904 function getFormFieldsToValidate(form2, fields2) { 49905 const normalizedForm = normalize_form_default(form2); 49906 if (normalizedForm.fields.length === 0) { 49907 return []; 49908 } 49909 const fieldsMap = /* @__PURE__ */ new Map(); 49910 fields2.forEach((field) => { 49911 fieldsMap.set(field.id, field); 49912 }); 49913 function processFormField(formField) { 49914 if ("children" in formField && Array.isArray(formField.children)) { 49915 const processedChildren = formField.children.map(processFormField).filter((child) => child !== null); 49916 if (processedChildren.length === 0) { 49917 return null; 49918 } 49919 const fieldDef2 = fieldsMap.get(formField.id); 49920 if (fieldDef2) { 49921 const [normalizedField2] = normalizeFields([ 49922 fieldDef2 49923 ]); 49924 return { 49925 id: formField.id, 49926 children: processedChildren, 49927 field: normalizedField2 49928 }; 49929 } 49930 return { 49931 id: formField.id, 49932 children: processedChildren 49933 }; 49934 } 49935 const fieldDef = fieldsMap.get(formField.id); 49936 if (!fieldDef) { 49937 return null; 49938 } 49939 const [normalizedField] = normalizeFields([fieldDef]); 49940 return { 49941 id: formField.id, 49942 children: [], 49943 field: normalizedField 49944 }; 49945 } 49946 const toValidate = normalizedForm.fields.map(processFormField).filter((field) => field !== null); 49947 return toValidate; 49948 } 49949 function setValidityAtPath(formValidity, fieldValidity, path) { 49950 if (!formValidity) { 49951 formValidity = {}; 49952 } 49953 if (path.length === 0) { 49954 return formValidity; 49955 } 49956 const result = { ...formValidity }; 49957 let current = result; 49958 for (let i2 = 0; i2 < path.length - 1; i2++) { 49959 const segment = path[i2]; 49960 if (!current[segment]) { 49961 current[segment] = {}; 49962 } 49963 current[segment] = { ...current[segment] }; 49964 current = current[segment]; 49965 } 49966 const finalKey = path[path.length - 1]; 49967 current[finalKey] = { 49968 ...current[finalKey] || {}, 49969 ...fieldValidity 49970 }; 49971 return result; 49972 } 49973 function removeValidationProperty(formValidity, path, property) { 49974 if (!formValidity || path.length === 0) { 49975 return formValidity; 49976 } 49977 const result = { ...formValidity }; 49978 let current = result; 49979 for (let i2 = 0; i2 < path.length - 1; i2++) { 49980 const segment = path[i2]; 49981 if (!current[segment]) { 49982 return formValidity; 49983 } 49984 current[segment] = { ...current[segment] }; 49985 current = current[segment]; 49986 } 49987 const finalKey = path[path.length - 1]; 49988 if (!current[finalKey]) { 49989 return formValidity; 49990 } 49991 const fieldValidity = { ...current[finalKey] }; 49992 delete fieldValidity[property]; 49993 if (Object.keys(fieldValidity).length === 0) { 49994 delete current[finalKey]; 49995 } else { 49996 current[finalKey] = fieldValidity; 49997 } 49998 if (Object.keys(result).length === 0) { 49999 return void 0; 50000 } 50001 return result; 50002 } 50003 function handleElementsValidationAsync(promise, formField, promiseHandler) { 50004 const { elementsCounterRef, setFormValidity, path, item } = promiseHandler; 50005 const currentToken = (elementsCounterRef.current[formField.id] || 0) + 1; 50006 elementsCounterRef.current[formField.id] = currentToken; 50007 promise.then((result) => { 50008 if (currentToken !== elementsCounterRef.current[formField.id]) { 50009 return; 50010 } 50011 if (!Array.isArray(result)) { 50012 setFormValidity((prev) => { 50013 const newFormValidity = setValidityAtPath( 50014 prev, 50015 { 50016 elements: { 50017 type: "invalid", 50018 message: (0, import_i18n118.__)("Could not validate elements.") 50019 } 50020 }, 50021 [...path, formField.id] 50022 ); 50023 return newFormValidity; 50024 }); 50025 return; 50026 } 50027 if (formField.field?.isValid.elements && !formField.field.isValid.elements.validate(item, { 50028 ...formField.field, 50029 elements: result 50030 })) { 50031 setFormValidity((prev) => { 50032 const newFormValidity = setValidityAtPath( 50033 prev, 50034 { 50035 elements: { 50036 type: "invalid", 50037 message: (0, import_i18n118.__)( 50038 "Value must be one of the elements." 50039 ) 50040 } 50041 }, 50042 [...path, formField.id] 50043 ); 50044 return newFormValidity; 50045 }); 50046 } else { 50047 setFormValidity((prev) => { 50048 return removeValidationProperty( 50049 prev, 50050 [...path, formField.id], 50051 "elements" 50052 ); 50053 }); 50054 } 50055 }).catch((error2) => { 50056 if (currentToken !== elementsCounterRef.current[formField.id]) { 50057 return; 50058 } 50059 let errorMessage; 50060 if (error2 instanceof Error) { 50061 errorMessage = error2.message; 50062 } else { 50063 errorMessage = String(error2) || (0, import_i18n118.__)( 50064 "Unknown error when running elements validation asynchronously." 50065 ); 50066 } 50067 setFormValidity((prev) => { 50068 const newFormValidity = setValidityAtPath( 50069 prev, 50070 { 50071 elements: { 50072 type: "invalid", 50073 message: errorMessage 50074 } 50075 }, 50076 [...path, formField.id] 50077 ); 50078 return newFormValidity; 50079 }); 50080 }); 50081 } 50082 function handleCustomValidationAsync(promise, formField, promiseHandler) { 50083 const { customCounterRef, setFormValidity, path } = promiseHandler; 50084 const currentToken = (customCounterRef.current[formField.id] || 0) + 1; 50085 customCounterRef.current[formField.id] = currentToken; 50086 promise.then((result) => { 50087 if (currentToken !== customCounterRef.current[formField.id]) { 50088 return; 50089 } 50090 if (result === null) { 50091 setFormValidity((prev) => { 50092 return removeValidationProperty( 50093 prev, 50094 [...path, formField.id], 50095 "custom" 50096 ); 50097 }); 50098 return; 50099 } 50100 if (typeof result === "string") { 50101 setFormValidity((prev) => { 50102 const newFormValidity = setValidityAtPath( 50103 prev, 50104 { 50105 custom: { 50106 type: "invalid", 50107 message: result 50108 } 50109 }, 50110 [...path, formField.id] 50111 ); 50112 return newFormValidity; 50113 }); 50114 return; 50115 } 50116 setFormValidity((prev) => { 50117 const newFormValidity = setValidityAtPath( 50118 prev, 50119 { 50120 custom: { 50121 type: "invalid", 50122 message: (0, import_i18n118.__)("Validation could not be processed.") 50123 } 50124 }, 50125 [...path, formField.id] 50126 ); 50127 return newFormValidity; 50128 }); 50129 }).catch((error2) => { 50130 if (currentToken !== customCounterRef.current[formField.id]) { 50131 return; 50132 } 50133 let errorMessage; 50134 if (error2 instanceof Error) { 50135 errorMessage = error2.message; 50136 } else { 50137 errorMessage = String(error2) || (0, import_i18n118.__)( 50138 "Unknown error when running custom validation asynchronously." 50139 ); 50140 } 50141 setFormValidity((prev) => { 50142 const newFormValidity = setValidityAtPath( 50143 prev, 50144 { 50145 custom: { 50146 type: "invalid", 50147 message: errorMessage 50148 } 50149 }, 50150 [...path, formField.id] 50151 ); 50152 return newFormValidity; 50153 }); 50154 }); 50155 } 50156 function validateFormField(item, formField, promiseHandler) { 50157 if (formField.field?.isValid.required && !formField.field.isValid.required.validate(item, formField.field)) { 50158 return { 50159 required: { type: "invalid" } 50160 }; 50161 } 50162 if (formField.field?.isValid.pattern && !formField.field.isValid.pattern.validate(item, formField.field)) { 50163 return { 50164 pattern: { 50165 type: "invalid", 50166 message: (0, import_i18n118.__)("Value does not match the required pattern.") 50167 } 50168 }; 50169 } 50170 if (formField.field?.isValid.min && !formField.field.isValid.min.validate(item, formField.field)) { 50171 return { 50172 min: { 50173 type: "invalid", 50174 message: (0, import_i18n118.__)("Value is below the minimum.") 50175 } 50176 }; 50177 } 50178 if (formField.field?.isValid.max && !formField.field.isValid.max.validate(item, formField.field)) { 50179 return { 50180 max: { 50181 type: "invalid", 50182 message: (0, import_i18n118.__)("Value is above the maximum.") 50183 } 50184 }; 50185 } 50186 if (formField.field?.isValid.minLength && !formField.field.isValid.minLength.validate(item, formField.field)) { 50187 return { 50188 minLength: { 50189 type: "invalid", 50190 message: (0, import_i18n118.__)("Value is too short.") 50191 } 50192 }; 50193 } 50194 if (formField.field?.isValid.maxLength && !formField.field.isValid.maxLength.validate(item, formField.field)) { 50195 return { 50196 maxLength: { 50197 type: "invalid", 50198 message: (0, import_i18n118.__)("Value is too long.") 50199 } 50200 }; 50201 } 50202 if (formField.field?.isValid.elements && formField.field.hasElements && !formField.field.getElements && Array.isArray(formField.field.elements) && !formField.field.isValid.elements.validate(item, formField.field)) { 50203 return { 50204 elements: { 50205 type: "invalid", 50206 message: (0, import_i18n118.__)("Value must be one of the elements.") 50207 } 50208 }; 50209 } 50210 let customError; 50211 if (!!formField.field && formField.field.isValid.custom) { 50212 try { 50213 const value = formField.field.getValue({ item }); 50214 customError = formField.field.isValid.custom( 50215 (0, import_deepmerge2.default)( 50216 item, 50217 formField.field.setValue({ 50218 item, 50219 value 50220 }) 50221 ), 50222 formField.field 50223 ); 50224 } catch (error2) { 50225 let errorMessage; 50226 if (error2 instanceof Error) { 50227 errorMessage = error2.message; 50228 } else { 50229 errorMessage = String(error2) || (0, import_i18n118.__)("Unknown error when running custom validation."); 50230 } 50231 return { 50232 custom: { 50233 type: "invalid", 50234 message: errorMessage 50235 } 50236 }; 50237 } 50238 } 50239 if (typeof customError === "string") { 50240 return { 50241 custom: { 50242 type: "invalid", 50243 message: customError 50244 } 50245 }; 50246 } 50247 const fieldValidity = {}; 50248 if (!!formField.field && formField.field.isValid.elements && formField.field.hasElements && typeof formField.field.getElements === "function") { 50249 handleElementsValidationAsync( 50250 formField.field.getElements(), 50251 formField, 50252 promiseHandler 50253 ); 50254 fieldValidity.elements = { 50255 type: "validating", 50256 message: (0, import_i18n118.__)("Validating\u2026") 50257 }; 50258 } 50259 if (customError instanceof Promise) { 50260 handleCustomValidationAsync(customError, formField, promiseHandler); 50261 fieldValidity.custom = { 50262 type: "validating", 50263 message: (0, import_i18n118.__)("Validating\u2026") 50264 }; 50265 } 50266 if (Object.keys(fieldValidity).length > 0) { 50267 return fieldValidity; 50268 } 50269 if (formField.children.length > 0) { 50270 const result = {}; 50271 formField.children.forEach((child) => { 50272 result[child.id] = validateFormField(item, child, { 50273 ...promiseHandler, 50274 path: [...promiseHandler.path, formField.id, "children"] 50275 }); 50276 }); 50277 const filteredResult = {}; 50278 Object.entries(result).forEach(([key, value]) => { 50279 if (value !== void 0) { 50280 filteredResult[key] = value; 50281 } 50282 }); 50283 if (Object.keys(filteredResult).length === 0) { 50284 return void 0; 50285 } 50286 return { 50287 children: filteredResult 50288 }; 50289 } 50290 return void 0; 50291 } 50292 function getFormFieldValue(formField, item) { 50293 const fieldValue = formField?.field?.getValue({ item }); 50294 if (formField.children.length === 0) { 50295 return fieldValue; 50296 } 50297 const childrenValues = formField.children.map( 50298 (child) => getFormFieldValue(child, item) 50299 ); 50300 if (!childrenValues) { 50301 return fieldValue; 50302 } 50303 return { 50304 value: fieldValue, 50305 children: childrenValues 50306 }; 50307 } 50308 function useFormValidity(item, fields2, form2) { 50309 const [formValidity, setFormValidity] = (0, import_element149.useState)(); 50310 const customCounterRef = (0, import_element149.useRef)({}); 50311 const elementsCounterRef = (0, import_element149.useRef)({}); 50312 const previousValuesRef = (0, import_element149.useRef)({}); 50313 const validate = (0, import_element149.useCallback)(() => { 50314 const promiseHandler = { 50315 customCounterRef, 50316 elementsCounterRef, 50317 setFormValidity, 50318 path: [], 50319 item 50320 }; 50321 const formFieldsToValidate = getFormFieldsToValidate(form2, fields2); 50322 if (formFieldsToValidate.length === 0) { 50323 setFormValidity(void 0); 50324 return; 50325 } 50326 const newFormValidity = {}; 50327 const untouchedFields = []; 50328 formFieldsToValidate.forEach((formField) => { 50329 const value = getFormFieldValue(formField, item); 50330 if (previousValuesRef.current.hasOwnProperty(formField.id) && (0, import_es63.default)( 50331 previousValuesRef.current[formField.id], 50332 value 50333 )) { 50334 untouchedFields.push(formField.id); 50335 return; 50336 } 50337 previousValuesRef.current[formField.id] = value; 50338 const fieldValidity = validateFormField( 50339 item, 50340 formField, 50341 promiseHandler 50342 ); 50343 if (fieldValidity !== void 0) { 50344 newFormValidity[formField.id] = fieldValidity; 50345 } 50346 }); 50347 setFormValidity((existingFormValidity) => { 50348 let validity = { 50349 ...existingFormValidity, 50350 ...newFormValidity 50351 }; 50352 const fieldsToKeep = [ 50353 ...untouchedFields, 50354 ...Object.keys(newFormValidity) 50355 ]; 50356 Object.keys(validity).forEach((key) => { 50357 if (validity && !fieldsToKeep.includes(key)) { 50358 delete validity[key]; 50359 } 50360 }); 50361 if (Object.keys(validity).length === 0) { 50362 validity = void 0; 50363 } 50364 const areEqual = (0, import_es63.default)(existingFormValidity, validity); 50365 if (areEqual) { 50366 return existingFormValidity; 50367 } 50368 return validity; 50369 }); 50370 }, [item, fields2, form2]); 50371 (0, import_element149.useEffect)(() => { 50372 validate(); 50373 }, [validate]); 50374 return { 50375 validity: formValidity, 50376 isValid: isFormValid(formValidity) 50377 }; 50378 } 50379 var use_form_validity_default = useFormValidity; 50380 50381 // packages/dataviews/build-module/hooks/use-report-validity.mjs 50382 var import_element150 = __toESM(require_element(), 1); 50383 function useReportValidity(ref, shouldReport) { 50384 (0, import_element150.useEffect)(() => { 50385 if (shouldReport && ref.current) { 50386 const inputs = ref.current.querySelectorAll( 50387 "input, textarea, select" 50388 ); 50389 inputs.forEach((input) => { 50390 input.reportValidity(); 50391 }); 50392 } 50393 }, [shouldReport, ref]); 50394 } 50395 50396 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs 50397 var import_element151 = __toESM(require_element(), 1); 50398 50399 // packages/dataviews/build-module/components/dataform-layouts/get-summary-fields.mjs 50400 function extractSummaryIds(summary) { 50401 if (Array.isArray(summary)) { 50402 return summary.map( 50403 (item) => typeof item === "string" ? item : item.id 50404 ); 50405 } 50406 return []; 50407 } 50408 var getSummaryFields = (summaryField, fields2) => { 50409 if (Array.isArray(summaryField) && summaryField.length > 0) { 50410 const summaryIds = extractSummaryIds(summaryField); 50411 return summaryIds.map( 50412 (summaryId) => fields2.find((_field) => _field.id === summaryId) 50413 ).filter((_field) => _field !== void 0); 50414 } 50415 return []; 50416 }; 50417 50418 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs 50419 var getFieldDefinition = (field, fields2) => { 50420 const fieldDefinition = fields2.find((_field) => _field.id === field.id); 50421 if (!fieldDefinition) { 50422 return fields2.find((_field) => { 50423 if (!!field.children) { 50424 const simpleChildren = field.children.filter( 50425 (child) => !child.children 50426 ); 50427 if (simpleChildren.length === 0) { 50428 return false; 50429 } 50430 return _field.id === simpleChildren[0].id; 50431 } 50432 return _field.id === field.id; 50433 }); 50434 } 50435 return fieldDefinition; 50436 }; 50437 function useFieldFromFormField(field) { 50438 const { fields: fields2 } = (0, import_element151.useContext)(dataform_context_default); 50439 const layout = field.layout; 50440 const summaryFields = getSummaryFields(layout.summary, fields2); 50441 const fieldDefinition = getFieldDefinition(field, fields2); 50442 const fieldLabel = !!field.children ? field.label : fieldDefinition?.label; 50443 if (summaryFields.length === 0) { 50444 return { 50445 summaryFields: fieldDefinition ? [fieldDefinition] : [], 50446 fieldDefinition, 50447 fieldLabel 50448 }; 50449 } 50450 return { 50451 summaryFields, 50452 fieldDefinition, 50453 fieldLabel 50454 }; 50455 } 50456 var use_field_from_form_field_default = useFieldFromFormField; 50457 50458 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs 50459 var import_jsx_runtime276 = __toESM(require_jsx_runtime(), 1); 50460 function ModalContent({ 50461 data, 50462 field, 50463 onChange, 50464 fieldLabel, 50465 onClose, 50466 touched 50467 }) { 50468 const { openAs } = field.layout; 50469 const { applyLabel, cancelLabel } = openAs; 50470 const { fields: fields2 } = (0, import_element152.useContext)(dataform_context_default); 50471 const [changes, setChanges] = (0, import_element152.useState)({}); 50472 const modalData = (0, import_element152.useMemo)(() => { 50473 return (0, import_deepmerge3.default)(data, changes, { 50474 arrayMerge: (target, source) => source 50475 }); 50476 }, [data, changes]); 50477 const form2 = (0, import_element152.useMemo)( 50478 () => ({ 50479 layout: DEFAULT_LAYOUT, 50480 fields: !!field.children ? field.children : ( 50481 // If not explicit children return the field id itself. 50482 [{ id: field.id, layout: DEFAULT_LAYOUT }] 50483 ) 50484 }), 50485 [field] 50486 ); 50487 const fieldsAsFieldType = fields2.map((f2) => ({ 50488 ...f2, 50489 Edit: f2.Edit === null ? void 0 : f2.Edit, 50490 isValid: { 50491 required: f2.isValid.required?.constraint, 50492 elements: f2.isValid.elements?.constraint, 50493 min: f2.isValid.min?.constraint, 50494 max: f2.isValid.max?.constraint, 50495 pattern: f2.isValid.pattern?.constraint, 50496 minLength: f2.isValid.minLength?.constraint, 50497 maxLength: f2.isValid.maxLength?.constraint 50498 } 50499 })); 50500 const { validity } = use_form_validity_default(modalData, fieldsAsFieldType, form2); 50501 const onApply = () => { 50502 onChange(changes); 50503 onClose(); 50504 }; 50505 const handleOnChange = (newValue) => { 50506 setChanges( 50507 (prev) => (0, import_deepmerge3.default)(prev, newValue, { 50508 arrayMerge: (target, source) => source 50509 }) 50510 ); 50511 }; 50512 const focusOnMountRef = (0, import_compose25.useFocusOnMount)("firstInputElement"); 50513 const contentRef = (0, import_element152.useRef)(null); 50514 const mergedRef = (0, import_compose25.useMergeRefs)([focusOnMountRef, contentRef]); 50515 useReportValidity(contentRef, touched); 50516 return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)( 50517 import_components130.Modal, 50518 { 50519 className: "dataforms-layouts-panel__modal", 50520 onRequestClose: onClose, 50521 isFullScreen: false, 50522 title: fieldLabel, 50523 size: "medium", 50524 children: [ 50525 /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("div", { ref: mergedRef, children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)( 50526 DataFormLayout, 50527 { 50528 data: modalData, 50529 form: form2, 50530 onChange: handleOnChange, 50531 validity, 50532 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime276.jsx)( 50533 FieldLayout, 50534 { 50535 data: modalData, 50536 field: childField, 50537 onChange: handleOnChange, 50538 hideLabelFromVision: form2.fields.length < 2, 50539 markWhenOptional, 50540 validity: childFieldValidity 50541 }, 50542 childField.id 50543 ) 50544 } 50545 ) }), 50546 /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)( 50547 Stack, 50548 { 50549 direction: "row", 50550 className: "dataforms-layouts-panel__modal-footer", 50551 gap: "md", 50552 children: [ 50553 /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_components130.__experimentalSpacer, { style: { flex: 1 } }), 50554 /* @__PURE__ */ (0, import_jsx_runtime276.jsx)( 50555 import_components130.Button, 50556 { 50557 variant: "tertiary", 50558 onClick: onClose, 50559 __next40pxDefaultSize: true, 50560 children: cancelLabel 50561 } 50562 ), 50563 /* @__PURE__ */ (0, import_jsx_runtime276.jsx)( 50564 import_components130.Button, 50565 { 50566 variant: "primary", 50567 onClick: onApply, 50568 __next40pxDefaultSize: true, 50569 children: applyLabel 50570 } 50571 ) 50572 ] 50573 } 50574 ) 50575 ] 50576 } 50577 ); 50578 } 50579 function PanelModal({ 50580 data, 50581 field, 50582 onChange, 50583 validity 50584 }) { 50585 const [touched, setTouched] = (0, import_element152.useState)(false); 50586 const [isOpen, setIsOpen] = (0, import_element152.useState)(false); 50587 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field); 50588 if (!fieldDefinition) { 50589 return null; 50590 } 50591 const handleClose = () => { 50592 setIsOpen(false); 50593 setTouched(true); 50594 }; 50595 return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(import_jsx_runtime276.Fragment, { children: [ 50596 /* @__PURE__ */ (0, import_jsx_runtime276.jsx)( 50597 SummaryButton, 50598 { 50599 data, 50600 field, 50601 fieldLabel, 50602 summaryFields, 50603 validity, 50604 touched, 50605 disabled: fieldDefinition.readOnly === true, 50606 onClick: () => setIsOpen(true), 50607 "aria-expanded": isOpen 50608 } 50609 ), 50610 isOpen && /* @__PURE__ */ (0, import_jsx_runtime276.jsx)( 50611 ModalContent, 50612 { 50613 data, 50614 field, 50615 onChange, 50616 fieldLabel: fieldLabel ?? "", 50617 onClose: handleClose, 50618 touched 50619 } 50620 ) 50621 ] }); 50622 } 50623 var modal_default2 = PanelModal; 50624 50625 // packages/dataviews/build-module/components/dataform-layouts/panel/dropdown.mjs 50626 var import_components131 = __toESM(require_components(), 1); 50627 var import_i18n119 = __toESM(require_i18n(), 1); 50628 var import_element153 = __toESM(require_element(), 1); 50629 var import_compose26 = __toESM(require_compose(), 1); 50630 var import_jsx_runtime277 = __toESM(require_jsx_runtime(), 1); 50631 function DropdownHeader({ 50632 title, 50633 onClose 50634 }) { 50635 return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)( 50636 Stack, 50637 { 50638 direction: "column", 50639 className: "dataforms-layouts-panel__dropdown-header", 50640 gap: "lg", 50641 children: /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", children: [ 50642 title && /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(import_components131.__experimentalHeading, { level: 2, size: 13, children: title }), 50643 /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(import_components131.__experimentalSpacer, { style: { flex: 1 } }), 50644 onClose && /* @__PURE__ */ (0, import_jsx_runtime277.jsx)( 50645 import_components131.Button, 50646 { 50647 label: (0, import_i18n119.__)("Close"), 50648 icon: close_small_default, 50649 onClick: onClose, 50650 size: "small" 50651 } 50652 ) 50653 ] }) 50654 } 50655 ); 50656 } 50657 function DropdownContentWithValidation({ 50658 touched, 50659 children 50660 }) { 50661 const ref = (0, import_element153.useRef)(null); 50662 useReportValidity(ref, touched); 50663 return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { ref, children }); 50664 } 50665 function PanelDropdown({ 50666 data, 50667 field, 50668 onChange, 50669 validity 50670 }) { 50671 const [touched, setTouched] = (0, import_element153.useState)(false); 50672 const [popoverAnchor, setPopoverAnchor] = (0, import_element153.useState)( 50673 null 50674 ); 50675 const popoverProps = (0, import_element153.useMemo)( 50676 () => ({ 50677 // Anchor the popover to the middle of the entire row so that it doesn't 50678 // move around when the label changes. 50679 anchor: popoverAnchor, 50680 placement: "left-start", 50681 offset: 36, 50682 shift: true 50683 }), 50684 [popoverAnchor] 50685 ); 50686 const [dialogRef, dialogProps] = (0, import_compose26.__experimentalUseDialog)({ 50687 focusOnMount: "firstInputElement" 50688 }); 50689 const form2 = (0, import_element153.useMemo)( 50690 () => ({ 50691 layout: DEFAULT_LAYOUT, 50692 fields: !!field.children ? field.children : ( 50693 // If not explicit children return the field id itself. 50694 [{ id: field.id, layout: DEFAULT_LAYOUT }] 50695 ) 50696 }), 50697 [field] 50698 ); 50699 const formValidity = (0, import_element153.useMemo)(() => { 50700 if (validity === void 0) { 50701 return void 0; 50702 } 50703 if (!!field.children) { 50704 return validity?.children; 50705 } 50706 return { [field.id]: validity }; 50707 }, [validity, field]); 50708 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field); 50709 if (!fieldDefinition) { 50710 return null; 50711 } 50712 return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)( 50713 "div", 50714 { 50715 ref: setPopoverAnchor, 50716 className: "dataforms-layouts-panel__field-dropdown-anchor", 50717 children: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)( 50718 import_components131.Dropdown, 50719 { 50720 contentClassName: "dataforms-layouts-panel__field-dropdown", 50721 popoverProps, 50722 focusOnMount: false, 50723 onToggle: (willOpen) => { 50724 if (!willOpen) { 50725 setTouched(true); 50726 } 50727 }, 50728 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)( 50729 SummaryButton, 50730 { 50731 data, 50732 field, 50733 fieldLabel, 50734 summaryFields, 50735 validity, 50736 touched, 50737 disabled: fieldDefinition.readOnly === true, 50738 onClick: onToggle, 50739 "aria-expanded": isOpen 50740 } 50741 ), 50742 renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)("div", { ref: dialogRef, ...dialogProps, children: [ 50743 /* @__PURE__ */ (0, import_jsx_runtime277.jsx)( 50744 DropdownHeader, 50745 { 50746 title: fieldLabel, 50747 onClose 50748 } 50749 ), 50750 /* @__PURE__ */ (0, import_jsx_runtime277.jsx)( 50751 DataFormLayout, 50752 { 50753 data, 50754 form: form2, 50755 onChange, 50756 validity: formValidity, 50757 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)( 50758 FieldLayout, 50759 { 50760 data, 50761 field: childField, 50762 onChange, 50763 hideLabelFromVision: (form2?.fields ?? []).length < 2, 50764 markWhenOptional, 50765 validity: childFieldValidity 50766 }, 50767 childField.id 50768 ) 50769 } 50770 ) 50771 ] }) }) 50772 } 50773 ) 50774 } 50775 ); 50776 } 50777 var dropdown_default = PanelDropdown; 50778 50779 // packages/dataviews/build-module/components/dataform-layouts/panel/index.mjs 50780 var import_jsx_runtime278 = __toESM(require_jsx_runtime(), 1); 50781 function FormPanelField({ 50782 data, 50783 field, 50784 onChange, 50785 validity 50786 }) { 50787 const layout = field.layout; 50788 if (layout.openAs.type === "modal") { 50789 return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)( 50790 modal_default2, 50791 { 50792 data, 50793 field, 50794 onChange, 50795 validity 50796 } 50797 ); 50798 } 50799 return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)( 50800 dropdown_default, 50801 { 50802 data, 50803 field, 50804 onChange, 50805 validity 50806 } 50807 ); 50808 } 50809 50810 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs 50811 var import_element154 = __toESM(require_element(), 1); 50812 50813 // packages/dataviews/build-module/components/dataform-layouts/validation-badge.mjs 50814 var import_i18n120 = __toESM(require_i18n(), 1); 50815 var import_jsx_runtime279 = __toESM(require_jsx_runtime(), 1); 50816 function countInvalidFields(validity) { 50817 if (!validity) { 50818 return 0; 50819 } 50820 let count = 0; 50821 const validityRules = Object.keys(validity).filter( 50822 (key) => key !== "children" 50823 ); 50824 for (const key of validityRules) { 50825 const rule = validity[key]; 50826 if (rule?.type === "invalid") { 50827 count++; 50828 } 50829 } 50830 if (validity.children) { 50831 for (const childValidity of Object.values(validity.children)) { 50832 count += countInvalidFields(childValidity); 50833 } 50834 } 50835 return count; 50836 } 50837 function ValidationBadge({ 50838 validity 50839 }) { 50840 const invalidCount = countInvalidFields(validity); 50841 if (invalidCount === 0) { 50842 return null; 50843 } 50844 return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(Badge, { intent: "high", children: (0, import_i18n120.sprintf)( 50845 /* translators: %d: Number of fields that need attention */ 50846 (0, import_i18n120._n)( 50847 "%d field needs attention", 50848 "%d fields need attention", 50849 invalidCount 50850 ), 50851 invalidCount 50852 ) }); 50853 } 50854 50855 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs 50856 var import_jsx_runtime280 = __toESM(require_jsx_runtime(), 1); 50857 function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) { 50858 if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) { 50859 return false; 50860 } 50861 const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig]; 50862 const fieldConfig = summaryConfigArray.find((config2) => { 50863 if (typeof config2 === "string") { 50864 return config2 === summaryField.id; 50865 } 50866 if (typeof config2 === "object" && "id" in config2) { 50867 return config2.id === summaryField.id; 50868 } 50869 return false; 50870 }); 50871 if (!fieldConfig) { 50872 return false; 50873 } 50874 if (typeof fieldConfig === "string") { 50875 return true; 50876 } 50877 if (typeof fieldConfig === "object" && "visibility" in fieldConfig) { 50878 return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen; 50879 } 50880 return true; 50881 } 50882 function HeaderContent({ 50883 data, 50884 fields: fields2, 50885 label, 50886 layout, 50887 isOpen, 50888 touched, 50889 validity 50890 }) { 50891 const summaryFields = getSummaryFields(layout.summary, fields2); 50892 const visibleSummaryFields = summaryFields.filter( 50893 (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen) 50894 ); 50895 const hasBadge = touched && layout.isCollapsible; 50896 const hasSummary = visibleSummaryFields.length > 0 && layout.withHeader; 50897 return /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)( 50898 Stack, 50899 { 50900 align: "center", 50901 justify: "space-between", 50902 className: "dataforms-layouts-card__field-header-content", 50903 children: [ 50904 /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(card_exports.Title, { children: label }), 50905 (hasBadge || hasSummary) && /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(collapsible_card_exports.HeaderDescription, { className: "dataforms-layouts-card__field-header-content-description", children: [ 50906 hasBadge && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(ValidationBadge, { validity }), 50907 hasSummary && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime280.jsx)( 50908 summaryField.render, 50909 { 50910 item: data, 50911 field: summaryField 50912 }, 50913 summaryField.id 50914 )) }) 50915 ] }) 50916 ] 50917 } 50918 ); 50919 } 50920 function BodyContent({ 50921 data, 50922 field, 50923 form: form2, 50924 onChange, 50925 hideLabelFromVision, 50926 markWhenOptional, 50927 validity, 50928 withHeader 50929 }) { 50930 if (field.children) { 50931 return /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(import_jsx_runtime280.Fragment, { children: [ 50932 field.description && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }), 50933 /* @__PURE__ */ (0, import_jsx_runtime280.jsx)( 50934 DataFormLayout, 50935 { 50936 data, 50937 form: form2, 50938 onChange, 50939 validity: validity?.children 50940 } 50941 ) 50942 ] }); 50943 } 50944 const SingleFieldLayout = getFormFieldLayout("regular")?.component; 50945 if (!SingleFieldLayout) { 50946 return null; 50947 } 50948 return /* @__PURE__ */ (0, import_jsx_runtime280.jsx)( 50949 SingleFieldLayout, 50950 { 50951 data, 50952 field, 50953 onChange, 50954 hideLabelFromVision: hideLabelFromVision || withHeader, 50955 markWhenOptional, 50956 validity 50957 } 50958 ); 50959 } 50960 function FormCardField({ 50961 data, 50962 field, 50963 onChange, 50964 hideLabelFromVision, 50965 markWhenOptional, 50966 validity 50967 }) { 50968 const { fields: fields2 } = (0, import_element154.useContext)(dataform_context_default); 50969 const layout = field.layout; 50970 const contentRef = (0, import_element154.useRef)(null); 50971 const form2 = (0, import_element154.useMemo)( 50972 () => ({ 50973 layout: DEFAULT_LAYOUT, 50974 fields: field.children ?? [] 50975 }), 50976 [field] 50977 ); 50978 const { isOpened, isCollapsible } = layout; 50979 const [isOpen, setIsOpen] = (0, import_element154.useState)(isOpened); 50980 const [touched, setTouched] = (0, import_element154.useState)(false); 50981 (0, import_element154.useEffect)(() => { 50982 setIsOpen(isOpened); 50983 }, [isOpened]); 50984 const handleOpenChange = (0, import_element154.useCallback)((open) => { 50985 if (!open) { 50986 setTouched(true); 50987 } 50988 setIsOpen(open); 50989 }, []); 50990 const handleBlur = (0, import_element154.useCallback)(() => { 50991 setTouched(true); 50992 }, []); 50993 useReportValidity( 50994 contentRef, 50995 (isCollapsible ? isOpen : true) && touched 50996 ); 50997 let label = field.label; 50998 let withHeader; 50999 if (field.children) { 51000 withHeader = !!label && layout.withHeader; 51001 } else { 51002 const fieldDefinition = fields2.find( 51003 (fieldDef) => fieldDef.id === field.id 51004 ); 51005 if (!fieldDefinition || !fieldDefinition.Edit) { 51006 return null; 51007 } 51008 label = fieldDefinition.label; 51009 withHeader = !!label && layout.withHeader; 51010 } 51011 const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime280.jsx)( 51012 BodyContent, 51013 { 51014 data, 51015 field, 51016 form: form2, 51017 onChange, 51018 hideLabelFromVision, 51019 markWhenOptional, 51020 validity, 51021 withHeader 51022 } 51023 ); 51024 const headerContent = /* @__PURE__ */ (0, import_jsx_runtime280.jsx)( 51025 HeaderContent, 51026 { 51027 data, 51028 fields: fields2, 51029 label, 51030 layout, 51031 isOpen: isCollapsible ? !!isOpen : true, 51032 touched, 51033 validity 51034 } 51035 ); 51036 if (withHeader && isCollapsible) { 51037 return /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)( 51038 collapsible_card_exports.Root, 51039 { 51040 className: "dataforms-layouts-card__field", 51041 open: isOpen, 51042 onOpenChange: handleOpenChange, 51043 children: [ 51044 /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(collapsible_card_exports.Header, { children: headerContent }), 51045 /* @__PURE__ */ (0, import_jsx_runtime280.jsx)( 51046 collapsible_card_exports.Content, 51047 { 51048 ref: contentRef, 51049 onBlur: handleBlur, 51050 children: bodyContent 51051 } 51052 ) 51053 ] 51054 } 51055 ); 51056 } 51057 return /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(card_exports.Root, { className: "dataforms-layouts-card__field", children: [ 51058 withHeader && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(card_exports.Header, { children: headerContent }), 51059 /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(card_exports.Content, { ref: contentRef, onBlur: handleBlur, children: bodyContent }) 51060 ] }); 51061 } 51062 51063 // packages/dataviews/build-module/components/dataform-layouts/row/index.mjs 51064 var import_components132 = __toESM(require_components(), 1); 51065 var import_jsx_runtime281 = __toESM(require_jsx_runtime(), 1); 51066 function Header5({ title }) { 51067 return /* @__PURE__ */ (0, import_jsx_runtime281.jsx)( 51068 Stack, 51069 { 51070 direction: "column", 51071 className: "dataforms-layouts-row__header", 51072 gap: "lg", 51073 children: /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(import_components132.__experimentalHeading, { level: 2, size: 13, children: title }) }) 51074 } 51075 ); 51076 } 51077 var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(import_jsx_runtime281.Fragment, { children }); 51078 function FormRowField({ 51079 data, 51080 field, 51081 onChange, 51082 hideLabelFromVision, 51083 markWhenOptional, 51084 validity 51085 }) { 51086 const layout = field.layout; 51087 if (!!field.children) { 51088 const form2 = { 51089 layout: DEFAULT_LAYOUT, 51090 fields: field.children 51091 }; 51092 return /* @__PURE__ */ (0, import_jsx_runtime281.jsxs)("div", { className: "dataforms-layouts-row__field", children: [ 51093 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(Header5, { title: field.label }), 51094 /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime281.jsx)( 51095 DataFormLayout, 51096 { 51097 data, 51098 form: form2, 51099 onChange, 51100 validity: validity?.children, 51101 as: EMPTY_WRAPPER, 51102 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0, import_jsx_runtime281.jsx)( 51103 "div", 51104 { 51105 className: "dataforms-layouts-row__field-control", 51106 style: layout.styles[childField.id], 51107 children: /* @__PURE__ */ (0, import_jsx_runtime281.jsx)( 51108 FieldLayout, 51109 { 51110 data, 51111 field: childField, 51112 onChange, 51113 hideLabelFromVision, 51114 markWhenOptional, 51115 validity: childFieldValidity 51116 } 51117 ) 51118 }, 51119 childField.id 51120 ) 51121 } 51122 ) }) 51123 ] }); 51124 } 51125 const RegularLayout = getFormFieldLayout("regular")?.component; 51126 if (!RegularLayout) { 51127 return null; 51128 } 51129 return /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(import_jsx_runtime281.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime281.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0, import_jsx_runtime281.jsx)( 51130 RegularLayout, 51131 { 51132 data, 51133 field, 51134 onChange, 51135 markWhenOptional, 51136 validity 51137 } 51138 ) }) }); 51139 } 51140 51141 // packages/dataviews/build-module/components/dataform-layouts/details/index.mjs 51142 var import_element155 = __toESM(require_element(), 1); 51143 var import_i18n121 = __toESM(require_i18n(), 1); 51144 var import_jsx_runtime282 = __toESM(require_jsx_runtime(), 1); 51145 function FormDetailsField({ 51146 data, 51147 field, 51148 onChange, 51149 validity 51150 }) { 51151 const { fields: fields2 } = (0, import_element155.useContext)(dataform_context_default); 51152 const detailsRef = (0, import_element155.useRef)(null); 51153 const contentRef = (0, import_element155.useRef)(null); 51154 const [touched, setTouched] = (0, import_element155.useState)(false); 51155 const [isOpen, setIsOpen] = (0, import_element155.useState)(false); 51156 const form2 = (0, import_element155.useMemo)( 51157 () => ({ 51158 layout: DEFAULT_LAYOUT, 51159 fields: field.children ?? [] 51160 }), 51161 [field] 51162 ); 51163 (0, import_element155.useEffect)(() => { 51164 const details = detailsRef.current; 51165 if (!details) { 51166 return; 51167 } 51168 const handleToggle = () => { 51169 const nowOpen = details.open; 51170 if (!nowOpen) { 51171 setTouched(true); 51172 } 51173 setIsOpen(nowOpen); 51174 }; 51175 details.addEventListener("toggle", handleToggle); 51176 return () => { 51177 details.removeEventListener("toggle", handleToggle); 51178 }; 51179 }, []); 51180 useReportValidity(contentRef, isOpen && touched); 51181 const handleBlur = (0, import_element155.useCallback)(() => { 51182 setTouched(true); 51183 }, []); 51184 if (!field.children) { 51185 return null; 51186 } 51187 const summaryFieldId = field.layout.summary ?? ""; 51188 const summaryField = summaryFieldId ? fields2.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0; 51189 let summaryContent; 51190 if (summaryField && summaryField.render) { 51191 summaryContent = /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(summaryField.render, { item: data, field: summaryField }); 51192 } else { 51193 summaryContent = field.label || (0, import_i18n121.__)("More details"); 51194 } 51195 return /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)( 51196 "details", 51197 { 51198 ref: detailsRef, 51199 className: "dataforms-layouts-details__details", 51200 children: [ 51201 /* @__PURE__ */ (0, import_jsx_runtime282.jsx)("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)( 51202 Stack, 51203 { 51204 direction: "row", 51205 align: "center", 51206 gap: "md", 51207 className: "dataforms-layouts-details__summary-content", 51208 children: [ 51209 summaryContent, 51210 touched && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(ValidationBadge, { validity }) 51211 ] 51212 } 51213 ) }), 51214 /* @__PURE__ */ (0, import_jsx_runtime282.jsx)( 51215 "div", 51216 { 51217 ref: contentRef, 51218 className: "dataforms-layouts-details__content", 51219 onBlur: handleBlur, 51220 children: /* @__PURE__ */ (0, import_jsx_runtime282.jsx)( 51221 DataFormLayout, 51222 { 51223 data, 51224 form: form2, 51225 onChange, 51226 validity: validity?.children 51227 } 51228 ) 51229 } 51230 ) 51231 ] 51232 } 51233 ); 51234 } 51235 51236 // packages/dataviews/build-module/components/dataform-layouts/index.mjs 51237 var import_jsx_runtime283 = __toESM(require_jsx_runtime(), 1); 51238 var FORM_FIELD_LAYOUTS = [ 51239 { 51240 type: "regular", 51241 component: FormRegularField, 51242 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime283.jsx)( 51243 Stack, 51244 { 51245 direction: "column", 51246 className: "dataforms-layouts__wrapper", 51247 gap: "lg", 51248 children 51249 } 51250 ) 51251 }, 51252 { 51253 type: "panel", 51254 component: FormPanelField, 51255 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime283.jsx)( 51256 Stack, 51257 { 51258 direction: "column", 51259 className: "dataforms-layouts__wrapper", 51260 gap: "md", 51261 children 51262 } 51263 ) 51264 }, 51265 { 51266 type: "card", 51267 component: FormCardField, 51268 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime283.jsx)( 51269 Stack, 51270 { 51271 direction: "column", 51272 className: "dataforms-layouts__wrapper", 51273 gap: "xl", 51274 children 51275 } 51276 ) 51277 }, 51278 { 51279 type: "row", 51280 component: FormRowField, 51281 wrapper: ({ 51282 children, 51283 layout 51284 }) => /* @__PURE__ */ (0, import_jsx_runtime283.jsx)( 51285 Stack, 51286 { 51287 direction: "column", 51288 className: "dataforms-layouts__wrapper", 51289 gap: "lg", 51290 children: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)( 51291 Stack, 51292 { 51293 direction: "row", 51294 gap: "lg", 51295 align: layout.alignment, 51296 children 51297 } 51298 ) }) 51299 } 51300 ) 51301 }, 51302 { 51303 type: "details", 51304 component: FormDetailsField 51305 } 51306 ]; 51307 function getFormFieldLayout(type) { 51308 return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type); 51309 } 51310 51311 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs 51312 var import_jsx_runtime284 = __toESM(require_jsx_runtime(), 1); 51313 var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children }); 51314 function DataFormLayout({ 51315 data, 51316 form: form2, 51317 onChange, 51318 validity, 51319 children, 51320 as 51321 }) { 51322 const { fields: fieldDefinitions } = (0, import_element156.useContext)(dataform_context_default); 51323 const markWhenOptional = (0, import_element156.useMemo)(() => { 51324 const requiredCount = fieldDefinitions.filter( 51325 (f2) => !!f2.isValid?.required 51326 ).length; 51327 const optionalCount = fieldDefinitions.length - requiredCount; 51328 return requiredCount > optionalCount; 51329 }, [fieldDefinitions]); 51330 function getFieldDefinition2(field) { 51331 return fieldDefinitions.find( 51332 (fieldDefinition) => fieldDefinition.id === field.id 51333 ); 51334 } 51335 const Wrapper = as ?? getFormFieldLayout(form2.layout.type)?.wrapper ?? DEFAULT_WRAPPER; 51336 return /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(Wrapper, { layout: form2.layout, children: form2.fields.map((formField) => { 51337 const FieldLayout = getFormFieldLayout(formField.layout.type)?.component; 51338 if (!FieldLayout) { 51339 return null; 51340 } 51341 const fieldDefinition = !formField.children ? getFieldDefinition2(formField) : void 0; 51342 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { 51343 return null; 51344 } 51345 if (children) { 51346 return children( 51347 FieldLayout, 51348 formField, 51349 validity?.[formField.id], 51350 markWhenOptional 51351 ); 51352 } 51353 return /* @__PURE__ */ (0, import_jsx_runtime284.jsx)( 51354 FieldLayout, 51355 { 51356 data, 51357 field: formField, 51358 onChange, 51359 markWhenOptional, 51360 validity: validity?.[formField.id] 51361 }, 51362 formField.id 51363 ); 51364 }) }); 51365 } 51366 51367 // packages/dataviews/build-module/dataform/index.mjs 51368 var import_jsx_runtime285 = __toESM(require_jsx_runtime(), 1); 51369 function DataForm({ 51370 data, 51371 form: form2, 51372 fields: fields2, 51373 onChange, 51374 validity 51375 }) { 51376 const normalizedForm = (0, import_element157.useMemo)(() => normalize_form_default(form2), [form2]); 51377 const normalizedFields = (0, import_element157.useMemo)( 51378 () => normalizeFields(fields2), 51379 [fields2] 51380 ); 51381 if (!form2.fields) { 51382 return null; 51383 } 51384 return /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0, import_jsx_runtime285.jsx)( 51385 DataFormLayout, 51386 { 51387 data, 51388 form: normalizedForm, 51389 onChange, 51390 validity 51391 } 51392 ) }); 51393 } 51394 51395 // packages/dataviews/build-module/utils/filter-sort-and-paginate.mjs 51396 var import_remove_accents2 = __toESM(require_remove_accents(), 1); 51397 var import_deprecated4 = __toESM(require_deprecated(), 1); 51398 function normalizeSearchInput2(input = "") { 51399 return (0, import_remove_accents2.default)(input.trim().toLowerCase()); 51400 } 51401 var EMPTY_ARRAY10 = []; 51402 function filterSortAndPaginate(data, view, fields2) { 51403 if (!data) { 51404 return { 51405 data: EMPTY_ARRAY10, 51406 paginationInfo: { totalItems: 0, totalPages: 0 } 51407 }; 51408 } 51409 const _fields = normalizeFields(fields2); 51410 let filteredData = [...data]; 51411 if (view.search) { 51412 const normalizedSearch = normalizeSearchInput2(view.search); 51413 filteredData = filteredData.filter((item) => { 51414 return _fields.filter((field) => field.enableGlobalSearch).some((field) => { 51415 const fieldValue = field.getValue({ item }); 51416 const values = Array.isArray(fieldValue) ? fieldValue : [fieldValue]; 51417 return values.some( 51418 (value) => normalizeSearchInput2(String(value)).includes( 51419 normalizedSearch 51420 ) 51421 ); 51422 }); 51423 }); 51424 } 51425 if (view.filters && view.filters?.length > 0) { 51426 view.filters.forEach((filter) => { 51427 const field = _fields.find( 51428 (_field) => _field.id === filter.field 51429 ); 51430 if (field) { 51431 if (filter.operator === OPERATOR_IS_NOT_ALL) { 51432 (0, import_deprecated4.default)("The 'isNotAll' filter operator", { 51433 since: "7.0", 51434 alternative: "'isNone'" 51435 }); 51436 } 51437 const handler = field.filter[filter.operator]; 51438 if (handler) { 51439 filteredData = filteredData.filter( 51440 (item) => handler(item, field, filter.value) 51441 ); 51442 } 51443 } 51444 }); 51445 } 51446 const sortByField = view.sort?.field ? _fields.find((field) => { 51447 return field.enableSorting !== false && field.id === view.sort?.field; 51448 }) : null; 51449 const groupByField = view.groupBy?.field ? _fields.find((field) => { 51450 return field.enableSorting !== false && field.id === view.groupBy?.field; 51451 }) : null; 51452 if (sortByField || groupByField) { 51453 filteredData.sort((a2, b2) => { 51454 if (groupByField) { 51455 const groupCompare = groupByField.sort( 51456 a2, 51457 b2, 51458 view.groupBy?.direction ?? "asc" 51459 ); 51460 if (groupCompare !== 0) { 51461 return groupCompare; 51462 } 51463 } 51464 if (sortByField) { 51465 return sortByField.sort(a2, b2, view.sort?.direction ?? "desc"); 51466 } 51467 return 0; 51468 }); 51469 } 51470 let totalItems = filteredData.length; 51471 let totalPages = 1; 51472 if (view.infiniteScrollEnabled && view.startPosition !== void 0 && view.perPage !== void 0) { 51473 const start2 = view.startPosition - 1; 51474 const end = Math.min(start2 + view.perPage, totalItems); 51475 filteredData = filteredData?.slice(start2, end); 51476 } else if (view.page !== void 0 && view.perPage !== void 0) { 51477 const start2 = (view.page - 1) * view.perPage; 51478 totalItems = filteredData?.length || 0; 51479 totalPages = Math.ceil(totalItems / view.perPage); 51480 filteredData = filteredData?.slice(start2, start2 + view.perPage); 51481 } 51482 return { 51483 data: filteredData, 51484 paginationInfo: { 51485 totalItems, 51486 totalPages 51487 } 51488 }; 51489 } 51490 51491 // packages/fields/build-module/lock-unlock.mjs 51492 var import_private_apis5 = __toESM(require_private_apis(), 1); 51493 var { lock: lock5, unlock: unlock5 } = (0, import_private_apis5.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 51494 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 51495 "@wordpress/fields" 51496 ); 51497 51498 // packages/fields/build-module/components/media-edit/index.mjs 51499 var import_components133 = __toESM(require_components(), 1); 51500 var import_blob2 = __toESM(require_blob(), 1); 51501 var import_core_data35 = __toESM(require_core_data(), 1); 51502 var import_data54 = __toESM(require_data(), 1); 51503 var import_element159 = __toESM(require_element(), 1); 51504 var import_i18n122 = __toESM(require_i18n(), 1); 51505 var import_media_utils = __toESM(require_media_utils(), 1); 51506 var import_notices4 = __toESM(require_notices(), 1); 51507 51508 // packages/fields/build-module/components/media-edit/use-moving-animation.mjs 51509 var import_element158 = __toESM(require_element(), 1); 51510 function getAbsolutePosition2(element) { 51511 return { 51512 top: element.offsetTop, 51513 left: element.offsetLeft 51514 }; 51515 } 51516 function useMovingAnimation2(triggerAnimationOnChange) { 51517 const ref = (0, import_element158.useRef)(null); 51518 const previousRef = (0, import_element158.useRef)(void 0); 51519 if (ref.current) { 51520 previousRef.current = getAbsolutePosition2(ref.current); 51521 } 51522 (0, import_element158.useLayoutEffect)(() => { 51523 const previous = previousRef.current; 51524 if (!previous || !ref.current) { 51525 return; 51526 } 51527 if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) { 51528 return; 51529 } 51530 const controller = new Controller({ 51531 x: 0, 51532 y: 0, 51533 config: { mass: 5, tension: 2e3, friction: 200 }, 51534 onChange({ value }) { 51535 if (!ref.current) { 51536 return; 51537 } 51538 let { x: x22, y: y22 } = value; 51539 x22 = Math.round(x22); 51540 y22 = Math.round(y22); 51541 const finishedMoving = x22 === 0 && y22 === 0; 51542 ref.current.style.transform = finishedMoving ? "" : `translate3d($x22}px,$y22}px,0)`; 51543 } 51544 }); 51545 ref.current.style.transform = ""; 51546 const destination = getAbsolutePosition2(ref.current); 51547 const x2 = Math.round(previous.left - destination.left); 51548 const y2 = Math.round(previous.top - destination.top); 51549 controller.start({ x: 0, y: 0, from: { x: x2, y: y2 } }); 51550 return () => { 51551 controller.stop(); 51552 controller.set({ x: 0, y: 0 }); 51553 }; 51554 }, [triggerAnimationOnChange]); 51555 return ref; 51556 } 51557 51558 // packages/fields/build-module/components/media-edit/index.mjs 51559 var import_jsx_runtime286 = __toESM(require_jsx_runtime(), 1); 51560 var { MediaUploadModal } = unlock5(import_media_utils.privateApis); 51561 function AnimatedMediaItem({ 51562 children, 51563 index: index2, 51564 className 51565 }) { 51566 const ref = useMovingAnimation2(index2); 51567 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { ref, className, children }); 51568 } 51569 function normalizeValue2(value) { 51570 if (Array.isArray(value)) { 51571 return value; 51572 } 51573 return value ? [value] : []; 51574 } 51575 function ConditionalMediaUpload({ render: render4, multiple, ...props }) { 51576 const [isModalOpen, setIsModalOpen] = (0, import_element159.useState)(false); 51577 if (window.__experimentalDataViewsMediaModal) { 51578 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)(import_jsx_runtime286.Fragment, { children: [ 51579 render4 && render4({ open: () => setIsModalOpen(true) }), 51580 isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51581 MediaUploadModal, 51582 { 51583 ...props, 51584 multiple, 51585 isOpen: isModalOpen, 51586 onClose: () => { 51587 setIsModalOpen(false); 51588 props.onClose?.(); 51589 }, 51590 onSelect: (media) => { 51591 setIsModalOpen(false); 51592 props.onSelect?.(media); 51593 } 51594 } 51595 ) 51596 ] }); 51597 } 51598 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51599 import_media_utils.MediaUpload, 51600 { 51601 ...props, 51602 render: render4, 51603 multiple: multiple ? "add" : void 0 51604 } 51605 ); 51606 } 51607 function MediaPickerButton({ 51608 open, 51609 children, 51610 label, 51611 showTooltip = false, 51612 onFilesDrop, 51613 attachment, 51614 isUploading = false 51615 }) { 51616 const isBlob = attachment && (0, import_blob2.isBlobURL)(attachment.source_url); 51617 const mediaPickerButton = /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)( 51618 "div", 51619 { 51620 className: clsx_default("fields__media-edit-picker-button", { 51621 "has-attachment": attachment 51622 }), 51623 role: "button", 51624 tabIndex: 0, 51625 onClick: () => { 51626 if (!isUploading) { 51627 open(); 51628 } 51629 }, 51630 onKeyDown: (event) => { 51631 if (isUploading) { 51632 return; 51633 } 51634 if (event.key === "Enter" || event.key === " ") { 51635 event.preventDefault(); 51636 open(); 51637 } 51638 }, 51639 "aria-label": label, 51640 "aria-disabled": isUploading, 51641 children: [ 51642 children, 51643 isBlob && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("span", { className: "fields__media-edit-picker-button-spinner", children: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(import_components133.Spinner, {}) }), 51644 !isUploading && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51645 import_components133.DropZone, 51646 { 51647 onFilesDrop: (files) => onFilesDrop(files, attachment?.id) 51648 } 51649 ) 51650 ] 51651 } 51652 ); 51653 if (!showTooltip) { 51654 return mediaPickerButton; 51655 } 51656 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)(tooltip_exports.Root, { children: [ 51657 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(tooltip_exports.Trigger, { render: mediaPickerButton }), 51658 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(tooltip_exports.Popup, { children: label }) 51659 ] }); 51660 } 51661 var archiveMimeTypes = [ 51662 "application/zip", 51663 "application/x-zip-compressed", 51664 "application/x-rar-compressed", 51665 "application/x-7z-compressed", 51666 "application/x-tar", 51667 "application/x-gzip" 51668 ]; 51669 function MediaTitle({ attachment }) { 51670 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(import_components133.__experimentalTruncate, { className: "fields__media-edit-filename", children: attachment.title.rendered }); 51671 } 51672 function MediaEditPlaceholder(props) { 51673 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(MediaPickerButton, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("span", { className: "fields__media-edit-placeholder", children: props.label }) }); 51674 } 51675 function MoveButtons({ 51676 itemId, 51677 index: index2, 51678 totalItems, 51679 isUploading, 51680 moveItem, 51681 orientation = "vertical" 51682 }) { 51683 const isHorizontal = orientation === "horizontal"; 51684 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)(import_jsx_runtime286.Fragment, { children: [ 51685 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51686 import_components133.Button, 51687 { 51688 __next40pxDefaultSize: true, 51689 icon: isHorizontal ? chevron_left_default : chevron_up_default, 51690 label: isHorizontal ? (0, import_i18n122.__)("Move left") : (0, import_i18n122.__)("Move up"), 51691 size: "small", 51692 disabled: isUploading || index2 === 0, 51693 accessibleWhenDisabled: true, 51694 tooltipPosition: "top", 51695 onClick: (event) => { 51696 event.stopPropagation(); 51697 moveItem(itemId, "up"); 51698 } 51699 } 51700 ), 51701 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51702 import_components133.Button, 51703 { 51704 __next40pxDefaultSize: true, 51705 icon: isHorizontal ? chevron_right_default : chevron_down_default, 51706 label: isHorizontal ? (0, import_i18n122.__)("Move right") : (0, import_i18n122.__)("Move down"), 51707 size: "small", 51708 disabled: isUploading || index2 === totalItems - 1, 51709 accessibleWhenDisabled: true, 51710 tooltipPosition: "top", 51711 onClick: (event) => { 51712 event.stopPropagation(); 51713 moveItem(itemId, "down"); 51714 } 51715 } 51716 ) 51717 ] }); 51718 } 51719 function MediaPreview({ attachment }) { 51720 const url = attachment.source_url; 51721 const mimeType = attachment.mime_type || ""; 51722 if (mimeType.startsWith("image")) { 51723 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51724 "img", 51725 { 51726 className: "fields__media-edit-thumbnail", 51727 alt: attachment.alt_text || "", 51728 src: url 51729 } 51730 ); 51731 } else if (mimeType.startsWith("audio")) { 51732 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(import_components133.Icon, { icon: audio_default }); 51733 } else if (mimeType.startsWith("video")) { 51734 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(import_components133.Icon, { icon: video_default }); 51735 } else if (archiveMimeTypes.includes(mimeType)) { 51736 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(import_components133.Icon, { icon: archive_default }); 51737 } 51738 return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(import_components133.Icon, { icon: file_default }); 51739 } 51740 function ExpandedMediaEditAttachments({ 51741 allItems, 51742 addButtonLabel, 51743 multiple, 51744 removeItem, 51745 moveItem, 51746 open, 51747 onFilesDrop, 51748 isUploading, 51749 setTargetItemId 51750 }) { 51751 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)( 51752 "div", 51753 { 51754 className: clsx_default("fields__media-edit-expanded", { 51755 "is-multiple": multiple, 51756 "is-single": !multiple, 51757 "is-empty": !allItems?.length 51758 }), 51759 children: [ 51760 allItems?.map((attachment, index2) => { 51761 const hasPreviewImage = attachment.mime_type?.startsWith("image"); 51762 const isBlob = (0, import_blob2.isBlobURL)(attachment.source_url); 51763 const attachmentNumericId = attachment.id; 51764 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)( 51765 AnimatedMediaItem, 51766 { 51767 index: index2, 51768 className: clsx_default("fields__media-edit-expanded-item", { 51769 "has-preview-image": hasPreviewImage 51770 }), 51771 children: [ 51772 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51773 MediaPickerButton, 51774 { 51775 open: () => { 51776 setTargetItemId(attachmentNumericId); 51777 open(); 51778 }, 51779 label: !isBlob ? (0, import_i18n122.sprintf)( 51780 /* translators: %s: The title of the media item. */ 51781 (0, import_i18n122.__)("Replace %s"), 51782 attachment.title.rendered 51783 ) : (0, import_i18n122.__)("Replace"), 51784 showTooltip: true, 51785 onFilesDrop, 51786 attachment, 51787 isUploading, 51788 children: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { className: "fields__media-edit-expanded-preview", children: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51789 import_components133.__experimentalVStack, 51790 { 51791 spacing: 0, 51792 alignment: "center", 51793 justify: "center", 51794 className: "fields__media-edit-expanded-preview-stack", 51795 children: (!isBlob || hasPreviewImage) && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51796 MediaPreview, 51797 { 51798 attachment 51799 } 51800 ) 51801 } 51802 ) }) 51803 } 51804 ), 51805 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { className: "fields__media-edit-expanded-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)( 51806 import_components133.__experimentalHStack, 51807 { 51808 className: "fields__media-edit-expanded-actions", 51809 spacing: 0, 51810 alignment: "flex-end", 51811 expanded: false, 51812 children: [ 51813 multiple && allItems.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51814 MoveButtons, 51815 { 51816 itemId: attachmentNumericId, 51817 index: index2, 51818 totalItems: allItems.length, 51819 isUploading, 51820 moveItem, 51821 orientation: "horizontal" 51822 } 51823 ), 51824 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51825 import_components133.Button, 51826 { 51827 __next40pxDefaultSize: true, 51828 icon: close_small_default, 51829 label: (0, import_i18n122.__)("Remove"), 51830 size: "small", 51831 disabled: isUploading, 51832 accessibleWhenDisabled: true, 51833 tooltipPosition: "top", 51834 onClick: (event) => { 51835 event.stopPropagation(); 51836 removeItem(attachmentNumericId); 51837 } 51838 } 51839 ) 51840 ] 51841 } 51842 ) }) 51843 ] 51844 }, 51845 attachment.id 51846 ); 51847 }), 51848 (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51849 MediaEditPlaceholder, 51850 { 51851 open: () => { 51852 setTargetItemId(void 0); 51853 open(); 51854 }, 51855 label: addButtonLabel, 51856 onFilesDrop, 51857 isUploading 51858 } 51859 ) 51860 ] 51861 } 51862 ); 51863 } 51864 function CompactMediaEditAttachments({ 51865 allItems, 51866 addButtonLabel, 51867 multiple, 51868 removeItem, 51869 moveItem, 51870 open, 51871 onFilesDrop, 51872 isUploading, 51873 setTargetItemId 51874 }) { 51875 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)(import_jsx_runtime286.Fragment, { children: [ 51876 !!allItems?.length && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51877 "div", 51878 { 51879 className: clsx_default("fields__media-edit-compact-group", { 51880 "is-single": allItems.length === 1 51881 }), 51882 children: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(import_components133.__experimentalVStack, { spacing: 0, children: allItems.map((attachment, index2) => { 51883 const isBlob = (0, import_blob2.isBlobURL)(attachment.source_url); 51884 const showMoveButtons = multiple && allItems.length > 1; 51885 const attachmentNumericId = attachment.id; 51886 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)( 51887 AnimatedMediaItem, 51888 { 51889 index: index2, 51890 className: "fields__media-edit-compact", 51891 children: [ 51892 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51893 MediaPickerButton, 51894 { 51895 open: () => { 51896 setTargetItemId( 51897 attachmentNumericId 51898 ); 51899 open(); 51900 }, 51901 label: (0, import_i18n122.__)("Replace"), 51902 showTooltip: true, 51903 onFilesDrop, 51904 attachment, 51905 isUploading, 51906 children: /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)(import_jsx_runtime286.Fragment, { children: [ 51907 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51908 MediaPreview, 51909 { 51910 attachment 51911 } 51912 ), 51913 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51914 MediaTitle, 51915 { 51916 attachment 51917 } 51918 ) 51919 ] }) 51920 } 51921 ), 51922 !isBlob && /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)( 51923 import_components133.__experimentalHStack, 51924 { 51925 className: "fields__media-edit-compact-movers", 51926 spacing: 0, 51927 alignment: "flex-end", 51928 expanded: false, 51929 children: [ 51930 showMoveButtons && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51931 MoveButtons, 51932 { 51933 itemId: attachmentNumericId, 51934 index: index2, 51935 totalItems: allItems.length, 51936 isUploading, 51937 moveItem, 51938 orientation: "vertical" 51939 } 51940 ), 51941 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51942 import_components133.Button, 51943 { 51944 __next40pxDefaultSize: true, 51945 icon: close_small_default, 51946 label: (0, import_i18n122.__)("Remove"), 51947 size: "small", 51948 disabled: isUploading, 51949 accessibleWhenDisabled: true, 51950 tooltipPosition: "top", 51951 onClick: (event) => { 51952 event.stopPropagation(); 51953 removeItem( 51954 attachmentNumericId 51955 ); 51956 } 51957 } 51958 ) 51959 ] 51960 } 51961 ) 51962 ] 51963 }, 51964 attachment.id 51965 ); 51966 }) }) 51967 } 51968 ), 51969 (multiple || !allItems?.length) && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 51970 MediaEditPlaceholder, 51971 { 51972 open: () => { 51973 setTargetItemId(void 0); 51974 open(); 51975 }, 51976 label: addButtonLabel, 51977 onFilesDrop, 51978 isUploading 51979 } 51980 ) 51981 ] }); 51982 } 51983 function MediaEdit({ 51984 data, 51985 field, 51986 onChange, 51987 hideLabelFromVision, 51988 allowedTypes = ["image"], 51989 multiple, 51990 isExpanded, 51991 validity 51992 }) { 51993 const value = field.getValue({ item: data }); 51994 const [isTouched, setIsTouched] = (0, import_element159.useState)(false); 51995 const validityTargetRef = (0, import_element159.useRef)(null); 51996 const [customValidity, setCustomValidity] = (0, import_element159.useState)(void 0); 51997 (0, import_element159.useEffect)(() => { 51998 const validityTarget = validityTargetRef.current; 51999 const handler = () => { 52000 setIsTouched(true); 52001 }; 52002 validityTarget?.addEventListener("invalid", handler); 52003 return () => validityTarget?.removeEventListener("invalid", handler); 52004 }, []); 52005 const attachments = (0, import_data54.useSelect)( 52006 (select4) => { 52007 if (!value) { 52008 return null; 52009 } 52010 const normalizedValue = normalizeValue2(value); 52011 const sortedIds = normalizedValue.toSorted((a2, b2) => a2 - b2); 52012 const { getEntityRecords } = select4(import_core_data35.store); 52013 return getEntityRecords("postType", "attachment", { 52014 include: sortedIds 52015 }); 52016 }, 52017 [value] 52018 ); 52019 const stableAttachmentsRef = (0, import_element159.useRef)( 52020 null 52021 ); 52022 if (attachments !== null) { 52023 stableAttachmentsRef.current = attachments; 52024 } 52025 let stableAttachments = attachments; 52026 if (attachments === null && stableAttachmentsRef.current && value) { 52027 const stableIds = new Set( 52028 stableAttachmentsRef.current.map((a2) => a2.id) 52029 ); 52030 if (normalizeValue2(value).every((id) => stableIds.has(id))) { 52031 stableAttachments = stableAttachmentsRef.current; 52032 } 52033 } 52034 const orderedAttachments = (0, import_element159.useMemo)(() => { 52035 if (!stableAttachments) { 52036 return null; 52037 } 52038 const normalizedValue = normalizeValue2(value); 52039 const attachmentMap = new Map( 52040 stableAttachments.map((a2) => [a2.id, a2]) 52041 ); 52042 return normalizedValue.map((id) => attachmentMap.get(id)).filter((a2) => a2 !== void 0); 52043 }, [stableAttachments, value]); 52044 const { createErrorNotice } = (0, import_data54.useDispatch)(import_notices4.store); 52045 const { receiveEntityRecords } = (0, import_data54.useDispatch)(import_core_data35.store); 52046 const [targetItemId, setTargetItemId] = (0, import_element159.useState)(); 52047 const openModalRef = (0, import_element159.useRef)(void 0); 52048 const [pendingOpen, setPendingOpen] = (0, import_element159.useState)(false); 52049 const [blobs, setBlobs] = (0, import_element159.useState)([]); 52050 (0, import_element159.useEffect)(() => { 52051 if (pendingOpen) { 52052 setPendingOpen(false); 52053 openModalRef.current?.(); 52054 } 52055 }, [pendingOpen]); 52056 const onChangeControl = (0, import_element159.useCallback)( 52057 (newValue) => onChange(field.setValue({ item: data, value: newValue })), 52058 [data, field, onChange] 52059 ); 52060 const removeItem = (0, import_element159.useCallback)( 52061 (itemId) => { 52062 const currentIds = normalizeValue2(value); 52063 const newIds = currentIds.filter((id) => id !== itemId); 52064 setIsTouched(true); 52065 onChangeControl(newIds.length ? newIds : void 0); 52066 }, 52067 [value, onChangeControl] 52068 ); 52069 const moveItem = (0, import_element159.useCallback)( 52070 (itemId, direction) => { 52071 if (!orderedAttachments) { 52072 return; 52073 } 52074 const currentIds = orderedAttachments.map((a2) => a2.id); 52075 const index2 = currentIds.indexOf(itemId); 52076 const newIndex = direction === "up" ? index2 - 1 : index2 + 1; 52077 [currentIds[index2], currentIds[newIndex]] = [ 52078 currentIds[newIndex], 52079 currentIds[index2] 52080 ]; 52081 onChangeControl(currentIds); 52082 }, 52083 [orderedAttachments, onChangeControl] 52084 ); 52085 const onFilesDrop = (0, import_element159.useCallback)( 52086 (files, _targetItemId) => { 52087 setTargetItemId(_targetItemId); 52088 (0, import_media_utils.uploadMedia)({ 52089 allowedTypes: allowedTypes?.length ? allowedTypes : void 0, 52090 filesList: files, 52091 onFileChange(uploadedMedia) { 52092 const blobUrls = uploadedMedia.filter((item) => (0, import_blob2.isBlobURL)(item.url)).map((item) => item.url); 52093 setBlobs(blobUrls); 52094 if (!!blobUrls.length) { 52095 return; 52096 } 52097 receiveEntityRecords( 52098 "postType", 52099 "attachment", 52100 [], 52101 void 0, 52102 true 52103 ); 52104 const uploadedIds = uploadedMedia.map( 52105 (item) => item.id 52106 ); 52107 if (!multiple) { 52108 onChangeControl(uploadedIds[0]); 52109 setTargetItemId(void 0); 52110 return; 52111 } 52112 const currentValue = normalizeValue2(value); 52113 if (_targetItemId === void 0) { 52114 onChangeControl([...currentValue, ...uploadedIds]); 52115 } else { 52116 const newValue = [...currentValue]; 52117 newValue.splice( 52118 currentValue.indexOf(_targetItemId), 52119 1, 52120 ...uploadedIds 52121 ); 52122 onChangeControl(newValue); 52123 } 52124 setTargetItemId(void 0); 52125 }, 52126 onError(error2) { 52127 setTargetItemId(void 0); 52128 setBlobs([]); 52129 createErrorNotice(error2.message, { type: "snackbar" }); 52130 }, 52131 multiple: !!multiple 52132 }); 52133 }, 52134 [ 52135 allowedTypes, 52136 value, 52137 multiple, 52138 createErrorNotice, 52139 onChangeControl, 52140 receiveEntityRecords 52141 ] 52142 ); 52143 const addButtonLabel = field.placeholder || (multiple ? (0, import_i18n122.__)("Choose files") : (0, import_i18n122.__)("Choose file")); 52144 const allItems = (0, import_element159.useMemo)(() => { 52145 if (!blobs.length) { 52146 return orderedAttachments; 52147 } 52148 const items = [ 52149 ...orderedAttachments || [] 52150 ]; 52151 const blobItems = blobs.map((url) => ({ 52152 id: url, 52153 source_url: url, 52154 mime_type: (0, import_blob2.getBlobTypeByURL)(url) 52155 })); 52156 if (targetItemId !== void 0) { 52157 const targetIndex = items.findIndex( 52158 (a2) => a2.id === targetItemId 52159 ); 52160 items.splice(targetIndex, 1, ...blobItems); 52161 } else { 52162 items.push(...blobItems); 52163 } 52164 return items; 52165 }, [orderedAttachments, targetItemId, blobs]); 52166 (0, import_element159.useEffect)(() => { 52167 if (!isTouched) { 52168 return; 52169 } 52170 const input = validityTargetRef.current; 52171 if (!input) { 52172 return; 52173 } 52174 if (validity) { 52175 const customValidityResult = validity?.custom; 52176 setCustomValidity(customValidityResult); 52177 if (customValidityResult?.type === "invalid") { 52178 input.setCustomValidity( 52179 customValidityResult.message || (0, import_i18n122.__)("Invalid") 52180 ); 52181 } else { 52182 input.setCustomValidity(""); 52183 } 52184 } else { 52185 input.setCustomValidity(""); 52186 setCustomValidity(void 0); 52187 } 52188 }, [isTouched, field.isValid, validity]); 52189 const onBlur = (0, import_element159.useCallback)( 52190 (event) => { 52191 if (isTouched) { 52192 return; 52193 } 52194 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { 52195 setIsTouched(true); 52196 } 52197 }, 52198 [isTouched] 52199 ); 52200 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)("div", { onBlur, children: [ 52201 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("fieldset", { className: "fields__media-edit", "data-field-id": field.id, children: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 52202 ConditionalMediaUpload, 52203 { 52204 onSelect: (selectedMedia) => { 52205 if (!multiple) { 52206 onChangeControl(selectedMedia.id); 52207 setTargetItemId(void 0); 52208 return; 52209 } 52210 const newIds = Array.isArray(selectedMedia) ? selectedMedia.map((m2) => m2.id) : [selectedMedia.id]; 52211 const currentValue = normalizeValue2(value); 52212 if (!currentValue.length) { 52213 onChangeControl(newIds); 52214 } else if (targetItemId === void 0) { 52215 const existingItems = currentValue.filter( 52216 (id) => newIds.includes(id) 52217 ); 52218 const newItems = newIds.filter( 52219 (id) => !currentValue.includes(id) 52220 ); 52221 onChangeControl([ 52222 ...existingItems, 52223 ...newItems 52224 ]); 52225 } else if (selectedMedia.id !== targetItemId) { 52226 const filtered = currentValue.filter( 52227 (id) => id !== selectedMedia.id 52228 ); 52229 onChangeControl( 52230 filtered.map( 52231 (id) => id === targetItemId ? selectedMedia.id : id 52232 ) 52233 ); 52234 } 52235 setTargetItemId(void 0); 52236 }, 52237 onClose: () => setTargetItemId(void 0), 52238 allowedTypes, 52239 value: targetItemId !== void 0 ? targetItemId : value, 52240 multiple: multiple && targetItemId === void 0, 52241 title: field.label, 52242 render: ({ open }) => { 52243 openModalRef.current = open; 52244 const AttachmentsComponent = isExpanded ? ExpandedMediaEditAttachments : CompactMediaEditAttachments; 52245 return /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)(import_components133.__experimentalVStack, { spacing: 2, children: [ 52246 field.label && (hideLabelFromVision ? /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("legend", {}), children: field.label }) : /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 52247 import_components133.BaseControl.VisualLabel, 52248 { 52249 as: "legend", 52250 style: { marginBottom: 0 }, 52251 children: field.label 52252 } 52253 )), 52254 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 52255 AttachmentsComponent, 52256 { 52257 allItems, 52258 addButtonLabel, 52259 multiple, 52260 removeItem, 52261 moveItem, 52262 open: () => setPendingOpen(true), 52263 onFilesDrop, 52264 isUploading: !!blobs.length, 52265 setTargetItemId 52266 } 52267 ), 52268 field.description && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 52269 import_components133.__experimentalText, 52270 { 52271 variant: "muted", 52272 className: "fields__media-edit-description", 52273 children: field.description 52274 } 52275 ) 52276 ] }); 52277 } 52278 } 52279 ) }), 52280 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 52281 "input", 52282 { 52283 type: "text", 52284 ref: validityTargetRef, 52285 value: value ?? "", 52286 tabIndex: -1, 52287 "aria-hidden": "true", 52288 onChange: () => { 52289 } 52290 } 52291 ) }), 52292 customValidity && /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("div", { "aria-live": "polite", children: /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)( 52293 "p", 52294 { 52295 className: clsx_default( 52296 "components-validated-control__indicator", 52297 { 52298 "is-invalid": customValidity.type === "invalid", 52299 "is-valid": customValidity.type === "valid" 52300 } 52301 ), 52302 children: [ 52303 /* @__PURE__ */ (0, import_jsx_runtime286.jsx)( 52304 import_components133.Icon, 52305 { 52306 className: "components-validated-control__indicator-icon", 52307 icon: error_default, 52308 size: 16, 52309 fill: "currentColor" 52310 } 52311 ), 52312 customValidity.message 52313 ] 52314 } 52315 ) }) 52316 ] }); 52317 } 52318 52319 // node_modules/tslib/tslib.es6.mjs 52320 var __assign = function() { 52321 __assign = Object.assign || function __assign2(t3) { 52322 for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { 52323 s2 = arguments[i2]; 52324 for (var p3 in s2) if (Object.prototype.hasOwnProperty.call(s2, p3)) t3[p3] = s2[p3]; 52325 } 52326 return t3; 52327 }; 52328 return __assign.apply(this, arguments); 52329 }; 52330 52331 // node_modules/lower-case/dist.es2015/index.js 52332 function lowerCase(str) { 52333 return str.toLowerCase(); 52334 } 52335 52336 // node_modules/no-case/dist.es2015/index.js 52337 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 52338 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 52339 function noCase(input, options) { 52340 if (options === void 0) { 52341 options = {}; 52342 } 52343 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; 52344 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 52345 var start2 = 0; 52346 var end = result.length; 52347 while (result.charAt(start2) === "\0") 52348 start2++; 52349 while (result.charAt(end - 1) === "\0") 52350 end--; 52351 return result.slice(start2, end).split("\0").map(transform).join(delimiter); 52352 } 52353 function replace(input, re, value) { 52354 if (re instanceof RegExp) 52355 return input.replace(re, value); 52356 return re.reduce(function(input2, re2) { 52357 return input2.replace(re2, value); 52358 }, input); 52359 } 52360 52361 // node_modules/dot-case/dist.es2015/index.js 52362 function dotCase(input, options) { 52363 if (options === void 0) { 52364 options = {}; 52365 } 52366 return noCase(input, __assign({ delimiter: "." }, options)); 52367 } 52368 52369 // node_modules/param-case/dist.es2015/index.js 52370 function paramCase(input, options) { 52371 if (options === void 0) { 52372 options = {}; 52373 } 52374 return dotCase(input, __assign({ delimiter: "-" }, options)); 52375 } 52376 52377 // packages/edit-site/build-module/components/sidebar-identity/index.mjs 52378 var import_jsx_runtime287 = __toESM(require_jsx_runtime(), 1); 52379 var fields = [ 52380 { 52381 id: "title", 52382 type: "text", 52383 label: (0, import_i18n123.__)("Site Title"), 52384 description: (0, import_i18n123.__)( 52385 "Displays in your site's layout via the Site Title block." 52386 ) 52387 }, 52388 { 52389 id: "description", 52390 type: "text", 52391 label: (0, import_i18n123.__)("Site Tagline"), 52392 description: (0, import_i18n123.__)( 52393 "In a few words, explain what this site is about. Displays in your site's layout via the Site Tagline block." 52394 ) 52395 }, 52396 { 52397 id: "site_logo", 52398 type: "media", 52399 label: (0, import_i18n123.__)("Site Logo"), 52400 description: (0, import_i18n123.__)( 52401 "Displays in your site's layout via the Site Logo block." 52402 ), 52403 placeholder: (0, import_i18n123.__)("Choose logo"), 52404 Edit: MediaEdit, 52405 setValue: ({ value }) => ({ 52406 site_logo: value ?? 0 52407 }) 52408 }, 52409 { 52410 id: "site_icon", 52411 type: "media", 52412 label: (0, import_i18n123.__)("Site Icon"), 52413 description: (0, import_i18n123.__)( 52414 "Shown in browser tabs, bookmarks, and mobile apps. It should be square and at least 512 by 512 pixels." 52415 ), 52416 placeholder: (0, import_i18n123.__)("Choose icon"), 52417 Edit: MediaEdit, 52418 setValue: ({ value }) => ({ 52419 site_icon: value ?? 0 52420 }) 52421 } 52422 ]; 52423 var form = { 52424 layout: { 52425 type: "regular", 52426 labelPosition: "top" 52427 }, 52428 fields: ["title", "description", "site_logo", "site_icon"] 52429 }; 52430 function SidebarIdentity() { 52431 const data = (0, import_data55.useSelect)( 52432 (select4) => select4(import_core_data36.store).getEditedEntityRecord("root", "site"), 52433 [] 52434 ); 52435 const { editEntityRecord } = (0, import_data55.useDispatch)(import_core_data36.store); 52436 const onChange = (edits) => { 52437 editEntityRecord("root", "site", void 0, edits); 52438 }; 52439 return /* @__PURE__ */ (0, import_jsx_runtime287.jsx)( 52440 page_default2, 52441 { 52442 title: (0, import_i18n123._x)("Identity", "site identity"), 52443 headingLevel: 2, 52444 hasPadding: true, 52445 children: /* @__PURE__ */ (0, import_jsx_runtime287.jsx)( 52446 DataForm, 52447 { 52448 data, 52449 fields, 52450 form, 52451 onChange 52452 } 52453 ) 52454 } 52455 ); 52456 } 52457 52458 // packages/edit-site/build-module/components/site-editor-routes/identity.mjs 52459 var import_jsx_runtime288 = __toESM(require_jsx_runtime(), 1); 52460 var identityRoute = { 52461 name: "identity", 52462 path: "/identity", 52463 areas: { 52464 sidebar: /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(SidebarNavigationScreenIdentity, {}), 52465 content: /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(SidebarIdentity, {}), 52466 preview: /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(EditSiteEditor, {}), 52467 mobileContent: /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(SidebarIdentity, {}) 52468 }, 52469 widths: { 52470 content: 380 52471 } 52472 }; 52473 52474 // packages/edit-site/build-module/components/site-editor-routes/styles.mjs 52475 var import_router21 = __toESM(require_router(), 1); 52476 var import_editor24 = __toESM(require_editor(), 1); 52477 var import_url15 = __toESM(require_url(), 1); 52478 52479 // packages/edit-site/build-module/components/sidebar-global-styles/index.mjs 52480 var import_i18n124 = __toESM(require_i18n(), 1); 52481 var import_element160 = __toESM(require_element(), 1); 52482 var import_router20 = __toESM(require_router(), 1); 52483 var import_editor23 = __toESM(require_editor(), 1); 52484 var import_compose27 = __toESM(require_compose(), 1); 52485 var import_data56 = __toESM(require_data(), 1); 52486 var import_components134 = __toESM(require_components(), 1); 52487 var import_url14 = __toESM(require_url(), 1); 52488 var import_jsx_runtime289 = __toESM(require_jsx_runtime(), 1); 52489 var { GlobalStylesUIWrapper, GlobalStylesActionMenu } = unlock(import_editor23.privateApis); 52490 var { useLocation: useLocation19, useHistory: useHistory12 } = unlock(import_router20.privateApis); 52491 var GlobalStylesPageActions = ({ 52492 isStyleBookOpened, 52493 setIsStyleBookOpened, 52494 path, 52495 onChangeSection 52496 }) => { 52497 const history = useHistory12(); 52498 return /* @__PURE__ */ (0, import_jsx_runtime289.jsxs)(import_components134.__experimentalHStack, { className: "edit-site-styles__header-actions", children: [ 52499 /* @__PURE__ */ (0, import_jsx_runtime289.jsx)( 52500 import_components134.Button, 52501 { 52502 isPressed: isStyleBookOpened, 52503 icon: seen_default, 52504 label: (0, import_i18n124.__)("Style Book"), 52505 onClick: () => { 52506 setIsStyleBookOpened(!isStyleBookOpened); 52507 const updatedPath = !isStyleBookOpened ? (0, import_url14.addQueryArgs)(path, { preview: "stylebook" }) : (0, import_url14.removeQueryArgs)(path, "preview"); 52508 history.navigate(updatedPath); 52509 }, 52510 size: "compact" 52511 } 52512 ), 52513 /* @__PURE__ */ (0, import_jsx_runtime289.jsx)( 52514 GlobalStylesActionMenu, 52515 { 52516 hideWelcomeGuide: true, 52517 onChangePath: onChangeSection 52518 } 52519 ) 52520 ] }); 52521 }; 52522 var useSection = () => { 52523 const { path, query } = useLocation19(); 52524 const history = useHistory12(); 52525 return (0, import_element160.useMemo)(() => { 52526 return [ 52527 query.section ?? "/", 52528 (updatedSection) => { 52529 history.navigate( 52530 (0, import_url14.addQueryArgs)(path, { 52531 section: updatedSection 52532 }) 52533 ); 52534 } 52535 ]; 52536 }, [path, query.section, history]); 52537 }; 52538 function SidebarGlobalStyles() { 52539 const { path } = useLocation19(); 52540 const [isStyleBookOpened, setIsStyleBookOpened] = (0, import_element160.useState)( 52541 path.includes("preview=stylebook") 52542 ); 52543 const isMobileViewport = (0, import_compose27.useViewportMatch)("medium", "<"); 52544 const [section, onChangeSection] = useSection(); 52545 const settings2 = (0, import_data56.useSelect)( 52546 (select4) => select4(store).getSettings(), 52547 [] 52548 ); 52549 return /* @__PURE__ */ (0, import_jsx_runtime289.jsx)( 52550 page_default2, 52551 { 52552 actions: !isMobileViewport ? /* @__PURE__ */ (0, import_jsx_runtime289.jsx)( 52553 GlobalStylesPageActions, 52554 { 52555 isStyleBookOpened, 52556 setIsStyleBookOpened, 52557 path, 52558 onChangeSection 52559 } 52560 ) : null, 52561 className: "edit-site-styles", 52562 title: (0, import_i18n124.__)("Styles"), 52563 headingLevel: 2, 52564 children: /* @__PURE__ */ (0, import_jsx_runtime289.jsx)( 52565 GlobalStylesUIWrapper, 52566 { 52567 path: section, 52568 onPathChange: onChangeSection, 52569 settings: settings2 52570 } 52571 ) 52572 } 52573 ); 52574 } 52575 52576 // packages/edit-site/build-module/components/site-editor-routes/styles.mjs 52577 var import_jsx_runtime290 = __toESM(require_jsx_runtime(), 1); 52578 var { useLocation: useLocation20, useHistory: useHistory13 } = unlock(import_router21.privateApis); 52579 var { StyleBookPreview } = unlock(import_editor24.privateApis); 52580 function StylesPreviewArea() { 52581 const { path, query } = useLocation20(); 52582 const history = useHistory13(); 52583 const isStylebook = query.preview === "stylebook"; 52584 const section = query.section ?? "/"; 52585 const onChangeSection = (updatedSection) => { 52586 history.navigate( 52587 (0, import_url15.addQueryArgs)(path, { 52588 section: updatedSection 52589 }) 52590 ); 52591 }; 52592 if (isStylebook) { 52593 return /* @__PURE__ */ (0, import_jsx_runtime290.jsx)( 52594 StyleBookPreview, 52595 { 52596 path: section, 52597 onPathChange: onChangeSection 52598 } 52599 ); 52600 } 52601 return /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(EditSiteEditor, {}); 52602 } 52603 var stylesRoute = { 52604 name: "styles", 52605 path: "/styles", 52606 areas: { 52607 content: /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(SidebarGlobalStyles, {}), 52608 sidebar: /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(SidebarNavigationScreenGlobalStyles, { backPath: "/" }), 52609 preview: /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(StylesPreviewArea, {}), 52610 mobileContent: /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(SidebarGlobalStyles, {}) 52611 }, 52612 widths: { 52613 content: 380 52614 } 52615 }; 52616 52617 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.mjs 52618 var import_i18n133 = __toESM(require_i18n(), 1); 52619 var import_core_data41 = __toESM(require_core_data(), 1); 52620 var import_data62 = __toESM(require_data(), 1); 52621 var import_html_entities8 = __toESM(require_html_entities(), 1); 52622 var import_components140 = __toESM(require_components(), 1); 52623 52624 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.mjs 52625 var PRELOADED_NAVIGATION_MENUS_QUERY = { 52626 per_page: 100, 52627 status: ["publish", "draft"], 52628 order: "desc", 52629 orderby: "date" 52630 }; 52631 52632 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.mjs 52633 var import_i18n130 = __toESM(require_i18n(), 1); 52634 var import_html_entities6 = __toESM(require_html_entities(), 1); 52635 52636 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.mjs 52637 var import_components137 = __toESM(require_components(), 1); 52638 var import_i18n127 = __toESM(require_i18n(), 1); 52639 var import_element162 = __toESM(require_element(), 1); 52640 var import_router22 = __toESM(require_router(), 1); 52641 52642 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.mjs 52643 var import_components135 = __toESM(require_components(), 1); 52644 var import_i18n125 = __toESM(require_i18n(), 1); 52645 var import_element161 = __toESM(require_element(), 1); 52646 var import_jsx_runtime291 = __toESM(require_jsx_runtime(), 1); 52647 var notEmptyString = (testString) => testString?.trim()?.length > 0; 52648 function RenameModal({ menuTitle, onClose, onSave }) { 52649 const [editedMenuTitle, setEditedMenuTitle] = (0, import_element161.useState)(menuTitle); 52650 const titleHasChanged = editedMenuTitle !== menuTitle; 52651 const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle); 52652 return /* @__PURE__ */ (0, import_jsx_runtime291.jsx)( 52653 import_components135.Modal, 52654 { 52655 title: (0, import_i18n125.__)("Rename"), 52656 onRequestClose: onClose, 52657 focusOnMount: "firstContentElement", 52658 size: "small", 52659 children: /* @__PURE__ */ (0, import_jsx_runtime291.jsx)("form", { className: "sidebar-navigation__rename-modal-form", children: /* @__PURE__ */ (0, import_jsx_runtime291.jsxs)(import_components135.__experimentalVStack, { spacing: "3", children: [ 52660 /* @__PURE__ */ (0, import_jsx_runtime291.jsx)( 52661 import_components135.TextControl, 52662 { 52663 __next40pxDefaultSize: true, 52664 value: editedMenuTitle, 52665 placeholder: (0, import_i18n125.__)("Navigation title"), 52666 onChange: setEditedMenuTitle, 52667 label: (0, import_i18n125.__)("Name") 52668 } 52669 ), 52670 /* @__PURE__ */ (0, import_jsx_runtime291.jsxs)(import_components135.__experimentalHStack, { justify: "right", children: [ 52671 /* @__PURE__ */ (0, import_jsx_runtime291.jsx)( 52672 import_components135.Button, 52673 { 52674 __next40pxDefaultSize: true, 52675 variant: "tertiary", 52676 onClick: onClose, 52677 children: (0, import_i18n125.__)("Cancel") 52678 } 52679 ), 52680 /* @__PURE__ */ (0, import_jsx_runtime291.jsx)( 52681 import_components135.Button, 52682 { 52683 __next40pxDefaultSize: true, 52684 accessibleWhenDisabled: true, 52685 disabled: !isEditedMenuTitleValid, 52686 variant: "primary", 52687 type: "submit", 52688 onClick: (e2) => { 52689 e2.preventDefault(); 52690 if (!isEditedMenuTitleValid) { 52691 return; 52692 } 52693 onSave({ title: editedMenuTitle }); 52694 onClose(); 52695 }, 52696 children: (0, import_i18n125.__)("Save") 52697 } 52698 ) 52699 ] }) 52700 ] }) }) 52701 } 52702 ); 52703 } 52704 52705 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.mjs 52706 var import_components136 = __toESM(require_components(), 1); 52707 var import_i18n126 = __toESM(require_i18n(), 1); 52708 var import_jsx_runtime292 = __toESM(require_jsx_runtime(), 1); 52709 function DeleteConfirmDialog({ onClose, onConfirm }) { 52710 return /* @__PURE__ */ (0, import_jsx_runtime292.jsx)( 52711 import_components136.__experimentalConfirmDialog, 52712 { 52713 isOpen: true, 52714 onConfirm: () => { 52715 onConfirm(); 52716 onClose(); 52717 }, 52718 onCancel: onClose, 52719 confirmButtonText: (0, import_i18n126.__)("Delete"), 52720 size: "medium", 52721 children: (0, import_i18n126.__)("Are you sure you want to delete this Navigation Menu?") 52722 } 52723 ); 52724 } 52725 52726 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.mjs 52727 var import_jsx_runtime293 = __toESM(require_jsx_runtime(), 1); 52728 var { useHistory: useHistory14 } = unlock(import_router22.privateApis); 52729 var POPOVER_PROPS = { 52730 position: "bottom right" 52731 }; 52732 function ScreenNavigationMoreMenu(props) { 52733 const { onDelete, onSave, onDuplicate, menuTitle, menuId } = props; 52734 const [renameModalOpen, setRenameModalOpen] = (0, import_element162.useState)(false); 52735 const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0, import_element162.useState)(false); 52736 const history = useHistory14(); 52737 const closeModals = () => { 52738 setRenameModalOpen(false); 52739 setDeleteConfirmDialogOpen(false); 52740 }; 52741 const openRenameModal = () => setRenameModalOpen(true); 52742 const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true); 52743 return /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_jsx_runtime293.Fragment, { children: [ 52744 /* @__PURE__ */ (0, import_jsx_runtime293.jsx)( 52745 import_components137.DropdownMenu, 52746 { 52747 className: "sidebar-navigation__more-menu", 52748 label: (0, import_i18n127.__)("Actions"), 52749 icon: more_vertical_default, 52750 popoverProps: POPOVER_PROPS, 52751 children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_components137.MenuGroup, { children: [ 52752 /* @__PURE__ */ (0, import_jsx_runtime293.jsx)( 52753 import_components137.MenuItem, 52754 { 52755 onClick: () => { 52756 openRenameModal(); 52757 onClose(); 52758 }, 52759 children: (0, import_i18n127.__)("Rename") 52760 } 52761 ), 52762 /* @__PURE__ */ (0, import_jsx_runtime293.jsx)( 52763 import_components137.MenuItem, 52764 { 52765 onClick: () => { 52766 history.navigate( 52767 `/wp_navigation/$menuId}?canvas=edit` 52768 ); 52769 }, 52770 children: (0, import_i18n127.__)("Edit") 52771 } 52772 ), 52773 /* @__PURE__ */ (0, import_jsx_runtime293.jsx)( 52774 import_components137.MenuItem, 52775 { 52776 onClick: () => { 52777 onDuplicate(); 52778 onClose(); 52779 }, 52780 children: (0, import_i18n127.__)("Duplicate") 52781 } 52782 ), 52783 /* @__PURE__ */ (0, import_jsx_runtime293.jsx)( 52784 import_components137.MenuItem, 52785 { 52786 isDestructive: true, 52787 onClick: () => { 52788 openDeleteConfirmDialog(); 52789 onClose(); 52790 }, 52791 children: (0, import_i18n127.__)("Delete") 52792 } 52793 ) 52794 ] }) 52795 } 52796 ), 52797 deleteConfirmDialogOpen && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)( 52798 DeleteConfirmDialog, 52799 { 52800 onClose: closeModals, 52801 onConfirm: onDelete 52802 } 52803 ), 52804 renameModalOpen && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)( 52805 RenameModal, 52806 { 52807 onClose: closeModals, 52808 menuTitle, 52809 onSave 52810 } 52811 ) 52812 ] }); 52813 } 52814 52815 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.mjs 52816 var import_element165 = __toESM(require_element(), 1); 52817 var import_data59 = __toESM(require_data(), 1); 52818 var import_block_editor22 = __toESM(require_block_editor(), 1); 52819 var import_blocks10 = __toESM(require_blocks(), 1); 52820 var import_core_data38 = __toESM(require_core_data(), 1); 52821 52822 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.mjs 52823 var import_block_editor21 = __toESM(require_block_editor(), 1); 52824 var import_data58 = __toESM(require_data(), 1); 52825 var import_blocks9 = __toESM(require_blocks(), 1); 52826 var import_element164 = __toESM(require_element(), 1); 52827 var import_core_data37 = __toESM(require_core_data(), 1); 52828 var import_block_library2 = __toESM(require_block_library(), 1); 52829 52830 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.mjs 52831 var import_components138 = __toESM(require_components(), 1); 52832 var import_data57 = __toESM(require_data(), 1); 52833 var import_element163 = __toESM(require_element(), 1); 52834 var import_i18n128 = __toESM(require_i18n(), 1); 52835 var import_block_editor20 = __toESM(require_block_editor(), 1); 52836 var import_router23 = __toESM(require_router(), 1); 52837 var import_jsx_runtime294 = __toESM(require_jsx_runtime(), 1); 52838 var POPOVER_PROPS2 = { 52839 className: "block-editor-block-settings-menu__popover", 52840 placement: "bottom-start" 52841 }; 52842 var { useHistory: useHistory15, useLocation: useLocation21 } = unlock(import_router23.privateApis); 52843 function LeafMoreMenu(props) { 52844 const history = useHistory15(); 52845 const { path } = useLocation21(); 52846 const { block } = props; 52847 const { clientId } = block; 52848 const { moveBlocksDown, moveBlocksUp, removeBlocks } = (0, import_data57.useDispatch)(import_block_editor20.store); 52849 const removeLabel = (0, import_i18n128.sprintf)( 52850 /* translators: %s: block name */ 52851 (0, import_i18n128.__)("Remove %s"), 52852 (0, import_block_editor20.BlockTitle)({ clientId, maximumLength: 25 }) 52853 ); 52854 const goToLabel = (0, import_i18n128.sprintf)( 52855 /* translators: %s: block name */ 52856 (0, import_i18n128.__)("Go to %s"), 52857 (0, import_block_editor20.BlockTitle)({ clientId, maximumLength: 25 }) 52858 ); 52859 const rootClientId = (0, import_data57.useSelect)( 52860 (select4) => { 52861 const { getBlockRootClientId } = select4(import_block_editor20.store); 52862 return getBlockRootClientId(clientId); 52863 }, 52864 [clientId] 52865 ); 52866 const onGoToPage = (0, import_element163.useCallback)( 52867 (selectedBlock) => { 52868 const { attributes, name: name2 } = selectedBlock; 52869 if (attributes.kind === "post-type" && attributes.id && attributes.type && history) { 52870 history.navigate( 52871 `/$attributes.type}/$attributes.id}?canvas=edit`, 52872 { 52873 state: { backPath: path } 52874 } 52875 ); 52876 } 52877 if (name2 === "core/page-list-item" && attributes.id && history) { 52878 history.navigate(`/page/$attributes.id}?canvas=edit`, { 52879 state: { backPath: path } 52880 }); 52881 } 52882 }, 52883 [path, history] 52884 ); 52885 return /* @__PURE__ */ (0, import_jsx_runtime294.jsx)( 52886 import_components138.DropdownMenu, 52887 { 52888 icon: more_vertical_default, 52889 label: (0, import_i18n128.__)("Options"), 52890 className: "block-editor-block-settings-menu", 52891 popoverProps: POPOVER_PROPS2, 52892 noIcons: true, 52893 ...props, 52894 children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(import_jsx_runtime294.Fragment, { children: [ 52895 /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(import_components138.MenuGroup, { children: [ 52896 /* @__PURE__ */ (0, import_jsx_runtime294.jsx)( 52897 import_components138.MenuItem, 52898 { 52899 icon: chevron_up_default, 52900 onClick: () => { 52901 moveBlocksUp([clientId], rootClientId); 52902 onClose(); 52903 }, 52904 children: (0, import_i18n128.__)("Move up") 52905 } 52906 ), 52907 /* @__PURE__ */ (0, import_jsx_runtime294.jsx)( 52908 import_components138.MenuItem, 52909 { 52910 icon: chevron_down_default, 52911 onClick: () => { 52912 moveBlocksDown([clientId], rootClientId); 52913 onClose(); 52914 }, 52915 children: (0, import_i18n128.__)("Move down") 52916 } 52917 ), 52918 block.attributes?.type === "page" && block.attributes?.id && /* @__PURE__ */ (0, import_jsx_runtime294.jsx)( 52919 import_components138.MenuItem, 52920 { 52921 onClick: () => { 52922 onGoToPage(block); 52923 onClose(); 52924 }, 52925 children: goToLabel 52926 } 52927 ) 52928 ] }), 52929 /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(import_components138.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime294.jsx)( 52930 import_components138.MenuItem, 52931 { 52932 onClick: () => { 52933 removeBlocks([clientId], false); 52934 onClose(); 52935 }, 52936 children: removeLabel 52937 } 52938 ) }) 52939 ] }) 52940 } 52941 ); 52942 } 52943 52944 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.mjs 52945 var import_jsx_runtime295 = __toESM(require_jsx_runtime(), 1); 52946 var { PrivateListView } = unlock(import_block_editor21.privateApis); 52947 var { NavigationLinkUI } = unlock(import_block_library2.privateApis); 52948 var MAX_PAGE_COUNT = 100; 52949 var PAGES_QUERY = [ 52950 "postType", 52951 "page", 52952 { 52953 per_page: MAX_PAGE_COUNT, 52954 _fields: ["id", "link", "menu_order", "parent", "title", "type"], 52955 // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby 52956 // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent 52957 // sort. 52958 orderby: "menu_order", 52959 order: "asc" 52960 } 52961 ]; 52962 function NavigationMenuContent({ rootClientId }) { 52963 const { listViewRootClientId, isLoading } = (0, import_data58.useSelect)( 52964 (select4) => { 52965 const { 52966 areInnerBlocksControlled, 52967 getBlockName, 52968 getBlockCount, 52969 getBlockOrder 52970 } = select4(import_block_editor21.store); 52971 const { isResolving } = select4(import_core_data37.store); 52972 const blockClientIds = getBlockOrder(rootClientId); 52973 const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === "core/page-list"; 52974 const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0; 52975 const isLoadingPages = isResolving( 52976 "getEntityRecords", 52977 PAGES_QUERY 52978 ); 52979 return { 52980 listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId, 52981 // This is a small hack to wait for the navigation block 52982 // to actually load its inner blocks. 52983 isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages 52984 }; 52985 }, 52986 [rootClientId] 52987 ); 52988 const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } = (0, import_data58.useDispatch)(import_block_editor21.store); 52989 const offCanvasOnselect = (0, import_element164.useCallback)( 52990 (block) => { 52991 if (block.name === "core/navigation-link" && !block.attributes.url) { 52992 __unstableMarkNextChangeAsNotPersistent(); 52993 replaceBlock( 52994 block.clientId, 52995 (0, import_blocks9.createBlock)("core/navigation-link", block.attributes) 52996 ); 52997 } 52998 }, 52999 [__unstableMarkNextChangeAsNotPersistent, replaceBlock] 53000 ); 53001 return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(import_jsx_runtime295.Fragment, { children: [ 53002 !isLoading && /* @__PURE__ */ (0, import_jsx_runtime295.jsx)( 53003 PrivateListView, 53004 { 53005 rootClientId: listViewRootClientId, 53006 onSelect: offCanvasOnselect, 53007 blockSettingsMenu: LeafMoreMenu, 53008 showAppender: true, 53009 additionalBlockContent: NavigationLinkUI, 53010 isExpanded: true 53011 } 53012 ), 53013 /* @__PURE__ */ (0, import_jsx_runtime295.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", children: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(import_block_editor21.BlockList, {}) }) 53014 ] }); 53015 } 53016 53017 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.mjs 53018 var import_jsx_runtime296 = __toESM(require_jsx_runtime(), 1); 53019 var noop6 = () => { 53020 }; 53021 function NavigationMenuEditor({ navigationMenuId }) { 53022 const { storedSettings } = (0, import_data59.useSelect)((select4) => { 53023 const { getSettings: getSettings7 } = unlock(select4(store)); 53024 return { 53025 storedSettings: getSettings7() 53026 }; 53027 }, []); 53028 const settings2 = (0, import_element165.useMemo)(() => { 53029 return { 53030 ...storedSettings, 53031 __experimentalFetchLinkSuggestions: (search, searchOptions) => (0, import_core_data38.__experimentalFetchLinkSuggestions)(search, searchOptions, storedSettings) 53032 }; 53033 }, [storedSettings]); 53034 const blocks = (0, import_element165.useMemo)(() => { 53035 if (!navigationMenuId) { 53036 return []; 53037 } 53038 return [(0, import_blocks10.createBlock)("core/navigation", { ref: navigationMenuId })]; 53039 }, [navigationMenuId]); 53040 if (!navigationMenuId || !blocks?.length) { 53041 return null; 53042 } 53043 return /* @__PURE__ */ (0, import_jsx_runtime296.jsx)( 53044 import_block_editor22.BlockEditorProvider, 53045 { 53046 settings: settings2, 53047 value: blocks, 53048 onChange: noop6, 53049 onInput: noop6, 53050 children: /* @__PURE__ */ (0, import_jsx_runtime296.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__content", children: /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(NavigationMenuContent, { rootClientId: blocks[0].clientId }) }) 53051 } 53052 ); 53053 } 53054 53055 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.mjs 53056 var import_i18n129 = __toESM(require_i18n(), 1); 53057 var import_html_entities5 = __toESM(require_html_entities(), 1); 53058 function buildNavigationLabel(title, id, status) { 53059 if (!title?.rendered) { 53060 return (0, import_i18n129.sprintf)((0, import_i18n129.__)("(no title %s)"), id); 53061 } 53062 if (status === "publish") { 53063 return (0, import_html_entities5.decodeEntities)(title?.rendered); 53064 } 53065 return (0, import_i18n129.sprintf)( 53066 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 53067 (0, import_i18n129._x)("%1$s (%2$s)", "menu label"), 53068 (0, import_html_entities5.decodeEntities)(title?.rendered), 53069 status 53070 ); 53071 } 53072 53073 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.mjs 53074 var import_jsx_runtime297 = __toESM(require_jsx_runtime(), 1); 53075 function SingleNavigationMenu({ 53076 navigationMenu, 53077 backPath, 53078 handleDelete, 53079 handleDuplicate, 53080 handleSave 53081 }) { 53082 const menuTitle = navigationMenu?.title?.rendered; 53083 return /* @__PURE__ */ (0, import_jsx_runtime297.jsx)( 53084 SidebarNavigationScreenWrapper, 53085 { 53086 actions: /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(import_jsx_runtime297.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime297.jsx)( 53087 ScreenNavigationMoreMenu, 53088 { 53089 menuId: navigationMenu?.id, 53090 menuTitle: (0, import_html_entities6.decodeEntities)(menuTitle), 53091 onDelete: handleDelete, 53092 onSave: handleSave, 53093 onDuplicate: handleDuplicate 53094 } 53095 ) }), 53096 backPath, 53097 title: buildNavigationLabel( 53098 navigationMenu?.title, 53099 navigationMenu?.id, 53100 navigationMenu?.status 53101 ), 53102 description: (0, import_i18n130.__)( 53103 "Navigation Menus are a curated collection of blocks that allow visitors to get around your site." 53104 ), 53105 children: /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(NavigationMenuEditor, { navigationMenuId: navigationMenu?.id }) 53106 } 53107 ); 53108 } 53109 53110 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.mjs 53111 var import_core_data40 = __toESM(require_core_data(), 1); 53112 var import_i18n132 = __toESM(require_i18n(), 1); 53113 var import_data61 = __toESM(require_data(), 1); 53114 var import_notices5 = __toESM(require_notices(), 1); 53115 var import_router25 = __toESM(require_router(), 1); 53116 53117 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.mjs 53118 var import_core_data39 = __toESM(require_core_data(), 1); 53119 var import_components139 = __toESM(require_components(), 1); 53120 var import_i18n131 = __toESM(require_i18n(), 1); 53121 var import_data60 = __toESM(require_data(), 1); 53122 var import_html_entities7 = __toESM(require_html_entities(), 1); 53123 var import_router24 = __toESM(require_router(), 1); 53124 var import_jsx_runtime298 = __toESM(require_jsx_runtime(), 1); 53125 var { useLocation: useLocation22 } = unlock(import_router24.privateApis); 53126 var postType = `wp_navigation`; 53127 function SidebarNavigationScreenNavigationMenu({ backPath }) { 53128 const { 53129 params: { postId } 53130 } = useLocation22(); 53131 const { record: navigationMenu, isResolving } = (0, import_core_data39.useEntityRecord)( 53132 "postType", 53133 postType, 53134 postId 53135 ); 53136 const { isSaving, isDeleting } = (0, import_data60.useSelect)( 53137 (select4) => { 53138 const { isSavingEntityRecord, isDeletingEntityRecord } = select4(import_core_data39.store); 53139 return { 53140 isSaving: isSavingEntityRecord("postType", postType, postId), 53141 isDeleting: isDeletingEntityRecord( 53142 "postType", 53143 postType, 53144 postId 53145 ) 53146 }; 53147 }, 53148 [postId] 53149 ); 53150 const isLoading = isResolving || isSaving || isDeleting; 53151 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 53152 const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers(); 53153 const _handleDelete = () => handleDelete(navigationMenu); 53154 const _handleSave = (edits) => handleSave(navigationMenu, edits); 53155 const _handleDuplicate = () => handleDuplicate(navigationMenu); 53156 if (isLoading) { 53157 return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)( 53158 SidebarNavigationScreenWrapper, 53159 { 53160 description: (0, import_i18n131.__)( 53161 "Navigation Menus are a curated collection of blocks that allow visitors to get around your site." 53162 ), 53163 backPath, 53164 children: /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(import_components139.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) 53165 } 53166 ); 53167 } 53168 if (!isLoading && !navigationMenu) { 53169 return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)( 53170 SidebarNavigationScreenWrapper, 53171 { 53172 description: (0, import_i18n131.__)("Navigation Menu missing."), 53173 backPath 53174 } 53175 ); 53176 } 53177 if (!navigationMenu?.content?.raw) { 53178 return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)( 53179 SidebarNavigationScreenWrapper, 53180 { 53181 actions: /* @__PURE__ */ (0, import_jsx_runtime298.jsx)( 53182 ScreenNavigationMoreMenu, 53183 { 53184 menuId: navigationMenu?.id, 53185 menuTitle: (0, import_html_entities7.decodeEntities)(menuTitle), 53186 onDelete: _handleDelete, 53187 onSave: _handleSave, 53188 onDuplicate: _handleDuplicate 53189 } 53190 ), 53191 backPath, 53192 title: buildNavigationLabel( 53193 navigationMenu?.title, 53194 navigationMenu?.id, 53195 navigationMenu?.status 53196 ), 53197 description: (0, import_i18n131.__)("This Navigation Menu is empty.") 53198 } 53199 ); 53200 } 53201 return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)( 53202 SingleNavigationMenu, 53203 { 53204 navigationMenu, 53205 backPath, 53206 handleDelete: _handleDelete, 53207 handleSave: _handleSave, 53208 handleDuplicate: _handleDuplicate 53209 } 53210 ); 53211 } 53212 53213 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.mjs 53214 var { useHistory: useHistory16 } = unlock(import_router25.privateApis); 53215 function useDeleteNavigationMenu() { 53216 const { deleteEntityRecord } = (0, import_data61.useDispatch)(import_core_data40.store); 53217 const { createSuccessNotice, createErrorNotice } = (0, import_data61.useDispatch)(import_notices5.store); 53218 const history = useHistory16(); 53219 const handleDelete = async (navigationMenu) => { 53220 const postId = navigationMenu?.id; 53221 try { 53222 await deleteEntityRecord( 53223 "postType", 53224 postType, 53225 postId, 53226 { 53227 force: true 53228 }, 53229 { 53230 throwOnError: true 53231 } 53232 ); 53233 createSuccessNotice( 53234 (0, import_i18n132.__)("Navigation Menu successfully deleted."), 53235 { 53236 type: "snackbar" 53237 } 53238 ); 53239 history.navigate("/navigation"); 53240 } catch (error2) { 53241 createErrorNotice( 53242 (0, import_i18n132.sprintf)( 53243 /* translators: %s: error message describing why the navigation menu could not be deleted. */ 53244 (0, import_i18n132.__)(`Unable to delete Navigation Menu (%s).`), 53245 error2?.message 53246 ), 53247 { 53248 type: "snackbar" 53249 } 53250 ); 53251 } 53252 }; 53253 return handleDelete; 53254 } 53255 function useSaveNavigationMenu() { 53256 const { getEditedEntityRecord } = (0, import_data61.useSelect)((select4) => { 53257 const { getEditedEntityRecord: getEditedEntityRecordSelector } = select4(import_core_data40.store); 53258 return { 53259 getEditedEntityRecord: getEditedEntityRecordSelector 53260 }; 53261 }, []); 53262 const { 53263 editEntityRecord, 53264 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 53265 } = (0, import_data61.useDispatch)(import_core_data40.store); 53266 const { createSuccessNotice, createErrorNotice } = (0, import_data61.useDispatch)(import_notices5.store); 53267 const handleSave = async (navigationMenu, edits) => { 53268 if (!edits) { 53269 return; 53270 } 53271 const postId = navigationMenu?.id; 53272 const originalRecord = getEditedEntityRecord( 53273 "postType", 53274 NAVIGATION_POST_TYPE, 53275 postId 53276 ); 53277 editEntityRecord("postType", postType, postId, edits); 53278 const recordPropertiesToSave = Object.keys(edits); 53279 try { 53280 await saveSpecifiedEntityEdits( 53281 "postType", 53282 postType, 53283 postId, 53284 recordPropertiesToSave, 53285 { 53286 throwOnError: true 53287 } 53288 ); 53289 createSuccessNotice((0, import_i18n132.__)("Renamed Navigation Menu"), { 53290 type: "snackbar" 53291 }); 53292 } catch (error2) { 53293 editEntityRecord("postType", postType, postId, originalRecord); 53294 createErrorNotice( 53295 (0, import_i18n132.sprintf)( 53296 /* translators: %s: error message describing why the navigation menu could not be renamed. */ 53297 (0, import_i18n132.__)(`Unable to rename Navigation Menu (%s).`), 53298 error2?.message 53299 ), 53300 { 53301 type: "snackbar" 53302 } 53303 ); 53304 } 53305 }; 53306 return handleSave; 53307 } 53308 function useDuplicateNavigationMenu() { 53309 const history = useHistory16(); 53310 const { saveEntityRecord } = (0, import_data61.useDispatch)(import_core_data40.store); 53311 const { createSuccessNotice, createErrorNotice } = (0, import_data61.useDispatch)(import_notices5.store); 53312 const handleDuplicate = async (navigationMenu) => { 53313 const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug; 53314 try { 53315 const savedRecord = await saveEntityRecord( 53316 "postType", 53317 postType, 53318 { 53319 title: (0, import_i18n132.sprintf)( 53320 /* translators: %s: Navigation menu title */ 53321 (0, import_i18n132._x)("%s (Copy)", "navigation menu"), 53322 menuTitle 53323 ), 53324 content: navigationMenu?.content?.raw, 53325 status: "publish" 53326 }, 53327 { 53328 throwOnError: true 53329 } 53330 ); 53331 if (savedRecord) { 53332 createSuccessNotice((0, import_i18n132.__)("Duplicated Navigation Menu"), { 53333 type: "snackbar" 53334 }); 53335 history.navigate(`/wp_navigation/$savedRecord.id}`); 53336 } 53337 } catch (error2) { 53338 createErrorNotice( 53339 (0, import_i18n132.sprintf)( 53340 /* translators: %s: error message describing why the navigation menu could not be deleted. */ 53341 (0, import_i18n132.__)(`Unable to duplicate Navigation Menu (%s).`), 53342 error2?.message 53343 ), 53344 { 53345 type: "snackbar" 53346 } 53347 ); 53348 } 53349 }; 53350 return handleDuplicate; 53351 } 53352 function useNavigationMenuHandlers() { 53353 return { 53354 handleDelete: useDeleteNavigationMenu(), 53355 handleSave: useSaveNavigationMenu(), 53356 handleDuplicate: useDuplicateNavigationMenu() 53357 }; 53358 } 53359 53360 // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.mjs 53361 var import_jsx_runtime299 = __toESM(require_jsx_runtime(), 1); 53362 function buildMenuLabel(title, id, status) { 53363 if (!title) { 53364 return (0, import_i18n133.sprintf)((0, import_i18n133.__)("(no title %s)"), id); 53365 } 53366 if (status === "publish") { 53367 return (0, import_html_entities8.decodeEntities)(title); 53368 } 53369 return (0, import_i18n133.sprintf)( 53370 // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.). 53371 (0, import_i18n133._x)("%1$s (%2$s)", "menu label"), 53372 (0, import_html_entities8.decodeEntities)(title), 53373 status 53374 ); 53375 } 53376 function SidebarNavigationScreenNavigationMenus({ backPath }) { 53377 const { 53378 records: navigationMenus, 53379 isResolving: isResolvingNavigationMenus, 53380 hasResolved: hasResolvedNavigationMenus 53381 } = (0, import_core_data41.useEntityRecords)( 53382 "postType", 53383 NAVIGATION_POST_TYPE, 53384 PRELOADED_NAVIGATION_MENUS_QUERY 53385 ); 53386 const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus; 53387 const { getNavigationFallbackId } = unlock((0, import_data62.useSelect)(import_core_data41.store)); 53388 const isCreatingNavigationFallback = (0, import_data62.useSelect)( 53389 (select4) => select4(import_core_data41.store).isResolving("getNavigationFallbackId"), 53390 [] 53391 ); 53392 const firstNavigationMenu = navigationMenus?.[0]; 53393 if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && // Ensure a fallback navigation is created only once 53394 !isCreatingNavigationFallback) { 53395 getNavigationFallbackId(); 53396 } 53397 const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers(); 53398 const hasNavigationMenus = !!navigationMenus?.length; 53399 if (isLoading) { 53400 return /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(import_components140.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) }); 53401 } 53402 if (!isLoading && !hasNavigationMenus) { 53403 return /* @__PURE__ */ (0, import_jsx_runtime299.jsx)( 53404 SidebarNavigationScreenWrapper, 53405 { 53406 description: (0, import_i18n133.__)("No Navigation Menus found."), 53407 backPath 53408 } 53409 ); 53410 } 53411 if (navigationMenus?.length === 1) { 53412 return /* @__PURE__ */ (0, import_jsx_runtime299.jsx)( 53413 SingleNavigationMenu, 53414 { 53415 navigationMenu: firstNavigationMenu, 53416 backPath, 53417 handleDelete: () => handleDelete(firstNavigationMenu), 53418 handleDuplicate: () => handleDuplicate(firstNavigationMenu), 53419 handleSave: (edits) => handleSave(firstNavigationMenu, edits) 53420 } 53421 ); 53422 } 53423 return /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(import_components140.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-navigation-menus", children: navigationMenus?.map(({ id, title, status }, index2) => /* @__PURE__ */ (0, import_jsx_runtime299.jsx)( 53424 NavMenuItem, 53425 { 53426 postId: id, 53427 withChevron: true, 53428 icon: navigation_default, 53429 children: buildMenuLabel(title?.rendered, index2 + 1, status) 53430 }, 53431 id 53432 )) }) }); 53433 } 53434 function SidebarNavigationScreenWrapper({ 53435 children, 53436 actions, 53437 title, 53438 description, 53439 backPath 53440 }) { 53441 return /* @__PURE__ */ (0, import_jsx_runtime299.jsx)( 53442 SidebarNavigationScreen, 53443 { 53444 title: title || (0, import_i18n133.__)("Navigation"), 53445 actions, 53446 description: description || (0, import_i18n133.__)("Manage your Navigation Menus."), 53447 backPath, 53448 content: children 53449 } 53450 ); 53451 } 53452 var NavMenuItem = ({ postId, ...props }) => { 53453 return /* @__PURE__ */ (0, import_jsx_runtime299.jsx)( 53454 SidebarNavigationItem, 53455 { 53456 to: `/wp_navigation/$postId}`, 53457 ...props 53458 } 53459 ); 53460 }; 53461 53462 // packages/edit-site/build-module/components/site-editor-routes/navigation.mjs 53463 var import_jsx_runtime300 = __toESM(require_jsx_runtime(), 1); 53464 var navigationRoute = { 53465 name: "navigation", 53466 path: "/navigation", 53467 areas: { 53468 sidebar({ siteData }) { 53469 if (!isThemeDataLoaded(siteData)) { 53470 return null; 53471 } 53472 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }) : /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(SidebarNavigationScreenUnsupported, {}); 53473 }, 53474 preview({ siteData }) { 53475 const isBlockTheme = siteData.currentTheme?.is_block_theme; 53476 return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(EditSiteEditor, {}) : void 0; 53477 }, 53478 mobileSidebar({ siteData }) { 53479 if (!isThemeDataLoaded(siteData)) { 53480 return /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_jsx_runtime300.Fragment, {}); 53481 } 53482 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }) : /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(SidebarNavigationScreenUnsupported, {}); 53483 } 53484 } 53485 }; 53486 53487 // packages/edit-site/build-module/components/site-editor-routes/navigation-item.mjs 53488 var import_jsx_runtime301 = __toESM(require_jsx_runtime(), 1); 53489 var navigationItemRoute = { 53490 name: "navigation-item", 53491 path: "/wp_navigation/:postId", 53492 areas: { 53493 sidebar({ siteData }) { 53494 if (!isThemeDataLoaded(siteData)) { 53495 return null; 53496 } 53497 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }) : /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(SidebarNavigationScreenUnsupported, {}); 53498 }, 53499 preview({ siteData }) { 53500 if (!isThemeDataLoaded(siteData)) { 53501 return null; 53502 } 53503 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(SidebarNavigationScreenUnsupported, {}); 53504 }, 53505 mobileSidebar({ siteData }) { 53506 if (!isThemeDataLoaded(siteData)) { 53507 return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(import_jsx_runtime301.Fragment, {}); 53508 } 53509 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }) : /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(SidebarNavigationScreenUnsupported, {}); 53510 } 53511 } 53512 }; 53513 53514 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.mjs 53515 var import_components141 = __toESM(require_components(), 1); 53516 var import_editor28 = __toESM(require_editor(), 1); 53517 var import_element170 = __toESM(require_element(), 1); 53518 var import_i18n135 = __toESM(require_i18n(), 1); 53519 var import_router26 = __toESM(require_router(), 1); 53520 53521 // node_modules/dequal/dist/index.mjs 53522 var has = Object.prototype.hasOwnProperty; 53523 function find(iter, tar, key) { 53524 for (key of iter.keys()) { 53525 if (dequal(key, tar)) return key; 53526 } 53527 } 53528 function dequal(foo, bar) { 53529 var ctor, len, tmp; 53530 if (foo === bar) return true; 53531 if (foo && bar && (ctor = foo.constructor) === bar.constructor) { 53532 if (ctor === Date) return foo.getTime() === bar.getTime(); 53533 if (ctor === RegExp) return foo.toString() === bar.toString(); 53534 if (ctor === Array) { 53535 if ((len = foo.length) === bar.length) { 53536 while (len-- && dequal(foo[len], bar[len])) ; 53537 } 53538 return len === -1; 53539 } 53540 if (ctor === Set) { 53541 if (foo.size !== bar.size) { 53542 return false; 53543 } 53544 for (len of foo) { 53545 tmp = len; 53546 if (tmp && typeof tmp === "object") { 53547 tmp = find(bar, tmp); 53548 if (!tmp) return false; 53549 } 53550 if (!bar.has(tmp)) return false; 53551 } 53552 return true; 53553 } 53554 if (ctor === Map) { 53555 if (foo.size !== bar.size) { 53556 return false; 53557 } 53558 for (len of foo) { 53559 tmp = len[0]; 53560 if (tmp && typeof tmp === "object") { 53561 tmp = find(bar, tmp); 53562 if (!tmp) return false; 53563 } 53564 if (!dequal(len[1], bar.get(tmp))) { 53565 return false; 53566 } 53567 } 53568 return true; 53569 } 53570 if (ctor === ArrayBuffer) { 53571 foo = new Uint8Array(foo); 53572 bar = new Uint8Array(bar); 53573 } else if (ctor === DataView) { 53574 if ((len = foo.byteLength) === bar.byteLength) { 53575 while (len-- && foo.getInt8(len) === bar.getInt8(len)) ; 53576 } 53577 return len === -1; 53578 } 53579 if (ArrayBuffer.isView(foo)) { 53580 if ((len = foo.byteLength) === bar.byteLength) { 53581 while (len-- && foo[len] === bar[len]) ; 53582 } 53583 return len === -1; 53584 } 53585 if (!ctor || typeof foo === "object") { 53586 len = 0; 53587 for (ctor in foo) { 53588 if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; 53589 if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; 53590 } 53591 return Object.keys(bar).length === len; 53592 } 53593 } 53594 return foo !== foo && bar !== bar; 53595 } 53596 53597 // packages/views/build-module/use-view.mjs 53598 var import_element166 = __toESM(require_element(), 1); 53599 var import_data63 = __toESM(require_data(), 1); 53600 var import_preferences11 = __toESM(require_preferences(), 1); 53601 53602 // packages/views/build-module/preference-keys.mjs 53603 function generatePreferenceKey(kind, name2, slug) { 53604 return `dataviews-$kind}-$name2}-$slug}`; 53605 } 53606 53607 // packages/views/build-module/filter-utils.mjs 53608 var SCALAR_VALUES = [ 53609 "titleField", 53610 "mediaField", 53611 "descriptionField", 53612 "showTitle", 53613 "showMedia", 53614 "showDescription", 53615 "showLevels", 53616 "infiniteScrollEnabled" 53617 ]; 53618 function mergeActiveViewOverrides(view, activeViewOverrides, defaultView) { 53619 if (!activeViewOverrides) { 53620 return view; 53621 } 53622 let result = view; 53623 for (const key of SCALAR_VALUES) { 53624 if (key in activeViewOverrides) { 53625 result = { ...result, [key]: activeViewOverrides[key] }; 53626 } 53627 } 53628 if (activeViewOverrides.filters && activeViewOverrides.filters.length > 0) { 53629 const activeFields = new Set( 53630 activeViewOverrides.filters.map((f2) => f2.field) 53631 ); 53632 const preserved = (view.filters ?? []).filter( 53633 (f2) => !activeFields.has(f2.field) 53634 ); 53635 result = { 53636 ...result, 53637 filters: [...preserved, ...activeViewOverrides.filters] 53638 }; 53639 } 53640 if (activeViewOverrides.sort) { 53641 const isDefaultSort = defaultView && view.sort?.field === defaultView.sort?.field && view.sort?.direction === defaultView.sort?.direction; 53642 if (isDefaultSort) { 53643 result = { 53644 ...result, 53645 sort: activeViewOverrides.sort 53646 }; 53647 } 53648 } 53649 if (activeViewOverrides.layout) { 53650 result = { 53651 ...result, 53652 layout: { 53653 ...result.layout, 53654 ...activeViewOverrides.layout 53655 } 53656 }; 53657 } 53658 if (activeViewOverrides.groupBy) { 53659 result = { 53660 ...result, 53661 groupBy: activeViewOverrides.groupBy 53662 }; 53663 } 53664 return result; 53665 } 53666 function stripActiveViewOverrides(view, activeViewOverrides, defaultView) { 53667 if (!activeViewOverrides) { 53668 return view; 53669 } 53670 let result = view; 53671 for (const key of SCALAR_VALUES) { 53672 if (key in activeViewOverrides) { 53673 const { [key]: _, ...rest } = result; 53674 result = rest; 53675 } 53676 } 53677 if (activeViewOverrides.filters && activeViewOverrides.filters.length > 0) { 53678 const activeFields = new Set( 53679 activeViewOverrides.filters.map((f2) => f2.field) 53680 ); 53681 result = { 53682 ...result, 53683 filters: (view.filters ?? []).filter( 53684 (f2) => !activeFields.has(f2.field) 53685 ) 53686 }; 53687 } 53688 if (activeViewOverrides.sort && view.sort?.field === activeViewOverrides.sort.field && view.sort?.direction === activeViewOverrides.sort.direction) { 53689 result = { 53690 ...result, 53691 sort: defaultView?.sort 53692 }; 53693 } 53694 if (activeViewOverrides.layout && "layout" in result && result.layout) { 53695 const layout = { ...result.layout }; 53696 for (const key of Object.keys(activeViewOverrides.layout)) { 53697 delete layout[key]; 53698 } 53699 result = { 53700 ...result, 53701 layout: Object.keys(layout).length > 0 ? layout : void 0 53702 }; 53703 } 53704 if (activeViewOverrides.groupBy && "groupBy" in result) { 53705 const { groupBy: _, ...rest } = result; 53706 result = rest; 53707 } 53708 return result; 53709 } 53710 53711 // packages/views/build-module/use-view.mjs 53712 function omit3(obj, keys) { 53713 const result = { ...obj }; 53714 for (const key of keys) { 53715 delete result[key]; 53716 } 53717 return result; 53718 } 53719 function useView(config2) { 53720 const { 53721 kind, 53722 name: name2, 53723 slug, 53724 defaultView, 53725 activeViewOverrides, 53726 queryParams, 53727 onChangeQueryParams 53728 } = config2; 53729 const preferenceKey = generatePreferenceKey(kind, name2, slug); 53730 const persistedView = (0, import_data63.useSelect)( 53731 (select4) => { 53732 return select4(import_preferences11.store).get( 53733 "core/views", 53734 preferenceKey 53735 ); 53736 }, 53737 [preferenceKey] 53738 ); 53739 const { set: set3 } = (0, import_data63.useDispatch)(import_preferences11.store); 53740 const baseView = (0, import_element166.useMemo)( 53741 () => persistedView ?? defaultView ?? {}, 53742 [persistedView, defaultView] 53743 ); 53744 const page = Number(queryParams?.page ?? baseView.page ?? 1); 53745 const search = queryParams?.search ?? baseView.search ?? ""; 53746 const combinedOverrides = (0, import_element166.useMemo)(() => { 53747 const rawDefaults = config2.defaultLayouts?.[baseView.type]; 53748 const layoutTypeDefaults = !rawDefaults || rawDefaults === true ? {} : rawDefaults; 53749 return { ...layoutTypeDefaults, ...activeViewOverrides }; 53750 }, [config2.defaultLayouts, baseView.type, activeViewOverrides]); 53751 const view = (0, import_element166.useMemo)(() => { 53752 return mergeActiveViewOverrides( 53753 { 53754 ...baseView, 53755 page, 53756 search 53757 }, 53758 combinedOverrides, 53759 defaultView 53760 ); 53761 }, [baseView, page, search, combinedOverrides, defaultView]); 53762 const isModified = !!persistedView; 53763 const updateView = (0, import_element166.useCallback)( 53764 (newView) => { 53765 const urlParams = { 53766 page: newView?.page, 53767 search: newView?.search 53768 }; 53769 const preferenceView = stripActiveViewOverrides( 53770 omit3(newView, ["page", "search"]), 53771 combinedOverrides, 53772 defaultView 53773 ); 53774 if (onChangeQueryParams && !dequal(urlParams, { page, search })) { 53775 onChangeQueryParams(urlParams); 53776 } 53777 const comparableBaseView = stripActiveViewOverrides( 53778 baseView, 53779 combinedOverrides, 53780 defaultView 53781 ); 53782 const comparableDefaultView = stripActiveViewOverrides( 53783 defaultView, 53784 combinedOverrides, 53785 defaultView 53786 ); 53787 if (!dequal(comparableBaseView, preferenceView)) { 53788 if (dequal(preferenceView, comparableDefaultView)) { 53789 set3("core/views", preferenceKey, void 0); 53790 } else { 53791 set3("core/views", preferenceKey, preferenceView); 53792 } 53793 } 53794 }, 53795 [ 53796 onChangeQueryParams, 53797 page, 53798 search, 53799 baseView, 53800 defaultView, 53801 combinedOverrides, 53802 set3, 53803 preferenceKey 53804 ] 53805 ); 53806 const resetToDefault = (0, import_element166.useCallback)(() => { 53807 set3("core/views", preferenceKey, void 0); 53808 }, [preferenceKey, set3]); 53809 return { 53810 view, 53811 isModified, 53812 updateView, 53813 resetToDefault 53814 }; 53815 } 53816 53817 // packages/views/build-module/load-view.mjs 53818 var import_data64 = __toESM(require_data(), 1); 53819 var import_preferences12 = __toESM(require_preferences(), 1); 53820 async function loadView(config2) { 53821 const { kind, name: name2, slug, defaultView, activeViewOverrides, queryParams } = config2; 53822 const preferenceKey = generatePreferenceKey(kind, name2, slug); 53823 const persistedView = (0, import_data64.select)(import_preferences12.store).get( 53824 "core/views", 53825 preferenceKey 53826 ); 53827 const baseView = persistedView ?? defaultView; 53828 const page = queryParams?.page ?? 1; 53829 const search = queryParams?.search ?? ""; 53830 const rawDefaults = config2.defaultLayouts?.[baseView?.type]; 53831 const layoutTypeDefaults = !rawDefaults || rawDefaults === true ? {} : rawDefaults; 53832 const combinedOverrides = { ...layoutTypeDefaults, ...activeViewOverrides }; 53833 return mergeActiveViewOverrides( 53834 { 53835 ...baseView, 53836 page, 53837 search 53838 }, 53839 combinedOverrides, 53840 defaultView 53841 ); 53842 } 53843 53844 // packages/views/build-module/use-view-config.mjs 53845 var import_data65 = __toESM(require_data(), 1); 53846 var import_core_data42 = __toESM(require_core_data(), 1); 53847 53848 // packages/views/build-module/lock-unlock.mjs 53849 var import_private_apis6 = __toESM(require_private_apis(), 1); 53850 var { lock: lock6, unlock: unlock6 } = (0, import_private_apis6.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 53851 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 53852 "@wordpress/views" 53853 ); 53854 53855 // packages/views/build-module/use-view-config.mjs 53856 function useViewConfig({ 53857 kind, 53858 name: name2 53859 }) { 53860 return (0, import_data65.useSelect)( 53861 (select4) => { 53862 return unlock6(select4(import_core_data42.store)).getViewConfig(kind, name2); 53863 }, 53864 [kind, name2] 53865 ); 53866 } 53867 53868 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.mjs 53869 var import_jsx_runtime302 = __toESM(require_jsx_runtime(), 1); 53870 function CategoryItem({ 53871 count, 53872 icon, 53873 id, 53874 isActive, 53875 label, 53876 type 53877 }) { 53878 if (!count) { 53879 return; 53880 } 53881 const queryArgs = [`postType=$type}`]; 53882 if (id) { 53883 queryArgs.push(`categoryId=$id}`); 53884 } 53885 return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)( 53886 SidebarNavigationItem, 53887 { 53888 icon, 53889 suffix: /* @__PURE__ */ (0, import_jsx_runtime302.jsx)("span", { children: count }), 53890 "aria-current": isActive ? "true" : void 0, 53891 to: `/pattern?$queryArgs.join("&")}`, 53892 children: label 53893 } 53894 ); 53895 } 53896 53897 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.mjs 53898 var import_element169 = __toESM(require_element(), 1); 53899 var import_i18n134 = __toESM(require_i18n(), 1); 53900 53901 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.mjs 53902 var import_core_data43 = __toESM(require_core_data(), 1); 53903 var import_data66 = __toESM(require_data(), 1); 53904 function useDefaultPatternCategories() { 53905 const blockPatternCategories = (0, import_data66.useSelect)((select4) => { 53906 const { getSettings: getSettings7 } = unlock(select4(store)); 53907 const settings2 = getSettings7(); 53908 return settings2.__experimentalAdditionalBlockPatternCategories ?? settings2.__experimentalBlockPatternCategories; 53909 }); 53910 const restBlockPatternCategories = (0, import_data66.useSelect)( 53911 (select4) => select4(import_core_data43.store).getBlockPatternCategories() 53912 ); 53913 return [ 53914 ...blockPatternCategories || [], 53915 ...restBlockPatternCategories || [] 53916 ]; 53917 } 53918 53919 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.mjs 53920 var import_core_data44 = __toESM(require_core_data(), 1); 53921 var import_data67 = __toESM(require_data(), 1); 53922 var import_element167 = __toESM(require_element(), 1); 53923 53924 // packages/edit-site/build-module/components/page-patterns/utils.mjs 53925 var filterOutDuplicatesByName = (currentItem, index2, items) => index2 === items.findIndex((item) => currentItem.name === item.name); 53926 53927 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.mjs 53928 function useThemePatterns() { 53929 const blockPatterns = (0, import_data67.useSelect)((select4) => { 53930 const { getSettings: getSettings7 } = unlock(select4(store)); 53931 return getSettings7().__experimentalAdditionalBlockPatterns ?? getSettings7().__experimentalBlockPatterns; 53932 }); 53933 const restBlockPatterns = (0, import_data67.useSelect)( 53934 (select4) => select4(import_core_data44.store).getBlockPatterns() 53935 ); 53936 const patterns = (0, import_element167.useMemo)( 53937 () => [...blockPatterns || [], ...restBlockPatterns || []].filter( 53938 (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source) 53939 ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false), 53940 [blockPatterns, restBlockPatterns] 53941 ); 53942 return patterns; 53943 } 53944 53945 // packages/edit-site/build-module/components/page-patterns/use-patterns.mjs 53946 var import_blocks11 = __toESM(require_blocks(), 1); 53947 var import_data68 = __toESM(require_data(), 1); 53948 var import_core_data45 = __toESM(require_core_data(), 1); 53949 var import_element168 = __toESM(require_element(), 1); 53950 53951 // packages/edit-site/build-module/components/page-patterns/search-items.mjs 53952 var import_block_editor23 = __toESM(require_block_editor(), 1); 53953 var { extractWords, getNormalizedSearchTerms, normalizeString: normalizeString2 } = unlock( 53954 import_block_editor23.privateApis 53955 ); 53956 var defaultGetName = (item) => { 53957 if (item.type === PATTERN_TYPES.user) { 53958 return item.slug; 53959 } 53960 if (item.type === TEMPLATE_PART_POST_TYPE) { 53961 return ""; 53962 } 53963 return item.name || ""; 53964 }; 53965 var defaultGetTitle = (item) => { 53966 if (typeof item.title === "string") { 53967 return item.title; 53968 } 53969 if (item.title && item.title.rendered) { 53970 return item.title.rendered; 53971 } 53972 if (item.title && item.title.raw) { 53973 return item.title.raw; 53974 } 53975 return ""; 53976 }; 53977 var defaultGetDescription = (item) => { 53978 if (item.type === PATTERN_TYPES.user) { 53979 return item.excerpt.raw; 53980 } 53981 return item.description || ""; 53982 }; 53983 var defaultGetKeywords = (item) => item.keywords || []; 53984 var defaultHasCategory = () => false; 53985 var removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => { 53986 return unmatchedTerms.filter( 53987 (term) => !getNormalizedSearchTerms(unprocessedTerms).some( 53988 (unprocessedTerm) => unprocessedTerm.includes(term) 53989 ) 53990 ); 53991 }; 53992 var searchItems = (items = [], searchInput = "", config2 = {}) => { 53993 const normalizedSearchTerms = getNormalizedSearchTerms(searchInput); 53994 const onlyFilterByCategory = config2.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length; 53995 const searchRankConfig = { ...config2, onlyFilterByCategory }; 53996 const threshold = onlyFilterByCategory ? 0 : 1; 53997 const rankedItems = items.map((item) => { 53998 return [ 53999 item, 54000 getItemSearchRank(item, searchInput, searchRankConfig) 54001 ]; 54002 }).filter(([, rank]) => rank > threshold); 54003 if (normalizedSearchTerms.length === 0) { 54004 return rankedItems.map(([item]) => item); 54005 } 54006 rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1); 54007 return rankedItems.map(([item]) => item); 54008 }; 54009 function getItemSearchRank(item, searchTerm, config2) { 54010 const { 54011 categoryId, 54012 getName = defaultGetName, 54013 getTitle = defaultGetTitle, 54014 getDescription = defaultGetDescription, 54015 getKeywords = defaultGetKeywords, 54016 hasCategory = defaultHasCategory, 54017 onlyFilterByCategory 54018 } = config2; 54019 let rank = categoryId === PATTERN_DEFAULT_CATEGORY || categoryId === TEMPLATE_PART_ALL_AREAS_CATEGORY || categoryId === PATTERN_USER_CATEGORY && item.type === PATTERN_TYPES.user || hasCategory(item, categoryId) ? 1 : 0; 54020 if (!rank || onlyFilterByCategory) { 54021 return rank; 54022 } 54023 const name2 = getName(item); 54024 const title = getTitle(item); 54025 const description = getDescription(item); 54026 const keywords = getKeywords(item); 54027 const normalizedSearchInput = normalizeString2(searchTerm); 54028 const normalizedTitle = normalizeString2(title); 54029 if (normalizedSearchInput === normalizedTitle) { 54030 rank += 30; 54031 } else if (normalizedTitle.startsWith(normalizedSearchInput)) { 54032 rank += 20; 54033 } else { 54034 const terms = [name2, title, description, ...keywords].join(" "); 54035 const normalizedSearchTerms = extractWords(normalizedSearchInput); 54036 const unmatchedTerms = removeMatchingTerms( 54037 normalizedSearchTerms, 54038 terms 54039 ); 54040 if (unmatchedTerms.length === 0) { 54041 rank += 10; 54042 } 54043 } 54044 return rank; 54045 } 54046 54047 // packages/edit-site/build-module/components/page-patterns/use-patterns.mjs 54048 var EMPTY_PATTERN_LIST = []; 54049 var selectTemplateParts = (0, import_data68.createSelector)( 54050 (select4, categoryId, search = "") => { 54051 const { 54052 getEntityRecords, 54053 getCurrentTheme, 54054 isResolving: isResolvingSelector 54055 } = select4(import_core_data45.store); 54056 const query = { per_page: -1 }; 54057 const templateParts = getEntityRecords("postType", TEMPLATE_PART_POST_TYPE, query) ?? EMPTY_PATTERN_LIST; 54058 const knownAreas = getCurrentTheme()?.default_template_part_areas || []; 54059 const templatePartAreas = knownAreas.map((area) => area.area); 54060 const templatePartHasCategory = (item, category) => { 54061 if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) { 54062 return item.area === category; 54063 } 54064 return item.area === category || !templatePartAreas.includes(item.area); 54065 }; 54066 const isResolving = isResolvingSelector("getEntityRecords", [ 54067 "postType", 54068 TEMPLATE_PART_POST_TYPE, 54069 query 54070 ]); 54071 const patterns = searchItems(templateParts, search, { 54072 categoryId, 54073 hasCategory: templatePartHasCategory 54074 }); 54075 return { patterns, isResolving }; 54076 }, 54077 (select4) => [ 54078 select4(import_core_data45.store).getEntityRecords( 54079 "postType", 54080 TEMPLATE_PART_POST_TYPE, 54081 { 54082 per_page: -1 54083 } 54084 ), 54085 select4(import_core_data45.store).isResolving("getEntityRecords", [ 54086 "postType", 54087 TEMPLATE_PART_POST_TYPE, 54088 { per_page: -1 } 54089 ]), 54090 select4(import_core_data45.store).getCurrentTheme()?.default_template_part_areas 54091 ] 54092 ); 54093 var selectThemePatterns = (0, import_data68.createSelector)( 54094 (select4) => { 54095 const { getSettings: getSettings7 } = unlock(select4(store)); 54096 const { isResolving: isResolvingSelector } = select4(import_core_data45.store); 54097 const settings2 = getSettings7(); 54098 const blockPatterns = settings2.__experimentalAdditionalBlockPatterns ?? settings2.__experimentalBlockPatterns; 54099 const restBlockPatterns = select4(import_core_data45.store).getBlockPatterns(); 54100 const patterns = [ 54101 ...blockPatterns || [], 54102 ...restBlockPatterns || [] 54103 ].filter( 54104 (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source) 54105 ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false).map((pattern) => ({ 54106 ...pattern, 54107 keywords: pattern.keywords || [], 54108 type: PATTERN_TYPES.theme, 54109 blocks: (0, import_blocks11.parse)(pattern.content, { 54110 __unstableSkipMigrationLogs: true 54111 }) 54112 })); 54113 return { 54114 patterns, 54115 isResolving: isResolvingSelector("getBlockPatterns") 54116 }; 54117 }, 54118 (select4) => [ 54119 select4(import_core_data45.store).getBlockPatterns(), 54120 select4(import_core_data45.store).isResolving("getBlockPatterns"), 54121 unlock(select4(store)).getSettings() 54122 ] 54123 ); 54124 var selectPatterns = (0, import_data68.createSelector)( 54125 (select4, categoryId, syncStatus, search = "") => { 54126 const { 54127 patterns: themePatterns, 54128 isResolving: isResolvingThemePatterns 54129 } = selectThemePatterns(select4); 54130 const { 54131 patterns: userPatterns, 54132 isResolving: isResolvingUserPatterns, 54133 categories: userPatternCategories 54134 } = selectUserPatterns(select4); 54135 let patterns = [ 54136 ...themePatterns || [], 54137 ...userPatterns || [] 54138 ]; 54139 if (syncStatus) { 54140 patterns = patterns.filter((pattern) => { 54141 return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced; 54142 }); 54143 } 54144 if (categoryId) { 54145 patterns = searchItems(patterns, search, { 54146 categoryId, 54147 hasCategory: (item, currentCategory) => { 54148 if (item.type === PATTERN_TYPES.user) { 54149 return item.wp_pattern_category?.some( 54150 (catId) => userPatternCategories.find( 54151 (cat) => cat.id === catId 54152 )?.slug === currentCategory 54153 ); 54154 } 54155 return item.categories?.includes(currentCategory); 54156 } 54157 }); 54158 } else { 54159 patterns = searchItems(patterns, search, { 54160 hasCategory: (item) => { 54161 if (item.type === PATTERN_TYPES.user) { 54162 return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some( 54163 (catId) => userPatternCategories.find( 54164 (cat) => cat.id === catId 54165 ) 54166 )); 54167 } 54168 return !item.hasOwnProperty("categories"); 54169 } 54170 }); 54171 } 54172 return { 54173 patterns, 54174 isResolving: isResolvingThemePatterns || isResolvingUserPatterns 54175 }; 54176 }, 54177 (select4) => [ 54178 selectThemePatterns(select4), 54179 selectUserPatterns(select4) 54180 ] 54181 ); 54182 var selectUserPatterns = (0, import_data68.createSelector)( 54183 (select4, syncStatus, search = "") => { 54184 const { 54185 getEntityRecords, 54186 isResolving: isResolvingSelector, 54187 getUserPatternCategories 54188 } = select4(import_core_data45.store); 54189 const query = { per_page: -1 }; 54190 const patternPosts = getEntityRecords( 54191 "postType", 54192 PATTERN_TYPES.user, 54193 query 54194 ); 54195 const userPatternCategories = getUserPatternCategories(); 54196 const categories = /* @__PURE__ */ new Map(); 54197 userPatternCategories.forEach( 54198 (userCategory) => categories.set(userCategory.id, userCategory) 54199 ); 54200 let patterns = patternPosts ?? EMPTY_PATTERN_LIST; 54201 const isResolving = isResolvingSelector("getEntityRecords", [ 54202 "postType", 54203 PATTERN_TYPES.user, 54204 query 54205 ]); 54206 if (syncStatus) { 54207 patterns = patterns.filter( 54208 (pattern) => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus 54209 ); 54210 } 54211 patterns = searchItems(patterns, search, { 54212 // We exit user pattern retrieval early if we aren't in the 54213 // catch-all category for user created patterns, so it has 54214 // to be in the category. 54215 hasCategory: () => true 54216 }); 54217 return { 54218 patterns, 54219 isResolving, 54220 categories: userPatternCategories 54221 }; 54222 }, 54223 (select4) => [ 54224 select4(import_core_data45.store).getEntityRecords("postType", PATTERN_TYPES.user, { 54225 per_page: -1 54226 }), 54227 select4(import_core_data45.store).isResolving("getEntityRecords", [ 54228 "postType", 54229 PATTERN_TYPES.user, 54230 { per_page: -1 } 54231 ]), 54232 select4(import_core_data45.store).getUserPatternCategories() 54233 ] 54234 ); 54235 function useAugmentPatternsWithPermissions(patterns) { 54236 const idsAndTypes = (0, import_element168.useMemo)( 54237 () => patterns?.filter((record) => record.type !== PATTERN_TYPES.theme).map((record) => [record.type, record.id]) ?? [], 54238 [patterns] 54239 ); 54240 const permissions = (0, import_data68.useSelect)( 54241 (select4) => { 54242 const { getEntityRecordPermissions } = unlock( 54243 select4(import_core_data45.store) 54244 ); 54245 return idsAndTypes.reduce((acc, [type, id]) => { 54246 acc[id] = getEntityRecordPermissions("postType", type, id); 54247 return acc; 54248 }, {}); 54249 }, 54250 [idsAndTypes] 54251 ); 54252 return (0, import_element168.useMemo)( 54253 () => patterns?.map((record) => ({ 54254 ...record, 54255 permissions: permissions?.[record.id] ?? {} 54256 })) ?? [], 54257 [patterns, permissions] 54258 ); 54259 } 54260 var usePatterns = (postType2, categoryId, { search = "", syncStatus } = {}) => { 54261 return (0, import_data68.useSelect)( 54262 (select4) => { 54263 if (postType2 === TEMPLATE_PART_POST_TYPE) { 54264 return selectTemplateParts(select4, categoryId, search); 54265 } else if (postType2 === PATTERN_TYPES.user && !!categoryId) { 54266 const appliedCategory = categoryId === "uncategorized" ? "" : categoryId; 54267 return selectPatterns( 54268 select4, 54269 appliedCategory, 54270 syncStatus, 54271 search 54272 ); 54273 } else if (postType2 === PATTERN_TYPES.user) { 54274 return selectUserPatterns(select4, syncStatus, search); 54275 } 54276 return { 54277 patterns: EMPTY_PATTERN_LIST, 54278 isResolving: false 54279 }; 54280 }, 54281 [categoryId, postType2, search, syncStatus] 54282 ); 54283 }; 54284 var use_patterns_default = usePatterns; 54285 54286 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.mjs 54287 function usePatternCategories() { 54288 const defaultCategories = useDefaultPatternCategories(); 54289 defaultCategories.push({ 54290 name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY, 54291 label: (0, import_i18n134.__)("Uncategorized") 54292 }); 54293 const themePatterns = useThemePatterns(); 54294 const { patterns: userPatterns, categories: userPatternCategories } = use_patterns_default(PATTERN_TYPES.user); 54295 const patternCategories = (0, import_element169.useMemo)(() => { 54296 const categoryMap = {}; 54297 const categoriesWithCounts = []; 54298 defaultCategories.forEach((category) => { 54299 if (!categoryMap[category.name]) { 54300 categoryMap[category.name] = { ...category, count: 0 }; 54301 } 54302 }); 54303 userPatternCategories.forEach((category) => { 54304 if (!categoryMap[category.name]) { 54305 categoryMap[category.name] = { ...category, count: 0 }; 54306 } 54307 }); 54308 themePatterns.forEach((pattern) => { 54309 pattern.categories?.forEach((category) => { 54310 if (categoryMap[category]) { 54311 categoryMap[category].count += 1; 54312 } 54313 }); 54314 if (!pattern.categories?.length) { 54315 categoryMap.uncategorized.count += 1; 54316 } 54317 }); 54318 userPatterns.forEach((pattern) => { 54319 pattern.wp_pattern_category?.forEach((catId) => { 54320 const category = userPatternCategories.find( 54321 (cat) => cat.id === catId 54322 )?.name; 54323 if (categoryMap[category]) { 54324 categoryMap[category].count += 1; 54325 } 54326 }); 54327 if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some( 54328 (catId) => userPatternCategories.find((cat) => cat.id === catId) 54329 )) { 54330 categoryMap.uncategorized.count += 1; 54331 } 54332 }); 54333 [...defaultCategories, ...userPatternCategories].forEach( 54334 (category) => { 54335 if (categoryMap[category.name].count && !categoriesWithCounts.find( 54336 (cat) => cat.name === category.name 54337 )) { 54338 categoriesWithCounts.push(categoryMap[category.name]); 54339 } 54340 } 54341 ); 54342 const sortedCategories = categoriesWithCounts.sort( 54343 (a2, b2) => a2.label.localeCompare(b2.label) 54344 ); 54345 sortedCategories.unshift({ 54346 name: PATTERN_USER_CATEGORY, 54347 label: (0, import_i18n134.__)("My patterns"), 54348 count: userPatterns.length 54349 }); 54350 sortedCategories.unshift({ 54351 name: PATTERN_DEFAULT_CATEGORY, 54352 label: (0, import_i18n134.__)("All patterns"), 54353 description: (0, import_i18n134.__)("A list of all patterns from all sources."), 54354 count: themePatterns.length + userPatterns.length 54355 }); 54356 return sortedCategories; 54357 }, [ 54358 defaultCategories, 54359 themePatterns, 54360 userPatternCategories, 54361 userPatterns 54362 ]); 54363 return { patternCategories, hasPatterns: !!patternCategories.length }; 54364 } 54365 54366 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.mjs 54367 var import_core_data46 = __toESM(require_core_data(), 1); 54368 var import_data69 = __toESM(require_data(), 1); 54369 var import_block_library3 = __toESM(require_block_library(), 1); 54370 var { NAVIGATION_OVERLAY_TEMPLATE_PART_AREA } = unlock( 54371 import_block_library3.privateApis 54372 ); 54373 var useTemplatePartsGroupedByArea = (items) => { 54374 const allItems = items || []; 54375 const templatePartAreas = (0, import_data69.useSelect)( 54376 (select4) => select4(import_core_data46.store).getCurrentTheme()?.default_template_part_areas || [], 54377 [] 54378 ); 54379 const knownAreas = { 54380 header: {}, 54381 footer: {}, 54382 sidebar: {}, 54383 uncategorized: {}, 54384 [NAVIGATION_OVERLAY_TEMPLATE_PART_AREA]: {} 54385 }; 54386 templatePartAreas.forEach( 54387 (templatePartArea) => knownAreas[templatePartArea.area] = { 54388 ...templatePartArea, 54389 templateParts: [] 54390 } 54391 ); 54392 const groupedByArea = allItems.reduce((accumulator, item) => { 54393 const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY; 54394 accumulator[key]?.templateParts?.push(item); 54395 return accumulator; 54396 }, knownAreas); 54397 return groupedByArea; 54398 }; 54399 function useTemplatePartAreas() { 54400 const { records: templateParts, isResolving: isLoading } = (0, import_core_data46.useEntityRecords)( 54401 "postType", 54402 TEMPLATE_PART_POST_TYPE, 54403 { per_page: -1 } 54404 ); 54405 return { 54406 hasTemplateParts: templateParts ? !!templateParts.length : false, 54407 isLoading, 54408 templatePartAreas: useTemplatePartsGroupedByArea(templateParts) 54409 }; 54410 } 54411 54412 // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.mjs 54413 var import_jsx_runtime303 = __toESM(require_jsx_runtime(), 1); 54414 var { useLocation: useLocation23 } = unlock(import_router26.privateApis); 54415 function CategoriesGroup({ 54416 templatePartViews, 54417 patternViews, 54418 templatePartCounts, 54419 patternCounts, 54420 currentCategory, 54421 currentType 54422 }) { 54423 return /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)(import_components141.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: [ 54424 templatePartViews?.map((view) => /* @__PURE__ */ (0, import_jsx_runtime303.jsx)( 54425 CategoryItem, 54426 { 54427 count: templatePartCounts[view.slug], 54428 icon: (0, import_editor28.getTemplatePartIcon)( 54429 view.slug === TEMPLATE_PART_ALL_AREAS_CATEGORY ? void 0 : view.slug 54430 ), 54431 label: view.title, 54432 id: view.slug, 54433 type: TEMPLATE_PART_POST_TYPE, 54434 isActive: currentCategory === view.slug && currentType === TEMPLATE_PART_POST_TYPE 54435 }, 54436 view.slug 54437 )), 54438 /* @__PURE__ */ (0, import_jsx_runtime303.jsx)("div", { className: "edit-site-sidebar-navigation-screen-patterns__divider" }), 54439 patternViews?.map((view) => /* @__PURE__ */ (0, import_jsx_runtime303.jsx)( 54440 CategoryItem, 54441 { 54442 count: patternCounts[view.slug], 54443 label: view.title, 54444 icon: file_default, 54445 id: view.slug, 54446 type: PATTERN_TYPES.user, 54447 isActive: currentCategory === `$view.slug}` && currentType === PATTERN_TYPES.user 54448 }, 54449 view.slug 54450 )) 54451 ] }); 54452 } 54453 function SidebarNavigationScreenPatterns({ backPath }) { 54454 const { 54455 query: { postType: postType2 = "wp_block", categoryId } 54456 } = useLocation23(); 54457 const currentCategory = categoryId || (postType2 === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY); 54458 const { view_list: templatePartViews } = useViewConfig({ 54459 kind: "postType", 54460 name: TEMPLATE_PART_POST_TYPE 54461 }); 54462 const { view_list: patternViews } = useViewConfig({ 54463 kind: "postType", 54464 name: PATTERN_TYPES.user 54465 }); 54466 const { templatePartAreas, isLoading, hasTemplateParts } = useTemplatePartAreas(); 54467 const templatePartCounts = (0, import_element170.useMemo)(() => { 54468 const counts = { [TEMPLATE_PART_ALL_AREAS_CATEGORY]: 0 }; 54469 Object.entries(templatePartAreas).forEach( 54470 ([area, { templateParts }]) => { 54471 const count = templateParts?.length || 0; 54472 counts[area] = count; 54473 counts[TEMPLATE_PART_ALL_AREAS_CATEGORY] += count; 54474 } 54475 ); 54476 return counts; 54477 }, [templatePartAreas]); 54478 const { patternCategories } = usePatternCategories(); 54479 const patternCounts = (0, import_element170.useMemo)(() => { 54480 const counts = {}; 54481 patternCategories.forEach((cat) => { 54482 counts[cat.name] = cat.count; 54483 }); 54484 return counts; 54485 }, [patternCategories]); 54486 const hasPatterns = patternCounts[PATTERN_DEFAULT_CATEGORY] > 0; 54487 return /* @__PURE__ */ (0, import_jsx_runtime303.jsx)( 54488 SidebarNavigationScreen, 54489 { 54490 title: (0, import_i18n135.__)("Patterns"), 54491 description: (0, import_i18n135.__)( 54492 "Manage what patterns are available when editing the site." 54493 ), 54494 isRoot: !backPath, 54495 backPath, 54496 content: /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)(import_jsx_runtime303.Fragment, { children: [ 54497 isLoading && (0, import_i18n135.__)("Loading items\u2026"), 54498 !isLoading && /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)(import_jsx_runtime303.Fragment, { children: [ 54499 !hasTemplateParts && !hasPatterns && /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_components141.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_components141.__experimentalItem, { children: (0, import_i18n135.__)("No items found") }) }), 54500 /* @__PURE__ */ (0, import_jsx_runtime303.jsx)( 54501 CategoriesGroup, 54502 { 54503 templatePartViews, 54504 patternViews, 54505 templatePartCounts, 54506 patternCounts, 54507 currentCategory, 54508 currentType: postType2 54509 } 54510 ) 54511 ] }) 54512 ] }) 54513 } 54514 ); 54515 } 54516 54517 // packages/edit-site/build-module/components/page-patterns/index.mjs 54518 var import_i18n142 = __toESM(require_i18n(), 1); 54519 var import_element177 = __toESM(require_element(), 1); 54520 var import_block_editor26 = __toESM(require_block_editor(), 1); 54521 var import_core_data52 = __toESM(require_core_data(), 1); 54522 var import_editor32 = __toESM(require_editor(), 1); 54523 var import_router30 = __toESM(require_router(), 1); 54524 var import_data75 = __toESM(require_data(), 1); 54525 var import_url17 = __toESM(require_url(), 1); 54526 54527 // packages/edit-site/build-module/components/page-patterns/use-pattern-settings.mjs 54528 var import_core_data47 = __toESM(require_core_data(), 1); 54529 var import_data70 = __toESM(require_data(), 1); 54530 var import_element171 = __toESM(require_element(), 1); 54531 var import_block_editor24 = __toESM(require_block_editor(), 1); 54532 var import_editor29 = __toESM(require_editor(), 1); 54533 var { useGlobalStyles: useGlobalStyles3 } = unlock(import_editor29.privateApis); 54534 var { globalStylesDataKey } = unlock(import_block_editor24.privateApis); 54535 function usePatternSettings() { 54536 const { merged: mergedConfig } = useGlobalStyles3(); 54537 const storedSettings = (0, import_data70.useSelect)((select4) => { 54538 const { getSettings: getSettings7 } = unlock(select4(store)); 54539 return getSettings7(); 54540 }, []); 54541 const settingsBlockPatterns = storedSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0 54542 storedSettings.__experimentalBlockPatterns; 54543 const restBlockPatterns = (0, import_data70.useSelect)( 54544 (select4) => select4(import_core_data47.store).getBlockPatterns(), 54545 [] 54546 ); 54547 const blockPatterns = (0, import_element171.useMemo)( 54548 () => [ 54549 ...settingsBlockPatterns || [], 54550 ...restBlockPatterns || [] 54551 ].filter(filterOutDuplicatesByName), 54552 [settingsBlockPatterns, restBlockPatterns] 54553 ); 54554 const [globalStyles, globalSettings] = (0, import_element171.useMemo)(() => { 54555 return generateGlobalStyles(mergedConfig, [], { 54556 disableRootPadding: false 54557 }); 54558 }, [mergedConfig]); 54559 const settings2 = (0, import_element171.useMemo)(() => { 54560 const { 54561 __experimentalAdditionalBlockPatterns, 54562 styles, 54563 __experimentalFeatures, 54564 ...restStoredSettings 54565 } = storedSettings; 54566 const nonGlobalStyles = (styles ?? []).filter( 54567 (style) => !style.isGlobalStyles 54568 ); 54569 return { 54570 ...restStoredSettings, 54571 styles: [...nonGlobalStyles, ...globalStyles], 54572 __experimentalFeatures: globalSettings, 54573 [globalStylesDataKey]: mergedConfig.styles ?? {}, 54574 __experimentalBlockPatterns: blockPatterns, 54575 isPreviewMode: true 54576 }; 54577 }, [ 54578 storedSettings, 54579 blockPatterns, 54580 globalStyles, 54581 globalSettings, 54582 mergedConfig 54583 ]); 54584 return settings2; 54585 } 54586 54587 // packages/edit-site/build-module/components/page-patterns/actions.mjs 54588 var import_components145 = __toESM(require_components(), 1); 54589 var import_i18n139 = __toESM(require_i18n(), 1); 54590 54591 // packages/edit-site/build-module/components/add-new-pattern/index.mjs 54592 var import_components142 = __toESM(require_components(), 1); 54593 var import_element172 = __toESM(require_element(), 1); 54594 var import_i18n136 = __toESM(require_i18n(), 1); 54595 var import_data71 = __toESM(require_data(), 1); 54596 var import_router27 = __toESM(require_router(), 1); 54597 var import_patterns2 = __toESM(require_patterns(), 1); 54598 var import_notices6 = __toESM(require_notices(), 1); 54599 var import_core_data48 = __toESM(require_core_data(), 1); 54600 var import_editor30 = __toESM(require_editor(), 1); 54601 var import_jsx_runtime304 = __toESM(require_jsx_runtime(), 1); 54602 var { useHistory: useHistory17, useLocation: useLocation24 } = unlock(import_router27.privateApis); 54603 var { CreatePatternModal, useAddPatternCategory } = unlock( 54604 import_patterns2.privateApis 54605 ); 54606 var { CreateTemplatePartModal } = unlock(import_editor30.privateApis); 54607 function AddNewPattern() { 54608 const history = useHistory17(); 54609 const location = useLocation24(); 54610 const [showPatternModal, setShowPatternModal] = (0, import_element172.useState)(false); 54611 const [showTemplatePartModal, setShowTemplatePartModal] = (0, import_element172.useState)(false); 54612 const { createPatternFromFile } = unlock((0, import_data71.useDispatch)(import_patterns2.store)); 54613 const { createSuccessNotice, createErrorNotice } = (0, import_data71.useDispatch)(import_notices6.store); 54614 const patternUploadInputRef = (0, import_element172.useRef)(); 54615 const { 54616 isBlockBasedTheme, 54617 addNewPatternLabel, 54618 addNewTemplatePartLabel, 54619 canCreatePattern, 54620 canCreateTemplatePart 54621 } = (0, import_data71.useSelect)((select4) => { 54622 const { getCurrentTheme, getPostType: getPostType2, canUser } = select4(import_core_data48.store); 54623 return { 54624 isBlockBasedTheme: getCurrentTheme()?.is_block_theme, 54625 addNewPatternLabel: getPostType2(PATTERN_TYPES.user)?.labels?.add_new_item, 54626 addNewTemplatePartLabel: getPostType2(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item, 54627 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. 54628 canCreatePattern: canUser("create", { 54629 kind: "postType", 54630 name: PATTERN_TYPES.user 54631 }), 54632 canCreateTemplatePart: canUser("create", { 54633 kind: "postType", 54634 name: TEMPLATE_PART_POST_TYPE 54635 }) 54636 }; 54637 }, []); 54638 function handleCreatePattern({ pattern }) { 54639 setShowPatternModal(false); 54640 history.navigate( 54641 `/$PATTERN_TYPES.user}/$pattern.id}?canvas=edit` 54642 ); 54643 } 54644 function handleCreateTemplatePart(templatePart) { 54645 setShowTemplatePartModal(false); 54646 history.navigate( 54647 `/$TEMPLATE_PART_POST_TYPE}/$templatePart.id}?canvas=edit` 54648 ); 54649 } 54650 function handleError() { 54651 setShowPatternModal(false); 54652 setShowTemplatePartModal(false); 54653 } 54654 const controls = []; 54655 if (canCreatePattern) { 54656 controls.push({ 54657 icon: symbol_default, 54658 onClick: () => setShowPatternModal(true), 54659 title: addNewPatternLabel 54660 }); 54661 } 54662 if (isBlockBasedTheme && canCreateTemplatePart) { 54663 controls.push({ 54664 icon: symbol_filled_default, 54665 onClick: () => setShowTemplatePartModal(true), 54666 title: addNewTemplatePartLabel 54667 }); 54668 } 54669 if (canCreatePattern) { 54670 controls.push({ 54671 icon: upload_default, 54672 onClick: () => { 54673 patternUploadInputRef.current.click(); 54674 }, 54675 title: (0, import_i18n136.__)("Import pattern from JSON") 54676 }); 54677 } 54678 const { categoryMap, findOrCreateTerm } = useAddPatternCategory(); 54679 if (controls.length === 0) { 54680 return null; 54681 } 54682 return /* @__PURE__ */ (0, import_jsx_runtime304.jsxs)(import_jsx_runtime304.Fragment, { children: [ 54683 addNewPatternLabel && /* @__PURE__ */ (0, import_jsx_runtime304.jsx)( 54684 import_components142.DropdownMenu, 54685 { 54686 controls, 54687 icon: null, 54688 toggleProps: { 54689 variant: "primary", 54690 showTooltip: false, 54691 size: "compact", 54692 __next40pxDefaultSize: true 54693 }, 54694 text: addNewPatternLabel, 54695 label: addNewPatternLabel 54696 } 54697 ), 54698 showPatternModal && /* @__PURE__ */ (0, import_jsx_runtime304.jsx)( 54699 CreatePatternModal, 54700 { 54701 onClose: () => setShowPatternModal(false), 54702 onSuccess: handleCreatePattern, 54703 onError: handleError 54704 } 54705 ), 54706 showTemplatePartModal && /* @__PURE__ */ (0, import_jsx_runtime304.jsx)( 54707 CreateTemplatePartModal, 54708 { 54709 closeModal: () => setShowTemplatePartModal(false), 54710 blocks: [], 54711 onCreate: handleCreateTemplatePart, 54712 onError: handleError 54713 } 54714 ), 54715 /* @__PURE__ */ (0, import_jsx_runtime304.jsx)( 54716 "input", 54717 { 54718 type: "file", 54719 accept: ".json", 54720 hidden: true, 54721 ref: patternUploadInputRef, 54722 onChange: async (event) => { 54723 const file = event.target.files?.[0]; 54724 if (!file) { 54725 return; 54726 } 54727 try { 54728 let currentCategoryId; 54729 if (location.query.postType !== TEMPLATE_PART_POST_TYPE) { 54730 const currentCategory = Array.from( 54731 categoryMap.values() 54732 ).find( 54733 (term) => term.name === location.query.categoryId 54734 ); 54735 if (currentCategory) { 54736 currentCategoryId = currentCategory.id || await findOrCreateTerm( 54737 currentCategory.label 54738 ); 54739 } 54740 } 54741 const pattern = await createPatternFromFile( 54742 file, 54743 currentCategoryId ? [currentCategoryId] : void 0 54744 ); 54745 if (!currentCategoryId && location.query.categoryId !== "my-patterns") { 54746 history.navigate( 54747 `/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}` 54748 ); 54749 } 54750 createSuccessNotice( 54751 (0, import_i18n136.sprintf)( 54752 // translators: %s: The imported pattern's title. 54753 (0, import_i18n136.__)('Imported "%s" from JSON.'), 54754 pattern.title.raw 54755 ), 54756 { 54757 type: "snackbar", 54758 id: "import-pattern-success" 54759 } 54760 ); 54761 } catch (err) { 54762 createErrorNotice(err.message, { 54763 type: "snackbar", 54764 id: "import-pattern-error" 54765 }); 54766 } finally { 54767 event.target.value = ""; 54768 } 54769 } 54770 } 54771 ) 54772 ] }); 54773 } 54774 54775 // packages/edit-site/build-module/components/page-patterns/rename-category-menu-item.mjs 54776 var import_components143 = __toESM(require_components(), 1); 54777 var import_element173 = __toESM(require_element(), 1); 54778 var import_i18n137 = __toESM(require_i18n(), 1); 54779 var import_patterns3 = __toESM(require_patterns(), 1); 54780 var import_jsx_runtime305 = __toESM(require_jsx_runtime(), 1); 54781 var { RenamePatternCategoryModal } = unlock(import_patterns3.privateApis); 54782 function RenameCategoryMenuItem({ category, onClose }) { 54783 const [isModalOpen, setIsModalOpen] = (0, import_element173.useState)(false); 54784 return /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)(import_jsx_runtime305.Fragment, { children: [ 54785 /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_components143.MenuItem, { onClick: () => setIsModalOpen(true), children: (0, import_i18n137.__)("Rename") }), 54786 isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime305.jsx)( 54787 RenameModal2, 54788 { 54789 category, 54790 onClose: () => { 54791 setIsModalOpen(false); 54792 onClose(); 54793 } 54794 } 54795 ) 54796 ] }); 54797 } 54798 function RenameModal2({ category, onClose }) { 54799 const normalizedCategory = { 54800 id: category.id, 54801 slug: category.slug, 54802 name: category.label 54803 }; 54804 const existingCategories = usePatternCategories(); 54805 return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)( 54806 RenamePatternCategoryModal, 54807 { 54808 category: normalizedCategory, 54809 existingCategories, 54810 onClose, 54811 overlayClassName: "edit-site-list__rename-modal", 54812 focusOnMount: "firstContentElement", 54813 size: "small" 54814 } 54815 ); 54816 } 54817 54818 // packages/edit-site/build-module/components/page-patterns/delete-category-menu-item.mjs 54819 var import_components144 = __toESM(require_components(), 1); 54820 var import_core_data49 = __toESM(require_core_data(), 1); 54821 var import_data72 = __toESM(require_data(), 1); 54822 var import_element174 = __toESM(require_element(), 1); 54823 var import_html_entities9 = __toESM(require_html_entities(), 1); 54824 var import_i18n138 = __toESM(require_i18n(), 1); 54825 var import_notices7 = __toESM(require_notices(), 1); 54826 var import_router28 = __toESM(require_router(), 1); 54827 var import_jsx_runtime306 = __toESM(require_jsx_runtime(), 1); 54828 var { useHistory: useHistory18 } = unlock(import_router28.privateApis); 54829 function DeleteCategoryMenuItem({ category, onClose }) { 54830 const [isModalOpen, setIsModalOpen] = (0, import_element174.useState)(false); 54831 const history = useHistory18(); 54832 const { createSuccessNotice, createErrorNotice } = (0, import_data72.useDispatch)(import_notices7.store); 54833 const { deleteEntityRecord, invalidateResolution } = (0, import_data72.useDispatch)(import_core_data49.store); 54834 const onDelete = async () => { 54835 try { 54836 await deleteEntityRecord( 54837 "taxonomy", 54838 "wp_pattern_category", 54839 category.id, 54840 { force: true }, 54841 { throwOnError: true } 54842 ); 54843 invalidateResolution("getUserPatternCategories"); 54844 invalidateResolution("getEntityRecords", [ 54845 "postType", 54846 PATTERN_TYPES.user, 54847 { per_page: -1 } 54848 ]); 54849 createSuccessNotice( 54850 (0, import_i18n138.sprintf)( 54851 /* translators: %s: The pattern category's name */ 54852 (0, import_i18n138._x)('"%s" deleted.', "pattern category"), 54853 category.label 54854 ), 54855 { type: "snackbar", id: "pattern-category-delete" } 54856 ); 54857 onClose?.(); 54858 history.navigate( 54859 `/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}` 54860 ); 54861 } catch (error2) { 54862 const errorMessage = error2.message && error2.code !== "unknown_error" ? error2.message : (0, import_i18n138.__)( 54863 "An error occurred while deleting the pattern category." 54864 ); 54865 createErrorNotice(errorMessage, { 54866 type: "snackbar", 54867 id: "pattern-category-delete" 54868 }); 54869 } 54870 }; 54871 return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)(import_jsx_runtime306.Fragment, { children: [ 54872 /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(import_components144.MenuItem, { isDestructive: true, onClick: () => setIsModalOpen(true), children: (0, import_i18n138.__)("Delete") }), 54873 /* @__PURE__ */ (0, import_jsx_runtime306.jsx)( 54874 import_components144.__experimentalConfirmDialog, 54875 { 54876 isOpen: isModalOpen, 54877 onConfirm: onDelete, 54878 onCancel: () => setIsModalOpen(false), 54879 confirmButtonText: (0, import_i18n138.__)("Delete"), 54880 className: "edit-site-patterns__delete-modal", 54881 title: (0, import_i18n138.sprintf)( 54882 // translators: %s: The pattern category's name. 54883 (0, import_i18n138._x)('Delete "%s"?', "pattern category"), 54884 (0, import_html_entities9.decodeEntities)(category.label) 54885 ), 54886 size: "medium", 54887 __experimentalHideHeader: false, 54888 children: (0, import_i18n138.sprintf)( 54889 // translators: %s: The pattern category's name. 54890 (0, import_i18n138.__)( 54891 'Are you sure you want to delete the category "%s"? The patterns will not be deleted.' 54892 ), 54893 (0, import_html_entities9.decodeEntities)(category.label) 54894 ) 54895 } 54896 ) 54897 ] }); 54898 } 54899 54900 // packages/edit-site/build-module/components/page-patterns/actions.mjs 54901 var import_jsx_runtime307 = __toESM(require_jsx_runtime(), 1); 54902 function PatternsActions({ categoryId, type }) { 54903 const { patternCategories } = usePatternCategories(); 54904 let patternCategory; 54905 if (type === PATTERN_TYPES.user && !!categoryId) { 54906 patternCategory = patternCategories.find( 54907 (category) => category.name === categoryId 54908 ); 54909 } 54910 return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(import_jsx_runtime307.Fragment, { children: [ 54911 /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(AddNewPattern, {}), 54912 !!patternCategory?.id && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)( 54913 import_components145.DropdownMenu, 54914 { 54915 icon: more_vertical_default, 54916 label: (0, import_i18n139.__)("Actions"), 54917 toggleProps: { 54918 className: "edit-site-patterns__button", 54919 size: "compact" 54920 }, 54921 children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(import_components145.MenuGroup, { children: [ 54922 /* @__PURE__ */ (0, import_jsx_runtime307.jsx)( 54923 RenameCategoryMenuItem, 54924 { 54925 category: patternCategory, 54926 onClose 54927 } 54928 ), 54929 /* @__PURE__ */ (0, import_jsx_runtime307.jsx)( 54930 DeleteCategoryMenuItem, 54931 { 54932 category: patternCategory, 54933 onClose 54934 } 54935 ) 54936 ] }) 54937 } 54938 ) 54939 ] }); 54940 } 54941 54942 // packages/edit-site/build-module/components/dataviews-actions/index.mjs 54943 var import_i18n140 = __toESM(require_i18n(), 1); 54944 var import_element175 = __toESM(require_element(), 1); 54945 var import_router29 = __toESM(require_router(), 1); 54946 var import_data73 = __toESM(require_data(), 1); 54947 var import_core_data50 = __toESM(require_core_data(), 1); 54948 var import_url16 = __toESM(require_url(), 1); 54949 var { useLocation: useLocation25, useHistory: useHistory19 } = unlock(import_router29.privateApis); 54950 var useSetActiveTemplateAction = () => { 54951 const activeTheme = (0, import_data73.useSelect)( 54952 (select4) => select4(import_core_data50.store).getCurrentTheme() 54953 ); 54954 const { getEntityRecord } = (0, import_data73.useSelect)(import_core_data50.store); 54955 const { editEntityRecord, saveEditedEntityRecord } = (0, import_data73.useDispatch)(import_core_data50.store); 54956 return (0, import_element175.useMemo)( 54957 () => ({ 54958 id: "set-active-template", 54959 label(items) { 54960 return items.some((item) => item._isActive) ? (0, import_i18n140.__)("Deactivate") : (0, import_i18n140.__)("Activate"); 54961 }, 54962 isPrimary: true, 54963 icon: pencil_default, 54964 isEligible(item) { 54965 if (item.theme !== activeTheme.stylesheet) { 54966 return false; 54967 } 54968 if (typeof item.id !== "number") { 54969 return item._isActive === false; 54970 } 54971 return true; 54972 }, 54973 async callback(items) { 54974 const deactivate = items.some((item) => item._isActive); 54975 const activeTemplates = { 54976 ...await getEntityRecord("root", "site").active_templates ?? {} 54977 }; 54978 for (const item of items) { 54979 if (deactivate) { 54980 delete activeTemplates[item.slug]; 54981 } else { 54982 activeTemplates[item.slug] = item.id; 54983 } 54984 } 54985 await editEntityRecord("root", "site", void 0, { 54986 active_templates: activeTemplates 54987 }); 54988 await saveEditedEntityRecord("root", "site"); 54989 } 54990 }), 54991 [ 54992 editEntityRecord, 54993 saveEditedEntityRecord, 54994 getEntityRecord, 54995 activeTheme 54996 ] 54997 ); 54998 }; 54999 var useEditPostAction = () => { 55000 const history = useHistory19(); 55001 return (0, import_element175.useMemo)( 55002 () => ({ 55003 id: "edit-post", 55004 label: (0, import_i18n140.__)("Edit"), 55005 icon: pencil_default, 55006 isEligible(post2) { 55007 if (post2.status === "trash") { 55008 return false; 55009 } 55010 return post2.type !== PATTERN_TYPES.theme; 55011 }, 55012 callback(items) { 55013 const post2 = items[0]; 55014 history.navigate(`/$post2.type}/$post2.id}?canvas=edit`); 55015 } 55016 }), 55017 [history] 55018 ); 55019 }; 55020 var useQuickEditPostAction = () => { 55021 const history = useHistory19(); 55022 const { path, query } = useLocation25(); 55023 return (0, import_element175.useMemo)( 55024 () => ({ 55025 id: "quick-edit", 55026 label: (0, import_i18n140.__)("Quick Edit"), 55027 icon: drawer_right_default, 55028 isPrimary: true, 55029 supportsBulk: true, 55030 isEligible(post2) { 55031 if (post2.status === "trash") { 55032 return false; 55033 } 55034 return post2.type === "page"; 55035 }, 55036 callback(items) { 55037 history.navigate( 55038 (0, import_url16.addQueryArgs)(path, { 55039 ...query, 55040 quickEdit: true, 55041 postId: items.map((item) => item.id).join(",") 55042 }) 55043 ); 55044 } 55045 }), 55046 [history, path, query] 55047 ); 55048 }; 55049 55050 // packages/edit-site/build-module/components/page-patterns/fields.mjs 55051 var import_components146 = __toESM(require_components(), 1); 55052 var import_i18n141 = __toESM(require_i18n(), 1); 55053 var import_element176 = __toESM(require_element(), 1); 55054 var import_block_editor25 = __toESM(require_block_editor(), 1); 55055 var import_blocks12 = __toESM(require_blocks(), 1); 55056 var import_editor31 = __toESM(require_editor(), 1); 55057 55058 // packages/edit-site/build-module/components/page-templates/hooks.mjs 55059 var import_core_data51 = __toESM(require_core_data(), 1); 55060 var import_data74 = __toESM(require_data(), 1); 55061 function useAddedBy(postType2, postId) { 55062 return (0, import_data74.useSelect)( 55063 (select4) => { 55064 const { getEntityRecord, getUser, getEditedEntityRecord } = select4(import_core_data51.store); 55065 const template = getEditedEntityRecord( 55066 "postType", 55067 postType2, 55068 postId 55069 ); 55070 const originalSource = template?.original_source; 55071 const authorText = template?.author_text; 55072 switch (originalSource) { 55073 case "theme": { 55074 return { 55075 type: originalSource, 55076 icon: layout_default, 55077 text: authorText, 55078 isCustomized: template.source === TEMPLATE_ORIGINS.custom 55079 }; 55080 } 55081 case "plugin": { 55082 return { 55083 type: originalSource, 55084 icon: plugins_default, 55085 text: authorText, 55086 isCustomized: template.source === TEMPLATE_ORIGINS.custom 55087 }; 55088 } 55089 case "site": { 55090 const siteData = getEntityRecord( 55091 "root", 55092 "__unstableBase" 55093 ); 55094 return { 55095 type: originalSource, 55096 icon: globe_default, 55097 imageUrl: siteData?.site_logo ? getEntityRecord( 55098 "postType", 55099 "attachment", 55100 siteData.site_logo 55101 )?.source_url : void 0, 55102 text: authorText, 55103 isCustomized: false 55104 }; 55105 } 55106 default: { 55107 const user = getUser(template.author); 55108 return { 55109 type: "user", 55110 icon: comment_author_avatar_default, 55111 imageUrl: user?.avatar_urls?.[48], 55112 text: authorText ?? user?.name, 55113 isCustomized: false 55114 }; 55115 } 55116 } 55117 }, 55118 [postType2, postId] 55119 ); 55120 } 55121 55122 // packages/edit-site/build-module/components/page-patterns/fields.mjs 55123 var import_jsx_runtime308 = __toESM(require_jsx_runtime(), 1); 55124 var { useStyle: useStyle4 } = unlock(import_editor31.privateApis); 55125 function PreviewField({ item }) { 55126 const descriptionId = (0, import_element176.useId)(); 55127 const description = item.description || item?.excerpt?.raw; 55128 const isTemplatePart2 = item.type === TEMPLATE_PART_POST_TYPE; 55129 const backgroundColor = useStyle4("color.background"); 55130 const blocks = (0, import_element176.useMemo)(() => { 55131 return item.blocks ?? (0, import_blocks12.parse)(item.content.raw, { 55132 __unstableSkipMigrationLogs: true 55133 }); 55134 }, [item?.content?.raw, item.blocks]); 55135 const isEmpty3 = !blocks?.length; 55136 return /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)( 55137 "div", 55138 { 55139 className: "page-patterns-preview-field", 55140 style: { backgroundColor }, 55141 "aria-describedby": !!description ? descriptionId : void 0, 55142 children: [ 55143 isEmpty3 && isTemplatePart2 && (0, import_i18n141.__)("Empty template part"), 55144 isEmpty3 && !isTemplatePart2 && (0, import_i18n141.__)("Empty pattern"), 55145 !isEmpty3 && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(import_block_editor25.BlockPreview.Async, { children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)( 55146 import_block_editor25.BlockPreview, 55147 { 55148 blocks, 55149 viewportWidth: item.viewportWidth 55150 } 55151 ) }), 55152 !!description && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("div", { hidden: true, id: descriptionId, children: description }) 55153 ] 55154 } 55155 ); 55156 } 55157 var previewField = { 55158 label: (0, import_i18n141.__)("Preview"), 55159 id: "preview", 55160 render: PreviewField, 55161 enableSorting: false 55162 }; 55163 var SYNC_FILTERS = [ 55164 { 55165 value: PATTERN_SYNC_TYPES.full, 55166 label: (0, import_i18n141._x)("Synced", "pattern (singular)"), 55167 description: (0, import_i18n141.__)("Patterns that are kept in sync across the site.") 55168 }, 55169 { 55170 value: PATTERN_SYNC_TYPES.unsynced, 55171 label: (0, import_i18n141._x)("Not synced", "pattern (singular)"), 55172 description: (0, import_i18n141.__)( 55173 "Patterns that can be changed freely without affecting the site." 55174 ) 55175 } 55176 ]; 55177 var patternStatusField = { 55178 label: (0, import_i18n141.__)("Sync status"), 55179 id: "sync-status", 55180 render: ({ item }) => { 55181 const syncStatus = "wp_pattern_sync_status" in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced; 55182 return /* @__PURE__ */ (0, import_jsx_runtime308.jsx)( 55183 "span", 55184 { 55185 className: `edit-site-patterns__field-sync-status-$syncStatus}`, 55186 children: SYNC_FILTERS.find(({ value }) => value === syncStatus).label 55187 } 55188 ); 55189 }, 55190 elements: SYNC_FILTERS, 55191 filterBy: { 55192 operators: [OPERATOR_IS], 55193 isPrimary: true 55194 }, 55195 enableSorting: false 55196 }; 55197 function AuthorField({ item }) { 55198 const [isImageLoaded, setIsImageLoaded] = (0, import_element176.useState)(false); 55199 const { text, icon, imageUrl } = useAddedBy(item.type, item.id); 55200 return /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)(import_components146.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 55201 imageUrl && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)( 55202 "div", 55203 { 55204 className: clsx_default("fields-controls__author-avatar", { 55205 "is-loaded": isImageLoaded 55206 }), 55207 children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)( 55208 "img", 55209 { 55210 onLoad: () => setIsImageLoaded(true), 55211 alt: "", 55212 src: imageUrl 55213 } 55214 ) 55215 } 55216 ), 55217 !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("div", { className: "fields-controls__author-icon", children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(icon_default, { icon }) }), 55218 /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("span", { className: "fields-controls__author-name", children: text }) 55219 ] }); 55220 } 55221 var templatePartAuthorField = { 55222 label: (0, import_i18n141.__)("Author"), 55223 id: "author", 55224 getValue: ({ item }) => item.author_text, 55225 render: AuthorField, 55226 filterBy: { 55227 isPrimary: true 55228 } 55229 }; 55230 55231 // packages/edit-site/build-module/components/page-patterns/index.mjs 55232 var import_jsx_runtime309 = __toESM(require_jsx_runtime(), 1); 55233 var { ExperimentalBlockEditorProvider } = unlock(import_block_editor26.privateApis); 55234 var { usePostActions, patternTitleField } = unlock(import_editor32.privateApis); 55235 var { useLocation: useLocation26, useHistory: useHistory20 } = unlock(import_router30.privateApis); 55236 var EMPTY_ARRAY11 = []; 55237 function usePagePatternsHeader(type, categoryId) { 55238 const { patternCategories } = usePatternCategories(); 55239 const templatePartAreas = (0, import_data75.useSelect)( 55240 (select4) => select4(import_core_data52.store).getCurrentTheme()?.default_template_part_areas || [], 55241 [] 55242 ); 55243 let title, description, patternCategory; 55244 if (type === TEMPLATE_PART_POST_TYPE) { 55245 const templatePartArea = templatePartAreas.find( 55246 (area) => area.area === categoryId 55247 ); 55248 title = templatePartArea?.label || (0, import_i18n142.__)("All Template Parts"); 55249 description = templatePartArea?.description || (0, import_i18n142.__)("Includes every template part defined for any area."); 55250 } else if (type === PATTERN_TYPES.user && !!categoryId) { 55251 patternCategory = patternCategories.find( 55252 (category) => category.name === categoryId 55253 ); 55254 title = patternCategory?.label; 55255 description = patternCategory?.description; 55256 } 55257 return { title, description }; 55258 } 55259 function DataviewsPatterns() { 55260 const { path, query } = useLocation26(); 55261 const { postType: postType2 = "wp_block", categoryId: categoryIdFromURL } = query; 55262 const history = useHistory20(); 55263 const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY; 55264 const { default_view: defaultView, default_layouts: defaultLayouts2 } = useViewConfig({ 55265 kind: "postType", 55266 name: postType2 55267 }); 55268 const { view, updateView, isModified, resetToDefault } = useView({ 55269 kind: "postType", 55270 name: postType2, 55271 slug: "default", 55272 defaultView, 55273 defaultLayouts: defaultLayouts2, 55274 queryParams: { 55275 page: query.pageNumber, 55276 search: query.search 55277 }, 55278 onChangeQueryParams: (params) => { 55279 history.navigate( 55280 (0, import_url17.addQueryArgs)(path, { 55281 ...query, 55282 pageNumber: params.page, 55283 search: params.search 55284 }) 55285 ); 55286 } 55287 }); 55288 const viewSyncStatus = view.filters?.find( 55289 ({ field }) => field === "sync-status" 55290 )?.value; 55291 const { patterns, isResolving } = use_patterns_default(postType2, categoryId, { 55292 search: view.search, 55293 syncStatus: viewSyncStatus 55294 }); 55295 const { records } = (0, import_core_data52.useEntityRecords)("postType", TEMPLATE_PART_POST_TYPE, { 55296 per_page: -1 55297 }); 55298 const authors = (0, import_element177.useMemo)(() => { 55299 if (!records) { 55300 return EMPTY_ARRAY11; 55301 } 55302 const authorsSet = /* @__PURE__ */ new Set(); 55303 records.forEach((template) => { 55304 authorsSet.add(template.author_text); 55305 }); 55306 return Array.from(authorsSet).map((author) => ({ 55307 value: author, 55308 label: author 55309 })); 55310 }, [records]); 55311 const fields2 = (0, import_element177.useMemo)(() => { 55312 const _fields = [previewField, patternTitleField]; 55313 if (postType2 === PATTERN_TYPES.user) { 55314 _fields.push(patternStatusField); 55315 } else if (postType2 === TEMPLATE_PART_POST_TYPE) { 55316 _fields.push({ 55317 ...templatePartAuthorField, 55318 elements: authors 55319 }); 55320 } 55321 return _fields; 55322 }, [postType2, authors]); 55323 const { data, paginationInfo } = (0, import_element177.useMemo)(() => { 55324 const viewWithoutFilters = { ...view }; 55325 delete viewWithoutFilters.search; 55326 if (postType2 !== TEMPLATE_PART_POST_TYPE) { 55327 viewWithoutFilters.filters = []; 55328 } 55329 return filterSortAndPaginate(patterns, viewWithoutFilters, fields2); 55330 }, [patterns, view, fields2, postType2]); 55331 const dataWithPermissions = useAugmentPatternsWithPermissions(data); 55332 const templatePartActions = usePostActions({ 55333 postType: TEMPLATE_PART_POST_TYPE, 55334 context: "list" 55335 }); 55336 const patternActions = usePostActions({ 55337 postType: PATTERN_TYPES.user, 55338 context: "list" 55339 }); 55340 const editAction = useEditPostAction(); 55341 const actions = (0, import_element177.useMemo)(() => { 55342 if (postType2 === TEMPLATE_PART_POST_TYPE) { 55343 return [editAction, ...templatePartActions].filter(Boolean); 55344 } 55345 return [editAction, ...patternActions].filter(Boolean); 55346 }, [editAction, postType2, templatePartActions, patternActions]); 55347 const settings2 = usePatternSettings(); 55348 const { title, description } = usePagePatternsHeader( 55349 postType2, 55350 categoryId 55351 ); 55352 return /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(ExperimentalBlockEditorProvider, { settings: settings2, children: /* @__PURE__ */ (0, import_jsx_runtime309.jsx)( 55353 page_default2, 55354 { 55355 className: "edit-site-page-patterns-dataviews", 55356 title, 55357 headingLevel: 2, 55358 subTitle: description, 55359 actions: /* @__PURE__ */ (0, import_jsx_runtime309.jsx)( 55360 PatternsActions, 55361 { 55362 categoryId, 55363 type: postType2 55364 } 55365 ), 55366 children: /* @__PURE__ */ (0, import_jsx_runtime309.jsx)( 55367 dataviews_default, 55368 { 55369 paginationInfo, 55370 fields: fields2, 55371 actions, 55372 data: dataWithPermissions || EMPTY_ARRAY11, 55373 getItemId: (item) => item.name ?? item.id, 55374 isLoading: isResolving, 55375 isItemClickable: (item) => item.type !== PATTERN_TYPES.theme, 55376 onClickItem: (item) => { 55377 history.navigate( 55378 `/$item.type}/${[ 55379 PATTERN_TYPES.user, 55380 TEMPLATE_PART_POST_TYPE 55381 ].includes(item.type) ? item.id : item.name}?canvas=edit` 55382 ); 55383 }, 55384 view, 55385 onChangeView: updateView, 55386 defaultLayouts: defaultLayouts2, 55387 onReset: isModified ? resetToDefault : false 55388 }, 55389 categoryId + postType2 55390 ) 55391 } 55392 ) }); 55393 } 55394 55395 // packages/edit-site/build-module/components/site-editor-routes/patterns.mjs 55396 var import_jsx_runtime310 = __toESM(require_jsx_runtime(), 1); 55397 var patternsRoute = { 55398 name: "patterns", 55399 path: "/pattern", 55400 areas: { 55401 sidebar({ siteData }) { 55402 const isBlockTheme = siteData.currentTheme?.is_block_theme; 55403 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0; 55404 return /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(SidebarNavigationScreenPatterns, { backPath }); 55405 }, 55406 content: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(DataviewsPatterns, {}), 55407 mobileSidebar({ siteData, query }) { 55408 if (query.categoryId) { 55409 return void 0; 55410 } 55411 const isBlockTheme = siteData.currentTheme?.is_block_theme; 55412 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0; 55413 return /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(SidebarNavigationScreenPatterns, { backPath }); 55414 }, 55415 mobileContent({ query }) { 55416 return query.categoryId ? /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(DataviewsPatterns, {}) : void 0; 55417 } 55418 } 55419 }; 55420 55421 // packages/edit-site/build-module/components/site-editor-routes/pattern-item.mjs 55422 var import_jsx_runtime311 = __toESM(require_jsx_runtime(), 1); 55423 var patternItemRoute = { 55424 name: "pattern-item", 55425 path: "/wp_block/:postId", 55426 areas: { 55427 sidebar({ siteData }) { 55428 const isBlockTheme = siteData.currentTheme?.is_block_theme; 55429 const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0; 55430 return /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(SidebarNavigationScreenPatterns, { backPath }); 55431 }, 55432 // Also rendered on mobile, where this route is only reached at canvas=edit. 55433 preview: /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(EditSiteEditor, {}) 55434 } 55435 }; 55436 55437 // packages/edit-site/build-module/components/site-editor-routes/template-part-item.mjs 55438 var import_jsx_runtime312 = __toESM(require_jsx_runtime(), 1); 55439 var templatePartItemRoute = { 55440 name: "template-part-item", 55441 path: "/wp_template_part/*postId", 55442 areas: { 55443 sidebar: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(SidebarNavigationScreenPatterns, { backPath: "/" }), 55444 // Also rendered on mobile, where this route is only reached at canvas=edit. 55445 preview: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(EditSiteEditor, {}) 55446 } 55447 }; 55448 55449 // packages/edit-site/build-module/components/site-editor-routes/templates.mjs 55450 var import_data83 = __toESM(require_data(), 1); 55451 var import_core_data64 = __toESM(require_core_data(), 1); 55452 55453 // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.mjs 55454 var import_i18n144 = __toESM(require_i18n(), 1); 55455 55456 // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.mjs 55457 var import_core_data53 = __toESM(require_core_data(), 1); 55458 var import_element178 = __toESM(require_element(), 1); 55459 var import_components147 = __toESM(require_components(), 1); 55460 var import_i18n143 = __toESM(require_i18n(), 1); 55461 var import_router31 = __toESM(require_router(), 1); 55462 var import_url18 = __toESM(require_url(), 1); 55463 var import_jsx_runtime313 = __toESM(require_jsx_runtime(), 1); 55464 var { useLocation: useLocation27 } = unlock(import_router31.privateApis); 55465 var EMPTY_ARRAY12 = []; 55466 function TemplateDataviewItem({ template, isActive }) { 55467 const { text, icon } = useAddedBy(template.type, template.id); 55468 return /* @__PURE__ */ (0, import_jsx_runtime313.jsx)( 55469 SidebarNavigationItem, 55470 { 55471 to: (0, import_url18.addQueryArgs)("/template", { activeView: text }), 55472 icon, 55473 "aria-current": isActive, 55474 children: text 55475 } 55476 ); 55477 } 55478 function DataviewsTemplatesSidebarContent() { 55479 const { 55480 query: { activeView = "active" } 55481 } = useLocation27(); 55482 const { records } = (0, import_core_data53.useEntityRecords)("root", "registeredTemplate", { 55483 // This should not be needed, the endpoint returns all registered 55484 // templates, but it's not possible right now to turn off pagination for 55485 // entity configs. 55486 per_page: -1 55487 }); 55488 const firstItemPerAuthorText = (0, import_element178.useMemo)(() => { 55489 const firstItemPerAuthor = records?.reduce((acc, template) => { 55490 const author = template.author_text; 55491 if (author && !acc[author]) { 55492 acc[author] = template; 55493 } 55494 return acc; 55495 }, {}); 55496 return (firstItemPerAuthor && Object.values(firstItemPerAuthor)) ?? EMPTY_ARRAY12; 55497 }, [records]); 55498 return /* @__PURE__ */ (0, import_jsx_runtime313.jsxs)(import_components147.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-templates-browse", children: [ 55499 /* @__PURE__ */ (0, import_jsx_runtime313.jsx)( 55500 SidebarNavigationItem, 55501 { 55502 to: "/template", 55503 icon: published_default, 55504 "aria-current": activeView === "active", 55505 children: (0, import_i18n143.__)("Active templates") 55506 } 55507 ), 55508 /* @__PURE__ */ (0, import_jsx_runtime313.jsx)( 55509 SidebarNavigationItem, 55510 { 55511 to: (0, import_url18.addQueryArgs)("/template", { activeView: "user" }), 55512 icon: comment_author_avatar_default, 55513 "aria-current": activeView === "user", 55514 // Let's avoid calling them "custom templates" to avoid 55515 // confusion. "Created" is closest to meaning database 55516 // templates, created by users. 55517 // https://developer.wordpress.org/themes/classic-themes/templates/page-template-files/#creating-custom-page-templates-for-global-use 55518 children: (0, import_i18n143.__)("Created templates") 55519 } 55520 ), 55521 firstItemPerAuthorText.map((template) => { 55522 return /* @__PURE__ */ (0, import_jsx_runtime313.jsx)( 55523 TemplateDataviewItem, 55524 { 55525 template, 55526 isActive: activeView === template.author_text 55527 }, 55528 template.author_text 55529 ); 55530 }) 55531 ] }); 55532 } 55533 55534 // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs 55535 var import_core_data54 = __toESM(require_core_data(), 1); 55536 var import_data76 = __toESM(require_data(), 1); 55537 55538 // packages/edit-site/build-module/components/sidebar-dataviews/index.mjs 55539 var import_components148 = __toESM(require_components(), 1); 55540 var import_router32 = __toESM(require_router(), 1); 55541 var import_url19 = __toESM(require_url(), 1); 55542 var import_jsx_runtime314 = __toESM(require_jsx_runtime(), 1); 55543 var { useLocation: useLocation28 } = unlock(import_router32.privateApis); 55544 var SLUG_TO_ICON = { 55545 all: pages_default, 55546 published: published_default, 55547 future: scheduled_default, 55548 drafts: drafts_default, 55549 pending: pending_default, 55550 private: not_allowed_default, 55551 trash: trash_default 55552 }; 55553 var defaultResolveIcon = (view) => { 55554 return SLUG_TO_ICON[view.slug]; 55555 }; 55556 function DataViewsSidebarContent({ 55557 postType: postType2, 55558 resolveIcon = defaultResolveIcon 55559 }) { 55560 const { 55561 path, 55562 query: { activeView = "all" } 55563 } = useLocation28(); 55564 const { view_list: viewList } = useViewConfig({ 55565 kind: "postType", 55566 name: postType2 55567 }); 55568 if (!postType2) { 55569 return null; 55570 } 55571 return /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(import_jsx_runtime314.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(import_components148.__experimentalItemGroup, { className: "edit-site-sidebar-dataviews", children: viewList?.map((view) => { 55572 const isActive = view.slug === activeView; 55573 const slug = view.slug === "all" ? void 0 : view.slug; 55574 const icon = resolveIcon(view); 55575 return /* @__PURE__ */ (0, import_jsx_runtime314.jsx)( 55576 SidebarNavigationItem, 55577 { 55578 icon, 55579 to: (0, import_url19.addQueryArgs)(path, { 55580 activeView: slug 55581 }), 55582 "aria-current": isActive ? "true" : void 0, 55583 children: view.title 55584 }, 55585 view.slug 55586 ); 55587 }) }) }); 55588 } 55589 55590 // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs 55591 var import_jsx_runtime315 = __toESM(require_jsx_runtime(), 1); 55592 var SOURCE_TO_ICON = { 55593 user: comment_author_avatar_default, 55594 theme: layout_default, 55595 plugin: plugins_default, 55596 site: globe_default 55597 }; 55598 function DataviewsTemplatesSidebarContent2() { 55599 const authorSourceMap = (0, import_data76.useSelect)((select4) => { 55600 const templates = select4(import_core_data54.store).getEntityRecords( 55601 "postType", 55602 TEMPLATE_POST_TYPE, 55603 { per_page: -1 } 55604 ); 55605 if (!templates) { 55606 return {}; 55607 } 55608 const map = {}; 55609 for (const template of templates) { 55610 if (template.author_text && template.original_source && !map[template.author_text]) { 55611 map[template.author_text] = template.original_source; 55612 } 55613 } 55614 return map; 55615 }, []); 55616 const resolveIcon = (view) => { 55617 const source = authorSourceMap[view.slug]; 55618 return SOURCE_TO_ICON[source] ?? layout_default; 55619 }; 55620 return /* @__PURE__ */ (0, import_jsx_runtime315.jsx)( 55621 DataViewsSidebarContent, 55622 { 55623 postType: TEMPLATE_POST_TYPE, 55624 resolveIcon 55625 } 55626 ); 55627 } 55628 55629 // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.mjs 55630 var import_jsx_runtime316 = __toESM(require_jsx_runtime(), 1); 55631 function SidebarNavigationScreenTemplatesBrowse({ backPath }) { 55632 return /* @__PURE__ */ (0, import_jsx_runtime316.jsx)( 55633 SidebarNavigationScreen, 55634 { 55635 title: (0, import_i18n144.__)("Templates"), 55636 description: (0, import_i18n144.__)( 55637 "Create new templates, or reset any customizations made to the templates supplied by your theme." 55638 ), 55639 backPath, 55640 content: window?.__experimentalTemplateActivate ? /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(DataviewsTemplatesSidebarContent, {}) : /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(DataviewsTemplatesSidebarContent2, {}) 55641 } 55642 ); 55643 } 55644 55645 // packages/edit-site/build-module/components/page-templates/index.mjs 55646 var import_i18n150 = __toESM(require_i18n(), 1); 55647 var import_html_entities14 = __toESM(require_html_entities(), 1); 55648 var import_element184 = __toESM(require_element(), 1); 55649 var import_core_data59 = __toESM(require_core_data(), 1); 55650 var import_router34 = __toESM(require_router(), 1); 55651 var import_editor36 = __toESM(require_editor(), 1); 55652 var import_url22 = __toESM(require_url(), 1); 55653 var import_data80 = __toESM(require_data(), 1); 55654 var import_compose30 = __toESM(require_compose(), 1); 55655 var import_components153 = __toESM(require_components(), 1); 55656 var import_notices9 = __toESM(require_notices(), 1); 55657 55658 // packages/edit-site/build-module/components/add-new-template/index.mjs 55659 var import_components151 = __toESM(require_components(), 1); 55660 var import_html_entities12 = __toESM(require_html_entities(), 1); 55661 var import_element182 = __toESM(require_element(), 1); 55662 var import_data78 = __toESM(require_data(), 1); 55663 var import_core_data57 = __toESM(require_core_data(), 1); 55664 var import_compose29 = __toESM(require_compose(), 1); 55665 var import_i18n148 = __toESM(require_i18n(), 1); 55666 var import_notices8 = __toESM(require_notices(), 1); 55667 var import_router33 = __toESM(require_router(), 1); 55668 var import_dom34 = __toESM(require_dom(), 1); 55669 55670 // packages/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.mjs 55671 var import_element180 = __toESM(require_element(), 1); 55672 var import_i18n146 = __toESM(require_i18n(), 1); 55673 var import_components149 = __toESM(require_components(), 1); 55674 var import_core_data56 = __toESM(require_core_data(), 1); 55675 var import_html_entities11 = __toESM(require_html_entities(), 1); 55676 var import_compose28 = __toESM(require_compose(), 1); 55677 var import_dom33 = __toESM(require_dom(), 1); 55678 var import_url21 = __toESM(require_url(), 1); 55679 55680 // packages/edit-site/build-module/components/add-new-template/utils.mjs 55681 var import_data77 = __toESM(require_data(), 1); 55682 var import_core_data55 = __toESM(require_core_data(), 1); 55683 var import_html_entities10 = __toESM(require_html_entities(), 1); 55684 var import_element179 = __toESM(require_element(), 1); 55685 var import_i18n145 = __toESM(require_i18n(), 1); 55686 var import_url20 = __toESM(require_url(), 1); 55687 var EMPTY_OBJECT2 = {}; 55688 var getValueFromObjectPath2 = (object, path) => { 55689 let value = object; 55690 path.split(".").forEach((fieldName) => { 55691 value = value?.[fieldName]; 55692 }); 55693 return value; 55694 }; 55695 function prefixSlug(prefix2, slug) { 55696 return `$prefix2}-${(0, import_url20.safeDecodeURI)(slug)}`; 55697 } 55698 var mapToIHasNameAndId = (entities, path) => { 55699 return (entities || []).map((entity) => ({ 55700 ...entity, 55701 name: (0, import_html_entities10.decodeEntities)(getValueFromObjectPath2(entity, path)) 55702 })); 55703 }; 55704 var useExistingTemplates = () => { 55705 return (0, import_data77.useSelect)( 55706 (select4) => select4(import_core_data55.store).getEntityRecords( 55707 "postType", 55708 TEMPLATE_POST_TYPE, 55709 { 55710 per_page: -1 55711 } 55712 ), 55713 [] 55714 ); 55715 }; 55716 var useDefaultTemplateTypes = () => { 55717 return (0, import_data77.useSelect)( 55718 (select4) => select4(import_core_data55.store).getCurrentTheme()?.default_template_types || [], 55719 [] 55720 ); 55721 }; 55722 var usePublicPostTypes = () => { 55723 const postTypes = (0, import_data77.useSelect)( 55724 (select4) => select4(import_core_data55.store).getPostTypes({ per_page: -1 }), 55725 [] 55726 ); 55727 return (0, import_element179.useMemo)(() => { 55728 const excludedPostTypes = ["attachment"]; 55729 return postTypes?.filter( 55730 ({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug) 55731 ).sort((a2, b2) => { 55732 if (a2.slug === "post" || b2.slug === "post") { 55733 return 0; 55734 } 55735 return a2.name.localeCompare(b2.name); 55736 }); 55737 }, [postTypes]); 55738 }; 55739 var usePublicTaxonomies = () => { 55740 const taxonomies = (0, import_data77.useSelect)( 55741 (select4) => select4(import_core_data55.store).getTaxonomies({ per_page: -1 }), 55742 [] 55743 ); 55744 return (0, import_element179.useMemo)(() => { 55745 return taxonomies?.filter( 55746 ({ visibility }) => visibility?.publicly_queryable 55747 ); 55748 }, [taxonomies]); 55749 }; 55750 function usePostTypeArchiveMenuItems() { 55751 const publicPostTypes = usePublicPostTypes(); 55752 const postTypesWithArchives = (0, import_element179.useMemo)( 55753 () => publicPostTypes?.filter((postType2) => postType2.has_archive), 55754 [publicPostTypes] 55755 ); 55756 const existingTemplates = useExistingTemplates(); 55757 const postTypeLabels = (0, import_element179.useMemo)( 55758 () => publicPostTypes?.reduce((accumulator, { labels }) => { 55759 const singularName = labels.singular_name.toLowerCase(); 55760 accumulator[singularName] = (accumulator[singularName] || 0) + 1; 55761 return accumulator; 55762 }, {}), 55763 [publicPostTypes] 55764 ); 55765 const needsUniqueIdentifier = (0, import_element179.useCallback)( 55766 ({ labels, slug }) => { 55767 const singularName = labels.singular_name.toLowerCase(); 55768 return postTypeLabels[singularName] > 1 && singularName !== slug; 55769 }, 55770 [postTypeLabels] 55771 ); 55772 return (0, import_element179.useMemo)( 55773 () => postTypesWithArchives?.filter( 55774 (postType2) => !(existingTemplates || []).some( 55775 (existingTemplate) => existingTemplate.slug === "archive-" + postType2.slug 55776 ) 55777 ).map((postType2) => { 55778 let title; 55779 if (needsUniqueIdentifier(postType2)) { 55780 title = (0, import_i18n145.sprintf)( 55781 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". 55782 (0, import_i18n145.__)("Archive: %1$s (%2$s)"), 55783 postType2.labels.singular_name, 55784 postType2.slug 55785 ); 55786 } else { 55787 title = (0, import_i18n145.sprintf)( 55788 // translators: %s: Name of the post type e.g: "Post". 55789 (0, import_i18n145.__)("Archive: %s"), 55790 postType2.labels.singular_name 55791 ); 55792 } 55793 return { 55794 slug: "archive-" + postType2.slug, 55795 description: (0, import_i18n145.sprintf)( 55796 // translators: %s: Name of the post type e.g: "Post". 55797 (0, import_i18n145.__)( 55798 "Displays an archive with the latest posts of type: %s." 55799 ), 55800 postType2.labels.singular_name 55801 ), 55802 title, 55803 // `icon` is the `menu_icon` property of a post type. We 55804 // only handle `dashicons` for now, even if the `menu_icon` 55805 // also supports urls and svg as values. 55806 icon: typeof postType2.icon === "string" && postType2.icon.startsWith("dashicons-") ? postType2.icon.slice(10) : archive_default, 55807 templatePrefix: "archive" 55808 }; 55809 }) || [], 55810 [postTypesWithArchives, existingTemplates, needsUniqueIdentifier] 55811 ); 55812 } 55813 var usePostTypeMenuItems = (onClickMenuItem) => { 55814 const publicPostTypes = usePublicPostTypes(); 55815 const defaultTemplateTypes = useDefaultTemplateTypes(); 55816 const templateLabels = (0, import_element179.useMemo)( 55817 () => publicPostTypes?.reduce((accumulator, { labels }) => { 55818 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 55819 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 55820 return accumulator; 55821 }, {}), 55822 [publicPostTypes] 55823 ); 55824 const needsUniqueIdentifier = (0, import_element179.useCallback)( 55825 ({ labels, slug }) => { 55826 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 55827 return templateLabels[templateName] > 1 && templateName !== slug; 55828 }, 55829 [templateLabels] 55830 ); 55831 const templatePrefixes = (0, import_element179.useMemo)( 55832 () => publicPostTypes?.reduce((accumulator, { slug }) => { 55833 let suffix = slug; 55834 if (slug !== "page") { 55835 suffix = `single-$suffix}`; 55836 } 55837 accumulator[slug] = suffix; 55838 return accumulator; 55839 }, {}), 55840 [publicPostTypes] 55841 ); 55842 const postTypesInfo = useEntitiesInfo("postType", templatePrefixes); 55843 const menuItems = (publicPostTypes || []).reduce( 55844 (accumulator, postType2) => { 55845 const { slug, labels, icon } = postType2; 55846 const generalTemplateSlug = templatePrefixes[slug]; 55847 const defaultTemplateType = defaultTemplateTypes?.find( 55848 ({ slug: _slug }) => _slug === generalTemplateSlug 55849 ); 55850 const _needsUniqueIdentifier = needsUniqueIdentifier(postType2); 55851 let menuItemTitle = labels.template_name || (0, import_i18n145.sprintf)( 55852 // translators: %s: Name of the post type e.g: "Post". 55853 (0, import_i18n145.__)("Single item: %s"), 55854 labels.singular_name 55855 ); 55856 if (_needsUniqueIdentifier) { 55857 menuItemTitle = labels.template_name ? (0, import_i18n145.sprintf)( 55858 // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book". 55859 (0, import_i18n145._x)("%1$s (%2$s)", "post type menu label"), 55860 labels.template_name, 55861 slug 55862 ) : (0, import_i18n145.sprintf)( 55863 // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book". 55864 (0, import_i18n145._x)( 55865 "Single item: %1$s (%2$s)", 55866 "post type menu label" 55867 ), 55868 labels.singular_name, 55869 slug 55870 ); 55871 } 55872 const menuItem = defaultTemplateType ? { 55873 ...defaultTemplateType, 55874 templatePrefix: templatePrefixes[slug] 55875 } : { 55876 slug: generalTemplateSlug, 55877 title: menuItemTitle, 55878 description: (0, import_i18n145.sprintf)( 55879 // translators: %s: Name of the post type e.g: "Post". 55880 (0, import_i18n145.__)("Displays a single item: %s."), 55881 labels.singular_name 55882 ), 55883 // `icon` is the `menu_icon` property of a post type. We 55884 // only handle `dashicons` for now, even if the `menu_icon` 55885 // also supports urls and svg as values. 55886 icon: typeof icon === "string" && icon.startsWith("dashicons-") ? icon.slice(10) : post_default, 55887 templatePrefix: templatePrefixes[slug] 55888 }; 55889 const hasEntities = postTypesInfo?.[slug]?.hasEntities; 55890 if (hasEntities) { 55891 menuItem.onClick = (template) => { 55892 onClickMenuItem({ 55893 type: "postType", 55894 slug, 55895 config: { 55896 recordNamePath: "title.rendered", 55897 queryArgs: ({ search }) => { 55898 return { 55899 _fields: "id,title,slug,link", 55900 orderBy: search ? "relevance" : "modified", 55901 exclude: postTypesInfo[slug].existingEntitiesIds 55902 }; 55903 }, 55904 getSpecificTemplate: (suggestion) => { 55905 const templateSlug = prefixSlug( 55906 templatePrefixes[slug], 55907 suggestion.slug 55908 ); 55909 return { 55910 title: templateSlug, 55911 slug: templateSlug, 55912 templatePrefix: templatePrefixes[slug] 55913 }; 55914 } 55915 }, 55916 labels, 55917 template 55918 }); 55919 }; 55920 } 55921 if (hasEntities) { 55922 accumulator.push(menuItem); 55923 } 55924 return accumulator; 55925 }, 55926 [] 55927 ); 55928 const postTypesMenuItems = (0, import_element179.useMemo)( 55929 () => menuItems.reduce( 55930 (accumulator, postType2) => { 55931 const { slug } = postType2; 55932 let key = "postTypesMenuItems"; 55933 if (slug === "page") { 55934 key = "defaultPostTypesMenuItems"; 55935 } 55936 accumulator[key].push(postType2); 55937 return accumulator; 55938 }, 55939 { defaultPostTypesMenuItems: [], postTypesMenuItems: [] } 55940 ), 55941 [menuItems] 55942 ); 55943 return postTypesMenuItems; 55944 }; 55945 var useTaxonomiesMenuItems = (onClickMenuItem) => { 55946 const publicTaxonomies = usePublicTaxonomies(); 55947 const existingTemplates = useExistingTemplates(); 55948 const defaultTemplateTypes = useDefaultTemplateTypes(); 55949 const templatePrefixes = (0, import_element179.useMemo)( 55950 () => publicTaxonomies?.reduce((accumulator, { slug }) => { 55951 let suffix = slug; 55952 if (!["category", "post_tag"].includes(slug)) { 55953 suffix = `taxonomy-$suffix}`; 55954 } 55955 if (slug === "post_tag") { 55956 suffix = `tag`; 55957 } 55958 accumulator[slug] = suffix; 55959 return accumulator; 55960 }, {}), 55961 [publicTaxonomies] 55962 ); 55963 const taxonomyLabels = publicTaxonomies?.reduce( 55964 (accumulator, { labels }) => { 55965 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 55966 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 55967 return accumulator; 55968 }, 55969 {} 55970 ); 55971 const needsUniqueIdentifier = (labels, slug) => { 55972 if (["category", "post_tag"].includes(slug)) { 55973 return false; 55974 } 55975 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 55976 return taxonomyLabels[templateName] > 1 && templateName !== slug; 55977 }; 55978 const taxonomiesInfo = useEntitiesInfo("taxonomy", templatePrefixes); 55979 const existingTemplateSlugs = (existingTemplates || []).map( 55980 ({ slug }) => slug 55981 ); 55982 const menuItems = (publicTaxonomies || []).reduce( 55983 (accumulator, taxonomy) => { 55984 const { slug, labels } = taxonomy; 55985 const generalTemplateSlug = templatePrefixes[slug]; 55986 const defaultTemplateType = defaultTemplateTypes?.find( 55987 ({ slug: _slug }) => _slug === generalTemplateSlug 55988 ); 55989 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 55990 const _needsUniqueIdentifier = needsUniqueIdentifier( 55991 labels, 55992 slug 55993 ); 55994 let menuItemTitle = labels.template_name || labels.singular_name; 55995 if (_needsUniqueIdentifier) { 55996 menuItemTitle = labels.template_name ? (0, import_i18n145.sprintf)( 55997 // translators: 1: Name of the template e.g: "Products by Category". 2: Slug of the taxonomy e.g: "product_cat". 55998 (0, import_i18n145._x)("%1$s (%2$s)", "taxonomy template menu label"), 55999 labels.template_name, 56000 slug 56001 ) : (0, import_i18n145.sprintf)( 56002 // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat". 56003 (0, import_i18n145._x)("%1$s (%2$s)", "taxonomy menu label"), 56004 labels.singular_name, 56005 slug 56006 ); 56007 } 56008 const menuItem = defaultTemplateType ? { 56009 ...defaultTemplateType, 56010 templatePrefix: templatePrefixes[slug] 56011 } : { 56012 slug: generalTemplateSlug, 56013 title: menuItemTitle, 56014 description: (0, import_i18n145.sprintf)( 56015 // translators: %s: Name of the taxonomy e.g: "Product Categories". 56016 (0, import_i18n145.__)("Displays taxonomy: %s."), 56017 labels.singular_name 56018 ), 56019 icon: block_meta_default, 56020 templatePrefix: templatePrefixes[slug] 56021 }; 56022 const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; 56023 if (hasEntities) { 56024 menuItem.onClick = (template) => { 56025 onClickMenuItem({ 56026 type: "taxonomy", 56027 slug, 56028 config: { 56029 queryArgs: ({ search }) => { 56030 return { 56031 _fields: "id,name,slug,link", 56032 orderBy: search ? "name" : "count", 56033 exclude: taxonomiesInfo[slug].existingEntitiesIds 56034 }; 56035 }, 56036 getSpecificTemplate: (suggestion) => { 56037 const templateSlug = prefixSlug( 56038 templatePrefixes[slug], 56039 suggestion.slug 56040 ); 56041 return { 56042 title: templateSlug, 56043 slug: templateSlug, 56044 templatePrefix: templatePrefixes[slug] 56045 }; 56046 } 56047 }, 56048 labels, 56049 hasGeneralTemplate, 56050 template 56051 }); 56052 }; 56053 } 56054 if (!hasGeneralTemplate || hasEntities) { 56055 accumulator.push(menuItem); 56056 } 56057 return accumulator; 56058 }, 56059 [] 56060 ); 56061 const taxonomiesMenuItems = (0, import_element179.useMemo)( 56062 () => menuItems.reduce( 56063 (accumulator, taxonomy) => { 56064 const { slug } = taxonomy; 56065 let key = "taxonomiesMenuItems"; 56066 if (["category", "tag"].includes(slug)) { 56067 key = "defaultTaxonomiesMenuItems"; 56068 } 56069 accumulator[key].push(taxonomy); 56070 return accumulator; 56071 }, 56072 { defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] } 56073 ), 56074 [menuItems] 56075 ); 56076 return taxonomiesMenuItems; 56077 }; 56078 var USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: "author" }; 56079 var USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: "authors" } }; 56080 function useAuthorMenuItem(onClickMenuItem) { 56081 const existingTemplates = useExistingTemplates(); 56082 const defaultTemplateTypes = useDefaultTemplateTypes(); 56083 const authorInfo = useEntitiesInfo( 56084 "root", 56085 USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, 56086 USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS 56087 ); 56088 let authorMenuItem = defaultTemplateTypes?.find( 56089 ({ slug }) => slug === "author" 56090 ); 56091 if (!authorMenuItem) { 56092 authorMenuItem = { 56093 description: (0, import_i18n145.__)( 56094 "Displays latest posts written by a single author." 56095 ), 56096 slug: "author", 56097 title: "Author" 56098 }; 56099 } 56100 const hasGeneralTemplate = !!existingTemplates?.find( 56101 ({ slug }) => slug === "author" 56102 ); 56103 if (authorInfo.user?.hasEntities) { 56104 authorMenuItem = { ...authorMenuItem, templatePrefix: "author" }; 56105 authorMenuItem.onClick = (template) => { 56106 onClickMenuItem({ 56107 type: "root", 56108 slug: "user", 56109 config: { 56110 queryArgs: ({ search }) => { 56111 return { 56112 _fields: "id,name,slug,link", 56113 orderBy: search ? "name" : "registered_date", 56114 exclude: authorInfo.user.existingEntitiesIds, 56115 who: "authors" 56116 }; 56117 }, 56118 getSpecificTemplate: (suggestion) => { 56119 const templateSlug = prefixSlug( 56120 "author", 56121 suggestion.slug 56122 ); 56123 return { 56124 title: (0, import_i18n145.sprintf)( 56125 // translators: %s: Name of the author e.g: "Admin". 56126 (0, import_i18n145.__)("Author: %s"), 56127 suggestion.name 56128 ), 56129 slug: templateSlug, 56130 templatePrefix: "author" 56131 }; 56132 } 56133 }, 56134 labels: { 56135 singular_name: (0, import_i18n145.__)("Author"), 56136 search_items: (0, import_i18n145.__)("Search Authors"), 56137 not_found: (0, import_i18n145.__)("No authors found."), 56138 all_items: (0, import_i18n145.__)("All Authors") 56139 }, 56140 hasGeneralTemplate, 56141 template 56142 }); 56143 }; 56144 } 56145 if (!hasGeneralTemplate || authorInfo.user?.hasEntities) { 56146 return authorMenuItem; 56147 } 56148 } 56149 var useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT2) => { 56150 const entitiesHasRecords = (0, import_data77.useSelect)( 56151 (select4) => { 56152 return Object.keys(templatePrefixes || {}).reduce( 56153 (accumulator, slug) => { 56154 const records = select4(import_core_data55.store).getEntityRecords( 56155 entityName, 56156 slug, 56157 { 56158 per_page: 1, 56159 _fields: "id", 56160 context: "view", 56161 ...additionalQueryParameters[slug] 56162 } 56163 ); 56164 accumulator[slug] = records === null || records.length > 0; 56165 return accumulator; 56166 }, 56167 {} 56168 ); 56169 }, 56170 [templatePrefixes, entityName, additionalQueryParameters] 56171 ); 56172 const entitiesInfo = (0, import_element179.useMemo)(() => { 56173 return Object.keys(templatePrefixes || {}).reduce( 56174 (accumulator, slug) => { 56175 accumulator[slug] = { 56176 hasEntities: entitiesHasRecords[slug] 56177 }; 56178 return accumulator; 56179 }, 56180 {} 56181 ); 56182 }, [templatePrefixes, entitiesHasRecords]); 56183 return entitiesInfo; 56184 }; 56185 56186 // packages/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.mjs 56187 var import_jsx_runtime317 = __toESM(require_jsx_runtime(), 1); 56188 var EMPTY_ARRAY13 = []; 56189 function SuggestionListItem({ 56190 suggestion, 56191 search, 56192 onSelect, 56193 entityForSuggestions 56194 }) { 56195 const baseCssClass = "edit-site-custom-template-modal__suggestions_list__list-item"; 56196 return /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)( 56197 import_components149.Composite.Item, 56198 { 56199 render: /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56200 import_components149.Button, 56201 { 56202 __next40pxDefaultSize: true, 56203 role: "option", 56204 className: baseCssClass, 56205 onClick: () => onSelect( 56206 entityForSuggestions.config.getSpecificTemplate( 56207 suggestion 56208 ) 56209 ) 56210 } 56211 ), 56212 children: [ 56213 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56214 import_components149.__experimentalText, 56215 { 56216 size: "body", 56217 lineHeight: 1.53846153846, 56218 weight: 500, 56219 className: `$baseCssClass}__title`, 56220 children: /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56221 import_components149.TextHighlight, 56222 { 56223 text: (0, import_html_entities11.decodeEntities)(suggestion.name), 56224 highlight: search 56225 } 56226 ) 56227 } 56228 ), 56229 suggestion.link && /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56230 import_components149.__experimentalText, 56231 { 56232 size: "body", 56233 lineHeight: 1.53846153846, 56234 className: `$baseCssClass}__info`, 56235 children: (0, import_url21.safeDecodeURI)(suggestion.link) 56236 } 56237 ) 56238 ] 56239 } 56240 ); 56241 } 56242 function useSearchSuggestions(entityForSuggestions, search) { 56243 const { config: config2 } = entityForSuggestions; 56244 const query = (0, import_element180.useMemo)( 56245 () => ({ 56246 order: "asc", 56247 context: "view", 56248 search, 56249 per_page: search ? 20 : 10, 56250 ...config2.queryArgs(search) 56251 }), 56252 [search, config2] 56253 ); 56254 const { records: searchResults, hasResolved: searchHasResolved } = (0, import_core_data56.useEntityRecords)( 56255 entityForSuggestions.type, 56256 entityForSuggestions.slug, 56257 query 56258 ); 56259 const [suggestions, setSuggestions] = (0, import_element180.useState)(EMPTY_ARRAY13); 56260 (0, import_element180.useEffect)(() => { 56261 if (!searchHasResolved) { 56262 return; 56263 } 56264 let newSuggestions = EMPTY_ARRAY13; 56265 if (searchResults?.length) { 56266 newSuggestions = searchResults; 56267 if (config2.recordNamePath) { 56268 newSuggestions = mapToIHasNameAndId( 56269 newSuggestions, 56270 config2.recordNamePath 56271 ); 56272 } 56273 } 56274 setSuggestions(newSuggestions); 56275 }, [searchResults, searchHasResolved]); 56276 return suggestions; 56277 } 56278 function SuggestionList({ entityForSuggestions, onSelect }) { 56279 const [search, setSearch, debouncedSearch] = (0, import_compose28.useDebouncedInput)(); 56280 const suggestions = useSearchSuggestions( 56281 entityForSuggestions, 56282 debouncedSearch 56283 ); 56284 const { labels } = entityForSuggestions; 56285 const [showSearchControl, setShowSearchControl] = (0, import_element180.useState)(false); 56286 if (!showSearchControl && suggestions?.length > 9) { 56287 setShowSearchControl(true); 56288 } 56289 return /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)(import_jsx_runtime317.Fragment, { children: [ 56290 showSearchControl && /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56291 import_components149.SearchControl, 56292 { 56293 onChange: setSearch, 56294 value: search, 56295 label: labels.search_items, 56296 placeholder: labels.search_items 56297 } 56298 ), 56299 !!suggestions?.length && /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56300 import_components149.Composite, 56301 { 56302 orientation: "vertical", 56303 role: "listbox", 56304 className: "edit-site-custom-template-modal__suggestions_list", 56305 "aria-label": (0, import_i18n146.__)("Suggestions list"), 56306 children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56307 SuggestionListItem, 56308 { 56309 suggestion, 56310 search: debouncedSearch, 56311 onSelect, 56312 entityForSuggestions 56313 }, 56314 suggestion.slug 56315 )) 56316 } 56317 ), 56318 debouncedSearch && !suggestions?.length && /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56319 import_components149.__experimentalText, 56320 { 56321 as: "p", 56322 className: "edit-site-custom-template-modal__no-results", 56323 children: labels.not_found 56324 } 56325 ) 56326 ] }); 56327 } 56328 function AddCustomTemplateModalContent({ 56329 onSelect, 56330 entityForSuggestions, 56331 onBack, 56332 containerRef 56333 }) { 56334 const [showSearchEntities, setShowSearchEntities] = (0, import_element180.useState)(); 56335 (0, import_element180.useEffect)(() => { 56336 if (containerRef.current) { 56337 const [firstFocusable] = import_dom33.focus.focusable.find( 56338 containerRef.current 56339 ); 56340 firstFocusable?.focus(); 56341 } 56342 }, [showSearchEntities]); 56343 return /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)( 56344 import_components149.__experimentalVStack, 56345 { 56346 spacing: 4, 56347 className: "edit-site-custom-template-modal__contents-wrapper", 56348 alignment: "left", 56349 children: [ 56350 !showSearchEntities && /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)(import_jsx_runtime317.Fragment, { children: [ 56351 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(import_components149.__experimentalText, { as: "p", children: (0, import_i18n146.__)( 56352 "Select whether to create a single template for all items or a specific one." 56353 ) }), 56354 /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)( 56355 import_components149.Flex, 56356 { 56357 className: "edit-site-custom-template-modal__contents", 56358 gap: "4", 56359 align: "initial", 56360 children: [ 56361 /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)( 56362 import_components149.FlexItem, 56363 { 56364 isBlock: true, 56365 as: import_components149.Button, 56366 onClick: () => { 56367 const { 56368 slug, 56369 title, 56370 description, 56371 templatePrefix 56372 } = entityForSuggestions.template; 56373 onSelect({ 56374 slug, 56375 title, 56376 description, 56377 templatePrefix 56378 }); 56379 }, 56380 children: [ 56381 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56382 import_components149.__experimentalText, 56383 { 56384 as: "span", 56385 weight: 500, 56386 lineHeight: 1.53846153846, 56387 children: entityForSuggestions.labels.all_items 56388 } 56389 ), 56390 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56391 import_components149.__experimentalText, 56392 { 56393 as: "span", 56394 lineHeight: 1.53846153846, 56395 // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. 56396 children: (0, import_i18n146.__)("For all items") 56397 } 56398 ) 56399 ] 56400 } 56401 ), 56402 /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)( 56403 import_components149.FlexItem, 56404 { 56405 isBlock: true, 56406 as: import_components149.Button, 56407 onClick: () => { 56408 setShowSearchEntities(true); 56409 }, 56410 children: [ 56411 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56412 import_components149.__experimentalText, 56413 { 56414 as: "span", 56415 weight: 500, 56416 lineHeight: 1.53846153846, 56417 children: entityForSuggestions.labels.singular_name 56418 } 56419 ), 56420 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56421 import_components149.__experimentalText, 56422 { 56423 as: "span", 56424 lineHeight: 1.53846153846, 56425 // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. 56426 children: (0, import_i18n146.__)("For a specific item") 56427 } 56428 ) 56429 ] 56430 } 56431 ) 56432 ] 56433 } 56434 ), 56435 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(import_components149.Flex, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56436 import_components149.Button, 56437 { 56438 __next40pxDefaultSize: true, 56439 variant: "tertiary", 56440 onClick: onBack, 56441 children: (0, import_i18n146.__)("Back") 56442 } 56443 ) }) 56444 ] }), 56445 showSearchEntities && /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)(import_jsx_runtime317.Fragment, { children: [ 56446 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(import_components149.__experimentalText, { as: "p", children: (0, import_i18n146.__)( 56447 "This template will be used only for the specific item chosen." 56448 ) }), 56449 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56450 SuggestionList, 56451 { 56452 entityForSuggestions, 56453 onSelect 56454 } 56455 ), 56456 /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(import_components149.Flex, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime317.jsx)( 56457 import_components149.Button, 56458 { 56459 __next40pxDefaultSize: true, 56460 variant: "tertiary", 56461 onClick: () => { 56462 if (entityForSuggestions.hasGeneralTemplate) { 56463 onBack(); 56464 } else { 56465 setShowSearchEntities(false); 56466 } 56467 }, 56468 children: (0, import_i18n146.__)("Back") 56469 } 56470 ) }) 56471 ] }) 56472 ] 56473 } 56474 ); 56475 } 56476 var add_custom_template_modal_content_default = AddCustomTemplateModalContent; 56477 56478 // packages/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.mjs 56479 var import_element181 = __toESM(require_element(), 1); 56480 var import_i18n147 = __toESM(require_i18n(), 1); 56481 var import_components150 = __toESM(require_components(), 1); 56482 var import_jsx_runtime318 = __toESM(require_jsx_runtime(), 1); 56483 function AddCustomGenericTemplateModalContent({ createTemplate, onBack }) { 56484 const [title, setTitle] = (0, import_element181.useState)(""); 56485 const defaultTitle = (0, import_i18n147.__)("Custom Template"); 56486 const [isBusy, setIsBusy] = (0, import_element181.useState)(false); 56487 const inputRef = (0, import_element181.useRef)(); 56488 (0, import_element181.useEffect)(() => { 56489 if (inputRef.current) { 56490 inputRef.current.focus(); 56491 } 56492 }, []); 56493 async function onCreateTemplate(event) { 56494 event.preventDefault(); 56495 if (isBusy) { 56496 return; 56497 } 56498 setIsBusy(true); 56499 try { 56500 await createTemplate( 56501 { 56502 slug: paramCase(title || defaultTitle) || "wp-custom-template", 56503 title: title || defaultTitle 56504 }, 56505 false 56506 ); 56507 } finally { 56508 setIsBusy(false); 56509 } 56510 } 56511 return /* @__PURE__ */ (0, import_jsx_runtime318.jsx)("form", { onSubmit: onCreateTemplate, children: /* @__PURE__ */ (0, import_jsx_runtime318.jsxs)(import_components150.__experimentalVStack, { spacing: 6, children: [ 56512 /* @__PURE__ */ (0, import_jsx_runtime318.jsx)( 56513 import_components150.TextControl, 56514 { 56515 __next40pxDefaultSize: true, 56516 label: (0, import_i18n147.__)("Name"), 56517 value: title, 56518 onChange: setTitle, 56519 placeholder: defaultTitle, 56520 disabled: isBusy, 56521 ref: inputRef, 56522 help: (0, import_i18n147.__)( 56523 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 56524 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.' 56525 ) 56526 } 56527 ), 56528 /* @__PURE__ */ (0, import_jsx_runtime318.jsxs)( 56529 import_components150.__experimentalHStack, 56530 { 56531 className: "edit-site-custom-generic-template__modal-actions", 56532 justify: "right", 56533 children: [ 56534 /* @__PURE__ */ (0, import_jsx_runtime318.jsx)( 56535 import_components150.Button, 56536 { 56537 __next40pxDefaultSize: true, 56538 variant: "tertiary", 56539 onClick: onBack, 56540 children: (0, import_i18n147.__)("Back") 56541 } 56542 ), 56543 /* @__PURE__ */ (0, import_jsx_runtime318.jsx)( 56544 import_components150.Button, 56545 { 56546 __next40pxDefaultSize: true, 56547 variant: "primary", 56548 type: "submit", 56549 isBusy, 56550 "aria-disabled": isBusy, 56551 children: (0, import_i18n147.__)("Create") 56552 } 56553 ) 56554 ] 56555 } 56556 ) 56557 ] }) }); 56558 } 56559 var add_custom_generic_template_modal_content_default = AddCustomGenericTemplateModalContent; 56560 56561 // packages/edit-site/build-module/components/add-new-template/index.mjs 56562 var import_jsx_runtime319 = __toESM(require_jsx_runtime(), 1); 56563 var { useHistory: useHistory21 } = unlock(import_router33.privateApis); 56564 var DEFAULT_TEMPLATE_SLUGS = [ 56565 "front-page", 56566 "home", 56567 "single", 56568 "page", 56569 "index", 56570 "archive", 56571 "author", 56572 "category", 56573 "date", 56574 "tag", 56575 "search", 56576 "404" 56577 ]; 56578 var TEMPLATE_ICONS = { 56579 "front-page": home_default, 56580 home: verse_default, 56581 single: pin_default, 56582 page: page_default, 56583 archive: archive_default, 56584 search: search_default, 56585 404: not_found_default, 56586 index: list_default, 56587 category: category_default, 56588 author: comment_author_avatar_default, 56589 taxonomy: block_meta_default, 56590 date: calendar_default, 56591 tag: tag_default, 56592 attachment: media_default 56593 }; 56594 function TemplateListItem({ 56595 title, 56596 direction, 56597 className, 56598 description, 56599 icon, 56600 onClick, 56601 children 56602 }) { 56603 return /* @__PURE__ */ (0, import_jsx_runtime319.jsx)( 56604 import_components151.Button, 56605 { 56606 __next40pxDefaultSize: true, 56607 className, 56608 onClick, 56609 label: description, 56610 showTooltip: !!description, 56611 children: /* @__PURE__ */ (0, import_jsx_runtime319.jsxs)( 56612 import_components151.Flex, 56613 { 56614 as: "span", 56615 spacing: 2, 56616 align: "center", 56617 justify: "center", 56618 style: { width: "100%" }, 56619 direction, 56620 children: [ 56621 /* @__PURE__ */ (0, import_jsx_runtime319.jsx)("div", { className: "edit-site-add-new-template__template-icon", children: /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(import_components151.Icon, { icon }) }), 56622 /* @__PURE__ */ (0, import_jsx_runtime319.jsxs)( 56623 import_components151.__experimentalVStack, 56624 { 56625 className: "edit-site-add-new-template__template-name", 56626 alignment: "center", 56627 spacing: 0, 56628 children: [ 56629 /* @__PURE__ */ (0, import_jsx_runtime319.jsx)( 56630 import_components151.__experimentalText, 56631 { 56632 align: "center", 56633 weight: 500, 56634 lineHeight: 1.53846153846, 56635 children: title 56636 } 56637 ), 56638 children 56639 ] 56640 } 56641 ) 56642 ] 56643 } 56644 ) 56645 } 56646 ); 56647 } 56648 var modalContentMap = { 56649 templatesList: 1, 56650 customTemplate: 2, 56651 customGenericTemplate: 3 56652 }; 56653 function NewTemplateModal({ onClose }) { 56654 const [modalContent, setModalContent] = (0, import_element182.useState)( 56655 modalContentMap.templatesList 56656 ); 56657 const [entityForSuggestions, setEntityForSuggestions] = (0, import_element182.useState)({}); 56658 const [isSubmitting, setIsSubmitting] = (0, import_element182.useState)(false); 56659 const missingTemplates = useMissingTemplates( 56660 setEntityForSuggestions, 56661 () => setModalContent(modalContentMap.customTemplate) 56662 ); 56663 const history = useHistory21(); 56664 const { saveEntityRecord } = (0, import_data78.useDispatch)(import_core_data57.store); 56665 const { createErrorNotice, createSuccessNotice } = (0, import_data78.useDispatch)(import_notices8.store); 56666 const containerRef = (0, import_element182.useRef)(null); 56667 const isMobile = (0, import_compose29.useViewportMatch)("medium", "<"); 56668 const homeUrl = (0, import_data78.useSelect)((select4) => { 56669 return select4(import_core_data57.store).getEntityRecord("root", "__unstableBase")?.home; 56670 }, []); 56671 const TEMPLATE_SHORT_DESCRIPTIONS = { 56672 "front-page": homeUrl, 56673 date: (0, import_i18n148.sprintf)( 56674 // translators: %s: The homepage url. 56675 (0, import_i18n148.__)("E.g. %s"), 56676 homeUrl + "/" + (/* @__PURE__ */ new Date()).getFullYear() 56677 ) 56678 }; 56679 (0, import_element182.useEffect)(() => { 56680 if (containerRef.current && modalContent === modalContentMap.templatesList) { 56681 const [firstFocusable] = import_dom34.focus.focusable.find( 56682 containerRef.current 56683 ); 56684 firstFocusable?.focus(); 56685 } 56686 }, [modalContent]); 56687 async function createTemplate(template, isWPSuggestion = true) { 56688 if (isSubmitting) { 56689 return; 56690 } 56691 setIsSubmitting(true); 56692 try { 56693 const { title, description, slug } = template; 56694 const newTemplate = await saveEntityRecord( 56695 "postType", 56696 TEMPLATE_POST_TYPE, 56697 { 56698 description, 56699 // Slugs need to be strings, so this is for template `404` 56700 slug: slug.toString(), 56701 status: "publish", 56702 title, 56703 // This adds a post meta field in template that is part of `is_custom` value calculation. 56704 meta: { 56705 is_wp_suggestion: isWPSuggestion 56706 } 56707 }, 56708 { throwOnError: true } 56709 ); 56710 history.navigate( 56711 `/$TEMPLATE_POST_TYPE}/$newTemplate.id}?canvas=edit` 56712 ); 56713 createSuccessNotice( 56714 (0, import_i18n148.sprintf)( 56715 // translators: %s: Title of the created post or template, e.g: "Hello world". 56716 (0, import_i18n148.__)('"%s" successfully created.'), 56717 (0, import_html_entities12.decodeEntities)(newTemplate.title?.rendered || title) || (0, import_i18n148.__)("(no title)") 56718 ), 56719 { 56720 type: "snackbar" 56721 } 56722 ); 56723 } catch (error2) { 56724 const errorMessage = error2.message && error2.code !== "unknown_error" ? error2.message : (0, import_i18n148.__)("An error occurred while creating the template."); 56725 createErrorNotice(errorMessage, { 56726 type: "snackbar" 56727 }); 56728 } finally { 56729 setIsSubmitting(false); 56730 } 56731 } 56732 const onModalClose = () => { 56733 onClose(); 56734 setModalContent(modalContentMap.templatesList); 56735 }; 56736 let modalTitle = (0, import_i18n148.__)("Add template"); 56737 if (modalContent === modalContentMap.customTemplate) { 56738 modalTitle = (0, import_i18n148.sprintf)( 56739 // translators: %s: Name of the post type e.g: "Post". 56740 (0, import_i18n148.__)("Add template: %s"), 56741 entityForSuggestions.labels.singular_name 56742 ); 56743 } else if (modalContent === modalContentMap.customGenericTemplate) { 56744 modalTitle = (0, import_i18n148.__)("Create custom template"); 56745 } 56746 return /* @__PURE__ */ (0, import_jsx_runtime319.jsxs)( 56747 import_components151.Modal, 56748 { 56749 title: modalTitle, 56750 className: clsx_default("edit-site-add-new-template__modal", { 56751 "edit-site-add-new-template__modal_template_list": modalContent === modalContentMap.templatesList, 56752 "edit-site-custom-template-modal": modalContent === modalContentMap.customTemplate 56753 }), 56754 onRequestClose: onModalClose, 56755 overlayClassName: modalContent === modalContentMap.customGenericTemplate ? "edit-site-custom-generic-template__modal" : void 0, 56756 ref: containerRef, 56757 children: [ 56758 modalContent === modalContentMap.templatesList && /* @__PURE__ */ (0, import_jsx_runtime319.jsxs)( 56759 import_components151.__experimentalGrid, 56760 { 56761 columns: isMobile ? 2 : 3, 56762 gap: 4, 56763 align: "flex-start", 56764 justify: "center", 56765 className: "edit-site-add-new-template__template-list__contents", 56766 children: [ 56767 /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(import_components151.Flex, { className: "edit-site-add-new-template__template-list__prompt", children: (0, import_i18n148.__)( 56768 "Select what the new template should apply to:" 56769 ) }), 56770 missingTemplates.map((template) => { 56771 const { title, slug, onClick } = template; 56772 return /* @__PURE__ */ (0, import_jsx_runtime319.jsx)( 56773 TemplateListItem, 56774 { 56775 title, 56776 direction: "column", 56777 className: "edit-site-add-new-template__template-button", 56778 description: TEMPLATE_SHORT_DESCRIPTIONS[slug], 56779 icon: TEMPLATE_ICONS[slug] || layout_default, 56780 onClick: () => onClick ? onClick(template) : createTemplate(template) 56781 }, 56782 slug 56783 ); 56784 }), 56785 /* @__PURE__ */ (0, import_jsx_runtime319.jsx)( 56786 TemplateListItem, 56787 { 56788 title: (0, import_i18n148.__)("Custom template"), 56789 direction: "row", 56790 className: "edit-site-add-new-template__custom-template-button", 56791 icon: pencil_default, 56792 onClick: () => setModalContent( 56793 modalContentMap.customGenericTemplate 56794 ), 56795 children: /* @__PURE__ */ (0, import_jsx_runtime319.jsx)( 56796 import_components151.__experimentalText, 56797 { 56798 lineHeight: 1.53846153846, 56799 children: (0, import_i18n148.__)( 56800 "A custom template can be manually applied to any post or page." 56801 ) 56802 } 56803 ) 56804 } 56805 ) 56806 ] 56807 } 56808 ), 56809 modalContent === modalContentMap.customTemplate && /* @__PURE__ */ (0, import_jsx_runtime319.jsx)( 56810 add_custom_template_modal_content_default, 56811 { 56812 onSelect: createTemplate, 56813 entityForSuggestions, 56814 onBack: () => setModalContent(modalContentMap.templatesList), 56815 containerRef 56816 } 56817 ), 56818 modalContent === modalContentMap.customGenericTemplate && /* @__PURE__ */ (0, import_jsx_runtime319.jsx)( 56819 add_custom_generic_template_modal_content_default, 56820 { 56821 createTemplate, 56822 onBack: () => setModalContent(modalContentMap.templatesList) 56823 } 56824 ) 56825 ] 56826 } 56827 ); 56828 } 56829 function NewTemplate() { 56830 const [showModal, setShowModal] = (0, import_element182.useState)(false); 56831 const { postType: postType2 } = (0, import_data78.useSelect)((select4) => { 56832 const { getPostType: getPostType2 } = select4(import_core_data57.store); 56833 return { 56834 postType: getPostType2(TEMPLATE_POST_TYPE) 56835 }; 56836 }, []); 56837 if (!postType2) { 56838 return null; 56839 } 56840 return /* @__PURE__ */ (0, import_jsx_runtime319.jsxs)(import_jsx_runtime319.Fragment, { children: [ 56841 /* @__PURE__ */ (0, import_jsx_runtime319.jsx)( 56842 import_components151.Button, 56843 { 56844 variant: "primary", 56845 onClick: () => setShowModal(true), 56846 label: postType2.labels.add_new_item, 56847 size: "compact", 56848 __next40pxDefaultSize: true, 56849 children: postType2.labels.add_new_item 56850 } 56851 ), 56852 showModal && /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(NewTemplateModal, { onClose: () => setShowModal(false) }) 56853 ] }); 56854 } 56855 function useMissingTemplates(setEntityForSuggestions, onClick) { 56856 const defaultTemplateTypes = useDefaultTemplateTypes(); 56857 const missingDefaultTemplates = (defaultTemplateTypes || []).filter( 56858 (template) => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) 56859 ); 56860 const onClickMenuItem = (_entityForSuggestions) => { 56861 onClick?.(); 56862 setEntityForSuggestions(_entityForSuggestions); 56863 }; 56864 const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates]; 56865 const { defaultTaxonomiesMenuItems, taxonomiesMenuItems } = useTaxonomiesMenuItems(onClickMenuItem); 56866 const { defaultPostTypesMenuItems, postTypesMenuItems } = usePostTypeMenuItems(onClickMenuItem); 56867 const authorMenuItem = useAuthorMenuItem(onClickMenuItem); 56868 [ 56869 ...defaultTaxonomiesMenuItems, 56870 ...defaultPostTypesMenuItems, 56871 authorMenuItem 56872 ].forEach((menuItem) => { 56873 if (!menuItem) { 56874 return; 56875 } 56876 const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex( 56877 (template) => template.slug === menuItem.slug 56878 ); 56879 if (matchIndex > -1) { 56880 enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem; 56881 } else { 56882 enhancedMissingDefaultTemplateTypes.push(menuItem); 56883 } 56884 }); 56885 enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => { 56886 return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug); 56887 }); 56888 const missingTemplates = [ 56889 ...enhancedMissingDefaultTemplateTypes, 56890 ...usePostTypeArchiveMenuItems(), 56891 ...postTypesMenuItems, 56892 ...taxonomiesMenuItems 56893 ]; 56894 return missingTemplates; 56895 } 56896 var add_new_template_default = (0, import_element182.memo)(NewTemplate); 56897 56898 // packages/edit-site/build-module/components/page-templates/fields.mjs 56899 var import_components152 = __toESM(require_components(), 1); 56900 var import_i18n149 = __toESM(require_i18n(), 1); 56901 var import_element183 = __toESM(require_element(), 1); 56902 var import_html_entities13 = __toESM(require_html_entities(), 1); 56903 var import_blocks13 = __toESM(require_blocks(), 1); 56904 var import_block_editor27 = __toESM(require_block_editor(), 1); 56905 var import_editor35 = __toESM(require_editor(), 1); 56906 var import_core_data58 = __toESM(require_core_data(), 1); 56907 var import_data79 = __toESM(require_data(), 1); 56908 var import_jsx_runtime320 = __toESM(require_jsx_runtime(), 1); 56909 var { Badge: WCBadge3 } = unlock(import_components152.privateApis); 56910 var { useEntityRecordsWithPermissions } = unlock(import_core_data58.privateApis); 56911 var { useStyle: useStyle5 } = unlock(import_editor35.privateApis); 56912 function useAllDefaultTemplateTypes() { 56913 const defaultTemplateTypes = useDefaultTemplateTypes(); 56914 const { records: staticRecords } = useEntityRecordsWithPermissions( 56915 "root", 56916 "registeredTemplate" 56917 ); 56918 return [ 56919 ...defaultTemplateTypes, 56920 ...staticRecords?.filter((record) => !record.is_custom).map((record) => { 56921 return { 56922 slug: record.slug, 56923 title: record.title.rendered, 56924 description: record.description 56925 }; 56926 }) 56927 ]; 56928 } 56929 function PreviewField2({ item }) { 56930 const settings2 = usePatternSettings(); 56931 const backgroundColor = useStyle5("color.background") ?? "white"; 56932 const blocks = (0, import_element183.useMemo)(() => { 56933 return (0, import_blocks13.parse)(item.content.raw); 56934 }, [item.content.raw]); 56935 const isEmpty3 = !blocks?.length; 56936 return /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(import_editor35.EditorProvider, { post: item, settings: settings2, children: /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)( 56937 "div", 56938 { 56939 className: "page-templates-preview-field", 56940 style: { backgroundColor }, 56941 children: [ 56942 isEmpty3 && (0, import_i18n149.__)("Empty template"), 56943 !isEmpty3 && /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(import_block_editor27.BlockPreview.Async, { children: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(import_block_editor27.BlockPreview, { blocks }) }) 56944 ] 56945 } 56946 ) }); 56947 } 56948 var previewField2 = { 56949 label: (0, import_i18n149.__)("Preview"), 56950 id: "preview", 56951 render: PreviewField2, 56952 enableSorting: false 56953 }; 56954 var descriptionField = { 56955 label: (0, import_i18n149.__)("Description"), 56956 id: "description", 56957 render: window?.__experimentalTemplateActivate ? function RenderDescription({ item }) { 56958 const defaultTemplateTypes = useAllDefaultTemplateTypes(); 56959 const defaultTemplateType = defaultTemplateTypes.find( 56960 (type) => type.slug === item.slug 56961 ); 56962 return item.description ? (0, import_html_entities13.decodeEntities)(item.description) : defaultTemplateType?.description; 56963 } : ({ item }) => { 56964 return item.description && (0, import_html_entities13.decodeEntities)(item.description); 56965 }, 56966 enableSorting: false, 56967 enableGlobalSearch: true 56968 }; 56969 function AuthorField2({ item }) { 56970 const [isImageLoaded, setIsImageLoaded] = (0, import_element183.useState)(false); 56971 const { text, icon, imageUrl } = useAddedBy(item.type, item.id); 56972 return /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)(import_components152.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 56973 imageUrl && /* @__PURE__ */ (0, import_jsx_runtime320.jsx)( 56974 "div", 56975 { 56976 className: clsx_default("fields-controls__author-avatar", { 56977 "is-loaded": isImageLoaded 56978 }), 56979 children: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)( 56980 "img", 56981 { 56982 onLoad: () => setIsImageLoaded(true), 56983 alt: "", 56984 src: imageUrl 56985 } 56986 ) 56987 } 56988 ), 56989 !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime320.jsx)("div", { className: "fields-controls__author-icon", children: /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(import_components152.Icon, { icon }) }), 56990 /* @__PURE__ */ (0, import_jsx_runtime320.jsx)("span", { className: "fields-controls__author-name", children: text }) 56991 ] }); 56992 } 56993 var authorField = { 56994 label: (0, import_i18n149.__)("Author"), 56995 id: "author", 56996 getValue: ({ item }) => item.author_text ?? item.author, 56997 render: AuthorField2 56998 }; 56999 var activeField = { 57000 label: (0, import_i18n149.__)("Status"), 57001 id: "active", 57002 type: "boolean", 57003 getValue: ({ item }) => item._isActive, 57004 render: function Render({ item }) { 57005 const activeLabel = item._isCustom ? (0, import_i18n149._x)("Active when used", "template") : (0, import_i18n149._x)("Active", "template"); 57006 const activeIntent = item._isCustom ? "info" : "success"; 57007 const isActive = item._isActive; 57008 return /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(WCBadge3, { intent: isActive ? activeIntent : "default", children: isActive ? activeLabel : (0, import_i18n149._x)("Inactive", "template") }); 57009 } 57010 }; 57011 var useThemeField = () => { 57012 const activeTheme = (0, import_data79.useSelect)( 57013 (select4) => select4(import_core_data58.store).getCurrentTheme() 57014 ); 57015 return (0, import_element183.useMemo)( 57016 () => ({ 57017 label: (0, import_i18n149.__)("Compatible Theme"), 57018 id: "theme", 57019 getValue: ({ item }) => item.theme, 57020 render: function Render3({ item }) { 57021 if (item.theme === activeTheme.stylesheet) { 57022 return /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(WCBadge3, { intent: "success", children: item.theme }); 57023 } 57024 return /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(WCBadge3, { intent: "error", children: item.theme }); 57025 } 57026 }), 57027 [activeTheme] 57028 ); 57029 }; 57030 var slugField = { 57031 label: (0, import_i18n149.__)("Template Type"), 57032 id: "slug", 57033 getValue: ({ item }) => item.slug, 57034 render: function Render2({ item }) { 57035 const defaultTemplateTypes = useAllDefaultTemplateTypes(); 57036 const defaultTemplateType = defaultTemplateTypes.find( 57037 (type) => type.slug === item.slug 57038 ); 57039 return defaultTemplateType?.title || (0, import_i18n149._x)("Custom", "template type"); 57040 } 57041 }; 57042 57043 // packages/edit-site/build-module/components/page-templates/view-utils.mjs 57044 var defaultLayouts = { 57045 table: { 57046 showMedia: false 57047 }, 57048 grid: { 57049 showMedia: true 57050 }, 57051 list: { 57052 showMedia: false 57053 } 57054 }; 57055 var DEFAULT_VIEW = { 57056 type: "grid", 57057 perPage: 20, 57058 sort: { 57059 field: "title", 57060 direction: "asc" 57061 }, 57062 titleField: "title", 57063 descriptionField: "description", 57064 mediaField: "preview", 57065 fields: ["author", "active", "slug", "theme"], 57066 filters: [], 57067 ...defaultLayouts.grid 57068 }; 57069 function getActiveViewOverridesForTab(activeView) { 57070 if (activeView === "user") { 57071 return { 57072 sort: { field: "date", direction: "desc" } 57073 }; 57074 } 57075 if (activeView === "active") { 57076 return {}; 57077 } 57078 return { 57079 filters: [ 57080 { 57081 field: "author", 57082 operator: "is", 57083 value: activeView, 57084 isLocked: true 57085 } 57086 ] 57087 }; 57088 } 57089 57090 // packages/edit-site/build-module/components/page-templates/index.mjs 57091 var import_jsx_runtime321 = __toESM(require_jsx_runtime(), 1); 57092 var { usePostActions: usePostActions2, usePostFields, templateTitleField } = unlock(import_editor36.privateApis); 57093 var { useHistory: useHistory22, useLocation: useLocation29 } = unlock(import_router34.privateApis); 57094 var { useEntityRecordsWithPermissions: useEntityRecordsWithPermissions2 } = unlock(import_core_data59.privateApis); 57095 function PageTemplates() { 57096 const { path, query } = useLocation29(); 57097 const { activeView = "active", postId } = query; 57098 const [selection, setSelection] = (0, import_element184.useState)([postId]); 57099 const [selectedRegisteredTemplate, setSelectedRegisteredTemplate] = (0, import_element184.useState)(false); 57100 const defaultView = DEFAULT_VIEW; 57101 const activeViewOverrides = (0, import_element184.useMemo)( 57102 () => getActiveViewOverridesForTab(activeView), 57103 [activeView] 57104 ); 57105 const { view, updateView, isModified, resetToDefault } = useView({ 57106 kind: "postType", 57107 name: TEMPLATE_POST_TYPE, 57108 slug: "default", 57109 defaultView, 57110 activeViewOverrides, 57111 queryParams: { 57112 page: query.pageNumber, 57113 search: query.search 57114 }, 57115 onChangeQueryParams: (newQueryParams) => { 57116 history.navigate( 57117 (0, import_url22.addQueryArgs)(path, { 57118 ...query, 57119 pageNumber: newQueryParams.page, 57120 search: newQueryParams.search || void 0 57121 }) 57122 ); 57123 } 57124 }); 57125 const { activeTemplatesOption, activeTheme, defaultTemplateTypes } = (0, import_data80.useSelect)((select4) => { 57126 const { getEntityRecord, getCurrentTheme } = select4(import_core_data59.store); 57127 return { 57128 activeTemplatesOption: getEntityRecord("root", "site")?.active_templates, 57129 activeTheme: getCurrentTheme(), 57130 defaultTemplateTypes: select4(import_core_data59.store).getCurrentTheme()?.default_template_types 57131 }; 57132 }); 57133 const { records: userRecords, isResolving: isLoadingUserRecords } = useEntityRecordsWithPermissions2("postType", TEMPLATE_POST_TYPE, { 57134 per_page: -1, 57135 combinedTemplates: false 57136 }); 57137 const { records: staticRecords, isResolving: isLoadingStaticData } = useEntityRecordsWithPermissions2("root", "registeredTemplate", { 57138 // This should not be needed, the endpoint returns all registered 57139 // templates, but it's not possible right now to turn off pagination 57140 // for entity configs. 57141 per_page: -1 57142 }); 57143 const activeTemplates = (0, import_element184.useMemo)(() => { 57144 const _active = [...staticRecords]; 57145 if (activeTemplatesOption) { 57146 for (const activeSlug in activeTemplatesOption) { 57147 const activeId = activeTemplatesOption[activeSlug]; 57148 const template = userRecords.find( 57149 (userRecord) => userRecord.id === activeId && userRecord.theme === activeTheme.stylesheet 57150 ); 57151 if (template) { 57152 const index2 = _active.findIndex( 57153 ({ slug }) => slug === template.slug 57154 ); 57155 if (index2 !== -1) { 57156 _active[index2] = template; 57157 } else { 57158 _active.push(template); 57159 } 57160 } 57161 } 57162 } 57163 return _active; 57164 }, [userRecords, staticRecords, activeTemplatesOption, activeTheme]); 57165 let isLoadingData; 57166 if (activeView === "active") { 57167 isLoadingData = isLoadingUserRecords || isLoadingStaticData; 57168 } else if (activeView === "user") { 57169 isLoadingData = isLoadingUserRecords; 57170 } else { 57171 isLoadingData = isLoadingStaticData; 57172 } 57173 const records = (0, import_element184.useMemo)(() => { 57174 function isCustom(record) { 57175 return record.is_custom ?? // For user templates it's custom if the is_wp_suggestion meta 57176 // field is not set and the slug is not found in the default 57177 // template types. 57178 (!record.meta?.is_wp_suggestion && !defaultTemplateTypes.some( 57179 (type) => type.slug === record.slug 57180 )); 57181 } 57182 let _records; 57183 if (activeView === "active") { 57184 _records = activeTemplates.filter( 57185 (record) => !isCustom(record) 57186 ); 57187 } else if (activeView === "user") { 57188 _records = userRecords; 57189 } else { 57190 _records = staticRecords; 57191 } 57192 return _records.map((record) => ({ 57193 ...record, 57194 _isActive: activeTemplates.some( 57195 (template) => template.id === record.id 57196 ), 57197 _isCustom: isCustom(record) 57198 })); 57199 }, [ 57200 activeTemplates, 57201 defaultTemplateTypes, 57202 userRecords, 57203 staticRecords, 57204 activeView 57205 ]); 57206 const users = (0, import_data80.useSelect)( 57207 (select4) => { 57208 const { getUser } = select4(import_core_data59.store); 57209 return records.reduce((acc, record) => { 57210 if (record.author_text) { 57211 if (!acc[record.author_text]) { 57212 acc[record.author_text] = record.author_text; 57213 } 57214 } else if (record.author) { 57215 if (!acc[record.author]) { 57216 acc[record.author] = getUser(record.author); 57217 } 57218 } 57219 return acc; 57220 }, {}); 57221 }, 57222 [records] 57223 ); 57224 const history = useHistory22(); 57225 const onChangeSelection = (0, import_element184.useCallback)( 57226 (items) => { 57227 setSelection(items); 57228 if (view?.type === "list") { 57229 history.navigate( 57230 (0, import_url22.addQueryArgs)(path, { 57231 postId: items.length === 1 ? items[0] : void 0 57232 }) 57233 ); 57234 } 57235 }, 57236 [history, path, view?.type] 57237 ); 57238 const postTypeFields = usePostFields({ 57239 postType: TEMPLATE_POST_TYPE 57240 }); 57241 const dateField = postTypeFields.find((field) => field.id === "date"); 57242 const themeField = useThemeField(); 57243 const fields2 = (0, import_element184.useMemo)(() => { 57244 const _fields = [ 57245 previewField2, 57246 templateTitleField, 57247 descriptionField, 57248 activeField, 57249 slugField 57250 ]; 57251 if (activeView === "user") { 57252 _fields.push(themeField); 57253 if (dateField) { 57254 _fields.push(dateField); 57255 } 57256 } 57257 const elements2 = []; 57258 for (const author in users) { 57259 elements2.push({ 57260 value: users[author]?.id ?? author, 57261 label: users[author]?.name ?? author 57262 }); 57263 } 57264 _fields.push({ 57265 ...authorField, 57266 elements: elements2 57267 }); 57268 return _fields; 57269 }, [users, activeView, themeField, dateField]); 57270 const { data, paginationInfo } = (0, import_element184.useMemo)(() => { 57271 return filterSortAndPaginate(records, view, fields2); 57272 }, [records, view, fields2]); 57273 const { createSuccessNotice } = (0, import_data80.useDispatch)(import_notices9.store); 57274 const onActionPerformed = (0, import_element184.useCallback)( 57275 (actionId, items) => { 57276 switch (actionId) { 57277 case "duplicate-post": 57278 { 57279 const newItem = items[0]; 57280 const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered; 57281 history.navigate(`/template?activeView=user`); 57282 createSuccessNotice( 57283 (0, import_i18n150.sprintf)( 57284 // translators: %s: Title of the created post or template, e.g: "Hello world". 57285 (0, import_i18n150.__)('"%s" successfully created.'), 57286 (0, import_html_entities14.decodeEntities)(_title) || (0, import_i18n150.__)("(no title)") 57287 ), 57288 { 57289 type: "snackbar", 57290 id: "duplicate-post-action", 57291 actions: [ 57292 { 57293 label: (0, import_i18n150.__)("Edit"), 57294 onClick: () => { 57295 history.navigate( 57296 `/$newItem.type}/$newItem.id}?canvas=edit` 57297 ); 57298 } 57299 } 57300 ] 57301 } 57302 ); 57303 } 57304 break; 57305 } 57306 }, 57307 [history, createSuccessNotice] 57308 ); 57309 const postTypeActions = usePostActions2({ 57310 postType: TEMPLATE_POST_TYPE, 57311 context: "list", 57312 onActionPerformed 57313 }); 57314 const editAction = useEditPostAction(); 57315 const setActiveTemplateAction = useSetActiveTemplateAction(); 57316 const actions = (0, import_element184.useMemo)( 57317 () => activeView === "user" ? [setActiveTemplateAction, editAction, ...postTypeActions] : [setActiveTemplateAction, ...postTypeActions], 57318 [postTypeActions, setActiveTemplateAction, editAction, activeView] 57319 ); 57320 const onChangeView = (0, import_compose30.useEvent)((newView) => { 57321 updateView(newView); 57322 if (newView.type !== view.type) { 57323 history.invalidate(); 57324 } 57325 }); 57326 const duplicateAction = actions.find( 57327 (action) => action.id === "duplicate-post" 57328 ); 57329 return /* @__PURE__ */ (0, import_jsx_runtime321.jsxs)( 57330 page_default2, 57331 { 57332 className: "edit-site-page-templates", 57333 title: (0, import_i18n150.__)("Templates"), 57334 headingLevel: 2, 57335 actions: /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(add_new_template_default, {}), 57336 children: [ 57337 /* @__PURE__ */ (0, import_jsx_runtime321.jsx)( 57338 dataviews_default, 57339 { 57340 paginationInfo, 57341 fields: fields2, 57342 actions, 57343 data, 57344 isLoading: isLoadingData, 57345 view, 57346 onChangeView, 57347 onChangeSelection, 57348 isItemClickable: () => true, 57349 onClickItem: (item) => { 57350 if (typeof item.id === "string") { 57351 setSelectedRegisteredTemplate(item); 57352 } else { 57353 history.navigate( 57354 `/$item.type}/$item.id}?canvas=edit` 57355 ); 57356 } 57357 }, 57358 selection, 57359 defaultLayouts, 57360 onReset: isModified ? () => { 57361 resetToDefault(); 57362 history.invalidate(); 57363 } : false 57364 }, 57365 activeView 57366 ), 57367 selectedRegisteredTemplate && duplicateAction && /* @__PURE__ */ (0, import_jsx_runtime321.jsx)( 57368 import_components153.Modal, 57369 { 57370 title: (0, import_i18n150.__)("Duplicate"), 57371 onRequestClose: () => setSelectedRegisteredTemplate(), 57372 size: "small", 57373 children: /* @__PURE__ */ (0, import_jsx_runtime321.jsx)( 57374 duplicateAction.RenderModal, 57375 { 57376 items: [selectedRegisteredTemplate], 57377 closeModal: () => setSelectedRegisteredTemplate() 57378 } 57379 ) 57380 } 57381 ) 57382 ] 57383 } 57384 ); 57385 } 57386 57387 // packages/edit-site/build-module/components/page-templates/index-legacy.mjs 57388 var import_i18n155 = __toESM(require_i18n(), 1); 57389 var import_element189 = __toESM(require_element(), 1); 57390 var import_core_data63 = __toESM(require_core_data(), 1); 57391 var import_router36 = __toESM(require_router(), 1); 57392 var import_editor37 = __toESM(require_editor(), 1); 57393 var import_url25 = __toESM(require_url(), 1); 57394 var import_compose33 = __toESM(require_compose(), 1); 57395 57396 // packages/edit-site/build-module/components/add-new-template-legacy/index.mjs 57397 var import_components156 = __toESM(require_components(), 1); 57398 var import_html_entities17 = __toESM(require_html_entities(), 1); 57399 var import_element188 = __toESM(require_element(), 1); 57400 var import_data82 = __toESM(require_data(), 1); 57401 var import_core_data62 = __toESM(require_core_data(), 1); 57402 var import_compose32 = __toESM(require_compose(), 1); 57403 var import_i18n154 = __toESM(require_i18n(), 1); 57404 var import_notices10 = __toESM(require_notices(), 1); 57405 var import_router35 = __toESM(require_router(), 1); 57406 var import_dom36 = __toESM(require_dom(), 1); 57407 57408 // packages/edit-site/build-module/components/add-new-template-legacy/add-custom-template-modal-content.mjs 57409 var import_element186 = __toESM(require_element(), 1); 57410 var import_i18n152 = __toESM(require_i18n(), 1); 57411 var import_components154 = __toESM(require_components(), 1); 57412 var import_core_data61 = __toESM(require_core_data(), 1); 57413 var import_html_entities16 = __toESM(require_html_entities(), 1); 57414 var import_compose31 = __toESM(require_compose(), 1); 57415 var import_dom35 = __toESM(require_dom(), 1); 57416 var import_url24 = __toESM(require_url(), 1); 57417 57418 // packages/edit-site/build-module/components/add-new-template-legacy/utils.mjs 57419 var import_data81 = __toESM(require_data(), 1); 57420 var import_core_data60 = __toESM(require_core_data(), 1); 57421 var import_html_entities15 = __toESM(require_html_entities(), 1); 57422 var import_element185 = __toESM(require_element(), 1); 57423 var import_i18n151 = __toESM(require_i18n(), 1); 57424 var import_url23 = __toESM(require_url(), 1); 57425 var EMPTY_OBJECT3 = {}; 57426 var getValueFromObjectPath3 = (object, path) => { 57427 let value = object; 57428 path.split(".").forEach((fieldName) => { 57429 value = value?.[fieldName]; 57430 }); 57431 return value; 57432 }; 57433 function prefixSlug2(prefix2, slug) { 57434 return `$prefix2}-${(0, import_url23.safeDecodeURI)(slug)}`; 57435 } 57436 var mapToIHasNameAndId2 = (entities, path) => { 57437 return (entities || []).map((entity) => ({ 57438 ...entity, 57439 name: (0, import_html_entities15.decodeEntities)(getValueFromObjectPath3(entity, path)) 57440 })); 57441 }; 57442 var useExistingTemplates2 = () => { 57443 return (0, import_data81.useSelect)( 57444 (select4) => select4(import_core_data60.store).getEntityRecords( 57445 "postType", 57446 TEMPLATE_POST_TYPE, 57447 { 57448 per_page: -1 57449 } 57450 ), 57451 [] 57452 ); 57453 }; 57454 var useDefaultTemplateTypes2 = () => { 57455 return (0, import_data81.useSelect)( 57456 (select4) => select4(import_core_data60.store).getCurrentTheme()?.default_template_types || [], 57457 [] 57458 ); 57459 }; 57460 var usePublicPostTypes2 = () => { 57461 const postTypes = (0, import_data81.useSelect)( 57462 (select4) => select4(import_core_data60.store).getPostTypes({ per_page: -1 }), 57463 [] 57464 ); 57465 return (0, import_element185.useMemo)(() => { 57466 const excludedPostTypes = ["attachment"]; 57467 return postTypes?.filter( 57468 ({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug) 57469 ).sort((a2, b2) => { 57470 if (a2.slug === "post" || b2.slug === "post") { 57471 return 0; 57472 } 57473 return a2.name.localeCompare(b2.name); 57474 }); 57475 }, [postTypes]); 57476 }; 57477 var usePublicTaxonomies2 = () => { 57478 const taxonomies = (0, import_data81.useSelect)( 57479 (select4) => select4(import_core_data60.store).getTaxonomies({ per_page: -1 }), 57480 [] 57481 ); 57482 return (0, import_element185.useMemo)(() => { 57483 return taxonomies?.filter( 57484 ({ visibility }) => visibility?.publicly_queryable 57485 ); 57486 }, [taxonomies]); 57487 }; 57488 function usePostTypeArchiveMenuItems2() { 57489 const publicPostTypes = usePublicPostTypes2(); 57490 const postTypesWithArchives = (0, import_element185.useMemo)( 57491 () => publicPostTypes?.filter((postType2) => postType2.has_archive), 57492 [publicPostTypes] 57493 ); 57494 const existingTemplates = useExistingTemplates2(); 57495 const postTypeLabels = (0, import_element185.useMemo)( 57496 () => publicPostTypes?.reduce((accumulator, { labels }) => { 57497 const singularName = labels.singular_name.toLowerCase(); 57498 accumulator[singularName] = (accumulator[singularName] || 0) + 1; 57499 return accumulator; 57500 }, {}), 57501 [publicPostTypes] 57502 ); 57503 const needsUniqueIdentifier = (0, import_element185.useCallback)( 57504 ({ labels, slug }) => { 57505 const singularName = labels.singular_name.toLowerCase(); 57506 return postTypeLabels[singularName] > 1 && singularName !== slug; 57507 }, 57508 [postTypeLabels] 57509 ); 57510 return (0, import_element185.useMemo)( 57511 () => postTypesWithArchives?.filter( 57512 (postType2) => !(existingTemplates || []).some( 57513 (existingTemplate) => existingTemplate.slug === "archive-" + postType2.slug 57514 ) 57515 ).map((postType2) => { 57516 let title; 57517 if (needsUniqueIdentifier(postType2)) { 57518 title = (0, import_i18n151.sprintf)( 57519 // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". 57520 (0, import_i18n151.__)("Archive: %1$s (%2$s)"), 57521 postType2.labels.singular_name, 57522 postType2.slug 57523 ); 57524 } else { 57525 title = (0, import_i18n151.sprintf)( 57526 // translators: %s: Name of the post type e.g: "Post". 57527 (0, import_i18n151.__)("Archive: %s"), 57528 postType2.labels.singular_name 57529 ); 57530 } 57531 return { 57532 slug: "archive-" + postType2.slug, 57533 description: (0, import_i18n151.sprintf)( 57534 // translators: %s: Name of the post type e.g: "Post". 57535 (0, import_i18n151.__)( 57536 "Displays an archive with the latest posts of type: %s." 57537 ), 57538 postType2.labels.singular_name 57539 ), 57540 title, 57541 // `icon` is the `menu_icon` property of a post type. We 57542 // only handle `dashicons` for now, even if the `menu_icon` 57543 // also supports urls and svg as values. 57544 icon: typeof postType2.icon === "string" && postType2.icon.startsWith("dashicons-") ? postType2.icon.slice(10) : archive_default, 57545 templatePrefix: "archive" 57546 }; 57547 }) || [], 57548 [postTypesWithArchives, existingTemplates, needsUniqueIdentifier] 57549 ); 57550 } 57551 var usePostTypeMenuItems2 = (onClickMenuItem) => { 57552 const publicPostTypes = usePublicPostTypes2(); 57553 const existingTemplates = useExistingTemplates2(); 57554 const defaultTemplateTypes = useDefaultTemplateTypes2(); 57555 const templateLabels = (0, import_element185.useMemo)( 57556 () => publicPostTypes?.reduce((accumulator, { labels }) => { 57557 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 57558 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 57559 return accumulator; 57560 }, {}), 57561 [publicPostTypes] 57562 ); 57563 const needsUniqueIdentifier = (0, import_element185.useCallback)( 57564 ({ labels, slug }) => { 57565 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 57566 return templateLabels[templateName] > 1 && templateName !== slug; 57567 }, 57568 [templateLabels] 57569 ); 57570 const templatePrefixes = (0, import_element185.useMemo)( 57571 () => publicPostTypes?.reduce((accumulator, { slug }) => { 57572 let suffix = slug; 57573 if (slug !== "page") { 57574 suffix = `single-$suffix}`; 57575 } 57576 accumulator[slug] = suffix; 57577 return accumulator; 57578 }, {}), 57579 [publicPostTypes] 57580 ); 57581 const postTypesInfo = useEntitiesInfo2("postType", templatePrefixes); 57582 const existingTemplateSlugs = (existingTemplates || []).map( 57583 ({ slug }) => slug 57584 ); 57585 const menuItems = (publicPostTypes || []).reduce( 57586 (accumulator, postType2) => { 57587 const { slug, labels, icon } = postType2; 57588 const generalTemplateSlug = templatePrefixes[slug]; 57589 const defaultTemplateType = defaultTemplateTypes?.find( 57590 ({ slug: _slug }) => _slug === generalTemplateSlug 57591 ); 57592 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 57593 const _needsUniqueIdentifier = needsUniqueIdentifier(postType2); 57594 let menuItemTitle = labels.template_name || (0, import_i18n151.sprintf)( 57595 // translators: %s: Name of the post type e.g: "Post". 57596 (0, import_i18n151.__)("Single item: %s"), 57597 labels.singular_name 57598 ); 57599 if (_needsUniqueIdentifier) { 57600 menuItemTitle = labels.template_name ? (0, import_i18n151.sprintf)( 57601 // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book". 57602 (0, import_i18n151._x)("%1$s (%2$s)", "post type menu label"), 57603 labels.template_name, 57604 slug 57605 ) : (0, import_i18n151.sprintf)( 57606 // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book". 57607 (0, import_i18n151._x)( 57608 "Single item: %1$s (%2$s)", 57609 "post type menu label" 57610 ), 57611 labels.singular_name, 57612 slug 57613 ); 57614 } 57615 const menuItem = defaultTemplateType ? { 57616 ...defaultTemplateType, 57617 templatePrefix: templatePrefixes[slug] 57618 } : { 57619 slug: generalTemplateSlug, 57620 title: menuItemTitle, 57621 description: (0, import_i18n151.sprintf)( 57622 // translators: %s: Name of the post type e.g: "Post". 57623 (0, import_i18n151.__)("Displays a single item: %s."), 57624 labels.singular_name 57625 ), 57626 // `icon` is the `menu_icon` property of a post type. We 57627 // only handle `dashicons` for now, even if the `menu_icon` 57628 // also supports urls and svg as values. 57629 icon: typeof icon === "string" && icon.startsWith("dashicons-") ? icon.slice(10) : post_default, 57630 templatePrefix: templatePrefixes[slug] 57631 }; 57632 const hasEntities = postTypesInfo?.[slug]?.hasEntities; 57633 if (hasEntities) { 57634 menuItem.onClick = (template) => { 57635 onClickMenuItem({ 57636 type: "postType", 57637 slug, 57638 config: { 57639 recordNamePath: "title.rendered", 57640 queryArgs: ({ search }) => { 57641 return { 57642 _fields: "id,title,slug,link", 57643 orderBy: search ? "relevance" : "modified", 57644 exclude: postTypesInfo[slug].existingEntitiesIds 57645 }; 57646 }, 57647 getSpecificTemplate: (suggestion) => { 57648 const templateSlug = prefixSlug2( 57649 templatePrefixes[slug], 57650 suggestion.slug 57651 ); 57652 return { 57653 title: templateSlug, 57654 slug: templateSlug, 57655 templatePrefix: templatePrefixes[slug] 57656 }; 57657 } 57658 }, 57659 labels, 57660 hasGeneralTemplate, 57661 template 57662 }); 57663 }; 57664 } 57665 if (!hasGeneralTemplate || hasEntities) { 57666 accumulator.push(menuItem); 57667 } 57668 return accumulator; 57669 }, 57670 [] 57671 ); 57672 const postTypesMenuItems = (0, import_element185.useMemo)( 57673 () => menuItems.reduce( 57674 (accumulator, postType2) => { 57675 const { slug } = postType2; 57676 let key = "postTypesMenuItems"; 57677 if (slug === "page") { 57678 key = "defaultPostTypesMenuItems"; 57679 } 57680 accumulator[key].push(postType2); 57681 return accumulator; 57682 }, 57683 { defaultPostTypesMenuItems: [], postTypesMenuItems: [] } 57684 ), 57685 [menuItems] 57686 ); 57687 return postTypesMenuItems; 57688 }; 57689 var useTaxonomiesMenuItems2 = (onClickMenuItem) => { 57690 const publicTaxonomies = usePublicTaxonomies2(); 57691 const existingTemplates = useExistingTemplates2(); 57692 const defaultTemplateTypes = useDefaultTemplateTypes2(); 57693 const templatePrefixes = (0, import_element185.useMemo)( 57694 () => publicTaxonomies?.reduce((accumulator, { slug }) => { 57695 let suffix = slug; 57696 if (!["category", "post_tag"].includes(slug)) { 57697 suffix = `taxonomy-$suffix}`; 57698 } 57699 if (slug === "post_tag") { 57700 suffix = `tag`; 57701 } 57702 accumulator[slug] = suffix; 57703 return accumulator; 57704 }, {}), 57705 [publicTaxonomies] 57706 ); 57707 const taxonomyLabels = publicTaxonomies?.reduce( 57708 (accumulator, { labels }) => { 57709 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 57710 accumulator[templateName] = (accumulator[templateName] || 0) + 1; 57711 return accumulator; 57712 }, 57713 {} 57714 ); 57715 const needsUniqueIdentifier = (labels, slug) => { 57716 if (["category", "post_tag"].includes(slug)) { 57717 return false; 57718 } 57719 const templateName = (labels.template_name || labels.singular_name).toLowerCase(); 57720 return taxonomyLabels[templateName] > 1 && templateName !== slug; 57721 }; 57722 const taxonomiesInfo = useEntitiesInfo2("taxonomy", templatePrefixes); 57723 const existingTemplateSlugs = (existingTemplates || []).map( 57724 ({ slug }) => slug 57725 ); 57726 const menuItems = (publicTaxonomies || []).reduce( 57727 (accumulator, taxonomy) => { 57728 const { slug, labels } = taxonomy; 57729 const generalTemplateSlug = templatePrefixes[slug]; 57730 const defaultTemplateType = defaultTemplateTypes?.find( 57731 ({ slug: _slug }) => _slug === generalTemplateSlug 57732 ); 57733 const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug); 57734 const _needsUniqueIdentifier = needsUniqueIdentifier( 57735 labels, 57736 slug 57737 ); 57738 let menuItemTitle = labels.template_name || labels.singular_name; 57739 if (_needsUniqueIdentifier) { 57740 menuItemTitle = labels.template_name ? (0, import_i18n151.sprintf)( 57741 // translators: 1: Name of the template e.g: "Products by Category". 2: Slug of the taxonomy e.g: "product_cat". 57742 (0, import_i18n151._x)("%1$s (%2$s)", "taxonomy template menu label"), 57743 labels.template_name, 57744 slug 57745 ) : (0, import_i18n151.sprintf)( 57746 // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat". 57747 (0, import_i18n151._x)("%1$s (%2$s)", "taxonomy menu label"), 57748 labels.singular_name, 57749 slug 57750 ); 57751 } 57752 const menuItem = defaultTemplateType ? { 57753 ...defaultTemplateType, 57754 templatePrefix: templatePrefixes[slug] 57755 } : { 57756 slug: generalTemplateSlug, 57757 title: menuItemTitle, 57758 description: (0, import_i18n151.sprintf)( 57759 // translators: %s: Name of the taxonomy e.g: "Product Categories". 57760 (0, import_i18n151.__)("Displays taxonomy: %s."), 57761 labels.singular_name 57762 ), 57763 icon: block_meta_default, 57764 templatePrefix: templatePrefixes[slug] 57765 }; 57766 const hasEntities = taxonomiesInfo?.[slug]?.hasEntities; 57767 if (hasEntities) { 57768 menuItem.onClick = (template) => { 57769 onClickMenuItem({ 57770 type: "taxonomy", 57771 slug, 57772 config: { 57773 queryArgs: ({ search }) => { 57774 return { 57775 _fields: "id,name,slug,link", 57776 orderBy: search ? "name" : "count", 57777 exclude: taxonomiesInfo[slug].existingEntitiesIds 57778 }; 57779 }, 57780 getSpecificTemplate: (suggestion) => { 57781 const templateSlug = prefixSlug2( 57782 templatePrefixes[slug], 57783 suggestion.slug 57784 ); 57785 return { 57786 title: templateSlug, 57787 slug: templateSlug, 57788 templatePrefix: templatePrefixes[slug] 57789 }; 57790 } 57791 }, 57792 labels, 57793 hasGeneralTemplate, 57794 template 57795 }); 57796 }; 57797 } 57798 if (!hasGeneralTemplate || hasEntities) { 57799 accumulator.push(menuItem); 57800 } 57801 return accumulator; 57802 }, 57803 [] 57804 ); 57805 const taxonomiesMenuItems = (0, import_element185.useMemo)( 57806 () => menuItems.reduce( 57807 (accumulator, taxonomy) => { 57808 const { slug } = taxonomy; 57809 let key = "taxonomiesMenuItems"; 57810 if (["category", "tag"].includes(slug)) { 57811 key = "defaultTaxonomiesMenuItems"; 57812 } 57813 accumulator[key].push(taxonomy); 57814 return accumulator; 57815 }, 57816 { defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] } 57817 ), 57818 [menuItems] 57819 ); 57820 return taxonomiesMenuItems; 57821 }; 57822 var USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX2 = { user: "author" }; 57823 var USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS2 = { user: { who: "authors" } }; 57824 function useAuthorMenuItem2(onClickMenuItem) { 57825 const existingTemplates = useExistingTemplates2(); 57826 const defaultTemplateTypes = useDefaultTemplateTypes2(); 57827 const authorInfo = useEntitiesInfo2( 57828 "root", 57829 USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX2, 57830 USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS2 57831 ); 57832 let authorMenuItem = defaultTemplateTypes?.find( 57833 ({ slug }) => slug === "author" 57834 ); 57835 if (!authorMenuItem) { 57836 authorMenuItem = { 57837 description: (0, import_i18n151.__)( 57838 "Displays latest posts written by a single author." 57839 ), 57840 slug: "author", 57841 title: "Author" 57842 }; 57843 } 57844 const hasGeneralTemplate = !!existingTemplates?.find( 57845 ({ slug }) => slug === "author" 57846 ); 57847 if (authorInfo.user?.hasEntities) { 57848 authorMenuItem = { ...authorMenuItem, templatePrefix: "author" }; 57849 authorMenuItem.onClick = (template) => { 57850 onClickMenuItem({ 57851 type: "root", 57852 slug: "user", 57853 config: { 57854 queryArgs: ({ search }) => { 57855 return { 57856 _fields: "id,name,slug,link", 57857 orderBy: search ? "name" : "registered_date", 57858 exclude: authorInfo.user.existingEntitiesIds, 57859 who: "authors" 57860 }; 57861 }, 57862 getSpecificTemplate: (suggestion) => { 57863 const templateSlug = prefixSlug2( 57864 "author", 57865 suggestion.slug 57866 ); 57867 return { 57868 title: templateSlug, 57869 slug: templateSlug, 57870 templatePrefix: "author" 57871 }; 57872 } 57873 }, 57874 labels: { 57875 singular_name: (0, import_i18n151.__)("Author"), 57876 search_items: (0, import_i18n151.__)("Search Authors"), 57877 not_found: (0, import_i18n151.__)("No authors found."), 57878 all_items: (0, import_i18n151.__)("All Authors") 57879 }, 57880 hasGeneralTemplate, 57881 template 57882 }); 57883 }; 57884 } 57885 if (!hasGeneralTemplate || authorInfo.user?.hasEntities) { 57886 return authorMenuItem; 57887 } 57888 } 57889 var useExistingTemplateSlugs = (templatePrefixes) => { 57890 const existingTemplates = useExistingTemplates2(); 57891 const existingSlugs = (0, import_element185.useMemo)(() => { 57892 return Object.entries(templatePrefixes || {}).reduce( 57893 (accumulator, [slug, prefix2]) => { 57894 const slugsWithTemplates = (existingTemplates || []).reduce( 57895 (_accumulator, existingTemplate) => { 57896 const _prefix = `$prefix2}-`; 57897 if (existingTemplate.slug.startsWith(_prefix)) { 57898 _accumulator.push( 57899 existingTemplate.slug.substring( 57900 _prefix.length 57901 ) 57902 ); 57903 } 57904 return _accumulator; 57905 }, 57906 [] 57907 ); 57908 if (slugsWithTemplates.length) { 57909 accumulator[slug] = slugsWithTemplates; 57910 } 57911 return accumulator; 57912 }, 57913 {} 57914 ); 57915 }, [templatePrefixes, existingTemplates]); 57916 return existingSlugs; 57917 }; 57918 var useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => { 57919 const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes); 57920 const recordsToExcludePerEntity = (0, import_data81.useSelect)( 57921 (select4) => { 57922 return Object.entries(slugsToExcludePerEntity || {}).reduce( 57923 (accumulator, [slug, slugsWithTemplates]) => { 57924 const entitiesWithTemplates = select4( 57925 import_core_data60.store 57926 ).getEntityRecords(entityName, slug, { 57927 _fields: "id", 57928 context: "view", 57929 slug: slugsWithTemplates, 57930 ...additionalQueryParameters[slug] 57931 }); 57932 if (entitiesWithTemplates?.length) { 57933 accumulator[slug] = entitiesWithTemplates; 57934 } 57935 return accumulator; 57936 }, 57937 {} 57938 ); 57939 }, 57940 [slugsToExcludePerEntity] 57941 ); 57942 return recordsToExcludePerEntity; 57943 }; 57944 var useEntitiesInfo2 = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT3) => { 57945 const recordsToExcludePerEntity = useTemplatesToExclude( 57946 entityName, 57947 templatePrefixes, 57948 additionalQueryParameters 57949 ); 57950 const entitiesHasRecords = (0, import_data81.useSelect)( 57951 (select4) => { 57952 return Object.keys(templatePrefixes || {}).reduce( 57953 (accumulator, slug) => { 57954 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map( 57955 ({ id }) => id 57956 ) || []; 57957 const records = select4(import_core_data60.store).getEntityRecords( 57958 entityName, 57959 slug, 57960 { 57961 per_page: 1, 57962 _fields: "id", 57963 context: "view", 57964 exclude: existingEntitiesIds, 57965 ...additionalQueryParameters[slug] 57966 } 57967 ); 57968 accumulator[slug] = records === null || records.length > 0; 57969 return accumulator; 57970 }, 57971 {} 57972 ); 57973 }, 57974 [ 57975 templatePrefixes, 57976 recordsToExcludePerEntity, 57977 entityName, 57978 additionalQueryParameters 57979 ] 57980 ); 57981 const entitiesInfo = (0, import_element185.useMemo)(() => { 57982 return Object.keys(templatePrefixes || {}).reduce( 57983 (accumulator, slug) => { 57984 const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map( 57985 ({ id }) => id 57986 ) || []; 57987 accumulator[slug] = { 57988 hasEntities: entitiesHasRecords[slug], 57989 existingEntitiesIds 57990 }; 57991 return accumulator; 57992 }, 57993 {} 57994 ); 57995 }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]); 57996 return entitiesInfo; 57997 }; 57998 57999 // packages/edit-site/build-module/components/add-new-template-legacy/add-custom-template-modal-content.mjs 58000 var import_jsx_runtime322 = __toESM(require_jsx_runtime(), 1); 58001 var EMPTY_ARRAY14 = []; 58002 function SuggestionListItem2({ 58003 suggestion, 58004 search, 58005 onSelect, 58006 entityForSuggestions 58007 }) { 58008 const baseCssClass = "edit-site-custom-template-modal__suggestions_list__list-item"; 58009 return /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)( 58010 import_components154.Composite.Item, 58011 { 58012 render: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58013 import_components154.Button, 58014 { 58015 __next40pxDefaultSize: true, 58016 role: "option", 58017 className: baseCssClass, 58018 onClick: () => onSelect( 58019 entityForSuggestions.config.getSpecificTemplate( 58020 suggestion 58021 ) 58022 ) 58023 } 58024 ), 58025 children: [ 58026 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58027 import_components154.__experimentalText, 58028 { 58029 size: "body", 58030 lineHeight: 1.53846153846, 58031 weight: 500, 58032 className: `$baseCssClass}__title`, 58033 children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58034 import_components154.TextHighlight, 58035 { 58036 text: (0, import_html_entities16.decodeEntities)(suggestion.name), 58037 highlight: search 58038 } 58039 ) 58040 } 58041 ), 58042 suggestion.link && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58043 import_components154.__experimentalText, 58044 { 58045 size: "body", 58046 lineHeight: 1.53846153846, 58047 className: `$baseCssClass}__info`, 58048 children: (0, import_url24.safeDecodeURI)(suggestion.link) 58049 } 58050 ) 58051 ] 58052 } 58053 ); 58054 } 58055 function useSearchSuggestions2(entityForSuggestions, search) { 58056 const { config: config2 } = entityForSuggestions; 58057 const query = (0, import_element186.useMemo)( 58058 () => ({ 58059 order: "asc", 58060 context: "view", 58061 search, 58062 per_page: search ? 20 : 10, 58063 ...config2.queryArgs(search) 58064 }), 58065 [search, config2] 58066 ); 58067 const { records: searchResults, hasResolved: searchHasResolved } = (0, import_core_data61.useEntityRecords)( 58068 entityForSuggestions.type, 58069 entityForSuggestions.slug, 58070 query 58071 ); 58072 const [suggestions, setSuggestions] = (0, import_element186.useState)(EMPTY_ARRAY14); 58073 (0, import_element186.useEffect)(() => { 58074 if (!searchHasResolved) { 58075 return; 58076 } 58077 let newSuggestions = EMPTY_ARRAY14; 58078 if (searchResults?.length) { 58079 newSuggestions = searchResults; 58080 if (config2.recordNamePath) { 58081 newSuggestions = mapToIHasNameAndId2( 58082 newSuggestions, 58083 config2.recordNamePath 58084 ); 58085 } 58086 } 58087 setSuggestions(newSuggestions); 58088 }, [searchResults, searchHasResolved]); 58089 return suggestions; 58090 } 58091 function SuggestionList2({ entityForSuggestions, onSelect }) { 58092 const [search, setSearch, debouncedSearch] = (0, import_compose31.useDebouncedInput)(); 58093 const suggestions = useSearchSuggestions2( 58094 entityForSuggestions, 58095 debouncedSearch 58096 ); 58097 const { labels } = entityForSuggestions; 58098 const [showSearchControl, setShowSearchControl] = (0, import_element186.useState)(false); 58099 if (!showSearchControl && suggestions?.length > 9) { 58100 setShowSearchControl(true); 58101 } 58102 return /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)(import_jsx_runtime322.Fragment, { children: [ 58103 showSearchControl && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58104 import_components154.SearchControl, 58105 { 58106 onChange: setSearch, 58107 value: search, 58108 label: labels.search_items, 58109 placeholder: labels.search_items 58110 } 58111 ), 58112 !!suggestions?.length && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58113 import_components154.Composite, 58114 { 58115 orientation: "vertical", 58116 role: "listbox", 58117 className: "edit-site-custom-template-modal__suggestions_list", 58118 "aria-label": (0, import_i18n152.__)("Suggestions list"), 58119 children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58120 SuggestionListItem2, 58121 { 58122 suggestion, 58123 search: debouncedSearch, 58124 onSelect, 58125 entityForSuggestions 58126 }, 58127 suggestion.slug 58128 )) 58129 } 58130 ), 58131 debouncedSearch && !suggestions?.length && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58132 import_components154.__experimentalText, 58133 { 58134 as: "p", 58135 className: "edit-site-custom-template-modal__no-results", 58136 children: labels.not_found 58137 } 58138 ) 58139 ] }); 58140 } 58141 function AddCustomTemplateModalContent2({ 58142 onSelect, 58143 entityForSuggestions, 58144 onBack, 58145 containerRef 58146 }) { 58147 const [showSearchEntities, setShowSearchEntities] = (0, import_element186.useState)( 58148 entityForSuggestions.hasGeneralTemplate 58149 ); 58150 (0, import_element186.useEffect)(() => { 58151 if (containerRef.current) { 58152 const [firstFocusable] = import_dom35.focus.focusable.find( 58153 containerRef.current 58154 ); 58155 firstFocusable?.focus(); 58156 } 58157 }, [showSearchEntities]); 58158 return /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)( 58159 import_components154.__experimentalVStack, 58160 { 58161 spacing: 4, 58162 className: "edit-site-custom-template-modal__contents-wrapper", 58163 alignment: "left", 58164 children: [ 58165 !showSearchEntities && /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)(import_jsx_runtime322.Fragment, { children: [ 58166 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_components154.__experimentalText, { as: "p", children: (0, import_i18n152.__)( 58167 "Select whether to create a single template for all items or a specific one." 58168 ) }), 58169 /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)( 58170 import_components154.Flex, 58171 { 58172 className: "edit-site-custom-template-modal__contents", 58173 gap: "4", 58174 align: "initial", 58175 children: [ 58176 /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)( 58177 import_components154.FlexItem, 58178 { 58179 isBlock: true, 58180 as: import_components154.Button, 58181 onClick: () => { 58182 const { 58183 slug, 58184 title, 58185 description, 58186 templatePrefix 58187 } = entityForSuggestions.template; 58188 onSelect({ 58189 slug, 58190 title, 58191 description, 58192 templatePrefix 58193 }); 58194 }, 58195 children: [ 58196 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58197 import_components154.__experimentalText, 58198 { 58199 as: "span", 58200 weight: 500, 58201 lineHeight: 1.53846153846, 58202 children: entityForSuggestions.labels.all_items 58203 } 58204 ), 58205 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58206 import_components154.__experimentalText, 58207 { 58208 as: "span", 58209 lineHeight: 1.53846153846, 58210 // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. 58211 children: (0, import_i18n152.__)("For all items") 58212 } 58213 ) 58214 ] 58215 } 58216 ), 58217 /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)( 58218 import_components154.FlexItem, 58219 { 58220 isBlock: true, 58221 as: import_components154.Button, 58222 onClick: () => { 58223 setShowSearchEntities(true); 58224 }, 58225 children: [ 58226 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58227 import_components154.__experimentalText, 58228 { 58229 as: "span", 58230 weight: 500, 58231 lineHeight: 1.53846153846, 58232 children: entityForSuggestions.labels.singular_name 58233 } 58234 ), 58235 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58236 import_components154.__experimentalText, 58237 { 58238 as: "span", 58239 lineHeight: 1.53846153846, 58240 // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one. 58241 children: (0, import_i18n152.__)("For a specific item") 58242 } 58243 ) 58244 ] 58245 } 58246 ) 58247 ] 58248 } 58249 ), 58250 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_components154.Flex, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58251 import_components154.Button, 58252 { 58253 __next40pxDefaultSize: true, 58254 variant: "tertiary", 58255 onClick: onBack, 58256 children: (0, import_i18n152.__)("Back") 58257 } 58258 ) }) 58259 ] }), 58260 showSearchEntities && /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)(import_jsx_runtime322.Fragment, { children: [ 58261 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_components154.__experimentalText, { as: "p", children: (0, import_i18n152.__)( 58262 "This template will be used only for the specific item chosen." 58263 ) }), 58264 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58265 SuggestionList2, 58266 { 58267 entityForSuggestions, 58268 onSelect 58269 } 58270 ), 58271 /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_components154.Flex, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)( 58272 import_components154.Button, 58273 { 58274 __next40pxDefaultSize: true, 58275 variant: "tertiary", 58276 onClick: () => { 58277 if (entityForSuggestions.hasGeneralTemplate) { 58278 onBack(); 58279 } else { 58280 setShowSearchEntities(false); 58281 } 58282 }, 58283 children: (0, import_i18n152.__)("Back") 58284 } 58285 ) }) 58286 ] }) 58287 ] 58288 } 58289 ); 58290 } 58291 var add_custom_template_modal_content_default2 = AddCustomTemplateModalContent2; 58292 58293 // packages/edit-site/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.mjs 58294 var import_element187 = __toESM(require_element(), 1); 58295 var import_i18n153 = __toESM(require_i18n(), 1); 58296 var import_components155 = __toESM(require_components(), 1); 58297 var import_jsx_runtime323 = __toESM(require_jsx_runtime(), 1); 58298 function AddCustomGenericTemplateModalContent2({ createTemplate, onBack }) { 58299 const [title, setTitle] = (0, import_element187.useState)(""); 58300 const defaultTitle = (0, import_i18n153.__)("Custom Template"); 58301 const [isBusy, setIsBusy] = (0, import_element187.useState)(false); 58302 const inputRef = (0, import_element187.useRef)(); 58303 (0, import_element187.useEffect)(() => { 58304 if (inputRef.current) { 58305 inputRef.current.focus(); 58306 } 58307 }, []); 58308 async function onCreateTemplate(event) { 58309 event.preventDefault(); 58310 if (isBusy) { 58311 return; 58312 } 58313 setIsBusy(true); 58314 try { 58315 await createTemplate( 58316 { 58317 slug: paramCase(title || defaultTitle) || "wp-custom-template", 58318 title: title || defaultTitle 58319 }, 58320 false 58321 ); 58322 } finally { 58323 setIsBusy(false); 58324 } 58325 } 58326 return /* @__PURE__ */ (0, import_jsx_runtime323.jsx)("form", { onSubmit: onCreateTemplate, children: /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(import_components155.__experimentalVStack, { spacing: 6, children: [ 58327 /* @__PURE__ */ (0, import_jsx_runtime323.jsx)( 58328 import_components155.TextControl, 58329 { 58330 __next40pxDefaultSize: true, 58331 label: (0, import_i18n153.__)("Name"), 58332 value: title, 58333 onChange: setTitle, 58334 placeholder: defaultTitle, 58335 disabled: isBusy, 58336 ref: inputRef, 58337 help: (0, import_i18n153.__)( 58338 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 58339 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.' 58340 ) 58341 } 58342 ), 58343 /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)( 58344 import_components155.__experimentalHStack, 58345 { 58346 className: "edit-site-custom-generic-template__modal-actions", 58347 justify: "right", 58348 children: [ 58349 /* @__PURE__ */ (0, import_jsx_runtime323.jsx)( 58350 import_components155.Button, 58351 { 58352 __next40pxDefaultSize: true, 58353 variant: "tertiary", 58354 onClick: onBack, 58355 children: (0, import_i18n153.__)("Back") 58356 } 58357 ), 58358 /* @__PURE__ */ (0, import_jsx_runtime323.jsx)( 58359 import_components155.Button, 58360 { 58361 __next40pxDefaultSize: true, 58362 variant: "primary", 58363 type: "submit", 58364 isBusy, 58365 "aria-disabled": isBusy, 58366 children: (0, import_i18n153.__)("Create") 58367 } 58368 ) 58369 ] 58370 } 58371 ) 58372 ] }) }); 58373 } 58374 var add_custom_generic_template_modal_content_default2 = AddCustomGenericTemplateModalContent2; 58375 58376 // packages/edit-site/build-module/components/add-new-template-legacy/index.mjs 58377 var import_jsx_runtime324 = __toESM(require_jsx_runtime(), 1); 58378 var { useHistory: useHistory23 } = unlock(import_router35.privateApis); 58379 var DEFAULT_TEMPLATE_SLUGS2 = [ 58380 "front-page", 58381 "home", 58382 "single", 58383 "page", 58384 "index", 58385 "archive", 58386 "author", 58387 "category", 58388 "date", 58389 "tag", 58390 "search", 58391 "404" 58392 ]; 58393 var TEMPLATE_ICONS2 = { 58394 "front-page": home_default, 58395 home: verse_default, 58396 single: pin_default, 58397 page: page_default, 58398 archive: archive_default, 58399 search: search_default, 58400 404: not_found_default, 58401 index: list_default, 58402 category: category_default, 58403 author: comment_author_avatar_default, 58404 taxonomy: block_meta_default, 58405 date: calendar_default, 58406 tag: tag_default, 58407 attachment: media_default 58408 }; 58409 function TemplateListItem2({ 58410 title, 58411 direction, 58412 className, 58413 description, 58414 icon, 58415 onClick, 58416 children 58417 }) { 58418 return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)( 58419 import_components156.Button, 58420 { 58421 __next40pxDefaultSize: true, 58422 className, 58423 onClick, 58424 label: description, 58425 showTooltip: !!description, 58426 children: /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)( 58427 import_components156.Flex, 58428 { 58429 as: "span", 58430 spacing: 2, 58431 align: "center", 58432 justify: "center", 58433 style: { width: "100%" }, 58434 direction, 58435 children: [ 58436 /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "edit-site-add-new-template__template-icon", children: /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(import_components156.Icon, { icon }) }), 58437 /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)( 58438 import_components156.__experimentalVStack, 58439 { 58440 className: "edit-site-add-new-template__template-name", 58441 alignment: "center", 58442 spacing: 0, 58443 children: [ 58444 /* @__PURE__ */ (0, import_jsx_runtime324.jsx)( 58445 import_components156.__experimentalText, 58446 { 58447 align: "center", 58448 weight: 500, 58449 lineHeight: 1.53846153846, 58450 children: title 58451 } 58452 ), 58453 children 58454 ] 58455 } 58456 ) 58457 ] 58458 } 58459 ) 58460 } 58461 ); 58462 } 58463 var modalContentMap2 = { 58464 templatesList: 1, 58465 customTemplate: 2, 58466 customGenericTemplate: 3 58467 }; 58468 function NewTemplateModal2({ onClose }) { 58469 const [modalContent, setModalContent] = (0, import_element188.useState)( 58470 modalContentMap2.templatesList 58471 ); 58472 const [entityForSuggestions, setEntityForSuggestions] = (0, import_element188.useState)({}); 58473 const [isSubmitting, setIsSubmitting] = (0, import_element188.useState)(false); 58474 const missingTemplates = useMissingTemplates2( 58475 setEntityForSuggestions, 58476 () => setModalContent(modalContentMap2.customTemplate) 58477 ); 58478 const history = useHistory23(); 58479 const { saveEntityRecord } = (0, import_data82.useDispatch)(import_core_data62.store); 58480 const { createErrorNotice, createSuccessNotice } = (0, import_data82.useDispatch)(import_notices10.store); 58481 const containerRef = (0, import_element188.useRef)(null); 58482 const isMobile = (0, import_compose32.useViewportMatch)("medium", "<"); 58483 const homeUrl = (0, import_data82.useSelect)((select4) => { 58484 return select4(import_core_data62.store).getEntityRecord("root", "__unstableBase")?.home; 58485 }, []); 58486 const TEMPLATE_SHORT_DESCRIPTIONS = { 58487 "front-page": homeUrl, 58488 date: (0, import_i18n154.sprintf)( 58489 // translators: %s: The homepage url. 58490 (0, import_i18n154.__)("E.g. %s"), 58491 homeUrl + "/" + (/* @__PURE__ */ new Date()).getFullYear() 58492 ) 58493 }; 58494 (0, import_element188.useEffect)(() => { 58495 if (containerRef.current && modalContent === modalContentMap2.templatesList) { 58496 const [firstFocusable] = import_dom36.focus.focusable.find( 58497 containerRef.current 58498 ); 58499 firstFocusable?.focus(); 58500 } 58501 }, [modalContent]); 58502 async function createTemplate(template, isWPSuggestion = true) { 58503 if (isSubmitting) { 58504 return; 58505 } 58506 setIsSubmitting(true); 58507 try { 58508 const { title, description, slug } = template; 58509 const newTemplate = await saveEntityRecord( 58510 "postType", 58511 TEMPLATE_POST_TYPE, 58512 { 58513 description, 58514 // Slugs need to be strings, so this is for template `404` 58515 slug: slug.toString(), 58516 status: "publish", 58517 title, 58518 // This adds a post meta field in template that is part of `is_custom` value calculation. 58519 is_wp_suggestion: isWPSuggestion 58520 }, 58521 { throwOnError: true } 58522 ); 58523 history.navigate( 58524 `/$TEMPLATE_POST_TYPE}/$newTemplate.id}?canvas=edit` 58525 ); 58526 createSuccessNotice( 58527 (0, import_i18n154.sprintf)( 58528 // translators: %s: Title of the created post or template, e.g: "Hello world". 58529 (0, import_i18n154.__)('"%s" successfully created.'), 58530 (0, import_html_entities17.decodeEntities)(newTemplate.title?.rendered || title) || (0, import_i18n154.__)("(no title)") 58531 ), 58532 { 58533 type: "snackbar" 58534 } 58535 ); 58536 } catch (error2) { 58537 const errorMessage = error2.message && error2.code !== "unknown_error" ? error2.message : (0, import_i18n154.__)("An error occurred while creating the template."); 58538 createErrorNotice(errorMessage, { 58539 type: "snackbar" 58540 }); 58541 } finally { 58542 setIsSubmitting(false); 58543 } 58544 } 58545 const onModalClose = () => { 58546 onClose(); 58547 setModalContent(modalContentMap2.templatesList); 58548 }; 58549 let modalTitle = (0, import_i18n154.__)("Add template"); 58550 if (modalContent === modalContentMap2.customTemplate) { 58551 modalTitle = (0, import_i18n154.sprintf)( 58552 // translators: %s: Name of the post type e.g: "Post". 58553 (0, import_i18n154.__)("Add template: %s"), 58554 entityForSuggestions.labels.singular_name 58555 ); 58556 } else if (modalContent === modalContentMap2.customGenericTemplate) { 58557 modalTitle = (0, import_i18n154.__)("Create custom template"); 58558 } 58559 return /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)( 58560 import_components156.Modal, 58561 { 58562 title: modalTitle, 58563 className: clsx_default("edit-site-add-new-template__modal", { 58564 "edit-site-add-new-template__modal_template_list": modalContent === modalContentMap2.templatesList, 58565 "edit-site-custom-template-modal": modalContent === modalContentMap2.customTemplate 58566 }), 58567 onRequestClose: onModalClose, 58568 overlayClassName: modalContent === modalContentMap2.customGenericTemplate ? "edit-site-custom-generic-template__modal" : void 0, 58569 ref: containerRef, 58570 children: [ 58571 modalContent === modalContentMap2.templatesList && /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)( 58572 import_components156.__experimentalGrid, 58573 { 58574 columns: isMobile ? 2 : 3, 58575 gap: 4, 58576 align: "flex-start", 58577 justify: "center", 58578 className: "edit-site-add-new-template__template-list__contents", 58579 children: [ 58580 /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(import_components156.Flex, { className: "edit-site-add-new-template__template-list__prompt", children: (0, import_i18n154.__)( 58581 "Select what the new template should apply to:" 58582 ) }), 58583 missingTemplates.map((template) => { 58584 const { title, slug, onClick } = template; 58585 return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)( 58586 TemplateListItem2, 58587 { 58588 title, 58589 direction: "column", 58590 className: "edit-site-add-new-template__template-button", 58591 description: TEMPLATE_SHORT_DESCRIPTIONS[slug], 58592 icon: TEMPLATE_ICONS2[slug] || layout_default, 58593 onClick: () => onClick ? onClick(template) : createTemplate(template) 58594 }, 58595 slug 58596 ); 58597 }), 58598 /* @__PURE__ */ (0, import_jsx_runtime324.jsx)( 58599 TemplateListItem2, 58600 { 58601 title: (0, import_i18n154.__)("Custom template"), 58602 direction: "row", 58603 className: "edit-site-add-new-template__custom-template-button", 58604 icon: pencil_default, 58605 onClick: () => setModalContent( 58606 modalContentMap2.customGenericTemplate 58607 ), 58608 children: /* @__PURE__ */ (0, import_jsx_runtime324.jsx)( 58609 import_components156.__experimentalText, 58610 { 58611 lineHeight: 1.53846153846, 58612 children: (0, import_i18n154.__)( 58613 "A custom template can be manually applied to any post or page." 58614 ) 58615 } 58616 ) 58617 } 58618 ) 58619 ] 58620 } 58621 ), 58622 modalContent === modalContentMap2.customTemplate && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)( 58623 add_custom_template_modal_content_default2, 58624 { 58625 onSelect: createTemplate, 58626 entityForSuggestions, 58627 onBack: () => setModalContent(modalContentMap2.templatesList), 58628 containerRef 58629 } 58630 ), 58631 modalContent === modalContentMap2.customGenericTemplate && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)( 58632 add_custom_generic_template_modal_content_default2, 58633 { 58634 createTemplate, 58635 onBack: () => setModalContent(modalContentMap2.templatesList) 58636 } 58637 ) 58638 ] 58639 } 58640 ); 58641 } 58642 function NewTemplate2() { 58643 const [showModal, setShowModal] = (0, import_element188.useState)(false); 58644 const { postType: postType2 } = (0, import_data82.useSelect)((select4) => { 58645 const { getPostType: getPostType2 } = select4(import_core_data62.store); 58646 return { 58647 postType: getPostType2(TEMPLATE_POST_TYPE) 58648 }; 58649 }, []); 58650 if (!postType2) { 58651 return null; 58652 } 58653 return /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)(import_jsx_runtime324.Fragment, { children: [ 58654 /* @__PURE__ */ (0, import_jsx_runtime324.jsx)( 58655 import_components156.Button, 58656 { 58657 variant: "primary", 58658 onClick: () => setShowModal(true), 58659 label: postType2.labels.add_new_item, 58660 size: "compact", 58661 __next40pxDefaultSize: true, 58662 children: postType2.labels.add_new_item 58663 } 58664 ), 58665 showModal && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(NewTemplateModal2, { onClose: () => setShowModal(false) }) 58666 ] }); 58667 } 58668 function useMissingTemplates2(setEntityForSuggestions, onClick) { 58669 const existingTemplates = useExistingTemplates2(); 58670 const defaultTemplateTypes = useDefaultTemplateTypes2(); 58671 const existingTemplateSlugs = (existingTemplates || []).map( 58672 ({ slug }) => slug 58673 ); 58674 const missingDefaultTemplates = (defaultTemplateTypes || []).filter( 58675 (template) => DEFAULT_TEMPLATE_SLUGS2.includes(template.slug) && !existingTemplateSlugs.includes(template.slug) 58676 ); 58677 const onClickMenuItem = (_entityForSuggestions) => { 58678 onClick?.(); 58679 setEntityForSuggestions(_entityForSuggestions); 58680 }; 58681 const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates]; 58682 const { defaultTaxonomiesMenuItems, taxonomiesMenuItems } = useTaxonomiesMenuItems2(onClickMenuItem); 58683 const { defaultPostTypesMenuItems, postTypesMenuItems } = usePostTypeMenuItems2(onClickMenuItem); 58684 const authorMenuItem = useAuthorMenuItem2(onClickMenuItem); 58685 [ 58686 ...defaultTaxonomiesMenuItems, 58687 ...defaultPostTypesMenuItems, 58688 authorMenuItem 58689 ].forEach((menuItem) => { 58690 if (!menuItem) { 58691 return; 58692 } 58693 const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex( 58694 (template) => template.slug === menuItem.slug 58695 ); 58696 if (matchIndex > -1) { 58697 enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem; 58698 } else { 58699 enhancedMissingDefaultTemplateTypes.push(menuItem); 58700 } 58701 }); 58702 enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => { 58703 return DEFAULT_TEMPLATE_SLUGS2.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS2.indexOf(template2.slug); 58704 }); 58705 const missingTemplates = [ 58706 ...enhancedMissingDefaultTemplateTypes, 58707 ...usePostTypeArchiveMenuItems2(), 58708 ...postTypesMenuItems, 58709 ...taxonomiesMenuItems 58710 ]; 58711 return missingTemplates; 58712 } 58713 var add_new_template_legacy_default = (0, import_element188.memo)(NewTemplate2); 58714 58715 // packages/edit-site/build-module/components/page-templates/index-legacy.mjs 58716 var import_jsx_runtime325 = __toESM(require_jsx_runtime(), 1); 58717 var { usePostActions: usePostActions3, templateTitleField: templateTitleField2 } = unlock(import_editor37.privateApis); 58718 var { useHistory: useHistory24, useLocation: useLocation30 } = unlock(import_router36.privateApis); 58719 var { useEntityRecordsWithPermissions: useEntityRecordsWithPermissions3 } = unlock(import_core_data63.privateApis); 58720 function PageTemplates2() { 58721 const { path, query } = useLocation30(); 58722 const { activeView = "all", postId } = query; 58723 const [selection, setSelection] = (0, import_element189.useState)([postId]); 58724 const { 58725 default_view: defaultView, 58726 default_layouts: defaultLayouts2, 58727 view_list: viewList 58728 } = useViewConfig({ 58729 kind: "postType", 58730 name: TEMPLATE_POST_TYPE 58731 }); 58732 const activeViewOverrides = (0, import_element189.useMemo)( 58733 () => viewList?.find((v2) => v2.slug === activeView)?.view ?? {}, 58734 [viewList, activeView] 58735 ); 58736 const { view, updateView, isModified, resetToDefault } = useView({ 58737 kind: "postType", 58738 name: TEMPLATE_POST_TYPE, 58739 slug: "default", 58740 defaultView, 58741 activeViewOverrides, 58742 defaultLayouts: defaultLayouts2, 58743 queryParams: { 58744 page: query.pageNumber, 58745 search: query.search 58746 }, 58747 onChangeQueryParams: (newQueryParams) => { 58748 history.navigate( 58749 (0, import_url25.addQueryArgs)(path, { 58750 ...query, 58751 pageNumber: newQueryParams.page, 58752 search: newQueryParams.search || void 0 58753 }) 58754 ); 58755 } 58756 }); 58757 const { records, isResolving: isLoadingData } = useEntityRecordsWithPermissions3("postType", TEMPLATE_POST_TYPE, { 58758 per_page: -1 58759 }); 58760 const history = useHistory24(); 58761 const onChangeSelection = (0, import_element189.useCallback)( 58762 (items) => { 58763 setSelection(items); 58764 if (view?.type === "list") { 58765 history.navigate( 58766 (0, import_url25.addQueryArgs)(path, { 58767 postId: items.length === 1 ? items[0] : void 0 58768 }) 58769 ); 58770 } 58771 }, 58772 [history, path, view?.type] 58773 ); 58774 const authors = (0, import_element189.useMemo)(() => { 58775 if (!records) { 58776 return []; 58777 } 58778 const authorsSet = /* @__PURE__ */ new Set(); 58779 records.forEach((template) => { 58780 authorsSet.add(template.author_text); 58781 }); 58782 return Array.from(authorsSet).map((author) => ({ 58783 value: author, 58784 label: author 58785 })); 58786 }, [records]); 58787 const fields2 = (0, import_element189.useMemo)( 58788 () => [ 58789 previewField2, 58790 templateTitleField2, 58791 descriptionField, 58792 { 58793 ...authorField, 58794 elements: authors 58795 } 58796 ], 58797 [authors] 58798 ); 58799 const { data, paginationInfo } = (0, import_element189.useMemo)(() => { 58800 return filterSortAndPaginate(records, view, fields2); 58801 }, [records, view, fields2]); 58802 const postTypeActions = usePostActions3({ 58803 postType: TEMPLATE_POST_TYPE, 58804 context: "list" 58805 }); 58806 const editAction = useEditPostAction(); 58807 const actions = (0, import_element189.useMemo)( 58808 () => [editAction, ...postTypeActions], 58809 [postTypeActions, editAction] 58810 ); 58811 const onChangeView = (0, import_compose33.useEvent)((newView) => { 58812 updateView(newView); 58813 if (newView.type !== view.type) { 58814 history.invalidate(); 58815 } 58816 }); 58817 return /* @__PURE__ */ (0, import_jsx_runtime325.jsx)( 58818 page_default2, 58819 { 58820 className: "edit-site-page-templates", 58821 title: (0, import_i18n155.__)("Templates"), 58822 headingLevel: 2, 58823 actions: /* @__PURE__ */ (0, import_jsx_runtime325.jsx)(add_new_template_legacy_default, {}), 58824 children: /* @__PURE__ */ (0, import_jsx_runtime325.jsx)( 58825 dataviews_default, 58826 { 58827 paginationInfo, 58828 fields: fields2, 58829 actions, 58830 data, 58831 isLoading: isLoadingData, 58832 view, 58833 onChangeView, 58834 onChangeSelection, 58835 isItemClickable: () => true, 58836 onClickItem: ({ id }) => { 58837 history.navigate(`/wp_template/$id}?canvas=edit`); 58838 }, 58839 selection, 58840 defaultLayouts: defaultLayouts2, 58841 onReset: isModified ? () => { 58842 resetToDefault(); 58843 history.invalidate(); 58844 } : false 58845 }, 58846 activeView 58847 ) 58848 } 58849 ); 58850 } 58851 58852 // packages/edit-site/build-module/components/site-editor-routes/templates.mjs 58853 var import_jsx_runtime326 = __toESM(require_jsx_runtime(), 1); 58854 async function isTemplateListView(query) { 58855 const { activeView = "active" } = query; 58856 const config2 = await unlock((0, import_data83.resolveSelect)(import_core_data64.store)).getViewConfig( 58857 "postType", 58858 "wp_template" 58859 ); 58860 const defaultView = config2?.default_view; 58861 const activeViewOverrides = config2?.view_list?.find((v2) => v2.slug === activeView)?.view ?? {}; 58862 const view = await loadView({ 58863 kind: "postType", 58864 name: "wp_template", 58865 slug: "default", 58866 defaultView, 58867 activeViewOverrides 58868 }); 58869 return view.type === "list"; 58870 } 58871 var templatesRoute = { 58872 name: "templates", 58873 path: "/template", 58874 areas: { 58875 sidebar({ siteData }) { 58876 if (!isThemeDataLoaded(siteData)) { 58877 return null; 58878 } 58879 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(SidebarNavigationScreenUnsupported, {}); 58880 }, 58881 content({ siteData }) { 58882 const isBlockTheme = siteData.currentTheme?.is_block_theme; 58883 if (!isBlockTheme) { 58884 return void 0; 58885 } 58886 return window?.__experimentalTemplateActivate ? /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(PageTemplates, {}) : /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(PageTemplates2, {}); 58887 }, 58888 async preview({ query, siteData }) { 58889 const isBlockTheme = siteData.currentTheme?.is_block_theme; 58890 if (!isBlockTheme) { 58891 return void 0; 58892 } 58893 const isListView2 = await isTemplateListView(query); 58894 return isListView2 ? /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(EditSiteEditor, {}) : void 0; 58895 }, 58896 mobileSidebar({ siteData }) { 58897 if (!isThemeDataLoaded(siteData)) { 58898 return /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(import_jsx_runtime326.Fragment, {}); 58899 } 58900 if (!siteData.currentTheme.is_block_theme) { 58901 return /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(SidebarNavigationScreenUnsupported, {}); 58902 } 58903 return void 0; 58904 }, 58905 mobileContent({ siteData }) { 58906 const isBlockTheme = siteData.currentTheme?.is_block_theme; 58907 if (!isBlockTheme) { 58908 return void 0; 58909 } 58910 const isTemplateActivateEnabled = typeof window !== "undefined" && window.__experimentalTemplateActivate; 58911 return isTemplateActivateEnabled ? /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(PageTemplates, {}) : /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(PageTemplates2, {}); 58912 } 58913 }, 58914 widths: { 58915 async content({ query }) { 58916 const isListView2 = await isTemplateListView(query); 58917 return isListView2 ? 380 : void 0; 58918 } 58919 } 58920 }; 58921 58922 // packages/edit-site/build-module/components/site-editor-routes/template-item.mjs 58923 var import_jsx_runtime327 = __toESM(require_jsx_runtime(), 1); 58924 var areas = { 58925 sidebar({ siteData }) { 58926 if (!isThemeDataLoaded(siteData)) { 58927 return null; 58928 } 58929 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(SidebarNavigationScreenUnsupported, {}); 58930 }, 58931 // Also rendered on mobile, where this route is only reached at canvas=edit. 58932 preview({ siteData }) { 58933 if (!isThemeDataLoaded(siteData)) { 58934 return null; 58935 } 58936 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(SidebarNavigationScreenUnsupported, {}); 58937 } 58938 }; 58939 var templateItemRoute = { 58940 name: "template-item", 58941 path: "/wp_template/*postId", 58942 areas 58943 }; 58944 58945 // packages/edit-site/build-module/components/site-editor-routes/pages.mjs 58946 var import_i18n158 = __toESM(require_i18n(), 1); 58947 var import_data87 = __toESM(require_data(), 1); 58948 var import_core_data69 = __toESM(require_core_data(), 1); 58949 58950 // packages/edit-site/build-module/components/post-list/index.mjs 58951 var import_components159 = __toESM(require_components(), 1); 58952 var import_core_data68 = __toESM(require_core_data(), 1); 58953 var import_element193 = __toESM(require_element(), 1); 58954 var import_router37 = __toESM(require_router(), 1); 58955 var import_data86 = __toESM(require_data(), 1); 58956 var import_editor41 = __toESM(require_editor(), 1); 58957 var import_compose34 = __toESM(require_compose(), 1); 58958 var import_url26 = __toESM(require_url(), 1); 58959 58960 // packages/edit-site/build-module/components/add-new-post/index.mjs 58961 var import_components157 = __toESM(require_components(), 1); 58962 var import_i18n156 = __toESM(require_i18n(), 1); 58963 var import_data84 = __toESM(require_data(), 1); 58964 var import_element190 = __toESM(require_element(), 1); 58965 var import_core_data65 = __toESM(require_core_data(), 1); 58966 var import_notices11 = __toESM(require_notices(), 1); 58967 var import_html_entities18 = __toESM(require_html_entities(), 1); 58968 var import_blocks14 = __toESM(require_blocks(), 1); 58969 var import_jsx_runtime328 = __toESM(require_jsx_runtime(), 1); 58970 function AddNewPostModal({ postType: postType2, onSave, onClose }) { 58971 const labels = (0, import_data84.useSelect)( 58972 (select4) => select4(import_core_data65.store).getPostType(postType2)?.labels, 58973 [postType2] 58974 ); 58975 const [isCreatingPost, setIsCreatingPost] = (0, import_element190.useState)(false); 58976 const [title, setTitle] = (0, import_element190.useState)(""); 58977 const { saveEntityRecord } = (0, import_data84.useDispatch)(import_core_data65.store); 58978 const { createErrorNotice, createSuccessNotice } = (0, import_data84.useDispatch)(import_notices11.store); 58979 const { resolveSelect: resolveSelect4 } = (0, import_data84.useRegistry)(); 58980 async function createPost(event) { 58981 event.preventDefault(); 58982 if (isCreatingPost) { 58983 return; 58984 } 58985 setIsCreatingPost(true); 58986 try { 58987 const postTypeObject = await resolveSelect4(import_core_data65.store).getPostType(postType2); 58988 const newPage = await saveEntityRecord( 58989 "postType", 58990 postType2, 58991 { 58992 status: "draft", 58993 title, 58994 slug: title ?? void 0, 58995 content: !!postTypeObject.template && postTypeObject.template.length ? (0, import_blocks14.serialize)( 58996 (0, import_blocks14.synchronizeBlocksWithTemplate)( 58997 [], 58998 postTypeObject.template 58999 ) 59000 ) : void 0 59001 }, 59002 { throwOnError: true } 59003 ); 59004 onSave(newPage); 59005 createSuccessNotice( 59006 (0, import_i18n156.sprintf)( 59007 // translators: %s: Title of the created post or template, e.g: "Hello world". 59008 (0, import_i18n156.__)('"%s" successfully created.'), 59009 (0, import_html_entities18.decodeEntities)(newPage.title?.rendered || title) || (0, import_i18n156.__)("(no title)") 59010 ), 59011 { type: "snackbar" } 59012 ); 59013 } catch (error2) { 59014 const errorMessage = error2.message && error2.code !== "unknown_error" ? error2.message : (0, import_i18n156.__)("An error occurred while creating the item."); 59015 createErrorNotice(errorMessage, { 59016 type: "snackbar" 59017 }); 59018 } finally { 59019 setIsCreatingPost(false); 59020 } 59021 } 59022 return /* @__PURE__ */ (0, import_jsx_runtime328.jsx)( 59023 import_components157.Modal, 59024 { 59025 title: ( 59026 // translators: %s: post type singular_name label e.g: "Page". 59027 (0, import_i18n156.sprintf)((0, import_i18n156.__)("Draft new: %s"), labels?.singular_name) 59028 ), 59029 onRequestClose: onClose, 59030 focusOnMount: "firstContentElement", 59031 size: "small", 59032 children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)("form", { onSubmit: createPost, children: /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)(import_components157.__experimentalVStack, { spacing: 4, children: [ 59033 /* @__PURE__ */ (0, import_jsx_runtime328.jsx)( 59034 import_components157.TextControl, 59035 { 59036 __next40pxDefaultSize: true, 59037 label: (0, import_i18n156.__)("Title"), 59038 onChange: setTitle, 59039 placeholder: (0, import_i18n156.__)("No title"), 59040 value: title 59041 } 59042 ), 59043 /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)(import_components157.__experimentalHStack, { spacing: 2, justify: "end", children: [ 59044 /* @__PURE__ */ (0, import_jsx_runtime328.jsx)( 59045 import_components157.Button, 59046 { 59047 __next40pxDefaultSize: true, 59048 variant: "tertiary", 59049 onClick: onClose, 59050 children: (0, import_i18n156.__)("Cancel") 59051 } 59052 ), 59053 /* @__PURE__ */ (0, import_jsx_runtime328.jsx)( 59054 import_components157.Button, 59055 { 59056 __next40pxDefaultSize: true, 59057 variant: "primary", 59058 type: "submit", 59059 isBusy: isCreatingPost, 59060 "aria-disabled": isCreatingPost, 59061 children: (0, import_i18n156.__)("Create draft") 59062 } 59063 ) 59064 ] }) 59065 ] }) }) 59066 } 59067 ); 59068 } 59069 59070 // packages/edit-site/build-module/components/post-list/use-notes-count.mjs 59071 var import_element191 = __toESM(require_element(), 1); 59072 var import_core_data66 = __toESM(require_core_data(), 1); 59073 function useNotesCount(postIds) { 59074 const { records: notes, isResolving } = (0, import_core_data66.useEntityRecords)( 59075 "root", 59076 "comment", 59077 { 59078 post: postIds, 59079 type: "note", 59080 status: "all", 59081 per_page: -1, 59082 _fields: "id,post" 59083 }, 59084 { 59085 enabled: postIds?.length > 0 59086 } 59087 ); 59088 const notesCount = (0, import_element191.useMemo)(() => { 59089 if (!notes || notes.length === 0) { 59090 return {}; 59091 } 59092 const counts = {}; 59093 notes.forEach((note) => { 59094 const postId = note.post; 59095 counts[postId] = (counts[postId] || 0) + 1; 59096 }); 59097 return counts; 59098 }, [notes]); 59099 return { notesCount, isResolving }; 59100 } 59101 59102 // packages/edit-site/build-module/components/post-list/quick-edit-modal.mjs 59103 var import_i18n157 = __toESM(require_i18n(), 1); 59104 var import_data85 = __toESM(require_data(), 1); 59105 var import_core_data67 = __toESM(require_core_data(), 1); 59106 var import_components158 = __toESM(require_components(), 1); 59107 var import_element192 = __toESM(require_element(), 1); 59108 var import_editor40 = __toESM(require_editor(), 1); 59109 var import_jsx_runtime329 = __toESM(require_jsx_runtime(), 1); 59110 var { usePostFields: usePostFields2, PostCardPanel } = unlock(import_editor40.privateApis); 59111 var fieldsWithBulkEditSupport = ["status", "date", "author", "discussion"]; 59112 function QuickEditModal({ 59113 postType: postType2, 59114 postId, 59115 closeModal, 59116 quickEditForm 59117 }) { 59118 const isBulk = postId.length > 1; 59119 const [localEdits, setLocalEdits] = (0, import_element192.useState)({}); 59120 const { record, hasFinishedResolution, canSwitchTemplate } = (0, import_data85.useSelect)( 59121 (select4) => { 59122 const { 59123 getEditedEntityRecord, 59124 hasFinishedResolution: hasFinished 59125 } = select4(import_core_data67.store); 59126 if (isBulk) { 59127 return { 59128 record: null, 59129 hasFinishedResolution: true 59130 }; 59131 } 59132 const args = ["postType", postType2, postId[0]]; 59133 const { getHomePage, getPostsPageId } = unlock( 59134 select4(import_core_data67.store) 59135 ); 59136 const singlePostId = String(postId[0]); 59137 const isPostsPage = singlePostId !== void 0 && getPostsPageId() === singlePostId; 59138 const isFrontPage = singlePostId !== void 0 && postType2 === "page" && getHomePage()?.postId === singlePostId; 59139 return { 59140 record: getEditedEntityRecord(...args), 59141 hasFinishedResolution: hasFinished( 59142 "getEditedEntityRecord", 59143 args 59144 ), 59145 canSwitchTemplate: !isPostsPage && !isFrontPage 59146 }; 59147 }, 59148 [postType2, postId, isBulk] 59149 ); 59150 const { editEntityRecord, saveEditedEntityRecord } = (0, import_data85.useDispatch)(import_core_data67.store); 59151 const _fields = usePostFields2({ postType: postType2 }); 59152 const fields2 = (0, import_element192.useMemo)( 59153 () => _fields?.map((field) => { 59154 if (field.id === "status") { 59155 return { 59156 ...field, 59157 elements: field.elements.filter( 59158 (element) => element.value !== "trash" 59159 ) 59160 }; 59161 } 59162 if (field.id === "template") { 59163 return { 59164 ...field, 59165 readOnly: !canSwitchTemplate 59166 }; 59167 } 59168 return field; 59169 }), 59170 [_fields, canSwitchTemplate] 59171 ); 59172 const form2 = (0, import_element192.useMemo)(() => { 59173 if (!quickEditForm) { 59174 return { layout: { type: "panel" }, fields: [] }; 59175 } 59176 if (!isBulk) { 59177 return quickEditForm; 59178 } 59179 return { 59180 ...quickEditForm, 59181 fields: (quickEditForm.fields ?? []).filter( 59182 (field) => fieldsWithBulkEditSupport.includes( 59183 typeof field === "string" ? field : field.id 59184 ) 59185 ) 59186 }; 59187 }, [isBulk, quickEditForm]); 59188 const onChange = (edits) => { 59189 const currentData = { ...record, ...localEdits }; 59190 if (edits.status && edits.status !== "future" && currentData?.status === "future" && new Date(currentData.date) > /* @__PURE__ */ new Date()) { 59191 edits.date = null; 59192 } 59193 if (edits.status && edits.status === "private" && currentData?.password) { 59194 edits.password = ""; 59195 } 59196 setLocalEdits((prev) => ({ ...prev, ...edits })); 59197 }; 59198 (0, import_element192.useEffect)(() => { 59199 setLocalEdits({}); 59200 }, [postId]); 59201 const onSave = async () => { 59202 for (const id of postId) { 59203 editEntityRecord("postType", postType2, id, localEdits); 59204 } 59205 if (isBulk) { 59206 await Promise.allSettled( 59207 postId.map( 59208 (id) => saveEditedEntityRecord("postType", postType2, id) 59209 ) 59210 ); 59211 } else { 59212 await saveEditedEntityRecord("postType", postType2, postId[0]); 59213 } 59214 closeModal?.(); 59215 }; 59216 return /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)( 59217 import_components158.Modal, 59218 { 59219 overlayClassName: "dataviews-action-modal__quick-edit", 59220 __experimentalHideHeader: true, 59221 onRequestClose: closeModal, 59222 focusOnMount: "firstElement", 59223 children: [ 59224 /* @__PURE__ */ (0, import_jsx_runtime329.jsx)("div", { className: "dataviews-action-modal__quick-edit-header", children: /* @__PURE__ */ (0, import_jsx_runtime329.jsx)( 59225 PostCardPanel, 59226 { 59227 postType: postType2, 59228 postId, 59229 hideActions: true 59230 } 59231 ) }), 59232 /* @__PURE__ */ (0, import_jsx_runtime329.jsx)("div", { className: "dataviews-action-modal__quick-edit-content", children: hasFinishedResolution && /* @__PURE__ */ (0, import_jsx_runtime329.jsx)( 59233 DataForm, 59234 { 59235 data: { ...record, ...localEdits }, 59236 fields: fields2, 59237 form: form2, 59238 onChange 59239 } 59240 ) }), 59241 /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)(import_components158.__experimentalHStack, { className: "dataviews-action-modal__quick-edit-footer", children: [ 59242 /* @__PURE__ */ (0, import_jsx_runtime329.jsx)( 59243 import_components158.Button, 59244 { 59245 __next40pxDefaultSize: true, 59246 variant: "secondary", 59247 onClick: closeModal, 59248 children: (0, import_i18n157.__)("Cancel") 59249 } 59250 ), 59251 /* @__PURE__ */ (0, import_jsx_runtime329.jsx)( 59252 import_components158.Button, 59253 { 59254 __next40pxDefaultSize: true, 59255 variant: "primary", 59256 onClick: onSave, 59257 children: (0, import_i18n157.__)("Done") 59258 } 59259 ) 59260 ] }) 59261 ] 59262 } 59263 ); 59264 } 59265 59266 // packages/edit-site/build-module/components/post-list/index.mjs 59267 var import_jsx_runtime330 = __toESM(require_jsx_runtime(), 1); 59268 var { usePostActions: usePostActions4, usePostFields: usePostFields3 } = unlock(import_editor41.privateApis); 59269 var { useLocation: useLocation31, useHistory: useHistory25 } = unlock(import_router37.privateApis); 59270 var { useEntityRecordsWithPermissions: useEntityRecordsWithPermissions4 } = unlock(import_core_data68.privateApis); 59271 var EMPTY_ARRAY15 = []; 59272 var DEFAULT_STATUSES = "draft,future,pending,private,publish"; 59273 function getItemId(item) { 59274 return item.id.toString(); 59275 } 59276 function getItemLevel(item) { 59277 return item.level; 59278 } 59279 function PostList({ postType: postType2 }) { 59280 const { path, query } = useLocation31(); 59281 const { activeView = "all", postId, quickEdit = false } = query; 59282 const history = useHistory25(); 59283 const { 59284 default_view: defaultView, 59285 default_layouts: defaultLayouts2, 59286 view_list: viewList, 59287 form: quickEditForm 59288 } = useViewConfig({ 59289 kind: "postType", 59290 name: postType2 59291 }); 59292 const activeViewOverrides = (0, import_element193.useMemo)( 59293 () => viewList?.find((v2) => v2.slug === activeView)?.view ?? {}, 59294 [viewList, activeView] 59295 ); 59296 const { view, updateView, isModified, resetToDefault } = useView({ 59297 kind: "postType", 59298 name: postType2, 59299 slug: "default", 59300 defaultView, 59301 defaultLayouts: defaultLayouts2, 59302 activeViewOverrides, 59303 queryParams: { 59304 page: query.pageNumber, 59305 search: query.search 59306 }, 59307 onChangeQueryParams: (newQueryParams) => { 59308 history.navigate( 59309 (0, import_url26.addQueryArgs)(path, { 59310 ...query, 59311 pageNumber: newQueryParams.page, 59312 search: newQueryParams.search || void 0 59313 }) 59314 ); 59315 } 59316 }); 59317 const onChangeView = (0, import_compose34.useEvent)((newView) => { 59318 updateView(newView); 59319 if (newView.type !== view.type) { 59320 history.invalidate(); 59321 } 59322 }); 59323 const [selection, setSelection] = (0, import_element193.useState)(postId?.split(",") ?? []); 59324 const onChangeSelection = (0, import_element193.useCallback)( 59325 (items) => { 59326 setSelection(items); 59327 history.navigate( 59328 (0, import_url26.addQueryArgs)(path, { 59329 postId: items.join(",") 59330 }) 59331 ); 59332 }, 59333 [path, history] 59334 ); 59335 (0, import_element193.useEffect)(() => { 59336 const newSelection = postId?.split(",") ?? []; 59337 setSelection(newSelection); 59338 }, [postId]); 59339 const fields2 = usePostFields3({ 59340 postType: postType2 59341 }); 59342 const queryArgs = (0, import_element193.useMemo)(() => { 59343 const filters = {}; 59344 view.filters?.forEach((filter) => { 59345 if (filter.field === "status" && filter.operator === OPERATOR_IS_ANY) { 59346 filters.status = filter.value; 59347 } 59348 if (filter.field === "author" && filter.operator === OPERATOR_IS_ANY) { 59349 filters.author = filter.value; 59350 } else if (filter.field === "author" && filter.operator === OPERATOR_IS_NONE) { 59351 filters.author_exclude = filter.value; 59352 } 59353 if (filter.field === "date") { 59354 if (!filter.value) { 59355 return; 59356 } 59357 if (filter.operator === OPERATOR_BEFORE) { 59358 filters.before = filter.value; 59359 } else if (filter.operator === OPERATOR_AFTER) { 59360 filters.after = filter.value; 59361 } 59362 } 59363 }); 59364 if (!filters.status || filters.status === "") { 59365 filters.status = DEFAULT_STATUSES; 59366 } 59367 return { 59368 per_page: view.perPage, 59369 page: view.page, 59370 _embed: "author,wp:featuredmedia", 59371 order: view.sort?.direction, 59372 orderby: view.sort?.field, 59373 orderby_hierarchy: !!view.showLevels, 59374 search: view.search, 59375 ...filters 59376 }; 59377 }, [view]); 59378 const { 59379 records, 59380 isResolving: isLoadingData, 59381 totalItems, 59382 totalPages, 59383 hasResolved 59384 } = useEntityRecordsWithPermissions4("postType", postType2, queryArgs); 59385 const postIds = (0, import_element193.useMemo)( 59386 () => records?.map((record) => record.id) ?? [], 59387 [records] 59388 ); 59389 const { notesCount, isLoading: isLoadingNotesCount } = useNotesCount(postIds); 59390 const data = (0, import_element193.useMemo)(() => { 59391 let processedRecords = records; 59392 if (view?.sort?.field === "author") { 59393 processedRecords = filterSortAndPaginate( 59394 records, 59395 { sort: { ...view.sort } }, 59396 fields2 59397 ).data; 59398 } 59399 if (processedRecords) { 59400 return processedRecords.map((record) => ({ 59401 ...record, 59402 notesCount: notesCount[record.id] ?? 0 59403 })); 59404 } 59405 return processedRecords; 59406 }, [records, fields2, view?.sort, notesCount]); 59407 const ids = data?.map((record) => getItemId(record)) ?? []; 59408 const prevIds = (0, import_compose34.usePrevious)(ids) ?? []; 59409 const deletedIds = prevIds.filter((id) => !ids.includes(id)); 59410 const postIdWasDeleted = deletedIds.includes(postId); 59411 (0, import_element193.useEffect)(() => { 59412 if (postIdWasDeleted) { 59413 history.navigate( 59414 (0, import_url26.addQueryArgs)(path, { 59415 postId: void 0 59416 }) 59417 ); 59418 } 59419 }, [history, postIdWasDeleted, path]); 59420 const paginationInfo = (0, import_element193.useMemo)( 59421 () => ({ 59422 totalItems, 59423 totalPages 59424 }), 59425 [totalItems, totalPages] 59426 ); 59427 const { labels, canCreateRecord } = (0, import_data86.useSelect)( 59428 (select4) => { 59429 const { getPostType: getPostType2, canUser } = select4(import_core_data68.store); 59430 return { 59431 labels: getPostType2(postType2)?.labels, 59432 canCreateRecord: canUser("create", { 59433 kind: "postType", 59434 name: postType2 59435 }) 59436 }; 59437 }, 59438 [postType2] 59439 ); 59440 const postTypeActions = usePostActions4({ 59441 postType: postType2, 59442 context: "list" 59443 }); 59444 const editAction = useEditPostAction(); 59445 const quickEditAction = useQuickEditPostAction(); 59446 const actions = (0, import_element193.useMemo)(() => { 59447 if (view.type === LAYOUT_LIST) { 59448 const editActionPrimary = { ...editAction, isPrimary: true }; 59449 return [editActionPrimary, ...postTypeActions]; 59450 } 59451 return [editAction, quickEditAction, ...postTypeActions]; 59452 }, [view.type, editAction, quickEditAction, postTypeActions]); 59453 const [showAddPostModal, setShowAddPostModal] = (0, import_element193.useState)(false); 59454 const openModal = () => setShowAddPostModal(true); 59455 const closeModal = () => setShowAddPostModal(false); 59456 const handleNewPage = ({ type, id }) => { 59457 history.navigate(`/$type}/$id}?canvas=edit`); 59458 closeModal(); 59459 }; 59460 const closeQuickEditModal = () => { 59461 history.navigate( 59462 (0, import_url26.addQueryArgs)(path, { 59463 ...query, 59464 quickEdit: void 0 59465 }) 59466 ); 59467 }; 59468 return /* @__PURE__ */ (0, import_jsx_runtime330.jsxs)( 59469 page_default2, 59470 { 59471 title: labels?.name, 59472 headingLevel: 2, 59473 actions: /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(import_jsx_runtime330.Fragment, { children: labels?.add_new_item && canCreateRecord && /* @__PURE__ */ (0, import_jsx_runtime330.jsxs)(import_jsx_runtime330.Fragment, { children: [ 59474 /* @__PURE__ */ (0, import_jsx_runtime330.jsx)( 59475 import_components159.Button, 59476 { 59477 variant: "primary", 59478 onClick: openModal, 59479 size: "compact", 59480 __next40pxDefaultSize: true, 59481 children: labels.add_new_item 59482 } 59483 ), 59484 showAddPostModal && /* @__PURE__ */ (0, import_jsx_runtime330.jsx)( 59485 AddNewPostModal, 59486 { 59487 postType: postType2, 59488 onSave: handleNewPage, 59489 onClose: closeModal 59490 } 59491 ) 59492 ] }) }), 59493 children: [ 59494 /* @__PURE__ */ (0, import_jsx_runtime330.jsx)( 59495 dataviews_default, 59496 { 59497 paginationInfo, 59498 fields: fields2, 59499 actions, 59500 data: data || EMPTY_ARRAY15, 59501 isLoading: isLoadingData || isLoadingNotesCount || !hasResolved, 59502 view, 59503 onChangeView, 59504 selection, 59505 onChangeSelection, 59506 isItemClickable: (item) => item.status !== "trash", 59507 onClickItem: ({ id }) => { 59508 history.navigate(`/$postType2}/$id}?canvas=edit`); 59509 }, 59510 getItemId, 59511 getItemLevel, 59512 defaultLayouts: defaultLayouts2, 59513 onReset: isModified ? () => { 59514 resetToDefault(); 59515 history.invalidate(); 59516 } : false 59517 }, 59518 activeView 59519 ), 59520 quickEdit && !isLoadingData && selection.length > 0 && view.type !== LAYOUT_LIST && /* @__PURE__ */ (0, import_jsx_runtime330.jsx)( 59521 QuickEditModal, 59522 { 59523 postType: postType2, 59524 postId: selection, 59525 closeModal: closeQuickEditModal, 59526 quickEditForm 59527 } 59528 ) 59529 ] 59530 } 59531 ); 59532 } 59533 59534 // packages/edit-site/build-module/components/site-editor-routes/pages.mjs 59535 var import_jsx_runtime331 = __toESM(require_jsx_runtime(), 1); 59536 async function isListView(query) { 59537 const { activeView = "all" } = query; 59538 const config2 = await unlock((0, import_data87.resolveSelect)(import_core_data69.store)).getViewConfig( 59539 "postType", 59540 "page" 59541 ); 59542 const defaultView = config2?.default_view; 59543 const defaultLayouts2 = config2?.default_layouts; 59544 const viewEntry = config2?.view_list?.find((v2) => v2.slug === activeView); 59545 const view = await loadView({ 59546 kind: "postType", 59547 name: "page", 59548 slug: "default", 59549 defaultView, 59550 defaultLayouts: defaultLayouts2, 59551 activeViewOverrides: viewEntry?.view ?? {} 59552 }); 59553 return view.type === "list"; 59554 } 59555 var pagesRoute = { 59556 name: "pages", 59557 path: "/page", 59558 areas: { 59559 sidebar({ siteData }) { 59560 if (!isThemeDataLoaded(siteData)) { 59561 return null; 59562 } 59563 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime331.jsx)( 59564 SidebarNavigationScreen, 59565 { 59566 title: (0, import_i18n158.__)("Pages"), 59567 backPath: "/", 59568 content: /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(DataViewsSidebarContent, { postType: "page" }) 59569 } 59570 ) : /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(SidebarNavigationScreenUnsupported, {}); 59571 }, 59572 content({ siteData }) { 59573 const isBlockTheme = siteData.currentTheme?.is_block_theme; 59574 return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(PostList, { postType: "page" }) : void 0; 59575 }, 59576 async preview({ query, siteData }) { 59577 const isBlockTheme = siteData.currentTheme?.is_block_theme; 59578 if (!isBlockTheme) { 59579 return void 0; 59580 } 59581 const isList = await isListView(query); 59582 return isList ? /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(EditSiteEditor, {}) : void 0; 59583 }, 59584 mobileSidebar({ siteData }) { 59585 if (!isThemeDataLoaded(siteData)) { 59586 return /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(import_jsx_runtime331.Fragment, {}); 59587 } 59588 return siteData.currentTheme.is_block_theme ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(SidebarNavigationScreenUnsupported, {}); 59589 }, 59590 mobileContent({ siteData }) { 59591 const isBlockTheme = siteData.currentTheme?.is_block_theme; 59592 return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(PostList, { postType: "page" }) : void 0; 59593 } 59594 }, 59595 widths: { 59596 async content({ query }) { 59597 const isList = await isListView(query); 59598 return isList ? 380 : void 0; 59599 } 59600 } 59601 }; 59602 59603 // packages/edit-site/build-module/components/site-editor-routes/page-item.mjs 59604 var import_i18n159 = __toESM(require_i18n(), 1); 59605 var import_jsx_runtime332 = __toESM(require_jsx_runtime(), 1); 59606 var pageItemRoute = { 59607 name: "page-item", 59608 path: "/page/:postId", 59609 areas: { 59610 sidebar({ siteData }) { 59611 if (!isThemeDataLoaded(siteData)) { 59612 return null; 59613 } 59614 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime332.jsx)( 59615 SidebarNavigationScreen, 59616 { 59617 title: (0, import_i18n159.__)("Pages"), 59618 backPath: "/", 59619 content: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(DataViewsSidebarContent, { postType: "page" }) 59620 } 59621 ) : /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(SidebarNavigationScreenUnsupported, {}); 59622 }, 59623 // Also rendered on mobile, where this route is only reached at canvas=edit. 59624 preview({ siteData }) { 59625 if (!isThemeDataLoaded(siteData)) { 59626 return null; 59627 } 59628 return siteData.currentTheme.is_block_theme ? /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(SidebarNavigationScreenUnsupported, {}); 59629 } 59630 } 59631 }; 59632 59633 // packages/edit-site/build-module/components/site-editor-routes/stylebook.mjs 59634 var import_i18n160 = __toESM(require_i18n(), 1); 59635 var import_editor44 = __toESM(require_editor(), 1); 59636 var import_jsx_runtime333 = __toESM(require_jsx_runtime(), 1); 59637 var { StyleBookPreview: StyleBookPreview2 } = unlock(import_editor44.privateApis); 59638 var stylebookRoute = { 59639 name: "stylebook", 59640 path: "/stylebook", 59641 areas: { 59642 sidebar({ siteData }) { 59643 if (!isThemeDataLoaded(siteData)) { 59644 return null; 59645 } 59646 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime333.jsx)( 59647 SidebarNavigationScreen, 59648 { 59649 title: (0, import_i18n160.__)("Styles"), 59650 backPath: "/", 59651 description: (0, import_i18n160.__)( 59652 `Preview your website's visual identity: colors, typography, and blocks.` 59653 ) 59654 } 59655 ) : /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(SidebarNavigationScreenUnsupported, {}); 59656 }, 59657 preview({ siteData }) { 59658 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime333.jsx)( 59659 StyleBookPreview2, 59660 { 59661 isStatic: true, 59662 settings: siteData.editorSettings 59663 } 59664 ) : void 0; 59665 }, 59666 mobileContent({ siteData }) { 59667 return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime333.jsx)( 59668 StyleBookPreview2, 59669 { 59670 isStatic: true, 59671 settings: siteData.editorSettings 59672 } 59673 ) : void 0; 59674 } 59675 } 59676 }; 59677 59678 // packages/edit-site/build-module/components/site-editor-routes/notfound.mjs 59679 var import_i18n161 = __toESM(require_i18n(), 1); 59680 var import_components160 = __toESM(require_components(), 1); 59681 var import_jsx_runtime334 = __toESM(require_jsx_runtime(), 1); 59682 function NotFoundError() { 59683 return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(import_components160.Notice, { status: "error", isDismissible: false, children: (0, import_i18n161.__)( 59684 "The requested page could not be found. Please check the URL." 59685 ) }); 59686 } 59687 var notFoundRoute = { 59688 name: "notfound", 59689 path: "*", 59690 areas: { 59691 sidebar: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(SidebarNavigationScreenMain, {}), 59692 mobileSidebar: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)( 59693 SidebarNavigationScreenMain, 59694 { 59695 customDescription: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(NotFoundError, {}) 59696 } 59697 ), 59698 content: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(import_components160.__experimentalSpacer, { padding: 2, children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(NotFoundError, {}) }) 59699 } 59700 }; 59701 59702 // packages/edit-site/build-module/components/site-editor-routes/index.mjs 59703 var routes2 = [ 59704 pageItemRoute, 59705 pagesRoute, 59706 templateItemRoute, 59707 templatesRoute, 59708 templatePartItemRoute, 59709 patternItemRoute, 59710 patternsRoute, 59711 navigationItemRoute, 59712 navigationRoute, 59713 identityRoute, 59714 stylesRoute, 59715 homeRoute, 59716 stylebookRoute, 59717 notFoundRoute 59718 ]; 59719 function useRegisterSiteEditorRoutes() { 59720 const registry = (0, import_data88.useRegistry)(); 59721 const { registerRoute: registerRoute2 } = unlock((0, import_data88.useDispatch)(store)); 59722 (0, import_element194.useEffect)(() => { 59723 registry.batch(() => { 59724 routes2.forEach(registerRoute2); 59725 }); 59726 }, [registry, registerRoute2]); 59727 } 59728 59729 // packages/edit-site/build-module/components/app/index.mjs 59730 var import_jsx_runtime335 = __toESM(require_jsx_runtime(), 1); 59731 var { RouterProvider } = unlock(import_router38.privateApis); 59732 function AppLayout() { 59733 useCommonCommands(); 59734 useSetCommandContext(); 59735 return /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(LayoutWithGlobalStylesProvider, {}); 59736 } 59737 function App() { 59738 useRegisterSiteEditorRoutes(); 59739 const { routes: routes3, currentTheme, editorSettings } = (0, import_data89.useSelect)((select4) => { 59740 return { 59741 routes: unlock(select4(store)).getRoutes(), 59742 currentTheme: select4(import_core_data70.store).getCurrentTheme(), 59743 // This is a temp solution until the has_theme_json value is available for the current theme. 59744 editorSettings: select4(store).getSettings() 59745 }; 59746 }, []); 59747 const beforeNavigate = (0, import_element195.useCallback)(({ path, query }) => { 59748 if (!isPreviewingTheme()) { 59749 return { path, query }; 59750 } 59751 return { 59752 path, 59753 query: { 59754 ...query, 59755 wp_theme_preview: "wp_theme_preview" in query ? query.wp_theme_preview : currentlyPreviewingTheme() 59756 } 59757 }; 59758 }, []); 59759 const matchResolverArgsValue = (0, import_element195.useMemo)( 59760 () => ({ 59761 siteData: { currentTheme, editorSettings } 59762 }), 59763 [currentTheme, editorSettings] 59764 ); 59765 return /* @__PURE__ */ (0, import_jsx_runtime335.jsx)( 59766 RouterProvider, 59767 { 59768 routes: routes3, 59769 pathArg: "p", 59770 beforeNavigate, 59771 matchResolverArgs: matchResolverArgsValue, 59772 children: /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(AppLayout, {}) 59773 } 59774 ); 59775 } 59776 59777 // packages/edit-site/build-module/deprecated.mjs 59778 var import_editor45 = __toESM(require_editor(), 1); 59779 var import_url27 = __toESM(require_url(), 1); 59780 var import_deprecated5 = __toESM(require_deprecated(), 1); 59781 var import_jsx_runtime336 = __toESM(require_jsx_runtime(), 1); 59782 var isSiteEditor = (0, import_url27.getPath)(window.location.href)?.includes( 59783 "site-editor.php" 59784 ); 59785 var deprecateSlot = (name2) => { 59786 (0, import_deprecated5.default)(`wp.editPost.$name2}`, { 59787 since: "6.6", 59788 alternative: `wp.editor.$name2}` 59789 }); 59790 }; 59791 function PluginMoreMenuItem(props) { 59792 if (!isSiteEditor) { 59793 return null; 59794 } 59795 deprecateSlot("PluginMoreMenuItem"); 59796 return /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(import_editor45.PluginMoreMenuItem, { ...props }); 59797 } 59798 function PluginSidebar(props) { 59799 if (!isSiteEditor) { 59800 return null; 59801 } 59802 deprecateSlot("PluginSidebar"); 59803 return /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(import_editor45.PluginSidebar, { ...props }); 59804 } 59805 function PluginSidebarMoreMenuItem(props) { 59806 if (!isSiteEditor) { 59807 return null; 59808 } 59809 deprecateSlot("PluginSidebarMoreMenuItem"); 59810 return /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(import_editor45.PluginSidebarMoreMenuItem, { ...props }); 59811 } 59812 59813 // packages/edit-site/build-module/index.mjs 59814 var import_jsx_runtime337 = __toESM(require_jsx_runtime(), 1); 59815 var { registerCoreBlockBindingsSources } = unlock(import_editor46.privateApis); 59816 function initializeEditor(id, settings2) { 59817 const target = document.getElementById(id); 59818 const root = (0, import_element196.createRoot)(target); 59819 (0, import_data90.dispatch)(import_blocks15.store).reapplyBlockTypeFilters(); 59820 const coreBlocks = (0, import_block_library4.__experimentalGetCoreBlocks)().filter( 59821 ({ name: name2 }) => name2 !== "core/freeform" 59822 ); 59823 (0, import_block_library4.registerCoreBlocks)(coreBlocks); 59824 registerCoreBlockBindingsSources(); 59825 (0, import_data90.dispatch)(import_blocks15.store).setFreeformFallbackBlockName("core/html"); 59826 (0, import_widgets.registerLegacyWidgetBlock)({ inserter: false }); 59827 (0, import_widgets.registerWidgetGroupBlock)({ inserter: false }); 59828 if (false) { 59829 (0, import_block_library4.__experimentalRegisterExperimentalCoreBlocks)({ 59830 enableFSEBlocks: true 59831 }); 59832 } 59833 (0, import_data90.dispatch)(import_preferences13.store).setDefaults("core/edit-site", { 59834 welcomeGuide: true, 59835 welcomeGuideStyles: true, 59836 welcomeGuidePage: true, 59837 welcomeGuideTemplate: true 59838 }); 59839 (0, import_data90.dispatch)(import_preferences13.store).setDefaults("core", { 59840 allowRightClickOverrides: true, 59841 distractionFree: false, 59842 editorMode: "visual", 59843 editorTool: "edit", 59844 fixedToolbar: false, 59845 focusMode: false, 59846 inactivePanels: [], 59847 keepCaretInsideBlock: false, 59848 openPanels: ["post-status"], 59849 showBlockBreadcrumbs: true, 59850 showListViewByDefault: false, 59851 enableChoosePatternModal: true, 59852 showCollaborationCursor: false, 59853 showCollaborationNotifications: true 59854 }); 59855 if (window.__clientSideMediaProcessing) { 59856 (0, import_data90.dispatch)(import_preferences13.store).setDefaults("core/media", { 59857 requireApproval: true, 59858 optimizeOnUpload: true 59859 }); 59860 } 59861 (0, import_data90.dispatch)(store).updateSettings(settings2); 59862 window.addEventListener("dragover", (e2) => e2.preventDefault(), false); 59863 window.addEventListener("drop", (e2) => e2.preventDefault(), false); 59864 root.render( 59865 /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(import_element196.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(App, {}) }) 59866 ); 59867 return root; 59868 } 59869 function reinitializeEditor() { 59870 (0, import_deprecated6.default)("wp.editSite.reinitializeEditor", { 59871 since: "6.2", 59872 version: "6.3" 59873 }); 59874 } 59875 return __toCommonJS(index_exports); 59876 })(); 59877 /*! Bundled license information: 59878 59879 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 59880 (** 59881 * @license React 59882 * use-sync-external-store-shim.development.js 59883 * 59884 * Copyright (c) Meta Platforms, Inc. and affiliates. 59885 * 59886 * This source code is licensed under the MIT license found in the 59887 * LICENSE file in the root directory of this source tree. 59888 *) 59889 59890 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 59891 (** 59892 * @license React 59893 * use-sync-external-store-shim/with-selector.development.js 59894 * 59895 * Copyright (c) Meta Platforms, Inc. and affiliates. 59896 * 59897 * This source code is licensed under the MIT license found in the 59898 * LICENSE file in the root directory of this source tree. 59899 *) 59900 59901 is-plain-object/dist/is-plain-object.mjs: 59902 (*! 59903 * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 59904 * 59905 * Copyright (c) 2014-2017, Jon Schlinkert. 59906 * Released under the MIT License. 59907 *) 59908 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Fri Jul 10 08:20:14 2026 | Cross-referenced by PHPXref |