wp/wp-includes/js/dist/i18n.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    80 /******/ 	// __webpack_public_path__
    80 /******/ 	// __webpack_public_path__
    81 /******/ 	__webpack_require__.p = "";
    81 /******/ 	__webpack_require__.p = "";
    82 /******/
    82 /******/
    83 /******/
    83 /******/
    84 /******/ 	// Load entry module and return exports
    84 /******/ 	// Load entry module and return exports
    85 /******/ 	return __webpack_require__(__webpack_require__.s = 452);
    85 /******/ 	return __webpack_require__(__webpack_require__.s = "Vhyj");
    86 /******/ })
    86 /******/ })
    87 /************************************************************************/
    87 /************************************************************************/
    88 /******/ ({
    88 /******/ ({
    89 
    89 
    90 /***/ 197:
    90 /***/ "4Z/T":
    91 /***/ (function(module, exports, __webpack_require__) {
    91 /***/ (function(module, exports, __webpack_require__) {
    92 
    92 
    93 var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
    93 var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
    94 
    94 
    95 !function() {
    95 !function() {
   324 }(); // eslint-disable-line
   324 }(); // eslint-disable-line
   325 
   325 
   326 
   326 
   327 /***/ }),
   327 /***/ }),
   328 
   328 
   329 /***/ 452:
   329 /***/ "4eJC":
       
   330 /***/ (function(module, exports, __webpack_require__) {
       
   331 
       
   332 /**
       
   333  * Memize options object.
       
   334  *
       
   335  * @typedef MemizeOptions
       
   336  *
       
   337  * @property {number} [maxSize] Maximum size of the cache.
       
   338  */
       
   339 
       
   340 /**
       
   341  * Internal cache entry.
       
   342  *
       
   343  * @typedef MemizeCacheNode
       
   344  *
       
   345  * @property {?MemizeCacheNode|undefined} [prev] Previous node.
       
   346  * @property {?MemizeCacheNode|undefined} [next] Next node.
       
   347  * @property {Array<*>}                   args   Function arguments for cache
       
   348  *                                               entry.
       
   349  * @property {*}                          val    Function result.
       
   350  */
       
   351 
       
   352 /**
       
   353  * Properties of the enhanced function for controlling cache.
       
   354  *
       
   355  * @typedef MemizeMemoizedFunction
       
   356  *
       
   357  * @property {()=>void} clear Clear the cache.
       
   358  */
       
   359 
       
   360 /**
       
   361  * Accepts a function to be memoized, and returns a new memoized function, with
       
   362  * optional options.
       
   363  *
       
   364  * @template {Function} F
       
   365  *
       
   366  * @param {F}             fn        Function to memoize.
       
   367  * @param {MemizeOptions} [options] Options object.
       
   368  *
       
   369  * @return {F & MemizeMemoizedFunction} Memoized function.
       
   370  */
       
   371 function memize( fn, options ) {
       
   372 	var size = 0;
       
   373 
       
   374 	/** @type {?MemizeCacheNode|undefined} */
       
   375 	var head;
       
   376 
       
   377 	/** @type {?MemizeCacheNode|undefined} */
       
   378 	var tail;
       
   379 
       
   380 	options = options || {};
       
   381 
       
   382 	function memoized( /* ...args */ ) {
       
   383 		var node = head,
       
   384 			len = arguments.length,
       
   385 			args, i;
       
   386 
       
   387 		searchCache: while ( node ) {
       
   388 			// Perform a shallow equality test to confirm that whether the node
       
   389 			// under test is a candidate for the arguments passed. Two arrays
       
   390 			// are shallowly equal if their length matches and each entry is
       
   391 			// strictly equal between the two sets. Avoid abstracting to a
       
   392 			// function which could incur an arguments leaking deoptimization.
       
   393 
       
   394 			// Check whether node arguments match arguments length
       
   395 			if ( node.args.length !== arguments.length ) {
       
   396 				node = node.next;
       
   397 				continue;
       
   398 			}
       
   399 
       
   400 			// Check whether node arguments match arguments values
       
   401 			for ( i = 0; i < len; i++ ) {
       
   402 				if ( node.args[ i ] !== arguments[ i ] ) {
       
   403 					node = node.next;
       
   404 					continue searchCache;
       
   405 				}
       
   406 			}
       
   407 
       
   408 			// At this point we can assume we've found a match
       
   409 
       
   410 			// Surface matched node to head if not already
       
   411 			if ( node !== head ) {
       
   412 				// As tail, shift to previous. Must only shift if not also
       
   413 				// head, since if both head and tail, there is no previous.
       
   414 				if ( node === tail ) {
       
   415 					tail = node.prev;
       
   416 				}
       
   417 
       
   418 				// Adjust siblings to point to each other. If node was tail,
       
   419 				// this also handles new tail's empty `next` assignment.
       
   420 				/** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
       
   421 				if ( node.next ) {
       
   422 					node.next.prev = node.prev;
       
   423 				}
       
   424 
       
   425 				node.next = head;
       
   426 				node.prev = null;
       
   427 				/** @type {MemizeCacheNode} */ ( head ).prev = node;
       
   428 				head = node;
       
   429 			}
       
   430 
       
   431 			// Return immediately
       
   432 			return node.val;
       
   433 		}
       
   434 
       
   435 		// No cached value found. Continue to insertion phase:
       
   436 
       
   437 		// Create a copy of arguments (avoid leaking deoptimization)
       
   438 		args = new Array( len );
       
   439 		for ( i = 0; i < len; i++ ) {
       
   440 			args[ i ] = arguments[ i ];
       
   441 		}
       
   442 
       
   443 		node = {
       
   444 			args: args,
       
   445 
       
   446 			// Generate the result from original function
       
   447 			val: fn.apply( null, args ),
       
   448 		};
       
   449 
       
   450 		// Don't need to check whether node is already head, since it would
       
   451 		// have been returned above already if it was
       
   452 
       
   453 		// Shift existing head down list
       
   454 		if ( head ) {
       
   455 			head.prev = node;
       
   456 			node.next = head;
       
   457 		} else {
       
   458 			// If no head, follows that there's no tail (at initial or reset)
       
   459 			tail = node;
       
   460 		}
       
   461 
       
   462 		// Trim tail if we're reached max size and are pending cache insertion
       
   463 		if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
       
   464 			tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
       
   465 			/** @type {MemizeCacheNode} */ ( tail ).next = null;
       
   466 		} else {
       
   467 			size++;
       
   468 		}
       
   469 
       
   470 		head = node;
       
   471 
       
   472 		return node.val;
       
   473 	}
       
   474 
       
   475 	memoized.clear = function() {
       
   476 		head = null;
       
   477 		tail = null;
       
   478 		size = 0;
       
   479 	};
       
   480 
       
   481 	if ( false ) {}
       
   482 
       
   483 	// Ignore reason: There's not a clear solution to create an intersection of
       
   484 	// the function with additional properties, where the goal is to retain the
       
   485 	// function signature of the incoming argument and add control properties
       
   486 	// on the return value.
       
   487 
       
   488 	// @ts-ignore
       
   489 	return memoized;
       
   490 }
       
   491 
       
   492 module.exports = memize;
       
   493 
       
   494 
       
   495 /***/ }),
       
   496 
       
   497 /***/ "Vhyj":
   330 /***/ (function(module, __webpack_exports__, __webpack_require__) {
   498 /***/ (function(module, __webpack_exports__, __webpack_require__) {
   331 
   499 
   332 "use strict";
   500 "use strict";
   333 // ESM COMPAT FLAG
   501 // ESM COMPAT FLAG
   334 __webpack_require__.r(__webpack_exports__);
   502 __webpack_require__.r(__webpack_exports__);
   335 
   503 
   336 // EXPORTS
   504 // EXPORTS
   337 __webpack_require__.d(__webpack_exports__, "sprintf", function() { return /* reexport */ sprintf_sprintf; });
   505 __webpack_require__.d(__webpack_exports__, "sprintf", function() { return /* reexport */ sprintf_sprintf; });
   338 __webpack_require__.d(__webpack_exports__, "createI18n", function() { return /* reexport */ create_i18n_createI18n; });
   506 __webpack_require__.d(__webpack_exports__, "createI18n", function() { return /* reexport */ createI18n; });
       
   507 __webpack_require__.d(__webpack_exports__, "defaultI18n", function() { return /* reexport */ default_i18n; });
   339 __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return /* reexport */ default_i18n_setLocaleData; });
   508 __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return /* reexport */ default_i18n_setLocaleData; });
       
   509 __webpack_require__.d(__webpack_exports__, "resetLocaleData", function() { return /* reexport */ default_i18n_resetLocaleData; });
       
   510 __webpack_require__.d(__webpack_exports__, "getLocaleData", function() { return /* reexport */ default_i18n_getLocaleData; });
       
   511 __webpack_require__.d(__webpack_exports__, "subscribe", function() { return /* reexport */ default_i18n_subscribe; });
   340 __webpack_require__.d(__webpack_exports__, "__", function() { return /* reexport */ default_i18n_; });
   512 __webpack_require__.d(__webpack_exports__, "__", function() { return /* reexport */ default_i18n_; });
   341 __webpack_require__.d(__webpack_exports__, "_x", function() { return /* reexport */ default_i18n_x; });
   513 __webpack_require__.d(__webpack_exports__, "_x", function() { return /* reexport */ default_i18n_x; });
   342 __webpack_require__.d(__webpack_exports__, "_n", function() { return /* reexport */ default_i18n_n; });
   514 __webpack_require__.d(__webpack_exports__, "_n", function() { return /* reexport */ default_i18n_n; });
   343 __webpack_require__.d(__webpack_exports__, "_nx", function() { return /* reexport */ default_i18n_nx; });
   515 __webpack_require__.d(__webpack_exports__, "_nx", function() { return /* reexport */ default_i18n_nx; });
   344 __webpack_require__.d(__webpack_exports__, "isRTL", function() { return /* reexport */ default_i18n_isRTL; });
   516 __webpack_require__.d(__webpack_exports__, "isRTL", function() { return /* reexport */ default_i18n_isRTL; });
       
   517 __webpack_require__.d(__webpack_exports__, "hasTranslation", function() { return /* reexport */ default_i18n_hasTranslation; });
   345 
   518 
   346 // EXTERNAL MODULE: ./node_modules/memize/index.js
   519 // EXTERNAL MODULE: ./node_modules/memize/index.js
   347 var memize = __webpack_require__(60);
   520 var memize = __webpack_require__("4eJC");
   348 var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
   521 var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
   349 
   522 
   350 // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
   523 // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
   351 var sprintf = __webpack_require__(197);
   524 var sprintf = __webpack_require__("4Z/T");
   352 var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
   525 var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
   353 
   526 
   354 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/sprintf.js
   527 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/sprintf.js
   355 /**
   528 /**
   356  * External dependencies
   529  * External dependencies
   363  * to avoid crashing the application.
   536  * to avoid crashing the application.
   364  *
   537  *
   365  * @param {...*} args Arguments to pass to `console.error`
   538  * @param {...*} args Arguments to pass to `console.error`
   366  */
   539  */
   367 
   540 
   368 var logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
   541 const logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
   369 
   542 
   370 /**
   543 /**
   371  * Returns a formatted string. If an error occurs in applying the format, the
   544  * Returns a formatted string. If an error occurs in applying the format, the
   372  * original format string is returned.
   545  * original format string is returned.
   373  *
   546  *
   374  * @param {string}    format The format of the string to generate.
   547  * @param {string}    format The format of the string to generate.
   375  * @param {...*} args Arguments to apply to the format.
   548  * @param {...*} args Arguments to apply to the format.
   376  *
   549  *
   377  * @see http://www.diveintojavascript.com/projects/javascript-sprintf
   550  * @see https://www.npmjs.com/package/sprintf-js
   378  *
   551  *
   379  * @return {string} The formatted string.
   552  * @return {string} The formatted string.
   380  */
   553  */
   381 
   554 
   382 function sprintf_sprintf(format) {
   555 function sprintf_sprintf(format, ...args) {
   383   try {
   556   try {
   384     for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
   557     return sprintf_default.a.sprintf(format, ...args);
   385       args[_key - 1] = arguments[_key];
       
   386     }
       
   387 
       
   388     return sprintf_default.a.sprintf.apply(sprintf_default.a, [format].concat(args));
       
   389   } catch (error) {
   558   } catch (error) {
   390     logErrorOnce('sprintf error: \n\n' + error.toString());
   559     logErrorOnce('sprintf error: \n\n' + error.toString());
   391     return format;
   560     return format;
   392   }
   561   }
   393 }
   562 }
   394 
       
   395 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
       
   396 var defineProperty = __webpack_require__(5);
       
   397 
   563 
   398 // CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
   564 // CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
   399 var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
   565 var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
   400 
   566 
   401 /**
   567 /**
   898 	// representing the singular value.
  1064 	// representing the singular value.
   899 	return index === 0 ? singular : plural;
  1065 	return index === 0 ? singular : plural;
   900 };
  1066 };
   901 
  1067 
   902 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/create-i18n.js
  1068 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/create-i18n.js
   903 
       
   904 
       
   905 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
       
   906 
       
   907 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
       
   908 
       
   909 /**
  1069 /**
   910  * External dependencies
  1070  * External dependencies
   911  */
  1071  */
   912 
  1072 
   913 /**
  1073 /**
   919  * Assumes an English plural forms expression.
  1079  * Assumes an English plural forms expression.
   920  *
  1080  *
   921  * @type {LocaleData}
  1081  * @type {LocaleData}
   922  */
  1082  */
   923 
  1083 
   924 var DEFAULT_LOCALE_DATA = {
  1084 const DEFAULT_LOCALE_DATA = {
   925   '': {
  1085   '': {
   926     /** @param {number} n */
  1086     /** @param {number} n */
   927     plural_forms: function plural_forms(n) {
  1087     plural_forms(n) {
   928       return n === 1 ? 0 : 1;
  1088       return n === 1 ? 0 : 1;
   929     }
  1089     }
       
  1090 
   930   }
  1091   }
   931 };
  1092 };
       
  1093 /*
       
  1094  * Regular expression that matches i18n hooks like `i18n.gettext`, `i18n.ngettext`,
       
  1095  * `i18n.gettext_domain` or `i18n.ngettext_with_context` or `i18n.has_translation`.
       
  1096  */
       
  1097 
       
  1098 const I18N_HOOK_REGEXP = /^i18n\.(n?gettext|has_translation)(_|$)/;
       
  1099 /**
       
  1100  * @typedef {(domain?: string) => LocaleData} GetLocaleData
       
  1101  *
       
  1102  * Returns locale data by domain in a
       
  1103  * Jed-formatted JSON object shape.
       
  1104  *
       
  1105  * @see http://messageformat.github.io/Jed/
       
  1106  */
       
  1107 
       
  1108 /**
       
  1109  * @typedef {(data?: LocaleData, domain?: string) => void} SetLocaleData
       
  1110  *
       
  1111  * Merges locale data into the Tannin instance by domain. Accepts data in a
       
  1112  * Jed-formatted JSON object shape.
       
  1113  *
       
  1114  * @see http://messageformat.github.io/Jed/
       
  1115  */
       
  1116 
       
  1117 /**
       
  1118  * @typedef {(data?: LocaleData, domain?: string) => void} ResetLocaleData
       
  1119  *
       
  1120  * Resets all current Tannin instance locale data and sets the specified
       
  1121  * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
       
  1122  *
       
  1123  * @see http://messageformat.github.io/Jed/
       
  1124  */
       
  1125 
       
  1126 /** @typedef {() => void} SubscribeCallback */
       
  1127 
       
  1128 /** @typedef {() => void} UnsubscribeCallback */
       
  1129 
       
  1130 /**
       
  1131  * @typedef {(callback: SubscribeCallback) => UnsubscribeCallback} Subscribe
       
  1132  *
       
  1133  * Subscribes to changes of locale data
       
  1134  */
       
  1135 
       
  1136 /**
       
  1137  * @typedef {(domain?: string) => string} GetFilterDomain
       
  1138  * Retrieve the domain to use when calling domain-specific filters.
       
  1139  */
       
  1140 
       
  1141 /**
       
  1142  * @typedef {(text: string, domain?: string) => string} __
       
  1143  *
       
  1144  * Retrieve the translation of text.
       
  1145  *
       
  1146  * @see https://developer.wordpress.org/reference/functions/__/
       
  1147  */
       
  1148 
       
  1149 /**
       
  1150  * @typedef {(text: string, context: string, domain?: string) => string} _x
       
  1151  *
       
  1152  * Retrieve translated string with gettext context.
       
  1153  *
       
  1154  * @see https://developer.wordpress.org/reference/functions/_x/
       
  1155  */
       
  1156 
       
  1157 /**
       
  1158  * @typedef {(single: string, plural: string, number: number, domain?: string) => string} _n
       
  1159  *
       
  1160  * Translates and retrieves the singular or plural form based on the supplied
       
  1161  * number.
       
  1162  *
       
  1163  * @see https://developer.wordpress.org/reference/functions/_n/
       
  1164  */
       
  1165 
       
  1166 /**
       
  1167  * @typedef {(single: string, plural: string, number: number, context: string, domain?: string) => string} _nx
       
  1168  *
       
  1169  * Translates and retrieves the singular or plural form based on the supplied
       
  1170  * number, with gettext context.
       
  1171  *
       
  1172  * @see https://developer.wordpress.org/reference/functions/_nx/
       
  1173  */
       
  1174 
       
  1175 /**
       
  1176  * @typedef {() => boolean} IsRtl
       
  1177  *
       
  1178  * Check if current locale is RTL.
       
  1179  *
       
  1180  * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
       
  1181  * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
       
  1182  * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
       
  1183  * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
       
  1184  */
       
  1185 
       
  1186 /**
       
  1187  * @typedef {(single: string, context?: string, domain?: string) => boolean} HasTranslation
       
  1188  *
       
  1189  * Check if there is a translation for a given string in singular form.
       
  1190  */
       
  1191 
       
  1192 /** @typedef {import('@wordpress/hooks').Hooks} Hooks */
       
  1193 
   932 /**
  1194 /**
   933  * An i18n instance
  1195  * An i18n instance
   934  *
  1196  *
   935  * @typedef {Object} I18n
  1197  * @typedef I18n
   936  * @property {Function} setLocaleData Merges locale data into the Tannin instance by domain. Accepts data in a
  1198  * @property {GetLocaleData} getLocaleData     Returns locale data by domain in a Jed-formatted JSON object shape.
   937  *                                    Jed-formatted JSON object shape.
  1199  * @property {SetLocaleData} setLocaleData     Merges locale data into the Tannin instance by domain. Accepts data in a
   938  * @property {Function} __            Retrieve the translation of text.
  1200  *                                             Jed-formatted JSON object shape.
   939  * @property {Function} _x            Retrieve translated string with gettext context.
  1201  * @property {ResetLocaleData} resetLocaleData Resets all current Tannin instance locale data and sets the specified
   940  * @property {Function} _n            Translates and retrieves the singular or plural form based on the supplied
  1202  *                                             locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
   941  *                                    number.
  1203  * @property {Subscribe} subscribe             Subscribes to changes of Tannin locale data.
   942  * @property {Function} _nx           Translates and retrieves the singular or plural form based on the supplied
  1204  * @property {__} __                           Retrieve the translation of text.
   943  *                                    number, with gettext context.
  1205  * @property {_x} _x                           Retrieve translated string with gettext context.
   944  * @property {Function} isRTL         Check if current locale is RTL.
  1206  * @property {_n} _n                           Translates and retrieves the singular or plural form based on the supplied
       
  1207  *                                             number.
       
  1208  * @property {_nx} _nx                         Translates and retrieves the singular or plural form based on the supplied
       
  1209  *                                             number, with gettext context.
       
  1210  * @property {IsRtl} isRTL                     Check if current locale is RTL.
       
  1211  * @property {HasTranslation} hasTranslation   Check if there is a translation for a given string.
   945  */
  1212  */
   946 
  1213 
   947 /**
  1214 /**
   948  * Create an i18n instance
  1215  * Create an i18n instance
   949  *
  1216  *
   950  * @param {LocaleData} [initialData]    Locale data configuration.
  1217  * @param {LocaleData} [initialData]    Locale data configuration.
   951  * @param {string}     [initialDomain]  Domain for which configuration applies.
  1218  * @param {string}     [initialDomain]  Domain for which configuration applies.
       
  1219  * @param {Hooks} [hooks]     Hooks implementation.
   952  * @return {I18n}                       I18n instance
  1220  * @return {I18n}                       I18n instance
   953  */
  1221  */
   954 
  1222 
   955 var create_i18n_createI18n = function createI18n(initialData, initialDomain) {
  1223 const createI18n = (initialData, initialDomain, hooks) => {
   956   /**
  1224   /**
   957    * The underlying instance of Tannin to which exported functions interface.
  1225    * The underlying instance of Tannin to which exported functions interface.
   958    *
  1226    *
   959    * @type {Tannin}
  1227    * @type {Tannin}
   960    */
  1228    */
   961   var tannin = new Tannin({});
  1229   const tannin = new Tannin({});
       
  1230   const listeners = new Set();
       
  1231 
       
  1232   const notifyListeners = () => {
       
  1233     listeners.forEach(listener => listener());
       
  1234   };
   962   /**
  1235   /**
   963    * Merges locale data into the Tannin instance by domain. Accepts data in a
  1236    * Subscribe to changes of locale data.
   964    * Jed-formatted JSON object shape.
       
   965    *
  1237    *
   966    * @see http://messageformat.github.io/Jed/
  1238    * @param {SubscribeCallback} callback Subscription callback.
   967    *
  1239    * @return {UnsubscribeCallback} Unsubscribe callback.
   968    * @param {LocaleData} [data]   Locale data configuration.
       
   969    * @param {string}     [domain] Domain for which configuration applies.
       
   970    */
  1240    */
   971 
  1241 
   972   var setLocaleData = function setLocaleData(data) {
  1242 
   973     var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
  1243   const subscribe = callback => {
   974     tannin.data[domain] = _objectSpread({}, DEFAULT_LOCALE_DATA, {}, tannin.data[domain], {}, data); // Populate default domain configuration (supported locale date which omits
  1244     listeners.add(callback);
       
  1245     return () => listeners.delete(callback);
       
  1246   };
       
  1247   /** @type {GetLocaleData} */
       
  1248 
       
  1249 
       
  1250   const getLocaleData = (domain = 'default') => tannin.data[domain];
       
  1251   /**
       
  1252    * @param {LocaleData} [data]
       
  1253    * @param {string} [domain]
       
  1254    */
       
  1255 
       
  1256 
       
  1257   const doSetLocaleData = (data, domain = 'default') => {
       
  1258     tannin.data[domain] = { ...DEFAULT_LOCALE_DATA,
       
  1259       ...tannin.data[domain],
       
  1260       ...data
       
  1261     }; // Populate default domain configuration (supported locale date which omits
   975     // a plural forms expression).
  1262     // a plural forms expression).
   976 
  1263 
   977     tannin.data[domain][''] = _objectSpread({}, DEFAULT_LOCALE_DATA[''], {}, tannin.data[domain]['']);
  1264     tannin.data[domain][''] = { ...DEFAULT_LOCALE_DATA[''],
       
  1265       ...tannin.data[domain]['']
       
  1266     };
       
  1267   };
       
  1268   /** @type {SetLocaleData} */
       
  1269 
       
  1270 
       
  1271   const setLocaleData = (data, domain) => {
       
  1272     doSetLocaleData(data, domain);
       
  1273     notifyListeners();
       
  1274   };
       
  1275   /** @type {ResetLocaleData} */
       
  1276 
       
  1277 
       
  1278   const resetLocaleData = (data, domain) => {
       
  1279     // Reset all current Tannin locale data.
       
  1280     tannin.data = {}; // Reset cached plural forms functions cache.
       
  1281 
       
  1282     tannin.pluralForms = {};
       
  1283     setLocaleData(data, domain);
   978   };
  1284   };
   979   /**
  1285   /**
   980    * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
  1286    * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
   981    * otherwise previously assigned.
  1287    * otherwise previously assigned.
   982    *
  1288    *
   991    *
  1297    *
   992    * @return {string} The translated string.
  1298    * @return {string} The translated string.
   993    */
  1299    */
   994 
  1300 
   995 
  1301 
   996   var dcnpgettext = function dcnpgettext() {
  1302   const dcnpgettext = (domain = 'default', context, single, plural, number) => {
   997     var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
       
   998     var context = arguments.length > 1 ? arguments[1] : undefined;
       
   999     var single = arguments.length > 2 ? arguments[2] : undefined;
       
  1000     var plural = arguments.length > 3 ? arguments[3] : undefined;
       
  1001     var number = arguments.length > 4 ? arguments[4] : undefined;
       
  1002 
       
  1003     if (!tannin.data[domain]) {
  1303     if (!tannin.data[domain]) {
  1004       setLocaleData(undefined, domain);
  1304       // use `doSetLocaleData` to set silently, without notifying listeners
       
  1305       doSetLocaleData(undefined, domain);
  1005     }
  1306     }
  1006 
  1307 
  1007     return tannin.dcnpgettext(domain, context, single, plural, number);
  1308     return tannin.dcnpgettext(domain, context, single, plural, number);
  1008   };
  1309   };
  1009   /**
  1310   /** @type {GetFilterDomain} */
  1010    * Retrieve the translation of text.
  1311 
  1011    *
  1312 
  1012    * @see https://developer.wordpress.org/reference/functions/__/
  1313   const getFilterDomain = (domain = 'default') => domain;
  1013    *
  1314   /** @type {__} */
  1014    * @param {string} text     Text to translate.
  1315 
  1015    * @param {string} [domain] Domain to retrieve the translated text.
  1316 
  1016    *
  1317   const __ = (text, domain) => {
  1017    * @return {string} Translated text.
  1318     let translation = dcnpgettext(domain, undefined, text);
  1018    */
  1319 
  1019 
  1320     if (!hooks) {
  1020 
  1321       return translation;
  1021   var __ = function __(text, domain) {
  1322     }
  1022     return dcnpgettext(domain, undefined, text);
  1323     /**
       
  1324      * Filters text with its translation.
       
  1325      *
       
  1326      * @param {string} translation Translated text.
       
  1327      * @param {string} text        Text to translate.
       
  1328      * @param {string} domain      Text domain. Unique identifier for retrieving translated strings.
       
  1329      */
       
  1330 
       
  1331 
       
  1332     translation =
       
  1333     /** @type {string} */
       
  1334 
       
  1335     /** @type {*} */
       
  1336     hooks.applyFilters('i18n.gettext', translation, text, domain);
       
  1337     return (
       
  1338       /** @type {string} */
       
  1339 
       
  1340       /** @type {*} */
       
  1341       hooks.applyFilters('i18n.gettext_' + getFilterDomain(domain), translation, text, domain)
       
  1342     );
  1023   };
  1343   };
  1024   /**
  1344   /** @type {_x} */
  1025    * Retrieve translated string with gettext context.
  1345 
  1026    *
  1346 
  1027    * @see https://developer.wordpress.org/reference/functions/_x/
  1347   const _x = (text, context, domain) => {
  1028    *
  1348     let translation = dcnpgettext(domain, context, text);
  1029    * @param {string} text     Text to translate.
  1349 
  1030    * @param {string} context  Context information for the translators.
  1350     if (!hooks) {
  1031    * @param {string} [domain] Domain to retrieve the translated text.
  1351       return translation;
  1032    *
  1352     }
  1033    * @return {string} Translated context string without pipe.
  1353     /**
  1034    */
  1354      * Filters text with its translation based on context information.
  1035 
  1355      *
  1036 
  1356      * @param {string} translation Translated text.
  1037   var _x = function _x(text, context, domain) {
  1357      * @param {string} text        Text to translate.
  1038     return dcnpgettext(domain, context, text);
  1358      * @param {string} context     Context information for the translators.
       
  1359      * @param {string} domain      Text domain. Unique identifier for retrieving translated strings.
       
  1360      */
       
  1361 
       
  1362 
       
  1363     translation =
       
  1364     /** @type {string} */
       
  1365 
       
  1366     /** @type {*} */
       
  1367     hooks.applyFilters('i18n.gettext_with_context', translation, text, context, domain);
       
  1368     return (
       
  1369       /** @type {string} */
       
  1370 
       
  1371       /** @type {*} */
       
  1372       hooks.applyFilters('i18n.gettext_with_context_' + getFilterDomain(domain), translation, text, context, domain)
       
  1373     );
  1039   };
  1374   };
  1040   /**
  1375   /** @type {_n} */
  1041    * Translates and retrieves the singular or plural form based on the supplied
  1376 
  1042    * number.
  1377 
  1043    *
  1378   const _n = (single, plural, number, domain) => {
  1044    * @see https://developer.wordpress.org/reference/functions/_n/
  1379     let translation = dcnpgettext(domain, undefined, single, plural, number);
  1045    *
  1380 
  1046    * @param {string} single   The text to be used if the number is singular.
  1381     if (!hooks) {
  1047    * @param {string} plural   The text to be used if the number is plural.
  1382       return translation;
  1048    * @param {number} number   The number to compare against to use either the
  1383     }
  1049    *                          singular or plural form.
  1384     /**
  1050    * @param {string} [domain] Domain to retrieve the translated text.
  1385      * Filters the singular or plural form of a string.
  1051    *
  1386      *
  1052    * @return {string} The translated singular or plural form.
  1387      * @param {string} translation Translated text.
  1053    */
  1388      * @param {string} single      The text to be used if the number is singular.
  1054 
  1389      * @param {string} plural      The text to be used if the number is plural.
  1055 
  1390      * @param {string} number      The number to compare against to use either the singular or plural form.
  1056   var _n = function _n(single, plural, number, domain) {
  1391      * @param {string} domain      Text domain. Unique identifier for retrieving translated strings.
  1057     return dcnpgettext(domain, undefined, single, plural, number);
  1392      */
       
  1393 
       
  1394 
       
  1395     translation =
       
  1396     /** @type {string} */
       
  1397 
       
  1398     /** @type {*} */
       
  1399     hooks.applyFilters('i18n.ngettext', translation, single, plural, number, domain);
       
  1400     return (
       
  1401       /** @type {string} */
       
  1402 
       
  1403       /** @type {*} */
       
  1404       hooks.applyFilters('i18n.ngettext_' + getFilterDomain(domain), translation, single, plural, number, domain)
       
  1405     );
  1058   };
  1406   };
  1059   /**
  1407   /** @type {_nx} */
  1060    * Translates and retrieves the singular or plural form based on the supplied
  1408 
  1061    * number, with gettext context.
  1409 
  1062    *
  1410   const _nx = (single, plural, number, context, domain) => {
  1063    * @see https://developer.wordpress.org/reference/functions/_nx/
  1411     let translation = dcnpgettext(domain, context, single, plural, number);
  1064    *
  1412 
  1065    * @param {string} single   The text to be used if the number is singular.
  1413     if (!hooks) {
  1066    * @param {string} plural   The text to be used if the number is plural.
  1414       return translation;
  1067    * @param {number} number   The number to compare against to use either the
  1415     }
  1068    *                          singular or plural form.
  1416     /**
  1069    * @param {string} context  Context information for the translators.
  1417      * Filters the singular or plural form of a string with gettext context.
  1070    * @param {string} [domain] Domain to retrieve the translated text.
  1418      *
  1071    *
  1419      * @param {string} translation Translated text.
  1072    * @return {string} The translated singular or plural form.
  1420      * @param {string} single      The text to be used if the number is singular.
  1073    */
  1421      * @param {string} plural      The text to be used if the number is plural.
  1074 
  1422      * @param {string} number      The number to compare against to use either the singular or plural form.
  1075 
  1423      * @param {string} context     Context information for the translators.
  1076   var _nx = function _nx(single, plural, number, context, domain) {
  1424      * @param {string} domain      Text domain. Unique identifier for retrieving translated strings.
  1077     return dcnpgettext(domain, context, single, plural, number);
  1425      */
       
  1426 
       
  1427 
       
  1428     translation =
       
  1429     /** @type {string} */
       
  1430 
       
  1431     /** @type {*} */
       
  1432     hooks.applyFilters('i18n.ngettext_with_context', translation, single, plural, number, context, domain);
       
  1433     return (
       
  1434       /** @type {string} */
       
  1435 
       
  1436       /** @type {*} */
       
  1437       hooks.applyFilters('i18n.ngettext_with_context_' + getFilterDomain(domain), translation, single, plural, number, context, domain)
       
  1438     );
  1078   };
  1439   };
  1079   /**
  1440   /** @type {IsRtl} */
  1080    * Check if current locale is RTL.
  1441 
  1081    *
  1442 
  1082    * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
  1443   const isRTL = () => {
  1083    * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
       
  1084    * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
       
  1085    * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
       
  1086    *
       
  1087    * @return {boolean} Whether locale is RTL.
       
  1088    */
       
  1089 
       
  1090 
       
  1091   var isRTL = function isRTL() {
       
  1092     return 'rtl' === _x('ltr', 'text direction');
  1444     return 'rtl' === _x('ltr', 'text direction');
       
  1445   };
       
  1446   /** @type {HasTranslation} */
       
  1447 
       
  1448 
       
  1449   const hasTranslation = (single, context, domain) => {
       
  1450     var _tannin$data, _tannin$data2;
       
  1451 
       
  1452     const key = context ? context + '\u0004' + single : single;
       
  1453     let result = !!((_tannin$data = tannin.data) !== null && _tannin$data !== void 0 && (_tannin$data2 = _tannin$data[domain !== null && domain !== void 0 ? domain : 'default']) !== null && _tannin$data2 !== void 0 && _tannin$data2[key]);
       
  1454 
       
  1455     if (hooks) {
       
  1456       /**
       
  1457        * Filters the presence of a translation in the locale data.
       
  1458        *
       
  1459        * @param {boolean} hasTranslation Whether the translation is present or not..
       
  1460        * @param {string} single The singular form of the translated text (used as key in locale data)
       
  1461        * @param {string} context Context information for the translators.
       
  1462        * @param {string} domain Text domain. Unique identifier for retrieving translated strings.
       
  1463        */
       
  1464       result =
       
  1465       /** @type { boolean } */
       
  1466 
       
  1467       /** @type {*} */
       
  1468       hooks.applyFilters('i18n.has_translation', result, single, context, domain);
       
  1469       result =
       
  1470       /** @type { boolean } */
       
  1471 
       
  1472       /** @type {*} */
       
  1473       hooks.applyFilters('i18n.has_translation_' + getFilterDomain(domain), result, single, context, domain);
       
  1474     }
       
  1475 
       
  1476     return result;
  1093   };
  1477   };
  1094 
  1478 
  1095   if (initialData) {
  1479   if (initialData) {
  1096     setLocaleData(initialData, initialDomain);
  1480     setLocaleData(initialData, initialDomain);
  1097   }
  1481   }
  1098 
  1482 
       
  1483   if (hooks) {
       
  1484     /**
       
  1485      * @param {string} hookName
       
  1486      */
       
  1487     const onHookAddedOrRemoved = hookName => {
       
  1488       if (I18N_HOOK_REGEXP.test(hookName)) {
       
  1489         notifyListeners();
       
  1490       }
       
  1491     };
       
  1492 
       
  1493     hooks.addAction('hookAdded', 'core/i18n', onHookAddedOrRemoved);
       
  1494     hooks.addAction('hookRemoved', 'core/i18n', onHookAddedOrRemoved);
       
  1495   }
       
  1496 
  1099   return {
  1497   return {
  1100     setLocaleData: setLocaleData,
  1498     getLocaleData,
  1101     __: __,
  1499     setLocaleData,
  1102     _x: _x,
  1500     resetLocaleData,
  1103     _n: _n,
  1501     subscribe,
  1104     _nx: _nx,
  1502     __,
  1105     isRTL: isRTL
  1503     _x,
       
  1504     _n,
       
  1505     _nx,
       
  1506     isRTL,
       
  1507     hasTranslation
  1106   };
  1508   };
  1107 };
  1509 };
  1108 
  1510 
       
  1511 // EXTERNAL MODULE: external ["wp","hooks"]
       
  1512 var external_wp_hooks_ = __webpack_require__("g56x");
       
  1513 
  1109 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/default-i18n.js
  1514 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/default-i18n.js
  1110 /**
  1515 /**
  1111  * Internal dependencies
  1516  * Internal dependencies
  1112  */
  1517  */
  1113 
  1518 
  1114 var i18n = create_i18n_createI18n();
  1519 /**
       
  1520  * WordPress dependencies
       
  1521  */
       
  1522 
       
  1523 
       
  1524 const i18n = createI18n(undefined, undefined, external_wp_hooks_["defaultHooks"]);
       
  1525 /**
       
  1526  * Default, singleton instance of `I18n`.
       
  1527  */
       
  1528 
       
  1529 /* harmony default export */ var default_i18n = (i18n);
  1115 /*
  1530 /*
  1116  * Comments in this file are duplicated from ./i18n due to
  1531  * Comments in this file are duplicated from ./i18n due to
  1117  * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
  1532  * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
  1118  */
  1533  */
  1119 
  1534 
  1120 /**
  1535 /**
  1121  * @typedef {import('./create-i18n').LocaleData} LocaleData
  1536  * @typedef {import('./create-i18n').LocaleData} LocaleData
  1122  */
  1537  * @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback
  1123 
  1538  * @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback
       
  1539  */
       
  1540 
       
  1541 /**
       
  1542  * Returns locale data by domain in a Jed-formatted JSON object shape.
       
  1543  *
       
  1544  * @see http://messageformat.github.io/Jed/
       
  1545  *
       
  1546  * @param {string} [domain] Domain for which to get the data.
       
  1547  * @return {LocaleData} Locale data.
       
  1548  */
       
  1549 
       
  1550 const default_i18n_getLocaleData = i18n.getLocaleData.bind(i18n);
  1124 /**
  1551 /**
  1125  * Merges locale data into the Tannin instance by domain. Accepts data in a
  1552  * Merges locale data into the Tannin instance by domain. Accepts data in a
  1126  * Jed-formatted JSON object shape.
  1553  * Jed-formatted JSON object shape.
  1127  *
  1554  *
  1128  * @see http://messageformat.github.io/Jed/
  1555  * @see http://messageformat.github.io/Jed/
  1129  *
  1556  *
  1130  * @param {LocaleData} [data]   Locale data configuration.
  1557  * @param {LocaleData} [data]   Locale data configuration.
  1131  * @param {string}     [domain] Domain for which configuration applies.
  1558  * @param {string}     [domain] Domain for which configuration applies.
  1132  */
  1559  */
  1133 
  1560 
  1134 var default_i18n_setLocaleData = i18n.setLocaleData.bind(i18n);
  1561 const default_i18n_setLocaleData = i18n.setLocaleData.bind(i18n);
       
  1562 /**
       
  1563  * Resets all current Tannin instance locale data and sets the specified
       
  1564  * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
       
  1565  *
       
  1566  * @see http://messageformat.github.io/Jed/
       
  1567  *
       
  1568  * @param {LocaleData} [data]   Locale data configuration.
       
  1569  * @param {string}     [domain] Domain for which configuration applies.
       
  1570  */
       
  1571 
       
  1572 const default_i18n_resetLocaleData = i18n.resetLocaleData.bind(i18n);
       
  1573 /**
       
  1574  * Subscribes to changes of locale data
       
  1575  *
       
  1576  * @param {SubscribeCallback} callback Subscription callback
       
  1577  * @return {UnsubscribeCallback} Unsubscribe callback
       
  1578  */
       
  1579 
       
  1580 const default_i18n_subscribe = i18n.subscribe.bind(i18n);
  1135 /**
  1581 /**
  1136  * Retrieve the translation of text.
  1582  * Retrieve the translation of text.
  1137  *
  1583  *
  1138  * @see https://developer.wordpress.org/reference/functions/__/
  1584  * @see https://developer.wordpress.org/reference/functions/__/
  1139  *
  1585  *
  1141  * @param {string} [domain] Domain to retrieve the translated text.
  1587  * @param {string} [domain] Domain to retrieve the translated text.
  1142  *
  1588  *
  1143  * @return {string} Translated text.
  1589  * @return {string} Translated text.
  1144  */
  1590  */
  1145 
  1591 
  1146 var default_i18n_ = i18n.__.bind(i18n);
  1592 const default_i18n_ = i18n.__.bind(i18n);
  1147 /**
  1593 /**
  1148  * Retrieve translated string with gettext context.
  1594  * Retrieve translated string with gettext context.
  1149  *
  1595  *
  1150  * @see https://developer.wordpress.org/reference/functions/_x/
  1596  * @see https://developer.wordpress.org/reference/functions/_x/
  1151  *
  1597  *
  1154  * @param {string} [domain] Domain to retrieve the translated text.
  1600  * @param {string} [domain] Domain to retrieve the translated text.
  1155  *
  1601  *
  1156  * @return {string} Translated context string without pipe.
  1602  * @return {string} Translated context string without pipe.
  1157  */
  1603  */
  1158 
  1604 
  1159 var default_i18n_x = i18n._x.bind(i18n);
  1605 const default_i18n_x = i18n._x.bind(i18n);
  1160 /**
  1606 /**
  1161  * Translates and retrieves the singular or plural form based on the supplied
  1607  * Translates and retrieves the singular or plural form based on the supplied
  1162  * number.
  1608  * number.
  1163  *
  1609  *
  1164  * @see https://developer.wordpress.org/reference/functions/_n/
  1610  * @see https://developer.wordpress.org/reference/functions/_n/
  1170  * @param {string} [domain] Domain to retrieve the translated text.
  1616  * @param {string} [domain] Domain to retrieve the translated text.
  1171  *
  1617  *
  1172  * @return {string} The translated singular or plural form.
  1618  * @return {string} The translated singular or plural form.
  1173  */
  1619  */
  1174 
  1620 
  1175 var default_i18n_n = i18n._n.bind(i18n);
  1621 const default_i18n_n = i18n._n.bind(i18n);
  1176 /**
  1622 /**
  1177  * Translates and retrieves the singular or plural form based on the supplied
  1623  * Translates and retrieves the singular or plural form based on the supplied
  1178  * number, with gettext context.
  1624  * number, with gettext context.
  1179  *
  1625  *
  1180  * @see https://developer.wordpress.org/reference/functions/_nx/
  1626  * @see https://developer.wordpress.org/reference/functions/_nx/
  1187  * @param {string} [domain] Domain to retrieve the translated text.
  1633  * @param {string} [domain] Domain to retrieve the translated text.
  1188  *
  1634  *
  1189  * @return {string} The translated singular or plural form.
  1635  * @return {string} The translated singular or plural form.
  1190  */
  1636  */
  1191 
  1637 
  1192 var default_i18n_nx = i18n._nx.bind(i18n);
  1638 const default_i18n_nx = i18n._nx.bind(i18n);
  1193 /**
  1639 /**
  1194  * Check if current locale is RTL.
  1640  * Check if current locale is RTL.
  1195  *
  1641  *
  1196  * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
  1642  * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
  1197  * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
  1643  * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
  1199  * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
  1645  * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
  1200  *
  1646  *
  1201  * @return {boolean} Whether locale is RTL.
  1647  * @return {boolean} Whether locale is RTL.
  1202  */
  1648  */
  1203 
  1649 
  1204 var default_i18n_isRTL = i18n.isRTL.bind(i18n);
  1650 const default_i18n_isRTL = i18n.isRTL.bind(i18n);
       
  1651 /**
       
  1652  * Check if there is a translation for a given string (in singular form).
       
  1653  *
       
  1654  * @param {string} single Singular form of the string to look up.
       
  1655  * @param {string} [context] Context information for the translators.
       
  1656  * @param {string} [domain] Domain to retrieve the translated text.
       
  1657  * @return {boolean} Whether the translation exists or not.
       
  1658  */
       
  1659 
       
  1660 const default_i18n_hasTranslation = i18n.hasTranslation.bind(i18n);
  1205 
  1661 
  1206 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
  1662 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
  1207 
  1663 
  1208 
  1664 
  1209 
  1665 
  1210 
  1666 
  1211 
  1667 
  1212 /***/ }),
  1668 /***/ }),
  1213 
  1669 
  1214 /***/ 5:
  1670 /***/ "g56x":
  1215 /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1671 /***/ (function(module, exports) {
  1216 
  1672 
  1217 "use strict";
  1673 (function() { module.exports = window["wp"]["hooks"]; }());
  1218 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
       
  1219 function _defineProperty(obj, key, value) {
       
  1220   if (key in obj) {
       
  1221     Object.defineProperty(obj, key, {
       
  1222       value: value,
       
  1223       enumerable: true,
       
  1224       configurable: true,
       
  1225       writable: true
       
  1226     });
       
  1227   } else {
       
  1228     obj[key] = value;
       
  1229   }
       
  1230 
       
  1231   return obj;
       
  1232 }
       
  1233 
       
  1234 /***/ }),
       
  1235 
       
  1236 /***/ 60:
       
  1237 /***/ (function(module, exports, __webpack_require__) {
       
  1238 
       
  1239 /**
       
  1240  * Memize options object.
       
  1241  *
       
  1242  * @typedef MemizeOptions
       
  1243  *
       
  1244  * @property {number} [maxSize] Maximum size of the cache.
       
  1245  */
       
  1246 
       
  1247 /**
       
  1248  * Internal cache entry.
       
  1249  *
       
  1250  * @typedef MemizeCacheNode
       
  1251  *
       
  1252  * @property {?MemizeCacheNode|undefined} [prev] Previous node.
       
  1253  * @property {?MemizeCacheNode|undefined} [next] Next node.
       
  1254  * @property {Array<*>}                   args   Function arguments for cache
       
  1255  *                                               entry.
       
  1256  * @property {*}                          val    Function result.
       
  1257  */
       
  1258 
       
  1259 /**
       
  1260  * Properties of the enhanced function for controlling cache.
       
  1261  *
       
  1262  * @typedef MemizeMemoizedFunction
       
  1263  *
       
  1264  * @property {()=>void} clear Clear the cache.
       
  1265  */
       
  1266 
       
  1267 /**
       
  1268  * Accepts a function to be memoized, and returns a new memoized function, with
       
  1269  * optional options.
       
  1270  *
       
  1271  * @template {Function} F
       
  1272  *
       
  1273  * @param {F}             fn        Function to memoize.
       
  1274  * @param {MemizeOptions} [options] Options object.
       
  1275  *
       
  1276  * @return {F & MemizeMemoizedFunction} Memoized function.
       
  1277  */
       
  1278 function memize( fn, options ) {
       
  1279 	var size = 0;
       
  1280 
       
  1281 	/** @type {?MemizeCacheNode|undefined} */
       
  1282 	var head;
       
  1283 
       
  1284 	/** @type {?MemizeCacheNode|undefined} */
       
  1285 	var tail;
       
  1286 
       
  1287 	options = options || {};
       
  1288 
       
  1289 	function memoized( /* ...args */ ) {
       
  1290 		var node = head,
       
  1291 			len = arguments.length,
       
  1292 			args, i;
       
  1293 
       
  1294 		searchCache: while ( node ) {
       
  1295 			// Perform a shallow equality test to confirm that whether the node
       
  1296 			// under test is a candidate for the arguments passed. Two arrays
       
  1297 			// are shallowly equal if their length matches and each entry is
       
  1298 			// strictly equal between the two sets. Avoid abstracting to a
       
  1299 			// function which could incur an arguments leaking deoptimization.
       
  1300 
       
  1301 			// Check whether node arguments match arguments length
       
  1302 			if ( node.args.length !== arguments.length ) {
       
  1303 				node = node.next;
       
  1304 				continue;
       
  1305 			}
       
  1306 
       
  1307 			// Check whether node arguments match arguments values
       
  1308 			for ( i = 0; i < len; i++ ) {
       
  1309 				if ( node.args[ i ] !== arguments[ i ] ) {
       
  1310 					node = node.next;
       
  1311 					continue searchCache;
       
  1312 				}
       
  1313 			}
       
  1314 
       
  1315 			// At this point we can assume we've found a match
       
  1316 
       
  1317 			// Surface matched node to head if not already
       
  1318 			if ( node !== head ) {
       
  1319 				// As tail, shift to previous. Must only shift if not also
       
  1320 				// head, since if both head and tail, there is no previous.
       
  1321 				if ( node === tail ) {
       
  1322 					tail = node.prev;
       
  1323 				}
       
  1324 
       
  1325 				// Adjust siblings to point to each other. If node was tail,
       
  1326 				// this also handles new tail's empty `next` assignment.
       
  1327 				/** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
       
  1328 				if ( node.next ) {
       
  1329 					node.next.prev = node.prev;
       
  1330 				}
       
  1331 
       
  1332 				node.next = head;
       
  1333 				node.prev = null;
       
  1334 				/** @type {MemizeCacheNode} */ ( head ).prev = node;
       
  1335 				head = node;
       
  1336 			}
       
  1337 
       
  1338 			// Return immediately
       
  1339 			return node.val;
       
  1340 		}
       
  1341 
       
  1342 		// No cached value found. Continue to insertion phase:
       
  1343 
       
  1344 		// Create a copy of arguments (avoid leaking deoptimization)
       
  1345 		args = new Array( len );
       
  1346 		for ( i = 0; i < len; i++ ) {
       
  1347 			args[ i ] = arguments[ i ];
       
  1348 		}
       
  1349 
       
  1350 		node = {
       
  1351 			args: args,
       
  1352 
       
  1353 			// Generate the result from original function
       
  1354 			val: fn.apply( null, args ),
       
  1355 		};
       
  1356 
       
  1357 		// Don't need to check whether node is already head, since it would
       
  1358 		// have been returned above already if it was
       
  1359 
       
  1360 		// Shift existing head down list
       
  1361 		if ( head ) {
       
  1362 			head.prev = node;
       
  1363 			node.next = head;
       
  1364 		} else {
       
  1365 			// If no head, follows that there's no tail (at initial or reset)
       
  1366 			tail = node;
       
  1367 		}
       
  1368 
       
  1369 		// Trim tail if we're reached max size and are pending cache insertion
       
  1370 		if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
       
  1371 			tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
       
  1372 			/** @type {MemizeCacheNode} */ ( tail ).next = null;
       
  1373 		} else {
       
  1374 			size++;
       
  1375 		}
       
  1376 
       
  1377 		head = node;
       
  1378 
       
  1379 		return node.val;
       
  1380 	}
       
  1381 
       
  1382 	memoized.clear = function() {
       
  1383 		head = null;
       
  1384 		tail = null;
       
  1385 		size = 0;
       
  1386 	};
       
  1387 
       
  1388 	if ( false ) {}
       
  1389 
       
  1390 	// Ignore reason: There's not a clear solution to create an intersection of
       
  1391 	// the function with additional properties, where the goal is to retain the
       
  1392 	// function signature of the incoming argument and add control properties
       
  1393 	// on the return value.
       
  1394 
       
  1395 	// @ts-ignore
       
  1396 	return memoized;
       
  1397 }
       
  1398 
       
  1399 module.exports = memize;
       
  1400 
       
  1401 
  1674 
  1402 /***/ })
  1675 /***/ })
  1403 
  1676 
  1404 /******/ });
  1677 /******/ });