You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4670 lines
164 KiB

1 year ago
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 4403:
  4. /***/ (function(module, exports) {
  5. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  6. Copyright (c) 2018 Jed Watson.
  7. Licensed under the MIT License (MIT), see
  8. http://jedwatson.github.io/classnames
  9. */
  10. /* global define */
  11. (function () {
  12. 'use strict';
  13. var hasOwn = {}.hasOwnProperty;
  14. var nativeCodeString = '[native code]';
  15. function classNames() {
  16. var classes = [];
  17. for (var i = 0; i < arguments.length; i++) {
  18. var arg = arguments[i];
  19. if (!arg) continue;
  20. var argType = typeof arg;
  21. if (argType === 'string' || argType === 'number') {
  22. classes.push(arg);
  23. } else if (Array.isArray(arg)) {
  24. if (arg.length) {
  25. var inner = classNames.apply(null, arg);
  26. if (inner) {
  27. classes.push(inner);
  28. }
  29. }
  30. } else if (argType === 'object') {
  31. if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
  32. classes.push(arg.toString());
  33. continue;
  34. }
  35. for (var key in arg) {
  36. if (hasOwn.call(arg, key) && arg[key]) {
  37. classes.push(key);
  38. }
  39. }
  40. }
  41. }
  42. return classes.join(' ');
  43. }
  44. if ( true && module.exports) {
  45. classNames.default = classNames;
  46. module.exports = classNames;
  47. } else if (true) {
  48. // register as 'classnames', consistent with npm package name
  49. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  50. return classNames;
  51. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  52. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  53. } else {}
  54. }());
  55. /***/ })
  56. /******/ });
  57. /************************************************************************/
  58. /******/ // The module cache
  59. /******/ var __webpack_module_cache__ = {};
  60. /******/
  61. /******/ // The require function
  62. /******/ function __webpack_require__(moduleId) {
  63. /******/ // Check if module is in cache
  64. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  65. /******/ if (cachedModule !== undefined) {
  66. /******/ return cachedModule.exports;
  67. /******/ }
  68. /******/ // Create a new module (and put it into the cache)
  69. /******/ var module = __webpack_module_cache__[moduleId] = {
  70. /******/ // no module.id needed
  71. /******/ // no module.loaded needed
  72. /******/ exports: {}
  73. /******/ };
  74. /******/
  75. /******/ // Execute the module function
  76. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  77. /******/
  78. /******/ // Return the exports of the module
  79. /******/ return module.exports;
  80. /******/ }
  81. /******/
  82. /************************************************************************/
  83. /******/ /* webpack/runtime/compat get default export */
  84. /******/ !function() {
  85. /******/ // getDefaultExport function for compatibility with non-harmony modules
  86. /******/ __webpack_require__.n = function(module) {
  87. /******/ var getter = module && module.__esModule ?
  88. /******/ function() { return module['default']; } :
  89. /******/ function() { return module; };
  90. /******/ __webpack_require__.d(getter, { a: getter });
  91. /******/ return getter;
  92. /******/ };
  93. /******/ }();
  94. /******/
  95. /******/ /* webpack/runtime/define property getters */
  96. /******/ !function() {
  97. /******/ // define getter functions for harmony exports
  98. /******/ __webpack_require__.d = function(exports, definition) {
  99. /******/ for(var key in definition) {
  100. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  101. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  102. /******/ }
  103. /******/ }
  104. /******/ };
  105. /******/ }();
  106. /******/
  107. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  108. /******/ !function() {
  109. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  110. /******/ }();
  111. /******/
  112. /******/ /* webpack/runtime/make namespace object */
  113. /******/ !function() {
  114. /******/ // define __esModule on exports
  115. /******/ __webpack_require__.r = function(exports) {
  116. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  117. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  118. /******/ }
  119. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  120. /******/ };
  121. /******/ }();
  122. /******/
  123. /************************************************************************/
  124. var __webpack_exports__ = {};
  125. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  126. !function() {
  127. "use strict";
  128. // ESM COMPAT FLAG
  129. __webpack_require__.r(__webpack_exports__);
  130. // EXPORTS
  131. __webpack_require__.d(__webpack_exports__, {
  132. initialize: function() { return /* binding */ initialize; },
  133. initializeEditor: function() { return /* binding */ initializeEditor; },
  134. reinitializeEditor: function() { return /* binding */ reinitializeEditor; },
  135. store: function() { return /* reexport */ store_store; }
  136. });
  137. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
  138. var actions_namespaceObject = {};
  139. __webpack_require__.r(actions_namespaceObject);
  140. __webpack_require__.d(actions_namespaceObject, {
  141. closeModal: function() { return closeModal; },
  142. disableComplementaryArea: function() { return disableComplementaryArea; },
  143. enableComplementaryArea: function() { return enableComplementaryArea; },
  144. openModal: function() { return openModal; },
  145. pinItem: function() { return pinItem; },
  146. setDefaultComplementaryArea: function() { return setDefaultComplementaryArea; },
  147. setFeatureDefaults: function() { return setFeatureDefaults; },
  148. setFeatureValue: function() { return setFeatureValue; },
  149. toggleFeature: function() { return toggleFeature; },
  150. unpinItem: function() { return unpinItem; }
  151. });
  152. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  153. var selectors_namespaceObject = {};
  154. __webpack_require__.r(selectors_namespaceObject);
  155. __webpack_require__.d(selectors_namespaceObject, {
  156. getActiveComplementaryArea: function() { return getActiveComplementaryArea; },
  157. isComplementaryAreaLoading: function() { return isComplementaryAreaLoading; },
  158. isFeatureActive: function() { return isFeatureActive; },
  159. isItemPinned: function() { return isItemPinned; },
  160. isModalActive: function() { return isModalActive; }
  161. });
  162. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js
  163. var store_actions_namespaceObject = {};
  164. __webpack_require__.r(store_actions_namespaceObject);
  165. __webpack_require__.d(store_actions_namespaceObject, {
  166. closeGeneralSidebar: function() { return closeGeneralSidebar; },
  167. moveBlockToWidgetArea: function() { return moveBlockToWidgetArea; },
  168. persistStubPost: function() { return persistStubPost; },
  169. saveEditedWidgetAreas: function() { return saveEditedWidgetAreas; },
  170. saveWidgetArea: function() { return saveWidgetArea; },
  171. saveWidgetAreas: function() { return saveWidgetAreas; },
  172. setIsInserterOpened: function() { return setIsInserterOpened; },
  173. setIsListViewOpened: function() { return setIsListViewOpened; },
  174. setIsWidgetAreaOpen: function() { return setIsWidgetAreaOpen; },
  175. setWidgetAreasOpenState: function() { return setWidgetAreasOpenState; },
  176. setWidgetIdForClientId: function() { return setWidgetIdForClientId; }
  177. });
  178. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js
  179. var resolvers_namespaceObject = {};
  180. __webpack_require__.r(resolvers_namespaceObject);
  181. __webpack_require__.d(resolvers_namespaceObject, {
  182. getWidgetAreas: function() { return getWidgetAreas; },
  183. getWidgets: function() { return getWidgets; }
  184. });
  185. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js
  186. var store_selectors_namespaceObject = {};
  187. __webpack_require__.r(store_selectors_namespaceObject);
  188. __webpack_require__.d(store_selectors_namespaceObject, {
  189. __experimentalGetInsertionPoint: function() { return __experimentalGetInsertionPoint; },
  190. canInsertBlockInWidgetArea: function() { return canInsertBlockInWidgetArea; },
  191. getEditedWidgetAreas: function() { return getEditedWidgetAreas; },
  192. getIsWidgetAreaOpen: function() { return getIsWidgetAreaOpen; },
  193. getParentWidgetAreaBlock: function() { return getParentWidgetAreaBlock; },
  194. getReferenceWidgetBlocks: function() { return getReferenceWidgetBlocks; },
  195. getWidget: function() { return getWidget; },
  196. getWidgetAreaForWidgetId: function() { return getWidgetAreaForWidgetId; },
  197. getWidgetAreas: function() { return selectors_getWidgetAreas; },
  198. getWidgets: function() { return selectors_getWidgets; },
  199. isInserterOpened: function() { return isInserterOpened; },
  200. isListViewOpened: function() { return isListViewOpened; },
  201. isSavingWidgetAreas: function() { return isSavingWidgetAreas; }
  202. });
  203. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js
  204. var widget_area_namespaceObject = {};
  205. __webpack_require__.r(widget_area_namespaceObject);
  206. __webpack_require__.d(widget_area_namespaceObject, {
  207. metadata: function() { return metadata; },
  208. name: function() { return widget_area_name; },
  209. settings: function() { return settings; }
  210. });
  211. ;// CONCATENATED MODULE: external ["wp","element"]
  212. var external_wp_element_namespaceObject = window["wp"]["element"];
  213. ;// CONCATENATED MODULE: external ["wp","blocks"]
  214. var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
  215. ;// CONCATENATED MODULE: external ["wp","data"]
  216. var external_wp_data_namespaceObject = window["wp"]["data"];
  217. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  218. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  219. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  220. ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
  221. var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
  222. ;// CONCATENATED MODULE: external ["wp","coreData"]
  223. var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
  224. ;// CONCATENATED MODULE: external ["wp","widgets"]
  225. var external_wp_widgets_namespaceObject = window["wp"]["widgets"];
  226. ;// CONCATENATED MODULE: external ["wp","preferences"]
  227. var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
  228. ;// CONCATENATED MODULE: external ["wp","apiFetch"]
  229. var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
  230. var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
  231. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/reducer.js
  232. /**
  233. * WordPress dependencies
  234. */
  235. /**
  236. * Controls the open state of the widget areas.
  237. *
  238. * @param {Object} state Redux state.
  239. * @param {Object} action Redux action.
  240. *
  241. * @return {Array} Updated state.
  242. */
  243. function widgetAreasOpenState(state = {}, action) {
  244. const {
  245. type
  246. } = action;
  247. switch (type) {
  248. case 'SET_WIDGET_AREAS_OPEN_STATE':
  249. {
  250. return action.widgetAreasOpenState;
  251. }
  252. case 'SET_IS_WIDGET_AREA_OPEN':
  253. {
  254. const {
  255. clientId,
  256. isOpen
  257. } = action;
  258. return {
  259. ...state,
  260. [clientId]: isOpen
  261. };
  262. }
  263. default:
  264. {
  265. return state;
  266. }
  267. }
  268. }
  269. /**
  270. * Reducer to set the block inserter panel open or closed.
  271. *
  272. * Note: this reducer interacts with the list view panel reducer
  273. * to make sure that only one of the two panels is open at the same time.
  274. *
  275. * @param {Object} state Current state.
  276. * @param {Object} action Dispatched action.
  277. */
  278. function blockInserterPanel(state = false, action) {
  279. switch (action.type) {
  280. case 'SET_IS_LIST_VIEW_OPENED':
  281. return action.isOpen ? false : state;
  282. case 'SET_IS_INSERTER_OPENED':
  283. return action.value;
  284. }
  285. return state;
  286. }
  287. /**
  288. * Reducer to set the list view panel open or closed.
  289. *
  290. * Note: this reducer interacts with the inserter panel reducer
  291. * to make sure that only one of the two panels is open at the same time.
  292. *
  293. * @param {Object} state Current state.
  294. * @param {Object} action Dispatched action.
  295. */
  296. function listViewPanel(state = false, action) {
  297. switch (action.type) {
  298. case 'SET_IS_INSERTER_OPENED':
  299. return action.value ? false : state;
  300. case 'SET_IS_LIST_VIEW_OPENED':
  301. return action.isOpen;
  302. }
  303. return state;
  304. }
  305. /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  306. blockInserterPanel,
  307. listViewPanel,
  308. widgetAreasOpenState
  309. }));
  310. ;// CONCATENATED MODULE: external ["wp","i18n"]
  311. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  312. ;// CONCATENATED MODULE: external ["wp","notices"]
  313. var external_wp_notices_namespaceObject = window["wp"]["notices"];
  314. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  315. var classnames = __webpack_require__(4403);
  316. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  317. ;// CONCATENATED MODULE: external ["wp","components"]
  318. var external_wp_components_namespaceObject = window["wp"]["components"];
  319. ;// CONCATENATED MODULE: external ["wp","primitives"]
  320. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  321. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  322. /**
  323. * WordPress dependencies
  324. */
  325. const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  326. xmlns: "http://www.w3.org/2000/svg",
  327. viewBox: "0 0 24 24"
  328. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  329. d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  330. }));
  331. /* harmony default export */ var library_check = (check);
  332. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
  333. /**
  334. * WordPress dependencies
  335. */
  336. const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  337. xmlns: "http://www.w3.org/2000/svg",
  338. viewBox: "0 0 24 24"
  339. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  340. 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"
  341. }));
  342. /* harmony default export */ var star_filled = (starFilled);
  343. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
  344. /**
  345. * WordPress dependencies
  346. */
  347. const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  348. xmlns: "http://www.w3.org/2000/svg",
  349. viewBox: "0 0 24 24"
  350. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  351. fillRule: "evenodd",
  352. 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",
  353. clipRule: "evenodd"
  354. }));
  355. /* harmony default export */ var star_empty = (starEmpty);
  356. ;// CONCATENATED MODULE: external ["wp","viewport"]
  357. var external_wp_viewport_namespaceObject = window["wp"]["viewport"];
  358. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  359. /**
  360. * WordPress dependencies
  361. */
  362. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  363. xmlns: "http://www.w3.org/2000/svg",
  364. viewBox: "0 0 24 24"
  365. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  366. 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"
  367. }));
  368. /* harmony default export */ var close_small = (closeSmall);
  369. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
  370. /**
  371. * WordPress dependencies
  372. */
  373. /**
  374. * Set a default complementary area.
  375. *
  376. * @param {string} scope Complementary area scope.
  377. * @param {string} area Area identifier.
  378. *
  379. * @return {Object} Action object.
  380. */
  381. const setDefaultComplementaryArea = (scope, area) => ({
  382. type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
  383. scope,
  384. area
  385. });
  386. /**
  387. * Enable the complementary area.
  388. *
  389. * @param {string} scope Complementary area scope.
  390. * @param {string} area Area identifier.
  391. */
  392. const enableComplementaryArea = (scope, area) => ({
  393. registry,
  394. dispatch
  395. }) => {
  396. // Return early if there's no area.
  397. if (!area) {
  398. return;
  399. }
  400. const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  401. if (!isComplementaryAreaVisible) {
  402. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true);
  403. }
  404. dispatch({
  405. type: 'ENABLE_COMPLEMENTARY_AREA',
  406. scope,
  407. area
  408. });
  409. };
  410. /**
  411. * Disable the complementary area.
  412. *
  413. * @param {string} scope Complementary area scope.
  414. */
  415. const disableComplementaryArea = scope => ({
  416. registry
  417. }) => {
  418. const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  419. if (isComplementaryAreaVisible) {
  420. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false);
  421. }
  422. };
  423. /**
  424. * Pins an item.
  425. *
  426. * @param {string} scope Item scope.
  427. * @param {string} item Item identifier.
  428. *
  429. * @return {Object} Action object.
  430. */
  431. const pinItem = (scope, item) => ({
  432. registry
  433. }) => {
  434. // Return early if there's no item.
  435. if (!item) {
  436. return;
  437. }
  438. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  439. // The item is already pinned, there's nothing to do.
  440. if (pinnedItems?.[item] === true) {
  441. return;
  442. }
  443. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', {
  444. ...pinnedItems,
  445. [item]: true
  446. });
  447. };
  448. /**
  449. * Unpins an item.
  450. *
  451. * @param {string} scope Item scope.
  452. * @param {string} item Item identifier.
  453. */
  454. const unpinItem = (scope, item) => ({
  455. registry
  456. }) => {
  457. // Return early if there's no item.
  458. if (!item) {
  459. return;
  460. }
  461. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  462. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', {
  463. ...pinnedItems,
  464. [item]: false
  465. });
  466. };
  467. /**
  468. * Returns an action object used in signalling that a feature should be toggled.
  469. *
  470. * @param {string} scope The feature scope (e.g. core/edit-post).
  471. * @param {string} featureName The feature name.
  472. */
  473. function toggleFeature(scope, featureName) {
  474. return function ({
  475. registry
  476. }) {
  477. external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
  478. since: '6.0',
  479. alternative: `dispatch( 'core/preferences' ).toggle`
  480. });
  481. registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
  482. };
  483. }
  484. /**
  485. * Returns an action object used in signalling that a feature should be set to
  486. * a true or false value
  487. *
  488. * @param {string} scope The feature scope (e.g. core/edit-post).
  489. * @param {string} featureName The feature name.
  490. * @param {boolean} value The value to set.
  491. *
  492. * @return {Object} Action object.
  493. */
  494. function setFeatureValue(scope, featureName, value) {
  495. return function ({
  496. registry
  497. }) {
  498. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
  499. since: '6.0',
  500. alternative: `dispatch( 'core/preferences' ).set`
  501. });
  502. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
  503. };
  504. }
  505. /**
  506. * Returns an action object used in signalling that defaults should be set for features.
  507. *
  508. * @param {string} scope The feature scope (e.g. core/edit-post).
  509. * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
  510. *
  511. * @return {Object} Action object.
  512. */
  513. function setFeatureDefaults(scope, defaults) {
  514. return function ({
  515. registry
  516. }) {
  517. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
  518. since: '6.0',
  519. alternative: `dispatch( 'core/preferences' ).setDefaults`
  520. });
  521. registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
  522. };
  523. }
  524. /**
  525. * Returns an action object used in signalling that the user opened a modal.
  526. *
  527. * @param {string} name A string that uniquely identifies the modal.
  528. *
  529. * @return {Object} Action object.
  530. */
  531. function openModal(name) {
  532. return {
  533. type: 'OPEN_MODAL',
  534. name
  535. };
  536. }
  537. /**
  538. * Returns an action object signalling that the user closed a modal.
  539. *
  540. * @return {Object} Action object.
  541. */
  542. function closeModal() {
  543. return {
  544. type: 'CLOSE_MODAL'
  545. };
  546. }
  547. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  548. /**
  549. * WordPress dependencies
  550. */
  551. /**
  552. * Returns the complementary area that is active in a given scope.
  553. *
  554. * @param {Object} state Global application state.
  555. * @param {string} scope Item scope.
  556. *
  557. * @return {string | null | undefined} The complementary area that is active in the given scope.
  558. */
  559. const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
  560. const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  561. // Return `undefined` to indicate that the user has never toggled
  562. // visibility, this is the vanilla default. Other code relies on this
  563. // nuance in the return value.
  564. if (isComplementaryAreaVisible === undefined) {
  565. return undefined;
  566. }
  567. // Return `null` to indicate the user hid the complementary area.
  568. if (isComplementaryAreaVisible === false) {
  569. return null;
  570. }
  571. return state?.complementaryAreas?.[scope];
  572. });
  573. const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
  574. const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  575. const identifier = state?.complementaryAreas?.[scope];
  576. return isVisible && identifier === undefined;
  577. });
  578. /**
  579. * Returns a boolean indicating if an item is pinned or not.
  580. *
  581. * @param {Object} state Global application state.
  582. * @param {string} scope Scope.
  583. * @param {string} item Item to check.
  584. *
  585. * @return {boolean} True if the item is pinned and false otherwise.
  586. */
  587. const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
  588. var _pinnedItems$item;
  589. const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  590. return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
  591. });
  592. /**
  593. * Returns a boolean indicating whether a feature is active for a particular
  594. * scope.
  595. *
  596. * @param {Object} state The store state.
  597. * @param {string} scope The scope of the feature (e.g. core/edit-post).
  598. * @param {string} featureName The name of the feature.
  599. *
  600. * @return {boolean} Is the feature enabled?
  601. */
  602. const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
  603. external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
  604. since: '6.0',
  605. alternative: `select( 'core/preferences' ).get( scope, featureName )`
  606. });
  607. return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
  608. });
  609. /**
  610. * Returns true if a modal is active, or false otherwise.
  611. *
  612. * @param {Object} state Global application state.
  613. * @param {string} modalName A string that uniquely identifies the modal.
  614. *
  615. * @return {boolean} Whether the modal is active.
  616. */
  617. function isModalActive(state, modalName) {
  618. return state.activeModal === modalName;
  619. }
  620. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js
  621. /**
  622. * WordPress dependencies
  623. */
  624. function complementaryAreas(state = {}, action) {
  625. switch (action.type) {
  626. case 'SET_DEFAULT_COMPLEMENTARY_AREA':
  627. {
  628. const {
  629. scope,
  630. area
  631. } = action;
  632. // If there's already an area, don't overwrite it.
  633. if (state[scope]) {
  634. return state;
  635. }
  636. return {
  637. ...state,
  638. [scope]: area
  639. };
  640. }
  641. case 'ENABLE_COMPLEMENTARY_AREA':
  642. {
  643. const {
  644. scope,
  645. area
  646. } = action;
  647. return {
  648. ...state,
  649. [scope]: area
  650. };
  651. }
  652. }
  653. return state;
  654. }
  655. /**
  656. * Reducer for storing the name of the open modal, or null if no modal is open.
  657. *
  658. * @param {Object} state Previous state.
  659. * @param {Object} action Action object containing the `name` of the modal
  660. *
  661. * @return {Object} Updated state
  662. */
  663. function activeModal(state = null, action) {
  664. switch (action.type) {
  665. case 'OPEN_MODAL':
  666. return action.name;
  667. case 'CLOSE_MODAL':
  668. return null;
  669. }
  670. return state;
  671. }
  672. /* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  673. complementaryAreas,
  674. activeModal
  675. }));
  676. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
  677. /**
  678. * The identifier for the data store.
  679. *
  680. * @type {string}
  681. */
  682. const STORE_NAME = 'core/interface';
  683. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
  684. /**
  685. * WordPress dependencies
  686. */
  687. /**
  688. * Internal dependencies
  689. */
  690. /**
  691. * Store definition for the interface namespace.
  692. *
  693. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  694. *
  695. * @type {Object}
  696. */
  697. const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
  698. reducer: store_reducer,
  699. actions: actions_namespaceObject,
  700. selectors: selectors_namespaceObject
  701. });
  702. // Once we build a more generic persistence plugin that works across types of stores
  703. // we'd be able to replace this with a register call.
  704. (0,external_wp_data_namespaceObject.register)(store);
  705. ;// CONCATENATED MODULE: external ["wp","plugins"]
  706. var external_wp_plugins_namespaceObject = window["wp"]["plugins"];
  707. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
  708. /**
  709. * WordPress dependencies
  710. */
  711. /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  712. return {
  713. icon: ownProps.icon || context.icon,
  714. identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
  715. };
  716. }));
  717. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
  718. /**
  719. * WordPress dependencies
  720. */
  721. /**
  722. * Internal dependencies
  723. */
  724. function ComplementaryAreaToggle({
  725. as = external_wp_components_namespaceObject.Button,
  726. scope,
  727. identifier,
  728. icon,
  729. selectedIcon,
  730. name,
  731. ...props
  732. }) {
  733. const ComponentToUse = as;
  734. const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]);
  735. const {
  736. enableComplementaryArea,
  737. disableComplementaryArea
  738. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  739. return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, {
  740. icon: selectedIcon && isSelected ? selectedIcon : icon,
  741. "aria-controls": identifier.replace('/', ':'),
  742. onClick: () => {
  743. if (isSelected) {
  744. disableComplementaryArea(scope);
  745. } else {
  746. enableComplementaryArea(scope, identifier);
  747. }
  748. },
  749. ...props
  750. });
  751. }
  752. /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
  753. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
  754. /**
  755. * External dependencies
  756. */
  757. /**
  758. * WordPress dependencies
  759. */
  760. /**
  761. * Internal dependencies
  762. */
  763. const ComplementaryAreaHeader = ({
  764. smallScreenTitle,
  765. children,
  766. className,
  767. toggleButtonProps
  768. }) => {
  769. const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
  770. icon: close_small,
  771. ...toggleButtonProps
  772. });
  773. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  774. className: "components-panel__header interface-complementary-area-header__small"
  775. }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", {
  776. className: "interface-complementary-area-header__small-title"
  777. }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", {
  778. className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
  779. tabIndex: -1
  780. }, children, toggleButton));
  781. };
  782. /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
  783. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
  784. /**
  785. * WordPress dependencies
  786. */
  787. const noop = () => {};
  788. function ActionItemSlot({
  789. name,
  790. as: Component = external_wp_components_namespaceObject.ButtonGroup,
  791. fillProps = {},
  792. bubblesVirtually,
  793. ...props
  794. }) {
  795. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
  796. name: name,
  797. bubblesVirtually: bubblesVirtually,
  798. fillProps: fillProps
  799. }, fills => {
  800. if (!external_wp_element_namespaceObject.Children.toArray(fills).length) {
  801. return null;
  802. }
  803. // Special handling exists for backward compatibility.
  804. // It ensures that menu items created by plugin authors aren't
  805. // duplicated with automatically injected menu items coming
  806. // from pinnable plugin sidebars.
  807. // @see https://github.com/WordPress/gutenberg/issues/14457
  808. const initializedByPlugins = [];
  809. external_wp_element_namespaceObject.Children.forEach(fills, ({
  810. props: {
  811. __unstableExplicitMenuItem,
  812. __unstableTarget
  813. }
  814. }) => {
  815. if (__unstableTarget && __unstableExplicitMenuItem) {
  816. initializedByPlugins.push(__unstableTarget);
  817. }
  818. });
  819. const children = external_wp_element_namespaceObject.Children.map(fills, child => {
  820. if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
  821. return null;
  822. }
  823. return child;
  824. });
  825. return (0,external_wp_element_namespaceObject.createElement)(Component, {
  826. ...props
  827. }, children);
  828. });
  829. }
  830. function ActionItem({
  831. name,
  832. as: Component = external_wp_components_namespaceObject.Button,
  833. onClick,
  834. ...props
  835. }) {
  836. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  837. name: name
  838. }, ({
  839. onClick: fpOnClick
  840. }) => {
  841. return (0,external_wp_element_namespaceObject.createElement)(Component, {
  842. onClick: onClick || fpOnClick ? (...args) => {
  843. (onClick || noop)(...args);
  844. (fpOnClick || noop)(...args);
  845. } : undefined,
  846. ...props
  847. });
  848. });
  849. }
  850. ActionItem.Slot = ActionItemSlot;
  851. /* harmony default export */ var action_item = (ActionItem);
  852. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
  853. /**
  854. * WordPress dependencies
  855. */
  856. /**
  857. * Internal dependencies
  858. */
  859. const PluginsMenuItem = ({
  860. // Menu item is marked with unstable prop for backward compatibility.
  861. // They are removed so they don't leak to DOM elements.
  862. // @see https://github.com/WordPress/gutenberg/issues/14457
  863. __unstableExplicitMenuItem,
  864. __unstableTarget,
  865. ...restProps
  866. }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  867. ...restProps
  868. });
  869. function ComplementaryAreaMoreMenuItem({
  870. scope,
  871. target,
  872. __unstableExplicitMenuItem,
  873. ...props
  874. }) {
  875. return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
  876. as: toggleProps => {
  877. return (0,external_wp_element_namespaceObject.createElement)(action_item, {
  878. __unstableExplicitMenuItem: __unstableExplicitMenuItem,
  879. __unstableTarget: `${scope}/${target}`,
  880. as: PluginsMenuItem,
  881. name: `${scope}/plugin-more-menu`,
  882. ...toggleProps
  883. });
  884. },
  885. role: "menuitemcheckbox",
  886. selectedIcon: library_check,
  887. name: target,
  888. scope: scope,
  889. ...props
  890. });
  891. }
  892. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
  893. /**
  894. * External dependencies
  895. */
  896. /**
  897. * WordPress dependencies
  898. */
  899. function PinnedItems({
  900. scope,
  901. ...props
  902. }) {
  903. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  904. name: `PinnedItems/${scope}`,
  905. ...props
  906. });
  907. }
  908. function PinnedItemsSlot({
  909. scope,
  910. className,
  911. ...props
  912. }) {
  913. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
  914. name: `PinnedItems/${scope}`,
  915. ...props
  916. }, fills => fills?.length > 0 && (0,external_wp_element_namespaceObject.createElement)("div", {
  917. className: classnames_default()(className, 'interface-pinned-items')
  918. }, fills));
  919. }
  920. PinnedItems.Slot = PinnedItemsSlot;
  921. /* harmony default export */ var pinned_items = (PinnedItems);
  922. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
  923. /**
  924. * External dependencies
  925. */
  926. /**
  927. * WordPress dependencies
  928. */
  929. /**
  930. * Internal dependencies
  931. */
  932. function ComplementaryAreaSlot({
  933. scope,
  934. ...props
  935. }) {
  936. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
  937. name: `ComplementaryArea/${scope}`,
  938. ...props
  939. });
  940. }
  941. function ComplementaryAreaFill({
  942. scope,
  943. children,
  944. className,
  945. id
  946. }) {
  947. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  948. name: `ComplementaryArea/${scope}`
  949. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  950. id: id,
  951. className: className
  952. }, children));
  953. }
  954. function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
  955. const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  956. const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  957. const {
  958. enableComplementaryArea,
  959. disableComplementaryArea
  960. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  961. (0,external_wp_element_namespaceObject.useEffect)(() => {
  962. // If the complementary area is active and the editor is switching from
  963. // a big to a small window size.
  964. if (isActive && isSmall && !previousIsSmall.current) {
  965. disableComplementaryArea(scope);
  966. // Flag the complementary area to be reopened when the window size
  967. // goes from small to big.
  968. shouldOpenWhenNotSmall.current = true;
  969. } else if (
  970. // If there is a flag indicating the complementary area should be
  971. // enabled when we go from small to big window size and we are going
  972. // from a small to big window size.
  973. shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
  974. // Remove the flag indicating the complementary area should be
  975. // enabled.
  976. shouldOpenWhenNotSmall.current = false;
  977. enableComplementaryArea(scope, identifier);
  978. } else if (
  979. // If the flag is indicating the current complementary should be
  980. // reopened but another complementary area becomes active, remove
  981. // the flag.
  982. shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
  983. shouldOpenWhenNotSmall.current = false;
  984. }
  985. if (isSmall !== previousIsSmall.current) {
  986. previousIsSmall.current = isSmall;
  987. }
  988. }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]);
  989. }
  990. function ComplementaryArea({
  991. children,
  992. className,
  993. closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
  994. identifier,
  995. header,
  996. headerClassName,
  997. icon,
  998. isPinnable = true,
  999. panelClassName,
  1000. scope,
  1001. name,
  1002. smallScreenTitle,
  1003. title,
  1004. toggleShortcut,
  1005. isActiveByDefault,
  1006. showIconLabels = false
  1007. }) {
  1008. const {
  1009. isLoading,
  1010. isActive,
  1011. isPinned,
  1012. activeArea,
  1013. isSmall,
  1014. isLarge
  1015. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  1016. const {
  1017. getActiveComplementaryArea,
  1018. isComplementaryAreaLoading,
  1019. isItemPinned
  1020. } = select(store);
  1021. const _activeArea = getActiveComplementaryArea(scope);
  1022. return {
  1023. isLoading: isComplementaryAreaLoading(scope),
  1024. isActive: _activeArea === identifier,
  1025. isPinned: isItemPinned(scope, identifier),
  1026. activeArea: _activeArea,
  1027. isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
  1028. isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large')
  1029. };
  1030. }, [identifier, scope]);
  1031. useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
  1032. const {
  1033. enableComplementaryArea,
  1034. disableComplementaryArea,
  1035. pinItem,
  1036. unpinItem
  1037. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1038. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1039. // Set initial visibility: For large screens, enable if it's active by
  1040. // default. For small screens, always initially disable.
  1041. if (isActiveByDefault && activeArea === undefined && !isSmall) {
  1042. enableComplementaryArea(scope, identifier);
  1043. } else if (activeArea === undefined && isSmall) {
  1044. disableComplementaryArea(scope, identifier);
  1045. }
  1046. }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]);
  1047. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, {
  1048. scope: scope
  1049. }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
  1050. scope: scope,
  1051. identifier: identifier,
  1052. isPressed: isActive && (!showIconLabels || isLarge),
  1053. "aria-expanded": isActive,
  1054. "aria-disabled": isLoading,
  1055. label: title,
  1056. icon: showIconLabels ? library_check : icon,
  1057. showTooltip: !showIconLabels,
  1058. variant: showIconLabels ? 'tertiary' : undefined
  1059. })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
  1060. target: name,
  1061. scope: scope,
  1062. icon: icon
  1063. }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, {
  1064. className: classnames_default()('interface-complementary-area', className),
  1065. scope: scope,
  1066. id: identifier.replace('/', ':')
  1067. }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, {
  1068. className: headerClassName,
  1069. closeLabel: closeLabel,
  1070. onClose: () => disableComplementaryArea(scope),
  1071. smallScreenTitle: smallScreenTitle,
  1072. toggleButtonProps: {
  1073. label: closeLabel,
  1074. shortcut: toggleShortcut,
  1075. scope,
  1076. identifier
  1077. }
  1078. }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  1079. className: "interface-complementary-area__pin-unpin-item",
  1080. icon: isPinned ? star_filled : star_empty,
  1081. label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
  1082. onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
  1083. isPressed: isPinned,
  1084. "aria-expanded": isPinned
  1085. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
  1086. className: panelClassName
  1087. }, children)));
  1088. }
  1089. const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
  1090. ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
  1091. /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
  1092. ;// CONCATENATED MODULE: external ["wp","compose"]
  1093. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  1094. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js
  1095. /**
  1096. * External dependencies
  1097. */
  1098. function NavigableRegion({
  1099. children,
  1100. className,
  1101. ariaLabel,
  1102. as: Tag = 'div',
  1103. ...props
  1104. }) {
  1105. return (0,external_wp_element_namespaceObject.createElement)(Tag, {
  1106. className: classnames_default()('interface-navigable-region', className),
  1107. "aria-label": ariaLabel,
  1108. role: "region",
  1109. tabIndex: "-1",
  1110. ...props
  1111. }, children);
  1112. }
  1113. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
  1114. /**
  1115. * External dependencies
  1116. */
  1117. /**
  1118. * WordPress dependencies
  1119. */
  1120. /**
  1121. * Internal dependencies
  1122. */
  1123. function useHTMLClass(className) {
  1124. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1125. const element = document && document.querySelector(`html:not(.${className})`);
  1126. if (!element) {
  1127. return;
  1128. }
  1129. element.classList.toggle(className);
  1130. return () => {
  1131. element.classList.toggle(className);
  1132. };
  1133. }, [className]);
  1134. }
  1135. const headerVariants = {
  1136. hidden: {
  1137. opacity: 0
  1138. },
  1139. hover: {
  1140. opacity: 1,
  1141. transition: {
  1142. type: 'tween',
  1143. delay: 0.2,
  1144. delayChildren: 0.2
  1145. }
  1146. },
  1147. distractionFreeInactive: {
  1148. opacity: 1,
  1149. transition: {
  1150. delay: 0
  1151. }
  1152. }
  1153. };
  1154. function InterfaceSkeleton({
  1155. isDistractionFree,
  1156. footer,
  1157. header,
  1158. editorNotices,
  1159. sidebar,
  1160. secondarySidebar,
  1161. notices,
  1162. content,
  1163. contentProps,
  1164. actions,
  1165. labels,
  1166. className,
  1167. enableRegionNavigation = true,
  1168. // Todo: does this need to be a prop.
  1169. // Can we use a dependency to keyboard-shortcuts directly?
  1170. shortcuts
  1171. }, ref) {
  1172. const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
  1173. useHTMLClass('interface-interface-skeleton__html-container');
  1174. const defaultLabels = {
  1175. /* translators: accessibility text for the top bar landmark region. */
  1176. header: (0,external_wp_i18n_namespaceObject.__)('Header'),
  1177. /* translators: accessibility text for the content landmark region. */
  1178. body: (0,external_wp_i18n_namespaceObject.__)('Content'),
  1179. /* translators: accessibility text for the secondary sidebar landmark region. */
  1180. secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
  1181. /* translators: accessibility text for the settings landmark region. */
  1182. sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  1183. /* translators: accessibility text for the publish landmark region. */
  1184. actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
  1185. /* translators: accessibility text for the footer landmark region. */
  1186. footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
  1187. };
  1188. const mergedLabels = {
  1189. ...defaultLabels,
  1190. ...labels
  1191. };
  1192. return (0,external_wp_element_namespaceObject.createElement)("div", {
  1193. ...(enableRegionNavigation ? navigateRegionsProps : {}),
  1194. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]),
  1195. className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
  1196. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  1197. className: "interface-interface-skeleton__editor"
  1198. }, !!header && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, {
  1199. as: external_wp_components_namespaceObject.__unstableMotion.div,
  1200. className: "interface-interface-skeleton__header",
  1201. "aria-label": mergedLabels.header,
  1202. initial: isDistractionFree ? 'hidden' : 'distractionFreeInactive',
  1203. whileHover: isDistractionFree ? 'hover' : 'distractionFreeInactive',
  1204. animate: isDistractionFree ? 'hidden' : 'distractionFreeInactive',
  1205. variants: headerVariants,
  1206. transition: isDistractionFree ? {
  1207. type: 'tween',
  1208. delay: 0.8
  1209. } : undefined
  1210. }, header), isDistractionFree && (0,external_wp_element_namespaceObject.createElement)("div", {
  1211. className: "interface-interface-skeleton__header"
  1212. }, editorNotices), (0,external_wp_element_namespaceObject.createElement)("div", {
  1213. className: "interface-interface-skeleton__body"
  1214. }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, {
  1215. className: "interface-interface-skeleton__secondary-sidebar",
  1216. ariaLabel: mergedLabels.secondarySidebar
  1217. }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", {
  1218. className: "interface-interface-skeleton__notices"
  1219. }, notices), (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, {
  1220. className: "interface-interface-skeleton__content",
  1221. ariaLabel: mergedLabels.body,
  1222. ...contentProps
  1223. }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, {
  1224. className: "interface-interface-skeleton__sidebar",
  1225. ariaLabel: mergedLabels.sidebar
  1226. }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, {
  1227. className: "interface-interface-skeleton__actions",
  1228. ariaLabel: mergedLabels.actions
  1229. }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, {
  1230. className: "interface-interface-skeleton__footer",
  1231. ariaLabel: mergedLabels.footer
  1232. }, footer));
  1233. }
  1234. /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
  1235. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
  1236. /**
  1237. * WordPress dependencies
  1238. */
  1239. const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1240. xmlns: "http://www.w3.org/2000/svg",
  1241. viewBox: "0 0 24 24"
  1242. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1243. d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
  1244. }));
  1245. /* harmony default export */ var more_vertical = (moreVertical);
  1246. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js
  1247. /**
  1248. * External dependencies
  1249. */
  1250. /**
  1251. * WordPress dependencies
  1252. */
  1253. function MoreMenuDropdown({
  1254. as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
  1255. className,
  1256. /* translators: button label text should, if possible, be under 16 characters. */
  1257. label = (0,external_wp_i18n_namespaceObject.__)('Options'),
  1258. popoverProps,
  1259. toggleProps,
  1260. children
  1261. }) {
  1262. return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
  1263. className: classnames_default()('interface-more-menu-dropdown', className),
  1264. icon: more_vertical,
  1265. label: label,
  1266. popoverProps: {
  1267. placement: 'bottom-end',
  1268. ...popoverProps,
  1269. className: classnames_default()('interface-more-menu-dropdown__content', popoverProps?.className)
  1270. },
  1271. toggleProps: {
  1272. tooltipPosition: 'bottom',
  1273. ...toggleProps
  1274. }
  1275. }, onClose => children(onClose));
  1276. }
  1277. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
  1278. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
  1279. ;// CONCATENATED MODULE: external ["wp","blockEditor"]
  1280. var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  1281. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/transformers.js
  1282. /**
  1283. * WordPress dependencies
  1284. */
  1285. /**
  1286. * Converts a widget entity record into a block.
  1287. *
  1288. * @param {Object} widget The widget entity record.
  1289. * @return {Object} a block (converted from the entity record).
  1290. */
  1291. function transformWidgetToBlock(widget) {
  1292. if (widget.id_base === 'block') {
  1293. const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)(widget.instance.raw.content, {
  1294. __unstableSkipAutop: true
  1295. });
  1296. if (!parsedBlocks.length) {
  1297. return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {}, []), widget.id);
  1298. }
  1299. return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)(parsedBlocks[0], widget.id);
  1300. }
  1301. let attributes;
  1302. if (widget._embedded.about[0].is_multi) {
  1303. attributes = {
  1304. idBase: widget.id_base,
  1305. instance: widget.instance
  1306. };
  1307. } else {
  1308. attributes = {
  1309. id: widget.id
  1310. };
  1311. }
  1312. return (0,external_wp_widgets_namespaceObject.addWidgetIdToBlock)((0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', attributes, []), widget.id);
  1313. }
  1314. /**
  1315. * Converts a block to a widget entity record.
  1316. *
  1317. * @param {Object} block The block.
  1318. * @param {Object?} relatedWidget A related widget entity record from the API (optional).
  1319. * @return {Object} the widget object (converted from block).
  1320. */
  1321. function transformBlockToWidget(block, relatedWidget = {}) {
  1322. let widget;
  1323. const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance);
  1324. if (isValidLegacyWidgetBlock) {
  1325. var _block$attributes$id, _block$attributes$idB, _block$attributes$ins;
  1326. widget = {
  1327. ...relatedWidget,
  1328. id: (_block$attributes$id = block.attributes.id) !== null && _block$attributes$id !== void 0 ? _block$attributes$id : relatedWidget.id,
  1329. id_base: (_block$attributes$idB = block.attributes.idBase) !== null && _block$attributes$idB !== void 0 ? _block$attributes$idB : relatedWidget.id_base,
  1330. instance: (_block$attributes$ins = block.attributes.instance) !== null && _block$attributes$ins !== void 0 ? _block$attributes$ins : relatedWidget.instance
  1331. };
  1332. } else {
  1333. widget = {
  1334. ...relatedWidget,
  1335. id_base: 'block',
  1336. instance: {
  1337. raw: {
  1338. content: (0,external_wp_blocks_namespaceObject.serialize)(block)
  1339. }
  1340. }
  1341. };
  1342. }
  1343. // Delete read-only properties.
  1344. delete widget.rendered;
  1345. delete widget.rendered_form;
  1346. return widget;
  1347. }
  1348. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/utils.js
  1349. /**
  1350. * "Kind" of the navigation post.
  1351. *
  1352. * @type {string}
  1353. */
  1354. const KIND = 'root';
  1355. /**
  1356. * "post type" of the navigation post.
  1357. *
  1358. * @type {string}
  1359. */
  1360. const WIDGET_AREA_ENTITY_TYPE = 'sidebar';
  1361. /**
  1362. * "post type" of the widget area post.
  1363. *
  1364. * @type {string}
  1365. */
  1366. const POST_TYPE = 'postType';
  1367. /**
  1368. * Builds an ID for a new widget area post.
  1369. *
  1370. * @param {number} widgetAreaId Widget area id.
  1371. * @return {string} An ID.
  1372. */
  1373. const buildWidgetAreaPostId = widgetAreaId => `widget-area-${widgetAreaId}`;
  1374. /**
  1375. * Builds an ID for a global widget areas post.
  1376. *
  1377. * @return {string} An ID.
  1378. */
  1379. const buildWidgetAreasPostId = () => `widget-areas`;
  1380. /**
  1381. * Builds a query to resolve sidebars.
  1382. *
  1383. * @return {Object} Query.
  1384. */
  1385. function buildWidgetAreasQuery() {
  1386. return {
  1387. per_page: -1
  1388. };
  1389. }
  1390. /**
  1391. * Builds a query to resolve widgets.
  1392. *
  1393. * @return {Object} Query.
  1394. */
  1395. function buildWidgetsQuery() {
  1396. return {
  1397. per_page: -1,
  1398. _embed: 'about'
  1399. };
  1400. }
  1401. /**
  1402. * Creates a stub post with given id and set of blocks. Used as a governing entity records
  1403. * for all widget areas.
  1404. *
  1405. * @param {string} id Post ID.
  1406. * @param {Array} blocks The list of blocks.
  1407. * @return {Object} A stub post object formatted in compliance with the data layer.
  1408. */
  1409. const createStubPost = (id, blocks) => ({
  1410. id,
  1411. slug: id,
  1412. status: 'draft',
  1413. type: 'page',
  1414. blocks,
  1415. meta: {
  1416. widgetAreaId: id
  1417. }
  1418. });
  1419. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/constants.js
  1420. /**
  1421. * Module Constants
  1422. */
  1423. const constants_STORE_NAME = 'core/edit-widgets';
  1424. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js
  1425. /**
  1426. * WordPress dependencies
  1427. */
  1428. /**
  1429. * Internal dependencies
  1430. */
  1431. /**
  1432. * Persists a stub post with given ID to core data store. The post is meant to be in-memory only and
  1433. * shouldn't be saved via the API.
  1434. *
  1435. * @param {string} id Post ID.
  1436. * @param {Array} blocks Blocks the post should consist of.
  1437. * @return {Object} The post object.
  1438. */
  1439. const persistStubPost = (id, blocks) => ({
  1440. registry
  1441. }) => {
  1442. const stubPost = createStubPost(id, blocks);
  1443. registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, stubPost, {
  1444. id: stubPost.id
  1445. }, false);
  1446. return stubPost;
  1447. };
  1448. /**
  1449. * Converts all the blocks from edited widget areas into widgets,
  1450. * and submits a batch request to save everything at once.
  1451. *
  1452. * Creates a snackbar notice on either success or error.
  1453. *
  1454. * @return {Function} An action creator.
  1455. */
  1456. const saveEditedWidgetAreas = () => async ({
  1457. select,
  1458. dispatch,
  1459. registry
  1460. }) => {
  1461. const editedWidgetAreas = select.getEditedWidgetAreas();
  1462. if (!editedWidgetAreas?.length) {
  1463. return;
  1464. }
  1465. try {
  1466. await dispatch.saveWidgetAreas(editedWidgetAreas);
  1467. registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Widgets saved.'), {
  1468. type: 'snackbar'
  1469. });
  1470. } catch (e) {
  1471. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice( /* translators: %s: The error message. */
  1472. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('There was an error. %s'), e.message), {
  1473. type: 'snackbar'
  1474. });
  1475. }
  1476. };
  1477. /**
  1478. * Converts all the blocks from specified widget areas into widgets,
  1479. * and submits a batch request to save everything at once.
  1480. *
  1481. * @param {Object[]} widgetAreas Widget areas to save.
  1482. * @return {Function} An action creator.
  1483. */
  1484. const saveWidgetAreas = widgetAreas => async ({
  1485. dispatch,
  1486. registry
  1487. }) => {
  1488. try {
  1489. for (const widgetArea of widgetAreas) {
  1490. await dispatch.saveWidgetArea(widgetArea.id);
  1491. }
  1492. } finally {
  1493. // saveEditedEntityRecord resets the resolution status, let's fix it manually.
  1494. await registry.dispatch(external_wp_coreData_namespaceObject.store).finishResolution('getEntityRecord', KIND, WIDGET_AREA_ENTITY_TYPE, buildWidgetAreasQuery());
  1495. }
  1496. };
  1497. /**
  1498. * Converts all the blocks from a widget area specified by ID into widgets,
  1499. * and submits a batch request to save everything at once.
  1500. *
  1501. * @param {string} widgetAreaId ID of the widget area to process.
  1502. * @return {Function} An action creator.
  1503. */
  1504. const saveWidgetArea = widgetAreaId => async ({
  1505. dispatch,
  1506. select,
  1507. registry
  1508. }) => {
  1509. const widgets = select.getWidgets();
  1510. const post = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetAreaId));
  1511. // Get all widgets from this area
  1512. const areaWidgets = Object.values(widgets).filter(({
  1513. sidebar
  1514. }) => sidebar === widgetAreaId);
  1515. // Remove all duplicate reference widget instances for legacy widgets.
  1516. // Why? We filter out the widgets with duplicate IDs to prevent adding more than one instance of a widget
  1517. // implemented using a function. WordPress doesn't support having more than one instance of these, if you try to
  1518. // save multiple instances of these in different sidebars you will run into undefined behaviors.
  1519. const usedReferenceWidgets = [];
  1520. const widgetsBlocks = post.blocks.filter(block => {
  1521. const {
  1522. id
  1523. } = block.attributes;
  1524. if (block.name === 'core/legacy-widget' && id) {
  1525. if (usedReferenceWidgets.includes(id)) {
  1526. return false;
  1527. }
  1528. usedReferenceWidgets.push(id);
  1529. }
  1530. return true;
  1531. });
  1532. // Determine which widgets have been deleted. We can tell if a widget is
  1533. // deleted and not just moved to a different area by looking to see if
  1534. // getWidgetAreaForWidgetId() finds something.
  1535. const deletedWidgets = [];
  1536. for (const widget of areaWidgets) {
  1537. const widgetsNewArea = select.getWidgetAreaForWidgetId(widget.id);
  1538. if (!widgetsNewArea) {
  1539. deletedWidgets.push(widget);
  1540. }
  1541. }
  1542. const batchMeta = [];
  1543. const batchTasks = [];
  1544. const sidebarWidgetsIds = [];
  1545. for (let i = 0; i < widgetsBlocks.length; i++) {
  1546. const block = widgetsBlocks[i];
  1547. const widgetId = (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block);
  1548. const oldWidget = widgets[widgetId];
  1549. const widget = transformBlockToWidget(block, oldWidget);
  1550. // We'll replace the null widgetId after save, but we track it here
  1551. // since order is important.
  1552. sidebarWidgetsIds.push(widgetId);
  1553. // Check oldWidget as widgetId might refer to an ID which has been
  1554. // deleted, e.g. if a deleted block is restored via undo after saving.
  1555. if (oldWidget) {
  1556. // Update an existing widget.
  1557. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('root', 'widget', widgetId, {
  1558. ...widget,
  1559. sidebar: widgetAreaId
  1560. }, {
  1561. undoIgnore: true
  1562. });
  1563. const hasEdits = registry.select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('root', 'widget', widgetId);
  1564. if (!hasEdits) {
  1565. continue;
  1566. }
  1567. batchTasks.push(({
  1568. saveEditedEntityRecord
  1569. }) => saveEditedEntityRecord('root', 'widget', widgetId));
  1570. } else {
  1571. // Create a new widget.
  1572. batchTasks.push(({
  1573. saveEntityRecord
  1574. }) => saveEntityRecord('root', 'widget', {
  1575. ...widget,
  1576. sidebar: widgetAreaId
  1577. }));
  1578. }
  1579. batchMeta.push({
  1580. block,
  1581. position: i,
  1582. clientId: block.clientId
  1583. });
  1584. }
  1585. for (const widget of deletedWidgets) {
  1586. batchTasks.push(({
  1587. deleteEntityRecord
  1588. }) => deleteEntityRecord('root', 'widget', widget.id, {
  1589. force: true
  1590. }));
  1591. }
  1592. const records = await registry.dispatch(external_wp_coreData_namespaceObject.store).__experimentalBatch(batchTasks);
  1593. const preservedRecords = records.filter(record => !record.hasOwnProperty('deleted'));
  1594. const failedWidgetNames = [];
  1595. for (let i = 0; i < preservedRecords.length; i++) {
  1596. const widget = preservedRecords[i];
  1597. const {
  1598. block,
  1599. position
  1600. } = batchMeta[i];
  1601. // Set __internalWidgetId on the block. This will be persisted to the
  1602. // store when we dispatch receiveEntityRecords( post ) below.
  1603. post.blocks[position].attributes.__internalWidgetId = widget.id;
  1604. const error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('root', 'widget', widget.id);
  1605. if (error) {
  1606. failedWidgetNames.push(block.attributes?.name || block?.name);
  1607. }
  1608. if (!sidebarWidgetsIds[position]) {
  1609. sidebarWidgetsIds[position] = widget.id;
  1610. }
  1611. }
  1612. if (failedWidgetNames.length) {
  1613. throw new Error((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: List of widget names */
  1614. (0,external_wp_i18n_namespaceObject.__)('Could not save the following widgets: %s.'), failedWidgetNames.join(', ')));
  1615. }
  1616. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, {
  1617. widgets: sidebarWidgetsIds
  1618. }, {
  1619. undoIgnore: true
  1620. });
  1621. dispatch(trySaveWidgetArea(widgetAreaId));
  1622. registry.dispatch(external_wp_coreData_namespaceObject.store).receiveEntityRecords(KIND, POST_TYPE, post, undefined);
  1623. };
  1624. const trySaveWidgetArea = widgetAreaId => ({
  1625. registry
  1626. }) => {
  1627. registry.dispatch(external_wp_coreData_namespaceObject.store).saveEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, {
  1628. throwOnError: true
  1629. });
  1630. };
  1631. /**
  1632. * Sets the clientId stored for a particular widgetId.
  1633. *
  1634. * @param {number} clientId Client id.
  1635. * @param {number} widgetId Widget id.
  1636. *
  1637. * @return {Object} Action.
  1638. */
  1639. function setWidgetIdForClientId(clientId, widgetId) {
  1640. return {
  1641. type: 'SET_WIDGET_ID_FOR_CLIENT_ID',
  1642. clientId,
  1643. widgetId
  1644. };
  1645. }
  1646. /**
  1647. * Sets the open state of all the widget areas.
  1648. *
  1649. * @param {Object} widgetAreasOpenState The open states of all the widget areas.
  1650. *
  1651. * @return {Object} Action.
  1652. */
  1653. function setWidgetAreasOpenState(widgetAreasOpenState) {
  1654. return {
  1655. type: 'SET_WIDGET_AREAS_OPEN_STATE',
  1656. widgetAreasOpenState
  1657. };
  1658. }
  1659. /**
  1660. * Sets the open state of the widget area.
  1661. *
  1662. * @param {string} clientId The clientId of the widget area.
  1663. * @param {boolean} isOpen Whether the widget area should be opened.
  1664. *
  1665. * @return {Object} Action.
  1666. */
  1667. function setIsWidgetAreaOpen(clientId, isOpen) {
  1668. return {
  1669. type: 'SET_IS_WIDGET_AREA_OPEN',
  1670. clientId,
  1671. isOpen
  1672. };
  1673. }
  1674. /**
  1675. * Returns an action object used to open/close the inserter.
  1676. *
  1677. * @param {boolean|Object} value Whether the inserter should be
  1678. * opened (true) or closed (false).
  1679. * To specify an insertion point,
  1680. * use an object.
  1681. * @param {string} value.rootClientId The root client ID to insert at.
  1682. * @param {number} value.insertionIndex The index to insert at.
  1683. *
  1684. * @return {Object} Action object.
  1685. */
  1686. function setIsInserterOpened(value) {
  1687. return {
  1688. type: 'SET_IS_INSERTER_OPENED',
  1689. value
  1690. };
  1691. }
  1692. /**
  1693. * Returns an action object used to open/close the list view.
  1694. *
  1695. * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
  1696. * @return {Object} Action object.
  1697. */
  1698. function setIsListViewOpened(isOpen) {
  1699. return {
  1700. type: 'SET_IS_LIST_VIEW_OPENED',
  1701. isOpen
  1702. };
  1703. }
  1704. /**
  1705. * Returns an action object signalling that the user closed the sidebar.
  1706. *
  1707. * @return {Object} Action creator.
  1708. */
  1709. const closeGeneralSidebar = () => ({
  1710. registry
  1711. }) => {
  1712. registry.dispatch(store).disableComplementaryArea(constants_STORE_NAME);
  1713. };
  1714. /**
  1715. * Action that handles moving a block between widget areas
  1716. *
  1717. * @param {string} clientId The clientId of the block to move.
  1718. * @param {string} widgetAreaId The id of the widget area to move the block to.
  1719. */
  1720. const moveBlockToWidgetArea = (clientId, widgetAreaId) => async ({
  1721. dispatch,
  1722. select,
  1723. registry
  1724. }) => {
  1725. const sourceRootClientId = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockRootClientId(clientId);
  1726. // Search the top level blocks (widget areas) for the one with the matching
  1727. // id attribute. Makes the assumption that all top-level blocks are widget
  1728. // areas.
  1729. const widgetAreas = registry.select(external_wp_blockEditor_namespaceObject.store).getBlocks();
  1730. const destinationWidgetAreaBlock = widgetAreas.find(({
  1731. attributes
  1732. }) => attributes.id === widgetAreaId);
  1733. const destinationRootClientId = destinationWidgetAreaBlock.clientId;
  1734. // Get the index for moving to the end of the destination widget area.
  1735. const destinationInnerBlocksClientIds = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockOrder(destinationRootClientId);
  1736. const destinationIndex = destinationInnerBlocksClientIds.length;
  1737. // Reveal the widget area, if it's not open.
  1738. const isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen(destinationRootClientId);
  1739. if (!isDestinationWidgetAreaOpen) {
  1740. dispatch.setIsWidgetAreaOpen(destinationRootClientId, true);
  1741. }
  1742. // Move the block.
  1743. registry.dispatch(external_wp_blockEditor_namespaceObject.store).moveBlocksToPosition([clientId], sourceRootClientId, destinationRootClientId, destinationIndex);
  1744. };
  1745. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js
  1746. /**
  1747. * WordPress dependencies
  1748. */
  1749. /**
  1750. * Internal dependencies
  1751. */
  1752. /**
  1753. * Creates a "stub" widgets post reflecting all available widget areas. The
  1754. * post is meant as a convenient to only exists in runtime and should never be saved. It
  1755. * enables a convenient way of editing the widgets by using a regular post editor.
  1756. *
  1757. * Fetches all widgets from all widgets aras, converts them into blocks, and hydrates a new post with them.
  1758. *
  1759. * @return {Function} An action creator.
  1760. */
  1761. const getWidgetAreas = () => async ({
  1762. dispatch,
  1763. registry
  1764. }) => {
  1765. const query = buildWidgetAreasQuery();
  1766. const widgetAreas = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query);
  1767. const widgetAreaBlocks = [];
  1768. const sortedWidgetAreas = widgetAreas.sort((a, b) => {
  1769. if (a.id === 'wp_inactive_widgets') {
  1770. return 1;
  1771. }
  1772. if (b.id === 'wp_inactive_widgets') {
  1773. return -1;
  1774. }
  1775. return 0;
  1776. });
  1777. for (const widgetArea of sortedWidgetAreas) {
  1778. widgetAreaBlocks.push((0,external_wp_blocks_namespaceObject.createBlock)('core/widget-area', {
  1779. id: widgetArea.id,
  1780. name: widgetArea.name
  1781. }));
  1782. if (!widgetArea.widgets.length) {
  1783. // If this widget area has no widgets, it won't get a post setup by
  1784. // the getWidgets resolver.
  1785. dispatch(persistStubPost(buildWidgetAreaPostId(widgetArea.id), []));
  1786. }
  1787. }
  1788. const widgetAreasOpenState = {};
  1789. widgetAreaBlocks.forEach((widgetAreaBlock, index) => {
  1790. // Defaults to open the first widget area.
  1791. widgetAreasOpenState[widgetAreaBlock.clientId] = index === 0;
  1792. });
  1793. dispatch(setWidgetAreasOpenState(widgetAreasOpenState));
  1794. dispatch(persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks));
  1795. };
  1796. /**
  1797. * Fetches all widgets from all widgets ares, and groups them by widget area Id.
  1798. *
  1799. * @return {Function} An action creator.
  1800. */
  1801. const getWidgets = () => async ({
  1802. dispatch,
  1803. registry
  1804. }) => {
  1805. const query = buildWidgetsQuery();
  1806. const widgets = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', query);
  1807. const groupedBySidebar = {};
  1808. for (const widget of widgets) {
  1809. const block = transformWidgetToBlock(widget);
  1810. groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || [];
  1811. groupedBySidebar[widget.sidebar].push(block);
  1812. }
  1813. for (const sidebarId in groupedBySidebar) {
  1814. if (groupedBySidebar.hasOwnProperty(sidebarId)) {
  1815. // Persist the actual post containing the widget block
  1816. dispatch(persistStubPost(buildWidgetAreaPostId(sidebarId), groupedBySidebar[sidebarId]));
  1817. }
  1818. }
  1819. };
  1820. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js
  1821. /**
  1822. * WordPress dependencies
  1823. */
  1824. /**
  1825. * Internal dependencies
  1826. */
  1827. const EMPTY_INSERTION_POINT = {
  1828. rootClientId: undefined,
  1829. insertionIndex: undefined
  1830. };
  1831. /**
  1832. * Returns all API widgets.
  1833. *
  1834. * @return {Object[]} API List of widgets.
  1835. */
  1836. const selectors_getWidgets = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  1837. const widgets = select(external_wp_coreData_namespaceObject.store).getEntityRecords('root', 'widget', buildWidgetsQuery());
  1838. return (
  1839. // Key widgets by their ID.
  1840. widgets?.reduce((allWidgets, widget) => ({
  1841. ...allWidgets,
  1842. [widget.id]: widget
  1843. }), {}) || {}
  1844. );
  1845. });
  1846. /**
  1847. * Returns API widget data for a particular widget ID.
  1848. *
  1849. * @param {number} id Widget ID.
  1850. *
  1851. * @return {Object} API widget data for a particular widget ID.
  1852. */
  1853. const getWidget = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, id) => {
  1854. const widgets = select(constants_STORE_NAME).getWidgets();
  1855. return widgets[id];
  1856. });
  1857. /**
  1858. * Returns all API widget areas.
  1859. *
  1860. * @return {Object[]} API List of widget areas.
  1861. */
  1862. const selectors_getWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  1863. const query = buildWidgetAreasQuery();
  1864. return select(external_wp_coreData_namespaceObject.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query);
  1865. });
  1866. /**
  1867. * Returns widgetArea containing a block identify by given widgetId
  1868. *
  1869. * @param {string} widgetId The ID of the widget.
  1870. * @return {Object} Containing widget area.
  1871. */
  1872. const getWidgetAreaForWidgetId = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, widgetId) => {
  1873. const widgetAreas = select(constants_STORE_NAME).getWidgetAreas();
  1874. return widgetAreas.find(widgetArea => {
  1875. const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetArea.id));
  1876. const blockWidgetIds = post.blocks.map(block => (0,external_wp_widgets_namespaceObject.getWidgetIdFromBlock)(block));
  1877. return blockWidgetIds.includes(widgetId);
  1878. });
  1879. });
  1880. /**
  1881. * Given a child client id, returns the parent widget area block.
  1882. *
  1883. * @param {string} clientId The client id of a block in a widget area.
  1884. *
  1885. * @return {WPBlock} The widget area block.
  1886. */
  1887. const getParentWidgetAreaBlock = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId) => {
  1888. const {
  1889. getBlock,
  1890. getBlockName,
  1891. getBlockParents
  1892. } = select(external_wp_blockEditor_namespaceObject.store);
  1893. const blockParents = getBlockParents(clientId);
  1894. const widgetAreaClientId = blockParents.find(parentClientId => getBlockName(parentClientId) === 'core/widget-area');
  1895. return getBlock(widgetAreaClientId);
  1896. });
  1897. /**
  1898. * Returns all edited widget area entity records.
  1899. *
  1900. * @return {Object[]} List of edited widget area entity records.
  1901. */
  1902. const getEditedWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, ids) => {
  1903. let widgetAreas = select(constants_STORE_NAME).getWidgetAreas();
  1904. if (!widgetAreas) {
  1905. return [];
  1906. }
  1907. if (ids) {
  1908. widgetAreas = widgetAreas.filter(({
  1909. id
  1910. }) => ids.includes(id));
  1911. }
  1912. return widgetAreas.filter(({
  1913. id
  1914. }) => select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(id))).map(({
  1915. id
  1916. }) => select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id));
  1917. });
  1918. /**
  1919. * Returns all blocks representing reference widgets.
  1920. *
  1921. * @param {string} referenceWidgetName Optional. If given, only reference widgets with this name will be returned.
  1922. * @return {Array} List of all blocks representing reference widgets
  1923. */
  1924. const getReferenceWidgetBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, referenceWidgetName = null) => {
  1925. const results = [];
  1926. const widgetAreas = select(constants_STORE_NAME).getWidgetAreas();
  1927. for (const _widgetArea of widgetAreas) {
  1928. const post = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(_widgetArea.id));
  1929. for (const block of post.blocks) {
  1930. if (block.name === 'core/legacy-widget' && (!referenceWidgetName || block.attributes?.referenceWidgetName === referenceWidgetName)) {
  1931. results.push(block);
  1932. }
  1933. }
  1934. }
  1935. return results;
  1936. });
  1937. /**
  1938. * Returns true if any widget area is currently being saved.
  1939. *
  1940. * @return {boolean} True if any widget area is currently being saved. False otherwise.
  1941. */
  1942. const isSavingWidgetAreas = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  1943. const widgetAreasIds = select(constants_STORE_NAME).getWidgetAreas()?.map(({
  1944. id
  1945. }) => id);
  1946. if (!widgetAreasIds) {
  1947. return false;
  1948. }
  1949. for (const id of widgetAreasIds) {
  1950. const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id);
  1951. if (isSaving) {
  1952. return true;
  1953. }
  1954. }
  1955. const widgetIds = [...Object.keys(select(constants_STORE_NAME).getWidgets()), undefined // account for new widgets without an ID
  1956. ];
  1957. for (const id of widgetIds) {
  1958. const isSaving = select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord('root', 'widget', id);
  1959. if (isSaving) {
  1960. return true;
  1961. }
  1962. }
  1963. return false;
  1964. });
  1965. /**
  1966. * Gets whether the widget area is opened.
  1967. *
  1968. * @param {Array} state The open state of the widget areas.
  1969. * @param {string} clientId The clientId of the widget area.
  1970. *
  1971. * @return {boolean} True if the widget area is open.
  1972. */
  1973. const getIsWidgetAreaOpen = (state, clientId) => {
  1974. const {
  1975. widgetAreasOpenState
  1976. } = state;
  1977. return !!widgetAreasOpenState[clientId];
  1978. };
  1979. /**
  1980. * Returns true if the inserter is opened.
  1981. *
  1982. * @param {Object} state Global application state.
  1983. *
  1984. * @return {boolean} Whether the inserter is opened.
  1985. */
  1986. function isInserterOpened(state) {
  1987. return !!state.blockInserterPanel;
  1988. }
  1989. /**
  1990. * Get the insertion point for the inserter.
  1991. *
  1992. * @param {Object} state Global application state.
  1993. *
  1994. * @return {Object} The root client ID and index to insert at.
  1995. */
  1996. function __experimentalGetInsertionPoint(state) {
  1997. if (typeof state.blockInserterPanel === 'boolean') {
  1998. return EMPTY_INSERTION_POINT;
  1999. }
  2000. return state.blockInserterPanel;
  2001. }
  2002. /**
  2003. * Returns true if a block can be inserted into a widget area.
  2004. *
  2005. * @param {Array} state The open state of the widget areas.
  2006. * @param {string} blockName The name of the block being inserted.
  2007. *
  2008. * @return {boolean} True if the block can be inserted in a widget area.
  2009. */
  2010. const canInsertBlockInWidgetArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, blockName) => {
  2011. // Widget areas are always top-level blocks, which getBlocks will return.
  2012. const widgetAreas = select(external_wp_blockEditor_namespaceObject.store).getBlocks();
  2013. // Makes an assumption that a block that can be inserted into one
  2014. // widget area can be inserted into any widget area. Uses the first
  2015. // widget area for testing whether the block can be inserted.
  2016. const [firstWidgetArea] = widgetAreas;
  2017. return select(external_wp_blockEditor_namespaceObject.store).canInsertBlockType(blockName, firstWidgetArea.clientId);
  2018. });
  2019. /**
  2020. * Returns true if the list view is opened.
  2021. *
  2022. * @param {Object} state Global application state.
  2023. *
  2024. * @return {boolean} Whether the list view is opened.
  2025. */
  2026. function isListViewOpened(state) {
  2027. return state.listViewPanel;
  2028. }
  2029. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/index.js
  2030. /**
  2031. * WordPress dependencies
  2032. */
  2033. /**
  2034. * Internal dependencies
  2035. */
  2036. /**
  2037. * Block editor data store configuration.
  2038. *
  2039. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register
  2040. *
  2041. * @type {Object}
  2042. */
  2043. const storeConfig = {
  2044. reducer: reducer,
  2045. selectors: store_selectors_namespaceObject,
  2046. resolvers: resolvers_namespaceObject,
  2047. actions: store_actions_namespaceObject
  2048. };
  2049. /**
  2050. * Store definition for the edit widgets namespace.
  2051. *
  2052. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  2053. *
  2054. * @type {Object}
  2055. */
  2056. const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig);
  2057. (0,external_wp_data_namespaceObject.register)(store_store);
  2058. // This package uses a few in-memory post types as wrappers for convenience.
  2059. // This middleware prevents any network requests related to these types as they are
  2060. // bound to fail anyway.
  2061. external_wp_apiFetch_default().use(function (options, next) {
  2062. if (options.path?.indexOf('/wp/v2/types/widget-area') === 0) {
  2063. return Promise.resolve({});
  2064. }
  2065. return next(options);
  2066. });
  2067. ;// CONCATENATED MODULE: external ["wp","hooks"]
  2068. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  2069. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/move-to-widget-area.js
  2070. /**
  2071. * WordPress dependencies
  2072. */
  2073. /**
  2074. * Internal dependencies
  2075. */
  2076. const withMoveToWidgetAreaToolbarItem = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
  2077. const {
  2078. clientId,
  2079. name: blockName
  2080. } = props;
  2081. const {
  2082. widgetAreas,
  2083. currentWidgetAreaId,
  2084. canInsertBlockInWidgetArea
  2085. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2086. // Component won't display for a widget area, so don't run selectors.
  2087. if (blockName === 'core/widget-area') {
  2088. return {};
  2089. }
  2090. const selectors = select(store_store);
  2091. const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
  2092. return {
  2093. widgetAreas: selectors.getWidgetAreas(),
  2094. currentWidgetAreaId: widgetAreaBlock?.attributes?.id,
  2095. canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName)
  2096. };
  2097. }, [clientId, blockName]);
  2098. const {
  2099. moveBlockToWidgetArea
  2100. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2101. const hasMultipleWidgetAreas = widgetAreas?.length > 1;
  2102. const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea;
  2103. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, {
  2104. ...props
  2105. }), isMoveToWidgetAreaVisible && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_widgets_namespaceObject.MoveToWidgetArea, {
  2106. widgetAreas: widgetAreas,
  2107. currentWidgetAreaId: currentWidgetAreaId,
  2108. onSelect: widgetAreaId => {
  2109. moveBlockToWidgetArea(props.clientId, widgetAreaId);
  2110. }
  2111. })));
  2112. }, 'withMoveToWidgetAreaToolbarItem');
  2113. (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-widgets/block-edit', withMoveToWidgetAreaToolbarItem);
  2114. ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
  2115. var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
  2116. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/replace-media-upload.js
  2117. /**
  2118. * WordPress dependencies
  2119. */
  2120. const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload;
  2121. (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
  2122. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/index.js
  2123. /**
  2124. * Internal dependencies
  2125. */
  2126. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.js
  2127. /**
  2128. * WordPress dependencies
  2129. */
  2130. /** @typedef {import('@wordpress/element').RefObject} RefObject */
  2131. /**
  2132. * A React hook to determine if it's dragging within the target element.
  2133. *
  2134. * @param {RefObject<HTMLElement>} elementRef The target elementRef object.
  2135. *
  2136. * @return {boolean} Is dragging within the target element.
  2137. */
  2138. const useIsDraggingWithin = elementRef => {
  2139. const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false);
  2140. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2141. const {
  2142. ownerDocument
  2143. } = elementRef.current;
  2144. function handleDragStart(event) {
  2145. // Check the first time when the dragging starts.
  2146. handleDragEnter(event);
  2147. }
  2148. // Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
  2149. function handleDragEnd() {
  2150. setIsDraggingWithin(false);
  2151. }
  2152. function handleDragEnter(event) {
  2153. // Check if the current target is inside the item element.
  2154. if (elementRef.current.contains(event.target)) {
  2155. setIsDraggingWithin(true);
  2156. } else {
  2157. setIsDraggingWithin(false);
  2158. }
  2159. }
  2160. // Bind these events to the document to catch all drag events.
  2161. // Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari.
  2162. ownerDocument.addEventListener('dragstart', handleDragStart);
  2163. ownerDocument.addEventListener('dragend', handleDragEnd);
  2164. ownerDocument.addEventListener('dragenter', handleDragEnter);
  2165. return () => {
  2166. ownerDocument.removeEventListener('dragstart', handleDragStart);
  2167. ownerDocument.removeEventListener('dragend', handleDragEnd);
  2168. ownerDocument.removeEventListener('dragenter', handleDragEnter);
  2169. };
  2170. }, []);
  2171. return isDraggingWithin;
  2172. };
  2173. /* harmony default export */ var use_is_dragging_within = (useIsDraggingWithin);
  2174. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.js
  2175. /**
  2176. * External dependencies
  2177. */
  2178. /**
  2179. * WordPress dependencies
  2180. */
  2181. /**
  2182. * Internal dependencies
  2183. */
  2184. function WidgetAreaInnerBlocks({
  2185. id
  2186. }) {
  2187. const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('root', 'postType');
  2188. const innerBlocksRef = (0,external_wp_element_namespaceObject.useRef)();
  2189. const isDraggingWithinInnerBlocks = use_is_dragging_within(innerBlocksRef);
  2190. const shouldHighlightDropZone = isDraggingWithinInnerBlocks;
  2191. // Using the experimental hook so that we can control the className of the element.
  2192. const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
  2193. ref: innerBlocksRef
  2194. }, {
  2195. value: blocks,
  2196. onInput,
  2197. onChange,
  2198. templateLock: false,
  2199. renderAppender: external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender
  2200. });
  2201. return (0,external_wp_element_namespaceObject.createElement)("div", {
  2202. "data-widget-area-id": id,
  2203. className: classnames_default()('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
  2204. 'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
  2205. })
  2206. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  2207. ...innerBlocksProps
  2208. }));
  2209. }
  2210. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/index.js
  2211. /**
  2212. * WordPress dependencies
  2213. */
  2214. /**
  2215. * Internal dependencies
  2216. */
  2217. /** @typedef {import('@wordpress/element').RefObject} RefObject */
  2218. function WidgetAreaEdit({
  2219. clientId,
  2220. className,
  2221. attributes: {
  2222. id,
  2223. name
  2224. }
  2225. }) {
  2226. const isOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getIsWidgetAreaOpen(clientId), [clientId]);
  2227. const {
  2228. setIsWidgetAreaOpen
  2229. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2230. const wrapper = (0,external_wp_element_namespaceObject.useRef)();
  2231. const setOpen = (0,external_wp_element_namespaceObject.useCallback)(openState => setIsWidgetAreaOpen(clientId, openState), [clientId]);
  2232. const isDragging = useIsDragging(wrapper);
  2233. const isDraggingWithin = use_is_dragging_within(wrapper);
  2234. const [openedWhileDragging, setOpenedWhileDragging] = (0,external_wp_element_namespaceObject.useState)(false);
  2235. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2236. if (!isDragging) {
  2237. setOpenedWhileDragging(false);
  2238. return;
  2239. }
  2240. if (isDraggingWithin && !isOpen) {
  2241. setOpen(true);
  2242. setOpenedWhileDragging(true);
  2243. } else if (!isDraggingWithin && isOpen && openedWhileDragging) {
  2244. setOpen(false);
  2245. }
  2246. }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]);
  2247. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
  2248. className: className,
  2249. ref: wrapper
  2250. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  2251. title: name,
  2252. opened: isOpen,
  2253. onToggle: () => {
  2254. setIsWidgetAreaOpen(clientId, !isOpen);
  2255. },
  2256. scrollAfterOpen: !isDragging
  2257. }, ({
  2258. opened
  2259. }) =>
  2260. // This is required to ensure LegacyWidget blocks are not
  2261. // unmounted when the panel is collapsed. Unmounting legacy
  2262. // widgets may have unintended consequences (e.g. TinyMCE
  2263. // not being properly reinitialized)
  2264. (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableDisclosureContent, {
  2265. className: "wp-block-widget-area__panel-body-content",
  2266. visible: opened
  2267. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
  2268. kind: "root",
  2269. type: "postType",
  2270. id: `widget-area-${id}`
  2271. }, (0,external_wp_element_namespaceObject.createElement)(WidgetAreaInnerBlocks, {
  2272. id: id
  2273. })))));
  2274. }
  2275. /**
  2276. * A React hook to determine if dragging is active.
  2277. *
  2278. * @param {RefObject<HTMLElement>} elementRef The target elementRef object.
  2279. *
  2280. * @return {boolean} Is dragging within the entire document.
  2281. */
  2282. const useIsDragging = elementRef => {
  2283. const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false);
  2284. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2285. const {
  2286. ownerDocument
  2287. } = elementRef.current;
  2288. function handleDragStart() {
  2289. setIsDragging(true);
  2290. }
  2291. function handleDragEnd() {
  2292. setIsDragging(false);
  2293. }
  2294. ownerDocument.addEventListener('dragstart', handleDragStart);
  2295. ownerDocument.addEventListener('dragend', handleDragEnd);
  2296. return () => {
  2297. ownerDocument.removeEventListener('dragstart', handleDragStart);
  2298. ownerDocument.removeEventListener('dragend', handleDragEnd);
  2299. };
  2300. }, []);
  2301. return isDragging;
  2302. };
  2303. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js
  2304. /**
  2305. * WordPress dependencies
  2306. */
  2307. /**
  2308. * Internal dependencies
  2309. */
  2310. const metadata = {
  2311. name: "core/widget-area",
  2312. category: "widgets",
  2313. attributes: {
  2314. id: {
  2315. type: "string"
  2316. },
  2317. name: {
  2318. type: "string"
  2319. }
  2320. },
  2321. supports: {
  2322. html: false,
  2323. inserter: false,
  2324. customClassName: false,
  2325. reusable: false,
  2326. __experimentalToolbar: false,
  2327. __experimentalParentSelector: false,
  2328. __experimentalDisableBlockOverlay: true
  2329. },
  2330. editorStyle: "wp-block-widget-area-editor",
  2331. style: "wp-block-widget-area"
  2332. };
  2333. const {
  2334. name: widget_area_name
  2335. } = metadata;
  2336. const settings = {
  2337. title: (0,external_wp_i18n_namespaceObject.__)('Widget Area'),
  2338. description: (0,external_wp_i18n_namespaceObject.__)('A widget area container.'),
  2339. __experimentalLabel: ({
  2340. name: label
  2341. }) => label,
  2342. edit: WidgetAreaEdit
  2343. };
  2344. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/error-boundary/index.js
  2345. /**
  2346. * WordPress dependencies
  2347. */
  2348. function CopyButton({
  2349. text,
  2350. children
  2351. }) {
  2352. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
  2353. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2354. variant: "secondary",
  2355. ref: ref
  2356. }, children);
  2357. }
  2358. function ErrorBoundaryWarning({
  2359. message,
  2360. error
  2361. }) {
  2362. const actions = [(0,external_wp_element_namespaceObject.createElement)(CopyButton, {
  2363. key: "copy-error",
  2364. text: error.stack
  2365. }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))];
  2366. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
  2367. className: "edit-widgets-error-boundary",
  2368. actions: actions
  2369. }, message);
  2370. }
  2371. class ErrorBoundary extends external_wp_element_namespaceObject.Component {
  2372. constructor() {
  2373. super(...arguments);
  2374. this.state = {
  2375. error: null
  2376. };
  2377. }
  2378. componentDidCatch(error) {
  2379. (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
  2380. }
  2381. static getDerivedStateFromError(error) {
  2382. return {
  2383. error
  2384. };
  2385. }
  2386. render() {
  2387. if (!this.state.error) {
  2388. return this.props.children;
  2389. }
  2390. return (0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, {
  2391. message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'),
  2392. error: this.state.error
  2393. });
  2394. }
  2395. }
  2396. ;// CONCATENATED MODULE: external ["wp","patterns"]
  2397. var external_wp_patterns_namespaceObject = window["wp"]["patterns"];
  2398. ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
  2399. var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
  2400. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  2401. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  2402. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcuts/index.js
  2403. /**
  2404. * WordPress dependencies
  2405. */
  2406. /**
  2407. * Internal dependencies
  2408. */
  2409. function KeyboardShortcuts() {
  2410. const {
  2411. redo,
  2412. undo
  2413. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  2414. const {
  2415. saveEditedWidgetAreas
  2416. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2417. const {
  2418. replaceBlocks
  2419. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  2420. const {
  2421. getBlockName,
  2422. getSelectedBlockClientId,
  2423. getBlockAttributes
  2424. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
  2425. const handleTextLevelShortcut = (event, level) => {
  2426. event.preventDefault();
  2427. const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading';
  2428. const currentClientId = getSelectedBlockClientId();
  2429. if (currentClientId === null) {
  2430. return;
  2431. }
  2432. const blockName = getBlockName(currentClientId);
  2433. if (blockName !== 'core/paragraph' && blockName !== 'core/heading') {
  2434. return;
  2435. }
  2436. const attributes = getBlockAttributes(currentClientId);
  2437. const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign';
  2438. const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
  2439. replaceBlocks(currentClientId, (0,external_wp_blocks_namespaceObject.createBlock)(destinationBlockName, {
  2440. level,
  2441. content: attributes.content,
  2442. ...{
  2443. [destinationTextAlign]: attributes[textAlign]
  2444. }
  2445. }));
  2446. };
  2447. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/undo', event => {
  2448. undo();
  2449. event.preventDefault();
  2450. });
  2451. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/redo', event => {
  2452. redo();
  2453. event.preventDefault();
  2454. });
  2455. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/save', event => {
  2456. event.preventDefault();
  2457. saveEditedWidgetAreas();
  2458. });
  2459. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0));
  2460. [1, 2, 3, 4, 5, 6].forEach(level => {
  2461. //the loop is based off on a constant therefore
  2462. //the hook will execute the same way every time
  2463. //eslint-disable-next-line react-hooks/rules-of-hooks
  2464. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)(`core/edit-widgets/transform-paragraph-to-heading-${level}`, event => handleTextLevelShortcut(event, level));
  2465. });
  2466. return null;
  2467. }
  2468. function KeyboardShortcutsRegister() {
  2469. // Registering the shortcuts.
  2470. const {
  2471. registerShortcut
  2472. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  2473. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2474. registerShortcut({
  2475. name: 'core/edit-widgets/undo',
  2476. category: 'global',
  2477. description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
  2478. keyCombination: {
  2479. modifier: 'primary',
  2480. character: 'z'
  2481. }
  2482. });
  2483. registerShortcut({
  2484. name: 'core/edit-widgets/redo',
  2485. category: 'global',
  2486. description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
  2487. keyCombination: {
  2488. modifier: 'primaryShift',
  2489. character: 'z'
  2490. },
  2491. // Disable on Apple OS because it conflicts with the browser's
  2492. // history shortcut. It's a fine alias for both Windows and Linux.
  2493. // Since there's no conflict for Ctrl+Shift+Z on both Windows and
  2494. // Linux, we keep it as the default for consistency.
  2495. aliases: (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? [] : [{
  2496. modifier: 'primary',
  2497. character: 'y'
  2498. }]
  2499. });
  2500. registerShortcut({
  2501. name: 'core/edit-widgets/save',
  2502. category: 'global',
  2503. description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
  2504. keyCombination: {
  2505. modifier: 'primary',
  2506. character: 's'
  2507. }
  2508. });
  2509. registerShortcut({
  2510. name: 'core/edit-widgets/keyboard-shortcuts',
  2511. category: 'main',
  2512. description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
  2513. keyCombination: {
  2514. modifier: 'access',
  2515. character: 'h'
  2516. }
  2517. });
  2518. registerShortcut({
  2519. name: 'core/edit-widgets/next-region',
  2520. category: 'global',
  2521. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
  2522. keyCombination: {
  2523. modifier: 'ctrl',
  2524. character: '`'
  2525. },
  2526. aliases: [{
  2527. modifier: 'access',
  2528. character: 'n'
  2529. }]
  2530. });
  2531. registerShortcut({
  2532. name: 'core/edit-widgets/previous-region',
  2533. category: 'global',
  2534. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
  2535. keyCombination: {
  2536. modifier: 'ctrlShift',
  2537. character: '`'
  2538. },
  2539. aliases: [{
  2540. modifier: 'access',
  2541. character: 'p'
  2542. }, {
  2543. modifier: 'ctrlShift',
  2544. character: '~'
  2545. }]
  2546. });
  2547. registerShortcut({
  2548. name: 'core/edit-widgets/transform-heading-to-paragraph',
  2549. category: 'block-library',
  2550. description: (0,external_wp_i18n_namespaceObject.__)('Transform heading to paragraph.'),
  2551. keyCombination: {
  2552. modifier: 'access',
  2553. character: `0`
  2554. }
  2555. });
  2556. [1, 2, 3, 4, 5, 6].forEach(level => {
  2557. registerShortcut({
  2558. name: `core/edit-widgets/transform-paragraph-to-heading-${level}`,
  2559. category: 'block-library',
  2560. description: (0,external_wp_i18n_namespaceObject.__)('Transform paragraph to heading.'),
  2561. keyCombination: {
  2562. modifier: 'access',
  2563. character: `${level}`
  2564. }
  2565. });
  2566. });
  2567. }, [registerShortcut]);
  2568. return null;
  2569. }
  2570. KeyboardShortcuts.Register = KeyboardShortcutsRegister;
  2571. /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
  2572. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-last-selected-widget-area.js
  2573. /**
  2574. * WordPress dependencies
  2575. */
  2576. /**
  2577. * Internal dependencies
  2578. */
  2579. /**
  2580. * A react hook that returns the client id of the last widget area to have
  2581. * been selected, or to have a selected block within it.
  2582. *
  2583. * @return {string} clientId of the widget area last selected.
  2584. */
  2585. const useLastSelectedWidgetArea = () => (0,external_wp_data_namespaceObject.useSelect)(select => {
  2586. const {
  2587. getBlockSelectionEnd,
  2588. getBlockName
  2589. } = select(external_wp_blockEditor_namespaceObject.store);
  2590. const selectionEndClientId = getBlockSelectionEnd();
  2591. // If the selected block is a widget area, return its clientId.
  2592. if (getBlockName(selectionEndClientId) === 'core/widget-area') {
  2593. return selectionEndClientId;
  2594. }
  2595. const {
  2596. getParentWidgetAreaBlock
  2597. } = select(store_store);
  2598. const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId);
  2599. const widgetAreaBlockClientId = widgetAreaBlock?.clientId;
  2600. if (widgetAreaBlockClientId) {
  2601. return widgetAreaBlockClientId;
  2602. }
  2603. // If no widget area has been selected, return the clientId of the first
  2604. // area.
  2605. const {
  2606. getEntityRecord
  2607. } = select(external_wp_coreData_namespaceObject.store);
  2608. const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId());
  2609. return widgetAreasPost?.blocks[0]?.clientId;
  2610. }, []);
  2611. /* harmony default export */ var use_last_selected_widget_area = (useLastSelectedWidgetArea);
  2612. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/constants.js
  2613. const ALLOW_REUSABLE_BLOCKS = false;
  2614. const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
  2615. ;// CONCATENATED MODULE: external ["wp","privateApis"]
  2616. var external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
  2617. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/lock-unlock.js
  2618. /**
  2619. * WordPress dependencies
  2620. */
  2621. const {
  2622. lock,
  2623. unlock
  2624. } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-widgets');
  2625. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.js
  2626. /**
  2627. * WordPress dependencies
  2628. */
  2629. /**
  2630. * Internal dependencies
  2631. */
  2632. const {
  2633. ExperimentalBlockEditorProvider
  2634. } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
  2635. const {
  2636. PatternsMenuItems
  2637. } = unlock(external_wp_patterns_namespaceObject.privateApis);
  2638. function WidgetAreasBlockEditorProvider({
  2639. blockEditorSettings,
  2640. children,
  2641. ...props
  2642. }) {
  2643. const mediaPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('media');
  2644. const {
  2645. reusableBlocks,
  2646. isFixedToolbarActive,
  2647. keepCaretInsideBlock
  2648. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  2649. widgetAreas: select(store_store).getWidgetAreas(),
  2650. widgets: select(store_store).getWidgets(),
  2651. reusableBlocks: ALLOW_REUSABLE_BLOCKS ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block') : [],
  2652. isFixedToolbarActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'fixedToolbar'),
  2653. keepCaretInsideBlock: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'keepCaretInsideBlock')
  2654. }), []);
  2655. const {
  2656. setIsInserterOpened
  2657. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2658. const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
  2659. let mediaUploadBlockEditor;
  2660. if (mediaPermissions.canCreate) {
  2661. mediaUploadBlockEditor = ({
  2662. onError,
  2663. ...argumentsObject
  2664. }) => {
  2665. (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
  2666. wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
  2667. onError: ({
  2668. message
  2669. }) => onError(message),
  2670. ...argumentsObject
  2671. });
  2672. };
  2673. }
  2674. return {
  2675. ...blockEditorSettings,
  2676. __experimentalReusableBlocks: reusableBlocks,
  2677. hasFixedToolbar: isFixedToolbarActive,
  2678. keepCaretInsideBlock,
  2679. mediaUpload: mediaUploadBlockEditor,
  2680. templateLock: 'all',
  2681. __experimentalSetIsInserterOpened: setIsInserterOpened
  2682. };
  2683. }, [blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, mediaPermissions.canCreate, reusableBlocks, setIsInserterOpened]);
  2684. const widgetAreaId = use_last_selected_widget_area();
  2685. const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)(KIND, POST_TYPE, {
  2686. id: buildWidgetAreasPostId()
  2687. });
  2688. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(ExperimentalBlockEditorProvider, {
  2689. value: blocks,
  2690. onInput: onInput,
  2691. onChange: onChange,
  2692. settings: settings,
  2693. useSubRegistry: false,
  2694. ...props
  2695. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.CopyHandler, null, children), (0,external_wp_element_namespaceObject.createElement)(PatternsMenuItems, {
  2696. rootClientId: widgetAreaId
  2697. })));
  2698. }
  2699. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-left.js
  2700. /**
  2701. * WordPress dependencies
  2702. */
  2703. const drawerLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2704. width: "24",
  2705. height: "24",
  2706. xmlns: "http://www.w3.org/2000/svg",
  2707. viewBox: "0 0 24 24"
  2708. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2709. fillRule: "evenodd",
  2710. clipRule: "evenodd",
  2711. 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"
  2712. }));
  2713. /* harmony default export */ var drawer_left = (drawerLeft);
  2714. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-right.js
  2715. /**
  2716. * WordPress dependencies
  2717. */
  2718. const drawerRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2719. width: "24",
  2720. height: "24",
  2721. xmlns: "http://www.w3.org/2000/svg",
  2722. viewBox: "0 0 24 24"
  2723. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2724. fillRule: "evenodd",
  2725. clipRule: "evenodd",
  2726. 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"
  2727. }));
  2728. /* harmony default export */ var drawer_right = (drawerRight);
  2729. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
  2730. /**
  2731. * WordPress dependencies
  2732. */
  2733. const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2734. xmlns: "http://www.w3.org/2000/svg",
  2735. viewBox: "0 0 24 24"
  2736. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2737. 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"
  2738. }));
  2739. /* harmony default export */ var block_default = (blockDefault);
  2740. ;// CONCATENATED MODULE: external ["wp","url"]
  2741. var external_wp_url_namespaceObject = window["wp"]["url"];
  2742. ;// CONCATENATED MODULE: external ["wp","dom"]
  2743. var external_wp_dom_namespaceObject = window["wp"]["dom"];
  2744. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/widget-areas.js
  2745. /**
  2746. * WordPress dependencies
  2747. */
  2748. /**
  2749. * Internal dependencies
  2750. */
  2751. function WidgetAreas({
  2752. selectedWidgetAreaId
  2753. }) {
  2754. const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getWidgetAreas(), []);
  2755. const selectedWidgetArea = (0,external_wp_element_namespaceObject.useMemo)(() => selectedWidgetAreaId && widgetAreas?.find(widgetArea => widgetArea.id === selectedWidgetAreaId), [selectedWidgetAreaId, widgetAreas]);
  2756. let description;
  2757. if (!selectedWidgetArea) {
  2758. description = (0,external_wp_i18n_namespaceObject.__)('Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.');
  2759. } else if (selectedWidgetAreaId === 'wp_inactive_widgets') {
  2760. description = (0,external_wp_i18n_namespaceObject.__)('Blocks in this Widget Area will not be displayed in your site.');
  2761. } else {
  2762. description = selectedWidgetArea.description;
  2763. }
  2764. return (0,external_wp_element_namespaceObject.createElement)("div", {
  2765. className: "edit-widgets-widget-areas"
  2766. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  2767. className: "edit-widgets-widget-areas__top-container"
  2768. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
  2769. icon: block_default
  2770. }), (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)("p", {
  2771. // Use `dangerouslySetInnerHTML` to keep backwards
  2772. // compatibility. Basic markup in the description is an
  2773. // established feature of WordPress.
  2774. // @see https://github.com/WordPress/gutenberg/issues/33106
  2775. dangerouslySetInnerHTML: {
  2776. __html: (0,external_wp_dom_namespaceObject.safeHTML)(description)
  2777. }
  2778. }), widgetAreas?.length === 0 && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme does not contain any Widget Areas.')), !selectedWidgetArea && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2779. href: (0,external_wp_url_namespaceObject.addQueryArgs)('customize.php', {
  2780. 'autofocus[panel]': 'widgets',
  2781. return: window.location.pathname
  2782. }),
  2783. variant: "tertiary"
  2784. }, (0,external_wp_i18n_namespaceObject.__)('Manage with live preview')))));
  2785. }
  2786. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/index.js
  2787. /**
  2788. * External dependencies
  2789. */
  2790. /**
  2791. * WordPress dependencies
  2792. */
  2793. const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({
  2794. web: true,
  2795. native: false
  2796. });
  2797. const BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';
  2798. // Widget areas were one called block areas, so use 'edit-widgets/block-areas'
  2799. // for backwards compatibility.
  2800. const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';
  2801. /**
  2802. * Internal dependencies
  2803. */
  2804. function ComplementaryAreaTab({
  2805. identifier,
  2806. label,
  2807. isActive
  2808. }) {
  2809. const {
  2810. enableComplementaryArea
  2811. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  2812. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2813. onClick: () => enableComplementaryArea(store_store.name, identifier),
  2814. className: classnames_default()('edit-widgets-sidebar__panel-tab', {
  2815. 'is-active': isActive
  2816. }),
  2817. "aria-label": isActive ?
  2818. // translators: %s: sidebar label e.g: "Widget Areas".
  2819. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), label) : label,
  2820. "data-label": label
  2821. }, label);
  2822. }
  2823. function Sidebar() {
  2824. const {
  2825. enableComplementaryArea
  2826. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  2827. const {
  2828. currentArea,
  2829. hasSelectedNonAreaBlock,
  2830. isGeneralSidebarOpen,
  2831. selectedWidgetAreaBlock
  2832. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2833. const {
  2834. getSelectedBlock,
  2835. getBlock,
  2836. getBlockParentsByBlockName
  2837. } = select(external_wp_blockEditor_namespaceObject.store);
  2838. const {
  2839. getActiveComplementaryArea
  2840. } = select(store);
  2841. const selectedBlock = getSelectedBlock();
  2842. const activeArea = getActiveComplementaryArea(store_store.name);
  2843. let currentSelection = activeArea;
  2844. if (!currentSelection) {
  2845. if (selectedBlock) {
  2846. currentSelection = BLOCK_INSPECTOR_IDENTIFIER;
  2847. } else {
  2848. currentSelection = WIDGET_AREAS_IDENTIFIER;
  2849. }
  2850. }
  2851. let widgetAreaBlock;
  2852. if (selectedBlock) {
  2853. if (selectedBlock.name === 'core/widget-area') {
  2854. widgetAreaBlock = selectedBlock;
  2855. } else {
  2856. widgetAreaBlock = getBlock(getBlockParentsByBlockName(selectedBlock.clientId, 'core/widget-area')[0]);
  2857. }
  2858. }
  2859. return {
  2860. currentArea: currentSelection,
  2861. hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== 'core/widget-area'),
  2862. isGeneralSidebarOpen: !!activeArea,
  2863. selectedWidgetAreaBlock: widgetAreaBlock
  2864. };
  2865. }, []);
  2866. // currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,
  2867. // because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.
  2868. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2869. if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) {
  2870. enableComplementaryArea('core/edit-widgets', BLOCK_INSPECTOR_IDENTIFIER);
  2871. }
  2872. if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) {
  2873. enableComplementaryArea('core/edit-widgets', WIDGET_AREAS_IDENTIFIER);
  2874. }
  2875. }, [hasSelectedNonAreaBlock, enableComplementaryArea]);
  2876. return (0,external_wp_element_namespaceObject.createElement)(complementary_area, {
  2877. className: "edit-widgets-sidebar",
  2878. header: (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaTab, {
  2879. identifier: WIDGET_AREAS_IDENTIFIER,
  2880. label: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0,external_wp_i18n_namespaceObject.__)('Widget Areas'),
  2881. isActive: currentArea === WIDGET_AREAS_IDENTIFIER
  2882. })), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaTab, {
  2883. identifier: BLOCK_INSPECTOR_IDENTIFIER,
  2884. label: (0,external_wp_i18n_namespaceObject.__)('Block'),
  2885. isActive: currentArea === BLOCK_INSPECTOR_IDENTIFIER
  2886. }))),
  2887. headerClassName: "edit-widgets-sidebar__panel-tabs"
  2888. /* translators: button label text should, if possible, be under 16 characters. */,
  2889. title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  2890. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings'),
  2891. scope: "core/edit-widgets",
  2892. identifier: currentArea,
  2893. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right,
  2894. isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
  2895. }, currentArea === WIDGET_AREAS_IDENTIFIER && (0,external_wp_element_namespaceObject.createElement)(WidgetAreas, {
  2896. selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id
  2897. }), currentArea === BLOCK_INSPECTOR_IDENTIFIER && (hasSelectedNonAreaBlock ? (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null) :
  2898. // Pretend that Widget Areas are part of the UI by not
  2899. // showing the Block Inspector when one is selected.
  2900. (0,external_wp_element_namespaceObject.createElement)("span", {
  2901. className: "block-editor-block-inspector__no-blocks"
  2902. }, (0,external_wp_i18n_namespaceObject.__)('No block selected.'))));
  2903. }
  2904. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  2905. /**
  2906. * WordPress dependencies
  2907. */
  2908. const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2909. xmlns: "http://www.w3.org/2000/svg",
  2910. viewBox: "0 0 24 24"
  2911. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2912. d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
  2913. }));
  2914. /* harmony default export */ var library_plus = (plus);
  2915. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
  2916. /**
  2917. * WordPress dependencies
  2918. */
  2919. const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2920. viewBox: "0 0 24 24",
  2921. xmlns: "http://www.w3.org/2000/svg"
  2922. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2923. d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"
  2924. }));
  2925. /* harmony default export */ var list_view = (listView);
  2926. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/save-button/index.js
  2927. /**
  2928. * WordPress dependencies
  2929. */
  2930. /**
  2931. * Internal dependencies
  2932. */
  2933. function SaveButton() {
  2934. const {
  2935. hasEditedWidgetAreaIds,
  2936. isSaving
  2937. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2938. const {
  2939. getEditedWidgetAreas,
  2940. isSavingWidgetAreas
  2941. } = select(store_store);
  2942. return {
  2943. hasEditedWidgetAreaIds: getEditedWidgetAreas()?.length > 0,
  2944. isSaving: isSavingWidgetAreas()
  2945. };
  2946. }, []);
  2947. const {
  2948. saveEditedWidgetAreas
  2949. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2950. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2951. variant: "primary",
  2952. isBusy: isSaving,
  2953. "aria-disabled": isSaving,
  2954. onClick: isSaving ? undefined : saveEditedWidgetAreas,
  2955. disabled: !hasEditedWidgetAreaIds
  2956. }, isSaving ? (0,external_wp_i18n_namespaceObject.__)('Saving…') : (0,external_wp_i18n_namespaceObject.__)('Update'));
  2957. }
  2958. /* harmony default export */ var save_button = (SaveButton);
  2959. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
  2960. /**
  2961. * WordPress dependencies
  2962. */
  2963. const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2964. xmlns: "http://www.w3.org/2000/svg",
  2965. viewBox: "0 0 24 24"
  2966. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2967. 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"
  2968. }));
  2969. /* harmony default export */ var library_undo = (undo);
  2970. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
  2971. /**
  2972. * WordPress dependencies
  2973. */
  2974. const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2975. xmlns: "http://www.w3.org/2000/svg",
  2976. viewBox: "0 0 24 24"
  2977. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2978. 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"
  2979. }));
  2980. /* harmony default export */ var library_redo = (redo);
  2981. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/undo.js
  2982. /**
  2983. * WordPress dependencies
  2984. */
  2985. function UndoButton() {
  2986. const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []);
  2987. const {
  2988. undo
  2989. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  2990. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
  2991. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo,
  2992. label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
  2993. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z')
  2994. // If there are no undo levels we don't want to actually disable this
  2995. // button, because it will remove focus for keyboard users.
  2996. // See: https://github.com/WordPress/gutenberg/issues/3486
  2997. ,
  2998. "aria-disabled": !hasUndo,
  2999. onClick: hasUndo ? undo : undefined
  3000. });
  3001. }
  3002. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/redo.js
  3003. /**
  3004. * WordPress dependencies
  3005. */
  3006. function RedoButton() {
  3007. const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y');
  3008. const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []);
  3009. const {
  3010. redo
  3011. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  3012. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
  3013. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo,
  3014. label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
  3015. shortcut: shortcut
  3016. // If there are no undo levels we don't want to actually disable this
  3017. // button, because it will remove focus for keyboard users.
  3018. // See: https://github.com/WordPress/gutenberg/issues/3486
  3019. ,
  3020. "aria-disabled": !hasRedo,
  3021. onClick: hasRedo ? redo : undefined
  3022. });
  3023. }
  3024. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
  3025. /**
  3026. * WordPress dependencies
  3027. */
  3028. const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  3029. xmlns: "http://www.w3.org/2000/svg",
  3030. viewBox: "0 0 24 24"
  3031. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  3032. 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"
  3033. }));
  3034. /* harmony default export */ var library_external = (external);
  3035. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.js
  3036. /**
  3037. * WordPress dependencies
  3038. */
  3039. const textFormattingShortcuts = [{
  3040. keyCombination: {
  3041. modifier: 'primary',
  3042. character: 'b'
  3043. },
  3044. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
  3045. }, {
  3046. keyCombination: {
  3047. modifier: 'primary',
  3048. character: 'i'
  3049. },
  3050. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
  3051. }, {
  3052. keyCombination: {
  3053. modifier: 'primary',
  3054. character: 'k'
  3055. },
  3056. description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
  3057. }, {
  3058. keyCombination: {
  3059. modifier: 'primaryShift',
  3060. character: 'k'
  3061. },
  3062. description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
  3063. }, {
  3064. keyCombination: {
  3065. character: '[['
  3066. },
  3067. description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.')
  3068. }, {
  3069. keyCombination: {
  3070. modifier: 'primary',
  3071. character: 'u'
  3072. },
  3073. description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
  3074. }, {
  3075. keyCombination: {
  3076. modifier: 'access',
  3077. character: 'd'
  3078. },
  3079. description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.')
  3080. }, {
  3081. keyCombination: {
  3082. modifier: 'access',
  3083. character: 'x'
  3084. },
  3085. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.')
  3086. }, {
  3087. keyCombination: {
  3088. modifier: 'access',
  3089. character: '0'
  3090. },
  3091. description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.')
  3092. }, {
  3093. keyCombination: {
  3094. modifier: 'access',
  3095. character: '1-6'
  3096. },
  3097. description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.')
  3098. }];
  3099. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js
  3100. /**
  3101. * WordPress dependencies
  3102. */
  3103. function KeyCombination({
  3104. keyCombination,
  3105. forceAriaLabel
  3106. }) {
  3107. const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  3108. const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  3109. const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut];
  3110. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  3111. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
  3112. "aria-label": forceAriaLabel || ariaLabel
  3113. }, shortcuts.map((character, index) => {
  3114. if (character === '+') {
  3115. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
  3116. key: index
  3117. }, character);
  3118. }
  3119. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  3120. key: index,
  3121. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key"
  3122. }, character);
  3123. }));
  3124. }
  3125. function Shortcut({
  3126. description,
  3127. keyCombination,
  3128. aliases = [],
  3129. ariaLabel
  3130. }) {
  3131. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  3132. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description"
  3133. }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
  3134. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term"
  3135. }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  3136. keyCombination: keyCombination,
  3137. forceAriaLabel: ariaLabel
  3138. }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  3139. keyCombination: alias,
  3140. forceAriaLabel: ariaLabel,
  3141. key: index
  3142. }))));
  3143. }
  3144. /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
  3145. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
  3146. /**
  3147. * WordPress dependencies
  3148. */
  3149. /**
  3150. * Internal dependencies
  3151. */
  3152. function DynamicShortcut({
  3153. name
  3154. }) {
  3155. const {
  3156. keyCombination,
  3157. description,
  3158. aliases
  3159. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3160. const {
  3161. getShortcutKeyCombination,
  3162. getShortcutDescription,
  3163. getShortcutAliases
  3164. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  3165. return {
  3166. keyCombination: getShortcutKeyCombination(name),
  3167. aliases: getShortcutAliases(name),
  3168. description: getShortcutDescription(name)
  3169. };
  3170. }, [name]);
  3171. if (!keyCombination) {
  3172. return null;
  3173. }
  3174. return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
  3175. keyCombination: keyCombination,
  3176. description: description,
  3177. aliases: aliases
  3178. });
  3179. }
  3180. /* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
  3181. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.js
  3182. /**
  3183. * External dependencies
  3184. */
  3185. /**
  3186. * WordPress dependencies
  3187. */
  3188. /**
  3189. * Internal dependencies
  3190. */
  3191. const ShortcutList = ({
  3192. shortcuts
  3193. }) =>
  3194. /*
  3195. * Disable reason: The `list` ARIA role is redundant but
  3196. * Safari+VoiceOver won't announce the list otherwise.
  3197. */
  3198. /* eslint-disable jsx-a11y/no-redundant-roles */
  3199. (0,external_wp_element_namespaceObject.createElement)("ul", {
  3200. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list",
  3201. role: "list"
  3202. }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
  3203. className: "edit-widgets-keyboard-shortcut-help-modal__shortcut",
  3204. key: index
  3205. }, typeof shortcut === 'string' ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, {
  3206. name: shortcut
  3207. }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
  3208. ...shortcut
  3209. }))))
  3210. /* eslint-enable jsx-a11y/no-redundant-roles */;
  3211. const ShortcutSection = ({
  3212. title,
  3213. shortcuts,
  3214. className
  3215. }) => (0,external_wp_element_namespaceObject.createElement)("section", {
  3216. className: classnames_default()('edit-widgets-keyboard-shortcut-help-modal__section', className)
  3217. }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
  3218. className: "edit-widgets-keyboard-shortcut-help-modal__section-title"
  3219. }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
  3220. shortcuts: shortcuts
  3221. }));
  3222. const ShortcutCategorySection = ({
  3223. title,
  3224. categoryName,
  3225. additionalShortcuts = []
  3226. }) => {
  3227. const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3228. return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
  3229. }, [categoryName]);
  3230. return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3231. title: title,
  3232. shortcuts: categoryShortcuts.concat(additionalShortcuts)
  3233. });
  3234. };
  3235. function KeyboardShortcutHelpModal({
  3236. isModalActive,
  3237. toggleModal
  3238. }) {
  3239. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleModal, {
  3240. bindGlobal: true
  3241. });
  3242. if (!isModalActive) {
  3243. return null;
  3244. }
  3245. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  3246. className: "edit-widgets-keyboard-shortcut-help-modal",
  3247. title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
  3248. onRequestClose: toggleModal
  3249. }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3250. className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts",
  3251. shortcuts: ['core/edit-widgets/keyboard-shortcuts']
  3252. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3253. title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
  3254. categoryName: "global"
  3255. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3256. title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
  3257. categoryName: "selection"
  3258. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3259. title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
  3260. categoryName: "block",
  3261. additionalShortcuts: [{
  3262. keyCombination: {
  3263. character: '/'
  3264. },
  3265. description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
  3266. /* translators: The forward-slash character. e.g. '/'. */
  3267. ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
  3268. }]
  3269. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3270. title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
  3271. shortcuts: textFormattingShortcuts
  3272. }));
  3273. }
  3274. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/tools-more-menu-group.js
  3275. /**
  3276. * WordPress dependencies
  3277. */
  3278. const {
  3279. Fill: ToolsMoreMenuGroup,
  3280. Slot
  3281. } = (0,external_wp_components_namespaceObject.createSlotFill)('EditWidgetsToolsMoreMenuGroup');
  3282. ToolsMoreMenuGroup.Slot = ({
  3283. fillProps
  3284. }) => (0,external_wp_element_namespaceObject.createElement)(Slot, {
  3285. fillProps: fillProps
  3286. }, fills => fills.length > 0 && fills);
  3287. /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
  3288. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/index.js
  3289. /**
  3290. * WordPress dependencies
  3291. */
  3292. /**
  3293. * Internal dependencies
  3294. */
  3295. function MoreMenu() {
  3296. const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0,external_wp_element_namespaceObject.useState)(false);
  3297. const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
  3298. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
  3299. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  3300. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, null, onClose => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  3301. label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
  3302. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3303. scope: "core/edit-widgets",
  3304. name: "fixedToolbar",
  3305. label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
  3306. info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
  3307. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
  3308. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
  3309. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  3310. label: (0,external_wp_i18n_namespaceObject.__)('Tools')
  3311. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  3312. onClick: () => {
  3313. setIsKeyboardShortcutsModalVisible(true);
  3314. },
  3315. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
  3316. }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3317. scope: "core/edit-widgets",
  3318. name: "welcomeGuide",
  3319. label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
  3320. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  3321. role: "menuitem",
  3322. icon: library_external,
  3323. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/block-based-widgets-editor/'),
  3324. target: "_blank",
  3325. rel: "noopener noreferrer"
  3326. }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  3327. as: "span"
  3328. }, /* translators: accessibility text */
  3329. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, {
  3330. fillProps: {
  3331. onClose
  3332. }
  3333. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  3334. label: (0,external_wp_i18n_namespaceObject.__)('Preferences')
  3335. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3336. scope: "core/edit-widgets",
  3337. name: "keepCaretInsideBlock",
  3338. label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block'),
  3339. info: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
  3340. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block activated'),
  3341. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block deactivated')
  3342. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3343. scope: "core/edit-widgets",
  3344. name: "themeStyles",
  3345. info: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'),
  3346. label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles')
  3347. }), isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  3348. scope: "core/edit-widgets",
  3349. name: "showBlockBreadcrumbs",
  3350. label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs'),
  3351. info: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'),
  3352. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs activated'),
  3353. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs deactivated')
  3354. })))), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, {
  3355. isModalActive: isKeyboardShortcutsModalActive,
  3356. toggleModal: toggleKeyboardShortcutsModal
  3357. }));
  3358. }
  3359. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/index.js
  3360. /**
  3361. * WordPress dependencies
  3362. */
  3363. /**
  3364. * Internal dependencies
  3365. */
  3366. const {
  3367. useShouldContextualToolbarShow
  3368. } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
  3369. function Header({
  3370. setListViewToggleElement
  3371. }) {
  3372. const isMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  3373. const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
  3374. const widgetAreaClientId = use_last_selected_widget_area();
  3375. const isLastSelectedWidgetAreaOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
  3376. const {
  3377. isInserterOpen,
  3378. isListViewOpen
  3379. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3380. const {
  3381. isInserterOpened,
  3382. isListViewOpened
  3383. } = select(store_store);
  3384. return {
  3385. isInserterOpen: isInserterOpened(),
  3386. isListViewOpen: isListViewOpened()
  3387. };
  3388. }, []);
  3389. const {
  3390. setIsWidgetAreaOpen,
  3391. setIsInserterOpened,
  3392. setIsListViewOpened
  3393. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3394. const {
  3395. selectBlock
  3396. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  3397. const handleClick = () => {
  3398. if (isInserterOpen) {
  3399. // Focusing the inserter button closes the inserter popover.
  3400. setIsInserterOpened(false);
  3401. } else {
  3402. if (!isLastSelectedWidgetAreaOpen) {
  3403. // Select the last selected block if hasn't already.
  3404. selectBlock(widgetAreaClientId);
  3405. // Open the last selected widget area when opening the inserter.
  3406. setIsWidgetAreaOpen(widgetAreaClientId, true);
  3407. }
  3408. // The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the
  3409. // same tick and pretty much in a random order. The inserter is closed if any other part of the
  3410. // app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then
  3411. // the inserter is visible for a brief moment and then gets auto-closed due to focus moving to
  3412. // the selected block.
  3413. window.requestAnimationFrame(() => setIsInserterOpened(true));
  3414. }
  3415. };
  3416. const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
  3417. const {
  3418. shouldShowContextualToolbar,
  3419. canFocusHiddenToolbar,
  3420. fixedToolbarCanBeFocused
  3421. } = useShouldContextualToolbarShow();
  3422. // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
  3423. // There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
  3424. const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
  3425. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  3426. className: "edit-widgets-header"
  3427. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  3428. className: "edit-widgets-header__navigable-toolbar-wrapper"
  3429. }, isMediumViewport && (0,external_wp_element_namespaceObject.createElement)("h1", {
  3430. className: "edit-widgets-header__title"
  3431. }, (0,external_wp_i18n_namespaceObject.__)('Widgets')), !isMediumViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  3432. as: "h1",
  3433. className: "edit-widgets-header__title"
  3434. }, (0,external_wp_i18n_namespaceObject.__)('Widgets')), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
  3435. className: "edit-widgets-header-toolbar",
  3436. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools'),
  3437. shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused
  3438. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  3439. ref: inserterButton,
  3440. as: external_wp_components_namespaceObject.Button,
  3441. className: "edit-widgets-header-toolbar__inserter-toggle",
  3442. variant: "primary",
  3443. isPressed: isInserterOpen,
  3444. onMouseDown: event => {
  3445. event.preventDefault();
  3446. },
  3447. onClick: handleClick,
  3448. icon: library_plus
  3449. /* translators: button label text should, if possible, be under 16
  3450. characters. */,
  3451. label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button')
  3452. }), isMediumViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(UndoButton, null), (0,external_wp_element_namespaceObject.createElement)(RedoButton, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  3453. as: external_wp_components_namespaceObject.Button,
  3454. className: "edit-widgets-header-toolbar__list-view-toggle",
  3455. icon: list_view,
  3456. isPressed: isListViewOpen
  3457. /* translators: button label text should, if possible, be under 16 characters. */,
  3458. label: (0,external_wp_i18n_namespaceObject.__)('List View'),
  3459. onClick: toggleListView,
  3460. ref: setListViewToggleElement
  3461. })))), (0,external_wp_element_namespaceObject.createElement)("div", {
  3462. className: "edit-widgets-header__actions"
  3463. }, (0,external_wp_element_namespaceObject.createElement)(save_button, null), (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
  3464. scope: "core/edit-widgets"
  3465. }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, null))));
  3466. }
  3467. /* harmony default export */ var header = (Header);
  3468. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/notices/index.js
  3469. /**
  3470. * WordPress dependencies
  3471. */
  3472. function Notices() {
  3473. const {
  3474. removeNotice
  3475. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  3476. const {
  3477. notices
  3478. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3479. return {
  3480. notices: select(external_wp_notices_namespaceObject.store).getNotices()
  3481. };
  3482. }, []);
  3483. const dismissibleNotices = notices.filter(({
  3484. isDismissible,
  3485. type
  3486. }) => isDismissible && type === 'default');
  3487. const nonDismissibleNotices = notices.filter(({
  3488. isDismissible,
  3489. type
  3490. }) => !isDismissible && type === 'default');
  3491. const snackbarNotices = notices.filter(({
  3492. type
  3493. }) => type === 'snackbar');
  3494. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
  3495. notices: nonDismissibleNotices,
  3496. className: "edit-widgets-notices__pinned"
  3497. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
  3498. notices: dismissibleNotices,
  3499. className: "edit-widgets-notices__dismissible",
  3500. onRemove: removeNotice
  3501. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SnackbarList, {
  3502. notices: snackbarNotices,
  3503. className: "edit-widgets-notices__snackbar",
  3504. onRemove: removeNotice
  3505. }));
  3506. }
  3507. /* harmony default export */ var notices = (Notices);
  3508. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-content/index.js
  3509. /**
  3510. * WordPress dependencies
  3511. */
  3512. /**
  3513. * Internal dependencies
  3514. */
  3515. function WidgetAreasBlockEditorContent({
  3516. blockEditorSettings
  3517. }) {
  3518. const hasThemeStyles = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'themeStyles'), []);
  3519. const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3520. return hasThemeStyles ? blockEditorSettings.styles : [];
  3521. }, [blockEditorSettings, hasThemeStyles]);
  3522. return (0,external_wp_element_namespaceObject.createElement)("div", {
  3523. className: "edit-widgets-block-editor"
  3524. }, (0,external_wp_element_namespaceObject.createElement)(notices, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, null, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  3525. styles: styles,
  3526. scope: ".editor-styles-wrapper"
  3527. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSelectionClearer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
  3528. className: "edit-widgets-main-block-list"
  3529. })))));
  3530. }
  3531. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  3532. /**
  3533. * WordPress dependencies
  3534. */
  3535. const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  3536. xmlns: "http://www.w3.org/2000/svg",
  3537. viewBox: "0 0 24 24"
  3538. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  3539. d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
  3540. }));
  3541. /* harmony default export */ var library_close = (close_close);
  3542. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-widget-library-insertion-point.js
  3543. /**
  3544. * WordPress dependencies
  3545. */
  3546. /**
  3547. * Internal dependencies
  3548. */
  3549. const useWidgetLibraryInsertionPoint = () => {
  3550. const firstRootId = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3551. // Default to the first widget area
  3552. const {
  3553. getEntityRecord
  3554. } = select(external_wp_coreData_namespaceObject.store);
  3555. const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId());
  3556. return widgetAreasPost?.blocks[0]?.clientId;
  3557. }, []);
  3558. return (0,external_wp_data_namespaceObject.useSelect)(select => {
  3559. const {
  3560. getBlockRootClientId,
  3561. getBlockSelectionEnd,
  3562. getBlockOrder,
  3563. getBlockIndex
  3564. } = select(external_wp_blockEditor_namespaceObject.store);
  3565. const insertionPoint = select(store_store).__experimentalGetInsertionPoint();
  3566. // "Browse all" in the quick inserter will set the rootClientId to the current block.
  3567. // Otherwise, it will just be undefined, and we'll have to handle it differently below.
  3568. if (insertionPoint.rootClientId) {
  3569. return insertionPoint;
  3570. }
  3571. const clientId = getBlockSelectionEnd() || firstRootId;
  3572. const rootClientId = getBlockRootClientId(clientId);
  3573. // If the selected block is at the root level, it's a widget area and
  3574. // blocks can't be inserted here. Return this block as the root and the
  3575. // last child clientId indicating insertion at the end.
  3576. if (clientId && rootClientId === '') {
  3577. return {
  3578. rootClientId: clientId,
  3579. insertionIndex: getBlockOrder(clientId).length
  3580. };
  3581. }
  3582. return {
  3583. rootClientId,
  3584. insertionIndex: getBlockIndex(clientId) + 1
  3585. };
  3586. }, [firstRootId]);
  3587. };
  3588. /* harmony default export */ var use_widget_library_insertion_point = (useWidgetLibraryInsertionPoint);
  3589. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.js
  3590. /**
  3591. * WordPress dependencies
  3592. */
  3593. /**
  3594. * Internal dependencies
  3595. */
  3596. function InserterSidebar() {
  3597. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  3598. const {
  3599. rootClientId,
  3600. insertionIndex
  3601. } = use_widget_library_insertion_point();
  3602. const {
  3603. setIsInserterOpened
  3604. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3605. const closeInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
  3606. return setIsInserterOpened(false);
  3607. }, [setIsInserterOpened]);
  3608. const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div';
  3609. const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
  3610. onClose: closeInserter,
  3611. focusOnMount: null
  3612. });
  3613. const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
  3614. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3615. libraryRef.current.focusSearch();
  3616. }, []);
  3617. return (0,external_wp_element_namespaceObject.createElement)("div", {
  3618. ref: inserterDialogRef,
  3619. ...inserterDialogProps,
  3620. className: "edit-widgets-layout__inserter-panel"
  3621. }, (0,external_wp_element_namespaceObject.createElement)(TagName, {
  3622. className: "edit-widgets-layout__inserter-panel-header"
  3623. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3624. icon: library_close,
  3625. onClick: closeInserter,
  3626. label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter')
  3627. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  3628. className: "edit-widgets-layout__inserter-panel-content"
  3629. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
  3630. showInserterHelpPanel: true,
  3631. shouldFocusBlock: isMobileViewport,
  3632. rootClientId: rootClientId,
  3633. __experimentalInsertionIndex: insertionIndex,
  3634. ref: libraryRef
  3635. })));
  3636. }
  3637. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/list-view-sidebar.js
  3638. /**
  3639. * WordPress dependencies
  3640. */
  3641. /**
  3642. * Internal dependencies
  3643. */
  3644. function ListViewSidebar({
  3645. listViewToggleElement
  3646. }) {
  3647. const {
  3648. setIsListViewOpened
  3649. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3650. // Use internal state instead of a ref to make sure that the component
  3651. // re-renders when the dropZoneElement updates.
  3652. const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null);
  3653. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
  3654. // When closing the list view, focus should return to the toggle button.
  3655. const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => {
  3656. setIsListViewOpened(false);
  3657. listViewToggleElement?.focus();
  3658. }, [listViewToggleElement, setIsListViewOpened]);
  3659. const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => {
  3660. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
  3661. event.preventDefault();
  3662. closeListView();
  3663. }
  3664. }, [closeListView]);
  3665. return (
  3666. // eslint-disable-next-line jsx-a11y/no-static-element-interactions
  3667. (0,external_wp_element_namespaceObject.createElement)("div", {
  3668. className: "edit-widgets-editor__list-view-panel",
  3669. onKeyDown: closeOnEscape
  3670. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  3671. className: "edit-widgets-editor__list-view-panel-header"
  3672. }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3673. icon: close_small,
  3674. label: (0,external_wp_i18n_namespaceObject.__)('Close'),
  3675. onClick: closeListView
  3676. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  3677. className: "edit-widgets-editor__list-view-panel-content",
  3678. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, setDropZoneElement])
  3679. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, {
  3680. dropZoneElement: dropZoneElement
  3681. })))
  3682. );
  3683. }
  3684. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/secondary-sidebar/index.js
  3685. /**
  3686. * WordPress dependencies
  3687. */
  3688. /**
  3689. * Internal dependencies
  3690. */
  3691. /**
  3692. * Internal dependencies
  3693. */
  3694. function SecondarySidebar({
  3695. listViewToggleElement
  3696. }) {
  3697. const {
  3698. isInserterOpen,
  3699. isListViewOpen
  3700. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3701. const {
  3702. isInserterOpened,
  3703. isListViewOpened
  3704. } = select(store_store);
  3705. return {
  3706. isInserterOpen: isInserterOpened(),
  3707. isListViewOpen: isListViewOpened()
  3708. };
  3709. }, []);
  3710. if (isInserterOpen) {
  3711. return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null);
  3712. }
  3713. if (isListViewOpen) {
  3714. return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, {
  3715. listViewToggleElement: listViewToggleElement
  3716. });
  3717. }
  3718. return null;
  3719. }
  3720. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/interface.js
  3721. /**
  3722. * WordPress dependencies
  3723. */
  3724. /**
  3725. * Internal dependencies
  3726. */
  3727. const interfaceLabels = {
  3728. /* translators: accessibility text for the widgets screen top bar landmark region. */
  3729. header: (0,external_wp_i18n_namespaceObject.__)('Widgets top bar'),
  3730. /* translators: accessibility text for the widgets screen content landmark region. */
  3731. body: (0,external_wp_i18n_namespaceObject.__)('Widgets and blocks'),
  3732. /* translators: accessibility text for the widgets screen settings landmark region. */
  3733. sidebar: (0,external_wp_i18n_namespaceObject.__)('Widgets settings'),
  3734. /* translators: accessibility text for the widgets screen footer landmark region. */
  3735. footer: (0,external_wp_i18n_namespaceObject.__)('Widgets footer')
  3736. };
  3737. function Interface({
  3738. blockEditorSettings
  3739. }) {
  3740. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  3741. const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
  3742. const {
  3743. setIsInserterOpened,
  3744. setIsListViewOpened,
  3745. closeGeneralSidebar
  3746. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3747. const {
  3748. hasBlockBreadCrumbsEnabled,
  3749. hasSidebarEnabled,
  3750. isInserterOpened,
  3751. isListViewOpened,
  3752. previousShortcut,
  3753. nextShortcut
  3754. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  3755. hasSidebarEnabled: !!select(store).getActiveComplementaryArea(store_store.name),
  3756. isInserterOpened: !!select(store_store).isInserterOpened(),
  3757. isListViewOpened: !!select(store_store).isListViewOpened(),
  3758. hasBlockBreadCrumbsEnabled: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'showBlockBreadcrumbs'),
  3759. previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'),
  3760. nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-widgets/next-region')
  3761. }), []);
  3762. const [listViewToggleElement, setListViewToggleElement] = (0,external_wp_element_namespaceObject.useState)(null);
  3763. // Inserter and Sidebars are mutually exclusive
  3764. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3765. if (hasSidebarEnabled && !isHugeViewport) {
  3766. setIsInserterOpened(false);
  3767. setIsListViewOpened(false);
  3768. }
  3769. }, [hasSidebarEnabled, isHugeViewport]);
  3770. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3771. if ((isInserterOpened || isListViewOpened) && !isHugeViewport) {
  3772. closeGeneralSidebar();
  3773. }
  3774. }, [isInserterOpened, isListViewOpened, isHugeViewport]);
  3775. const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
  3776. const hasSecondarySidebar = isListViewOpened || isInserterOpened;
  3777. return (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
  3778. labels: {
  3779. ...interfaceLabels,
  3780. secondarySidebar: secondarySidebarLabel
  3781. },
  3782. header: (0,external_wp_element_namespaceObject.createElement)(header, {
  3783. setListViewToggleElement: setListViewToggleElement
  3784. }),
  3785. secondarySidebar: hasSecondarySidebar && (0,external_wp_element_namespaceObject.createElement)(SecondarySidebar, {
  3786. listViewToggleElement: listViewToggleElement
  3787. }),
  3788. sidebar: hasSidebarEnabled && (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, {
  3789. scope: "core/edit-widgets"
  3790. }),
  3791. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(WidgetAreasBlockEditorContent, {
  3792. blockEditorSettings: blockEditorSettings
  3793. })),
  3794. footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && (0,external_wp_element_namespaceObject.createElement)("div", {
  3795. className: "edit-widgets-layout__footer"
  3796. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
  3797. rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Widgets')
  3798. })),
  3799. shortcuts: {
  3800. previous: previousShortcut,
  3801. next: nextShortcut
  3802. }
  3803. });
  3804. }
  3805. /* harmony default export */ var layout_interface = (Interface);
  3806. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/unsaved-changes-warning.js
  3807. /**
  3808. * WordPress dependencies
  3809. */
  3810. /**
  3811. * Internal dependencies
  3812. */
  3813. /**
  3814. * Warns the user if there are unsaved changes before leaving the editor.
  3815. *
  3816. * This is a duplicate of the component implemented in the editor package.
  3817. * Duplicated here as edit-widgets doesn't depend on editor.
  3818. *
  3819. * @return {WPComponent} The component.
  3820. */
  3821. function UnsavedChangesWarning() {
  3822. const isDirty = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3823. const {
  3824. getEditedWidgetAreas
  3825. } = select(store_store);
  3826. const editedWidgetAreas = getEditedWidgetAreas();
  3827. return editedWidgetAreas?.length > 0;
  3828. }, []);
  3829. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3830. /**
  3831. * Warns the user if there are unsaved changes before leaving the editor.
  3832. *
  3833. * @param {Event} event `beforeunload` event.
  3834. *
  3835. * @return {string | undefined} Warning prompt message, if unsaved changes exist.
  3836. */
  3837. const warnIfUnsavedChanges = event => {
  3838. if (isDirty) {
  3839. event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.');
  3840. return event.returnValue;
  3841. }
  3842. };
  3843. window.addEventListener('beforeunload', warnIfUnsavedChanges);
  3844. return () => {
  3845. window.removeEventListener('beforeunload', warnIfUnsavedChanges);
  3846. };
  3847. }, [isDirty]);
  3848. return null;
  3849. }
  3850. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/welcome-guide/index.js
  3851. /**
  3852. * WordPress dependencies
  3853. */
  3854. /**
  3855. * Internal dependencies
  3856. */
  3857. function WelcomeGuide() {
  3858. var _widgetAreas$filter$l;
  3859. const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-widgets', 'welcomeGuide'), []);
  3860. const {
  3861. toggle
  3862. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
  3863. const widgetAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getWidgetAreas({
  3864. per_page: -1
  3865. }), []);
  3866. if (!isActive) {
  3867. return null;
  3868. }
  3869. const isEntirelyBlockWidgets = widgetAreas?.every(widgetArea => widgetArea.id === 'wp_inactive_widgets' || widgetArea.widgets.every(widgetId => widgetId.startsWith('block-')));
  3870. const numWidgetAreas = (_widgetAreas$filter$l = widgetAreas?.filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets').length) !== null && _widgetAreas$filter$l !== void 0 ? _widgetAreas$filter$l : 0;
  3871. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
  3872. className: "edit-widgets-welcome-guide",
  3873. contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets'),
  3874. finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
  3875. onFinish: () => toggle('core/edit-widgets', 'welcomeGuide'),
  3876. pages: [{
  3877. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  3878. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
  3879. animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
  3880. }),
  3881. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  3882. className: "edit-widgets-welcome-guide__heading"
  3883. }, (0,external_wp_i18n_namespaceObject.__)('Welcome to block Widgets')), isEntirelyBlockWidgets ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", {
  3884. className: "edit-widgets-welcome-guide__text"
  3885. }, (0,external_wp_i18n_namespaceObject.sprintf)(
  3886. // Translators: %s: Number of block areas in the current theme.
  3887. (0,external_wp_i18n_namespaceObject._n)('Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', 'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', numWidgetAreas), numWidgetAreas))) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", {
  3888. className: "edit-widgets-welcome-guide__text"
  3889. }, (0,external_wp_i18n_namespaceObject.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), (0,external_wp_element_namespaceObject.createElement)("p", {
  3890. className: "edit-widgets-welcome-guide__text"
  3891. }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Want to stick with the old widgets?')), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  3892. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/plugins/classic-widgets/')
  3893. }, (0,external_wp_i18n_namespaceObject.__)('Get the Classic Widgets plugin.')))))
  3894. }, {
  3895. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  3896. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
  3897. animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
  3898. }),
  3899. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  3900. className: "edit-widgets-welcome-guide__heading"
  3901. }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", {
  3902. className: "edit-widgets-welcome-guide__text"
  3903. }, (0,external_wp_i18n_namespaceObject.__)('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.')))
  3904. }, {
  3905. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  3906. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
  3907. animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
  3908. }),
  3909. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  3910. className: "edit-widgets-welcome-guide__heading"
  3911. }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", {
  3912. className: "edit-widgets-welcome-guide__text"
  3913. }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), {
  3914. InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", {
  3915. className: "edit-widgets-welcome-guide__inserter-icon",
  3916. alt: (0,external_wp_i18n_namespaceObject.__)('inserter'),
  3917. 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"
  3918. })
  3919. })))
  3920. }, {
  3921. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  3922. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
  3923. animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
  3924. }),
  3925. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  3926. className: "edit-widgets-welcome-guide__heading"
  3927. }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
  3928. className: "edit-widgets-welcome-guide__text"
  3929. }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  3930. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/')
  3931. }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide."))))
  3932. }]
  3933. });
  3934. }
  3935. function WelcomeGuideImage({
  3936. nonAnimatedSrc,
  3937. animatedSrc
  3938. }) {
  3939. return (0,external_wp_element_namespaceObject.createElement)("picture", {
  3940. className: "edit-widgets-welcome-guide__image"
  3941. }, (0,external_wp_element_namespaceObject.createElement)("source", {
  3942. srcSet: nonAnimatedSrc,
  3943. media: "(prefers-reduced-motion: reduce)"
  3944. }), (0,external_wp_element_namespaceObject.createElement)("img", {
  3945. src: animatedSrc,
  3946. width: "312",
  3947. height: "240",
  3948. alt: ""
  3949. }));
  3950. }
  3951. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/index.js
  3952. /**
  3953. * WordPress dependencies
  3954. */
  3955. /**
  3956. * Internal dependencies
  3957. */
  3958. function Layout({
  3959. blockEditorSettings
  3960. }) {
  3961. const {
  3962. createErrorNotice
  3963. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  3964. function onPluginAreaError(name) {
  3965. createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */
  3966. (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
  3967. }
  3968. return (0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, null, (0,external_wp_element_namespaceObject.createElement)(WidgetAreasBlockEditorProvider, {
  3969. blockEditorSettings: blockEditorSettings
  3970. }, (0,external_wp_element_namespaceObject.createElement)(layout_interface, {
  3971. blockEditorSettings: blockEditorSettings
  3972. }), (0,external_wp_element_namespaceObject.createElement)(Sidebar, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
  3973. onError: onPluginAreaError
  3974. }), (0,external_wp_element_namespaceObject.createElement)(UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null)));
  3975. }
  3976. /* harmony default export */ var layout = (Layout);
  3977. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/index.js
  3978. /**
  3979. * WordPress dependencies
  3980. */
  3981. /**
  3982. * Internal dependencies
  3983. */
  3984. const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
  3985. /**
  3986. * Initializes the block editor in the widgets screen.
  3987. *
  3988. * @param {string} id ID of the root element to render the screen in.
  3989. * @param {Object} settings Block editor settings.
  3990. */
  3991. function initializeEditor(id, settings) {
  3992. const target = document.getElementById(id);
  3993. const root = (0,external_wp_element_namespaceObject.createRoot)(target);
  3994. const coreBlocks = (0,external_wp_blockLibrary_namespaceObject.__experimentalGetCoreBlocks)().filter(block => {
  3995. 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'));
  3996. });
  3997. (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-widgets', {
  3998. fixedToolbar: false,
  3999. welcomeGuide: true,
  4000. showBlockBreadcrumbs: true,
  4001. themeStyles: true
  4002. });
  4003. (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters();
  4004. (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(coreBlocks);
  4005. (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)();
  4006. if (false) {}
  4007. (0,external_wp_widgets_namespaceObject.registerLegacyWidgetVariations)(settings);
  4008. registerBlock(widget_area_namespaceObject);
  4009. (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)();
  4010. settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
  4011. // As we are unregistering `core/freeform` to avoid the Classic block, we must
  4012. // replace it with something as the default freeform content handler. Failure to
  4013. // do this will result in errors in the default block parser.
  4014. // see: https://github.com/WordPress/gutenberg/issues/33097
  4015. (0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)('core/html');
  4016. root.render((0,external_wp_element_namespaceObject.createElement)(layout, {
  4017. blockEditorSettings: settings
  4018. }));
  4019. return root;
  4020. }
  4021. /**
  4022. * Compatibility export under the old `initialize` name.
  4023. */
  4024. const initialize = initializeEditor;
  4025. function reinitializeEditor() {
  4026. external_wp_deprecated_default()('wp.editWidgets.reinitializeEditor', {
  4027. since: '6.2',
  4028. version: '6.3'
  4029. });
  4030. }
  4031. /**
  4032. * Function to register an individual block.
  4033. *
  4034. * @param {Object} block The block to be registered.
  4035. */
  4036. const registerBlock = block => {
  4037. if (!block) {
  4038. return;
  4039. }
  4040. const {
  4041. metadata,
  4042. settings,
  4043. name
  4044. } = block;
  4045. if (metadata) {
  4046. (0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({
  4047. [name]: metadata
  4048. });
  4049. }
  4050. (0,external_wp_blocks_namespaceObject.registerBlockType)(name, settings);
  4051. };
  4052. }();
  4053. (window.wp = window.wp || {}).editWidgets = __webpack_exports__;
  4054. /******/ })()
  4055. ;