[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-includes/js/dist/ -> i18n.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["i18n"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  37  /******/     // define getter function for harmony exports
  38  /******/     __webpack_require__.d = function(exports, name, getter) {
  39  /******/         if(!__webpack_require__.o(exports, name)) {
  40  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41  /******/         }
  42  /******/     };
  43  /******/
  44  /******/     // define __esModule on exports
  45  /******/     __webpack_require__.r = function(exports) {
  46  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48  /******/         }
  49  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  50  /******/     };
  51  /******/
  52  /******/     // create a fake namespace object
  53  /******/     // mode & 1: value is a module id, require it
  54  /******/     // mode & 2: merge all properties of value into the ns
  55  /******/     // mode & 4: return value when already ns object
  56  /******/     // mode & 8|1: behave like require
  57  /******/     __webpack_require__.t = function(value, mode) {
  58  /******/         if(mode & 1) value = __webpack_require__(value);
  59  /******/         if(mode & 8) return value;
  60  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61  /******/         var ns = Object.create(null);
  62  /******/         __webpack_require__.r(ns);
  63  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65  /******/         return ns;
  66  /******/     };
  67  /******/
  68  /******/     // getDefaultExport function for compatibility with non-harmony modules
  69  /******/     __webpack_require__.n = function(module) {
  70  /******/         var getter = module && module.__esModule ?
  71  /******/ 			function getDefault() { return module['default']; } :
  72  /******/ 			function getModuleExports() { return module; };
  73  /******/         __webpack_require__.d(getter, 'a', getter);
  74  /******/         return getter;
  75  /******/     };
  76  /******/
  77  /******/     // Object.prototype.hasOwnProperty.call
  78  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79  /******/
  80  /******/     // __webpack_public_path__
  81  /******/     __webpack_require__.p = "";
  82  /******/
  83  /******/
  84  /******/     // Load entry module and return exports
  85  /******/     return __webpack_require__(__webpack_require__.s = 360);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 10:
  91  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  92  
  93  "use strict";
  94  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
  95  function _defineProperty(obj, key, value) {
  96    if (key in obj) {
  97      Object.defineProperty(obj, key, {
  98        value: value,
  99        enumerable: true,
 100        configurable: true,
 101        writable: true
 102      });
 103    } else {
 104      obj[key] = value;
 105    }
 106  
 107    return obj;
 108  }
 109  
 110  /***/ }),
 111  
 112  /***/ 146:
 113  /***/ (function(module, exports, __webpack_require__) {
 114  
 115  var __WEBPACK_AMD_DEFINE_RESULT__;/* global window, exports, define */
 116  
 117  !function() {
 118      'use strict'
 119  
 120      var re = {
 121          not_string: /[^s]/,
 122          not_bool: /[^t]/,
 123          not_type: /[^T]/,
 124          not_primitive: /[^v]/,
 125          number: /[diefg]/,
 126          numeric_arg: /[bcdiefguxX]/,
 127          json: /[j]/,
 128          not_json: /[^j]/,
 129          text: /^[^\x25]+/,
 130          modulo: /^\x25{2}/,
 131          placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
 132          key: /^([a-z_][a-z_\d]*)/i,
 133          key_access: /^\.([a-z_][a-z_\d]*)/i,
 134          index_access: /^\[(\d+)\]/,
 135          sign: /^[+-]/
 136      }
 137  
 138      function sprintf(key) {
 139          // `arguments` is not an array, but should be fine for this call
 140          return sprintf_format(sprintf_parse(key), arguments)
 141      }
 142  
 143      function vsprintf(fmt, argv) {
 144          return sprintf.apply(null, [fmt].concat(argv || []))
 145      }
 146  
 147      function sprintf_format(parse_tree, argv) {
 148          var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign
 149          for (i = 0; i < tree_length; i++) {
 150              if (typeof parse_tree[i] === 'string') {
 151                  output += parse_tree[i]
 152              }
 153              else if (typeof parse_tree[i] === 'object') {
 154                  ph = parse_tree[i] // convenience purposes only
 155                  if (ph.keys) { // keyword argument
 156                      arg = argv[cursor]
 157                      for (k = 0; k < ph.keys.length; k++) {
 158                          if (arg == undefined) {
 159                              throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1]))
 160                          }
 161                          arg = arg[ph.keys[k]]
 162                      }
 163                  }
 164                  else if (ph.param_no) { // positional argument (explicit)
 165                      arg = argv[ph.param_no]
 166                  }
 167                  else { // positional argument (implicit)
 168                      arg = argv[cursor++]
 169                  }
 170  
 171                  if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
 172                      arg = arg()
 173                  }
 174  
 175                  if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) {
 176                      throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg))
 177                  }
 178  
 179                  if (re.number.test(ph.type)) {
 180                      is_positive = arg >= 0
 181                  }
 182  
 183                  switch (ph.type) {
 184                      case 'b':
 185                          arg = parseInt(arg, 10).toString(2)
 186                          break
 187                      case 'c':
 188                          arg = String.fromCharCode(parseInt(arg, 10))
 189                          break
 190                      case 'd':
 191                      case 'i':
 192                          arg = parseInt(arg, 10)
 193                          break
 194                      case 'j':
 195                          arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0)
 196                          break
 197                      case 'e':
 198                          arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential()
 199                          break
 200                      case 'f':
 201                          arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg)
 202                          break
 203                      case 'g':
 204                          arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg)
 205                          break
 206                      case 'o':
 207                          arg = (parseInt(arg, 10) >>> 0).toString(8)
 208                          break
 209                      case 's':
 210                          arg = String(arg)
 211                          arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
 212                          break
 213                      case 't':
 214                          arg = String(!!arg)
 215                          arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
 216                          break
 217                      case 'T':
 218                          arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase()
 219                          arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
 220                          break
 221                      case 'u':
 222                          arg = parseInt(arg, 10) >>> 0
 223                          break
 224                      case 'v':
 225                          arg = arg.valueOf()
 226                          arg = (ph.precision ? arg.substring(0, ph.precision) : arg)
 227                          break
 228                      case 'x':
 229                          arg = (parseInt(arg, 10) >>> 0).toString(16)
 230                          break
 231                      case 'X':
 232                          arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase()
 233                          break
 234                  }
 235                  if (re.json.test(ph.type)) {
 236                      output += arg
 237                  }
 238                  else {
 239                      if (re.number.test(ph.type) && (!is_positive || ph.sign)) {
 240                          sign = is_positive ? '+' : '-'
 241                          arg = arg.toString().replace(re.sign, '')
 242                      }
 243                      else {
 244                          sign = ''
 245                      }
 246                      pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' '
 247                      pad_length = ph.width - (sign + arg).length
 248                      pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : ''
 249                      output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg)
 250                  }
 251              }
 252          }
 253          return output
 254      }
 255  
 256      var sprintf_cache = Object.create(null)
 257  
 258      function sprintf_parse(fmt) {
 259          if (sprintf_cache[fmt]) {
 260              return sprintf_cache[fmt]
 261          }
 262  
 263          var _fmt = fmt, match, parse_tree = [], arg_names = 0
 264          while (_fmt) {
 265              if ((match = re.text.exec(_fmt)) !== null) {
 266                  parse_tree.push(match[0])
 267              }
 268              else if ((match = re.modulo.exec(_fmt)) !== null) {
 269                  parse_tree.push('%')
 270              }
 271              else if ((match = re.placeholder.exec(_fmt)) !== null) {
 272                  if (match[2]) {
 273                      arg_names |= 1
 274                      var field_list = [], replacement_field = match[2], field_match = []
 275                      if ((field_match = re.key.exec(replacement_field)) !== null) {
 276                          field_list.push(field_match[1])
 277                          while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
 278                              if ((field_match = re.key_access.exec(replacement_field)) !== null) {
 279                                  field_list.push(field_match[1])
 280                              }
 281                              else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
 282                                  field_list.push(field_match[1])
 283                              }
 284                              else {
 285                                  throw new SyntaxError('[sprintf] failed to parse named argument key')
 286                              }
 287                          }
 288                      }
 289                      else {
 290                          throw new SyntaxError('[sprintf] failed to parse named argument key')
 291                      }
 292                      match[2] = field_list
 293                  }
 294                  else {
 295                      arg_names |= 2
 296                  }
 297                  if (arg_names === 3) {
 298                      throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported')
 299                  }
 300  
 301                  parse_tree.push(
 302                      {
 303                          placeholder: match[0],
 304                          param_no:    match[1],
 305                          keys:        match[2],
 306                          sign:        match[3],
 307                          pad_char:    match[4],
 308                          align:       match[5],
 309                          width:       match[6],
 310                          precision:   match[7],
 311                          type:        match[8]
 312                      }
 313                  )
 314              }
 315              else {
 316                  throw new SyntaxError('[sprintf] unexpected placeholder')
 317              }
 318              _fmt = _fmt.substring(match[0].length)
 319          }
 320          return sprintf_cache[fmt] = parse_tree
 321      }
 322  
 323      /**
 324       * export to either browser or node.js
 325       */
 326      /* eslint-disable quote-props */
 327      if (true) {
 328          exports['sprintf'] = sprintf
 329          exports['vsprintf'] = vsprintf
 330      }
 331      if (typeof window !== 'undefined') {
 332          window['sprintf'] = sprintf
 333          window['vsprintf'] = vsprintf
 334  
 335          if (true) {
 336              !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
 337                  return {
 338                      'sprintf': sprintf,
 339                      'vsprintf': vsprintf
 340                  }
 341              }).call(exports, __webpack_require__, exports, module),
 342                  __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
 343          }
 344      }
 345      /* eslint-enable quote-props */
 346  }(); // eslint-disable-line
 347  
 348  
 349  /***/ }),
 350  
 351  /***/ 360:
 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  
 360  // CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
 361  var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
 362  
 363  /**
 364   * Operator precedence mapping.
 365   *
 366   * @type {Object}
 367   */
 368  PRECEDENCE = {
 369      '(': 9,
 370      '!': 8,
 371      '*': 7,
 372      '/': 7,
 373      '%': 7,
 374      '+': 6,
 375      '-': 6,
 376      '<': 5,
 377      '<=': 5,
 378      '>': 5,
 379      '>=': 5,
 380      '==': 4,
 381      '!=': 4,
 382      '&&': 3,
 383      '||': 2,
 384      '?': 1,
 385      '?:': 1,
 386  };
 387  
 388  /**
 389   * Characters which signal pair opening, to be terminated by terminators.
 390   *
 391   * @type {string[]}
 392   */
 393  OPENERS = [ '(', '?' ];
 394  
 395  /**
 396   * Characters which signal pair termination, the value an array with the
 397   * opener as its first member. The second member is an optional operator
 398   * replacement to push to the stack.
 399   *
 400   * @type {string[]}
 401   */
 402  TERMINATORS = {
 403      ')': [ '(' ],
 404      ':': [ '?', '?:' ],
 405  };
 406  
 407  /**
 408   * Pattern matching operators and openers.
 409   *
 410   * @type {RegExp}
 411   */
 412  PATTERN = /<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;
 413  
 414  /**
 415   * Given a C expression, returns the equivalent postfix (Reverse Polish)
 416   * notation terms as an array.
 417   *
 418   * If a postfix string is desired, simply `.join( ' ' )` the result.
 419   *
 420   * @example
 421   *
 422   * ```js
 423   * import postfix from '@tannin/postfix';
 424   *
 425   * postfix( 'n > 1' );
 426   * // ⇒ [ 'n', '1', '>' ]
 427   * ```
 428   *
 429   * @param {string} expression C expression.
 430   *
 431   * @return {string[]} Postfix terms.
 432   */
 433  function postfix( expression ) {
 434      var terms = [],
 435          stack = [],
 436          match, operator, term, element;
 437  
 438      while ( ( match = expression.match( PATTERN ) ) ) {
 439          operator = match[ 0 ];
 440  
 441          // Term is the string preceding the operator match. It may contain
 442          // whitespace, and may be empty (if operator is at beginning).
 443          term = expression.substr( 0, match.index ).trim();
 444          if ( term ) {
 445              terms.push( term );
 446          }
 447  
 448          while ( ( element = stack.pop() ) ) {
 449              if ( TERMINATORS[ operator ] ) {
 450                  if ( TERMINATORS[ operator ][ 0 ] === element ) {
 451                      // Substitution works here under assumption that because
 452                      // the assigned operator will no longer be a terminator, it
 453                      // will be pushed to the stack during the condition below.
 454                      operator = TERMINATORS[ operator ][ 1 ] || operator;
 455                      break;
 456                  }
 457              } else if ( OPENERS.indexOf( element ) >= 0 || PRECEDENCE[ element ] < PRECEDENCE[ operator ] ) {
 458                  // Push to stack if either an opener or when pop reveals an
 459                  // element of lower precedence.
 460                  stack.push( element );
 461                  break;
 462              }
 463  
 464              // For each popped from stack, push to terms.
 465              terms.push( element );
 466          }
 467  
 468          if ( ! TERMINATORS[ operator ] ) {
 469              stack.push( operator );
 470          }
 471  
 472          // Slice matched fragment from expression to continue match.
 473          expression = expression.substr( match.index + operator.length );
 474      }
 475  
 476      // Push remainder of operand, if exists, to terms.
 477      expression = expression.trim();
 478      if ( expression ) {
 479          terms.push( expression );
 480      }
 481  
 482      // Pop remaining items from stack into terms.
 483      return terms.concat( stack.reverse() );
 484  }
 485  
 486  // CONCATENATED MODULE: ./node_modules/@tannin/evaluate/index.js
 487  /**
 488   * Operator callback functions.
 489   *
 490   * @type {Object}
 491   */
 492  var OPERATORS = {
 493      '!': function( a ) {
 494          return ! a;
 495      },
 496      '*': function( a, b ) {
 497          return a * b;
 498      },
 499      '/': function( a, b ) {
 500          return a / b;
 501      },
 502      '%': function( a, b ) {
 503          return a % b;
 504      },
 505      '+': function( a, b ) {
 506          return a + b;
 507      },
 508      '-': function( a, b ) {
 509          return a - b;
 510      },
 511      '<': function( a, b ) {
 512          return a < b;
 513      },
 514      '<=': function( a, b ) {
 515          return a <= b;
 516      },
 517      '>': function( a, b ) {
 518          return a > b;
 519      },
 520      '>=': function( a, b ) {
 521          return a >= b;
 522      },
 523      '==': function( a, b ) {
 524          return a === b;
 525      },
 526      '!=': function( a, b ) {
 527          return a !== b;
 528      },
 529      '&&': function( a, b ) {
 530          return a && b;
 531      },
 532      '||': function( a, b ) {
 533          return a || b;
 534      },
 535      '?:': function( a, b, c ) {
 536          if ( a ) {
 537              throw b;
 538          }
 539  
 540          return c;
 541      },
 542  };
 543  
 544  /**
 545   * Given an array of postfix terms and operand variables, returns the result of
 546   * the postfix evaluation.
 547   *
 548   * @example
 549   *
 550   * ```js
 551   * import evaluate from '@tannin/evaluate';
 552   *
 553   * // 3 + 4 * 5 / 6 ⇒ '3 4 5 * 6 / +'
 554   * const terms = [ '3', '4', '5', '*', '6', '/', '+' ];
 555   *
 556   * evaluate( terms, {} );
 557   * // ⇒ 6.333333333333334
 558   * ```
 559   *
 560   * @param {string[]} postfix   Postfix terms.
 561   * @param {Object}   variables Operand variables.
 562   *
 563   * @return {*} Result of evaluation.
 564   */
 565  function evaluate_evaluate( postfix, variables ) {
 566      var stack = [],
 567          i, j, args, getOperatorResult, term, value;
 568  
 569      for ( i = 0; i < postfix.length; i++ ) {
 570          term = postfix[ i ];
 571  
 572          getOperatorResult = OPERATORS[ term ];
 573          if ( getOperatorResult ) {
 574              // Pop from stack by number of function arguments.
 575              j = getOperatorResult.length;
 576              args = Array( j );
 577              while ( j-- ) {
 578                  args[ j ] = stack.pop();
 579              }
 580  
 581              try {
 582                  value = getOperatorResult.apply( null, args );
 583              } catch ( earlyReturn ) {
 584                  return earlyReturn;
 585              }
 586          } else if ( variables.hasOwnProperty( term ) ) {
 587              value = variables[ term ];
 588          } else {
 589              value = +term;
 590          }
 591  
 592          stack.push( value );
 593      }
 594  
 595      return stack[ 0 ];
 596  }
 597  
 598  // CONCATENATED MODULE: ./node_modules/@tannin/compile/index.js
 599  
 600  
 601  
 602  /**
 603   * Given a C expression, returns a function which can be called to evaluate its
 604   * result.
 605   *
 606   * @example
 607   *
 608   * ```js
 609   * import compile from '@tannin/compile';
 610   *
 611   * const evaluate = compile( 'n > 1' );
 612   *
 613   * evaluate( { n: 2 } );
 614   * // ⇒ true
 615   * ```
 616   *
 617   * @param {string} expression C expression.
 618   *
 619   * @return {Function} Compiled evaluator.
 620   */
 621  function compile( expression ) {
 622      var terms = postfix( expression );
 623  
 624      return function( variables ) {
 625          return evaluate_evaluate( terms, variables );
 626      };
 627  }
 628  
 629  // CONCATENATED MODULE: ./node_modules/@tannin/plural-forms/index.js
 630  
 631  
 632  /**
 633   * Given a C expression, returns a function which, when called with a value,
 634   * evaluates the result with the value assumed to be the "n" variable of the
 635   * expression. The result will be coerced to its numeric equivalent.
 636   *
 637   * @param {string} expression C expression.
 638   *
 639   * @return {Function} Evaluator function.
 640   */
 641  function pluralForms( expression ) {
 642      var evaluate = compile( expression );
 643  
 644      return function( n ) {
 645          return +evaluate( { n: n } );
 646      };
 647  }
 648  
 649  // CONCATENATED MODULE: ./node_modules/tannin/index.js
 650  
 651  
 652  /**
 653   * Tannin constructor options.
 654   *
 655   * @property {?string}   contextDelimiter Joiner in string lookup with context.
 656   * @property {?Function} onMissingKey     Callback to invoke when key missing.
 657   *
 658   * @type {Object}
 659   *
 660   * @typedef {TanninOptions}
 661   */
 662  
 663  /**
 664   * Default Tannin constructor options.
 665   *
 666   * @type {TanninOptions}
 667   */
 668  var DEFAULT_OPTIONS = {
 669      contextDelimiter: '\u0004',
 670      onMissingKey: null,
 671  };
 672  
 673  /**
 674   * Given a specific locale data's config `plural_forms` value, returns the
 675   * expression.
 676   *
 677   * @example
 678   *
 679   * ```
 680   * getPluralExpression( 'nplurals=2; plural=(n != 1);' ) === '(n != 1)'
 681   * ```
 682   *
 683   * @param {string} pf Locale data plural forms.
 684   *
 685   * @return {string} Plural forms expression.
 686   */
 687  function getPluralExpression( pf ) {
 688      var parts, i, part;
 689  
 690      parts = pf.split( ';' );
 691  
 692      for ( i = 0; i < parts.length; i++ ) {
 693          part = parts[ i ].trim();
 694          if ( part.indexOf( 'plural=' ) === 0 ) {
 695              return part.substr( 7 );
 696          }
 697      }
 698  }
 699  
 700  /**
 701   * Tannin constructor.
 702   *
 703   * @param {Object}        data    Jed-formatted locale data.
 704   * @param {TanninOptions} options Tannin options.
 705   */
 706  function Tannin( data, options ) {
 707      var key;
 708  
 709      this.data = data;
 710      this.pluralForms = {};
 711  
 712      options = options || {};
 713      this.options = {};
 714      for ( key in DEFAULT_OPTIONS ) {
 715          this.options[ key ] = options[ key ] || DEFAULT_OPTIONS[ key ];
 716      }
 717  }
 718  
 719  /**
 720   * Returns the plural form index for the given domain and value.
 721   *
 722   * @param {string} domain Domain on which to calculate plural form.
 723   * @param {number} n      Value for which plural form is to be calculated.
 724   *
 725   * @return {number} Plural form index.
 726   */
 727  Tannin.prototype.getPluralForm = function( domain, n ) {
 728      var getPluralForm = this.pluralForms[ domain ],
 729          config, plural, pf;
 730  
 731      if ( ! getPluralForm ) {
 732          config = this.data[ domain ][ '' ];
 733  
 734          pf = (
 735              config[ 'Plural-Forms' ] ||
 736              config[ 'plural-forms' ] ||
 737              config.plural_forms
 738          );
 739  
 740          if ( typeof pf !== 'function' ) {
 741              plural = getPluralExpression(
 742                  config[ 'Plural-Forms' ] ||
 743                  config[ 'plural-forms' ] ||
 744                  config.plural_forms
 745              );
 746  
 747              pf = pluralForms( plural );
 748          }
 749  
 750          getPluralForm = this.pluralForms[ domain ] = pf;
 751      }
 752  
 753      return getPluralForm( n );
 754  };
 755  
 756  /**
 757   * Translate a string.
 758   *
 759   * @param {string} domain   Translation domain.
 760   * @param {string} context  Context distinguishing terms of the same name.
 761   * @param {string} singular Primary key for translation lookup.
 762   * @param {string} plural   Fallback value used for non-zero plural form index.
 763   * @param {number} n        Value to use in calculating plural form.
 764   *
 765   * @return {string} Translated string.
 766   */
 767  Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) {
 768      var index, key, entry;
 769  
 770      if ( n === undefined ) {
 771          // Default to singular.
 772          index = 0;
 773      } else {
 774          // Find index by evaluating plural form for value.
 775          index = this.getPluralForm( domain, n );
 776      }
 777  
 778      key = singular;
 779  
 780      // If provided, context is prepended to key with delimiter.
 781      if ( context ) {
 782          key = context + this.options.contextDelimiter + singular;
 783      }
 784  
 785      entry = this.data[ domain ][ key ];
 786  
 787      // Verify not only that entry exists, but that the intended index is within
 788      // range and non-empty.
 789      if ( entry && entry[ index ] ) {
 790          return entry[ index ];
 791      }
 792  
 793      if ( this.options.onMissingKey ) {
 794          this.options.onMissingKey( singular, domain );
 795      }
 796  
 797      // If entry not found, fall back to singular vs. plural with zero index
 798      // representing the singular value.
 799      return index === 0 ? singular : plural;
 800  };
 801  
 802  // EXTERNAL MODULE: ./node_modules/memize/index.js
 803  var memize = __webpack_require__(44);
 804  var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
 805  
 806  // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
 807  var sprintf = __webpack_require__(146);
 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  
 819  /**
 820   * External dependencies
 821   */
 822  
 823  
 824  
 825  /**
 826   * Default locale data to use for Tannin domain when not otherwise provided.
 827   * Assumes an English plural forms expression.
 828   *
 829   * @type {Object}
 830   */
 831  
 832  var DEFAULT_LOCALE_DATA = {
 833    '': {
 834      plural_forms: function plural_forms(n) {
 835        return n === 1 ? 0 : 1;
 836      }
 837    }
 838  };
 839  /**
 840   * Log to console, once per message; or more precisely, per referentially equal
 841   * argument set. Because Jed throws errors, we log these to the console instead
 842   * to avoid crashing the application.
 843   *
 844   * @param {...*} args Arguments to pass to `console.error`
 845   */
 846  
 847  var logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
 848  
 849  /**
 850   * The underlying instance of Tannin to which exported functions interface.
 851   *
 852   * @type {Tannin}
 853   */
 854  
 855  var i18n = new Tannin({});
 856  /**
 857   * Merges locale data into the Tannin instance by domain. Accepts data in a
 858   * Jed-formatted JSON object shape.
 859   *
 860   * @see http://messageformat.github.io/Jed/
 861   *
 862   * @param {?Object} data   Locale data configuration.
 863   * @param {?string} domain Domain for which configuration applies.
 864   */
 865  
 866  function setLocaleData(data) {
 867    var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
 868    i18n.data[domain] = Object(objectSpread["a" /* default */])({}, DEFAULT_LOCALE_DATA, i18n.data[domain], data); // Populate default domain configuration (supported locale date which omits
 869    // a plural forms expression).
 870  
 871    i18n.data[domain][''] = Object(objectSpread["a" /* default */])({}, DEFAULT_LOCALE_DATA[''], i18n.data[domain]['']);
 872  }
 873  /**
 874   * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
 875   * otherwise previously assigned.
 876   *
 877   * @param {?string} domain  Domain to retrieve the translated text.
 878   * @param {?string} context Context information for the translators.
 879   * @param {string}  single  Text to translate if non-plural. Used as fallback
 880   *                          return value on a caught error.
 881   * @param {?string} plural  The text to be used if the number is plural.
 882   * @param {?number} number  The number to compare against to use either the
 883   *                          singular or plural form.
 884   *
 885   * @return {string} The translated string.
 886   */
 887  
 888  function dcnpgettext() {
 889    var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
 890    var context = arguments.length > 1 ? arguments[1] : undefined;
 891    var single = arguments.length > 2 ? arguments[2] : undefined;
 892    var plural = arguments.length > 3 ? arguments[3] : undefined;
 893    var number = arguments.length > 4 ? arguments[4] : undefined;
 894  
 895    if (!i18n.data[domain]) {
 896      setLocaleData(undefined, domain);
 897    }
 898  
 899    return i18n.dcnpgettext(domain, context, single, plural, number);
 900  }
 901  /**
 902   * Retrieve the translation of text.
 903   *
 904   * @see https://developer.wordpress.org/reference/functions/__/
 905   *
 906   * @param {string}  text   Text to translate.
 907   * @param {?string} domain Domain to retrieve the translated text.
 908   *
 909   * @return {string} Translated text.
 910   */
 911  
 912  
 913  function __(text, domain) {
 914    return dcnpgettext(domain, undefined, text);
 915  }
 916  /**
 917   * Retrieve translated string with gettext context.
 918   *
 919   * @see https://developer.wordpress.org/reference/functions/_x/
 920   *
 921   * @param {string}  text    Text to translate.
 922   * @param {string}  context Context information for the translators.
 923   * @param {?string} domain  Domain to retrieve the translated text.
 924   *
 925   * @return {string} Translated context string without pipe.
 926   */
 927  
 928  function _x(text, context, domain) {
 929    return dcnpgettext(domain, context, text);
 930  }
 931  /**
 932   * Translates and retrieves the singular or plural form based on the supplied
 933   * number.
 934   *
 935   * @see https://developer.wordpress.org/reference/functions/_n/
 936   *
 937   * @param {string}  single The text to be used if the number is singular.
 938   * @param {string}  plural The text to be used if the number is plural.
 939   * @param {number}  number The number to compare against to use either the
 940   *                         singular or plural form.
 941   * @param {?string} domain Domain to retrieve the translated text.
 942   *
 943   * @return {string} The translated singular or plural form.
 944   */
 945  
 946  function _n(single, plural, number, domain) {
 947    return dcnpgettext(domain, undefined, single, plural, number);
 948  }
 949  /**
 950   * Translates and retrieves the singular or plural form based on the supplied
 951   * number, with gettext context.
 952   *
 953   * @see https://developer.wordpress.org/reference/functions/_nx/
 954   *
 955   * @param {string}  single  The text to be used if the number is singular.
 956   * @param {string}  plural  The text to be used if the number is plural.
 957   * @param {number}  number  The number to compare against to use either the
 958   *                          singular or plural form.
 959   * @param {string}  context Context information for the translators.
 960   * @param {?string} domain  Domain to retrieve the translated text.
 961   *
 962   * @return {string} The translated singular or plural form.
 963   */
 964  
 965  function _nx(single, plural, number, context, domain) {
 966    return dcnpgettext(domain, context, single, plural, number);
 967  }
 968  /**
 969   * Returns a formatted string. If an error occurs in applying the format, the
 970   * original format string is returned.
 971   *
 972   * @param {string}   format  The format of the string to generate.
 973   * @param {...string} args Arguments to apply to the format.
 974   *
 975   * @see http://www.diveintojavascript.com/projects/javascript-sprintf
 976   *
 977   * @return {string} The formatted string.
 978   */
 979  
 980  function build_module_sprintf(format) {
 981    try {
 982      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
 983        args[_key - 1] = arguments[_key];
 984      }
 985  
 986      return sprintf_default.a.sprintf.apply(sprintf_default.a, [format].concat(args));
 987    } catch (error) {
 988      logErrorOnce('sprintf error: \n\n' + error.toString());
 989      return format;
 990    }
 991  }
 992  
 993  
 994  /***/ }),
 995  
 996  /***/ 44:
 997  /***/ (function(module, exports, __webpack_require__) {
 998  
 999  module.exports = function memize( fn, options ) {
1000      var size = 0,
1001          maxSize, head, tail;
1002  
1003      if ( options && options.maxSize ) {
1004          maxSize = options.maxSize;
1005      }
1006  
1007  	function memoized( /* ...args */ ) {
1008          var node = head,
1009              len = arguments.length,
1010              args, i;
1011  
1012          searchCache: while ( node ) {
1013              // Perform a shallow equality test to confirm that whether the node
1014              // under test is a candidate for the arguments passed. Two arrays
1015              // are shallowly equal if their length matches and each entry is
1016              // strictly equal between the two sets. Avoid abstracting to a
1017              // function which could incur an arguments leaking deoptimization.
1018  
1019              // Check whether node arguments match arguments length
1020              if ( node.args.length !== arguments.length ) {
1021                  node = node.next;
1022                  continue;
1023              }
1024  
1025              // Check whether node arguments match arguments values
1026              for ( i = 0; i < len; i++ ) {
1027                  if ( node.args[ i ] !== arguments[ i ] ) {
1028                      node = node.next;
1029                      continue searchCache;
1030                  }
1031              }
1032  
1033              // At this point we can assume we've found a match
1034  
1035              // Surface matched node to head if not already
1036              if ( node !== head ) {
1037                  // As tail, shift to previous. Must only shift if not also
1038                  // head, since if both head and tail, there is no previous.
1039                  if ( node === tail ) {
1040                      tail = node.prev;
1041                  }
1042  
1043                  // Adjust siblings to point to each other. If node was tail,
1044                  // this also handles new tail's empty `next` assignment.
1045                  node.prev.next = node.next;
1046                  if ( node.next ) {
1047                      node.next.prev = node.prev;
1048                  }
1049  
1050                  node.next = head;
1051                  node.prev = null;
1052                  head.prev = node;
1053                  head = node;
1054              }
1055  
1056              // Return immediately
1057              return node.val;
1058          }
1059  
1060          // No cached value found. Continue to insertion phase:
1061  
1062          // Create a copy of arguments (avoid leaking deoptimization)
1063          args = new Array( len );
1064          for ( i = 0; i < len; i++ ) {
1065              args[ i ] = arguments[ i ];
1066          }
1067  
1068          node = {
1069              args: args,
1070  
1071              // Generate the result from original function
1072              val: fn.apply( null, args )
1073          };
1074  
1075          // Don't need to check whether node is already head, since it would
1076          // have been returned above already if it was
1077  
1078          // Shift existing head down list
1079          if ( head ) {
1080              head.prev = node;
1081              node.next = head;
1082          } else {
1083              // If no head, follows that there's no tail (at initial or reset)
1084              tail = node;
1085          }
1086  
1087          // Trim tail if we're reached max size and are pending cache insertion
1088          if ( size === maxSize ) {
1089              tail = tail.prev;
1090              tail.next = null;
1091          } else {
1092              size++;
1093          }
1094  
1095          head = node;
1096  
1097          return node.val;
1098      }
1099  
1100      memoized.clear = function() {
1101          head = null;
1102          tail = null;
1103          size = 0;
1104      };
1105  
1106      if ( false ) {}
1107  
1108      return memoized;
1109  };
1110  
1111  
1112  /***/ }),
1113  
1114  /***/ 7:
1115  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1116  
1117  "use strict";
1118  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
1119  /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
1120  
1121  function _objectSpread(target) {
1122    for (var i = 1; i < arguments.length; i++) {
1123      var source = arguments[i] != null ? arguments[i] : {};
1124      var ownKeys = Object.keys(source);
1125  
1126      if (typeof Object.getOwnPropertySymbols === 'function') {
1127        ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
1128          return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1129        }));
1130      }
1131  
1132      ownKeys.forEach(function (key) {
1133        Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
1134      });
1135    }
1136  
1137    return target;
1138  }
1139  
1140  /***/ })
1141  
1142  /******/ });


Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7