wp/wp-includes/js/dist/preferences.js
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     1 /******/ (function() { // webpackBootstrap
     1 /******/ (() => { // webpackBootstrap
     2 /******/ 	"use strict";
     2 /******/ 	"use strict";
     3 /******/ 	// The require scope
     3 /******/ 	// The require scope
     4 /******/ 	var __webpack_require__ = {};
     4 /******/ 	var __webpack_require__ = {};
     5 /******/ 	
     5 /******/ 	
     6 /************************************************************************/
     6 /************************************************************************/
       
     7 /******/ 	/* webpack/runtime/compat get default export */
       
     8 /******/ 	(() => {
       
     9 /******/ 		// getDefaultExport function for compatibility with non-harmony modules
       
    10 /******/ 		__webpack_require__.n = (module) => {
       
    11 /******/ 			var getter = module && module.__esModule ?
       
    12 /******/ 				() => (module['default']) :
       
    13 /******/ 				() => (module);
       
    14 /******/ 			__webpack_require__.d(getter, { a: getter });
       
    15 /******/ 			return getter;
       
    16 /******/ 		};
       
    17 /******/ 	})();
       
    18 /******/ 	
     7 /******/ 	/* webpack/runtime/define property getters */
    19 /******/ 	/* webpack/runtime/define property getters */
     8 /******/ 	!function() {
    20 /******/ 	(() => {
     9 /******/ 		// define getter functions for harmony exports
    21 /******/ 		// define getter functions for harmony exports
    10 /******/ 		__webpack_require__.d = function(exports, definition) {
    22 /******/ 		__webpack_require__.d = (exports, definition) => {
    11 /******/ 			for(var key in definition) {
    23 /******/ 			for(var key in definition) {
    12 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    24 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    13 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    25 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    14 /******/ 				}
    26 /******/ 				}
    15 /******/ 			}
    27 /******/ 			}
    16 /******/ 		};
    28 /******/ 		};
    17 /******/ 	}();
    29 /******/ 	})();
    18 /******/ 	
    30 /******/ 	
    19 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    31 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    20 /******/ 	!function() {
    32 /******/ 	(() => {
    21 /******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
    33 /******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
    22 /******/ 	}();
    34 /******/ 	})();
    23 /******/ 	
    35 /******/ 	
    24 /******/ 	/* webpack/runtime/make namespace object */
    36 /******/ 	/* webpack/runtime/make namespace object */
    25 /******/ 	!function() {
    37 /******/ 	(() => {
    26 /******/ 		// define __esModule on exports
    38 /******/ 		// define __esModule on exports
    27 /******/ 		__webpack_require__.r = function(exports) {
    39 /******/ 		__webpack_require__.r = (exports) => {
    28 /******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    40 /******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    29 /******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    41 /******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    30 /******/ 			}
    42 /******/ 			}
    31 /******/ 			Object.defineProperty(exports, '__esModule', { value: true });
    43 /******/ 			Object.defineProperty(exports, '__esModule', { value: true });
    32 /******/ 		};
    44 /******/ 		};
    33 /******/ 	}();
    45 /******/ 	})();
    34 /******/ 	
    46 /******/ 	
    35 /************************************************************************/
    47 /************************************************************************/
    36 var __webpack_exports__ = {};
    48 var __webpack_exports__ = {};
    37 // ESM COMPAT FLAG
    49 // ESM COMPAT FLAG
    38 __webpack_require__.r(__webpack_exports__);
    50 __webpack_require__.r(__webpack_exports__);
    39 
    51 
    40 // EXPORTS
    52 // EXPORTS
    41 __webpack_require__.d(__webpack_exports__, {
    53 __webpack_require__.d(__webpack_exports__, {
    42   "PreferenceToggleMenuItem": function() { return /* reexport */ PreferenceToggleMenuItem; },
    54   PreferenceToggleMenuItem: () => (/* reexport */ PreferenceToggleMenuItem),
    43   "store": function() { return /* reexport */ store; }
    55   privateApis: () => (/* reexport */ privateApis),
       
    56   store: () => (/* reexport */ store)
    44 });
    57 });
    45 
    58 
    46 // NAMESPACE OBJECT: ./node_modules/@wordpress/preferences/build-module/store/actions.js
    59 // NAMESPACE OBJECT: ./node_modules/@wordpress/preferences/build-module/store/actions.js
    47 var actions_namespaceObject = {};
    60 var actions_namespaceObject = {};
    48 __webpack_require__.r(actions_namespaceObject);
    61 __webpack_require__.r(actions_namespaceObject);
    49 __webpack_require__.d(actions_namespaceObject, {
    62 __webpack_require__.d(actions_namespaceObject, {
    50   "set": function() { return set; },
    63   set: () => (set),
    51   "setDefaults": function() { return setDefaults; },
    64   setDefaults: () => (setDefaults),
    52   "toggle": function() { return toggle; }
    65   setPersistenceLayer: () => (setPersistenceLayer),
       
    66   toggle: () => (toggle)
    53 });
    67 });
    54 
    68 
    55 // NAMESPACE OBJECT: ./node_modules/@wordpress/preferences/build-module/store/selectors.js
    69 // NAMESPACE OBJECT: ./node_modules/@wordpress/preferences/build-module/store/selectors.js
    56 var selectors_namespaceObject = {};
    70 var selectors_namespaceObject = {};
    57 __webpack_require__.r(selectors_namespaceObject);
    71 __webpack_require__.r(selectors_namespaceObject);
    58 __webpack_require__.d(selectors_namespaceObject, {
    72 __webpack_require__.d(selectors_namespaceObject, {
    59   "get": function() { return get; }
    73   get: () => (get)
    60 });
    74 });
    61 
    75 
    62 ;// CONCATENATED MODULE: external ["wp","element"]
       
    63 var external_wp_element_namespaceObject = window["wp"]["element"];
       
    64 ;// CONCATENATED MODULE: external ["wp","data"]
    76 ;// CONCATENATED MODULE: external ["wp","data"]
    65 var external_wp_data_namespaceObject = window["wp"]["data"];
    77 const external_wp_data_namespaceObject = window["wp"]["data"];
    66 ;// CONCATENATED MODULE: external ["wp","components"]
    78 ;// CONCATENATED MODULE: external ["wp","components"]
    67 var external_wp_components_namespaceObject = window["wp"]["components"];
    79 const external_wp_components_namespaceObject = window["wp"]["components"];
    68 ;// CONCATENATED MODULE: external ["wp","i18n"]
    80 ;// CONCATENATED MODULE: external ["wp","i18n"]
    69 var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
    81 const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
    70 ;// CONCATENATED MODULE: external ["wp","primitives"]
    82 ;// CONCATENATED MODULE: external ["wp","primitives"]
    71 var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
    83 const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
       
    84 ;// CONCATENATED MODULE: external "ReactJSXRuntime"
       
    85 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
    72 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
    86 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
    73 
    87 /**
    74 
    88  * WordPress dependencies
    75 /**
    89  */
    76  * WordPress dependencies
    90 
    77  */
    91 
    78 
    92 const check = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
    79 const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
       
    80   xmlns: "http://www.w3.org/2000/svg",
    93   xmlns: "http://www.w3.org/2000/svg",
    81   viewBox: "0 0 24 24"
    94   viewBox: "0 0 24 24",
    82 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
    95   children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
    83   d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
    96     d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
    84 }));
    97   })
    85 /* harmony default export */ var library_check = (check);
    98 });
       
    99 /* harmony default export */ const library_check = (check);
    86 
   100 
    87 ;// CONCATENATED MODULE: external ["wp","a11y"]
   101 ;// CONCATENATED MODULE: external ["wp","a11y"]
    88 var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
   102 const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
    89 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/reducer.js
   103 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/reducer.js
    90 /**
   104 /**
    91  * WordPress dependencies
   105  * WordPress dependencies
    92  */
   106  */
       
   107 
    93 
   108 
    94 /**
   109 /**
    95  * Reducer returning the defaults for user preferences.
   110  * Reducer returning the defaults for user preferences.
    96  *
   111  *
    97  * This is kept intentionally separate from the preferences
   112  * This is kept intentionally separate from the preferences
   100  * @param {Object} state  Current state.
   115  * @param {Object} state  Current state.
   101  * @param {Object} action Dispatched action.
   116  * @param {Object} action Dispatched action.
   102  *
   117  *
   103  * @return {Object} Updated state.
   118  * @return {Object} Updated state.
   104  */
   119  */
   105 
   120 function defaults(state = {}, action) {
   106 function defaults() {
       
   107   let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
       
   108   let action = arguments.length > 1 ? arguments[1] : undefined;
       
   109 
       
   110   if (action.type === 'SET_PREFERENCE_DEFAULTS') {
   121   if (action.type === 'SET_PREFERENCE_DEFAULTS') {
   111     const {
   122     const {
   112       scope,
   123       scope,
   113       defaults: values
   124       defaults: values
   114     } = action;
   125     } = action;
   115     return { ...state,
   126     return {
   116       [scope]: { ...state[scope],
   127       ...state,
       
   128       [scope]: {
       
   129         ...state[scope],
   117         ...values
   130         ...values
   118       }
   131       }
   119     };
   132     };
   120   }
   133   }
   121 
       
   122   return state;
   134   return state;
   123 }
   135 }
       
   136 
       
   137 /**
       
   138  * Higher order reducer that does the following:
       
   139  * - Merges any data from the persistence layer into the state when the
       
   140  *   `SET_PERSISTENCE_LAYER` action is received.
       
   141  * - Passes any preferences changes to the persistence layer.
       
   142  *
       
   143  * @param {Function} reducer The preferences reducer.
       
   144  *
       
   145  * @return {Function} The enhanced reducer.
       
   146  */
       
   147 function withPersistenceLayer(reducer) {
       
   148   let persistenceLayer;
       
   149   return (state, action) => {
       
   150     // Setup the persistence layer, and return the persisted data
       
   151     // as the state.
       
   152     if (action.type === 'SET_PERSISTENCE_LAYER') {
       
   153       const {
       
   154         persistenceLayer: persistence,
       
   155         persistedData
       
   156       } = action;
       
   157       persistenceLayer = persistence;
       
   158       return persistedData;
       
   159     }
       
   160     const nextState = reducer(state, action);
       
   161     if (action.type === 'SET_PREFERENCE_VALUE') {
       
   162       persistenceLayer?.set(nextState);
       
   163     }
       
   164     return nextState;
       
   165   };
       
   166 }
       
   167 
   124 /**
   168 /**
   125  * Reducer returning the user preferences.
   169  * Reducer returning the user preferences.
   126  *
   170  *
   127  * @param {Object} state  Current state.
   171  * @param {Object} state  Current state.
   128  * @param {Object} action Dispatched action.
   172  * @param {Object} action Dispatched action.
   129  *
   173  *
   130  * @return {Object} Updated state.
   174  * @return {Object} Updated state.
   131  */
   175  */
   132 
   176 const preferences = withPersistenceLayer((state = {}, action) => {
   133 function preferences() {
       
   134   let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
       
   135   let action = arguments.length > 1 ? arguments[1] : undefined;
       
   136 
       
   137   if (action.type === 'SET_PREFERENCE_VALUE') {
   177   if (action.type === 'SET_PREFERENCE_VALUE') {
   138     const {
   178     const {
   139       scope,
   179       scope,
   140       name,
   180       name,
   141       value
   181       value
   142     } = action;
   182     } = action;
   143     return { ...state,
   183     return {
   144       [scope]: { ...state[scope],
   184       ...state,
       
   185       [scope]: {
       
   186         ...state[scope],
   145         [name]: value
   187         [name]: value
   146       }
   188       }
   147     };
   189     };
   148   }
   190   }
   149 
       
   150   return state;
   191   return state;
   151 }
   192 });
   152 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
   193 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
   153   defaults,
   194   defaults,
   154   preferences
   195   preferences
   155 }));
   196 }));
   156 
   197 
   157 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/actions.js
   198 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/actions.js
   161  *
   202  *
   162  * @param {string} scope The preference scope (e.g. core/edit-post).
   203  * @param {string} scope The preference scope (e.g. core/edit-post).
   163  * @param {string} name  The preference name.
   204  * @param {string} name  The preference name.
   164  */
   205  */
   165 function toggle(scope, name) {
   206 function toggle(scope, name) {
   166   return function (_ref) {
   207   return function ({
   167     let {
   208     select,
   168       select,
   209     dispatch
   169       dispatch
   210   }) {
   170     } = _ref;
       
   171     const currentValue = select.get(scope, name);
   211     const currentValue = select.get(scope, name);
   172     dispatch.set(scope, name, !currentValue);
   212     dispatch.set(scope, name, !currentValue);
   173   };
   213   };
   174 }
   214 }
       
   215 
   175 /**
   216 /**
   176  * Returns an action object used in signalling that a preference should be set
   217  * Returns an action object used in signalling that a preference should be set
   177  * to a value
   218  * to a value
   178  *
   219  *
   179  * @param {string} scope The preference scope (e.g. core/edit-post).
   220  * @param {string} scope The preference scope (e.g. core/edit-post).
   180  * @param {string} name  The preference name.
   221  * @param {string} name  The preference name.
   181  * @param {*}      value The value to set.
   222  * @param {*}      value The value to set.
   182  *
   223  *
   183  * @return {Object} Action object.
   224  * @return {Object} Action object.
   184  */
   225  */
   185 
       
   186 function set(scope, name, value) {
   226 function set(scope, name, value) {
   187   return {
   227   return {
   188     type: 'SET_PREFERENCE_VALUE',
   228     type: 'SET_PREFERENCE_VALUE',
   189     scope,
   229     scope,
   190     name,
   230     name,
   191     value
   231     value
   192   };
   232   };
   193 }
   233 }
       
   234 
   194 /**
   235 /**
   195  * Returns an action object used in signalling that preference defaults should
   236  * Returns an action object used in signalling that preference defaults should
   196  * be set.
   237  * be set.
   197  *
   238  *
   198  * @param {string}            scope    The preference scope (e.g. core/edit-post).
   239  * @param {string}            scope    The preference scope (e.g. core/edit-post).
   199  * @param {Object<string, *>} defaults A key/value map of preference names to values.
   240  * @param {Object<string, *>} defaults A key/value map of preference names to values.
   200  *
   241  *
   201  * @return {Object} Action object.
   242  * @return {Object} Action object.
   202  */
   243  */
   203 
       
   204 function setDefaults(scope, defaults) {
   244 function setDefaults(scope, defaults) {
   205   return {
   245   return {
   206     type: 'SET_PREFERENCE_DEFAULTS',
   246     type: 'SET_PREFERENCE_DEFAULTS',
   207     scope,
   247     scope,
   208     defaults
   248     defaults
   209   };
   249   };
   210 }
   250 }
   211 
   251 
       
   252 /** @typedef {() => Promise<Object>} WPPreferencesPersistenceLayerGet */
       
   253 /** @typedef {(Object) => void} WPPreferencesPersistenceLayerSet */
       
   254 /**
       
   255  * @typedef WPPreferencesPersistenceLayer
       
   256  *
       
   257  * @property {WPPreferencesPersistenceLayerGet} get An async function that gets data from the persistence layer.
       
   258  * @property {WPPreferencesPersistenceLayerSet} set A function that sets data in the persistence layer.
       
   259  */
       
   260 
       
   261 /**
       
   262  * Sets the persistence layer.
       
   263  *
       
   264  * When a persistence layer is set, the preferences store will:
       
   265  * - call `get` immediately and update the store state to the value returned.
       
   266  * - call `set` with all preferences whenever a preference changes value.
       
   267  *
       
   268  * `setPersistenceLayer` should ideally be dispatched at the start of an
       
   269  * application's lifecycle, before any other actions have been dispatched to
       
   270  * the preferences store.
       
   271  *
       
   272  * @param {WPPreferencesPersistenceLayer} persistenceLayer The persistence layer.
       
   273  *
       
   274  * @return {Object} Action object.
       
   275  */
       
   276 async function setPersistenceLayer(persistenceLayer) {
       
   277   const persistedData = await persistenceLayer.get();
       
   278   return {
       
   279     type: 'SET_PERSISTENCE_LAYER',
       
   280     persistenceLayer,
       
   281     persistedData
       
   282   };
       
   283 }
       
   284 
       
   285 ;// CONCATENATED MODULE: external ["wp","deprecated"]
       
   286 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
       
   287 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
   212 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/selectors.js
   288 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/selectors.js
       
   289 /**
       
   290  * WordPress dependencies
       
   291  */
       
   292 
       
   293 const withDeprecatedKeys = originalGet => (state, scope, name) => {
       
   294   const settingsToMoveToCore = ['allowRightClickOverrides', 'distractionFree', 'editorMode', 'fixedToolbar', 'focusMode', 'hiddenBlockTypes', 'inactivePanels', 'keepCaretInsideBlock', 'mostUsedBlocks', 'openPanels', 'showBlockBreadcrumbs', 'showIconLabels', 'showListViewByDefault', 'isPublishSidebarEnabled', 'isComplementaryAreaVisible', 'pinnedItems'];
       
   295   if (settingsToMoveToCore.includes(name) && ['core/edit-post', 'core/edit-site'].includes(scope)) {
       
   296     external_wp_deprecated_default()(`wp.data.select( 'core/preferences' ).get( '${scope}', '${name}' )`, {
       
   297       since: '6.5',
       
   298       alternative: `wp.data.select( 'core/preferences' ).get( 'core', '${name}' )`
       
   299     });
       
   300     return originalGet(state, 'core', name);
       
   301   }
       
   302   return originalGet(state, scope, name);
       
   303 };
       
   304 
   213 /**
   305 /**
   214  * Returns a boolean indicating whether a prefer is active for a particular
   306  * Returns a boolean indicating whether a prefer is active for a particular
   215  * scope.
   307  * scope.
   216  *
   308  *
   217  * @param {Object} state The store state.
   309  * @param {Object} state The store state.
   218  * @param {string} scope The scope of the feature (e.g. core/edit-post).
   310  * @param {string} scope The scope of the feature (e.g. core/edit-post).
   219  * @param {string} name  The name of the feature.
   311  * @param {string} name  The name of the feature.
   220  *
   312  *
   221  * @return {*} Is the feature enabled?
   313  * @return {*} Is the feature enabled?
   222  */
   314  */
   223 function get(state, scope, name) {
   315 const get = withDeprecatedKeys((state, scope, name) => {
   224   var _state$preferences$sc, _state$defaults$scope;
   316   const value = state.preferences[scope]?.[name];
   225 
   317   return value !== undefined ? value : state.defaults[scope]?.[name];
   226   const value = (_state$preferences$sc = state.preferences[scope]) === null || _state$preferences$sc === void 0 ? void 0 : _state$preferences$sc[name];
   318 });
   227   return value !== undefined ? value : (_state$defaults$scope = state.defaults[scope]) === null || _state$defaults$scope === void 0 ? void 0 : _state$defaults$scope[name];
       
   228 }
       
   229 
   319 
   230 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/constants.js
   320 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/constants.js
   231 /**
   321 /**
   232  * The identifier for the data store.
   322  * The identifier for the data store.
   233  *
   323  *
   238 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/index.js
   328 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/store/index.js
   239 /**
   329 /**
   240  * WordPress dependencies
   330  * WordPress dependencies
   241  */
   331  */
   242 
   332 
       
   333 
   243 /**
   334 /**
   244  * Internal dependencies
   335  * Internal dependencies
   245  */
   336  */
   246 
   337 
   247 /**
   338 
   248  * Internal dependencies
   339 
   249  */
   340 
   250 
   341 
   251 
   342 /**
   252 
   343  * Store definition for the preferences namespace.
   253 
       
   254 
       
   255 /**
       
   256  * Store definition for the interface namespace.
       
   257  *
   344  *
   258  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
   345  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
   259  *
   346  *
   260  * @type {Object}
   347  * @type {Object}
   261  */
   348  */
   262 
       
   263 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
   349 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
   264   reducer: reducer,
   350   reducer: reducer,
   265   actions: actions_namespaceObject,
   351   actions: actions_namespaceObject,
   266   selectors: selectors_namespaceObject,
   352   selectors: selectors_namespaceObject
   267   persist: ['preferences']
   353 });
   268 }); // Once we build a more generic persistence plugin that works across types of stores
   354 (0,external_wp_data_namespaceObject.register)(store);
   269 // we'd be able to replace this with a register call.
       
   270 
       
   271 (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, {
       
   272   reducer: reducer,
       
   273   actions: actions_namespaceObject,
       
   274   selectors: selectors_namespaceObject,
       
   275   persist: ['preferences']
       
   276 });
       
   277 
   355 
   278 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preference-toggle-menu-item/index.js
   356 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preference-toggle-menu-item/index.js
   279 
   357 /**
   280 
   358  * WordPress dependencies
   281 /**
   359  */
   282  * WordPress dependencies
   360 
   283  */
       
   284 
   361 
   285 
   362 
   286 
   363 
   287 
   364 
   288 
   365 
   289 /**
   366 /**
   290  * Internal dependencies
   367  * Internal dependencies
   291  */
   368  */
   292 
   369 
   293 
   370 
   294 function PreferenceToggleMenuItem(_ref) {
   371 function PreferenceToggleMenuItem({
   295   let {
   372   scope,
   296     scope,
   373   name,
   297     name,
   374   label,
   298     label,
   375   info,
   299     info,
   376   messageActivated,
   300     messageActivated,
   377   messageDeactivated,
   301     messageDeactivated,
   378   shortcut,
   302     shortcut
   379   handleToggling = true,
   303   } = _ref;
   380   onToggle = () => null,
   304   const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).get(scope, name), [name]);
   381   disabled = false
       
   382 }) {
       
   383   const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).get(scope, name), [scope, name]);
   305   const {
   384   const {
   306     toggle
   385     toggle
   307   } = (0,external_wp_data_namespaceObject.useDispatch)(store);
   386   } = (0,external_wp_data_namespaceObject.useDispatch)(store);
   308 
       
   309   const speakMessage = () => {
   387   const speakMessage = () => {
   310     if (isActive) {
   388     if (isActive) {
   311       const message = messageDeactivated || (0,external_wp_i18n_namespaceObject.sprintf)(
   389       const message = messageDeactivated || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: preference name, e.g. 'Fullscreen mode' */
   312       /* translators: %s: preference name, e.g. 'Fullscreen mode' */
       
   313       (0,external_wp_i18n_namespaceObject.__)('Preference deactivated - %s'), label);
   390       (0,external_wp_i18n_namespaceObject.__)('Preference deactivated - %s'), label);
   314       (0,external_wp_a11y_namespaceObject.speak)(message);
   391       (0,external_wp_a11y_namespaceObject.speak)(message);
   315     } else {
   392     } else {
   316       const message = messageActivated || (0,external_wp_i18n_namespaceObject.sprintf)(
   393       const message = messageActivated || (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: preference name, e.g. 'Fullscreen mode' */
   317       /* translators: %s: preference name, e.g. 'Fullscreen mode' */
       
   318       (0,external_wp_i18n_namespaceObject.__)('Preference activated - %s'), label);
   394       (0,external_wp_i18n_namespaceObject.__)('Preference activated - %s'), label);
   319       (0,external_wp_a11y_namespaceObject.speak)(message);
   395       (0,external_wp_a11y_namespaceObject.speak)(message);
   320     }
   396     }
   321   };
   397   };
   322 
   398   return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, {
   323   return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
       
   324     icon: isActive && library_check,
   399     icon: isActive && library_check,
   325     isSelected: isActive,
   400     isSelected: isActive,
   326     onClick: () => {
   401     onClick: () => {
   327       toggle(scope, name);
   402       onToggle();
       
   403       if (handleToggling) {
       
   404         toggle(scope, name);
       
   405       }
   328       speakMessage();
   406       speakMessage();
   329     },
   407     },
   330     role: "menuitemcheckbox",
   408     role: "menuitemcheckbox",
   331     info: info,
   409     info: info,
   332     shortcut: shortcut
   410     shortcut: shortcut,
   333   }, label);
   411     disabled: disabled,
       
   412     children: label
       
   413   });
   334 }
   414 }
   335 
   415 
   336 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/index.js
   416 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/index.js
   337 
   417 
   338 
   418 
       
   419 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preference-base-option/index.js
       
   420 /**
       
   421  * WordPress dependencies
       
   422  */
       
   423 
       
   424 
       
   425 
       
   426 function BaseOption({
       
   427   help,
       
   428   label,
       
   429   isChecked,
       
   430   onChange,
       
   431   children
       
   432 }) {
       
   433   return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
       
   434     className: "preference-base-option",
       
   435     children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, {
       
   436       __nextHasNoMarginBottom: true,
       
   437       help: help,
       
   438       label: label,
       
   439       checked: isChecked,
       
   440       onChange: onChange
       
   441     }), children]
       
   442   });
       
   443 }
       
   444 /* harmony default export */ const preference_base_option = (BaseOption);
       
   445 
       
   446 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preference-toggle-control/index.js
       
   447 /**
       
   448  * WordPress dependencies
       
   449  */
       
   450 
       
   451 
       
   452 /**
       
   453  * Internal dependencies
       
   454  */
       
   455 
       
   456 
       
   457 
       
   458 function PreferenceToggleControl(props) {
       
   459   const {
       
   460     scope,
       
   461     featureName,
       
   462     onToggle = () => {},
       
   463     ...remainingProps
       
   464   } = props;
       
   465   const isChecked = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).get(scope, featureName), [scope, featureName]);
       
   466   const {
       
   467     toggle
       
   468   } = (0,external_wp_data_namespaceObject.useDispatch)(store);
       
   469   const onChange = () => {
       
   470     onToggle();
       
   471     toggle(scope, featureName);
       
   472   };
       
   473   return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(preference_base_option, {
       
   474     onChange: onChange,
       
   475     isChecked: isChecked,
       
   476     ...remainingProps
       
   477   });
       
   478 }
       
   479 /* harmony default export */ const preference_toggle_control = (PreferenceToggleControl);
       
   480 
       
   481 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preferences-modal/index.js
       
   482 /**
       
   483  * WordPress dependencies
       
   484  */
       
   485 
       
   486 
       
   487 
       
   488 function PreferencesModal({
       
   489   closeModal,
       
   490   children
       
   491 }) {
       
   492   return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, {
       
   493     className: "preferences-modal",
       
   494     title: (0,external_wp_i18n_namespaceObject.__)('Preferences'),
       
   495     onRequestClose: closeModal,
       
   496     children: children
       
   497   });
       
   498 }
       
   499 
       
   500 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preferences-modal-section/index.js
       
   501 
       
   502 
       
   503 const Section = ({
       
   504   description,
       
   505   title,
       
   506   children
       
   507 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("fieldset", {
       
   508   className: "preferences-modal__section",
       
   509   children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("legend", {
       
   510     className: "preferences-modal__section-legend",
       
   511     children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h2", {
       
   512       className: "preferences-modal__section-title",
       
   513       children: title
       
   514     }), description && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
       
   515       className: "preferences-modal__section-description",
       
   516       children: description
       
   517     })]
       
   518   }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
       
   519     className: "preferences-modal__section-content",
       
   520     children: children
       
   521   })]
       
   522 });
       
   523 /* harmony default export */ const preferences_modal_section = (Section);
       
   524 
       
   525 ;// CONCATENATED MODULE: external ["wp","compose"]
       
   526 const external_wp_compose_namespaceObject = window["wp"]["compose"];
       
   527 ;// CONCATENATED MODULE: external ["wp","element"]
       
   528 const external_wp_element_namespaceObject = window["wp"]["element"];
       
   529 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
       
   530 /**
       
   531  * WordPress dependencies
       
   532  */
       
   533 
       
   534 
       
   535 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
       
   536 
       
   537 /**
       
   538  * Return an SVG icon.
       
   539  *
       
   540  * @param {IconProps}                                 props icon is the SVG component to render
       
   541  *                                                          size is a number specifiying the icon size in pixels
       
   542  *                                                          Other props will be passed to wrapped SVG component
       
   543  * @param {import('react').ForwardedRef<HTMLElement>} ref   The forwarded ref to the SVG element.
       
   544  *
       
   545  * @return {JSX.Element}  Icon component
       
   546  */
       
   547 function Icon({
       
   548   icon,
       
   549   size = 24,
       
   550   ...props
       
   551 }, ref) {
       
   552   return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
       
   553     width: size,
       
   554     height: size,
       
   555     ...props,
       
   556     ref
       
   557   });
       
   558 }
       
   559 /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
       
   560 
       
   561 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
       
   562 /**
       
   563  * WordPress dependencies
       
   564  */
       
   565 
       
   566 
       
   567 const chevronLeft = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
       
   568   xmlns: "http://www.w3.org/2000/svg",
       
   569   viewBox: "0 0 24 24",
       
   570   children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
       
   571     d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
       
   572   })
       
   573 });
       
   574 /* harmony default export */ const chevron_left = (chevronLeft);
       
   575 
       
   576 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
       
   577 /**
       
   578  * WordPress dependencies
       
   579  */
       
   580 
       
   581 
       
   582 const chevronRight = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
       
   583   xmlns: "http://www.w3.org/2000/svg",
       
   584   viewBox: "0 0 24 24",
       
   585   children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
       
   586     d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
       
   587   })
       
   588 });
       
   589 /* harmony default export */ const chevron_right = (chevronRight);
       
   590 
       
   591 ;// CONCATENATED MODULE: external ["wp","privateApis"]
       
   592 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
       
   593 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/lock-unlock.js
       
   594 /**
       
   595  * WordPress dependencies
       
   596  */
       
   597 
       
   598 const {
       
   599   lock,
       
   600   unlock
       
   601 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/preferences');
       
   602 
       
   603 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/components/preferences-modal-tabs/index.js
       
   604 /**
       
   605  * WordPress dependencies
       
   606  */
       
   607 
       
   608 
       
   609 
       
   610 
       
   611 
       
   612 
       
   613 /**
       
   614  * Internal dependencies
       
   615  */
       
   616 
       
   617 
       
   618 
       
   619 const {
       
   620   Tabs
       
   621 } = unlock(external_wp_components_namespaceObject.privateApis);
       
   622 const PREFERENCES_MENU = 'preferences-menu';
       
   623 function PreferencesModalTabs({
       
   624   sections
       
   625 }) {
       
   626   const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
       
   627 
       
   628   // This is also used to sync the two different rendered components
       
   629   // between small and large viewports.
       
   630   const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU);
       
   631   /**
       
   632    * Create helper objects from `sections` for easier data handling.
       
   633    * `tabs` is used for creating the `Tabs` and `sectionsContentMap`
       
   634    * is used for easier access to active tab's content.
       
   635    */
       
   636   const {
       
   637     tabs,
       
   638     sectionsContentMap
       
   639   } = (0,external_wp_element_namespaceObject.useMemo)(() => {
       
   640     let mappedTabs = {
       
   641       tabs: [],
       
   642       sectionsContentMap: {}
       
   643     };
       
   644     if (sections.length) {
       
   645       mappedTabs = sections.reduce((accumulator, {
       
   646         name,
       
   647         tabLabel: title,
       
   648         content
       
   649       }) => {
       
   650         accumulator.tabs.push({
       
   651           name,
       
   652           title
       
   653         });
       
   654         accumulator.sectionsContentMap[name] = content;
       
   655         return accumulator;
       
   656       }, {
       
   657         tabs: [],
       
   658         sectionsContentMap: {}
       
   659       });
       
   660     }
       
   661     return mappedTabs;
       
   662   }, [sections]);
       
   663   let modalContent;
       
   664   // We render different components based on the viewport size.
       
   665   if (isLargeViewport) {
       
   666     modalContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
       
   667       className: "preferences__tabs",
       
   668       children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, {
       
   669         defaultTabId: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
       
   670         onSelect: setActiveMenu,
       
   671         orientation: "vertical",
       
   672         children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, {
       
   673           className: "preferences__tabs-tablist",
       
   674           children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, {
       
   675             tabId: tab.name,
       
   676             className: "preferences__tabs-tab",
       
   677             children: tab.title
       
   678           }, tab.name))
       
   679         }), tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, {
       
   680           tabId: tab.name,
       
   681           className: "preferences__tabs-tabpanel",
       
   682           focusable: false,
       
   683           children: sectionsContentMap[tab.name] || null
       
   684         }, tab.name))]
       
   685       })
       
   686     });
       
   687   } else {
       
   688     modalContent = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
       
   689       initialPath: "/",
       
   690       className: "preferences__provider",
       
   691       children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
       
   692         path: "/",
       
   693         children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Card, {
       
   694           isBorderless: true,
       
   695           size: "small",
       
   696           children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, {
       
   697             children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
       
   698               children: tabs.map(tab => {
       
   699                 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
       
   700                   path: tab.name,
       
   701                   as: external_wp_components_namespaceObject.__experimentalItem,
       
   702                   isAction: true,
       
   703                   children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
       
   704                     justify: "space-between",
       
   705                     children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
       
   706                       children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalTruncate, {
       
   707                         children: tab.title
       
   708                       })
       
   709                     }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
       
   710                       children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, {
       
   711                         icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
       
   712                       })
       
   713                     })]
       
   714                   })
       
   715                 }, tab.name);
       
   716               })
       
   717             })
       
   718           })
       
   719         })
       
   720       }), sections.length && sections.map(section => {
       
   721         return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
       
   722           path: section.name,
       
   723           children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Card, {
       
   724             isBorderless: true,
       
   725             size: "large",
       
   726             children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.CardHeader, {
       
   727               isBorderless: false,
       
   728               justify: "left",
       
   729               size: "small",
       
   730               gap: "6",
       
   731               children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, {
       
   732                 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
       
   733                 label: (0,external_wp_i18n_namespaceObject.__)('Back')
       
   734               }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, {
       
   735                 size: "16",
       
   736                 children: section.tabLabel
       
   737               })]
       
   738             }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CardBody, {
       
   739               children: section.content
       
   740             })]
       
   741           })
       
   742         }, `${section.name}-menu`);
       
   743       })]
       
   744     });
       
   745   }
       
   746   return modalContent;
       
   747 }
       
   748 
       
   749 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/private-apis.js
       
   750 /**
       
   751  * Internal dependencies
       
   752  */
       
   753 
       
   754 
       
   755 
       
   756 
       
   757 
       
   758 
       
   759 const privateApis = {};
       
   760 lock(privateApis, {
       
   761   PreferenceBaseOption: preference_base_option,
       
   762   PreferenceToggleControl: preference_toggle_control,
       
   763   PreferencesModal: PreferencesModal,
       
   764   PreferencesModalSection: preferences_modal_section,
       
   765   PreferencesModalTabs: PreferencesModalTabs
       
   766 });
       
   767 
   339 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/index.js
   768 ;// CONCATENATED MODULE: ./node_modules/@wordpress/preferences/build-module/index.js
       
   769 
   340 
   770 
   341 
   771 
   342 
   772 
   343 (window.wp = window.wp || {}).preferences = __webpack_exports__;
   773 (window.wp = window.wp || {}).preferences = __webpack_exports__;
   344 /******/ })()
   774 /******/ })()