[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> edit-site.js (source)

   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    // package-external:@wordpress/components
 140    var require_components = __commonJS({
 141      "package-external:@wordpress/components"(exports, module) {
 142        module.exports = window.wp.components;
 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
 154    var require_react = __commonJS({
 155      "vendor-external:react"(exports, module) {
 156        module.exports = window.React;
 157      }
 158    });
 159  
 160    // vendor-external:react-dom
 161    var require_react_dom = __commonJS({
 162      "vendor-external:react-dom"(exports, module) {
 163        module.exports = window.ReactDOM;
 164      }
 165    });
 166  
 167    // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
 168    var require_use_sync_external_store_shim_development = __commonJS({
 169      "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
 170        "use strict";
 171        (function() {
 172          function is2(x2, y2) {
 173            return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
 174          }
 175          function useSyncExternalStore$2(subscribe2, getSnapshot) {
 176            didWarnOld18Alpha || void 0 === React10.startTransition || (didWarnOld18Alpha = true, console.error(
 177              "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."
 178            ));
 179            var value = getSnapshot();
 180            if (!didWarnUncachedGetSnapshot) {
 181              var cachedValue = getSnapshot();
 182              objectIs(value, cachedValue) || (console.error(
 183                "The result of getSnapshot should be cached to avoid an infinite loop"
 184              ), didWarnUncachedGetSnapshot = true);
 185            }
 186            cachedValue = useState71({
 187              inst: { value, getSnapshot }
 188            });
 189            var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
 190            useLayoutEffect7(
 191              function() {
 192                inst.value = value;
 193                inst.getSnapshot = getSnapshot;
 194                checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 195              },
 196              [subscribe2, value, getSnapshot]
 197            );
 198            useEffect51(
 199              function() {
 200                checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 201                return subscribe2(function() {
 202                  checkIfSnapshotChanged(inst) && forceUpdate({ inst });
 203                });
 204              },
 205              [subscribe2]
 206            );
 207            useDebugValue(value);
 208            return value;
 209          }
 210          function checkIfSnapshotChanged(inst) {
 211            var latestGetSnapshot = inst.getSnapshot;
 212            inst = inst.value;
 213            try {
 214              var nextValue = latestGetSnapshot();
 215              return !objectIs(inst, nextValue);
 216            } catch (error) {
 217              return true;
 218            }
 219          }
 220          function useSyncExternalStore$1(subscribe2, getSnapshot) {
 221            return getSnapshot();
 222          }
 223          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
 224          var React10 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is2, useState71 = React10.useState, useEffect51 = React10.useEffect, useLayoutEffect7 = React10.useLayoutEffect, useDebugValue = React10.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
 225          exports.useSyncExternalStore = void 0 !== React10.useSyncExternalStore ? React10.useSyncExternalStore : shim;
 226          "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
 227        })();
 228      }
 229    });
 230  
 231    // node_modules/use-sync-external-store/shim/index.js
 232    var require_shim = __commonJS({
 233      "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
 234        "use strict";
 235        if (false) {
 236          module.exports = null;
 237        } else {
 238          module.exports = require_use_sync_external_store_shim_development();
 239        }
 240      }
 241    });
 242  
 243    // package-external:@wordpress/a11y
 244    var require_a11y = __commonJS({
 245      "package-external:@wordpress/a11y"(exports, module) {
 246        module.exports = window.wp.a11y;
 247      }
 248    });
 249  
 250    // package-external:@wordpress/primitives
 251    var require_primitives = __commonJS({
 252      "package-external:@wordpress/primitives"(exports, module) {
 253        module.exports = window.wp.primitives;
 254      }
 255    });
 256  
 257    // package-external:@wordpress/compose
 258    var require_compose = __commonJS({
 259      "package-external:@wordpress/compose"(exports, module) {
 260        module.exports = window.wp.compose;
 261      }
 262    });
 263  
 264    // package-external:@wordpress/plugins
 265    var require_plugins = __commonJS({
 266      "package-external:@wordpress/plugins"(exports, module) {
 267        module.exports = window.wp.plugins;
 268      }
 269    });
 270  
 271    // package-external:@wordpress/notices
 272    var require_notices = __commonJS({
 273      "package-external:@wordpress/notices"(exports, module) {
 274        module.exports = window.wp.notices;
 275      }
 276    });
 277  
 278    // package-external:@wordpress/html-entities
 279    var require_html_entities = __commonJS({
 280      "package-external:@wordpress/html-entities"(exports, module) {
 281        module.exports = window.wp.htmlEntities;
 282      }
 283    });
 284  
 285    // package-external:@wordpress/commands
 286    var require_commands = __commonJS({
 287      "package-external:@wordpress/commands"(exports, module) {
 288        module.exports = window.wp.commands;
 289      }
 290    });
 291  
 292    // package-external:@wordpress/keycodes
 293    var require_keycodes = __commonJS({
 294      "package-external:@wordpress/keycodes"(exports, module) {
 295        module.exports = window.wp.keycodes;
 296      }
 297    });
 298  
 299    // package-external:@wordpress/url
 300    var require_url = __commonJS({
 301      "package-external:@wordpress/url"(exports, module) {
 302        module.exports = window.wp.url;
 303      }
 304    });
 305  
 306    // package-external:@wordpress/dom
 307    var require_dom = __commonJS({
 308      "package-external:@wordpress/dom"(exports, module) {
 309        module.exports = window.wp.dom;
 310      }
 311    });
 312  
 313    // package-external:@wordpress/keyboard-shortcuts
 314    var require_keyboard_shortcuts = __commonJS({
 315      "package-external:@wordpress/keyboard-shortcuts"(exports, module) {
 316        module.exports = window.wp.keyboardShortcuts;
 317      }
 318    });
 319  
 320    // package-external:@wordpress/api-fetch
 321    var require_api_fetch = __commonJS({
 322      "package-external:@wordpress/api-fetch"(exports, module) {
 323        module.exports = window.wp.apiFetch;
 324      }
 325    });
 326  
 327    // package-external:@wordpress/style-engine
 328    var require_style_engine = __commonJS({
 329      "package-external:@wordpress/style-engine"(exports, module) {
 330        module.exports = window.wp.styleEngine;
 331      }
 332    });
 333  
 334    // node_modules/fast-deep-equal/es6/index.js
 335    var require_es6 = __commonJS({
 336      "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
 337        "use strict";
 338        module.exports = function equal(a2, b2) {
 339          if (a2 === b2) return true;
 340          if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
 341            if (a2.constructor !== b2.constructor) return false;
 342            var length, i2, keys;
 343            if (Array.isArray(a2)) {
 344              length = a2.length;
 345              if (length != b2.length) return false;
 346              for (i2 = length; i2-- !== 0; )
 347                if (!equal(a2[i2], b2[i2])) return false;
 348              return true;
 349            }
 350            if (a2 instanceof Map && b2 instanceof Map) {
 351              if (a2.size !== b2.size) return false;
 352              for (i2 of a2.entries())
 353                if (!b2.has(i2[0])) return false;
 354              for (i2 of a2.entries())
 355                if (!equal(i2[1], b2.get(i2[0]))) return false;
 356              return true;
 357            }
 358            if (a2 instanceof Set && b2 instanceof Set) {
 359              if (a2.size !== b2.size) return false;
 360              for (i2 of a2.entries())
 361                if (!b2.has(i2[0])) return false;
 362              return true;
 363            }
 364            if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
 365              length = a2.length;
 366              if (length != b2.length) return false;
 367              for (i2 = length; i2-- !== 0; )
 368                if (a2[i2] !== b2[i2]) return false;
 369              return true;
 370            }
 371            if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
 372            if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
 373            if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
 374            keys = Object.keys(a2);
 375            length = keys.length;
 376            if (length !== Object.keys(b2).length) return false;
 377            for (i2 = length; i2-- !== 0; )
 378              if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
 379            for (i2 = length; i2-- !== 0; ) {
 380              var key = keys[i2];
 381              if (!equal(a2[key], b2[key])) return false;
 382            }
 383            return true;
 384          }
 385          return a2 !== a2 && b2 !== b2;
 386        };
 387      }
 388    });
 389  
 390    // node_modules/deepmerge/dist/cjs.js
 391    var require_cjs = __commonJS({
 392      "node_modules/deepmerge/dist/cjs.js"(exports, module) {
 393        "use strict";
 394        var isMergeableObject = function isMergeableObject2(value) {
 395          return isNonNullObject(value) && !isSpecial(value);
 396        };
 397        function isNonNullObject(value) {
 398          return !!value && typeof value === "object";
 399        }
 400        function isSpecial(value) {
 401          var stringValue = Object.prototype.toString.call(value);
 402          return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
 403        }
 404        var canUseSymbol = typeof Symbol === "function" && Symbol.for;
 405        var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
 406        function isReactElement(value) {
 407          return value.$$typeof === REACT_ELEMENT_TYPE;
 408        }
 409        function emptyTarget(val) {
 410          return Array.isArray(val) ? [] : {};
 411        }
 412        function cloneUnlessOtherwiseSpecified(value, options) {
 413          return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
 414        }
 415        function defaultArrayMerge(target, source, options) {
 416          return target.concat(source).map(function(element) {
 417            return cloneUnlessOtherwiseSpecified(element, options);
 418          });
 419        }
 420        function getMergeFunction(key, options) {
 421          if (!options.customMerge) {
 422            return deepmerge2;
 423          }
 424          var customMerge = options.customMerge(key);
 425          return typeof customMerge === "function" ? customMerge : deepmerge2;
 426        }
 427        function getEnumerableOwnPropertySymbols(target) {
 428          return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol3) {
 429            return Object.propertyIsEnumerable.call(target, symbol3);
 430          }) : [];
 431        }
 432        function getKeys2(target) {
 433          return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
 434        }
 435        function propertyIsOnObject(object, property) {
 436          try {
 437            return property in object;
 438          } catch (_) {
 439            return false;
 440          }
 441        }
 442        function propertyIsUnsafe(target, key) {
 443          return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
 444        }
 445        function mergeObject(target, source, options) {
 446          var destination = {};
 447          if (options.isMergeableObject(target)) {
 448            getKeys2(target).forEach(function(key) {
 449              destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
 450            });
 451          }
 452          getKeys2(source).forEach(function(key) {
 453            if (propertyIsUnsafe(target, key)) {
 454              return;
 455            }
 456            if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
 457              destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
 458            } else {
 459              destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
 460            }
 461          });
 462          return destination;
 463        }
 464        function deepmerge2(target, source, options) {
 465          options = options || {};
 466          options.arrayMerge = options.arrayMerge || defaultArrayMerge;
 467          options.isMergeableObject = options.isMergeableObject || isMergeableObject;
 468          options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
 469          var sourceIsArray = Array.isArray(source);
 470          var targetIsArray = Array.isArray(target);
 471          var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
 472          if (!sourceAndTargetTypesMatch) {
 473            return cloneUnlessOtherwiseSpecified(source, options);
 474          } else if (sourceIsArray) {
 475            return options.arrayMerge(target, source, options);
 476          } else {
 477            return mergeObject(target, source, options);
 478          }
 479        }
 480        deepmerge2.all = function deepmergeAll(array, options) {
 481          if (!Array.isArray(array)) {
 482            throw new Error("first argument should be an array");
 483          }
 484          return array.reduce(function(prev, next) {
 485            return deepmerge2(prev, next, options);
 486          }, {});
 487        };
 488        var deepmerge_1 = deepmerge2;
 489        module.exports = deepmerge_1;
 490      }
 491    });
 492  
 493    // package-external:@wordpress/date
 494    var require_date = __commonJS({
 495      "package-external:@wordpress/date"(exports, module) {
 496        module.exports = window.wp.date;
 497      }
 498    });
 499  
 500    // package-external:@wordpress/blob
 501    var require_blob = __commonJS({
 502      "package-external:@wordpress/blob"(exports, module) {
 503        module.exports = window.wp.blob;
 504      }
 505    });
 506  
 507    // node_modules/remove-accents/index.js
 508    var require_remove_accents = __commonJS({
 509      "node_modules/remove-accents/index.js"(exports, module) {
 510        var characterMap = {
 511          "\xC0": "A",
 512          "\xC1": "A",
 513          "\xC2": "A",
 514          "\xC3": "A",
 515          "\xC4": "A",
 516          "\xC5": "A",
 517          "\u1EA4": "A",
 518          "\u1EAE": "A",
 519          "\u1EB2": "A",
 520          "\u1EB4": "A",
 521          "\u1EB6": "A",
 522          "\xC6": "AE",
 523          "\u1EA6": "A",
 524          "\u1EB0": "A",
 525          "\u0202": "A",
 526          "\u1EA2": "A",
 527          "\u1EA0": "A",
 528          "\u1EA8": "A",
 529          "\u1EAA": "A",
 530          "\u1EAC": "A",
 531          "\xC7": "C",
 532          "\u1E08": "C",
 533          "\xC8": "E",
 534          "\xC9": "E",
 535          "\xCA": "E",
 536          "\xCB": "E",
 537          "\u1EBE": "E",
 538          "\u1E16": "E",
 539          "\u1EC0": "E",
 540          "\u1E14": "E",
 541          "\u1E1C": "E",
 542          "\u0206": "E",
 543          "\u1EBA": "E",
 544          "\u1EBC": "E",
 545          "\u1EB8": "E",
 546          "\u1EC2": "E",
 547          "\u1EC4": "E",
 548          "\u1EC6": "E",
 549          "\xCC": "I",
 550          "\xCD": "I",
 551          "\xCE": "I",
 552          "\xCF": "I",
 553          "\u1E2E": "I",
 554          "\u020A": "I",
 555          "\u1EC8": "I",
 556          "\u1ECA": "I",
 557          "\xD0": "D",
 558          "\xD1": "N",
 559          "\xD2": "O",
 560          "\xD3": "O",
 561          "\xD4": "O",
 562          "\xD5": "O",
 563          "\xD6": "O",
 564          "\xD8": "O",
 565          "\u1ED0": "O",
 566          "\u1E4C": "O",
 567          "\u1E52": "O",
 568          "\u020E": "O",
 569          "\u1ECE": "O",
 570          "\u1ECC": "O",
 571          "\u1ED4": "O",
 572          "\u1ED6": "O",
 573          "\u1ED8": "O",
 574          "\u1EDC": "O",
 575          "\u1EDE": "O",
 576          "\u1EE0": "O",
 577          "\u1EDA": "O",
 578          "\u1EE2": "O",
 579          "\xD9": "U",
 580          "\xDA": "U",
 581          "\xDB": "U",
 582          "\xDC": "U",
 583          "\u1EE6": "U",
 584          "\u1EE4": "U",
 585          "\u1EEC": "U",
 586          "\u1EEE": "U",
 587          "\u1EF0": "U",
 588          "\xDD": "Y",
 589          "\xE0": "a",
 590          "\xE1": "a",
 591          "\xE2": "a",
 592          "\xE3": "a",
 593          "\xE4": "a",
 594          "\xE5": "a",
 595          "\u1EA5": "a",
 596          "\u1EAF": "a",
 597          "\u1EB3": "a",
 598          "\u1EB5": "a",
 599          "\u1EB7": "a",
 600          "\xE6": "ae",
 601          "\u1EA7": "a",
 602          "\u1EB1": "a",
 603          "\u0203": "a",
 604          "\u1EA3": "a",
 605          "\u1EA1": "a",
 606          "\u1EA9": "a",
 607          "\u1EAB": "a",
 608          "\u1EAD": "a",
 609          "\xE7": "c",
 610          "\u1E09": "c",
 611          "\xE8": "e",
 612          "\xE9": "e",
 613          "\xEA": "e",
 614          "\xEB": "e",
 615          "\u1EBF": "e",
 616          "\u1E17": "e",
 617          "\u1EC1": "e",
 618          "\u1E15": "e",
 619          "\u1E1D": "e",
 620          "\u0207": "e",
 621          "\u1EBB": "e",
 622          "\u1EBD": "e",
 623          "\u1EB9": "e",
 624          "\u1EC3": "e",
 625          "\u1EC5": "e",
 626          "\u1EC7": "e",
 627          "\xEC": "i",
 628          "\xED": "i",
 629          "\xEE": "i",
 630          "\xEF": "i",
 631          "\u1E2F": "i",
 632          "\u020B": "i",
 633          "\u1EC9": "i",
 634          "\u1ECB": "i",
 635          "\xF0": "d",
 636          "\xF1": "n",
 637          "\xF2": "o",
 638          "\xF3": "o",
 639          "\xF4": "o",
 640          "\xF5": "o",
 641          "\xF6": "o",
 642          "\xF8": "o",
 643          "\u1ED1": "o",
 644          "\u1E4D": "o",
 645          "\u1E53": "o",
 646          "\u020F": "o",
 647          "\u1ECF": "o",
 648          "\u1ECD": "o",
 649          "\u1ED5": "o",
 650          "\u1ED7": "o",
 651          "\u1ED9": "o",
 652          "\u1EDD": "o",
 653          "\u1EDF": "o",
 654          "\u1EE1": "o",
 655          "\u1EDB": "o",
 656          "\u1EE3": "o",
 657          "\xF9": "u",
 658          "\xFA": "u",
 659          "\xFB": "u",
 660          "\xFC": "u",
 661          "\u1EE7": "u",
 662          "\u1EE5": "u",
 663          "\u1EED": "u",
 664          "\u1EEF": "u",
 665          "\u1EF1": "u",
 666          "\xFD": "y",
 667          "\xFF": "y",
 668          "\u0100": "A",
 669          "\u0101": "a",
 670          "\u0102": "A",
 671          "\u0103": "a",
 672          "\u0104": "A",
 673          "\u0105": "a",
 674          "\u0106": "C",
 675          "\u0107": "c",
 676          "\u0108": "C",
 677          "\u0109": "c",
 678          "\u010A": "C",
 679          "\u010B": "c",
 680          "\u010C": "C",
 681          "\u010D": "c",
 682          "C\u0306": "C",
 683          "c\u0306": "c",
 684          "\u010E": "D",
 685          "\u010F": "d",
 686          "\u0110": "D",
 687          "\u0111": "d",
 688          "\u0112": "E",
 689          "\u0113": "e",
 690          "\u0114": "E",
 691          "\u0115": "e",
 692          "\u0116": "E",
 693          "\u0117": "e",
 694          "\u0118": "E",
 695          "\u0119": "e",
 696          "\u011A": "E",
 697          "\u011B": "e",
 698          "\u011C": "G",
 699          "\u01F4": "G",
 700          "\u011D": "g",
 701          "\u01F5": "g",
 702          "\u011E": "G",
 703          "\u011F": "g",
 704          "\u0120": "G",
 705          "\u0121": "g",
 706          "\u0122": "G",
 707          "\u0123": "g",
 708          "\u0124": "H",
 709          "\u0125": "h",
 710          "\u0126": "H",
 711          "\u0127": "h",
 712          "\u1E2A": "H",
 713          "\u1E2B": "h",
 714          "\u0128": "I",
 715          "\u0129": "i",
 716          "\u012A": "I",
 717          "\u012B": "i",
 718          "\u012C": "I",
 719          "\u012D": "i",
 720          "\u012E": "I",
 721          "\u012F": "i",
 722          "\u0130": "I",
 723          "\u0131": "i",
 724          "\u0132": "IJ",
 725          "\u0133": "ij",
 726          "\u0134": "J",
 727          "\u0135": "j",
 728          "\u0136": "K",
 729          "\u0137": "k",
 730          "\u1E30": "K",
 731          "\u1E31": "k",
 732          "K\u0306": "K",
 733          "k\u0306": "k",
 734          "\u0139": "L",
 735          "\u013A": "l",
 736          "\u013B": "L",
 737          "\u013C": "l",
 738          "\u013D": "L",
 739          "\u013E": "l",
 740          "\u013F": "L",
 741          "\u0140": "l",
 742          "\u0141": "l",
 743          "\u0142": "l",
 744          "\u1E3E": "M",
 745          "\u1E3F": "m",
 746          "M\u0306": "M",
 747          "m\u0306": "m",
 748          "\u0143": "N",
 749          "\u0144": "n",
 750          "\u0145": "N",
 751          "\u0146": "n",
 752          "\u0147": "N",
 753          "\u0148": "n",
 754          "\u0149": "n",
 755          "N\u0306": "N",
 756          "n\u0306": "n",
 757          "\u014C": "O",
 758          "\u014D": "o",
 759          "\u014E": "O",
 760          "\u014F": "o",
 761          "\u0150": "O",
 762          "\u0151": "o",
 763          "\u0152": "OE",
 764          "\u0153": "oe",
 765          "P\u0306": "P",
 766          "p\u0306": "p",
 767          "\u0154": "R",
 768          "\u0155": "r",
 769          "\u0156": "R",
 770          "\u0157": "r",
 771          "\u0158": "R",
 772          "\u0159": "r",
 773          "R\u0306": "R",
 774          "r\u0306": "r",
 775          "\u0212": "R",
 776          "\u0213": "r",
 777          "\u015A": "S",
 778          "\u015B": "s",
 779          "\u015C": "S",
 780          "\u015D": "s",
 781          "\u015E": "S",
 782          "\u0218": "S",
 783          "\u0219": "s",
 784          "\u015F": "s",
 785          "\u0160": "S",
 786          "\u0161": "s",
 787          "\u0162": "T",
 788          "\u0163": "t",
 789          "\u021B": "t",
 790          "\u021A": "T",
 791          "\u0164": "T",
 792          "\u0165": "t",
 793          "\u0166": "T",
 794          "\u0167": "t",
 795          "T\u0306": "T",
 796          "t\u0306": "t",
 797          "\u0168": "U",
 798          "\u0169": "u",
 799          "\u016A": "U",
 800          "\u016B": "u",
 801          "\u016C": "U",
 802          "\u016D": "u",
 803          "\u016E": "U",
 804          "\u016F": "u",
 805          "\u0170": "U",
 806          "\u0171": "u",
 807          "\u0172": "U",
 808          "\u0173": "u",
 809          "\u0216": "U",
 810          "\u0217": "u",
 811          "V\u0306": "V",
 812          "v\u0306": "v",
 813          "\u0174": "W",
 814          "\u0175": "w",
 815          "\u1E82": "W",
 816          "\u1E83": "w",
 817          "X\u0306": "X",
 818          "x\u0306": "x",
 819          "\u0176": "Y",
 820          "\u0177": "y",
 821          "\u0178": "Y",
 822          "Y\u0306": "Y",
 823          "y\u0306": "y",
 824          "\u0179": "Z",
 825          "\u017A": "z",
 826          "\u017B": "Z",
 827          "\u017C": "z",
 828          "\u017D": "Z",
 829          "\u017E": "z",
 830          "\u017F": "s",
 831          "\u0192": "f",
 832          "\u01A0": "O",
 833          "\u01A1": "o",
 834          "\u01AF": "U",
 835          "\u01B0": "u",
 836          "\u01CD": "A",
 837          "\u01CE": "a",
 838          "\u01CF": "I",
 839          "\u01D0": "i",
 840          "\u01D1": "O",
 841          "\u01D2": "o",
 842          "\u01D3": "U",
 843          "\u01D4": "u",
 844          "\u01D5": "U",
 845          "\u01D6": "u",
 846          "\u01D7": "U",
 847          "\u01D8": "u",
 848          "\u01D9": "U",
 849          "\u01DA": "u",
 850          "\u01DB": "U",
 851          "\u01DC": "u",
 852          "\u1EE8": "U",
 853          "\u1EE9": "u",
 854          "\u1E78": "U",
 855          "\u1E79": "u",
 856          "\u01FA": "A",
 857          "\u01FB": "a",
 858          "\u01FC": "AE",
 859          "\u01FD": "ae",
 860          "\u01FE": "O",
 861          "\u01FF": "o",
 862          "\xDE": "TH",
 863          "\xFE": "th",
 864          "\u1E54": "P",
 865          "\u1E55": "p",
 866          "\u1E64": "S",
 867          "\u1E65": "s",
 868          "X\u0301": "X",
 869          "x\u0301": "x",
 870          "\u0403": "\u0413",
 871          "\u0453": "\u0433",
 872          "\u040C": "\u041A",
 873          "\u045C": "\u043A",
 874          "A\u030B": "A",
 875          "a\u030B": "a",
 876          "E\u030B": "E",
 877          "e\u030B": "e",
 878          "I\u030B": "I",
 879          "i\u030B": "i",
 880          "\u01F8": "N",
 881          "\u01F9": "n",
 882          "\u1ED2": "O",
 883          "\u1ED3": "o",
 884          "\u1E50": "O",
 885          "\u1E51": "o",
 886          "\u1EEA": "U",
 887          "\u1EEB": "u",
 888          "\u1E80": "W",
 889          "\u1E81": "w",
 890          "\u1EF2": "Y",
 891          "\u1EF3": "y",
 892          "\u0200": "A",
 893          "\u0201": "a",
 894          "\u0204": "E",
 895          "\u0205": "e",
 896          "\u0208": "I",
 897          "\u0209": "i",
 898          "\u020C": "O",
 899          "\u020D": "o",
 900          "\u0210": "R",
 901          "\u0211": "r",
 902          "\u0214": "U",
 903          "\u0215": "u",
 904          "B\u030C": "B",
 905          "b\u030C": "b",
 906          "\u010C\u0323": "C",
 907          "\u010D\u0323": "c",
 908          "\xCA\u030C": "E",
 909          "\xEA\u030C": "e",
 910          "F\u030C": "F",
 911          "f\u030C": "f",
 912          "\u01E6": "G",
 913          "\u01E7": "g",
 914          "\u021E": "H",
 915          "\u021F": "h",
 916          "J\u030C": "J",
 917          "\u01F0": "j",
 918          "\u01E8": "K",
 919          "\u01E9": "k",
 920          "M\u030C": "M",
 921          "m\u030C": "m",
 922          "P\u030C": "P",
 923          "p\u030C": "p",
 924          "Q\u030C": "Q",
 925          "q\u030C": "q",
 926          "\u0158\u0329": "R",
 927          "\u0159\u0329": "r",
 928          "\u1E66": "S",
 929          "\u1E67": "s",
 930          "V\u030C": "V",
 931          "v\u030C": "v",
 932          "W\u030C": "W",
 933          "w\u030C": "w",
 934          "X\u030C": "X",
 935          "x\u030C": "x",
 936          "Y\u030C": "Y",
 937          "y\u030C": "y",
 938          "A\u0327": "A",
 939          "a\u0327": "a",
 940          "B\u0327": "B",
 941          "b\u0327": "b",
 942          "\u1E10": "D",
 943          "\u1E11": "d",
 944          "\u0228": "E",
 945          "\u0229": "e",
 946          "\u0190\u0327": "E",
 947          "\u025B\u0327": "e",
 948          "\u1E28": "H",
 949          "\u1E29": "h",
 950          "I\u0327": "I",
 951          "i\u0327": "i",
 952          "\u0197\u0327": "I",
 953          "\u0268\u0327": "i",
 954          "M\u0327": "M",
 955          "m\u0327": "m",
 956          "O\u0327": "O",
 957          "o\u0327": "o",
 958          "Q\u0327": "Q",
 959          "q\u0327": "q",
 960          "U\u0327": "U",
 961          "u\u0327": "u",
 962          "X\u0327": "X",
 963          "x\u0327": "x",
 964          "Z\u0327": "Z",
 965          "z\u0327": "z",
 966          "\u0439": "\u0438",
 967          "\u0419": "\u0418",
 968          "\u0451": "\u0435",
 969          "\u0401": "\u0415"
 970        };
 971        var chars = Object.keys(characterMap).join("|");
 972        var allAccents = new RegExp(chars, "g");
 973        var firstAccent = new RegExp(chars, "");
 974        function matcher(match3) {
 975          return characterMap[match3];
 976        }
 977        var removeAccents3 = function(string) {
 978          return string.replace(allAccents, matcher);
 979        };
 980        var hasAccents = function(string) {
 981          return !!string.match(firstAccent);
 982        };
 983        module.exports = removeAccents3;
 984        module.exports.has = hasAccents;
 985        module.exports.remove = removeAccents3;
 986      }
 987    });
 988  
 989    // package-external:@wordpress/warning
 990    var require_warning = __commonJS({
 991      "package-external:@wordpress/warning"(exports, module) {
 992        module.exports = window.wp.warning;
 993      }
 994    });
 995  
 996    // packages/edit-site/build-module/index.mjs
 997    var index_exports = {};
 998    __export(index_exports, {
 999      PluginMoreMenuItem: () => PluginMoreMenuItem,
1000      PluginSidebar: () => PluginSidebar,
1001      PluginSidebarMoreMenuItem: () => PluginSidebarMoreMenuItem,
1002      PluginTemplateSettingPanel: () => plugin_template_setting_panel_default,
1003      initializeEditor: () => initializeEditor,
1004      reinitializeEditor: () => reinitializeEditor,
1005      store: () => store
1006    });
1007    var import_blocks15 = __toESM(require_blocks(), 1);
1008    var import_block_library3 = __toESM(require_block_library(), 1);
1009    var import_data84 = __toESM(require_data(), 1);
1010    var import_deprecated6 = __toESM(require_deprecated(), 1);
1011    var import_element162 = __toESM(require_element(), 1);
1012    var import_editor46 = __toESM(require_editor(), 1);
1013    var import_preferences13 = __toESM(require_preferences(), 1);
1014    var import_widgets = __toESM(require_widgets(), 1);
1015  
1016    // packages/edit-site/build-module/store/index.mjs
1017    var import_data3 = __toESM(require_data(), 1);
1018  
1019    // packages/edit-site/build-module/store/reducer.mjs
1020    var import_data = __toESM(require_data(), 1);
1021    function settings(state = {}, action) {
1022      switch (action.type) {
1023        case "UPDATE_SETTINGS":
1024          return {
1025            ...state,
1026            ...action.settings
1027          };
1028      }
1029      return state;
1030    }
1031    function editedPost(state = {}, action) {
1032      switch (action.type) {
1033        case "SET_EDITED_POST":
1034          return {
1035            postType: action.postType,
1036            id: action.id,
1037            context: action.context
1038          };
1039        case "SET_EDITED_POST_CONTEXT":
1040          return {
1041            ...state,
1042            context: action.context
1043          };
1044      }
1045      return state;
1046    }
1047    function saveViewPanel(state = false, action) {
1048      switch (action.type) {
1049        case "SET_IS_SAVE_VIEW_OPENED":
1050          return action.isOpen;
1051      }
1052      return state;
1053    }
1054    function routes(state = [], action) {
1055      switch (action.type) {
1056        case "REGISTER_ROUTE":
1057          return [...state, action.route];
1058        case "UNREGISTER_ROUTE":
1059          return state.filter((route) => route.name !== action.name);
1060      }
1061      return state;
1062    }
1063    var reducer_default = (0, import_data.combineReducers)({
1064      settings,
1065      editedPost,
1066      saveViewPanel,
1067      routes
1068    });
1069  
1070    // packages/edit-site/build-module/store/actions.mjs
1071    var actions_exports = {};
1072    __export(actions_exports, {
1073      __experimentalSetPreviewDeviceType: () => __experimentalSetPreviewDeviceType,
1074      addTemplate: () => addTemplate,
1075      closeGeneralSidebar: () => closeGeneralSidebar,
1076      openGeneralSidebar: () => openGeneralSidebar,
1077      openNavigationPanelToMenu: () => openNavigationPanelToMenu,
1078      removeTemplate: () => removeTemplate,
1079      revertTemplate: () => revertTemplate,
1080      setEditedEntity: () => setEditedEntity,
1081      setEditedPostContext: () => setEditedPostContext,
1082      setHasPageContentFocus: () => setHasPageContentFocus,
1083      setHomeTemplateId: () => setHomeTemplateId,
1084      setIsInserterOpened: () => setIsInserterOpened,
1085      setIsListViewOpened: () => setIsListViewOpened,
1086      setIsNavigationPanelOpened: () => setIsNavigationPanelOpened,
1087      setIsSaveViewOpened: () => setIsSaveViewOpened,
1088      setNavigationMenu: () => setNavigationMenu,
1089      setNavigationPanelActiveMenu: () => setNavigationPanelActiveMenu,
1090      setPage: () => setPage,
1091      setTemplate: () => setTemplate,
1092      setTemplatePart: () => setTemplatePart,
1093      switchEditorMode: () => switchEditorMode,
1094      toggleDistractionFree: () => toggleDistractionFree,
1095      toggleFeature: () => toggleFeature,
1096      updateSettings: () => updateSettings
1097    });
1098    var import_blocks = __toESM(require_blocks(), 1);
1099    var import_deprecated = __toESM(require_deprecated(), 1);
1100    var import_core_data = __toESM(require_core_data(), 1);
1101    var import_block_editor = __toESM(require_block_editor(), 1);
1102    var import_editor = __toESM(require_editor(), 1);
1103    var import_preferences = __toESM(require_preferences(), 1);
1104  
1105    // packages/edit-site/build-module/utils/constants.mjs
1106    var import_i18n = __toESM(require_i18n(), 1);
1107    var import_patterns = __toESM(require_patterns(), 1);
1108  
1109    // packages/edit-site/build-module/lock-unlock.mjs
1110    var import_private_apis = __toESM(require_private_apis(), 1);
1111    var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
1112      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
1113      "@wordpress/edit-site"
1114    );
1115  
1116    // packages/edit-site/build-module/utils/constants.mjs
1117    var ATTACHMENT_POST_TYPE = "attachment";
1118    var NAVIGATION_POST_TYPE = "wp_navigation";
1119    var TEMPLATE_POST_TYPE = "wp_template";
1120    var TEMPLATE_PART_POST_TYPE = "wp_template_part";
1121    var TEMPLATE_ORIGINS = {
1122      custom: "custom",
1123      theme: "theme",
1124      plugin: "plugin"
1125    };
1126    var TEMPLATE_PART_AREA_DEFAULT_CATEGORY = "uncategorized";
1127    var TEMPLATE_PART_ALL_AREAS_CATEGORY = "all-parts";
1128    var {
1129      PATTERN_TYPES,
1130      PATTERN_DEFAULT_CATEGORY,
1131      PATTERN_USER_CATEGORY,
1132      EXCLUDED_PATTERN_SOURCES,
1133      PATTERN_SYNC_TYPES
1134    } = unlock(import_patterns.privateApis);
1135    var FOCUSABLE_ENTITIES = [
1136      TEMPLATE_PART_POST_TYPE,
1137      NAVIGATION_POST_TYPE,
1138      PATTERN_TYPES.user
1139    ];
1140    var POST_TYPE_LABELS = {
1141      [TEMPLATE_POST_TYPE]: (0, import_i18n.__)("Template"),
1142      [TEMPLATE_PART_POST_TYPE]: (0, import_i18n.__)("Template part"),
1143      [PATTERN_TYPES.user]: (0, import_i18n.__)("Pattern"),
1144      [NAVIGATION_POST_TYPE]: (0, import_i18n.__)("Navigation")
1145    };
1146    var LAYOUT_GRID = "grid";
1147    var LAYOUT_TABLE = "table";
1148    var LAYOUT_LIST = "list";
1149    var OPERATOR_IS = "is";
1150    var OPERATOR_IS_ANY = "isAny";
1151    var OPERATOR_IS_NONE = "isNone";
1152    var OPERATOR_BEFORE = "before";
1153    var OPERATOR_AFTER = "after";
1154  
1155    // packages/edit-site/build-module/store/actions.mjs
1156    var { interfaceStore } = unlock(import_editor.privateApis);
1157    function toggleFeature(featureName) {
1158      return function({ registry }) {
1159        (0, import_deprecated.default)(
1160          "dispatch( 'core/edit-site' ).toggleFeature( featureName )",
1161          {
1162            since: "6.0",
1163            alternative: "dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"
1164          }
1165        );
1166        registry.dispatch(import_preferences.store).toggle("core/edit-site", featureName);
1167      };
1168    }
1169    var __experimentalSetPreviewDeviceType = (deviceType) => ({ registry }) => {
1170      (0, import_deprecated.default)(
1171        "dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",
1172        {
1173          since: "6.5",
1174          version: "6.7",
1175          hint: "registry.dispatch( editorStore ).setDeviceType"
1176        }
1177      );
1178      registry.dispatch(import_editor.store).setDeviceType(deviceType);
1179    };
1180    function setTemplate() {
1181      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setTemplate", {
1182        since: "6.5",
1183        version: "6.8",
1184        hint: "The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically."
1185      });
1186      return {
1187        type: "NOTHING"
1188      };
1189    }
1190    var addTemplate = (template) => async ({ dispatch: dispatch2, registry }) => {
1191      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).addTemplate", {
1192        since: "6.5",
1193        version: "6.8",
1194        hint: "use saveEntityRecord directly"
1195      });
1196      const newTemplate = await registry.dispatch(import_core_data.store).saveEntityRecord("postType", TEMPLATE_POST_TYPE, template);
1197      if (template.content) {
1198        registry.dispatch(import_core_data.store).editEntityRecord(
1199          "postType",
1200          TEMPLATE_POST_TYPE,
1201          newTemplate.id,
1202          { blocks: (0, import_blocks.parse)(template.content) },
1203          { undoIgnore: true }
1204        );
1205      }
1206      dispatch2({
1207        type: "SET_EDITED_POST",
1208        postType: TEMPLATE_POST_TYPE,
1209        id: newTemplate.id
1210      });
1211    };
1212    var removeTemplate = (template) => ({ registry }) => {
1213      return unlock(registry.dispatch(import_editor.store)).removeTemplates([
1214        template
1215      ]);
1216    };
1217    function setTemplatePart(templatePartId) {
1218      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setTemplatePart", {
1219        since: "6.8"
1220      });
1221      return {
1222        type: "SET_EDITED_POST",
1223        postType: TEMPLATE_PART_POST_TYPE,
1224        id: templatePartId
1225      };
1226    }
1227    function setNavigationMenu(navigationMenuId) {
1228      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setNavigationMenu", {
1229        since: "6.8"
1230      });
1231      return {
1232        type: "SET_EDITED_POST",
1233        postType: NAVIGATION_POST_TYPE,
1234        id: navigationMenuId
1235      };
1236    }
1237    function setEditedEntity(postType2, postId, context) {
1238      return {
1239        type: "SET_EDITED_POST",
1240        postType: postType2,
1241        id: postId,
1242        context
1243      };
1244    }
1245    function setHomeTemplateId() {
1246      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setHomeTemplateId", {
1247        since: "6.2",
1248        version: "6.4"
1249      });
1250      return {
1251        type: "NOTHING"
1252      };
1253    }
1254    function setEditedPostContext(context) {
1255      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setEditedPostContext", {
1256        since: "6.8"
1257      });
1258      return {
1259        type: "SET_EDITED_POST_CONTEXT",
1260        context
1261      };
1262    }
1263    function setPage() {
1264      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setPage", {
1265        since: "6.5",
1266        version: "6.8",
1267        hint: "The setPage is not needed anymore, the correct entity is resolved from the URL automatically."
1268      });
1269      return { type: "NOTHING" };
1270    }
1271    function setNavigationPanelActiveMenu() {
1272      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu", {
1273        since: "6.2",
1274        version: "6.4"
1275      });
1276      return { type: "NOTHING" };
1277    }
1278    function openNavigationPanelToMenu() {
1279      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).openNavigationPanelToMenu", {
1280        since: "6.2",
1281        version: "6.4"
1282      });
1283      return { type: "NOTHING" };
1284    }
1285    function setIsNavigationPanelOpened() {
1286      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened", {
1287        since: "6.2",
1288        version: "6.4"
1289      });
1290      return { type: "NOTHING" };
1291    }
1292    var setIsInserterOpened = (value) => ({ registry }) => {
1293      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setIsInserterOpened", {
1294        since: "6.5",
1295        alternative: "dispatch( 'core/editor').setIsInserterOpened"
1296      });
1297      registry.dispatch(import_editor.store).setIsInserterOpened(value);
1298    };
1299    var setIsListViewOpened = (isOpen) => ({ registry }) => {
1300      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).setIsListViewOpened", {
1301        since: "6.5",
1302        alternative: "dispatch( 'core/editor').setIsListViewOpened"
1303      });
1304      registry.dispatch(import_editor.store).setIsListViewOpened(isOpen);
1305    };
1306    function updateSettings(settings2) {
1307      return {
1308        type: "UPDATE_SETTINGS",
1309        settings: settings2
1310      };
1311    }
1312    function setIsSaveViewOpened(isOpen) {
1313      return {
1314        type: "SET_IS_SAVE_VIEW_OPENED",
1315        isOpen
1316      };
1317    }
1318    var revertTemplate = (template, options) => ({ registry }) => {
1319      return unlock(registry.dispatch(import_editor.store)).revertTemplate(
1320        template,
1321        options
1322      );
1323    };
1324    var openGeneralSidebar = (name2) => ({ registry }) => {
1325      registry.dispatch(interfaceStore).enableComplementaryArea("core", name2);
1326    };
1327    var closeGeneralSidebar = () => ({ registry }) => {
1328      registry.dispatch(interfaceStore).disableComplementaryArea("core");
1329    };
1330    var switchEditorMode = (mode) => ({ registry }) => {
1331      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).switchEditorMode", {
1332        since: "6.6",
1333        alternative: "dispatch( 'core/editor').switchEditorMode"
1334      });
1335      registry.dispatch(import_editor.store).switchEditorMode(mode);
1336    };
1337    var setHasPageContentFocus = (hasPageContentFocus2) => ({ dispatch: dispatch2, registry }) => {
1338      (0, import_deprecated.default)(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, {
1339        since: "6.5"
1340      });
1341      if (hasPageContentFocus2) {
1342        registry.dispatch(import_block_editor.store).clearSelectedBlock();
1343      }
1344      dispatch2({
1345        type: "SET_HAS_PAGE_CONTENT_FOCUS",
1346        hasPageContentFocus: hasPageContentFocus2
1347      });
1348    };
1349    var toggleDistractionFree = () => ({ registry }) => {
1350      (0, import_deprecated.default)("dispatch( 'core/edit-site' ).toggleDistractionFree", {
1351        since: "6.6",
1352        alternative: "dispatch( 'core/editor').toggleDistractionFree"
1353      });
1354      registry.dispatch(import_editor.store).toggleDistractionFree();
1355    };
1356  
1357    // packages/edit-site/build-module/store/private-actions.mjs
1358    var private_actions_exports = {};
1359    __export(private_actions_exports, {
1360      registerRoute: () => registerRoute,
1361      unregisterRoute: () => unregisterRoute
1362    });
1363    function registerRoute(route) {
1364      return {
1365        type: "REGISTER_ROUTE",
1366        route
1367      };
1368    }
1369    function unregisterRoute(name2) {
1370      return {
1371        type: "UNREGISTER_ROUTE",
1372        name: name2
1373      };
1374    }
1375  
1376    // packages/edit-site/build-module/store/selectors.mjs
1377    var selectors_exports = {};
1378    __export(selectors_exports, {
1379      __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint,
1380      __experimentalGetPreviewDeviceType: () => __experimentalGetPreviewDeviceType,
1381      getCanUserCreateMedia: () => getCanUserCreateMedia,
1382      getCurrentTemplateNavigationPanelSubMenu: () => getCurrentTemplateNavigationPanelSubMenu,
1383      getCurrentTemplateTemplateParts: () => getCurrentTemplateTemplateParts,
1384      getEditedPostContext: () => getEditedPostContext,
1385      getEditedPostId: () => getEditedPostId,
1386      getEditedPostType: () => getEditedPostType,
1387      getEditorMode: () => getEditorMode,
1388      getHomeTemplateId: () => getHomeTemplateId,
1389      getNavigationPanelActiveMenu: () => getNavigationPanelActiveMenu,
1390      getPage: () => getPage,
1391      getReusableBlocks: () => getReusableBlocks,
1392      getSettings: () => getSettings,
1393      hasPageContentFocus: () => hasPageContentFocus,
1394      isFeatureActive: () => isFeatureActive,
1395      isInserterOpened: () => isInserterOpened,
1396      isListViewOpened: () => isListViewOpened,
1397      isNavigationOpened: () => isNavigationOpened,
1398      isPage: () => isPage,
1399      isSaveViewOpened: () => isSaveViewOpened
1400    });
1401    var import_core_data2 = __toESM(require_core_data(), 1);
1402    var import_data2 = __toESM(require_data(), 1);
1403    var import_deprecated2 = __toESM(require_deprecated(), 1);
1404    var import_element = __toESM(require_element(), 1);
1405    var import_preferences2 = __toESM(require_preferences(), 1);
1406    var import_editor2 = __toESM(require_editor(), 1);
1407    var import_block_editor2 = __toESM(require_block_editor(), 1);
1408  
1409    // packages/edit-site/build-module/utils/get-filtered-template-parts.mjs
1410    var import_blocks2 = __toESM(require_blocks(), 1);
1411    var EMPTY_ARRAY = [];
1412    function getFilteredTemplatePartBlocks(blocks = EMPTY_ARRAY, templateParts) {
1413      const templatePartsById = templateParts ? (
1414        // Key template parts by their ID.
1415        templateParts.reduce(
1416          (newTemplateParts, part) => ({
1417            ...newTemplateParts,
1418            [part.id]: part
1419          }),
1420          {}
1421        )
1422      ) : {};
1423      const result = [];
1424      const stack = [...blocks];
1425      while (stack.length) {
1426        const { innerBlocks, ...block } = stack.shift();
1427        stack.unshift(...innerBlocks);
1428        if ((0, import_blocks2.isTemplatePart)(block)) {
1429          const {
1430            attributes: { theme, slug }
1431          } = block;
1432          const templatePartId = `$theme}//${slug}`;
1433          const templatePart = templatePartsById[templatePartId];
1434          if (templatePart) {
1435            result.push({
1436              templatePart,
1437              block
1438            });
1439          }
1440        }
1441      }
1442      return result;
1443    }
1444  
1445    // packages/edit-site/build-module/store/selectors.mjs
1446    var isFeatureActive = (0, import_data2.createRegistrySelector)(
1447      (select3) => (_, featureName) => {
1448        (0, import_deprecated2.default)(`select( 'core/edit-site' ).isFeatureActive`, {
1449          since: "6.0",
1450          alternative: `select( 'core/preferences' ).get`
1451        });
1452        return !!select3(import_preferences2.store).get(
1453          "core/edit-site",
1454          featureName
1455        );
1456      }
1457    );
1458    var __experimentalGetPreviewDeviceType = (0, import_data2.createRegistrySelector)(
1459      (select3) => () => {
1460        (0, import_deprecated2.default)(
1461          `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,
1462          {
1463            since: "6.5",
1464            version: "6.7",
1465            alternative: `select( 'core/editor' ).getDeviceType`
1466          }
1467        );
1468        return select3(import_editor2.store).getDeviceType();
1469      }
1470    );
1471    var getCanUserCreateMedia = (0, import_data2.createRegistrySelector)(
1472      (select3) => () => {
1473        (0, import_deprecated2.default)(
1474          `wp.data.select( 'core/edit-site' ).getCanUserCreateMedia()`,
1475          {
1476            since: "6.7",
1477            alternative: `wp.data.select( 'core' ).canUser( 'create', { kind: 'postType', type: 'attachment' } )`
1478          }
1479        );
1480        return select3(import_core_data2.store).canUser("create", "media");
1481      }
1482    );
1483    var getReusableBlocks = (0, import_data2.createRegistrySelector)((select3) => () => {
1484      (0, import_deprecated2.default)(`select( 'core/edit-site' ).getReusableBlocks()`, {
1485        since: "6.5",
1486        version: "6.8",
1487        alternative: `select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )`
1488      });
1489      const isWeb = import_element.Platform.OS === "web";
1490      return isWeb ? select3(import_core_data2.store).getEntityRecords("postType", "wp_block", {
1491        per_page: -1
1492      }) : [];
1493    });
1494    function getSettings(state) {
1495      return state.settings;
1496    }
1497    function getHomeTemplateId() {
1498      (0, import_deprecated2.default)("select( 'core/edit-site' ).getHomeTemplateId", {
1499        since: "6.2",
1500        version: "6.4"
1501      });
1502    }
1503    function getEditedPostType(state) {
1504      (0, import_deprecated2.default)("select( 'core/edit-site' ).getEditedPostType", {
1505        since: "6.8",
1506        alternative: "select( 'core/editor' ).getCurrentPostType"
1507      });
1508      return state.editedPost.postType;
1509    }
1510    function getEditedPostId(state) {
1511      (0, import_deprecated2.default)("select( 'core/edit-site' ).getEditedPostId", {
1512        since: "6.8",
1513        alternative: "select( 'core/editor' ).getCurrentPostId"
1514      });
1515      return state.editedPost.id;
1516    }
1517    function getEditedPostContext(state) {
1518      (0, import_deprecated2.default)("select( 'core/edit-site' ).getEditedPostContext", {
1519        since: "6.8"
1520      });
1521      return state.editedPost.context;
1522    }
1523    function getPage(state) {
1524      (0, import_deprecated2.default)("select( 'core/edit-site' ).getPage", {
1525        since: "6.8"
1526      });
1527      return { context: state.editedPost.context };
1528    }
1529    var isInserterOpened = (0, import_data2.createRegistrySelector)((select3) => () => {
1530      (0, import_deprecated2.default)(`select( 'core/edit-site' ).isInserterOpened`, {
1531        since: "6.5",
1532        alternative: `select( 'core/editor' ).isInserterOpened`
1533      });
1534      return select3(import_editor2.store).isInserterOpened();
1535    });
1536    var __experimentalGetInsertionPoint = (0, import_data2.createRegistrySelector)(
1537      (select3) => () => {
1538        (0, import_deprecated2.default)(
1539          `select( 'core/edit-site' ).__experimentalGetInsertionPoint`,
1540          {
1541            since: "6.5",
1542            version: "6.7"
1543          }
1544        );
1545        return unlock(select3(import_editor2.store)).getInserter();
1546      }
1547    );
1548    var isListViewOpened = (0, import_data2.createRegistrySelector)((select3) => () => {
1549      (0, import_deprecated2.default)(`select( 'core/edit-site' ).isListViewOpened`, {
1550        since: "6.5",
1551        alternative: `select( 'core/editor' ).isListViewOpened`
1552      });
1553      return select3(import_editor2.store).isListViewOpened();
1554    });
1555    function isSaveViewOpened(state) {
1556      return state.saveViewPanel;
1557    }
1558    function getBlocksAndTemplateParts(select3) {
1559      const templateParts = select3(import_core_data2.store).getEntityRecords(
1560        "postType",
1561        TEMPLATE_PART_POST_TYPE,
1562        { per_page: -1 }
1563      );
1564      const { getBlocksByName, getBlocksByClientId } = select3(import_block_editor2.store);
1565      const clientIds = getBlocksByName("core/template-part");
1566      const blocks = getBlocksByClientId(clientIds);
1567      return [blocks, templateParts];
1568    }
1569    var getCurrentTemplateTemplateParts = (0, import_data2.createRegistrySelector)(
1570      (select3) => (0, import_data2.createSelector)(
1571        () => {
1572          (0, import_deprecated2.default)(
1573            `select( 'core/edit-site' ).getCurrentTemplateTemplateParts()`,
1574            {
1575              since: "6.7",
1576              version: "6.9",
1577              alternative: `select( 'core/block-editor' ).getBlocksByName( 'core/template-part' )`
1578            }
1579          );
1580          return getFilteredTemplatePartBlocks(
1581            ...getBlocksAndTemplateParts(select3)
1582          );
1583        },
1584        () => getBlocksAndTemplateParts(select3)
1585      )
1586    );
1587    var getEditorMode = (0, import_data2.createRegistrySelector)((select3) => () => {
1588      return select3(import_preferences2.store).get("core", "editorMode");
1589    });
1590    function getCurrentTemplateNavigationPanelSubMenu() {
1591      (0, import_deprecated2.default)(
1592        "dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",
1593        {
1594          since: "6.2",
1595          version: "6.4"
1596        }
1597      );
1598    }
1599    function getNavigationPanelActiveMenu() {
1600      (0, import_deprecated2.default)("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu", {
1601        since: "6.2",
1602        version: "6.4"
1603      });
1604    }
1605    function isNavigationOpened() {
1606      (0, import_deprecated2.default)("dispatch( 'core/edit-site' ).isNavigationOpened", {
1607        since: "6.2",
1608        version: "6.4"
1609      });
1610    }
1611    function isPage(state) {
1612      (0, import_deprecated2.default)("select( 'core/edit-site' ).isPage", {
1613        since: "6.8",
1614        alternative: "select( 'core/editor' ).getCurrentPostType"
1615      });
1616      return !!state.editedPost.context?.postId;
1617    }
1618    function hasPageContentFocus() {
1619      (0, import_deprecated2.default)(`select( 'core/edit-site' ).hasPageContentFocus`, {
1620        since: "6.5"
1621      });
1622      return false;
1623    }
1624  
1625    // packages/edit-site/build-module/store/private-selectors.mjs
1626    var private_selectors_exports = {};
1627    __export(private_selectors_exports, {
1628      getRoutes: () => getRoutes
1629    });
1630    function getRoutes(state) {
1631      return state.routes;
1632    }
1633  
1634    // packages/edit-site/build-module/store/constants.mjs
1635    var STORE_NAME = "core/edit-site";
1636  
1637    // packages/edit-site/build-module/store/index.mjs
1638    var storeConfig = {
1639      reducer: reducer_default,
1640      actions: actions_exports,
1641      selectors: selectors_exports
1642    };
1643    var store = (0, import_data3.createReduxStore)(STORE_NAME, storeConfig);
1644    (0, import_data3.register)(store);
1645    unlock(store).registerPrivateSelectors(private_selectors_exports);
1646    unlock(store).registerPrivateActions(private_actions_exports);
1647  
1648    // packages/edit-site/build-module/components/app/index.mjs
1649    var import_data83 = __toESM(require_data(), 1);
1650    var import_router42 = __toESM(require_router(), 1);
1651    var import_element161 = __toESM(require_element(), 1);
1652    var import_core_data65 = __toESM(require_core_data(), 1);
1653  
1654    // node_modules/clsx/dist/clsx.mjs
1655    function r(e2) {
1656      var t3, f2, n2 = "";
1657      if ("string" == typeof e2 || "number" == typeof e2) n2 += e2;
1658      else if ("object" == typeof e2) if (Array.isArray(e2)) {
1659        var o3 = e2.length;
1660        for (t3 = 0; t3 < o3; t3++) e2[t3] && (f2 = r(e2[t3])) && (n2 && (n2 += " "), n2 += f2);
1661      } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2);
1662      return n2;
1663    }
1664    function clsx() {
1665      for (var e2, t3, f2 = 0, n2 = "", o3 = arguments.length; f2 < o3; f2++) (e2 = arguments[f2]) && (t3 = r(e2)) && (n2 && (n2 += " "), n2 += t3);
1666      return n2;
1667    }
1668    var clsx_default = clsx;
1669  
1670    // packages/admin-ui/build-module/navigable-region/index.mjs
1671    var import_element2 = __toESM(require_element(), 1);
1672    var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
1673    var NavigableRegion = (0, import_element2.forwardRef)(
1674      ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
1675        return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1676          Tag,
1677          {
1678            ref,
1679            className: clsx_default("admin-ui-navigable-region", className),
1680            "aria-label": ariaLabel,
1681            role: "region",
1682            tabIndex: "-1",
1683            ...props,
1684            children
1685          }
1686        );
1687      }
1688    );
1689    NavigableRegion.displayName = "NavigableRegion";
1690    var navigable_region_default = NavigableRegion;
1691  
1692    // node_modules/@base-ui/utils/esm/useRefWithInit.js
1693    var React = __toESM(require_react(), 1);
1694    var UNINITIALIZED = {};
1695    function useRefWithInit(init2, initArg) {
1696      const ref = React.useRef(UNINITIALIZED);
1697      if (ref.current === UNINITIALIZED) {
1698        ref.current = init2(initArg);
1699      }
1700      return ref;
1701    }
1702  
1703    // node_modules/@base-ui/react/esm/utils/useRenderElement.js
1704    var React4 = __toESM(require_react(), 1);
1705  
1706    // node_modules/@base-ui/utils/esm/useMergedRefs.js
1707    function useMergedRefs(a2, b2, c6, d2) {
1708      const forkRef = useRefWithInit(createForkRef).current;
1709      if (didChange(forkRef, a2, b2, c6, d2)) {
1710        update(forkRef, [a2, b2, c6, d2]);
1711      }
1712      return forkRef.callback;
1713    }
1714    function useMergedRefsN(refs) {
1715      const forkRef = useRefWithInit(createForkRef).current;
1716      if (didChangeN(forkRef, refs)) {
1717        update(forkRef, refs);
1718      }
1719      return forkRef.callback;
1720    }
1721    function createForkRef() {
1722      return {
1723        callback: null,
1724        cleanup: null,
1725        refs: []
1726      };
1727    }
1728    function didChange(forkRef, a2, b2, c6, d2) {
1729      return forkRef.refs[0] !== a2 || forkRef.refs[1] !== b2 || forkRef.refs[2] !== c6 || forkRef.refs[3] !== d2;
1730    }
1731    function didChangeN(forkRef, newRefs) {
1732      return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
1733    }
1734    function update(forkRef, refs) {
1735      forkRef.refs = refs;
1736      if (refs.every((ref) => ref == null)) {
1737        forkRef.callback = null;
1738        return;
1739      }
1740      forkRef.callback = (instance) => {
1741        if (forkRef.cleanup) {
1742          forkRef.cleanup();
1743          forkRef.cleanup = null;
1744        }
1745        if (instance != null) {
1746          const cleanupCallbacks = Array(refs.length).fill(null);
1747          for (let i2 = 0; i2 < refs.length; i2 += 1) {
1748            const ref = refs[i2];
1749            if (ref == null) {
1750              continue;
1751            }
1752            switch (typeof ref) {
1753              case "function": {
1754                const refCleanup = ref(instance);
1755                if (typeof refCleanup === "function") {
1756                  cleanupCallbacks[i2] = refCleanup;
1757                }
1758                break;
1759              }
1760              case "object": {
1761                ref.current = instance;
1762                break;
1763              }
1764              default:
1765            }
1766          }
1767          forkRef.cleanup = () => {
1768            for (let i2 = 0; i2 < refs.length; i2 += 1) {
1769              const ref = refs[i2];
1770              if (ref == null) {
1771                continue;
1772              }
1773              switch (typeof ref) {
1774                case "function": {
1775                  const cleanupCallback = cleanupCallbacks[i2];
1776                  if (typeof cleanupCallback === "function") {
1777                    cleanupCallback();
1778                  } else {
1779                    ref(null);
1780                  }
1781                  break;
1782                }
1783                case "object": {
1784                  ref.current = null;
1785                  break;
1786                }
1787                default:
1788              }
1789            }
1790          };
1791        }
1792      };
1793    }
1794  
1795    // node_modules/@base-ui/utils/esm/getReactElementRef.js
1796    var React3 = __toESM(require_react(), 1);
1797  
1798    // node_modules/@base-ui/utils/esm/reactVersion.js
1799    var React2 = __toESM(require_react(), 1);
1800    var majorVersion = parseInt(React2.version, 10);
1801    function isReactVersionAtLeast(reactVersionToCheck) {
1802      return majorVersion >= reactVersionToCheck;
1803    }
1804  
1805    // node_modules/@base-ui/utils/esm/getReactElementRef.js
1806    function getReactElementRef(element) {
1807      if (!/* @__PURE__ */ React3.isValidElement(element)) {
1808        return null;
1809      }
1810      const reactElement = element;
1811      const propsWithRef = reactElement.props;
1812      return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
1813    }
1814  
1815    // node_modules/@base-ui/utils/esm/mergeObjects.js
1816    function mergeObjects(a2, b2) {
1817      if (a2 && !b2) {
1818        return a2;
1819      }
1820      if (!a2 && b2) {
1821        return b2;
1822      }
1823      if (a2 || b2) {
1824        return {
1825          ...a2,
1826          ...b2
1827        };
1828      }
1829      return void 0;
1830    }
1831  
1832    // node_modules/@base-ui/react/esm/utils/getStateAttributesProps.js
1833    function getStateAttributesProps(state, customMapping) {
1834      const props = {};
1835      for (const key in state) {
1836        const value = state[key];
1837        if (customMapping?.hasOwnProperty(key)) {
1838          const customProps = customMapping[key](value);
1839          if (customProps != null) {
1840            Object.assign(props, customProps);
1841          }
1842          continue;
1843        }
1844        if (value === true) {
1845          props[`data-$key.toLowerCase()}`] = "";
1846        } else if (value) {
1847          props[`data-$key.toLowerCase()}`] = value.toString();
1848        }
1849      }
1850      return props;
1851    }
1852  
1853    // node_modules/@base-ui/react/esm/utils/resolveClassName.js
1854    function resolveClassName(className, state) {
1855      return typeof className === "function" ? className(state) : className;
1856    }
1857  
1858    // node_modules/@base-ui/react/esm/utils/resolveStyle.js
1859    function resolveStyle(style, state) {
1860      return typeof style === "function" ? style(state) : style;
1861    }
1862  
1863    // node_modules/@base-ui/react/esm/merge-props/mergeProps.js
1864    var EMPTY_PROPS = {};
1865    function mergeProps(a2, b2, c6, d2, e2) {
1866      let merged = {
1867        ...resolvePropsGetter(a2, EMPTY_PROPS)
1868      };
1869      if (b2) {
1870        merged = mergeOne(merged, b2);
1871      }
1872      if (c6) {
1873        merged = mergeOne(merged, c6);
1874      }
1875      if (d2) {
1876        merged = mergeOne(merged, d2);
1877      }
1878      if (e2) {
1879        merged = mergeOne(merged, e2);
1880      }
1881      return merged;
1882    }
1883    function mergePropsN(props) {
1884      if (props.length === 0) {
1885        return EMPTY_PROPS;
1886      }
1887      if (props.length === 1) {
1888        return resolvePropsGetter(props[0], EMPTY_PROPS);
1889      }
1890      let merged = {
1891        ...resolvePropsGetter(props[0], EMPTY_PROPS)
1892      };
1893      for (let i2 = 1; i2 < props.length; i2 += 1) {
1894        merged = mergeOne(merged, props[i2]);
1895      }
1896      return merged;
1897    }
1898    function mergeOne(merged, inputProps) {
1899      if (isPropsGetter(inputProps)) {
1900        return inputProps(merged);
1901      }
1902      return mutablyMergeInto(merged, inputProps);
1903    }
1904    function mutablyMergeInto(mergedProps, externalProps) {
1905      if (!externalProps) {
1906        return mergedProps;
1907      }
1908      for (const propName in externalProps) {
1909        const externalPropValue = externalProps[propName];
1910        switch (propName) {
1911          case "style": {
1912            mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
1913            break;
1914          }
1915          case "className": {
1916            mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
1917            break;
1918          }
1919          default: {
1920            if (isEventHandler(propName, externalPropValue)) {
1921              mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
1922            } else {
1923              mergedProps[propName] = externalPropValue;
1924            }
1925          }
1926        }
1927      }
1928      return mergedProps;
1929    }
1930    function isEventHandler(key, value) {
1931      const code0 = key.charCodeAt(0);
1932      const code1 = key.charCodeAt(1);
1933      const code2 = key.charCodeAt(2);
1934      return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
1935    }
1936    function isPropsGetter(inputProps) {
1937      return typeof inputProps === "function";
1938    }
1939    function resolvePropsGetter(inputProps, previousProps) {
1940      if (isPropsGetter(inputProps)) {
1941        return inputProps(previousProps);
1942      }
1943      return inputProps ?? EMPTY_PROPS;
1944    }
1945    function mergeEventHandlers(ourHandler, theirHandler) {
1946      if (!theirHandler) {
1947        return ourHandler;
1948      }
1949      if (!ourHandler) {
1950        return theirHandler;
1951      }
1952      return (event) => {
1953        if (isSyntheticEvent(event)) {
1954          const baseUIEvent = event;
1955          makeEventPreventable(baseUIEvent);
1956          const result2 = theirHandler(baseUIEvent);
1957          if (!baseUIEvent.baseUIHandlerPrevented) {
1958            ourHandler?.(baseUIEvent);
1959          }
1960          return result2;
1961        }
1962        const result = theirHandler(event);
1963        ourHandler?.(event);
1964        return result;
1965      };
1966    }
1967    function makeEventPreventable(event) {
1968      event.preventBaseUIHandler = () => {
1969        event.baseUIHandlerPrevented = true;
1970      };
1971      return event;
1972    }
1973    function mergeClassNames(ourClassName, theirClassName) {
1974      if (theirClassName) {
1975        if (ourClassName) {
1976          return theirClassName + " " + ourClassName;
1977        }
1978        return theirClassName;
1979      }
1980      return ourClassName;
1981    }
1982    function isSyntheticEvent(event) {
1983      return event != null && typeof event === "object" && "nativeEvent" in event;
1984    }
1985  
1986    // node_modules/@base-ui/utils/esm/empty.js
1987    var EMPTY_ARRAY2 = Object.freeze([]);
1988    var EMPTY_OBJECT = Object.freeze({});
1989  
1990    // node_modules/@base-ui/react/esm/utils/useRenderElement.js
1991    var import_react = __toESM(require_react(), 1);
1992    function useRenderElement(element, componentProps, params = {}) {
1993      const renderProp = componentProps.render;
1994      const outProps = useRenderElementProps(componentProps, params);
1995      if (params.enabled === false) {
1996        return null;
1997      }
1998      const state = params.state ?? EMPTY_OBJECT;
1999      return evaluateRenderProp(element, renderProp, outProps, state);
2000    }
2001    function useRenderElementProps(componentProps, params = {}) {
2002      const {
2003        className: classNameProp,
2004        style: styleProp,
2005        render: renderProp
2006      } = componentProps;
2007      const {
2008        state = EMPTY_OBJECT,
2009        ref,
2010        props,
2011        stateAttributesMapping,
2012        enabled = true
2013      } = params;
2014      const className = enabled ? resolveClassName(classNameProp, state) : void 0;
2015      const style = enabled ? resolveStyle(styleProp, state) : void 0;
2016      const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
2017      const outProps = enabled ? mergeObjects(stateProps, Array.isArray(props) ? mergePropsN(props) : props) ?? EMPTY_OBJECT : EMPTY_OBJECT;
2018      if (typeof document !== "undefined") {
2019        if (!enabled) {
2020          useMergedRefs(null, null);
2021        } else if (Array.isArray(ref)) {
2022          outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
2023        } else {
2024          outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
2025        }
2026      }
2027      if (!enabled) {
2028        return EMPTY_OBJECT;
2029      }
2030      if (className !== void 0) {
2031        outProps.className = mergeClassNames(outProps.className, className);
2032      }
2033      if (style !== void 0) {
2034        outProps.style = mergeObjects(outProps.style, style);
2035      }
2036      return outProps;
2037    }
2038    function evaluateRenderProp(element, render4, props, state) {
2039      if (render4) {
2040        if (typeof render4 === "function") {
2041          return render4(props, state);
2042        }
2043        const mergedProps = mergeProps(props, render4.props);
2044        mergedProps.ref = props.ref;
2045        return /* @__PURE__ */ React4.cloneElement(render4, mergedProps);
2046      }
2047      if (element) {
2048        if (typeof element === "string") {
2049          return renderTag(element, props);
2050        }
2051      }
2052      throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage(8));
2053    }
2054    function renderTag(Tag, props) {
2055      if (Tag === "button") {
2056        return /* @__PURE__ */ (0, import_react.createElement)("button", {
2057          type: "button",
2058          ...props,
2059          key: props.key
2060        });
2061      }
2062      if (Tag === "img") {
2063        return /* @__PURE__ */ (0, import_react.createElement)("img", {
2064          alt: "",
2065          ...props,
2066          key: props.key
2067        });
2068      }
2069      return /* @__PURE__ */ React4.createElement(Tag, props);
2070    }
2071  
2072    // node_modules/@base-ui/react/esm/use-render/useRender.js
2073    function useRender(params) {
2074      return useRenderElement(params.defaultTagName ?? "div", params, params);
2075    }
2076  
2077    // packages/ui/build-module/badge/badge.mjs
2078    var import_element3 = __toESM(require_element(), 1);
2079    if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='244b5c59c0']")) {
2080      const style = document.createElement("style");
2081      style.setAttribute("data-wp-hash", "244b5c59c0");
2082      style.appendChild(document.createTextNode('@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);font-family:var(--wpds-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-font-size-sm,12px);font-weight:var(--wpds-font-weight-regular,400);line-height:var(--wpds-font-line-height-xs,16px);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,#fde6bd);color:var(--wpds-color-fg-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-bg-surface-caution,#fee994);color:var(--wpds-color-fg-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-bg-surface-success,#c5f7cc);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,#f0f0f0);color:var(--wpds-color-fg-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-bg-surface-neutral,#f8f8f8);color:var(--wpds-color-fg-content-neutral-weak,#6d6d6d)}}'));
2083      document.head.appendChild(style);
2084    }
2085    var style_default = { "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" };
2086    var Badge = (0, import_element3.forwardRef)(function Badge2({ children, intent = "none", render: render4, className, ...props }, ref) {
2087      const element = useRender({
2088        render: render4,
2089        defaultTagName: "span",
2090        ref,
2091        props: mergeProps(props, {
2092          className: clsx_default(
2093            style_default.badge,
2094            style_default[`is-$intent}-intent`],
2095            className
2096          ),
2097          children
2098        })
2099      });
2100      return element;
2101    });
2102  
2103    // packages/icons/build-module/icon/index.mjs
2104    var import_element4 = __toESM(require_element(), 1);
2105    var icon_default = (0, import_element4.forwardRef)(
2106      ({ icon, size = 24, ...props }, ref) => {
2107        return (0, import_element4.cloneElement)(icon, {
2108          width: size,
2109          height: size,
2110          ...props,
2111          ref
2112        });
2113      }
2114    );
2115  
2116    // packages/icons/build-module/library/archive.mjs
2117    var import_primitives = __toESM(require_primitives(), 1);
2118    var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
2119    var archive_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.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" }) });
2120  
2121    // packages/icons/build-module/library/arrow-down.mjs
2122    var import_primitives2 = __toESM(require_primitives(), 1);
2123    var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
2124    var arrow_down_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives2.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" }) });
2125  
2126    // packages/icons/build-module/library/arrow-left.mjs
2127    var import_primitives3 = __toESM(require_primitives(), 1);
2128    var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
2129    var arrow_left_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives3.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) });
2130  
2131    // packages/icons/build-module/library/arrow-right.mjs
2132    var import_primitives4 = __toESM(require_primitives(), 1);
2133    var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
2134    var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives4.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) });
2135  
2136    // packages/icons/build-module/library/arrow-up-left.mjs
2137    var import_primitives5 = __toESM(require_primitives(), 1);
2138    var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
2139    var arrow_up_left_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives5.Path, { d: "M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z" }) });
2140  
2141    // packages/icons/build-module/library/arrow-up.mjs
2142    var import_primitives6 = __toESM(require_primitives(), 1);
2143    var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
2144    var arrow_up_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives6.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) });
2145  
2146    // packages/icons/build-module/library/backup.mjs
2147    var import_primitives7 = __toESM(require_primitives(), 1);
2148    var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
2149    var backup_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives7.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" }) });
2150  
2151    // packages/icons/build-module/library/block-meta.mjs
2152    var import_primitives8 = __toESM(require_primitives(), 1);
2153    var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
2154    var block_meta_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives8.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" }) });
2155  
2156    // packages/icons/build-module/library/block-table.mjs
2157    var import_primitives9 = __toESM(require_primitives(), 1);
2158    var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
2159    var block_table_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives9.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" }) });
2160  
2161    // packages/icons/build-module/library/calendar.mjs
2162    var import_primitives10 = __toESM(require_primitives(), 1);
2163    var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
2164    var calendar_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives10.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" }) });
2165  
2166    // packages/icons/build-module/library/category.mjs
2167    var import_primitives11 = __toESM(require_primitives(), 1);
2168    var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
2169    var category_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives11.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" }) });
2170  
2171    // packages/icons/build-module/library/check.mjs
2172    var import_primitives12 = __toESM(require_primitives(), 1);
2173    var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
2174    var check_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives12.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) });
2175  
2176    // packages/icons/build-module/library/chevron-down.mjs
2177    var import_primitives13 = __toESM(require_primitives(), 1);
2178    var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
2179    var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives13.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) });
2180  
2181    // packages/icons/build-module/library/chevron-left-small.mjs
2182    var import_primitives14 = __toESM(require_primitives(), 1);
2183    var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
2184    var chevron_left_small_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives14.Path, { d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" }) });
2185  
2186    // packages/icons/build-module/library/chevron-left.mjs
2187    var import_primitives15 = __toESM(require_primitives(), 1);
2188    var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
2189    var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives15.Path, { d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" }) });
2190  
2191    // packages/icons/build-module/library/chevron-right-small.mjs
2192    var import_primitives16 = __toESM(require_primitives(), 1);
2193    var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
2194    var chevron_right_small_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives16.Path, { d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" }) });
2195  
2196    // packages/icons/build-module/library/chevron-right.mjs
2197    var import_primitives17 = __toESM(require_primitives(), 1);
2198    var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
2199    var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives17.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) });
2200  
2201    // packages/icons/build-module/library/chevron-up.mjs
2202    var import_primitives18 = __toESM(require_primitives(), 1);
2203    var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
2204    var chevron_up_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives18.Path, { d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" }) });
2205  
2206    // packages/icons/build-module/library/close-small.mjs
2207    var import_primitives19 = __toESM(require_primitives(), 1);
2208    var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
2209    var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives19.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" }) });
2210  
2211    // packages/icons/build-module/library/cog.mjs
2212    var import_primitives20 = __toESM(require_primitives(), 1);
2213    var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
2214    var cog_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives20.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" }) });
2215  
2216    // packages/icons/build-module/library/comment-author-avatar.mjs
2217    var import_primitives21 = __toESM(require_primitives(), 1);
2218    var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
2219    var comment_author_avatar_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives21.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" }) });
2220  
2221    // packages/icons/build-module/library/download.mjs
2222    var import_primitives22 = __toESM(require_primitives(), 1);
2223    var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
2224    var download_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives22.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives22.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" }) });
2225  
2226    // packages/icons/build-module/library/drafts.mjs
2227    var import_primitives23 = __toESM(require_primitives(), 1);
2228    var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
2229    var drafts_default = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives23.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives23.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" }) });
2230  
2231    // packages/icons/build-module/library/drawer-right.mjs
2232    var import_primitives24 = __toESM(require_primitives(), 1);
2233    var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
2234    var drawer_right_default = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives24.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives24.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" }) });
2235  
2236    // packages/icons/build-module/library/envelope.mjs
2237    var import_primitives25 = __toESM(require_primitives(), 1);
2238    var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
2239    var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives25.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" }) });
2240  
2241    // packages/icons/build-module/library/error.mjs
2242    var import_primitives26 = __toESM(require_primitives(), 1);
2243    var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
2244    var error_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives26.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives26.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" }) });
2245  
2246    // packages/icons/build-module/library/file.mjs
2247    var import_primitives27 = __toESM(require_primitives(), 1);
2248    var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
2249    var file_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives27.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives27.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" }) });
2250  
2251    // packages/icons/build-module/library/format-list-bullets-rtl.mjs
2252    var import_primitives28 = __toESM(require_primitives(), 1);
2253    var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
2254    var format_list_bullets_rtl_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives28.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives28.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" }) });
2255  
2256    // packages/icons/build-module/library/format-list-bullets.mjs
2257    var import_primitives29 = __toESM(require_primitives(), 1);
2258    var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
2259    var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives29.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives29.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" }) });
2260  
2261    // packages/icons/build-module/library/funnel.mjs
2262    var import_primitives30 = __toESM(require_primitives(), 1);
2263    var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
2264    var funnel_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives30.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives30.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) });
2265  
2266    // packages/icons/build-module/library/globe.mjs
2267    var import_primitives31 = __toESM(require_primitives(), 1);
2268    var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
2269    var globe_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives31.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives31.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" }) });
2270  
2271    // packages/icons/build-module/library/help.mjs
2272    var import_primitives32 = __toESM(require_primitives(), 1);
2273    var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
2274    var help_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives32.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives32.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" }) });
2275  
2276    // packages/icons/build-module/library/home.mjs
2277    var import_primitives33 = __toESM(require_primitives(), 1);
2278    var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
2279    var home_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives33.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives33.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) });
2280  
2281    // packages/icons/build-module/library/layout.mjs
2282    var import_primitives34 = __toESM(require_primitives(), 1);
2283    var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
2284    var layout_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives34.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives34.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" }) });
2285  
2286    // packages/icons/build-module/library/link.mjs
2287    var import_primitives35 = __toESM(require_primitives(), 1);
2288    var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
2289    var link_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives35.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives35.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" }) });
2290  
2291    // packages/icons/build-module/library/list.mjs
2292    var import_primitives36 = __toESM(require_primitives(), 1);
2293    var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
2294    var list_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives36.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives36.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" }) });
2295  
2296    // packages/icons/build-module/library/media.mjs
2297    var import_primitives37 = __toESM(require_primitives(), 1);
2298    var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
2299    var media_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_primitives37.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
2300      /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives37.Path, { d: "m7 6.5 4 2.5-4 2.5z" }),
2301      /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives37.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" })
2302    ] });
2303  
2304    // packages/icons/build-module/library/mobile.mjs
2305    var import_primitives38 = __toESM(require_primitives(), 1);
2306    var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
2307    var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives38.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives38.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" }) });
2308  
2309    // packages/icons/build-module/library/more-vertical.mjs
2310    var import_primitives39 = __toESM(require_primitives(), 1);
2311    var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
2312    var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives39.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives39.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) });
2313  
2314    // packages/icons/build-module/library/navigation.mjs
2315    var import_primitives40 = __toESM(require_primitives(), 1);
2316    var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
2317    var navigation_default = /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives40.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives40.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" }) });
2318  
2319    // packages/icons/build-module/library/next.mjs
2320    var import_primitives41 = __toESM(require_primitives(), 1);
2321    var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
2322    var next_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives41.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives41.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" }) });
2323  
2324    // packages/icons/build-module/library/not-allowed.mjs
2325    var import_primitives42 = __toESM(require_primitives(), 1);
2326    var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
2327    var not_allowed_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives42.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives42.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" }) });
2328  
2329    // packages/icons/build-module/library/not-found.mjs
2330    var import_primitives43 = __toESM(require_primitives(), 1);
2331    var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
2332    var not_found_default = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives43.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives43.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" }) });
2333  
2334    // packages/icons/build-module/library/page.mjs
2335    var import_primitives44 = __toESM(require_primitives(), 1);
2336    var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
2337    var page_default = /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_primitives44.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
2338      /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives44.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }),
2339      /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives44.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" })
2340    ] });
2341  
2342    // packages/icons/build-module/library/pages.mjs
2343    var import_primitives45 = __toESM(require_primitives(), 1);
2344    var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
2345    var pages_default = /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_primitives45.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
2346      /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives45.Path, { d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z" }),
2347      /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives45.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" }),
2348      /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives45.Path, { d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z" })
2349    ] });
2350  
2351    // packages/icons/build-module/library/pencil.mjs
2352    var import_primitives46 = __toESM(require_primitives(), 1);
2353    var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
2354    var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives46.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives46.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) });
2355  
2356    // packages/icons/build-module/library/pending.mjs
2357    var import_primitives47 = __toESM(require_primitives(), 1);
2358    var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
2359    var pending_default = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives47.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives47.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" }) });
2360  
2361    // packages/icons/build-module/library/pin.mjs
2362    var import_primitives48 = __toESM(require_primitives(), 1);
2363    var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
2364    var pin_default = /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives48.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives48.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" }) });
2365  
2366    // packages/icons/build-module/library/plugins.mjs
2367    var import_primitives49 = __toESM(require_primitives(), 1);
2368    var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
2369    var plugins_default = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives49.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives49.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" }) });
2370  
2371    // packages/icons/build-module/library/post.mjs
2372    var import_primitives50 = __toESM(require_primitives(), 1);
2373    var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
2374    var post_default = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives50.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives50.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" }) });
2375  
2376    // packages/icons/build-module/library/previous.mjs
2377    var import_primitives51 = __toESM(require_primitives(), 1);
2378    var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
2379    var previous_default = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives51.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives51.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" }) });
2380  
2381    // packages/icons/build-module/library/published.mjs
2382    var import_primitives52 = __toESM(require_primitives(), 1);
2383    var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
2384    var published_default = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives52.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives52.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" }) });
2385  
2386    // packages/icons/build-module/library/rotate-left.mjs
2387    var import_primitives53 = __toESM(require_primitives(), 1);
2388    var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
2389    var rotate_left_default = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives53.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives53.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" }) });
2390  
2391    // packages/icons/build-module/library/rotate-right.mjs
2392    var import_primitives54 = __toESM(require_primitives(), 1);
2393    var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
2394    var rotate_right_default = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives54.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives54.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" }) });
2395  
2396    // packages/icons/build-module/library/scheduled.mjs
2397    var import_primitives55 = __toESM(require_primitives(), 1);
2398    var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
2399    var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives55.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime56.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 0Zm9 1V8h-1.5v3.5h-2V13H13Z" }) });
2400  
2401    // packages/icons/build-module/library/search.mjs
2402    var import_primitives56 = __toESM(require_primitives(), 1);
2403    var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
2404    var search_default = /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives56.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives56.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" }) });
2405  
2406    // packages/icons/build-module/library/seen.mjs
2407    var import_primitives57 = __toESM(require_primitives(), 1);
2408    var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
2409    var seen_default = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives57.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives57.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" }) });
2410  
2411    // packages/icons/build-module/library/styles.mjs
2412    var import_primitives58 = __toESM(require_primitives(), 1);
2413    var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
2414    var styles_default = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives58.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives58.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" }) });
2415  
2416    // packages/icons/build-module/library/symbol-filled.mjs
2417    var import_primitives59 = __toESM(require_primitives(), 1);
2418    var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
2419    var symbol_filled_default = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives59.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives59.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" }) });
2420  
2421    // packages/icons/build-module/library/symbol.mjs
2422    var import_primitives60 = __toESM(require_primitives(), 1);
2423    var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
2424    var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives60.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives60.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" }) });
2425  
2426    // packages/icons/build-module/library/tag.mjs
2427    var import_primitives61 = __toESM(require_primitives(), 1);
2428    var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
2429    var tag_default = /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives61.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives61.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" }) });
2430  
2431    // packages/icons/build-module/library/trash.mjs
2432    var import_primitives62 = __toESM(require_primitives(), 1);
2433    var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
2434    var trash_default = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives62.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives62.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" }) });
2435  
2436    // packages/icons/build-module/library/unseen.mjs
2437    var import_primitives63 = __toESM(require_primitives(), 1);
2438    var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
2439    var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives63.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives63.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" }) });
2440  
2441    // packages/icons/build-module/library/upload.mjs
2442    var import_primitives64 = __toESM(require_primitives(), 1);
2443    var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
2444    var upload_default = /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives64.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives64.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" }) });
2445  
2446    // packages/icons/build-module/library/verse.mjs
2447    var import_primitives65 = __toESM(require_primitives(), 1);
2448    var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
2449    var verse_default = /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives65.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives65.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" }) });
2450  
2451    // packages/icons/build-module/library/wordpress.mjs
2452    var import_primitives66 = __toESM(require_primitives(), 1);
2453    var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
2454    var wordpress_default = /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives66.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_primitives66.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" }) });
2455  
2456    // packages/ui/build-module/stack/stack.mjs
2457    var import_element5 = __toESM(require_element(), 1);
2458    if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='71d20935c2']")) {
2459      const style = document.createElement("style");
2460      style.setAttribute("data-wp-hash", "71d20935c2");
2461      style.appendChild(document.createTextNode("@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}"));
2462      document.head.appendChild(style);
2463    }
2464    var style_default2 = { "stack": "_19ce0419607e1896__stack" };
2465    var gapTokens = {
2466      xs: "var(--wpds-dimension-gap-xs, 4px)",
2467      sm: "var(--wpds-dimension-gap-sm, 8px)",
2468      md: "var(--wpds-dimension-gap-md, 12px)",
2469      lg: "var(--wpds-dimension-gap-lg, 16px)",
2470      xl: "var(--wpds-dimension-gap-xl, 24px)",
2471      "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
2472      "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
2473    };
2474    var Stack = (0, import_element5.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) {
2475      const style = {
2476        gap: gap && gapTokens[gap],
2477        alignItems: align,
2478        justifyContent: justify,
2479        flexDirection: direction,
2480        flexWrap: wrap
2481      };
2482      const element = useRender({
2483        render: render4,
2484        ref,
2485        props: mergeProps(props, { style, className: style_default2.stack })
2486      });
2487      return element;
2488    });
2489  
2490    // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs
2491    var import_components = __toESM(require_components(), 1);
2492    var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components.createSlotFill)("SidebarToggle");
2493  
2494    // packages/admin-ui/build-module/page/header.mjs
2495    var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
2496    function Header({
2497      headingLevel = 1,
2498      breadcrumbs,
2499      badges,
2500      title,
2501      subTitle,
2502      actions,
2503      showSidebarToggle = true
2504    }) {
2505      const HeadingTag = `h$headingLevel}`;
2506      return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Stack, { direction: "column", className: "admin-ui-page__header", children: [
2507        /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Stack, { direction: "row", justify: "space-between", gap: "sm", children: [
2508          /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", justify: "start", children: [
2509            showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2510              SidebarToggleSlot,
2511              {
2512                bubblesVirtually: true,
2513                className: "admin-ui-page__sidebar-toggle-slot"
2514              }
2515            ),
2516            title && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(HeadingTag, { className: "admin-ui-page__header-title", children: title }),
2517            breadcrumbs,
2518            badges
2519          ] }),
2520          /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2521            Stack,
2522            {
2523              direction: "row",
2524              gap: "sm",
2525              style: { width: "auto", flexShrink: 0 },
2526              className: "admin-ui-page__header-actions",
2527              align: "center",
2528              children: actions
2529            }
2530          )
2531        ] }),
2532        subTitle && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "admin-ui-page__header-subtitle", children: subTitle })
2533      ] });
2534    }
2535  
2536    // packages/admin-ui/build-module/page/index.mjs
2537    var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
2538    function Page({
2539      headingLevel,
2540      breadcrumbs,
2541      badges,
2542      title,
2543      subTitle,
2544      children,
2545      className,
2546      actions,
2547      hasPadding = false,
2548      showSidebarToggle = true
2549    }) {
2550      const classes = clsx_default("admin-ui-page", className);
2551      return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(navigable_region_default, { className: classes, ariaLabel: title, children: [
2552        (title || breadcrumbs || badges) && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
2553          Header,
2554          {
2555            headingLevel,
2556            breadcrumbs,
2557            badges,
2558            title,
2559            subTitle,
2560            actions,
2561            showSidebarToggle
2562          }
2563        ),
2564        hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "admin-ui-page__content has-padding", children }) : children
2565      ] });
2566    }
2567    Page.SidebarToggleFill = SidebarToggleFill;
2568    var page_default2 = Page;
2569  
2570    // packages/edit-site/build-module/components/layout/index.mjs
2571    var import_components8 = __toESM(require_components(), 1);
2572    var import_compose2 = __toESM(require_compose(), 1);
2573    var import_i18n8 = __toESM(require_i18n(), 1);
2574    var import_element14 = __toESM(require_element(), 1);
2575    var import_editor6 = __toESM(require_editor(), 1);
2576    var import_router6 = __toESM(require_router(), 1);
2577    var import_plugins2 = __toESM(require_plugins(), 1);
2578    var import_notices = __toESM(require_notices(), 1);
2579    var import_data13 = __toESM(require_data(), 1);
2580    var import_preferences3 = __toESM(require_preferences(), 1);
2581  
2582    // packages/edit-site/build-module/components/site-hub/index.mjs
2583    var import_data5 = __toESM(require_data(), 1);
2584    var import_components3 = __toESM(require_components(), 1);
2585    var import_i18n3 = __toESM(require_i18n(), 1);
2586    var import_core_data4 = __toESM(require_core_data(), 1);
2587    var import_html_entities = __toESM(require_html_entities(), 1);
2588    var import_element7 = __toESM(require_element(), 1);
2589    var import_commands = __toESM(require_commands(), 1);
2590    var import_keycodes = __toESM(require_keycodes(), 1);
2591    var import_url = __toESM(require_url(), 1);
2592    var import_router = __toESM(require_router(), 1);
2593  
2594    // packages/edit-site/build-module/components/site-icon/index.mjs
2595    var import_data4 = __toESM(require_data(), 1);
2596    var import_components2 = __toESM(require_components(), 1);
2597    var import_i18n2 = __toESM(require_i18n(), 1);
2598    var import_core_data3 = __toESM(require_core_data(), 1);
2599    var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
2600    function SiteIcon({ className }) {
2601      const { isRequestingSite, siteIconUrl } = (0, import_data4.useSelect)((select3) => {
2602        const { getEntityRecord } = select3(import_core_data3.store);
2603        const siteData = getEntityRecord("root", "__unstableBase", void 0);
2604        return {
2605          isRequestingSite: !siteData,
2606          siteIconUrl: siteData?.site_icon_url
2607        };
2608      }, []);
2609      if (isRequestingSite && !siteIconUrl) {
2610        return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "edit-site-site-icon__image" });
2611      }
2612      const icon = siteIconUrl ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
2613        "img",
2614        {
2615          className: "edit-site-site-icon__image",
2616          alt: (0, import_i18n2.__)("Site Icon"),
2617          src: siteIconUrl
2618        }
2619      ) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
2620        import_components2.Icon,
2621        {
2622          className: "edit-site-site-icon__icon",
2623          icon: wordpress_default,
2624          size: 48
2625        }
2626      );
2627      return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: clsx_default(className, "edit-site-site-icon"), children: icon });
2628    }
2629    var site_icon_default = SiteIcon;
2630  
2631    // packages/edit-site/build-module/components/sidebar/index.mjs
2632    var import_element6 = __toESM(require_element(), 1);
2633    var import_dom = __toESM(require_dom(), 1);
2634    var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
2635    var SidebarNavigationContext = (0, import_element6.createContext)(() => {
2636    });
2637    SidebarNavigationContext.displayName = "SidebarNavigationContext";
2638    function focusSidebarElement(el, direction, focusSelector) {
2639      let elementToFocus;
2640      if (direction === "back" && focusSelector) {
2641        elementToFocus = el.querySelector(focusSelector);
2642      }
2643      if (direction !== null && !elementToFocus) {
2644        const [firstTabbable] = import_dom.focus.tabbable.find(el);
2645        elementToFocus = firstTabbable ?? el;
2646      }
2647      elementToFocus?.focus();
2648    }
2649    function createNavState() {
2650      let state = {
2651        direction: null,
2652        focusSelector: null
2653      };
2654      return {
2655        get() {
2656          return state;
2657        },
2658        navigate(direction, focusSelector = null) {
2659          state = {
2660            direction,
2661            focusSelector: direction === "forward" && focusSelector ? focusSelector : state.focusSelector
2662          };
2663        }
2664      };
2665    }
2666    function SidebarContentWrapper({ children, shouldAnimate }) {
2667      const navState = (0, import_element6.useContext)(SidebarNavigationContext);
2668      const wrapperRef = (0, import_element6.useRef)();
2669      const [navAnimation, setNavAnimation] = (0, import_element6.useState)(null);
2670      (0, import_element6.useLayoutEffect)(() => {
2671        const { direction, focusSelector } = navState.get();
2672        focusSidebarElement(wrapperRef.current, direction, focusSelector);
2673        setNavAnimation(direction);
2674      }, [navState]);
2675      const wrapperCls = clsx_default(
2676        "edit-site-sidebar__screen-wrapper",
2677        /*
2678         * Some panes do not have sub-panes and therefore
2679         * should not animate when clicked on.
2680         */
2681        shouldAnimate ? {
2682          "slide-from-left": navAnimation === "back",
2683          "slide-from-right": navAnimation === "forward"
2684        } : {}
2685      );
2686      return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { ref: wrapperRef, className: wrapperCls, children });
2687    }
2688    function SidebarNavigationProvider({ children }) {
2689      const [navState] = (0, import_element6.useState)(createNavState);
2690      return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SidebarNavigationContext.Provider, { value: navState, children });
2691    }
2692    function SidebarContent({ routeKey, shouldAnimate, children }) {
2693      return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "edit-site-sidebar__content", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
2694        SidebarContentWrapper,
2695        {
2696          shouldAnimate,
2697          children
2698        },
2699        routeKey
2700      ) });
2701    }
2702  
2703    // packages/edit-site/build-module/components/site-hub/index.mjs
2704    var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
2705    var { useLocation, useHistory } = unlock(import_router.privateApis);
2706    var SiteHub = (0, import_element7.memo)(
2707      (0, import_element7.forwardRef)(({ isTransparent }, ref) => {
2708        const { dashboardLink, homeUrl, siteTitle } = (0, import_data5.useSelect)((select3) => {
2709          const { getSettings: getSettings7 } = unlock(select3(store));
2710          const { getEntityRecord } = select3(import_core_data4.store);
2711          const _site = getEntityRecord("root", "site");
2712          return {
2713            dashboardLink: getSettings7().__experimentalDashboardLink,
2714            homeUrl: getEntityRecord("root", "__unstableBase")?.home,
2715            siteTitle: !_site?.title && !!_site?.url ? (0, import_url.filterURLForDisplay)(_site?.url) : _site?.title
2716          };
2717        }, []);
2718        const { open: openCommandCenter } = (0, import_data5.useDispatch)(import_commands.store);
2719        return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_components3.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [
2720          /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2721            "div",
2722            {
2723              className: clsx_default(
2724                "edit-site-site-hub__view-mode-toggle-container",
2725                {
2726                  "has-transparent-background": isTransparent
2727                }
2728              ),
2729              children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2730                import_components3.Button,
2731                {
2732                  __next40pxDefaultSize: true,
2733                  ref,
2734                  href: dashboardLink,
2735                  label: (0, import_i18n3.__)("Go to the Dashboard"),
2736                  className: "edit-site-layout__view-mode-toggle",
2737                  style: {
2738                    transform: "scale(0.5333) translateX(-4px)",
2739                    // Offset to position the icon 12px from viewport edge
2740                    borderRadius: 4
2741                  },
2742                  children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" })
2743                }
2744              )
2745            }
2746          ),
2747          /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_components3.__experimentalHStack, { children: [
2748            /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
2749              import_components3.Button,
2750              {
2751                __next40pxDefaultSize: true,
2752                variant: "link",
2753                href: homeUrl,
2754                target: "_blank",
2755                children: [
2756                  (0, import_html_entities.decodeEntities)(siteTitle),
2757                  /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components3.VisuallyHidden, {
2758                    as: "span",
2759                    /* translators: accessibility text */
2760                    children: (0, import_i18n3.__)("(opens in a new tab)")
2761                  })
2762                ]
2763              }
2764            ) }),
2765            /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2766              import_components3.__experimentalHStack,
2767              {
2768                spacing: 0,
2769                expanded: false,
2770                className: "edit-site-site-hub__actions",
2771                children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2772                  import_components3.Button,
2773                  {
2774                    size: "compact",
2775                    className: "edit-site-site-hub_toggle-command-center",
2776                    icon: search_default,
2777                    onClick: () => openCommandCenter(),
2778                    label: (0, import_i18n3.__)("Open command palette"),
2779                    shortcut: import_keycodes.displayShortcut.primary("k")
2780                  }
2781                )
2782              }
2783            )
2784          ] })
2785        ] }) });
2786      })
2787    );
2788    var site_hub_default = SiteHub;
2789    var SiteHubMobile = (0, import_element7.memo)(
2790      (0, import_element7.forwardRef)(({ isTransparent }, ref) => {
2791        const { path } = useLocation();
2792        const history = useHistory();
2793        const { navigate } = (0, import_element7.useContext)(SidebarNavigationContext);
2794        const {
2795          dashboardLink,
2796          homeUrl,
2797          siteTitle,
2798          isBlockTheme,
2799          isClassicThemeWithStyleBookSupport: isClassicThemeWithStyleBookSupport2
2800        } = (0, import_data5.useSelect)((select3) => {
2801          const { getSettings: getSettings7 } = unlock(select3(store));
2802          const { getEntityRecord, getCurrentTheme } = select3(import_core_data4.store);
2803          const _site = getEntityRecord("root", "site");
2804          const currentTheme = getCurrentTheme();
2805          const settings2 = getSettings7();
2806          const supportsEditorStyles = currentTheme?.theme_supports["editor-styles"];
2807          const hasThemeJson = settings2.supportsLayout;
2808          return {
2809            dashboardLink: settings2.__experimentalDashboardLink,
2810            homeUrl: getEntityRecord("root", "__unstableBase")?.home,
2811            siteTitle: !_site?.title && !!_site?.url ? (0, import_url.filterURLForDisplay)(_site?.url) : _site?.title,
2812            isBlockTheme: currentTheme?.is_block_theme,
2813            isClassicThemeWithStyleBookSupport: !currentTheme?.is_block_theme && (supportsEditorStyles || hasThemeJson)
2814          };
2815        }, []);
2816        const { open: openCommandCenter } = (0, import_data5.useDispatch)(import_commands.store);
2817        let backPath;
2818        if (path !== "/") {
2819          if (isBlockTheme || isClassicThemeWithStyleBookSupport2) {
2820            backPath = "/";
2821          } else if (path !== "/pattern") {
2822            backPath = "/pattern";
2823          }
2824        }
2825        const backButtonProps = {
2826          href: !!backPath ? void 0 : dashboardLink,
2827          label: !!backPath ? (0, import_i18n3.__)("Go to Site Editor") : (0, import_i18n3.__)("Go to the Dashboard"),
2828          onClick: !!backPath ? () => {
2829            history.navigate(backPath);
2830            navigate("back");
2831          } : void 0
2832        };
2833        return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "edit-site-site-hub", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_components3.__experimentalHStack, { justify: "flex-start", spacing: "0", children: [
2834          /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2835            "div",
2836            {
2837              className: clsx_default(
2838                "edit-site-site-hub__view-mode-toggle-container",
2839                {
2840                  "has-transparent-background": isTransparent
2841                }
2842              ),
2843              children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2844                import_components3.Button,
2845                {
2846                  __next40pxDefaultSize: true,
2847                  ref,
2848                  className: "edit-site-layout__view-mode-toggle",
2849                  style: {
2850                    transform: "scale(0.5)",
2851                    borderRadius: 4
2852                  },
2853                  ...backButtonProps,
2854                  children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(site_icon_default, { className: "edit-site-layout__view-mode-toggle-icon" })
2855                }
2856              )
2857            }
2858          ),
2859          /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_components3.__experimentalHStack, { children: [
2860            /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "edit-site-site-hub__title", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2861              import_components3.Button,
2862              {
2863                __next40pxDefaultSize: true,
2864                variant: "link",
2865                href: homeUrl,
2866                target: "_blank",
2867                label: (0, import_i18n3.__)("View site (opens in a new tab)"),
2868                children: (0, import_html_entities.decodeEntities)(siteTitle)
2869              }
2870            ) }),
2871            /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2872              import_components3.__experimentalHStack,
2873              {
2874                spacing: 0,
2875                expanded: false,
2876                className: "edit-site-site-hub__actions",
2877                children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2878                  import_components3.Button,
2879                  {
2880                    __next40pxDefaultSize: true,
2881                    className: "edit-site-site-hub_toggle-command-center",
2882                    icon: search_default,
2883                    onClick: () => openCommandCenter(),
2884                    label: (0, import_i18n3.__)("Open command palette"),
2885                    shortcut: import_keycodes.displayShortcut.primary("k")
2886                  }
2887                )
2888              }
2889            )
2890          ] })
2891        ] }) });
2892      })
2893    );
2894  
2895    // packages/edit-site/build-module/components/resizable-frame/index.mjs
2896    var import_element8 = __toESM(require_element(), 1);
2897    var import_components4 = __toESM(require_components(), 1);
2898    var import_compose = __toESM(require_compose(), 1);
2899    var import_i18n4 = __toESM(require_i18n(), 1);
2900    var import_router2 = __toESM(require_router(), 1);
2901    var import_data6 = __toESM(require_data(), 1);
2902    var import_core_data5 = __toESM(require_core_data(), 1);
2903    var import_url2 = __toESM(require_url(), 1);
2904    var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
2905    var { useLocation: useLocation2, useHistory: useHistory2 } = unlock(import_router2.privateApis);
2906    var HANDLE_STYLES_OVERRIDE = {
2907      position: void 0,
2908      userSelect: void 0,
2909      cursor: void 0,
2910      width: void 0,
2911      height: void 0,
2912      top: void 0,
2913      right: void 0,
2914      bottom: void 0,
2915      left: void 0
2916    };
2917    var FRAME_MIN_WIDTH = 320;
2918    var FRAME_REFERENCE_WIDTH = 1300;
2919    var FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;
2920    var SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;
2921    var INITIAL_FRAME_SIZE = { width: "100%", height: "100%" };
2922    function calculateNewHeight(width, initialAspectRatio) {
2923      const lerp = (a2, b2, amount) => {
2924        return a2 + (b2 - a2) * amount;
2925      };
2926      const lerpFactor = 1 - Math.max(
2927        0,
2928        Math.min(
2929          1,
2930          (width - FRAME_MIN_WIDTH) / (FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH)
2931        )
2932      );
2933      const intermediateAspectRatio = lerp(
2934        initialAspectRatio,
2935        FRAME_TARGET_ASPECT_RATIO,
2936        lerpFactor
2937      );
2938      return width / intermediateAspectRatio;
2939    }
2940    function ResizableFrame({
2941      isFullWidth,
2942      isOversized,
2943      setIsOversized,
2944      isReady,
2945      children,
2946      /** The default (unresized) width/height of the frame, based on the space available in the viewport. */
2947      defaultSize,
2948      innerContentStyle
2949    }) {
2950      const history = useHistory2();
2951      const { path, query } = useLocation2();
2952      const { canvas = "view" } = query;
2953      const disableMotion = (0, import_compose.useReducedMotion)();
2954      const [frameSize, setFrameSize] = (0, import_element8.useState)(INITIAL_FRAME_SIZE);
2955      const [startingWidth, setStartingWidth] = (0, import_element8.useState)();
2956      const [isResizing, setIsResizing] = (0, import_element8.useState)(false);
2957      const [shouldShowHandle, setShouldShowHandle] = (0, import_element8.useState)(false);
2958      const [resizeRatio, setResizeRatio] = (0, import_element8.useState)(1);
2959      const FRAME_TRANSITION = { type: "tween", duration: isResizing ? 0 : 0.5 };
2960      const frameRef = (0, import_element8.useRef)(null);
2961      const resizableHandleHelpId = (0, import_compose.useInstanceId)(
2962        ResizableFrame,
2963        "edit-site-resizable-frame-handle-help"
2964      );
2965      const defaultAspectRatio = defaultSize.width / defaultSize.height;
2966      const isBlockTheme = (0, import_data6.useSelect)((select3) => {
2967        const { getCurrentTheme } = select3(import_core_data5.store);
2968        return getCurrentTheme()?.is_block_theme;
2969      }, []);
2970      const handleResizeStart = (_event, _direction, ref) => {
2971        setStartingWidth(ref.offsetWidth);
2972        setIsResizing(true);
2973      };
2974      const handleResize = (_event, _direction, _ref, delta) => {
2975        const normalizedDelta = delta.width / resizeRatio;
2976        const deltaAbs = Math.abs(normalizedDelta);
2977        const maxDoubledDelta = delta.width < 0 ? deltaAbs : (defaultSize.width - startingWidth) / 2;
2978        const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta);
2979        const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;
2980        const singleSegment = 1 - doubleSegment;
2981        setResizeRatio(singleSegment + doubleSegment * 2);
2982        const updatedWidth = startingWidth + delta.width;
2983        setIsOversized(updatedWidth > defaultSize.width);
2984        setFrameSize({
2985          height: isOversized ? "100%" : calculateNewHeight(updatedWidth, defaultAspectRatio)
2986        });
2987      };
2988      const handleResizeStop = (_event, _direction, ref) => {
2989        setIsResizing(false);
2990        if (!isOversized) {
2991          return;
2992        }
2993        setIsOversized(false);
2994        const remainingWidth = ref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;
2995        if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD || !isBlockTheme) {
2996          setFrameSize(INITIAL_FRAME_SIZE);
2997        } else {
2998          history.navigate(
2999            (0, import_url2.addQueryArgs)(path, {
3000              canvas: "edit"
3001            }),
3002            {
3003              transition: "canvas-mode-edit-transition"
3004            }
3005          );
3006        }
3007      };
3008      const handleResizableHandleKeyDown = (event) => {
3009        if (!["ArrowLeft", "ArrowRight"].includes(event.key)) {
3010          return;
3011        }
3012        event.preventDefault();
3013        const step = 20 * (event.shiftKey ? 5 : 1);
3014        const delta = step * (event.key === "ArrowLeft" ? 1 : -1) * ((0, import_i18n4.isRTL)() ? -1 : 1);
3015        const newWidth = Math.min(
3016          Math.max(
3017            FRAME_MIN_WIDTH,
3018            frameRef.current.resizable.offsetWidth + delta
3019          ),
3020          defaultSize.width
3021        );
3022        setFrameSize({
3023          width: newWidth,
3024          height: calculateNewHeight(newWidth, defaultAspectRatio)
3025        });
3026      };
3027      const frameAnimationVariants = {
3028        default: {
3029          flexGrow: 0,
3030          height: frameSize.height
3031        },
3032        fullWidth: {
3033          flexGrow: 1,
3034          height: frameSize.height
3035        }
3036      };
3037      const resizeHandleVariants = {
3038        hidden: {
3039          opacity: 0,
3040          ...(0, import_i18n4.isRTL)() ? { right: 0 } : { left: 0 }
3041        },
3042        visible: {
3043          opacity: 1,
3044          // Account for the handle's width.
3045          ...(0, import_i18n4.isRTL)() ? { right: -14 } : { left: -14 }
3046        },
3047        active: {
3048          opacity: 1,
3049          // Account for the handle's width.
3050          ...(0, import_i18n4.isRTL)() ? { right: -14 } : { left: -14 },
3051          scaleY: 1.3
3052        }
3053      };
3054      const currentResizeHandleVariant = (() => {
3055        if (isResizing) {
3056          return "active";
3057        }
3058        return shouldShowHandle ? "visible" : "hidden";
3059      })();
3060      return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3061        import_components4.ResizableBox,
3062        {
3063          as: import_components4.__unstableMotion.div,
3064          ref: frameRef,
3065          initial: false,
3066          variants: frameAnimationVariants,
3067          animate: isFullWidth ? "fullWidth" : "default",
3068          onAnimationComplete: (definition) => {
3069            if (definition === "fullWidth") {
3070              setFrameSize({ width: "100%", height: "100%" });
3071            }
3072          },
3073          whileHover: canvas === "view" && isBlockTheme ? {
3074            scale: 1.005,
3075            transition: {
3076              duration: disableMotion ? 0 : 0.5,
3077              ease: "easeOut"
3078            }
3079          } : {},
3080          transition: FRAME_TRANSITION,
3081          size: frameSize,
3082          enable: {
3083            top: false,
3084            bottom: false,
3085            // Resizing will be disabled until the editor content is loaded.
3086            ...(0, import_i18n4.isRTL)() ? { right: isReady, left: false } : { left: isReady, right: false },
3087            topRight: false,
3088            bottomRight: false,
3089            bottomLeft: false,
3090            topLeft: false
3091          },
3092          resizeRatio,
3093          handleClasses: void 0,
3094          handleStyles: {
3095            left: HANDLE_STYLES_OVERRIDE,
3096            right: HANDLE_STYLES_OVERRIDE
3097          },
3098          minWidth: FRAME_MIN_WIDTH,
3099          maxWidth: isFullWidth ? "100%" : "150%",
3100          maxHeight: "100%",
3101          onFocus: () => setShouldShowHandle(true),
3102          onBlur: () => setShouldShowHandle(false),
3103          onMouseOver: () => setShouldShowHandle(true),
3104          onMouseOut: () => setShouldShowHandle(false),
3105          handleComponent: {
3106            [(0, import_i18n4.isRTL)() ? "right" : "left"]: canvas === "view" && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
3107              /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components4.Tooltip, { text: (0, import_i18n4.__)("Drag to resize"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3108                import_components4.__unstableMotion.button,
3109                {
3110                  role: "separator",
3111                  "aria-orientation": "vertical",
3112                  className: clsx_default(
3113                    "edit-site-resizable-frame__handle",
3114                    { "is-resizing": isResizing }
3115                  ),
3116                  variants: resizeHandleVariants,
3117                  animate: currentResizeHandleVariant,
3118                  "aria-label": (0, import_i18n4.__)("Drag to resize"),
3119                  "aria-describedby": resizableHandleHelpId,
3120                  "aria-valuenow": frameRef.current?.resizable?.offsetWidth || void 0,
3121                  "aria-valuemin": FRAME_MIN_WIDTH,
3122                  "aria-valuemax": defaultSize.width,
3123                  onKeyDown: handleResizableHandleKeyDown,
3124                  initial: "hidden",
3125                  exit: "hidden",
3126                  whileFocus: "active",
3127                  whileHover: "active"
3128                },
3129                "handle"
3130              ) }),
3131              /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { hidden: true, id: resizableHandleHelpId, children: (0, import_i18n4.__)(
3132                "Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments."
3133              ) })
3134            ] })
3135          },
3136          onResizeStart: handleResizeStart,
3137          onResize: handleResize,
3138          onResizeStop: handleResizeStop,
3139          className: clsx_default("edit-site-resizable-frame__inner", {
3140            "is-resizing": isResizing
3141          }),
3142          showHandle: false,
3143          children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3144            "div",
3145            {
3146              className: "edit-site-resizable-frame__inner-content",
3147              style: innerContentStyle,
3148              children
3149            }
3150          )
3151        }
3152      );
3153    }
3154    var resizable_frame_default = ResizableFrame;
3155  
3156    // packages/edit-site/build-module/components/save-keyboard-shortcut/index.mjs
3157    var import_element9 = __toESM(require_element(), 1);
3158    var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
3159    var import_i18n5 = __toESM(require_i18n(), 1);
3160    var import_data7 = __toESM(require_data(), 1);
3161    var import_core_data6 = __toESM(require_core_data(), 1);
3162    var import_editor3 = __toESM(require_editor(), 1);
3163    var shortcutName = "core/edit-site/save";
3164    function SaveKeyboardShortcut() {
3165      const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = (0, import_data7.useSelect)(import_core_data6.store);
3166      const { hasNonPostEntityChanges, isPostSavingLocked } = (0, import_data7.useSelect)(import_editor3.store);
3167      const { savePost } = (0, import_data7.useDispatch)(import_editor3.store);
3168      const { setIsSaveViewOpened: setIsSaveViewOpened2 } = (0, import_data7.useDispatch)(store);
3169      const { registerShortcut, unregisterShortcut } = (0, import_data7.useDispatch)(
3170        import_keyboard_shortcuts.store
3171      );
3172      (0, import_element9.useEffect)(() => {
3173        registerShortcut({
3174          name: shortcutName,
3175          category: "global",
3176          description: (0, import_i18n5.__)("Save your changes."),
3177          keyCombination: {
3178            modifier: "primary",
3179            character: "s"
3180          }
3181        });
3182        return () => {
3183          unregisterShortcut(shortcutName);
3184        };
3185      }, [registerShortcut, unregisterShortcut]);
3186      (0, import_keyboard_shortcuts.useShortcut)("core/edit-site/save", (event) => {
3187        event.preventDefault();
3188        const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
3189        const hasDirtyEntities = !!dirtyEntityRecords.length;
3190        const isSaving = dirtyEntityRecords.some(
3191          (record) => isSavingEntityRecord(record.kind, record.name, record.key)
3192        );
3193        if (!hasDirtyEntities || isSaving) {
3194          return;
3195        }
3196        if (hasNonPostEntityChanges()) {
3197          setIsSaveViewOpened2(true);
3198        } else if (!isPostSavingLocked()) {
3199          savePost();
3200        }
3201      });
3202      return null;
3203    }
3204  
3205    // packages/edit-site/build-module/components/layout/hooks.mjs
3206    var import_element10 = __toESM(require_element(), 1);
3207    var import_data8 = __toESM(require_data(), 1);
3208    var import_core_data7 = __toESM(require_core_data(), 1);
3209    var MAX_LOADING_TIME = 1e4;
3210    function useIsSiteEditorLoading() {
3211      const [loaded, setLoaded] = (0, import_element10.useState)(false);
3212      const inLoadingPause = (0, import_data8.useSelect)(
3213        (select3) => {
3214          const hasResolvingSelectors = select3(import_core_data7.store).hasResolvingSelectors();
3215          return !loaded && !hasResolvingSelectors;
3216        },
3217        [loaded]
3218      );
3219      (0, import_element10.useEffect)(() => {
3220        let timeout;
3221        if (!loaded) {
3222          timeout = setTimeout(() => {
3223            setLoaded(true);
3224          }, MAX_LOADING_TIME);
3225        }
3226        return () => {
3227          clearTimeout(timeout);
3228        };
3229      }, [loaded]);
3230      (0, import_element10.useEffect)(() => {
3231        if (inLoadingPause) {
3232          const ARTIFICIAL_DELAY = 100;
3233          const timeout = setTimeout(() => {
3234            setLoaded(true);
3235          }, ARTIFICIAL_DELAY);
3236          return () => {
3237            clearTimeout(timeout);
3238          };
3239        }
3240      }, [inLoadingPause]);
3241      return !loaded;
3242    }
3243  
3244    // node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.js
3245    var updateQueue = makeQueue();
3246    var raf = (fn) => schedule(fn, updateQueue);
3247    var writeQueue = makeQueue();
3248    raf.write = (fn) => schedule(fn, writeQueue);
3249    var onStartQueue = makeQueue();
3250    raf.onStart = (fn) => schedule(fn, onStartQueue);
3251    var onFrameQueue = makeQueue();
3252    raf.onFrame = (fn) => schedule(fn, onFrameQueue);
3253    var onFinishQueue = makeQueue();
3254    raf.onFinish = (fn) => schedule(fn, onFinishQueue);
3255    var timeouts = [];
3256    raf.setTimeout = (handler, ms) => {
3257      let time = raf.now() + ms;
3258      let cancel = () => {
3259        let i2 = timeouts.findIndex((t3) => t3.cancel == cancel);
3260        if (~i2) timeouts.splice(i2, 1);
3261        pendingCount -= ~i2 ? 1 : 0;
3262      };
3263      let timeout = {
3264        time,
3265        handler,
3266        cancel
3267      };
3268      timeouts.splice(findTimeout(time), 0, timeout);
3269      pendingCount += 1;
3270      start();
3271      return timeout;
3272    };
3273    var findTimeout = (time) => ~(~timeouts.findIndex((t3) => t3.time > time) || ~timeouts.length);
3274    raf.cancel = (fn) => {
3275      onStartQueue.delete(fn);
3276      onFrameQueue.delete(fn);
3277      onFinishQueue.delete(fn);
3278      updateQueue.delete(fn);
3279      writeQueue.delete(fn);
3280    };
3281    raf.sync = (fn) => {
3282      sync = true;
3283      raf.batchedUpdates(fn);
3284      sync = false;
3285    };
3286    raf.throttle = (fn) => {
3287      let lastArgs;
3288      function queuedFn() {
3289        try {
3290          fn(...lastArgs);
3291        } finally {
3292          lastArgs = null;
3293        }
3294      }
3295      function throttled(...args) {
3296        lastArgs = args;
3297        raf.onStart(queuedFn);
3298      }
3299      throttled.handler = fn;
3300      throttled.cancel = () => {
3301        onStartQueue.delete(queuedFn);
3302        lastArgs = null;
3303      };
3304      return throttled;
3305    };
3306    var nativeRaf = typeof window != "undefined" ? window.requestAnimationFrame : () => {
3307    };
3308    raf.use = (impl) => nativeRaf = impl;
3309    raf.now = typeof performance != "undefined" ? () => performance.now() : Date.now;
3310    raf.batchedUpdates = (fn) => fn();
3311    raf.catch = console.error;
3312    raf.frameLoop = "always";
3313    raf.advance = () => {
3314      if (raf.frameLoop !== "demand") {
3315        console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand");
3316      } else {
3317        update2();
3318      }
3319    };
3320    var ts = -1;
3321    var pendingCount = 0;
3322    var sync = false;
3323    function schedule(fn, queue) {
3324      if (sync) {
3325        queue.delete(fn);
3326        fn(0);
3327      } else {
3328        queue.add(fn);
3329        start();
3330      }
3331    }
3332    function start() {
3333      if (ts < 0) {
3334        ts = 0;
3335        if (raf.frameLoop !== "demand") {
3336          nativeRaf(loop);
3337        }
3338      }
3339    }
3340    function stop() {
3341      ts = -1;
3342    }
3343    function loop() {
3344      if (~ts) {
3345        nativeRaf(loop);
3346        raf.batchedUpdates(update2);
3347      }
3348    }
3349    function update2() {
3350      let prevTs = ts;
3351      ts = raf.now();
3352      let count = findTimeout(ts);
3353      if (count) {
3354        eachSafely(timeouts.splice(0, count), (t3) => t3.handler());
3355        pendingCount -= count;
3356      }
3357      if (!pendingCount) {
3358        stop();
3359        return;
3360      }
3361      onStartQueue.flush();
3362      updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667);
3363      onFrameQueue.flush();
3364      writeQueue.flush();
3365      onFinishQueue.flush();
3366    }
3367    function makeQueue() {
3368      let next = /* @__PURE__ */ new Set();
3369      let current = next;
3370      return {
3371        add(fn) {
3372          pendingCount += current == next && !next.has(fn) ? 1 : 0;
3373          next.add(fn);
3374        },
3375        delete(fn) {
3376          pendingCount -= current == next && next.has(fn) ? 1 : 0;
3377          return next.delete(fn);
3378        },
3379        flush(arg) {
3380          if (current.size) {
3381            next = /* @__PURE__ */ new Set();
3382            pendingCount -= current.size;
3383            eachSafely(current, (fn) => fn(arg) && next.add(fn));
3384            pendingCount += next.size;
3385            current = next;
3386          }
3387        }
3388      };
3389    }
3390    function eachSafely(values, each2) {
3391      values.forEach((value) => {
3392        try {
3393          each2(value);
3394        } catch (e2) {
3395          raf.catch(e2);
3396        }
3397      });
3398    }
3399  
3400    // node_modules/@react-spring/shared/dist/react-spring-shared.esm.js
3401    var import_react4 = __toESM(require_react());
3402    function noop() {
3403    }
3404    var defineHidden = (obj, key, value) => Object.defineProperty(obj, key, {
3405      value,
3406      writable: true,
3407      configurable: true
3408    });
3409    var is = {
3410      arr: Array.isArray,
3411      obj: (a2) => !!a2 && a2.constructor.name === "Object",
3412      fun: (a2) => typeof a2 === "function",
3413      str: (a2) => typeof a2 === "string",
3414      num: (a2) => typeof a2 === "number",
3415      und: (a2) => a2 === void 0
3416    };
3417    function isEqual(a2, b2) {
3418      if (is.arr(a2)) {
3419        if (!is.arr(b2) || a2.length !== b2.length) return false;
3420        for (let i2 = 0; i2 < a2.length; i2++) {
3421          if (a2[i2] !== b2[i2]) return false;
3422        }
3423        return true;
3424      }
3425      return a2 === b2;
3426    }
3427    var each = (obj, fn) => obj.forEach(fn);
3428    function eachProp(obj, fn, ctx9) {
3429      if (is.arr(obj)) {
3430        for (let i2 = 0; i2 < obj.length; i2++) {
3431          fn.call(ctx9, obj[i2], `$i2}`);
3432        }
3433        return;
3434      }
3435      for (const key in obj) {
3436        if (obj.hasOwnProperty(key)) {
3437          fn.call(ctx9, obj[key], key);
3438        }
3439      }
3440    }
3441    var toArray = (a2) => is.und(a2) ? [] : is.arr(a2) ? a2 : [a2];
3442    function flush(queue, iterator) {
3443      if (queue.size) {
3444        const items = Array.from(queue);
3445        queue.clear();
3446        each(items, iterator);
3447      }
3448    }
3449    var flushCalls = (queue, ...args) => flush(queue, (fn) => fn(...args));
3450    var isSSR = () => typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent);
3451    var createStringInterpolator$1;
3452    var to;
3453    var colors$1 = null;
3454    var skipAnimation = false;
3455    var willAdvance = noop;
3456    var assign = (globals2) => {
3457      if (globals2.to) to = globals2.to;
3458      if (globals2.now) raf.now = globals2.now;
3459      if (globals2.colors !== void 0) colors$1 = globals2.colors;
3460      if (globals2.skipAnimation != null) skipAnimation = globals2.skipAnimation;
3461      if (globals2.createStringInterpolator) createStringInterpolator$1 = globals2.createStringInterpolator;
3462      if (globals2.requestAnimationFrame) raf.use(globals2.requestAnimationFrame);
3463      if (globals2.batchedUpdates) raf.batchedUpdates = globals2.batchedUpdates;
3464      if (globals2.willAdvance) willAdvance = globals2.willAdvance;
3465      if (globals2.frameLoop) raf.frameLoop = globals2.frameLoop;
3466    };
3467    var globals = /* @__PURE__ */ Object.freeze({
3468      __proto__: null,
3469      get createStringInterpolator() {
3470        return createStringInterpolator$1;
3471      },
3472      get to() {
3473        return to;
3474      },
3475      get colors() {
3476        return colors$1;
3477      },
3478      get skipAnimation() {
3479        return skipAnimation;
3480      },
3481      get willAdvance() {
3482        return willAdvance;
3483      },
3484      assign
3485    });
3486    var startQueue = /* @__PURE__ */ new Set();
3487    var currentFrame = [];
3488    var prevFrame = [];
3489    var priority = 0;
3490    var frameLoop = {
3491      get idle() {
3492        return !startQueue.size && !currentFrame.length;
3493      },
3494      start(animation) {
3495        if (priority > animation.priority) {
3496          startQueue.add(animation);
3497          raf.onStart(flushStartQueue);
3498        } else {
3499          startSafely(animation);
3500          raf(advance);
3501        }
3502      },
3503      advance,
3504      sort(animation) {
3505        if (priority) {
3506          raf.onFrame(() => frameLoop.sort(animation));
3507        } else {
3508          const prevIndex = currentFrame.indexOf(animation);
3509          if (~prevIndex) {
3510            currentFrame.splice(prevIndex, 1);
3511            startUnsafely(animation);
3512          }
3513        }
3514      },
3515      clear() {
3516        currentFrame = [];
3517        startQueue.clear();
3518      }
3519    };
3520    function flushStartQueue() {
3521      startQueue.forEach(startSafely);
3522      startQueue.clear();
3523      raf(advance);
3524    }
3525    function startSafely(animation) {
3526      if (!currentFrame.includes(animation)) startUnsafely(animation);
3527    }
3528    function startUnsafely(animation) {
3529      currentFrame.splice(findIndex(currentFrame, (other) => other.priority > animation.priority), 0, animation);
3530    }
3531    function advance(dt) {
3532      const nextFrame = prevFrame;
3533      for (let i2 = 0; i2 < currentFrame.length; i2++) {
3534        const animation = currentFrame[i2];
3535        priority = animation.priority;
3536        if (!animation.idle) {
3537          willAdvance(animation);
3538          animation.advance(dt);
3539          if (!animation.idle) {
3540            nextFrame.push(animation);
3541          }
3542        }
3543      }
3544      priority = 0;
3545      prevFrame = currentFrame;
3546      prevFrame.length = 0;
3547      currentFrame = nextFrame;
3548      return currentFrame.length > 0;
3549    }
3550    function findIndex(arr, test) {
3551      const index = arr.findIndex(test);
3552      return index < 0 ? arr.length : index;
3553    }
3554    var colors = {
3555      transparent: 0,
3556      aliceblue: 4042850303,
3557      antiquewhite: 4209760255,
3558      aqua: 16777215,
3559      aquamarine: 2147472639,
3560      azure: 4043309055,
3561      beige: 4126530815,
3562      bisque: 4293182719,
3563      black: 255,
3564      blanchedalmond: 4293643775,
3565      blue: 65535,
3566      blueviolet: 2318131967,
3567      brown: 2771004159,
3568      burlywood: 3736635391,
3569      burntsienna: 3934150143,
3570      cadetblue: 1604231423,
3571      chartreuse: 2147418367,
3572      chocolate: 3530104575,
3573      coral: 4286533887,
3574      cornflowerblue: 1687547391,
3575      cornsilk: 4294499583,
3576      crimson: 3692313855,
3577      cyan: 16777215,
3578      darkblue: 35839,
3579      darkcyan: 9145343,
3580      darkgoldenrod: 3095792639,
3581      darkgray: 2846468607,
3582      darkgreen: 6553855,
3583      darkgrey: 2846468607,
3584      darkkhaki: 3182914559,
3585      darkmagenta: 2332068863,
3586      darkolivegreen: 1433087999,
3587      darkorange: 4287365375,
3588      darkorchid: 2570243327,
3589      darkred: 2332033279,
3590      darksalmon: 3918953215,
3591      darkseagreen: 2411499519,
3592      darkslateblue: 1211993087,
3593      darkslategray: 793726975,
3594      darkslategrey: 793726975,
3595      darkturquoise: 13554175,
3596      darkviolet: 2483082239,
3597      deeppink: 4279538687,
3598      deepskyblue: 12582911,
3599      dimgray: 1768516095,
3600      dimgrey: 1768516095,
3601      dodgerblue: 512819199,
3602      firebrick: 2988581631,
3603      floralwhite: 4294635775,
3604      forestgreen: 579543807,
3605      fuchsia: 4278255615,
3606      gainsboro: 3705462015,
3607      ghostwhite: 4177068031,
3608      gold: 4292280575,
3609      goldenrod: 3668254975,
3610      gray: 2155905279,
3611      green: 8388863,
3612      greenyellow: 2919182335,
3613      grey: 2155905279,
3614      honeydew: 4043305215,
3615      hotpink: 4285117695,
3616      indianred: 3445382399,
3617      indigo: 1258324735,
3618      ivory: 4294963455,
3619      khaki: 4041641215,
3620      lavender: 3873897215,
3621      lavenderblush: 4293981695,
3622      lawngreen: 2096890111,
3623      lemonchiffon: 4294626815,
3624      lightblue: 2916673279,
3625      lightcoral: 4034953471,
3626      lightcyan: 3774873599,
3627      lightgoldenrodyellow: 4210742015,
3628      lightgray: 3553874943,
3629      lightgreen: 2431553791,
3630      lightgrey: 3553874943,
3631      lightpink: 4290167295,
3632      lightsalmon: 4288707327,
3633      lightseagreen: 548580095,
3634      lightskyblue: 2278488831,
3635      lightslategray: 2005441023,
3636      lightslategrey: 2005441023,
3637      lightsteelblue: 2965692159,
3638      lightyellow: 4294959359,
3639      lime: 16711935,
3640      limegreen: 852308735,
3641      linen: 4210091775,
3642      magenta: 4278255615,
3643      maroon: 2147483903,
3644      mediumaquamarine: 1724754687,
3645      mediumblue: 52735,
3646      mediumorchid: 3126187007,
3647      mediumpurple: 2473647103,
3648      mediumseagreen: 1018393087,
3649      mediumslateblue: 2070474495,
3650      mediumspringgreen: 16423679,
3651      mediumturquoise: 1221709055,
3652      mediumvioletred: 3340076543,
3653      midnightblue: 421097727,
3654      mintcream: 4127193855,
3655      mistyrose: 4293190143,
3656      moccasin: 4293178879,
3657      navajowhite: 4292783615,
3658      navy: 33023,
3659      oldlace: 4260751103,
3660      olive: 2155872511,
3661      olivedrab: 1804477439,
3662      orange: 4289003775,
3663      orangered: 4282712319,
3664      orchid: 3664828159,
3665      palegoldenrod: 4008225535,
3666      palegreen: 2566625535,
3667      paleturquoise: 2951671551,
3668      palevioletred: 3681588223,
3669      papayawhip: 4293907967,
3670      peachpuff: 4292524543,
3671      peru: 3448061951,
3672      pink: 4290825215,
3673      plum: 3718307327,
3674      powderblue: 2967529215,
3675      purple: 2147516671,
3676      rebeccapurple: 1714657791,
3677      red: 4278190335,
3678      rosybrown: 3163525119,
3679      royalblue: 1097458175,
3680      saddlebrown: 2336560127,
3681      salmon: 4202722047,
3682      sandybrown: 4104413439,
3683      seagreen: 780883967,
3684      seashell: 4294307583,
3685      sienna: 2689740287,
3686      silver: 3233857791,
3687      skyblue: 2278484991,
3688      slateblue: 1784335871,
3689      slategray: 1887473919,
3690      slategrey: 1887473919,
3691      snow: 4294638335,
3692      springgreen: 16744447,
3693      steelblue: 1182971135,
3694      tan: 3535047935,
3695      teal: 8421631,
3696      thistle: 3636451583,
3697      tomato: 4284696575,
3698      turquoise: 1088475391,
3699      violet: 4001558271,
3700      wheat: 4125012991,
3701      white: 4294967295,
3702      whitesmoke: 4126537215,
3703      yellow: 4294902015,
3704      yellowgreen: 2597139199
3705    };
3706    var NUMBER = "[-+]?\\d*\\.?\\d+";
3707    var PERCENTAGE = NUMBER + "%";
3708    function call(...parts) {
3709      return "\\(\\s*(" + parts.join(")\\s*,\\s*(") + ")\\s*\\)";
3710    }
3711    var rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
3712    var rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
3713    var hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
3714    var hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
3715    var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
3716    var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
3717    var hex6 = /^#([0-9a-fA-F]{6})$/;
3718    var hex8 = /^#([0-9a-fA-F]{8})$/;
3719    function normalizeColor(color) {
3720      let match3;
3721      if (typeof color === "number") {
3722        return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
3723      }
3724      if (match3 = hex6.exec(color)) return parseInt(match3[1] + "ff", 16) >>> 0;
3725      if (colors$1 && colors$1[color] !== void 0) {
3726        return colors$1[color];
3727      }
3728      if (match3 = rgb.exec(color)) {
3729        return (parse255(match3[1]) << 24 | parse255(match3[2]) << 16 | parse255(match3[3]) << 8 | 255) >>> 0;
3730      }
3731      if (match3 = rgba.exec(color)) {
3732        return (parse255(match3[1]) << 24 | parse255(match3[2]) << 16 | parse255(match3[3]) << 8 | parse1(match3[4])) >>> 0;
3733      }
3734      if (match3 = hex3.exec(color)) {
3735        return parseInt(match3[1] + match3[1] + match3[2] + match3[2] + match3[3] + match3[3] + "ff", 16) >>> 0;
3736      }
3737      if (match3 = hex8.exec(color)) return parseInt(match3[1], 16) >>> 0;
3738      if (match3 = hex4.exec(color)) {
3739        return parseInt(match3[1] + match3[1] + match3[2] + match3[2] + match3[3] + match3[3] + match3[4] + match3[4], 16) >>> 0;
3740      }
3741      if (match3 = hsl.exec(color)) {
3742        return (hslToRgb(parse360(match3[1]), parsePercentage(match3[2]), parsePercentage(match3[3])) | 255) >>> 0;
3743      }
3744      if (match3 = hsla.exec(color)) {
3745        return (hslToRgb(parse360(match3[1]), parsePercentage(match3[2]), parsePercentage(match3[3])) | parse1(match3[4])) >>> 0;
3746      }
3747      return null;
3748    }
3749    function hue2rgb(p3, q, t3) {
3750      if (t3 < 0) t3 += 1;
3751      if (t3 > 1) t3 -= 1;
3752      if (t3 < 1 / 6) return p3 + (q - p3) * 6 * t3;
3753      if (t3 < 1 / 2) return q;
3754      if (t3 < 2 / 3) return p3 + (q - p3) * (2 / 3 - t3) * 6;
3755      return p3;
3756    }
3757    function hslToRgb(h2, s2, l2) {
3758      const q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
3759      const p3 = 2 * l2 - q;
3760      const r3 = hue2rgb(p3, q, h2 + 1 / 3);
3761      const g2 = hue2rgb(p3, q, h2);
3762      const b2 = hue2rgb(p3, q, h2 - 1 / 3);
3763      return Math.round(r3 * 255) << 24 | Math.round(g2 * 255) << 16 | Math.round(b2 * 255) << 8;
3764    }
3765    function parse255(str) {
3766      const int = parseInt(str, 10);
3767      if (int < 0) return 0;
3768      if (int > 255) return 255;
3769      return int;
3770    }
3771    function parse360(str) {
3772      const int = parseFloat(str);
3773      return (int % 360 + 360) % 360 / 360;
3774    }
3775    function parse1(str) {
3776      const num = parseFloat(str);
3777      if (num < 0) return 0;
3778      if (num > 1) return 255;
3779      return Math.round(num * 255);
3780    }
3781    function parsePercentage(str) {
3782      const int = parseFloat(str);
3783      if (int < 0) return 0;
3784      if (int > 100) return 1;
3785      return int / 100;
3786    }
3787    function colorToRgba(input) {
3788      let int32Color = normalizeColor(input);
3789      if (int32Color === null) return input;
3790      int32Color = int32Color || 0;
3791      let r3 = (int32Color & 4278190080) >>> 24;
3792      let g2 = (int32Color & 16711680) >>> 16;
3793      let b2 = (int32Color & 65280) >>> 8;
3794      let a2 = (int32Color & 255) / 255;
3795      return `rgba($r3}, $g2}, $b2}, $a2})`;
3796    }
3797    var createInterpolator = (range, output, extrapolate) => {
3798      if (is.fun(range)) {
3799        return range;
3800      }
3801      if (is.arr(range)) {
3802        return createInterpolator({
3803          range,
3804          output,
3805          extrapolate
3806        });
3807      }
3808      if (is.str(range.output[0])) {
3809        return createStringInterpolator$1(range);
3810      }
3811      const config2 = range;
3812      const outputRange = config2.output;
3813      const inputRange = config2.range || [0, 1];
3814      const extrapolateLeft = config2.extrapolateLeft || config2.extrapolate || "extend";
3815      const extrapolateRight = config2.extrapolateRight || config2.extrapolate || "extend";
3816      const easing = config2.easing || ((t3) => t3);
3817      return (input) => {
3818        const range2 = findRange(input, inputRange);
3819        return interpolate(input, inputRange[range2], inputRange[range2 + 1], outputRange[range2], outputRange[range2 + 1], easing, extrapolateLeft, extrapolateRight, config2.map);
3820      };
3821    };
3822    function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
3823      let result = map ? map(input) : input;
3824      if (result < inputMin) {
3825        if (extrapolateLeft === "identity") return result;
3826        else if (extrapolateLeft === "clamp") result = inputMin;
3827      }
3828      if (result > inputMax) {
3829        if (extrapolateRight === "identity") return result;
3830        else if (extrapolateRight === "clamp") result = inputMax;
3831      }
3832      if (outputMin === outputMax) return outputMin;
3833      if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax;
3834      if (inputMin === -Infinity) result = -result;
3835      else if (inputMax === Infinity) result = result - inputMin;
3836      else result = (result - inputMin) / (inputMax - inputMin);
3837      result = easing(result);
3838      if (outputMin === -Infinity) result = -result;
3839      else if (outputMax === Infinity) result = result + outputMin;
3840      else result = result * (outputMax - outputMin) + outputMin;
3841      return result;
3842    }
3843    function findRange(input, inputRange) {
3844      for (var i2 = 1; i2 < inputRange.length - 1; ++i2) if (inputRange[i2] >= input) break;
3845      return i2 - 1;
3846    }
3847    function _extends() {
3848      _extends = Object.assign ? Object.assign.bind() : function(target) {
3849        for (var i2 = 1; i2 < arguments.length; i2++) {
3850          var source = arguments[i2];
3851          for (var key in source) {
3852            if (Object.prototype.hasOwnProperty.call(source, key)) {
3853              target[key] = source[key];
3854            }
3855          }
3856        }
3857        return target;
3858      };
3859      return _extends.apply(this, arguments);
3860    }
3861    var $get = /* @__PURE__ */ Symbol.for("FluidValue.get");
3862    var $observers = /* @__PURE__ */ Symbol.for("FluidValue.observers");
3863    var hasFluidValue = (arg) => Boolean(arg && arg[$get]);
3864    var getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg;
3865    var getFluidObservers = (target) => target[$observers] || null;
3866    function callFluidObserver(observer, event) {
3867      if (observer.eventObserved) {
3868        observer.eventObserved(event);
3869      } else {
3870        observer(event);
3871      }
3872    }
3873    function callFluidObservers(target, event) {
3874      let observers = target[$observers];
3875      if (observers) {
3876        observers.forEach((observer) => {
3877          callFluidObserver(observer, event);
3878        });
3879      }
3880    }
3881    var FluidValue = class {
3882      constructor(get) {
3883        this[$get] = void 0;
3884        this[$observers] = void 0;
3885        if (!get && !(get = this.get)) {
3886          throw Error("Unknown getter");
3887        }
3888        setFluidGetter(this, get);
3889      }
3890    };
3891    var setFluidGetter = (target, get) => setHidden(target, $get, get);
3892    function addFluidObserver(target, observer) {
3893      if (target[$get]) {
3894        let observers = target[$observers];
3895        if (!observers) {
3896          setHidden(target, $observers, observers = /* @__PURE__ */ new Set());
3897        }
3898        if (!observers.has(observer)) {
3899          observers.add(observer);
3900          if (target.observerAdded) {
3901            target.observerAdded(observers.size, observer);
3902          }
3903        }
3904      }
3905      return observer;
3906    }
3907    function removeFluidObserver(target, observer) {
3908      let observers = target[$observers];
3909      if (observers && observers.has(observer)) {
3910        const count = observers.size - 1;
3911        if (count) {
3912          observers.delete(observer);
3913        } else {
3914          target[$observers] = null;
3915        }
3916        if (target.observerRemoved) {
3917          target.observerRemoved(count, observer);
3918        }
3919      }
3920    }
3921    var setHidden = (target, key, value) => Object.defineProperty(target, key, {
3922      value,
3923      writable: true,
3924      configurable: true
3925    });
3926    var numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
3927    var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;
3928    var unitRegex = new RegExp(`($numberRegex.source})(%|[a-z]+)`, "i");
3929    var rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi;
3930    var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
3931    var variableToRgba = (input) => {
3932      const [token, fallback] = parseCSSVariable(input);
3933      if (!token || isSSR()) {
3934        return input;
3935      }
3936      const value = window.getComputedStyle(document.documentElement).getPropertyValue(token);
3937      if (value) {
3938        return value.trim();
3939      } else if (fallback && fallback.startsWith("--")) {
3940        const _value = window.getComputedStyle(document.documentElement).getPropertyValue(fallback);
3941        if (_value) {
3942          return _value;
3943        } else {
3944          return input;
3945        }
3946      } else if (fallback && cssVariableRegex.test(fallback)) {
3947        return variableToRgba(fallback);
3948      } else if (fallback) {
3949        return fallback;
3950      }
3951      return input;
3952    };
3953    var parseCSSVariable = (current) => {
3954      const match3 = cssVariableRegex.exec(current);
3955      if (!match3) return [,];
3956      const [, token, fallback] = match3;
3957      return [token, fallback];
3958    };
3959    var namedColorRegex;
3960    var rgbaRound = (_, p1, p22, p3, p4) => `rgba($Math.round(p1)}, $Math.round(p22)}, $Math.round(p3)}, $p4})`;
3961    var createStringInterpolator = (config2) => {
3962      if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`($Object.keys(colors$1).join("|")})(?!\\w)`, "g") : /^\b$/;
3963      const output = config2.output.map((value) => {
3964        return getFluidValue(value).replace(cssVariableRegex, variableToRgba).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba);
3965      });
3966      const keyframes = output.map((value) => value.match(numberRegex).map(Number));
3967      const outputRanges = keyframes[0].map((_, i2) => keyframes.map((values) => {
3968        if (!(i2 in values)) {
3969          throw Error('The arity of each "output" value must be equal');
3970        }
3971        return values[i2];
3972      }));
3973      const interpolators = outputRanges.map((output2) => createInterpolator(_extends({}, config2, {
3974        output: output2
3975      })));
3976      return (input) => {
3977        var _output$find;
3978        const missingUnit = !unitRegex.test(output[0]) && ((_output$find = output.find((value) => unitRegex.test(value))) == null ? void 0 : _output$find.replace(numberRegex, ""));
3979        let i2 = 0;
3980        return output[0].replace(numberRegex, () => `$interpolators[i2++](input)}$missingUnit || ""}`).replace(rgbaRegex, rgbaRound);
3981      };
3982    };
3983    var prefix = "react-spring: ";
3984    var once = (fn) => {
3985      const func = fn;
3986      let called = false;
3987      if (typeof func != "function") {
3988        throw new TypeError(`$prefix}once requires a function parameter`);
3989      }
3990      return (...args) => {
3991        if (!called) {
3992          func(...args);
3993          called = true;
3994        }
3995      };
3996    };
3997    var warnInterpolate = once(console.warn);
3998    function deprecateInterpolate() {
3999      warnInterpolate(`$prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`);
4000    }
4001    var warnDirectCall = once(console.warn);
4002    function isAnimatedString(value) {
4003      return is.str(value) && (value[0] == "#" || /\d/.test(value) || !isSSR() && cssVariableRegex.test(value) || value in (colors$1 || {}));
4004    }
4005    var useIsomorphicLayoutEffect = isSSR() ? import_react4.useEffect : import_react4.useLayoutEffect;
4006    var useIsMounted = () => {
4007      const isMounted = (0, import_react4.useRef)(false);
4008      useIsomorphicLayoutEffect(() => {
4009        isMounted.current = true;
4010        return () => {
4011          isMounted.current = false;
4012        };
4013      }, []);
4014      return isMounted;
4015    };
4016    function useForceUpdate() {
4017      const update4 = (0, import_react4.useState)()[1];
4018      const isMounted = useIsMounted();
4019      return () => {
4020        if (isMounted.current) {
4021          update4(Math.random());
4022        }
4023      };
4024    }
4025    function useMemoOne(getResult, inputs) {
4026      const [initial] = (0, import_react4.useState)(() => ({
4027        inputs,
4028        result: getResult()
4029      }));
4030      const committed = (0, import_react4.useRef)();
4031      const prevCache = committed.current;
4032      let cache = prevCache;
4033      if (cache) {
4034        const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs));
4035        if (!useCache) {
4036          cache = {
4037            inputs,
4038            result: getResult()
4039          };
4040        }
4041      } else {
4042        cache = initial;
4043      }
4044      (0, import_react4.useEffect)(() => {
4045        committed.current = cache;
4046        if (prevCache == initial) {
4047          initial.inputs = initial.result = void 0;
4048        }
4049      }, [cache]);
4050      return cache.result;
4051    }
4052    function areInputsEqual(next, prev) {
4053      if (next.length !== prev.length) {
4054        return false;
4055      }
4056      for (let i2 = 0; i2 < next.length; i2++) {
4057        if (next[i2] !== prev[i2]) {
4058          return false;
4059        }
4060      }
4061      return true;
4062    }
4063    var useOnce = (effect) => (0, import_react4.useEffect)(effect, emptyDeps);
4064    var emptyDeps = [];
4065  
4066    // node_modules/@react-spring/core/dist/react-spring-core.esm.js
4067    var React6 = __toESM(require_react());
4068    var import_react6 = __toESM(require_react());
4069  
4070    // node_modules/@react-spring/animated/dist/react-spring-animated.esm.js
4071    var React5 = __toESM(require_react());
4072    var import_react5 = __toESM(require_react());
4073    var $node = /* @__PURE__ */ Symbol.for("Animated:node");
4074    var isAnimated = (value) => !!value && value[$node] === value;
4075    var getAnimated = (owner) => owner && owner[$node];
4076    var setAnimated = (owner, node) => defineHidden(owner, $node, node);
4077    var getPayload = (owner) => owner && owner[$node] && owner[$node].getPayload();
4078    var Animated = class {
4079      constructor() {
4080        this.payload = void 0;
4081        setAnimated(this, this);
4082      }
4083      getPayload() {
4084        return this.payload || [];
4085      }
4086    };
4087    var AnimatedValue = class _AnimatedValue extends Animated {
4088      constructor(_value) {
4089        super();
4090        this.done = true;
4091        this.elapsedTime = void 0;
4092        this.lastPosition = void 0;
4093        this.lastVelocity = void 0;
4094        this.v0 = void 0;
4095        this.durationProgress = 0;
4096        this._value = _value;
4097        if (is.num(this._value)) {
4098          this.lastPosition = this._value;
4099        }
4100      }
4101      static create(value) {
4102        return new _AnimatedValue(value);
4103      }
4104      getPayload() {
4105        return [this];
4106      }
4107      getValue() {
4108        return this._value;
4109      }
4110      setValue(value, step) {
4111        if (is.num(value)) {
4112          this.lastPosition = value;
4113          if (step) {
4114            value = Math.round(value / step) * step;
4115            if (this.done) {
4116              this.lastPosition = value;
4117            }
4118          }
4119        }
4120        if (this._value === value) {
4121          return false;
4122        }
4123        this._value = value;
4124        return true;
4125      }
4126      reset() {
4127        const {
4128          done
4129        } = this;
4130        this.done = false;
4131        if (is.num(this._value)) {
4132          this.elapsedTime = 0;
4133          this.durationProgress = 0;
4134          this.lastPosition = this._value;
4135          if (done) this.lastVelocity = null;
4136          this.v0 = null;
4137        }
4138      }
4139    };
4140    var AnimatedString = class _AnimatedString extends AnimatedValue {
4141      constructor(value) {
4142        super(0);
4143        this._string = null;
4144        this._toString = void 0;
4145        this._toString = createInterpolator({
4146          output: [value, value]
4147        });
4148      }
4149      static create(value) {
4150        return new _AnimatedString(value);
4151      }
4152      getValue() {
4153        let value = this._string;
4154        return value == null ? this._string = this._toString(this._value) : value;
4155      }
4156      setValue(value) {
4157        if (is.str(value)) {
4158          if (value == this._string) {
4159            return false;
4160          }
4161          this._string = value;
4162          this._value = 1;
4163        } else if (super.setValue(value)) {
4164          this._string = null;
4165        } else {
4166          return false;
4167        }
4168        return true;
4169      }
4170      reset(goal) {
4171        if (goal) {
4172          this._toString = createInterpolator({
4173            output: [this.getValue(), goal]
4174          });
4175        }
4176        this._value = 0;
4177        super.reset();
4178      }
4179    };
4180    var TreeContext = {
4181      dependencies: null
4182    };
4183    var AnimatedObject = class extends Animated {
4184      constructor(source) {
4185        super();
4186        this.source = source;
4187        this.setValue(source);
4188      }
4189      getValue(animated2) {
4190        const values = {};
4191        eachProp(this.source, (source, key) => {
4192          if (isAnimated(source)) {
4193            values[key] = source.getValue(animated2);
4194          } else if (hasFluidValue(source)) {
4195            values[key] = getFluidValue(source);
4196          } else if (!animated2) {
4197            values[key] = source;
4198          }
4199        });
4200        return values;
4201      }
4202      setValue(source) {
4203        this.source = source;
4204        this.payload = this._makePayload(source);
4205      }
4206      reset() {
4207        if (this.payload) {
4208          each(this.payload, (node) => node.reset());
4209        }
4210      }
4211      _makePayload(source) {
4212        if (source) {
4213          const payload = /* @__PURE__ */ new Set();
4214          eachProp(source, this._addToPayload, payload);
4215          return Array.from(payload);
4216        }
4217      }
4218      _addToPayload(source) {
4219        if (TreeContext.dependencies && hasFluidValue(source)) {
4220          TreeContext.dependencies.add(source);
4221        }
4222        const payload = getPayload(source);
4223        if (payload) {
4224          each(payload, (node) => this.add(node));
4225        }
4226      }
4227    };
4228    var AnimatedArray = class _AnimatedArray extends AnimatedObject {
4229      constructor(source) {
4230        super(source);
4231      }
4232      static create(source) {
4233        return new _AnimatedArray(source);
4234      }
4235      getValue() {
4236        return this.source.map((node) => node.getValue());
4237      }
4238      setValue(source) {
4239        const payload = this.getPayload();
4240        if (source.length == payload.length) {
4241          return payload.map((node, i2) => node.setValue(source[i2])).some(Boolean);
4242        }
4243        super.setValue(source.map(makeAnimated));
4244        return true;
4245      }
4246    };
4247    function makeAnimated(value) {
4248      const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue;
4249      return nodeType.create(value);
4250    }
4251    function getAnimatedType(value) {
4252      const parentNode = getAnimated(value);
4253      return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue;
4254    }
4255    function _extends2() {
4256      _extends2 = Object.assign ? Object.assign.bind() : function(target) {
4257        for (var i2 = 1; i2 < arguments.length; i2++) {
4258          var source = arguments[i2];
4259          for (var key in source) {
4260            if (Object.prototype.hasOwnProperty.call(source, key)) {
4261              target[key] = source[key];
4262            }
4263          }
4264        }
4265        return target;
4266      };
4267      return _extends2.apply(this, arguments);
4268    }
4269    var withAnimated = (Component, host2) => {
4270      const hasInstance = !is.fun(Component) || Component.prototype && Component.prototype.isReactComponent;
4271      return (0, import_react5.forwardRef)((givenProps, givenRef) => {
4272        const instanceRef = (0, import_react5.useRef)(null);
4273        const ref = hasInstance && (0, import_react5.useCallback)((value) => {
4274          instanceRef.current = updateRef(givenRef, value);
4275        }, [givenRef]);
4276        const [props, deps] = getAnimatedState(givenProps, host2);
4277        const forceUpdate = useForceUpdate();
4278        const callback = () => {
4279          const instance = instanceRef.current;
4280          if (hasInstance && !instance) {
4281            return;
4282          }
4283          const didUpdate = instance ? host2.applyAnimatedValues(instance, props.getValue(true)) : false;
4284          if (didUpdate === false) {
4285            forceUpdate();
4286          }
4287        };
4288        const observer = new PropsObserver(callback, deps);
4289        const observerRef = (0, import_react5.useRef)();
4290        useIsomorphicLayoutEffect(() => {
4291          observerRef.current = observer;
4292          each(deps, (dep) => addFluidObserver(dep, observer));
4293          return () => {
4294            if (observerRef.current) {
4295              each(observerRef.current.deps, (dep) => removeFluidObserver(dep, observerRef.current));
4296              raf.cancel(observerRef.current.update);
4297            }
4298          };
4299        });
4300        (0, import_react5.useEffect)(callback, []);
4301        useOnce(() => () => {
4302          const observer2 = observerRef.current;
4303          each(observer2.deps, (dep) => removeFluidObserver(dep, observer2));
4304        });
4305        const usedProps = host2.getComponentProps(props.getValue());
4306        return React5.createElement(Component, _extends2({}, usedProps, {
4307          ref
4308        }));
4309      });
4310    };
4311    var PropsObserver = class {
4312      constructor(update4, deps) {
4313        this.update = update4;
4314        this.deps = deps;
4315      }
4316      eventObserved(event) {
4317        if (event.type == "change") {
4318          raf.write(this.update);
4319        }
4320      }
4321    };
4322    function getAnimatedState(props, host2) {
4323      const dependencies = /* @__PURE__ */ new Set();
4324      TreeContext.dependencies = dependencies;
4325      if (props.style) props = _extends2({}, props, {
4326        style: host2.createAnimatedStyle(props.style)
4327      });
4328      props = new AnimatedObject(props);
4329      TreeContext.dependencies = null;
4330      return [props, dependencies];
4331    }
4332    function updateRef(ref, value) {
4333      if (ref) {
4334        if (is.fun(ref)) ref(value);
4335        else ref.current = value;
4336      }
4337      return value;
4338    }
4339    var cacheKey = /* @__PURE__ */ Symbol.for("AnimatedComponent");
4340    var createHost = (components, {
4341      applyAnimatedValues: _applyAnimatedValues = () => false,
4342      createAnimatedStyle: _createAnimatedStyle = (style) => new AnimatedObject(style),
4343      getComponentProps: _getComponentProps = (props) => props
4344    } = {}) => {
4345      const hostConfig = {
4346        applyAnimatedValues: _applyAnimatedValues,
4347        createAnimatedStyle: _createAnimatedStyle,
4348        getComponentProps: _getComponentProps
4349      };
4350      const animated2 = (Component) => {
4351        const displayName = getDisplayName(Component) || "Anonymous";
4352        if (is.str(Component)) {
4353          Component = animated2[Component] || (animated2[Component] = withAnimated(Component, hostConfig));
4354        } else {
4355          Component = Component[cacheKey] || (Component[cacheKey] = withAnimated(Component, hostConfig));
4356        }
4357        Component.displayName = `Animated($displayName})`;
4358        return Component;
4359      };
4360      eachProp(components, (Component, key) => {
4361        if (is.arr(components)) {
4362          key = getDisplayName(Component);
4363        }
4364        animated2[key] = animated2(Component);
4365      });
4366      return {
4367        animated: animated2
4368      };
4369    };
4370    var getDisplayName = (arg) => is.str(arg) ? arg : arg && is.str(arg.displayName) ? arg.displayName : is.fun(arg) && arg.name || null;
4371  
4372    // node_modules/@react-spring/core/dist/react-spring-core.esm.js
4373    function _extends3() {
4374      _extends3 = Object.assign ? Object.assign.bind() : function(target) {
4375        for (var i2 = 1; i2 < arguments.length; i2++) {
4376          var source = arguments[i2];
4377          for (var key in source) {
4378            if (Object.prototype.hasOwnProperty.call(source, key)) {
4379              target[key] = source[key];
4380            }
4381          }
4382        }
4383        return target;
4384      };
4385      return _extends3.apply(this, arguments);
4386    }
4387    function callProp(value, ...args) {
4388      return is.fun(value) ? value(...args) : value;
4389    }
4390    var matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key)));
4391    var resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop;
4392    var getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0;
4393    var noopTransform = (value) => value;
4394    var getDefaultProps = (props, transform = noopTransform) => {
4395      let keys = DEFAULT_PROPS;
4396      if (props.default && props.default !== true) {
4397        props = props.default;
4398        keys = Object.keys(props);
4399      }
4400      const defaults2 = {};
4401      for (const key of keys) {
4402        const value = transform(props[key], key);
4403        if (!is.und(value)) {
4404          defaults2[key] = value;
4405        }
4406      }
4407      return defaults2;
4408    };
4409    var DEFAULT_PROPS = ["config", "onProps", "onStart", "onChange", "onPause", "onResume", "onRest"];
4410    var RESERVED_PROPS = {
4411      config: 1,
4412      from: 1,
4413      to: 1,
4414      ref: 1,
4415      loop: 1,
4416      reset: 1,
4417      pause: 1,
4418      cancel: 1,
4419      reverse: 1,
4420      immediate: 1,
4421      default: 1,
4422      delay: 1,
4423      onProps: 1,
4424      onStart: 1,
4425      onChange: 1,
4426      onPause: 1,
4427      onResume: 1,
4428      onRest: 1,
4429      onResolve: 1,
4430      items: 1,
4431      trail: 1,
4432      sort: 1,
4433      expires: 1,
4434      initial: 1,
4435      enter: 1,
4436      update: 1,
4437      leave: 1,
4438      children: 1,
4439      onDestroyed: 1,
4440      keys: 1,
4441      callId: 1,
4442      parentId: 1
4443    };
4444    function getForwardProps(props) {
4445      const forward = {};
4446      let count = 0;
4447      eachProp(props, (value, prop) => {
4448        if (!RESERVED_PROPS[prop]) {
4449          forward[prop] = value;
4450          count++;
4451        }
4452      });
4453      if (count) {
4454        return forward;
4455      }
4456    }
4457    function inferTo(props) {
4458      const to2 = getForwardProps(props);
4459      if (to2) {
4460        const out = {
4461          to: to2
4462        };
4463        eachProp(props, (val, key) => key in to2 || (out[key] = val));
4464        return out;
4465      }
4466      return _extends3({}, props);
4467    }
4468    function computeGoal(value) {
4469      value = getFluidValue(value);
4470      return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({
4471        range: [0, 1],
4472        output: [value, value]
4473      })(1) : value;
4474    }
4475    function isAsyncTo(to2) {
4476      return is.fun(to2) || is.arr(to2) && is.obj(to2[0]);
4477    }
4478    var config = {
4479      default: {
4480        tension: 170,
4481        friction: 26
4482      },
4483      gentle: {
4484        tension: 120,
4485        friction: 14
4486      },
4487      wobbly: {
4488        tension: 180,
4489        friction: 12
4490      },
4491      stiff: {
4492        tension: 210,
4493        friction: 20
4494      },
4495      slow: {
4496        tension: 280,
4497        friction: 60
4498      },
4499      molasses: {
4500        tension: 280,
4501        friction: 120
4502      }
4503    };
4504    var c1 = 1.70158;
4505    var c2 = c1 * 1.525;
4506    var c3 = c1 + 1;
4507    var c4 = 2 * Math.PI / 3;
4508    var c5 = 2 * Math.PI / 4.5;
4509    var bounceOut = (x2) => {
4510      const n1 = 7.5625;
4511      const d1 = 2.75;
4512      if (x2 < 1 / d1) {
4513        return n1 * x2 * x2;
4514      } else if (x2 < 2 / d1) {
4515        return n1 * (x2 -= 1.5 / d1) * x2 + 0.75;
4516      } else if (x2 < 2.5 / d1) {
4517        return n1 * (x2 -= 2.25 / d1) * x2 + 0.9375;
4518      } else {
4519        return n1 * (x2 -= 2.625 / d1) * x2 + 0.984375;
4520      }
4521    };
4522    var easings = {
4523      linear: (x2) => x2,
4524      easeInQuad: (x2) => x2 * x2,
4525      easeOutQuad: (x2) => 1 - (1 - x2) * (1 - x2),
4526      easeInOutQuad: (x2) => x2 < 0.5 ? 2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 2) / 2,
4527      easeInCubic: (x2) => x2 * x2 * x2,
4528      easeOutCubic: (x2) => 1 - Math.pow(1 - x2, 3),
4529      easeInOutCubic: (x2) => x2 < 0.5 ? 4 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 3) / 2,
4530      easeInQuart: (x2) => x2 * x2 * x2 * x2,
4531      easeOutQuart: (x2) => 1 - Math.pow(1 - x2, 4),
4532      easeInOutQuart: (x2) => x2 < 0.5 ? 8 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 4) / 2,
4533      easeInQuint: (x2) => x2 * x2 * x2 * x2 * x2,
4534      easeOutQuint: (x2) => 1 - Math.pow(1 - x2, 5),
4535      easeInOutQuint: (x2) => x2 < 0.5 ? 16 * x2 * x2 * x2 * x2 * x2 : 1 - Math.pow(-2 * x2 + 2, 5) / 2,
4536      easeInSine: (x2) => 1 - Math.cos(x2 * Math.PI / 2),
4537      easeOutSine: (x2) => Math.sin(x2 * Math.PI / 2),
4538      easeInOutSine: (x2) => -(Math.cos(Math.PI * x2) - 1) / 2,
4539      easeInExpo: (x2) => x2 === 0 ? 0 : Math.pow(2, 10 * x2 - 10),
4540      easeOutExpo: (x2) => x2 === 1 ? 1 : 1 - Math.pow(2, -10 * x2),
4541      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,
4542      easeInCirc: (x2) => 1 - Math.sqrt(1 - Math.pow(x2, 2)),
4543      easeOutCirc: (x2) => Math.sqrt(1 - Math.pow(x2 - 1, 2)),
4544      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,
4545      easeInBack: (x2) => c3 * x2 * x2 * x2 - c1 * x2 * x2,
4546      easeOutBack: (x2) => 1 + c3 * Math.pow(x2 - 1, 3) + c1 * Math.pow(x2 - 1, 2),
4547      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,
4548      easeInElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : -Math.pow(2, 10 * x2 - 10) * Math.sin((x2 * 10 - 10.75) * c4),
4549      easeOutElastic: (x2) => x2 === 0 ? 0 : x2 === 1 ? 1 : Math.pow(2, -10 * x2) * Math.sin((x2 * 10 - 0.75) * c4) + 1,
4550      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,
4551      easeInBounce: (x2) => 1 - bounceOut(1 - x2),
4552      easeOutBounce: bounceOut,
4553      easeInOutBounce: (x2) => x2 < 0.5 ? (1 - bounceOut(1 - 2 * x2)) / 2 : (1 + bounceOut(2 * x2 - 1)) / 2
4554    };
4555    var defaults = _extends3({}, config.default, {
4556      mass: 1,
4557      damping: 1,
4558      easing: easings.linear,
4559      clamp: false
4560    });
4561    var AnimationConfig = class {
4562      constructor() {
4563        this.tension = void 0;
4564        this.friction = void 0;
4565        this.frequency = void 0;
4566        this.damping = void 0;
4567        this.mass = void 0;
4568        this.velocity = 0;
4569        this.restVelocity = void 0;
4570        this.precision = void 0;
4571        this.progress = void 0;
4572        this.duration = void 0;
4573        this.easing = void 0;
4574        this.clamp = void 0;
4575        this.bounce = void 0;
4576        this.decay = void 0;
4577        this.round = void 0;
4578        Object.assign(this, defaults);
4579      }
4580    };
4581    function mergeConfig(config2, newConfig, defaultConfig) {
4582      if (defaultConfig) {
4583        defaultConfig = _extends3({}, defaultConfig);
4584        sanitizeConfig(defaultConfig, newConfig);
4585        newConfig = _extends3({}, defaultConfig, newConfig);
4586      }
4587      sanitizeConfig(config2, newConfig);
4588      Object.assign(config2, newConfig);
4589      for (const key in defaults) {
4590        if (config2[key] == null) {
4591          config2[key] = defaults[key];
4592        }
4593      }
4594      let {
4595        mass,
4596        frequency,
4597        damping
4598      } = config2;
4599      if (!is.und(frequency)) {
4600        if (frequency < 0.01) frequency = 0.01;
4601        if (damping < 0) damping = 0;
4602        config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass;
4603        config2.friction = 4 * Math.PI * damping * mass / frequency;
4604      }
4605      return config2;
4606    }
4607    function sanitizeConfig(config2, props) {
4608      if (!is.und(props.decay)) {
4609        config2.duration = void 0;
4610      } else {
4611        const isTensionConfig = !is.und(props.tension) || !is.und(props.friction);
4612        if (isTensionConfig || !is.und(props.frequency) || !is.und(props.damping) || !is.und(props.mass)) {
4613          config2.duration = void 0;
4614          config2.decay = void 0;
4615        }
4616        if (isTensionConfig) {
4617          config2.frequency = void 0;
4618        }
4619      }
4620    }
4621    var emptyArray = [];
4622    var Animation = class {
4623      constructor() {
4624        this.changed = false;
4625        this.values = emptyArray;
4626        this.toValues = null;
4627        this.fromValues = emptyArray;
4628        this.to = void 0;
4629        this.from = void 0;
4630        this.config = new AnimationConfig();
4631        this.immediate = false;
4632      }
4633    };
4634    function scheduleProps(callId, {
4635      key,
4636      props,
4637      defaultProps,
4638      state,
4639      actions
4640    }) {
4641      return new Promise((resolve, reject) => {
4642        var _props$cancel;
4643        let delay;
4644        let timeout;
4645        let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key);
4646        if (cancel) {
4647          onStart();
4648        } else {
4649          if (!is.und(props.pause)) {
4650            state.paused = matchProp(props.pause, key);
4651          }
4652          let pause = defaultProps == null ? void 0 : defaultProps.pause;
4653          if (pause !== true) {
4654            pause = state.paused || matchProp(pause, key);
4655          }
4656          delay = callProp(props.delay || 0, key);
4657          if (pause) {
4658            state.resumeQueue.add(onResume);
4659            actions.pause();
4660          } else {
4661            actions.resume();
4662            onResume();
4663          }
4664        }
4665        function onPause() {
4666          state.resumeQueue.add(onResume);
4667          state.timeouts.delete(timeout);
4668          timeout.cancel();
4669          delay = timeout.time - raf.now();
4670        }
4671        function onResume() {
4672          if (delay > 0 && !globals.skipAnimation) {
4673            state.delayed = true;
4674            timeout = raf.setTimeout(onStart, delay);
4675            state.pauseQueue.add(onPause);
4676            state.timeouts.add(timeout);
4677          } else {
4678            onStart();
4679          }
4680        }
4681        function onStart() {
4682          if (state.delayed) {
4683            state.delayed = false;
4684          }
4685          state.pauseQueue.delete(onPause);
4686          state.timeouts.delete(timeout);
4687          if (callId <= (state.cancelId || 0)) {
4688            cancel = true;
4689          }
4690          try {
4691            actions.start(_extends3({}, props, {
4692              callId,
4693              cancel
4694            }), resolve);
4695          } catch (err) {
4696            reject(err);
4697          }
4698        }
4699      });
4700    }
4701    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));
4702    var getNoopResult = (value) => ({
4703      value,
4704      noop: true,
4705      finished: true,
4706      cancelled: false
4707    });
4708    var getFinishedResult = (value, finished, cancelled = false) => ({
4709      value,
4710      finished,
4711      cancelled
4712    });
4713    var getCancelledResult = (value) => ({
4714      value,
4715      cancelled: true,
4716      finished: false
4717    });
4718    function runAsync(to2, props, state, target) {
4719      const {
4720        callId,
4721        parentId,
4722        onRest
4723      } = props;
4724      const {
4725        asyncTo: prevTo,
4726        promise: prevPromise
4727      } = state;
4728      if (!parentId && to2 === prevTo && !props.reset) {
4729        return prevPromise;
4730      }
4731      return state.promise = (async () => {
4732        state.asyncId = callId;
4733        state.asyncTo = to2;
4734        const defaultProps = getDefaultProps(props, (value, key) => key === "onRest" ? void 0 : value);
4735        let preventBail;
4736        let bail;
4737        const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject));
4738        const bailIfEnded = (bailSignal) => {
4739          const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false);
4740          if (bailResult) {
4741            bailSignal.result = bailResult;
4742            bail(bailSignal);
4743            throw bailSignal;
4744          }
4745        };
4746        const animate = (arg1, arg2) => {
4747          const bailSignal = new BailSignal();
4748          const skipAnimationSignal = new SkipAniamtionSignal();
4749          return (async () => {
4750            if (globals.skipAnimation) {
4751              stopAsync(state);
4752              skipAnimationSignal.result = getFinishedResult(target, false);
4753              bail(skipAnimationSignal);
4754              throw skipAnimationSignal;
4755            }
4756            bailIfEnded(bailSignal);
4757            const props2 = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, {
4758              to: arg1
4759            });
4760            props2.parentId = callId;
4761            eachProp(defaultProps, (value, key) => {
4762              if (is.und(props2[key])) {
4763                props2[key] = value;
4764              }
4765            });
4766            const result2 = await target.start(props2);
4767            bailIfEnded(bailSignal);
4768            if (state.paused) {
4769              await new Promise((resume) => {
4770                state.resumeQueue.add(resume);
4771              });
4772            }
4773            return result2;
4774          })();
4775        };
4776        let result;
4777        if (globals.skipAnimation) {
4778          stopAsync(state);
4779          return getFinishedResult(target, false);
4780        }
4781        try {
4782          let animating;
4783          if (is.arr(to2)) {
4784            animating = (async (queue) => {
4785              for (const props2 of queue) {
4786                await animate(props2);
4787              }
4788            })(to2);
4789          } else {
4790            animating = Promise.resolve(to2(animate, target.stop.bind(target)));
4791          }
4792          await Promise.all([animating.then(preventBail), bailPromise]);
4793          result = getFinishedResult(target.get(), true, false);
4794        } catch (err) {
4795          if (err instanceof BailSignal) {
4796            result = err.result;
4797          } else if (err instanceof SkipAniamtionSignal) {
4798            result = err.result;
4799          } else {
4800            throw err;
4801          }
4802        } finally {
4803          if (callId == state.asyncId) {
4804            state.asyncId = parentId;
4805            state.asyncTo = parentId ? prevTo : void 0;
4806            state.promise = parentId ? prevPromise : void 0;
4807          }
4808        }
4809        if (is.fun(onRest)) {
4810          raf.batchedUpdates(() => {
4811            onRest(result, target, target.item);
4812          });
4813        }
4814        return result;
4815      })();
4816    }
4817    function stopAsync(state, cancelId) {
4818      flush(state.timeouts, (t3) => t3.cancel());
4819      state.pauseQueue.clear();
4820      state.resumeQueue.clear();
4821      state.asyncId = state.asyncTo = state.promise = void 0;
4822      if (cancelId) state.cancelId = cancelId;
4823    }
4824    var BailSignal = class extends Error {
4825      constructor() {
4826        super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.");
4827        this.result = void 0;
4828      }
4829    };
4830    var SkipAniamtionSignal = class extends Error {
4831      constructor() {
4832        super("SkipAnimationSignal");
4833        this.result = void 0;
4834      }
4835    };
4836    var isFrameValue = (value) => value instanceof FrameValue;
4837    var nextId$1 = 1;
4838    var FrameValue = class extends FluidValue {
4839      constructor(...args) {
4840        super(...args);
4841        this.id = nextId$1++;
4842        this.key = void 0;
4843        this._priority = 0;
4844      }
4845      get priority() {
4846        return this._priority;
4847      }
4848      set priority(priority2) {
4849        if (this._priority != priority2) {
4850          this._priority = priority2;
4851          this._onPriorityChange(priority2);
4852        }
4853      }
4854      get() {
4855        const node = getAnimated(this);
4856        return node && node.getValue();
4857      }
4858      to(...args) {
4859        return globals.to(this, args);
4860      }
4861      interpolate(...args) {
4862        deprecateInterpolate();
4863        return globals.to(this, args);
4864      }
4865      toJSON() {
4866        return this.get();
4867      }
4868      observerAdded(count) {
4869        if (count == 1) this._attach();
4870      }
4871      observerRemoved(count) {
4872        if (count == 0) this._detach();
4873      }
4874      _attach() {
4875      }
4876      _detach() {
4877      }
4878      _onChange(value, idle = false) {
4879        callFluidObservers(this, {
4880          type: "change",
4881          parent: this,
4882          value,
4883          idle
4884        });
4885      }
4886      _onPriorityChange(priority2) {
4887        if (!this.idle) {
4888          frameLoop.sort(this);
4889        }
4890        callFluidObservers(this, {
4891          type: "priority",
4892          parent: this,
4893          priority: priority2
4894        });
4895      }
4896    };
4897    var $P = /* @__PURE__ */ Symbol.for("SpringPhase");
4898    var HAS_ANIMATED = 1;
4899    var IS_ANIMATING = 2;
4900    var IS_PAUSED = 4;
4901    var hasAnimated = (target) => (target[$P] & HAS_ANIMATED) > 0;
4902    var isAnimating = (target) => (target[$P] & IS_ANIMATING) > 0;
4903    var isPaused = (target) => (target[$P] & IS_PAUSED) > 0;
4904    var setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING;
4905    var setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED;
4906    var SpringValue = class extends FrameValue {
4907      constructor(arg1, arg2) {
4908        super();
4909        this.key = void 0;
4910        this.animation = new Animation();
4911        this.queue = void 0;
4912        this.defaultProps = {};
4913        this._state = {
4914          paused: false,
4915          delayed: false,
4916          pauseQueue: /* @__PURE__ */ new Set(),
4917          resumeQueue: /* @__PURE__ */ new Set(),
4918          timeouts: /* @__PURE__ */ new Set()
4919        };
4920        this._pendingCalls = /* @__PURE__ */ new Set();
4921        this._lastCallId = 0;
4922        this._lastToId = 0;
4923        this._memoizedDuration = 0;
4924        if (!is.und(arg1) || !is.und(arg2)) {
4925          const props = is.obj(arg1) ? _extends3({}, arg1) : _extends3({}, arg2, {
4926            from: arg1
4927          });
4928          if (is.und(props.default)) {
4929            props.default = true;
4930          }
4931          this.start(props);
4932        }
4933      }
4934      get idle() {
4935        return !(isAnimating(this) || this._state.asyncTo) || isPaused(this);
4936      }
4937      get goal() {
4938        return getFluidValue(this.animation.to);
4939      }
4940      get velocity() {
4941        const node = getAnimated(this);
4942        return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map((node2) => node2.lastVelocity || 0);
4943      }
4944      get hasAnimated() {
4945        return hasAnimated(this);
4946      }
4947      get isAnimating() {
4948        return isAnimating(this);
4949      }
4950      get isPaused() {
4951        return isPaused(this);
4952      }
4953      get isDelayed() {
4954        return this._state.delayed;
4955      }
4956      advance(dt) {
4957        let idle = true;
4958        let changed = false;
4959        const anim = this.animation;
4960        let {
4961          config: config2,
4962          toValues
4963        } = anim;
4964        const payload = getPayload(anim.to);
4965        if (!payload && hasFluidValue(anim.to)) {
4966          toValues = toArray(getFluidValue(anim.to));
4967        }
4968        anim.values.forEach((node2, i2) => {
4969          if (node2.done) return;
4970          const to2 = node2.constructor == AnimatedString ? 1 : payload ? payload[i2].lastPosition : toValues[i2];
4971          let finished = anim.immediate;
4972          let position = to2;
4973          if (!finished) {
4974            position = node2.lastPosition;
4975            if (config2.tension <= 0) {
4976              node2.done = true;
4977              return;
4978            }
4979            let elapsed = node2.elapsedTime += dt;
4980            const from = anim.fromValues[i2];
4981            const v0 = node2.v0 != null ? node2.v0 : node2.v0 = is.arr(config2.velocity) ? config2.velocity[i2] : config2.velocity;
4982            let velocity;
4983            const precision = config2.precision || (from == to2 ? 5e-3 : Math.min(1, Math.abs(to2 - from) * 1e-3));
4984            if (!is.und(config2.duration)) {
4985              let p3 = 1;
4986              if (config2.duration > 0) {
4987                if (this._memoizedDuration !== config2.duration) {
4988                  this._memoizedDuration = config2.duration;
4989                  if (node2.durationProgress > 0) {
4990                    node2.elapsedTime = config2.duration * node2.durationProgress;
4991                    elapsed = node2.elapsedTime += dt;
4992                  }
4993                }
4994                p3 = (config2.progress || 0) + elapsed / this._memoizedDuration;
4995                p3 = p3 > 1 ? 1 : p3 < 0 ? 0 : p3;
4996                node2.durationProgress = p3;
4997              }
4998              position = from + config2.easing(p3) * (to2 - from);
4999              velocity = (position - node2.lastPosition) / dt;
5000              finished = p3 == 1;
5001            } else if (config2.decay) {
5002              const decay = config2.decay === true ? 0.998 : config2.decay;
5003              const e2 = Math.exp(-(1 - decay) * elapsed);
5004              position = from + v0 / (1 - decay) * (1 - e2);
5005              finished = Math.abs(node2.lastPosition - position) <= precision;
5006              velocity = v0 * e2;
5007            } else {
5008              velocity = node2.lastVelocity == null ? v0 : node2.lastVelocity;
5009              const restVelocity = config2.restVelocity || precision / 10;
5010              const bounceFactor = config2.clamp ? 0 : config2.bounce;
5011              const canBounce = !is.und(bounceFactor);
5012              const isGrowing = from == to2 ? node2.v0 > 0 : from < to2;
5013              let isMoving;
5014              let isBouncing = false;
5015              const step = 1;
5016              const numSteps = Math.ceil(dt / step);
5017              for (let n2 = 0; n2 < numSteps; ++n2) {
5018                isMoving = Math.abs(velocity) > restVelocity;
5019                if (!isMoving) {
5020                  finished = Math.abs(to2 - position) <= precision;
5021                  if (finished) {
5022                    break;
5023                  }
5024                }
5025                if (canBounce) {
5026                  isBouncing = position == to2 || position > to2 == isGrowing;
5027                  if (isBouncing) {
5028                    velocity = -velocity * bounceFactor;
5029                    position = to2;
5030                  }
5031                }
5032                const springForce = -config2.tension * 1e-6 * (position - to2);
5033                const dampingForce = -config2.friction * 1e-3 * velocity;
5034                const acceleration = (springForce + dampingForce) / config2.mass;
5035                velocity = velocity + acceleration * step;
5036                position = position + velocity * step;
5037              }
5038            }
5039            node2.lastVelocity = velocity;
5040            if (Number.isNaN(position)) {
5041              console.warn(`Got NaN while animating:`, this);
5042              finished = true;
5043            }
5044          }
5045          if (payload && !payload[i2].done) {
5046            finished = false;
5047          }
5048          if (finished) {
5049            node2.done = true;
5050          } else {
5051            idle = false;
5052          }
5053          if (node2.setValue(position, config2.round)) {
5054            changed = true;
5055          }
5056        });
5057        const node = getAnimated(this);
5058        const currVal = node.getValue();
5059        if (idle) {
5060          const finalVal = getFluidValue(anim.to);
5061          if ((currVal !== finalVal || changed) && !config2.decay) {
5062            node.setValue(finalVal);
5063            this._onChange(finalVal);
5064          } else if (changed && config2.decay) {
5065            this._onChange(currVal);
5066          }
5067          this._stop();
5068        } else if (changed) {
5069          this._onChange(currVal);
5070        }
5071      }
5072      set(value) {
5073        raf.batchedUpdates(() => {
5074          this._stop();
5075          this._focus(value);
5076          this._set(value);
5077        });
5078        return this;
5079      }
5080      pause() {
5081        this._update({
5082          pause: true
5083        });
5084      }
5085      resume() {
5086        this._update({
5087          pause: false
5088        });
5089      }
5090      finish() {
5091        if (isAnimating(this)) {
5092          const {
5093            to: to2,
5094            config: config2
5095          } = this.animation;
5096          raf.batchedUpdates(() => {
5097            this._onStart();
5098            if (!config2.decay) {
5099              this._set(to2, false);
5100            }
5101            this._stop();
5102          });
5103        }
5104        return this;
5105      }
5106      update(props) {
5107        const queue = this.queue || (this.queue = []);
5108        queue.push(props);
5109        return this;
5110      }
5111      start(to2, arg2) {
5112        let queue;
5113        if (!is.und(to2)) {
5114          queue = [is.obj(to2) ? to2 : _extends3({}, arg2, {
5115            to: to2
5116          })];
5117        } else {
5118          queue = this.queue || [];
5119          this.queue = [];
5120        }
5121        return Promise.all(queue.map((props) => {
5122          const up = this._update(props);
5123          return up;
5124        })).then((results) => getCombinedResult(this, results));
5125      }
5126      stop(cancel) {
5127        const {
5128          to: to2
5129        } = this.animation;
5130        this._focus(this.get());
5131        stopAsync(this._state, cancel && this._lastCallId);
5132        raf.batchedUpdates(() => this._stop(to2, cancel));
5133        return this;
5134      }
5135      reset() {
5136        this._update({
5137          reset: true
5138        });
5139      }
5140      eventObserved(event) {
5141        if (event.type == "change") {
5142          this._start();
5143        } else if (event.type == "priority") {
5144          this.priority = event.priority + 1;
5145        }
5146      }
5147      _prepareNode(props) {
5148        const key = this.key || "";
5149        let {
5150          to: to2,
5151          from
5152        } = props;
5153        to2 = is.obj(to2) ? to2[key] : to2;
5154        if (to2 == null || isAsyncTo(to2)) {
5155          to2 = void 0;
5156        }
5157        from = is.obj(from) ? from[key] : from;
5158        if (from == null) {
5159          from = void 0;
5160        }
5161        const range = {
5162          to: to2,
5163          from
5164        };
5165        if (!hasAnimated(this)) {
5166          if (props.reverse) [to2, from] = [from, to2];
5167          from = getFluidValue(from);
5168          if (!is.und(from)) {
5169            this._set(from);
5170          } else if (!getAnimated(this)) {
5171            this._set(to2);
5172          }
5173        }
5174        return range;
5175      }
5176      _update(_ref, isLoop) {
5177        let props = _extends3({}, _ref);
5178        const {
5179          key,
5180          defaultProps
5181        } = this;
5182        if (props.default) Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value));
5183        mergeActiveFn(this, props, "onProps");
5184        sendEvent(this, "onProps", props, this);
5185        const range = this._prepareNode(props);
5186        if (Object.isFrozen(this)) {
5187          throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");
5188        }
5189        const state = this._state;
5190        return scheduleProps(++this._lastCallId, {
5191          key,
5192          props,
5193          defaultProps,
5194          state,
5195          actions: {
5196            pause: () => {
5197              if (!isPaused(this)) {
5198                setPausedBit(this, true);
5199                flushCalls(state.pauseQueue);
5200                sendEvent(this, "onPause", getFinishedResult(this, checkFinished(this, this.animation.to)), this);
5201              }
5202            },
5203            resume: () => {
5204              if (isPaused(this)) {
5205                setPausedBit(this, false);
5206                if (isAnimating(this)) {
5207                  this._resume();
5208                }
5209                flushCalls(state.resumeQueue);
5210                sendEvent(this, "onResume", getFinishedResult(this, checkFinished(this, this.animation.to)), this);
5211              }
5212            },
5213            start: this._merge.bind(this, range)
5214          }
5215        }).then((result) => {
5216          if (props.loop && result.finished && !(isLoop && result.noop)) {
5217            const nextProps = createLoopUpdate(props);
5218            if (nextProps) {
5219              return this._update(nextProps, true);
5220            }
5221          }
5222          return result;
5223        });
5224      }
5225      _merge(range, props, resolve) {
5226        if (props.cancel) {
5227          this.stop(true);
5228          return resolve(getCancelledResult(this));
5229        }
5230        const hasToProp = !is.und(range.to);
5231        const hasFromProp = !is.und(range.from);
5232        if (hasToProp || hasFromProp) {
5233          if (props.callId > this._lastToId) {
5234            this._lastToId = props.callId;
5235          } else {
5236            return resolve(getCancelledResult(this));
5237          }
5238        }
5239        const {
5240          key,
5241          defaultProps,
5242          animation: anim
5243        } = this;
5244        const {
5245          to: prevTo,
5246          from: prevFrom
5247        } = anim;
5248        let {
5249          to: to2 = prevTo,
5250          from = prevFrom
5251        } = range;
5252        if (hasFromProp && !hasToProp && (!props.default || is.und(to2))) {
5253          to2 = from;
5254        }
5255        if (props.reverse) [to2, from] = [from, to2];
5256        const hasFromChanged = !isEqual(from, prevFrom);
5257        if (hasFromChanged) {
5258          anim.from = from;
5259        }
5260        from = getFluidValue(from);
5261        const hasToChanged = !isEqual(to2, prevTo);
5262        if (hasToChanged) {
5263          this._focus(to2);
5264        }
5265        const hasAsyncTo = isAsyncTo(props.to);
5266        const {
5267          config: config2
5268        } = anim;
5269        const {
5270          decay,
5271          velocity
5272        } = config2;
5273        if (hasToProp || hasFromProp) {
5274          config2.velocity = 0;
5275        }
5276        if (props.config && !hasAsyncTo) {
5277          mergeConfig(config2, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0);
5278        }
5279        let node = getAnimated(this);
5280        if (!node || is.und(to2)) {
5281          return resolve(getFinishedResult(this, true));
5282        }
5283        const reset = is.und(props.reset) ? hasFromProp && !props.default : !is.und(from) && matchProp(props.reset, key);
5284        const value = reset ? from : this.get();
5285        const goal = computeGoal(to2);
5286        const isAnimatable = is.num(goal) || is.arr(goal) || isAnimatedString(goal);
5287        const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key));
5288        if (hasToChanged) {
5289          const nodeType = getAnimatedType(to2);
5290          if (nodeType !== node.constructor) {
5291            if (immediate) {
5292              node = this._set(goal);
5293            } else throw Error(`Cannot animate between $node.constructor.name} and $nodeType.name}, as the "to" prop suggests`);
5294          }
5295        }
5296        const goalType = node.constructor;
5297        let started = hasFluidValue(to2);
5298        let finished = false;
5299        if (!started) {
5300          const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
5301          if (hasToChanged || hasValueChanged) {
5302            finished = isEqual(computeGoal(value), goal);
5303            started = !finished;
5304          }
5305          if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) {
5306            started = true;
5307          }
5308        }
5309        if (finished && isAnimating(this)) {
5310          if (anim.changed && !reset) {
5311            started = true;
5312          } else if (!started) {
5313            this._stop(prevTo);
5314          }
5315        }
5316        if (!hasAsyncTo) {
5317          if (started || hasFluidValue(prevTo)) {
5318            anim.values = node.getPayload();
5319            anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal);
5320          }
5321          if (anim.immediate != immediate) {
5322            anim.immediate = immediate;
5323            if (!immediate && !reset) {
5324              this._set(prevTo);
5325            }
5326          }
5327          if (started) {
5328            const {
5329              onRest
5330            } = anim;
5331            each(ACTIVE_EVENTS, (type) => mergeActiveFn(this, props, type));
5332            const result = getFinishedResult(this, checkFinished(this, prevTo));
5333            flushCalls(this._pendingCalls, result);
5334            this._pendingCalls.add(resolve);
5335            if (anim.changed) raf.batchedUpdates(() => {
5336              anim.changed = !reset;
5337              onRest == null ? void 0 : onRest(result, this);
5338              if (reset) {
5339                callProp(defaultProps.onRest, result);
5340              } else {
5341                anim.onStart == null ? void 0 : anim.onStart(result, this);
5342              }
5343            });
5344          }
5345        }
5346        if (reset) {
5347          this._set(value);
5348        }
5349        if (hasAsyncTo) {
5350          resolve(runAsync(props.to, props, this._state, this));
5351        } else if (started) {
5352          this._start();
5353        } else if (isAnimating(this) && !hasToChanged) {
5354          this._pendingCalls.add(resolve);
5355        } else {
5356          resolve(getNoopResult(value));
5357        }
5358      }
5359      _focus(value) {
5360        const anim = this.animation;
5361        if (value !== anim.to) {
5362          if (getFluidObservers(this)) {
5363            this._detach();
5364          }
5365          anim.to = value;
5366          if (getFluidObservers(this)) {
5367            this._attach();
5368          }
5369        }
5370      }
5371      _attach() {
5372        let priority2 = 0;
5373        const {
5374          to: to2
5375        } = this.animation;
5376        if (hasFluidValue(to2)) {
5377          addFluidObserver(to2, this);
5378          if (isFrameValue(to2)) {
5379            priority2 = to2.priority + 1;
5380          }
5381        }
5382        this.priority = priority2;
5383      }
5384      _detach() {
5385        const {
5386          to: to2
5387        } = this.animation;
5388        if (hasFluidValue(to2)) {
5389          removeFluidObserver(to2, this);
5390        }
5391      }
5392      _set(arg, idle = true) {
5393        const value = getFluidValue(arg);
5394        if (!is.und(value)) {
5395          const oldNode = getAnimated(this);
5396          if (!oldNode || !isEqual(value, oldNode.getValue())) {
5397            const nodeType = getAnimatedType(value);
5398            if (!oldNode || oldNode.constructor != nodeType) {
5399              setAnimated(this, nodeType.create(value));
5400            } else {
5401              oldNode.setValue(value);
5402            }
5403            if (oldNode) {
5404              raf.batchedUpdates(() => {
5405                this._onChange(value, idle);
5406              });
5407            }
5408          }
5409        }
5410        return getAnimated(this);
5411      }
5412      _onStart() {
5413        const anim = this.animation;
5414        if (!anim.changed) {
5415          anim.changed = true;
5416          sendEvent(this, "onStart", getFinishedResult(this, checkFinished(this, anim.to)), this);
5417        }
5418      }
5419      _onChange(value, idle) {
5420        if (!idle) {
5421          this._onStart();
5422          callProp(this.animation.onChange, value, this);
5423        }
5424        callProp(this.defaultProps.onChange, value, this);
5425        super._onChange(value, idle);
5426      }
5427      _start() {
5428        const anim = this.animation;
5429        getAnimated(this).reset(getFluidValue(anim.to));
5430        if (!anim.immediate) {
5431          anim.fromValues = anim.values.map((node) => node.lastPosition);
5432        }
5433        if (!isAnimating(this)) {
5434          setActiveBit(this, true);
5435          if (!isPaused(this)) {
5436            this._resume();
5437          }
5438        }
5439      }
5440      _resume() {
5441        if (globals.skipAnimation) {
5442          this.finish();
5443        } else {
5444          frameLoop.start(this);
5445        }
5446      }
5447      _stop(goal, cancel) {
5448        if (isAnimating(this)) {
5449          setActiveBit(this, false);
5450          const anim = this.animation;
5451          each(anim.values, (node) => {
5452            node.done = true;
5453          });
5454          if (anim.toValues) {
5455            anim.onChange = anim.onPause = anim.onResume = void 0;
5456          }
5457          callFluidObservers(this, {
5458            type: "idle",
5459            parent: this
5460          });
5461          const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to));
5462          flushCalls(this._pendingCalls, result);
5463          if (anim.changed) {
5464            anim.changed = false;
5465            sendEvent(this, "onRest", result, this);
5466          }
5467        }
5468      }
5469    };
5470    function checkFinished(target, to2) {
5471      const goal = computeGoal(to2);
5472      const value = computeGoal(target.get());
5473      return isEqual(value, goal);
5474    }
5475    function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) {
5476      let loopRet = callProp(loop2);
5477      if (loopRet) {
5478        const overrides = loopRet !== true && inferTo(loopRet);
5479        const reverse = (overrides || props).reverse;
5480        const reset = !overrides || overrides.reset;
5481        return createUpdate(_extends3({}, props, {
5482          loop: loop2,
5483          default: false,
5484          pause: void 0,
5485          to: !reverse || isAsyncTo(to2) ? to2 : void 0,
5486          from: reset ? props.from : void 0,
5487          reset
5488        }, overrides));
5489      }
5490    }
5491    function createUpdate(props) {
5492      const {
5493        to: to2,
5494        from
5495      } = props = inferTo(props);
5496      const keys = /* @__PURE__ */ new Set();
5497      if (is.obj(to2)) findDefined(to2, keys);
5498      if (is.obj(from)) findDefined(from, keys);
5499      props.keys = keys.size ? Array.from(keys) : null;
5500      return props;
5501    }
5502    function findDefined(values, keys) {
5503      eachProp(values, (value, key) => value != null && keys.add(key));
5504    }
5505    var ACTIVE_EVENTS = ["onStart", "onRest", "onChange", "onPause", "onResume"];
5506    function mergeActiveFn(target, props, type) {
5507      target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : void 0;
5508    }
5509    function sendEvent(target, type, ...args) {
5510      var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps;
5511      (_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args);
5512      (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args);
5513    }
5514    var BATCHED_EVENTS = ["onStart", "onChange", "onRest"];
5515    var nextId = 1;
5516    var Controller = class {
5517      constructor(props, flush2) {
5518        this.id = nextId++;
5519        this.springs = {};
5520        this.queue = [];
5521        this.ref = void 0;
5522        this._flush = void 0;
5523        this._initialProps = void 0;
5524        this._lastAsyncId = 0;
5525        this._active = /* @__PURE__ */ new Set();
5526        this._changed = /* @__PURE__ */ new Set();
5527        this._started = false;
5528        this._item = void 0;
5529        this._state = {
5530          paused: false,
5531          pauseQueue: /* @__PURE__ */ new Set(),
5532          resumeQueue: /* @__PURE__ */ new Set(),
5533          timeouts: /* @__PURE__ */ new Set()
5534        };
5535        this._events = {
5536          onStart: /* @__PURE__ */ new Map(),
5537          onChange: /* @__PURE__ */ new Map(),
5538          onRest: /* @__PURE__ */ new Map()
5539        };
5540        this._onFrame = this._onFrame.bind(this);
5541        if (flush2) {
5542          this._flush = flush2;
5543        }
5544        if (props) {
5545          this.start(_extends3({
5546            default: true
5547          }, props));
5548        }
5549      }
5550      get idle() {
5551        return !this._state.asyncTo && Object.values(this.springs).every((spring) => {
5552          return spring.idle && !spring.isDelayed && !spring.isPaused;
5553        });
5554      }
5555      get item() {
5556        return this._item;
5557      }
5558      set item(item) {
5559        this._item = item;
5560      }
5561      get() {
5562        const values = {};
5563        this.each((spring, key) => values[key] = spring.get());
5564        return values;
5565      }
5566      set(values) {
5567        for (const key in values) {
5568          const value = values[key];
5569          if (!is.und(value)) {
5570            this.springs[key].set(value);
5571          }
5572        }
5573      }
5574      update(props) {
5575        if (props) {
5576          this.queue.push(createUpdate(props));
5577        }
5578        return this;
5579      }
5580      start(props) {
5581        let {
5582          queue
5583        } = this;
5584        if (props) {
5585          queue = toArray(props).map(createUpdate);
5586        } else {
5587          this.queue = [];
5588        }
5589        if (this._flush) {
5590          return this._flush(this, queue);
5591        }
5592        prepareKeys(this, queue);
5593        return flushUpdateQueue(this, queue);
5594      }
5595      stop(arg, keys) {
5596        if (arg !== !!arg) {
5597          keys = arg;
5598        }
5599        if (keys) {
5600          const springs = this.springs;
5601          each(toArray(keys), (key) => springs[key].stop(!!arg));
5602        } else {
5603          stopAsync(this._state, this._lastAsyncId);
5604          this.each((spring) => spring.stop(!!arg));
5605        }
5606        return this;
5607      }
5608      pause(keys) {
5609        if (is.und(keys)) {
5610          this.start({
5611            pause: true
5612          });
5613        } else {
5614          const springs = this.springs;
5615          each(toArray(keys), (key) => springs[key].pause());
5616        }
5617        return this;
5618      }
5619      resume(keys) {
5620        if (is.und(keys)) {
5621          this.start({
5622            pause: false
5623          });
5624        } else {
5625          const springs = this.springs;
5626          each(toArray(keys), (key) => springs[key].resume());
5627        }
5628        return this;
5629      }
5630      each(iterator) {
5631        eachProp(this.springs, iterator);
5632      }
5633      _onFrame() {
5634        const {
5635          onStart,
5636          onChange,
5637          onRest
5638        } = this._events;
5639        const active = this._active.size > 0;
5640        const changed = this._changed.size > 0;
5641        if (active && !this._started || changed && !this._started) {
5642          this._started = true;
5643          flush(onStart, ([onStart2, result]) => {
5644            result.value = this.get();
5645            onStart2(result, this, this._item);
5646          });
5647        }
5648        const idle = !active && this._started;
5649        const values = changed || idle && onRest.size ? this.get() : null;
5650        if (changed && onChange.size) {
5651          flush(onChange, ([onChange2, result]) => {
5652            result.value = values;
5653            onChange2(result, this, this._item);
5654          });
5655        }
5656        if (idle) {
5657          this._started = false;
5658          flush(onRest, ([onRest2, result]) => {
5659            result.value = values;
5660            onRest2(result, this, this._item);
5661          });
5662        }
5663      }
5664      eventObserved(event) {
5665        if (event.type == "change") {
5666          this._changed.add(event.parent);
5667          if (!event.idle) {
5668            this._active.add(event.parent);
5669          }
5670        } else if (event.type == "idle") {
5671          this._active.delete(event.parent);
5672        } else return;
5673        raf.onFrame(this._onFrame);
5674      }
5675    };
5676    function flushUpdateQueue(ctrl, queue) {
5677      return Promise.all(queue.map((props) => flushUpdate(ctrl, props))).then((results) => getCombinedResult(ctrl, results));
5678    }
5679    async function flushUpdate(ctrl, props, isLoop) {
5680      const {
5681        keys,
5682        to: to2,
5683        from,
5684        loop: loop2,
5685        onRest,
5686        onResolve
5687      } = props;
5688      const defaults2 = is.obj(props.default) && props.default;
5689      if (loop2) {
5690        props.loop = false;
5691      }
5692      if (to2 === false) props.to = null;
5693      if (from === false) props.from = null;
5694      const asyncTo = is.arr(to2) || is.fun(to2) ? to2 : void 0;
5695      if (asyncTo) {
5696        props.to = void 0;
5697        props.onRest = void 0;
5698        if (defaults2) {
5699          defaults2.onRest = void 0;
5700        }
5701      } else {
5702        each(BATCHED_EVENTS, (key) => {
5703          const handler = props[key];
5704          if (is.fun(handler)) {
5705            const queue = ctrl["_events"][key];
5706            props[key] = ({
5707              finished,
5708              cancelled
5709            }) => {
5710              const result2 = queue.get(handler);
5711              if (result2) {
5712                if (!finished) result2.finished = false;
5713                if (cancelled) result2.cancelled = true;
5714              } else {
5715                queue.set(handler, {
5716                  value: null,
5717                  finished: finished || false,
5718                  cancelled: cancelled || false
5719                });
5720              }
5721            };
5722            if (defaults2) {
5723              defaults2[key] = props[key];
5724            }
5725          }
5726        });
5727      }
5728      const state = ctrl["_state"];
5729      if (props.pause === !state.paused) {
5730        state.paused = props.pause;
5731        flushCalls(props.pause ? state.pauseQueue : state.resumeQueue);
5732      } else if (state.paused) {
5733        props.pause = true;
5734      }
5735      const promises = (keys || Object.keys(ctrl.springs)).map((key) => ctrl.springs[key].start(props));
5736      const cancel = props.cancel === true || getDefaultProp(props, "cancel") === true;
5737      if (asyncTo || cancel && state.asyncId) {
5738        promises.push(scheduleProps(++ctrl["_lastAsyncId"], {
5739          props,
5740          state,
5741          actions: {
5742            pause: noop,
5743            resume: noop,
5744            start(props2, resolve) {
5745              if (cancel) {
5746                stopAsync(state, ctrl["_lastAsyncId"]);
5747                resolve(getCancelledResult(ctrl));
5748              } else {
5749                props2.onRest = onRest;
5750                resolve(runAsync(asyncTo, props2, state, ctrl));
5751              }
5752            }
5753          }
5754        }));
5755      }
5756      if (state.paused) {
5757        await new Promise((resume) => {
5758          state.resumeQueue.add(resume);
5759        });
5760      }
5761      const result = getCombinedResult(ctrl, await Promise.all(promises));
5762      if (loop2 && result.finished && !(isLoop && result.noop)) {
5763        const nextProps = createLoopUpdate(props, loop2, to2);
5764        if (nextProps) {
5765          prepareKeys(ctrl, [nextProps]);
5766          return flushUpdate(ctrl, nextProps, true);
5767        }
5768      }
5769      if (onResolve) {
5770        raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item));
5771      }
5772      return result;
5773    }
5774    function createSpring(key, observer) {
5775      const spring = new SpringValue();
5776      spring.key = key;
5777      if (observer) {
5778        addFluidObserver(spring, observer);
5779      }
5780      return spring;
5781    }
5782    function prepareSprings(springs, props, create) {
5783      if (props.keys) {
5784        each(props.keys, (key) => {
5785          const spring = springs[key] || (springs[key] = create(key));
5786          spring["_prepareNode"](props);
5787        });
5788      }
5789    }
5790    function prepareKeys(ctrl, queue) {
5791      each(queue, (props) => {
5792        prepareSprings(ctrl.springs, props, (key) => {
5793          return createSpring(key, ctrl);
5794        });
5795      });
5796    }
5797    function _objectWithoutPropertiesLoose(source, excluded) {
5798      if (source == null) return {};
5799      var target = {};
5800      var sourceKeys = Object.keys(source);
5801      var key, i2;
5802      for (i2 = 0; i2 < sourceKeys.length; i2++) {
5803        key = sourceKeys[i2];
5804        if (excluded.indexOf(key) >= 0) continue;
5805        target[key] = source[key];
5806      }
5807      return target;
5808    }
5809    var _excluded$3 = ["children"];
5810    var SpringContext = (_ref) => {
5811      let {
5812        children
5813      } = _ref, props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
5814      const inherited = (0, import_react6.useContext)(ctx);
5815      const pause = props.pause || !!inherited.pause, immediate = props.immediate || !!inherited.immediate;
5816      props = useMemoOne(() => ({
5817        pause,
5818        immediate
5819      }), [pause, immediate]);
5820      const {
5821        Provider
5822      } = ctx;
5823      return React6.createElement(Provider, {
5824        value: props
5825      }, children);
5826    };
5827    var ctx = makeContext(SpringContext, {});
5828    SpringContext.Provider = ctx.Provider;
5829    SpringContext.Consumer = ctx.Consumer;
5830    function makeContext(target, init2) {
5831      Object.assign(target, React6.createContext(init2));
5832      target.Provider._context = target;
5833      target.Consumer._context = target;
5834      return target;
5835    }
5836    var TransitionPhase;
5837    (function(TransitionPhase2) {
5838      TransitionPhase2["MOUNT"] = "mount";
5839      TransitionPhase2["ENTER"] = "enter";
5840      TransitionPhase2["UPDATE"] = "update";
5841      TransitionPhase2["LEAVE"] = "leave";
5842    })(TransitionPhase || (TransitionPhase = {}));
5843    var Interpolation = class extends FrameValue {
5844      constructor(source, args) {
5845        super();
5846        this.key = void 0;
5847        this.idle = true;
5848        this.calc = void 0;
5849        this._active = /* @__PURE__ */ new Set();
5850        this.source = source;
5851        this.calc = createInterpolator(...args);
5852        const value = this._get();
5853        const nodeType = getAnimatedType(value);
5854        setAnimated(this, nodeType.create(value));
5855      }
5856      advance(_dt) {
5857        const value = this._get();
5858        const oldValue = this.get();
5859        if (!isEqual(value, oldValue)) {
5860          getAnimated(this).setValue(value);
5861          this._onChange(value, this.idle);
5862        }
5863        if (!this.idle && checkIdle(this._active)) {
5864          becomeIdle(this);
5865        }
5866      }
5867      _get() {
5868        const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source));
5869        return this.calc(...inputs);
5870      }
5871      _start() {
5872        if (this.idle && !checkIdle(this._active)) {
5873          this.idle = false;
5874          each(getPayload(this), (node) => {
5875            node.done = false;
5876          });
5877          if (globals.skipAnimation) {
5878            raf.batchedUpdates(() => this.advance());
5879            becomeIdle(this);
5880          } else {
5881            frameLoop.start(this);
5882          }
5883        }
5884      }
5885      _attach() {
5886        let priority2 = 1;
5887        each(toArray(this.source), (source) => {
5888          if (hasFluidValue(source)) {
5889            addFluidObserver(source, this);
5890          }
5891          if (isFrameValue(source)) {
5892            if (!source.idle) {
5893              this._active.add(source);
5894            }
5895            priority2 = Math.max(priority2, source.priority + 1);
5896          }
5897        });
5898        this.priority = priority2;
5899        this._start();
5900      }
5901      _detach() {
5902        each(toArray(this.source), (source) => {
5903          if (hasFluidValue(source)) {
5904            removeFluidObserver(source, this);
5905          }
5906        });
5907        this._active.clear();
5908        becomeIdle(this);
5909      }
5910      eventObserved(event) {
5911        if (event.type == "change") {
5912          if (event.idle) {
5913            this.advance();
5914          } else {
5915            this._active.add(event.parent);
5916            this._start();
5917          }
5918        } else if (event.type == "idle") {
5919          this._active.delete(event.parent);
5920        } else if (event.type == "priority") {
5921          this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
5922        }
5923      }
5924    };
5925    function isIdle(source) {
5926      return source.idle !== false;
5927    }
5928    function checkIdle(active) {
5929      return !active.size || Array.from(active).every(isIdle);
5930    }
5931    function becomeIdle(self2) {
5932      if (!self2.idle) {
5933        self2.idle = true;
5934        each(getPayload(self2), (node) => {
5935          node.done = true;
5936        });
5937        callFluidObservers(self2, {
5938          type: "idle",
5939          parent: self2
5940        });
5941      }
5942    }
5943    globals.assign({
5944      createStringInterpolator,
5945      to: (source, args) => new Interpolation(source, args)
5946    });
5947    var update3 = frameLoop.advance;
5948  
5949    // node_modules/@react-spring/web/dist/react-spring-web.esm.js
5950    var import_react_dom = __toESM(require_react_dom());
5951    function _objectWithoutPropertiesLoose2(source, excluded) {
5952      if (source == null) return {};
5953      var target = {};
5954      var sourceKeys = Object.keys(source);
5955      var key, i2;
5956      for (i2 = 0; i2 < sourceKeys.length; i2++) {
5957        key = sourceKeys[i2];
5958        if (excluded.indexOf(key) >= 0) continue;
5959        target[key] = source[key];
5960      }
5961      return target;
5962    }
5963    var _excluded$2 = ["style", "children", "scrollTop", "scrollLeft"];
5964    var isCustomPropRE = /^--/;
5965    function dangerousStyleValue(name2, value) {
5966      if (value == null || typeof value === "boolean" || value === "") return "";
5967      if (typeof value === "number" && value !== 0 && !isCustomPropRE.test(name2) && !(isUnitlessNumber.hasOwnProperty(name2) && isUnitlessNumber[name2])) return value + "px";
5968      return ("" + value).trim();
5969    }
5970    var attributeCache = {};
5971    function applyAnimatedValues(instance, props) {
5972      if (!instance.nodeType || !instance.setAttribute) {
5973        return false;
5974      }
5975      const isFilterElement = instance.nodeName === "filter" || instance.parentNode && instance.parentNode.nodeName === "filter";
5976      const _ref = props, {
5977        style,
5978        children,
5979        scrollTop,
5980        scrollLeft
5981      } = _ref, attributes = _objectWithoutPropertiesLoose2(_ref, _excluded$2);
5982      const values = Object.values(attributes);
5983      const names = Object.keys(attributes).map((name2) => isFilterElement || instance.hasAttribute(name2) ? name2 : attributeCache[name2] || (attributeCache[name2] = name2.replace(/([A-Z])/g, (n2) => "-" + n2.toLowerCase())));
5984      if (children !== void 0) {
5985        instance.textContent = children;
5986      }
5987      for (let name2 in style) {
5988        if (style.hasOwnProperty(name2)) {
5989          const value = dangerousStyleValue(name2, style[name2]);
5990          if (isCustomPropRE.test(name2)) {
5991            instance.style.setProperty(name2, value);
5992          } else {
5993            instance.style[name2] = value;
5994          }
5995        }
5996      }
5997      names.forEach((name2, i2) => {
5998        instance.setAttribute(name2, values[i2]);
5999      });
6000      if (scrollTop !== void 0) {
6001        instance.scrollTop = scrollTop;
6002      }
6003      if (scrollLeft !== void 0) {
6004        instance.scrollLeft = scrollLeft;
6005      }
6006    }
6007    var isUnitlessNumber = {
6008      animationIterationCount: true,
6009      borderImageOutset: true,
6010      borderImageSlice: true,
6011      borderImageWidth: true,
6012      boxFlex: true,
6013      boxFlexGroup: true,
6014      boxOrdinalGroup: true,
6015      columnCount: true,
6016      columns: true,
6017      flex: true,
6018      flexGrow: true,
6019      flexPositive: true,
6020      flexShrink: true,
6021      flexNegative: true,
6022      flexOrder: true,
6023      gridRow: true,
6024      gridRowEnd: true,
6025      gridRowSpan: true,
6026      gridRowStart: true,
6027      gridColumn: true,
6028      gridColumnEnd: true,
6029      gridColumnSpan: true,
6030      gridColumnStart: true,
6031      fontWeight: true,
6032      lineClamp: true,
6033      lineHeight: true,
6034      opacity: true,
6035      order: true,
6036      orphans: true,
6037      tabSize: true,
6038      widows: true,
6039      zIndex: true,
6040      zoom: true,
6041      fillOpacity: true,
6042      floodOpacity: true,
6043      stopOpacity: true,
6044      strokeDasharray: true,
6045      strokeDashoffset: true,
6046      strokeMiterlimit: true,
6047      strokeOpacity: true,
6048      strokeWidth: true
6049    };
6050    var prefixKey = (prefix2, key) => prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
6051    var prefixes = ["Webkit", "Ms", "Moz", "O"];
6052    isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
6053      prefixes.forEach((prefix2) => acc[prefixKey(prefix2, prop)] = acc[prop]);
6054      return acc;
6055    }, isUnitlessNumber);
6056    var _excluded$1 = ["x", "y", "z"];
6057    var domTransforms = /^(matrix|translate|scale|rotate|skew)/;
6058    var pxTransforms = /^(translate)/;
6059    var degTransforms = /^(rotate|skew)/;
6060    var addUnit = (value, unit) => is.num(value) && value !== 0 ? value + unit : value;
6061    var isValueIdentity = (value, id) => is.arr(value) ? value.every((v2) => isValueIdentity(v2, id)) : is.num(value) ? value === id : parseFloat(value) === id;
6062    var AnimatedStyle = class extends AnimatedObject {
6063      constructor(_ref) {
6064        let {
6065          x: x2,
6066          y: y2,
6067          z
6068        } = _ref, style = _objectWithoutPropertiesLoose2(_ref, _excluded$1);
6069        const inputs = [];
6070        const transforms = [];
6071        if (x2 || y2 || z) {
6072          inputs.push([x2 || 0, y2 || 0, z || 0]);
6073          transforms.push((xyz) => [`translate3d($xyz.map((v2) => addUnit(v2, "px")).join(",")})`, isValueIdentity(xyz, 0)]);
6074        }
6075        eachProp(style, (value, key) => {
6076          if (key === "transform") {
6077            inputs.push([value || ""]);
6078            transforms.push((transform) => [transform, transform === ""]);
6079          } else if (domTransforms.test(key)) {
6080            delete style[key];
6081            if (is.und(value)) return;
6082            const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : "";
6083            inputs.push(toArray(value));
6084            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)]);
6085          }
6086        });
6087        if (inputs.length) {
6088          style.transform = new FluidTransform(inputs, transforms);
6089        }
6090        super(style);
6091      }
6092    };
6093    var FluidTransform = class extends FluidValue {
6094      constructor(inputs, transforms) {
6095        super();
6096        this._value = null;
6097        this.inputs = inputs;
6098        this.transforms = transforms;
6099      }
6100      get() {
6101        return this._value || (this._value = this._get());
6102      }
6103      _get() {
6104        let transform = "";
6105        let identity2 = true;
6106        each(this.inputs, (input, i2) => {
6107          const arg1 = getFluidValue(input[0]);
6108          const [t3, id] = this.transforms[i2](is.arr(arg1) ? arg1 : input.map(getFluidValue));
6109          transform += " " + t3;
6110          identity2 = identity2 && id;
6111        });
6112        return identity2 ? "none" : transform;
6113      }
6114      observerAdded(count) {
6115        if (count == 1) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && addFluidObserver(value, this)));
6116      }
6117      observerRemoved(count) {
6118        if (count == 0) each(this.inputs, (input) => each(input, (value) => hasFluidValue(value) && removeFluidObserver(value, this)));
6119      }
6120      eventObserved(event) {
6121        if (event.type == "change") {
6122          this._value = null;
6123        }
6124        callFluidObservers(this, event);
6125      }
6126    };
6127    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"];
6128    var _excluded = ["scrollTop", "scrollLeft"];
6129    globals.assign({
6130      batchedUpdates: import_react_dom.unstable_batchedUpdates,
6131      createStringInterpolator,
6132      colors
6133    });
6134    var host = createHost(primitives, {
6135      applyAnimatedValues,
6136      createAnimatedStyle: (style) => new AnimatedStyle(style),
6137      getComponentProps: (_ref) => {
6138        let props = _objectWithoutPropertiesLoose2(_ref, _excluded);
6139        return props;
6140      }
6141    });
6142    var animated = host.animated;
6143  
6144    // packages/edit-site/build-module/components/layout/animation.mjs
6145    var import_element11 = __toESM(require_element(), 1);
6146    function getAbsolutePosition(element) {
6147      return {
6148        top: element.offsetTop,
6149        left: element.offsetLeft
6150      };
6151    }
6152    var ANIMATION_DURATION = 400;
6153    function useMovingAnimation({ triggerAnimationOnChange }) {
6154      const ref = (0, import_element11.useRef)();
6155      const { previous, prevRect } = (0, import_element11.useMemo)(
6156        () => ({
6157          previous: ref.current && getAbsolutePosition(ref.current),
6158          prevRect: ref.current && ref.current.getBoundingClientRect()
6159        }),
6160        [triggerAnimationOnChange]
6161      );
6162      (0, import_element11.useLayoutEffect)(() => {
6163        if (!previous || !ref.current) {
6164          return;
6165        }
6166        const disableAnimation = window.matchMedia(
6167          "(prefers-reduced-motion: reduce)"
6168        ).matches;
6169        if (disableAnimation) {
6170          return;
6171        }
6172        const controller = new Controller({
6173          x: 0,
6174          y: 0,
6175          width: prevRect.width,
6176          height: prevRect.height,
6177          config: {
6178            duration: ANIMATION_DURATION,
6179            easing: easings.easeInOutQuint
6180          },
6181          onChange({ value }) {
6182            if (!ref.current) {
6183              return;
6184            }
6185            let { x: x22, y: y22, width: width2, height: height2 } = value;
6186            x22 = Math.round(x22);
6187            y22 = Math.round(y22);
6188            width2 = Math.round(width2);
6189            height2 = Math.round(height2);
6190            const finishedMoving = x22 === 0 && y22 === 0;
6191            ref.current.style.transformOrigin = "center center";
6192            ref.current.style.transform = finishedMoving ? null : `translate3d($x22}px,$y22}px,0)`;
6193            ref.current.style.width = finishedMoving ? null : `$width2}px`;
6194            ref.current.style.height = finishedMoving ? null : `$height2}px`;
6195          }
6196        });
6197        ref.current.style.transform = void 0;
6198        const destination = ref.current.getBoundingClientRect();
6199        const x2 = Math.round(prevRect.left - destination.left);
6200        const y2 = Math.round(prevRect.top - destination.top);
6201        const width = destination.width;
6202        const height = destination.height;
6203        controller.start({
6204          x: 0,
6205          y: 0,
6206          width,
6207          height,
6208          from: { x: x2, y: y2, width: prevRect.width, height: prevRect.height }
6209        });
6210        return () => {
6211          controller.stop();
6212          controller.set({
6213            x: 0,
6214            y: 0,
6215            width: prevRect.width,
6216            height: prevRect.height
6217          });
6218        };
6219      }, [previous, prevRect]);
6220      return ref;
6221    }
6222    var animation_default = useMovingAnimation;
6223  
6224    // packages/edit-site/build-module/components/save-hub/index.mjs
6225    var import_data10 = __toESM(require_data(), 1);
6226    var import_components6 = __toESM(require_components(), 1);
6227    var import_core_data9 = __toESM(require_core_data(), 1);
6228  
6229    // packages/edit-site/build-module/components/save-button/index.mjs
6230    var import_data9 = __toESM(require_data(), 1);
6231    var import_components5 = __toESM(require_components(), 1);
6232    var import_i18n6 = __toESM(require_i18n(), 1);
6233    var import_core_data8 = __toESM(require_core_data(), 1);
6234    var import_keycodes2 = __toESM(require_keycodes(), 1);
6235    var import_router3 = __toESM(require_router(), 1);
6236    var import_editor4 = __toESM(require_editor(), 1);
6237  
6238    // packages/edit-site/build-module/utils/is-previewing-theme.mjs
6239    var import_url3 = __toESM(require_url(), 1);
6240    function isPreviewingTheme() {
6241      return !!(0, import_url3.getQueryArg)(window.location.href, "wp_theme_preview");
6242    }
6243    function currentlyPreviewingTheme() {
6244      if (isPreviewingTheme()) {
6245        return (0, import_url3.getQueryArg)(window.location.href, "wp_theme_preview");
6246      }
6247      return null;
6248    }
6249  
6250    // packages/edit-site/build-module/components/save-button/index.mjs
6251    var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
6252    var { useLocation: useLocation3 } = unlock(import_router3.privateApis);
6253    function SaveButton({
6254      className = "edit-site-save-button__button",
6255      variant = "primary",
6256      showTooltip = true,
6257      showReviewMessage,
6258      icon,
6259      size,
6260      __next40pxDefaultSize = false
6261    }) {
6262      const { params } = useLocation3();
6263      const { setIsSaveViewOpened: setIsSaveViewOpened2 } = (0, import_data9.useDispatch)(store);
6264      const { saveDirtyEntities } = unlock((0, import_data9.useDispatch)(import_editor4.store));
6265      const { dirtyEntityRecords } = (0, import_editor4.useEntitiesSavedStatesIsDirty)();
6266      const { isSaving, isSaveViewOpen, previewingThemeName } = (0, import_data9.useSelect)(
6267        (select3) => {
6268          const { isSavingEntityRecord, isResolving } = select3(import_core_data8.store);
6269          const { isSaveViewOpened: isSaveViewOpened2 } = select3(store);
6270          const isActivatingTheme = isResolving("activateTheme");
6271          const currentlyPreviewingThemeId = currentlyPreviewingTheme();
6272          return {
6273            isSaving: dirtyEntityRecords.some(
6274              (record) => isSavingEntityRecord(
6275                record.kind,
6276                record.name,
6277                record.key
6278              )
6279            ) || isActivatingTheme,
6280            isSaveViewOpen: isSaveViewOpened2(),
6281            // Do not call `getTheme` with null, it will cause a request to
6282            // the server.
6283            previewingThemeName: currentlyPreviewingThemeId ? select3(import_core_data8.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0
6284          };
6285        },
6286        [dirtyEntityRecords]
6287      );
6288      const hasDirtyEntities = !!dirtyEntityRecords.length;
6289      let isOnlyCurrentEntityDirty;
6290      if (dirtyEntityRecords.length === 1) {
6291        if (params.postId) {
6292          isOnlyCurrentEntityDirty = `$dirtyEntityRecords[0].key}` === params.postId && dirtyEntityRecords[0].name === params.postType;
6293        } else if (params.path?.includes("wp_global_styles")) {
6294          isOnlyCurrentEntityDirty = dirtyEntityRecords[0].name === "globalStyles";
6295        }
6296      }
6297      const disabled = isSaving || !hasDirtyEntities && !isPreviewingTheme();
6298      const getLabel = () => {
6299        if (isPreviewingTheme()) {
6300          if (isSaving) {
6301            return (0, import_i18n6.sprintf)(
6302              /* translators: %s: The name of theme to be activated. */
6303              (0, import_i18n6.__)("Activating %s"),
6304              previewingThemeName
6305            );
6306          } else if (disabled) {
6307            return (0, import_i18n6.__)("Saved");
6308          } else if (hasDirtyEntities) {
6309            return (0, import_i18n6.sprintf)(
6310              /* translators: %s: The name of theme to be activated. */
6311              (0, import_i18n6.__)("Activate %s & Save"),
6312              previewingThemeName
6313            );
6314          }
6315          return (0, import_i18n6.sprintf)(
6316            /* translators: %s: The name of theme to be activated. */
6317            (0, import_i18n6.__)("Activate %s"),
6318            previewingThemeName
6319          );
6320        }
6321        if (isSaving) {
6322          return (0, import_i18n6.__)("Saving");
6323        }
6324        if (disabled) {
6325          return (0, import_i18n6.__)("Saved");
6326        }
6327        if (!isOnlyCurrentEntityDirty && showReviewMessage) {
6328          return (0, import_i18n6.sprintf)(
6329            // translators: %d: number of unsaved changes (number).
6330            (0, import_i18n6._n)(
6331              "Review %d change\u2026",
6332              "Review %d changes\u2026",
6333              dirtyEntityRecords.length
6334            ),
6335            dirtyEntityRecords.length
6336          );
6337        }
6338        return (0, import_i18n6.__)("Save");
6339      };
6340      const label = getLabel();
6341      const onClick = isOnlyCurrentEntityDirty ? () => saveDirtyEntities({ dirtyEntityRecords }) : () => setIsSaveViewOpened2(true);
6342      return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
6343        import_components5.Button,
6344        {
6345          variant,
6346          className,
6347          "aria-disabled": disabled,
6348          "aria-expanded": isSaveViewOpen,
6349          isBusy: isSaving,
6350          onClick: disabled ? void 0 : onClick,
6351          label,
6352          shortcut: disabled ? void 0 : import_keycodes2.displayShortcut.primary("s"),
6353          showTooltip,
6354          icon,
6355          __next40pxDefaultSize,
6356          size,
6357          children: label
6358        }
6359      );
6360    }
6361  
6362    // packages/edit-site/build-module/components/save-hub/index.mjs
6363    var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
6364    function SaveHub() {
6365      const { isDisabled, isSaving } = (0, import_data10.useSelect)((select3) => {
6366        const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } = select3(import_core_data9.store);
6367        const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
6368        const _isSaving = dirtyEntityRecords.some(
6369          (record) => isSavingEntityRecord(record.kind, record.name, record.key)
6370        );
6371        return {
6372          isSaving: _isSaving,
6373          isDisabled: _isSaving || !dirtyEntityRecords.length && !isPreviewingTheme()
6374        };
6375      }, []);
6376      return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components6.__experimentalHStack, { className: "edit-site-save-hub", alignment: "right", spacing: 4, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
6377        SaveButton,
6378        {
6379          className: "edit-site-save-hub__button",
6380          variant: isDisabled ? null : "primary",
6381          showTooltip: false,
6382          icon: isDisabled && !isSaving ? check_default : null,
6383          showReviewMessage: true,
6384          __next40pxDefaultSize: true
6385        }
6386      ) });
6387    }
6388  
6389    // packages/edit-site/build-module/components/save-panel/index.mjs
6390    var import_components7 = __toESM(require_components(), 1);
6391    var import_editor5 = __toESM(require_editor(), 1);
6392    var import_data12 = __toESM(require_data(), 1);
6393    var import_i18n7 = __toESM(require_i18n(), 1);
6394    var import_core_data11 = __toESM(require_core_data(), 1);
6395    var import_router5 = __toESM(require_router(), 1);
6396    var import_element13 = __toESM(require_element(), 1);
6397  
6398    // packages/edit-site/build-module/utils/use-activate-theme.mjs
6399    var import_core_data10 = __toESM(require_core_data(), 1);
6400    var import_data11 = __toESM(require_data(), 1);
6401    var import_router4 = __toESM(require_router(), 1);
6402    var import_url4 = __toESM(require_url(), 1);
6403    var { useHistory: useHistory3, useLocation: useLocation4 } = unlock(import_router4.privateApis);
6404    function useActivateTheme() {
6405      const history = useHistory3();
6406      const { path } = useLocation4();
6407      const { startResolution, finishResolution } = (0, import_data11.useDispatch)(import_core_data10.store);
6408      return async () => {
6409        if (isPreviewingTheme()) {
6410          const activationURL = "themes.php?action=activate&stylesheet=" + currentlyPreviewingTheme() + "&_wpnonce=" + window.WP_BLOCK_THEME_ACTIVATE_NONCE;
6411          startResolution("activateTheme");
6412          await window.fetch(activationURL);
6413          finishResolution("activateTheme");
6414          history.navigate((0, import_url4.addQueryArgs)(path, { wp_theme_preview: "" }));
6415        }
6416      };
6417    }
6418  
6419    // packages/edit-site/build-module/utils/use-actual-current-theme.mjs
6420    var import_api_fetch = __toESM(require_api_fetch(), 1);
6421    var import_element12 = __toESM(require_element(), 1);
6422    var import_url5 = __toESM(require_url(), 1);
6423    var ACTIVE_THEMES_URL = "/wp/v2/themes?status=active";
6424    function useActualCurrentTheme() {
6425      const [currentTheme, setCurrentTheme] = (0, import_element12.useState)();
6426      (0, import_element12.useEffect)(() => {
6427        const path = (0, import_url5.addQueryArgs)(ACTIVE_THEMES_URL, {
6428          context: "edit",
6429          wp_theme_preview: ""
6430        });
6431        (0, import_api_fetch.default)({ path }).then((activeThemes) => setCurrentTheme(activeThemes[0])).catch(() => {
6432        });
6433      }, []);
6434      return currentTheme;
6435    }
6436  
6437    // packages/edit-site/build-module/components/save-panel/index.mjs
6438    var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
6439    var { EntitiesSavedStatesExtensible } = unlock(import_editor5.privateApis);
6440    var { useLocation: useLocation5 } = unlock(import_router5.privateApis);
6441    var EntitiesSavedStatesForPreview = ({
6442      onClose,
6443      renderDialog,
6444      variant
6445    }) => {
6446      const isDirtyProps = (0, import_editor5.useEntitiesSavedStatesIsDirty)();
6447      let activateSaveLabel, successNoticeContent;
6448      if (isDirtyProps.isDirty) {
6449        activateSaveLabel = (0, import_i18n7.__)("Activate & Save");
6450        successNoticeContent = (0, import_i18n7.__)("Theme activated and site updated.");
6451      } else {
6452        activateSaveLabel = (0, import_i18n7.__)("Activate");
6453        successNoticeContent = (0, import_i18n7.__)("Theme activated.");
6454      }
6455      const currentTheme = useActualCurrentTheme();
6456      const previewingTheme = (0, import_data12.useSelect)(
6457        (select3) => select3(import_core_data11.store).getCurrentTheme(),
6458        []
6459      );
6460      const additionalPrompt = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("p", { children: (0, import_i18n7.sprintf)(
6461        /* translators: 1: The name of active theme, 2: The name of theme to be activated. */
6462        (0, import_i18n7.__)(
6463          "Saving your changes will change your active theme from %1$s to %2$s."
6464        ),
6465        currentTheme?.name?.rendered ?? "...",
6466        previewingTheme?.name?.rendered ?? "..."
6467      ) });
6468      const activateTheme = useActivateTheme();
6469      const onSave = async (values) => {
6470        await activateTheme();
6471        return values;
6472      };
6473      return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6474        EntitiesSavedStatesExtensible,
6475        {
6476          ...{
6477            ...isDirtyProps,
6478            additionalPrompt,
6479            close: onClose,
6480            onSave,
6481            saveEnabled: true,
6482            saveLabel: activateSaveLabel,
6483            renderDialog,
6484            variant,
6485            successNoticeContent
6486          }
6487        }
6488      );
6489    };
6490    var _EntitiesSavedStates = ({ onClose, renderDialog, variant }) => {
6491      if (isPreviewingTheme()) {
6492        return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6493          EntitiesSavedStatesForPreview,
6494          {
6495            onClose,
6496            renderDialog,
6497            variant
6498          }
6499        );
6500      }
6501      return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6502        import_editor5.EntitiesSavedStates,
6503        {
6504          close: onClose,
6505          renderDialog,
6506          variant
6507        }
6508      );
6509    };
6510    function SavePanel() {
6511      const { query } = useLocation5();
6512      const { canvas = "view" } = query;
6513      const { isSaveViewOpen, isDirty, isSaving } = (0, import_data12.useSelect)((select3) => {
6514        const {
6515          __experimentalGetDirtyEntityRecords,
6516          isSavingEntityRecord,
6517          isResolving
6518        } = select3(import_core_data11.store);
6519        const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
6520        const isActivatingTheme = isResolving("activateTheme");
6521        const { isSaveViewOpened: isSaveViewOpened2 } = unlock(select3(store));
6522        return {
6523          isSaveViewOpen: isSaveViewOpened2(),
6524          isDirty: dirtyEntityRecords.length > 0,
6525          isSaving: dirtyEntityRecords.some(
6526            (record) => isSavingEntityRecord(record.kind, record.name, record.key)
6527          ) || isActivatingTheme
6528        };
6529      }, []);
6530      const { setIsSaveViewOpened: setIsSaveViewOpened2 } = (0, import_data12.useDispatch)(store);
6531      const onClose = () => setIsSaveViewOpened2(false);
6532      (0, import_element13.useEffect)(() => {
6533        setIsSaveViewOpened2(false);
6534      }, [canvas, setIsSaveViewOpened2]);
6535      if (canvas === "view") {
6536        return isSaveViewOpen ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6537          import_components7.Modal,
6538          {
6539            className: "edit-site-save-panel__modal",
6540            onRequestClose: onClose,
6541            title: (0, import_i18n7.__)("Review changes"),
6542            size: "small",
6543            children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(_EntitiesSavedStates, { onClose, variant: "inline" })
6544          }
6545        ) : null;
6546      }
6547      const activateSaveEnabled = isPreviewingTheme() || isDirty;
6548      const disabled = isSaving || !activateSaveEnabled;
6549      return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
6550        navigable_region_default,
6551        {
6552          className: clsx_default("edit-site-layout__actions", {
6553            "is-entity-save-view-open": isSaveViewOpen
6554          }),
6555          ariaLabel: (0, import_i18n7.__)("Save panel"),
6556          children: [
6557            /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6558              "div",
6559              {
6560                className: clsx_default("edit-site-editor__toggle-save-panel", {
6561                  "screen-reader-text": isSaveViewOpen
6562                }),
6563                children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
6564                  import_components7.Button,
6565                  {
6566                    __next40pxDefaultSize: true,
6567                    variant: "secondary",
6568                    className: "edit-site-editor__toggle-save-panel-button",
6569                    onClick: () => setIsSaveViewOpened2(true),
6570                    "aria-haspopup": "dialog",
6571                    disabled,
6572                    accessibleWhenDisabled: true,
6573                    children: (0, import_i18n7.__)("Open save panel")
6574                  }
6575                )
6576              }
6577            ),
6578            isSaveViewOpen && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(_EntitiesSavedStates, { onClose, renderDialog: true })
6579          ]
6580        }
6581      );
6582    }
6583  
6584    // packages/edit-site/build-module/components/layout/index.mjs
6585    var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
6586    var { useLocation: useLocation6 } = unlock(import_router6.privateApis);
6587    var { useStyle } = unlock(import_editor6.privateApis);
6588    var ANIMATION_DURATION2 = 0.3;
6589    function Layout() {
6590      const { query, name: routeKey, areas: areas2, widths } = useLocation6();
6591      const canvas = routeKey === "notfound" ? "view" : query?.canvas ?? "view";
6592      const isMobileViewport = (0, import_compose2.useViewportMatch)("medium", "<");
6593      const toggleRef = (0, import_element14.useRef)();
6594      const navigateRegionsProps = (0, import_components8.__unstableUseNavigateRegions)();
6595      const disableMotion = (0, import_compose2.useReducedMotion)();
6596      const [canvasResizer, canvasSize] = (0, import_compose2.useResizeObserver)();
6597      const isEditorLoading = useIsSiteEditorLoading();
6598      const [isResizableFrameOversized, setIsResizableFrameOversized] = (0, import_element14.useState)(false);
6599      const animationRef = animation_default({
6600        triggerAnimationOnChange: routeKey + "-" + canvas
6601      });
6602      const { showIconLabels } = (0, import_data13.useSelect)((select3) => {
6603        return {
6604          showIconLabels: select3(import_preferences3.store).get(
6605            "core",
6606            "showIconLabels"
6607          )
6608        };
6609      });
6610      const backgroundColor = useStyle("color.background");
6611      const gradientValue = useStyle("color.gradient");
6612      const previousCanvaMode = (0, import_compose2.usePrevious)(canvas);
6613      (0, import_element14.useEffect)(() => {
6614        if (previousCanvaMode === "edit") {
6615          toggleRef.current?.focus();
6616        }
6617      }, [canvas]);
6618      return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
6619        /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_editor6.UnsavedChangesWarning, {}),
6620        canvas === "view" && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SaveKeyboardShortcut, {}),
6621        /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6622          "div",
6623          {
6624            ...navigateRegionsProps,
6625            ref: navigateRegionsProps.ref,
6626            className: clsx_default(
6627              "edit-site-layout",
6628              navigateRegionsProps.className,
6629              {
6630                "is-full-canvas": canvas === "edit",
6631                "show-icon-labels": showIconLabels
6632              }
6633            ),
6634            children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "edit-site-layout__content", children: [
6635              (!isMobileViewport || !areas2.mobile) && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6636                navigable_region_default,
6637                {
6638                  ariaLabel: (0, import_i18n8.__)("Navigation"),
6639                  className: "edit-site-layout__sidebar-region",
6640                  children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components8.__unstableAnimatePresence, { children: canvas === "view" && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
6641                    import_components8.__unstableMotion.div,
6642                    {
6643                      initial: { opacity: 0 },
6644                      animate: { opacity: 1 },
6645                      exit: { opacity: 0 },
6646                      transition: {
6647                        type: "tween",
6648                        duration: (
6649                          // Disable transition in mobile to emulate a full page transition.
6650                          disableMotion || isMobileViewport ? 0 : ANIMATION_DURATION2
6651                        ),
6652                        ease: "easeOut"
6653                      },
6654                      className: "edit-site-layout__sidebar",
6655                      children: [
6656                        /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6657                          site_hub_default,
6658                          {
6659                            ref: toggleRef,
6660                            isTransparent: isResizableFrameOversized
6661                          }
6662                        ),
6663                        /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SidebarNavigationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6664                          SidebarContent,
6665                          {
6666                            shouldAnimate: routeKey !== "styles",
6667                            routeKey,
6668                            children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_editor6.ErrorBoundary, { children: areas2.sidebar })
6669                          }
6670                        ) }),
6671                        /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SaveHub, {}),
6672                        /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SavePanel, {})
6673                      ]
6674                    }
6675                  ) })
6676                }
6677              ),
6678              /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_notices.SnackbarNotices, { className: "edit-site-layout__snackbar" }),
6679              isMobileViewport && areas2.mobile && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "edit-site-layout__mobile", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SidebarNavigationProvider, { children: canvas !== "edit" ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
6680                /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6681                  SiteHubMobile,
6682                  {
6683                    ref: toggleRef,
6684                    isTransparent: isResizableFrameOversized
6685                  }
6686                ),
6687                /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SidebarContent, { routeKey, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_editor6.ErrorBoundary, { children: areas2.mobile }) }),
6688                /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SaveHub, {}),
6689                /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(SavePanel, {})
6690              ] }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_editor6.ErrorBoundary, { children: areas2.mobile }) }) }),
6691              !isMobileViewport && areas2.content && canvas !== "edit" && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6692                "div",
6693                {
6694                  className: "edit-site-layout__area",
6695                  style: {
6696                    maxWidth: widths?.content
6697                  },
6698                  children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_editor6.ErrorBoundary, { children: areas2.content })
6699                }
6700              ),
6701              !isMobileViewport && areas2.edit && canvas !== "edit" && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6702                "div",
6703                {
6704                  className: "edit-site-layout__area",
6705                  style: {
6706                    maxWidth: widths?.edit
6707                  },
6708                  children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_editor6.ErrorBoundary, { children: areas2.edit })
6709                }
6710              ),
6711              !isMobileViewport && areas2.preview && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "edit-site-layout__canvas-container", children: [
6712                canvasResizer,
6713                !!canvasSize.width && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6714                  "div",
6715                  {
6716                    className: clsx_default(
6717                      "edit-site-layout__canvas",
6718                      {
6719                        "is-right-aligned": isResizableFrameOversized
6720                      }
6721                    ),
6722                    ref: animationRef,
6723                    children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_editor6.ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
6724                      resizable_frame_default,
6725                      {
6726                        isReady: !isEditorLoading,
6727                        isFullWidth: canvas === "edit",
6728                        defaultSize: {
6729                          width: canvasSize.width - 24,
6730                          height: canvasSize.height
6731                        },
6732                        isOversized: isResizableFrameOversized,
6733                        setIsOversized: setIsResizableFrameOversized,
6734                        innerContentStyle: {
6735                          background: gradientValue ?? backgroundColor
6736                        },
6737                        children: areas2.preview
6738                      }
6739                    ) })
6740                  }
6741                )
6742              ] })
6743            ] })
6744          }
6745        )
6746      ] });
6747    }
6748    function LayoutWithGlobalStylesProvider(props) {
6749      const { createErrorNotice } = (0, import_data13.useDispatch)(import_notices.store);
6750      function onPluginAreaError(name2) {
6751        createErrorNotice(
6752          (0, import_i18n8.sprintf)(
6753            /* translators: %s: plugin name */
6754            (0, import_i18n8.__)(
6755              'The "%s" plugin has encountered an error and cannot be rendered.'
6756            ),
6757            name2
6758          )
6759        );
6760      }
6761      return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_components8.SlotFillProvider, { children: [
6762        /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_plugins2.PluginArea, { onError: onPluginAreaError }),
6763        /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Layout, { ...props })
6764      ] });
6765    }
6766  
6767    // packages/edit-site/build-module/hooks/commands/use-common-commands.mjs
6768    var import_element15 = __toESM(require_element(), 1);
6769    var import_data14 = __toESM(require_data(), 1);
6770    var import_i18n9 = __toESM(require_i18n(), 1);
6771    var import_commands2 = __toESM(require_commands(), 1);
6772    var import_router7 = __toESM(require_router(), 1);
6773    var import_preferences4 = __toESM(require_preferences(), 1);
6774    var import_core_data12 = __toESM(require_core_data(), 1);
6775    var import_editor7 = __toESM(require_editor(), 1);
6776    var { useHistory: useHistory4, useLocation: useLocation7 } = unlock(import_router7.privateApis);
6777    var { useGlobalStyles } = unlock(import_editor7.privateApis);
6778    var getGlobalStylesToggleWelcomeGuideCommands = () => function useGlobalStylesToggleWelcomeGuideCommands() {
6779      const { openGeneralSidebar: openGeneralSidebar2 } = unlock((0, import_data14.useDispatch)(store));
6780      const { params } = useLocation7();
6781      const { canvas = "view" } = params;
6782      const { set } = (0, import_data14.useDispatch)(import_preferences4.store);
6783      const history = useHistory4();
6784      const isBlockBasedTheme = (0, import_data14.useSelect)((select3) => {
6785        return select3(import_core_data12.store).getCurrentTheme().is_block_theme;
6786      }, []);
6787      const commands = (0, import_element15.useMemo)(() => {
6788        if (!isBlockBasedTheme) {
6789          return [];
6790        }
6791        return [
6792          {
6793            name: "core/edit-site/toggle-styles-welcome-guide",
6794            label: (0, import_i18n9.__)("Learn about styles"),
6795            callback: ({ close }) => {
6796              close();
6797              if (canvas !== "edit") {
6798                history.navigate("/styles?canvas=edit", {
6799                  transition: "canvas-mode-edit-transition"
6800                });
6801              }
6802              openGeneralSidebar2("edit-site/global-styles");
6803              set("core/edit-site", "welcomeGuideStyles", true);
6804              setTimeout(() => {
6805                set("core/edit-site", "welcomeGuideStyles", true);
6806              }, 500);
6807            },
6808            icon: help_default
6809          }
6810        ];
6811      }, [history, openGeneralSidebar2, canvas, isBlockBasedTheme, set]);
6812      return {
6813        isLoading: false,
6814        commands
6815      };
6816    };
6817    var getGlobalStylesResetCommands = () => function useGlobalStylesResetCommands() {
6818      const { user, setUser } = useGlobalStyles();
6819      const canReset = !!user && (Object.keys(user?.styles ?? {}).length > 0 || Object.keys(user?.settings ?? {}).length > 0);
6820      const commands = (0, import_element15.useMemo)(() => {
6821        if (!canReset) {
6822          return [];
6823        }
6824        return [
6825          {
6826            name: "core/edit-site/reset-global-styles",
6827            label: (0, import_i18n9.__)("Reset styles"),
6828            icon: (0, import_i18n9.isRTL)() ? rotate_right_default : rotate_left_default,
6829            callback: ({ close }) => {
6830              close();
6831              setUser({ styles: {}, settings: {} });
6832            }
6833          }
6834        ];
6835      }, [canReset, setUser]);
6836      return {
6837        isLoading: false,
6838        commands
6839      };
6840    };
6841    var getGlobalStylesOpenRevisionsCommands = () => function useGlobalStylesOpenRevisionsCommands() {
6842      const { openGeneralSidebar: openGeneralSidebar2 } = unlock((0, import_data14.useDispatch)(store));
6843      const { setStylesPath } = unlock((0, import_data14.useDispatch)(import_editor7.store));
6844      const { params } = useLocation7();
6845      const { canvas = "view" } = params;
6846      const history = useHistory4();
6847      const hasRevisions = (0, import_data14.useSelect)((select3) => {
6848        const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select3(import_core_data12.store);
6849        const globalStylesId = __experimentalGetCurrentGlobalStylesId();
6850        const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
6851        return !!globalStyles?._links?.["version-history"]?.[0]?.count;
6852      }, []);
6853      const commands = (0, import_element15.useMemo)(() => {
6854        if (!hasRevisions) {
6855          return [];
6856        }
6857        return [
6858          {
6859            name: "core/edit-site/open-styles-revisions",
6860            label: (0, import_i18n9.__)("Open style revisions"),
6861            icon: backup_default,
6862            callback: ({ close }) => {
6863              close();
6864              if (canvas !== "edit") {
6865                history.navigate("/styles?canvas=edit", {
6866                  transition: "canvas-mode-edit-transition"
6867                });
6868              }
6869              openGeneralSidebar2("edit-site/global-styles");
6870              setStylesPath("/revisions");
6871            }
6872          }
6873        ];
6874      }, [
6875        history,
6876        openGeneralSidebar2,
6877        setStylesPath,
6878        hasRevisions,
6879        canvas
6880      ]);
6881      return {
6882        isLoading: false,
6883        commands
6884      };
6885    };
6886    function useCommonCommands() {
6887      (0, import_commands2.useCommandLoader)({
6888        name: "core/edit-site/toggle-styles-welcome-guide",
6889        hook: getGlobalStylesToggleWelcomeGuideCommands()
6890      });
6891      (0, import_commands2.useCommandLoader)({
6892        name: "core/edit-site/reset-global-styles",
6893        hook: getGlobalStylesResetCommands()
6894      });
6895      (0, import_commands2.useCommandLoader)({
6896        name: "core/edit-site/open-styles-revisions",
6897        hook: getGlobalStylesOpenRevisionsCommands()
6898      });
6899    }
6900  
6901    // packages/edit-site/build-module/hooks/commands/use-set-command-context.mjs
6902    var import_data15 = __toESM(require_data(), 1);
6903    var import_commands3 = __toESM(require_commands(), 1);
6904    var import_block_editor3 = __toESM(require_block_editor(), 1);
6905    var import_router8 = __toESM(require_router(), 1);
6906    var { useCommandContext } = unlock(import_commands3.privateApis);
6907    var { useLocation: useLocation8 } = unlock(import_router8.privateApis);
6908    function useSetCommandContext() {
6909      const { query = {} } = useLocation8();
6910      const { canvas = "view" } = query;
6911      const hasBlockSelected = (0, import_data15.useSelect)((select3) => {
6912        return select3(import_block_editor3.store).getBlockSelectionStart();
6913      }, []);
6914      let commandContext = "site-editor";
6915      if (canvas === "edit") {
6916        commandContext = "entity-edit";
6917      }
6918      if (hasBlockSelected) {
6919        commandContext = "block-selection-edit";
6920      }
6921      useCommandContext(commandContext);
6922    }
6923  
6924    // packages/edit-site/build-module/components/site-editor-routes/index.mjs
6925    var import_data82 = __toESM(require_data(), 1);
6926    var import_element160 = __toESM(require_element(), 1);
6927  
6928    // packages/edit-site/build-module/components/sidebar-navigation-screen-main/index.mjs
6929    var import_components73 = __toESM(require_components(), 1);
6930    var import_i18n59 = __toESM(require_i18n(), 1);
6931    var import_data31 = __toESM(require_data(), 1);
6932    var import_core_data25 = __toESM(require_core_data(), 1);
6933  
6934    // packages/edit-site/build-module/components/sidebar-navigation-screen/index.mjs
6935    var import_components10 = __toESM(require_components(), 1);
6936    var import_i18n10 = __toESM(require_i18n(), 1);
6937    var import_core_data13 = __toESM(require_core_data(), 1);
6938    var import_data16 = __toESM(require_data(), 1);
6939    var import_router9 = __toESM(require_router(), 1);
6940    var import_element16 = __toESM(require_element(), 1);
6941  
6942    // packages/edit-site/build-module/components/sidebar-button/index.mjs
6943    var import_components9 = __toESM(require_components(), 1);
6944    var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
6945    function SidebarButton(props) {
6946      return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
6947        import_components9.Button,
6948        {
6949          size: "compact",
6950          ...props,
6951          className: clsx_default("edit-site-sidebar-button", props.className)
6952        }
6953      );
6954    }
6955  
6956    // packages/edit-site/build-module/components/sidebar-navigation-screen/index.mjs
6957    var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
6958    var { useHistory: useHistory5, useLocation: useLocation9 } = unlock(import_router9.privateApis);
6959    function SidebarNavigationScreen({
6960      isRoot,
6961      title,
6962      actions,
6963      content,
6964      footer,
6965      description,
6966      backPath: backPathProp
6967    }) {
6968      const { dashboardLink, dashboardLinkText, previewingThemeName } = (0, import_data16.useSelect)(
6969        (select3) => {
6970          const { getSettings: getSettings7 } = unlock(select3(store));
6971          const currentlyPreviewingThemeId = currentlyPreviewingTheme();
6972          return {
6973            dashboardLink: getSettings7().__experimentalDashboardLink,
6974            dashboardLinkText: getSettings7().__experimentalDashboardLinkText,
6975            // Do not call `getTheme` with null, it will cause a request to
6976            // the server.
6977            previewingThemeName: currentlyPreviewingThemeId ? select3(import_core_data13.store).getTheme(currentlyPreviewingThemeId)?.name?.rendered : void 0
6978          };
6979        },
6980        []
6981      );
6982      const location = useLocation9();
6983      const history = useHistory5();
6984      const { navigate } = (0, import_element16.useContext)(SidebarNavigationContext);
6985      const backPath = backPathProp ?? location.state?.backPath;
6986      const icon = (0, import_i18n10.isRTL)() ? chevron_right_default : chevron_left_default;
6987      return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
6988        /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
6989          import_components10.__experimentalVStack,
6990          {
6991            className: clsx_default("edit-site-sidebar-navigation-screen__main", {
6992              "has-footer": !!footer
6993            }),
6994            spacing: 0,
6995            justify: "flex-start",
6996            children: [
6997              /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
6998                import_components10.__experimentalHStack,
6999                {
7000                  spacing: 3,
7001                  alignment: "flex-start",
7002                  className: "edit-site-sidebar-navigation-screen__title-icon",
7003                  children: [
7004                    !isRoot && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
7005                      SidebarButton,
7006                      {
7007                        onClick: () => {
7008                          history.navigate(backPath);
7009                          navigate("back");
7010                        },
7011                        icon,
7012                        label: (0, import_i18n10.__)("Back"),
7013                        showTooltip: false
7014                      }
7015                    ),
7016                    isRoot && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
7017                      SidebarButton,
7018                      {
7019                        icon,
7020                        label: dashboardLinkText || (0, import_i18n10.__)("Go to the Dashboard"),
7021                        href: dashboardLink
7022                      }
7023                    ),
7024                    /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
7025                      import_components10.__experimentalHeading,
7026                      {
7027                        className: "edit-site-sidebar-navigation-screen__title",
7028                        color: "#e0e0e0",
7029                        level: 1,
7030                        size: 20,
7031                        children: !isPreviewingTheme() ? title : (0, import_i18n10.sprintf)(
7032                          /* translators: 1: theme name. 2: title */
7033                          (0, import_i18n10.__)("Previewing %1$s: %2$s"),
7034                          previewingThemeName,
7035                          title
7036                        )
7037                      }
7038                    ),
7039                    actions && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "edit-site-sidebar-navigation-screen__actions", children: actions })
7040                  ]
7041                }
7042              ),
7043              /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "edit-site-sidebar-navigation-screen__content", children: [
7044                description && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "edit-site-sidebar-navigation-screen__description", children: description }),
7045                content
7046              ] })
7047            ]
7048          }
7049        ),
7050        footer && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("footer", { className: "edit-site-sidebar-navigation-screen__footer", children: footer })
7051      ] });
7052    }
7053  
7054    // packages/edit-site/build-module/components/sidebar-navigation-item/index.mjs
7055    var import_components11 = __toESM(require_components(), 1);
7056    var import_i18n11 = __toESM(require_i18n(), 1);
7057    var import_router10 = __toESM(require_router(), 1);
7058    var import_element17 = __toESM(require_element(), 1);
7059    var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
7060    var { useHistory: useHistory6, useLink } = unlock(import_router10.privateApis);
7061    function SidebarNavigationItem({
7062      className,
7063      icon,
7064      withChevron = false,
7065      suffix,
7066      uid,
7067      to: to2,
7068      onClick,
7069      children,
7070      ...props
7071    }) {
7072      const history = useHistory6();
7073      const { navigate } = (0, import_element17.useContext)(SidebarNavigationContext);
7074      function handleClick(e2) {
7075        if (onClick) {
7076          onClick(e2);
7077          navigate("forward");
7078        } else if (to2) {
7079          e2.preventDefault();
7080          history.navigate(to2);
7081          navigate("forward", `[id="$uid}"]`);
7082        }
7083      }
7084      const linkProps = useLink(to2);
7085      return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
7086        import_components11.__experimentalItem,
7087        {
7088          className: clsx_default(
7089            "edit-site-sidebar-navigation-item",
7090            { "with-suffix": !withChevron && suffix },
7091            className
7092          ),
7093          id: uid,
7094          onClick: handleClick,
7095          href: to2 ? linkProps.href : void 0,
7096          ...props,
7097          children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_components11.__experimentalHStack, { justify: "flex-start", children: [
7098            icon && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
7099              icon_default,
7100              {
7101                style: { fill: "currentcolor" },
7102                icon,
7103                size: 24
7104              }
7105            ),
7106            /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components11.FlexBlock, { children }),
7107            withChevron && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
7108              icon_default,
7109              {
7110                icon: (0, import_i18n11.isRTL)() ? chevron_left_small_default : chevron_right_small_default,
7111                className: "edit-site-sidebar-navigation-item__drilldown-indicator",
7112                size: 24
7113              }
7114            ),
7115            !withChevron && suffix
7116          ] })
7117        }
7118      );
7119    }
7120  
7121    // packages/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.mjs
7122    var import_i18n58 = __toESM(require_i18n(), 1);
7123    var import_data30 = __toESM(require_data(), 1);
7124    var import_element49 = __toESM(require_element(), 1);
7125    var import_preferences5 = __toESM(require_preferences(), 1);
7126    var import_editor8 = __toESM(require_editor(), 1);
7127    var import_router11 = __toESM(require_router(), 1);
7128    var import_url7 = __toESM(require_url(), 1);
7129  
7130    // packages/global-styles-ui/build-module/global-styles-ui.mjs
7131    var import_components71 = __toESM(require_components(), 1);
7132    var import_blocks8 = __toESM(require_blocks(), 1);
7133    var import_data29 = __toESM(require_data(), 1);
7134    var import_block_editor16 = __toESM(require_block_editor(), 1);
7135    var import_element48 = __toESM(require_element(), 1);
7136    var import_compose8 = __toESM(require_compose(), 1);
7137  
7138    // packages/global-styles-engine/build-module/utils/object.mjs
7139    function setImmutably(object, path, value) {
7140      path = Array.isArray(path) ? [...path] : [path];
7141      object = Array.isArray(object) ? [...object] : { ...object };
7142      const leaf = path.pop();
7143      let prev = object;
7144      for (const key of path) {
7145        const lvl = prev[key];
7146        prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl };
7147      }
7148      prev[leaf] = value;
7149      return object;
7150    }
7151    var getValueFromObjectPath = (object, path, defaultValue2) => {
7152      const arrayPath = Array.isArray(path) ? path : path.split(".");
7153      let value = object;
7154      arrayPath.forEach((fieldName) => {
7155        value = value?.[fieldName];
7156      });
7157      return value ?? defaultValue2;
7158    };
7159  
7160    // packages/global-styles-engine/build-module/settings/get-setting.mjs
7161    var VALID_SETTINGS = [
7162      "appearanceTools",
7163      "useRootPaddingAwareAlignments",
7164      "background.backgroundImage",
7165      "background.backgroundRepeat",
7166      "background.backgroundSize",
7167      "background.backgroundPosition",
7168      "border.color",
7169      "border.radius",
7170      "border.radiusSizes",
7171      "border.style",
7172      "border.width",
7173      "shadow.presets",
7174      "shadow.defaultPresets",
7175      "color.background",
7176      "color.button",
7177      "color.caption",
7178      "color.custom",
7179      "color.customDuotone",
7180      "color.customGradient",
7181      "color.defaultDuotone",
7182      "color.defaultGradients",
7183      "color.defaultPalette",
7184      "color.duotone",
7185      "color.gradients",
7186      "color.heading",
7187      "color.link",
7188      "color.palette",
7189      "color.text",
7190      "custom",
7191      "dimensions.aspectRatio",
7192      "dimensions.height",
7193      "dimensions.minHeight",
7194      "dimensions.width",
7195      "dimensions.dimensionSizes",
7196      "layout.contentSize",
7197      "layout.definitions",
7198      "layout.wideSize",
7199      "lightbox.enabled",
7200      "lightbox.allowEditing",
7201      "position.fixed",
7202      "position.sticky",
7203      "spacing.customSpacingSize",
7204      "spacing.defaultSpacingSizes",
7205      "spacing.spacingSizes",
7206      "spacing.spacingScale",
7207      "spacing.blockGap",
7208      "spacing.margin",
7209      "spacing.padding",
7210      "spacing.units",
7211      "typography.fluid",
7212      "typography.customFontSize",
7213      "typography.defaultFontSizes",
7214      "typography.dropCap",
7215      "typography.fontFamilies",
7216      "typography.fontSizes",
7217      "typography.fontStyle",
7218      "typography.fontWeight",
7219      "typography.letterSpacing",
7220      "typography.lineHeight",
7221      "typography.textAlign",
7222      "typography.textColumns",
7223      "typography.textDecoration",
7224      "typography.textIndent",
7225      "typography.textTransform",
7226      "typography.writingMode"
7227    ];
7228    function getSetting(globalStyles, path, blockName) {
7229      const appendedBlockPath = blockName ? ".blocks." + blockName : "";
7230      const appendedPropertyPath = path ? "." + path : "";
7231      const contextualPath = `settings$appendedBlockPath}$appendedPropertyPath}`;
7232      const globalPath = `settings$appendedPropertyPath}`;
7233      if (path) {
7234        return getValueFromObjectPath(globalStyles, contextualPath) ?? getValueFromObjectPath(globalStyles, globalPath);
7235      }
7236      let result = {};
7237      VALID_SETTINGS.forEach((setting) => {
7238        const value = getValueFromObjectPath(
7239          globalStyles,
7240          `settings$appendedBlockPath}.$setting}`
7241        ) ?? getValueFromObjectPath(globalStyles, `settings.$setting}`);
7242        if (value !== void 0) {
7243          result = setImmutably(result, setting.split("."), value);
7244        }
7245      });
7246      return result;
7247    }
7248  
7249    // packages/global-styles-engine/build-module/settings/set-setting.mjs
7250    function setSetting(globalStyles, path, newValue, blockName) {
7251      const appendedBlockPath = blockName ? ".blocks." + blockName : "";
7252      const appendedPropertyPath = path ? "." + path : "";
7253      const finalPath = `settings$appendedBlockPath}$appendedPropertyPath}`;
7254      return setImmutably(
7255        globalStyles,
7256        finalPath.split("."),
7257        newValue
7258      );
7259    }
7260  
7261    // packages/global-styles-engine/build-module/utils/common.mjs
7262    var import_style_engine = __toESM(require_style_engine(), 1);
7263  
7264    // packages/global-styles-engine/build-module/utils/fluid.mjs
7265    var DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px";
7266    var DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px";
7267    var DEFAULT_SCALE_FACTOR = 1;
7268    var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25;
7269    var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75;
7270    var DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px";
7271    function getComputedFluidTypographyValue({
7272      minimumFontSize,
7273      maximumFontSize,
7274      fontSize,
7275      minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH,
7276      maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH,
7277      scaleFactor = DEFAULT_SCALE_FACTOR,
7278      minimumFontSizeLimit
7279    }) {
7280      minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT;
7281      if (fontSize) {
7282        const fontSizeParsed = getTypographyValueAndUnit(fontSize);
7283        if (!fontSizeParsed?.unit || !fontSizeParsed?.value) {
7284          return null;
7285        }
7286        const minimumFontSizeLimitParsed = getTypographyValueAndUnit(
7287          minimumFontSizeLimit,
7288          {
7289            coerceTo: fontSizeParsed.unit
7290          }
7291        );
7292        if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) {
7293          if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) {
7294            return null;
7295          }
7296        }
7297        if (!maximumFontSize) {
7298          maximumFontSize = `$fontSizeParsed.value}$fontSizeParsed.unit}`;
7299        }
7300        if (!minimumFontSize) {
7301          const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16;
7302          const minimumFontSizeFactor = Math.min(
7303            Math.max(
7304              1 - 0.075 * Math.log2(fontSizeValueInPx),
7305              DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN
7306            ),
7307            DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX
7308          );
7309          const calculatedMinimumFontSize = roundToPrecision(
7310            fontSizeParsed.value * minimumFontSizeFactor,
7311            3
7312          );
7313          if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) {
7314            minimumFontSize = `$minimumFontSizeLimitParsed.value}$minimumFontSizeLimitParsed.unit}`;
7315          } else {
7316            minimumFontSize = `$calculatedMinimumFontSize}$fontSizeParsed.unit}`;
7317          }
7318        }
7319      }
7320      const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize);
7321      const fontSizeUnit = minimumFontSizeParsed?.unit || "rem";
7322      const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, {
7323        coerceTo: fontSizeUnit
7324      });
7325      if (!minimumFontSizeParsed || !maximumFontSizeParsed) {
7326        return null;
7327      }
7328      const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, {
7329        coerceTo: "rem"
7330      });
7331      const maximumViewportWidthParsed = getTypographyValueAndUnit(
7332        maximumViewportWidth,
7333        { coerceTo: fontSizeUnit }
7334      );
7335      const minimumViewportWidthParsed = getTypographyValueAndUnit(
7336        minimumViewportWidth,
7337        { coerceTo: fontSizeUnit }
7338      );
7339      if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) {
7340        return null;
7341      }
7342      const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value;
7343      if (!linearDenominator) {
7344        return null;
7345      }
7346      const minViewportWidthOffsetValue = roundToPrecision(
7347        minimumViewportWidthParsed.value / 100,
7348        3
7349      );
7350      const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit;
7351      const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator);
7352      const linearFactorScaled = roundToPrecision(
7353        (linearFactor || 1) * scaleFactor,
7354        3
7355      );
7356      const fluidTargetFontSize = `$minimumFontSizeRem.value}$minimumFontSizeRem.unit} + ((1vw - $viewportWidthOffset}) * $linearFactorScaled})`;
7357      return `clamp($minimumFontSize}, $fluidTargetFontSize}, $maximumFontSize})`;
7358    }
7359    function getTypographyValueAndUnit(rawValue, options = {}) {
7360      if (typeof rawValue !== "string" && typeof rawValue !== "number") {
7361        return null;
7362      }
7363      if (isFinite(rawValue)) {
7364        rawValue = `$rawValue}px`;
7365      }
7366      const { coerceTo, rootSizeValue, acceptableUnits } = {
7367        coerceTo: "",
7368        // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`.
7369        rootSizeValue: 16,
7370        acceptableUnits: ["rem", "px", "em"],
7371        ...options
7372      };
7373      const acceptableUnitsGroup = acceptableUnits?.join("|");
7374      const regexUnits = new RegExp(
7375        `^(\\d*\\.?\\d+)($acceptableUnitsGroup}){1,1}$`
7376      );
7377      const matches = rawValue.toString().match(regexUnits);
7378      if (!matches || matches.length < 3) {
7379        return null;
7380      }
7381      let [, value, unit] = matches;
7382      let returnValue = parseFloat(value);
7383      if ("px" === coerceTo && ("em" === unit || "rem" === unit)) {
7384        returnValue = returnValue * rootSizeValue;
7385        unit = coerceTo;
7386      }
7387      if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) {
7388        returnValue = returnValue / rootSizeValue;
7389        unit = coerceTo;
7390      }
7391      if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) {
7392        unit = coerceTo;
7393      }
7394      if (!unit) {
7395        return null;
7396      }
7397      return {
7398        value: roundToPrecision(returnValue, 3),
7399        unit
7400      };
7401    }
7402    function roundToPrecision(value, digits = 3) {
7403      const base = Math.pow(10, digits);
7404      return Math.round(value * base) / base;
7405    }
7406  
7407    // packages/global-styles-engine/build-module/utils/typography.mjs
7408    function isFluidTypographyEnabled(typographySettings) {
7409      const fluidSettings = typographySettings?.fluid;
7410      return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0;
7411    }
7412    function getFluidTypographyOptionsFromSettings(settings2) {
7413      const typographySettings = settings2?.typography ?? {};
7414      const layoutSettings = settings2?.layout;
7415      const defaultMaxViewportWidth = getTypographyValueAndUnit(
7416        layoutSettings?.wideSize
7417      ) ? layoutSettings?.wideSize : null;
7418      return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? {
7419        fluid: {
7420          maxViewportWidth: defaultMaxViewportWidth,
7421          ...typeof typographySettings.fluid === "object" ? typographySettings.fluid : {}
7422        }
7423      } : {
7424        fluid: typographySettings?.fluid
7425      };
7426    }
7427    function getTypographyFontSizeValue(preset, settings2) {
7428      const { size: defaultSize } = preset;
7429      if (!defaultSize || "0" === defaultSize || false === preset?.fluid) {
7430        return defaultSize;
7431      }
7432      if (!isFluidTypographyEnabled(settings2?.typography) && !isFluidTypographyEnabled(preset)) {
7433        return defaultSize;
7434      }
7435      const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings2)?.fluid ?? {};
7436      const fluidFontSizeValue = getComputedFluidTypographyValue({
7437        minimumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.min,
7438        maximumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.max,
7439        fontSize: defaultSize,
7440        minimumFontSizeLimit: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minFontSize : void 0,
7441        maximumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.maxViewportWidth : void 0,
7442        minimumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minViewportWidth : void 0
7443      });
7444      if (!!fluidFontSizeValue) {
7445        return fluidFontSizeValue;
7446      }
7447      return defaultSize;
7448    }
7449  
7450    // packages/global-styles-engine/build-module/utils/common.mjs
7451    var ROOT_BLOCK_SELECTOR = "body";
7452    var ROOT_CSS_PROPERTIES_SELECTOR = ":root";
7453    var PRESET_METADATA = [
7454      {
7455        path: ["color", "palette"],
7456        valueKey: "color",
7457        cssVarInfix: "color",
7458        classes: [
7459          { classSuffix: "color", propertyName: "color" },
7460          {
7461            classSuffix: "background-color",
7462            propertyName: "background-color"
7463          },
7464          {
7465            classSuffix: "border-color",
7466            propertyName: "border-color"
7467          }
7468        ]
7469      },
7470      {
7471        path: ["color", "gradients"],
7472        valueKey: "gradient",
7473        cssVarInfix: "gradient",
7474        classes: [
7475          {
7476            classSuffix: "gradient-background",
7477            propertyName: "background"
7478          }
7479        ]
7480      },
7481      {
7482        path: ["color", "duotone"],
7483        valueKey: "colors",
7484        cssVarInfix: "duotone",
7485        valueFunc: ({ slug }) => `url( '#wp-duotone-$slug}' )`,
7486        classes: []
7487      },
7488      {
7489        path: ["shadow", "presets"],
7490        valueKey: "shadow",
7491        cssVarInfix: "shadow",
7492        classes: []
7493      },
7494      {
7495        path: ["typography", "fontSizes"],
7496        valueFunc: (preset, settings2) => getTypographyFontSizeValue(preset, settings2),
7497        valueKey: "size",
7498        cssVarInfix: "font-size",
7499        classes: [{ classSuffix: "font-size", propertyName: "font-size" }]
7500      },
7501      {
7502        path: ["typography", "fontFamilies"],
7503        valueKey: "fontFamily",
7504        cssVarInfix: "font-family",
7505        classes: [
7506          { classSuffix: "font-family", propertyName: "font-family" }
7507        ]
7508      },
7509      {
7510        path: ["spacing", "spacingSizes"],
7511        valueKey: "size",
7512        cssVarInfix: "spacing",
7513        valueFunc: ({ size }) => size,
7514        classes: []
7515      },
7516      {
7517        path: ["border", "radiusSizes"],
7518        valueKey: "size",
7519        cssVarInfix: "border-radius",
7520        classes: []
7521      },
7522      {
7523        path: ["dimensions", "dimensionSizes"],
7524        valueKey: "size",
7525        cssVarInfix: "dimension",
7526        classes: []
7527      }
7528    ];
7529    function scopeSelector(scope, selector2) {
7530      if (!scope || !selector2) {
7531        return selector2;
7532      }
7533      const scopes = scope.split(",");
7534      const selectors = selector2.split(",");
7535      const selectorsScoped = [];
7536      scopes.forEach((outer) => {
7537        selectors.forEach((inner) => {
7538          selectorsScoped.push(`$outer.trim()} $inner.trim()}`);
7539        });
7540      });
7541      return selectorsScoped.join(", ");
7542    }
7543    function scopeFeatureSelectors(scope, selectors) {
7544      if (!scope || !selectors) {
7545        return;
7546      }
7547      const featureSelectors = {};
7548      Object.entries(selectors).forEach(([feature, selector2]) => {
7549        if (typeof selector2 === "string") {
7550          featureSelectors[feature] = scopeSelector(scope, selector2);
7551        }
7552        if (typeof selector2 === "object") {
7553          featureSelectors[feature] = {};
7554          Object.entries(selector2).forEach(
7555            ([subfeature, subfeatureSelector]) => {
7556              featureSelectors[feature][subfeature] = scopeSelector(
7557                scope,
7558                subfeatureSelector
7559              );
7560            }
7561          );
7562        }
7563      });
7564      return featureSelectors;
7565    }
7566    function appendToSelector(selector2, toAppend) {
7567      if (!selector2.includes(",")) {
7568        return selector2 + toAppend;
7569      }
7570      const selectors = selector2.split(",");
7571      const newSelectors = selectors.map((sel) => sel + toAppend);
7572      return newSelectors.join(",");
7573    }
7574    function getBlockStyleVariationSelector(variation, blockSelector) {
7575      const variationClass = `.is-style-$variation}`;
7576      if (!blockSelector) {
7577        return variationClass;
7578      }
7579      const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/;
7580      const addVariationClass = (_match, group1, group2) => {
7581        return group1 + group2 + variationClass;
7582      };
7583      const result = blockSelector.split(",").map((part) => part.replace(ancestorRegex, addVariationClass));
7584      return result.join(",");
7585    }
7586    function getResolvedRefValue(ruleValue, tree) {
7587      if (!ruleValue || !tree) {
7588        return ruleValue;
7589      }
7590      if (typeof ruleValue === "object" && "ref" in ruleValue && ruleValue?.ref) {
7591        const resolvedRuleValue = (0, import_style_engine.getCSSValueFromRawStyle)(
7592          getValueFromObjectPath(tree, ruleValue.ref)
7593        );
7594        if (typeof resolvedRuleValue === "object" && resolvedRuleValue !== null && "ref" in resolvedRuleValue && resolvedRuleValue?.ref) {
7595          return void 0;
7596        }
7597        if (resolvedRuleValue === void 0) {
7598          return ruleValue;
7599        }
7600        return resolvedRuleValue;
7601      }
7602      return ruleValue;
7603    }
7604    function getResolvedThemeFilePath(file, themeFileURIs) {
7605      if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) {
7606        return file;
7607      }
7608      const uri = themeFileURIs.find(
7609        (themeFileUri) => themeFileUri?.name === file
7610      );
7611      if (!uri?.href) {
7612        return file;
7613      }
7614      return uri?.href;
7615    }
7616    function getResolvedValue(ruleValue, tree) {
7617      if (!ruleValue || !tree) {
7618        return ruleValue;
7619      }
7620      const resolvedValue = getResolvedRefValue(ruleValue, tree);
7621      if (typeof resolvedValue === "object" && resolvedValue !== null && "url" in resolvedValue && resolvedValue?.url) {
7622        resolvedValue.url = getResolvedThemeFilePath(
7623          resolvedValue.url,
7624          tree?._links?.["wp:theme-file"]
7625        );
7626      }
7627      return resolvedValue;
7628    }
7629    function findInPresetsBy(settings2, blockName, presetPath = [], presetProperty = "slug", presetValueValue) {
7630      const orderedPresetsByOrigin = [
7631        blockName ? getValueFromObjectPath(settings2, [
7632          "blocks",
7633          blockName,
7634          ...presetPath
7635        ]) : void 0,
7636        getValueFromObjectPath(settings2, presetPath)
7637      ].filter(Boolean);
7638      for (const presetByOrigin of orderedPresetsByOrigin) {
7639        if (presetByOrigin) {
7640          const origins = ["custom", "theme", "default"];
7641          for (const origin of origins) {
7642            const presets = presetByOrigin[origin];
7643            if (presets) {
7644              const presetObject = presets.find(
7645                (preset) => preset[presetProperty] === presetValueValue
7646              );
7647              if (presetObject) {
7648                if (presetProperty === "slug") {
7649                  return presetObject;
7650                }
7651                const highestPresetObjectWithSameSlug = findInPresetsBy(
7652                  settings2,
7653                  blockName,
7654                  presetPath,
7655                  "slug",
7656                  presetObject.slug
7657                );
7658                if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) {
7659                  return presetObject;
7660                }
7661                return void 0;
7662              }
7663            }
7664          }
7665        }
7666      }
7667    }
7668    function getValueFromPresetVariable(features, blockName, variable, [presetType, slug] = []) {
7669      const metadata = PRESET_METADATA.find(
7670        (data) => data.cssVarInfix === presetType
7671      );
7672      if (!metadata || !features.settings) {
7673        return variable;
7674      }
7675      const presetObject = findInPresetsBy(
7676        features.settings,
7677        blockName,
7678        metadata.path,
7679        "slug",
7680        slug
7681      );
7682      if (presetObject) {
7683        const { valueKey } = metadata;
7684        const result = presetObject[valueKey];
7685        return getValueFromVariable(features, blockName, result);
7686      }
7687      return variable;
7688    }
7689    function getValueFromCustomVariable(features, blockName, variable, path = []) {
7690      const result = (blockName ? getValueFromObjectPath(features?.settings ?? {}, [
7691        "blocks",
7692        blockName,
7693        "custom",
7694        ...path
7695      ]) : void 0) ?? getValueFromObjectPath(features?.settings ?? {}, [
7696        "custom",
7697        ...path
7698      ]);
7699      if (!result) {
7700        return variable;
7701      }
7702      return getValueFromVariable(features, blockName, result);
7703    }
7704    function getValueFromVariable(features, blockName, variable) {
7705      if (!variable || typeof variable !== "string") {
7706        if (typeof variable === "object" && variable !== null && "ref" in variable && typeof variable.ref === "string") {
7707          const resolvedVariable = getValueFromObjectPath(
7708            features,
7709            variable.ref
7710          );
7711          if (!resolvedVariable || typeof resolvedVariable === "object" && "ref" in resolvedVariable) {
7712            return resolvedVariable;
7713          }
7714          variable = resolvedVariable;
7715        } else {
7716          return variable;
7717        }
7718      }
7719      const USER_VALUE_PREFIX = "var:";
7720      const THEME_VALUE_PREFIX = "var(--wp--";
7721      const THEME_VALUE_SUFFIX = ")";
7722      let parsedVar;
7723      if (variable.startsWith(USER_VALUE_PREFIX)) {
7724        parsedVar = variable.slice(USER_VALUE_PREFIX.length).split("|");
7725      } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) {
7726        parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split("--");
7727      } else {
7728        return variable;
7729      }
7730      const [type, ...path] = parsedVar;
7731      if (type === "preset") {
7732        return getValueFromPresetVariable(
7733          features,
7734          blockName,
7735          variable,
7736          path
7737        );
7738      }
7739      if (type === "custom") {
7740        return getValueFromCustomVariable(
7741          features,
7742          blockName,
7743          variable,
7744          path
7745        );
7746      }
7747      return variable;
7748    }
7749  
7750    // packages/global-styles-engine/build-module/settings/get-style.mjs
7751    function getStyle(globalStyles, path, blockName, shouldDecodeEncode = true) {
7752      const appendedPath = path ? "." + path : "";
7753      const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`;
7754      if (!globalStyles) {
7755        return void 0;
7756      }
7757      const rawResult = getValueFromObjectPath(globalStyles, finalPath);
7758      const result = shouldDecodeEncode ? getValueFromVariable(globalStyles, blockName, rawResult) : rawResult;
7759      return result;
7760    }
7761  
7762    // packages/global-styles-engine/build-module/settings/set-style.mjs
7763    function setStyle(globalStyles, path, newValue, blockName) {
7764      const appendedPath = path ? "." + path : "";
7765      const finalPath = !blockName ? `styles$appendedPath}` : `styles.blocks.$blockName}$appendedPath}`;
7766      return setImmutably(
7767        globalStyles,
7768        finalPath.split("."),
7769        newValue
7770      );
7771    }
7772  
7773    // packages/global-styles-engine/build-module/core/equal.mjs
7774    var import_es6 = __toESM(require_es6(), 1);
7775    function areGlobalStylesEqual(original, variation) {
7776      if (typeof original !== "object" || typeof variation !== "object") {
7777        return original === variation;
7778      }
7779      return (0, import_es6.default)(original?.styles, variation?.styles) && (0, import_es6.default)(original?.settings, variation?.settings);
7780    }
7781  
7782    // packages/global-styles-engine/build-module/core/merge.mjs
7783    var import_deepmerge = __toESM(require_cjs(), 1);
7784  
7785    // node_modules/is-plain-object/dist/is-plain-object.mjs
7786    function isObject(o3) {
7787      return Object.prototype.toString.call(o3) === "[object Object]";
7788    }
7789    function isPlainObject(o3) {
7790      var ctor, prot;
7791      if (isObject(o3) === false) return false;
7792      ctor = o3.constructor;
7793      if (ctor === void 0) return true;
7794      prot = ctor.prototype;
7795      if (isObject(prot) === false) return false;
7796      if (prot.hasOwnProperty("isPrototypeOf") === false) {
7797        return false;
7798      }
7799      return true;
7800    }
7801  
7802    // packages/global-styles-engine/build-module/core/merge.mjs
7803    function mergeGlobalStyles(base, user) {
7804      return (0, import_deepmerge.default)(base, user, {
7805        /*
7806         * We only pass as arrays the presets,
7807         * in which case we want the new array of values
7808         * to override the old array (no merging).
7809         */
7810        isMergeableObject: isPlainObject,
7811        /*
7812         * Exceptions to the above rule.
7813         * Background images should be replaced, not merged,
7814         * as they themselves are specific object definitions for the style.
7815         */
7816        customMerge: (key) => {
7817          if (key === "backgroundImage") {
7818            return (baseConfig, userConfig) => userConfig ?? baseConfig;
7819          }
7820          return void 0;
7821        }
7822      });
7823    }
7824  
7825    // packages/global-styles-engine/build-module/core/render.mjs
7826    var import_blocks3 = __toESM(require_blocks(), 1);
7827    var import_style_engine2 = __toESM(require_style_engine(), 1);
7828    var import_data17 = __toESM(require_data(), 1);
7829  
7830    // packages/global-styles-engine/build-module/core/selectors.mjs
7831    function getBlockSelector(blockType, target = "root", options = {}) {
7832      if (!target) {
7833        return null;
7834      }
7835      const { fallback = false } = options;
7836      const { name: name2, selectors, supports } = blockType;
7837      const hasSelectors = selectors && Object.keys(selectors).length > 0;
7838      const path = Array.isArray(target) ? target.join(".") : target;
7839      let rootSelector = null;
7840      if (hasSelectors && selectors.root) {
7841        rootSelector = selectors?.root;
7842      } else if (supports?.__experimentalSelector) {
7843        rootSelector = supports.__experimentalSelector;
7844      } else {
7845        rootSelector = ".wp-block-" + name2.replace("core/", "").replace("/", "-");
7846      }
7847      if (path === "root") {
7848        return rootSelector;
7849      }
7850      const pathArray = Array.isArray(target) ? target : target.split(".");
7851      if (pathArray.length === 1) {
7852        const fallbackSelector = fallback ? rootSelector : null;
7853        if (hasSelectors) {
7854          const featureSelector2 = getValueFromObjectPath(
7855            selectors,
7856            `$path}.root`,
7857            null
7858          ) || getValueFromObjectPath(selectors, path, null);
7859          return featureSelector2 || fallbackSelector;
7860        }
7861        const featureSelector = supports ? getValueFromObjectPath(
7862          supports,
7863          `$path}.__experimentalSelector`,
7864          null
7865        ) : void 0;
7866        if (!featureSelector) {
7867          return fallbackSelector;
7868        }
7869        return scopeSelector(rootSelector, featureSelector);
7870      }
7871      let subfeatureSelector;
7872      if (hasSelectors) {
7873        subfeatureSelector = getValueFromObjectPath(selectors, path, null);
7874      }
7875      if (subfeatureSelector) {
7876        return subfeatureSelector;
7877      }
7878      if (fallback) {
7879        return getBlockSelector(blockType, pathArray[0], options);
7880      }
7881      return null;
7882    }
7883  
7884    // node_modules/colord/index.mjs
7885    var r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
7886    var t = function(r3) {
7887      return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3;
7888    };
7889    var n = function(r3, t3, n2) {
7890      return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = Math.pow(10, t3)), Math.round(n2 * r3) / n2 + 0;
7891    };
7892    var e = function(r3, t3, n2) {
7893      return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t3 ? r3 : t3;
7894    };
7895    var u = function(r3) {
7896      return (r3 = isFinite(r3) ? r3 % 360 : 0) > 0 ? r3 : r3 + 360;
7897    };
7898    var a = function(r3) {
7899      return { r: e(r3.r, 0, 255), g: e(r3.g, 0, 255), b: e(r3.b, 0, 255), a: e(r3.a) };
7900    };
7901    var o = function(r3) {
7902      return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) };
7903    };
7904    var i = /^#([0-9a-f]{3,8})$/i;
7905    var s = function(r3) {
7906      var t3 = r3.toString(16);
7907      return t3.length < 2 ? "0" + t3 : t3;
7908    };
7909    var h = function(r3) {
7910      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;
7911      return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o3 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 };
7912    };
7913    var b = function(r3) {
7914      var t3 = r3.h, n2 = r3.s, e2 = r3.v, u2 = r3.a;
7915      t3 = t3 / 360 * 6, n2 /= 100, e2 /= 100;
7916      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;
7917      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 };
7918    };
7919    var g = function(r3) {
7920      return { h: u(r3.h), s: e(r3.s, 0, 100), l: e(r3.l, 0, 100), a: e(r3.a) };
7921    };
7922    var d = function(r3) {
7923      return { h: n(r3.h), s: n(r3.s), l: n(r3.l), a: n(r3.a, 3) };
7924    };
7925    var f = function(r3) {
7926      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 }));
7927      var t3, n2, e2;
7928    };
7929    var c = function(r3) {
7930      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 };
7931      var t3, n2, e2, u2;
7932    };
7933    var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
7934    var p2 = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
7935    var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
7936    var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
7937    var y = { string: [[function(r3) {
7938      var t3 = i.exec(r3);
7939      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;
7940    }, "hex"], [function(r3) {
7941      var t3 = v.exec(r3) || m.exec(r3);
7942      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;
7943    }, "rgb"], [function(t3) {
7944      var n2 = l.exec(t3) || p2.exec(t3);
7945      if (!n2) return null;
7946      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) });
7947      return f(a2);
7948    }, "hsl"]], object: [[function(r3) {
7949      var n2 = r3.r, e2 = r3.g, u2 = r3.b, o3 = r3.a, i2 = void 0 === o3 ? 1 : o3;
7950      return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null;
7951    }, "rgb"], [function(r3) {
7952      var n2 = r3.h, e2 = r3.s, u2 = r3.l, a2 = r3.a, o3 = void 0 === a2 ? 1 : a2;
7953      if (!t(n2) || !t(e2) || !t(u2)) return null;
7954      var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o3) });
7955      return f(i2);
7956    }, "hsl"], [function(r3) {
7957      var n2 = r3.h, a2 = r3.s, o3 = r3.v, i2 = r3.a, s2 = void 0 === i2 ? 1 : i2;
7958      if (!t(n2) || !t(a2) || !t(o3)) return null;
7959      var h2 = (function(r4) {
7960        return { h: u(r4.h), s: e(r4.s, 0, 100), v: e(r4.v, 0, 100), a: e(r4.a) };
7961      })({ h: Number(n2), s: Number(a2), v: Number(o3), a: Number(s2) });
7962      return b(h2);
7963    }, "hsv"]] };
7964    var N = function(r3, t3) {
7965      for (var n2 = 0; n2 < t3.length; n2++) {
7966        var e2 = t3[n2][0](r3);
7967        if (e2) return [e2, t3[n2][1]];
7968      }
7969      return [null, void 0];
7970    };
7971    var x = function(r3) {
7972      return "string" == typeof r3 ? N(r3.trim(), y.string) : "object" == typeof r3 && null !== r3 ? N(r3, y.object) : [null, void 0];
7973    };
7974    var M = function(r3, t3) {
7975      var n2 = c(r3);
7976      return { h: n2.h, s: e(n2.s + 100 * t3, 0, 100), l: n2.l, a: n2.a };
7977    };
7978    var H = function(r3) {
7979      return (299 * r3.r + 587 * r3.g + 114 * r3.b) / 1e3 / 255;
7980    };
7981    var $ = function(r3, t3) {
7982      var n2 = c(r3);
7983      return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t3, 0, 100), a: n2.a };
7984    };
7985    var j = (function() {
7986      function r3(r4) {
7987        this.parsed = x(r4)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
7988      }
7989      return r3.prototype.isValid = function() {
7990        return null !== this.parsed;
7991      }, r3.prototype.brightness = function() {
7992        return n(H(this.rgba), 2);
7993      }, r3.prototype.isDark = function() {
7994        return H(this.rgba) < 0.5;
7995      }, r3.prototype.isLight = function() {
7996        return H(this.rgba) >= 0.5;
7997      }, r3.prototype.toHex = function() {
7998        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;
7999        var r4, t3, e2, u2, a2, i2;
8000      }, r3.prototype.toRgb = function() {
8001        return o(this.rgba);
8002      }, r3.prototype.toRgbString = function() {
8003        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 + ")";
8004        var r4, t3, n2, e2, u2;
8005      }, r3.prototype.toHsl = function() {
8006        return d(c(this.rgba));
8007      }, r3.prototype.toHslString = function() {
8008        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 + "%)";
8009        var r4, t3, n2, e2, u2;
8010      }, r3.prototype.toHsv = function() {
8011        return r4 = h(this.rgba), { h: n(r4.h), s: n(r4.s), v: n(r4.v), a: n(r4.a, 3) };
8012        var r4;
8013      }, r3.prototype.invert = function() {
8014        return w({ r: 255 - (r4 = this.rgba).r, g: 255 - r4.g, b: 255 - r4.b, a: r4.a });
8015        var r4;
8016      }, r3.prototype.saturate = function(r4) {
8017        return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, r4));
8018      }, r3.prototype.desaturate = function(r4) {
8019        return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, -r4));
8020      }, r3.prototype.grayscale = function() {
8021        return w(M(this.rgba, -1));
8022      }, r3.prototype.lighten = function(r4) {
8023        return void 0 === r4 && (r4 = 0.1), w($(this.rgba, r4));
8024      }, r3.prototype.darken = function(r4) {
8025        return void 0 === r4 && (r4 = 0.1), w($(this.rgba, -r4));
8026      }, r3.prototype.rotate = function(r4) {
8027        return void 0 === r4 && (r4 = 15), this.hue(this.hue() + r4);
8028      }, r3.prototype.alpha = function(r4) {
8029        return "number" == typeof r4 ? w({ r: (t3 = this.rgba).r, g: t3.g, b: t3.b, a: r4 }) : n(this.rgba.a, 3);
8030        var t3;
8031      }, r3.prototype.hue = function(r4) {
8032        var t3 = c(this.rgba);
8033        return "number" == typeof r4 ? w({ h: r4, s: t3.s, l: t3.l, a: t3.a }) : n(t3.h);
8034      }, r3.prototype.isEqual = function(r4) {
8035        return this.toHex() === w(r4).toHex();
8036      }, r3;
8037    })();
8038    var w = function(r3) {
8039      return r3 instanceof j ? r3 : new j(r3);
8040    };
8041    var S = [];
8042    var k = function(r3) {
8043      r3.forEach(function(r4) {
8044        S.indexOf(r4) < 0 && (r4(j, y), S.push(r4));
8045      });
8046    };
8047  
8048    // packages/global-styles-engine/build-module/utils/duotone.mjs
8049    function getValuesFromColors(colors2 = []) {
8050      const values = {
8051        r: [],
8052        g: [],
8053        b: [],
8054        a: []
8055      };
8056      colors2.forEach((color) => {
8057        const rgbColor = w(color).toRgb();
8058        values.r.push(rgbColor.r / 255);
8059        values.g.push(rgbColor.g / 255);
8060        values.b.push(rgbColor.b / 255);
8061        values.a.push(rgbColor.a);
8062      });
8063      return values;
8064    }
8065    function getDuotoneFilter(id, colors2) {
8066      const values = getValuesFromColors(colors2);
8067      return `
8068  <svg
8069      xmlns:xlink="http://www.w3.org/1999/xlink"
8070      viewBox="0 0 0 0"
8071      width="0"
8072      height="0"
8073      focusable="false"
8074      role="none"
8075      aria-hidden="true"
8076      style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"
8077  >
8078      <defs>
8079          <filter id="$id}">
8080              <!--
8081                  Use sRGB instead of linearRGB so transparency looks correct.
8082                  Use perceptual brightness to convert to grayscale.
8083              -->
8084              <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>
8085              <!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. -->
8086              <feComponentTransfer color-interpolation-filters="sRGB">
8087                  <feFuncR type="table" tableValues="$values.r.join(" ")}"></feFuncR>
8088                  <feFuncG type="table" tableValues="$values.g.join(" ")}"></feFuncG>
8089                  <feFuncB type="table" tableValues="$values.b.join(" ")}"></feFuncB>
8090                  <feFuncA type="table" tableValues="$values.a.join(" ")}"></feFuncA>
8091              </feComponentTransfer>
8092              <!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. -->
8093              <feComposite in2="SourceGraphic" operator="in"></feComposite>
8094          </filter>
8095      </defs>
8096  </svg>`;
8097    }
8098  
8099    // packages/global-styles-engine/build-module/utils/string.mjs
8100    function kebabCase(str) {
8101      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();
8102    }
8103  
8104    // packages/global-styles-engine/build-module/utils/spacing.mjs
8105    function getSpacingPresetCssVar(value) {
8106      if (!value) {
8107        return;
8108      }
8109      const slug = value.match(/var:preset\|spacing\|(.+)/);
8110      if (!slug) {
8111        return value;
8112      }
8113      return `var(--wp--preset--spacing--$slug[1]})`;
8114    }
8115  
8116    // packages/global-styles-engine/build-module/utils/gap.mjs
8117    function getGapBoxControlValueFromStyle(blockGapValue) {
8118      if (!blockGapValue) {
8119        return null;
8120      }
8121      const isValueString = typeof blockGapValue === "string";
8122      return {
8123        top: isValueString ? blockGapValue : blockGapValue?.top,
8124        left: isValueString ? blockGapValue : blockGapValue?.left
8125      };
8126    }
8127    function getGapCSSValue(blockGapValue, defaultValue2 = "0") {
8128      const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue);
8129      if (!blockGapBoxControlValue) {
8130        return null;
8131      }
8132      const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue2;
8133      const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue2;
8134      return row === column ? row : `$row} $column}`;
8135    }
8136  
8137    // packages/global-styles-engine/build-module/utils/background.mjs
8138    var BACKGROUND_BLOCK_DEFAULT_VALUES = {
8139      backgroundSize: "cover",
8140      backgroundPosition: "50% 50%"
8141      // used only when backgroundSize is 'contain'.
8142    };
8143    function setBackgroundStyleDefaults(backgroundStyle) {
8144      if (!backgroundStyle || // @ts-expect-error
8145      !backgroundStyle?.backgroundImage?.url) {
8146        return;
8147      }
8148      let backgroundStylesWithDefaults;
8149      if (!backgroundStyle?.backgroundSize) {
8150        backgroundStylesWithDefaults = {
8151          backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize
8152        };
8153      }
8154      if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) {
8155        backgroundStylesWithDefaults = {
8156          backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition
8157        };
8158      }
8159      return backgroundStylesWithDefaults;
8160    }
8161  
8162    // packages/global-styles-engine/build-module/utils/layout.mjs
8163    var LAYOUT_DEFINITIONS = {
8164      default: {
8165        name: "default",
8166        slug: "flow",
8167        className: "is-layout-flow",
8168        baseStyles: [
8169          {
8170            selector: " > .alignleft",
8171            rules: {
8172              float: "left",
8173              "margin-inline-start": "0",
8174              "margin-inline-end": "2em"
8175            }
8176          },
8177          {
8178            selector: " > .alignright",
8179            rules: {
8180              float: "right",
8181              "margin-inline-start": "2em",
8182              "margin-inline-end": "0"
8183            }
8184          },
8185          {
8186            selector: " > .aligncenter",
8187            rules: {
8188              "margin-left": "auto !important",
8189              "margin-right": "auto !important"
8190            }
8191          }
8192        ],
8193        spacingStyles: [
8194          {
8195            selector: " > :first-child",
8196            rules: {
8197              "margin-block-start": "0"
8198            }
8199          },
8200          {
8201            selector: " > :last-child",
8202            rules: {
8203              "margin-block-end": "0"
8204            }
8205          },
8206          {
8207            selector: " > *",
8208            rules: {
8209              "margin-block-start": null,
8210              "margin-block-end": "0"
8211            }
8212          }
8213        ]
8214      },
8215      constrained: {
8216        name: "constrained",
8217        slug: "constrained",
8218        className: "is-layout-constrained",
8219        baseStyles: [
8220          {
8221            selector: " > .alignleft",
8222            rules: {
8223              float: "left",
8224              "margin-inline-start": "0",
8225              "margin-inline-end": "2em"
8226            }
8227          },
8228          {
8229            selector: " > .alignright",
8230            rules: {
8231              float: "right",
8232              "margin-inline-start": "2em",
8233              "margin-inline-end": "0"
8234            }
8235          },
8236          {
8237            selector: " > .aligncenter",
8238            rules: {
8239              "margin-left": "auto !important",
8240              "margin-right": "auto !important"
8241            }
8242          },
8243          {
8244            selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))",
8245            rules: {
8246              "max-width": "var(--wp--style--global--content-size)",
8247              "margin-left": "auto !important",
8248              "margin-right": "auto !important"
8249            }
8250          },
8251          {
8252            selector: " > .alignwide",
8253            rules: {
8254              "max-width": "var(--wp--style--global--wide-size)"
8255            }
8256          }
8257        ],
8258        spacingStyles: [
8259          {
8260            selector: " > :first-child",
8261            rules: {
8262              "margin-block-start": "0"
8263            }
8264          },
8265          {
8266            selector: " > :last-child",
8267            rules: {
8268              "margin-block-end": "0"
8269            }
8270          },
8271          {
8272            selector: " > *",
8273            rules: {
8274              "margin-block-start": null,
8275              "margin-block-end": "0"
8276            }
8277          }
8278        ]
8279      },
8280      flex: {
8281        name: "flex",
8282        slug: "flex",
8283        className: "is-layout-flex",
8284        displayMode: "flex",
8285        baseStyles: [
8286          {
8287            selector: "",
8288            rules: {
8289              "flex-wrap": "wrap",
8290              "align-items": "center"
8291            }
8292          },
8293          {
8294            selector: " > :is(*, div)",
8295            // :is(*, div) instead of just * increases the specificity by 001.
8296            rules: {
8297              margin: "0"
8298            }
8299          }
8300        ],
8301        spacingStyles: [
8302          {
8303            selector: "",
8304            rules: {
8305              gap: null
8306            }
8307          }
8308        ]
8309      },
8310      grid: {
8311        name: "grid",
8312        slug: "grid",
8313        className: "is-layout-grid",
8314        displayMode: "grid",
8315        baseStyles: [
8316          {
8317            selector: " > :is(*, div)",
8318            // :is(*, div) instead of just * increases the specificity by 001.
8319            rules: {
8320              margin: "0"
8321            }
8322          }
8323        ],
8324        spacingStyles: [
8325          {
8326            selector: "",
8327            rules: {
8328              gap: null
8329            }
8330          }
8331        ]
8332      }
8333    };
8334  
8335    // packages/global-styles-engine/build-module/core/render.mjs
8336    var ELEMENT_CLASS_NAMES = {
8337      button: "wp-element-button",
8338      caption: "wp-element-caption"
8339    };
8340    var BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
8341      __experimentalBorder: "border",
8342      color: "color",
8343      dimensions: "dimensions",
8344      spacing: "spacing",
8345      typography: "typography"
8346    };
8347    function getPresetsDeclarations(blockPresets = {}, mergedSettings) {
8348      return PRESET_METADATA.reduce(
8349        (declarations, { path, valueKey, valueFunc, cssVarInfix }) => {
8350          const presetByOrigin = getValueFromObjectPath(
8351            blockPresets,
8352            path,
8353            []
8354          );
8355          ["default", "theme", "custom"].forEach((origin) => {
8356            if (presetByOrigin[origin]) {
8357              presetByOrigin[origin].forEach((value) => {
8358                if (valueKey && !valueFunc) {
8359                  declarations.push(
8360                    `--wp--preset--$cssVarInfix}--$kebabCase(
8361                      value.slug
8362                    )}: $value[valueKey]}`
8363                  );
8364                } else if (valueFunc && typeof valueFunc === "function") {
8365                  declarations.push(
8366                    `--wp--preset--$cssVarInfix}--$kebabCase(
8367                      value.slug
8368                    )}: $valueFunc(value, mergedSettings)}`
8369                  );
8370                }
8371              });
8372            }
8373          });
8374          return declarations;
8375        },
8376        []
8377      );
8378    }
8379    function getPresetsClasses(blockSelector = "*", blockPresets = {}) {
8380      return PRESET_METADATA.reduce(
8381        (declarations, { path, cssVarInfix, classes }) => {
8382          if (!classes) {
8383            return declarations;
8384          }
8385          const presetByOrigin = getValueFromObjectPath(
8386            blockPresets,
8387            path,
8388            []
8389          );
8390          ["default", "theme", "custom"].forEach((origin) => {
8391            if (presetByOrigin[origin]) {
8392              presetByOrigin[origin].forEach(
8393                ({ slug }) => {
8394                  classes.forEach(
8395                    ({
8396                      classSuffix,
8397                      propertyName
8398                    }) => {
8399                      const classSelectorToUse = `.has-$kebabCase(
8400                        slug
8401                      )}-$classSuffix}`;
8402                      const selectorToUse = blockSelector.split(",").map(
8403                        (selector2) => `$selector2}$classSelectorToUse}`
8404                      ).join(",");
8405                      const value = `var(--wp--preset--$cssVarInfix}--$kebabCase(
8406                        slug
8407                      )})`;
8408                      declarations += `$selectorToUse}{$propertyName}: $value} !important;}`;
8409                    }
8410                  );
8411                }
8412              );
8413            }
8414          });
8415          return declarations;
8416        },
8417        ""
8418      );
8419    }
8420    function getPresetsSvgFilters(blockPresets = {}) {
8421      return PRESET_METADATA.filter(
8422        // Duotone are the only type of filters for now.
8423        (metadata) => metadata.path.at(-1) === "duotone"
8424      ).flatMap((metadata) => {
8425        const presetByOrigin = getValueFromObjectPath(
8426          blockPresets,
8427          metadata.path,
8428          {}
8429        );
8430        return ["default", "theme"].filter((origin) => presetByOrigin[origin]).flatMap(
8431          (origin) => presetByOrigin[origin].map(
8432            (preset) => getDuotoneFilter(
8433              `wp-duotone-$preset.slug}`,
8434              preset.colors
8435            )
8436          )
8437        ).join("");
8438      });
8439    }
8440    function flattenTree(input = {}, prefix2, token) {
8441      let result = [];
8442      Object.keys(input).forEach((key) => {
8443        const newKey = prefix2 + kebabCase(key.replace("/", "-"));
8444        const newLeaf = input[key];
8445        if (newLeaf instanceof Object) {
8446          const newPrefix = newKey + token;
8447          result = [...result, ...flattenTree(newLeaf, newPrefix, token)];
8448        } else {
8449          result.push(`$newKey}: $newLeaf}`);
8450        }
8451      });
8452      return result;
8453    }
8454    function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) {
8455      const featureSelectors = featureSelector.split(",");
8456      const combinedSelectors = [];
8457      featureSelectors.forEach((selector2) => {
8458        combinedSelectors.push(
8459          `$styleVariationSelector.trim()}$selector2.trim()}`
8460        );
8461      });
8462      return combinedSelectors.join(", ");
8463    }
8464    var updateParagraphTextIndentSelector = (featureDeclarations, settings2, blockName) => {
8465      if (blockName !== "core/paragraph") {
8466        return featureDeclarations;
8467      }
8468      const blockSettings = settings2?.blocks?.["core/paragraph"];
8469      const textIndentSetting = blockSettings?.typography?.textIndent ?? settings2?.typography?.textIndent ?? "subsequent";
8470      if (textIndentSetting !== "all") {
8471        return featureDeclarations;
8472      }
8473      const oldSelector = ".wp-block-paragraph + .wp-block-paragraph";
8474      const newSelector = ".wp-block-paragraph";
8475      if (oldSelector in featureDeclarations) {
8476        const declarations = featureDeclarations[oldSelector];
8477        const updated = { ...featureDeclarations };
8478        delete updated[oldSelector];
8479        updated[newSelector] = declarations;
8480        return updated;
8481      }
8482      return featureDeclarations;
8483    };
8484    var getFeatureDeclarations = (selectors, styles) => {
8485      const declarations = {};
8486      Object.entries(selectors).forEach(([feature, selector2]) => {
8487        if (feature === "root" || !styles?.[feature]) {
8488          return;
8489        }
8490        const isShorthand = typeof selector2 === "string";
8491        if (!isShorthand && typeof selector2 === "object" && selector2 !== null) {
8492          Object.entries(selector2).forEach(
8493            ([subfeature, subfeatureSelector]) => {
8494              if (subfeature === "root" || !styles?.[feature][subfeature]) {
8495                return;
8496              }
8497              const subfeatureStyles = {
8498                [feature]: {
8499                  [subfeature]: styles[feature][subfeature]
8500                }
8501              };
8502              const newDeclarations = getStylesDeclarations(subfeatureStyles);
8503              declarations[subfeatureSelector] = [
8504                ...declarations[subfeatureSelector] || [],
8505                ...newDeclarations
8506              ];
8507              delete styles[feature][subfeature];
8508            }
8509          );
8510        }
8511        if (isShorthand || typeof selector2 === "object" && selector2 !== null && "root" in selector2) {
8512          const featureSelector = isShorthand ? selector2 : selector2.root;
8513          const featureStyles = { [feature]: styles[feature] };
8514          const newDeclarations = getStylesDeclarations(featureStyles);
8515          declarations[featureSelector] = [
8516            ...declarations[featureSelector] || [],
8517            ...newDeclarations
8518          ];
8519          delete styles[feature];
8520        }
8521      });
8522      return declarations;
8523    };
8524    function getStylesDeclarations(blockStyles = {}, selector2 = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) {
8525      const isRoot = ROOT_BLOCK_SELECTOR === selector2;
8526      const output = Object.entries(
8527        import_blocks3.__EXPERIMENTAL_STYLE_PROPERTY
8528      ).reduce(
8529        (declarations, [key, { value, properties, useEngine, rootOnly }]) => {
8530          if (rootOnly && !isRoot) {
8531            return declarations;
8532          }
8533          const pathToValue = value;
8534          if (pathToValue[0] === "elements" || useEngine) {
8535            return declarations;
8536          }
8537          const styleValue = getValueFromObjectPath(
8538            blockStyles,
8539            pathToValue
8540          );
8541          if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) {
8542            return declarations;
8543          }
8544          if (properties && typeof styleValue !== "string") {
8545            Object.entries(properties).forEach((entry) => {
8546              const [name2, prop] = entry;
8547              if (!getValueFromObjectPath(styleValue, [prop], false)) {
8548                return;
8549              }
8550              const cssProperty = name2.startsWith("--") ? name2 : kebabCase(name2);
8551              declarations.push(
8552                `$cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)(
8553                  getValueFromObjectPath(styleValue, [prop])
8554                )}`
8555              );
8556            });
8557          } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) {
8558            const cssProperty = key.startsWith("--") ? key : kebabCase(key);
8559            declarations.push(
8560              `$cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)(
8561                getValueFromObjectPath(blockStyles, pathToValue)
8562              )}`
8563            );
8564          }
8565          return declarations;
8566        },
8567        []
8568      );
8569      if (!!blockStyles.background) {
8570        if (blockStyles.background?.backgroundImage) {
8571          blockStyles.background.backgroundImage = getResolvedValue(
8572            blockStyles.background.backgroundImage,
8573            tree
8574          );
8575        }
8576        if (!isRoot && !!blockStyles.background?.backgroundImage?.id) {
8577          blockStyles = {
8578            ...blockStyles,
8579            background: {
8580              ...blockStyles.background,
8581              ...setBackgroundStyleDefaults(blockStyles.background)
8582            }
8583          };
8584        }
8585      }
8586      const extraRules = (0, import_style_engine2.getCSSRules)(blockStyles);
8587      extraRules.forEach((rule) => {
8588        if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) {
8589          return;
8590        }
8591        const cssProperty = rule.key.startsWith("--") ? rule.key : kebabCase(rule.key);
8592        let ruleValue = getResolvedValue(rule.value, tree);
8593        if (cssProperty === "font-size") {
8594          ruleValue = getTypographyFontSizeValue(
8595            { name: "", slug: "", size: ruleValue },
8596            tree?.settings
8597          );
8598        }
8599        if (cssProperty === "aspect-ratio") {
8600          output.push("min-height: unset");
8601        }
8602        output.push(`$cssProperty}: $ruleValue}`);
8603      });
8604      return output;
8605    }
8606    function getLayoutStyles({
8607      layoutDefinitions = LAYOUT_DEFINITIONS,
8608      style,
8609      selector: selector2,
8610      hasBlockGapSupport,
8611      hasFallbackGapSupport,
8612      fallbackGapValue
8613    }) {
8614      let ruleset = "";
8615      let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : "";
8616      if (hasFallbackGapSupport) {
8617        if (selector2 === ROOT_BLOCK_SELECTOR) {
8618          gapValue = !gapValue ? "0.5em" : gapValue;
8619        } else if (!hasBlockGapSupport && fallbackGapValue) {
8620          gapValue = fallbackGapValue;
8621        }
8622      }
8623      if (gapValue && layoutDefinitions) {
8624        Object.values(layoutDefinitions).forEach(
8625          ({ className, name: name2, spacingStyles }) => {
8626            if (!hasBlockGapSupport && "flex" !== name2 && "grid" !== name2) {
8627              return;
8628            }
8629            if (spacingStyles?.length) {
8630              spacingStyles.forEach((spacingStyle) => {
8631                const declarations = [];
8632                if (spacingStyle.rules) {
8633                  Object.entries(spacingStyle.rules).forEach(
8634                    ([cssProperty, cssValue]) => {
8635                      declarations.push(
8636                        `$cssProperty}: $cssValue ? cssValue : gapValue}`
8637                      );
8638                    }
8639                  );
8640                }
8641                if (declarations.length) {
8642                  let combinedSelector = "";
8643                  if (!hasBlockGapSupport) {
8644                    combinedSelector = selector2 === ROOT_BLOCK_SELECTOR ? `:where(.$className}$spacingStyle?.selector || ""})` : `:where($selector2}.$className}$spacingStyle?.selector || ""})`;
8645                  } else {
8646                    combinedSelector = selector2 === ROOT_BLOCK_SELECTOR ? `:root :where(.$className})$spacingStyle?.selector || ""}` : `:root :where($selector2}-$className})$spacingStyle?.selector || ""}`;
8647                  }
8648                  ruleset += `$combinedSelector} { $declarations.join(
8649                    "; "
8650                  )}; }`;
8651                }
8652              });
8653            }
8654          }
8655        );
8656        if (selector2 === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) {
8657          ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: $gapValue}; }`;
8658        }
8659      }
8660      if (selector2 === ROOT_BLOCK_SELECTOR && layoutDefinitions) {
8661        const validDisplayModes = ["block", "flex", "grid"];
8662        Object.values(layoutDefinitions).forEach(
8663          ({ className, displayMode, baseStyles }) => {
8664            if (displayMode && validDisplayModes.includes(displayMode)) {
8665              ruleset += `$selector2} .$className} { display:$displayMode}; }`;
8666            }
8667            if (baseStyles?.length) {
8668              baseStyles.forEach((baseStyle) => {
8669                const declarations = [];
8670                if (baseStyle.rules) {
8671                  Object.entries(baseStyle.rules).forEach(
8672                    ([cssProperty, cssValue]) => {
8673                      declarations.push(
8674                        `$cssProperty}: $cssValue}`
8675                      );
8676                    }
8677                  );
8678                }
8679                if (declarations.length) {
8680                  const combinedSelector = `.$className}$baseStyle?.selector || ""}`;
8681                  ruleset += `$combinedSelector} { $declarations.join(
8682                    "; "
8683                  )}; }`;
8684                }
8685              });
8686            }
8687          }
8688        );
8689      }
8690      return ruleset;
8691    }
8692    var STYLE_KEYS = [
8693      "border",
8694      "color",
8695      "dimensions",
8696      "spacing",
8697      "typography",
8698      "filter",
8699      "outline",
8700      "shadow",
8701      "background"
8702    ];
8703    function pickStyleKeys(treeToPickFrom) {
8704      if (!treeToPickFrom) {
8705        return {};
8706      }
8707      const entries = Object.entries(treeToPickFrom);
8708      const pickedEntries = entries.filter(
8709        ([key]) => STYLE_KEYS.includes(key)
8710      );
8711      const clonedEntries = pickedEntries.map(([key, style]) => [
8712        key,
8713        JSON.parse(JSON.stringify(style))
8714      ]);
8715      return Object.fromEntries(clonedEntries);
8716    }
8717    var getNodesWithStyles = (tree, blockSelectors) => {
8718      const nodes = [];
8719      if (!tree?.styles) {
8720        return nodes;
8721      }
8722      const styles = pickStyleKeys(tree.styles);
8723      if (styles) {
8724        nodes.push({
8725          styles,
8726          selector: ROOT_BLOCK_SELECTOR,
8727          // Root selector (body) styles should not be wrapped in `:root where()` to keep
8728          // specificity at (0,0,1) and maintain backwards compatibility.
8729          skipSelectorWrapper: true
8730        });
8731      }
8732      Object.entries(import_blocks3.__EXPERIMENTAL_ELEMENTS).forEach(([name2, selector2]) => {
8733        if (tree.styles?.elements?.[name2]) {
8734          nodes.push({
8735            styles: tree.styles?.elements?.[name2] ?? {},
8736            selector: selector2,
8737            // Top level elements that don't use a class name should not receive the
8738            // `:root :where()` wrapper to maintain backwards compatibility.
8739            skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name2]
8740          });
8741        }
8742      });
8743      Object.entries(tree.styles?.blocks ?? {}).forEach(
8744        ([blockName, node]) => {
8745          const blockStyles = pickStyleKeys(node);
8746          const typedNode = node;
8747          const variationNodesToAdd = [];
8748          if (typedNode?.variations) {
8749            const variations = {};
8750            Object.entries(typedNode.variations).forEach(
8751              ([variationName, variation]) => {
8752                const typedVariation = variation;
8753                variations[variationName] = pickStyleKeys(typedVariation);
8754                if (typedVariation?.css) {
8755                  variations[variationName].css = typedVariation.css;
8756                }
8757                const variationSelector = typeof blockSelectors !== "string" ? blockSelectors[blockName]?.styleVariationSelectors?.[variationName] : void 0;
8758                Object.entries(
8759                  typedVariation?.elements ?? {}
8760                ).forEach(([element, elementStyles]) => {
8761                  if (elementStyles && import_blocks3.__EXPERIMENTAL_ELEMENTS[element]) {
8762                    variationNodesToAdd.push({
8763                      styles: elementStyles,
8764                      selector: scopeSelector(
8765                        variationSelector,
8766                        import_blocks3.__EXPERIMENTAL_ELEMENTS[element]
8767                      )
8768                    });
8769                  }
8770                });
8771                Object.entries(typedVariation?.blocks ?? {}).forEach(
8772                  ([
8773                    variationBlockName,
8774                    variationBlockStyles
8775                  ]) => {
8776                    const variationBlockSelector = typeof blockSelectors !== "string" ? scopeSelector(
8777                      variationSelector,
8778                      blockSelectors[variationBlockName]?.selector
8779                    ) : void 0;
8780                    const variationDuotoneSelector = typeof blockSelectors !== "string" ? scopeSelector(
8781                      variationSelector,
8782                      blockSelectors[variationBlockName]?.duotoneSelector
8783                    ) : void 0;
8784                    const variationFeatureSelectors = typeof blockSelectors !== "string" ? scopeFeatureSelectors(
8785                      variationSelector,
8786                      blockSelectors[variationBlockName]?.featureSelectors ?? {}
8787                    ) : void 0;
8788                    const variationBlockStyleNodes = pickStyleKeys(variationBlockStyles);
8789                    if (variationBlockStyles?.css) {
8790                      variationBlockStyleNodes.css = variationBlockStyles.css;
8791                    }
8792                    if (!variationBlockSelector || typeof blockSelectors === "string") {
8793                      return;
8794                    }
8795                    variationNodesToAdd.push({
8796                      selector: variationBlockSelector,
8797                      duotoneSelector: variationDuotoneSelector,
8798                      featureSelectors: variationFeatureSelectors,
8799                      fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue,
8800                      hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport,
8801                      styles: variationBlockStyleNodes
8802                    });
8803                    Object.entries(
8804                      variationBlockStyles.elements ?? {}
8805                    ).forEach(
8806                      ([
8807                        variationBlockElement,
8808                        variationBlockElementStyles
8809                      ]) => {
8810                        if (variationBlockElementStyles && import_blocks3.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) {
8811                          variationNodesToAdd.push({
8812                            styles: variationBlockElementStyles,
8813                            selector: scopeSelector(
8814                              variationBlockSelector,
8815                              import_blocks3.__EXPERIMENTAL_ELEMENTS[variationBlockElement]
8816                            )
8817                          });
8818                        }
8819                      }
8820                    );
8821                  }
8822                );
8823              }
8824            );
8825            blockStyles.variations = variations;
8826          }
8827          if (typeof blockSelectors !== "string" && blockSelectors?.[blockName]?.selector) {
8828            nodes.push({
8829              duotoneSelector: blockSelectors[blockName].duotoneSelector,
8830              fallbackGapValue: blockSelectors[blockName].fallbackGapValue,
8831              hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
8832              selector: blockSelectors[blockName].selector,
8833              styles: blockStyles,
8834              featureSelectors: blockSelectors[blockName].featureSelectors,
8835              styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors,
8836              name: blockName
8837            });
8838          }
8839          Object.entries(typedNode?.elements ?? {}).forEach(
8840            ([elementName, value]) => {
8841              if (typeof blockSelectors !== "string" && value && blockSelectors?.[blockName] && import_blocks3.__EXPERIMENTAL_ELEMENTS[elementName]) {
8842                nodes.push({
8843                  styles: value,
8844                  selector: blockSelectors[blockName]?.selector.split(",").map((sel) => {
8845                    const elementSelectors = import_blocks3.__EXPERIMENTAL_ELEMENTS[elementName].split(",");
8846                    return elementSelectors.map(
8847                      (elementSelector) => sel + " " + elementSelector
8848                    );
8849                  }).join(",")
8850                });
8851              }
8852            }
8853          );
8854          nodes.push(...variationNodesToAdd);
8855        }
8856      );
8857      return nodes;
8858    };
8859    var getNodesWithSettings = (tree, blockSelectors) => {
8860      const nodes = [];
8861      if (!tree?.settings) {
8862        return nodes;
8863      }
8864      const pickPresets = (treeToPickFrom) => {
8865        let presets2 = {};
8866        PRESET_METADATA.forEach(({ path }) => {
8867          const value = getValueFromObjectPath(treeToPickFrom, path, false);
8868          if (value !== false) {
8869            presets2 = setImmutably(presets2, path, value);
8870          }
8871        });
8872        return presets2;
8873      };
8874      const presets = pickPresets(tree.settings);
8875      const custom = tree.settings?.custom;
8876      if (Object.keys(presets).length > 0 || custom) {
8877        nodes.push({
8878          presets,
8879          custom,
8880          selector: ROOT_CSS_PROPERTIES_SELECTOR
8881        });
8882      }
8883      Object.entries(tree.settings?.blocks ?? {}).forEach(
8884        ([blockName, node]) => {
8885          const blockCustom = node.custom;
8886          if (typeof blockSelectors === "string" || !blockSelectors[blockName]) {
8887            return;
8888          }
8889          const blockPresets = pickPresets(node);
8890          if (Object.keys(blockPresets).length > 0 || blockCustom) {
8891            nodes.push({
8892              presets: blockPresets,
8893              custom: blockCustom,
8894              selector: blockSelectors[blockName]?.selector
8895            });
8896          }
8897        }
8898      );
8899      return nodes;
8900    };
8901    var generateCustomProperties = (tree, blockSelectors) => {
8902      const settings2 = getNodesWithSettings(tree, blockSelectors);
8903      let ruleset = "";
8904      settings2.forEach(({ presets, custom, selector: selector2 }) => {
8905        const declarations = tree?.settings ? getPresetsDeclarations(presets, tree?.settings) : [];
8906        const customProps = flattenTree(custom, "--wp--custom--", "--");
8907        if (customProps.length > 0) {
8908          declarations.push(...customProps);
8909        }
8910        if (declarations.length > 0) {
8911          ruleset += `$selector2}{$declarations.join(";")};}`;
8912        }
8913      });
8914      return ruleset;
8915    };
8916    var transformToStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = {}) => {
8917      const options = {
8918        blockGap: true,
8919        blockStyles: true,
8920        layoutStyles: true,
8921        marginReset: true,
8922        presets: true,
8923        rootPadding: true,
8924        variationStyles: false,
8925        ...styleOptions
8926      };
8927      const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
8928      const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
8929      const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;
8930      const { contentSize, wideSize } = tree?.settings?.layout || {};
8931      const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles;
8932      let ruleset = "";
8933      if (options.presets && (contentSize || wideSize)) {
8934        ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} {`;
8935        ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: $contentSize};` : ruleset;
8936        ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: $wideSize};` : ruleset;
8937        ruleset += "}";
8938      }
8939      if (hasBodyStyles) {
8940        ruleset += ":where(body) {margin: 0;";
8941        if (options.rootPadding && useRootPaddingAlign) {
8942          ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
8943                  .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
8944                  .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
8945                  .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }
8946                  .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;
8947                  `;
8948        }
8949        ruleset += "}";
8950      }
8951      if (options.blockStyles) {
8952        nodesWithStyles.forEach(
8953          ({
8954            selector: selector2,
8955            duotoneSelector,
8956            styles,
8957            fallbackGapValue,
8958            hasLayoutSupport,
8959            featureSelectors,
8960            styleVariationSelectors,
8961            skipSelectorWrapper,
8962            name: name2
8963          }) => {
8964            if (featureSelectors) {
8965              let featureDeclarations = getFeatureDeclarations(
8966                featureSelectors,
8967                styles
8968              );
8969              featureDeclarations = updateParagraphTextIndentSelector(
8970                featureDeclarations,
8971                tree.settings,
8972                name2
8973              );
8974              Object.entries(featureDeclarations).forEach(
8975                ([cssSelector, declarations]) => {
8976                  if (declarations.length) {
8977                    const rules = declarations.join(";");
8978                    ruleset += `:root :where($cssSelector}){$rules};}`;
8979                  }
8980                }
8981              );
8982            }
8983            if (duotoneSelector) {
8984              const duotoneStyles = {};
8985              if (styles?.filter) {
8986                duotoneStyles.filter = styles.filter;
8987                delete styles.filter;
8988              }
8989              const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
8990              if (duotoneDeclarations.length) {
8991                ruleset += `$duotoneSelector}{$duotoneDeclarations.join(
8992                  ";"
8993                )};}`;
8994              }
8995            }
8996            if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector2 || hasLayoutSupport)) {
8997              ruleset += getLayoutStyles({
8998                style: styles,
8999                selector: selector2,
9000                hasBlockGapSupport,
9001                hasFallbackGapSupport,
9002                fallbackGapValue
9003              });
9004            }
9005            const styleDeclarations = getStylesDeclarations(
9006              styles,
9007              selector2,
9008              useRootPaddingAlign,
9009              tree,
9010              disableRootPadding
9011            );
9012            if (styleDeclarations?.length) {
9013              const generalSelector = skipSelectorWrapper ? selector2 : `:root :where($selector2})`;
9014              ruleset += `$generalSelector}{$styleDeclarations.join(
9015                ";"
9016              )};}`;
9017            }
9018            if (styles?.css) {
9019              ruleset += processCSSNesting(
9020                styles.css,
9021                `:root :where($selector2})`
9022              );
9023            }
9024            if (options.variationStyles && styleVariationSelectors) {
9025              Object.entries(styleVariationSelectors).forEach(
9026                ([styleVariationName, styleVariationSelector]) => {
9027                  const styleVariations = styles?.variations?.[styleVariationName];
9028                  if (styleVariations) {
9029                    if (featureSelectors) {
9030                      let featureDeclarations = getFeatureDeclarations(
9031                        featureSelectors,
9032                        styleVariations
9033                      );
9034                      featureDeclarations = updateParagraphTextIndentSelector(
9035                        featureDeclarations,
9036                        tree.settings,
9037                        name2
9038                      );
9039                      Object.entries(
9040                        featureDeclarations
9041                      ).forEach(
9042                        ([baseSelector, declarations]) => {
9043                          if (declarations.length) {
9044                            const cssSelector = concatFeatureVariationSelectorString(
9045                              baseSelector,
9046                              styleVariationSelector
9047                            );
9048                            const rules = declarations.join(";");
9049                            ruleset += `:root :where($cssSelector}){$rules};}`;
9050                          }
9051                        }
9052                      );
9053                    }
9054                    const styleVariationDeclarations = getStylesDeclarations(
9055                      styleVariations,
9056                      styleVariationSelector,
9057                      useRootPaddingAlign,
9058                      tree
9059                    );
9060                    if (styleVariationDeclarations.length) {
9061                      ruleset += `:root :where($styleVariationSelector}){$styleVariationDeclarations.join(
9062                        ";"
9063                      )};}`;
9064                    }
9065                    if (styleVariations?.css) {
9066                      ruleset += processCSSNesting(
9067                        styleVariations.css,
9068                        `:root :where($styleVariationSelector})`
9069                      );
9070                    }
9071                    if (hasLayoutSupport && styleVariations?.spacing?.blockGap) {
9072                      const variationSelectorWithBlock = styleVariationSelector + selector2;
9073                      ruleset += getLayoutStyles({
9074                        style: styleVariations,
9075                        selector: variationSelectorWithBlock,
9076                        hasBlockGapSupport: true,
9077                        hasFallbackGapSupport,
9078                        fallbackGapValue
9079                      });
9080                    }
9081                  }
9082                }
9083              );
9084            }
9085            const pseudoSelectorStyles = Object.entries(styles).filter(
9086              ([key]) => key.startsWith(":")
9087            );
9088            if (pseudoSelectorStyles?.length) {
9089              pseudoSelectorStyles.forEach(
9090                ([pseudoKey, pseudoStyle]) => {
9091                  const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
9092                  if (!pseudoDeclarations?.length) {
9093                    return;
9094                  }
9095                  const _selector = selector2.split(",").map((sel) => sel + pseudoKey).join(",");
9096                  const pseudoRule = `:root :where($_selector}){$pseudoDeclarations.join(
9097                    ";"
9098                  )};}`;
9099                  ruleset += pseudoRule;
9100                }
9101              );
9102            }
9103          }
9104        );
9105      }
9106      if (options.layoutStyles) {
9107        ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }";
9108        ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }";
9109        ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }";
9110      }
9111      if (options.blockGap && hasBlockGapSupport) {
9112        const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || "0.5em";
9113        ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: $gapValue}; margin-block-end: 0; }`;
9114        ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }";
9115        ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }";
9116      }
9117      if (options.presets) {
9118        nodesWithSettings.forEach(({ selector: selector2, presets }) => {
9119          if (ROOT_BLOCK_SELECTOR === selector2 || ROOT_CSS_PROPERTIES_SELECTOR === selector2) {
9120            selector2 = "";
9121          }
9122          const classes = getPresetsClasses(selector2, presets);
9123          if (classes.length > 0) {
9124            ruleset += classes;
9125          }
9126        });
9127      }
9128      return ruleset;
9129    };
9130    function generateSvgFilters(tree, blockSelectors) {
9131      const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
9132      return nodesWithSettings.flatMap(({ presets }) => {
9133        return getPresetsSvgFilters(presets);
9134      });
9135    }
9136    var getSelectorsConfig = (blockType, rootSelector) => {
9137      if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) {
9138        return blockType.selectors;
9139      }
9140      const config2 = {
9141        root: rootSelector
9142      };
9143      Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(
9144        ([featureKey, featureName]) => {
9145          const featureSelector = getBlockSelector(blockType, featureKey);
9146          if (featureSelector) {
9147            config2[featureName] = featureSelector;
9148          }
9149        }
9150      );
9151      return config2;
9152    };
9153    var getBlockSelectors = (blockTypes, variationInstanceId) => {
9154      const { getBlockStyles } = (0, import_data17.select)(import_blocks3.store);
9155      const result = {};
9156      blockTypes.forEach((blockType) => {
9157        const name2 = blockType.name;
9158        const selector2 = getBlockSelector(blockType);
9159        if (!selector2) {
9160          return;
9161        }
9162        let duotoneSelector = getBlockSelector(blockType, "filter.duotone");
9163        if (!duotoneSelector) {
9164          const rootSelector = getBlockSelector(blockType);
9165          const duotoneSupport = (0, import_blocks3.getBlockSupport)(
9166            blockType,
9167            "color.__experimentalDuotone",
9168            false
9169          );
9170          duotoneSelector = duotoneSupport && rootSelector && scopeSelector(rootSelector, duotoneSupport);
9171        }
9172        const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout;
9173        const fallbackGapValue = (
9174          // @ts-expect-error
9175          blockType?.supports?.spacing?.blockGap?.__experimentalDefault
9176        );
9177        const blockStyleVariations = getBlockStyles(name2);
9178        const styleVariationSelectors = {};
9179        blockStyleVariations?.forEach((variation) => {
9180          const variationSuffix = variationInstanceId ? `-$variationInstanceId}` : "";
9181          const variationName = `$variation.name}$variationSuffix}`;
9182          const styleVariationSelector = getBlockStyleVariationSelector(
9183            variationName,
9184            selector2
9185          );
9186          styleVariationSelectors[variationName] = styleVariationSelector;
9187        });
9188        const featureSelectors = getSelectorsConfig(blockType, selector2);
9189        result[name2] = {
9190          duotoneSelector: duotoneSelector ?? void 0,
9191          fallbackGapValue,
9192          featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0,
9193          hasLayoutSupport,
9194          name: name2,
9195          selector: selector2,
9196          styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0
9197        };
9198      });
9199      return result;
9200    };
9201    function updateConfigWithSeparator(config2) {
9202      const blocks = config2.styles?.blocks;
9203      const separatorBlock = blocks?.["core/separator"];
9204      const needsSeparatorStyleUpdate = separatorBlock && separatorBlock.color?.background && !separatorBlock.color?.text && !separatorBlock.border?.color;
9205      if (needsSeparatorStyleUpdate) {
9206        return {
9207          ...config2,
9208          styles: {
9209            ...config2.styles,
9210            blocks: {
9211              ...blocks,
9212              "core/separator": {
9213                ...separatorBlock,
9214                color: {
9215                  ...separatorBlock.color,
9216                  text: separatorBlock.color?.background
9217                }
9218              }
9219            }
9220          }
9221        };
9222      }
9223      return config2;
9224    }
9225    function processCSSNesting(css, blockSelector) {
9226      let processedCSS = "";
9227      if (!css || css.trim() === "") {
9228        return processedCSS;
9229      }
9230      const parts = css.split("&");
9231      parts.forEach((part) => {
9232        if (!part || part.trim() === "") {
9233          return;
9234        }
9235        const isRootCss = !part.includes("{");
9236        if (isRootCss) {
9237          processedCSS += `:root :where($blockSelector}){$part.trim()}}`;
9238        } else {
9239          const splitPart = part.replace("}", "").split("{");
9240          if (splitPart.length !== 2) {
9241            return;
9242          }
9243          const [nestedSelector, cssValue] = splitPart;
9244          const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/);
9245          const pseudoPart = matches ? matches[1] : "";
9246          const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim();
9247          let combinedSelector;
9248          if (withoutPseudoElement === "") {
9249            combinedSelector = blockSelector;
9250          } else {
9251            combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement);
9252          }
9253          processedCSS += `:root :where($combinedSelector})$pseudoPart}{$cssValue.trim()}}`;
9254        }
9255      });
9256      return processedCSS;
9257    }
9258    function generateGlobalStyles(config2 = {}, blockTypes = [], options = {}) {
9259      const {
9260        hasBlockGapSupport: hasBlockGapSupportOption,
9261        hasFallbackGapSupport: hasFallbackGapSupportOption,
9262        disableLayoutStyles = false,
9263        disableRootPadding = false,
9264        styleOptions = {}
9265      } = options;
9266      const blocks = blockTypes.length > 0 ? blockTypes : (0, import_blocks3.getBlockTypes)();
9267      const blockGap = getSetting(config2, "spacing.blockGap");
9268      const hasBlockGapSupport = hasBlockGapSupportOption ?? blockGap !== null;
9269      const hasFallbackGapSupport = hasFallbackGapSupportOption ?? !hasBlockGapSupport;
9270      if (!config2?.styles || !config2?.settings) {
9271        return [[], {}];
9272      }
9273      const updatedConfig = updateConfigWithSeparator(config2);
9274      const blockSelectors = getBlockSelectors(blocks);
9275      const customProperties = generateCustomProperties(
9276        updatedConfig,
9277        blockSelectors
9278      );
9279      const globalStyles = transformToStyles(
9280        updatedConfig,
9281        blockSelectors,
9282        hasBlockGapSupport,
9283        hasFallbackGapSupport,
9284        disableLayoutStyles,
9285        disableRootPadding,
9286        styleOptions
9287      );
9288      const svgs = generateSvgFilters(updatedConfig, blockSelectors);
9289      const styles = [
9290        {
9291          css: customProperties,
9292          isGlobalStyles: true
9293        },
9294        {
9295          css: globalStyles,
9296          isGlobalStyles: true
9297        },
9298        // 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.
9299        {
9300          css: updatedConfig?.styles?.css ?? "",
9301          isGlobalStyles: true
9302        },
9303        {
9304          assets: svgs,
9305          __unstableType: "svg",
9306          isGlobalStyles: true
9307        }
9308      ];
9309      blocks.forEach((blockType) => {
9310        const blockStyles = updatedConfig?.styles?.blocks?.[blockType.name];
9311        if (blockStyles?.css) {
9312          const selector2 = blockSelectors[blockType.name].selector;
9313          styles.push({
9314            css: processCSSNesting(blockStyles.css, selector2),
9315            isGlobalStyles: true
9316          });
9317        }
9318      });
9319      return [styles, updatedConfig.settings];
9320    }
9321  
9322    // packages/global-styles-ui/build-module/provider.mjs
9323    var import_element19 = __toESM(require_element(), 1);
9324  
9325    // packages/global-styles-ui/build-module/context.mjs
9326    var import_element18 = __toESM(require_element(), 1);
9327    var GlobalStylesContext = (0, import_element18.createContext)({
9328      user: { styles: {}, settings: {} },
9329      base: { styles: {}, settings: {} },
9330      merged: { styles: {}, settings: {} },
9331      onChange: () => {
9332      },
9333      fontLibraryEnabled: false
9334    });
9335  
9336    // packages/global-styles-ui/build-module/provider.mjs
9337    var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
9338    function GlobalStylesProvider({
9339      children,
9340      value,
9341      baseValue,
9342      onChange,
9343      fontLibraryEnabled
9344    }) {
9345      const merged = (0, import_element19.useMemo)(() => {
9346        return mergeGlobalStyles(baseValue, value);
9347      }, [baseValue, value]);
9348      const contextValue = (0, import_element19.useMemo)(
9349        () => ({
9350          user: value,
9351          base: baseValue,
9352          merged,
9353          onChange,
9354          fontLibraryEnabled
9355        }),
9356        [value, baseValue, merged, onChange, fontLibraryEnabled]
9357      );
9358      return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(GlobalStylesContext.Provider, { value: contextValue, children });
9359    }
9360  
9361    // packages/global-styles-ui/build-module/screen-root.mjs
9362    var import_components18 = __toESM(require_components(), 1);
9363    var import_i18n15 = __toESM(require_i18n(), 1);
9364    var import_data19 = __toESM(require_data(), 1);
9365    var import_core_data15 = __toESM(require_core_data(), 1);
9366  
9367    // packages/global-styles-ui/build-module/icon-with-current-color.mjs
9368    var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
9369    function IconWithCurrentColor({
9370      className,
9371      ...props
9372    }) {
9373      return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
9374        icon_default,
9375        {
9376          className: clsx_default(
9377            className,
9378            "global-styles-ui-icon-with-current-color"
9379          ),
9380          ...props
9381        }
9382      );
9383    }
9384  
9385    // packages/global-styles-ui/build-module/navigation-button.mjs
9386    var import_components12 = __toESM(require_components(), 1);
9387    var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1);
9388    function GenericNavigationButton({
9389      icon,
9390      children,
9391      ...props
9392    }) {
9393      return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_components12.__experimentalItem, { ...props, children: [
9394        icon && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_components12.__experimentalHStack, { justify: "flex-start", children: [
9395          /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(IconWithCurrentColor, { icon, size: 24 }),
9396          /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components12.FlexItem, { children })
9397        ] }),
9398        !icon && children
9399      ] });
9400    }
9401    function NavigationButtonAsItem(props) {
9402      return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_components12.Navigator.Button, { as: GenericNavigationButton, ...props });
9403    }
9404  
9405    // packages/global-styles-ui/build-module/root-menu.mjs
9406    var import_components13 = __toESM(require_components(), 1);
9407    var import_i18n13 = __toESM(require_i18n(), 1);
9408    var import_block_editor4 = __toESM(require_block_editor(), 1);
9409  
9410    // node_modules/colord/plugins/a11y.mjs
9411    var o2 = function(o3) {
9412      var t3 = o3 / 255;
9413      return t3 < 0.04045 ? t3 / 12.92 : Math.pow((t3 + 0.055) / 1.055, 2.4);
9414    };
9415    var t2 = function(t3) {
9416      return 0.2126 * o2(t3.r) + 0.7152 * o2(t3.g) + 0.0722 * o2(t3.b);
9417    };
9418    function a11y_default(o3) {
9419      o3.prototype.luminance = function() {
9420        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;
9421        var o4, r3, n2;
9422      }, o3.prototype.contrast = function(r3) {
9423        void 0 === r3 && (r3 = "#FFF");
9424        var n2, a2, i2, e2, v2, u2, d2, c6 = r3 instanceof o3 ? r3 : new o3(r3);
9425        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;
9426      }, o3.prototype.isReadable = function(o4, t3) {
9427        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);
9428        var r3, n2, a2, i2, e2;
9429      };
9430    }
9431  
9432    // packages/global-styles-ui/build-module/hooks.mjs
9433    var import_element20 = __toESM(require_element(), 1);
9434    var import_data18 = __toESM(require_data(), 1);
9435    var import_core_data14 = __toESM(require_core_data(), 1);
9436    var import_i18n12 = __toESM(require_i18n(), 1);
9437  
9438    // packages/global-styles-ui/build-module/utils.mjs
9439    function removePropertiesFromObject(object, properties) {
9440      if (!properties?.length) {
9441        return object;
9442      }
9443      if (typeof object !== "object" || !object || !Object.keys(object).length) {
9444        return object;
9445      }
9446      for (const key in object) {
9447        if (properties.includes(key)) {
9448          delete object[key];
9449        } else if (typeof object[key] === "object") {
9450          removePropertiesFromObject(object[key], properties);
9451        }
9452      }
9453      return object;
9454    }
9455    var filterObjectByProperties = (object, properties) => {
9456      if (!object || !properties?.length) {
9457        return {};
9458      }
9459      const newObject = {};
9460      Object.keys(object).forEach((key) => {
9461        if (properties.includes(key)) {
9462          newObject[key] = object[key];
9463        } else if (typeof object[key] === "object") {
9464          const newFilter = filterObjectByProperties(
9465            object[key],
9466            properties
9467          );
9468          if (Object.keys(newFilter).length) {
9469            newObject[key] = newFilter;
9470          }
9471        }
9472      });
9473      return newObject;
9474    };
9475    function isVariationWithProperties(variation, properties) {
9476      const variationWithProperties = filterObjectByProperties(
9477        structuredClone(variation),
9478        properties
9479      );
9480      return areGlobalStylesEqual(variationWithProperties, variation);
9481    }
9482    function getFontFamilyFromSetting(fontFamilies, setting) {
9483      if (!Array.isArray(fontFamilies) || !setting) {
9484        return null;
9485      }
9486      const fontFamilyVariable = setting.replace("var(", "").replace(")", "");
9487      const fontFamilySlug = fontFamilyVariable?.split("--").slice(-1)[0];
9488      return fontFamilies.find(
9489        (fontFamily) => fontFamily.slug === fontFamilySlug
9490      );
9491    }
9492    function getFontFamilies(themeJson) {
9493      const themeFontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme;
9494      const customFontFamilies = themeJson?.settings?.typography?.fontFamilies?.custom;
9495      let fontFamilies = [];
9496      if (themeFontFamilies && customFontFamilies) {
9497        fontFamilies = [...themeFontFamilies, ...customFontFamilies];
9498      } else if (themeFontFamilies) {
9499        fontFamilies = themeFontFamilies;
9500      } else if (customFontFamilies) {
9501        fontFamilies = customFontFamilies;
9502      }
9503      const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
9504      const bodyFontFamily = getFontFamilyFromSetting(
9505        fontFamilies,
9506        bodyFontFamilySetting
9507      );
9508      const headingFontFamilySetting = themeJson?.styles?.elements?.heading?.typography?.fontFamily;
9509      let headingFontFamily;
9510      if (!headingFontFamilySetting) {
9511        headingFontFamily = bodyFontFamily;
9512      } else {
9513        headingFontFamily = getFontFamilyFromSetting(
9514          fontFamilies,
9515          themeJson?.styles?.elements?.heading?.typography?.fontFamily
9516        );
9517      }
9518      return [bodyFontFamily, headingFontFamily];
9519    }
9520  
9521    // packages/global-styles-ui/build-module/hooks.mjs
9522    k([a11y_default]);
9523    function useStyle2(path, blockName, readFrom = "merged", shouldDecodeEncode = true) {
9524      const { user, base, merged, onChange } = (0, import_element20.useContext)(GlobalStylesContext);
9525      let sourceValue = merged;
9526      if (readFrom === "base") {
9527        sourceValue = base;
9528      } else if (readFrom === "user") {
9529        sourceValue = user;
9530      }
9531      const styleValue = (0, import_element20.useMemo)(
9532        () => getStyle(sourceValue, path, blockName, shouldDecodeEncode),
9533        [sourceValue, path, blockName, shouldDecodeEncode]
9534      );
9535      const setStyleValue = (0, import_element20.useCallback)(
9536        (newValue) => {
9537          const newGlobalStyles = setStyle(
9538            user,
9539            path,
9540            newValue,
9541            blockName
9542          );
9543          onChange(newGlobalStyles);
9544        },
9545        [user, onChange, path, blockName]
9546      );
9547      return [styleValue, setStyleValue];
9548    }
9549    function useSetting(path, blockName, readFrom = "merged") {
9550      const { user, base, merged, onChange } = (0, import_element20.useContext)(GlobalStylesContext);
9551      let sourceValue = merged;
9552      if (readFrom === "base") {
9553        sourceValue = base;
9554      } else if (readFrom === "user") {
9555        sourceValue = user;
9556      }
9557      const settingValue = (0, import_element20.useMemo)(
9558        () => getSetting(sourceValue, path, blockName),
9559        [sourceValue, path, blockName]
9560      );
9561      const setSettingValue = (0, import_element20.useCallback)(
9562        (newValue) => {
9563          const newGlobalStyles = setSetting(
9564            user,
9565            path,
9566            newValue,
9567            blockName
9568          );
9569          onChange(newGlobalStyles);
9570        },
9571        [user, onChange, path, blockName]
9572      );
9573      return [settingValue, setSettingValue];
9574    }
9575    var EMPTY_ARRAY3 = [];
9576    function hasThemeVariation({
9577      title,
9578      settings: settings2,
9579      styles
9580    }) {
9581      return title === (0, import_i18n12.__)("Default") || Object.keys(settings2 || {}).length > 0 || Object.keys(styles || {}).length > 0;
9582    }
9583    function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
9584      const { variationsFromTheme } = (0, import_data18.useSelect)((select3) => {
9585        const _variationsFromTheme = select3(
9586          import_core_data14.store
9587        ).__experimentalGetCurrentThemeGlobalStylesVariations?.();
9588        return {
9589          variationsFromTheme: _variationsFromTheme || EMPTY_ARRAY3
9590        };
9591      }, []);
9592      const { user: userVariation } = (0, import_element20.useContext)(GlobalStylesContext);
9593      return (0, import_element20.useMemo)(() => {
9594        const clonedUserVariation = structuredClone(userVariation);
9595        const userVariationWithoutProperties = removePropertiesFromObject(
9596          clonedUserVariation,
9597          properties
9598        );
9599        userVariationWithoutProperties.title = (0, import_i18n12.__)("Default");
9600        const variationsWithPropertiesAndBase = variationsFromTheme.filter((variation) => {
9601          return isVariationWithProperties(variation, properties);
9602        }).map((variation) => {
9603          return mergeGlobalStyles(
9604            userVariationWithoutProperties,
9605            variation
9606          );
9607        });
9608        const variationsByProperties = [
9609          userVariationWithoutProperties,
9610          ...variationsWithPropertiesAndBase
9611        ];
9612        return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
9613      }, [properties, userVariation, variationsFromTheme]);
9614    }
9615  
9616    // packages/global-styles-ui/build-module/lock-unlock.mjs
9617    var import_private_apis2 = __toESM(require_private_apis(), 1);
9618    var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
9619      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
9620      "@wordpress/global-styles-ui"
9621    );
9622  
9623    // packages/global-styles-ui/build-module/root-menu.mjs
9624    var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
9625    var {
9626      useHasDimensionsPanel,
9627      useHasTypographyPanel,
9628      useHasColorPanel,
9629      useSettingsForBlockElement,
9630      useHasBackgroundPanel
9631    } = unlock2(import_block_editor4.privateApis);
9632  
9633    // packages/global-styles-ui/build-module/preview-styles.mjs
9634    var import_components17 = __toESM(require_components(), 1);
9635  
9636    // packages/global-styles-ui/build-module/preview-hooks.mjs
9637    function useStylesPreviewColors() {
9638      const [textColor = "black"] = useStyle2("color.text");
9639      const [backgroundColor = "white"] = useStyle2("color.background");
9640      const [headingColor = textColor] = useStyle2(
9641        "elements.h1.color.text"
9642      );
9643      const [linkColor = headingColor] = useStyle2(
9644        "elements.link.color.text"
9645      );
9646      const [buttonBackgroundColor = linkColor] = useStyle2(
9647        "elements.button.color.background"
9648      );
9649      const [coreColors] = useSetting("color.palette.core") || [];
9650      const [themeColors] = useSetting("color.palette.theme") || [];
9651      const [customColors] = useSetting("color.palette.custom") || [];
9652      const paletteColors = (themeColors ?? []).concat(customColors ?? []).concat(coreColors ?? []);
9653      const textColorObject = paletteColors.filter(
9654        ({ color }) => color === textColor
9655      );
9656      const buttonBackgroundColorObject = paletteColors.filter(
9657        ({ color }) => color === buttonBackgroundColor
9658      );
9659      const highlightedColors = textColorObject.concat(buttonBackgroundColorObject).concat(paletteColors).filter(
9660        // we exclude these background color because it is already visible in the preview.
9661        ({ color }) => color !== backgroundColor
9662      ).slice(0, 2);
9663      return {
9664        paletteColors,
9665        highlightedColors
9666      };
9667    }
9668  
9669    // packages/global-styles-ui/build-module/typography-example.mjs
9670    var import_element21 = __toESM(require_element(), 1);
9671    var import_components14 = __toESM(require_components(), 1);
9672    var import_i18n14 = __toESM(require_i18n(), 1);
9673  
9674    // packages/global-styles-ui/build-module/font-library/utils/preview-styles.mjs
9675    function findNearest(input, numbers) {
9676      if (numbers.length === 0) {
9677        return null;
9678      }
9679      numbers.sort((a2, b2) => Math.abs(input - a2) - Math.abs(input - b2));
9680      return numbers[0];
9681    }
9682    function extractFontWeights(fontFaces) {
9683      const result = [];
9684      fontFaces.forEach((face) => {
9685        const weights = String(face.fontWeight).split(" ");
9686        if (weights.length === 2) {
9687          const start2 = parseInt(weights[0]);
9688          const end = parseInt(weights[1]);
9689          for (let i2 = start2; i2 <= end; i2 += 100) {
9690            result.push(i2);
9691          }
9692        } else if (weights.length === 1) {
9693          result.push(parseInt(weights[0]));
9694        }
9695      });
9696      return result;
9697    }
9698    function formatFontFamily(input) {
9699      const regex = /^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/;
9700      const output = input.trim();
9701      const formatItem = (item) => {
9702        item = item.trim();
9703        if (item.match(regex)) {
9704          item = item.replace(/^["']|["']$/g, "");
9705          return `"$item}"`;
9706        }
9707        return item;
9708      };
9709      if (output.includes(",")) {
9710        return output.split(",").map(formatItem).filter((item) => item !== "").join(", ");
9711      }
9712      return formatItem(output);
9713    }
9714    function getFamilyPreviewStyle(family) {
9715      const style = {
9716        fontFamily: formatFontFamily(family.fontFamily)
9717      };
9718      if (!("fontFace" in family) || !Array.isArray(family.fontFace)) {
9719        style.fontWeight = "400";
9720        style.fontStyle = "normal";
9721        return style;
9722      }
9723      if (family.fontFace) {
9724        const normalFaces = family.fontFace.filter(
9725          (face) => face?.fontStyle && face.fontStyle.toLowerCase() === "normal"
9726        );
9727        if (normalFaces.length > 0) {
9728          style.fontStyle = "normal";
9729          const normalWeights = extractFontWeights(normalFaces);
9730          const nearestWeight = findNearest(400, normalWeights);
9731          style.fontWeight = String(nearestWeight) || "400";
9732        } else {
9733          style.fontStyle = family.fontFace.length && family.fontFace[0].fontStyle || "normal";
9734          style.fontWeight = family.fontFace.length && String(family.fontFace[0].fontWeight) || "400";
9735        }
9736      }
9737      return style;
9738    }
9739  
9740    // packages/global-styles-ui/build-module/typography-example.mjs
9741    var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
9742    function PreviewTypography({
9743      fontSize,
9744      variation
9745    }) {
9746      const { base } = (0, import_element21.useContext)(GlobalStylesContext);
9747      let config2 = base;
9748      if (variation) {
9749        config2 = { ...base, ...variation };
9750      }
9751      const [textColor] = useStyle2("color.text");
9752      const [bodyFontFamilies, headingFontFamilies] = getFontFamilies(config2);
9753      const bodyPreviewStyle = bodyFontFamilies ? getFamilyPreviewStyle(bodyFontFamilies) : {};
9754      const headingPreviewStyle = headingFontFamilies ? getFamilyPreviewStyle(headingFontFamilies) : {};
9755      if (textColor) {
9756        bodyPreviewStyle.color = textColor;
9757        headingPreviewStyle.color = textColor;
9758      }
9759      if (fontSize) {
9760        bodyPreviewStyle.fontSize = fontSize;
9761        headingPreviewStyle.fontSize = fontSize;
9762      }
9763      return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
9764        import_components14.__unstableMotion.div,
9765        {
9766          animate: {
9767            scale: 1,
9768            opacity: 1
9769          },
9770          initial: {
9771            scale: 0.1,
9772            opacity: 0
9773          },
9774          transition: {
9775            delay: 0.3,
9776            type: "tween"
9777          },
9778          style: {
9779            textAlign: "center",
9780            lineHeight: 1
9781          },
9782          children: [
9783            /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { style: headingPreviewStyle, children: (0, import_i18n14._x)("A", "Uppercase letter A") }),
9784            /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { style: bodyPreviewStyle, children: (0, import_i18n14._x)("a", "Lowercase letter A") })
9785          ]
9786        }
9787      );
9788    }
9789  
9790    // packages/global-styles-ui/build-module/highlighted-colors.mjs
9791    var import_components15 = __toESM(require_components(), 1);
9792    var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
9793    function HighlightedColors({
9794      normalizedColorSwatchSize,
9795      ratio
9796    }) {
9797      const { highlightedColors } = useStylesPreviewColors();
9798      const scaledSwatchSize = normalizedColorSwatchSize * ratio;
9799      return highlightedColors.map(({ slug, color }, index) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9800        import_components15.__unstableMotion.div,
9801        {
9802          style: {
9803            height: scaledSwatchSize,
9804            width: scaledSwatchSize,
9805            background: color,
9806            borderRadius: scaledSwatchSize / 2
9807          },
9808          animate: {
9809            scale: 1,
9810            opacity: 1
9811          },
9812          initial: {
9813            scale: 0.1,
9814            opacity: 0
9815          },
9816          transition: {
9817            delay: index === 1 ? 0.2 : 0.1
9818          }
9819        },
9820        `$slug}-$index}`
9821      ));
9822    }
9823  
9824    // packages/global-styles-ui/build-module/preview-wrapper.mjs
9825    var import_components16 = __toESM(require_components(), 1);
9826    var import_compose3 = __toESM(require_compose(), 1);
9827    var import_element22 = __toESM(require_element(), 1);
9828    var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
9829    var normalizedWidth = 248;
9830    var normalizedHeight = 152;
9831    var THROTTLE_OPTIONS = {
9832      leading: true,
9833      trailing: true
9834    };
9835    function PreviewWrapper({
9836      children,
9837      label,
9838      isFocused,
9839      withHoverView
9840    }) {
9841      const [backgroundColor = "white"] = useStyle2("color.background");
9842      const [gradientValue] = useStyle2("color.gradient");
9843      const disableMotion = (0, import_compose3.useReducedMotion)();
9844      const [isHovered, setIsHovered] = (0, import_element22.useState)(false);
9845      const [containerResizeListener, { width }] = (0, import_compose3.useResizeObserver)();
9846      const [throttledWidth, setThrottledWidthState] = (0, import_element22.useState)(width);
9847      const [ratioState, setRatioState] = (0, import_element22.useState)();
9848      const setThrottledWidth = (0, import_compose3.useThrottle)(
9849        setThrottledWidthState,
9850        250,
9851        THROTTLE_OPTIONS
9852      );
9853      (0, import_element22.useLayoutEffect)(() => {
9854        if (width) {
9855          setThrottledWidth(width);
9856        }
9857      }, [width, setThrottledWidth]);
9858      (0, import_element22.useLayoutEffect)(() => {
9859        const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
9860        const ratioDiff = newRatio - (ratioState || 0);
9861        const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1;
9862        if (isRatioDiffBigEnough || !ratioState) {
9863          setRatioState(newRatio);
9864        }
9865      }, [throttledWidth, ratioState]);
9866      const fallbackRatio = width ? width / normalizedWidth : 1;
9867      const ratio = ratioState ? ratioState : fallbackRatio;
9868      const isReady = !!width;
9869      return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
9870        /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { style: { position: "relative" }, children: containerResizeListener }),
9871        isReady && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9872          "div",
9873          {
9874            className: "global-styles-ui-preview__wrapper",
9875            style: {
9876              height: normalizedHeight * ratio
9877            },
9878            onMouseEnter: () => setIsHovered(true),
9879            onMouseLeave: () => setIsHovered(false),
9880            tabIndex: -1,
9881            children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9882              import_components16.__unstableMotion.div,
9883              {
9884                style: {
9885                  height: normalizedHeight * ratio,
9886                  width: "100%",
9887                  background: gradientValue ?? backgroundColor,
9888                  cursor: withHoverView ? "pointer" : void 0
9889                },
9890                initial: "start",
9891                animate: (isHovered || isFocused) && !disableMotion && label ? "hover" : "start",
9892                children: [].concat(children).map(
9893                  (child, key) => child({ ratio, key })
9894                )
9895              }
9896            )
9897          }
9898        )
9899      ] });
9900    }
9901    var preview_wrapper_default = PreviewWrapper;
9902  
9903    // packages/global-styles-ui/build-module/preview-styles.mjs
9904    var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
9905    var firstFrameVariants = {
9906      start: {
9907        scale: 1,
9908        opacity: 1
9909      },
9910      hover: {
9911        scale: 0,
9912        opacity: 0
9913      }
9914    };
9915    var midFrameVariants = {
9916      hover: {
9917        opacity: 1
9918      },
9919      start: {
9920        opacity: 0.5
9921      }
9922    };
9923    var secondFrameVariants = {
9924      hover: {
9925        scale: 1,
9926        opacity: 1
9927      },
9928      start: {
9929        scale: 0,
9930        opacity: 0
9931      }
9932    };
9933    function PreviewStyles({
9934      label,
9935      isFocused,
9936      withHoverView,
9937      variation
9938    }) {
9939      const [fontWeight] = useStyle2("typography.fontWeight");
9940      const [fontFamily = "serif"] = useStyle2(
9941        "typography.fontFamily"
9942      );
9943      const [headingFontFamily = fontFamily] = useStyle2(
9944        "elements.h1.typography.fontFamily"
9945      );
9946      const [headingFontWeight = fontWeight] = useStyle2(
9947        "elements.h1.typography.fontWeight"
9948      );
9949      const [textColor = "black"] = useStyle2("color.text");
9950      const [headingColor = textColor] = useStyle2(
9951        "elements.h1.color.text"
9952      );
9953      const { paletteColors } = useStylesPreviewColors();
9954      return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
9955        preview_wrapper_default,
9956        {
9957          label,
9958          isFocused,
9959          withHoverView,
9960          children: [
9961            ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9962              import_components17.__unstableMotion.div,
9963              {
9964                variants: firstFrameVariants,
9965                style: {
9966                  height: "100%",
9967                  overflow: "hidden"
9968                },
9969                children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
9970                  import_components17.__experimentalHStack,
9971                  {
9972                    spacing: 10 * ratio,
9973                    justify: "center",
9974                    style: {
9975                      height: "100%",
9976                      overflow: "hidden"
9977                    },
9978                    children: [
9979                      /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9980                        PreviewTypography,
9981                        {
9982                          fontSize: 65 * ratio,
9983                          variation
9984                        }
9985                      ),
9986                      /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_components17.__experimentalVStack, { spacing: 4 * ratio, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9987                        HighlightedColors,
9988                        {
9989                          normalizedColorSwatchSize: 32,
9990                          ratio
9991                        }
9992                      ) })
9993                    ]
9994                  }
9995                )
9996              },
9997              key
9998            ),
9999            ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10000              import_components17.__unstableMotion.div,
10001              {
10002                variants: withHoverView ? midFrameVariants : void 0,
10003                style: {
10004                  height: "100%",
10005                  width: "100%",
10006                  position: "absolute",
10007                  top: 0,
10008                  overflow: "hidden",
10009                  filter: "blur(60px)",
10010                  opacity: 0.1
10011                },
10012                children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10013                  import_components17.__experimentalHStack,
10014                  {
10015                    spacing: 0,
10016                    justify: "flex-start",
10017                    style: {
10018                      height: "100%",
10019                      overflow: "hidden"
10020                    },
10021                    children: paletteColors.slice(0, 4).map(({ color }, index) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10022                      "div",
10023                      {
10024                        style: {
10025                          height: "100%",
10026                          background: color,
10027                          flexGrow: 1
10028                        }
10029                      },
10030                      index
10031                    ))
10032                  }
10033                )
10034              },
10035              key
10036            ),
10037            ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10038              import_components17.__unstableMotion.div,
10039              {
10040                variants: secondFrameVariants,
10041                style: {
10042                  height: "100%",
10043                  width: "100%",
10044                  overflow: "hidden",
10045                  position: "absolute",
10046                  top: 0
10047                },
10048                children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10049                  import_components17.__experimentalVStack,
10050                  {
10051                    spacing: 3 * ratio,
10052                    justify: "center",
10053                    style: {
10054                      height: "100%",
10055                      overflow: "hidden",
10056                      padding: 10 * ratio,
10057                      boxSizing: "border-box"
10058                    },
10059                    children: label && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
10060                      "div",
10061                      {
10062                        style: {
10063                          fontSize: 40 * ratio,
10064                          fontFamily: headingFontFamily,
10065                          color: headingColor,
10066                          fontWeight: headingFontWeight,
10067                          lineHeight: "1em",
10068                          textAlign: "center"
10069                        },
10070                        children: label
10071                      }
10072                    )
10073                  }
10074                )
10075              },
10076              key
10077            )
10078          ]
10079        }
10080      );
10081    }
10082    var preview_styles_default = PreviewStyles;
10083  
10084    // packages/global-styles-ui/build-module/screen-root.mjs
10085    var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
10086  
10087    // packages/global-styles-ui/build-module/screen-block-list.mjs
10088    var import_blocks5 = __toESM(require_blocks(), 1);
10089    var import_i18n17 = __toESM(require_i18n(), 1);
10090    var import_components21 = __toESM(require_components(), 1);
10091    var import_data21 = __toESM(require_data(), 1);
10092    var import_element23 = __toESM(require_element(), 1);
10093    var import_block_editor5 = __toESM(require_block_editor(), 1);
10094    var import_compose4 = __toESM(require_compose(), 1);
10095    var import_a11y2 = __toESM(require_a11y(), 1);
10096  
10097    // packages/global-styles-ui/build-module/variations/variations-panel.mjs
10098    var import_blocks4 = __toESM(require_blocks(), 1);
10099    var import_data20 = __toESM(require_data(), 1);
10100    var import_components19 = __toESM(require_components(), 1);
10101    var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
10102    function getFilteredBlockStyles(blockStyles, variations) {
10103      return blockStyles?.filter(
10104        (style) => style.source === "block" || variations.includes(style.name)
10105      ) || [];
10106    }
10107    function useBlockVariations(name2) {
10108      const blockStyles = (0, import_data20.useSelect)(
10109        (select3) => {
10110          const { getBlockStyles } = select3(import_blocks4.store);
10111          return getBlockStyles(name2);
10112        },
10113        [name2]
10114      );
10115      const [variations] = useStyle2("variations", name2);
10116      const variationNames = Object.keys(variations ?? {});
10117      return getFilteredBlockStyles(blockStyles, variationNames);
10118    }
10119  
10120    // packages/global-styles-ui/build-module/screen-header.mjs
10121    var import_components20 = __toESM(require_components(), 1);
10122    var import_i18n16 = __toESM(require_i18n(), 1);
10123    var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
10124  
10125    // packages/global-styles-ui/build-module/screen-block-list.mjs
10126    var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
10127    var {
10128      useHasDimensionsPanel: useHasDimensionsPanel2,
10129      useHasTypographyPanel: useHasTypographyPanel2,
10130      useHasBorderPanel,
10131      useSettingsForBlockElement: useSettingsForBlockElement2,
10132      useHasColorPanel: useHasColorPanel2
10133    } = unlock2(import_block_editor5.privateApis);
10134    function useSortedBlockTypes() {
10135      const blockItems = (0, import_data21.useSelect)(
10136        (select3) => select3(import_blocks5.store).getBlockTypes(),
10137        []
10138      );
10139      const groupByType = (blocks, block) => {
10140        const { core, noncore } = blocks;
10141        const type = block.name.startsWith("core/") ? core : noncore;
10142        type.push(block);
10143        return blocks;
10144      };
10145      const { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(
10146        groupByType,
10147        { core: [], noncore: [] }
10148      );
10149      return [...coreItems, ...nonCoreItems];
10150    }
10151    function useBlockHasGlobalStyles(blockName) {
10152      const [rawSettings] = useSetting("", blockName);
10153      const settings2 = useSettingsForBlockElement2(rawSettings, blockName);
10154      const hasTypographyPanel = useHasTypographyPanel2(settings2);
10155      const hasColorPanel = useHasColorPanel2(settings2);
10156      const hasBorderPanel = useHasBorderPanel(settings2);
10157      const hasDimensionsPanel = useHasDimensionsPanel2(settings2);
10158      const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
10159      const hasVariationsPanel = !!useBlockVariations(blockName)?.length;
10160      const hasGlobalStyles = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel;
10161      return hasGlobalStyles;
10162    }
10163    function BlockMenuItem({ block }) {
10164      const hasBlockMenuItem = useBlockHasGlobalStyles(block.name);
10165      if (!hasBlockMenuItem) {
10166        return null;
10167      }
10168      return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
10169        NavigationButtonAsItem,
10170        {
10171          path: "/blocks/" + encodeURIComponent(block.name),
10172          children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_components21.__experimentalHStack, { justify: "flex-start", children: [
10173            /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_block_editor5.BlockIcon, { icon: block.icon }),
10174            /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_components21.FlexItem, { children: block.title })
10175          ] })
10176        }
10177      );
10178    }
10179    function BlockList({ filterValue }) {
10180      const sortedBlockTypes = useSortedBlockTypes();
10181      const debouncedSpeak = (0, import_compose4.useDebounce)(import_a11y2.speak, 500);
10182      const { isMatchingSearchTerm } = (0, import_data21.useSelect)(import_blocks5.store);
10183      const filteredBlockTypes = !filterValue ? sortedBlockTypes : sortedBlockTypes.filter(
10184        (blockType) => isMatchingSearchTerm(blockType, filterValue)
10185      );
10186      const blockTypesListRef = (0, import_element23.useRef)(null);
10187      (0, import_element23.useEffect)(() => {
10188        if (!filterValue) {
10189          return;
10190        }
10191        const count = blockTypesListRef.current?.childElementCount || 0;
10192        const resultsFoundMessage = (0, import_i18n17.sprintf)(
10193          /* translators: %d: number of results. */
10194          (0, import_i18n17._n)("%d result found.", "%d results found.", count),
10195          count
10196        );
10197        debouncedSpeak(resultsFoundMessage, "polite");
10198      }, [filterValue, debouncedSpeak]);
10199      return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
10200        "div",
10201        {
10202          ref: blockTypesListRef,
10203          className: "global-styles-ui-block-types-item-list",
10204          role: "list",
10205          children: filteredBlockTypes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_components21.__experimentalText, { align: "center", as: "p", children: (0, import_i18n17.__)("No blocks found.") }) : filteredBlockTypes.map((block) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
10206            BlockMenuItem,
10207            {
10208              block
10209            },
10210            "menu-itemblock-" + block.name
10211          ))
10212        }
10213      );
10214    }
10215    var MemoizedBlockList = (0, import_element23.memo)(BlockList);
10216  
10217    // packages/global-styles-ui/build-module/screen-block.mjs
10218    var import_blocks7 = __toESM(require_blocks(), 1);
10219    var import_block_editor7 = __toESM(require_block_editor(), 1);
10220    var import_element25 = __toESM(require_element(), 1);
10221    var import_data22 = __toESM(require_data(), 1);
10222    var import_core_data16 = __toESM(require_core_data(), 1);
10223    var import_components24 = __toESM(require_components(), 1);
10224    var import_i18n18 = __toESM(require_i18n(), 1);
10225  
10226    // packages/global-styles-ui/build-module/block-preview-panel.mjs
10227    var import_block_editor6 = __toESM(require_block_editor(), 1);
10228    var import_blocks6 = __toESM(require_blocks(), 1);
10229    var import_components22 = __toESM(require_components(), 1);
10230    var import_element24 = __toESM(require_element(), 1);
10231    var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
10232  
10233    // packages/global-styles-ui/build-module/subtitle.mjs
10234    var import_components23 = __toESM(require_components(), 1);
10235    var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
10236    function Subtitle({ children, level = 2 }) {
10237      return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_components23.__experimentalHeading, { className: "global-styles-ui-subtitle", level, children });
10238    }
10239  
10240    // packages/global-styles-ui/build-module/screen-block.mjs
10241    var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
10242    var {
10243      useHasDimensionsPanel: useHasDimensionsPanel3,
10244      useHasTypographyPanel: useHasTypographyPanel3,
10245      useHasBorderPanel: useHasBorderPanel2,
10246      useSettingsForBlockElement: useSettingsForBlockElement3,
10247      useHasColorPanel: useHasColorPanel3,
10248      useHasFiltersPanel,
10249      useHasImageSettingsPanel,
10250      useHasBackgroundPanel: useHasBackgroundPanel2,
10251      BackgroundPanel: StylesBackgroundPanel,
10252      BorderPanel: StylesBorderPanel,
10253      ColorPanel: StylesColorPanel,
10254      TypographyPanel: StylesTypographyPanel,
10255      DimensionsPanel: StylesDimensionsPanel,
10256      FiltersPanel: StylesFiltersPanel,
10257      ImageSettingsPanel,
10258      AdvancedPanel: StylesAdvancedPanel
10259    } = unlock2(import_block_editor7.privateApis);
10260  
10261    // packages/global-styles-ui/build-module/screen-typography.mjs
10262    var import_i18n32 = __toESM(require_i18n(), 1);
10263    var import_components44 = __toESM(require_components(), 1);
10264    var import_element36 = __toESM(require_element(), 1);
10265  
10266    // packages/global-styles-ui/build-module/screen-body.mjs
10267    var import_components25 = __toESM(require_components(), 1);
10268    var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
10269  
10270    // packages/global-styles-ui/build-module/typography-elements.mjs
10271    var import_i18n19 = __toESM(require_i18n(), 1);
10272    var import_components26 = __toESM(require_components(), 1);
10273    var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
10274  
10275    // packages/global-styles-ui/build-module/variations/variations-typography.mjs
10276    var import_components29 = __toESM(require_components(), 1);
10277  
10278    // packages/global-styles-ui/build-module/preview-typography.mjs
10279    var import_components27 = __toESM(require_components(), 1);
10280    var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
10281    var StylesPreviewTypography = ({
10282      variation,
10283      isFocused,
10284      withHoverView
10285    }) => {
10286      return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
10287        preview_wrapper_default,
10288        {
10289          label: variation.title,
10290          isFocused,
10291          withHoverView,
10292          children: ({ ratio, key }) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
10293            import_components27.__experimentalHStack,
10294            {
10295              spacing: 10 * ratio,
10296              justify: "center",
10297              style: {
10298                height: "100%",
10299                overflow: "hidden"
10300              },
10301              children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
10302                PreviewTypography,
10303                {
10304                  variation,
10305                  fontSize: 85 * ratio
10306                }
10307              )
10308            },
10309            key
10310          )
10311        }
10312      );
10313    };
10314    var preview_typography_default = StylesPreviewTypography;
10315  
10316    // packages/global-styles-ui/build-module/variations/variation.mjs
10317    var import_components28 = __toESM(require_components(), 1);
10318    var import_element26 = __toESM(require_element(), 1);
10319    var import_keycodes3 = __toESM(require_keycodes(), 1);
10320    var import_i18n20 = __toESM(require_i18n(), 1);
10321    var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
10322    function Variation({
10323      variation,
10324      children,
10325      isPill = false,
10326      properties,
10327      showTooltip = false
10328    }) {
10329      const [isFocused, setIsFocused] = (0, import_element26.useState)(false);
10330      const {
10331        base,
10332        user,
10333        onChange: setUserConfig
10334      } = (0, import_element26.useContext)(GlobalStylesContext);
10335      const context = (0, import_element26.useMemo)(() => {
10336        let merged = mergeGlobalStyles(base, variation);
10337        if (properties) {
10338          merged = filterObjectByProperties(merged, properties);
10339        }
10340        return {
10341          user: variation,
10342          base,
10343          merged,
10344          onChange: () => {
10345          }
10346        };
10347      }, [variation, base, properties]);
10348      const selectVariation = () => setUserConfig(variation);
10349      const selectOnEnter = (event) => {
10350        if (event.keyCode === import_keycodes3.ENTER) {
10351          event.preventDefault();
10352          selectVariation();
10353        }
10354      };
10355      const isActive = (0, import_element26.useMemo)(
10356        () => areGlobalStylesEqual(user, variation),
10357        [user, variation]
10358      );
10359      let label = variation?.title;
10360      if (variation?.description) {
10361        label = (0, import_i18n20.sprintf)(
10362          /* translators: 1: variation title. 2: variation description. */
10363          (0, import_i18n20._x)("%1$s (%2$s)", "variation label"),
10364          variation?.title,
10365          variation?.description
10366        );
10367      }
10368      const content = /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
10369        "div",
10370        {
10371          className: clsx_default("global-styles-ui-variations_item", {
10372            "is-active": isActive
10373          }),
10374          role: "button",
10375          onClick: selectVariation,
10376          onKeyDown: selectOnEnter,
10377          tabIndex: 0,
10378          "aria-label": label,
10379          "aria-current": isActive,
10380          onFocus: () => setIsFocused(true),
10381          onBlur: () => setIsFocused(false),
10382          children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
10383            "div",
10384            {
10385              className: clsx_default("global-styles-ui-variations_item-preview", {
10386                "is-pill": isPill
10387              }),
10388              children: children(isFocused)
10389            }
10390          )
10391        }
10392      );
10393      return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(GlobalStylesContext.Provider, { value: context, children: showTooltip ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_components28.Tooltip, { text: variation?.title, children: content }) : content });
10394    }
10395  
10396    // packages/global-styles-ui/build-module/variations/variations-typography.mjs
10397    var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
10398    var propertiesToFilter = ["typography"];
10399    function TypographyVariations({
10400      title,
10401      gap = 2
10402    }) {
10403      const typographyVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter);
10404      if (typographyVariations?.length <= 1) {
10405        return null;
10406      }
10407      return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_components29.__experimentalVStack, { spacing: 3, children: [
10408        title && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Subtitle, { level: 3, children: title }),
10409        /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
10410          import_components29.__experimentalGrid,
10411          {
10412            columns: 3,
10413            gap,
10414            className: "global-styles-ui-style-variations-container",
10415            children: typographyVariations.map(
10416              (variation, index) => {
10417                return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
10418                  Variation,
10419                  {
10420                    variation,
10421                    properties: propertiesToFilter,
10422                    showTooltip: true,
10423                    children: () => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
10424                      preview_typography_default,
10425                      {
10426                        variation
10427                      }
10428                    )
10429                  },
10430                  index
10431                );
10432              }
10433            )
10434          }
10435        )
10436      ] });
10437    }
10438  
10439    // packages/global-styles-ui/build-module/font-families.mjs
10440    var import_i18n30 = __toESM(require_i18n(), 1);
10441    var import_components42 = __toESM(require_components(), 1);
10442    var import_element35 = __toESM(require_element(), 1);
10443  
10444    // packages/global-styles-ui/build-module/font-library/context.mjs
10445    var import_element27 = __toESM(require_element(), 1);
10446    var import_data23 = __toESM(require_data(), 1);
10447    var import_core_data18 = __toESM(require_core_data(), 1);
10448    var import_i18n22 = __toESM(require_i18n(), 1);
10449  
10450    // packages/global-styles-ui/build-module/font-library/api.mjs
10451    var import_api_fetch2 = __toESM(require_api_fetch(), 1);
10452    var import_core_data17 = __toESM(require_core_data(), 1);
10453  
10454    // packages/global-styles-ui/build-module/font-library/utils/index.mjs
10455    var import_components30 = __toESM(require_components(), 1);
10456  
10457    // packages/global-styles-ui/build-module/font-library/utils/constants.mjs
10458    var import_i18n21 = __toESM(require_i18n(), 1);
10459    var FONT_WEIGHTS = {
10460      100: (0, import_i18n21._x)("Thin", "font weight"),
10461      200: (0, import_i18n21._x)("Extra-light", "font weight"),
10462      300: (0, import_i18n21._x)("Light", "font weight"),
10463      400: (0, import_i18n21._x)("Normal", "font weight"),
10464      500: (0, import_i18n21._x)("Medium", "font weight"),
10465      600: (0, import_i18n21._x)("Semi-bold", "font weight"),
10466      700: (0, import_i18n21._x)("Bold", "font weight"),
10467      800: (0, import_i18n21._x)("Extra-bold", "font weight"),
10468      900: (0, import_i18n21._x)("Black", "font weight")
10469    };
10470    var FONT_STYLES = {
10471      normal: (0, import_i18n21._x)("Normal", "font style"),
10472      italic: (0, import_i18n21._x)("Italic", "font style")
10473    };
10474  
10475    // packages/global-styles-ui/build-module/font-library/utils/index.mjs
10476    var { File } = window;
10477    var { kebabCase: kebabCase2 } = unlock2(import_components30.privateApis);
10478  
10479    // packages/global-styles-ui/build-module/font-library/context.mjs
10480    var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
10481    var FontLibraryContext = (0, import_element27.createContext)(
10482      {}
10483    );
10484    FontLibraryContext.displayName = "FontLibraryContext";
10485  
10486    // packages/global-styles-ui/build-module/font-library/modal.mjs
10487    var import_i18n28 = __toESM(require_i18n(), 1);
10488    var import_components40 = __toESM(require_components(), 1);
10489    var import_core_data21 = __toESM(require_core_data(), 1);
10490    var import_data25 = __toESM(require_data(), 1);
10491  
10492    // packages/global-styles-ui/build-module/font-library/installed-fonts.mjs
10493    var import_components34 = __toESM(require_components(), 1);
10494    var import_core_data19 = __toESM(require_core_data(), 1);
10495    var import_data24 = __toESM(require_data(), 1);
10496    var import_element30 = __toESM(require_element(), 1);
10497    var import_i18n24 = __toESM(require_i18n(), 1);
10498  
10499    // packages/global-styles-ui/build-module/font-library/font-card.mjs
10500    var import_i18n23 = __toESM(require_i18n(), 1);
10501    var import_components32 = __toESM(require_components(), 1);
10502  
10503    // packages/global-styles-ui/build-module/font-library/font-demo.mjs
10504    var import_components31 = __toESM(require_components(), 1);
10505    var import_element28 = __toESM(require_element(), 1);
10506    var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
10507  
10508    // packages/global-styles-ui/build-module/font-library/font-card.mjs
10509    var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
10510  
10511    // packages/global-styles-ui/build-module/font-library/library-font-variant.mjs
10512    var import_element29 = __toESM(require_element(), 1);
10513    var import_components33 = __toESM(require_components(), 1);
10514    var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
10515  
10516    // packages/global-styles-ui/build-module/font-library/installed-fonts.mjs
10517    var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
10518  
10519    // packages/global-styles-ui/build-module/font-library/font-collection.mjs
10520    var import_element32 = __toESM(require_element(), 1);
10521    var import_components37 = __toESM(require_components(), 1);
10522    var import_compose5 = __toESM(require_compose(), 1);
10523    var import_i18n26 = __toESM(require_i18n(), 1);
10524    var import_core_data20 = __toESM(require_core_data(), 1);
10525  
10526    // packages/global-styles-ui/build-module/font-library/google-fonts-confirm-dialog.mjs
10527    var import_i18n25 = __toESM(require_i18n(), 1);
10528    var import_components35 = __toESM(require_components(), 1);
10529    var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
10530  
10531    // packages/global-styles-ui/build-module/font-library/collection-font-variant.mjs
10532    var import_element31 = __toESM(require_element(), 1);
10533    var import_components36 = __toESM(require_components(), 1);
10534    var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
10535  
10536    // packages/global-styles-ui/build-module/font-library/font-collection.mjs
10537    var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1);
10538    var DEFAULT_CATEGORY = {
10539      slug: "all",
10540      name: (0, import_i18n26._x)("All", "font categories")
10541    };
10542  
10543    // packages/global-styles-ui/build-module/font-library/upload-fonts.mjs
10544    var import_i18n27 = __toESM(require_i18n(), 1);
10545    var import_components39 = __toESM(require_components(), 1);
10546    var import_element33 = __toESM(require_element(), 1);
10547  
10548    // packages/global-styles-ui/build-module/font-library/lib/unbrotli.mjs
10549    var __require2 = /* @__PURE__ */ ((x2) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x2, {
10550      get: (a2, b2) => (typeof __require !== "undefined" ? __require : a2)[b2]
10551    }) : x2)(function(x2) {
10552      if (typeof __require !== "undefined") return __require.apply(this, arguments);
10553      throw Error('Dynamic require of "' + x2 + '" is not supported');
10554    });
10555    var unbrotli_default = (function() {
10556      var define, module, exports;
10557      return (/* @__PURE__ */ (function() {
10558        function r3(e2, n2, t3) {
10559          function o3(i22, f2) {
10560            if (!n2[i22]) {
10561              if (!e2[i22]) {
10562                var c6 = "function" == typeof __require2 && __require2;
10563                if (!f2 && c6) return c6(i22, true);
10564                if (u2) return u2(i22, true);
10565                var a2 = new Error("Cannot find module '" + i22 + "'");
10566                throw a2.code = "MODULE_NOT_FOUND", a2;
10567              }
10568              var p3 = n2[i22] = { exports: {} };
10569              e2[i22][0].call(
10570                p3.exports,
10571                function(r22) {
10572                  var n22 = e2[i22][1][r22];
10573                  return o3(n22 || r22);
10574                },
10575                p3,
10576                p3.exports,
10577                r3,
10578                e2,
10579                n2,
10580                t3
10581              );
10582            }
10583            return n2[i22].exports;
10584          }
10585          for (var u2 = "function" == typeof __require2 && __require2, i2 = 0; i2 < t3.length; i2++)
10586            o3(t3[i2]);
10587          return o3;
10588        }
10589        return r3;
10590      })())(
10591        {
10592          1: [
10593            function(require2, module2, exports2) {
10594              var BROTLI_READ_SIZE = 4096;
10595              var BROTLI_IBUF_SIZE = 2 * BROTLI_READ_SIZE + 32;
10596              var BROTLI_IBUF_MASK = 2 * BROTLI_READ_SIZE - 1;
10597              var kBitMask = new Uint32Array([
10598                0,
10599                1,
10600                3,
10601                7,
10602                15,
10603                31,
10604                63,
10605                127,
10606                255,
10607                511,
10608                1023,
10609                2047,
10610                4095,
10611                8191,
10612                16383,
10613                32767,
10614                65535,
10615                131071,
10616                262143,
10617                524287,
10618                1048575,
10619                2097151,
10620                4194303,
10621                8388607,
10622                16777215
10623              ]);
10624              function BrotliBitReader(input) {
10625                this.buf_ = new Uint8Array(BROTLI_IBUF_SIZE);
10626                this.input_ = input;
10627                this.reset();
10628              }
10629              BrotliBitReader.READ_SIZE = BROTLI_READ_SIZE;
10630              BrotliBitReader.IBUF_MASK = BROTLI_IBUF_MASK;
10631              BrotliBitReader.prototype.reset = function() {
10632                this.buf_ptr_ = 0;
10633                this.val_ = 0;
10634                this.pos_ = 0;
10635                this.bit_pos_ = 0;
10636                this.bit_end_pos_ = 0;
10637                this.eos_ = 0;
10638                this.readMoreInput();
10639                for (var i2 = 0; i2 < 4; i2++) {
10640                  this.val_ |= this.buf_[this.pos_] << 8 * i2;
10641                  ++this.pos_;
10642                }
10643                return this.bit_end_pos_ > 0;
10644              };
10645              BrotliBitReader.prototype.readMoreInput = function() {
10646                if (this.bit_end_pos_ > 256) {
10647                  return;
10648                } else if (this.eos_) {
10649                  if (this.bit_pos_ > this.bit_end_pos_)
10650                    throw new Error(
10651                      "Unexpected end of input " + this.bit_pos_ + " " + this.bit_end_pos_
10652                    );
10653                } else {
10654                  var dst = this.buf_ptr_;
10655                  var bytes_read = this.input_.read(
10656                    this.buf_,
10657                    dst,
10658                    BROTLI_READ_SIZE
10659                  );
10660                  if (bytes_read < 0) {
10661                    throw new Error("Unexpected end of input");
10662                  }
10663                  if (bytes_read < BROTLI_READ_SIZE) {
10664                    this.eos_ = 1;
10665                    for (var p3 = 0; p3 < 32; p3++)
10666                      this.buf_[dst + bytes_read + p3] = 0;
10667                  }
10668                  if (dst === 0) {
10669                    for (var p3 = 0; p3 < 32; p3++)
10670                      this.buf_[(BROTLI_READ_SIZE << 1) + p3] = this.buf_[p3];
10671                    this.buf_ptr_ = BROTLI_READ_SIZE;
10672                  } else {
10673                    this.buf_ptr_ = 0;
10674                  }
10675                  this.bit_end_pos_ += bytes_read << 3;
10676                }
10677              };
10678              BrotliBitReader.prototype.fillBitWindow = function() {
10679                while (this.bit_pos_ >= 8) {
10680                  this.val_ >>>= 8;
10681                  this.val_ |= this.buf_[this.pos_ & BROTLI_IBUF_MASK] << 24;
10682                  ++this.pos_;
10683                  this.bit_pos_ = this.bit_pos_ - 8 >>> 0;
10684                  this.bit_end_pos_ = this.bit_end_pos_ - 8 >>> 0;
10685                }
10686              };
10687              BrotliBitReader.prototype.readBits = function(n_bits) {
10688                if (32 - this.bit_pos_ < n_bits) {
10689                  this.fillBitWindow();
10690                }
10691                var val = this.val_ >>> this.bit_pos_ & kBitMask[n_bits];
10692                this.bit_pos_ += n_bits;
10693                return val;
10694              };
10695              module2.exports = BrotliBitReader;
10696            },
10697            {}
10698          ],
10699          2: [
10700            function(require2, module2, exports2) {
10701              var CONTEXT_LSB6 = 0;
10702              var CONTEXT_MSB6 = 1;
10703              var CONTEXT_UTF8 = 2;
10704              var CONTEXT_SIGNED = 3;
10705              exports2.lookup = new Uint8Array([
10706                /* CONTEXT_UTF8, last byte. */
10707                /* ASCII range. */
10708                0,
10709                0,
10710                0,
10711                0,
10712                0,
10713                0,
10714                0,
10715                0,
10716                0,
10717                4,
10718                4,
10719                0,
10720                0,
10721                4,
10722                0,
10723                0,
10724                0,
10725                0,
10726                0,
10727                0,
10728                0,
10729                0,
10730                0,
10731                0,
10732                0,
10733                0,
10734                0,
10735                0,
10736                0,
10737                0,
10738                0,
10739                0,
10740                8,
10741                12,
10742                16,
10743                12,
10744                12,
10745                20,
10746                12,
10747                16,
10748                24,
10749                28,
10750                12,
10751                12,
10752                32,
10753                12,
10754                36,
10755                12,
10756                44,
10757                44,
10758                44,
10759                44,
10760                44,
10761                44,
10762                44,
10763                44,
10764                44,
10765                44,
10766                32,
10767                32,
10768                24,
10769                40,
10770                28,
10771                12,
10772                12,
10773                48,
10774                52,
10775                52,
10776                52,
10777                48,
10778                52,
10779                52,
10780                52,
10781                48,
10782                52,
10783                52,
10784                52,
10785                52,
10786                52,
10787                48,
10788                52,
10789                52,
10790                52,
10791                52,
10792                52,
10793                48,
10794                52,
10795                52,
10796                52,
10797                52,
10798                52,
10799                24,
10800                12,
10801                28,
10802                12,
10803                12,
10804                12,
10805                56,
10806                60,
10807                60,
10808                60,
10809                56,
10810                60,
10811                60,
10812                60,
10813                56,
10814                60,
10815                60,
10816                60,
10817                60,
10818                60,
10819                56,
10820                60,
10821                60,
10822                60,
10823                60,
10824                60,
10825                56,
10826                60,
10827                60,
10828                60,
10829                60,
10830                60,
10831                24,
10832                12,
10833                28,
10834                12,
10835                0,
10836                /* UTF8 continuation byte range. */
10837                0,
10838                1,
10839                0,
10840                1,
10841                0,
10842                1,
10843                0,
10844                1,
10845                0,
10846                1,
10847                0,
10848                1,
10849                0,
10850                1,
10851                0,
10852                1,
10853                0,
10854                1,
10855                0,
10856                1,
10857                0,
10858                1,
10859                0,
10860                1,
10861                0,
10862                1,
10863                0,
10864                1,
10865                0,
10866                1,
10867                0,
10868                1,
10869                0,
10870                1,
10871                0,
10872                1,
10873                0,
10874                1,
10875                0,
10876                1,
10877                0,
10878                1,
10879                0,
10880                1,
10881                0,
10882                1,
10883                0,
10884                1,
10885                0,
10886                1,
10887                0,
10888                1,
10889                0,
10890                1,
10891                0,
10892                1,
10893                0,
10894                1,
10895                0,
10896                1,
10897                0,
10898                1,
10899                0,
10900                1,
10901                2,
10902                3,
10903                2,
10904                3,
10905                2,
10906                3,
10907                2,
10908                3,
10909                2,
10910                3,
10911                2,
10912                3,
10913                2,
10914                3,
10915                2,
10916                3,
10917                2,
10918                3,
10919                2,
10920                3,
10921                2,
10922                3,
10923                2,
10924                3,
10925                2,
10926                3,
10927                2,
10928                3,
10929                2,
10930                3,
10931                2,
10932                3,
10933                2,
10934                3,
10935                2,
10936                3,
10937                2,
10938                3,
10939                2,
10940                3,
10941                2,
10942                3,
10943                2,
10944                3,
10945                2,
10946                3,
10947                2,
10948                3,
10949                2,
10950                3,
10951                2,
10952                3,
10953                2,
10954                3,
10955                2,
10956                3,
10957                2,
10958                3,
10959                2,
10960                3,
10961                2,
10962                3,
10963                2,
10964                3,
10965                /* ASCII range. */
10966                0,
10967                0,
10968                0,
10969                0,
10970                0,
10971                0,
10972                0,
10973                0,
10974                0,
10975                0,
10976                0,
10977                0,
10978                0,
10979                0,
10980                0,
10981                0,
10982                0,
10983                0,
10984                0,
10985                0,
10986                0,
10987                0,
10988                0,
10989                0,
10990                0,
10991                0,
10992                0,
10993                0,
10994                0,
10995                0,
10996                0,
10997                0,
10998                0,
10999                1,
11000                1,
11001                1,
11002                1,
11003                1,
11004                1,
11005                1,
11006                1,
11007                1,
11008                1,
11009                1,
11010                1,
11011                1,
11012                1,
11013                1,
11014                2,
11015                2,
11016                2,
11017                2,
11018                2,
11019                2,
11020                2,
11021                2,
11022                2,
11023                2,
11024                1,
11025                1,
11026                1,
11027                1,
11028                1,
11029                1,
11030                1,
11031                2,
11032                2,
11033                2,
11034                2,
11035                2,
11036                2,
11037                2,
11038                2,
11039                2,
11040                2,
11041                2,
11042                2,
11043                2,
11044                2,
11045                2,
11046                2,
11047                2,
11048                2,
11049                2,
11050                2,
11051                2,
11052                2,
11053                2,
11054                2,
11055                2,
11056                2,
11057                1,
11058                1,
11059                1,
11060                1,
11061                1,
11062                1,
11063                3,
11064                3,
11065                3,
11066                3,
11067                3,
11068                3,
11069                3,
11070                3,
11071                3,
11072                3,
11073                3,
11074                3,
11075                3,
11076                3,
11077                3,
11078                3,
11079                3,
11080                3,
11081                3,
11082                3,
11083                3,
11084                3,
11085                3,
11086                3,
11087                3,
11088                3,
11089                1,
11090                1,
11091                1,
11092                1,
11093                0,
11094                /* UTF8 continuation byte range. */
11095                0,
11096                0,
11097                0,
11098                0,
11099                0,
11100                0,
11101                0,
11102                0,
11103                0,
11104                0,
11105                0,
11106                0,
11107                0,
11108                0,
11109                0,
11110                0,
11111                0,
11112                0,
11113                0,
11114                0,
11115                0,
11116                0,
11117                0,
11118                0,
11119                0,
11120                0,
11121                0,
11122                0,
11123                0,
11124                0,
11125                0,
11126                0,
11127                0,
11128                0,
11129                0,
11130                0,
11131                0,
11132                0,
11133                0,
11134                0,
11135                0,
11136                0,
11137                0,
11138                0,
11139                0,
11140                0,
11141                0,
11142                0,
11143                0,
11144                0,
11145                0,
11146                0,
11147                0,
11148                0,
11149                0,
11150                0,
11151                0,
11152                0,
11153                0,
11154                0,
11155                0,
11156                0,
11157                0,
11158                0,
11159                0,
11160                0,
11161                0,
11162                0,
11163                0,
11164                0,
11165                0,
11166                0,
11167                0,
11168                0,
11169                0,
11170                0,
11171                0,
11172                0,
11173                0,
11174                0,
11175                0,
11176                0,
11177                0,
11178                0,
11179                0,
11180                0,
11181                0,
11182                0,
11183                0,
11184                0,
11185                0,
11186                0,
11187                0,
11188                0,
11189                0,
11190                0,
11191                2,
11192                2,
11193                2,
11194                2,
11195                2,
11196                2,
11197                2,
11198                2,
11199                2,
11200                2,
11201                2,
11202                2,
11203                2,
11204                2,
11205                2,
11206                2,
11207                2,
11208                2,
11209                2,
11210                2,
11211                2,
11212                2,
11213                2,
11214                2,
11215                2,
11216                2,
11217                2,
11218                2,
11219                2,
11220                2,
11221                2,
11222                2,
11223                0,
11224                1,
11225                1,
11226                1,
11227                1,
11228                1,
11229                1,
11230                1,
11231                1,
11232                1,
11233                1,
11234                1,
11235                1,
11236                1,
11237                1,
11238                1,
11239                2,
11240                2,
11241                2,
11242                2,
11243                2,
11244                2,
11245                2,
11246                2,
11247                2,
11248                2,
11249                2,
11250                2,
11251                2,
11252                2,
11253                2,
11254                2,
11255                2,
11256                2,
11257                2,
11258                2,
11259                2,
11260                2,
11261                2,
11262                2,
11263                2,
11264                2,
11265                2,
11266                2,
11267                2,
11268                2,
11269                2,
11270                2,
11271                2,
11272                2,
11273                2,
11274                2,
11275                2,
11276                2,
11277                2,
11278                2,
11279                2,
11280                2,
11281                2,
11282                2,
11283                2,
11284                2,
11285                2,
11286                2,
11287                3,
11288                3,
11289                3,
11290                3,
11291                3,
11292                3,
11293                3,
11294                3,
11295                3,
11296                3,
11297                3,
11298                3,
11299                3,
11300                3,
11301                3,
11302                3,
11303                3,
11304                3,
11305                3,
11306                3,
11307                3,
11308                3,
11309                3,
11310                3,
11311                3,
11312                3,
11313                3,
11314                3,
11315                3,
11316                3,
11317                3,
11318                3,
11319                3,
11320                3,
11321                3,
11322                3,
11323                3,
11324                3,
11325                3,
11326                3,
11327                3,
11328                3,
11329                3,
11330                3,
11331                3,
11332                3,
11333                3,
11334                3,
11335                3,
11336                3,
11337                3,
11338                3,
11339                3,
11340                3,
11341                3,
11342                3,
11343                3,
11344                3,
11345                3,
11346                3,
11347                3,
11348                3,
11349                3,
11350                3,
11351                4,
11352                4,
11353                4,
11354                4,
11355                4,
11356                4,
11357                4,
11358                4,
11359                4,
11360                4,
11361                4,
11362                4,
11363                4,
11364                4,
11365                4,
11366                4,
11367                4,
11368                4,
11369                4,
11370                4,
11371                4,
11372                4,
11373                4,
11374                4,
11375                4,
11376                4,
11377                4,
11378                4,
11379                4,
11380                4,
11381                4,
11382                4,
11383                4,
11384                4,
11385                4,
11386                4,
11387                4,
11388                4,
11389                4,
11390                4,
11391                4,
11392                4,
11393                4,
11394                4,
11395                4,
11396                4,
11397                4,
11398                4,
11399                4,
11400                4,
11401                4,
11402                4,
11403                4,
11404                4,
11405                4,
11406                4,
11407                4,
11408                4,
11409                4,
11410                4,
11411                4,
11412                4,
11413                4,
11414                4,
11415                5,
11416                5,
11417                5,
11418                5,
11419                5,
11420                5,
11421                5,
11422                5,
11423                5,
11424                5,
11425                5,
11426                5,
11427                5,
11428                5,
11429                5,
11430                5,
11431                5,
11432                5,
11433                5,
11434                5,
11435                5,
11436                5,
11437                5,
11438                5,
11439                5,
11440                5,
11441                5,
11442                5,
11443                5,
11444                5,
11445                5,
11446                5,
11447                5,
11448                5,
11449                5,
11450                5,
11451                5,
11452                5,
11453                5,
11454                5,
11455                5,
11456                5,
11457                5,
11458                5,
11459                5,
11460                5,
11461                5,
11462                5,
11463                6,
11464                6,
11465                6,
11466                6,
11467                6,
11468                6,
11469                6,
11470                6,
11471                6,
11472                6,
11473                6,
11474                6,
11475                6,
11476                6,
11477                6,
11478                7,
11479                /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */
11480                0,
11481                8,
11482                8,
11483                8,
11484                8,
11485                8,
11486                8,
11487                8,
11488                8,
11489                8,
11490                8,
11491                8,
11492                8,
11493                8,
11494                8,
11495                8,
11496                16,
11497                16,
11498                16,
11499                16,
11500                16,
11501                16,
11502                16,
11503                16,
11504                16,
11505                16,
11506                16,
11507                16,
11508                16,
11509                16,
11510                16,
11511                16,
11512                16,
11513                16,
11514                16,
11515                16,
11516                16,
11517                16,
11518                16,
11519                16,
11520                16,
11521                16,
11522                16,
11523                16,
11524                16,
11525                16,
11526                16,
11527                16,
11528                16,
11529                16,
11530                16,
11531                16,
11532                16,
11533                16,
11534                16,
11535                16,
11536                16,
11537                16,
11538                16,
11539                16,
11540                16,
11541                16,
11542                16,
11543                16,
11544                24,
11545                24,
11546                24,
11547                24,
11548                24,
11549                24,
11550                24,
11551                24,
11552                24,
11553                24,
11554                24,
11555                24,
11556                24,
11557                24,
11558                24,
11559                24,
11560                24,
11561                24,
11562                24,
11563                24,
11564                24,
11565                24,
11566                24,
11567                24,
11568                24,
11569                24,
11570                24,
11571                24,
11572                24,
11573                24,
11574                24,
11575                24,
11576                24,
11577                24,
11578                24,
11579                24,
11580                24,
11581                24,
11582                24,
11583                24,
11584                24,
11585                24,
11586                24,
11587                24,
11588                24,
11589                24,
11590                24,
11591                24,
11592                24,
11593                24,
11594                24,
11595                24,
11596                24,
11597                24,
11598                24,
11599                24,
11600                24,
11601                24,
11602                24,
11603                24,
11604                24,
11605                24,
11606                24,
11607                24,
11608                32,
11609                32,
11610                32,
11611                32,
11612                32,
11613                32,
11614                32,
11615                32,
11616                32,
11617                32,
11618                32,
11619                32,
11620                32,
11621                32,
11622                32,
11623                32,
11624                32,
11625                32,
11626                32,
11627                32,
11628                32,
11629                32,
11630                32,
11631                32,
11632                32,
11633                32,
11634                32,
11635                32,
11636                32,
11637                32,
11638                32,
11639                32,
11640                32,
11641                32,
11642                32,
11643                32,
11644                32,
11645                32,
11646                32,
11647                32,
11648                32,
11649                32,
11650                32,
11651                32,
11652                32,
11653                32,
11654                32,
11655                32,
11656                32,
11657                32,
11658                32,
11659                32,
11660                32,
11661                32,
11662                32,
11663                32,
11664                32,
11665                32,
11666                32,
11667                32,
11668                32,
11669                32,
11670                32,
11671                32,
11672                40,
11673                40,
11674                40,
11675                40,
11676                40,
11677                40,
11678                40,
11679                40,
11680                40,
11681                40,
11682                40,
11683                40,
11684                40,
11685                40,
11686                40,
11687                40,
11688                40,
11689                40,
11690                40,
11691                40,
11692                40,
11693                40,
11694                40,
11695                40,
11696                40,
11697                40,
11698                40,
11699                40,
11700                40,
11701                40,
11702                40,
11703                40,
11704                40,
11705                40,
11706                40,
11707                40,
11708                40,
11709                40,
11710                40,
11711                40,
11712                40,
11713                40,
11714                40,
11715                40,
11716                40,
11717                40,
11718                40,
11719                40,
11720                48,
11721                48,
11722                48,
11723                48,
11724                48,
11725                48,
11726                48,
11727                48,
11728                48,
11729                48,
11730                48,
11731                48,
11732                48,
11733                48,
11734                48,
11735                56,
11736                /* CONTEXT_LSB6, last byte. */
11737                0,
11738                1,
11739                2,
11740                3,
11741                4,
11742                5,
11743                6,
11744                7,
11745                8,
11746                9,
11747                10,
11748                11,
11749                12,
11750                13,
11751                14,
11752                15,
11753                16,
11754                17,
11755                18,
11756                19,
11757                20,
11758                21,
11759                22,
11760                23,
11761                24,
11762                25,
11763                26,
11764                27,
11765                28,
11766                29,
11767                30,
11768                31,
11769                32,
11770                33,
11771                34,
11772                35,
11773                36,
11774                37,
11775                38,
11776                39,
11777                40,
11778                41,
11779                42,
11780                43,
11781                44,
11782                45,
11783                46,
11784                47,
11785                48,
11786                49,
11787                50,
11788                51,
11789                52,
11790                53,
11791                54,
11792                55,
11793                56,
11794                57,
11795                58,
11796                59,
11797                60,
11798                61,
11799                62,
11800                63,
11801                0,
11802                1,
11803                2,
11804                3,
11805                4,
11806                5,
11807                6,
11808                7,
11809                8,
11810                9,
11811                10,
11812                11,
11813                12,
11814                13,
11815                14,
11816                15,
11817                16,
11818                17,
11819                18,
11820                19,
11821                20,
11822                21,
11823                22,
11824                23,
11825                24,
11826                25,
11827                26,
11828                27,
11829                28,
11830                29,
11831                30,
11832                31,
11833                32,
11834                33,
11835                34,
11836                35,
11837                36,
11838                37,
11839                38,
11840                39,
11841                40,
11842                41,
11843                42,
11844                43,
11845                44,
11846                45,
11847                46,
11848                47,
11849                48,
11850                49,
11851                50,
11852                51,
11853                52,
11854                53,
11855                54,
11856                55,
11857                56,
11858                57,
11859                58,
11860                59,
11861                60,
11862                61,
11863                62,
11864                63,
11865                0,
11866                1,
11867                2,
11868                3,
11869                4,
11870                5,
11871                6,
11872                7,
11873                8,
11874                9,
11875                10,
11876                11,
11877                12,
11878                13,
11879                14,
11880                15,
11881                16,
11882                17,
11883                18,
11884                19,
11885                20,
11886                21,
11887                22,
11888                23,
11889                24,
11890                25,
11891                26,
11892                27,
11893                28,
11894                29,
11895                30,
11896                31,
11897                32,
11898                33,
11899                34,
11900                35,
11901                36,
11902                37,
11903                38,
11904                39,
11905                40,
11906                41,
11907                42,
11908                43,
11909                44,
11910                45,
11911                46,
11912                47,
11913                48,
11914                49,
11915                50,
11916                51,
11917                52,
11918                53,
11919                54,
11920                55,
11921                56,
11922                57,
11923                58,
11924                59,
11925                60,
11926                61,
11927                62,
11928                63,
11929                0,
11930                1,
11931                2,
11932                3,
11933                4,
11934                5,
11935                6,
11936                7,
11937                8,
11938                9,
11939                10,
11940                11,
11941                12,
11942                13,
11943                14,
11944                15,
11945                16,
11946                17,
11947                18,
11948                19,
11949                20,
11950                21,
11951                22,
11952                23,
11953                24,
11954                25,
11955                26,
11956                27,
11957                28,
11958                29,
11959                30,
11960                31,
11961                32,
11962                33,
11963                34,
11964                35,
11965                36,
11966                37,
11967                38,
11968                39,
11969                40,
11970                41,
11971                42,
11972                43,
11973                44,
11974                45,
11975                46,
11976                47,
11977                48,
11978                49,
11979                50,
11980                51,
11981                52,
11982                53,
11983                54,
11984                55,
11985                56,
11986                57,
11987                58,
11988                59,
11989                60,
11990                61,
11991                62,
11992                63,
11993                /* CONTEXT_MSB6, last byte. */
11994                0,
11995                0,
11996                0,
11997                0,
11998                1,
11999                1,
12000                1,
12001                1,
12002                2,
12003                2,
12004                2,
12005                2,
12006                3,
12007                3,
12008                3,
12009                3,
12010                4,
12011                4,
12012                4,
12013                4,
12014                5,
12015                5,
12016                5,
12017                5,
12018                6,
12019                6,
12020                6,
12021                6,
12022                7,
12023                7,
12024                7,
12025                7,
12026                8,
12027                8,
12028                8,
12029                8,
12030                9,
12031                9,
12032                9,
12033                9,
12034                10,
12035                10,
12036                10,
12037                10,
12038                11,
12039                11,
12040                11,
12041                11,
12042                12,
12043                12,
12044                12,
12045                12,
12046                13,
12047                13,
12048                13,
12049                13,
12050                14,
12051                14,
12052                14,
12053                14,
12054                15,
12055                15,
12056                15,
12057                15,
12058                16,
12059                16,
12060                16,
12061                16,
12062                17,
12063                17,
12064                17,
12065                17,
12066                18,
12067                18,
12068                18,
12069                18,
12070                19,
12071                19,
12072                19,
12073                19,
12074                20,
12075                20,
12076                20,
12077                20,
12078                21,
12079                21,
12080                21,
12081                21,
12082                22,
12083                22,
12084                22,
12085                22,
12086                23,
12087                23,
12088                23,
12089                23,
12090                24,
12091                24,
12092                24,
12093                24,
12094                25,
12095                25,
12096                25,
12097                25,
12098                26,
12099                26,
12100                26,
12101                26,
12102                27,
12103                27,
12104                27,
12105                27,
12106                28,
12107                28,
12108                28,
12109                28,
12110                29,
12111                29,
12112                29,
12113                29,
12114                30,
12115                30,
12116                30,
12117                30,
12118                31,
12119                31,
12120                31,
12121                31,
12122                32,
12123                32,
12124                32,
12125                32,
12126                33,
12127                33,
12128                33,
12129                33,
12130                34,
12131                34,
12132                34,
12133                34,
12134                35,
12135                35,
12136                35,
12137                35,
12138                36,
12139                36,
12140                36,
12141                36,
12142                37,
12143                37,
12144                37,
12145                37,
12146                38,
12147                38,
12148                38,
12149                38,
12150                39,
12151                39,
12152                39,
12153                39,
12154                40,
12155                40,
12156                40,
12157                40,
12158                41,
12159                41,
12160                41,
12161                41,
12162                42,
12163                42,
12164                42,
12165                42,
12166                43,
12167                43,
12168                43,
12169                43,
12170                44,
12171                44,
12172                44,
12173                44,
12174                45,
12175                45,
12176                45,
12177                45,
12178                46,
12179                46,
12180                46,
12181                46,
12182                47,
12183                47,
12184                47,
12185                47,
12186                48,
12187                48,
12188                48,
12189                48,
12190                49,
12191                49,
12192                49,
12193                49,
12194                50,
12195                50,
12196                50,
12197                50,
12198                51,
12199                51,
12200                51,
12201                51,
12202                52,
12203                52,
12204                52,
12205                52,
12206                53,
12207                53,
12208                53,
12209                53,
12210                54,
12211                54,
12212                54,
12213                54,
12214                55,
12215                55,
12216                55,
12217                55,
12218                56,
12219                56,
12220                56,
12221                56,
12222                57,
12223                57,
12224                57,
12225                57,
12226                58,
12227                58,
12228                58,
12229                58,
12230                59,
12231                59,
12232                59,
12233                59,
12234                60,
12235                60,
12236                60,
12237                60,
12238                61,
12239                61,
12240                61,
12241                61,
12242                62,
12243                62,
12244                62,
12245                62,
12246                63,
12247                63,
12248                63,
12249                63,
12250                /* CONTEXT_{M,L}SB6, second last byte, */
12251                0,
12252                0,
12253                0,
12254                0,
12255                0,
12256                0,
12257                0,
12258                0,
12259                0,
12260                0,
12261                0,
12262                0,
12263                0,
12264                0,
12265                0,
12266                0,
12267                0,
12268                0,
12269                0,
12270                0,
12271                0,
12272                0,
12273                0,
12274                0,
12275                0,
12276                0,
12277                0,
12278                0,
12279                0,
12280                0,
12281                0,
12282                0,
12283                0,
12284                0,
12285                0,
12286                0,
12287                0,
12288                0,
12289                0,
12290                0,
12291                0,
12292                0,
12293                0,
12294                0,
12295                0,
12296                0,
12297                0,
12298                0,
12299                0,
12300                0,
12301                0,
12302                0,
12303                0,
12304                0,
12305                0,
12306                0,
12307                0,
12308                0,
12309                0,
12310                0,
12311                0,
12312                0,
12313                0,
12314                0,
12315                0,
12316                0,
12317                0,
12318                0,
12319                0,
12320                0,
12321                0,
12322                0,
12323                0,
12324                0,
12325                0,
12326                0,
12327                0,
12328                0,
12329                0,
12330                0,
12331                0,
12332                0,
12333                0,
12334                0,
12335                0,
12336                0,
12337                0,
12338                0,
12339                0,
12340                0,
12341                0,
12342                0,
12343                0,
12344                0,
12345                0,
12346                0,
12347                0,
12348                0,
12349                0,
12350                0,
12351                0,
12352                0,
12353                0,
12354                0,
12355                0,
12356                0,
12357                0,
12358                0,
12359                0,
12360                0,
12361                0,
12362                0,
12363                0,
12364                0,
12365                0,
12366                0,
12367                0,
12368                0,
12369                0,
12370                0,
12371                0,
12372                0,
12373                0,
12374                0,
12375                0,
12376                0,
12377                0,
12378                0,
12379                0,
12380                0,
12381                0,
12382                0,
12383                0,
12384                0,
12385                0,
12386                0,
12387                0,
12388                0,
12389                0,
12390                0,
12391                0,
12392                0,
12393                0,
12394                0,
12395                0,
12396                0,
12397                0,
12398                0,
12399                0,
12400                0,
12401                0,
12402                0,
12403                0,
12404                0,
12405                0,
12406                0,
12407                0,
12408                0,
12409                0,
12410                0,
12411                0,
12412                0,
12413                0,
12414                0,
12415                0,
12416                0,
12417                0,
12418                0,
12419                0,
12420                0,
12421                0,
12422                0,
12423                0,
12424                0,
12425                0,
12426                0,
12427                0,
12428                0,
12429                0,
12430                0,
12431                0,
12432                0,
12433                0,
12434                0,
12435                0,
12436                0,
12437                0,
12438                0,
12439                0,
12440                0,
12441                0,
12442                0,
12443                0,
12444                0,
12445                0,
12446                0,
12447                0,
12448                0,
12449                0,
12450                0,
12451                0,
12452                0,
12453                0,
12454                0,
12455                0,
12456                0,
12457                0,
12458                0,
12459                0,
12460                0,
12461                0,
12462                0,
12463                0,
12464                0,
12465                0,
12466                0,
12467                0,
12468                0,
12469                0,
12470                0,
12471                0,
12472                0,
12473                0,
12474                0,
12475                0,
12476                0,
12477                0,
12478                0,
12479                0,
12480                0,
12481                0,
12482                0,
12483                0,
12484                0,
12485                0,
12486                0,
12487                0,
12488                0,
12489                0,
12490                0,
12491                0,
12492                0,
12493                0,
12494                0,
12495                0,
12496                0,
12497                0,
12498                0,
12499                0,
12500                0,
12501                0,
12502                0,
12503                0,
12504                0,
12505                0,
12506                0
12507              ]);
12508              exports2.lookupOffsets = new Uint16Array([
12509                /* CONTEXT_LSB6 */
12510                1024,
12511                1536,
12512                1280,
12513                1536,
12514                0,
12515                256,
12516                768,
12517                512
12518              ]);
12519            },
12520            {}
12521          ],
12522          3: [
12523            function(require2, module2, exports2) {
12524              var BrotliInput = require2("./streams").BrotliInput;
12525              var BrotliOutput = require2("./streams").BrotliOutput;
12526              var BrotliBitReader = require2("./bit_reader");
12527              var BrotliDictionary = require2("./dictionary");
12528              var HuffmanCode = require2("./huffman").HuffmanCode;
12529              var BrotliBuildHuffmanTable = require2("./huffman").BrotliBuildHuffmanTable;
12530              var Context = require2("./context");
12531              var Prefix = require2("./prefix");
12532              var Transform = require2("./transform");
12533              var kDefaultCodeLength = 8;
12534              var kCodeLengthRepeatCode = 16;
12535              var kNumLiteralCodes = 256;
12536              var kNumInsertAndCopyCodes = 704;
12537              var kNumBlockLengthCodes = 26;
12538              var kLiteralContextBits = 6;
12539              var kDistanceContextBits = 2;
12540              var HUFFMAN_TABLE_BITS = 8;
12541              var HUFFMAN_TABLE_MASK = 255;
12542              var HUFFMAN_MAX_TABLE_SIZE = 1080;
12543              var CODE_LENGTH_CODES = 18;
12544              var kCodeLengthCodeOrder = new Uint8Array([
12545                1,
12546                2,
12547                3,
12548                4,
12549                0,
12550                5,
12551                17,
12552                6,
12553                16,
12554                7,
12555                8,
12556                9,
12557                10,
12558                11,
12559                12,
12560                13,
12561                14,
12562                15
12563              ]);
12564              var NUM_DISTANCE_SHORT_CODES = 16;
12565              var kDistanceShortCodeIndexOffset = new Uint8Array([
12566                3,
12567                2,
12568                1,
12569                0,
12570                3,
12571                3,
12572                3,
12573                3,
12574                3,
12575                3,
12576                2,
12577                2,
12578                2,
12579                2,
12580                2,
12581                2
12582              ]);
12583              var kDistanceShortCodeValueOffset = new Int8Array([
12584                0,
12585                0,
12586                0,
12587                0,
12588                -1,
12589                1,
12590                -2,
12591                2,
12592                -3,
12593                3,
12594                -1,
12595                1,
12596                -2,
12597                2,
12598                -3,
12599                3
12600              ]);
12601              var kMaxHuffmanTableSize = new Uint16Array([
12602                256,
12603                402,
12604                436,
12605                468,
12606                500,
12607                534,
12608                566,
12609                598,
12610                630,
12611                662,
12612                694,
12613                726,
12614                758,
12615                790,
12616                822,
12617                854,
12618                886,
12619                920,
12620                952,
12621                984,
12622                1016,
12623                1048,
12624                1080
12625              ]);
12626              function DecodeWindowBits(br) {
12627                var n2;
12628                if (br.readBits(1) === 0) {
12629                  return 16;
12630                }
12631                n2 = br.readBits(3);
12632                if (n2 > 0) {
12633                  return 17 + n2;
12634                }
12635                n2 = br.readBits(3);
12636                if (n2 > 0) {
12637                  return 8 + n2;
12638                }
12639                return 17;
12640              }
12641              function DecodeVarLenUint8(br) {
12642                if (br.readBits(1)) {
12643                  var nbits = br.readBits(3);
12644                  if (nbits === 0) {
12645                    return 1;
12646                  } else {
12647                    return br.readBits(nbits) + (1 << nbits);
12648                  }
12649                }
12650                return 0;
12651              }
12652              function MetaBlockLength() {
12653                this.meta_block_length = 0;
12654                this.input_end = 0;
12655                this.is_uncompressed = 0;
12656                this.is_metadata = false;
12657              }
12658              function DecodeMetaBlockLength(br) {
12659                var out = new MetaBlockLength();
12660                var size_nibbles;
12661                var size_bytes;
12662                var i2;
12663                out.input_end = br.readBits(1);
12664                if (out.input_end && br.readBits(1)) {
12665                  return out;
12666                }
12667                size_nibbles = br.readBits(2) + 4;
12668                if (size_nibbles === 7) {
12669                  out.is_metadata = true;
12670                  if (br.readBits(1) !== 0)
12671                    throw new Error("Invalid reserved bit");
12672                  size_bytes = br.readBits(2);
12673                  if (size_bytes === 0) return out;
12674                  for (i2 = 0; i2 < size_bytes; i2++) {
12675                    var next_byte = br.readBits(8);
12676                    if (i2 + 1 === size_bytes && size_bytes > 1 && next_byte === 0)
12677                      throw new Error("Invalid size byte");
12678                    out.meta_block_length |= next_byte << i2 * 8;
12679                  }
12680                } else {
12681                  for (i2 = 0; i2 < size_nibbles; ++i2) {
12682                    var next_nibble = br.readBits(4);
12683                    if (i2 + 1 === size_nibbles && size_nibbles > 4 && next_nibble === 0)
12684                      throw new Error("Invalid size nibble");
12685                    out.meta_block_length |= next_nibble << i2 * 4;
12686                  }
12687                }
12688                ++out.meta_block_length;
12689                if (!out.input_end && !out.is_metadata) {
12690                  out.is_uncompressed = br.readBits(1);
12691                }
12692                return out;
12693              }
12694              function ReadSymbol(table, index, br) {
12695                var start_index = index;
12696                var nbits;
12697                br.fillBitWindow();
12698                index += br.val_ >>> br.bit_pos_ & HUFFMAN_TABLE_MASK;
12699                nbits = table[index].bits - HUFFMAN_TABLE_BITS;
12700                if (nbits > 0) {
12701                  br.bit_pos_ += HUFFMAN_TABLE_BITS;
12702                  index += table[index].value;
12703                  index += br.val_ >>> br.bit_pos_ & (1 << nbits) - 1;
12704                }
12705                br.bit_pos_ += table[index].bits;
12706                return table[index].value;
12707              }
12708              function ReadHuffmanCodeLengths(code_length_code_lengths, num_symbols, code_lengths, br) {
12709                var symbol3 = 0;
12710                var prev_code_len = kDefaultCodeLength;
12711                var repeat = 0;
12712                var repeat_code_len = 0;
12713                var space = 32768;
12714                var table = [];
12715                for (var i2 = 0; i2 < 32; i2++)
12716                  table.push(new HuffmanCode(0, 0));
12717                BrotliBuildHuffmanTable(
12718                  table,
12719                  0,
12720                  5,
12721                  code_length_code_lengths,
12722                  CODE_LENGTH_CODES
12723                );
12724                while (symbol3 < num_symbols && space > 0) {
12725                  var p3 = 0;
12726                  var code_len;
12727                  br.readMoreInput();
12728                  br.fillBitWindow();
12729                  p3 += br.val_ >>> br.bit_pos_ & 31;
12730                  br.bit_pos_ += table[p3].bits;
12731                  code_len = table[p3].value & 255;
12732                  if (code_len < kCodeLengthRepeatCode) {
12733                    repeat = 0;
12734                    code_lengths[symbol3++] = code_len;
12735                    if (code_len !== 0) {
12736                      prev_code_len = code_len;
12737                      space -= 32768 >> code_len;
12738                    }
12739                  } else {
12740                    var extra_bits = code_len - 14;
12741                    var old_repeat;
12742                    var repeat_delta;
12743                    var new_len = 0;
12744                    if (code_len === kCodeLengthRepeatCode) {
12745                      new_len = prev_code_len;
12746                    }
12747                    if (repeat_code_len !== new_len) {
12748                      repeat = 0;
12749                      repeat_code_len = new_len;
12750                    }
12751                    old_repeat = repeat;
12752                    if (repeat > 0) {
12753                      repeat -= 2;
12754                      repeat <<= extra_bits;
12755                    }
12756                    repeat += br.readBits(extra_bits) + 3;
12757                    repeat_delta = repeat - old_repeat;
12758                    if (symbol3 + repeat_delta > num_symbols) {
12759                      throw new Error(
12760                        "[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols"
12761                      );
12762                    }
12763                    for (var x2 = 0; x2 < repeat_delta; x2++)
12764                      code_lengths[symbol3 + x2] = repeat_code_len;
12765                    symbol3 += repeat_delta;
12766                    if (repeat_code_len !== 0) {
12767                      space -= repeat_delta << 15 - repeat_code_len;
12768                    }
12769                  }
12770                }
12771                if (space !== 0) {
12772                  throw new Error(
12773                    "[ReadHuffmanCodeLengths] space = " + space
12774                  );
12775                }
12776                for (; symbol3 < num_symbols; symbol3++)
12777                  code_lengths[symbol3] = 0;
12778              }
12779              function ReadHuffmanCode(alphabet_size, tables, table, br) {
12780                var table_size = 0;
12781                var simple_code_or_skip;
12782                var code_lengths = new Uint8Array(alphabet_size);
12783                br.readMoreInput();
12784                simple_code_or_skip = br.readBits(2);
12785                if (simple_code_or_skip === 1) {
12786                  var i2;
12787                  var max_bits_counter = alphabet_size - 1;
12788                  var max_bits = 0;
12789                  var symbols = new Int32Array(4);
12790                  var num_symbols = br.readBits(2) + 1;
12791                  while (max_bits_counter) {
12792                    max_bits_counter >>= 1;
12793                    ++max_bits;
12794                  }
12795                  for (i2 = 0; i2 < num_symbols; ++i2) {
12796                    symbols[i2] = br.readBits(max_bits) % alphabet_size;
12797                    code_lengths[symbols[i2]] = 2;
12798                  }
12799                  code_lengths[symbols[0]] = 1;
12800                  switch (num_symbols) {
12801                    case 1:
12802                      break;
12803                    case 3:
12804                      if (symbols[0] === symbols[1] || symbols[0] === symbols[2] || symbols[1] === symbols[2]) {
12805                        throw new Error(
12806                          "[ReadHuffmanCode] invalid symbols"
12807                        );
12808                      }
12809                      break;
12810                    case 2:
12811                      if (symbols[0] === symbols[1]) {
12812                        throw new Error(
12813                          "[ReadHuffmanCode] invalid symbols"
12814                        );
12815                      }
12816                      code_lengths[symbols[1]] = 1;
12817                      break;
12818                    case 4:
12819                      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]) {
12820                        throw new Error(
12821                          "[ReadHuffmanCode] invalid symbols"
12822                        );
12823                      }
12824                      if (br.readBits(1)) {
12825                        code_lengths[symbols[2]] = 3;
12826                        code_lengths[symbols[3]] = 3;
12827                      } else {
12828                        code_lengths[symbols[0]] = 2;
12829                      }
12830                      break;
12831                  }
12832                } else {
12833                  var i2;
12834                  var code_length_code_lengths = new Uint8Array(
12835                    CODE_LENGTH_CODES
12836                  );
12837                  var space = 32;
12838                  var num_codes = 0;
12839                  var huff = [
12840                    new HuffmanCode(2, 0),
12841                    new HuffmanCode(2, 4),
12842                    new HuffmanCode(2, 3),
12843                    new HuffmanCode(3, 2),
12844                    new HuffmanCode(2, 0),
12845                    new HuffmanCode(2, 4),
12846                    new HuffmanCode(2, 3),
12847                    new HuffmanCode(4, 1),
12848                    new HuffmanCode(2, 0),
12849                    new HuffmanCode(2, 4),
12850                    new HuffmanCode(2, 3),
12851                    new HuffmanCode(3, 2),
12852                    new HuffmanCode(2, 0),
12853                    new HuffmanCode(2, 4),
12854                    new HuffmanCode(2, 3),
12855                    new HuffmanCode(4, 5)
12856                  ];
12857                  for (i2 = simple_code_or_skip; i2 < CODE_LENGTH_CODES && space > 0; ++i2) {
12858                    var code_len_idx = kCodeLengthCodeOrder[i2];
12859                    var p3 = 0;
12860                    var v2;
12861                    br.fillBitWindow();
12862                    p3 += br.val_ >>> br.bit_pos_ & 15;
12863                    br.bit_pos_ += huff[p3].bits;
12864                    v2 = huff[p3].value;
12865                    code_length_code_lengths[code_len_idx] = v2;
12866                    if (v2 !== 0) {
12867                      space -= 32 >> v2;
12868                      ++num_codes;
12869                    }
12870                  }
12871                  if (!(num_codes === 1 || space === 0))
12872                    throw new Error(
12873                      "[ReadHuffmanCode] invalid num_codes or space"
12874                    );
12875                  ReadHuffmanCodeLengths(
12876                    code_length_code_lengths,
12877                    alphabet_size,
12878                    code_lengths,
12879                    br
12880                  );
12881                }
12882                table_size = BrotliBuildHuffmanTable(
12883                  tables,
12884                  table,
12885                  HUFFMAN_TABLE_BITS,
12886                  code_lengths,
12887                  alphabet_size
12888                );
12889                if (table_size === 0) {
12890                  throw new Error(
12891                    "[ReadHuffmanCode] BuildHuffmanTable failed: "
12892                  );
12893                }
12894                return table_size;
12895              }
12896              function ReadBlockLength(table, index, br) {
12897                var code;
12898                var nbits;
12899                code = ReadSymbol(table, index, br);
12900                nbits = Prefix.kBlockLengthPrefixCode[code].nbits;
12901                return Prefix.kBlockLengthPrefixCode[code].offset + br.readBits(nbits);
12902              }
12903              function TranslateShortCodes(code, ringbuffer, index) {
12904                var val;
12905                if (code < NUM_DISTANCE_SHORT_CODES) {
12906                  index += kDistanceShortCodeIndexOffset[code];
12907                  index &= 3;
12908                  val = ringbuffer[index] + kDistanceShortCodeValueOffset[code];
12909                } else {
12910                  val = code - NUM_DISTANCE_SHORT_CODES + 1;
12911                }
12912                return val;
12913              }
12914              function MoveToFront(v2, index) {
12915                var value = v2[index];
12916                var i2 = index;
12917                for (; i2; --i2) v2[i2] = v2[i2 - 1];
12918                v2[0] = value;
12919              }
12920              function InverseMoveToFrontTransform(v2, v_len) {
12921                var mtf = new Uint8Array(256);
12922                var i2;
12923                for (i2 = 0; i2 < 256; ++i2) {
12924                  mtf[i2] = i2;
12925                }
12926                for (i2 = 0; i2 < v_len; ++i2) {
12927                  var index = v2[i2];
12928                  v2[i2] = mtf[index];
12929                  if (index) MoveToFront(mtf, index);
12930                }
12931              }
12932              function HuffmanTreeGroup(alphabet_size, num_htrees) {
12933                this.alphabet_size = alphabet_size;
12934                this.num_htrees = num_htrees;
12935                this.codes = new Array(
12936                  num_htrees + num_htrees * kMaxHuffmanTableSize[alphabet_size + 31 >>> 5]
12937                );
12938                this.htrees = new Uint32Array(num_htrees);
12939              }
12940              HuffmanTreeGroup.prototype.decode = function(br) {
12941                var i2;
12942                var table_size;
12943                var next = 0;
12944                for (i2 = 0; i2 < this.num_htrees; ++i2) {
12945                  this.htrees[i2] = next;
12946                  table_size = ReadHuffmanCode(
12947                    this.alphabet_size,
12948                    this.codes,
12949                    next,
12950                    br
12951                  );
12952                  next += table_size;
12953                }
12954              };
12955              function DecodeContextMap(context_map_size, br) {
12956                var out = { num_htrees: null, context_map: null };
12957                var use_rle_for_zeros;
12958                var max_run_length_prefix = 0;
12959                var table;
12960                var i2;
12961                br.readMoreInput();
12962                var num_htrees = out.num_htrees = DecodeVarLenUint8(br) + 1;
12963                var context_map = out.context_map = new Uint8Array(
12964                  context_map_size
12965                );
12966                if (num_htrees <= 1) {
12967                  return out;
12968                }
12969                use_rle_for_zeros = br.readBits(1);
12970                if (use_rle_for_zeros) {
12971                  max_run_length_prefix = br.readBits(4) + 1;
12972                }
12973                table = [];
12974                for (i2 = 0; i2 < HUFFMAN_MAX_TABLE_SIZE; i2++) {
12975                  table[i2] = new HuffmanCode(0, 0);
12976                }
12977                ReadHuffmanCode(
12978                  num_htrees + max_run_length_prefix,
12979                  table,
12980                  0,
12981                  br
12982                );
12983                for (i2 = 0; i2 < context_map_size; ) {
12984                  var code;
12985                  br.readMoreInput();
12986                  code = ReadSymbol(table, 0, br);
12987                  if (code === 0) {
12988                    context_map[i2] = 0;
12989                    ++i2;
12990                  } else if (code <= max_run_length_prefix) {
12991                    var reps = 1 + (1 << code) + br.readBits(code);
12992                    while (--reps) {
12993                      if (i2 >= context_map_size) {
12994                        throw new Error(
12995                          "[DecodeContextMap] i >= context_map_size"
12996                        );
12997                      }
12998                      context_map[i2] = 0;
12999                      ++i2;
13000                    }
13001                  } else {
13002                    context_map[i2] = code - max_run_length_prefix;
13003                    ++i2;
13004                  }
13005                }
13006                if (br.readBits(1)) {
13007                  InverseMoveToFrontTransform(
13008                    context_map,
13009                    context_map_size
13010                  );
13011                }
13012                return out;
13013              }
13014              function DecodeBlockType(max_block_type, trees, tree_type, block_types, ringbuffers, indexes, br) {
13015                var ringbuffer = tree_type * 2;
13016                var index = tree_type;
13017                var type_code = ReadSymbol(
13018                  trees,
13019                  tree_type * HUFFMAN_MAX_TABLE_SIZE,
13020                  br
13021                );
13022                var block_type;
13023                if (type_code === 0) {
13024                  block_type = ringbuffers[ringbuffer + (indexes[index] & 1)];
13025                } else if (type_code === 1) {
13026                  block_type = ringbuffers[ringbuffer + (indexes[index] - 1 & 1)] + 1;
13027                } else {
13028                  block_type = type_code - 2;
13029                }
13030                if (block_type >= max_block_type) {
13031                  block_type -= max_block_type;
13032                }
13033                block_types[tree_type] = block_type;
13034                ringbuffers[ringbuffer + (indexes[index] & 1)] = block_type;
13035                ++indexes[index];
13036              }
13037              function CopyUncompressedBlockToOutput(output, len, pos, ringbuffer, ringbuffer_mask, br) {
13038                var rb_size = ringbuffer_mask + 1;
13039                var rb_pos = pos & ringbuffer_mask;
13040                var br_pos = br.pos_ & BrotliBitReader.IBUF_MASK;
13041                var nbytes;
13042                if (len < 8 || br.bit_pos_ + (len << 3) < br.bit_end_pos_) {
13043                  while (len-- > 0) {
13044                    br.readMoreInput();
13045                    ringbuffer[rb_pos++] = br.readBits(8);
13046                    if (rb_pos === rb_size) {
13047                      output.write(ringbuffer, rb_size);
13048                      rb_pos = 0;
13049                    }
13050                  }
13051                  return;
13052                }
13053                if (br.bit_end_pos_ < 32) {
13054                  throw new Error(
13055                    "[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32"
13056                  );
13057                }
13058                while (br.bit_pos_ < 32) {
13059                  ringbuffer[rb_pos] = br.val_ >>> br.bit_pos_;
13060                  br.bit_pos_ += 8;
13061                  ++rb_pos;
13062                  --len;
13063                }
13064                nbytes = br.bit_end_pos_ - br.bit_pos_ >> 3;
13065                if (br_pos + nbytes > BrotliBitReader.IBUF_MASK) {
13066                  var tail = BrotliBitReader.IBUF_MASK + 1 - br_pos;
13067                  for (var x2 = 0; x2 < tail; x2++)
13068                    ringbuffer[rb_pos + x2] = br.buf_[br_pos + x2];
13069                  nbytes -= tail;
13070                  rb_pos += tail;
13071                  len -= tail;
13072                  br_pos = 0;
13073                }
13074                for (var x2 = 0; x2 < nbytes; x2++)
13075                  ringbuffer[rb_pos + x2] = br.buf_[br_pos + x2];
13076                rb_pos += nbytes;
13077                len -= nbytes;
13078                if (rb_pos >= rb_size) {
13079                  output.write(ringbuffer, rb_size);
13080                  rb_pos -= rb_size;
13081                  for (var x2 = 0; x2 < rb_pos; x2++)
13082                    ringbuffer[x2] = ringbuffer[rb_size + x2];
13083                }
13084                while (rb_pos + len >= rb_size) {
13085                  nbytes = rb_size - rb_pos;
13086                  if (br.input_.read(ringbuffer, rb_pos, nbytes) < nbytes) {
13087                    throw new Error(
13088                      "[CopyUncompressedBlockToOutput] not enough bytes"
13089                    );
13090                  }
13091                  output.write(ringbuffer, rb_size);
13092                  len -= nbytes;
13093                  rb_pos = 0;
13094                }
13095                if (br.input_.read(ringbuffer, rb_pos, len) < len) {
13096                  throw new Error(
13097                    "[CopyUncompressedBlockToOutput] not enough bytes"
13098                  );
13099                }
13100                br.reset();
13101              }
13102              function JumpToByteBoundary(br) {
13103                var new_bit_pos = br.bit_pos_ + 7 & ~7;
13104                var pad_bits = br.readBits(new_bit_pos - br.bit_pos_);
13105                return pad_bits == 0;
13106              }
13107              function BrotliDecompressedSize(buffer) {
13108                var input = new BrotliInput(buffer);
13109                var br = new BrotliBitReader(input);
13110                DecodeWindowBits(br);
13111                var out = DecodeMetaBlockLength(br);
13112                return out.meta_block_length;
13113              }
13114              exports2.BrotliDecompressedSize = BrotliDecompressedSize;
13115              function BrotliDecompressBuffer(buffer, output_size) {
13116                var input = new BrotliInput(buffer);
13117                if (output_size == null) {
13118                  output_size = BrotliDecompressedSize(buffer);
13119                }
13120                var output_buffer = new Uint8Array(output_size);
13121                var output = new BrotliOutput(output_buffer);
13122                BrotliDecompress(input, output);
13123                if (output.pos < output.buffer.length) {
13124                  output.buffer = output.buffer.subarray(
13125                    0,
13126                    output.pos
13127                  );
13128                }
13129                return output.buffer;
13130              }
13131              exports2.BrotliDecompressBuffer = BrotliDecompressBuffer;
13132              function BrotliDecompress(input, output) {
13133                var i2;
13134                var pos = 0;
13135                var input_end = 0;
13136                var window_bits = 0;
13137                var max_backward_distance;
13138                var max_distance = 0;
13139                var ringbuffer_size;
13140                var ringbuffer_mask;
13141                var ringbuffer;
13142                var ringbuffer_end;
13143                var dist_rb = [16, 15, 11, 4];
13144                var dist_rb_idx = 0;
13145                var prev_byte1 = 0;
13146                var prev_byte2 = 0;
13147                var hgroup = [
13148                  new HuffmanTreeGroup(0, 0),
13149                  new HuffmanTreeGroup(0, 0),
13150                  new HuffmanTreeGroup(0, 0)
13151                ];
13152                var block_type_trees;
13153                var block_len_trees;
13154                var br;
13155                var kRingBufferWriteAheadSlack = 128 + BrotliBitReader.READ_SIZE;
13156                br = new BrotliBitReader(input);
13157                window_bits = DecodeWindowBits(br);
13158                max_backward_distance = (1 << window_bits) - 16;
13159                ringbuffer_size = 1 << window_bits;
13160                ringbuffer_mask = ringbuffer_size - 1;
13161                ringbuffer = new Uint8Array(
13162                  ringbuffer_size + kRingBufferWriteAheadSlack + BrotliDictionary.maxDictionaryWordLength
13163                );
13164                ringbuffer_end = ringbuffer_size;
13165                block_type_trees = [];
13166                block_len_trees = [];
13167                for (var x2 = 0; x2 < 3 * HUFFMAN_MAX_TABLE_SIZE; x2++) {
13168                  block_type_trees[x2] = new HuffmanCode(0, 0);
13169                  block_len_trees[x2] = new HuffmanCode(0, 0);
13170                }
13171                while (!input_end) {
13172                  var meta_block_remaining_len = 0;
13173                  var is_uncompressed;
13174                  var block_length = [1 << 28, 1 << 28, 1 << 28];
13175                  var block_type = [0];
13176                  var num_block_types = [1, 1, 1];
13177                  var block_type_rb = [0, 1, 0, 1, 0, 1];
13178                  var block_type_rb_index = [0];
13179                  var distance_postfix_bits;
13180                  var num_direct_distance_codes;
13181                  var distance_postfix_mask;
13182                  var num_distance_codes;
13183                  var context_map = null;
13184                  var context_modes = null;
13185                  var num_literal_htrees;
13186                  var dist_context_map = null;
13187                  var num_dist_htrees;
13188                  var context_offset = 0;
13189                  var context_map_slice = null;
13190                  var literal_htree_index = 0;
13191                  var dist_context_offset = 0;
13192                  var dist_context_map_slice = null;
13193                  var dist_htree_index = 0;
13194                  var context_lookup_offset1 = 0;
13195                  var context_lookup_offset2 = 0;
13196                  var context_mode;
13197                  var htree_command;
13198                  for (i2 = 0; i2 < 3; ++i2) {
13199                    hgroup[i2].codes = null;
13200                    hgroup[i2].htrees = null;
13201                  }
13202                  br.readMoreInput();
13203                  var _out = DecodeMetaBlockLength(br);
13204                  meta_block_remaining_len = _out.meta_block_length;
13205                  if (pos + meta_block_remaining_len > output.buffer.length) {
13206                    var tmp = new Uint8Array(
13207                      pos + meta_block_remaining_len
13208                    );
13209                    tmp.set(output.buffer);
13210                    output.buffer = tmp;
13211                  }
13212                  input_end = _out.input_end;
13213                  is_uncompressed = _out.is_uncompressed;
13214                  if (_out.is_metadata) {
13215                    JumpToByteBoundary(br);
13216                    for (; meta_block_remaining_len > 0; --meta_block_remaining_len) {
13217                      br.readMoreInput();
13218                      br.readBits(8);
13219                    }
13220                    continue;
13221                  }
13222                  if (meta_block_remaining_len === 0) {
13223                    continue;
13224                  }
13225                  if (is_uncompressed) {
13226                    br.bit_pos_ = br.bit_pos_ + 7 & ~7;
13227                    CopyUncompressedBlockToOutput(
13228                      output,
13229                      meta_block_remaining_len,
13230                      pos,
13231                      ringbuffer,
13232                      ringbuffer_mask,
13233                      br
13234                    );
13235                    pos += meta_block_remaining_len;
13236                    continue;
13237                  }
13238                  for (i2 = 0; i2 < 3; ++i2) {
13239                    num_block_types[i2] = DecodeVarLenUint8(br) + 1;
13240                    if (num_block_types[i2] >= 2) {
13241                      ReadHuffmanCode(
13242                        num_block_types[i2] + 2,
13243                        block_type_trees,
13244                        i2 * HUFFMAN_MAX_TABLE_SIZE,
13245                        br
13246                      );
13247                      ReadHuffmanCode(
13248                        kNumBlockLengthCodes,
13249                        block_len_trees,
13250                        i2 * HUFFMAN_MAX_TABLE_SIZE,
13251                        br
13252                      );
13253                      block_length[i2] = ReadBlockLength(
13254                        block_len_trees,
13255                        i2 * HUFFMAN_MAX_TABLE_SIZE,
13256                        br
13257                      );
13258                      block_type_rb_index[i2] = 1;
13259                    }
13260                  }
13261                  br.readMoreInput();
13262                  distance_postfix_bits = br.readBits(2);
13263                  num_direct_distance_codes = NUM_DISTANCE_SHORT_CODES + (br.readBits(4) << distance_postfix_bits);
13264                  distance_postfix_mask = (1 << distance_postfix_bits) - 1;
13265                  num_distance_codes = num_direct_distance_codes + (48 << distance_postfix_bits);
13266                  context_modes = new Uint8Array(
13267                    num_block_types[0]
13268                  );
13269                  for (i2 = 0; i2 < num_block_types[0]; ++i2) {
13270                    br.readMoreInput();
13271                    context_modes[i2] = br.readBits(2) << 1;
13272                  }
13273                  var _o1 = DecodeContextMap(
13274                    num_block_types[0] << kLiteralContextBits,
13275                    br
13276                  );
13277                  num_literal_htrees = _o1.num_htrees;
13278                  context_map = _o1.context_map;
13279                  var _o2 = DecodeContextMap(
13280                    num_block_types[2] << kDistanceContextBits,
13281                    br
13282                  );
13283                  num_dist_htrees = _o2.num_htrees;
13284                  dist_context_map = _o2.context_map;
13285                  hgroup[0] = new HuffmanTreeGroup(
13286                    kNumLiteralCodes,
13287                    num_literal_htrees
13288                  );
13289                  hgroup[1] = new HuffmanTreeGroup(
13290                    kNumInsertAndCopyCodes,
13291                    num_block_types[1]
13292                  );
13293                  hgroup[2] = new HuffmanTreeGroup(
13294                    num_distance_codes,
13295                    num_dist_htrees
13296                  );
13297                  for (i2 = 0; i2 < 3; ++i2) {
13298                    hgroup[i2].decode(br);
13299                  }
13300                  context_map_slice = 0;
13301                  dist_context_map_slice = 0;
13302                  context_mode = context_modes[block_type[0]];
13303                  context_lookup_offset1 = Context.lookupOffsets[context_mode];
13304                  context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
13305                  htree_command = hgroup[1].htrees[0];
13306                  while (meta_block_remaining_len > 0) {
13307                    var cmd_code;
13308                    var range_idx;
13309                    var insert_code;
13310                    var copy_code;
13311                    var insert_length;
13312                    var copy_length;
13313                    var distance_code;
13314                    var distance;
13315                    var context;
13316                    var j2;
13317                    var copy_dst;
13318                    br.readMoreInput();
13319                    if (block_length[1] === 0) {
13320                      DecodeBlockType(
13321                        num_block_types[1],
13322                        block_type_trees,
13323                        1,
13324                        block_type,
13325                        block_type_rb,
13326                        block_type_rb_index,
13327                        br
13328                      );
13329                      block_length[1] = ReadBlockLength(
13330                        block_len_trees,
13331                        HUFFMAN_MAX_TABLE_SIZE,
13332                        br
13333                      );
13334                      htree_command = hgroup[1].htrees[block_type[1]];
13335                    }
13336                    --block_length[1];
13337                    cmd_code = ReadSymbol(
13338                      hgroup[1].codes,
13339                      htree_command,
13340                      br
13341                    );
13342                    range_idx = cmd_code >> 6;
13343                    if (range_idx >= 2) {
13344                      range_idx -= 2;
13345                      distance_code = -1;
13346                    } else {
13347                      distance_code = 0;
13348                    }
13349                    insert_code = Prefix.kInsertRangeLut[range_idx] + (cmd_code >> 3 & 7);
13350                    copy_code = Prefix.kCopyRangeLut[range_idx] + (cmd_code & 7);
13351                    insert_length = Prefix.kInsertLengthPrefixCode[insert_code].offset + br.readBits(
13352                      Prefix.kInsertLengthPrefixCode[insert_code].nbits
13353                    );
13354                    copy_length = Prefix.kCopyLengthPrefixCode[copy_code].offset + br.readBits(
13355                      Prefix.kCopyLengthPrefixCode[copy_code].nbits
13356                    );
13357                    prev_byte1 = ringbuffer[pos - 1 & ringbuffer_mask];
13358                    prev_byte2 = ringbuffer[pos - 2 & ringbuffer_mask];
13359                    for (j2 = 0; j2 < insert_length; ++j2) {
13360                      br.readMoreInput();
13361                      if (block_length[0] === 0) {
13362                        DecodeBlockType(
13363                          num_block_types[0],
13364                          block_type_trees,
13365                          0,
13366                          block_type,
13367                          block_type_rb,
13368                          block_type_rb_index,
13369                          br
13370                        );
13371                        block_length[0] = ReadBlockLength(
13372                          block_len_trees,
13373                          0,
13374                          br
13375                        );
13376                        context_offset = block_type[0] << kLiteralContextBits;
13377                        context_map_slice = context_offset;
13378                        context_mode = context_modes[block_type[0]];
13379                        context_lookup_offset1 = Context.lookupOffsets[context_mode];
13380                        context_lookup_offset2 = Context.lookupOffsets[context_mode + 1];
13381                      }
13382                      context = Context.lookup[context_lookup_offset1 + prev_byte1] | Context.lookup[context_lookup_offset2 + prev_byte2];
13383                      literal_htree_index = context_map[context_map_slice + context];
13384                      --block_length[0];
13385                      prev_byte2 = prev_byte1;
13386                      prev_byte1 = ReadSymbol(
13387                        hgroup[0].codes,
13388                        hgroup[0].htrees[literal_htree_index],
13389                        br
13390                      );
13391                      ringbuffer[pos & ringbuffer_mask] = prev_byte1;
13392                      if ((pos & ringbuffer_mask) === ringbuffer_mask) {
13393                        output.write(
13394                          ringbuffer,
13395                          ringbuffer_size
13396                        );
13397                      }
13398                      ++pos;
13399                    }
13400                    meta_block_remaining_len -= insert_length;
13401                    if (meta_block_remaining_len <= 0) break;
13402                    if (distance_code < 0) {
13403                      var context;
13404                      br.readMoreInput();
13405                      if (block_length[2] === 0) {
13406                        DecodeBlockType(
13407                          num_block_types[2],
13408                          block_type_trees,
13409                          2,
13410                          block_type,
13411                          block_type_rb,
13412                          block_type_rb_index,
13413                          br
13414                        );
13415                        block_length[2] = ReadBlockLength(
13416                          block_len_trees,
13417                          2 * HUFFMAN_MAX_TABLE_SIZE,
13418                          br
13419                        );
13420                        dist_context_offset = block_type[2] << kDistanceContextBits;
13421                        dist_context_map_slice = dist_context_offset;
13422                      }
13423                      --block_length[2];
13424                      context = (copy_length > 4 ? 3 : copy_length - 2) & 255;
13425                      dist_htree_index = dist_context_map[dist_context_map_slice + context];
13426                      distance_code = ReadSymbol(
13427                        hgroup[2].codes,
13428                        hgroup[2].htrees[dist_htree_index],
13429                        br
13430                      );
13431                      if (distance_code >= num_direct_distance_codes) {
13432                        var nbits;
13433                        var postfix;
13434                        var offset;
13435                        distance_code -= num_direct_distance_codes;
13436                        postfix = distance_code & distance_postfix_mask;
13437                        distance_code >>= distance_postfix_bits;
13438                        nbits = (distance_code >> 1) + 1;
13439                        offset = (2 + (distance_code & 1) << nbits) - 4;
13440                        distance_code = num_direct_distance_codes + (offset + br.readBits(nbits) << distance_postfix_bits) + postfix;
13441                      }
13442                    }
13443                    distance = TranslateShortCodes(
13444                      distance_code,
13445                      dist_rb,
13446                      dist_rb_idx
13447                    );
13448                    if (distance < 0) {
13449                      throw new Error(
13450                        "[BrotliDecompress] invalid distance"
13451                      );
13452                    }
13453                    if (pos < max_backward_distance && max_distance !== max_backward_distance) {
13454                      max_distance = pos;
13455                    } else {
13456                      max_distance = max_backward_distance;
13457                    }
13458                    copy_dst = pos & ringbuffer_mask;
13459                    if (distance > max_distance) {
13460                      if (copy_length >= BrotliDictionary.minDictionaryWordLength && copy_length <= BrotliDictionary.maxDictionaryWordLength) {
13461                        var offset = BrotliDictionary.offsetsByLength[copy_length];
13462                        var word_id = distance - max_distance - 1;
13463                        var shift = BrotliDictionary.sizeBitsByLength[copy_length];
13464                        var mask = (1 << shift) - 1;
13465                        var word_idx = word_id & mask;
13466                        var transform_idx = word_id >> shift;
13467                        offset += word_idx * copy_length;
13468                        if (transform_idx < Transform.kNumTransforms) {
13469                          var len = Transform.transformDictionaryWord(
13470                            ringbuffer,
13471                            copy_dst,
13472                            offset,
13473                            copy_length,
13474                            transform_idx
13475                          );
13476                          copy_dst += len;
13477                          pos += len;
13478                          meta_block_remaining_len -= len;
13479                          if (copy_dst >= ringbuffer_end) {
13480                            output.write(
13481                              ringbuffer,
13482                              ringbuffer_size
13483                            );
13484                            for (var _x24 = 0; _x24 < copy_dst - ringbuffer_end; _x24++)
13485                              ringbuffer[_x24] = ringbuffer[ringbuffer_end + _x24];
13486                          }
13487                        } else {
13488                          throw new Error(
13489                            "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len
13490                          );
13491                        }
13492                      } else {
13493                        throw new Error(
13494                          "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len
13495                        );
13496                      }
13497                    } else {
13498                      if (distance_code > 0) {
13499                        dist_rb[dist_rb_idx & 3] = distance;
13500                        ++dist_rb_idx;
13501                      }
13502                      if (copy_length > meta_block_remaining_len) {
13503                        throw new Error(
13504                          "Invalid backward reference. pos: " + pos + " distance: " + distance + " len: " + copy_length + " bytes left: " + meta_block_remaining_len
13505                        );
13506                      }
13507                      for (j2 = 0; j2 < copy_length; ++j2) {
13508                        ringbuffer[pos & ringbuffer_mask] = ringbuffer[pos - distance & ringbuffer_mask];
13509                        if ((pos & ringbuffer_mask) === ringbuffer_mask) {
13510                          output.write(
13511                            ringbuffer,
13512                            ringbuffer_size
13513                          );
13514                        }
13515                        ++pos;
13516                        --meta_block_remaining_len;
13517                      }
13518                    }
13519                    prev_byte1 = ringbuffer[pos - 1 & ringbuffer_mask];
13520                    prev_byte2 = ringbuffer[pos - 2 & ringbuffer_mask];
13521                  }
13522                  pos &= 1073741823;
13523                }
13524                output.write(ringbuffer, pos & ringbuffer_mask);
13525              }
13526              exports2.BrotliDecompress = BrotliDecompress;
13527              BrotliDictionary.init();
13528            },
13529            {
13530              "./bit_reader": 1,
13531              "./context": 2,
13532              "./dictionary": 6,
13533              "./huffman": 7,
13534              "./prefix": 9,
13535              "./streams": 10,
13536              "./transform": 11
13537            }
13538          ],
13539          4: [
13540            function(require2, module2, exports2) {
13541              var base64 = require2("base64-js");
13542              exports2.init = function() {
13543                var BrotliDecompressBuffer = require2("./decode").BrotliDecompressBuffer;
13544                var compressed = base64.toByteArray(
13545                  require2("./dictionary.bin.js")
13546                );
13547                return BrotliDecompressBuffer(compressed);
13548              };
13549            },
13550            { "./decode": 3, "./dictionary.bin.js": 5, "base64-js": 8 }
13551          ],
13552          5: [
13553            function(require2, module2, exports2) {
13554              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=";
13555            },
13556            {}
13557          ],
13558          6: [
13559            function(require2, module2, exports2) {
13560              var data = require2("./dictionary-browser");
13561              exports2.init = function() {
13562                exports2.dictionary = data.init();
13563              };
13564              exports2.offsetsByLength = new Uint32Array([
13565                0,
13566                0,
13567                0,
13568                0,
13569                0,
13570                4096,
13571                9216,
13572                21504,
13573                35840,
13574                44032,
13575                53248,
13576                63488,
13577                74752,
13578                87040,
13579                93696,
13580                100864,
13581                104704,
13582                106752,
13583                108928,
13584                113536,
13585                115968,
13586                118528,
13587                119872,
13588                121280,
13589                122016
13590              ]);
13591              exports2.sizeBitsByLength = new Uint8Array([
13592                0,
13593                0,
13594                0,
13595                0,
13596                10,
13597                10,
13598                11,
13599                11,
13600                10,
13601                10,
13602                10,
13603                10,
13604                10,
13605                9,
13606                9,
13607                8,
13608                7,
13609                7,
13610                8,
13611                7,
13612                7,
13613                6,
13614                6,
13615                5,
13616                5
13617              ]);
13618              exports2.minDictionaryWordLength = 4;
13619              exports2.maxDictionaryWordLength = 24;
13620            },
13621            { "./dictionary-browser": 4 }
13622          ],
13623          7: [
13624            function(require2, module2, exports2) {
13625              function HuffmanCode(bits, value) {
13626                this.bits = bits;
13627                this.value = value;
13628              }
13629              exports2.HuffmanCode = HuffmanCode;
13630              var MAX_LENGTH = 15;
13631              function GetNextKey(key, len) {
13632                var step = 1 << len - 1;
13633                while (key & step) {
13634                  step >>= 1;
13635                }
13636                return (key & step - 1) + step;
13637              }
13638              function ReplicateValue(table, i2, step, end, code) {
13639                do {
13640                  end -= step;
13641                  table[i2 + end] = new HuffmanCode(
13642                    code.bits,
13643                    code.value
13644                  );
13645                } while (end > 0);
13646              }
13647              function NextTableBitSize(count, len, root_bits) {
13648                var left = 1 << len - root_bits;
13649                while (len < MAX_LENGTH) {
13650                  left -= count[len];
13651                  if (left <= 0) break;
13652                  ++len;
13653                  left <<= 1;
13654                }
13655                return len - root_bits;
13656              }
13657              exports2.BrotliBuildHuffmanTable = function(root_table, table, root_bits, code_lengths, code_lengths_size) {
13658                var start_table = table;
13659                var code;
13660                var len;
13661                var symbol3;
13662                var key;
13663                var step;
13664                var low;
13665                var mask;
13666                var table_bits;
13667                var table_size;
13668                var total_size;
13669                var sorted;
13670                var count = new Int32Array(
13671                  MAX_LENGTH + 1
13672                );
13673                var offset = new Int32Array(
13674                  MAX_LENGTH + 1
13675                );
13676                sorted = new Int32Array(code_lengths_size);
13677                for (symbol3 = 0; symbol3 < code_lengths_size; symbol3++) {
13678                  count[code_lengths[symbol3]]++;
13679                }
13680                offset[1] = 0;
13681                for (len = 1; len < MAX_LENGTH; len++) {
13682                  offset[len + 1] = offset[len] + count[len];
13683                }
13684                for (symbol3 = 0; symbol3 < code_lengths_size; symbol3++) {
13685                  if (code_lengths[symbol3] !== 0) {
13686                    sorted[offset[code_lengths[symbol3]]++] = symbol3;
13687                  }
13688                }
13689                table_bits = root_bits;
13690                table_size = 1 << table_bits;
13691                total_size = table_size;
13692                if (offset[MAX_LENGTH] === 1) {
13693                  for (key = 0; key < total_size; ++key) {
13694                    root_table[table + key] = new HuffmanCode(
13695                      0,
13696                      sorted[0] & 65535
13697                    );
13698                  }
13699                  return total_size;
13700                }
13701                key = 0;
13702                symbol3 = 0;
13703                for (len = 1, step = 2; len <= root_bits; ++len, step <<= 1) {
13704                  for (; count[len] > 0; --count[len]) {
13705                    code = new HuffmanCode(
13706                      len & 255,
13707                      sorted[symbol3++] & 65535
13708                    );
13709                    ReplicateValue(
13710                      root_table,
13711                      table + key,
13712                      step,
13713                      table_size,
13714                      code
13715                    );
13716                    key = GetNextKey(key, len);
13717                  }
13718                }
13719                mask = total_size - 1;
13720                low = -1;
13721                for (len = root_bits + 1, step = 2; len <= MAX_LENGTH; ++len, step <<= 1) {
13722                  for (; count[len] > 0; --count[len]) {
13723                    if ((key & mask) !== low) {
13724                      table += table_size;
13725                      table_bits = NextTableBitSize(
13726                        count,
13727                        len,
13728                        root_bits
13729                      );
13730                      table_size = 1 << table_bits;
13731                      total_size += table_size;
13732                      low = key & mask;
13733                      root_table[start_table + low] = new HuffmanCode(
13734                        table_bits + root_bits & 255,
13735                        table - start_table - low & 65535
13736                      );
13737                    }
13738                    code = new HuffmanCode(
13739                      len - root_bits & 255,
13740                      sorted[symbol3++] & 65535
13741                    );
13742                    ReplicateValue(
13743                      root_table,
13744                      table + (key >> root_bits),
13745                      step,
13746                      table_size,
13747                      code
13748                    );
13749                    key = GetNextKey(key, len);
13750                  }
13751                }
13752                return total_size;
13753              };
13754            },
13755            {}
13756          ],
13757          8: [
13758            function(require2, module2, exports2) {
13759              "use strict";
13760              exports2.byteLength = byteLength;
13761              exports2.toByteArray = toByteArray;
13762              exports2.fromByteArray = fromByteArray;
13763              var lookup = [];
13764              var revLookup = [];
13765              var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
13766              var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
13767              for (var i2 = 0, len = code.length; i2 < len; ++i2) {
13768                lookup[i2] = code[i2];
13769                revLookup[code.charCodeAt(i2)] = i2;
13770              }
13771              revLookup["-".charCodeAt(0)] = 62;
13772              revLookup["_".charCodeAt(0)] = 63;
13773              function getLens(b64) {
13774                var len2 = b64.length;
13775                if (len2 % 4 > 0) {
13776                  throw new Error(
13777                    "Invalid string. Length must be a multiple of 4"
13778                  );
13779                }
13780                var validLen = b64.indexOf("=");
13781                if (validLen === -1) validLen = len2;
13782                var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
13783                return [validLen, placeHoldersLen];
13784              }
13785              function byteLength(b64) {
13786                var lens = getLens(b64);
13787                var validLen = lens[0];
13788                var placeHoldersLen = lens[1];
13789                return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
13790              }
13791              function _byteLength(b64, validLen, placeHoldersLen) {
13792                return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
13793              }
13794              function toByteArray(b64) {
13795                var tmp;
13796                var lens = getLens(b64);
13797                var validLen = lens[0];
13798                var placeHoldersLen = lens[1];
13799                var arr = new Arr(
13800                  _byteLength(b64, validLen, placeHoldersLen)
13801                );
13802                var curByte = 0;
13803                var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
13804                for (var i22 = 0; i22 < len2; i22 += 4) {
13805                  tmp = revLookup[b64.charCodeAt(i22)] << 18 | revLookup[b64.charCodeAt(i22 + 1)] << 12 | revLookup[b64.charCodeAt(i22 + 2)] << 6 | revLookup[b64.charCodeAt(i22 + 3)];
13806                  arr[curByte++] = tmp >> 16 & 255;
13807                  arr[curByte++] = tmp >> 8 & 255;
13808                  arr[curByte++] = tmp & 255;
13809                }
13810                if (placeHoldersLen === 2) {
13811                  tmp = revLookup[b64.charCodeAt(i22)] << 2 | revLookup[b64.charCodeAt(i22 + 1)] >> 4;
13812                  arr[curByte++] = tmp & 255;
13813                }
13814                if (placeHoldersLen === 1) {
13815                  tmp = revLookup[b64.charCodeAt(i22)] << 10 | revLookup[b64.charCodeAt(i22 + 1)] << 4 | revLookup[b64.charCodeAt(i22 + 2)] >> 2;
13816                  arr[curByte++] = tmp >> 8 & 255;
13817                  arr[curByte++] = tmp & 255;
13818                }
13819                return arr;
13820              }
13821              function tripletToBase64(num) {
13822                return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
13823              }
13824              function encodeChunk(uint8, start2, end) {
13825                var tmp;
13826                var output = [];
13827                for (var i22 = start2; i22 < end; i22 += 3) {
13828                  tmp = (uint8[i22] << 16 & 16711680) + (uint8[i22 + 1] << 8 & 65280) + (uint8[i22 + 2] & 255);
13829                  output.push(tripletToBase64(tmp));
13830                }
13831                return output.join("");
13832              }
13833              function fromByteArray(uint8) {
13834                var tmp;
13835                var len2 = uint8.length;
13836                var extraBytes = len2 % 3;
13837                var parts = [];
13838                var maxChunkLength = 16383;
13839                for (var i22 = 0, len22 = len2 - extraBytes; i22 < len22; i22 += maxChunkLength) {
13840                  parts.push(
13841                    encodeChunk(
13842                      uint8,
13843                      i22,
13844                      i22 + maxChunkLength > len22 ? len22 : i22 + maxChunkLength
13845                    )
13846                  );
13847                }
13848                if (extraBytes === 1) {
13849                  tmp = uint8[len2 - 1];
13850                  parts.push(
13851                    lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
13852                  );
13853                } else if (extraBytes === 2) {
13854                  tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
13855                  parts.push(
13856                    lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
13857                  );
13858                }
13859                return parts.join("");
13860              }
13861            },
13862            {}
13863          ],
13864          9: [
13865            function(require2, module2, exports2) {
13866              function PrefixCodeRange(offset, nbits) {
13867                this.offset = offset;
13868                this.nbits = nbits;
13869              }
13870              exports2.kBlockLengthPrefixCode = [
13871                new PrefixCodeRange(1, 2),
13872                new PrefixCodeRange(5, 2),
13873                new PrefixCodeRange(9, 2),
13874                new PrefixCodeRange(13, 2),
13875                new PrefixCodeRange(17, 3),
13876                new PrefixCodeRange(25, 3),
13877                new PrefixCodeRange(33, 3),
13878                new PrefixCodeRange(41, 3),
13879                new PrefixCodeRange(49, 4),
13880                new PrefixCodeRange(65, 4),
13881                new PrefixCodeRange(81, 4),
13882                new PrefixCodeRange(97, 4),
13883                new PrefixCodeRange(113, 5),
13884                new PrefixCodeRange(145, 5),
13885                new PrefixCodeRange(177, 5),
13886                new PrefixCodeRange(209, 5),
13887                new PrefixCodeRange(241, 6),
13888                new PrefixCodeRange(305, 6),
13889                new PrefixCodeRange(369, 7),
13890                new PrefixCodeRange(497, 8),
13891                new PrefixCodeRange(753, 9),
13892                new PrefixCodeRange(1265, 10),
13893                new PrefixCodeRange(2289, 11),
13894                new PrefixCodeRange(4337, 12),
13895                new PrefixCodeRange(8433, 13),
13896                new PrefixCodeRange(16625, 24)
13897              ];
13898              exports2.kInsertLengthPrefixCode = [
13899                new PrefixCodeRange(0, 0),
13900                new PrefixCodeRange(1, 0),
13901                new PrefixCodeRange(2, 0),
13902                new PrefixCodeRange(3, 0),
13903                new PrefixCodeRange(4, 0),
13904                new PrefixCodeRange(5, 0),
13905                new PrefixCodeRange(6, 1),
13906                new PrefixCodeRange(8, 1),
13907                new PrefixCodeRange(10, 2),
13908                new PrefixCodeRange(14, 2),
13909                new PrefixCodeRange(18, 3),
13910                new PrefixCodeRange(26, 3),
13911                new PrefixCodeRange(34, 4),
13912                new PrefixCodeRange(50, 4),
13913                new PrefixCodeRange(66, 5),
13914                new PrefixCodeRange(98, 5),
13915                new PrefixCodeRange(130, 6),
13916                new PrefixCodeRange(194, 7),
13917                new PrefixCodeRange(322, 8),
13918                new PrefixCodeRange(578, 9),
13919                new PrefixCodeRange(1090, 10),
13920                new PrefixCodeRange(2114, 12),
13921                new PrefixCodeRange(6210, 14),
13922                new PrefixCodeRange(22594, 24)
13923              ];
13924              exports2.kCopyLengthPrefixCode = [
13925                new PrefixCodeRange(2, 0),
13926                new PrefixCodeRange(3, 0),
13927                new PrefixCodeRange(4, 0),
13928                new PrefixCodeRange(5, 0),
13929                new PrefixCodeRange(6, 0),
13930                new PrefixCodeRange(7, 0),
13931                new PrefixCodeRange(8, 0),
13932                new PrefixCodeRange(9, 0),
13933                new PrefixCodeRange(10, 1),
13934                new PrefixCodeRange(12, 1),
13935                new PrefixCodeRange(14, 2),
13936                new PrefixCodeRange(18, 2),
13937                new PrefixCodeRange(22, 3),
13938                new PrefixCodeRange(30, 3),
13939                new PrefixCodeRange(38, 4),
13940                new PrefixCodeRange(54, 4),
13941                new PrefixCodeRange(70, 5),
13942                new PrefixCodeRange(102, 5),
13943                new PrefixCodeRange(134, 6),
13944                new PrefixCodeRange(198, 7),
13945                new PrefixCodeRange(326, 8),
13946                new PrefixCodeRange(582, 9),
13947                new PrefixCodeRange(1094, 10),
13948                new PrefixCodeRange(2118, 24)
13949              ];
13950              exports2.kInsertRangeLut = [0, 0, 8, 8, 0, 16, 8, 16, 16];
13951              exports2.kCopyRangeLut = [0, 8, 0, 8, 16, 0, 16, 8, 16];
13952            },
13953            {}
13954          ],
13955          10: [
13956            function(require2, module2, exports2) {
13957              function BrotliInput(buffer) {
13958                this.buffer = buffer;
13959                this.pos = 0;
13960              }
13961              BrotliInput.prototype.read = function(buf, i2, count) {
13962                if (this.pos + count > this.buffer.length) {
13963                  count = this.buffer.length - this.pos;
13964                }
13965                for (var p3 = 0; p3 < count; p3++)
13966                  buf[i2 + p3] = this.buffer[this.pos + p3];
13967                this.pos += count;
13968                return count;
13969              };
13970              exports2.BrotliInput = BrotliInput;
13971              function BrotliOutput(buf) {
13972                this.buffer = buf;
13973                this.pos = 0;
13974              }
13975              BrotliOutput.prototype.write = function(buf, count) {
13976                if (this.pos + count > this.buffer.length)
13977                  throw new Error(
13978                    "Output buffer is not large enough"
13979                  );
13980                this.buffer.set(buf.subarray(0, count), this.pos);
13981                this.pos += count;
13982                return count;
13983              };
13984              exports2.BrotliOutput = BrotliOutput;
13985            },
13986            {}
13987          ],
13988          11: [
13989            function(require2, module2, exports2) {
13990              var BrotliDictionary = require2("./dictionary");
13991              var kIdentity = 0;
13992              var kOmitLast1 = 1;
13993              var kOmitLast2 = 2;
13994              var kOmitLast3 = 3;
13995              var kOmitLast4 = 4;
13996              var kOmitLast5 = 5;
13997              var kOmitLast6 = 6;
13998              var kOmitLast7 = 7;
13999              var kOmitLast8 = 8;
14000              var kOmitLast9 = 9;
14001              var kUppercaseFirst = 10;
14002              var kUppercaseAll = 11;
14003              var kOmitFirst1 = 12;
14004              var kOmitFirst2 = 13;
14005              var kOmitFirst3 = 14;
14006              var kOmitFirst4 = 15;
14007              var kOmitFirst5 = 16;
14008              var kOmitFirst6 = 17;
14009              var kOmitFirst7 = 18;
14010              var kOmitFirst8 = 19;
14011              var kOmitFirst9 = 20;
14012              function Transform(prefix2, transform, suffix) {
14013                this.prefix = new Uint8Array(prefix2.length);
14014                this.transform = transform;
14015                this.suffix = new Uint8Array(suffix.length);
14016                for (var i2 = 0; i2 < prefix2.length; i2++)
14017                  this.prefix[i2] = prefix2.charCodeAt(i2);
14018                for (var i2 = 0; i2 < suffix.length; i2++)
14019                  this.suffix[i2] = suffix.charCodeAt(i2);
14020              }
14021              var kTransforms = [
14022                new Transform("", kIdentity, ""),
14023                new Transform("", kIdentity, " "),
14024                new Transform(" ", kIdentity, " "),
14025                new Transform("", kOmitFirst1, ""),
14026                new Transform("", kUppercaseFirst, " "),
14027                new Transform("", kIdentity, " the "),
14028                new Transform(" ", kIdentity, ""),
14029                new Transform("s ", kIdentity, " "),
14030                new Transform("", kIdentity, " of "),
14031                new Transform("", kUppercaseFirst, ""),
14032                new Transform("", kIdentity, " and "),
14033                new Transform("", kOmitFirst2, ""),
14034                new Transform("", kOmitLast1, ""),
14035                new Transform(", ", kIdentity, " "),
14036                new Transform("", kIdentity, ", "),
14037                new Transform(" ", kUppercaseFirst, " "),
14038                new Transform("", kIdentity, " in "),
14039                new Transform("", kIdentity, " to "),
14040                new Transform("e ", kIdentity, " "),
14041                new Transform("", kIdentity, '"'),
14042                new Transform("", kIdentity, "."),
14043                new Transform("", kIdentity, '">'),
14044                new Transform("", kIdentity, "\n"),
14045                new Transform("", kOmitLast3, ""),
14046                new Transform("", kIdentity, "]"),
14047                new Transform("", kIdentity, " for "),
14048                new Transform("", kOmitFirst3, ""),
14049                new Transform("", kOmitLast2, ""),
14050                new Transform("", kIdentity, " a "),
14051                new Transform("", kIdentity, " that "),
14052                new Transform(" ", kUppercaseFirst, ""),
14053                new Transform("", kIdentity, ". "),
14054                new Transform(".", kIdentity, ""),
14055                new Transform(" ", kIdentity, ", "),
14056                new Transform("", kOmitFirst4, ""),
14057                new Transform("", kIdentity, " with "),
14058                new Transform("", kIdentity, "'"),
14059                new Transform("", kIdentity, " from "),
14060                new Transform("", kIdentity, " by "),
14061                new Transform("", kOmitFirst5, ""),
14062                new Transform("", kOmitFirst6, ""),
14063                new Transform(" the ", kIdentity, ""),
14064                new Transform("", kOmitLast4, ""),
14065                new Transform("", kIdentity, ". The "),
14066                new Transform("", kUppercaseAll, ""),
14067                new Transform("", kIdentity, " on "),
14068                new Transform("", kIdentity, " as "),
14069                new Transform("", kIdentity, " is "),
14070                new Transform("", kOmitLast7, ""),
14071                new Transform("", kOmitLast1, "ing "),
14072                new Transform("", kIdentity, "\n    "),
14073                new Transform("", kIdentity, ":"),
14074                new Transform(" ", kIdentity, ". "),
14075                new Transform("", kIdentity, "ed "),
14076                new Transform("", kOmitFirst9, ""),
14077                new Transform("", kOmitFirst7, ""),
14078                new Transform("", kOmitLast6, ""),
14079                new Transform("", kIdentity, "("),
14080                new Transform("", kUppercaseFirst, ", "),
14081                new Transform("", kOmitLast8, ""),
14082                new Transform("", kIdentity, " at "),
14083                new Transform("", kIdentity, "ly "),
14084                new Transform(" the ", kIdentity, " of "),
14085                new Transform("", kOmitLast5, ""),
14086                new Transform("", kOmitLast9, ""),
14087                new Transform(" ", kUppercaseFirst, ", "),
14088                new Transform("", kUppercaseFirst, '"'),
14089                new Transform(".", kIdentity, "("),
14090                new Transform("", kUppercaseAll, " "),
14091                new Transform("", kUppercaseFirst, '">'),
14092                new Transform("", kIdentity, '="'),
14093                new Transform(" ", kIdentity, "."),
14094                new Transform(".com/", kIdentity, ""),
14095                new Transform(" the ", kIdentity, " of the "),
14096                new Transform("", kUppercaseFirst, "'"),
14097                new Transform("", kIdentity, ". This "),
14098                new Transform("", kIdentity, ","),
14099                new Transform(".", kIdentity, " "),
14100                new Transform("", kUppercaseFirst, "("),
14101                new Transform("", kUppercaseFirst, "."),
14102                new Transform("", kIdentity, " not "),
14103                new Transform(" ", kIdentity, '="'),
14104                new Transform("", kIdentity, "er "),
14105                new Transform(" ", kUppercaseAll, " "),
14106                new Transform("", kIdentity, "al "),
14107                new Transform(" ", kUppercaseAll, ""),
14108                new Transform("", kIdentity, "='"),
14109                new Transform("", kUppercaseAll, '"'),
14110                new Transform("", kUppercaseFirst, ". "),
14111                new Transform(" ", kIdentity, "("),
14112                new Transform("", kIdentity, "ful "),
14113                new Transform(" ", kUppercaseFirst, ". "),
14114                new Transform("", kIdentity, "ive "),
14115                new Transform("", kIdentity, "less "),
14116                new Transform("", kUppercaseAll, "'"),
14117                new Transform("", kIdentity, "est "),
14118                new Transform(" ", kUppercaseFirst, "."),
14119                new Transform("", kUppercaseAll, '">'),
14120                new Transform(" ", kIdentity, "='"),
14121                new Transform("", kUppercaseFirst, ","),
14122                new Transform("", kIdentity, "ize "),
14123                new Transform("", kUppercaseAll, "."),
14124                new Transform("\xC2\xA0", kIdentity, ""),
14125                new Transform(" ", kIdentity, ","),
14126                new Transform("", kUppercaseFirst, '="'),
14127                new Transform("", kUppercaseAll, '="'),
14128                new Transform("", kIdentity, "ous "),
14129                new Transform("", kUppercaseAll, ", "),
14130                new Transform("", kUppercaseFirst, "='"),
14131                new Transform(" ", kUppercaseFirst, ","),
14132                new Transform(" ", kUppercaseAll, '="'),
14133                new Transform(" ", kUppercaseAll, ", "),
14134                new Transform("", kUppercaseAll, ","),
14135                new Transform("", kUppercaseAll, "("),
14136                new Transform("", kUppercaseAll, ". "),
14137                new Transform(" ", kUppercaseAll, "."),
14138                new Transform("", kUppercaseAll, "='"),
14139                new Transform(" ", kUppercaseAll, ". "),
14140                new Transform(" ", kUppercaseFirst, '="'),
14141                new Transform(" ", kUppercaseAll, "='"),
14142                new Transform(" ", kUppercaseFirst, "='")
14143              ];
14144              exports2.kTransforms = kTransforms;
14145              exports2.kNumTransforms = kTransforms.length;
14146              function ToUpperCase(p3, i2) {
14147                if (p3[i2] < 192) {
14148                  if (p3[i2] >= 97 && p3[i2] <= 122) {
14149                    p3[i2] ^= 32;
14150                  }
14151                  return 1;
14152                }
14153                if (p3[i2] < 224) {
14154                  p3[i2 + 1] ^= 32;
14155                  return 2;
14156                }
14157                p3[i2 + 2] ^= 5;
14158                return 3;
14159              }
14160              exports2.transformDictionaryWord = function(dst, idx, word, len, transform) {
14161                var prefix2 = kTransforms[transform].prefix;
14162                var suffix = kTransforms[transform].suffix;
14163                var t3 = kTransforms[transform].transform;
14164                var skip = t3 < kOmitFirst1 ? 0 : t3 - (kOmitFirst1 - 1);
14165                var i2 = 0;
14166                var start_idx = idx;
14167                var uppercase;
14168                if (skip > len) {
14169                  skip = len;
14170                }
14171                var prefix_pos = 0;
14172                while (prefix_pos < prefix2.length) {
14173                  dst[idx++] = prefix2[prefix_pos++];
14174                }
14175                word += skip;
14176                len -= skip;
14177                if (t3 <= kOmitLast9) {
14178                  len -= t3;
14179                }
14180                for (i2 = 0; i2 < len; i2++) {
14181                  dst[idx++] = BrotliDictionary.dictionary[word + i2];
14182                }
14183                uppercase = idx - len;
14184                if (t3 === kUppercaseFirst) {
14185                  ToUpperCase(dst, uppercase);
14186                } else if (t3 === kUppercaseAll) {
14187                  while (len > 0) {
14188                    var step = ToUpperCase(dst, uppercase);
14189                    uppercase += step;
14190                    len -= step;
14191                  }
14192                }
14193                var suffix_pos = 0;
14194                while (suffix_pos < suffix.length) {
14195                  dst[idx++] = suffix[suffix_pos++];
14196                }
14197                return idx - start_idx;
14198              };
14199            },
14200            { "./dictionary": 6 }
14201          ],
14202          12: [
14203            function(require2, module2, exports2) {
14204              module2.exports = require2("./dec/decode").BrotliDecompressBuffer;
14205            },
14206            { "./dec/decode": 3 }
14207          ]
14208        },
14209        {},
14210        [12]
14211      )(12);
14212    })();
14213  
14214    // packages/global-styles-ui/build-module/font-library/lib/inflate.mjs
14215    var __require3 = /* @__PURE__ */ ((x2) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x2, {
14216      get: (a2, b2) => (typeof __require !== "undefined" ? __require : a2)[b2]
14217    }) : x2)(function(x2) {
14218      if (typeof __require !== "undefined") return __require.apply(this, arguments);
14219      throw Error('Dynamic require of "' + x2 + '" is not supported');
14220    });
14221    var inflate_default = (function() {
14222      var define, module, exports;
14223      return (/* @__PURE__ */ (function() {
14224        function r3(e2, n2, t3) {
14225          function o3(i22, f2) {
14226            if (!n2[i22]) {
14227              if (!e2[i22]) {
14228                var c6 = "function" == typeof __require3 && __require3;
14229                if (!f2 && c6) return c6(i22, true);
14230                if (u2) return u2(i22, true);
14231                var a2 = new Error("Cannot find module '" + i22 + "'");
14232                throw a2.code = "MODULE_NOT_FOUND", a2;
14233              }
14234              var p3 = n2[i22] = { exports: {} };
14235              e2[i22][0].call(
14236                p3.exports,
14237                function(r22) {
14238                  var n22 = e2[i22][1][r22];
14239                  return o3(n22 || r22);
14240                },
14241                p3,
14242                p3.exports,
14243                r3,
14244                e2,
14245                n2,
14246                t3
14247              );
14248            }
14249            return n2[i22].exports;
14250          }
14251          for (var u2 = "function" == typeof __require3 && __require3, i2 = 0; i2 < t3.length; i2++)
14252            o3(t3[i2]);
14253          return o3;
14254        }
14255        return r3;
14256      })())(
14257        {
14258          1: [
14259            function(require2, module2, exports2) {
14260              "use strict";
14261              var TYPED_OK = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Int32Array !== "undefined";
14262              function _has(obj, key) {
14263                return Object.prototype.hasOwnProperty.call(obj, key);
14264              }
14265              exports2.assign = function(obj) {
14266                var sources = Array.prototype.slice.call(
14267                  arguments,
14268                  1
14269                );
14270                while (sources.length) {
14271                  var source = sources.shift();
14272                  if (!source) {
14273                    continue;
14274                  }
14275                  if (typeof source !== "object") {
14276                    throw new TypeError(
14277                      source + "must be non-object"
14278                    );
14279                  }
14280                  for (var p3 in source) {
14281                    if (_has(source, p3)) {
14282                      obj[p3] = source[p3];
14283                    }
14284                  }
14285                }
14286                return obj;
14287              };
14288              exports2.shrinkBuf = function(buf, size) {
14289                if (buf.length === size) {
14290                  return buf;
14291                }
14292                if (buf.subarray) {
14293                  return buf.subarray(0, size);
14294                }
14295                buf.length = size;
14296                return buf;
14297              };
14298              var fnTyped = {
14299                arraySet: function(dest, src, src_offs, len, dest_offs) {
14300                  if (src.subarray && dest.subarray) {
14301                    dest.set(
14302                      src.subarray(src_offs, src_offs + len),
14303                      dest_offs
14304                    );
14305                    return;
14306                  }
14307                  for (var i2 = 0; i2 < len; i2++) {
14308                    dest[dest_offs + i2] = src[src_offs + i2];
14309                  }
14310                },
14311                // Join array of chunks to single array.
14312                flattenChunks: function(chunks) {
14313                  var i2, l2, len, pos, chunk2, result;
14314                  len = 0;
14315                  for (i2 = 0, l2 = chunks.length; i2 < l2; i2++) {
14316                    len += chunks[i2].length;
14317                  }
14318                  result = new Uint8Array(len);
14319                  pos = 0;
14320                  for (i2 = 0, l2 = chunks.length; i2 < l2; i2++) {
14321                    chunk2 = chunks[i2];
14322                    result.set(chunk2, pos);
14323                    pos += chunk2.length;
14324                  }
14325                  return result;
14326                }
14327              };
14328              var fnUntyped = {
14329                arraySet: function(dest, src, src_offs, len, dest_offs) {
14330                  for (var i2 = 0; i2 < len; i2++) {
14331                    dest[dest_offs + i2] = src[src_offs + i2];
14332                  }
14333                },
14334                // Join array of chunks to single array.
14335                flattenChunks: function(chunks) {
14336                  return [].concat.apply([], chunks);
14337                }
14338              };
14339              exports2.setTyped = function(on) {
14340                if (on) {
14341                  exports2.Buf8 = Uint8Array;
14342                  exports2.Buf16 = Uint16Array;
14343                  exports2.Buf32 = Int32Array;
14344                  exports2.assign(exports2, fnTyped);
14345                } else {
14346                  exports2.Buf8 = Array;
14347                  exports2.Buf16 = Array;
14348                  exports2.Buf32 = Array;
14349                  exports2.assign(exports2, fnUntyped);
14350                }
14351              };
14352              exports2.setTyped(TYPED_OK);
14353            },
14354            {}
14355          ],
14356          2: [
14357            function(require2, module2, exports2) {
14358              "use strict";
14359              var utils = require2("./common");
14360              var STR_APPLY_OK = true;
14361              var STR_APPLY_UIA_OK = true;
14362              try {
14363                String.fromCharCode.apply(null, [0]);
14364              } catch (__150) {
14365                STR_APPLY_OK = false;
14366              }
14367              try {
14368                String.fromCharCode.apply(null, new Uint8Array(1));
14369              } catch (__150) {
14370                STR_APPLY_UIA_OK = false;
14371              }
14372              var _utf8len = new utils.Buf8(256);
14373              for (var q = 0; q < 256; q++) {
14374                _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
14375              }
14376              _utf8len[254] = _utf8len[254] = 1;
14377              exports2.string2buf = function(str) {
14378                var buf, c6, c22, m_pos, i2, str_len = str.length, buf_len = 0;
14379                for (m_pos = 0; m_pos < str_len; m_pos++) {
14380                  c6 = str.charCodeAt(m_pos);
14381                  if ((c6 & 64512) === 55296 && m_pos + 1 < str_len) {
14382                    c22 = str.charCodeAt(m_pos + 1);
14383                    if ((c22 & 64512) === 56320) {
14384                      c6 = 65536 + (c6 - 55296 << 10) + (c22 - 56320);
14385                      m_pos++;
14386                    }
14387                  }
14388                  buf_len += c6 < 128 ? 1 : c6 < 2048 ? 2 : c6 < 65536 ? 3 : 4;
14389                }
14390                buf = new utils.Buf8(buf_len);
14391                for (i2 = 0, m_pos = 0; i2 < buf_len; m_pos++) {
14392                  c6 = str.charCodeAt(m_pos);
14393                  if ((c6 & 64512) === 55296 && m_pos + 1 < str_len) {
14394                    c22 = str.charCodeAt(m_pos + 1);
14395                    if ((c22 & 64512) === 56320) {
14396                      c6 = 65536 + (c6 - 55296 << 10) + (c22 - 56320);
14397                      m_pos++;
14398                    }
14399                  }
14400                  if (c6 < 128) {
14401                    buf[i2++] = c6;
14402                  } else if (c6 < 2048) {
14403                    buf[i2++] = 192 | c6 >>> 6;
14404                    buf[i2++] = 128 | c6 & 63;
14405                  } else if (c6 < 65536) {
14406                    buf[i2++] = 224 | c6 >>> 12;
14407                    buf[i2++] = 128 | c6 >>> 6 & 63;
14408                    buf[i2++] = 128 | c6 & 63;
14409                  } else {
14410                    buf[i2++] = 240 | c6 >>> 18;
14411                    buf[i2++] = 128 | c6 >>> 12 & 63;
14412                    buf[i2++] = 128 | c6 >>> 6 & 63;
14413                    buf[i2++] = 128 | c6 & 63;
14414                  }
14415                }
14416                return buf;
14417              };
14418              function buf2binstring(buf, len) {
14419                if (len < 65534) {
14420                  if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) {
14421                    return String.fromCharCode.apply(
14422                      null,
14423                      utils.shrinkBuf(buf, len)
14424                    );
14425                  }
14426                }
14427                var result = "";
14428                for (var i2 = 0; i2 < len; i2++) {
14429                  result += String.fromCharCode(buf[i2]);
14430                }
14431                return result;
14432              }
14433              exports2.buf2binstring = function(buf) {
14434                return buf2binstring(buf, buf.length);
14435              };
14436              exports2.binstring2buf = function(str) {
14437                var buf = new utils.Buf8(str.length);
14438                for (var i2 = 0, len = buf.length; i2 < len; i2++) {
14439                  buf[i2] = str.charCodeAt(i2);
14440                }
14441                return buf;
14442              };
14443              exports2.buf2string = function(buf, max) {
14444                var i2, out, c6, c_len;
14445                var len = max || buf.length;
14446                var utf16buf = new Array(len * 2);
14447                for (out = 0, i2 = 0; i2 < len; ) {
14448                  c6 = buf[i2++];
14449                  if (c6 < 128) {
14450                    utf16buf[out++] = c6;
14451                    continue;
14452                  }
14453                  c_len = _utf8len[c6];
14454                  if (c_len > 4) {
14455                    utf16buf[out++] = 65533;
14456                    i2 += c_len - 1;
14457                    continue;
14458                  }
14459                  c6 &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7;
14460                  while (c_len > 1 && i2 < len) {
14461                    c6 = c6 << 6 | buf[i2++] & 63;
14462                    c_len--;
14463                  }
14464                  if (c_len > 1) {
14465                    utf16buf[out++] = 65533;
14466                    continue;
14467                  }
14468                  if (c6 < 65536) {
14469                    utf16buf[out++] = c6;
14470                  } else {
14471                    c6 -= 65536;
14472                    utf16buf[out++] = 55296 | c6 >> 10 & 1023;
14473                    utf16buf[out++] = 56320 | c6 & 1023;
14474                  }
14475                }
14476                return buf2binstring(utf16buf, out);
14477              };
14478              exports2.utf8border = function(buf, max) {
14479                var pos;
14480                max = max || buf.length;
14481                if (max > buf.length) {
14482                  max = buf.length;
14483                }
14484                pos = max - 1;
14485                while (pos >= 0 && (buf[pos] & 192) === 128) {
14486                  pos--;
14487                }
14488                if (pos < 0) {
14489                  return max;
14490                }
14491                if (pos === 0) {
14492                  return max;
14493                }
14494                return pos + _utf8len[buf[pos]] > max ? pos : max;
14495              };
14496            },
14497            { "./common": 1 }
14498          ],
14499          3: [
14500            function(require2, module2, exports2) {
14501              "use strict";
14502              function adler32(adler, buf, len, pos) {
14503                var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n2 = 0;
14504                while (len !== 0) {
14505                  n2 = len > 2e3 ? 2e3 : len;
14506                  len -= n2;
14507                  do {
14508                    s1 = s1 + buf[pos++] | 0;
14509                    s2 = s2 + s1 | 0;
14510                  } while (--n2);
14511                  s1 %= 65521;
14512                  s2 %= 65521;
14513                }
14514                return s1 | s2 << 16 | 0;
14515              }
14516              module2.exports = adler32;
14517            },
14518            {}
14519          ],
14520          4: [
14521            function(require2, module2, exports2) {
14522              "use strict";
14523              module2.exports = {
14524                /* Allowed flush values; see deflate() and inflate() below for details */
14525                Z_NO_FLUSH: 0,
14526                Z_PARTIAL_FLUSH: 1,
14527                Z_SYNC_FLUSH: 2,
14528                Z_FULL_FLUSH: 3,
14529                Z_FINISH: 4,
14530                Z_BLOCK: 5,
14531                Z_TREES: 6,
14532                /* Return codes for the compression/decompression functions. Negative values
14533                 * are errors, positive values are used for special but normal events.
14534                 */
14535                Z_OK: 0,
14536                Z_STREAM_END: 1,
14537                Z_NEED_DICT: 2,
14538                Z_ERRNO: -1,
14539                Z_STREAM_ERROR: -2,
14540                Z_DATA_ERROR: -3,
14541                //Z_MEM_ERROR:     -4,
14542                Z_BUF_ERROR: -5,
14543                //Z_VERSION_ERROR: -6,
14544                /* compression levels */
14545                Z_NO_COMPRESSION: 0,
14546                Z_BEST_SPEED: 1,
14547                Z_BEST_COMPRESSION: 9,
14548                Z_DEFAULT_COMPRESSION: -1,
14549                Z_FILTERED: 1,
14550                Z_HUFFMAN_ONLY: 2,
14551                Z_RLE: 3,
14552                Z_FIXED: 4,
14553                Z_DEFAULT_STRATEGY: 0,
14554                /* Possible values of the data_type field (though see inflate()) */
14555                Z_BINARY: 0,
14556                Z_TEXT: 1,
14557                //Z_ASCII:                1, // = Z_TEXT (deprecated)
14558                Z_UNKNOWN: 2,
14559                /* The deflate compression method */
14560                Z_DEFLATED: 8
14561                //Z_NULL:                 null // Use -1 or null inline, depending on var type
14562              };
14563            },
14564            {}
14565          ],
14566          5: [
14567            function(require2, module2, exports2) {
14568              "use strict";
14569              function makeTable() {
14570                var c6, table = [];
14571                for (var n2 = 0; n2 < 256; n2++) {
14572                  c6 = n2;
14573                  for (var k2 = 0; k2 < 8; k2++) {
14574                    c6 = c6 & 1 ? 3988292384 ^ c6 >>> 1 : c6 >>> 1;
14575                  }
14576                  table[n2] = c6;
14577                }
14578                return table;
14579              }
14580              var crcTable = makeTable();
14581              function crc32(crc, buf, len, pos) {
14582                var t3 = crcTable, end = pos + len;
14583                crc ^= -1;
14584                for (var i2 = pos; i2 < end; i2++) {
14585                  crc = crc >>> 8 ^ t3[(crc ^ buf[i2]) & 255];
14586                }
14587                return crc ^ -1;
14588              }
14589              module2.exports = crc32;
14590            },
14591            {}
14592          ],
14593          6: [
14594            function(require2, module2, exports2) {
14595              "use strict";
14596              function GZheader() {
14597                this.text = 0;
14598                this.time = 0;
14599                this.xflags = 0;
14600                this.os = 0;
14601                this.extra = null;
14602                this.extra_len = 0;
14603                this.name = "";
14604                this.comment = "";
14605                this.hcrc = 0;
14606                this.done = false;
14607              }
14608              module2.exports = GZheader;
14609            },
14610            {}
14611          ],
14612          7: [
14613            function(require2, module2, exports2) {
14614              "use strict";
14615              var BAD = 30;
14616              var TYPE = 12;
14617              module2.exports = function inflate_fast(strm, start2) {
14618                var state;
14619                var _in;
14620                var last;
14621                var _out;
14622                var beg;
14623                var end;
14624                var dmax;
14625                var wsize;
14626                var whave;
14627                var wnext;
14628                var s_window;
14629                var hold;
14630                var bits;
14631                var lcode;
14632                var dcode;
14633                var lmask;
14634                var dmask;
14635                var here;
14636                var op;
14637                var len;
14638                var dist;
14639                var from;
14640                var from_source;
14641                var input, output;
14642                state = strm.state;
14643                _in = strm.next_in;
14644                input = strm.input;
14645                last = _in + (strm.avail_in - 5);
14646                _out = strm.next_out;
14647                output = strm.output;
14648                beg = _out - (start2 - strm.avail_out);
14649                end = _out + (strm.avail_out - 257);
14650                dmax = state.dmax;
14651                wsize = state.wsize;
14652                whave = state.whave;
14653                wnext = state.wnext;
14654                s_window = state.window;
14655                hold = state.hold;
14656                bits = state.bits;
14657                lcode = state.lencode;
14658                dcode = state.distcode;
14659                lmask = (1 << state.lenbits) - 1;
14660                dmask = (1 << state.distbits) - 1;
14661                top: do {
14662                  if (bits < 15) {
14663                    hold += input[_in++] << bits;
14664                    bits += 8;
14665                    hold += input[_in++] << bits;
14666                    bits += 8;
14667                  }
14668                  here = lcode[hold & lmask];
14669                  dolen: for (; ; ) {
14670                    op = here >>> 24;
14671                    hold >>>= op;
14672                    bits -= op;
14673                    op = here >>> 16 & 255;
14674                    if (op === 0) {
14675                      output[_out++] = here & 65535;
14676                    } else if (op & 16) {
14677                      len = here & 65535;
14678                      op &= 15;
14679                      if (op) {
14680                        if (bits < op) {
14681                          hold += input[_in++] << bits;
14682                          bits += 8;
14683                        }
14684                        len += hold & (1 << op) - 1;
14685                        hold >>>= op;
14686                        bits -= op;
14687                      }
14688                      if (bits < 15) {
14689                        hold += input[_in++] << bits;
14690                        bits += 8;
14691                        hold += input[_in++] << bits;
14692                        bits += 8;
14693                      }
14694                      here = dcode[hold & dmask];
14695                      dodist: for (; ; ) {
14696                        op = here >>> 24;
14697                        hold >>>= op;
14698                        bits -= op;
14699                        op = here >>> 16 & 255;
14700                        if (op & 16) {
14701                          dist = here & 65535;
14702                          op &= 15;
14703                          if (bits < op) {
14704                            hold += input[_in++] << bits;
14705                            bits += 8;
14706                            if (bits < op) {
14707                              hold += input[_in++] << bits;
14708                              bits += 8;
14709                            }
14710                          }
14711                          dist += hold & (1 << op) - 1;
14712                          if (dist > dmax) {
14713                            strm.msg = "invalid distance too far back";
14714                            state.mode = BAD;
14715                            break top;
14716                          }
14717                          hold >>>= op;
14718                          bits -= op;
14719                          op = _out - beg;
14720                          if (dist > op) {
14721                            op = dist - op;
14722                            if (op > whave) {
14723                              if (state.sane) {
14724                                strm.msg = "invalid distance too far back";
14725                                state.mode = BAD;
14726                                break top;
14727                              }
14728                            }
14729                            from = 0;
14730                            from_source = s_window;
14731                            if (wnext === 0) {
14732                              from += wsize - op;
14733                              if (op < len) {
14734                                len -= op;
14735                                do {
14736                                  output[_out++] = s_window[from++];
14737                                } while (--op);
14738                                from = _out - dist;
14739                                from_source = output;
14740                              }
14741                            } else if (wnext < op) {
14742                              from += wsize + wnext - op;
14743                              op -= wnext;
14744                              if (op < len) {
14745                                len -= op;
14746                                do {
14747                                  output[_out++] = s_window[from++];
14748                                } while (--op);
14749                                from = 0;
14750                                if (wnext < len) {
14751                                  op = wnext;
14752                                  len -= op;
14753                                  do {
14754                                    output[_out++] = s_window[from++];
14755                                  } while (--op);
14756                                  from = _out - dist;
14757                                  from_source = output;
14758                                }
14759                              }
14760                            } else {
14761                              from += wnext - op;
14762                              if (op < len) {
14763                                len -= op;
14764                                do {
14765                                  output[_out++] = s_window[from++];
14766                                } while (--op);
14767                                from = _out - dist;
14768                                from_source = output;
14769                              }
14770                            }
14771                            while (len > 2) {
14772                              output[_out++] = from_source[from++];
14773                              output[_out++] = from_source[from++];
14774                              output[_out++] = from_source[from++];
14775                              len -= 3;
14776                            }
14777                            if (len) {
14778                              output[_out++] = from_source[from++];
14779                              if (len > 1) {
14780                                output[_out++] = from_source[from++];
14781                              }
14782                            }
14783                          } else {
14784                            from = _out - dist;
14785                            do {
14786                              output[_out++] = output[from++];
14787                              output[_out++] = output[from++];
14788                              output[_out++] = output[from++];
14789                              len -= 3;
14790                            } while (len > 2);
14791                            if (len) {
14792                              output[_out++] = output[from++];
14793                              if (len > 1) {
14794                                output[_out++] = output[from++];
14795                              }
14796                            }
14797                          }
14798                        } else if ((op & 64) === 0) {
14799                          here = dcode[(here & 65535) + (hold & (1 << op) - 1)];
14800                          continue dodist;
14801                        } else {
14802                          strm.msg = "invalid distance code";
14803                          state.mode = BAD;
14804                          break top;
14805                        }
14806                        break;
14807                      }
14808                    } else if ((op & 64) === 0) {
14809                      here = lcode[(here & 65535) + (hold & (1 << op) - 1)];
14810                      continue dolen;
14811                    } else if (op & 32) {
14812                      state.mode = TYPE;
14813                      break top;
14814                    } else {
14815                      strm.msg = "invalid literal/length code";
14816                      state.mode = BAD;
14817                      break top;
14818                    }
14819                    break;
14820                  }
14821                } while (_in < last && _out < end);
14822                len = bits >> 3;
14823                _in -= len;
14824                bits -= len << 3;
14825                hold &= (1 << bits) - 1;
14826                strm.next_in = _in;
14827                strm.next_out = _out;
14828                strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);
14829                strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);
14830                state.hold = hold;
14831                state.bits = bits;
14832                return;
14833              };
14834            },
14835            {}
14836          ],
14837          8: [
14838            function(require2, module2, exports2) {
14839              "use strict";
14840              var utils = require2("../utils/common");
14841              var adler32 = require2("./adler32");
14842              var crc32 = require2("./crc32");
14843              var inflate_fast = require2("./inffast");
14844              var inflate_table = require2("./inftrees");
14845              var CODES = 0;
14846              var LENS = 1;
14847              var DISTS = 2;
14848              var Z_FINISH = 4;
14849              var Z_BLOCK = 5;
14850              var Z_TREES = 6;
14851              var Z_OK = 0;
14852              var Z_STREAM_END = 1;
14853              var Z_NEED_DICT = 2;
14854              var Z_STREAM_ERROR = -2;
14855              var Z_DATA_ERROR = -3;
14856              var Z_MEM_ERROR = -4;
14857              var Z_BUF_ERROR = -5;
14858              var Z_DEFLATED = 8;
14859              var HEAD = 1;
14860              var FLAGS = 2;
14861              var TIME = 3;
14862              var OS = 4;
14863              var EXLEN = 5;
14864              var EXTRA = 6;
14865              var NAME = 7;
14866              var COMMENT = 8;
14867              var HCRC = 9;
14868              var DICTID = 10;
14869              var DICT = 11;
14870              var TYPE = 12;
14871              var TYPEDO = 13;
14872              var STORED = 14;
14873              var COPY_ = 15;
14874              var COPY = 16;
14875              var TABLE = 17;
14876              var LENLENS = 18;
14877              var CODELENS = 19;
14878              var LEN_ = 20;
14879              var LEN = 21;
14880              var LENEXT = 22;
14881              var DIST = 23;
14882              var DISTEXT = 24;
14883              var MATCH = 25;
14884              var LIT = 26;
14885              var CHECK = 27;
14886              var LENGTH = 28;
14887              var DONE = 29;
14888              var BAD = 30;
14889              var MEM = 31;
14890              var SYNC = 32;
14891              var ENOUGH_LENS = 852;
14892              var ENOUGH_DISTS = 592;
14893              var MAX_WBITS = 15;
14894              var DEF_WBITS = MAX_WBITS;
14895              function zswap32(q) {
14896                return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);
14897              }
14898              function InflateState() {
14899                this.mode = 0;
14900                this.last = false;
14901                this.wrap = 0;
14902                this.havedict = false;
14903                this.flags = 0;
14904                this.dmax = 0;
14905                this.check = 0;
14906                this.total = 0;
14907                this.head = null;
14908                this.wbits = 0;
14909                this.wsize = 0;
14910                this.whave = 0;
14911                this.wnext = 0;
14912                this.window = null;
14913                this.hold = 0;
14914                this.bits = 0;
14915                this.length = 0;
14916                this.offset = 0;
14917                this.extra = 0;
14918                this.lencode = null;
14919                this.distcode = null;
14920                this.lenbits = 0;
14921                this.distbits = 0;
14922                this.ncode = 0;
14923                this.nlen = 0;
14924                this.ndist = 0;
14925                this.have = 0;
14926                this.next = null;
14927                this.lens = new utils.Buf16(
14928                  320
14929                );
14930                this.work = new utils.Buf16(
14931                  288
14932                );
14933                this.lendyn = null;
14934                this.distdyn = null;
14935                this.sane = 0;
14936                this.back = 0;
14937                this.was = 0;
14938              }
14939              function inflateResetKeep(strm) {
14940                var state;
14941                if (!strm || !strm.state) {
14942                  return Z_STREAM_ERROR;
14943                }
14944                state = strm.state;
14945                strm.total_in = strm.total_out = state.total = 0;
14946                strm.msg = "";
14947                if (state.wrap) {
14948                  strm.adler = state.wrap & 1;
14949                }
14950                state.mode = HEAD;
14951                state.last = 0;
14952                state.havedict = 0;
14953                state.dmax = 32768;
14954                state.head = null;
14955                state.hold = 0;
14956                state.bits = 0;
14957                state.lencode = state.lendyn = new utils.Buf32(
14958                  ENOUGH_LENS
14959                );
14960                state.distcode = state.distdyn = new utils.Buf32(
14961                  ENOUGH_DISTS
14962                );
14963                state.sane = 1;
14964                state.back = -1;
14965                return Z_OK;
14966              }
14967              function inflateReset(strm) {
14968                var state;
14969                if (!strm || !strm.state) {
14970                  return Z_STREAM_ERROR;
14971                }
14972                state = strm.state;
14973                state.wsize = 0;
14974                state.whave = 0;
14975                state.wnext = 0;
14976                return inflateResetKeep(strm);
14977              }
14978              function inflateReset2(strm, windowBits) {
14979                var wrap;
14980                var state;
14981                if (!strm || !strm.state) {
14982                  return Z_STREAM_ERROR;
14983                }
14984                state = strm.state;
14985                if (windowBits < 0) {
14986                  wrap = 0;
14987                  windowBits = -windowBits;
14988                } else {
14989                  wrap = (windowBits >> 4) + 1;
14990                  if (windowBits < 48) {
14991                    windowBits &= 15;
14992                  }
14993                }
14994                if (windowBits && (windowBits < 8 || windowBits > 15)) {
14995                  return Z_STREAM_ERROR;
14996                }
14997                if (state.window !== null && state.wbits !== windowBits) {
14998                  state.window = null;
14999                }
15000                state.wrap = wrap;
15001                state.wbits = windowBits;
15002                return inflateReset(strm);
15003              }
15004              function inflateInit2(strm, windowBits) {
15005                var ret;
15006                var state;
15007                if (!strm) {
15008                  return Z_STREAM_ERROR;
15009                }
15010                state = new InflateState();
15011                strm.state = state;
15012                state.window = null;
15013                ret = inflateReset2(strm, windowBits);
15014                if (ret !== Z_OK) {
15015                  strm.state = null;
15016                }
15017                return ret;
15018              }
15019              function inflateInit(strm) {
15020                return inflateInit2(strm, DEF_WBITS);
15021              }
15022              var virgin = true;
15023              var lenfix, distfix;
15024              function fixedtables(state) {
15025                if (virgin) {
15026                  var sym;
15027                  lenfix = new utils.Buf32(512);
15028                  distfix = new utils.Buf32(32);
15029                  sym = 0;
15030                  while (sym < 144) {
15031                    state.lens[sym++] = 8;
15032                  }
15033                  while (sym < 256) {
15034                    state.lens[sym++] = 9;
15035                  }
15036                  while (sym < 280) {
15037                    state.lens[sym++] = 7;
15038                  }
15039                  while (sym < 288) {
15040                    state.lens[sym++] = 8;
15041                  }
15042                  inflate_table(
15043                    LENS,
15044                    state.lens,
15045                    0,
15046                    288,
15047                    lenfix,
15048                    0,
15049                    state.work,
15050                    { bits: 9 }
15051                  );
15052                  sym = 0;
15053                  while (sym < 32) {
15054                    state.lens[sym++] = 5;
15055                  }
15056                  inflate_table(
15057                    DISTS,
15058                    state.lens,
15059                    0,
15060                    32,
15061                    distfix,
15062                    0,
15063                    state.work,
15064                    { bits: 5 }
15065                  );
15066                  virgin = false;
15067                }
15068                state.lencode = lenfix;
15069                state.lenbits = 9;
15070                state.distcode = distfix;
15071                state.distbits = 5;
15072              }
15073              function updatewindow(strm, src, end, copy) {
15074                var dist;
15075                var state = strm.state;
15076                if (state.window === null) {
15077                  state.wsize = 1 << state.wbits;
15078                  state.wnext = 0;
15079                  state.whave = 0;
15080                  state.window = new utils.Buf8(state.wsize);
15081                }
15082                if (copy >= state.wsize) {
15083                  utils.arraySet(
15084                    state.window,
15085                    src,
15086                    end - state.wsize,
15087                    state.wsize,
15088                    0
15089                  );
15090                  state.wnext = 0;
15091                  state.whave = state.wsize;
15092                } else {
15093                  dist = state.wsize - state.wnext;
15094                  if (dist > copy) {
15095                    dist = copy;
15096                  }
15097                  utils.arraySet(
15098                    state.window,
15099                    src,
15100                    end - copy,
15101                    dist,
15102                    state.wnext
15103                  );
15104                  copy -= dist;
15105                  if (copy) {
15106                    utils.arraySet(
15107                      state.window,
15108                      src,
15109                      end - copy,
15110                      copy,
15111                      0
15112                    );
15113                    state.wnext = copy;
15114                    state.whave = state.wsize;
15115                  } else {
15116                    state.wnext += dist;
15117                    if (state.wnext === state.wsize) {
15118                      state.wnext = 0;
15119                    }
15120                    if (state.whave < state.wsize) {
15121                      state.whave += dist;
15122                    }
15123                  }
15124                }
15125                return 0;
15126              }
15127              function inflate(strm, flush2) {
15128                var state;
15129                var input, output;
15130                var next;
15131                var put;
15132                var have, left;
15133                var hold;
15134                var bits;
15135                var _in, _out;
15136                var copy;
15137                var from;
15138                var from_source;
15139                var here = 0;
15140                var here_bits, here_op, here_val;
15141                var last_bits, last_op, last_val;
15142                var len;
15143                var ret;
15144                var hbuf = new utils.Buf8(
15145                  4
15146                );
15147                var opts;
15148                var n2;
15149                var order = (
15150                  /* permutation of code lengths */
15151                  [
15152                    16,
15153                    17,
15154                    18,
15155                    0,
15156                    8,
15157                    7,
15158                    9,
15159                    6,
15160                    10,
15161                    5,
15162                    11,
15163                    4,
15164                    12,
15165                    3,
15166                    13,
15167                    2,
15168                    14,
15169                    1,
15170                    15
15171                  ]
15172                );
15173                if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) {
15174                  return Z_STREAM_ERROR;
15175                }
15176                state = strm.state;
15177                if (state.mode === TYPE) {
15178                  state.mode = TYPEDO;
15179                }
15180                put = strm.next_out;
15181                output = strm.output;
15182                left = strm.avail_out;
15183                next = strm.next_in;
15184                input = strm.input;
15185                have = strm.avail_in;
15186                hold = state.hold;
15187                bits = state.bits;
15188                _in = have;
15189                _out = left;
15190                ret = Z_OK;
15191                inf_leave: for (; ; ) {
15192                  switch (state.mode) {
15193                    case HEAD:
15194                      if (state.wrap === 0) {
15195                        state.mode = TYPEDO;
15196                        break;
15197                      }
15198                      while (bits < 16) {
15199                        if (have === 0) {
15200                          break inf_leave;
15201                        }
15202                        have--;
15203                        hold += input[next++] << bits;
15204                        bits += 8;
15205                      }
15206                      if (state.wrap & 2 && hold === 35615) {
15207                        state.check = 0;
15208                        hbuf[0] = hold & 255;
15209                        hbuf[1] = hold >>> 8 & 255;
15210                        state.check = crc32(
15211                          state.check,
15212                          hbuf,
15213                          2,
15214                          0
15215                        );
15216                        hold = 0;
15217                        bits = 0;
15218                        state.mode = FLAGS;
15219                        break;
15220                      }
15221                      state.flags = 0;
15222                      if (state.head) {
15223                        state.head.done = false;
15224                      }
15225                      if (!(state.wrap & 1) || (((hold & 255) << 8) + (hold >> 8)) % 31) {
15226                        strm.msg = "incorrect header check";
15227                        state.mode = BAD;
15228                        break;
15229                      }
15230                      if ((hold & 15) !== Z_DEFLATED) {
15231                        strm.msg = "unknown compression method";
15232                        state.mode = BAD;
15233                        break;
15234                      }
15235                      hold >>>= 4;
15236                      bits -= 4;
15237                      len = (hold & 15) + 8;
15238                      if (state.wbits === 0) {
15239                        state.wbits = len;
15240                      } else if (len > state.wbits) {
15241                        strm.msg = "invalid window size";
15242                        state.mode = BAD;
15243                        break;
15244                      }
15245                      state.dmax = 1 << len;
15246                      strm.adler = state.check = 1;
15247                      state.mode = hold & 512 ? DICTID : TYPE;
15248                      hold = 0;
15249                      bits = 0;
15250                      break;
15251                    case FLAGS:
15252                      while (bits < 16) {
15253                        if (have === 0) {
15254                          break inf_leave;
15255                        }
15256                        have--;
15257                        hold += input[next++] << bits;
15258                        bits += 8;
15259                      }
15260                      state.flags = hold;
15261                      if ((state.flags & 255) !== Z_DEFLATED) {
15262                        strm.msg = "unknown compression method";
15263                        state.mode = BAD;
15264                        break;
15265                      }
15266                      if (state.flags & 57344) {
15267                        strm.msg = "unknown header flags set";
15268                        state.mode = BAD;
15269                        break;
15270                      }
15271                      if (state.head) {
15272                        state.head.text = hold >> 8 & 1;
15273                      }
15274                      if (state.flags & 512) {
15275                        hbuf[0] = hold & 255;
15276                        hbuf[1] = hold >>> 8 & 255;
15277                        state.check = crc32(
15278                          state.check,
15279                          hbuf,
15280                          2,
15281                          0
15282                        );
15283                      }
15284                      hold = 0;
15285                      bits = 0;
15286                      state.mode = TIME;
15287                    /* falls through */
15288                    case TIME:
15289                      while (bits < 32) {
15290                        if (have === 0) {
15291                          break inf_leave;
15292                        }
15293                        have--;
15294                        hold += input[next++] << bits;
15295                        bits += 8;
15296                      }
15297                      if (state.head) {
15298                        state.head.time = hold;
15299                      }
15300                      if (state.flags & 512) {
15301                        hbuf[0] = hold & 255;
15302                        hbuf[1] = hold >>> 8 & 255;
15303                        hbuf[2] = hold >>> 16 & 255;
15304                        hbuf[3] = hold >>> 24 & 255;
15305                        state.check = crc32(
15306                          state.check,
15307                          hbuf,
15308                          4,
15309                          0
15310                        );
15311                      }
15312                      hold = 0;
15313                      bits = 0;
15314                      state.mode = OS;
15315                    /* falls through */
15316                    case OS:
15317                      while (bits < 16) {
15318                        if (have === 0) {
15319                          break inf_leave;
15320                        }
15321                        have--;
15322                        hold += input[next++] << bits;
15323                        bits += 8;
15324                      }
15325                      if (state.head) {
15326                        state.head.xflags = hold & 255;
15327                        state.head.os = hold >> 8;
15328                      }
15329                      if (state.flags & 512) {
15330                        hbuf[0] = hold & 255;
15331                        hbuf[1] = hold >>> 8 & 255;
15332                        state.check = crc32(
15333                          state.check,
15334                          hbuf,
15335                          2,
15336                          0
15337                        );
15338                      }
15339                      hold = 0;
15340                      bits = 0;
15341                      state.mode = EXLEN;
15342                    /* falls through */
15343                    case EXLEN:
15344                      if (state.flags & 1024) {
15345                        while (bits < 16) {
15346                          if (have === 0) {
15347                            break inf_leave;
15348                          }
15349                          have--;
15350                          hold += input[next++] << bits;
15351                          bits += 8;
15352                        }
15353                        state.length = hold;
15354                        if (state.head) {
15355                          state.head.extra_len = hold;
15356                        }
15357                        if (state.flags & 512) {
15358                          hbuf[0] = hold & 255;
15359                          hbuf[1] = hold >>> 8 & 255;
15360                          state.check = crc32(
15361                            state.check,
15362                            hbuf,
15363                            2,
15364                            0
15365                          );
15366                        }
15367                        hold = 0;
15368                        bits = 0;
15369                      } else if (state.head) {
15370                        state.head.extra = null;
15371                      }
15372                      state.mode = EXTRA;
15373                    /* falls through */
15374                    case EXTRA:
15375                      if (state.flags & 1024) {
15376                        copy = state.length;
15377                        if (copy > have) {
15378                          copy = have;
15379                        }
15380                        if (copy) {
15381                          if (state.head) {
15382                            len = state.head.extra_len - state.length;
15383                            if (!state.head.extra) {
15384                              state.head.extra = new Array(
15385                                state.head.extra_len
15386                              );
15387                            }
15388                            utils.arraySet(
15389                              state.head.extra,
15390                              input,
15391                              next,
15392                              // extra field is limited to 65536 bytes
15393                              // - no need for additional size check
15394                              copy,
15395                              /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
15396                              len
15397                            );
15398                          }
15399                          if (state.flags & 512) {
15400                            state.check = crc32(
15401                              state.check,
15402                              input,
15403                              copy,
15404                              next
15405                            );
15406                          }
15407                          have -= copy;
15408                          next += copy;
15409                          state.length -= copy;
15410                        }
15411                        if (state.length) {
15412                          break inf_leave;
15413                        }
15414                      }
15415                      state.length = 0;
15416                      state.mode = NAME;
15417                    /* falls through */
15418                    case NAME:
15419                      if (state.flags & 2048) {
15420                        if (have === 0) {
15421                          break inf_leave;
15422                        }
15423                        copy = 0;
15424                        do {
15425                          len = input[next + copy++];
15426                          if (state.head && len && state.length < 65536) {
15427                            state.head.name += String.fromCharCode(len);
15428                          }
15429                        } while (len && copy < have);
15430                        if (state.flags & 512) {
15431                          state.check = crc32(
15432                            state.check,
15433                            input,
15434                            copy,
15435                            next
15436                          );
15437                        }
15438                        have -= copy;
15439                        next += copy;
15440                        if (len) {
15441                          break inf_leave;
15442                        }
15443                      } else if (state.head) {
15444                        state.head.name = null;
15445                      }
15446                      state.length = 0;
15447                      state.mode = COMMENT;
15448                    /* falls through */
15449                    case COMMENT:
15450                      if (state.flags & 4096) {
15451                        if (have === 0) {
15452                          break inf_leave;
15453                        }
15454                        copy = 0;
15455                        do {
15456                          len = input[next + copy++];
15457                          if (state.head && len && state.length < 65536) {
15458                            state.head.comment += String.fromCharCode(len);
15459                          }
15460                        } while (len && copy < have);
15461                        if (state.flags & 512) {
15462                          state.check = crc32(
15463                            state.check,
15464                            input,
15465                            copy,
15466                            next
15467                          );
15468                        }
15469                        have -= copy;
15470                        next += copy;
15471                        if (len) {
15472                          break inf_leave;
15473                        }
15474                      } else if (state.head) {
15475                        state.head.comment = null;
15476                      }
15477                      state.mode = HCRC;
15478                    /* falls through */
15479                    case HCRC:
15480                      if (state.flags & 512) {
15481                        while (bits < 16) {
15482                          if (have === 0) {
15483                            break inf_leave;
15484                          }
15485                          have--;
15486                          hold += input[next++] << bits;
15487                          bits += 8;
15488                        }
15489                        if (hold !== (state.check & 65535)) {
15490                          strm.msg = "header crc mismatch";
15491                          state.mode = BAD;
15492                          break;
15493                        }
15494                        hold = 0;
15495                        bits = 0;
15496                      }
15497                      if (state.head) {
15498                        state.head.hcrc = state.flags >> 9 & 1;
15499                        state.head.done = true;
15500                      }
15501                      strm.adler = state.check = 0;
15502                      state.mode = TYPE;
15503                      break;
15504                    case DICTID:
15505                      while (bits < 32) {
15506                        if (have === 0) {
15507                          break inf_leave;
15508                        }
15509                        have--;
15510                        hold += input[next++] << bits;
15511                        bits += 8;
15512                      }
15513                      strm.adler = state.check = zswap32(hold);
15514                      hold = 0;
15515                      bits = 0;
15516                      state.mode = DICT;
15517                    /* falls through */
15518                    case DICT:
15519                      if (state.havedict === 0) {
15520                        strm.next_out = put;
15521                        strm.avail_out = left;
15522                        strm.next_in = next;
15523                        strm.avail_in = have;
15524                        state.hold = hold;
15525                        state.bits = bits;
15526                        return Z_NEED_DICT;
15527                      }
15528                      strm.adler = state.check = 1;
15529                      state.mode = TYPE;
15530                    /* falls through */
15531                    case TYPE:
15532                      if (flush2 === Z_BLOCK || flush2 === Z_TREES) {
15533                        break inf_leave;
15534                      }
15535                    /* falls through */
15536                    case TYPEDO:
15537                      if (state.last) {
15538                        hold >>>= bits & 7;
15539                        bits -= bits & 7;
15540                        state.mode = CHECK;
15541                        break;
15542                      }
15543                      while (bits < 3) {
15544                        if (have === 0) {
15545                          break inf_leave;
15546                        }
15547                        have--;
15548                        hold += input[next++] << bits;
15549                        bits += 8;
15550                      }
15551                      state.last = hold & 1;
15552                      hold >>>= 1;
15553                      bits -= 1;
15554                      switch (hold & 3) {
15555                        case 0:
15556                          state.mode = STORED;
15557                          break;
15558                        case 1:
15559                          fixedtables(state);
15560                          state.mode = LEN_;
15561                          if (flush2 === Z_TREES) {
15562                            hold >>>= 2;
15563                            bits -= 2;
15564                            break inf_leave;
15565                          }
15566                          break;
15567                        case 2:
15568                          state.mode = TABLE;
15569                          break;
15570                        case 3:
15571                          strm.msg = "invalid block type";
15572                          state.mode = BAD;
15573                      }
15574                      hold >>>= 2;
15575                      bits -= 2;
15576                      break;
15577                    case STORED:
15578                      hold >>>= bits & 7;
15579                      bits -= bits & 7;
15580                      while (bits < 32) {
15581                        if (have === 0) {
15582                          break inf_leave;
15583                        }
15584                        have--;
15585                        hold += input[next++] << bits;
15586                        bits += 8;
15587                      }
15588                      if ((hold & 65535) !== (hold >>> 16 ^ 65535)) {
15589                        strm.msg = "invalid stored block lengths";
15590                        state.mode = BAD;
15591                        break;
15592                      }
15593                      state.length = hold & 65535;
15594                      hold = 0;
15595                      bits = 0;
15596                      state.mode = COPY_;
15597                      if (flush2 === Z_TREES) {
15598                        break inf_leave;
15599                      }
15600                    /* falls through */
15601                    case COPY_:
15602                      state.mode = COPY;
15603                    /* falls through */
15604                    case COPY:
15605                      copy = state.length;
15606                      if (copy) {
15607                        if (copy > have) {
15608                          copy = have;
15609                        }
15610                        if (copy > left) {
15611                          copy = left;
15612                        }
15613                        if (copy === 0) {
15614                          break inf_leave;
15615                        }
15616                        utils.arraySet(
15617                          output,
15618                          input,
15619                          next,
15620                          copy,
15621                          put
15622                        );
15623                        have -= copy;
15624                        next += copy;
15625                        left -= copy;
15626                        put += copy;
15627                        state.length -= copy;
15628                        break;
15629                      }
15630                      state.mode = TYPE;
15631                      break;
15632                    case TABLE:
15633                      while (bits < 14) {
15634                        if (have === 0) {
15635                          break inf_leave;
15636                        }
15637                        have--;
15638                        hold += input[next++] << bits;
15639                        bits += 8;
15640                      }
15641                      state.nlen = (hold & 31) + 257;
15642                      hold >>>= 5;
15643                      bits -= 5;
15644                      state.ndist = (hold & 31) + 1;
15645                      hold >>>= 5;
15646                      bits -= 5;
15647                      state.ncode = (hold & 15) + 4;
15648                      hold >>>= 4;
15649                      bits -= 4;
15650                      if (state.nlen > 286 || state.ndist > 30) {
15651                        strm.msg = "too many length or distance symbols";
15652                        state.mode = BAD;
15653                        break;
15654                      }
15655                      state.have = 0;
15656                      state.mode = LENLENS;
15657                    /* falls through */
15658                    case LENLENS:
15659                      while (state.have < state.ncode) {
15660                        while (bits < 3) {
15661                          if (have === 0) {
15662                            break inf_leave;
15663                          }
15664                          have--;
15665                          hold += input[next++] << bits;
15666                          bits += 8;
15667                        }
15668                        state.lens[order[state.have++]] = hold & 7;
15669                        hold >>>= 3;
15670                        bits -= 3;
15671                      }
15672                      while (state.have < 19) {
15673                        state.lens[order[state.have++]] = 0;
15674                      }
15675                      state.lencode = state.lendyn;
15676                      state.lenbits = 7;
15677                      opts = { bits: state.lenbits };
15678                      ret = inflate_table(
15679                        CODES,
15680                        state.lens,
15681                        0,
15682                        19,
15683                        state.lencode,
15684                        0,
15685                        state.work,
15686                        opts
15687                      );
15688                      state.lenbits = opts.bits;
15689                      if (ret) {
15690                        strm.msg = "invalid code lengths set";
15691                        state.mode = BAD;
15692                        break;
15693                      }
15694                      state.have = 0;
15695                      state.mode = CODELENS;
15696                    /* falls through */
15697                    case CODELENS:
15698                      while (state.have < state.nlen + state.ndist) {
15699                        for (; ; ) {
15700                          here = state.lencode[hold & (1 << state.lenbits) - 1];
15701                          here_bits = here >>> 24;
15702                          here_op = here >>> 16 & 255;
15703                          here_val = here & 65535;
15704                          if (here_bits <= bits) {
15705                            break;
15706                          }
15707                          if (have === 0) {
15708                            break inf_leave;
15709                          }
15710                          have--;
15711                          hold += input[next++] << bits;
15712                          bits += 8;
15713                        }
15714                        if (here_val < 16) {
15715                          hold >>>= here_bits;
15716                          bits -= here_bits;
15717                          state.lens[state.have++] = here_val;
15718                        } else {
15719                          if (here_val === 16) {
15720                            n2 = here_bits + 2;
15721                            while (bits < n2) {
15722                              if (have === 0) {
15723                                break inf_leave;
15724                              }
15725                              have--;
15726                              hold += input[next++] << bits;
15727                              bits += 8;
15728                            }
15729                            hold >>>= here_bits;
15730                            bits -= here_bits;
15731                            if (state.have === 0) {
15732                              strm.msg = "invalid bit length repeat";
15733                              state.mode = BAD;
15734                              break;
15735                            }
15736                            len = state.lens[state.have - 1];
15737                            copy = 3 + (hold & 3);
15738                            hold >>>= 2;
15739                            bits -= 2;
15740                          } else if (here_val === 17) {
15741                            n2 = here_bits + 3;
15742                            while (bits < n2) {
15743                              if (have === 0) {
15744                                break inf_leave;
15745                              }
15746                              have--;
15747                              hold += input[next++] << bits;
15748                              bits += 8;
15749                            }
15750                            hold >>>= here_bits;
15751                            bits -= here_bits;
15752                            len = 0;
15753                            copy = 3 + (hold & 7);
15754                            hold >>>= 3;
15755                            bits -= 3;
15756                          } else {
15757                            n2 = here_bits + 7;
15758                            while (bits < n2) {
15759                              if (have === 0) {
15760                                break inf_leave;
15761                              }
15762                              have--;
15763                              hold += input[next++] << bits;
15764                              bits += 8;
15765                            }
15766                            hold >>>= here_bits;
15767                            bits -= here_bits;
15768                            len = 0;
15769                            copy = 11 + (hold & 127);
15770                            hold >>>= 7;
15771                            bits -= 7;
15772                          }
15773                          if (state.have + copy > state.nlen + state.ndist) {
15774                            strm.msg = "invalid bit length repeat";
15775                            state.mode = BAD;
15776                            break;
15777                          }
15778                          while (copy--) {
15779                            state.lens[state.have++] = len;
15780                          }
15781                        }
15782                      }
15783                      if (state.mode === BAD) {
15784                        break;
15785                      }
15786                      if (state.lens[256] === 0) {
15787                        strm.msg = "invalid code -- missing end-of-block";
15788                        state.mode = BAD;
15789                        break;
15790                      }
15791                      state.lenbits = 9;
15792                      opts = { bits: state.lenbits };
15793                      ret = inflate_table(
15794                        LENS,
15795                        state.lens,
15796                        0,
15797                        state.nlen,
15798                        state.lencode,
15799                        0,
15800                        state.work,
15801                        opts
15802                      );
15803                      state.lenbits = opts.bits;
15804                      if (ret) {
15805                        strm.msg = "invalid literal/lengths set";
15806                        state.mode = BAD;
15807                        break;
15808                      }
15809                      state.distbits = 6;
15810                      state.distcode = state.distdyn;
15811                      opts = { bits: state.distbits };
15812                      ret = inflate_table(
15813                        DISTS,
15814                        state.lens,
15815                        state.nlen,
15816                        state.ndist,
15817                        state.distcode,
15818                        0,
15819                        state.work,
15820                        opts
15821                      );
15822                      state.distbits = opts.bits;
15823                      if (ret) {
15824                        strm.msg = "invalid distances set";
15825                        state.mode = BAD;
15826                        break;
15827                      }
15828                      state.mode = LEN_;
15829                      if (flush2 === Z_TREES) {
15830                        break inf_leave;
15831                      }
15832                    /* falls through */
15833                    case LEN_:
15834                      state.mode = LEN;
15835                    /* falls through */
15836                    case LEN:
15837                      if (have >= 6 && left >= 258) {
15838                        strm.next_out = put;
15839                        strm.avail_out = left;
15840                        strm.next_in = next;
15841                        strm.avail_in = have;
15842                        state.hold = hold;
15843                        state.bits = bits;
15844                        inflate_fast(strm, _out);
15845                        put = strm.next_out;
15846                        output = strm.output;
15847                        left = strm.avail_out;
15848                        next = strm.next_in;
15849                        input = strm.input;
15850                        have = strm.avail_in;
15851                        hold = state.hold;
15852                        bits = state.bits;
15853                        if (state.mode === TYPE) {
15854                          state.back = -1;
15855                        }
15856                        break;
15857                      }
15858                      state.back = 0;
15859                      for (; ; ) {
15860                        here = state.lencode[hold & (1 << state.lenbits) - 1];
15861                        here_bits = here >>> 24;
15862                        here_op = here >>> 16 & 255;
15863                        here_val = here & 65535;
15864                        if (here_bits <= bits) {
15865                          break;
15866                        }
15867                        if (have === 0) {
15868                          break inf_leave;
15869                        }
15870                        have--;
15871                        hold += input[next++] << bits;
15872                        bits += 8;
15873                      }
15874                      if (here_op && (here_op & 240) === 0) {
15875                        last_bits = here_bits;
15876                        last_op = here_op;
15877                        last_val = here_val;
15878                        for (; ; ) {
15879                          here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)];
15880                          here_bits = here >>> 24;
15881                          here_op = here >>> 16 & 255;
15882                          here_val = here & 65535;
15883                          if (last_bits + here_bits <= bits) {
15884                            break;
15885                          }
15886                          if (have === 0) {
15887                            break inf_leave;
15888                          }
15889                          have--;
15890                          hold += input[next++] << bits;
15891                          bits += 8;
15892                        }
15893                        hold >>>= last_bits;
15894                        bits -= last_bits;
15895                        state.back += last_bits;
15896                      }
15897                      hold >>>= here_bits;
15898                      bits -= here_bits;
15899                      state.back += here_bits;
15900                      state.length = here_val;
15901                      if (here_op === 0) {
15902                        state.mode = LIT;
15903                        break;
15904                      }
15905                      if (here_op & 32) {
15906                        state.back = -1;
15907                        state.mode = TYPE;
15908                        break;
15909                      }
15910                      if (here_op & 64) {
15911                        strm.msg = "invalid literal/length code";
15912                        state.mode = BAD;
15913                        break;
15914                      }
15915                      state.extra = here_op & 15;
15916                      state.mode = LENEXT;
15917                    /* falls through */
15918                    case LENEXT:
15919                      if (state.extra) {
15920                        n2 = state.extra;
15921                        while (bits < n2) {
15922                          if (have === 0) {
15923                            break inf_leave;
15924                          }
15925                          have--;
15926                          hold += input[next++] << bits;
15927                          bits += 8;
15928                        }
15929                        state.length += hold & (1 << state.extra) - 1;
15930                        hold >>>= state.extra;
15931                        bits -= state.extra;
15932                        state.back += state.extra;
15933                      }
15934                      state.was = state.length;
15935                      state.mode = DIST;
15936                    /* falls through */
15937                    case DIST:
15938                      for (; ; ) {
15939                        here = state.distcode[hold & (1 << state.distbits) - 1];
15940                        here_bits = here >>> 24;
15941                        here_op = here >>> 16 & 255;
15942                        here_val = here & 65535;
15943                        if (here_bits <= bits) {
15944                          break;
15945                        }
15946                        if (have === 0) {
15947                          break inf_leave;
15948                        }
15949                        have--;
15950                        hold += input[next++] << bits;
15951                        bits += 8;
15952                      }
15953                      if ((here_op & 240) === 0) {
15954                        last_bits = here_bits;
15955                        last_op = here_op;
15956                        last_val = here_val;
15957                        for (; ; ) {
15958                          here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)];
15959                          here_bits = here >>> 24;
15960                          here_op = here >>> 16 & 255;
15961                          here_val = here & 65535;
15962                          if (last_bits + here_bits <= bits) {
15963                            break;
15964                          }
15965                          if (have === 0) {
15966                            break inf_leave;
15967                          }
15968                          have--;
15969                          hold += input[next++] << bits;
15970                          bits += 8;
15971                        }
15972                        hold >>>= last_bits;
15973                        bits -= last_bits;
15974                        state.back += last_bits;
15975                      }
15976                      hold >>>= here_bits;
15977                      bits -= here_bits;
15978                      state.back += here_bits;
15979                      if (here_op & 64) {
15980                        strm.msg = "invalid distance code";
15981                        state.mode = BAD;
15982                        break;
15983                      }
15984                      state.offset = here_val;
15985                      state.extra = here_op & 15;
15986                      state.mode = DISTEXT;
15987                    /* falls through */
15988                    case DISTEXT:
15989                      if (state.extra) {
15990                        n2 = state.extra;
15991                        while (bits < n2) {
15992                          if (have === 0) {
15993                            break inf_leave;
15994                          }
15995                          have--;
15996                          hold += input[next++] << bits;
15997                          bits += 8;
15998                        }
15999                        state.offset += hold & (1 << state.extra) - 1;
16000                        hold >>>= state.extra;
16001                        bits -= state.extra;
16002                        state.back += state.extra;
16003                      }
16004                      if (state.offset > state.dmax) {
16005                        strm.msg = "invalid distance too far back";
16006                        state.mode = BAD;
16007                        break;
16008                      }
16009                      state.mode = MATCH;
16010                    /* falls through */
16011                    case MATCH:
16012                      if (left === 0) {
16013                        break inf_leave;
16014                      }
16015                      copy = _out - left;
16016                      if (state.offset > copy) {
16017                        copy = state.offset - copy;
16018                        if (copy > state.whave) {
16019                          if (state.sane) {
16020                            strm.msg = "invalid distance too far back";
16021                            state.mode = BAD;
16022                            break;
16023                          }
16024                        }
16025                        if (copy > state.wnext) {
16026                          copy -= state.wnext;
16027                          from = state.wsize - copy;
16028                        } else {
16029                          from = state.wnext - copy;
16030                        }
16031                        if (copy > state.length) {
16032                          copy = state.length;
16033                        }
16034                        from_source = state.window;
16035                      } else {
16036                        from_source = output;
16037                        from = put - state.offset;
16038                        copy = state.length;
16039                      }
16040                      if (copy > left) {
16041                        copy = left;
16042                      }
16043                      left -= copy;
16044                      state.length -= copy;
16045                      do {
16046                        output[put++] = from_source[from++];
16047                      } while (--copy);
16048                      if (state.length === 0) {
16049                        state.mode = LEN;
16050                      }
16051                      break;
16052                    case LIT:
16053                      if (left === 0) {
16054                        break inf_leave;
16055                      }
16056                      output[put++] = state.length;
16057                      left--;
16058                      state.mode = LEN;
16059                      break;
16060                    case CHECK:
16061                      if (state.wrap) {
16062                        while (bits < 32) {
16063                          if (have === 0) {
16064                            break inf_leave;
16065                          }
16066                          have--;
16067                          hold |= input[next++] << bits;
16068                          bits += 8;
16069                        }
16070                        _out -= left;
16071                        strm.total_out += _out;
16072                        state.total += _out;
16073                        if (_out) {
16074                          strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/
16075                          state.flags ? crc32(
16076                            state.check,
16077                            output,
16078                            _out,
16079                            put - _out
16080                          ) : adler32(
16081                            state.check,
16082                            output,
16083                            _out,
16084                            put - _out
16085                          );
16086                        }
16087                        _out = left;
16088                        if ((state.flags ? hold : zswap32(hold)) !== state.check) {
16089                          strm.msg = "incorrect data check";
16090                          state.mode = BAD;
16091                          break;
16092                        }
16093                        hold = 0;
16094                        bits = 0;
16095                      }
16096                      state.mode = LENGTH;
16097                    /* falls through */
16098                    case LENGTH:
16099                      if (state.wrap && state.flags) {
16100                        while (bits < 32) {
16101                          if (have === 0) {
16102                            break inf_leave;
16103                          }
16104                          have--;
16105                          hold += input[next++] << bits;
16106                          bits += 8;
16107                        }
16108                        if (hold !== (state.total & 4294967295)) {
16109                          strm.msg = "incorrect length check";
16110                          state.mode = BAD;
16111                          break;
16112                        }
16113                        hold = 0;
16114                        bits = 0;
16115                      }
16116                      state.mode = DONE;
16117                    /* falls through */
16118                    case DONE:
16119                      ret = Z_STREAM_END;
16120                      break inf_leave;
16121                    case BAD:
16122                      ret = Z_DATA_ERROR;
16123                      break inf_leave;
16124                    case MEM:
16125                      return Z_MEM_ERROR;
16126                    case SYNC:
16127                    /* falls through */
16128                    default:
16129                      return Z_STREAM_ERROR;
16130                  }
16131                }
16132                strm.next_out = put;
16133                strm.avail_out = left;
16134                strm.next_in = next;
16135                strm.avail_in = have;
16136                state.hold = hold;
16137                state.bits = bits;
16138                if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush2 !== Z_FINISH)) {
16139                  if (updatewindow(
16140                    strm,
16141                    strm.output,
16142                    strm.next_out,
16143                    _out - strm.avail_out
16144                  )) {
16145                    state.mode = MEM;
16146                    return Z_MEM_ERROR;
16147                  }
16148                }
16149                _in -= strm.avail_in;
16150                _out -= strm.avail_out;
16151                strm.total_in += _in;
16152                strm.total_out += _out;
16153                state.total += _out;
16154                if (state.wrap && _out) {
16155                  strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
16156                  state.flags ? crc32(
16157                    state.check,
16158                    output,
16159                    _out,
16160                    strm.next_out - _out
16161                  ) : adler32(
16162                    state.check,
16163                    output,
16164                    _out,
16165                    strm.next_out - _out
16166                  );
16167                }
16168                strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
16169                if ((_in === 0 && _out === 0 || flush2 === Z_FINISH) && ret === Z_OK) {
16170                  ret = Z_BUF_ERROR;
16171                }
16172                return ret;
16173              }
16174              function inflateEnd(strm) {
16175                if (!strm || !strm.state) {
16176                  return Z_STREAM_ERROR;
16177                }
16178                var state = strm.state;
16179                if (state.window) {
16180                  state.window = null;
16181                }
16182                strm.state = null;
16183                return Z_OK;
16184              }
16185              function inflateGetHeader(strm, head2) {
16186                var state;
16187                if (!strm || !strm.state) {
16188                  return Z_STREAM_ERROR;
16189                }
16190                state = strm.state;
16191                if ((state.wrap & 2) === 0) {
16192                  return Z_STREAM_ERROR;
16193                }
16194                state.head = head2;
16195                head2.done = false;
16196                return Z_OK;
16197              }
16198              function inflateSetDictionary(strm, dictionary) {
16199                var dictLength = dictionary.length;
16200                var state;
16201                var dictid;
16202                var ret;
16203                if (!strm || !strm.state) {
16204                  return Z_STREAM_ERROR;
16205                }
16206                state = strm.state;
16207                if (state.wrap !== 0 && state.mode !== DICT) {
16208                  return Z_STREAM_ERROR;
16209                }
16210                if (state.mode === DICT) {
16211                  dictid = 1;
16212                  dictid = adler32(
16213                    dictid,
16214                    dictionary,
16215                    dictLength,
16216                    0
16217                  );
16218                  if (dictid !== state.check) {
16219                    return Z_DATA_ERROR;
16220                  }
16221                }
16222                ret = updatewindow(
16223                  strm,
16224                  dictionary,
16225                  dictLength,
16226                  dictLength
16227                );
16228                if (ret) {
16229                  state.mode = MEM;
16230                  return Z_MEM_ERROR;
16231                }
16232                state.havedict = 1;
16233                return Z_OK;
16234              }
16235              exports2.inflateReset = inflateReset;
16236              exports2.inflateReset2 = inflateReset2;
16237              exports2.inflateResetKeep = inflateResetKeep;
16238              exports2.inflateInit = inflateInit;
16239              exports2.inflateInit2 = inflateInit2;
16240              exports2.inflate = inflate;
16241              exports2.inflateEnd = inflateEnd;
16242              exports2.inflateGetHeader = inflateGetHeader;
16243              exports2.inflateSetDictionary = inflateSetDictionary;
16244              exports2.inflateInfo = "pako inflate (from Nodeca project)";
16245            },
16246            {
16247              "../utils/common": 1,
16248              "./adler32": 3,
16249              "./crc32": 5,
16250              "./inffast": 7,
16251              "./inftrees": 9
16252            }
16253          ],
16254          9: [
16255            function(require2, module2, exports2) {
16256              "use strict";
16257              var utils = require2("../utils/common");
16258              var MAXBITS = 15;
16259              var ENOUGH_LENS = 852;
16260              var ENOUGH_DISTS = 592;
16261              var CODES = 0;
16262              var LENS = 1;
16263              var DISTS = 2;
16264              var lbase = [
16265                /* Length codes 257..285 base */
16266                3,
16267                4,
16268                5,
16269                6,
16270                7,
16271                8,
16272                9,
16273                10,
16274                11,
16275                13,
16276                15,
16277                17,
16278                19,
16279                23,
16280                27,
16281                31,
16282                35,
16283                43,
16284                51,
16285                59,
16286                67,
16287                83,
16288                99,
16289                115,
16290                131,
16291                163,
16292                195,
16293                227,
16294                258,
16295                0,
16296                0
16297              ];
16298              var lext = [
16299                /* Length codes 257..285 extra */
16300                16,
16301                16,
16302                16,
16303                16,
16304                16,
16305                16,
16306                16,
16307                16,
16308                17,
16309                17,
16310                17,
16311                17,
16312                18,
16313                18,
16314                18,
16315                18,
16316                19,
16317                19,
16318                19,
16319                19,
16320                20,
16321                20,
16322                20,
16323                20,
16324                21,
16325                21,
16326                21,
16327                21,
16328                16,
16329                72,
16330                78
16331              ];
16332              var dbase = [
16333                /* Distance codes 0..29 base */
16334                1,
16335                2,
16336                3,
16337                4,
16338                5,
16339                7,
16340                9,
16341                13,
16342                17,
16343                25,
16344                33,
16345                49,
16346                65,
16347                97,
16348                129,
16349                193,
16350                257,
16351                385,
16352                513,
16353                769,
16354                1025,
16355                1537,
16356                2049,
16357                3073,
16358                4097,
16359                6145,
16360                8193,
16361                12289,
16362                16385,
16363                24577,
16364                0,
16365                0
16366              ];
16367              var dext = [
16368                /* Distance codes 0..29 extra */
16369                16,
16370                16,
16371                16,
16372                16,
16373                17,
16374                17,
16375                18,
16376                18,
16377                19,
16378                19,
16379                20,
16380                20,
16381                21,
16382                21,
16383                22,
16384                22,
16385                23,
16386                23,
16387                24,
16388                24,
16389                25,
16390                25,
16391                26,
16392                26,
16393                27,
16394                27,
16395                28,
16396                28,
16397                29,
16398                29,
16399                64,
16400                64
16401              ];
16402              module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {
16403                var bits = opts.bits;
16404                var len = 0;
16405                var sym = 0;
16406                var min = 0, max = 0;
16407                var root = 0;
16408                var curr = 0;
16409                var drop = 0;
16410                var left = 0;
16411                var used = 0;
16412                var huff = 0;
16413                var incr;
16414                var fill;
16415                var low;
16416                var mask;
16417                var next;
16418                var base = null;
16419                var base_index = 0;
16420                var end;
16421                var count = new utils.Buf16(MAXBITS + 1);
16422                var offs = new utils.Buf16(MAXBITS + 1);
16423                var extra = null;
16424                var extra_index = 0;
16425                var here_bits, here_op, here_val;
16426                for (len = 0; len <= MAXBITS; len++) {
16427                  count[len] = 0;
16428                }
16429                for (sym = 0; sym < codes; sym++) {
16430                  count[lens[lens_index + sym]]++;
16431                }
16432                root = bits;
16433                for (max = MAXBITS; max >= 1; max--) {
16434                  if (count[max] !== 0) {
16435                    break;
16436                  }
16437                }
16438                if (root > max) {
16439                  root = max;
16440                }
16441                if (max === 0) {
16442                  table[table_index++] = 1 << 24 | 64 << 16 | 0;
16443                  table[table_index++] = 1 << 24 | 64 << 16 | 0;
16444                  opts.bits = 1;
16445                  return 0;
16446                }
16447                for (min = 1; min < max; min++) {
16448                  if (count[min] !== 0) {
16449                    break;
16450                  }
16451                }
16452                if (root < min) {
16453                  root = min;
16454                }
16455                left = 1;
16456                for (len = 1; len <= MAXBITS; len++) {
16457                  left <<= 1;
16458                  left -= count[len];
16459                  if (left < 0) {
16460                    return -1;
16461                  }
16462                }
16463                if (left > 0 && (type === CODES || max !== 1)) {
16464                  return -1;
16465                }
16466                offs[1] = 0;
16467                for (len = 1; len < MAXBITS; len++) {
16468                  offs[len + 1] = offs[len] + count[len];
16469                }
16470                for (sym = 0; sym < codes; sym++) {
16471                  if (lens[lens_index + sym] !== 0) {
16472                    work[offs[lens[lens_index + sym]]++] = sym;
16473                  }
16474                }
16475                if (type === CODES) {
16476                  base = extra = work;
16477                  end = 19;
16478                } else if (type === LENS) {
16479                  base = lbase;
16480                  base_index -= 257;
16481                  extra = lext;
16482                  extra_index -= 257;
16483                  end = 256;
16484                } else {
16485                  base = dbase;
16486                  extra = dext;
16487                  end = -1;
16488                }
16489                huff = 0;
16490                sym = 0;
16491                len = min;
16492                next = table_index;
16493                curr = root;
16494                drop = 0;
16495                low = -1;
16496                used = 1 << root;
16497                mask = used - 1;
16498                if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
16499                  return 1;
16500                }
16501                for (; ; ) {
16502                  here_bits = len - drop;
16503                  if (work[sym] < end) {
16504                    here_op = 0;
16505                    here_val = work[sym];
16506                  } else if (work[sym] > end) {
16507                    here_op = extra[extra_index + work[sym]];
16508                    here_val = base[base_index + work[sym]];
16509                  } else {
16510                    here_op = 32 + 64;
16511                    here_val = 0;
16512                  }
16513                  incr = 1 << len - drop;
16514                  fill = 1 << curr;
16515                  min = fill;
16516                  do {
16517                    fill -= incr;
16518                    table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
16519                  } while (fill !== 0);
16520                  incr = 1 << len - 1;
16521                  while (huff & incr) {
16522                    incr >>= 1;
16523                  }
16524                  if (incr !== 0) {
16525                    huff &= incr - 1;
16526                    huff += incr;
16527                  } else {
16528                    huff = 0;
16529                  }
16530                  sym++;
16531                  if (--count[len] === 0) {
16532                    if (len === max) {
16533                      break;
16534                    }
16535                    len = lens[lens_index + work[sym]];
16536                  }
16537                  if (len > root && (huff & mask) !== low) {
16538                    if (drop === 0) {
16539                      drop = root;
16540                    }
16541                    next += min;
16542                    curr = len - drop;
16543                    left = 1 << curr;
16544                    while (curr + drop < max) {
16545                      left -= count[curr + drop];
16546                      if (left <= 0) {
16547                        break;
16548                      }
16549                      curr++;
16550                      left <<= 1;
16551                    }
16552                    used += 1 << curr;
16553                    if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {
16554                      return 1;
16555                    }
16556                    low = huff & mask;
16557                    table[low] = root << 24 | curr << 16 | next - table_index | 0;
16558                  }
16559                }
16560                if (huff !== 0) {
16561                  table[next + huff] = len - drop << 24 | 64 << 16 | 0;
16562                }
16563                opts.bits = root;
16564                return 0;
16565              };
16566            },
16567            { "../utils/common": 1 }
16568          ],
16569          10: [
16570            function(require2, module2, exports2) {
16571              "use strict";
16572              module2.exports = {
16573                2: "need dictionary",
16574                1: "stream end",
16575                0: "",
16576                "-1": "file error",
16577                "-2": "stream error",
16578                "-3": "data error",
16579                "-4": "insufficient memory",
16580                "-5": "buffer error",
16581                "-6": "incompatible version"
16582              };
16583            },
16584            {}
16585          ],
16586          11: [
16587            function(require2, module2, exports2) {
16588              "use strict";
16589              function ZStream() {
16590                this.input = null;
16591                this.next_in = 0;
16592                this.avail_in = 0;
16593                this.total_in = 0;
16594                this.output = null;
16595                this.next_out = 0;
16596                this.avail_out = 0;
16597                this.total_out = 0;
16598                this.msg = "";
16599                this.state = null;
16600                this.data_type = 2;
16601                this.adler = 0;
16602              }
16603              module2.exports = ZStream;
16604            },
16605            {}
16606          ],
16607          "/lib/inflate.js": [
16608            function(require2, module2, exports2) {
16609              "use strict";
16610              var zlib_inflate = require2("./zlib/inflate");
16611              var utils = require2("./utils/common");
16612              var strings = require2("./utils/strings");
16613              var c6 = require2("./zlib/constants");
16614              var msg = require2("./zlib/messages");
16615              var ZStream = require2("./zlib/zstream");
16616              var GZheader = require2("./zlib/gzheader");
16617              var toString = Object.prototype.toString;
16618              function Inflate(options) {
16619                if (!(this instanceof Inflate))
16620                  return new Inflate(options);
16621                this.options = utils.assign(
16622                  {
16623                    chunkSize: 16384,
16624                    windowBits: 0,
16625                    to: ""
16626                  },
16627                  options || {}
16628                );
16629                var opt = this.options;
16630                if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
16631                  opt.windowBits = -opt.windowBits;
16632                  if (opt.windowBits === 0) {
16633                    opt.windowBits = -15;
16634                  }
16635                }
16636                if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
16637                  opt.windowBits += 32;
16638                }
16639                if (opt.windowBits > 15 && opt.windowBits < 48) {
16640                  if ((opt.windowBits & 15) === 0) {
16641                    opt.windowBits |= 15;
16642                  }
16643                }
16644                this.err = 0;
16645                this.msg = "";
16646                this.ended = false;
16647                this.chunks = [];
16648                this.strm = new ZStream();
16649                this.strm.avail_out = 0;
16650                var status = zlib_inflate.inflateInit2(
16651                  this.strm,
16652                  opt.windowBits
16653                );
16654                if (status !== c6.Z_OK) {
16655                  throw new Error(msg[status]);
16656                }
16657                this.header = new GZheader();
16658                zlib_inflate.inflateGetHeader(this.strm, this.header);
16659                if (opt.dictionary) {
16660                  if (typeof opt.dictionary === "string") {
16661                    opt.dictionary = strings.string2buf(
16662                      opt.dictionary
16663                    );
16664                  } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") {
16665                    opt.dictionary = new Uint8Array(
16666                      opt.dictionary
16667                    );
16668                  }
16669                  if (opt.raw) {
16670                    status = zlib_inflate.inflateSetDictionary(
16671                      this.strm,
16672                      opt.dictionary
16673                    );
16674                    if (status !== c6.Z_OK) {
16675                      throw new Error(msg[status]);
16676                    }
16677                  }
16678                }
16679              }
16680              Inflate.prototype.push = function(data, mode) {
16681                var strm = this.strm;
16682                var chunkSize = this.options.chunkSize;
16683                var dictionary = this.options.dictionary;
16684                var status, _mode;
16685                var next_out_utf8, tail, utf8str;
16686                var allowBufError = false;
16687                if (this.ended) {
16688                  return false;
16689                }
16690                _mode = mode === ~~mode ? mode : mode === true ? c6.Z_FINISH : c6.Z_NO_FLUSH;
16691                if (typeof data === "string") {
16692                  strm.input = strings.binstring2buf(data);
16693                } else if (toString.call(data) === "[object ArrayBuffer]") {
16694                  strm.input = new Uint8Array(data);
16695                } else {
16696                  strm.input = data;
16697                }
16698                strm.next_in = 0;
16699                strm.avail_in = strm.input.length;
16700                do {
16701                  if (strm.avail_out === 0) {
16702                    strm.output = new utils.Buf8(chunkSize);
16703                    strm.next_out = 0;
16704                    strm.avail_out = chunkSize;
16705                  }
16706                  status = zlib_inflate.inflate(
16707                    strm,
16708                    c6.Z_NO_FLUSH
16709                  );
16710                  if (status === c6.Z_NEED_DICT && dictionary) {
16711                    status = zlib_inflate.inflateSetDictionary(
16712                      this.strm,
16713                      dictionary
16714                    );
16715                  }
16716                  if (status === c6.Z_BUF_ERROR && allowBufError === true) {
16717                    status = c6.Z_OK;
16718                    allowBufError = false;
16719                  }
16720                  if (status !== c6.Z_STREAM_END && status !== c6.Z_OK) {
16721                    this.onEnd(status);
16722                    this.ended = true;
16723                    return false;
16724                  }
16725                  if (strm.next_out) {
16726                    if (strm.avail_out === 0 || status === c6.Z_STREAM_END || strm.avail_in === 0 && (_mode === c6.Z_FINISH || _mode === c6.Z_SYNC_FLUSH)) {
16727                      if (this.options.to === "string") {
16728                        next_out_utf8 = strings.utf8border(
16729                          strm.output,
16730                          strm.next_out
16731                        );
16732                        tail = strm.next_out - next_out_utf8;
16733                        utf8str = strings.buf2string(
16734                          strm.output,
16735                          next_out_utf8
16736                        );
16737                        strm.next_out = tail;
16738                        strm.avail_out = chunkSize - tail;
16739                        if (tail) {
16740                          utils.arraySet(
16741                            strm.output,
16742                            strm.output,
16743                            next_out_utf8,
16744                            tail,
16745                            0
16746                          );
16747                        }
16748                        this.onData(utf8str);
16749                      } else {
16750                        this.onData(
16751                          utils.shrinkBuf(
16752                            strm.output,
16753                            strm.next_out
16754                          )
16755                        );
16756                      }
16757                    }
16758                  }
16759                  if (strm.avail_in === 0 && strm.avail_out === 0) {
16760                    allowBufError = true;
16761                  }
16762                } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c6.Z_STREAM_END);
16763                if (status === c6.Z_STREAM_END) {
16764                  _mode = c6.Z_FINISH;
16765                }
16766                if (_mode === c6.Z_FINISH) {
16767                  status = zlib_inflate.inflateEnd(this.strm);
16768                  this.onEnd(status);
16769                  this.ended = true;
16770                  return status === c6.Z_OK;
16771                }
16772                if (_mode === c6.Z_SYNC_FLUSH) {
16773                  this.onEnd(c6.Z_OK);
16774                  strm.avail_out = 0;
16775                  return true;
16776                }
16777                return true;
16778              };
16779              Inflate.prototype.onData = function(chunk2) {
16780                this.chunks.push(chunk2);
16781              };
16782              Inflate.prototype.onEnd = function(status) {
16783                if (status === c6.Z_OK) {
16784                  if (this.options.to === "string") {
16785                    this.result = this.chunks.join("");
16786                  } else {
16787                    this.result = utils.flattenChunks(
16788                      this.chunks
16789                    );
16790                  }
16791                }
16792                this.chunks = [];
16793                this.err = status;
16794                this.msg = this.strm.msg;
16795              };
16796              function inflate(input, options) {
16797                var inflator = new Inflate(options);
16798                inflator.push(input, true);
16799                if (inflator.err) {
16800                  throw inflator.msg || msg[inflator.err];
16801                }
16802                return inflator.result;
16803              }
16804              function inflateRaw(input, options) {
16805                options = options || {};
16806                options.raw = true;
16807                return inflate(input, options);
16808              }
16809              exports2.Inflate = Inflate;
16810              exports2.inflate = inflate;
16811              exports2.inflateRaw = inflateRaw;
16812              exports2.ungzip = inflate;
16813            },
16814            {
16815              "./utils/common": 1,
16816              "./utils/strings": 2,
16817              "./zlib/constants": 4,
16818              "./zlib/gzheader": 6,
16819              "./zlib/inflate": 8,
16820              "./zlib/messages": 10,
16821              "./zlib/zstream": 11
16822            }
16823          ]
16824        },
16825        {},
16826        []
16827      )("/lib/inflate.js");
16828    })();
16829  
16830    // packages/global-styles-ui/build-module/font-library/lib/lib-font.browser.mjs
16831    var fetchFunction = globalThis.fetch;
16832    var Event2 = class {
16833      constructor(type, detail = {}, msg) {
16834        this.type = type;
16835        this.detail = detail;
16836        this.msg = msg;
16837        Object.defineProperty(this, `__mayPropagate`, {
16838          enumerable: false,
16839          writable: true
16840        });
16841        this.__mayPropagate = true;
16842      }
16843      preventDefault() {
16844      }
16845      stopPropagation() {
16846        this.__mayPropagate = false;
16847      }
16848      valueOf() {
16849        return this;
16850      }
16851      toString() {
16852        return this.msg ? `[$this.type} event]: $this.msg}` : `[$this.type} event]`;
16853      }
16854    };
16855    var EventManager = class {
16856      constructor() {
16857        this.listeners = {};
16858      }
16859      addEventListener(type, listener, useCapture) {
16860        let bin = this.listeners[type] || [];
16861        if (useCapture) bin.unshift(listener);
16862        else bin.push(listener);
16863        this.listeners[type] = bin;
16864      }
16865      removeEventListener(type, listener) {
16866        let bin = this.listeners[type] || [];
16867        let pos = bin.findIndex((e2) => e2 === listener);
16868        if (pos > -1) {
16869          bin.splice(pos, 1);
16870          this.listeners[type] = bin;
16871        }
16872      }
16873      dispatch(event) {
16874        let bin = this.listeners[event.type];
16875        if (bin) {
16876          for (let l2 = 0, e2 = bin.length; l2 < e2; l2++) {
16877            if (!event.__mayPropagate) break;
16878            bin[l2](event);
16879          }
16880        }
16881      }
16882    };
16883    var startDate = (/* @__PURE__ */ new Date(`1904-01-01T00:00:00+0000`)).getTime();
16884    function asText(data) {
16885      return Array.from(data).map((v2) => String.fromCharCode(v2)).join(``);
16886    }
16887    var Parser = class {
16888      constructor(dict, dataview, name2) {
16889        this.name = (name2 || dict.tag || ``).trim();
16890        this.length = dict.length;
16891        this.start = dict.offset;
16892        this.offset = 0;
16893        this.data = dataview;
16894        [
16895          `getInt8`,
16896          `getUint8`,
16897          `getInt16`,
16898          `getUint16`,
16899          `getInt32`,
16900          `getUint32`,
16901          `getBigInt64`,
16902          `getBigUint64`
16903        ].forEach((name3) => {
16904          let fn = name3.replace(/get(Big)?/, "").toLowerCase();
16905          let increment = parseInt(name3.replace(/[^\d]/g, "")) / 8;
16906          Object.defineProperty(this, fn, {
16907            get: () => this.getValue(name3, increment)
16908          });
16909        });
16910      }
16911      get currentPosition() {
16912        return this.start + this.offset;
16913      }
16914      set currentPosition(position) {
16915        this.start = position;
16916        this.offset = 0;
16917      }
16918      skip(n2 = 0, bits = 8) {
16919        this.offset += n2 * bits / 8;
16920      }
16921      getValue(type, increment) {
16922        let pos = this.start + this.offset;
16923        this.offset += increment;
16924        try {
16925          return this.data[type](pos);
16926        } catch (e2) {
16927          console.error(`parser`, type, increment, this);
16928          console.error(`parser`, this.start, this.offset);
16929          throw e2;
16930        }
16931      }
16932      flags(n2) {
16933        if (n2 === 8 || n2 === 16 || n2 === 32 || n2 === 64) {
16934          return this[`uint$n2}`].toString(2).padStart(n2, 0).split(``).map((v2) => v2 === "1");
16935        }
16936        console.error(
16937          `Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long`
16938        );
16939        console.trace();
16940      }
16941      get tag() {
16942        const t3 = this.uint32;
16943        return asText([
16944          t3 >> 24 & 255,
16945          t3 >> 16 & 255,
16946          t3 >> 8 & 255,
16947          t3 & 255
16948        ]);
16949      }
16950      get fixed() {
16951        let major = this.int16;
16952        let minor = Math.round(1e3 * this.uint16 / 65356);
16953        return major + minor / 1e3;
16954      }
16955      get legacyFixed() {
16956        let major = this.uint16;
16957        let minor = this.uint16.toString(16).padStart(4, 0);
16958        return parseFloat(`$major}.$minor}`);
16959      }
16960      get uint24() {
16961        return (this.uint8 << 16) + (this.uint8 << 8) + this.uint8;
16962      }
16963      get uint128() {
16964        let value = 0;
16965        for (let i2 = 0; i2 < 5; i2++) {
16966          let byte = this.uint8;
16967          value = value * 128 + (byte & 127);
16968          if (byte < 128) break;
16969        }
16970        return value;
16971      }
16972      get longdatetime() {
16973        return new Date(startDate + 1e3 * parseInt(this.int64.toString()));
16974      }
16975      get fword() {
16976        return this.int16;
16977      }
16978      get ufword() {
16979        return this.uint16;
16980      }
16981      get Offset16() {
16982        return this.uint16;
16983      }
16984      get Offset32() {
16985        return this.uint32;
16986      }
16987      get F2DOT14() {
16988        const bits = p.uint16;
16989        const integer = [0, 1, -2, -1][bits >> 14];
16990        const fraction = bits & 16383;
16991        return integer + fraction / 16384;
16992      }
16993      verifyLength() {
16994        if (this.offset != this.length) {
16995          console.error(
16996            `unexpected parsed table size ($this.offset}) for "$this.name}" (expected $this.length})`
16997          );
16998        }
16999      }
17000      readBytes(n2 = 0, position = 0, bits = 8, signed = false) {
17001        n2 = n2 || this.length;
17002        if (n2 === 0) return [];
17003        if (position) this.currentPosition = position;
17004        const fn = `$signed ? `` : `u`}int$bits}`, slice = [];
17005        while (n2--) slice.push(this[fn]);
17006        return slice;
17007      }
17008    };
17009    var ParsedData = class {
17010      constructor(parser) {
17011        const pGetter = { enumerable: false, get: () => parser };
17012        Object.defineProperty(this, `parser`, pGetter);
17013        const start2 = parser.currentPosition;
17014        const startGetter = { enumerable: false, get: () => start2 };
17015        Object.defineProperty(this, `start`, startGetter);
17016      }
17017      load(struct) {
17018        Object.keys(struct).forEach((p22) => {
17019          let props = Object.getOwnPropertyDescriptor(struct, p22);
17020          if (props.get) {
17021            this[p22] = props.get.bind(this);
17022          } else if (props.value !== void 0) {
17023            this[p22] = props.value;
17024          }
17025        });
17026        if (this.parser.length) {
17027          this.parser.verifyLength();
17028        }
17029      }
17030    };
17031    var SimpleTable = class extends ParsedData {
17032      constructor(dict, dataview, name2) {
17033        const { parser, start: start2 } = super(
17034          new Parser(dict, dataview, name2)
17035        );
17036        const pGetter = { enumerable: false, get: () => parser };
17037        Object.defineProperty(this, `p`, pGetter);
17038        const startGetter = { enumerable: false, get: () => start2 };
17039        Object.defineProperty(this, `tableStart`, startGetter);
17040      }
17041    };
17042    function lazy$1(object, property, getter) {
17043      let val;
17044      Object.defineProperty(object, property, {
17045        get: () => {
17046          if (val) return val;
17047          val = getter();
17048          return val;
17049        },
17050        enumerable: true
17051      });
17052    }
17053    var SFNT = class extends SimpleTable {
17054      constructor(font2, dataview, createTable2) {
17055        const { p: p22 } = super({ offset: 0, length: 12 }, dataview, `sfnt`);
17056        this.version = p22.uint32;
17057        this.numTables = p22.uint16;
17058        this.searchRange = p22.uint16;
17059        this.entrySelector = p22.uint16;
17060        this.rangeShift = p22.uint16;
17061        p22.verifyLength();
17062        this.directory = [...new Array(this.numTables)].map(
17063          (_) => new TableRecord(p22)
17064        );
17065        this.tables = {};
17066        this.directory.forEach((entry) => {
17067          const getter = () => createTable2(
17068            this.tables,
17069            {
17070              tag: entry.tag,
17071              offset: entry.offset,
17072              length: entry.length
17073            },
17074            dataview
17075          );
17076          lazy$1(this.tables, entry.tag.trim(), getter);
17077        });
17078      }
17079    };
17080    var TableRecord = class {
17081      constructor(p22) {
17082        this.tag = p22.tag;
17083        this.checksum = p22.uint32;
17084        this.offset = p22.uint32;
17085        this.length = p22.uint32;
17086      }
17087    };
17088    var gzipDecode = inflate_default.inflate || void 0;
17089    var nativeGzipDecode = void 0;
17090    var WOFF$1 = class extends SimpleTable {
17091      constructor(font2, dataview, createTable2) {
17092        const { p: p22 } = super({ offset: 0, length: 44 }, dataview, `woff`);
17093        this.signature = p22.tag;
17094        this.flavor = p22.uint32;
17095        this.length = p22.uint32;
17096        this.numTables = p22.uint16;
17097        p22.uint16;
17098        this.totalSfntSize = p22.uint32;
17099        this.majorVersion = p22.uint16;
17100        this.minorVersion = p22.uint16;
17101        this.metaOffset = p22.uint32;
17102        this.metaLength = p22.uint32;
17103        this.metaOrigLength = p22.uint32;
17104        this.privOffset = p22.uint32;
17105        this.privLength = p22.uint32;
17106        p22.verifyLength();
17107        this.directory = [...new Array(this.numTables)].map(
17108          (_) => new WoffTableDirectoryEntry(p22)
17109        );
17110        buildWoffLazyLookups(this, dataview, createTable2);
17111      }
17112    };
17113    var WoffTableDirectoryEntry = class {
17114      constructor(p22) {
17115        this.tag = p22.tag;
17116        this.offset = p22.uint32;
17117        this.compLength = p22.uint32;
17118        this.origLength = p22.uint32;
17119        this.origChecksum = p22.uint32;
17120      }
17121    };
17122    function buildWoffLazyLookups(woff, dataview, createTable2) {
17123      woff.tables = {};
17124      woff.directory.forEach((entry) => {
17125        lazy$1(woff.tables, entry.tag.trim(), () => {
17126          let offset = 0;
17127          let view = dataview;
17128          if (entry.compLength !== entry.origLength) {
17129            const data = dataview.buffer.slice(
17130              entry.offset,
17131              entry.offset + entry.compLength
17132            );
17133            let unpacked;
17134            if (gzipDecode) {
17135              unpacked = gzipDecode(new Uint8Array(data));
17136            } else if (nativeGzipDecode) {
17137              unpacked = nativeGzipDecode(new Uint8Array(data));
17138            } else {
17139              const msg = `no brotli decoder available to decode WOFF2 font`;
17140              if (font.onerror) font.onerror(msg);
17141              throw new Error(msg);
17142            }
17143            view = new DataView(unpacked.buffer);
17144          } else {
17145            offset = entry.offset;
17146          }
17147          return createTable2(
17148            woff.tables,
17149            { tag: entry.tag, offset, length: entry.origLength },
17150            view
17151          );
17152        });
17153      });
17154    }
17155    var brotliDecode = unbrotli_default;
17156    var nativeBrotliDecode = void 0;
17157    var WOFF2$1 = class extends SimpleTable {
17158      constructor(font2, dataview, createTable2) {
17159        const { p: p22 } = super({ offset: 0, length: 48 }, dataview, `woff2`);
17160        this.signature = p22.tag;
17161        this.flavor = p22.uint32;
17162        this.length = p22.uint32;
17163        this.numTables = p22.uint16;
17164        p22.uint16;
17165        this.totalSfntSize = p22.uint32;
17166        this.totalCompressedSize = p22.uint32;
17167        this.majorVersion = p22.uint16;
17168        this.minorVersion = p22.uint16;
17169        this.metaOffset = p22.uint32;
17170        this.metaLength = p22.uint32;
17171        this.metaOrigLength = p22.uint32;
17172        this.privOffset = p22.uint32;
17173        this.privLength = p22.uint32;
17174        p22.verifyLength();
17175        this.directory = [...new Array(this.numTables)].map(
17176          (_) => new Woff2TableDirectoryEntry(p22)
17177        );
17178        let dictOffset = p22.currentPosition;
17179        this.directory[0].offset = 0;
17180        this.directory.forEach((e2, i2) => {
17181          let next = this.directory[i2 + 1];
17182          if (next) {
17183            next.offset = e2.offset + (e2.transformLength !== void 0 ? e2.transformLength : e2.origLength);
17184          }
17185        });
17186        let decoded;
17187        let buffer = dataview.buffer.slice(dictOffset);
17188        if (brotliDecode) {
17189          decoded = brotliDecode(new Uint8Array(buffer));
17190        } else if (nativeBrotliDecode) {
17191          decoded = new Uint8Array(nativeBrotliDecode(buffer));
17192        } else {
17193          const msg = `no brotli decoder available to decode WOFF2 font`;
17194          if (font2.onerror) font2.onerror(msg);
17195          throw new Error(msg);
17196        }
17197        buildWoff2LazyLookups(this, decoded, createTable2);
17198      }
17199    };
17200    var Woff2TableDirectoryEntry = class {
17201      constructor(p22) {
17202        this.flags = p22.uint8;
17203        const tagNumber = this.tagNumber = this.flags & 63;
17204        if (tagNumber === 63) {
17205          this.tag = p22.tag;
17206        } else {
17207          this.tag = getWOFF2Tag(tagNumber);
17208        }
17209        const transformVersion = this.transformVersion = (this.flags & 192) >> 6;
17210        let hasTransforms = transformVersion !== 0;
17211        if (this.tag === `glyf` || this.tag === `loca`) {
17212          hasTransforms = this.transformVersion !== 3;
17213        }
17214        this.origLength = p22.uint128;
17215        if (hasTransforms) {
17216          this.transformLength = p22.uint128;
17217        }
17218      }
17219    };
17220    function buildWoff2LazyLookups(woff2, decoded, createTable2) {
17221      woff2.tables = {};
17222      woff2.directory.forEach((entry) => {
17223        lazy$1(woff2.tables, entry.tag.trim(), () => {
17224          const start2 = entry.offset;
17225          const end = start2 + (entry.transformLength ? entry.transformLength : entry.origLength);
17226          const data = new DataView(decoded.slice(start2, end).buffer);
17227          try {
17228            return createTable2(
17229              woff2.tables,
17230              { tag: entry.tag, offset: 0, length: entry.origLength },
17231              data
17232            );
17233          } catch (e2) {
17234            console.error(e2);
17235          }
17236        });
17237      });
17238    }
17239    function getWOFF2Tag(flag) {
17240      return [
17241        `cmap`,
17242        `head`,
17243        `hhea`,
17244        `hmtx`,
17245        `maxp`,
17246        `name`,
17247        `OS/2`,
17248        `post`,
17249        `cvt `,
17250        `fpgm`,
17251        `glyf`,
17252        `loca`,
17253        `prep`,
17254        `CFF `,
17255        `VORG`,
17256        `EBDT`,
17257        `EBLC`,
17258        `gasp`,
17259        `hdmx`,
17260        `kern`,
17261        `LTSH`,
17262        `PCLT`,
17263        `VDMX`,
17264        `vhea`,
17265        `vmtx`,
17266        `BASE`,
17267        `GDEF`,
17268        `GPOS`,
17269        `GSUB`,
17270        `EBSC`,
17271        `JSTF`,
17272        `MATH`,
17273        `CBDT`,
17274        `CBLC`,
17275        `COLR`,
17276        `CPAL`,
17277        `SVG `,
17278        `sbix`,
17279        `acnt`,
17280        `avar`,
17281        `bdat`,
17282        `bloc`,
17283        `bsln`,
17284        `cvar`,
17285        `fdsc`,
17286        `feat`,
17287        `fmtx`,
17288        `fvar`,
17289        `gvar`,
17290        `hsty`,
17291        `just`,
17292        `lcar`,
17293        `mort`,
17294        `morx`,
17295        `opbd`,
17296        `prop`,
17297        `trak`,
17298        `Zapf`,
17299        `Silf`,
17300        `Glat`,
17301        `Gloc`,
17302        `Feat`,
17303        `Sill`
17304      ][flag & 63];
17305    }
17306    var tableClasses = {};
17307    var tableClassesLoaded = false;
17308    Promise.all([
17309      Promise.resolve().then(function() {
17310        return cmap$1;
17311      }),
17312      Promise.resolve().then(function() {
17313        return head$1;
17314      }),
17315      Promise.resolve().then(function() {
17316        return hhea$1;
17317      }),
17318      Promise.resolve().then(function() {
17319        return hmtx$1;
17320      }),
17321      Promise.resolve().then(function() {
17322        return maxp$1;
17323      }),
17324      Promise.resolve().then(function() {
17325        return name$1;
17326      }),
17327      Promise.resolve().then(function() {
17328        return OS2$1;
17329      }),
17330      Promise.resolve().then(function() {
17331        return post$1;
17332      }),
17333      Promise.resolve().then(function() {
17334        return BASE$1;
17335      }),
17336      Promise.resolve().then(function() {
17337        return GDEF$1;
17338      }),
17339      Promise.resolve().then(function() {
17340        return GSUB$1;
17341      }),
17342      Promise.resolve().then(function() {
17343        return GPOS$1;
17344      }),
17345      Promise.resolve().then(function() {
17346        return SVG$1;
17347      }),
17348      Promise.resolve().then(function() {
17349        return fvar$1;
17350      }),
17351      Promise.resolve().then(function() {
17352        return cvt$1;
17353      }),
17354      Promise.resolve().then(function() {
17355        return fpgm$1;
17356      }),
17357      Promise.resolve().then(function() {
17358        return gasp$1;
17359      }),
17360      Promise.resolve().then(function() {
17361        return glyf$1;
17362      }),
17363      Promise.resolve().then(function() {
17364        return loca$1;
17365      }),
17366      Promise.resolve().then(function() {
17367        return prep$1;
17368      }),
17369      Promise.resolve().then(function() {
17370        return CFF$1;
17371      }),
17372      Promise.resolve().then(function() {
17373        return CFF2$1;
17374      }),
17375      Promise.resolve().then(function() {
17376        return VORG$1;
17377      }),
17378      Promise.resolve().then(function() {
17379        return EBLC$1;
17380      }),
17381      Promise.resolve().then(function() {
17382        return EBDT$1;
17383      }),
17384      Promise.resolve().then(function() {
17385        return EBSC$1;
17386      }),
17387      Promise.resolve().then(function() {
17388        return CBLC$1;
17389      }),
17390      Promise.resolve().then(function() {
17391        return CBDT$1;
17392      }),
17393      Promise.resolve().then(function() {
17394        return sbix$1;
17395      }),
17396      Promise.resolve().then(function() {
17397        return COLR$1;
17398      }),
17399      Promise.resolve().then(function() {
17400        return CPAL$1;
17401      }),
17402      Promise.resolve().then(function() {
17403        return DSIG$1;
17404      }),
17405      Promise.resolve().then(function() {
17406        return hdmx$1;
17407      }),
17408      Promise.resolve().then(function() {
17409        return kern$1;
17410      }),
17411      Promise.resolve().then(function() {
17412        return LTSH$1;
17413      }),
17414      Promise.resolve().then(function() {
17415        return MERG$1;
17416      }),
17417      Promise.resolve().then(function() {
17418        return meta$1;
17419      }),
17420      Promise.resolve().then(function() {
17421        return PCLT$1;
17422      }),
17423      Promise.resolve().then(function() {
17424        return VDMX$1;
17425      }),
17426      Promise.resolve().then(function() {
17427        return vhea$1;
17428      }),
17429      Promise.resolve().then(function() {
17430        return vmtx$1;
17431      })
17432    ]).then((data) => {
17433      data.forEach((e2) => {
17434        let name2 = Object.keys(e2)[0];
17435        tableClasses[name2] = e2[name2];
17436      });
17437      tableClassesLoaded = true;
17438    });
17439    function createTable(tables, dict, dataview) {
17440      let name2 = dict.tag.replace(/[^\w\d]/g, ``);
17441      let Type = tableClasses[name2];
17442      if (Type) return new Type(dict, dataview, tables);
17443      console.warn(
17444        `lib-font has no definition for $name2}. The table was skipped.`
17445      );
17446      return {};
17447    }
17448    function loadTableClasses() {
17449      let count = 0;
17450      function checkLoaded(resolve, reject) {
17451        if (!tableClassesLoaded) {
17452          if (count > 10) {
17453            return reject(new Error(`loading took too long`));
17454          }
17455          count++;
17456          return setTimeout(() => checkLoaded(resolve), 250);
17457        }
17458        resolve(createTable);
17459      }
17460      return new Promise((resolve, reject) => checkLoaded(resolve));
17461    }
17462    function getFontCSSFormat(path, errorOnStyle) {
17463      let pos = path.lastIndexOf(`.`);
17464      let ext = (path.substring(pos + 1) || ``).toLowerCase();
17465      let format6 = {
17466        ttf: `truetype`,
17467        otf: `opentype`,
17468        woff: `woff`,
17469        woff2: `woff2`
17470      }[ext];
17471      if (format6) return format6;
17472      let msg = {
17473        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.`,
17474        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.`,
17475        fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`,
17476        ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`
17477      }[ext];
17478      if (!msg) msg = `$path} is not a known webfont format.`;
17479      if (errorOnStyle) {
17480        throw new Error(msg);
17481      } else {
17482        console.warn(`Could not load font: $msg}`);
17483      }
17484    }
17485    async function setupFontFace(name2, url, options = {}) {
17486      if (!globalThis.document) return;
17487      let format6 = getFontCSSFormat(url, options.errorOnStyle);
17488      if (!format6) return;
17489      let style = document.createElement(`style`);
17490      style.className = `injected-by-Font-js`;
17491      let rules = [];
17492      if (options.styleRules) {
17493        rules = Object.entries(options.styleRules).map(
17494          ([key, value]) => `$key}: $value};`
17495        );
17496      }
17497      style.textContent = `
17498  @font-face {
17499      font-family: "$name2}";
17500      $rules.join(
17501        `
17502      `
17503      )}
17504      src: url("$url}") format("$format6}");
17505  }`;
17506      globalThis.document.head.appendChild(style);
17507      return style;
17508    }
17509    var TTF = [0, 1, 0, 0];
17510    var OTF = [79, 84, 84, 79];
17511    var WOFF = [119, 79, 70, 70];
17512    var WOFF2 = [119, 79, 70, 50];
17513    function match(ar1, ar2) {
17514      if (ar1.length !== ar2.length) return;
17515      for (let i2 = 0; i2 < ar1.length; i2++) {
17516        if (ar1[i2] !== ar2[i2]) return;
17517      }
17518      return true;
17519    }
17520    function validFontFormat(dataview) {
17521      const LEAD_BYTES = [
17522        dataview.getUint8(0),
17523        dataview.getUint8(1),
17524        dataview.getUint8(2),
17525        dataview.getUint8(3)
17526      ];
17527      if (match(LEAD_BYTES, TTF) || match(LEAD_BYTES, OTF)) return `SFNT`;
17528      if (match(LEAD_BYTES, WOFF)) return `WOFF`;
17529      if (match(LEAD_BYTES, WOFF2)) return `WOFF2`;
17530    }
17531    function checkFetchResponseStatus(response) {
17532      if (!response.ok) {
17533        throw new Error(
17534          `HTTP $response.status} - $response.statusText}`
17535        );
17536      }
17537      return response;
17538    }
17539    var Font = class extends EventManager {
17540      constructor(name2, options = {}) {
17541        super();
17542        this.name = name2;
17543        this.options = options;
17544        this.metrics = false;
17545      }
17546      get src() {
17547        return this.__src;
17548      }
17549      set src(src) {
17550        this.__src = src;
17551        (async () => {
17552          if (globalThis.document && !this.options.skipStyleSheet) {
17553            await setupFontFace(this.name, src, this.options);
17554          }
17555          this.loadFont(src);
17556        })();
17557      }
17558      async loadFont(url, filename) {
17559        fetch(url).then(
17560          (response) => checkFetchResponseStatus(response) && response.arrayBuffer()
17561        ).then(
17562          (buffer) => this.fromDataBuffer(buffer, filename || url)
17563        ).catch((err) => {
17564          const evt = new Event2(
17565            `error`,
17566            err,
17567            `Failed to load font at $filename || url}`
17568          );
17569          this.dispatch(evt);
17570          if (this.onerror) this.onerror(evt);
17571        });
17572      }
17573      async fromDataBuffer(buffer, filenameOrUrL) {
17574        this.fontData = new DataView(buffer);
17575        let type = validFontFormat(this.fontData);
17576        if (!type) {
17577          throw new Error(
17578            `$filenameOrUrL} is either an unsupported font format, or not a font at all.`
17579          );
17580        }
17581        await this.parseBasicData(type);
17582        const evt = new Event2("load", { font: this });
17583        this.dispatch(evt);
17584        if (this.onload) this.onload(evt);
17585      }
17586      async parseBasicData(type) {
17587        return loadTableClasses().then((createTable2) => {
17588          if (type === `SFNT`) {
17589            this.opentype = new SFNT(this, this.fontData, createTable2);
17590          }
17591          if (type === `WOFF`) {
17592            this.opentype = new WOFF$1(this, this.fontData, createTable2);
17593          }
17594          if (type === `WOFF2`) {
17595            this.opentype = new WOFF2$1(this, this.fontData, createTable2);
17596          }
17597          return this.opentype;
17598        });
17599      }
17600      getGlyphId(char) {
17601        return this.opentype.tables.cmap.getGlyphId(char);
17602      }
17603      reverse(glyphid) {
17604        return this.opentype.tables.cmap.reverse(glyphid);
17605      }
17606      supports(char) {
17607        return this.getGlyphId(char) !== 0;
17608      }
17609      supportsVariation(variation) {
17610        return this.opentype.tables.cmap.supportsVariation(variation) !== false;
17611      }
17612      measureText(text, size = 16) {
17613        if (this.__unloaded)
17614          throw new Error(
17615            "Cannot measure text: font was unloaded. Please reload before calling measureText()"
17616          );
17617        let d2 = document.createElement("div");
17618        d2.textContent = text;
17619        d2.style.fontFamily = this.name;
17620        d2.style.fontSize = `$size}px`;
17621        d2.style.color = `transparent`;
17622        d2.style.background = `transparent`;
17623        d2.style.top = `0`;
17624        d2.style.left = `0`;
17625        d2.style.position = `absolute`;
17626        document.body.appendChild(d2);
17627        let bbox = d2.getBoundingClientRect();
17628        document.body.removeChild(d2);
17629        const OS22 = this.opentype.tables["OS/2"];
17630        bbox.fontSize = size;
17631        bbox.ascender = OS22.sTypoAscender;
17632        bbox.descender = OS22.sTypoDescender;
17633        return bbox;
17634      }
17635      unload() {
17636        if (this.styleElement.parentNode) {
17637          this.styleElement.parentNode.removeElement(this.styleElement);
17638          const evt = new Event2("unload", { font: this });
17639          this.dispatch(evt);
17640          if (this.onunload) this.onunload(evt);
17641        }
17642        this._unloaded = true;
17643      }
17644      load() {
17645        if (this.__unloaded) {
17646          delete this.__unloaded;
17647          document.head.appendChild(this.styleElement);
17648          const evt = new Event2("load", { font: this });
17649          this.dispatch(evt);
17650          if (this.onload) this.onload(evt);
17651        }
17652      }
17653    };
17654    globalThis.Font = Font;
17655    var Subtable = class extends ParsedData {
17656      constructor(p22, plaformID, encodingID) {
17657        super(p22);
17658        this.plaformID = plaformID;
17659        this.encodingID = encodingID;
17660      }
17661    };
17662    var Format0 = class extends Subtable {
17663      constructor(p22, platformID, encodingID) {
17664        super(p22, platformID, encodingID);
17665        this.format = 0;
17666        this.length = p22.uint16;
17667        this.language = p22.uint16;
17668        this.glyphIdArray = [...new Array(256)].map((_) => p22.uint8);
17669      }
17670      supports(charCode) {
17671        if (charCode.charCodeAt) {
17672          charCode = -1;
17673          console.warn(
17674            `supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.`
17675          );
17676        }
17677        return 0 <= charCode && charCode <= 255;
17678      }
17679      reverse(glyphID) {
17680        console.warn(`reverse not implemented for cmap subtable format 0`);
17681        return {};
17682      }
17683      getSupportedCharCodes() {
17684        return [{ start: 1, end: 256 }];
17685      }
17686    };
17687    var Format2 = class extends Subtable {
17688      constructor(p22, platformID, encodingID) {
17689        super(p22, platformID, encodingID);
17690        this.format = 2;
17691        this.length = p22.uint16;
17692        this.language = p22.uint16;
17693        this.subHeaderKeys = [...new Array(256)].map((_) => p22.uint16);
17694        const subHeaderCount = Math.max(...this.subHeaderKeys);
17695        const subHeaderOffset = p22.currentPosition;
17696        lazy$1(this, `subHeaders`, () => {
17697          p22.currentPosition = subHeaderOffset;
17698          return [...new Array(subHeaderCount)].map(
17699            (_) => new SubHeader(p22)
17700          );
17701        });
17702        const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8;
17703        lazy$1(this, `glyphIndexArray`, () => {
17704          p22.currentPosition = glyphIndexOffset;
17705          return [...new Array(subHeaderCount)].map((_) => p22.uint16);
17706        });
17707      }
17708      supports(charCode) {
17709        if (charCode.charCodeAt) {
17710          charCode = -1;
17711          console.warn(
17712            `supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.`
17713          );
17714        }
17715        const low = charCode && 255;
17716        const high = charCode && 65280;
17717        const subHeaderKey = this.subHeaders[high];
17718        const subheader = this.subHeaders[subHeaderKey];
17719        const first = subheader.firstCode;
17720        const last = first + subheader.entryCount;
17721        return first <= low && low <= last;
17722      }
17723      reverse(glyphID) {
17724        console.warn(`reverse not implemented for cmap subtable format 2`);
17725        return {};
17726      }
17727      getSupportedCharCodes(preservePropNames = false) {
17728        if (preservePropNames) {
17729          return this.subHeaders.map((h2) => ({
17730            firstCode: h2.firstCode,
17731            lastCode: h2.lastCode
17732          }));
17733        }
17734        return this.subHeaders.map((h2) => ({
17735          start: h2.firstCode,
17736          end: h2.lastCode
17737        }));
17738      }
17739    };
17740    var SubHeader = class {
17741      constructor(p22) {
17742        this.firstCode = p22.uint16;
17743        this.entryCount = p22.uint16;
17744        this.lastCode = this.first + this.entryCount;
17745        this.idDelta = p22.int16;
17746        this.idRangeOffset = p22.uint16;
17747      }
17748    };
17749    var Format4 = class extends Subtable {
17750      constructor(p22, platformID, encodingID) {
17751        super(p22, platformID, encodingID);
17752        this.format = 4;
17753        this.length = p22.uint16;
17754        this.language = p22.uint16;
17755        this.segCountX2 = p22.uint16;
17756        this.segCount = this.segCountX2 / 2;
17757        this.searchRange = p22.uint16;
17758        this.entrySelector = p22.uint16;
17759        this.rangeShift = p22.uint16;
17760        const endCodePosition = p22.currentPosition;
17761        lazy$1(
17762          this,
17763          `endCode`,
17764          () => p22.readBytes(this.segCount, endCodePosition, 16)
17765        );
17766        const startCodePosition = endCodePosition + 2 + this.segCountX2;
17767        lazy$1(
17768          this,
17769          `startCode`,
17770          () => p22.readBytes(this.segCount, startCodePosition, 16)
17771        );
17772        const idDeltaPosition = startCodePosition + this.segCountX2;
17773        lazy$1(
17774          this,
17775          `idDelta`,
17776          () => p22.readBytes(this.segCount, idDeltaPosition, 16, true)
17777        );
17778        const idRangePosition = idDeltaPosition + this.segCountX2;
17779        lazy$1(
17780          this,
17781          `idRangeOffset`,
17782          () => p22.readBytes(this.segCount, idRangePosition, 16)
17783        );
17784        const glyphIdArrayPosition = idRangePosition + this.segCountX2;
17785        const glyphIdArrayLength = this.length - (glyphIdArrayPosition - this.tableStart);
17786        lazy$1(
17787          this,
17788          `glyphIdArray`,
17789          () => p22.readBytes(glyphIdArrayLength, glyphIdArrayPosition, 16)
17790        );
17791        lazy$1(
17792          this,
17793          `segments`,
17794          () => this.buildSegments(idRangePosition, glyphIdArrayPosition, p22)
17795        );
17796      }
17797      buildSegments(idRangePosition, glyphIdArrayPosition, p22) {
17798        const build = (_, i2) => {
17799          let startCode = this.startCode[i2], endCode = this.endCode[i2], idDelta = this.idDelta[i2], idRangeOffset = this.idRangeOffset[i2], idRangeOffsetPointer = idRangePosition + 2 * i2, glyphIDs = [];
17800          if (idRangeOffset === 0) {
17801            for (let i22 = startCode + idDelta, e2 = endCode + idDelta; i22 <= e2; i22++) {
17802              glyphIDs.push(i22);
17803            }
17804          } else {
17805            for (let i22 = 0, e2 = endCode - startCode; i22 <= e2; i22++) {
17806              p22.currentPosition = idRangeOffsetPointer + idRangeOffset + i22 * 2;
17807              glyphIDs.push(p22.uint16);
17808            }
17809          }
17810          return {
17811            startCode,
17812            endCode,
17813            idDelta,
17814            idRangeOffset,
17815            glyphIDs
17816          };
17817        };
17818        return [...new Array(this.segCount)].map(build);
17819      }
17820      reverse(glyphID) {
17821        let s2 = this.segments.find((v2) => v2.glyphIDs.includes(glyphID));
17822        if (!s2) return {};
17823        const code = s2.startCode + s2.glyphIDs.indexOf(glyphID);
17824        return { code, unicode: String.fromCodePoint(code) };
17825      }
17826      getGlyphId(charCode) {
17827        if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
17828        if (55296 <= charCode && charCode <= 57343) return 0;
17829        if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535)
17830          return 0;
17831        let segment = this.segments.find(
17832          (s2) => s2.startCode <= charCode && charCode <= s2.endCode
17833        );
17834        if (!segment) return 0;
17835        return segment.glyphIDs[charCode - segment.startCode];
17836      }
17837      supports(charCode) {
17838        return this.getGlyphId(charCode) !== 0;
17839      }
17840      getSupportedCharCodes(preservePropNames = false) {
17841        if (preservePropNames) return this.segments;
17842        return this.segments.map((v2) => ({
17843          start: v2.startCode,
17844          end: v2.endCode
17845        }));
17846      }
17847    };
17848    var Format6 = class extends Subtable {
17849      constructor(p22, platformID, encodingID) {
17850        super(p22, platformID, encodingID);
17851        this.format = 6;
17852        this.length = p22.uint16;
17853        this.language = p22.uint16;
17854        this.firstCode = p22.uint16;
17855        this.entryCount = p22.uint16;
17856        this.lastCode = this.firstCode + this.entryCount - 1;
17857        const getter = () => [...new Array(this.entryCount)].map((_) => p22.uint16);
17858        lazy$1(this, `glyphIdArray`, getter);
17859      }
17860      supports(charCode) {
17861        if (charCode.charCodeAt) {
17862          charCode = -1;
17863          console.warn(
17864            `supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.`
17865          );
17866        }
17867        if (charCode < this.firstCode) return {};
17868        if (charCode > this.firstCode + this.entryCount) return {};
17869        const code = charCode - this.firstCode;
17870        return { code, unicode: String.fromCodePoint(code) };
17871      }
17872      reverse(glyphID) {
17873        let pos = this.glyphIdArray.indexOf(glyphID);
17874        if (pos > -1) return this.firstCode + pos;
17875      }
17876      getSupportedCharCodes(preservePropNames = false) {
17877        if (preservePropNames) {
17878          return [{ firstCode: this.firstCode, lastCode: this.lastCode }];
17879        }
17880        return [{ start: this.firstCode, end: this.lastCode }];
17881      }
17882    };
17883    var Format8 = class extends Subtable {
17884      constructor(p22, platformID, encodingID) {
17885        super(p22, platformID, encodingID);
17886        this.format = 8;
17887        p22.uint16;
17888        this.length = p22.uint32;
17889        this.language = p22.uint32;
17890        this.is32 = [...new Array(8192)].map((_) => p22.uint8);
17891        this.numGroups = p22.uint32;
17892        const getter = () => [...new Array(this.numGroups)].map(
17893          (_) => new SequentialMapGroup$1(p22)
17894        );
17895        lazy$1(this, `groups`, getter);
17896      }
17897      supports(charCode) {
17898        if (charCode.charCodeAt) {
17899          charCode = -1;
17900          console.warn(
17901            `supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.`
17902          );
17903        }
17904        return this.groups.findIndex(
17905          (s2) => s2.startcharCode <= charCode && charCode <= s2.endcharCode
17906        ) !== -1;
17907      }
17908      reverse(glyphID) {
17909        console.warn(`reverse not implemented for cmap subtable format 8`);
17910        return {};
17911      }
17912      getSupportedCharCodes(preservePropNames = false) {
17913        if (preservePropNames) return this.groups;
17914        return this.groups.map((v2) => ({
17915          start: v2.startcharCode,
17916          end: v2.endcharCode
17917        }));
17918      }
17919    };
17920    var SequentialMapGroup$1 = class {
17921      constructor(p22) {
17922        this.startcharCode = p22.uint32;
17923        this.endcharCode = p22.uint32;
17924        this.startGlyphID = p22.uint32;
17925      }
17926    };
17927    var Format10 = class extends Subtable {
17928      constructor(p22, platformID, encodingID) {
17929        super(p22, platformID, encodingID);
17930        this.format = 10;
17931        p22.uint16;
17932        this.length = p22.uint32;
17933        this.language = p22.uint32;
17934        this.startCharCode = p22.uint32;
17935        this.numChars = p22.uint32;
17936        this.endCharCode = this.startCharCode + this.numChars;
17937        const getter = () => [...new Array(this.numChars)].map((_) => p22.uint16);
17938        lazy$1(this, `glyphs`, getter);
17939      }
17940      supports(charCode) {
17941        if (charCode.charCodeAt) {
17942          charCode = -1;
17943          console.warn(
17944            `supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.`
17945          );
17946        }
17947        if (charCode < this.startCharCode) return false;
17948        if (charCode > this.startCharCode + this.numChars) return false;
17949        return charCode - this.startCharCode;
17950      }
17951      reverse(glyphID) {
17952        console.warn(`reverse not implemented for cmap subtable format 10`);
17953        return {};
17954      }
17955      getSupportedCharCodes(preservePropNames = false) {
17956        if (preservePropNames) {
17957          return [
17958            {
17959              startCharCode: this.startCharCode,
17960              endCharCode: this.endCharCode
17961            }
17962          ];
17963        }
17964        return [{ start: this.startCharCode, end: this.endCharCode }];
17965      }
17966    };
17967    var Format12 = class extends Subtable {
17968      constructor(p22, platformID, encodingID) {
17969        super(p22, platformID, encodingID);
17970        this.format = 12;
17971        p22.uint16;
17972        this.length = p22.uint32;
17973        this.language = p22.uint32;
17974        this.numGroups = p22.uint32;
17975        const getter = () => [...new Array(this.numGroups)].map(
17976          (_) => new SequentialMapGroup(p22)
17977        );
17978        lazy$1(this, `groups`, getter);
17979      }
17980      supports(charCode) {
17981        if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
17982        if (55296 <= charCode && charCode <= 57343) return 0;
17983        if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535)
17984          return 0;
17985        return this.groups.findIndex(
17986          (s2) => s2.startCharCode <= charCode && charCode <= s2.endCharCode
17987        ) !== -1;
17988      }
17989      reverse(glyphID) {
17990        for (let group of this.groups) {
17991          let start2 = group.startGlyphID;
17992          if (start2 > glyphID) continue;
17993          if (start2 === glyphID) return group.startCharCode;
17994          let end = start2 + (group.endCharCode - group.startCharCode);
17995          if (end < glyphID) continue;
17996          const code = group.startCharCode + (glyphID - start2);
17997          return { code, unicode: String.fromCodePoint(code) };
17998        }
17999        return {};
18000      }
18001      getSupportedCharCodes(preservePropNames = false) {
18002        if (preservePropNames) return this.groups;
18003        return this.groups.map((v2) => ({
18004          start: v2.startCharCode,
18005          end: v2.endCharCode
18006        }));
18007      }
18008    };
18009    var SequentialMapGroup = class {
18010      constructor(p22) {
18011        this.startCharCode = p22.uint32;
18012        this.endCharCode = p22.uint32;
18013        this.startGlyphID = p22.uint32;
18014      }
18015    };
18016    var Format13 = class extends Subtable {
18017      constructor(p22, platformID, encodingID) {
18018        super(p22, platformID, encodingID);
18019        this.format = 13;
18020        p22.uint16;
18021        this.length = p22.uint32;
18022        this.language = p22.uint32;
18023        this.numGroups = p22.uint32;
18024        const getter = [...new Array(this.numGroups)].map(
18025          (_) => new ConstantMapGroup(p22)
18026        );
18027        lazy$1(this, `groups`, getter);
18028      }
18029      supports(charCode) {
18030        if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
18031        return this.groups.findIndex(
18032          (s2) => s2.startCharCode <= charCode && charCode <= s2.endCharCode
18033        ) !== -1;
18034      }
18035      reverse(glyphID) {
18036        console.warn(`reverse not implemented for cmap subtable format 13`);
18037        return {};
18038      }
18039      getSupportedCharCodes(preservePropNames = false) {
18040        if (preservePropNames) return this.groups;
18041        return this.groups.map((v2) => ({
18042          start: v2.startCharCode,
18043          end: v2.endCharCode
18044        }));
18045      }
18046    };
18047    var ConstantMapGroup = class {
18048      constructor(p22) {
18049        this.startCharCode = p22.uint32;
18050        this.endCharCode = p22.uint32;
18051        this.glyphID = p22.uint32;
18052      }
18053    };
18054    var Format14 = class extends Subtable {
18055      constructor(p22, platformID, encodingID) {
18056        super(p22, platformID, encodingID);
18057        this.subTableStart = p22.currentPosition;
18058        this.format = 14;
18059        this.length = p22.uint32;
18060        this.numVarSelectorRecords = p22.uint32;
18061        lazy$1(
18062          this,
18063          `varSelectors`,
18064          () => [...new Array(this.numVarSelectorRecords)].map(
18065            (_) => new VariationSelector(p22)
18066          )
18067        );
18068      }
18069      supports() {
18070        console.warn(`supports not implemented for cmap subtable format 14`);
18071        return 0;
18072      }
18073      getSupportedCharCodes() {
18074        console.warn(
18075          `getSupportedCharCodes not implemented for cmap subtable format 14`
18076        );
18077        return [];
18078      }
18079      reverse(glyphID) {
18080        console.warn(`reverse not implemented for cmap subtable format 14`);
18081        return {};
18082      }
18083      supportsVariation(variation) {
18084        let v2 = this.varSelector.find(
18085          (uvs) => uvs.varSelector === variation
18086        );
18087        return v2 ? v2 : false;
18088      }
18089      getSupportedVariations() {
18090        return this.varSelectors.map((v2) => v2.varSelector);
18091      }
18092    };
18093    var VariationSelector = class {
18094      constructor(p22) {
18095        this.varSelector = p22.uint24;
18096        this.defaultUVSOffset = p22.Offset32;
18097        this.nonDefaultUVSOffset = p22.Offset32;
18098      }
18099    };
18100    function createSubTable(parser, platformID, encodingID) {
18101      const format6 = parser.uint16;
18102      if (format6 === 0) return new Format0(parser, platformID, encodingID);
18103      if (format6 === 2) return new Format2(parser, platformID, encodingID);
18104      if (format6 === 4) return new Format4(parser, platformID, encodingID);
18105      if (format6 === 6) return new Format6(parser, platformID, encodingID);
18106      if (format6 === 8) return new Format8(parser, platformID, encodingID);
18107      if (format6 === 10) return new Format10(parser, platformID, encodingID);
18108      if (format6 === 12) return new Format12(parser, platformID, encodingID);
18109      if (format6 === 13) return new Format13(parser, platformID, encodingID);
18110      if (format6 === 14) return new Format14(parser, platformID, encodingID);
18111      return {};
18112    }
18113    var cmap = class extends SimpleTable {
18114      constructor(dict, dataview) {
18115        const { p: p22 } = super(dict, dataview);
18116        this.version = p22.uint16;
18117        this.numTables = p22.uint16;
18118        this.encodingRecords = [...new Array(this.numTables)].map(
18119          (_) => new EncodingRecord(p22, this.tableStart)
18120        );
18121      }
18122      getSubTable(tableID) {
18123        return this.encodingRecords[tableID].table;
18124      }
18125      getSupportedEncodings() {
18126        return this.encodingRecords.map((r3) => ({
18127          platformID: r3.platformID,
18128          encodingId: r3.encodingID
18129        }));
18130      }
18131      getSupportedCharCodes(platformID, encodingID) {
18132        const recordID = this.encodingRecords.findIndex(
18133          (r3) => r3.platformID === platformID && r3.encodingID === encodingID
18134        );
18135        if (recordID === -1) return false;
18136        const subtable = this.getSubTable(recordID);
18137        return subtable.getSupportedCharCodes();
18138      }
18139      reverse(glyphid) {
18140        for (let i2 = 0; i2 < this.numTables; i2++) {
18141          let code = this.getSubTable(i2).reverse(glyphid);
18142          if (code) return code;
18143        }
18144      }
18145      getGlyphId(char) {
18146        let last = 0;
18147        this.encodingRecords.some((_, tableID) => {
18148          let t3 = this.getSubTable(tableID);
18149          if (!t3.getGlyphId) return false;
18150          last = t3.getGlyphId(char);
18151          return last !== 0;
18152        });
18153        return last;
18154      }
18155      supports(char) {
18156        return this.encodingRecords.some((_, tableID) => {
18157          const t3 = this.getSubTable(tableID);
18158          return t3.supports && t3.supports(char) !== false;
18159        });
18160      }
18161      supportsVariation(variation) {
18162        return this.encodingRecords.some((_, tableID) => {
18163          const t3 = this.getSubTable(tableID);
18164          return t3.supportsVariation && t3.supportsVariation(variation) !== false;
18165        });
18166      }
18167    };
18168    var EncodingRecord = class {
18169      constructor(p22, tableStart) {
18170        const platformID = this.platformID = p22.uint16;
18171        const encodingID = this.encodingID = p22.uint16;
18172        const offset = this.offset = p22.Offset32;
18173        lazy$1(this, `table`, () => {
18174          p22.currentPosition = tableStart + offset;
18175          return createSubTable(p22, platformID, encodingID);
18176        });
18177      }
18178    };
18179    var cmap$1 = Object.freeze({ __proto__: null, cmap });
18180    var head = class extends SimpleTable {
18181      constructor(dict, dataview) {
18182        const { p: p22 } = super(dict, dataview);
18183        this.load({
18184          majorVersion: p22.uint16,
18185          minorVersion: p22.uint16,
18186          fontRevision: p22.fixed,
18187          checkSumAdjustment: p22.uint32,
18188          magicNumber: p22.uint32,
18189          flags: p22.flags(16),
18190          unitsPerEm: p22.uint16,
18191          created: p22.longdatetime,
18192          modified: p22.longdatetime,
18193          xMin: p22.int16,
18194          yMin: p22.int16,
18195          xMax: p22.int16,
18196          yMax: p22.int16,
18197          macStyle: p22.flags(16),
18198          lowestRecPPEM: p22.uint16,
18199          fontDirectionHint: p22.uint16,
18200          indexToLocFormat: p22.uint16,
18201          glyphDataFormat: p22.uint16
18202        });
18203      }
18204    };
18205    var head$1 = Object.freeze({ __proto__: null, head });
18206    var hhea = class extends SimpleTable {
18207      constructor(dict, dataview) {
18208        const { p: p22 } = super(dict, dataview);
18209        this.majorVersion = p22.uint16;
18210        this.minorVersion = p22.uint16;
18211        this.ascender = p22.fword;
18212        this.descender = p22.fword;
18213        this.lineGap = p22.fword;
18214        this.advanceWidthMax = p22.ufword;
18215        this.minLeftSideBearing = p22.fword;
18216        this.minRightSideBearing = p22.fword;
18217        this.xMaxExtent = p22.fword;
18218        this.caretSlopeRise = p22.int16;
18219        this.caretSlopeRun = p22.int16;
18220        this.caretOffset = p22.int16;
18221        p22.int16;
18222        p22.int16;
18223        p22.int16;
18224        p22.int16;
18225        this.metricDataFormat = p22.int16;
18226        this.numberOfHMetrics = p22.uint16;
18227        p22.verifyLength();
18228      }
18229    };
18230    var hhea$1 = Object.freeze({ __proto__: null, hhea });
18231    var hmtx = class extends SimpleTable {
18232      constructor(dict, dataview, tables) {
18233        const { p: p22 } = super(dict, dataview);
18234        const numberOfHMetrics = tables.hhea.numberOfHMetrics;
18235        const numGlyphs = tables.maxp.numGlyphs;
18236        const metricsStart = p22.currentPosition;
18237        lazy$1(this, `hMetrics`, () => {
18238          p22.currentPosition = metricsStart;
18239          return [...new Array(numberOfHMetrics)].map(
18240            (_) => new LongHorMetric(p22.uint16, p22.int16)
18241          );
18242        });
18243        if (numberOfHMetrics < numGlyphs) {
18244          const lsbStart = metricsStart + numberOfHMetrics * 4;
18245          lazy$1(this, `leftSideBearings`, () => {
18246            p22.currentPosition = lsbStart;
18247            return [...new Array(numGlyphs - numberOfHMetrics)].map(
18248              (_) => p22.int16
18249            );
18250          });
18251        }
18252      }
18253    };
18254    var LongHorMetric = class {
18255      constructor(w2, b2) {
18256        this.advanceWidth = w2;
18257        this.lsb = b2;
18258      }
18259    };
18260    var hmtx$1 = Object.freeze({ __proto__: null, hmtx });
18261    var maxp = class extends SimpleTable {
18262      constructor(dict, dataview) {
18263        const { p: p22 } = super(dict, dataview);
18264        this.version = p22.legacyFixed;
18265        this.numGlyphs = p22.uint16;
18266        if (this.version === 1) {
18267          this.maxPoints = p22.uint16;
18268          this.maxContours = p22.uint16;
18269          this.maxCompositePoints = p22.uint16;
18270          this.maxCompositeContours = p22.uint16;
18271          this.maxZones = p22.uint16;
18272          this.maxTwilightPoints = p22.uint16;
18273          this.maxStorage = p22.uint16;
18274          this.maxFunctionDefs = p22.uint16;
18275          this.maxInstructionDefs = p22.uint16;
18276          this.maxStackElements = p22.uint16;
18277          this.maxSizeOfInstructions = p22.uint16;
18278          this.maxComponentElements = p22.uint16;
18279          this.maxComponentDepth = p22.uint16;
18280        }
18281        p22.verifyLength();
18282      }
18283    };
18284    var maxp$1 = Object.freeze({ __proto__: null, maxp });
18285    var name = class extends SimpleTable {
18286      constructor(dict, dataview) {
18287        const { p: p22 } = super(dict, dataview);
18288        this.format = p22.uint16;
18289        this.count = p22.uint16;
18290        this.stringOffset = p22.Offset16;
18291        this.nameRecords = [...new Array(this.count)].map(
18292          (_) => new NameRecord(p22, this)
18293        );
18294        if (this.format === 1) {
18295          this.langTagCount = p22.uint16;
18296          this.langTagRecords = [...new Array(this.langTagCount)].map(
18297            (_) => new LangTagRecord(p22.uint16, p22.Offset16)
18298          );
18299        }
18300        this.stringStart = this.tableStart + this.stringOffset;
18301      }
18302      get(nameID) {
18303        let record = this.nameRecords.find(
18304          (record2) => record2.nameID === nameID
18305        );
18306        if (record) return record.string;
18307      }
18308    };
18309    var LangTagRecord = class {
18310      constructor(length, offset) {
18311        this.length = length;
18312        this.offset = offset;
18313      }
18314    };
18315    var NameRecord = class {
18316      constructor(p22, nameTable) {
18317        this.platformID = p22.uint16;
18318        this.encodingID = p22.uint16;
18319        this.languageID = p22.uint16;
18320        this.nameID = p22.uint16;
18321        this.length = p22.uint16;
18322        this.offset = p22.Offset16;
18323        lazy$1(this, `string`, () => {
18324          p22.currentPosition = nameTable.stringStart + this.offset;
18325          return decodeString(p22, this);
18326        });
18327      }
18328    };
18329    function decodeString(p22, record) {
18330      const { platformID, length } = record;
18331      if (length === 0) return ``;
18332      if (platformID === 0 || platformID === 3) {
18333        const str2 = [];
18334        for (let i2 = 0, e2 = length / 2; i2 < e2; i2++)
18335          str2[i2] = String.fromCharCode(p22.uint16);
18336        return str2.join(``);
18337      }
18338      const bytes = p22.readBytes(length);
18339      const str = [];
18340      bytes.forEach(function(b2, i2) {
18341        str[i2] = String.fromCharCode(b2);
18342      });
18343      return str.join(``);
18344    }
18345    var name$1 = Object.freeze({ __proto__: null, name });
18346    var OS2 = class extends SimpleTable {
18347      constructor(dict, dataview) {
18348        const { p: p22 } = super(dict, dataview);
18349        this.version = p22.uint16;
18350        this.xAvgCharWidth = p22.int16;
18351        this.usWeightClass = p22.uint16;
18352        this.usWidthClass = p22.uint16;
18353        this.fsType = p22.uint16;
18354        this.ySubscriptXSize = p22.int16;
18355        this.ySubscriptYSize = p22.int16;
18356        this.ySubscriptXOffset = p22.int16;
18357        this.ySubscriptYOffset = p22.int16;
18358        this.ySuperscriptXSize = p22.int16;
18359        this.ySuperscriptYSize = p22.int16;
18360        this.ySuperscriptXOffset = p22.int16;
18361        this.ySuperscriptYOffset = p22.int16;
18362        this.yStrikeoutSize = p22.int16;
18363        this.yStrikeoutPosition = p22.int16;
18364        this.sFamilyClass = p22.int16;
18365        this.panose = [...new Array(10)].map((_) => p22.uint8);
18366        this.ulUnicodeRange1 = p22.flags(32);
18367        this.ulUnicodeRange2 = p22.flags(32);
18368        this.ulUnicodeRange3 = p22.flags(32);
18369        this.ulUnicodeRange4 = p22.flags(32);
18370        this.achVendID = p22.tag;
18371        this.fsSelection = p22.uint16;
18372        this.usFirstCharIndex = p22.uint16;
18373        this.usLastCharIndex = p22.uint16;
18374        this.sTypoAscender = p22.int16;
18375        this.sTypoDescender = p22.int16;
18376        this.sTypoLineGap = p22.int16;
18377        this.usWinAscent = p22.uint16;
18378        this.usWinDescent = p22.uint16;
18379        if (this.version === 0) return p22.verifyLength();
18380        this.ulCodePageRange1 = p22.flags(32);
18381        this.ulCodePageRange2 = p22.flags(32);
18382        if (this.version === 1) return p22.verifyLength();
18383        this.sxHeight = p22.int16;
18384        this.sCapHeight = p22.int16;
18385        this.usDefaultChar = p22.uint16;
18386        this.usBreakChar = p22.uint16;
18387        this.usMaxContext = p22.uint16;
18388        if (this.version <= 4) return p22.verifyLength();
18389        this.usLowerOpticalPointSize = p22.uint16;
18390        this.usUpperOpticalPointSize = p22.uint16;
18391        if (this.version === 5) return p22.verifyLength();
18392      }
18393    };
18394    var OS2$1 = Object.freeze({ __proto__: null, OS2 });
18395    var post = class extends SimpleTable {
18396      constructor(dict, dataview) {
18397        const { p: p22 } = super(dict, dataview);
18398        this.version = p22.legacyFixed;
18399        this.italicAngle = p22.fixed;
18400        this.underlinePosition = p22.fword;
18401        this.underlineThickness = p22.fword;
18402        this.isFixedPitch = p22.uint32;
18403        this.minMemType42 = p22.uint32;
18404        this.maxMemType42 = p22.uint32;
18405        this.minMemType1 = p22.uint32;
18406        this.maxMemType1 = p22.uint32;
18407        if (this.version === 1 || this.version === 3) return p22.verifyLength();
18408        this.numGlyphs = p22.uint16;
18409        if (this.version === 2) {
18410          this.glyphNameIndex = [...new Array(this.numGlyphs)].map(
18411            (_) => p22.uint16
18412          );
18413          this.namesOffset = p22.currentPosition;
18414          this.glyphNameOffsets = [1];
18415          for (let i2 = 0; i2 < this.numGlyphs; i2++) {
18416            let index = this.glyphNameIndex[i2];
18417            if (index < macStrings.length) {
18418              this.glyphNameOffsets.push(this.glyphNameOffsets[i2]);
18419              continue;
18420            }
18421            let bytelength = p22.int8;
18422            p22.skip(bytelength);
18423            this.glyphNameOffsets.push(
18424              this.glyphNameOffsets[i2] + bytelength + 1
18425            );
18426          }
18427        }
18428        if (this.version === 2.5) {
18429          this.offset = [...new Array(this.numGlyphs)].map(
18430            (_) => p22.int8
18431          );
18432        }
18433      }
18434      getGlyphName(glyphid) {
18435        if (this.version !== 2) {
18436          console.warn(
18437            `post table version $this.version} does not support glyph name lookups`
18438          );
18439          return ``;
18440        }
18441        let index = this.glyphNameIndex[glyphid];
18442        if (index < 258) return macStrings[index];
18443        let offset = this.glyphNameOffsets[glyphid];
18444        let next = this.glyphNameOffsets[glyphid + 1];
18445        let len = next - offset - 1;
18446        if (len === 0) return `.notdef.`;
18447        this.parser.currentPosition = this.namesOffset + offset;
18448        const data = this.parser.readBytes(
18449          len,
18450          this.namesOffset + offset,
18451          8,
18452          true
18453        );
18454        return data.map((b2) => String.fromCharCode(b2)).join(``);
18455      }
18456    };
18457    var macStrings = [
18458      `.notdef`,
18459      `.null`,
18460      `nonmarkingreturn`,
18461      `space`,
18462      `exclam`,
18463      `quotedbl`,
18464      `numbersign`,
18465      `dollar`,
18466      `percent`,
18467      `ampersand`,
18468      `quotesingle`,
18469      `parenleft`,
18470      `parenright`,
18471      `asterisk`,
18472      `plus`,
18473      `comma`,
18474      `hyphen`,
18475      `period`,
18476      `slash`,
18477      `zero`,
18478      `one`,
18479      `two`,
18480      `three`,
18481      `four`,
18482      `five`,
18483      `six`,
18484      `seven`,
18485      `eight`,
18486      `nine`,
18487      `colon`,
18488      `semicolon`,
18489      `less`,
18490      `equal`,
18491      `greater`,
18492      `question`,
18493      `at`,
18494      `A`,
18495      `B`,
18496      `C`,
18497      `D`,
18498      `E`,
18499      `F`,
18500      `G`,
18501      `H`,
18502      `I`,
18503      `J`,
18504      `K`,
18505      `L`,
18506      `M`,
18507      `N`,
18508      `O`,
18509      `P`,
18510      `Q`,
18511      `R`,
18512      `S`,
18513      `T`,
18514      `U`,
18515      `V`,
18516      `W`,
18517      `X`,
18518      `Y`,
18519      `Z`,
18520      `bracketleft`,
18521      `backslash`,
18522      `bracketright`,
18523      `asciicircum`,
18524      `underscore`,
18525      `grave`,
18526      `a`,
18527      `b`,
18528      `c`,
18529      `d`,
18530      `e`,
18531      `f`,
18532      `g`,
18533      `h`,
18534      `i`,
18535      `j`,
18536      `k`,
18537      `l`,
18538      `m`,
18539      `n`,
18540      `o`,
18541      `p`,
18542      `q`,
18543      `r`,
18544      `s`,
18545      `t`,
18546      `u`,
18547      `v`,
18548      `w`,
18549      `x`,
18550      `y`,
18551      `z`,
18552      `braceleft`,
18553      `bar`,
18554      `braceright`,
18555      `asciitilde`,
18556      `Adieresis`,
18557      `Aring`,
18558      `Ccedilla`,
18559      `Eacute`,
18560      `Ntilde`,
18561      `Odieresis`,
18562      `Udieresis`,
18563      `aacute`,
18564      `agrave`,
18565      `acircumflex`,
18566      `adieresis`,
18567      `atilde`,
18568      `aring`,
18569      `ccedilla`,
18570      `eacute`,
18571      `egrave`,
18572      `ecircumflex`,
18573      `edieresis`,
18574      `iacute`,
18575      `igrave`,
18576      `icircumflex`,
18577      `idieresis`,
18578      `ntilde`,
18579      `oacute`,
18580      `ograve`,
18581      `ocircumflex`,
18582      `odieresis`,
18583      `otilde`,
18584      `uacute`,
18585      `ugrave`,
18586      `ucircumflex`,
18587      `udieresis`,
18588      `dagger`,
18589      `degree`,
18590      `cent`,
18591      `sterling`,
18592      `section`,
18593      `bullet`,
18594      `paragraph`,
18595      `germandbls`,
18596      `registered`,
18597      `copyright`,
18598      `trademark`,
18599      `acute`,
18600      `dieresis`,
18601      `notequal`,
18602      `AE`,
18603      `Oslash`,
18604      `infinity`,
18605      `plusminus`,
18606      `lessequal`,
18607      `greaterequal`,
18608      `yen`,
18609      `mu`,
18610      `partialdiff`,
18611      `summation`,
18612      `product`,
18613      `pi`,
18614      `integral`,
18615      `ordfeminine`,
18616      `ordmasculine`,
18617      `Omega`,
18618      `ae`,
18619      `oslash`,
18620      `questiondown`,
18621      `exclamdown`,
18622      `logicalnot`,
18623      `radical`,
18624      `florin`,
18625      `approxequal`,
18626      `Delta`,
18627      `guillemotleft`,
18628      `guillemotright`,
18629      `ellipsis`,
18630      `nonbreakingspace`,
18631      `Agrave`,
18632      `Atilde`,
18633      `Otilde`,
18634      `OE`,
18635      `oe`,
18636      `endash`,
18637      `emdash`,
18638      `quotedblleft`,
18639      `quotedblright`,
18640      `quoteleft`,
18641      `quoteright`,
18642      `divide`,
18643      `lozenge`,
18644      `ydieresis`,
18645      `Ydieresis`,
18646      `fraction`,
18647      `currency`,
18648      `guilsinglleft`,
18649      `guilsinglright`,
18650      `fi`,
18651      `fl`,
18652      `daggerdbl`,
18653      `periodcentered`,
18654      `quotesinglbase`,
18655      `quotedblbase`,
18656      `perthousand`,
18657      `Acircumflex`,
18658      `Ecircumflex`,
18659      `Aacute`,
18660      `Edieresis`,
18661      `Egrave`,
18662      `Iacute`,
18663      `Icircumflex`,
18664      `Idieresis`,
18665      `Igrave`,
18666      `Oacute`,
18667      `Ocircumflex`,
18668      `apple`,
18669      `Ograve`,
18670      `Uacute`,
18671      `Ucircumflex`,
18672      `Ugrave`,
18673      `dotlessi`,
18674      `circumflex`,
18675      `tilde`,
18676      `macron`,
18677      `breve`,
18678      `dotaccent`,
18679      `ring`,
18680      `cedilla`,
18681      `hungarumlaut`,
18682      `ogonek`,
18683      `caron`,
18684      `Lslash`,
18685      `lslash`,
18686      `Scaron`,
18687      `scaron`,
18688      `Zcaron`,
18689      `zcaron`,
18690      `brokenbar`,
18691      `Eth`,
18692      `eth`,
18693      `Yacute`,
18694      `yacute`,
18695      `Thorn`,
18696      `thorn`,
18697      `minus`,
18698      `multiply`,
18699      `onesuperior`,
18700      `twosuperior`,
18701      `threesuperior`,
18702      `onehalf`,
18703      `onequarter`,
18704      `threequarters`,
18705      `franc`,
18706      `Gbreve`,
18707      `gbreve`,
18708      `Idotaccent`,
18709      `Scedilla`,
18710      `scedilla`,
18711      `Cacute`,
18712      `cacute`,
18713      `Ccaron`,
18714      `ccaron`,
18715      `dcroat`
18716    ];
18717    var post$1 = Object.freeze({ __proto__: null, post });
18718    var BASE = class extends SimpleTable {
18719      constructor(dict, dataview) {
18720        const { p: p22 } = super(dict, dataview);
18721        this.majorVersion = p22.uint16;
18722        this.minorVersion = p22.uint16;
18723        this.horizAxisOffset = p22.Offset16;
18724        this.vertAxisOffset = p22.Offset16;
18725        lazy$1(
18726          this,
18727          `horizAxis`,
18728          () => new AxisTable(
18729            { offset: dict.offset + this.horizAxisOffset },
18730            dataview
18731          )
18732        );
18733        lazy$1(
18734          this,
18735          `vertAxis`,
18736          () => new AxisTable(
18737            { offset: dict.offset + this.vertAxisOffset },
18738            dataview
18739          )
18740        );
18741        if (this.majorVersion === 1 && this.minorVersion === 1) {
18742          this.itemVarStoreOffset = p22.Offset32;
18743          lazy$1(
18744            this,
18745            `itemVarStore`,
18746            () => new AxisTable(
18747              { offset: dict.offset + this.itemVarStoreOffset },
18748              dataview
18749            )
18750          );
18751        }
18752      }
18753    };
18754    var AxisTable = class extends SimpleTable {
18755      constructor(dict, dataview) {
18756        const { p: p22 } = super(dict, dataview, `AxisTable`);
18757        this.baseTagListOffset = p22.Offset16;
18758        this.baseScriptListOffset = p22.Offset16;
18759        lazy$1(
18760          this,
18761          `baseTagList`,
18762          () => new BaseTagListTable(
18763            { offset: dict.offset + this.baseTagListOffset },
18764            dataview
18765          )
18766        );
18767        lazy$1(
18768          this,
18769          `baseScriptList`,
18770          () => new BaseScriptListTable(
18771            { offset: dict.offset + this.baseScriptListOffset },
18772            dataview
18773          )
18774        );
18775      }
18776    };
18777    var BaseTagListTable = class extends SimpleTable {
18778      constructor(dict, dataview) {
18779        const { p: p22 } = super(dict, dataview, `BaseTagListTable`);
18780        this.baseTagCount = p22.uint16;
18781        this.baselineTags = [...new Array(this.baseTagCount)].map(
18782          (_) => p22.tag
18783        );
18784      }
18785    };
18786    var BaseScriptListTable = class extends SimpleTable {
18787      constructor(dict, dataview) {
18788        const { p: p22 } = super(dict, dataview, `BaseScriptListTable`);
18789        this.baseScriptCount = p22.uint16;
18790        const recordStart = p22.currentPosition;
18791        lazy$1(this, `baseScriptRecords`, () => {
18792          p22.currentPosition = recordStart;
18793          return [...new Array(this.baseScriptCount)].map(
18794            (_) => new BaseScriptRecord(this.start, p22)
18795          );
18796        });
18797      }
18798    };
18799    var BaseScriptRecord = class {
18800      constructor(baseScriptListTableStart, p22) {
18801        this.baseScriptTag = p22.tag;
18802        this.baseScriptOffset = p22.Offset16;
18803        lazy$1(this, `baseScriptTable`, () => {
18804          p22.currentPosition = baseScriptListTableStart + this.baseScriptOffset;
18805          return new BaseScriptTable(p22);
18806        });
18807      }
18808    };
18809    var BaseScriptTable = class {
18810      constructor(p22) {
18811        this.start = p22.currentPosition;
18812        this.baseValuesOffset = p22.Offset16;
18813        this.defaultMinMaxOffset = p22.Offset16;
18814        this.baseLangSysCount = p22.uint16;
18815        this.baseLangSysRecords = [...new Array(this.baseLangSysCount)].map(
18816          (_) => new BaseLangSysRecord(this.start, p22)
18817        );
18818        lazy$1(this, `baseValues`, () => {
18819          p22.currentPosition = this.start + this.baseValuesOffset;
18820          return new BaseValuesTable(p22);
18821        });
18822        lazy$1(this, `defaultMinMax`, () => {
18823          p22.currentPosition = this.start + this.defaultMinMaxOffset;
18824          return new MinMaxTable(p22);
18825        });
18826      }
18827    };
18828    var BaseLangSysRecord = class {
18829      constructor(baseScriptTableStart, p22) {
18830        this.baseLangSysTag = p22.tag;
18831        this.minMaxOffset = p22.Offset16;
18832        lazy$1(this, `minMax`, () => {
18833          p22.currentPosition = baseScriptTableStart + this.minMaxOffset;
18834          return new MinMaxTable(p22);
18835        });
18836      }
18837    };
18838    var BaseValuesTable = class {
18839      constructor(p22) {
18840        this.parser = p22;
18841        this.start = p22.currentPosition;
18842        this.defaultBaselineIndex = p22.uint16;
18843        this.baseCoordCount = p22.uint16;
18844        this.baseCoords = [...new Array(this.baseCoordCount)].map(
18845          (_) => p22.Offset16
18846        );
18847      }
18848      getTable(id) {
18849        this.parser.currentPosition = this.start + this.baseCoords[id];
18850        return new BaseCoordTable(this.parser);
18851      }
18852    };
18853    var MinMaxTable = class {
18854      constructor(p22) {
18855        this.minCoord = p22.Offset16;
18856        this.maxCoord = p22.Offset16;
18857        this.featMinMaxCount = p22.uint16;
18858        const recordStart = p22.currentPosition;
18859        lazy$1(this, `featMinMaxRecords`, () => {
18860          p22.currentPosition = recordStart;
18861          return [...new Array(this.featMinMaxCount)].map(
18862            (_) => new FeatMinMaxRecord(p22)
18863          );
18864        });
18865      }
18866    };
18867    var FeatMinMaxRecord = class {
18868      constructor(p22) {
18869        this.featureTableTag = p22.tag;
18870        this.minCoord = p22.Offset16;
18871        this.maxCoord = p22.Offset16;
18872      }
18873    };
18874    var BaseCoordTable = class {
18875      constructor(p22) {
18876        this.baseCoordFormat = p22.uint16;
18877        this.coordinate = p22.int16;
18878        if (this.baseCoordFormat === 2) {
18879          this.referenceGlyph = p22.uint16;
18880          this.baseCoordPoint = p22.uint16;
18881        }
18882        if (this.baseCoordFormat === 3) {
18883          this.deviceTable = p22.Offset16;
18884        }
18885      }
18886    };
18887    var BASE$1 = Object.freeze({ __proto__: null, BASE });
18888    var ClassDefinition = class {
18889      constructor(p22) {
18890        this.classFormat = p22.uint16;
18891        if (this.classFormat === 1) {
18892          this.startGlyphID = p22.uint16;
18893          this.glyphCount = p22.uint16;
18894          this.classValueArray = [...new Array(this.glyphCount)].map(
18895            (_) => p22.uint16
18896          );
18897        }
18898        if (this.classFormat === 2) {
18899          this.classRangeCount = p22.uint16;
18900          this.classRangeRecords = [
18901            ...new Array(this.classRangeCount)
18902          ].map((_) => new ClassRangeRecord(p22));
18903        }
18904      }
18905    };
18906    var ClassRangeRecord = class {
18907      constructor(p22) {
18908        this.startGlyphID = p22.uint16;
18909        this.endGlyphID = p22.uint16;
18910        this.class = p22.uint16;
18911      }
18912    };
18913    var CoverageTable = class extends ParsedData {
18914      constructor(p22) {
18915        super(p22);
18916        this.coverageFormat = p22.uint16;
18917        if (this.coverageFormat === 1) {
18918          this.glyphCount = p22.uint16;
18919          this.glyphArray = [...new Array(this.glyphCount)].map(
18920            (_) => p22.uint16
18921          );
18922        }
18923        if (this.coverageFormat === 2) {
18924          this.rangeCount = p22.uint16;
18925          this.rangeRecords = [...new Array(this.rangeCount)].map(
18926            (_) => new CoverageRangeRecord(p22)
18927          );
18928        }
18929      }
18930    };
18931    var CoverageRangeRecord = class {
18932      constructor(p22) {
18933        this.startGlyphID = p22.uint16;
18934        this.endGlyphID = p22.uint16;
18935        this.startCoverageIndex = p22.uint16;
18936      }
18937    };
18938    var ItemVariationStoreTable = class {
18939      constructor(table, p22) {
18940        this.table = table;
18941        this.parser = p22;
18942        this.start = p22.currentPosition;
18943        this.format = p22.uint16;
18944        this.variationRegionListOffset = p22.Offset32;
18945        this.itemVariationDataCount = p22.uint16;
18946        this.itemVariationDataOffsets = [
18947          ...new Array(this.itemVariationDataCount)
18948        ].map((_) => p22.Offset32);
18949      }
18950    };
18951    var GDEF = class extends SimpleTable {
18952      constructor(dict, dataview) {
18953        const { p: p22 } = super(dict, dataview);
18954        this.majorVersion = p22.uint16;
18955        this.minorVersion = p22.uint16;
18956        this.glyphClassDefOffset = p22.Offset16;
18957        lazy$1(this, `glyphClassDefs`, () => {
18958          if (this.glyphClassDefOffset === 0) return void 0;
18959          p22.currentPosition = this.tableStart + this.glyphClassDefOffset;
18960          return new ClassDefinition(p22);
18961        });
18962        this.attachListOffset = p22.Offset16;
18963        lazy$1(this, `attachList`, () => {
18964          if (this.attachListOffset === 0) return void 0;
18965          p22.currentPosition = this.tableStart + this.attachListOffset;
18966          return new AttachList(p22);
18967        });
18968        this.ligCaretListOffset = p22.Offset16;
18969        lazy$1(this, `ligCaretList`, () => {
18970          if (this.ligCaretListOffset === 0) return void 0;
18971          p22.currentPosition = this.tableStart + this.ligCaretListOffset;
18972          return new LigCaretList(p22);
18973        });
18974        this.markAttachClassDefOffset = p22.Offset16;
18975        lazy$1(this, `markAttachClassDef`, () => {
18976          if (this.markAttachClassDefOffset === 0) return void 0;
18977          p22.currentPosition = this.tableStart + this.markAttachClassDefOffset;
18978          return new ClassDefinition(p22);
18979        });
18980        if (this.minorVersion >= 2) {
18981          this.markGlyphSetsDefOffset = p22.Offset16;
18982          lazy$1(this, `markGlyphSetsDef`, () => {
18983            if (this.markGlyphSetsDefOffset === 0) return void 0;
18984            p22.currentPosition = this.tableStart + this.markGlyphSetsDefOffset;
18985            return new MarkGlyphSetsTable(p22);
18986          });
18987        }
18988        if (this.minorVersion === 3) {
18989          this.itemVarStoreOffset = p22.Offset32;
18990          lazy$1(this, `itemVarStore`, () => {
18991            if (this.itemVarStoreOffset === 0) return void 0;
18992            p22.currentPosition = this.tableStart + this.itemVarStoreOffset;
18993            return new ItemVariationStoreTable(p22);
18994          });
18995        }
18996      }
18997    };
18998    var AttachList = class extends ParsedData {
18999      constructor(p22) {
19000        super(p22);
19001        this.coverageOffset = p22.Offset16;
19002        this.glyphCount = p22.uint16;
19003        this.attachPointOffsets = [...new Array(this.glyphCount)].map(
19004          (_) => p22.Offset16
19005        );
19006      }
19007      getPoint(pointID) {
19008        this.parser.currentPosition = this.start + this.attachPointOffsets[pointID];
19009        return new AttachPoint(this.parser);
19010      }
19011    };
19012    var AttachPoint = class {
19013      constructor(p22) {
19014        this.pointCount = p22.uint16;
19015        this.pointIndices = [...new Array(this.pointCount)].map(
19016          (_) => p22.uint16
19017        );
19018      }
19019    };
19020    var LigCaretList = class extends ParsedData {
19021      constructor(p22) {
19022        super(p22);
19023        this.coverageOffset = p22.Offset16;
19024        lazy$1(this, `coverage`, () => {
19025          p22.currentPosition = this.start + this.coverageOffset;
19026          return new CoverageTable(p22);
19027        });
19028        this.ligGlyphCount = p22.uint16;
19029        this.ligGlyphOffsets = [...new Array(this.ligGlyphCount)].map(
19030          (_) => p22.Offset16
19031        );
19032      }
19033      getLigGlyph(ligGlyphID) {
19034        this.parser.currentPosition = this.start + this.ligGlyphOffsets[ligGlyphID];
19035        return new LigGlyph(this.parser);
19036      }
19037    };
19038    var LigGlyph = class extends ParsedData {
19039      constructor(p22) {
19040        super(p22);
19041        this.caretCount = p22.uint16;
19042        this.caretValueOffsets = [...new Array(this.caretCount)].map(
19043          (_) => p22.Offset16
19044        );
19045      }
19046      getCaretValue(caretID) {
19047        this.parser.currentPosition = this.start + this.caretValueOffsets[caretID];
19048        return new CaretValue(this.parser);
19049      }
19050    };
19051    var CaretValue = class {
19052      constructor(p22) {
19053        this.caretValueFormat = p22.uint16;
19054        if (this.caretValueFormat === 1) {
19055          this.coordinate = p22.int16;
19056        }
19057        if (this.caretValueFormat === 2) {
19058          this.caretValuePointIndex = p22.uint16;
19059        }
19060        if (this.caretValueFormat === 3) {
19061          this.coordinate = p22.int16;
19062          this.deviceOffset = p22.Offset16;
19063        }
19064      }
19065    };
19066    var MarkGlyphSetsTable = class extends ParsedData {
19067      constructor(p22) {
19068        super(p22);
19069        this.markGlyphSetTableFormat = p22.uint16;
19070        this.markGlyphSetCount = p22.uint16;
19071        this.coverageOffsets = [...new Array(this.markGlyphSetCount)].map(
19072          (_) => p22.Offset32
19073        );
19074      }
19075      getMarkGlyphSet(markGlyphSetID) {
19076        this.parser.currentPosition = this.start + this.coverageOffsets[markGlyphSetID];
19077        return new CoverageTable(this.parser);
19078      }
19079    };
19080    var GDEF$1 = Object.freeze({ __proto__: null, GDEF });
19081    var ScriptList = class extends ParsedData {
19082      static EMPTY = { scriptCount: 0, scriptRecords: [] };
19083      constructor(p22) {
19084        super(p22);
19085        this.scriptCount = p22.uint16;
19086        this.scriptRecords = [...new Array(this.scriptCount)].map(
19087          (_) => new ScriptRecord(p22)
19088        );
19089      }
19090    };
19091    var ScriptRecord = class {
19092      constructor(p22) {
19093        this.scriptTag = p22.tag;
19094        this.scriptOffset = p22.Offset16;
19095      }
19096    };
19097    var ScriptTable = class extends ParsedData {
19098      constructor(p22) {
19099        super(p22);
19100        this.defaultLangSys = p22.Offset16;
19101        this.langSysCount = p22.uint16;
19102        this.langSysRecords = [...new Array(this.langSysCount)].map(
19103          (_) => new LangSysRecord(p22)
19104        );
19105      }
19106    };
19107    var LangSysRecord = class {
19108      constructor(p22) {
19109        this.langSysTag = p22.tag;
19110        this.langSysOffset = p22.Offset16;
19111      }
19112    };
19113    var LangSysTable = class {
19114      constructor(p22) {
19115        this.lookupOrder = p22.Offset16;
19116        this.requiredFeatureIndex = p22.uint16;
19117        this.featureIndexCount = p22.uint16;
19118        this.featureIndices = [...new Array(this.featureIndexCount)].map(
19119          (_) => p22.uint16
19120        );
19121      }
19122    };
19123    var FeatureList = class extends ParsedData {
19124      static EMPTY = { featureCount: 0, featureRecords: [] };
19125      constructor(p22) {
19126        super(p22);
19127        this.featureCount = p22.uint16;
19128        this.featureRecords = [...new Array(this.featureCount)].map(
19129          (_) => new FeatureRecord(p22)
19130        );
19131      }
19132    };
19133    var FeatureRecord = class {
19134      constructor(p22) {
19135        this.featureTag = p22.tag;
19136        this.featureOffset = p22.Offset16;
19137      }
19138    };
19139    var FeatureTable = class extends ParsedData {
19140      constructor(p22) {
19141        super(p22);
19142        this.featureParams = p22.Offset16;
19143        this.lookupIndexCount = p22.uint16;
19144        this.lookupListIndices = [...new Array(this.lookupIndexCount)].map(
19145          (_) => p22.uint16
19146        );
19147      }
19148      getFeatureParams() {
19149        if (this.featureParams > 0) {
19150          const p22 = this.parser;
19151          p22.currentPosition = this.start + this.featureParams;
19152          const tag = this.featureTag;
19153          if (tag === `size`) return new Size(p22);
19154          if (tag.startsWith(`cc`)) return new CharacterVariant(p22);
19155          if (tag.startsWith(`ss`)) return new StylisticSet(p22);
19156        }
19157      }
19158    };
19159    var CharacterVariant = class {
19160      constructor(p22) {
19161        this.format = p22.uint16;
19162        this.featUiLabelNameId = p22.uint16;
19163        this.featUiTooltipTextNameId = p22.uint16;
19164        this.sampleTextNameId = p22.uint16;
19165        this.numNamedParameters = p22.uint16;
19166        this.firstParamUiLabelNameId = p22.uint16;
19167        this.charCount = p22.uint16;
19168        this.character = [...new Array(this.charCount)].map(
19169          (_) => p22.uint24
19170        );
19171      }
19172    };
19173    var Size = class {
19174      constructor(p22) {
19175        this.designSize = p22.uint16;
19176        this.subfamilyIdentifier = p22.uint16;
19177        this.subfamilyNameID = p22.uint16;
19178        this.smallEnd = p22.uint16;
19179        this.largeEnd = p22.uint16;
19180      }
19181    };
19182    var StylisticSet = class {
19183      constructor(p22) {
19184        this.version = p22.uint16;
19185        this.UINameID = p22.uint16;
19186      }
19187    };
19188    function undoCoverageOffsetParsing(instance) {
19189      instance.parser.currentPosition -= 2;
19190      delete instance.coverageOffset;
19191      delete instance.getCoverageTable;
19192    }
19193    var LookupType$1 = class extends ParsedData {
19194      constructor(p22) {
19195        super(p22);
19196        this.substFormat = p22.uint16;
19197        this.coverageOffset = p22.Offset16;
19198      }
19199      getCoverageTable() {
19200        let p22 = this.parser;
19201        p22.currentPosition = this.start + this.coverageOffset;
19202        return new CoverageTable(p22);
19203      }
19204    };
19205    var SubstLookupRecord = class {
19206      constructor(p22) {
19207        this.glyphSequenceIndex = p22.uint16;
19208        this.lookupListIndex = p22.uint16;
19209      }
19210    };
19211    var LookupType1$1 = class extends LookupType$1 {
19212      constructor(p22) {
19213        super(p22);
19214        this.deltaGlyphID = p22.int16;
19215      }
19216    };
19217    var LookupType2$1 = class extends LookupType$1 {
19218      constructor(p22) {
19219        super(p22);
19220        this.sequenceCount = p22.uint16;
19221        this.sequenceOffsets = [...new Array(this.sequenceCount)].map(
19222          (_) => p22.Offset16
19223        );
19224      }
19225      getSequence(index) {
19226        let p22 = this.parser;
19227        p22.currentPosition = this.start + this.sequenceOffsets[index];
19228        return new SequenceTable(p22);
19229      }
19230    };
19231    var SequenceTable = class {
19232      constructor(p22) {
19233        this.glyphCount = p22.uint16;
19234        this.substituteGlyphIDs = [...new Array(this.glyphCount)].map(
19235          (_) => p22.uint16
19236        );
19237      }
19238    };
19239    var LookupType3$1 = class extends LookupType$1 {
19240      constructor(p22) {
19241        super(p22);
19242        this.alternateSetCount = p22.uint16;
19243        this.alternateSetOffsets = [
19244          ...new Array(this.alternateSetCount)
19245        ].map((_) => p22.Offset16);
19246      }
19247      getAlternateSet(index) {
19248        let p22 = this.parser;
19249        p22.currentPosition = this.start + this.alternateSetOffsets[index];
19250        return new AlternateSetTable(p22);
19251      }
19252    };
19253    var AlternateSetTable = class {
19254      constructor(p22) {
19255        this.glyphCount = p22.uint16;
19256        this.alternateGlyphIDs = [...new Array(this.glyphCount)].map(
19257          (_) => p22.uint16
19258        );
19259      }
19260    };
19261    var LookupType4$1 = class extends LookupType$1 {
19262      constructor(p22) {
19263        super(p22);
19264        this.ligatureSetCount = p22.uint16;
19265        this.ligatureSetOffsets = [...new Array(this.ligatureSetCount)].map(
19266          (_) => p22.Offset16
19267        );
19268      }
19269      getLigatureSet(index) {
19270        let p22 = this.parser;
19271        p22.currentPosition = this.start + this.ligatureSetOffsets[index];
19272        return new LigatureSetTable(p22);
19273      }
19274    };
19275    var LigatureSetTable = class extends ParsedData {
19276      constructor(p22) {
19277        super(p22);
19278        this.ligatureCount = p22.uint16;
19279        this.ligatureOffsets = [...new Array(this.ligatureCount)].map(
19280          (_) => p22.Offset16
19281        );
19282      }
19283      getLigature(index) {
19284        let p22 = this.parser;
19285        p22.currentPosition = this.start + this.ligatureOffsets[index];
19286        return new LigatureTable(p22);
19287      }
19288    };
19289    var LigatureTable = class {
19290      constructor(p22) {
19291        this.ligatureGlyph = p22.uint16;
19292        this.componentCount = p22.uint16;
19293        this.componentGlyphIDs = [
19294          ...new Array(this.componentCount - 1)
19295        ].map((_) => p22.uint16);
19296      }
19297    };
19298    var LookupType5$1 = class extends LookupType$1 {
19299      constructor(p22) {
19300        super(p22);
19301        if (this.substFormat === 1) {
19302          this.subRuleSetCount = p22.uint16;
19303          this.subRuleSetOffsets = [
19304            ...new Array(this.subRuleSetCount)
19305          ].map((_) => p22.Offset16);
19306        }
19307        if (this.substFormat === 2) {
19308          this.classDefOffset = p22.Offset16;
19309          this.subClassSetCount = p22.uint16;
19310          this.subClassSetOffsets = [
19311            ...new Array(this.subClassSetCount)
19312          ].map((_) => p22.Offset16);
19313        }
19314        if (this.substFormat === 3) {
19315          undoCoverageOffsetParsing(this);
19316          this.glyphCount = p22.uint16;
19317          this.substitutionCount = p22.uint16;
19318          this.coverageOffsets = [...new Array(this.glyphCount)].map(
19319            (_) => p22.Offset16
19320          );
19321          this.substLookupRecords = [
19322            ...new Array(this.substitutionCount)
19323          ].map((_) => new SubstLookupRecord(p22));
19324        }
19325      }
19326      getSubRuleSet(index) {
19327        if (this.substFormat !== 1)
19328          throw new Error(
19329            `lookup type 5.$this.substFormat} has no subrule sets.`
19330          );
19331        let p22 = this.parser;
19332        p22.currentPosition = this.start + this.subRuleSetOffsets[index];
19333        return new SubRuleSetTable(p22);
19334      }
19335      getSubClassSet(index) {
19336        if (this.substFormat !== 2)
19337          throw new Error(
19338            `lookup type 5.$this.substFormat} has no subclass sets.`
19339          );
19340        let p22 = this.parser;
19341        p22.currentPosition = this.start + this.subClassSetOffsets[index];
19342        return new SubClassSetTable(p22);
19343      }
19344      getCoverageTable(index) {
19345        if (this.substFormat !== 3 && !index)
19346          return super.getCoverageTable();
19347        if (!index)
19348          throw new Error(
19349            `lookup type 5.$this.substFormat} requires an coverage table index.`
19350          );
19351        let p22 = this.parser;
19352        p22.currentPosition = this.start + this.coverageOffsets[index];
19353        return new CoverageTable(p22);
19354      }
19355    };
19356    var SubRuleSetTable = class extends ParsedData {
19357      constructor(p22) {
19358        super(p22);
19359        this.subRuleCount = p22.uint16;
19360        this.subRuleOffsets = [...new Array(this.subRuleCount)].map(
19361          (_) => p22.Offset16
19362        );
19363      }
19364      getSubRule(index) {
19365        let p22 = this.parser;
19366        p22.currentPosition = this.start + this.subRuleOffsets[index];
19367        return new SubRuleTable(p22);
19368      }
19369    };
19370    var SubRuleTable = class {
19371      constructor(p22) {
19372        this.glyphCount = p22.uint16;
19373        this.substitutionCount = p22.uint16;
19374        this.inputSequence = [...new Array(this.glyphCount - 1)].map(
19375          (_) => p22.uint16
19376        );
19377        this.substLookupRecords = [
19378          ...new Array(this.substitutionCount)
19379        ].map((_) => new SubstLookupRecord(p22));
19380      }
19381    };
19382    var SubClassSetTable = class extends ParsedData {
19383      constructor(p22) {
19384        super(p22);
19385        this.subClassRuleCount = p22.uint16;
19386        this.subClassRuleOffsets = [
19387          ...new Array(this.subClassRuleCount)
19388        ].map((_) => p22.Offset16);
19389      }
19390      getSubClass(index) {
19391        let p22 = this.parser;
19392        p22.currentPosition = this.start + this.subClassRuleOffsets[index];
19393        return new SubClassRuleTable(p22);
19394      }
19395    };
19396    var SubClassRuleTable = class extends SubRuleTable {
19397      constructor(p22) {
19398        super(p22);
19399      }
19400    };
19401    var LookupType6$1 = class extends LookupType$1 {
19402      constructor(p22) {
19403        super(p22);
19404        if (this.substFormat === 1) {
19405          this.chainSubRuleSetCount = p22.uint16;
19406          this.chainSubRuleSetOffsets = [
19407            ...new Array(this.chainSubRuleSetCount)
19408          ].map((_) => p22.Offset16);
19409        }
19410        if (this.substFormat === 2) {
19411          this.backtrackClassDefOffset = p22.Offset16;
19412          this.inputClassDefOffset = p22.Offset16;
19413          this.lookaheadClassDefOffset = p22.Offset16;
19414          this.chainSubClassSetCount = p22.uint16;
19415          this.chainSubClassSetOffsets = [
19416            ...new Array(this.chainSubClassSetCount)
19417          ].map((_) => p22.Offset16);
19418        }
19419        if (this.substFormat === 3) {
19420          undoCoverageOffsetParsing(this);
19421          this.backtrackGlyphCount = p22.uint16;
19422          this.backtrackCoverageOffsets = [
19423            ...new Array(this.backtrackGlyphCount)
19424          ].map((_) => p22.Offset16);
19425          this.inputGlyphCount = p22.uint16;
19426          this.inputCoverageOffsets = [
19427            ...new Array(this.inputGlyphCount)
19428          ].map((_) => p22.Offset16);
19429          this.lookaheadGlyphCount = p22.uint16;
19430          this.lookaheadCoverageOffsets = [
19431            ...new Array(this.lookaheadGlyphCount)
19432          ].map((_) => p22.Offset16);
19433          this.seqLookupCount = p22.uint16;
19434          this.seqLookupRecords = [
19435            ...new Array(this.substitutionCount)
19436          ].map((_) => new SequenceLookupRecord(p22));
19437        }
19438      }
19439      getChainSubRuleSet(index) {
19440        if (this.substFormat !== 1)
19441          throw new Error(
19442            `lookup type 6.$this.substFormat} has no chainsubrule sets.`
19443          );
19444        let p22 = this.parser;
19445        p22.currentPosition = this.start + this.chainSubRuleSetOffsets[index];
19446        return new ChainSubRuleSetTable(p22);
19447      }
19448      getChainSubClassSet(index) {
19449        if (this.substFormat !== 2)
19450          throw new Error(
19451            `lookup type 6.$this.substFormat} has no chainsubclass sets.`
19452          );
19453        let p22 = this.parser;
19454        p22.currentPosition = this.start + this.chainSubClassSetOffsets[index];
19455        return new ChainSubClassSetTable(p22);
19456      }
19457      getCoverageFromOffset(offset) {
19458        if (this.substFormat !== 3)
19459          throw new Error(
19460            `lookup type 6.$this.substFormat} does not use contextual coverage offsets.`
19461          );
19462        let p22 = this.parser;
19463        p22.currentPosition = this.start + offset;
19464        return new CoverageTable(p22);
19465      }
19466    };
19467    var ChainSubRuleSetTable = class extends ParsedData {
19468      constructor(p22) {
19469        super(p22);
19470        this.chainSubRuleCount = p22.uint16;
19471        this.chainSubRuleOffsets = [
19472          ...new Array(this.chainSubRuleCount)
19473        ].map((_) => p22.Offset16);
19474      }
19475      getSubRule(index) {
19476        let p22 = this.parser;
19477        p22.currentPosition = this.start + this.chainSubRuleOffsets[index];
19478        return new ChainSubRuleTable(p22);
19479      }
19480    };
19481    var ChainSubRuleTable = class {
19482      constructor(p22) {
19483        this.backtrackGlyphCount = p22.uint16;
19484        this.backtrackSequence = [
19485          ...new Array(this.backtrackGlyphCount)
19486        ].map((_) => p22.uint16);
19487        this.inputGlyphCount = p22.uint16;
19488        this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map(
19489          (_) => p22.uint16
19490        );
19491        this.lookaheadGlyphCount = p22.uint16;
19492        this.lookAheadSequence = [
19493          ...new Array(this.lookAheadGlyphCount)
19494        ].map((_) => p22.uint16);
19495        this.substitutionCount = p22.uint16;
19496        this.substLookupRecords = [...new Array(this.SubstCount)].map(
19497          (_) => new SubstLookupRecord(p22)
19498        );
19499      }
19500    };
19501    var ChainSubClassSetTable = class extends ParsedData {
19502      constructor(p22) {
19503        super(p22);
19504        this.chainSubClassRuleCount = p22.uint16;
19505        this.chainSubClassRuleOffsets = [
19506          ...new Array(this.chainSubClassRuleCount)
19507        ].map((_) => p22.Offset16);
19508      }
19509      getSubClass(index) {
19510        let p22 = this.parser;
19511        p22.currentPosition = this.start + this.chainSubRuleOffsets[index];
19512        return new ChainSubClassRuleTable(p22);
19513      }
19514    };
19515    var ChainSubClassRuleTable = class {
19516      constructor(p22) {
19517        this.backtrackGlyphCount = p22.uint16;
19518        this.backtrackSequence = [
19519          ...new Array(this.backtrackGlyphCount)
19520        ].map((_) => p22.uint16);
19521        this.inputGlyphCount = p22.uint16;
19522        this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map(
19523          (_) => p22.uint16
19524        );
19525        this.lookaheadGlyphCount = p22.uint16;
19526        this.lookAheadSequence = [
19527          ...new Array(this.lookAheadGlyphCount)
19528        ].map((_) => p22.uint16);
19529        this.substitutionCount = p22.uint16;
19530        this.substLookupRecords = [
19531          ...new Array(this.substitutionCount)
19532        ].map((_) => new SequenceLookupRecord(p22));
19533      }
19534    };
19535    var SequenceLookupRecord = class extends ParsedData {
19536      constructor(p22) {
19537        super(p22);
19538        this.sequenceIndex = p22.uint16;
19539        this.lookupListIndex = p22.uint16;
19540      }
19541    };
19542    var LookupType7$1 = class extends ParsedData {
19543      constructor(p22) {
19544        super(p22);
19545        this.substFormat = p22.uint16;
19546        this.extensionLookupType = p22.uint16;
19547        this.extensionOffset = p22.Offset32;
19548      }
19549    };
19550    var LookupType8$1 = class extends LookupType$1 {
19551      constructor(p22) {
19552        super(p22);
19553        this.backtrackGlyphCount = p22.uint16;
19554        this.backtrackCoverageOffsets = [
19555          ...new Array(this.backtrackGlyphCount)
19556        ].map((_) => p22.Offset16);
19557        this.lookaheadGlyphCount = p22.uint16;
19558        this.lookaheadCoverageOffsets = [
19559          new Array(this.lookaheadGlyphCount)
19560        ].map((_) => p22.Offset16);
19561        this.glyphCount = p22.uint16;
19562        this.substituteGlyphIDs = [...new Array(this.glyphCount)].map(
19563          (_) => p22.uint16
19564        );
19565      }
19566    };
19567    var GSUBtables = {
19568      buildSubtable: function(type, p22) {
19569        const subtable = new [
19570          void 0,
19571          LookupType1$1,
19572          LookupType2$1,
19573          LookupType3$1,
19574          LookupType4$1,
19575          LookupType5$1,
19576          LookupType6$1,
19577          LookupType7$1,
19578          LookupType8$1
19579        ][type](p22);
19580        subtable.type = type;
19581        return subtable;
19582      }
19583    };
19584    var LookupType = class extends ParsedData {
19585      constructor(p22) {
19586        super(p22);
19587      }
19588    };
19589    var LookupType1 = class extends LookupType {
19590      constructor(p22) {
19591        super(p22);
19592        console.log(`lookup type 1`);
19593      }
19594    };
19595    var LookupType2 = class extends LookupType {
19596      constructor(p22) {
19597        super(p22);
19598        console.log(`lookup type 2`);
19599      }
19600    };
19601    var LookupType3 = class extends LookupType {
19602      constructor(p22) {
19603        super(p22);
19604        console.log(`lookup type 3`);
19605      }
19606    };
19607    var LookupType4 = class extends LookupType {
19608      constructor(p22) {
19609        super(p22);
19610        console.log(`lookup type 4`);
19611      }
19612    };
19613    var LookupType5 = class extends LookupType {
19614      constructor(p22) {
19615        super(p22);
19616        console.log(`lookup type 5`);
19617      }
19618    };
19619    var LookupType6 = class extends LookupType {
19620      constructor(p22) {
19621        super(p22);
19622        console.log(`lookup type 6`);
19623      }
19624    };
19625    var LookupType7 = class extends LookupType {
19626      constructor(p22) {
19627        super(p22);
19628        console.log(`lookup type 7`);
19629      }
19630    };
19631    var LookupType8 = class extends LookupType {
19632      constructor(p22) {
19633        super(p22);
19634        console.log(`lookup type 8`);
19635      }
19636    };
19637    var LookupType9 = class extends LookupType {
19638      constructor(p22) {
19639        super(p22);
19640        console.log(`lookup type 9`);
19641      }
19642    };
19643    var GPOStables = {
19644      buildSubtable: function(type, p22) {
19645        const subtable = new [
19646          void 0,
19647          LookupType1,
19648          LookupType2,
19649          LookupType3,
19650          LookupType4,
19651          LookupType5,
19652          LookupType6,
19653          LookupType7,
19654          LookupType8,
19655          LookupType9
19656        ][type](p22);
19657        subtable.type = type;
19658        return subtable;
19659      }
19660    };
19661    var LookupList = class extends ParsedData {
19662      static EMPTY = { lookupCount: 0, lookups: [] };
19663      constructor(p22) {
19664        super(p22);
19665        this.lookupCount = p22.uint16;
19666        this.lookups = [...new Array(this.lookupCount)].map(
19667          (_) => p22.Offset16
19668        );
19669      }
19670    };
19671    var LookupTable = class extends ParsedData {
19672      constructor(p22, type) {
19673        super(p22);
19674        this.ctType = type;
19675        this.lookupType = p22.uint16;
19676        this.lookupFlag = p22.uint16;
19677        this.subTableCount = p22.uint16;
19678        this.subtableOffsets = [...new Array(this.subTableCount)].map(
19679          (_) => p22.Offset16
19680        );
19681        this.markFilteringSet = p22.uint16;
19682      }
19683      get rightToLeft() {
19684        return this.lookupFlag & true;
19685      }
19686      get ignoreBaseGlyphs() {
19687        return this.lookupFlag & true;
19688      }
19689      get ignoreLigatures() {
19690        return this.lookupFlag & true;
19691      }
19692      get ignoreMarks() {
19693        return this.lookupFlag & true;
19694      }
19695      get useMarkFilteringSet() {
19696        return this.lookupFlag & true;
19697      }
19698      get markAttachmentType() {
19699        return this.lookupFlag & true;
19700      }
19701      getSubTable(index) {
19702        const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables;
19703        this.parser.currentPosition = this.start + this.subtableOffsets[index];
19704        return builder.buildSubtable(this.lookupType, this.parser);
19705      }
19706    };
19707    var CommonLayoutTable = class extends SimpleTable {
19708      constructor(dict, dataview, name2) {
19709        const { p: p22, tableStart } = super(dict, dataview, name2);
19710        this.majorVersion = p22.uint16;
19711        this.minorVersion = p22.uint16;
19712        this.scriptListOffset = p22.Offset16;
19713        this.featureListOffset = p22.Offset16;
19714        this.lookupListOffset = p22.Offset16;
19715        if (this.majorVersion === 1 && this.minorVersion === 1) {
19716          this.featureVariationsOffset = p22.Offset32;
19717        }
19718        const no_content = !(this.scriptListOffset || this.featureListOffset || this.lookupListOffset);
19719        lazy$1(this, `scriptList`, () => {
19720          if (no_content) return ScriptList.EMPTY;
19721          p22.currentPosition = tableStart + this.scriptListOffset;
19722          return new ScriptList(p22);
19723        });
19724        lazy$1(this, `featureList`, () => {
19725          if (no_content) return FeatureList.EMPTY;
19726          p22.currentPosition = tableStart + this.featureListOffset;
19727          return new FeatureList(p22);
19728        });
19729        lazy$1(this, `lookupList`, () => {
19730          if (no_content) return LookupList.EMPTY;
19731          p22.currentPosition = tableStart + this.lookupListOffset;
19732          return new LookupList(p22);
19733        });
19734        if (this.featureVariationsOffset) {
19735          lazy$1(this, `featureVariations`, () => {
19736            if (no_content) return FeatureVariations.EMPTY;
19737            p22.currentPosition = tableStart + this.featureVariationsOffset;
19738            return new FeatureVariations(p22);
19739          });
19740        }
19741      }
19742      getSupportedScripts() {
19743        return this.scriptList.scriptRecords.map((r3) => r3.scriptTag);
19744      }
19745      getScriptTable(scriptTag) {
19746        let record = this.scriptList.scriptRecords.find(
19747          (r3) => r3.scriptTag === scriptTag
19748        );
19749        this.parser.currentPosition = this.scriptList.start + record.scriptOffset;
19750        let table = new ScriptTable(this.parser);
19751        table.scriptTag = scriptTag;
19752        return table;
19753      }
19754      ensureScriptTable(arg) {
19755        if (typeof arg === "string") {
19756          return this.getScriptTable(arg);
19757        }
19758        return arg;
19759      }
19760      getSupportedLangSys(scriptTable) {
19761        scriptTable = this.ensureScriptTable(scriptTable);
19762        const hasDefault = scriptTable.defaultLangSys !== 0;
19763        const supported = scriptTable.langSysRecords.map(
19764          (l2) => l2.langSysTag
19765        );
19766        if (hasDefault) supported.unshift(`dflt`);
19767        return supported;
19768      }
19769      getDefaultLangSysTable(scriptTable) {
19770        scriptTable = this.ensureScriptTable(scriptTable);
19771        let offset = scriptTable.defaultLangSys;
19772        if (offset !== 0) {
19773          this.parser.currentPosition = scriptTable.start + offset;
19774          let table = new LangSysTable(this.parser);
19775          table.langSysTag = ``;
19776          table.defaultForScript = scriptTable.scriptTag;
19777          return table;
19778        }
19779      }
19780      getLangSysTable(scriptTable, langSysTag = `dflt`) {
19781        if (langSysTag === `dflt`)
19782          return this.getDefaultLangSysTable(scriptTable);
19783        scriptTable = this.ensureScriptTable(scriptTable);
19784        let record = scriptTable.langSysRecords.find(
19785          (l2) => l2.langSysTag === langSysTag
19786        );
19787        this.parser.currentPosition = scriptTable.start + record.langSysOffset;
19788        let table = new LangSysTable(this.parser);
19789        table.langSysTag = langSysTag;
19790        return table;
19791      }
19792      getFeatures(langSysTable) {
19793        return langSysTable.featureIndices.map(
19794          (index) => this.getFeature(index)
19795        );
19796      }
19797      getFeature(indexOrTag) {
19798        let record;
19799        if (parseInt(indexOrTag) == indexOrTag) {
19800          record = this.featureList.featureRecords[indexOrTag];
19801        } else {
19802          record = this.featureList.featureRecords.find(
19803            (f2) => f2.featureTag === indexOrTag
19804          );
19805        }
19806        if (!record) return;
19807        this.parser.currentPosition = this.featureList.start + record.featureOffset;
19808        let table = new FeatureTable(this.parser);
19809        table.featureTag = record.featureTag;
19810        return table;
19811      }
19812      getLookups(featureTable) {
19813        return featureTable.lookupListIndices.map(
19814          (index) => this.getLookup(index)
19815        );
19816      }
19817      getLookup(lookupIndex, type) {
19818        let lookupOffset = this.lookupList.lookups[lookupIndex];
19819        this.parser.currentPosition = this.lookupList.start + lookupOffset;
19820        return new LookupTable(this.parser, type);
19821      }
19822    };
19823    var GSUB = class extends CommonLayoutTable {
19824      constructor(dict, dataview) {
19825        super(dict, dataview, `GSUB`);
19826      }
19827      getLookup(lookupIndex) {
19828        return super.getLookup(lookupIndex, `GSUB`);
19829      }
19830    };
19831    var GSUB$1 = Object.freeze({ __proto__: null, GSUB });
19832    var GPOS = class extends CommonLayoutTable {
19833      constructor(dict, dataview) {
19834        super(dict, dataview, `GPOS`);
19835      }
19836      getLookup(lookupIndex) {
19837        return super.getLookup(lookupIndex, `GPOS`);
19838      }
19839    };
19840    var GPOS$1 = Object.freeze({ __proto__: null, GPOS });
19841    var SVG67 = class extends SimpleTable {
19842      constructor(dict, dataview) {
19843        const { p: p22 } = super(dict, dataview);
19844        this.version = p22.uint16;
19845        this.offsetToSVGDocumentList = p22.Offset32;
19846        p22.currentPosition = this.tableStart + this.offsetToSVGDocumentList;
19847        this.documentList = new SVGDocumentList(p22);
19848      }
19849    };
19850    var SVGDocumentList = class extends ParsedData {
19851      constructor(p22) {
19852        super(p22);
19853        this.numEntries = p22.uint16;
19854        this.documentRecords = [...new Array(this.numEntries)].map(
19855          (_) => new SVGDocumentRecord(p22)
19856        );
19857      }
19858      getDocument(documentID) {
19859        let record = this.documentRecords[documentID];
19860        if (!record) return "";
19861        let offset = this.start + record.svgDocOffset;
19862        this.parser.currentPosition = offset;
19863        return this.parser.readBytes(record.svgDocLength);
19864      }
19865      getDocumentForGlyph(glyphID) {
19866        let id = this.documentRecords.findIndex(
19867          (d2) => d2.startGlyphID <= glyphID && glyphID <= d2.endGlyphID
19868        );
19869        if (id === -1) return "";
19870        return this.getDocument(id);
19871      }
19872    };
19873    var SVGDocumentRecord = class {
19874      constructor(p22) {
19875        this.startGlyphID = p22.uint16;
19876        this.endGlyphID = p22.uint16;
19877        this.svgDocOffset = p22.Offset32;
19878        this.svgDocLength = p22.uint32;
19879      }
19880    };
19881    var SVG$1 = Object.freeze({ __proto__: null, SVG: SVG67 });
19882    var fvar = class extends SimpleTable {
19883      constructor(dict, dataview) {
19884        const { p: p22 } = super(dict, dataview);
19885        this.majorVersion = p22.uint16;
19886        this.minorVersion = p22.uint16;
19887        this.axesArrayOffset = p22.Offset16;
19888        p22.uint16;
19889        this.axisCount = p22.uint16;
19890        this.axisSize = p22.uint16;
19891        this.instanceCount = p22.uint16;
19892        this.instanceSize = p22.uint16;
19893        const axisStart = this.tableStart + this.axesArrayOffset;
19894        lazy$1(this, `axes`, () => {
19895          p22.currentPosition = axisStart;
19896          return [...new Array(this.axisCount)].map(
19897            (_) => new VariationAxisRecord(p22)
19898          );
19899        });
19900        const instanceStart = axisStart + this.axisCount * this.axisSize;
19901        lazy$1(this, `instances`, () => {
19902          let instances = [];
19903          for (let i2 = 0; i2 < this.instanceCount; i2++) {
19904            p22.currentPosition = instanceStart + i2 * this.instanceSize;
19905            instances.push(
19906              new InstanceRecord(p22, this.axisCount, this.instanceSize)
19907            );
19908          }
19909          return instances;
19910        });
19911      }
19912      getSupportedAxes() {
19913        return this.axes.map((a2) => a2.tag);
19914      }
19915      getAxis(name2) {
19916        return this.axes.find((a2) => a2.tag === name2);
19917      }
19918    };
19919    var VariationAxisRecord = class {
19920      constructor(p22) {
19921        this.tag = p22.tag;
19922        this.minValue = p22.fixed;
19923        this.defaultValue = p22.fixed;
19924        this.maxValue = p22.fixed;
19925        this.flags = p22.flags(16);
19926        this.axisNameID = p22.uint16;
19927      }
19928    };
19929    var InstanceRecord = class {
19930      constructor(p22, axisCount, size) {
19931        let start2 = p22.currentPosition;
19932        this.subfamilyNameID = p22.uint16;
19933        p22.uint16;
19934        this.coordinates = [...new Array(axisCount)].map(
19935          (_) => p22.fixed
19936        );
19937        if (p22.currentPosition - start2 < size) {
19938          this.postScriptNameID = p22.uint16;
19939        }
19940      }
19941    };
19942    var fvar$1 = Object.freeze({ __proto__: null, fvar });
19943    var cvt = class extends SimpleTable {
19944      constructor(dict, dataview) {
19945        const { p: p22 } = super(dict, dataview);
19946        const n2 = dict.length / 2;
19947        lazy$1(
19948          this,
19949          `items`,
19950          () => [...new Array(n2)].map((_) => p22.fword)
19951        );
19952      }
19953    };
19954    var cvt$1 = Object.freeze({ __proto__: null, cvt });
19955    var fpgm = class extends SimpleTable {
19956      constructor(dict, dataview) {
19957        const { p: p22 } = super(dict, dataview);
19958        lazy$1(
19959          this,
19960          `instructions`,
19961          () => [...new Array(dict.length)].map((_) => p22.uint8)
19962        );
19963      }
19964    };
19965    var fpgm$1 = Object.freeze({ __proto__: null, fpgm });
19966    var gasp = class extends SimpleTable {
19967      constructor(dict, dataview) {
19968        const { p: p22 } = super(dict, dataview);
19969        this.version = p22.uint16;
19970        this.numRanges = p22.uint16;
19971        const getter = () => [...new Array(this.numRanges)].map(
19972          (_) => new GASPRange(p22)
19973        );
19974        lazy$1(this, `gaspRanges`, getter);
19975      }
19976    };
19977    var GASPRange = class {
19978      constructor(p22) {
19979        this.rangeMaxPPEM = p22.uint16;
19980        this.rangeGaspBehavior = p22.uint16;
19981      }
19982    };
19983    var gasp$1 = Object.freeze({ __proto__: null, gasp });
19984    var glyf = class extends SimpleTable {
19985      constructor(dict, dataview) {
19986        super(dict, dataview);
19987      }
19988      getGlyphData(offset, length) {
19989        this.parser.currentPosition = this.tableStart + offset;
19990        return this.parser.readBytes(length);
19991      }
19992    };
19993    var glyf$1 = Object.freeze({ __proto__: null, glyf });
19994    var loca = class extends SimpleTable {
19995      constructor(dict, dataview, tables) {
19996        const { p: p22 } = super(dict, dataview);
19997        const n2 = tables.maxp.numGlyphs + 1;
19998        if (tables.head.indexToLocFormat === 0) {
19999          this.x2 = true;
20000          lazy$1(
20001            this,
20002            `offsets`,
20003            () => [...new Array(n2)].map((_) => p22.Offset16)
20004          );
20005        } else {
20006          lazy$1(
20007            this,
20008            `offsets`,
20009            () => [...new Array(n2)].map((_) => p22.Offset32)
20010          );
20011        }
20012      }
20013      getGlyphDataOffsetAndLength(glyphID) {
20014        let offset = this.offsets[glyphID] * this.x2 ? 2 : 1;
20015        let nextOffset = this.offsets[glyphID + 1] * this.x2 ? 2 : 1;
20016        return { offset, length: nextOffset - offset };
20017      }
20018    };
20019    var loca$1 = Object.freeze({ __proto__: null, loca });
20020    var prep = class extends SimpleTable {
20021      constructor(dict, dataview) {
20022        const { p: p22 } = super(dict, dataview);
20023        lazy$1(
20024          this,
20025          `instructions`,
20026          () => [...new Array(dict.length)].map((_) => p22.uint8)
20027        );
20028      }
20029    };
20030    var prep$1 = Object.freeze({ __proto__: null, prep });
20031    var CFF = class extends SimpleTable {
20032      constructor(dict, dataview) {
20033        const { p: p22 } = super(dict, dataview);
20034        lazy$1(this, `data`, () => p22.readBytes());
20035      }
20036    };
20037    var CFF$1 = Object.freeze({ __proto__: null, CFF });
20038    var CFF2 = class extends SimpleTable {
20039      constructor(dict, dataview) {
20040        const { p: p22 } = super(dict, dataview);
20041        lazy$1(this, `data`, () => p22.readBytes());
20042      }
20043    };
20044    var CFF2$1 = Object.freeze({ __proto__: null, CFF2 });
20045    var VORG = class extends SimpleTable {
20046      constructor(dict, dataview) {
20047        const { p: p22 } = super(dict, dataview);
20048        this.majorVersion = p22.uint16;
20049        this.minorVersion = p22.uint16;
20050        this.defaultVertOriginY = p22.int16;
20051        this.numVertOriginYMetrics = p22.uint16;
20052        lazy$1(
20053          this,
20054          `vertORiginYMetrics`,
20055          () => [...new Array(this.numVertOriginYMetrics)].map(
20056            (_) => new VertOriginYMetric(p22)
20057          )
20058        );
20059      }
20060    };
20061    var VertOriginYMetric = class {
20062      constructor(p22) {
20063        this.glyphIndex = p22.uint16;
20064        this.vertOriginY = p22.int16;
20065      }
20066    };
20067    var VORG$1 = Object.freeze({ __proto__: null, VORG });
20068    var BitmapSize = class {
20069      constructor(p22) {
20070        this.indexSubTableArrayOffset = p22.Offset32;
20071        this.indexTablesSize = p22.uint32;
20072        this.numberofIndexSubTables = p22.uint32;
20073        this.colorRef = p22.uint32;
20074        this.hori = new SbitLineMetrics(p22);
20075        this.vert = new SbitLineMetrics(p22);
20076        this.startGlyphIndex = p22.uint16;
20077        this.endGlyphIndex = p22.uint16;
20078        this.ppemX = p22.uint8;
20079        this.ppemY = p22.uint8;
20080        this.bitDepth = p22.uint8;
20081        this.flags = p22.int8;
20082      }
20083    };
20084    var BitmapScale = class {
20085      constructor(p22) {
20086        this.hori = new SbitLineMetrics(p22);
20087        this.vert = new SbitLineMetrics(p22);
20088        this.ppemX = p22.uint8;
20089        this.ppemY = p22.uint8;
20090        this.substitutePpemX = p22.uint8;
20091        this.substitutePpemY = p22.uint8;
20092      }
20093    };
20094    var SbitLineMetrics = class {
20095      constructor(p22) {
20096        this.ascender = p22.int8;
20097        this.descender = p22.int8;
20098        this.widthMax = p22.uint8;
20099        this.caretSlopeNumerator = p22.int8;
20100        this.caretSlopeDenominator = p22.int8;
20101        this.caretOffset = p22.int8;
20102        this.minOriginSB = p22.int8;
20103        this.minAdvanceSB = p22.int8;
20104        this.maxBeforeBL = p22.int8;
20105        this.minAfterBL = p22.int8;
20106        this.pad1 = p22.int8;
20107        this.pad2 = p22.int8;
20108      }
20109    };
20110    var EBLC = class extends SimpleTable {
20111      constructor(dict, dataview, name2) {
20112        const { p: p22 } = super(dict, dataview, name2);
20113        this.majorVersion = p22.uint16;
20114        this.minorVersion = p22.uint16;
20115        this.numSizes = p22.uint32;
20116        lazy$1(
20117          this,
20118          `bitMapSizes`,
20119          () => [...new Array(this.numSizes)].map(
20120            (_) => new BitmapSize(p22)
20121          )
20122        );
20123      }
20124    };
20125    var EBLC$1 = Object.freeze({ __proto__: null, EBLC });
20126    var EBDT = class extends SimpleTable {
20127      constructor(dict, dataview, name2) {
20128        const { p: p22 } = super(dict, dataview, name2);
20129        this.majorVersion = p22.uint16;
20130        this.minorVersion = p22.uint16;
20131      }
20132    };
20133    var EBDT$1 = Object.freeze({ __proto__: null, EBDT });
20134    var EBSC = class extends SimpleTable {
20135      constructor(dict, dataview) {
20136        const { p: p22 } = super(dict, dataview);
20137        this.majorVersion = p22.uint16;
20138        this.minorVersion = p22.uint16;
20139        this.numSizes = p22.uint32;
20140        lazy$1(
20141          this,
20142          `bitmapScales`,
20143          () => [...new Array(this.numSizes)].map(
20144            (_) => new BitmapScale(p22)
20145          )
20146        );
20147      }
20148    };
20149    var EBSC$1 = Object.freeze({ __proto__: null, EBSC });
20150    var CBLC = class extends EBLC {
20151      constructor(dict, dataview) {
20152        super(dict, dataview, `CBLC`);
20153      }
20154    };
20155    var CBLC$1 = Object.freeze({ __proto__: null, CBLC });
20156    var CBDT = class extends EBDT {
20157      constructor(dict, dataview) {
20158        super(dict, dataview, `CBDT`);
20159      }
20160    };
20161    var CBDT$1 = Object.freeze({ __proto__: null, CBDT });
20162    var sbix = class extends SimpleTable {
20163      constructor(dict, dataview) {
20164        const { p: p22 } = super(dict, dataview);
20165        this.version = p22.uint16;
20166        this.flags = p22.flags(16);
20167        this.numStrikes = p22.uint32;
20168        lazy$1(
20169          this,
20170          `strikeOffsets`,
20171          () => [...new Array(this.numStrikes)].map((_) => p22.Offset32)
20172        );
20173      }
20174    };
20175    var sbix$1 = Object.freeze({ __proto__: null, sbix });
20176    var COLR = class extends SimpleTable {
20177      constructor(dict, dataview) {
20178        const { p: p22 } = super(dict, dataview);
20179        this.version = p22.uint16;
20180        this.numBaseGlyphRecords = p22.uint16;
20181        this.baseGlyphRecordsOffset = p22.Offset32;
20182        this.layerRecordsOffset = p22.Offset32;
20183        this.numLayerRecords = p22.uint16;
20184      }
20185      getBaseGlyphRecord(glyphID) {
20186        let start2 = this.tableStart + this.baseGlyphRecordsOffset;
20187        this.parser.currentPosition = start2;
20188        let first = new BaseGlyphRecord(this.parser);
20189        let firstID = first.gID;
20190        let end = this.tableStart + this.layerRecordsOffset - 6;
20191        this.parser.currentPosition = end;
20192        let last = new BaseGlyphRecord(this.parser);
20193        let lastID = last.gID;
20194        if (firstID === glyphID) return first;
20195        if (lastID === glyphID) return last;
20196        while (true) {
20197          if (start2 === end) break;
20198          let mid = start2 + (end - start2) / 12;
20199          this.parser.currentPosition = mid;
20200          let middle = new BaseGlyphRecord(this.parser);
20201          let midID = middle.gID;
20202          if (midID === glyphID) return middle;
20203          else if (midID > glyphID) {
20204            end = mid;
20205          } else if (midID < glyphID) {
20206            start2 = mid;
20207          }
20208        }
20209        return false;
20210      }
20211      getLayers(glyphID) {
20212        let record = this.getBaseGlyphRecord(glyphID);
20213        this.parser.currentPosition = this.tableStart + this.layerRecordsOffset + 4 * record.firstLayerIndex;
20214        return [...new Array(record.numLayers)].map(
20215          (_) => new LayerRecord(p)
20216        );
20217      }
20218    };
20219    var BaseGlyphRecord = class {
20220      constructor(p22) {
20221        this.gID = p22.uint16;
20222        this.firstLayerIndex = p22.uint16;
20223        this.numLayers = p22.uint16;
20224      }
20225    };
20226    var LayerRecord = class {
20227      constructor(p22) {
20228        this.gID = p22.uint16;
20229        this.paletteIndex = p22.uint16;
20230      }
20231    };
20232    var COLR$1 = Object.freeze({ __proto__: null, COLR });
20233    var CPAL = class extends SimpleTable {
20234      constructor(dict, dataview) {
20235        const { p: p22 } = super(dict, dataview);
20236        this.version = p22.uint16;
20237        this.numPaletteEntries = p22.uint16;
20238        const numPalettes = this.numPalettes = p22.uint16;
20239        this.numColorRecords = p22.uint16;
20240        this.offsetFirstColorRecord = p22.Offset32;
20241        this.colorRecordIndices = [...new Array(this.numPalettes)].map(
20242          (_) => p22.uint16
20243        );
20244        lazy$1(this, `colorRecords`, () => {
20245          p22.currentPosition = this.tableStart + this.offsetFirstColorRecord;
20246          return [...new Array(this.numColorRecords)].map(
20247            (_) => new ColorRecord(p22)
20248          );
20249        });
20250        if (this.version === 1) {
20251          this.offsetPaletteTypeArray = p22.Offset32;
20252          this.offsetPaletteLabelArray = p22.Offset32;
20253          this.offsetPaletteEntryLabelArray = p22.Offset32;
20254          lazy$1(this, `paletteTypeArray`, () => {
20255            p22.currentPosition = this.tableStart + this.offsetPaletteTypeArray;
20256            return new PaletteTypeArray(p22, numPalettes);
20257          });
20258          lazy$1(this, `paletteLabelArray`, () => {
20259            p22.currentPosition = this.tableStart + this.offsetPaletteLabelArray;
20260            return new PaletteLabelsArray(p22, numPalettes);
20261          });
20262          lazy$1(this, `paletteEntryLabelArray`, () => {
20263            p22.currentPosition = this.tableStart + this.offsetPaletteEntryLabelArray;
20264            return new PaletteEntryLabelArray(p22, numPalettes);
20265          });
20266        }
20267      }
20268    };
20269    var ColorRecord = class {
20270      constructor(p22) {
20271        this.blue = p22.uint8;
20272        this.green = p22.uint8;
20273        this.red = p22.uint8;
20274        this.alpha = p22.uint8;
20275      }
20276    };
20277    var PaletteTypeArray = class {
20278      constructor(p22, numPalettes) {
20279        this.paletteTypes = [...new Array(numPalettes)].map(
20280          (_) => p22.uint32
20281        );
20282      }
20283    };
20284    var PaletteLabelsArray = class {
20285      constructor(p22, numPalettes) {
20286        this.paletteLabels = [...new Array(numPalettes)].map(
20287          (_) => p22.uint16
20288        );
20289      }
20290    };
20291    var PaletteEntryLabelArray = class {
20292      constructor(p22, numPalettes) {
20293        this.paletteEntryLabels = [...new Array(numPalettes)].map(
20294          (_) => p22.uint16
20295        );
20296      }
20297    };
20298    var CPAL$1 = Object.freeze({ __proto__: null, CPAL });
20299    var DSIG = class extends SimpleTable {
20300      constructor(dict, dataview) {
20301        const { p: p22 } = super(dict, dataview);
20302        this.version = p22.uint32;
20303        this.numSignatures = p22.uint16;
20304        this.flags = p22.uint16;
20305        this.signatureRecords = [...new Array(this.numSignatures)].map(
20306          (_) => new SignatureRecord(p22)
20307        );
20308      }
20309      getData(signatureID) {
20310        const record = this.signatureRecords[signatureID];
20311        this.parser.currentPosition = this.tableStart + record.offset;
20312        return new SignatureBlockFormat1(this.parser);
20313      }
20314    };
20315    var SignatureRecord = class {
20316      constructor(p22) {
20317        this.format = p22.uint32;
20318        this.length = p22.uint32;
20319        this.offset = p22.Offset32;
20320      }
20321    };
20322    var SignatureBlockFormat1 = class {
20323      constructor(p22) {
20324        p22.uint16;
20325        p22.uint16;
20326        this.signatureLength = p22.uint32;
20327        this.signature = p22.readBytes(this.signatureLength);
20328      }
20329    };
20330    var DSIG$1 = Object.freeze({ __proto__: null, DSIG });
20331    var hdmx = class extends SimpleTable {
20332      constructor(dict, dataview, tables) {
20333        const { p: p22 } = super(dict, dataview);
20334        const numGlyphs = tables.hmtx.numGlyphs;
20335        this.version = p22.uint16;
20336        this.numRecords = p22.int16;
20337        this.sizeDeviceRecord = p22.int32;
20338        this.records = [...new Array(numRecords)].map(
20339          (_) => new DeviceRecord(p22, numGlyphs)
20340        );
20341      }
20342    };
20343    var DeviceRecord = class {
20344      constructor(p22, numGlyphs) {
20345        this.pixelSize = p22.uint8;
20346        this.maxWidth = p22.uint8;
20347        this.widths = p22.readBytes(numGlyphs);
20348      }
20349    };
20350    var hdmx$1 = Object.freeze({ __proto__: null, hdmx });
20351    var kern = class extends SimpleTable {
20352      constructor(dict, dataview) {
20353        const { p: p22 } = super(dict, dataview);
20354        this.version = p22.uint16;
20355        this.nTables = p22.uint16;
20356        lazy$1(this, `tables`, () => {
20357          let offset = this.tableStart + 4;
20358          const tables = [];
20359          for (let i2 = 0; i2 < this.nTables; i2++) {
20360            p22.currentPosition = offset;
20361            let subtable = new KernSubTable(p22);
20362            tables.push(subtable);
20363            offset += subtable;
20364          }
20365          return tables;
20366        });
20367      }
20368    };
20369    var KernSubTable = class {
20370      constructor(p22) {
20371        this.version = p22.uint16;
20372        this.length = p22.uint16;
20373        this.coverage = p22.flags(8);
20374        this.format = p22.uint8;
20375        if (this.format === 0) {
20376          this.nPairs = p22.uint16;
20377          this.searchRange = p22.uint16;
20378          this.entrySelector = p22.uint16;
20379          this.rangeShift = p22.uint16;
20380          lazy$1(
20381            this,
20382            `pairs`,
20383            () => [...new Array(this.nPairs)].map((_) => new Pair(p22))
20384          );
20385        }
20386        if (this.format === 2) {
20387          console.warn(
20388            `Kern subtable format 2 is not supported: this parser currently only parses universal table data.`
20389          );
20390        }
20391      }
20392      get horizontal() {
20393        return this.coverage[0];
20394      }
20395      get minimum() {
20396        return this.coverage[1];
20397      }
20398      get crossstream() {
20399        return this.coverage[2];
20400      }
20401      get override() {
20402        return this.coverage[3];
20403      }
20404    };
20405    var Pair = class {
20406      constructor(p22) {
20407        this.left = p22.uint16;
20408        this.right = p22.uint16;
20409        this.value = p22.fword;
20410      }
20411    };
20412    var kern$1 = Object.freeze({ __proto__: null, kern });
20413    var LTSH = class extends SimpleTable {
20414      constructor(dict, dataview) {
20415        const { p: p22 } = super(dict, dataview);
20416        this.version = p22.uint16;
20417        this.numGlyphs = p22.uint16;
20418        this.yPels = p22.readBytes(this.numGlyphs);
20419      }
20420    };
20421    var LTSH$1 = Object.freeze({ __proto__: null, LTSH });
20422    var MERG = class extends SimpleTable {
20423      constructor(dict, dataview) {
20424        const { p: p22 } = super(dict, dataview);
20425        this.version = p22.uint16;
20426        this.mergeClassCount = p22.uint16;
20427        this.mergeDataOffset = p22.Offset16;
20428        this.classDefCount = p22.uint16;
20429        this.offsetToClassDefOffsets = p22.Offset16;
20430        lazy$1(
20431          this,
20432          `mergeEntryMatrix`,
20433          () => [...new Array(this.mergeClassCount)].map(
20434            (_) => p22.readBytes(this.mergeClassCount)
20435          )
20436        );
20437        console.warn(`Full MERG parsing is currently not supported.`);
20438        console.warn(
20439          `If you need this table parsed, please file an issue, or better yet, a PR.`
20440        );
20441      }
20442    };
20443    var MERG$1 = Object.freeze({ __proto__: null, MERG });
20444    var meta = class extends SimpleTable {
20445      constructor(dict, dataview) {
20446        const { p: p22 } = super(dict, dataview);
20447        this.version = p22.uint32;
20448        this.flags = p22.uint32;
20449        p22.uint32;
20450        this.dataMapsCount = p22.uint32;
20451        this.dataMaps = [...new Array(this.dataMapsCount)].map(
20452          (_) => new DataMap(this.tableStart, p22)
20453        );
20454      }
20455    };
20456    var DataMap = class {
20457      constructor(tableStart, p22) {
20458        this.tableStart = tableStart;
20459        this.parser = p22;
20460        this.tag = p22.tag;
20461        this.dataOffset = p22.Offset32;
20462        this.dataLength = p22.uint32;
20463      }
20464      getData() {
20465        this.parser.currentField = this.tableStart + this.dataOffset;
20466        return this.parser.readBytes(this.dataLength);
20467      }
20468    };
20469    var meta$1 = Object.freeze({ __proto__: null, meta });
20470    var PCLT = class extends SimpleTable {
20471      constructor(dict, dataview) {
20472        super(dict, dataview);
20473        console.warn(
20474          `This font uses a PCLT table, which is currently not supported by this parser.`
20475        );
20476        console.warn(
20477          `If you need this table parsed, please file an issue, or better yet, a PR.`
20478        );
20479      }
20480    };
20481    var PCLT$1 = Object.freeze({ __proto__: null, PCLT });
20482    var VDMX = class extends SimpleTable {
20483      constructor(dict, dataview) {
20484        const { p: p22 } = super(dict, dataview);
20485        this.version = p22.uint16;
20486        this.numRecs = p22.uint16;
20487        this.numRatios = p22.uint16;
20488        this.ratRanges = [...new Array(this.numRatios)].map(
20489          (_) => new RatioRange(p22)
20490        );
20491        this.offsets = [...new Array(this.numRatios)].map(
20492          (_) => p22.Offset16
20493        );
20494        this.VDMXGroups = [...new Array(this.numRecs)].map(
20495          (_) => new VDMXGroup(p22)
20496        );
20497      }
20498    };
20499    var RatioRange = class {
20500      constructor(p22) {
20501        this.bCharSet = p22.uint8;
20502        this.xRatio = p22.uint8;
20503        this.yStartRatio = p22.uint8;
20504        this.yEndRatio = p22.uint8;
20505      }
20506    };
20507    var VDMXGroup = class {
20508      constructor(p22) {
20509        this.recs = p22.uint16;
20510        this.startsz = p22.uint8;
20511        this.endsz = p22.uint8;
20512        this.records = [...new Array(this.recs)].map(
20513          (_) => new vTable(p22)
20514        );
20515      }
20516    };
20517    var vTable = class {
20518      constructor(p22) {
20519        this.yPelHeight = p22.uint16;
20520        this.yMax = p22.int16;
20521        this.yMin = p22.int16;
20522      }
20523    };
20524    var VDMX$1 = Object.freeze({ __proto__: null, VDMX });
20525    var vhea = class extends SimpleTable {
20526      constructor(dict, dataview) {
20527        const { p: p22 } = super(dict, dataview);
20528        this.version = p22.fixed;
20529        this.ascent = this.vertTypoAscender = p22.int16;
20530        this.descent = this.vertTypoDescender = p22.int16;
20531        this.lineGap = this.vertTypoLineGap = p22.int16;
20532        this.advanceHeightMax = p22.int16;
20533        this.minTopSideBearing = p22.int16;
20534        this.minBottomSideBearing = p22.int16;
20535        this.yMaxExtent = p22.int16;
20536        this.caretSlopeRise = p22.int16;
20537        this.caretSlopeRun = p22.int16;
20538        this.caretOffset = p22.int16;
20539        this.reserved = p22.int16;
20540        this.reserved = p22.int16;
20541        this.reserved = p22.int16;
20542        this.reserved = p22.int16;
20543        this.metricDataFormat = p22.int16;
20544        this.numOfLongVerMetrics = p22.uint16;
20545        p22.verifyLength();
20546      }
20547    };
20548    var vhea$1 = Object.freeze({ __proto__: null, vhea });
20549    var vmtx = class extends SimpleTable {
20550      constructor(dict, dataview, tables) {
20551        super(dict, dataview);
20552        const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics;
20553        const numGlyphs = tables.maxp.numGlyphs;
20554        const metricsStart = p.currentPosition;
20555        lazy(this, `vMetrics`, () => {
20556          p.currentPosition = metricsStart;
20557          return [...new Array(numOfLongVerMetrics)].map(
20558            (_) => new LongVertMetric(p.uint16, p.int16)
20559          );
20560        });
20561        if (numOfLongVerMetrics < numGlyphs) {
20562          const tsbStart = metricsStart + numOfLongVerMetrics * 4;
20563          lazy(this, `topSideBearings`, () => {
20564            p.currentPosition = tsbStart;
20565            return [...new Array(numGlyphs - numOfLongVerMetrics)].map(
20566              (_) => p.int16
20567            );
20568          });
20569        }
20570      }
20571    };
20572    var LongVertMetric = class {
20573      constructor(h2, b2) {
20574        this.advanceHeight = h2;
20575        this.topSideBearing = b2;
20576      }
20577    };
20578    var vmtx$1 = Object.freeze({ __proto__: null, vmtx });
20579  
20580    // packages/global-styles-ui/build-module/font-library/utils/make-families-from-faces.mjs
20581    var import_components38 = __toESM(require_components(), 1);
20582    var { kebabCase: kebabCase3 } = unlock2(import_components38.privateApis);
20583  
20584    // packages/global-styles-ui/build-module/font-library/upload-fonts.mjs
20585    var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1);
20586  
20587    // packages/global-styles-ui/build-module/font-library/modal.mjs
20588    var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1);
20589    var { Tabs } = unlock2(import_components40.privateApis);
20590    var DEFAULT_TAB = {
20591      id: "installed-fonts",
20592      title: (0, import_i18n28._x)("Library", "Font library")
20593    };
20594    var UPLOAD_TAB = {
20595      id: "upload-fonts",
20596      title: (0, import_i18n28._x)("Upload", "noun")
20597    };
20598  
20599    // packages/global-styles-ui/build-module/font-family-item.mjs
20600    var import_i18n29 = __toESM(require_i18n(), 1);
20601    var import_components41 = __toESM(require_components(), 1);
20602    var import_element34 = __toESM(require_element(), 1);
20603    var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1);
20604  
20605    // packages/global-styles-ui/build-module/font-families.mjs
20606    var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1);
20607  
20608    // packages/global-styles-ui/build-module/font-sizes/font-sizes-count.mjs
20609    var import_i18n31 = __toESM(require_i18n(), 1);
20610    var import_components43 = __toESM(require_components(), 1);
20611    var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1);
20612  
20613    // packages/global-styles-ui/build-module/screen-typography.mjs
20614    var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1);
20615  
20616    // packages/global-styles-ui/build-module/screen-typography-element.mjs
20617    var import_i18n33 = __toESM(require_i18n(), 1);
20618    var import_components45 = __toESM(require_components(), 1);
20619    var import_element37 = __toESM(require_element(), 1);
20620  
20621    // packages/global-styles-ui/build-module/typography-panel.mjs
20622    var import_block_editor8 = __toESM(require_block_editor(), 1);
20623    var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1);
20624    var { useSettingsForBlockElement: useSettingsForBlockElement4, TypographyPanel: StylesTypographyPanel2 } = unlock2(import_block_editor8.privateApis);
20625  
20626    // packages/global-styles-ui/build-module/typography-preview.mjs
20627    var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1);
20628  
20629    // packages/global-styles-ui/build-module/screen-typography-element.mjs
20630    var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1);
20631    var elements = {
20632      text: {
20633        description: (0, import_i18n33.__)("Manage the fonts used on the site."),
20634        title: (0, import_i18n33.__)("Text")
20635      },
20636      link: {
20637        description: (0, import_i18n33.__)("Manage the fonts and typography used on the links."),
20638        title: (0, import_i18n33.__)("Links")
20639      },
20640      heading: {
20641        description: (0, import_i18n33.__)("Manage the fonts and typography used on headings."),
20642        title: (0, import_i18n33.__)("Headings")
20643      },
20644      caption: {
20645        description: (0, import_i18n33.__)("Manage the fonts and typography used on captions."),
20646        title: (0, import_i18n33.__)("Captions")
20647      },
20648      button: {
20649        description: (0, import_i18n33.__)("Manage the fonts and typography used on buttons."),
20650        title: (0, import_i18n33.__)("Buttons")
20651      }
20652    };
20653  
20654    // packages/global-styles-ui/build-module/screen-colors.mjs
20655    var import_i18n35 = __toESM(require_i18n(), 1);
20656    var import_components48 = __toESM(require_components(), 1);
20657    var import_block_editor9 = __toESM(require_block_editor(), 1);
20658  
20659    // packages/global-styles-ui/build-module/palette.mjs
20660    var import_components47 = __toESM(require_components(), 1);
20661    var import_i18n34 = __toESM(require_i18n(), 1);
20662    var import_element38 = __toESM(require_element(), 1);
20663  
20664    // packages/global-styles-ui/build-module/color-indicator-wrapper.mjs
20665    var import_components46 = __toESM(require_components(), 1);
20666    var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1);
20667  
20668    // packages/global-styles-ui/build-module/palette.mjs
20669    var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1);
20670  
20671    // packages/global-styles-ui/build-module/screen-colors.mjs
20672    var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1);
20673    var { useSettingsForBlockElement: useSettingsForBlockElement5, ColorPanel: StylesColorPanel2 } = unlock2(
20674      import_block_editor9.privateApis
20675    );
20676  
20677    // packages/global-styles-ui/build-module/screen-color-palette.mjs
20678    var import_i18n38 = __toESM(require_i18n(), 1);
20679    var import_components53 = __toESM(require_components(), 1);
20680  
20681    // packages/global-styles-ui/build-module/color-palette-panel.mjs
20682    var import_compose6 = __toESM(require_compose(), 1);
20683    var import_components51 = __toESM(require_components(), 1);
20684    var import_i18n36 = __toESM(require_i18n(), 1);
20685  
20686    // packages/global-styles-ui/build-module/variations/variations-color.mjs
20687    var import_components50 = __toESM(require_components(), 1);
20688  
20689    // packages/global-styles-ui/build-module/preview-colors.mjs
20690    var import_components49 = __toESM(require_components(), 1);
20691  
20692    // packages/global-styles-ui/build-module/preset-colors.mjs
20693    var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1);
20694    function PresetColors() {
20695      const { paletteColors } = useStylesPreviewColors();
20696      return paletteColors.slice(0, 4).map(({ slug, color }, index) => /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
20697        "div",
20698        {
20699          style: {
20700            flexGrow: 1,
20701            height: "100%",
20702            background: color
20703          }
20704        },
20705        `$slug}-$index}`
20706      ));
20707    }
20708  
20709    // packages/global-styles-ui/build-module/preview-colors.mjs
20710    var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1);
20711    var firstFrameVariants2 = {
20712      start: {
20713        scale: 1,
20714        opacity: 1
20715      },
20716      hover: {
20717        scale: 0,
20718        opacity: 0
20719      }
20720    };
20721    var StylesPreviewColors = ({
20722      label,
20723      isFocused,
20724      withHoverView
20725    }) => {
20726      return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
20727        preview_wrapper_default,
20728        {
20729          label,
20730          isFocused,
20731          withHoverView,
20732          children: ({ key }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
20733            import_components49.__unstableMotion.div,
20734            {
20735              variants: firstFrameVariants2,
20736              style: {
20737                height: "100%",
20738                overflow: "hidden"
20739              },
20740              children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
20741                import_components49.__experimentalHStack,
20742                {
20743                  spacing: 0,
20744                  justify: "center",
20745                  style: {
20746                    height: "100%",
20747                    overflow: "hidden"
20748                  },
20749                  children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(PresetColors, {})
20750                }
20751              )
20752            },
20753            key
20754          )
20755        }
20756      );
20757    };
20758    var preview_colors_default = StylesPreviewColors;
20759  
20760    // packages/global-styles-ui/build-module/variations/variations-color.mjs
20761    var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1);
20762    var propertiesToFilter2 = ["color"];
20763    function ColorVariations({
20764      title,
20765      gap = 2
20766    }) {
20767      const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig(propertiesToFilter2);
20768      if (colorVariations?.length <= 1) {
20769        return null;
20770      }
20771      return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_components50.__experimentalVStack, { spacing: 3, children: [
20772        title && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Subtitle, { level: 3, children: title }),
20773        /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components50.__experimentalGrid, { gap, children: colorVariations.map((variation, index) => /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
20774          Variation,
20775          {
20776            variation,
20777            isPill: true,
20778            properties: propertiesToFilter2,
20779            showTooltip: true,
20780            children: () => /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(preview_colors_default, {})
20781          },
20782          index
20783        )) })
20784      ] });
20785    }
20786  
20787    // packages/global-styles-ui/build-module/color-palette-panel.mjs
20788    var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1);
20789  
20790    // packages/global-styles-ui/build-module/gradients-palette-panel.mjs
20791    var import_compose7 = __toESM(require_compose(), 1);
20792    var import_components52 = __toESM(require_components(), 1);
20793    var import_i18n37 = __toESM(require_i18n(), 1);
20794    var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1);
20795  
20796    // packages/global-styles-ui/build-module/screen-color-palette.mjs
20797    var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1);
20798    var { Tabs: Tabs2 } = unlock2(import_components53.privateApis);
20799  
20800    // packages/global-styles-ui/build-module/screen-background.mjs
20801    var import_i18n39 = __toESM(require_i18n(), 1);
20802    var import_block_editor11 = __toESM(require_block_editor(), 1);
20803    var import_components54 = __toESM(require_components(), 1);
20804  
20805    // packages/global-styles-ui/build-module/background-panel.mjs
20806    var import_block_editor10 = __toESM(require_block_editor(), 1);
20807    var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1);
20808    var { BackgroundPanel: StylesBackgroundPanel2 } = unlock2(
20809      import_block_editor10.privateApis
20810    );
20811  
20812    // packages/global-styles-ui/build-module/screen-background.mjs
20813    var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1);
20814    var { useHasBackgroundPanel: useHasBackgroundPanel3 } = unlock2(import_block_editor11.privateApis);
20815  
20816    // packages/global-styles-ui/build-module/shadows-panel.mjs
20817    var import_components56 = __toESM(require_components(), 1);
20818    var import_i18n41 = __toESM(require_i18n(), 1);
20819    var import_element39 = __toESM(require_element(), 1);
20820  
20821    // packages/global-styles-ui/build-module/confirm-reset-shadow-dialog.mjs
20822    var import_components55 = __toESM(require_components(), 1);
20823    var import_i18n40 = __toESM(require_i18n(), 1);
20824    var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1);
20825  
20826    // packages/global-styles-ui/build-module/shadows-panel.mjs
20827    var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1);
20828    var { Menu } = unlock2(import_components56.privateApis);
20829  
20830    // packages/global-styles-ui/build-module/shadows-edit-panel.mjs
20831    var import_components57 = __toESM(require_components(), 1);
20832    var import_i18n42 = __toESM(require_i18n(), 1);
20833    var import_element40 = __toESM(require_element(), 1);
20834    var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1);
20835    var { Menu: Menu2 } = unlock2(import_components57.privateApis);
20836    var customShadowMenuItems = [
20837      {
20838        label: (0, import_i18n42.__)("Rename"),
20839        action: "rename"
20840      },
20841      {
20842        label: (0, import_i18n42.__)("Delete"),
20843        action: "delete"
20844      }
20845    ];
20846    var presetShadowMenuItems = [
20847      {
20848        label: (0, import_i18n42.__)("Reset"),
20849        action: "reset"
20850      }
20851    ];
20852  
20853    // packages/global-styles-ui/build-module/screen-shadows.mjs
20854    var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1);
20855  
20856    // packages/global-styles-ui/build-module/screen-layout.mjs
20857    var import_i18n43 = __toESM(require_i18n(), 1);
20858    var import_block_editor13 = __toESM(require_block_editor(), 1);
20859  
20860    // packages/global-styles-ui/build-module/dimensions-panel.mjs
20861    var import_block_editor12 = __toESM(require_block_editor(), 1);
20862    var import_element41 = __toESM(require_element(), 1);
20863    var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1);
20864    var { useSettingsForBlockElement: useSettingsForBlockElement6, DimensionsPanel: StylesDimensionsPanel2 } = unlock2(import_block_editor12.privateApis);
20865  
20866    // packages/global-styles-ui/build-module/screen-layout.mjs
20867    var import_jsx_runtime134 = __toESM(require_jsx_runtime(), 1);
20868    var { useHasDimensionsPanel: useHasDimensionsPanel4, useSettingsForBlockElement: useSettingsForBlockElement7 } = unlock2(
20869      import_block_editor13.privateApis
20870    );
20871  
20872    // packages/global-styles-ui/build-module/screen-style-variations.mjs
20873    var import_components60 = __toESM(require_components(), 1);
20874    var import_i18n46 = __toESM(require_i18n(), 1);
20875  
20876    // packages/global-styles-ui/build-module/style-variations-content.mjs
20877    var import_i18n45 = __toESM(require_i18n(), 1);
20878    var import_components59 = __toESM(require_components(), 1);
20879  
20880    // packages/global-styles-ui/build-module/style-variations-container.mjs
20881    var import_core_data22 = __toESM(require_core_data(), 1);
20882    var import_data26 = __toESM(require_data(), 1);
20883    var import_element42 = __toESM(require_element(), 1);
20884    var import_components58 = __toESM(require_components(), 1);
20885    var import_i18n44 = __toESM(require_i18n(), 1);
20886    var import_jsx_runtime135 = __toESM(require_jsx_runtime(), 1);
20887    function StyleVariationsContainer({
20888      gap = 2
20889    }) {
20890      const { user } = (0, import_element42.useContext)(GlobalStylesContext);
20891      const userStyles = user?.styles;
20892      const variations = (0, import_data26.useSelect)((select3) => {
20893        const result = select3(
20894          import_core_data22.store
20895        ).__experimentalGetCurrentThemeGlobalStylesVariations();
20896        return Array.isArray(result) ? result : void 0;
20897      }, []);
20898      const fullStyleVariations = variations?.filter(
20899        (variation) => {
20900          return !isVariationWithProperties(variation, ["color"]) && !isVariationWithProperties(variation, [
20901            "typography",
20902            "spacing"
20903          ]);
20904        }
20905      );
20906      const themeVariations = (0, import_element42.useMemo)(() => {
20907        const withEmptyVariation = [
20908          {
20909            title: (0, import_i18n44.__)("Default"),
20910            settings: {},
20911            styles: {}
20912          },
20913          ...fullStyleVariations ?? []
20914        ];
20915        return [
20916          ...withEmptyVariation.map((variation) => {
20917            const blockStyles = variation?.styles?.blocks ? { ...variation.styles.blocks } : {};
20918            if (userStyles?.blocks) {
20919              Object.keys(userStyles.blocks).forEach((blockName) => {
20920                if (userStyles.blocks?.[blockName]?.css) {
20921                  const variationBlockStyles = blockStyles[blockName] || {};
20922                  const customCSS = {
20923                    css: `$blockStyles[blockName]?.css || ""} $userStyles.blocks?.[blockName]?.css?.trim() || ""}`
20924                  };
20925                  blockStyles[blockName] = {
20926                    ...variationBlockStyles,
20927                    ...customCSS
20928                  };
20929                }
20930              });
20931            }
20932            const css = userStyles?.css || variation.styles?.css ? {
20933              css: `$variation.styles?.css || ""} $userStyles?.css || ""}`
20934            } : {};
20935            const blocks = Object.keys(blockStyles).length > 0 ? { blocks: blockStyles } : {};
20936            const styles = {
20937              ...variation.styles,
20938              ...css,
20939              ...blocks
20940            };
20941            return {
20942              ...variation,
20943              settings: variation.settings ?? {},
20944              styles
20945            };
20946          })
20947        ];
20948      }, [fullStyleVariations, userStyles?.blocks, userStyles?.css]);
20949      if (!fullStyleVariations || fullStyleVariations.length < 1) {
20950        return null;
20951      }
20952      return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
20953        import_components58.__experimentalGrid,
20954        {
20955          columns: 2,
20956          className: "global-styles-ui-style-variations-container",
20957          gap,
20958          children: themeVariations.map(
20959            (variation, index) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Variation, { variation, children: (isFocused) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
20960              preview_styles_default,
20961              {
20962                label: variation?.title,
20963                withHoverView: true,
20964                isFocused,
20965                variation
20966              }
20967            ) }, index)
20968          )
20969        }
20970      );
20971    }
20972    var style_variations_container_default = StyleVariationsContainer;
20973  
20974    // packages/global-styles-ui/build-module/style-variations-content.mjs
20975    var import_jsx_runtime136 = __toESM(require_jsx_runtime(), 1);
20976  
20977    // packages/global-styles-ui/build-module/screen-style-variations.mjs
20978    var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1);
20979  
20980    // packages/global-styles-ui/build-module/screen-css.mjs
20981    var import_i18n47 = __toESM(require_i18n(), 1);
20982    var import_components61 = __toESM(require_components(), 1);
20983    var import_block_editor14 = __toESM(require_block_editor(), 1);
20984    var import_jsx_runtime138 = __toESM(require_jsx_runtime(), 1);
20985    var { AdvancedPanel: StylesAdvancedPanel2 } = unlock2(import_block_editor14.privateApis);
20986  
20987    // packages/global-styles-ui/build-module/screen-revisions/index.mjs
20988    var import_i18n50 = __toESM(require_i18n(), 1);
20989    var import_components64 = __toESM(require_components(), 1);
20990    var import_element44 = __toESM(require_element(), 1);
20991  
20992    // packages/global-styles-ui/build-module/screen-revisions/use-global-styles-revisions.mjs
20993    var import_data27 = __toESM(require_data(), 1);
20994    var import_core_data23 = __toESM(require_core_data(), 1);
20995    var import_element43 = __toESM(require_element(), 1);
20996    var SITE_EDITOR_AUTHORS_QUERY = {
20997      per_page: -1,
20998      _fields: "id,name,avatar_urls",
20999      context: "view",
21000      capabilities: ["edit_theme_options"]
21001    };
21002    var DEFAULT_QUERY = { per_page: 100, page: 1 };
21003    var EMPTY_ARRAY4 = [];
21004    function useGlobalStylesRevisions({
21005      query
21006    } = {}) {
21007      const { user: userConfig } = (0, import_element43.useContext)(GlobalStylesContext);
21008      const _query = (0, import_element43.useMemo)(
21009        () => ({ ...DEFAULT_QUERY, ...query }),
21010        [query]
21011      );
21012      const {
21013        authors,
21014        currentUser,
21015        isDirty,
21016        revisions,
21017        isLoadingGlobalStylesRevisions,
21018        revisionsCount
21019      } = (0, import_data27.useSelect)(
21020        (select3) => {
21021          const {
21022            __experimentalGetDirtyEntityRecords,
21023            getCurrentUser,
21024            getUsers,
21025            getRevisions,
21026            __experimentalGetCurrentGlobalStylesId,
21027            getEntityRecord,
21028            // @ts-expect-error
21029            isResolving
21030          } = select3(import_core_data23.store);
21031          const dirtyEntityRecords = __experimentalGetDirtyEntityRecords() || [];
21032          const _currentUser = getCurrentUser();
21033          const _isDirty = dirtyEntityRecords.length > 0;
21034          const globalStylesId = __experimentalGetCurrentGlobalStylesId();
21035          const globalStyles = globalStylesId ? getEntityRecord(
21036            "root",
21037            "globalStyles",
21038            globalStylesId
21039          ) : void 0;
21040          const _revisionsCount = (
21041            // @ts-expect-error - _links is not typed in GlobalStylesRevision
21042            globalStyles?._links?.["version-history"]?.[0]?.count ?? 0
21043          );
21044          const globalStylesRevisions = globalStylesId ? getRevisions(
21045            "root",
21046            "globalStyles",
21047            globalStylesId,
21048            _query
21049          ) || EMPTY_ARRAY4 : EMPTY_ARRAY4;
21050          const _authors = getUsers(SITE_EDITOR_AUTHORS_QUERY) || EMPTY_ARRAY4;
21051          const _isResolving = globalStylesId ? isResolving("getRevisions", [
21052            "root",
21053            "globalStyles",
21054            globalStylesId,
21055            _query
21056          ]) : false;
21057          return {
21058            authors: _authors,
21059            currentUser: _currentUser,
21060            isDirty: _isDirty,
21061            revisions: globalStylesRevisions,
21062            isLoadingGlobalStylesRevisions: _isResolving,
21063            revisionsCount: _revisionsCount
21064          };
21065        },
21066        [_query]
21067      );
21068      return (0, import_element43.useMemo)(() => {
21069        if (!authors.length || isLoadingGlobalStylesRevisions) {
21070          return {
21071            revisions: EMPTY_ARRAY4,
21072            hasUnsavedChanges: isDirty,
21073            isLoading: true,
21074            revisionsCount
21075          };
21076        }
21077        const _modifiedRevisions = revisions.map((revision) => {
21078          return {
21079            ...revision,
21080            author: authors.find(
21081              (author) => author.id === revision.author
21082            )
21083          };
21084        });
21085        const fetchedRevisionsCount = revisions.length;
21086        if (fetchedRevisionsCount) {
21087          if (_modifiedRevisions[0].id !== "unsaved" && _query.page === 1) {
21088            _modifiedRevisions[0].isLatest = true;
21089          }
21090          if (isDirty && userConfig && Object.keys(userConfig).length > 0 && currentUser && _query.page === 1) {
21091            const unsavedRevision = {
21092              id: "unsaved",
21093              styles: userConfig?.styles,
21094              settings: userConfig?.settings,
21095              _links: userConfig?._links,
21096              author: {
21097                name: currentUser?.name || "",
21098                // @ts-expect-error - avatar_urls is not typed in User
21099                avatar_urls: currentUser?.avatar_urls || {}
21100              },
21101              modified: /* @__PURE__ */ new Date()
21102            };
21103            _modifiedRevisions.unshift(unsavedRevision);
21104          }
21105          if (_query.per_page && _query.page === Math.ceil(revisionsCount / _query.per_page)) {
21106            _modifiedRevisions.push({
21107              id: "parent",
21108              styles: {},
21109              settings: {}
21110            });
21111          }
21112        }
21113        return {
21114          revisions: _modifiedRevisions,
21115          hasUnsavedChanges: isDirty,
21116          isLoading: false,
21117          revisionsCount
21118        };
21119      }, [
21120        isDirty,
21121        revisions,
21122        currentUser,
21123        authors,
21124        userConfig,
21125        isLoadingGlobalStylesRevisions,
21126        revisionsCount,
21127        _query.page,
21128        _query.per_page
21129      ]);
21130    }
21131  
21132    // packages/global-styles-ui/build-module/screen-revisions/revisions-buttons.mjs
21133    var import_i18n48 = __toESM(require_i18n(), 1);
21134    var import_components62 = __toESM(require_components(), 1);
21135    var import_date = __toESM(require_date(), 1);
21136    var import_core_data24 = __toESM(require_core_data(), 1);
21137    var import_data28 = __toESM(require_data(), 1);
21138    var import_keycodes4 = __toESM(require_keycodes(), 1);
21139    var import_jsx_runtime139 = __toESM(require_jsx_runtime(), 1);
21140    var DAY_IN_MILLISECONDS = 60 * 60 * 1e3 * 24;
21141  
21142    // packages/global-styles-ui/build-module/pagination/index.mjs
21143    var import_components63 = __toESM(require_components(), 1);
21144    var import_i18n49 = __toESM(require_i18n(), 1);
21145    var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1);
21146  
21147    // packages/global-styles-ui/build-module/screen-revisions/index.mjs
21148    var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1);
21149  
21150    // packages/global-styles-ui/build-module/font-sizes/font-sizes.mjs
21151    var import_i18n52 = __toESM(require_i18n(), 1);
21152    var import_components66 = __toESM(require_components(), 1);
21153    var import_element45 = __toESM(require_element(), 1);
21154  
21155    // packages/global-styles-ui/build-module/font-sizes/confirm-reset-font-sizes-dialog.mjs
21156    var import_components65 = __toESM(require_components(), 1);
21157    var import_i18n51 = __toESM(require_i18n(), 1);
21158    var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1);
21159  
21160    // packages/global-styles-ui/build-module/font-sizes/font-sizes.mjs
21161    var import_jsx_runtime143 = __toESM(require_jsx_runtime(), 1);
21162    var { Menu: Menu3 } = unlock2(import_components66.privateApis);
21163  
21164    // packages/global-styles-ui/build-module/font-sizes/font-size.mjs
21165    var import_i18n56 = __toESM(require_i18n(), 1);
21166    var import_components70 = __toESM(require_components(), 1);
21167    var import_element47 = __toESM(require_element(), 1);
21168  
21169    // packages/global-styles-ui/build-module/font-sizes/font-size-preview.mjs
21170    var import_block_editor15 = __toESM(require_block_editor(), 1);
21171    var import_i18n53 = __toESM(require_i18n(), 1);
21172    var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1);
21173  
21174    // packages/global-styles-ui/build-module/font-sizes/confirm-delete-font-size-dialog.mjs
21175    var import_components67 = __toESM(require_components(), 1);
21176    var import_i18n54 = __toESM(require_i18n(), 1);
21177    var import_jsx_runtime145 = __toESM(require_jsx_runtime(), 1);
21178  
21179    // packages/global-styles-ui/build-module/font-sizes/rename-font-size-dialog.mjs
21180    var import_components68 = __toESM(require_components(), 1);
21181    var import_i18n55 = __toESM(require_i18n(), 1);
21182    var import_element46 = __toESM(require_element(), 1);
21183    var import_jsx_runtime146 = __toESM(require_jsx_runtime(), 1);
21184  
21185    // packages/global-styles-ui/build-module/size-control/index.mjs
21186    var import_components69 = __toESM(require_components(), 1);
21187    var import_jsx_runtime147 = __toESM(require_jsx_runtime(), 1);
21188  
21189    // packages/global-styles-ui/build-module/font-sizes/font-size.mjs
21190    var import_jsx_runtime148 = __toESM(require_jsx_runtime(), 1);
21191    var { Menu: Menu4 } = unlock2(import_components70.privateApis);
21192  
21193    // packages/global-styles-ui/build-module/global-styles-ui.mjs
21194    var import_jsx_runtime149 = __toESM(require_jsx_runtime(), 1);
21195  
21196    // packages/global-styles-ui/build-module/with-global-styles-provider.mjs
21197    var import_jsx_runtime150 = __toESM(require_jsx_runtime(), 1);
21198    function withGlobalStylesProvider(Component) {
21199      return function WrappedComponent({
21200        value,
21201        baseValue,
21202        onChange,
21203        ...props
21204      }) {
21205        return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
21206          GlobalStylesProvider,
21207          {
21208            value,
21209            baseValue,
21210            onChange,
21211            children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Component, { ...props })
21212          }
21213        );
21214      };
21215    }
21216  
21217    // packages/global-styles-ui/build-module/style-variations.mjs
21218    var StyleVariations = withGlobalStylesProvider(style_variations_container_default);
21219  
21220    // packages/global-styles-ui/build-module/color-variations.mjs
21221    var ColorVariations2 = withGlobalStylesProvider(ColorVariations);
21222  
21223    // packages/global-styles-ui/build-module/typography-variations.mjs
21224    var TypographyVariations2 = withGlobalStylesProvider(TypographyVariations);
21225  
21226    // packages/global-styles-ui/build-module/font-library/font-library.mjs
21227    var import_jsx_runtime151 = __toESM(require_jsx_runtime(), 1);
21228  
21229    // packages/edit-site/build-module/components/sidebar-navigation-screen-details-footer/index.mjs
21230    var import_i18n57 = __toESM(require_i18n(), 1);
21231    var import_url6 = __toESM(require_url(), 1);
21232    var import_components72 = __toESM(require_components(), 1);
21233    var import_jsx_runtime152 = __toESM(require_jsx_runtime(), 1);
21234    function SidebarNavigationScreenDetailsFooter({
21235      record,
21236      revisionsCount,
21237      ...otherProps
21238    }) {
21239      const hrefProps = {};
21240      const lastRevisionId = record?._links?.["predecessor-version"]?.[0]?.id ?? null;
21241      revisionsCount = revisionsCount || record?._links?.["version-history"]?.[0]?.count || 0;
21242      if (lastRevisionId && revisionsCount > 1) {
21243        hrefProps.href = (0, import_url6.addQueryArgs)("revision.php", {
21244          revision: record?._links["predecessor-version"][0].id
21245        });
21246        hrefProps.as = "a";
21247      }
21248      return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
21249        import_components72.__experimentalItemGroup,
21250        {
21251          size: "large",
21252          className: "edit-site-sidebar-navigation-screen-details-footer",
21253          children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
21254            SidebarNavigationItem,
21255            {
21256              icon: backup_default,
21257              ...hrefProps,
21258              ...otherProps,
21259              children: (0, import_i18n57.sprintf)(
21260                /* translators: %d: Number of Styles revisions. */
21261                (0, import_i18n57._n)("%d Revision", "%d Revisions", revisionsCount),
21262                revisionsCount
21263              )
21264            }
21265          )
21266        }
21267      );
21268    }
21269  
21270    // packages/edit-site/build-module/components/sidebar-navigation-screen-global-styles/index.mjs
21271    var import_jsx_runtime153 = __toESM(require_jsx_runtime(), 1);
21272    var { useLocation: useLocation10, useHistory: useHistory7 } = unlock(import_router11.privateApis);
21273    function SidebarNavigationItemGlobalStyles(props) {
21274      const { name: name2 } = useLocation10();
21275      return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
21276        SidebarNavigationItem,
21277        {
21278          ...props,
21279          "aria-current": name2 === "styles"
21280        }
21281      );
21282    }
21283    function SidebarNavigationScreenGlobalStyles() {
21284      const history = useHistory7();
21285      const { path } = useLocation10();
21286      const {
21287        revisions,
21288        isLoading: isLoadingRevisions,
21289        revisionsCount
21290      } = useGlobalStylesRevisions();
21291      const { openGeneralSidebar: openGeneralSidebar2 } = (0, import_data30.useDispatch)(store);
21292      const { setStylesPath } = unlock((0, import_data30.useDispatch)(import_editor8.store));
21293      const { set: setPreference } = (0, import_data30.useDispatch)(import_preferences5.store);
21294      const openGlobalStyles = (0, import_element49.useCallback)(async () => {
21295        history.navigate((0, import_url7.addQueryArgs)(path, { canvas: "edit" }), {
21296          transition: "canvas-mode-edit-transition"
21297        });
21298        return Promise.all([
21299          setPreference("core", "distractionFree", false),
21300          openGeneralSidebar2("edit-site/global-styles")
21301        ]);
21302      }, [path, history, openGeneralSidebar2, setPreference]);
21303      const openRevisions = (0, import_element49.useCallback)(async () => {
21304        await openGlobalStyles();
21305        setStylesPath("/revisions");
21306      }, [openGlobalStyles, setStylesPath]);
21307      const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions;
21308      return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_jsx_runtime153.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
21309        SidebarNavigationScreen,
21310        {
21311          title: (0, import_i18n58.__)("Design"),
21312          isRoot: true,
21313          description: (0, import_i18n58.__)(
21314            "Customize the appearance of your website using the block editor."
21315          ),
21316          content: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(MainSidebarNavigationContent, { activeItem: "styles-navigation-item" }),
21317          footer: shouldShowGlobalStylesFooter && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
21318            SidebarNavigationScreenDetailsFooter,
21319            {
21320              record: revisions?.[0],
21321              revisionsCount,
21322              onClick: openRevisions
21323            }
21324          )
21325        }
21326      ) });
21327    }
21328  
21329    // packages/edit-site/build-module/components/sidebar-navigation-screen-main/index.mjs
21330    var import_jsx_runtime154 = __toESM(require_jsx_runtime(), 1);
21331    function MainSidebarNavigationContent({ isBlockBasedTheme = true }) {
21332      return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(import_components73.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-main", children: [
21333        isBlockBasedTheme && /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(import_jsx_runtime154.Fragment, { children: [
21334          /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
21335            SidebarNavigationItemGlobalStyles,
21336            {
21337              to: "/styles",
21338              uid: "global-styles-navigation-item",
21339              icon: styles_default,
21340              children: (0, import_i18n59.__)("Styles")
21341            }
21342          ),
21343          /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
21344            SidebarNavigationItem,
21345            {
21346              uid: "navigation-navigation-item",
21347              to: "/navigation",
21348              withChevron: true,
21349              icon: navigation_default,
21350              children: (0, import_i18n59.__)("Navigation")
21351            }
21352          ),
21353          /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
21354            SidebarNavigationItem,
21355            {
21356              uid: "page-navigation-item",
21357              to: "/page",
21358              withChevron: true,
21359              icon: page_default,
21360              children: (0, import_i18n59.__)("Pages")
21361            }
21362          ),
21363          /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
21364            SidebarNavigationItem,
21365            {
21366              uid: "template-navigation-item",
21367              to: "/template",
21368              withChevron: true,
21369              icon: layout_default,
21370              children: (0, import_i18n59.__)("Templates")
21371            }
21372          )
21373        ] }),
21374        !isBlockBasedTheme && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
21375          SidebarNavigationItem,
21376          {
21377            uid: "stylebook-navigation-item",
21378            to: "/stylebook",
21379            withChevron: true,
21380            icon: styles_default,
21381            children: (0, import_i18n59.__)("Styles")
21382          }
21383        ),
21384        /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
21385          SidebarNavigationItem,
21386          {
21387            uid: "patterns-navigation-item",
21388            to: "/pattern",
21389            withChevron: true,
21390            icon: symbol_default,
21391            children: (0, import_i18n59.__)("Patterns")
21392          }
21393        )
21394      ] });
21395    }
21396    function SidebarNavigationScreenMain({ customDescription }) {
21397      const isBlockBasedTheme = (0, import_data31.useSelect)(
21398        (select3) => select3(import_core_data25.store).getCurrentTheme()?.is_block_theme,
21399        []
21400      );
21401      let description;
21402      if (customDescription) {
21403        description = customDescription;
21404      } else if (isBlockBasedTheme) {
21405        description = (0, import_i18n59.__)(
21406          "Customize the appearance of your website using the block editor."
21407        );
21408      } else {
21409        description = (0, import_i18n59.__)(
21410          "Explore block styles and patterns to refine your site."
21411        );
21412      }
21413      return /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
21414        SidebarNavigationScreen,
21415        {
21416          isRoot: true,
21417          title: (0, import_i18n59.__)("Design"),
21418          description,
21419          content: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
21420            MainSidebarNavigationContent,
21421            {
21422              isBlockBasedTheme
21423            }
21424          )
21425        }
21426      );
21427    }
21428  
21429    // packages/edit-site/build-module/components/sidebar-navigation-screen-unsupported/index.mjs
21430    var import_i18n60 = __toESM(require_i18n(), 1);
21431    var import_components74 = __toESM(require_components(), 1);
21432    var import_jsx_runtime155 = __toESM(require_jsx_runtime(), 1);
21433    function SidebarNavigationScreenUnsupported() {
21434      return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(import_components74.__experimentalSpacer, { padding: 3, children: /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(import_components74.Notice, { status: "warning", isDismissible: false, children: (0, import_i18n60.__)(
21435        "The theme you are currently using does not support this screen."
21436      ) }) });
21437    }
21438  
21439    // packages/edit-site/build-module/components/editor/index.mjs
21440    var import_data48 = __toESM(require_data(), 1);
21441    var import_components82 = __toESM(require_components(), 1);
21442    var import_compose10 = __toESM(require_compose(), 1);
21443    var import_editor20 = __toESM(require_editor(), 1);
21444    var import_i18n70 = __toESM(require_i18n(), 1);
21445    var import_core_data34 = __toESM(require_core_data(), 1);
21446    var import_block_library = __toESM(require_block_library(), 1);
21447    var import_element58 = __toESM(require_element(), 1);
21448    var import_notices3 = __toESM(require_notices(), 1);
21449    var import_router18 = __toESM(require_router(), 1);
21450    var import_html_entities4 = __toESM(require_html_entities(), 1);
21451    var import_block_editor18 = __toESM(require_block_editor(), 1);
21452    var import_url11 = __toESM(require_url(), 1);
21453  
21454    // packages/edit-site/build-module/components/welcome-guide/editor.mjs
21455    var import_data32 = __toESM(require_data(), 1);
21456    var import_components75 = __toESM(require_components(), 1);
21457    var import_i18n61 = __toESM(require_i18n(), 1);
21458    var import_element50 = __toESM(require_element(), 1);
21459    var import_preferences6 = __toESM(require_preferences(), 1);
21460    var import_core_data26 = __toESM(require_core_data(), 1);
21461  
21462    // packages/edit-site/build-module/components/welcome-guide/image.mjs
21463    var import_jsx_runtime156 = __toESM(require_jsx_runtime(), 1);
21464    function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) {
21465      return /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("picture", { className: "edit-site-welcome-guide__image", children: [
21466        /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
21467          "source",
21468          {
21469            srcSet: nonAnimatedSrc,
21470            media: "(prefers-reduced-motion: reduce)"
21471          }
21472        ),
21473        /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })
21474      ] });
21475    }
21476  
21477    // packages/edit-site/build-module/components/welcome-guide/editor.mjs
21478    var import_jsx_runtime157 = __toESM(require_jsx_runtime(), 1);
21479    function WelcomeGuideEditor() {
21480      const { toggle } = (0, import_data32.useDispatch)(import_preferences6.store);
21481      const { isActive, isBlockBasedTheme } = (0, import_data32.useSelect)((select3) => {
21482        return {
21483          isActive: !!select3(import_preferences6.store).get(
21484            "core/edit-site",
21485            "welcomeGuide"
21486          ),
21487          isBlockBasedTheme: select3(import_core_data26.store).getCurrentTheme()?.is_block_theme
21488        };
21489      }, []);
21490      if (!isActive || !isBlockBasedTheme) {
21491        return null;
21492      }
21493      return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
21494        import_components75.Guide,
21495        {
21496          className: "edit-site-welcome-guide guide-editor",
21497          contentLabel: (0, import_i18n61.__)("Welcome to the site editor"),
21498          finishButtonText: (0, import_i18n61.__)("Get started"),
21499          onFinish: () => toggle("core/edit-site", "welcomeGuide"),
21500          pages: [
21501            {
21502              image: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
21503                WelcomeGuideImage,
21504                {
21505                  nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1",
21506                  animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1"
21507                }
21508              ),
21509              content: /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(import_jsx_runtime157.Fragment, { children: [
21510                /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: (0, import_i18n61.__)("Edit your site") }),
21511                /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0, import_i18n61.__)(
21512                  "Design everything on your site \u2014 from the header right down to the footer \u2014 using blocks."
21513                ) }),
21514                /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0, import_element50.createInterpolateElement)(
21515                  (0, import_i18n61.__)(
21516                    "Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors."
21517                  ),
21518                  {
21519                    StylesIconImage: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
21520                      "img",
21521                      {
21522                        alt: (0, import_i18n61.__)("styles"),
21523                        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"
21524                      }
21525                    )
21526                  }
21527                ) })
21528              ] })
21529            }
21530          ]
21531        }
21532      );
21533    }
21534  
21535    // packages/edit-site/build-module/components/welcome-guide/page.mjs
21536    var import_data33 = __toESM(require_data(), 1);
21537    var import_components76 = __toESM(require_components(), 1);
21538    var import_i18n62 = __toESM(require_i18n(), 1);
21539    var import_preferences7 = __toESM(require_preferences(), 1);
21540    var import_jsx_runtime158 = __toESM(require_jsx_runtime(), 1);
21541    function WelcomeGuidePage() {
21542      const { toggle } = (0, import_data33.useDispatch)(import_preferences7.store);
21543      const isVisible2 = (0, import_data33.useSelect)((select3) => {
21544        const isPageActive = !!select3(import_preferences7.store).get(
21545          "core/edit-site",
21546          "welcomeGuidePage"
21547        );
21548        const isEditorActive = !!select3(import_preferences7.store).get(
21549          "core/edit-site",
21550          "welcomeGuide"
21551        );
21552        return isPageActive && !isEditorActive;
21553      }, []);
21554      if (!isVisible2) {
21555        return null;
21556      }
21557      const heading = (0, import_i18n62.__)("Editing a page");
21558      return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
21559        import_components76.Guide,
21560        {
21561          className: "edit-site-welcome-guide guide-page",
21562          contentLabel: heading,
21563          finishButtonText: (0, import_i18n62.__)("Continue"),
21564          onFinish: () => toggle("core/edit-site", "welcomeGuidePage"),
21565          pages: [
21566            {
21567              image: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
21568                "video",
21569                {
21570                  className: "edit-site-welcome-guide__video",
21571                  autoPlay: true,
21572                  loop: true,
21573                  muted: true,
21574                  width: "312",
21575                  height: "240",
21576                  children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
21577                    "source",
21578                    {
21579                      src: "https://s.w.org/images/block-editor/editing-your-page.mp4",
21580                      type: "video/mp4"
21581                    }
21582                  )
21583                }
21584              ),
21585              content: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
21586                /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }),
21587                /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0, import_i18n62.__)(
21588                  // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
21589                  "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."
21590                ) })
21591              ] })
21592            }
21593          ]
21594        }
21595      );
21596    }
21597  
21598    // packages/edit-site/build-module/components/welcome-guide/template.mjs
21599    var import_data34 = __toESM(require_data(), 1);
21600    var import_components77 = __toESM(require_components(), 1);
21601    var import_i18n63 = __toESM(require_i18n(), 1);
21602    var import_preferences8 = __toESM(require_preferences(), 1);
21603    var import_editor9 = __toESM(require_editor(), 1);
21604    var import_jsx_runtime159 = __toESM(require_jsx_runtime(), 1);
21605    function WelcomeGuideTemplate() {
21606      const { toggle } = (0, import_data34.useDispatch)(import_preferences8.store);
21607      const { isActive, hasPreviousEntity } = (0, import_data34.useSelect)((select3) => {
21608        const { getEditorSettings } = select3(import_editor9.store);
21609        const { get } = select3(import_preferences8.store);
21610        return {
21611          isActive: get("core/edit-site", "welcomeGuideTemplate"),
21612          hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord
21613        };
21614      }, []);
21615      const isVisible2 = isActive && hasPreviousEntity;
21616      if (!isVisible2) {
21617        return null;
21618      }
21619      const heading = (0, import_i18n63.__)("Editing a template");
21620      return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
21621        import_components77.Guide,
21622        {
21623          className: "edit-site-welcome-guide guide-template",
21624          contentLabel: heading,
21625          finishButtonText: (0, import_i18n63.__)("Continue"),
21626          onFinish: () => toggle("core/edit-site", "welcomeGuideTemplate"),
21627          pages: [
21628            {
21629              image: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
21630                "video",
21631                {
21632                  className: "edit-site-welcome-guide__video",
21633                  autoPlay: true,
21634                  loop: true,
21635                  muted: true,
21636                  width: "312",
21637                  height: "240",
21638                  children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
21639                    "source",
21640                    {
21641                      src: "https://s.w.org/images/block-editor/editing-your-template.mp4",
21642                      type: "video/mp4"
21643                    }
21644                  )
21645                }
21646              ),
21647              content: /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(import_jsx_runtime159.Fragment, { children: [
21648                /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("h1", { className: "edit-site-welcome-guide__heading", children: heading }),
21649                /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("p", { className: "edit-site-welcome-guide__text", children: (0, import_i18n63.__)(
21650                  "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."
21651                ) })
21652              ] })
21653            }
21654          ]
21655        }
21656      );
21657    }
21658  
21659    // packages/edit-site/build-module/components/welcome-guide/index.mjs
21660    var import_jsx_runtime160 = __toESM(require_jsx_runtime(), 1);
21661    function WelcomeGuide({ postType: postType2 }) {
21662      return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(import_jsx_runtime160.Fragment, { children: [
21663        /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(WelcomeGuideEditor, {}),
21664        postType2 === "page" && /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(WelcomeGuidePage, {}),
21665        postType2 === "wp_template" && /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(WelcomeGuideTemplate, {})
21666      ] });
21667    }
21668  
21669    // packages/edit-site/build-module/components/canvas-loader/index.mjs
21670    var import_components78 = __toESM(require_components(), 1);
21671    var import_core_data27 = __toESM(require_core_data(), 1);
21672    var import_data35 = __toESM(require_data(), 1);
21673    var import_editor11 = __toESM(require_editor(), 1);
21674    var import_jsx_runtime161 = __toESM(require_jsx_runtime(), 1);
21675    var { Theme } = unlock(import_components78.privateApis);
21676    var { useStyle: useStyle3 } = unlock(import_editor11.privateApis);
21677    function CanvasLoader({ id }) {
21678      const textColor = useStyle3("color.text");
21679      const backgroundColor = useStyle3("color.background");
21680      const { elapsed, total } = (0, import_data35.useSelect)((select3) => {
21681        const selectorsByStatus = select3(import_core_data27.store).countSelectorsByStatus();
21682        const resolving = selectorsByStatus.resolving ?? 0;
21683        const finished = selectorsByStatus.finished ?? 0;
21684        return {
21685          elapsed: finished,
21686          total: finished + resolving
21687        };
21688      }, []);
21689      return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "edit-site-canvas-loader", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(Theme, { accent: textColor, background: backgroundColor, children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(import_components78.ProgressBar, { id, max: total, value: elapsed }) }) });
21690    }
21691  
21692    // packages/edit-site/build-module/components/block-editor/use-site-editor-settings.mjs
21693    var import_data38 = __toESM(require_data(), 1);
21694    var import_element53 = __toESM(require_element(), 1);
21695    var import_router14 = __toESM(require_router(), 1);
21696    var import_compose9 = __toESM(require_compose(), 1);
21697    var import_editor14 = __toESM(require_editor(), 1);
21698  
21699    // packages/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.mjs
21700    var import_data37 = __toESM(require_data(), 1);
21701    var import_router13 = __toESM(require_router(), 1);
21702    var import_element52 = __toESM(require_element(), 1);
21703    var import_url8 = __toESM(require_url(), 1);
21704    var import_core_data28 = __toESM(require_core_data(), 1);
21705    var import_editor13 = __toESM(require_editor(), 1);
21706  
21707    // packages/edit-site/build-module/components/block-editor/use-viewport-sync.mjs
21708    var import_element51 = __toESM(require_element(), 1);
21709    var import_data36 = __toESM(require_data(), 1);
21710    var import_router12 = __toESM(require_router(), 1);
21711    var import_editor12 = __toESM(require_editor(), 1);
21712    var { useLocation: useLocation11 } = unlock(import_router12.privateApis);
21713    var DEFAULT_DEVICE_TYPE = "Desktop";
21714    var VALID_DEVICE_TYPES = ["desktop", "tablet", "mobile"];
21715    var capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
21716    function useViewportSync() {
21717      const { query } = useLocation11();
21718      const { setDeviceType } = (0, import_data36.useDispatch)(import_editor12.store);
21719      (0, import_element51.useEffect)(() => {
21720        const viewport = query?.viewport?.toLowerCase();
21721        const isValid2 = VALID_DEVICE_TYPES.includes(viewport);
21722        setDeviceType(isValid2 ? capitalize(viewport) : DEFAULT_DEVICE_TYPE);
21723      }, [query?.viewport, setDeviceType]);
21724    }
21725    function ViewportSync() {
21726      useViewportSync();
21727      return null;
21728    }
21729  
21730    // packages/edit-site/build-module/components/block-editor/use-navigate-to-entity-record.mjs
21731    var { useHistory: useHistory8, useLocation: useLocation12 } = unlock(import_router13.privateApis);
21732    var VALID_VIEWPORTS = ["desktop", "tablet", "mobile"];
21733    function useNavigateToEntityRecord() {
21734      const history = useHistory8();
21735      const location = useLocation12();
21736      const { query, path } = location;
21737      const registry = (0, import_data37.useRegistry)();
21738      const currentDeviceType = (0, import_data37.useSelect)(
21739        (select3) => select3(import_editor13.store).getDeviceType(),
21740        []
21741      );
21742      const onNavigateToEntityRecord = (0, import_element52.useCallback)(
21743        (params) => {
21744          const currentPostType = registry.select(import_editor13.store).getCurrentPostType();
21745          const currentPostId = registry.select(import_editor13.store).getCurrentPostId();
21746          const entityEdits = registry.select(import_core_data28.store).getEntityRecordEdits(
21747            "postType",
21748            currentPostType,
21749            currentPostId
21750          );
21751          const externalClientId = entityEdits?.selection?.selectionStart?.clientId;
21752          const urlUpdates = { ...query };
21753          if (externalClientId) {
21754            urlUpdates.selectedBlock = externalClientId;
21755          }
21756          const requestedViewport = typeof params.viewport === "string" ? params.viewport.toLowerCase() : void 0;
21757          const isValidRequestedViewport = VALID_VIEWPORTS.includes(requestedViewport);
21758          if (isValidRequestedViewport) {
21759            const currentViewportLower = (currentDeviceType || DEFAULT_DEVICE_TYPE).toLowerCase();
21760            if (currentViewportLower === DEFAULT_DEVICE_TYPE.toLowerCase()) {
21761              delete urlUpdates.viewport;
21762            } else {
21763              urlUpdates.viewport = currentViewportLower;
21764            }
21765          }
21766          const hasUpdatesToSave = externalClientId || isValidRequestedViewport;
21767          if (hasUpdatesToSave) {
21768            history.navigate((0, import_url8.addQueryArgs)(path, urlUpdates), {
21769              replace: true
21770            });
21771          }
21772          const queryArgs = {
21773            canvas: "edit",
21774            focusMode: true
21775          };
21776          if (isValidRequestedViewport) {
21777            queryArgs.viewport = requestedViewport;
21778          }
21779          const url = (0, import_url8.addQueryArgs)(
21780            `/$params.postType}/$params.postId}`,
21781            queryArgs
21782          );
21783          history.navigate(url);
21784        },
21785        [history, path, query, registry, currentDeviceType]
21786      );
21787      return onNavigateToEntityRecord;
21788    }
21789  
21790    // packages/edit-site/build-module/components/block-editor/use-site-editor-settings.mjs
21791    var { useLocation: useLocation13, useHistory: useHistory9 } = unlock(import_router14.privateApis);
21792    var { useGlobalStyles: useGlobalStyles2 } = unlock(import_editor14.privateApis);
21793    function useNavigateToPreviousEntityRecord() {
21794      const location = useLocation13();
21795      const previousCanvas = (0, import_compose9.usePrevious)(location.query.canvas);
21796      const history = useHistory9();
21797      const goBack = (0, import_element53.useMemo)(() => {
21798        const isFocusMode = location.query.focusMode || location?.params?.postId && FOCUSABLE_ENTITIES.includes(location?.params?.postType);
21799        const didComeFromEditorCanvas = previousCanvas === "edit";
21800        const showBackButton = isFocusMode && didComeFromEditorCanvas;
21801        return showBackButton ? () => history.back() : void 0;
21802      }, [location, history, previousCanvas]);
21803      return goBack;
21804    }
21805    function useSpecificEditorSettings() {
21806      const { query } = useLocation13();
21807      const { canvas = "view" } = query;
21808      const onNavigateToEntityRecord = useNavigateToEntityRecord();
21809      const { merged: mergedConfig } = useGlobalStyles2();
21810      const { settings: settings2, currentPostIsTrashed } = (0, import_data38.useSelect)((select3) => {
21811        const { getSettings: getSettings7 } = select3(store);
21812        const { getCurrentPostAttribute } = select3(import_editor14.store);
21813        return {
21814          settings: getSettings7(),
21815          currentPostIsTrashed: getCurrentPostAttribute("status") === "trash"
21816        };
21817      }, []);
21818      const onNavigateToPreviousEntityRecord = useNavigateToPreviousEntityRecord();
21819      const [globalStyles, globalSettings] = (0, import_element53.useMemo)(() => {
21820        return generateGlobalStyles(mergedConfig, [], {
21821          disableRootPadding: false
21822        });
21823      }, [mergedConfig]);
21824      const defaultEditorSettings = (0, import_element53.useMemo)(() => {
21825        const nonGlobalStyles = (settings2?.styles ?? []).filter(
21826          (style) => !style.isGlobalStyles
21827        );
21828        return {
21829          ...settings2,
21830          styles: [
21831            ...nonGlobalStyles,
21832            ...globalStyles,
21833            {
21834              // Forming a "block formatting context" to prevent margin collapsing.
21835              // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
21836              css: canvas === "view" ? `body{min-height: 100vh; $currentPostIsTrashed ? "" : "cursor: pointer;"}}` : void 0
21837            }
21838          ],
21839          __experimentalFeatures: globalSettings,
21840          richEditingEnabled: true,
21841          supportsTemplateMode: true,
21842          focusMode: canvas !== "view",
21843          onNavigateToEntityRecord,
21844          onNavigateToPreviousEntityRecord,
21845          isPreviewMode: canvas === "view"
21846        };
21847      }, [
21848        settings2,
21849        globalStyles,
21850        globalSettings,
21851        canvas,
21852        currentPostIsTrashed,
21853        onNavigateToEntityRecord,
21854        onNavigateToPreviousEntityRecord
21855      ]);
21856      return defaultEditorSettings;
21857    }
21858  
21859    // packages/edit-site/build-module/components/plugin-template-setting-panel/index.mjs
21860    var import_editor15 = __toESM(require_editor(), 1);
21861    var import_data39 = __toESM(require_data(), 1);
21862    var import_components79 = __toESM(require_components(), 1);
21863    var import_deprecated3 = __toESM(require_deprecated(), 1);
21864    var import_jsx_runtime162 = __toESM(require_jsx_runtime(), 1);
21865    var { Fill, Slot } = (0, import_components79.createSlotFill)("PluginTemplateSettingPanel");
21866    var PluginTemplateSettingPanel = ({ children }) => {
21867      (0, import_deprecated3.default)("wp.editSite.PluginTemplateSettingPanel", {
21868        since: "6.6",
21869        version: "6.8",
21870        alternative: "wp.editor.PluginDocumentSettingPanel"
21871      });
21872      const isCurrentEntityTemplate = (0, import_data39.useSelect)(
21873        (select3) => select3(import_editor15.store).getCurrentPostType() === "wp_template",
21874        []
21875      );
21876      if (!isCurrentEntityTemplate) {
21877        return null;
21878      }
21879      return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(Fill, { children });
21880    };
21881    PluginTemplateSettingPanel.Slot = Slot;
21882    var plugin_template_setting_panel_default = PluginTemplateSettingPanel;
21883  
21884    // packages/edit-site/build-module/components/more-menu/index.mjs
21885    var import_editor16 = __toESM(require_editor(), 1);
21886  
21887    // packages/edit-site/build-module/components/more-menu/site-export.mjs
21888    var import_i18n64 = __toESM(require_i18n(), 1);
21889    var import_components80 = __toESM(require_components(), 1);
21890    var import_api_fetch3 = __toESM(require_api_fetch(), 1);
21891    var import_data40 = __toESM(require_data(), 1);
21892    var import_blob = __toESM(require_blob(), 1);
21893    var import_core_data29 = __toESM(require_core_data(), 1);
21894    var import_notices2 = __toESM(require_notices(), 1);
21895    var import_jsx_runtime163 = __toESM(require_jsx_runtime(), 1);
21896    function SiteExport() {
21897      const canExport = (0, import_data40.useSelect)((select3) => {
21898        const targetHints = select3(import_core_data29.store).getCurrentTheme()?._links?.["wp:export-theme"]?.[0]?.targetHints ?? {};
21899        return !!targetHints.allow?.includes("GET");
21900      }, []);
21901      const { createErrorNotice } = (0, import_data40.useDispatch)(import_notices2.store);
21902      if (!canExport) {
21903        return null;
21904      }
21905      async function handleExport() {
21906        try {
21907          const response = await (0, import_api_fetch3.default)({
21908            path: "/wp-block-editor/v1/export",
21909            parse: false,
21910            headers: {
21911              Accept: "application/zip"
21912            }
21913          });
21914          const blob = await response.blob();
21915          const contentDisposition = response.headers.get(
21916            "content-disposition"
21917          );
21918          const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/);
21919          const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : "edit-site-export";
21920          (0, import_blob.downloadBlob)(fileName + ".zip", blob, "application/zip");
21921        } catch (errorResponse) {
21922          let error = {};
21923          try {
21924            error = await errorResponse.json();
21925          } catch (e2) {
21926          }
21927          const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n64.__)("An error occurred while creating the site export.");
21928          createErrorNotice(errorMessage, { type: "snackbar" });
21929        }
21930      }
21931      return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
21932        import_components80.MenuItem,
21933        {
21934          role: "menuitem",
21935          icon: download_default,
21936          onClick: handleExport,
21937          info: (0, import_i18n64.__)(
21938            "Download your theme with updated templates and styles."
21939          ),
21940          children: (0, import_i18n64._x)("Export", "site exporter menu item")
21941        }
21942      );
21943    }
21944  
21945    // packages/edit-site/build-module/components/more-menu/welcome-guide-menu-item.mjs
21946    var import_i18n65 = __toESM(require_i18n(), 1);
21947    var import_data41 = __toESM(require_data(), 1);
21948    var import_components81 = __toESM(require_components(), 1);
21949    var import_preferences9 = __toESM(require_preferences(), 1);
21950    var import_jsx_runtime164 = __toESM(require_jsx_runtime(), 1);
21951    function WelcomeGuideMenuItem() {
21952      const { toggle } = (0, import_data41.useDispatch)(import_preferences9.store);
21953      return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(import_components81.MenuItem, { onClick: () => toggle("core/edit-site", "welcomeGuide"), children: (0, import_i18n65.__)("Welcome Guide") });
21954    }
21955  
21956    // packages/edit-site/build-module/components/more-menu/index.mjs
21957    var import_jsx_runtime165 = __toESM(require_jsx_runtime(), 1);
21958    var { ToolsMoreMenuGroup, PreferencesModal } = unlock(import_editor16.privateApis);
21959    function MoreMenu() {
21960      return /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(import_jsx_runtime165.Fragment, { children: [
21961        /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(ToolsMoreMenuGroup, { children: [
21962          /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(SiteExport, {}),
21963          /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(WelcomeGuideMenuItem, {})
21964        ] }),
21965        /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(PreferencesModal, {})
21966      ] });
21967    }
21968  
21969    // packages/edit-site/build-module/components/block-editor/use-editor-iframe-props.mjs
21970    var import_data42 = __toESM(require_data(), 1);
21971    var import_keycodes5 = __toESM(require_keycodes(), 1);
21972    var import_element54 = __toESM(require_element(), 1);
21973    var import_i18n66 = __toESM(require_i18n(), 1);
21974    var import_editor17 = __toESM(require_editor(), 1);
21975    var import_router15 = __toESM(require_router(), 1);
21976    var import_url9 = __toESM(require_url(), 1);
21977    var { useLocation: useLocation14, useHistory: useHistory10 } = unlock(import_router15.privateApis);
21978    function useEditorIframeProps() {
21979      const { query, path } = useLocation14();
21980      const history = useHistory10();
21981      const { canvas = "view" } = query;
21982      const currentPostIsTrashed = (0, import_data42.useSelect)((select3) => {
21983        return select3(import_editor17.store).getCurrentPostAttribute("status") === "trash";
21984      }, []);
21985      const [isFocused, setIsFocused] = (0, import_element54.useState)(false);
21986      (0, import_element54.useEffect)(() => {
21987        if (canvas === "edit") {
21988          setIsFocused(false);
21989        }
21990      }, [canvas]);
21991      const viewModeIframeProps = {
21992        "aria-label": (0, import_i18n66.__)("Edit"),
21993        "aria-disabled": currentPostIsTrashed,
21994        title: null,
21995        role: "button",
21996        tabIndex: 0,
21997        onFocus: () => setIsFocused(true),
21998        onBlur: () => setIsFocused(false),
21999        onKeyDown: (event) => {
22000          const { keyCode } = event;
22001          if ((keyCode === import_keycodes5.ENTER || keyCode === import_keycodes5.SPACE) && !currentPostIsTrashed) {
22002            event.preventDefault();
22003            history.navigate((0, import_url9.addQueryArgs)(path, { canvas: "edit" }), {
22004              transition: "canvas-mode-edit-transition"
22005            });
22006          }
22007        },
22008        onClick: () => history.navigate((0, import_url9.addQueryArgs)(path, { canvas: "edit" }), {
22009          transition: "canvas-mode-edit-transition"
22010        }),
22011        onClickCapture: (event) => {
22012          if (currentPostIsTrashed) {
22013            event.preventDefault();
22014            event.stopPropagation();
22015          }
22016        },
22017        readonly: true
22018      };
22019      return {
22020        className: clsx_default("edit-site-visual-editor__editor-canvas", {
22021          "is-focused": isFocused && canvas === "view"
22022        }),
22023        ...canvas === "view" ? viewModeIframeProps : {}
22024      };
22025    }
22026  
22027    // packages/edit-site/build-module/components/editor/use-editor-title.mjs
22028    var import_i18n68 = __toESM(require_i18n(), 1);
22029    var import_data44 = __toESM(require_data(), 1);
22030    var import_core_data31 = __toESM(require_core_data(), 1);
22031    var import_html_entities3 = __toESM(require_html_entities(), 1);
22032    var import_editor18 = __toESM(require_editor(), 1);
22033  
22034    // packages/edit-site/build-module/components/routes/use-title.mjs
22035    var import_element55 = __toESM(require_element(), 1);
22036    var import_data43 = __toESM(require_data(), 1);
22037    var import_core_data30 = __toESM(require_core_data(), 1);
22038    var import_i18n67 = __toESM(require_i18n(), 1);
22039    var import_a11y3 = __toESM(require_a11y(), 1);
22040    var import_html_entities2 = __toESM(require_html_entities(), 1);
22041    var import_router16 = __toESM(require_router(), 1);
22042    var { useLocation: useLocation15 } = unlock(import_router16.privateApis);
22043    function useTitle(title) {
22044      const location = useLocation15();
22045      const siteTitle = (0, import_data43.useSelect)(
22046        (select3) => select3(import_core_data30.store).getEntityRecord("root", "site")?.title,
22047        []
22048      );
22049      const isInitialLocationRef = (0, import_element55.useRef)(true);
22050      (0, import_element55.useEffect)(() => {
22051        isInitialLocationRef.current = false;
22052      }, [location]);
22053      (0, import_element55.useEffect)(() => {
22054        if (isInitialLocationRef.current) {
22055          return;
22056        }
22057        if (title && siteTitle) {
22058          const formattedTitle = (0, import_i18n67.sprintf)(
22059            /* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */
22060            (0, import_i18n67.__)("%1$s \u2039 %2$s \u2039 Editor \u2014 WordPress"),
22061            (0, import_html_entities2.decodeEntities)(title),
22062            (0, import_html_entities2.decodeEntities)(siteTitle)
22063          );
22064          document.title = formattedTitle;
22065          (0, import_a11y3.speak)(title, "assertive");
22066        }
22067      }, [title, siteTitle, location]);
22068    }
22069  
22070    // packages/edit-site/build-module/components/editor/use-editor-title.mjs
22071    var { getTemplateInfo } = unlock(import_editor18.privateApis);
22072    function useEditorTitle(postType2, postId) {
22073      const { title, isLoaded } = (0, import_data44.useSelect)(
22074        (select3) => {
22075          const {
22076            getEditedEntityRecord,
22077            getCurrentTheme,
22078            hasFinishedResolution
22079          } = select3(import_core_data31.store);
22080          if (!postId) {
22081            return { isLoaded: false };
22082          }
22083          const _record = getEditedEntityRecord(
22084            "postType",
22085            postType2,
22086            postId
22087          );
22088          const { default_template_types: templateTypes = [] } = getCurrentTheme() ?? {};
22089          const templateInfo = getTemplateInfo({
22090            template: _record,
22091            templateTypes
22092          });
22093          const _isLoaded = hasFinishedResolution("getEditedEntityRecord", [
22094            "postType",
22095            postType2,
22096            postId
22097          ]);
22098          return {
22099            title: templateInfo.title,
22100            isLoaded: _isLoaded
22101          };
22102        },
22103        [postType2, postId]
22104      );
22105      let editorTitle;
22106      if (isLoaded) {
22107        editorTitle = (0, import_i18n68.sprintf)(
22108          // translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).
22109          (0, import_i18n68._x)("%1$s \u2039 %2$s", "breadcrumb trail"),
22110          (0, import_html_entities3.decodeEntities)(title),
22111          POST_TYPE_LABELS[postType2] ?? POST_TYPE_LABELS[TEMPLATE_POST_TYPE]
22112        );
22113      }
22114      useTitle(isLoaded && editorTitle);
22115    }
22116    var use_editor_title_default = useEditorTitle;
22117  
22118    // packages/edit-site/build-module/components/editor/use-adapt-editor-to-canvas.mjs
22119    var import_data45 = __toESM(require_data(), 1);
22120    var import_block_editor17 = __toESM(require_block_editor(), 1);
22121    var import_editor19 = __toESM(require_editor(), 1);
22122    var import_element56 = __toESM(require_element(), 1);
22123    var import_preferences10 = __toESM(require_preferences(), 1);
22124    function useAdaptEditorToCanvas(canvas) {
22125      const { clearSelectedBlock } = (0, import_data45.useDispatch)(import_block_editor17.store);
22126      const {
22127        editPost,
22128        setDeviceType,
22129        closePublishSidebar,
22130        setIsListViewOpened: setIsListViewOpened2,
22131        setIsInserterOpened: setIsInserterOpened2
22132      } = (0, import_data45.useDispatch)(import_editor19.store);
22133      const { get: getPreference } = (0, import_data45.useSelect)(import_preferences10.store);
22134      const { getCurrentPost } = (0, import_data45.useSelect)(import_editor19.store);
22135      const registry = (0, import_data45.useRegistry)();
22136      (0, import_element56.useLayoutEffect)(() => {
22137        const isMediumOrBigger = window.matchMedia("(min-width: 782px)").matches;
22138        registry.batch(() => {
22139          clearSelectedBlock();
22140          if (getCurrentPost()?.type) {
22141            editPost({ selection: void 0 }, { undoIgnore: true });
22142          }
22143          setDeviceType(DEFAULT_DEVICE_TYPE);
22144          closePublishSidebar();
22145          setIsInserterOpened2(false);
22146          if (isMediumOrBigger && canvas === "edit" && getPreference("core", "showListViewByDefault") && !getPreference("core", "distractionFree")) {
22147            setIsListViewOpened2(true);
22148          } else {
22149            setIsListViewOpened2(false);
22150          }
22151        });
22152      }, [
22153        canvas,
22154        registry,
22155        clearSelectedBlock,
22156        editPost,
22157        setDeviceType,
22158        closePublishSidebar,
22159        setIsInserterOpened2,
22160        setIsListViewOpened2,
22161        getPreference,
22162        getCurrentPost
22163      ]);
22164    }
22165  
22166    // packages/edit-site/build-module/components/editor/use-resolve-edited-entity.mjs
22167    var import_element57 = __toESM(require_element(), 1);
22168    var import_data46 = __toESM(require_data(), 1);
22169    var import_core_data32 = __toESM(require_core_data(), 1);
22170    var import_router17 = __toESM(require_router(), 1);
22171    var { useLocation: useLocation16 } = unlock(import_router17.privateApis);
22172    var postTypesWithoutParentTemplate = [
22173      ATTACHMENT_POST_TYPE,
22174      TEMPLATE_POST_TYPE,
22175      TEMPLATE_PART_POST_TYPE,
22176      NAVIGATION_POST_TYPE,
22177      PATTERN_TYPES.user
22178    ];
22179    var authorizedPostTypes = ["page", "post"];
22180    function getPostType(name2) {
22181      let postType2;
22182      if (name2 === "navigation-item") {
22183        postType2 = NAVIGATION_POST_TYPE;
22184      } else if (name2 === "pattern-item") {
22185        postType2 = PATTERN_TYPES.user;
22186      } else if (name2 === "template-part-item") {
22187        postType2 = TEMPLATE_PART_POST_TYPE;
22188      } else if (name2 === "templates") {
22189        postType2 = TEMPLATE_POST_TYPE;
22190      } else if (name2 === "template-item") {
22191        postType2 = TEMPLATE_POST_TYPE;
22192      } else if (name2 === "page-item" || name2 === "pages") {
22193        postType2 = "page";
22194      } else if (name2 === "post-item" || name2 === "posts") {
22195        postType2 = "post";
22196      } else if (name2 === "attachment-item") {
22197        postType2 = ATTACHMENT_POST_TYPE;
22198      }
22199      return postType2;
22200    }
22201    function useResolveEditedEntity() {
22202      const { editEntityRecord } = (0, import_data46.useDispatch)(import_core_data32.store);
22203      const { hasEntityRecord } = (0, import_data46.useSelect)(import_core_data32.store);
22204      const { name: name2, params = {}, query } = useLocation16();
22205      const { postId = query?.postId } = params;
22206      const postType2 = getPostType(name2, postId) ?? query?.postType;
22207      const { selectedBlock } = query;
22208      const appliedSelectionRef = (0, import_element57.useRef)(null);
22209      const homePage = (0, import_data46.useSelect)((select3) => {
22210        const { getHomePage } = unlock(select3(import_core_data32.store));
22211        return getHomePage();
22212      }, []);
22213      const resolvedTemplateId = (0, import_data46.useSelect)(
22214        (select3) => {
22215          if (postTypesWithoutParentTemplate.includes(postType2) && postId) {
22216            return;
22217          }
22218          if (postId && postId.includes(",")) {
22219            return;
22220          }
22221          const { getTemplateId } = unlock(select3(import_core_data32.store));
22222          if (postType2 && postId && authorizedPostTypes.includes(postType2)) {
22223            return getTemplateId(postType2, postId);
22224          }
22225          if (homePage?.postType === "page") {
22226            return getTemplateId("page", homePage?.postId);
22227          }
22228          if (homePage?.postType === "wp_template") {
22229            return homePage?.postId;
22230          }
22231        },
22232        [homePage, postId, postType2]
22233      );
22234      const context = (0, import_element57.useMemo)(() => {
22235        if (postTypesWithoutParentTemplate.includes(postType2) && postId) {
22236          return {};
22237        }
22238        if (postType2 && postId && authorizedPostTypes.includes(postType2)) {
22239          return { postType: postType2, postId };
22240        }
22241        if (homePage?.postType === "page") {
22242          return { postType: "page", postId: homePage?.postId };
22243        }
22244        return {};
22245      }, [homePage, postType2, postId]);
22246      let entity;
22247      if (postTypesWithoutParentTemplate.includes(postType2) && postId) {
22248        entity = { isReady: true, postType: postType2, postId, context };
22249      } else if (!!homePage) {
22250        entity = {
22251          isReady: resolvedTemplateId !== void 0,
22252          postType: TEMPLATE_POST_TYPE,
22253          postId: resolvedTemplateId,
22254          context
22255        };
22256      } else {
22257        entity = { isReady: false };
22258      }
22259      if (selectedBlock && entity.isReady && appliedSelectionRef.current !== selectedBlock) {
22260        const selectionPostType = entity.context?.postId ? entity.context.postType : entity.postType;
22261        const selectionPostId = entity.context?.postId ? entity.context.postId : entity.postId;
22262        if (hasEntityRecord("postType", selectionPostType, selectionPostId)) {
22263          editEntityRecord(
22264            "postType",
22265            selectionPostType,
22266            selectionPostId,
22267            {
22268              selection: {
22269                selectionStart: { clientId: selectedBlock },
22270                selectionEnd: { clientId: selectedBlock }
22271              }
22272            },
22273            { undoIgnore: true }
22274          );
22275          appliedSelectionRef.current = selectedBlock;
22276        }
22277      }
22278      return entity;
22279    }
22280    function useSyncDeprecatedEntityIntoState({
22281      postType: postType2,
22282      postId,
22283      context,
22284      isReady
22285    }) {
22286      const { setEditedEntity: setEditedEntity2 } = (0, import_data46.useDispatch)(store);
22287      (0, import_element57.useEffect)(() => {
22288        if (isReady) {
22289          setEditedEntity2(postType2, String(postId), context);
22290        }
22291      }, [isReady, postType2, postId, context, setEditedEntity2]);
22292    }
22293  
22294    // packages/edit-site/build-module/components/editor/site-preview.mjs
22295    var import_i18n69 = __toESM(require_i18n(), 1);
22296    var import_data47 = __toESM(require_data(), 1);
22297    var import_core_data33 = __toESM(require_core_data(), 1);
22298    var import_dom2 = __toESM(require_dom(), 1);
22299    var import_url10 = __toESM(require_url(), 1);
22300    var import_jsx_runtime166 = __toESM(require_jsx_runtime(), 1);
22301    function SitePreview() {
22302      const siteUrl = (0, import_data47.useSelect)((select3) => {
22303        const { getEntityRecord } = select3(import_core_data33.store);
22304        const siteData = getEntityRecord("root", "__unstableBase");
22305        return siteData?.home;
22306      }, []);
22307      return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
22308        "iframe",
22309        {
22310          src: (0, import_url10.addQueryArgs)(siteUrl, {
22311            // Parameter for hiding the admin bar.
22312            wp_site_preview: 1
22313          }),
22314          title: (0, import_i18n69.__)("Site Preview"),
22315          style: {
22316            display: "block",
22317            width: "100%",
22318            height: "100%",
22319            backgroundColor: "#fff"
22320          },
22321          onLoad: (event) => {
22322            const document2 = event.target.contentDocument;
22323            const focusableElements = import_dom2.focus.focusable.find(document2);
22324            focusableElements.forEach((element) => {
22325              element.style.pointerEvents = "none";
22326              element.tabIndex = -1;
22327              element.setAttribute("aria-hidden", "true");
22328            });
22329          }
22330        }
22331      );
22332    }
22333  
22334    // packages/edit-site/build-module/components/editor/index.mjs
22335    var import_jsx_runtime167 = __toESM(require_jsx_runtime(), 1);
22336    var { Editor, BackButton } = unlock(import_editor20.privateApis);
22337    var { useHistory: useHistory11, useLocation: useLocation17 } = unlock(import_router18.privateApis);
22338    var { BlockKeyboardShortcuts } = unlock(import_block_library.privateApis);
22339    var toggleHomeIconVariants = {
22340      edit: {
22341        opacity: 0,
22342        scale: 0.2
22343      },
22344      hover: {
22345        opacity: 1,
22346        scale: 1,
22347        clipPath: "inset( 22% round 2px )"
22348      }
22349    };
22350    var siteIconVariants = {
22351      edit: {
22352        clipPath: "inset(0% round 0px)"
22353      },
22354      hover: {
22355        clipPath: "inset( 22% round 2px )"
22356      },
22357      tap: {
22358        clipPath: "inset(0% round 0px)"
22359      }
22360    };
22361    function getListPathForPostType(postType2) {
22362      switch (postType2) {
22363        case "navigation":
22364          return "/navigation";
22365        case "wp_block":
22366          return "/pattern?postType=wp_block";
22367        case "wp_template_part":
22368          return "/pattern?postType=wp_template_part";
22369        case "wp_template":
22370          return "/template";
22371        case "page":
22372          return "/page";
22373        case "post":
22374          return "/";
22375      }
22376      throw "Unknown post type";
22377    }
22378    function getNavigationPath(location, postType2) {
22379      const { path, name: name2 } = location;
22380      if ([
22381        "pattern-item",
22382        "template-part-item",
22383        "page-item",
22384        "template-item",
22385        "static-template-item",
22386        "post-item"
22387      ].includes(name2)) {
22388        return getListPathForPostType(postType2);
22389      }
22390      return (0, import_url11.addQueryArgs)(path, { canvas: void 0 });
22391    }
22392    function EditSiteEditor({ isHomeRoute = false }) {
22393      const disableMotion = (0, import_compose10.useReducedMotion)();
22394      const location = useLocation17();
22395      const history = useHistory11();
22396      const { canvas = "view" } = location.query;
22397      const isLoading = useIsSiteEditorLoading();
22398      useAdaptEditorToCanvas(canvas);
22399      const entity = useResolveEditedEntity();
22400      useSyncDeprecatedEntityIntoState(entity);
22401      const { postType: postType2, postId, context } = entity;
22402      const { isBlockBasedTheme, hasSiteIcon } = (0, import_data48.useSelect)((select3) => {
22403        const { getCurrentTheme, getEntityRecord } = select3(import_core_data34.store);
22404        const siteData = getEntityRecord("root", "__unstableBase", void 0);
22405        return {
22406          isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
22407          hasSiteIcon: !!siteData?.site_icon_url
22408        };
22409      }, []);
22410      const postWithTemplate = !!context?.postId;
22411      use_editor_title_default(
22412        postWithTemplate ? context.postType : postType2,
22413        postWithTemplate ? context.postId : postId
22414      );
22415      const _isPreviewingTheme = isPreviewingTheme();
22416      const iframeProps = useEditorIframeProps();
22417      const isEditMode = canvas === "edit";
22418      const loadingProgressId = (0, import_compose10.useInstanceId)(
22419        CanvasLoader,
22420        "edit-site-editor__loading-progress"
22421      );
22422      const editorSettings = useSpecificEditorSettings();
22423      const { resetZoomLevel } = unlock((0, import_data48.useDispatch)(import_block_editor18.store));
22424      const { setCurrentRevisionId } = unlock((0, import_data48.useDispatch)(import_editor20.store));
22425      const { createSuccessNotice } = (0, import_data48.useDispatch)(import_notices3.store);
22426      const onActionPerformed = (0, import_element58.useCallback)(
22427        (actionId, items) => {
22428          switch (actionId) {
22429            case "move-to-trash":
22430            case "delete-post":
22431              {
22432                history.navigate(
22433                  getListPathForPostType(
22434                    postWithTemplate ? context.postType : postType2
22435                  )
22436                );
22437              }
22438              break;
22439            case "duplicate-post":
22440              {
22441                const newItem = items[0];
22442                const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
22443                createSuccessNotice(
22444                  (0, import_i18n70.sprintf)(
22445                    // translators: %s: Title of the created post or template, e.g: "Hello world".
22446                    (0, import_i18n70.__)('"%s" successfully created.'),
22447                    (0, import_html_entities4.decodeEntities)(_title) || (0, import_i18n70.__)("(no title)")
22448                  ),
22449                  {
22450                    type: "snackbar",
22451                    id: "duplicate-post-action",
22452                    actions: [
22453                      {
22454                        label: (0, import_i18n70.__)("Edit"),
22455                        onClick: () => {
22456                          history.navigate(
22457                            `/$newItem.type}/$newItem.id}?canvas=edit`
22458                          );
22459                        }
22460                      }
22461                    ]
22462                  }
22463                );
22464              }
22465              break;
22466          }
22467        },
22468        [
22469          postType2,
22470          context?.postType,
22471          postWithTemplate,
22472          history,
22473          createSuccessNotice
22474        ]
22475      );
22476      const isReady = !isLoading;
22477      const transition = {
22478        duration: disableMotion ? 0 : 0.2
22479      };
22480      return !isBlockBasedTheme && isHomeRoute ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(SitePreview, {}) : /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(import_jsx_runtime167.Fragment, { children: [
22481        /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_editor20.EditorKeyboardShortcutsRegister, {}),
22482        isEditMode && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(BlockKeyboardShortcuts, {}),
22483        !isReady ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(CanvasLoader, { id: loadingProgressId }) : null,
22484        isEditMode && isReady && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
22485          WelcomeGuide,
22486          {
22487            postType: postWithTemplate ? context.postType : postType2
22488          }
22489        ),
22490        isReady && /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
22491          Editor,
22492          {
22493            postType: postWithTemplate ? context.postType : postType2,
22494            postId: postWithTemplate ? context.postId : postId,
22495            templateId: postWithTemplate ? postId : void 0,
22496            settings: editorSettings,
22497            className: "edit-site-editor__editor-interface",
22498            customSaveButton: _isPreviewingTheme && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(SaveButton, { size: "compact" }),
22499            customSavePanel: _isPreviewingTheme && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(SavePanel, {}),
22500            iframeProps,
22501            onActionPerformed,
22502            extraSidebarPanels: !postWithTemplate && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(plugin_template_setting_panel_default.Slot, {}),
22503            children: [
22504              isEditMode && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(ViewportSync, {}),
22505              isEditMode && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(BackButton, { children: ({ length }) => length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
22506                import_components82.__unstableMotion.div,
22507                {
22508                  className: "edit-site-editor__view-mode-toggle",
22509                  transition,
22510                  animate: "edit",
22511                  initial: "edit",
22512                  whileHover: "hover",
22513                  whileTap: "tap",
22514                  children: [
22515                    /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
22516                      import_components82.Button,
22517                      {
22518                        __next40pxDefaultSize: true,
22519                        label: (0, import_i18n70.__)("Open Navigation"),
22520                        showTooltip: true,
22521                        tooltipPosition: "middle right",
22522                        onClick: () => {
22523                          resetZoomLevel();
22524                          setCurrentRevisionId(null);
22525                          history.navigate(
22526                            getNavigationPath(
22527                              location,
22528                              postWithTemplate ? context.postType : postType2
22529                            ),
22530                            {
22531                              transition: "canvas-mode-view-transition"
22532                            }
22533                          );
22534                        },
22535                        children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
22536                          import_components82.__unstableMotion.div,
22537                          {
22538                            variants: siteIconVariants,
22539                            children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(site_icon_default, { className: "edit-site-editor__view-mode-toggle-icon" })
22540                          }
22541                        )
22542                      }
22543                    ),
22544                    /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
22545                      import_components82.__unstableMotion.div,
22546                      {
22547                        className: clsx_default(
22548                          "edit-site-editor__back-icon",
22549                          {
22550                            "has-site-icon": hasSiteIcon
22551                          }
22552                        ),
22553                        variants: toggleHomeIconVariants,
22554                        children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(icon_default, { icon: arrow_up_left_default })
22555                      }
22556                    )
22557                  ]
22558                }
22559              ) }),
22560              /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(MoreMenu, {})
22561            ]
22562          }
22563        )
22564      ] });
22565    }
22566  
22567    // packages/edit-site/build-module/components/site-editor-routes/utils.mjs
22568    function isClassicThemeWithStyleBookSupport(siteData) {
22569      const isBlockTheme = siteData.currentTheme?.is_block_theme;
22570      const supportsEditorStyles = siteData.currentTheme?.theme_supports["editor-styles"];
22571      const hasThemeJson = siteData.editorSettings?.supportsLayout;
22572      return !isBlockTheme && (supportsEditorStyles || hasThemeJson);
22573    }
22574  
22575    // packages/edit-site/build-module/components/site-editor-routes/home.mjs
22576    var import_jsx_runtime168 = __toESM(require_jsx_runtime(), 1);
22577    var homeRoute = {
22578      name: "home",
22579      path: "/",
22580      areas: {
22581        sidebar({ siteData }) {
22582          const isBlockTheme = siteData.currentTheme?.is_block_theme;
22583          return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SidebarNavigationScreenUnsupported, {});
22584        },
22585        preview({ siteData }) {
22586          const isBlockTheme = siteData.currentTheme?.is_block_theme;
22587          return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(EditSiteEditor, { isHomeRoute: true }) : void 0;
22588        },
22589        mobile({ siteData }) {
22590          const isBlockTheme = siteData.currentTheme?.is_block_theme;
22591          return isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SidebarNavigationScreenMain, {}) : /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SidebarNavigationScreenUnsupported, {});
22592        }
22593      }
22594    };
22595  
22596    // packages/edit-site/build-module/components/site-editor-routes/styles.mjs
22597    var import_router20 = __toESM(require_router(), 1);
22598    var import_editor23 = __toESM(require_editor(), 1);
22599    var import_url13 = __toESM(require_url(), 1);
22600  
22601    // packages/edit-site/build-module/components/sidebar-global-styles/index.mjs
22602    var import_i18n71 = __toESM(require_i18n(), 1);
22603    var import_element59 = __toESM(require_element(), 1);
22604    var import_router19 = __toESM(require_router(), 1);
22605    var import_editor22 = __toESM(require_editor(), 1);
22606    var import_compose11 = __toESM(require_compose(), 1);
22607    var import_components83 = __toESM(require_components(), 1);
22608    var import_url12 = __toESM(require_url(), 1);
22609    var import_jsx_runtime169 = __toESM(require_jsx_runtime(), 1);
22610    var { GlobalStylesUIWrapper, GlobalStylesActionMenu } = unlock(import_editor22.privateApis);
22611    var { useLocation: useLocation18, useHistory: useHistory12 } = unlock(import_router19.privateApis);
22612    var GlobalStylesPageActions = ({
22613      isStyleBookOpened,
22614      setIsStyleBookOpened,
22615      path,
22616      onChangeSection
22617    }) => {
22618      const history = useHistory12();
22619      return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(import_components83.__experimentalHStack, { children: [
22620        /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
22621          import_components83.Button,
22622          {
22623            isPressed: isStyleBookOpened,
22624            icon: seen_default,
22625            label: (0, import_i18n71.__)("Style Book"),
22626            onClick: () => {
22627              setIsStyleBookOpened(!isStyleBookOpened);
22628              const updatedPath = !isStyleBookOpened ? (0, import_url12.addQueryArgs)(path, { preview: "stylebook" }) : (0, import_url12.removeQueryArgs)(path, "preview");
22629              history.navigate(updatedPath);
22630            },
22631            size: "compact"
22632          }
22633        ),
22634        /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
22635          GlobalStylesActionMenu,
22636          {
22637            hideWelcomeGuide: true,
22638            onChangePath: onChangeSection
22639          }
22640        )
22641      ] });
22642    };
22643    var useSection = () => {
22644      const { path, query } = useLocation18();
22645      const history = useHistory12();
22646      return (0, import_element59.useMemo)(() => {
22647        return [
22648          query.section ?? "/",
22649          (updatedSection) => {
22650            history.navigate(
22651              (0, import_url12.addQueryArgs)(path, {
22652                section: updatedSection
22653              })
22654            );
22655          }
22656        ];
22657      }, [path, query.section, history]);
22658    };
22659    function SidebarGlobalStyles() {
22660      const { path } = useLocation18();
22661      const [isStyleBookOpened, setIsStyleBookOpened] = (0, import_element59.useState)(
22662        path.includes("preview=stylebook")
22663      );
22664      const isMobileViewport = (0, import_compose11.useViewportMatch)("medium", "<");
22665      const [section, onChangeSection] = useSection();
22666      return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
22667        page_default2,
22668        {
22669          actions: !isMobileViewport ? /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
22670            GlobalStylesPageActions,
22671            {
22672              isStyleBookOpened,
22673              setIsStyleBookOpened,
22674              path,
22675              onChangeSection
22676            }
22677          ) : null,
22678          className: "edit-site-styles",
22679          title: (0, import_i18n71.__)("Styles"),
22680          headingLevel: 2,
22681          children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
22682            GlobalStylesUIWrapper,
22683            {
22684              path: section,
22685              onPathChange: onChangeSection
22686            }
22687          )
22688        }
22689      );
22690    }
22691  
22692    // packages/edit-site/build-module/components/site-editor-routes/styles.mjs
22693    var import_jsx_runtime170 = __toESM(require_jsx_runtime(), 1);
22694    var { useLocation: useLocation19, useHistory: useHistory13 } = unlock(import_router20.privateApis);
22695    var { StyleBookPreview } = unlock(import_editor23.privateApis);
22696    function MobileGlobalStylesUI() {
22697      const { query = {} } = useLocation19();
22698      const { canvas } = query;
22699      if (canvas === "edit") {
22700        return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(EditSiteEditor, {});
22701      }
22702      return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(SidebarGlobalStyles, {});
22703    }
22704    function StylesPreviewArea() {
22705      const { path, query } = useLocation19();
22706      const history = useHistory13();
22707      const isStylebook = query.preview === "stylebook";
22708      const section = query.section ?? "/";
22709      const onChangeSection = (updatedSection) => {
22710        history.navigate(
22711          (0, import_url13.addQueryArgs)(path, {
22712            section: updatedSection
22713          })
22714        );
22715      };
22716      if (isStylebook) {
22717        return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
22718          StyleBookPreview,
22719          {
22720            path: section,
22721            onPathChange: onChangeSection
22722          }
22723        );
22724      }
22725      return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(EditSiteEditor, {});
22726    }
22727    var stylesRoute = {
22728      name: "styles",
22729      path: "/styles",
22730      areas: {
22731        content: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(SidebarGlobalStyles, {}),
22732        sidebar: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(SidebarNavigationScreenGlobalStyles, { backPath: "/" }),
22733        preview: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(StylesPreviewArea, {}),
22734        mobile: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(MobileGlobalStylesUI, {})
22735      },
22736      widths: {
22737        content: 380
22738      }
22739    };
22740  
22741    // packages/edit-site/build-module/components/site-editor-routes/navigation.mjs
22742    var import_router25 = __toESM(require_router(), 1);
22743  
22744    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.mjs
22745    var import_i18n80 = __toESM(require_i18n(), 1);
22746    var import_core_data38 = __toESM(require_core_data(), 1);
22747    var import_data54 = __toESM(require_data(), 1);
22748    var import_html_entities8 = __toESM(require_html_entities(), 1);
22749    var import_components89 = __toESM(require_components(), 1);
22750  
22751    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/constants.mjs
22752    var PRELOADED_NAVIGATION_MENUS_QUERY = {
22753      per_page: 100,
22754      status: ["publish", "draft"],
22755      order: "desc",
22756      orderby: "date"
22757    };
22758  
22759    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.mjs
22760    var import_i18n77 = __toESM(require_i18n(), 1);
22761    var import_html_entities6 = __toESM(require_html_entities(), 1);
22762  
22763    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.mjs
22764    var import_components86 = __toESM(require_components(), 1);
22765    var import_i18n74 = __toESM(require_i18n(), 1);
22766    var import_element61 = __toESM(require_element(), 1);
22767    var import_router21 = __toESM(require_router(), 1);
22768  
22769    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.mjs
22770    var import_components84 = __toESM(require_components(), 1);
22771    var import_i18n72 = __toESM(require_i18n(), 1);
22772    var import_element60 = __toESM(require_element(), 1);
22773    var import_jsx_runtime171 = __toESM(require_jsx_runtime(), 1);
22774    var notEmptyString = (testString) => testString?.trim()?.length > 0;
22775    function RenameModal({ menuTitle, onClose, onSave }) {
22776      const [editedMenuTitle, setEditedMenuTitle] = (0, import_element60.useState)(menuTitle);
22777      const titleHasChanged = editedMenuTitle !== menuTitle;
22778      const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle);
22779      return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
22780        import_components84.Modal,
22781        {
22782          title: (0, import_i18n72.__)("Rename"),
22783          onRequestClose: onClose,
22784          focusOnMount: "firstContentElement",
22785          size: "small",
22786          children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("form", { className: "sidebar-navigation__rename-modal-form", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_components84.__experimentalVStack, { spacing: "3", children: [
22787            /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
22788              import_components84.TextControl,
22789              {
22790                __next40pxDefaultSize: true,
22791                value: editedMenuTitle,
22792                placeholder: (0, import_i18n72.__)("Navigation title"),
22793                onChange: setEditedMenuTitle,
22794                label: (0, import_i18n72.__)("Name")
22795              }
22796            ),
22797            /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_components84.__experimentalHStack, { justify: "right", children: [
22798              /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
22799                import_components84.Button,
22800                {
22801                  __next40pxDefaultSize: true,
22802                  variant: "tertiary",
22803                  onClick: onClose,
22804                  children: (0, import_i18n72.__)("Cancel")
22805                }
22806              ),
22807              /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
22808                import_components84.Button,
22809                {
22810                  __next40pxDefaultSize: true,
22811                  accessibleWhenDisabled: true,
22812                  disabled: !isEditedMenuTitleValid,
22813                  variant: "primary",
22814                  type: "submit",
22815                  onClick: (e2) => {
22816                    e2.preventDefault();
22817                    if (!isEditedMenuTitleValid) {
22818                      return;
22819                    }
22820                    onSave({ title: editedMenuTitle });
22821                    onClose();
22822                  },
22823                  children: (0, import_i18n72.__)("Save")
22824                }
22825              )
22826            ] })
22827          ] }) })
22828        }
22829      );
22830    }
22831  
22832    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.mjs
22833    var import_components85 = __toESM(require_components(), 1);
22834    var import_i18n73 = __toESM(require_i18n(), 1);
22835    var import_jsx_runtime172 = __toESM(require_jsx_runtime(), 1);
22836    function DeleteConfirmDialog({ onClose, onConfirm }) {
22837      return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
22838        import_components85.__experimentalConfirmDialog,
22839        {
22840          isOpen: true,
22841          onConfirm: () => {
22842            onConfirm();
22843            onClose();
22844          },
22845          onCancel: onClose,
22846          confirmButtonText: (0, import_i18n73.__)("Delete"),
22847          size: "medium",
22848          children: (0, import_i18n73.__)("Are you sure you want to delete this Navigation Menu?")
22849        }
22850      );
22851    }
22852  
22853    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.mjs
22854    var import_jsx_runtime173 = __toESM(require_jsx_runtime(), 1);
22855    var { useHistory: useHistory14 } = unlock(import_router21.privateApis);
22856    var POPOVER_PROPS = {
22857      position: "bottom right"
22858    };
22859    function ScreenNavigationMoreMenu(props) {
22860      const { onDelete, onSave, onDuplicate, menuTitle, menuId } = props;
22861      const [renameModalOpen, setRenameModalOpen] = (0, import_element61.useState)(false);
22862      const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = (0, import_element61.useState)(false);
22863      const history = useHistory14();
22864      const closeModals = () => {
22865        setRenameModalOpen(false);
22866        setDeleteConfirmDialogOpen(false);
22867      };
22868      const openRenameModal = () => setRenameModalOpen(true);
22869      const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true);
22870      return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_jsx_runtime173.Fragment, { children: [
22871        /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
22872          import_components86.DropdownMenu,
22873          {
22874            className: "sidebar-navigation__more-menu",
22875            label: (0, import_i18n74.__)("Actions"),
22876            icon: more_vertical_default,
22877            popoverProps: POPOVER_PROPS,
22878            children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_components86.MenuGroup, { children: [
22879              /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
22880                import_components86.MenuItem,
22881                {
22882                  onClick: () => {
22883                    openRenameModal();
22884                    onClose();
22885                  },
22886                  children: (0, import_i18n74.__)("Rename")
22887                }
22888              ),
22889              /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
22890                import_components86.MenuItem,
22891                {
22892                  onClick: () => {
22893                    history.navigate(
22894                      `/wp_navigation/$menuId}?canvas=edit`
22895                    );
22896                  },
22897                  children: (0, import_i18n74.__)("Edit")
22898                }
22899              ),
22900              /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
22901                import_components86.MenuItem,
22902                {
22903                  onClick: () => {
22904                    onDuplicate();
22905                    onClose();
22906                  },
22907                  children: (0, import_i18n74.__)("Duplicate")
22908                }
22909              ),
22910              /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
22911                import_components86.MenuItem,
22912                {
22913                  isDestructive: true,
22914                  onClick: () => {
22915                    openDeleteConfirmDialog();
22916                    onClose();
22917                  },
22918                  children: (0, import_i18n74.__)("Delete")
22919                }
22920              )
22921            ] })
22922          }
22923        ),
22924        deleteConfirmDialogOpen && /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
22925          DeleteConfirmDialog,
22926          {
22927            onClose: closeModals,
22928            onConfirm: onDelete
22929          }
22930        ),
22931        renameModalOpen && /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
22932          RenameModal,
22933          {
22934            onClose: closeModals,
22935            menuTitle,
22936            onSave
22937          }
22938        )
22939      ] });
22940    }
22941  
22942    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.mjs
22943    var import_element64 = __toESM(require_element(), 1);
22944    var import_data51 = __toESM(require_data(), 1);
22945    var import_block_editor21 = __toESM(require_block_editor(), 1);
22946    var import_blocks10 = __toESM(require_blocks(), 1);
22947  
22948    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.mjs
22949    var import_block_editor20 = __toESM(require_block_editor(), 1);
22950    var import_data50 = __toESM(require_data(), 1);
22951    var import_blocks9 = __toESM(require_blocks(), 1);
22952    var import_element63 = __toESM(require_element(), 1);
22953    var import_core_data35 = __toESM(require_core_data(), 1);
22954  
22955    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.mjs
22956    var import_components87 = __toESM(require_components(), 1);
22957    var import_data49 = __toESM(require_data(), 1);
22958    var import_element62 = __toESM(require_element(), 1);
22959    var import_i18n75 = __toESM(require_i18n(), 1);
22960    var import_block_editor19 = __toESM(require_block_editor(), 1);
22961    var import_router22 = __toESM(require_router(), 1);
22962    var import_jsx_runtime174 = __toESM(require_jsx_runtime(), 1);
22963    var POPOVER_PROPS2 = {
22964      className: "block-editor-block-settings-menu__popover",
22965      placement: "bottom-start"
22966    };
22967    var { useHistory: useHistory15, useLocation: useLocation20 } = unlock(import_router22.privateApis);
22968    function LeafMoreMenu(props) {
22969      const history = useHistory15();
22970      const { path } = useLocation20();
22971      const { block } = props;
22972      const { clientId } = block;
22973      const { moveBlocksDown, moveBlocksUp, removeBlocks } = (0, import_data49.useDispatch)(import_block_editor19.store);
22974      const removeLabel = (0, import_i18n75.sprintf)(
22975        /* translators: %s: block name */
22976        (0, import_i18n75.__)("Remove %s"),
22977        (0, import_block_editor19.BlockTitle)({ clientId, maximumLength: 25 })
22978      );
22979      const goToLabel = (0, import_i18n75.sprintf)(
22980        /* translators: %s: block name */
22981        (0, import_i18n75.__)("Go to %s"),
22982        (0, import_block_editor19.BlockTitle)({ clientId, maximumLength: 25 })
22983      );
22984      const rootClientId = (0, import_data49.useSelect)(
22985        (select3) => {
22986          const { getBlockRootClientId } = select3(import_block_editor19.store);
22987          return getBlockRootClientId(clientId);
22988        },
22989        [clientId]
22990      );
22991      const onGoToPage = (0, import_element62.useCallback)(
22992        (selectedBlock) => {
22993          const { attributes, name: name2 } = selectedBlock;
22994          if (attributes.kind === "post-type" && attributes.id && attributes.type && history) {
22995            history.navigate(
22996              `/$attributes.type}/$attributes.id}?canvas=edit`,
22997              {
22998                state: { backPath: path }
22999              }
23000            );
23001          }
23002          if (name2 === "core/page-list-item" && attributes.id && history) {
23003            history.navigate(`/page/$attributes.id}?canvas=edit`, {
23004              state: { backPath: path }
23005            });
23006          }
23007        },
23008        [path, history]
23009      );
23010      return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
23011        import_components87.DropdownMenu,
23012        {
23013          icon: more_vertical_default,
23014          label: (0, import_i18n75.__)("Options"),
23015          className: "block-editor-block-settings-menu",
23016          popoverProps: POPOVER_PROPS2,
23017          noIcons: true,
23018          ...props,
23019          children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(import_jsx_runtime174.Fragment, { children: [
23020            /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(import_components87.MenuGroup, { children: [
23021              /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
23022                import_components87.MenuItem,
23023                {
23024                  icon: chevron_up_default,
23025                  onClick: () => {
23026                    moveBlocksUp([clientId], rootClientId);
23027                    onClose();
23028                  },
23029                  children: (0, import_i18n75.__)("Move up")
23030                }
23031              ),
23032              /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
23033                import_components87.MenuItem,
23034                {
23035                  icon: chevron_down_default,
23036                  onClick: () => {
23037                    moveBlocksDown([clientId], rootClientId);
23038                    onClose();
23039                  },
23040                  children: (0, import_i18n75.__)("Move down")
23041                }
23042              ),
23043              block.attributes?.type === "page" && block.attributes?.id && /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
23044                import_components87.MenuItem,
23045                {
23046                  onClick: () => {
23047                    onGoToPage(block);
23048                    onClose();
23049                  },
23050                  children: goToLabel
23051                }
23052              )
23053            ] }),
23054            /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_components87.MenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
23055              import_components87.MenuItem,
23056              {
23057                onClick: () => {
23058                  removeBlocks([clientId], false);
23059                  onClose();
23060                },
23061                children: removeLabel
23062              }
23063            ) })
23064          ] })
23065        }
23066      );
23067    }
23068  
23069    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.mjs
23070    var import_jsx_runtime175 = __toESM(require_jsx_runtime(), 1);
23071    var { PrivateListView } = unlock(import_block_editor20.privateApis);
23072    var MAX_PAGE_COUNT = 100;
23073    var PAGES_QUERY = [
23074      "postType",
23075      "page",
23076      {
23077        per_page: MAX_PAGE_COUNT,
23078        _fields: ["id", "link", "menu_order", "parent", "title", "type"],
23079        // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby
23080        // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent
23081        // sort.
23082        orderby: "menu_order",
23083        order: "asc"
23084      }
23085    ];
23086    function NavigationMenuContent({ rootClientId }) {
23087      const { listViewRootClientId, isLoading } = (0, import_data50.useSelect)(
23088        (select3) => {
23089          const {
23090            areInnerBlocksControlled,
23091            getBlockName,
23092            getBlockCount,
23093            getBlockOrder
23094          } = select3(import_block_editor20.store);
23095          const { isResolving } = select3(import_core_data35.store);
23096          const blockClientIds = getBlockOrder(rootClientId);
23097          const hasOnlyPageListBlock = blockClientIds.length === 1 && getBlockName(blockClientIds[0]) === "core/page-list";
23098          const pageListHasBlocks = hasOnlyPageListBlock && getBlockCount(blockClientIds[0]) > 0;
23099          const isLoadingPages = isResolving(
23100            "getEntityRecords",
23101            PAGES_QUERY
23102          );
23103          return {
23104            listViewRootClientId: pageListHasBlocks ? blockClientIds[0] : rootClientId,
23105            // This is a small hack to wait for the navigation block
23106            // to actually load its inner blocks.
23107            isLoading: !areInnerBlocksControlled(rootClientId) || isLoadingPages
23108          };
23109        },
23110        [rootClientId]
23111      );
23112      const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } = (0, import_data50.useDispatch)(import_block_editor20.store);
23113      const offCanvasOnselect = (0, import_element63.useCallback)(
23114        (block) => {
23115          if (block.name === "core/navigation-link" && !block.attributes.url) {
23116            __unstableMarkNextChangeAsNotPersistent();
23117            replaceBlock(
23118              block.clientId,
23119              (0, import_blocks9.createBlock)("core/navigation-link", block.attributes)
23120            );
23121          }
23122        },
23123        [__unstableMarkNextChangeAsNotPersistent, replaceBlock]
23124      );
23125      return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(import_jsx_runtime175.Fragment, { children: [
23126        !isLoading && /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
23127          PrivateListView,
23128          {
23129            rootClientId: listViewRootClientId,
23130            onSelect: offCanvasOnselect,
23131            blockSettingsMenu: LeafMoreMenu,
23132            showAppender: false,
23133            isExpanded: true
23134          }
23135        ),
23136        /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor", children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(import_block_editor20.BlockList, {}) })
23137      ] });
23138    }
23139  
23140    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.mjs
23141    var import_jsx_runtime176 = __toESM(require_jsx_runtime(), 1);
23142    var noop2 = () => {
23143    };
23144    function NavigationMenuEditor({ navigationMenuId }) {
23145      const { storedSettings } = (0, import_data51.useSelect)((select3) => {
23146        const { getSettings: getSettings7 } = unlock(select3(store));
23147        return {
23148          storedSettings: getSettings7()
23149        };
23150      }, []);
23151      const blocks = (0, import_element64.useMemo)(() => {
23152        if (!navigationMenuId) {
23153          return [];
23154        }
23155        return [(0, import_blocks10.createBlock)("core/navigation", { ref: navigationMenuId })];
23156      }, [navigationMenuId]);
23157      if (!navigationMenuId || !blocks?.length) {
23158        return null;
23159      }
23160      return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
23161        import_block_editor21.BlockEditorProvider,
23162        {
23163          settings: storedSettings,
23164          value: blocks,
23165          onChange: noop2,
23166          onInput: noop2,
23167          children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__content", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(NavigationMenuContent, { rootClientId: blocks[0].clientId }) })
23168        }
23169      );
23170    }
23171  
23172    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.mjs
23173    var import_i18n76 = __toESM(require_i18n(), 1);
23174    var import_html_entities5 = __toESM(require_html_entities(), 1);
23175    function buildNavigationLabel(title, id, status) {
23176      if (!title?.rendered) {
23177        return (0, import_i18n76.sprintf)((0, import_i18n76.__)("(no title %s)"), id);
23178      }
23179      if (status === "publish") {
23180        return (0, import_html_entities5.decodeEntities)(title?.rendered);
23181      }
23182      return (0, import_i18n76.sprintf)(
23183        // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
23184        (0, import_i18n76._x)("%1$s (%2$s)", "menu label"),
23185        (0, import_html_entities5.decodeEntities)(title?.rendered),
23186        status
23187      );
23188    }
23189  
23190    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.mjs
23191    var import_jsx_runtime177 = __toESM(require_jsx_runtime(), 1);
23192    function SingleNavigationMenu({
23193      navigationMenu,
23194      backPath,
23195      handleDelete,
23196      handleDuplicate,
23197      handleSave
23198    }) {
23199      const menuTitle = navigationMenu?.title?.rendered;
23200      return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
23201        SidebarNavigationScreenWrapper,
23202        {
23203          actions: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_jsx_runtime177.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
23204            ScreenNavigationMoreMenu,
23205            {
23206              menuId: navigationMenu?.id,
23207              menuTitle: (0, import_html_entities6.decodeEntities)(menuTitle),
23208              onDelete: handleDelete,
23209              onSave: handleSave,
23210              onDuplicate: handleDuplicate
23211            }
23212          ) }),
23213          backPath,
23214          title: buildNavigationLabel(
23215            navigationMenu?.title,
23216            navigationMenu?.id,
23217            navigationMenu?.status
23218          ),
23219          description: (0, import_i18n77.__)(
23220            "Navigation Menus are a curated collection of blocks that allow visitors to get around your site."
23221          ),
23222          children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(NavigationMenuEditor, { navigationMenuId: navigationMenu?.id })
23223        }
23224      );
23225    }
23226  
23227    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.mjs
23228    var import_core_data37 = __toESM(require_core_data(), 1);
23229    var import_i18n79 = __toESM(require_i18n(), 1);
23230    var import_data53 = __toESM(require_data(), 1);
23231    var import_notices4 = __toESM(require_notices(), 1);
23232    var import_router24 = __toESM(require_router(), 1);
23233  
23234    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/index.mjs
23235    var import_core_data36 = __toESM(require_core_data(), 1);
23236    var import_components88 = __toESM(require_components(), 1);
23237    var import_i18n78 = __toESM(require_i18n(), 1);
23238    var import_data52 = __toESM(require_data(), 1);
23239    var import_html_entities7 = __toESM(require_html_entities(), 1);
23240    var import_router23 = __toESM(require_router(), 1);
23241    var import_jsx_runtime178 = __toESM(require_jsx_runtime(), 1);
23242    var { useLocation: useLocation21 } = unlock(import_router23.privateApis);
23243    var postType = `wp_navigation`;
23244    function SidebarNavigationScreenNavigationMenu({ backPath }) {
23245      const {
23246        params: { postId }
23247      } = useLocation21();
23248      const { record: navigationMenu, isResolving } = (0, import_core_data36.useEntityRecord)(
23249        "postType",
23250        postType,
23251        postId
23252      );
23253      const { isSaving, isDeleting } = (0, import_data52.useSelect)(
23254        (select3) => {
23255          const { isSavingEntityRecord, isDeletingEntityRecord } = select3(import_core_data36.store);
23256          return {
23257            isSaving: isSavingEntityRecord("postType", postType, postId),
23258            isDeleting: isDeletingEntityRecord(
23259              "postType",
23260              postType,
23261              postId
23262            )
23263          };
23264        },
23265        [postId]
23266      );
23267      const isLoading = isResolving || isSaving || isDeleting;
23268      const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
23269      const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers();
23270      const _handleDelete = () => handleDelete(navigationMenu);
23271      const _handleSave = (edits) => handleSave(navigationMenu, edits);
23272      const _handleDuplicate = () => handleDuplicate(navigationMenu);
23273      if (isLoading) {
23274        return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
23275          SidebarNavigationScreenWrapper,
23276          {
23277            description: (0, import_i18n78.__)(
23278              "Navigation Menus are a curated collection of blocks that allow visitors to get around your site."
23279            ),
23280            backPath,
23281            children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(import_components88.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" })
23282          }
23283        );
23284      }
23285      if (!isLoading && !navigationMenu) {
23286        return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
23287          SidebarNavigationScreenWrapper,
23288          {
23289            description: (0, import_i18n78.__)("Navigation Menu missing."),
23290            backPath
23291          }
23292        );
23293      }
23294      if (!navigationMenu?.content?.raw) {
23295        return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
23296          SidebarNavigationScreenWrapper,
23297          {
23298            actions: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
23299              ScreenNavigationMoreMenu,
23300              {
23301                menuId: navigationMenu?.id,
23302                menuTitle: (0, import_html_entities7.decodeEntities)(menuTitle),
23303                onDelete: _handleDelete,
23304                onSave: _handleSave,
23305                onDuplicate: _handleDuplicate
23306              }
23307            ),
23308            backPath,
23309            title: buildNavigationLabel(
23310              navigationMenu?.title,
23311              navigationMenu?.id,
23312              navigationMenu?.status
23313            ),
23314            description: (0, import_i18n78.__)("This Navigation Menu is empty.")
23315          }
23316        );
23317      }
23318      return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
23319        SingleNavigationMenu,
23320        {
23321          navigationMenu,
23322          backPath,
23323          handleDelete: _handleDelete,
23324          handleSave: _handleSave,
23325          handleDuplicate: _handleDuplicate
23326        }
23327      );
23328    }
23329  
23330    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.mjs
23331    var { useHistory: useHistory16 } = unlock(import_router24.privateApis);
23332    function useDeleteNavigationMenu() {
23333      const { deleteEntityRecord } = (0, import_data53.useDispatch)(import_core_data37.store);
23334      const { createSuccessNotice, createErrorNotice } = (0, import_data53.useDispatch)(import_notices4.store);
23335      const history = useHistory16();
23336      const handleDelete = async (navigationMenu) => {
23337        const postId = navigationMenu?.id;
23338        try {
23339          await deleteEntityRecord(
23340            "postType",
23341            postType,
23342            postId,
23343            {
23344              force: true
23345            },
23346            {
23347              throwOnError: true
23348            }
23349          );
23350          createSuccessNotice(
23351            (0, import_i18n79.__)("Navigation Menu successfully deleted."),
23352            {
23353              type: "snackbar"
23354            }
23355          );
23356          history.navigate("/navigation");
23357        } catch (error) {
23358          createErrorNotice(
23359            (0, import_i18n79.sprintf)(
23360              /* translators: %s: error message describing why the navigation menu could not be deleted. */
23361              (0, import_i18n79.__)(`Unable to delete Navigation Menu (%s).`),
23362              error?.message
23363            ),
23364            {
23365              type: "snackbar"
23366            }
23367          );
23368        }
23369      };
23370      return handleDelete;
23371    }
23372    function useSaveNavigationMenu() {
23373      const { getEditedEntityRecord } = (0, import_data53.useSelect)((select3) => {
23374        const { getEditedEntityRecord: getEditedEntityRecordSelector } = select3(import_core_data37.store);
23375        return {
23376          getEditedEntityRecord: getEditedEntityRecordSelector
23377        };
23378      }, []);
23379      const {
23380        editEntityRecord,
23381        __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
23382      } = (0, import_data53.useDispatch)(import_core_data37.store);
23383      const { createSuccessNotice, createErrorNotice } = (0, import_data53.useDispatch)(import_notices4.store);
23384      const handleSave = async (navigationMenu, edits) => {
23385        if (!edits) {
23386          return;
23387        }
23388        const postId = navigationMenu?.id;
23389        const originalRecord = getEditedEntityRecord(
23390          "postType",
23391          NAVIGATION_POST_TYPE,
23392          postId
23393        );
23394        editEntityRecord("postType", postType, postId, edits);
23395        const recordPropertiesToSave = Object.keys(edits);
23396        try {
23397          await saveSpecifiedEntityEdits(
23398            "postType",
23399            postType,
23400            postId,
23401            recordPropertiesToSave,
23402            {
23403              throwOnError: true
23404            }
23405          );
23406          createSuccessNotice((0, import_i18n79.__)("Renamed Navigation Menu"), {
23407            type: "snackbar"
23408          });
23409        } catch (error) {
23410          editEntityRecord("postType", postType, postId, originalRecord);
23411          createErrorNotice(
23412            (0, import_i18n79.sprintf)(
23413              /* translators: %s: error message describing why the navigation menu could not be renamed. */
23414              (0, import_i18n79.__)(`Unable to rename Navigation Menu (%s).`),
23415              error?.message
23416            ),
23417            {
23418              type: "snackbar"
23419            }
23420          );
23421        }
23422      };
23423      return handleSave;
23424    }
23425    function useDuplicateNavigationMenu() {
23426      const history = useHistory16();
23427      const { saveEntityRecord } = (0, import_data53.useDispatch)(import_core_data37.store);
23428      const { createSuccessNotice, createErrorNotice } = (0, import_data53.useDispatch)(import_notices4.store);
23429      const handleDuplicate = async (navigationMenu) => {
23430        const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
23431        try {
23432          const savedRecord = await saveEntityRecord(
23433            "postType",
23434            postType,
23435            {
23436              title: (0, import_i18n79.sprintf)(
23437                /* translators: %s: Navigation menu title */
23438                (0, import_i18n79._x)("%s (Copy)", "navigation menu"),
23439                menuTitle
23440              ),
23441              content: navigationMenu?.content?.raw,
23442              status: "publish"
23443            },
23444            {
23445              throwOnError: true
23446            }
23447          );
23448          if (savedRecord) {
23449            createSuccessNotice((0, import_i18n79.__)("Duplicated Navigation Menu"), {
23450              type: "snackbar"
23451            });
23452            history.navigate(`/wp_navigation/$savedRecord.id}`);
23453          }
23454        } catch (error) {
23455          createErrorNotice(
23456            (0, import_i18n79.sprintf)(
23457              /* translators: %s: error message describing why the navigation menu could not be deleted. */
23458              (0, import_i18n79.__)(`Unable to duplicate Navigation Menu (%s).`),
23459              error?.message
23460            ),
23461            {
23462              type: "snackbar"
23463            }
23464          );
23465        }
23466      };
23467      return handleDuplicate;
23468    }
23469    function useNavigationMenuHandlers() {
23470      return {
23471        handleDelete: useDeleteNavigationMenu(),
23472        handleSave: useSaveNavigationMenu(),
23473        handleDuplicate: useDuplicateNavigationMenu()
23474      };
23475    }
23476  
23477    // packages/edit-site/build-module/components/sidebar-navigation-screen-navigation-menus/index.mjs
23478    var import_jsx_runtime179 = __toESM(require_jsx_runtime(), 1);
23479    function buildMenuLabel(title, id, status) {
23480      if (!title) {
23481        return (0, import_i18n80.sprintf)((0, import_i18n80.__)("(no title %s)"), id);
23482      }
23483      if (status === "publish") {
23484        return (0, import_html_entities8.decodeEntities)(title);
23485      }
23486      return (0, import_i18n80.sprintf)(
23487        // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
23488        (0, import_i18n80._x)("%1$s (%2$s)", "menu label"),
23489        (0, import_html_entities8.decodeEntities)(title),
23490        status
23491      );
23492    }
23493    function SidebarNavigationScreenNavigationMenus({ backPath }) {
23494      const {
23495        records: navigationMenus,
23496        isResolving: isResolvingNavigationMenus,
23497        hasResolved: hasResolvedNavigationMenus
23498      } = (0, import_core_data38.useEntityRecords)(
23499        "postType",
23500        NAVIGATION_POST_TYPE,
23501        PRELOADED_NAVIGATION_MENUS_QUERY
23502      );
23503      const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus;
23504      const { getNavigationFallbackId } = unlock((0, import_data54.useSelect)(import_core_data38.store));
23505      const isCreatingNavigationFallback = (0, import_data54.useSelect)(
23506        (select3) => select3(import_core_data38.store).isResolving("getNavigationFallbackId"),
23507        []
23508      );
23509      const firstNavigationMenu = navigationMenus?.[0];
23510      if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && // Ensure a fallback navigation is created only once
23511      !isCreatingNavigationFallback) {
23512        getNavigationFallbackId();
23513      }
23514      const { handleSave, handleDelete, handleDuplicate } = useNavigationMenuHandlers();
23515      const hasNavigationMenus = !!navigationMenus?.length;
23516      if (isLoading) {
23517        return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(import_components89.Spinner, { className: "edit-site-sidebar-navigation-screen-navigation-menus__loading" }) });
23518      }
23519      if (!isLoading && !hasNavigationMenus) {
23520        return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
23521          SidebarNavigationScreenWrapper,
23522          {
23523            description: (0, import_i18n80.__)("No Navigation Menus found."),
23524            backPath
23525          }
23526        );
23527      }
23528      if (navigationMenus?.length === 1) {
23529        return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
23530          SingleNavigationMenu,
23531          {
23532            navigationMenu: firstNavigationMenu,
23533            backPath,
23534            handleDelete: () => handleDelete(firstNavigationMenu),
23535            handleDuplicate: () => handleDuplicate(firstNavigationMenu),
23536            handleSave: (edits) => handleSave(firstNavigationMenu, edits)
23537          }
23538        );
23539      }
23540      return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(SidebarNavigationScreenWrapper, { backPath, children: /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(import_components89.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-navigation-menus", children: navigationMenus?.map(({ id, title, status }, index) => /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
23541        NavMenuItem,
23542        {
23543          postId: id,
23544          withChevron: true,
23545          icon: navigation_default,
23546          children: buildMenuLabel(title?.rendered, index + 1, status)
23547        },
23548        id
23549      )) }) });
23550    }
23551    function SidebarNavigationScreenWrapper({
23552      children,
23553      actions,
23554      title,
23555      description,
23556      backPath
23557    }) {
23558      return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
23559        SidebarNavigationScreen,
23560        {
23561          title: title || (0, import_i18n80.__)("Navigation"),
23562          actions,
23563          description: description || (0, import_i18n80.__)("Manage your Navigation Menus."),
23564          backPath,
23565          content: children
23566        }
23567      );
23568    }
23569    var NavMenuItem = ({ postId, ...props }) => {
23570      return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
23571        SidebarNavigationItem,
23572        {
23573          to: `/wp_navigation/$postId}`,
23574          ...props
23575        }
23576      );
23577    };
23578  
23579    // packages/edit-site/build-module/components/site-editor-routes/navigation.mjs
23580    var import_jsx_runtime180 = __toESM(require_jsx_runtime(), 1);
23581    var { useLocation: useLocation22 } = unlock(import_router25.privateApis);
23582    function MobileNavigationView() {
23583      const { query = {} } = useLocation22();
23584      const { canvas = "view" } = query;
23585      return canvas === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" });
23586    }
23587    var navigationRoute = {
23588      name: "navigation",
23589      path: "/navigation",
23590      areas: {
23591        sidebar({ siteData }) {
23592          const isBlockTheme = siteData.currentTheme?.is_block_theme;
23593          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(SidebarNavigationScreenNavigationMenus, { backPath: "/" }) : /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(SidebarNavigationScreenUnsupported, {});
23594        },
23595        preview({ siteData }) {
23596          const isBlockTheme = siteData.currentTheme?.is_block_theme;
23597          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(EditSiteEditor, {}) : void 0;
23598        },
23599        mobile({ siteData }) {
23600          const isBlockTheme = siteData.currentTheme?.is_block_theme;
23601          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(MobileNavigationView, {}) : /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(SidebarNavigationScreenUnsupported, {});
23602        }
23603      }
23604    };
23605  
23606    // packages/edit-site/build-module/components/site-editor-routes/navigation-item.mjs
23607    var import_router26 = __toESM(require_router(), 1);
23608    var import_jsx_runtime181 = __toESM(require_jsx_runtime(), 1);
23609    var { useLocation: useLocation23 } = unlock(import_router26.privateApis);
23610    function MobileNavigationItemView() {
23611      const { query = {} } = useLocation23();
23612      const { canvas = "view" } = query;
23613      return canvas === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" });
23614    }
23615    var navigationItemRoute = {
23616      name: "navigation-item",
23617      path: "/wp_navigation/:postId",
23618      areas: {
23619        sidebar({ siteData }) {
23620          const isBlockTheme = siteData.currentTheme?.is_block_theme;
23621          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(SidebarNavigationScreenNavigationMenu, { backPath: "/navigation" }) : /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(SidebarNavigationScreenUnsupported, {});
23622        },
23623        preview({ siteData }) {
23624          const isBlockTheme = siteData.currentTheme?.is_block_theme;
23625          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(SidebarNavigationScreenUnsupported, {});
23626        },
23627        mobile({ siteData }) {
23628          const isBlockTheme = siteData.currentTheme?.is_block_theme;
23629          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(MobileNavigationItemView, {}) : /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(SidebarNavigationScreenUnsupported, {});
23630        }
23631      }
23632    };
23633  
23634    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.mjs
23635    var import_components90 = __toESM(require_components(), 1);
23636    var import_editor27 = __toESM(require_editor(), 1);
23637    var import_i18n82 = __toESM(require_i18n(), 1);
23638    var import_router27 = __toESM(require_router(), 1);
23639  
23640    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/category-item.mjs
23641    var import_jsx_runtime182 = __toESM(require_jsx_runtime(), 1);
23642    function CategoryItem({
23643      count,
23644      icon,
23645      id,
23646      isActive,
23647      label,
23648      type
23649    }) {
23650      if (!count) {
23651        return;
23652      }
23653      const queryArgs = [`postType=$type}`];
23654      if (id) {
23655        queryArgs.push(`categoryId=$id}`);
23656      }
23657      return /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
23658        SidebarNavigationItem,
23659        {
23660          icon,
23661          suffix: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("span", { children: count }),
23662          "aria-current": isActive ? "true" : void 0,
23663          to: `/pattern?$queryArgs.join("&")}`,
23664          children: label
23665        }
23666      );
23667    }
23668  
23669    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.mjs
23670    var import_element67 = __toESM(require_element(), 1);
23671    var import_i18n81 = __toESM(require_i18n(), 1);
23672  
23673    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.mjs
23674    var import_core_data39 = __toESM(require_core_data(), 1);
23675    var import_data55 = __toESM(require_data(), 1);
23676    function useDefaultPatternCategories() {
23677      const blockPatternCategories = (0, import_data55.useSelect)((select3) => {
23678        const { getSettings: getSettings7 } = unlock(select3(store));
23679        const settings2 = getSettings7();
23680        return settings2.__experimentalAdditionalBlockPatternCategories ?? settings2.__experimentalBlockPatternCategories;
23681      });
23682      const restBlockPatternCategories = (0, import_data55.useSelect)(
23683        (select3) => select3(import_core_data39.store).getBlockPatternCategories()
23684      );
23685      return [
23686        ...blockPatternCategories || [],
23687        ...restBlockPatternCategories || []
23688      ];
23689    }
23690  
23691    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.mjs
23692    var import_core_data40 = __toESM(require_core_data(), 1);
23693    var import_data56 = __toESM(require_data(), 1);
23694    var import_element65 = __toESM(require_element(), 1);
23695  
23696    // packages/edit-site/build-module/components/page-patterns/utils.mjs
23697    var filterOutDuplicatesByName = (currentItem, index, items) => index === items.findIndex((item) => currentItem.name === item.name);
23698  
23699    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.mjs
23700    function useThemePatterns() {
23701      const blockPatterns = (0, import_data56.useSelect)((select3) => {
23702        const { getSettings: getSettings7 } = unlock(select3(store));
23703        return getSettings7().__experimentalAdditionalBlockPatterns ?? getSettings7().__experimentalBlockPatterns;
23704      });
23705      const restBlockPatterns = (0, import_data56.useSelect)(
23706        (select3) => select3(import_core_data40.store).getBlockPatterns()
23707      );
23708      const patterns = (0, import_element65.useMemo)(
23709        () => [...blockPatterns || [], ...restBlockPatterns || []].filter(
23710          (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)
23711        ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false),
23712        [blockPatterns, restBlockPatterns]
23713      );
23714      return patterns;
23715    }
23716  
23717    // packages/edit-site/build-module/components/page-patterns/use-patterns.mjs
23718    var import_blocks11 = __toESM(require_blocks(), 1);
23719    var import_data57 = __toESM(require_data(), 1);
23720    var import_core_data41 = __toESM(require_core_data(), 1);
23721    var import_element66 = __toESM(require_element(), 1);
23722  
23723    // packages/edit-site/build-module/components/page-patterns/search-items.mjs
23724    var import_block_editor22 = __toESM(require_block_editor(), 1);
23725    var { extractWords, getNormalizedSearchTerms, normalizeString } = unlock(
23726      import_block_editor22.privateApis
23727    );
23728    var defaultGetName = (item) => {
23729      if (item.type === PATTERN_TYPES.user) {
23730        return item.slug;
23731      }
23732      if (item.type === TEMPLATE_PART_POST_TYPE) {
23733        return "";
23734      }
23735      return item.name || "";
23736    };
23737    var defaultGetTitle = (item) => {
23738      if (typeof item.title === "string") {
23739        return item.title;
23740      }
23741      if (item.title && item.title.rendered) {
23742        return item.title.rendered;
23743      }
23744      if (item.title && item.title.raw) {
23745        return item.title.raw;
23746      }
23747      return "";
23748    };
23749    var defaultGetDescription = (item) => {
23750      if (item.type === PATTERN_TYPES.user) {
23751        return item.excerpt.raw;
23752      }
23753      return item.description || "";
23754    };
23755    var defaultGetKeywords = (item) => item.keywords || [];
23756    var defaultHasCategory = () => false;
23757    var removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
23758      return unmatchedTerms.filter(
23759        (term) => !getNormalizedSearchTerms(unprocessedTerms).some(
23760          (unprocessedTerm) => unprocessedTerm.includes(term)
23761        )
23762      );
23763    };
23764    var searchItems = (items = [], searchInput = "", config2 = {}) => {
23765      const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
23766      const onlyFilterByCategory = config2.categoryId !== PATTERN_DEFAULT_CATEGORY && !normalizedSearchTerms.length;
23767      const searchRankConfig = { ...config2, onlyFilterByCategory };
23768      const threshold = onlyFilterByCategory ? 0 : 1;
23769      const rankedItems = items.map((item) => {
23770        return [
23771          item,
23772          getItemSearchRank(item, searchInput, searchRankConfig)
23773        ];
23774      }).filter(([, rank]) => rank > threshold);
23775      if (normalizedSearchTerms.length === 0) {
23776        return rankedItems.map(([item]) => item);
23777      }
23778      rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
23779      return rankedItems.map(([item]) => item);
23780    };
23781    function getItemSearchRank(item, searchTerm, config2) {
23782      const {
23783        categoryId,
23784        getName = defaultGetName,
23785        getTitle = defaultGetTitle,
23786        getDescription = defaultGetDescription,
23787        getKeywords = defaultGetKeywords,
23788        hasCategory = defaultHasCategory,
23789        onlyFilterByCategory
23790      } = config2;
23791      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;
23792      if (!rank || onlyFilterByCategory) {
23793        return rank;
23794      }
23795      const name2 = getName(item);
23796      const title = getTitle(item);
23797      const description = getDescription(item);
23798      const keywords = getKeywords(item);
23799      const normalizedSearchInput = normalizeString(searchTerm);
23800      const normalizedTitle = normalizeString(title);
23801      if (normalizedSearchInput === normalizedTitle) {
23802        rank += 30;
23803      } else if (normalizedTitle.startsWith(normalizedSearchInput)) {
23804        rank += 20;
23805      } else {
23806        const terms = [name2, title, description, ...keywords].join(" ");
23807        const normalizedSearchTerms = extractWords(normalizedSearchInput);
23808        const unmatchedTerms = removeMatchingTerms(
23809          normalizedSearchTerms,
23810          terms
23811        );
23812        if (unmatchedTerms.length === 0) {
23813          rank += 10;
23814        }
23815      }
23816      return rank;
23817    }
23818  
23819    // packages/edit-site/build-module/components/page-patterns/use-patterns.mjs
23820    var EMPTY_PATTERN_LIST = [];
23821    var selectTemplateParts = (0, import_data57.createSelector)(
23822      (select3, categoryId, search = "") => {
23823        const {
23824          getEntityRecords,
23825          getCurrentTheme,
23826          isResolving: isResolvingSelector
23827        } = select3(import_core_data41.store);
23828        const query = { per_page: -1 };
23829        const templateParts = getEntityRecords("postType", TEMPLATE_PART_POST_TYPE, query) ?? EMPTY_PATTERN_LIST;
23830        const knownAreas = getCurrentTheme()?.default_template_part_areas || [];
23831        const templatePartAreas = knownAreas.map((area) => area.area);
23832        const templatePartHasCategory = (item, category) => {
23833          if (category !== TEMPLATE_PART_AREA_DEFAULT_CATEGORY) {
23834            return item.area === category;
23835          }
23836          return item.area === category || !templatePartAreas.includes(item.area);
23837        };
23838        const isResolving = isResolvingSelector("getEntityRecords", [
23839          "postType",
23840          TEMPLATE_PART_POST_TYPE,
23841          query
23842        ]);
23843        const patterns = searchItems(templateParts, search, {
23844          categoryId,
23845          hasCategory: templatePartHasCategory
23846        });
23847        return { patterns, isResolving };
23848      },
23849      (select3) => [
23850        select3(import_core_data41.store).getEntityRecords(
23851          "postType",
23852          TEMPLATE_PART_POST_TYPE,
23853          {
23854            per_page: -1
23855          }
23856        ),
23857        select3(import_core_data41.store).isResolving("getEntityRecords", [
23858          "postType",
23859          TEMPLATE_PART_POST_TYPE,
23860          { per_page: -1 }
23861        ]),
23862        select3(import_core_data41.store).getCurrentTheme()?.default_template_part_areas
23863      ]
23864    );
23865    var selectThemePatterns = (0, import_data57.createSelector)(
23866      (select3) => {
23867        const { getSettings: getSettings7 } = unlock(select3(store));
23868        const { isResolving: isResolvingSelector } = select3(import_core_data41.store);
23869        const settings2 = getSettings7();
23870        const blockPatterns = settings2.__experimentalAdditionalBlockPatterns ?? settings2.__experimentalBlockPatterns;
23871        const restBlockPatterns = select3(import_core_data41.store).getBlockPatterns();
23872        const patterns = [
23873          ...blockPatterns || [],
23874          ...restBlockPatterns || []
23875        ].filter(
23876          (pattern) => !EXCLUDED_PATTERN_SOURCES.includes(pattern.source)
23877        ).filter(filterOutDuplicatesByName).filter((pattern) => pattern.inserter !== false).map((pattern) => ({
23878          ...pattern,
23879          keywords: pattern.keywords || [],
23880          type: PATTERN_TYPES.theme,
23881          blocks: (0, import_blocks11.parse)(pattern.content, {
23882            __unstableSkipMigrationLogs: true
23883          })
23884        }));
23885        return {
23886          patterns,
23887          isResolving: isResolvingSelector("getBlockPatterns")
23888        };
23889      },
23890      (select3) => [
23891        select3(import_core_data41.store).getBlockPatterns(),
23892        select3(import_core_data41.store).isResolving("getBlockPatterns"),
23893        unlock(select3(store)).getSettings()
23894      ]
23895    );
23896    var selectPatterns = (0, import_data57.createSelector)(
23897      (select3, categoryId, syncStatus, search = "") => {
23898        const {
23899          patterns: themePatterns,
23900          isResolving: isResolvingThemePatterns
23901        } = selectThemePatterns(select3);
23902        const {
23903          patterns: userPatterns,
23904          isResolving: isResolvingUserPatterns,
23905          categories: userPatternCategories
23906        } = selectUserPatterns(select3);
23907        let patterns = [
23908          ...themePatterns || [],
23909          ...userPatterns || []
23910        ];
23911        if (syncStatus) {
23912          patterns = patterns.filter((pattern) => {
23913            return pattern.type === PATTERN_TYPES.user ? (pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full) === syncStatus : syncStatus === PATTERN_SYNC_TYPES.unsynced;
23914          });
23915        }
23916        if (categoryId) {
23917          patterns = searchItems(patterns, search, {
23918            categoryId,
23919            hasCategory: (item, currentCategory) => {
23920              if (item.type === PATTERN_TYPES.user) {
23921                return item.wp_pattern_category?.some(
23922                  (catId) => userPatternCategories.find(
23923                    (cat) => cat.id === catId
23924                  )?.slug === currentCategory
23925                );
23926              }
23927              return item.categories?.includes(currentCategory);
23928            }
23929          });
23930        } else {
23931          patterns = searchItems(patterns, search, {
23932            hasCategory: (item) => {
23933              if (item.type === PATTERN_TYPES.user) {
23934                return userPatternCategories?.length && (!item.wp_pattern_category?.length || !item.wp_pattern_category?.some(
23935                  (catId) => userPatternCategories.find(
23936                    (cat) => cat.id === catId
23937                  )
23938                ));
23939              }
23940              return !item.hasOwnProperty("categories");
23941            }
23942          });
23943        }
23944        return {
23945          patterns,
23946          isResolving: isResolvingThemePatterns || isResolvingUserPatterns
23947        };
23948      },
23949      (select3) => [
23950        selectThemePatterns(select3),
23951        selectUserPatterns(select3)
23952      ]
23953    );
23954    var selectUserPatterns = (0, import_data57.createSelector)(
23955      (select3, syncStatus, search = "") => {
23956        const {
23957          getEntityRecords,
23958          isResolving: isResolvingSelector,
23959          getUserPatternCategories
23960        } = select3(import_core_data41.store);
23961        const query = { per_page: -1 };
23962        const patternPosts = getEntityRecords(
23963          "postType",
23964          PATTERN_TYPES.user,
23965          query
23966        );
23967        const userPatternCategories = getUserPatternCategories();
23968        const categories = /* @__PURE__ */ new Map();
23969        userPatternCategories.forEach(
23970          (userCategory) => categories.set(userCategory.id, userCategory)
23971        );
23972        let patterns = patternPosts ?? EMPTY_PATTERN_LIST;
23973        const isResolving = isResolvingSelector("getEntityRecords", [
23974          "postType",
23975          PATTERN_TYPES.user,
23976          query
23977        ]);
23978        if (syncStatus) {
23979          patterns = patterns.filter(
23980            (pattern) => pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full === syncStatus
23981          );
23982        }
23983        patterns = searchItems(patterns, search, {
23984          // We exit user pattern retrieval early if we aren't in the
23985          // catch-all category for user created patterns, so it has
23986          // to be in the category.
23987          hasCategory: () => true
23988        });
23989        return {
23990          patterns,
23991          isResolving,
23992          categories: userPatternCategories
23993        };
23994      },
23995      (select3) => [
23996        select3(import_core_data41.store).getEntityRecords("postType", PATTERN_TYPES.user, {
23997          per_page: -1
23998        }),
23999        select3(import_core_data41.store).isResolving("getEntityRecords", [
24000          "postType",
24001          PATTERN_TYPES.user,
24002          { per_page: -1 }
24003        ]),
24004        select3(import_core_data41.store).getUserPatternCategories()
24005      ]
24006    );
24007    function useAugmentPatternsWithPermissions(patterns) {
24008      const idsAndTypes = (0, import_element66.useMemo)(
24009        () => patterns?.filter((record) => record.type !== PATTERN_TYPES.theme).map((record) => [record.type, record.id]) ?? [],
24010        [patterns]
24011      );
24012      const permissions = (0, import_data57.useSelect)(
24013        (select3) => {
24014          const { getEntityRecordPermissions } = unlock(
24015            select3(import_core_data41.store)
24016          );
24017          return idsAndTypes.reduce((acc, [type, id]) => {
24018            acc[id] = getEntityRecordPermissions("postType", type, id);
24019            return acc;
24020          }, {});
24021        },
24022        [idsAndTypes]
24023      );
24024      return (0, import_element66.useMemo)(
24025        () => patterns?.map((record) => ({
24026          ...record,
24027          permissions: permissions?.[record.id] ?? {}
24028        })) ?? [],
24029        [patterns, permissions]
24030      );
24031    }
24032    var usePatterns = (postType2, categoryId, { search = "", syncStatus } = {}) => {
24033      return (0, import_data57.useSelect)(
24034        (select3) => {
24035          if (postType2 === TEMPLATE_PART_POST_TYPE) {
24036            return selectTemplateParts(select3, categoryId, search);
24037          } else if (postType2 === PATTERN_TYPES.user && !!categoryId) {
24038            const appliedCategory = categoryId === "uncategorized" ? "" : categoryId;
24039            return selectPatterns(
24040              select3,
24041              appliedCategory,
24042              syncStatus,
24043              search
24044            );
24045          } else if (postType2 === PATTERN_TYPES.user) {
24046            return selectUserPatterns(select3, syncStatus, search);
24047          }
24048          return {
24049            patterns: EMPTY_PATTERN_LIST,
24050            isResolving: false
24051          };
24052        },
24053        [categoryId, postType2, search, syncStatus]
24054      );
24055    };
24056    var use_patterns_default = usePatterns;
24057  
24058    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.mjs
24059    function usePatternCategories() {
24060      const defaultCategories = useDefaultPatternCategories();
24061      defaultCategories.push({
24062        name: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,
24063        label: (0, import_i18n81.__)("Uncategorized")
24064      });
24065      const themePatterns = useThemePatterns();
24066      const { patterns: userPatterns, categories: userPatternCategories } = use_patterns_default(PATTERN_TYPES.user);
24067      const patternCategories = (0, import_element67.useMemo)(() => {
24068        const categoryMap = {};
24069        const categoriesWithCounts = [];
24070        defaultCategories.forEach((category) => {
24071          if (!categoryMap[category.name]) {
24072            categoryMap[category.name] = { ...category, count: 0 };
24073          }
24074        });
24075        userPatternCategories.forEach((category) => {
24076          if (!categoryMap[category.name]) {
24077            categoryMap[category.name] = { ...category, count: 0 };
24078          }
24079        });
24080        themePatterns.forEach((pattern) => {
24081          pattern.categories?.forEach((category) => {
24082            if (categoryMap[category]) {
24083              categoryMap[category].count += 1;
24084            }
24085          });
24086          if (!pattern.categories?.length) {
24087            categoryMap.uncategorized.count += 1;
24088          }
24089        });
24090        userPatterns.forEach((pattern) => {
24091          pattern.wp_pattern_category?.forEach((catId) => {
24092            const category = userPatternCategories.find(
24093              (cat) => cat.id === catId
24094            )?.name;
24095            if (categoryMap[category]) {
24096              categoryMap[category].count += 1;
24097            }
24098          });
24099          if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(
24100            (catId) => userPatternCategories.find((cat) => cat.id === catId)
24101          )) {
24102            categoryMap.uncategorized.count += 1;
24103          }
24104        });
24105        [...defaultCategories, ...userPatternCategories].forEach(
24106          (category) => {
24107            if (categoryMap[category.name].count && !categoriesWithCounts.find(
24108              (cat) => cat.name === category.name
24109            )) {
24110              categoriesWithCounts.push(categoryMap[category.name]);
24111            }
24112          }
24113        );
24114        const sortedCategories = categoriesWithCounts.sort(
24115          (a2, b2) => a2.label.localeCompare(b2.label)
24116        );
24117        sortedCategories.unshift({
24118          name: PATTERN_USER_CATEGORY,
24119          label: (0, import_i18n81.__)("My patterns"),
24120          count: userPatterns.length
24121        });
24122        sortedCategories.unshift({
24123          name: PATTERN_DEFAULT_CATEGORY,
24124          label: (0, import_i18n81.__)("All patterns"),
24125          description: (0, import_i18n81.__)("A list of all patterns from all sources."),
24126          count: themePatterns.length + userPatterns.length
24127        });
24128        return sortedCategories;
24129      }, [
24130        defaultCategories,
24131        themePatterns,
24132        userPatternCategories,
24133        userPatterns
24134      ]);
24135      return { patternCategories, hasPatterns: !!patternCategories.length };
24136    }
24137  
24138    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.mjs
24139    var import_core_data42 = __toESM(require_core_data(), 1);
24140    var import_data58 = __toESM(require_data(), 1);
24141    var import_block_library2 = __toESM(require_block_library(), 1);
24142    var { NAVIGATION_OVERLAY_TEMPLATE_PART_AREA } = unlock(
24143      import_block_library2.privateApis
24144    );
24145    var useTemplatePartsGroupedByArea = (items) => {
24146      const allItems = items || [];
24147      const templatePartAreas = (0, import_data58.useSelect)(
24148        (select3) => select3(import_core_data42.store).getCurrentTheme()?.default_template_part_areas || [],
24149        []
24150      );
24151      const knownAreas = {
24152        header: {},
24153        footer: {},
24154        sidebar: {},
24155        uncategorized: {},
24156        [NAVIGATION_OVERLAY_TEMPLATE_PART_AREA]: {}
24157      };
24158      templatePartAreas.forEach(
24159        (templatePartArea) => knownAreas[templatePartArea.area] = {
24160          ...templatePartArea,
24161          templateParts: []
24162        }
24163      );
24164      const groupedByArea = allItems.reduce((accumulator, item) => {
24165        const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
24166        accumulator[key]?.templateParts?.push(item);
24167        return accumulator;
24168      }, knownAreas);
24169      return groupedByArea;
24170    };
24171    function useTemplatePartAreas() {
24172      const { records: templateParts, isResolving: isLoading } = (0, import_core_data42.useEntityRecords)(
24173        "postType",
24174        TEMPLATE_PART_POST_TYPE,
24175        { per_page: -1 }
24176      );
24177      return {
24178        hasTemplateParts: templateParts ? !!templateParts.length : false,
24179        isLoading,
24180        templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
24181      };
24182    }
24183  
24184    // packages/edit-site/build-module/components/sidebar-navigation-screen-patterns/index.mjs
24185    var import_jsx_runtime183 = __toESM(require_jsx_runtime(), 1);
24186    var { useLocation: useLocation24 } = unlock(import_router27.privateApis);
24187    function CategoriesGroup({
24188      templatePartAreas,
24189      patternCategories,
24190      currentCategory,
24191      currentType
24192    }) {
24193      const [allPatterns, ...otherPatterns] = patternCategories;
24194      return /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(import_components90.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: [
24195        /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
24196          CategoryItem,
24197          {
24198            count: Object.values(templatePartAreas).map(({ templateParts }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0),
24199            icon: (0, import_editor27.getTemplatePartIcon)(),
24200            label: (0, import_i18n82.__)("All template parts"),
24201            id: TEMPLATE_PART_ALL_AREAS_CATEGORY,
24202            type: TEMPLATE_PART_POST_TYPE,
24203            isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE
24204          },
24205          "all"
24206        ),
24207        Object.entries(templatePartAreas).map(
24208          ([area, { label, templateParts, icon }]) => /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
24209            CategoryItem,
24210            {
24211              count: templateParts?.length,
24212              icon: (0, import_editor27.getTemplatePartIcon)(icon),
24213              label,
24214              id: area,
24215              type: TEMPLATE_PART_POST_TYPE,
24216              isActive: currentCategory === area && currentType === TEMPLATE_PART_POST_TYPE
24217            },
24218            area
24219          )
24220        ),
24221        /* @__PURE__ */ (0, import_jsx_runtime183.jsx)("div", { className: "edit-site-sidebar-navigation-screen-patterns__divider" }),
24222        allPatterns && /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
24223          CategoryItem,
24224          {
24225            count: allPatterns.count,
24226            label: allPatterns.label,
24227            icon: file_default,
24228            id: allPatterns.name,
24229            type: PATTERN_TYPES.user,
24230            isActive: currentCategory === `$allPatterns.name}` && currentType === PATTERN_TYPES.user
24231          },
24232          allPatterns.name
24233        ),
24234        otherPatterns.map((category) => /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
24235          CategoryItem,
24236          {
24237            count: category.count,
24238            label: category.label,
24239            icon: file_default,
24240            id: category.name,
24241            type: PATTERN_TYPES.user,
24242            isActive: currentCategory === `$category.name}` && currentType === PATTERN_TYPES.user
24243          },
24244          category.name
24245        ))
24246      ] });
24247    }
24248    function SidebarNavigationScreenPatterns({ backPath }) {
24249      const {
24250        query: { postType: postType2 = "wp_block", categoryId }
24251      } = useLocation24();
24252      const currentCategory = categoryId || (postType2 === PATTERN_TYPES.user ? PATTERN_DEFAULT_CATEGORY : TEMPLATE_PART_ALL_AREAS_CATEGORY);
24253      const { templatePartAreas, hasTemplateParts, isLoading } = useTemplatePartAreas();
24254      const { patternCategories, hasPatterns } = usePatternCategories();
24255      return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
24256        SidebarNavigationScreen,
24257        {
24258          title: (0, import_i18n82.__)("Patterns"),
24259          description: (0, import_i18n82.__)(
24260            "Manage what patterns are available when editing the site."
24261          ),
24262          isRoot: !backPath,
24263          backPath,
24264          content: /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(import_jsx_runtime183.Fragment, { children: [
24265            isLoading && (0, import_i18n82.__)("Loading items\u2026"),
24266            !isLoading && /* @__PURE__ */ (0, import_jsx_runtime183.jsxs)(import_jsx_runtime183.Fragment, { children: [
24267              !hasTemplateParts && !hasPatterns && /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(import_components90.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-patterns__group", children: /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(import_components90.__experimentalItem, { children: (0, import_i18n82.__)("No items found") }) }),
24268              /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
24269                CategoriesGroup,
24270                {
24271                  templatePartAreas,
24272                  patternCategories,
24273                  currentCategory,
24274                  currentType: postType2
24275                }
24276              )
24277            ] })
24278          ] })
24279        }
24280      );
24281    }
24282  
24283    // packages/edit-site/build-module/components/page-patterns/index.mjs
24284    var import_i18n139 = __toESM(require_i18n(), 1);
24285    var import_element141 = __toESM(require_element(), 1);
24286    var import_block_editor25 = __toESM(require_block_editor(), 1);
24287  
24288    // packages/dataviews/build-module/dataviews/index.mjs
24289    var import_element121 = __toESM(require_element(), 1);
24290    var import_compose23 = __toESM(require_compose(), 1);
24291  
24292    // packages/dataviews/build-module/components/dataviews-context/index.mjs
24293    var import_element68 = __toESM(require_element(), 1);
24294  
24295    // packages/dataviews/build-module/constants.mjs
24296    var import_i18n83 = __toESM(require_i18n(), 1);
24297    var OPERATOR_IS_ANY2 = "isAny";
24298    var OPERATOR_IS_NONE2 = "isNone";
24299    var OPERATOR_IS_ALL = "isAll";
24300    var OPERATOR_IS_NOT_ALL = "isNotAll";
24301    var OPERATOR_BETWEEN = "between";
24302    var OPERATOR_IN_THE_PAST = "inThePast";
24303    var OPERATOR_OVER = "over";
24304    var OPERATOR_IS2 = "is";
24305    var OPERATOR_IS_NOT = "isNot";
24306    var OPERATOR_LESS_THAN = "lessThan";
24307    var OPERATOR_GREATER_THAN = "greaterThan";
24308    var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
24309    var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
24310    var OPERATOR_BEFORE2 = "before";
24311    var OPERATOR_AFTER2 = "after";
24312    var OPERATOR_BEFORE_INC = "beforeInc";
24313    var OPERATOR_AFTER_INC = "afterInc";
24314    var OPERATOR_CONTAINS = "contains";
24315    var OPERATOR_NOT_CONTAINS = "notContains";
24316    var OPERATOR_STARTS_WITH = "startsWith";
24317    var OPERATOR_ON = "on";
24318    var OPERATOR_NOT_ON = "notOn";
24319    var SORTING_DIRECTIONS = ["asc", "desc"];
24320    var sortArrows = { asc: "\u2191", desc: "\u2193" };
24321    var sortValues = { asc: "ascending", desc: "descending" };
24322    var sortLabels = {
24323      asc: (0, import_i18n83.__)("Sort ascending"),
24324      desc: (0, import_i18n83.__)("Sort descending")
24325    };
24326    var sortIcons = {
24327      asc: arrow_up_default,
24328      desc: arrow_down_default
24329    };
24330    var LAYOUT_TABLE2 = "table";
24331    var LAYOUT_GRID2 = "grid";
24332    var LAYOUT_LIST2 = "list";
24333    var LAYOUT_ACTIVITY = "activity";
24334    var LAYOUT_PICKER_GRID = "pickerGrid";
24335    var LAYOUT_PICKER_TABLE = "pickerTable";
24336  
24337    // packages/dataviews/build-module/components/dataviews-context/index.mjs
24338    var DataViewsContext = (0, import_element68.createContext)({
24339      view: { type: LAYOUT_TABLE2 },
24340      onChangeView: () => {
24341      },
24342      fields: [],
24343      data: [],
24344      paginationInfo: {
24345        totalItems: 0,
24346        totalPages: 0
24347      },
24348      selection: [],
24349      onChangeSelection: () => {
24350      },
24351      setOpenedFilter: () => {
24352      },
24353      openedFilter: null,
24354      getItemId: (item) => item.id,
24355      isItemClickable: () => true,
24356      renderItemLink: void 0,
24357      containerWidth: 0,
24358      containerRef: (0, import_element68.createRef)(),
24359      resizeObserverRef: () => {
24360      },
24361      defaultLayouts: { list: {}, grid: {}, table: {} },
24362      filters: [],
24363      isShowingFilter: false,
24364      setIsShowingFilter: () => {
24365      },
24366      hasInitiallyLoaded: false,
24367      hasInfiniteScrollHandler: false,
24368      config: {
24369        perPageSizes: []
24370      }
24371    });
24372    DataViewsContext.displayName = "DataViewsContext";
24373    var dataviews_context_default = DataViewsContext;
24374  
24375    // packages/dataviews/build-module/components/dataviews-layouts/index.mjs
24376    var import_i18n103 = __toESM(require_i18n(), 1);
24377  
24378    // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs
24379    var import_i18n91 = __toESM(require_i18n(), 1);
24380    var import_components96 = __toESM(require_components(), 1);
24381    var import_element76 = __toESM(require_element(), 1);
24382    var import_keycodes6 = __toESM(require_keycodes(), 1);
24383  
24384    // packages/dataviews/build-module/components/dataviews-selection-checkbox/index.mjs
24385    var import_components91 = __toESM(require_components(), 1);
24386    var import_i18n84 = __toESM(require_i18n(), 1);
24387    var import_jsx_runtime184 = __toESM(require_jsx_runtime(), 1);
24388    function DataViewsSelectionCheckbox({
24389      selection,
24390      onChangeSelection,
24391      item,
24392      getItemId: getItemId2,
24393      titleField,
24394      disabled,
24395      ...extraProps
24396    }) {
24397      const id = getItemId2(item);
24398      const checked = !disabled && selection.includes(id);
24399      const selectionLabel = titleField?.getValue?.({ item }) || (0, import_i18n84.__)("(no title)");
24400      return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
24401        import_components91.CheckboxControl,
24402        {
24403          className: "dataviews-selection-checkbox",
24404          "aria-label": selectionLabel,
24405          "aria-disabled": disabled,
24406          checked,
24407          onChange: () => {
24408            if (disabled) {
24409              return;
24410            }
24411            onChangeSelection(
24412              selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
24413            );
24414          },
24415          ...extraProps
24416        }
24417      );
24418    }
24419  
24420    // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs
24421    var import_components92 = __toESM(require_components(), 1);
24422    var import_i18n85 = __toESM(require_i18n(), 1);
24423    var import_element69 = __toESM(require_element(), 1);
24424    var import_data59 = __toESM(require_data(), 1);
24425    var import_compose12 = __toESM(require_compose(), 1);
24426  
24427    // packages/dataviews/build-module/lock-unlock.mjs
24428    var import_private_apis3 = __toESM(require_private_apis(), 1);
24429    var { lock: lock3, unlock: unlock3 } = (0, import_private_apis3.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
24430      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
24431      "@wordpress/dataviews"
24432    );
24433  
24434    // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs
24435    var import_jsx_runtime185 = __toESM(require_jsx_runtime(), 1);
24436    var { Menu: Menu5, kebabCase: kebabCase4 } = unlock3(import_components92.privateApis);
24437    function ButtonTrigger({
24438      action,
24439      onClick,
24440      items,
24441      variant
24442    }) {
24443      const label = typeof action.label === "string" ? action.label : action.label(items);
24444      return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24445        import_components92.Button,
24446        {
24447          disabled: !!action.disabled,
24448          accessibleWhenDisabled: true,
24449          size: "compact",
24450          variant,
24451          onClick,
24452          children: label
24453        }
24454      );
24455    }
24456    function MenuItemTrigger({
24457      action,
24458      onClick,
24459      items
24460    }) {
24461      const label = typeof action.label === "string" ? action.label : action.label(items);
24462      return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(Menu5.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(Menu5.ItemLabel, { children: label }) });
24463    }
24464    function ActionModal({
24465      action,
24466      items,
24467      closeModal
24468    }) {
24469      const label = typeof action.label === "string" ? action.label : action.label(items);
24470      const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader;
24471      return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24472        import_components92.Modal,
24473        {
24474          title: modalHeader || label,
24475          __experimentalHideHeader: !!action.hideModalHeader,
24476          onRequestClose: closeModal,
24477          focusOnMount: action.modalFocusOnMount ?? true,
24478          size: action.modalSize || "medium",
24479          overlayClassName: `dataviews-action-modal dataviews-action-modal__$kebabCase4(
24480            action.id
24481          )}`,
24482          children: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(action.RenderModal, { items, closeModal })
24483        }
24484      );
24485    }
24486    function ActionsMenuGroup({
24487      actions,
24488      item,
24489      registry,
24490      setActiveModalAction
24491    }) {
24492      const { primaryActions, regularActions } = (0, import_element69.useMemo)(() => {
24493        return actions.reduce(
24494          (acc, action) => {
24495            (action.isPrimary ? acc.primaryActions : acc.regularActions).push(action);
24496            return acc;
24497          },
24498          {
24499            primaryActions: [],
24500            regularActions: []
24501          }
24502        );
24503      }, [actions]);
24504      const renderActionGroup = (actionList) => actionList.map((action) => /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24505        MenuItemTrigger,
24506        {
24507          action,
24508          onClick: () => {
24509            if ("RenderModal" in action) {
24510              setActiveModalAction(action);
24511              return;
24512            }
24513            action.callback([item], { registry });
24514          },
24515          items: [item]
24516        },
24517        action.id
24518      ));
24519      return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)(Menu5.Group, { children: [
24520        renderActionGroup(primaryActions),
24521        renderActionGroup(regularActions)
24522      ] });
24523    }
24524    function ItemActions({
24525      item,
24526      actions,
24527      isCompact
24528    }) {
24529      const registry = (0, import_data59.useRegistry)();
24530      const { primaryActions, eligibleActions } = (0, import_element69.useMemo)(() => {
24531        const _eligibleActions = actions.filter(
24532          (action) => !action.isEligible || action.isEligible(item)
24533        );
24534        const _primaryActions = _eligibleActions.filter(
24535          (action) => action.isPrimary
24536        );
24537        return {
24538          primaryActions: _primaryActions,
24539          eligibleActions: _eligibleActions
24540        };
24541      }, [actions, item]);
24542      const isMobileViewport = (0, import_compose12.useViewportMatch)("medium", "<");
24543      if (isCompact) {
24544        return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24545          CompactItemActions,
24546          {
24547            item,
24548            actions: eligibleActions,
24549            isSmall: true,
24550            registry
24551          }
24552        );
24553      }
24554      return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)(
24555        Stack,
24556        {
24557          direction: "row",
24558          justify: "flex-end",
24559          className: "dataviews-item-actions",
24560          style: {
24561            flexShrink: 0,
24562            width: "auto"
24563          },
24564          children: [
24565            /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24566              PrimaryActions,
24567              {
24568                item,
24569                actions: primaryActions,
24570                registry
24571              }
24572            ),
24573            (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu
24574            // there if there are any actions at all.
24575            isMobileViewport) && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24576              CompactItemActions,
24577              {
24578                item,
24579                actions: eligibleActions,
24580                registry
24581              }
24582            )
24583          ]
24584        }
24585      );
24586    }
24587    function CompactItemActions({
24588      item,
24589      actions,
24590      isSmall,
24591      registry
24592    }) {
24593      const [activeModalAction, setActiveModalAction] = (0, import_element69.useState)(
24594        null
24595      );
24596      return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)(import_jsx_runtime185.Fragment, { children: [
24597        /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)(Menu5, { placement: "bottom-end", children: [
24598          /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24599            Menu5.TriggerButton,
24600            {
24601              render: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24602                import_components92.Button,
24603                {
24604                  size: isSmall ? "small" : "compact",
24605                  icon: more_vertical_default,
24606                  label: (0, import_i18n85.__)("Actions"),
24607                  accessibleWhenDisabled: true,
24608                  disabled: !actions.length,
24609                  className: "dataviews-all-actions-button"
24610                }
24611              )
24612            }
24613          ),
24614          /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(Menu5.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24615            ActionsMenuGroup,
24616            {
24617              actions,
24618              item,
24619              registry,
24620              setActiveModalAction
24621            }
24622          ) })
24623        ] }),
24624        !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24625          ActionModal,
24626          {
24627            action: activeModalAction,
24628            items: [item],
24629            closeModal: () => setActiveModalAction(null)
24630          }
24631        )
24632      ] });
24633    }
24634    function PrimaryActions({
24635      item,
24636      actions,
24637      registry,
24638      buttonVariant
24639    }) {
24640      const [activeModalAction, setActiveModalAction] = (0, import_element69.useState)(null);
24641      const isMobileViewport = (0, import_compose12.useViewportMatch)("medium", "<");
24642      if (isMobileViewport) {
24643        return null;
24644      }
24645      if (!Array.isArray(actions) || actions.length === 0) {
24646        return null;
24647      }
24648      return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)(import_jsx_runtime185.Fragment, { children: [
24649        actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24650          ButtonTrigger,
24651          {
24652            action,
24653            onClick: () => {
24654              if ("RenderModal" in action) {
24655                setActiveModalAction(action);
24656                return;
24657              }
24658              action.callback([item], { registry });
24659            },
24660            items: [item],
24661            variant: buttonVariant
24662          },
24663          action.id
24664        )),
24665        !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
24666          ActionModal,
24667          {
24668            action: activeModalAction,
24669            items: [item],
24670            closeModal: () => setActiveModalAction(null)
24671          }
24672        )
24673      ] });
24674    }
24675  
24676    // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs
24677    var import_components93 = __toESM(require_components(), 1);
24678    var import_i18n87 = __toESM(require_i18n(), 1);
24679    var import_element70 = __toESM(require_element(), 1);
24680    var import_data60 = __toESM(require_data(), 1);
24681    var import_compose13 = __toESM(require_compose(), 1);
24682  
24683    // packages/dataviews/build-module/utils/get-footer-message.mjs
24684    var import_i18n86 = __toESM(require_i18n(), 1);
24685    function getFooterMessage(selectionCount, itemsCount, totalItems) {
24686      if (selectionCount > 0) {
24687        return (0, import_i18n86.sprintf)(
24688          /* translators: %d: number of items. */
24689          (0, import_i18n86._n)("%d Item selected", "%d Items selected", selectionCount),
24690          selectionCount
24691        );
24692      }
24693      if (totalItems > itemsCount) {
24694        return (0, import_i18n86.sprintf)(
24695          /* translators: %1$d: number of items. %2$d: total number of items. */
24696          (0, import_i18n86._n)("%1$d of %2$d Item", "%1$d of %2$d Items", totalItems),
24697          itemsCount,
24698          totalItems
24699        );
24700      }
24701      return (0, import_i18n86.sprintf)(
24702        /* translators: %d: number of items. */
24703        (0, import_i18n86._n)("%d Item", "%d Items", itemsCount),
24704        itemsCount
24705      );
24706    }
24707  
24708    // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs
24709    var import_jsx_runtime186 = __toESM(require_jsx_runtime(), 1);
24710    function ActionWithModal({
24711      action,
24712      items,
24713      ActionTriggerComponent
24714    }) {
24715      const [isModalOpen, setIsModalOpen] = (0, import_element70.useState)(false);
24716      const actionTriggerProps = {
24717        action,
24718        onClick: () => {
24719          setIsModalOpen(true);
24720        },
24721        items
24722      };
24723      return /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(import_jsx_runtime186.Fragment, { children: [
24724        /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(ActionTriggerComponent, { ...actionTriggerProps }),
24725        isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24726          ActionModal,
24727          {
24728            action,
24729            items,
24730            closeModal: () => setIsModalOpen(false)
24731          }
24732        )
24733      ] });
24734    }
24735    function useHasAPossibleBulkAction(actions, item) {
24736      return (0, import_element70.useMemo)(() => {
24737        return actions.some((action) => {
24738          return action.supportsBulk && (!action.isEligible || action.isEligible(item));
24739        });
24740      }, [actions, item]);
24741    }
24742    function useSomeItemHasAPossibleBulkAction(actions, data) {
24743      return (0, import_element70.useMemo)(() => {
24744        return data.some((item) => {
24745          return actions.some((action) => {
24746            return action.supportsBulk && (!action.isEligible || action.isEligible(item));
24747          });
24748        });
24749      }, [actions, data]);
24750    }
24751    function BulkSelectionCheckbox({
24752      selection,
24753      onChangeSelection,
24754      data,
24755      actions,
24756      getItemId: getItemId2
24757    }) {
24758      const selectableItems = (0, import_element70.useMemo)(() => {
24759        return data.filter((item) => {
24760          return actions.some(
24761            (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item))
24762          );
24763        });
24764      }, [data, actions]);
24765      const selectedItems = data.filter(
24766        (item) => selection.includes(getItemId2(item)) && selectableItems.includes(item)
24767      );
24768      const areAllSelected = selectedItems.length === selectableItems.length;
24769      return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24770        import_components93.CheckboxControl,
24771        {
24772          className: "dataviews-view-table-selection-checkbox",
24773          checked: areAllSelected,
24774          indeterminate: !areAllSelected && !!selectedItems.length,
24775          onChange: () => {
24776            if (areAllSelected) {
24777              onChangeSelection([]);
24778            } else {
24779              onChangeSelection(
24780                selectableItems.map((item) => getItemId2(item))
24781              );
24782            }
24783          },
24784          "aria-label": areAllSelected ? (0, import_i18n87.__)("Deselect all") : (0, import_i18n87.__)("Select all")
24785        }
24786      );
24787    }
24788    function ActionTrigger({
24789      action,
24790      onClick,
24791      isBusy,
24792      items
24793    }) {
24794      const label = typeof action.label === "string" ? action.label : action.label(items);
24795      const isMobile = (0, import_compose13.useViewportMatch)("medium", "<");
24796      if (isMobile) {
24797        return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24798          import_components93.Button,
24799          {
24800            disabled: isBusy,
24801            accessibleWhenDisabled: true,
24802            label,
24803            icon: action.icon,
24804            size: "compact",
24805            onClick,
24806            isBusy
24807          }
24808        );
24809      }
24810      return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24811        import_components93.Button,
24812        {
24813          disabled: isBusy,
24814          accessibleWhenDisabled: true,
24815          size: "compact",
24816          onClick,
24817          isBusy,
24818          children: label
24819        }
24820      );
24821    }
24822    var EMPTY_ARRAY5 = [];
24823    function ActionButton({
24824      action,
24825      selectedItems,
24826      actionInProgress,
24827      setActionInProgress
24828    }) {
24829      const registry = (0, import_data60.useRegistry)();
24830      const selectedEligibleItems = (0, import_element70.useMemo)(() => {
24831        return selectedItems.filter((item) => {
24832          return !action.isEligible || action.isEligible(item);
24833        });
24834      }, [action, selectedItems]);
24835      if ("RenderModal" in action) {
24836        return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24837          ActionWithModal,
24838          {
24839            action,
24840            items: selectedEligibleItems,
24841            ActionTriggerComponent: ActionTrigger
24842          },
24843          action.id
24844        );
24845      }
24846      return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24847        ActionTrigger,
24848        {
24849          action,
24850          onClick: async () => {
24851            setActionInProgress(action.id);
24852            await action.callback(selectedItems, {
24853              registry
24854            });
24855            setActionInProgress(null);
24856          },
24857          items: selectedEligibleItems,
24858          isBusy: actionInProgress === action.id
24859        },
24860        action.id
24861      );
24862    }
24863    function renderFooterContent(data, actions, getItemId2, selection, actionsToShow, selectedItems, actionInProgress, setActionInProgress, onChangeSelection, paginationInfo) {
24864      const message2 = getFooterMessage(
24865        selection.length,
24866        data.length,
24867        paginationInfo.totalItems
24868      );
24869      return /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(
24870        Stack,
24871        {
24872          direction: "row",
24873          className: "dataviews-bulk-actions-footer__container",
24874          gap: "md",
24875          align: "center",
24876          children: [
24877            /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24878              BulkSelectionCheckbox,
24879              {
24880                selection,
24881                onChangeSelection,
24882                data,
24883                actions,
24884                getItemId: getItemId2
24885              }
24886            ),
24887            /* @__PURE__ */ (0, import_jsx_runtime186.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message2 }),
24888            /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(
24889              Stack,
24890              {
24891                direction: "row",
24892                className: "dataviews-bulk-actions-footer__action-buttons",
24893                gap: "xs",
24894                children: [
24895                  actionsToShow.map((action) => {
24896                    return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24897                      ActionButton,
24898                      {
24899                        action,
24900                        selectedItems,
24901                        actionInProgress,
24902                        setActionInProgress
24903                      },
24904                      action.id
24905                    );
24906                  }),
24907                  selectedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
24908                    import_components93.Button,
24909                    {
24910                      icon: close_small_default,
24911                      showTooltip: true,
24912                      tooltipPosition: "top",
24913                      size: "compact",
24914                      label: (0, import_i18n87.__)("Cancel"),
24915                      disabled: !!actionInProgress,
24916                      accessibleWhenDisabled: false,
24917                      onClick: () => {
24918                        onChangeSelection(EMPTY_ARRAY5);
24919                      }
24920                    }
24921                  )
24922                ]
24923              }
24924            )
24925          ]
24926        }
24927      );
24928    }
24929    function FooterContent({
24930      selection,
24931      actions,
24932      onChangeSelection,
24933      data,
24934      getItemId: getItemId2,
24935      paginationInfo
24936    }) {
24937      const [actionInProgress, setActionInProgress] = (0, import_element70.useState)(
24938        null
24939      );
24940      const footerContentRef = (0, import_element70.useRef)(void 0);
24941      const isMobile = (0, import_compose13.useViewportMatch)("medium", "<");
24942      const bulkActions = (0, import_element70.useMemo)(
24943        () => actions.filter((action) => action.supportsBulk),
24944        [actions]
24945      );
24946      const selectableItems = (0, import_element70.useMemo)(() => {
24947        return data.filter((item) => {
24948          return bulkActions.some(
24949            (action) => !action.isEligible || action.isEligible(item)
24950          );
24951        });
24952      }, [data, bulkActions]);
24953      const selectedItems = (0, import_element70.useMemo)(() => {
24954        return data.filter(
24955          (item) => selection.includes(getItemId2(item)) && selectableItems.includes(item)
24956        );
24957      }, [selection, data, getItemId2, selectableItems]);
24958      const actionsToShow = (0, import_element70.useMemo)(
24959        () => actions.filter((action) => {
24960          return action.supportsBulk && (!isMobile || action.icon) && selectedItems.some(
24961            (item) => !action.isEligible || action.isEligible(item)
24962          );
24963        }),
24964        [actions, selectedItems, isMobile]
24965      );
24966      if (!actionInProgress) {
24967        if (footerContentRef.current) {
24968          footerContentRef.current = void 0;
24969        }
24970        return renderFooterContent(
24971          data,
24972          actions,
24973          getItemId2,
24974          selection,
24975          actionsToShow,
24976          selectedItems,
24977          actionInProgress,
24978          setActionInProgress,
24979          onChangeSelection,
24980          paginationInfo
24981        );
24982      } else if (!footerContentRef.current) {
24983        footerContentRef.current = renderFooterContent(
24984          data,
24985          actions,
24986          getItemId2,
24987          selection,
24988          actionsToShow,
24989          selectedItems,
24990          actionInProgress,
24991          setActionInProgress,
24992          onChangeSelection,
24993          paginationInfo
24994        );
24995      }
24996      return footerContentRef.current;
24997    }
24998    function BulkActionsFooter() {
24999      const {
25000        data,
25001        selection,
25002        actions = EMPTY_ARRAY5,
25003        onChangeSelection,
25004        getItemId: getItemId2,
25005        paginationInfo
25006      } = (0, import_element70.useContext)(dataviews_context_default);
25007      return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
25008        FooterContent,
25009        {
25010          selection,
25011          onChangeSelection,
25012          data,
25013          actions,
25014          getItemId: getItemId2,
25015          paginationInfo
25016        }
25017      );
25018    }
25019  
25020    // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs
25021    var import_i18n88 = __toESM(require_i18n(), 1);
25022    var import_components94 = __toESM(require_components(), 1);
25023    var import_element71 = __toESM(require_element(), 1);
25024  
25025    // packages/dataviews/build-module/utils/get-hideable-fields.mjs
25026    function getHideableFields(view, fields) {
25027      const togglableFields = [
25028        view?.titleField,
25029        view?.mediaField,
25030        view?.descriptionField
25031      ].filter(Boolean);
25032      return fields.filter(
25033        (f2) => !togglableFields.includes(f2.id) && f2.type !== "media" && f2.enableHiding !== false
25034      );
25035    }
25036  
25037    // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs
25038    var import_jsx_runtime187 = __toESM(require_jsx_runtime(), 1);
25039    var { Menu: Menu6 } = unlock3(import_components94.privateApis);
25040    function WithMenuSeparators({ children }) {
25041      return import_element71.Children.toArray(children).filter(Boolean).map((child, i2) => /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(import_element71.Fragment, { children: [
25042        i2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.Separator, {}),
25043        child
25044      ] }, i2));
25045    }
25046    var _HeaderMenu = (0, import_element71.forwardRef)(function HeaderMenu({
25047      fieldId,
25048      view,
25049      fields,
25050      onChangeView,
25051      onHide,
25052      setOpenedFilter,
25053      canMove = true,
25054      canInsertLeft = true,
25055      canInsertRight = true
25056    }, ref) {
25057      const visibleFieldIds = view.fields ?? [];
25058      const index = visibleFieldIds?.indexOf(fieldId);
25059      const isSorted = view.sort?.field === fieldId;
25060      let isHidable = false;
25061      let isSortable = false;
25062      let canAddFilter = false;
25063      let operators = [];
25064      const field = fields.find((f2) => f2.id === fieldId);
25065      const { setIsShowingFilter } = (0, import_element71.useContext)(dataviews_context_default);
25066      if (!field) {
25067        return null;
25068      }
25069      isHidable = field.enableHiding !== false;
25070      isSortable = field.enableSorting !== false;
25071      const header = field.header;
25072      operators = !!field.filterBy && field.filterBy?.operators || [];
25073      canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary;
25074      if (!isSortable && !canMove && !isHidable && !canAddFilter) {
25075        return header;
25076      }
25077      const hiddenFields = getHideableFields(view, fields).filter(
25078        (f2) => !visibleFieldIds.includes(f2.id)
25079      );
25080      const canInsert = (canInsertLeft || canInsertRight) && !!hiddenFields.length;
25081      const isRtl = (0, import_i18n88.isRTL)();
25082      return /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(Menu6, { children: [
25083        /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(
25084          Menu6.TriggerButton,
25085          {
25086            render: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
25087              import_components94.Button,
25088              {
25089                size: "compact",
25090                className: "dataviews-view-table-header-button",
25091                ref,
25092                variant: "tertiary"
25093              }
25094            ),
25095            children: [
25096              header,
25097              view.sort && isSorted && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] })
25098            ]
25099          }
25100        ),
25101        /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(WithMenuSeparators, { children: [
25102          isSortable && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.Group, { children: SORTING_DIRECTIONS.map(
25103            (direction) => {
25104              const isChecked = view.sort && isSorted && view.sort.direction === direction;
25105              const value = `$fieldId}-$direction}`;
25106              return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
25107                Menu6.RadioItem,
25108                {
25109                  name: "view-table-sorting",
25110                  value,
25111                  checked: isChecked,
25112                  onChange: () => {
25113                    onChangeView({
25114                      ...view,
25115                      sort: {
25116                        field: fieldId,
25117                        direction
25118                      },
25119                      showLevels: false
25120                    });
25121                  },
25122                  children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: sortLabels[direction] })
25123                },
25124                value
25125              );
25126            }
25127          ) }),
25128          canAddFilter && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
25129            Menu6.Item,
25130            {
25131              prefix: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_components94.Icon, { icon: funnel_default }),
25132              onClick: () => {
25133                setOpenedFilter(fieldId);
25134                setIsShowingFilter(true);
25135                onChangeView({
25136                  ...view,
25137                  page: 1,
25138                  filters: [
25139                    ...view.filters || [],
25140                    {
25141                      field: fieldId,
25142                      value: void 0,
25143                      operator: operators[0]
25144                    }
25145                  ]
25146                });
25147              },
25148              children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: (0, import_i18n88.__)("Add filter") })
25149            }
25150          ) }),
25151          (canMove || isHidable || canInsert) && field && /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(Menu6.Group, { children: [
25152            canMove && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
25153              Menu6.Item,
25154              {
25155                prefix: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_components94.Icon, { icon: arrow_left_default }),
25156                disabled: isRtl ? index >= visibleFieldIds.length - 1 : index < 1,
25157                onClick: () => {
25158                  const targetIndex = isRtl ? index + 1 : index - 1;
25159                  const newFields = [
25160                    ...visibleFieldIds
25161                  ];
25162                  newFields.splice(index, 1);
25163                  newFields.splice(
25164                    targetIndex,
25165                    0,
25166                    fieldId
25167                  );
25168                  onChangeView({
25169                    ...view,
25170                    fields: newFields
25171                  });
25172                },
25173                children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: (0, import_i18n88.__)("Move left") })
25174              }
25175            ),
25176            canMove && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
25177              Menu6.Item,
25178              {
25179                prefix: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_components94.Icon, { icon: arrow_right_default }),
25180                disabled: isRtl ? index < 1 : index >= visibleFieldIds.length - 1,
25181                onClick: () => {
25182                  const targetIndex = isRtl ? index - 1 : index + 1;
25183                  const newFields = [
25184                    ...visibleFieldIds
25185                  ];
25186                  newFields.splice(index, 1);
25187                  newFields.splice(
25188                    targetIndex,
25189                    0,
25190                    fieldId
25191                  );
25192                  onChangeView({
25193                    ...view,
25194                    fields: newFields
25195                  });
25196                },
25197                children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: (0, import_i18n88.__)("Move right") })
25198              }
25199            ),
25200            canInsertLeft && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(Menu6, { children: [
25201              /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: (0, import_i18n88.__)("Insert left") }) }),
25202              /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.Popover, { children: hiddenFields.map((hiddenField) => {
25203                const insertIndex = isRtl ? index + 1 : index;
25204                return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
25205                  Menu6.Item,
25206                  {
25207                    onClick: () => {
25208                      onChangeView({
25209                        ...view,
25210                        fields: [
25211                          ...visibleFieldIds.slice(
25212                            0,
25213                            insertIndex
25214                          ),
25215                          hiddenField.id,
25216                          ...visibleFieldIds.slice(
25217                            insertIndex
25218                          )
25219                        ]
25220                      });
25221                    },
25222                    children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: hiddenField.label })
25223                  },
25224                  hiddenField.id
25225                );
25226              }) })
25227            ] }),
25228            canInsertRight && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(Menu6, { children: [
25229              /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: (0, import_i18n88.__)("Insert right") }) }),
25230              /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.Popover, { children: hiddenFields.map((hiddenField) => {
25231                const insertIndex = isRtl ? index : index + 1;
25232                return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
25233                  Menu6.Item,
25234                  {
25235                    onClick: () => {
25236                      onChangeView({
25237                        ...view,
25238                        fields: [
25239                          ...visibleFieldIds.slice(
25240                            0,
25241                            insertIndex
25242                          ),
25243                          hiddenField.id,
25244                          ...visibleFieldIds.slice(
25245                            insertIndex
25246                          )
25247                        ]
25248                      });
25249                    },
25250                    children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: hiddenField.label })
25251                  },
25252                  hiddenField.id
25253                );
25254              }) })
25255            ] }),
25256            isHidable && field && /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
25257              Menu6.Item,
25258              {
25259                prefix: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(import_components94.Icon, { icon: unseen_default }),
25260                onClick: () => {
25261                  onHide(field);
25262                  onChangeView({
25263                    ...view,
25264                    fields: visibleFieldIds.filter(
25265                      (id) => id !== fieldId
25266                    )
25267                  });
25268                },
25269                children: /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(Menu6.ItemLabel, { children: (0, import_i18n88.__)("Hide column") })
25270              }
25271            )
25272          ] })
25273        ] }) })
25274      ] });
25275    });
25276    var ColumnHeaderMenu = _HeaderMenu;
25277    var column_header_menu_default = ColumnHeaderMenu;
25278  
25279    // packages/dataviews/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs
25280    var import_element72 = __toESM(require_element(), 1);
25281    var import_jsx_runtime188 = __toESM(require_jsx_runtime(), 1);
25282    function getClickableItemProps({
25283      item,
25284      isItemClickable,
25285      onClickItem,
25286      className
25287    }) {
25288      if (!isItemClickable(item) || !onClickItem) {
25289        return { className };
25290      }
25291      return {
25292        className: className ? `$className} $className}--clickable` : void 0,
25293        role: "button",
25294        tabIndex: 0,
25295        onClick: (event) => {
25296          event.stopPropagation();
25297          onClickItem(item);
25298        },
25299        onKeyDown: (event) => {
25300          if (event.key === "Enter" || event.key === "" || event.key === " ") {
25301            event.stopPropagation();
25302            onClickItem(item);
25303          }
25304        }
25305      };
25306    }
25307    function ItemClickWrapper({
25308      item,
25309      isItemClickable,
25310      onClickItem,
25311      renderItemLink,
25312      className,
25313      children,
25314      ...extraProps
25315    }) {
25316      if (!isItemClickable(item)) {
25317        return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("div", { className, ...extraProps, children });
25318      }
25319      if (renderItemLink) {
25320        const renderedElement = renderItemLink({
25321          item,
25322          className: `$className} $className}--clickable`,
25323          ...extraProps,
25324          children
25325        });
25326        return (0, import_element72.cloneElement)(renderedElement, {
25327          onClick: (event) => {
25328            event.stopPropagation();
25329            if (renderedElement.props.onClick) {
25330              renderedElement.props.onClick(event);
25331            }
25332          },
25333          onKeyDown: (event) => {
25334            if (event.key === "Enter" || event.key === "" || event.key === " ") {
25335              event.stopPropagation();
25336              if (renderedElement.props.onKeyDown) {
25337                renderedElement.props.onKeyDown(event);
25338              }
25339            }
25340          }
25341        });
25342      }
25343      const clickProps = getClickableItemProps({
25344        item,
25345        isItemClickable,
25346        onClickItem,
25347        className
25348      });
25349      return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("div", { ...clickProps, ...extraProps, children });
25350    }
25351  
25352    // packages/dataviews/build-module/components/dataviews-layouts/table/column-primary.mjs
25353    var import_jsx_runtime189 = __toESM(require_jsx_runtime(), 1);
25354    function ColumnPrimary({
25355      item,
25356      level,
25357      titleField,
25358      mediaField,
25359      descriptionField: descriptionField2,
25360      onClickItem,
25361      renderItemLink,
25362      isItemClickable
25363    }) {
25364      return /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(Stack, { direction: "row", gap: "md", align: "flex-start", justify: "flex-start", children: [
25365        mediaField && /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
25366          ItemClickWrapper,
25367          {
25368            item,
25369            isItemClickable,
25370            onClickItem,
25371            renderItemLink,
25372            className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media",
25373            "aria-label": isItemClickable(item) && (!!onClickItem || !!renderItemLink) && !!titleField ? titleField.getValue?.({ item }) : void 0,
25374            children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
25375              mediaField.render,
25376              {
25377                item,
25378                field: mediaField,
25379                config: { sizes: "32px" }
25380              }
25381            )
25382          }
25383        ),
25384        /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(
25385          Stack,
25386          {
25387            direction: "column",
25388            align: "flex-start",
25389            className: "dataviews-view-table__primary-column-content",
25390            children: [
25391              titleField && /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(
25392                ItemClickWrapper,
25393                {
25394                  item,
25395                  isItemClickable,
25396                  onClickItem,
25397                  renderItemLink,
25398                  className: "dataviews-view-table__cell-content-wrapper dataviews-title-field",
25399                  children: [
25400                    level !== void 0 && level > 0 && /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)("span", { className: "dataviews-view-table__level", children: [
25401                      Array(level).fill("\u2014").join(" "),
25402                      "\xA0"
25403                    ] }),
25404                    /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(titleField.render, { item, field: titleField })
25405                  ]
25406                }
25407              ),
25408              descriptionField2 && /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
25409                descriptionField2.render,
25410                {
25411                  item,
25412                  field: descriptionField2
25413                }
25414              )
25415            ]
25416          }
25417        )
25418      ] });
25419    }
25420    var column_primary_default = ColumnPrimary;
25421  
25422    // packages/dataviews/build-module/components/dataviews-layouts/table/use-is-horizontal-scroll-end.mjs
25423    var import_compose14 = __toESM(require_compose(), 1);
25424    var import_element73 = __toESM(require_element(), 1);
25425    var import_i18n89 = __toESM(require_i18n(), 1);
25426    var isScrolledToEnd = (element) => {
25427      if ((0, import_i18n89.isRTL)()) {
25428        const scrollLeft = Math.abs(element.scrollLeft);
25429        return scrollLeft <= 1;
25430      }
25431      return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1;
25432    };
25433    function useIsHorizontalScrollEnd({
25434      scrollContainerRef,
25435      enabled = false
25436    }) {
25437      const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0, import_element73.useState)(false);
25438      const handleIsHorizontalScrollEnd = (0, import_compose14.useDebounce)(
25439        (0, import_element73.useCallback)(() => {
25440          const scrollContainer = scrollContainerRef.current;
25441          if (scrollContainer) {
25442            setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer));
25443          }
25444        }, [scrollContainerRef, setIsHorizontalScrollEnd]),
25445        200
25446      );
25447      (0, import_element73.useEffect)(() => {
25448        if (typeof window === "undefined" || !enabled || !scrollContainerRef.current) {
25449          return () => {
25450          };
25451        }
25452        handleIsHorizontalScrollEnd();
25453        scrollContainerRef.current.addEventListener(
25454          "scroll",
25455          handleIsHorizontalScrollEnd
25456        );
25457        window.addEventListener("resize", handleIsHorizontalScrollEnd);
25458        return () => {
25459          scrollContainerRef.current?.removeEventListener(
25460            "scroll",
25461            handleIsHorizontalScrollEnd
25462          );
25463          window.removeEventListener("resize", handleIsHorizontalScrollEnd);
25464        };
25465      }, [scrollContainerRef, enabled]);
25466      return isHorizontalScrollEnd;
25467    }
25468  
25469    // packages/dataviews/build-module/components/dataviews-layouts/utils/get-data-by-group.mjs
25470    function getDataByGroup(data, groupByField) {
25471      return data.reduce((groups, item) => {
25472        const groupName = groupByField.getValue({ item });
25473        if (!groups.has(groupName)) {
25474          groups.set(groupName, []);
25475        }
25476        groups.get(groupName)?.push(item);
25477        return groups;
25478      }, /* @__PURE__ */ new Map());
25479    }
25480  
25481    // packages/dataviews/build-module/components/dataviews-view-config/properties-section.mjs
25482    var import_components95 = __toESM(require_components(), 1);
25483    var import_i18n90 = __toESM(require_i18n(), 1);
25484    var import_element74 = __toESM(require_element(), 1);
25485    var import_jsx_runtime190 = __toESM(require_jsx_runtime(), 1);
25486    function FieldItem({
25487      field,
25488      isVisible: isVisible2,
25489      onToggleVisibility
25490    }) {
25491      return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_components95.__experimentalItem, { onClick: field.enableHiding ? onToggleVisibility : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(Stack, { direction: "row", gap: "sm", justify: "flex-start", align: "center", children: [
25492        /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { style: { height: 24, width: 24 }, children: isVisible2 && /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_components95.Icon, { icon: check_default }) }),
25493        /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "dataviews-view-config__label", children: field.label })
25494      ] }) });
25495    }
25496    function isDefined(item) {
25497      return !!item;
25498    }
25499    function PropertiesSection({
25500      showLabel = true
25501    }) {
25502      const { view, fields, onChangeView } = (0, import_element74.useContext)(dataviews_context_default);
25503      const regularFields = getHideableFields(view, fields);
25504      if (!regularFields?.length) {
25505        return null;
25506      }
25507      const titleField = fields.find((f2) => f2.id === view.titleField);
25508      const previewField3 = fields.find((f2) => f2.id === view.mediaField);
25509      const descriptionField2 = fields.find(
25510        (f2) => f2.id === view.descriptionField
25511      );
25512      const lockedFields = [
25513        {
25514          field: titleField,
25515          isVisibleFlag: "showTitle"
25516        },
25517        {
25518          field: previewField3,
25519          isVisibleFlag: "showMedia"
25520        },
25521        {
25522          field: descriptionField2,
25523          isVisibleFlag: "showDescription"
25524        }
25525      ].filter(({ field }) => isDefined(field));
25526      const visibleFieldIds = view.fields ?? [];
25527      const visibleRegularFieldsCount = regularFields.filter(
25528        (f2) => visibleFieldIds.includes(f2.id)
25529      ).length;
25530      const visibleLockedFields = lockedFields.filter(
25531        ({ isVisibleFlag }) => (
25532          // @ts-expect-error
25533          view[isVisibleFlag] ?? true
25534        )
25535      );
25536      const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount;
25537      const isSingleVisibleLockedField = totalVisibleFields === 1 && visibleLockedFields.length === 1;
25538      return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(Stack, { direction: "column", className: "dataviews-field-control", children: [
25539        showLabel && /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_components95.BaseControl.VisualLabel, { children: (0, import_i18n90.__)("Properties") }),
25540        /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
25541          Stack,
25542          {
25543            direction: "column",
25544            className: "dataviews-view-config__properties",
25545            children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_components95.__experimentalItemGroup, { isBordered: true, isSeparated: true, size: "medium", children: [
25546              lockedFields.map(({ field, isVisibleFlag }) => {
25547                const isVisible2 = view[isVisibleFlag] ?? true;
25548                const fieldToRender = isSingleVisibleLockedField && isVisible2 ? { ...field, enableHiding: false } : field;
25549                return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
25550                  FieldItem,
25551                  {
25552                    field: fieldToRender,
25553                    isVisible: isVisible2,
25554                    onToggleVisibility: () => {
25555                      onChangeView({
25556                        ...view,
25557                        [isVisibleFlag]: !isVisible2
25558                      });
25559                    }
25560                  },
25561                  field.id
25562                );
25563              }),
25564              regularFields.map((field) => {
25565                const isVisible2 = visibleFieldIds.includes(field.id);
25566                const fieldToRender = totalVisibleFields === 1 && isVisible2 ? { ...field, enableHiding: false } : field;
25567                return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
25568                  FieldItem,
25569                  {
25570                    field: fieldToRender,
25571                    isVisible: isVisible2,
25572                    onToggleVisibility: () => {
25573                      onChangeView({
25574                        ...view,
25575                        fields: isVisible2 ? visibleFieldIds.filter(
25576                          (fieldId) => fieldId !== field.id
25577                        ) : [...visibleFieldIds, field.id]
25578                      });
25579                    }
25580                  },
25581                  field.id
25582                );
25583              })
25584            ] })
25585          }
25586        )
25587      ] });
25588    }
25589  
25590    // packages/dataviews/build-module/hooks/use-delayed-loading.mjs
25591    var import_element75 = __toESM(require_element(), 1);
25592    function useDelayedLoading(isLoading, options = { delay: 400 }) {
25593      const [showLoader, setShowLoader] = (0, import_element75.useState)(false);
25594      (0, import_element75.useEffect)(() => {
25595        if (!isLoading) {
25596          return;
25597        }
25598        const timeout = setTimeout(() => {
25599          setShowLoader(true);
25600        }, options.delay);
25601        return () => {
25602          clearTimeout(timeout);
25603          setShowLoader(false);
25604        };
25605      }, [isLoading, options.delay]);
25606      return showLoader;
25607    }
25608  
25609    // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs
25610    var import_jsx_runtime191 = __toESM(require_jsx_runtime(), 1);
25611    function getEffectiveAlign(explicitAlign, fieldType) {
25612      if (explicitAlign) {
25613        return explicitAlign;
25614      }
25615      if (fieldType === "integer" || fieldType === "number") {
25616        return "end";
25617      }
25618      return void 0;
25619    }
25620    function TableColumnField({
25621      item,
25622      fields,
25623      column,
25624      align
25625    }) {
25626      const field = fields.find((f2) => f2.id === column);
25627      if (!field) {
25628        return null;
25629      }
25630      const className = clsx_default("dataviews-view-table__cell-content-wrapper", {
25631        "dataviews-view-table__cell-align-end": align === "end",
25632        "dataviews-view-table__cell-align-center": align === "center"
25633      });
25634      return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(field.render, { item, field }) });
25635    }
25636    function TableRow({
25637      hasBulkActions,
25638      item,
25639      level,
25640      actions,
25641      fields,
25642      id,
25643      view,
25644      titleField,
25645      mediaField,
25646      descriptionField: descriptionField2,
25647      selection,
25648      getItemId: getItemId2,
25649      isItemClickable,
25650      onClickItem,
25651      renderItemLink,
25652      onChangeSelection,
25653      isActionsColumnSticky,
25654      posinset
25655    }) {
25656      const { paginationInfo } = (0, import_element76.useContext)(dataviews_context_default);
25657      const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item);
25658      const isSelected2 = hasPossibleBulkAction && selection.includes(id);
25659      const {
25660        showTitle = true,
25661        showMedia = true,
25662        showDescription = true,
25663        infiniteScrollEnabled
25664      } = view;
25665      const isTouchDeviceRef = (0, import_element76.useRef)(false);
25666      const columns = view.fields ?? [];
25667      const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription;
25668      return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
25669        "tr",
25670        {
25671          className: clsx_default("dataviews-view-table__row", {
25672            "is-selected": hasPossibleBulkAction && isSelected2,
25673            "has-bulk-actions": hasPossibleBulkAction
25674          }),
25675          onTouchStart: () => {
25676            isTouchDeviceRef.current = true;
25677          },
25678          "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
25679          "aria-posinset": posinset,
25680          role: infiniteScrollEnabled ? "article" : void 0,
25681          onMouseDown: (event) => {
25682            const isMetaClick = (0, import_keycodes6.isAppleOS)() ? event.metaKey : event.ctrlKey;
25683            if (event.button === 0 && isMetaClick && window.navigator.userAgent.toLowerCase().includes("firefox")) {
25684              event?.preventDefault();
25685            }
25686          },
25687          onClick: (event) => {
25688            if (!hasPossibleBulkAction) {
25689              return;
25690            }
25691            const isModifierKeyPressed = (0, import_keycodes6.isAppleOS)() ? event.metaKey : event.ctrlKey;
25692            if (isModifierKeyPressed && !isTouchDeviceRef.current && document.getSelection()?.type !== "Range") {
25693              onChangeSelection(
25694                selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
25695              );
25696            }
25697          },
25698          children: [
25699            hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25700              DataViewsSelectionCheckbox,
25701              {
25702                item,
25703                selection,
25704                onChangeSelection,
25705                getItemId: getItemId2,
25706                titleField,
25707                disabled: !hasPossibleBulkAction
25708              }
25709            ) }) }),
25710            hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25711              column_primary_default,
25712              {
25713                item,
25714                level,
25715                titleField: showTitle ? titleField : void 0,
25716                mediaField: showMedia ? mediaField : void 0,
25717                descriptionField: showDescription ? descriptionField2 : void 0,
25718                isItemClickable,
25719                onClickItem,
25720                renderItemLink
25721              }
25722            ) }),
25723            columns.map((column) => {
25724              const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
25725              const field = fields.find((f2) => f2.id === column);
25726              const effectiveAlign = getEffectiveAlign(align, field?.type);
25727              return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25728                "td",
25729                {
25730                  style: {
25731                    width,
25732                    maxWidth,
25733                    minWidth
25734                  },
25735                  children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25736                    TableColumnField,
25737                    {
25738                      fields,
25739                      item,
25740                      column,
25741                      align: effectiveAlign
25742                    }
25743                  )
25744                },
25745                column
25746              );
25747            }),
25748            !!actions?.length && // Disable reason: we are not making the element interactive,
25749            // but preventing any click events from bubbling up to the
25750            // table row. This allows us to add a click handler to the row
25751            // itself (to toggle row selection) without erroneously
25752            // intercepting click events from ItemActions.
25753            /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
25754            /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25755              "td",
25756              {
25757                className: clsx_default("dataviews-view-table__actions-column", {
25758                  "dataviews-view-table__actions-column--sticky": true,
25759                  "dataviews-view-table__actions-column--stuck": isActionsColumnSticky
25760                }),
25761                onClick: (e2) => e2.stopPropagation(),
25762                children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ItemActions, { item, actions })
25763              }
25764            )
25765          ]
25766        }
25767      );
25768    }
25769    function ViewTable({
25770      actions,
25771      data,
25772      fields,
25773      getItemId: getItemId2,
25774      getItemLevel: getItemLevel2,
25775      isLoading = false,
25776      onChangeView,
25777      onChangeSelection,
25778      selection,
25779      setOpenedFilter,
25780      onClickItem,
25781      isItemClickable,
25782      renderItemLink,
25783      view,
25784      className,
25785      empty
25786    }) {
25787      const { containerRef } = (0, import_element76.useContext)(dataviews_context_default);
25788      const isDelayedLoading = useDelayedLoading(isLoading);
25789      const headerMenuRefs = (0, import_element76.useRef)(/* @__PURE__ */ new Map());
25790      const headerMenuToFocusRef = (0, import_element76.useRef)(void 0);
25791      const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element76.useState)();
25792      const [contextMenuAnchor, setContextMenuAnchor] = (0, import_element76.useState)(null);
25793      (0, import_element76.useEffect)(() => {
25794        if (headerMenuToFocusRef.current) {
25795          headerMenuToFocusRef.current.focus();
25796          headerMenuToFocusRef.current = void 0;
25797        }
25798      });
25799      const tableNoticeId = (0, import_element76.useId)();
25800      const isHorizontalScrollEnd = useIsHorizontalScrollEnd({
25801        scrollContainerRef: containerRef,
25802        enabled: !!actions?.length
25803      });
25804      const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
25805      if (nextHeaderMenuToFocus) {
25806        headerMenuToFocusRef.current = nextHeaderMenuToFocus;
25807        setNextHeaderMenuToFocus(void 0);
25808        return;
25809      }
25810      const onHide = (field) => {
25811        const hidden = headerMenuRefs.current.get(field.id);
25812        const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
25813        setNextHeaderMenuToFocus(fallback?.node);
25814      };
25815      const handleHeaderContextMenu = (event) => {
25816        event.preventDefault();
25817        event.stopPropagation();
25818        const virtualAnchor = {
25819          getBoundingClientRect: () => ({
25820            x: event.clientX,
25821            y: event.clientY,
25822            top: event.clientY,
25823            left: event.clientX,
25824            right: event.clientX,
25825            bottom: event.clientY,
25826            width: 0,
25827            height: 0,
25828            toJSON: () => ({})
25829          })
25830        };
25831        window.requestAnimationFrame(() => {
25832          setContextMenuAnchor(virtualAnchor);
25833        });
25834      };
25835      const hasData = !!data?.length;
25836      const titleField = fields.find((field) => field.id === view.titleField);
25837      const mediaField = fields.find((field) => field.id === view.mediaField);
25838      const descriptionField2 = fields.find(
25839        (field) => field.id === view.descriptionField
25840      );
25841      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
25842      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
25843      const { showTitle = true, showMedia = true, showDescription = true } = view;
25844      const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription;
25845      const columns = view.fields ?? [];
25846      const headerMenuRef = (column, index) => (node) => {
25847        if (node) {
25848          headerMenuRefs.current.set(column, {
25849            node,
25850            fallback: columns[index > 0 ? index - 1 : 1]
25851          });
25852        } else {
25853          headerMenuRefs.current.delete(column);
25854        }
25855      };
25856      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
25857      const isRtl = (0, import_i18n91.isRTL)();
25858      if (!hasData) {
25859        return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25860          "div",
25861          {
25862            className: clsx_default("dataviews-no-results", {
25863              "is-refreshing": isDelayedLoading
25864            }),
25865            id: tableNoticeId,
25866            children: empty
25867          }
25868        );
25869      }
25870      return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
25871        /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
25872          "table",
25873          {
25874            className: clsx_default("dataviews-view-table", className, {
25875              [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
25876                view.layout.density
25877              ),
25878              "has-bulk-actions": hasBulkActions,
25879              "is-refreshing": !isInfiniteScroll && isDelayedLoading
25880            }),
25881            "aria-busy": isLoading,
25882            "aria-describedby": tableNoticeId,
25883            role: isInfiniteScroll ? "feed" : void 0,
25884            inert: !isInfiniteScroll && isLoading ? "true" : void 0,
25885            children: [
25886              /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("colgroup", { children: [
25887                hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("col", { className: "dataviews-view-table__col-checkbox" }),
25888                hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("col", { className: "dataviews-view-table__col-first-data" }),
25889                columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25890                  "col",
25891                  {
25892                    className: clsx_default(
25893                      `dataviews-view-table__col-$column}`,
25894                      {
25895                        "dataviews-view-table__col-first-data": !hasPrimaryColumn && index === 0
25896                      }
25897                    )
25898                  },
25899                  `col-$column}`
25900                )),
25901                !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("col", { className: "dataviews-view-table__col-actions" })
25902              ] }),
25903              contextMenuAnchor && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25904                import_components96.Popover,
25905                {
25906                  anchor: contextMenuAnchor,
25907                  onClose: () => setContextMenuAnchor(null),
25908                  placement: "bottom-start",
25909                  children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(PropertiesSection, { showLabel: false })
25910                }
25911              ),
25912              /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("thead", { onContextMenu: handleHeaderContextMenu, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("tr", { className: "dataviews-view-table__row", children: [
25913                hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25914                  "th",
25915                  {
25916                    className: "dataviews-view-table__checkbox-column",
25917                    scope: "col",
25918                    onContextMenu: handleHeaderContextMenu,
25919                    children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25920                      BulkSelectionCheckbox,
25921                      {
25922                        selection,
25923                        onChangeSelection,
25924                        data,
25925                        actions,
25926                        getItemId: getItemId2
25927                      }
25928                    )
25929                  }
25930                ),
25931                hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25932                  column_header_menu_default,
25933                  {
25934                    ref: headerMenuRef(
25935                      titleField.id,
25936                      0
25937                    ),
25938                    fieldId: titleField.id,
25939                    view,
25940                    fields,
25941                    onChangeView,
25942                    onHide,
25943                    setOpenedFilter,
25944                    canMove: false,
25945                    canInsertLeft: isRtl ? view.layout?.enableMoving ?? true : false,
25946                    canInsertRight: isRtl ? false : view.layout?.enableMoving ?? true
25947                  }
25948                ) }),
25949                columns.map((column, index) => {
25950                  const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
25951                  const field = fields.find(
25952                    (f2) => f2.id === column
25953                  );
25954                  const effectiveAlign = getEffectiveAlign(
25955                    align,
25956                    field?.type
25957                  );
25958                  const canInsertOrMove = view.layout?.enableMoving ?? true;
25959                  return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25960                    "th",
25961                    {
25962                      style: {
25963                        width,
25964                        maxWidth,
25965                        minWidth,
25966                        textAlign: effectiveAlign
25967                      },
25968                      "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
25969                      scope: "col",
25970                      children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25971                        column_header_menu_default,
25972                        {
25973                          ref: headerMenuRef(column, index),
25974                          fieldId: column,
25975                          view,
25976                          fields,
25977                          onChangeView,
25978                          onHide,
25979                          setOpenedFilter,
25980                          canMove: canInsertOrMove,
25981                          canInsertLeft: canInsertOrMove,
25982                          canInsertRight: canInsertOrMove
25983                        }
25984                      )
25985                    },
25986                    column
25987                  );
25988                }),
25989                !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
25990                  "th",
25991                  {
25992                    className: clsx_default(
25993                      "dataviews-view-table__actions-column",
25994                      {
25995                        "dataviews-view-table__actions-column--sticky": true,
25996                        "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd
25997                      }
25998                    ),
25999                    children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "dataviews-view-table-header", children: (0, import_i18n91.__)("Actions") })
26000                  }
26001                )
26002              ] }) }),
26003              hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
26004                ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("tbody", { children: [
26005                  /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
26006                    "td",
26007                    {
26008                      colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0),
26009                      className: "dataviews-view-table__group-header-cell",
26010                      children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n91.sprintf)(
26011                        // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
26012                        (0, import_i18n91.__)("%1$s: %2$s"),
26013                        groupField.label,
26014                        groupName
26015                      )
26016                    }
26017                  ) }),
26018                  groupItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
26019                    TableRow,
26020                    {
26021                      item,
26022                      level: view.showLevels && typeof getItemLevel2 === "function" ? getItemLevel2(item) : void 0,
26023                      hasBulkActions,
26024                      actions,
26025                      fields,
26026                      id: getItemId2(item) || index.toString(),
26027                      view,
26028                      titleField,
26029                      mediaField,
26030                      descriptionField: descriptionField2,
26031                      selection,
26032                      getItemId: getItemId2,
26033                      onChangeSelection,
26034                      onClickItem,
26035                      renderItemLink,
26036                      isItemClickable,
26037                      isActionsColumnSticky: !isHorizontalScrollEnd
26038                    },
26039                    getItemId2(item)
26040                  ))
26041                ] }, `group-$groupName}`)
26042              ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("tbody", { children: hasData && data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
26043                TableRow,
26044                {
26045                  item,
26046                  level: view.showLevels && typeof getItemLevel2 === "function" ? getItemLevel2(item) : void 0,
26047                  hasBulkActions,
26048                  actions,
26049                  fields,
26050                  id: getItemId2(item) || index.toString(),
26051                  view,
26052                  titleField,
26053                  mediaField,
26054                  descriptionField: descriptionField2,
26055                  selection,
26056                  getItemId: getItemId2,
26057                  onChangeSelection,
26058                  onClickItem,
26059                  renderItemLink,
26060                  isItemClickable,
26061                  isActionsColumnSticky: !isHorizontalScrollEnd,
26062                  posinset: isInfiniteScroll ? index + 1 : void 0
26063                },
26064                getItemId2(item)
26065              )) })
26066            ]
26067          }
26068        ),
26069        isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "dataviews-loading", id: tableNoticeId, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_components96.Spinner, {}) }) })
26070      ] });
26071    }
26072    var table_default = ViewTable;
26073  
26074    // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs
26075    var import_components99 = __toESM(require_components(), 1);
26076    var import_i18n94 = __toESM(require_i18n(), 1);
26077  
26078    // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs
26079    var import_components98 = __toESM(require_components(), 1);
26080    var import_i18n93 = __toESM(require_i18n(), 1);
26081    var import_compose15 = __toESM(require_compose(), 1);
26082    var import_keycodes7 = __toESM(require_keycodes(), 1);
26083    var import_element78 = __toESM(require_element(), 1);
26084  
26085    // packages/dataviews/build-module/components/dataviews-layouts/grid/preview-size-picker.mjs
26086    var import_components97 = __toESM(require_components(), 1);
26087    var import_i18n92 = __toESM(require_i18n(), 1);
26088    var import_element77 = __toESM(require_element(), 1);
26089    var import_jsx_runtime192 = __toESM(require_jsx_runtime(), 1);
26090    var imageSizes = [
26091      {
26092        value: 120,
26093        breakpoint: 1
26094      },
26095      {
26096        value: 170,
26097        breakpoint: 1
26098      },
26099      {
26100        value: 230,
26101        breakpoint: 1
26102      },
26103      {
26104        value: 290,
26105        breakpoint: 1112
26106        // at minimum image width, 4 images display at this container size
26107      },
26108      {
26109        value: 350,
26110        breakpoint: 1636
26111        // at minimum image width, 6 images display at this container size
26112      },
26113      {
26114        value: 430,
26115        breakpoint: 588
26116        // at minimum image width, 2 images display at this container size
26117      }
26118    ];
26119    var DEFAULT_PREVIEW_SIZE = imageSizes[2].value;
26120    function useGridColumns() {
26121      const context = (0, import_element77.useContext)(dataviews_context_default);
26122      const view = context.view;
26123      return (0, import_element77.useMemo)(() => {
26124        const containerWidth = context.containerWidth;
26125        const gap = 32;
26126        const previewSize = view.layout?.previewSize ?? DEFAULT_PREVIEW_SIZE;
26127        const columns = Math.floor(
26128          (containerWidth + gap) / (previewSize + gap)
26129        );
26130        return Math.max(1, columns);
26131      }, [context.containerWidth, view.layout?.previewSize]);
26132    }
26133  
26134    // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs
26135    var import_jsx_runtime193 = __toESM(require_jsx_runtime(), 1);
26136    var { Badge: Badge3 } = unlock3(import_components98.privateApis);
26137    function chunk(array, size) {
26138      const chunks = [];
26139      for (let i2 = 0, j2 = array.length; i2 < j2; i2 += size) {
26140        chunks.push(array.slice(i2, i2 + size));
26141      }
26142      return chunks;
26143    }
26144    var GridItem = (0, import_element78.forwardRef)(function GridItem2({
26145      view,
26146      selection,
26147      onChangeSelection,
26148      onClickItem,
26149      isItemClickable,
26150      renderItemLink,
26151      getItemId: getItemId2,
26152      item,
26153      actions,
26154      mediaField,
26155      titleField,
26156      descriptionField: descriptionField2,
26157      regularFields,
26158      badgeFields,
26159      hasBulkActions,
26160      config: config2,
26161      ...props
26162    }, ref) {
26163      const { showTitle = true, showMedia = true, showDescription = true } = view;
26164      const hasBulkAction = useHasAPossibleBulkAction(actions, item);
26165      const id = getItemId2(item);
26166      const instanceId = (0, import_compose15.useInstanceId)(GridItem2);
26167      const isSelected2 = selection.includes(id);
26168      const mediaPlaceholder = /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("span", { className: "dataviews-view-grid__media-placeholder" });
26169      const rendersMediaField = showMedia && mediaField?.render;
26170      const renderedMediaField = rendersMediaField ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26171        mediaField.render,
26172        {
26173          item,
26174          field: mediaField,
26175          config: config2
26176        }
26177      ) : mediaPlaceholder;
26178      const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(titleField.render, { item, field: titleField }) : null;
26179      let mediaA11yProps;
26180      let titleA11yProps;
26181      if (isItemClickable(item) && onClickItem) {
26182        if (renderedTitleField) {
26183          mediaA11yProps = {
26184            "aria-labelledby": `dataviews-view-grid__title-field-$instanceId}`
26185          };
26186          titleA11yProps = {
26187            id: `dataviews-view-grid__title-field-$instanceId}`
26188          };
26189        } else {
26190          mediaA11yProps = {
26191            "aria-label": (0, import_i18n93.__)("Navigate to item")
26192          };
26193        }
26194      }
26195      return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
26196        Stack,
26197        {
26198          direction: "column",
26199          ...props,
26200          ref,
26201          className: clsx_default(
26202            props.className,
26203            "dataviews-view-grid__row__gridcell",
26204            "dataviews-view-grid__card",
26205            {
26206              "is-selected": hasBulkAction && isSelected2
26207            }
26208          ),
26209          onClickCapture: (event) => {
26210            props.onClickCapture?.(event);
26211            if ((0, import_keycodes7.isAppleOS)() ? event.metaKey : event.ctrlKey) {
26212              event.stopPropagation();
26213              event.preventDefault();
26214              if (!hasBulkAction) {
26215                return;
26216              }
26217              onChangeSelection(
26218                selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id]
26219              );
26220            }
26221          },
26222          children: [
26223            /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26224              ItemClickWrapper,
26225              {
26226                item,
26227                isItemClickable,
26228                onClickItem,
26229                renderItemLink,
26230                className: clsx_default("dataviews-view-grid__media", {
26231                  "dataviews-view-grid__media--placeholder": !rendersMediaField
26232                }),
26233                ...mediaA11yProps,
26234                children: renderedMediaField
26235              }
26236            ),
26237            hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26238              DataViewsSelectionCheckbox,
26239              {
26240                item,
26241                selection,
26242                onChangeSelection,
26243                getItemId: getItemId2,
26244                titleField,
26245                disabled: !hasBulkAction
26246              }
26247            ),
26248            !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(ItemActions, { item, actions, isCompact: true }) }),
26249            showTitle && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "dataviews-view-grid__title", children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26250              ItemClickWrapper,
26251              {
26252                item,
26253                isItemClickable,
26254                onClickItem,
26255                renderItemLink,
26256                className: "dataviews-view-grid__title-field dataviews-title-field",
26257                ...titleA11yProps,
26258                title: titleField?.getValueFormatted({
26259                  item,
26260                  field: titleField
26261                }) || void 0,
26262                children: renderedTitleField
26263              }
26264            ) }),
26265            /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(Stack, { direction: "column", gap: "xs", children: [
26266              showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26267                descriptionField2.render,
26268                {
26269                  item,
26270                  field: descriptionField2
26271                }
26272              ),
26273              !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26274                Stack,
26275                {
26276                  direction: "row",
26277                  className: "dataviews-view-grid__badge-fields",
26278                  gap: "sm",
26279                  wrap: "wrap",
26280                  align: "top",
26281                  justify: "flex-start",
26282                  children: badgeFields.map((field) => {
26283                    return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26284                      Badge3,
26285                      {
26286                        className: "dataviews-view-grid__field-value",
26287                        children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26288                          field.render,
26289                          {
26290                            item,
26291                            field
26292                          }
26293                        )
26294                      },
26295                      field.id
26296                    );
26297                  })
26298                }
26299              ),
26300              !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26301                Stack,
26302                {
26303                  direction: "column",
26304                  className: "dataviews-view-grid__fields",
26305                  gap: "xs",
26306                  children: regularFields.map((field) => {
26307                    return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26308                      import_components98.Flex,
26309                      {
26310                        className: "dataviews-view-grid__field",
26311                        gap: 1,
26312                        justify: "flex-start",
26313                        expanded: true,
26314                        style: { height: "auto" },
26315                        direction: "row",
26316                        children: /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_jsx_runtime193.Fragment, { children: [
26317                          /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(import_components98.Tooltip, { text: field.label, children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(import_components98.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) }),
26318                          /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26319                            import_components98.FlexItem,
26320                            {
26321                              className: "dataviews-view-grid__field-value",
26322                              style: { maxHeight: "none" },
26323                              children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26324                                field.render,
26325                                {
26326                                  item,
26327                                  field
26328                                }
26329                              )
26330                            }
26331                          )
26332                        ] })
26333                      },
26334                      field.id
26335                    );
26336                  })
26337                }
26338              )
26339            ] })
26340          ]
26341        }
26342      );
26343    });
26344    function CompositeGrid({
26345      data,
26346      isInfiniteScroll,
26347      className,
26348      inert,
26349      isLoading,
26350      view,
26351      fields,
26352      selection,
26353      onChangeSelection,
26354      onClickItem,
26355      isItemClickable,
26356      renderItemLink,
26357      getItemId: getItemId2,
26358      actions
26359    }) {
26360      const { paginationInfo, resizeObserverRef } = (0, import_element78.useContext)(dataviews_context_default);
26361      const gridColumns = useGridColumns();
26362      const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data);
26363      const titleField = fields.find(
26364        (field) => field.id === view?.titleField
26365      );
26366      const mediaField = fields.find(
26367        (field) => field.id === view?.mediaField
26368      );
26369      const descriptionField2 = fields.find(
26370        (field) => field.id === view?.descriptionField
26371      );
26372      const otherFields = view.fields ?? [];
26373      const { regularFields, badgeFields } = otherFields.reduce(
26374        (accumulator, fieldId) => {
26375          const field = fields.find((f2) => f2.id === fieldId);
26376          if (!field) {
26377            return accumulator;
26378          }
26379          const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
26380          accumulator[key].push(field);
26381          return accumulator;
26382        },
26383        { regularFields: [], badgeFields: [] }
26384      );
26385      const size = "900px";
26386      const totalRows = Math.ceil(data.length / gridColumns);
26387      return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26388        import_components98.Composite,
26389        {
26390          role: isInfiniteScroll ? "feed" : "grid",
26391          className: clsx_default("dataviews-view-grid", className),
26392          focusWrap: true,
26393          "aria-busy": isLoading,
26394          "aria-rowcount": isInfiniteScroll ? void 0 : totalRows,
26395          ref: resizeObserverRef,
26396          inert,
26397          children: chunk(data, gridColumns).map((row, i2) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26398            import_components98.Composite.Row,
26399            {
26400              render: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26401                "div",
26402                {
26403                  role: "row",
26404                  "aria-rowindex": i2 + 1,
26405                  "aria-label": (0, import_i18n93.sprintf)(
26406                    /* translators: %d: The row number in the grid */
26407                    (0, import_i18n93.__)("Row %d"),
26408                    i2 + 1
26409                  ),
26410                  className: "dataviews-view-grid__row",
26411                  style: {
26412                    gridTemplateColumns: `repeat( $gridColumns}, minmax(0, 1fr) )`
26413                  }
26414                }
26415              ),
26416              children: row.map((item, indexInRow) => {
26417                const index = i2 * gridColumns + indexInRow;
26418                return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26419                  import_components98.Composite.Item,
26420                  {
26421                    render: (props) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
26422                      GridItem,
26423                      {
26424                        ...props,
26425                        role: isInfiniteScroll ? "article" : "gridcell",
26426                        "aria-setsize": isInfiniteScroll ? paginationInfo.totalItems : void 0,
26427                        "aria-posinset": isInfiniteScroll ? index + 1 : void 0,
26428                        view,
26429                        selection,
26430                        onChangeSelection,
26431                        onClickItem,
26432                        isItemClickable,
26433                        renderItemLink,
26434                        getItemId: getItemId2,
26435                        item,
26436                        actions,
26437                        mediaField,
26438                        titleField,
26439                        descriptionField: descriptionField2,
26440                        regularFields,
26441                        badgeFields,
26442                        hasBulkActions,
26443                        config: {
26444                          sizes: size
26445                        }
26446                      }
26447                    )
26448                  },
26449                  getItemId2(item)
26450                );
26451              })
26452            },
26453            i2
26454          ))
26455        }
26456      );
26457    }
26458  
26459    // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs
26460    var import_jsx_runtime194 = __toESM(require_jsx_runtime(), 1);
26461    function ViewGrid({
26462      actions,
26463      data,
26464      fields,
26465      getItemId: getItemId2,
26466      isLoading,
26467      onChangeSelection,
26468      onClickItem,
26469      isItemClickable,
26470      renderItemLink,
26471      selection,
26472      view,
26473      className,
26474      empty
26475    }) {
26476      const isDelayedLoading = useDelayedLoading(!!isLoading);
26477      const hasData = !!data?.length;
26478      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
26479      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
26480      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
26481      if (!hasData) {
26482        return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
26483          "div",
26484          {
26485            className: clsx_default("dataviews-no-results", {
26486              "is-refreshing": isDelayedLoading
26487            }),
26488            children: empty
26489          }
26490        );
26491      }
26492      const gridProps = {
26493        className: clsx_default(className, {
26494          "is-refreshing": !isInfiniteScroll && isDelayedLoading
26495        }),
26496        inert: !isInfiniteScroll && !!isLoading ? "true" : void 0,
26497        isLoading,
26498        view,
26499        fields,
26500        selection,
26501        onChangeSelection,
26502        onClickItem,
26503        isItemClickable,
26504        renderItemLink,
26505        getItemId: getItemId2,
26506        actions
26507      };
26508      return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)(import_jsx_runtime194.Fragment, {
26509        // Render multiple groups.
26510        children: [
26511          hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(Stack, { direction: "column", gap: "lg", children: Array.from(dataByGroup.entries()).map(
26512            ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)(
26513              Stack,
26514              {
26515                direction: "column",
26516                gap: "sm",
26517                children: [
26518                  /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("h3", { className: "dataviews-view-grid__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n94.sprintf)(
26519                    // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
26520                    (0, import_i18n94.__)("%1$s: %2$s"),
26521                    groupField.label,
26522                    groupName
26523                  ) }),
26524                  /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
26525                    CompositeGrid,
26526                    {
26527                      ...gridProps,
26528                      data: groupItems,
26529                      isInfiniteScroll: false
26530                    }
26531                  )
26532                ]
26533              },
26534              groupName
26535            )
26536          ) }),
26537          // Render a single grid with all data.
26538          !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
26539            CompositeGrid,
26540            {
26541              ...gridProps,
26542              data,
26543              isInfiniteScroll: !!isInfiniteScroll
26544            }
26545          ),
26546          isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_components99.Spinner, {}) })
26547        ]
26548      });
26549    }
26550    var grid_default = ViewGrid;
26551  
26552    // packages/dataviews/build-module/components/dataviews-layouts/list/index.mjs
26553    var import_compose16 = __toESM(require_compose(), 1);
26554    var import_components100 = __toESM(require_components(), 1);
26555    var import_element79 = __toESM(require_element(), 1);
26556    var import_i18n95 = __toESM(require_i18n(), 1);
26557    var import_data61 = __toESM(require_data(), 1);
26558    var import_jsx_runtime195 = __toESM(require_jsx_runtime(), 1);
26559    var { Menu: Menu7 } = unlock3(import_components100.privateApis);
26560    function generateItemWrapperCompositeId(idPrefix) {
26561      return `$idPrefix}-item-wrapper`;
26562    }
26563    function generatePrimaryActionCompositeId(idPrefix, primaryActionId) {
26564      return `$idPrefix}-primary-action-$primaryActionId}`;
26565    }
26566    function generateDropdownTriggerCompositeId(idPrefix) {
26567      return `$idPrefix}-dropdown`;
26568    }
26569    function PrimaryActionGridCell({
26570      idPrefix,
26571      primaryAction,
26572      item
26573    }) {
26574      const registry = (0, import_data61.useRegistry)();
26575      const [isModalOpen, setIsModalOpen] = (0, import_element79.useState)(false);
26576      const compositeItemId = generatePrimaryActionCompositeId(
26577        idPrefix,
26578        primaryAction.id
26579      );
26580      const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]);
26581      return "RenderModal" in primaryAction ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26582        import_components100.Composite.Item,
26583        {
26584          id: compositeItemId,
26585          render: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26586            import_components100.Button,
26587            {
26588              disabled: !!primaryAction.disabled,
26589              accessibleWhenDisabled: true,
26590              text: label,
26591              size: "small",
26592              onClick: () => setIsModalOpen(true)
26593            }
26594          ),
26595          children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26596            ActionModal,
26597            {
26598              action: primaryAction,
26599              items: [item],
26600              closeModal: () => setIsModalOpen(false)
26601            }
26602          )
26603        }
26604      ) }, primaryAction.id) : /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26605        import_components100.Composite.Item,
26606        {
26607          id: compositeItemId,
26608          render: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26609            import_components100.Button,
26610            {
26611              disabled: !!primaryAction.disabled,
26612              accessibleWhenDisabled: true,
26613              size: "small",
26614              onClick: () => {
26615                primaryAction.callback([item], { registry });
26616              },
26617              children: label
26618            }
26619          )
26620        }
26621      ) }, primaryAction.id);
26622    }
26623    function ListItem({
26624      view,
26625      actions,
26626      idPrefix,
26627      isSelected: isSelected2,
26628      item,
26629      titleField,
26630      mediaField,
26631      descriptionField: descriptionField2,
26632      onSelect,
26633      otherFields,
26634      onDropdownTriggerKeyDown,
26635      posinset
26636    }) {
26637      const {
26638        showTitle = true,
26639        showMedia = true,
26640        showDescription = true,
26641        infiniteScrollEnabled
26642      } = view;
26643      const itemRef = (0, import_element79.useRef)(null);
26644      const labelId = `$idPrefix}-label`;
26645      const descriptionId = `$idPrefix}-description`;
26646      const registry = (0, import_data61.useRegistry)();
26647      const [isHovered, setIsHovered] = (0, import_element79.useState)(false);
26648      const [activeModalAction, setActiveModalAction] = (0, import_element79.useState)(
26649        null
26650      );
26651      const handleHover = ({ type }) => {
26652        const isHover = type === "mouseenter";
26653        setIsHovered(isHover);
26654      };
26655      const { paginationInfo } = (0, import_element79.useContext)(dataviews_context_default);
26656      (0, import_element79.useEffect)(() => {
26657        if (isSelected2) {
26658          itemRef.current?.scrollIntoView({
26659            behavior: "auto",
26660            block: "nearest",
26661            inline: "nearest"
26662          });
26663        }
26664      }, [isSelected2]);
26665      const { primaryAction, eligibleActions } = (0, import_element79.useMemo)(() => {
26666        const _eligibleActions = actions.filter(
26667          (action) => !action.isEligible || action.isEligible(item)
26668        );
26669        const _primaryActions = _eligibleActions.filter(
26670          (action) => action.isPrimary
26671        );
26672        return {
26673          primaryAction: _primaryActions[0],
26674          eligibleActions: _eligibleActions
26675        };
26676      }, [actions, item]);
26677      const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1;
26678      const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26679        mediaField.render,
26680        {
26681          item,
26682          field: mediaField,
26683          config: { sizes: "52px" }
26684        }
26685      ) }) : null;
26686      const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(titleField.render, { item, field: titleField }) : null;
26687      const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(
26688        Stack,
26689        {
26690          direction: "row",
26691          gap: "md",
26692          className: "dataviews-view-list__item-actions",
26693          children: [
26694            primaryAction && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26695              PrimaryActionGridCell,
26696              {
26697                idPrefix,
26698                primaryAction,
26699                item
26700              }
26701            ),
26702            !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("div", { role: "gridcell", children: [
26703              /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(Menu7, { placement: "bottom-end", children: [
26704                /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26705                  Menu7.TriggerButton,
26706                  {
26707                    render: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26708                      import_components100.Composite.Item,
26709                      {
26710                        id: generateDropdownTriggerCompositeId(
26711                          idPrefix
26712                        ),
26713                        render: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26714                          import_components100.Button,
26715                          {
26716                            size: "small",
26717                            icon: more_vertical_default,
26718                            label: (0, import_i18n95.__)("Actions"),
26719                            accessibleWhenDisabled: true,
26720                            disabled: !actions.length,
26721                            onKeyDown: onDropdownTriggerKeyDown
26722                          }
26723                        )
26724                      }
26725                    )
26726                  }
26727                ),
26728                /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(Menu7.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26729                  ActionsMenuGroup,
26730                  {
26731                    actions: eligibleActions,
26732                    item,
26733                    registry,
26734                    setActiveModalAction
26735                  }
26736                ) })
26737              ] }),
26738              !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26739                ActionModal,
26740                {
26741                  action: activeModalAction,
26742                  items: [item],
26743                  closeModal: () => setActiveModalAction(null)
26744                }
26745              )
26746            ] })
26747          ]
26748        }
26749      );
26750      return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26751        import_components100.Composite.Row,
26752        {
26753          ref: itemRef,
26754          render: (
26755            /* aria-posinset breaks Composite.Row if passed to it directly. */
26756            /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26757              "div",
26758              {
26759                "aria-posinset": posinset,
26760                "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0
26761              }
26762            )
26763          ),
26764          role: infiniteScrollEnabled ? "article" : "row",
26765          className: clsx_default({
26766            "is-selected": isSelected2,
26767            "is-hovered": isHovered
26768          }),
26769          onMouseEnter: handleHover,
26770          onMouseLeave: handleHover,
26771          children: /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(
26772            Stack,
26773            {
26774              direction: "row",
26775              className: "dataviews-view-list__item-wrapper",
26776              children: [
26777                /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26778                  import_components100.Composite.Item,
26779                  {
26780                    id: generateItemWrapperCompositeId(idPrefix),
26781                    "aria-pressed": isSelected2,
26782                    "aria-labelledby": labelId,
26783                    "aria-describedby": descriptionId,
26784                    className: "dataviews-view-list__item",
26785                    onClick: () => onSelect(item)
26786                  }
26787                ) }),
26788                /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(
26789                  Stack,
26790                  {
26791                    direction: "row",
26792                    gap: "md",
26793                    justify: "start",
26794                    align: "flex-start",
26795                    style: { flex: 1, minWidth: 0 },
26796                    children: [
26797                      renderedMediaField,
26798                      /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(
26799                        Stack,
26800                        {
26801                          direction: "column",
26802                          gap: "xs",
26803                          className: "dataviews-view-list__field-wrapper",
26804                          children: [
26805                            /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(Stack, { direction: "row", align: "center", children: [
26806                              /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26807                                "div",
26808                                {
26809                                  className: "dataviews-title-field dataviews-view-list__title-field",
26810                                  id: labelId,
26811                                  children: renderedTitleField
26812                                }
26813                              ),
26814                              usedActions
26815                            ] }),
26816                            showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26817                              descriptionField2.render,
26818                              {
26819                                item,
26820                                field: descriptionField2
26821                              }
26822                            ) }),
26823                            /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26824                              "div",
26825                              {
26826                                className: "dataviews-view-list__fields",
26827                                id: descriptionId,
26828                                children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(
26829                                  "div",
26830                                  {
26831                                    className: "dataviews-view-list__field",
26832                                    children: [
26833                                      /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26834                                        import_components100.VisuallyHidden,
26835                                        {
26836                                          as: "span",
26837                                          className: "dataviews-view-list__field-label",
26838                                          children: field.label
26839                                        }
26840                                      ),
26841                                      /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26842                                        field.render,
26843                                        {
26844                                          item,
26845                                          field
26846                                        }
26847                                      ) })
26848                                    ]
26849                                  },
26850                                  field.id
26851                                ))
26852                              }
26853                            )
26854                          ]
26855                        }
26856                      )
26857                    ]
26858                  }
26859                )
26860              ]
26861            }
26862          )
26863        }
26864      );
26865    }
26866    function isDefined2(item) {
26867      return !!item;
26868    }
26869    function ViewList(props) {
26870      const {
26871        actions,
26872        data,
26873        fields,
26874        getItemId: getItemId2,
26875        isLoading,
26876        onChangeSelection,
26877        selection,
26878        view,
26879        className,
26880        empty
26881      } = props;
26882      const baseId = (0, import_compose16.useInstanceId)(ViewList, "view-list");
26883      const isDelayedLoading = useDelayedLoading(!!isLoading);
26884      const selectedItem = data?.findLast(
26885        (item) => selection.includes(getItemId2(item))
26886      );
26887      const titleField = fields.find((field) => field.id === view.titleField);
26888      const mediaField = fields.find((field) => field.id === view.mediaField);
26889      const descriptionField2 = fields.find(
26890        (field) => field.id === view.descriptionField
26891      );
26892      const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined2);
26893      const onSelect = (item) => onChangeSelection([getItemId2(item)]);
26894      const generateCompositeItemIdPrefix = (0, import_element79.useCallback)(
26895        (item) => `$baseId}-$getItemId2(item)}`,
26896        [baseId, getItemId2]
26897      );
26898      const isActiveCompositeItem = (0, import_element79.useCallback)(
26899        (item, idToCheck) => {
26900          return idToCheck.startsWith(
26901            generateCompositeItemIdPrefix(item)
26902          );
26903        },
26904        [generateCompositeItemIdPrefix]
26905      );
26906      const [activeCompositeId, setActiveCompositeId] = (0, import_element79.useState)(void 0);
26907      (0, import_element79.useEffect)(() => {
26908        if (selectedItem) {
26909          setActiveCompositeId(
26910            generateItemWrapperCompositeId(
26911              generateCompositeItemIdPrefix(selectedItem)
26912            )
26913          );
26914        }
26915      }, [selectedItem, generateCompositeItemIdPrefix]);
26916      const activeItemIndex = data.findIndex(
26917        (item) => isActiveCompositeItem(item, activeCompositeId ?? "")
26918      );
26919      const previousActiveItemIndex = (0, import_compose16.usePrevious)(activeItemIndex);
26920      const isActiveIdInList = activeItemIndex !== -1;
26921      const selectCompositeItem = (0, import_element79.useCallback)(
26922        (targetIndex, generateCompositeId) => {
26923          const clampedIndex = Math.min(
26924            data.length - 1,
26925            Math.max(0, targetIndex)
26926          );
26927          if (!data[clampedIndex]) {
26928            return;
26929          }
26930          const itemIdPrefix = generateCompositeItemIdPrefix(
26931            data[clampedIndex]
26932          );
26933          const targetCompositeItemId = generateCompositeId(itemIdPrefix);
26934          setActiveCompositeId(targetCompositeItemId);
26935          document.getElementById(targetCompositeItemId)?.focus();
26936        },
26937        [data, generateCompositeItemIdPrefix]
26938      );
26939      (0, import_element79.useEffect)(() => {
26940        const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1;
26941        if (!isActiveIdInList && wasActiveIdInList) {
26942          selectCompositeItem(
26943            previousActiveItemIndex,
26944            generateItemWrapperCompositeId
26945          );
26946        }
26947      }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]);
26948      const onDropdownTriggerKeyDown = (0, import_element79.useCallback)(
26949        (event) => {
26950          if (event.key === "ArrowDown") {
26951            event.preventDefault();
26952            selectCompositeItem(
26953              activeItemIndex + 1,
26954              generateDropdownTriggerCompositeId
26955            );
26956          }
26957          if (event.key === "ArrowUp") {
26958            event.preventDefault();
26959            selectCompositeItem(
26960              activeItemIndex - 1,
26961              generateDropdownTriggerCompositeId
26962            );
26963          }
26964        },
26965        [selectCompositeItem, activeItemIndex]
26966      );
26967      const hasData = !!data?.length;
26968      const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null;
26969      const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null;
26970      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
26971      if (!hasData) {
26972        return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26973          "div",
26974          {
26975            className: clsx_default("dataviews-no-results", {
26976              "is-refreshing": isDelayedLoading
26977            }),
26978            children: empty
26979          }
26980        );
26981      }
26982      if (hasData && groupField && dataByGroup) {
26983        return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26984          import_components100.Composite,
26985          {
26986            id: `$baseId}`,
26987            render: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", {}),
26988            className: "dataviews-view-list__group",
26989            role: "grid",
26990            activeId: activeCompositeId,
26991            setActiveId: setActiveCompositeId,
26992            children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
26993              Stack,
26994              {
26995                direction: "column",
26996                gap: "lg",
26997                className: clsx_default("dataviews-view-list", className),
26998                children: Array.from(dataByGroup.entries()).map(
26999                  ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(
27000                    Stack,
27001                    {
27002                      direction: "column",
27003                      gap: "sm",
27004                      children: [
27005                        /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("h3", { className: "dataviews-view-list__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n95.sprintf)(
27006                          // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
27007                          (0, import_i18n95.__)("%1$s: %2$s"),
27008                          groupField.label,
27009                          groupName
27010                        ) }),
27011                        groupItems.map((item) => {
27012                          const id = generateCompositeItemIdPrefix(item);
27013                          return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
27014                            ListItem,
27015                            {
27016                              view,
27017                              idPrefix: id,
27018                              actions,
27019                              item,
27020                              isSelected: item === selectedItem,
27021                              onSelect,
27022                              mediaField,
27023                              titleField,
27024                              descriptionField: descriptionField2,
27025                              otherFields,
27026                              onDropdownTriggerKeyDown
27027                            },
27028                            id
27029                          );
27030                        })
27031                      ]
27032                    },
27033                    groupName
27034                  )
27035                )
27036              }
27037            )
27038          }
27039        );
27040      }
27041      return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(import_jsx_runtime195.Fragment, { children: [
27042        /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
27043          import_components100.Composite,
27044          {
27045            id: baseId,
27046            render: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", {}),
27047            className: clsx_default("dataviews-view-list", className, {
27048              [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
27049                view.layout.density
27050              ),
27051              "is-refreshing": !isInfiniteScroll && isDelayedLoading
27052            }),
27053            role: view.infiniteScrollEnabled ? "feed" : "grid",
27054            activeId: activeCompositeId,
27055            setActiveId: setActiveCompositeId,
27056            inert: !isInfiniteScroll && !!isLoading ? "true" : void 0,
27057            children: data.map((item, index) => {
27058              const id = generateCompositeItemIdPrefix(item);
27059              return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
27060                ListItem,
27061                {
27062                  view,
27063                  idPrefix: id,
27064                  actions,
27065                  item,
27066                  isSelected: item === selectedItem,
27067                  onSelect,
27068                  mediaField,
27069                  titleField,
27070                  descriptionField: descriptionField2,
27071                  otherFields,
27072                  onDropdownTriggerKeyDown,
27073                  posinset: view.infiniteScrollEnabled ? index + 1 : void 0
27074                },
27075                id
27076              );
27077            })
27078          }
27079        ),
27080        isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_components100.Spinner, {}) })
27081      ] });
27082    }
27083  
27084    // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs
27085    var import_components102 = __toESM(require_components(), 1);
27086  
27087    // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-group.mjs
27088    var import_i18n96 = __toESM(require_i18n(), 1);
27089    var import_element80 = __toESM(require_element(), 1);
27090    var import_jsx_runtime196 = __toESM(require_jsx_runtime(), 1);
27091    function ActivityGroup({
27092      groupName,
27093      groupData,
27094      groupField,
27095      showLabel = true,
27096      children
27097    }) {
27098      const groupHeader = showLabel ? (0, import_element80.createInterpolateElement)(
27099        // translators: %s: The label of the field e.g. "Status".
27100        (0, import_i18n96.sprintf)((0, import_i18n96.__)("%s: <groupName />"), groupField.label).trim(),
27101        {
27102          groupName: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
27103            groupField.render,
27104            {
27105              item: groupData[0],
27106              field: groupField
27107            }
27108          )
27109        }
27110      ) : /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(groupField.render, { item: groupData[0], field: groupField });
27111      return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(
27112        Stack,
27113        {
27114          direction: "column",
27115          className: "dataviews-view-activity__group",
27116          children: [
27117            /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("h3", { className: "dataviews-view-activity__group-header", children: groupHeader }),
27118            children
27119          ]
27120        },
27121        groupName
27122      );
27123    }
27124  
27125    // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-item.mjs
27126    var import_components101 = __toESM(require_components(), 1);
27127    var import_element81 = __toESM(require_element(), 1);
27128    var import_data62 = __toESM(require_data(), 1);
27129    var import_compose17 = __toESM(require_compose(), 1);
27130    var import_jsx_runtime197 = __toESM(require_jsx_runtime(), 1);
27131    function ActivityItem(props) {
27132      const {
27133        view,
27134        actions,
27135        item,
27136        titleField,
27137        mediaField,
27138        descriptionField: descriptionField2,
27139        otherFields,
27140        posinset,
27141        onClickItem,
27142        renderItemLink,
27143        isItemClickable
27144      } = props;
27145      const {
27146        showTitle = true,
27147        showMedia = true,
27148        showDescription = true,
27149        infiniteScrollEnabled
27150      } = view;
27151      const itemRef = (0, import_element81.useRef)(null);
27152      const registry = (0, import_data62.useRegistry)();
27153      const { paginationInfo } = (0, import_element81.useContext)(dataviews_context_default);
27154      const { primaryActions, eligibleActions } = (0, import_element81.useMemo)(() => {
27155        const _eligibleActions = actions.filter(
27156          (action) => !action.isEligible || action.isEligible(item)
27157        );
27158        const _primaryActions = _eligibleActions.filter(
27159          (action) => action.isPrimary
27160        );
27161        return {
27162          primaryActions: _primaryActions,
27163          eligibleActions: _eligibleActions
27164        };
27165      }, [actions, item]);
27166      const isMobileViewport = (0, import_compose17.useViewportMatch)("medium", "<");
27167      const density = view.layout?.density ?? "balanced";
27168      const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27169        mediaField.render,
27170        {
27171          item,
27172          field: mediaField,
27173          config: {
27174            sizes: density === "comfortable" ? "32px" : "24px"
27175          }
27176        }
27177      ) : null;
27178      const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-view-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27179        "span",
27180        {
27181          className: "dataviews-view-activity__item-bullet",
27182          "aria-hidden": "true"
27183        }
27184      ) });
27185      const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(titleField.render, { item, field: titleField }) : null;
27186      const verticalGap = (0, import_element81.useMemo)(() => {
27187        switch (density) {
27188          case "comfortable":
27189            return "md";
27190          default:
27191            return "sm";
27192        }
27193      }, [density]);
27194      return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27195        "div",
27196        {
27197          ref: itemRef,
27198          role: infiniteScrollEnabled ? "article" : void 0,
27199          "aria-posinset": posinset,
27200          "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0,
27201          className: clsx_default(
27202            "dataviews-view-activity__item",
27203            density === "compact" && "is-compact",
27204            density === "balanced" && "is-balanced",
27205            density === "comfortable" && "is-comfortable"
27206          ),
27207          children: /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [
27208            /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27209              Stack,
27210              {
27211                direction: "column",
27212                gap: "xs",
27213                align: "center",
27214                className: "dataviews-view-activity__item-type",
27215                children: renderedMediaField
27216              }
27217            ),
27218            /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
27219              Stack,
27220              {
27221                direction: "column",
27222                gap: verticalGap,
27223                align: "flex-start",
27224                className: "dataviews-view-activity__item-content",
27225                children: [
27226                  renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27227                    ItemClickWrapper,
27228                    {
27229                      item,
27230                      isItemClickable,
27231                      onClickItem,
27232                      renderItemLink,
27233                      className: "dataviews-view-activity__item-title",
27234                      children: renderedTitleField
27235                    }
27236                  ),
27237                  showDescription && descriptionField2 && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-view-activity__item-description", children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27238                    descriptionField2.render,
27239                    {
27240                      item,
27241                      field: descriptionField2
27242                    }
27243                  ) }),
27244                  /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-view-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
27245                    "div",
27246                    {
27247                      className: "dataviews-view-activity__item-field",
27248                      children: [
27249                        /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27250                          import_components101.VisuallyHidden,
27251                          {
27252                            as: "span",
27253                            className: "dataviews-view-activity__item-field-label",
27254                            children: field.label
27255                          }
27256                        ),
27257                        /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("span", { className: "dataviews-view-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27258                          field.render,
27259                          {
27260                            item,
27261                            field
27262                          }
27263                        ) })
27264                      ]
27265                    },
27266                    field.id
27267                  )) }),
27268                  !!primaryActions?.length && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27269                    PrimaryActions,
27270                    {
27271                      item,
27272                      actions: primaryActions,
27273                      registry,
27274                      buttonVariant: "secondary"
27275                    }
27276                  )
27277                ]
27278              }
27279            ),
27280            (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu
27281            // there if there are any actions at all.
27282            isMobileViewport && // At the same time, only show the menu if there are actions to show.
27283            eligibleActions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-view-activity__item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
27284              ItemActions,
27285              {
27286                item,
27287                actions: eligibleActions,
27288                isCompact: true
27289              }
27290            ) })
27291          ] })
27292        }
27293      );
27294    }
27295    var activity_item_default = ActivityItem;
27296  
27297    // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-items.mjs
27298    var import_react7 = __toESM(require_react(), 1);
27299    function isDefined3(item) {
27300      return !!item;
27301    }
27302    function ActivityItems(props) {
27303      const { data, fields, getItemId: getItemId2, view } = props;
27304      const titleField = fields.find((field) => field.id === view.titleField);
27305      const mediaField = fields.find((field) => field.id === view.mediaField);
27306      const descriptionField2 = fields.find(
27307        (field) => field.id === view.descriptionField
27308      );
27309      const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f2) => fieldId === f2.id)).filter(isDefined3);
27310      return data.map((item, index) => {
27311        return /* @__PURE__ */ (0, import_react7.createElement)(
27312          activity_item_default,
27313          {
27314            ...props,
27315            key: getItemId2(item),
27316            item,
27317            mediaField,
27318            titleField,
27319            descriptionField: descriptionField2,
27320            otherFields,
27321            posinset: view.infiniteScrollEnabled ? index + 1 : void 0
27322          }
27323        );
27324      });
27325    }
27326  
27327    // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs
27328    var import_jsx_runtime198 = __toESM(require_jsx_runtime(), 1);
27329    function ViewActivity(props) {
27330      const { empty, data, fields, isLoading, view, className } = props;
27331      const isDelayedLoading = useDelayedLoading(!!isLoading);
27332      const hasData = !!data?.length;
27333      const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null;
27334      const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null;
27335      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
27336      if (!hasData) {
27337        return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
27338          "div",
27339          {
27340            className: clsx_default("dataviews-no-results", {
27341              "is-refreshing": isDelayedLoading
27342            }),
27343            children: empty
27344          }
27345        );
27346      }
27347      const isInert = !isInfiniteScroll && !!isLoading;
27348      const wrapperClassName = clsx_default("dataviews-view-activity", className, {
27349        "is-refreshing": !isInfiniteScroll && isDelayedLoading
27350      });
27351      const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : [];
27352      if (hasData && groupField && dataByGroup) {
27353        return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
27354          Stack,
27355          {
27356            direction: "column",
27357            gap: "sm",
27358            className: wrapperClassName,
27359            inert: isInert ? "true" : void 0,
27360            children: groupedEntries.map(
27361              ([groupName, groupData]) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
27362                ActivityGroup,
27363                {
27364                  groupName,
27365                  groupData,
27366                  groupField,
27367                  showLabel: view.groupBy?.showLabel !== false,
27368                  children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
27369                    ActivityItems,
27370                    {
27371                      ...props,
27372                      data: groupData
27373                    }
27374                  )
27375                },
27376                groupName
27377              )
27378            )
27379          }
27380        );
27381      }
27382      return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_jsx_runtime198.Fragment, { children: [
27383        /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
27384          "div",
27385          {
27386            className: wrapperClassName,
27387            role: view.infiniteScrollEnabled ? "feed" : void 0,
27388            inert: isInert ? "true" : void 0,
27389            children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ActivityItems, { ...props })
27390          }
27391        ),
27392        isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_components102.Spinner, {}) })
27393      ] });
27394    }
27395  
27396    // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs
27397    var import_components105 = __toESM(require_components(), 1);
27398    var import_i18n99 = __toESM(require_i18n(), 1);
27399    var import_compose18 = __toESM(require_compose(), 1);
27400    var import_element85 = __toESM(require_element(), 1);
27401  
27402    // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs
27403    var import_components104 = __toESM(require_components(), 1);
27404    var import_data63 = __toESM(require_data(), 1);
27405    var import_element83 = __toESM(require_element(), 1);
27406    var import_i18n98 = __toESM(require_i18n(), 1);
27407  
27408    // packages/dataviews/build-module/components/dataviews-pagination/index.mjs
27409    var import_components103 = __toESM(require_components(), 1);
27410    var import_element82 = __toESM(require_element(), 1);
27411    var import_i18n97 = __toESM(require_i18n(), 1);
27412    var import_jsx_runtime199 = __toESM(require_jsx_runtime(), 1);
27413    function DataViewsPagination() {
27414      const {
27415        view,
27416        onChangeView,
27417        paginationInfo: { totalItems = 0, totalPages }
27418      } = (0, import_element82.useContext)(dataviews_context_default);
27419      if (!totalItems || !totalPages || view.infiniteScrollEnabled) {
27420        return null;
27421      }
27422      const currentPage = view.page ?? 1;
27423      const pageSelectOptions = Array.from(Array(totalPages)).map(
27424        (_, i2) => {
27425          const page = i2 + 1;
27426          return {
27427            value: page.toString(),
27428            label: page.toString(),
27429            "aria-label": currentPage === page ? (0, import_i18n97.sprintf)(
27430              // translators: 1: current page number. 2: total number of pages.
27431              (0, import_i18n97.__)("Page %1$d of %2$d"),
27432              currentPage,
27433              totalPages
27434            ) : page.toString()
27435          };
27436        }
27437      );
27438      return !!totalItems && totalPages !== 1 && /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(
27439        Stack,
27440        {
27441          direction: "row",
27442          className: "dataviews-pagination",
27443          justify: "end",
27444          align: "center",
27445          gap: "xl",
27446          children: [
27447            /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
27448              Stack,
27449              {
27450                direction: "row",
27451                justify: "flex-start",
27452                align: "center",
27453                gap: "xs",
27454                className: "dataviews-pagination__page-select",
27455                children: (0, import_element82.createInterpolateElement)(
27456                  (0, import_i18n97.sprintf)(
27457                    // translators: 1: Current page number, 2: Total number of pages.
27458                    (0, import_i18n97._x)(
27459                      "<div>Page</div>%1$s<div>of %2$d</div>",
27460                      "paging"
27461                    ),
27462                    "<CurrentPage />",
27463                    totalPages
27464                  ),
27465                  {
27466                    div: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { "aria-hidden": true }),
27467                    CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
27468                      import_components103.SelectControl,
27469                      {
27470                        "aria-label": (0, import_i18n97.__)("Current page"),
27471                        value: currentPage.toString(),
27472                        options: pageSelectOptions,
27473                        onChange: (newValue) => {
27474                          onChangeView({
27475                            ...view,
27476                            page: +newValue
27477                          });
27478                        },
27479                        size: "small",
27480                        variant: "minimal"
27481                      }
27482                    )
27483                  }
27484                )
27485              }
27486            ),
27487            /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(Stack, { direction: "row", gap: "xs", align: "center", children: [
27488              /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
27489                import_components103.Button,
27490                {
27491                  onClick: () => onChangeView({
27492                    ...view,
27493                    page: currentPage - 1
27494                  }),
27495                  disabled: currentPage === 1,
27496                  accessibleWhenDisabled: true,
27497                  label: (0, import_i18n97.__)("Previous page"),
27498                  icon: (0, import_i18n97.isRTL)() ? next_default : previous_default,
27499                  showTooltip: true,
27500                  size: "compact",
27501                  tooltipPosition: "top"
27502                }
27503              ),
27504              /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
27505                import_components103.Button,
27506                {
27507                  onClick: () => onChangeView({ ...view, page: currentPage + 1 }),
27508                  disabled: currentPage >= totalPages,
27509                  accessibleWhenDisabled: true,
27510                  label: (0, import_i18n97.__)("Next page"),
27511                  icon: (0, import_i18n97.isRTL)() ? previous_default : next_default,
27512                  showTooltip: true,
27513                  size: "compact",
27514                  tooltipPosition: "top"
27515                }
27516              )
27517            ] })
27518          ]
27519        }
27520      );
27521    }
27522    var dataviews_pagination_default = (0, import_element82.memo)(DataViewsPagination);
27523  
27524    // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs
27525    var import_jsx_runtime200 = __toESM(require_jsx_runtime(), 1);
27526    function useIsMultiselectPicker(actions) {
27527      return (0, import_element83.useMemo)(() => {
27528        return actions?.every((action) => action.supportsBulk);
27529      }, [actions]);
27530    }
27531  
27532    // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-items.mjs
27533    var import_element84 = __toESM(require_element(), 1);
27534    var import_jsx_runtime201 = __toESM(require_jsx_runtime(), 1);
27535    var GridItems = (0, import_element84.forwardRef)(({ className, previewSize, ...props }, ref) => {
27536      return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
27537        "div",
27538        {
27539          ref,
27540          className: clsx_default("dataviews-view-grid-items", className),
27541          style: {
27542            gridTemplateColumns: previewSize && `repeat(auto-fill, minmax($previewSize}px, 1fr))`
27543          },
27544          ...props
27545        }
27546      );
27547    });
27548  
27549    // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs
27550    var import_jsx_runtime202 = __toESM(require_jsx_runtime(), 1);
27551    var { Badge: Badge4 } = unlock3(import_components105.privateApis);
27552    function GridItem3({
27553      view,
27554      multiselect,
27555      selection,
27556      onChangeSelection,
27557      getItemId: getItemId2,
27558      item,
27559      mediaField,
27560      titleField,
27561      descriptionField: descriptionField2,
27562      regularFields,
27563      badgeFields,
27564      config: config2,
27565      posinset,
27566      setsize
27567    }) {
27568      const { showTitle = true, showMedia = true, showDescription = true } = view;
27569      const id = getItemId2(item);
27570      const isSelected2 = selection.includes(id);
27571      const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27572        mediaField.render,
27573        {
27574          item,
27575          field: mediaField,
27576          config: config2
27577        }
27578      ) : null;
27579      const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(titleField.render, { item, field: titleField }) : null;
27580      return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(
27581        import_components105.Composite.Item,
27582        {
27583          "aria-label": titleField ? titleField.getValue({ item }) || (0, import_i18n99.__)("(no title)") : void 0,
27584          render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(Stack, { direction: "column", children, ...props }),
27585          role: "option",
27586          "aria-posinset": posinset,
27587          "aria-setsize": setsize,
27588          className: clsx_default("dataviews-view-picker-grid__card", {
27589            "is-selected": isSelected2
27590          }),
27591          "aria-selected": isSelected2,
27592          onClick: () => {
27593            if (isSelected2) {
27594              onChangeSelection(
27595                selection.filter((itemId) => id !== itemId)
27596              );
27597            } else {
27598              const newSelection = multiselect ? [...selection, id] : [id];
27599              onChangeSelection(newSelection);
27600            }
27601          },
27602          children: [
27603            showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }),
27604            showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27605              DataViewsSelectionCheckbox,
27606              {
27607                item,
27608                selection,
27609                onChangeSelection,
27610                getItemId: getItemId2,
27611                titleField,
27612                disabled: false,
27613                "aria-hidden": true,
27614                tabIndex: -1
27615              }
27616            ),
27617            showTitle && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27618              Stack,
27619              {
27620                direction: "row",
27621                justify: "space-between",
27622                className: "dataviews-view-picker-grid__title-actions",
27623                children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField })
27624              }
27625            ),
27626            /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(Stack, { direction: "column", gap: "xs", children: [
27627              showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27628                descriptionField2.render,
27629                {
27630                  item,
27631                  field: descriptionField2
27632                }
27633              ),
27634              !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27635                Stack,
27636                {
27637                  direction: "row",
27638                  className: "dataviews-view-picker-grid__badge-fields",
27639                  gap: "sm",
27640                  wrap: "wrap",
27641                  align: "top",
27642                  justify: "flex-start",
27643                  children: badgeFields.map((field) => {
27644                    return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27645                      Badge4,
27646                      {
27647                        className: "dataviews-view-picker-grid__field-value",
27648                        children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27649                          field.render,
27650                          {
27651                            item,
27652                            field
27653                          }
27654                        )
27655                      },
27656                      field.id
27657                    );
27658                  })
27659                }
27660              ),
27661              !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27662                Stack,
27663                {
27664                  direction: "column",
27665                  className: "dataviews-view-picker-grid__fields",
27666                  gap: "xs",
27667                  children: regularFields.map((field) => {
27668                    return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27669                      import_components105.Flex,
27670                      {
27671                        className: "dataviews-view-picker-grid__field",
27672                        gap: 1,
27673                        justify: "flex-start",
27674                        expanded: true,
27675                        style: { height: "auto" },
27676                        direction: "row",
27677                        children: /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(import_jsx_runtime202.Fragment, { children: [
27678                          /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_components105.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }),
27679                          /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27680                            import_components105.FlexItem,
27681                            {
27682                              className: "dataviews-view-picker-grid__field-value",
27683                              style: { maxHeight: "none" },
27684                              children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27685                                field.render,
27686                                {
27687                                  item,
27688                                  field
27689                                }
27690                              )
27691                            }
27692                          )
27693                        ] })
27694                      },
27695                      field.id
27696                    );
27697                  })
27698                }
27699              )
27700            ] })
27701          ]
27702        },
27703        id
27704      );
27705    }
27706    function GridGroup({
27707      groupName,
27708      groupField,
27709      showLabel = true,
27710      children
27711    }) {
27712      const headerId = (0, import_compose18.useInstanceId)(
27713        GridGroup,
27714        "dataviews-view-picker-grid-group__header"
27715      );
27716      return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(
27717        Stack,
27718        {
27719          direction: "column",
27720          gap: "sm",
27721          role: "group",
27722          "aria-labelledby": headerId,
27723          children: [
27724            /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27725              "h3",
27726              {
27727                className: "dataviews-view-picker-grid-group__header",
27728                id: headerId,
27729                children: showLabel ? (0, import_i18n99.sprintf)(
27730                  // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
27731                  (0, import_i18n99.__)("%1$s: %2$s"),
27732                  groupField.label,
27733                  groupName
27734                ) : groupName
27735              }
27736            ),
27737            children
27738          ]
27739        },
27740        groupName
27741      );
27742    }
27743    function ViewPickerGrid({
27744      actions,
27745      data,
27746      fields,
27747      getItemId: getItemId2,
27748      isLoading,
27749      onChangeSelection,
27750      selection,
27751      view,
27752      className,
27753      empty
27754    }) {
27755      const { resizeObserverRef, paginationInfo, itemListLabel } = (0, import_element85.useContext)(dataviews_context_default);
27756      const titleField = fields.find(
27757        (field) => field.id === view?.titleField
27758      );
27759      const mediaField = fields.find(
27760        (field) => field.id === view?.mediaField
27761      );
27762      const descriptionField2 = fields.find(
27763        (field) => field.id === view?.descriptionField
27764      );
27765      const otherFields = view.fields ?? [];
27766      const { regularFields, badgeFields } = otherFields.reduce(
27767        (accumulator, fieldId) => {
27768          const field = fields.find((f2) => f2.id === fieldId);
27769          if (!field) {
27770            return accumulator;
27771          }
27772          const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields";
27773          accumulator[key].push(field);
27774          return accumulator;
27775        },
27776        { regularFields: [], badgeFields: [] }
27777      );
27778      const hasData = !!data?.length;
27779      const usedPreviewSize = view.layout?.previewSize;
27780      const isMultiselect = useIsMultiselectPicker(actions);
27781      const size = "900px";
27782      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
27783      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
27784      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
27785      const currentPage = view?.page ?? 1;
27786      const perPage = view?.perPage ?? 0;
27787      const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0;
27788      return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(import_jsx_runtime202.Fragment, {
27789        // Render multiple groups.
27790        children: [
27791          hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27792            import_components105.Composite,
27793            {
27794              virtualFocus: true,
27795              orientation: "horizontal",
27796              role: "listbox",
27797              "aria-multiselectable": isMultiselect,
27798              className: clsx_default(
27799                "dataviews-view-picker-grid",
27800                className
27801              ),
27802              "aria-label": itemListLabel,
27803              render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27804                Stack,
27805                {
27806                  direction: "column",
27807                  gap: "lg",
27808                  children,
27809                  ...props
27810                }
27811              ),
27812              children: Array.from(dataByGroup.entries()).map(
27813                ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27814                  GridGroup,
27815                  {
27816                    groupName,
27817                    groupField,
27818                    showLabel: view.groupBy?.showLabel !== false,
27819                    children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27820                      GridItems,
27821                      {
27822                        previewSize: usedPreviewSize,
27823                        style: {
27824                          gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax($usedPreviewSize}px, 1fr))`
27825                        },
27826                        "aria-busy": isLoading,
27827                        ref: resizeObserverRef,
27828                        children: groupItems.map((item) => {
27829                          const posInSet = (currentPage - 1) * perPage + data.indexOf(item) + 1;
27830                          return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27831                            GridItem3,
27832                            {
27833                              view,
27834                              multiselect: isMultiselect,
27835                              selection,
27836                              onChangeSelection,
27837                              getItemId: getItemId2,
27838                              item,
27839                              mediaField,
27840                              titleField,
27841                              descriptionField: descriptionField2,
27842                              regularFields,
27843                              badgeFields,
27844                              config: {
27845                                sizes: size
27846                              },
27847                              posinset: posInSet,
27848                              setsize: setSize
27849                            },
27850                            getItemId2(item)
27851                          );
27852                        })
27853                      }
27854                    )
27855                  },
27856                  groupName
27857                )
27858              )
27859            }
27860          ),
27861          // Render a single grid with all data.
27862          hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27863            import_components105.Composite,
27864            {
27865              render: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27866                GridItems,
27867                {
27868                  className: clsx_default(
27869                    "dataviews-view-picker-grid",
27870                    className
27871                  ),
27872                  previewSize: usedPreviewSize,
27873                  "aria-busy": isLoading,
27874                  ref: resizeObserverRef
27875                }
27876              ),
27877              virtualFocus: true,
27878              orientation: "horizontal",
27879              role: "listbox",
27880              "aria-multiselectable": isMultiselect,
27881              "aria-label": itemListLabel,
27882              children: data.map((item, index) => {
27883                let posinset = isInfiniteScroll ? index + 1 : void 0;
27884                if (!isInfiniteScroll) {
27885                  posinset = (currentPage - 1) * perPage + index + 1;
27886                }
27887                return /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27888                  GridItem3,
27889                  {
27890                    view,
27891                    multiselect: isMultiselect,
27892                    selection,
27893                    onChangeSelection,
27894                    getItemId: getItemId2,
27895                    item,
27896                    mediaField,
27897                    titleField,
27898                    descriptionField: descriptionField2,
27899                    regularFields,
27900                    badgeFields,
27901                    config: {
27902                      sizes: size
27903                    },
27904                    posinset,
27905                    setsize: setSize
27906                  },
27907                  getItemId2(item)
27908                );
27909              })
27910            }
27911          ),
27912          // Render empty state.
27913          !hasData && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
27914            "div",
27915            {
27916              className: clsx_default({
27917                "dataviews-loading": isLoading,
27918                "dataviews-no-results": !isLoading
27919              }),
27920              children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_components105.Spinner, {}) }) : empty
27921            }
27922          ),
27923          hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_components105.Spinner, {}) })
27924        ]
27925      });
27926    }
27927    var picker_grid_default = ViewPickerGrid;
27928  
27929    // packages/dataviews/build-module/components/dataviews-layouts/picker-table/index.mjs
27930    var import_i18n100 = __toESM(require_i18n(), 1);
27931    var import_components106 = __toESM(require_components(), 1);
27932    var import_element86 = __toESM(require_element(), 1);
27933    var import_jsx_runtime203 = __toESM(require_jsx_runtime(), 1);
27934    function TableColumnField2({
27935      item,
27936      fields,
27937      column,
27938      align
27939    }) {
27940      const field = fields.find((f2) => f2.id === column);
27941      if (!field) {
27942        return null;
27943      }
27944      const className = clsx_default("dataviews-view-table__cell-content-wrapper", {
27945        "dataviews-view-table__cell-align-end": align === "end",
27946        "dataviews-view-table__cell-align-center": align === "center"
27947      });
27948      return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(field.render, { item, field }) });
27949    }
27950    function TableRow2({
27951      item,
27952      fields,
27953      id,
27954      view,
27955      titleField,
27956      mediaField,
27957      descriptionField: descriptionField2,
27958      selection,
27959      getItemId: getItemId2,
27960      onChangeSelection,
27961      multiselect,
27962      posinset
27963    }) {
27964      const { paginationInfo } = (0, import_element86.useContext)(dataviews_context_default);
27965      const isSelected2 = selection.includes(id);
27966      const [isHovered, setIsHovered] = (0, import_element86.useState)(false);
27967      const {
27968        showTitle = true,
27969        showMedia = true,
27970        showDescription = true,
27971        infiniteScrollEnabled
27972      } = view;
27973      const handleMouseEnter = () => {
27974        setIsHovered(true);
27975      };
27976      const handleMouseLeave = () => {
27977        setIsHovered(false);
27978      };
27979      const columns = view.fields ?? [];
27980      const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription;
27981      return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
27982        import_components106.Composite.Item,
27983        {
27984          render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
27985            "tr",
27986            {
27987              className: clsx_default("dataviews-view-table__row", {
27988                "is-selected": isSelected2,
27989                "is-hovered": isHovered
27990              }),
27991              onMouseEnter: handleMouseEnter,
27992              onMouseLeave: handleMouseLeave,
27993              children,
27994              ...props
27995            }
27996          ),
27997          "aria-selected": isSelected2,
27998          "aria-setsize": paginationInfo.totalItems || void 0,
27999          "aria-posinset": posinset,
28000          role: infiniteScrollEnabled ? "article" : "option",
28001          onClick: () => {
28002            if (isSelected2) {
28003              onChangeSelection(
28004                selection.filter((itemId) => id !== itemId)
28005              );
28006            } else {
28007              const newSelection = multiselect ? [...selection, id] : [id];
28008              onChangeSelection(newSelection);
28009            }
28010          },
28011          children: [
28012            /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28013              "td",
28014              {
28015                className: "dataviews-view-table__checkbox-column",
28016                role: "presentation",
28017                children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28018                  DataViewsSelectionCheckbox,
28019                  {
28020                    item,
28021                    selection,
28022                    onChangeSelection,
28023                    getItemId: getItemId2,
28024                    titleField,
28025                    disabled: false,
28026                    "aria-hidden": true,
28027                    tabIndex: -1
28028                  }
28029                ) })
28030              }
28031            ),
28032            hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("td", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28033              column_primary_default,
28034              {
28035                item,
28036                titleField: showTitle ? titleField : void 0,
28037                mediaField: showMedia ? mediaField : void 0,
28038                descriptionField: showDescription ? descriptionField2 : void 0,
28039                isItemClickable: () => false
28040              }
28041            ) }),
28042            columns.map((column) => {
28043              const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
28044              return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28045                "td",
28046                {
28047                  style: {
28048                    width,
28049                    maxWidth,
28050                    minWidth
28051                  },
28052                  role: "presentation",
28053                  children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28054                    TableColumnField2,
28055                    {
28056                      fields,
28057                      item,
28058                      column,
28059                      align
28060                    }
28061                  )
28062                },
28063                column
28064              );
28065            })
28066          ]
28067        },
28068        id
28069      );
28070    }
28071    function ViewPickerTable({
28072      actions,
28073      data,
28074      fields,
28075      getItemId: getItemId2,
28076      isLoading = false,
28077      onChangeView,
28078      onChangeSelection,
28079      selection,
28080      setOpenedFilter,
28081      view,
28082      className,
28083      empty
28084    }) {
28085      const headerMenuRefs = (0, import_element86.useRef)(/* @__PURE__ */ new Map());
28086      const headerMenuToFocusRef = (0, import_element86.useRef)(void 0);
28087      const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element86.useState)();
28088      const isMultiselect = useIsMultiselectPicker(actions) ?? false;
28089      (0, import_element86.useEffect)(() => {
28090        if (headerMenuToFocusRef.current) {
28091          headerMenuToFocusRef.current.focus();
28092          headerMenuToFocusRef.current = void 0;
28093        }
28094      });
28095      const tableNoticeId = (0, import_element86.useId)();
28096      if (nextHeaderMenuToFocus) {
28097        headerMenuToFocusRef.current = nextHeaderMenuToFocus;
28098        setNextHeaderMenuToFocus(void 0);
28099        return;
28100      }
28101      const onHide = (field) => {
28102        const hidden = headerMenuRefs.current.get(field.id);
28103        const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0;
28104        setNextHeaderMenuToFocus(fallback?.node);
28105      };
28106      const hasData = !!data?.length;
28107      const titleField = fields.find((field) => field.id === view.titleField);
28108      const mediaField = fields.find((field) => field.id === view.mediaField);
28109      const descriptionField2 = fields.find(
28110        (field) => field.id === view.descriptionField
28111      );
28112      const groupField = view.groupBy?.field ? fields.find((f2) => f2.id === view.groupBy?.field) : null;
28113      const dataByGroup = groupField ? getDataByGroup(data, groupField) : null;
28114      const { showTitle = true, showMedia = true, showDescription = true } = view;
28115      const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription;
28116      const columns = view.fields ?? [];
28117      const headerMenuRef = (column, index) => (node) => {
28118        if (node) {
28119          headerMenuRefs.current.set(column, {
28120            node,
28121            fallback: columns[index > 0 ? index - 1 : 1]
28122          });
28123        } else {
28124          headerMenuRefs.current.delete(column);
28125        }
28126      };
28127      const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup;
28128      return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(import_jsx_runtime203.Fragment, { children: [
28129        /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
28130          "table",
28131          {
28132            className: clsx_default(
28133              "dataviews-view-table",
28134              "dataviews-view-picker-table",
28135              className,
28136              {
28137                [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
28138                  view.layout.density
28139                )
28140              }
28141            ),
28142            "aria-busy": isLoading,
28143            "aria-describedby": tableNoticeId,
28144            role: isInfiniteScroll ? "feed" : "listbox",
28145            children: [
28146              /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("thead", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
28147                "tr",
28148                {
28149                  className: "dataviews-view-table__row",
28150                  role: "presentation",
28151                  children: [
28152                    /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("th", { className: "dataviews-view-table__checkbox-column", children: isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28153                      BulkSelectionCheckbox,
28154                      {
28155                        selection,
28156                        onChangeSelection,
28157                        data,
28158                        actions,
28159                        getItemId: getItemId2
28160                      }
28161                    ) }),
28162                    hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("th", { children: titleField && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28163                      column_header_menu_default,
28164                      {
28165                        ref: headerMenuRef(
28166                          titleField.id,
28167                          0
28168                        ),
28169                        fieldId: titleField.id,
28170                        view,
28171                        fields,
28172                        onChangeView,
28173                        onHide,
28174                        setOpenedFilter,
28175                        canMove: false
28176                      }
28177                    ) }),
28178                    columns.map((column, index) => {
28179                      const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {};
28180                      return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28181                        "th",
28182                        {
28183                          style: {
28184                            width,
28185                            maxWidth,
28186                            minWidth,
28187                            textAlign: align
28188                          },
28189                          "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0,
28190                          scope: "col",
28191                          children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28192                            column_header_menu_default,
28193                            {
28194                              ref: headerMenuRef(column, index),
28195                              fieldId: column,
28196                              view,
28197                              fields,
28198                              onChangeView,
28199                              onHide,
28200                              setOpenedFilter,
28201                              canMove: view.layout?.enableMoving ?? true
28202                            }
28203                          )
28204                        },
28205                        column
28206                      );
28207                    })
28208                  ]
28209                }
28210              ) }),
28211              hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map(
28212                ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
28213                  import_components106.Composite,
28214                  {
28215                    virtualFocus: true,
28216                    orientation: "vertical",
28217                    render: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("tbody", { role: "group" }),
28218                    children: [
28219                      /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28220                        "tr",
28221                        {
28222                          className: "dataviews-view-table__group-header-row",
28223                          role: "presentation",
28224                          children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28225                            "td",
28226                            {
28227                              colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + 1,
28228                              className: "dataviews-view-table__group-header-cell",
28229                              role: "presentation",
28230                              children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n100.sprintf)(
28231                                // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022".
28232                                (0, import_i18n100.__)("%1$s: %2$s"),
28233                                groupField.label,
28234                                groupName
28235                              )
28236                            }
28237                          )
28238                        }
28239                      ),
28240                      groupItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28241                        TableRow2,
28242                        {
28243                          item,
28244                          fields,
28245                          id: getItemId2(item) || index.toString(),
28246                          view,
28247                          titleField,
28248                          mediaField,
28249                          descriptionField: descriptionField2,
28250                          selection,
28251                          getItemId: getItemId2,
28252                          onChangeSelection,
28253                          multiselect: isMultiselect
28254                        },
28255                        getItemId2(item)
28256                      ))
28257                    ]
28258                  },
28259                  `group-$groupName}`
28260                )
28261              ) : /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28262                import_components106.Composite,
28263                {
28264                  render: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("tbody", { role: "presentation" }),
28265                  virtualFocus: true,
28266                  orientation: "vertical",
28267                  children: hasData && data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
28268                    TableRow2,
28269                    {
28270                      item,
28271                      fields,
28272                      id: getItemId2(item) || index.toString(),
28273                      view,
28274                      titleField,
28275                      mediaField,
28276                      descriptionField: descriptionField2,
28277                      selection,
28278                      getItemId: getItemId2,
28279                      onChangeSelection,
28280                      multiselect: isMultiselect,
28281                      posinset: index + 1
28282                    },
28283                    getItemId2(item)
28284                  ))
28285                }
28286              )
28287            ]
28288          }
28289        ),
28290        /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
28291          "div",
28292          {
28293            className: clsx_default({
28294              "dataviews-loading": isLoading,
28295              "dataviews-no-results": !hasData && !isLoading
28296            }),
28297            id: tableNoticeId,
28298            children: [
28299              !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(import_components106.Spinner, {}) }) : empty),
28300              hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(import_components106.Spinner, {}) })
28301            ]
28302          }
28303        )
28304      ] });
28305    }
28306    var picker_table_default = ViewPickerTable;
28307  
28308    // packages/dataviews/build-module/components/dataviews-layouts/utils/preview-size-picker.mjs
28309    var import_components107 = __toESM(require_components(), 1);
28310    var import_i18n101 = __toESM(require_i18n(), 1);
28311    var import_element87 = __toESM(require_element(), 1);
28312    var import_jsx_runtime204 = __toESM(require_jsx_runtime(), 1);
28313    var imageSizes2 = [
28314      {
28315        value: 120,
28316        breakpoint: 1
28317      },
28318      {
28319        value: 170,
28320        breakpoint: 1
28321      },
28322      {
28323        value: 230,
28324        breakpoint: 1
28325      },
28326      {
28327        value: 290,
28328        breakpoint: 1112
28329        // at minimum image width, 4 images display at this container size
28330      },
28331      {
28332        value: 350,
28333        breakpoint: 1636
28334        // at minimum image width, 6 images display at this container size
28335      },
28336      {
28337        value: 430,
28338        breakpoint: 588
28339        // at minimum image width, 2 images display at this container size
28340      }
28341    ];
28342    function PreviewSizePicker() {
28343      const context = (0, import_element87.useContext)(dataviews_context_default);
28344      const view = context.view;
28345      const breakValues = imageSizes2.filter((size) => {
28346        return context.containerWidth >= size.breakpoint;
28347      });
28348      const layoutPreviewSize = view.layout?.previewSize ?? 230;
28349      const previewSizeToUse = breakValues.map((size, index) => ({ ...size, index })).filter((size) => size.value <= layoutPreviewSize).sort((a2, b2) => b2.value - a2.value)[0]?.index ?? 0;
28350      const marks = breakValues.map((size, index) => {
28351        return {
28352          value: index
28353        };
28354      });
28355      return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
28356        import_components107.RangeControl,
28357        {
28358          __next40pxDefaultSize: true,
28359          showTooltip: false,
28360          label: (0, import_i18n101.__)("Preview size"),
28361          value: previewSizeToUse,
28362          min: 0,
28363          max: breakValues.length - 1,
28364          withInputField: false,
28365          onChange: (value = 0) => {
28366            context.onChangeView({
28367              ...view,
28368              layout: {
28369                ...view.layout,
28370                previewSize: breakValues[value].value
28371              }
28372            });
28373          },
28374          step: 1,
28375          marks
28376        }
28377      );
28378    }
28379  
28380    // packages/dataviews/build-module/components/dataviews-layouts/utils/density-picker.mjs
28381    var import_components108 = __toESM(require_components(), 1);
28382    var import_i18n102 = __toESM(require_i18n(), 1);
28383    var import_element88 = __toESM(require_element(), 1);
28384    var import_jsx_runtime205 = __toESM(require_jsx_runtime(), 1);
28385    function DensityPicker() {
28386      const context = (0, import_element88.useContext)(dataviews_context_default);
28387      const view = context.view;
28388      return /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(
28389        import_components108.__experimentalToggleGroupControl,
28390        {
28391          size: "__unstable-large",
28392          label: (0, import_i18n102.__)("Density"),
28393          value: view.layout?.density || "balanced",
28394          onChange: (value) => {
28395            context.onChangeView({
28396              ...view,
28397              layout: {
28398                ...view.layout,
28399                density: value
28400              }
28401            });
28402          },
28403          isBlock: true,
28404          children: [
28405            /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
28406              import_components108.__experimentalToggleGroupControlOption,
28407              {
28408                value: "comfortable",
28409                label: (0, import_i18n102._x)(
28410                  "Comfortable",
28411                  "Density option for DataView layout"
28412                )
28413              },
28414              "comfortable"
28415            ),
28416            /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
28417              import_components108.__experimentalToggleGroupControlOption,
28418              {
28419                value: "balanced",
28420                label: (0, import_i18n102._x)("Balanced", "Density option for DataView layout")
28421              },
28422              "balanced"
28423            ),
28424            /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
28425              import_components108.__experimentalToggleGroupControlOption,
28426              {
28427                value: "compact",
28428                label: (0, import_i18n102._x)("Compact", "Density option for DataView layout")
28429              },
28430              "compact"
28431            )
28432          ]
28433        }
28434      );
28435    }
28436  
28437    // packages/dataviews/build-module/components/dataviews-layouts/index.mjs
28438    var VIEW_LAYOUTS = [
28439      {
28440        type: LAYOUT_TABLE2,
28441        label: (0, import_i18n103.__)("Table"),
28442        component: table_default,
28443        icon: block_table_default,
28444        viewConfigOptions: DensityPicker
28445      },
28446      {
28447        type: LAYOUT_GRID2,
28448        label: (0, import_i18n103.__)("Grid"),
28449        component: grid_default,
28450        icon: category_default,
28451        viewConfigOptions: PreviewSizePicker
28452      },
28453      {
28454        type: LAYOUT_LIST2,
28455        label: (0, import_i18n103.__)("List"),
28456        component: ViewList,
28457        icon: (0, import_i18n103.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default,
28458        viewConfigOptions: DensityPicker
28459      },
28460      {
28461        type: LAYOUT_ACTIVITY,
28462        label: (0, import_i18n103.__)("Activity"),
28463        component: ViewActivity,
28464        icon: scheduled_default,
28465        viewConfigOptions: DensityPicker
28466      },
28467      {
28468        type: LAYOUT_PICKER_GRID,
28469        label: (0, import_i18n103.__)("Grid"),
28470        component: picker_grid_default,
28471        icon: category_default,
28472        viewConfigOptions: PreviewSizePicker,
28473        isPicker: true
28474      },
28475      {
28476        type: LAYOUT_PICKER_TABLE,
28477        label: (0, import_i18n103.__)("Table"),
28478        component: picker_table_default,
28479        icon: block_table_default,
28480        viewConfigOptions: DensityPicker,
28481        isPicker: true
28482      }
28483    ];
28484  
28485    // packages/dataviews/build-module/components/dataviews-filters/filters.mjs
28486    var import_element96 = __toESM(require_element(), 1);
28487  
28488    // packages/dataviews/build-module/components/dataviews-filters/filter.mjs
28489    var import_components111 = __toESM(require_components(), 1);
28490    var import_i18n106 = __toESM(require_i18n(), 1);
28491    var import_element93 = __toESM(require_element(), 1);
28492  
28493    // node_modules/@ariakit/core/esm/__chunks/XMCVU3LR.js
28494    function noop3(..._) {
28495    }
28496    function applyState(argument, currentValue) {
28497      if (isUpdater(argument)) {
28498        const value = isLazyValue(currentValue) ? currentValue() : currentValue;
28499        return argument(value);
28500      }
28501      return argument;
28502    }
28503    function isUpdater(argument) {
28504      return typeof argument === "function";
28505    }
28506    function isLazyValue(value) {
28507      return typeof value === "function";
28508    }
28509    function hasOwnProperty(object, prop) {
28510      if (typeof Object.hasOwn === "function") {
28511        return Object.hasOwn(object, prop);
28512      }
28513      return Object.prototype.hasOwnProperty.call(object, prop);
28514    }
28515    function chain(...fns) {
28516      return (...args) => {
28517        for (const fn of fns) {
28518          if (typeof fn === "function") {
28519            fn(...args);
28520          }
28521        }
28522      };
28523    }
28524    function normalizeString2(str) {
28525      return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
28526    }
28527    function omit(object, keys) {
28528      const result = { ...object };
28529      for (const key of keys) {
28530        if (hasOwnProperty(result, key)) {
28531          delete result[key];
28532        }
28533      }
28534      return result;
28535    }
28536    function pick(object, paths) {
28537      const result = {};
28538      for (const key of paths) {
28539        if (hasOwnProperty(object, key)) {
28540          result[key] = object[key];
28541        }
28542      }
28543      return result;
28544    }
28545    function identity(value) {
28546      return value;
28547    }
28548    function invariant(condition, message2) {
28549      if (condition) return;
28550      if (typeof message2 !== "string") throw new Error("Invariant failed");
28551      throw new Error(message2);
28552    }
28553    function getKeys(obj) {
28554      return Object.keys(obj);
28555    }
28556    function isFalsyBooleanCallback(booleanOrCallback, ...args) {
28557      const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
28558      if (result == null) return false;
28559      return !result;
28560    }
28561    function disabledFromProps(props) {
28562      return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
28563    }
28564    function removeUndefinedValues(obj) {
28565      const result = {};
28566      for (const key in obj) {
28567        if (obj[key] !== void 0) {
28568          result[key] = obj[key];
28569        }
28570      }
28571      return result;
28572    }
28573    function defaultValue(...values) {
28574      for (const value of values) {
28575        if (value !== void 0) return value;
28576      }
28577      return void 0;
28578    }
28579  
28580    // node_modules/@ariakit/react-core/esm/__chunks/YXGXYGQX.js
28581    var import_react8 = __toESM(require_react(), 1);
28582    function setRef(ref, value) {
28583      if (typeof ref === "function") {
28584        ref(value);
28585      } else if (ref) {
28586        ref.current = value;
28587      }
28588    }
28589    function isValidElementWithRef(element) {
28590      if (!element) return false;
28591      if (!(0, import_react8.isValidElement)(element)) return false;
28592      if ("ref" in element.props) return true;
28593      if ("ref" in element) return true;
28594      return false;
28595    }
28596    function getRefProperty(element) {
28597      if (!isValidElementWithRef(element)) return null;
28598      const props = { ...element.props };
28599      return props.ref || element.ref;
28600    }
28601    function mergeProps2(base, overrides) {
28602      const props = { ...base };
28603      for (const key in overrides) {
28604        if (!hasOwnProperty(overrides, key)) continue;
28605        if (key === "className") {
28606          const prop = "className";
28607          props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop];
28608          continue;
28609        }
28610        if (key === "style") {
28611          const prop = "style";
28612          props[prop] = base[prop] ? { ...base[prop], ...overrides[prop] } : overrides[prop];
28613          continue;
28614        }
28615        const overrideValue = overrides[key];
28616        if (typeof overrideValue === "function" && key.startsWith("on")) {
28617          const baseValue = base[key];
28618          if (typeof baseValue === "function") {
28619            props[key] = (...args) => {
28620              overrideValue(...args);
28621              baseValue(...args);
28622            };
28623            continue;
28624          }
28625        }
28626        props[key] = overrideValue;
28627      }
28628      return props;
28629    }
28630  
28631    // node_modules/@ariakit/core/esm/__chunks/3DNM6L6E.js
28632    var canUseDOM = checkIsBrowser();
28633    function checkIsBrowser() {
28634      var _a;
28635      return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
28636    }
28637    function getDocument(node) {
28638      if (!node) return document;
28639      if ("self" in node) return node.document;
28640      return node.ownerDocument || document;
28641    }
28642    function getActiveElement(node, activeDescendant = false) {
28643      var _a;
28644      const { activeElement } = getDocument(node);
28645      if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
28646        return null;
28647      }
28648      if (isFrame(activeElement) && ((_a = activeElement.contentDocument) == null ? void 0 : _a.body)) {
28649        return getActiveElement(
28650          activeElement.contentDocument.body,
28651          activeDescendant
28652        );
28653      }
28654      if (activeDescendant) {
28655        const id = activeElement.getAttribute("aria-activedescendant");
28656        if (id) {
28657          const element = getDocument(activeElement).getElementById(id);
28658          if (element) {
28659            return element;
28660          }
28661        }
28662      }
28663      return activeElement;
28664    }
28665    function contains(parent, child) {
28666      return parent === child || parent.contains(child);
28667    }
28668    function isFrame(element) {
28669      return element.tagName === "IFRAME";
28670    }
28671    function isButton(element) {
28672      const tagName = element.tagName.toLowerCase();
28673      if (tagName === "button") return true;
28674      if (tagName === "input" && element.type) {
28675        return buttonInputTypes.indexOf(element.type) !== -1;
28676      }
28677      return false;
28678    }
28679    var buttonInputTypes = [
28680      "button",
28681      "color",
28682      "file",
28683      "image",
28684      "reset",
28685      "submit"
28686    ];
28687    function isVisible(element) {
28688      if (typeof element.checkVisibility === "function") {
28689        return element.checkVisibility();
28690      }
28691      const htmlElement = element;
28692      return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
28693    }
28694    function isTextField(element) {
28695      try {
28696        const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
28697        const isTextArea = element.tagName === "TEXTAREA";
28698        return isTextInput || isTextArea || false;
28699      } catch (_error) {
28700        return false;
28701      }
28702    }
28703    function isTextbox(element) {
28704      return element.isContentEditable || isTextField(element);
28705    }
28706    function getTextboxValue(element) {
28707      if (isTextField(element)) {
28708        return element.value;
28709      }
28710      if (element.isContentEditable) {
28711        const range = getDocument(element).createRange();
28712        range.selectNodeContents(element);
28713        return range.toString();
28714      }
28715      return "";
28716    }
28717    function getTextboxSelection(element) {
28718      let start2 = 0;
28719      let end = 0;
28720      if (isTextField(element)) {
28721        start2 = element.selectionStart || 0;
28722        end = element.selectionEnd || 0;
28723      } else if (element.isContentEditable) {
28724        const selection = getDocument(element).getSelection();
28725        if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
28726          const range = selection.getRangeAt(0);
28727          const nextRange = range.cloneRange();
28728          nextRange.selectNodeContents(element);
28729          nextRange.setEnd(range.startContainer, range.startOffset);
28730          start2 = nextRange.toString().length;
28731          nextRange.setEnd(range.endContainer, range.endOffset);
28732          end = nextRange.toString().length;
28733        }
28734      }
28735      return { start: start2, end };
28736    }
28737    function getPopupRole(element, fallback) {
28738      const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
28739      const role = element == null ? void 0 : element.getAttribute("role");
28740      if (role && allowedPopupRoles.indexOf(role) !== -1) {
28741        return role;
28742      }
28743      return fallback;
28744    }
28745    function getScrollingElement(element) {
28746      if (!element) return null;
28747      const isScrollableOverflow = (overflow) => {
28748        if (overflow === "auto") return true;
28749        if (overflow === "scroll") return true;
28750        return false;
28751      };
28752      if (element.clientHeight && element.scrollHeight > element.clientHeight) {
28753        const { overflowY } = getComputedStyle(element);
28754        if (isScrollableOverflow(overflowY)) return element;
28755      } else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
28756        const { overflowX } = getComputedStyle(element);
28757        if (isScrollableOverflow(overflowX)) return element;
28758      }
28759      return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
28760    }
28761    function setSelectionRange(element, ...args) {
28762      if (/text|search|password|tel|url/i.test(element.type)) {
28763        element.setSelectionRange(...args);
28764      }
28765    }
28766    function sortBasedOnDOMPosition(items, getElement) {
28767      const pairs = items.map((item, index) => [index, item]);
28768      let isOrderDifferent = false;
28769      pairs.sort(([indexA, a2], [indexB, b2]) => {
28770        const elementA = getElement(a2);
28771        const elementB = getElement(b2);
28772        if (elementA === elementB) return 0;
28773        if (!elementA || !elementB) return 0;
28774        if (isElementPreceding(elementA, elementB)) {
28775          if (indexA > indexB) {
28776            isOrderDifferent = true;
28777          }
28778          return -1;
28779        }
28780        if (indexA < indexB) {
28781          isOrderDifferent = true;
28782        }
28783        return 1;
28784      });
28785      if (isOrderDifferent) {
28786        return pairs.map(([_, item]) => item);
28787      }
28788      return items;
28789    }
28790    function isElementPreceding(a2, b2) {
28791      return Boolean(
28792        b2.compareDocumentPosition(a2) & Node.DOCUMENT_POSITION_PRECEDING
28793      );
28794    }
28795  
28796    // node_modules/@ariakit/core/esm/__chunks/SNHYQNEZ.js
28797    function isTouchDevice() {
28798      return canUseDOM && !!navigator.maxTouchPoints;
28799    }
28800    function isApple() {
28801      if (!canUseDOM) return false;
28802      return /mac|iphone|ipad|ipod/i.test(navigator.platform);
28803    }
28804    function isSafari() {
28805      return canUseDOM && isApple() && /apple/i.test(navigator.vendor);
28806    }
28807    function isFirefox() {
28808      return canUseDOM && /firefox\//i.test(navigator.userAgent);
28809    }
28810  
28811    // node_modules/@ariakit/core/esm/utils/events.js
28812    function isPortalEvent(event) {
28813      return Boolean(
28814        event.currentTarget && !contains(event.currentTarget, event.target)
28815      );
28816    }
28817    function isSelfTarget(event) {
28818      return event.target === event.currentTarget;
28819    }
28820    function isOpeningInNewTab(event) {
28821      const element = event.currentTarget;
28822      if (!element) return false;
28823      const isAppleDevice = isApple();
28824      if (isAppleDevice && !event.metaKey) return false;
28825      if (!isAppleDevice && !event.ctrlKey) return false;
28826      const tagName = element.tagName.toLowerCase();
28827      if (tagName === "a") return true;
28828      if (tagName === "button" && element.type === "submit") return true;
28829      if (tagName === "input" && element.type === "submit") return true;
28830      return false;
28831    }
28832    function isDownloading(event) {
28833      const element = event.currentTarget;
28834      if (!element) return false;
28835      const tagName = element.tagName.toLowerCase();
28836      if (!event.altKey) return false;
28837      if (tagName === "a") return true;
28838      if (tagName === "button" && element.type === "submit") return true;
28839      if (tagName === "input" && element.type === "submit") return true;
28840      return false;
28841    }
28842    function fireBlurEvent(element, eventInit) {
28843      const event = new FocusEvent("blur", eventInit);
28844      const defaultAllowed = element.dispatchEvent(event);
28845      const bubbleInit = { ...eventInit, bubbles: true };
28846      element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
28847      return defaultAllowed;
28848    }
28849    function fireKeyboardEvent(element, type, eventInit) {
28850      const event = new KeyboardEvent(type, eventInit);
28851      return element.dispatchEvent(event);
28852    }
28853    function fireClickEvent(element, eventInit) {
28854      const event = new MouseEvent("click", eventInit);
28855      return element.dispatchEvent(event);
28856    }
28857    function isFocusEventOutside(event, container) {
28858      const containerElement = container || event.currentTarget;
28859      const relatedTarget = event.relatedTarget;
28860      return !relatedTarget || !contains(containerElement, relatedTarget);
28861    }
28862    function queueBeforeEvent(element, type, callback, timeout) {
28863      const createTimer = (callback2) => {
28864        if (timeout) {
28865          const timerId2 = setTimeout(callback2, timeout);
28866          return () => clearTimeout(timerId2);
28867        }
28868        const timerId = requestAnimationFrame(callback2);
28869        return () => cancelAnimationFrame(timerId);
28870      };
28871      const cancelTimer = createTimer(() => {
28872        element.removeEventListener(type, callSync, true);
28873        callback();
28874      });
28875      const callSync = () => {
28876        cancelTimer();
28877        callback();
28878      };
28879      element.addEventListener(type, callSync, { once: true, capture: true });
28880      return cancelTimer;
28881    }
28882    function addGlobalEventListener(type, listener, options, scope = window) {
28883      const children = [];
28884      try {
28885        scope.document.addEventListener(type, listener, options);
28886        for (const frame of Array.from(scope.frames)) {
28887          children.push(addGlobalEventListener(type, listener, options, frame));
28888        }
28889      } catch (e2) {
28890      }
28891      const removeEventListener = () => {
28892        try {
28893          scope.document.removeEventListener(type, listener, options);
28894        } catch (e2) {
28895        }
28896        for (const remove of children) {
28897          remove();
28898        }
28899      };
28900      return removeEventListener;
28901    }
28902  
28903    // node_modules/@ariakit/react-core/esm/__chunks/KPHZR4MB.js
28904    var React7 = __toESM(require_react(), 1);
28905    var import_react9 = __toESM(require_react(), 1);
28906    var _React = { ...React7 };
28907    var useReactId = _React.useId;
28908    var useReactDeferredValue = _React.useDeferredValue;
28909    var useReactInsertionEffect = _React.useInsertionEffect;
28910    var useSafeLayoutEffect = canUseDOM ? import_react9.useLayoutEffect : import_react9.useEffect;
28911    function useInitialValue(value) {
28912      const [initialValue] = (0, import_react9.useState)(value);
28913      return initialValue;
28914    }
28915    function useLiveRef(value) {
28916      const ref = (0, import_react9.useRef)(value);
28917      useSafeLayoutEffect(() => {
28918        ref.current = value;
28919      });
28920      return ref;
28921    }
28922    function useEvent(callback) {
28923      const ref = (0, import_react9.useRef)(() => {
28924        throw new Error("Cannot call an event handler while rendering.");
28925      });
28926      if (useReactInsertionEffect) {
28927        useReactInsertionEffect(() => {
28928          ref.current = callback;
28929        });
28930      } else {
28931        ref.current = callback;
28932      }
28933      return (0, import_react9.useCallback)((...args) => {
28934        var _a;
28935        return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
28936      }, []);
28937    }
28938    function useTransactionState(callback) {
28939      const [state, setState] = (0, import_react9.useState)(null);
28940      useSafeLayoutEffect(() => {
28941        if (state == null) return;
28942        if (!callback) return;
28943        let prevState = null;
28944        callback((prev) => {
28945          prevState = prev;
28946          return state;
28947        });
28948        return () => {
28949          callback(prevState);
28950        };
28951      }, [state, callback]);
28952      return [state, setState];
28953    }
28954    function useMergeRefs(...refs) {
28955      return (0, import_react9.useMemo)(() => {
28956        if (!refs.some(Boolean)) return;
28957        return (value) => {
28958          for (const ref of refs) {
28959            setRef(ref, value);
28960          }
28961        };
28962      }, refs);
28963    }
28964    function useId5(defaultId) {
28965      if (useReactId) {
28966        const reactId = useReactId();
28967        if (defaultId) return defaultId;
28968        return reactId;
28969      }
28970      const [id, setId] = (0, import_react9.useState)(defaultId);
28971      useSafeLayoutEffect(() => {
28972        if (defaultId || id) return;
28973        const random = Math.random().toString(36).slice(2, 8);
28974        setId(`id-$random}`);
28975      }, [defaultId, id]);
28976      return defaultId || id;
28977    }
28978    function useTagName(refOrElement, type) {
28979      const stringOrUndefined = (type2) => {
28980        if (typeof type2 !== "string") return;
28981        return type2;
28982      };
28983      const [tagName, setTagName] = (0, import_react9.useState)(() => stringOrUndefined(type));
28984      useSafeLayoutEffect(() => {
28985        const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
28986        setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type));
28987      }, [refOrElement, type]);
28988      return tagName;
28989    }
28990    function useAttribute(refOrElement, attributeName, defaultValue2) {
28991      const initialValue = useInitialValue(defaultValue2);
28992      const [attribute, setAttribute] = (0, import_react9.useState)(initialValue);
28993      (0, import_react9.useEffect)(() => {
28994        const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
28995        if (!element) return;
28996        const callback = () => {
28997          const value = element.getAttribute(attributeName);
28998          setAttribute(value == null ? initialValue : value);
28999        };
29000        const observer = new MutationObserver(callback);
29001        observer.observe(element, { attributeFilter: [attributeName] });
29002        callback();
29003        return () => observer.disconnect();
29004      }, [refOrElement, attributeName, initialValue]);
29005      return attribute;
29006    }
29007    function useUpdateEffect(effect, deps) {
29008      const mounted = (0, import_react9.useRef)(false);
29009      (0, import_react9.useEffect)(() => {
29010        if (mounted.current) {
29011          return effect();
29012        }
29013        mounted.current = true;
29014      }, deps);
29015      (0, import_react9.useEffect)(
29016        () => () => {
29017          mounted.current = false;
29018        },
29019        []
29020      );
29021    }
29022    function useUpdateLayoutEffect(effect, deps) {
29023      const mounted = (0, import_react9.useRef)(false);
29024      useSafeLayoutEffect(() => {
29025        if (mounted.current) {
29026          return effect();
29027        }
29028        mounted.current = true;
29029      }, deps);
29030      useSafeLayoutEffect(
29031        () => () => {
29032          mounted.current = false;
29033        },
29034        []
29035      );
29036    }
29037    function useForceUpdate2() {
29038      return (0, import_react9.useReducer)(() => [], []);
29039    }
29040    function useBooleanEvent(booleanOrCallback) {
29041      return useEvent(
29042        typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback
29043      );
29044    }
29045    function useWrapElement(props, callback, deps = []) {
29046      const wrapElement = (0, import_react9.useCallback)(
29047        (element) => {
29048          if (props.wrapElement) {
29049            element = props.wrapElement(element);
29050          }
29051          return callback(element);
29052        },
29053        [...deps, props.wrapElement]
29054      );
29055      return { ...props, wrapElement };
29056    }
29057    function useMetadataProps(props, key, value) {
29058      const parent = props.onLoadedMetadataCapture;
29059      const onLoadedMetadataCapture = (0, import_react9.useMemo)(() => {
29060        return Object.assign(() => {
29061        }, { ...parent, [key]: value });
29062      }, [parent, key, value]);
29063      return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
29064    }
29065    var hasInstalledGlobalEventListeners = false;
29066    function useIsMouseMoving() {
29067      (0, import_react9.useEffect)(() => {
29068        if (hasInstalledGlobalEventListeners) return;
29069        addGlobalEventListener("mousemove", setMouseMoving, true);
29070        addGlobalEventListener("mousedown", resetMouseMoving, true);
29071        addGlobalEventListener("mouseup", resetMouseMoving, true);
29072        addGlobalEventListener("keydown", resetMouseMoving, true);
29073        addGlobalEventListener("scroll", resetMouseMoving, true);
29074        hasInstalledGlobalEventListeners = true;
29075      }, []);
29076      const isMouseMoving = useEvent(() => mouseMoving);
29077      return isMouseMoving;
29078    }
29079    var mouseMoving = false;
29080    var previousScreenX = 0;
29081    var previousScreenY = 0;
29082    function hasMouseMovement(event) {
29083      const movementX = event.movementX || event.screenX - previousScreenX;
29084      const movementY = event.movementY || event.screenY - previousScreenY;
29085      previousScreenX = event.screenX;
29086      previousScreenY = event.screenY;
29087      return movementX || movementY || false;
29088    }
29089    function setMouseMoving(event) {
29090      if (!hasMouseMovement(event)) return;
29091      mouseMoving = true;
29092    }
29093    function resetMouseMoving() {
29094      mouseMoving = false;
29095    }
29096  
29097    // node_modules/@ariakit/react-core/esm/__chunks/GWSL6KNJ.js
29098    var React8 = __toESM(require_react(), 1);
29099    var import_jsx_runtime206 = __toESM(require_jsx_runtime(), 1);
29100    function forwardRef22(render4) {
29101      const Role = React8.forwardRef(
29102        // @ts-ignore Incompatible with React 19 types. Ignore for now.
29103        (props, ref) => render4({ ...props, ref })
29104      );
29105      Role.displayName = render4.displayName || render4.name;
29106      return Role;
29107    }
29108    function memo22(Component, propsAreEqual) {
29109      return React8.memo(Component, propsAreEqual);
29110    }
29111    function createElement5(Type, props) {
29112      const { wrapElement, render: render4, ...rest } = props;
29113      const mergedRef = useMergeRefs(props.ref, getRefProperty(render4));
29114      let element;
29115      if (React8.isValidElement(render4)) {
29116        const renderProps = {
29117          // @ts-ignore Incompatible with React 19 types. Ignore for now.
29118          ...render4.props,
29119          ref: mergedRef
29120        };
29121        element = React8.cloneElement(render4, mergeProps2(rest, renderProps));
29122      } else if (render4) {
29123        element = render4(rest);
29124      } else {
29125        element = /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(Type, { ...rest });
29126      }
29127      if (wrapElement) {
29128        return wrapElement(element);
29129      }
29130      return element;
29131    }
29132    function createHook(useProps) {
29133      const useRole = (props = {}) => {
29134        return useProps(props);
29135      };
29136      useRole.displayName = useProps.name;
29137      return useRole;
29138    }
29139    function createStoreContext(providers = [], scopedProviders = []) {
29140      const context = React8.createContext(void 0);
29141      const scopedContext = React8.createContext(void 0);
29142      const useContext210 = () => React8.useContext(context);
29143      const useScopedContext = (onlyScoped = false) => {
29144        const scoped = React8.useContext(scopedContext);
29145        const store2 = useContext210();
29146        if (onlyScoped) return scoped;
29147        return scoped || store2;
29148      };
29149      const useProviderContext = () => {
29150        const scoped = React8.useContext(scopedContext);
29151        const store2 = useContext210();
29152        if (scoped && scoped === store2) return;
29153        return store2;
29154      };
29155      const ContextProvider = (props) => {
29156        return providers.reduceRight(
29157          (children, Provider) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(Provider, { ...props, children }),
29158          /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(context.Provider, { ...props })
29159        );
29160      };
29161      const ScopedContextProvider = (props) => {
29162        return /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(ContextProvider, { ...props, children: scopedProviders.reduceRight(
29163          (children, Provider) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(Provider, { ...props, children }),
29164          /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(scopedContext.Provider, { ...props })
29165        ) });
29166      };
29167      return {
29168        context,
29169        scopedContext,
29170        useContext: useContext210,
29171        useScopedContext,
29172        useProviderContext,
29173        ContextProvider,
29174        ScopedContextProvider
29175      };
29176    }
29177  
29178    // node_modules/@ariakit/react-core/esm/__chunks/SMPCIMZM.js
29179    var ctx2 = createStoreContext();
29180    var useCollectionContext = ctx2.useContext;
29181    var useCollectionScopedContext = ctx2.useScopedContext;
29182    var useCollectionProviderContext = ctx2.useProviderContext;
29183    var CollectionContextProvider = ctx2.ContextProvider;
29184    var CollectionScopedContextProvider = ctx2.ScopedContextProvider;
29185  
29186    // node_modules/@ariakit/react-core/esm/__chunks/AVVXDJMZ.js
29187    var import_react10 = __toESM(require_react(), 1);
29188    var ctx3 = createStoreContext(
29189      [CollectionContextProvider],
29190      [CollectionScopedContextProvider]
29191    );
29192    var useCompositeContext = ctx3.useContext;
29193    var useCompositeScopedContext = ctx3.useScopedContext;
29194    var useCompositeProviderContext = ctx3.useProviderContext;
29195    var CompositeContextProvider = ctx3.ContextProvider;
29196    var CompositeScopedContextProvider = ctx3.ScopedContextProvider;
29197    var CompositeItemContext = (0, import_react10.createContext)(
29198      void 0
29199    );
29200    var CompositeRowContext = (0, import_react10.createContext)(
29201      void 0
29202    );
29203  
29204    // node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js
29205    function findFirstEnabledItem(items, excludeId) {
29206      return items.find((item) => {
29207        if (excludeId) {
29208          return !item.disabled && item.id !== excludeId;
29209        }
29210        return !item.disabled;
29211      });
29212    }
29213    function getEnabledItem(store2, id) {
29214      if (!id) return null;
29215      return store2.item(id) || null;
29216    }
29217    function groupItemsByRows(items) {
29218      const rows = [];
29219      for (const item of items) {
29220        const row = rows.find((currentRow) => {
29221          var _a;
29222          return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
29223        });
29224        if (row) {
29225          row.push(item);
29226        } else {
29227          rows.push([item]);
29228        }
29229      }
29230      return rows;
29231    }
29232    function selectTextField(element, collapseToEnd = false) {
29233      if (isTextField(element)) {
29234        element.setSelectionRange(
29235          collapseToEnd ? element.value.length : 0,
29236          element.value.length
29237        );
29238      } else if (element.isContentEditable) {
29239        const selection = getDocument(element).getSelection();
29240        selection == null ? void 0 : selection.selectAllChildren(element);
29241        if (collapseToEnd) {
29242          selection == null ? void 0 : selection.collapseToEnd();
29243        }
29244      }
29245    }
29246    var FOCUS_SILENTLY = /* @__PURE__ */ Symbol("FOCUS_SILENTLY");
29247    function focusSilently(element) {
29248      element[FOCUS_SILENTLY] = true;
29249      element.focus({ preventScroll: true });
29250    }
29251    function silentlyFocused(element) {
29252      const isSilentlyFocused = element[FOCUS_SILENTLY];
29253      delete element[FOCUS_SILENTLY];
29254      return isSilentlyFocused;
29255    }
29256    function isItem(store2, element, exclude) {
29257      if (!element) return false;
29258      if (element === exclude) return false;
29259      const item = store2.item(element.id);
29260      if (!item) return false;
29261      if (exclude && item.element === exclude) return false;
29262      return true;
29263    }
29264  
29265    // node_modules/@ariakit/react-core/esm/__chunks/Z2O3VLAQ.js
29266    var import_react11 = __toESM(require_react(), 1);
29267    var TagName = "div";
29268    var useCollectionItem = createHook(
29269      function useCollectionItem2({
29270        store: store2,
29271        shouldRegisterItem = true,
29272        getItem = identity,
29273        // @ts-expect-error This prop may come from a collection renderer.
29274        element,
29275        ...props
29276      }) {
29277        const context = useCollectionContext();
29278        store2 = store2 || context;
29279        const id = useId5(props.id);
29280        const ref = (0, import_react11.useRef)(element);
29281        (0, import_react11.useEffect)(() => {
29282          const element2 = ref.current;
29283          if (!id) return;
29284          if (!element2) return;
29285          if (!shouldRegisterItem) return;
29286          const item = getItem({ id, element: element2 });
29287          return store2 == null ? void 0 : store2.renderItem(item);
29288        }, [id, shouldRegisterItem, getItem, store2]);
29289        props = {
29290          ...props,
29291          ref: useMergeRefs(ref, props.ref)
29292        };
29293        return removeUndefinedValues(props);
29294      }
29295    );
29296    var CollectionItem = forwardRef22(function CollectionItem2(props) {
29297      const htmlProps = useCollectionItem(props);
29298      return createElement5(TagName, htmlProps);
29299    });
29300  
29301    // node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js
29302    var import_react12 = __toESM(require_react(), 1);
29303    var FocusableContext = (0, import_react12.createContext)(true);
29304  
29305    // node_modules/@ariakit/core/esm/utils/focus.js
29306    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'])";
29307    function isFocusable(element) {
29308      if (!element.matches(selector)) return false;
29309      if (!isVisible(element)) return false;
29310      if (element.closest("[inert]")) return false;
29311      return true;
29312    }
29313    function getClosestFocusable(element) {
29314      while (element && !isFocusable(element)) {
29315        element = element.closest(selector);
29316      }
29317      return element || null;
29318    }
29319    function hasFocus(element) {
29320      const activeElement = getActiveElement(element);
29321      if (!activeElement) return false;
29322      if (activeElement === element) return true;
29323      const activeDescendant = activeElement.getAttribute("aria-activedescendant");
29324      if (!activeDescendant) return false;
29325      return activeDescendant === element.id;
29326    }
29327    function hasFocusWithin(element) {
29328      const activeElement = getActiveElement(element);
29329      if (!activeElement) return false;
29330      if (contains(element, activeElement)) return true;
29331      const activeDescendant = activeElement.getAttribute("aria-activedescendant");
29332      if (!activeDescendant) return false;
29333      if (!("id" in element)) return false;
29334      if (activeDescendant === element.id) return true;
29335      return !!element.querySelector(`#$CSS.escape(activeDescendant)}`);
29336    }
29337    function focusIfNeeded(element) {
29338      if (!hasFocusWithin(element) && isFocusable(element)) {
29339        element.focus();
29340      }
29341    }
29342    function focusIntoView(element, options) {
29343      if (!("scrollIntoView" in element)) {
29344        element.focus();
29345      } else {
29346        element.focus({ preventScroll: true });
29347        element.scrollIntoView({ block: "nearest", inline: "nearest", ...options });
29348      }
29349    }
29350  
29351    // node_modules/@ariakit/react-core/esm/__chunks/U6HHPQDW.js
29352    var import_react13 = __toESM(require_react(), 1);
29353    var TagName2 = "div";
29354    var isSafariBrowser = isSafari();
29355    var alwaysFocusVisibleInputTypes = [
29356      "text",
29357      "search",
29358      "url",
29359      "tel",
29360      "email",
29361      "password",
29362      "number",
29363      "date",
29364      "month",
29365      "week",
29366      "time",
29367      "datetime",
29368      "datetime-local"
29369    ];
29370    var safariFocusAncestorSymbol = /* @__PURE__ */ Symbol("safariFocusAncestor");
29371    function markSafariFocusAncestor(element, value) {
29372      if (!element) return;
29373      element[safariFocusAncestorSymbol] = value;
29374    }
29375    function isAlwaysFocusVisible(element) {
29376      const { tagName, readOnly, type } = element;
29377      if (tagName === "TEXTAREA" && !readOnly) return true;
29378      if (tagName === "SELECT" && !readOnly) return true;
29379      if (tagName === "INPUT" && !readOnly) {
29380        return alwaysFocusVisibleInputTypes.includes(type);
29381      }
29382      if (element.isContentEditable) return true;
29383      const role = element.getAttribute("role");
29384      if (role === "combobox" && element.dataset.name) {
29385        return true;
29386      }
29387      return false;
29388    }
29389    function getLabels(element) {
29390      if ("labels" in element) {
29391        return element.labels;
29392      }
29393      return null;
29394    }
29395    function isNativeCheckboxOrRadio(element) {
29396      const tagName = element.tagName.toLowerCase();
29397      if (tagName === "input" && element.type) {
29398        return element.type === "radio" || element.type === "checkbox";
29399      }
29400      return false;
29401    }
29402    function isNativeTabbable(tagName) {
29403      if (!tagName) return true;
29404      return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
29405    }
29406    function supportsDisabledAttribute(tagName) {
29407      if (!tagName) return true;
29408      return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
29409    }
29410    function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
29411      if (!focusable) {
29412        return tabIndexProp;
29413      }
29414      if (trulyDisabled) {
29415        if (nativeTabbable && !supportsDisabled) {
29416          return -1;
29417        }
29418        return;
29419      }
29420      if (nativeTabbable) {
29421        return tabIndexProp;
29422      }
29423      return tabIndexProp || 0;
29424    }
29425    function useDisableEvent(onEvent, disabled) {
29426      return useEvent((event) => {
29427        onEvent == null ? void 0 : onEvent(event);
29428        if (event.defaultPrevented) return;
29429        if (disabled) {
29430          event.stopPropagation();
29431          event.preventDefault();
29432        }
29433      });
29434    }
29435    var hasInstalledGlobalEventListeners2 = false;
29436    var isKeyboardModality = true;
29437    function onGlobalMouseDown(event) {
29438      const target = event.target;
29439      if (target && "hasAttribute" in target) {
29440        if (!target.hasAttribute("data-focus-visible")) {
29441          isKeyboardModality = false;
29442        }
29443      }
29444    }
29445    function onGlobalKeyDown(event) {
29446      if (event.metaKey) return;
29447      if (event.ctrlKey) return;
29448      if (event.altKey) return;
29449      isKeyboardModality = true;
29450    }
29451    var useFocusable = createHook(
29452      function useFocusable2({
29453        focusable = true,
29454        accessibleWhenDisabled,
29455        autoFocus,
29456        onFocusVisible,
29457        ...props
29458      }) {
29459        const ref = (0, import_react13.useRef)(null);
29460        (0, import_react13.useEffect)(() => {
29461          if (!focusable) return;
29462          if (hasInstalledGlobalEventListeners2) return;
29463          addGlobalEventListener("mousedown", onGlobalMouseDown, true);
29464          addGlobalEventListener("keydown", onGlobalKeyDown, true);
29465          hasInstalledGlobalEventListeners2 = true;
29466        }, [focusable]);
29467        if (isSafariBrowser) {
29468          (0, import_react13.useEffect)(() => {
29469            if (!focusable) return;
29470            const element = ref.current;
29471            if (!element) return;
29472            if (!isNativeCheckboxOrRadio(element)) return;
29473            const labels = getLabels(element);
29474            if (!labels) return;
29475            const onMouseUp = () => queueMicrotask(() => element.focus());
29476            for (const label of labels) {
29477              label.addEventListener("mouseup", onMouseUp);
29478            }
29479            return () => {
29480              for (const label of labels) {
29481                label.removeEventListener("mouseup", onMouseUp);
29482              }
29483            };
29484          }, [focusable]);
29485        }
29486        const disabled = focusable && disabledFromProps(props);
29487        const trulyDisabled = !!disabled && !accessibleWhenDisabled;
29488        const [focusVisible, setFocusVisible] = (0, import_react13.useState)(false);
29489        (0, import_react13.useEffect)(() => {
29490          if (!focusable) return;
29491          if (trulyDisabled && focusVisible) {
29492            setFocusVisible(false);
29493          }
29494        }, [focusable, trulyDisabled, focusVisible]);
29495        (0, import_react13.useEffect)(() => {
29496          if (!focusable) return;
29497          if (!focusVisible) return;
29498          const element = ref.current;
29499          if (!element) return;
29500          if (typeof IntersectionObserver === "undefined") return;
29501          const observer = new IntersectionObserver(() => {
29502            if (!isFocusable(element)) {
29503              setFocusVisible(false);
29504            }
29505          });
29506          observer.observe(element);
29507          return () => observer.disconnect();
29508        }, [focusable, focusVisible]);
29509        const onKeyPressCapture = useDisableEvent(
29510          props.onKeyPressCapture,
29511          disabled
29512        );
29513        const onMouseDownCapture = useDisableEvent(
29514          props.onMouseDownCapture,
29515          disabled
29516        );
29517        const onClickCapture = useDisableEvent(props.onClickCapture, disabled);
29518        const onMouseDownProp = props.onMouseDown;
29519        const onMouseDown = useEvent((event) => {
29520          onMouseDownProp == null ? void 0 : onMouseDownProp(event);
29521          if (event.defaultPrevented) return;
29522          if (!focusable) return;
29523          const element = event.currentTarget;
29524          if (!isSafariBrowser) return;
29525          if (isPortalEvent(event)) return;
29526          if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return;
29527          let receivedFocus = false;
29528          const onFocus = () => {
29529            receivedFocus = true;
29530          };
29531          const options = { capture: true, once: true };
29532          element.addEventListener("focusin", onFocus, options);
29533          const focusableContainer = getClosestFocusable(element.parentElement);
29534          markSafariFocusAncestor(focusableContainer, true);
29535          queueBeforeEvent(element, "mouseup", () => {
29536            element.removeEventListener("focusin", onFocus, true);
29537            markSafariFocusAncestor(focusableContainer, false);
29538            if (receivedFocus) return;
29539            focusIfNeeded(element);
29540          });
29541        });
29542        const handleFocusVisible = (event, currentTarget) => {
29543          if (currentTarget) {
29544            event.currentTarget = currentTarget;
29545          }
29546          if (!focusable) return;
29547          const element = event.currentTarget;
29548          if (!element) return;
29549          if (!hasFocus(element)) return;
29550          onFocusVisible == null ? void 0 : onFocusVisible(event);
29551          if (event.defaultPrevented) return;
29552          element.dataset.focusVisible = "true";
29553          setFocusVisible(true);
29554        };
29555        const onKeyDownCaptureProp = props.onKeyDownCapture;
29556        const onKeyDownCapture = useEvent((event) => {
29557          onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
29558          if (event.defaultPrevented) return;
29559          if (!focusable) return;
29560          if (focusVisible) return;
29561          if (event.metaKey) return;
29562          if (event.altKey) return;
29563          if (event.ctrlKey) return;
29564          if (!isSelfTarget(event)) return;
29565          const element = event.currentTarget;
29566          const applyFocusVisible = () => handleFocusVisible(event, element);
29567          queueBeforeEvent(element, "focusout", applyFocusVisible);
29568        });
29569        const onFocusCaptureProp = props.onFocusCapture;
29570        const onFocusCapture = useEvent((event) => {
29571          onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
29572          if (event.defaultPrevented) return;
29573          if (!focusable) return;
29574          if (!isSelfTarget(event)) {
29575            setFocusVisible(false);
29576            return;
29577          }
29578          const element = event.currentTarget;
29579          const applyFocusVisible = () => handleFocusVisible(event, element);
29580          if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
29581            queueBeforeEvent(event.target, "focusout", applyFocusVisible);
29582          } else {
29583            setFocusVisible(false);
29584          }
29585        });
29586        const onBlurProp = props.onBlur;
29587        const onBlur = useEvent((event) => {
29588          onBlurProp == null ? void 0 : onBlurProp(event);
29589          if (!focusable) return;
29590          if (!isFocusEventOutside(event)) return;
29591          event.currentTarget.removeAttribute("data-focus-visible");
29592          setFocusVisible(false);
29593        });
29594        const autoFocusOnShow = (0, import_react13.useContext)(FocusableContext);
29595        const autoFocusRef = useEvent((element) => {
29596          if (!focusable) return;
29597          if (!autoFocus) return;
29598          if (!element) return;
29599          if (!autoFocusOnShow) return;
29600          queueMicrotask(() => {
29601            if (hasFocus(element)) return;
29602            if (!isFocusable(element)) return;
29603            element.focus();
29604          });
29605        });
29606        const tagName = useTagName(ref);
29607        const nativeTabbable = focusable && isNativeTabbable(tagName);
29608        const supportsDisabled = focusable && supportsDisabledAttribute(tagName);
29609        const styleProp = props.style;
29610        const style = (0, import_react13.useMemo)(() => {
29611          if (trulyDisabled) {
29612            return { pointerEvents: "none", ...styleProp };
29613          }
29614          return styleProp;
29615        }, [trulyDisabled, styleProp]);
29616        props = {
29617          "data-focus-visible": focusable && focusVisible || void 0,
29618          "data-autofocus": autoFocus || void 0,
29619          "aria-disabled": disabled || void 0,
29620          ...props,
29621          ref: useMergeRefs(ref, autoFocusRef, props.ref),
29622          style,
29623          tabIndex: getTabIndex(
29624            focusable,
29625            trulyDisabled,
29626            nativeTabbable,
29627            supportsDisabled,
29628            props.tabIndex
29629          ),
29630          disabled: supportsDisabled && trulyDisabled ? true : void 0,
29631          // TODO: Test Focusable contentEditable.
29632          contentEditable: disabled ? void 0 : props.contentEditable,
29633          onKeyPressCapture,
29634          onClickCapture,
29635          onMouseDownCapture,
29636          onMouseDown,
29637          onKeyDownCapture,
29638          onFocusCapture,
29639          onBlur
29640        };
29641        return removeUndefinedValues(props);
29642      }
29643    );
29644    var Focusable = forwardRef22(function Focusable2(props) {
29645      const htmlProps = useFocusable(props);
29646      return createElement5(TagName2, htmlProps);
29647    });
29648  
29649    // node_modules/@ariakit/react-core/esm/__chunks/PZ3OL7I2.js
29650    var import_react14 = __toESM(require_react(), 1);
29651    var TagName3 = "button";
29652    function isNativeClick(event) {
29653      if (!event.isTrusted) return false;
29654      const element = event.currentTarget;
29655      if (event.key === "Enter") {
29656        return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
29657      }
29658      if (event.key === " ") {
29659        return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
29660      }
29661      return false;
29662    }
29663    var symbol = /* @__PURE__ */ Symbol("command");
29664    var useCommand = createHook(
29665      function useCommand2({ clickOnEnter = true, clickOnSpace = true, ...props }) {
29666        const ref = (0, import_react14.useRef)(null);
29667        const [isNativeButton, setIsNativeButton] = (0, import_react14.useState)(false);
29668        (0, import_react14.useEffect)(() => {
29669          if (!ref.current) return;
29670          setIsNativeButton(isButton(ref.current));
29671        }, []);
29672        const [active, setActive] = (0, import_react14.useState)(false);
29673        const activeRef = (0, import_react14.useRef)(false);
29674        const disabled = disabledFromProps(props);
29675        const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true);
29676        const onKeyDownProp = props.onKeyDown;
29677        const onKeyDown = useEvent((event) => {
29678          onKeyDownProp == null ? void 0 : onKeyDownProp(event);
29679          const element = event.currentTarget;
29680          if (event.defaultPrevented) return;
29681          if (isDuplicate) return;
29682          if (disabled) return;
29683          if (!isSelfTarget(event)) return;
29684          if (isTextField(element)) return;
29685          if (element.isContentEditable) return;
29686          const isEnter = clickOnEnter && event.key === "Enter";
29687          const isSpace = clickOnSpace && event.key === " ";
29688          const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
29689          const shouldPreventSpace = event.key === " " && !clickOnSpace;
29690          if (shouldPreventEnter || shouldPreventSpace) {
29691            event.preventDefault();
29692            return;
29693          }
29694          if (isEnter || isSpace) {
29695            const nativeClick = isNativeClick(event);
29696            if (isEnter) {
29697              if (!nativeClick) {
29698                event.preventDefault();
29699                const { view, ...eventInit } = event;
29700                const click = () => fireClickEvent(element, eventInit);
29701                if (isFirefox()) {
29702                  queueBeforeEvent(element, "keyup", click);
29703                } else {
29704                  queueMicrotask(click);
29705                }
29706              }
29707            } else if (isSpace) {
29708              activeRef.current = true;
29709              if (!nativeClick) {
29710                event.preventDefault();
29711                setActive(true);
29712              }
29713            }
29714          }
29715        });
29716        const onKeyUpProp = props.onKeyUp;
29717        const onKeyUp = useEvent((event) => {
29718          onKeyUpProp == null ? void 0 : onKeyUpProp(event);
29719          if (event.defaultPrevented) return;
29720          if (isDuplicate) return;
29721          if (disabled) return;
29722          if (event.metaKey) return;
29723          const isSpace = clickOnSpace && event.key === " ";
29724          if (activeRef.current && isSpace) {
29725            activeRef.current = false;
29726            if (!isNativeClick(event)) {
29727              event.preventDefault();
29728              setActive(false);
29729              const element = event.currentTarget;
29730              const { view, ...eventInit } = event;
29731              queueMicrotask(() => fireClickEvent(element, eventInit));
29732            }
29733          }
29734        });
29735        props = {
29736          "data-active": active || void 0,
29737          type: isNativeButton ? "button" : void 0,
29738          ...metadataProps,
29739          ...props,
29740          ref: useMergeRefs(ref, props.ref),
29741          onKeyDown,
29742          onKeyUp
29743        };
29744        props = useFocusable(props);
29745        return props;
29746      }
29747    );
29748    var Command = forwardRef22(function Command2(props) {
29749      const htmlProps = useCommand(props);
29750      return createElement5(TagName3, htmlProps);
29751    });
29752  
29753    // node_modules/@ariakit/core/esm/__chunks/SXKM4CGU.js
29754    function getInternal(store2, key) {
29755      const internals = store2.__unstableInternals;
29756      invariant(internals, "Invalid store");
29757      return internals[key];
29758    }
29759    function createStore(initialState, ...stores) {
29760      let state = initialState;
29761      let prevStateBatch = state;
29762      let lastUpdate = /* @__PURE__ */ Symbol();
29763      let destroy = noop3;
29764      const instances = /* @__PURE__ */ new Set();
29765      const updatedKeys = /* @__PURE__ */ new Set();
29766      const setups = /* @__PURE__ */ new Set();
29767      const listeners = /* @__PURE__ */ new Set();
29768      const batchListeners = /* @__PURE__ */ new Set();
29769      const disposables = /* @__PURE__ */ new WeakMap();
29770      const listenerKeys = /* @__PURE__ */ new WeakMap();
29771      const storeSetup = (callback) => {
29772        setups.add(callback);
29773        return () => setups.delete(callback);
29774      };
29775      const storeInit = () => {
29776        const initialized = instances.size;
29777        const instance = /* @__PURE__ */ Symbol();
29778        instances.add(instance);
29779        const maybeDestroy = () => {
29780          instances.delete(instance);
29781          if (instances.size) return;
29782          destroy();
29783        };
29784        if (initialized) return maybeDestroy;
29785        const desyncs = getKeys(state).map(
29786          (key) => chain(
29787            ...stores.map((store2) => {
29788              var _a;
29789              const storeState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
29790              if (!storeState) return;
29791              if (!hasOwnProperty(storeState, key)) return;
29792              return sync2(store2, [key], (state2) => {
29793                setState(
29794                  key,
29795                  state2[key],
29796                  // @ts-expect-error - Not public API. This is just to prevent
29797                  // infinite loops.
29798                  true
29799                );
29800              });
29801            })
29802          )
29803        );
29804        const teardowns = [];
29805        for (const setup2 of setups) {
29806          teardowns.push(setup2());
29807        }
29808        const cleanups = stores.map(init);
29809        destroy = chain(...desyncs, ...teardowns, ...cleanups);
29810        return maybeDestroy;
29811      };
29812      const sub = (keys, listener, set = listeners) => {
29813        set.add(listener);
29814        listenerKeys.set(listener, keys);
29815        return () => {
29816          var _a;
29817          (_a = disposables.get(listener)) == null ? void 0 : _a();
29818          disposables.delete(listener);
29819          listenerKeys.delete(listener);
29820          set.delete(listener);
29821        };
29822      };
29823      const storeSubscribe = (keys, listener) => sub(keys, listener);
29824      const storeSync = (keys, listener) => {
29825        disposables.set(listener, listener(state, state));
29826        return sub(keys, listener);
29827      };
29828      const storeBatch = (keys, listener) => {
29829        disposables.set(listener, listener(state, prevStateBatch));
29830        return sub(keys, listener, batchListeners);
29831      };
29832      const storePick = (keys) => createStore(pick(state, keys), finalStore);
29833      const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
29834      const getState = () => state;
29835      const setState = (key, value, fromStores = false) => {
29836        var _a;
29837        if (!hasOwnProperty(state, key)) return;
29838        const nextValue = applyState(value, state[key]);
29839        if (nextValue === state[key]) return;
29840        if (!fromStores) {
29841          for (const store2 of stores) {
29842            (_a = store2 == null ? void 0 : store2.setState) == null ? void 0 : _a.call(store2, key, nextValue);
29843          }
29844        }
29845        const prevState = state;
29846        state = { ...state, [key]: nextValue };
29847        const thisUpdate = /* @__PURE__ */ Symbol();
29848        lastUpdate = thisUpdate;
29849        updatedKeys.add(key);
29850        const run = (listener, prev, uKeys) => {
29851          var _a2;
29852          const keys = listenerKeys.get(listener);
29853          const updated = (k2) => uKeys ? uKeys.has(k2) : k2 === key;
29854          if (!keys || keys.some(updated)) {
29855            (_a2 = disposables.get(listener)) == null ? void 0 : _a2();
29856            disposables.set(listener, listener(state, prev));
29857          }
29858        };
29859        for (const listener of listeners) {
29860          run(listener, prevState);
29861        }
29862        queueMicrotask(() => {
29863          if (lastUpdate !== thisUpdate) return;
29864          const snapshot = state;
29865          for (const listener of batchListeners) {
29866            run(listener, prevStateBatch, updatedKeys);
29867          }
29868          prevStateBatch = snapshot;
29869          updatedKeys.clear();
29870        });
29871      };
29872      const finalStore = {
29873        getState,
29874        setState,
29875        __unstableInternals: {
29876          setup: storeSetup,
29877          init: storeInit,
29878          subscribe: storeSubscribe,
29879          sync: storeSync,
29880          batch: storeBatch,
29881          pick: storePick,
29882          omit: storeOmit
29883        }
29884      };
29885      return finalStore;
29886    }
29887    function setup(store2, ...args) {
29888      if (!store2) return;
29889      return getInternal(store2, "setup")(...args);
29890    }
29891    function init(store2, ...args) {
29892      if (!store2) return;
29893      return getInternal(store2, "init")(...args);
29894    }
29895    function subscribe(store2, ...args) {
29896      if (!store2) return;
29897      return getInternal(store2, "subscribe")(...args);
29898    }
29899    function sync2(store2, ...args) {
29900      if (!store2) return;
29901      return getInternal(store2, "sync")(...args);
29902    }
29903    function batch(store2, ...args) {
29904      if (!store2) return;
29905      return getInternal(store2, "batch")(...args);
29906    }
29907    function omit2(store2, ...args) {
29908      if (!store2) return;
29909      return getInternal(store2, "omit")(...args);
29910    }
29911    function pick2(store2, ...args) {
29912      if (!store2) return;
29913      return getInternal(store2, "pick")(...args);
29914    }
29915    function mergeStore(...stores) {
29916      var _a;
29917      const initialState = {};
29918      for (const store22 of stores) {
29919        const nextState = (_a = store22 == null ? void 0 : store22.getState) == null ? void 0 : _a.call(store22);
29920        if (nextState) {
29921          Object.assign(initialState, nextState);
29922        }
29923      }
29924      const store2 = createStore(initialState, ...stores);
29925      return Object.assign({}, ...stores, store2);
29926    }
29927    function throwOnConflictingProps(props, store2) {
29928      if (false) return;
29929      if (!store2) return;
29930      const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
29931        var _a;
29932        const stateKey = key.replace("default", "");
29933        return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`;
29934      });
29935      if (!defaultKeys.length) return;
29936      const storeState = store2.getState();
29937      const conflictingProps = defaultKeys.filter(
29938        (key) => hasOwnProperty(storeState, key)
29939      );
29940      if (!conflictingProps.length) return;
29941      throw new Error(
29942        `Passing a store prop in conjunction with a default state is not supported.
29943  
29944  const store = useSelectStore();
29945  <SelectProvider store={store} defaultValue="Apple" />
29946                  ^             ^
29947  
29948  Instead, pass the default state to the topmost store:
29949  
29950  const store = useSelectStore({ defaultValue: "Apple" });
29951  <SelectProvider store={store} />
29952  
29953  See https://github.com/ariakit/ariakit/pull/2745 for more details.
29954  
29955  If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
29956  `
29957      );
29958    }
29959  
29960    // node_modules/@ariakit/react-core/esm/__chunks/Q5W46E73.js
29961    var React9 = __toESM(require_react(), 1);
29962    var import_shim = __toESM(require_shim(), 1);
29963    var { useSyncExternalStore } = import_shim.default;
29964    var noopSubscribe = () => () => {
29965    };
29966    function useStoreState(store2, keyOrSelector = identity) {
29967      const storeSubscribe = React9.useCallback(
29968        (callback) => {
29969          if (!store2) return noopSubscribe();
29970          return subscribe(store2, null, callback);
29971        },
29972        [store2]
29973      );
29974      const getSnapshot = () => {
29975        const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
29976        const selector2 = typeof keyOrSelector === "function" ? keyOrSelector : null;
29977        const state = store2 == null ? void 0 : store2.getState();
29978        if (selector2) return selector2(state);
29979        if (!state) return;
29980        if (!key) return;
29981        if (!hasOwnProperty(state, key)) return;
29982        return state[key];
29983      };
29984      return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
29985    }
29986    function useStoreStateObject(store2, object) {
29987      const objRef = React9.useRef(
29988        {}
29989      );
29990      const storeSubscribe = React9.useCallback(
29991        (callback) => {
29992          if (!store2) return noopSubscribe();
29993          return subscribe(store2, null, callback);
29994        },
29995        [store2]
29996      );
29997      const getSnapshot = () => {
29998        const state = store2 == null ? void 0 : store2.getState();
29999        let updated = false;
30000        const obj = objRef.current;
30001        for (const prop in object) {
30002          const keyOrSelector = object[prop];
30003          if (typeof keyOrSelector === "function") {
30004            const value = keyOrSelector(state);
30005            if (value !== obj[prop]) {
30006              obj[prop] = value;
30007              updated = true;
30008            }
30009          }
30010          if (typeof keyOrSelector === "string") {
30011            if (!state) continue;
30012            if (!hasOwnProperty(state, keyOrSelector)) continue;
30013            const value = state[keyOrSelector];
30014            if (value !== obj[prop]) {
30015              obj[prop] = value;
30016              updated = true;
30017            }
30018          }
30019        }
30020        if (updated) {
30021          objRef.current = { ...obj };
30022        }
30023        return objRef.current;
30024      };
30025      return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
30026    }
30027    function useStoreProps(store2, props, key, setKey) {
30028      const value = hasOwnProperty(props, key) ? props[key] : void 0;
30029      const setValue = setKey ? props[setKey] : void 0;
30030      const propsRef = useLiveRef({ value, setValue });
30031      useSafeLayoutEffect(() => {
30032        return sync2(store2, [key], (state, prev) => {
30033          const { value: value2, setValue: setValue2 } = propsRef.current;
30034          if (!setValue2) return;
30035          if (state[key] === prev[key]) return;
30036          if (state[key] === value2) return;
30037          setValue2(state[key]);
30038        });
30039      }, [store2, key]);
30040      useSafeLayoutEffect(() => {
30041        if (value === void 0) return;
30042        store2.setState(key, value);
30043        return batch(store2, [key], () => {
30044          if (value === void 0) return;
30045          store2.setState(key, value);
30046        });
30047      });
30048    }
30049    function useStore(createStore2, props) {
30050      const [store2, setStore] = React9.useState(() => createStore2(props));
30051      useSafeLayoutEffect(() => init(store2), [store2]);
30052      const useState210 = React9.useCallback(
30053        (keyOrSelector) => useStoreState(store2, keyOrSelector),
30054        [store2]
30055      );
30056      const memoizedStore = React9.useMemo(
30057        () => ({ ...store2, useState: useState210 }),
30058        [store2, useState210]
30059      );
30060      const updateStore = useEvent(() => {
30061        setStore((store22) => createStore2({ ...props, ...store22.getState() }));
30062      });
30063      return [memoizedStore, updateStore];
30064    }
30065  
30066    // node_modules/@ariakit/react-core/esm/__chunks/WZWDIE3S.js
30067    var import_react15 = __toESM(require_react(), 1);
30068    var import_jsx_runtime207 = __toESM(require_jsx_runtime(), 1);
30069    var TagName4 = "button";
30070    function isEditableElement(element) {
30071      if (isTextbox(element)) return true;
30072      return element.tagName === "INPUT" && !isButton(element);
30073    }
30074    function getNextPageOffset(scrollingElement, pageUp = false) {
30075      const height = scrollingElement.clientHeight;
30076      const { top } = scrollingElement.getBoundingClientRect();
30077      const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
30078      const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
30079      if (scrollingElement.tagName === "HTML") {
30080        return pageOffset + scrollingElement.scrollTop;
30081      }
30082      return pageOffset;
30083    }
30084    function getItemOffset(itemElement, pageUp = false) {
30085      const { top } = itemElement.getBoundingClientRect();
30086      if (pageUp) {
30087        return top + itemElement.clientHeight;
30088      }
30089      return top;
30090    }
30091    function findNextPageItemId(element, store2, next, pageUp = false) {
30092      var _a;
30093      if (!store2) return;
30094      if (!next) return;
30095      const { renderedItems } = store2.getState();
30096      const scrollingElement = getScrollingElement(element);
30097      if (!scrollingElement) return;
30098      const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
30099      let id;
30100      let prevDifference;
30101      for (let i2 = 0; i2 < renderedItems.length; i2 += 1) {
30102        const previousId = id;
30103        id = next(i2);
30104        if (!id) break;
30105        if (id === previousId) continue;
30106        const itemElement = (_a = getEnabledItem(store2, id)) == null ? void 0 : _a.element;
30107        if (!itemElement) continue;
30108        const itemOffset = getItemOffset(itemElement, pageUp);
30109        const difference = itemOffset - nextPageOffset;
30110        const absDifference = Math.abs(difference);
30111        if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
30112          if (prevDifference !== void 0 && prevDifference < absDifference) {
30113            id = previousId;
30114          }
30115          break;
30116        }
30117        prevDifference = absDifference;
30118      }
30119      return id;
30120    }
30121    function targetIsAnotherItem(event, store2) {
30122      if (isSelfTarget(event)) return false;
30123      return isItem(store2, event.target);
30124    }
30125    var useCompositeItem = createHook(
30126      function useCompositeItem2({
30127        store: store2,
30128        rowId: rowIdProp,
30129        preventScrollOnKeyDown = false,
30130        moveOnKeyPress = true,
30131        tabbable = false,
30132        getItem: getItemProp,
30133        "aria-setsize": ariaSetSizeProp,
30134        "aria-posinset": ariaPosInSetProp,
30135        ...props
30136      }) {
30137        const context = useCompositeContext();
30138        store2 = store2 || context;
30139        const id = useId5(props.id);
30140        const ref = (0, import_react15.useRef)(null);
30141        const row = (0, import_react15.useContext)(CompositeRowContext);
30142        const disabled = disabledFromProps(props);
30143        const trulyDisabled = disabled && !props.accessibleWhenDisabled;
30144        const {
30145          rowId,
30146          baseElement,
30147          isActiveItem,
30148          ariaSetSize,
30149          ariaPosInSet,
30150          isTabbable
30151        } = useStoreStateObject(store2, {
30152          rowId(state) {
30153            if (rowIdProp) return rowIdProp;
30154            if (!state) return;
30155            if (!(row == null ? void 0 : row.baseElement)) return;
30156            if (row.baseElement !== state.baseElement) return;
30157            return row.id;
30158          },
30159          baseElement(state) {
30160            return (state == null ? void 0 : state.baseElement) || void 0;
30161          },
30162          isActiveItem(state) {
30163            return !!state && state.activeId === id;
30164          },
30165          ariaSetSize(state) {
30166            if (ariaSetSizeProp != null) return ariaSetSizeProp;
30167            if (!state) return;
30168            if (!(row == null ? void 0 : row.ariaSetSize)) return;
30169            if (row.baseElement !== state.baseElement) return;
30170            return row.ariaSetSize;
30171          },
30172          ariaPosInSet(state) {
30173            if (ariaPosInSetProp != null) return ariaPosInSetProp;
30174            if (!state) return;
30175            if (!(row == null ? void 0 : row.ariaPosInSet)) return;
30176            if (row.baseElement !== state.baseElement) return;
30177            const itemsInRow = state.renderedItems.filter(
30178              (item) => item.rowId === rowId
30179            );
30180            return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id);
30181          },
30182          isTabbable(state) {
30183            if (!(state == null ? void 0 : state.renderedItems.length)) return true;
30184            if (state.virtualFocus) return false;
30185            if (tabbable) return true;
30186            if (state.activeId === null) return false;
30187            const item = store2 == null ? void 0 : store2.item(state.activeId);
30188            if (item == null ? void 0 : item.disabled) return true;
30189            if (!(item == null ? void 0 : item.element)) return true;
30190            return state.activeId === id;
30191          }
30192        });
30193        const getItem = (0, import_react15.useCallback)(
30194          (item) => {
30195            var _a;
30196            const nextItem = {
30197              ...item,
30198              id: id || item.id,
30199              rowId,
30200              disabled: !!trulyDisabled,
30201              children: (_a = item.element) == null ? void 0 : _a.textContent
30202            };
30203            if (getItemProp) {
30204              return getItemProp(nextItem);
30205            }
30206            return nextItem;
30207          },
30208          [id, rowId, trulyDisabled, getItemProp]
30209        );
30210        const onFocusProp = props.onFocus;
30211        const hasFocusedComposite = (0, import_react15.useRef)(false);
30212        const onFocus = useEvent((event) => {
30213          onFocusProp == null ? void 0 : onFocusProp(event);
30214          if (event.defaultPrevented) return;
30215          if (isPortalEvent(event)) return;
30216          if (!id) return;
30217          if (!store2) return;
30218          if (targetIsAnotherItem(event, store2)) return;
30219          const { virtualFocus, baseElement: baseElement2 } = store2.getState();
30220          store2.setActiveId(id);
30221          if (isTextbox(event.currentTarget)) {
30222            selectTextField(event.currentTarget);
30223          }
30224          if (!virtualFocus) return;
30225          if (!isSelfTarget(event)) return;
30226          if (isEditableElement(event.currentTarget)) return;
30227          if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return;
30228          if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) {
30229            event.currentTarget.scrollIntoView({
30230              block: "nearest",
30231              inline: "nearest"
30232            });
30233          }
30234          hasFocusedComposite.current = true;
30235          const fromComposite = event.relatedTarget === baseElement2 || isItem(store2, event.relatedTarget);
30236          if (fromComposite) {
30237            focusSilently(baseElement2);
30238          } else {
30239            baseElement2.focus();
30240          }
30241        });
30242        const onBlurCaptureProp = props.onBlurCapture;
30243        const onBlurCapture = useEvent((event) => {
30244          onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
30245          if (event.defaultPrevented) return;
30246          const state = store2 == null ? void 0 : store2.getState();
30247          if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) {
30248            hasFocusedComposite.current = false;
30249            event.preventDefault();
30250            event.stopPropagation();
30251          }
30252        });
30253        const onKeyDownProp = props.onKeyDown;
30254        const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown);
30255        const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
30256        const onKeyDown = useEvent((event) => {
30257          onKeyDownProp == null ? void 0 : onKeyDownProp(event);
30258          if (event.defaultPrevented) return;
30259          if (!isSelfTarget(event)) return;
30260          if (!store2) return;
30261          const { currentTarget } = event;
30262          const state = store2.getState();
30263          const item = store2.item(id);
30264          const isGrid2 = !!(item == null ? void 0 : item.rowId);
30265          const isVertical = state.orientation !== "horizontal";
30266          const isHorizontal = state.orientation !== "vertical";
30267          const canHomeEnd = () => {
30268            if (isGrid2) return true;
30269            if (isHorizontal) return true;
30270            if (!state.baseElement) return true;
30271            if (!isTextField(state.baseElement)) return true;
30272            return false;
30273          };
30274          const keyMap = {
30275            ArrowUp: (isGrid2 || isVertical) && store2.up,
30276            ArrowRight: (isGrid2 || isHorizontal) && store2.next,
30277            ArrowDown: (isGrid2 || isVertical) && store2.down,
30278            ArrowLeft: (isGrid2 || isHorizontal) && store2.previous,
30279            Home: () => {
30280              if (!canHomeEnd()) return;
30281              if (!isGrid2 || event.ctrlKey) {
30282                return store2 == null ? void 0 : store2.first();
30283              }
30284              return store2 == null ? void 0 : store2.previous(-1);
30285            },
30286            End: () => {
30287              if (!canHomeEnd()) return;
30288              if (!isGrid2 || event.ctrlKey) {
30289                return store2 == null ? void 0 : store2.last();
30290              }
30291              return store2 == null ? void 0 : store2.next(-1);
30292            },
30293            PageUp: () => {
30294              return findNextPageItemId(currentTarget, store2, store2 == null ? void 0 : store2.up, true);
30295            },
30296            PageDown: () => {
30297              return findNextPageItemId(currentTarget, store2, store2 == null ? void 0 : store2.down);
30298            }
30299          };
30300          const action = keyMap[event.key];
30301          if (action) {
30302            if (isTextbox(currentTarget)) {
30303              const selection = getTextboxSelection(currentTarget);
30304              const isLeft = isHorizontal && event.key === "ArrowLeft";
30305              const isRight = isHorizontal && event.key === "ArrowRight";
30306              const isUp = isVertical && event.key === "ArrowUp";
30307              const isDown = isVertical && event.key === "ArrowDown";
30308              if (isRight || isDown) {
30309                const { length: valueLength } = getTextboxValue(currentTarget);
30310                if (selection.end !== valueLength) return;
30311              } else if ((isLeft || isUp) && selection.start !== 0) return;
30312            }
30313            const nextId2 = action();
30314            if (preventScrollOnKeyDownProp(event) || nextId2 !== void 0) {
30315              if (!moveOnKeyPressProp(event)) return;
30316              event.preventDefault();
30317              store2.move(nextId2);
30318            }
30319          }
30320        });
30321        const providerValue = (0, import_react15.useMemo)(
30322          () => ({ id, baseElement }),
30323          [id, baseElement]
30324        );
30325        props = useWrapElement(
30326          props,
30327          (element) => /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
30328          [providerValue]
30329        );
30330        props = {
30331          id,
30332          "data-active-item": isActiveItem || void 0,
30333          ...props,
30334          ref: useMergeRefs(ref, props.ref),
30335          tabIndex: isTabbable ? props.tabIndex : -1,
30336          onFocus,
30337          onBlurCapture,
30338          onKeyDown
30339        };
30340        props = useCommand(props);
30341        props = useCollectionItem({
30342          store: store2,
30343          ...props,
30344          getItem,
30345          shouldRegisterItem: id ? props.shouldRegisterItem : false
30346        });
30347        return removeUndefinedValues({
30348          ...props,
30349          "aria-setsize": ariaSetSize,
30350          "aria-posinset": ariaPosInSet
30351        });
30352      }
30353    );
30354    var CompositeItem = memo22(
30355      forwardRef22(function CompositeItem2(props) {
30356        const htmlProps = useCompositeItem(props);
30357        return createElement5(TagName4, htmlProps);
30358      })
30359    );
30360  
30361    // node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js
30362    function toArray2(arg) {
30363      if (Array.isArray(arg)) {
30364        return arg;
30365      }
30366      return typeof arg !== "undefined" ? [arg] : [];
30367    }
30368    function flatten2DArray(array) {
30369      const flattened = [];
30370      for (const row of array) {
30371        flattened.push(...row);
30372      }
30373      return flattened;
30374    }
30375    function reverseArray(array) {
30376      return array.slice().reverse();
30377    }
30378  
30379    // node_modules/@ariakit/react-core/esm/__chunks/ZMWF7ASR.js
30380    var import_react16 = __toESM(require_react(), 1);
30381    var import_jsx_runtime208 = __toESM(require_jsx_runtime(), 1);
30382    var TagName5 = "div";
30383    function isGrid(items) {
30384      return items.some((item) => !!item.rowId);
30385    }
30386    function isPrintableKey(event) {
30387      const target = event.target;
30388      if (target && !isTextField(target)) return false;
30389      return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
30390    }
30391    function isModifierKey(event) {
30392      return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
30393    }
30394    function useKeyboardEventProxy(store2, onKeyboardEvent, previousElementRef) {
30395      return useEvent((event) => {
30396        var _a;
30397        onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
30398        if (event.defaultPrevented) return;
30399        if (event.isPropagationStopped()) return;
30400        if (!isSelfTarget(event)) return;
30401        if (isModifierKey(event)) return;
30402        if (isPrintableKey(event)) return;
30403        const state = store2.getState();
30404        const activeElement = (_a = getEnabledItem(store2, state.activeId)) == null ? void 0 : _a.element;
30405        if (!activeElement) return;
30406        const { view, ...eventInit } = event;
30407        const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
30408        if (activeElement !== previousElement) {
30409          activeElement.focus();
30410        }
30411        if (!fireKeyboardEvent(activeElement, event.type, eventInit)) {
30412          event.preventDefault();
30413        }
30414        if (event.currentTarget.contains(activeElement)) {
30415          event.stopPropagation();
30416        }
30417      });
30418    }
30419    function findFirstEnabledItemInTheLastRow(items) {
30420      return findFirstEnabledItem(
30421        flatten2DArray(reverseArray(groupItemsByRows(items)))
30422      );
30423    }
30424    function useScheduleFocus(store2) {
30425      const [scheduled, setScheduled] = (0, import_react16.useState)(false);
30426      const schedule2 = (0, import_react16.useCallback)(() => setScheduled(true), []);
30427      const activeItem = store2.useState(
30428        (state) => getEnabledItem(store2, state.activeId)
30429      );
30430      (0, import_react16.useEffect)(() => {
30431        const activeElement = activeItem == null ? void 0 : activeItem.element;
30432        if (!scheduled) return;
30433        if (!activeElement) return;
30434        setScheduled(false);
30435        activeElement.focus({ preventScroll: true });
30436      }, [activeItem, scheduled]);
30437      return schedule2;
30438    }
30439    var useComposite = createHook(
30440      function useComposite2({
30441        store: store2,
30442        composite = true,
30443        focusOnMove = composite,
30444        moveOnKeyPress = true,
30445        ...props
30446      }) {
30447        const context = useCompositeProviderContext();
30448        store2 = store2 || context;
30449        invariant(
30450          store2,
30451          "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."
30452        );
30453        const ref = (0, import_react16.useRef)(null);
30454        const previousElementRef = (0, import_react16.useRef)(null);
30455        const scheduleFocus = useScheduleFocus(store2);
30456        const moves = store2.useState("moves");
30457        const [, setBaseElement] = useTransactionState(
30458          composite ? store2.setBaseElement : null
30459        );
30460        (0, import_react16.useEffect)(() => {
30461          var _a;
30462          if (!store2) return;
30463          if (!moves) return;
30464          if (!composite) return;
30465          if (!focusOnMove) return;
30466          const { activeId: activeId2 } = store2.getState();
30467          const itemElement = (_a = getEnabledItem(store2, activeId2)) == null ? void 0 : _a.element;
30468          if (!itemElement) return;
30469          focusIntoView(itemElement);
30470        }, [store2, moves, composite, focusOnMove]);
30471        useSafeLayoutEffect(() => {
30472          if (!store2) return;
30473          if (!moves) return;
30474          if (!composite) return;
30475          const { baseElement, activeId: activeId2 } = store2.getState();
30476          const isSelfAcive = activeId2 === null;
30477          if (!isSelfAcive) return;
30478          if (!baseElement) return;
30479          const previousElement = previousElementRef.current;
30480          previousElementRef.current = null;
30481          if (previousElement) {
30482            fireBlurEvent(previousElement, { relatedTarget: baseElement });
30483          }
30484          if (!hasFocus(baseElement)) {
30485            baseElement.focus();
30486          }
30487        }, [store2, moves, composite]);
30488        const activeId = store2.useState("activeId");
30489        const virtualFocus = store2.useState("virtualFocus");
30490        useSafeLayoutEffect(() => {
30491          var _a;
30492          if (!store2) return;
30493          if (!composite) return;
30494          if (!virtualFocus) return;
30495          const previousElement = previousElementRef.current;
30496          previousElementRef.current = null;
30497          if (!previousElement) return;
30498          const activeElement = (_a = getEnabledItem(store2, activeId)) == null ? void 0 : _a.element;
30499          const relatedTarget = activeElement || getActiveElement(previousElement);
30500          if (relatedTarget === previousElement) return;
30501          fireBlurEvent(previousElement, { relatedTarget });
30502        }, [store2, activeId, virtualFocus, composite]);
30503        const onKeyDownCapture = useKeyboardEventProxy(
30504          store2,
30505          props.onKeyDownCapture,
30506          previousElementRef
30507        );
30508        const onKeyUpCapture = useKeyboardEventProxy(
30509          store2,
30510          props.onKeyUpCapture,
30511          previousElementRef
30512        );
30513        const onFocusCaptureProp = props.onFocusCapture;
30514        const onFocusCapture = useEvent((event) => {
30515          onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
30516          if (event.defaultPrevented) return;
30517          if (!store2) return;
30518          const { virtualFocus: virtualFocus2 } = store2.getState();
30519          if (!virtualFocus2) return;
30520          const previousActiveElement = event.relatedTarget;
30521          const isSilentlyFocused = silentlyFocused(event.currentTarget);
30522          if (isSelfTarget(event) && isSilentlyFocused) {
30523            event.stopPropagation();
30524            previousElementRef.current = previousActiveElement;
30525          }
30526        });
30527        const onFocusProp = props.onFocus;
30528        const onFocus = useEvent((event) => {
30529          onFocusProp == null ? void 0 : onFocusProp(event);
30530          if (event.defaultPrevented) return;
30531          if (!composite) return;
30532          if (!store2) return;
30533          const { relatedTarget } = event;
30534          const { virtualFocus: virtualFocus2 } = store2.getState();
30535          if (virtualFocus2) {
30536            if (isSelfTarget(event) && !isItem(store2, relatedTarget)) {
30537              queueMicrotask(scheduleFocus);
30538            }
30539          } else if (isSelfTarget(event)) {
30540            store2.setActiveId(null);
30541          }
30542        });
30543        const onBlurCaptureProp = props.onBlurCapture;
30544        const onBlurCapture = useEvent((event) => {
30545          var _a;
30546          onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
30547          if (event.defaultPrevented) return;
30548          if (!store2) return;
30549          const { virtualFocus: virtualFocus2, activeId: activeId2 } = store2.getState();
30550          if (!virtualFocus2) return;
30551          const activeElement = (_a = getEnabledItem(store2, activeId2)) == null ? void 0 : _a.element;
30552          const nextActiveElement = event.relatedTarget;
30553          const nextActiveElementIsItem = isItem(store2, nextActiveElement);
30554          const previousElement = previousElementRef.current;
30555          previousElementRef.current = null;
30556          if (isSelfTarget(event) && nextActiveElementIsItem) {
30557            if (nextActiveElement === activeElement) {
30558              if (previousElement && previousElement !== nextActiveElement) {
30559                fireBlurEvent(previousElement, event);
30560              }
30561            } else if (activeElement) {
30562              fireBlurEvent(activeElement, event);
30563            } else if (previousElement) {
30564              fireBlurEvent(previousElement, event);
30565            }
30566            event.stopPropagation();
30567          } else {
30568            const targetIsItem = isItem(store2, event.target);
30569            if (!targetIsItem && activeElement) {
30570              fireBlurEvent(activeElement, event);
30571            }
30572          }
30573        });
30574        const onKeyDownProp = props.onKeyDown;
30575        const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
30576        const onKeyDown = useEvent((event) => {
30577          var _a;
30578          onKeyDownProp == null ? void 0 : onKeyDownProp(event);
30579          if (event.nativeEvent.isComposing) return;
30580          if (event.defaultPrevented) return;
30581          if (!store2) return;
30582          if (!isSelfTarget(event)) return;
30583          const { orientation, renderedItems, activeId: activeId2 } = store2.getState();
30584          const activeItem = getEnabledItem(store2, activeId2);
30585          if ((_a = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a.isConnected) return;
30586          const isVertical = orientation !== "horizontal";
30587          const isHorizontal = orientation !== "vertical";
30588          const grid = isGrid(renderedItems);
30589          const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
30590          if (isHorizontalKey && isTextField(event.currentTarget)) return;
30591          const up = () => {
30592            if (grid) {
30593              const item = findFirstEnabledItemInTheLastRow(renderedItems);
30594              return item == null ? void 0 : item.id;
30595            }
30596            return store2 == null ? void 0 : store2.last();
30597          };
30598          const keyMap = {
30599            ArrowUp: (grid || isVertical) && up,
30600            ArrowRight: (grid || isHorizontal) && store2.first,
30601            ArrowDown: (grid || isVertical) && store2.first,
30602            ArrowLeft: (grid || isHorizontal) && store2.last,
30603            Home: store2.first,
30604            End: store2.last,
30605            PageUp: store2.first,
30606            PageDown: store2.last
30607          };
30608          const action = keyMap[event.key];
30609          if (action) {
30610            const id = action();
30611            if (id !== void 0) {
30612              if (!moveOnKeyPressProp(event)) return;
30613              event.preventDefault();
30614              store2.move(id);
30615            }
30616          }
30617        });
30618        props = useWrapElement(
30619          props,
30620          (element) => /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(CompositeContextProvider, { value: store2, children: element }),
30621          [store2]
30622        );
30623        const activeDescendant = store2.useState((state) => {
30624          var _a;
30625          if (!store2) return;
30626          if (!composite) return;
30627          if (!state.virtualFocus) return;
30628          return (_a = getEnabledItem(store2, state.activeId)) == null ? void 0 : _a.id;
30629        });
30630        props = {
30631          "aria-activedescendant": activeDescendant,
30632          ...props,
30633          ref: useMergeRefs(ref, setBaseElement, props.ref),
30634          onKeyDownCapture,
30635          onKeyUpCapture,
30636          onFocusCapture,
30637          onFocus,
30638          onBlurCapture,
30639          onKeyDown
30640        };
30641        const focusable = store2.useState(
30642          (state) => composite && (state.virtualFocus || state.activeId === null)
30643        );
30644        props = useFocusable({ focusable, ...props });
30645        return props;
30646      }
30647    );
30648    var Composite6 = forwardRef22(function Composite22(props) {
30649      const htmlProps = useComposite(props);
30650      return createElement5(TagName5, htmlProps);
30651    });
30652  
30653    // node_modules/@ariakit/react-core/esm/__chunks/LVDQFHCH.js
30654    var ctx4 = createStoreContext();
30655    var useDisclosureContext = ctx4.useContext;
30656    var useDisclosureScopedContext = ctx4.useScopedContext;
30657    var useDisclosureProviderContext = ctx4.useProviderContext;
30658    var DisclosureContextProvider = ctx4.ContextProvider;
30659    var DisclosureScopedContextProvider = ctx4.ScopedContextProvider;
30660  
30661    // node_modules/@ariakit/react-core/esm/__chunks/A62MDFCW.js
30662    var import_react17 = __toESM(require_react(), 1);
30663    var ctx5 = createStoreContext(
30664      [DisclosureContextProvider],
30665      [DisclosureScopedContextProvider]
30666    );
30667    var useDialogContext = ctx5.useContext;
30668    var useDialogScopedContext = ctx5.useScopedContext;
30669    var useDialogProviderContext = ctx5.useProviderContext;
30670    var DialogContextProvider = ctx5.ContextProvider;
30671    var DialogScopedContextProvider = ctx5.ScopedContextProvider;
30672    var DialogHeadingContext = (0, import_react17.createContext)(void 0);
30673    var DialogDescriptionContext = (0, import_react17.createContext)(void 0);
30674  
30675    // node_modules/@ariakit/react-core/esm/__chunks/6B3RXHKP.js
30676    var import_react18 = __toESM(require_react(), 1);
30677    var import_react_dom2 = __toESM(require_react_dom(), 1);
30678    var import_jsx_runtime209 = __toESM(require_jsx_runtime(), 1);
30679    var TagName6 = "div";
30680    function afterTimeout(timeoutMs, cb) {
30681      const timeoutId = setTimeout(cb, timeoutMs);
30682      return () => clearTimeout(timeoutId);
30683    }
30684    function afterPaint2(cb) {
30685      let raf2 = requestAnimationFrame(() => {
30686        raf2 = requestAnimationFrame(cb);
30687      });
30688      return () => cancelAnimationFrame(raf2);
30689    }
30690    function parseCSSTime(...times) {
30691      return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => {
30692        const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3;
30693        const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier;
30694        if (currentTime > longestTime) return currentTime;
30695        return longestTime;
30696      }, 0);
30697    }
30698    function isHidden(mounted, hidden, alwaysVisible) {
30699      return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
30700    }
30701    var useDisclosureContent = createHook(function useDisclosureContent2({ store: store2, alwaysVisible, ...props }) {
30702      const context = useDisclosureProviderContext();
30703      store2 = store2 || context;
30704      invariant(
30705        store2,
30706        "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component."
30707      );
30708      const ref = (0, import_react18.useRef)(null);
30709      const id = useId5(props.id);
30710      const [transition, setTransition] = (0, import_react18.useState)(null);
30711      const open = store2.useState("open");
30712      const mounted = store2.useState("mounted");
30713      const animated2 = store2.useState("animated");
30714      const contentElement = store2.useState("contentElement");
30715      const otherElement = useStoreState(store2.disclosure, "contentElement");
30716      useSafeLayoutEffect(() => {
30717        if (!ref.current) return;
30718        store2 == null ? void 0 : store2.setContentElement(ref.current);
30719      }, [store2]);
30720      useSafeLayoutEffect(() => {
30721        let previousAnimated;
30722        store2 == null ? void 0 : store2.setState("animated", (animated22) => {
30723          previousAnimated = animated22;
30724          return true;
30725        });
30726        return () => {
30727          if (previousAnimated === void 0) return;
30728          store2 == null ? void 0 : store2.setState("animated", previousAnimated);
30729        };
30730      }, [store2]);
30731      useSafeLayoutEffect(() => {
30732        if (!animated2) return;
30733        if (!(contentElement == null ? void 0 : contentElement.isConnected)) {
30734          setTransition(null);
30735          return;
30736        }
30737        return afterPaint2(() => {
30738          setTransition(open ? "enter" : mounted ? "leave" : null);
30739        });
30740      }, [animated2, contentElement, open, mounted]);
30741      useSafeLayoutEffect(() => {
30742        if (!store2) return;
30743        if (!animated2) return;
30744        if (!transition) return;
30745        if (!contentElement) return;
30746        const stopAnimation = () => store2 == null ? void 0 : store2.setState("animating", false);
30747        const stopAnimationSync = () => (0, import_react_dom2.flushSync)(stopAnimation);
30748        if (transition === "leave" && open) return;
30749        if (transition === "enter" && !open) return;
30750        if (typeof animated2 === "number") {
30751          const timeout2 = animated2;
30752          return afterTimeout(timeout2, stopAnimationSync);
30753        }
30754        const {
30755          transitionDuration,
30756          animationDuration,
30757          transitionDelay,
30758          animationDelay
30759        } = getComputedStyle(contentElement);
30760        const {
30761          transitionDuration: transitionDuration2 = "0",
30762          animationDuration: animationDuration2 = "0",
30763          transitionDelay: transitionDelay2 = "0",
30764          animationDelay: animationDelay2 = "0"
30765        } = otherElement ? getComputedStyle(otherElement) : {};
30766        const delay = parseCSSTime(
30767          transitionDelay,
30768          animationDelay,
30769          transitionDelay2,
30770          animationDelay2
30771        );
30772        const duration = parseCSSTime(
30773          transitionDuration,
30774          animationDuration,
30775          transitionDuration2,
30776          animationDuration2
30777        );
30778        const timeout = delay + duration;
30779        if (!timeout) {
30780          if (transition === "enter") {
30781            store2.setState("animated", false);
30782          }
30783          stopAnimation();
30784          return;
30785        }
30786        const frameRate = 1e3 / 60;
30787        const maxTimeout = Math.max(timeout - frameRate, 0);
30788        return afterTimeout(maxTimeout, stopAnimationSync);
30789      }, [store2, animated2, contentElement, otherElement, open, transition]);
30790      props = useWrapElement(
30791        props,
30792        (element) => /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(DialogScopedContextProvider, { value: store2, children: element }),
30793        [store2]
30794      );
30795      const hidden = isHidden(mounted, props.hidden, alwaysVisible);
30796      const styleProp = props.style;
30797      const style = (0, import_react18.useMemo)(() => {
30798        if (hidden) {
30799          return { ...styleProp, display: "none" };
30800        }
30801        return styleProp;
30802      }, [hidden, styleProp]);
30803      props = {
30804        id,
30805        "data-open": open || void 0,
30806        "data-enter": transition === "enter" || void 0,
30807        "data-leave": transition === "leave" || void 0,
30808        hidden,
30809        ...props,
30810        ref: useMergeRefs(id ? store2.setContentElement : null, ref, props.ref),
30811        style
30812      };
30813      return removeUndefinedValues(props);
30814    });
30815    var DisclosureContentImpl = forwardRef22(function DisclosureContentImpl2(props) {
30816      const htmlProps = useDisclosureContent(props);
30817      return createElement5(TagName6, htmlProps);
30818    });
30819    var DisclosureContent = forwardRef22(function DisclosureContent2({
30820      unmountOnHide,
30821      ...props
30822    }) {
30823      const context = useDisclosureProviderContext();
30824      const store2 = props.store || context;
30825      const mounted = useStoreState(
30826        store2,
30827        (state) => !unmountOnHide || (state == null ? void 0 : state.mounted)
30828      );
30829      if (mounted === false) return null;
30830      return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(DisclosureContentImpl, { ...props });
30831    });
30832  
30833    // node_modules/@ariakit/core/esm/__chunks/75BJEVSH.js
30834    function createDisclosureStore(props = {}) {
30835      const store2 = mergeStore(
30836        props.store,
30837        omit2(props.disclosure, ["contentElement", "disclosureElement"])
30838      );
30839      throwOnConflictingProps(props, store2);
30840      const syncState = store2 == null ? void 0 : store2.getState();
30841      const open = defaultValue(
30842        props.open,
30843        syncState == null ? void 0 : syncState.open,
30844        props.defaultOpen,
30845        false
30846      );
30847      const animated2 = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
30848      const initialState = {
30849        open,
30850        animated: animated2,
30851        animating: !!animated2 && open,
30852        mounted: open,
30853        contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
30854        disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
30855      };
30856      const disclosure = createStore(initialState, store2);
30857      setup(
30858        disclosure,
30859        () => sync2(disclosure, ["animated", "animating"], (state) => {
30860          if (state.animated) return;
30861          disclosure.setState("animating", false);
30862        })
30863      );
30864      setup(
30865        disclosure,
30866        () => subscribe(disclosure, ["open"], () => {
30867          if (!disclosure.getState().animated) return;
30868          disclosure.setState("animating", true);
30869        })
30870      );
30871      setup(
30872        disclosure,
30873        () => sync2(disclosure, ["open", "animating"], (state) => {
30874          disclosure.setState("mounted", state.open || state.animating);
30875        })
30876      );
30877      return {
30878        ...disclosure,
30879        disclosure: props.disclosure,
30880        setOpen: (value) => disclosure.setState("open", value),
30881        show: () => disclosure.setState("open", true),
30882        hide: () => disclosure.setState("open", false),
30883        toggle: () => disclosure.setState("open", (open2) => !open2),
30884        stopAnimation: () => disclosure.setState("animating", false),
30885        setContentElement: (value) => disclosure.setState("contentElement", value),
30886        setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
30887      };
30888    }
30889  
30890    // node_modules/@ariakit/react-core/esm/__chunks/WLZ6H5FH.js
30891    function useDisclosureStoreProps(store2, update4, props) {
30892      useUpdateEffect(update4, [props.store, props.disclosure]);
30893      useStoreProps(store2, props, "open", "setOpen");
30894      useStoreProps(store2, props, "mounted", "setMounted");
30895      useStoreProps(store2, props, "animated");
30896      return Object.assign(store2, { disclosure: props.disclosure });
30897    }
30898  
30899    // node_modules/@ariakit/react-core/esm/__chunks/JMU4N4M5.js
30900    var ctx6 = createStoreContext(
30901      [DialogContextProvider],
30902      [DialogScopedContextProvider]
30903    );
30904    var usePopoverContext = ctx6.useContext;
30905    var usePopoverScopedContext = ctx6.useScopedContext;
30906    var usePopoverProviderContext = ctx6.useProviderContext;
30907    var PopoverContextProvider = ctx6.ContextProvider;
30908    var PopoverScopedContextProvider = ctx6.ScopedContextProvider;
30909  
30910    // node_modules/@ariakit/core/esm/__chunks/N5XGANPW.js
30911    function getCommonParent(items) {
30912      var _a;
30913      const firstItem = items.find((item) => !!item.element);
30914      const lastItem = [...items].reverse().find((item) => !!item.element);
30915      let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
30916      while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
30917        const parent = parentElement;
30918        if (lastItem && parent.contains(lastItem.element)) {
30919          return parentElement;
30920        }
30921        parentElement = parentElement.parentElement;
30922      }
30923      return getDocument(parentElement).body;
30924    }
30925    function getPrivateStore(store2) {
30926      return store2 == null ? void 0 : store2.__unstablePrivateStore;
30927    }
30928    function createCollectionStore(props = {}) {
30929      var _a;
30930      throwOnConflictingProps(props, props.store);
30931      const syncState = (_a = props.store) == null ? void 0 : _a.getState();
30932      const items = defaultValue(
30933        props.items,
30934        syncState == null ? void 0 : syncState.items,
30935        props.defaultItems,
30936        []
30937      );
30938      const itemsMap = new Map(items.map((item) => [item.id, item]));
30939      const initialState = {
30940        items,
30941        renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
30942      };
30943      const syncPrivateStore = getPrivateStore(props.store);
30944      const privateStore = createStore(
30945        { items, renderedItems: initialState.renderedItems },
30946        syncPrivateStore
30947      );
30948      const collection = createStore(initialState, props.store);
30949      const sortItems = (renderedItems) => {
30950        const sortedItems = sortBasedOnDOMPosition(renderedItems, (i2) => i2.element);
30951        privateStore.setState("renderedItems", sortedItems);
30952        collection.setState("renderedItems", sortedItems);
30953      };
30954      setup(collection, () => init(privateStore));
30955      setup(privateStore, () => {
30956        return batch(privateStore, ["items"], (state) => {
30957          collection.setState("items", state.items);
30958        });
30959      });
30960      setup(privateStore, () => {
30961        return batch(privateStore, ["renderedItems"], (state) => {
30962          let firstRun = true;
30963          let raf2 = requestAnimationFrame(() => {
30964            const { renderedItems } = collection.getState();
30965            if (state.renderedItems === renderedItems) return;
30966            sortItems(state.renderedItems);
30967          });
30968          if (typeof IntersectionObserver !== "function") {
30969            return () => cancelAnimationFrame(raf2);
30970          }
30971          const ioCallback = () => {
30972            if (firstRun) {
30973              firstRun = false;
30974              return;
30975            }
30976            cancelAnimationFrame(raf2);
30977            raf2 = requestAnimationFrame(() => sortItems(state.renderedItems));
30978          };
30979          const root = getCommonParent(state.renderedItems);
30980          const observer = new IntersectionObserver(ioCallback, { root });
30981          for (const item of state.renderedItems) {
30982            if (!item.element) continue;
30983            observer.observe(item.element);
30984          }
30985          return () => {
30986            cancelAnimationFrame(raf2);
30987            observer.disconnect();
30988          };
30989        });
30990      });
30991      const mergeItem = (item, setItems, canDeleteFromMap = false) => {
30992        let prevItem;
30993        setItems((items2) => {
30994          const index = items2.findIndex(({ id }) => id === item.id);
30995          const nextItems = items2.slice();
30996          if (index !== -1) {
30997            prevItem = items2[index];
30998            const nextItem = { ...prevItem, ...item };
30999            nextItems[index] = nextItem;
31000            itemsMap.set(item.id, nextItem);
31001          } else {
31002            nextItems.push(item);
31003            itemsMap.set(item.id, item);
31004          }
31005          return nextItems;
31006        });
31007        const unmergeItem = () => {
31008          setItems((items2) => {
31009            if (!prevItem) {
31010              if (canDeleteFromMap) {
31011                itemsMap.delete(item.id);
31012              }
31013              return items2.filter(({ id }) => id !== item.id);
31014            }
31015            const index = items2.findIndex(({ id }) => id === item.id);
31016            if (index === -1) return items2;
31017            const nextItems = items2.slice();
31018            nextItems[index] = prevItem;
31019            itemsMap.set(item.id, prevItem);
31020            return nextItems;
31021          });
31022        };
31023        return unmergeItem;
31024      };
31025      const registerItem = (item) => mergeItem(
31026        item,
31027        (getItems) => privateStore.setState("items", getItems),
31028        true
31029      );
31030      return {
31031        ...collection,
31032        registerItem,
31033        renderItem: (item) => chain(
31034          registerItem(item),
31035          mergeItem(
31036            item,
31037            (getItems) => privateStore.setState("renderedItems", getItems)
31038          )
31039        ),
31040        item: (id) => {
31041          if (!id) return null;
31042          let item = itemsMap.get(id);
31043          if (!item) {
31044            const { items: items2 } = privateStore.getState();
31045            item = items2.find((item2) => item2.id === id);
31046            if (item) {
31047              itemsMap.set(id, item);
31048            }
31049          }
31050          return item || null;
31051        },
31052        // @ts-expect-error Internal
31053        __unstablePrivateStore: privateStore
31054      };
31055    }
31056  
31057    // node_modules/@ariakit/react-core/esm/__chunks/GVAFFF2B.js
31058    function useCollectionStoreProps(store2, update4, props) {
31059      useUpdateEffect(update4, [props.store]);
31060      useStoreProps(store2, props, "items", "setItems");
31061      return store2;
31062    }
31063  
31064    // node_modules/@ariakit/core/esm/__chunks/RVTIKFRL.js
31065    var NULL_ITEM = { id: null };
31066    function findFirstEnabledItem2(items, excludeId) {
31067      return items.find((item) => {
31068        if (excludeId) {
31069          return !item.disabled && item.id !== excludeId;
31070        }
31071        return !item.disabled;
31072      });
31073    }
31074    function getEnabledItems(items, excludeId) {
31075      return items.filter((item) => {
31076        if (excludeId) {
31077          return !item.disabled && item.id !== excludeId;
31078        }
31079        return !item.disabled;
31080      });
31081    }
31082    function getItemsInRow(items, rowId) {
31083      return items.filter((item) => item.rowId === rowId);
31084    }
31085    function flipItems(items, activeId, shouldInsertNullItem = false) {
31086      const index = items.findIndex((item) => item.id === activeId);
31087      return [
31088        ...items.slice(index + 1),
31089        ...shouldInsertNullItem ? [NULL_ITEM] : [],
31090        ...items.slice(0, index)
31091      ];
31092    }
31093    function groupItemsByRows2(items) {
31094      const rows = [];
31095      for (const item of items) {
31096        const row = rows.find((currentRow) => {
31097          var _a;
31098          return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
31099        });
31100        if (row) {
31101          row.push(item);
31102        } else {
31103          rows.push([item]);
31104        }
31105      }
31106      return rows;
31107    }
31108    function getMaxRowLength(array) {
31109      let maxLength = 0;
31110      for (const { length } of array) {
31111        if (length > maxLength) {
31112          maxLength = length;
31113        }
31114      }
31115      return maxLength;
31116    }
31117    function createEmptyItem(rowId) {
31118      return {
31119        id: "__EMPTY_ITEM__",
31120        disabled: true,
31121        rowId
31122      };
31123    }
31124    function normalizeRows(rows, activeId, focusShift) {
31125      const maxLength = getMaxRowLength(rows);
31126      for (const row of rows) {
31127        for (let i2 = 0; i2 < maxLength; i2 += 1) {
31128          const item = row[i2];
31129          if (!item || focusShift && item.disabled) {
31130            const isFirst = i2 === 0;
31131            const previousItem = isFirst && focusShift ? findFirstEnabledItem2(row) : row[i2 - 1];
31132            row[i2] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
31133          }
31134        }
31135      }
31136      return rows;
31137    }
31138    function verticalizeItems(items) {
31139      const rows = groupItemsByRows2(items);
31140      const maxLength = getMaxRowLength(rows);
31141      const verticalized = [];
31142      for (let i2 = 0; i2 < maxLength; i2 += 1) {
31143        for (const row of rows) {
31144          const item = row[i2];
31145          if (item) {
31146            verticalized.push({
31147              ...item,
31148              // If there's no rowId, it means that it's not a grid composite, but
31149              // a single row instead. So, instead of verticalizing it, that is,
31150              // assigning a different rowId based on the column index, we keep it
31151              // undefined so they will be part of the same row. This is useful
31152              // when using up/down on one-dimensional composites.
31153              rowId: item.rowId ? `$i2}` : void 0
31154            });
31155          }
31156        }
31157      }
31158      return verticalized;
31159    }
31160    function createCompositeStore(props = {}) {
31161      var _a;
31162      const syncState = (_a = props.store) == null ? void 0 : _a.getState();
31163      const collection = createCollectionStore(props);
31164      const activeId = defaultValue(
31165        props.activeId,
31166        syncState == null ? void 0 : syncState.activeId,
31167        props.defaultActiveId
31168      );
31169      const initialState = {
31170        ...collection.getState(),
31171        id: defaultValue(
31172          props.id,
31173          syncState == null ? void 0 : syncState.id,
31174          `id-$Math.random().toString(36).slice(2, 8)}`
31175        ),
31176        activeId,
31177        baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
31178        includesBaseElement: defaultValue(
31179          props.includesBaseElement,
31180          syncState == null ? void 0 : syncState.includesBaseElement,
31181          activeId === null
31182        ),
31183        moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
31184        orientation: defaultValue(
31185          props.orientation,
31186          syncState == null ? void 0 : syncState.orientation,
31187          "both"
31188        ),
31189        rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
31190        virtualFocus: defaultValue(
31191          props.virtualFocus,
31192          syncState == null ? void 0 : syncState.virtualFocus,
31193          false
31194        ),
31195        focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
31196        focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
31197        focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
31198      };
31199      const composite = createStore(initialState, collection, props.store);
31200      setup(
31201        composite,
31202        () => sync2(composite, ["renderedItems", "activeId"], (state) => {
31203          composite.setState("activeId", (activeId2) => {
31204            var _a2;
31205            if (activeId2 !== void 0) return activeId2;
31206            return (_a2 = findFirstEnabledItem2(state.renderedItems)) == null ? void 0 : _a2.id;
31207          });
31208        })
31209      );
31210      const getNextId = (direction = "next", options = {}) => {
31211        var _a2, _b;
31212        const defaultState = composite.getState();
31213        const {
31214          skip = 0,
31215          activeId: activeId2 = defaultState.activeId,
31216          focusShift = defaultState.focusShift,
31217          focusLoop = defaultState.focusLoop,
31218          focusWrap = defaultState.focusWrap,
31219          includesBaseElement = defaultState.includesBaseElement,
31220          renderedItems = defaultState.renderedItems,
31221          rtl = defaultState.rtl
31222        } = options;
31223        const isVerticalDirection = direction === "up" || direction === "down";
31224        const isNextDirection = direction === "next" || direction === "down";
31225        const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection;
31226        const canShift = focusShift && !skip;
31227        let items = !isVerticalDirection ? renderedItems : flatten2DArray(
31228          normalizeRows(groupItemsByRows2(renderedItems), activeId2, canShift)
31229        );
31230        items = canReverse ? reverseArray(items) : items;
31231        items = isVerticalDirection ? verticalizeItems(items) : items;
31232        if (activeId2 == null) {
31233          return (_a2 = findFirstEnabledItem2(items)) == null ? void 0 : _a2.id;
31234        }
31235        const activeItem = items.find((item) => item.id === activeId2);
31236        if (!activeItem) {
31237          return (_b = findFirstEnabledItem2(items)) == null ? void 0 : _b.id;
31238        }
31239        const isGrid2 = items.some((item) => item.rowId);
31240        const activeIndex = items.indexOf(activeItem);
31241        const nextItems = items.slice(activeIndex + 1);
31242        const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
31243        if (skip) {
31244          const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
31245          const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
31246          nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
31247          return nextItem2 == null ? void 0 : nextItem2.id;
31248        }
31249        const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
31250        const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
31251        const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
31252        if (canLoop) {
31253          const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId);
31254          const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
31255          const nextItem2 = findFirstEnabledItem2(sortedItems, activeId2);
31256          return nextItem2 == null ? void 0 : nextItem2.id;
31257        }
31258        if (canWrap) {
31259          const nextItem2 = findFirstEnabledItem2(
31260            // We can use nextItems, which contains all the next items, including
31261            // items from other rows, to wrap between rows. However, if there is a
31262            // null item (the composite container), we'll only use the next items in
31263            // the row. So moving next from the last item will focus on the
31264            // composite container. On grid composites, horizontal navigation never
31265            // focuses on the composite container, only vertical.
31266            hasNullItem ? nextItemsInRow : nextItems,
31267            activeId2
31268          );
31269          const nextId2 = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
31270          return nextId2;
31271        }
31272        const nextItem = findFirstEnabledItem2(nextItemsInRow, activeId2);
31273        if (!nextItem && hasNullItem) {
31274          return null;
31275        }
31276        return nextItem == null ? void 0 : nextItem.id;
31277      };
31278      return {
31279        ...collection,
31280        ...composite,
31281        setBaseElement: (element) => composite.setState("baseElement", element),
31282        setActiveId: (id) => composite.setState("activeId", id),
31283        move: (id) => {
31284          if (id === void 0) return;
31285          composite.setState("activeId", id);
31286          composite.setState("moves", (moves) => moves + 1);
31287        },
31288        first: () => {
31289          var _a2;
31290          return (_a2 = findFirstEnabledItem2(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
31291        },
31292        last: () => {
31293          var _a2;
31294          return (_a2 = findFirstEnabledItem2(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
31295        },
31296        next: (options) => {
31297          if (options !== void 0 && typeof options === "number") {
31298            options = { skip: options };
31299          }
31300          return getNextId("next", options);
31301        },
31302        previous: (options) => {
31303          if (options !== void 0 && typeof options === "number") {
31304            options = { skip: options };
31305          }
31306          return getNextId("previous", options);
31307        },
31308        down: (options) => {
31309          if (options !== void 0 && typeof options === "number") {
31310            options = { skip: options };
31311          }
31312          return getNextId("down", options);
31313        },
31314        up: (options) => {
31315          if (options !== void 0 && typeof options === "number") {
31316            options = { skip: options };
31317          }
31318          return getNextId("up", options);
31319        }
31320      };
31321    }
31322  
31323    // node_modules/@ariakit/react-core/esm/__chunks/IQYAUKXT.js
31324    function useCompositeStoreOptions(props) {
31325      const id = useId5(props.id);
31326      return { id, ...props };
31327    }
31328    function useCompositeStoreProps(store2, update4, props) {
31329      store2 = useCollectionStoreProps(store2, update4, props);
31330      useStoreProps(store2, props, "activeId", "setActiveId");
31331      useStoreProps(store2, props, "includesBaseElement");
31332      useStoreProps(store2, props, "virtualFocus");
31333      useStoreProps(store2, props, "orientation");
31334      useStoreProps(store2, props, "rtl");
31335      useStoreProps(store2, props, "focusLoop");
31336      useStoreProps(store2, props, "focusWrap");
31337      useStoreProps(store2, props, "focusShift");
31338      return store2;
31339    }
31340  
31341    // node_modules/@ariakit/react-core/esm/__chunks/CVCFNOHX.js
31342    var import_react19 = __toESM(require_react(), 1);
31343    var ComboboxListRoleContext = (0, import_react19.createContext)(
31344      void 0
31345    );
31346    var ctx7 = createStoreContext(
31347      [PopoverContextProvider, CompositeContextProvider],
31348      [PopoverScopedContextProvider, CompositeScopedContextProvider]
31349    );
31350    var useComboboxContext = ctx7.useContext;
31351    var useComboboxScopedContext = ctx7.useScopedContext;
31352    var useComboboxProviderContext = ctx7.useProviderContext;
31353    var ComboboxContextProvider = ctx7.ContextProvider;
31354    var ComboboxScopedContextProvider = ctx7.ScopedContextProvider;
31355    var ComboboxItemValueContext = (0, import_react19.createContext)(
31356      void 0
31357    );
31358    var ComboboxItemCheckedContext = (0, import_react19.createContext)(false);
31359  
31360    // node_modules/@ariakit/core/esm/__chunks/KMAUV3TY.js
31361    function createDialogStore(props = {}) {
31362      return createDisclosureStore(props);
31363    }
31364  
31365    // node_modules/@ariakit/react-core/esm/__chunks/4NYSH4UO.js
31366    function useDialogStoreProps(store2, update4, props) {
31367      return useDisclosureStoreProps(store2, update4, props);
31368    }
31369  
31370    // node_modules/@ariakit/core/esm/__chunks/BFGNM53A.js
31371    function createPopoverStore({
31372      popover: otherPopover,
31373      ...props
31374    } = {}) {
31375      const store2 = mergeStore(
31376        props.store,
31377        omit2(otherPopover, [
31378          "arrowElement",
31379          "anchorElement",
31380          "contentElement",
31381          "popoverElement",
31382          "disclosureElement"
31383        ])
31384      );
31385      throwOnConflictingProps(props, store2);
31386      const syncState = store2 == null ? void 0 : store2.getState();
31387      const dialog = createDialogStore({ ...props, store: store2 });
31388      const placement = defaultValue(
31389        props.placement,
31390        syncState == null ? void 0 : syncState.placement,
31391        "bottom"
31392      );
31393      const initialState = {
31394        ...dialog.getState(),
31395        placement,
31396        currentPlacement: placement,
31397        anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
31398        popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
31399        arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
31400        rendered: /* @__PURE__ */ Symbol("rendered")
31401      };
31402      const popover = createStore(initialState, dialog, store2);
31403      return {
31404        ...dialog,
31405        ...popover,
31406        setAnchorElement: (element) => popover.setState("anchorElement", element),
31407        setPopoverElement: (element) => popover.setState("popoverElement", element),
31408        setArrowElement: (element) => popover.setState("arrowElement", element),
31409        render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered"))
31410      };
31411    }
31412  
31413    // node_modules/@ariakit/react-core/esm/__chunks/B6FLPFJM.js
31414    function usePopoverStoreProps(store2, update4, props) {
31415      useUpdateEffect(update4, [props.popover]);
31416      useStoreProps(store2, props, "placement");
31417      return useDialogStoreProps(store2, update4, props);
31418    }
31419  
31420    // node_modules/@ariakit/react-core/esm/__chunks/4POTBZ2J.js
31421    var TagName7 = "div";
31422    var usePopoverAnchor = createHook(
31423      function usePopoverAnchor2({ store: store2, ...props }) {
31424        const context = usePopoverProviderContext();
31425        store2 = store2 || context;
31426        props = {
31427          ...props,
31428          ref: useMergeRefs(store2 == null ? void 0 : store2.setAnchorElement, props.ref)
31429        };
31430        return props;
31431      }
31432    );
31433    var PopoverAnchor = forwardRef22(function PopoverAnchor2(props) {
31434      const htmlProps = usePopoverAnchor(props);
31435      return createElement5(TagName7, htmlProps);
31436    });
31437  
31438    // node_modules/@ariakit/react-core/esm/__chunks/X6LNAU2F.js
31439    var import_react20 = __toESM(require_react(), 1);
31440    var TagName8 = "div";
31441    function getMouseDestination(event) {
31442      const relatedTarget = event.relatedTarget;
31443      if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
31444        return relatedTarget;
31445      }
31446      return null;
31447    }
31448    function hoveringInside(event) {
31449      const nextElement = getMouseDestination(event);
31450      if (!nextElement) return false;
31451      return contains(event.currentTarget, nextElement);
31452    }
31453    var symbol2 = /* @__PURE__ */ Symbol("composite-hover");
31454    function movingToAnotherItem(event) {
31455      let dest = getMouseDestination(event);
31456      if (!dest) return false;
31457      do {
31458        if (hasOwnProperty(dest, symbol2) && dest[symbol2]) return true;
31459        dest = dest.parentElement;
31460      } while (dest);
31461      return false;
31462    }
31463    var useCompositeHover = createHook(
31464      function useCompositeHover2({
31465        store: store2,
31466        focusOnHover = true,
31467        blurOnHoverEnd = !!focusOnHover,
31468        ...props
31469      }) {
31470        const context = useCompositeContext();
31471        store2 = store2 || context;
31472        invariant(
31473          store2,
31474          "CompositeHover must be wrapped in a Composite component."
31475        );
31476        const isMouseMoving = useIsMouseMoving();
31477        const onMouseMoveProp = props.onMouseMove;
31478        const focusOnHoverProp = useBooleanEvent(focusOnHover);
31479        const onMouseMove = useEvent((event) => {
31480          onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
31481          if (event.defaultPrevented) return;
31482          if (!isMouseMoving()) return;
31483          if (!focusOnHoverProp(event)) return;
31484          if (!hasFocusWithin(event.currentTarget)) {
31485            const baseElement = store2 == null ? void 0 : store2.getState().baseElement;
31486            if (baseElement && !hasFocus(baseElement)) {
31487              baseElement.focus();
31488            }
31489          }
31490          store2 == null ? void 0 : store2.setActiveId(event.currentTarget.id);
31491        });
31492        const onMouseLeaveProp = props.onMouseLeave;
31493        const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
31494        const onMouseLeave = useEvent((event) => {
31495          var _a;
31496          onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
31497          if (event.defaultPrevented) return;
31498          if (!isMouseMoving()) return;
31499          if (hoveringInside(event)) return;
31500          if (movingToAnotherItem(event)) return;
31501          if (!focusOnHoverProp(event)) return;
31502          if (!blurOnHoverEndProp(event)) return;
31503          store2 == null ? void 0 : store2.setActiveId(null);
31504          (_a = store2 == null ? void 0 : store2.getState().baseElement) == null ? void 0 : _a.focus();
31505        });
31506        const ref = (0, import_react20.useCallback)((element) => {
31507          if (!element) return;
31508          element[symbol2] = true;
31509        }, []);
31510        props = {
31511          ...props,
31512          ref: useMergeRefs(ref, props.ref),
31513          onMouseMove,
31514          onMouseLeave
31515        };
31516        return removeUndefinedValues(props);
31517      }
31518    );
31519    var CompositeHover = memo22(
31520      forwardRef22(function CompositeHover2(props) {
31521        const htmlProps = useCompositeHover(props);
31522        return createElement5(TagName8, htmlProps);
31523      })
31524    );
31525  
31526    // node_modules/@ariakit/react-core/esm/combobox/combobox.js
31527    var import_react21 = __toESM(require_react(), 1);
31528    var TagName9 = "input";
31529    function isFirstItemAutoSelected(items, activeValue, autoSelect) {
31530      if (!autoSelect) return false;
31531      const firstItem = items.find((item) => !item.disabled && item.value);
31532      return (firstItem == null ? void 0 : firstItem.value) === activeValue;
31533    }
31534    function hasCompletionString(value, activeValue) {
31535      if (!activeValue) return false;
31536      if (value == null) return false;
31537      value = normalizeString2(value);
31538      return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0;
31539    }
31540    function isInputEvent(event) {
31541      return event.type === "input";
31542    }
31543    function isAriaAutoCompleteValue(value) {
31544      return value === "inline" || value === "list" || value === "both" || value === "none";
31545    }
31546    function getDefaultAutoSelectId(items) {
31547      const item = items.find((item2) => {
31548        var _a;
31549        if (item2.disabled) return false;
31550        return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab";
31551      });
31552      return item == null ? void 0 : item.id;
31553    }
31554    var useCombobox = createHook(
31555      function useCombobox2({
31556        store: store2,
31557        focusable = true,
31558        autoSelect: autoSelectProp = false,
31559        getAutoSelectId,
31560        setValueOnChange,
31561        showMinLength = 0,
31562        showOnChange,
31563        showOnMouseDown,
31564        showOnClick = showOnMouseDown,
31565        showOnKeyDown,
31566        showOnKeyPress = showOnKeyDown,
31567        blurActiveItemOnClick,
31568        setValueOnClick = true,
31569        moveOnKeyPress = true,
31570        autoComplete = "list",
31571        ...props
31572      }) {
31573        const context = useComboboxProviderContext();
31574        store2 = store2 || context;
31575        invariant(
31576          store2,
31577          "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component."
31578        );
31579        const ref = (0, import_react21.useRef)(null);
31580        const [valueUpdated, forceValueUpdate] = useForceUpdate2();
31581        const canAutoSelectRef = (0, import_react21.useRef)(false);
31582        const composingRef = (0, import_react21.useRef)(false);
31583        const autoSelect = store2.useState(
31584          (state) => state.virtualFocus && autoSelectProp
31585        );
31586        const inline = autoComplete === "inline" || autoComplete === "both";
31587        const [canInline, setCanInline] = (0, import_react21.useState)(inline);
31588        useUpdateLayoutEffect(() => {
31589          if (!inline) return;
31590          setCanInline(true);
31591        }, [inline]);
31592        const storeValue = store2.useState("value");
31593        const prevSelectedValueRef = (0, import_react21.useRef)(void 0);
31594        (0, import_react21.useEffect)(() => {
31595          return sync2(store2, ["selectedValue", "activeId"], (_, prev) => {
31596            prevSelectedValueRef.current = prev.selectedValue;
31597          });
31598        }, []);
31599        const inlineActiveValue = store2.useState((state) => {
31600          var _a;
31601          if (!inline) return;
31602          if (!canInline) return;
31603          if (state.activeValue && Array.isArray(state.selectedValue)) {
31604            if (state.selectedValue.includes(state.activeValue)) return;
31605            if ((_a = prevSelectedValueRef.current) == null ? void 0 : _a.includes(state.activeValue)) return;
31606          }
31607          return state.activeValue;
31608        });
31609        const items = store2.useState("renderedItems");
31610        const open = store2.useState("open");
31611        const contentElement = store2.useState("contentElement");
31612        const value = (0, import_react21.useMemo)(() => {
31613          if (!inline) return storeValue;
31614          if (!canInline) return storeValue;
31615          const firstItemAutoSelected = isFirstItemAutoSelected(
31616            items,
31617            inlineActiveValue,
31618            autoSelect
31619          );
31620          if (firstItemAutoSelected) {
31621            if (hasCompletionString(storeValue, inlineActiveValue)) {
31622              const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || "";
31623              return storeValue + slice;
31624            }
31625            return storeValue;
31626          }
31627          return inlineActiveValue || storeValue;
31628        }, [inline, canInline, items, inlineActiveValue, autoSelect, storeValue]);
31629        (0, import_react21.useEffect)(() => {
31630          const element = ref.current;
31631          if (!element) return;
31632          const onCompositeItemMove = () => setCanInline(true);
31633          element.addEventListener("combobox-item-move", onCompositeItemMove);
31634          return () => {
31635            element.removeEventListener("combobox-item-move", onCompositeItemMove);
31636          };
31637        }, []);
31638        (0, import_react21.useEffect)(() => {
31639          if (!inline) return;
31640          if (!canInline) return;
31641          if (!inlineActiveValue) return;
31642          const firstItemAutoSelected = isFirstItemAutoSelected(
31643            items,
31644            inlineActiveValue,
31645            autoSelect
31646          );
31647          if (!firstItemAutoSelected) return;
31648          if (!hasCompletionString(storeValue, inlineActiveValue)) return;
31649          let cleanup = noop3;
31650          queueMicrotask(() => {
31651            const element = ref.current;
31652            if (!element) return;
31653            const { start: prevStart, end: prevEnd } = getTextboxSelection(element);
31654            const nextStart = storeValue.length;
31655            const nextEnd = inlineActiveValue.length;
31656            setSelectionRange(element, nextStart, nextEnd);
31657            cleanup = () => {
31658              if (!hasFocus(element)) return;
31659              const { start: start2, end } = getTextboxSelection(element);
31660              if (start2 !== nextStart) return;
31661              if (end !== nextEnd) return;
31662              setSelectionRange(element, prevStart, prevEnd);
31663            };
31664          });
31665          return () => cleanup();
31666        }, [
31667          valueUpdated,
31668          inline,
31669          canInline,
31670          inlineActiveValue,
31671          items,
31672          autoSelect,
31673          storeValue
31674        ]);
31675        const scrollingElementRef = (0, import_react21.useRef)(null);
31676        const getAutoSelectIdProp = useEvent(getAutoSelectId);
31677        const autoSelectIdRef = (0, import_react21.useRef)(null);
31678        (0, import_react21.useEffect)(() => {
31679          if (!open) return;
31680          if (!contentElement) return;
31681          const scrollingElement = getScrollingElement(contentElement);
31682          if (!scrollingElement) return;
31683          scrollingElementRef.current = scrollingElement;
31684          const onUserScroll = () => {
31685            canAutoSelectRef.current = false;
31686          };
31687          const onScroll = () => {
31688            if (!store2) return;
31689            if (!canAutoSelectRef.current) return;
31690            const { activeId } = store2.getState();
31691            if (activeId === null) return;
31692            if (activeId === autoSelectIdRef.current) return;
31693            canAutoSelectRef.current = false;
31694          };
31695          const options = { passive: true, capture: true };
31696          scrollingElement.addEventListener("wheel", onUserScroll, options);
31697          scrollingElement.addEventListener("touchmove", onUserScroll, options);
31698          scrollingElement.addEventListener("scroll", onScroll, options);
31699          return () => {
31700            scrollingElement.removeEventListener("wheel", onUserScroll, true);
31701            scrollingElement.removeEventListener("touchmove", onUserScroll, true);
31702            scrollingElement.removeEventListener("scroll", onScroll, true);
31703          };
31704        }, [open, contentElement, store2]);
31705        useSafeLayoutEffect(() => {
31706          if (!storeValue) return;
31707          if (composingRef.current) return;
31708          canAutoSelectRef.current = true;
31709        }, [storeValue]);
31710        useSafeLayoutEffect(() => {
31711          if (autoSelect !== "always" && open) return;
31712          canAutoSelectRef.current = open;
31713        }, [autoSelect, open]);
31714        const resetValueOnSelect = store2.useState("resetValueOnSelect");
31715        useUpdateEffect(() => {
31716          var _a, _b;
31717          const canAutoSelect = canAutoSelectRef.current;
31718          if (!store2) return;
31719          if (!open) return;
31720          if (!canAutoSelect && !resetValueOnSelect) return;
31721          const { baseElement, contentElement: contentElement2, activeId } = store2.getState();
31722          if (baseElement && !hasFocus(baseElement)) return;
31723          if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) {
31724            const observer = new MutationObserver(forceValueUpdate);
31725            observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
31726            return () => observer.disconnect();
31727          }
31728          if (autoSelect && canAutoSelect) {
31729            const userAutoSelectId = getAutoSelectIdProp(items);
31730            const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a = getDefaultAutoSelectId(items)) != null ? _a : store2.first();
31731            autoSelectIdRef.current = autoSelectId;
31732            store2.move(autoSelectId != null ? autoSelectId : null);
31733          } else {
31734            const element = (_b = store2.item(activeId || store2.first())) == null ? void 0 : _b.element;
31735            if (element && "scrollIntoView" in element) {
31736              element.scrollIntoView({ block: "nearest", inline: "nearest" });
31737            }
31738          }
31739          return;
31740        }, [
31741          store2,
31742          open,
31743          valueUpdated,
31744          storeValue,
31745          autoSelect,
31746          resetValueOnSelect,
31747          getAutoSelectIdProp,
31748          items
31749        ]);
31750        (0, import_react21.useEffect)(() => {
31751          if (!inline) return;
31752          const combobox = ref.current;
31753          if (!combobox) return;
31754          const elements2 = [combobox, contentElement].filter(
31755            (value2) => !!value2
31756          );
31757          const onBlur2 = (event) => {
31758            if (elements2.every((el) => isFocusEventOutside(event, el))) {
31759              store2 == null ? void 0 : store2.setValue(value);
31760            }
31761          };
31762          for (const element of elements2) {
31763            element.addEventListener("focusout", onBlur2);
31764          }
31765          return () => {
31766            for (const element of elements2) {
31767              element.removeEventListener("focusout", onBlur2);
31768            }
31769          };
31770        }, [inline, contentElement, store2, value]);
31771        const canShow = (event) => {
31772          const currentTarget = event.currentTarget;
31773          return currentTarget.value.length >= showMinLength;
31774        };
31775        const onChangeProp = props.onChange;
31776        const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow);
31777        const setValueOnChangeProp = useBooleanEvent(
31778          // If the combobox is combined with tags, the value will be set by the tag
31779          // input component.
31780          setValueOnChange != null ? setValueOnChange : !store2.tag
31781        );
31782        const onChange = useEvent((event) => {
31783          onChangeProp == null ? void 0 : onChangeProp(event);
31784          if (event.defaultPrevented) return;
31785          if (!store2) return;
31786          const currentTarget = event.currentTarget;
31787          const { value: value2, selectionStart, selectionEnd } = currentTarget;
31788          const nativeEvent = event.nativeEvent;
31789          canAutoSelectRef.current = true;
31790          if (isInputEvent(nativeEvent)) {
31791            if (nativeEvent.isComposing) {
31792              canAutoSelectRef.current = false;
31793              composingRef.current = true;
31794            }
31795            if (inline) {
31796              const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText";
31797              const caretAtEnd = selectionStart === value2.length;
31798              setCanInline(textInserted && caretAtEnd);
31799            }
31800          }
31801          if (setValueOnChangeProp(event)) {
31802            const isSameValue = value2 === store2.getState().value;
31803            store2.setValue(value2);
31804            queueMicrotask(() => {
31805              setSelectionRange(currentTarget, selectionStart, selectionEnd);
31806            });
31807            if (inline && autoSelect && isSameValue) {
31808              forceValueUpdate();
31809            }
31810          }
31811          if (showOnChangeProp(event)) {
31812            store2.show();
31813          }
31814          if (!autoSelect || !canAutoSelectRef.current) {
31815            store2.setActiveId(null);
31816          }
31817        });
31818        const onCompositionEndProp = props.onCompositionEnd;
31819        const onCompositionEnd = useEvent((event) => {
31820          canAutoSelectRef.current = true;
31821          composingRef.current = false;
31822          onCompositionEndProp == null ? void 0 : onCompositionEndProp(event);
31823          if (event.defaultPrevented) return;
31824          if (!autoSelect) return;
31825          forceValueUpdate();
31826        });
31827        const onMouseDownProp = props.onMouseDown;
31828        const blurActiveItemOnClickProp = useBooleanEvent(
31829          blurActiveItemOnClick != null ? blurActiveItemOnClick : (() => !!(store2 == null ? void 0 : store2.getState().includesBaseElement))
31830        );
31831        const setValueOnClickProp = useBooleanEvent(setValueOnClick);
31832        const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow);
31833        const onMouseDown = useEvent((event) => {
31834          onMouseDownProp == null ? void 0 : onMouseDownProp(event);
31835          if (event.defaultPrevented) return;
31836          if (event.button) return;
31837          if (event.ctrlKey) return;
31838          if (!store2) return;
31839          if (blurActiveItemOnClickProp(event)) {
31840            store2.setActiveId(null);
31841          }
31842          if (setValueOnClickProp(event)) {
31843            store2.setValue(value);
31844          }
31845          if (showOnClickProp(event)) {
31846            queueBeforeEvent(event.currentTarget, "mouseup", store2.show);
31847          }
31848        });
31849        const onKeyDownProp = props.onKeyDown;
31850        const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow);
31851        const onKeyDown = useEvent((event) => {
31852          onKeyDownProp == null ? void 0 : onKeyDownProp(event);
31853          if (!event.repeat) {
31854            canAutoSelectRef.current = false;
31855          }
31856          if (event.defaultPrevented) return;
31857          if (event.ctrlKey) return;
31858          if (event.altKey) return;
31859          if (event.shiftKey) return;
31860          if (event.metaKey) return;
31861          if (!store2) return;
31862          const { open: open2 } = store2.getState();
31863          if (open2) return;
31864          if (event.key === "ArrowUp" || event.key === "ArrowDown") {
31865            if (showOnKeyPressProp(event)) {
31866              event.preventDefault();
31867              store2.show();
31868            }
31869          }
31870        });
31871        const onBlurProp = props.onBlur;
31872        const onBlur = useEvent((event) => {
31873          canAutoSelectRef.current = false;
31874          onBlurProp == null ? void 0 : onBlurProp(event);
31875          if (event.defaultPrevented) return;
31876        });
31877        const id = useId5(props.id);
31878        const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0;
31879        const isActiveItem = store2.useState((state) => state.activeId === null);
31880        props = {
31881          id,
31882          role: "combobox",
31883          "aria-autocomplete": ariaAutoComplete,
31884          "aria-haspopup": getPopupRole(contentElement, "listbox"),
31885          "aria-expanded": open,
31886          "aria-controls": contentElement == null ? void 0 : contentElement.id,
31887          "data-active-item": isActiveItem || void 0,
31888          value,
31889          ...props,
31890          ref: useMergeRefs(ref, props.ref),
31891          onChange,
31892          onCompositionEnd,
31893          onMouseDown,
31894          onKeyDown,
31895          onBlur
31896        };
31897        props = useComposite({
31898          store: store2,
31899          focusable,
31900          ...props,
31901          // Enable inline autocomplete when the user moves from the combobox input
31902          // to an item.
31903          moveOnKeyPress: (event) => {
31904            if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false;
31905            if (inline) setCanInline(true);
31906            return true;
31907          }
31908        });
31909        props = usePopoverAnchor({ store: store2, ...props });
31910        return { autoComplete: "off", ...props };
31911      }
31912    );
31913    var Combobox = forwardRef22(function Combobox2(props) {
31914      const htmlProps = useCombobox(props);
31915      return createElement5(TagName9, htmlProps);
31916    });
31917  
31918    // node_modules/@ariakit/react-core/esm/__chunks/IBXZ2LQC.js
31919    var import_react22 = __toESM(require_react(), 1);
31920    var import_jsx_runtime210 = __toESM(require_jsx_runtime(), 1);
31921    var TagName10 = "div";
31922    function isSelected(storeValue, itemValue) {
31923      if (itemValue == null) return;
31924      if (storeValue == null) return false;
31925      if (Array.isArray(storeValue)) {
31926        return storeValue.includes(itemValue);
31927      }
31928      return storeValue === itemValue;
31929    }
31930    function getItemRole(popupRole) {
31931      var _a;
31932      const itemRoleByPopupRole = {
31933        menu: "menuitem",
31934        listbox: "option",
31935        tree: "treeitem"
31936      };
31937      const key = popupRole;
31938      return (_a = itemRoleByPopupRole[key]) != null ? _a : "option";
31939    }
31940    var useComboboxItem = createHook(
31941      function useComboboxItem2({
31942        store: store2,
31943        value,
31944        hideOnClick,
31945        setValueOnClick,
31946        selectValueOnClick = true,
31947        resetValueOnSelect,
31948        focusOnHover = false,
31949        moveOnKeyPress = true,
31950        getItem: getItemProp,
31951        ...props
31952      }) {
31953        var _a;
31954        const context = useComboboxScopedContext();
31955        store2 = store2 || context;
31956        invariant(
31957          store2,
31958          "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component."
31959        );
31960        const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store2, {
31961          resetValueOnSelectState: "resetValueOnSelect",
31962          multiSelectable(state) {
31963            return Array.isArray(state.selectedValue);
31964          },
31965          selected(state) {
31966            return isSelected(state.selectedValue, value);
31967          }
31968        });
31969        const getItem = (0, import_react22.useCallback)(
31970          (item) => {
31971            const nextItem = { ...item, value };
31972            if (getItemProp) {
31973              return getItemProp(nextItem);
31974            }
31975            return nextItem;
31976          },
31977          [value, getItemProp]
31978        );
31979        setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable;
31980        hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable;
31981        const onClickProp = props.onClick;
31982        const setValueOnClickProp = useBooleanEvent(setValueOnClick);
31983        const selectValueOnClickProp = useBooleanEvent(selectValueOnClick);
31984        const resetValueOnSelectProp = useBooleanEvent(
31985          (_a = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a : multiSelectable
31986        );
31987        const hideOnClickProp = useBooleanEvent(hideOnClick);
31988        const onClick = useEvent((event) => {
31989          onClickProp == null ? void 0 : onClickProp(event);
31990          if (event.defaultPrevented) return;
31991          if (isDownloading(event)) return;
31992          if (isOpeningInNewTab(event)) return;
31993          if (value != null) {
31994            if (selectValueOnClickProp(event)) {
31995              if (resetValueOnSelectProp(event)) {
31996                store2 == null ? void 0 : store2.resetValue();
31997              }
31998              store2 == null ? void 0 : store2.setSelectedValue((prevValue) => {
31999                if (!Array.isArray(prevValue)) return value;
32000                if (prevValue.includes(value)) {
32001                  return prevValue.filter((v2) => v2 !== value);
32002                }
32003                return [...prevValue, value];
32004              });
32005            }
32006            if (setValueOnClickProp(event)) {
32007              store2 == null ? void 0 : store2.setValue(value);
32008            }
32009          }
32010          if (hideOnClickProp(event)) {
32011            store2 == null ? void 0 : store2.hide();
32012          }
32013        });
32014        const onKeyDownProp = props.onKeyDown;
32015        const onKeyDown = useEvent((event) => {
32016          onKeyDownProp == null ? void 0 : onKeyDownProp(event);
32017          if (event.defaultPrevented) return;
32018          const baseElement = store2 == null ? void 0 : store2.getState().baseElement;
32019          if (!baseElement) return;
32020          if (hasFocus(baseElement)) return;
32021          const printable = event.key.length === 1;
32022          if (printable || event.key === "Backspace" || event.key === "Delete") {
32023            queueMicrotask(() => baseElement.focus());
32024            if (isTextField(baseElement)) {
32025              store2 == null ? void 0 : store2.setValue(baseElement.value);
32026            }
32027          }
32028        });
32029        if (multiSelectable && selected != null) {
32030          props = {
32031            "aria-selected": selected,
32032            ...props
32033          };
32034        }
32035        props = useWrapElement(
32036          props,
32037          (element) => /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }),
32038          [value, selected]
32039        );
32040        const popupRole = (0, import_react22.useContext)(ComboboxListRoleContext);
32041        props = {
32042          role: getItemRole(popupRole),
32043          children: value,
32044          ...props,
32045          onClick,
32046          onKeyDown
32047        };
32048        const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
32049        props = useCompositeItem({
32050          store: store2,
32051          ...props,
32052          getItem,
32053          // Dispatch a custom event on the combobox input when moving to an item
32054          // with the keyboard so the Combobox component can enable inline
32055          // autocompletion.
32056          moveOnKeyPress: (event) => {
32057            if (!moveOnKeyPressProp(event)) return false;
32058            const moveEvent = new Event("combobox-item-move");
32059            const baseElement = store2 == null ? void 0 : store2.getState().baseElement;
32060            baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent);
32061            return true;
32062          }
32063        });
32064        props = useCompositeHover({ store: store2, focusOnHover, ...props });
32065        return props;
32066      }
32067    );
32068    var ComboboxItem = memo22(
32069      forwardRef22(function ComboboxItem2(props) {
32070        const htmlProps = useComboboxItem(props);
32071        return createElement5(TagName10, htmlProps);
32072      })
32073    );
32074  
32075    // node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js
32076    var import_react23 = __toESM(require_react(), 1);
32077    var import_jsx_runtime211 = __toESM(require_jsx_runtime(), 1);
32078    var TagName11 = "span";
32079    function normalizeValue(value) {
32080      return normalizeString2(value).toLowerCase();
32081    }
32082    function getOffsets(string, values) {
32083      const offsets = [];
32084      for (const value of values) {
32085        let pos = 0;
32086        const length = value.length;
32087        while (string.indexOf(value, pos) !== -1) {
32088          const index = string.indexOf(value, pos);
32089          if (index !== -1) {
32090            offsets.push([index, length]);
32091          }
32092          pos = index + 1;
32093        }
32094      }
32095      return offsets;
32096    }
32097    function filterOverlappingOffsets(offsets) {
32098      return offsets.filter(([offset, length], i2, arr) => {
32099        return !arr.some(
32100          ([o3, l2], j2) => j2 !== i2 && o3 <= offset && o3 + l2 >= offset + length
32101        );
32102      });
32103    }
32104    function sortOffsets(offsets) {
32105      return offsets.sort(([a2], [b2]) => a2 - b2);
32106    }
32107    function splitValue(itemValue, userValue) {
32108      if (!itemValue) return itemValue;
32109      if (!userValue) return itemValue;
32110      const userValues = toArray2(userValue).filter(Boolean).map(normalizeValue);
32111      const parts = [];
32112      const span = (value, autocomplete = false) => /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(
32113        "span",
32114        {
32115          "data-autocomplete-value": autocomplete ? "" : void 0,
32116          "data-user-value": autocomplete ? void 0 : "",
32117          children: value
32118        },
32119        parts.length
32120      );
32121      const offsets = sortOffsets(
32122        filterOverlappingOffsets(
32123          // Convert userValues into a set to avoid duplicates
32124          getOffsets(normalizeValue(itemValue), new Set(userValues))
32125        )
32126      );
32127      if (!offsets.length) {
32128        parts.push(span(itemValue, true));
32129        return parts;
32130      }
32131      const [firstOffset] = offsets[0];
32132      const values = [
32133        itemValue.slice(0, firstOffset),
32134        ...offsets.flatMap(([offset, length], i2) => {
32135          var _a;
32136          const value = itemValue.slice(offset, offset + length);
32137          const nextOffset = (_a = offsets[i2 + 1]) == null ? void 0 : _a[0];
32138          const nextValue = itemValue.slice(offset + length, nextOffset);
32139          return [value, nextValue];
32140        })
32141      ];
32142      values.forEach((value, i2) => {
32143        if (!value) return;
32144        parts.push(span(value, i2 % 2 === 0));
32145      });
32146      return parts;
32147    }
32148    var useComboboxItemValue = createHook(function useComboboxItemValue2({ store: store2, value, userValue, ...props }) {
32149      const context = useComboboxScopedContext();
32150      store2 = store2 || context;
32151      const itemContext = (0, import_react23.useContext)(ComboboxItemValueContext);
32152      const itemValue = value != null ? value : itemContext;
32153      const inputValue = useStoreState(store2, (state) => userValue != null ? userValue : state == null ? void 0 : state.value);
32154      const children = (0, import_react23.useMemo)(() => {
32155        if (!itemValue) return;
32156        if (!inputValue) return itemValue;
32157        return splitValue(itemValue, inputValue);
32158      }, [itemValue, inputValue]);
32159      props = {
32160        children,
32161        ...props
32162      };
32163      return removeUndefinedValues(props);
32164    });
32165    var ComboboxItemValue = forwardRef22(function ComboboxItemValue2(props) {
32166      const htmlProps = useComboboxItemValue(props);
32167      return createElement5(TagName11, htmlProps);
32168    });
32169  
32170    // node_modules/@ariakit/react-core/esm/combobox/combobox-label.js
32171    var TagName12 = "label";
32172    var useComboboxLabel = createHook(
32173      function useComboboxLabel2({ store: store2, ...props }) {
32174        const context = useComboboxProviderContext();
32175        store2 = store2 || context;
32176        invariant(
32177          store2,
32178          "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component."
32179        );
32180        const comboboxId = store2.useState((state) => {
32181          var _a;
32182          return (_a = state.baseElement) == null ? void 0 : _a.id;
32183        });
32184        props = {
32185          htmlFor: comboboxId,
32186          ...props
32187        };
32188        return removeUndefinedValues(props);
32189      }
32190    );
32191    var ComboboxLabel = memo22(
32192      forwardRef22(function ComboboxLabel2(props) {
32193        const htmlProps = useComboboxLabel(props);
32194        return createElement5(TagName12, htmlProps);
32195      })
32196    );
32197  
32198    // node_modules/@ariakit/react-core/esm/__chunks/2G6YEJT4.js
32199    var import_react24 = __toESM(require_react(), 1);
32200    var import_jsx_runtime212 = __toESM(require_jsx_runtime(), 1);
32201    var TagName13 = "div";
32202    var useComboboxList = createHook(
32203      function useComboboxList2({ store: store2, alwaysVisible, ...props }) {
32204        const scopedContext = useComboboxScopedContext(true);
32205        const context = useComboboxContext();
32206        store2 = store2 || context;
32207        const scopedContextSameStore = !!store2 && store2 === scopedContext;
32208        invariant(
32209          store2,
32210          "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component."
32211        );
32212        const ref = (0, import_react24.useRef)(null);
32213        const id = useId5(props.id);
32214        const mounted = store2.useState("mounted");
32215        const hidden = isHidden(mounted, props.hidden, alwaysVisible);
32216        const style = hidden ? { ...props.style, display: "none" } : props.style;
32217        const multiSelectable = store2.useState(
32218          (state) => Array.isArray(state.selectedValue)
32219        );
32220        const role = useAttribute(ref, "role", props.role);
32221        const isCompositeRole = role === "listbox" || role === "tree" || role === "grid";
32222        const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0;
32223        const [hasListboxInside, setHasListboxInside] = (0, import_react24.useState)(false);
32224        const contentElement = store2.useState("contentElement");
32225        useSafeLayoutEffect(() => {
32226          if (!mounted) return;
32227          const element = ref.current;
32228          if (!element) return;
32229          if (contentElement !== element) return;
32230          const callback = () => {
32231            setHasListboxInside(!!element.querySelector("[role='listbox']"));
32232          };
32233          const observer = new MutationObserver(callback);
32234          observer.observe(element, {
32235            subtree: true,
32236            childList: true,
32237            attributeFilter: ["role"]
32238          });
32239          callback();
32240          return () => observer.disconnect();
32241        }, [mounted, contentElement]);
32242        if (!hasListboxInside) {
32243          props = {
32244            role: "listbox",
32245            "aria-multiselectable": ariaMultiSelectable,
32246            ...props
32247          };
32248        }
32249        props = useWrapElement(
32250          props,
32251          (element) => /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(ComboboxScopedContextProvider, { value: store2, children: /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }),
32252          [store2, role]
32253        );
32254        const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store2.setContentElement : null;
32255        props = {
32256          id,
32257          hidden,
32258          ...props,
32259          ref: useMergeRefs(setContentElement, ref, props.ref),
32260          style
32261        };
32262        return removeUndefinedValues(props);
32263      }
32264    );
32265    var ComboboxList = forwardRef22(function ComboboxList2(props) {
32266      const htmlProps = useComboboxList(props);
32267      return createElement5(TagName13, htmlProps);
32268    });
32269  
32270    // node_modules/@ariakit/react-core/esm/__chunks/XSIEPKGA.js
32271    var import_react25 = __toESM(require_react(), 1);
32272    var TagValueContext = (0, import_react25.createContext)(null);
32273    var TagRemoveIdContext = (0, import_react25.createContext)(
32274      null
32275    );
32276    var ctx8 = createStoreContext(
32277      [CompositeContextProvider],
32278      [CompositeScopedContextProvider]
32279    );
32280    var useTagContext = ctx8.useContext;
32281    var useTagScopedContext = ctx8.useScopedContext;
32282    var useTagProviderContext = ctx8.useProviderContext;
32283    var TagContextProvider = ctx8.ContextProvider;
32284    var TagScopedContextProvider = ctx8.ScopedContextProvider;
32285  
32286    // node_modules/@ariakit/core/esm/combobox/combobox-store.js
32287    var isTouchSafari = isSafari() && isTouchDevice();
32288    function createComboboxStore({
32289      tag,
32290      ...props
32291    } = {}) {
32292      const store2 = mergeStore(props.store, pick2(tag, ["value", "rtl"]));
32293      throwOnConflictingProps(props, store2);
32294      const tagState = tag == null ? void 0 : tag.getState();
32295      const syncState = store2 == null ? void 0 : store2.getState();
32296      const activeId = defaultValue(
32297        props.activeId,
32298        syncState == null ? void 0 : syncState.activeId,
32299        props.defaultActiveId,
32300        null
32301      );
32302      const composite = createCompositeStore({
32303        ...props,
32304        activeId,
32305        includesBaseElement: defaultValue(
32306          props.includesBaseElement,
32307          syncState == null ? void 0 : syncState.includesBaseElement,
32308          true
32309        ),
32310        orientation: defaultValue(
32311          props.orientation,
32312          syncState == null ? void 0 : syncState.orientation,
32313          "vertical"
32314        ),
32315        focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
32316        focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
32317        virtualFocus: defaultValue(
32318          props.virtualFocus,
32319          syncState == null ? void 0 : syncState.virtualFocus,
32320          true
32321        )
32322      });
32323      const popover = createPopoverStore({
32324        ...props,
32325        placement: defaultValue(
32326          props.placement,
32327          syncState == null ? void 0 : syncState.placement,
32328          "bottom-start"
32329        )
32330      });
32331      const value = defaultValue(
32332        props.value,
32333        syncState == null ? void 0 : syncState.value,
32334        props.defaultValue,
32335        ""
32336      );
32337      const selectedValue = defaultValue(
32338        props.selectedValue,
32339        syncState == null ? void 0 : syncState.selectedValue,
32340        tagState == null ? void 0 : tagState.values,
32341        props.defaultSelectedValue,
32342        ""
32343      );
32344      const multiSelectable = Array.isArray(selectedValue);
32345      const initialState = {
32346        ...composite.getState(),
32347        ...popover.getState(),
32348        value,
32349        selectedValue,
32350        resetValueOnSelect: defaultValue(
32351          props.resetValueOnSelect,
32352          syncState == null ? void 0 : syncState.resetValueOnSelect,
32353          multiSelectable
32354        ),
32355        resetValueOnHide: defaultValue(
32356          props.resetValueOnHide,
32357          syncState == null ? void 0 : syncState.resetValueOnHide,
32358          multiSelectable && !tag
32359        ),
32360        activeValue: syncState == null ? void 0 : syncState.activeValue
32361      };
32362      const combobox = createStore(initialState, composite, popover, store2);
32363      if (isTouchSafari) {
32364        setup(
32365          combobox,
32366          () => sync2(combobox, ["virtualFocus"], () => {
32367            combobox.setState("virtualFocus", false);
32368          })
32369        );
32370      }
32371      setup(combobox, () => {
32372        if (!tag) return;
32373        return chain(
32374          sync2(combobox, ["selectedValue"], (state) => {
32375            if (!Array.isArray(state.selectedValue)) return;
32376            tag.setValues(state.selectedValue);
32377          }),
32378          sync2(tag, ["values"], (state) => {
32379            combobox.setState("selectedValue", state.values);
32380          })
32381        );
32382      });
32383      setup(
32384        combobox,
32385        () => sync2(combobox, ["resetValueOnHide", "mounted"], (state) => {
32386          if (!state.resetValueOnHide) return;
32387          if (state.mounted) return;
32388          combobox.setState("value", value);
32389        })
32390      );
32391      setup(
32392        combobox,
32393        () => sync2(combobox, ["open"], (state) => {
32394          if (state.open) return;
32395          combobox.setState("activeId", activeId);
32396          combobox.setState("moves", 0);
32397        })
32398      );
32399      setup(
32400        combobox,
32401        () => sync2(combobox, ["moves", "activeId"], (state, prevState) => {
32402          if (state.moves === prevState.moves) {
32403            combobox.setState("activeValue", void 0);
32404          }
32405        })
32406      );
32407      setup(
32408        combobox,
32409        () => batch(combobox, ["moves", "renderedItems"], (state, prev) => {
32410          if (state.moves === prev.moves) return;
32411          const { activeId: activeId2 } = combobox.getState();
32412          const activeItem = composite.item(activeId2);
32413          combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
32414        })
32415      );
32416      return {
32417        ...popover,
32418        ...composite,
32419        ...combobox,
32420        tag,
32421        setValue: (value2) => combobox.setState("value", value2),
32422        resetValue: () => combobox.setState("value", initialState.value),
32423        setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
32424      };
32425    }
32426  
32427    // node_modules/@ariakit/react-core/esm/__chunks/SVN33SY6.js
32428    function useComboboxStoreOptions(props) {
32429      const tag = useTagContext();
32430      props = {
32431        ...props,
32432        tag: props.tag !== void 0 ? props.tag : tag
32433      };
32434      return useCompositeStoreOptions(props);
32435    }
32436    function useComboboxStoreProps(store2, update4, props) {
32437      useUpdateEffect(update4, [props.tag]);
32438      useStoreProps(store2, props, "value", "setValue");
32439      useStoreProps(store2, props, "selectedValue", "setSelectedValue");
32440      useStoreProps(store2, props, "resetValueOnHide");
32441      useStoreProps(store2, props, "resetValueOnSelect");
32442      return Object.assign(
32443        useCompositeStoreProps(
32444          usePopoverStoreProps(store2, update4, props),
32445          update4,
32446          props
32447        ),
32448        { tag: props.tag }
32449      );
32450    }
32451    function useComboboxStore(props = {}) {
32452      props = useComboboxStoreOptions(props);
32453      const [store2, update4] = useStore(createComboboxStore, props);
32454      return useComboboxStoreProps(store2, update4, props);
32455    }
32456  
32457    // node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js
32458    var import_jsx_runtime213 = __toESM(require_jsx_runtime(), 1);
32459    function ComboboxProvider(props = {}) {
32460      const store2 = useComboboxStore(props);
32461      return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(ComboboxContextProvider, { value: store2, children: props.children });
32462    }
32463  
32464    // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs
32465    var import_remove_accents = __toESM(require_remove_accents(), 1);
32466    var import_compose19 = __toESM(require_compose(), 1);
32467    var import_i18n104 = __toESM(require_i18n(), 1);
32468    var import_element90 = __toESM(require_element(), 1);
32469    var import_components109 = __toESM(require_components(), 1);
32470  
32471    // packages/dataviews/build-module/components/dataviews-filters/utils.mjs
32472    var EMPTY_ARRAY6 = [];
32473    var getCurrentValue = (filterDefinition, currentFilter) => {
32474      if (filterDefinition.singleSelection) {
32475        return currentFilter?.value;
32476      }
32477      if (Array.isArray(currentFilter?.value)) {
32478        return currentFilter.value;
32479      }
32480      if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) {
32481        return [currentFilter.value];
32482      }
32483      return EMPTY_ARRAY6;
32484    };
32485  
32486    // packages/dataviews/build-module/hooks/use-elements.mjs
32487    var import_element89 = __toESM(require_element(), 1);
32488    var EMPTY_ARRAY7 = [];
32489    function useElements({
32490      elements: elements2,
32491      getElements
32492    }) {
32493      const staticElements = Array.isArray(elements2) && elements2.length > 0 ? elements2 : EMPTY_ARRAY7;
32494      const [records, setRecords] = (0, import_element89.useState)(staticElements);
32495      const [isLoading, setIsLoading] = (0, import_element89.useState)(false);
32496      (0, import_element89.useEffect)(() => {
32497        if (!getElements) {
32498          setRecords(staticElements);
32499          return;
32500        }
32501        let cancelled = false;
32502        setIsLoading(true);
32503        getElements().then((fetchedElements) => {
32504          if (!cancelled) {
32505            const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
32506            setRecords(dynamicElements);
32507          }
32508        }).catch(() => {
32509          if (!cancelled) {
32510            setRecords(staticElements);
32511          }
32512        }).finally(() => {
32513          if (!cancelled) {
32514            setIsLoading(false);
32515          }
32516        });
32517        return () => {
32518          cancelled = true;
32519        };
32520      }, [getElements, staticElements]);
32521      return {
32522        elements: records,
32523        isLoading
32524      };
32525    }
32526  
32527    // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs
32528    var import_jsx_runtime214 = __toESM(require_jsx_runtime(), 1);
32529    function normalizeSearchInput(input = "") {
32530      return (0, import_remove_accents.default)(input.trim().toLowerCase());
32531    }
32532    var getNewValue = (filterDefinition, currentFilter, value) => {
32533      if (filterDefinition.singleSelection) {
32534        return value;
32535      }
32536      if (Array.isArray(currentFilter?.value)) {
32537        return currentFilter.value.includes(value) ? currentFilter.value.filter((v2) => v2 !== value) : [...currentFilter.value, value];
32538      }
32539      return [value];
32540    };
32541    function generateFilterElementCompositeItemId(prefix2, filterElementValue) {
32542      return `$prefix2}-$filterElementValue}`;
32543    }
32544    var MultiSelectionOption = ({ selected }) => {
32545      return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32546        "span",
32547        {
32548          className: clsx_default(
32549            "dataviews-filters__search-widget-listitem-multi-selection",
32550            { "is-selected": selected }
32551          ),
32552          children: selected && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(import_components109.Icon, { icon: check_default })
32553        }
32554      );
32555    };
32556    var SingleSelectionOption = ({ selected }) => {
32557      return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32558        "span",
32559        {
32560          className: clsx_default(
32561            "dataviews-filters__search-widget-listitem-single-selection",
32562            { "is-selected": selected }
32563          )
32564        }
32565      );
32566    };
32567    function ListBox({ view, filter, onChangeView }) {
32568      const baseId = (0, import_compose19.useInstanceId)(ListBox, "dataviews-filter-list-box");
32569      const [activeCompositeId, setActiveCompositeId] = (0, import_element90.useState)(
32570        // When there are one or less operators, the first item is set as active
32571        // (by setting the initial `activeId` to `undefined`).
32572        // With 2 or more operators, the focus is moved on the operators control
32573        // (by setting the initial `activeId` to `null`), meaning that there won't
32574        // be an active item initially. Focus is then managed via the
32575        // `onFocusVisible` callback.
32576        filter.operators?.length === 1 ? void 0 : null
32577      );
32578      const currentFilter = view.filters?.find(
32579        (f2) => f2.field === filter.field
32580      );
32581      const currentValue = getCurrentValue(filter, currentFilter);
32582      return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32583        import_components109.Composite,
32584        {
32585          virtualFocus: true,
32586          focusLoop: true,
32587          activeId: activeCompositeId,
32588          setActiveId: setActiveCompositeId,
32589          role: "listbox",
32590          className: "dataviews-filters__search-widget-listbox",
32591          "aria-label": (0, import_i18n104.sprintf)(
32592            /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */
32593            (0, import_i18n104.__)("List of: %1$s"),
32594            filter.name
32595          ),
32596          onFocusVisible: () => {
32597            if (!activeCompositeId && filter.elements.length) {
32598              setActiveCompositeId(
32599                generateFilterElementCompositeItemId(
32600                  baseId,
32601                  filter.elements[0].value
32602                )
32603              );
32604            }
32605          },
32606          render: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(import_components109.Composite.Typeahead, {}),
32607          children: filter.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
32608            import_components109.Composite.Hover,
32609            {
32610              render: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32611                import_components109.Composite.Item,
32612                {
32613                  id: generateFilterElementCompositeItemId(
32614                    baseId,
32615                    element.value
32616                  ),
32617                  render: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32618                    "div",
32619                    {
32620                      "aria-label": element.label,
32621                      role: "option",
32622                      className: "dataviews-filters__search-widget-listitem"
32623                    }
32624                  ),
32625                  onClick: () => {
32626                    const newFilters = currentFilter ? [
32627                      ...(view.filters ?? []).map(
32628                        (_filter) => {
32629                          if (_filter.field === filter.field) {
32630                            return {
32631                              ..._filter,
32632                              operator: currentFilter.operator || filter.operators[0],
32633                              value: getNewValue(
32634                                filter,
32635                                currentFilter,
32636                                element.value
32637                              )
32638                            };
32639                          }
32640                          return _filter;
32641                        }
32642                      )
32643                    ] : [
32644                      ...view.filters ?? [],
32645                      {
32646                        field: filter.field,
32647                        operator: filter.operators[0],
32648                        value: getNewValue(
32649                          filter,
32650                          currentFilter,
32651                          element.value
32652                        )
32653                      }
32654                    ];
32655                    onChangeView({
32656                      ...view,
32657                      page: 1,
32658                      filters: newFilters
32659                    });
32660                  }
32661                }
32662              ),
32663              children: [
32664                filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32665                  SingleSelectionOption,
32666                  {
32667                    selected: currentValue === element.value
32668                  }
32669                ),
32670                !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32671                  MultiSelectionOption,
32672                  {
32673                    selected: currentValue.includes(element.value)
32674                  }
32675                ),
32676                /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32677                  "span",
32678                  {
32679                    className: "dataviews-filters__search-widget-listitem-value",
32680                    title: element.label,
32681                    children: element.label
32682                  }
32683                )
32684              ]
32685            },
32686            element.value
32687          ))
32688        }
32689      );
32690    }
32691    function ComboboxList22({ view, filter, onChangeView }) {
32692      const [searchValue, setSearchValue] = (0, import_element90.useState)("");
32693      const deferredSearchValue = (0, import_element90.useDeferredValue)(searchValue);
32694      const currentFilter = view.filters?.find(
32695        (_filter) => _filter.field === filter.field
32696      );
32697      const currentValue = getCurrentValue(filter, currentFilter);
32698      const matches = (0, import_element90.useMemo)(() => {
32699        const normalizedSearch = normalizeSearchInput(deferredSearchValue);
32700        return filter.elements.filter(
32701          (item) => normalizeSearchInput(item.label).includes(normalizedSearch)
32702        );
32703      }, [filter.elements, deferredSearchValue]);
32704      return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
32705        ComboboxProvider,
32706        {
32707          selectedValue: currentValue,
32708          setSelectedValue: (value) => {
32709            const newFilters = currentFilter ? [
32710              ...(view.filters ?? []).map((_filter) => {
32711                if (_filter.field === filter.field) {
32712                  return {
32713                    ..._filter,
32714                    operator: currentFilter.operator || filter.operators[0],
32715                    value
32716                  };
32717                }
32718                return _filter;
32719              })
32720            ] : [
32721              ...view.filters ?? [],
32722              {
32723                field: filter.field,
32724                operator: filter.operators[0],
32725                value
32726              }
32727            ];
32728            onChangeView({
32729              ...view,
32730              page: 1,
32731              filters: newFilters
32732            });
32733          },
32734          setValue: setSearchValue,
32735          children: [
32736            /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [
32737              /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32738                ComboboxLabel,
32739                {
32740                  render: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(import_components109.VisuallyHidden, { children: (0, import_i18n104.__)("Search items") }),
32741                  children: (0, import_i18n104.__)("Search items")
32742                }
32743              ),
32744              /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32745                Combobox,
32746                {
32747                  autoSelect: "always",
32748                  placeholder: (0, import_i18n104.__)("Search"),
32749                  className: "dataviews-filters__search-widget-filter-combobox__input"
32750                }
32751              ),
32752              /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(import_components109.Icon, { icon: search_default }) })
32753            ] }),
32754            /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
32755              ComboboxList,
32756              {
32757                className: "dataviews-filters__search-widget-filter-combobox-list",
32758                alwaysVisible: true,
32759                children: [
32760                  matches.map((element) => {
32761                    return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
32762                      ComboboxItem,
32763                      {
32764                        resetValueOnSelect: false,
32765                        value: element.value,
32766                        className: "dataviews-filters__search-widget-listitem",
32767                        hideOnClick: false,
32768                        setValueOnClick: false,
32769                        focusOnHover: true,
32770                        children: [
32771                          filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32772                            SingleSelectionOption,
32773                            {
32774                              selected: currentValue === element.value
32775                            }
32776                          ),
32777                          !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32778                            MultiSelectionOption,
32779                            {
32780                              selected: currentValue.includes(
32781                                element.value
32782                              )
32783                            }
32784                          ),
32785                          /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
32786                            "span",
32787                            {
32788                              className: "dataviews-filters__search-widget-listitem-value",
32789                              title: element.label,
32790                              children: [
32791                                /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
32792                                  ComboboxItemValue,
32793                                  {
32794                                    className: "dataviews-filters__search-widget-filter-combobox-item-value",
32795                                    value: element.label
32796                                  }
32797                                ),
32798                                !!element.description && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description })
32799                              ]
32800                            }
32801                          )
32802                        ]
32803                      },
32804                      element.value
32805                    );
32806                  }),
32807                  !matches.length && /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("p", { children: (0, import_i18n104.__)("No results found") })
32808                ]
32809              }
32810            )
32811          ]
32812        }
32813      );
32814    }
32815    function SearchWidget(props) {
32816      const { elements: elements2, isLoading } = useElements({
32817        elements: props.filter.elements,
32818        getElements: props.filter.getElements
32819      });
32820      if (isLoading) {
32821        return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(import_components109.Spinner, {}) });
32822      }
32823      if (elements2.length === 0) {
32824        return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0, import_i18n104.__)("No elements found") });
32825      }
32826      const Widget = elements2.length > 10 ? ComboboxList22 : ListBox;
32827      return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(Widget, { ...props, filter: { ...props.filter, elements: elements2 } });
32828    }
32829  
32830    // packages/dataviews/build-module/components/dataviews-filters/input-widget.mjs
32831    var import_es62 = __toESM(require_es6(), 1);
32832    var import_compose20 = __toESM(require_compose(), 1);
32833    var import_element91 = __toESM(require_element(), 1);
32834    var import_components110 = __toESM(require_components(), 1);
32835    var import_jsx_runtime215 = __toESM(require_jsx_runtime(), 1);
32836    function InputWidget({
32837      filter,
32838      view,
32839      onChangeView,
32840      fields
32841    }) {
32842      const currentFilter = view.filters?.find(
32843        (f2) => f2.field === filter.field
32844      );
32845      const currentValue = getCurrentValue(filter, currentFilter);
32846      const field = (0, import_element91.useMemo)(() => {
32847        const currentField = fields.find((f2) => f2.id === filter.field);
32848        if (currentField) {
32849          return {
32850            ...currentField,
32851            // Deactivate validation for filters.
32852            isValid: {},
32853            // Configure getValue/setValue as if Item was a plain object.
32854            getValue: ({ item }) => item[currentField.id],
32855            setValue: ({ value }) => ({
32856              [currentField.id]: value
32857            })
32858          };
32859        }
32860        return currentField;
32861      }, [fields, filter.field]);
32862      const data = (0, import_element91.useMemo)(() => {
32863        return (view.filters ?? []).reduce(
32864          (acc, activeFilter) => {
32865            acc[activeFilter.field] = activeFilter.value;
32866            return acc;
32867          },
32868          {}
32869        );
32870      }, [view.filters]);
32871      const handleChange = (0, import_compose20.useEvent)((updatedData) => {
32872        if (!field || !currentFilter) {
32873          return;
32874        }
32875        const nextValue = field.getValue({ item: updatedData });
32876        if ((0, import_es62.default)(nextValue, currentValue)) {
32877          return;
32878        }
32879        onChangeView({
32880          ...view,
32881          filters: (view.filters ?? []).map(
32882            (_filter) => _filter.field === filter.field ? {
32883              ..._filter,
32884              operator: currentFilter.operator || filter.operators[0],
32885              // Consider empty strings as undefined:
32886              //
32887              // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records
32888              // - empty string as value means "search empty string": returns only the records that have an empty string as value
32889              //
32890              // In practice, this means the filter will not be able to find an empty string as the value.
32891              value: nextValue === "" ? void 0 : nextValue
32892            } : _filter
32893          )
32894        });
32895      });
32896      if (!field || !field.Edit || !currentFilter) {
32897        return null;
32898      }
32899      return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
32900        import_components110.Flex,
32901        {
32902          className: "dataviews-filters__user-input-widget",
32903          gap: 2.5,
32904          direction: "column",
32905          children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
32906            field.Edit,
32907            {
32908              hideLabelFromVision: true,
32909              data,
32910              field,
32911              operator: currentFilter.operator,
32912              onChange: handleChange
32913            }
32914          )
32915        }
32916      );
32917    }
32918  
32919    // packages/dataviews/node_modules/date-fns/constants.js
32920    var daysInYear = 365.2425;
32921    var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
32922    var minTime = -maxTime;
32923    var millisecondsInWeek = 6048e5;
32924    var millisecondsInDay = 864e5;
32925    var secondsInHour = 3600;
32926    var secondsInDay = secondsInHour * 24;
32927    var secondsInWeek = secondsInDay * 7;
32928    var secondsInYear = secondsInDay * daysInYear;
32929    var secondsInMonth = secondsInYear / 12;
32930    var secondsInQuarter = secondsInMonth * 3;
32931    var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
32932  
32933    // packages/dataviews/node_modules/date-fns/constructFrom.js
32934    function constructFrom(date, value) {
32935      if (typeof date === "function") return date(value);
32936      if (date && typeof date === "object" && constructFromSymbol in date)
32937        return date[constructFromSymbol](value);
32938      if (date instanceof Date) return new date.constructor(value);
32939      return new Date(value);
32940    }
32941  
32942    // packages/dataviews/node_modules/date-fns/toDate.js
32943    function toDate(argument, context) {
32944      return constructFrom(context || argument, argument);
32945    }
32946  
32947    // packages/dataviews/node_modules/date-fns/addDays.js
32948    function addDays(date, amount, options) {
32949      const _date = toDate(date, options?.in);
32950      if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
32951      if (!amount) return _date;
32952      _date.setDate(_date.getDate() + amount);
32953      return _date;
32954    }
32955  
32956    // packages/dataviews/node_modules/date-fns/addMonths.js
32957    function addMonths(date, amount, options) {
32958      const _date = toDate(date, options?.in);
32959      if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
32960      if (!amount) {
32961        return _date;
32962      }
32963      const dayOfMonth = _date.getDate();
32964      const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
32965      endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
32966      const daysInMonth = endOfDesiredMonth.getDate();
32967      if (dayOfMonth >= daysInMonth) {
32968        return endOfDesiredMonth;
32969      } else {
32970        _date.setFullYear(
32971          endOfDesiredMonth.getFullYear(),
32972          endOfDesiredMonth.getMonth(),
32973          dayOfMonth
32974        );
32975        return _date;
32976      }
32977    }
32978  
32979    // packages/dataviews/node_modules/date-fns/_lib/defaultOptions.js
32980    var defaultOptions = {};
32981    function getDefaultOptions() {
32982      return defaultOptions;
32983    }
32984  
32985    // packages/dataviews/node_modules/date-fns/startOfWeek.js
32986    function startOfWeek(date, options) {
32987      const defaultOptions2 = getDefaultOptions();
32988      const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
32989      const _date = toDate(date, options?.in);
32990      const day = _date.getDay();
32991      const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
32992      _date.setDate(_date.getDate() - diff);
32993      _date.setHours(0, 0, 0, 0);
32994      return _date;
32995    }
32996  
32997    // packages/dataviews/node_modules/date-fns/startOfISOWeek.js
32998    function startOfISOWeek(date, options) {
32999      return startOfWeek(date, { ...options, weekStartsOn: 1 });
33000    }
33001  
33002    // packages/dataviews/node_modules/date-fns/getISOWeekYear.js
33003    function getISOWeekYear(date, options) {
33004      const _date = toDate(date, options?.in);
33005      const year = _date.getFullYear();
33006      const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
33007      fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
33008      fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
33009      const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
33010      const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
33011      fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
33012      fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
33013      const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
33014      if (_date.getTime() >= startOfNextYear.getTime()) {
33015        return year + 1;
33016      } else if (_date.getTime() >= startOfThisYear.getTime()) {
33017        return year;
33018      } else {
33019        return year - 1;
33020      }
33021    }
33022  
33023    // packages/dataviews/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
33024    function getTimezoneOffsetInMilliseconds(date) {
33025      const _date = toDate(date);
33026      const utcDate = new Date(
33027        Date.UTC(
33028          _date.getFullYear(),
33029          _date.getMonth(),
33030          _date.getDate(),
33031          _date.getHours(),
33032          _date.getMinutes(),
33033          _date.getSeconds(),
33034          _date.getMilliseconds()
33035        )
33036      );
33037      utcDate.setUTCFullYear(_date.getFullYear());
33038      return +date - +utcDate;
33039    }
33040  
33041    // packages/dataviews/node_modules/date-fns/_lib/normalizeDates.js
33042    function normalizeDates(context, ...dates) {
33043      const normalize = constructFrom.bind(
33044        null,
33045        context || dates.find((date) => typeof date === "object")
33046      );
33047      return dates.map(normalize);
33048    }
33049  
33050    // packages/dataviews/node_modules/date-fns/startOfDay.js
33051    function startOfDay(date, options) {
33052      const _date = toDate(date, options?.in);
33053      _date.setHours(0, 0, 0, 0);
33054      return _date;
33055    }
33056  
33057    // packages/dataviews/node_modules/date-fns/differenceInCalendarDays.js
33058    function differenceInCalendarDays(laterDate, earlierDate, options) {
33059      const [laterDate_, earlierDate_] = normalizeDates(
33060        options?.in,
33061        laterDate,
33062        earlierDate
33063      );
33064      const laterStartOfDay = startOfDay(laterDate_);
33065      const earlierStartOfDay = startOfDay(earlierDate_);
33066      const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
33067      const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
33068      return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
33069    }
33070  
33071    // packages/dataviews/node_modules/date-fns/startOfISOWeekYear.js
33072    function startOfISOWeekYear(date, options) {
33073      const year = getISOWeekYear(date, options);
33074      const fourthOfJanuary = constructFrom(options?.in || date, 0);
33075      fourthOfJanuary.setFullYear(year, 0, 4);
33076      fourthOfJanuary.setHours(0, 0, 0, 0);
33077      return startOfISOWeek(fourthOfJanuary);
33078    }
33079  
33080    // packages/dataviews/node_modules/date-fns/addWeeks.js
33081    function addWeeks(date, amount, options) {
33082      return addDays(date, amount * 7, options);
33083    }
33084  
33085    // packages/dataviews/node_modules/date-fns/addYears.js
33086    function addYears(date, amount, options) {
33087      return addMonths(date, amount * 12, options);
33088    }
33089  
33090    // packages/dataviews/node_modules/date-fns/isDate.js
33091    function isDate(value) {
33092      return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
33093    }
33094  
33095    // packages/dataviews/node_modules/date-fns/isValid.js
33096    function isValid(date) {
33097      return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
33098    }
33099  
33100    // packages/dataviews/node_modules/date-fns/startOfMonth.js
33101    function startOfMonth(date, options) {
33102      const _date = toDate(date, options?.in);
33103      _date.setDate(1);
33104      _date.setHours(0, 0, 0, 0);
33105      return _date;
33106    }
33107  
33108    // packages/dataviews/node_modules/date-fns/startOfYear.js
33109    function startOfYear(date, options) {
33110      const date_ = toDate(date, options?.in);
33111      date_.setFullYear(date_.getFullYear(), 0, 1);
33112      date_.setHours(0, 0, 0, 0);
33113      return date_;
33114    }
33115  
33116    // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/formatDistance.js
33117    var formatDistanceLocale = {
33118      lessThanXSeconds: {
33119        one: "less than a second",
33120        other: "less than {{count}} seconds"
33121      },
33122      xSeconds: {
33123        one: "1 second",
33124        other: "{{count}} seconds"
33125      },
33126      halfAMinute: "half a minute",
33127      lessThanXMinutes: {
33128        one: "less than a minute",
33129        other: "less than {{count}} minutes"
33130      },
33131      xMinutes: {
33132        one: "1 minute",
33133        other: "{{count}} minutes"
33134      },
33135      aboutXHours: {
33136        one: "about 1 hour",
33137        other: "about {{count}} hours"
33138      },
33139      xHours: {
33140        one: "1 hour",
33141        other: "{{count}} hours"
33142      },
33143      xDays: {
33144        one: "1 day",
33145        other: "{{count}} days"
33146      },
33147      aboutXWeeks: {
33148        one: "about 1 week",
33149        other: "about {{count}} weeks"
33150      },
33151      xWeeks: {
33152        one: "1 week",
33153        other: "{{count}} weeks"
33154      },
33155      aboutXMonths: {
33156        one: "about 1 month",
33157        other: "about {{count}} months"
33158      },
33159      xMonths: {
33160        one: "1 month",
33161        other: "{{count}} months"
33162      },
33163      aboutXYears: {
33164        one: "about 1 year",
33165        other: "about {{count}} years"
33166      },
33167      xYears: {
33168        one: "1 year",
33169        other: "{{count}} years"
33170      },
33171      overXYears: {
33172        one: "over 1 year",
33173        other: "over {{count}} years"
33174      },
33175      almostXYears: {
33176        one: "almost 1 year",
33177        other: "almost {{count}} years"
33178      }
33179    };
33180    var formatDistance = (token, count, options) => {
33181      let result;
33182      const tokenValue = formatDistanceLocale[token];
33183      if (typeof tokenValue === "string") {
33184        result = tokenValue;
33185      } else if (count === 1) {
33186        result = tokenValue.one;
33187      } else {
33188        result = tokenValue.other.replace("{{count}}", count.toString());
33189      }
33190      if (options?.addSuffix) {
33191        if (options.comparison && options.comparison > 0) {
33192          return "in " + result;
33193        } else {
33194          return result + " ago";
33195        }
33196      }
33197      return result;
33198    };
33199  
33200    // packages/dataviews/node_modules/date-fns/locale/_lib/buildFormatLongFn.js
33201    function buildFormatLongFn(args) {
33202      return (options = {}) => {
33203        const width = options.width ? String(options.width) : args.defaultWidth;
33204        const format6 = args.formats[width] || args.formats[args.defaultWidth];
33205        return format6;
33206      };
33207    }
33208  
33209    // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/formatLong.js
33210    var dateFormats = {
33211      full: "EEEE, MMMM do, y",
33212      long: "MMMM do, y",
33213      medium: "MMM d, y",
33214      short: "MM/dd/yyyy"
33215    };
33216    var timeFormats = {
33217      full: "h:mm:ss a zzzz",
33218      long: "h:mm:ss a z",
33219      medium: "h:mm:ss a",
33220      short: "h:mm a"
33221    };
33222    var dateTimeFormats = {
33223      full: "{{date}} 'at' {{time}}",
33224      long: "{{date}} 'at' {{time}}",
33225      medium: "{{date}}, {{time}}",
33226      short: "{{date}}, {{time}}"
33227    };
33228    var formatLong = {
33229      date: buildFormatLongFn({
33230        formats: dateFormats,
33231        defaultWidth: "full"
33232      }),
33233      time: buildFormatLongFn({
33234        formats: timeFormats,
33235        defaultWidth: "full"
33236      }),
33237      dateTime: buildFormatLongFn({
33238        formats: dateTimeFormats,
33239        defaultWidth: "full"
33240      })
33241    };
33242  
33243    // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/formatRelative.js
33244    var formatRelativeLocale = {
33245      lastWeek: "'last' eeee 'at' p",
33246      yesterday: "'yesterday at' p",
33247      today: "'today at' p",
33248      tomorrow: "'tomorrow at' p",
33249      nextWeek: "eeee 'at' p",
33250      other: "P"
33251    };
33252    var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
33253  
33254    // packages/dataviews/node_modules/date-fns/locale/_lib/buildLocalizeFn.js
33255    function buildLocalizeFn(args) {
33256      return (value, options) => {
33257        const context = options?.context ? String(options.context) : "standalone";
33258        let valuesArray;
33259        if (context === "formatting" && args.formattingValues) {
33260          const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
33261          const width = options?.width ? String(options.width) : defaultWidth;
33262          valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
33263        } else {
33264          const defaultWidth = args.defaultWidth;
33265          const width = options?.width ? String(options.width) : args.defaultWidth;
33266          valuesArray = args.values[width] || args.values[defaultWidth];
33267        }
33268        const index = args.argumentCallback ? args.argumentCallback(value) : value;
33269        return valuesArray[index];
33270      };
33271    }
33272  
33273    // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/localize.js
33274    var eraValues = {
33275      narrow: ["B", "A"],
33276      abbreviated: ["BC", "AD"],
33277      wide: ["Before Christ", "Anno Domini"]
33278    };
33279    var quarterValues = {
33280      narrow: ["1", "2", "3", "4"],
33281      abbreviated: ["Q1", "Q2", "Q3", "Q4"],
33282      wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
33283    };
33284    var monthValues = {
33285      narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
33286      abbreviated: [
33287        "Jan",
33288        "Feb",
33289        "Mar",
33290        "Apr",
33291        "May",
33292        "Jun",
33293        "Jul",
33294        "Aug",
33295        "Sep",
33296        "Oct",
33297        "Nov",
33298        "Dec"
33299      ],
33300      wide: [
33301        "January",
33302        "February",
33303        "March",
33304        "April",
33305        "May",
33306        "June",
33307        "July",
33308        "August",
33309        "September",
33310        "October",
33311        "November",
33312        "December"
33313      ]
33314    };
33315    var dayValues = {
33316      narrow: ["S", "M", "T", "W", "T", "F", "S"],
33317      short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
33318      abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
33319      wide: [
33320        "Sunday",
33321        "Monday",
33322        "Tuesday",
33323        "Wednesday",
33324        "Thursday",
33325        "Friday",
33326        "Saturday"
33327      ]
33328    };
33329    var dayPeriodValues = {
33330      narrow: {
33331        am: "a",
33332        pm: "p",
33333        midnight: "mi",
33334        noon: "n",
33335        morning: "morning",
33336        afternoon: "afternoon",
33337        evening: "evening",
33338        night: "night"
33339      },
33340      abbreviated: {
33341        am: "AM",
33342        pm: "PM",
33343        midnight: "midnight",
33344        noon: "noon",
33345        morning: "morning",
33346        afternoon: "afternoon",
33347        evening: "evening",
33348        night: "night"
33349      },
33350      wide: {
33351        am: "a.m.",
33352        pm: "p.m.",
33353        midnight: "midnight",
33354        noon: "noon",
33355        morning: "morning",
33356        afternoon: "afternoon",
33357        evening: "evening",
33358        night: "night"
33359      }
33360    };
33361    var formattingDayPeriodValues = {
33362      narrow: {
33363        am: "a",
33364        pm: "p",
33365        midnight: "mi",
33366        noon: "n",
33367        morning: "in the morning",
33368        afternoon: "in the afternoon",
33369        evening: "in the evening",
33370        night: "at night"
33371      },
33372      abbreviated: {
33373        am: "AM",
33374        pm: "PM",
33375        midnight: "midnight",
33376        noon: "noon",
33377        morning: "in the morning",
33378        afternoon: "in the afternoon",
33379        evening: "in the evening",
33380        night: "at night"
33381      },
33382      wide: {
33383        am: "a.m.",
33384        pm: "p.m.",
33385        midnight: "midnight",
33386        noon: "noon",
33387        morning: "in the morning",
33388        afternoon: "in the afternoon",
33389        evening: "in the evening",
33390        night: "at night"
33391      }
33392    };
33393    var ordinalNumber = (dirtyNumber, _options) => {
33394      const number = Number(dirtyNumber);
33395      const rem100 = number % 100;
33396      if (rem100 > 20 || rem100 < 10) {
33397        switch (rem100 % 10) {
33398          case 1:
33399            return number + "st";
33400          case 2:
33401            return number + "nd";
33402          case 3:
33403            return number + "rd";
33404        }
33405      }
33406      return number + "th";
33407    };
33408    var localize = {
33409      ordinalNumber,
33410      era: buildLocalizeFn({
33411        values: eraValues,
33412        defaultWidth: "wide"
33413      }),
33414      quarter: buildLocalizeFn({
33415        values: quarterValues,
33416        defaultWidth: "wide",
33417        argumentCallback: (quarter) => quarter - 1
33418      }),
33419      month: buildLocalizeFn({
33420        values: monthValues,
33421        defaultWidth: "wide"
33422      }),
33423      day: buildLocalizeFn({
33424        values: dayValues,
33425        defaultWidth: "wide"
33426      }),
33427      dayPeriod: buildLocalizeFn({
33428        values: dayPeriodValues,
33429        defaultWidth: "wide",
33430        formattingValues: formattingDayPeriodValues,
33431        defaultFormattingWidth: "wide"
33432      })
33433    };
33434  
33435    // packages/dataviews/node_modules/date-fns/locale/_lib/buildMatchFn.js
33436    function buildMatchFn(args) {
33437      return (string, options = {}) => {
33438        const width = options.width;
33439        const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
33440        const matchResult = string.match(matchPattern);
33441        if (!matchResult) {
33442          return null;
33443        }
33444        const matchedString = matchResult[0];
33445        const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
33446        const key = Array.isArray(parsePatterns) ? findIndex2(parsePatterns, (pattern) => pattern.test(matchedString)) : (
33447          // [TODO] -- I challenge you to fix the type
33448          findKey(parsePatterns, (pattern) => pattern.test(matchedString))
33449        );
33450        let value;
33451        value = args.valueCallback ? args.valueCallback(key) : key;
33452        value = options.valueCallback ? (
33453          // [TODO] -- I challenge you to fix the type
33454          options.valueCallback(value)
33455        ) : value;
33456        const rest = string.slice(matchedString.length);
33457        return { value, rest };
33458      };
33459    }
33460    function findKey(object, predicate) {
33461      for (const key in object) {
33462        if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
33463          return key;
33464        }
33465      }
33466      return void 0;
33467    }
33468    function findIndex2(array, predicate) {
33469      for (let key = 0; key < array.length; key++) {
33470        if (predicate(array[key])) {
33471          return key;
33472        }
33473      }
33474      return void 0;
33475    }
33476  
33477    // packages/dataviews/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
33478    function buildMatchPatternFn(args) {
33479      return (string, options = {}) => {
33480        const matchResult = string.match(args.matchPattern);
33481        if (!matchResult) return null;
33482        const matchedString = matchResult[0];
33483        const parseResult = string.match(args.parsePattern);
33484        if (!parseResult) return null;
33485        let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
33486        value = options.valueCallback ? options.valueCallback(value) : value;
33487        const rest = string.slice(matchedString.length);
33488        return { value, rest };
33489      };
33490    }
33491  
33492    // packages/dataviews/node_modules/date-fns/locale/en-US/_lib/match.js
33493    var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
33494    var parseOrdinalNumberPattern = /\d+/i;
33495    var matchEraPatterns = {
33496      narrow: /^(b|a)/i,
33497      abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
33498      wide: /^(before christ|before common era|anno domini|common era)/i
33499    };
33500    var parseEraPatterns = {
33501      any: [/^b/i, /^(a|c)/i]
33502    };
33503    var matchQuarterPatterns = {
33504      narrow: /^[1234]/i,
33505      abbreviated: /^q[1234]/i,
33506      wide: /^[1234](th|st|nd|rd)? quarter/i
33507    };
33508    var parseQuarterPatterns = {
33509      any: [/1/i, /2/i, /3/i, /4/i]
33510    };
33511    var matchMonthPatterns = {
33512      narrow: /^[jfmasond]/i,
33513      abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
33514      wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
33515    };
33516    var parseMonthPatterns = {
33517      narrow: [
33518        /^j/i,
33519        /^f/i,
33520        /^m/i,
33521        /^a/i,
33522        /^m/i,
33523        /^j/i,
33524        /^j/i,
33525        /^a/i,
33526        /^s/i,
33527        /^o/i,
33528        /^n/i,
33529        /^d/i
33530      ],
33531      any: [
33532        /^ja/i,
33533        /^f/i,
33534        /^mar/i,
33535        /^ap/i,
33536        /^may/i,
33537        /^jun/i,
33538        /^jul/i,
33539        /^au/i,
33540        /^s/i,
33541        /^o/i,
33542        /^n/i,
33543        /^d/i
33544      ]
33545    };
33546    var matchDayPatterns = {
33547      narrow: /^[smtwf]/i,
33548      short: /^(su|mo|tu|we|th|fr|sa)/i,
33549      abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
33550      wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
33551    };
33552    var parseDayPatterns = {
33553      narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
33554      any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
33555    };
33556    var matchDayPeriodPatterns = {
33557      narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
33558      any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
33559    };
33560    var parseDayPeriodPatterns = {
33561      any: {
33562        am: /^a/i,
33563        pm: /^p/i,
33564        midnight: /^mi/i,
33565        noon: /^no/i,
33566        morning: /morning/i,
33567        afternoon: /afternoon/i,
33568        evening: /evening/i,
33569        night: /night/i
33570      }
33571    };
33572    var match2 = {
33573      ordinalNumber: buildMatchPatternFn({
33574        matchPattern: matchOrdinalNumberPattern,
33575        parsePattern: parseOrdinalNumberPattern,
33576        valueCallback: (value) => parseInt(value, 10)
33577      }),
33578      era: buildMatchFn({
33579        matchPatterns: matchEraPatterns,
33580        defaultMatchWidth: "wide",
33581        parsePatterns: parseEraPatterns,
33582        defaultParseWidth: "any"
33583      }),
33584      quarter: buildMatchFn({
33585        matchPatterns: matchQuarterPatterns,
33586        defaultMatchWidth: "wide",
33587        parsePatterns: parseQuarterPatterns,
33588        defaultParseWidth: "any",
33589        valueCallback: (index) => index + 1
33590      }),
33591      month: buildMatchFn({
33592        matchPatterns: matchMonthPatterns,
33593        defaultMatchWidth: "wide",
33594        parsePatterns: parseMonthPatterns,
33595        defaultParseWidth: "any"
33596      }),
33597      day: buildMatchFn({
33598        matchPatterns: matchDayPatterns,
33599        defaultMatchWidth: "wide",
33600        parsePatterns: parseDayPatterns,
33601        defaultParseWidth: "any"
33602      }),
33603      dayPeriod: buildMatchFn({
33604        matchPatterns: matchDayPeriodPatterns,
33605        defaultMatchWidth: "any",
33606        parsePatterns: parseDayPeriodPatterns,
33607        defaultParseWidth: "any"
33608      })
33609    };
33610  
33611    // packages/dataviews/node_modules/date-fns/locale/en-US.js
33612    var enUS = {
33613      code: "en-US",
33614      formatDistance,
33615      formatLong,
33616      formatRelative,
33617      localize,
33618      match: match2,
33619      options: {
33620        weekStartsOn: 0,
33621        firstWeekContainsDate: 1
33622      }
33623    };
33624  
33625    // packages/dataviews/node_modules/date-fns/getDayOfYear.js
33626    function getDayOfYear(date, options) {
33627      const _date = toDate(date, options?.in);
33628      const diff = differenceInCalendarDays(_date, startOfYear(_date));
33629      const dayOfYear = diff + 1;
33630      return dayOfYear;
33631    }
33632  
33633    // packages/dataviews/node_modules/date-fns/getISOWeek.js
33634    function getISOWeek(date, options) {
33635      const _date = toDate(date, options?.in);
33636      const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
33637      return Math.round(diff / millisecondsInWeek) + 1;
33638    }
33639  
33640    // packages/dataviews/node_modules/date-fns/getWeekYear.js
33641    function getWeekYear(date, options) {
33642      const _date = toDate(date, options?.in);
33643      const year = _date.getFullYear();
33644      const defaultOptions2 = getDefaultOptions();
33645      const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
33646      const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
33647      firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
33648      firstWeekOfNextYear.setHours(0, 0, 0, 0);
33649      const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
33650      const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
33651      firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
33652      firstWeekOfThisYear.setHours(0, 0, 0, 0);
33653      const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
33654      if (+_date >= +startOfNextYear) {
33655        return year + 1;
33656      } else if (+_date >= +startOfThisYear) {
33657        return year;
33658      } else {
33659        return year - 1;
33660      }
33661    }
33662  
33663    // packages/dataviews/node_modules/date-fns/startOfWeekYear.js
33664    function startOfWeekYear(date, options) {
33665      const defaultOptions2 = getDefaultOptions();
33666      const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
33667      const year = getWeekYear(date, options);
33668      const firstWeek = constructFrom(options?.in || date, 0);
33669      firstWeek.setFullYear(year, 0, firstWeekContainsDate);
33670      firstWeek.setHours(0, 0, 0, 0);
33671      const _date = startOfWeek(firstWeek, options);
33672      return _date;
33673    }
33674  
33675    // packages/dataviews/node_modules/date-fns/getWeek.js
33676    function getWeek(date, options) {
33677      const _date = toDate(date, options?.in);
33678      const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
33679      return Math.round(diff / millisecondsInWeek) + 1;
33680    }
33681  
33682    // packages/dataviews/node_modules/date-fns/_lib/addLeadingZeros.js
33683    function addLeadingZeros(number, targetLength) {
33684      const sign = number < 0 ? "-" : "";
33685      const output = Math.abs(number).toString().padStart(targetLength, "0");
33686      return sign + output;
33687    }
33688  
33689    // packages/dataviews/node_modules/date-fns/_lib/format/lightFormatters.js
33690    var lightFormatters = {
33691      // Year
33692      y(date, token) {
33693        const signedYear = date.getFullYear();
33694        const year = signedYear > 0 ? signedYear : 1 - signedYear;
33695        return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
33696      },
33697      // Month
33698      M(date, token) {
33699        const month = date.getMonth();
33700        return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
33701      },
33702      // Day of the month
33703      d(date, token) {
33704        return addLeadingZeros(date.getDate(), token.length);
33705      },
33706      // AM or PM
33707      a(date, token) {
33708        const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
33709        switch (token) {
33710          case "a":
33711          case "aa":
33712            return dayPeriodEnumValue.toUpperCase();
33713          case "aaa":
33714            return dayPeriodEnumValue;
33715          case "aaaaa":
33716            return dayPeriodEnumValue[0];
33717          case "aaaa":
33718          default:
33719            return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
33720        }
33721      },
33722      // Hour [1-12]
33723      h(date, token) {
33724        return addLeadingZeros(date.getHours() % 12 || 12, token.length);
33725      },
33726      // Hour [0-23]
33727      H(date, token) {
33728        return addLeadingZeros(date.getHours(), token.length);
33729      },
33730      // Minute
33731      m(date, token) {
33732        return addLeadingZeros(date.getMinutes(), token.length);
33733      },
33734      // Second
33735      s(date, token) {
33736        return addLeadingZeros(date.getSeconds(), token.length);
33737      },
33738      // Fraction of second
33739      S(date, token) {
33740        const numberOfDigits = token.length;
33741        const milliseconds = date.getMilliseconds();
33742        const fractionalSeconds = Math.trunc(
33743          milliseconds * Math.pow(10, numberOfDigits - 3)
33744        );
33745        return addLeadingZeros(fractionalSeconds, token.length);
33746      }
33747    };
33748  
33749    // packages/dataviews/node_modules/date-fns/_lib/format/formatters.js
33750    var dayPeriodEnum = {
33751      am: "am",
33752      pm: "pm",
33753      midnight: "midnight",
33754      noon: "noon",
33755      morning: "morning",
33756      afternoon: "afternoon",
33757      evening: "evening",
33758      night: "night"
33759    };
33760    var formatters = {
33761      // Era
33762      G: function(date, token, localize2) {
33763        const era = date.getFullYear() > 0 ? 1 : 0;
33764        switch (token) {
33765          // AD, BC
33766          case "G":
33767          case "GG":
33768          case "GGG":
33769            return localize2.era(era, { width: "abbreviated" });
33770          // A, B
33771          case "GGGGG":
33772            return localize2.era(era, { width: "narrow" });
33773          // Anno Domini, Before Christ
33774          case "GGGG":
33775          default:
33776            return localize2.era(era, { width: "wide" });
33777        }
33778      },
33779      // Year
33780      y: function(date, token, localize2) {
33781        if (token === "yo") {
33782          const signedYear = date.getFullYear();
33783          const year = signedYear > 0 ? signedYear : 1 - signedYear;
33784          return localize2.ordinalNumber(year, { unit: "year" });
33785        }
33786        return lightFormatters.y(date, token);
33787      },
33788      // Local week-numbering year
33789      Y: function(date, token, localize2, options) {
33790        const signedWeekYear = getWeekYear(date, options);
33791        const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
33792        if (token === "YY") {
33793          const twoDigitYear = weekYear % 100;
33794          return addLeadingZeros(twoDigitYear, 2);
33795        }
33796        if (token === "Yo") {
33797          return localize2.ordinalNumber(weekYear, { unit: "year" });
33798        }
33799        return addLeadingZeros(weekYear, token.length);
33800      },
33801      // ISO week-numbering year
33802      R: function(date, token) {
33803        const isoWeekYear = getISOWeekYear(date);
33804        return addLeadingZeros(isoWeekYear, token.length);
33805      },
33806      // Extended year. This is a single number designating the year of this calendar system.
33807      // The main difference between `y` and `u` localizers are B.C. years:
33808      // | Year | `y` | `u` |
33809      // |------|-----|-----|
33810      // | AC 1 |   1 |   1 |
33811      // | BC 1 |   1 |   0 |
33812      // | BC 2 |   2 |  -1 |
33813      // Also `yy` always returns the last two digits of a year,
33814      // while `uu` pads single digit years to 2 characters and returns other years unchanged.
33815      u: function(date, token) {
33816        const year = date.getFullYear();
33817        return addLeadingZeros(year, token.length);
33818      },
33819      // Quarter
33820      Q: function(date, token, localize2) {
33821        const quarter = Math.ceil((date.getMonth() + 1) / 3);
33822        switch (token) {
33823          // 1, 2, 3, 4
33824          case "Q":
33825            return String(quarter);
33826          // 01, 02, 03, 04
33827          case "QQ":
33828            return addLeadingZeros(quarter, 2);
33829          // 1st, 2nd, 3rd, 4th
33830          case "Qo":
33831            return localize2.ordinalNumber(quarter, { unit: "quarter" });
33832          // Q1, Q2, Q3, Q4
33833          case "QQQ":
33834            return localize2.quarter(quarter, {
33835              width: "abbreviated",
33836              context: "formatting"
33837            });
33838          // 1, 2, 3, 4 (narrow quarter; could be not numerical)
33839          case "QQQQQ":
33840            return localize2.quarter(quarter, {
33841              width: "narrow",
33842              context: "formatting"
33843            });
33844          // 1st quarter, 2nd quarter, ...
33845          case "QQQQ":
33846          default:
33847            return localize2.quarter(quarter, {
33848              width: "wide",
33849              context: "formatting"
33850            });
33851        }
33852      },
33853      // Stand-alone quarter
33854      q: function(date, token, localize2) {
33855        const quarter = Math.ceil((date.getMonth() + 1) / 3);
33856        switch (token) {
33857          // 1, 2, 3, 4
33858          case "q":
33859            return String(quarter);
33860          // 01, 02, 03, 04
33861          case "qq":
33862            return addLeadingZeros(quarter, 2);
33863          // 1st, 2nd, 3rd, 4th
33864          case "qo":
33865            return localize2.ordinalNumber(quarter, { unit: "quarter" });
33866          // Q1, Q2, Q3, Q4
33867          case "qqq":
33868            return localize2.quarter(quarter, {
33869              width: "abbreviated",
33870              context: "standalone"
33871            });
33872          // 1, 2, 3, 4 (narrow quarter; could be not numerical)
33873          case "qqqqq":
33874            return localize2.quarter(quarter, {
33875              width: "narrow",
33876              context: "standalone"
33877            });
33878          // 1st quarter, 2nd quarter, ...
33879          case "qqqq":
33880          default:
33881            return localize2.quarter(quarter, {
33882              width: "wide",
33883              context: "standalone"
33884            });
33885        }
33886      },
33887      // Month
33888      M: function(date, token, localize2) {
33889        const month = date.getMonth();
33890        switch (token) {
33891          case "M":
33892          case "MM":
33893            return lightFormatters.M(date, token);
33894          // 1st, 2nd, ..., 12th
33895          case "Mo":
33896            return localize2.ordinalNumber(month + 1, { unit: "month" });
33897          // Jan, Feb, ..., Dec
33898          case "MMM":
33899            return localize2.month(month, {
33900              width: "abbreviated",
33901              context: "formatting"
33902            });
33903          // J, F, ..., D
33904          case "MMMMM":
33905            return localize2.month(month, {
33906              width: "narrow",
33907              context: "formatting"
33908            });
33909          // January, February, ..., December
33910          case "MMMM":
33911          default:
33912            return localize2.month(month, { width: "wide", context: "formatting" });
33913        }
33914      },
33915      // Stand-alone month
33916      L: function(date, token, localize2) {
33917        const month = date.getMonth();
33918        switch (token) {
33919          // 1, 2, ..., 12
33920          case "L":
33921            return String(month + 1);
33922          // 01, 02, ..., 12
33923          case "LL":
33924            return addLeadingZeros(month + 1, 2);
33925          // 1st, 2nd, ..., 12th
33926          case "Lo":
33927            return localize2.ordinalNumber(month + 1, { unit: "month" });
33928          // Jan, Feb, ..., Dec
33929          case "LLL":
33930            return localize2.month(month, {
33931              width: "abbreviated",
33932              context: "standalone"
33933            });
33934          // J, F, ..., D
33935          case "LLLLL":
33936            return localize2.month(month, {
33937              width: "narrow",
33938              context: "standalone"
33939            });
33940          // January, February, ..., December
33941          case "LLLL":
33942          default:
33943            return localize2.month(month, { width: "wide", context: "standalone" });
33944        }
33945      },
33946      // Local week of year
33947      w: function(date, token, localize2, options) {
33948        const week = getWeek(date, options);
33949        if (token === "wo") {
33950          return localize2.ordinalNumber(week, { unit: "week" });
33951        }
33952        return addLeadingZeros(week, token.length);
33953      },
33954      // ISO week of year
33955      I: function(date, token, localize2) {
33956        const isoWeek = getISOWeek(date);
33957        if (token === "Io") {
33958          return localize2.ordinalNumber(isoWeek, { unit: "week" });
33959        }
33960        return addLeadingZeros(isoWeek, token.length);
33961      },
33962      // Day of the month
33963      d: function(date, token, localize2) {
33964        if (token === "do") {
33965          return localize2.ordinalNumber(date.getDate(), { unit: "date" });
33966        }
33967        return lightFormatters.d(date, token);
33968      },
33969      // Day of year
33970      D: function(date, token, localize2) {
33971        const dayOfYear = getDayOfYear(date);
33972        if (token === "Do") {
33973          return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
33974        }
33975        return addLeadingZeros(dayOfYear, token.length);
33976      },
33977      // Day of week
33978      E: function(date, token, localize2) {
33979        const dayOfWeek = date.getDay();
33980        switch (token) {
33981          // Tue
33982          case "E":
33983          case "EE":
33984          case "EEE":
33985            return localize2.day(dayOfWeek, {
33986              width: "abbreviated",
33987              context: "formatting"
33988            });
33989          // T
33990          case "EEEEE":
33991            return localize2.day(dayOfWeek, {
33992              width: "narrow",
33993              context: "formatting"
33994            });
33995          // Tu
33996          case "EEEEEE":
33997            return localize2.day(dayOfWeek, {
33998              width: "short",
33999              context: "formatting"
34000            });
34001          // Tuesday
34002          case "EEEE":
34003          default:
34004            return localize2.day(dayOfWeek, {
34005              width: "wide",
34006              context: "formatting"
34007            });
34008        }
34009      },
34010      // Local day of week
34011      e: function(date, token, localize2, options) {
34012        const dayOfWeek = date.getDay();
34013        const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
34014        switch (token) {
34015          // Numerical value (Nth day of week with current locale or weekStartsOn)
34016          case "e":
34017            return String(localDayOfWeek);
34018          // Padded numerical value
34019          case "ee":
34020            return addLeadingZeros(localDayOfWeek, 2);
34021          // 1st, 2nd, ..., 7th
34022          case "eo":
34023            return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
34024          case "eee":
34025            return localize2.day(dayOfWeek, {
34026              width: "abbreviated",
34027              context: "formatting"
34028            });
34029          // T
34030          case "eeeee":
34031            return localize2.day(dayOfWeek, {
34032              width: "narrow",
34033              context: "formatting"
34034            });
34035          // Tu
34036          case "eeeeee":
34037            return localize2.day(dayOfWeek, {
34038              width: "short",
34039              context: "formatting"
34040            });
34041          // Tuesday
34042          case "eeee":
34043          default:
34044            return localize2.day(dayOfWeek, {
34045              width: "wide",
34046              context: "formatting"
34047            });
34048        }
34049      },
34050      // Stand-alone local day of week
34051      c: function(date, token, localize2, options) {
34052        const dayOfWeek = date.getDay();
34053        const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
34054        switch (token) {
34055          // Numerical value (same as in `e`)
34056          case "c":
34057            return String(localDayOfWeek);
34058          // Padded numerical value
34059          case "cc":
34060            return addLeadingZeros(localDayOfWeek, token.length);
34061          // 1st, 2nd, ..., 7th
34062          case "co":
34063            return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
34064          case "ccc":
34065            return localize2.day(dayOfWeek, {
34066              width: "abbreviated",
34067              context: "standalone"
34068            });
34069          // T
34070          case "ccccc":
34071            return localize2.day(dayOfWeek, {
34072              width: "narrow",
34073              context: "standalone"
34074            });
34075          // Tu
34076          case "cccccc":
34077            return localize2.day(dayOfWeek, {
34078              width: "short",
34079              context: "standalone"
34080            });
34081          // Tuesday
34082          case "cccc":
34083          default:
34084            return localize2.day(dayOfWeek, {
34085              width: "wide",
34086              context: "standalone"
34087            });
34088        }
34089      },
34090      // ISO day of week
34091      i: function(date, token, localize2) {
34092        const dayOfWeek = date.getDay();
34093        const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
34094        switch (token) {
34095          // 2
34096          case "i":
34097            return String(isoDayOfWeek);
34098          // 02
34099          case "ii":
34100            return addLeadingZeros(isoDayOfWeek, token.length);
34101          // 2nd
34102          case "io":
34103            return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
34104          // Tue
34105          case "iii":
34106            return localize2.day(dayOfWeek, {
34107              width: "abbreviated",
34108              context: "formatting"
34109            });
34110          // T
34111          case "iiiii":
34112            return localize2.day(dayOfWeek, {
34113              width: "narrow",
34114              context: "formatting"
34115            });
34116          // Tu
34117          case "iiiiii":
34118            return localize2.day(dayOfWeek, {
34119              width: "short",
34120              context: "formatting"
34121            });
34122          // Tuesday
34123          case "iiii":
34124          default:
34125            return localize2.day(dayOfWeek, {
34126              width: "wide",
34127              context: "formatting"
34128            });
34129        }
34130      },
34131      // AM or PM
34132      a: function(date, token, localize2) {
34133        const hours = date.getHours();
34134        const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
34135        switch (token) {
34136          case "a":
34137          case "aa":
34138            return localize2.dayPeriod(dayPeriodEnumValue, {
34139              width: "abbreviated",
34140              context: "formatting"
34141            });
34142          case "aaa":
34143            return localize2.dayPeriod(dayPeriodEnumValue, {
34144              width: "abbreviated",
34145              context: "formatting"
34146            }).toLowerCase();
34147          case "aaaaa":
34148            return localize2.dayPeriod(dayPeriodEnumValue, {
34149              width: "narrow",
34150              context: "formatting"
34151            });
34152          case "aaaa":
34153          default:
34154            return localize2.dayPeriod(dayPeriodEnumValue, {
34155              width: "wide",
34156              context: "formatting"
34157            });
34158        }
34159      },
34160      // AM, PM, midnight, noon
34161      b: function(date, token, localize2) {
34162        const hours = date.getHours();
34163        let dayPeriodEnumValue;
34164        if (hours === 12) {
34165          dayPeriodEnumValue = dayPeriodEnum.noon;
34166        } else if (hours === 0) {
34167          dayPeriodEnumValue = dayPeriodEnum.midnight;
34168        } else {
34169          dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
34170        }
34171        switch (token) {
34172          case "b":
34173          case "bb":
34174            return localize2.dayPeriod(dayPeriodEnumValue, {
34175              width: "abbreviated",
34176              context: "formatting"
34177            });
34178          case "bbb":
34179            return localize2.dayPeriod(dayPeriodEnumValue, {
34180              width: "abbreviated",
34181              context: "formatting"
34182            }).toLowerCase();
34183          case "bbbbb":
34184            return localize2.dayPeriod(dayPeriodEnumValue, {
34185              width: "narrow",
34186              context: "formatting"
34187            });
34188          case "bbbb":
34189          default:
34190            return localize2.dayPeriod(dayPeriodEnumValue, {
34191              width: "wide",
34192              context: "formatting"
34193            });
34194        }
34195      },
34196      // in the morning, in the afternoon, in the evening, at night
34197      B: function(date, token, localize2) {
34198        const hours = date.getHours();
34199        let dayPeriodEnumValue;
34200        if (hours >= 17) {
34201          dayPeriodEnumValue = dayPeriodEnum.evening;
34202        } else if (hours >= 12) {
34203          dayPeriodEnumValue = dayPeriodEnum.afternoon;
34204        } else if (hours >= 4) {
34205          dayPeriodEnumValue = dayPeriodEnum.morning;
34206        } else {
34207          dayPeriodEnumValue = dayPeriodEnum.night;
34208        }
34209        switch (token) {
34210          case "B":
34211          case "BB":
34212          case "BBB":
34213            return localize2.dayPeriod(dayPeriodEnumValue, {
34214              width: "abbreviated",
34215              context: "formatting"
34216            });
34217          case "BBBBB":
34218            return localize2.dayPeriod(dayPeriodEnumValue, {
34219              width: "narrow",
34220              context: "formatting"
34221            });
34222          case "BBBB":
34223          default:
34224            return localize2.dayPeriod(dayPeriodEnumValue, {
34225              width: "wide",
34226              context: "formatting"
34227            });
34228        }
34229      },
34230      // Hour [1-12]
34231      h: function(date, token, localize2) {
34232        if (token === "ho") {
34233          let hours = date.getHours() % 12;
34234          if (hours === 0) hours = 12;
34235          return localize2.ordinalNumber(hours, { unit: "hour" });
34236        }
34237        return lightFormatters.h(date, token);
34238      },
34239      // Hour [0-23]
34240      H: function(date, token, localize2) {
34241        if (token === "Ho") {
34242          return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
34243        }
34244        return lightFormatters.H(date, token);
34245      },
34246      // Hour [0-11]
34247      K: function(date, token, localize2) {
34248        const hours = date.getHours() % 12;
34249        if (token === "Ko") {
34250          return localize2.ordinalNumber(hours, { unit: "hour" });
34251        }
34252        return addLeadingZeros(hours, token.length);
34253      },
34254      // Hour [1-24]
34255      k: function(date, token, localize2) {
34256        let hours = date.getHours();
34257        if (hours === 0) hours = 24;
34258        if (token === "ko") {
34259          return localize2.ordinalNumber(hours, { unit: "hour" });
34260        }
34261        return addLeadingZeros(hours, token.length);
34262      },
34263      // Minute
34264      m: function(date, token, localize2) {
34265        if (token === "mo") {
34266          return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
34267        }
34268        return lightFormatters.m(date, token);
34269      },
34270      // Second
34271      s: function(date, token, localize2) {
34272        if (token === "so") {
34273          return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
34274        }
34275        return lightFormatters.s(date, token);
34276      },
34277      // Fraction of second
34278      S: function(date, token) {
34279        return lightFormatters.S(date, token);
34280      },
34281      // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
34282      X: function(date, token, _localize) {
34283        const timezoneOffset = date.getTimezoneOffset();
34284        if (timezoneOffset === 0) {
34285          return "Z";
34286        }
34287        switch (token) {
34288          // Hours and optional minutes
34289          case "X":
34290            return formatTimezoneWithOptionalMinutes(timezoneOffset);
34291          // Hours, minutes and optional seconds without `:` delimiter
34292          // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
34293          // so this token always has the same output as `XX`
34294          case "XXXX":
34295          case "XX":
34296            return formatTimezone(timezoneOffset);
34297          // Hours, minutes and optional seconds with `:` delimiter
34298          // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
34299          // so this token always has the same output as `XXX`
34300          case "XXXXX":
34301          case "XXX":
34302          // Hours and minutes with `:` delimiter
34303          default:
34304            return formatTimezone(timezoneOffset, ":");
34305        }
34306      },
34307      // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
34308      x: function(date, token, _localize) {
34309        const timezoneOffset = date.getTimezoneOffset();
34310        switch (token) {
34311          // Hours and optional minutes
34312          case "x":
34313            return formatTimezoneWithOptionalMinutes(timezoneOffset);
34314          // Hours, minutes and optional seconds without `:` delimiter
34315          // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
34316          // so this token always has the same output as `xx`
34317          case "xxxx":
34318          case "xx":
34319            return formatTimezone(timezoneOffset);
34320          // Hours, minutes and optional seconds with `:` delimiter
34321          // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
34322          // so this token always has the same output as `xxx`
34323          case "xxxxx":
34324          case "xxx":
34325          // Hours and minutes with `:` delimiter
34326          default:
34327            return formatTimezone(timezoneOffset, ":");
34328        }
34329      },
34330      // Timezone (GMT)
34331      O: function(date, token, _localize) {
34332        const timezoneOffset = date.getTimezoneOffset();
34333        switch (token) {
34334          // Short
34335          case "O":
34336          case "OO":
34337          case "OOO":
34338            return "GMT" + formatTimezoneShort(timezoneOffset, ":");
34339          // Long
34340          case "OOOO":
34341          default:
34342            return "GMT" + formatTimezone(timezoneOffset, ":");
34343        }
34344      },
34345      // Timezone (specific non-location)
34346      z: function(date, token, _localize) {
34347        const timezoneOffset = date.getTimezoneOffset();
34348        switch (token) {
34349          // Short
34350          case "z":
34351          case "zz":
34352          case "zzz":
34353            return "GMT" + formatTimezoneShort(timezoneOffset, ":");
34354          // Long
34355          case "zzzz":
34356          default:
34357            return "GMT" + formatTimezone(timezoneOffset, ":");
34358        }
34359      },
34360      // Seconds timestamp
34361      t: function(date, token, _localize) {
34362        const timestamp = Math.trunc(+date / 1e3);
34363        return addLeadingZeros(timestamp, token.length);
34364      },
34365      // Milliseconds timestamp
34366      T: function(date, token, _localize) {
34367        return addLeadingZeros(+date, token.length);
34368      }
34369    };
34370    function formatTimezoneShort(offset, delimiter = "") {
34371      const sign = offset > 0 ? "-" : "+";
34372      const absOffset = Math.abs(offset);
34373      const hours = Math.trunc(absOffset / 60);
34374      const minutes = absOffset % 60;
34375      if (minutes === 0) {
34376        return sign + String(hours);
34377      }
34378      return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
34379    }
34380    function formatTimezoneWithOptionalMinutes(offset, delimiter) {
34381      if (offset % 60 === 0) {
34382        const sign = offset > 0 ? "-" : "+";
34383        return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
34384      }
34385      return formatTimezone(offset, delimiter);
34386    }
34387    function formatTimezone(offset, delimiter = "") {
34388      const sign = offset > 0 ? "-" : "+";
34389      const absOffset = Math.abs(offset);
34390      const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
34391      const minutes = addLeadingZeros(absOffset % 60, 2);
34392      return sign + hours + delimiter + minutes;
34393    }
34394  
34395    // packages/dataviews/node_modules/date-fns/_lib/format/longFormatters.js
34396    var dateLongFormatter = (pattern, formatLong2) => {
34397      switch (pattern) {
34398        case "P":
34399          return formatLong2.date({ width: "short" });
34400        case "PP":
34401          return formatLong2.date({ width: "medium" });
34402        case "PPP":
34403          return formatLong2.date({ width: "long" });
34404        case "PPPP":
34405        default:
34406          return formatLong2.date({ width: "full" });
34407      }
34408    };
34409    var timeLongFormatter = (pattern, formatLong2) => {
34410      switch (pattern) {
34411        case "p":
34412          return formatLong2.time({ width: "short" });
34413        case "pp":
34414          return formatLong2.time({ width: "medium" });
34415        case "ppp":
34416          return formatLong2.time({ width: "long" });
34417        case "pppp":
34418        default:
34419          return formatLong2.time({ width: "full" });
34420      }
34421    };
34422    var dateTimeLongFormatter = (pattern, formatLong2) => {
34423      const matchResult = pattern.match(/(P+)(p+)?/) || [];
34424      const datePattern = matchResult[1];
34425      const timePattern = matchResult[2];
34426      if (!timePattern) {
34427        return dateLongFormatter(pattern, formatLong2);
34428      }
34429      let dateTimeFormat;
34430      switch (datePattern) {
34431        case "P":
34432          dateTimeFormat = formatLong2.dateTime({ width: "short" });
34433          break;
34434        case "PP":
34435          dateTimeFormat = formatLong2.dateTime({ width: "medium" });
34436          break;
34437        case "PPP":
34438          dateTimeFormat = formatLong2.dateTime({ width: "long" });
34439          break;
34440        case "PPPP":
34441        default:
34442          dateTimeFormat = formatLong2.dateTime({ width: "full" });
34443          break;
34444      }
34445      return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
34446    };
34447    var longFormatters = {
34448      p: timeLongFormatter,
34449      P: dateTimeLongFormatter
34450    };
34451  
34452    // packages/dataviews/node_modules/date-fns/_lib/protectedTokens.js
34453    var dayOfYearTokenRE = /^D+$/;
34454    var weekYearTokenRE = /^Y+$/;
34455    var throwTokens = ["D", "DD", "YY", "YYYY"];
34456    function isProtectedDayOfYearToken(token) {
34457      return dayOfYearTokenRE.test(token);
34458    }
34459    function isProtectedWeekYearToken(token) {
34460      return weekYearTokenRE.test(token);
34461    }
34462    function warnOrThrowProtectedError(token, format6, input) {
34463      const _message = message(token, format6, input);
34464      console.warn(_message);
34465      if (throwTokens.includes(token)) throw new RangeError(_message);
34466    }
34467    function message(token, format6, input) {
34468      const subject = token[0] === "Y" ? "years" : "days of the month";
34469      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`;
34470    }
34471  
34472    // packages/dataviews/node_modules/date-fns/format.js
34473    var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
34474    var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
34475    var escapedStringRegExp = /^'([^]*?)'?$/;
34476    var doubleQuoteRegExp = /''/g;
34477    var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
34478    function format(date, formatStr, options) {
34479      const defaultOptions2 = getDefaultOptions();
34480      const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
34481      const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
34482      const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
34483      const originalDate = toDate(date, options?.in);
34484      if (!isValid(originalDate)) {
34485        throw new RangeError("Invalid time value");
34486      }
34487      let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
34488        const firstCharacter = substring[0];
34489        if (firstCharacter === "p" || firstCharacter === "P") {
34490          const longFormatter = longFormatters[firstCharacter];
34491          return longFormatter(substring, locale.formatLong);
34492        }
34493        return substring;
34494      }).join("").match(formattingTokensRegExp).map((substring) => {
34495        if (substring === "''") {
34496          return { isToken: false, value: "'" };
34497        }
34498        const firstCharacter = substring[0];
34499        if (firstCharacter === "'") {
34500          return { isToken: false, value: cleanEscapedString(substring) };
34501        }
34502        if (formatters[firstCharacter]) {
34503          return { isToken: true, value: substring };
34504        }
34505        if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
34506          throw new RangeError(
34507            "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
34508          );
34509        }
34510        return { isToken: false, value: substring };
34511      });
34512      if (locale.localize.preprocessor) {
34513        parts = locale.localize.preprocessor(originalDate, parts);
34514      }
34515      const formatterOptions = {
34516        firstWeekContainsDate,
34517        weekStartsOn,
34518        locale
34519      };
34520      return parts.map((part) => {
34521        if (!part.isToken) return part.value;
34522        const token = part.value;
34523        if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
34524          warnOrThrowProtectedError(token, formatStr, String(date));
34525        }
34526        const formatter = formatters[token[0]];
34527        return formatter(originalDate, token, locale.localize, formatterOptions);
34528      }).join("");
34529    }
34530    function cleanEscapedString(input) {
34531      const matched = input.match(escapedStringRegExp);
34532      if (!matched) {
34533        return input;
34534      }
34535      return matched[1].replace(doubleQuoteRegExp, "'");
34536    }
34537  
34538    // packages/dataviews/node_modules/date-fns/subDays.js
34539    function subDays(date, amount, options) {
34540      return addDays(date, -amount, options);
34541    }
34542  
34543    // packages/dataviews/node_modules/date-fns/subMonths.js
34544    function subMonths(date, amount, options) {
34545      return addMonths(date, -amount, options);
34546    }
34547  
34548    // packages/dataviews/node_modules/date-fns/subWeeks.js
34549    function subWeeks(date, amount, options) {
34550      return addWeeks(date, -amount, options);
34551    }
34552  
34553    // packages/dataviews/node_modules/date-fns/subYears.js
34554    function subYears(date, amount, options) {
34555      return addYears(date, -amount, options);
34556    }
34557  
34558    // packages/dataviews/build-module/utils/operators.mjs
34559    var import_i18n105 = __toESM(require_i18n(), 1);
34560    var import_element92 = __toESM(require_element(), 1);
34561    var import_date2 = __toESM(require_date(), 1);
34562    var import_jsx_runtime216 = __toESM(require_jsx_runtime(), 1);
34563    var filterTextWrappers = {
34564      Name: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
34565      Value: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
34566    };
34567    function getRelativeDate(value, unit) {
34568      switch (unit) {
34569        case "days":
34570          return subDays(/* @__PURE__ */ new Date(), value);
34571        case "weeks":
34572          return subWeeks(/* @__PURE__ */ new Date(), value);
34573        case "months":
34574          return subMonths(/* @__PURE__ */ new Date(), value);
34575        case "years":
34576          return subYears(/* @__PURE__ */ new Date(), value);
34577        default:
34578          return /* @__PURE__ */ new Date();
34579      }
34580    }
34581    var isNoneOperatorDefinition = {
34582      /* translators: DataViews operator name */
34583      label: (0, import_i18n105.__)("Is none of"),
34584      filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34585        (0, import_i18n105.sprintf)(
34586          /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */
34587          (0, import_i18n105.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"),
34588          filter.name,
34589          activeElements.map((element) => element.label).join(", ")
34590        ),
34591        filterTextWrappers
34592      ),
34593      filter: ((item, field, filterValue) => {
34594        if (!filterValue?.length) {
34595          return true;
34596        }
34597        const fieldValue = field.getValue({ item });
34598        if (Array.isArray(fieldValue)) {
34599          return !filterValue.some(
34600            (fv) => fieldValue.includes(fv)
34601          );
34602        } else if (typeof fieldValue === "string") {
34603          return !filterValue.includes(fieldValue);
34604        }
34605        return false;
34606      }),
34607      selection: "multi"
34608    };
34609    var OPERATORS = [
34610      {
34611        name: OPERATOR_IS_ANY2,
34612        /* translators: DataViews operator name */
34613        label: (0, import_i18n105.__)("Includes"),
34614        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34615          (0, import_i18n105.sprintf)(
34616            /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */
34617            (0, import_i18n105.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"),
34618            filter.name,
34619            activeElements.map((element) => element.label).join(", ")
34620          ),
34621          filterTextWrappers
34622        ),
34623        filter(item, field, filterValue) {
34624          if (!filterValue?.length) {
34625            return true;
34626          }
34627          const fieldValue = field.getValue({ item });
34628          if (Array.isArray(fieldValue)) {
34629            return filterValue.some(
34630              (fv) => fieldValue.includes(fv)
34631            );
34632          } else if (typeof fieldValue === "string") {
34633            return filterValue.includes(fieldValue);
34634          }
34635          return false;
34636        },
34637        selection: "multi"
34638      },
34639      {
34640        name: OPERATOR_IS_NONE2,
34641        ...isNoneOperatorDefinition
34642      },
34643      {
34644        name: OPERATOR_IS_ALL,
34645        /* translators: DataViews operator name */
34646        label: (0, import_i18n105.__)("Includes all"),
34647        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34648          (0, import_i18n105.sprintf)(
34649            /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */
34650            (0, import_i18n105.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"),
34651            filter.name,
34652            activeElements.map((element) => element.label).join(", ")
34653          ),
34654          filterTextWrappers
34655        ),
34656        filter(item, field, filterValue) {
34657          if (!filterValue?.length) {
34658            return true;
34659          }
34660          return filterValue.every((value) => {
34661            return field.getValue({ item })?.includes(value);
34662          });
34663        },
34664        selection: "multi"
34665      },
34666      {
34667        name: OPERATOR_IS_NOT_ALL,
34668        ...isNoneOperatorDefinition
34669      },
34670      {
34671        name: OPERATOR_BETWEEN,
34672        /* translators: DataViews operator name */
34673        label: (0, import_i18n105.__)("Between (inc)"),
34674        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34675          (0, import_i18n105.sprintf)(
34676            /* 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". */
34677            (0, import_i18n105.__)(
34678              "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
34679            ),
34680            filter.name,
34681            activeElements[0].label[0],
34682            activeElements[0].label[1]
34683          ),
34684          filterTextWrappers
34685        ),
34686        filter(item, field, filterValue) {
34687          if (!Array.isArray(filterValue) || filterValue.length !== 2 || filterValue[0] === void 0 || filterValue[1] === void 0) {
34688            return true;
34689          }
34690          const fieldValue = field.getValue({ item });
34691          if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") {
34692            return fieldValue >= filterValue[0] && fieldValue <= filterValue[1];
34693          }
34694          return false;
34695        },
34696        selection: "custom"
34697      },
34698      {
34699        name: OPERATOR_IN_THE_PAST,
34700        /* translators: DataViews operator name */
34701        label: (0, import_i18n105.__)("In the past"),
34702        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34703          (0, import_i18n105.sprintf)(
34704            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */
34705            (0, import_i18n105.__)(
34706              "<Name>%1$s is in the past: </Name><Value>%2$s</Value>"
34707            ),
34708            filter.name,
34709            `$activeElements[0].value.value} $activeElements[0].value.unit}`
34710          ),
34711          filterTextWrappers
34712        ),
34713        filter(item, field, filterValue) {
34714          if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
34715            return true;
34716          }
34717          const targetDate = getRelativeDate(
34718            filterValue.value,
34719            filterValue.unit
34720          );
34721          const fieldValue = (0, import_date2.getDate)(field.getValue({ item }));
34722          return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date();
34723        },
34724        selection: "custom"
34725      },
34726      {
34727        name: OPERATOR_OVER,
34728        /* translators: DataViews operator name */
34729        label: (0, import_i18n105.__)("Over"),
34730        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34731          (0, import_i18n105.sprintf)(
34732            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */
34733            (0, import_i18n105.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"),
34734            filter.name,
34735            `$activeElements[0].value.value} $activeElements[0].value.unit}`
34736          ),
34737          filterTextWrappers
34738        ),
34739        filter(item, field, filterValue) {
34740          if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
34741            return true;
34742          }
34743          const targetDate = getRelativeDate(
34744            filterValue.value,
34745            filterValue.unit
34746          );
34747          const fieldValue = (0, import_date2.getDate)(field.getValue({ item }));
34748          return fieldValue < targetDate;
34749        },
34750        selection: "custom"
34751      },
34752      {
34753        name: OPERATOR_IS2,
34754        /* translators: DataViews operator name */
34755        label: (0, import_i18n105.__)("Is"),
34756        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34757          (0, import_i18n105.sprintf)(
34758            /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */
34759            (0, import_i18n105.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
34760            filter.name,
34761            activeElements[0].label
34762          ),
34763          filterTextWrappers
34764        ),
34765        filter(item, field, filterValue) {
34766          return filterValue === field.getValue({ item }) || filterValue === void 0;
34767        },
34768        selection: "single"
34769      },
34770      {
34771        name: OPERATOR_IS_NOT,
34772        /* translators: DataViews operator name */
34773        label: (0, import_i18n105.__)("Is not"),
34774        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34775          (0, import_i18n105.sprintf)(
34776            /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */
34777            (0, import_i18n105.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
34778            filter.name,
34779            activeElements[0].label
34780          ),
34781          filterTextWrappers
34782        ),
34783        filter(item, field, filterValue) {
34784          return filterValue !== field.getValue({ item });
34785        },
34786        selection: "single"
34787      },
34788      {
34789        name: OPERATOR_LESS_THAN,
34790        /* translators: DataViews operator name */
34791        label: (0, import_i18n105.__)("Less than"),
34792        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34793          (0, import_i18n105.sprintf)(
34794            /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */
34795            (0, import_i18n105.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
34796            filter.name,
34797            activeElements[0].label
34798          ),
34799          filterTextWrappers
34800        ),
34801        filter(item, field, filterValue) {
34802          if (filterValue === void 0) {
34803            return true;
34804          }
34805          const fieldValue = field.getValue({ item });
34806          return fieldValue < filterValue;
34807        },
34808        selection: "single"
34809      },
34810      {
34811        name: OPERATOR_GREATER_THAN,
34812        /* translators: DataViews operator name */
34813        label: (0, import_i18n105.__)("Greater than"),
34814        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34815          (0, import_i18n105.sprintf)(
34816            /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */
34817            (0, import_i18n105.__)(
34818              "<Name>%1$s is greater than: </Name><Value>%2$s</Value>"
34819            ),
34820            filter.name,
34821            activeElements[0].label
34822          ),
34823          filterTextWrappers
34824        ),
34825        filter(item, field, filterValue) {
34826          if (filterValue === void 0) {
34827            return true;
34828          }
34829          const fieldValue = field.getValue({ item });
34830          return fieldValue > filterValue;
34831        },
34832        selection: "single"
34833      },
34834      {
34835        name: OPERATOR_LESS_THAN_OR_EQUAL,
34836        /* translators: DataViews operator name */
34837        label: (0, import_i18n105.__)("Less than or equal"),
34838        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34839          (0, import_i18n105.sprintf)(
34840            /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */
34841            (0, import_i18n105.__)(
34842              "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
34843            ),
34844            filter.name,
34845            activeElements[0].label
34846          ),
34847          filterTextWrappers
34848        ),
34849        filter(item, field, filterValue) {
34850          if (filterValue === void 0) {
34851            return true;
34852          }
34853          const fieldValue = field.getValue({ item });
34854          return fieldValue <= filterValue;
34855        },
34856        selection: "single"
34857      },
34858      {
34859        name: OPERATOR_GREATER_THAN_OR_EQUAL,
34860        /* translators: DataViews operator name */
34861        label: (0, import_i18n105.__)("Greater than or equal"),
34862        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34863          (0, import_i18n105.sprintf)(
34864            /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */
34865            (0, import_i18n105.__)(
34866              "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
34867            ),
34868            filter.name,
34869            activeElements[0].label
34870          ),
34871          filterTextWrappers
34872        ),
34873        filter(item, field, filterValue) {
34874          if (filterValue === void 0) {
34875            return true;
34876          }
34877          const fieldValue = field.getValue({ item });
34878          return fieldValue >= filterValue;
34879        },
34880        selection: "single"
34881      },
34882      {
34883        name: OPERATOR_BEFORE2,
34884        /* translators: DataViews operator name */
34885        label: (0, import_i18n105.__)("Before"),
34886        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34887          (0, import_i18n105.sprintf)(
34888            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */
34889            (0, import_i18n105.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
34890            filter.name,
34891            activeElements[0].label
34892          ),
34893          filterTextWrappers
34894        ),
34895        filter(item, field, filterValue) {
34896          if (filterValue === void 0) {
34897            return true;
34898          }
34899          const filterDate = (0, import_date2.getDate)(filterValue);
34900          const fieldDate = (0, import_date2.getDate)(field.getValue({ item }));
34901          return fieldDate < filterDate;
34902        },
34903        selection: "single"
34904      },
34905      {
34906        name: OPERATOR_AFTER2,
34907        /* translators: DataViews operator name */
34908        label: (0, import_i18n105.__)("After"),
34909        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34910          (0, import_i18n105.sprintf)(
34911            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */
34912            (0, import_i18n105.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
34913            filter.name,
34914            activeElements[0].label
34915          ),
34916          filterTextWrappers
34917        ),
34918        filter(item, field, filterValue) {
34919          if (filterValue === void 0) {
34920            return true;
34921          }
34922          const filterDate = (0, import_date2.getDate)(filterValue);
34923          const fieldDate = (0, import_date2.getDate)(field.getValue({ item }));
34924          return fieldDate > filterDate;
34925        },
34926        selection: "single"
34927      },
34928      {
34929        name: OPERATOR_BEFORE_INC,
34930        /* translators: DataViews operator name */
34931        label: (0, import_i18n105.__)("Before (inc)"),
34932        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34933          (0, import_i18n105.sprintf)(
34934            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */
34935            (0, import_i18n105.__)(
34936              "<Name>%1$s is on or before: </Name><Value>%2$s</Value>"
34937            ),
34938            filter.name,
34939            activeElements[0].label
34940          ),
34941          filterTextWrappers
34942        ),
34943        filter(item, field, filterValue) {
34944          if (filterValue === void 0) {
34945            return true;
34946          }
34947          const filterDate = (0, import_date2.getDate)(filterValue);
34948          const fieldDate = (0, import_date2.getDate)(field.getValue({ item }));
34949          return fieldDate <= filterDate;
34950        },
34951        selection: "single"
34952      },
34953      {
34954        name: OPERATOR_AFTER_INC,
34955        /* translators: DataViews operator name */
34956        label: (0, import_i18n105.__)("After (inc)"),
34957        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34958          (0, import_i18n105.sprintf)(
34959            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */
34960            (0, import_i18n105.__)(
34961              "<Name>%1$s is on or after: </Name><Value>%2$s</Value>"
34962            ),
34963            filter.name,
34964            activeElements[0].label
34965          ),
34966          filterTextWrappers
34967        ),
34968        filter(item, field, filterValue) {
34969          if (filterValue === void 0) {
34970            return true;
34971          }
34972          const filterDate = (0, import_date2.getDate)(filterValue);
34973          const fieldDate = (0, import_date2.getDate)(field.getValue({ item }));
34974          return fieldDate >= filterDate;
34975        },
34976        selection: "single"
34977      },
34978      {
34979        name: OPERATOR_CONTAINS,
34980        /* translators: DataViews operator name */
34981        label: (0, import_i18n105.__)("Contains"),
34982        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
34983          (0, import_i18n105.sprintf)(
34984            /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */
34985            (0, import_i18n105.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
34986            filter.name,
34987            activeElements[0].label
34988          ),
34989          filterTextWrappers
34990        ),
34991        filter(item, field, filterValue) {
34992          if (filterValue === void 0) {
34993            return true;
34994          }
34995          const fieldValue = field.getValue({ item });
34996          return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
34997        },
34998        selection: "single"
34999      },
35000      {
35001        name: OPERATOR_NOT_CONTAINS,
35002        /* translators: DataViews operator name */
35003        label: (0, import_i18n105.__)("Doesn't contain"),
35004        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
35005          (0, import_i18n105.sprintf)(
35006            /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */
35007            (0, import_i18n105.__)(
35008              "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"
35009            ),
35010            filter.name,
35011            activeElements[0].label
35012          ),
35013          filterTextWrappers
35014        ),
35015        filter(item, field, filterValue) {
35016          if (filterValue === void 0) {
35017            return true;
35018          }
35019          const fieldValue = field.getValue({ item });
35020          return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
35021        },
35022        selection: "single"
35023      },
35024      {
35025        name: OPERATOR_STARTS_WITH,
35026        /* translators: DataViews operator name */
35027        label: (0, import_i18n105.__)("Starts with"),
35028        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
35029          (0, import_i18n105.sprintf)(
35030            /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */
35031            (0, import_i18n105.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
35032            filter.name,
35033            activeElements[0].label
35034          ),
35035          filterTextWrappers
35036        ),
35037        filter(item, field, filterValue) {
35038          if (filterValue === void 0) {
35039            return true;
35040          }
35041          const fieldValue = field.getValue({ item });
35042          return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase());
35043        },
35044        selection: "single"
35045      },
35046      {
35047        name: OPERATOR_ON,
35048        /* translators: DataViews operator name */
35049        label: (0, import_i18n105.__)("On"),
35050        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
35051          (0, import_i18n105.sprintf)(
35052            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */
35053            (0, import_i18n105.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
35054            filter.name,
35055            activeElements[0].label
35056          ),
35057          filterTextWrappers
35058        ),
35059        filter(item, field, filterValue) {
35060          if (filterValue === void 0) {
35061            return true;
35062          }
35063          const filterDate = (0, import_date2.getDate)(filterValue);
35064          const fieldDate = (0, import_date2.getDate)(field.getValue({ item }));
35065          return filterDate.getTime() === fieldDate.getTime();
35066        },
35067        selection: "single"
35068      },
35069      {
35070        name: OPERATOR_NOT_ON,
35071        /* translators: DataViews operator name */
35072        label: (0, import_i18n105.__)("Not on"),
35073        filterText: (filter, activeElements) => (0, import_element92.createInterpolateElement)(
35074          (0, import_i18n105.sprintf)(
35075            /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */
35076            (0, import_i18n105.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
35077            filter.name,
35078            activeElements[0].label
35079          ),
35080          filterTextWrappers
35081        ),
35082        filter(item, field, filterValue) {
35083          if (filterValue === void 0) {
35084            return true;
35085          }
35086          const filterDate = (0, import_date2.getDate)(filterValue);
35087          const fieldDate = (0, import_date2.getDate)(field.getValue({ item }));
35088          return filterDate.getTime() !== fieldDate.getTime();
35089        },
35090        selection: "single"
35091      }
35092    ];
35093    var getOperatorByName = (name2) => OPERATORS.find((op) => op.name === name2);
35094    var getAllOperatorNames = () => OPERATORS.map((op) => op.name);
35095    var isSingleSelectionOperator = (name2) => OPERATORS.filter((op) => op.selection === "single").some(
35096      (op) => op.name === name2
35097    );
35098    var isRegisteredOperator = (name2) => OPERATORS.some((op) => op.name === name2);
35099  
35100    // packages/dataviews/build-module/components/dataviews-filters/filter.mjs
35101    var import_jsx_runtime217 = __toESM(require_jsx_runtime(), 1);
35102    var ENTER4 = "Enter";
35103    var SPACE3 = " ";
35104    var FilterText = ({
35105      activeElements,
35106      filterInView,
35107      filter
35108    }) => {
35109      if (activeElements === void 0 || activeElements.length === 0) {
35110        return filter.name;
35111      }
35112      const operator = getOperatorByName(filterInView?.operator);
35113      if (operator !== void 0) {
35114        return operator.filterText(filter, activeElements);
35115      }
35116      return (0, import_i18n106.sprintf)(
35117        /* translators: 1: Filter name e.g.: "Unknown status for Author". */
35118        (0, import_i18n106.__)("Unknown status for %1$s"),
35119        filter.name
35120      );
35121    };
35122    function OperatorSelector({
35123      filter,
35124      view,
35125      onChangeView
35126    }) {
35127      const operatorOptions = filter.operators?.map((operator) => ({
35128        value: operator,
35129        label: getOperatorByName(operator)?.label || operator
35130      }));
35131      const currentFilter = view.filters?.find(
35132        (_filter) => _filter.field === filter.field
35133      );
35134      const value = currentFilter?.operator || filter.operators[0];
35135      return operatorOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)(
35136        Stack,
35137        {
35138          direction: "row",
35139          gap: "sm",
35140          justify: "flex-start",
35141          className: "dataviews-filters__summary-operators-container",
35142          align: "center",
35143          children: [
35144            /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(import_components111.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }),
35145            /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
35146              import_components111.SelectControl,
35147              {
35148                className: "dataviews-filters__summary-operators-filter-select",
35149                label: (0, import_i18n106.__)("Conditions"),
35150                value,
35151                options: operatorOptions,
35152                onChange: (newValue) => {
35153                  const newOperator = newValue;
35154                  const currentOperator = currentFilter?.operator;
35155                  const newFilters = currentFilter ? [
35156                    ...(view.filters ?? []).map(
35157                      (_filter) => {
35158                        if (_filter.field === filter.field) {
35159                          const currentOpSelectionModel = getOperatorByName(
35160                            currentOperator
35161                          )?.selection;
35162                          const newOpSelectionModel = getOperatorByName(
35163                            newOperator
35164                          )?.selection;
35165                          const shouldResetValue = currentOpSelectionModel !== newOpSelectionModel || [
35166                            currentOpSelectionModel,
35167                            newOpSelectionModel
35168                          ].includes("custom");
35169                          return {
35170                            ..._filter,
35171                            value: shouldResetValue ? void 0 : _filter.value,
35172                            operator: newOperator
35173                          };
35174                        }
35175                        return _filter;
35176                      }
35177                    )
35178                  ] : [
35179                    ...view.filters ?? [],
35180                    {
35181                      field: filter.field,
35182                      operator: newOperator,
35183                      value: void 0
35184                    }
35185                  ];
35186                  onChangeView({
35187                    ...view,
35188                    page: 1,
35189                    filters: newFilters
35190                  });
35191                },
35192                size: "small",
35193                variant: "minimal",
35194                hideLabelFromVision: true
35195              }
35196            )
35197          ]
35198        }
35199      );
35200    }
35201    function Filter({
35202      addFilterRef,
35203      openedFilter,
35204      fields,
35205      ...commonProps
35206    }) {
35207      const toggleRef = (0, import_element93.useRef)(null);
35208      const { filter, view, onChangeView } = commonProps;
35209      const filterInView = view.filters?.find(
35210        (f2) => f2.field === filter.field
35211      );
35212      let activeElements = [];
35213      const field = (0, import_element93.useMemo)(() => {
35214        const currentField = fields.find((f2) => f2.id === filter.field);
35215        if (currentField) {
35216          return {
35217            ...currentField,
35218            // Configure getValue as if Item was a plain object.
35219            // See related input-widget.tsx
35220            getValue: ({ item }) => item[currentField.id]
35221          };
35222        }
35223        return currentField;
35224      }, [fields, filter.field]);
35225      const { elements: elements2 } = useElements({
35226        elements: filter.elements,
35227        getElements: filter.getElements
35228      });
35229      if (elements2.length > 0) {
35230        activeElements = elements2.filter((element) => {
35231          if (filter.singleSelection) {
35232            return element.value === filterInView?.value;
35233          }
35234          return filterInView?.value?.includes(element.value);
35235        });
35236      } else if (Array.isArray(filterInView?.value)) {
35237        const label = filterInView.value.map((v2) => {
35238          const formattedValue = field?.getValueFormatted({
35239            item: { [field.id]: v2 },
35240            field
35241          });
35242          return formattedValue || String(v2);
35243        });
35244        activeElements = [
35245          {
35246            value: filterInView.value,
35247            // @ts-ignore
35248            label
35249          }
35250        ];
35251      } else if (typeof filterInView?.value === "object") {
35252        activeElements = [
35253          { value: filterInView.value, label: filterInView.value }
35254        ];
35255      } else if (filterInView?.value !== void 0) {
35256        const label = field !== void 0 ? field.getValueFormatted({
35257          item: { [field.id]: filterInView.value },
35258          field
35259        }) : String(filterInView.value);
35260        activeElements = [
35261          {
35262            value: filterInView.value,
35263            label
35264          }
35265        ];
35266      }
35267      const isPrimary = filter.isPrimary;
35268      const isLocked = filterInView?.isLocked;
35269      const hasValues = !isLocked && filterInView?.value !== void 0;
35270      const canResetOrRemove = !isLocked && (!isPrimary || hasValues);
35271      return /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
35272        import_components111.Dropdown,
35273        {
35274          defaultOpen: openedFilter === filter.field,
35275          contentClassName: "dataviews-filters__summary-popover",
35276          popoverProps: { placement: "bottom-start", role: "dialog" },
35277          onClose: () => {
35278            toggleRef.current?.focus();
35279          },
35280          renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [
35281            /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
35282              import_components111.Tooltip,
35283              {
35284                text: (0, import_i18n106.sprintf)(
35285                  /* translators: 1: Filter name. */
35286                  (0, import_i18n106.__)("Filter by: %1$s"),
35287                  filter.name.toLowerCase()
35288                ),
35289                placement: "top",
35290                children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
35291                  "div",
35292                  {
35293                    className: clsx_default(
35294                      "dataviews-filters__summary-chip",
35295                      {
35296                        "has-reset": canResetOrRemove,
35297                        "has-values": hasValues,
35298                        "is-not-clickable": isLocked
35299                      }
35300                    ),
35301                    role: "button",
35302                    tabIndex: isLocked ? -1 : 0,
35303                    onClick: () => {
35304                      if (!isLocked) {
35305                        onToggle();
35306                      }
35307                    },
35308                    onKeyDown: (event) => {
35309                      if (!isLocked && [ENTER4, SPACE3].includes(event.key)) {
35310                        onToggle();
35311                        event.preventDefault();
35312                      }
35313                    },
35314                    "aria-disabled": isLocked,
35315                    "aria-pressed": isOpen,
35316                    "aria-expanded": isOpen,
35317                    ref: toggleRef,
35318                    children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
35319                      FilterText,
35320                      {
35321                        activeElements,
35322                        filterInView,
35323                        filter
35324                      }
35325                    )
35326                  }
35327                )
35328              }
35329            ),
35330            canResetOrRemove && /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
35331              import_components111.Tooltip,
35332              {
35333                text: isPrimary ? (0, import_i18n106.__)("Reset") : (0, import_i18n106.__)("Remove"),
35334                placement: "top",
35335                children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
35336                  "button",
35337                  {
35338                    className: clsx_default(
35339                      "dataviews-filters__summary-chip-remove",
35340                      { "has-values": hasValues }
35341                    ),
35342                    onClick: () => {
35343                      onChangeView({
35344                        ...view,
35345                        page: 1,
35346                        filters: view.filters?.filter(
35347                          (_filter) => _filter.field !== filter.field
35348                        )
35349                      });
35350                      if (!isPrimary) {
35351                        addFilterRef.current?.focus();
35352                      } else {
35353                        toggleRef.current?.focus();
35354                      }
35355                    },
35356                    children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(import_components111.Icon, { icon: close_small_default })
35357                  }
35358                )
35359              }
35360            )
35361          ] }),
35362          renderContent: () => {
35363            return /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)(Stack, { direction: "column", justify: "flex-start", children: [
35364              /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(OperatorSelector, { ...commonProps }),
35365              commonProps.filter.hasElements ? /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
35366                SearchWidget,
35367                {
35368                  ...commonProps,
35369                  filter: {
35370                    ...commonProps.filter,
35371                    elements: elements2
35372                  }
35373                }
35374              ) : /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(InputWidget, { ...commonProps, fields })
35375            ] });
35376          }
35377        }
35378      );
35379    }
35380  
35381    // packages/dataviews/build-module/components/dataviews-filters/add-filter.mjs
35382    var import_components112 = __toESM(require_components(), 1);
35383    var import_i18n107 = __toESM(require_i18n(), 1);
35384    var import_element94 = __toESM(require_element(), 1);
35385    var import_jsx_runtime218 = __toESM(require_jsx_runtime(), 1);
35386    var { Menu: Menu8 } = unlock3(import_components112.privateApis);
35387    function AddFilterMenu({
35388      filters,
35389      view,
35390      onChangeView,
35391      setOpenedFilter,
35392      triggerProps
35393    }) {
35394      const inactiveFilters = filters.filter((filter) => !filter.isVisible);
35395      return /* @__PURE__ */ (0, import_jsx_runtime218.jsxs)(Menu8, { children: [
35396        /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(Menu8.TriggerButton, { ...triggerProps }),
35397        /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(Menu8.Popover, { children: inactiveFilters.map((filter) => {
35398          return /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
35399            Menu8.Item,
35400            {
35401              onClick: () => {
35402                setOpenedFilter(filter.field);
35403                onChangeView({
35404                  ...view,
35405                  page: 1,
35406                  filters: [
35407                    ...view.filters || [],
35408                    {
35409                      field: filter.field,
35410                      value: void 0,
35411                      operator: filter.operators[0]
35412                    }
35413                  ]
35414                });
35415              },
35416              children: /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(Menu8.ItemLabel, { children: filter.name })
35417            },
35418            filter.field
35419          );
35420        }) })
35421      ] });
35422    }
35423    function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) {
35424      if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) {
35425        return null;
35426      }
35427      const inactiveFilters = filters.filter((filter) => !filter.isVisible);
35428      return /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
35429        AddFilterMenu,
35430        {
35431          triggerProps: {
35432            render: /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
35433              import_components112.Button,
35434              {
35435                accessibleWhenDisabled: true,
35436                size: "compact",
35437                className: "dataviews-filters-button",
35438                variant: "tertiary",
35439                disabled: !inactiveFilters.length,
35440                ref
35441              }
35442            ),
35443            children: (0, import_i18n107.__)("Add filter")
35444          },
35445          ...{ filters, view, onChangeView, setOpenedFilter }
35446        }
35447      );
35448    }
35449    var add_filter_default = (0, import_element94.forwardRef)(AddFilter);
35450  
35451    // packages/dataviews/build-module/components/dataviews-filters/reset-filters.mjs
35452    var import_components113 = __toESM(require_components(), 1);
35453    var import_i18n108 = __toESM(require_i18n(), 1);
35454    var import_jsx_runtime219 = __toESM(require_jsx_runtime(), 1);
35455    function ResetFilter({
35456      filters,
35457      view,
35458      onChangeView
35459    }) {
35460      const isPrimary = (field) => filters.some(
35461        (_filter) => _filter.field === field && _filter.isPrimary
35462      );
35463      const isDisabled = !view.search && !view.filters?.some(
35464        (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field))
35465      );
35466      return /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(
35467        import_components113.Button,
35468        {
35469          disabled: isDisabled,
35470          accessibleWhenDisabled: true,
35471          size: "compact",
35472          variant: "tertiary",
35473          className: "dataviews-filters__reset-button",
35474          onClick: () => {
35475            onChangeView({
35476              ...view,
35477              page: 1,
35478              search: "",
35479              filters: view.filters?.filter((f2) => !!f2.isLocked) || []
35480            });
35481          },
35482          children: (0, import_i18n108.__)("Reset")
35483        }
35484      );
35485    }
35486  
35487    // packages/dataviews/build-module/components/dataviews-filters/use-filters.mjs
35488    var import_element95 = __toESM(require_element(), 1);
35489    function useFilters(fields, view) {
35490      return (0, import_element95.useMemo)(() => {
35491        const filters = [];
35492        fields.forEach((field) => {
35493          if (field.filterBy === false || !field.hasElements && !field.Edit) {
35494            return;
35495          }
35496          const operators = field.filterBy.operators;
35497          const isPrimary = !!field.filterBy?.isPrimary;
35498          const isLocked = view.filters?.some(
35499            (f2) => f2.field === field.id && !!f2.isLocked
35500          ) ?? false;
35501          filters.push({
35502            field: field.id,
35503            name: field.label,
35504            elements: field.elements,
35505            getElements: field.getElements,
35506            hasElements: field.hasElements,
35507            singleSelection: operators.some(
35508              (op) => isSingleSelectionOperator(op)
35509            ),
35510            operators,
35511            isVisible: isLocked || isPrimary || !!view.filters?.some(
35512              (f2) => f2.field === field.id && isRegisteredOperator(f2.operator)
35513            ),
35514            isPrimary,
35515            isLocked
35516          });
35517        });
35518        filters.sort((a2, b2) => {
35519          if (a2.isLocked && !b2.isLocked) {
35520            return -1;
35521          }
35522          if (!a2.isLocked && b2.isLocked) {
35523            return 1;
35524          }
35525          if (a2.isPrimary && !b2.isPrimary) {
35526            return -1;
35527          }
35528          if (!a2.isPrimary && b2.isPrimary) {
35529            return 1;
35530          }
35531          return a2.name.localeCompare(b2.name);
35532        });
35533        return filters;
35534      }, [fields, view]);
35535    }
35536    var use_filters_default = useFilters;
35537  
35538    // packages/dataviews/build-module/components/dataviews-filters/filters.mjs
35539    var import_jsx_runtime220 = __toESM(require_jsx_runtime(), 1);
35540    function Filters({ className }) {
35541      const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0, import_element96.useContext)(dataviews_context_default);
35542      const addFilterRef = (0, import_element96.useRef)(null);
35543      const filters = use_filters_default(fields, view);
35544      const addFilter = /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
35545        add_filter_default,
35546        {
35547          filters,
35548          view,
35549          onChangeView,
35550          ref: addFilterRef,
35551          setOpenedFilter
35552        },
35553        "add-filter"
35554      );
35555      const visibleFilters = filters.filter((filter) => filter.isVisible);
35556      if (visibleFilters.length === 0) {
35557        return null;
35558      }
35559      const filterComponents = [
35560        ...visibleFilters.map((filter) => {
35561          return /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
35562            Filter,
35563            {
35564              filter,
35565              view,
35566              fields,
35567              onChangeView,
35568              addFilterRef,
35569              openedFilter
35570            },
35571            filter.field
35572          );
35573        }),
35574        addFilter
35575      ];
35576      filterComponents.push(
35577        /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
35578          ResetFilter,
35579          {
35580            filters,
35581            view,
35582            onChangeView
35583          },
35584          "reset-filters"
35585        )
35586      );
35587      return /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
35588        Stack,
35589        {
35590          direction: "row",
35591          justify: "flex-start",
35592          gap: "sm",
35593          style: { width: "fit-content" },
35594          wrap: "wrap",
35595          className,
35596          children: filterComponents
35597        }
35598      );
35599    }
35600    var filters_default = (0, import_element96.memo)(Filters);
35601  
35602    // packages/dataviews/build-module/components/dataviews-filters/toggle.mjs
35603    var import_element97 = __toESM(require_element(), 1);
35604    var import_components114 = __toESM(require_components(), 1);
35605    var import_i18n109 = __toESM(require_i18n(), 1);
35606    var import_jsx_runtime221 = __toESM(require_jsx_runtime(), 1);
35607    function FiltersToggle() {
35608      const {
35609        filters,
35610        view,
35611        onChangeView,
35612        setOpenedFilter,
35613        isShowingFilter,
35614        setIsShowingFilter
35615      } = (0, import_element97.useContext)(dataviews_context_default);
35616      const buttonRef = (0, import_element97.useRef)(null);
35617      const onChangeViewWithFilterVisibility = (0, import_element97.useCallback)(
35618        (_view) => {
35619          onChangeView(_view);
35620          setIsShowingFilter(true);
35621        },
35622        [onChangeView, setIsShowingFilter]
35623      );
35624      if (filters.length === 0) {
35625        return null;
35626      }
35627      const hasVisibleFilters = filters.some((filter) => filter.isVisible);
35628      const addFilterButtonProps = {
35629        label: (0, import_i18n109.__)("Add filter"),
35630        "aria-expanded": false,
35631        isPressed: false
35632      };
35633      const toggleFiltersButtonProps = {
35634        label: (0, import_i18n109._x)("Filter", "verb"),
35635        "aria-expanded": isShowingFilter,
35636        isPressed: isShowingFilter,
35637        onClick: () => {
35638          if (!isShowingFilter) {
35639            setOpenedFilter(null);
35640          }
35641          setIsShowingFilter(!isShowingFilter);
35642        }
35643      };
35644      const hasPrimaryOrLockedFilters = filters.some(
35645        (filter) => filter.isPrimary || filter.isLocked
35646      );
35647      const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
35648        import_components114.Button,
35649        {
35650          ref: buttonRef,
35651          className: "dataviews-filters__visibility-toggle",
35652          size: "compact",
35653          icon: funnel_default,
35654          disabled: hasPrimaryOrLockedFilters,
35655          accessibleWhenDisabled: true,
35656          ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps
35657        }
35658      );
35659      return /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
35660        AddFilterMenu,
35661        {
35662          filters,
35663          view,
35664          onChangeView: onChangeViewWithFilterVisibility,
35665          setOpenedFilter,
35666          triggerProps: { render: buttonComponent }
35667        }
35668      ) : /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
35669        FilterVisibilityToggle,
35670        {
35671          buttonRef,
35672          filtersCount: view.filters?.length,
35673          children: buttonComponent
35674        }
35675      ) });
35676    }
35677    function FilterVisibilityToggle({
35678      buttonRef,
35679      filtersCount,
35680      children
35681    }) {
35682      (0, import_element97.useEffect)(
35683        () => () => {
35684          buttonRef.current?.focus();
35685        },
35686        [buttonRef]
35687      );
35688      return /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(import_jsx_runtime221.Fragment, { children: [
35689        children,
35690        !!filtersCount && /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount })
35691      ] });
35692    }
35693    var toggle_default = FiltersToggle;
35694  
35695    // packages/dataviews/build-module/components/dataviews-filters/filters-toggled.mjs
35696    var import_element98 = __toESM(require_element(), 1);
35697    var import_jsx_runtime222 = __toESM(require_jsx_runtime(), 1);
35698    function FiltersToggled(props) {
35699      const { isShowingFilter } = (0, import_element98.useContext)(dataviews_context_default);
35700      if (!isShowingFilter) {
35701        return null;
35702      }
35703      return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(filters_default, { ...props });
35704    }
35705    var filters_toggled_default = FiltersToggled;
35706  
35707    // packages/dataviews/build-module/components/dataviews-layout/index.mjs
35708    var import_element99 = __toESM(require_element(), 1);
35709    var import_components115 = __toESM(require_components(), 1);
35710    var import_i18n110 = __toESM(require_i18n(), 1);
35711    var import_jsx_runtime223 = __toESM(require_jsx_runtime(), 1);
35712    function DataViewsLayout({ className }) {
35713      const {
35714        actions = [],
35715        data,
35716        fields,
35717        getItemId: getItemId2,
35718        getItemLevel: getItemLevel2,
35719        hasInitiallyLoaded,
35720        isLoading,
35721        view,
35722        onChangeView,
35723        selection,
35724        onChangeSelection,
35725        setOpenedFilter,
35726        onClickItem,
35727        isItemClickable,
35728        renderItemLink,
35729        defaultLayouts: defaultLayouts4,
35730        empty = /* @__PURE__ */ (0, import_jsx_runtime223.jsx)("p", { children: (0, import_i18n110.__)("No results") })
35731      } = (0, import_element99.useContext)(dataviews_context_default);
35732      const isDelayedInitialLoading = useDelayedLoading(!hasInitiallyLoaded, {
35733        delay: 200
35734      });
35735      if (!hasInitiallyLoaded) {
35736        if (!isDelayedInitialLoading) {
35737          return null;
35738        }
35739        return /* @__PURE__ */ (0, import_jsx_runtime223.jsx)("div", { className: "dataviews-loading", children: /* @__PURE__ */ (0, import_jsx_runtime223.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(import_components115.Spinner, {}) }) });
35740      }
35741      const ViewComponent = VIEW_LAYOUTS.find(
35742        (v2) => v2.type === view.type && defaultLayouts4[v2.type]
35743      )?.component;
35744      return /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(
35745        ViewComponent,
35746        {
35747          className,
35748          actions,
35749          data,
35750          fields,
35751          getItemId: getItemId2,
35752          getItemLevel: getItemLevel2,
35753          isLoading,
35754          onChangeView,
35755          onChangeSelection,
35756          selection,
35757          setOpenedFilter,
35758          onClickItem,
35759          renderItemLink,
35760          isItemClickable,
35761          view,
35762          empty
35763        }
35764      );
35765    }
35766  
35767    // packages/dataviews/build-module/components/dataviews-footer/index.mjs
35768    var import_element100 = __toESM(require_element(), 1);
35769    var import_jsx_runtime224 = __toESM(require_jsx_runtime(), 1);
35770    var EMPTY_ARRAY8 = [];
35771    function DataViewsFooter() {
35772      const {
35773        view,
35774        paginationInfo: { totalItems = 0, totalPages },
35775        data,
35776        actions = EMPTY_ARRAY8,
35777        isLoading,
35778        hasInitiallyLoaded,
35779        hasInfiniteScrollHandler
35780      } = (0, import_element100.useContext)(dataviews_context_default);
35781      const isRefreshing = !!isLoading && hasInitiallyLoaded && !hasInfiniteScrollHandler && !!data?.length;
35782      const isDelayedRefreshing = useDelayedLoading(!!isRefreshing);
35783      const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data) && [LAYOUT_TABLE2, LAYOUT_GRID2].includes(view.type);
35784      if (!isRefreshing && (!totalItems || !totalPages || totalPages <= 1 && !hasBulkActions)) {
35785        return null;
35786      }
35787      return (!!totalItems || isRefreshing) && /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(
35788        "div",
35789        {
35790          className: "dataviews-footer",
35791          inert: isRefreshing ? "true" : void 0,
35792          children: /* @__PURE__ */ (0, import_jsx_runtime224.jsxs)(
35793            Stack,
35794            {
35795              direction: "row",
35796              justify: "end",
35797              align: "center",
35798              className: clsx_default("dataviews-footer__content", {
35799                "is-refreshing": isDelayedRefreshing
35800              }),
35801              gap: "sm",
35802              children: [
35803                hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(BulkActionsFooter, {}),
35804                /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(dataviews_pagination_default, {})
35805              ]
35806            }
35807          )
35808        }
35809      );
35810    }
35811  
35812    // packages/dataviews/build-module/components/dataviews-search/index.mjs
35813    var import_i18n111 = __toESM(require_i18n(), 1);
35814    var import_element101 = __toESM(require_element(), 1);
35815    var import_components116 = __toESM(require_components(), 1);
35816    var import_compose21 = __toESM(require_compose(), 1);
35817    var import_jsx_runtime225 = __toESM(require_jsx_runtime(), 1);
35818    var DataViewsSearch = (0, import_element101.memo)(function Search({ label }) {
35819      const { view, onChangeView } = (0, import_element101.useContext)(dataviews_context_default);
35820      const [search, setSearch, debouncedSearch] = (0, import_compose21.useDebouncedInput)(
35821        view.search
35822      );
35823      (0, import_element101.useEffect)(() => {
35824        setSearch(view.search ?? "");
35825      }, [view.search, setSearch]);
35826      const onChangeViewRef = (0, import_element101.useRef)(onChangeView);
35827      const viewRef = (0, import_element101.useRef)(view);
35828      (0, import_element101.useEffect)(() => {
35829        onChangeViewRef.current = onChangeView;
35830        viewRef.current = view;
35831      }, [onChangeView, view]);
35832      (0, import_element101.useEffect)(() => {
35833        if (debouncedSearch !== viewRef.current?.search) {
35834          onChangeViewRef.current({
35835            ...viewRef.current,
35836            page: 1,
35837            search: debouncedSearch
35838          });
35839        }
35840      }, [debouncedSearch]);
35841      const searchLabel = label || (0, import_i18n111.__)("Search");
35842      return /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
35843        import_components116.SearchControl,
35844        {
35845          className: "dataviews-search",
35846          onChange: setSearch,
35847          value: search,
35848          label: searchLabel,
35849          placeholder: searchLabel,
35850          size: "compact"
35851        }
35852      );
35853    });
35854    var dataviews_search_default = DataViewsSearch;
35855  
35856    // packages/dataviews/build-module/components/dataviews-view-config/index.mjs
35857    var import_components118 = __toESM(require_components(), 1);
35858    var import_i18n113 = __toESM(require_i18n(), 1);
35859    var import_element103 = __toESM(require_element(), 1);
35860    var import_warning = __toESM(require_warning(), 1);
35861    var import_compose22 = __toESM(require_compose(), 1);
35862  
35863    // packages/dataviews/build-module/components/dataviews-view-config/infinite-scroll-toggle.mjs
35864    var import_components117 = __toESM(require_components(), 1);
35865    var import_i18n112 = __toESM(require_i18n(), 1);
35866    var import_element102 = __toESM(require_element(), 1);
35867    var import_jsx_runtime226 = __toESM(require_jsx_runtime(), 1);
35868    function InfiniteScrollToggle() {
35869      const context = (0, import_element102.useContext)(dataviews_context_default);
35870      const { view, onChangeView } = context;
35871      const infiniteScrollEnabled = view.infiniteScrollEnabled ?? false;
35872      if (!context.hasInfiniteScrollHandler) {
35873        return null;
35874      }
35875      return /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
35876        import_components117.ToggleControl,
35877        {
35878          label: (0, import_i18n112.__)("Enable infinite scroll"),
35879          help: (0, import_i18n112.__)(
35880            "Automatically load more content as you scroll, instead of showing pagination links."
35881          ),
35882          checked: infiniteScrollEnabled,
35883          onChange: (newValue) => {
35884            onChangeView({
35885              ...view,
35886              infiniteScrollEnabled: newValue
35887            });
35888          }
35889        }
35890      );
35891    }
35892  
35893    // packages/dataviews/build-module/components/dataviews-view-config/index.mjs
35894    var import_jsx_runtime227 = __toESM(require_jsx_runtime(), 1);
35895    var { Menu: Menu9 } = unlock3(import_components118.privateApis);
35896    var DATAVIEWS_CONFIG_POPOVER_PROPS = {
35897      className: "dataviews-config__popover",
35898      placement: "bottom-end",
35899      offset: 9
35900    };
35901    function ViewTypeMenu() {
35902      const { view, onChangeView, defaultLayouts: defaultLayouts4 } = (0, import_element103.useContext)(dataviews_context_default);
35903      const availableLayouts = Object.keys(defaultLayouts4);
35904      if (availableLayouts.length <= 1) {
35905        return null;
35906      }
35907      const activeView = VIEW_LAYOUTS.find((v2) => view.type === v2.type);
35908      return /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(Menu9, { children: [
35909        /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
35910          Menu9.TriggerButton,
35911          {
35912            render: /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
35913              import_components118.Button,
35914              {
35915                size: "compact",
35916                icon: activeView?.icon,
35917                label: (0, import_i18n113.__)("Layout")
35918              }
35919            )
35920          }
35921        ),
35922        /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Menu9.Popover, { children: availableLayouts.map((layout) => {
35923          const config2 = VIEW_LAYOUTS.find(
35924            (v2) => v2.type === layout
35925          );
35926          if (!config2) {
35927            return null;
35928          }
35929          return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
35930            Menu9.RadioItem,
35931            {
35932              value: layout,
35933              name: "view-actions-available-view",
35934              checked: layout === view.type,
35935              hideOnClick: true,
35936              onChange: (e2) => {
35937                switch (e2.target.value) {
35938                  case "list":
35939                  case "grid":
35940                  case "table":
35941                  case "pickerGrid":
35942                  case "pickerTable":
35943                  case "activity":
35944                    const viewWithoutLayout = { ...view };
35945                    if ("layout" in viewWithoutLayout) {
35946                      delete viewWithoutLayout.layout;
35947                    }
35948                    return onChangeView({
35949                      ...viewWithoutLayout,
35950                      type: e2.target.value,
35951                      ...defaultLayouts4[e2.target.value]
35952                    });
35953                }
35954                (0, import_warning.default)("Invalid dataview");
35955              },
35956              children: /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Menu9.ItemLabel, { children: config2.label })
35957            },
35958            layout
35959          );
35960        }) })
35961      ] });
35962    }
35963    function SortFieldControl() {
35964      const { view, fields, onChangeView } = (0, import_element103.useContext)(dataviews_context_default);
35965      const orderOptions = (0, import_element103.useMemo)(() => {
35966        const sortableFields = fields.filter(
35967          (field) => field.enableSorting !== false
35968        );
35969        return sortableFields.map((field) => {
35970          return {
35971            label: field.label,
35972            value: field.id
35973          };
35974        });
35975      }, [fields]);
35976      return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
35977        import_components118.SelectControl,
35978        {
35979          __next40pxDefaultSize: true,
35980          label: (0, import_i18n113.__)("Sort by"),
35981          value: view.sort?.field,
35982          options: orderOptions,
35983          onChange: (value) => {
35984            onChangeView({
35985              ...view,
35986              sort: {
35987                direction: view?.sort?.direction || "desc",
35988                field: value
35989              },
35990              showLevels: false
35991            });
35992          }
35993        }
35994      );
35995    }
35996    function SortDirectionControl() {
35997      const { view, fields, onChangeView } = (0, import_element103.useContext)(dataviews_context_default);
35998      const sortableFields = fields.filter(
35999        (field) => field.enableSorting !== false
36000      );
36001      if (sortableFields.length === 0) {
36002        return null;
36003      }
36004      let value = view.sort?.direction;
36005      if (!value && view.sort?.field) {
36006        value = "desc";
36007      }
36008      return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36009        import_components118.__experimentalToggleGroupControl,
36010        {
36011          className: "dataviews-view-config__sort-direction",
36012          __next40pxDefaultSize: true,
36013          isBlock: true,
36014          label: (0, import_i18n113.__)("Order"),
36015          value,
36016          onChange: (newDirection) => {
36017            if (newDirection === "asc" || newDirection === "desc") {
36018              onChangeView({
36019                ...view,
36020                sort: {
36021                  direction: newDirection,
36022                  field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field.
36023                  fields.find(
36024                    (field) => field.enableSorting !== false
36025                  )?.id || ""
36026                },
36027                showLevels: false
36028              });
36029              return;
36030            }
36031            (0, import_warning.default)("Invalid direction");
36032          },
36033          children: SORTING_DIRECTIONS.map((direction) => {
36034            return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36035              import_components118.__experimentalToggleGroupControlOptionIcon,
36036              {
36037                value: direction,
36038                icon: sortIcons[direction],
36039                label: sortLabels[direction]
36040              },
36041              direction
36042            );
36043          })
36044        }
36045      );
36046    }
36047    function ItemsPerPageControl() {
36048      const { view, config: config2, onChangeView } = (0, import_element103.useContext)(dataviews_context_default);
36049      const { infiniteScrollEnabled } = view;
36050      if (!config2 || !config2.perPageSizes || config2.perPageSizes.length < 2 || config2.perPageSizes.length > 6 || infiniteScrollEnabled) {
36051        return null;
36052      }
36053      return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36054        import_components118.__experimentalToggleGroupControl,
36055        {
36056          __next40pxDefaultSize: true,
36057          isBlock: true,
36058          label: (0, import_i18n113.__)("Items per page"),
36059          value: view.perPage || 10,
36060          disabled: !view?.sort?.field,
36061          onChange: (newItemsPerPage) => {
36062            const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10);
36063            onChangeView({
36064              ...view,
36065              perPage: newItemsPerPageNumber,
36066              page: 1
36067            });
36068          },
36069          children: config2.perPageSizes.map((value) => {
36070            return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36071              import_components118.__experimentalToggleGroupControlOption,
36072              {
36073                value,
36074                label: value.toString()
36075              },
36076              value
36077            );
36078          })
36079        }
36080      );
36081    }
36082    function ResetViewButton() {
36083      const { onReset } = (0, import_element103.useContext)(dataviews_context_default);
36084      if (onReset === void 0) {
36085        return null;
36086      }
36087      const isDisabled = onReset === false;
36088      return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36089        import_components118.Button,
36090        {
36091          variant: "tertiary",
36092          size: "compact",
36093          disabled: isDisabled,
36094          accessibleWhenDisabled: true,
36095          className: "dataviews-view-config__reset-button",
36096          onClick: () => {
36097            if (typeof onReset === "function") {
36098              onReset();
36099            }
36100          },
36101          children: (0, import_i18n113.__)("Reset view")
36102        }
36103      );
36104    }
36105    function DataviewsViewConfigDropdown() {
36106      const { view, onReset } = (0, import_element103.useContext)(dataviews_context_default);
36107      const popoverId = (0, import_compose22.useInstanceId)(
36108        _DataViewsViewConfig,
36109        "dataviews-view-config-dropdown"
36110      );
36111      const activeLayout = VIEW_LAYOUTS.find(
36112        (layout) => layout.type === view.type
36113      );
36114      const isModified = typeof onReset === "function";
36115      return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36116        import_components118.Dropdown,
36117        {
36118          expandOnMobile: true,
36119          popoverProps: {
36120            ...DATAVIEWS_CONFIG_POPOVER_PROPS,
36121            id: popoverId
36122          },
36123          renderToggle: ({ onToggle, isOpen }) => {
36124            return /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "dataviews-view-config__toggle-wrapper", children: [
36125              /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36126                import_components118.Button,
36127                {
36128                  size: "compact",
36129                  icon: cog_default,
36130                  label: (0, import_i18n113._x)(
36131                    "View options",
36132                    "View is used as a noun"
36133                  ),
36134                  onClick: onToggle,
36135                  "aria-expanded": isOpen ? "true" : "false",
36136                  "aria-controls": popoverId
36137                }
36138              ),
36139              isModified && /* @__PURE__ */ (0, import_jsx_runtime227.jsx)("span", { className: "dataviews-view-config__modified-indicator" })
36140            ] });
36141          },
36142          renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36143            import_components118.__experimentalDropdownContentWrapper,
36144            {
36145              paddingSize: "medium",
36146              className: "dataviews-config__popover-content-wrapper",
36147              children: /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(
36148                Stack,
36149                {
36150                  direction: "column",
36151                  className: "dataviews-view-config",
36152                  gap: "xl",
36153                  children: [
36154                    /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(
36155                      Stack,
36156                      {
36157                        direction: "row",
36158                        justify: "space-between",
36159                        align: "center",
36160                        className: "dataviews-view-config__header",
36161                        children: [
36162                          /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
36163                            import_components118.__experimentalHeading,
36164                            {
36165                              level: 2,
36166                              className: "dataviews-settings-section__title",
36167                              children: (0, import_i18n113.__)("Appearance")
36168                            }
36169                          ),
36170                          /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(ResetViewButton, {})
36171                        ]
36172                      }
36173                    ),
36174                    /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(Stack, { direction: "column", gap: "lg", children: [
36175                      /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(
36176                        Stack,
36177                        {
36178                          direction: "row",
36179                          gap: "sm",
36180                          className: "dataviews-view-config__sort-controls",
36181                          children: [
36182                            /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(SortFieldControl, {}),
36183                            /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(SortDirectionControl, {})
36184                          ]
36185                        }
36186                      ),
36187                      !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(activeLayout.viewConfigOptions, {}),
36188                      /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(InfiniteScrollToggle, {}),
36189                      /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(ItemsPerPageControl, {}),
36190                      /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(PropertiesSection, {})
36191                    ] })
36192                  ]
36193                }
36194              )
36195            }
36196          )
36197        }
36198      );
36199    }
36200    function _DataViewsViewConfig() {
36201      return /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(import_jsx_runtime227.Fragment, { children: [
36202        /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(ViewTypeMenu, {}),
36203        /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(DataviewsViewConfigDropdown, {})
36204      ] });
36205    }
36206    var DataViewsViewConfig = (0, import_element103.memo)(_DataViewsViewConfig);
36207    var dataviews_view_config_default = DataViewsViewConfig;
36208  
36209    // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
36210    var import_components119 = __toESM(require_components(), 1);
36211    var import_element104 = __toESM(require_element(), 1);
36212  
36213    // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs
36214    function getCustomValidity(isValid2, validity) {
36215      let customValidity;
36216      if (isValid2?.required && validity?.required) {
36217        customValidity = validity?.required?.message ? validity.required : void 0;
36218      } else if (isValid2?.pattern && validity?.pattern) {
36219        customValidity = validity.pattern;
36220      } else if (isValid2?.min && validity?.min) {
36221        customValidity = validity.min;
36222      } else if (isValid2?.max && validity?.max) {
36223        customValidity = validity.max;
36224      } else if (isValid2?.minLength && validity?.minLength) {
36225        customValidity = validity.minLength;
36226      } else if (isValid2?.maxLength && validity?.maxLength) {
36227        customValidity = validity.maxLength;
36228      } else if (isValid2?.elements && validity?.elements) {
36229        customValidity = validity.elements;
36230      } else if (validity?.custom) {
36231        customValidity = validity.custom;
36232      }
36233      return customValidity;
36234    }
36235  
36236    // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
36237    var import_jsx_runtime228 = __toESM(require_jsx_runtime(), 1);
36238    var { ValidatedCheckboxControl } = unlock3(import_components119.privateApis);
36239    function Checkbox({
36240      field,
36241      onChange,
36242      data,
36243      hideLabelFromVision,
36244      markWhenOptional,
36245      validity
36246    }) {
36247      const { getValue, setValue, label, description, isValid: isValid2 } = field;
36248      const onChangeControl = (0, import_element104.useCallback)(() => {
36249        onChange(
36250          setValue({ item: data, value: !getValue({ item: data }) })
36251        );
36252      }, [data, getValue, onChange, setValue]);
36253      return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
36254        ValidatedCheckboxControl,
36255        {
36256          required: !!field.isValid?.required,
36257          markWhenOptional,
36258          customValidity: getCustomValidity(isValid2, validity),
36259          hidden: hideLabelFromVision,
36260          label,
36261          help: description,
36262          checked: getValue({ item: data }),
36263          onChange: onChangeControl
36264        }
36265      );
36266    }
36267  
36268    // packages/dataviews/build-module/components/dataform-controls/combobox.mjs
36269    var import_components120 = __toESM(require_components(), 1);
36270    var import_element105 = __toESM(require_element(), 1);
36271    var import_jsx_runtime229 = __toESM(require_jsx_runtime(), 1);
36272    var { ValidatedComboboxControl } = unlock3(import_components120.privateApis);
36273    function Combobox3({
36274      data,
36275      field,
36276      onChange,
36277      hideLabelFromVision,
36278      validity
36279    }) {
36280      const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field;
36281      const value = getValue({ item: data }) ?? "";
36282      const onChangeControl = (0, import_element105.useCallback)(
36283        (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })),
36284        [data, onChange, setValue]
36285      );
36286      const { elements: elements2, isLoading } = useElements({
36287        elements: field.elements,
36288        getElements: field.getElements
36289      });
36290      if (isLoading) {
36291        return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(import_components120.Spinner, {});
36292      }
36293      return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
36294        ValidatedComboboxControl,
36295        {
36296          required: !!field.isValid?.required,
36297          customValidity: getCustomValidity(isValid2, validity),
36298          label,
36299          value,
36300          help: description,
36301          placeholder,
36302          options: elements2,
36303          onChange: onChangeControl,
36304          hideLabelFromVision,
36305          allowReset: true,
36306          expandOnFocus: true
36307        }
36308      );
36309    }
36310  
36311    // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
36312    var import_components122 = __toESM(require_components(), 1);
36313    var import_element107 = __toESM(require_element(), 1);
36314    var import_i18n115 = __toESM(require_i18n(), 1);
36315    var import_date4 = __toESM(require_date(), 1);
36316  
36317    // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs
36318    var import_components121 = __toESM(require_components(), 1);
36319    var import_element106 = __toESM(require_element(), 1);
36320    var import_i18n114 = __toESM(require_i18n(), 1);
36321    var import_jsx_runtime230 = __toESM(require_jsx_runtime(), 1);
36322    var TIME_UNITS_OPTIONS = {
36323      [OPERATOR_IN_THE_PAST]: [
36324        { value: "days", label: (0, import_i18n114.__)("Days") },
36325        { value: "weeks", label: (0, import_i18n114.__)("Weeks") },
36326        { value: "months", label: (0, import_i18n114.__)("Months") },
36327        { value: "years", label: (0, import_i18n114.__)("Years") }
36328      ],
36329      [OPERATOR_OVER]: [
36330        { value: "days", label: (0, import_i18n114.__)("Days ago") },
36331        { value: "weeks", label: (0, import_i18n114.__)("Weeks ago") },
36332        { value: "months", label: (0, import_i18n114.__)("Months ago") },
36333        { value: "years", label: (0, import_i18n114.__)("Years ago") }
36334      ]
36335    };
36336    function RelativeDateControl({
36337      className,
36338      data,
36339      field,
36340      onChange,
36341      hideLabelFromVision,
36342      operator
36343    }) {
36344      const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
36345      const { id, label, getValue, setValue } = field;
36346      const fieldValue = getValue({ item: data });
36347      const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
36348      const onChangeValue = (0, import_element106.useCallback)(
36349        (newValue) => onChange(
36350          setValue({
36351            item: data,
36352            value: { value: Number(newValue), unit }
36353          })
36354        ),
36355        [onChange, setValue, data, unit]
36356      );
36357      const onChangeUnit = (0, import_element106.useCallback)(
36358        (newUnit) => onChange(
36359          setValue({
36360            item: data,
36361            value: { value: relValue, unit: newUnit }
36362          })
36363        ),
36364        [onChange, setValue, data, relValue]
36365      );
36366      return /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
36367        import_components121.BaseControl,
36368        {
36369          id,
36370          className: clsx_default(className, "dataviews-controls__relative-date"),
36371          label,
36372          hideLabelFromVision,
36373          children: /* @__PURE__ */ (0, import_jsx_runtime230.jsxs)(Stack, { direction: "row", gap: "sm", children: [
36374            /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
36375              import_components121.__experimentalNumberControl,
36376              {
36377                __next40pxDefaultSize: true,
36378                className: "dataviews-controls__relative-date-number",
36379                spinControls: "none",
36380                min: 1,
36381                step: 1,
36382                value: relValue,
36383                onChange: onChangeValue
36384              }
36385            ),
36386            /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
36387              import_components121.SelectControl,
36388              {
36389                className: "dataviews-controls__relative-date-unit",
36390                __next40pxDefaultSize: true,
36391                label: (0, import_i18n114.__)("Unit"),
36392                value: unit,
36393                options,
36394                onChange: onChangeUnit,
36395                hideLabelFromVision: true
36396              }
36397            )
36398          ] })
36399        }
36400      );
36401    }
36402  
36403    // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs
36404    var import_date3 = __toESM(require_date(), 1);
36405    function parseDateTime(dateTimeString) {
36406      if (!dateTimeString) {
36407        return null;
36408      }
36409      const parsed = (0, import_date3.getDate)(dateTimeString);
36410      return parsed && isValid(parsed) ? parsed : null;
36411    }
36412  
36413    // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
36414    var import_jsx_runtime231 = __toESM(require_jsx_runtime(), 1);
36415    var { DateCalendar, ValidatedInputControl } = unlock3(import_components122.privateApis);
36416    var formatDateTime = (value) => {
36417      if (!value) {
36418        return "";
36419      }
36420      return (0, import_date4.dateI18n)("Y-m-d\\TH:i", (0, import_date4.getDate)(value));
36421    };
36422    function CalendarDateTimeControl({
36423      data,
36424      field,
36425      onChange,
36426      hideLabelFromVision,
36427      markWhenOptional,
36428      validity
36429    }) {
36430      const { id, label, description, setValue, getValue, isValid: isValid2 } = field;
36431      const fieldValue = getValue({ item: data });
36432      const value = typeof fieldValue === "string" ? fieldValue : void 0;
36433      const [calendarMonth, setCalendarMonth] = (0, import_element107.useState)(() => {
36434        const parsedDate = parseDateTime(value);
36435        return parsedDate || /* @__PURE__ */ new Date();
36436      });
36437      const inputControlRef = (0, import_element107.useRef)(null);
36438      const validationTimeoutRef = (0, import_element107.useRef)(void 0);
36439      const previousFocusRef = (0, import_element107.useRef)(null);
36440      const onChangeCallback = (0, import_element107.useCallback)(
36441        (newValue) => onChange(setValue({ item: data, value: newValue })),
36442        [data, onChange, setValue]
36443      );
36444      (0, import_element107.useEffect)(() => {
36445        return () => {
36446          if (validationTimeoutRef.current) {
36447            clearTimeout(validationTimeoutRef.current);
36448          }
36449        };
36450      }, []);
36451      const onSelectDate = (0, import_element107.useCallback)(
36452        (newDate) => {
36453          let dateTimeValue;
36454          if (newDate) {
36455            const wpDate = (0, import_date4.dateI18n)("Y-m-d", newDate);
36456            let wpTime;
36457            if (value) {
36458              wpTime = (0, import_date4.dateI18n)("H:i", (0, import_date4.getDate)(value));
36459            } else {
36460              wpTime = (0, import_date4.dateI18n)("H:i", newDate);
36461            }
36462            const finalDateTime = (0, import_date4.getDate)(`$wpDate}T$wpTime}`);
36463            dateTimeValue = finalDateTime.toISOString();
36464            onChangeCallback(dateTimeValue);
36465            if (validationTimeoutRef.current) {
36466              clearTimeout(validationTimeoutRef.current);
36467            }
36468          } else {
36469            onChangeCallback(void 0);
36470          }
36471          previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement;
36472          validationTimeoutRef.current = setTimeout(() => {
36473            if (inputControlRef.current) {
36474              inputControlRef.current.focus();
36475              inputControlRef.current.blur();
36476              onChangeCallback(dateTimeValue);
36477              if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) {
36478                previousFocusRef.current.focus();
36479              }
36480            }
36481          }, 0);
36482        },
36483        [onChangeCallback, value]
36484      );
36485      const handleManualDateTimeChange = (0, import_element107.useCallback)(
36486        (newValue) => {
36487          if (newValue) {
36488            const dateTime = (0, import_date4.getDate)(newValue);
36489            onChangeCallback(dateTime.toISOString());
36490            const parsedDate = parseDateTime(dateTime.toISOString());
36491            if (parsedDate) {
36492              setCalendarMonth(parsedDate);
36493            }
36494          } else {
36495            onChangeCallback(void 0);
36496          }
36497        },
36498        [onChangeCallback]
36499      );
36500      const { format: fieldFormat } = field;
36501      const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek;
36502      const {
36503        timezone: { string: timezoneString }
36504      } = (0, import_date4.getSettings)();
36505      let displayLabel = label;
36506      if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) {
36507        displayLabel = `$label} (${(0, import_i18n115.__)("Required")})`;
36508      } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) {
36509        displayLabel = `$label} (${(0, import_i18n115.__)("Optional")})`;
36510      }
36511      return /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(
36512        import_components122.BaseControl,
36513        {
36514          id,
36515          label: displayLabel,
36516          help: description,
36517          hideLabelFromVision,
36518          children: /* @__PURE__ */ (0, import_jsx_runtime231.jsxs)(Stack, { direction: "column", gap: "lg", children: [
36519            /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(
36520              DateCalendar,
36521              {
36522                style: { width: "100%" },
36523                selected: value ? parseDateTime(value) || void 0 : void 0,
36524                onSelect: onSelectDate,
36525                month: calendarMonth,
36526                onMonthChange: setCalendarMonth,
36527                timeZone: timezoneString || void 0,
36528                weekStartsOn
36529              }
36530            ),
36531            /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(
36532              ValidatedInputControl,
36533              {
36534                ref: inputControlRef,
36535                __next40pxDefaultSize: true,
36536                required: !!isValid2?.required,
36537                customValidity: getCustomValidity(isValid2, validity),
36538                type: "datetime-local",
36539                label: (0, import_i18n115.__)("Date time"),
36540                hideLabelFromVision: true,
36541                value: formatDateTime(value),
36542                onChange: handleManualDateTimeChange
36543              }
36544            )
36545          ] })
36546        }
36547      );
36548    }
36549    function DateTime({
36550      data,
36551      field,
36552      onChange,
36553      hideLabelFromVision,
36554      markWhenOptional,
36555      operator,
36556      validity
36557    }) {
36558      if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
36559        return /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(
36560          RelativeDateControl,
36561          {
36562            className: "dataviews-controls__datetime",
36563            data,
36564            field,
36565            onChange,
36566            hideLabelFromVision,
36567            operator
36568          }
36569        );
36570      }
36571      return /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(
36572        CalendarDateTimeControl,
36573        {
36574          data,
36575          field,
36576          onChange,
36577          hideLabelFromVision,
36578          markWhenOptional,
36579          validity
36580        }
36581      );
36582    }
36583  
36584    // packages/dataviews/build-module/components/dataform-controls/date.mjs
36585    var import_components123 = __toESM(require_components(), 1);
36586    var import_element108 = __toESM(require_element(), 1);
36587    var import_i18n116 = __toESM(require_i18n(), 1);
36588    var import_date5 = __toESM(require_date(), 1);
36589    var import_jsx_runtime232 = __toESM(require_jsx_runtime(), 1);
36590    var { DateCalendar: DateCalendar2, DateRangeCalendar } = unlock3(import_components123.privateApis);
36591    var DATE_PRESETS = [
36592      {
36593        id: "today",
36594        label: (0, import_i18n116.__)("Today"),
36595        getValue: () => (0, import_date5.getDate)(null)
36596      },
36597      {
36598        id: "yesterday",
36599        label: (0, import_i18n116.__)("Yesterday"),
36600        getValue: () => {
36601          const today = (0, import_date5.getDate)(null);
36602          return subDays(today, 1);
36603        }
36604      },
36605      {
36606        id: "past-week",
36607        label: (0, import_i18n116.__)("Past week"),
36608        getValue: () => {
36609          const today = (0, import_date5.getDate)(null);
36610          return subDays(today, 7);
36611        }
36612      },
36613      {
36614        id: "past-month",
36615        label: (0, import_i18n116.__)("Past month"),
36616        getValue: () => {
36617          const today = (0, import_date5.getDate)(null);
36618          return subMonths(today, 1);
36619        }
36620      }
36621    ];
36622    var DATE_RANGE_PRESETS = [
36623      {
36624        id: "last-7-days",
36625        label: (0, import_i18n116.__)("Last 7 days"),
36626        getValue: () => {
36627          const today = (0, import_date5.getDate)(null);
36628          return [subDays(today, 7), today];
36629        }
36630      },
36631      {
36632        id: "last-30-days",
36633        label: (0, import_i18n116.__)("Last 30 days"),
36634        getValue: () => {
36635          const today = (0, import_date5.getDate)(null);
36636          return [subDays(today, 30), today];
36637        }
36638      },
36639      {
36640        id: "month-to-date",
36641        label: (0, import_i18n116.__)("Month to date"),
36642        getValue: () => {
36643          const today = (0, import_date5.getDate)(null);
36644          return [startOfMonth(today), today];
36645        }
36646      },
36647      {
36648        id: "last-year",
36649        label: (0, import_i18n116.__)("Last year"),
36650        getValue: () => {
36651          const today = (0, import_date5.getDate)(null);
36652          return [subYears(today, 1), today];
36653        }
36654      },
36655      {
36656        id: "year-to-date",
36657        label: (0, import_i18n116.__)("Year to date"),
36658        getValue: () => {
36659          const today = (0, import_date5.getDate)(null);
36660          return [startOfYear(today), today];
36661        }
36662      }
36663    ];
36664    var parseDate = (dateString) => {
36665      if (!dateString) {
36666        return null;
36667      }
36668      const parsed = (0, import_date5.getDate)(dateString);
36669      return parsed && isValid(parsed) ? parsed : null;
36670    };
36671    var formatDate = (date) => {
36672      if (!date) {
36673        return "";
36674      }
36675      return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
36676    };
36677    function ValidatedDateControl({
36678      field,
36679      validity,
36680      inputRefs,
36681      isTouched,
36682      setIsTouched,
36683      children
36684    }) {
36685      const { isValid: isValid2 } = field;
36686      const [customValidity, setCustomValidity] = (0, import_element108.useState)(void 0);
36687      const validateRefs = (0, import_element108.useCallback)(() => {
36688        const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
36689        for (const ref of refs) {
36690          const input = ref.current;
36691          if (input && !input.validity.valid) {
36692            setCustomValidity({
36693              type: "invalid",
36694              message: input.validationMessage
36695            });
36696            return;
36697          }
36698        }
36699        setCustomValidity(void 0);
36700      }, [inputRefs]);
36701      (0, import_element108.useEffect)(() => {
36702        const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
36703        const result = validity ? getCustomValidity(isValid2, validity) : void 0;
36704        for (const ref of refs) {
36705          const input = ref.current;
36706          if (input) {
36707            input.setCustomValidity(
36708              result?.type === "invalid" && result.message ? result.message : ""
36709            );
36710          }
36711        }
36712      }, [inputRefs, isValid2, validity]);
36713      (0, import_element108.useEffect)(() => {
36714        const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
36715        const handleInvalid = (event) => {
36716          event.preventDefault();
36717          setIsTouched(true);
36718        };
36719        for (const ref of refs) {
36720          ref.current?.addEventListener("invalid", handleInvalid);
36721        }
36722        return () => {
36723          for (const ref of refs) {
36724            ref.current?.removeEventListener("invalid", handleInvalid);
36725          }
36726        };
36727      }, [inputRefs, setIsTouched]);
36728      (0, import_element108.useEffect)(() => {
36729        if (!isTouched) {
36730          return;
36731        }
36732        const result = validity ? getCustomValidity(isValid2, validity) : void 0;
36733        if (result) {
36734          setCustomValidity(result);
36735        } else {
36736          validateRefs();
36737        }
36738      }, [isTouched, isValid2, validity, validateRefs]);
36739      const onBlur = (event) => {
36740        if (isTouched) {
36741          return;
36742        }
36743        if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
36744          setIsTouched(true);
36745        }
36746      };
36747      return /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)("div", { onBlur, children: [
36748        children,
36749        /* @__PURE__ */ (0, import_jsx_runtime232.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)(
36750          "p",
36751          {
36752            className: clsx_default(
36753              "components-validated-control__indicator",
36754              customValidity.type === "invalid" ? "is-invalid" : void 0
36755            ),
36756            children: [
36757              /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
36758                import_components123.Icon,
36759                {
36760                  className: "components-validated-control__indicator-icon",
36761                  icon: error_default,
36762                  size: 16,
36763                  fill: "currentColor"
36764                }
36765              ),
36766              customValidity.message
36767            ]
36768          }
36769        ) })
36770      ] });
36771    }
36772    function CalendarDateControl({
36773      data,
36774      field,
36775      onChange,
36776      hideLabelFromVision,
36777      markWhenOptional,
36778      validity
36779    }) {
36780      const {
36781        id,
36782        label,
36783        setValue,
36784        getValue,
36785        isValid: isValid2,
36786        format: fieldFormat
36787      } = field;
36788      const [selectedPresetId, setSelectedPresetId] = (0, import_element108.useState)(
36789        null
36790      );
36791      const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek;
36792      const fieldValue = getValue({ item: data });
36793      const value = typeof fieldValue === "string" ? fieldValue : void 0;
36794      const [calendarMonth, setCalendarMonth] = (0, import_element108.useState)(() => {
36795        const parsedDate = parseDate(value);
36796        return parsedDate || /* @__PURE__ */ new Date();
36797      });
36798      const [isTouched, setIsTouched] = (0, import_element108.useState)(false);
36799      const validityTargetRef = (0, import_element108.useRef)(null);
36800      const onChangeCallback = (0, import_element108.useCallback)(
36801        (newValue) => onChange(setValue({ item: data, value: newValue })),
36802        [data, onChange, setValue]
36803      );
36804      const onSelectDate = (0, import_element108.useCallback)(
36805        (newDate) => {
36806          const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0;
36807          onChangeCallback(dateValue);
36808          setSelectedPresetId(null);
36809          setIsTouched(true);
36810        },
36811        [onChangeCallback]
36812      );
36813      const handlePresetClick = (0, import_element108.useCallback)(
36814        (preset) => {
36815          const presetDate = preset.getValue();
36816          const dateValue = formatDate(presetDate);
36817          setCalendarMonth(presetDate);
36818          onChangeCallback(dateValue);
36819          setSelectedPresetId(preset.id);
36820          setIsTouched(true);
36821        },
36822        [onChangeCallback]
36823      );
36824      const handleManualDateChange = (0, import_element108.useCallback)(
36825        (newValue) => {
36826          onChangeCallback(newValue);
36827          if (newValue) {
36828            const parsedDate = parseDate(newValue);
36829            if (parsedDate) {
36830              setCalendarMonth(parsedDate);
36831            }
36832          }
36833          setSelectedPresetId(null);
36834          setIsTouched(true);
36835        },
36836        [onChangeCallback]
36837      );
36838      const {
36839        timezone: { string: timezoneString }
36840      } = (0, import_date5.getSettings)();
36841      let displayLabel = label;
36842      if (isValid2?.required && !markWhenOptional) {
36843        displayLabel = `$label} (${(0, import_i18n116.__)("Required")})`;
36844      } else if (!isValid2?.required && markWhenOptional) {
36845        displayLabel = `$label} (${(0, import_i18n116.__)("Optional")})`;
36846      }
36847      return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
36848        ValidatedDateControl,
36849        {
36850          field,
36851          validity,
36852          inputRefs: validityTargetRef,
36853          isTouched,
36854          setIsTouched,
36855          children: /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
36856            import_components123.BaseControl,
36857            {
36858              id,
36859              className: "dataviews-controls__date",
36860              label: displayLabel,
36861              hideLabelFromVision,
36862              children: /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)(Stack, { direction: "column", gap: "lg", children: [
36863                /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)(
36864                  Stack,
36865                  {
36866                    direction: "row",
36867                    gap: "sm",
36868                    wrap: "wrap",
36869                    justify: "flex-start",
36870                    children: [
36871                      DATE_PRESETS.map((preset) => {
36872                        const isSelected2 = selectedPresetId === preset.id;
36873                        return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
36874                          import_components123.Button,
36875                          {
36876                            className: "dataviews-controls__date-preset",
36877                            variant: "tertiary",
36878                            isPressed: isSelected2,
36879                            size: "small",
36880                            onClick: () => handlePresetClick(preset),
36881                            children: preset.label
36882                          },
36883                          preset.id
36884                        );
36885                      }),
36886                      /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
36887                        import_components123.Button,
36888                        {
36889                          className: "dataviews-controls__date-preset",
36890                          variant: "tertiary",
36891                          isPressed: !selectedPresetId,
36892                          size: "small",
36893                          disabled: !!selectedPresetId,
36894                          accessibleWhenDisabled: false,
36895                          children: (0, import_i18n116.__)("Custom")
36896                        }
36897                      )
36898                    ]
36899                  }
36900                ),
36901                /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
36902                  import_components123.__experimentalInputControl,
36903                  {
36904                    __next40pxDefaultSize: true,
36905                    ref: validityTargetRef,
36906                    type: "date",
36907                    label: (0, import_i18n116.__)("Date"),
36908                    hideLabelFromVision: true,
36909                    value,
36910                    onChange: handleManualDateChange,
36911                    required: !!field.isValid?.required
36912                  }
36913                ),
36914                /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
36915                  DateCalendar2,
36916                  {
36917                    style: { width: "100%" },
36918                    selected: value ? parseDate(value) || void 0 : void 0,
36919                    onSelect: onSelectDate,
36920                    month: calendarMonth,
36921                    onMonthChange: setCalendarMonth,
36922                    timeZone: timezoneString || void 0,
36923                    weekStartsOn
36924                  }
36925                )
36926              ] })
36927            }
36928          )
36929        }
36930      );
36931    }
36932    function CalendarDateRangeControl({
36933      data,
36934      field,
36935      onChange,
36936      hideLabelFromVision,
36937      markWhenOptional,
36938      validity
36939    }) {
36940      const { id, label, getValue, setValue, format: fieldFormat } = field;
36941      let value;
36942      const fieldValue = getValue({ item: data });
36943      if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
36944        value = fieldValue;
36945      }
36946      const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek;
36947      const onChangeCallback = (0, import_element108.useCallback)(
36948        (newValue) => {
36949          onChange(
36950            setValue({
36951              item: data,
36952              value: newValue
36953            })
36954          );
36955        },
36956        [data, onChange, setValue]
36957      );
36958      const [selectedPresetId, setSelectedPresetId] = (0, import_element108.useState)(
36959        null
36960      );
36961      const selectedRange = (0, import_element108.useMemo)(() => {
36962        if (!value) {
36963          return { from: void 0, to: void 0 };
36964        }
36965        const [from, to2] = value;
36966        return {
36967          from: parseDate(from) || void 0,
36968          to: parseDate(to2) || void 0
36969        };
36970      }, [value]);
36971      const [calendarMonth, setCalendarMonth] = (0, import_element108.useState)(() => {
36972        return selectedRange.from || /* @__PURE__ */ new Date();
36973      });
36974      const [isTouched, setIsTouched] = (0, import_element108.useState)(false);
36975      const fromInputRef = (0, import_element108.useRef)(null);
36976      const toInputRef = (0, import_element108.useRef)(null);
36977      const updateDateRange = (0, import_element108.useCallback)(
36978        (fromDate, toDate2) => {
36979          if (fromDate && toDate2) {
36980            onChangeCallback([
36981              formatDate(fromDate),
36982              formatDate(toDate2)
36983            ]);
36984          } else if (!fromDate && !toDate2) {
36985            onChangeCallback(void 0);
36986          }
36987        },
36988        [onChangeCallback]
36989      );
36990      const onSelectCalendarRange = (0, import_element108.useCallback)(
36991        (newRange) => {
36992          updateDateRange(newRange?.from, newRange?.to);
36993          setSelectedPresetId(null);
36994          setIsTouched(true);
36995        },
36996        [updateDateRange]
36997      );
36998      const handlePresetClick = (0, import_element108.useCallback)(
36999        (preset) => {
37000          const [startDate2, endDate] = preset.getValue();
37001          setCalendarMonth(startDate2);
37002          updateDateRange(startDate2, endDate);
37003          setSelectedPresetId(preset.id);
37004          setIsTouched(true);
37005        },
37006        [updateDateRange]
37007      );
37008      const handleManualDateChange = (0, import_element108.useCallback)(
37009        (fromOrTo, newValue) => {
37010          const [currentFrom, currentTo] = value || [
37011            void 0,
37012            void 0
37013          ];
37014          const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
37015          const updatedTo = fromOrTo === "to" ? newValue : currentTo;
37016          updateDateRange(updatedFrom, updatedTo);
37017          if (newValue) {
37018            const parsedDate = parseDate(newValue);
37019            if (parsedDate) {
37020              setCalendarMonth(parsedDate);
37021            }
37022          }
37023          setSelectedPresetId(null);
37024          setIsTouched(true);
37025        },
37026        [value, updateDateRange]
37027      );
37028      const { timezone } = (0, import_date5.getSettings)();
37029      let displayLabel = label;
37030      if (field.isValid?.required && !markWhenOptional) {
37031        displayLabel = `$label} (${(0, import_i18n116.__)("Required")})`;
37032      } else if (!field.isValid?.required && markWhenOptional) {
37033        displayLabel = `$label} (${(0, import_i18n116.__)("Optional")})`;
37034      }
37035      return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37036        ValidatedDateControl,
37037        {
37038          field,
37039          validity,
37040          inputRefs: [fromInputRef, toInputRef],
37041          isTouched,
37042          setIsTouched,
37043          children: /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37044            import_components123.BaseControl,
37045            {
37046              id,
37047              className: "dataviews-controls__date",
37048              label: displayLabel,
37049              hideLabelFromVision,
37050              children: /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)(Stack, { direction: "column", gap: "lg", children: [
37051                /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)(
37052                  Stack,
37053                  {
37054                    direction: "row",
37055                    gap: "sm",
37056                    wrap: "wrap",
37057                    justify: "flex-start",
37058                    children: [
37059                      DATE_RANGE_PRESETS.map((preset) => {
37060                        const isSelected2 = selectedPresetId === preset.id;
37061                        return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37062                          import_components123.Button,
37063                          {
37064                            className: "dataviews-controls__date-preset",
37065                            variant: "tertiary",
37066                            isPressed: isSelected2,
37067                            size: "small",
37068                            onClick: () => handlePresetClick(preset),
37069                            children: preset.label
37070                          },
37071                          preset.id
37072                        );
37073                      }),
37074                      /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37075                        import_components123.Button,
37076                        {
37077                          className: "dataviews-controls__date-preset",
37078                          variant: "tertiary",
37079                          isPressed: !selectedPresetId,
37080                          size: "small",
37081                          accessibleWhenDisabled: false,
37082                          disabled: !!selectedPresetId,
37083                          children: (0, import_i18n116.__)("Custom")
37084                        }
37085                      )
37086                    ]
37087                  }
37088                ),
37089                /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)(
37090                  Stack,
37091                  {
37092                    direction: "row",
37093                    gap: "sm",
37094                    justify: "space-between",
37095                    className: "dataviews-controls__date-range-inputs",
37096                    children: [
37097                      /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37098                        import_components123.__experimentalInputControl,
37099                        {
37100                          __next40pxDefaultSize: true,
37101                          ref: fromInputRef,
37102                          type: "date",
37103                          label: (0, import_i18n116.__)("From"),
37104                          hideLabelFromVision: true,
37105                          value: value?.[0],
37106                          onChange: (newValue) => handleManualDateChange("from", newValue),
37107                          required: !!field.isValid?.required
37108                        }
37109                      ),
37110                      /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37111                        import_components123.__experimentalInputControl,
37112                        {
37113                          __next40pxDefaultSize: true,
37114                          ref: toInputRef,
37115                          type: "date",
37116                          label: (0, import_i18n116.__)("To"),
37117                          hideLabelFromVision: true,
37118                          value: value?.[1],
37119                          onChange: (newValue) => handleManualDateChange("to", newValue),
37120                          required: !!field.isValid?.required
37121                        }
37122                      )
37123                    ]
37124                  }
37125                ),
37126                /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37127                  DateRangeCalendar,
37128                  {
37129                    style: { width: "100%" },
37130                    selected: selectedRange,
37131                    onSelect: onSelectCalendarRange,
37132                    month: calendarMonth,
37133                    onMonthChange: setCalendarMonth,
37134                    timeZone: timezone.string || void 0,
37135                    weekStartsOn
37136                  }
37137                )
37138              ] })
37139            }
37140          )
37141        }
37142      );
37143    }
37144    function DateControl({
37145      data,
37146      field,
37147      onChange,
37148      hideLabelFromVision,
37149      markWhenOptional,
37150      operator,
37151      validity
37152    }) {
37153      if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
37154        return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37155          RelativeDateControl,
37156          {
37157            className: "dataviews-controls__date",
37158            data,
37159            field,
37160            onChange,
37161            hideLabelFromVision,
37162            operator
37163          }
37164        );
37165      }
37166      if (operator === OPERATOR_BETWEEN) {
37167        return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37168          CalendarDateRangeControl,
37169          {
37170            data,
37171            field,
37172            onChange,
37173            hideLabelFromVision,
37174            markWhenOptional,
37175            validity
37176          }
37177        );
37178      }
37179      return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
37180        CalendarDateControl,
37181        {
37182          data,
37183          field,
37184          onChange,
37185          hideLabelFromVision,
37186          markWhenOptional,
37187          validity
37188        }
37189      );
37190    }
37191  
37192    // packages/dataviews/build-module/components/dataform-controls/select.mjs
37193    var import_components124 = __toESM(require_components(), 1);
37194    var import_element109 = __toESM(require_element(), 1);
37195    var import_jsx_runtime233 = __toESM(require_jsx_runtime(), 1);
37196    var { ValidatedSelectControl } = unlock3(import_components124.privateApis);
37197    function Select({
37198      data,
37199      field,
37200      onChange,
37201      hideLabelFromVision,
37202      markWhenOptional,
37203      validity
37204    }) {
37205      const { type, label, description, getValue, setValue, isValid: isValid2 } = field;
37206      const isMultiple = type === "array";
37207      const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
37208      const onChangeControl = (0, import_element109.useCallback)(
37209        (newValue) => onChange(setValue({ item: data, value: newValue })),
37210        [data, onChange, setValue]
37211      );
37212      const { elements: elements2, isLoading } = useElements({
37213        elements: field.elements,
37214        getElements: field.getElements
37215      });
37216      if (isLoading) {
37217        return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(import_components124.Spinner, {});
37218      }
37219      return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
37220        ValidatedSelectControl,
37221        {
37222          required: !!field.isValid?.required,
37223          markWhenOptional,
37224          customValidity: getCustomValidity(isValid2, validity),
37225          label,
37226          value,
37227          help: description,
37228          options: elements2,
37229          onChange: onChangeControl,
37230          __next40pxDefaultSize: true,
37231          hideLabelFromVision,
37232          multiple: isMultiple
37233        }
37234      );
37235    }
37236  
37237    // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs
37238    var import_jsx_runtime234 = __toESM(require_jsx_runtime(), 1);
37239    var ELEMENTS_THRESHOLD = 10;
37240    function AdaptiveSelect(props) {
37241      const { field } = props;
37242      const { elements: elements2 } = useElements({
37243        elements: field.elements,
37244        getElements: field.getElements
37245      });
37246      if (elements2.length >= ELEMENTS_THRESHOLD) {
37247        return /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(Combobox3, { ...props });
37248      }
37249      return /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(Select, { ...props });
37250    }
37251  
37252    // packages/dataviews/build-module/components/dataform-controls/email.mjs
37253    var import_components126 = __toESM(require_components(), 1);
37254  
37255    // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs
37256    var import_components125 = __toESM(require_components(), 1);
37257    var import_element110 = __toESM(require_element(), 1);
37258    var import_jsx_runtime235 = __toESM(require_jsx_runtime(), 1);
37259    var { ValidatedInputControl: ValidatedInputControl2 } = unlock3(import_components125.privateApis);
37260    function ValidatedText({
37261      data,
37262      field,
37263      onChange,
37264      hideLabelFromVision,
37265      markWhenOptional,
37266      type,
37267      prefix: prefix2,
37268      suffix,
37269      validity
37270    }) {
37271      const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
37272      const value = getValue({ item: data });
37273      const onChangeControl = (0, import_element110.useCallback)(
37274        (newValue) => onChange(
37275          setValue({
37276            item: data,
37277            value: newValue
37278          })
37279        ),
37280        [data, setValue, onChange]
37281      );
37282      return /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
37283        ValidatedInputControl2,
37284        {
37285          required: !!isValid2.required,
37286          markWhenOptional,
37287          customValidity: getCustomValidity(isValid2, validity),
37288          label,
37289          placeholder,
37290          value: value ?? "",
37291          help: description,
37292          onChange: onChangeControl,
37293          hideLabelFromVision,
37294          type,
37295          prefix: prefix2,
37296          suffix,
37297          pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0,
37298          minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
37299          maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
37300          __next40pxDefaultSize: true
37301        }
37302      );
37303    }
37304  
37305    // packages/dataviews/build-module/components/dataform-controls/email.mjs
37306    var import_jsx_runtime236 = __toESM(require_jsx_runtime(), 1);
37307    function Email({
37308      data,
37309      field,
37310      onChange,
37311      hideLabelFromVision,
37312      markWhenOptional,
37313      validity
37314    }) {
37315      return /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
37316        ValidatedText,
37317        {
37318          ...{
37319            data,
37320            field,
37321            onChange,
37322            hideLabelFromVision,
37323            markWhenOptional,
37324            validity,
37325            type: "email",
37326            prefix: /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(import_components126.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(import_components126.Icon, { icon: envelope_default }) })
37327          }
37328        }
37329      );
37330    }
37331  
37332    // packages/dataviews/build-module/components/dataform-controls/telephone.mjs
37333    var import_components127 = __toESM(require_components(), 1);
37334    var import_jsx_runtime237 = __toESM(require_jsx_runtime(), 1);
37335    function Telephone({
37336      data,
37337      field,
37338      onChange,
37339      hideLabelFromVision,
37340      markWhenOptional,
37341      validity
37342    }) {
37343      return /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(
37344        ValidatedText,
37345        {
37346          ...{
37347            data,
37348            field,
37349            onChange,
37350            hideLabelFromVision,
37351            markWhenOptional,
37352            validity,
37353            type: "tel",
37354            prefix: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(import_components127.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(import_components127.Icon, { icon: mobile_default }) })
37355          }
37356        }
37357      );
37358    }
37359  
37360    // packages/dataviews/build-module/components/dataform-controls/url.mjs
37361    var import_components128 = __toESM(require_components(), 1);
37362    var import_jsx_runtime238 = __toESM(require_jsx_runtime(), 1);
37363    function Url({
37364      data,
37365      field,
37366      onChange,
37367      hideLabelFromVision,
37368      markWhenOptional,
37369      validity
37370    }) {
37371      return /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(
37372        ValidatedText,
37373        {
37374          ...{
37375            data,
37376            field,
37377            onChange,
37378            hideLabelFromVision,
37379            markWhenOptional,
37380            validity,
37381            type: "url",
37382            prefix: /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(import_components128.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(import_components128.Icon, { icon: link_default }) })
37383          }
37384        }
37385      );
37386    }
37387  
37388    // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs
37389    var import_components129 = __toESM(require_components(), 1);
37390    var import_element111 = __toESM(require_element(), 1);
37391    var import_i18n117 = __toESM(require_i18n(), 1);
37392    var import_jsx_runtime239 = __toESM(require_jsx_runtime(), 1);
37393    var { ValidatedNumberControl } = unlock3(import_components129.privateApis);
37394    function toNumberOrEmpty(value) {
37395      if (value === "" || value === void 0) {
37396        return "";
37397      }
37398      const number = Number(value);
37399      return Number.isFinite(number) ? number : "";
37400    }
37401    function BetweenControls({
37402      value,
37403      onChange,
37404      hideLabelFromVision,
37405      step
37406    }) {
37407      const [min = "", max = ""] = value;
37408      const onChangeMin = (0, import_element111.useCallback)(
37409        (newValue) => onChange([toNumberOrEmpty(newValue), max]),
37410        [onChange, max]
37411      );
37412      const onChangeMax = (0, import_element111.useCallback)(
37413        (newValue) => onChange([min, toNumberOrEmpty(newValue)]),
37414        [onChange, min]
37415      );
37416      return /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
37417        import_components129.BaseControl,
37418        {
37419          help: (0, import_i18n117.__)("The max. value must be greater than the min. value."),
37420          children: /* @__PURE__ */ (0, import_jsx_runtime239.jsxs)(import_components129.Flex, { direction: "row", gap: 4, children: [
37421            /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
37422              import_components129.__experimentalNumberControl,
37423              {
37424                label: (0, import_i18n117.__)("Min."),
37425                value: min,
37426                max: max ? Number(max) - step : void 0,
37427                onChange: onChangeMin,
37428                __next40pxDefaultSize: true,
37429                hideLabelFromVision,
37430                step
37431              }
37432            ),
37433            /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
37434              import_components129.__experimentalNumberControl,
37435              {
37436                label: (0, import_i18n117.__)("Max."),
37437                value: max,
37438                min: min ? Number(min) + step : void 0,
37439                onChange: onChangeMax,
37440                __next40pxDefaultSize: true,
37441                hideLabelFromVision,
37442                step
37443              }
37444            )
37445          ] })
37446        }
37447      );
37448    }
37449    function ValidatedNumber({
37450      data,
37451      field,
37452      onChange,
37453      hideLabelFromVision,
37454      markWhenOptional,
37455      operator,
37456      validity
37457    }) {
37458      const decimals = field.format?.decimals ?? 0;
37459      const step = Math.pow(10, Math.abs(decimals) * -1);
37460      const { label, description, getValue, setValue, isValid: isValid2 } = field;
37461      const value = getValue({ item: data }) ?? "";
37462      const onChangeControl = (0, import_element111.useCallback)(
37463        (newValue) => {
37464          onChange(
37465            setValue({
37466              item: data,
37467              // Do not convert an empty string or undefined to a number,
37468              // otherwise there's a mismatch between the UI control (empty)
37469              // and the data relied by onChange (0).
37470              value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
37471            })
37472          );
37473        },
37474        [data, onChange, setValue]
37475      );
37476      const onChangeBetweenControls = (0, import_element111.useCallback)(
37477        (newValue) => {
37478          onChange(
37479            setValue({
37480              item: data,
37481              value: newValue
37482            })
37483          );
37484        },
37485        [data, onChange, setValue]
37486      );
37487      if (operator === OPERATOR_BETWEEN) {
37488        let valueBetween = ["", ""];
37489        if (Array.isArray(value) && value.length === 2 && value.every(
37490          (element) => typeof element === "number" || element === ""
37491        )) {
37492          valueBetween = value;
37493        }
37494        return /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
37495          BetweenControls,
37496          {
37497            value: valueBetween,
37498            onChange: onChangeBetweenControls,
37499            hideLabelFromVision,
37500            step
37501          }
37502        );
37503      }
37504      return /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
37505        ValidatedNumberControl,
37506        {
37507          required: !!isValid2.required,
37508          markWhenOptional,
37509          customValidity: getCustomValidity(isValid2, validity),
37510          label,
37511          help: description,
37512          value,
37513          onChange: onChangeControl,
37514          __next40pxDefaultSize: true,
37515          hideLabelFromVision,
37516          step,
37517          min: isValid2.min ? isValid2.min.constraint : void 0,
37518          max: isValid2.max ? isValid2.max.constraint : void 0
37519        }
37520      );
37521    }
37522  
37523    // packages/dataviews/build-module/components/dataform-controls/integer.mjs
37524    var import_jsx_runtime240 = __toESM(require_jsx_runtime(), 1);
37525    function Integer(props) {
37526      return /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(ValidatedNumber, { ...props });
37527    }
37528  
37529    // packages/dataviews/build-module/components/dataform-controls/number.mjs
37530    var import_jsx_runtime241 = __toESM(require_jsx_runtime(), 1);
37531    function Number2(props) {
37532      return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(ValidatedNumber, { ...props });
37533    }
37534  
37535    // packages/dataviews/build-module/components/dataform-controls/radio.mjs
37536    var import_components130 = __toESM(require_components(), 1);
37537    var import_element112 = __toESM(require_element(), 1);
37538    var import_jsx_runtime242 = __toESM(require_jsx_runtime(), 1);
37539    var { ValidatedRadioControl } = unlock3(import_components130.privateApis);
37540    function Radio({
37541      data,
37542      field,
37543      onChange,
37544      hideLabelFromVision,
37545      markWhenOptional,
37546      validity
37547    }) {
37548      const { label, description, getValue, setValue, isValid: isValid2 } = field;
37549      const { elements: elements2, isLoading } = useElements({
37550        elements: field.elements,
37551        getElements: field.getElements
37552      });
37553      const value = getValue({ item: data });
37554      const onChangeControl = (0, import_element112.useCallback)(
37555        (newValue) => onChange(setValue({ item: data, value: newValue })),
37556        [data, onChange, setValue]
37557      );
37558      if (isLoading) {
37559        return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(import_components130.Spinner, {});
37560      }
37561      return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
37562        ValidatedRadioControl,
37563        {
37564          required: !!field.isValid?.required,
37565          markWhenOptional,
37566          customValidity: getCustomValidity(isValid2, validity),
37567          label,
37568          help: description,
37569          onChange: onChangeControl,
37570          options: elements2,
37571          selected: value,
37572          hideLabelFromVision
37573        }
37574      );
37575    }
37576  
37577    // packages/dataviews/build-module/components/dataform-controls/text.mjs
37578    var import_element113 = __toESM(require_element(), 1);
37579    var import_jsx_runtime243 = __toESM(require_jsx_runtime(), 1);
37580    function Text12({
37581      data,
37582      field,
37583      onChange,
37584      hideLabelFromVision,
37585      markWhenOptional,
37586      config: config2,
37587      validity
37588    }) {
37589      const { prefix: prefix2, suffix } = config2 || {};
37590      return /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(
37591        ValidatedText,
37592        {
37593          ...{
37594            data,
37595            field,
37596            onChange,
37597            hideLabelFromVision,
37598            markWhenOptional,
37599            validity,
37600            prefix: prefix2 ? (0, import_element113.createElement)(prefix2) : void 0,
37601            suffix: suffix ? (0, import_element113.createElement)(suffix) : void 0
37602          }
37603        }
37604      );
37605    }
37606  
37607    // packages/dataviews/build-module/components/dataform-controls/toggle.mjs
37608    var import_components131 = __toESM(require_components(), 1);
37609    var import_element114 = __toESM(require_element(), 1);
37610    var import_jsx_runtime244 = __toESM(require_jsx_runtime(), 1);
37611    var { ValidatedToggleControl } = unlock3(import_components131.privateApis);
37612    function Toggle({
37613      field,
37614      onChange,
37615      data,
37616      hideLabelFromVision,
37617      markWhenOptional,
37618      validity
37619    }) {
37620      const { label, description, getValue, setValue, isValid: isValid2 } = field;
37621      const onChangeControl = (0, import_element114.useCallback)(() => {
37622        onChange(
37623          setValue({ item: data, value: !getValue({ item: data }) })
37624        );
37625      }, [onChange, setValue, data, getValue]);
37626      return /* @__PURE__ */ (0, import_jsx_runtime244.jsx)(
37627        ValidatedToggleControl,
37628        {
37629          required: !!isValid2.required,
37630          markWhenOptional,
37631          customValidity: getCustomValidity(isValid2, validity),
37632          hidden: hideLabelFromVision,
37633          label,
37634          help: description,
37635          checked: getValue({ item: data }),
37636          onChange: onChangeControl
37637        }
37638      );
37639    }
37640  
37641    // packages/dataviews/build-module/components/dataform-controls/textarea.mjs
37642    var import_components132 = __toESM(require_components(), 1);
37643    var import_element115 = __toESM(require_element(), 1);
37644    var import_jsx_runtime245 = __toESM(require_jsx_runtime(), 1);
37645    var { ValidatedTextareaControl } = unlock3(import_components132.privateApis);
37646    function Textarea({
37647      data,
37648      field,
37649      onChange,
37650      hideLabelFromVision,
37651      markWhenOptional,
37652      config: config2,
37653      validity
37654    }) {
37655      const { rows = 4 } = config2 || {};
37656      const { label, placeholder, description, setValue, isValid: isValid2 } = field;
37657      const value = field.getValue({ item: data });
37658      const onChangeControl = (0, import_element115.useCallback)(
37659        (newValue) => onChange(setValue({ item: data, value: newValue })),
37660        [data, onChange, setValue]
37661      );
37662      return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(
37663        ValidatedTextareaControl,
37664        {
37665          required: !!isValid2.required,
37666          markWhenOptional,
37667          customValidity: getCustomValidity(isValid2, validity),
37668          label,
37669          placeholder,
37670          value: value ?? "",
37671          help: description,
37672          onChange: onChangeControl,
37673          rows,
37674          minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
37675          maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
37676          __next40pxDefaultSize: true,
37677          hideLabelFromVision
37678        }
37679      );
37680    }
37681  
37682    // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs
37683    var import_components133 = __toESM(require_components(), 1);
37684    var import_element116 = __toESM(require_element(), 1);
37685    var import_jsx_runtime246 = __toESM(require_jsx_runtime(), 1);
37686    var { ValidatedToggleGroupControl } = unlock3(import_components133.privateApis);
37687    function ToggleGroup({
37688      data,
37689      field,
37690      onChange,
37691      hideLabelFromVision,
37692      markWhenOptional,
37693      validity
37694    }) {
37695      const { getValue, setValue, isValid: isValid2 } = field;
37696      const value = getValue({ item: data });
37697      const onChangeControl = (0, import_element116.useCallback)(
37698        (newValue) => onChange(setValue({ item: data, value: newValue })),
37699        [data, onChange, setValue]
37700      );
37701      const { elements: elements2, isLoading } = useElements({
37702        elements: field.elements,
37703        getElements: field.getElements
37704      });
37705      if (isLoading) {
37706        return /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(import_components133.Spinner, {});
37707      }
37708      if (elements2.length === 0) {
37709        return null;
37710      }
37711      const selectedOption = elements2.find((el) => el.value === value);
37712      return /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
37713        ValidatedToggleGroupControl,
37714        {
37715          required: !!field.isValid?.required,
37716          markWhenOptional,
37717          customValidity: getCustomValidity(isValid2, validity),
37718          __next40pxDefaultSize: true,
37719          isBlock: true,
37720          label: field.label,
37721          help: selectedOption?.description || field.description,
37722          onChange: onChangeControl,
37723          value,
37724          hideLabelFromVision,
37725          children: elements2.map((el) => /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
37726            import_components133.__experimentalToggleGroupControlOption,
37727            {
37728              label: el.label,
37729              value: el.value
37730            },
37731            el.value
37732          ))
37733        }
37734      );
37735    }
37736  
37737    // packages/dataviews/build-module/components/dataform-controls/array.mjs
37738    var import_components134 = __toESM(require_components(), 1);
37739    var import_element117 = __toESM(require_element(), 1);
37740    var import_jsx_runtime247 = __toESM(require_jsx_runtime(), 1);
37741    var { ValidatedFormTokenField } = unlock3(import_components134.privateApis);
37742    function ArrayControl({
37743      data,
37744      field,
37745      onChange,
37746      hideLabelFromVision,
37747      markWhenOptional,
37748      validity
37749    }) {
37750      const { label, placeholder, getValue, setValue, isValid: isValid2 } = field;
37751      const value = getValue({ item: data });
37752      const { elements: elements2, isLoading } = useElements({
37753        elements: field.elements,
37754        getElements: field.getElements
37755      });
37756      const arrayValueAsElements = (0, import_element117.useMemo)(
37757        () => Array.isArray(value) ? value.map((token) => {
37758          const element = elements2?.find(
37759            (suggestion) => suggestion.value === token
37760          );
37761          return element || { value: token, label: token };
37762        }) : [],
37763        [value, elements2]
37764      );
37765      const onChangeControl = (0, import_element117.useCallback)(
37766        (tokens) => {
37767          const valueTokens = tokens.map((token) => {
37768            if (typeof token === "object" && "value" in token) {
37769              return token.value;
37770            }
37771            return token;
37772          });
37773          onChange(setValue({ item: data, value: valueTokens }));
37774        },
37775        [onChange, setValue, data]
37776      );
37777      if (isLoading) {
37778        return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(import_components134.Spinner, {});
37779      }
37780      return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(
37781        ValidatedFormTokenField,
37782        {
37783          required: !!isValid2?.required,
37784          markWhenOptional,
37785          customValidity: getCustomValidity(isValid2, validity),
37786          label: hideLabelFromVision ? void 0 : label,
37787          value: arrayValueAsElements,
37788          onChange: onChangeControl,
37789          placeholder,
37790          suggestions: elements2?.map((element) => element.value),
37791          __experimentalValidateInput: (token) => {
37792            if (field.isValid?.elements && elements2) {
37793              return elements2.some(
37794                (element) => element.value === token || element.label === token
37795              );
37796            }
37797            return true;
37798          },
37799          __experimentalExpandOnFocus: elements2 && elements2.length > 0,
37800          __experimentalShowHowTo: !field.isValid?.elements,
37801          displayTransform: (token) => {
37802            if (typeof token === "object" && "label" in token) {
37803              return token.label;
37804            }
37805            if (typeof token === "string" && elements2) {
37806              const element = elements2.find(
37807                (el) => el.value === token
37808              );
37809              return element?.label || token;
37810            }
37811            return token;
37812          },
37813          __experimentalRenderItem: ({ item }) => {
37814            if (typeof item === "string" && elements2) {
37815              const element = elements2.find(
37816                (el) => el.value === item
37817              );
37818              return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)("span", { children: element?.label || item });
37819            }
37820            return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)("span", { children: item });
37821          }
37822        }
37823      );
37824    }
37825  
37826    // packages/dataviews/build-module/components/dataform-controls/color.mjs
37827    var import_components135 = __toESM(require_components(), 1);
37828    var import_element118 = __toESM(require_element(), 1);
37829    var import_i18n118 = __toESM(require_i18n(), 1);
37830    var import_jsx_runtime248 = __toESM(require_jsx_runtime(), 1);
37831    var { ValidatedInputControl: ValidatedInputControl3 } = unlock3(import_components135.privateApis);
37832    var ColorPickerDropdown = ({
37833      color,
37834      onColorChange
37835    }) => {
37836      const validColor = color && w(color).isValid() ? color : "#ffffff";
37837      return /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
37838        import_components135.Dropdown,
37839        {
37840          className: "dataviews-controls__color-picker-dropdown",
37841          popoverProps: { resize: false },
37842          renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
37843            import_components135.Button,
37844            {
37845              onClick: onToggle,
37846              "aria-label": (0, import_i18n118.__)("Open color picker"),
37847              size: "small",
37848              icon: () => /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(import_components135.ColorIndicator, { colorValue: validColor })
37849            }
37850          ),
37851          renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(import_components135.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
37852            import_components135.ColorPicker,
37853            {
37854              color: validColor,
37855              onChange: onColorChange,
37856              enableAlpha: true
37857            }
37858          ) })
37859        }
37860      );
37861    };
37862    function Color({
37863      data,
37864      field,
37865      onChange,
37866      hideLabelFromVision,
37867      markWhenOptional,
37868      validity
37869    }) {
37870      const { label, placeholder, description, setValue, isValid: isValid2 } = field;
37871      const value = field.getValue({ item: data }) || "";
37872      const handleColorChange = (0, import_element118.useCallback)(
37873        (newColor) => {
37874          onChange(setValue({ item: data, value: newColor }));
37875        },
37876        [data, onChange, setValue]
37877      );
37878      const handleInputChange = (0, import_element118.useCallback)(
37879        (newValue) => {
37880          onChange(setValue({ item: data, value: newValue || "" }));
37881        },
37882        [data, onChange, setValue]
37883      );
37884      return /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
37885        ValidatedInputControl3,
37886        {
37887          required: !!field.isValid?.required,
37888          markWhenOptional,
37889          customValidity: getCustomValidity(isValid2, validity),
37890          label,
37891          placeholder,
37892          value,
37893          help: description,
37894          onChange: handleInputChange,
37895          hideLabelFromVision,
37896          type: "text",
37897          prefix: /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(import_components135.__experimentalInputControlPrefixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(
37898            ColorPickerDropdown,
37899            {
37900              color: value,
37901              onColorChange: handleColorChange
37902            }
37903          ) })
37904        }
37905      );
37906    }
37907  
37908    // packages/dataviews/build-module/components/dataform-controls/password.mjs
37909    var import_components136 = __toESM(require_components(), 1);
37910    var import_element119 = __toESM(require_element(), 1);
37911    var import_i18n119 = __toESM(require_i18n(), 1);
37912    var import_jsx_runtime249 = __toESM(require_jsx_runtime(), 1);
37913    function Password({
37914      data,
37915      field,
37916      onChange,
37917      hideLabelFromVision,
37918      markWhenOptional,
37919      validity
37920    }) {
37921      const [isVisible2, setIsVisible] = (0, import_element119.useState)(false);
37922      const toggleVisibility = (0, import_element119.useCallback)(() => {
37923        setIsVisible((prev) => !prev);
37924      }, []);
37925      return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
37926        ValidatedText,
37927        {
37928          ...{
37929            data,
37930            field,
37931            onChange,
37932            hideLabelFromVision,
37933            markWhenOptional,
37934            validity,
37935            type: isVisible2 ? "text" : "password",
37936            suffix: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(import_components136.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
37937              import_components136.Button,
37938              {
37939                icon: isVisible2 ? unseen_default : seen_default,
37940                onClick: toggleVisibility,
37941                size: "small",
37942                label: isVisible2 ? (0, import_i18n119.__)("Hide password") : (0, import_i18n119.__)("Show password")
37943              }
37944            ) })
37945          }
37946        }
37947      );
37948    }
37949  
37950    // packages/dataviews/build-module/field-types/utils/has-elements.mjs
37951    function hasElements(field) {
37952      return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
37953    }
37954  
37955    // packages/dataviews/build-module/components/dataform-controls/index.mjs
37956    var import_jsx_runtime250 = __toESM(require_jsx_runtime(), 1);
37957    var FORM_CONTROLS = {
37958      adaptiveSelect: AdaptiveSelect,
37959      array: ArrayControl,
37960      checkbox: Checkbox,
37961      color: Color,
37962      combobox: Combobox3,
37963      datetime: DateTime,
37964      date: DateControl,
37965      email: Email,
37966      telephone: Telephone,
37967      url: Url,
37968      integer: Integer,
37969      number: Number2,
37970      password: Password,
37971      radio: Radio,
37972      select: Select,
37973      text: Text12,
37974      toggle: Toggle,
37975      textarea: Textarea,
37976      toggleGroup: ToggleGroup
37977    };
37978    function isEditConfig(value) {
37979      return value && typeof value === "object" && typeof value.control === "string";
37980    }
37981    function createConfiguredControl(config2) {
37982      const { control, ...controlConfig } = config2;
37983      const BaseControlType = getControlByType(control);
37984      if (BaseControlType === null) {
37985        return null;
37986      }
37987      return function ConfiguredControl(props) {
37988        return /* @__PURE__ */ (0, import_jsx_runtime250.jsx)(BaseControlType, { ...props, config: controlConfig });
37989      };
37990    }
37991    function getControl(field, fallback) {
37992      if (typeof field.Edit === "function") {
37993        return field.Edit;
37994      }
37995      if (typeof field.Edit === "string") {
37996        return getControlByType(field.Edit);
37997      }
37998      if (isEditConfig(field.Edit)) {
37999        return createConfiguredControl(field.Edit);
38000      }
38001      if (hasElements(field) && field.type !== "array") {
38002        return getControlByType("adaptiveSelect");
38003      }
38004      if (fallback === null) {
38005        return null;
38006      }
38007      return getControlByType(fallback);
38008    }
38009    function getControlByType(type) {
38010      if (Object.keys(FORM_CONTROLS).includes(type)) {
38011        return FORM_CONTROLS[type];
38012      }
38013      return null;
38014    }
38015  
38016    // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs
38017    function getFilterBy(field, defaultOperators, validOperators) {
38018      if (field.filterBy === false) {
38019        return false;
38020      }
38021      const operators = field.filterBy?.operators?.filter(
38022        (op) => validOperators.includes(op)
38023      ) ?? defaultOperators;
38024      if (operators.length === 0) {
38025        return false;
38026      }
38027      return {
38028        isPrimary: !!field.filterBy?.isPrimary,
38029        operators
38030      };
38031    }
38032    var get_filter_by_default = getFilterBy;
38033  
38034    // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs
38035    var getValueFromId = (id) => ({ item }) => {
38036      const path = id.split(".");
38037      let value = item;
38038      for (const segment of path) {
38039        if (value.hasOwnProperty(segment)) {
38040          value = value[segment];
38041        } else {
38042          value = void 0;
38043        }
38044      }
38045      return value;
38046    };
38047    var get_value_from_id_default = getValueFromId;
38048  
38049    // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs
38050    var setValueFromId = (id) => ({ value }) => {
38051      const path = id.split(".");
38052      const result = {};
38053      let current = result;
38054      for (const segment of path.slice(0, -1)) {
38055        current[segment] = {};
38056        current = current[segment];
38057      }
38058      current[path.at(-1)] = value;
38059      return result;
38060    };
38061    var set_value_from_id_default = setValueFromId;
38062  
38063    // packages/dataviews/build-module/field-types/email.mjs
38064    var import_i18n120 = __toESM(require_i18n(), 1);
38065  
38066    // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs
38067    function RenderFromElements({
38068      item,
38069      field
38070    }) {
38071      const { elements: elements2, isLoading } = useElements({
38072        elements: field.elements,
38073        getElements: field.getElements
38074      });
38075      const value = field.getValue({ item });
38076      if (isLoading) {
38077        return value;
38078      }
38079      if (elements2.length === 0) {
38080        return value;
38081      }
38082      return elements2?.find((element) => element.value === value)?.label || field.getValue({ item });
38083    }
38084  
38085    // packages/dataviews/build-module/field-types/utils/render-default.mjs
38086    var import_jsx_runtime251 = __toESM(require_jsx_runtime(), 1);
38087    function render({
38088      item,
38089      field
38090    }) {
38091      if (field.hasElements) {
38092        return /* @__PURE__ */ (0, import_jsx_runtime251.jsx)(RenderFromElements, { item, field });
38093      }
38094      return field.getValueFormatted({ item, field });
38095    }
38096  
38097    // packages/dataviews/build-module/field-types/utils/sort-text.mjs
38098    var sort_text_default = (a2, b2, direction) => {
38099      return direction === "asc" ? a2.localeCompare(b2) : b2.localeCompare(a2);
38100    };
38101  
38102    // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs
38103    function isValidRequired(item, field) {
38104      const value = field.getValue({ item });
38105      return ![void 0, "", null].includes(value);
38106    }
38107  
38108    // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs
38109    function isValidMinLength(item, field) {
38110      if (typeof field.isValid.minLength?.constraint !== "number") {
38111        return false;
38112      }
38113      const value = field.getValue({ item });
38114      if ([void 0, "", null].includes(value)) {
38115        return true;
38116      }
38117      return String(value).length >= field.isValid.minLength.constraint;
38118    }
38119  
38120    // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs
38121    function isValidMaxLength(item, field) {
38122      if (typeof field.isValid.maxLength?.constraint !== "number") {
38123        return false;
38124      }
38125      const value = field.getValue({ item });
38126      if ([void 0, "", null].includes(value)) {
38127        return true;
38128      }
38129      return String(value).length <= field.isValid.maxLength.constraint;
38130    }
38131  
38132    // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs
38133    function isValidPattern(item, field) {
38134      if (field.isValid.pattern?.constraint === void 0) {
38135        return true;
38136      }
38137      try {
38138        const regexp = new RegExp(field.isValid.pattern.constraint);
38139        const value = field.getValue({ item });
38140        if ([void 0, "", null].includes(value)) {
38141          return true;
38142        }
38143        return regexp.test(String(value));
38144      } catch {
38145        return false;
38146      }
38147    }
38148  
38149    // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs
38150    function isValidElements(item, field) {
38151      const elements2 = field.elements ?? [];
38152      const validValues = elements2.map((el) => el.value);
38153      if (validValues.length === 0) {
38154        return true;
38155      }
38156      const value = field.getValue({ item });
38157      return [].concat(value).every((v2) => validValues.includes(v2));
38158    }
38159  
38160    // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs
38161    function getValueFormatted({
38162      item,
38163      field
38164    }) {
38165      return field.getValue({ item });
38166    }
38167    var get_value_formatted_default_default = getValueFormatted;
38168  
38169    // packages/dataviews/build-module/field-types/email.mjs
38170    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])?)*$/;
38171    function isValidCustom(item, field) {
38172      const value = field.getValue({ item });
38173      if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
38174        return (0, import_i18n120.__)("Value must be a valid email address.");
38175      }
38176      return null;
38177    }
38178    var email_default = {
38179      type: "email",
38180      render,
38181      Edit: "email",
38182      sort: sort_text_default,
38183      enableSorting: true,
38184      enableGlobalSearch: false,
38185      defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2],
38186      validOperators: [
38187        OPERATOR_IS2,
38188        OPERATOR_IS_NOT,
38189        OPERATOR_CONTAINS,
38190        OPERATOR_NOT_CONTAINS,
38191        OPERATOR_STARTS_WITH,
38192        // Multiple selection
38193        OPERATOR_IS_ANY2,
38194        OPERATOR_IS_NONE2,
38195        OPERATOR_IS_ALL,
38196        OPERATOR_IS_NOT_ALL
38197      ],
38198      format: {},
38199      getValueFormatted: get_value_formatted_default_default,
38200      validate: {
38201        required: isValidRequired,
38202        pattern: isValidPattern,
38203        minLength: isValidMinLength,
38204        maxLength: isValidMaxLength,
38205        elements: isValidElements,
38206        custom: isValidCustom
38207      }
38208    };
38209  
38210    // packages/dataviews/build-module/field-types/integer.mjs
38211    var import_i18n121 = __toESM(require_i18n(), 1);
38212  
38213    // packages/dataviews/build-module/field-types/utils/sort-number.mjs
38214    var sort_number_default = (a2, b2, direction) => {
38215      return direction === "asc" ? a2 - b2 : b2 - a2;
38216    };
38217  
38218    // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs
38219    function isValidMin(item, field) {
38220      if (typeof field.isValid.min?.constraint !== "number") {
38221        return false;
38222      }
38223      const value = field.getValue({ item });
38224      if ([void 0, "", null].includes(value)) {
38225        return true;
38226      }
38227      return Number(value) >= field.isValid.min.constraint;
38228    }
38229  
38230    // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs
38231    function isValidMax(item, field) {
38232      if (typeof field.isValid.max?.constraint !== "number") {
38233        return false;
38234      }
38235      const value = field.getValue({ item });
38236      if ([void 0, "", null].includes(value)) {
38237        return true;
38238      }
38239      return Number(value) <= field.isValid.max.constraint;
38240    }
38241  
38242    // packages/dataviews/build-module/field-types/integer.mjs
38243    var format2 = {
38244      separatorThousand: ","
38245    };
38246    function getValueFormatted2({
38247      item,
38248      field
38249    }) {
38250      let value = field.getValue({ item });
38251      if (value === null || value === void 0) {
38252        return "";
38253      }
38254      value = Number(value);
38255      if (!Number.isFinite(value)) {
38256        return String(value);
38257      }
38258      let formatInteger;
38259      if (field.type !== "integer") {
38260        formatInteger = format2;
38261      } else {
38262        formatInteger = field.format;
38263      }
38264      const { separatorThousand } = formatInteger;
38265      const integerValue = Math.trunc(value);
38266      if (!separatorThousand) {
38267        return String(integerValue);
38268      }
38269      return String(integerValue).replace(
38270        /\B(?=(\d{3})+(?!\d))/g,
38271        separatorThousand
38272      );
38273    }
38274    function isValidCustom2(item, field) {
38275      const value = field.getValue({ item });
38276      if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
38277        return (0, import_i18n121.__)("Value must be an integer.");
38278      }
38279      return null;
38280    }
38281    var integer_default = {
38282      type: "integer",
38283      render,
38284      Edit: "integer",
38285      sort: sort_number_default,
38286      enableSorting: true,
38287      enableGlobalSearch: false,
38288      defaultOperators: [
38289        OPERATOR_IS2,
38290        OPERATOR_IS_NOT,
38291        OPERATOR_LESS_THAN,
38292        OPERATOR_GREATER_THAN,
38293        OPERATOR_LESS_THAN_OR_EQUAL,
38294        OPERATOR_GREATER_THAN_OR_EQUAL,
38295        OPERATOR_BETWEEN
38296      ],
38297      validOperators: [
38298        // Single-selection
38299        OPERATOR_IS2,
38300        OPERATOR_IS_NOT,
38301        OPERATOR_LESS_THAN,
38302        OPERATOR_GREATER_THAN,
38303        OPERATOR_LESS_THAN_OR_EQUAL,
38304        OPERATOR_GREATER_THAN_OR_EQUAL,
38305        OPERATOR_BETWEEN,
38306        // Multiple-selection
38307        OPERATOR_IS_ANY2,
38308        OPERATOR_IS_NONE2,
38309        OPERATOR_IS_ALL,
38310        OPERATOR_IS_NOT_ALL
38311      ],
38312      format: format2,
38313      getValueFormatted: getValueFormatted2,
38314      validate: {
38315        required: isValidRequired,
38316        min: isValidMin,
38317        max: isValidMax,
38318        elements: isValidElements,
38319        custom: isValidCustom2
38320      }
38321    };
38322  
38323    // packages/dataviews/build-module/field-types/number.mjs
38324    var import_i18n122 = __toESM(require_i18n(), 1);
38325    var format3 = {
38326      separatorThousand: ",",
38327      separatorDecimal: ".",
38328      decimals: 2
38329    };
38330    function getValueFormatted3({
38331      item,
38332      field
38333    }) {
38334      let value = field.getValue({ item });
38335      if (value === null || value === void 0) {
38336        return "";
38337      }
38338      value = Number(value);
38339      if (!Number.isFinite(value)) {
38340        return String(value);
38341      }
38342      let formatNumber;
38343      if (field.type !== "number") {
38344        formatNumber = format3;
38345      } else {
38346        formatNumber = field.format;
38347      }
38348      const { separatorThousand, separatorDecimal, decimals } = formatNumber;
38349      const fixedValue = value.toFixed(decimals);
38350      const [integerPart, decimalPart] = fixedValue.split(".");
38351      const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart;
38352      return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart;
38353    }
38354    function isEmpty2(value) {
38355      return value === "" || value === void 0 || value === null;
38356    }
38357    function isValidCustom3(item, field) {
38358      const value = field.getValue({ item });
38359      if (!isEmpty2(value) && !Number.isFinite(value)) {
38360        return (0, import_i18n122.__)("Value must be a number.");
38361      }
38362      return null;
38363    }
38364    var number_default = {
38365      type: "number",
38366      render,
38367      Edit: "number",
38368      sort: sort_number_default,
38369      enableSorting: true,
38370      enableGlobalSearch: false,
38371      defaultOperators: [
38372        OPERATOR_IS2,
38373        OPERATOR_IS_NOT,
38374        OPERATOR_LESS_THAN,
38375        OPERATOR_GREATER_THAN,
38376        OPERATOR_LESS_THAN_OR_EQUAL,
38377        OPERATOR_GREATER_THAN_OR_EQUAL,
38378        OPERATOR_BETWEEN
38379      ],
38380      validOperators: [
38381        // Single-selection
38382        OPERATOR_IS2,
38383        OPERATOR_IS_NOT,
38384        OPERATOR_LESS_THAN,
38385        OPERATOR_GREATER_THAN,
38386        OPERATOR_LESS_THAN_OR_EQUAL,
38387        OPERATOR_GREATER_THAN_OR_EQUAL,
38388        OPERATOR_BETWEEN,
38389        // Multiple-selection
38390        OPERATOR_IS_ANY2,
38391        OPERATOR_IS_NONE2,
38392        OPERATOR_IS_ALL,
38393        OPERATOR_IS_NOT_ALL
38394      ],
38395      format: format3,
38396      getValueFormatted: getValueFormatted3,
38397      validate: {
38398        required: isValidRequired,
38399        min: isValidMin,
38400        max: isValidMax,
38401        elements: isValidElements,
38402        custom: isValidCustom3
38403      }
38404    };
38405  
38406    // packages/dataviews/build-module/field-types/text.mjs
38407    var text_default = {
38408      type: "text",
38409      render,
38410      Edit: "text",
38411      sort: sort_text_default,
38412      enableSorting: true,
38413      enableGlobalSearch: false,
38414      defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2],
38415      validOperators: [
38416        // Single selection
38417        OPERATOR_IS2,
38418        OPERATOR_IS_NOT,
38419        OPERATOR_CONTAINS,
38420        OPERATOR_NOT_CONTAINS,
38421        OPERATOR_STARTS_WITH,
38422        // Multiple selection
38423        OPERATOR_IS_ANY2,
38424        OPERATOR_IS_NONE2,
38425        OPERATOR_IS_ALL,
38426        OPERATOR_IS_NOT_ALL
38427      ],
38428      format: {},
38429      getValueFormatted: get_value_formatted_default_default,
38430      validate: {
38431        required: isValidRequired,
38432        pattern: isValidPattern,
38433        minLength: isValidMinLength,
38434        maxLength: isValidMaxLength,
38435        elements: isValidElements
38436      }
38437    };
38438  
38439    // packages/dataviews/build-module/field-types/datetime.mjs
38440    var import_date7 = __toESM(require_date(), 1);
38441    var format4 = {
38442      datetime: (0, import_date7.getSettings)().formats.datetime,
38443      weekStartsOn: (0, import_date7.getSettings)().l10n.startOfWeek
38444    };
38445    function getValueFormatted4({
38446      item,
38447      field
38448    }) {
38449      const value = field.getValue({ item });
38450      if (["", void 0, null].includes(value)) {
38451        return "";
38452      }
38453      let formatDatetime;
38454      if (field.type !== "datetime") {
38455        formatDatetime = format4;
38456      } else {
38457        formatDatetime = field.format;
38458      }
38459      return (0, import_date7.dateI18n)(formatDatetime.datetime, (0, import_date7.getDate)(value));
38460    }
38461    var sort = (a2, b2, direction) => {
38462      const timeA = new Date(a2).getTime();
38463      const timeB = new Date(b2).getTime();
38464      return direction === "asc" ? timeA - timeB : timeB - timeA;
38465    };
38466    var datetime_default = {
38467      type: "datetime",
38468      render,
38469      Edit: "datetime",
38470      sort,
38471      enableSorting: true,
38472      enableGlobalSearch: false,
38473      defaultOperators: [
38474        OPERATOR_ON,
38475        OPERATOR_NOT_ON,
38476        OPERATOR_BEFORE2,
38477        OPERATOR_AFTER2,
38478        OPERATOR_BEFORE_INC,
38479        OPERATOR_AFTER_INC,
38480        OPERATOR_IN_THE_PAST,
38481        OPERATOR_OVER
38482      ],
38483      validOperators: [
38484        OPERATOR_ON,
38485        OPERATOR_NOT_ON,
38486        OPERATOR_BEFORE2,
38487        OPERATOR_AFTER2,
38488        OPERATOR_BEFORE_INC,
38489        OPERATOR_AFTER_INC,
38490        OPERATOR_IN_THE_PAST,
38491        OPERATOR_OVER
38492      ],
38493      format: format4,
38494      getValueFormatted: getValueFormatted4,
38495      validate: {
38496        required: isValidRequired,
38497        elements: isValidElements
38498      }
38499    };
38500  
38501    // packages/dataviews/build-module/field-types/date.mjs
38502    var import_date8 = __toESM(require_date(), 1);
38503    var format5 = {
38504      date: (0, import_date8.getSettings)().formats.date,
38505      weekStartsOn: (0, import_date8.getSettings)().l10n.startOfWeek
38506    };
38507    function getValueFormatted5({
38508      item,
38509      field
38510    }) {
38511      const value = field.getValue({ item });
38512      if (["", void 0, null].includes(value)) {
38513        return "";
38514      }
38515      let formatDate2;
38516      if (field.type !== "date") {
38517        formatDate2 = format5;
38518      } else {
38519        formatDate2 = field.format;
38520      }
38521      return (0, import_date8.dateI18n)(formatDate2.date, (0, import_date8.getDate)(value));
38522    }
38523    var sort2 = (a2, b2, direction) => {
38524      const timeA = new Date(a2).getTime();
38525      const timeB = new Date(b2).getTime();
38526      return direction === "asc" ? timeA - timeB : timeB - timeA;
38527    };
38528    var date_default = {
38529      type: "date",
38530      render,
38531      Edit: "date",
38532      sort: sort2,
38533      enableSorting: true,
38534      enableGlobalSearch: false,
38535      defaultOperators: [
38536        OPERATOR_ON,
38537        OPERATOR_NOT_ON,
38538        OPERATOR_BEFORE2,
38539        OPERATOR_AFTER2,
38540        OPERATOR_BEFORE_INC,
38541        OPERATOR_AFTER_INC,
38542        OPERATOR_IN_THE_PAST,
38543        OPERATOR_OVER,
38544        OPERATOR_BETWEEN
38545      ],
38546      validOperators: [
38547        OPERATOR_ON,
38548        OPERATOR_NOT_ON,
38549        OPERATOR_BEFORE2,
38550        OPERATOR_AFTER2,
38551        OPERATOR_BEFORE_INC,
38552        OPERATOR_AFTER_INC,
38553        OPERATOR_IN_THE_PAST,
38554        OPERATOR_OVER,
38555        OPERATOR_BETWEEN
38556      ],
38557      format: format5,
38558      getValueFormatted: getValueFormatted5,
38559      validate: {
38560        required: isValidRequired,
38561        elements: isValidElements
38562      }
38563    };
38564  
38565    // packages/dataviews/build-module/field-types/boolean.mjs
38566    var import_i18n123 = __toESM(require_i18n(), 1);
38567  
38568    // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs
38569    function isValidRequiredForBool(item, field) {
38570      const value = field.getValue({ item });
38571      return value === true;
38572    }
38573  
38574    // packages/dataviews/build-module/field-types/boolean.mjs
38575    function getValueFormatted6({
38576      item,
38577      field
38578    }) {
38579      const value = field.getValue({ item });
38580      if (value === true) {
38581        return (0, import_i18n123.__)("True");
38582      }
38583      if (value === false) {
38584        return (0, import_i18n123.__)("False");
38585      }
38586      return "";
38587    }
38588    function isValidCustom4(item, field) {
38589      const value = field.getValue({ item });
38590      if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
38591        return (0, import_i18n123.__)("Value must be true, false, or undefined");
38592      }
38593      return null;
38594    }
38595    var sort3 = (a2, b2, direction) => {
38596      const boolA = Boolean(a2);
38597      const boolB = Boolean(b2);
38598      if (boolA === boolB) {
38599        return 0;
38600      }
38601      if (direction === "asc") {
38602        return boolA ? 1 : -1;
38603      }
38604      return boolA ? -1 : 1;
38605    };
38606    var boolean_default = {
38607      type: "boolean",
38608      render,
38609      Edit: "checkbox",
38610      sort: sort3,
38611      validate: {
38612        required: isValidRequiredForBool,
38613        elements: isValidElements,
38614        custom: isValidCustom4
38615      },
38616      enableSorting: true,
38617      enableGlobalSearch: false,
38618      defaultOperators: [OPERATOR_IS2, OPERATOR_IS_NOT],
38619      validOperators: [OPERATOR_IS2, OPERATOR_IS_NOT],
38620      format: {},
38621      getValueFormatted: getValueFormatted6
38622    };
38623  
38624    // packages/dataviews/build-module/field-types/media.mjs
38625    var media_default2 = {
38626      type: "media",
38627      render: () => null,
38628      Edit: null,
38629      sort: () => 0,
38630      enableSorting: false,
38631      enableGlobalSearch: false,
38632      defaultOperators: [],
38633      validOperators: [],
38634      format: {},
38635      getValueFormatted: get_value_formatted_default_default,
38636      // cannot validate any constraint, so
38637      // the only available validation for the field author
38638      // would be providing a custom validator.
38639      validate: {}
38640    };
38641  
38642    // packages/dataviews/build-module/field-types/array.mjs
38643    var import_i18n124 = __toESM(require_i18n(), 1);
38644  
38645    // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs
38646    function isValidRequiredForArray(item, field) {
38647      const value = field.getValue({ item });
38648      return Array.isArray(value) && value.length > 0 && value.every(
38649        (element) => ![void 0, "", null].includes(element)
38650      );
38651    }
38652  
38653    // packages/dataviews/build-module/field-types/array.mjs
38654    function getValueFormatted7({
38655      item,
38656      field
38657    }) {
38658      const value = field.getValue({ item });
38659      const arr = Array.isArray(value) ? value : [];
38660      return arr.join(", ");
38661    }
38662    function render2({ item, field }) {
38663      return getValueFormatted7({ item, field });
38664    }
38665    function isValidCustom5(item, field) {
38666      const value = field.getValue({ item });
38667      if (![void 0, "", null].includes(value) && !Array.isArray(value)) {
38668        return (0, import_i18n124.__)("Value must be an array.");
38669      }
38670      if (!value.every((v2) => typeof v2 === "string")) {
38671        return (0, import_i18n124.__)("Every value must be a string.");
38672      }
38673      return null;
38674    }
38675    var sort4 = (a2, b2, direction) => {
38676      const arrA = Array.isArray(a2) ? a2 : [];
38677      const arrB = Array.isArray(b2) ? b2 : [];
38678      if (arrA.length !== arrB.length) {
38679        return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
38680      }
38681      const joinedA = arrA.join(",");
38682      const joinedB = arrB.join(",");
38683      return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
38684    };
38685    var array_default = {
38686      type: "array",
38687      render: render2,
38688      Edit: "array",
38689      sort: sort4,
38690      enableSorting: true,
38691      enableGlobalSearch: false,
38692      defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2],
38693      validOperators: [
38694        OPERATOR_IS_ANY2,
38695        OPERATOR_IS_NONE2,
38696        OPERATOR_IS_ALL,
38697        OPERATOR_IS_NOT_ALL
38698      ],
38699      format: {},
38700      getValueFormatted: getValueFormatted7,
38701      validate: {
38702        required: isValidRequiredForArray,
38703        elements: isValidElements,
38704        custom: isValidCustom5
38705      }
38706    };
38707  
38708    // packages/dataviews/build-module/field-types/password.mjs
38709    function getValueFormatted8({
38710      item,
38711      field
38712    }) {
38713      return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "";
38714    }
38715    var password_default = {
38716      type: "password",
38717      render,
38718      Edit: "password",
38719      sort: () => 0,
38720      // Passwords should not be sortable for security reasons
38721      enableSorting: false,
38722      enableGlobalSearch: false,
38723      defaultOperators: [],
38724      validOperators: [],
38725      format: {},
38726      getValueFormatted: getValueFormatted8,
38727      validate: {
38728        required: isValidRequired,
38729        pattern: isValidPattern,
38730        minLength: isValidMinLength,
38731        maxLength: isValidMaxLength,
38732        elements: isValidElements
38733      }
38734    };
38735  
38736    // packages/dataviews/build-module/field-types/telephone.mjs
38737    var telephone_default = {
38738      type: "telephone",
38739      render,
38740      Edit: "telephone",
38741      sort: sort_text_default,
38742      enableSorting: true,
38743      enableGlobalSearch: false,
38744      defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2],
38745      validOperators: [
38746        OPERATOR_IS2,
38747        OPERATOR_IS_NOT,
38748        OPERATOR_CONTAINS,
38749        OPERATOR_NOT_CONTAINS,
38750        OPERATOR_STARTS_WITH,
38751        // Multiple selection
38752        OPERATOR_IS_ANY2,
38753        OPERATOR_IS_NONE2,
38754        OPERATOR_IS_ALL,
38755        OPERATOR_IS_NOT_ALL
38756      ],
38757      format: {},
38758      getValueFormatted: get_value_formatted_default_default,
38759      validate: {
38760        required: isValidRequired,
38761        pattern: isValidPattern,
38762        minLength: isValidMinLength,
38763        maxLength: isValidMaxLength,
38764        elements: isValidElements
38765      }
38766    };
38767  
38768    // packages/dataviews/build-module/field-types/color.mjs
38769    var import_i18n125 = __toESM(require_i18n(), 1);
38770    var import_jsx_runtime252 = __toESM(require_jsx_runtime(), 1);
38771    function render3({ item, field }) {
38772      if (field.hasElements) {
38773        return /* @__PURE__ */ (0, import_jsx_runtime252.jsx)(RenderFromElements, { item, field });
38774      }
38775      const value = get_value_formatted_default_default({ item, field });
38776      if (!value || !w(value).isValid()) {
38777        return value;
38778      }
38779      return /* @__PURE__ */ (0, import_jsx_runtime252.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
38780        /* @__PURE__ */ (0, import_jsx_runtime252.jsx)(
38781          "div",
38782          {
38783            style: {
38784              width: "16px",
38785              height: "16px",
38786              borderRadius: "50%",
38787              backgroundColor: value,
38788              border: "1px solid #ddd",
38789              flexShrink: 0
38790            }
38791          }
38792        ),
38793        /* @__PURE__ */ (0, import_jsx_runtime252.jsx)("span", { children: value })
38794      ] });
38795    }
38796    function isValidCustom6(item, field) {
38797      const value = field.getValue({ item });
38798      if (![void 0, "", null].includes(value) && !w(value).isValid()) {
38799        return (0, import_i18n125.__)("Value must be a valid color.");
38800      }
38801      return null;
38802    }
38803    var sort5 = (a2, b2, direction) => {
38804      const colorA = w(a2);
38805      const colorB = w(b2);
38806      if (!colorA.isValid() && !colorB.isValid()) {
38807        return 0;
38808      }
38809      if (!colorA.isValid()) {
38810        return direction === "asc" ? 1 : -1;
38811      }
38812      if (!colorB.isValid()) {
38813        return direction === "asc" ? -1 : 1;
38814      }
38815      const hslA = colorA.toHsl();
38816      const hslB = colorB.toHsl();
38817      if (hslA.h !== hslB.h) {
38818        return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
38819      }
38820      if (hslA.s !== hslB.s) {
38821        return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
38822      }
38823      return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
38824    };
38825    var color_default = {
38826      type: "color",
38827      render: render3,
38828      Edit: "color",
38829      sort: sort5,
38830      enableSorting: true,
38831      enableGlobalSearch: false,
38832      defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2],
38833      validOperators: [
38834        OPERATOR_IS2,
38835        OPERATOR_IS_NOT,
38836        OPERATOR_IS_ANY2,
38837        OPERATOR_IS_NONE2
38838      ],
38839      format: {},
38840      getValueFormatted: get_value_formatted_default_default,
38841      validate: {
38842        required: isValidRequired,
38843        elements: isValidElements,
38844        custom: isValidCustom6
38845      }
38846    };
38847  
38848    // packages/dataviews/build-module/field-types/url.mjs
38849    var url_default = {
38850      type: "url",
38851      render,
38852      Edit: "url",
38853      sort: sort_text_default,
38854      enableSorting: true,
38855      enableGlobalSearch: false,
38856      defaultOperators: [OPERATOR_IS_ANY2, OPERATOR_IS_NONE2],
38857      validOperators: [
38858        OPERATOR_IS2,
38859        OPERATOR_IS_NOT,
38860        OPERATOR_CONTAINS,
38861        OPERATOR_NOT_CONTAINS,
38862        OPERATOR_STARTS_WITH,
38863        // Multiple selection
38864        OPERATOR_IS_ANY2,
38865        OPERATOR_IS_NONE2,
38866        OPERATOR_IS_ALL,
38867        OPERATOR_IS_NOT_ALL
38868      ],
38869      format: {},
38870      getValueFormatted: get_value_formatted_default_default,
38871      validate: {
38872        required: isValidRequired,
38873        pattern: isValidPattern,
38874        minLength: isValidMinLength,
38875        maxLength: isValidMaxLength,
38876        elements: isValidElements
38877      }
38878    };
38879  
38880    // packages/dataviews/build-module/field-types/no-type.mjs
38881    var sort6 = (a2, b2, direction) => {
38882      if (typeof a2 === "number" && typeof b2 === "number") {
38883        return sort_number_default(a2, b2, direction);
38884      }
38885      return sort_text_default(a2, b2, direction);
38886    };
38887    var no_type_default = {
38888      // type: no type for this one
38889      render,
38890      Edit: null,
38891      sort: sort6,
38892      enableSorting: true,
38893      enableGlobalSearch: false,
38894      defaultOperators: [OPERATOR_IS2, OPERATOR_IS_NOT],
38895      validOperators: getAllOperatorNames(),
38896      format: {},
38897      getValueFormatted: get_value_formatted_default_default,
38898      validate: {
38899        required: isValidRequired,
38900        elements: isValidElements
38901      }
38902    };
38903  
38904    // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs
38905    function getIsValid(field, fieldType) {
38906      let required;
38907      if (field.isValid?.required === true && fieldType.validate.required !== void 0) {
38908        required = {
38909          constraint: true,
38910          validate: fieldType.validate.required
38911        };
38912      }
38913      let elements2;
38914      if ((field.isValid?.elements === true || // elements is enabled unless the field opts-out
38915      field.isValid?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) {
38916        elements2 = {
38917          constraint: true,
38918          validate: fieldType.validate.elements
38919        };
38920      }
38921      let min;
38922      if (typeof field.isValid?.min === "number" && fieldType.validate.min !== void 0) {
38923        min = {
38924          constraint: field.isValid.min,
38925          validate: fieldType.validate.min
38926        };
38927      }
38928      let max;
38929      if (typeof field.isValid?.max === "number" && fieldType.validate.max !== void 0) {
38930        max = {
38931          constraint: field.isValid.max,
38932          validate: fieldType.validate.max
38933        };
38934      }
38935      let minLength;
38936      if (typeof field.isValid?.minLength === "number" && fieldType.validate.minLength !== void 0) {
38937        minLength = {
38938          constraint: field.isValid.minLength,
38939          validate: fieldType.validate.minLength
38940        };
38941      }
38942      let maxLength;
38943      if (typeof field.isValid?.maxLength === "number" && fieldType.validate.maxLength !== void 0) {
38944        maxLength = {
38945          constraint: field.isValid.maxLength,
38946          validate: fieldType.validate.maxLength
38947        };
38948      }
38949      let pattern;
38950      if (field.isValid?.pattern !== void 0 && fieldType.validate.pattern !== void 0) {
38951        pattern = {
38952          constraint: field.isValid?.pattern,
38953          validate: fieldType.validate.pattern
38954        };
38955      }
38956      const custom = field.isValid?.custom ?? fieldType.validate.custom;
38957      return {
38958        required,
38959        elements: elements2,
38960        min,
38961        max,
38962        minLength,
38963        maxLength,
38964        pattern,
38965        custom
38966      };
38967    }
38968  
38969    // packages/dataviews/build-module/field-types/utils/get-filter.mjs
38970    function getFilter(fieldType) {
38971      return fieldType.validOperators.reduce((accumulator, operator) => {
38972        const operatorObj = getOperatorByName(operator);
38973        if (operatorObj?.filter) {
38974          accumulator[operator] = operatorObj.filter;
38975        }
38976        return accumulator;
38977      }, {});
38978    }
38979  
38980    // packages/dataviews/build-module/field-types/utils/get-format.mjs
38981    function getFormat(field, fieldType) {
38982      return {
38983        ...fieldType.format,
38984        ...field.format
38985      };
38986    }
38987    var get_format_default = getFormat;
38988  
38989    // packages/dataviews/build-module/field-types/index.mjs
38990    function getFieldTypeByName(type) {
38991      const found = [
38992        email_default,
38993        integer_default,
38994        number_default,
38995        text_default,
38996        datetime_default,
38997        date_default,
38998        boolean_default,
38999        media_default2,
39000        array_default,
39001        password_default,
39002        telephone_default,
39003        color_default,
39004        url_default
39005      ].find((fieldType) => fieldType?.type === type);
39006      if (!!found) {
39007        return found;
39008      }
39009      return no_type_default;
39010    }
39011    function normalizeFields(fields) {
39012      return fields.map((field) => {
39013        const fieldType = getFieldTypeByName(field.type);
39014        const getValue = field.getValue || get_value_from_id_default(field.id);
39015        const sort7 = function(a2, b2, direction) {
39016          const aValue = getValue({ item: a2 });
39017          const bValue = getValue({ item: b2 });
39018          return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction);
39019        };
39020        return {
39021          id: field.id,
39022          label: field.label || field.id,
39023          header: field.header || field.label || field.id,
39024          description: field.description,
39025          placeholder: field.placeholder,
39026          getValue,
39027          setValue: field.setValue || set_value_from_id_default(field.id),
39028          elements: field.elements,
39029          getElements: field.getElements,
39030          hasElements: hasElements(field),
39031          isVisible: field.isVisible,
39032          enableHiding: field.enableHiding ?? true,
39033          readOnly: field.readOnly ?? false,
39034          // The type provides defaults for the following props
39035          type: fieldType.type,
39036          render: field.render ?? fieldType.render,
39037          Edit: getControl(field, fieldType.Edit),
39038          sort: sort7,
39039          enableSorting: field.enableSorting ?? fieldType.enableSorting,
39040          enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch,
39041          isValid: getIsValid(field, fieldType),
39042          filterBy: get_filter_by_default(
39043            field,
39044            fieldType.defaultOperators,
39045            fieldType.validOperators
39046          ),
39047          filter: getFilter(fieldType),
39048          format: get_format_default(field, fieldType),
39049          getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted
39050        };
39051      });
39052    }
39053  
39054    // packages/dataviews/build-module/hooks/use-data.mjs
39055    var import_element120 = __toESM(require_element(), 1);
39056    function useData(data, isLoading, paginationInfo) {
39057      const previousDataRef = (0, import_element120.useRef)(data);
39058      const previousPaginationInfoRef = (0, import_element120.useRef)(paginationInfo);
39059      const [hasInitiallyLoaded, setHasInitiallyLoaded] = (0, import_element120.useState)(
39060        !isLoading
39061      );
39062      (0, import_element120.useEffect)(() => {
39063        if (!isLoading) {
39064          previousDataRef.current = data;
39065          previousPaginationInfoRef.current = paginationInfo;
39066          setHasInitiallyLoaded(true);
39067        }
39068      }, [data, isLoading, paginationInfo]);
39069      return {
39070        data: isLoading && previousDataRef.current?.length ? previousDataRef.current : data,
39071        paginationInfo: isLoading && previousDataRef.current?.length ? previousPaginationInfoRef.current : paginationInfo,
39072        hasInitiallyLoaded
39073      };
39074    }
39075  
39076    // packages/dataviews/build-module/dataviews/index.mjs
39077    var import_jsx_runtime253 = __toESM(require_jsx_runtime(), 1);
39078    var defaultGetItemId = (item) => item.id;
39079    var defaultIsItemClickable = () => true;
39080    var EMPTY_ARRAY9 = [];
39081    var dataViewsLayouts = VIEW_LAYOUTS.filter(
39082      (viewLayout) => !viewLayout.isPicker
39083    );
39084    function DefaultUI({
39085      header,
39086      search = true,
39087      searchLabel = void 0
39088    }) {
39089      return /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(import_jsx_runtime253.Fragment, { children: [
39090        /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(
39091          Stack,
39092          {
39093            direction: "row",
39094            align: "top",
39095            justify: "space-between",
39096            className: "dataviews__view-actions",
39097            gap: "xs",
39098            children: [
39099              /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(
39100                Stack,
39101                {
39102                  direction: "row",
39103                  justify: "start",
39104                  gap: "sm",
39105                  className: "dataviews__search",
39106                  children: [
39107                    search && /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(dataviews_search_default, { label: searchLabel }),
39108                    /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(toggle_default, {})
39109                  ]
39110                }
39111              ),
39112              /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: [
39113                /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(dataviews_view_config_default, {}),
39114                header
39115              ] })
39116            ]
39117          }
39118        ),
39119        /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }),
39120        /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(DataViewsLayout, {}),
39121        /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(DataViewsFooter, {})
39122      ] });
39123    }
39124    function DataViews({
39125      view,
39126      onChangeView,
39127      fields,
39128      search = true,
39129      searchLabel = void 0,
39130      actions = EMPTY_ARRAY9,
39131      data,
39132      getItemId: getItemId2 = defaultGetItemId,
39133      getItemLevel: getItemLevel2,
39134      isLoading = false,
39135      paginationInfo,
39136      defaultLayouts: defaultLayoutsProperty,
39137      selection: selectionProperty,
39138      onChangeSelection,
39139      onClickItem,
39140      renderItemLink,
39141      isItemClickable = defaultIsItemClickable,
39142      header,
39143      children,
39144      config: config2 = { perPageSizes: [10, 20, 50, 100] },
39145      empty,
39146      onReset
39147    }) {
39148      const { infiniteScrollHandler } = paginationInfo;
39149      const containerRef = (0, import_element121.useRef)(null);
39150      const [containerWidth, setContainerWidth] = (0, import_element121.useState)(0);
39151      const resizeObserverRef = (0, import_compose23.useResizeObserver)(
39152        (resizeObserverEntries) => {
39153          setContainerWidth(
39154            resizeObserverEntries[0].borderBoxSize[0].inlineSize
39155          );
39156        },
39157        { box: "border-box" }
39158      );
39159      const [selectionState, setSelectionState] = (0, import_element121.useState)([]);
39160      const isUncontrolled = selectionProperty === void 0 || onChangeSelection === void 0;
39161      const selection = isUncontrolled ? selectionState : selectionProperty;
39162      const [openedFilter, setOpenedFilter] = (0, import_element121.useState)(null);
39163      function setSelectionWithChange(value) {
39164        const newValue = typeof value === "function" ? value(selection) : value;
39165        if (isUncontrolled) {
39166          setSelectionState(newValue);
39167        }
39168        if (onChangeSelection) {
39169          onChangeSelection(newValue);
39170        }
39171      }
39172      const _fields = (0, import_element121.useMemo)(() => normalizeFields(fields), [fields]);
39173      const _selection = (0, import_element121.useMemo)(() => {
39174        return selection.filter(
39175          (id) => data.some((item) => getItemId2(item) === id)
39176        );
39177      }, [selection, data, getItemId2]);
39178      const filters = use_filters_default(_fields, view);
39179      const hasPrimaryOrLockedFilters = (0, import_element121.useMemo)(
39180        () => (filters || []).some(
39181          (filter) => filter.isPrimary || filter.isLocked
39182        ),
39183        [filters]
39184      );
39185      const [isShowingFilter, setIsShowingFilter] = (0, import_element121.useState)(
39186        hasPrimaryOrLockedFilters
39187      );
39188      (0, import_element121.useEffect)(() => {
39189        if (hasPrimaryOrLockedFilters && !isShowingFilter) {
39190          setIsShowingFilter(true);
39191        }
39192      }, [hasPrimaryOrLockedFilters, isShowingFilter]);
39193      (0, import_element121.useEffect)(() => {
39194        if (!view.infiniteScrollEnabled || !containerRef.current) {
39195          return;
39196        }
39197        const handleScroll = (0, import_compose23.throttle)((event) => {
39198          const target = event.target;
39199          const scrollTop = target.scrollTop;
39200          const scrollHeight = target.scrollHeight;
39201          const clientHeight = target.clientHeight;
39202          if (scrollTop + clientHeight >= scrollHeight - 100) {
39203            infiniteScrollHandler?.();
39204          }
39205        }, 100);
39206        const container = containerRef.current;
39207        container.addEventListener("scroll", handleScroll);
39208        return () => {
39209          container.removeEventListener("scroll", handleScroll);
39210          handleScroll.cancel();
39211        };
39212      }, [infiniteScrollHandler, view.infiniteScrollEnabled]);
39213      const defaultLayouts4 = (0, import_element121.useMemo)(
39214        () => Object.fromEntries(
39215          Object.entries(defaultLayoutsProperty).filter(
39216            ([layoutType]) => {
39217              return dataViewsLayouts.some(
39218                (viewLayout) => viewLayout.type === layoutType
39219              );
39220            }
39221          )
39222        ),
39223        [defaultLayoutsProperty]
39224      );
39225      const {
39226        data: displayData,
39227        paginationInfo: displayPaginationInfo,
39228        hasInitiallyLoaded
39229      } = useData(data, isLoading, paginationInfo);
39230      if (!defaultLayouts4[view.type]) {
39231        return null;
39232      }
39233      return /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(
39234        dataviews_context_default.Provider,
39235        {
39236          value: {
39237            view,
39238            onChangeView,
39239            fields: _fields,
39240            actions,
39241            data: displayData,
39242            isLoading,
39243            paginationInfo: displayPaginationInfo,
39244            selection: _selection,
39245            onChangeSelection: setSelectionWithChange,
39246            openedFilter,
39247            setOpenedFilter,
39248            getItemId: getItemId2,
39249            getItemLevel: getItemLevel2,
39250            isItemClickable,
39251            onClickItem,
39252            renderItemLink,
39253            containerWidth,
39254            containerRef,
39255            resizeObserverRef,
39256            defaultLayouts: defaultLayouts4,
39257            filters,
39258            isShowingFilter,
39259            setIsShowingFilter,
39260            config: config2,
39261            empty,
39262            hasInitiallyLoaded,
39263            hasInfiniteScrollHandler: !!infiniteScrollHandler,
39264            onReset
39265          },
39266          children: /* @__PURE__ */ (0, import_jsx_runtime253.jsx)("div", { className: "dataviews-wrapper", ref: containerRef, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(
39267            DefaultUI,
39268            {
39269              header,
39270              search,
39271              searchLabel
39272            }
39273          ) })
39274        }
39275      );
39276    }
39277    var DataViewsSubComponents = DataViews;
39278    DataViewsSubComponents.BulkActionToolbar = BulkActionsFooter;
39279    DataViewsSubComponents.Filters = filters_default;
39280    DataViewsSubComponents.FiltersToggled = filters_toggled_default;
39281    DataViewsSubComponents.FiltersToggle = toggle_default;
39282    DataViewsSubComponents.Layout = DataViewsLayout;
39283    DataViewsSubComponents.LayoutSwitcher = ViewTypeMenu;
39284    DataViewsSubComponents.Pagination = DataViewsPagination;
39285    DataViewsSubComponents.Search = dataviews_search_default;
39286    DataViewsSubComponents.ViewConfig = DataviewsViewConfigDropdown;
39287    DataViewsSubComponents.Footer = DataViewsFooter;
39288    var dataviews_default = DataViewsSubComponents;
39289  
39290    // packages/dataviews/build-module/dataform/index.mjs
39291    var import_element133 = __toESM(require_element(), 1);
39292  
39293    // packages/dataviews/build-module/components/dataform-context/index.mjs
39294    var import_element122 = __toESM(require_element(), 1);
39295    var import_jsx_runtime254 = __toESM(require_jsx_runtime(), 1);
39296    var DataFormContext = (0, import_element122.createContext)({
39297      fields: []
39298    });
39299    DataFormContext.displayName = "DataFormContext";
39300    function DataFormProvider({
39301      fields,
39302      children
39303    }) {
39304      return /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(DataFormContext.Provider, { value: { fields }, children });
39305    }
39306    var dataform_context_default = DataFormContext;
39307  
39308    // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
39309    var import_element132 = __toESM(require_element(), 1);
39310  
39311    // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
39312    var import_element123 = __toESM(require_element(), 1);
39313    var import_components137 = __toESM(require_components(), 1);
39314  
39315    // packages/dataviews/build-module/components/dataform-layouts/normalize-form.mjs
39316    var DEFAULT_LAYOUT = {
39317      type: "regular",
39318      labelPosition: "top"
39319    };
39320    var normalizeCardSummaryField = (sum) => {
39321      if (typeof sum === "string") {
39322        return [{ id: sum, visibility: "when-collapsed" }];
39323      }
39324      return sum.map((item) => {
39325        if (typeof item === "string") {
39326          return { id: item, visibility: "when-collapsed" };
39327        }
39328        return { id: item.id, visibility: item.visibility };
39329      });
39330    };
39331    function normalizeLayout(layout) {
39332      let normalizedLayout = DEFAULT_LAYOUT;
39333      if (layout?.type === "regular") {
39334        normalizedLayout = {
39335          type: "regular",
39336          labelPosition: layout?.labelPosition ?? "top"
39337        };
39338      } else if (layout?.type === "panel") {
39339        const summary = layout.summary ?? [];
39340        const normalizedSummary = Array.isArray(summary) ? summary : [summary];
39341        normalizedLayout = {
39342          type: "panel",
39343          labelPosition: layout?.labelPosition ?? "side",
39344          openAs: layout?.openAs ?? "dropdown",
39345          summary: normalizedSummary,
39346          editVisibility: layout?.editVisibility ?? "on-hover"
39347        };
39348      } else if (layout?.type === "card") {
39349        if (layout.withHeader === false) {
39350          normalizedLayout = {
39351            type: "card",
39352            withHeader: false,
39353            isOpened: true,
39354            summary: [],
39355            isCollapsible: false
39356          };
39357        } else {
39358          const summary = layout.summary ?? [];
39359          normalizedLayout = {
39360            type: "card",
39361            withHeader: true,
39362            isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true,
39363            summary: normalizeCardSummaryField(summary),
39364            isCollapsible: layout.isCollapsible === void 0 ? true : layout.isCollapsible
39365          };
39366        }
39367      } else if (layout?.type === "row") {
39368        normalizedLayout = {
39369          type: "row",
39370          alignment: layout?.alignment ?? "center",
39371          styles: layout?.styles ?? {}
39372        };
39373      } else if (layout?.type === "details") {
39374        normalizedLayout = {
39375          type: "details",
39376          summary: layout?.summary ?? ""
39377        };
39378      }
39379      return normalizedLayout;
39380    }
39381    function normalizeForm(form) {
39382      const normalizedFormLayout = normalizeLayout(form?.layout);
39383      const normalizedFields = (form.fields ?? []).map(
39384        (field) => {
39385          if (typeof field === "string") {
39386            return {
39387              id: field,
39388              layout: normalizedFormLayout
39389            };
39390          }
39391          const fieldLayout = field.layout ? normalizeLayout(field.layout) : normalizedFormLayout;
39392          return {
39393            id: field.id,
39394            layout: fieldLayout,
39395            ...!!field.label && { label: field.label },
39396            ...!!field.description && {
39397              description: field.description
39398            },
39399            ..."children" in field && Array.isArray(field.children) && {
39400              children: normalizeForm({
39401                fields: field.children,
39402                layout: DEFAULT_LAYOUT
39403              }).fields
39404            }
39405          };
39406        }
39407      );
39408      return {
39409        layout: normalizedFormLayout,
39410        fields: normalizedFields
39411      };
39412    }
39413    var normalize_form_default = normalizeForm;
39414  
39415    // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
39416    var import_jsx_runtime255 = __toESM(require_jsx_runtime(), 1);
39417    function Header2({ title }) {
39418      return /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
39419        Stack,
39420        {
39421          direction: "column",
39422          className: "dataforms-layouts-regular__header",
39423          gap: "lg",
39424          children: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(import_components137.__experimentalHeading, { level: 2, size: 13, children: title }) })
39425        }
39426      );
39427    }
39428    function FormRegularField({
39429      data,
39430      field,
39431      onChange,
39432      hideLabelFromVision,
39433      markWhenOptional,
39434      validity
39435    }) {
39436      const { fields } = (0, import_element123.useContext)(dataform_context_default);
39437      const layout = field.layout;
39438      const form = (0, import_element123.useMemo)(
39439        () => ({
39440          layout: DEFAULT_LAYOUT,
39441          fields: !!field.children ? field.children : []
39442        }),
39443        [field]
39444      );
39445      if (!!field.children) {
39446        return /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(import_jsx_runtime255.Fragment, { children: [
39447          !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(Header2, { title: field.label }),
39448          /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
39449            DataFormLayout,
39450            {
39451              data,
39452              form,
39453              onChange,
39454              validity: validity?.children
39455            }
39456          )
39457        ] });
39458      }
39459      const labelPosition = layout.labelPosition;
39460      const fieldDefinition = fields.find(
39461        (fieldDef) => fieldDef.id === field.id
39462      );
39463      if (!fieldDefinition || !fieldDefinition.Edit) {
39464        return null;
39465      }
39466      if (labelPosition === "side") {
39467        return /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(
39468          Stack,
39469          {
39470            direction: "row",
39471            className: "dataforms-layouts-regular__field",
39472            gap: "sm",
39473            children: [
39474              /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
39475                "div",
39476                {
39477                  className: clsx_default(
39478                    "dataforms-layouts-regular__field-label",
39479                    `dataforms-layouts-regular__field-label--label-position-$labelPosition}`
39480                  ),
39481                  children: /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(import_components137.BaseControl.VisualLabel, { children: fieldDefinition.label })
39482                }
39483              ),
39484              /* @__PURE__ */ (0, import_jsx_runtime255.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
39485                fieldDefinition.render,
39486                {
39487                  item: data,
39488                  field: fieldDefinition
39489                }
39490              ) : /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
39491                fieldDefinition.Edit,
39492                {
39493                  data,
39494                  field: fieldDefinition,
39495                  onChange,
39496                  hideLabelFromVision: true,
39497                  markWhenOptional,
39498                  validity
39499                },
39500                fieldDefinition.id
39501              ) })
39502            ]
39503          }
39504        );
39505      }
39506      return /* @__PURE__ */ (0, import_jsx_runtime255.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(import_jsx_runtime255.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(import_jsx_runtime255.Fragment, { children: [
39507        !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(import_components137.BaseControl.VisualLabel, { children: fieldDefinition.label }),
39508        /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
39509          fieldDefinition.render,
39510          {
39511            item: data,
39512            field: fieldDefinition
39513          }
39514        )
39515      ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
39516        fieldDefinition.Edit,
39517        {
39518          data,
39519          field: fieldDefinition,
39520          onChange,
39521          hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision,
39522          markWhenOptional,
39523          validity
39524        }
39525      ) });
39526    }
39527  
39528    // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
39529    var import_deepmerge3 = __toESM(require_cjs(), 1);
39530    var import_components140 = __toESM(require_components(), 1);
39531    var import_i18n128 = __toESM(require_i18n(), 1);
39532    var import_element128 = __toESM(require_element(), 1);
39533    var import_compose25 = __toESM(require_compose(), 1);
39534  
39535    // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
39536    var import_components139 = __toESM(require_components(), 1);
39537    var import_i18n126 = __toESM(require_i18n(), 1);
39538    var import_compose24 = __toESM(require_compose(), 1);
39539    var import_element124 = __toESM(require_element(), 1);
39540  
39541    // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs
39542    function getLabelClassName(labelPosition, showError) {
39543      return clsx_default(
39544        "dataforms-layouts-panel__field-label",
39545        `dataforms-layouts-panel__field-label--label-position-$labelPosition}`,
39546        { "has-error": showError }
39547      );
39548    }
39549    var get_label_classname_default = getLabelClassName;
39550  
39551    // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs
39552    var import_components138 = __toESM(require_components(), 1);
39553    var import_jsx_runtime256 = __toESM(require_jsx_runtime(), 1);
39554    function getLabelContent(showError, errorMessage, fieldLabel) {
39555      return showError ? /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(import_components138.Tooltip, { text: errorMessage, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [
39556        /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(import_components138.Icon, { icon: error_default, size: 16 }),
39557        fieldLabel
39558      ] }) }) : fieldLabel;
39559    }
39560    var get_label_content_default = getLabelContent;
39561  
39562    // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs
39563    function getFirstValidationError(validity) {
39564      if (!validity) {
39565        return void 0;
39566      }
39567      const validityRules = Object.keys(validity).filter(
39568        (key) => key !== "children"
39569      );
39570      for (const key of validityRules) {
39571        const rule = validity[key];
39572        if (rule === void 0) {
39573          continue;
39574        }
39575        if (rule.type === "invalid") {
39576          if (rule.message) {
39577            return rule.message;
39578          }
39579          if (key === "required") {
39580            return "A required field is empty";
39581          }
39582          return "Unidentified validation error";
39583        }
39584      }
39585      if (validity.children) {
39586        for (const childValidity of Object.values(validity.children)) {
39587          const childError = getFirstValidationError(childValidity);
39588          if (childError) {
39589            return childError;
39590          }
39591        }
39592      }
39593      return void 0;
39594    }
39595    var get_first_validation_error_default = getFirstValidationError;
39596  
39597    // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
39598    var import_jsx_runtime257 = __toESM(require_jsx_runtime(), 1);
39599    function SummaryButton({
39600      data,
39601      field,
39602      fieldLabel,
39603      summaryFields,
39604      validity,
39605      touched,
39606      disabled,
39607      onClick,
39608      "aria-expanded": ariaExpanded
39609    }) {
39610      const { labelPosition, editVisibility } = field.layout;
39611      const errorMessage = get_first_validation_error_default(validity);
39612      const showError = touched && !!errorMessage;
39613      const labelClassName = get_label_classname_default(labelPosition, showError);
39614      const labelContent = get_label_content_default(showError, errorMessage, fieldLabel);
39615      const className = clsx_default(
39616        "dataforms-layouts-panel__field-trigger",
39617        `dataforms-layouts-panel__field-trigger--label-$labelPosition}`,
39618        {
39619          "is-disabled": disabled,
39620          "dataforms-layouts-panel__field-trigger--edit-always": editVisibility === "always"
39621        }
39622      );
39623      const controlId = (0, import_compose24.useInstanceId)(
39624        SummaryButton,
39625        "dataforms-layouts-panel__field-control"
39626      );
39627      const ariaLabel = showError ? (0, import_i18n126.sprintf)(
39628        // translators: %s: Field name.
39629        (0, import_i18n126._x)("Edit %s (has errors)", "field"),
39630        fieldLabel || ""
39631      ) : (0, import_i18n126.sprintf)(
39632        // translators: %s: Field name.
39633        (0, import_i18n126._x)("Edit %s", "field"),
39634        fieldLabel || ""
39635      );
39636      const rowRef = (0, import_element124.useRef)(null);
39637      const handleRowClick = () => {
39638        const selection = rowRef.current?.ownerDocument.defaultView?.getSelection();
39639        if (selection && selection.toString().length > 0) {
39640          return;
39641        }
39642        onClick();
39643      };
39644      const handleKeyDown = (event) => {
39645        if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) {
39646          event.preventDefault();
39647          onClick();
39648        }
39649      };
39650      return /* @__PURE__ */ (0, import_jsx_runtime257.jsxs)(
39651        "div",
39652        {
39653          ref: rowRef,
39654          className,
39655          onClick: !disabled ? handleRowClick : void 0,
39656          onKeyDown: !disabled ? handleKeyDown : void 0,
39657          children: [
39658            labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime257.jsx)("span", { className: labelClassName, children: labelContent }),
39659            labelPosition === "none" && showError && /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(import_components139.Tooltip, { text: errorMessage, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(import_components139.Icon, { icon: error_default, size: 16 }) }) }),
39660            /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
39661              "span",
39662              {
39663                id: `$controlId}`,
39664                className: "dataforms-layouts-panel__field-control",
39665                children: summaryFields.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
39666                  "span",
39667                  {
39668                    style: {
39669                      display: "flex",
39670                      flexDirection: "column",
39671                      alignItems: "flex-start",
39672                      width: "100%",
39673                      gap: "2px"
39674                    },
39675                    children: summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
39676                      "span",
39677                      {
39678                        style: { width: "100%" },
39679                        children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
39680                          summaryField.render,
39681                          {
39682                            item: data,
39683                            field: summaryField
39684                          }
39685                        )
39686                      },
39687                      summaryField.id
39688                    ))
39689                  }
39690                ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
39691                  summaryField.render,
39692                  {
39693                    item: data,
39694                    field: summaryField
39695                  },
39696                  summaryField.id
39697                ))
39698              }
39699            ),
39700            !disabled && /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
39701              import_components139.Button,
39702              {
39703                className: "dataforms-layouts-panel__field-trigger-icon",
39704                label: ariaLabel,
39705                showTooltip: false,
39706                icon: pencil_default,
39707                size: "small",
39708                "aria-expanded": ariaExpanded,
39709                "aria-haspopup": "dialog",
39710                "aria-describedby": `$controlId}`
39711              }
39712            )
39713          ]
39714        }
39715      );
39716    }
39717  
39718    // packages/dataviews/build-module/hooks/use-form-validity.mjs
39719    var import_deepmerge2 = __toESM(require_cjs(), 1);
39720    var import_es63 = __toESM(require_es6(), 1);
39721    var import_element125 = __toESM(require_element(), 1);
39722    var import_i18n127 = __toESM(require_i18n(), 1);
39723    function isFormValid(formValidity) {
39724      if (!formValidity) {
39725        return true;
39726      }
39727      return Object.values(formValidity).every((fieldValidation) => {
39728        return Object.entries(fieldValidation).every(
39729          ([key, validation]) => {
39730            if (key === "children" && validation && typeof validation === "object") {
39731              return isFormValid(validation);
39732            }
39733            return validation.type !== "invalid" && validation.type !== "validating";
39734          }
39735        );
39736      });
39737    }
39738    function getFormFieldsToValidate(form, fields) {
39739      const normalizedForm = normalize_form_default(form);
39740      if (normalizedForm.fields.length === 0) {
39741        return [];
39742      }
39743      const fieldsMap = /* @__PURE__ */ new Map();
39744      fields.forEach((field) => {
39745        fieldsMap.set(field.id, field);
39746      });
39747      function processFormField(formField) {
39748        if ("children" in formField && Array.isArray(formField.children)) {
39749          const processedChildren = formField.children.map(processFormField).filter((child) => child !== null);
39750          if (processedChildren.length === 0) {
39751            return null;
39752          }
39753          const fieldDef2 = fieldsMap.get(formField.id);
39754          if (fieldDef2) {
39755            const [normalizedField2] = normalizeFields([
39756              fieldDef2
39757            ]);
39758            return {
39759              id: formField.id,
39760              children: processedChildren,
39761              field: normalizedField2
39762            };
39763          }
39764          return {
39765            id: formField.id,
39766            children: processedChildren
39767          };
39768        }
39769        const fieldDef = fieldsMap.get(formField.id);
39770        if (!fieldDef) {
39771          return null;
39772        }
39773        const [normalizedField] = normalizeFields([fieldDef]);
39774        return {
39775          id: formField.id,
39776          children: [],
39777          field: normalizedField
39778        };
39779      }
39780      const toValidate = normalizedForm.fields.map(processFormField).filter((field) => field !== null);
39781      return toValidate;
39782    }
39783    function setValidityAtPath(formValidity, fieldValidity, path) {
39784      if (!formValidity) {
39785        formValidity = {};
39786      }
39787      if (path.length === 0) {
39788        return formValidity;
39789      }
39790      const result = { ...formValidity };
39791      let current = result;
39792      for (let i2 = 0; i2 < path.length - 1; i2++) {
39793        const segment = path[i2];
39794        if (!current[segment]) {
39795          current[segment] = {};
39796        }
39797        current[segment] = { ...current[segment] };
39798        current = current[segment];
39799      }
39800      const finalKey = path[path.length - 1];
39801      current[finalKey] = {
39802        ...current[finalKey] || {},
39803        ...fieldValidity
39804      };
39805      return result;
39806    }
39807    function removeValidationProperty(formValidity, path, property) {
39808      if (!formValidity || path.length === 0) {
39809        return formValidity;
39810      }
39811      const result = { ...formValidity };
39812      let current = result;
39813      for (let i2 = 0; i2 < path.length - 1; i2++) {
39814        const segment = path[i2];
39815        if (!current[segment]) {
39816          return formValidity;
39817        }
39818        current[segment] = { ...current[segment] };
39819        current = current[segment];
39820      }
39821      const finalKey = path[path.length - 1];
39822      if (!current[finalKey]) {
39823        return formValidity;
39824      }
39825      const fieldValidity = { ...current[finalKey] };
39826      delete fieldValidity[property];
39827      if (Object.keys(fieldValidity).length === 0) {
39828        delete current[finalKey];
39829      } else {
39830        current[finalKey] = fieldValidity;
39831      }
39832      if (Object.keys(result).length === 0) {
39833        return void 0;
39834      }
39835      return result;
39836    }
39837    function handleElementsValidationAsync(promise, formField, promiseHandler) {
39838      const { elementsCounterRef, setFormValidity, path, item } = promiseHandler;
39839      const currentToken = (elementsCounterRef.current[formField.id] || 0) + 1;
39840      elementsCounterRef.current[formField.id] = currentToken;
39841      promise.then((result) => {
39842        if (currentToken !== elementsCounterRef.current[formField.id]) {
39843          return;
39844        }
39845        if (!Array.isArray(result)) {
39846          setFormValidity((prev) => {
39847            const newFormValidity = setValidityAtPath(
39848              prev,
39849              {
39850                elements: {
39851                  type: "invalid",
39852                  message: (0, import_i18n127.__)("Could not validate elements.")
39853                }
39854              },
39855              [...path, formField.id]
39856            );
39857            return newFormValidity;
39858          });
39859          return;
39860        }
39861        if (formField.field?.isValid.elements && !formField.field.isValid.elements.validate(item, {
39862          ...formField.field,
39863          elements: result
39864        })) {
39865          setFormValidity((prev) => {
39866            const newFormValidity = setValidityAtPath(
39867              prev,
39868              {
39869                elements: {
39870                  type: "invalid",
39871                  message: (0, import_i18n127.__)(
39872                    "Value must be one of the elements."
39873                  )
39874                }
39875              },
39876              [...path, formField.id]
39877            );
39878            return newFormValidity;
39879          });
39880        } else {
39881          setFormValidity((prev) => {
39882            return removeValidationProperty(
39883              prev,
39884              [...path, formField.id],
39885              "elements"
39886            );
39887          });
39888        }
39889      }).catch((error) => {
39890        if (currentToken !== elementsCounterRef.current[formField.id]) {
39891          return;
39892        }
39893        let errorMessage;
39894        if (error instanceof Error) {
39895          errorMessage = error.message;
39896        } else {
39897          errorMessage = String(error) || (0, import_i18n127.__)(
39898            "Unknown error when running elements validation asynchronously."
39899          );
39900        }
39901        setFormValidity((prev) => {
39902          const newFormValidity = setValidityAtPath(
39903            prev,
39904            {
39905              elements: {
39906                type: "invalid",
39907                message: errorMessage
39908              }
39909            },
39910            [...path, formField.id]
39911          );
39912          return newFormValidity;
39913        });
39914      });
39915    }
39916    function handleCustomValidationAsync(promise, formField, promiseHandler) {
39917      const { customCounterRef, setFormValidity, path } = promiseHandler;
39918      const currentToken = (customCounterRef.current[formField.id] || 0) + 1;
39919      customCounterRef.current[formField.id] = currentToken;
39920      promise.then((result) => {
39921        if (currentToken !== customCounterRef.current[formField.id]) {
39922          return;
39923        }
39924        if (result === null) {
39925          setFormValidity((prev) => {
39926            return removeValidationProperty(
39927              prev,
39928              [...path, formField.id],
39929              "custom"
39930            );
39931          });
39932          return;
39933        }
39934        if (typeof result === "string") {
39935          setFormValidity((prev) => {
39936            const newFormValidity = setValidityAtPath(
39937              prev,
39938              {
39939                custom: {
39940                  type: "invalid",
39941                  message: result
39942                }
39943              },
39944              [...path, formField.id]
39945            );
39946            return newFormValidity;
39947          });
39948          return;
39949        }
39950        setFormValidity((prev) => {
39951          const newFormValidity = setValidityAtPath(
39952            prev,
39953            {
39954              custom: {
39955                type: "invalid",
39956                message: (0, import_i18n127.__)("Validation could not be processed.")
39957              }
39958            },
39959            [...path, formField.id]
39960          );
39961          return newFormValidity;
39962        });
39963      }).catch((error) => {
39964        if (currentToken !== customCounterRef.current[formField.id]) {
39965          return;
39966        }
39967        let errorMessage;
39968        if (error instanceof Error) {
39969          errorMessage = error.message;
39970        } else {
39971          errorMessage = String(error) || (0, import_i18n127.__)(
39972            "Unknown error when running custom validation asynchronously."
39973          );
39974        }
39975        setFormValidity((prev) => {
39976          const newFormValidity = setValidityAtPath(
39977            prev,
39978            {
39979              custom: {
39980                type: "invalid",
39981                message: errorMessage
39982              }
39983            },
39984            [...path, formField.id]
39985          );
39986          return newFormValidity;
39987        });
39988      });
39989    }
39990    function validateFormField(item, formField, promiseHandler) {
39991      if (formField.field?.isValid.required && !formField.field.isValid.required.validate(item, formField.field)) {
39992        return {
39993          required: { type: "invalid" }
39994        };
39995      }
39996      if (formField.field?.isValid.pattern && !formField.field.isValid.pattern.validate(item, formField.field)) {
39997        return {
39998          pattern: {
39999            type: "invalid",
40000            message: (0, import_i18n127.__)("Value does not match the required pattern.")
40001          }
40002        };
40003      }
40004      if (formField.field?.isValid.min && !formField.field.isValid.min.validate(item, formField.field)) {
40005        return {
40006          min: {
40007            type: "invalid",
40008            message: (0, import_i18n127.__)("Value is below the minimum.")
40009          }
40010        };
40011      }
40012      if (formField.field?.isValid.max && !formField.field.isValid.max.validate(item, formField.field)) {
40013        return {
40014          max: {
40015            type: "invalid",
40016            message: (0, import_i18n127.__)("Value is above the maximum.")
40017          }
40018        };
40019      }
40020      if (formField.field?.isValid.minLength && !formField.field.isValid.minLength.validate(item, formField.field)) {
40021        return {
40022          minLength: {
40023            type: "invalid",
40024            message: (0, import_i18n127.__)("Value is too short.")
40025          }
40026        };
40027      }
40028      if (formField.field?.isValid.maxLength && !formField.field.isValid.maxLength.validate(item, formField.field)) {
40029        return {
40030          maxLength: {
40031            type: "invalid",
40032            message: (0, import_i18n127.__)("Value is too long.")
40033          }
40034        };
40035      }
40036      if (formField.field?.isValid.elements && formField.field.hasElements && !formField.field.getElements && Array.isArray(formField.field.elements) && !formField.field.isValid.elements.validate(item, formField.field)) {
40037        return {
40038          elements: {
40039            type: "invalid",
40040            message: (0, import_i18n127.__)("Value must be one of the elements.")
40041          }
40042        };
40043      }
40044      let customError;
40045      if (!!formField.field && formField.field.isValid.custom) {
40046        try {
40047          const value = formField.field.getValue({ item });
40048          customError = formField.field.isValid.custom(
40049            (0, import_deepmerge2.default)(
40050              item,
40051              formField.field.setValue({
40052                item,
40053                value
40054              })
40055            ),
40056            formField.field
40057          );
40058        } catch (error) {
40059          let errorMessage;
40060          if (error instanceof Error) {
40061            errorMessage = error.message;
40062          } else {
40063            errorMessage = String(error) || (0, import_i18n127.__)("Unknown error when running custom validation.");
40064          }
40065          return {
40066            custom: {
40067              type: "invalid",
40068              message: errorMessage
40069            }
40070          };
40071        }
40072      }
40073      if (typeof customError === "string") {
40074        return {
40075          custom: {
40076            type: "invalid",
40077            message: customError
40078          }
40079        };
40080      }
40081      const fieldValidity = {};
40082      if (!!formField.field && formField.field.isValid.elements && formField.field.hasElements && typeof formField.field.getElements === "function") {
40083        handleElementsValidationAsync(
40084          formField.field.getElements(),
40085          formField,
40086          promiseHandler
40087        );
40088        fieldValidity.elements = {
40089          type: "validating",
40090          message: (0, import_i18n127.__)("Validating\u2026")
40091        };
40092      }
40093      if (customError instanceof Promise) {
40094        handleCustomValidationAsync(customError, formField, promiseHandler);
40095        fieldValidity.custom = {
40096          type: "validating",
40097          message: (0, import_i18n127.__)("Validating\u2026")
40098        };
40099      }
40100      if (Object.keys(fieldValidity).length > 0) {
40101        return fieldValidity;
40102      }
40103      if (formField.children.length > 0) {
40104        const result = {};
40105        formField.children.forEach((child) => {
40106          result[child.id] = validateFormField(item, child, {
40107            ...promiseHandler,
40108            path: [...promiseHandler.path, formField.id, "children"]
40109          });
40110        });
40111        const filteredResult = {};
40112        Object.entries(result).forEach(([key, value]) => {
40113          if (value !== void 0) {
40114            filteredResult[key] = value;
40115          }
40116        });
40117        if (Object.keys(filteredResult).length === 0) {
40118          return void 0;
40119        }
40120        return {
40121          children: filteredResult
40122        };
40123      }
40124      return void 0;
40125    }
40126    function getFormFieldValue(formField, item) {
40127      const fieldValue = formField?.field?.getValue({ item });
40128      if (formField.children.length === 0) {
40129        return fieldValue;
40130      }
40131      const childrenValues = formField.children.map(
40132        (child) => getFormFieldValue(child, item)
40133      );
40134      if (!childrenValues) {
40135        return fieldValue;
40136      }
40137      return {
40138        value: fieldValue,
40139        children: childrenValues
40140      };
40141    }
40142    function useFormValidity(item, fields, form) {
40143      const [formValidity, setFormValidity] = (0, import_element125.useState)();
40144      const customCounterRef = (0, import_element125.useRef)({});
40145      const elementsCounterRef = (0, import_element125.useRef)({});
40146      const previousValuesRef = (0, import_element125.useRef)({});
40147      const validate = (0, import_element125.useCallback)(() => {
40148        const promiseHandler = {
40149          customCounterRef,
40150          elementsCounterRef,
40151          setFormValidity,
40152          path: [],
40153          item
40154        };
40155        const formFieldsToValidate = getFormFieldsToValidate(form, fields);
40156        if (formFieldsToValidate.length === 0) {
40157          setFormValidity(void 0);
40158          return;
40159        }
40160        const newFormValidity = {};
40161        const untouchedFields = [];
40162        formFieldsToValidate.forEach((formField) => {
40163          const value = getFormFieldValue(formField, item);
40164          if (previousValuesRef.current.hasOwnProperty(formField.id) && (0, import_es63.default)(
40165            previousValuesRef.current[formField.id],
40166            value
40167          )) {
40168            untouchedFields.push(formField.id);
40169            return;
40170          }
40171          previousValuesRef.current[formField.id] = value;
40172          const fieldValidity = validateFormField(
40173            item,
40174            formField,
40175            promiseHandler
40176          );
40177          if (fieldValidity !== void 0) {
40178            newFormValidity[formField.id] = fieldValidity;
40179          }
40180        });
40181        setFormValidity((existingFormValidity) => {
40182          let validity = {
40183            ...existingFormValidity,
40184            ...newFormValidity
40185          };
40186          const fieldsToKeep = [
40187            ...untouchedFields,
40188            ...Object.keys(newFormValidity)
40189          ];
40190          Object.keys(validity).forEach((key) => {
40191            if (validity && !fieldsToKeep.includes(key)) {
40192              delete validity[key];
40193            }
40194          });
40195          if (Object.keys(validity).length === 0) {
40196            validity = void 0;
40197          }
40198          const areEqual = (0, import_es63.default)(existingFormValidity, validity);
40199          if (areEqual) {
40200            return existingFormValidity;
40201          }
40202          return validity;
40203        });
40204      }, [item, fields, form]);
40205      (0, import_element125.useEffect)(() => {
40206        validate();
40207      }, [validate]);
40208      return {
40209        validity: formValidity,
40210        isValid: isFormValid(formValidity)
40211      };
40212    }
40213    var use_form_validity_default = useFormValidity;
40214  
40215    // packages/dataviews/build-module/hooks/use-report-validity.mjs
40216    var import_element126 = __toESM(require_element(), 1);
40217    function useReportValidity(ref, shouldReport) {
40218      (0, import_element126.useEffect)(() => {
40219        if (shouldReport && ref.current) {
40220          const inputs = ref.current.querySelectorAll(
40221            "input, textarea, select"
40222          );
40223          inputs.forEach((input) => {
40224            input.reportValidity();
40225          });
40226        }
40227      }, [shouldReport, ref]);
40228    }
40229  
40230    // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
40231    var import_element127 = __toESM(require_element(), 1);
40232  
40233    // packages/dataviews/build-module/components/dataform-layouts/get-summary-fields.mjs
40234    function extractSummaryIds(summary) {
40235      if (Array.isArray(summary)) {
40236        return summary.map(
40237          (item) => typeof item === "string" ? item : item.id
40238        );
40239      }
40240      return [];
40241    }
40242    var getSummaryFields = (summaryField, fields) => {
40243      if (Array.isArray(summaryField) && summaryField.length > 0) {
40244        const summaryIds = extractSummaryIds(summaryField);
40245        return summaryIds.map(
40246          (summaryId) => fields.find((_field) => _field.id === summaryId)
40247        ).filter((_field) => _field !== void 0);
40248      }
40249      return [];
40250    };
40251  
40252    // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
40253    var getFieldDefinition = (field, fields) => {
40254      const fieldDefinition = fields.find((_field) => _field.id === field.id);
40255      if (!fieldDefinition) {
40256        return fields.find((_field) => {
40257          if (!!field.children) {
40258            const simpleChildren = field.children.filter(
40259              (child) => !child.children
40260            );
40261            if (simpleChildren.length === 0) {
40262              return false;
40263            }
40264            return _field.id === simpleChildren[0].id;
40265          }
40266          return _field.id === field.id;
40267        });
40268      }
40269      return fieldDefinition;
40270    };
40271    function useFieldFromFormField(field) {
40272      const { fields } = (0, import_element127.useContext)(dataform_context_default);
40273      const layout = field.layout;
40274      const summaryFields = getSummaryFields(layout.summary, fields);
40275      const fieldDefinition = getFieldDefinition(field, fields);
40276      const fieldLabel = !!field.children ? field.label : fieldDefinition?.label;
40277      if (summaryFields.length === 0) {
40278        return {
40279          summaryFields: fieldDefinition ? [fieldDefinition] : [],
40280          fieldDefinition,
40281          fieldLabel
40282        };
40283      }
40284      return {
40285        summaryFields,
40286        fieldDefinition,
40287        fieldLabel
40288      };
40289    }
40290    var use_field_from_form_field_default = useFieldFromFormField;
40291  
40292    // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
40293    var import_jsx_runtime258 = __toESM(require_jsx_runtime(), 1);
40294    function ModalContent({
40295      data,
40296      field,
40297      onChange,
40298      fieldLabel,
40299      onClose,
40300      touched
40301    }) {
40302      const { fields } = (0, import_element128.useContext)(dataform_context_default);
40303      const [changes, setChanges] = (0, import_element128.useState)({});
40304      const modalData = (0, import_element128.useMemo)(() => {
40305        return (0, import_deepmerge3.default)(data, changes, {
40306          arrayMerge: (target, source) => source
40307        });
40308      }, [data, changes]);
40309      const form = (0, import_element128.useMemo)(
40310        () => ({
40311          layout: DEFAULT_LAYOUT,
40312          fields: !!field.children ? field.children : (
40313            // If not explicit children return the field id itself.
40314            [{ id: field.id, layout: DEFAULT_LAYOUT }]
40315          )
40316        }),
40317        [field]
40318      );
40319      const fieldsAsFieldType = fields.map((f2) => ({
40320        ...f2,
40321        Edit: f2.Edit === null ? void 0 : f2.Edit,
40322        isValid: {
40323          required: f2.isValid.required?.constraint,
40324          elements: f2.isValid.elements?.constraint,
40325          min: f2.isValid.min?.constraint,
40326          max: f2.isValid.max?.constraint,
40327          pattern: f2.isValid.pattern?.constraint,
40328          minLength: f2.isValid.minLength?.constraint,
40329          maxLength: f2.isValid.maxLength?.constraint
40330        }
40331      }));
40332      const { validity } = use_form_validity_default(modalData, fieldsAsFieldType, form);
40333      const onApply = () => {
40334        onChange(changes);
40335        onClose();
40336      };
40337      const handleOnChange = (newValue) => {
40338        setChanges(
40339          (prev) => (0, import_deepmerge3.default)(prev, newValue, {
40340            arrayMerge: (target, source) => source
40341          })
40342        );
40343      };
40344      const focusOnMountRef = (0, import_compose25.useFocusOnMount)("firstInputElement");
40345      const contentRef = (0, import_element128.useRef)(null);
40346      const mergedRef = (0, import_compose25.useMergeRefs)([focusOnMountRef, contentRef]);
40347      useReportValidity(contentRef, touched);
40348      return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)(
40349        import_components140.Modal,
40350        {
40351          className: "dataforms-layouts-panel__modal",
40352          onRequestClose: onClose,
40353          isFullScreen: false,
40354          title: fieldLabel,
40355          size: "medium",
40356          children: [
40357            /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("div", { ref: mergedRef, children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
40358              DataFormLayout,
40359              {
40360                data: modalData,
40361                form,
40362                onChange: handleOnChange,
40363                validity,
40364                children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
40365                  FieldLayout,
40366                  {
40367                    data: modalData,
40368                    field: childField,
40369                    onChange: handleOnChange,
40370                    hideLabelFromVision: form.fields.length < 2,
40371                    markWhenOptional,
40372                    validity: childFieldValidity
40373                  },
40374                  childField.id
40375                )
40376              }
40377            ) }),
40378            /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)(
40379              Stack,
40380              {
40381                direction: "row",
40382                className: "dataforms-layouts-panel__modal-footer",
40383                gap: "md",
40384                children: [
40385                  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_components140.__experimentalSpacer, { style: { flex: 1 } }),
40386                  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
40387                    import_components140.Button,
40388                    {
40389                      variant: "tertiary",
40390                      onClick: onClose,
40391                      __next40pxDefaultSize: true,
40392                      children: (0, import_i18n128.__)("Cancel")
40393                    }
40394                  ),
40395                  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
40396                    import_components140.Button,
40397                    {
40398                      variant: "primary",
40399                      onClick: onApply,
40400                      __next40pxDefaultSize: true,
40401                      children: (0, import_i18n128.__)("Apply")
40402                    }
40403                  )
40404                ]
40405              }
40406            )
40407          ]
40408        }
40409      );
40410    }
40411    function PanelModal({
40412      data,
40413      field,
40414      onChange,
40415      validity
40416    }) {
40417      const [touched, setTouched] = (0, import_element128.useState)(false);
40418      const [isOpen, setIsOpen] = (0, import_element128.useState)(false);
40419      const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
40420      if (!fieldDefinition) {
40421        return null;
40422      }
40423      const handleClose = () => {
40424        setIsOpen(false);
40425        setTouched(true);
40426      };
40427      return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)(import_jsx_runtime258.Fragment, { children: [
40428        /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
40429          SummaryButton,
40430          {
40431            data,
40432            field,
40433            fieldLabel,
40434            summaryFields,
40435            validity,
40436            touched,
40437            disabled: fieldDefinition.readOnly === true,
40438            onClick: () => setIsOpen(true),
40439            "aria-expanded": isOpen
40440          }
40441        ),
40442        isOpen && /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
40443          ModalContent,
40444          {
40445            data,
40446            field,
40447            onChange,
40448            fieldLabel: fieldLabel ?? "",
40449            onClose: handleClose,
40450            touched
40451          }
40452        )
40453      ] });
40454    }
40455    var modal_default2 = PanelModal;
40456  
40457    // packages/dataviews/build-module/components/dataform-layouts/panel/dropdown.mjs
40458    var import_components141 = __toESM(require_components(), 1);
40459    var import_i18n129 = __toESM(require_i18n(), 1);
40460    var import_element129 = __toESM(require_element(), 1);
40461    var import_compose26 = __toESM(require_compose(), 1);
40462    var import_jsx_runtime259 = __toESM(require_jsx_runtime(), 1);
40463    function DropdownHeader({
40464      title,
40465      onClose
40466    }) {
40467      return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
40468        Stack,
40469        {
40470          direction: "column",
40471          className: "dataforms-layouts-panel__dropdown-header",
40472          gap: "lg",
40473          children: /* @__PURE__ */ (0, import_jsx_runtime259.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", children: [
40474            title && /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(import_components141.__experimentalHeading, { level: 2, size: 13, children: title }),
40475            /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(import_components141.__experimentalSpacer, { style: { flex: 1 } }),
40476            onClose && /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
40477              import_components141.Button,
40478              {
40479                label: (0, import_i18n129.__)("Close"),
40480                icon: close_small_default,
40481                onClick: onClose,
40482                size: "small"
40483              }
40484            )
40485          ] })
40486        }
40487      );
40488    }
40489    function DropdownContentWithValidation({
40490      touched,
40491      children
40492    }) {
40493      const ref = (0, import_element129.useRef)(null);
40494      useReportValidity(ref, touched);
40495      return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)("div", { ref, children });
40496    }
40497    function PanelDropdown({
40498      data,
40499      field,
40500      onChange,
40501      validity
40502    }) {
40503      const [touched, setTouched] = (0, import_element129.useState)(false);
40504      const [popoverAnchor, setPopoverAnchor] = (0, import_element129.useState)(
40505        null
40506      );
40507      const popoverProps = (0, import_element129.useMemo)(
40508        () => ({
40509          // Anchor the popover to the middle of the entire row so that it doesn't
40510          // move around when the label changes.
40511          anchor: popoverAnchor,
40512          placement: "left-start",
40513          offset: 36,
40514          shift: true
40515        }),
40516        [popoverAnchor]
40517      );
40518      const [dialogRef, dialogProps] = (0, import_compose26.__experimentalUseDialog)({
40519        focusOnMount: "firstInputElement"
40520      });
40521      const form = (0, import_element129.useMemo)(
40522        () => ({
40523          layout: DEFAULT_LAYOUT,
40524          fields: !!field.children ? field.children : (
40525            // If not explicit children return the field id itself.
40526            [{ id: field.id, layout: DEFAULT_LAYOUT }]
40527          )
40528        }),
40529        [field]
40530      );
40531      const formValidity = (0, import_element129.useMemo)(() => {
40532        if (validity === void 0) {
40533          return void 0;
40534        }
40535        if (!!field.children) {
40536          return validity?.children;
40537        }
40538        return { [field.id]: validity };
40539      }, [validity, field]);
40540      const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
40541      if (!fieldDefinition) {
40542        return null;
40543      }
40544      return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
40545        "div",
40546        {
40547          ref: setPopoverAnchor,
40548          className: "dataforms-layouts-panel__field-dropdown-anchor",
40549          children: /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
40550            import_components141.Dropdown,
40551            {
40552              contentClassName: "dataforms-layouts-panel__field-dropdown",
40553              popoverProps,
40554              focusOnMount: false,
40555              onToggle: (willOpen) => {
40556                if (!willOpen) {
40557                  setTouched(true);
40558                }
40559              },
40560              renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
40561                SummaryButton,
40562                {
40563                  data,
40564                  field,
40565                  fieldLabel,
40566                  summaryFields,
40567                  validity,
40568                  touched,
40569                  disabled: fieldDefinition.readOnly === true,
40570                  onClick: onToggle,
40571                  "aria-expanded": isOpen
40572                }
40573              ),
40574              renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ (0, import_jsx_runtime259.jsxs)("div", { ref: dialogRef, ...dialogProps, children: [
40575                /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
40576                  DropdownHeader,
40577                  {
40578                    title: fieldLabel,
40579                    onClose
40580                  }
40581                ),
40582                /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
40583                  DataFormLayout,
40584                  {
40585                    data,
40586                    form,
40587                    onChange,
40588                    validity: formValidity,
40589                    children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
40590                      FieldLayout,
40591                      {
40592                        data,
40593                        field: childField,
40594                        onChange,
40595                        hideLabelFromVision: (form?.fields ?? []).length < 2,
40596                        markWhenOptional,
40597                        validity: childFieldValidity
40598                      },
40599                      childField.id
40600                    )
40601                  }
40602                )
40603              ] }) })
40604            }
40605          )
40606        }
40607      );
40608    }
40609    var dropdown_default = PanelDropdown;
40610  
40611    // packages/dataviews/build-module/components/dataform-layouts/panel/index.mjs
40612    var import_jsx_runtime260 = __toESM(require_jsx_runtime(), 1);
40613    function FormPanelField({
40614      data,
40615      field,
40616      onChange,
40617      validity
40618    }) {
40619      const layout = field.layout;
40620      if (layout.openAs === "modal") {
40621        return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
40622          modal_default2,
40623          {
40624            data,
40625            field,
40626            onChange,
40627            validity
40628          }
40629        );
40630      }
40631      return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
40632        dropdown_default,
40633        {
40634          data,
40635          field,
40636          onChange,
40637          validity
40638        }
40639      );
40640    }
40641  
40642    // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
40643    var import_components142 = __toESM(require_components(), 1);
40644    var import_compose27 = __toESM(require_compose(), 1);
40645    var import_element130 = __toESM(require_element(), 1);
40646    var import_i18n131 = __toESM(require_i18n(), 1);
40647  
40648    // packages/dataviews/build-module/components/dataform-layouts/validation-badge.mjs
40649    var import_i18n130 = __toESM(require_i18n(), 1);
40650    var import_jsx_runtime261 = __toESM(require_jsx_runtime(), 1);
40651    function countInvalidFields(validity) {
40652      if (!validity) {
40653        return 0;
40654      }
40655      let count = 0;
40656      const validityRules = Object.keys(validity).filter(
40657        (key) => key !== "children"
40658      );
40659      for (const key of validityRules) {
40660        const rule = validity[key];
40661        if (rule?.type === "invalid") {
40662          count++;
40663        }
40664      }
40665      if (validity.children) {
40666        for (const childValidity of Object.values(validity.children)) {
40667          count += countInvalidFields(childValidity);
40668        }
40669      }
40670      return count;
40671    }
40672    function ValidationBadge({
40673      validity
40674    }) {
40675      const invalidCount = countInvalidFields(validity);
40676      if (invalidCount === 0) {
40677        return null;
40678      }
40679      return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(Badge, { intent: "high", children: (0, import_i18n130.sprintf)(
40680        /* translators: %d: Number of fields that need attention */
40681        (0, import_i18n130._n)(
40682          "%d field needs attention",
40683          "%d fields need attention",
40684          invalidCount
40685        ),
40686        invalidCount
40687      ) });
40688    }
40689  
40690    // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
40691    var import_jsx_runtime262 = __toESM(require_jsx_runtime(), 1);
40692    function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) {
40693      if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
40694        return false;
40695      }
40696      const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig];
40697      const fieldConfig = summaryConfigArray.find((config2) => {
40698        if (typeof config2 === "string") {
40699          return config2 === summaryField.id;
40700        }
40701        if (typeof config2 === "object" && "id" in config2) {
40702          return config2.id === summaryField.id;
40703        }
40704        return false;
40705      });
40706      if (!fieldConfig) {
40707        return false;
40708      }
40709      if (typeof fieldConfig === "string") {
40710        return true;
40711      }
40712      if (typeof fieldConfig === "object" && "visibility" in fieldConfig) {
40713        return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen;
40714      }
40715      return true;
40716    }
40717    function FormCardField({
40718      data,
40719      field,
40720      onChange,
40721      hideLabelFromVision,
40722      markWhenOptional,
40723      validity
40724    }) {
40725      const { fields } = (0, import_element130.useContext)(dataform_context_default);
40726      const layout = field.layout;
40727      const cardBodyRef = (0, import_element130.useRef)(null);
40728      const bodyId = (0, import_compose27.useInstanceId)(
40729        FormCardField,
40730        "dataforms-layouts-card-card-body"
40731      );
40732      const form = (0, import_element130.useMemo)(
40733        () => ({
40734          layout: DEFAULT_LAYOUT,
40735          fields: field.children ?? []
40736        }),
40737        [field]
40738      );
40739      const { isOpened, isCollapsible } = layout;
40740      const [internalIsOpen, setIsOpen] = (0, import_element130.useState)(isOpened);
40741      const [touched, setTouched] = (0, import_element130.useState)(false);
40742      (0, import_element130.useEffect)(() => {
40743        setIsOpen(isOpened);
40744      }, [isOpened]);
40745      const toggle = (0, import_element130.useCallback)(() => {
40746        setIsOpen((prev) => {
40747          if (prev) {
40748            setTouched(true);
40749          }
40750          return !prev;
40751        });
40752      }, []);
40753      const isOpen = isCollapsible ? internalIsOpen : true;
40754      const handleBlur = (0, import_element130.useCallback)(() => {
40755        setTouched(true);
40756      }, [setTouched]);
40757      useReportValidity(cardBodyRef, isOpen && touched);
40758      const summaryFields = getSummaryFields(layout.summary, fields);
40759      const visibleSummaryFields = summaryFields.filter(
40760        (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen)
40761      );
40762      const validationBadge = touched && layout.isCollapsible ? /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(ValidationBadge, { validity }) : null;
40763      const sizeCard = {
40764        blockStart: "medium",
40765        blockEnd: "medium",
40766        inlineStart: "medium",
40767        inlineEnd: "medium"
40768      };
40769      let label = field.label;
40770      let withHeader;
40771      let bodyContent;
40772      if (field.children) {
40773        withHeader = !!label && layout.withHeader;
40774        bodyContent = /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(import_jsx_runtime262.Fragment, { children: [
40775          field.description && /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
40776          /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
40777            DataFormLayout,
40778            {
40779              data,
40780              form,
40781              onChange,
40782              validity: validity?.children
40783            }
40784          )
40785        ] });
40786      } else {
40787        const fieldDefinition = fields.find(
40788          (fieldDef) => fieldDef.id === field.id
40789        );
40790        if (!fieldDefinition || !fieldDefinition.Edit) {
40791          return null;
40792        }
40793        const SingleFieldLayout = getFormFieldLayout("regular")?.component;
40794        if (!SingleFieldLayout) {
40795          return null;
40796        }
40797        label = fieldDefinition.label;
40798        withHeader = !!label && layout.withHeader;
40799        bodyContent = /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
40800          SingleFieldLayout,
40801          {
40802            data,
40803            field,
40804            onChange,
40805            hideLabelFromVision: hideLabelFromVision || withHeader,
40806            markWhenOptional,
40807            validity
40808          }
40809        );
40810      }
40811      const sizeCardBody = {
40812        blockStart: withHeader ? "none" : "medium",
40813        blockEnd: "medium",
40814        inlineStart: "medium",
40815        inlineEnd: "medium"
40816      };
40817      return /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(import_components142.Card, { className: "dataforms-layouts-card__field", size: sizeCard, children: [
40818        withHeader && /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(
40819          import_components142.CardHeader,
40820          {
40821            className: "dataforms-layouts-card__field-header",
40822            onClick: isCollapsible ? toggle : void 0,
40823            style: {
40824              cursor: isCollapsible ? "pointer" : void 0
40825            },
40826            isBorderless: true,
40827            children: [
40828              /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(
40829                "div",
40830                {
40831                  style: {
40832                    // Match the expand/collapse button's height to avoid layout
40833                    // differences when that button is not displayed.
40834                    height: isCollapsible ? void 0 : "40px",
40835                    width: "100%",
40836                    display: "flex",
40837                    justifyContent: "space-between",
40838                    alignItems: "center"
40839                  },
40840                  children: [
40841                    /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("span", { className: "dataforms-layouts-card__field-header-label", children: label }),
40842                    validationBadge,
40843                    visibleSummaryFields.length > 0 && layout.withHeader && /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map(
40844                      (summaryField) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
40845                        summaryField.render,
40846                        {
40847                          item: data,
40848                          field: summaryField
40849                        },
40850                        summaryField.id
40851                      )
40852                    ) })
40853                  ]
40854                }
40855              ),
40856              isCollapsible && /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
40857                import_components142.Button,
40858                {
40859                  __next40pxDefaultSize: true,
40860                  variant: "tertiary",
40861                  icon: isOpen ? chevron_up_default : chevron_down_default,
40862                  "aria-expanded": isOpen,
40863                  "aria-controls": bodyId,
40864                  "aria-label": isOpen ? (0, import_i18n131.__)("Collapse") : (0, import_i18n131.__)("Expand")
40865                }
40866              )
40867            ]
40868          }
40869        ),
40870        (isOpen || !withHeader) && // If it doesn't have a header, keep it open.
40871        // Otherwise, the card will not be visible.
40872        /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
40873          import_components142.CardBody,
40874          {
40875            id: bodyId,
40876            size: sizeCardBody,
40877            className: "dataforms-layouts-card__field-control",
40878            ref: cardBodyRef,
40879            onBlur: handleBlur,
40880            children: bodyContent
40881          }
40882        )
40883      ] });
40884    }
40885  
40886    // packages/dataviews/build-module/components/dataform-layouts/row/index.mjs
40887    var import_components143 = __toESM(require_components(), 1);
40888    var import_jsx_runtime263 = __toESM(require_jsx_runtime(), 1);
40889    function Header3({ title }) {
40890      return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
40891        Stack,
40892        {
40893          direction: "column",
40894          className: "dataforms-layouts-row__header",
40895          gap: "lg",
40896          children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_components143.__experimentalHeading, { level: 2, size: 13, children: title }) })
40897        }
40898      );
40899    }
40900    var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_jsx_runtime263.Fragment, { children });
40901    function FormRowField({
40902      data,
40903      field,
40904      onChange,
40905      hideLabelFromVision,
40906      markWhenOptional,
40907      validity
40908    }) {
40909      const layout = field.layout;
40910      if (!!field.children) {
40911        const form = {
40912          layout: DEFAULT_LAYOUT,
40913          fields: field.children
40914        };
40915        return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "dataforms-layouts-row__field", children: [
40916          !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Header3, { title: field.label }),
40917          /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
40918            DataFormLayout,
40919            {
40920              data,
40921              form,
40922              onChange,
40923              validity: validity?.children,
40924              as: EMPTY_WRAPPER,
40925              children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
40926                "div",
40927                {
40928                  className: "dataforms-layouts-row__field-control",
40929                  style: layout.styles[childField.id],
40930                  children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
40931                    FieldLayout,
40932                    {
40933                      data,
40934                      field: childField,
40935                      onChange,
40936                      hideLabelFromVision,
40937                      markWhenOptional,
40938                      validity: childFieldValidity
40939                    }
40940                  )
40941                },
40942                childField.id
40943              )
40944            }
40945          ) })
40946        ] });
40947      }
40948      const RegularLayout = getFormFieldLayout("regular")?.component;
40949      if (!RegularLayout) {
40950        return null;
40951      }
40952      return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_jsx_runtime263.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
40953        RegularLayout,
40954        {
40955          data,
40956          field,
40957          onChange,
40958          markWhenOptional,
40959          validity
40960        }
40961      ) }) });
40962    }
40963  
40964    // packages/dataviews/build-module/components/dataform-layouts/details/index.mjs
40965    var import_element131 = __toESM(require_element(), 1);
40966    var import_i18n132 = __toESM(require_i18n(), 1);
40967    var import_jsx_runtime264 = __toESM(require_jsx_runtime(), 1);
40968    function FormDetailsField({
40969      data,
40970      field,
40971      onChange,
40972      validity
40973    }) {
40974      const { fields } = (0, import_element131.useContext)(dataform_context_default);
40975      const detailsRef = (0, import_element131.useRef)(null);
40976      const contentRef = (0, import_element131.useRef)(null);
40977      const [touched, setTouched] = (0, import_element131.useState)(false);
40978      const [isOpen, setIsOpen] = (0, import_element131.useState)(false);
40979      const form = (0, import_element131.useMemo)(
40980        () => ({
40981          layout: DEFAULT_LAYOUT,
40982          fields: field.children ?? []
40983        }),
40984        [field]
40985      );
40986      (0, import_element131.useEffect)(() => {
40987        const details = detailsRef.current;
40988        if (!details) {
40989          return;
40990        }
40991        const handleToggle = () => {
40992          const nowOpen = details.open;
40993          if (!nowOpen) {
40994            setTouched(true);
40995          }
40996          setIsOpen(nowOpen);
40997        };
40998        details.addEventListener("toggle", handleToggle);
40999        return () => {
41000          details.removeEventListener("toggle", handleToggle);
41001        };
41002      }, []);
41003      useReportValidity(contentRef, isOpen && touched);
41004      const handleBlur = (0, import_element131.useCallback)(() => {
41005        setTouched(true);
41006      }, []);
41007      if (!field.children) {
41008        return null;
41009      }
41010      const summaryFieldId = field.layout.summary ?? "";
41011      const summaryField = summaryFieldId ? fields.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0;
41012      let summaryContent;
41013      if (summaryField && summaryField.render) {
41014        summaryContent = /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(summaryField.render, { item: data, field: summaryField });
41015      } else {
41016        summaryContent = field.label || (0, import_i18n132.__)("More details");
41017      }
41018      return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(
41019        "details",
41020        {
41021          ref: detailsRef,
41022          className: "dataforms-layouts-details__details",
41023          children: [
41024            /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(
41025              Stack,
41026              {
41027                direction: "row",
41028                align: "center",
41029                gap: "md",
41030                className: "dataforms-layouts-details__summary-content",
41031                children: [
41032                  summaryContent,
41033                  touched && /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(ValidationBadge, { validity })
41034                ]
41035              }
41036            ) }),
41037            /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
41038              "div",
41039              {
41040                ref: contentRef,
41041                className: "dataforms-layouts-details__content",
41042                onBlur: handleBlur,
41043                children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
41044                  DataFormLayout,
41045                  {
41046                    data,
41047                    form,
41048                    onChange,
41049                    validity: validity?.children
41050                  }
41051                )
41052              }
41053            )
41054          ]
41055        }
41056      );
41057    }
41058  
41059    // packages/dataviews/build-module/components/dataform-layouts/index.mjs
41060    var import_jsx_runtime265 = __toESM(require_jsx_runtime(), 1);
41061    var FORM_FIELD_LAYOUTS = [
41062      {
41063        type: "regular",
41064        component: FormRegularField,
41065        wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
41066          Stack,
41067          {
41068            direction: "column",
41069            className: "dataforms-layouts__wrapper",
41070            gap: "lg",
41071            children
41072          }
41073        )
41074      },
41075      {
41076        type: "panel",
41077        component: FormPanelField,
41078        wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
41079          Stack,
41080          {
41081            direction: "column",
41082            className: "dataforms-layouts__wrapper",
41083            gap: "md",
41084            children
41085          }
41086        )
41087      },
41088      {
41089        type: "card",
41090        component: FormCardField,
41091        wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
41092          Stack,
41093          {
41094            direction: "column",
41095            className: "dataforms-layouts__wrapper",
41096            gap: "xl",
41097            children
41098          }
41099        )
41100      },
41101      {
41102        type: "row",
41103        component: FormRowField,
41104        wrapper: ({
41105          children,
41106          layout
41107        }) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
41108          Stack,
41109          {
41110            direction: "column",
41111            className: "dataforms-layouts__wrapper",
41112            gap: "lg",
41113            children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
41114              Stack,
41115              {
41116                direction: "row",
41117                gap: "lg",
41118                align: layout.alignment,
41119                children
41120              }
41121            ) })
41122          }
41123        )
41124      },
41125      {
41126        type: "details",
41127        component: FormDetailsField
41128      }
41129    ];
41130    function getFormFieldLayout(type) {
41131      return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type);
41132    }
41133  
41134    // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
41135    var import_jsx_runtime266 = __toESM(require_jsx_runtime(), 1);
41136    var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children });
41137    function DataFormLayout({
41138      data,
41139      form,
41140      onChange,
41141      validity,
41142      children,
41143      as
41144    }) {
41145      const { fields: fieldDefinitions } = (0, import_element132.useContext)(dataform_context_default);
41146      const markWhenOptional = (0, import_element132.useMemo)(() => {
41147        const requiredCount = fieldDefinitions.filter(
41148          (f2) => !!f2.isValid?.required
41149        ).length;
41150        const optionalCount = fieldDefinitions.length - requiredCount;
41151        return requiredCount > optionalCount;
41152      }, [fieldDefinitions]);
41153      function getFieldDefinition2(field) {
41154        return fieldDefinitions.find(
41155          (fieldDefinition) => fieldDefinition.id === field.id
41156        );
41157      }
41158      const Wrapper = as ?? getFormFieldLayout(form.layout.type)?.wrapper ?? DEFAULT_WRAPPER;
41159      return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Wrapper, { layout: form.layout, children: form.fields.map((formField) => {
41160        const FieldLayout = getFormFieldLayout(formField.layout.type)?.component;
41161        if (!FieldLayout) {
41162          return null;
41163        }
41164        const fieldDefinition = !formField.children ? getFieldDefinition2(formField) : void 0;
41165        if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) {
41166          return null;
41167        }
41168        if (children) {
41169          return children(
41170            FieldLayout,
41171            formField,
41172            validity?.[formField.id],
41173            markWhenOptional
41174          );
41175        }
41176        return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
41177          FieldLayout,
41178          {
41179            data,
41180            field: formField,
41181            onChange,
41182            markWhenOptional,
41183            validity: validity?.[formField.id]
41184          },
41185          formField.id
41186        );
41187      }) });
41188    }
41189  
41190    // packages/dataviews/build-module/dataform/index.mjs
41191    var import_jsx_runtime267 = __toESM(require_jsx_runtime(), 1);
41192    function DataForm({
41193      data,
41194      form,
41195      fields,
41196      onChange,
41197      validity
41198    }) {
41199      const normalizedForm = (0, import_element133.useMemo)(() => normalize_form_default(form), [form]);
41200      const normalizedFields = (0, import_element133.useMemo)(
41201        () => normalizeFields(fields),
41202        [fields]
41203      );
41204      if (!form.fields) {
41205        return null;
41206      }
41207      return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
41208        DataFormLayout,
41209        {
41210          data,
41211          form: normalizedForm,
41212          onChange,
41213          validity
41214        }
41215      ) });
41216    }
41217  
41218    // packages/dataviews/build-module/utils/filter-sort-and-paginate.mjs
41219    var import_remove_accents2 = __toESM(require_remove_accents(), 1);
41220    var import_deprecated4 = __toESM(require_deprecated(), 1);
41221    function normalizeSearchInput2(input = "") {
41222      return (0, import_remove_accents2.default)(input.trim().toLowerCase());
41223    }
41224    var EMPTY_ARRAY10 = [];
41225    function filterSortAndPaginate(data, view, fields) {
41226      if (!data) {
41227        return {
41228          data: EMPTY_ARRAY10,
41229          paginationInfo: { totalItems: 0, totalPages: 0 }
41230        };
41231      }
41232      const _fields = normalizeFields(fields);
41233      let filteredData = [...data];
41234      if (view.search) {
41235        const normalizedSearch = normalizeSearchInput2(view.search);
41236        filteredData = filteredData.filter((item) => {
41237          return _fields.filter((field) => field.enableGlobalSearch).some((field) => {
41238            const fieldValue = field.getValue({ item });
41239            const values = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
41240            return values.some(
41241              (value) => normalizeSearchInput2(String(value)).includes(
41242                normalizedSearch
41243              )
41244            );
41245          });
41246        });
41247      }
41248      if (view.filters && view.filters?.length > 0) {
41249        view.filters.forEach((filter) => {
41250          const field = _fields.find(
41251            (_field) => _field.id === filter.field
41252          );
41253          if (field) {
41254            if (filter.operator === OPERATOR_IS_NOT_ALL) {
41255              (0, import_deprecated4.default)("The 'isNotAll' filter operator", {
41256                since: "7.0",
41257                alternative: "'isNone'"
41258              });
41259            }
41260            const handler = field.filter[filter.operator];
41261            if (handler) {
41262              filteredData = filteredData.filter(
41263                (item) => handler(item, field, filter.value)
41264              );
41265            }
41266          }
41267        });
41268      }
41269      const sortByField = view.sort?.field ? _fields.find((field) => {
41270        return field.enableSorting !== false && field.id === view.sort?.field;
41271      }) : null;
41272      const groupByField = view.groupBy?.field ? _fields.find((field) => {
41273        return field.enableSorting !== false && field.id === view.groupBy?.field;
41274      }) : null;
41275      if (sortByField || groupByField) {
41276        filteredData.sort((a2, b2) => {
41277          if (groupByField) {
41278            const groupCompare = groupByField.sort(
41279              a2,
41280              b2,
41281              view.groupBy?.direction ?? "asc"
41282            );
41283            if (groupCompare !== 0) {
41284              return groupCompare;
41285            }
41286          }
41287          if (sortByField) {
41288            return sortByField.sort(a2, b2, view.sort?.direction ?? "desc");
41289          }
41290          return 0;
41291        });
41292      }
41293      let totalItems = filteredData.length;
41294      let totalPages = 1;
41295      if (view.page !== void 0 && view.perPage !== void 0) {
41296        const start2 = (view.page - 1) * view.perPage;
41297        totalItems = filteredData?.length || 0;
41298        totalPages = Math.ceil(totalItems / view.perPage);
41299        filteredData = filteredData?.slice(start2, start2 + view.perPage);
41300      }
41301      return {
41302        data: filteredData,
41303        paginationInfo: {
41304          totalItems,
41305          totalPages
41306        }
41307      };
41308    }
41309  
41310    // packages/edit-site/build-module/components/page-patterns/index.mjs
41311    var import_core_data48 = __toESM(require_core_data(), 1);
41312    var import_editor31 = __toESM(require_editor(), 1);
41313    var import_router31 = __toESM(require_router(), 1);
41314  
41315    // node_modules/dequal/dist/index.mjs
41316    var has = Object.prototype.hasOwnProperty;
41317    function find(iter, tar, key) {
41318      for (key of iter.keys()) {
41319        if (dequal(key, tar)) return key;
41320      }
41321    }
41322    function dequal(foo, bar) {
41323      var ctor, len, tmp;
41324      if (foo === bar) return true;
41325      if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
41326        if (ctor === Date) return foo.getTime() === bar.getTime();
41327        if (ctor === RegExp) return foo.toString() === bar.toString();
41328        if (ctor === Array) {
41329          if ((len = foo.length) === bar.length) {
41330            while (len-- && dequal(foo[len], bar[len])) ;
41331          }
41332          return len === -1;
41333        }
41334        if (ctor === Set) {
41335          if (foo.size !== bar.size) {
41336            return false;
41337          }
41338          for (len of foo) {
41339            tmp = len;
41340            if (tmp && typeof tmp === "object") {
41341              tmp = find(bar, tmp);
41342              if (!tmp) return false;
41343            }
41344            if (!bar.has(tmp)) return false;
41345          }
41346          return true;
41347        }
41348        if (ctor === Map) {
41349          if (foo.size !== bar.size) {
41350            return false;
41351          }
41352          for (len of foo) {
41353            tmp = len[0];
41354            if (tmp && typeof tmp === "object") {
41355              tmp = find(bar, tmp);
41356              if (!tmp) return false;
41357            }
41358            if (!dequal(len[1], bar.get(tmp))) {
41359              return false;
41360            }
41361          }
41362          return true;
41363        }
41364        if (ctor === ArrayBuffer) {
41365          foo = new Uint8Array(foo);
41366          bar = new Uint8Array(bar);
41367        } else if (ctor === DataView) {
41368          if ((len = foo.byteLength) === bar.byteLength) {
41369            while (len-- && foo.getInt8(len) === bar.getInt8(len)) ;
41370          }
41371          return len === -1;
41372        }
41373        if (ArrayBuffer.isView(foo)) {
41374          if ((len = foo.byteLength) === bar.byteLength) {
41375            while (len-- && foo[len] === bar[len]) ;
41376          }
41377          return len === -1;
41378        }
41379        if (!ctor || typeof foo === "object") {
41380          len = 0;
41381          for (ctor in foo) {
41382            if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
41383            if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
41384          }
41385          return Object.keys(bar).length === len;
41386        }
41387      }
41388      return foo !== foo && bar !== bar;
41389    }
41390  
41391    // packages/views/build-module/use-view.mjs
41392    var import_element134 = __toESM(require_element(), 1);
41393    var import_data64 = __toESM(require_data(), 1);
41394    var import_preferences11 = __toESM(require_preferences(), 1);
41395  
41396    // packages/views/build-module/preference-keys.mjs
41397    function generatePreferenceKey(kind, name2, slug) {
41398      return `dataviews-$kind}-$name2}-$slug}`;
41399    }
41400  
41401    // packages/views/build-module/filter-utils.mjs
41402    var SCALAR_VALUES = [
41403      "titleField",
41404      "mediaField",
41405      "descriptionField",
41406      "showTitle",
41407      "showMedia",
41408      "showDescription",
41409      "showLevels",
41410      "infiniteScrollEnabled"
41411    ];
41412    function mergeActiveViewOverrides(view, activeViewOverrides, defaultView) {
41413      if (!activeViewOverrides) {
41414        return view;
41415      }
41416      let result = view;
41417      for (const key of SCALAR_VALUES) {
41418        if (key in activeViewOverrides) {
41419          result = { ...result, [key]: activeViewOverrides[key] };
41420        }
41421      }
41422      if (activeViewOverrides.filters && activeViewOverrides.filters.length > 0) {
41423        const activeFields = new Set(
41424          activeViewOverrides.filters.map((f2) => f2.field)
41425        );
41426        const preserved = (view.filters ?? []).filter(
41427          (f2) => !activeFields.has(f2.field)
41428        );
41429        result = {
41430          ...result,
41431          filters: [...preserved, ...activeViewOverrides.filters]
41432        };
41433      }
41434      if (activeViewOverrides.sort) {
41435        const isDefaultSort = defaultView && view.sort?.field === defaultView.sort?.field && view.sort?.direction === defaultView.sort?.direction;
41436        if (isDefaultSort) {
41437          result = {
41438            ...result,
41439            sort: activeViewOverrides.sort
41440          };
41441        }
41442      }
41443      if (activeViewOverrides.layout) {
41444        result = {
41445          ...result,
41446          layout: {
41447            ...result.layout,
41448            ...activeViewOverrides.layout
41449          }
41450        };
41451      }
41452      if (activeViewOverrides.groupBy) {
41453        result = {
41454          ...result,
41455          groupBy: activeViewOverrides.groupBy
41456        };
41457      }
41458      return result;
41459    }
41460    function stripActiveViewOverrides(view, activeViewOverrides, defaultView) {
41461      if (!activeViewOverrides) {
41462        return view;
41463      }
41464      let result = view;
41465      for (const key of SCALAR_VALUES) {
41466        if (key in activeViewOverrides) {
41467          const { [key]: _, ...rest } = result;
41468          result = rest;
41469        }
41470      }
41471      if (activeViewOverrides.filters && activeViewOverrides.filters.length > 0) {
41472        const activeFields = new Set(
41473          activeViewOverrides.filters.map((f2) => f2.field)
41474        );
41475        result = {
41476          ...result,
41477          filters: (view.filters ?? []).filter(
41478            (f2) => !activeFields.has(f2.field)
41479          )
41480        };
41481      }
41482      if (activeViewOverrides.sort && view.sort?.field === activeViewOverrides.sort.field && view.sort?.direction === activeViewOverrides.sort.direction) {
41483        result = {
41484          ...result,
41485          sort: defaultView?.sort
41486        };
41487      }
41488      if (activeViewOverrides.layout && "layout" in result && result.layout) {
41489        const layout = { ...result.layout };
41490        for (const key of Object.keys(activeViewOverrides.layout)) {
41491          delete layout[key];
41492        }
41493        result = {
41494          ...result,
41495          layout: Object.keys(layout).length > 0 ? layout : void 0
41496        };
41497      }
41498      if (activeViewOverrides.groupBy && "groupBy" in result) {
41499        const { groupBy: _, ...rest } = result;
41500        result = rest;
41501      }
41502      return result;
41503    }
41504  
41505    // packages/views/build-module/use-view.mjs
41506    function omit3(obj, keys) {
41507      const result = { ...obj };
41508      for (const key of keys) {
41509        delete result[key];
41510      }
41511      return result;
41512    }
41513    function useView(config2) {
41514      const {
41515        kind,
41516        name: name2,
41517        slug,
41518        defaultView,
41519        activeViewOverrides,
41520        queryParams,
41521        onChangeQueryParams
41522      } = config2;
41523      const preferenceKey = generatePreferenceKey(kind, name2, slug);
41524      const persistedView = (0, import_data64.useSelect)(
41525        (select3) => {
41526          return select3(import_preferences11.store).get(
41527            "core/views",
41528            preferenceKey
41529          );
41530        },
41531        [preferenceKey]
41532      );
41533      const { set } = (0, import_data64.useDispatch)(import_preferences11.store);
41534      const baseView = persistedView ?? defaultView;
41535      const page = Number(queryParams?.page ?? baseView.page ?? 1);
41536      const search = queryParams?.search ?? baseView.search ?? "";
41537      const view = (0, import_element134.useMemo)(() => {
41538        return mergeActiveViewOverrides(
41539          {
41540            ...baseView,
41541            page,
41542            search
41543          },
41544          activeViewOverrides,
41545          defaultView
41546        );
41547      }, [baseView, page, search, activeViewOverrides, defaultView]);
41548      const isModified = !!persistedView;
41549      const updateView = (0, import_element134.useCallback)(
41550        (newView) => {
41551          const urlParams = {
41552            page: newView?.page,
41553            search: newView?.search
41554          };
41555          const preferenceView = stripActiveViewOverrides(
41556            omit3(newView, ["page", "search"]),
41557            activeViewOverrides,
41558            defaultView
41559          );
41560          if (onChangeQueryParams && !dequal(urlParams, { page, search })) {
41561            onChangeQueryParams(urlParams);
41562          }
41563          const comparableBaseView = stripActiveViewOverrides(
41564            baseView,
41565            activeViewOverrides,
41566            defaultView
41567          );
41568          const comparableDefaultView = stripActiveViewOverrides(
41569            defaultView,
41570            activeViewOverrides,
41571            defaultView
41572          );
41573          if (!dequal(comparableBaseView, preferenceView)) {
41574            if (dequal(preferenceView, comparableDefaultView)) {
41575              set("core/views", preferenceKey, void 0);
41576            } else {
41577              set("core/views", preferenceKey, preferenceView);
41578            }
41579          }
41580        },
41581        [
41582          onChangeQueryParams,
41583          page,
41584          search,
41585          baseView,
41586          defaultView,
41587          activeViewOverrides,
41588          set,
41589          preferenceKey
41590        ]
41591      );
41592      const resetToDefault = (0, import_element134.useCallback)(() => {
41593        set("core/views", preferenceKey, void 0);
41594      }, [preferenceKey, set]);
41595      return {
41596        view,
41597        isModified,
41598        updateView,
41599        resetToDefault
41600      };
41601    }
41602  
41603    // packages/views/build-module/load-view.mjs
41604    var import_data65 = __toESM(require_data(), 1);
41605    var import_preferences12 = __toESM(require_preferences(), 1);
41606    async function loadView(config2) {
41607      const { kind, name: name2, slug, defaultView, activeViewOverrides, queryParams } = config2;
41608      const preferenceKey = generatePreferenceKey(kind, name2, slug);
41609      const persistedView = (0, import_data65.select)(import_preferences12.store).get(
41610        "core/views",
41611        preferenceKey
41612      );
41613      const baseView = persistedView ?? defaultView;
41614      const page = queryParams?.page ?? 1;
41615      const search = queryParams?.search ?? "";
41616      return mergeActiveViewOverrides(
41617        {
41618          ...baseView,
41619          page,
41620          search
41621        },
41622        activeViewOverrides,
41623        defaultView
41624      );
41625    }
41626  
41627    // packages/edit-site/build-module/components/page-patterns/index.mjs
41628    var import_data71 = __toESM(require_data(), 1);
41629    var import_url17 = __toESM(require_url(), 1);
41630  
41631    // packages/edit-site/build-module/components/page-patterns/use-pattern-settings.mjs
41632    var import_core_data43 = __toESM(require_core_data(), 1);
41633    var import_data66 = __toESM(require_data(), 1);
41634    var import_element135 = __toESM(require_element(), 1);
41635    var import_block_editor23 = __toESM(require_block_editor(), 1);
41636    var import_editor28 = __toESM(require_editor(), 1);
41637    var { useGlobalStyles: useGlobalStyles3 } = unlock(import_editor28.privateApis);
41638    var { globalStylesDataKey } = unlock(import_block_editor23.privateApis);
41639    function usePatternSettings() {
41640      const { merged: mergedConfig } = useGlobalStyles3();
41641      const storedSettings = (0, import_data66.useSelect)((select3) => {
41642        const { getSettings: getSettings7 } = unlock(select3(store));
41643        return getSettings7();
41644      }, []);
41645      const settingsBlockPatterns = storedSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
41646      storedSettings.__experimentalBlockPatterns;
41647      const restBlockPatterns = (0, import_data66.useSelect)(
41648        (select3) => select3(import_core_data43.store).getBlockPatterns(),
41649        []
41650      );
41651      const blockPatterns = (0, import_element135.useMemo)(
41652        () => [
41653          ...settingsBlockPatterns || [],
41654          ...restBlockPatterns || []
41655        ].filter(filterOutDuplicatesByName),
41656        [settingsBlockPatterns, restBlockPatterns]
41657      );
41658      const [globalStyles, globalSettings] = (0, import_element135.useMemo)(() => {
41659        return generateGlobalStyles(mergedConfig, [], {
41660          disableRootPadding: false
41661        });
41662      }, [mergedConfig]);
41663      const settings2 = (0, import_element135.useMemo)(() => {
41664        const {
41665          __experimentalAdditionalBlockPatterns,
41666          styles,
41667          __experimentalFeatures,
41668          ...restStoredSettings
41669        } = storedSettings;
41670        const nonGlobalStyles = (styles ?? []).filter(
41671          (style) => !style.isGlobalStyles
41672        );
41673        return {
41674          ...restStoredSettings,
41675          styles: [...nonGlobalStyles, ...globalStyles],
41676          __experimentalFeatures: globalSettings,
41677          [globalStylesDataKey]: mergedConfig.styles ?? {},
41678          __experimentalBlockPatterns: blockPatterns,
41679          isPreviewMode: true
41680        };
41681      }, [
41682        storedSettings,
41683        blockPatterns,
41684        globalStyles,
41685        globalSettings,
41686        mergedConfig
41687      ]);
41688      return settings2;
41689    }
41690  
41691    // packages/edit-site/build-module/components/page-patterns/actions.mjs
41692    var import_components147 = __toESM(require_components(), 1);
41693    var import_i18n136 = __toESM(require_i18n(), 1);
41694  
41695    // packages/edit-site/build-module/components/add-new-pattern/index.mjs
41696    var import_components144 = __toESM(require_components(), 1);
41697    var import_element136 = __toESM(require_element(), 1);
41698    var import_i18n133 = __toESM(require_i18n(), 1);
41699    var import_data67 = __toESM(require_data(), 1);
41700    var import_router28 = __toESM(require_router(), 1);
41701    var import_patterns2 = __toESM(require_patterns(), 1);
41702    var import_notices5 = __toESM(require_notices(), 1);
41703    var import_core_data44 = __toESM(require_core_data(), 1);
41704    var import_editor29 = __toESM(require_editor(), 1);
41705    var import_jsx_runtime268 = __toESM(require_jsx_runtime(), 1);
41706    var { useHistory: useHistory17, useLocation: useLocation25 } = unlock(import_router28.privateApis);
41707    var { CreatePatternModal, useAddPatternCategory } = unlock(
41708      import_patterns2.privateApis
41709    );
41710    var { CreateTemplatePartModal } = unlock(import_editor29.privateApis);
41711    function AddNewPattern() {
41712      const history = useHistory17();
41713      const location = useLocation25();
41714      const [showPatternModal, setShowPatternModal] = (0, import_element136.useState)(false);
41715      const [showTemplatePartModal, setShowTemplatePartModal] = (0, import_element136.useState)(false);
41716      const { createPatternFromFile } = unlock((0, import_data67.useDispatch)(import_patterns2.store));
41717      const { createSuccessNotice, createErrorNotice } = (0, import_data67.useDispatch)(import_notices5.store);
41718      const patternUploadInputRef = (0, import_element136.useRef)();
41719      const {
41720        isBlockBasedTheme,
41721        addNewPatternLabel,
41722        addNewTemplatePartLabel,
41723        canCreatePattern,
41724        canCreateTemplatePart
41725      } = (0, import_data67.useSelect)((select3) => {
41726        const { getCurrentTheme, getPostType: getPostType2, canUser } = select3(import_core_data44.store);
41727        return {
41728          isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
41729          addNewPatternLabel: getPostType2(PATTERN_TYPES.user)?.labels?.add_new_item,
41730          addNewTemplatePartLabel: getPostType2(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item,
41731          // Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
41732          canCreatePattern: canUser("create", {
41733            kind: "postType",
41734            name: PATTERN_TYPES.user
41735          }),
41736          canCreateTemplatePart: canUser("create", {
41737            kind: "postType",
41738            name: TEMPLATE_PART_POST_TYPE
41739          })
41740        };
41741      }, []);
41742      function handleCreatePattern({ pattern }) {
41743        setShowPatternModal(false);
41744        history.navigate(
41745          `/$PATTERN_TYPES.user}/$pattern.id}?canvas=edit`
41746        );
41747      }
41748      function handleCreateTemplatePart(templatePart) {
41749        setShowTemplatePartModal(false);
41750        history.navigate(
41751          `/$TEMPLATE_PART_POST_TYPE}/$templatePart.id}?canvas=edit`
41752        );
41753      }
41754      function handleError() {
41755        setShowPatternModal(false);
41756        setShowTemplatePartModal(false);
41757      }
41758      const controls = [];
41759      if (canCreatePattern) {
41760        controls.push({
41761          icon: symbol_default,
41762          onClick: () => setShowPatternModal(true),
41763          title: addNewPatternLabel
41764        });
41765      }
41766      if (isBlockBasedTheme && canCreateTemplatePart) {
41767        controls.push({
41768          icon: symbol_filled_default,
41769          onClick: () => setShowTemplatePartModal(true),
41770          title: addNewTemplatePartLabel
41771        });
41772      }
41773      if (canCreatePattern) {
41774        controls.push({
41775          icon: upload_default,
41776          onClick: () => {
41777            patternUploadInputRef.current.click();
41778          },
41779          title: (0, import_i18n133.__)("Import pattern from JSON")
41780        });
41781      }
41782      const { categoryMap, findOrCreateTerm } = useAddPatternCategory();
41783      if (controls.length === 0) {
41784        return null;
41785      }
41786      return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
41787        addNewPatternLabel && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
41788          import_components144.DropdownMenu,
41789          {
41790            controls,
41791            icon: null,
41792            toggleProps: {
41793              variant: "primary",
41794              showTooltip: false,
41795              __next40pxDefaultSize: true
41796            },
41797            text: addNewPatternLabel,
41798            label: addNewPatternLabel
41799          }
41800        ),
41801        showPatternModal && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
41802          CreatePatternModal,
41803          {
41804            onClose: () => setShowPatternModal(false),
41805            onSuccess: handleCreatePattern,
41806            onError: handleError
41807          }
41808        ),
41809        showTemplatePartModal && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
41810          CreateTemplatePartModal,
41811          {
41812            closeModal: () => setShowTemplatePartModal(false),
41813            blocks: [],
41814            onCreate: handleCreateTemplatePart,
41815            onError: handleError
41816          }
41817        ),
41818        /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
41819          "input",
41820          {
41821            type: "file",
41822            accept: ".json",
41823            hidden: true,
41824            ref: patternUploadInputRef,
41825            onChange: async (event) => {
41826              const file = event.target.files?.[0];
41827              if (!file) {
41828                return;
41829              }
41830              try {
41831                let currentCategoryId;
41832                if (location.query.postType !== TEMPLATE_PART_POST_TYPE) {
41833                  const currentCategory = Array.from(
41834                    categoryMap.values()
41835                  ).find(
41836                    (term) => term.name === location.query.categoryId
41837                  );
41838                  if (currentCategory) {
41839                    currentCategoryId = currentCategory.id || await findOrCreateTerm(
41840                      currentCategory.label
41841                    );
41842                  }
41843                }
41844                const pattern = await createPatternFromFile(
41845                  file,
41846                  currentCategoryId ? [currentCategoryId] : void 0
41847                );
41848                if (!currentCategoryId && location.query.categoryId !== "my-patterns") {
41849                  history.navigate(
41850                    `/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}`
41851                  );
41852                }
41853                createSuccessNotice(
41854                  (0, import_i18n133.sprintf)(
41855                    // translators: %s: The imported pattern's title.
41856                    (0, import_i18n133.__)('Imported "%s" from JSON.'),
41857                    pattern.title.raw
41858                  ),
41859                  {
41860                    type: "snackbar",
41861                    id: "import-pattern-success"
41862                  }
41863                );
41864              } catch (err) {
41865                createErrorNotice(err.message, {
41866                  type: "snackbar",
41867                  id: "import-pattern-error"
41868                });
41869              } finally {
41870                event.target.value = "";
41871              }
41872            }
41873          }
41874        )
41875      ] });
41876    }
41877  
41878    // packages/edit-site/build-module/components/page-patterns/rename-category-menu-item.mjs
41879    var import_components145 = __toESM(require_components(), 1);
41880    var import_element137 = __toESM(require_element(), 1);
41881    var import_i18n134 = __toESM(require_i18n(), 1);
41882    var import_patterns3 = __toESM(require_patterns(), 1);
41883    var import_jsx_runtime269 = __toESM(require_jsx_runtime(), 1);
41884    var { RenamePatternCategoryModal } = unlock(import_patterns3.privateApis);
41885    function RenameCategoryMenuItem({ category, onClose }) {
41886      const [isModalOpen, setIsModalOpen] = (0, import_element137.useState)(false);
41887      return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
41888        /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_components145.MenuItem, { onClick: () => setIsModalOpen(true), children: (0, import_i18n134.__)("Rename") }),
41889        isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
41890          RenameModal2,
41891          {
41892            category,
41893            onClose: () => {
41894              setIsModalOpen(false);
41895              onClose();
41896            }
41897          }
41898        )
41899      ] });
41900    }
41901    function RenameModal2({ category, onClose }) {
41902      const normalizedCategory = {
41903        id: category.id,
41904        slug: category.slug,
41905        name: category.label
41906      };
41907      const existingCategories = usePatternCategories();
41908      return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
41909        RenamePatternCategoryModal,
41910        {
41911          category: normalizedCategory,
41912          existingCategories,
41913          onClose,
41914          overlayClassName: "edit-site-list__rename-modal",
41915          focusOnMount: "firstContentElement",
41916          size: "small"
41917        }
41918      );
41919    }
41920  
41921    // packages/edit-site/build-module/components/page-patterns/delete-category-menu-item.mjs
41922    var import_components146 = __toESM(require_components(), 1);
41923    var import_core_data45 = __toESM(require_core_data(), 1);
41924    var import_data68 = __toESM(require_data(), 1);
41925    var import_element138 = __toESM(require_element(), 1);
41926    var import_html_entities9 = __toESM(require_html_entities(), 1);
41927    var import_i18n135 = __toESM(require_i18n(), 1);
41928    var import_notices6 = __toESM(require_notices(), 1);
41929    var import_router29 = __toESM(require_router(), 1);
41930    var import_jsx_runtime270 = __toESM(require_jsx_runtime(), 1);
41931    var { useHistory: useHistory18 } = unlock(import_router29.privateApis);
41932    function DeleteCategoryMenuItem({ category, onClose }) {
41933      const [isModalOpen, setIsModalOpen] = (0, import_element138.useState)(false);
41934      const history = useHistory18();
41935      const { createSuccessNotice, createErrorNotice } = (0, import_data68.useDispatch)(import_notices6.store);
41936      const { deleteEntityRecord, invalidateResolution } = (0, import_data68.useDispatch)(import_core_data45.store);
41937      const onDelete = async () => {
41938        try {
41939          await deleteEntityRecord(
41940            "taxonomy",
41941            "wp_pattern_category",
41942            category.id,
41943            { force: true },
41944            { throwOnError: true }
41945          );
41946          invalidateResolution("getUserPatternCategories");
41947          invalidateResolution("getEntityRecords", [
41948            "postType",
41949            PATTERN_TYPES.user,
41950            { per_page: -1 }
41951          ]);
41952          createSuccessNotice(
41953            (0, import_i18n135.sprintf)(
41954              /* translators: %s: The pattern category's name */
41955              (0, import_i18n135._x)('"%s" deleted.', "pattern category"),
41956              category.label
41957            ),
41958            { type: "snackbar", id: "pattern-category-delete" }
41959          );
41960          onClose?.();
41961          history.navigate(
41962            `/pattern?categoryId=$PATTERN_DEFAULT_CATEGORY}`
41963          );
41964        } catch (error) {
41965          const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n135.__)(
41966            "An error occurred while deleting the pattern category."
41967          );
41968          createErrorNotice(errorMessage, {
41969            type: "snackbar",
41970            id: "pattern-category-delete"
41971          });
41972        }
41973      };
41974      return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
41975        /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_components146.MenuItem, { isDestructive: true, onClick: () => setIsModalOpen(true), children: (0, import_i18n135.__)("Delete") }),
41976        /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
41977          import_components146.__experimentalConfirmDialog,
41978          {
41979            isOpen: isModalOpen,
41980            onConfirm: onDelete,
41981            onCancel: () => setIsModalOpen(false),
41982            confirmButtonText: (0, import_i18n135.__)("Delete"),
41983            className: "edit-site-patterns__delete-modal",
41984            title: (0, import_i18n135.sprintf)(
41985              // translators: %s: The pattern category's name.
41986              (0, import_i18n135._x)('Delete "%s"?', "pattern category"),
41987              (0, import_html_entities9.decodeEntities)(category.label)
41988            ),
41989            size: "medium",
41990            __experimentalHideHeader: false,
41991            children: (0, import_i18n135.sprintf)(
41992              // translators: %s: The pattern category's name.
41993              (0, import_i18n135.__)(
41994                'Are you sure you want to delete the category "%s"? The patterns will not be deleted.'
41995              ),
41996              (0, import_html_entities9.decodeEntities)(category.label)
41997            )
41998          }
41999        )
42000      ] });
42001    }
42002  
42003    // packages/edit-site/build-module/components/page-patterns/actions.mjs
42004    var import_jsx_runtime271 = __toESM(require_jsx_runtime(), 1);
42005    function PatternsActions({ categoryId, type }) {
42006      const { patternCategories } = usePatternCategories();
42007      let patternCategory;
42008      if (type === PATTERN_TYPES.user && !!categoryId) {
42009        patternCategory = patternCategories.find(
42010          (category) => category.name === categoryId
42011        );
42012      }
42013      return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_jsx_runtime271.Fragment, { children: [
42014        /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(AddNewPattern, {}),
42015        !!patternCategory?.id && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
42016          import_components147.DropdownMenu,
42017          {
42018            icon: more_vertical_default,
42019            label: (0, import_i18n136.__)("Actions"),
42020            toggleProps: {
42021              className: "edit-site-patterns__button",
42022              size: "compact"
42023            },
42024            children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_components147.MenuGroup, { children: [
42025              /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
42026                RenameCategoryMenuItem,
42027                {
42028                  category: patternCategory,
42029                  onClose
42030                }
42031              ),
42032              /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
42033                DeleteCategoryMenuItem,
42034                {
42035                  category: patternCategory,
42036                  onClose
42037                }
42038              )
42039            ] })
42040          }
42041        )
42042      ] });
42043    }
42044  
42045    // packages/edit-site/build-module/components/dataviews-actions/index.mjs
42046    var import_i18n137 = __toESM(require_i18n(), 1);
42047    var import_element139 = __toESM(require_element(), 1);
42048    var import_router30 = __toESM(require_router(), 1);
42049    var import_data69 = __toESM(require_data(), 1);
42050    var import_core_data46 = __toESM(require_core_data(), 1);
42051    var import_url16 = __toESM(require_url(), 1);
42052    var { useLocation: useLocation26, useHistory: useHistory19 } = unlock(import_router30.privateApis);
42053    var useSetActiveTemplateAction = () => {
42054      const activeTheme = (0, import_data69.useSelect)(
42055        (select3) => select3(import_core_data46.store).getCurrentTheme()
42056      );
42057      const { getEntityRecord } = (0, import_data69.useSelect)(import_core_data46.store);
42058      const { editEntityRecord, saveEditedEntityRecord } = (0, import_data69.useDispatch)(import_core_data46.store);
42059      return (0, import_element139.useMemo)(
42060        () => ({
42061          id: "set-active-template",
42062          label(items) {
42063            return items.some((item) => item._isActive) ? (0, import_i18n137.__)("Deactivate") : (0, import_i18n137.__)("Activate");
42064          },
42065          isPrimary: true,
42066          icon: pencil_default,
42067          isEligible(item) {
42068            if (item.theme !== activeTheme.stylesheet) {
42069              return false;
42070            }
42071            if (typeof item.id !== "number") {
42072              return item._isActive === false;
42073            }
42074            return true;
42075          },
42076          async callback(items) {
42077            const deactivate = items.some((item) => item._isActive);
42078            const activeTemplates = {
42079              ...await getEntityRecord("root", "site").active_templates ?? {}
42080            };
42081            for (const item of items) {
42082              if (deactivate) {
42083                delete activeTemplates[item.slug];
42084              } else {
42085                activeTemplates[item.slug] = item.id;
42086              }
42087            }
42088            await editEntityRecord("root", "site", void 0, {
42089              active_templates: activeTemplates
42090            });
42091            await saveEditedEntityRecord("root", "site");
42092          }
42093        }),
42094        [
42095          editEntityRecord,
42096          saveEditedEntityRecord,
42097          getEntityRecord,
42098          activeTheme
42099        ]
42100      );
42101    };
42102    var useEditPostAction = () => {
42103      const history = useHistory19();
42104      return (0, import_element139.useMemo)(
42105        () => ({
42106          id: "edit-post",
42107          label: (0, import_i18n137.__)("Edit"),
42108          icon: pencil_default,
42109          isEligible(post2) {
42110            if (post2.status === "trash") {
42111              return false;
42112            }
42113            return post2.type !== PATTERN_TYPES.theme;
42114          },
42115          callback(items) {
42116            const post2 = items[0];
42117            history.navigate(`/$post2.type}/$post2.id}?canvas=edit`);
42118          }
42119        }),
42120        [history]
42121      );
42122    };
42123    var useQuickEditPostAction = () => {
42124      const history = useHistory19();
42125      const { path, query } = useLocation26();
42126      return (0, import_element139.useMemo)(
42127        () => ({
42128          id: "quick-edit",
42129          label: (0, import_i18n137.__)("Quick Edit"),
42130          icon: drawer_right_default,
42131          isPrimary: true,
42132          supportsBulk: true,
42133          isEligible(post2) {
42134            if (post2.status === "trash") {
42135              return false;
42136            }
42137            return post2.type === "page";
42138          },
42139          callback(items) {
42140            history.navigate(
42141              (0, import_url16.addQueryArgs)(path, {
42142                ...query,
42143                quickEdit: true,
42144                postId: items.map((item) => item.id).join(",")
42145              })
42146            );
42147          }
42148        }),
42149        [history, path, query]
42150      );
42151    };
42152  
42153    // packages/edit-site/build-module/components/page-patterns/fields.mjs
42154    var import_components148 = __toESM(require_components(), 1);
42155    var import_i18n138 = __toESM(require_i18n(), 1);
42156    var import_element140 = __toESM(require_element(), 1);
42157    var import_block_editor24 = __toESM(require_block_editor(), 1);
42158    var import_blocks12 = __toESM(require_blocks(), 1);
42159    var import_editor30 = __toESM(require_editor(), 1);
42160  
42161    // packages/edit-site/build-module/components/page-templates/hooks.mjs
42162    var import_core_data47 = __toESM(require_core_data(), 1);
42163    var import_data70 = __toESM(require_data(), 1);
42164    function useAddedBy(postType2, postId) {
42165      return (0, import_data70.useSelect)(
42166        (select3) => {
42167          const { getEntityRecord, getUser, getEditedEntityRecord } = select3(import_core_data47.store);
42168          const template = getEditedEntityRecord(
42169            "postType",
42170            postType2,
42171            postId
42172          );
42173          const originalSource = template?.original_source;
42174          const authorText = template?.author_text;
42175          switch (originalSource) {
42176            case "theme": {
42177              return {
42178                type: originalSource,
42179                icon: layout_default,
42180                text: authorText,
42181                isCustomized: template.source === TEMPLATE_ORIGINS.custom
42182              };
42183            }
42184            case "plugin": {
42185              return {
42186                type: originalSource,
42187                icon: plugins_default,
42188                text: authorText,
42189                isCustomized: template.source === TEMPLATE_ORIGINS.custom
42190              };
42191            }
42192            case "site": {
42193              const siteData = getEntityRecord(
42194                "root",
42195                "__unstableBase"
42196              );
42197              return {
42198                type: originalSource,
42199                icon: globe_default,
42200                imageUrl: siteData?.site_logo ? getEntityRecord(
42201                  "postType",
42202                  "attachment",
42203                  siteData.site_logo
42204                )?.source_url : void 0,
42205                text: authorText,
42206                isCustomized: false
42207              };
42208            }
42209            default: {
42210              const user = getUser(template.author);
42211              return {
42212                type: "user",
42213                icon: comment_author_avatar_default,
42214                imageUrl: user?.avatar_urls?.[48],
42215                text: authorText ?? user?.name,
42216                isCustomized: false
42217              };
42218            }
42219          }
42220        },
42221        [postType2, postId]
42222      );
42223    }
42224  
42225    // packages/edit-site/build-module/components/page-patterns/fields.mjs
42226    var import_jsx_runtime272 = __toESM(require_jsx_runtime(), 1);
42227    var { useStyle: useStyle4 } = unlock(import_editor30.privateApis);
42228    function PreviewField({ item }) {
42229      const descriptionId = (0, import_element140.useId)();
42230      const description = item.description || item?.excerpt?.raw;
42231      const isTemplatePart2 = item.type === TEMPLATE_PART_POST_TYPE;
42232      const backgroundColor = useStyle4("color.background");
42233      const blocks = (0, import_element140.useMemo)(() => {
42234        return item.blocks ?? (0, import_blocks12.parse)(item.content.raw, {
42235          __unstableSkipMigrationLogs: true
42236        });
42237      }, [item?.content?.raw, item.blocks]);
42238      const isEmpty3 = !blocks?.length;
42239      return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
42240        "div",
42241        {
42242          className: "page-patterns-preview-field",
42243          style: { backgroundColor },
42244          "aria-describedby": !!description ? descriptionId : void 0,
42245          children: [
42246            isEmpty3 && isTemplatePart2 && (0, import_i18n138.__)("Empty template part"),
42247            isEmpty3 && !isTemplatePart2 && (0, import_i18n138.__)("Empty pattern"),
42248            !isEmpty3 && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_block_editor24.BlockPreview.Async, { children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
42249              import_block_editor24.BlockPreview,
42250              {
42251                blocks,
42252                viewportWidth: item.viewportWidth
42253              }
42254            ) }),
42255            !!description && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { hidden: true, id: descriptionId, children: description })
42256          ]
42257        }
42258      );
42259    }
42260    var previewField = {
42261      label: (0, import_i18n138.__)("Preview"),
42262      id: "preview",
42263      render: PreviewField,
42264      enableSorting: false
42265    };
42266    var SYNC_FILTERS = [
42267      {
42268        value: PATTERN_SYNC_TYPES.full,
42269        label: (0, import_i18n138._x)("Synced", "pattern (singular)"),
42270        description: (0, import_i18n138.__)("Patterns that are kept in sync across the site.")
42271      },
42272      {
42273        value: PATTERN_SYNC_TYPES.unsynced,
42274        label: (0, import_i18n138._x)("Not synced", "pattern (singular)"),
42275        description: (0, import_i18n138.__)(
42276          "Patterns that can be changed freely without affecting the site."
42277        )
42278      }
42279    ];
42280    var patternStatusField = {
42281      label: (0, import_i18n138.__)("Sync status"),
42282      id: "sync-status",
42283      render: ({ item }) => {
42284        const syncStatus = "wp_pattern_sync_status" in item ? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full : PATTERN_SYNC_TYPES.unsynced;
42285        return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
42286          "span",
42287          {
42288            className: `edit-site-patterns__field-sync-status-$syncStatus}`,
42289            children: SYNC_FILTERS.find(({ value }) => value === syncStatus).label
42290          }
42291        );
42292      },
42293      elements: SYNC_FILTERS,
42294      filterBy: {
42295        operators: [OPERATOR_IS],
42296        isPrimary: true
42297      },
42298      enableSorting: false
42299    };
42300    function AuthorField({ item }) {
42301      const [isImageLoaded, setIsImageLoaded] = (0, import_element140.useState)(false);
42302      const { text, icon, imageUrl } = useAddedBy(item.type, item.id);
42303      return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(import_components148.__experimentalHStack, { alignment: "left", spacing: 0, children: [
42304        imageUrl && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
42305          "div",
42306          {
42307            className: clsx_default("page-templates-author-field__avatar", {
42308              "is-loaded": isImageLoaded
42309            }),
42310            children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
42311              "img",
42312              {
42313                onLoad: () => setIsImageLoaded(true),
42314                alt: "",
42315                src: imageUrl
42316              }
42317            )
42318          }
42319        ),
42320        !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(icon_default, { icon }) }),
42321        /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: "page-templates-author-field__name", children: text })
42322      ] });
42323    }
42324    var templatePartAuthorField = {
42325      label: (0, import_i18n138.__)("Author"),
42326      id: "author",
42327      getValue: ({ item }) => item.author_text,
42328      render: AuthorField,
42329      filterBy: {
42330        isPrimary: true
42331      }
42332    };
42333  
42334    // packages/edit-site/build-module/components/page-patterns/index.mjs
42335    var import_jsx_runtime273 = __toESM(require_jsx_runtime(), 1);
42336    var { ExperimentalBlockEditorProvider } = unlock(import_block_editor25.privateApis);
42337    var { usePostActions, patternTitleField } = unlock(import_editor31.privateApis);
42338    var { useLocation: useLocation27, useHistory: useHistory20 } = unlock(import_router31.privateApis);
42339    var EMPTY_ARRAY11 = [];
42340    var defaultLayouts = {
42341      [LAYOUT_TABLE]: {
42342        layout: {
42343          styles: {
42344            author: {
42345              width: "1%"
42346            }
42347          }
42348        }
42349      },
42350      [LAYOUT_GRID]: {
42351        layout: {
42352          badgeFields: ["sync-status"]
42353        }
42354      }
42355    };
42356    var DEFAULT_VIEW = {
42357      type: LAYOUT_GRID,
42358      perPage: 20,
42359      titleField: "title",
42360      mediaField: "preview",
42361      fields: ["sync-status"],
42362      filters: [],
42363      ...defaultLayouts[LAYOUT_GRID]
42364    };
42365    function usePagePatternsHeader(type, categoryId) {
42366      const { patternCategories } = usePatternCategories();
42367      const templatePartAreas = (0, import_data71.useSelect)(
42368        (select3) => select3(import_core_data48.store).getCurrentTheme()?.default_template_part_areas || [],
42369        []
42370      );
42371      let title, description, patternCategory;
42372      if (type === TEMPLATE_PART_POST_TYPE) {
42373        const templatePartArea = templatePartAreas.find(
42374          (area) => area.area === categoryId
42375        );
42376        title = templatePartArea?.label || (0, import_i18n139.__)("All Template Parts");
42377        description = templatePartArea?.description || (0, import_i18n139.__)("Includes every template part defined for any area.");
42378      } else if (type === PATTERN_TYPES.user && !!categoryId) {
42379        patternCategory = patternCategories.find(
42380          (category) => category.name === categoryId
42381        );
42382        title = patternCategory?.label;
42383        description = patternCategory?.description;
42384      }
42385      return { title, description };
42386    }
42387    function DataviewsPatterns() {
42388      const { path, query } = useLocation27();
42389      const { postType: postType2 = "wp_block", categoryId: categoryIdFromURL } = query;
42390      const history = useHistory20();
42391      const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;
42392      const { view, updateView, isModified, resetToDefault } = useView({
42393        kind: "postType",
42394        name: postType2,
42395        slug: "default",
42396        defaultView: DEFAULT_VIEW,
42397        queryParams: {
42398          page: query.pageNumber,
42399          search: query.search
42400        },
42401        onChangeQueryParams: (params) => {
42402          history.navigate(
42403            (0, import_url17.addQueryArgs)(path, {
42404              ...query,
42405              pageNumber: params.page,
42406              search: params.search
42407            })
42408          );
42409        }
42410      });
42411      const viewSyncStatus = view.filters?.find(
42412        ({ field }) => field === "sync-status"
42413      )?.value;
42414      const { patterns, isResolving } = use_patterns_default(postType2, categoryId, {
42415        search: view.search,
42416        syncStatus: viewSyncStatus
42417      });
42418      const { records } = (0, import_core_data48.useEntityRecords)("postType", TEMPLATE_PART_POST_TYPE, {
42419        per_page: -1
42420      });
42421      const authors = (0, import_element141.useMemo)(() => {
42422        if (!records) {
42423          return EMPTY_ARRAY11;
42424        }
42425        const authorsSet = /* @__PURE__ */ new Set();
42426        records.forEach((template) => {
42427          authorsSet.add(template.author_text);
42428        });
42429        return Array.from(authorsSet).map((author) => ({
42430          value: author,
42431          label: author
42432        }));
42433      }, [records]);
42434      const fields = (0, import_element141.useMemo)(() => {
42435        const _fields = [previewField, patternTitleField];
42436        if (postType2 === PATTERN_TYPES.user) {
42437          _fields.push(patternStatusField);
42438        } else if (postType2 === TEMPLATE_PART_POST_TYPE) {
42439          _fields.push({
42440            ...templatePartAuthorField,
42441            elements: authors
42442          });
42443        }
42444        return _fields;
42445      }, [postType2, authors]);
42446      const { data, paginationInfo } = (0, import_element141.useMemo)(() => {
42447        const viewWithoutFilters = { ...view };
42448        delete viewWithoutFilters.search;
42449        if (postType2 !== TEMPLATE_PART_POST_TYPE) {
42450          viewWithoutFilters.filters = [];
42451        }
42452        return filterSortAndPaginate(patterns, viewWithoutFilters, fields);
42453      }, [patterns, view, fields, postType2]);
42454      const dataWithPermissions = useAugmentPatternsWithPermissions(data);
42455      const templatePartActions = usePostActions({
42456        postType: TEMPLATE_PART_POST_TYPE,
42457        context: "list"
42458      });
42459      const patternActions = usePostActions({
42460        postType: PATTERN_TYPES.user,
42461        context: "list"
42462      });
42463      const editAction = useEditPostAction();
42464      const actions = (0, import_element141.useMemo)(() => {
42465        if (postType2 === TEMPLATE_PART_POST_TYPE) {
42466          return [editAction, ...templatePartActions].filter(Boolean);
42467        }
42468        return [editAction, ...patternActions].filter(Boolean);
42469      }, [editAction, postType2, templatePartActions, patternActions]);
42470      const settings2 = usePatternSettings();
42471      const { title, description } = usePagePatternsHeader(
42472        postType2,
42473        categoryId
42474      );
42475      return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(ExperimentalBlockEditorProvider, { settings: settings2, children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
42476        page_default2,
42477        {
42478          className: "edit-site-page-patterns-dataviews",
42479          title,
42480          headingLevel: 2,
42481          subTitle: description,
42482          actions: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
42483            PatternsActions,
42484            {
42485              categoryId,
42486              type: postType2
42487            }
42488          ),
42489          children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
42490            dataviews_default,
42491            {
42492              paginationInfo,
42493              fields,
42494              actions,
42495              data: dataWithPermissions || EMPTY_ARRAY11,
42496              getItemId: (item) => item.name ?? item.id,
42497              isLoading: isResolving,
42498              isItemClickable: (item) => item.type !== PATTERN_TYPES.theme,
42499              onClickItem: (item) => {
42500                history.navigate(
42501                  `/$item.type}/${[
42502                    PATTERN_TYPES.user,
42503                    TEMPLATE_PART_POST_TYPE
42504                  ].includes(item.type) ? item.id : item.name}?canvas=edit`
42505                );
42506              },
42507              view,
42508              onChangeView: updateView,
42509              defaultLayouts,
42510              onReset: isModified ? resetToDefault : false
42511            },
42512            categoryId + postType2
42513          )
42514        }
42515      ) });
42516    }
42517  
42518    // packages/edit-site/build-module/components/site-editor-routes/patterns.mjs
42519    var import_jsx_runtime274 = __toESM(require_jsx_runtime(), 1);
42520    var patternsRoute = {
42521      name: "patterns",
42522      path: "/pattern",
42523      areas: {
42524        sidebar({ siteData }) {
42525          const isBlockTheme = siteData.currentTheme?.is_block_theme;
42526          const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
42527          return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(SidebarNavigationScreenPatterns, { backPath });
42528        },
42529        content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(DataviewsPatterns, {}),
42530        mobile({ siteData, query }) {
42531          const { categoryId } = query;
42532          const isBlockTheme = siteData.currentTheme?.is_block_theme;
42533          const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
42534          return !!categoryId ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(DataviewsPatterns, {}) : /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(SidebarNavigationScreenPatterns, { backPath });
42535        }
42536      }
42537    };
42538  
42539    // packages/edit-site/build-module/components/site-editor-routes/pattern-item.mjs
42540    var import_jsx_runtime275 = __toESM(require_jsx_runtime(), 1);
42541    var patternItemRoute = {
42542      name: "pattern-item",
42543      path: "/wp_block/:postId",
42544      areas: {
42545        sidebar({ siteData }) {
42546          const isBlockTheme = siteData.currentTheme?.is_block_theme;
42547          const backPath = isBlockTheme || isClassicThemeWithStyleBookSupport(siteData) ? "/" : void 0;
42548          return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(SidebarNavigationScreenPatterns, { backPath });
42549        },
42550        mobile: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(EditSiteEditor, {}),
42551        preview: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(EditSiteEditor, {})
42552      }
42553    };
42554  
42555    // packages/edit-site/build-module/components/site-editor-routes/template-part-item.mjs
42556    var import_jsx_runtime276 = __toESM(require_jsx_runtime(), 1);
42557    var templatePartItemRoute = {
42558      name: "template-part-item",
42559      path: "/wp_template_part/*postId",
42560      areas: {
42561        sidebar: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(SidebarNavigationScreenPatterns, { backPath: "/" }),
42562        mobile: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(EditSiteEditor, {}),
42563        preview: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(EditSiteEditor, {})
42564      }
42565    };
42566  
42567    // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.mjs
42568    var import_i18n142 = __toESM(require_i18n(), 1);
42569  
42570    // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content.mjs
42571    var import_core_data49 = __toESM(require_core_data(), 1);
42572    var import_element142 = __toESM(require_element(), 1);
42573    var import_components149 = __toESM(require_components(), 1);
42574    var import_i18n140 = __toESM(require_i18n(), 1);
42575    var import_router32 = __toESM(require_router(), 1);
42576    var import_url18 = __toESM(require_url(), 1);
42577    var import_jsx_runtime277 = __toESM(require_jsx_runtime(), 1);
42578    var { useLocation: useLocation28 } = unlock(import_router32.privateApis);
42579    var EMPTY_ARRAY12 = [];
42580    function TemplateDataviewItem({ template, isActive }) {
42581      const { text, icon } = useAddedBy(template.type, template.id);
42582      return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
42583        SidebarNavigationItem,
42584        {
42585          to: (0, import_url18.addQueryArgs)("/template", { activeView: text }),
42586          icon,
42587          "aria-current": isActive,
42588          children: text
42589        }
42590      );
42591    }
42592    function DataviewsTemplatesSidebarContent() {
42593      const {
42594        query: { activeView = "active" }
42595      } = useLocation28();
42596      const { records } = (0, import_core_data49.useEntityRecords)("root", "registeredTemplate", {
42597        // This should not be needed, the endpoint returns all registered
42598        // templates, but it's not possible right now to turn off pagination for
42599        // entity configs.
42600        per_page: -1
42601      });
42602      const firstItemPerAuthorText = (0, import_element142.useMemo)(() => {
42603        const firstItemPerAuthor = records?.reduce((acc, template) => {
42604          const author = template.author_text;
42605          if (author && !acc[author]) {
42606            acc[author] = template;
42607          }
42608          return acc;
42609        }, {});
42610        return (firstItemPerAuthor && Object.values(firstItemPerAuthor)) ?? EMPTY_ARRAY12;
42611      }, [records]);
42612      return /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)(import_components149.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-templates-browse", children: [
42613        /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
42614          SidebarNavigationItem,
42615          {
42616            to: "/template",
42617            icon: published_default,
42618            "aria-current": activeView === "active",
42619            children: (0, import_i18n140.__)("Active templates")
42620          }
42621        ),
42622        /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
42623          SidebarNavigationItem,
42624          {
42625            to: (0, import_url18.addQueryArgs)("/template", { activeView: "user" }),
42626            icon: comment_author_avatar_default,
42627            "aria-current": activeView === "user",
42628            // Let's avoid calling them "custom templates" to avoid
42629            // confusion. "Created" is closest to meaning database
42630            // templates, created by users.
42631            // https://developer.wordpress.org/themes/classic-themes/templates/page-template-files/#creating-custom-page-templates-for-global-use
42632            children: (0, import_i18n140.__)("Created templates")
42633          }
42634        ),
42635        firstItemPerAuthorText.map((template) => {
42636          return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
42637            TemplateDataviewItem,
42638            {
42639              template,
42640              isActive: activeView === template.author_text
42641            },
42642            template.author_text
42643          );
42644        })
42645      ] });
42646    }
42647  
42648    // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs
42649    var import_core_data50 = __toESM(require_core_data(), 1);
42650    var import_element143 = __toESM(require_element(), 1);
42651    var import_components150 = __toESM(require_components(), 1);
42652    var import_i18n141 = __toESM(require_i18n(), 1);
42653    var import_router33 = __toESM(require_router(), 1);
42654    var import_url19 = __toESM(require_url(), 1);
42655    var import_jsx_runtime278 = __toESM(require_jsx_runtime(), 1);
42656    var { useLocation: useLocation29 } = unlock(import_router33.privateApis);
42657    var EMPTY_ARRAY13 = [];
42658    function TemplateDataviewItem2({ template, isActive }) {
42659      const { text, icon } = useAddedBy(template.type, template.id);
42660      return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
42661        SidebarNavigationItem,
42662        {
42663          to: (0, import_url19.addQueryArgs)("/template", { activeView: text }),
42664          icon,
42665          "aria-current": isActive,
42666          children: text
42667        }
42668      );
42669    }
42670    function DataviewsTemplatesSidebarContent2() {
42671      const {
42672        query: { activeView = "all" }
42673      } = useLocation29();
42674      const { records } = (0, import_core_data50.useEntityRecords)("postType", TEMPLATE_POST_TYPE, {
42675        per_page: -1
42676      });
42677      const firstItemPerAuthorText = (0, import_element143.useMemo)(() => {
42678        const firstItemPerAuthor = records?.reduce((acc, template) => {
42679          const author = template.author_text;
42680          if (author && !acc[author]) {
42681            acc[author] = template;
42682          }
42683          return acc;
42684        }, {});
42685        return (firstItemPerAuthor && Object.values(firstItemPerAuthor)) ?? EMPTY_ARRAY13;
42686      }, [records]);
42687      return /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(import_components150.__experimentalItemGroup, { className: "edit-site-sidebar-navigation-screen-templates-browse", children: [
42688        /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
42689          SidebarNavigationItem,
42690          {
42691            to: "/template",
42692            icon: layout_default,
42693            "aria-current": activeView === "all",
42694            children: (0, import_i18n141.__)("All templates")
42695          }
42696        ),
42697        firstItemPerAuthorText.map((template) => {
42698          return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
42699            TemplateDataviewItem2,
42700            {
42701              template,
42702              isActive: activeView === template.author_text
42703            },
42704            template.author_text
42705          );
42706        })
42707      ] });
42708    }
42709  
42710    // packages/edit-site/build-module/components/sidebar-navigation-screen-templates-browse/index.mjs
42711    var import_jsx_runtime279 = __toESM(require_jsx_runtime(), 1);
42712    function SidebarNavigationScreenTemplatesBrowse({ backPath }) {
42713      return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
42714        SidebarNavigationScreen,
42715        {
42716          title: (0, import_i18n142.__)("Templates"),
42717          description: (0, import_i18n142.__)(
42718            "Create new templates, or reset any customizations made to the templates supplied by your theme."
42719          ),
42720          backPath,
42721          content: window?.__experimentalTemplateActivate ? /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(DataviewsTemplatesSidebarContent, {}) : /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(DataviewsTemplatesSidebarContent2, {})
42722        }
42723      );
42724    }
42725  
42726    // packages/edit-site/build-module/components/page-templates/index.mjs
42727    var import_i18n148 = __toESM(require_i18n(), 1);
42728    var import_html_entities14 = __toESM(require_html_entities(), 1);
42729    var import_element149 = __toESM(require_element(), 1);
42730    var import_core_data55 = __toESM(require_core_data(), 1);
42731    var import_router35 = __toESM(require_router(), 1);
42732    var import_editor35 = __toESM(require_editor(), 1);
42733    var import_url22 = __toESM(require_url(), 1);
42734    var import_data75 = __toESM(require_data(), 1);
42735    var import_compose30 = __toESM(require_compose(), 1);
42736    var import_components155 = __toESM(require_components(), 1);
42737    var import_notices8 = __toESM(require_notices(), 1);
42738  
42739    // packages/edit-site/build-module/components/add-new-template/index.mjs
42740    var import_components153 = __toESM(require_components(), 1);
42741    var import_html_entities12 = __toESM(require_html_entities(), 1);
42742    var import_element147 = __toESM(require_element(), 1);
42743    var import_data73 = __toESM(require_data(), 1);
42744    var import_core_data53 = __toESM(require_core_data(), 1);
42745    var import_compose29 = __toESM(require_compose(), 1);
42746    var import_i18n146 = __toESM(require_i18n(), 1);
42747    var import_notices7 = __toESM(require_notices(), 1);
42748    var import_router34 = __toESM(require_router(), 1);
42749    var import_dom13 = __toESM(require_dom(), 1);
42750  
42751    // packages/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.mjs
42752    var import_element145 = __toESM(require_element(), 1);
42753    var import_i18n144 = __toESM(require_i18n(), 1);
42754    var import_components151 = __toESM(require_components(), 1);
42755    var import_core_data52 = __toESM(require_core_data(), 1);
42756    var import_html_entities11 = __toESM(require_html_entities(), 1);
42757    var import_compose28 = __toESM(require_compose(), 1);
42758    var import_dom12 = __toESM(require_dom(), 1);
42759    var import_url21 = __toESM(require_url(), 1);
42760  
42761    // packages/edit-site/build-module/components/add-new-template/utils.mjs
42762    var import_data72 = __toESM(require_data(), 1);
42763    var import_core_data51 = __toESM(require_core_data(), 1);
42764    var import_html_entities10 = __toESM(require_html_entities(), 1);
42765    var import_element144 = __toESM(require_element(), 1);
42766    var import_i18n143 = __toESM(require_i18n(), 1);
42767    var import_url20 = __toESM(require_url(), 1);
42768    var EMPTY_OBJECT2 = {};
42769    var getValueFromObjectPath2 = (object, path) => {
42770      let value = object;
42771      path.split(".").forEach((fieldName) => {
42772        value = value?.[fieldName];
42773      });
42774      return value;
42775    };
42776    function prefixSlug(prefix2, slug) {
42777      return `$prefix2}-${(0, import_url20.safeDecodeURI)(slug)}`;
42778    }
42779    var mapToIHasNameAndId = (entities, path) => {
42780      return (entities || []).map((entity) => ({
42781        ...entity,
42782        name: (0, import_html_entities10.decodeEntities)(getValueFromObjectPath2(entity, path))
42783      }));
42784    };
42785    var useExistingTemplates = () => {
42786      return (0, import_data72.useSelect)(
42787        (select3) => select3(import_core_data51.store).getEntityRecords(
42788          "postType",
42789          TEMPLATE_POST_TYPE,
42790          {
42791            per_page: -1
42792          }
42793        ),
42794        []
42795      );
42796    };
42797    var useDefaultTemplateTypes = () => {
42798      return (0, import_data72.useSelect)(
42799        (select3) => select3(import_core_data51.store).getCurrentTheme()?.default_template_types || [],
42800        []
42801      );
42802    };
42803    var usePublicPostTypes = () => {
42804      const postTypes = (0, import_data72.useSelect)(
42805        (select3) => select3(import_core_data51.store).getPostTypes({ per_page: -1 }),
42806        []
42807      );
42808      return (0, import_element144.useMemo)(() => {
42809        const excludedPostTypes = ["attachment"];
42810        return postTypes?.filter(
42811          ({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug)
42812        ).sort((a2, b2) => {
42813          if (a2.slug === "post" || b2.slug === "post") {
42814            return 0;
42815          }
42816          return a2.name.localeCompare(b2.name);
42817        });
42818      }, [postTypes]);
42819    };
42820    var usePublicTaxonomies = () => {
42821      const taxonomies = (0, import_data72.useSelect)(
42822        (select3) => select3(import_core_data51.store).getTaxonomies({ per_page: -1 }),
42823        []
42824      );
42825      return (0, import_element144.useMemo)(() => {
42826        return taxonomies?.filter(
42827          ({ visibility }) => visibility?.publicly_queryable
42828        );
42829      }, [taxonomies]);
42830    };
42831    function usePostTypeArchiveMenuItems() {
42832      const publicPostTypes = usePublicPostTypes();
42833      const postTypesWithArchives = (0, import_element144.useMemo)(
42834        () => publicPostTypes?.filter((postType2) => postType2.has_archive),
42835        [publicPostTypes]
42836      );
42837      const existingTemplates = useExistingTemplates();
42838      const postTypeLabels = (0, import_element144.useMemo)(
42839        () => publicPostTypes?.reduce((accumulator, { labels }) => {
42840          const singularName = labels.singular_name.toLowerCase();
42841          accumulator[singularName] = (accumulator[singularName] || 0) + 1;
42842          return accumulator;
42843        }, {}),
42844        [publicPostTypes]
42845      );
42846      const needsUniqueIdentifier = (0, import_element144.useCallback)(
42847        ({ labels, slug }) => {
42848          const singularName = labels.singular_name.toLowerCase();
42849          return postTypeLabels[singularName] > 1 && singularName !== slug;
42850        },
42851        [postTypeLabels]
42852      );
42853      return (0, import_element144.useMemo)(
42854        () => postTypesWithArchives?.filter(
42855          (postType2) => !(existingTemplates || []).some(
42856            (existingTemplate) => existingTemplate.slug === "archive-" + postType2.slug
42857          )
42858        ).map((postType2) => {
42859          let title;
42860          if (needsUniqueIdentifier(postType2)) {
42861            title = (0, import_i18n143.sprintf)(
42862              // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
42863              (0, import_i18n143.__)("Archive: %1$s (%2$s)"),
42864              postType2.labels.singular_name,
42865              postType2.slug
42866            );
42867          } else {
42868            title = (0, import_i18n143.sprintf)(
42869              // translators: %s: Name of the post type e.g: "Post".
42870              (0, import_i18n143.__)("Archive: %s"),
42871              postType2.labels.singular_name
42872            );
42873          }
42874          return {
42875            slug: "archive-" + postType2.slug,
42876            description: (0, import_i18n143.sprintf)(
42877              // translators: %s: Name of the post type e.g: "Post".
42878              (0, import_i18n143.__)(
42879                "Displays an archive with the latest posts of type: %s."
42880              ),
42881              postType2.labels.singular_name
42882            ),
42883            title,
42884            // `icon` is the `menu_icon` property of a post type. We
42885            // only handle `dashicons` for now, even if the `menu_icon`
42886            // also supports urls and svg as values.
42887            icon: typeof postType2.icon === "string" && postType2.icon.startsWith("dashicons-") ? postType2.icon.slice(10) : archive_default,
42888            templatePrefix: "archive"
42889          };
42890        }) || [],
42891        [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]
42892      );
42893    }
42894    var usePostTypeMenuItems = (onClickMenuItem) => {
42895      const publicPostTypes = usePublicPostTypes();
42896      const defaultTemplateTypes = useDefaultTemplateTypes();
42897      const templateLabels = (0, import_element144.useMemo)(
42898        () => publicPostTypes?.reduce((accumulator, { labels }) => {
42899          const templateName = (labels.template_name || labels.singular_name).toLowerCase();
42900          accumulator[templateName] = (accumulator[templateName] || 0) + 1;
42901          return accumulator;
42902        }, {}),
42903        [publicPostTypes]
42904      );
42905      const needsUniqueIdentifier = (0, import_element144.useCallback)(
42906        ({ labels, slug }) => {
42907          const templateName = (labels.template_name || labels.singular_name).toLowerCase();
42908          return templateLabels[templateName] > 1 && templateName !== slug;
42909        },
42910        [templateLabels]
42911      );
42912      const templatePrefixes = (0, import_element144.useMemo)(
42913        () => publicPostTypes?.reduce((accumulator, { slug }) => {
42914          let suffix = slug;
42915          if (slug !== "page") {
42916            suffix = `single-$suffix}`;
42917          }
42918          accumulator[slug] = suffix;
42919          return accumulator;
42920        }, {}),
42921        [publicPostTypes]
42922      );
42923      const postTypesInfo = useEntitiesInfo("postType", templatePrefixes);
42924      const menuItems = (publicPostTypes || []).reduce(
42925        (accumulator, postType2) => {
42926          const { slug, labels, icon } = postType2;
42927          const generalTemplateSlug = templatePrefixes[slug];
42928          const defaultTemplateType = defaultTemplateTypes?.find(
42929            ({ slug: _slug }) => _slug === generalTemplateSlug
42930          );
42931          const _needsUniqueIdentifier = needsUniqueIdentifier(postType2);
42932          let menuItemTitle = labels.template_name || (0, import_i18n143.sprintf)(
42933            // translators: %s: Name of the post type e.g: "Post".
42934            (0, import_i18n143.__)("Single item: %s"),
42935            labels.singular_name
42936          );
42937          if (_needsUniqueIdentifier) {
42938            menuItemTitle = labels.template_name ? (0, import_i18n143.sprintf)(
42939              // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book".
42940              (0, import_i18n143._x)("%1$s (%2$s)", "post type menu label"),
42941              labels.template_name,
42942              slug
42943            ) : (0, import_i18n143.sprintf)(
42944              // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book".
42945              (0, import_i18n143._x)(
42946                "Single item: %1$s (%2$s)",
42947                "post type menu label"
42948              ),
42949              labels.singular_name,
42950              slug
42951            );
42952          }
42953          const menuItem = defaultTemplateType ? {
42954            ...defaultTemplateType,
42955            templatePrefix: templatePrefixes[slug]
42956          } : {
42957            slug: generalTemplateSlug,
42958            title: menuItemTitle,
42959            description: (0, import_i18n143.sprintf)(
42960              // translators: %s: Name of the post type e.g: "Post".
42961              (0, import_i18n143.__)("Displays a single item: %s."),
42962              labels.singular_name
42963            ),
42964            // `icon` is the `menu_icon` property of a post type. We
42965            // only handle `dashicons` for now, even if the `menu_icon`
42966            // also supports urls and svg as values.
42967            icon: typeof icon === "string" && icon.startsWith("dashicons-") ? icon.slice(10) : post_default,
42968            templatePrefix: templatePrefixes[slug]
42969          };
42970          const hasEntities = postTypesInfo?.[slug]?.hasEntities;
42971          if (hasEntities) {
42972            menuItem.onClick = (template) => {
42973              onClickMenuItem({
42974                type: "postType",
42975                slug,
42976                config: {
42977                  recordNamePath: "title.rendered",
42978                  queryArgs: ({ search }) => {
42979                    return {
42980                      _fields: "id,title,slug,link",
42981                      orderBy: search ? "relevance" : "modified",
42982                      exclude: postTypesInfo[slug].existingEntitiesIds
42983                    };
42984                  },
42985                  getSpecificTemplate: (suggestion) => {
42986                    const templateSlug = prefixSlug(
42987                      templatePrefixes[slug],
42988                      suggestion.slug
42989                    );
42990                    return {
42991                      title: templateSlug,
42992                      slug: templateSlug,
42993                      templatePrefix: templatePrefixes[slug]
42994                    };
42995                  }
42996                },
42997                labels,
42998                template
42999              });
43000            };
43001          }
43002          if (hasEntities) {
43003            accumulator.push(menuItem);
43004          }
43005          return accumulator;
43006        },
43007        []
43008      );
43009      const postTypesMenuItems = (0, import_element144.useMemo)(
43010        () => menuItems.reduce(
43011          (accumulator, postType2) => {
43012            const { slug } = postType2;
43013            let key = "postTypesMenuItems";
43014            if (slug === "page") {
43015              key = "defaultPostTypesMenuItems";
43016            }
43017            accumulator[key].push(postType2);
43018            return accumulator;
43019          },
43020          { defaultPostTypesMenuItems: [], postTypesMenuItems: [] }
43021        ),
43022        [menuItems]
43023      );
43024      return postTypesMenuItems;
43025    };
43026    var useTaxonomiesMenuItems = (onClickMenuItem) => {
43027      const publicTaxonomies = usePublicTaxonomies();
43028      const existingTemplates = useExistingTemplates();
43029      const defaultTemplateTypes = useDefaultTemplateTypes();
43030      const templatePrefixes = (0, import_element144.useMemo)(
43031        () => publicTaxonomies?.reduce((accumulator, { slug }) => {
43032          let suffix = slug;
43033          if (!["category", "post_tag"].includes(slug)) {
43034            suffix = `taxonomy-$suffix}`;
43035          }
43036          if (slug === "post_tag") {
43037            suffix = `tag`;
43038          }
43039          accumulator[slug] = suffix;
43040          return accumulator;
43041        }, {}),
43042        [publicTaxonomies]
43043      );
43044      const taxonomyLabels = publicTaxonomies?.reduce(
43045        (accumulator, { labels }) => {
43046          const templateName = (labels.template_name || labels.singular_name).toLowerCase();
43047          accumulator[templateName] = (accumulator[templateName] || 0) + 1;
43048          return accumulator;
43049        },
43050        {}
43051      );
43052      const needsUniqueIdentifier = (labels, slug) => {
43053        if (["category", "post_tag"].includes(slug)) {
43054          return false;
43055        }
43056        const templateName = (labels.template_name || labels.singular_name).toLowerCase();
43057        return taxonomyLabels[templateName] > 1 && templateName !== slug;
43058      };
43059      const taxonomiesInfo = useEntitiesInfo("taxonomy", templatePrefixes);
43060      const existingTemplateSlugs = (existingTemplates || []).map(
43061        ({ slug }) => slug
43062      );
43063      const menuItems = (publicTaxonomies || []).reduce(
43064        (accumulator, taxonomy) => {
43065          const { slug, labels } = taxonomy;
43066          const generalTemplateSlug = templatePrefixes[slug];
43067          const defaultTemplateType = defaultTemplateTypes?.find(
43068            ({ slug: _slug }) => _slug === generalTemplateSlug
43069          );
43070          const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
43071          const _needsUniqueIdentifier = needsUniqueIdentifier(
43072            labels,
43073            slug
43074          );
43075          let menuItemTitle = labels.template_name || labels.singular_name;
43076          if (_needsUniqueIdentifier) {
43077            menuItemTitle = labels.template_name ? (0, import_i18n143.sprintf)(
43078              // translators: 1: Name of the template e.g: "Products by Category". 2: Slug of the taxonomy e.g: "product_cat".
43079              (0, import_i18n143._x)("%1$s (%2$s)", "taxonomy template menu label"),
43080              labels.template_name,
43081              slug
43082            ) : (0, import_i18n143.sprintf)(
43083              // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat".
43084              (0, import_i18n143._x)("%1$s (%2$s)", "taxonomy menu label"),
43085              labels.singular_name,
43086              slug
43087            );
43088          }
43089          const menuItem = defaultTemplateType ? {
43090            ...defaultTemplateType,
43091            templatePrefix: templatePrefixes[slug]
43092          } : {
43093            slug: generalTemplateSlug,
43094            title: menuItemTitle,
43095            description: (0, import_i18n143.sprintf)(
43096              // translators: %s: Name of the taxonomy e.g: "Product Categories".
43097              (0, import_i18n143.__)("Displays taxonomy: %s."),
43098              labels.singular_name
43099            ),
43100            icon: block_meta_default,
43101            templatePrefix: templatePrefixes[slug]
43102          };
43103          const hasEntities = taxonomiesInfo?.[slug]?.hasEntities;
43104          if (hasEntities) {
43105            menuItem.onClick = (template) => {
43106              onClickMenuItem({
43107                type: "taxonomy",
43108                slug,
43109                config: {
43110                  queryArgs: ({ search }) => {
43111                    return {
43112                      _fields: "id,name,slug,link",
43113                      orderBy: search ? "name" : "count",
43114                      exclude: taxonomiesInfo[slug].existingEntitiesIds
43115                    };
43116                  },
43117                  getSpecificTemplate: (suggestion) => {
43118                    const templateSlug = prefixSlug(
43119                      templatePrefixes[slug],
43120                      suggestion.slug
43121                    );
43122                    return {
43123                      title: templateSlug,
43124                      slug: templateSlug,
43125                      templatePrefix: templatePrefixes[slug]
43126                    };
43127                  }
43128                },
43129                labels,
43130                hasGeneralTemplate,
43131                template
43132              });
43133            };
43134          }
43135          if (!hasGeneralTemplate || hasEntities) {
43136            accumulator.push(menuItem);
43137          }
43138          return accumulator;
43139        },
43140        []
43141      );
43142      const taxonomiesMenuItems = (0, import_element144.useMemo)(
43143        () => menuItems.reduce(
43144          (accumulator, taxonomy) => {
43145            const { slug } = taxonomy;
43146            let key = "taxonomiesMenuItems";
43147            if (["category", "tag"].includes(slug)) {
43148              key = "defaultTaxonomiesMenuItems";
43149            }
43150            accumulator[key].push(taxonomy);
43151            return accumulator;
43152          },
43153          { defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }
43154        ),
43155        [menuItems]
43156      );
43157      return taxonomiesMenuItems;
43158    };
43159    var USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: "author" };
43160    var USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: "authors" } };
43161    function useAuthorMenuItem(onClickMenuItem) {
43162      const existingTemplates = useExistingTemplates();
43163      const defaultTemplateTypes = useDefaultTemplateTypes();
43164      const authorInfo = useEntitiesInfo(
43165        "root",
43166        USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,
43167        USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS
43168      );
43169      let authorMenuItem = defaultTemplateTypes?.find(
43170        ({ slug }) => slug === "author"
43171      );
43172      if (!authorMenuItem) {
43173        authorMenuItem = {
43174          description: (0, import_i18n143.__)(
43175            "Displays latest posts written by a single author."
43176          ),
43177          slug: "author",
43178          title: "Author"
43179        };
43180      }
43181      const hasGeneralTemplate = !!existingTemplates?.find(
43182        ({ slug }) => slug === "author"
43183      );
43184      if (authorInfo.user?.hasEntities) {
43185        authorMenuItem = { ...authorMenuItem, templatePrefix: "author" };
43186        authorMenuItem.onClick = (template) => {
43187          onClickMenuItem({
43188            type: "root",
43189            slug: "user",
43190            config: {
43191              queryArgs: ({ search }) => {
43192                return {
43193                  _fields: "id,name,slug,link",
43194                  orderBy: search ? "name" : "registered_date",
43195                  exclude: authorInfo.user.existingEntitiesIds,
43196                  who: "authors"
43197                };
43198              },
43199              getSpecificTemplate: (suggestion) => {
43200                const templateSlug = prefixSlug(
43201                  "author",
43202                  suggestion.slug
43203                );
43204                return {
43205                  title: (0, import_i18n143.sprintf)(
43206                    // translators: %s: Name of the author e.g: "Admin".
43207                    (0, import_i18n143.__)("Author: %s"),
43208                    suggestion.name
43209                  ),
43210                  slug: templateSlug,
43211                  templatePrefix: "author"
43212                };
43213              }
43214            },
43215            labels: {
43216              singular_name: (0, import_i18n143.__)("Author"),
43217              search_items: (0, import_i18n143.__)("Search Authors"),
43218              not_found: (0, import_i18n143.__)("No authors found."),
43219              all_items: (0, import_i18n143.__)("All Authors")
43220            },
43221            hasGeneralTemplate,
43222            template
43223          });
43224        };
43225      }
43226      if (!hasGeneralTemplate || authorInfo.user?.hasEntities) {
43227        return authorMenuItem;
43228      }
43229    }
43230    var useEntitiesInfo = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT2) => {
43231      const entitiesHasRecords = (0, import_data72.useSelect)(
43232        (select3) => {
43233          return Object.keys(templatePrefixes || {}).reduce(
43234            (accumulator, slug) => {
43235              accumulator[slug] = !!select3(
43236                import_core_data51.store
43237              ).getEntityRecords(entityName, slug, {
43238                per_page: 1,
43239                _fields: "id",
43240                context: "view",
43241                ...additionalQueryParameters[slug]
43242              })?.length;
43243              return accumulator;
43244            },
43245            {}
43246          );
43247        },
43248        [templatePrefixes, entityName, additionalQueryParameters]
43249      );
43250      const entitiesInfo = (0, import_element144.useMemo)(() => {
43251        return Object.keys(templatePrefixes || {}).reduce(
43252          (accumulator, slug) => {
43253            accumulator[slug] = {
43254              hasEntities: entitiesHasRecords[slug]
43255            };
43256            return accumulator;
43257          },
43258          {}
43259        );
43260      }, [templatePrefixes, entitiesHasRecords]);
43261      return entitiesInfo;
43262    };
43263  
43264    // packages/edit-site/build-module/components/add-new-template/add-custom-template-modal-content.mjs
43265    var import_jsx_runtime280 = __toESM(require_jsx_runtime(), 1);
43266    var EMPTY_ARRAY14 = [];
43267    function SuggestionListItem({
43268      suggestion,
43269      search,
43270      onSelect,
43271      entityForSuggestions
43272    }) {
43273      const baseCssClass = "edit-site-custom-template-modal__suggestions_list__list-item";
43274      return /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
43275        import_components151.Composite.Item,
43276        {
43277          render: /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43278            import_components151.Button,
43279            {
43280              __next40pxDefaultSize: true,
43281              role: "option",
43282              className: baseCssClass,
43283              onClick: () => onSelect(
43284                entityForSuggestions.config.getSpecificTemplate(
43285                  suggestion
43286                )
43287              )
43288            }
43289          ),
43290          children: [
43291            /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43292              import_components151.__experimentalText,
43293              {
43294                size: "body",
43295                lineHeight: 1.53846153846,
43296                weight: 500,
43297                className: `$baseCssClass}__title`,
43298                children: /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43299                  import_components151.TextHighlight,
43300                  {
43301                    text: (0, import_html_entities11.decodeEntities)(suggestion.name),
43302                    highlight: search
43303                  }
43304                )
43305              }
43306            ),
43307            suggestion.link && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43308              import_components151.__experimentalText,
43309              {
43310                size: "body",
43311                lineHeight: 1.53846153846,
43312                className: `$baseCssClass}__info`,
43313                children: (0, import_url21.safeDecodeURI)(suggestion.link)
43314              }
43315            )
43316          ]
43317        }
43318      );
43319    }
43320    function useSearchSuggestions(entityForSuggestions, search) {
43321      const { config: config2 } = entityForSuggestions;
43322      const query = (0, import_element145.useMemo)(
43323        () => ({
43324          order: "asc",
43325          context: "view",
43326          search,
43327          per_page: search ? 20 : 10,
43328          ...config2.queryArgs(search)
43329        }),
43330        [search, config2]
43331      );
43332      const { records: searchResults, hasResolved: searchHasResolved } = (0, import_core_data52.useEntityRecords)(
43333        entityForSuggestions.type,
43334        entityForSuggestions.slug,
43335        query
43336      );
43337      const [suggestions, setSuggestions] = (0, import_element145.useState)(EMPTY_ARRAY14);
43338      (0, import_element145.useEffect)(() => {
43339        if (!searchHasResolved) {
43340          return;
43341        }
43342        let newSuggestions = EMPTY_ARRAY14;
43343        if (searchResults?.length) {
43344          newSuggestions = searchResults;
43345          if (config2.recordNamePath) {
43346            newSuggestions = mapToIHasNameAndId(
43347              newSuggestions,
43348              config2.recordNamePath
43349            );
43350          }
43351        }
43352        setSuggestions(newSuggestions);
43353      }, [searchResults, searchHasResolved]);
43354      return suggestions;
43355    }
43356    function SuggestionList({ entityForSuggestions, onSelect }) {
43357      const [search, setSearch, debouncedSearch] = (0, import_compose28.useDebouncedInput)();
43358      const suggestions = useSearchSuggestions(
43359        entityForSuggestions,
43360        debouncedSearch
43361      );
43362      const { labels } = entityForSuggestions;
43363      const [showSearchControl, setShowSearchControl] = (0, import_element145.useState)(false);
43364      if (!showSearchControl && suggestions?.length > 9) {
43365        setShowSearchControl(true);
43366      }
43367      return /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(import_jsx_runtime280.Fragment, { children: [
43368        showSearchControl && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43369          import_components151.SearchControl,
43370          {
43371            onChange: setSearch,
43372            value: search,
43373            label: labels.search_items,
43374            placeholder: labels.search_items
43375          }
43376        ),
43377        !!suggestions?.length && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43378          import_components151.Composite,
43379          {
43380            orientation: "vertical",
43381            role: "listbox",
43382            className: "edit-site-custom-template-modal__suggestions_list",
43383            "aria-label": (0, import_i18n144.__)("Suggestions list"),
43384            children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43385              SuggestionListItem,
43386              {
43387                suggestion,
43388                search: debouncedSearch,
43389                onSelect,
43390                entityForSuggestions
43391              },
43392              suggestion.slug
43393            ))
43394          }
43395        ),
43396        debouncedSearch && !suggestions?.length && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43397          import_components151.__experimentalText,
43398          {
43399            as: "p",
43400            className: "edit-site-custom-template-modal__no-results",
43401            children: labels.not_found
43402          }
43403        )
43404      ] });
43405    }
43406    function AddCustomTemplateModalContent({
43407      onSelect,
43408      entityForSuggestions,
43409      onBack,
43410      containerRef
43411    }) {
43412      const [showSearchEntities, setShowSearchEntities] = (0, import_element145.useState)();
43413      (0, import_element145.useEffect)(() => {
43414        if (containerRef.current) {
43415          const [firstFocusable] = import_dom12.focus.focusable.find(
43416            containerRef.current
43417          );
43418          firstFocusable?.focus();
43419        }
43420      }, [showSearchEntities]);
43421      return /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
43422        import_components151.__experimentalVStack,
43423        {
43424          spacing: 4,
43425          className: "edit-site-custom-template-modal__contents-wrapper",
43426          alignment: "left",
43427          children: [
43428            !showSearchEntities && /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(import_jsx_runtime280.Fragment, { children: [
43429              /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(import_components151.__experimentalText, { as: "p", children: (0, import_i18n144.__)(
43430                "Select whether to create a single template for all items or a specific one."
43431              ) }),
43432              /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
43433                import_components151.Flex,
43434                {
43435                  className: "edit-site-custom-template-modal__contents",
43436                  gap: "4",
43437                  align: "initial",
43438                  children: [
43439                    /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
43440                      import_components151.FlexItem,
43441                      {
43442                        isBlock: true,
43443                        as: import_components151.Button,
43444                        onClick: () => {
43445                          const {
43446                            slug,
43447                            title,
43448                            description,
43449                            templatePrefix
43450                          } = entityForSuggestions.template;
43451                          onSelect({
43452                            slug,
43453                            title,
43454                            description,
43455                            templatePrefix
43456                          });
43457                        },
43458                        children: [
43459                          /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43460                            import_components151.__experimentalText,
43461                            {
43462                              as: "span",
43463                              weight: 500,
43464                              lineHeight: 1.53846153846,
43465                              children: entityForSuggestions.labels.all_items
43466                            }
43467                          ),
43468                          /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43469                            import_components151.__experimentalText,
43470                            {
43471                              as: "span",
43472                              lineHeight: 1.53846153846,
43473                              // 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.
43474                              children: (0, import_i18n144.__)("For all items")
43475                            }
43476                          )
43477                        ]
43478                      }
43479                    ),
43480                    /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
43481                      import_components151.FlexItem,
43482                      {
43483                        isBlock: true,
43484                        as: import_components151.Button,
43485                        onClick: () => {
43486                          setShowSearchEntities(true);
43487                        },
43488                        children: [
43489                          /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43490                            import_components151.__experimentalText,
43491                            {
43492                              as: "span",
43493                              weight: 500,
43494                              lineHeight: 1.53846153846,
43495                              children: entityForSuggestions.labels.singular_name
43496                            }
43497                          ),
43498                          /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43499                            import_components151.__experimentalText,
43500                            {
43501                              as: "span",
43502                              lineHeight: 1.53846153846,
43503                              // 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.
43504                              children: (0, import_i18n144.__)("For a specific item")
43505                            }
43506                          )
43507                        ]
43508                      }
43509                    )
43510                  ]
43511                }
43512              ),
43513              /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(import_components151.Flex, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43514                import_components151.Button,
43515                {
43516                  __next40pxDefaultSize: true,
43517                  variant: "tertiary",
43518                  onClick: onBack,
43519                  children: (0, import_i18n144.__)("Back")
43520                }
43521              ) })
43522            ] }),
43523            showSearchEntities && /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(import_jsx_runtime280.Fragment, { children: [
43524              /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(import_components151.__experimentalText, { as: "p", children: (0, import_i18n144.__)(
43525                "This template will be used only for the specific item chosen."
43526              ) }),
43527              /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43528                SuggestionList,
43529                {
43530                  entityForSuggestions,
43531                  onSelect
43532                }
43533              ),
43534              /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(import_components151.Flex, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
43535                import_components151.Button,
43536                {
43537                  __next40pxDefaultSize: true,
43538                  variant: "tertiary",
43539                  onClick: () => {
43540                    if (entityForSuggestions.hasGeneralTemplate) {
43541                      onBack();
43542                    } else {
43543                      setShowSearchEntities(false);
43544                    }
43545                  },
43546                  children: (0, import_i18n144.__)("Back")
43547                }
43548              ) })
43549            ] })
43550          ]
43551        }
43552      );
43553    }
43554    var add_custom_template_modal_content_default = AddCustomTemplateModalContent;
43555  
43556    // node_modules/tslib/tslib.es6.mjs
43557    var __assign = function() {
43558      __assign = Object.assign || function __assign2(t3) {
43559        for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
43560          s2 = arguments[i2];
43561          for (var p3 in s2) if (Object.prototype.hasOwnProperty.call(s2, p3)) t3[p3] = s2[p3];
43562        }
43563        return t3;
43564      };
43565      return __assign.apply(this, arguments);
43566    };
43567  
43568    // node_modules/lower-case/dist.es2015/index.js
43569    function lowerCase(str) {
43570      return str.toLowerCase();
43571    }
43572  
43573    // node_modules/no-case/dist.es2015/index.js
43574    var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
43575    var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
43576    function noCase(input, options) {
43577      if (options === void 0) {
43578        options = {};
43579      }
43580      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;
43581      var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
43582      var start2 = 0;
43583      var end = result.length;
43584      while (result.charAt(start2) === "\0")
43585        start2++;
43586      while (result.charAt(end - 1) === "\0")
43587        end--;
43588      return result.slice(start2, end).split("\0").map(transform).join(delimiter);
43589    }
43590    function replace(input, re, value) {
43591      if (re instanceof RegExp)
43592        return input.replace(re, value);
43593      return re.reduce(function(input2, re2) {
43594        return input2.replace(re2, value);
43595      }, input);
43596    }
43597  
43598    // node_modules/dot-case/dist.es2015/index.js
43599    function dotCase(input, options) {
43600      if (options === void 0) {
43601        options = {};
43602      }
43603      return noCase(input, __assign({ delimiter: "." }, options));
43604    }
43605  
43606    // node_modules/param-case/dist.es2015/index.js
43607    function paramCase(input, options) {
43608      if (options === void 0) {
43609        options = {};
43610      }
43611      return dotCase(input, __assign({ delimiter: "-" }, options));
43612    }
43613  
43614    // packages/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal-content.mjs
43615    var import_element146 = __toESM(require_element(), 1);
43616    var import_i18n145 = __toESM(require_i18n(), 1);
43617    var import_components152 = __toESM(require_components(), 1);
43618    var import_jsx_runtime281 = __toESM(require_jsx_runtime(), 1);
43619    function AddCustomGenericTemplateModalContent({ createTemplate, onBack }) {
43620      const [title, setTitle] = (0, import_element146.useState)("");
43621      const defaultTitle = (0, import_i18n145.__)("Custom Template");
43622      const [isBusy, setIsBusy] = (0, import_element146.useState)(false);
43623      const inputRef = (0, import_element146.useRef)();
43624      (0, import_element146.useEffect)(() => {
43625        if (inputRef.current) {
43626          inputRef.current.focus();
43627        }
43628      }, []);
43629      async function onCreateTemplate(event) {
43630        event.preventDefault();
43631        if (isBusy) {
43632          return;
43633        }
43634        setIsBusy(true);
43635        try {
43636          await createTemplate(
43637            {
43638              slug: paramCase(title || defaultTitle) || "wp-custom-template",
43639              title: title || defaultTitle
43640            },
43641            false
43642          );
43643        } finally {
43644          setIsBusy(false);
43645        }
43646      }
43647      return /* @__PURE__ */ (0, import_jsx_runtime281.jsx)("form", { onSubmit: onCreateTemplate, children: /* @__PURE__ */ (0, import_jsx_runtime281.jsxs)(import_components152.__experimentalVStack, { spacing: 6, children: [
43648        /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(
43649          import_components152.TextControl,
43650          {
43651            __next40pxDefaultSize: true,
43652            label: (0, import_i18n145.__)("Name"),
43653            value: title,
43654            onChange: setTitle,
43655            placeholder: defaultTitle,
43656            disabled: isBusy,
43657            ref: inputRef,
43658            help: (0, import_i18n145.__)(
43659              // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
43660              'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.'
43661            )
43662          }
43663        ),
43664        /* @__PURE__ */ (0, import_jsx_runtime281.jsxs)(
43665          import_components152.__experimentalHStack,
43666          {
43667            className: "edit-site-custom-generic-template__modal-actions",
43668            justify: "right",
43669            children: [
43670              /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(
43671                import_components152.Button,
43672                {
43673                  __next40pxDefaultSize: true,
43674                  variant: "tertiary",
43675                  onClick: onBack,
43676                  children: (0, import_i18n145.__)("Back")
43677                }
43678              ),
43679              /* @__PURE__ */ (0, import_jsx_runtime281.jsx)(
43680                import_components152.Button,
43681                {
43682                  __next40pxDefaultSize: true,
43683                  variant: "primary",
43684                  type: "submit",
43685                  isBusy,
43686                  "aria-disabled": isBusy,
43687                  children: (0, import_i18n145.__)("Create")
43688                }
43689              )
43690            ]
43691          }
43692        )
43693      ] }) });
43694    }
43695    var add_custom_generic_template_modal_content_default = AddCustomGenericTemplateModalContent;
43696  
43697    // packages/edit-site/build-module/components/add-new-template/index.mjs
43698    var import_jsx_runtime282 = __toESM(require_jsx_runtime(), 1);
43699    var { useHistory: useHistory21 } = unlock(import_router34.privateApis);
43700    var DEFAULT_TEMPLATE_SLUGS = [
43701      "front-page",
43702      "home",
43703      "single",
43704      "page",
43705      "index",
43706      "archive",
43707      "author",
43708      "category",
43709      "date",
43710      "tag",
43711      "search",
43712      "404"
43713    ];
43714    var TEMPLATE_ICONS = {
43715      "front-page": home_default,
43716      home: verse_default,
43717      single: pin_default,
43718      page: page_default,
43719      archive: archive_default,
43720      search: search_default,
43721      404: not_found_default,
43722      index: list_default,
43723      category: category_default,
43724      author: comment_author_avatar_default,
43725      taxonomy: block_meta_default,
43726      date: calendar_default,
43727      tag: tag_default,
43728      attachment: media_default
43729    };
43730    function TemplateListItem({
43731      title,
43732      direction,
43733      className,
43734      description,
43735      icon,
43736      onClick,
43737      children
43738    }) {
43739      return /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
43740        import_components153.Button,
43741        {
43742          __next40pxDefaultSize: true,
43743          className,
43744          onClick,
43745          label: description,
43746          showTooltip: !!description,
43747          children: /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)(
43748            import_components153.Flex,
43749            {
43750              as: "span",
43751              spacing: 2,
43752              align: "center",
43753              justify: "center",
43754              style: { width: "100%" },
43755              direction,
43756              children: [
43757                /* @__PURE__ */ (0, import_jsx_runtime282.jsx)("div", { className: "edit-site-add-new-template__template-icon", children: /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(import_components153.Icon, { icon }) }),
43758                /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)(
43759                  import_components153.__experimentalVStack,
43760                  {
43761                    className: "edit-site-add-new-template__template-name",
43762                    alignment: "center",
43763                    spacing: 0,
43764                    children: [
43765                      /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
43766                        import_components153.__experimentalText,
43767                        {
43768                          align: "center",
43769                          weight: 500,
43770                          lineHeight: 1.53846153846,
43771                          children: title
43772                        }
43773                      ),
43774                      children
43775                    ]
43776                  }
43777                )
43778              ]
43779            }
43780          )
43781        }
43782      );
43783    }
43784    var modalContentMap = {
43785      templatesList: 1,
43786      customTemplate: 2,
43787      customGenericTemplate: 3
43788    };
43789    function NewTemplateModal({ onClose }) {
43790      const [modalContent, setModalContent] = (0, import_element147.useState)(
43791        modalContentMap.templatesList
43792      );
43793      const [entityForSuggestions, setEntityForSuggestions] = (0, import_element147.useState)({});
43794      const [isSubmitting, setIsSubmitting] = (0, import_element147.useState)(false);
43795      const missingTemplates = useMissingTemplates(
43796        setEntityForSuggestions,
43797        () => setModalContent(modalContentMap.customTemplate)
43798      );
43799      const history = useHistory21();
43800      const { saveEntityRecord } = (0, import_data73.useDispatch)(import_core_data53.store);
43801      const { createErrorNotice, createSuccessNotice } = (0, import_data73.useDispatch)(import_notices7.store);
43802      const containerRef = (0, import_element147.useRef)(null);
43803      const isMobile = (0, import_compose29.useViewportMatch)("medium", "<");
43804      const homeUrl = (0, import_data73.useSelect)((select3) => {
43805        return select3(import_core_data53.store).getEntityRecord("root", "__unstableBase")?.home;
43806      }, []);
43807      const TEMPLATE_SHORT_DESCRIPTIONS = {
43808        "front-page": homeUrl,
43809        date: (0, import_i18n146.sprintf)(
43810          // translators: %s: The homepage url.
43811          (0, import_i18n146.__)("E.g. %s"),
43812          homeUrl + "/" + (/* @__PURE__ */ new Date()).getFullYear()
43813        )
43814      };
43815      (0, import_element147.useEffect)(() => {
43816        if (containerRef.current && modalContent === modalContentMap.templatesList) {
43817          const [firstFocusable] = import_dom13.focus.focusable.find(
43818            containerRef.current
43819          );
43820          firstFocusable?.focus();
43821        }
43822      }, [modalContent]);
43823      async function createTemplate(template, isWPSuggestion = true) {
43824        if (isSubmitting) {
43825          return;
43826        }
43827        setIsSubmitting(true);
43828        try {
43829          const { title, description, slug } = template;
43830          const newTemplate = await saveEntityRecord(
43831            "postType",
43832            TEMPLATE_POST_TYPE,
43833            {
43834              description,
43835              // Slugs need to be strings, so this is for template `404`
43836              slug: slug.toString(),
43837              status: "publish",
43838              title,
43839              // This adds a post meta field in template that is part of `is_custom` value calculation.
43840              meta: {
43841                is_wp_suggestion: isWPSuggestion
43842              }
43843            },
43844            { throwOnError: true }
43845          );
43846          history.navigate(
43847            `/$TEMPLATE_POST_TYPE}/$newTemplate.id}?canvas=edit`
43848          );
43849          createSuccessNotice(
43850            (0, import_i18n146.sprintf)(
43851              // translators: %s: Title of the created post or template, e.g: "Hello world".
43852              (0, import_i18n146.__)('"%s" successfully created.'),
43853              (0, import_html_entities12.decodeEntities)(newTemplate.title?.rendered || title) || (0, import_i18n146.__)("(no title)")
43854            ),
43855            {
43856              type: "snackbar"
43857            }
43858          );
43859        } catch (error) {
43860          const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n146.__)("An error occurred while creating the template.");
43861          createErrorNotice(errorMessage, {
43862            type: "snackbar"
43863          });
43864        } finally {
43865          setIsSubmitting(false);
43866        }
43867      }
43868      const onModalClose = () => {
43869        onClose();
43870        setModalContent(modalContentMap.templatesList);
43871      };
43872      let modalTitle = (0, import_i18n146.__)("Add template");
43873      if (modalContent === modalContentMap.customTemplate) {
43874        modalTitle = (0, import_i18n146.sprintf)(
43875          // translators: %s: Name of the post type e.g: "Post".
43876          (0, import_i18n146.__)("Add template: %s"),
43877          entityForSuggestions.labels.singular_name
43878        );
43879      } else if (modalContent === modalContentMap.customGenericTemplate) {
43880        modalTitle = (0, import_i18n146.__)("Create custom template");
43881      }
43882      return /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)(
43883        import_components153.Modal,
43884        {
43885          title: modalTitle,
43886          className: clsx_default("edit-site-add-new-template__modal", {
43887            "edit-site-add-new-template__modal_template_list": modalContent === modalContentMap.templatesList,
43888            "edit-site-custom-template-modal": modalContent === modalContentMap.customTemplate
43889          }),
43890          onRequestClose: onModalClose,
43891          overlayClassName: modalContent === modalContentMap.customGenericTemplate ? "edit-site-custom-generic-template__modal" : void 0,
43892          ref: containerRef,
43893          children: [
43894            modalContent === modalContentMap.templatesList && /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)(
43895              import_components153.__experimentalGrid,
43896              {
43897                columns: isMobile ? 2 : 3,
43898                gap: 4,
43899                align: "flex-start",
43900                justify: "center",
43901                className: "edit-site-add-new-template__template-list__contents",
43902                children: [
43903                  /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(import_components153.Flex, { className: "edit-site-add-new-template__template-list__prompt", children: (0, import_i18n146.__)(
43904                    "Select what the new template should apply to:"
43905                  ) }),
43906                  missingTemplates.map((template) => {
43907                    const { title, slug, onClick } = template;
43908                    return /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
43909                      TemplateListItem,
43910                      {
43911                        title,
43912                        direction: "column",
43913                        className: "edit-site-add-new-template__template-button",
43914                        description: TEMPLATE_SHORT_DESCRIPTIONS[slug],
43915                        icon: TEMPLATE_ICONS[slug] || layout_default,
43916                        onClick: () => onClick ? onClick(template) : createTemplate(template)
43917                      },
43918                      slug
43919                    );
43920                  }),
43921                  /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
43922                    TemplateListItem,
43923                    {
43924                      title: (0, import_i18n146.__)("Custom template"),
43925                      direction: "row",
43926                      className: "edit-site-add-new-template__custom-template-button",
43927                      icon: pencil_default,
43928                      onClick: () => setModalContent(
43929                        modalContentMap.customGenericTemplate
43930                      ),
43931                      children: /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
43932                        import_components153.__experimentalText,
43933                        {
43934                          lineHeight: 1.53846153846,
43935                          children: (0, import_i18n146.__)(
43936                            "A custom template can be manually applied to any post or page."
43937                          )
43938                        }
43939                      )
43940                    }
43941                  )
43942                ]
43943              }
43944            ),
43945            modalContent === modalContentMap.customTemplate && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
43946              add_custom_template_modal_content_default,
43947              {
43948                onSelect: createTemplate,
43949                entityForSuggestions,
43950                onBack: () => setModalContent(modalContentMap.templatesList),
43951                containerRef
43952              }
43953            ),
43954            modalContent === modalContentMap.customGenericTemplate && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
43955              add_custom_generic_template_modal_content_default,
43956              {
43957                createTemplate,
43958                onBack: () => setModalContent(modalContentMap.templatesList)
43959              }
43960            )
43961          ]
43962        }
43963      );
43964    }
43965    function NewTemplate() {
43966      const [showModal, setShowModal] = (0, import_element147.useState)(false);
43967      const { postType: postType2 } = (0, import_data73.useSelect)((select3) => {
43968        const { getPostType: getPostType2 } = select3(import_core_data53.store);
43969        return {
43970          postType: getPostType2(TEMPLATE_POST_TYPE)
43971        };
43972      }, []);
43973      if (!postType2) {
43974        return null;
43975      }
43976      return /* @__PURE__ */ (0, import_jsx_runtime282.jsxs)(import_jsx_runtime282.Fragment, { children: [
43977        /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(
43978          import_components153.Button,
43979          {
43980            variant: "primary",
43981            onClick: () => setShowModal(true),
43982            label: postType2.labels.add_new_item,
43983            __next40pxDefaultSize: true,
43984            children: postType2.labels.add_new_item
43985          }
43986        ),
43987        showModal && /* @__PURE__ */ (0, import_jsx_runtime282.jsx)(NewTemplateModal, { onClose: () => setShowModal(false) })
43988      ] });
43989    }
43990    function useMissingTemplates(setEntityForSuggestions, onClick) {
43991      const defaultTemplateTypes = useDefaultTemplateTypes();
43992      const missingDefaultTemplates = (defaultTemplateTypes || []).filter(
43993        (template) => DEFAULT_TEMPLATE_SLUGS.includes(template.slug)
43994      );
43995      const onClickMenuItem = (_entityForSuggestions) => {
43996        onClick?.();
43997        setEntityForSuggestions(_entityForSuggestions);
43998      };
43999      const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates];
44000      const { defaultTaxonomiesMenuItems, taxonomiesMenuItems } = useTaxonomiesMenuItems(onClickMenuItem);
44001      const { defaultPostTypesMenuItems, postTypesMenuItems } = usePostTypeMenuItems(onClickMenuItem);
44002      const authorMenuItem = useAuthorMenuItem(onClickMenuItem);
44003      [
44004        ...defaultTaxonomiesMenuItems,
44005        ...defaultPostTypesMenuItems,
44006        authorMenuItem
44007      ].forEach((menuItem) => {
44008        if (!menuItem) {
44009          return;
44010        }
44011        const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(
44012          (template) => template.slug === menuItem.slug
44013        );
44014        if (matchIndex > -1) {
44015          enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem;
44016        } else {
44017          enhancedMissingDefaultTemplateTypes.push(menuItem);
44018        }
44019      });
44020      enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => {
44021        return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug);
44022      });
44023      const missingTemplates = [
44024        ...enhancedMissingDefaultTemplateTypes,
44025        ...usePostTypeArchiveMenuItems(),
44026        ...postTypesMenuItems,
44027        ...taxonomiesMenuItems
44028      ];
44029      return missingTemplates;
44030    }
44031    var add_new_template_default = (0, import_element147.memo)(NewTemplate);
44032  
44033    // packages/edit-site/build-module/components/page-templates/fields.mjs
44034    var import_components154 = __toESM(require_components(), 1);
44035    var import_i18n147 = __toESM(require_i18n(), 1);
44036    var import_element148 = __toESM(require_element(), 1);
44037    var import_html_entities13 = __toESM(require_html_entities(), 1);
44038    var import_blocks13 = __toESM(require_blocks(), 1);
44039    var import_block_editor26 = __toESM(require_block_editor(), 1);
44040    var import_editor34 = __toESM(require_editor(), 1);
44041    var import_core_data54 = __toESM(require_core_data(), 1);
44042    var import_data74 = __toESM(require_data(), 1);
44043    var import_jsx_runtime283 = __toESM(require_jsx_runtime(), 1);
44044    var { Badge: Badge5 } = unlock(import_components154.privateApis);
44045    var { useEntityRecordsWithPermissions } = unlock(import_core_data54.privateApis);
44046    var { useStyle: useStyle5 } = unlock(import_editor34.privateApis);
44047    function useAllDefaultTemplateTypes() {
44048      const defaultTemplateTypes = useDefaultTemplateTypes();
44049      const { records: staticRecords } = useEntityRecordsWithPermissions(
44050        "root",
44051        "registeredTemplate"
44052      );
44053      return [
44054        ...defaultTemplateTypes,
44055        ...staticRecords?.filter((record) => !record.is_custom).map((record) => {
44056          return {
44057            slug: record.slug,
44058            title: record.title.rendered,
44059            description: record.description
44060          };
44061        })
44062      ];
44063    }
44064    function PreviewField2({ item }) {
44065      const settings2 = usePatternSettings();
44066      const backgroundColor = useStyle5("color.background") ?? "white";
44067      const blocks = (0, import_element148.useMemo)(() => {
44068        return (0, import_blocks13.parse)(item.content.raw);
44069      }, [item.content.raw]);
44070      const isEmpty3 = !blocks?.length;
44071      return /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(import_editor34.EditorProvider, { post: item, settings: settings2, children: /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)(
44072        "div",
44073        {
44074          className: "page-templates-preview-field",
44075          style: { backgroundColor },
44076          children: [
44077            isEmpty3 && (0, import_i18n147.__)("Empty template"),
44078            !isEmpty3 && /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(import_block_editor26.BlockPreview.Async, { children: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(import_block_editor26.BlockPreview, { blocks }) })
44079          ]
44080        }
44081      ) });
44082    }
44083    var previewField2 = {
44084      label: (0, import_i18n147.__)("Preview"),
44085      id: "preview",
44086      render: PreviewField2,
44087      enableSorting: false
44088    };
44089    var descriptionField = {
44090      label: (0, import_i18n147.__)("Description"),
44091      id: "description",
44092      render: window?.__experimentalTemplateActivate ? function RenderDescription({ item }) {
44093        const defaultTemplateTypes = useAllDefaultTemplateTypes();
44094        const defaultTemplateType = defaultTemplateTypes.find(
44095          (type) => type.slug === item.slug
44096        );
44097        return item.description ? (0, import_html_entities13.decodeEntities)(item.description) : defaultTemplateType?.description;
44098      } : ({ item }) => {
44099        return item.description && (0, import_html_entities13.decodeEntities)(item.description);
44100      },
44101      enableSorting: false,
44102      enableGlobalSearch: true
44103    };
44104    function AuthorField2({ item }) {
44105      const [isImageLoaded, setIsImageLoaded] = (0, import_element148.useState)(false);
44106      const { text, icon, imageUrl } = useAddedBy(item.type, item.id);
44107      return /* @__PURE__ */ (0, import_jsx_runtime283.jsxs)(import_components154.__experimentalHStack, { alignment: "left", spacing: 0, children: [
44108        imageUrl && /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
44109          "div",
44110          {
44111            className: clsx_default("page-templates-author-field__avatar", {
44112              "is-loaded": isImageLoaded
44113            }),
44114            children: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(
44115              "img",
44116              {
44117                onLoad: () => setIsImageLoaded(true),
44118                alt: "",
44119                src: imageUrl
44120              }
44121            )
44122          }
44123        ),
44124        !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("div", { className: "page-templates-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(import_components154.Icon, { icon }) }),
44125        /* @__PURE__ */ (0, import_jsx_runtime283.jsx)("span", { className: "page-templates-author-field__name", children: text })
44126      ] });
44127    }
44128    var authorField = {
44129      label: (0, import_i18n147.__)("Author"),
44130      id: "author",
44131      getValue: ({ item }) => item.author_text ?? item.author,
44132      render: AuthorField2
44133    };
44134    var activeField = {
44135      label: (0, import_i18n147.__)("Status"),
44136      id: "active",
44137      type: "boolean",
44138      getValue: ({ item }) => item._isActive,
44139      render: function Render({ item }) {
44140        const activeLabel = item._isCustom ? (0, import_i18n147._x)("Active when used", "template") : (0, import_i18n147._x)("Active", "template");
44141        const activeIntent = item._isCustom ? "info" : "success";
44142        const isActive = item._isActive;
44143        return /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(Badge5, { intent: isActive ? activeIntent : "default", children: isActive ? activeLabel : (0, import_i18n147._x)("Inactive", "template") });
44144      }
44145    };
44146    var useThemeField = () => {
44147      const activeTheme = (0, import_data74.useSelect)(
44148        (select3) => select3(import_core_data54.store).getCurrentTheme()
44149      );
44150      return (0, import_element148.useMemo)(
44151        () => ({
44152          label: (0, import_i18n147.__)("Compatible Theme"),
44153          id: "theme",
44154          getValue: ({ item }) => item.theme,
44155          render: function Render3({ item }) {
44156            if (item.theme === activeTheme.stylesheet) {
44157              return /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(Badge5, { intent: "success", children: item.theme });
44158            }
44159            return /* @__PURE__ */ (0, import_jsx_runtime283.jsx)(Badge5, { intent: "error", children: item.theme });
44160          }
44161        }),
44162        [activeTheme]
44163      );
44164    };
44165    var slugField = {
44166      label: (0, import_i18n147.__)("Template Type"),
44167      id: "slug",
44168      getValue: ({ item }) => item.slug,
44169      render: function Render2({ item }) {
44170        const defaultTemplateTypes = useAllDefaultTemplateTypes();
44171        const defaultTemplateType = defaultTemplateTypes.find(
44172          (type) => type.slug === item.slug
44173        );
44174        return defaultTemplateType?.title || (0, import_i18n147._x)("Custom", "template type");
44175      }
44176    };
44177  
44178    // packages/edit-site/build-module/components/page-templates/view-utils.mjs
44179    var defaultLayouts2 = {
44180      table: {
44181        showMedia: false
44182      },
44183      grid: {
44184        showMedia: true
44185      },
44186      list: {
44187        showMedia: false
44188      }
44189    };
44190    var DEFAULT_VIEW2 = {
44191      type: "grid",
44192      perPage: 20,
44193      sort: {
44194        field: "title",
44195        direction: "asc"
44196      },
44197      titleField: "title",
44198      descriptionField: "description",
44199      mediaField: "preview",
44200      fields: ["author", "active", "slug", "theme"],
44201      filters: [],
44202      ...defaultLayouts2.grid
44203    };
44204    function getActiveViewOverridesForTab(activeView) {
44205      if (activeView === "user") {
44206        return {
44207          sort: { field: "date", direction: "desc" }
44208        };
44209      }
44210      if (activeView === "active") {
44211        return {};
44212      }
44213      return {
44214        filters: [
44215          {
44216            field: "author",
44217            operator: "is",
44218            value: activeView,
44219            isLocked: true
44220          }
44221        ]
44222      };
44223    }
44224  
44225    // packages/edit-site/build-module/components/page-templates/index.mjs
44226    var import_jsx_runtime284 = __toESM(require_jsx_runtime(), 1);
44227    var { usePostActions: usePostActions2, usePostFields, templateTitleField } = unlock(import_editor35.privateApis);
44228    var { useHistory: useHistory22, useLocation: useLocation30 } = unlock(import_router35.privateApis);
44229    var { useEntityRecordsWithPermissions: useEntityRecordsWithPermissions2 } = unlock(import_core_data55.privateApis);
44230    function PageTemplates() {
44231      const { path, query } = useLocation30();
44232      const { activeView = "active", postId } = query;
44233      const [selection, setSelection] = (0, import_element149.useState)([postId]);
44234      const [selectedRegisteredTemplate, setSelectedRegisteredTemplate] = (0, import_element149.useState)(false);
44235      const defaultView = DEFAULT_VIEW2;
44236      const activeViewOverrides = (0, import_element149.useMemo)(
44237        () => getActiveViewOverridesForTab(activeView),
44238        [activeView]
44239      );
44240      const { view, updateView, isModified, resetToDefault } = useView({
44241        kind: "postType",
44242        name: TEMPLATE_POST_TYPE,
44243        slug: "default",
44244        defaultView,
44245        activeViewOverrides,
44246        queryParams: {
44247          page: query.pageNumber,
44248          search: query.search
44249        },
44250        onChangeQueryParams: (newQueryParams) => {
44251          history.navigate(
44252            (0, import_url22.addQueryArgs)(path, {
44253              ...query,
44254              pageNumber: newQueryParams.page,
44255              search: newQueryParams.search || void 0
44256            })
44257          );
44258        }
44259      });
44260      const { activeTemplatesOption, activeTheme, defaultTemplateTypes } = (0, import_data75.useSelect)((select3) => {
44261        const { getEntityRecord, getCurrentTheme } = select3(import_core_data55.store);
44262        return {
44263          activeTemplatesOption: getEntityRecord("root", "site")?.active_templates,
44264          activeTheme: getCurrentTheme(),
44265          defaultTemplateTypes: select3(import_core_data55.store).getCurrentTheme()?.default_template_types
44266        };
44267      });
44268      const { records: userRecords, isResolving: isLoadingUserRecords } = useEntityRecordsWithPermissions2("postType", TEMPLATE_POST_TYPE, {
44269        per_page: -1,
44270        combinedTemplates: false
44271      });
44272      const { records: staticRecords, isResolving: isLoadingStaticData } = useEntityRecordsWithPermissions2("root", "registeredTemplate", {
44273        // This should not be needed, the endpoint returns all registered
44274        // templates, but it's not possible right now to turn off pagination
44275        // for entity configs.
44276        per_page: -1
44277      });
44278      const activeTemplates = (0, import_element149.useMemo)(() => {
44279        const _active = [...staticRecords];
44280        if (activeTemplatesOption) {
44281          for (const activeSlug in activeTemplatesOption) {
44282            const activeId = activeTemplatesOption[activeSlug];
44283            const template = userRecords.find(
44284              (userRecord) => userRecord.id === activeId && userRecord.theme === activeTheme.stylesheet
44285            );
44286            if (template) {
44287              const index = _active.findIndex(
44288                ({ slug }) => slug === template.slug
44289              );
44290              if (index !== -1) {
44291                _active[index] = template;
44292              } else {
44293                _active.push(template);
44294              }
44295            }
44296          }
44297        }
44298        return _active;
44299      }, [userRecords, staticRecords, activeTemplatesOption, activeTheme]);
44300      let isLoadingData;
44301      if (activeView === "active") {
44302        isLoadingData = isLoadingUserRecords || isLoadingStaticData;
44303      } else if (activeView === "user") {
44304        isLoadingData = isLoadingUserRecords;
44305      } else {
44306        isLoadingData = isLoadingStaticData;
44307      }
44308      const records = (0, import_element149.useMemo)(() => {
44309        function isCustom(record) {
44310          return record.is_custom ?? // For user templates it's custom if the is_wp_suggestion meta
44311          // field is not set and the slug is not found in the default
44312          // template types.
44313          (!record.meta?.is_wp_suggestion && !defaultTemplateTypes.some(
44314            (type) => type.slug === record.slug
44315          ));
44316        }
44317        let _records;
44318        if (activeView === "active") {
44319          _records = activeTemplates.filter(
44320            (record) => !isCustom(record)
44321          );
44322        } else if (activeView === "user") {
44323          _records = userRecords;
44324        } else {
44325          _records = staticRecords;
44326        }
44327        return _records.map((record) => ({
44328          ...record,
44329          _isActive: activeTemplates.some(
44330            (template) => template.id === record.id
44331          ),
44332          _isCustom: isCustom(record)
44333        }));
44334      }, [
44335        activeTemplates,
44336        defaultTemplateTypes,
44337        userRecords,
44338        staticRecords,
44339        activeView
44340      ]);
44341      const users = (0, import_data75.useSelect)(
44342        (select3) => {
44343          const { getUser } = select3(import_core_data55.store);
44344          return records.reduce((acc, record) => {
44345            if (record.author_text) {
44346              if (!acc[record.author_text]) {
44347                acc[record.author_text] = record.author_text;
44348              }
44349            } else if (record.author) {
44350              if (!acc[record.author]) {
44351                acc[record.author] = getUser(record.author);
44352              }
44353            }
44354            return acc;
44355          }, {});
44356        },
44357        [records]
44358      );
44359      const history = useHistory22();
44360      const onChangeSelection = (0, import_element149.useCallback)(
44361        (items) => {
44362          setSelection(items);
44363          if (view?.type === "list") {
44364            history.navigate(
44365              (0, import_url22.addQueryArgs)(path, {
44366                postId: items.length === 1 ? items[0] : void 0
44367              })
44368            );
44369          }
44370        },
44371        [history, path, view?.type]
44372      );
44373      const postTypeFields = usePostFields({
44374        postType: TEMPLATE_POST_TYPE
44375      });
44376      const dateField = postTypeFields.find((field) => field.id === "date");
44377      const themeField = useThemeField();
44378      const fields = (0, import_element149.useMemo)(() => {
44379        const _fields = [
44380          previewField2,
44381          templateTitleField,
44382          descriptionField,
44383          activeField,
44384          slugField
44385        ];
44386        if (activeView === "user") {
44387          _fields.push(themeField);
44388          if (dateField) {
44389            _fields.push(dateField);
44390          }
44391        }
44392        const elements2 = [];
44393        for (const author in users) {
44394          elements2.push({
44395            value: users[author]?.id ?? author,
44396            label: users[author]?.name ?? author
44397          });
44398        }
44399        _fields.push({
44400          ...authorField,
44401          elements: elements2
44402        });
44403        return _fields;
44404      }, [users, activeView, themeField, dateField]);
44405      const { data, paginationInfo } = (0, import_element149.useMemo)(() => {
44406        return filterSortAndPaginate(records, view, fields);
44407      }, [records, view, fields]);
44408      const { createSuccessNotice } = (0, import_data75.useDispatch)(import_notices8.store);
44409      const onActionPerformed = (0, import_element149.useCallback)(
44410        (actionId, items) => {
44411          switch (actionId) {
44412            case "duplicate-post":
44413              {
44414                const newItem = items[0];
44415                const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
44416                history.navigate(`/template?activeView=user`);
44417                createSuccessNotice(
44418                  (0, import_i18n148.sprintf)(
44419                    // translators: %s: Title of the created post or template, e.g: "Hello world".
44420                    (0, import_i18n148.__)('"%s" successfully created.'),
44421                    (0, import_html_entities14.decodeEntities)(_title) || (0, import_i18n148.__)("(no title)")
44422                  ),
44423                  {
44424                    type: "snackbar",
44425                    id: "duplicate-post-action",
44426                    actions: [
44427                      {
44428                        label: (0, import_i18n148.__)("Edit"),
44429                        onClick: () => {
44430                          history.navigate(
44431                            `/$newItem.type}/$newItem.id}?canvas=edit`
44432                          );
44433                        }
44434                      }
44435                    ]
44436                  }
44437                );
44438              }
44439              break;
44440          }
44441        },
44442        [history, createSuccessNotice]
44443      );
44444      const postTypeActions = usePostActions2({
44445        postType: TEMPLATE_POST_TYPE,
44446        context: "list",
44447        onActionPerformed
44448      });
44449      const editAction = useEditPostAction();
44450      const setActiveTemplateAction = useSetActiveTemplateAction();
44451      const actions = (0, import_element149.useMemo)(
44452        () => activeView === "user" ? [setActiveTemplateAction, editAction, ...postTypeActions] : [setActiveTemplateAction, ...postTypeActions],
44453        [postTypeActions, setActiveTemplateAction, editAction, activeView]
44454      );
44455      const onChangeView = (0, import_compose30.useEvent)((newView) => {
44456        updateView(newView);
44457        if (newView.type !== view.type) {
44458          history.invalidate();
44459        }
44460      });
44461      const duplicateAction = actions.find(
44462        (action) => action.id === "duplicate-post"
44463      );
44464      return /* @__PURE__ */ (0, import_jsx_runtime284.jsxs)(
44465        page_default2,
44466        {
44467          className: "edit-site-page-templates",
44468          title: (0, import_i18n148.__)("Templates"),
44469          headingLevel: 2,
44470          actions: /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(add_new_template_default, {}),
44471          children: [
44472            /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
44473              dataviews_default,
44474              {
44475                paginationInfo,
44476                fields,
44477                actions,
44478                data,
44479                isLoading: isLoadingData,
44480                view,
44481                onChangeView,
44482                onChangeSelection,
44483                isItemClickable: () => true,
44484                onClickItem: (item) => {
44485                  if (typeof item.id === "string") {
44486                    setSelectedRegisteredTemplate(item);
44487                  } else {
44488                    history.navigate(
44489                      `/$item.type}/$item.id}?canvas=edit`
44490                    );
44491                  }
44492                },
44493                selection,
44494                defaultLayouts: defaultLayouts2,
44495                onReset: isModified ? () => {
44496                  resetToDefault();
44497                  history.invalidate();
44498                } : false
44499              },
44500              activeView
44501            ),
44502            selectedRegisteredTemplate && duplicateAction && /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
44503              import_components155.Modal,
44504              {
44505                title: (0, import_i18n148.__)("Duplicate"),
44506                onRequestClose: () => setSelectedRegisteredTemplate(),
44507                size: "small",
44508                children: /* @__PURE__ */ (0, import_jsx_runtime284.jsx)(
44509                  duplicateAction.RenderModal,
44510                  {
44511                    items: [selectedRegisteredTemplate],
44512                    closeModal: () => setSelectedRegisteredTemplate()
44513                  }
44514                )
44515              }
44516            )
44517          ]
44518        }
44519      );
44520    }
44521  
44522    // packages/edit-site/build-module/components/page-templates/index-legacy.mjs
44523    var import_i18n153 = __toESM(require_i18n(), 1);
44524    var import_element154 = __toESM(require_element(), 1);
44525    var import_core_data59 = __toESM(require_core_data(), 1);
44526    var import_router37 = __toESM(require_router(), 1);
44527    var import_editor36 = __toESM(require_editor(), 1);
44528    var import_url25 = __toESM(require_url(), 1);
44529    var import_compose33 = __toESM(require_compose(), 1);
44530  
44531    // packages/edit-site/build-module/components/add-new-template-legacy/index.mjs
44532    var import_components158 = __toESM(require_components(), 1);
44533    var import_html_entities17 = __toESM(require_html_entities(), 1);
44534    var import_element153 = __toESM(require_element(), 1);
44535    var import_data77 = __toESM(require_data(), 1);
44536    var import_core_data58 = __toESM(require_core_data(), 1);
44537    var import_compose32 = __toESM(require_compose(), 1);
44538    var import_i18n152 = __toESM(require_i18n(), 1);
44539    var import_notices9 = __toESM(require_notices(), 1);
44540    var import_router36 = __toESM(require_router(), 1);
44541    var import_dom15 = __toESM(require_dom(), 1);
44542  
44543    // packages/edit-site/build-module/components/add-new-template-legacy/add-custom-template-modal-content.mjs
44544    var import_element151 = __toESM(require_element(), 1);
44545    var import_i18n150 = __toESM(require_i18n(), 1);
44546    var import_components156 = __toESM(require_components(), 1);
44547    var import_core_data57 = __toESM(require_core_data(), 1);
44548    var import_html_entities16 = __toESM(require_html_entities(), 1);
44549    var import_compose31 = __toESM(require_compose(), 1);
44550    var import_dom14 = __toESM(require_dom(), 1);
44551    var import_url24 = __toESM(require_url(), 1);
44552  
44553    // packages/edit-site/build-module/components/add-new-template-legacy/utils.mjs
44554    var import_data76 = __toESM(require_data(), 1);
44555    var import_core_data56 = __toESM(require_core_data(), 1);
44556    var import_html_entities15 = __toESM(require_html_entities(), 1);
44557    var import_element150 = __toESM(require_element(), 1);
44558    var import_i18n149 = __toESM(require_i18n(), 1);
44559    var import_url23 = __toESM(require_url(), 1);
44560    var EMPTY_OBJECT3 = {};
44561    var getValueFromObjectPath3 = (object, path) => {
44562      let value = object;
44563      path.split(".").forEach((fieldName) => {
44564        value = value?.[fieldName];
44565      });
44566      return value;
44567    };
44568    function prefixSlug2(prefix2, slug) {
44569      return `$prefix2}-${(0, import_url23.safeDecodeURI)(slug)}`;
44570    }
44571    var mapToIHasNameAndId2 = (entities, path) => {
44572      return (entities || []).map((entity) => ({
44573        ...entity,
44574        name: (0, import_html_entities15.decodeEntities)(getValueFromObjectPath3(entity, path))
44575      }));
44576    };
44577    var useExistingTemplates2 = () => {
44578      return (0, import_data76.useSelect)(
44579        (select3) => select3(import_core_data56.store).getEntityRecords(
44580          "postType",
44581          TEMPLATE_POST_TYPE,
44582          {
44583            per_page: -1
44584          }
44585        ),
44586        []
44587      );
44588    };
44589    var useDefaultTemplateTypes2 = () => {
44590      return (0, import_data76.useSelect)(
44591        (select3) => select3(import_core_data56.store).getCurrentTheme()?.default_template_types || [],
44592        []
44593      );
44594    };
44595    var usePublicPostTypes2 = () => {
44596      const postTypes = (0, import_data76.useSelect)(
44597        (select3) => select3(import_core_data56.store).getPostTypes({ per_page: -1 }),
44598        []
44599      );
44600      return (0, import_element150.useMemo)(() => {
44601        const excludedPostTypes = ["attachment"];
44602        return postTypes?.filter(
44603          ({ viewable, slug }) => viewable && !excludedPostTypes.includes(slug)
44604        ).sort((a2, b2) => {
44605          if (a2.slug === "post" || b2.slug === "post") {
44606            return 0;
44607          }
44608          return a2.name.localeCompare(b2.name);
44609        });
44610      }, [postTypes]);
44611    };
44612    var usePublicTaxonomies2 = () => {
44613      const taxonomies = (0, import_data76.useSelect)(
44614        (select3) => select3(import_core_data56.store).getTaxonomies({ per_page: -1 }),
44615        []
44616      );
44617      return (0, import_element150.useMemo)(() => {
44618        return taxonomies?.filter(
44619          ({ visibility }) => visibility?.publicly_queryable
44620        );
44621      }, [taxonomies]);
44622    };
44623    function usePostTypeArchiveMenuItems2() {
44624      const publicPostTypes = usePublicPostTypes2();
44625      const postTypesWithArchives = (0, import_element150.useMemo)(
44626        () => publicPostTypes?.filter((postType2) => postType2.has_archive),
44627        [publicPostTypes]
44628      );
44629      const existingTemplates = useExistingTemplates2();
44630      const postTypeLabels = (0, import_element150.useMemo)(
44631        () => publicPostTypes?.reduce((accumulator, { labels }) => {
44632          const singularName = labels.singular_name.toLowerCase();
44633          accumulator[singularName] = (accumulator[singularName] || 0) + 1;
44634          return accumulator;
44635        }, {}),
44636        [publicPostTypes]
44637      );
44638      const needsUniqueIdentifier = (0, import_element150.useCallback)(
44639        ({ labels, slug }) => {
44640          const singularName = labels.singular_name.toLowerCase();
44641          return postTypeLabels[singularName] > 1 && singularName !== slug;
44642        },
44643        [postTypeLabels]
44644      );
44645      return (0, import_element150.useMemo)(
44646        () => postTypesWithArchives?.filter(
44647          (postType2) => !(existingTemplates || []).some(
44648            (existingTemplate) => existingTemplate.slug === "archive-" + postType2.slug
44649          )
44650        ).map((postType2) => {
44651          let title;
44652          if (needsUniqueIdentifier(postType2)) {
44653            title = (0, import_i18n149.sprintf)(
44654              // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
44655              (0, import_i18n149.__)("Archive: %1$s (%2$s)"),
44656              postType2.labels.singular_name,
44657              postType2.slug
44658            );
44659          } else {
44660            title = (0, import_i18n149.sprintf)(
44661              // translators: %s: Name of the post type e.g: "Post".
44662              (0, import_i18n149.__)("Archive: %s"),
44663              postType2.labels.singular_name
44664            );
44665          }
44666          return {
44667            slug: "archive-" + postType2.slug,
44668            description: (0, import_i18n149.sprintf)(
44669              // translators: %s: Name of the post type e.g: "Post".
44670              (0, import_i18n149.__)(
44671                "Displays an archive with the latest posts of type: %s."
44672              ),
44673              postType2.labels.singular_name
44674            ),
44675            title,
44676            // `icon` is the `menu_icon` property of a post type. We
44677            // only handle `dashicons` for now, even if the `menu_icon`
44678            // also supports urls and svg as values.
44679            icon: typeof postType2.icon === "string" && postType2.icon.startsWith("dashicons-") ? postType2.icon.slice(10) : archive_default,
44680            templatePrefix: "archive"
44681          };
44682        }) || [],
44683        [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]
44684      );
44685    }
44686    var usePostTypeMenuItems2 = (onClickMenuItem) => {
44687      const publicPostTypes = usePublicPostTypes2();
44688      const existingTemplates = useExistingTemplates2();
44689      const defaultTemplateTypes = useDefaultTemplateTypes2();
44690      const templateLabels = (0, import_element150.useMemo)(
44691        () => publicPostTypes?.reduce((accumulator, { labels }) => {
44692          const templateName = (labels.template_name || labels.singular_name).toLowerCase();
44693          accumulator[templateName] = (accumulator[templateName] || 0) + 1;
44694          return accumulator;
44695        }, {}),
44696        [publicPostTypes]
44697      );
44698      const needsUniqueIdentifier = (0, import_element150.useCallback)(
44699        ({ labels, slug }) => {
44700          const templateName = (labels.template_name || labels.singular_name).toLowerCase();
44701          return templateLabels[templateName] > 1 && templateName !== slug;
44702        },
44703        [templateLabels]
44704      );
44705      const templatePrefixes = (0, import_element150.useMemo)(
44706        () => publicPostTypes?.reduce((accumulator, { slug }) => {
44707          let suffix = slug;
44708          if (slug !== "page") {
44709            suffix = `single-$suffix}`;
44710          }
44711          accumulator[slug] = suffix;
44712          return accumulator;
44713        }, {}),
44714        [publicPostTypes]
44715      );
44716      const postTypesInfo = useEntitiesInfo2("postType", templatePrefixes);
44717      const existingTemplateSlugs = (existingTemplates || []).map(
44718        ({ slug }) => slug
44719      );
44720      const menuItems = (publicPostTypes || []).reduce(
44721        (accumulator, postType2) => {
44722          const { slug, labels, icon } = postType2;
44723          const generalTemplateSlug = templatePrefixes[slug];
44724          const defaultTemplateType = defaultTemplateTypes?.find(
44725            ({ slug: _slug }) => _slug === generalTemplateSlug
44726          );
44727          const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
44728          const _needsUniqueIdentifier = needsUniqueIdentifier(postType2);
44729          let menuItemTitle = labels.template_name || (0, import_i18n149.sprintf)(
44730            // translators: %s: Name of the post type e.g: "Post".
44731            (0, import_i18n149.__)("Single item: %s"),
44732            labels.singular_name
44733          );
44734          if (_needsUniqueIdentifier) {
44735            menuItemTitle = labels.template_name ? (0, import_i18n149.sprintf)(
44736              // translators: 1: Name of the template e.g: "Single Item: Post". 2: Slug of the post type e.g: "book".
44737              (0, import_i18n149._x)("%1$s (%2$s)", "post type menu label"),
44738              labels.template_name,
44739              slug
44740            ) : (0, import_i18n149.sprintf)(
44741              // translators: 1: Name of the post type e.g: "Post". 2: Slug of the post type e.g: "book".
44742              (0, import_i18n149._x)(
44743                "Single item: %1$s (%2$s)",
44744                "post type menu label"
44745              ),
44746              labels.singular_name,
44747              slug
44748            );
44749          }
44750          const menuItem = defaultTemplateType ? {
44751            ...defaultTemplateType,
44752            templatePrefix: templatePrefixes[slug]
44753          } : {
44754            slug: generalTemplateSlug,
44755            title: menuItemTitle,
44756            description: (0, import_i18n149.sprintf)(
44757              // translators: %s: Name of the post type e.g: "Post".
44758              (0, import_i18n149.__)("Displays a single item: %s."),
44759              labels.singular_name
44760            ),
44761            // `icon` is the `menu_icon` property of a post type. We
44762            // only handle `dashicons` for now, even if the `menu_icon`
44763            // also supports urls and svg as values.
44764            icon: typeof icon === "string" && icon.startsWith("dashicons-") ? icon.slice(10) : post_default,
44765            templatePrefix: templatePrefixes[slug]
44766          };
44767          const hasEntities = postTypesInfo?.[slug]?.hasEntities;
44768          if (hasEntities) {
44769            menuItem.onClick = (template) => {
44770              onClickMenuItem({
44771                type: "postType",
44772                slug,
44773                config: {
44774                  recordNamePath: "title.rendered",
44775                  queryArgs: ({ search }) => {
44776                    return {
44777                      _fields: "id,title,slug,link",
44778                      orderBy: search ? "relevance" : "modified",
44779                      exclude: postTypesInfo[slug].existingEntitiesIds
44780                    };
44781                  },
44782                  getSpecificTemplate: (suggestion) => {
44783                    const templateSlug = prefixSlug2(
44784                      templatePrefixes[slug],
44785                      suggestion.slug
44786                    );
44787                    return {
44788                      title: templateSlug,
44789                      slug: templateSlug,
44790                      templatePrefix: templatePrefixes[slug]
44791                    };
44792                  }
44793                },
44794                labels,
44795                hasGeneralTemplate,
44796                template
44797              });
44798            };
44799          }
44800          if (!hasGeneralTemplate || hasEntities) {
44801            accumulator.push(menuItem);
44802          }
44803          return accumulator;
44804        },
44805        []
44806      );
44807      const postTypesMenuItems = (0, import_element150.useMemo)(
44808        () => menuItems.reduce(
44809          (accumulator, postType2) => {
44810            const { slug } = postType2;
44811            let key = "postTypesMenuItems";
44812            if (slug === "page") {
44813              key = "defaultPostTypesMenuItems";
44814            }
44815            accumulator[key].push(postType2);
44816            return accumulator;
44817          },
44818          { defaultPostTypesMenuItems: [], postTypesMenuItems: [] }
44819        ),
44820        [menuItems]
44821      );
44822      return postTypesMenuItems;
44823    };
44824    var useTaxonomiesMenuItems2 = (onClickMenuItem) => {
44825      const publicTaxonomies = usePublicTaxonomies2();
44826      const existingTemplates = useExistingTemplates2();
44827      const defaultTemplateTypes = useDefaultTemplateTypes2();
44828      const templatePrefixes = (0, import_element150.useMemo)(
44829        () => publicTaxonomies?.reduce((accumulator, { slug }) => {
44830          let suffix = slug;
44831          if (!["category", "post_tag"].includes(slug)) {
44832            suffix = `taxonomy-$suffix}`;
44833          }
44834          if (slug === "post_tag") {
44835            suffix = `tag`;
44836          }
44837          accumulator[slug] = suffix;
44838          return accumulator;
44839        }, {}),
44840        [publicTaxonomies]
44841      );
44842      const taxonomyLabels = publicTaxonomies?.reduce(
44843        (accumulator, { labels }) => {
44844          const templateName = (labels.template_name || labels.singular_name).toLowerCase();
44845          accumulator[templateName] = (accumulator[templateName] || 0) + 1;
44846          return accumulator;
44847        },
44848        {}
44849      );
44850      const needsUniqueIdentifier = (labels, slug) => {
44851        if (["category", "post_tag"].includes(slug)) {
44852          return false;
44853        }
44854        const templateName = (labels.template_name || labels.singular_name).toLowerCase();
44855        return taxonomyLabels[templateName] > 1 && templateName !== slug;
44856      };
44857      const taxonomiesInfo = useEntitiesInfo2("taxonomy", templatePrefixes);
44858      const existingTemplateSlugs = (existingTemplates || []).map(
44859        ({ slug }) => slug
44860      );
44861      const menuItems = (publicTaxonomies || []).reduce(
44862        (accumulator, taxonomy) => {
44863          const { slug, labels } = taxonomy;
44864          const generalTemplateSlug = templatePrefixes[slug];
44865          const defaultTemplateType = defaultTemplateTypes?.find(
44866            ({ slug: _slug }) => _slug === generalTemplateSlug
44867          );
44868          const hasGeneralTemplate = existingTemplateSlugs?.includes(generalTemplateSlug);
44869          const _needsUniqueIdentifier = needsUniqueIdentifier(
44870            labels,
44871            slug
44872          );
44873          let menuItemTitle = labels.template_name || labels.singular_name;
44874          if (_needsUniqueIdentifier) {
44875            menuItemTitle = labels.template_name ? (0, import_i18n149.sprintf)(
44876              // translators: 1: Name of the template e.g: "Products by Category". 2: Slug of the taxonomy e.g: "product_cat".
44877              (0, import_i18n149._x)("%1$s (%2$s)", "taxonomy template menu label"),
44878              labels.template_name,
44879              slug
44880            ) : (0, import_i18n149.sprintf)(
44881              // translators: 1: Name of the taxonomy e.g: "Category". 2: Slug of the taxonomy e.g: "product_cat".
44882              (0, import_i18n149._x)("%1$s (%2$s)", "taxonomy menu label"),
44883              labels.singular_name,
44884              slug
44885            );
44886          }
44887          const menuItem = defaultTemplateType ? {
44888            ...defaultTemplateType,
44889            templatePrefix: templatePrefixes[slug]
44890          } : {
44891            slug: generalTemplateSlug,
44892            title: menuItemTitle,
44893            description: (0, import_i18n149.sprintf)(
44894              // translators: %s: Name of the taxonomy e.g: "Product Categories".
44895              (0, import_i18n149.__)("Displays taxonomy: %s."),
44896              labels.singular_name
44897            ),
44898            icon: block_meta_default,
44899            templatePrefix: templatePrefixes[slug]
44900          };
44901          const hasEntities = taxonomiesInfo?.[slug]?.hasEntities;
44902          if (hasEntities) {
44903            menuItem.onClick = (template) => {
44904              onClickMenuItem({
44905                type: "taxonomy",
44906                slug,
44907                config: {
44908                  queryArgs: ({ search }) => {
44909                    return {
44910                      _fields: "id,name,slug,link",
44911                      orderBy: search ? "name" : "count",
44912                      exclude: taxonomiesInfo[slug].existingEntitiesIds
44913                    };
44914                  },
44915                  getSpecificTemplate: (suggestion) => {
44916                    const templateSlug = prefixSlug2(
44917                      templatePrefixes[slug],
44918                      suggestion.slug
44919                    );
44920                    return {
44921                      title: templateSlug,
44922                      slug: templateSlug,
44923                      templatePrefix: templatePrefixes[slug]
44924                    };
44925                  }
44926                },
44927                labels,
44928                hasGeneralTemplate,
44929                template
44930              });
44931            };
44932          }
44933          if (!hasGeneralTemplate || hasEntities) {
44934            accumulator.push(menuItem);
44935          }
44936          return accumulator;
44937        },
44938        []
44939      );
44940      const taxonomiesMenuItems = (0, import_element150.useMemo)(
44941        () => menuItems.reduce(
44942          (accumulator, taxonomy) => {
44943            const { slug } = taxonomy;
44944            let key = "taxonomiesMenuItems";
44945            if (["category", "tag"].includes(slug)) {
44946              key = "defaultTaxonomiesMenuItems";
44947            }
44948            accumulator[key].push(taxonomy);
44949            return accumulator;
44950          },
44951          { defaultTaxonomiesMenuItems: [], taxonomiesMenuItems: [] }
44952        ),
44953        [menuItems]
44954      );
44955      return taxonomiesMenuItems;
44956    };
44957    var USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX2 = { user: "author" };
44958    var USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS2 = { user: { who: "authors" } };
44959    function useAuthorMenuItem2(onClickMenuItem) {
44960      const existingTemplates = useExistingTemplates2();
44961      const defaultTemplateTypes = useDefaultTemplateTypes2();
44962      const authorInfo = useEntitiesInfo2(
44963        "root",
44964        USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX2,
44965        USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS2
44966      );
44967      let authorMenuItem = defaultTemplateTypes?.find(
44968        ({ slug }) => slug === "author"
44969      );
44970      if (!authorMenuItem) {
44971        authorMenuItem = {
44972          description: (0, import_i18n149.__)(
44973            "Displays latest posts written by a single author."
44974          ),
44975          slug: "author",
44976          title: "Author"
44977        };
44978      }
44979      const hasGeneralTemplate = !!existingTemplates?.find(
44980        ({ slug }) => slug === "author"
44981      );
44982      if (authorInfo.user?.hasEntities) {
44983        authorMenuItem = { ...authorMenuItem, templatePrefix: "author" };
44984        authorMenuItem.onClick = (template) => {
44985          onClickMenuItem({
44986            type: "root",
44987            slug: "user",
44988            config: {
44989              queryArgs: ({ search }) => {
44990                return {
44991                  _fields: "id,name,slug,link",
44992                  orderBy: search ? "name" : "registered_date",
44993                  exclude: authorInfo.user.existingEntitiesIds,
44994                  who: "authors"
44995                };
44996              },
44997              getSpecificTemplate: (suggestion) => {
44998                const templateSlug = prefixSlug2(
44999                  "author",
45000                  suggestion.slug
45001                );
45002                return {
45003                  title: templateSlug,
45004                  slug: templateSlug,
45005                  templatePrefix: "author"
45006                };
45007              }
45008            },
45009            labels: {
45010              singular_name: (0, import_i18n149.__)("Author"),
45011              search_items: (0, import_i18n149.__)("Search Authors"),
45012              not_found: (0, import_i18n149.__)("No authors found."),
45013              all_items: (0, import_i18n149.__)("All Authors")
45014            },
45015            hasGeneralTemplate,
45016            template
45017          });
45018        };
45019      }
45020      if (!hasGeneralTemplate || authorInfo.user?.hasEntities) {
45021        return authorMenuItem;
45022      }
45023    }
45024    var useExistingTemplateSlugs = (templatePrefixes) => {
45025      const existingTemplates = useExistingTemplates2();
45026      const existingSlugs = (0, import_element150.useMemo)(() => {
45027        return Object.entries(templatePrefixes || {}).reduce(
45028          (accumulator, [slug, prefix2]) => {
45029            const slugsWithTemplates = (existingTemplates || []).reduce(
45030              (_accumulator, existingTemplate) => {
45031                const _prefix = `$prefix2}-`;
45032                if (existingTemplate.slug.startsWith(_prefix)) {
45033                  _accumulator.push(
45034                    existingTemplate.slug.substring(
45035                      _prefix.length
45036                    )
45037                  );
45038                }
45039                return _accumulator;
45040              },
45041              []
45042            );
45043            if (slugsWithTemplates.length) {
45044              accumulator[slug] = slugsWithTemplates;
45045            }
45046            return accumulator;
45047          },
45048          {}
45049        );
45050      }, [templatePrefixes, existingTemplates]);
45051      return existingSlugs;
45052    };
45053    var useTemplatesToExclude = (entityName, templatePrefixes, additionalQueryParameters = {}) => {
45054      const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes);
45055      const recordsToExcludePerEntity = (0, import_data76.useSelect)(
45056        (select3) => {
45057          return Object.entries(slugsToExcludePerEntity || {}).reduce(
45058            (accumulator, [slug, slugsWithTemplates]) => {
45059              const entitiesWithTemplates = select3(
45060                import_core_data56.store
45061              ).getEntityRecords(entityName, slug, {
45062                _fields: "id",
45063                context: "view",
45064                slug: slugsWithTemplates,
45065                ...additionalQueryParameters[slug]
45066              });
45067              if (entitiesWithTemplates?.length) {
45068                accumulator[slug] = entitiesWithTemplates;
45069              }
45070              return accumulator;
45071            },
45072            {}
45073          );
45074        },
45075        [slugsToExcludePerEntity]
45076      );
45077      return recordsToExcludePerEntity;
45078    };
45079    var useEntitiesInfo2 = (entityName, templatePrefixes, additionalQueryParameters = EMPTY_OBJECT3) => {
45080      const recordsToExcludePerEntity = useTemplatesToExclude(
45081        entityName,
45082        templatePrefixes,
45083        additionalQueryParameters
45084      );
45085      const entitiesHasRecords = (0, import_data76.useSelect)(
45086        (select3) => {
45087          return Object.keys(templatePrefixes || {}).reduce(
45088            (accumulator, slug) => {
45089              const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(
45090                ({ id }) => id
45091              ) || [];
45092              accumulator[slug] = !!select3(
45093                import_core_data56.store
45094              ).getEntityRecords(entityName, slug, {
45095                per_page: 1,
45096                _fields: "id",
45097                context: "view",
45098                exclude: existingEntitiesIds,
45099                ...additionalQueryParameters[slug]
45100              })?.length;
45101              return accumulator;
45102            },
45103            {}
45104          );
45105        },
45106        [
45107          templatePrefixes,
45108          recordsToExcludePerEntity,
45109          entityName,
45110          additionalQueryParameters
45111        ]
45112      );
45113      const entitiesInfo = (0, import_element150.useMemo)(() => {
45114        return Object.keys(templatePrefixes || {}).reduce(
45115          (accumulator, slug) => {
45116            const existingEntitiesIds = recordsToExcludePerEntity?.[slug]?.map(
45117              ({ id }) => id
45118            ) || [];
45119            accumulator[slug] = {
45120              hasEntities: entitiesHasRecords[slug],
45121              existingEntitiesIds
45122            };
45123            return accumulator;
45124          },
45125          {}
45126        );
45127      }, [templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords]);
45128      return entitiesInfo;
45129    };
45130  
45131    // packages/edit-site/build-module/components/add-new-template-legacy/add-custom-template-modal-content.mjs
45132    var import_jsx_runtime285 = __toESM(require_jsx_runtime(), 1);
45133    var EMPTY_ARRAY15 = [];
45134    function SuggestionListItem2({
45135      suggestion,
45136      search,
45137      onSelect,
45138      entityForSuggestions
45139    }) {
45140      const baseCssClass = "edit-site-custom-template-modal__suggestions_list__list-item";
45141      return /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)(
45142        import_components156.Composite.Item,
45143        {
45144          render: /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45145            import_components156.Button,
45146            {
45147              __next40pxDefaultSize: true,
45148              role: "option",
45149              className: baseCssClass,
45150              onClick: () => onSelect(
45151                entityForSuggestions.config.getSpecificTemplate(
45152                  suggestion
45153                )
45154              )
45155            }
45156          ),
45157          children: [
45158            /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45159              import_components156.__experimentalText,
45160              {
45161                size: "body",
45162                lineHeight: 1.53846153846,
45163                weight: 500,
45164                className: `$baseCssClass}__title`,
45165                children: /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45166                  import_components156.TextHighlight,
45167                  {
45168                    text: (0, import_html_entities16.decodeEntities)(suggestion.name),
45169                    highlight: search
45170                  }
45171                )
45172              }
45173            ),
45174            suggestion.link && /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45175              import_components156.__experimentalText,
45176              {
45177                size: "body",
45178                lineHeight: 1.53846153846,
45179                className: `$baseCssClass}__info`,
45180                children: (0, import_url24.safeDecodeURI)(suggestion.link)
45181              }
45182            )
45183          ]
45184        }
45185      );
45186    }
45187    function useSearchSuggestions2(entityForSuggestions, search) {
45188      const { config: config2 } = entityForSuggestions;
45189      const query = (0, import_element151.useMemo)(
45190        () => ({
45191          order: "asc",
45192          context: "view",
45193          search,
45194          per_page: search ? 20 : 10,
45195          ...config2.queryArgs(search)
45196        }),
45197        [search, config2]
45198      );
45199      const { records: searchResults, hasResolved: searchHasResolved } = (0, import_core_data57.useEntityRecords)(
45200        entityForSuggestions.type,
45201        entityForSuggestions.slug,
45202        query
45203      );
45204      const [suggestions, setSuggestions] = (0, import_element151.useState)(EMPTY_ARRAY15);
45205      (0, import_element151.useEffect)(() => {
45206        if (!searchHasResolved) {
45207          return;
45208        }
45209        let newSuggestions = EMPTY_ARRAY15;
45210        if (searchResults?.length) {
45211          newSuggestions = searchResults;
45212          if (config2.recordNamePath) {
45213            newSuggestions = mapToIHasNameAndId2(
45214              newSuggestions,
45215              config2.recordNamePath
45216            );
45217          }
45218        }
45219        setSuggestions(newSuggestions);
45220      }, [searchResults, searchHasResolved]);
45221      return suggestions;
45222    }
45223    function SuggestionList2({ entityForSuggestions, onSelect }) {
45224      const [search, setSearch, debouncedSearch] = (0, import_compose31.useDebouncedInput)();
45225      const suggestions = useSearchSuggestions2(
45226        entityForSuggestions,
45227        debouncedSearch
45228      );
45229      const { labels } = entityForSuggestions;
45230      const [showSearchControl, setShowSearchControl] = (0, import_element151.useState)(false);
45231      if (!showSearchControl && suggestions?.length > 9) {
45232        setShowSearchControl(true);
45233      }
45234      return /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)(import_jsx_runtime285.Fragment, { children: [
45235        showSearchControl && /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45236          import_components156.SearchControl,
45237          {
45238            onChange: setSearch,
45239            value: search,
45240            label: labels.search_items,
45241            placeholder: labels.search_items
45242          }
45243        ),
45244        !!suggestions?.length && /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45245          import_components156.Composite,
45246          {
45247            orientation: "vertical",
45248            role: "listbox",
45249            className: "edit-site-custom-template-modal__suggestions_list",
45250            "aria-label": (0, import_i18n150.__)("Suggestions list"),
45251            children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45252              SuggestionListItem2,
45253              {
45254                suggestion,
45255                search: debouncedSearch,
45256                onSelect,
45257                entityForSuggestions
45258              },
45259              suggestion.slug
45260            ))
45261          }
45262        ),
45263        debouncedSearch && !suggestions?.length && /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45264          import_components156.__experimentalText,
45265          {
45266            as: "p",
45267            className: "edit-site-custom-template-modal__no-results",
45268            children: labels.not_found
45269          }
45270        )
45271      ] });
45272    }
45273    function AddCustomTemplateModalContent2({
45274      onSelect,
45275      entityForSuggestions,
45276      onBack,
45277      containerRef
45278    }) {
45279      const [showSearchEntities, setShowSearchEntities] = (0, import_element151.useState)(
45280        entityForSuggestions.hasGeneralTemplate
45281      );
45282      (0, import_element151.useEffect)(() => {
45283        if (containerRef.current) {
45284          const [firstFocusable] = import_dom14.focus.focusable.find(
45285            containerRef.current
45286          );
45287          firstFocusable?.focus();
45288        }
45289      }, [showSearchEntities]);
45290      return /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)(
45291        import_components156.__experimentalVStack,
45292        {
45293          spacing: 4,
45294          className: "edit-site-custom-template-modal__contents-wrapper",
45295          alignment: "left",
45296          children: [
45297            !showSearchEntities && /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)(import_jsx_runtime285.Fragment, { children: [
45298              /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(import_components156.__experimentalText, { as: "p", children: (0, import_i18n150.__)(
45299                "Select whether to create a single template for all items or a specific one."
45300              ) }),
45301              /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)(
45302                import_components156.Flex,
45303                {
45304                  className: "edit-site-custom-template-modal__contents",
45305                  gap: "4",
45306                  align: "initial",
45307                  children: [
45308                    /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)(
45309                      import_components156.FlexItem,
45310                      {
45311                        isBlock: true,
45312                        as: import_components156.Button,
45313                        onClick: () => {
45314                          const {
45315                            slug,
45316                            title,
45317                            description,
45318                            templatePrefix
45319                          } = entityForSuggestions.template;
45320                          onSelect({
45321                            slug,
45322                            title,
45323                            description,
45324                            templatePrefix
45325                          });
45326                        },
45327                        children: [
45328                          /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45329                            import_components156.__experimentalText,
45330                            {
45331                              as: "span",
45332                              weight: 500,
45333                              lineHeight: 1.53846153846,
45334                              children: entityForSuggestions.labels.all_items
45335                            }
45336                          ),
45337                          /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45338                            import_components156.__experimentalText,
45339                            {
45340                              as: "span",
45341                              lineHeight: 1.53846153846,
45342                              // 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.
45343                              children: (0, import_i18n150.__)("For all items")
45344                            }
45345                          )
45346                        ]
45347                      }
45348                    ),
45349                    /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)(
45350                      import_components156.FlexItem,
45351                      {
45352                        isBlock: true,
45353                        as: import_components156.Button,
45354                        onClick: () => {
45355                          setShowSearchEntities(true);
45356                        },
45357                        children: [
45358                          /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45359                            import_components156.__experimentalText,
45360                            {
45361                              as: "span",
45362                              weight: 500,
45363                              lineHeight: 1.53846153846,
45364                              children: entityForSuggestions.labels.singular_name
45365                            }
45366                          ),
45367                          /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45368                            import_components156.__experimentalText,
45369                            {
45370                              as: "span",
45371                              lineHeight: 1.53846153846,
45372                              // 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.
45373                              children: (0, import_i18n150.__)("For a specific item")
45374                            }
45375                          )
45376                        ]
45377                      }
45378                    )
45379                  ]
45380                }
45381              ),
45382              /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(import_components156.Flex, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45383                import_components156.Button,
45384                {
45385                  __next40pxDefaultSize: true,
45386                  variant: "tertiary",
45387                  onClick: onBack,
45388                  children: (0, import_i18n150.__)("Back")
45389                }
45390              ) })
45391            ] }),
45392            showSearchEntities && /* @__PURE__ */ (0, import_jsx_runtime285.jsxs)(import_jsx_runtime285.Fragment, { children: [
45393              /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(import_components156.__experimentalText, { as: "p", children: (0, import_i18n150.__)(
45394                "This template will be used only for the specific item chosen."
45395              ) }),
45396              /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45397                SuggestionList2,
45398                {
45399                  entityForSuggestions,
45400                  onSelect
45401                }
45402              ),
45403              /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(import_components156.Flex, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime285.jsx)(
45404                import_components156.Button,
45405                {
45406                  __next40pxDefaultSize: true,
45407                  variant: "tertiary",
45408                  onClick: () => {
45409                    if (entityForSuggestions.hasGeneralTemplate) {
45410                      onBack();
45411                    } else {
45412                      setShowSearchEntities(false);
45413                    }
45414                  },
45415                  children: (0, import_i18n150.__)("Back")
45416                }
45417              ) })
45418            ] })
45419          ]
45420        }
45421      );
45422    }
45423    var add_custom_template_modal_content_default2 = AddCustomTemplateModalContent2;
45424  
45425    // packages/edit-site/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.mjs
45426    var import_element152 = __toESM(require_element(), 1);
45427    var import_i18n151 = __toESM(require_i18n(), 1);
45428    var import_components157 = __toESM(require_components(), 1);
45429    var import_jsx_runtime286 = __toESM(require_jsx_runtime(), 1);
45430    function AddCustomGenericTemplateModalContent2({ createTemplate, onBack }) {
45431      const [title, setTitle] = (0, import_element152.useState)("");
45432      const defaultTitle = (0, import_i18n151.__)("Custom Template");
45433      const [isBusy, setIsBusy] = (0, import_element152.useState)(false);
45434      const inputRef = (0, import_element152.useRef)();
45435      (0, import_element152.useEffect)(() => {
45436        if (inputRef.current) {
45437          inputRef.current.focus();
45438        }
45439      }, []);
45440      async function onCreateTemplate(event) {
45441        event.preventDefault();
45442        if (isBusy) {
45443          return;
45444        }
45445        setIsBusy(true);
45446        try {
45447          await createTemplate(
45448            {
45449              slug: paramCase(title || defaultTitle) || "wp-custom-template",
45450              title: title || defaultTitle
45451            },
45452            false
45453          );
45454        } finally {
45455          setIsBusy(false);
45456        }
45457      }
45458      return /* @__PURE__ */ (0, import_jsx_runtime286.jsx)("form", { onSubmit: onCreateTemplate, children: /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)(import_components157.__experimentalVStack, { spacing: 6, children: [
45459        /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(
45460          import_components157.TextControl,
45461          {
45462            __next40pxDefaultSize: true,
45463            label: (0, import_i18n151.__)("Name"),
45464            value: title,
45465            onChange: setTitle,
45466            placeholder: defaultTitle,
45467            disabled: isBusy,
45468            ref: inputRef,
45469            help: (0, import_i18n151.__)(
45470              // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
45471              'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.'
45472            )
45473          }
45474        ),
45475        /* @__PURE__ */ (0, import_jsx_runtime286.jsxs)(
45476          import_components157.__experimentalHStack,
45477          {
45478            className: "edit-site-custom-generic-template__modal-actions",
45479            justify: "right",
45480            children: [
45481              /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(
45482                import_components157.Button,
45483                {
45484                  __next40pxDefaultSize: true,
45485                  variant: "tertiary",
45486                  onClick: onBack,
45487                  children: (0, import_i18n151.__)("Back")
45488                }
45489              ),
45490              /* @__PURE__ */ (0, import_jsx_runtime286.jsx)(
45491                import_components157.Button,
45492                {
45493                  __next40pxDefaultSize: true,
45494                  variant: "primary",
45495                  type: "submit",
45496                  isBusy,
45497                  "aria-disabled": isBusy,
45498                  children: (0, import_i18n151.__)("Create")
45499                }
45500              )
45501            ]
45502          }
45503        )
45504      ] }) });
45505    }
45506    var add_custom_generic_template_modal_content_default2 = AddCustomGenericTemplateModalContent2;
45507  
45508    // packages/edit-site/build-module/components/add-new-template-legacy/index.mjs
45509    var import_jsx_runtime287 = __toESM(require_jsx_runtime(), 1);
45510    var { useHistory: useHistory23 } = unlock(import_router36.privateApis);
45511    var DEFAULT_TEMPLATE_SLUGS2 = [
45512      "front-page",
45513      "home",
45514      "single",
45515      "page",
45516      "index",
45517      "archive",
45518      "author",
45519      "category",
45520      "date",
45521      "tag",
45522      "search",
45523      "404"
45524    ];
45525    var TEMPLATE_ICONS2 = {
45526      "front-page": home_default,
45527      home: verse_default,
45528      single: pin_default,
45529      page: page_default,
45530      archive: archive_default,
45531      search: search_default,
45532      404: not_found_default,
45533      index: list_default,
45534      category: category_default,
45535      author: comment_author_avatar_default,
45536      taxonomy: block_meta_default,
45537      date: calendar_default,
45538      tag: tag_default,
45539      attachment: media_default
45540    };
45541    function TemplateListItem2({
45542      title,
45543      direction,
45544      className,
45545      description,
45546      icon,
45547      onClick,
45548      children
45549    }) {
45550      return /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
45551        import_components158.Button,
45552        {
45553          __next40pxDefaultSize: true,
45554          className,
45555          onClick,
45556          label: description,
45557          showTooltip: !!description,
45558          children: /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(
45559            import_components158.Flex,
45560            {
45561              as: "span",
45562              spacing: 2,
45563              align: "center",
45564              justify: "center",
45565              style: { width: "100%" },
45566              direction,
45567              children: [
45568                /* @__PURE__ */ (0, import_jsx_runtime287.jsx)("div", { className: "edit-site-add-new-template__template-icon", children: /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(import_components158.Icon, { icon }) }),
45569                /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(
45570                  import_components158.__experimentalVStack,
45571                  {
45572                    className: "edit-site-add-new-template__template-name",
45573                    alignment: "center",
45574                    spacing: 0,
45575                    children: [
45576                      /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
45577                        import_components158.__experimentalText,
45578                        {
45579                          align: "center",
45580                          weight: 500,
45581                          lineHeight: 1.53846153846,
45582                          children: title
45583                        }
45584                      ),
45585                      children
45586                    ]
45587                  }
45588                )
45589              ]
45590            }
45591          )
45592        }
45593      );
45594    }
45595    var modalContentMap2 = {
45596      templatesList: 1,
45597      customTemplate: 2,
45598      customGenericTemplate: 3
45599    };
45600    function NewTemplateModal2({ onClose }) {
45601      const [modalContent, setModalContent] = (0, import_element153.useState)(
45602        modalContentMap2.templatesList
45603      );
45604      const [entityForSuggestions, setEntityForSuggestions] = (0, import_element153.useState)({});
45605      const [isSubmitting, setIsSubmitting] = (0, import_element153.useState)(false);
45606      const missingTemplates = useMissingTemplates2(
45607        setEntityForSuggestions,
45608        () => setModalContent(modalContentMap2.customTemplate)
45609      );
45610      const history = useHistory23();
45611      const { saveEntityRecord } = (0, import_data77.useDispatch)(import_core_data58.store);
45612      const { createErrorNotice, createSuccessNotice } = (0, import_data77.useDispatch)(import_notices9.store);
45613      const containerRef = (0, import_element153.useRef)(null);
45614      const isMobile = (0, import_compose32.useViewportMatch)("medium", "<");
45615      const homeUrl = (0, import_data77.useSelect)((select3) => {
45616        return select3(import_core_data58.store).getEntityRecord("root", "__unstableBase")?.home;
45617      }, []);
45618      const TEMPLATE_SHORT_DESCRIPTIONS = {
45619        "front-page": homeUrl,
45620        date: (0, import_i18n152.sprintf)(
45621          // translators: %s: The homepage url.
45622          (0, import_i18n152.__)("E.g. %s"),
45623          homeUrl + "/" + (/* @__PURE__ */ new Date()).getFullYear()
45624        )
45625      };
45626      (0, import_element153.useEffect)(() => {
45627        if (containerRef.current && modalContent === modalContentMap2.templatesList) {
45628          const [firstFocusable] = import_dom15.focus.focusable.find(
45629            containerRef.current
45630          );
45631          firstFocusable?.focus();
45632        }
45633      }, [modalContent]);
45634      async function createTemplate(template, isWPSuggestion = true) {
45635        if (isSubmitting) {
45636          return;
45637        }
45638        setIsSubmitting(true);
45639        try {
45640          const { title, description, slug } = template;
45641          const newTemplate = await saveEntityRecord(
45642            "postType",
45643            TEMPLATE_POST_TYPE,
45644            {
45645              description,
45646              // Slugs need to be strings, so this is for template `404`
45647              slug: slug.toString(),
45648              status: "publish",
45649              title,
45650              // This adds a post meta field in template that is part of `is_custom` value calculation.
45651              is_wp_suggestion: isWPSuggestion
45652            },
45653            { throwOnError: true }
45654          );
45655          history.navigate(
45656            `/$TEMPLATE_POST_TYPE}/$newTemplate.id}?canvas=edit`
45657          );
45658          createSuccessNotice(
45659            (0, import_i18n152.sprintf)(
45660              // translators: %s: Title of the created post or template, e.g: "Hello world".
45661              (0, import_i18n152.__)('"%s" successfully created.'),
45662              (0, import_html_entities17.decodeEntities)(newTemplate.title?.rendered || title) || (0, import_i18n152.__)("(no title)")
45663            ),
45664            {
45665              type: "snackbar"
45666            }
45667          );
45668        } catch (error) {
45669          const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n152.__)("An error occurred while creating the template.");
45670          createErrorNotice(errorMessage, {
45671            type: "snackbar"
45672          });
45673        } finally {
45674          setIsSubmitting(false);
45675        }
45676      }
45677      const onModalClose = () => {
45678        onClose();
45679        setModalContent(modalContentMap2.templatesList);
45680      };
45681      let modalTitle = (0, import_i18n152.__)("Add template");
45682      if (modalContent === modalContentMap2.customTemplate) {
45683        modalTitle = (0, import_i18n152.sprintf)(
45684          // translators: %s: Name of the post type e.g: "Post".
45685          (0, import_i18n152.__)("Add template: %s"),
45686          entityForSuggestions.labels.singular_name
45687        );
45688      } else if (modalContent === modalContentMap2.customGenericTemplate) {
45689        modalTitle = (0, import_i18n152.__)("Create custom template");
45690      }
45691      return /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(
45692        import_components158.Modal,
45693        {
45694          title: modalTitle,
45695          className: clsx_default("edit-site-add-new-template__modal", {
45696            "edit-site-add-new-template__modal_template_list": modalContent === modalContentMap2.templatesList,
45697            "edit-site-custom-template-modal": modalContent === modalContentMap2.customTemplate
45698          }),
45699          onRequestClose: onModalClose,
45700          overlayClassName: modalContent === modalContentMap2.customGenericTemplate ? "edit-site-custom-generic-template__modal" : void 0,
45701          ref: containerRef,
45702          children: [
45703            modalContent === modalContentMap2.templatesList && /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(
45704              import_components158.__experimentalGrid,
45705              {
45706                columns: isMobile ? 2 : 3,
45707                gap: 4,
45708                align: "flex-start",
45709                justify: "center",
45710                className: "edit-site-add-new-template__template-list__contents",
45711                children: [
45712                  /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(import_components158.Flex, { className: "edit-site-add-new-template__template-list__prompt", children: (0, import_i18n152.__)(
45713                    "Select what the new template should apply to:"
45714                  ) }),
45715                  missingTemplates.map((template) => {
45716                    const { title, slug, onClick } = template;
45717                    return /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
45718                      TemplateListItem2,
45719                      {
45720                        title,
45721                        direction: "column",
45722                        className: "edit-site-add-new-template__template-button",
45723                        description: TEMPLATE_SHORT_DESCRIPTIONS[slug],
45724                        icon: TEMPLATE_ICONS2[slug] || layout_default,
45725                        onClick: () => onClick ? onClick(template) : createTemplate(template)
45726                      },
45727                      slug
45728                    );
45729                  }),
45730                  /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
45731                    TemplateListItem2,
45732                    {
45733                      title: (0, import_i18n152.__)("Custom template"),
45734                      direction: "row",
45735                      className: "edit-site-add-new-template__custom-template-button",
45736                      icon: pencil_default,
45737                      onClick: () => setModalContent(
45738                        modalContentMap2.customGenericTemplate
45739                      ),
45740                      children: /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
45741                        import_components158.__experimentalText,
45742                        {
45743                          lineHeight: 1.53846153846,
45744                          children: (0, import_i18n152.__)(
45745                            "A custom template can be manually applied to any post or page."
45746                          )
45747                        }
45748                      )
45749                    }
45750                  )
45751                ]
45752              }
45753            ),
45754            modalContent === modalContentMap2.customTemplate && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
45755              add_custom_template_modal_content_default2,
45756              {
45757                onSelect: createTemplate,
45758                entityForSuggestions,
45759                onBack: () => setModalContent(modalContentMap2.templatesList),
45760                containerRef
45761              }
45762            ),
45763            modalContent === modalContentMap2.customGenericTemplate && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
45764              add_custom_generic_template_modal_content_default2,
45765              {
45766                createTemplate,
45767                onBack: () => setModalContent(modalContentMap2.templatesList)
45768              }
45769            )
45770          ]
45771        }
45772      );
45773    }
45774    function NewTemplate2() {
45775      const [showModal, setShowModal] = (0, import_element153.useState)(false);
45776      const { postType: postType2 } = (0, import_data77.useSelect)((select3) => {
45777        const { getPostType: getPostType2 } = select3(import_core_data58.store);
45778        return {
45779          postType: getPostType2(TEMPLATE_POST_TYPE)
45780        };
45781      }, []);
45782      if (!postType2) {
45783        return null;
45784      }
45785      return /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(import_jsx_runtime287.Fragment, { children: [
45786        /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
45787          import_components158.Button,
45788          {
45789            variant: "primary",
45790            onClick: () => setShowModal(true),
45791            label: postType2.labels.add_new_item,
45792            __next40pxDefaultSize: true,
45793            children: postType2.labels.add_new_item
45794          }
45795        ),
45796        showModal && /* @__PURE__ */ (0, import_jsx_runtime287.jsx)(NewTemplateModal2, { onClose: () => setShowModal(false) })
45797      ] });
45798    }
45799    function useMissingTemplates2(setEntityForSuggestions, onClick) {
45800      const existingTemplates = useExistingTemplates2();
45801      const defaultTemplateTypes = useDefaultTemplateTypes2();
45802      const existingTemplateSlugs = (existingTemplates || []).map(
45803        ({ slug }) => slug
45804      );
45805      const missingDefaultTemplates = (defaultTemplateTypes || []).filter(
45806        (template) => DEFAULT_TEMPLATE_SLUGS2.includes(template.slug) && !existingTemplateSlugs.includes(template.slug)
45807      );
45808      const onClickMenuItem = (_entityForSuggestions) => {
45809        onClick?.();
45810        setEntityForSuggestions(_entityForSuggestions);
45811      };
45812      const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates];
45813      const { defaultTaxonomiesMenuItems, taxonomiesMenuItems } = useTaxonomiesMenuItems2(onClickMenuItem);
45814      const { defaultPostTypesMenuItems, postTypesMenuItems } = usePostTypeMenuItems2(onClickMenuItem);
45815      const authorMenuItem = useAuthorMenuItem2(onClickMenuItem);
45816      [
45817        ...defaultTaxonomiesMenuItems,
45818        ...defaultPostTypesMenuItems,
45819        authorMenuItem
45820      ].forEach((menuItem) => {
45821        if (!menuItem) {
45822          return;
45823        }
45824        const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(
45825          (template) => template.slug === menuItem.slug
45826        );
45827        if (matchIndex > -1) {
45828          enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem;
45829        } else {
45830          enhancedMissingDefaultTemplateTypes.push(menuItem);
45831        }
45832      });
45833      enhancedMissingDefaultTemplateTypes?.sort((template1, template2) => {
45834        return DEFAULT_TEMPLATE_SLUGS2.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS2.indexOf(template2.slug);
45835      });
45836      const missingTemplates = [
45837        ...enhancedMissingDefaultTemplateTypes,
45838        ...usePostTypeArchiveMenuItems2(),
45839        ...postTypesMenuItems,
45840        ...taxonomiesMenuItems
45841      ];
45842      return missingTemplates;
45843    }
45844    var add_new_template_legacy_default = (0, import_element153.memo)(NewTemplate2);
45845  
45846    // packages/edit-site/build-module/components/page-templates/index-legacy.mjs
45847    var import_jsx_runtime288 = __toESM(require_jsx_runtime(), 1);
45848    var { usePostActions: usePostActions3, templateTitleField: templateTitleField2 } = unlock(import_editor36.privateApis);
45849    var { useHistory: useHistory24, useLocation: useLocation31 } = unlock(import_router37.privateApis);
45850    var { useEntityRecordsWithPermissions: useEntityRecordsWithPermissions3 } = unlock(import_core_data59.privateApis);
45851    function PageTemplates2() {
45852      const { path, query } = useLocation31();
45853      const { activeView = "active", postId } = query;
45854      const [selection, setSelection] = (0, import_element154.useState)([postId]);
45855      const defaultView = DEFAULT_VIEW2;
45856      const activeViewOverrides = (0, import_element154.useMemo)(
45857        () => getActiveViewOverridesForTab(activeView),
45858        [activeView]
45859      );
45860      const { view, updateView, isModified, resetToDefault } = useView({
45861        kind: "postType",
45862        name: TEMPLATE_POST_TYPE,
45863        slug: "default",
45864        defaultView,
45865        activeViewOverrides,
45866        queryParams: {
45867          page: query.pageNumber,
45868          search: query.search
45869        },
45870        onChangeQueryParams: (newQueryParams) => {
45871          history.navigate(
45872            (0, import_url25.addQueryArgs)(path, {
45873              ...query,
45874              pageNumber: newQueryParams.page,
45875              search: newQueryParams.search || void 0
45876            })
45877          );
45878        }
45879      });
45880      const { records, isResolving: isLoadingData } = useEntityRecordsWithPermissions3("postType", TEMPLATE_POST_TYPE, {
45881        per_page: -1
45882      });
45883      const history = useHistory24();
45884      const onChangeSelection = (0, import_element154.useCallback)(
45885        (items) => {
45886          setSelection(items);
45887          if (view?.type === "list") {
45888            history.navigate(
45889              (0, import_url25.addQueryArgs)(path, {
45890                postId: items.length === 1 ? items[0] : void 0
45891              })
45892            );
45893          }
45894        },
45895        [history, path, view?.type]
45896      );
45897      const authors = (0, import_element154.useMemo)(() => {
45898        if (!records) {
45899          return [];
45900        }
45901        const authorsSet = /* @__PURE__ */ new Set();
45902        records.forEach((template) => {
45903          authorsSet.add(template.author_text);
45904        });
45905        return Array.from(authorsSet).map((author) => ({
45906          value: author,
45907          label: author
45908        }));
45909      }, [records]);
45910      const fields = (0, import_element154.useMemo)(
45911        () => [
45912          previewField2,
45913          templateTitleField2,
45914          descriptionField,
45915          {
45916            ...authorField,
45917            elements: authors
45918          }
45919        ],
45920        [authors]
45921      );
45922      const { data, paginationInfo } = (0, import_element154.useMemo)(() => {
45923        return filterSortAndPaginate(records, view, fields);
45924      }, [records, view, fields]);
45925      const postTypeActions = usePostActions3({
45926        postType: TEMPLATE_POST_TYPE,
45927        context: "list"
45928      });
45929      const editAction = useEditPostAction();
45930      const actions = (0, import_element154.useMemo)(
45931        () => [editAction, ...postTypeActions],
45932        [postTypeActions, editAction]
45933      );
45934      const onChangeView = (0, import_compose33.useEvent)((newView) => {
45935        updateView(newView);
45936        if (newView.type !== view.type) {
45937          history.invalidate();
45938        }
45939      });
45940      return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
45941        page_default2,
45942        {
45943          className: "edit-site-page-templates",
45944          title: (0, import_i18n153.__)("Templates"),
45945          headingLevel: 2,
45946          actions: /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(add_new_template_legacy_default, {}),
45947          children: /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
45948            dataviews_default,
45949            {
45950              paginationInfo,
45951              fields,
45952              actions,
45953              data,
45954              isLoading: isLoadingData,
45955              view,
45956              onChangeView,
45957              onChangeSelection,
45958              isItemClickable: () => true,
45959              onClickItem: ({ id }) => {
45960                history.navigate(`/wp_template/$id}?canvas=edit`);
45961              },
45962              selection,
45963              defaultLayouts: defaultLayouts2,
45964              onReset: isModified ? () => {
45965                resetToDefault();
45966                history.invalidate();
45967              } : false
45968            },
45969            activeView
45970          )
45971        }
45972      );
45973    }
45974  
45975    // packages/edit-site/build-module/components/site-editor-routes/templates.mjs
45976    var import_jsx_runtime289 = __toESM(require_jsx_runtime(), 1);
45977    async function isTemplateListView(query) {
45978      const { activeView = "active" } = query;
45979      const view = await loadView({
45980        kind: "postType",
45981        name: "wp_template",
45982        slug: "default",
45983        defaultView: DEFAULT_VIEW2,
45984        activeViewOverrides: getActiveViewOverridesForTab(activeView)
45985      });
45986      return view.type === "list";
45987    }
45988    var templatesRoute = {
45989      name: "templates",
45990      path: "/template",
45991      areas: {
45992        sidebar({ siteData }) {
45993          const isBlockTheme = siteData.currentTheme?.is_block_theme;
45994          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(SidebarNavigationScreenUnsupported, {});
45995        },
45996        content({ siteData }) {
45997          const isBlockTheme = siteData.currentTheme?.is_block_theme;
45998          if (!isBlockTheme) {
45999            return void 0;
46000          }
46001          return window?.__experimentalTemplateActivate ? /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(PageTemplates, {}) : /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(PageTemplates2, {});
46002        },
46003        async preview({ query, siteData }) {
46004          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46005          if (!isBlockTheme) {
46006            return void 0;
46007          }
46008          const isListView2 = await isTemplateListView(query);
46009          return isListView2 ? /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(EditSiteEditor, {}) : void 0;
46010        },
46011        mobile({ siteData }) {
46012          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46013          if (!isBlockTheme) {
46014            return /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(SidebarNavigationScreenUnsupported, {});
46015          }
46016          const isTemplateActivateEnabled = typeof window !== "undefined" && window.__experimentalTemplateActivate;
46017          return isTemplateActivateEnabled ? /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(PageTemplates, {}) : /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(PageTemplates2, {});
46018        }
46019      },
46020      widths: {
46021        async content({ query }) {
46022          const isListView2 = await isTemplateListView(query);
46023          return isListView2 ? 380 : void 0;
46024        }
46025      }
46026    };
46027  
46028    // packages/edit-site/build-module/components/site-editor-routes/template-item.mjs
46029    var import_jsx_runtime290 = __toESM(require_jsx_runtime(), 1);
46030    var areas = {
46031      sidebar({ siteData }) {
46032        const isBlockTheme = siteData.currentTheme?.is_block_theme;
46033        return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(SidebarNavigationScreenUnsupported, {});
46034      },
46035      mobile({ siteData }) {
46036        const isBlockTheme = siteData.currentTheme?.is_block_theme;
46037        return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(SidebarNavigationScreenUnsupported, {});
46038      },
46039      preview({ siteData }) {
46040        const isBlockTheme = siteData.currentTheme?.is_block_theme;
46041        return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(SidebarNavigationScreenUnsupported, {});
46042      }
46043    };
46044    var templateItemRoute = {
46045      name: "template-item",
46046      path: "/wp_template/*postId",
46047      areas
46048    };
46049  
46050    // packages/edit-site/build-module/components/site-editor-routes/pages.mjs
46051    var import_router41 = __toESM(require_router(), 1);
46052    var import_i18n157 = __toESM(require_i18n(), 1);
46053  
46054    // packages/edit-site/build-module/components/sidebar-dataviews/index.mjs
46055    var import_components160 = __toESM(require_components(), 1);
46056    var import_router39 = __toESM(require_router(), 1);
46057    var import_data78 = __toESM(require_data(), 1);
46058    var import_core_data60 = __toESM(require_core_data(), 1);
46059    var import_element155 = __toESM(require_element(), 1);
46060  
46061    // packages/edit-site/build-module/components/sidebar-dataviews/dataview-item.mjs
46062    var import_router38 = __toESM(require_router(), 1);
46063    var import_components159 = __toESM(require_components(), 1);
46064    var import_url26 = __toESM(require_url(), 1);
46065    var import_jsx_runtime291 = __toESM(require_jsx_runtime(), 1);
46066    var { useLocation: useLocation32 } = unlock(import_router38.privateApis);
46067    function DataViewItem({
46068      title,
46069      slug,
46070      type,
46071      icon,
46072      isActive,
46073      suffix
46074    }) {
46075      const { path } = useLocation32();
46076      const iconToUse = icon || VIEW_LAYOUTS.find((v2) => v2.type === type).icon;
46077      if (slug === "all") {
46078        slug = void 0;
46079      }
46080      return /* @__PURE__ */ (0, import_jsx_runtime291.jsxs)(
46081        import_components159.__experimentalHStack,
46082        {
46083          justify: "flex-start",
46084          className: clsx_default("edit-site-sidebar-dataviews-dataview-item", {
46085            "is-selected": isActive
46086          }),
46087          children: [
46088            /* @__PURE__ */ (0, import_jsx_runtime291.jsx)(
46089              SidebarNavigationItem,
46090              {
46091                icon: iconToUse,
46092                to: (0, import_url26.addQueryArgs)(path, {
46093                  activeView: slug
46094                }),
46095                "aria-current": isActive ? "true" : void 0,
46096                children: title
46097              }
46098            ),
46099            suffix
46100          ]
46101        }
46102      );
46103    }
46104  
46105    // packages/edit-site/build-module/components/post-list/view-utils.mjs
46106    var import_i18n154 = __toESM(require_i18n(), 1);
46107    var defaultLayouts3 = {
46108      table: {
46109        layout: {
46110          styles: {
46111            author: {
46112              align: "start"
46113            }
46114          }
46115        }
46116      },
46117      grid: {},
46118      list: {}
46119    };
46120    var DEFAULT_VIEW3 = {
46121      type: "list",
46122      filters: [],
46123      perPage: 20,
46124      sort: {
46125        field: "title",
46126        direction: "asc"
46127      },
46128      showLevels: true,
46129      titleField: "title",
46130      mediaField: "featured_media",
46131      fields: ["author", "status"],
46132      ...defaultLayouts3.list
46133    };
46134    function getDefaultViews(postType2) {
46135      return [
46136        {
46137          title: postType2?.labels?.all_items || (0, import_i18n154.__)("All items"),
46138          slug: "all",
46139          icon: pages_default,
46140          view: DEFAULT_VIEW3
46141        },
46142        {
46143          title: (0, import_i18n154.__)("Published"),
46144          slug: "published",
46145          icon: published_default,
46146          view: {
46147            ...DEFAULT_VIEW3,
46148            filters: [
46149              {
46150                field: "status",
46151                operator: OPERATOR_IS_ANY,
46152                value: "publish",
46153                isLocked: true
46154              }
46155            ]
46156          }
46157        },
46158        {
46159          title: (0, import_i18n154.__)("Scheduled"),
46160          slug: "future",
46161          icon: scheduled_default,
46162          view: {
46163            ...DEFAULT_VIEW3,
46164            filters: [
46165              {
46166                field: "status",
46167                operator: OPERATOR_IS_ANY,
46168                value: "future",
46169                isLocked: true
46170              }
46171            ]
46172          }
46173        },
46174        {
46175          title: (0, import_i18n154.__)("Drafts"),
46176          slug: "drafts",
46177          icon: drafts_default,
46178          view: {
46179            ...DEFAULT_VIEW3,
46180            filters: [
46181              {
46182                field: "status",
46183                operator: OPERATOR_IS_ANY,
46184                value: "draft",
46185                isLocked: true
46186              }
46187            ]
46188          }
46189        },
46190        {
46191          title: (0, import_i18n154.__)("Pending"),
46192          slug: "pending",
46193          icon: pending_default,
46194          view: {
46195            ...DEFAULT_VIEW3,
46196            filters: [
46197              {
46198                field: "status",
46199                operator: OPERATOR_IS_ANY,
46200                value: "pending",
46201                isLocked: true
46202              }
46203            ]
46204          }
46205        },
46206        {
46207          title: (0, import_i18n154.__)("Private"),
46208          slug: "private",
46209          icon: not_allowed_default,
46210          view: {
46211            ...DEFAULT_VIEW3,
46212            filters: [
46213              {
46214                field: "status",
46215                operator: OPERATOR_IS_ANY,
46216                value: "private",
46217                isLocked: true
46218              }
46219            ]
46220          }
46221        },
46222        {
46223          title: (0, import_i18n154.__)("Trash"),
46224          slug: "trash",
46225          icon: trash_default,
46226          view: {
46227            ...DEFAULT_VIEW3,
46228            type: "table",
46229            layout: defaultLayouts3.table.layout,
46230            filters: [
46231              {
46232                field: "status",
46233                operator: OPERATOR_IS_ANY,
46234                value: "trash",
46235                isLocked: true
46236              }
46237            ]
46238          }
46239        }
46240      ];
46241    }
46242    var SLUG_TO_STATUS = {
46243      published: "publish",
46244      future: "future",
46245      drafts: "draft",
46246      pending: "pending",
46247      private: "private",
46248      trash: "trash"
46249    };
46250    function getActiveViewOverridesForTab2(activeView) {
46251      const base = {
46252        ...defaultLayouts3.table
46253      };
46254      const status = SLUG_TO_STATUS[activeView];
46255      if (!status) {
46256        return base;
46257      }
46258      return {
46259        ...base,
46260        filters: [
46261          {
46262            field: "status",
46263            operator: OPERATOR_IS_ANY,
46264            value: status,
46265            isLocked: true
46266          }
46267        ]
46268      };
46269    }
46270  
46271    // packages/edit-site/build-module/components/sidebar-dataviews/index.mjs
46272    var import_jsx_runtime292 = __toESM(require_jsx_runtime(), 1);
46273    var { useLocation: useLocation33 } = unlock(import_router39.privateApis);
46274    function DataViewsSidebarContent({ postType: postType2 }) {
46275      const {
46276        query: { activeView = "all" }
46277      } = useLocation33();
46278      const postTypeObject = (0, import_data78.useSelect)(
46279        (select3) => {
46280          const { getPostType: getPostType2 } = select3(import_core_data60.store);
46281          return getPostType2(postType2);
46282        },
46283        [postType2]
46284      );
46285      const defaultViews = (0, import_element155.useMemo)(
46286        () => getDefaultViews(postTypeObject),
46287        [postTypeObject]
46288      );
46289      if (!postType2) {
46290        return null;
46291      }
46292      return /* @__PURE__ */ (0, import_jsx_runtime292.jsx)(import_jsx_runtime292.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime292.jsx)(import_components160.__experimentalItemGroup, { className: "edit-site-sidebar-dataviews", children: defaultViews.map((dataview) => {
46293        return /* @__PURE__ */ (0, import_jsx_runtime292.jsx)(
46294          DataViewItem,
46295          {
46296            slug: dataview.slug,
46297            title: dataview.title,
46298            icon: dataview.icon,
46299            type: dataview.view.type,
46300            isActive: dataview.slug === activeView
46301          },
46302          dataview.slug
46303        );
46304      }) }) });
46305    }
46306  
46307    // packages/edit-site/build-module/components/post-list/index.mjs
46308    var import_components163 = __toESM(require_components(), 1);
46309    var import_core_data64 = __toESM(require_core_data(), 1);
46310    var import_element159 = __toESM(require_element(), 1);
46311    var import_router40 = __toESM(require_router(), 1);
46312    var import_data81 = __toESM(require_data(), 1);
46313    var import_editor40 = __toESM(require_editor(), 1);
46314    var import_compose34 = __toESM(require_compose(), 1);
46315    var import_url27 = __toESM(require_url(), 1);
46316  
46317    // packages/edit-site/build-module/components/add-new-post/index.mjs
46318    var import_components161 = __toESM(require_components(), 1);
46319    var import_i18n155 = __toESM(require_i18n(), 1);
46320    var import_data79 = __toESM(require_data(), 1);
46321    var import_element156 = __toESM(require_element(), 1);
46322    var import_core_data61 = __toESM(require_core_data(), 1);
46323    var import_notices10 = __toESM(require_notices(), 1);
46324    var import_html_entities18 = __toESM(require_html_entities(), 1);
46325    var import_blocks14 = __toESM(require_blocks(), 1);
46326    var import_jsx_runtime293 = __toESM(require_jsx_runtime(), 1);
46327    function AddNewPostModal({ postType: postType2, onSave, onClose }) {
46328      const labels = (0, import_data79.useSelect)(
46329        (select3) => select3(import_core_data61.store).getPostType(postType2)?.labels,
46330        [postType2]
46331      );
46332      const [isCreatingPost, setIsCreatingPost] = (0, import_element156.useState)(false);
46333      const [title, setTitle] = (0, import_element156.useState)("");
46334      const { saveEntityRecord } = (0, import_data79.useDispatch)(import_core_data61.store);
46335      const { createErrorNotice, createSuccessNotice } = (0, import_data79.useDispatch)(import_notices10.store);
46336      const { resolveSelect: resolveSelect2 } = (0, import_data79.useRegistry)();
46337      async function createPost(event) {
46338        event.preventDefault();
46339        if (isCreatingPost) {
46340          return;
46341        }
46342        setIsCreatingPost(true);
46343        try {
46344          const postTypeObject = await resolveSelect2(import_core_data61.store).getPostType(postType2);
46345          const newPage = await saveEntityRecord(
46346            "postType",
46347            postType2,
46348            {
46349              status: "draft",
46350              title,
46351              slug: title ?? void 0,
46352              content: !!postTypeObject.template && postTypeObject.template.length ? (0, import_blocks14.serialize)(
46353                (0, import_blocks14.synchronizeBlocksWithTemplate)(
46354                  [],
46355                  postTypeObject.template
46356                )
46357              ) : void 0
46358            },
46359            { throwOnError: true }
46360          );
46361          onSave(newPage);
46362          createSuccessNotice(
46363            (0, import_i18n155.sprintf)(
46364              // translators: %s: Title of the created post or template, e.g: "Hello world".
46365              (0, import_i18n155.__)('"%s" successfully created.'),
46366              (0, import_html_entities18.decodeEntities)(newPage.title?.rendered || title) || (0, import_i18n155.__)("(no title)")
46367            ),
46368            { type: "snackbar" }
46369          );
46370        } catch (error) {
46371          const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n155.__)("An error occurred while creating the item.");
46372          createErrorNotice(errorMessage, {
46373            type: "snackbar"
46374          });
46375        } finally {
46376          setIsCreatingPost(false);
46377        }
46378      }
46379      return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
46380        import_components161.Modal,
46381        {
46382          title: (
46383            // translators: %s: post type singular_name label e.g: "Page".
46384            (0, import_i18n155.sprintf)((0, import_i18n155.__)("Draft new: %s"), labels?.singular_name)
46385          ),
46386          onRequestClose: onClose,
46387          focusOnMount: "firstContentElement",
46388          size: "small",
46389          children: /* @__PURE__ */ (0, import_jsx_runtime293.jsx)("form", { onSubmit: createPost, children: /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_components161.__experimentalVStack, { spacing: 4, children: [
46390            /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
46391              import_components161.TextControl,
46392              {
46393                __next40pxDefaultSize: true,
46394                label: (0, import_i18n155.__)("Title"),
46395                onChange: setTitle,
46396                placeholder: (0, import_i18n155.__)("No title"),
46397                value: title
46398              }
46399            ),
46400            /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_components161.__experimentalHStack, { spacing: 2, justify: "end", children: [
46401              /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
46402                import_components161.Button,
46403                {
46404                  __next40pxDefaultSize: true,
46405                  variant: "tertiary",
46406                  onClick: onClose,
46407                  children: (0, import_i18n155.__)("Cancel")
46408                }
46409              ),
46410              /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
46411                import_components161.Button,
46412                {
46413                  __next40pxDefaultSize: true,
46414                  variant: "primary",
46415                  type: "submit",
46416                  isBusy: isCreatingPost,
46417                  "aria-disabled": isCreatingPost,
46418                  children: (0, import_i18n155.__)("Create draft")
46419                }
46420              )
46421            ] })
46422          ] }) })
46423        }
46424      );
46425    }
46426  
46427    // packages/edit-site/build-module/components/post-list/use-notes-count.mjs
46428    var import_element157 = __toESM(require_element(), 1);
46429    var import_core_data62 = __toESM(require_core_data(), 1);
46430    function useNotesCount(postIds) {
46431      const { records: notes, isResolving } = (0, import_core_data62.useEntityRecords)(
46432        "root",
46433        "comment",
46434        {
46435          post: postIds,
46436          type: "note",
46437          status: "all",
46438          per_page: -1,
46439          _fields: "id,post"
46440        },
46441        {
46442          enabled: postIds?.length > 0
46443        }
46444      );
46445      const notesCount = (0, import_element157.useMemo)(() => {
46446        if (!notes || notes.length === 0) {
46447          return {};
46448        }
46449        const counts = {};
46450        notes.forEach((note) => {
46451          const postId = note.post;
46452          counts[postId] = (counts[postId] || 0) + 1;
46453        });
46454        return counts;
46455      }, [notes]);
46456      return { notesCount, isResolving };
46457    }
46458  
46459    // packages/edit-site/build-module/components/post-list/quick-edit-modal.mjs
46460    var import_i18n156 = __toESM(require_i18n(), 1);
46461    var import_data80 = __toESM(require_data(), 1);
46462    var import_core_data63 = __toESM(require_core_data(), 1);
46463    var import_components162 = __toESM(require_components(), 1);
46464    var import_element158 = __toESM(require_element(), 1);
46465    var import_editor39 = __toESM(require_editor(), 1);
46466    var import_jsx_runtime294 = __toESM(require_jsx_runtime(), 1);
46467    var { usePostFields: usePostFields2, PostCardPanel } = unlock(import_editor39.privateApis);
46468    var fieldsWithBulkEditSupport = ["status", "date", "author", "discussion"];
46469    function QuickEditModal({ postType: postType2, postId, closeModal }) {
46470      const isBulk = postId.length > 1;
46471      const [localEdits, setLocalEdits] = (0, import_element158.useState)({});
46472      const { record, hasFinishedResolution, canSwitchTemplate } = (0, import_data80.useSelect)(
46473        (select3) => {
46474          const {
46475            getEditedEntityRecord,
46476            hasFinishedResolution: hasFinished
46477          } = select3(import_core_data63.store);
46478          if (isBulk) {
46479            return {
46480              record: null,
46481              hasFinishedResolution: true
46482            };
46483          }
46484          const args = ["postType", postType2, postId[0]];
46485          const { getHomePage, getPostsPageId } = unlock(
46486            select3(import_core_data63.store)
46487          );
46488          const singlePostId = String(postId[0]);
46489          const isPostsPage = singlePostId !== void 0 && getPostsPageId() === singlePostId;
46490          const isFrontPage = singlePostId !== void 0 && postType2 === "page" && getHomePage()?.postId === singlePostId;
46491          return {
46492            record: getEditedEntityRecord(...args),
46493            hasFinishedResolution: hasFinished(
46494              "getEditedEntityRecord",
46495              args
46496            ),
46497            canSwitchTemplate: !isPostsPage && !isFrontPage
46498          };
46499        },
46500        [postType2, postId, isBulk]
46501      );
46502      const { editEntityRecord, saveEditedEntityRecord } = (0, import_data80.useDispatch)(import_core_data63.store);
46503      const _fields = usePostFields2({ postType: postType2 });
46504      const fields = (0, import_element158.useMemo)(
46505        () => _fields?.map((field) => {
46506          if (field.id === "status") {
46507            return {
46508              ...field,
46509              elements: field.elements.filter(
46510                (element) => element.value !== "trash"
46511              )
46512            };
46513          }
46514          if (field.id === "template") {
46515            return {
46516              ...field,
46517              readOnly: !canSwitchTemplate
46518            };
46519          }
46520          return field;
46521        }),
46522        [_fields, canSwitchTemplate]
46523      );
46524      const form = (0, import_element158.useMemo)(() => {
46525        const allFields = [
46526          {
46527            id: "featured_media",
46528            layout: {
46529              type: "regular",
46530              labelPosition: "none"
46531            }
46532          },
46533          {
46534            id: "status",
46535            label: (0, import_i18n156.__)("Status"),
46536            children: [
46537              {
46538                id: "status",
46539                layout: { type: "regular", labelPosition: "none" }
46540              },
46541              "password"
46542            ]
46543          },
46544          "author",
46545          "date",
46546          "slug",
46547          "parent",
46548          {
46549            id: "discussion",
46550            label: (0, import_i18n156.__)("Discussion"),
46551            children: [
46552              {
46553                id: "comment_status",
46554                layout: { type: "regular", labelPosition: "none" }
46555              },
46556              "ping_status"
46557            ]
46558          },
46559          "template"
46560        ];
46561        return {
46562          layout: {
46563            type: "panel"
46564          },
46565          fields: isBulk ? allFields.filter(
46566            (field) => fieldsWithBulkEditSupport.includes(
46567              typeof field === "string" ? field : field.id
46568            )
46569          ) : allFields
46570        };
46571      }, [isBulk]);
46572      const onChange = (edits) => {
46573        const currentData = { ...record, ...localEdits };
46574        if (edits.status && edits.status !== "future" && currentData?.status === "future" && new Date(currentData.date) > /* @__PURE__ */ new Date()) {
46575          edits.date = null;
46576        }
46577        if (edits.status && edits.status === "private" && currentData?.password) {
46578          edits.password = "";
46579        }
46580        setLocalEdits((prev) => ({ ...prev, ...edits }));
46581      };
46582      (0, import_element158.useEffect)(() => {
46583        setLocalEdits({});
46584      }, [postId]);
46585      const onSave = async () => {
46586        for (const id of postId) {
46587          editEntityRecord("postType", postType2, id, localEdits);
46588        }
46589        if (isBulk) {
46590          await Promise.allSettled(
46591            postId.map(
46592              (id) => saveEditedEntityRecord("postType", postType2, id)
46593            )
46594          );
46595        } else {
46596          await saveEditedEntityRecord("postType", postType2, postId[0]);
46597        }
46598        closeModal?.();
46599      };
46600      return /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(
46601        import_components162.Modal,
46602        {
46603          overlayClassName: "dataviews-action-modal__quick-edit",
46604          __experimentalHideHeader: true,
46605          onRequestClose: closeModal,
46606          focusOnMount: "firstElement",
46607          children: [
46608            /* @__PURE__ */ (0, import_jsx_runtime294.jsx)("div", { className: "dataviews-action-modal__quick-edit-header", children: /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(
46609              PostCardPanel,
46610              {
46611                postType: postType2,
46612                postId,
46613                onClose: closeModal,
46614                hideActions: true
46615              }
46616            ) }),
46617            /* @__PURE__ */ (0, import_jsx_runtime294.jsx)("div", { className: "dataviews-action-modal__quick-edit-content", children: hasFinishedResolution && /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(
46618              DataForm,
46619              {
46620                data: { ...record, ...localEdits },
46621                fields,
46622                form,
46623                onChange
46624              }
46625            ) }),
46626            /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(import_components162.__experimentalHStack, { className: "dataviews-action-modal__quick-edit-footer", children: [
46627              /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(
46628                import_components162.Button,
46629                {
46630                  __next40pxDefaultSize: true,
46631                  variant: "secondary",
46632                  onClick: closeModal,
46633                  children: (0, import_i18n156.__)("Cancel")
46634                }
46635              ),
46636              /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(
46637                import_components162.Button,
46638                {
46639                  __next40pxDefaultSize: true,
46640                  variant: "primary",
46641                  onClick: onSave,
46642                  children: (0, import_i18n156.__)("Done")
46643                }
46644              )
46645            ] })
46646          ]
46647        }
46648      );
46649    }
46650  
46651    // packages/edit-site/build-module/components/post-list/index.mjs
46652    var import_jsx_runtime295 = __toESM(require_jsx_runtime(), 1);
46653    var { usePostActions: usePostActions4, usePostFields: usePostFields3 } = unlock(import_editor40.privateApis);
46654    var { useLocation: useLocation34, useHistory: useHistory25 } = unlock(import_router40.privateApis);
46655    var { useEntityRecordsWithPermissions: useEntityRecordsWithPermissions4 } = unlock(import_core_data64.privateApis);
46656    var EMPTY_ARRAY16 = [];
46657    var DEFAULT_STATUSES = "draft,future,pending,private,publish";
46658    function getItemId(item) {
46659      return item.id.toString();
46660    }
46661    function getItemLevel(item) {
46662      return item.level;
46663    }
46664    function PostList({ postType: postType2 }) {
46665      const { path, query } = useLocation34();
46666      const { activeView = "all", postId, quickEdit = false } = query;
46667      const history = useHistory25();
46668      const defaultView = DEFAULT_VIEW3;
46669      const activeViewOverrides = (0, import_element159.useMemo)(
46670        () => getActiveViewOverridesForTab2(activeView),
46671        [activeView]
46672      );
46673      const { view, updateView, isModified, resetToDefault } = useView({
46674        kind: "postType",
46675        name: postType2,
46676        slug: "default",
46677        defaultView,
46678        activeViewOverrides,
46679        queryParams: {
46680          page: query.pageNumber,
46681          search: query.search
46682        },
46683        onChangeQueryParams: (newQueryParams) => {
46684          history.navigate(
46685            (0, import_url27.addQueryArgs)(path, {
46686              ...query,
46687              pageNumber: newQueryParams.page,
46688              search: newQueryParams.search || void 0
46689            })
46690          );
46691        }
46692      });
46693      const onChangeView = (0, import_compose34.useEvent)((newView) => {
46694        updateView(newView);
46695        if (newView.type !== view.type) {
46696          history.invalidate();
46697        }
46698      });
46699      const [selection, setSelection] = (0, import_element159.useState)(postId?.split(",") ?? []);
46700      const onChangeSelection = (0, import_element159.useCallback)(
46701        (items) => {
46702          setSelection(items);
46703          history.navigate(
46704            (0, import_url27.addQueryArgs)(path, {
46705              postId: items.join(",")
46706            })
46707          );
46708        },
46709        [path, history]
46710      );
46711      (0, import_element159.useEffect)(() => {
46712        const newSelection = postId?.split(",") ?? [];
46713        setSelection(newSelection);
46714      }, [postId]);
46715      const fields = usePostFields3({
46716        postType: postType2
46717      });
46718      const queryArgs = (0, import_element159.useMemo)(() => {
46719        const filters = {};
46720        view.filters?.forEach((filter) => {
46721          if (filter.field === "status" && filter.operator === OPERATOR_IS_ANY) {
46722            filters.status = filter.value;
46723          }
46724          if (filter.field === "author" && filter.operator === OPERATOR_IS_ANY) {
46725            filters.author = filter.value;
46726          } else if (filter.field === "author" && filter.operator === OPERATOR_IS_NONE) {
46727            filters.author_exclude = filter.value;
46728          }
46729          if (filter.field === "date") {
46730            if (!filter.value) {
46731              return;
46732            }
46733            if (filter.operator === OPERATOR_BEFORE) {
46734              filters.before = filter.value;
46735            } else if (filter.operator === OPERATOR_AFTER) {
46736              filters.after = filter.value;
46737            }
46738          }
46739        });
46740        if (!filters.status || filters.status === "") {
46741          filters.status = DEFAULT_STATUSES;
46742        }
46743        return {
46744          per_page: view.perPage,
46745          page: view.page,
46746          _embed: "author,wp:featuredmedia",
46747          order: view.sort?.direction,
46748          orderby: view.sort?.field,
46749          orderby_hierarchy: !!view.showLevels,
46750          search: view.search,
46751          ...filters
46752        };
46753      }, [view]);
46754      const {
46755        records,
46756        isResolving: isLoadingData,
46757        totalItems,
46758        totalPages,
46759        hasResolved
46760      } = useEntityRecordsWithPermissions4("postType", postType2, queryArgs);
46761      const postIds = (0, import_element159.useMemo)(
46762        () => records?.map((record) => record.id) ?? [],
46763        [records]
46764      );
46765      const { notesCount, isLoading: isLoadingNotesCount } = useNotesCount(postIds);
46766      const data = (0, import_element159.useMemo)(() => {
46767        let processedRecords = records;
46768        if (view?.sort?.field === "author") {
46769          processedRecords = filterSortAndPaginate(
46770            records,
46771            { sort: { ...view.sort } },
46772            fields
46773          ).data;
46774        }
46775        if (processedRecords) {
46776          return processedRecords.map((record) => ({
46777            ...record,
46778            notesCount: notesCount[record.id] ?? 0
46779          }));
46780        }
46781        return processedRecords;
46782      }, [records, fields, view?.sort, notesCount]);
46783      const ids = data?.map((record) => getItemId(record)) ?? [];
46784      const prevIds = (0, import_compose34.usePrevious)(ids) ?? [];
46785      const deletedIds = prevIds.filter((id) => !ids.includes(id));
46786      const postIdWasDeleted = deletedIds.includes(postId);
46787      (0, import_element159.useEffect)(() => {
46788        if (postIdWasDeleted) {
46789          history.navigate(
46790            (0, import_url27.addQueryArgs)(path, {
46791              postId: void 0
46792            })
46793          );
46794        }
46795      }, [history, postIdWasDeleted, path]);
46796      const paginationInfo = (0, import_element159.useMemo)(
46797        () => ({
46798          totalItems,
46799          totalPages
46800        }),
46801        [totalItems, totalPages]
46802      );
46803      const { labels, canCreateRecord } = (0, import_data81.useSelect)(
46804        (select3) => {
46805          const { getPostType: getPostType2, canUser } = select3(import_core_data64.store);
46806          return {
46807            labels: getPostType2(postType2)?.labels,
46808            canCreateRecord: canUser("create", {
46809              kind: "postType",
46810              name: postType2
46811            })
46812          };
46813        },
46814        [postType2]
46815      );
46816      const postTypeActions = usePostActions4({
46817        postType: postType2,
46818        context: "list"
46819      });
46820      const editAction = useEditPostAction();
46821      const quickEditAction = useQuickEditPostAction();
46822      const actions = (0, import_element159.useMemo)(() => {
46823        if (view.type === LAYOUT_LIST) {
46824          const editActionPrimary = { ...editAction, isPrimary: true };
46825          return [editActionPrimary, ...postTypeActions];
46826        }
46827        return [editAction, quickEditAction, ...postTypeActions];
46828      }, [view.type, editAction, quickEditAction, postTypeActions]);
46829      const [showAddPostModal, setShowAddPostModal] = (0, import_element159.useState)(false);
46830      const openModal = () => setShowAddPostModal(true);
46831      const closeModal = () => setShowAddPostModal(false);
46832      const handleNewPage = ({ type, id }) => {
46833        history.navigate(`/$type}/$id}?canvas=edit`);
46834        closeModal();
46835      };
46836      const closeQuickEditModal = () => {
46837        history.navigate(
46838          (0, import_url27.addQueryArgs)(path, {
46839            ...query,
46840            quickEdit: void 0
46841          })
46842        );
46843      };
46844      return /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(
46845        page_default2,
46846        {
46847          title: labels?.name,
46848          headingLevel: 2,
46849          actions: /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(import_jsx_runtime295.Fragment, { children: labels?.add_new_item && canCreateRecord && /* @__PURE__ */ (0, import_jsx_runtime295.jsxs)(import_jsx_runtime295.Fragment, { children: [
46850            /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
46851              import_components163.Button,
46852              {
46853                variant: "primary",
46854                onClick: openModal,
46855                __next40pxDefaultSize: true,
46856                children: labels.add_new_item
46857              }
46858            ),
46859            showAddPostModal && /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
46860              AddNewPostModal,
46861              {
46862                postType: postType2,
46863                onSave: handleNewPage,
46864                onClose: closeModal
46865              }
46866            )
46867          ] }) }),
46868          children: [
46869            /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
46870              dataviews_default,
46871              {
46872                paginationInfo,
46873                fields,
46874                actions,
46875                data: data || EMPTY_ARRAY16,
46876                isLoading: isLoadingData || isLoadingNotesCount || !hasResolved,
46877                view,
46878                onChangeView,
46879                selection,
46880                onChangeSelection,
46881                isItemClickable: (item) => item.status !== "trash",
46882                onClickItem: ({ id }) => {
46883                  history.navigate(`/$postType2}/$id}?canvas=edit`);
46884                },
46885                getItemId,
46886                getItemLevel,
46887                defaultLayouts: defaultLayouts3,
46888                onReset: isModified ? () => {
46889                  resetToDefault();
46890                  history.invalidate();
46891                } : false
46892              },
46893              activeView
46894            ),
46895            quickEdit && !isLoadingData && selection.length > 0 && view.type !== LAYOUT_LIST && /* @__PURE__ */ (0, import_jsx_runtime295.jsx)(
46896              QuickEditModal,
46897              {
46898                postType: postType2,
46899                postId: selection,
46900                closeModal: closeQuickEditModal
46901              }
46902            )
46903          ]
46904        }
46905      );
46906    }
46907  
46908    // packages/edit-site/build-module/components/site-editor-routes/pages.mjs
46909    var import_jsx_runtime296 = __toESM(require_jsx_runtime(), 1);
46910    var { useLocation: useLocation35 } = unlock(import_router41.privateApis);
46911    async function isListView(query) {
46912      const { activeView = "all" } = query;
46913      const view = await loadView({
46914        kind: "postType",
46915        name: "page",
46916        slug: "default",
46917        defaultView: DEFAULT_VIEW3,
46918        activeViewOverrides: getActiveViewOverridesForTab2(activeView)
46919      });
46920      return view.type === "list";
46921    }
46922    function MobilePagesView() {
46923      const { query = {} } = useLocation35();
46924      const { canvas = "view" } = query;
46925      return canvas === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(PostList, { postType: "page" });
46926    }
46927    var pagesRoute = {
46928      name: "pages",
46929      path: "/page",
46930      areas: {
46931        sidebar({ siteData }) {
46932          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46933          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(
46934            SidebarNavigationScreen,
46935            {
46936              title: (0, import_i18n157.__)("Pages"),
46937              backPath: "/",
46938              content: /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(DataViewsSidebarContent, { postType: "page" })
46939            }
46940          ) : /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(SidebarNavigationScreenUnsupported, {});
46941        },
46942        content({ siteData }) {
46943          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46944          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(PostList, { postType: "page" }) : void 0;
46945        },
46946        async preview({ query, siteData }) {
46947          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46948          if (!isBlockTheme) {
46949            return void 0;
46950          }
46951          const isList = await isListView(query);
46952          return isList ? /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(EditSiteEditor, {}) : void 0;
46953        },
46954        mobile({ siteData }) {
46955          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46956          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(MobilePagesView, {}) : /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(SidebarNavigationScreenUnsupported, {});
46957        }
46958      },
46959      widths: {
46960        async content({ query }) {
46961          const isList = await isListView(query);
46962          return isList ? 380 : void 0;
46963        }
46964      }
46965    };
46966  
46967    // packages/edit-site/build-module/components/site-editor-routes/page-item.mjs
46968    var import_i18n158 = __toESM(require_i18n(), 1);
46969    var import_jsx_runtime297 = __toESM(require_jsx_runtime(), 1);
46970    var pageItemRoute = {
46971      name: "page-item",
46972      path: "/page/:postId",
46973      areas: {
46974        sidebar({ siteData }) {
46975          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46976          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
46977            SidebarNavigationScreen,
46978            {
46979              title: (0, import_i18n158.__)("Pages"),
46980              backPath: "/",
46981              content: /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(DataViewsSidebarContent, { postType: "page" })
46982            }
46983          ) : /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(SidebarNavigationScreenUnsupported, {});
46984        },
46985        mobile({ siteData }) {
46986          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46987          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(SidebarNavigationScreenUnsupported, {});
46988        },
46989        preview({ siteData }) {
46990          const isBlockTheme = siteData.currentTheme?.is_block_theme;
46991          return isBlockTheme ? /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(EditSiteEditor, {}) : /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(SidebarNavigationScreenUnsupported, {});
46992        }
46993      }
46994    };
46995  
46996    // packages/edit-site/build-module/components/site-editor-routes/attachment-item.mjs
46997    var import_i18n159 = __toESM(require_i18n(), 1);
46998    var import_jsx_runtime298 = __toESM(require_jsx_runtime(), 1);
46999    var attachmentItemRoute = {
47000      name: "attachment-item",
47001      path: "/attachment/:postId",
47002      areas: {
47003        sidebar: /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(
47004          SidebarNavigationScreen,
47005          {
47006            title: (0, import_i18n159.__)("Media"),
47007            backPath: "/",
47008            content: null
47009          }
47010        ),
47011        mobile: /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(EditSiteEditor, {}),
47012        preview: /* @__PURE__ */ (0, import_jsx_runtime298.jsx)(EditSiteEditor, {})
47013      }
47014    };
47015  
47016    // packages/edit-site/build-module/components/site-editor-routes/stylebook.mjs
47017    var import_i18n160 = __toESM(require_i18n(), 1);
47018    var import_editor44 = __toESM(require_editor(), 1);
47019    var import_jsx_runtime299 = __toESM(require_jsx_runtime(), 1);
47020    var { StyleBookPreview: StyleBookPreview2 } = unlock(import_editor44.privateApis);
47021    var stylebookRoute = {
47022      name: "stylebook",
47023      path: "/stylebook",
47024      areas: {
47025        sidebar({ siteData }) {
47026          return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(
47027            SidebarNavigationScreen,
47028            {
47029              title: (0, import_i18n160.__)("Styles"),
47030              backPath: "/",
47031              description: (0, import_i18n160.__)(
47032                `Preview your website's visual identity: colors, typography, and blocks.`
47033              )
47034            }
47035          ) : /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(SidebarNavigationScreenUnsupported, {});
47036        },
47037        preview({ siteData }) {
47038          return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(
47039            StyleBookPreview2,
47040            {
47041              isStatic: true,
47042              settings: siteData.editorSettings
47043            }
47044          ) : void 0;
47045        },
47046        mobile({ siteData }) {
47047          return isClassicThemeWithStyleBookSupport(siteData) ? /* @__PURE__ */ (0, import_jsx_runtime299.jsx)(
47048            StyleBookPreview2,
47049            {
47050              isStatic: true,
47051              settings: siteData.editorSettings
47052            }
47053          ) : void 0;
47054        }
47055      }
47056    };
47057  
47058    // packages/edit-site/build-module/components/site-editor-routes/notfound.mjs
47059    var import_i18n161 = __toESM(require_i18n(), 1);
47060    var import_components164 = __toESM(require_components(), 1);
47061    var import_jsx_runtime300 = __toESM(require_jsx_runtime(), 1);
47062    function NotFoundError() {
47063      return /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_components164.Notice, { status: "error", isDismissible: false, children: (0, import_i18n161.__)(
47064        "The requested page could not be found. Please check the URL."
47065      ) });
47066    }
47067    var notFoundRoute = {
47068      name: "notfound",
47069      path: "*",
47070      areas: {
47071        sidebar: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(SidebarNavigationScreenMain, {}),
47072        mobile: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(
47073          SidebarNavigationScreenMain,
47074          {
47075            customDescription: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(NotFoundError, {})
47076          }
47077        ),
47078        content: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(import_components164.__experimentalSpacer, { padding: 2, children: /* @__PURE__ */ (0, import_jsx_runtime300.jsx)(NotFoundError, {}) })
47079      }
47080    };
47081  
47082    // packages/edit-site/build-module/components/site-editor-routes/index.mjs
47083    var routes2 = [
47084      ...window?.__experimentalMediaEditor ? [attachmentItemRoute] : [],
47085      pageItemRoute,
47086      pagesRoute,
47087      templateItemRoute,
47088      templatesRoute,
47089      templatePartItemRoute,
47090      patternItemRoute,
47091      patternsRoute,
47092      navigationItemRoute,
47093      navigationRoute,
47094      stylesRoute,
47095      homeRoute,
47096      stylebookRoute,
47097      notFoundRoute
47098    ];
47099    function useRegisterSiteEditorRoutes() {
47100      const registry = (0, import_data82.useRegistry)();
47101      const { registerRoute: registerRoute2 } = unlock((0, import_data82.useDispatch)(store));
47102      (0, import_element160.useEffect)(() => {
47103        registry.batch(() => {
47104          routes2.forEach(registerRoute2);
47105        });
47106      }, [registry, registerRoute2]);
47107    }
47108  
47109    // packages/edit-site/build-module/components/app/index.mjs
47110    var import_jsx_runtime301 = __toESM(require_jsx_runtime(), 1);
47111    var { RouterProvider } = unlock(import_router42.privateApis);
47112    function AppLayout() {
47113      useCommonCommands();
47114      useSetCommandContext();
47115      return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(LayoutWithGlobalStylesProvider, {});
47116    }
47117    function App() {
47118      useRegisterSiteEditorRoutes();
47119      const { routes: routes3, currentTheme, editorSettings } = (0, import_data83.useSelect)((select3) => {
47120        return {
47121          routes: unlock(select3(store)).getRoutes(),
47122          currentTheme: select3(import_core_data65.store).getCurrentTheme(),
47123          // This is a temp solution until the has_theme_json value is available for the current theme.
47124          editorSettings: select3(store).getSettings()
47125        };
47126      }, []);
47127      const beforeNavigate = (0, import_element161.useCallback)(({ path, query }) => {
47128        if (!isPreviewingTheme()) {
47129          return { path, query };
47130        }
47131        return {
47132          path,
47133          query: {
47134            ...query,
47135            wp_theme_preview: "wp_theme_preview" in query ? query.wp_theme_preview : currentlyPreviewingTheme()
47136          }
47137        };
47138      }, []);
47139      const matchResolverArgsValue = (0, import_element161.useMemo)(
47140        () => ({
47141          siteData: { currentTheme, editorSettings }
47142        }),
47143        [currentTheme, editorSettings]
47144      );
47145      return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(
47146        RouterProvider,
47147        {
47148          routes: routes3,
47149          pathArg: "p",
47150          beforeNavigate,
47151          matchResolverArgs: matchResolverArgsValue,
47152          children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)(AppLayout, {})
47153        }
47154      );
47155    }
47156  
47157    // packages/edit-site/build-module/deprecated.mjs
47158    var import_editor45 = __toESM(require_editor(), 1);
47159    var import_url28 = __toESM(require_url(), 1);
47160    var import_deprecated5 = __toESM(require_deprecated(), 1);
47161    var import_jsx_runtime302 = __toESM(require_jsx_runtime(), 1);
47162    var isSiteEditor = (0, import_url28.getPath)(window.location.href)?.includes(
47163      "site-editor.php"
47164    );
47165    var deprecateSlot = (name2) => {
47166      (0, import_deprecated5.default)(`wp.editPost.$name2}`, {
47167        since: "6.6",
47168        alternative: `wp.editor.$name2}`
47169      });
47170    };
47171    function PluginMoreMenuItem(props) {
47172      if (!isSiteEditor) {
47173        return null;
47174      }
47175      deprecateSlot("PluginMoreMenuItem");
47176      return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(import_editor45.PluginMoreMenuItem, { ...props });
47177    }
47178    function PluginSidebar(props) {
47179      if (!isSiteEditor) {
47180        return null;
47181      }
47182      deprecateSlot("PluginSidebar");
47183      return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(import_editor45.PluginSidebar, { ...props });
47184    }
47185    function PluginSidebarMoreMenuItem(props) {
47186      if (!isSiteEditor) {
47187        return null;
47188      }
47189      deprecateSlot("PluginSidebarMoreMenuItem");
47190      return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(import_editor45.PluginSidebarMoreMenuItem, { ...props });
47191    }
47192  
47193    // packages/edit-site/build-module/index.mjs
47194    var import_jsx_runtime303 = __toESM(require_jsx_runtime(), 1);
47195    var { registerCoreBlockBindingsSources } = unlock(import_editor46.privateApis);
47196    function initializeEditor(id, settings2) {
47197      const target = document.getElementById(id);
47198      const root = (0, import_element162.createRoot)(target);
47199      (0, import_data84.dispatch)(import_blocks15.store).reapplyBlockTypeFilters();
47200      const coreBlocks = (0, import_block_library3.__experimentalGetCoreBlocks)().filter(
47201        ({ name: name2 }) => name2 !== "core/freeform"
47202      );
47203      (0, import_block_library3.registerCoreBlocks)(coreBlocks);
47204      registerCoreBlockBindingsSources();
47205      (0, import_data84.dispatch)(import_blocks15.store).setFreeformFallbackBlockName("core/html");
47206      (0, import_widgets.registerLegacyWidgetBlock)({ inserter: false });
47207      (0, import_widgets.registerWidgetGroupBlock)({ inserter: false });
47208      if (false) {
47209        (0, import_block_library3.__experimentalRegisterExperimentalCoreBlocks)({
47210          enableFSEBlocks: true
47211        });
47212      }
47213      (0, import_data84.dispatch)(import_preferences13.store).setDefaults("core/edit-site", {
47214        welcomeGuide: true,
47215        welcomeGuideStyles: true,
47216        welcomeGuidePage: true,
47217        welcomeGuideTemplate: true
47218      });
47219      (0, import_data84.dispatch)(import_preferences13.store).setDefaults("core", {
47220        allowRightClickOverrides: true,
47221        distractionFree: false,
47222        editorMode: "visual",
47223        editorTool: "edit",
47224        fixedToolbar: false,
47225        focusMode: false,
47226        inactivePanels: [],
47227        keepCaretInsideBlock: false,
47228        openPanels: ["post-status"],
47229        showBlockBreadcrumbs: true,
47230        showListViewByDefault: false,
47231        enableChoosePatternModal: true,
47232        showCollaborationCursor: false,
47233        showCollaborationNotifications: true
47234      });
47235      if (window.__clientSideMediaProcessing) {
47236        (0, import_data84.dispatch)(import_preferences13.store).setDefaults("core/media", {
47237          requireApproval: true,
47238          optimizeOnUpload: true
47239        });
47240      }
47241      (0, import_data84.dispatch)(store).updateSettings(settings2);
47242      window.addEventListener("dragover", (e2) => e2.preventDefault(), false);
47243      window.addEventListener("drop", (e2) => e2.preventDefault(), false);
47244      root.render(
47245        /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(import_element162.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(App, {}) })
47246      );
47247      return root;
47248    }
47249    function reinitializeEditor() {
47250      (0, import_deprecated6.default)("wp.editSite.reinitializeEditor", {
47251        since: "6.2",
47252        version: "6.3"
47253      });
47254    }
47255    return __toCommonJS(index_exports);
47256  })();
47257  /*! Bundled license information:
47258  
47259  use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
47260    (**
47261     * @license React
47262     * use-sync-external-store-shim.development.js
47263     *
47264     * Copyright (c) Meta Platforms, Inc. and affiliates.
47265     *
47266     * This source code is licensed under the MIT license found in the
47267     * LICENSE file in the root directory of this source tree.
47268     *)
47269  
47270  is-plain-object/dist/is-plain-object.mjs:
47271    (*!
47272     * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
47273     *
47274     * Copyright (c) 2014-2017, Jon Schlinkert.
47275     * Released under the MIT License.
47276     *)
47277  */


Generated : Sat Jun 20 08:20:11 2026 Cross-referenced by PHPXref