[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  (function() {
   2  var wp;
   3  (wp ||= {}).editWidgets = (() => {
   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 name2 in all)
  15        __defProp(target, name2, { get: all[name2], 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    // package-external:@wordpress/blocks
  36    var require_blocks = __commonJS({
  37      "package-external:@wordpress/blocks"(exports, module) {
  38        module.exports = window.wp.blocks;
  39      }
  40    });
  41  
  42    // package-external:@wordpress/data
  43    var require_data = __commonJS({
  44      "package-external:@wordpress/data"(exports, module) {
  45        module.exports = window.wp.data;
  46      }
  47    });
  48  
  49    // package-external:@wordpress/deprecated
  50    var require_deprecated = __commonJS({
  51      "package-external:@wordpress/deprecated"(exports, module) {
  52        module.exports = window.wp.deprecated;
  53      }
  54    });
  55  
  56    // package-external:@wordpress/element
  57    var require_element = __commonJS({
  58      "package-external:@wordpress/element"(exports, module) {
  59        module.exports = window.wp.element;
  60      }
  61    });
  62  
  63    // package-external:@wordpress/block-library
  64    var require_block_library = __commonJS({
  65      "package-external:@wordpress/block-library"(exports, module) {
  66        module.exports = window.wp.blockLibrary;
  67      }
  68    });
  69  
  70    // package-external:@wordpress/core-data
  71    var require_core_data = __commonJS({
  72      "package-external:@wordpress/core-data"(exports, module) {
  73        module.exports = window.wp.coreData;
  74      }
  75    });
  76  
  77    // package-external:@wordpress/widgets
  78    var require_widgets = __commonJS({
  79      "package-external:@wordpress/widgets"(exports, module) {
  80        module.exports = window.wp.widgets;
  81      }
  82    });
  83  
  84    // package-external:@wordpress/preferences
  85    var require_preferences = __commonJS({
  86      "package-external:@wordpress/preferences"(exports, module) {
  87        module.exports = window.wp.preferences;
  88      }
  89    });
  90  
  91    // package-external:@wordpress/api-fetch
  92    var require_api_fetch = __commonJS({
  93      "package-external:@wordpress/api-fetch"(exports, module) {
  94        module.exports = window.wp.apiFetch;
  95      }
  96    });
  97  
  98    // package-external:@wordpress/i18n
  99    var require_i18n = __commonJS({
 100      "package-external:@wordpress/i18n"(exports, module) {
 101        module.exports = window.wp.i18n;
 102      }
 103    });
 104  
 105    // package-external:@wordpress/notices
 106    var require_notices = __commonJS({
 107      "package-external:@wordpress/notices"(exports, module) {
 108        module.exports = window.wp.notices;
 109      }
 110    });
 111  
 112    // package-external:@wordpress/components
 113    var require_components = __commonJS({
 114      "package-external:@wordpress/components"(exports, module) {
 115        module.exports = window.wp.components;
 116      }
 117    });
 118  
 119    // package-external:@wordpress/primitives
 120    var require_primitives = __commonJS({
 121      "package-external:@wordpress/primitives"(exports, module) {
 122        module.exports = window.wp.primitives;
 123      }
 124    });
 125  
 126    // vendor-external:react/jsx-runtime
 127    var require_jsx_runtime = __commonJS({
 128      "vendor-external:react/jsx-runtime"(exports, module) {
 129        module.exports = window.ReactJSXRuntime;
 130      }
 131    });
 132  
 133    // package-external:@wordpress/viewport
 134    var require_viewport = __commonJS({
 135      "package-external:@wordpress/viewport"(exports, module) {
 136        module.exports = window.wp.viewport;
 137      }
 138    });
 139  
 140    // package-external:@wordpress/compose
 141    var require_compose = __commonJS({
 142      "package-external:@wordpress/compose"(exports, module) {
 143        module.exports = window.wp.compose;
 144      }
 145    });
 146  
 147    // package-external:@wordpress/plugins
 148    var require_plugins = __commonJS({
 149      "package-external:@wordpress/plugins"(exports, module) {
 150        module.exports = window.wp.plugins;
 151      }
 152    });
 153  
 154    // vendor-external:react
 155    var require_react = __commonJS({
 156      "vendor-external:react"(exports, module) {
 157        module.exports = window.React;
 158      }
 159    });
 160  
 161    // package-external:@wordpress/theme
 162    var require_theme = __commonJS({
 163      "package-external:@wordpress/theme"(exports, module) {
 164        module.exports = window.wp.theme;
 165      }
 166    });
 167  
 168    // package-external:@wordpress/private-apis
 169    var require_private_apis = __commonJS({
 170      "package-external:@wordpress/private-apis"(exports, module) {
 171        module.exports = window.wp.privateApis;
 172      }
 173    });
 174  
 175    // package-external:@wordpress/block-editor
 176    var require_block_editor = __commonJS({
 177      "package-external:@wordpress/block-editor"(exports, module) {
 178        module.exports = window.wp.blockEditor;
 179      }
 180    });
 181  
 182    // package-external:@wordpress/hooks
 183    var require_hooks = __commonJS({
 184      "package-external:@wordpress/hooks"(exports, module) {
 185        module.exports = window.wp.hooks;
 186      }
 187    });
 188  
 189    // package-external:@wordpress/media-utils
 190    var require_media_utils = __commonJS({
 191      "package-external:@wordpress/media-utils"(exports, module) {
 192        module.exports = window.wp.mediaUtils;
 193      }
 194    });
 195  
 196    // package-external:@wordpress/patterns
 197    var require_patterns = __commonJS({
 198      "package-external:@wordpress/patterns"(exports, module) {
 199        module.exports = window.wp.patterns;
 200      }
 201    });
 202  
 203    // package-external:@wordpress/keyboard-shortcuts
 204    var require_keyboard_shortcuts = __commonJS({
 205      "package-external:@wordpress/keyboard-shortcuts"(exports, module) {
 206        module.exports = window.wp.keyboardShortcuts;
 207      }
 208    });
 209  
 210    // package-external:@wordpress/keycodes
 211    var require_keycodes = __commonJS({
 212      "package-external:@wordpress/keycodes"(exports, module) {
 213        module.exports = window.wp.keycodes;
 214      }
 215    });
 216  
 217    // package-external:@wordpress/url
 218    var require_url = __commonJS({
 219      "package-external:@wordpress/url"(exports, module) {
 220        module.exports = window.wp.url;
 221      }
 222    });
 223  
 224    // package-external:@wordpress/dom
 225    var require_dom = __commonJS({
 226      "package-external:@wordpress/dom"(exports, module) {
 227        module.exports = window.wp.dom;
 228      }
 229    });
 230  
 231    // packages/edit-widgets/build-module/index.mjs
 232    var index_exports = {};
 233    __export(index_exports, {
 234      initialize: () => initialize,
 235      initializeEditor: () => initializeEditor,
 236      reinitializeEditor: () => reinitializeEditor,
 237      store: () => store2
 238    });
 239    var import_blocks3 = __toESM(require_blocks(), 1);
 240    var import_data32 = __toESM(require_data(), 1);
 241    var import_deprecated6 = __toESM(require_deprecated(), 1);
 242    var import_element27 = __toESM(require_element(), 1);
 243    var import_block_library2 = __toESM(require_block_library(), 1);
 244    var import_core_data12 = __toESM(require_core_data(), 1);
 245    var import_widgets5 = __toESM(require_widgets(), 1);
 246    var import_preferences10 = __toESM(require_preferences(), 1);
 247  
 248    // packages/edit-widgets/build-module/store/index.mjs
 249    var import_api_fetch = __toESM(require_api_fetch(), 1);
 250    var import_data8 = __toESM(require_data(), 1);
 251  
 252    // packages/edit-widgets/build-module/store/reducer.mjs
 253    var import_data = __toESM(require_data(), 1);
 254    function widgetAreasOpenState(state = {}, action) {
 255      const { type } = action;
 256      switch (type) {
 257        case "SET_WIDGET_AREAS_OPEN_STATE": {
 258          return action.widgetAreasOpenState;
 259        }
 260        case "SET_IS_WIDGET_AREA_OPEN": {
 261          const { clientId, isOpen } = action;
 262          return {
 263            ...state,
 264            [clientId]: isOpen
 265          };
 266        }
 267        default: {
 268          return state;
 269        }
 270      }
 271    }
 272    function blockInserterPanel(state = false, action) {
 273      switch (action.type) {
 274        case "SET_IS_LIST_VIEW_OPENED":
 275          return action.isOpen ? false : state;
 276        case "SET_IS_INSERTER_OPENED":
 277          return action.value;
 278      }
 279      return state;
 280    }
 281    function listViewPanel(state = false, action) {
 282      switch (action.type) {
 283        case "SET_IS_INSERTER_OPENED":
 284          return action.value ? false : state;
 285        case "SET_IS_LIST_VIEW_OPENED":
 286          return action.isOpen;
 287      }
 288      return state;
 289    }
 290    function listViewToggleRef(state = { current: null }) {
 291      return state;
 292    }
 293    function inserterSidebarToggleRef(state = { current: null }) {
 294      return state;
 295    }
 296    function widgetSavingLock(state = {}, action) {
 297      switch (action.type) {
 298        case "LOCK_WIDGET_SAVING":
 299          return { ...state, [action.lockName]: true };
 300        case "UNLOCK_WIDGET_SAVING": {
 301          const { [action.lockName]: removedLockName, ...restState } = state;
 302          return restState;
 303        }
 304      }
 305      return state;
 306    }
 307    var reducer_default = (0, import_data.combineReducers)({
 308      blockInserterPanel,
 309      inserterSidebarToggleRef,
 310      listViewPanel,
 311      listViewToggleRef,
 312      widgetAreasOpenState,
 313      widgetSavingLock
 314    });
 315  
 316    // packages/edit-widgets/build-module/store/resolvers.mjs
 317    var resolvers_exports = {};
 318    __export(resolvers_exports, {
 319      getWidgetAreas: () => getWidgetAreas,
 320      getWidgets: () => getWidgets
 321    });
 322    var import_blocks2 = __toESM(require_blocks(), 1);
 323    var import_core_data2 = __toESM(require_core_data(), 1);
 324  
 325    // packages/edit-widgets/build-module/store/actions.mjs
 326    var actions_exports2 = {};
 327    __export(actions_exports2, {
 328      closeGeneralSidebar: () => closeGeneralSidebar,
 329      lockWidgetSaving: () => lockWidgetSaving,
 330      moveBlockToWidgetArea: () => moveBlockToWidgetArea,
 331      persistStubPost: () => persistStubPost,
 332      saveEditedWidgetAreas: () => saveEditedWidgetAreas,
 333      saveWidgetArea: () => saveWidgetArea,
 334      saveWidgetAreas: () => saveWidgetAreas,
 335      setIsInserterOpened: () => setIsInserterOpened,
 336      setIsListViewOpened: () => setIsListViewOpened,
 337      setIsWidgetAreaOpen: () => setIsWidgetAreaOpen,
 338      setWidgetAreasOpenState: () => setWidgetAreasOpenState,
 339      setWidgetIdForClientId: () => setWidgetIdForClientId,
 340      unlockWidgetSaving: () => unlockWidgetSaving
 341    });
 342    var import_i18n3 = __toESM(require_i18n(), 1);
 343    var import_notices = __toESM(require_notices(), 1);
 344  
 345    // node_modules/clsx/dist/clsx.mjs
 346    function r(e) {
 347      var t, f, n = "";
 348      if ("string" == typeof e || "number" == typeof e) n += e;
 349      else if ("object" == typeof e) if (Array.isArray(e)) {
 350        var o = e.length;
 351        for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
 352      } else for (f in e) e[f] && (n && (n += " "), n += f);
 353      return n;
 354    }
 355    function clsx() {
 356      for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
 357      return n;
 358    }
 359    var clsx_default = clsx;
 360  
 361    // packages/interface/build-module/components/complementary-area/index.mjs
 362    var import_components5 = __toESM(require_components(), 1);
 363    var import_data6 = __toESM(require_data(), 1);
 364    var import_i18n = __toESM(require_i18n(), 1);
 365  
 366    // packages/icons/build-module/library/block-default.mjs
 367    var import_primitives = __toESM(require_primitives(), 1);
 368    var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
 369    var block_default_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) });
 370  
 371    // packages/icons/build-module/library/check.mjs
 372    var import_primitives2 = __toESM(require_primitives(), 1);
 373    var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
 374    var check_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) });
 375  
 376    // packages/icons/build-module/library/close-small.mjs
 377    var import_primitives3 = __toESM(require_primitives(), 1);
 378    var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
 379    var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) });
 380  
 381    // packages/icons/build-module/library/drawer-left.mjs
 382    var import_primitives4 = __toESM(require_primitives(), 1);
 383    var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
 384    var drawer_left_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" }) });
 385  
 386    // packages/icons/build-module/library/drawer-right.mjs
 387    var import_primitives5 = __toESM(require_primitives(), 1);
 388    var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
 389    var drawer_right_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" }) });
 390  
 391    // packages/icons/build-module/library/external.mjs
 392    var import_primitives6 = __toESM(require_primitives(), 1);
 393    var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
 394    var external_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) });
 395  
 396    // packages/icons/build-module/library/list-view.mjs
 397    var import_primitives7 = __toESM(require_primitives(), 1);
 398    var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
 399    var list_view_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) });
 400  
 401    // packages/icons/build-module/library/more-vertical.mjs
 402    var import_primitives8 = __toESM(require_primitives(), 1);
 403    var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
 404    var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) });
 405  
 406    // packages/icons/build-module/library/plus.mjs
 407    var import_primitives9 = __toESM(require_primitives(), 1);
 408    var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
 409    var plus_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) });
 410  
 411    // packages/icons/build-module/library/redo.mjs
 412    var import_primitives10 = __toESM(require_primitives(), 1);
 413    var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
 414    var redo_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) });
 415  
 416    // packages/icons/build-module/library/star-empty.mjs
 417    var import_primitives11 = __toESM(require_primitives(), 1);
 418    var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
 419    var star_empty_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z" }) });
 420  
 421    // packages/icons/build-module/library/star-filled.mjs
 422    var import_primitives12 = __toESM(require_primitives(), 1);
 423    var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
 424    var star_filled_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) });
 425  
 426    // packages/icons/build-module/library/undo.mjs
 427    var import_primitives13 = __toESM(require_primitives(), 1);
 428    var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
 429    var undo_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) });
 430  
 431    // packages/interface/build-module/components/complementary-area/index.mjs
 432    var import_element2 = __toESM(require_element(), 1);
 433    var import_viewport = __toESM(require_viewport(), 1);
 434    var import_preferences3 = __toESM(require_preferences(), 1);
 435    var import_compose = __toESM(require_compose(), 1);
 436    var import_plugins2 = __toESM(require_plugins(), 1);
 437  
 438    // packages/interface/build-module/components/complementary-area-toggle/index.mjs
 439    var import_components = __toESM(require_components(), 1);
 440    var import_data5 = __toESM(require_data(), 1);
 441    var import_plugins = __toESM(require_plugins(), 1);
 442  
 443    // packages/interface/build-module/store/index.mjs
 444    var import_data4 = __toESM(require_data(), 1);
 445  
 446    // packages/interface/build-module/store/actions.mjs
 447    var actions_exports = {};
 448    __export(actions_exports, {
 449      closeModal: () => closeModal,
 450      disableComplementaryArea: () => disableComplementaryArea,
 451      enableComplementaryArea: () => enableComplementaryArea,
 452      openModal: () => openModal,
 453      pinItem: () => pinItem,
 454      setDefaultComplementaryArea: () => setDefaultComplementaryArea,
 455      setFeatureDefaults: () => setFeatureDefaults,
 456      setFeatureValue: () => setFeatureValue,
 457      toggleFeature: () => toggleFeature,
 458      unpinItem: () => unpinItem
 459    });
 460    var import_deprecated2 = __toESM(require_deprecated(), 1);
 461    var import_preferences = __toESM(require_preferences(), 1);
 462  
 463    // packages/interface/build-module/store/deprecated.mjs
 464    var import_deprecated = __toESM(require_deprecated(), 1);
 465    function normalizeComplementaryAreaScope(scope) {
 466      if (["core/edit-post", "core/edit-site"].includes(scope)) {
 467        (0, import_deprecated.default)(`$scope} interface scope`, {
 468          alternative: "core interface scope",
 469          hint: "core/edit-post and core/edit-site are merging.",
 470          version: "6.6"
 471        });
 472        return "core";
 473      }
 474      return scope;
 475    }
 476    function normalizeComplementaryAreaName(scope, name2) {
 477      if (scope === "core" && name2 === "edit-site/template") {
 478        (0, import_deprecated.default)(`edit-site/template sidebar`, {
 479          alternative: "edit-post/document",
 480          version: "6.6"
 481        });
 482        return "edit-post/document";
 483      }
 484      if (scope === "core" && name2 === "edit-site/block-inspector") {
 485        (0, import_deprecated.default)(`edit-site/block-inspector sidebar`, {
 486          alternative: "edit-post/block",
 487          version: "6.6"
 488        });
 489        return "edit-post/block";
 490      }
 491      return name2;
 492    }
 493  
 494    // packages/interface/build-module/store/actions.mjs
 495    var setDefaultComplementaryArea = (scope, area) => {
 496      scope = normalizeComplementaryAreaScope(scope);
 497      area = normalizeComplementaryAreaName(scope, area);
 498      return {
 499        type: "SET_DEFAULT_COMPLEMENTARY_AREA",
 500        scope,
 501        area
 502      };
 503    };
 504    var enableComplementaryArea = (scope, area) => ({ registry, dispatch: dispatch2 }) => {
 505      if (!area) {
 506        return;
 507      }
 508      scope = normalizeComplementaryAreaScope(scope);
 509      area = normalizeComplementaryAreaName(scope, area);
 510      const isComplementaryAreaVisible = registry.select(import_preferences.store).get(scope, "isComplementaryAreaVisible");
 511      if (!isComplementaryAreaVisible) {
 512        registry.dispatch(import_preferences.store).set(scope, "isComplementaryAreaVisible", true);
 513      }
 514      dispatch2({
 515        type: "ENABLE_COMPLEMENTARY_AREA",
 516        scope,
 517        area
 518      });
 519    };
 520    var disableComplementaryArea = (scope) => ({ registry }) => {
 521      scope = normalizeComplementaryAreaScope(scope);
 522      const isComplementaryAreaVisible = registry.select(import_preferences.store).get(scope, "isComplementaryAreaVisible");
 523      if (isComplementaryAreaVisible) {
 524        registry.dispatch(import_preferences.store).set(scope, "isComplementaryAreaVisible", false);
 525      }
 526    };
 527    var pinItem = (scope, item) => ({ registry }) => {
 528      if (!item) {
 529        return;
 530      }
 531      scope = normalizeComplementaryAreaScope(scope);
 532      item = normalizeComplementaryAreaName(scope, item);
 533      const pinnedItems = registry.select(import_preferences.store).get(scope, "pinnedItems");
 534      if (pinnedItems?.[item] === true) {
 535        return;
 536      }
 537      registry.dispatch(import_preferences.store).set(scope, "pinnedItems", {
 538        ...pinnedItems,
 539        [item]: true
 540      });
 541    };
 542    var unpinItem = (scope, item) => ({ registry }) => {
 543      if (!item) {
 544        return;
 545      }
 546      scope = normalizeComplementaryAreaScope(scope);
 547      item = normalizeComplementaryAreaName(scope, item);
 548      const pinnedItems = registry.select(import_preferences.store).get(scope, "pinnedItems");
 549      registry.dispatch(import_preferences.store).set(scope, "pinnedItems", {
 550        ...pinnedItems,
 551        [item]: false
 552      });
 553    };
 554    function toggleFeature(scope, featureName) {
 555      return function({ registry }) {
 556        (0, import_deprecated2.default)(`dispatch( 'core/interface' ).toggleFeature`, {
 557          since: "6.0",
 558          alternative: `dispatch( 'core/preferences' ).toggle`
 559        });
 560        registry.dispatch(import_preferences.store).toggle(scope, featureName);
 561      };
 562    }
 563    function setFeatureValue(scope, featureName, value) {
 564      return function({ registry }) {
 565        (0, import_deprecated2.default)(`dispatch( 'core/interface' ).setFeatureValue`, {
 566          since: "6.0",
 567          alternative: `dispatch( 'core/preferences' ).set`
 568        });
 569        registry.dispatch(import_preferences.store).set(scope, featureName, !!value);
 570      };
 571    }
 572    function setFeatureDefaults(scope, defaults) {
 573      return function({ registry }) {
 574        (0, import_deprecated2.default)(`dispatch( 'core/interface' ).setFeatureDefaults`, {
 575          since: "6.0",
 576          alternative: `dispatch( 'core/preferences' ).setDefaults`
 577        });
 578        registry.dispatch(import_preferences.store).setDefaults(scope, defaults);
 579      };
 580    }
 581    function openModal(name2) {
 582      return {
 583        type: "OPEN_MODAL",
 584        name: name2
 585      };
 586    }
 587    function closeModal() {
 588      return {
 589        type: "CLOSE_MODAL"
 590      };
 591    }
 592  
 593    // packages/interface/build-module/store/selectors.mjs
 594    var selectors_exports = {};
 595    __export(selectors_exports, {
 596      getActiveComplementaryArea: () => getActiveComplementaryArea,
 597      isComplementaryAreaLoading: () => isComplementaryAreaLoading,
 598      isFeatureActive: () => isFeatureActive,
 599      isItemPinned: () => isItemPinned,
 600      isModalActive: () => isModalActive
 601    });
 602    var import_data2 = __toESM(require_data(), 1);
 603    var import_deprecated4 = __toESM(require_deprecated(), 1);
 604    var import_preferences2 = __toESM(require_preferences(), 1);
 605    var getActiveComplementaryArea = (0, import_data2.createRegistrySelector)(
 606      (select) => (state, scope) => {
 607        scope = normalizeComplementaryAreaScope(scope);
 608        const isComplementaryAreaVisible = select(import_preferences2.store).get(
 609          scope,
 610          "isComplementaryAreaVisible"
 611        );
 612        if (isComplementaryAreaVisible === void 0) {
 613          return void 0;
 614        }
 615        if (isComplementaryAreaVisible === false) {
 616          return null;
 617        }
 618        return state?.complementaryAreas?.[scope];
 619      }
 620    );
 621    var isComplementaryAreaLoading = (0, import_data2.createRegistrySelector)(
 622      (select) => (state, scope) => {
 623        scope = normalizeComplementaryAreaScope(scope);
 624        const isVisible = select(import_preferences2.store).get(
 625          scope,
 626          "isComplementaryAreaVisible"
 627        );
 628        const identifier = state?.complementaryAreas?.[scope];
 629        return isVisible && identifier === void 0;
 630      }
 631    );
 632    var isItemPinned = (0, import_data2.createRegistrySelector)(
 633      (select) => (state, scope, item) => {
 634        scope = normalizeComplementaryAreaScope(scope);
 635        item = normalizeComplementaryAreaName(scope, item);
 636        const pinnedItems = select(import_preferences2.store).get(
 637          scope,
 638          "pinnedItems"
 639        );
 640        return pinnedItems?.[item] ?? true;
 641      }
 642    );
 643    var isFeatureActive = (0, import_data2.createRegistrySelector)(
 644      (select) => (state, scope, featureName) => {
 645        (0, import_deprecated4.default)(
 646          `select( 'core/interface' ).isFeatureActive( scope, featureName )`,
 647          {
 648            since: "6.0",
 649            alternative: `select( 'core/preferences' ).get( scope, featureName )`
 650          }
 651        );
 652        return !!select(import_preferences2.store).get(scope, featureName);
 653      }
 654    );
 655    function isModalActive(state, modalName) {
 656      return state.activeModal === modalName;
 657    }
 658  
 659    // packages/interface/build-module/store/reducer.mjs
 660    var import_data3 = __toESM(require_data(), 1);
 661    function complementaryAreas(state = {}, action) {
 662      switch (action.type) {
 663        case "SET_DEFAULT_COMPLEMENTARY_AREA": {
 664          const { scope, area } = action;
 665          if (state[scope]) {
 666            return state;
 667          }
 668          return {
 669            ...state,
 670            [scope]: area
 671          };
 672        }
 673        case "ENABLE_COMPLEMENTARY_AREA": {
 674          const { scope, area } = action;
 675          return {
 676            ...state,
 677            [scope]: area
 678          };
 679        }
 680      }
 681      return state;
 682    }
 683    function activeModal(state = null, action) {
 684      switch (action.type) {
 685        case "OPEN_MODAL":
 686          return action.name;
 687        case "CLOSE_MODAL":
 688          return null;
 689      }
 690      return state;
 691    }
 692    var reducer_default2 = (0, import_data3.combineReducers)({
 693      complementaryAreas,
 694      activeModal
 695    });
 696  
 697    // packages/interface/build-module/store/constants.mjs
 698    var STORE_NAME = "core/interface";
 699  
 700    // packages/interface/build-module/store/index.mjs
 701    var store = (0, import_data4.createReduxStore)(STORE_NAME, {
 702      reducer: reducer_default2,
 703      actions: actions_exports,
 704      selectors: selectors_exports
 705    });
 706    (0, import_data4.register)(store);
 707  
 708    // packages/interface/build-module/components/complementary-area-toggle/index.mjs
 709    var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
 710    function roleSupportsCheckedState(role) {
 711      return [
 712        "checkbox",
 713        "option",
 714        "radio",
 715        "switch",
 716        "menuitemcheckbox",
 717        "menuitemradio",
 718        "treeitem"
 719      ].includes(role);
 720    }
 721    function ComplementaryAreaToggle({
 722      as = import_components.Button,
 723      scope,
 724      identifier: identifierProp,
 725      icon: iconProp,
 726      selectedIcon,
 727      name: name2,
 728      shortcut,
 729      ...props
 730    }) {
 731      const ComponentToUse = as;
 732      const context = (0, import_plugins.usePluginContext)();
 733      const icon = iconProp || context.icon;
 734      const identifier = identifierProp || `$context.name}/$name2}`;
 735      const isSelected = (0, import_data5.useSelect)(
 736        (select) => select(store).getActiveComplementaryArea(scope) === identifier,
 737        [identifier, scope]
 738      );
 739      const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data5.useDispatch)(store);
 740      return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
 741        ComponentToUse,
 742        {
 743          icon: selectedIcon && isSelected ? selectedIcon : icon,
 744          "aria-controls": identifier.replace("/", ":"),
 745          "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : void 0,
 746          onClick: () => {
 747            if (isSelected) {
 748              disableComplementaryArea2(scope);
 749            } else {
 750              enableComplementaryArea2(scope, identifier);
 751            }
 752          },
 753          shortcut,
 754          ...props
 755        }
 756      );
 757    }
 758  
 759    // packages/interface/build-module/components/complementary-area-header/index.mjs
 760    var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
 761    var ComplementaryAreaHeader = ({
 762      children,
 763      className,
 764      toggleButtonProps
 765    }) => {
 766      const toggleButton = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps });
 767      return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
 768        "div",
 769        {
 770          className: clsx_default(
 771            "components-panel__header",
 772            "interface-complementary-area-header",
 773            className
 774          ),
 775          tabIndex: -1,
 776          children: [
 777            children,
 778            toggleButton
 779          ]
 780        }
 781      );
 782    };
 783    var complementary_area_header_default = ComplementaryAreaHeader;
 784  
 785    // packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs
 786    var import_components3 = __toESM(require_components(), 1);
 787  
 788    // packages/interface/build-module/components/action-item/index.mjs
 789    var import_components2 = __toESM(require_components(), 1);
 790    var import_element = __toESM(require_element(), 1);
 791    var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
 792    var noop = () => {
 793    };
 794    function ActionItemSlot({
 795      name: name2,
 796      as: Component2 = import_components2.MenuGroup,
 797      fillProps = {},
 798      bubblesVirtually,
 799      ...props
 800    }) {
 801      return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
 802        import_components2.Slot,
 803        {
 804          name: name2,
 805          bubblesVirtually,
 806          fillProps,
 807          children: (fills) => {
 808            if (!import_element.Children.toArray(fills).length) {
 809              return null;
 810            }
 811            const initializedByPlugins = [];
 812            import_element.Children.forEach(
 813              fills,
 814              ({
 815                props: { __unstableExplicitMenuItem, __unstableTarget }
 816              }) => {
 817                if (__unstableTarget && __unstableExplicitMenuItem) {
 818                  initializedByPlugins.push(__unstableTarget);
 819                }
 820              }
 821            );
 822            const children = import_element.Children.map(fills, (child) => {
 823              if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(
 824                child.props.__unstableTarget
 825              )) {
 826                return null;
 827              }
 828              return child;
 829            });
 830            return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Component2, { ...props, children });
 831          }
 832        }
 833      );
 834    }
 835    function ActionItem({ name: name2, as: Component2 = import_components2.Button, onClick, ...props }) {
 836      return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components2.Fill, { name: name2, children: ({ onClick: fpOnClick }) => {
 837        return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
 838          Component2,
 839          {
 840            onClick: onClick || fpOnClick ? (...args) => {
 841              (onClick || noop)(...args);
 842              (fpOnClick || noop)(...args);
 843            } : void 0,
 844            ...props
 845          }
 846        );
 847      } });
 848    }
 849    ActionItem.Slot = ActionItemSlot;
 850    var action_item_default = ActionItem;
 851  
 852    // packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs
 853    var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
 854    var PluginsMenuItem = ({
 855      // Menu item is marked with unstable prop for backward compatibility.
 856      // They are removed so they don't leak to DOM elements.
 857      // @see https://github.com/WordPress/gutenberg/issues/14457
 858      __unstableExplicitMenuItem,
 859      __unstableTarget,
 860      ...restProps
 861    }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components3.MenuItem, { ...restProps });
 862    function ComplementaryAreaMoreMenuItem({
 863      scope,
 864      target,
 865      __unstableExplicitMenuItem,
 866      ...props
 867    }) {
 868      return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
 869        ComplementaryAreaToggle,
 870        {
 871          as: (toggleProps) => {
 872            return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
 873              action_item_default,
 874              {
 875                __unstableExplicitMenuItem,
 876                __unstableTarget: `$scope}/$target}`,
 877                as: PluginsMenuItem,
 878                name: `$scope}/plugin-more-menu`,
 879                ...toggleProps
 880              }
 881            );
 882          },
 883          role: "menuitemcheckbox",
 884          selectedIcon: check_default,
 885          name: target,
 886          scope,
 887          ...props
 888        }
 889      );
 890    }
 891  
 892    // packages/interface/build-module/components/pinned-items/index.mjs
 893    var import_components4 = __toESM(require_components(), 1);
 894    var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
 895    function PinnedItems({ scope, ...props }) {
 896      return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components4.Fill, { name: `PinnedItems/$scope}`, ...props });
 897    }
 898    function PinnedItemsSlot({ scope, className, ...props }) {
 899      return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components4.Slot, { name: `PinnedItems/$scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
 900        "div",
 901        {
 902          className: clsx_default(
 903            className,
 904            "interface-pinned-items"
 905          ),
 906          children: fills
 907        }
 908      ) });
 909    }
 910    PinnedItems.Slot = PinnedItemsSlot;
 911    var pinned_items_default = PinnedItems;
 912  
 913    // packages/interface/build-module/components/complementary-area/index.mjs
 914    var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
 915    var ANIMATION_DURATION = 0.3;
 916    function ComplementaryAreaSlot({ scope, ...props }) {
 917      return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components5.Slot, { name: `ComplementaryArea/$scope}`, ...props });
 918    }
 919    var SIDEBAR_WIDTH = 280;
 920    var variants = {
 921      open: { width: SIDEBAR_WIDTH },
 922      closed: { width: 0 },
 923      mobileOpen: { width: "100vw" }
 924    };
 925    function ComplementaryAreaFill({
 926      activeArea,
 927      isActive,
 928      scope,
 929      children,
 930      className,
 931      id
 932    }) {
 933      const disableMotion = (0, import_compose.useReducedMotion)();
 934      const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
 935      const previousActiveArea = (0, import_compose.usePrevious)(activeArea);
 936      const previousIsActive = (0, import_compose.usePrevious)(isActive);
 937      const [, setState] = (0, import_element2.useState)({});
 938      (0, import_element2.useEffect)(() => {
 939        setState({});
 940      }, [isActive]);
 941      const transition = {
 942        type: "tween",
 943        duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION,
 944        ease: [0.6, 0, 0.4, 1]
 945      };
 946      return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components5.Fill, { name: `ComplementaryArea/$scope}`, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components5.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
 947        import_components5.__unstableMotion.div,
 948        {
 949          variants,
 950          initial: "closed",
 951          animate: isMobileViewport ? "mobileOpen" : "open",
 952          exit: "closed",
 953          transition,
 954          className: "interface-complementary-area__fill",
 955          children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
 956            "div",
 957            {
 958              id,
 959              className,
 960              style: {
 961                width: isMobileViewport ? "100vw" : SIDEBAR_WIDTH
 962              },
 963              children
 964            }
 965          )
 966        }
 967      ) }) });
 968    }
 969    function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
 970      const previousIsSmallRef = (0, import_element2.useRef)(false);
 971      const shouldOpenWhenNotSmallRef = (0, import_element2.useRef)(false);
 972      const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data6.useDispatch)(store);
 973      (0, import_element2.useEffect)(() => {
 974        if (isActive && isSmall && !previousIsSmallRef.current) {
 975          disableComplementaryArea2(scope);
 976          shouldOpenWhenNotSmallRef.current = true;
 977        } else if (
 978          // If there is a flag indicating the complementary area should be
 979          // enabled when we go from small to big window size and we are going
 980          // from a small to big window size.
 981          shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current
 982        ) {
 983          shouldOpenWhenNotSmallRef.current = false;
 984          enableComplementaryArea2(scope, identifier);
 985        } else if (
 986          // If the flag is indicating the current complementary should be
 987          // reopened but another complementary area becomes active, remove
 988          // the flag.
 989          shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier
 990        ) {
 991          shouldOpenWhenNotSmallRef.current = false;
 992        }
 993        if (isSmall !== previousIsSmallRef.current) {
 994          previousIsSmallRef.current = isSmall;
 995        }
 996      }, [
 997        isActive,
 998        isSmall,
 999        scope,
1000        identifier,
1001        activeArea,
1002        disableComplementaryArea2,
1003        enableComplementaryArea2
1004      ]);
1005    }
1006    function ComplementaryArea({
1007      children,
1008      className,
1009      closeLabel = (0, import_i18n.__)("Close plugin"),
1010      identifier: identifierProp,
1011      header,
1012      headerClassName,
1013      icon: iconProp,
1014      isPinnable = true,
1015      panelClassName,
1016      scope,
1017      name: name2,
1018      title,
1019      toggleShortcut,
1020      isActiveByDefault
1021    }) {
1022      const context = (0, import_plugins2.usePluginContext)();
1023      const icon = iconProp || context.icon;
1024      const identifier = identifierProp || `$context.name}/$name2}`;
1025      const [isReady, setIsReady] = (0, import_element2.useState)(false);
1026      const {
1027        isLoading,
1028        isActive,
1029        isPinned,
1030        activeArea,
1031        isSmall,
1032        isLarge,
1033        showIconLabels
1034      } = (0, import_data6.useSelect)(
1035        (select) => {
1036          const {
1037            getActiveComplementaryArea: getActiveComplementaryArea2,
1038            isComplementaryAreaLoading: isComplementaryAreaLoading2,
1039            isItemPinned: isItemPinned2
1040          } = select(store);
1041          const { get } = select(import_preferences3.store);
1042          const _activeArea = getActiveComplementaryArea2(scope);
1043          return {
1044            isLoading: isComplementaryAreaLoading2(scope),
1045            isActive: _activeArea === identifier,
1046            isPinned: isItemPinned2(scope, identifier),
1047            activeArea: _activeArea,
1048            isSmall: select(import_viewport.store).isViewportMatch("< medium"),
1049            isLarge: select(import_viewport.store).isViewportMatch("large"),
1050            showIconLabels: get("core", "showIconLabels")
1051          };
1052        },
1053        [identifier, scope]
1054      );
1055      const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
1056      useAdjustComplementaryListener(
1057        scope,
1058        identifier,
1059        activeArea,
1060        isActive,
1061        isSmall
1062      );
1063      const {
1064        enableComplementaryArea: enableComplementaryArea2,
1065        disableComplementaryArea: disableComplementaryArea2,
1066        pinItem: pinItem2,
1067        unpinItem: unpinItem2
1068      } = (0, import_data6.useDispatch)(store);
1069      (0, import_element2.useEffect)(() => {
1070        if (isActiveByDefault && activeArea === void 0 && !isSmall) {
1071          enableComplementaryArea2(scope, identifier);
1072        } else if (activeArea === void 0 && isSmall) {
1073          disableComplementaryArea2(scope, identifier);
1074        }
1075        setIsReady(true);
1076      }, [
1077        activeArea,
1078        isActiveByDefault,
1079        scope,
1080        identifier,
1081        isSmall,
1082        enableComplementaryArea2,
1083        disableComplementaryArea2
1084      ]);
1085      if (!isReady) {
1086        return;
1087      }
1088      return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
1089        isPinnable && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1090          ComplementaryAreaToggle,
1091          {
1092            scope,
1093            identifier,
1094            isPressed: isActive && (!showIconLabels || isLarge),
1095            "aria-expanded": isActive,
1096            "aria-disabled": isLoading,
1097            label: title,
1098            icon: showIconLabels ? check_default : icon,
1099            showTooltip: !showIconLabels,
1100            variant: showIconLabels ? "tertiary" : void 0,
1101            size: "compact",
1102            shortcut: toggleShortcut
1103          }
1104        ) }),
1105        name2 && isPinnable && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1106          ComplementaryAreaMoreMenuItem,
1107          {
1108            target: name2,
1109            scope,
1110            icon,
1111            identifier,
1112            children: title
1113          }
1114        ),
1115        /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1116          ComplementaryAreaFill,
1117          {
1118            activeArea,
1119            isActive,
1120            className: clsx_default("interface-complementary-area", className),
1121            scope,
1122            id: identifier.replace("/", ":"),
1123            children: [
1124              /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1125                complementary_area_header_default,
1126                {
1127                  className: headerClassName,
1128                  closeLabel,
1129                  onClose: () => disableComplementaryArea2(scope),
1130                  toggleButtonProps: {
1131                    label: closeLabel,
1132                    size: "compact",
1133                    shortcut: toggleShortcut,
1134                    scope,
1135                    identifier
1136                  },
1137                  children: header || /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
1138                    /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }),
1139                    isPinnable && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1140                      import_components5.Button,
1141                      {
1142                        className: "interface-complementary-area__pin-unpin-item",
1143                        icon: isPinned ? star_filled_default : star_empty_default,
1144                        label: isPinned ? (0, import_i18n.__)("Unpin from toolbar") : (0, import_i18n.__)("Pin to toolbar"),
1145                        onClick: () => (isPinned ? unpinItem2 : pinItem2)(
1146                          scope,
1147                          identifier
1148                        ),
1149                        isPressed: isPinned,
1150                        "aria-expanded": isPinned,
1151                        size: "compact"
1152                      }
1153                    )
1154                  ] })
1155                }
1156              ),
1157              /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components5.Panel, { className: panelClassName, children })
1158            ]
1159          }
1160        )
1161      ] });
1162    }
1163    ComplementaryArea.Slot = ComplementaryAreaSlot;
1164    var complementary_area_default = ComplementaryArea;
1165  
1166    // node_modules/@base-ui/utils/useRefWithInit.mjs
1167    var React = __toESM(require_react(), 1);
1168    var UNINITIALIZED = {};
1169    function useRefWithInit(init, initArg) {
1170      const ref = React.useRef(UNINITIALIZED);
1171      if (ref.current === UNINITIALIZED) {
1172        ref.current = init(initArg);
1173      }
1174      return ref;
1175    }
1176  
1177    // node_modules/@base-ui/utils/warn.mjs
1178    var set;
1179    if (true) {
1180      set = /* @__PURE__ */ new Set();
1181    }
1182    function warn(...messages) {
1183      if (true) {
1184        const messageKey = messages.join(" ");
1185        if (!set.has(messageKey)) {
1186          set.add(messageKey);
1187          console.warn(`Base UI: $messageKey}`);
1188        }
1189      }
1190    }
1191  
1192    // node_modules/@base-ui/react/internals/useRenderElement.mjs
1193    var React4 = __toESM(require_react(), 1);
1194  
1195    // node_modules/@base-ui/utils/useMergedRefs.mjs
1196    function useMergedRefs(a, b, c, d) {
1197      const forkRef = useRefWithInit(createForkRef).current;
1198      if (didChange(forkRef, a, b, c, d)) {
1199        update(forkRef, [a, b, c, d]);
1200      }
1201      return forkRef.callback;
1202    }
1203    function useMergedRefsN(refs) {
1204      const forkRef = useRefWithInit(createForkRef).current;
1205      if (didChangeN(forkRef, refs)) {
1206        update(forkRef, refs);
1207      }
1208      return forkRef.callback;
1209    }
1210    function createForkRef() {
1211      return {
1212        callback: null,
1213        cleanup: null,
1214        refs: []
1215      };
1216    }
1217    function didChange(forkRef, a, b, c, d) {
1218      return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
1219    }
1220    function didChangeN(forkRef, newRefs) {
1221      return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
1222    }
1223    function update(forkRef, refs) {
1224      forkRef.refs = refs;
1225      if (refs.every((ref) => ref == null)) {
1226        forkRef.callback = null;
1227        return;
1228      }
1229      forkRef.callback = (instance) => {
1230        if (forkRef.cleanup) {
1231          forkRef.cleanup();
1232          forkRef.cleanup = null;
1233        }
1234        if (instance != null) {
1235          const cleanupCallbacks = Array(refs.length).fill(null);
1236          for (let i = 0; i < refs.length; i += 1) {
1237            const ref = refs[i];
1238            if (ref == null) {
1239              continue;
1240            }
1241            switch (typeof ref) {
1242              case "function": {
1243                const refCleanup = ref(instance);
1244                if (typeof refCleanup === "function") {
1245                  cleanupCallbacks[i] = refCleanup;
1246                }
1247                break;
1248              }
1249              case "object": {
1250                ref.current = instance;
1251                break;
1252              }
1253              default:
1254            }
1255          }
1256          forkRef.cleanup = () => {
1257            for (let i = 0; i < refs.length; i += 1) {
1258              const ref = refs[i];
1259              if (ref == null) {
1260                continue;
1261              }
1262              switch (typeof ref) {
1263                case "function": {
1264                  const cleanupCallback = cleanupCallbacks[i];
1265                  if (typeof cleanupCallback === "function") {
1266                    cleanupCallback();
1267                  } else {
1268                    ref(null);
1269                  }
1270                  break;
1271                }
1272                case "object": {
1273                  ref.current = null;
1274                  break;
1275                }
1276                default:
1277              }
1278            }
1279          };
1280        }
1281      };
1282    }
1283  
1284    // node_modules/@base-ui/utils/getReactElementRef.mjs
1285    var React3 = __toESM(require_react(), 1);
1286  
1287    // node_modules/@base-ui/utils/reactVersion.mjs
1288    var React2 = __toESM(require_react(), 1);
1289    var majorVersion = parseInt(React2.version, 10);
1290    function isReactVersionAtLeast(reactVersionToCheck) {
1291      return majorVersion >= reactVersionToCheck;
1292    }
1293  
1294    // node_modules/@base-ui/utils/getReactElementRef.mjs
1295    function getReactElementRef(element) {
1296      if (!/* @__PURE__ */ React3.isValidElement(element)) {
1297        return null;
1298      }
1299      const reactElement = element;
1300      const propsWithRef = reactElement.props;
1301      return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
1302    }
1303  
1304    // node_modules/@base-ui/utils/mergeObjects.mjs
1305    function mergeObjects(a, b) {
1306      if (a && !b) {
1307        return a;
1308      }
1309      if (!a && b) {
1310        return b;
1311      }
1312      if (a || b) {
1313        return {
1314          ...a,
1315          ...b
1316        };
1317      }
1318      return void 0;
1319    }
1320  
1321    // node_modules/@base-ui/utils/empty.mjs
1322    var EMPTY_ARRAY = Object.freeze([]);
1323    var EMPTY_OBJECT = Object.freeze({});
1324  
1325    // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
1326    function getStateAttributesProps(state, customMapping) {
1327      const props = {};
1328      for (const key in state) {
1329        const value = state[key];
1330        if (customMapping?.hasOwnProperty(key)) {
1331          const customProps = customMapping[key](value);
1332          if (customProps != null) {
1333            Object.assign(props, customProps);
1334          }
1335          continue;
1336        }
1337        if (value === true) {
1338          props[`data-$key.toLowerCase()}`] = "";
1339        } else if (value) {
1340          props[`data-$key.toLowerCase()}`] = value.toString();
1341        }
1342      }
1343      return props;
1344    }
1345  
1346    // node_modules/@base-ui/react/utils/resolveClassName.mjs
1347    function resolveClassName(className, state) {
1348      return typeof className === "function" ? className(state) : className;
1349    }
1350  
1351    // node_modules/@base-ui/react/utils/resolveStyle.mjs
1352    function resolveStyle(style, state) {
1353      return typeof style === "function" ? style(state) : style;
1354    }
1355  
1356    // node_modules/@base-ui/react/merge-props/mergeProps.mjs
1357    var EMPTY_PROPS = {};
1358    function mergeProps(a, b, c, d, e) {
1359      if (!c && !d && !e && !a) {
1360        return createInitialMergedProps(b);
1361      }
1362      let merged = createInitialMergedProps(a);
1363      if (b) {
1364        merged = mergeInto(merged, b);
1365      }
1366      if (c) {
1367        merged = mergeInto(merged, c);
1368      }
1369      if (d) {
1370        merged = mergeInto(merged, d);
1371      }
1372      if (e) {
1373        merged = mergeInto(merged, e);
1374      }
1375      return merged;
1376    }
1377    function mergePropsN(props) {
1378      if (props.length === 0) {
1379        return EMPTY_PROPS;
1380      }
1381      if (props.length === 1) {
1382        return createInitialMergedProps(props[0]);
1383      }
1384      let merged = createInitialMergedProps(props[0]);
1385      for (let i = 1; i < props.length; i += 1) {
1386        merged = mergeInto(merged, props[i]);
1387      }
1388      return merged;
1389    }
1390    function createInitialMergedProps(inputProps) {
1391      if (isPropsGetter(inputProps)) {
1392        return {
1393          ...resolvePropsGetter(inputProps, EMPTY_PROPS)
1394        };
1395      }
1396      return copyInitialProps(inputProps);
1397    }
1398    function mergeInto(merged, inputProps) {
1399      if (isPropsGetter(inputProps)) {
1400        return resolvePropsGetter(inputProps, merged);
1401      }
1402      return mutablyMergeInto(merged, inputProps);
1403    }
1404    function copyInitialProps(inputProps) {
1405      const copiedProps = {
1406        ...inputProps
1407      };
1408      for (const propName in copiedProps) {
1409        const propValue = copiedProps[propName];
1410        if (isEventHandler(propName, propValue)) {
1411          copiedProps[propName] = wrapEventHandler(propValue);
1412        }
1413      }
1414      return copiedProps;
1415    }
1416    function mutablyMergeInto(mergedProps, externalProps) {
1417      if (!externalProps) {
1418        return mergedProps;
1419      }
1420      for (const propName in externalProps) {
1421        const externalPropValue = externalProps[propName];
1422        switch (propName) {
1423          case "style": {
1424            mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
1425            break;
1426          }
1427          case "className": {
1428            mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
1429            break;
1430          }
1431          default: {
1432            if (isEventHandler(propName, externalPropValue)) {
1433              mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
1434            } else {
1435              mergedProps[propName] = externalPropValue;
1436            }
1437          }
1438        }
1439      }
1440      return mergedProps;
1441    }
1442    function isEventHandler(key, value) {
1443      const code0 = key.charCodeAt(0);
1444      const code1 = key.charCodeAt(1);
1445      const code2 = key.charCodeAt(2);
1446      return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
1447    }
1448    function isPropsGetter(inputProps) {
1449      return typeof inputProps === "function";
1450    }
1451    function resolvePropsGetter(inputProps, previousProps) {
1452      if (isPropsGetter(inputProps)) {
1453        return inputProps(previousProps);
1454      }
1455      return inputProps ?? EMPTY_PROPS;
1456    }
1457    function mergeEventHandlers(ourHandler, theirHandler) {
1458      if (!theirHandler) {
1459        return ourHandler;
1460      }
1461      if (!ourHandler) {
1462        return wrapEventHandler(theirHandler);
1463      }
1464      return (...args) => {
1465        const event = args[0];
1466        if (isSyntheticEvent(event)) {
1467          const baseUIEvent = event;
1468          makeEventPreventable(baseUIEvent);
1469          const result2 = theirHandler(...args);
1470          if (!baseUIEvent.baseUIHandlerPrevented) {
1471            ourHandler?.(...args);
1472          }
1473          return result2;
1474        }
1475        const result = theirHandler(...args);
1476        ourHandler?.(...args);
1477        return result;
1478      };
1479    }
1480    function wrapEventHandler(handler) {
1481      if (!handler) {
1482        return handler;
1483      }
1484      return (...args) => {
1485        const event = args[0];
1486        if (isSyntheticEvent(event)) {
1487          makeEventPreventable(event);
1488        }
1489        return handler(...args);
1490      };
1491    }
1492    function makeEventPreventable(event) {
1493      event.preventBaseUIHandler = () => {
1494        event.baseUIHandlerPrevented = true;
1495      };
1496      return event;
1497    }
1498    function mergeClassNames(ourClassName, theirClassName) {
1499      if (theirClassName) {
1500        if (ourClassName) {
1501          return theirClassName + " " + ourClassName;
1502        }
1503        return theirClassName;
1504      }
1505      return ourClassName;
1506    }
1507    function isSyntheticEvent(event) {
1508      return event != null && typeof event === "object" && "nativeEvent" in event;
1509    }
1510  
1511    // node_modules/@base-ui/react/internals/useRenderElement.mjs
1512    var import_react = __toESM(require_react(), 1);
1513    function useRenderElement(element, componentProps, params = {}) {
1514      const renderProp = componentProps.render;
1515      const outProps = useRenderElementProps(componentProps, params);
1516      if (params.enabled === false) {
1517        return null;
1518      }
1519      const state = params.state ?? EMPTY_OBJECT;
1520      return evaluateRenderProp(element, renderProp, outProps, state);
1521    }
1522    function useRenderElementProps(componentProps, params = {}) {
1523      const {
1524        className: classNameProp,
1525        style: styleProp,
1526        render: renderProp
1527      } = componentProps;
1528      const {
1529        state = EMPTY_OBJECT,
1530        ref,
1531        props,
1532        stateAttributesMapping,
1533        enabled = true
1534      } = params;
1535      const className = enabled ? resolveClassName(classNameProp, state) : void 0;
1536      const style = enabled ? resolveStyle(styleProp, state) : void 0;
1537      const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
1538      const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
1539      const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
1540      if (typeof document !== "undefined") {
1541        if (!enabled) {
1542          useMergedRefs(null, null);
1543        } else if (Array.isArray(ref)) {
1544          outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
1545        } else {
1546          outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
1547        }
1548      }
1549      if (!enabled) {
1550        return EMPTY_OBJECT;
1551      }
1552      if (className !== void 0) {
1553        outProps.className = mergeClassNames(outProps.className, className);
1554      }
1555      if (style !== void 0) {
1556        outProps.style = mergeObjects(outProps.style, style);
1557      }
1558      return outProps;
1559    }
1560    function resolveRenderFunctionProps(props) {
1561      if (Array.isArray(props)) {
1562        return mergePropsN(props);
1563      }
1564      return mergeProps(void 0, props);
1565    }
1566    var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
1567    var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
1568    var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
1569    function evaluateRenderProp(element, render, props, state) {
1570      if (render) {
1571        if (typeof render === "function") {
1572          if (true) {
1573            warnIfRenderPropLooksLikeComponent(render);
1574          }
1575          return render(props, state);
1576        }
1577        const mergedProps = mergeProps(props, render.props);
1578        mergedProps.ref = props.ref;
1579        let newElement = render;
1580        if (newElement?.$$typeof === REACT_LAZY_TYPE) {
1581          const children = React4.Children.toArray(render);
1582          newElement = children[0];
1583        }
1584        if (true) {
1585          if (!/* @__PURE__ */ React4.isValidElement(newElement)) {
1586            throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
1587          }
1588        }
1589        return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps);
1590      }
1591      if (element) {
1592        if (typeof element === "string") {
1593          return renderTag(element, props);
1594        }
1595      }
1596      throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
1597    }
1598    function warnIfRenderPropLooksLikeComponent(renderFn) {
1599      const functionName = renderFn.name;
1600      if (functionName.length === 0) {
1601        return;
1602      }
1603      if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
1604        return;
1605      }
1606      if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
1607        return;
1608      }
1609      warn(`The \`render\` prop received a function named \`$functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
1610    }
1611    function renderTag(Tag, props) {
1612      if (Tag === "button") {
1613        return /* @__PURE__ */ (0, import_react.createElement)("button", {
1614          type: "button",
1615          ...props,
1616          key: props.key
1617        });
1618      }
1619      if (Tag === "img") {
1620        return /* @__PURE__ */ (0, import_react.createElement)("img", {
1621          alt: "",
1622          ...props,
1623          key: props.key
1624        });
1625      }
1626      return /* @__PURE__ */ React4.createElement(Tag, props);
1627    }
1628  
1629    // node_modules/@base-ui/react/use-render/useRender.mjs
1630    function useRender(params) {
1631      return useRenderElement(params.defaultTagName ?? "div", params, params);
1632    }
1633  
1634    // packages/ui/build-module/visually-hidden/visually-hidden.mjs
1635    var import_element3 = __toESM(require_element(), 1);
1636    var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
1637    function getRuntime() {
1638      const globalScope = globalThis;
1639      if (globalScope.__wpStyleRuntime) {
1640        return globalScope.__wpStyleRuntime;
1641      }
1642      globalScope.__wpStyleRuntime = {
1643        documents: /* @__PURE__ */ new Map(),
1644        styles: /* @__PURE__ */ new Map(),
1645        injectedStyles: /* @__PURE__ */ new WeakMap()
1646      };
1647      if (typeof document !== "undefined") {
1648        registerDocument(document);
1649      }
1650      return globalScope.__wpStyleRuntime;
1651    }
1652    function documentContainsStyleHash(targetDocument, hash) {
1653      if (!targetDocument.head) {
1654        return false;
1655      }
1656      for (const style of targetDocument.head.querySelectorAll(
1657        `style[$STYLE_HASH_ATTRIBUTE}]`
1658      )) {
1659        if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
1660          return true;
1661        }
1662      }
1663      return false;
1664    }
1665    function injectStyle(targetDocument, hash, css) {
1666      if (!targetDocument.head) {
1667        return;
1668      }
1669      const runtime = getRuntime();
1670      let injectedStyles = runtime.injectedStyles.get(targetDocument);
1671      if (!injectedStyles) {
1672        injectedStyles = /* @__PURE__ */ new Set();
1673        runtime.injectedStyles.set(targetDocument, injectedStyles);
1674      }
1675      if (injectedStyles.has(hash)) {
1676        return;
1677      }
1678      if (documentContainsStyleHash(targetDocument, hash)) {
1679        injectedStyles.add(hash);
1680        return;
1681      }
1682      const style = targetDocument.createElement("style");
1683      style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
1684      style.appendChild(targetDocument.createTextNode(css));
1685      targetDocument.head.appendChild(style);
1686      injectedStyles.add(hash);
1687    }
1688    function registerDocument(targetDocument) {
1689      const runtime = getRuntime();
1690      runtime.documents.set(
1691        targetDocument,
1692        (runtime.documents.get(targetDocument) ?? 0) + 1
1693      );
1694      for (const [hash, css] of runtime.styles) {
1695        injectStyle(targetDocument, hash, css);
1696      }
1697      return () => {
1698        const count = runtime.documents.get(targetDocument);
1699        if (count === void 0) {
1700          return;
1701        }
1702        if (count <= 1) {
1703          runtime.documents.delete(targetDocument);
1704          return;
1705        }
1706        runtime.documents.set(targetDocument, count - 1);
1707      };
1708    }
1709    function registerStyle(hash, css) {
1710      const runtime = getRuntime();
1711      runtime.styles.set(hash, css);
1712      for (const targetDocument of runtime.documents.keys()) {
1713        injectStyle(targetDocument, hash, css);
1714      }
1715    }
1716    if (typeof process === "undefined" || true) {
1717      registerStyle("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}");
1718    }
1719    var style_default = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
1720    var VisuallyHidden = (0, import_element3.forwardRef)(
1721      function VisuallyHidden2({ render, ...restProps }, ref) {
1722        const element = useRender({
1723          render,
1724          ref,
1725          props: mergeProps(
1726            { className: style_default["visually-hidden"] },
1727            restProps,
1728            {
1729              // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
1730              "data-visually-hidden": ""
1731            }
1732          )
1733        });
1734        return element;
1735      }
1736    );
1737  
1738    // packages/admin-ui/build-module/navigable-region/index.mjs
1739    var import_element4 = __toESM(require_element(), 1);
1740    var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
1741    var NavigableRegion = (0, import_element4.forwardRef)(
1742      ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
1743        return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1744          Tag,
1745          {
1746            ref,
1747            className: clsx_default("admin-ui-navigable-region", className),
1748            "aria-label": ariaLabel,
1749            role: "region",
1750            tabIndex: "-1",
1751            ...props,
1752            children
1753          }
1754        );
1755      }
1756    );
1757    NavigableRegion.displayName = "NavigableRegion";
1758    var navigable_region_default = NavigableRegion;
1759  
1760    // packages/admin-ui/build-module/admin-theme-colors/index.mjs
1761    var DEFAULT_THEME_COLORS = {
1762      primary: "#3858e9",
1763      background: "#222524"
1764    };
1765    var ADMIN_THEME_COLORS = /* @__PURE__ */ new Map([
1766      ["modern", DEFAULT_THEME_COLORS],
1767      ["fresh", { primary: "#3858e9", background: "#25292b" }],
1768      ["midnight", { primary: "#cf4339", background: "#3d4042" }],
1769      ["coffee", { primary: "#916745", background: "#5b534d" }],
1770      ["ocean", { primary: "#567958", background: "#5f787f" }],
1771      ["blue", { primary: "#437aa8", background: "#3876a8" }],
1772      ["ectoplasm", { primary: "#646c3e", background: "#4f386e" }],
1773      ["sunrise", { primary: "#ad631e", background: "#cc4541" }],
1774      ["light", { primary: "#007cba", background: "#eaeeed" }]
1775    ]);
1776    function getAdminThemeColors() {
1777      const scheme = document.body.className.match(/admin-color-([\w-]+)/)?.[1] ?? "modern";
1778      return ADMIN_THEME_COLORS.get(scheme) ?? DEFAULT_THEME_COLORS;
1779    }
1780  
1781    // packages/interface/build-module/components/interface-skeleton/index.mjs
1782    var import_element5 = __toESM(require_element(), 1);
1783    var import_components6 = __toESM(require_components(), 1);
1784    var import_i18n2 = __toESM(require_i18n(), 1);
1785    var import_compose2 = __toESM(require_compose(), 1);
1786    var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
1787    var ANIMATION_DURATION2 = 0.25;
1788    var commonTransition = {
1789      type: "tween",
1790      duration: ANIMATION_DURATION2,
1791      ease: [0.6, 0, 0.4, 1]
1792    };
1793    function useHTMLClass(className) {
1794      (0, import_element5.useEffect)(() => {
1795        const element = document && document.querySelector(`html:not(.$className})`);
1796        if (!element) {
1797          return;
1798        }
1799        element.classList.toggle(className);
1800        return () => {
1801          element.classList.toggle(className);
1802        };
1803      }, [className]);
1804    }
1805    var headerVariants = {
1806      hidden: { opacity: 1, marginTop: -60 },
1807      visible: { opacity: 1, marginTop: 0 },
1808      distractionFreeHover: {
1809        opacity: 1,
1810        marginTop: 0,
1811        transition: {
1812          ...commonTransition,
1813          delay: 0.2,
1814          delayChildren: 0.2
1815        }
1816      },
1817      distractionFreeHidden: {
1818        opacity: 0,
1819        marginTop: -60
1820      },
1821      distractionFreeDisabled: {
1822        opacity: 0,
1823        marginTop: 0,
1824        transition: {
1825          ...commonTransition,
1826          delay: 0.8,
1827          delayChildren: 0.8
1828        }
1829      }
1830    };
1831    function InterfaceSkeleton({
1832      isDistractionFree,
1833      footer,
1834      header,
1835      editorNotices,
1836      sidebar,
1837      secondarySidebar,
1838      content,
1839      actions,
1840      labels,
1841      className
1842    }, ref) {
1843      const [secondarySidebarResizeListener, secondarySidebarSize] = (0, import_compose2.useResizeObserver)();
1844      const isMobileViewport = (0, import_compose2.useViewportMatch)("medium", "<");
1845      const disableMotion = (0, import_compose2.useReducedMotion)();
1846      const defaultTransition = {
1847        type: "tween",
1848        duration: disableMotion ? 0 : ANIMATION_DURATION2,
1849        ease: [0.6, 0, 0.4, 1]
1850      };
1851      useHTMLClass("interface-interface-skeleton__html-container");
1852      const defaultLabels = {
1853        /* translators: accessibility text for the top bar landmark region. */
1854        header: (0, import_i18n2._x)("Header", "header landmark area"),
1855        /* translators: accessibility text for the content landmark region. */
1856        body: (0, import_i18n2.__)("Content"),
1857        /* translators: accessibility text for the secondary sidebar landmark region. */
1858        secondarySidebar: (0, import_i18n2.__)("Block Library"),
1859        /* translators: accessibility text for the settings landmark region. */
1860        sidebar: (0, import_i18n2._x)("Settings", "settings landmark area"),
1861        /* translators: accessibility text for the publish landmark region. */
1862        actions: (0, import_i18n2.__)("Publish"),
1863        /* translators: accessibility text for the footer landmark region. */
1864        footer: (0, import_i18n2.__)("Footer")
1865      };
1866      const mergedLabels = { ...defaultLabels, ...labels };
1867      return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1868        "div",
1869        {
1870          ref,
1871          className: clsx_default(
1872            className,
1873            "interface-interface-skeleton",
1874            !!footer && "has-footer"
1875          ),
1876          children: [
1877            /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [
1878              /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components6.__unstableAnimatePresence, { initial: false, children: !!header && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1879                navigable_region_default,
1880                {
1881                  as: import_components6.__unstableMotion.div,
1882                  className: "interface-interface-skeleton__header",
1883                  ariaLabel: mergedLabels.header,
1884                  initial: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden",
1885                  whileHover: isDistractionFree && !isMobileViewport ? "distractionFreeHover" : "visible",
1886                  animate: isDistractionFree && !isMobileViewport ? "distractionFreeDisabled" : "visible",
1887                  exit: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden",
1888                  variants: headerVariants,
1889                  transition: defaultTransition,
1890                  children: header
1891                }
1892              ) }),
1893              isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }),
1894              /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "interface-interface-skeleton__body", children: [
1895                /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components6.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1896                  navigable_region_default,
1897                  {
1898                    className: "interface-interface-skeleton__secondary-sidebar",
1899                    ariaLabel: mergedLabels.secondarySidebar,
1900                    as: import_components6.__unstableMotion.div,
1901                    initial: "closed",
1902                    animate: "open",
1903                    exit: "closed",
1904                    variants: {
1905                      open: { width: secondarySidebarSize.width },
1906                      closed: { width: 0 }
1907                    },
1908                    transition: defaultTransition,
1909                    children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1910                      import_components6.__unstableMotion.div,
1911                      {
1912                        style: {
1913                          position: "absolute",
1914                          width: isMobileViewport ? "100vw" : "fit-content",
1915                          height: "100%",
1916                          left: 0
1917                        },
1918                        variants: {
1919                          open: { x: 0 },
1920                          closed: { x: "-100%" }
1921                        },
1922                        transition: defaultTransition,
1923                        children: [
1924                          secondarySidebarResizeListener,
1925                          secondarySidebar
1926                        ]
1927                      }
1928                    )
1929                  }
1930                ) }),
1931                /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1932                  navigable_region_default,
1933                  {
1934                    className: "interface-interface-skeleton__content",
1935                    ariaLabel: mergedLabels.body,
1936                    children: content
1937                  }
1938                ),
1939                !!sidebar && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1940                  navigable_region_default,
1941                  {
1942                    className: "interface-interface-skeleton__sidebar",
1943                    ariaLabel: mergedLabels.sidebar,
1944                    children: sidebar
1945                  }
1946                ),
1947                !!actions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1948                  navigable_region_default,
1949                  {
1950                    className: "interface-interface-skeleton__actions",
1951                    ariaLabel: mergedLabels.actions,
1952                    children: actions
1953                  }
1954                )
1955              ] })
1956            ] }),
1957            !!footer && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1958              navigable_region_default,
1959              {
1960                className: "interface-interface-skeleton__footer",
1961                ariaLabel: mergedLabels.footer,
1962                children: footer
1963              }
1964            )
1965          ]
1966        }
1967      );
1968    }
1969    var interface_skeleton_default = (0, import_element5.forwardRef)(InterfaceSkeleton);
1970  
1971    // packages/edit-widgets/build-module/store/actions.mjs
1972    var import_widgets2 = __toESM(require_widgets(), 1);
1973    var import_core_data = __toESM(require_core_data(), 1);
1974    var import_block_editor = __toESM(require_block_editor(), 1);
1975  
1976    // packages/edit-widgets/build-module/store/transformers.mjs
1977    var import_blocks = __toESM(require_blocks(), 1);
1978    var import_widgets = __toESM(require_widgets(), 1);
1979    function transformWidgetToBlock(widget) {
1980      if (widget.id_base === "block") {
1981        const parsedBlocks = (0, import_blocks.parse)(widget.instance.raw.content, {
1982          __unstableSkipAutop: true
1983        });
1984        if (!parsedBlocks.length) {
1985          return (0, import_widgets.addWidgetIdToBlock)(
1986            (0, import_blocks.createBlock)("core/paragraph", {}, []),
1987            widget.id
1988          );
1989        }
1990        return (0, import_widgets.addWidgetIdToBlock)(parsedBlocks[0], widget.id);
1991      }
1992      let attributes;
1993      if (widget._embedded.about[0].is_multi) {
1994        attributes = {
1995          idBase: widget.id_base,
1996          instance: widget.instance
1997        };
1998      } else {
1999        attributes = {
2000          id: widget.id
2001        };
2002      }
2003      return (0, import_widgets.addWidgetIdToBlock)(
2004        (0, import_blocks.createBlock)("core/legacy-widget", attributes, []),
2005        widget.id
2006      );
2007    }
2008    function transformBlockToWidget(block, relatedWidget = {}) {
2009      let widget;
2010      const isValidLegacyWidgetBlock = block.name === "core/legacy-widget" && (block.attributes.id || block.attributes.instance);
2011      if (isValidLegacyWidgetBlock) {
2012        widget = {
2013          ...relatedWidget,
2014          id: block.attributes.id ?? relatedWidget.id,
2015          id_base: block.attributes.idBase ?? relatedWidget.id_base,
2016          instance: block.attributes.instance ?? relatedWidget.instance
2017        };
2018      } else {
2019        widget = {
2020          ...relatedWidget,
2021          id_base: "block",
2022          instance: {
2023            raw: {
2024              content: (0, import_blocks.serialize)(block)
2025            }
2026          }
2027        };
2028      }
2029      delete widget.rendered;
2030      delete widget.rendered_form;
2031      return widget;
2032    }
2033  
2034    // packages/edit-widgets/build-module/store/utils.mjs
2035    var KIND = "root";
2036    var WIDGET_AREA_ENTITY_TYPE = "sidebar";
2037    var POST_TYPE = "postType";
2038    var buildWidgetAreaPostId = (widgetAreaId) => `widget-area-$widgetAreaId}`;
2039    var buildWidgetAreasPostId = () => `widget-areas`;
2040    function buildWidgetAreasQuery() {
2041      return {
2042        per_page: -1
2043      };
2044    }
2045    function buildWidgetsQuery() {
2046      return {
2047        per_page: -1,
2048        _embed: "about"
2049      };
2050    }
2051    var createStubPost = (id, blocks) => ({
2052      id,
2053      slug: id,
2054      status: "draft",
2055      type: "page",
2056      blocks,
2057      meta: {
2058        widgetAreaId: id
2059      }
2060    });
2061  
2062    // packages/edit-widgets/build-module/store/constants.mjs
2063    var STORE_NAME2 = "core/edit-widgets";
2064  
2065    // packages/edit-widgets/build-module/store/actions.mjs
2066    var persistStubPost = (id, blocks) => ({ registry }) => {
2067      const stubPost = createStubPost(id, blocks);
2068      registry.dispatch(import_core_data.store).receiveEntityRecords(
2069        KIND,
2070        POST_TYPE,
2071        stubPost,
2072        { id: stubPost.id },
2073        false
2074      );
2075      return stubPost;
2076    };
2077    var saveEditedWidgetAreas = () => async ({ select, dispatch: dispatch2, registry }) => {
2078      const editedWidgetAreas = select.getEditedWidgetAreas();
2079      if (!editedWidgetAreas?.length) {
2080        return;
2081      }
2082      try {
2083        await dispatch2.saveWidgetAreas(editedWidgetAreas);
2084        registry.dispatch(import_notices.store).createSuccessNotice((0, import_i18n3.__)("Widgets saved."), {
2085          type: "snackbar"
2086        });
2087      } catch (e) {
2088        registry.dispatch(import_notices.store).createErrorNotice(
2089          /* translators: %s: The error message. */
2090          (0, import_i18n3.sprintf)((0, import_i18n3.__)("There was an error. %s"), e.message),
2091          {
2092            type: "snackbar"
2093          }
2094        );
2095      }
2096    };
2097    var saveWidgetAreas = (widgetAreas) => async ({ dispatch: dispatch2, registry }) => {
2098      try {
2099        for (const widgetArea of widgetAreas) {
2100          await dispatch2.saveWidgetArea(widgetArea.id);
2101        }
2102      } finally {
2103        await registry.dispatch(import_core_data.store).finishResolution(
2104          "getEntityRecord",
2105          KIND,
2106          WIDGET_AREA_ENTITY_TYPE,
2107          buildWidgetAreasQuery()
2108        );
2109      }
2110    };
2111    var saveWidgetArea = (widgetAreaId) => async ({ dispatch: dispatch2, select, registry }) => {
2112      const widgets = select.getWidgets();
2113      const post = registry.select(import_core_data.store).getEditedEntityRecord(
2114        KIND,
2115        POST_TYPE,
2116        buildWidgetAreaPostId(widgetAreaId)
2117      );
2118      const areaWidgets = Object.values(widgets).filter(
2119        ({ sidebar }) => sidebar === widgetAreaId
2120      );
2121      const usedReferenceWidgets = [];
2122      const widgetsBlocks = post.blocks.filter((block) => {
2123        const { id } = block.attributes;
2124        if (block.name === "core/legacy-widget" && id) {
2125          if (usedReferenceWidgets.includes(id)) {
2126            return false;
2127          }
2128          usedReferenceWidgets.push(id);
2129        }
2130        return true;
2131      });
2132      const deletedWidgets = [];
2133      for (const widget of areaWidgets) {
2134        const widgetsNewArea = select.getWidgetAreaForWidgetId(widget.id);
2135        if (!widgetsNewArea) {
2136          deletedWidgets.push(widget);
2137        }
2138      }
2139      const batchMeta = [];
2140      const batchTasks = [];
2141      const sidebarWidgetsIds = [];
2142      for (let i = 0; i < widgetsBlocks.length; i++) {
2143        const block = widgetsBlocks[i];
2144        const widgetId = (0, import_widgets2.getWidgetIdFromBlock)(block);
2145        const oldWidget = widgets[widgetId];
2146        const widget = transformBlockToWidget(block, oldWidget);
2147        sidebarWidgetsIds.push(widgetId);
2148        if (oldWidget) {
2149          registry.dispatch(import_core_data.store).editEntityRecord(
2150            "root",
2151            "widget",
2152            widgetId,
2153            {
2154              ...widget,
2155              sidebar: widgetAreaId
2156            },
2157            { undoIgnore: true }
2158          );
2159          const hasEdits = registry.select(import_core_data.store).hasEditsForEntityRecord("root", "widget", widgetId);
2160          if (!hasEdits) {
2161            continue;
2162          }
2163          batchTasks.push(
2164            ({ saveEditedEntityRecord }) => saveEditedEntityRecord("root", "widget", widgetId)
2165          );
2166        } else {
2167          batchTasks.push(
2168            ({ saveEntityRecord }) => saveEntityRecord("root", "widget", {
2169              ...widget,
2170              sidebar: widgetAreaId
2171            })
2172          );
2173        }
2174        batchMeta.push({
2175          block,
2176          position: i,
2177          clientId: block.clientId
2178        });
2179      }
2180      for (const widget of deletedWidgets) {
2181        batchTasks.push(
2182          ({ deleteEntityRecord }) => deleteEntityRecord("root", "widget", widget.id, {
2183            force: true
2184          })
2185        );
2186      }
2187      const records = await registry.dispatch(import_core_data.store).__experimentalBatch(batchTasks);
2188      const preservedRecords = records.filter(
2189        (record) => !record.hasOwnProperty("deleted")
2190      );
2191      const failedWidgetNames = [];
2192      for (let i = 0; i < preservedRecords.length; i++) {
2193        const widget = preservedRecords[i];
2194        const { block, position } = batchMeta[i];
2195        post.blocks[position].attributes.__internalWidgetId = widget.id;
2196        const error = registry.select(import_core_data.store).getLastEntitySaveError("root", "widget", widget.id);
2197        if (error) {
2198          failedWidgetNames.push(block.attributes?.name || block?.name);
2199        }
2200        if (!sidebarWidgetsIds[position]) {
2201          sidebarWidgetsIds[position] = widget.id;
2202        }
2203      }
2204      if (failedWidgetNames.length) {
2205        throw new Error(
2206          (0, import_i18n3.sprintf)(
2207            /* translators: %s: List of widget names */
2208            (0, import_i18n3.__)("Could not save the following widgets: %s."),
2209            failedWidgetNames.join(", ")
2210          )
2211        );
2212      }
2213      registry.dispatch(import_core_data.store).editEntityRecord(
2214        KIND,
2215        WIDGET_AREA_ENTITY_TYPE,
2216        widgetAreaId,
2217        {
2218          widgets: sidebarWidgetsIds
2219        },
2220        { undoIgnore: true }
2221      );
2222      dispatch2(trySaveWidgetArea(widgetAreaId));
2223      registry.dispatch(import_core_data.store).receiveEntityRecords(KIND, POST_TYPE, post, void 0);
2224    };
2225    var trySaveWidgetArea = (widgetAreaId) => ({ registry }) => {
2226      registry.dispatch(import_core_data.store).saveEditedEntityRecord(
2227        KIND,
2228        WIDGET_AREA_ENTITY_TYPE,
2229        widgetAreaId,
2230        {
2231          throwOnError: true
2232        }
2233      );
2234    };
2235    function setWidgetIdForClientId(clientId, widgetId) {
2236      return {
2237        type: "SET_WIDGET_ID_FOR_CLIENT_ID",
2238        clientId,
2239        widgetId
2240      };
2241    }
2242    function setWidgetAreasOpenState(widgetAreasOpenState2) {
2243      return {
2244        type: "SET_WIDGET_AREAS_OPEN_STATE",
2245        widgetAreasOpenState: widgetAreasOpenState2
2246      };
2247    }
2248    function setIsWidgetAreaOpen(clientId, isOpen) {
2249      return {
2250        type: "SET_IS_WIDGET_AREA_OPEN",
2251        clientId,
2252        isOpen
2253      };
2254    }
2255    function setIsInserterOpened(value) {
2256      return {
2257        type: "SET_IS_INSERTER_OPENED",
2258        value
2259      };
2260    }
2261    function setIsListViewOpened(isOpen) {
2262      return {
2263        type: "SET_IS_LIST_VIEW_OPENED",
2264        isOpen
2265      };
2266    }
2267    var closeGeneralSidebar = () => ({ registry }) => {
2268      registry.dispatch(store).disableComplementaryArea(STORE_NAME2);
2269    };
2270    var moveBlockToWidgetArea = (clientId, widgetAreaId) => async ({ dispatch: dispatch2, select, registry }) => {
2271      const sourceRootClientId = registry.select(import_block_editor.store).getBlockRootClientId(clientId);
2272      const widgetAreas = registry.select(import_block_editor.store).getBlocks();
2273      const destinationWidgetAreaBlock = widgetAreas.find(
2274        ({ attributes }) => attributes.id === widgetAreaId
2275      );
2276      const destinationRootClientId = destinationWidgetAreaBlock.clientId;
2277      const destinationInnerBlocksClientIds = registry.select(import_block_editor.store).getBlockOrder(destinationRootClientId);
2278      const destinationIndex = destinationInnerBlocksClientIds.length;
2279      const isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen(
2280        destinationRootClientId
2281      );
2282      if (!isDestinationWidgetAreaOpen) {
2283        dispatch2.setIsWidgetAreaOpen(destinationRootClientId, true);
2284      }
2285      registry.dispatch(import_block_editor.store).moveBlocksToPosition(
2286        [clientId],
2287        sourceRootClientId,
2288        destinationRootClientId,
2289        destinationIndex
2290      );
2291    };
2292    function unlockWidgetSaving(lockName) {
2293      return {
2294        type: "UNLOCK_WIDGET_SAVING",
2295        lockName
2296      };
2297    }
2298    function lockWidgetSaving(lockName) {
2299      return {
2300        type: "LOCK_WIDGET_SAVING",
2301        lockName
2302      };
2303    }
2304  
2305    // packages/edit-widgets/build-module/store/resolvers.mjs
2306    var getWidgetAreas = () => async ({ dispatch: dispatch2, registry }) => {
2307      const query = buildWidgetAreasQuery();
2308      const widgetAreas = await registry.resolveSelect(import_core_data2.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query);
2309      const widgetAreaBlocks = [];
2310      const sortedWidgetAreas = widgetAreas.sort((a, b) => {
2311        if (a.id === "wp_inactive_widgets") {
2312          return 1;
2313        }
2314        if (b.id === "wp_inactive_widgets") {
2315          return -1;
2316        }
2317        return 0;
2318      });
2319      for (const widgetArea of sortedWidgetAreas) {
2320        widgetAreaBlocks.push(
2321          (0, import_blocks2.createBlock)("core/widget-area", {
2322            id: widgetArea.id,
2323            name: widgetArea.name
2324          })
2325        );
2326        if (!widgetArea.widgets.length) {
2327          dispatch2(
2328            persistStubPost(
2329              buildWidgetAreaPostId(widgetArea.id),
2330              []
2331            )
2332          );
2333        }
2334      }
2335      const widgetAreasOpenState2 = {};
2336      widgetAreaBlocks.forEach((widgetAreaBlock, index) => {
2337        widgetAreasOpenState2[widgetAreaBlock.clientId] = index === 0;
2338      });
2339      dispatch2(setWidgetAreasOpenState(widgetAreasOpenState2));
2340      dispatch2(
2341        persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks)
2342      );
2343    };
2344    var getWidgets = () => async ({ dispatch: dispatch2, registry }) => {
2345      const query = buildWidgetsQuery();
2346      const widgets = await registry.resolveSelect(import_core_data2.store).getEntityRecords("root", "widget", query);
2347      const groupedBySidebar = {};
2348      for (const widget of widgets) {
2349        const block = transformWidgetToBlock(widget);
2350        groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || [];
2351        groupedBySidebar[widget.sidebar].push(block);
2352      }
2353      for (const sidebarId in groupedBySidebar) {
2354        if (groupedBySidebar.hasOwnProperty(sidebarId)) {
2355          dispatch2(
2356            persistStubPost(
2357              buildWidgetAreaPostId(sidebarId),
2358              groupedBySidebar[sidebarId]
2359            )
2360          );
2361        }
2362      }
2363    };
2364  
2365    // packages/edit-widgets/build-module/store/selectors.mjs
2366    var selectors_exports2 = {};
2367    __export(selectors_exports2, {
2368      __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint,
2369      canInsertBlockInWidgetArea: () => canInsertBlockInWidgetArea,
2370      getEditedWidgetAreas: () => getEditedWidgetAreas,
2371      getIsWidgetAreaOpen: () => getIsWidgetAreaOpen,
2372      getParentWidgetAreaBlock: () => getParentWidgetAreaBlock,
2373      getReferenceWidgetBlocks: () => getReferenceWidgetBlocks,
2374      getWidget: () => getWidget,
2375      getWidgetAreaForWidgetId: () => getWidgetAreaForWidgetId,
2376      getWidgetAreas: () => getWidgetAreas2,
2377      getWidgets: () => getWidgets2,
2378      isInserterOpened: () => isInserterOpened,
2379      isListViewOpened: () => isListViewOpened,
2380      isSavingWidgetAreas: () => isSavingWidgetAreas,
2381      isWidgetSavingLocked: () => isWidgetSavingLocked
2382    });
2383    var import_data7 = __toESM(require_data(), 1);
2384    var import_widgets3 = __toESM(require_widgets(), 1);
2385    var import_core_data3 = __toESM(require_core_data(), 1);
2386    var import_block_editor2 = __toESM(require_block_editor(), 1);
2387    var EMPTY_INSERTION_POINT = {
2388      rootClientId: void 0,
2389      insertionIndex: void 0
2390    };
2391    var getWidgets2 = (0, import_data7.createRegistrySelector)(
2392      (select) => (0, import_data7.createSelector)(
2393        () => {
2394          const widgets = select(import_core_data3.store).getEntityRecords(
2395            "root",
2396            "widget",
2397            buildWidgetsQuery()
2398          );
2399          return (
2400            // Key widgets by their ID.
2401            widgets?.reduce(
2402              (allWidgets, widget) => ({
2403                ...allWidgets,
2404                [widget.id]: widget
2405              }),
2406              {}
2407            ) ?? {}
2408          );
2409        },
2410        () => [
2411          select(import_core_data3.store).getEntityRecords(
2412            "root",
2413            "widget",
2414            buildWidgetsQuery()
2415          )
2416        ]
2417      )
2418    );
2419    var getWidget = (0, import_data7.createRegistrySelector)(
2420      (select) => (state, id) => {
2421        const widgets = select(STORE_NAME2).getWidgets();
2422        return widgets[id];
2423      }
2424    );
2425    var getWidgetAreas2 = (0, import_data7.createRegistrySelector)((select) => () => {
2426      const query = buildWidgetAreasQuery();
2427      return select(import_core_data3.store).getEntityRecords(
2428        KIND,
2429        WIDGET_AREA_ENTITY_TYPE,
2430        query
2431      );
2432    });
2433    var getWidgetAreaForWidgetId = (0, import_data7.createRegistrySelector)(
2434      (select) => (state, widgetId) => {
2435        const widgetAreas = select(STORE_NAME2).getWidgetAreas();
2436        return widgetAreas.find((widgetArea) => {
2437          const post = select(import_core_data3.store).getEditedEntityRecord(
2438            KIND,
2439            POST_TYPE,
2440            buildWidgetAreaPostId(widgetArea.id)
2441          );
2442          const blockWidgetIds = post.blocks.map(
2443            (block) => (0, import_widgets3.getWidgetIdFromBlock)(block)
2444          );
2445          return blockWidgetIds.includes(widgetId);
2446        });
2447      }
2448    );
2449    var getParentWidgetAreaBlock = (0, import_data7.createRegistrySelector)(
2450      (select) => (state, clientId) => {
2451        const { getBlock, getBlockName, getBlockParents } = select(import_block_editor2.store);
2452        const blockParents = getBlockParents(clientId);
2453        const widgetAreaClientId = blockParents.find(
2454          (parentClientId) => getBlockName(parentClientId) === "core/widget-area"
2455        );
2456        return getBlock(widgetAreaClientId);
2457      }
2458    );
2459    var getEditedWidgetAreas = (0, import_data7.createRegistrySelector)(
2460      (select) => (state, ids) => {
2461        let widgetAreas = select(STORE_NAME2).getWidgetAreas();
2462        if (!widgetAreas) {
2463          return [];
2464        }
2465        if (ids) {
2466          widgetAreas = widgetAreas.filter(
2467            ({ id }) => ids.includes(id)
2468          );
2469        }
2470        return widgetAreas.filter(
2471          ({ id }) => select(import_core_data3.store).hasEditsForEntityRecord(
2472            KIND,
2473            POST_TYPE,
2474            buildWidgetAreaPostId(id)
2475          )
2476        ).map(
2477          ({ id }) => select(import_core_data3.store).getEditedEntityRecord(
2478            KIND,
2479            WIDGET_AREA_ENTITY_TYPE,
2480            id
2481          )
2482        );
2483      }
2484    );
2485    var getReferenceWidgetBlocks = (0, import_data7.createRegistrySelector)(
2486      (select) => (state, referenceWidgetName = null) => {
2487        const results = [];
2488        const widgetAreas = select(STORE_NAME2).getWidgetAreas();
2489        for (const _widgetArea of widgetAreas) {
2490          const post = select(import_core_data3.store).getEditedEntityRecord(
2491            KIND,
2492            POST_TYPE,
2493            buildWidgetAreaPostId(_widgetArea.id)
2494          );
2495          for (const block of post.blocks) {
2496            if (block.name === "core/legacy-widget" && (!referenceWidgetName || block.attributes?.referenceWidgetName === referenceWidgetName)) {
2497              results.push(block);
2498            }
2499          }
2500        }
2501        return results;
2502      }
2503    );
2504    var isSavingWidgetAreas = (0, import_data7.createRegistrySelector)((select) => () => {
2505      const widgetAreasIds = select(STORE_NAME2).getWidgetAreas()?.map(({ id }) => id);
2506      if (!widgetAreasIds) {
2507        return false;
2508      }
2509      for (const id of widgetAreasIds) {
2510        const isSaving = select(import_core_data3.store).isSavingEntityRecord(
2511          KIND,
2512          WIDGET_AREA_ENTITY_TYPE,
2513          id
2514        );
2515        if (isSaving) {
2516          return true;
2517        }
2518      }
2519      const widgetIds = [
2520        ...Object.keys(select(STORE_NAME2).getWidgets()),
2521        void 0
2522        // account for new widgets without an ID
2523      ];
2524      for (const id of widgetIds) {
2525        const isSaving = select(import_core_data3.store).isSavingEntityRecord(
2526          "root",
2527          "widget",
2528          id
2529        );
2530        if (isSaving) {
2531          return true;
2532        }
2533      }
2534      return false;
2535    });
2536    var getIsWidgetAreaOpen = (state, clientId) => {
2537      const { widgetAreasOpenState: widgetAreasOpenState2 } = state;
2538      return !!widgetAreasOpenState2[clientId];
2539    };
2540    function isInserterOpened(state) {
2541      return !!state.blockInserterPanel;
2542    }
2543    function __experimentalGetInsertionPoint(state) {
2544      if (typeof state.blockInserterPanel === "boolean") {
2545        return EMPTY_INSERTION_POINT;
2546      }
2547      return state.blockInserterPanel;
2548    }
2549    var canInsertBlockInWidgetArea = (0, import_data7.createRegistrySelector)(
2550      (select) => (state, blockName) => {
2551        const widgetAreas = select(import_block_editor2.store).getBlocks();
2552        const [firstWidgetArea] = widgetAreas;
2553        return select(import_block_editor2.store).canInsertBlockType(
2554          blockName,
2555          firstWidgetArea.clientId
2556        );
2557      }
2558    );
2559    function isListViewOpened(state) {
2560      return state.listViewPanel;
2561    }
2562    function isWidgetSavingLocked(state) {
2563      return Object.keys(state.widgetSavingLock).length > 0;
2564    }
2565  
2566    // packages/edit-widgets/build-module/store/private-selectors.mjs
2567    var private_selectors_exports = {};
2568    __export(private_selectors_exports, {
2569      getInserterSidebarToggleRef: () => getInserterSidebarToggleRef,
2570      getListViewToggleRef: () => getListViewToggleRef
2571    });
2572    function getListViewToggleRef(state) {
2573      return state.listViewToggleRef;
2574    }
2575    function getInserterSidebarToggleRef(state) {
2576      return state.inserterSidebarToggleRef;
2577    }
2578  
2579    // packages/edit-widgets/build-module/lock-unlock.mjs
2580    var import_private_apis = __toESM(require_private_apis(), 1);
2581    var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
2582      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
2583      "@wordpress/edit-widgets"
2584    );
2585  
2586    // packages/edit-widgets/build-module/store/index.mjs
2587    var storeConfig = {
2588      reducer: reducer_default,
2589      selectors: selectors_exports2,
2590      resolvers: resolvers_exports,
2591      actions: actions_exports2
2592    };
2593    var store2 = (0, import_data8.createReduxStore)(STORE_NAME2, storeConfig);
2594    (0, import_data8.register)(store2);
2595    import_api_fetch.default.use(function(options, next) {
2596      if (options.path?.indexOf("/wp/v2/types/widget-area") === 0) {
2597        return Promise.resolve({});
2598      }
2599      return next(options);
2600    });
2601    unlock(store2).registerPrivateSelectors(private_selectors_exports);
2602  
2603    // packages/edit-widgets/build-module/filters/move-to-widget-area.mjs
2604    var import_block_editor3 = __toESM(require_block_editor(), 1);
2605    var import_compose3 = __toESM(require_compose(), 1);
2606    var import_data9 = __toESM(require_data(), 1);
2607    var import_hooks = __toESM(require_hooks(), 1);
2608    var import_widgets4 = __toESM(require_widgets(), 1);
2609    var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
2610    var withMoveToWidgetAreaToolbarItem = (0, import_compose3.createHigherOrderComponent)(
2611      (BlockEdit) => (props) => {
2612        const { clientId, name: blockName } = props;
2613        const { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea: canInsertBlockInWidgetArea2 } = (0, import_data9.useSelect)(
2614          (select) => {
2615            if (blockName === "core/widget-area") {
2616              return {};
2617            }
2618            const selectors = select(store2);
2619            const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
2620            return {
2621              widgetAreas: selectors.getWidgetAreas(),
2622              currentWidgetAreaId: widgetAreaBlock?.attributes?.id,
2623              canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName)
2624            };
2625          },
2626          [clientId, blockName]
2627        );
2628        const { moveBlockToWidgetArea: moveBlockToWidgetArea2 } = (0, import_data9.useDispatch)(store2);
2629        const hasMultipleWidgetAreas = widgetAreas?.length > 1;
2630        const isMoveToWidgetAreaVisible = blockName !== "core/widget-area" && hasMultipleWidgetAreas && canInsertBlockInWidgetArea2;
2631        return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
2632          /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BlockEdit, { ...props }, "edit"),
2633          isMoveToWidgetAreaVisible && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_block_editor3.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2634            import_widgets4.MoveToWidgetArea,
2635            {
2636              widgetAreas,
2637              currentWidgetAreaId,
2638              onSelect: (widgetAreaId) => {
2639                moveBlockToWidgetArea2(
2640                  props.clientId,
2641                  widgetAreaId
2642                );
2643              }
2644            }
2645          ) })
2646        ] });
2647      },
2648      "withMoveToWidgetAreaToolbarItem"
2649    );
2650    (0, import_hooks.addFilter)(
2651      "editor.BlockEdit",
2652      "core/edit-widgets/block-edit",
2653      withMoveToWidgetAreaToolbarItem
2654    );
2655  
2656    // packages/edit-widgets/build-module/filters/replace-media-upload.mjs
2657    var import_hooks2 = __toESM(require_hooks(), 1);
2658    var import_media_utils = __toESM(require_media_utils(), 1);
2659    var replaceMediaUpload = () => import_media_utils.MediaUpload;
2660    (0, import_hooks2.addFilter)(
2661      "editor.MediaUpload",
2662      "core/edit-widgets/replace-media-upload",
2663      replaceMediaUpload
2664    );
2665  
2666    // packages/edit-widgets/build-module/blocks/widget-area/index.mjs
2667    var widget_area_exports = {};
2668    __export(widget_area_exports, {
2669      metadata: () => block_default,
2670      name: () => name,
2671      settings: () => settings
2672    });
2673    var import_i18n4 = __toESM(require_i18n(), 1);
2674  
2675    // packages/edit-widgets/build-module/blocks/widget-area/block.json
2676    var block_default = {
2677      $schema: "https://schemas.wp.org/trunk/block.json",
2678      apiVersion: 3,
2679      name: "core/widget-area",
2680      title: "Widget Area",
2681      category: "widgets",
2682      attributes: {
2683        id: {
2684          type: "string"
2685        },
2686        name: {
2687          type: "string"
2688        }
2689      },
2690      supports: {
2691        html: false,
2692        inserter: false,
2693        customClassName: false,
2694        reusable: false,
2695        renaming: false,
2696        visibility: false,
2697        __experimentalToolbar: false,
2698        __experimentalParentSelector: false,
2699        __experimentalDisableBlockOverlay: true
2700      },
2701      editorStyle: "wp-block-widget-area-editor",
2702      style: "wp-block-widget-area"
2703    };
2704  
2705    // packages/edit-widgets/build-module/blocks/widget-area/edit/index.mjs
2706    var import_element8 = __toESM(require_element(), 1);
2707    var import_data10 = __toESM(require_data(), 1);
2708    var import_core_data5 = __toESM(require_core_data(), 1);
2709    var import_components7 = __toESM(require_components(), 1);
2710    var import_block_editor5 = __toESM(require_block_editor(), 1);
2711  
2712    // packages/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.mjs
2713    var import_core_data4 = __toESM(require_core_data(), 1);
2714    var import_block_editor4 = __toESM(require_block_editor(), 1);
2715    var import_element7 = __toESM(require_element(), 1);
2716  
2717    // packages/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs
2718    var import_element6 = __toESM(require_element(), 1);
2719    var useIsDraggingWithin = (elementRef) => {
2720      const [isDraggingWithin, setIsDraggingWithin] = (0, import_element6.useState)(false);
2721      (0, import_element6.useEffect)(() => {
2722        const { ownerDocument } = elementRef.current;
2723        function handleDragStart(event) {
2724          handleDragEnter(event);
2725        }
2726        function handleDragEnd() {
2727          setIsDraggingWithin(false);
2728        }
2729        function handleDragEnter(event) {
2730          if (elementRef.current.contains(event.target)) {
2731            setIsDraggingWithin(true);
2732          } else {
2733            setIsDraggingWithin(false);
2734          }
2735        }
2736        ownerDocument.addEventListener("dragstart", handleDragStart);
2737        ownerDocument.addEventListener("dragend", handleDragEnd);
2738        ownerDocument.addEventListener("dragenter", handleDragEnter);
2739        return () => {
2740          ownerDocument.removeEventListener("dragstart", handleDragStart);
2741          ownerDocument.removeEventListener("dragend", handleDragEnd);
2742          ownerDocument.removeEventListener("dragenter", handleDragEnter);
2743        };
2744      }, []);
2745      return isDraggingWithin;
2746    };
2747    var use_is_dragging_within_default = useIsDraggingWithin;
2748  
2749    // packages/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.mjs
2750    var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
2751    function WidgetAreaInnerBlocks({ id }) {
2752      const [blocks, onInput, onChange] = (0, import_core_data4.useEntityBlockEditor)(
2753        "root",
2754        "postType"
2755      );
2756      const innerBlocksRef = (0, import_element7.useRef)();
2757      const isDraggingWithinInnerBlocks = use_is_dragging_within_default(innerBlocksRef);
2758      const shouldHighlightDropZone = isDraggingWithinInnerBlocks;
2759      const innerBlocksProps = (0, import_block_editor4.useInnerBlocksProps)(
2760        { ref: innerBlocksRef },
2761        {
2762          value: blocks,
2763          onInput,
2764          onChange,
2765          templateLock: false,
2766          renderAppender: import_block_editor4.InnerBlocks.ButtonBlockAppender
2767        }
2768      );
2769      return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2770        "div",
2771        {
2772          "data-widget-area-id": id,
2773          className: clsx_default(
2774            "wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper",
2775            {
2776              "wp-block-widget-area__highlight-drop-zone": shouldHighlightDropZone
2777            }
2778          ),
2779          children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ...innerBlocksProps })
2780        }
2781      );
2782    }
2783  
2784    // packages/edit-widgets/build-module/blocks/widget-area/edit/index.mjs
2785    var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
2786    function WidgetAreaEdit({
2787      clientId,
2788      attributes: { id, name: name2 }
2789    }) {
2790      const isOpen = (0, import_data10.useSelect)(
2791        (select) => select(store2).getIsWidgetAreaOpen(clientId),
2792        [clientId]
2793      );
2794      const { setIsWidgetAreaOpen: setIsWidgetAreaOpen2 } = (0, import_data10.useDispatch)(store2);
2795      const wrapper = (0, import_element8.useRef)();
2796      const setOpen = (0, import_element8.useCallback)(
2797        (openState) => setIsWidgetAreaOpen2(clientId, openState),
2798        [clientId]
2799      );
2800      const isDragging = useIsDragging(wrapper);
2801      const isDraggingWithin = use_is_dragging_within_default(wrapper);
2802      const [openedWhileDragging, setOpenedWhileDragging] = (0, import_element8.useState)(false);
2803      (0, import_element8.useEffect)(() => {
2804        if (!isDragging) {
2805          setOpenedWhileDragging(false);
2806          return;
2807        }
2808        if (isDraggingWithin && !isOpen) {
2809          setOpen(true);
2810          setOpenedWhileDragging(true);
2811        } else if (!isDraggingWithin && isOpen && openedWhileDragging) {
2812          setOpen(false);
2813        }
2814      }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]);
2815      const blockProps = (0, import_block_editor5.useBlockProps)();
2816      return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components7.Panel, { ref: wrapper, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2817        import_components7.PanelBody,
2818        {
2819          title: name2,
2820          opened: isOpen,
2821          onToggle: () => {
2822            setIsWidgetAreaOpen2(clientId, !isOpen);
2823          },
2824          scrollAfterOpen: !isDragging,
2825          children: ({ opened }) => (
2826            // This is required to ensure LegacyWidget blocks are not
2827            // unmounted when the panel is collapsed. Unmounting legacy
2828            // widgets may have unintended consequences (e.g.  TinyMCE
2829            // not being properly reinitialized)
2830            /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2831              import_components7.__unstableDisclosureContent,
2832              {
2833                className: "wp-block-widget-area__panel-body-content",
2834                visible: opened,
2835                children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2836                  import_core_data5.EntityProvider,
2837                  {
2838                    kind: "root",
2839                    type: "postType",
2840                    id: `widget-area-$id}`,
2841                    children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(WidgetAreaInnerBlocks, { id })
2842                  }
2843                )
2844              }
2845            )
2846          )
2847        }
2848      ) }) });
2849    }
2850    var useIsDragging = (elementRef) => {
2851      const [isDragging, setIsDragging] = (0, import_element8.useState)(false);
2852      (0, import_element8.useEffect)(() => {
2853        const { ownerDocument } = elementRef.current;
2854        function handleDragStart() {
2855          setIsDragging(true);
2856        }
2857        function handleDragEnd() {
2858          setIsDragging(false);
2859        }
2860        ownerDocument.addEventListener("dragstart", handleDragStart);
2861        ownerDocument.addEventListener("dragend", handleDragEnd);
2862        return () => {
2863          ownerDocument.removeEventListener("dragstart", handleDragStart);
2864          ownerDocument.removeEventListener("dragend", handleDragEnd);
2865        };
2866      }, []);
2867      return isDragging;
2868    };
2869  
2870    // packages/edit-widgets/build-module/blocks/widget-area/index.mjs
2871    var { name } = block_default;
2872    var settings = {
2873      title: (0, import_i18n4.__)("Widget Area"),
2874      description: (0, import_i18n4.__)("A widget area container."),
2875      __experimentalLabel: ({ name: label }) => label,
2876      edit: WidgetAreaEdit
2877    };
2878  
2879    // packages/edit-widgets/build-module/components/layout/index.mjs
2880    var import_i18n21 = __toESM(require_i18n(), 1);
2881    var import_element26 = __toESM(require_element(), 1);
2882    var import_data31 = __toESM(require_data(), 1);
2883    var import_plugins3 = __toESM(require_plugins(), 1);
2884    var import_notices4 = __toESM(require_notices(), 1);
2885    var import_components22 = __toESM(require_components(), 1);
2886    var import_theme2 = __toESM(require_theme(), 1);
2887  
2888    // packages/edit-widgets/build-module/components/error-boundary/index.mjs
2889    var import_element9 = __toESM(require_element(), 1);
2890    var import_i18n5 = __toESM(require_i18n(), 1);
2891    var import_components8 = __toESM(require_components(), 1);
2892    var import_block_editor6 = __toESM(require_block_editor(), 1);
2893    var import_compose4 = __toESM(require_compose(), 1);
2894    var import_hooks3 = __toESM(require_hooks(), 1);
2895    var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
2896    function CopyButton({ text, children }) {
2897      const ref = (0, import_compose4.useCopyToClipboard)(text);
2898      return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components8.Button, { __next40pxDefaultSize: true, variant: "secondary", ref, children });
2899    }
2900    function ErrorBoundaryWarning({ message, error }) {
2901      const actions = [
2902        /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CopyButton, { text: error.stack, children: (0, import_i18n5.__)("Copy Error") }, "copy-error")
2903      ];
2904      return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_block_editor6.Warning, { className: "edit-widgets-error-boundary", actions, children: message });
2905    }
2906    var ErrorBoundary = class extends import_element9.Component {
2907      constructor() {
2908        super(...arguments);
2909        this.state = {
2910          error: null
2911        };
2912      }
2913      componentDidCatch(error) {
2914        (0, import_hooks3.doAction)("editor.ErrorBoundary.errorLogged", error);
2915      }
2916      static getDerivedStateFromError(error) {
2917        return { error };
2918      }
2919      render() {
2920        if (!this.state.error) {
2921          return this.props.children;
2922        }
2923        return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2924          ErrorBoundaryWarning,
2925          {
2926            message: (0, import_i18n5.__)(
2927              "The editor has encountered an unexpected error."
2928            ),
2929            error: this.state.error
2930          }
2931        );
2932      }
2933    };
2934  
2935    // packages/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.mjs
2936    var import_components9 = __toESM(require_components(), 1);
2937    var import_compose5 = __toESM(require_compose(), 1);
2938    var import_media_utils2 = __toESM(require_media_utils(), 1);
2939    var import_data13 = __toESM(require_data(), 1);
2940    var import_core_data8 = __toESM(require_core_data(), 1);
2941    var import_element11 = __toESM(require_element(), 1);
2942    var import_block_editor9 = __toESM(require_block_editor(), 1);
2943    var import_patterns = __toESM(require_patterns(), 1);
2944    var import_preferences4 = __toESM(require_preferences(), 1);
2945    var import_block_library = __toESM(require_block_library(), 1);
2946  
2947    // packages/edit-widgets/build-module/components/keyboard-shortcuts/index.mjs
2948    var import_element10 = __toESM(require_element(), 1);
2949    var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1);
2950    var import_keycodes = __toESM(require_keycodes(), 1);
2951    var import_data11 = __toESM(require_data(), 1);
2952    var import_i18n6 = __toESM(require_i18n(), 1);
2953    var import_core_data6 = __toESM(require_core_data(), 1);
2954    var import_block_editor7 = __toESM(require_block_editor(), 1);
2955    var { usesNativeUndo } = unlock(import_block_editor7.privateApis);
2956    function KeyboardShortcuts() {
2957      const { redo, undo } = (0, import_data11.useDispatch)(import_core_data6.store);
2958      const { saveEditedWidgetAreas: saveEditedWidgetAreas2 } = (0, import_data11.useDispatch)(store2);
2959      (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/undo", (event) => {
2960        if (usesNativeUndo(event)) {
2961          return;
2962        }
2963        undo();
2964        event.preventDefault();
2965      });
2966      (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/redo", (event) => {
2967        if (usesNativeUndo(event)) {
2968          return;
2969        }
2970        redo();
2971        event.preventDefault();
2972      });
2973      (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/save", (event) => {
2974        event.preventDefault();
2975        saveEditedWidgetAreas2();
2976      });
2977      return null;
2978    }
2979    function KeyboardShortcutsRegister() {
2980      const { registerShortcut } = (0, import_data11.useDispatch)(import_keyboard_shortcuts.store);
2981      (0, import_element10.useEffect)(() => {
2982        registerShortcut({
2983          name: "core/edit-widgets/undo",
2984          category: "global",
2985          description: (0, import_i18n6.__)("Undo your last changes."),
2986          keyCombination: {
2987            modifier: "primary",
2988            character: "z"
2989          }
2990        });
2991        registerShortcut({
2992          name: "core/edit-widgets/redo",
2993          category: "global",
2994          description: (0, import_i18n6.__)("Redo your last undo."),
2995          keyCombination: {
2996            modifier: "primaryShift",
2997            character: "z"
2998          },
2999          // Disable on Apple OS because it conflicts with the browser's
3000          // history shortcut. It's a fine alias for both Windows and Linux.
3001          // Since there's no conflict for Ctrl+Shift+Z on both Windows and
3002          // Linux, we keep it as the default for consistency.
3003          aliases: (0, import_keycodes.isAppleOS)() ? [] : [
3004            {
3005              modifier: "primary",
3006              character: "y"
3007            }
3008          ]
3009        });
3010        registerShortcut({
3011          name: "core/edit-widgets/save",
3012          category: "global",
3013          description: (0, import_i18n6.__)("Save your changes."),
3014          keyCombination: {
3015            modifier: "primary",
3016            character: "s"
3017          }
3018        });
3019        registerShortcut({
3020          name: "core/edit-widgets/keyboard-shortcuts",
3021          category: "main",
3022          description: (0, import_i18n6.__)("Display these keyboard shortcuts."),
3023          keyCombination: {
3024            modifier: "access",
3025            character: "h"
3026          }
3027        });
3028        registerShortcut({
3029          name: "core/edit-widgets/next-region",
3030          category: "global",
3031          description: (0, import_i18n6.__)("Navigate to the next part of the editor."),
3032          keyCombination: {
3033            modifier: "ctrl",
3034            character: "`"
3035          },
3036          aliases: [
3037            {
3038              modifier: "access",
3039              character: "n"
3040            }
3041          ]
3042        });
3043        registerShortcut({
3044          name: "core/edit-widgets/previous-region",
3045          category: "global",
3046          description: (0, import_i18n6.__)("Navigate to the previous part of the editor."),
3047          keyCombination: {
3048            modifier: "ctrlShift",
3049            character: "`"
3050          },
3051          aliases: [
3052            {
3053              modifier: "access",
3054              character: "p"
3055            },
3056            {
3057              modifier: "ctrlShift",
3058              character: "~"
3059            }
3060          ]
3061        });
3062      }, [registerShortcut]);
3063      return null;
3064    }
3065    KeyboardShortcuts.Register = KeyboardShortcutsRegister;
3066    var keyboard_shortcuts_default = KeyboardShortcuts;
3067  
3068    // packages/edit-widgets/build-module/hooks/use-last-selected-widget-area.mjs
3069    var import_data12 = __toESM(require_data(), 1);
3070    var import_block_editor8 = __toESM(require_block_editor(), 1);
3071    var import_core_data7 = __toESM(require_core_data(), 1);
3072    var useLastSelectedWidgetArea = () => (0, import_data12.useSelect)((select) => {
3073      const { getBlockSelectionEnd, getBlockName } = select(import_block_editor8.store);
3074      const selectionEndClientId = getBlockSelectionEnd();
3075      if (getBlockName(selectionEndClientId) === "core/widget-area") {
3076        return selectionEndClientId;
3077      }
3078      const { getParentWidgetAreaBlock: getParentWidgetAreaBlock2 } = select(store2);
3079      const widgetAreaBlock = getParentWidgetAreaBlock2(selectionEndClientId);
3080      const widgetAreaBlockClientId = widgetAreaBlock?.clientId;
3081      if (widgetAreaBlockClientId) {
3082        return widgetAreaBlockClientId;
3083      }
3084      const { getEntityRecord } = select(import_core_data7.store);
3085      const widgetAreasPost = getEntityRecord(
3086        KIND,
3087        POST_TYPE,
3088        buildWidgetAreasPostId()
3089      );
3090      return widgetAreasPost?.blocks[0]?.clientId;
3091    }, []);
3092    var use_last_selected_widget_area_default = useLastSelectedWidgetArea;
3093  
3094    // packages/edit-widgets/build-module/constants.mjs
3095    var ALLOW_REUSABLE_BLOCKS = false;
3096  
3097    // packages/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.mjs
3098    var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
3099    var { ExperimentalBlockEditorProvider } = unlock(import_block_editor9.privateApis);
3100    var { PatternsMenuItems } = unlock(import_patterns.privateApis);
3101    var { BlockKeyboardShortcuts } = unlock(import_block_library.privateApis);
3102    var EMPTY_ARRAY2 = [];
3103    function WidgetAreasBlockEditorProvider({
3104      blockEditorSettings,
3105      children,
3106      ...props
3107    }) {
3108      const isLargeViewport = (0, import_compose5.useViewportMatch)("medium");
3109      const {
3110        hasUploadPermissions,
3111        reusableBlocks,
3112        isFixedToolbarActive,
3113        keepCaretInsideBlock,
3114        pageOnFront,
3115        pageForPosts
3116      } = (0, import_data13.useSelect)((select) => {
3117        const { canUser, getEntityRecord, getEntityRecords } = select(import_core_data8.store);
3118        const siteSettings = canUser("read", {
3119          kind: "root",
3120          name: "site"
3121        }) ? getEntityRecord("root", "site") : void 0;
3122        return {
3123          hasUploadPermissions: canUser("create", {
3124            kind: "postType",
3125            name: "attachment"
3126          }) ?? true,
3127          reusableBlocks: ALLOW_REUSABLE_BLOCKS ? getEntityRecords("postType", "wp_block") : EMPTY_ARRAY2,
3128          isFixedToolbarActive: !!select(import_preferences4.store).get(
3129            "core/edit-widgets",
3130            "fixedToolbar"
3131          ),
3132          keepCaretInsideBlock: !!select(import_preferences4.store).get(
3133            "core/edit-widgets",
3134            "keepCaretInsideBlock"
3135          ),
3136          pageOnFront: siteSettings?.page_on_front,
3137          pageForPosts: siteSettings?.page_for_posts
3138        };
3139      }, []);
3140      const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data13.useDispatch)(store2);
3141      const settings2 = (0, import_element11.useMemo)(() => {
3142        let mediaUploadBlockEditor;
3143        if (hasUploadPermissions) {
3144          mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => {
3145            (0, import_media_utils2.uploadMedia)({
3146              wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
3147              onError: ({ message }) => onError(message),
3148              ...argumentsObject
3149            });
3150          };
3151        }
3152        return {
3153          ...blockEditorSettings,
3154          __experimentalReusableBlocks: reusableBlocks,
3155          hasFixedToolbar: isFixedToolbarActive || !isLargeViewport,
3156          keepCaretInsideBlock,
3157          mediaUpload: mediaUploadBlockEditor,
3158          templateLock: "all",
3159          __experimentalSetIsInserterOpened: setIsInserterOpened2,
3160          pageOnFront,
3161          pageForPosts,
3162          editorTool: "edit"
3163        };
3164      }, [
3165        hasUploadPermissions,
3166        blockEditorSettings,
3167        isFixedToolbarActive,
3168        isLargeViewport,
3169        keepCaretInsideBlock,
3170        reusableBlocks,
3171        setIsInserterOpened2,
3172        pageOnFront,
3173        pageForPosts
3174      ]);
3175      const widgetAreaId = use_last_selected_widget_area_default();
3176      const [blocks, onInput, onChange] = (0, import_core_data8.useEntityBlockEditor)(
3177        KIND,
3178        POST_TYPE,
3179        { id: buildWidgetAreasPostId() }
3180      );
3181      return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_components9.SlotFillProvider, { children: [
3182        /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(keyboard_shortcuts_default.Register, {}),
3183        /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BlockKeyboardShortcuts, {}),
3184        /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3185          ExperimentalBlockEditorProvider,
3186          {
3187            value: blocks,
3188            onInput,
3189            onChange,
3190            settings: settings2,
3191            useSubRegistry: false,
3192            ...props,
3193            children: [
3194              children,
3195              /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PatternsMenuItems, { rootClientId: widgetAreaId })
3196            ]
3197          }
3198        )
3199      ] });
3200    }
3201  
3202    // packages/edit-widgets/build-module/components/sidebar/index.mjs
3203    var import_element13 = __toESM(require_element(), 1);
3204    var import_i18n8 = __toESM(require_i18n(), 1);
3205    var import_block_editor11 = __toESM(require_block_editor(), 1);
3206    var import_components11 = __toESM(require_components(), 1);
3207    var import_data15 = __toESM(require_data(), 1);
3208  
3209    // packages/edit-widgets/build-module/components/sidebar/widget-areas.mjs
3210    var import_data14 = __toESM(require_data(), 1);
3211    var import_element12 = __toESM(require_element(), 1);
3212    var import_block_editor10 = __toESM(require_block_editor(), 1);
3213    var import_components10 = __toESM(require_components(), 1);
3214    var import_i18n7 = __toESM(require_i18n(), 1);
3215    var import_url = __toESM(require_url(), 1);
3216    var import_dom = __toESM(require_dom(), 1);
3217    var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
3218    function WidgetAreas({ selectedWidgetAreaId }) {
3219      const widgetAreas = (0, import_data14.useSelect)(
3220        (select) => select(store2).getWidgetAreas(),
3221        []
3222      );
3223      const selectedWidgetArea = (0, import_element12.useMemo)(
3224        () => selectedWidgetAreaId && widgetAreas?.find(
3225          (widgetArea) => widgetArea.id === selectedWidgetAreaId
3226        ),
3227        [selectedWidgetAreaId, widgetAreas]
3228      );
3229      let description;
3230      if (!selectedWidgetArea) {
3231        description = (0, import_i18n7.__)(
3232          // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
3233          "Widget Areas are global parts in your site\u2019s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer."
3234        );
3235      } else if (selectedWidgetAreaId === "wp_inactive_widgets") {
3236        description = (0, import_i18n7.__)(
3237          "Blocks in this Widget Area will not be displayed in your site."
3238        );
3239      } else {
3240        description = selectedWidgetArea.description;
3241      }
3242      return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "edit-widgets-widget-areas", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "edit-widgets-widget-areas__top-container", children: [
3243        /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_block_editor10.BlockIcon, { icon: block_default_default }),
3244        /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
3245          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3246            "p",
3247            {
3248              dangerouslySetInnerHTML: {
3249                __html: (0, import_dom.safeHTML)(description)
3250              }
3251            }
3252          ),
3253          widgetAreas?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { children: (0, import_i18n7.__)(
3254            "Your theme does not contain any Widget Areas."
3255          ) }),
3256          !selectedWidgetArea && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3257            import_components10.Button,
3258            {
3259              __next40pxDefaultSize: true,
3260              href: (0, import_url.addQueryArgs)("customize.php", {
3261                "autofocus[panel]": "widgets",
3262                return: window.location.pathname
3263              }),
3264              variant: "tertiary",
3265              children: (0, import_i18n7.__)("Manage with live preview")
3266            }
3267          )
3268        ] })
3269      ] }) });
3270    }
3271  
3272    // packages/edit-widgets/build-module/components/sidebar/index.mjs
3273    var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
3274    var SIDEBAR_ACTIVE_BY_DEFAULT = true;
3275    var BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector";
3276    var WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas";
3277    var { Tabs } = unlock(import_components11.privateApis);
3278    function SidebarHeader({ selectedWidgetAreaBlock }) {
3279      return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tabs.TabList, { children: [
3280        /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Tabs.Tab, { tabId: WIDGET_AREAS_IDENTIFIER, children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0, import_i18n8.__)("Widget Areas") }),
3281        /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Tabs.Tab, { tabId: BLOCK_INSPECTOR_IDENTIFIER, children: (0, import_i18n8.__)("Block") })
3282      ] });
3283    }
3284    function SidebarContent({
3285      hasSelectedNonAreaBlock,
3286      currentArea,
3287      isGeneralSidebarOpen,
3288      selectedWidgetAreaBlock
3289    }) {
3290      const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data15.useDispatch)(store);
3291      (0, import_element13.useEffect)(() => {
3292        if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) {
3293          enableComplementaryArea2(
3294            "core/edit-widgets",
3295            BLOCK_INSPECTOR_IDENTIFIER
3296          );
3297        }
3298        if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) {
3299          enableComplementaryArea2(
3300            "core/edit-widgets",
3301            WIDGET_AREAS_IDENTIFIER
3302          );
3303        }
3304      }, [hasSelectedNonAreaBlock, enableComplementaryArea2]);
3305      const tabsContextValue = (0, import_element13.useContext)(Tabs.Context);
3306      return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3307        complementary_area_default,
3308        {
3309          className: "edit-widgets-sidebar",
3310          header: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3311            SidebarHeader,
3312            {
3313              selectedWidgetAreaBlock
3314            }
3315          ) }),
3316          headerClassName: "edit-widgets-sidebar__panel-tabs",
3317          title: (0, import_i18n8.__)("Settings"),
3318          closeLabel: (0, import_i18n8.__)("Close Settings"),
3319          scope: "core/edit-widgets",
3320          identifier: currentArea,
3321          icon: (0, import_i18n8.isRTL)() ? drawer_left_default : drawer_right_default,
3322          isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
3323          children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tabs.Context.Provider, { value: tabsContextValue, children: [
3324            /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3325              Tabs.TabPanel,
3326              {
3327                tabId: WIDGET_AREAS_IDENTIFIER,
3328                focusable: false,
3329                children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3330                  WidgetAreas,
3331                  {
3332                    selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id
3333                  }
3334                )
3335              }
3336            ),
3337            /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3338              Tabs.TabPanel,
3339              {
3340                tabId: BLOCK_INSPECTOR_IDENTIFIER,
3341                focusable: false,
3342                children: hasSelectedNonAreaBlock ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_block_editor11.BlockInspector, {}) : (
3343                  // Pretend that Widget Areas are part of the UI by not
3344                  // showing the Block Inspector when one is selected.
3345                  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0, import_i18n8.__)("No block selected.") })
3346                )
3347              }
3348            )
3349          ] })
3350        }
3351      );
3352    }
3353    function Sidebar() {
3354      const {
3355        currentArea,
3356        hasSelectedNonAreaBlock,
3357        isGeneralSidebarOpen,
3358        selectedWidgetAreaBlock
3359      } = (0, import_data15.useSelect)((select) => {
3360        const { getSelectedBlock, getBlock, getBlockParentsByBlockName } = select(import_block_editor11.store);
3361        const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select(store);
3362        const selectedBlock = getSelectedBlock();
3363        const activeArea = getActiveComplementaryArea2(store2.name);
3364        let currentSelection = activeArea;
3365        if (!currentSelection) {
3366          if (selectedBlock) {
3367            currentSelection = BLOCK_INSPECTOR_IDENTIFIER;
3368          } else {
3369            currentSelection = WIDGET_AREAS_IDENTIFIER;
3370          }
3371        }
3372        let widgetAreaBlock;
3373        if (selectedBlock) {
3374          if (selectedBlock.name === "core/widget-area") {
3375            widgetAreaBlock = selectedBlock;
3376          } else {
3377            widgetAreaBlock = getBlock(
3378              getBlockParentsByBlockName(
3379                selectedBlock.clientId,
3380                "core/widget-area"
3381              )[0]
3382            );
3383          }
3384        }
3385        return {
3386          currentArea: currentSelection,
3387          hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== "core/widget-area"),
3388          isGeneralSidebarOpen: !!activeArea,
3389          selectedWidgetAreaBlock: widgetAreaBlock
3390        };
3391      }, []);
3392      const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data15.useDispatch)(store);
3393      const onTabSelect = (0, import_element13.useCallback)(
3394        (newSelectedTabId) => {
3395          if (!!newSelectedTabId) {
3396            enableComplementaryArea2(
3397              store2.name,
3398              newSelectedTabId
3399            );
3400          }
3401        },
3402        [enableComplementaryArea2]
3403      );
3404      return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3405        Tabs,
3406        {
3407          selectedTabId: isGeneralSidebarOpen ? currentArea : null,
3408          onSelect: onTabSelect,
3409          selectOnMove: false,
3410          children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3411            SidebarContent,
3412            {
3413              hasSelectedNonAreaBlock,
3414              currentArea,
3415              isGeneralSidebarOpen,
3416              selectedWidgetAreaBlock
3417            }
3418          )
3419        }
3420      );
3421    }
3422  
3423    // packages/edit-widgets/build-module/components/layout/interface.mjs
3424    var import_compose12 = __toESM(require_compose(), 1);
3425    var import_block_editor18 = __toESM(require_block_editor(), 1);
3426    var import_element23 = __toESM(require_element(), 1);
3427    var import_data28 = __toESM(require_data(), 1);
3428    var import_i18n18 = __toESM(require_i18n(), 1);
3429    var import_preferences8 = __toESM(require_preferences(), 1);
3430  
3431    // packages/edit-widgets/build-module/components/header/index.mjs
3432    var import_block_editor13 = __toESM(require_block_editor(), 1);
3433    var import_data22 = __toESM(require_data(), 1);
3434    var import_element19 = __toESM(require_element(), 1);
3435    var import_i18n16 = __toESM(require_i18n(), 1);
3436    var import_components19 = __toESM(require_components(), 1);
3437    var import_compose8 = __toESM(require_compose(), 1);
3438    var import_preferences6 = __toESM(require_preferences(), 1);
3439  
3440    // packages/edit-widgets/build-module/components/header/document-tools/index.mjs
3441    var import_data18 = __toESM(require_data(), 1);
3442    var import_i18n11 = __toESM(require_i18n(), 1);
3443    var import_components14 = __toESM(require_components(), 1);
3444    var import_block_editor12 = __toESM(require_block_editor(), 1);
3445    var import_element16 = __toESM(require_element(), 1);
3446    var import_compose6 = __toESM(require_compose(), 1);
3447  
3448    // packages/edit-widgets/build-module/components/header/undo-redo/undo.mjs
3449    var import_i18n9 = __toESM(require_i18n(), 1);
3450    var import_components12 = __toESM(require_components(), 1);
3451    var import_data16 = __toESM(require_data(), 1);
3452    var import_keycodes2 = __toESM(require_keycodes(), 1);
3453    var import_core_data9 = __toESM(require_core_data(), 1);
3454    var import_element14 = __toESM(require_element(), 1);
3455    var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
3456    function UndoButton(props, ref) {
3457      const hasUndo = (0, import_data16.useSelect)(
3458        (select) => select(import_core_data9.store).hasUndo(),
3459        []
3460      );
3461      const { undo } = (0, import_data16.useDispatch)(import_core_data9.store);
3462      return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3463        import_components12.Button,
3464        {
3465          ...props,
3466          ref,
3467          icon: !(0, import_i18n9.isRTL)() ? undo_default : redo_default,
3468          label: (0, import_i18n9.__)("Undo"),
3469          shortcut: import_keycodes2.displayShortcut.primary("z"),
3470          "aria-disabled": !hasUndo,
3471          onClick: hasUndo ? undo : void 0,
3472          size: "compact"
3473        }
3474      );
3475    }
3476    var undo_default2 = (0, import_element14.forwardRef)(UndoButton);
3477  
3478    // packages/edit-widgets/build-module/components/header/undo-redo/redo.mjs
3479    var import_i18n10 = __toESM(require_i18n(), 1);
3480    var import_components13 = __toESM(require_components(), 1);
3481    var import_data17 = __toESM(require_data(), 1);
3482    var import_keycodes3 = __toESM(require_keycodes(), 1);
3483    var import_core_data10 = __toESM(require_core_data(), 1);
3484    var import_element15 = __toESM(require_element(), 1);
3485    var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
3486    function RedoButton(props, ref) {
3487      const shortcut = (0, import_keycodes3.isAppleOS)() ? import_keycodes3.displayShortcut.primaryShift("z") : import_keycodes3.displayShortcut.primary("y");
3488      const hasRedo = (0, import_data17.useSelect)(
3489        (select) => select(import_core_data10.store).hasRedo(),
3490        []
3491      );
3492      const { redo } = (0, import_data17.useDispatch)(import_core_data10.store);
3493      return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3494        import_components13.Button,
3495        {
3496          ...props,
3497          ref,
3498          icon: !(0, import_i18n10.isRTL)() ? redo_default : undo_default,
3499          label: (0, import_i18n10.__)("Redo"),
3500          shortcut,
3501          "aria-disabled": !hasRedo,
3502          onClick: hasRedo ? redo : void 0,
3503          size: "compact"
3504        }
3505      );
3506    }
3507    var redo_default2 = (0, import_element15.forwardRef)(RedoButton);
3508  
3509    // packages/edit-widgets/build-module/components/header/document-tools/index.mjs
3510    var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
3511    function DocumentTools() {
3512      const isMediumViewport = (0, import_compose6.useViewportMatch)("medium");
3513      const {
3514        isInserterOpen,
3515        isListViewOpen,
3516        inserterSidebarToggleRef: inserterSidebarToggleRef2,
3517        listViewToggleRef: listViewToggleRef2
3518      } = (0, import_data18.useSelect)((select) => {
3519        const {
3520          isInserterOpened: isInserterOpened2,
3521          getInserterSidebarToggleRef: getInserterSidebarToggleRef2,
3522          isListViewOpened: isListViewOpened2,
3523          getListViewToggleRef: getListViewToggleRef2
3524        } = unlock(select(store2));
3525        return {
3526          isInserterOpen: isInserterOpened2(),
3527          isListViewOpen: isListViewOpened2(),
3528          inserterSidebarToggleRef: getInserterSidebarToggleRef2(),
3529          listViewToggleRef: getListViewToggleRef2()
3530        };
3531      }, []);
3532      const { setIsInserterOpened: setIsInserterOpened2, setIsListViewOpened: setIsListViewOpened2 } = (0, import_data18.useDispatch)(store2);
3533      const toggleListView = (0, import_element16.useCallback)(
3534        () => setIsListViewOpened2(!isListViewOpen),
3535        [setIsListViewOpened2, isListViewOpen]
3536      );
3537      const toggleInserterSidebar = (0, import_element16.useCallback)(
3538        () => setIsInserterOpened2(!isInserterOpen),
3539        [setIsInserterOpened2, isInserterOpen]
3540      );
3541      return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
3542        import_block_editor12.NavigableToolbar,
3543        {
3544          className: "edit-widgets-header-toolbar",
3545          "aria-label": (0, import_i18n11.__)("Document tools"),
3546          variant: "unstyled",
3547          children: [
3548            /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3549              import_components14.ToolbarItem,
3550              {
3551                ref: inserterSidebarToggleRef2,
3552                as: import_components14.Button,
3553                className: "edit-widgets-header-toolbar__inserter-toggle",
3554                variant: "primary",
3555                isPressed: isInserterOpen,
3556                onMouseDown: (event) => {
3557                  event.preventDefault();
3558                },
3559                onClick: toggleInserterSidebar,
3560                icon: plus_default,
3561                label: (0, import_i18n11._x)(
3562                  "Block Inserter",
3563                  "Generic label for block inserter button"
3564                ),
3565                size: "compact"
3566              }
3567            ),
3568            isMediumViewport && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
3569              /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components14.ToolbarItem, { as: undo_default2 }),
3570              /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components14.ToolbarItem, { as: redo_default2 }),
3571              /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3572                import_components14.ToolbarItem,
3573                {
3574                  as: import_components14.Button,
3575                  className: "edit-widgets-header-toolbar__list-view-toggle",
3576                  icon: list_view_default,
3577                  isPressed: isListViewOpen,
3578                  label: (0, import_i18n11.__)("List View"),
3579                  onClick: toggleListView,
3580                  ref: listViewToggleRef2,
3581                  size: "compact"
3582                }
3583              )
3584            ] })
3585          ]
3586        }
3587      );
3588    }
3589    var document_tools_default = DocumentTools;
3590  
3591    // packages/edit-widgets/build-module/components/save-button/index.mjs
3592    var import_components15 = __toESM(require_components(), 1);
3593    var import_i18n12 = __toESM(require_i18n(), 1);
3594    var import_data19 = __toESM(require_data(), 1);
3595    var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
3596    function SaveButton() {
3597      const { hasEditedWidgetAreaIds, isSaving, isWidgetSaveLocked } = (0, import_data19.useSelect)(
3598        (select) => {
3599          const {
3600            getEditedWidgetAreas: getEditedWidgetAreas2,
3601            isSavingWidgetAreas: isSavingWidgetAreas2,
3602            isWidgetSavingLocked: isWidgetSavingLocked2
3603          } = select(store2);
3604          return {
3605            hasEditedWidgetAreaIds: getEditedWidgetAreas2()?.length > 0,
3606            isSaving: isSavingWidgetAreas2(),
3607            isWidgetSaveLocked: isWidgetSavingLocked2()
3608          };
3609        },
3610        []
3611      );
3612      const { saveEditedWidgetAreas: saveEditedWidgetAreas2 } = (0, import_data19.useDispatch)(store2);
3613      const isDisabled = isWidgetSaveLocked || isSaving || !hasEditedWidgetAreaIds;
3614      return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3615        import_components15.Button,
3616        {
3617          variant: "primary",
3618          isBusy: isSaving,
3619          "aria-disabled": isDisabled,
3620          onClick: isDisabled ? void 0 : saveEditedWidgetAreas2,
3621          size: "compact",
3622          children: isSaving ? (0, import_i18n12.__)("Saving\u2026") : (0, import_i18n12.__)("Update")
3623        }
3624      );
3625    }
3626    var save_button_default = SaveButton;
3627  
3628    // packages/edit-widgets/build-module/components/more-menu/index.mjs
3629    var import_components18 = __toESM(require_components(), 1);
3630    var import_element18 = __toESM(require_element(), 1);
3631    var import_i18n15 = __toESM(require_i18n(), 1);
3632    var import_preferences5 = __toESM(require_preferences(), 1);
3633    var import_keycodes5 = __toESM(require_keycodes(), 1);
3634    var import_keyboard_shortcuts5 = __toESM(require_keyboard_shortcuts(), 1);
3635    var import_compose7 = __toESM(require_compose(), 1);
3636  
3637    // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs
3638    var import_components16 = __toESM(require_components(), 1);
3639    var import_i18n14 = __toESM(require_i18n(), 1);
3640    var import_keyboard_shortcuts4 = __toESM(require_keyboard_shortcuts(), 1);
3641    var import_data21 = __toESM(require_data(), 1);
3642  
3643    // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.mjs
3644    var import_i18n13 = __toESM(require_i18n(), 1);
3645    var textFormattingShortcuts = [
3646      {
3647        keyCombination: { modifier: "primary", character: "b" },
3648        description: (0, import_i18n13.__)("Make the selected text bold.")
3649      },
3650      {
3651        keyCombination: { modifier: "primary", character: "i" },
3652        description: (0, import_i18n13.__)("Make the selected text italic.")
3653      },
3654      {
3655        keyCombination: { modifier: "primary", character: "k" },
3656        description: (0, import_i18n13.__)("Convert the selected text into a link.")
3657      },
3658      {
3659        keyCombination: { modifier: "primaryShift", character: "k" },
3660        description: (0, import_i18n13.__)("Remove a link.")
3661      },
3662      {
3663        keyCombination: { character: "[[" },
3664        description: (0, import_i18n13.__)("Insert a link to a post or page.")
3665      },
3666      {
3667        keyCombination: { modifier: "primary", character: "u" },
3668        description: (0, import_i18n13.__)("Underline the selected text.")
3669      },
3670      {
3671        keyCombination: { modifier: "access", character: "d" },
3672        description: (0, import_i18n13.__)("Strikethrough the selected text.")
3673      },
3674      {
3675        keyCombination: { modifier: "access", character: "x" },
3676        description: (0, import_i18n13.__)("Make the selected text inline code.")
3677      },
3678      {
3679        keyCombination: {
3680          modifier: "access",
3681          character: "0"
3682        },
3683        aliases: [
3684          {
3685            modifier: "access",
3686            character: "7"
3687          }
3688        ],
3689        description: (0, import_i18n13.__)("Convert the current heading to a paragraph.")
3690      },
3691      {
3692        keyCombination: { modifier: "access", character: "1-6" },
3693        description: (0, import_i18n13.__)(
3694          "Convert the current paragraph or heading to a heading of level 1 to 6."
3695        )
3696      },
3697      {
3698        keyCombination: { modifier: "primaryShift", character: "SPACE" },
3699        description: (0, import_i18n13.__)("Add non breaking space.")
3700      }
3701    ];
3702  
3703    // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs
3704    var import_element17 = __toESM(require_element(), 1);
3705    var import_keycodes4 = __toESM(require_keycodes(), 1);
3706    var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
3707    function KeyCombination({ keyCombination, forceAriaLabel }) {
3708      const shortcut = keyCombination.modifier ? import_keycodes4.displayShortcutList[keyCombination.modifier](
3709        keyCombination.character
3710      ) : keyCombination.character;
3711      const ariaLabel = keyCombination.modifier ? import_keycodes4.shortcutAriaLabel[keyCombination.modifier](
3712        keyCombination.character
3713      ) : keyCombination.character;
3714      const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut];
3715      return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3716        "kbd",
3717        {
3718          className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
3719          "aria-label": forceAriaLabel || ariaLabel,
3720          children: shortcuts.map((character, index) => {
3721            if (character === "+") {
3722              return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_element17.Fragment, { children: character }, index);
3723            }
3724            return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3725              "kbd",
3726              {
3727                className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key",
3728                children: character
3729              },
3730              index
3731            );
3732          })
3733        }
3734      );
3735    }
3736    function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) {
3737      return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
3738        /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description", children: description }),
3739        /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term", children: [
3740          /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3741            KeyCombination,
3742            {
3743              keyCombination,
3744              forceAriaLabel: ariaLabel
3745            }
3746          ),
3747          aliases.map((alias, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3748            KeyCombination,
3749            {
3750              keyCombination: alias,
3751              forceAriaLabel: ariaLabel
3752            },
3753            index
3754          ))
3755        ] })
3756      ] });
3757    }
3758    var shortcut_default = Shortcut;
3759  
3760    // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs
3761    var import_data20 = __toESM(require_data(), 1);
3762    var import_keyboard_shortcuts3 = __toESM(require_keyboard_shortcuts(), 1);
3763    var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
3764    function DynamicShortcut({ name: name2 }) {
3765      const { keyCombination, description, aliases } = (0, import_data20.useSelect)(
3766        (select) => {
3767          const {
3768            getShortcutKeyCombination,
3769            getShortcutDescription,
3770            getShortcutAliases
3771          } = select(import_keyboard_shortcuts3.store);
3772          return {
3773            keyCombination: getShortcutKeyCombination(name2),
3774            aliases: getShortcutAliases(name2),
3775            description: getShortcutDescription(name2)
3776          };
3777        },
3778        [name2]
3779      );
3780      if (!keyCombination) {
3781        return null;
3782      }
3783      return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3784        shortcut_default,
3785        {
3786          keyCombination,
3787          description,
3788          aliases
3789        }
3790      );
3791    }
3792    var dynamic_shortcut_default = DynamicShortcut;
3793  
3794    // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs
3795    var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
3796    var ShortcutList = ({ shortcuts }) => (
3797      /*
3798       * Disable reason: The `list` ARIA role is redundant but
3799       * Safari+VoiceOver won't announce the list otherwise.
3800       */
3801      /* eslint-disable jsx-a11y/no-redundant-roles */
3802      /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3803        "ul",
3804        {
3805          className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list",
3806          role: "list",
3807          children: shortcuts.map((shortcut, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3808            "li",
3809            {
3810              className: "edit-widgets-keyboard-shortcut-help-modal__shortcut",
3811              children: typeof shortcut === "string" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(shortcut_default, { ...shortcut })
3812            },
3813            index
3814          ))
3815        }
3816      )
3817    );
3818    var ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3819      "section",
3820      {
3821        className: clsx_default(
3822          "edit-widgets-keyboard-shortcut-help-modal__section",
3823          className
3824        ),
3825        children: [
3826          !!title && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h2", { className: "edit-widgets-keyboard-shortcut-help-modal__section-title", children: title }),
3827          /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ShortcutList, { shortcuts })
3828        ]
3829      }
3830    );
3831    var ShortcutCategorySection = ({
3832      title,
3833      categoryName,
3834      additionalShortcuts = []
3835    }) => {
3836      const categoryShortcuts = (0, import_data21.useSelect)(
3837        (select) => {
3838          return select(import_keyboard_shortcuts4.store).getCategoryShortcuts(
3839            categoryName
3840          );
3841        },
3842        [categoryName]
3843      );
3844      return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3845        ShortcutSection,
3846        {
3847          title,
3848          shortcuts: categoryShortcuts.concat(additionalShortcuts)
3849        }
3850      );
3851    };
3852    function KeyboardShortcutHelpModal({
3853      isModalActive: isModalActive2,
3854      toggleModal
3855    }) {
3856      (0, import_keyboard_shortcuts4.useShortcut)("core/edit-widgets/keyboard-shortcuts", toggleModal, {
3857        bindGlobal: true
3858      });
3859      if (!isModalActive2) {
3860        return null;
3861      }
3862      return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
3863        import_components16.Modal,
3864        {
3865          className: "edit-widgets-keyboard-shortcut-help-modal",
3866          title: (0, import_i18n14.__)("Keyboard shortcuts"),
3867          onRequestClose: toggleModal,
3868          children: [
3869            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3870              ShortcutSection,
3871              {
3872                className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",
3873                shortcuts: ["core/edit-widgets/keyboard-shortcuts"]
3874              }
3875            ),
3876            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3877              ShortcutCategorySection,
3878              {
3879                title: (0, import_i18n14.__)("Global shortcuts"),
3880                categoryName: "global"
3881              }
3882            ),
3883            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3884              ShortcutCategorySection,
3885              {
3886                title: (0, import_i18n14.__)("Selection shortcuts"),
3887                categoryName: "selection"
3888              }
3889            ),
3890            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3891              ShortcutCategorySection,
3892              {
3893                title: (0, import_i18n14.__)("Block shortcuts"),
3894                categoryName: "block",
3895                additionalShortcuts: [
3896                  {
3897                    keyCombination: { character: "/" },
3898                    description: (0, import_i18n14.__)(
3899                      "Change the block type after adding a new paragraph."
3900                    ),
3901                    /* translators: The forward-slash character. e.g. '/'. */
3902                    ariaLabel: (0, import_i18n14.__)("Forward-slash")
3903                  }
3904                ]
3905              }
3906            ),
3907            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3908              ShortcutSection,
3909              {
3910                title: (0, import_i18n14.__)("Text formatting"),
3911                shortcuts: textFormattingShortcuts
3912              }
3913            ),
3914            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
3915              ShortcutCategorySection,
3916              {
3917                title: (0, import_i18n14.__)("List View shortcuts"),
3918                categoryName: "list-view"
3919              }
3920            )
3921          ]
3922        }
3923      );
3924    }
3925  
3926    // packages/edit-widgets/build-module/components/more-menu/tools-more-menu-group.mjs
3927    var import_components17 = __toESM(require_components(), 1);
3928    var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
3929    var { Fill: ToolsMoreMenuGroup, Slot: Slot4 } = (0, import_components17.createSlotFill)(
3930      "EditWidgetsToolsMoreMenuGroup"
3931    );
3932    ToolsMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Slot4, { fillProps, children: (fills) => fills.length > 0 && fills });
3933    var tools_more_menu_group_default = ToolsMoreMenuGroup;
3934  
3935    // packages/edit-widgets/build-module/components/more-menu/index.mjs
3936    var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
3937    function MoreMenu() {
3938      const [
3939        isKeyboardShortcutsModalActive,
3940        setIsKeyboardShortcutsModalVisible
3941      ] = (0, import_element18.useState)(false);
3942      const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
3943      (0, import_keyboard_shortcuts5.useShortcut)(
3944        "core/edit-widgets/keyboard-shortcuts",
3945        toggleKeyboardShortcutsModal
3946      );
3947      const isLargeViewport = (0, import_compose7.useViewportMatch)("medium");
3948      return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
3949        /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3950          import_components18.DropdownMenu,
3951          {
3952            icon: more_vertical_default,
3953            label: (0, import_i18n15.__)("Options"),
3954            popoverProps: {
3955              placement: "bottom-end",
3956              className: "more-menu-dropdown__content"
3957            },
3958            toggleProps: {
3959              tooltipPosition: "bottom",
3960              size: "compact"
3961            },
3962            children: (onClose) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
3963              isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components18.MenuGroup, { label: (0, import_i18n15._x)("View", "noun"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3964                import_preferences5.PreferenceToggleMenuItem,
3965                {
3966                  scope: "core/edit-widgets",
3967                  name: "fixedToolbar",
3968                  label: (0, import_i18n15.__)("Top toolbar"),
3969                  info: (0, import_i18n15.__)(
3970                    "Access all block and document tools in a single place"
3971                  ),
3972                  messageActivated: (0, import_i18n15.__)(
3973                    "Top toolbar activated"
3974                  ),
3975                  messageDeactivated: (0, import_i18n15.__)(
3976                    "Top toolbar deactivated"
3977                  )
3978                }
3979              ) }),
3980              /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_components18.MenuGroup, { label: (0, import_i18n15.__)("Tools"), children: [
3981                /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3982                  import_components18.MenuItem,
3983                  {
3984                    onClick: () => {
3985                      setIsKeyboardShortcutsModalVisible(true);
3986                    },
3987                    shortcut: import_keycodes5.displayShortcut.access("h"),
3988                    children: (0, import_i18n15.__)("Keyboard shortcuts")
3989                  }
3990                ),
3991                /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
3992                  import_preferences5.PreferenceToggleMenuItem,
3993                  {
3994                    scope: "core/edit-widgets",
3995                    name: "welcomeGuide",
3996                    label: (0, import_i18n15.__)("Welcome Guide")
3997                  }
3998                ),
3999                /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4000                  import_components18.MenuItem,
4001                  {
4002                    role: "menuitem",
4003                    icon: external_default,
4004                    href: (0, import_i18n15.__)(
4005                      "https://wordpress.org/documentation/article/block-based-widgets-editor/"
4006                    ),
4007                    target: "_blank",
4008                    rel: "noopener",
4009                    children: [
4010                      (0, import_i18n15.__)("Help"),
4011                      /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(VisuallyHidden, {
4012                        render: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", {}),
4013                        /* translators: accessibility text */
4014                        children: (0, import_i18n15.__)("(opens in a new tab)")
4015                      })
4016                    ]
4017                  }
4018                ),
4019                /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4020                  tools_more_menu_group_default.Slot,
4021                  {
4022                    fillProps: { onClose }
4023                  }
4024                )
4025              ] }),
4026              /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_components18.MenuGroup, { label: (0, import_i18n15.__)("Preferences"), children: [
4027                /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4028                  import_preferences5.PreferenceToggleMenuItem,
4029                  {
4030                    scope: "core/edit-widgets",
4031                    name: "keepCaretInsideBlock",
4032                    label: (0, import_i18n15.__)(
4033                      "Contain text cursor inside block"
4034                    ),
4035                    info: (0, import_i18n15.__)(
4036                      "Aids screen readers by stopping text caret from leaving blocks."
4037                    ),
4038                    messageActivated: (0, import_i18n15.__)(
4039                      "Contain text cursor inside block activated"
4040                    ),
4041                    messageDeactivated: (0, import_i18n15.__)(
4042                      "Contain text cursor inside block deactivated"
4043                    )
4044                  }
4045                ),
4046                /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4047                  import_preferences5.PreferenceToggleMenuItem,
4048                  {
4049                    scope: "core/edit-widgets",
4050                    name: "themeStyles",
4051                    info: (0, import_i18n15.__)(
4052                      "Make the editor look like your theme."
4053                    ),
4054                    label: (0, import_i18n15.__)("Use theme styles")
4055                  }
4056                ),
4057                isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4058                  import_preferences5.PreferenceToggleMenuItem,
4059                  {
4060                    scope: "core/edit-widgets",
4061                    name: "showBlockBreadcrumbs",
4062                    label: (0, import_i18n15.__)("Display block breadcrumbs"),
4063                    info: (0, import_i18n15.__)(
4064                      "Shows block breadcrumbs at the bottom of the editor."
4065                    ),
4066                    messageActivated: (0, import_i18n15.__)(
4067                      "Display block breadcrumbs activated"
4068                    ),
4069                    messageDeactivated: (0, import_i18n15.__)(
4070                      "Display block breadcrumbs deactivated"
4071                    )
4072                  }
4073                )
4074              ] })
4075            ] })
4076          }
4077        ),
4078        /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4079          KeyboardShortcutHelpModal,
4080          {
4081            isModalActive: isKeyboardShortcutsModalActive,
4082            toggleModal: toggleKeyboardShortcutsModal
4083          }
4084        )
4085      ] });
4086    }
4087  
4088    // packages/edit-widgets/build-module/components/header/index.mjs
4089    var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
4090    function Header() {
4091      const isLargeViewport = (0, import_compose8.useViewportMatch)("medium");
4092      const blockToolbarRef = (0, import_element19.useRef)();
4093      const { hasFixedToolbar } = (0, import_data22.useSelect)(
4094        (select) => ({
4095          hasFixedToolbar: !!select(import_preferences6.store).get(
4096            "core/edit-widgets",
4097            "fixedToolbar"
4098          )
4099        }),
4100        []
4101      );
4102      return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "edit-widgets-header", children: [
4103        /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "edit-widgets-header__navigable-toolbar-wrapper", children: [
4104          isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: "edit-widgets-header__title", children: (0, import_i18n16.__)("Widgets") }),
4105          !isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4106            VisuallyHidden,
4107            {
4108              className: "edit-widgets-header__title",
4109              render: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", {}),
4110              children: (0, import_i18n16.__)("Widgets")
4111            }
4112          ),
4113          /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(document_tools_default, {}),
4114          hasFixedToolbar && isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
4115            /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "selected-block-tools-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_block_editor13.BlockToolbar, { hideDragHandle: true }) }),
4116            /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4117              import_components19.Popover.Slot,
4118              {
4119                ref: blockToolbarRef,
4120                name: "block-toolbar"
4121              }
4122            )
4123          ] })
4124        ] }),
4125        /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "edit-widgets-header__actions", children: [
4126          /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(pinned_items_default.Slot, { scope: "core/edit-widgets" }),
4127          /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(save_button_default, {}),
4128          /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MoreMenu, {})
4129        ] })
4130      ] }) });
4131    }
4132    var header_default = Header;
4133  
4134    // packages/edit-widgets/build-module/components/widget-areas-block-editor-content/index.mjs
4135    var import_block_editor14 = __toESM(require_block_editor(), 1);
4136    var import_compose9 = __toESM(require_compose(), 1);
4137    var import_data23 = __toESM(require_data(), 1);
4138    var import_element20 = __toESM(require_element(), 1);
4139    var import_preferences7 = __toESM(require_preferences(), 1);
4140  
4141    // packages/edit-widgets/build-module/components/notices/index.mjs
4142    var import_notices2 = __toESM(require_notices(), 1);
4143    var import_theme = __toESM(require_theme(), 1);
4144    var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
4145    function Notices() {
4146      return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_theme.ThemeProvider, { cornerRadius: "none", children: [
4147        /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4148          import_notices2.InlineNotices,
4149          {
4150            className: "edit-widgets-notices",
4151            pinnedNoticesClassName: "edit-widgets-notices__pinned",
4152            dismissibleNoticesClassName: "edit-widgets-notices__dismissible"
4153          }
4154        ),
4155        /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_notices2.SnackbarNotices, { className: "edit-widgets-notices__snackbar" })
4156      ] });
4157    }
4158    var notices_default = Notices;
4159  
4160    // packages/edit-widgets/build-module/components/widget-areas-block-editor-content/index.mjs
4161    var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
4162    function WidgetAreasBlockEditorContent({
4163      blockEditorSettings
4164    }) {
4165      const hasThemeStyles = (0, import_data23.useSelect)(
4166        (select) => !!select(import_preferences7.store).get(
4167          "core/edit-widgets",
4168          "themeStyles"
4169        ),
4170        []
4171      );
4172      const isLargeViewport = (0, import_compose9.useViewportMatch)("medium");
4173      const styles = (0, import_element20.useMemo)(() => {
4174        return hasThemeStyles ? blockEditorSettings.styles : [];
4175      }, [blockEditorSettings, hasThemeStyles]);
4176      return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "edit-widgets-block-editor", children: [
4177        /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(notices_default, {}),
4178        !isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_block_editor14.BlockToolbar, { hideDragHandle: true }),
4179        /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_block_editor14.BlockTools, { children: [
4180          /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(keyboard_shortcuts_default, {}),
4181          /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4182            import_block_editor14.__unstableEditorStyles,
4183            {
4184              styles,
4185              scope: ":where(.editor-styles-wrapper)"
4186            }
4187          ),
4188          /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_block_editor14.BlockSelectionClearer, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_block_editor14.WritingFlow, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_block_editor14.BlockList, { className: "edit-widgets-main-block-list" }) }) })
4189        ] })
4190      ] });
4191    }
4192  
4193    // packages/edit-widgets/build-module/components/secondary-sidebar/index.mjs
4194    var import_data27 = __toESM(require_data(), 1);
4195  
4196    // packages/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.mjs
4197    var import_block_editor16 = __toESM(require_block_editor(), 1);
4198    var import_compose10 = __toESM(require_compose(), 1);
4199    var import_element21 = __toESM(require_element(), 1);
4200    var import_data25 = __toESM(require_data(), 1);
4201  
4202    // packages/edit-widgets/build-module/hooks/use-widget-library-insertion-point.mjs
4203    var import_data24 = __toESM(require_data(), 1);
4204    var import_block_editor15 = __toESM(require_block_editor(), 1);
4205    var import_core_data11 = __toESM(require_core_data(), 1);
4206    var useWidgetLibraryInsertionPoint = () => {
4207      const firstRootId = (0, import_data24.useSelect)((select) => {
4208        const { getEntityRecord } = select(import_core_data11.store);
4209        const widgetAreasPost = getEntityRecord(
4210          KIND,
4211          POST_TYPE,
4212          buildWidgetAreasPostId()
4213        );
4214        return widgetAreasPost?.blocks[0]?.clientId;
4215      }, []);
4216      return (0, import_data24.useSelect)(
4217        (select) => {
4218          const {
4219            getBlockRootClientId,
4220            getBlockSelectionEnd,
4221            getBlockOrder,
4222            getBlockIndex
4223          } = select(import_block_editor15.store);
4224          const insertionPoint = select(store2).__experimentalGetInsertionPoint();
4225          if (insertionPoint.rootClientId) {
4226            return insertionPoint;
4227          }
4228          const clientId = getBlockSelectionEnd() || firstRootId;
4229          const rootClientId = getBlockRootClientId(clientId);
4230          if (clientId && rootClientId === "") {
4231            return {
4232              rootClientId: clientId,
4233              insertionIndex: getBlockOrder(clientId).length
4234            };
4235          }
4236          return {
4237            rootClientId,
4238            insertionIndex: getBlockIndex(clientId) + 1
4239          };
4240        },
4241        [firstRootId]
4242      );
4243    };
4244    var use_widget_library_insertion_point_default = useWidgetLibraryInsertionPoint;
4245  
4246    // packages/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.mjs
4247    var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
4248    function InserterSidebar() {
4249      const isMobileViewport = (0, import_compose10.useViewportMatch)("medium", "<");
4250      const { rootClientId, insertionIndex } = use_widget_library_insertion_point_default();
4251      const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data25.useDispatch)(store2);
4252      const closeInserter = (0, import_element21.useCallback)(() => {
4253        return setIsInserterOpened2(false);
4254      }, [setIsInserterOpened2]);
4255      const libraryRef = (0, import_element21.useRef)();
4256      return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "edit-widgets-layout__inserter-panel", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "edit-widgets-layout__inserter-panel-content", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4257        import_block_editor16.__experimentalLibrary,
4258        {
4259          showInserterHelpPanel: true,
4260          shouldFocusBlock: isMobileViewport,
4261          rootClientId,
4262          __experimentalInsertionIndex: insertionIndex,
4263          ref: libraryRef,
4264          onClose: closeInserter
4265        }
4266      ) }) });
4267    }
4268  
4269    // packages/edit-widgets/build-module/components/secondary-sidebar/list-view-sidebar.mjs
4270    var import_block_editor17 = __toESM(require_block_editor(), 1);
4271    var import_components20 = __toESM(require_components(), 1);
4272    var import_compose11 = __toESM(require_compose(), 1);
4273    var import_data26 = __toESM(require_data(), 1);
4274    var import_element22 = __toESM(require_element(), 1);
4275    var import_i18n17 = __toESM(require_i18n(), 1);
4276    var import_keycodes6 = __toESM(require_keycodes(), 1);
4277    var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
4278    function ListViewSidebar() {
4279      const { setIsListViewOpened: setIsListViewOpened2 } = (0, import_data26.useDispatch)(store2);
4280      const { getListViewToggleRef: getListViewToggleRef2 } = unlock((0, import_data26.useSelect)(store2));
4281      const [dropZoneElement, setDropZoneElement] = (0, import_element22.useState)(null);
4282      const focusOnMountRef = (0, import_compose11.useFocusOnMount)("firstElement");
4283      const closeListView = (0, import_element22.useCallback)(() => {
4284        setIsListViewOpened2(false);
4285        getListViewToggleRef2().current?.focus();
4286      }, [getListViewToggleRef2, setIsListViewOpened2]);
4287      const closeOnEscape = (0, import_element22.useCallback)(
4288        (event) => {
4289          if (event.keyCode === import_keycodes6.ESCAPE && !event.defaultPrevented) {
4290            event.preventDefault();
4291            closeListView();
4292          }
4293        },
4294        [closeListView]
4295      );
4296      return (
4297        // eslint-disable-next-line jsx-a11y/no-static-element-interactions
4298        /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4299          "div",
4300          {
4301            className: "edit-widgets-editor__list-view-panel",
4302            onKeyDown: closeOnEscape,
4303            children: [
4304              /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "edit-widgets-editor__list-view-panel-header", children: [
4305                /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("strong", { children: (0, import_i18n17.__)("List View") }),
4306                /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4307                  import_components20.Button,
4308                  {
4309                    icon: close_small_default,
4310                    label: (0, import_i18n17.__)("Close"),
4311                    onClick: closeListView,
4312                    size: "compact"
4313                  }
4314                )
4315              ] }),
4316              /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4317                "div",
4318                {
4319                  className: "edit-widgets-editor__list-view-panel-content",
4320                  ref: (0, import_compose11.useMergeRefs)([focusOnMountRef, setDropZoneElement]),
4321                  children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_block_editor17.__experimentalListView, { dropZoneElement })
4322                }
4323              )
4324            ]
4325          }
4326        )
4327      );
4328    }
4329  
4330    // packages/edit-widgets/build-module/components/secondary-sidebar/index.mjs
4331    var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
4332    function SecondarySidebar() {
4333      const { isInserterOpen, isListViewOpen } = (0, import_data27.useSelect)((select) => {
4334        const { isInserterOpened: isInserterOpened2, isListViewOpened: isListViewOpened2 } = select(store2);
4335        return {
4336          isInserterOpen: isInserterOpened2(),
4337          isListViewOpen: isListViewOpened2()
4338        };
4339      }, []);
4340      if (isInserterOpen) {
4341        return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(InserterSidebar, {});
4342      }
4343      if (isListViewOpen) {
4344        return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ListViewSidebar, {});
4345      }
4346      return null;
4347    }
4348  
4349    // packages/edit-widgets/build-module/components/layout/interface.mjs
4350    var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
4351    var interfaceLabels = {
4352      /* translators: accessibility text for the widgets screen top bar landmark region. */
4353      header: (0, import_i18n18.__)("Widgets top bar"),
4354      /* translators: accessibility text for the widgets screen content landmark region. */
4355      body: (0, import_i18n18.__)("Widgets and blocks"),
4356      /* translators: accessibility text for the widgets screen settings landmark region. */
4357      sidebar: (0, import_i18n18.__)("Widgets settings"),
4358      /* translators: accessibility text for the widgets screen footer landmark region. */
4359      footer: (0, import_i18n18.__)("Widgets footer")
4360    };
4361    function Interface({ blockEditorSettings }) {
4362      const isMobileViewport = (0, import_compose12.useViewportMatch)("medium", "<");
4363      const isHugeViewport = (0, import_compose12.useViewportMatch)("huge", ">=");
4364      const { setIsInserterOpened: setIsInserterOpened2, setIsListViewOpened: setIsListViewOpened2, closeGeneralSidebar: closeGeneralSidebar2 } = (0, import_data28.useDispatch)(store2);
4365      const {
4366        hasBlockBreadCrumbsEnabled,
4367        hasSidebarEnabled,
4368        isInserterOpened: isInserterOpened2,
4369        isListViewOpened: isListViewOpened2
4370      } = (0, import_data28.useSelect)(
4371        (select) => ({
4372          hasSidebarEnabled: !!select(
4373            store
4374          ).getActiveComplementaryArea(store2.name),
4375          isInserterOpened: !!select(store2).isInserterOpened(),
4376          isListViewOpened: !!select(store2).isListViewOpened(),
4377          hasBlockBreadCrumbsEnabled: !!select(import_preferences8.store).get(
4378            "core/edit-widgets",
4379            "showBlockBreadcrumbs"
4380          )
4381        }),
4382        []
4383      );
4384      (0, import_element23.useEffect)(() => {
4385        if (hasSidebarEnabled && !isHugeViewport) {
4386          setIsInserterOpened2(false);
4387          setIsListViewOpened2(false);
4388        }
4389      }, [hasSidebarEnabled, isHugeViewport]);
4390      (0, import_element23.useEffect)(() => {
4391        if ((isInserterOpened2 || isListViewOpened2) && !isHugeViewport) {
4392          closeGeneralSidebar2();
4393        }
4394      }, [isInserterOpened2, isListViewOpened2, isHugeViewport]);
4395      const secondarySidebarLabel = isListViewOpened2 ? (0, import_i18n18.__)("List View") : (0, import_i18n18.__)("Block Library");
4396      const hasSecondarySidebar = isListViewOpened2 || isInserterOpened2;
4397      return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4398        interface_skeleton_default,
4399        {
4400          labels: {
4401            ...interfaceLabels,
4402            secondarySidebar: secondarySidebarLabel
4403          },
4404          header: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(header_default, {}),
4405          secondarySidebar: hasSecondarySidebar && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SecondarySidebar, {}),
4406          sidebar: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(complementary_area_default.Slot, { scope: "core/edit-widgets" }),
4407          content: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4408            WidgetAreasBlockEditorContent,
4409            {
4410              blockEditorSettings
4411            }
4412          ) }),
4413          footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "edit-widgets-layout__footer", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_block_editor18.BlockBreadcrumb, { rootLabelText: (0, import_i18n18.__)("Widgets") }) })
4414        }
4415      );
4416    }
4417    var interface_default = Interface;
4418  
4419    // packages/edit-widgets/build-module/components/layout/unsaved-changes-warning.mjs
4420    var import_i18n19 = __toESM(require_i18n(), 1);
4421    var import_element24 = __toESM(require_element(), 1);
4422    var import_data29 = __toESM(require_data(), 1);
4423    function UnsavedChangesWarning() {
4424      const isDirty = (0, import_data29.useSelect)((select) => {
4425        const { getEditedWidgetAreas: getEditedWidgetAreas2 } = select(store2);
4426        const editedWidgetAreas = getEditedWidgetAreas2();
4427        return editedWidgetAreas?.length > 0;
4428      }, []);
4429      (0, import_element24.useEffect)(() => {
4430        const warnIfUnsavedChanges = (event) => {
4431          if (isDirty) {
4432            event.returnValue = (0, import_i18n19.__)(
4433              "You have unsaved changes. If you proceed, they will be lost."
4434            );
4435            return event.returnValue;
4436          }
4437        };
4438        window.addEventListener("beforeunload", warnIfUnsavedChanges);
4439        return () => {
4440          window.removeEventListener("beforeunload", warnIfUnsavedChanges);
4441        };
4442      }, [isDirty]);
4443      return null;
4444    }
4445  
4446    // packages/edit-widgets/build-module/components/welcome-guide/index.mjs
4447    var import_data30 = __toESM(require_data(), 1);
4448    var import_components21 = __toESM(require_components(), 1);
4449    var import_i18n20 = __toESM(require_i18n(), 1);
4450    var import_element25 = __toESM(require_element(), 1);
4451    var import_preferences9 = __toESM(require_preferences(), 1);
4452    var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
4453    function WelcomeGuide() {
4454      const isActive = (0, import_data30.useSelect)(
4455        (select) => !!select(import_preferences9.store).get(
4456          "core/edit-widgets",
4457          "welcomeGuide"
4458        ),
4459        []
4460      );
4461      const { toggle } = (0, import_data30.useDispatch)(import_preferences9.store);
4462      const widgetAreas = (0, import_data30.useSelect)(
4463        (select) => select(store2).getWidgetAreas({ per_page: -1 }),
4464        []
4465      );
4466      if (!isActive) {
4467        return null;
4468      }
4469      const isEntirelyBlockWidgets = widgetAreas?.every(
4470        (widgetArea) => widgetArea.id === "wp_inactive_widgets" || widgetArea.widgets.every(
4471          (widgetId) => widgetId.startsWith("block-")
4472        )
4473      );
4474      const numWidgetAreas = widgetAreas?.filter(
4475        (widgetArea) => widgetArea.id !== "wp_inactive_widgets"
4476      ).length ?? 0;
4477      return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4478        import_components21.Guide,
4479        {
4480          className: "edit-widgets-welcome-guide",
4481          contentLabel: (0, import_i18n20.__)("Welcome to block Widgets"),
4482          finishButtonText: (0, import_i18n20.__)("Get started"),
4483          onFinish: () => toggle("core/edit-widgets", "welcomeGuide"),
4484          pages: [
4485            {
4486              image: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4487                WelcomeGuideImage,
4488                {
4489                  nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
4490                  animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
4491                }
4492              ),
4493              content: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
4494                /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n20.__)("Welcome to block Widgets") }),
4495                isEntirelyBlockWidgets ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_jsx_runtime45.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n20.sprintf)(
4496                  // Translators: %s: Number of block areas in the current theme.
4497                  (0, import_i18n20._n)(
4498                    "Your theme provides %s \u201Cblock\u201D area for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site.",
4499                    "Your theme provides %s different \u201Cblock\u201D areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site.",
4500                    numWidgetAreas
4501                  ),
4502                  numWidgetAreas
4503                ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
4504                  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n20.__)(
4505                    "You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly."
4506                  ) }),
4507                  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: "edit-widgets-welcome-guide__text", children: [
4508                    /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("strong", { children: (0, import_i18n20.__)(
4509                      "Want to stick with the old widgets?"
4510                    ) }),
4511                    " ",
4512                    /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4513                      import_components21.ExternalLink,
4514                      {
4515                        href: (0, import_i18n20.__)(
4516                          "https://wordpress.org/plugins/classic-widgets/"
4517                        ),
4518                        children: (0, import_i18n20.__)(
4519                          "Get the Classic Widgets plugin."
4520                        )
4521                      }
4522                    )
4523                  ] })
4524                ] })
4525              ] })
4526            },
4527            {
4528              image: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4529                WelcomeGuideImage,
4530                {
4531                  nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
4532                  animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
4533                }
4534              ),
4535              content: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
4536                /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n20.__)("Customize each block") }),
4537                /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n20.__)(
4538                  "Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected."
4539                ) })
4540              ] })
4541            },
4542            {
4543              image: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4544                WelcomeGuideImage,
4545                {
4546                  nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
4547                  animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
4548                }
4549              ),
4550              content: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
4551                /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n20.__)("Explore all blocks") }),
4552                /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_element25.createInterpolateElement)(
4553                  (0, import_i18n20.__)(
4554                    "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon."
4555                  ),
4556                  {
4557                    InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4558                      "img",
4559                      {
4560                        className: "edit-widgets-welcome-guide__inserter-icon",
4561                        alt: (0, import_i18n20.__)("inserter"),
4562                        src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"
4563                      }
4564                    )
4565                  }
4566                ) })
4567              ] })
4568            },
4569            {
4570              image: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4571                WelcomeGuideImage,
4572                {
4573                  nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
4574                  animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
4575                }
4576              ),
4577              content: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
4578                /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n20.__)("Learn more") }),
4579                /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_element25.createInterpolateElement)(
4580                  (0, import_i18n20.__)(
4581                    "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>"
4582                  ),
4583                  {
4584                    a: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4585                      import_components21.ExternalLink,
4586                      {
4587                        href: (0, import_i18n20.__)(
4588                          "https://wordpress.org/documentation/article/wordpress-block-editor/"
4589                        )
4590                      }
4591                    )
4592                  }
4593                ) })
4594              ] })
4595            }
4596          ]
4597        }
4598      );
4599    }
4600    function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) {
4601      return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("picture", { className: "edit-widgets-welcome-guide__image", children: [
4602        /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4603          "source",
4604          {
4605            srcSet: nonAnimatedSrc,
4606            media: "(prefers-reduced-motion: reduce)"
4607          }
4608        ),
4609        /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" })
4610      ] });
4611    }
4612  
4613    // packages/edit-widgets/build-module/components/layout/index.mjs
4614    var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
4615    function Layout({ blockEditorSettings }) {
4616      const { createErrorNotice } = (0, import_data31.useDispatch)(import_notices4.store);
4617      function onPluginAreaError(name2) {
4618        createErrorNotice(
4619          (0, import_i18n21.sprintf)(
4620            /* translators: %s: plugin name */
4621            (0, import_i18n21.__)(
4622              'The "%s" plugin has encountered an error and cannot be rendered.'
4623            ),
4624            name2
4625          )
4626        );
4627      }
4628      const navigateRegionsProps = (0, import_components22.__unstableUseNavigateRegions)();
4629      const adminPrimary = (0, import_element26.useMemo)(() => getAdminThemeColors().primary, []);
4630      return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_theme2.ThemeProvider, { isRoot: true, color: { primary: adminPrimary }, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { ...navigateRegionsProps, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
4631        WidgetAreasBlockEditorProvider,
4632        {
4633          blockEditorSettings,
4634          children: [
4635            /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4636              interface_default,
4637              {
4638                blockEditorSettings
4639              }
4640            ),
4641            /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Sidebar, {}),
4642            /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_plugins3.PluginArea, { onError: onPluginAreaError }),
4643            /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(UnsavedChangesWarning, {}),
4644            /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(WelcomeGuide, {})
4645          ]
4646        }
4647      ) }) }) });
4648    }
4649    var layout_default = Layout;
4650  
4651    // packages/edit-widgets/build-module/index.mjs
4652    var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
4653    var disabledBlocks = [
4654      "core/more",
4655      "core/freeform",
4656      "core/template-part",
4657      ...ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"]
4658    ];
4659    function initializeEditor(id, settings2) {
4660      const target = document.getElementById(id);
4661      const root = (0, import_element27.createRoot)(target);
4662      const coreBlocks = (0, import_block_library2.__experimentalGetCoreBlocks)().filter((block) => {
4663        return !(disabledBlocks.includes(block.name) || block.name.startsWith("core/post") || block.name.startsWith("core/query") || block.name.startsWith("core/site") || block.name.startsWith("core/navigation") || block.name.startsWith("core/term"));
4664      });
4665      (0, import_data32.dispatch)(import_preferences10.store).setDefaults("core/edit-widgets", {
4666        fixedToolbar: false,
4667        welcomeGuide: true,
4668        showBlockBreadcrumbs: true,
4669        themeStyles: true
4670      });
4671      (0, import_data32.dispatch)(import_blocks3.store).reapplyBlockTypeFilters();
4672      (0, import_block_library2.registerCoreBlocks)(coreBlocks);
4673      (0, import_widgets5.registerLegacyWidgetBlock)();
4674      if (false) {
4675        (0, import_block_library2.__experimentalRegisterExperimentalCoreBlocks)({
4676          enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS
4677        });
4678      }
4679      (0, import_widgets5.registerLegacyWidgetVariations)(settings2);
4680      registerBlock(widget_area_exports);
4681      (0, import_widgets5.registerWidgetGroupBlock)();
4682      settings2.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, import_core_data12.__experimentalFetchLinkSuggestions)(search, searchOptions, settings2);
4683      (0, import_blocks3.setFreeformContentHandlerName)("core/html");
4684      root.render(
4685        /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_element27.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(layout_default, { blockEditorSettings: settings2 }) })
4686      );
4687      return root;
4688    }
4689    var initialize = initializeEditor;
4690    function reinitializeEditor() {
4691      (0, import_deprecated6.default)("wp.editWidgets.reinitializeEditor", {
4692        since: "6.2",
4693        version: "6.3"
4694      });
4695    }
4696    var registerBlock = (block) => {
4697      if (!block) {
4698        return;
4699      }
4700      const { metadata, settings: settings2, name: name2 } = block;
4701      if (metadata) {
4702        (0, import_blocks3.unstable__bootstrapServerSideBlockDefinitions)({ [name2]: metadata });
4703      }
4704      (0, import_blocks3.registerBlockType)(name2, settings2);
4705    };
4706    return __toCommonJS(index_exports);
4707  })();
4708  (window.wp ||= {}).editWidgets = wp.editWidgets;
4709  })();


Generated : Sat Aug 8 08:20:21 2026 Cross-referenced by PHPXref