vendor: 10,807 bytes, lines 1-273
1/******/ (function() { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ 124: 5/***/ (function(module, exports, __webpack_require__) { 6 7var __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/******/ !function() { 272/******/ // getDefaultExport function for compatibility with non-harmony modules 273/******/ __webpack_require__.n = function(module) {
vendor: 1,686 bytes, lines 274-314
274/******/ var getter = module && module.__esModule ? 275/******/ function() { return module['default']; } : 276/******/ function() { return module; }; 277/******/ __webpack_require__.d(getter, { a: getter }); 278/******/ return getter; 279/******/ }; 280/******/ }(); 281/******/ 282/******/ /* webpack/runtime/define property getters */ 283/******/ !function() { 284/******/ // define getter functions for harmony exports 285/******/ __webpack_require__.d = function(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/******/ !function() { 296/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 297/******/ }(); 298/******/ 299/******/ /* webpack/runtime/make namespace object */ 300/******/ !function() { 301/******/ // define __esModule on exports 302/******/ __webpack_require__.r = function(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/************************************************************************/ 311var __webpack_exports__ = {}; 312// This entry need to be wrapped in an IIFE because it need to be in strict mode. 313!function() { 314"use strict";
315// ESM COMPAT FLAG 316__webpack_require__.r(__webpack_exports__); 317 318// EXPORTS 319__webpack_require__.d(__webpack_exports__, { 320 "__": function() { return /* reexport */ __; }, 321 "_n": function() { return /* reexport */ _n; }, 322 "_nx": function() { return /* reexport */ _nx; }, 323 "_x": function() { return /* reexport */ _x; }, 324 "createI18n": function() { return /* reexport */ createI18n; }, 325 "defaultI18n": function() { return /* reexport */ default_i18n; }, 326 "getLocaleData": function() { return /* reexport */ getLocaleData; }, 327 "hasTranslation": function() { return /* reexport */ hasTranslation; }, 328 "isRTL": function() { return /* reexport */ isRTL; }, 329 "resetLocaleData": function() { return /* reexport */ resetLocaleData; }, 330 "setLocaleData": function() { return /* reexport */ setLocaleData; }, 331 "sprintf": function() { return /* reexport */ sprintf_sprintf; }, 332 "subscribe": function() { return /* reexport */ subscribe; } 333}); 334 335;// CONCATENATED MODULE: ./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 */ 375function 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 498var sprintf = __webpack_require__(124); 499var sprintf_default = /*#__PURE__*/__webpack_require__.n(sprintf); 500;// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/sprintf.js 501/** 502 * External dependencies 503 */ 504 505 506/** 507 * Log to console, once per message; or more precisely, per referentially equal 508 * argument set. Because Jed throws errors, we log these to the console instead 509 * to avoid crashing the application. 510 * 511 * @param {...*} args Arguments to pass to `console.error` 512 */ 513 514const 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 528function sprintf_sprintf(format, ...args) { 529 try { 530 return sprintf_default().sprintf(format, ...args); 531 } catch (error) { 532 if (error instanceof Error) { 533 logErrorOnce('sprintf error: \n\n' + error.toString()); 534 } 535 536 return format; 537 } 538} 539 540;// CONCATENATED MODULE: ./node_modules/@tannin/postfix/index.js 541var PRECEDENCE, OPENERS, TERMINATORS, PATTERN; 542 543/** 544 * Operator precedence mapping. 545 * 546 * @type {Object} 547 */ 548PRECEDENCE = { 549 '(': 9, 550 '!': 8, 551 '*': 7, 552 '/': 7, 553 '%': 7,
554 '+': 6, 555 '-': 6, 556 '<': 5, 557 '<=': 5, 558 '>': 5, 559 '>=': 5, 560 '==': 4, 561 '!=': 4, 562 '&&': 3, 563 '||': 2, 564 '?': 1, 565 '?:': 1, 566}; 567 568/** 569 * Characters which signal pair opening, to be terminated by terminators. 570 * 571 * @type {string[]} 572 */ 573OPENERS = [ '(', '?' ]; 574 575/** 576 * Characters which signal pair termination, the value an array with the 577 * opener as its first member. The second member is an optional operator 578 * replacement to push to the stack. 579 * 580 * @type {string[]} 581 */ 582TERMINATORS = { 583 ')': [ '(' ], 584 ':': [ '?', '?:' ], 585}; 586 587/** 588 * Pattern matching operators and openers. 589 * 590 * @type {RegExp} 591 */ 592PATTERN = /<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/; 593 594/** 595 * Given a C expression, returns the equivalent postfix (Reverse Polish) 596 * notation terms as an array. 597 * 598 * If a postfix string is desired, simply `.join( ' ' )` the result. 599 * 600 * @example 601 * 602 * ```js 603 * import postfix from '@tannin/postfix'; 604 * 605 * postfix( 'n > 1' ); 606 * // ⇒ [ 'n', '1', '>' ] 607 * ``` 608 * 609 * @param {string} expression C expression. 610 * 611 * @return {string[]} Postfix terms. 612 */ 613function postfix( expression ) { 614 var terms = [], 615 stack = [], 616 match, operator, term, element; 617 618 while ( ( match = expression.match( PATTERN ) ) ) { 619 operator = match[ 0 ]; 620 621 // Term is the string preceding the operator match. It may contain 622 // whitespace, and may be empty (if operator is at beginning). 623 term = expression.substr( 0, match.index ).trim(); 624 if ( term ) { 625 terms.push( term ); 626 } 627 628 while ( ( element = stack.pop() ) ) { 629 if ( TERMINATORS[ operator ] ) { 630 if ( TERMINATORS[ operator ][ 0 ] === element ) { 631 // Substitution works here under assumption that because 632 // the assigned operator will no longer be a terminator, it 633 // will be pushed to the stack during the condition below. 634 operator = TERMINATORS[ operator ][ 1 ] || operator; 635 break; 636 } 637 } else if ( OPENERS.indexOf( element ) >= 0 || PRECEDENCE[ element ] < PRECEDENCE[ operator ] ) { 638 // Push to stack if either an opener or when pop reveals an 639 // element of lower precedence. 640 stack.push( element ); 641 break; 642 } 643 644 // For each popped from stack, push to terms. 645 terms.push( element ); 646 } 647 648 if ( ! TERMINATORS[ operator ] ) { 649 stack.push( operator ); 650 } 651 652 // Slice matched fragment from expression to continue match. 653 expression = expression.substr( match.index + operator.length ); 654 } 655 656 // Push remainder of operand, if exists, to terms. 657 expression = expression.trim(); 658 if ( expression ) { 659 terms.push( expression ); 660 } 661 662 // Pop remaining items from stack into terms. 663 return terms.concat( stack.reverse() ); 664} 665 666;// CONCATENATED MODULE: ./node_modules/@tannin/evaluate/index.js 667/** 668 * Operator callback functions. 669 * 670 * @type {Object} 671 */ 672var OPERATORS = { 673 '!': function( a ) { 674 return ! a; 675 }, 676 '*': function( a, b ) { 677 return a * b; 678 }, 679 '/': function( a, b ) { 680 return a / b; 681 }, 682 '%': function( a, b ) { 683 return a % b; 684 }, 685 '+': function( a, b ) { 686 return a + b; 687 }, 688 '-': function( a, b ) { 689 return a - b; 690 }, 691 '<': function( a, b ) { 692 return a < b; 693 }, 694 '<=': function( a, b ) { 695 return a <= b; 696 }, 697 '>': function( a, b ) { 698 return a > b; 699 }, 700 '>=': function( a, b ) { 701 return a >= b; 702 }, 703 '==': function( a, b ) { 704 return a === b; 705 }, 706 '!=': function( a, b ) { 707 return a !== b; 708 }, 709 '&&': function( a, b ) { 710 return a && b; 711 }, 712 '||': function( a, b ) { 713 return a || b; 714 }, 715 '?:': function( a, b, c ) { 716 if ( a ) { 717 throw b; 718 } 719 720 return c; 721 }, 722}; 723 724/** 725 * Given an array of postfix terms and operand variables, returns the result of 726 * the postfix evaluation. 727 * 728 * @example 729 * 730 * ```js 731 * import evaluate from '@tannin/evaluate'; 732 * 733 * // 3 + 4 * 5 / 6 ⇒ '3 4 5 * 6 / +' 734 * const terms = [ '3', '4', '5', '*', '6', '/', '+' ]; 735 * 736 * evaluate( terms, {} ); 737 * // ⇒ 6.333333333333334 738 * ``` 739 * 740 * @param {string[]} postfix Postfix terms. 741 * @param {Object} variables Operand variables. 742 * 743 * @return {*} Result of evaluation. 744 */ 745function evaluate( postfix, variables ) { 746 var stack = [], 747 i, j, args, getOperatorResult, term, value; 748 749 for ( i = 0; i < postfix.length; i++ ) { 750 term = postfix[ i ]; 751 752 getOperatorResult = OPERATORS[ term ]; 753 if ( getOperatorResult ) { 754 // Pop from stack by number of function arguments. 755 j = getOperatorResult.length; 756 args = Array( j ); 757 while ( j-- ) { 758 args[ j ] = stack.pop(); 759 } 760 761 try { 762 value = getOperatorResult.apply( null, args ); 763 } catch ( earlyReturn ) { 764 return earlyReturn; 765 } 766 } else if ( variables.hasOwnProperty( term ) ) { 767 value = variables[ term ]; 768 } else { 769 value = +term; 770 } 771 772 stack.push( value ); 773 } 774 775 return stack[ 0 ]; 776} 777 778;// CONCATENATED MODULE: ./node_modules/@tannin/compile/index.js 779 780 781 782/** 783 * Given a C expression, returns a function which can be called to evaluate its 784 * result. 785 * 786 * @example 787 * 788 * ```js 789 * import compile from '@tannin/compile'; 790 * 791 * const evaluate = compile( 'n > 1' ); 792 * 793 * evaluate( { n: 2 } ); 794 * // ⇒ true 795 * ``` 796 * 797 * @param {string} expression C expression. 798 * 799 * @return {(variables?:{[variable:string]:*})=>*} Compiled evaluator. 800 */ 801function compile( expression ) { 802 var terms = postfix( expression ); 803 804 return function( variables ) { 805 return evaluate( terms, variables ); 806 }; 807} 808 809;// CONCATENATED MODULE: ./node_modules/@tannin/plural-forms/index.js 810 811 812/** 813 * Given a C expression, returns a function which, when called with a value, 814 * evaluates the result with the value assumed to be the "n" variable of the 815 * expression. The result will be coerced to its numeric equivalent. 816 * 817 * @param {string} expression C expression. 818 * 819 * @return {Function} Evaluator function. 820 */ 821function pluralForms( expression ) { 822 var evaluate = compile( expression ); 823 824 return function( n ) { 825 return +evaluate( { n: n } ); 826 }; 827} 828 829;// CONCATENATED MODULE: ./node_modules/tannin/index.js 830 831 832/** 833 * Tannin constructor options. 834 * 835 * @typedef {Object} TanninOptions 836 * 837 * @property {string} [contextDelimiter] Joiner in string lookup with context. 838 * @property {Function} [onMissingKey] Callback to invoke when key missing. 839 */ 840 841/** 842 * Domain metadata. 843 * 844 * @typedef {Object} TanninDomainMetadata 845 * 846 * @property {string} [domain] Domain name. 847 * @property {string} [lang] Language code. 848 * @property {(string|Function)} [plural_forms] Plural forms expression or 849 * function evaluator. 850 */ 851 852/** 853 * Domain translation pair respectively representing the singular and plural 854 * translation. 855 * 856 * @typedef {[string,string]} TanninTranslation 857 */ 858 859/** 860 * Locale data domain. The key is used as reference for lookup, the value an 861 * array of two string entries respectively representing the singular and plural 862 * translation. 863 * 864 * @typedef {{[key:string]:TanninDomainMetadata|TanninTranslation,'':TanninDomainMetadata|TanninTranslation}} TanninLocaleDomain 865 */ 866 867/** 868 * Jed-formatted locale data. 869 * 870 * @see http://messageformat.github.io/Jed/ 871 * 872 * @typedef {{[domain:string]:TanninLocaleDomain}} TanninLocaleData 873 */ 874 875/** 876 * Default Tannin constructor options. 877 * 878 * @type {TanninOptions} 879 */ 880var DEFAULT_OPTIONS = { 881 contextDelimiter: '\u0004', 882 onMissingKey: null, 883}; 884 885/** 886 * Given a specific locale data's config `plural_forms` value, returns the 887 * expression. 888 * 889 * @example 890 * 891 * ``` 892 * getPluralExpression( 'nplurals=2; plural=(n != 1);' ) === '(n != 1)' 893 * ``` 894 * 895 * @param {string} pf Locale data plural forms. 896 * 897 * @return {string} Plural forms expression. 898 */ 899function getPluralExpression( pf ) { 900 var parts, i, part; 901 902 parts = pf.split( ';' ); 903 904 for ( i = 0; i < parts.length; i++ ) { 905 part = parts[ i ].trim(); 906 if ( part.indexOf( 'plural=' ) === 0 ) { 907 return part.substr( 7 ); 908 } 909 } 910} 911 912/** 913 * Tannin constructor. 914 * 915 * @class 916 * 917 * @param {TanninLocaleData} data Jed-formatted locale data. 918 * @param {TanninOptions} [options] Tannin options. 919 */ 920function Tannin( data, options ) { 921 var key; 922 923 /** 924 * Jed-formatted locale data. 925 * 926 * @name Tannin#data 927 * @type {TanninLocaleData} 928 */ 929 this.data = data; 930 931 /** 932 * Plural forms function cache, keyed by plural forms string. 933 * 934 * @name Tannin#pluralForms 935 * @type {Object<string,Function>} 936 */ 937 this.pluralForms = {}; 938 939 /** 940 * Effective options for instance, including defaults. 941 * 942 * @name Tannin#options 943 * @type {TanninOptions} 944 */ 945 this.options = {}; 946 947 for ( key in DEFAULT_OPTIONS ) { 948 this.options[ key ] = options !== undefined && key in options 949 ? options[ key ] 950 : DEFAULT_OPTIONS[ key ]; 951 } 952} 953 954/** 955 * Returns the plural form index for the given domain and value. 956 * 957 * @param {string} domain Domain on which to calculate plural form. 958 * @param {number} n Value for which plural form is to be calculated. 959 * 960 * @return {number} Plural form index. 961 */ 962Tannin.prototype.getPluralForm = function( domain, n ) { 963 var getPluralForm = this.pluralForms[ domain ], 964 config, plural, pf; 965 966 if ( ! getPluralForm ) { 967 config = this.data[ domain ][ '' ]; 968 969 pf = ( 970 config[ 'Plural-Forms' ] || 971 config[ 'plural-forms' ] || 972 // Ignore reason: As known, there's no way to document the empty 973 // string property on a key to guarantee this as metadata. 974 // @ts-ignore 975 config.plural_forms 976 ); 977 978 if ( typeof pf !== 'function' ) { 979 plural = getPluralExpression( 980 config[ 'Plural-Forms' ] || 981 config[ 'plural-forms' ] || 982 // Ignore reason: As known, there's no way to document the empty 983 // string property on a key to guarantee this as metadata. 984 // @ts-ignore 985 config.plural_forms 986 ); 987 988 pf = pluralForms( plural ); 989 } 990 991 getPluralForm = this.pluralForms[ domain ] = pf; 992 } 993 994 return getPluralForm( n ); 995}; 996 997/** 998 * Translate a string. 999 * 1000 * @param {string} domain Translation domain. 1001 * @param {string|void} context Context distinguishing terms of the same name. 1002 * @param {string} singular Primary key for translation lookup. 1003 * @param {string=} plural Fallback value used for non-zero plural 1004 * form index. 1005 * @param {number=} n Value to use in calculating plural form. 1006 * 1007 * @return {string} Translated string. 1008 */ 1009Tannin.prototype.dcnpgettext = function( domain, context, singular, plural, n ) { 1010 var index, key, entry; 1011 1012 if ( n === undefined ) { 1013 // Default to singular. 1014 index = 0; 1015 } else { 1016 // Find index by evaluating plural form for value. 1017 index = this.getPluralForm( domain, n ); 1018 } 1019 1020 key = singular; 1021 1022 // If provided, context is prepended to key with delimiter. 1023 if ( context ) { 1024 key = context + this.options.contextDelimiter + singular; 1025 } 1026 1027 entry = this.data[ domain ][ key ]; 1028
1029 // Verify not only that entry exists, but that the intended index is within 1030 // range and non-empty. 1031 if ( entry && entry[ index ] ) { 1032 return entry[ index ]; 1033 } 1034 1035 if ( this.options.onMissingKey ) { 1036 this.options.onMissingKey( singular, domain ); 1037 } 1038 1039 // If entry not found, fall back to singular vs. plural with zero index 1040 // representing the singular value. 1041 return index === 0 ? singular : plural; 1042}; 1043 1044;// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/create-i18n.js 1045/** 1046 * External dependencies 1047 */ 1048 1049/** 1050 * @typedef {Record<string,any>} LocaleData 1051 */ 1052 1053/** 1054 * Default locale data to use for Tannin domain when not otherwise provided. 1055 * Assumes an English plural forms expression. 1056 * 1057 * @type {LocaleData} 1058 */ 1059 1060const DEFAULT_LOCALE_DATA = { 1061 '': { 1062 /** @param {number} n */ 1063 plural_forms(n) { 1064 return n === 1 ? 0 : 1; 1065 } 1066 1067 } 1068}; 1069/* 1070 * Regular expression that matches i18n hooks like `i18n.gettext`, `i18n.ngettext`, 1071 * `i18n.gettext_domain` or `i18n.ngettext_with_context` or `i18n.has_translation`. 1072 */ 1073 1074const I18N_HOOK_REGEXP = /^i18n\.(n?gettext|has_translation)(_|$)/; 1075/** 1076 * @typedef {(domain?: string) => LocaleData} GetLocaleData 1077 * 1078 * Returns locale data by domain in a 1079 * Jed-formatted JSON object shape. 1080 * 1081 * @see http://messageformat.github.io/Jed/ 1082 */ 1083 1084/** 1085 * @typedef {(data?: LocaleData, domain?: string) => void} SetLocaleData 1086 * 1087 * Merges locale data into the Tannin instance by domain. Note that this 1088 * function will overwrite the domain configuration. Accepts data in a 1089 * Jed-formatted JSON object shape. 1090 * 1091 * @see http://messageformat.github.io/Jed/ 1092 */ 1093 1094/** 1095 * @typedef {(data?: LocaleData, domain?: string) => void} AddLocaleData 1096 * 1097 * Merges locale data into the Tannin instance by domain. Note that this 1098 * function will also merge the domain configuration. Accepts data in a 1099 * Jed-formatted JSON object shape. 1100 * 1101 * @see http://messageformat.github.io/Jed/ 1102 */ 1103 1104/** 1105 * @typedef {(data?: LocaleData, domain?: string) => void} ResetLocaleData 1106 * 1107 * Resets all current Tannin instance locale data and sets the specified 1108 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. 1109 * 1110 * @see http://messageformat.github.io/Jed/ 1111 */ 1112 1113/** @typedef {() => void} SubscribeCallback */ 1114 1115/** @typedef {() => void} UnsubscribeCallback */ 1116 1117/** 1118 * @typedef {(callback: SubscribeCallback) => UnsubscribeCallback} Subscribe 1119 * 1120 * Subscribes to changes of locale data 1121 */ 1122 1123/** 1124 * @typedef {(domain?: string) => string} GetFilterDomain 1125 * Retrieve the domain to use when calling domain-specific filters. 1126 */ 1127 1128/** 1129 * @typedef {(text: string, domain?: string) => string} __ 1130 * 1131 * Retrieve the translation of text. 1132 * 1133 * @see https://developer.wordpress.org/reference/functions/__/ 1134 */ 1135 1136/** 1137 * @typedef {(text: string, context: string, domain?: string) => string} _x 1138 * 1139 * Retrieve translated string with gettext context. 1140 * 1141 * @see https://developer.wordpress.org/reference/functions/_x/ 1142 */ 1143 1144/** 1145 * @typedef {(single: string, plural: string, number: number, domain?: string) => string} _n 1146 * 1147 * Translates and retrieves the singular or plural form based on the supplied 1148 * number. 1149 * 1150 * @see https://developer.wordpress.org/reference/functions/_n/ 1151 */ 1152 1153/** 1154 * @typedef {(single: string, plural: string, number: number, context: string, domain?: string) => string} _nx 1155 * 1156 * Translates and retrieves the singular or plural form based on the supplied 1157 * number, with gettext context. 1158 * 1159 * @see https://developer.wordpress.org/reference/functions/_nx/ 1160 */ 1161 1162/** 1163 * @typedef {() => boolean} IsRtl 1164 * 1165 * Check if current locale is RTL. 1166 * 1167 * **RTL (Right To Left)** is a locale property indicating that text is written from right to left. 1168 * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common 1169 * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages, 1170 * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`). 1171 */ 1172 1173/** 1174 * @typedef {(single: string, context?: string, domain?: string) => boolean} HasTranslation 1175 * 1176 * Check if there is a translation for a given string in singular form. 1177 */ 1178 1179/** @typedef {import('@wordpress/hooks').Hooks} Hooks */ 1180
1181/** 1182 * An i18n instance 1183 * 1184 * @typedef I18n 1185 * @property {GetLocaleData} getLocaleData Returns locale data by domain in a Jed-formatted JSON object shape. 1186 * @property {SetLocaleData} setLocaleData Merges locale data into the Tannin instance by domain. Note that this 1187 * function will overwrite the domain configuration. Accepts data in a 1188 * Jed-formatted JSON object shape. 1189 * @property {AddLocaleData} addLocaleData Merges locale data into the Tannin instance by domain. Note that this 1190 * function will also merge the domain configuration. Accepts data in a 1191 * Jed-formatted JSON object shape. 1192 * @property {ResetLocaleData} resetLocaleData Resets all current Tannin instance locale data and sets the specified 1193 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. 1194 * @property {Subscribe} subscribe Subscribes to changes of Tannin locale data. 1195 * @property {__} __ Retrieve the translation of text. 1196 * @property {_x} _x Retrieve translated string with gettext context. 1197 * @property {_n} _n Translates and retrieves the singular or plural form based on the supplied 1198 * number. 1199 * @property {_nx} _nx Translates and retrieves the singular or plural form based on the supplied 1200 * number, with gettext context. 1201 * @property {IsRtl} isRTL Check if current locale is RTL. 1202 * @property {HasTranslation} hasTranslation Check if there is a translation for a given string. 1203 */ 1204 1205/** 1206 * Create an i18n instance 1207 * 1208 * @param {LocaleData} [initialData] Locale data configuration. 1209 * @param {string} [initialDomain] Domain for which configuration applies. 1210 * @param {Hooks} [hooks] Hooks implementation. 1211 * 1212 * @return {I18n} I18n instance. 1213 */ 1214 1215const createI18n = (initialData, initialDomain, hooks) => { 1216 /** 1217 * The underlying instance of Tannin to which exported functions interface. 1218 * 1219 * @type {Tannin} 1220 */ 1221 const tannin = new Tannin({}); 1222 const listeners = new Set(); 1223 1224 const notifyListeners = () => { 1225 listeners.forEach(listener => listener()); 1226 }; 1227 /** 1228 * Subscribe to changes of locale data. 1229 * 1230 * @param {SubscribeCallback} callback Subscription callback. 1231 * @return {UnsubscribeCallback} Unsubscribe callback. 1232 */ 1233 1234 1235 const subscribe = callback => { 1236 listeners.add(callback); 1237 return () => listeners.delete(callback); 1238 }; 1239 /** @type {GetLocaleData} */ 1240 1241 1242 const getLocaleData = (domain = 'default') => tannin.data[domain]; 1243 /** 1244 * @param {LocaleData} [data] 1245 * @param {string} [domain] 1246 */ 1247 1248 1249 const doSetLocaleData = (data, domain = 'default') => { 1250 tannin.data[domain] = { ...tannin.data[domain], 1251 ...data 1252 }; // Populate default domain configuration (supported locale date which omits 1253 // a plural forms expression). 1254 1255 tannin.data[domain][''] = { ...DEFAULT_LOCALE_DATA[''], 1256 ...tannin.data[domain]?.[''] 1257 }; // Clean up cached plural forms functions cache as it might be updated. 1258 1259 delete tannin.pluralForms[domain]; 1260 }; 1261 /** @type {SetLocaleData} */ 1262 1263 1264 const setLocaleData = (data, domain) => { 1265 doSetLocaleData(data, domain); 1266 notifyListeners(); 1267 }; 1268 /** @type {AddLocaleData} */ 1269 1270 1271 const addLocaleData = (data, domain = 'default') => { 1272 tannin.data[domain] = { ...tannin.data[domain], 1273 ...data, 1274 // Populate default domain configuration (supported locale date which omits 1275 // a plural forms expression). 1276 '': { ...DEFAULT_LOCALE_DATA[''], 1277 ...tannin.data[domain]?.[''], 1278 ...data?.[''] 1279 } 1280 }; // Clean up cached plural forms functions cache as it might be updated. 1281 1282 delete tannin.pluralForms[domain]; 1283 notifyListeners(); 1284 }; 1285 /** @type {ResetLocaleData} */ 1286 1287 1288 const resetLocaleData = (data, domain) => { 1289 // Reset all current Tannin locale data. 1290 tannin.data = {}; // Reset cached plural forms functions cache. 1291 1292 tannin.pluralForms = {};
1293 setLocaleData(data, domain); 1294 }; 1295 /** 1296 * Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not 1297 * otherwise previously assigned. 1298 * 1299 * @param {string|undefined} domain Domain to retrieve the translated text. 1300 * @param {string|undefined} context Context information for the translators. 1301 * @param {string} single Text to translate if non-plural. Used as 1302 * fallback return value on a caught error. 1303 * @param {string} [plural] The text to be used if the number is 1304 * plural. 1305 * @param {number} [number] The number to compare against to use 1306 * either the singular or plural form. 1307 * 1308 * @return {string} The translated string. 1309 */ 1310 1311 1312 const dcnpgettext = (domain = 'default', context, single, plural, number) => { 1313 if (!tannin.data[domain]) { 1314 // Use `doSetLocaleData` to set silently, without notifying listeners. 1315 doSetLocaleData(undefined, domain); 1316 } 1317 1318 return tannin.dcnpgettext(domain, context, single, plural, number); 1319 }; 1320 /** @type {GetFilterDomain} */ 1321 1322 1323 const getFilterDomain = (domain = 'default') => domain; 1324 /** @type {__} */ 1325 1326 1327 const __ = (text, domain) => { 1328 let translation = dcnpgettext(domain, undefined, text); 1329 1330 if (!hooks) { 1331 return translation; 1332 } 1333 /** 1334 * Filters text with its translation. 1335 * 1336 * @param {string} translation Translated text. 1337 * @param {string} text Text to translate. 1338 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1339 */ 1340 1341 1342 translation = 1343 /** @type {string} */ 1344 1345 /** @type {*} */ 1346 hooks.applyFilters('i18n.gettext', translation, text, domain); 1347 return ( 1348 /** @type {string} */ 1349 1350 /** @type {*} */ 1351 hooks.applyFilters('i18n.gettext_' + getFilterDomain(domain), translation, text, domain) 1352 ); 1353 }; 1354 /** @type {_x} */ 1355 1356 1357 const _x = (text, context, domain) => { 1358 let translation = dcnpgettext(domain, context, text); 1359 1360 if (!hooks) { 1361 return translation; 1362 } 1363 /** 1364 * Filters text with its translation based on context information. 1365 * 1366 * @param {string} translation Translated text. 1367 * @param {string} text Text to translate. 1368 * @param {string} context Context information for the translators. 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_with_context', translation, text, context, domain); 1378 return ( 1379 /** @type {string} */ 1380 1381 /** @type {*} */ 1382 hooks.applyFilters('i18n.gettext_with_context_' + getFilterDomain(domain), translation, text, context, domain) 1383 ); 1384 }; 1385 /** @type {_n} */ 1386 1387 1388 const _n = (single, plural, number, domain) => { 1389 let translation = dcnpgettext(domain, undefined, single, plural, number); 1390 1391 if (!hooks) { 1392 return translation; 1393 } 1394 /** 1395 * Filters the singular or plural form of a string. 1396 * 1397 * @param {string} translation Translated text. 1398 * @param {string} single The text to be used if the number is singular. 1399 * @param {string} plural The text to be used if the number is plural. 1400 * @param {string} number The number to compare against to use either the singular or plural form. 1401 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1402 */ 1403 1404 1405 translation = 1406 /** @type {string} */ 1407 1408 /** @type {*} */ 1409 hooks.applyFilters('i18n.ngettext', translation, single, plural, number, domain); 1410 return ( 1411 /** @type {string} */ 1412 1413 /** @type {*} */ 1414 hooks.applyFilters('i18n.ngettext_' + getFilterDomain(domain), translation, single, plural, number, domain) 1415 ); 1416 }; 1417 /** @type {_nx} */ 1418 1419 1420 const _nx = (single, plural, number, context, domain) => { 1421 let translation = dcnpgettext(domain, context, single, plural, number); 1422 1423 if (!hooks) { 1424 return translation; 1425 } 1426 /** 1427 * Filters the singular or plural form of a string with gettext context. 1428 * 1429 * @param {string} translation Translated text. 1430 * @param {string} single The text to be used if the number is singular. 1431 * @param {string} plural The text to be used if the number is plural. 1432 * @param {string} number The number to compare against to use either the singular or plural form. 1433 * @param {string} context Context information for the translators. 1434 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1435 */ 1436 1437 1438 translation = 1439 /** @type {string} */ 1440 1441 /** @type {*} */ 1442 hooks.applyFilters('i18n.ngettext_with_context', translation, single, plural, number,
1442context, domain); 1443 return ( 1444 /** @type {string} */ 1445 1446 /** @type {*} */ 1447 hooks.applyFilters('i18n.ngettext_with_context_' + getFilterDomain(domain), translation, single, plural, number, context, domain) 1448 ); 1449 }; 1450 /** @type {IsRtl} */ 1451 1452 1453 const isRTL = () => { 1454 return 'rtl' === _x('ltr', 'text direction'); 1455 }; 1456 /** @type {HasTranslation} */ 1457 1458 1459 const hasTranslation = (single, context, domain) => { 1460 const key = context ? context + '\u0004' + single : single; 1461 let result = !!tannin.data?.[domain !== null && domain !== void 0 ? domain : 'default']?.[key]; 1462 1463 if (hooks) { 1464 /** 1465 * Filters the presence of a translation in the locale data. 1466 * 1467 * @param {boolean} hasTranslation Whether the translation is present or not.. 1468 * @param {string} single The singular form of the translated text (used as key in locale data) 1469 * @param {string} context Context information for the translators. 1470 * @param {string} domain Text domain. Unique identifier for retrieving translated strings. 1471 */ 1472 result = 1473 /** @type { boolean } */ 1474 1475 /** @type {*} */ 1476 hooks.applyFilters('i18n.has_translation', result, single, context, domain); 1477 result = 1478 /** @type { boolean } */ 1479 1480 /** @type {*} */ 1481 hooks.applyFilters('i18n.has_translation_' + getFilterDomain(domain), result, single, context, domain); 1482 } 1483 1484 return result; 1485 }; 1486 1487 if (initialData) { 1488 setLocaleData(initialData, initialDomain); 1489 } 1490 1491 if (hooks) { 1492 /** 1493 * @param {string} hookName 1494 */ 1495 const onHookAddedOrRemoved = hookName => { 1496 if (I18N_HOOK_REGEXP.test(hookName)) { 1497 notifyListeners(); 1498 } 1499 }; 1500 1501 hooks.addAction('hookAdded', 'core/i18n', onHookAddedOrRemoved); 1502 hooks.addAction('hookRemoved', 'core/i18n', onHookAddedOrRemoved); 1503 } 1504 1505 return { 1506 getLocaleData, 1507 setLocaleData, 1508 addLocaleData, 1509 resetLocaleData, 1510 subscribe, 1511 __, 1512 _x, 1513 _n, 1514 _nx, 1515 isRTL, 1516 hasTranslation 1517 }; 1518}; 1519 1520;// CONCATENATED MODULE: external ["wp","hooks"] 1521var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 1522;// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/default-i18n.js 1523/** 1524 * Internal dependencies 1525 */ 1526 1527/** 1528 * WordPress dependencies 1529 */ 1530 1531 1532const i18n = createI18n(undefined, undefined, external_wp_hooks_namespaceObject.defaultHooks); 1533/** 1534 * Default, singleton instance of `I18n`. 1535 */ 1536 1537/* harmony default export */ var default_i18n = (i18n); 1538/* 1539 * Comments in this file are duplicated from ./i18n due to 1540 * https://github.com/WordPress/gutenberg/pull/20318#issuecomment-590837722 1541 */ 1542 1543/** 1544 * @typedef {import('./create-i18n').LocaleData} LocaleData 1545 * @typedef {import('./create-i18n').SubscribeCallback} SubscribeCallback 1546 * @typedef {import('./create-i18n').UnsubscribeCallback} UnsubscribeCallback 1547 */ 1548 1549/** 1550 * Returns locale data by domain in a Jed-formatted JSON object shape. 1551 * 1552 * @see http://messageformat.github.io/Jed/ 1553 * 1554 * @param {string} [domain] Domain for which to get the data. 1555 * @return {LocaleData} Locale data. 1556 */ 1557 1558const getLocaleData = i18n.getLocaleData.bind(i18n); 1559/** 1560 * Merges locale data into the Tannin instance by domain. Accepts data in a 1561 * Jed-formatted JSON object shape. 1562 * 1563 * @see http://messageformat.github.io/Jed/ 1564 * 1565 * @param {LocaleData} [data] Locale data configuration. 1566 * @param {string} [domain] Domain for which configuration applies. 1567 */ 1568 1569const setLocaleData = i18n.setLocaleData.bind(i18n); 1570/** 1571 * Resets all current Tannin instance locale data and sets the specified 1572 * locale data for the domain. Accepts data in a Jed-formatted JSON object shape. 1573 * 1574 * @see http://messageformat.github.io/Jed/ 1575 * 1576 * @param {LocaleData} [data] Locale data configuration. 1577 * @param {string} [domain] Domain for which configuration applies. 1578 */ 1579 1580const resetLocaleData = i18n.resetLocaleData.bind(i18n); 1581/** 1582 * Subscribes to changes of locale data 1583 * 1584 * @param {SubscribeCallback} callback Subscription callback 1585 * @return {UnsubscribeCallback} Unsubscribe callback 1586 */ 1587 1588const subscribe = i18n.subscribe.bind(i18n); 1589/** 1590 * Retrieve the translation of text. 1591 * 1592 * @see https://developer.wordpress.org/reference/functions/__/ 1593 * 1594 * @param {string} text Text to translate. 1595 * @param {string} [domain] Domain to retrieve the translated text. 1596 * 1597 * @return {string} Translated text. 1598 */ 1599 1600const __ = i18n.__.bind(i18n); 1601/** 1602 * Retrieve translated string with gettext context. 1603 * 1604 * @see https://developer.wordpress.org/reference/functions/_x/ 1605 * 1606 * @param {string} text Text to translate. 1607 * @param {string} context Context information for the translators. 1608 * @param {string} [domain] Domain to retrieve the translated text. 1609 * 1610 * @return {string} Translated context string without pipe. 1611 */ 1612 1613const _x = i18n._x.bind(i18n); 1614/** 1615 * Translates and retrieves the singular or plural form based on the supplied 1616 * number. 1617 * 1618 * @see https://developer.wordpress.org/reference/functions/_n/ 1619 * 1620 * @param {string} single The text to be used if the number is singular. 1621 * @param {string} plural The text to be used if the number is plural. 1622 * @param {number} number The number to compare against to use either the 1623 * singular or plural form. 1624 * @param {string} [domain] Domain to retrieve the translated text. 1625 * 1626 * @return {string} The translated singular or plural form. 1627 */ 1628 1629const _n = i18n._n.bind(i18n); 1630/** 1631 * Translates and retrieves the singular or plural form based on the supplied 1632 * number, with gettext context. 1633 * 1634 * @see https://developer.wordpress.org/reference/functions/_nx/ 1635 * 1636 * @param {string} single The text to be used if the number is singular. 1637 * @param {string} plural The text to be used if the number is plural. 1638 * @param {number} number The number to compare against to use either the 1639 * singular or plural form. 1640 * @param {string} context Context information for the translators. 1641 * @param {string} [domain] Domain to retrieve the translated text. 1642 * 1643 * @return {string} The translated singular or plural form. 1644 */ 1645 1646const _nx = i18n._nx.bind(i18n); 1647/** 1648 * Check if current locale is RTL. 1649 * 1650 * **RTL (Right To Left)** is a locale property indicating that text is written from right to left. 1651 * For example, the `he` locale (for Hebrew) specifies right-to-left. Arabic (ar) is another common 1652 * language written RTL. The opposite of RTL, LTR (Left To Right) is used in other languages, 1653 * including English (`en`, `en-US`, `en-GB`, etc.), Spanish (`es`), and French (`fr`). 1654 * 1655 * @return {boolean} Whether locale is RTL. 1656 */ 1657 1658const isRTL = i18n.isRTL.bind(i18n); 1659/** 1660 * Check if there is a translation for a given string (in singular form). 1661 * 1662 * @param {string} single Singular form of the string to look up. 1663 * @param {string} [context] Context information for the translators. 1664 * @param {string} [domain] Domain to retrieve the translated text. 1665 * @return {boolean} Whether the translation exists or not. 1666 */ 1667 1668const hasTranslation = i18n.hasTranslation.bind(i18n); 1669 1670;// CONCATENATED MODULE: ./node_modules/@wordpress/i18n/build-module/index.js 1671 1672 1673 1674 1675}(); 1676(window.wp = window.wp || {}).i18n = __webpack_exports__; 1677/******/ })() 1678;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.