[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  this["wp"] = this["wp"] || {}; this["wp"]["i18n"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  37  /******/     // define getter function for harmony exports
  38  /******/     __webpack_require__.d = function(exports, name, getter) {
  39  /******/         if(!__webpack_require__.o(exports, name)) {
  40  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41  /******/         }
  42  /******/     };
  43  /******/
  44  /******/     // define __esModule on exports
  45  /******/     __webpack_require__.r = function(exports) {
  46  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48  /******/         }
  49  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  50  /******/     };
  51  /******/
  52  /******/     // create a fake namespace object
  53  /******/     // mode & 1: value is a module id, require it
  54  /******/     // mode & 2: merge all properties of value into the ns
  55  /******/     // mode & 4: return value when already ns object
  56  /******/     // mode & 8|1: behave like require
  57  /******/     __webpack_require__.t = function(value, mode) {
  58  /******/         if(mode & 1) value = __webpack_require__(value);
  59  /******/         if(mode & 8) return value;
  60  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61  /******/         var ns = Object.create(null);
  62  /******/         __webpack_require__.r(ns);
  63  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65  /******/         return ns;
  66  /******/     };
  67  /******/
  68  /******/     // getDefaultExport function for compatibility with non-harmony modules
  69  /******/     __webpack_require__.n = function(module) {
  70  /******/         var getter = module && module.__esModule ?
  71  /******/ 			function getDefault() { return module['default']; } :
  72  /******/ 			function getModuleExports() { return module; };
  73  /******/         __webpack_require__.d(getter, 'a', getter);
  74  /******/         return getter;
  75  /******/     };
  76  /******/
  77  /******/     // Object.prototype.hasOwnProperty.call
  78  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79  /******/
  80  /******/     // __webpack_public_path__
  81  /******/     __webpack_require__.p = "";
  82  /******/
  83  /******/
  84  /******/     // Load entry module and return exports
  85  /******/     return __webpack_require__(__webpack_require__.s = "./node_modules/@wordpress/i18n/build-module/index.js");
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ "./node_modules/@wordpress/i18n/build-module/index.js":
  91  /*!************************************************************!*\
  92    !*** ./node_modules/@wordpress/i18n/build-module/index.js ***!
  93    \************************************************************/
  94  /*! exports provided: setLocaleData, __, _x, _n, _nx, sprintf */
  95  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  96  
  97  "use strict";
  98  __webpack_require__.r(__webpack_exports__);
  99  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLocaleData", function() { return setLocaleData; });
 100  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__", function() { return __; });
 101  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_x", function() { return _x; });
 102  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_n", function() { return _n; });
 103  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_nx", function() { return _nx; });
 104  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sprintf", function() { return sprintf; });
 105  /* harmony import */ var jed__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jed */ "./node_modules/jed/jed.js");
 106  /* harmony import */ var jed__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jed__WEBPACK_IMPORTED_MODULE_0__);
 107  /* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! memize */ "./node_modules/memize/index.js");
 108  /* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(memize__WEBPACK_IMPORTED_MODULE_1__);
 109  /**
 110   * External dependencies
 111   */
 112  
 113  
 114  var i18n;
 115  /**
 116   * Log to console, once per message; or more precisely, per referentially equal
 117   * argument set. Because Jed throws errors, we log these to the console instead
 118   * to avoid crashing the application.
 119   *
 120   * @param {...*} args Arguments to pass to `console.error`
 121   */
 122  
 123  var logErrorOnce = memize__WEBPACK_IMPORTED_MODULE_1___default()(console.error); // eslint-disable-line no-console
 124  
 125  /**
 126   * Merges locale data into the Jed instance by domain. Creates a new Jed
 127   * instance if one has not yet been assigned.
 128   *
 129   * @see http://messageformat.github.io/Jed/
 130   *
 131   * @param {?Object} localeData Locale data configuration.
 132   * @param {?string} domain     Domain for which configuration applies.
 133   */
 134  
 135  function setLocaleData() {
 136    var localeData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
 137      '': {}
 138    };
 139    var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
 140  
 141    if (!i18n) {
 142      i18n = new jed__WEBPACK_IMPORTED_MODULE_0___default.a({
 143        domain: 'default',
 144        locale_data: {
 145          default: {
 146            '': {}
 147          }
 148        }
 149      });
 150    }
 151  
 152    i18n.options.locale_data[domain] = Object.assign({}, i18n.options.locale_data[domain], localeData);
 153  }
 154  /**
 155   * Returns the current Jed instance, initializing with a default configuration
 156   * if not already assigned.
 157   *
 158   * @return {Jed} Jed instance.
 159   */
 160  
 161  function getI18n() {
 162    if (!i18n) {
 163      setLocaleData();
 164    }
 165  
 166    return i18n;
 167  }
 168  /**
 169   * Wrapper for Jed's `dcnpgettext`, its most qualified function. Absorbs errors
 170   * which are thrown as the result of invalid translation.
 171   *
 172   * @param {?string} domain  Domain to retrieve the translated text.
 173   * @param {?string} context Context information for the translators.
 174   * @param {string}  single  Text to translate if non-plural. Used as fallback
 175   *                          return value on a caught error.
 176   * @param {?string} plural  The text to be used if the number is plural.
 177   * @param {?number} number  The number to compare against to use either the
 178   *                          singular or plural form.
 179   *
 180   * @return {string} The translated string.
 181   */
 182  
 183  
 184  var dcnpgettext = memize__WEBPACK_IMPORTED_MODULE_1___default()(function () {
 185    var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
 186    var context = arguments.length > 1 ? arguments[1] : undefined;
 187    var single = arguments.length > 2 ? arguments[2] : undefined;
 188    var plural = arguments.length > 3 ? arguments[3] : undefined;
 189    var number = arguments.length > 4 ? arguments[4] : undefined;
 190  
 191    try {
 192      return getI18n().dcnpgettext(domain, context, single, plural, number);
 193    } catch (error) {
 194      logErrorOnce('Jed localization error: \n\n' + error.toString());
 195      return single;
 196    }
 197  });
 198  /**
 199   * Retrieve the translation of text.
 200   *
 201   * @see https://developer.wordpress.org/reference/functions/__/
 202   *
 203   * @param {string}  text   Text to translate.
 204   * @param {?string} domain Domain to retrieve the translated text.
 205   *
 206   * @return {string} Translated text.
 207   */
 208  
 209  function __(text, domain) {
 210    return dcnpgettext(domain, undefined, text);
 211  }
 212  /**
 213   * Retrieve translated string with gettext context.
 214   *
 215   * @see https://developer.wordpress.org/reference/functions/_x/
 216   *
 217   * @param {string}  text    Text to translate.
 218   * @param {string}  context Context information for the translators.
 219   * @param {?string} domain  Domain to retrieve the translated text.
 220   *
 221   * @return {string} Translated context string without pipe.
 222   */
 223  
 224  function _x(text, context, domain) {
 225    return dcnpgettext(domain, context, text);
 226  }
 227  /**
 228   * Translates and retrieves the singular or plural form based on the supplied
 229   * number.
 230   *
 231   * @see https://developer.wordpress.org/reference/functions/_n/
 232   *
 233   * @param {string}  single The text to be used if the number is singular.
 234   * @param {string}  plural The text to be used if the number is plural.
 235   * @param {number}  number The number to compare against to use either the
 236   *                         singular or plural form.
 237   * @param {?string} domain Domain to retrieve the translated text.
 238   *
 239   * @return {string} The translated singular or plural form.
 240   */
 241  
 242  function _n(single, plural, number, domain) {
 243    return dcnpgettext(domain, undefined, single, plural, number);
 244  }
 245  /**
 246   * Translates and retrieves the singular or plural form based on the supplied
 247   * number, with gettext context.
 248   *
 249   * @see https://developer.wordpress.org/reference/functions/_nx/
 250   *
 251   * @param {string}  single  The text to be used if the number is singular.
 252   * @param {string}  plural  The text to be used if the number is plural.
 253   * @param {number}  number  The number to compare against to use either the
 254   *                          singular or plural form.
 255   * @param {string}  context Context information for the translators.
 256   * @param {?string} domain  Domain to retrieve the translated text.
 257   *
 258   * @return {string} The translated singular or plural form.
 259   */
 260  
 261  function _nx(single, plural, number, context, domain) {
 262    return dcnpgettext(domain, context, single, plural, number);
 263  }
 264  /**
 265   * Returns a formatted string. If an error occurs in applying the format, the
 266   * original format string is returned.
 267   *
 268   * @param {string}   format  The format of the string to generate.
 269   * @param {string[]} ...args Arguments to apply to the format.
 270   *
 271   * @see http://www.diveintojavascript.com/projects/javascript-sprintf
 272   *
 273   * @return {string} The formatted string.
 274   */
 275  
 276  function sprintf(format) {
 277    try {
 278      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
 279        args[_key - 1] = arguments[_key];
 280      }
 281  
 282      return jed__WEBPACK_IMPORTED_MODULE_0___default.a.sprintf.apply(jed__WEBPACK_IMPORTED_MODULE_0___default.a, [format].concat(args));
 283    } catch (error) {
 284      logErrorOnce('Jed sprintf error: \n\n' + error.toString());
 285      return format;
 286    }
 287  }
 288  
 289  
 290  /***/ }),
 291  
 292  /***/ "./node_modules/jed/jed.js":
 293  /*!*********************************!*\
 294    !*** ./node_modules/jed/jed.js ***!
 295    \*********************************/
 296  /*! no static exports found */
 297  /***/ (function(module, exports, __webpack_require__) {
 298  
 299  /**
 300   * @preserve jed.js https://github.com/SlexAxton/Jed
 301   */
 302  /*
 303  -----------
 304  A gettext compatible i18n library for modern JavaScript Applications
 305  
 306  by Alex Sexton - AlexSexton [at] gmail - @SlexAxton
 307  
 308  MIT License
 309  
 310  A jQuery Foundation project - requires CLA to contribute -
 311  https://contribute.jquery.org/CLA/
 312  
 313  
 314  
 315  Jed offers the entire applicable GNU gettext spec'd set of
 316  functions, but also offers some nicer wrappers around them.
 317  The api for gettext was written for a language with no function
 318  overloading, so Jed allows a little more of that.
 319  
 320  Many thanks to Joshua I. Miller - unrtst@cpan.org - who wrote
 321  gettext.js back in 2008. I was able to vet a lot of my ideas
 322  against his. I also made sure Jed passed against his tests
 323  in order to offer easy upgrades -- jsgettext.berlios.de
 324  */
 325  (function (root, undef) {
 326  
 327    // Set up some underscore-style functions, if you already have
 328    // underscore, feel free to delete this section, and use it
 329    // directly, however, the amount of functions used doesn't
 330    // warrant having underscore as a full dependency.
 331    // Underscore 1.3.0 was used to port and is licensed
 332    // under the MIT License by Jeremy Ashkenas.
 333    var ArrayProto    = Array.prototype,
 334        ObjProto      = Object.prototype,
 335        slice         = ArrayProto.slice,
 336        hasOwnProp    = ObjProto.hasOwnProperty,
 337        nativeForEach = ArrayProto.forEach,
 338        breaker       = {};
 339  
 340    // We're not using the OOP style _ so we don't need the
 341    // extra level of indirection. This still means that you
 342    // sub out for real `_` though.
 343    var _ = {
 344      forEach : function( obj, iterator, context ) {
 345        var i, l, key;
 346        if ( obj === null ) {
 347          return;
 348        }
 349  
 350        if ( nativeForEach && obj.forEach === nativeForEach ) {
 351          obj.forEach( iterator, context );
 352        }
 353        else if ( obj.length === +obj.length ) {
 354          for ( i = 0, l = obj.length; i < l; i++ ) {
 355            if ( i in obj && iterator.call( context, obj[i], i, obj ) === breaker ) {
 356              return;
 357            }
 358          }
 359        }
 360        else {
 361          for ( key in obj) {
 362            if ( hasOwnProp.call( obj, key ) ) {
 363              if ( iterator.call (context, obj[key], key, obj ) === breaker ) {
 364                return;
 365              }
 366            }
 367          }
 368        }
 369      },
 370      extend : function( obj ) {
 371        this.forEach( slice.call( arguments, 1 ), function ( source ) {
 372          for ( var prop in source ) {
 373            obj[prop] = source[prop];
 374          }
 375        });
 376        return obj;
 377      }
 378    };
 379    // END Miniature underscore impl
 380  
 381    // Jed is a constructor function
 382    var Jed = function ( options ) {
 383      // Some minimal defaults
 384      this.defaults = {
 385        "locale_data" : {
 386          "messages" : {
 387            "" : {
 388              "domain"       : "messages",
 389              "lang"         : "en",
 390              "plural_forms" : "nplurals=2; plural=(n != 1);"
 391            }
 392            // There are no default keys, though
 393          }
 394        },
 395        // The default domain if one is missing
 396        "domain" : "messages",
 397        // enable debug mode to log untranslated strings to the console
 398        "debug" : false
 399      };
 400  
 401      // Mix in the sent options with the default options
 402      this.options = _.extend( {}, this.defaults, options );
 403      this.textdomain( this.options.domain );
 404  
 405      if ( options.domain && ! this.options.locale_data[ this.options.domain ] ) {
 406        throw new Error('Text domain set to non-existent domain: `' + options.domain + '`');
 407      }
 408    };
 409  
 410    // The gettext spec sets this character as the default
 411    // delimiter for context lookups.
 412    // e.g.: context\u0004key
 413    // If your translation company uses something different,
 414    // just change this at any time and it will use that instead.
 415    Jed.context_delimiter = String.fromCharCode( 4 );
 416  
 417    function getPluralFormFunc ( plural_form_string ) {
 418      return Jed.PF.compile( plural_form_string || "nplurals=2; plural=(n != 1);");
 419    }
 420  
 421    function Chain( key, i18n ){
 422      this._key = key;
 423      this._i18n = i18n;
 424    }
 425  
 426    // Create a chainable api for adding args prettily
 427    _.extend( Chain.prototype, {
 428      onDomain : function ( domain ) {
 429        this._domain = domain;
 430        return this;
 431      },
 432      withContext : function ( context ) {
 433        this._context = context;
 434        return this;
 435      },
 436      ifPlural : function ( num, pkey ) {
 437        this._val = num;
 438        this._pkey = pkey;
 439        return this;
 440      },
 441      fetch : function ( sArr ) {
 442        if ( {}.toString.call( sArr ) != '[object Array]' ) {
 443          sArr = [].slice.call(arguments, 0);
 444        }
 445        return ( sArr && sArr.length ? Jed.sprintf : function(x){ return x; } )(
 446          this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val),
 447          sArr
 448        );
 449      }
 450    });
 451  
 452    // Add functions to the Jed prototype.
 453    // These will be the functions on the object that's returned
 454    // from creating a `new Jed()`
 455    // These seem redundant, but they gzip pretty well.
 456    _.extend( Jed.prototype, {
 457      // The sexier api start point
 458      translate : function ( key ) {
 459        return new Chain( key, this );
 460      },
 461  
 462      textdomain : function ( domain ) {
 463        if ( ! domain ) {
 464          return this._textdomain;
 465        }
 466        this._textdomain = domain;
 467      },
 468  
 469      gettext : function ( key ) {
 470        return this.dcnpgettext.call( this, undef, undef, key );
 471      },
 472  
 473      dgettext : function ( domain, key ) {
 474       return this.dcnpgettext.call( this, domain, undef, key );
 475      },
 476  
 477      dcgettext : function ( domain , key /*, category */ ) {
 478        // Ignores the category anyways
 479        return this.dcnpgettext.call( this, domain, undef, key );
 480      },
 481  
 482      ngettext : function ( skey, pkey, val ) {
 483        return this.dcnpgettext.call( this, undef, undef, skey, pkey, val );
 484      },
 485  
 486      dngettext : function ( domain, skey, pkey, val ) {
 487        return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );
 488      },
 489  
 490      dcngettext : function ( domain, skey, pkey, val/*, category */) {
 491        return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );
 492      },
 493  
 494      pgettext : function ( context, key ) {
 495        return this.dcnpgettext.call( this, undef, context, key );
 496      },
 497  
 498      dpgettext : function ( domain, context, key ) {
 499        return this.dcnpgettext.call( this, domain, context, key );
 500      },
 501  
 502      dcpgettext : function ( domain, context, key/*, category */) {
 503        return this.dcnpgettext.call( this, domain, context, key );
 504      },
 505  
 506      npgettext : function ( context, skey, pkey, val ) {
 507        return this.dcnpgettext.call( this, undef, context, skey, pkey, val );
 508      },
 509  
 510      dnpgettext : function ( domain, context, skey, pkey, val ) {
 511        return this.dcnpgettext.call( this, domain, context, skey, pkey, val );
 512      },
 513  
 514      // The most fully qualified gettext function. It has every option.
 515      // Since it has every option, we can use it from every other method.
 516      // This is the bread and butter.
 517      // Technically there should be one more argument in this function for 'Category',
 518      // but since we never use it, we might as well not waste the bytes to define it.
 519      dcnpgettext : function ( domain, context, singular_key, plural_key, val ) {
 520        // Set some defaults
 521  
 522        plural_key = plural_key || singular_key;
 523  
 524        // Use the global domain default if one
 525        // isn't explicitly passed in
 526        domain = domain || this._textdomain;
 527  
 528        var fallback;
 529  
 530        // Handle special cases
 531  
 532        // No options found
 533        if ( ! this.options ) {
 534          // There's likely something wrong, but we'll return the correct key for english
 535          // We do this by instantiating a brand new Jed instance with the default set
 536          // for everything that could be broken.
 537          fallback = new Jed();
 538          return fallback.dcnpgettext.call( fallback, undefined, undefined, singular_key, plural_key, val );
 539        }
 540  
 541        // No translation data provided
 542        if ( ! this.options.locale_data ) {
 543          throw new Error('No locale data provided.');
 544        }
 545  
 546        if ( ! this.options.locale_data[ domain ] ) {
 547          throw new Error('Domain `' + domain + '` was not found.');
 548        }
 549  
 550        if ( ! this.options.locale_data[ domain ][ "" ] ) {
 551          throw new Error('No locale meta information provided.');
 552        }
 553  
 554        // Make sure we have a truthy key. Otherwise we might start looking
 555        // into the empty string key, which is the options for the locale
 556        // data.
 557        if ( ! singular_key ) {
 558          throw new Error('No translation key found.');
 559        }
 560  
 561        var key  = context ? context + Jed.context_delimiter + singular_key : singular_key,
 562            locale_data = this.options.locale_data,
 563            dict = locale_data[ domain ],
 564            defaultConf = (locale_data.messages || this.defaults.locale_data.messages)[""],
 565            pluralForms = dict[""].plural_forms || dict[""]["Plural-Forms"] || dict[""]["plural-forms"] || defaultConf.plural_forms || defaultConf["Plural-Forms"] || defaultConf["plural-forms"],
 566            val_list,
 567            res;
 568  
 569        var val_idx;
 570        if (val === undefined) {
 571          // No value passed in; assume singular key lookup.
 572          val_idx = 0;
 573  
 574        } else {
 575          // Value has been passed in; use plural-forms calculations.
 576  
 577          // Handle invalid numbers, but try casting strings for good measure
 578          if ( typeof val != 'number' ) {
 579            val = parseInt( val, 10 );
 580  
 581            if ( isNaN( val ) ) {
 582              throw new Error('The number that was passed in is not a number.');
 583            }
 584          }
 585  
 586          val_idx = getPluralFormFunc(pluralForms)(val);
 587        }
 588  
 589        // Throw an error if a domain isn't found
 590        if ( ! dict ) {
 591          throw new Error('No domain named `' + domain + '` could be found.');
 592        }
 593  
 594        val_list = dict[ key ];
 595  
 596        // If there is no match, then revert back to
 597        // english style singular/plural with the keys passed in.
 598        if ( ! val_list || val_idx > val_list.length ) {
 599          if (this.options.missing_key_callback) {
 600            this.options.missing_key_callback(key, domain);
 601          }
 602          res = [ singular_key, plural_key ];
 603  
 604          // collect untranslated strings
 605          if (this.options.debug===true) {
 606            console.log(res[ getPluralFormFunc(pluralForms)( val ) ]);
 607          }
 608          return res[ getPluralFormFunc()( val ) ];
 609        }
 610  
 611        res = val_list[ val_idx ];
 612  
 613        // This includes empty strings on purpose
 614        if ( ! res  ) {
 615          res = [ singular_key, plural_key ];
 616          return res[ getPluralFormFunc()( val ) ];
 617        }
 618        return res;
 619      }
 620    });
 621  
 622  
 623    // We add in sprintf capabilities for post translation value interolation
 624    // This is not internally used, so you can remove it if you have this
 625    // available somewhere else, or want to use a different system.
 626  
 627    // We _slightly_ modify the normal sprintf behavior to more gracefully handle
 628    // undefined values.
 629  
 630    /**
 631     sprintf() for JavaScript 0.7-beta1
 632     http://www.diveintojavascript.com/projects/javascript-sprintf
 633  
 634     Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
 635     All rights reserved.
 636  
 637     Redistribution and use in source and binary forms, with or without
 638     modification, are permitted provided that the following conditions are met:
 639         * Redistributions of source code must retain the above copyright
 640           notice, this list of conditions and the following disclaimer.
 641         * Redistributions in binary form must reproduce the above copyright
 642           notice, this list of conditions and the following disclaimer in the
 643           documentation and/or other materials provided with the distribution.
 644         * Neither the name of sprintf() for JavaScript nor the
 645           names of its contributors may be used to endorse or promote products
 646           derived from this software without specific prior written permission.
 647  
 648     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 649     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 650     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 651     DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
 652     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 653     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 654     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 655     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 656     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 657     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 658    */
 659    var sprintf = (function() {
 660      function get_type(variable) {
 661        return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
 662      }
 663      function str_repeat(input, multiplier) {
 664        for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
 665        return output.join('');
 666      }
 667  
 668      var str_format = function() {
 669        if (!str_format.cache.hasOwnProperty(arguments[0])) {
 670          str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
 671        }
 672        return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
 673      };
 674  
 675      str_format.format = function(parse_tree, argv) {
 676        var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
 677        for (i = 0; i < tree_length; i++) {
 678          node_type = get_type(parse_tree[i]);
 679          if (node_type === 'string') {
 680            output.push(parse_tree[i]);
 681          }
 682          else if (node_type === 'array') {
 683            match = parse_tree[i]; // convenience purposes only
 684            if (match[2]) { // keyword argument
 685              arg = argv[cursor];
 686              for (k = 0; k < match[2].length; k++) {
 687                if (!arg.hasOwnProperty(match[2][k])) {
 688                  throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
 689                }
 690                arg = arg[match[2][k]];
 691              }
 692            }
 693            else if (match[1]) { // positional argument (explicit)
 694              arg = argv[match[1]];
 695            }
 696            else { // positional argument (implicit)
 697              arg = argv[cursor++];
 698            }
 699  
 700            if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
 701              throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));
 702            }
 703  
 704            // Jed EDIT
 705            if ( typeof arg == 'undefined' || arg === null ) {
 706              arg = '';
 707            }
 708            // Jed EDIT
 709  
 710            switch (match[8]) {
 711              case 'b': arg = arg.toString(2); break;
 712              case 'c': arg = String.fromCharCode(arg); break;
 713              case 'd': arg = parseInt(arg, 10); break;
 714              case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
 715              case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
 716              case 'o': arg = arg.toString(8); break;
 717              case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
 718              case 'u': arg = Math.abs(arg); break;
 719              case 'x': arg = arg.toString(16); break;
 720              case 'X': arg = arg.toString(16).toUpperCase(); break;
 721            }
 722            arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
 723            pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
 724            pad_length = match[6] - String(arg).length;
 725            pad = match[6] ? str_repeat(pad_character, pad_length) : '';
 726            output.push(match[5] ? arg + pad : pad + arg);
 727          }
 728        }
 729        return output.join('');
 730      };
 731  
 732      str_format.cache = {};
 733  
 734      str_format.parse = function(fmt) {
 735        var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
 736        while (_fmt) {
 737          if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
 738            parse_tree.push(match[0]);
 739          }
 740          else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
 741            parse_tree.push('%');
 742          }
 743          else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
 744            if (match[2]) {
 745              arg_names |= 1;
 746              var field_list = [], replacement_field = match[2], field_match = [];
 747              if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
 748                field_list.push(field_match[1]);
 749                while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
 750                  if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
 751                    field_list.push(field_match[1]);
 752                  }
 753                  else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
 754                    field_list.push(field_match[1]);
 755                  }
 756                  else {
 757                    throw('[sprintf] huh?');
 758                  }
 759                }
 760              }
 761              else {
 762                throw('[sprintf] huh?');
 763              }
 764              match[2] = field_list;
 765            }
 766            else {
 767              arg_names |= 2;
 768            }
 769            if (arg_names === 3) {
 770              throw('[sprintf] mixing positional and named placeholders is not (yet) supported');
 771            }
 772            parse_tree.push(match);
 773          }
 774          else {
 775            throw('[sprintf] huh?');
 776          }
 777          _fmt = _fmt.substring(match[0].length);
 778        }
 779        return parse_tree;
 780      };
 781  
 782      return str_format;
 783    })();
 784  
 785    var vsprintf = function(fmt, argv) {
 786      argv.unshift(fmt);
 787      return sprintf.apply(null, argv);
 788    };
 789  
 790    Jed.parse_plural = function ( plural_forms, n ) {
 791      plural_forms = plural_forms.replace(/n/g, n);
 792      return Jed.parse_expression(plural_forms);
 793    };
 794  
 795    Jed.sprintf = function ( fmt, args ) {
 796      if ( {}.toString.call( args ) == '[object Array]' ) {
 797        return vsprintf( fmt, [].slice.call(args) );
 798      }
 799      return sprintf.apply(this, [].slice.call(arguments) );
 800    };
 801  
 802    Jed.prototype.sprintf = function () {
 803      return Jed.sprintf.apply(this, arguments);
 804    };
 805    // END sprintf Implementation
 806  
 807    // Start the Plural forms section
 808    // This is a full plural form expression parser. It is used to avoid
 809    // running 'eval' or 'new Function' directly against the plural
 810    // forms.
 811    //
 812    // This can be important if you get translations done through a 3rd
 813    // party vendor. I encourage you to use this instead, however, I
 814    // also will provide a 'precompiler' that you can use at build time
 815    // to output valid/safe function representations of the plural form
 816    // expressions. This means you can build this code out for the most
 817    // part.
 818    Jed.PF = {};
 819  
 820    Jed.PF.parse = function ( p ) {
 821      var plural_str = Jed.PF.extractPluralExpr( p );
 822      return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str);
 823    };
 824  
 825    Jed.PF.compile = function ( p ) {
 826      // Handle trues and falses as 0 and 1
 827      function imply( val ) {
 828        return (val === true ? 1 : val ? val : 0);
 829      }
 830  
 831      var ast = Jed.PF.parse( p );
 832      return function ( n ) {
 833        return imply( Jed.PF.interpreter( ast )( n ) );
 834      };
 835    };
 836  
 837    Jed.PF.interpreter = function ( ast ) {
 838      return function ( n ) {
 839        var res;
 840        switch ( ast.type ) {
 841          case 'GROUP':
 842            return Jed.PF.interpreter( ast.expr )( n );
 843          case 'TERNARY':
 844            if ( Jed.PF.interpreter( ast.expr )( n ) ) {
 845              return Jed.PF.interpreter( ast.truthy )( n );
 846            }
 847            return Jed.PF.interpreter( ast.falsey )( n );
 848          case 'OR':
 849            return Jed.PF.interpreter( ast.left )( n ) || Jed.PF.interpreter( ast.right )( n );
 850          case 'AND':
 851            return Jed.PF.interpreter( ast.left )( n ) && Jed.PF.interpreter( ast.right )( n );
 852          case 'LT':
 853            return Jed.PF.interpreter( ast.left )( n ) < Jed.PF.interpreter( ast.right )( n );
 854          case 'GT':
 855            return Jed.PF.interpreter( ast.left )( n ) > Jed.PF.interpreter( ast.right )( n );
 856          case 'LTE':
 857            return Jed.PF.interpreter( ast.left )( n ) <= Jed.PF.interpreter( ast.right )( n );
 858          case 'GTE':
 859            return Jed.PF.interpreter( ast.left )( n ) >= Jed.PF.interpreter( ast.right )( n );
 860          case 'EQ':
 861            return Jed.PF.interpreter( ast.left )( n ) == Jed.PF.interpreter( ast.right )( n );
 862          case 'NEQ':
 863            return Jed.PF.interpreter( ast.left )( n ) != Jed.PF.interpreter( ast.right )( n );
 864          case 'MOD':
 865            return Jed.PF.interpreter( ast.left )( n ) % Jed.PF.interpreter( ast.right )( n );
 866          case 'VAR':
 867            return n;
 868          case 'NUM':
 869            return ast.val;
 870          default:
 871            throw new Error("Invalid Token found.");
 872        }
 873      };
 874    };
 875  
 876    Jed.PF.extractPluralExpr = function ( p ) {
 877      // trim first
 878      p = p.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
 879  
 880      if (! /;\s*$/.test(p)) {
 881        p = p.concat(';');
 882      }
 883  
 884      var nplurals_re = /nplurals\=(\d+);/,
 885          plural_re = /plural\=(.*);/,
 886          nplurals_matches = p.match( nplurals_re ),
 887          res = {},
 888          plural_matches;
 889  
 890      // Find the nplurals number
 891      if ( nplurals_matches.length > 1 ) {
 892        res.nplurals = nplurals_matches[1];
 893      }
 894      else {
 895        throw new Error('nplurals not found in plural_forms string: ' + p );
 896      }
 897  
 898      // remove that data to get to the formula
 899      p = p.replace( nplurals_re, "" );
 900      plural_matches = p.match( plural_re );
 901  
 902      if (!( plural_matches && plural_matches.length > 1 ) ) {
 903        throw new Error('`plural` expression not found: ' + p);
 904      }
 905      return plural_matches[ 1 ];
 906    };
 907  
 908    /* Jison generated parser */
 909    Jed.PF.parser = (function(){
 910  
 911  var parser = {trace: function trace() { },
 912  yy: {},
 913  symbols_: {"error":2,"expressions":3,"e":4,"EOF":5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,"n":19,"NUMBER":20,"$accept":0,"$end":1},
 914  terminals_: {2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"},
 915  productions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],
 916  performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
 917  
 918  var $0 = $$.length - 1;
 919  switch (yystate) {
 920  case 1: return { type : 'GROUP', expr: $$[$0-1] };
 921  break;
 922  case 2:this.$ = { type: 'TERNARY', expr: $$[$0-4], truthy : $$[$0-2], falsey: $$[$0] };
 923  break;
 924  case 3:this.$ = { type: "OR", left: $$[$0-2], right: $$[$0] };
 925  break;
 926  case 4:this.$ = { type: "AND", left: $$[$0-2], right: $$[$0] };
 927  break;
 928  case 5:this.$ = { type: 'LT', left: $$[$0-2], right: $$[$0] };
 929  break;
 930  case 6:this.$ = { type: 'LTE', left: $$[$0-2], right: $$[$0] };
 931  break;
 932  case 7:this.$ = { type: 'GT', left: $$[$0-2], right: $$[$0] };
 933  break;
 934  case 8:this.$ = { type: 'GTE', left: $$[$0-2], right: $$[$0] };
 935  break;
 936  case 9:this.$ = { type: 'NEQ', left: $$[$0-2], right: $$[$0] };
 937  break;
 938  case 10:this.$ = { type: 'EQ', left: $$[$0-2], right: $$[$0] };
 939  break;
 940  case 11:this.$ = { type: 'MOD', left: $$[$0-2], right: $$[$0] };
 941  break;
 942  case 12:this.$ = { type: 'GROUP', expr: $$[$0-1] };
 943  break;
 944  case 13:this.$ = { type: 'VAR' };
 945  break;
 946  case 14:this.$ = { type: 'NUM', val: Number(yytext) };
 947  break;
 948  }
 949  },
 950  table: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],
 951  defaultActions: {6:[2,1]},
 952  parseError: function parseError(str, hash) {
 953      throw new Error(str);
 954  },
 955  parse: function parse(input) {
 956      var self = this,
 957          stack = [0],
 958          vstack = [null], // semantic value stack
 959          lstack = [], // location stack
 960          table = this.table,
 961          yytext = '',
 962          yylineno = 0,
 963          yyleng = 0,
 964          recovering = 0,
 965          TERROR = 2,
 966          EOF = 1;
 967  
 968      //this.reductionCount = this.shiftCount = 0;
 969  
 970      this.lexer.setInput(input);
 971      this.lexer.yy = this.yy;
 972      this.yy.lexer = this.lexer;
 973      if (typeof this.lexer.yylloc == 'undefined')
 974          this.lexer.yylloc = {};
 975      var yyloc = this.lexer.yylloc;
 976      lstack.push(yyloc);
 977  
 978      if (typeof this.yy.parseError === 'function')
 979          this.parseError = this.yy.parseError;
 980  
 981      function popStack (n) {
 982          stack.length = stack.length - 2*n;
 983          vstack.length = vstack.length - n;
 984          lstack.length = lstack.length - n;
 985      }
 986  
 987      function lex() {
 988          var token;
 989          token = self.lexer.lex() || 1; // $end = 1
 990          // if token isn't its numeric value, convert
 991          if (typeof token !== 'number') {
 992              token = self.symbols_[token] || token;
 993          }
 994          return token;
 995      }
 996  
 997      var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected;
 998      while (true) {
 999          // retreive state number from top of stack
1000          state = stack[stack.length-1];
1001  
1002          // use default actions if available
1003          if (this.defaultActions[state]) {
1004              action = this.defaultActions[state];
1005          } else {
1006              if (symbol == null)
1007                  symbol = lex();
1008              // read action for current state and first input
1009              action = table[state] && table[state][symbol];
1010          }
1011  
1012          // handle parse error
1013          _handle_error:
1014          if (typeof action === 'undefined' || !action.length || !action[0]) {
1015  
1016              if (!recovering) {
1017                  // Report error
1018                  expected = [];
1019                  for (p in table[state]) if (this.terminals_[p] && p > 2) {
1020                      expected.push("'"+this.terminals_[p]+"'");
1021                  }
1022                  var errStr = '';
1023                  if (this.lexer.showPosition) {
1024                      errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
1025                  } else {
1026                      errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
1027                                    (symbol == 1 /*EOF*/ ? "end of input" :
1028                                                ("'"+(this.terminals_[symbol] || symbol)+"'"));
1029                  }
1030                  this.parseError(errStr,
1031                      {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
1032              }
1033  
1034              // just recovered from another error
1035              if (recovering == 3) {
1036                  if (symbol == EOF) {
1037                      throw new Error(errStr || 'Parsing halted.');
1038                  }
1039  
1040                  // discard current lookahead and grab another
1041                  yyleng = this.lexer.yyleng;
1042                  yytext = this.lexer.yytext;
1043                  yylineno = this.lexer.yylineno;
1044                  yyloc = this.lexer.yylloc;
1045                  symbol = lex();
1046              }
1047  
1048              // try to recover from error
1049              while (1) {
1050                  // check for error recovery rule in this state
1051                  if ((TERROR.toString()) in table[state]) {
1052                      break;
1053                  }
1054                  if (state == 0) {
1055                      throw new Error(errStr || 'Parsing halted.');
1056                  }
1057                  popStack(1);
1058                  state = stack[stack.length-1];
1059              }
1060  
1061              preErrorSymbol = symbol; // save the lookahead token
1062              symbol = TERROR;         // insert generic error symbol as new lookahead
1063              state = stack[stack.length-1];
1064              action = table[state] && table[state][TERROR];
1065              recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
1066          }
1067  
1068          // this shouldn't happen, unless resolve defaults are off
1069          if (action[0] instanceof Array && action.length > 1) {
1070              throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
1071          }
1072  
1073          switch (action[0]) {
1074  
1075              case 1: // shift
1076                  //this.shiftCount++;
1077  
1078                  stack.push(symbol);
1079                  vstack.push(this.lexer.yytext);
1080                  lstack.push(this.lexer.yylloc);
1081                  stack.push(action[1]); // push state
1082                  symbol = null;
1083                  if (!preErrorSymbol) { // normal execution/no error
1084                      yyleng = this.lexer.yyleng;
1085                      yytext = this.lexer.yytext;
1086                      yylineno = this.lexer.yylineno;
1087                      yyloc = this.lexer.yylloc;
1088                      if (recovering > 0)
1089                          recovering--;
1090                  } else { // error just occurred, resume old lookahead f/ before error
1091                      symbol = preErrorSymbol;
1092                      preErrorSymbol = null;
1093                  }
1094                  break;
1095  
1096              case 2: // reduce
1097                  //this.reductionCount++;
1098  
1099                  len = this.productions_[action[1]][1];
1100  
1101                  // perform semantic action
1102                  yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
1103                  // default location, uses first token for firsts, last for lasts
1104                  yyval._$ = {
1105                      first_line: lstack[lstack.length-(len||1)].first_line,
1106                      last_line: lstack[lstack.length-1].last_line,
1107                      first_column: lstack[lstack.length-(len||1)].first_column,
1108                      last_column: lstack[lstack.length-1].last_column
1109                  };
1110                  r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
1111  
1112                  if (typeof r !== 'undefined') {
1113                      return r;
1114                  }
1115  
1116                  // pop off stack
1117                  if (len) {
1118                      stack = stack.slice(0,-1*len*2);
1119                      vstack = vstack.slice(0, -1*len);
1120                      lstack = lstack.slice(0, -1*len);
1121                  }
1122  
1123                  stack.push(this.productions_[action[1]][0]);    // push nonterminal (reduce)
1124                  vstack.push(yyval.$);
1125                  lstack.push(yyval._$);
1126                  // goto new state = table[STATE][NONTERMINAL]
1127                  newState = table[stack[stack.length-2]][stack[stack.length-1]];
1128                  stack.push(newState);
1129                  break;
1130  
1131              case 3: // accept
1132                  return true;
1133          }
1134  
1135      }
1136  
1137      return true;
1138  }};/* Jison generated lexer */
1139  var lexer = (function(){
1140  
1141  var lexer = ({EOF:1,
1142  parseError:function parseError(str, hash) {
1143          if (this.yy.parseError) {
1144              this.yy.parseError(str, hash);
1145          } else {
1146              throw new Error(str);
1147          }
1148      },
1149  setInput:function (input) {
1150          this._input = input;
1151          this._more = this._less = this.done = false;
1152          this.yylineno = this.yyleng = 0;
1153          this.yytext = this.matched = this.match = '';
1154          this.conditionStack = ['INITIAL'];
1155          this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
1156          return this;
1157      },
1158  input:function () {
1159          var ch = this._input[0];
1160          this.yytext+=ch;
1161          this.yyleng++;
1162          this.match+=ch;
1163          this.matched+=ch;
1164          var lines = ch.match(/\n/);
1165          if (lines) this.yylineno++;
1166          this._input = this._input.slice(1);
1167          return ch;
1168      },
1169  unput:function (ch) {
1170          this._input = ch + this._input;
1171          return this;
1172      },
1173  more:function () {
1174          this._more = true;
1175          return this;
1176      },
1177  pastInput:function () {
1178          var past = this.matched.substr(0, this.matched.length - this.match.length);
1179          return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
1180      },
1181  upcomingInput:function () {
1182          var next = this.match;
1183          if (next.length < 20) {
1184              next += this._input.substr(0, 20-next.length);
1185          }
1186          return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
1187      },
1188  showPosition:function () {
1189          var pre = this.pastInput();
1190          var c = new Array(pre.length + 1).join("-");
1191          return pre + this.upcomingInput() + "\n" + c+"^";
1192      },
1193  next:function () {
1194          if (this.done) {
1195              return this.EOF;
1196          }
1197          if (!this._input) this.done = true;
1198  
1199          var token,
1200              match,
1201              col,
1202              lines;
1203          if (!this._more) {
1204              this.yytext = '';
1205              this.match = '';
1206          }
1207          var rules = this._currentRules();
1208          for (var i=0;i < rules.length; i++) {
1209              match = this._input.match(this.rules[rules[i]]);
1210              if (match) {
1211                  lines = match[0].match(/\n.*/g);
1212                  if (lines) this.yylineno += lines.length;
1213                  this.yylloc = {first_line: this.yylloc.last_line,
1214                                 last_line: this.yylineno+1,
1215                                 first_column: this.yylloc.last_column,
1216                                 last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
1217                  this.yytext += match[0];
1218                  this.match += match[0];
1219                  this.matches = match;
1220                  this.yyleng = this.yytext.length;
1221                  this._more = false;
1222                  this._input = this._input.slice(match[0].length);
1223                  this.matched += match[0];
1224                  token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);
1225                  if (token) return token;
1226                  else return;
1227              }
1228          }
1229          if (this._input === "") {
1230              return this.EOF;
1231          } else {
1232              this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
1233                      {text: "", token: null, line: this.yylineno});
1234          }
1235      },
1236  lex:function lex() {
1237          var r = this.next();
1238          if (typeof r !== 'undefined') {
1239              return r;
1240          } else {
1241              return this.lex();
1242          }
1243      },
1244  begin:function begin(condition) {
1245          this.conditionStack.push(condition);
1246      },
1247  popState:function popState() {
1248          return this.conditionStack.pop();
1249      },
1250  _currentRules:function _currentRules() {
1251          return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
1252      },
1253  topState:function () {
1254          return this.conditionStack[this.conditionStack.length-2];
1255      },
1256  pushState:function begin(condition) {
1257          this.begin(condition);
1258      }});
1259  lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
1260  
1261  var YYSTATE=YY_START;
1262  switch($avoiding_name_collisions) {
1263  case 0:/* skip whitespace */
1264  break;
1265  case 1:return 20
1266  break;
1267  case 2:return 19
1268  break;
1269  case 3:return 8
1270  break;
1271  case 4:return 9
1272  break;
1273  case 5:return 6
1274  break;
1275  case 6:return 7
1276  break;
1277  case 7:return 11
1278  break;
1279  case 8:return 13
1280  break;
1281  case 9:return 10
1282  break;
1283  case 10:return 12
1284  break;
1285  case 11:return 14
1286  break;
1287  case 12:return 15
1288  break;
1289  case 13:return 16
1290  break;
1291  case 14:return 17
1292  break;
1293  case 15:return 18
1294  break;
1295  case 16:return 5
1296  break;
1297  case 17:return 'INVALID'
1298  break;
1299  }
1300  };
1301  lexer.rules = [/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^</,/^>/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./];
1302  lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}};return lexer;})()
1303  parser.lexer = lexer;
1304  return parser;
1305  })();
1306  // End parser
1307  
1308    // Handle node, amd, and global systems
1309    if (true) {
1310      if ( true && module.exports) {
1311        exports = module.exports = Jed;
1312      }
1313      exports.Jed = Jed;
1314    }
1315    else {}
1316  
1317  })(this);
1318  
1319  
1320  /***/ }),
1321  
1322  /***/ "./node_modules/memize/index.js":
1323  /*!**************************************!*\
1324    !*** ./node_modules/memize/index.js ***!
1325    \**************************************/
1326  /*! no static exports found */
1327  /***/ (function(module, exports, __webpack_require__) {
1328  
1329  module.exports = function memize( fn, options ) {
1330      var size = 0,
1331          maxSize, head, tail;
1332  
1333      if ( options && options.maxSize ) {
1334          maxSize = options.maxSize;
1335      }
1336  
1337  	function memoized( /* ...args */ ) {
1338          var node = head,
1339              len = arguments.length,
1340              args, i;
1341  
1342          searchCache: while ( node ) {
1343              // Perform a shallow equality test to confirm that whether the node
1344              // under test is a candidate for the arguments passed. Two arrays
1345              // are shallowly equal if their length matches and each entry is
1346              // strictly equal between the two sets. Avoid abstracting to a
1347              // function which could incur an arguments leaking deoptimization.
1348  
1349              // Check whether node arguments match arguments length
1350              if ( node.args.length !== arguments.length ) {
1351                  node = node.next;
1352                  continue;
1353              }
1354  
1355              // Check whether node arguments match arguments values
1356              for ( i = 0; i < len; i++ ) {
1357                  if ( node.args[ i ] !== arguments[ i ] ) {
1358                      node = node.next;
1359                      continue searchCache;
1360                  }
1361              }
1362  
1363              // At this point we can assume we've found a match
1364  
1365              // Surface matched node to head if not already
1366              if ( node !== head ) {
1367                  // As tail, shift to previous. Must only shift if not also
1368                  // head, since if both head and tail, there is no previous.
1369                  if ( node === tail ) {
1370                      tail = node.prev;
1371                  }
1372  
1373                  // Adjust siblings to point to each other. If node was tail,
1374                  // this also handles new tail's empty `next` assignment.
1375                  node.prev.next = node.next;
1376                  if ( node.next ) {
1377                      node.next.prev = node.prev;
1378                  }
1379  
1380                  node.next = head;
1381                  node.prev = null;
1382                  head.prev = node;
1383                  head = node;
1384              }
1385  
1386              // Return immediately
1387              return node.val;
1388          }
1389  
1390          // No cached value found. Continue to insertion phase:
1391  
1392          // Create a copy of arguments (avoid leaking deoptimization)
1393          args = new Array( len );
1394          for ( i = 0; i < len; i++ ) {
1395              args[ i ] = arguments[ i ];
1396          }
1397  
1398          node = {
1399              args: args,
1400  
1401              // Generate the result from original function
1402              val: fn.apply( null, args )
1403          };
1404  
1405          // Don't need to check whether node is already head, since it would
1406          // have been returned above already if it was
1407  
1408          // Shift existing head down list
1409          if ( head ) {
1410              head.prev = node;
1411              node.next = head;
1412          } else {
1413              // If no head, follows that there's no tail (at initial or reset)
1414              tail = node;
1415          }
1416  
1417          // Trim tail if we're reached max size and are pending cache insertion
1418          if ( size === maxSize ) {
1419              tail = tail.prev;
1420              tail.next = null;
1421          } else {
1422              size++;
1423          }
1424  
1425          head = node;
1426  
1427          return node.val;
1428      }
1429  
1430      memoized.clear = function() {
1431          head = null;
1432          tail = null;
1433          size = 0;
1434      };
1435  
1436      if ( false ) {}
1437  
1438      return memoized;
1439  };
1440  
1441  
1442  /***/ })
1443  
1444  /******/ });
1445  //# sourceMappingURL=i18n.js.map


Generated: Mon Jan 7 01:00:05 2019 Cross-referenced by PHPXref 0.7.1