[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> compose.js (source)

   1  "use strict";
   2  var wp;
   3  (wp ||= {}).compose = (() => {
   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 __commonJS = (cb, mod) => function __require() {
  11      return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  12    };
  13    var __export = (target, all) => {
  14      for (var name in all)
  15        __defProp(target, name, { get: all[name], enumerable: true });
  16    };
  17    var __copyProps = (to, from, except, desc) => {
  18      if (from && typeof from === "object" || typeof from === "function") {
  19        for (let key of __getOwnPropNames(from))
  20          if (!__hasOwnProp.call(to, key) && key !== except)
  21            __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  22      }
  23      return to;
  24    };
  25    var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  26      // If the importer is in node compatibility mode or this is not an ESM
  27      // file that has been converted to a CommonJS file using a Babel-
  28      // compatible transform (i.e. "__esModule" has not been set), then set
  29      // "default" to the CommonJS "module.exports" for node compatibility.
  30      isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  31      mod
  32    ));
  33    var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  34  
  35    // vendor-external:react/jsx-runtime
  36    var require_jsx_runtime = __commonJS({
  37      "vendor-external:react/jsx-runtime"(exports, module) {
  38        module.exports = window.ReactJSXRuntime;
  39      }
  40    });
  41  
  42    // package-external:@wordpress/is-shallow-equal
  43    var require_is_shallow_equal = __commonJS({
  44      "package-external:@wordpress/is-shallow-equal"(exports, module) {
  45        module.exports = window.wp.isShallowEqual;
  46      }
  47    });
  48  
  49    // package-external:@wordpress/element
  50    var require_element = __commonJS({
  51      "package-external:@wordpress/element"(exports, module) {
  52        module.exports = window.wp.element;
  53      }
  54    });
  55  
  56    // package-external:@wordpress/deprecated
  57    var require_deprecated = __commonJS({
  58      "package-external:@wordpress/deprecated"(exports, module) {
  59        module.exports = window.wp.deprecated;
  60      }
  61    });
  62  
  63    // package-external:@wordpress/dom
  64    var require_dom = __commonJS({
  65      "package-external:@wordpress/dom"(exports, module) {
  66        module.exports = window.wp.dom;
  67      }
  68    });
  69  
  70    // packages/compose/node_modules/clipboard/dist/clipboard.js
  71    var require_clipboard = __commonJS({
  72      "packages/compose/node_modules/clipboard/dist/clipboard.js"(exports, module) {
  73        (function webpackUniversalModuleDefinition(root, factory) {
  74          if (typeof exports === "object" && typeof module === "object")
  75            module.exports = factory();
  76          else if (typeof define === "function" && define.amd)
  77            define([], factory);
  78          else if (typeof exports === "object")
  79            exports["ClipboardJS"] = factory();
  80          else
  81            root["ClipboardJS"] = factory();
  82        })(exports, function() {
  83          return (
  84            /******/
  85            (function() {
  86              var __webpack_modules__ = {
  87                /***/
  88                686: (
  89                  /***/
  90                  (function(__unused_webpack_module, __webpack_exports__, __webpack_require__2) {
  91                    "use strict";
  92                    __webpack_require__2.d(__webpack_exports__, {
  93                      "default": function() {
  94                        return (
  95                          /* binding */
  96                          clipboard
  97                        );
  98                      }
  99                    });
 100                    var tiny_emitter = __webpack_require__2(279);
 101                    var tiny_emitter_default = /* @__PURE__ */ __webpack_require__2.n(tiny_emitter);
 102                    var listen = __webpack_require__2(370);
 103                    var listen_default = /* @__PURE__ */ __webpack_require__2.n(listen);
 104                    var src_select = __webpack_require__2(817);
 105                    var select_default = /* @__PURE__ */ __webpack_require__2.n(src_select);
 106                    ;
 107                    function command(type) {
 108                      try {
 109                        return document.execCommand(type);
 110                      } catch (err) {
 111                        return false;
 112                      }
 113                    }
 114                    ;
 115                    var ClipboardActionCut = function ClipboardActionCut2(target) {
 116                      var selectedText = select_default()(target);
 117                      command("cut");
 118                      return selectedText;
 119                    };
 120                    var actions_cut = ClipboardActionCut;
 121                    ;
 122                    function createFakeElement(value) {
 123                      var isRTL = document.documentElement.getAttribute("dir") === "rtl";
 124                      var fakeElement = document.createElement("textarea");
 125                      fakeElement.style.fontSize = "12pt";
 126                      fakeElement.style.border = "0";
 127                      fakeElement.style.padding = "0";
 128                      fakeElement.style.margin = "0";
 129                      fakeElement.style.position = "absolute";
 130                      fakeElement.style[isRTL ? "right" : "left"] = "-9999px";
 131                      var yPosition = window.pageYOffset || document.documentElement.scrollTop;
 132                      fakeElement.style.top = "".concat(yPosition, "px");
 133                      fakeElement.setAttribute("readonly", "");
 134                      fakeElement.value = value;
 135                      return fakeElement;
 136                    }
 137                    ;
 138                    var fakeCopyAction = function fakeCopyAction2(value, options) {
 139                      var fakeElement = createFakeElement(value);
 140                      options.container.appendChild(fakeElement);
 141                      var selectedText = select_default()(fakeElement);
 142                      command("copy");
 143                      fakeElement.remove();
 144                      return selectedText;
 145                    };
 146                    var ClipboardActionCopy = function ClipboardActionCopy2(target) {
 147                      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
 148                        container: document.body
 149                      };
 150                      var selectedText = "";
 151                      if (typeof target === "string") {
 152                        selectedText = fakeCopyAction(target, options);
 153                      } else if (target instanceof HTMLInputElement && !["text", "search", "url", "tel", "password"].includes(target === null || target === void 0 ? void 0 : target.type)) {
 154                        selectedText = fakeCopyAction(target.value, options);
 155                      } else {
 156                        selectedText = select_default()(target);
 157                        command("copy");
 158                      }
 159                      return selectedText;
 160                    };
 161                    var actions_copy = ClipboardActionCopy;
 162                    ;
 163                    function _typeof(obj) {
 164                      "@babel/helpers - typeof";
 165                      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
 166                        _typeof = function _typeof2(obj2) {
 167                          return typeof obj2;
 168                        };
 169                      } else {
 170                        _typeof = function _typeof2(obj2) {
 171                          return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
 172                        };
 173                      }
 174                      return _typeof(obj);
 175                    }
 176                    var ClipboardActionDefault = function ClipboardActionDefault2() {
 177                      var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
 178                      var _options$action = options.action, action = _options$action === void 0 ? "copy" : _options$action, container = options.container, target = options.target, text = options.text;
 179                      if (action !== "copy" && action !== "cut") {
 180                        throw new Error('Invalid "action" value, use either "copy" or "cut"');
 181                      }
 182                      if (target !== void 0) {
 183                        if (target && _typeof(target) === "object" && target.nodeType === 1) {
 184                          if (action === "copy" && target.hasAttribute("disabled")) {
 185                            throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
 186                          }
 187                          if (action === "cut" && (target.hasAttribute("readonly") || target.hasAttribute("disabled"))) {
 188                            throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`);
 189                          }
 190                        } else {
 191                          throw new Error('Invalid "target" value, use a valid Element');
 192                        }
 193                      }
 194                      if (text) {
 195                        return actions_copy(text, {
 196                          container
 197                        });
 198                      }
 199                      if (target) {
 200                        return action === "cut" ? actions_cut(target) : actions_copy(target, {
 201                          container
 202                        });
 203                      }
 204                    };
 205                    var actions_default = ClipboardActionDefault;
 206                    ;
 207                    function clipboard_typeof(obj) {
 208                      "@babel/helpers - typeof";
 209                      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
 210                        clipboard_typeof = function _typeof2(obj2) {
 211                          return typeof obj2;
 212                        };
 213                      } else {
 214                        clipboard_typeof = function _typeof2(obj2) {
 215                          return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
 216                        };
 217                      }
 218                      return clipboard_typeof(obj);
 219                    }
 220                    function _classCallCheck(instance, Constructor) {
 221                      if (!(instance instanceof Constructor)) {
 222                        throw new TypeError("Cannot call a class as a function");
 223                      }
 224                    }
 225                    function _defineProperties(target, props) {
 226                      for (var i = 0; i < props.length; i++) {
 227                        var descriptor = props[i];
 228                        descriptor.enumerable = descriptor.enumerable || false;
 229                        descriptor.configurable = true;
 230                        if ("value" in descriptor) descriptor.writable = true;
 231                        Object.defineProperty(target, descriptor.key, descriptor);
 232                      }
 233                    }
 234                    function _createClass(Constructor, protoProps, staticProps) {
 235                      if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 236                      if (staticProps) _defineProperties(Constructor, staticProps);
 237                      return Constructor;
 238                    }
 239                    function _inherits(subClass, superClass) {
 240                      if (typeof superClass !== "function" && superClass !== null) {
 241                        throw new TypeError("Super expression must either be null or a function");
 242                      }
 243                      subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
 244                      if (superClass) _setPrototypeOf(subClass, superClass);
 245                    }
 246                    function _setPrototypeOf(o, p) {
 247                      _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
 248                        o2.__proto__ = p2;
 249                        return o2;
 250                      };
 251                      return _setPrototypeOf(o, p);
 252                    }
 253                    function _createSuper(Derived) {
 254                      var hasNativeReflectConstruct = _isNativeReflectConstruct();
 255                      return function _createSuperInternal() {
 256                        var Super = _getPrototypeOf(Derived), result;
 257                        if (hasNativeReflectConstruct) {
 258                          var NewTarget = _getPrototypeOf(this).constructor;
 259                          result = Reflect.construct(Super, arguments, NewTarget);
 260                        } else {
 261                          result = Super.apply(this, arguments);
 262                        }
 263                        return _possibleConstructorReturn(this, result);
 264                      };
 265                    }
 266                    function _possibleConstructorReturn(self, call) {
 267                      if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) {
 268                        return call;
 269                      }
 270                      return _assertThisInitialized(self);
 271                    }
 272                    function _assertThisInitialized(self) {
 273                      if (self === void 0) {
 274                        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
 275                      }
 276                      return self;
 277                    }
 278                    function _isNativeReflectConstruct() {
 279                      if (typeof Reflect === "undefined" || !Reflect.construct) return false;
 280                      if (Reflect.construct.sham) return false;
 281                      if (typeof Proxy === "function") return true;
 282                      try {
 283                        Date.prototype.toString.call(Reflect.construct(Date, [], function() {
 284                        }));
 285                        return true;
 286                      } catch (e) {
 287                        return false;
 288                      }
 289                    }
 290                    function _getPrototypeOf(o) {
 291                      _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
 292                        return o2.__proto__ || Object.getPrototypeOf(o2);
 293                      };
 294                      return _getPrototypeOf(o);
 295                    }
 296                    function getAttributeValue(suffix, element) {
 297                      var attribute = "data-clipboard-".concat(suffix);
 298                      if (!element.hasAttribute(attribute)) {
 299                        return;
 300                      }
 301                      return element.getAttribute(attribute);
 302                    }
 303                    var Clipboard3 = /* @__PURE__ */ (function(_Emitter) {
 304                      _inherits(Clipboard4, _Emitter);
 305                      var _super = _createSuper(Clipboard4);
 306                      function Clipboard4(trigger, options) {
 307                        var _this;
 308                        _classCallCheck(this, Clipboard4);
 309                        _this = _super.call(this);
 310                        _this.resolveOptions(options);
 311                        _this.listenClick(trigger);
 312                        return _this;
 313                      }
 314                      _createClass(Clipboard4, [{
 315                        key: "resolveOptions",
 316                        value: function resolveOptions() {
 317                          var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
 318                          this.action = typeof options.action === "function" ? options.action : this.defaultAction;
 319                          this.target = typeof options.target === "function" ? options.target : this.defaultTarget;
 320                          this.text = typeof options.text === "function" ? options.text : this.defaultText;
 321                          this.container = clipboard_typeof(options.container) === "object" ? options.container : document.body;
 322                        }
 323                        /**
 324                         * Adds a click event listener to the passed trigger.
 325                         * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
 326                         */
 327                      }, {
 328                        key: "listenClick",
 329                        value: function listenClick(trigger) {
 330                          var _this2 = this;
 331                          this.listener = listen_default()(trigger, "click", function(e) {
 332                            return _this2.onClick(e);
 333                          });
 334                        }
 335                        /**
 336                         * Defines a new `ClipboardAction` on each click event.
 337                         * @param {Event} e
 338                         */
 339                      }, {
 340                        key: "onClick",
 341                        value: function onClick(e) {
 342                          var trigger = e.delegateTarget || e.currentTarget;
 343                          var action = this.action(trigger) || "copy";
 344                          var text = actions_default({
 345                            action,
 346                            container: this.container,
 347                            target: this.target(trigger),
 348                            text: this.text(trigger)
 349                          });
 350                          this.emit(text ? "success" : "error", {
 351                            action,
 352                            text,
 353                            trigger,
 354                            clearSelection: function clearSelection() {
 355                              if (trigger) {
 356                                trigger.focus();
 357                              }
 358                              window.getSelection().removeAllRanges();
 359                            }
 360                          });
 361                        }
 362                        /**
 363                         * Default `action` lookup function.
 364                         * @param {Element} trigger
 365                         */
 366                      }, {
 367                        key: "defaultAction",
 368                        value: function defaultAction(trigger) {
 369                          return getAttributeValue("action", trigger);
 370                        }
 371                        /**
 372                         * Default `target` lookup function.
 373                         * @param {Element} trigger
 374                         */
 375                      }, {
 376                        key: "defaultTarget",
 377                        value: function defaultTarget(trigger) {
 378                          var selector = getAttributeValue("target", trigger);
 379                          if (selector) {
 380                            return document.querySelector(selector);
 381                          }
 382                        }
 383                        /**
 384                         * Allow fire programmatically a copy action
 385                         * @param {String|HTMLElement} target
 386                         * @param {Object} options
 387                         * @returns Text copied.
 388                         */
 389                      }, {
 390                        key: "defaultText",
 391                        /**
 392                         * Default `text` lookup function.
 393                         * @param {Element} trigger
 394                         */
 395                        value: function defaultText(trigger) {
 396                          return getAttributeValue("text", trigger);
 397                        }
 398                        /**
 399                         * Destroy lifecycle.
 400                         */
 401                      }, {
 402                        key: "destroy",
 403                        value: function destroy() {
 404                          this.listener.destroy();
 405                        }
 406                      }], [{
 407                        key: "copy",
 408                        value: function copy(target) {
 409                          var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
 410                            container: document.body
 411                          };
 412                          return actions_copy(target, options);
 413                        }
 414                        /**
 415                         * Allow fire programmatically a cut action
 416                         * @param {String|HTMLElement} target
 417                         * @returns Text cutted.
 418                         */
 419                      }, {
 420                        key: "cut",
 421                        value: function cut(target) {
 422                          return actions_cut(target);
 423                        }
 424                        /**
 425                         * Returns the support of the given action, or all actions if no action is
 426                         * given.
 427                         * @param {String} [action]
 428                         */
 429                      }, {
 430                        key: "isSupported",
 431                        value: function isSupported() {
 432                          var action = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ["copy", "cut"];
 433                          var actions = typeof action === "string" ? [action] : action;
 434                          var support = !!document.queryCommandSupported;
 435                          actions.forEach(function(action2) {
 436                            support = support && !!document.queryCommandSupported(action2);
 437                          });
 438                          return support;
 439                        }
 440                      }]);
 441                      return Clipboard4;
 442                    })(tiny_emitter_default());
 443                    var clipboard = Clipboard3;
 444                  })
 445                ),
 446                /***/
 447                828: (
 448                  /***/
 449                  (function(module2) {
 450                    var DOCUMENT_NODE_TYPE = 9;
 451                    if (typeof Element !== "undefined" && !Element.prototype.matches) {
 452                      var proto = Element.prototype;
 453                      proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector;
 454                    }
 455                    function closest(element, selector) {
 456                      while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
 457                        if (typeof element.matches === "function" && element.matches(selector)) {
 458                          return element;
 459                        }
 460                        element = element.parentNode;
 461                      }
 462                    }
 463                    module2.exports = closest;
 464                  })
 465                ),
 466                /***/
 467                438: (
 468                  /***/
 469                  (function(module2, __unused_webpack_exports, __webpack_require__2) {
 470                    var closest = __webpack_require__2(828);
 471                    function _delegate(element, selector, type, callback, useCapture) {
 472                      var listenerFn = listener2.apply(this, arguments);
 473                      element.addEventListener(type, listenerFn, useCapture);
 474                      return {
 475                        destroy: function() {
 476                          element.removeEventListener(type, listenerFn, useCapture);
 477                        }
 478                      };
 479                    }
 480                    function delegate(elements, selector, type, callback, useCapture) {
 481                      if (typeof elements.addEventListener === "function") {
 482                        return _delegate.apply(null, arguments);
 483                      }
 484                      if (typeof type === "function") {
 485                        return _delegate.bind(null, document).apply(null, arguments);
 486                      }
 487                      if (typeof elements === "string") {
 488                        elements = document.querySelectorAll(elements);
 489                      }
 490                      return Array.prototype.map.call(elements, function(element) {
 491                        return _delegate(element, selector, type, callback, useCapture);
 492                      });
 493                    }
 494                    function listener2(element, selector, type, callback) {
 495                      return function(e) {
 496                        e.delegateTarget = closest(e.target, selector);
 497                        if (e.delegateTarget) {
 498                          callback.call(element, e);
 499                        }
 500                      };
 501                    }
 502                    module2.exports = delegate;
 503                  })
 504                ),
 505                /***/
 506                879: (
 507                  /***/
 508                  (function(__unused_webpack_module, exports2) {
 509                    exports2.node = function(value) {
 510                      return value !== void 0 && value instanceof HTMLElement && value.nodeType === 1;
 511                    };
 512                    exports2.nodeList = function(value) {
 513                      var type = Object.prototype.toString.call(value);
 514                      return value !== void 0 && (type === "[object NodeList]" || type === "[object HTMLCollection]") && "length" in value && (value.length === 0 || exports2.node(value[0]));
 515                    };
 516                    exports2.string = function(value) {
 517                      return typeof value === "string" || value instanceof String;
 518                    };
 519                    exports2.fn = function(value) {
 520                      var type = Object.prototype.toString.call(value);
 521                      return type === "[object Function]";
 522                    };
 523                  })
 524                ),
 525                /***/
 526                370: (
 527                  /***/
 528                  (function(module2, __unused_webpack_exports, __webpack_require__2) {
 529                    var is = __webpack_require__2(879);
 530                    var delegate = __webpack_require__2(438);
 531                    function listen(target, type, callback) {
 532                      if (!target && !type && !callback) {
 533                        throw new Error("Missing required arguments");
 534                      }
 535                      if (!is.string(type)) {
 536                        throw new TypeError("Second argument must be a String");
 537                      }
 538                      if (!is.fn(callback)) {
 539                        throw new TypeError("Third argument must be a Function");
 540                      }
 541                      if (is.node(target)) {
 542                        return listenNode(target, type, callback);
 543                      } else if (is.nodeList(target)) {
 544                        return listenNodeList(target, type, callback);
 545                      } else if (is.string(target)) {
 546                        return listenSelector(target, type, callback);
 547                      } else {
 548                        throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");
 549                      }
 550                    }
 551                    function listenNode(node, type, callback) {
 552                      node.addEventListener(type, callback);
 553                      return {
 554                        destroy: function() {
 555                          node.removeEventListener(type, callback);
 556                        }
 557                      };
 558                    }
 559                    function listenNodeList(nodeList, type, callback) {
 560                      Array.prototype.forEach.call(nodeList, function(node) {
 561                        node.addEventListener(type, callback);
 562                      });
 563                      return {
 564                        destroy: function() {
 565                          Array.prototype.forEach.call(nodeList, function(node) {
 566                            node.removeEventListener(type, callback);
 567                          });
 568                        }
 569                      };
 570                    }
 571                    function listenSelector(selector, type, callback) {
 572                      return delegate(document.body, selector, type, callback);
 573                    }
 574                    module2.exports = listen;
 575                  })
 576                ),
 577                /***/
 578                817: (
 579                  /***/
 580                  (function(module2) {
 581                    function select(element) {
 582                      var selectedText;
 583                      if (element.nodeName === "SELECT") {
 584                        element.focus();
 585                        selectedText = element.value;
 586                      } else if (element.nodeName === "INPUT" || element.nodeName === "TEXTAREA") {
 587                        var isReadOnly = element.hasAttribute("readonly");
 588                        if (!isReadOnly) {
 589                          element.setAttribute("readonly", "");
 590                        }
 591                        element.select();
 592                        element.setSelectionRange(0, element.value.length);
 593                        if (!isReadOnly) {
 594                          element.removeAttribute("readonly");
 595                        }
 596                        selectedText = element.value;
 597                      } else {
 598                        if (element.hasAttribute("contenteditable")) {
 599                          element.focus();
 600                        }
 601                        var selection = window.getSelection();
 602                        var range = document.createRange();
 603                        range.selectNodeContents(element);
 604                        selection.removeAllRanges();
 605                        selection.addRange(range);
 606                        selectedText = selection.toString();
 607                      }
 608                      return selectedText;
 609                    }
 610                    module2.exports = select;
 611                  })
 612                ),
 613                /***/
 614                279: (
 615                  /***/
 616                  (function(module2) {
 617                    function E() {
 618                    }
 619                    E.prototype = {
 620                      on: function(name, callback, ctx) {
 621                        var e = this.e || (this.e = {});
 622                        (e[name] || (e[name] = [])).push({
 623                          fn: callback,
 624                          ctx
 625                        });
 626                        return this;
 627                      },
 628                      once: function(name, callback, ctx) {
 629                        var self = this;
 630                        function listener2() {
 631                          self.off(name, listener2);
 632                          callback.apply(ctx, arguments);
 633                        }
 634                        ;
 635                        listener2._ = callback;
 636                        return this.on(name, listener2, ctx);
 637                      },
 638                      emit: function(name) {
 639                        var data = [].slice.call(arguments, 1);
 640                        var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
 641                        var i = 0;
 642                        var len = evtArr.length;
 643                        for (i; i < len; i++) {
 644                          evtArr[i].fn.apply(evtArr[i].ctx, data);
 645                        }
 646                        return this;
 647                      },
 648                      off: function(name, callback) {
 649                        var e = this.e || (this.e = {});
 650                        var evts = e[name];
 651                        var liveEvents = [];
 652                        if (evts && callback) {
 653                          for (var i = 0, len = evts.length; i < len; i++) {
 654                            if (evts[i].fn !== callback && evts[i].fn._ !== callback)
 655                              liveEvents.push(evts[i]);
 656                          }
 657                        }
 658                        liveEvents.length ? e[name] = liveEvents : delete e[name];
 659                        return this;
 660                      }
 661                    };
 662                    module2.exports = E;
 663                    module2.exports.TinyEmitter = E;
 664                  })
 665                )
 666                /******/
 667              };
 668              var __webpack_module_cache__ = {};
 669              function __webpack_require__(moduleId) {
 670                if (__webpack_module_cache__[moduleId]) {
 671                  return __webpack_module_cache__[moduleId].exports;
 672                }
 673                var module2 = __webpack_module_cache__[moduleId] = {
 674                  /******/
 675                  // no module.id needed
 676                  /******/
 677                  // no module.loaded needed
 678                  /******/
 679                  exports: {}
 680                  /******/
 681                };
 682                __webpack_modules__[moduleId](module2, module2.exports, __webpack_require__);
 683                return module2.exports;
 684              }
 685              !(function() {
 686                __webpack_require__.n = function(module2) {
 687                  var getter = module2 && module2.__esModule ? (
 688                    /******/
 689                    function() {
 690                      return module2["default"];
 691                    }
 692                  ) : (
 693                    /******/
 694                    function() {
 695                      return module2;
 696                    }
 697                  );
 698                  __webpack_require__.d(getter, { a: getter });
 699                  return getter;
 700                };
 701              })();
 702              !(function() {
 703                __webpack_require__.d = function(exports2, definition) {
 704                  for (var key in definition) {
 705                    if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports2, key)) {
 706                      Object.defineProperty(exports2, key, { enumerable: true, get: definition[key] });
 707                    }
 708                  }
 709                };
 710              })();
 711              !(function() {
 712                __webpack_require__.o = function(obj, prop) {
 713                  return Object.prototype.hasOwnProperty.call(obj, prop);
 714                };
 715              })();
 716              return __webpack_require__(686);
 717            })().default
 718          );
 719        });
 720      }
 721    });
 722  
 723    // package-external:@wordpress/keycodes
 724    var require_keycodes = __commonJS({
 725      "package-external:@wordpress/keycodes"(exports, module) {
 726        module.exports = window.wp.keycodes;
 727      }
 728    });
 729  
 730    // node_modules/mousetrap/mousetrap.js
 731    var require_mousetrap = __commonJS({
 732      "node_modules/mousetrap/mousetrap.js"(exports, module) {
 733        (function(window2, document2, undefined2) {
 734          if (!window2) {
 735            return;
 736          }
 737          var _MAP = {
 738            8: "backspace",
 739            9: "tab",
 740            13: "enter",
 741            16: "shift",
 742            17: "ctrl",
 743            18: "alt",
 744            20: "capslock",
 745            27: "esc",
 746            32: "space",
 747            33: "pageup",
 748            34: "pagedown",
 749            35: "end",
 750            36: "home",
 751            37: "left",
 752            38: "up",
 753            39: "right",
 754            40: "down",
 755            45: "ins",
 756            46: "del",
 757            91: "meta",
 758            93: "meta",
 759            224: "meta"
 760          };
 761          var _KEYCODE_MAP = {
 762            106: "*",
 763            107: "+",
 764            109: "-",
 765            110: ".",
 766            111: "/",
 767            186: ";",
 768            187: "=",
 769            188: ",",
 770            189: "-",
 771            190: ".",
 772            191: "/",
 773            192: "`",
 774            219: "[",
 775            220: "\\",
 776            221: "]",
 777            222: "'"
 778          };
 779          var _SHIFT_MAP = {
 780            "~": "`",
 781            "!": "1",
 782            "@": "2",
 783            "#": "3",
 784            "$": "4",
 785            "%": "5",
 786            "^": "6",
 787            "&": "7",
 788            "*": "8",
 789            "(": "9",
 790            ")": "0",
 791            "_": "-",
 792            "+": "=",
 793            ":": ";",
 794            '"': "'",
 795            "<": ",",
 796            ">": ".",
 797            "?": "/",
 798            "|": "\\"
 799          };
 800          var _SPECIAL_ALIASES = {
 801            "option": "alt",
 802            "command": "meta",
 803            "return": "enter",
 804            "escape": "esc",
 805            "plus": "+",
 806            "mod": /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? "meta" : "ctrl"
 807          };
 808          var _REVERSE_MAP;
 809          for (var i = 1; i < 20; ++i) {
 810            _MAP[111 + i] = "f" + i;
 811          }
 812          for (i = 0; i <= 9; ++i) {
 813            _MAP[i + 96] = i.toString();
 814          }
 815          function _addEvent(object, type, callback) {
 816            if (object.addEventListener) {
 817              object.addEventListener(type, callback, false);
 818              return;
 819            }
 820            object.attachEvent("on" + type, callback);
 821          }
 822          function _characterFromEvent(e) {
 823            if (e.type == "keypress") {
 824              var character = String.fromCharCode(e.which);
 825              if (!e.shiftKey) {
 826                character = character.toLowerCase();
 827              }
 828              return character;
 829            }
 830            if (_MAP[e.which]) {
 831              return _MAP[e.which];
 832            }
 833            if (_KEYCODE_MAP[e.which]) {
 834              return _KEYCODE_MAP[e.which];
 835            }
 836            return String.fromCharCode(e.which).toLowerCase();
 837          }
 838          function _modifiersMatch(modifiers1, modifiers2) {
 839            return modifiers1.sort().join(",") === modifiers2.sort().join(",");
 840          }
 841          function _eventModifiers(e) {
 842            var modifiers = [];
 843            if (e.shiftKey) {
 844              modifiers.push("shift");
 845            }
 846            if (e.altKey) {
 847              modifiers.push("alt");
 848            }
 849            if (e.ctrlKey) {
 850              modifiers.push("ctrl");
 851            }
 852            if (e.metaKey) {
 853              modifiers.push("meta");
 854            }
 855            return modifiers;
 856          }
 857          function _preventDefault(e) {
 858            if (e.preventDefault) {
 859              e.preventDefault();
 860              return;
 861            }
 862            e.returnValue = false;
 863          }
 864          function _stopPropagation(e) {
 865            if (e.stopPropagation) {
 866              e.stopPropagation();
 867              return;
 868            }
 869            e.cancelBubble = true;
 870          }
 871          function _isModifier(key) {
 872            return key == "shift" || key == "ctrl" || key == "alt" || key == "meta";
 873          }
 874          function _getReverseMap() {
 875            if (!_REVERSE_MAP) {
 876              _REVERSE_MAP = {};
 877              for (var key in _MAP) {
 878                if (key > 95 && key < 112) {
 879                  continue;
 880                }
 881                if (_MAP.hasOwnProperty(key)) {
 882                  _REVERSE_MAP[_MAP[key]] = key;
 883                }
 884              }
 885            }
 886            return _REVERSE_MAP;
 887          }
 888          function _pickBestAction(key, modifiers, action) {
 889            if (!action) {
 890              action = _getReverseMap()[key] ? "keydown" : "keypress";
 891            }
 892            if (action == "keypress" && modifiers.length) {
 893              action = "keydown";
 894            }
 895            return action;
 896          }
 897          function _keysFromString(combination) {
 898            if (combination === "+") {
 899              return ["+"];
 900            }
 901            combination = combination.replace(/\+{2}/g, "+plus");
 902            return combination.split("+");
 903          }
 904          function _getKeyInfo(combination, action) {
 905            var keys;
 906            var key;
 907            var i2;
 908            var modifiers = [];
 909            keys = _keysFromString(combination);
 910            for (i2 = 0; i2 < keys.length; ++i2) {
 911              key = keys[i2];
 912              if (_SPECIAL_ALIASES[key]) {
 913                key = _SPECIAL_ALIASES[key];
 914              }
 915              if (action && action != "keypress" && _SHIFT_MAP[key]) {
 916                key = _SHIFT_MAP[key];
 917                modifiers.push("shift");
 918              }
 919              if (_isModifier(key)) {
 920                modifiers.push(key);
 921              }
 922            }
 923            action = _pickBestAction(key, modifiers, action);
 924            return {
 925              key,
 926              modifiers,
 927              action
 928            };
 929          }
 930          function _belongsTo(element, ancestor) {
 931            if (element === null || element === document2) {
 932              return false;
 933            }
 934            if (element === ancestor) {
 935              return true;
 936            }
 937            return _belongsTo(element.parentNode, ancestor);
 938          }
 939          function Mousetrap3(targetElement) {
 940            var self = this;
 941            targetElement = targetElement || document2;
 942            if (!(self instanceof Mousetrap3)) {
 943              return new Mousetrap3(targetElement);
 944            }
 945            self.target = targetElement;
 946            self._callbacks = {};
 947            self._directMap = {};
 948            var _sequenceLevels = {};
 949            var _resetTimer;
 950            var _ignoreNextKeyup = false;
 951            var _ignoreNextKeypress = false;
 952            var _nextExpectedAction = false;
 953            function _resetSequences(doNotReset) {
 954              doNotReset = doNotReset || {};
 955              var activeSequences = false, key;
 956              for (key in _sequenceLevels) {
 957                if (doNotReset[key]) {
 958                  activeSequences = true;
 959                  continue;
 960                }
 961                _sequenceLevels[key] = 0;
 962              }
 963              if (!activeSequences) {
 964                _nextExpectedAction = false;
 965              }
 966            }
 967            function _getMatches(character, modifiers, e, sequenceName, combination, level) {
 968              var i2;
 969              var callback;
 970              var matches = [];
 971              var action = e.type;
 972              if (!self._callbacks[character]) {
 973                return [];
 974              }
 975              if (action == "keyup" && _isModifier(character)) {
 976                modifiers = [character];
 977              }
 978              for (i2 = 0; i2 < self._callbacks[character].length; ++i2) {
 979                callback = self._callbacks[character][i2];
 980                if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
 981                  continue;
 982                }
 983                if (action != callback.action) {
 984                  continue;
 985                }
 986                if (action == "keypress" && !e.metaKey && !e.ctrlKey || _modifiersMatch(modifiers, callback.modifiers)) {
 987                  var deleteCombo = !sequenceName && callback.combo == combination;
 988                  var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
 989                  if (deleteCombo || deleteSequence) {
 990                    self._callbacks[character].splice(i2, 1);
 991                  }
 992                  matches.push(callback);
 993                }
 994              }
 995              return matches;
 996            }
 997            function _fireCallback(callback, e, combo, sequence) {
 998              if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
 999                return;
1000              }
1001              if (callback(e, combo) === false) {
1002                _preventDefault(e);
1003                _stopPropagation(e);
1004              }
1005            }
1006            self._handleKey = function(character, modifiers, e) {
1007              var callbacks = _getMatches(character, modifiers, e);
1008              var i2;
1009              var doNotReset = {};
1010              var maxLevel = 0;
1011              var processedSequenceCallback = false;
1012              for (i2 = 0; i2 < callbacks.length; ++i2) {
1013                if (callbacks[i2].seq) {
1014                  maxLevel = Math.max(maxLevel, callbacks[i2].level);
1015                }
1016              }
1017              for (i2 = 0; i2 < callbacks.length; ++i2) {
1018                if (callbacks[i2].seq) {
1019                  if (callbacks[i2].level != maxLevel) {
1020                    continue;
1021                  }
1022                  processedSequenceCallback = true;
1023                  doNotReset[callbacks[i2].seq] = 1;
1024                  _fireCallback(callbacks[i2].callback, e, callbacks[i2].combo, callbacks[i2].seq);
1025                  continue;
1026                }
1027                if (!processedSequenceCallback) {
1028                  _fireCallback(callbacks[i2].callback, e, callbacks[i2].combo);
1029                }
1030              }
1031              var ignoreThisKeypress = e.type == "keypress" && _ignoreNextKeypress;
1032              if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
1033                _resetSequences(doNotReset);
1034              }
1035              _ignoreNextKeypress = processedSequenceCallback && e.type == "keydown";
1036            };
1037            function _handleKeyEvent(e) {
1038              if (typeof e.which !== "number") {
1039                e.which = e.keyCode;
1040              }
1041              var character = _characterFromEvent(e);
1042              if (!character) {
1043                return;
1044              }
1045              if (e.type == "keyup" && _ignoreNextKeyup === character) {
1046                _ignoreNextKeyup = false;
1047                return;
1048              }
1049              self.handleKey(character, _eventModifiers(e), e);
1050            }
1051            function _resetSequenceTimer() {
1052              clearTimeout(_resetTimer);
1053              _resetTimer = setTimeout(_resetSequences, 1e3);
1054            }
1055            function _bindSequence(combo, keys, callback, action) {
1056              _sequenceLevels[combo] = 0;
1057              function _increaseSequence(nextAction) {
1058                return function() {
1059                  _nextExpectedAction = nextAction;
1060                  ++_sequenceLevels[combo];
1061                  _resetSequenceTimer();
1062                };
1063              }
1064              function _callbackAndReset(e) {
1065                _fireCallback(callback, e, combo);
1066                if (action !== "keyup") {
1067                  _ignoreNextKeyup = _characterFromEvent(e);
1068                }
1069                setTimeout(_resetSequences, 10);
1070              }
1071              for (var i2 = 0; i2 < keys.length; ++i2) {
1072                var isFinal = i2 + 1 === keys.length;
1073                var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i2 + 1]).action);
1074                _bindSingle(keys[i2], wrappedCallback, action, combo, i2);
1075              }
1076            }
1077            function _bindSingle(combination, callback, action, sequenceName, level) {
1078              self._directMap[combination + ":" + action] = callback;
1079              combination = combination.replace(/\s+/g, " ");
1080              var sequence = combination.split(" ");
1081              var info;
1082              if (sequence.length > 1) {
1083                _bindSequence(combination, sequence, callback, action);
1084                return;
1085              }
1086              info = _getKeyInfo(combination, action);
1087              self._callbacks[info.key] = self._callbacks[info.key] || [];
1088              _getMatches(info.key, info.modifiers, { type: info.action }, sequenceName, combination, level);
1089              self._callbacks[info.key][sequenceName ? "unshift" : "push"]({
1090                callback,
1091                modifiers: info.modifiers,
1092                action: info.action,
1093                seq: sequenceName,
1094                level,
1095                combo: combination
1096              });
1097            }
1098            self._bindMultiple = function(combinations, callback, action) {
1099              for (var i2 = 0; i2 < combinations.length; ++i2) {
1100                _bindSingle(combinations[i2], callback, action);
1101              }
1102            };
1103            _addEvent(targetElement, "keypress", _handleKeyEvent);
1104            _addEvent(targetElement, "keydown", _handleKeyEvent);
1105            _addEvent(targetElement, "keyup", _handleKeyEvent);
1106          }
1107          Mousetrap3.prototype.bind = function(keys, callback, action) {
1108            var self = this;
1109            keys = keys instanceof Array ? keys : [keys];
1110            self._bindMultiple.call(self, keys, callback, action);
1111            return self;
1112          };
1113          Mousetrap3.prototype.unbind = function(keys, action) {
1114            var self = this;
1115            return self.bind.call(self, keys, function() {
1116            }, action);
1117          };
1118          Mousetrap3.prototype.trigger = function(keys, action) {
1119            var self = this;
1120            if (self._directMap[keys + ":" + action]) {
1121              self._directMap[keys + ":" + action]({}, keys);
1122            }
1123            return self;
1124          };
1125          Mousetrap3.prototype.reset = function() {
1126            var self = this;
1127            self._callbacks = {};
1128            self._directMap = {};
1129            return self;
1130          };
1131          Mousetrap3.prototype.stopCallback = function(e, element) {
1132            var self = this;
1133            if ((" " + element.className + " ").indexOf(" mousetrap ") > -1) {
1134              return false;
1135            }
1136            if (_belongsTo(element, self.target)) {
1137              return false;
1138            }
1139            if ("composedPath" in e && typeof e.composedPath === "function") {
1140              var initialEventTarget = e.composedPath()[0];
1141              if (initialEventTarget !== e.target) {
1142                element = initialEventTarget;
1143              }
1144            }
1145            return element.tagName == "INPUT" || element.tagName == "SELECT" || element.tagName == "TEXTAREA" || element.isContentEditable;
1146          };
1147          Mousetrap3.prototype.handleKey = function() {
1148            var self = this;
1149            return self._handleKey.apply(self, arguments);
1150          };
1151          Mousetrap3.addKeycodes = function(object) {
1152            for (var key in object) {
1153              if (object.hasOwnProperty(key)) {
1154                _MAP[key] = object[key];
1155              }
1156            }
1157            _REVERSE_MAP = null;
1158          };
1159          Mousetrap3.init = function() {
1160            var documentMousetrap = Mousetrap3(document2);
1161            for (var method in documentMousetrap) {
1162              if (method.charAt(0) !== "_") {
1163                Mousetrap3[method] = /* @__PURE__ */ (function(method2) {
1164                  return function() {
1165                    return documentMousetrap[method2].apply(documentMousetrap, arguments);
1166                  };
1167                })(method);
1168              }
1169            }
1170          };
1171          Mousetrap3.init();
1172          window2.Mousetrap = Mousetrap3;
1173          if (typeof module !== "undefined" && module.exports) {
1174            module.exports = Mousetrap3;
1175          }
1176          if (typeof define === "function" && define.amd) {
1177            define(function() {
1178              return Mousetrap3;
1179            });
1180          }
1181        })(typeof window !== "undefined" ? window : null, typeof window !== "undefined" ? document : null);
1182      }
1183    });
1184  
1185    // package-external:@wordpress/undo-manager
1186    var require_undo_manager = __commonJS({
1187      "package-external:@wordpress/undo-manager"(exports, module) {
1188        module.exports = window.wp.undoManager;
1189      }
1190    });
1191  
1192    // package-external:@wordpress/priority-queue
1193    var require_priority_queue = __commonJS({
1194      "package-external:@wordpress/priority-queue"(exports, module) {
1195        module.exports = window.wp.priorityQueue;
1196      }
1197    });
1198  
1199    // vendor-external:react
1200    var require_react = __commonJS({
1201      "vendor-external:react"(exports, module) {
1202        module.exports = window.React;
1203      }
1204    });
1205  
1206    // packages/compose/build-module/index.js
1207    var index_exports = {};
1208    __export(index_exports, {
1209      __experimentalUseDialog: () => use_dialog_default,
1210      __experimentalUseDragging: () => useDragging,
1211      __experimentalUseDropZone: () => useDropZone,
1212      __experimentalUseFixedWindowList: () => useFixedWindowList,
1213      __experimentalUseFocusOutside: () => useFocusOutside,
1214      compose: () => compose_default,
1215      createHigherOrderComponent: () => createHigherOrderComponent,
1216      debounce: () => debounce,
1217      ifCondition: () => if_condition_default,
1218      observableMap: () => observableMap,
1219      pipe: () => pipe_default,
1220      pure: () => pure_default,
1221      throttle: () => throttle,
1222      useAsyncList: () => use_async_list_default,
1223      useConstrainedTabbing: () => use_constrained_tabbing_default,
1224      useCopyOnClick: () => useCopyOnClick,
1225      useCopyToClipboard: () => useCopyToClipboard,
1226      useDebounce: () => useDebounce,
1227      useDebouncedInput: () => useDebouncedInput,
1228      useDisabled: () => useDisabled,
1229      useEvent: () => useEvent,
1230      useFocusOnMount: () => useFocusOnMount,
1231      useFocusReturn: () => use_focus_return_default,
1232      useFocusableIframe: () => useFocusableIframe,
1233      useInstanceId: () => use_instance_id_default,
1234      useIsomorphicLayoutEffect: () => use_isomorphic_layout_effect_default,
1235      useKeyboardShortcut: () => use_keyboard_shortcut_default,
1236      useMediaQuery: () => useMediaQuery,
1237      useMergeRefs: () => useMergeRefs,
1238      useObservableValue: () => useObservableValue,
1239      usePrevious: () => usePrevious,
1240      useReducedMotion: () => use_reduced_motion_default,
1241      useRefEffect: () => useRefEffect,
1242      useResizeObserver: () => useResizeObserver2,
1243      useStateWithHistory: () => useStateWithHistory,
1244      useThrottle: () => useThrottle,
1245      useViewportMatch: () => use_viewport_match_default,
1246      useWarnOnChange: () => use_warn_on_change_default,
1247      withGlobalEvents: () => withGlobalEvents,
1248      withInstanceId: () => with_instance_id_default,
1249      withSafeTimeout: () => with_safe_timeout_default,
1250      withState: () => withState
1251    });
1252  
1253    // node_modules/tslib/tslib.es6.mjs
1254    var __assign = function() {
1255      __assign = Object.assign || function __assign2(t) {
1256        for (var s, i = 1, n = arguments.length; i < n; i++) {
1257          s = arguments[i];
1258          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1259        }
1260        return t;
1261      };
1262      return __assign.apply(this, arguments);
1263    };
1264  
1265    // node_modules/lower-case/dist.es2015/index.js
1266    function lowerCase(str) {
1267      return str.toLowerCase();
1268    }
1269  
1270    // node_modules/no-case/dist.es2015/index.js
1271    var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
1272    var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
1273    function noCase(input, options) {
1274      if (options === void 0) {
1275        options = {};
1276      }
1277      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;
1278      var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
1279      var start = 0;
1280      var end = result.length;
1281      while (result.charAt(start) === "\0")
1282        start++;
1283      while (result.charAt(end - 1) === "\0")
1284        end--;
1285      return result.slice(start, end).split("\0").map(transform).join(delimiter);
1286    }
1287    function replace(input, re, value) {
1288      if (re instanceof RegExp)
1289        return input.replace(re, value);
1290      return re.reduce(function(input2, re2) {
1291        return input2.replace(re2, value);
1292      }, input);
1293    }
1294  
1295    // node_modules/pascal-case/dist.es2015/index.js
1296    function pascalCaseTransform(input, index) {
1297      var firstChar = input.charAt(0);
1298      var lowerChars = input.substr(1).toLowerCase();
1299      if (index > 0 && firstChar >= "0" && firstChar <= "9") {
1300        return "_" + firstChar + lowerChars;
1301      }
1302      return "" + firstChar.toUpperCase() + lowerChars;
1303    }
1304    function pascalCase(input, options) {
1305      if (options === void 0) {
1306        options = {};
1307      }
1308      return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
1309    }
1310  
1311    // packages/compose/build-module/utils/create-higher-order-component/index.js
1312    function createHigherOrderComponent(mapComponent, modifierName) {
1313      return (Inner) => {
1314        const Outer = mapComponent(Inner);
1315        Outer.displayName = hocName(modifierName, Inner);
1316        return Outer;
1317      };
1318    }
1319    var hocName = (name, Inner) => {
1320      const inner = Inner.displayName || Inner.name || "Component";
1321      const outer = pascalCase(name ?? "");
1322      return `$outer}($inner})`;
1323    };
1324  
1325    // packages/compose/build-module/utils/debounce/index.js
1326    var debounce = (func, wait, options) => {
1327      let lastArgs;
1328      let lastThis;
1329      let maxWait = 0;
1330      let result;
1331      let timerId;
1332      let lastCallTime;
1333      let lastInvokeTime = 0;
1334      let leading = false;
1335      let maxing = false;
1336      let trailing = true;
1337      if (options) {
1338        leading = !!options.leading;
1339        maxing = "maxWait" in options;
1340        if (options.maxWait !== void 0) {
1341          maxWait = Math.max(options.maxWait, wait);
1342        }
1343        trailing = "trailing" in options ? !!options.trailing : trailing;
1344      }
1345      function invokeFunc(time) {
1346        const args = lastArgs;
1347        const thisArg = lastThis;
1348        lastArgs = void 0;
1349        lastThis = void 0;
1350        lastInvokeTime = time;
1351        result = func.apply(thisArg, args);
1352        return result;
1353      }
1354      function startTimer(pendingFunc, waitTime) {
1355        timerId = setTimeout(pendingFunc, waitTime);
1356      }
1357      function cancelTimer() {
1358        if (timerId !== void 0) {
1359          clearTimeout(timerId);
1360        }
1361      }
1362      function leadingEdge(time) {
1363        lastInvokeTime = time;
1364        startTimer(timerExpired, wait);
1365        return leading ? invokeFunc(time) : result;
1366      }
1367      function getTimeSinceLastCall(time) {
1368        return time - (lastCallTime || 0);
1369      }
1370      function remainingWait(time) {
1371        const timeSinceLastCall = getTimeSinceLastCall(time);
1372        const timeSinceLastInvoke = time - lastInvokeTime;
1373        const timeWaiting = wait - timeSinceLastCall;
1374        return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
1375      }
1376      function shouldInvoke(time) {
1377        const timeSinceLastCall = getTimeSinceLastCall(time);
1378        const timeSinceLastInvoke = time - lastInvokeTime;
1379        return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
1380      }
1381      function timerExpired() {
1382        const time = Date.now();
1383        if (shouldInvoke(time)) {
1384          return trailingEdge(time);
1385        }
1386        startTimer(timerExpired, remainingWait(time));
1387        return void 0;
1388      }
1389      function clearTimer() {
1390        timerId = void 0;
1391      }
1392      function trailingEdge(time) {
1393        clearTimer();
1394        if (trailing && lastArgs) {
1395          return invokeFunc(time);
1396        }
1397        lastArgs = lastThis = void 0;
1398        return result;
1399      }
1400      function cancel() {
1401        cancelTimer();
1402        lastInvokeTime = 0;
1403        clearTimer();
1404        lastArgs = lastCallTime = lastThis = void 0;
1405      }
1406      function flush() {
1407        return pending() ? trailingEdge(Date.now()) : result;
1408      }
1409      function pending() {
1410        return timerId !== void 0;
1411      }
1412      function debounced(...args) {
1413        const time = Date.now();
1414        const isInvoking = shouldInvoke(time);
1415        lastArgs = args;
1416        lastThis = this;
1417        lastCallTime = time;
1418        if (isInvoking) {
1419          if (!pending()) {
1420            return leadingEdge(lastCallTime);
1421          }
1422          if (maxing) {
1423            startTimer(timerExpired, wait);
1424            return invokeFunc(lastCallTime);
1425          }
1426        }
1427        if (!pending()) {
1428          startTimer(timerExpired, wait);
1429        }
1430        return result;
1431      }
1432      debounced.cancel = cancel;
1433      debounced.flush = flush;
1434      debounced.pending = pending;
1435      return debounced;
1436    };
1437  
1438    // packages/compose/build-module/utils/throttle/index.js
1439    var throttle = (func, wait, options) => {
1440      let leading = true;
1441      let trailing = true;
1442      if (options) {
1443        leading = "leading" in options ? !!options.leading : leading;
1444        trailing = "trailing" in options ? !!options.trailing : trailing;
1445      }
1446      return debounce(func, wait, {
1447        leading,
1448        trailing,
1449        maxWait: wait
1450      });
1451    };
1452  
1453    // packages/compose/build-module/utils/observable-map/index.js
1454    function observableMap() {
1455      const map = /* @__PURE__ */ new Map();
1456      const listeners = /* @__PURE__ */ new Map();
1457      function callListeners(name) {
1458        const list = listeners.get(name);
1459        if (!list) {
1460          return;
1461        }
1462        for (const listener2 of list) {
1463          listener2();
1464        }
1465      }
1466      return {
1467        get(name) {
1468          return map.get(name);
1469        },
1470        set(name, value) {
1471          map.set(name, value);
1472          callListeners(name);
1473        },
1474        delete(name) {
1475          map.delete(name);
1476          callListeners(name);
1477        },
1478        subscribe(name, listener2) {
1479          let list = listeners.get(name);
1480          if (!list) {
1481            list = /* @__PURE__ */ new Set();
1482            listeners.set(name, list);
1483          }
1484          list.add(listener2);
1485          return () => {
1486            list.delete(listener2);
1487            if (list.size === 0) {
1488              listeners.delete(name);
1489            }
1490          };
1491        }
1492      };
1493    }
1494  
1495    // packages/compose/build-module/higher-order/pipe.js
1496    var basePipe = (reverse = false) => (...funcs) => (...args) => {
1497      const functions = funcs.flat();
1498      if (reverse) {
1499        functions.reverse();
1500      }
1501      return functions.reduce(
1502        (prev, func) => [func(...prev)],
1503        args
1504      )[0];
1505    };
1506    var pipe = basePipe();
1507    var pipe_default = pipe;
1508  
1509    // packages/compose/build-module/higher-order/compose.js
1510    var compose = basePipe(true);
1511    var compose_default = compose;
1512  
1513    // packages/compose/build-module/higher-order/if-condition/index.js
1514    var import_jsx_runtime = __toESM(require_jsx_runtime());
1515    function ifCondition(predicate) {
1516      return createHigherOrderComponent(
1517        (WrappedComponent) => (props) => {
1518          if (!predicate(props)) {
1519            return null;
1520          }
1521          return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrappedComponent, { ...props });
1522        },
1523        "ifCondition"
1524      );
1525    }
1526    var if_condition_default = ifCondition;
1527  
1528    // packages/compose/build-module/higher-order/pure/index.js
1529    var import_is_shallow_equal = __toESM(require_is_shallow_equal());
1530    var import_element = __toESM(require_element());
1531    var import_jsx_runtime2 = __toESM(require_jsx_runtime());
1532    var pure = createHigherOrderComponent(function(WrappedComponent) {
1533      if (WrappedComponent.prototype instanceof import_element.Component) {
1534        return class extends WrappedComponent {
1535          shouldComponentUpdate(nextProps, nextState) {
1536            return !(0, import_is_shallow_equal.default)(nextProps, this.props) || !(0, import_is_shallow_equal.default)(nextState, this.state);
1537          }
1538        };
1539      }
1540      return class extends import_element.Component {
1541        shouldComponentUpdate(nextProps) {
1542          return !(0, import_is_shallow_equal.default)(nextProps, this.props);
1543        }
1544        render() {
1545          return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(WrappedComponent, { ...this.props });
1546        }
1547      };
1548    }, "pure");
1549    var pure_default = pure;
1550  
1551    // packages/compose/build-module/higher-order/with-global-events/index.js
1552    var import_element2 = __toESM(require_element());
1553    var import_deprecated = __toESM(require_deprecated());
1554  
1555    // packages/compose/build-module/higher-order/with-global-events/listener.js
1556    var Listener = class {
1557      constructor() {
1558        this.listeners = {};
1559        this.handleEvent = this.handleEvent.bind(this);
1560      }
1561      add(eventType, instance) {
1562        if (!this.listeners[eventType]) {
1563          window.addEventListener(eventType, this.handleEvent);
1564          this.listeners[eventType] = [];
1565        }
1566        this.listeners[eventType].push(instance);
1567      }
1568      remove(eventType, instance) {
1569        if (!this.listeners[eventType]) {
1570          return;
1571        }
1572        this.listeners[eventType] = this.listeners[eventType].filter(
1573          (listener2) => listener2 !== instance
1574        );
1575        if (!this.listeners[eventType].length) {
1576          window.removeEventListener(eventType, this.handleEvent);
1577          delete this.listeners[eventType];
1578        }
1579      }
1580      handleEvent(event) {
1581        this.listeners[event.type]?.forEach(
1582          (instance) => {
1583            instance.handleEvent(event);
1584          }
1585        );
1586      }
1587    };
1588    var listener_default = Listener;
1589  
1590    // packages/compose/build-module/higher-order/with-global-events/index.js
1591    var import_jsx_runtime3 = __toESM(require_jsx_runtime());
1592    var listener = new listener_default();
1593    function withGlobalEvents(eventTypesToHandlers) {
1594      (0, import_deprecated.default)("wp.compose.withGlobalEvents", {
1595        since: "5.7",
1596        alternative: "useEffect"
1597      });
1598      return createHigherOrderComponent((WrappedComponent) => {
1599        class Wrapper extends import_element2.Component {
1600          constructor(props) {
1601            super(props);
1602            this.handleEvent = this.handleEvent.bind(this);
1603            this.handleRef = this.handleRef.bind(this);
1604          }
1605          componentDidMount() {
1606            Object.keys(eventTypesToHandlers).forEach((eventType) => {
1607              listener.add(eventType, this);
1608            });
1609          }
1610          componentWillUnmount() {
1611            Object.keys(eventTypesToHandlers).forEach((eventType) => {
1612              listener.remove(eventType, this);
1613            });
1614          }
1615          handleEvent(event) {
1616            const handler = eventTypesToHandlers[
1617              /** @type {keyof GlobalEventHandlersEventMap} */
1618              event.type
1619            ];
1620            if (typeof this.wrappedRef[handler] === "function") {
1621              this.wrappedRef[handler](event);
1622            }
1623          }
1624          handleRef(el) {
1625            this.wrappedRef = el;
1626            if (this.props.forwardedRef) {
1627              this.props.forwardedRef(el);
1628            }
1629          }
1630          render() {
1631            return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1632              WrappedComponent,
1633              {
1634                ...this.props.ownProps,
1635                ref: this.handleRef
1636              }
1637            );
1638          }
1639        }
1640        return (0, import_element2.forwardRef)((props, ref) => {
1641          return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Wrapper, { ownProps: props, forwardedRef: ref });
1642        });
1643      }, "withGlobalEvents");
1644    }
1645  
1646    // packages/compose/build-module/hooks/use-instance-id/index.js
1647    var import_element3 = __toESM(require_element());
1648    var instanceMap = /* @__PURE__ */ new WeakMap();
1649    function createId(object) {
1650      const instances = instanceMap.get(object) || 0;
1651      instanceMap.set(object, instances + 1);
1652      return instances;
1653    }
1654    function useInstanceId(object, prefix, preferredId) {
1655      return (0, import_element3.useMemo)(() => {
1656        if (preferredId) {
1657          return preferredId;
1658        }
1659        const id = createId(object);
1660        return prefix ? `$prefix}-$id}` : id;
1661      }, [object, preferredId, prefix]);
1662    }
1663    var use_instance_id_default = useInstanceId;
1664  
1665    // packages/compose/build-module/higher-order/with-instance-id/index.js
1666    var import_jsx_runtime4 = __toESM(require_jsx_runtime());
1667    var withInstanceId = createHigherOrderComponent(
1668      (WrappedComponent) => {
1669        return (props) => {
1670          const instanceId = use_instance_id_default(WrappedComponent);
1671          return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(WrappedComponent, { ...props, instanceId });
1672        };
1673      },
1674      "instanceId"
1675    );
1676    var with_instance_id_default = withInstanceId;
1677  
1678    // packages/compose/build-module/higher-order/with-safe-timeout/index.js
1679    var import_element4 = __toESM(require_element());
1680    var import_jsx_runtime5 = __toESM(require_jsx_runtime());
1681    var withSafeTimeout = createHigherOrderComponent(
1682      (OriginalComponent) => {
1683        return class WrappedComponent extends import_element4.Component {
1684          timeouts;
1685          constructor(props) {
1686            super(props);
1687            this.timeouts = [];
1688            this.setTimeout = this.setTimeout.bind(this);
1689            this.clearTimeout = this.clearTimeout.bind(this);
1690          }
1691          componentWillUnmount() {
1692            this.timeouts.forEach(clearTimeout);
1693          }
1694          setTimeout(fn, delay) {
1695            const id = setTimeout(() => {
1696              fn();
1697              this.clearTimeout(id);
1698            }, delay);
1699            this.timeouts.push(id);
1700            return id;
1701          }
1702          clearTimeout(id) {
1703            clearTimeout(id);
1704            this.timeouts = this.timeouts.filter(
1705              (timeoutId) => timeoutId !== id
1706            );
1707          }
1708          render() {
1709            return (
1710              // @ts-ignore
1711              /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1712                OriginalComponent,
1713                {
1714                  ...this.props,
1715                  setTimeout: this.setTimeout,
1716                  clearTimeout: this.clearTimeout
1717                }
1718              )
1719            );
1720          }
1721        };
1722      },
1723      "withSafeTimeout"
1724    );
1725    var with_safe_timeout_default = withSafeTimeout;
1726  
1727    // packages/compose/build-module/higher-order/with-state/index.js
1728    var import_element5 = __toESM(require_element());
1729    var import_deprecated2 = __toESM(require_deprecated());
1730    var import_jsx_runtime6 = __toESM(require_jsx_runtime());
1731    function withState(initialState = {}) {
1732      (0, import_deprecated2.default)("wp.compose.withState", {
1733        since: "5.8",
1734        alternative: "wp.element.useState"
1735      });
1736      return createHigherOrderComponent((OriginalComponent) => {
1737        return class WrappedComponent extends import_element5.Component {
1738          constructor(props) {
1739            super(props);
1740            this.setState = this.setState.bind(this);
1741            this.state = initialState;
1742          }
1743          render() {
1744            return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1745              OriginalComponent,
1746              {
1747                ...this.props,
1748                ...this.state,
1749                setState: this.setState
1750              }
1751            );
1752          }
1753        };
1754      }, "withState");
1755    }
1756  
1757    // packages/compose/build-module/hooks/use-constrained-tabbing/index.js
1758    var import_dom = __toESM(require_dom());
1759  
1760    // packages/compose/build-module/hooks/use-ref-effect/index.js
1761    var import_element6 = __toESM(require_element());
1762    function useRefEffect(callback, dependencies) {
1763      const cleanupRef = (0, import_element6.useRef)();
1764      return (0, import_element6.useCallback)((node) => {
1765        if (node) {
1766          cleanupRef.current = callback(node);
1767        } else if (cleanupRef.current) {
1768          cleanupRef.current();
1769        }
1770      }, dependencies);
1771    }
1772  
1773    // packages/compose/build-module/hooks/use-constrained-tabbing/index.js
1774    function useConstrainedTabbing() {
1775      return useRefEffect((node) => {
1776        function onKeyDown(event) {
1777          const { key, shiftKey, target } = event;
1778          if (key !== "Tab") {
1779            return;
1780          }
1781          const action = shiftKey ? "findPrevious" : "findNext";
1782          const nextElement = import_dom.focus.tabbable[action](
1783            /** @type {HTMLElement} */
1784            target
1785          ) || null;
1786          if (
1787            /** @type {HTMLElement} */
1788            target.contains(nextElement)
1789          ) {
1790            event.preventDefault();
1791            nextElement?.focus();
1792            return;
1793          }
1794          if (node.contains(nextElement)) {
1795            return;
1796          }
1797          const domAction = shiftKey ? "append" : "prepend";
1798          const { ownerDocument } = node;
1799          const trap = ownerDocument.createElement("div");
1800          trap.tabIndex = -1;
1801          node[domAction](trap);
1802          trap.addEventListener("blur", () => node.removeChild(trap));
1803          trap.focus();
1804        }
1805        node.addEventListener("keydown", onKeyDown);
1806        return () => {
1807          node.removeEventListener("keydown", onKeyDown);
1808        };
1809      }, []);
1810    }
1811    var use_constrained_tabbing_default = useConstrainedTabbing;
1812  
1813    // packages/compose/build-module/hooks/use-copy-on-click/index.js
1814    var import_clipboard = __toESM(require_clipboard());
1815    var import_element7 = __toESM(require_element());
1816    var import_deprecated3 = __toESM(require_deprecated());
1817    function useCopyOnClick(ref, text, timeout = 4e3) {
1818      (0, import_deprecated3.default)("wp.compose.useCopyOnClick", {
1819        since: "5.8",
1820        alternative: "wp.compose.useCopyToClipboard"
1821      });
1822      const clipboardRef = (0, import_element7.useRef)();
1823      const [hasCopied, setHasCopied] = (0, import_element7.useState)(false);
1824      (0, import_element7.useEffect)(() => {
1825        let timeoutId;
1826        if (!ref.current) {
1827          return;
1828        }
1829        clipboardRef.current = new import_clipboard.default(ref.current, {
1830          text: () => typeof text === "function" ? text() : text
1831        });
1832        clipboardRef.current.on("success", ({ clearSelection, trigger }) => {
1833          clearSelection();
1834          if (trigger) {
1835            trigger.focus();
1836          }
1837          if (timeout) {
1838            setHasCopied(true);
1839            clearTimeout(timeoutId);
1840            timeoutId = setTimeout(() => setHasCopied(false), timeout);
1841          }
1842        });
1843        return () => {
1844          if (clipboardRef.current) {
1845            clipboardRef.current.destroy();
1846          }
1847          clearTimeout(timeoutId);
1848        };
1849      }, [text, timeout, setHasCopied]);
1850      return hasCopied;
1851    }
1852  
1853    // packages/compose/build-module/hooks/use-copy-to-clipboard/index.js
1854    var import_clipboard2 = __toESM(require_clipboard());
1855    var import_element8 = __toESM(require_element());
1856    function useUpdatedRef(value) {
1857      const ref = (0, import_element8.useRef)(value);
1858      (0, import_element8.useLayoutEffect)(() => {
1859        ref.current = value;
1860      }, [value]);
1861      return ref;
1862    }
1863    function useCopyToClipboard(text, onSuccess) {
1864      const textRef = useUpdatedRef(text);
1865      const onSuccessRef = useUpdatedRef(onSuccess);
1866      return useRefEffect((node) => {
1867        const clipboard = new import_clipboard2.default(node, {
1868          text() {
1869            return typeof textRef.current === "function" ? textRef.current() : textRef.current || "";
1870          }
1871        });
1872        clipboard.on("success", ({ clearSelection }) => {
1873          clearSelection();
1874          if (onSuccessRef.current) {
1875            onSuccessRef.current();
1876          }
1877        });
1878        return () => {
1879          clipboard.destroy();
1880        };
1881      }, []);
1882    }
1883  
1884    // packages/compose/build-module/hooks/use-dialog/index.js
1885    var import_element13 = __toESM(require_element());
1886    var import_keycodes = __toESM(require_keycodes());
1887  
1888    // packages/compose/build-module/hooks/use-focus-on-mount/index.js
1889    var import_element9 = __toESM(require_element());
1890    var import_dom2 = __toESM(require_dom());
1891    function useFocusOnMount(focusOnMount = "firstElement") {
1892      const focusOnMountRef = (0, import_element9.useRef)(focusOnMount);
1893      const setFocus = (target) => {
1894        target.focus({
1895          // When focusing newly mounted dialogs,
1896          // the position of the popover is often not right on the first render
1897          // This prevents the layout shifts when focusing the dialogs.
1898          preventScroll: true
1899        });
1900      };
1901      const timerIdRef = (0, import_element9.useRef)();
1902      (0, import_element9.useEffect)(() => {
1903        focusOnMountRef.current = focusOnMount;
1904      }, [focusOnMount]);
1905      return useRefEffect((node) => {
1906        if (!node || focusOnMountRef.current === false) {
1907          return;
1908        }
1909        if (node.contains(node.ownerDocument?.activeElement ?? null)) {
1910          return;
1911        }
1912        if (focusOnMountRef.current !== "firstElement" && focusOnMountRef.current !== "firstInputElement") {
1913          setFocus(node);
1914          return;
1915        }
1916        timerIdRef.current = setTimeout(() => {
1917          if (focusOnMountRef.current === "firstInputElement") {
1918            let formInput = null;
1919            if (typeof window !== "undefined" && node instanceof window.Element) {
1920              formInput = node.querySelector(
1921                'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled])'
1922              );
1923            }
1924            if (formInput) {
1925              setFocus(formInput);
1926              return;
1927            }
1928          }
1929          const firstTabbable = import_dom2.focus.tabbable.find(node)[0];
1930          if (firstTabbable) {
1931            setFocus(firstTabbable);
1932          }
1933        }, 0);
1934        return () => {
1935          if (timerIdRef.current) {
1936            clearTimeout(timerIdRef.current);
1937          }
1938        };
1939      }, []);
1940    }
1941  
1942    // packages/compose/build-module/hooks/use-focus-return/index.js
1943    var import_element10 = __toESM(require_element());
1944    var origin = null;
1945    function useFocusReturn(onFocusReturn) {
1946      const ref = (0, import_element10.useRef)(null);
1947      const focusedBeforeMount = (0, import_element10.useRef)(null);
1948      const onFocusReturnRef = (0, import_element10.useRef)(onFocusReturn);
1949      (0, import_element10.useEffect)(() => {
1950        onFocusReturnRef.current = onFocusReturn;
1951      }, [onFocusReturn]);
1952      return (0, import_element10.useCallback)((node) => {
1953        if (node) {
1954          ref.current = node;
1955          if (focusedBeforeMount.current) {
1956            return;
1957          }
1958          const activeDocument = node.ownerDocument.activeElement instanceof window.HTMLIFrameElement ? node.ownerDocument.activeElement.contentDocument : node.ownerDocument;
1959          focusedBeforeMount.current = activeDocument?.activeElement ?? null;
1960        } else if (focusedBeforeMount.current) {
1961          const isFocused = ref.current?.contains(
1962            ref.current?.ownerDocument.activeElement
1963          );
1964          if (ref.current?.isConnected && !isFocused) {
1965            origin ??= focusedBeforeMount.current;
1966            return;
1967          }
1968          if (onFocusReturnRef.current) {
1969            onFocusReturnRef.current();
1970          } else {
1971            (!focusedBeforeMount.current.isConnected ? origin : focusedBeforeMount.current)?.focus();
1972          }
1973          origin = null;
1974        }
1975      }, []);
1976    }
1977    var use_focus_return_default = useFocusReturn;
1978  
1979    // packages/compose/build-module/hooks/use-focus-outside/index.js
1980    var import_element11 = __toESM(require_element());
1981    var INPUT_BUTTON_TYPES = ["button", "submit"];
1982    function isFocusNormalizedButton(eventTarget) {
1983      if (!(eventTarget instanceof window.HTMLElement)) {
1984        return false;
1985      }
1986      switch (eventTarget.nodeName) {
1987        case "A":
1988        case "BUTTON":
1989          return true;
1990        case "INPUT":
1991          return INPUT_BUTTON_TYPES.includes(
1992            eventTarget.type
1993          );
1994      }
1995      return false;
1996    }
1997    function useFocusOutside(onFocusOutside) {
1998      const currentOnFocusOutsideRef = (0, import_element11.useRef)(onFocusOutside);
1999      (0, import_element11.useEffect)(() => {
2000        currentOnFocusOutsideRef.current = onFocusOutside;
2001      }, [onFocusOutside]);
2002      const preventBlurCheckRef = (0, import_element11.useRef)(false);
2003      const blurCheckTimeoutIdRef = (0, import_element11.useRef)();
2004      const cancelBlurCheck = (0, import_element11.useCallback)(() => {
2005        clearTimeout(blurCheckTimeoutIdRef.current);
2006      }, []);
2007      (0, import_element11.useEffect)(() => {
2008        if (!onFocusOutside) {
2009          cancelBlurCheck();
2010        }
2011      }, [onFocusOutside, cancelBlurCheck]);
2012      const normalizeButtonFocus = (0, import_element11.useCallback)((event) => {
2013        const { type, target } = event;
2014        const isInteractionEnd = ["mouseup", "touchend"].includes(type);
2015        if (isInteractionEnd) {
2016          preventBlurCheckRef.current = false;
2017        } else if (isFocusNormalizedButton(target)) {
2018          preventBlurCheckRef.current = true;
2019        }
2020      }, []);
2021      const queueBlurCheck = (0, import_element11.useCallback)((event) => {
2022        event.persist();
2023        if (preventBlurCheckRef.current) {
2024          return;
2025        }
2026        const ignoreForRelatedTarget = event.target.getAttribute(
2027          "data-unstable-ignore-focus-outside-for-relatedtarget"
2028        );
2029        if (ignoreForRelatedTarget && event.relatedTarget?.closest(ignoreForRelatedTarget)) {
2030          return;
2031        }
2032        blurCheckTimeoutIdRef.current = setTimeout(() => {
2033          if (!document.hasFocus()) {
2034            event.preventDefault();
2035            return;
2036          }
2037          if ("function" === typeof currentOnFocusOutsideRef.current) {
2038            currentOnFocusOutsideRef.current(event);
2039          }
2040        }, 0);
2041      }, []);
2042      return {
2043        onFocus: cancelBlurCheck,
2044        onMouseDown: normalizeButtonFocus,
2045        onMouseUp: normalizeButtonFocus,
2046        onTouchStart: normalizeButtonFocus,
2047        onTouchEnd: normalizeButtonFocus,
2048        onBlur: queueBlurCheck
2049      };
2050    }
2051  
2052    // packages/compose/build-module/hooks/use-merge-refs/index.js
2053    var import_element12 = __toESM(require_element());
2054    function assignRef(ref, value) {
2055      if (typeof ref === "function") {
2056        ref(value);
2057      } else if (ref && ref.hasOwnProperty("current")) {
2058        ref.current = value;
2059      }
2060    }
2061    function useMergeRefs(refs) {
2062      const element = (0, import_element12.useRef)();
2063      const isAttachedRef = (0, import_element12.useRef)(false);
2064      const didElementChangeRef = (0, import_element12.useRef)(false);
2065      const previousRefsRef = (0, import_element12.useRef)([]);
2066      const currentRefsRef = (0, import_element12.useRef)(refs);
2067      currentRefsRef.current = refs;
2068      (0, import_element12.useLayoutEffect)(() => {
2069        if (didElementChangeRef.current === false && isAttachedRef.current === true) {
2070          refs.forEach((ref, index) => {
2071            const previousRef = previousRefsRef.current[index];
2072            if (ref !== previousRef) {
2073              assignRef(previousRef, null);
2074              assignRef(ref, element.current);
2075            }
2076          });
2077        }
2078        previousRefsRef.current = refs;
2079      }, refs);
2080      (0, import_element12.useLayoutEffect)(() => {
2081        didElementChangeRef.current = false;
2082      });
2083      return (0, import_element12.useCallback)((value) => {
2084        assignRef(element, value);
2085        didElementChangeRef.current = true;
2086        isAttachedRef.current = value !== null;
2087        const refsToAssign = value ? currentRefsRef.current : previousRefsRef.current;
2088        for (const ref of refsToAssign) {
2089          assignRef(ref, value);
2090        }
2091      }, []);
2092    }
2093  
2094    // packages/compose/build-module/hooks/use-dialog/index.js
2095    function useDialog(options) {
2096      const currentOptions = (0, import_element13.useRef)();
2097      const { constrainTabbing = options.focusOnMount !== false } = options;
2098      (0, import_element13.useEffect)(() => {
2099        currentOptions.current = options;
2100      }, Object.values(options));
2101      const constrainedTabbingRef = use_constrained_tabbing_default();
2102      const focusOnMountRef = useFocusOnMount(options.focusOnMount);
2103      const focusReturnRef = use_focus_return_default();
2104      const focusOutsideProps = useFocusOutside((event) => {
2105        if (currentOptions.current?.__unstableOnClose) {
2106          currentOptions.current.__unstableOnClose("focus-outside", event);
2107        } else if (currentOptions.current?.onClose) {
2108          currentOptions.current.onClose();
2109        }
2110      });
2111      const closeOnEscapeRef = (0, import_element13.useCallback)((node) => {
2112        if (!node) {
2113          return;
2114        }
2115        node.addEventListener("keydown", (event) => {
2116          if (event.keyCode === import_keycodes.ESCAPE && !event.defaultPrevented && currentOptions.current?.onClose) {
2117            event.preventDefault();
2118            currentOptions.current.onClose();
2119          }
2120        });
2121      }, []);
2122      return [
2123        useMergeRefs([
2124          constrainTabbing ? constrainedTabbingRef : null,
2125          options.focusOnMount !== false ? focusReturnRef : null,
2126          options.focusOnMount !== false ? focusOnMountRef : null,
2127          closeOnEscapeRef
2128        ]),
2129        {
2130          ...focusOutsideProps,
2131          tabIndex: -1
2132        }
2133      ];
2134    }
2135    var use_dialog_default = useDialog;
2136  
2137    // packages/compose/build-module/hooks/use-disabled/index.js
2138    function useDisabled({
2139      isDisabled: isDisabledProp = false
2140    } = {}) {
2141      return useRefEffect(
2142        (node) => {
2143          if (isDisabledProp) {
2144            return;
2145          }
2146          const defaultView = node?.ownerDocument?.defaultView;
2147          if (!defaultView) {
2148            return;
2149          }
2150          const updates = [];
2151          const disable = () => {
2152            node.childNodes.forEach((child) => {
2153              if (!(child instanceof defaultView.HTMLElement)) {
2154                return;
2155              }
2156              if (!child.getAttribute("inert")) {
2157                child.setAttribute("inert", "true");
2158                updates.push(() => {
2159                  child.removeAttribute("inert");
2160                });
2161              }
2162            });
2163          };
2164          const debouncedDisable = debounce(disable, 0, {
2165            leading: true
2166          });
2167          disable();
2168          const observer = new window.MutationObserver(debouncedDisable);
2169          observer.observe(node, {
2170            childList: true
2171          });
2172          return () => {
2173            if (observer) {
2174              observer.disconnect();
2175            }
2176            debouncedDisable.cancel();
2177            updates.forEach((update) => update());
2178          };
2179        },
2180        [isDisabledProp]
2181      );
2182    }
2183  
2184    // packages/compose/build-module/hooks/use-event/index.js
2185    var import_element14 = __toESM(require_element());
2186    function useEvent(callback) {
2187      const ref = (0, import_element14.useRef)(() => {
2188        throw new Error(
2189          "Callbacks created with `useEvent` cannot be called during rendering."
2190        );
2191      });
2192      (0, import_element14.useInsertionEffect)(() => {
2193        ref.current = callback;
2194      });
2195      return (0, import_element14.useCallback)(
2196        (...args) => ref.current?.(...args),
2197        []
2198      );
2199    }
2200  
2201    // packages/compose/build-module/hooks/use-dragging/index.js
2202    var import_element16 = __toESM(require_element());
2203  
2204    // packages/compose/build-module/hooks/use-isomorphic-layout-effect/index.js
2205    var import_element15 = __toESM(require_element());
2206    var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_element15.useLayoutEffect : import_element15.useEffect;
2207    var use_isomorphic_layout_effect_default = useIsomorphicLayoutEffect;
2208  
2209    // packages/compose/build-module/hooks/use-dragging/index.js
2210    function useDragging({ onDragStart, onDragMove, onDragEnd }) {
2211      const [isDragging, setIsDragging] = (0, import_element16.useState)(false);
2212      const eventsRef = (0, import_element16.useRef)({
2213        onDragStart,
2214        onDragMove,
2215        onDragEnd
2216      });
2217      use_isomorphic_layout_effect_default(() => {
2218        eventsRef.current.onDragStart = onDragStart;
2219        eventsRef.current.onDragMove = onDragMove;
2220        eventsRef.current.onDragEnd = onDragEnd;
2221      }, [onDragStart, onDragMove, onDragEnd]);
2222      const onMouseMove = (0, import_element16.useCallback)(
2223        (event) => eventsRef.current.onDragMove && eventsRef.current.onDragMove(event),
2224        []
2225      );
2226      const endDrag = (0, import_element16.useCallback)((event) => {
2227        if (eventsRef.current.onDragEnd) {
2228          eventsRef.current.onDragEnd(event);
2229        }
2230        document.removeEventListener("mousemove", onMouseMove);
2231        document.removeEventListener("mouseup", endDrag);
2232        setIsDragging(false);
2233      }, []);
2234      const startDrag = (0, import_element16.useCallback)((event) => {
2235        if (eventsRef.current.onDragStart) {
2236          eventsRef.current.onDragStart(event);
2237        }
2238        document.addEventListener("mousemove", onMouseMove);
2239        document.addEventListener("mouseup", endDrag);
2240        setIsDragging(true);
2241      }, []);
2242      (0, import_element16.useEffect)(() => {
2243        return () => {
2244          if (isDragging) {
2245            document.removeEventListener("mousemove", onMouseMove);
2246            document.removeEventListener("mouseup", endDrag);
2247          }
2248        };
2249      }, [isDragging]);
2250      return {
2251        startDrag,
2252        endDrag,
2253        isDragging
2254      };
2255    }
2256  
2257    // packages/compose/build-module/hooks/use-keyboard-shortcut/index.js
2258    var import_mousetrap = __toESM(require_mousetrap());
2259  
2260    // node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.js
2261    (function(Mousetrap3) {
2262      if (!Mousetrap3) {
2263        return;
2264      }
2265      var _globalCallbacks = {};
2266      var _originalStopCallback = Mousetrap3.prototype.stopCallback;
2267      Mousetrap3.prototype.stopCallback = function(e, element, combo, sequence) {
2268        var self = this;
2269        if (self.paused) {
2270          return true;
2271        }
2272        if (_globalCallbacks[combo] || _globalCallbacks[sequence]) {
2273          return false;
2274        }
2275        return _originalStopCallback.call(self, e, element, combo);
2276      };
2277      Mousetrap3.prototype.bindGlobal = function(keys, callback, action) {
2278        var self = this;
2279        self.bind(keys, callback, action);
2280        if (keys instanceof Array) {
2281          for (var i = 0; i < keys.length; i++) {
2282            _globalCallbacks[keys[i]] = true;
2283          }
2284          return;
2285        }
2286        _globalCallbacks[keys] = true;
2287      };
2288      Mousetrap3.init();
2289    })(typeof Mousetrap !== "undefined" ? Mousetrap : void 0);
2290  
2291    // packages/compose/build-module/hooks/use-keyboard-shortcut/index.js
2292    var import_element17 = __toESM(require_element());
2293    var import_keycodes2 = __toESM(require_keycodes());
2294    function useKeyboardShortcut(shortcuts, callback, {
2295      bindGlobal = false,
2296      eventName = "keydown",
2297      isDisabled = false,
2298      // This is important for performance considerations.
2299      target
2300    } = {}) {
2301      const currentCallbackRef = (0, import_element17.useRef)(callback);
2302      (0, import_element17.useEffect)(() => {
2303        currentCallbackRef.current = callback;
2304      }, [callback]);
2305      (0, import_element17.useEffect)(() => {
2306        if (isDisabled) {
2307          return;
2308        }
2309        const mousetrap = new import_mousetrap.default(
2310          target && target.current ? target.current : (
2311            // We were passing `document` here previously, so to successfully cast it to Element we must cast it first to `unknown`.
2312            // Not sure if this is a mistake but it was the behavior previous to the addition of types so we're just doing what's
2313            // necessary to maintain the existing behavior.
2314            /** @type {Element} */
2315            /** @type {unknown} */
2316            document
2317          )
2318        );
2319        const shortcutsArray = Array.isArray(shortcuts) ? shortcuts : [shortcuts];
2320        shortcutsArray.forEach((shortcut) => {
2321          const keys = shortcut.split("+");
2322          const modifiers = new Set(
2323            keys.filter((value) => value.length > 1)
2324          );
2325          const hasAlt = modifiers.has("alt");
2326          const hasShift = modifiers.has("shift");
2327          if ((0, import_keycodes2.isAppleOS)() && (modifiers.size === 1 && hasAlt || modifiers.size === 2 && hasAlt && hasShift)) {
2328            throw new Error(
2329              `Cannot bind $shortcut}. Alt and Shift+Alt modifiers are reserved for character input.`
2330            );
2331          }
2332          const bindFn = bindGlobal ? "bindGlobal" : "bind";
2333          mousetrap[bindFn](
2334            shortcut,
2335            (...args) => currentCallbackRef.current(...args),
2336            eventName
2337          );
2338        });
2339        return () => {
2340          mousetrap.reset();
2341        };
2342      }, [shortcuts, bindGlobal, eventName, target, isDisabled]);
2343    }
2344    var use_keyboard_shortcut_default = useKeyboardShortcut;
2345  
2346    // packages/compose/build-module/hooks/use-media-query/index.js
2347    var import_element18 = __toESM(require_element());
2348    var matchMediaCache = /* @__PURE__ */ new Map();
2349    function getMediaQueryList(query) {
2350      if (!query) {
2351        return null;
2352      }
2353      let match = matchMediaCache.get(query);
2354      if (match) {
2355        return match;
2356      }
2357      if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
2358        match = window.matchMedia(query);
2359        matchMediaCache.set(query, match);
2360        return match;
2361      }
2362      return null;
2363    }
2364    function useMediaQuery(query) {
2365      const source = (0, import_element18.useMemo)(() => {
2366        const mediaQueryList = getMediaQueryList(query);
2367        return {
2368          /** @type {(onStoreChange: () => void) => () => void} */
2369          subscribe(onStoreChange) {
2370            if (!mediaQueryList) {
2371              return () => {
2372              };
2373            }
2374            mediaQueryList.addEventListener?.("change", onStoreChange);
2375            return () => {
2376              mediaQueryList.removeEventListener?.(
2377                "change",
2378                onStoreChange
2379              );
2380            };
2381          },
2382          getValue() {
2383            return mediaQueryList?.matches ?? false;
2384          }
2385        };
2386      }, [query]);
2387      return (0, import_element18.useSyncExternalStore)(
2388        source.subscribe,
2389        source.getValue,
2390        () => false
2391      );
2392    }
2393  
2394    // packages/compose/build-module/hooks/use-previous/index.js
2395    var import_element19 = __toESM(require_element());
2396    function usePrevious(value) {
2397      const ref = (0, import_element19.useRef)();
2398      (0, import_element19.useEffect)(() => {
2399        ref.current = value;
2400      }, [value]);
2401      return ref.current;
2402    }
2403  
2404    // packages/compose/build-module/hooks/use-reduced-motion/index.js
2405    var useReducedMotion = () => useMediaQuery("(prefers-reduced-motion: reduce)");
2406    var use_reduced_motion_default = useReducedMotion;
2407  
2408    // packages/compose/build-module/hooks/use-state-with-history/index.js
2409    var import_undo_manager = __toESM(require_undo_manager());
2410    var import_element20 = __toESM(require_element());
2411    function undoRedoReducer(state, action) {
2412      switch (action.type) {
2413        case "UNDO": {
2414          const undoRecord = state.manager.undo();
2415          if (undoRecord) {
2416            return {
2417              ...state,
2418              value: undoRecord[0].changes.prop.from
2419            };
2420          }
2421          return state;
2422        }
2423        case "REDO": {
2424          const redoRecord = state.manager.redo();
2425          if (redoRecord) {
2426            return {
2427              ...state,
2428              value: redoRecord[0].changes.prop.to
2429            };
2430          }
2431          return state;
2432        }
2433        case "RECORD": {
2434          state.manager.addRecord(
2435            [
2436              {
2437                id: "object",
2438                changes: {
2439                  prop: { from: state.value, to: action.value }
2440                }
2441              }
2442            ],
2443            action.isStaged
2444          );
2445          return {
2446            ...state,
2447            value: action.value
2448          };
2449        }
2450      }
2451      return state;
2452    }
2453    function initReducer(value) {
2454      return {
2455        manager: (0, import_undo_manager.createUndoManager)(),
2456        value
2457      };
2458    }
2459    function useStateWithHistory(initialValue) {
2460      const [state, dispatch] = (0, import_element20.useReducer)(
2461        undoRedoReducer,
2462        initialValue,
2463        initReducer
2464      );
2465      return {
2466        value: state.value,
2467        setValue: (0, import_element20.useCallback)((newValue, isStaged) => {
2468          dispatch({
2469            type: "RECORD",
2470            value: newValue,
2471            isStaged
2472          });
2473        }, []),
2474        hasUndo: state.manager.hasUndo(),
2475        hasRedo: state.manager.hasRedo(),
2476        undo: (0, import_element20.useCallback)(() => {
2477          dispatch({ type: "UNDO" });
2478        }, []),
2479        redo: (0, import_element20.useCallback)(() => {
2480          dispatch({ type: "REDO" });
2481        }, [])
2482      };
2483    }
2484  
2485    // packages/compose/build-module/hooks/use-viewport-match/index.js
2486    var import_element21 = __toESM(require_element());
2487    var BREAKPOINTS = {
2488      xhuge: 1920,
2489      huge: 1440,
2490      wide: 1280,
2491      xlarge: 1080,
2492      large: 960,
2493      medium: 782,
2494      small: 600,
2495      mobile: 480
2496    };
2497    var CONDITIONS = {
2498      ">=": "min-width",
2499      "<": "max-width"
2500    };
2501    var OPERATOR_EVALUATORS = {
2502      ">=": (breakpointValue, width) => width >= breakpointValue,
2503      "<": (breakpointValue, width) => width < breakpointValue
2504    };
2505    var ViewportMatchWidthContext = (0, import_element21.createContext)(
2506      /** @type {null | number} */
2507      null
2508    );
2509    ViewportMatchWidthContext.displayName = "ViewportMatchWidthContext";
2510    var useViewportMatch = (breakpoint, operator = ">=") => {
2511      const simulatedWidth = (0, import_element21.useContext)(ViewportMatchWidthContext);
2512      const mediaQuery = !simulatedWidth && `($CONDITIONS[operator]}: $BREAKPOINTS[breakpoint]}px)`;
2513      const mediaQueryResult = useMediaQuery(mediaQuery || void 0);
2514      if (simulatedWidth) {
2515        return OPERATOR_EVALUATORS[operator](
2516          BREAKPOINTS[breakpoint],
2517          simulatedWidth
2518        );
2519      }
2520      return mediaQueryResult;
2521    };
2522    useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider;
2523    var use_viewport_match_default = useViewportMatch;
2524  
2525    // packages/compose/build-module/hooks/use-resize-observer/use-resize-observer.js
2526    var import_element22 = __toESM(require_element());
2527    function useResizeObserver(callback, resizeObserverOptions = {}) {
2528      const callbackEvent = useEvent(callback);
2529      const observedElementRef = (0, import_element22.useRef)();
2530      const resizeObserverRef = (0, import_element22.useRef)();
2531      return useEvent((element) => {
2532        if (element === observedElementRef.current) {
2533          return;
2534        }
2535        resizeObserverRef.current ??= new ResizeObserver(callbackEvent);
2536        const { current: resizeObserver } = resizeObserverRef;
2537        if (observedElementRef.current) {
2538          resizeObserver.unobserve(observedElementRef.current);
2539        }
2540        observedElementRef.current = element;
2541        if (element) {
2542          resizeObserver.observe(element, resizeObserverOptions);
2543        }
2544      });
2545    }
2546  
2547    // packages/compose/build-module/hooks/use-resize-observer/legacy/index.js
2548    var import_element23 = __toESM(require_element());
2549    var import_jsx_runtime7 = __toESM(require_jsx_runtime());
2550    var extractSize = (entry) => {
2551      let entrySize;
2552      if (!entry.contentBoxSize) {
2553        entrySize = [entry.contentRect.width, entry.contentRect.height];
2554      } else if (entry.contentBoxSize[0]) {
2555        const contentBoxSize = entry.contentBoxSize[0];
2556        entrySize = [contentBoxSize.inlineSize, contentBoxSize.blockSize];
2557      } else {
2558        const contentBoxSize = entry.contentBoxSize;
2559        entrySize = [contentBoxSize.inlineSize, contentBoxSize.blockSize];
2560      }
2561      const [width, height] = entrySize.map((d) => Math.round(d));
2562      return { width, height };
2563    };
2564    var RESIZE_ELEMENT_STYLES = {
2565      position: "absolute",
2566      top: 0,
2567      left: 0,
2568      right: 0,
2569      bottom: 0,
2570      pointerEvents: "none",
2571      opacity: 0,
2572      overflow: "hidden",
2573      zIndex: -1
2574    };
2575    function ResizeElement({ onResize }) {
2576      const resizeElementRef = useResizeObserver((entries) => {
2577        const newSize = extractSize(entries.at(-1));
2578        onResize(newSize);
2579      });
2580      return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2581        "div",
2582        {
2583          ref: resizeElementRef,
2584          style: RESIZE_ELEMENT_STYLES,
2585          "aria-hidden": "true"
2586        }
2587      );
2588    }
2589    function sizeEquals(a, b) {
2590      return a.width === b.width && a.height === b.height;
2591    }
2592    var NULL_SIZE = { width: null, height: null };
2593    function useLegacyResizeObserver() {
2594      const [size, setSize] = (0, import_element23.useState)(NULL_SIZE);
2595      const previousSizeRef = (0, import_element23.useRef)(NULL_SIZE);
2596      const handleResize = (0, import_element23.useCallback)((newSize) => {
2597        if (!sizeEquals(previousSizeRef.current, newSize)) {
2598          previousSizeRef.current = newSize;
2599          setSize(newSize);
2600        }
2601      }, []);
2602      const resizeElement = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ResizeElement, { onResize: handleResize });
2603      return [resizeElement, size];
2604    }
2605  
2606    // packages/compose/build-module/hooks/use-resize-observer/index.js
2607    function useResizeObserver2(callback, options = {}) {
2608      return callback ? useResizeObserver(callback, options) : useLegacyResizeObserver();
2609    }
2610  
2611    // packages/compose/build-module/hooks/use-async-list/index.js
2612    var import_element24 = __toESM(require_element());
2613    var import_priority_queue = __toESM(require_priority_queue());
2614    function getFirstItemsPresentInState(list, state) {
2615      const firstItems = [];
2616      for (let i = 0; i < list.length; i++) {
2617        const item = list[i];
2618        if (!state.includes(item)) {
2619          break;
2620        }
2621        firstItems.push(item);
2622      }
2623      return firstItems;
2624    }
2625    function useAsyncList(list, config = { step: 1 }) {
2626      const { step = 1 } = config;
2627      const [current, setCurrent] = (0, import_element24.useState)([]);
2628      (0, import_element24.useEffect)(() => {
2629        let firstItems = getFirstItemsPresentInState(list, current);
2630        if (firstItems.length < step) {
2631          firstItems = firstItems.concat(
2632            list.slice(firstItems.length, step)
2633          );
2634        }
2635        setCurrent(firstItems);
2636        const asyncQueue = (0, import_priority_queue.createQueue)();
2637        for (let i = firstItems.length; i < list.length; i += step) {
2638          asyncQueue.add({}, () => {
2639            (0, import_element24.flushSync)(() => {
2640              setCurrent((state) => [
2641                ...state,
2642                ...list.slice(i, i + step)
2643              ]);
2644            });
2645          });
2646        }
2647        return () => asyncQueue.reset();
2648      }, [list]);
2649      return current;
2650    }
2651    var use_async_list_default = useAsyncList;
2652  
2653    // packages/compose/build-module/hooks/use-warn-on-change/index.js
2654    function useWarnOnChange(object, prefix = "Change detection") {
2655      const previousValues = usePrevious(object);
2656      Object.entries(previousValues ?? []).forEach(([key, value]) => {
2657        if (value !== object[
2658          /** @type {keyof typeof object} */
2659          key
2660        ]) {
2661          console.warn(
2662            `$prefix}: $key} key changed:`,
2663            value,
2664            object[
2665              /** @type {keyof typeof object} */
2666              key
2667            ]
2668            /* eslint-enable jsdoc/check-types */
2669          );
2670        }
2671      });
2672    }
2673    var use_warn_on_change_default = useWarnOnChange;
2674  
2675    // node_modules/use-memo-one/dist/use-memo-one.esm.js
2676    var import_react = __toESM(require_react());
2677    function areInputsEqual(newInputs, lastInputs) {
2678      if (newInputs.length !== lastInputs.length) {
2679        return false;
2680      }
2681      for (var i = 0; i < newInputs.length; i++) {
2682        if (newInputs[i] !== lastInputs[i]) {
2683          return false;
2684        }
2685      }
2686      return true;
2687    }
2688    function useMemoOne(getResult, inputs) {
2689      var initial = (0, import_react.useState)(function() {
2690        return {
2691          inputs,
2692          result: getResult()
2693        };
2694      })[0];
2695      var committed = (0, import_react.useRef)(initial);
2696      var isInputMatch = Boolean(inputs && committed.current.inputs && areInputsEqual(inputs, committed.current.inputs));
2697      var cache = isInputMatch ? committed.current : {
2698        inputs,
2699        result: getResult()
2700      };
2701      (0, import_react.useEffect)(function() {
2702        committed.current = cache;
2703      }, [cache]);
2704      return cache.result;
2705    }
2706  
2707    // packages/compose/build-module/hooks/use-debounce/index.js
2708    var import_element25 = __toESM(require_element());
2709    function useDebounce(fn, wait, options) {
2710      const debounced = useMemoOne(
2711        () => debounce(fn, wait ?? 0, options),
2712        [fn, wait, options?.leading, options?.trailing, options?.maxWait]
2713      );
2714      (0, import_element25.useEffect)(() => () => debounced.cancel(), [debounced]);
2715      return debounced;
2716    }
2717  
2718    // packages/compose/build-module/hooks/use-debounced-input/index.js
2719    var import_element26 = __toESM(require_element());
2720    function useDebouncedInput(defaultValue = "") {
2721      const [input, setInput] = (0, import_element26.useState)(defaultValue);
2722      const [debouncedInput, setDebouncedState] = (0, import_element26.useState)(defaultValue);
2723      const setDebouncedInput = useDebounce(setDebouncedState, 250);
2724      (0, import_element26.useEffect)(() => {
2725        setDebouncedInput(input);
2726      }, [input, setDebouncedInput]);
2727      return [input, setInput, debouncedInput];
2728    }
2729  
2730    // packages/compose/build-module/hooks/use-throttle/index.js
2731    var import_element27 = __toESM(require_element());
2732    function useThrottle(fn, wait, options) {
2733      const throttled = useMemoOne(
2734        () => throttle(fn, wait ?? 0, options),
2735        [fn, wait, options]
2736      );
2737      (0, import_element27.useEffect)(() => () => throttled.cancel(), [throttled]);
2738      return throttled;
2739    }
2740  
2741    // packages/compose/build-module/hooks/use-drop-zone/index.js
2742    function useDropZone({
2743      dropZoneElement,
2744      isDisabled,
2745      onDrop: _onDrop,
2746      onDragStart: _onDragStart,
2747      onDragEnter: _onDragEnter,
2748      onDragLeave: _onDragLeave,
2749      onDragEnd: _onDragEnd,
2750      onDragOver: _onDragOver
2751    }) {
2752      const onDropEvent = useEvent(_onDrop);
2753      const onDragStartEvent = useEvent(_onDragStart);
2754      const onDragEnterEvent = useEvent(_onDragEnter);
2755      const onDragLeaveEvent = useEvent(_onDragLeave);
2756      const onDragEndEvent = useEvent(_onDragEnd);
2757      const onDragOverEvent = useEvent(_onDragOver);
2758      return useRefEffect(
2759        (elem) => {
2760          if (isDisabled) {
2761            return;
2762          }
2763          const element = dropZoneElement ?? elem;
2764          let isDragging = false;
2765          const { ownerDocument } = element;
2766          function isElementInZone(targetToCheck) {
2767            const { defaultView } = ownerDocument;
2768            if (!targetToCheck || !defaultView || !(targetToCheck instanceof defaultView.HTMLElement) || !element.contains(targetToCheck)) {
2769              return false;
2770            }
2771            let elementToCheck = targetToCheck;
2772            do {
2773              if (elementToCheck.dataset.isDropZone) {
2774                return elementToCheck === element;
2775              }
2776            } while (elementToCheck = elementToCheck.parentElement);
2777            return false;
2778          }
2779          function maybeDragStart(event) {
2780            if (isDragging) {
2781              return;
2782            }
2783            isDragging = true;
2784            ownerDocument.addEventListener("dragend", maybeDragEnd);
2785            ownerDocument.addEventListener("mousemove", maybeDragEnd);
2786            if (_onDragStart) {
2787              onDragStartEvent(event);
2788            }
2789          }
2790          function onDragEnter(event) {
2791            event.preventDefault();
2792            if (element.contains(
2793              /** @type {Node} */
2794              event.relatedTarget
2795            )) {
2796              return;
2797            }
2798            if (_onDragEnter) {
2799              onDragEnterEvent(event);
2800            }
2801          }
2802          function onDragOver(event) {
2803            if (!event.defaultPrevented && _onDragOver) {
2804              onDragOverEvent(event);
2805            }
2806            event.preventDefault();
2807          }
2808          function onDragLeave(event) {
2809            if (isElementInZone(event.relatedTarget)) {
2810              return;
2811            }
2812            if (_onDragLeave) {
2813              onDragLeaveEvent(event);
2814            }
2815          }
2816          function onDrop(event) {
2817            if (event.defaultPrevented) {
2818              return;
2819            }
2820            event.preventDefault();
2821            event.dataTransfer && event.dataTransfer.files.length;
2822            if (_onDrop) {
2823              onDropEvent(event);
2824            }
2825            maybeDragEnd(event);
2826          }
2827          function maybeDragEnd(event) {
2828            if (!isDragging) {
2829              return;
2830            }
2831            isDragging = false;
2832            ownerDocument.removeEventListener("dragend", maybeDragEnd);
2833            ownerDocument.removeEventListener("mousemove", maybeDragEnd);
2834            if (_onDragEnd) {
2835              onDragEndEvent(event);
2836            }
2837          }
2838          element.setAttribute("data-is-drop-zone", "true");
2839          element.addEventListener("drop", onDrop);
2840          element.addEventListener("dragenter", onDragEnter);
2841          element.addEventListener("dragover", onDragOver);
2842          element.addEventListener("dragleave", onDragLeave);
2843          ownerDocument.addEventListener("dragenter", maybeDragStart);
2844          return () => {
2845            element.removeAttribute("data-is-drop-zone");
2846            element.removeEventListener("drop", onDrop);
2847            element.removeEventListener("dragenter", onDragEnter);
2848            element.removeEventListener("dragover", onDragOver);
2849            element.removeEventListener("dragleave", onDragLeave);
2850            ownerDocument.removeEventListener("dragend", maybeDragEnd);
2851            ownerDocument.removeEventListener("mousemove", maybeDragEnd);
2852            ownerDocument.removeEventListener(
2853              "dragenter",
2854              maybeDragStart
2855            );
2856          };
2857        },
2858        [isDisabled, dropZoneElement]
2859        // Refresh when the passed in dropZoneElement changes.
2860      );
2861    }
2862  
2863    // packages/compose/build-module/hooks/use-focusable-iframe/index.js
2864    function useFocusableIframe() {
2865      return useRefEffect((element) => {
2866        const { ownerDocument } = element;
2867        if (!ownerDocument) {
2868          return;
2869        }
2870        const { defaultView } = ownerDocument;
2871        if (!defaultView) {
2872          return;
2873        }
2874        function checkFocus() {
2875          if (ownerDocument && ownerDocument.activeElement === element) {
2876            element.focus();
2877          }
2878        }
2879        defaultView.addEventListener("blur", checkFocus);
2880        return () => {
2881          defaultView.removeEventListener("blur", checkFocus);
2882        };
2883      }, []);
2884    }
2885  
2886    // packages/compose/build-module/hooks/use-fixed-window-list/index.js
2887    var import_element28 = __toESM(require_element());
2888    var import_dom3 = __toESM(require_dom());
2889    var import_keycodes3 = __toESM(require_keycodes());
2890    var DEFAULT_INIT_WINDOW_SIZE = 30;
2891    function useFixedWindowList(elementRef, itemHeight, totalItems, options) {
2892      const initWindowSize = options?.initWindowSize ?? DEFAULT_INIT_WINDOW_SIZE;
2893      const useWindowing = options?.useWindowing ?? true;
2894      const [fixedListWindow, setFixedListWindow] = (0, import_element28.useState)({
2895        visibleItems: initWindowSize,
2896        start: 0,
2897        end: initWindowSize,
2898        itemInView: (index) => {
2899          return index >= 0 && index <= initWindowSize;
2900        }
2901      });
2902      (0, import_element28.useLayoutEffect)(() => {
2903        if (!useWindowing) {
2904          return;
2905        }
2906        const scrollContainer = (0, import_dom3.getScrollContainer)(elementRef.current);
2907        const measureWindow = (initRender) => {
2908          if (!scrollContainer) {
2909            return;
2910          }
2911          const visibleItems = Math.ceil(
2912            scrollContainer.clientHeight / itemHeight
2913          );
2914          const windowOverscan = initRender ? visibleItems : options?.windowOverscan ?? visibleItems;
2915          const firstViewableIndex = Math.floor(
2916            scrollContainer.scrollTop / itemHeight
2917          );
2918          const start = Math.max(0, firstViewableIndex - windowOverscan);
2919          const end = Math.min(
2920            totalItems - 1,
2921            firstViewableIndex + visibleItems + windowOverscan
2922          );
2923          setFixedListWindow((lastWindow) => {
2924            const nextWindow = {
2925              visibleItems,
2926              start,
2927              end,
2928              itemInView: (index) => {
2929                return start <= index && index <= end;
2930              }
2931            };
2932            if (lastWindow.start !== nextWindow.start || lastWindow.end !== nextWindow.end || lastWindow.visibleItems !== nextWindow.visibleItems) {
2933              return nextWindow;
2934            }
2935            return lastWindow;
2936          });
2937        };
2938        measureWindow(true);
2939        const debounceMeasureList = debounce(() => {
2940          measureWindow();
2941        }, 16);
2942        scrollContainer?.addEventListener("scroll", debounceMeasureList);
2943        scrollContainer?.ownerDocument?.defaultView?.addEventListener(
2944          "resize",
2945          debounceMeasureList
2946        );
2947        scrollContainer?.ownerDocument?.defaultView?.addEventListener(
2948          "resize",
2949          debounceMeasureList
2950        );
2951        return () => {
2952          scrollContainer?.removeEventListener(
2953            "scroll",
2954            debounceMeasureList
2955          );
2956          scrollContainer?.ownerDocument?.defaultView?.removeEventListener(
2957            "resize",
2958            debounceMeasureList
2959          );
2960        };
2961      }, [
2962        itemHeight,
2963        elementRef,
2964        totalItems,
2965        options?.expandedState,
2966        options?.windowOverscan,
2967        useWindowing
2968      ]);
2969      (0, import_element28.useLayoutEffect)(() => {
2970        if (!useWindowing) {
2971          return;
2972        }
2973        const scrollContainer = (0, import_dom3.getScrollContainer)(elementRef.current);
2974        const handleKeyDown = (event) => {
2975          switch (event.keyCode) {
2976            case import_keycodes3.HOME: {
2977              return scrollContainer?.scrollTo({ top: 0 });
2978            }
2979            case import_keycodes3.END: {
2980              return scrollContainer?.scrollTo({
2981                top: totalItems * itemHeight
2982              });
2983            }
2984            case import_keycodes3.PAGEUP: {
2985              return scrollContainer?.scrollTo({
2986                top: scrollContainer.scrollTop - fixedListWindow.visibleItems * itemHeight
2987              });
2988            }
2989            case import_keycodes3.PAGEDOWN: {
2990              return scrollContainer?.scrollTo({
2991                top: scrollContainer.scrollTop + fixedListWindow.visibleItems * itemHeight
2992              });
2993            }
2994          }
2995        };
2996        scrollContainer?.ownerDocument?.defaultView?.addEventListener(
2997          "keydown",
2998          handleKeyDown
2999        );
3000        return () => {
3001          scrollContainer?.ownerDocument?.defaultView?.removeEventListener(
3002            "keydown",
3003            handleKeyDown
3004          );
3005        };
3006      }, [
3007        totalItems,
3008        itemHeight,
3009        elementRef,
3010        fixedListWindow.visibleItems,
3011        useWindowing,
3012        options?.expandedState
3013      ]);
3014      return [fixedListWindow, setFixedListWindow];
3015    }
3016  
3017    // packages/compose/build-module/hooks/use-observable-value/index.js
3018    var import_element29 = __toESM(require_element());
3019    function useObservableValue(map, name) {
3020      const [subscribe, getValue] = (0, import_element29.useMemo)(
3021        () => [
3022          (listener2) => map.subscribe(name, listener2),
3023          () => map.get(name)
3024        ],
3025        [map, name]
3026      );
3027      return (0, import_element29.useSyncExternalStore)(subscribe, getValue, getValue);
3028    }
3029    return __toCommonJS(index_exports);
3030  })();
3031  /*! Bundled license information:
3032  
3033  clipboard/dist/clipboard.js:
3034    (*!
3035     * clipboard.js v2.0.11
3036     * https://clipboardjs.com/
3037     *
3038     * Licensed MIT © Zeno Rocha
3039     *)
3040  */


Generated : Wed Apr 15 08:20:10 2026 Cross-referenced by PHPXref