[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

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


Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref