[ 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 = "Vhyj");
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ "4Z/T":
  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  /***/ "4eJC":
 330  /***/ (function(module, exports, __webpack_require__) {
 331  
 332  /**
 333   * Memize options object.
 334   *
 335   * @typedef MemizeOptions
 336   *
 337   * @property {number} [maxSize] Maximum size of the cache.
 338   */
 339  
 340  /**
 341   * Internal cache entry.
 342   *
 343   * @typedef MemizeCacheNode
 344   *
 345   * @property {?MemizeCacheNode|undefined} [prev] Previous node.
 346   * @property {?MemizeCacheNode|undefined} [next] Next node.
 347   * @property {Array<*>}                   args   Function arguments for cache
 348   *                                               entry.
 349   * @property {*}                          val    Function result.
 350   */
 351  
 352  /**
 353   * Properties of the enhanced function for controlling cache.
 354   *
 355   * @typedef MemizeMemoizedFunction
 356   *
 357   * @property {()=>void} clear Clear the cache.
 358   */
 359  
 360  /**
 361   * Accepts a function to be memoized, and returns a new memoized function, with
 362   * optional options.
 363   *
 364   * @template {Function} F
 365   *
 366   * @param {F}             fn        Function to memoize.
 367   * @param {MemizeOptions} [options] Options object.
 368   *
 369   * @return {F & MemizeMemoizedFunction} Memoized function.
 370   */
 371  function memize( fn, options ) {
 372      var size = 0;
 373  
 374      /** @type {?MemizeCacheNode|undefined} */
 375      var head;
 376  
 377      /** @type {?MemizeCacheNode|undefined} */
 378      var tail;
 379  
 380      options = options || {};
 381  
 382  	function memoized( /* ...args */ ) {
 383          var node = head,
 384              len = arguments.length,
 385              args, i;
 386  
 387          searchCache: while ( node ) {
 388              // Perform a shallow equality test to confirm that whether the node
 389              // under test is a candidate for the arguments passed. Two arrays
 390              // are shallowly equal if their length matches and each entry is
 391              // strictly equal between the two sets. Avoid abstracting to a
 392              // function which could incur an arguments leaking deoptimization.
 393  
 394              // Check whether node arguments match arguments length
 395              if ( node.args.length !== arguments.length ) {
 396                  node = node.next;
 397                  continue;
 398              }
 399  
 400              // Check whether node arguments match arguments values
 401              for ( i = 0; i < len; i++ ) {
 402                  if ( node.args[ i ] !== arguments[ i ] ) {
 403                      node = node.next;
 404                      continue searchCache;
 405                  }
 406              }
 407  
 408              // At this point we can assume we've found a match
 409  
 410              // Surface matched node to head if not already
 411              if ( node !== head ) {
 412                  // As tail, shift to previous. Must only shift if not also
 413                  // head, since if both head and tail, there is no previous.
 414                  if ( node === tail ) {
 415                      tail = node.prev;
 416                  }
 417  
 418                  // Adjust siblings to point to each other. If node was tail,
 419                  // this also handles new tail's empty `next` assignment.
 420                  /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
 421                  if ( node.next ) {
 422                      node.next.prev = node.prev;
 423                  }
 424  
 425                  node.next = head;
 426                  node.prev = null;
 427                  /** @type {MemizeCacheNode} */ ( head ).prev = node;
 428                  head = node;
 429              }
 430  
 431              // Return immediately
 432              return node.val;
 433          }
 434  
 435          // No cached value found. Continue to insertion phase:
 436  
 437          // Create a copy of arguments (avoid leaking deoptimization)
 438          args = new Array( len );
 439          for ( i = 0; i < len; i++ ) {
 440              args[ i ] = arguments[ i ];
 441          }
 442  
 443          node = {
 444              args: args,
 445  
 446              // Generate the result from original function
 447              val: fn.apply( null, args ),
 448          };
 449  
 450          // Don't need to check whether node is already head, since it would
 451          // have been returned above already if it was
 452  
 453          // Shift existing head down list
 454          if ( head ) {
 455              head.prev = node;
 456              node.next = head;
 457          } else {
 458              // If no head, follows that there's no tail (at initial or reset)
 459              tail = node;
 460          }
 461  
 462          // Trim tail if we're reached max size and are pending cache insertion
 463          if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
 464              tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
 465              /** @type {MemizeCacheNode} */ ( tail ).next = null;
 466          } else {
 467              size++;
 468          }
 469  
 470          head = node;
 471  
 472          return node.val;
 473      }
 474  
 475      memoized.clear = function() {
 476          head = null;
 477          tail = null;
 478          size = 0;
 479      };
 480  
 481      if ( false ) {}
 482  
 483      // Ignore reason: There's not a clear solution to create an intersection of
 484      // the function with additional properties, where the goal is to retain the
 485      // function signature of the incoming argument and add control properties
 486      // on the return value.
 487  
 488      // @ts-ignore
 489      return memoized;
 490  }
 491  
 492  module.exports = memize;
 493  
 494  
 495  /***/ }),
 496  
 497  /***/ "Vhyj":
 498  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 499  
 500  "use strict";
 501  // ESM COMPAT FLAG
 502  __webpack_require__.r(__webpack_exports__);
 503  
 504  // EXPORTS
 505  __webpack_require__.d(__webpack_exports__, "sprintf", function() { return /* reexport */ sprintf_sprintf; });
 506  __webpack_require__.d(__webpack_exports__, "createI18n", function() { return /* reexport */ createI18n; });
 507  __webpack_require__.d(__webpack_exports__, "defaultI18n", function() { return /* reexport */ default_i18n; });
 508  __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return /* reexport */ default_i18n_setLocaleData; });
 509  __webpack_require__.d(__webpack_exports__, "resetLocaleData", function() { return /* reexport */ default_i18n_resetLocaleData; });
 510  __webpack_require__.d(__webpack_exports__, "getLocaleData", function() { return /* reexport */ default_i18n_getLocaleData; });
 511  __webpack_require__.d(__webpack_exports__, "subscribe", function() { return /* reexport */ default_i18n_subscribe; });
 512  __webpack_require__.d(__webpack_exports__, "__", function() { return /* reexport */ default_i18n_; });
 513  __webpack_require__.d(__webpack_exports__, "_x", function() { return /* reexport */ default_i18n_x; });
 514  __webpack_require__.d(__webpack_exports__, "_n", function() { return /* reexport */ default_i18n_n; });
 515  __webpack_require__.d(__webpack_exports__, "_nx", function() { return /* reexport */ default_i18n_nx; });
 516  __webpack_require__.d(__webpack_exports__, "isRTL", function() { return /* reexport */ default_i18n_isRTL; });
 517  __webpack_require__.d(__webpack_exports__, "hasTranslation", function() { return /* reexport */ default_i18n_hasTranslation; });
 518  
 519  // EXTERNAL MODULE: ./node_modules/memize/index.js
 520  var memize = __webpack_require__("4eJC");
 521  var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
 522  
 523  // EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
 524  var sprintf = __webpack_require__("4Z/T");
 525  var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf);
 526  
 527  // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/sprintf.js
 528  /**
 529   * External dependencies
 530   */
 531  
 532  
 533  /**
 534   * Log to console, once per message; or more precisely, per referentially equal
 535   * argument set. Because Jed throws errors, we log these to the console instead
 536   * to avoid crashing the application.
 537   *
 538   * @param {...*} args Arguments to pass to `console.error`
 539   */
 540  
 541  const logErrorOnce = memize_default()(console.error); // eslint-disable-line no-console
 542  
 543  /**
 544   * Returns a formatted string. If an error occurs in applying the format, the
 545   * original format string is returned.
 546   *
 547   * @param {string} format The format of the string to generate.
 548   * @param {...*}   args   Arguments to apply to the format.
 549   *
 550   * @see https://www.npmjs.com/package/sprintf-js
 551   *
 552   * @return {string} The formatted string.
 553   */
 554  
 555  function sprintf_sprintf(format) {
 556    try {
 557      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
 558        args[_key - 1] = arguments[_key];
 559      }
 560  
 561      return sprintf_default.a.sprintf(format, ...args);
 562    } catch (error) {
 563      if (error instanceof Error) {
 564        logErrorOnce('sprintf error: \n\n' + error.toString());
 565      }
 566  
 567      return format;
 568    }
 569  }
 570  
 571  // CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js
 572  var PRECEDENCE, OPENERS, TERMINATORS, PATTERN;
 573  
 574  /**
 575   * Operator precedence mapping.
 576   *
 577   * @type {Object}
 578   */
 579  PRECEDENCE = {
 580      '(': 9,
 581      '!': 8,
 582      '*': 7,
 583      '/': 7,
 584      '%': 7,
 585      '+': 6,
 586      '-': 6,
 587      '<': 5,
 588      '<=': 5,
 589      '>': 5,
 590      '>=': 5,
 591      '==': 4,
 592      '!=': 4,
 593      '&&': 3,
 594      '||': 2,
 595      '?': 1,
 596      '?:': 1,
 597  };
 598  
 599  /**
 600   * Characters which signal pair opening, to be terminated by terminators.
 601   *
 602   * @type {string[]}
 603   */
 604  OPENERS = [ '(', '?' ];
 605  
 606  /**
 607   * Characters which signal pair termination, the value an array with the
 608   * opener as its first member. The second member is an optional operator
 609   * replacement to push to the stack.
 610   *
 611   * @type {string[]}
 612   */
 613  TERMINATORS = {
 614      ')': [ '(' ],
 615      ':': [ '?', '?:' ],
 616  };
 617  
 618  /**
 619   * Pattern matching operators and openers.
 620   *
 621   * @type {RegExp}
 622   */
 623  PATTERN = /<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;
 624  
 625  /**
 626   * Given a C expression, returns the equivalent postfix (Reverse Polish)
 627   * notation terms as an array.
 628   *
 629   * If a postfix string is desired, simply `.join( ' ' )` the result.
 630   *
 631   * @example
 632   *
 633   * ```js
 634   * import postfix from '@tannin/postfix';
 635   *
 636   * postfix( 'n > 1' );
 637   * // ⇒ [ 'n', '1', '>' ]
 638   * ```
 639   *
 640   * @param {string} expression C expression.
 641   *
 642   * @return {string[]} Postfix terms.
 643   */
 644  function postfix( expression ) {
 645      var terms = [],
 646          stack = [],
 647          match, operator, term, element;
 648  
 649      while ( ( match = expression.match( PATTERN ) ) ) {
 650          operator = match[ 0 ];
 651  
 652          // Term is the string preceding the operator match. It may contain
 653          // whitespace, and may be empty (if operator is at beginning).
 654          term = expression.substr( 0, match.index ).trim();
 655          if ( term ) {
 656              terms.push( term );
 657          }
 658  
 659          while ( ( element = stack.pop() ) ) {
 660              if ( TERMINATORS[ operator ] ) {
 661                  if ( TERMINATORS[ operator ][ 0 ] === element ) {
 662                      // Substitution works here under assumption that because
 663                      // the assigned operator will no longer be a terminator, it
 664                      // will be pushed to the stack during the condition below.
 665                      operator = TERMINATORS[ operator ][ 1 ] || operator;
 666                      break;
 667                  }
 668              } else if ( OPENERS.indexOf( element ) >= 0 || PRECEDENCE[ element ] < PRECEDENCE[ operator ] ) {
 669                  // Push to stack if either an opener or when pop reveals an
 670                  // element of lower precedence.
 671                  stack.push( element );
 672                  break;
 673              }
 674  
 675              // For each popped from stack, push to terms.
 676              terms.push( element );
 677          }
 678  
 679          if ( ! TERMINATORS[ operator ] ) {
 680              stack.push( operator );
 681          }
 682  
 683          // Slice matched fragment from expression to continue match.
 684          expression = expression.substr( match.index + operator.length );
 685      }
 686  
 687      // Push remainder of operand, if exists, to terms.
 688      expression = expression.trim();
 689      if ( expression ) {
 690          terms.push( expression );
 691      }
 692  
 693      // Pop remaining items from stack into terms.
 694      return terms.concat( stack.reverse() );
 695  }
 696  
 697  // CONCATENATED MODULE: ./node_modules/@tannin/evaluate/index.js
 698  /**
 699   * Operator callback functions.
 700   *
 701   * @type {Object}
 702   */
 703  var OPERATORS = {
 704      '!': function( a ) {
 705          return ! a;
 706      },
 707      '*': function( a, b ) {
 708          return a * b;
 709      },
 710      '/': function( a, b ) {
 711          return a / b;
 712      },
 713      '%': function( a, b ) {
 714          return a % b;
 715      },
 716      '+': function( a, b ) {
 717          return a + b;
 718      },
 719      '-': function( a, b ) {
 720          return a - b;
 721      },
 722      '<': function( a, b ) {
 723          return a < b;
 724      },
 725      '<=': function( a, b ) {
 726          return a <= b;
 727      },
 728      '>': function( a, b ) {
 729          return a > b;
 730      },
 731      '>=': function( a, b ) {
 732          return a >= b;
 733      },
 734      '==': function( a, b ) {
 735          return a === b;
 736      },
 737      '!=': function( a, b ) {
 738          return a !== b;
 739      },
 740      '&&': function( a, b ) {
 741          return a && b;
 742      },
 743      '||': function( a, b ) {
 744          return a || b;
 745      },
 746      '?:': function( a, b, c ) {
 747          if ( a ) {
 748              throw b;
 749          }
 750  
 751          return c;
 752      },
 753  };
 754  
 755  /**
 756   * Given an array of postfix terms and operand variables, returns the result of
 757   * the postfix evaluation.
 758   *
 759   * @example
 760   *
 761   * ```js
 762   * import evaluate from '@tannin/evaluate';
 763   *
 764   * // 3 + 4 * 5 / 6 ⇒ '3 4 5 * 6 / +'
 765   * const terms = [ '3', '4', '5', '*', '6', '/', '+' ];
 766   *
 767   * evaluate( terms, {} );
 768   * // ⇒ 6.333333333333334
 769   * ```
 770   *
 771   * @param {string[]} postfix   Postfix terms.
 772   * @param {Object}   variables Operand variables.
 773   *
 774   * @return {*} Result of evaluation.
 775   */
 776  function evaluate_evaluate( postfix, variables ) {
 777      var stack = [],
 778          i, j, args, getOperatorResult, term, value;
 779  
 780      for ( i = 0; i < postfix.length; i++ ) {
 781          term = postfix[ i ];
 782  
 783          getOperatorResult = OPERATORS[ term ];
 784          if ( getOperatorResult ) {
 785              // Pop from stack by number of function arguments.
 786              j = getOperatorResult.length;
 787              args = Array( j );
 788              while ( j-- ) {
 789                  args[ j ] = stack.pop();
 790              }
 791  
 792              try {
 793                  value = getOperatorResult.apply( null, args );
 794              } catch ( earlyReturn ) {
 795                  return earlyReturn;
 796              }
 797          } else if ( variables.hasOwnProperty( term ) ) {
 798              value = variables[ term ];
 799          } else {
 800              value = +term;
 801          }
 802  
 803          stack.push( value );
 804      }
 805  
 806      return stack[ 0 ];
 807  }
 808  
 809  // CONCATENATED MODULE: ./node_modules/@tannin/compile/index.js
 810  
 811  
 812  
 813  /**
 814   * Given a C expression, returns a function which can be called to evaluate its
 815   * result.
 816   *
 817   * @example
 818   *
 819   * ```js
 820   * import compile from '@tannin/compile';
 821   *
 822   * const evaluate = compile( 'n > 1' );
 823   *
 824   * evaluate( { n: 2 } );
 825   * // ⇒ true
 826   * ```
 827   *
 828   * @param {string} expression C expression.
 829   *
 830   * @return {(variables?:{[variable:string]:*})=>*} Compiled evaluator.
 831   */
 832  function compile( expression ) {
 833      var terms = postfix( expression );
 834  
 835      return function( variables ) {
 836          return evaluate_evaluate( terms, variables );
 837      };
 838  }
 839  
 840  // CONCATENATED MODULE: ./node_modules/@tannin/plural-forms/index.js
 841  
 842  
 843  /**
 844   * Given a C expression, returns a function which, when called with a value,
 845   * evaluates the result with the value assumed to be the "n" variable of the
 846   * expression. The result will be coerced to its numeric equivalent.
 847   *
 848   * @param {string} expression C expression.
 849   *
 850   * @return {Function} Evaluator function.
 851   */
 852  function pluralForms( expression ) {
 853      var evaluate = compile( expression );
 854  
 855      return function( n ) {
 856          return +evaluate( { n: n } );
 857      };
 858  }
 859  
 860  // CONCATENATED MODULE: ./node_modules/tannin/index.js
 861  
 862  
 863  /**
 864   * Tannin constructor options.
 865   *
 866   * @typedef {Object} TanninOptions
 867   *
 868   * @property {string}   [contextDelimiter] Joiner in string lookup with context.
 869   * @property {Function} [onMissingKey]     Callback to invoke when key missing.
 870   */
 871  
 872  /**
 873   * Domain metadata.
 874   *
 875   * @typedef {Object} TanninDomainMetadata
 876   *
 877   * @property {string}            [domain]       Domain name.
 878   * @property {string}            [lang]         Language code.
 879   * @property {(string|Function)} [plural_forms] Plural forms expression or
 880   *                                              function evaluator.
 881   */
 882  
 883  /**
 884   * Domain translation pair respectively representing the singular and plural
 885   * translation.
 886   *
 887   * @typedef {[string,string]} TanninTranslation
 888   */
 889  
 890  /**
 891   * Locale data domain. The key is used as reference for lookup, the value an
 892   * array of two string entries respectively representing the singular and plural
 893   * translation.
 894   *
 895   * @typedef {{[key:string]:TanninDomainMetadata|TanninTranslation,'':TanninDomainMetadata|TanninTranslation}} TanninLocaleDomain
 896   */
 897  
 898  /**
 899   * Jed-formatted locale data.
 900   *
 901   * @see http://messageformat.github.io/Jed/
 902   *
 903   * @typedef {{[domain:string]:TanninLocaleDomain}} TanninLocaleData
 904   */
 905  
 906  /**
 907   * Default Tannin constructor options.
 908   *
 909   * @type {TanninOptions}
 910   */
 911  var DEFAULT_OPTIONS = {
 912      contextDelimiter: '\u0004',
 913      onMissingKey: null,
 914  };
 915  
 916  /**
 917   * Given a specific locale data's config `plural_forms` value, returns the
 918   * expression.
 919   *
 920   * @example
 921   *
 922   * ```
 923   * getPluralExpression( 'nplurals=2; plural=(n != 1);' ) === '(n != 1)'
 924   * ```
 925   *
 926   * @param {string} pf Locale data plural forms.
 927   *
 928   * @return {string} Plural forms expression.
 929   */
 930  function getPluralExpression( pf ) {
 931      var parts, i, part;
 932  
 933      parts = pf.split( ';' );
 934  
 935      for ( i = 0; i < parts.length; i++ ) {
 936          part = parts[ i ].trim();
 937          if ( part.indexOf( 'plural=' ) === 0 ) {
 938              return part.substr( 7 );
 939          }
 940      }
 941  }
 942  
 943  /**
 944   * Tannin constructor.
 945   *
 946   * @class
 947   *
 948   * @param {TanninLocaleData} data      Jed-formatted locale data.
 949   * @param {TanninOptions}    [options] Tannin options.
 950   */
 951  function Tannin( data, options ) {
 952      var key;
 953  
 954      /**
 955       * Jed-formatted locale data.
 956       *
 957       * @name Tannin#data
 958       * @type {TanninLocaleData}
 959       */
 960      this.data = data;
 961  
 962      /**
 963       * Plural forms function cache, keyed by plural forms string.
 964       *
 965       * @name Tannin#pluralForms
 966       * @type {Object<string,Function>}
 967       */
 968      this.pluralForms = {};
 969  
 970      /**
 971       * Effective options for instance, including defaults.
 972       *
 973       * @name Tannin#options
 974       * @type {TanninOptions}
 975       */
 976      this.options = {};
 977  
 978      for ( key in DEFAULT_OPTIONS ) {
 979          this.options[ key ] = options !== undefined && key in options
 980              ? options[ key ]
 981              : DEFAULT_OPTIONS[ key ];
 982      }
 983  }
 984  
 985  /**
 986   * Returns the plural form index for the given domain and value.
 987   *
 988   * @param {string} domain Domain on which to calculate plural form.
 989   * @param {number} n      Value for which plural form is to be calculated.
 990   *
 991   * @return {number} Plural form index.
 992   */
 993  Tannin.prototype.getPluralForm = function( domain, n ) {
 994      var getPluralForm = this.pluralForms[ domain ],
 995          config, plural, pf;
 996  
 997      if ( ! getPluralForm ) {
 998          config = this.data[ domain ][ '' ];
 999  
1000          pf = (
1001              config[ 'Plural-Forms' ] ||
1002              config[ 'plural-forms' ] ||
1003              // Ignore reason: As known, there's no way to document the empty
1004              // string property on a key to guarantee this as metadata.
1005              // @ts-ignore
1006              config.plural_forms
1007          );
1008  
1009          if ( typeof pf !== 'function' ) {
1010              plural = getPluralExpression(
1011                  config[ 'Plural-Forms' ] ||
1012                  config[ 'plural-forms' ] ||
1013                  // Ignore reason: As known, there's no way to document the empty
1014                  // string property on a key to guarantee this as metadata.
1015                  // @ts-ignore
1016                  config.plural_forms
1017              );
1018  
1019              pf = pluralForms( plural );
1020          }
1021  
1022          getPluralForm = this.pluralForms[ domain ] = pf;
1023      }
1024  
1025      return getPluralForm( n );
1026  };
1027  
1028  /**
1029   * Translate a string.
1030   *
1031   * @param {string}      domain   Translation domain.
1032   * @param {string|void} context  Context distinguishing terms of the same name.
1033   * @param {string}      singular Primary key for translation lookup.
1034   * @param {string=}     plural   Fallback value used for non-zero plural
1035   *                               form index.
1036   * @param {number=}     n        Value to use in calculating plural form.
1037   *
1038   * @return {string} Translated string.
1039   */
1040  Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) {
1041      var index, key, entry;
1042  
1043      if ( n === undefined ) {
1044          // Default to singular.
1045          index = 0;
1046      } else {
1047          // Find index by evaluating plural form for value.
1048          index = this.getPluralForm( domain, n );
1049      }
1050  
1051      key = singular;
1052  
1053      // If provided, context is prepended to key with delimiter.
1054      if ( context ) {
1055          key = context + this.options.contextDelimiter + singular;
1056      }
1057  
1058      entry = this.data[ domain ][ key ];
1059  
1060      // Verify not only that entry exists, but that the intended index is within
1061      // range and non-empty.
1062      if ( entry && entry[ index ] ) {
1063          return entry[ index ];
1064      }
1065  
1066      if ( this.options.onMissingKey ) {
1067          this.options.onMissingKey( singular, domain );
1068      }
1069  
1070      // If entry not found, fall back to singular vs. plural with zero index
1071      // representing the singular value.
1072      return index === 0 ? singular : plural;
1073  };
1074  
1075  // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/create-i18n.js
1076  /**
1077   * External dependencies
1078   */
1079  
1080  /**
1081   * @typedef {Record<string,any>} LocaleData
1082   */
1083  
1084  /**
1085   * Default locale data to use for Tannin domain when not otherwise provided.
1086   * Assumes an English plural forms expression.
1087   *
1088   * @type {LocaleData}
1089   */
1090  
1091  const DEFAULT_LOCALE_DATA = {
1092    '': {
1093      /** @param {number} n */
1094      plural_forms(n) {
1095        return n === 1 ? 0 : 1;
1096      }
1097  
1098    }
1099  };
1100  /*
1101   * Regular expression that matches i18n hooks like `i18n.gettext`, `i18n.ngettext`,
1102   * `i18n.gettext_domain` or `i18n.ngettext_with_context` or `i18n.has_translation`.
1103   */
1104  
1105  const I18N_HOOK_REGEXP = /^i18n\.(n?gettext|has_translation)(_|$)/;
1106  /**
1107   * @typedef {(domain?: string) => LocaleData} GetLocaleData
1108   *
1109   * Returns locale data by domain in a
1110   * Jed-formatted JSON object shape.
1111   *
1112   * @see http://messageformat.github.io/Jed/
1113   */
1114  
1115  /**
1116   * @typedef {(data?: LocaleData, domain?: string) => void} SetLocaleData
1117   *
1118   * Merges locale data into the Tannin instance by domain. Accepts data in a
1119   * Jed-formatted JSON object shape.
1120   *
1121   * @see http://messageformat.github.io/Jed/
1122   */
1123  
1124  /**
1125   * @typedef {(data?: LocaleData, domain?: string) => void} ResetLocaleData
1126   *
1127   * Resets all current Tannin instance locale data and sets the specified
1128   * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
1129   *
1130   * @see http://messageformat.github.io/Jed/
1131   */
1132  
1133  /** @typedef {() => void} SubscribeCallback */
1134  
1135  /** @typedef {() => void} UnsubscribeCallback */
1136  
1137  /**
1138   * @typedef {(callback: SubscribeCallback) => UnsubscribeCallback} Subscribe
1139   *
1140   * Subscribes to changes of locale data
1141   */
1142  
1143  /**
1144   * @typedef {(domain?: string) => string} GetFilterDomain
1145   * Retrieve the domain to use when calling domain-specific filters.
1146   */
1147  
1148  /**
1149   * @typedef {(text: string, domain?: string) => string} __
1150   *
1151   * Retrieve the translation of text.
1152   *
1153   * @see https://developer.wordpress.org/reference/functions/__/
1154   */
1155  
1156  /**
1157   * @typedef {(text: string, context: string, domain?: string) => string} _x
1158   *
1159   * Retrieve translated string with gettext context.
1160   *
1161   * @see https://developer.wordpress.org/reference/functions/_x/
1162   */
1163  
1164  /**
1165   * @typedef {(single: string, plural: string, number: number, domain?: string) => string} _n
1166   *
1167   * Translates and retrieves the singular or plural form based on the supplied
1168   * number.
1169   *
1170   * @see https://developer.wordpress.org/reference/functions/_n/
1171   */
1172  
1173  /**
1174   * @typedef {(single: string, plural: string, number: number, context: string, domain?: string) => string} _nx
1175   *
1176   * Translates and retrieves the singular or plural form based on the supplied
1177   * number, with gettext context.
1178   *
1179   * @see https://developer.wordpress.org/reference/functions/_nx/
1180   */
1181  
1182  /**
1183   * @typedef {() => boolean} IsRtl
1184   *
1185   * Check if current locale is RTL.
1186   *
1187   * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
1188   * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
1189   * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
1190   * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
1191   */
1192  
1193  /**
1194   * @typedef {(single: string, context?: string, domain?: string) => boolean} HasTranslation
1195   *
1196   * Check if there is a translation for a given string in singular form.
1197   */
1198  
1199  /** @typedef {import('@wordpress/hooks').Hooks} Hooks */
1200  
1201  /**
1202   * An i18n instance
1203   *
1204   * @typedef I18n
1205   * @property {GetLocaleData}   getLocaleData   Returns locale data by domain in a Jed-formatted JSON object shape.
1206   * @property {SetLocaleData}   setLocaleData   Merges locale data into the Tannin instance by domain. Accepts data in a
1207   *                                             Jed-formatted JSON object shape.
1208   * @property {ResetLocaleData} resetLocaleData Resets all current Tannin instance locale data and sets the specified
1209   *                                             locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
1210   * @property {Subscribe}       subscribe       Subscribes to changes of Tannin locale data.
1211   * @property {__}              __              Retrieve the translation of text.
1212   * @property {_x}              _x              Retrieve translated string with gettext context.
1213   * @property {_n}              _n              Translates and retrieves the singular or plural form based on the supplied
1214   *                                             number.
1215   * @property {_nx}             _nx             Translates and retrieves the singular or plural form based on the supplied
1216   *                                             number, with gettext context.
1217   * @property {IsRtl}           isRTL           Check if current locale is RTL.
1218   * @property {HasTranslation}  hasTranslation  Check if there is a translation for a given string.
1219   */
1220  
1221  /**
1222   * Create an i18n instance
1223   *
1224   * @param {LocaleData} [initialData]   Locale data configuration.
1225   * @param {string}     [initialDomain] Domain for which configuration applies.
1226   * @param {Hooks}      [hooks]         Hooks implementation.
1227   *
1228   * @return {I18n} I18n instance.
1229   */
1230  
1231  const createI18n = (initialData, initialDomain, hooks) => {
1232    /**
1233     * The underlying instance of Tannin to which exported functions interface.
1234     *
1235     * @type {Tannin}
1236     */
1237    const tannin = new Tannin({});
1238    const listeners = new Set();
1239  
1240    const notifyListeners = () => {
1241      listeners.forEach(listener => listener());
1242    };
1243    /**
1244     * Subscribe to changes of locale data.
1245     *
1246     * @param {SubscribeCallback} callback Subscription callback.
1247     * @return {UnsubscribeCallback} Unsubscribe callback.
1248     */
1249  
1250  
1251    const subscribe = callback => {
1252      listeners.add(callback);
1253      return () => listeners.delete(callback);
1254    };
1255    /** @type {GetLocaleData} */
1256  
1257  
1258    const getLocaleData = function () {
1259      let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
1260      return tannin.data[domain];
1261    };
1262    /**
1263     * @param {LocaleData} [data]
1264     * @param {string}     [domain]
1265     */
1266  
1267  
1268    const doSetLocaleData = function (data) {
1269      let domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
1270      tannin.data[domain] = { ...DEFAULT_LOCALE_DATA,
1271        ...tannin.data[domain],
1272        ...data
1273      }; // Populate default domain configuration (supported locale date which omits
1274      // a plural forms expression).
1275  
1276      tannin.data[domain][''] = { ...DEFAULT_LOCALE_DATA[''],
1277        ...tannin.data[domain]['']
1278      };
1279    };
1280    /** @type {SetLocaleData} */
1281  
1282  
1283    const setLocaleData = (data, domain) => {
1284      doSetLocaleData(data, domain);
1285      notifyListeners();
1286    };
1287    /** @type {ResetLocaleData} */
1288  
1289  
1290    const resetLocaleData = (data, domain) => {
1291      // Reset all current Tannin locale data.
1292      tannin.data = {}; // Reset cached plural forms functions cache.
1293  
1294      tannin.pluralForms = {};
1295      setLocaleData(data, domain);
1296    };
1297    /**
1298     * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
1299     * otherwise previously assigned.
1300     *
1301     * @param {string|undefined} domain   Domain to retrieve the translated text.
1302     * @param {string|undefined} context  Context information for the translators.
1303     * @param {string}           single   Text to translate if non-plural. Used as
1304     *                                    fallback return value on a caught error.
1305     * @param {string}           [plural] The text to be used if the number is
1306     *                                    plural.
1307     * @param {number}           [number] The number to compare against to use
1308     *                                    either the singular or plural form.
1309     *
1310     * @return {string} The translated string.
1311     */
1312  
1313  
1314    const dcnpgettext = function () {
1315      let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
1316      let context = arguments.length > 1 ? arguments[1] : undefined;
1317      let single = arguments.length > 2 ? arguments[2] : undefined;
1318      let plural = arguments.length > 3 ? arguments[3] : undefined;
1319      let number = arguments.length > 4 ? arguments[4] : undefined;
1320  
1321      if (!tannin.data[domain]) {
1322        // use `doSetLocaleData` to set silently, without notifying listeners
1323        doSetLocaleData(undefined, domain);
1324      }
1325  
1326      return tannin.dcnpgettext(domain, context, single, plural, number);
1327    };
1328    /** @type {GetFilterDomain} */
1329  
1330  
1331    const getFilterDomain = function () {
1332      let domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
1333      return domain;
1334    };
1335    /** @type {__} */
1336  
1337  
1338    const __ = (text, domain) => {
1339      let translation = dcnpgettext(domain, undefined, text);
1340  
1341      if (!hooks) {
1342        return translation;
1343      }
1344      /**
1345       * Filters text with its translation.
1346       *
1347       * @param {string} translation Translated text.
1348       * @param {string} text        Text to translate.
1349       * @param {string} domain      Text domain. Unique identifier for retrieving translated strings.
1350       */
1351  
1352  
1353      translation =
1354      /** @type {string} */
1355  
1356      /** @type {*} */
1357      hooks.applyFilters('i18n.gettext', translation, text, domain);
1358      return (
1359        /** @type {string} */
1360  
1361        /** @type {*} */
1362        hooks.applyFilters('i18n.gettext_' + getFilterDomain(domain), translation, text, domain)
1363      );
1364    };
1365    /** @type {_x} */
1366  
1367  
1368    const _x = (text, context, domain) => {
1369      let translation = dcnpgettext(domain, context, text);
1370  
1371      if (!hooks) {
1372        return translation;
1373      }
1374      /**
1375       * Filters text with its translation based on context information.
1376       *
1377       * @param {string} translation Translated text.
1378       * @param {string} text        Text to translate.
1379       * @param {string} context     Context information for the translators.
1380       * @param {string} domain      Text domain. Unique identifier for retrieving translated strings.
1381       */
1382  
1383  
1384      translation =
1385      /** @type {string} */
1386  
1387      /** @type {*} */
1388      hooks.applyFilters('i18n.gettext_with_context', translation, text, context, domain);
1389      return (
1390        /** @type {string} */
1391  
1392        /** @type {*} */
1393        hooks.applyFilters('i18n.gettext_with_context_' + getFilterDomain(domain), translation, text, context, domain)
1394      );
1395    };
1396    /** @type {_n} */
1397  
1398  
1399    const _n = (single, plural, number, domain) => {
1400      let translation = dcnpgettext(domain, undefined, single, plural, number);
1401  
1402      if (!hooks) {
1403        return translation;
1404      }
1405      /**
1406       * Filters the singular or plural form of a string.
1407       *
1408       * @param {string} translation Translated text.
1409       * @param {string} single      The text to be used if the number is singular.
1410       * @param {string} plural      The text to be used if the number is plural.
1411       * @param {string} number      The number to compare against to use either the singular or plural form.
1412       * @param {string} domain      Text domain. Unique identifier for retrieving translated strings.
1413       */
1414  
1415  
1416      translation =
1417      /** @type {string} */
1418  
1419      /** @type {*} */
1420      hooks.applyFilters('i18n.ngettext', translation, single, plural, number, domain);
1421      return (
1422        /** @type {string} */
1423  
1424        /** @type {*} */
1425        hooks.applyFilters('i18n.ngettext_' + getFilterDomain(domain), translation, single, plural, number, domain)
1426      );
1427    };
1428    /** @type {_nx} */
1429  
1430  
1431    const _nx = (single, plural, number, context, domain) => {
1432      let translation = dcnpgettext(domain, context, single, plural, number);
1433  
1434      if (!hooks) {
1435        return translation;
1436      }
1437      /**
1438       * Filters the singular or plural form of a string with gettext context.
1439       *
1440       * @param {string} translation Translated text.
1441       * @param {string} single      The text to be used if the number is singular.
1442       * @param {string} plural      The text to be used if the number is plural.
1443       * @param {string} number      The number to compare against to use either the singular or plural form.
1444       * @param {string} context     Context information for the translators.
1445       * @param {string} domain      Text domain. Unique identifier for retrieving translated strings.
1446       */
1447  
1448  
1449      translation =
1450      /** @type {string} */
1451  
1452      /** @type {*} */
1453      hooks.applyFilters('i18n.ngettext_with_context', translation, single, plural, number, context, domain);
1454      return (
1455        /** @type {string} */
1456  
1457        /** @type {*} */
1458        hooks.applyFilters('i18n.ngettext_with_context_' + getFilterDomain(domain), translation, single, plural, number, context, domain)
1459      );
1460    };
1461    /** @type {IsRtl} */
1462  
1463  
1464    const isRTL = () => {
1465      return 'rtl' === _x('ltr', 'text direction');
1466    };
1467    /** @type {HasTranslation} */
1468  
1469  
1470    const hasTranslation = (single, context, domain) => {
1471      var _tannin$data, _tannin$data2;
1472  
1473      const key = context ? context + '\u0004' + single : single;
1474      let result = !!((_tannin$data = tannin.data) !== null && _tannin$data !== void 0 && (_tannin$data2 = _tannin$data[domain !== null && domain !== void 0 ? domain : 'default']) !== null && _tannin$data2 !== void 0 && _tannin$data2[key]);
1475  
1476      if (hooks) {
1477        /**
1478         * Filters the presence of a translation in the locale data.
1479         *
1480         * @param {boolean} hasTranslation Whether the translation is present or not..
1481         * @param {string}  single         The singular form of the translated text (used as key in locale data)
1482         * @param {string}  context        Context information for the translators.
1483         * @param {string}  domain         Text domain. Unique identifier for retrieving translated strings.
1484         */
1485        result =
1486        /** @type { boolean } */
1487  
1488        /** @type {*} */
1489        hooks.applyFilters('i18n.has_translation', result, single, context, domain);
1490        result =
1491        /** @type { boolean } */
1492  
1493        /** @type {*} */
1494        hooks.applyFilters('i18n.has_translation_' + getFilterDomain(domain), result, single, context, domain);
1495      }
1496  
1497      return result;
1498    };
1499  
1500    if (initialData) {
1501      setLocaleData(initialData, initialDomain);
1502    }
1503  
1504    if (hooks) {
1505      /**
1506       * @param {string} hookName
1507       */
1508      const onHookAddedOrRemoved = hookName => {
1509        if (I18N_HOOK_REGEXP.test(hookName)) {
1510          notifyListeners();
1511        }
1512      };
1513  
1514      hooks.addAction('hookAdded', 'core/i18n', onHookAddedOrRemoved);
1515      hooks.addAction('hookRemoved', 'core/i18n', onHookAddedOrRemoved);
1516    }
1517  
1518    return {
1519      getLocaleData,
1520      setLocaleData,
1521      resetLocaleData,
1522      subscribe,
1523      __,
1524      _x,
1525      _n,
1526      _nx,
1527      isRTL,
1528      hasTranslation
1529    };
1530  };
1531  
1532  // EXTERNAL MODULE: external ["wp","hooks"]
1533  var external_wp_hooks_ = __webpack_require__("g56x");
1534  
1535  // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/default-i18n.js
1536  /**
1537   * Internal dependencies
1538   */
1539  
1540  /**
1541   * WordPress dependencies
1542   */
1543  
1544  
1545  const i18n = createI18n(undefined, undefined, external_wp_hooks_["defaultHooks"]);
1546  /**
1547   * Default, singleton instance of `I18n`.
1548   */
1549  
1550  /* harmony default export */ var default_i18n = (i18n);
1551  /*
1552   * Comments in this file are duplicated from ./i18n due to
1553   * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722
1554   */
1555  
1556  /**
1557   * @typedef {import('./create-i18n').LocaleData} LocaleData
1558   * @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback
1559   * @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback
1560   */
1561  
1562  /**
1563   * Returns locale data by domain in a Jed-formatted JSON object shape.
1564   *
1565   * @see http://messageformat.github.io/Jed/
1566   *
1567   * @param {string} [domain] Domain for which to get the data.
1568   * @return {LocaleData} Locale data.
1569   */
1570  
1571  const default_i18n_getLocaleData = i18n.getLocaleData.bind(i18n);
1572  /**
1573   * Merges locale data into the Tannin instance by domain. Accepts data in a
1574   * Jed-formatted JSON object shape.
1575   *
1576   * @see http://messageformat.github.io/Jed/
1577   *
1578   * @param {LocaleData} [data]   Locale data configuration.
1579   * @param {string}     [domain] Domain for which configuration applies.
1580   */
1581  
1582  const default_i18n_setLocaleData = i18n.setLocaleData.bind(i18n);
1583  /**
1584   * Resets all current Tannin instance locale data and sets the specified
1585   * locale data for the domain. Accepts data in a Jed-formatted JSON object shape.
1586   *
1587   * @see http://messageformat.github.io/Jed/
1588   *
1589   * @param {LocaleData} [data]   Locale data configuration.
1590   * @param {string}     [domain] Domain for which configuration applies.
1591   */
1592  
1593  const default_i18n_resetLocaleData = i18n.resetLocaleData.bind(i18n);
1594  /**
1595   * Subscribes to changes of locale data
1596   *
1597   * @param {SubscribeCallback} callback Subscription callback
1598   * @return {UnsubscribeCallback} Unsubscribe callback
1599   */
1600  
1601  const default_i18n_subscribe = i18n.subscribe.bind(i18n);
1602  /**
1603   * Retrieve the translation of text.
1604   *
1605   * @see https://developer.wordpress.org/reference/functions/__/
1606   *
1607   * @param {string} text     Text to translate.
1608   * @param {string} [domain] Domain to retrieve the translated text.
1609   *
1610   * @return {string} Translated text.
1611   */
1612  
1613  const default_i18n_ = i18n.__.bind(i18n);
1614  /**
1615   * Retrieve translated string with gettext context.
1616   *
1617   * @see https://developer.wordpress.org/reference/functions/_x/
1618   *
1619   * @param {string} text     Text to translate.
1620   * @param {string} context  Context information for the translators.
1621   * @param {string} [domain] Domain to retrieve the translated text.
1622   *
1623   * @return {string} Translated context string without pipe.
1624   */
1625  
1626  const default_i18n_x = i18n._x.bind(i18n);
1627  /**
1628   * Translates and retrieves the singular or plural form based on the supplied
1629   * number.
1630   *
1631   * @see https://developer.wordpress.org/reference/functions/_n/
1632   *
1633   * @param {string} single   The text to be used if the number is singular.
1634   * @param {string} plural   The text to be used if the number is plural.
1635   * @param {number} number   The number to compare against to use either the
1636   *                          singular or plural form.
1637   * @param {string} [domain] Domain to retrieve the translated text.
1638   *
1639   * @return {string} The translated singular or plural form.
1640   */
1641  
1642  const default_i18n_n = i18n._n.bind(i18n);
1643  /**
1644   * Translates and retrieves the singular or plural form based on the supplied
1645   * number, with gettext context.
1646   *
1647   * @see https://developer.wordpress.org/reference/functions/_nx/
1648   *
1649   * @param {string} single   The text to be used if the number is singular.
1650   * @param {string} plural   The text to be used if the number is plural.
1651   * @param {number} number   The number to compare against to use either the
1652   *                          singular or plural form.
1653   * @param {string} context  Context information for the translators.
1654   * @param {string} [domain] Domain to retrieve the translated text.
1655   *
1656   * @return {string} The translated singular or plural form.
1657   */
1658  
1659  const default_i18n_nx = i18n._nx.bind(i18n);
1660  /**
1661   * Check if current locale is RTL.
1662   *
1663   * **RTL (Right To Left)** is a locale property indicating that text is written from right to left.
1664   * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common
1665   * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages,
1666   * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`).
1667   *
1668   * @return {boolean} Whether locale is RTL.
1669   */
1670  
1671  const default_i18n_isRTL = i18n.isRTL.bind(i18n);
1672  /**
1673   * Check if there is a translation for a given string (in singular form).
1674   *
1675   * @param {string} single    Singular form of the string to look up.
1676   * @param {string} [context] Context information for the translators.
1677   * @param {string} [domain]  Domain to retrieve the translated text.
1678   * @return {boolean} Whether the translation exists or not.
1679   */
1680  
1681  const default_i18n_hasTranslation = i18n.hasTranslation.bind(i18n);
1682  
1683  // CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js
1684  
1685  
1686  
1687  
1688  
1689  /***/ }),
1690  
1691  /***/ "g56x":
1692  /***/ (function(module, exports) {
1693  
1694  (function() { module.exports = window["wp"]["hooks"]; }());
1695  
1696  /***/ })
1697  
1698  /******/ });


Generated: Wed Jan 19 01:00:04 2022 Cross-referenced by PHPXref 0.7.1