[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

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


Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1