wp/wp-includes/js/dist/i18n.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    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 = 376);
    85 /******/ 	return __webpack_require__(__webpack_require__.s = 452);
    86 /******/ })
    86 /******/ })
    87 /************************************************************************/
    87 /************************************************************************/
    88 /******/ ({
    88 /******/ ({
    89 
    89 
    90 /***/ 137:
    90 /***/ 197:
    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 /***/ 15:
   329 /***/ 452:
   330 /***/ (function(module, __webpack_exports__, __webpack_require__) {
   330 /***/ (function(module, __webpack_exports__, __webpack_require__) {
   331 
   331 
   332 "use strict";
   332 "use strict";
   333 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
   333 // ESM COMPAT FLAG
   334 function _defineProperty(obj, key, value) {
   334 __webpack_require__.r(__webpack_exports__);
   335   if (key in obj) {
   335 
   336     Object.defineProperty(obj, key, {
   336 // EXPORTS
   337       value: value,
   337 __webpack_require__.d(__webpack_exports__, "sprintf", function() { return /* reexport */ sprintf_sprintf; });
   338       enumerable: true,
   338 __webpack_require__.d(__webpack_exports__, "createI18n", function() { return /* reexport */ create_i18n_createI18n; });
   339       configurable: true,
   339 __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return /* reexport */ default_i18n_setLocaleData; });
   340       writable: true
   340 __webpack_require__.d(__webpack_exports__, "__", function() { return /* reexport */ default_i18n_; });
   341     });
   341 __webpack_require__.d(__webpack_exports__, "_x", function() { return /* reexport */ default_i18n_x; });
   342   } else {
   342 __webpack_require__.d(__webpack_exports__, "_n", function() { return /* reexport */ default_i18n_n; });
   343     obj[key] = value;
   343 __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; });
       
   345 
       
   346 // EXTERNAL MODULE: ./node_modules/memize/index.js
       
   347 var memize = __webpack_require__(60);
       
   348 var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
       
   349 
       
   350 // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
       
   351 var sprintf = __webpack_require__(197);
       
   352 var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
       
   353 
       
   354 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/sprintf.js
       
   355 /**
       
   356  * External dependencies
       
   357  */
       
   358 
       
   359 
       
   360 /**
       
   361  * Log to console, once per message; or more precisely, per referentially equal
       
   362  * argument set. Because Jed throws errors, we log these to the console instead
       
   363  * to avoid crashing the application.
       
   364  *
       
   365  * @param {...*} args Arguments to pass to `console.error`
       
   366  */
       
   367 
       
   368 var logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
       
   369 
       
   370 /**
       
   371  * Returns a formatted string. If an error occurs in applying the format, the
       
   372  * original format string is returned.
       
   373  *
       
   374  * @param {string}    format The format of the string to generate.
       
   375  * @param {...*} args Arguments to apply to the format.
       
   376  *
       
   377  * @see http://www.diveintojavascript.com/projects/javascript-sprintf
       
   378  *
       
   379  * @return {string} The formatted string.
       
   380  */
       
   381 
       
   382 function sprintf_sprintf(format) {
       
   383   try {
       
   384     for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
       
   385       args[_key - 1] = arguments[_key];
       
   386     }
       
   387 
       
   388     return sprintf_default.a.sprintf.apply(sprintf_default.a, [format].concat(args));
       
   389   } catch (error) {
       
   390     logErrorOnce('sprintf error: \n\n' + error.toString());
       
   391     return format;
   344   }
   392   }
   345 
       
   346   return obj;
       
   347 }
   393 }
   348 
   394 
   349 /***/ }),
   395 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
   350 
   396 var defineProperty = __webpack_require__(5);
   351 /***/ 376:
       
   352 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   353 
       
   354 "use strict";
       
   355 __webpack_require__.r(__webpack_exports__);
       
   356 
       
   357 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
       
   358 var objectSpread = __webpack_require__(7);
       
   359 
   397 
   360 // CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
   398 // CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
   361 var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
   399 var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
   362 
   400 
   363 /**
   401 /**
   614  * // ⇒ true
   652  * // ⇒ true
   615  * ```
   653  * ```
   616  *
   654  *
   617  * @param {string} expression C expression.
   655  * @param {string} expression C expression.
   618  *
   656  *
   619  * @return {Function} Compiled evaluator.
   657  * @return {(variables?:{[variable:string]:*})=>*} Compiled evaluator.
   620  */
   658  */
   621 function compile( expression ) {
   659 function compile( expression ) {
   622 	var terms = postfix( expression );
   660 	var terms = postfix( expression );
   623 
   661 
   624 	return function( variables ) {
   662 	return function( variables ) {
   650 
   688 
   651 
   689 
   652 /**
   690 /**
   653  * Tannin constructor options.
   691  * Tannin constructor options.
   654  *
   692  *
   655  * @property {?string}   contextDelimiter Joiner in string lookup with context.
   693  * @typedef {Object} TanninOptions
   656  * @property {?Function} onMissingKey     Callback to invoke when key missing.
   694  *
   657  *
   695  * @property {string}   [contextDelimiter] Joiner in string lookup with context.
   658  * @type {Object}
   696  * @property {Function} [onMissingKey]     Callback to invoke when key missing.
   659  *
   697  */
   660  * @typedef {TanninOptions}
   698 
       
   699 /**
       
   700  * Domain metadata.
       
   701  *
       
   702  * @typedef {Object} TanninDomainMetadata
       
   703  *
       
   704  * @property {string}            [domain]       Domain name.
       
   705  * @property {string}            [lang]         Language code.
       
   706  * @property {(string|Function)} [plural_forms] Plural forms expression or
       
   707  *                                              function evaluator.
       
   708  */
       
   709 
       
   710 /**
       
   711  * Domain translation pair respectively representing the singular and plural
       
   712  * translation.
       
   713  *
       
   714  * @typedef {[string,string]} TanninTranslation
       
   715  */
       
   716 
       
   717 /**
       
   718  * Locale data domain. The key is used as reference for lookup, the value an
       
   719  * array of two string entries respectively representing the singular and plural
       
   720  * translation.
       
   721  *
       
   722  * @typedef {{[key:string]:TanninDomainMetadata|TanninTranslation,'':TanninDomainMetadata|TanninTranslation}} TanninLocaleDomain
       
   723  */
       
   724 
       
   725 /**
       
   726  * Jed-formatted locale data.
       
   727  *
       
   728  * @see http://messageformat.github.io/Jed/
       
   729  *
       
   730  * @typedef {{[domain:string]:TanninLocaleDomain}} TanninLocaleData
   661  */
   731  */
   662 
   732 
   663 /**
   733 /**
   664  * Default Tannin constructor options.
   734  * Default Tannin constructor options.
   665  *
   735  *
   698 }
   768 }
   699 
   769 
   700 /**
   770 /**
   701  * Tannin constructor.
   771  * Tannin constructor.
   702  *
   772  *
   703  * @param {Object}        data    Jed-formatted locale data.
   773  * @class
   704  * @param {TanninOptions} options Tannin options.
   774  *
       
   775  * @param {TanninLocaleData} data      Jed-formatted locale data.
       
   776  * @param {TanninOptions}    [options] Tannin options.
   705  */
   777  */
   706 function Tannin( data, options ) {
   778 function Tannin( data, options ) {
   707 	var key;
   779 	var key;
   708 
   780 
       
   781 	/**
       
   782 	 * Jed-formatted locale data.
       
   783 	 *
       
   784 	 * @name Tannin#data
       
   785 	 * @type {TanninLocaleData}
       
   786 	 */
   709 	this.data = data;
   787 	this.data = data;
       
   788 
       
   789 	/**
       
   790 	 * Plural forms function cache, keyed by plural forms string.
       
   791 	 *
       
   792 	 * @name Tannin#pluralForms
       
   793 	 * @type {Object<string,Function>}
       
   794 	 */
   710 	this.pluralForms = {};
   795 	this.pluralForms = {};
   711 
   796 
   712 	options = options || {};
   797 	/**
       
   798 	 * Effective options for instance, including defaults.
       
   799 	 *
       
   800 	 * @name Tannin#options
       
   801 	 * @type {TanninOptions}
       
   802 	 */
   713 	this.options = {};
   803 	this.options = {};
       
   804 
   714 	for ( key in DEFAULT_OPTIONS ) {
   805 	for ( key in DEFAULT_OPTIONS ) {
   715 		this.options[ key ] = options[ key ] || DEFAULT_OPTIONS[ key ];
   806 		this.options[ key ] = options !== undefined && key in options
       
   807 			? options[ key ]
       
   808 			: DEFAULT_OPTIONS[ key ];
   716 	}
   809 	}
   717 }
   810 }
   718 
   811 
   719 /**
   812 /**
   720  * Returns the plural form index for the given domain and value.
   813  * Returns the plural form index for the given domain and value.
   732 		config = this.data[ domain ][ '' ];
   825 		config = this.data[ domain ][ '' ];
   733 
   826 
   734 		pf = (
   827 		pf = (
   735 			config[ 'Plural-Forms' ] ||
   828 			config[ 'Plural-Forms' ] ||
   736 			config[ 'plural-forms' ] ||
   829 			config[ 'plural-forms' ] ||
       
   830 			// Ignore reason: As known, there's no way to document the empty
       
   831 			// string property on a key to guarantee this as metadata.
       
   832 			// @ts-ignore
   737 			config.plural_forms
   833 			config.plural_forms
   738 		);
   834 		);
   739 
   835 
   740 		if ( typeof pf !== 'function' ) {
   836 		if ( typeof pf !== 'function' ) {
   741 			plural = getPluralExpression(
   837 			plural = getPluralExpression(
   742 				config[ 'Plural-Forms' ] ||
   838 				config[ 'Plural-Forms' ] ||
   743 				config[ 'plural-forms' ] ||
   839 				config[ 'plural-forms' ] ||
       
   840 				// Ignore reason: As known, there's no way to document the empty
       
   841 				// string property on a key to guarantee this as metadata.
       
   842 				// @ts-ignore
   744 				config.plural_forms
   843 				config.plural_forms
   745 			);
   844 			);
   746 
   845 
   747 			pf = pluralForms( plural );
   846 			pf = pluralForms( plural );
   748 		}
   847 		}
   754 };
   853 };
   755 
   854 
   756 /**
   855 /**
   757  * Translate a string.
   856  * Translate a string.
   758  *
   857  *
   759  * @param {string} domain   Translation domain.
   858  * @param {string}      domain   Translation domain.
   760  * @param {string} context  Context distinguishing terms of the same name.
   859  * @param {string|void} context  Context distinguishing terms of the same name.
   761  * @param {string} singular Primary key for translation lookup.
   860  * @param {string}      singular Primary key for translation lookup.
   762  * @param {string} plural   Fallback value used for non-zero plural form index.
   861  * @param {string=}     plural   Fallback value used for non-zero plural
   763  * @param {number} n        Value to use in calculating plural form.
   862  *                               form index.
       
   863  * @param {number=}     n        Value to use in calculating plural form.
   764  *
   864  *
   765  * @return {string} Translated string.
   865  * @return {string} Translated string.
   766  */
   866  */
   767 Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) {
   867 Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) {
   768 	var index, key, entry;
   868 	var index, key, entry;
   797 	// If entry not found, fall back to singular vs. plural with zero index
   897 	// If entry not found, fall back to singular vs. plural with zero index
   798 	// representing the singular value.
   898 	// representing the singular value.
   799 	return index === 0 ? singular : plural;
   899 	return index === 0 ? singular : plural;
   800 };
   900 };
   801 
   901 
   802 // EXTERNAL MODULE: ./node_modules/memize/index.js
   902 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/create-i18n.js
   803 var memize = __webpack_require__(41);
   903 
   804 var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
   904 
   805 
   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; }
   806 // EXTERNAL MODULE: ./node_modules/@wordpress/i18n/node_modules/sprintf-js/src/sprintf.js
   906 
   807 var sprintf = __webpack_require__(137);
   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; }
   808 var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
       
   809 
       
   810 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
       
   811 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return setLocaleData; });
       
   812 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__", function() { return __; });
       
   813 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_x", function() { return _x; });
       
   814 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_n", function() { return _n; });
       
   815 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_nx", function() { return _nx; });
       
   816 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sprintf", function() { return build_module_sprintf; });
       
   817 
       
   818 
   908 
   819 /**
   909 /**
   820  * External dependencies
   910  * External dependencies
   821  */
   911  */
   822 
   912 
   823 
   913 /**
       
   914  * @typedef {Record<string,any>} LocaleData
       
   915  */
   824 
   916 
   825 /**
   917 /**
   826  * Default locale data to use for Tannin domain when not otherwise provided.
   918  * Default locale data to use for Tannin domain when not otherwise provided.
   827  * Assumes an English plural forms expression.
   919  * Assumes an English plural forms expression.
   828  *
   920  *
   829  * @type {Object}
   921  * @type {LocaleData}
   830  */
   922  */
   831 
   923 
   832 var DEFAULT_LOCALE_DATA = {
   924 var DEFAULT_LOCALE_DATA = {
   833   '': {
   925   '': {
   834     plural_forms: 'plural=(n!=1)'
   926     /** @param {number} n */
       
   927     plural_forms: function plural_forms(n) {
       
   928       return n === 1 ? 0 : 1;
       
   929     }
   835   }
   930   }
   836 };
   931 };
   837 /**
   932 /**
   838  * Log to console, once per message; or more precisely, per referentially equal
   933  * An i18n instance
   839  * argument set. Because Jed throws errors, we log these to the console instead
   934  *
   840  * to avoid crashing the application.
   935  * @typedef {Object} I18n
   841  *
   936  * @property {Function} setLocaleData Merges locale data into the Tannin instance by domain. Accepts data in a
   842  * @param {...*} args Arguments to pass to `console.error`
   937  *                                    Jed-formatted JSON object shape.
   843  */
   938  * @property {Function} __            Retrieve the translation of text.
   844 
   939  * @property {Function} _x            Retrieve translated string with gettext context.
   845 var logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
   940  * @property {Function} _n            Translates and retrieves the singular or plural form based on the supplied
   846 
   941  *                                    number.
   847 /**
   942  * @property {Function} _nx           Translates and retrieves the singular or plural form based on the supplied
   848  * The underlying instance of Tannin to which exported functions interface.
   943  *                                    number, with gettext context.
   849  *
   944  * @property {Function} isRTL         Check if current locale is RTL.
   850  * @type {Tannin}
   945  */
   851  */
   946 
   852 
   947 /**
   853 var i18n = new Tannin({});
   948  * Create an i18n instance
       
   949  *
       
   950  * @param {LocaleData} [initialData]    Locale data configuration.
       
   951  * @param {string}     [initialDomain]  Domain for which configuration applies.
       
   952  * @return {I18n}                       I18n instance
       
   953  */
       
   954 
       
   955 var create_i18n_createI18n = function createI18n(initialData, initialDomain) {
       
   956   /**
       
   957    * The underlying instance of Tannin to which exported functions interface.
       
   958    *
       
   959    * @type {Tannin}
       
   960    */
       
   961   var tannin = new Tannin({});
       
   962   /**
       
   963    * Merges locale data into the Tannin instance by domain. Accepts data in a
       
   964    * Jed-formatted JSON object shape.
       
   965    *
       
   966    * @see http://messageformat.github.io/Jed/
       
   967    *
       
   968    * @param {LocaleData} [data]   Locale data configuration.
       
   969    * @param {string}     [domain] Domain for which configuration applies.
       
   970    */
       
   971 
       
   972   var setLocaleData = function setLocaleData(data) {
       
   973     var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
       
   974     tannin.data[domain] = _objectSpread({}, DEFAULT_LOCALE_DATA, {}, tannin.data[domain], {}, data); // Populate default domain configuration (supported locale date which omits
       
   975     // a plural forms expression).
       
   976 
       
   977     tannin.data[domain][''] = _objectSpread({}, DEFAULT_LOCALE_DATA[''], {}, tannin.data[domain]['']);
       
   978   };
       
   979   /**
       
   980    * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
       
   981    * otherwise previously assigned.
       
   982    *
       
   983    * @param {string|undefined} domain   Domain to retrieve the translated text.
       
   984    * @param {string|undefined} context  Context information for the translators.
       
   985    * @param {string}           single   Text to translate if non-plural. Used as
       
   986    *                                    fallback return value on a caught error.
       
   987    * @param {string}           [plural] The text to be used if the number is
       
   988    *                                    plural.
       
   989    * @param {number}           [number] The number to compare against to use
       
   990    *                                    either the singular or plural form.
       
   991    *
       
   992    * @return {string} The translated string.
       
   993    */
       
   994 
       
   995 
       
   996   var dcnpgettext = function dcnpgettext() {
       
   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]) {
       
  1004       setLocaleData(undefined, domain);
       
  1005     }
       
  1006 
       
  1007     return tannin.dcnpgettext(domain, context, single, plural, number);
       
  1008   };
       
  1009   /**
       
  1010    * Retrieve the translation of text.
       
  1011    *
       
  1012    * @see https://developer.wordpress.org/reference/functions/__/
       
  1013    *
       
  1014    * @param {string} text     Text to translate.
       
  1015    * @param {string} [domain] Domain to retrieve the translated text.
       
  1016    *
       
  1017    * @return {string} Translated text.
       
  1018    */
       
  1019 
       
  1020 
       
  1021   var __ = function __(text, domain) {
       
  1022     return dcnpgettext(domain, undefined, text);
       
  1023   };
       
  1024   /**
       
  1025    * Retrieve translated string with gettext context.
       
  1026    *
       
  1027    * @see https://developer.wordpress.org/reference/functions/_x/
       
  1028    *
       
  1029    * @param {string} text     Text to translate.
       
  1030    * @param {string} context  Context information for the translators.
       
  1031    * @param {string} [domain] Domain to retrieve the translated text.
       
  1032    *
       
  1033    * @return {string} Translated context string without pipe.
       
  1034    */
       
  1035 
       
  1036 
       
  1037   var _x = function _x(text, context, domain) {
       
  1038     return dcnpgettext(domain, context, text);
       
  1039   };
       
  1040   /**
       
  1041    * Translates and retrieves the singular or plural form based on the supplied
       
  1042    * number.
       
  1043    *
       
  1044    * @see https://developer.wordpress.org/reference/functions/_n/
       
  1045    *
       
  1046    * @param {string} single   The text to be used if the number is singular.
       
  1047    * @param {string} plural   The text to be used if the number is plural.
       
  1048    * @param {number} number   The number to compare against to use either the
       
  1049    *                          singular or plural form.
       
  1050    * @param {string} [domain] Domain to retrieve the translated text.
       
  1051    *
       
  1052    * @return {string} The translated singular or plural form.
       
  1053    */
       
  1054 
       
  1055 
       
  1056   var _n = function _n(single, plural, number, domain) {
       
  1057     return dcnpgettext(domain, undefined, single, plural, number);
       
  1058   };
       
  1059   /**
       
  1060    * Translates and retrieves the singular or plural form based on the supplied
       
  1061    * number, with gettext context.
       
  1062    *
       
  1063    * @see https://developer.wordpress.org/reference/functions/_nx/
       
  1064    *
       
  1065    * @param {string} single   The text to be used if the number is singular.
       
  1066    * @param {string} plural   The text to be used if the number is plural.
       
  1067    * @param {number} number   The number to compare against to use either the
       
  1068    *                          singular or plural form.
       
  1069    * @param {string} context  Context information for the translators.
       
  1070    * @param {string} [domain] Domain to retrieve the translated text.
       
  1071    *
       
  1072    * @return {string} The translated singular or plural form.
       
  1073    */
       
  1074 
       
  1075 
       
  1076   var _nx = function _nx(single, plural, number, context, domain) {
       
  1077     return dcnpgettext(domain, context, single, plural, number);
       
  1078   };
       
  1079   /**
       
  1080    * Check if current locale is RTL.
       
  1081    *
       
  1082    * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
       
  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');
       
  1093   };
       
  1094 
       
  1095   if (initialData) {
       
  1096     setLocaleData(initialData, initialDomain);
       
  1097   }
       
  1098 
       
  1099   return {
       
  1100     setLocaleData: setLocaleData,
       
  1101     __: __,
       
  1102     _x: _x,
       
  1103     _n: _n,
       
  1104     _nx: _nx,
       
  1105     isRTL: isRTL
       
  1106   };
       
  1107 };
       
  1108 
       
  1109 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/default-i18n.js
       
  1110 /**
       
  1111  * Internal dependencies
       
  1112  */
       
  1113 
       
  1114 var i18n = create_i18n_createI18n();
       
  1115 /*
       
  1116  * Comments in this file are duplicated from ./i18n due to
       
  1117  * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
       
  1118  */
       
  1119 
       
  1120 /**
       
  1121  * @typedef {import('./create-i18n').LocaleData} LocaleData
       
  1122  */
       
  1123 
   854 /**
  1124 /**
   855  * Merges locale data into the Tannin instance by domain. Accepts data in a
  1125  * Merges locale data into the Tannin instance by domain. Accepts data in a
   856  * Jed-formatted JSON object shape.
  1126  * Jed-formatted JSON object shape.
   857  *
  1127  *
   858  * @see http://messageformat.github.io/Jed/
  1128  * @see http://messageformat.github.io/Jed/
   859  *
  1129  *
   860  * @param {?Object} data   Locale data configuration.
  1130  * @param {LocaleData} [data]   Locale data configuration.
   861  * @param {?string} domain Domain for which configuration applies.
  1131  * @param {string}     [domain] Domain for which configuration applies.
   862  */
  1132  */
   863 
  1133 
   864 function setLocaleData(data) {
  1134 var default_i18n_setLocaleData = i18n.setLocaleData.bind(i18n);
   865   var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
       
   866   i18n.data[domain] = Object(objectSpread["a" /* default */])({}, DEFAULT_LOCALE_DATA, i18n.data[domain], data); // Populate default domain configuration (supported locale date which omits
       
   867   // a plural forms expression).
       
   868 
       
   869   i18n.data[domain][''] = Object(objectSpread["a" /* default */])({}, DEFAULT_LOCALE_DATA[''], i18n.data[domain]['']);
       
   870 }
       
   871 /**
       
   872  * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
       
   873  * otherwise previously assigned.
       
   874  *
       
   875  * @param {?string} domain  Domain to retrieve the translated text.
       
   876  * @param {?string} context Context information for the translators.
       
   877  * @param {string}  single  Text to translate if non-plural. Used as fallback
       
   878  *                          return value on a caught error.
       
   879  * @param {?string} plural  The text to be used if the number is plural.
       
   880  * @param {?number} number  The number to compare against to use either the
       
   881  *                          singular or plural form.
       
   882  *
       
   883  * @return {string} The translated string.
       
   884  */
       
   885 
       
   886 function dcnpgettext() {
       
   887   var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
       
   888   var context = arguments.length > 1 ? arguments[1] : undefined;
       
   889   var single = arguments.length > 2 ? arguments[2] : undefined;
       
   890   var plural = arguments.length > 3 ? arguments[3] : undefined;
       
   891   var number = arguments.length > 4 ? arguments[4] : undefined;
       
   892 
       
   893   if (!i18n.data[domain]) {
       
   894     setLocaleData(undefined, domain);
       
   895   }
       
   896 
       
   897   return i18n.dcnpgettext(domain, context, single, plural, number);
       
   898 }
       
   899 /**
  1135 /**
   900  * Retrieve the translation of text.
  1136  * Retrieve the translation of text.
   901  *
  1137  *
   902  * @see https://developer.wordpress.org/reference/functions/__/
  1138  * @see https://developer.wordpress.org/reference/functions/__/
   903  *
  1139  *
   904  * @param {string}  text   Text to translate.
  1140  * @param {string} text     Text to translate.
   905  * @param {?string} domain Domain to retrieve the translated text.
  1141  * @param {string} [domain] Domain to retrieve the translated text.
   906  *
  1142  *
   907  * @return {string} Translated text.
  1143  * @return {string} Translated text.
   908  */
  1144  */
   909 
  1145 
   910 
  1146 var default_i18n_ = i18n.__.bind(i18n);
   911 function __(text, domain) {
       
   912   return dcnpgettext(domain, undefined, text);
       
   913 }
       
   914 /**
  1147 /**
   915  * Retrieve translated string with gettext context.
  1148  * Retrieve translated string with gettext context.
   916  *
  1149  *
   917  * @see https://developer.wordpress.org/reference/functions/_x/
  1150  * @see https://developer.wordpress.org/reference/functions/_x/
   918  *
  1151  *
   919  * @param {string}  text    Text to translate.
  1152  * @param {string} text     Text to translate.
   920  * @param {string}  context Context information for the translators.
  1153  * @param {string} context  Context information for the translators.
   921  * @param {?string} domain  Domain to retrieve the translated text.
  1154  * @param {string} [domain] Domain to retrieve the translated text.
   922  *
  1155  *
   923  * @return {string} Translated context string without pipe.
  1156  * @return {string} Translated context string without pipe.
   924  */
  1157  */
   925 
  1158 
   926 function _x(text, context, domain) {
  1159 var default_i18n_x = i18n._x.bind(i18n);
   927   return dcnpgettext(domain, context, text);
       
   928 }
       
   929 /**
  1160 /**
   930  * Translates and retrieves the singular or plural form based on the supplied
  1161  * Translates and retrieves the singular or plural form based on the supplied
   931  * number.
  1162  * number.
   932  *
  1163  *
   933  * @see https://developer.wordpress.org/reference/functions/_n/
  1164  * @see https://developer.wordpress.org/reference/functions/_n/
   934  *
  1165  *
   935  * @param {string}  single The text to be used if the number is singular.
  1166  * @param {string} single   The text to be used if the number is singular.
   936  * @param {string}  plural The text to be used if the number is plural.
  1167  * @param {string} plural   The text to be used if the number is plural.
   937  * @param {number}  number The number to compare against to use either the
  1168  * @param {number} number   The number to compare against to use either the
   938  *                         singular or plural form.
  1169  *                          singular or plural form.
   939  * @param {?string} domain Domain to retrieve the translated text.
  1170  * @param {string} [domain] Domain to retrieve the translated text.
   940  *
  1171  *
   941  * @return {string} The translated singular or plural form.
  1172  * @return {string} The translated singular or plural form.
   942  */
  1173  */
   943 
  1174 
   944 function _n(single, plural, number, domain) {
  1175 var default_i18n_n = i18n._n.bind(i18n);
   945   return dcnpgettext(domain, undefined, single, plural, number);
       
   946 }
       
   947 /**
  1176 /**
   948  * Translates and retrieves the singular or plural form based on the supplied
  1177  * Translates and retrieves the singular or plural form based on the supplied
   949  * number, with gettext context.
  1178  * number, with gettext context.
   950  *
  1179  *
   951  * @see https://developer.wordpress.org/reference/functions/_nx/
  1180  * @see https://developer.wordpress.org/reference/functions/_nx/
   952  *
  1181  *
   953  * @param {string}  single  The text to be used if the number is singular.
  1182  * @param {string} single   The text to be used if the number is singular.
   954  * @param {string}  plural  The text to be used if the number is plural.
  1183  * @param {string} plural   The text to be used if the number is plural.
   955  * @param {number}  number  The number to compare against to use either the
  1184  * @param {number} number   The number to compare against to use either the
   956  *                          singular or plural form.
  1185  *                          singular or plural form.
   957  * @param {string}  context Context information for the translators.
  1186  * @param {string} context  Context information for the translators.
   958  * @param {?string} domain  Domain to retrieve the translated text.
  1187  * @param {string} [domain] Domain to retrieve the translated text.
   959  *
  1188  *
   960  * @return {string} The translated singular or plural form.
  1189  * @return {string} The translated singular or plural form.
   961  */
  1190  */
   962 
  1191 
   963 function _nx(single, plural, number, context, domain) {
  1192 var default_i18n_nx = i18n._nx.bind(i18n);
   964   return dcnpgettext(domain, context, single, plural, number);
  1193 /**
       
  1194  * Check if current locale is RTL.
       
  1195  *
       
  1196  * **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
       
  1198  * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
       
  1199  * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
       
  1200  *
       
  1201  * @return {boolean} Whether locale is RTL.
       
  1202  */
       
  1203 
       
  1204 var default_i18n_isRTL = i18n.isRTL.bind(i18n);
       
  1205 
       
  1206 // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
       
  1207 
       
  1208 
       
  1209 
       
  1210 
       
  1211 
       
  1212 /***/ }),
       
  1213 
       
  1214 /***/ 5:
       
  1215 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
  1216 
       
  1217 "use strict";
       
  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;
   965 }
  1232 }
   966 /**
       
   967  * Returns a formatted string. If an error occurs in applying the format, the
       
   968  * original format string is returned.
       
   969  *
       
   970  * @param {string}   format  The format of the string to generate.
       
   971  * @param {...string} args Arguments to apply to the format.
       
   972  *
       
   973  * @see http://www.diveintojavascript.com/projects/javascript-sprintf
       
   974  *
       
   975  * @return {string} The formatted string.
       
   976  */
       
   977 
       
   978 function build_module_sprintf(format) {
       
   979   try {
       
   980     for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
       
   981       args[_key - 1] = arguments[_key];
       
   982     }
       
   983 
       
   984     return sprintf_default.a.sprintf.apply(sprintf_default.a, [format].concat(args));
       
   985   } catch (error) {
       
   986     logErrorOnce('sprintf error: \n\n' + error.toString());
       
   987     return format;
       
   988   }
       
   989 }
       
   990 
       
   991 
  1233 
   992 /***/ }),
  1234 /***/ }),
   993 
  1235 
   994 /***/ 41:
  1236 /***/ 60:
   995 /***/ (function(module, exports, __webpack_require__) {
  1237 /***/ (function(module, exports, __webpack_require__) {
   996 
  1238 
   997 module.exports = function memize( fn, options ) {
  1239 /**
   998 	var size = 0,
  1240  * Memize options object.
   999 		maxSize, head, tail;
  1241  *
  1000 
  1242  * @typedef MemizeOptions
  1001 	if ( options && options.maxSize ) {
  1243  *
  1002 		maxSize = options.maxSize;
  1244  * @property {number} [maxSize] Maximum size of the cache.
  1003 	}
  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 || {};
  1004 
  1288 
  1005 	function memoized( /* ...args */ ) {
  1289 	function memoized( /* ...args */ ) {
  1006 		var node = head,
  1290 		var node = head,
  1007 			len = arguments.length,
  1291 			len = arguments.length,
  1008 			args, i;
  1292 			args, i;
  1038 					tail = node.prev;
  1322 					tail = node.prev;
  1039 				}
  1323 				}
  1040 
  1324 
  1041 				// Adjust siblings to point to each other. If node was tail,
  1325 				// Adjust siblings to point to each other. If node was tail,
  1042 				// this also handles new tail's empty `next` assignment.
  1326 				// this also handles new tail's empty `next` assignment.
  1043 				node.prev.next = node.next;
  1327 				/** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
  1044 				if ( node.next ) {
  1328 				if ( node.next ) {
  1045 					node.next.prev = node.prev;
  1329 					node.next.prev = node.prev;
  1046 				}
  1330 				}
  1047 
  1331 
  1048 				node.next = head;
  1332 				node.next = head;
  1049 				node.prev = null;
  1333 				node.prev = null;
  1050 				head.prev = node;
  1334 				/** @type {MemizeCacheNode} */ ( head ).prev = node;
  1051 				head = node;
  1335 				head = node;
  1052 			}
  1336 			}
  1053 
  1337 
  1054 			// Return immediately
  1338 			// Return immediately
  1055 			return node.val;
  1339 			return node.val;
  1065 
  1349 
  1066 		node = {
  1350 		node = {
  1067 			args: args,
  1351 			args: args,
  1068 
  1352 
  1069 			// Generate the result from original function
  1353 			// Generate the result from original function
  1070 			val: fn.apply( null, args )
  1354 			val: fn.apply( null, args ),
  1071 		};
  1355 		};
  1072 
  1356 
  1073 		// Don't need to check whether node is already head, since it would
  1357 		// Don't need to check whether node is already head, since it would
  1074 		// have been returned above already if it was
  1358 		// have been returned above already if it was
  1075 
  1359 
  1081 			// If no head, follows that there's no tail (at initial or reset)
  1365 			// If no head, follows that there's no tail (at initial or reset)
  1082 			tail = node;
  1366 			tail = node;
  1083 		}
  1367 		}
  1084 
  1368 
  1085 		// Trim tail if we're reached max size and are pending cache insertion
  1369 		// Trim tail if we're reached max size and are pending cache insertion
  1086 		if ( size === maxSize ) {
  1370 		if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
  1087 			tail = tail.prev;
  1371 			tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
  1088 			tail.next = null;
  1372 			/** @type {MemizeCacheNode} */ ( tail ).next = null;
  1089 		} else {
  1373 		} else {
  1090 			size++;
  1374 			size++;
  1091 		}
  1375 		}
  1092 
  1376 
  1093 		head = node;
  1377 		head = node;
  1101 		size = 0;
  1385 		size = 0;
  1102 	};
  1386 	};
  1103 
  1387 
  1104 	if ( false ) {}
  1388 	if ( false ) {}
  1105 
  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
  1106 	return memoized;
  1396 	return memoized;
  1107 };
       
  1108 
       
  1109 
       
  1110 /***/ }),
       
  1111 
       
  1112 /***/ 7:
       
  1113 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
  1114 
       
  1115 "use strict";
       
  1116 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
       
  1117 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
       
  1118 
       
  1119 function _objectSpread(target) {
       
  1120   for (var i = 1; i < arguments.length; i++) {
       
  1121     var source = arguments[i] != null ? arguments[i] : {};
       
  1122     var ownKeys = Object.keys(source);
       
  1123 
       
  1124     if (typeof Object.getOwnPropertySymbols === 'function') {
       
  1125       ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
       
  1126         return Object.getOwnPropertyDescriptor(source, sym).enumerable;
       
  1127       }));
       
  1128     }
       
  1129 
       
  1130     ownKeys.forEach(function (key) {
       
  1131       Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
       
  1132     });
       
  1133   }
       
  1134 
       
  1135   return target;
       
  1136 }
  1397 }
  1137 
  1398 
       
  1399 module.exports = memize;
       
  1400 
       
  1401 
  1138 /***/ })
  1402 /***/ })
  1139 
  1403 
  1140 /******/ });
  1404 /******/ });