12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142 |
- this["wp"] = this["wp"] || {}; this["wp"]["i18n"] =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 360);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 10:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- /***/ }),
- /***/ 146:
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
- !function() {
- 'use strict'
- var re = {
- not_string: /[^s]/,
- not_bool: /[^t]/,
- not_type: /[^T]/,
- not_primitive: /[^v]/,
- number: /[diefg]/,
- numeric_arg: /[bcdiefguxX]/,
- json: /[j]/,
- not_json: /[^j]/,
- text: /^[^\x25]+/,
- modulo: /^\x25{2}/,
- placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
- key: /^([a-z_][a-z_\d]*)/i,
- key_access: /^\.([a-z_][a-z_\d]*)/i,
- index_access: /^\[(\d+)\]/,
- sign: /^[+-]/
- }
- function sprintf(key) {
- // `arguments` is not an array, but should be fine for this call
- return sprintf_format(sprintf_parse(key), arguments)
- }
- function vsprintf(fmt, argv) {
- return sprintf.apply(null, [fmt].concat(argv || []))
- }
- function sprintf_format(parse_tree, argv) {
- var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign
- for (i = 0; i < tree_length; i++) {
- if (typeof parse_tree[i] === 'string') {
- output += parse_tree[i]
- }
- else if (typeof parse_tree[i] === 'object') {
- ph = parse_tree[i] // convenience purposes only
- if (ph.keys) { // keyword argument
- arg = argv[cursor]
- for (k = 0; k < ph.keys.length; k++) {
- if (arg == undefined) {
- throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1]))
- }
- arg = arg[ph.keys[k]]
- }
- }
- else if (ph.param_no) { // positional argument (explicit)
- arg = argv[ph.param_no]
- }
- else { // positional argument (implicit)
- arg = argv[cursor++]
- }
- if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
- arg = arg()
- }
- if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) {
- throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))
- }
- if (re.number.test(ph.type)) {
- is_positive = arg >= 0
- }
- switch (ph.type) {
- case 'b':
- arg = parseInt(arg, 10).toString(2)
- break
- case 'c':
- arg = String.fromCharCode(parseInt(arg, 10))
- break
- case 'd':
- case 'i':
- arg = parseInt(arg, 10)
- break
- case 'j':
- arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0)
- break
- case 'e':
- arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential()
- break
- case 'f':
- arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg)
- break
- case 'g':
- arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg)
- break
- case 'o':
- arg = (parseInt(arg, 10) >>> 0).toString(8)
- break
- case 's':
- arg = String(arg)
- arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
- break
- case 't':
- arg = String(!!arg)
- arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
- break
- case 'T':
- arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase()
- arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
- break
- case 'u':
- arg = parseInt(arg, 10) >>> 0
- break
- case 'v':
- arg = arg.valueOf()
- arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
- break
- case 'x':
- arg = (parseInt(arg, 10) >>> 0).toString(16)
- break
- case 'X':
- arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase()
- break
- }
- if (re.json.test(ph.type)) {
- output += arg
- }
- else {
- if (re.number.test(ph.type) && (!is_positive || ph.sign)) {
- sign = is_positive ? '+' : '-'
- arg = arg.toString().replace(re.sign, '')
- }
- else {
- sign = ''
- }
- pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' '
- pad_length = ph.width - (sign + arg).length
- pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : ''
- output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg)
- }
- }
- }
- return output
- }
- var sprintf_cache = Object.create(null)
- function sprintf_parse(fmt) {
- if (sprintf_cache[fmt]) {
- return sprintf_cache[fmt]
- }
- var _fmt = fmt, match, parse_tree = [], arg_names = 0
- while (_fmt) {
- if ((match = re.text.exec(_fmt)) !== null) {
- parse_tree.push(match[0])
- }
- else if ((match = re.modulo.exec(_fmt)) !== null) {
- parse_tree.push('%')
- }
- else if ((match = re.placeholder.exec(_fmt)) !== null) {
- if (match[2]) {
- arg_names |= 1
- var field_list = [], replacement_field = match[2], field_match = []
- if ((field_match = re.key.exec(replacement_field)) !== null) {
- field_list.push(field_match[1])
- while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
- if ((field_match = re.key_access.exec(replacement_field)) !== null) {
- field_list.push(field_match[1])
- }
- else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
- field_list.push(field_match[1])
- }
- else {
- throw new SyntaxError('[sprintf] failed to parse named argument key')
- }
- }
- }
- else {
- throw new SyntaxError('[sprintf] failed to parse named argument key')
- }
- match[2] = field_list
- }
- else {
- arg_names |= 2
- }
- if (arg_names === 3) {
- throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported')
- }
- parse_tree.push(
- {
- placeholder: match[0],
- param_no: match[1],
- keys: match[2],
- sign: match[3],
- pad_char: match[4],
- align: match[5],
- width: match[6],
- precision: match[7],
- type: match[8]
- }
- )
- }
- else {
- throw new SyntaxError('[sprintf] unexpected placeholder')
- }
- _fmt = _fmt.substring(match[0].length)
- }
- return sprintf_cache[fmt] = parse_tree
- }
- /**
- * export to either browser or node.js
- */
- /* eslint-disable quote-props */
- if (true) {
- exports['sprintf'] = sprintf
- exports['vsprintf'] = vsprintf
- }
- if (typeof window !== 'undefined') {
- window['sprintf'] = sprintf
- window['vsprintf'] = vsprintf
- if (true) {
- !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
- return {
- 'sprintf': sprintf,
- 'vsprintf': vsprintf
- }
- }).call(exports, __webpack_require__, exports, module),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
- }
- }
- /* eslint-enable quote-props */
- }(); // eslint-disable-line
- /***/ }),
- /***/ 360:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
- var objectSpread = __webpack_require__(7);
- // CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
- var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
- /**
- * Operator precedence mapping.
- *
- * @type {Object}
- */
- PRECEDENCE = {
- '(': 9,
- '!': 8,
- '*': 7,
- '/': 7,
- '%': 7,
- '+': 6,
- '-': 6,
- '<': 5,
- '<=': 5,
- '>': 5,
- '>=': 5,
- '==': 4,
- '!=': 4,
- '&&': 3,
- '||': 2,
- '?': 1,
- '?:': 1,
- };
- /**
- * Characters which signal pair opening, to be terminated by terminators.
- *
- * @type {string[]}
- */
- OPENERS = [ '(', '?' ];
- /**
- * Characters which signal pair termination, the value an array with the
- * opener as its first member. The second member is an optional operator
- * replacement to push to the stack.
- *
- * @type {string[]}
- */
- TERMINATORS = {
- ')': [ '(' ],
- ':': [ '?', '?:' ],
- };
- /**
- * Pattern matching operators and openers.
- *
- * @type {RegExp}
- */
- PATTERN = /<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;
- /**
- * Given a C expression, returns the equivalent postfix (Reverse Polish)
- * notation terms as an array.
- *
- * If a postfix string is desired, simply `.join( ' ' )` the result.
- *
- * @example
- *
- * ```js
- * import postfix from '@tannin/postfix';
- *
- * postfix( 'n > 1' );
- * // ⇒ [ 'n', '1', '>' ]
- * ```
- *
- * @param {string} expression C expression.
- *
- * @return {string[]} Postfix terms.
- */
- function postfix( expression ) {
- var terms = [],
- stack = [],
- match, operator, term, element;
- while ( ( match = expression.match( PATTERN ) ) ) {
- operator = match[ 0 ];
- // Term is the string preceding the operator match. It may contain
- // whitespace, and may be empty (if operator is at beginning).
- term = expression.substr( 0, match.index ).trim();
- if ( term ) {
- terms.push( term );
- }
- while ( ( element = stack.pop() ) ) {
- if ( TERMINATORS[ operator ] ) {
- if ( TERMINATORS[ operator ][ 0 ] === element ) {
- // Substitution works here under assumption that because
- // the assigned operator will no longer be a terminator, it
- // will be pushed to the stack during the condition below.
- operator = TERMINATORS[ operator ][ 1 ] || operator;
- break;
- }
- } else if ( OPENERS.indexOf( element ) >= 0 || PRECEDENCE[ element ] < PRECEDENCE[ operator ] ) {
- // Push to stack if either an opener or when pop reveals an
- // element of lower precedence.
- stack.push( element );
- break;
- }
- // For each popped from stack, push to terms.
- terms.push( element );
- }
- if ( ! TERMINATORS[ operator ] ) {
- stack.push( operator );
- }
- // Slice matched fragment from expression to continue match.
- expression = expression.substr( match.index + operator.length );
- }
- // Push remainder of operand, if exists, to terms.
- expression = expression.trim();
- if ( expression ) {
- terms.push( expression );
- }
- // Pop remaining items from stack into terms.
- return terms.concat( stack.reverse() );
- }
- // CONCATENATED MODULE: ./node_modules/@tannin/evaluate/index.js
- /**
- * Operator callback functions.
- *
- * @type {Object}
- */
- var OPERATORS = {
- '!': function( a ) {
- return ! a;
- },
- '*': function( a, b ) {
- return a * b;
- },
- '/': function( a, b ) {
- return a / b;
- },
- '%': function( a, b ) {
- return a % b;
- },
- '+': function( a, b ) {
- return a + b;
- },
- '-': function( a, b ) {
- return a - b;
- },
- '<': function( a, b ) {
- return a < b;
- },
- '<=': function( a, b ) {
- return a <= b;
- },
- '>': function( a, b ) {
- return a > b;
- },
- '>=': function( a, b ) {
- return a >= b;
- },
- '==': function( a, b ) {
- return a === b;
- },
- '!=': function( a, b ) {
- return a !== b;
- },
- '&&': function( a, b ) {
- return a && b;
- },
- '||': function( a, b ) {
- return a || b;
- },
- '?:': function( a, b, c ) {
- if ( a ) {
- throw b;
- }
- return c;
- },
- };
- /**
- * Given an array of postfix terms and operand variables, returns the result of
- * the postfix evaluation.
- *
- * @example
- *
- * ```js
- * import evaluate from '@tannin/evaluate';
- *
- * // 3 + 4 * 5 / 6 ⇒ '3 4 5 * 6 / +'
- * const terms = [ '3', '4', '5', '*', '6', '/', '+' ];
- *
- * evaluate( terms, {} );
- * // ⇒ 6.333333333333334
- * ```
- *
- * @param {string[]} postfix Postfix terms.
- * @param {Object} variables Operand variables.
- *
- * @return {*} Result of evaluation.
- */
- function evaluate_evaluate( postfix, variables ) {
- var stack = [],
- i, j, args, getOperatorResult, term, value;
- for ( i = 0; i < postfix.length; i++ ) {
- term = postfix[ i ];
- getOperatorResult = OPERATORS[ term ];
- if ( getOperatorResult ) {
- // Pop from stack by number of function arguments.
- j = getOperatorResult.length;
- args = Array( j );
- while ( j-- ) {
- args[ j ] = stack.pop();
- }
- try {
- value = getOperatorResult.apply( null, args );
- } catch ( earlyReturn ) {
- return earlyReturn;
- }
- } else if ( variables.hasOwnProperty( term ) ) {
- value = variables[ term ];
- } else {
- value = +term;
- }
- stack.push( value );
- }
- return stack[ 0 ];
- }
- // CONCATENATED MODULE: ./node_modules/@tannin/compile/index.js
- /**
- * Given a C expression, returns a function which can be called to evaluate its
- * result.
- *
- * @example
- *
- * ```js
- * import compile from '@tannin/compile';
- *
- * const evaluate = compile( 'n > 1' );
- *
- * evaluate( { n: 2 } );
- * // ⇒ true
- * ```
- *
- * @param {string} expression C expression.
- *
- * @return {Function} Compiled evaluator.
- */
- function compile( expression ) {
- var terms = postfix( expression );
- return function( variables ) {
- return evaluate_evaluate( terms, variables );
- };
- }
- // CONCATENATED MODULE: ./node_modules/@tannin/plural-forms/index.js
- /**
- * Given a C expression, returns a function which, when called with a value,
- * evaluates the result with the value assumed to be the "n" variable of the
- * expression. The result will be coerced to its numeric equivalent.
- *
- * @param {string} expression C expression.
- *
- * @return {Function} Evaluator function.
- */
- function pluralForms( expression ) {
- var evaluate = compile( expression );
- return function( n ) {
- return +evaluate( { n: n } );
- };
- }
- // CONCATENATED MODULE: ./node_modules/tannin/index.js
- /**
- * Tannin constructor options.
- *
- * @property {?string} contextDelimiter Joiner in string lookup with context.
- * @property {?Function} onMissingKey Callback to invoke when key missing.
- *
- * @type {Object}
- *
- * @typedef {TanninOptions}
- */
- /**
- * Default Tannin constructor options.
- *
- * @type {TanninOptions}
- */
- var DEFAULT_OPTIONS = {
- contextDelimiter: '\u0004',
- onMissingKey: null,
- };
- /**
- * Given a specific locale data's config `plural_forms` value, returns the
- * expression.
- *
- * @example
- *
- * ```
- * getPluralExpression( 'nplurals=2; plural=(n != 1);' ) === '(n != 1)'
- * ```
- *
- * @param {string} pf Locale data plural forms.
- *
- * @return {string} Plural forms expression.
- */
- function getPluralExpression( pf ) {
- var parts, i, part;
- parts = pf.split( ';' );
- for ( i = 0; i < parts.length; i++ ) {
- part = parts[ i ].trim();
- if ( part.indexOf( 'plural=' ) === 0 ) {
- return part.substr( 7 );
- }
- }
- }
- /**
- * Tannin constructor.
- *
- * @param {Object} data Jed-formatted locale data.
- * @param {TanninOptions} options Tannin options.
- */
- function Tannin( data, options ) {
- var key;
- this.data = data;
- this.pluralForms = {};
- options = options || {};
- this.options = {};
- for ( key in DEFAULT_OPTIONS ) {
- this.options[ key ] = options[ key ] || DEFAULT_OPTIONS[ key ];
- }
- }
- /**
- * Returns the plural form index for the given domain and value.
- *
- * @param {string} domain Domain on which to calculate plural form.
- * @param {number} n Value for which plural form is to be calculated.
- *
- * @return {number} Plural form index.
- */
- Tannin.prototype.getPluralForm = function( domain, n ) {
- var getPluralForm = this.pluralForms[ domain ],
- config, plural, pf;
- if ( ! getPluralForm ) {
- config = this.data[ domain ][ '' ];
- pf = (
- config[ 'Plural-Forms' ] ||
- config[ 'plural-forms' ] ||
- config.plural_forms
- );
- if ( typeof pf !== 'function' ) {
- plural = getPluralExpression(
- config[ 'Plural-Forms' ] ||
- config[ 'plural-forms' ] ||
- config.plural_forms
- );
- pf = pluralForms( plural );
- }
- getPluralForm = this.pluralForms[ domain ] = pf;
- }
- return getPluralForm( n );
- };
- /**
- * Translate a string.
- *
- * @param {string} domain Translation domain.
- * @param {string} context Context distinguishing terms of the same name.
- * @param {string} singular Primary key for translation lookup.
- * @param {string} plural Fallback value used for non-zero plural form index.
- * @param {number} n Value to use in calculating plural form.
- *
- * @return {string} Translated string.
- */
- Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) {
- var index, key, entry;
- if ( n === undefined ) {
- // Default to singular.
- index = 0;
- } else {
- // Find index by evaluating plural form for value.
- index = this.getPluralForm( domain, n );
- }
- key = singular;
- // If provided, context is prepended to key with delimiter.
- if ( context ) {
- key = context + this.options.contextDelimiter + singular;
- }
- entry = this.data[ domain ][ key ];
- // Verify not only that entry exists, but that the intended index is within
- // range and non-empty.
- if ( entry && entry[ index ] ) {
- return entry[ index ];
- }
- if ( this.options.onMissingKey ) {
- this.options.onMissingKey( singular, domain );
- }
- // If entry not found, fall back to singular vs. plural with zero index
- // representing the singular value.
- return index === 0 ? singular : plural;
- };
- // EXTERNAL MODULE: ./node_modules/memize/index.js
- var memize = __webpack_require__(44);
- var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
- // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
- var sprintf = __webpack_require__(146);
- var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
- // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return setLocaleData; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__", function() { return __; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_x", function() { return _x; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_n", function() { return _n; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_nx", function() { return _nx; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sprintf", function() { return build_module_sprintf; });
- /**
- * External dependencies
- */
- /**
- * Default locale data to use for Tannin domain when not otherwise provided.
- * Assumes an English plural forms expression.
- *
- * @type {Object}
- */
- var DEFAULT_LOCALE_DATA = {
- '': {
- plural_forms: function plural_forms(n) {
- return n === 1 ? 0 : 1;
- }
- }
- };
- /**
- * Log to console, once per message; or more precisely, per referentially equal
- * argument set. Because Jed throws errors, we log these to the console instead
- * to avoid crashing the application.
- *
- * @param {...*} args Arguments to pass to `console.error`
- */
- var logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
- /**
- * The underlying instance of Tannin to which exported functions interface.
- *
- * @type {Tannin}
- */
- var i18n = new Tannin({});
- /**
- * Merges locale data into the Tannin instance by domain. Accepts data in a
- * Jed-formatted JSON object shape.
- *
- * @see http://messageformat.github.io/Jed/
- *
- * @param {?Object} data Locale data configuration.
- * @param {?string} domain Domain for which configuration applies.
- */
- function setLocaleData(data) {
- var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
- i18n.data[domain] = Object(objectSpread["a" /* default */])({}, DEFAULT_LOCALE_DATA, i18n.data[domain], data); // Populate default domain configuration (supported locale date which omits
- // a plural forms expression).
- i18n.data[domain][''] = Object(objectSpread["a" /* default */])({}, DEFAULT_LOCALE_DATA[''], i18n.data[domain]['']);
- }
- /**
- * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
- * otherwise previously assigned.
- *
- * @param {?string} domain Domain to retrieve the translated text.
- * @param {?string} context Context information for the translators.
- * @param {string} single Text to translate if non-plural. Used as fallback
- * return value on a caught error.
- * @param {?string} plural The text to be used if the number is plural.
- * @param {?number} number The number to compare against to use either the
- * singular or plural form.
- *
- * @return {string} The translated string.
- */
- function dcnpgettext() {
- var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
- var context = arguments.length > 1 ? arguments[1] : undefined;
- var single = arguments.length > 2 ? arguments[2] : undefined;
- var plural = arguments.length > 3 ? arguments[3] : undefined;
- var number = arguments.length > 4 ? arguments[4] : undefined;
- if (!i18n.data[domain]) {
- setLocaleData(undefined, domain);
- }
- return i18n.dcnpgettext(domain, context, single, plural, number);
- }
- /**
- * Retrieve the translation of text.
- *
- * @see https://developer.wordpress.org/reference/functions/__/
- *
- * @param {string} text Text to translate.
- * @param {?string} domain Domain to retrieve the translated text.
- *
- * @return {string} Translated text.
- */
- function __(text, domain) {
- return dcnpgettext(domain, undefined, text);
- }
- /**
- * Retrieve translated string with gettext context.
- *
- * @see https://developer.wordpress.org/reference/functions/_x/
- *
- * @param {string} text Text to translate.
- * @param {string} context Context information for the translators.
- * @param {?string} domain Domain to retrieve the translated text.
- *
- * @return {string} Translated context string without pipe.
- */
- function _x(text, context, domain) {
- return dcnpgettext(domain, context, text);
- }
- /**
- * Translates and retrieves the singular or plural form based on the supplied
- * number.
- *
- * @see https://developer.wordpress.org/reference/functions/_n/
- *
- * @param {string} single The text to be used if the number is singular.
- * @param {string} plural The text to be used if the number is plural.
- * @param {number} number The number to compare against to use either the
- * singular or plural form.
- * @param {?string} domain Domain to retrieve the translated text.
- *
- * @return {string} The translated singular or plural form.
- */
- function _n(single, plural, number, domain) {
- return dcnpgettext(domain, undefined, single, plural, number);
- }
- /**
- * Translates and retrieves the singular or plural form based on the supplied
- * number, with gettext context.
- *
- * @see https://developer.wordpress.org/reference/functions/_nx/
- *
- * @param {string} single The text to be used if the number is singular.
- * @param {string} plural The text to be used if the number is plural.
- * @param {number} number The number to compare against to use either the
- * singular or plural form.
- * @param {string} context Context information for the translators.
- * @param {?string} domain Domain to retrieve the translated text.
- *
- * @return {string} The translated singular or plural form.
- */
- function _nx(single, plural, number, context, domain) {
- return dcnpgettext(domain, context, single, plural, number);
- }
- /**
- * Returns a formatted string. If an error occurs in applying the format, the
- * original format string is returned.
- *
- * @param {string} format The format of the string to generate.
- * @param {...string} args Arguments to apply to the format.
- *
- * @see http://www.diveintojavascript.com/projects/javascript-sprintf
- *
- * @return {string} The formatted string.
- */
- function build_module_sprintf(format) {
- try {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- return sprintf_default.a.sprintf.apply(sprintf_default.a, [format].concat(args));
- } catch (error) {
- logErrorOnce('sprintf error: \n\n' + error.toString());
- return format;
- }
- }
- /***/ }),
- /***/ 44:
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = function memize( fn, options ) {
- var size = 0,
- maxSize, head, tail;
- if ( options && options.maxSize ) {
- maxSize = options.maxSize;
- }
- function memoized( /* ...args */ ) {
- var node = head,
- len = arguments.length,
- args, i;
- searchCache: while ( node ) {
- // Perform a shallow equality test to confirm that whether the node
- // under test is a candidate for the arguments passed. Two arrays
- // are shallowly equal if their length matches and each entry is
- // strictly equal between the two sets. Avoid abstracting to a
- // function which could incur an arguments leaking deoptimization.
- // Check whether node arguments match arguments length
- if ( node.args.length !== arguments.length ) {
- node = node.next;
- continue;
- }
- // Check whether node arguments match arguments values
- for ( i = 0; i < len; i++ ) {
- if ( node.args[ i ] !== arguments[ i ] ) {
- node = node.next;
- continue searchCache;
- }
- }
- // At this point we can assume we've found a match
- // Surface matched node to head if not already
- if ( node !== head ) {
- // As tail, shift to previous. Must only shift if not also
- // head, since if both head and tail, there is no previous.
- if ( node === tail ) {
- tail = node.prev;
- }
- // Adjust siblings to point to each other. If node was tail,
- // this also handles new tail's empty `next` assignment.
- node.prev.next = node.next;
- if ( node.next ) {
- node.next.prev = node.prev;
- }
- node.next = head;
- node.prev = null;
- head.prev = node;
- head = node;
- }
- // Return immediately
- return node.val;
- }
- // No cached value found. Continue to insertion phase:
- // Create a copy of arguments (avoid leaking deoptimization)
- args = new Array( len );
- for ( i = 0; i < len; i++ ) {
- args[ i ] = arguments[ i ];
- }
- node = {
- args: args,
- // Generate the result from original function
- val: fn.apply( null, args )
- };
- // Don't need to check whether node is already head, since it would
- // have been returned above already if it was
- // Shift existing head down list
- if ( head ) {
- head.prev = node;
- node.next = head;
- } else {
- // If no head, follows that there's no tail (at initial or reset)
- tail = node;
- }
- // Trim tail if we're reached max size and are pending cache insertion
- if ( size === maxSize ) {
- tail = tail.prev;
- tail.next = null;
- } else {
- size++;
- }
- head = node;
- return node.val;
- }
- memoized.clear = function() {
- head = null;
- tail = null;
- size = 0;
- };
- if ( false ) {}
- return memoized;
- };
- /***/ }),
- /***/ 7:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
- /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
- ownKeys.forEach(function (key) {
- Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
- });
- }
- return target;
- }
- /***/ })
- /******/ });
|