[ Index ]

PHP Cross Reference of WordPress

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


Generated: Tue Feb 18 01:00:03 2020 Cross-referenced by PHPXref 0.7.1