github.com/qubitproducts/logspray@v0.2.14/server/swagger-ui/lib/handlebars-4.0.5.js (about) 1 /*! 2 3 handlebars v4.0.5 4 5 Copyright (C) 2011-2015 by Yehuda Katz 6 7 Permission is hereby granted, free of charge, to any person obtaining a copy 8 of this software and associated documentation files (the "Software"), to deal 9 in the Software without restriction, including without limitation the rights 10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 copies of the Software, and to permit persons to whom the Software is 12 furnished to do so, subject to the following conditions: 13 14 The above copyright notice and this permission notice shall be included in 15 all copies or substantial portions of the Software. 16 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 THE SOFTWARE. 24 25 @license 26 */ 27 (function webpackUniversalModuleDefinition(root, factory) { 28 if(typeof exports === 'object' && typeof module === 'object') 29 module.exports = factory(); 30 else if(typeof define === 'function' && define.amd) 31 define([], factory); 32 else if(typeof exports === 'object') 33 exports["Handlebars"] = factory(); 34 else 35 root["Handlebars"] = factory(); 36 })(this, function() { 37 return /******/ (function(modules) { // webpackBootstrap 38 /******/ // The module cache 39 /******/ var installedModules = {}; 40 41 /******/ // The require function 42 /******/ function __webpack_require__(moduleId) { 43 44 /******/ // Check if module is in cache 45 /******/ if(installedModules[moduleId]) 46 /******/ return installedModules[moduleId].exports; 47 48 /******/ // Create a new module (and put it into the cache) 49 /******/ var module = installedModules[moduleId] = { 50 /******/ exports: {}, 51 /******/ id: moduleId, 52 /******/ loaded: false 53 /******/ }; 54 55 /******/ // Execute the module function 56 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 57 58 /******/ // Flag the module as loaded 59 /******/ module.loaded = true; 60 61 /******/ // Return the exports of the module 62 /******/ return module.exports; 63 /******/ } 64 65 66 /******/ // expose the modules object (__webpack_modules__) 67 /******/ __webpack_require__.m = modules; 68 69 /******/ // expose the module cache 70 /******/ __webpack_require__.c = installedModules; 71 72 /******/ // __webpack_public_path__ 73 /******/ __webpack_require__.p = ""; 74 75 /******/ // Load entry module and return exports 76 /******/ return __webpack_require__(0); 77 /******/ }) 78 /************************************************************************/ 79 /******/ ([ 80 /* 0 */ 81 /***/ function(module, exports, __webpack_require__) { 82 83 'use strict'; 84 85 var _interopRequireDefault = __webpack_require__(1)['default']; 86 87 exports.__esModule = true; 88 89 var _handlebarsRuntime = __webpack_require__(2); 90 91 var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); 92 93 // Compiler imports 94 95 var _handlebarsCompilerAst = __webpack_require__(21); 96 97 var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); 98 99 var _handlebarsCompilerBase = __webpack_require__(22); 100 101 var _handlebarsCompilerCompiler = __webpack_require__(27); 102 103 var _handlebarsCompilerJavascriptCompiler = __webpack_require__(28); 104 105 var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); 106 107 var _handlebarsCompilerVisitor = __webpack_require__(25); 108 109 var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); 110 111 var _handlebarsNoConflict = __webpack_require__(20); 112 113 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 114 115 var _create = _handlebarsRuntime2['default'].create; 116 function create() { 117 var hb = _create(); 118 119 hb.compile = function (input, options) { 120 return _handlebarsCompilerCompiler.compile(input, options, hb); 121 }; 122 hb.precompile = function (input, options) { 123 return _handlebarsCompilerCompiler.precompile(input, options, hb); 124 }; 125 126 hb.AST = _handlebarsCompilerAst2['default']; 127 hb.Compiler = _handlebarsCompilerCompiler.Compiler; 128 hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; 129 hb.Parser = _handlebarsCompilerBase.parser; 130 hb.parse = _handlebarsCompilerBase.parse; 131 132 return hb; 133 } 134 135 var inst = create(); 136 inst.create = create; 137 138 _handlebarsNoConflict2['default'](inst); 139 140 inst.Visitor = _handlebarsCompilerVisitor2['default']; 141 142 inst['default'] = inst; 143 144 exports['default'] = inst; 145 module.exports = exports['default']; 146 147 /***/ }, 148 /* 1 */ 149 /***/ function(module, exports) { 150 151 "use strict"; 152 153 exports["default"] = function (obj) { 154 return obj && obj.__esModule ? obj : { 155 "default": obj 156 }; 157 }; 158 159 exports.__esModule = true; 160 161 /***/ }, 162 /* 2 */ 163 /***/ function(module, exports, __webpack_require__) { 164 165 'use strict'; 166 167 var _interopRequireWildcard = __webpack_require__(3)['default']; 168 169 var _interopRequireDefault = __webpack_require__(1)['default']; 170 171 exports.__esModule = true; 172 173 var _handlebarsBase = __webpack_require__(4); 174 175 var base = _interopRequireWildcard(_handlebarsBase); 176 177 // Each of these augment the Handlebars object. No need to setup here. 178 // (This is done to easily share code between commonjs and browse envs) 179 180 var _handlebarsSafeString = __webpack_require__(18); 181 182 var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); 183 184 var _handlebarsException = __webpack_require__(6); 185 186 var _handlebarsException2 = _interopRequireDefault(_handlebarsException); 187 188 var _handlebarsUtils = __webpack_require__(5); 189 190 var Utils = _interopRequireWildcard(_handlebarsUtils); 191 192 var _handlebarsRuntime = __webpack_require__(19); 193 194 var runtime = _interopRequireWildcard(_handlebarsRuntime); 195 196 var _handlebarsNoConflict = __webpack_require__(20); 197 198 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 199 200 // For compatibility and usage outside of module systems, make the Handlebars object a namespace 201 function create() { 202 var hb = new base.HandlebarsEnvironment(); 203 204 Utils.extend(hb, base); 205 hb.SafeString = _handlebarsSafeString2['default']; 206 hb.Exception = _handlebarsException2['default']; 207 hb.Utils = Utils; 208 hb.escapeExpression = Utils.escapeExpression; 209 210 hb.VM = runtime; 211 hb.template = function (spec) { 212 return runtime.template(spec, hb); 213 }; 214 215 return hb; 216 } 217 218 var inst = create(); 219 inst.create = create; 220 221 _handlebarsNoConflict2['default'](inst); 222 223 inst['default'] = inst; 224 225 exports['default'] = inst; 226 module.exports = exports['default']; 227 228 /***/ }, 229 /* 3 */ 230 /***/ function(module, exports) { 231 232 "use strict"; 233 234 exports["default"] = function (obj) { 235 if (obj && obj.__esModule) { 236 return obj; 237 } else { 238 var newObj = {}; 239 240 if (obj != null) { 241 for (var key in obj) { 242 if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; 243 } 244 } 245 246 newObj["default"] = obj; 247 return newObj; 248 } 249 }; 250 251 exports.__esModule = true; 252 253 /***/ }, 254 /* 4 */ 255 /***/ function(module, exports, __webpack_require__) { 256 257 'use strict'; 258 259 var _interopRequireDefault = __webpack_require__(1)['default']; 260 261 exports.__esModule = true; 262 exports.HandlebarsEnvironment = HandlebarsEnvironment; 263 264 var _utils = __webpack_require__(5); 265 266 var _exception = __webpack_require__(6); 267 268 var _exception2 = _interopRequireDefault(_exception); 269 270 var _helpers = __webpack_require__(7); 271 272 var _decorators = __webpack_require__(15); 273 274 var _logger = __webpack_require__(17); 275 276 var _logger2 = _interopRequireDefault(_logger); 277 278 var VERSION = '4.0.5'; 279 exports.VERSION = VERSION; 280 var COMPILER_REVISION = 7; 281 282 exports.COMPILER_REVISION = COMPILER_REVISION; 283 var REVISION_CHANGES = { 284 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 285 2: '== 1.0.0-rc.3', 286 3: '== 1.0.0-rc.4', 287 4: '== 1.x.x', 288 5: '== 2.0.0-alpha.x', 289 6: '>= 2.0.0-beta.1', 290 7: '>= 4.0.0' 291 }; 292 293 exports.REVISION_CHANGES = REVISION_CHANGES; 294 var objectType = '[object Object]'; 295 296 function HandlebarsEnvironment(helpers, partials, decorators) { 297 this.helpers = helpers || {}; 298 this.partials = partials || {}; 299 this.decorators = decorators || {}; 300 301 _helpers.registerDefaultHelpers(this); 302 _decorators.registerDefaultDecorators(this); 303 } 304 305 HandlebarsEnvironment.prototype = { 306 constructor: HandlebarsEnvironment, 307 308 logger: _logger2['default'], 309 log: _logger2['default'].log, 310 311 registerHelper: function registerHelper(name, fn) { 312 if (_utils.toString.call(name) === objectType) { 313 if (fn) { 314 throw new _exception2['default']('Arg not supported with multiple helpers'); 315 } 316 _utils.extend(this.helpers, name); 317 } else { 318 this.helpers[name] = fn; 319 } 320 }, 321 unregisterHelper: function unregisterHelper(name) { 322 delete this.helpers[name]; 323 }, 324 325 registerPartial: function registerPartial(name, partial) { 326 if (_utils.toString.call(name) === objectType) { 327 _utils.extend(this.partials, name); 328 } else { 329 if (typeof partial === 'undefined') { 330 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); 331 } 332 this.partials[name] = partial; 333 } 334 }, 335 unregisterPartial: function unregisterPartial(name) { 336 delete this.partials[name]; 337 }, 338 339 registerDecorator: function registerDecorator(name, fn) { 340 if (_utils.toString.call(name) === objectType) { 341 if (fn) { 342 throw new _exception2['default']('Arg not supported with multiple decorators'); 343 } 344 _utils.extend(this.decorators, name); 345 } else { 346 this.decorators[name] = fn; 347 } 348 }, 349 unregisterDecorator: function unregisterDecorator(name) { 350 delete this.decorators[name]; 351 } 352 }; 353 354 var log = _logger2['default'].log; 355 356 exports.log = log; 357 exports.createFrame = _utils.createFrame; 358 exports.logger = _logger2['default']; 359 360 /***/ }, 361 /* 5 */ 362 /***/ function(module, exports) { 363 364 'use strict'; 365 366 exports.__esModule = true; 367 exports.extend = extend; 368 exports.indexOf = indexOf; 369 exports.escapeExpression = escapeExpression; 370 exports.isEmpty = isEmpty; 371 exports.createFrame = createFrame; 372 exports.blockParams = blockParams; 373 exports.appendContextPath = appendContextPath; 374 var escape = { 375 '&': '&', 376 '<': '<', 377 '>': '>', 378 '"': '"', 379 "'": ''', 380 '`': '`', 381 '=': '=' 382 }; 383 384 var badChars = /[&<>"'`=]/g, 385 possible = /[&<>"'`=]/; 386 387 function escapeChar(chr) { 388 return escape[chr]; 389 } 390 391 function extend(obj /* , ...source */) { 392 for (var i = 1; i < arguments.length; i++) { 393 for (var key in arguments[i]) { 394 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { 395 obj[key] = arguments[i][key]; 396 } 397 } 398 } 399 400 return obj; 401 } 402 403 var toString = Object.prototype.toString; 404 405 exports.toString = toString; 406 // Sourced from lodash 407 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 408 /* eslint-disable func-style */ 409 var isFunction = function isFunction(value) { 410 return typeof value === 'function'; 411 }; 412 // fallback for older versions of Chrome and Safari 413 /* istanbul ignore next */ 414 if (isFunction(/x/)) { 415 exports.isFunction = isFunction = function (value) { 416 return typeof value === 'function' && toString.call(value) === '[object Function]'; 417 }; 418 } 419 exports.isFunction = isFunction; 420 421 /* eslint-enable func-style */ 422 423 /* istanbul ignore next */ 424 var isArray = Array.isArray || function (value) { 425 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; 426 }; 427 428 exports.isArray = isArray; 429 // Older IE versions do not directly support indexOf so we must implement our own, sadly. 430 431 function indexOf(array, value) { 432 for (var i = 0, len = array.length; i < len; i++) { 433 if (array[i] === value) { 434 return i; 435 } 436 } 437 return -1; 438 } 439 440 function escapeExpression(string) { 441 if (typeof string !== 'string') { 442 // don't escape SafeStrings, since they're already safe 443 if (string && string.toHTML) { 444 return string.toHTML(); 445 } else if (string == null) { 446 return ''; 447 } else if (!string) { 448 return string + ''; 449 } 450 451 // Force a string conversion as this will be done by the append regardless and 452 // the regex test will do this transparently behind the scenes, causing issues if 453 // an object's to string has escaped characters in it. 454 string = '' + string; 455 } 456 457 if (!possible.test(string)) { 458 return string; 459 } 460 return string.replace(badChars, escapeChar); 461 } 462 463 function isEmpty(value) { 464 if (!value && value !== 0) { 465 return true; 466 } else if (isArray(value) && value.length === 0) { 467 return true; 468 } else { 469 return false; 470 } 471 } 472 473 function createFrame(object) { 474 var frame = extend({}, object); 475 frame._parent = object; 476 return frame; 477 } 478 479 function blockParams(params, ids) { 480 params.path = ids; 481 return params; 482 } 483 484 function appendContextPath(contextPath, id) { 485 return (contextPath ? contextPath + '.' : '') + id; 486 } 487 488 /***/ }, 489 /* 6 */ 490 /***/ function(module, exports) { 491 492 'use strict'; 493 494 exports.__esModule = true; 495 496 var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; 497 498 function Exception(message, node) { 499 var loc = node && node.loc, 500 line = undefined, 501 column = undefined; 502 if (loc) { 503 line = loc.start.line; 504 column = loc.start.column; 505 506 message += ' - ' + line + ':' + column; 507 } 508 509 var tmp = Error.prototype.constructor.call(this, message); 510 511 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 512 for (var idx = 0; idx < errorProps.length; idx++) { 513 this[errorProps[idx]] = tmp[errorProps[idx]]; 514 } 515 516 /* istanbul ignore else */ 517 if (Error.captureStackTrace) { 518 Error.captureStackTrace(this, Exception); 519 } 520 521 if (loc) { 522 this.lineNumber = line; 523 this.column = column; 524 } 525 } 526 527 Exception.prototype = new Error(); 528 529 exports['default'] = Exception; 530 module.exports = exports['default']; 531 532 /***/ }, 533 /* 7 */ 534 /***/ function(module, exports, __webpack_require__) { 535 536 'use strict'; 537 538 var _interopRequireDefault = __webpack_require__(1)['default']; 539 540 exports.__esModule = true; 541 exports.registerDefaultHelpers = registerDefaultHelpers; 542 543 var _helpersBlockHelperMissing = __webpack_require__(8); 544 545 var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); 546 547 var _helpersEach = __webpack_require__(9); 548 549 var _helpersEach2 = _interopRequireDefault(_helpersEach); 550 551 var _helpersHelperMissing = __webpack_require__(10); 552 553 var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); 554 555 var _helpersIf = __webpack_require__(11); 556 557 var _helpersIf2 = _interopRequireDefault(_helpersIf); 558 559 var _helpersLog = __webpack_require__(12); 560 561 var _helpersLog2 = _interopRequireDefault(_helpersLog); 562 563 var _helpersLookup = __webpack_require__(13); 564 565 var _helpersLookup2 = _interopRequireDefault(_helpersLookup); 566 567 var _helpersWith = __webpack_require__(14); 568 569 var _helpersWith2 = _interopRequireDefault(_helpersWith); 570 571 function registerDefaultHelpers(instance) { 572 _helpersBlockHelperMissing2['default'](instance); 573 _helpersEach2['default'](instance); 574 _helpersHelperMissing2['default'](instance); 575 _helpersIf2['default'](instance); 576 _helpersLog2['default'](instance); 577 _helpersLookup2['default'](instance); 578 _helpersWith2['default'](instance); 579 } 580 581 /***/ }, 582 /* 8 */ 583 /***/ function(module, exports, __webpack_require__) { 584 585 'use strict'; 586 587 exports.__esModule = true; 588 589 var _utils = __webpack_require__(5); 590 591 exports['default'] = function (instance) { 592 instance.registerHelper('blockHelperMissing', function (context, options) { 593 var inverse = options.inverse, 594 fn = options.fn; 595 596 if (context === true) { 597 return fn(this); 598 } else if (context === false || context == null) { 599 return inverse(this); 600 } else if (_utils.isArray(context)) { 601 if (context.length > 0) { 602 if (options.ids) { 603 options.ids = [options.name]; 604 } 605 606 return instance.helpers.each(context, options); 607 } else { 608 return inverse(this); 609 } 610 } else { 611 if (options.data && options.ids) { 612 var data = _utils.createFrame(options.data); 613 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); 614 options = { data: data }; 615 } 616 617 return fn(context, options); 618 } 619 }); 620 }; 621 622 module.exports = exports['default']; 623 624 /***/ }, 625 /* 9 */ 626 /***/ function(module, exports, __webpack_require__) { 627 628 'use strict'; 629 630 var _interopRequireDefault = __webpack_require__(1)['default']; 631 632 exports.__esModule = true; 633 634 var _utils = __webpack_require__(5); 635 636 var _exception = __webpack_require__(6); 637 638 var _exception2 = _interopRequireDefault(_exception); 639 640 exports['default'] = function (instance) { 641 instance.registerHelper('each', function (context, options) { 642 if (!options) { 643 throw new _exception2['default']('Must pass iterator to #each'); 644 } 645 646 var fn = options.fn, 647 inverse = options.inverse, 648 i = 0, 649 ret = '', 650 data = undefined, 651 contextPath = undefined; 652 653 if (options.data && options.ids) { 654 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; 655 } 656 657 if (_utils.isFunction(context)) { 658 context = context.call(this); 659 } 660 661 if (options.data) { 662 data = _utils.createFrame(options.data); 663 } 664 665 function execIteration(field, index, last) { 666 if (data) { 667 data.key = field; 668 data.index = index; 669 data.first = index === 0; 670 data.last = !!last; 671 672 if (contextPath) { 673 data.contextPath = contextPath + field; 674 } 675 } 676 677 ret = ret + fn(context[field], { 678 data: data, 679 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) 680 }); 681 } 682 683 if (context && typeof context === 'object') { 684 if (_utils.isArray(context)) { 685 for (var j = context.length; i < j; i++) { 686 if (i in context) { 687 execIteration(i, i, i === context.length - 1); 688 } 689 } 690 } else { 691 var priorKey = undefined; 692 693 for (var key in context) { 694 if (context.hasOwnProperty(key)) { 695 // We're running the iterations one step out of sync so we can detect 696 // the last iteration without have to scan the object twice and create 697 // an itermediate keys array. 698 if (priorKey !== undefined) { 699 execIteration(priorKey, i - 1); 700 } 701 priorKey = key; 702 i++; 703 } 704 } 705 if (priorKey !== undefined) { 706 execIteration(priorKey, i - 1, true); 707 } 708 } 709 } 710 711 if (i === 0) { 712 ret = inverse(this); 713 } 714 715 return ret; 716 }); 717 }; 718 719 module.exports = exports['default']; 720 721 /***/ }, 722 /* 10 */ 723 /***/ function(module, exports, __webpack_require__) { 724 725 'use strict'; 726 727 var _interopRequireDefault = __webpack_require__(1)['default']; 728 729 exports.__esModule = true; 730 731 var _exception = __webpack_require__(6); 732 733 var _exception2 = _interopRequireDefault(_exception); 734 735 exports['default'] = function (instance) { 736 instance.registerHelper('helperMissing', function () /* [args, ]options */{ 737 if (arguments.length === 1) { 738 // A missing field in a {{foo}} construct. 739 return undefined; 740 } else { 741 // Someone is actually trying to call something, blow up. 742 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); 743 } 744 }); 745 }; 746 747 module.exports = exports['default']; 748 749 /***/ }, 750 /* 11 */ 751 /***/ function(module, exports, __webpack_require__) { 752 753 'use strict'; 754 755 exports.__esModule = true; 756 757 var _utils = __webpack_require__(5); 758 759 exports['default'] = function (instance) { 760 instance.registerHelper('if', function (conditional, options) { 761 if (_utils.isFunction(conditional)) { 762 conditional = conditional.call(this); 763 } 764 765 // Default behavior is to render the positive path if the value is truthy and not empty. 766 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 767 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 768 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { 769 return options.inverse(this); 770 } else { 771 return options.fn(this); 772 } 773 }); 774 775 instance.registerHelper('unless', function (conditional, options) { 776 return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); 777 }); 778 }; 779 780 module.exports = exports['default']; 781 782 /***/ }, 783 /* 12 */ 784 /***/ function(module, exports) { 785 786 'use strict'; 787 788 exports.__esModule = true; 789 790 exports['default'] = function (instance) { 791 instance.registerHelper('log', function () /* message, options */{ 792 var args = [undefined], 793 options = arguments[arguments.length - 1]; 794 for (var i = 0; i < arguments.length - 1; i++) { 795 args.push(arguments[i]); 796 } 797 798 var level = 1; 799 if (options.hash.level != null) { 800 level = options.hash.level; 801 } else if (options.data && options.data.level != null) { 802 level = options.data.level; 803 } 804 args[0] = level; 805 806 instance.log.apply(instance, args); 807 }); 808 }; 809 810 module.exports = exports['default']; 811 812 /***/ }, 813 /* 13 */ 814 /***/ function(module, exports) { 815 816 'use strict'; 817 818 exports.__esModule = true; 819 820 exports['default'] = function (instance) { 821 instance.registerHelper('lookup', function (obj, field) { 822 return obj && obj[field]; 823 }); 824 }; 825 826 module.exports = exports['default']; 827 828 /***/ }, 829 /* 14 */ 830 /***/ function(module, exports, __webpack_require__) { 831 832 'use strict'; 833 834 exports.__esModule = true; 835 836 var _utils = __webpack_require__(5); 837 838 exports['default'] = function (instance) { 839 instance.registerHelper('with', function (context, options) { 840 if (_utils.isFunction(context)) { 841 context = context.call(this); 842 } 843 844 var fn = options.fn; 845 846 if (!_utils.isEmpty(context)) { 847 var data = options.data; 848 if (options.data && options.ids) { 849 data = _utils.createFrame(options.data); 850 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); 851 } 852 853 return fn(context, { 854 data: data, 855 blockParams: _utils.blockParams([context], [data && data.contextPath]) 856 }); 857 } else { 858 return options.inverse(this); 859 } 860 }); 861 }; 862 863 module.exports = exports['default']; 864 865 /***/ }, 866 /* 15 */ 867 /***/ function(module, exports, __webpack_require__) { 868 869 'use strict'; 870 871 var _interopRequireDefault = __webpack_require__(1)['default']; 872 873 exports.__esModule = true; 874 exports.registerDefaultDecorators = registerDefaultDecorators; 875 876 var _decoratorsInline = __webpack_require__(16); 877 878 var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); 879 880 function registerDefaultDecorators(instance) { 881 _decoratorsInline2['default'](instance); 882 } 883 884 /***/ }, 885 /* 16 */ 886 /***/ function(module, exports, __webpack_require__) { 887 888 'use strict'; 889 890 exports.__esModule = true; 891 892 var _utils = __webpack_require__(5); 893 894 exports['default'] = function (instance) { 895 instance.registerDecorator('inline', function (fn, props, container, options) { 896 var ret = fn; 897 if (!props.partials) { 898 props.partials = {}; 899 ret = function (context, options) { 900 // Create a new partials stack frame prior to exec. 901 var original = container.partials; 902 container.partials = _utils.extend({}, original, props.partials); 903 var ret = fn(context, options); 904 container.partials = original; 905 return ret; 906 }; 907 } 908 909 props.partials[options.args[0]] = options.fn; 910 911 return ret; 912 }); 913 }; 914 915 module.exports = exports['default']; 916 917 /***/ }, 918 /* 17 */ 919 /***/ function(module, exports, __webpack_require__) { 920 921 'use strict'; 922 923 exports.__esModule = true; 924 925 var _utils = __webpack_require__(5); 926 927 var logger = { 928 methodMap: ['debug', 'info', 'warn', 'error'], 929 level: 'info', 930 931 // Maps a given level value to the `methodMap` indexes above. 932 lookupLevel: function lookupLevel(level) { 933 if (typeof level === 'string') { 934 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); 935 if (levelMap >= 0) { 936 level = levelMap; 937 } else { 938 level = parseInt(level, 10); 939 } 940 } 941 942 return level; 943 }, 944 945 // Can be overridden in the host environment 946 log: function log(level) { 947 level = logger.lookupLevel(level); 948 949 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { 950 var method = logger.methodMap[level]; 951 if (!console[method]) { 952 // eslint-disable-line no-console 953 method = 'log'; 954 } 955 956 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 957 message[_key - 1] = arguments[_key]; 958 } 959 960 console[method].apply(console, message); // eslint-disable-line no-console 961 } 962 } 963 }; 964 965 exports['default'] = logger; 966 module.exports = exports['default']; 967 968 /***/ }, 969 /* 18 */ 970 /***/ function(module, exports) { 971 972 // Build out our basic SafeString type 973 'use strict'; 974 975 exports.__esModule = true; 976 function SafeString(string) { 977 this.string = string; 978 } 979 980 SafeString.prototype.toString = SafeString.prototype.toHTML = function () { 981 return '' + this.string; 982 }; 983 984 exports['default'] = SafeString; 985 module.exports = exports['default']; 986 987 /***/ }, 988 /* 19 */ 989 /***/ function(module, exports, __webpack_require__) { 990 991 'use strict'; 992 993 var _interopRequireWildcard = __webpack_require__(3)['default']; 994 995 var _interopRequireDefault = __webpack_require__(1)['default']; 996 997 exports.__esModule = true; 998 exports.checkRevision = checkRevision; 999 exports.template = template; 1000 exports.wrapProgram = wrapProgram; 1001 exports.resolvePartial = resolvePartial; 1002 exports.invokePartial = invokePartial; 1003 exports.noop = noop; 1004 1005 var _utils = __webpack_require__(5); 1006 1007 var Utils = _interopRequireWildcard(_utils); 1008 1009 var _exception = __webpack_require__(6); 1010 1011 var _exception2 = _interopRequireDefault(_exception); 1012 1013 var _base = __webpack_require__(4); 1014 1015 function checkRevision(compilerInfo) { 1016 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 1017 currentRevision = _base.COMPILER_REVISION; 1018 1019 if (compilerRevision !== currentRevision) { 1020 if (compilerRevision < currentRevision) { 1021 var runtimeVersions = _base.REVISION_CHANGES[currentRevision], 1022 compilerVersions = _base.REVISION_CHANGES[compilerRevision]; 1023 throw new _exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); 1024 } else { 1025 // Use the embedded version info since the runtime doesn't know about this revision yet 1026 throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); 1027 } 1028 } 1029 } 1030 1031 function template(templateSpec, env) { 1032 /* istanbul ignore next */ 1033 if (!env) { 1034 throw new _exception2['default']('No environment passed to template'); 1035 } 1036 if (!templateSpec || !templateSpec.main) { 1037 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); 1038 } 1039 1040 templateSpec.main.decorator = templateSpec.main_d; 1041 1042 // Note: Using env.VM references rather than local var references throughout this section to allow 1043 // for external users to override these as psuedo-supported APIs. 1044 env.VM.checkRevision(templateSpec.compiler); 1045 1046 function invokePartialWrapper(partial, context, options) { 1047 if (options.hash) { 1048 context = Utils.extend({}, context, options.hash); 1049 if (options.ids) { 1050 options.ids[0] = true; 1051 } 1052 } 1053 1054 partial = env.VM.resolvePartial.call(this, partial, context, options); 1055 var result = env.VM.invokePartial.call(this, partial, context, options); 1056 1057 if (result == null && env.compile) { 1058 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); 1059 result = options.partials[options.name](context, options); 1060 } 1061 if (result != null) { 1062 if (options.indent) { 1063 var lines = result.split('\n'); 1064 for (var i = 0, l = lines.length; i < l; i++) { 1065 if (!lines[i] && i + 1 === l) { 1066 break; 1067 } 1068 1069 lines[i] = options.indent + lines[i]; 1070 } 1071 result = lines.join('\n'); 1072 } 1073 return result; 1074 } else { 1075 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); 1076 } 1077 } 1078 1079 // Just add water 1080 var container = { 1081 strict: function strict(obj, name) { 1082 if (!(name in obj)) { 1083 throw new _exception2['default']('"' + name + '" not defined in ' + obj); 1084 } 1085 return obj[name]; 1086 }, 1087 lookup: function lookup(depths, name) { 1088 var len = depths.length; 1089 for (var i = 0; i < len; i++) { 1090 if (depths[i] && depths[i][name] != null) { 1091 return depths[i][name]; 1092 } 1093 } 1094 }, 1095 lambda: function lambda(current, context) { 1096 return typeof current === 'function' ? current.call(context) : current; 1097 }, 1098 1099 escapeExpression: Utils.escapeExpression, 1100 invokePartial: invokePartialWrapper, 1101 1102 fn: function fn(i) { 1103 var ret = templateSpec[i]; 1104 ret.decorator = templateSpec[i + '_d']; 1105 return ret; 1106 }, 1107 1108 programs: [], 1109 program: function program(i, data, declaredBlockParams, blockParams, depths) { 1110 var programWrapper = this.programs[i], 1111 fn = this.fn(i); 1112 if (data || depths || blockParams || declaredBlockParams) { 1113 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); 1114 } else if (!programWrapper) { 1115 programWrapper = this.programs[i] = wrapProgram(this, i, fn); 1116 } 1117 return programWrapper; 1118 }, 1119 1120 data: function data(value, depth) { 1121 while (value && depth--) { 1122 value = value._parent; 1123 } 1124 return value; 1125 }, 1126 merge: function merge(param, common) { 1127 var obj = param || common; 1128 1129 if (param && common && param !== common) { 1130 obj = Utils.extend({}, common, param); 1131 } 1132 1133 return obj; 1134 }, 1135 1136 noop: env.VM.noop, 1137 compilerInfo: templateSpec.compiler 1138 }; 1139 1140 function ret(context) { 1141 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1142 1143 var data = options.data; 1144 1145 ret._setup(options); 1146 if (!options.partial && templateSpec.useData) { 1147 data = initData(context, data); 1148 } 1149 var depths = undefined, 1150 blockParams = templateSpec.useBlockParams ? [] : undefined; 1151 if (templateSpec.useDepths) { 1152 if (options.depths) { 1153 depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; 1154 } else { 1155 depths = [context]; 1156 } 1157 } 1158 1159 function main(context /*, options*/) { 1160 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); 1161 } 1162 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); 1163 return main(context, options); 1164 } 1165 ret.isTop = true; 1166 1167 ret._setup = function (options) { 1168 if (!options.partial) { 1169 container.helpers = container.merge(options.helpers, env.helpers); 1170 1171 if (templateSpec.usePartial) { 1172 container.partials = container.merge(options.partials, env.partials); 1173 } 1174 if (templateSpec.usePartial || templateSpec.useDecorators) { 1175 container.decorators = container.merge(options.decorators, env.decorators); 1176 } 1177 } else { 1178 container.helpers = options.helpers; 1179 container.partials = options.partials; 1180 container.decorators = options.decorators; 1181 } 1182 }; 1183 1184 ret._child = function (i, data, blockParams, depths) { 1185 if (templateSpec.useBlockParams && !blockParams) { 1186 throw new _exception2['default']('must pass block params'); 1187 } 1188 if (templateSpec.useDepths && !depths) { 1189 throw new _exception2['default']('must pass parent depths'); 1190 } 1191 1192 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); 1193 }; 1194 return ret; 1195 } 1196 1197 function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { 1198 function prog(context) { 1199 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1200 1201 var currentDepths = depths; 1202 if (depths && context !== depths[0]) { 1203 currentDepths = [context].concat(depths); 1204 } 1205 1206 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); 1207 } 1208 1209 prog = executeDecorators(fn, prog, container, depths, data, blockParams); 1210 1211 prog.program = i; 1212 prog.depth = depths ? depths.length : 0; 1213 prog.blockParams = declaredBlockParams || 0; 1214 return prog; 1215 } 1216 1217 function resolvePartial(partial, context, options) { 1218 if (!partial) { 1219 if (options.name === '@partial-block') { 1220 partial = options.data['partial-block']; 1221 } else { 1222 partial = options.partials[options.name]; 1223 } 1224 } else if (!partial.call && !options.name) { 1225 // This is a dynamic partial that returned a string 1226 options.name = partial; 1227 partial = options.partials[partial]; 1228 } 1229 return partial; 1230 } 1231 1232 function invokePartial(partial, context, options) { 1233 options.partial = true; 1234 if (options.ids) { 1235 options.data.contextPath = options.ids[0] || options.data.contextPath; 1236 } 1237 1238 var partialBlock = undefined; 1239 if (options.fn && options.fn !== noop) { 1240 options.data = _base.createFrame(options.data); 1241 partialBlock = options.data['partial-block'] = options.fn; 1242 1243 if (partialBlock.partials) { 1244 options.partials = Utils.extend({}, options.partials, partialBlock.partials); 1245 } 1246 } 1247 1248 if (partial === undefined && partialBlock) { 1249 partial = partialBlock; 1250 } 1251 1252 if (partial === undefined) { 1253 throw new _exception2['default']('The partial ' + options.name + ' could not be found'); 1254 } else if (partial instanceof Function) { 1255 return partial(context, options); 1256 } 1257 } 1258 1259 function noop() { 1260 return ''; 1261 } 1262 1263 function initData(context, data) { 1264 if (!data || !('root' in data)) { 1265 data = data ? _base.createFrame(data) : {}; 1266 data.root = context; 1267 } 1268 return data; 1269 } 1270 1271 function executeDecorators(fn, prog, container, depths, data, blockParams) { 1272 if (fn.decorator) { 1273 var props = {}; 1274 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); 1275 Utils.extend(prog, props); 1276 } 1277 return prog; 1278 } 1279 1280 /***/ }, 1281 /* 20 */ 1282 /***/ function(module, exports) { 1283 1284 /* WEBPACK VAR INJECTION */(function(global) {/* global window */ 1285 'use strict'; 1286 1287 exports.__esModule = true; 1288 1289 exports['default'] = function (Handlebars) { 1290 /* istanbul ignore next */ 1291 var root = typeof global !== 'undefined' ? global : window, 1292 $Handlebars = root.Handlebars; 1293 /* istanbul ignore next */ 1294 Handlebars.noConflict = function () { 1295 if (root.Handlebars === Handlebars) { 1296 root.Handlebars = $Handlebars; 1297 } 1298 return Handlebars; 1299 }; 1300 }; 1301 1302 module.exports = exports['default']; 1303 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 1304 1305 /***/ }, 1306 /* 21 */ 1307 /***/ function(module, exports) { 1308 1309 'use strict'; 1310 1311 exports.__esModule = true; 1312 var AST = { 1313 // Public API used to evaluate derived attributes regarding AST nodes 1314 helpers: { 1315 // a mustache is definitely a helper if: 1316 // * it is an eligible helper, and 1317 // * it has at least one parameter or hash segment 1318 helperExpression: function helperExpression(node) { 1319 return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); 1320 }, 1321 1322 scopedId: function scopedId(path) { 1323 return (/^\.|this\b/.test(path.original) 1324 ); 1325 }, 1326 1327 // an ID is simple if it only has one part, and that part is not 1328 // `..` or `this`. 1329 simpleId: function simpleId(path) { 1330 return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; 1331 } 1332 } 1333 }; 1334 1335 // Must be exported as an object rather than the root of the module as the jison lexer 1336 // must modify the object to operate properly. 1337 exports['default'] = AST; 1338 module.exports = exports['default']; 1339 1340 /***/ }, 1341 /* 22 */ 1342 /***/ function(module, exports, __webpack_require__) { 1343 1344 'use strict'; 1345 1346 var _interopRequireDefault = __webpack_require__(1)['default']; 1347 1348 var _interopRequireWildcard = __webpack_require__(3)['default']; 1349 1350 exports.__esModule = true; 1351 exports.parse = parse; 1352 1353 var _parser = __webpack_require__(23); 1354 1355 var _parser2 = _interopRequireDefault(_parser); 1356 1357 var _whitespaceControl = __webpack_require__(24); 1358 1359 var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); 1360 1361 var _helpers = __webpack_require__(26); 1362 1363 var Helpers = _interopRequireWildcard(_helpers); 1364 1365 var _utils = __webpack_require__(5); 1366 1367 exports.parser = _parser2['default']; 1368 1369 var yy = {}; 1370 _utils.extend(yy, Helpers); 1371 1372 function parse(input, options) { 1373 // Just return if an already-compiled AST was passed in. 1374 if (input.type === 'Program') { 1375 return input; 1376 } 1377 1378 _parser2['default'].yy = yy; 1379 1380 // Altering the shared object here, but this is ok as parser is a sync operation 1381 yy.locInfo = function (locInfo) { 1382 return new yy.SourceLocation(options && options.srcName, locInfo); 1383 }; 1384 1385 var strip = new _whitespaceControl2['default'](options); 1386 return strip.accept(_parser2['default'].parse(input)); 1387 } 1388 1389 /***/ }, 1390 /* 23 */ 1391 /***/ function(module, exports) { 1392 1393 /* istanbul ignore next */ 1394 /* Jison generated parser */ 1395 "use strict"; 1396 1397 var handlebars = (function () { 1398 var parser = { trace: function trace() {}, 1399 yy: {}, 1400 symbols_: { "error": 2, "root": 3, "program": 4, "EOF": 5, "program_repetition0": 6, "statement": 7, "mustache": 8, "block": 9, "rawBlock": 10, "partial": 11, "partialBlock": 12, "content": 13, "COMMENT": 14, "CONTENT": 15, "openRawBlock": 16, "rawBlock_repetition_plus0": 17, "END_RAW_BLOCK": 18, "OPEN_RAW_BLOCK": 19, "helperName": 20, "openRawBlock_repetition0": 21, "openRawBlock_option0": 22, "CLOSE_RAW_BLOCK": 23, "openBlock": 24, "block_option0": 25, "closeBlock": 26, "openInverse": 27, "block_option1": 28, "OPEN_BLOCK": 29, "openBlock_repetition0": 30, "openBlock_option0": 31, "openBlock_option1": 32, "CLOSE": 33, "OPEN_INVERSE": 34, "openInverse_repetition0": 35, "openInverse_option0": 36, "openInverse_option1": 37, "openInverseChain": 38, "OPEN_INVERSE_CHAIN": 39, "openInverseChain_repetition0": 40, "openInverseChain_option0": 41, "openInverseChain_option1": 42, "inverseAndProgram": 43, "INVERSE": 44, "inverseChain": 45, "inverseChain_option0": 46, "OPEN_ENDBLOCK": 47, "OPEN": 48, "mustache_repetition0": 49, "mustache_option0": 50, "OPEN_UNESCAPED": 51, "mustache_repetition1": 52, "mustache_option1": 53, "CLOSE_UNESCAPED": 54, "OPEN_PARTIAL": 55, "partialName": 56, "partial_repetition0": 57, "partial_option0": 58, "openPartialBlock": 59, "OPEN_PARTIAL_BLOCK": 60, "openPartialBlock_repetition0": 61, "openPartialBlock_option0": 62, "param": 63, "sexpr": 64, "OPEN_SEXPR": 65, "sexpr_repetition0": 66, "sexpr_option0": 67, "CLOSE_SEXPR": 68, "hash": 69, "hash_repetition_plus0": 70, "hashSegment": 71, "ID": 72, "EQUALS": 73, "blockParams": 74, "OPEN_BLOCK_PARAMS": 75, "blockParams_repetition_plus0": 76, "CLOSE_BLOCK_PARAMS": 77, "path": 78, "dataName": 79, "STRING": 80, "NUMBER": 81, "BOOLEAN": 82, "UNDEFINED": 83, "NULL": 84, "DATA": 85, "pathSegments": 86, "SEP": 87, "$accept": 0, "$end": 1 }, 1401 terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT", 18: "END_RAW_BLOCK", 19: "OPEN_RAW_BLOCK", 23: "CLOSE_RAW_BLOCK", 29: "OPEN_BLOCK", 33: "CLOSE", 34: "OPEN_INVERSE", 39: "OPEN_INVERSE_CHAIN", 44: "INVERSE", 47: "OPEN_ENDBLOCK", 48: "OPEN", 51: "OPEN_UNESCAPED", 54: "CLOSE_UNESCAPED", 55: "OPEN_PARTIAL", 60: "OPEN_PARTIAL_BLOCK", 65: "OPEN_SEXPR", 68: "CLOSE_SEXPR", 72: "ID", 73: "EQUALS", 75: "OPEN_BLOCK_PARAMS", 77: "CLOSE_BLOCK_PARAMS", 80: "STRING", 81: "NUMBER", 82: "BOOLEAN", 83: "UNDEFINED", 84: "NULL", 85: "DATA", 87: "SEP" }, 1402 productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [13, 1], [10, 3], [16, 5], [9, 4], [9, 4], [24, 6], [27, 6], [38, 6], [43, 2], [45, 3], [45, 1], [26, 3], [8, 5], [8, 5], [11, 5], [12, 3], [59, 5], [63, 1], [63, 1], [64, 5], [69, 1], [71, 3], [74, 3], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [20, 1], [56, 1], [56, 1], [79, 2], [78, 1], [86, 3], [86, 1], [6, 0], [6, 2], [17, 1], [17, 2], [21, 0], [21, 2], [22, 0], [22, 1], [25, 0], [25, 1], [28, 0], [28, 1], [30, 0], [30, 2], [31, 0], [31, 1], [32, 0], [32, 1], [35, 0], [35, 2], [36, 0], [36, 1], [37, 0], [37, 1], [40, 0], [40, 2], [41, 0], [41, 1], [42, 0], [42, 1], [46, 0], [46, 1], [49, 0], [49, 2], [50, 0], [50, 1], [52, 0], [52, 2], [53, 0], [53, 1], [57, 0], [57, 2], [58, 0], [58, 1], [61, 0], [61, 2], [62, 0], [62, 1], [66, 0], [66, 2], [67, 0], [67, 1], [70, 1], [70, 2], [76, 1], [76, 2]], 1403 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$ 1404 /**/) { 1405 1406 var $0 = $$.length - 1; 1407 switch (yystate) { 1408 case 1: 1409 return $$[$0 - 1]; 1410 break; 1411 case 2: 1412 this.$ = yy.prepareProgram($$[$0]); 1413 break; 1414 case 3: 1415 this.$ = $$[$0]; 1416 break; 1417 case 4: 1418 this.$ = $$[$0]; 1419 break; 1420 case 5: 1421 this.$ = $$[$0]; 1422 break; 1423 case 6: 1424 this.$ = $$[$0]; 1425 break; 1426 case 7: 1427 this.$ = $$[$0]; 1428 break; 1429 case 8: 1430 this.$ = $$[$0]; 1431 break; 1432 case 9: 1433 this.$ = { 1434 type: 'CommentStatement', 1435 value: yy.stripComment($$[$0]), 1436 strip: yy.stripFlags($$[$0], $$[$0]), 1437 loc: yy.locInfo(this._$) 1438 }; 1439 1440 break; 1441 case 10: 1442 this.$ = { 1443 type: 'ContentStatement', 1444 original: $$[$0], 1445 value: $$[$0], 1446 loc: yy.locInfo(this._$) 1447 }; 1448 1449 break; 1450 case 11: 1451 this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 1452 break; 1453 case 12: 1454 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; 1455 break; 1456 case 13: 1457 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); 1458 break; 1459 case 14: 1460 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); 1461 break; 1462 case 15: 1463 this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1464 break; 1465 case 16: 1466 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1467 break; 1468 case 17: 1469 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1470 break; 1471 case 18: 1472 this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; 1473 break; 1474 case 19: 1475 var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), 1476 program = yy.prepareProgram([inverse], $$[$0 - 1].loc); 1477 program.chained = true; 1478 1479 this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; 1480 1481 break; 1482 case 20: 1483 this.$ = $$[$0]; 1484 break; 1485 case 21: 1486 this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; 1487 break; 1488 case 22: 1489 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 1490 break; 1491 case 23: 1492 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 1493 break; 1494 case 24: 1495 this.$ = { 1496 type: 'PartialStatement', 1497 name: $$[$0 - 3], 1498 params: $$[$0 - 2], 1499 hash: $$[$0 - 1], 1500 indent: '', 1501 strip: yy.stripFlags($$[$0 - 4], $$[$0]), 1502 loc: yy.locInfo(this._$) 1503 }; 1504 1505 break; 1506 case 25: 1507 this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 1508 break; 1509 case 26: 1510 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; 1511 break; 1512 case 27: 1513 this.$ = $$[$0]; 1514 break; 1515 case 28: 1516 this.$ = $$[$0]; 1517 break; 1518 case 29: 1519 this.$ = { 1520 type: 'SubExpression', 1521 path: $$[$0 - 3], 1522 params: $$[$0 - 2], 1523 hash: $$[$0 - 1], 1524 loc: yy.locInfo(this._$) 1525 }; 1526 1527 break; 1528 case 30: 1529 this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; 1530 break; 1531 case 31: 1532 this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; 1533 break; 1534 case 32: 1535 this.$ = yy.id($$[$0 - 1]); 1536 break; 1537 case 33: 1538 this.$ = $$[$0]; 1539 break; 1540 case 34: 1541 this.$ = $$[$0]; 1542 break; 1543 case 35: 1544 this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; 1545 break; 1546 case 36: 1547 this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; 1548 break; 1549 case 37: 1550 this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; 1551 break; 1552 case 38: 1553 this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; 1554 break; 1555 case 39: 1556 this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; 1557 break; 1558 case 40: 1559 this.$ = $$[$0]; 1560 break; 1561 case 41: 1562 this.$ = $$[$0]; 1563 break; 1564 case 42: 1565 this.$ = yy.preparePath(true, $$[$0], this._$); 1566 break; 1567 case 43: 1568 this.$ = yy.preparePath(false, $$[$0], this._$); 1569 break; 1570 case 44: 1571 $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; 1572 break; 1573 case 45: 1574 this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; 1575 break; 1576 case 46: 1577 this.$ = []; 1578 break; 1579 case 47: 1580 $$[$0 - 1].push($$[$0]); 1581 break; 1582 case 48: 1583 this.$ = [$$[$0]]; 1584 break; 1585 case 49: 1586 $$[$0 - 1].push($$[$0]); 1587 break; 1588 case 50: 1589 this.$ = []; 1590 break; 1591 case 51: 1592 $$[$0 - 1].push($$[$0]); 1593 break; 1594 case 58: 1595 this.$ = []; 1596 break; 1597 case 59: 1598 $$[$0 - 1].push($$[$0]); 1599 break; 1600 case 64: 1601 this.$ = []; 1602 break; 1603 case 65: 1604 $$[$0 - 1].push($$[$0]); 1605 break; 1606 case 70: 1607 this.$ = []; 1608 break; 1609 case 71: 1610 $$[$0 - 1].push($$[$0]); 1611 break; 1612 case 78: 1613 this.$ = []; 1614 break; 1615 case 79: 1616 $$[$0 - 1].push($$[$0]); 1617 break; 1618 case 82: 1619 this.$ = []; 1620 break; 1621 case 83: 1622 $$[$0 - 1].push($$[$0]); 1623 break; 1624 case 86: 1625 this.$ = []; 1626 break; 1627 case 87: 1628 $$[$0 - 1].push($$[$0]); 1629 break; 1630 case 90: 1631 this.$ = []; 1632 break; 1633 case 91: 1634 $$[$0 - 1].push($$[$0]); 1635 break; 1636 case 94: 1637 this.$ = []; 1638 break; 1639 case 95: 1640 $$[$0 - 1].push($$[$0]); 1641 break; 1642 case 98: 1643 this.$ = [$$[$0]]; 1644 break; 1645 case 99: 1646 $$[$0 - 1].push($$[$0]); 1647 break; 1648 case 100: 1649 this.$ = [$$[$0]]; 1650 break; 1651 case 101: 1652 $$[$0 - 1].push($$[$0]); 1653 break; 1654 } 1655 }, 1656 table: [{ 3: 1, 4: 2, 5: [2, 46], 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: [1, 12], 15: [1, 20], 16: 17, 19: [1, 23], 24: 15, 27: 16, 29: [1, 21], 34: [1, 22], 39: [2, 2], 44: [2, 2], 47: [2, 2], 48: [1, 13], 51: [1, 14], 55: [1, 18], 59: 19, 60: [1, 24] }, { 1: [2, 1] }, { 5: [2, 47], 14: [2, 47], 15: [2, 47], 19: [2, 47], 29: [2, 47], 34: [2, 47], 39: [2, 47], 44: [2, 47], 47: [2, 47], 48: [2, 47], 51: [2, 47], 55: [2, 47], 60: [2, 47] }, { 5: [2, 3], 14: [2, 3], 15: [2, 3], 19: [2, 3], 29: [2, 3], 34: [2, 3], 39: [2, 3], 44: [2, 3], 47: [2, 3], 48: [2, 3], 51: [2, 3], 55: [2, 3], 60: [2, 3] }, { 5: [2, 4], 14: [2, 4], 15: [2, 4], 19: [2, 4], 29: [2, 4], 34: [2, 4], 39: [2, 4], 44: [2, 4], 47: [2, 4], 48: [2, 4], 51: [2, 4], 55: [2, 4], 60: [2, 4] }, { 5: [2, 5], 14: [2, 5], 15: [2, 5], 19: [2, 5], 29: [2, 5], 34: [2, 5], 39: [2, 5], 44: [2, 5], 47: [2, 5], 48: [2, 5], 51: [2, 5], 55: [2, 5], 60: [2, 5] }, { 5: [2, 6], 14: [2, 6], 15: [2, 6], 19: [2, 6], 29: [2, 6], 34: [2, 6], 39: [2, 6], 44: [2, 6], 47: [2, 6], 48: [2, 6], 51: [2, 6], 55: [2, 6], 60: [2, 6] }, { 5: [2, 7], 14: [2, 7], 15: [2, 7], 19: [2, 7], 29: [2, 7], 34: [2, 7], 39: [2, 7], 44: [2, 7], 47: [2, 7], 48: [2, 7], 51: [2, 7], 55: [2, 7], 60: [2, 7] }, { 5: [2, 8], 14: [2, 8], 15: [2, 8], 19: [2, 8], 29: [2, 8], 34: [2, 8], 39: [2, 8], 44: [2, 8], 47: [2, 8], 48: [2, 8], 51: [2, 8], 55: [2, 8], 60: [2, 8] }, { 5: [2, 9], 14: [2, 9], 15: [2, 9], 19: [2, 9], 29: [2, 9], 34: [2, 9], 39: [2, 9], 44: [2, 9], 47: [2, 9], 48: [2, 9], 51: [2, 9], 55: [2, 9], 60: [2, 9] }, { 20: 25, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 36, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 37, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 4: 38, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 13: 40, 15: [1, 20], 17: 39 }, { 20: 42, 56: 41, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 45, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 5: [2, 10], 14: [2, 10], 15: [2, 10], 18: [2, 10], 19: [2, 10], 29: [2, 10], 34: [2, 10], 39: [2, 10], 44: [2, 10], 47: [2, 10], 48: [2, 10], 51: [2, 10], 55: [2, 10], 60: [2, 10] }, { 20: 46, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 47, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 48, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 42, 56: 49, 64: 43, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [2, 78], 49: 50, 65: [2, 78], 72: [2, 78], 80: [2, 78], 81: [2, 78], 82: [2, 78], 83: [2, 78], 84: [2, 78], 85: [2, 78] }, { 23: [2, 33], 33: [2, 33], 54: [2, 33], 65: [2, 33], 68: [2, 33], 72: [2, 33], 75: [2, 33], 80: [2, 33], 81: [2, 33], 82: [2, 33], 83: [2, 33], 84: [2, 33], 85: [2, 33] }, { 23: [2, 34], 33: [2, 34], 54: [2, 34], 65: [2, 34], 68: [2, 34], 72: [2, 34], 75: [2, 34], 80: [2, 34], 81: [2, 34], 82: [2, 34], 83: [2, 34], 84: [2, 34], 85: [2, 34] }, { 23: [2, 35], 33: [2, 35], 54: [2, 35], 65: [2, 35], 68: [2, 35], 72: [2, 35], 75: [2, 35], 80: [2, 35], 81: [2, 35], 82: [2, 35], 83: [2, 35], 84: [2, 35], 85: [2, 35] }, { 23: [2, 36], 33: [2, 36], 54: [2, 36], 65: [2, 36], 68: [2, 36], 72: [2, 36], 75: [2, 36], 80: [2, 36], 81: [2, 36], 82: [2, 36], 83: [2, 36], 84: [2, 36], 85: [2, 36] }, { 23: [2, 37], 33: [2, 37], 54: [2, 37], 65: [2, 37], 68: [2, 37], 72: [2, 37], 75: [2, 37], 80: [2, 37], 81: [2, 37], 82: [2, 37], 83: [2, 37], 84: [2, 37], 85: [2, 37] }, { 23: [2, 38], 33: [2, 38], 54: [2, 38], 65: [2, 38], 68: [2, 38], 72: [2, 38], 75: [2, 38], 80: [2, 38], 81: [2, 38], 82: [2, 38], 83: [2, 38], 84: [2, 38], 85: [2, 38] }, { 23: [2, 39], 33: [2, 39], 54: [2, 39], 65: [2, 39], 68: [2, 39], 72: [2, 39], 75: [2, 39], 80: [2, 39], 81: [2, 39], 82: [2, 39], 83: [2, 39], 84: [2, 39], 85: [2, 39] }, { 23: [2, 43], 33: [2, 43], 54: [2, 43], 65: [2, 43], 68: [2, 43], 72: [2, 43], 75: [2, 43], 80: [2, 43], 81: [2, 43], 82: [2, 43], 83: [2, 43], 84: [2, 43], 85: [2, 43], 87: [1, 51] }, { 72: [1, 35], 86: 52 }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 52: 53, 54: [2, 82], 65: [2, 82], 72: [2, 82], 80: [2, 82], 81: [2, 82], 82: [2, 82], 83: [2, 82], 84: [2, 82], 85: [2, 82] }, { 25: 54, 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 55, 47: [2, 54] }, { 28: 60, 43: 61, 44: [1, 59], 47: [2, 56] }, { 13: 63, 15: [1, 20], 18: [1, 62] }, { 15: [2, 48], 18: [2, 48] }, { 33: [2, 86], 57: 64, 65: [2, 86], 72: [2, 86], 80: [2, 86], 81: [2, 86], 82: [2, 86], 83: [2, 86], 84: [2, 86], 85: [2, 86] }, { 33: [2, 40], 65: [2, 40], 72: [2, 40], 80: [2, 40], 81: [2, 40], 82: [2, 40], 83: [2, 40], 84: [2, 40], 85: [2, 40] }, { 33: [2, 41], 65: [2, 41], 72: [2, 41], 80: [2, 41], 81: [2, 41], 82: [2, 41], 83: [2, 41], 84: [2, 41], 85: [2, 41] }, { 20: 65, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 66, 47: [1, 67] }, { 30: 68, 33: [2, 58], 65: [2, 58], 72: [2, 58], 75: [2, 58], 80: [2, 58], 81: [2, 58], 82: [2, 58], 83: [2, 58], 84: [2, 58], 85: [2, 58] }, { 33: [2, 64], 35: 69, 65: [2, 64], 72: [2, 64], 75: [2, 64], 80: [2, 64], 81: [2, 64], 82: [2, 64], 83: [2, 64], 84: [2, 64], 85: [2, 64] }, { 21: 70, 23: [2, 50], 65: [2, 50], 72: [2, 50], 80: [2, 50], 81: [2, 50], 82: [2, 50], 83: [2, 50], 84: [2, 50], 85: [2, 50] }, { 33: [2, 90], 61: 71, 65: [2, 90], 72: [2, 90], 80: [2, 90], 81: [2, 90], 82: [2, 90], 83: [2, 90], 84: [2, 90], 85: [2, 90] }, { 20: 75, 33: [2, 80], 50: 72, 63: 73, 64: 76, 65: [1, 44], 69: 74, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 72: [1, 80] }, { 23: [2, 42], 33: [2, 42], 54: [2, 42], 65: [2, 42], 68: [2, 42], 72: [2, 42], 75: [2, 42], 80: [2, 42], 81: [2, 42], 82: [2, 42], 83: [2, 42], 84: [2, 42], 85: [2, 42], 87: [1, 51] }, { 20: 75, 53: 81, 54: [2, 84], 63: 82, 64: 76, 65: [1, 44], 69: 83, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 26: 84, 47: [1, 67] }, { 47: [2, 55] }, { 4: 85, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 39: [2, 46], 44: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 47: [2, 20] }, { 20: 86, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 4: 87, 6: 3, 14: [2, 46], 15: [2, 46], 19: [2, 46], 29: [2, 46], 34: [2, 46], 47: [2, 46], 48: [2, 46], 51: [2, 46], 55: [2, 46], 60: [2, 46] }, { 26: 88, 47: [1, 67] }, { 47: [2, 57] }, { 5: [2, 11], 14: [2, 11], 15: [2, 11], 19: [2, 11], 29: [2, 11], 34: [2, 11], 39: [2, 11], 44: [2, 11], 47: [2, 11], 48: [2, 11], 51: [2, 11], 55: [2, 11], 60: [2, 11] }, { 15: [2, 49], 18: [2, 49] }, { 20: 75, 33: [2, 88], 58: 89, 63: 90, 64: 76, 65: [1, 44], 69: 91, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 65: [2, 94], 66: 92, 68: [2, 94], 72: [2, 94], 80: [2, 94], 81: [2, 94], 82: [2, 94], 83: [2, 94], 84: [2, 94], 85: [2, 94] }, { 5: [2, 25], 14: [2, 25], 15: [2, 25], 19: [2, 25], 29: [2, 25], 34: [2, 25], 39: [2, 25], 44: [2, 25], 47: [2, 25], 48: [2, 25], 51: [2, 25], 55: [2, 25], 60: [2, 25] }, { 20: 93, 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 31: 94, 33: [2, 60], 63: 95, 64: 76, 65: [1, 44], 69: 96, 70: 77, 71: 78, 72: [1, 79], 75: [2, 60], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 66], 36: 97, 63: 98, 64: 76, 65: [1, 44], 69: 99, 70: 77, 71: 78, 72: [1, 79], 75: [2, 66], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 22: 100, 23: [2, 52], 63: 101, 64: 76, 65: [1, 44], 69: 102, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 20: 75, 33: [2, 92], 62: 103, 63: 104, 64: 76, 65: [1, 44], 69: 105, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 106] }, { 33: [2, 79], 65: [2, 79], 72: [2, 79], 80: [2, 79], 81: [2, 79], 82: [2, 79], 83: [2, 79], 84: [2, 79], 85: [2, 79] }, { 33: [2, 81] }, { 23: [2, 27], 33: [2, 27], 54: [2, 27], 65: [2, 27], 68: [2, 27], 72: [2, 27], 75: [2, 27], 80: [2, 27], 81: [2, 27], 82: [2, 27], 83: [2, 27], 84: [2, 27], 85: [2, 27] }, { 23: [2, 28], 33: [2, 28], 54: [2, 28], 65: [2, 28], 68: [2, 28], 72: [2, 28], 75: [2, 28], 80: [2, 28], 81: [2, 28], 82: [2, 28], 83: [2, 28], 84: [2, 28], 85: [2, 28] }, { 23: [2, 30], 33: [2, 30], 54: [2, 30], 68: [2, 30], 71: 107, 72: [1, 108], 75: [2, 30] }, { 23: [2, 98], 33: [2, 98], 54: [2, 98], 68: [2, 98], 72: [2, 98], 75: [2, 98] }, { 23: [2, 45], 33: [2, 45], 54: [2, 45], 65: [2, 45], 68: [2, 45], 72: [2, 45], 73: [1, 109], 75: [2, 45], 80: [2, 45], 81: [2, 45], 82: [2, 45], 83: [2, 45], 84: [2, 45], 85: [2, 45], 87: [2, 45] }, { 23: [2, 44], 33: [2, 44], 54: [2, 44], 65: [2, 44], 68: [2, 44], 72: [2, 44], 75: [2, 44], 80: [2, 44], 81: [2, 44], 82: [2, 44], 83: [2, 44], 84: [2, 44], 85: [2, 44], 87: [2, 44] }, { 54: [1, 110] }, { 54: [2, 83], 65: [2, 83], 72: [2, 83], 80: [2, 83], 81: [2, 83], 82: [2, 83], 83: [2, 83], 84: [2, 83], 85: [2, 83] }, { 54: [2, 85] }, { 5: [2, 13], 14: [2, 13], 15: [2, 13], 19: [2, 13], 29: [2, 13], 34: [2, 13], 39: [2, 13], 44: [2, 13], 47: [2, 13], 48: [2, 13], 51: [2, 13], 55: [2, 13], 60: [2, 13] }, { 38: 56, 39: [1, 58], 43: 57, 44: [1, 59], 45: 112, 46: 111, 47: [2, 76] }, { 33: [2, 70], 40: 113, 65: [2, 70], 72: [2, 70], 75: [2, 70], 80: [2, 70], 81: [2, 70], 82: [2, 70], 83: [2, 70], 84: [2, 70], 85: [2, 70] }, { 47: [2, 18] }, { 5: [2, 14], 14: [2, 14], 15: [2, 14], 19: [2, 14], 29: [2, 14], 34: [2, 14], 39: [2, 14], 44: [2, 14], 47: [2, 14], 48: [2, 14], 51: [2, 14], 55: [2, 14], 60: [2, 14] }, { 33: [1, 114] }, { 33: [2, 87], 65: [2, 87], 72: [2, 87], 80: [2, 87], 81: [2, 87], 82: [2, 87], 83: [2, 87], 84: [2, 87], 85: [2, 87] }, { 33: [2, 89] }, { 20: 75, 63: 116, 64: 76, 65: [1, 44], 67: 115, 68: [2, 96], 69: 117, 70: 77, 71: 78, 72: [1, 79], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 33: [1, 118] }, { 32: 119, 33: [2, 62], 74: 120, 75: [1, 121] }, { 33: [2, 59], 65: [2, 59], 72: [2, 59], 75: [2, 59], 80: [2, 59], 81: [2, 59], 82: [2, 59], 83: [2, 59], 84: [2, 59], 85: [2, 59] }, { 33: [2, 61], 75: [2, 61] }, { 33: [2, 68], 37: 122, 74: 123, 75: [1, 121] }, { 33: [2, 65], 65: [2, 65], 72: [2, 65], 75: [2, 65], 80: [2, 65], 81: [2, 65], 82: [2, 65], 83: [2, 65], 84: [2, 65], 85: [2, 65] }, { 33: [2, 67], 75: [2, 67] }, { 23: [1, 124] }, { 23: [2, 51], 65: [2, 51], 72: [2, 51], 80: [2, 51], 81: [2, 51], 82: [2, 51], 83: [2, 51], 84: [2, 51], 85: [2, 51] }, { 23: [2, 53] }, { 33: [1, 125] }, { 33: [2, 91], 65: [2, 91], 72: [2, 91], 80: [2, 91], 81: [2, 91], 82: [2, 91], 83: [2, 91], 84: [2, 91], 85: [2, 91] }, { 33: [2, 93] }, { 5: [2, 22], 14: [2, 22], 15: [2, 22], 19: [2, 22], 29: [2, 22], 34: [2, 22], 39: [2, 22], 44: [2, 22], 47: [2, 22], 48: [2, 22], 51: [2, 22], 55: [2, 22], 60: [2, 22] }, { 23: [2, 99], 33: [2, 99], 54: [2, 99], 68: [2, 99], 72: [2, 99], 75: [2, 99] }, { 73: [1, 109] }, { 20: 75, 63: 126, 64: 76, 65: [1, 44], 72: [1, 35], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 23], 14: [2, 23], 15: [2, 23], 19: [2, 23], 29: [2, 23], 34: [2, 23], 39: [2, 23], 44: [2, 23], 47: [2, 23], 48: [2, 23], 51: [2, 23], 55: [2, 23], 60: [2, 23] }, { 47: [2, 19] }, { 47: [2, 77] }, { 20: 75, 33: [2, 72], 41: 127, 63: 128, 64: 76, 65: [1, 44], 69: 129, 70: 77, 71: 78, 72: [1, 79], 75: [2, 72], 78: 26, 79: 27, 80: [1, 28], 81: [1, 29], 82: [1, 30], 83: [1, 31], 84: [1, 32], 85: [1, 34], 86: 33 }, { 5: [2, 24], 14: [2, 24], 15: [2, 24], 19: [2, 24], 29: [2, 24], 34: [2, 24], 39: [2, 24], 44: [2, 24], 47: [2, 24], 48: [2, 24], 51: [2, 24], 55: [2, 24], 60: [2, 24] }, { 68: [1, 130] }, { 65: [2, 95], 68: [2, 95], 72: [2, 95], 80: [2, 95], 81: [2, 95], 82: [2, 95], 83: [2, 95], 84: [2, 95], 85: [2, 95] }, { 68: [2, 97] }, { 5: [2, 21], 14: [2, 21], 15: [2, 21], 19: [2, 21], 29: [2, 21], 34: [2, 21], 39: [2, 21], 44: [2, 21], 47: [2, 21], 48: [2, 21], 51: [2, 21], 55: [2, 21], 60: [2, 21] }, { 33: [1, 131] }, { 33: [2, 63] }, { 72: [1, 133], 76: 132 }, { 33: [1, 134] }, { 33: [2, 69] }, { 15: [2, 12] }, { 14: [2, 26], 15: [2, 26], 19: [2, 26], 29: [2, 26], 34: [2, 26], 47: [2, 26], 48: [2, 26], 51: [2, 26], 55: [2, 26], 60: [2, 26] }, { 23: [2, 31], 33: [2, 31], 54: [2, 31], 68: [2, 31], 72: [2, 31], 75: [2, 31] }, { 33: [2, 74], 42: 135, 74: 136, 75: [1, 121] }, { 33: [2, 71], 65: [2, 71], 72: [2, 71], 75: [2, 71], 80: [2, 71], 81: [2, 71], 82: [2, 71], 83: [2, 71], 84: [2, 71], 85: [2, 71] }, { 33: [2, 73], 75: [2, 73] }, { 23: [2, 29], 33: [2, 29], 54: [2, 29], 65: [2, 29], 68: [2, 29], 72: [2, 29], 75: [2, 29], 80: [2, 29], 81: [2, 29], 82: [2, 29], 83: [2, 29], 84: [2, 29], 85: [2, 29] }, { 14: [2, 15], 15: [2, 15], 19: [2, 15], 29: [2, 15], 34: [2, 15], 39: [2, 15], 44: [2, 15], 47: [2, 15], 48: [2, 15], 51: [2, 15], 55: [2, 15], 60: [2, 15] }, { 72: [1, 138], 77: [1, 137] }, { 72: [2, 100], 77: [2, 100] }, { 14: [2, 16], 15: [2, 16], 19: [2, 16], 29: [2, 16], 34: [2, 16], 44: [2, 16], 47: [2, 16], 48: [2, 16], 51: [2, 16], 55: [2, 16], 60: [2, 16] }, { 33: [1, 139] }, { 33: [2, 75] }, { 33: [2, 32] }, { 72: [2, 101], 77: [2, 101] }, { 14: [2, 17], 15: [2, 17], 19: [2, 17], 29: [2, 17], 34: [2, 17], 39: [2, 17], 44: [2, 17], 47: [2, 17], 48: [2, 17], 51: [2, 17], 55: [2, 17], 60: [2, 17] }], 1657 defaultActions: { 4: [2, 1], 55: [2, 55], 57: [2, 20], 61: [2, 57], 74: [2, 81], 83: [2, 85], 87: [2, 18], 91: [2, 89], 102: [2, 53], 105: [2, 93], 111: [2, 19], 112: [2, 77], 117: [2, 97], 120: [2, 63], 123: [2, 69], 124: [2, 12], 136: [2, 75], 137: [2, 32] }, 1658 parseError: function parseError(str, hash) { 1659 throw new Error(str); 1660 }, 1661 parse: function parse(input) { 1662 var self = this, 1663 stack = [0], 1664 vstack = [null], 1665 lstack = [], 1666 table = this.table, 1667 yytext = "", 1668 yylineno = 0, 1669 yyleng = 0, 1670 recovering = 0, 1671 TERROR = 2, 1672 EOF = 1; 1673 this.lexer.setInput(input); 1674 this.lexer.yy = this.yy; 1675 this.yy.lexer = this.lexer; 1676 this.yy.parser = this; 1677 if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; 1678 var yyloc = this.lexer.yylloc; 1679 lstack.push(yyloc); 1680 var ranges = this.lexer.options && this.lexer.options.ranges; 1681 if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; 1682 function popStack(n) { 1683 stack.length = stack.length - 2 * n; 1684 vstack.length = vstack.length - n; 1685 lstack.length = lstack.length - n; 1686 } 1687 function lex() { 1688 var token; 1689 token = self.lexer.lex() || 1; 1690 if (typeof token !== "number") { 1691 token = self.symbols_[token] || token; 1692 } 1693 return token; 1694 } 1695 var symbol, 1696 preErrorSymbol, 1697 state, 1698 action, 1699 a, 1700 r, 1701 yyval = {}, 1702 p, 1703 len, 1704 newState, 1705 expected; 1706 while (true) { 1707 state = stack[stack.length - 1]; 1708 if (this.defaultActions[state]) { 1709 action = this.defaultActions[state]; 1710 } else { 1711 if (symbol === null || typeof symbol == "undefined") { 1712 symbol = lex(); 1713 } 1714 action = table[state] && table[state][symbol]; 1715 } 1716 if (typeof action === "undefined" || !action.length || !action[0]) { 1717 var errStr = ""; 1718 if (!recovering) { 1719 expected = []; 1720 for (p in table[state]) if (this.terminals_[p] && p > 2) { 1721 expected.push("'" + this.terminals_[p] + "'"); 1722 } 1723 if (this.lexer.showPosition) { 1724 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 1725 } else { 1726 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); 1727 } 1728 this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); 1729 } 1730 } 1731 if (action[0] instanceof Array && action.length > 1) { 1732 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 1733 } 1734 switch (action[0]) { 1735 case 1: 1736 stack.push(symbol); 1737 vstack.push(this.lexer.yytext); 1738 lstack.push(this.lexer.yylloc); 1739 stack.push(action[1]); 1740 symbol = null; 1741 if (!preErrorSymbol) { 1742 yyleng = this.lexer.yyleng; 1743 yytext = this.lexer.yytext; 1744 yylineno = this.lexer.yylineno; 1745 yyloc = this.lexer.yylloc; 1746 if (recovering > 0) recovering--; 1747 } else { 1748 symbol = preErrorSymbol; 1749 preErrorSymbol = null; 1750 } 1751 break; 1752 case 2: 1753 len = this.productions_[action[1]][1]; 1754 yyval.$ = vstack[vstack.length - len]; 1755 yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; 1756 if (ranges) { 1757 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 1758 } 1759 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 1760 if (typeof r !== "undefined") { 1761 return r; 1762 } 1763 if (len) { 1764 stack = stack.slice(0, -1 * len * 2); 1765 vstack = vstack.slice(0, -1 * len); 1766 lstack = lstack.slice(0, -1 * len); 1767 } 1768 stack.push(this.productions_[action[1]][0]); 1769 vstack.push(yyval.$); 1770 lstack.push(yyval._$); 1771 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 1772 stack.push(newState); 1773 break; 1774 case 3: 1775 return true; 1776 } 1777 } 1778 return true; 1779 } 1780 }; 1781 /* Jison generated lexer */ 1782 var lexer = (function () { 1783 var lexer = { EOF: 1, 1784 parseError: function parseError(str, hash) { 1785 if (this.yy.parser) { 1786 this.yy.parser.parseError(str, hash); 1787 } else { 1788 throw new Error(str); 1789 } 1790 }, 1791 setInput: function setInput(input) { 1792 this._input = input; 1793 this._more = this._less = this.done = false; 1794 this.yylineno = this.yyleng = 0; 1795 this.yytext = this.matched = this.match = ''; 1796 this.conditionStack = ['INITIAL']; 1797 this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; 1798 if (this.options.ranges) this.yylloc.range = [0, 0]; 1799 this.offset = 0; 1800 return this; 1801 }, 1802 input: function input() { 1803 var ch = this._input[0]; 1804 this.yytext += ch; 1805 this.yyleng++; 1806 this.offset++; 1807 this.match += ch; 1808 this.matched += ch; 1809 var lines = ch.match(/(?:\r\n?|\n).*/g); 1810 if (lines) { 1811 this.yylineno++; 1812 this.yylloc.last_line++; 1813 } else { 1814 this.yylloc.last_column++; 1815 } 1816 if (this.options.ranges) this.yylloc.range[1]++; 1817 1818 this._input = this._input.slice(1); 1819 return ch; 1820 }, 1821 unput: function unput(ch) { 1822 var len = ch.length; 1823 var lines = ch.split(/(?:\r\n?|\n)/g); 1824 1825 this._input = ch + this._input; 1826 this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); 1827 //this.yyleng -= len; 1828 this.offset -= len; 1829 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 1830 this.match = this.match.substr(0, this.match.length - 1); 1831 this.matched = this.matched.substr(0, this.matched.length - 1); 1832 1833 if (lines.length - 1) this.yylineno -= lines.length - 1; 1834 var r = this.yylloc.range; 1835 1836 this.yylloc = { first_line: this.yylloc.first_line, 1837 last_line: this.yylineno + 1, 1838 first_column: this.yylloc.first_column, 1839 last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len 1840 }; 1841 1842 if (this.options.ranges) { 1843 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 1844 } 1845 return this; 1846 }, 1847 more: function more() { 1848 this._more = true; 1849 return this; 1850 }, 1851 less: function less(n) { 1852 this.unput(this.match.slice(n)); 1853 }, 1854 pastInput: function pastInput() { 1855 var past = this.matched.substr(0, this.matched.length - this.match.length); 1856 return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); 1857 }, 1858 upcomingInput: function upcomingInput() { 1859 var next = this.match; 1860 if (next.length < 20) { 1861 next += this._input.substr(0, 20 - next.length); 1862 } 1863 return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 1864 }, 1865 showPosition: function showPosition() { 1866 var pre = this.pastInput(); 1867 var c = new Array(pre.length + 1).join("-"); 1868 return pre + this.upcomingInput() + "\n" + c + "^"; 1869 }, 1870 next: function next() { 1871 if (this.done) { 1872 return this.EOF; 1873 } 1874 if (!this._input) this.done = true; 1875 1876 var token, match, tempMatch, index, col, lines; 1877 if (!this._more) { 1878 this.yytext = ''; 1879 this.match = ''; 1880 } 1881 var rules = this._currentRules(); 1882 for (var i = 0; i < rules.length; i++) { 1883 tempMatch = this._input.match(this.rules[rules[i]]); 1884 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 1885 match = tempMatch; 1886 index = i; 1887 if (!this.options.flex) break; 1888 } 1889 } 1890 if (match) { 1891 lines = match[0].match(/(?:\r\n?|\n).*/g); 1892 if (lines) this.yylineno += lines.length; 1893 this.yylloc = { first_line: this.yylloc.last_line, 1894 last_line: this.yylineno + 1, 1895 first_column: this.yylloc.last_column, 1896 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; 1897 this.yytext += match[0]; 1898 this.match += match[0]; 1899 this.matches = match; 1900 this.yyleng = this.yytext.length; 1901 if (this.options.ranges) { 1902 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 1903 } 1904 this._more = false; 1905 this._input = this._input.slice(match[0].length); 1906 this.matched += match[0]; 1907 token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); 1908 if (this.done && this._input) this.done = false; 1909 if (token) return token;else return; 1910 } 1911 if (this._input === "") { 1912 return this.EOF; 1913 } else { 1914 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); 1915 } 1916 }, 1917 lex: function lex() { 1918 var r = this.next(); 1919 if (typeof r !== 'undefined') { 1920 return r; 1921 } else { 1922 return this.lex(); 1923 } 1924 }, 1925 begin: function begin(condition) { 1926 this.conditionStack.push(condition); 1927 }, 1928 popState: function popState() { 1929 return this.conditionStack.pop(); 1930 }, 1931 _currentRules: function _currentRules() { 1932 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 1933 }, 1934 topState: function topState() { 1935 return this.conditionStack[this.conditionStack.length - 2]; 1936 }, 1937 pushState: function begin(condition) { 1938 this.begin(condition); 1939 } }; 1940 lexer.options = {}; 1941 lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START 1942 /**/) { 1943 1944 function strip(start, end) { 1945 return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); 1946 } 1947 1948 var YYSTATE = YY_START; 1949 switch ($avoiding_name_collisions) { 1950 case 0: 1951 if (yy_.yytext.slice(-2) === "\\\\") { 1952 strip(0, 1); 1953 this.begin("mu"); 1954 } else if (yy_.yytext.slice(-1) === "\\") { 1955 strip(0, 1); 1956 this.begin("emu"); 1957 } else { 1958 this.begin("mu"); 1959 } 1960 if (yy_.yytext) return 15; 1961 1962 break; 1963 case 1: 1964 return 15; 1965 break; 1966 case 2: 1967 this.popState(); 1968 return 15; 1969 1970 break; 1971 case 3: 1972 this.begin('raw');return 15; 1973 break; 1974 case 4: 1975 this.popState(); 1976 // Should be using `this.topState()` below, but it currently 1977 // returns the second top instead of the first top. Opened an 1978 // issue about it at https://github.com/zaach/jison/issues/291 1979 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { 1980 return 15; 1981 } else { 1982 yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9); 1983 return 'END_RAW_BLOCK'; 1984 } 1985 1986 break; 1987 case 5: 1988 return 15; 1989 break; 1990 case 6: 1991 this.popState(); 1992 return 14; 1993 1994 break; 1995 case 7: 1996 return 65; 1997 break; 1998 case 8: 1999 return 68; 2000 break; 2001 case 9: 2002 return 19; 2003 break; 2004 case 10: 2005 this.popState(); 2006 this.begin('raw'); 2007 return 23; 2008 2009 break; 2010 case 11: 2011 return 55; 2012 break; 2013 case 12: 2014 return 60; 2015 break; 2016 case 13: 2017 return 29; 2018 break; 2019 case 14: 2020 return 47; 2021 break; 2022 case 15: 2023 this.popState();return 44; 2024 break; 2025 case 16: 2026 this.popState();return 44; 2027 break; 2028 case 17: 2029 return 34; 2030 break; 2031 case 18: 2032 return 39; 2033 break; 2034 case 19: 2035 return 51; 2036 break; 2037 case 20: 2038 return 48; 2039 break; 2040 case 21: 2041 this.unput(yy_.yytext); 2042 this.popState(); 2043 this.begin('com'); 2044 2045 break; 2046 case 22: 2047 this.popState(); 2048 return 14; 2049 2050 break; 2051 case 23: 2052 return 48; 2053 break; 2054 case 24: 2055 return 73; 2056 break; 2057 case 25: 2058 return 72; 2059 break; 2060 case 26: 2061 return 72; 2062 break; 2063 case 27: 2064 return 87; 2065 break; 2066 case 28: 2067 // ignore whitespace 2068 break; 2069 case 29: 2070 this.popState();return 54; 2071 break; 2072 case 30: 2073 this.popState();return 33; 2074 break; 2075 case 31: 2076 yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; 2077 break; 2078 case 32: 2079 yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; 2080 break; 2081 case 33: 2082 return 85; 2083 break; 2084 case 34: 2085 return 82; 2086 break; 2087 case 35: 2088 return 82; 2089 break; 2090 case 36: 2091 return 83; 2092 break; 2093 case 37: 2094 return 84; 2095 break; 2096 case 38: 2097 return 81; 2098 break; 2099 case 39: 2100 return 75; 2101 break; 2102 case 40: 2103 return 77; 2104 break; 2105 case 41: 2106 return 72; 2107 break; 2108 case 42: 2109 yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; 2110 break; 2111 case 43: 2112 return 'INVALID'; 2113 break; 2114 case 44: 2115 return 5; 2116 break; 2117 } 2118 }; 2119 lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; 2120 lexer.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } }; 2121 return lexer; 2122 })(); 2123 parser.lexer = lexer; 2124 function Parser() { 2125 this.yy = {}; 2126 }Parser.prototype = parser;parser.Parser = Parser; 2127 return new Parser(); 2128 })();exports.__esModule = true; 2129 exports['default'] = handlebars; 2130 2131 /***/ }, 2132 /* 24 */ 2133 /***/ function(module, exports, __webpack_require__) { 2134 2135 'use strict'; 2136 2137 var _interopRequireDefault = __webpack_require__(1)['default']; 2138 2139 exports.__esModule = true; 2140 2141 var _visitor = __webpack_require__(25); 2142 2143 var _visitor2 = _interopRequireDefault(_visitor); 2144 2145 function WhitespaceControl() { 2146 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 2147 2148 this.options = options; 2149 } 2150 WhitespaceControl.prototype = new _visitor2['default'](); 2151 2152 WhitespaceControl.prototype.Program = function (program) { 2153 var doStandalone = !this.options.ignoreStandalone; 2154 2155 var isRoot = !this.isRootSeen; 2156 this.isRootSeen = true; 2157 2158 var body = program.body; 2159 for (var i = 0, l = body.length; i < l; i++) { 2160 var current = body[i], 2161 strip = this.accept(current); 2162 2163 if (!strip) { 2164 continue; 2165 } 2166 2167 var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), 2168 _isNextWhitespace = isNextWhitespace(body, i, isRoot), 2169 openStandalone = strip.openStandalone && _isPrevWhitespace, 2170 closeStandalone = strip.closeStandalone && _isNextWhitespace, 2171 inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; 2172 2173 if (strip.close) { 2174 omitRight(body, i, true); 2175 } 2176 if (strip.open) { 2177 omitLeft(body, i, true); 2178 } 2179 2180 if (doStandalone && inlineStandalone) { 2181 omitRight(body, i); 2182 2183 if (omitLeft(body, i)) { 2184 // If we are on a standalone node, save the indent info for partials 2185 if (current.type === 'PartialStatement') { 2186 // Pull out the whitespace from the final line 2187 current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; 2188 } 2189 } 2190 } 2191 if (doStandalone && openStandalone) { 2192 omitRight((current.program || current.inverse).body); 2193 2194 // Strip out the previous content node if it's whitespace only 2195 omitLeft(body, i); 2196 } 2197 if (doStandalone && closeStandalone) { 2198 // Always strip the next node 2199 omitRight(body, i); 2200 2201 omitLeft((current.inverse || current.program).body); 2202 } 2203 } 2204 2205 return program; 2206 }; 2207 2208 WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { 2209 this.accept(block.program); 2210 this.accept(block.inverse); 2211 2212 // Find the inverse program that is involed with whitespace stripping. 2213 var program = block.program || block.inverse, 2214 inverse = block.program && block.inverse, 2215 firstInverse = inverse, 2216 lastInverse = inverse; 2217 2218 if (inverse && inverse.chained) { 2219 firstInverse = inverse.body[0].program; 2220 2221 // Walk the inverse chain to find the last inverse that is actually in the chain. 2222 while (lastInverse.chained) { 2223 lastInverse = lastInverse.body[lastInverse.body.length - 1].program; 2224 } 2225 } 2226 2227 var strip = { 2228 open: block.openStrip.open, 2229 close: block.closeStrip.close, 2230 2231 // Determine the standalone candiacy. Basically flag our content as being possibly standalone 2232 // so our parent can determine if we actually are standalone 2233 openStandalone: isNextWhitespace(program.body), 2234 closeStandalone: isPrevWhitespace((firstInverse || program).body) 2235 }; 2236 2237 if (block.openStrip.close) { 2238 omitRight(program.body, null, true); 2239 } 2240 2241 if (inverse) { 2242 var inverseStrip = block.inverseStrip; 2243 2244 if (inverseStrip.open) { 2245 omitLeft(program.body, null, true); 2246 } 2247 2248 if (inverseStrip.close) { 2249 omitRight(firstInverse.body, null, true); 2250 } 2251 if (block.closeStrip.open) { 2252 omitLeft(lastInverse.body, null, true); 2253 } 2254 2255 // Find standalone else statments 2256 if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { 2257 omitLeft(program.body); 2258 omitRight(firstInverse.body); 2259 } 2260 } else if (block.closeStrip.open) { 2261 omitLeft(program.body, null, true); 2262 } 2263 2264 return strip; 2265 }; 2266 2267 WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { 2268 return mustache.strip; 2269 }; 2270 2271 WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { 2272 /* istanbul ignore next */ 2273 var strip = node.strip || {}; 2274 return { 2275 inlineStandalone: true, 2276 open: strip.open, 2277 close: strip.close 2278 }; 2279 }; 2280 2281 function isPrevWhitespace(body, i, isRoot) { 2282 if (i === undefined) { 2283 i = body.length; 2284 } 2285 2286 // Nodes that end with newlines are considered whitespace (but are special 2287 // cased for strip operations) 2288 var prev = body[i - 1], 2289 sibling = body[i - 2]; 2290 if (!prev) { 2291 return isRoot; 2292 } 2293 2294 if (prev.type === 'ContentStatement') { 2295 return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); 2296 } 2297 } 2298 function isNextWhitespace(body, i, isRoot) { 2299 if (i === undefined) { 2300 i = -1; 2301 } 2302 2303 var next = body[i + 1], 2304 sibling = body[i + 2]; 2305 if (!next) { 2306 return isRoot; 2307 } 2308 2309 if (next.type === 'ContentStatement') { 2310 return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); 2311 } 2312 } 2313 2314 // Marks the node to the right of the position as omitted. 2315 // I.e. {{foo}}' ' will mark the ' ' node as omitted. 2316 // 2317 // If i is undefined, then the first child will be marked as such. 2318 // 2319 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 2320 // content is met. 2321 function omitRight(body, i, multiple) { 2322 var current = body[i == null ? 0 : i + 1]; 2323 if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { 2324 return; 2325 } 2326 2327 var original = current.value; 2328 current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); 2329 current.rightStripped = current.value !== original; 2330 } 2331 2332 // Marks the node to the left of the position as omitted. 2333 // I.e. ' '{{foo}} will mark the ' ' node as omitted. 2334 // 2335 // If i is undefined then the last child will be marked as such. 2336 // 2337 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 2338 // content is met. 2339 function omitLeft(body, i, multiple) { 2340 var current = body[i == null ? body.length - 1 : i - 1]; 2341 if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { 2342 return; 2343 } 2344 2345 // We omit the last node if it's whitespace only and not preceeded by a non-content node. 2346 var original = current.value; 2347 current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); 2348 current.leftStripped = current.value !== original; 2349 return current.leftStripped; 2350 } 2351 2352 exports['default'] = WhitespaceControl; 2353 module.exports = exports['default']; 2354 2355 /***/ }, 2356 /* 25 */ 2357 /***/ function(module, exports, __webpack_require__) { 2358 2359 'use strict'; 2360 2361 var _interopRequireDefault = __webpack_require__(1)['default']; 2362 2363 exports.__esModule = true; 2364 2365 var _exception = __webpack_require__(6); 2366 2367 var _exception2 = _interopRequireDefault(_exception); 2368 2369 function Visitor() { 2370 this.parents = []; 2371 } 2372 2373 Visitor.prototype = { 2374 constructor: Visitor, 2375 mutating: false, 2376 2377 // Visits a given value. If mutating, will replace the value if necessary. 2378 acceptKey: function acceptKey(node, name) { 2379 var value = this.accept(node[name]); 2380 if (this.mutating) { 2381 // Hacky sanity check: This may have a few false positives for type for the helper 2382 // methods but will generally do the right thing without a lot of overhead. 2383 if (value && !Visitor.prototype[value.type]) { 2384 throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); 2385 } 2386 node[name] = value; 2387 } 2388 }, 2389 2390 // Performs an accept operation with added sanity check to ensure 2391 // required keys are not removed. 2392 acceptRequired: function acceptRequired(node, name) { 2393 this.acceptKey(node, name); 2394 2395 if (!node[name]) { 2396 throw new _exception2['default'](node.type + ' requires ' + name); 2397 } 2398 }, 2399 2400 // Traverses a given array. If mutating, empty respnses will be removed 2401 // for child elements. 2402 acceptArray: function acceptArray(array) { 2403 for (var i = 0, l = array.length; i < l; i++) { 2404 this.acceptKey(array, i); 2405 2406 if (!array[i]) { 2407 array.splice(i, 1); 2408 i--; 2409 l--; 2410 } 2411 } 2412 }, 2413 2414 accept: function accept(object) { 2415 if (!object) { 2416 return; 2417 } 2418 2419 /* istanbul ignore next: Sanity code */ 2420 if (!this[object.type]) { 2421 throw new _exception2['default']('Unknown type: ' + object.type, object); 2422 } 2423 2424 if (this.current) { 2425 this.parents.unshift(this.current); 2426 } 2427 this.current = object; 2428 2429 var ret = this[object.type](object); 2430 2431 this.current = this.parents.shift(); 2432 2433 if (!this.mutating || ret) { 2434 return ret; 2435 } else if (ret !== false) { 2436 return object; 2437 } 2438 }, 2439 2440 Program: function Program(program) { 2441 this.acceptArray(program.body); 2442 }, 2443 2444 MustacheStatement: visitSubExpression, 2445 Decorator: visitSubExpression, 2446 2447 BlockStatement: visitBlock, 2448 DecoratorBlock: visitBlock, 2449 2450 PartialStatement: visitPartial, 2451 PartialBlockStatement: function PartialBlockStatement(partial) { 2452 visitPartial.call(this, partial); 2453 2454 this.acceptKey(partial, 'program'); 2455 }, 2456 2457 ContentStatement: function ContentStatement() /* content */{}, 2458 CommentStatement: function CommentStatement() /* comment */{}, 2459 2460 SubExpression: visitSubExpression, 2461 2462 PathExpression: function PathExpression() /* path */{}, 2463 2464 StringLiteral: function StringLiteral() /* string */{}, 2465 NumberLiteral: function NumberLiteral() /* number */{}, 2466 BooleanLiteral: function BooleanLiteral() /* bool */{}, 2467 UndefinedLiteral: function UndefinedLiteral() /* literal */{}, 2468 NullLiteral: function NullLiteral() /* literal */{}, 2469 2470 Hash: function Hash(hash) { 2471 this.acceptArray(hash.pairs); 2472 }, 2473 HashPair: function HashPair(pair) { 2474 this.acceptRequired(pair, 'value'); 2475 } 2476 }; 2477 2478 function visitSubExpression(mustache) { 2479 this.acceptRequired(mustache, 'path'); 2480 this.acceptArray(mustache.params); 2481 this.acceptKey(mustache, 'hash'); 2482 } 2483 function visitBlock(block) { 2484 visitSubExpression.call(this, block); 2485 2486 this.acceptKey(block, 'program'); 2487 this.acceptKey(block, 'inverse'); 2488 } 2489 function visitPartial(partial) { 2490 this.acceptRequired(partial, 'name'); 2491 this.acceptArray(partial.params); 2492 this.acceptKey(partial, 'hash'); 2493 } 2494 2495 exports['default'] = Visitor; 2496 module.exports = exports['default']; 2497 2498 /***/ }, 2499 /* 26 */ 2500 /***/ function(module, exports, __webpack_require__) { 2501 2502 'use strict'; 2503 2504 var _interopRequireDefault = __webpack_require__(1)['default']; 2505 2506 exports.__esModule = true; 2507 exports.SourceLocation = SourceLocation; 2508 exports.id = id; 2509 exports.stripFlags = stripFlags; 2510 exports.stripComment = stripComment; 2511 exports.preparePath = preparePath; 2512 exports.prepareMustache = prepareMustache; 2513 exports.prepareRawBlock = prepareRawBlock; 2514 exports.prepareBlock = prepareBlock; 2515 exports.prepareProgram = prepareProgram; 2516 exports.preparePartialBlock = preparePartialBlock; 2517 2518 var _exception = __webpack_require__(6); 2519 2520 var _exception2 = _interopRequireDefault(_exception); 2521 2522 function validateClose(open, close) { 2523 close = close.path ? close.path.original : close; 2524 2525 if (open.path.original !== close) { 2526 var errorNode = { loc: open.path.loc }; 2527 2528 throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); 2529 } 2530 } 2531 2532 function SourceLocation(source, locInfo) { 2533 this.source = source; 2534 this.start = { 2535 line: locInfo.first_line, 2536 column: locInfo.first_column 2537 }; 2538 this.end = { 2539 line: locInfo.last_line, 2540 column: locInfo.last_column 2541 }; 2542 } 2543 2544 function id(token) { 2545 if (/^\[.*\]$/.test(token)) { 2546 return token.substr(1, token.length - 2); 2547 } else { 2548 return token; 2549 } 2550 } 2551 2552 function stripFlags(open, close) { 2553 return { 2554 open: open.charAt(2) === '~', 2555 close: close.charAt(close.length - 3) === '~' 2556 }; 2557 } 2558 2559 function stripComment(comment) { 2560 return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, ''); 2561 } 2562 2563 function preparePath(data, parts, loc) { 2564 loc = this.locInfo(loc); 2565 2566 var original = data ? '@' : '', 2567 dig = [], 2568 depth = 0, 2569 depthString = ''; 2570 2571 for (var i = 0, l = parts.length; i < l; i++) { 2572 var part = parts[i].part, 2573 2574 // If we have [] syntax then we do not treat path references as operators, 2575 // i.e. foo.[this] resolves to approximately context.foo['this'] 2576 isLiteral = parts[i].original !== part; 2577 original += (parts[i].separator || '') + part; 2578 2579 if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { 2580 if (dig.length > 0) { 2581 throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); 2582 } else if (part === '..') { 2583 depth++; 2584 depthString += '../'; 2585 } 2586 } else { 2587 dig.push(part); 2588 } 2589 } 2590 2591 return { 2592 type: 'PathExpression', 2593 data: data, 2594 depth: depth, 2595 parts: dig, 2596 original: original, 2597 loc: loc 2598 }; 2599 } 2600 2601 function prepareMustache(path, params, hash, open, strip, locInfo) { 2602 // Must use charAt to support IE pre-10 2603 var escapeFlag = open.charAt(3) || open.charAt(2), 2604 escaped = escapeFlag !== '{' && escapeFlag !== '&'; 2605 2606 var decorator = /\*/.test(open); 2607 return { 2608 type: decorator ? 'Decorator' : 'MustacheStatement', 2609 path: path, 2610 params: params, 2611 hash: hash, 2612 escaped: escaped, 2613 strip: strip, 2614 loc: this.locInfo(locInfo) 2615 }; 2616 } 2617 2618 function prepareRawBlock(openRawBlock, contents, close, locInfo) { 2619 validateClose(openRawBlock, close); 2620 2621 locInfo = this.locInfo(locInfo); 2622 var program = { 2623 type: 'Program', 2624 body: contents, 2625 strip: {}, 2626 loc: locInfo 2627 }; 2628 2629 return { 2630 type: 'BlockStatement', 2631 path: openRawBlock.path, 2632 params: openRawBlock.params, 2633 hash: openRawBlock.hash, 2634 program: program, 2635 openStrip: {}, 2636 inverseStrip: {}, 2637 closeStrip: {}, 2638 loc: locInfo 2639 }; 2640 } 2641 2642 function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { 2643 if (close && close.path) { 2644 validateClose(openBlock, close); 2645 } 2646 2647 var decorator = /\*/.test(openBlock.open); 2648 2649 program.blockParams = openBlock.blockParams; 2650 2651 var inverse = undefined, 2652 inverseStrip = undefined; 2653 2654 if (inverseAndProgram) { 2655 if (decorator) { 2656 throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); 2657 } 2658 2659 if (inverseAndProgram.chain) { 2660 inverseAndProgram.program.body[0].closeStrip = close.strip; 2661 } 2662 2663 inverseStrip = inverseAndProgram.strip; 2664 inverse = inverseAndProgram.program; 2665 } 2666 2667 if (inverted) { 2668 inverted = inverse; 2669 inverse = program; 2670 program = inverted; 2671 } 2672 2673 return { 2674 type: decorator ? 'DecoratorBlock' : 'BlockStatement', 2675 path: openBlock.path, 2676 params: openBlock.params, 2677 hash: openBlock.hash, 2678 program: program, 2679 inverse: inverse, 2680 openStrip: openBlock.strip, 2681 inverseStrip: inverseStrip, 2682 closeStrip: close && close.strip, 2683 loc: this.locInfo(locInfo) 2684 }; 2685 } 2686 2687 function prepareProgram(statements, loc) { 2688 if (!loc && statements.length) { 2689 var firstLoc = statements[0].loc, 2690 lastLoc = statements[statements.length - 1].loc; 2691 2692 /* istanbul ignore else */ 2693 if (firstLoc && lastLoc) { 2694 loc = { 2695 source: firstLoc.source, 2696 start: { 2697 line: firstLoc.start.line, 2698 column: firstLoc.start.column 2699 }, 2700 end: { 2701 line: lastLoc.end.line, 2702 column: lastLoc.end.column 2703 } 2704 }; 2705 } 2706 } 2707 2708 return { 2709 type: 'Program', 2710 body: statements, 2711 strip: {}, 2712 loc: loc 2713 }; 2714 } 2715 2716 function preparePartialBlock(open, program, close, locInfo) { 2717 validateClose(open, close); 2718 2719 return { 2720 type: 'PartialBlockStatement', 2721 name: open.path, 2722 params: open.params, 2723 hash: open.hash, 2724 program: program, 2725 openStrip: open.strip, 2726 closeStrip: close && close.strip, 2727 loc: this.locInfo(locInfo) 2728 }; 2729 } 2730 2731 /***/ }, 2732 /* 27 */ 2733 /***/ function(module, exports, __webpack_require__) { 2734 2735 /* eslint-disable new-cap */ 2736 2737 'use strict'; 2738 2739 var _interopRequireDefault = __webpack_require__(1)['default']; 2740 2741 exports.__esModule = true; 2742 exports.Compiler = Compiler; 2743 exports.precompile = precompile; 2744 exports.compile = compile; 2745 2746 var _exception = __webpack_require__(6); 2747 2748 var _exception2 = _interopRequireDefault(_exception); 2749 2750 var _utils = __webpack_require__(5); 2751 2752 var _ast = __webpack_require__(21); 2753 2754 var _ast2 = _interopRequireDefault(_ast); 2755 2756 var slice = [].slice; 2757 2758 function Compiler() {} 2759 2760 // the foundHelper register will disambiguate helper lookup from finding a 2761 // function in a context. This is necessary for mustache compatibility, which 2762 // requires that context functions in blocks are evaluated by blockHelperMissing, 2763 // and then proceed as if the resulting value was provided to blockHelperMissing. 2764 2765 Compiler.prototype = { 2766 compiler: Compiler, 2767 2768 equals: function equals(other) { 2769 var len = this.opcodes.length; 2770 if (other.opcodes.length !== len) { 2771 return false; 2772 } 2773 2774 for (var i = 0; i < len; i++) { 2775 var opcode = this.opcodes[i], 2776 otherOpcode = other.opcodes[i]; 2777 if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { 2778 return false; 2779 } 2780 } 2781 2782 // We know that length is the same between the two arrays because they are directly tied 2783 // to the opcode behavior above. 2784 len = this.children.length; 2785 for (var i = 0; i < len; i++) { 2786 if (!this.children[i].equals(other.children[i])) { 2787 return false; 2788 } 2789 } 2790 2791 return true; 2792 }, 2793 2794 guid: 0, 2795 2796 compile: function compile(program, options) { 2797 this.sourceNode = []; 2798 this.opcodes = []; 2799 this.children = []; 2800 this.options = options; 2801 this.stringParams = options.stringParams; 2802 this.trackIds = options.trackIds; 2803 2804 options.blockParams = options.blockParams || []; 2805 2806 // These changes will propagate to the other compiler components 2807 var knownHelpers = options.knownHelpers; 2808 options.knownHelpers = { 2809 'helperMissing': true, 2810 'blockHelperMissing': true, 2811 'each': true, 2812 'if': true, 2813 'unless': true, 2814 'with': true, 2815 'log': true, 2816 'lookup': true 2817 }; 2818 if (knownHelpers) { 2819 for (var _name in knownHelpers) { 2820 /* istanbul ignore else */ 2821 if (_name in knownHelpers) { 2822 options.knownHelpers[_name] = knownHelpers[_name]; 2823 } 2824 } 2825 } 2826 2827 return this.accept(program); 2828 }, 2829 2830 compileProgram: function compileProgram(program) { 2831 var childCompiler = new this.compiler(), 2832 // eslint-disable-line new-cap 2833 result = childCompiler.compile(program, this.options), 2834 guid = this.guid++; 2835 2836 this.usePartial = this.usePartial || result.usePartial; 2837 2838 this.children[guid] = result; 2839 this.useDepths = this.useDepths || result.useDepths; 2840 2841 return guid; 2842 }, 2843 2844 accept: function accept(node) { 2845 /* istanbul ignore next: Sanity code */ 2846 if (!this[node.type]) { 2847 throw new _exception2['default']('Unknown type: ' + node.type, node); 2848 } 2849 2850 this.sourceNode.unshift(node); 2851 var ret = this[node.type](node); 2852 this.sourceNode.shift(); 2853 return ret; 2854 }, 2855 2856 Program: function Program(program) { 2857 this.options.blockParams.unshift(program.blockParams); 2858 2859 var body = program.body, 2860 bodyLength = body.length; 2861 for (var i = 0; i < bodyLength; i++) { 2862 this.accept(body[i]); 2863 } 2864 2865 this.options.blockParams.shift(); 2866 2867 this.isSimple = bodyLength === 1; 2868 this.blockParams = program.blockParams ? program.blockParams.length : 0; 2869 2870 return this; 2871 }, 2872 2873 BlockStatement: function BlockStatement(block) { 2874 transformLiteralToPath(block); 2875 2876 var program = block.program, 2877 inverse = block.inverse; 2878 2879 program = program && this.compileProgram(program); 2880 inverse = inverse && this.compileProgram(inverse); 2881 2882 var type = this.classifySexpr(block); 2883 2884 if (type === 'helper') { 2885 this.helperSexpr(block, program, inverse); 2886 } else if (type === 'simple') { 2887 this.simpleSexpr(block); 2888 2889 // now that the simple mustache is resolved, we need to 2890 // evaluate it by executing `blockHelperMissing` 2891 this.opcode('pushProgram', program); 2892 this.opcode('pushProgram', inverse); 2893 this.opcode('emptyHash'); 2894 this.opcode('blockValue', block.path.original); 2895 } else { 2896 this.ambiguousSexpr(block, program, inverse); 2897 2898 // now that the simple mustache is resolved, we need to 2899 // evaluate it by executing `blockHelperMissing` 2900 this.opcode('pushProgram', program); 2901 this.opcode('pushProgram', inverse); 2902 this.opcode('emptyHash'); 2903 this.opcode('ambiguousBlockValue'); 2904 } 2905 2906 this.opcode('append'); 2907 }, 2908 2909 DecoratorBlock: function DecoratorBlock(decorator) { 2910 var program = decorator.program && this.compileProgram(decorator.program); 2911 var params = this.setupFullMustacheParams(decorator, program, undefined), 2912 path = decorator.path; 2913 2914 this.useDecorators = true; 2915 this.opcode('registerDecorator', params.length, path.original); 2916 }, 2917 2918 PartialStatement: function PartialStatement(partial) { 2919 this.usePartial = true; 2920 2921 var program = partial.program; 2922 if (program) { 2923 program = this.compileProgram(partial.program); 2924 } 2925 2926 var params = partial.params; 2927 if (params.length > 1) { 2928 throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); 2929 } else if (!params.length) { 2930 if (this.options.explicitPartialContext) { 2931 this.opcode('pushLiteral', 'undefined'); 2932 } else { 2933 params.push({ type: 'PathExpression', parts: [], depth: 0 }); 2934 } 2935 } 2936 2937 var partialName = partial.name.original, 2938 isDynamic = partial.name.type === 'SubExpression'; 2939 if (isDynamic) { 2940 this.accept(partial.name); 2941 } 2942 2943 this.setupFullMustacheParams(partial, program, undefined, true); 2944 2945 var indent = partial.indent || ''; 2946 if (this.options.preventIndent && indent) { 2947 this.opcode('appendContent', indent); 2948 indent = ''; 2949 } 2950 2951 this.opcode('invokePartial', isDynamic, partialName, indent); 2952 this.opcode('append'); 2953 }, 2954 PartialBlockStatement: function PartialBlockStatement(partialBlock) { 2955 this.PartialStatement(partialBlock); 2956 }, 2957 2958 MustacheStatement: function MustacheStatement(mustache) { 2959 this.SubExpression(mustache); 2960 2961 if (mustache.escaped && !this.options.noEscape) { 2962 this.opcode('appendEscaped'); 2963 } else { 2964 this.opcode('append'); 2965 } 2966 }, 2967 Decorator: function Decorator(decorator) { 2968 this.DecoratorBlock(decorator); 2969 }, 2970 2971 ContentStatement: function ContentStatement(content) { 2972 if (content.value) { 2973 this.opcode('appendContent', content.value); 2974 } 2975 }, 2976 2977 CommentStatement: function CommentStatement() {}, 2978 2979 SubExpression: function SubExpression(sexpr) { 2980 transformLiteralToPath(sexpr); 2981 var type = this.classifySexpr(sexpr); 2982 2983 if (type === 'simple') { 2984 this.simpleSexpr(sexpr); 2985 } else if (type === 'helper') { 2986 this.helperSexpr(sexpr); 2987 } else { 2988 this.ambiguousSexpr(sexpr); 2989 } 2990 }, 2991 ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { 2992 var path = sexpr.path, 2993 name = path.parts[0], 2994 isBlock = program != null || inverse != null; 2995 2996 this.opcode('getContext', path.depth); 2997 2998 this.opcode('pushProgram', program); 2999 this.opcode('pushProgram', inverse); 3000 3001 path.strict = true; 3002 this.accept(path); 3003 3004 this.opcode('invokeAmbiguous', name, isBlock); 3005 }, 3006 3007 simpleSexpr: function simpleSexpr(sexpr) { 3008 var path = sexpr.path; 3009 path.strict = true; 3010 this.accept(path); 3011 this.opcode('resolvePossibleLambda'); 3012 }, 3013 3014 helperSexpr: function helperSexpr(sexpr, program, inverse) { 3015 var params = this.setupFullMustacheParams(sexpr, program, inverse), 3016 path = sexpr.path, 3017 name = path.parts[0]; 3018 3019 if (this.options.knownHelpers[name]) { 3020 this.opcode('invokeKnownHelper', params.length, name); 3021 } else if (this.options.knownHelpersOnly) { 3022 throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); 3023 } else { 3024 path.strict = true; 3025 path.falsy = true; 3026 3027 this.accept(path); 3028 this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); 3029 } 3030 }, 3031 3032 PathExpression: function PathExpression(path) { 3033 this.addDepth(path.depth); 3034 this.opcode('getContext', path.depth); 3035 3036 var name = path.parts[0], 3037 scoped = _ast2['default'].helpers.scopedId(path), 3038 blockParamId = !path.depth && !scoped && this.blockParamIndex(name); 3039 3040 if (blockParamId) { 3041 this.opcode('lookupBlockParam', blockParamId, path.parts); 3042 } else if (!name) { 3043 // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` 3044 this.opcode('pushContext'); 3045 } else if (path.data) { 3046 this.options.data = true; 3047 this.opcode('lookupData', path.depth, path.parts, path.strict); 3048 } else { 3049 this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); 3050 } 3051 }, 3052 3053 StringLiteral: function StringLiteral(string) { 3054 this.opcode('pushString', string.value); 3055 }, 3056 3057 NumberLiteral: function NumberLiteral(number) { 3058 this.opcode('pushLiteral', number.value); 3059 }, 3060 3061 BooleanLiteral: function BooleanLiteral(bool) { 3062 this.opcode('pushLiteral', bool.value); 3063 }, 3064 3065 UndefinedLiteral: function UndefinedLiteral() { 3066 this.opcode('pushLiteral', 'undefined'); 3067 }, 3068 3069 NullLiteral: function NullLiteral() { 3070 this.opcode('pushLiteral', 'null'); 3071 }, 3072 3073 Hash: function Hash(hash) { 3074 var pairs = hash.pairs, 3075 i = 0, 3076 l = pairs.length; 3077 3078 this.opcode('pushHash'); 3079 3080 for (; i < l; i++) { 3081 this.pushParam(pairs[i].value); 3082 } 3083 while (i--) { 3084 this.opcode('assignToHash', pairs[i].key); 3085 } 3086 this.opcode('popHash'); 3087 }, 3088 3089 // HELPERS 3090 opcode: function opcode(name) { 3091 this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); 3092 }, 3093 3094 addDepth: function addDepth(depth) { 3095 if (!depth) { 3096 return; 3097 } 3098 3099 this.useDepths = true; 3100 }, 3101 3102 classifySexpr: function classifySexpr(sexpr) { 3103 var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); 3104 3105 var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); 3106 3107 // a mustache is an eligible helper if: 3108 // * its id is simple (a single part, not `this` or `..`) 3109 var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); 3110 3111 // if a mustache is an eligible helper but not a definite 3112 // helper, it is ambiguous, and will be resolved in a later 3113 // pass or at runtime. 3114 var isEligible = !isBlockParam && (isHelper || isSimple); 3115 3116 // if ambiguous, we can possibly resolve the ambiguity now 3117 // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. 3118 if (isEligible && !isHelper) { 3119 var _name2 = sexpr.path.parts[0], 3120 options = this.options; 3121 3122 if (options.knownHelpers[_name2]) { 3123 isHelper = true; 3124 } else if (options.knownHelpersOnly) { 3125 isEligible = false; 3126 } 3127 } 3128 3129 if (isHelper) { 3130 return 'helper'; 3131 } else if (isEligible) { 3132 return 'ambiguous'; 3133 } else { 3134 return 'simple'; 3135 } 3136 }, 3137 3138 pushParams: function pushParams(params) { 3139 for (var i = 0, l = params.length; i < l; i++) { 3140 this.pushParam(params[i]); 3141 } 3142 }, 3143 3144 pushParam: function pushParam(val) { 3145 var value = val.value != null ? val.value : val.original || ''; 3146 3147 if (this.stringParams) { 3148 if (value.replace) { 3149 value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); 3150 } 3151 3152 if (val.depth) { 3153 this.addDepth(val.depth); 3154 } 3155 this.opcode('getContext', val.depth || 0); 3156 this.opcode('pushStringParam', value, val.type); 3157 3158 if (val.type === 'SubExpression') { 3159 // SubExpressions get evaluated and passed in 3160 // in string params mode. 3161 this.accept(val); 3162 } 3163 } else { 3164 if (this.trackIds) { 3165 var blockParamIndex = undefined; 3166 if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { 3167 blockParamIndex = this.blockParamIndex(val.parts[0]); 3168 } 3169 if (blockParamIndex) { 3170 var blockParamChild = val.parts.slice(1).join('.'); 3171 this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); 3172 } else { 3173 value = val.original || value; 3174 if (value.replace) { 3175 value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); 3176 } 3177 3178 this.opcode('pushId', val.type, value); 3179 } 3180 } 3181 this.accept(val); 3182 } 3183 }, 3184 3185 setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { 3186 var params = sexpr.params; 3187 this.pushParams(params); 3188 3189 this.opcode('pushProgram', program); 3190 this.opcode('pushProgram', inverse); 3191 3192 if (sexpr.hash) { 3193 this.accept(sexpr.hash); 3194 } else { 3195 this.opcode('emptyHash', omitEmpty); 3196 } 3197 3198 return params; 3199 }, 3200 3201 blockParamIndex: function blockParamIndex(name) { 3202 for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { 3203 var blockParams = this.options.blockParams[depth], 3204 param = blockParams && _utils.indexOf(blockParams, name); 3205 if (blockParams && param >= 0) { 3206 return [depth, param]; 3207 } 3208 } 3209 } 3210 }; 3211 3212 function precompile(input, options, env) { 3213 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 3214 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); 3215 } 3216 3217 options = options || {}; 3218 if (!('data' in options)) { 3219 options.data = true; 3220 } 3221 if (options.compat) { 3222 options.useDepths = true; 3223 } 3224 3225 var ast = env.parse(input, options), 3226 environment = new env.Compiler().compile(ast, options); 3227 return new env.JavaScriptCompiler().compile(environment, options); 3228 } 3229 3230 function compile(input, options, env) { 3231 if (options === undefined) options = {}; 3232 3233 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 3234 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); 3235 } 3236 3237 if (!('data' in options)) { 3238 options.data = true; 3239 } 3240 if (options.compat) { 3241 options.useDepths = true; 3242 } 3243 3244 var compiled = undefined; 3245 3246 function compileInput() { 3247 var ast = env.parse(input, options), 3248 environment = new env.Compiler().compile(ast, options), 3249 templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); 3250 return env.template(templateSpec); 3251 } 3252 3253 // Template is only compiled on first use and cached after that point. 3254 function ret(context, execOptions) { 3255 if (!compiled) { 3256 compiled = compileInput(); 3257 } 3258 return compiled.call(this, context, execOptions); 3259 } 3260 ret._setup = function (setupOptions) { 3261 if (!compiled) { 3262 compiled = compileInput(); 3263 } 3264 return compiled._setup(setupOptions); 3265 }; 3266 ret._child = function (i, data, blockParams, depths) { 3267 if (!compiled) { 3268 compiled = compileInput(); 3269 } 3270 return compiled._child(i, data, blockParams, depths); 3271 }; 3272 return ret; 3273 } 3274 3275 function argEquals(a, b) { 3276 if (a === b) { 3277 return true; 3278 } 3279 3280 if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { 3281 for (var i = 0; i < a.length; i++) { 3282 if (!argEquals(a[i], b[i])) { 3283 return false; 3284 } 3285 } 3286 return true; 3287 } 3288 } 3289 3290 function transformLiteralToPath(sexpr) { 3291 if (!sexpr.path.parts) { 3292 var literal = sexpr.path; 3293 // Casting to string here to make false and 0 literal values play nicely with the rest 3294 // of the system. 3295 sexpr.path = { 3296 type: 'PathExpression', 3297 data: false, 3298 depth: 0, 3299 parts: [literal.original + ''], 3300 original: literal.original + '', 3301 loc: literal.loc 3302 }; 3303 } 3304 } 3305 3306 /***/ }, 3307 /* 28 */ 3308 /***/ function(module, exports, __webpack_require__) { 3309 3310 'use strict'; 3311 3312 var _interopRequireDefault = __webpack_require__(1)['default']; 3313 3314 exports.__esModule = true; 3315 3316 var _base = __webpack_require__(4); 3317 3318 var _exception = __webpack_require__(6); 3319 3320 var _exception2 = _interopRequireDefault(_exception); 3321 3322 var _utils = __webpack_require__(5); 3323 3324 var _codeGen = __webpack_require__(29); 3325 3326 var _codeGen2 = _interopRequireDefault(_codeGen); 3327 3328 function Literal(value) { 3329 this.value = value; 3330 } 3331 3332 function JavaScriptCompiler() {} 3333 3334 JavaScriptCompiler.prototype = { 3335 // PUBLIC API: You can override these methods in a subclass to provide 3336 // alternative compiled forms for name lookup and buffering semantics 3337 nameLookup: function nameLookup(parent, name /* , type*/) { 3338 if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { 3339 return [parent, '.', name]; 3340 } else { 3341 return [parent, '[', JSON.stringify(name), ']']; 3342 } 3343 }, 3344 depthedLookup: function depthedLookup(name) { 3345 return [this.aliasable('container.lookup'), '(depths, "', name, '")']; 3346 }, 3347 3348 compilerInfo: function compilerInfo() { 3349 var revision = _base.COMPILER_REVISION, 3350 versions = _base.REVISION_CHANGES[revision]; 3351 return [revision, versions]; 3352 }, 3353 3354 appendToBuffer: function appendToBuffer(source, location, explicit) { 3355 // Force a source as this simplifies the merge logic. 3356 if (!_utils.isArray(source)) { 3357 source = [source]; 3358 } 3359 source = this.source.wrap(source, location); 3360 3361 if (this.environment.isSimple) { 3362 return ['return ', source, ';']; 3363 } else if (explicit) { 3364 // This is a case where the buffer operation occurs as a child of another 3365 // construct, generally braces. We have to explicitly output these buffer 3366 // operations to ensure that the emitted code goes in the correct location. 3367 return ['buffer += ', source, ';']; 3368 } else { 3369 source.appendToBuffer = true; 3370 return source; 3371 } 3372 }, 3373 3374 initializeBuffer: function initializeBuffer() { 3375 return this.quotedString(''); 3376 }, 3377 // END PUBLIC API 3378 3379 compile: function compile(environment, options, context, asObject) { 3380 this.environment = environment; 3381 this.options = options; 3382 this.stringParams = this.options.stringParams; 3383 this.trackIds = this.options.trackIds; 3384 this.precompile = !asObject; 3385 3386 this.name = this.environment.name; 3387 this.isChild = !!context; 3388 this.context = context || { 3389 decorators: [], 3390 programs: [], 3391 environments: [] 3392 }; 3393 3394 this.preamble(); 3395 3396 this.stackSlot = 0; 3397 this.stackVars = []; 3398 this.aliases = {}; 3399 this.registers = { list: [] }; 3400 this.hashes = []; 3401 this.compileStack = []; 3402 this.inlineStack = []; 3403 this.blockParams = []; 3404 3405 this.compileChildren(environment, options); 3406 3407 this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; 3408 this.useBlockParams = this.useBlockParams || environment.useBlockParams; 3409 3410 var opcodes = environment.opcodes, 3411 opcode = undefined, 3412 firstLoc = undefined, 3413 i = undefined, 3414 l = undefined; 3415 3416 for (i = 0, l = opcodes.length; i < l; i++) { 3417 opcode = opcodes[i]; 3418 3419 this.source.currentLocation = opcode.loc; 3420 firstLoc = firstLoc || opcode.loc; 3421 this[opcode.opcode].apply(this, opcode.args); 3422 } 3423 3424 // Flush any trailing content that might be pending. 3425 this.source.currentLocation = firstLoc; 3426 this.pushSource(''); 3427 3428 /* istanbul ignore next */ 3429 if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { 3430 throw new _exception2['default']('Compile completed with content left on stack'); 3431 } 3432 3433 if (!this.decorators.isEmpty()) { 3434 this.useDecorators = true; 3435 3436 this.decorators.prepend('var decorators = container.decorators;\n'); 3437 this.decorators.push('return fn;'); 3438 3439 if (asObject) { 3440 this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); 3441 } else { 3442 this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); 3443 this.decorators.push('}\n'); 3444 this.decorators = this.decorators.merge(); 3445 } 3446 } else { 3447 this.decorators = undefined; 3448 } 3449 3450 var fn = this.createFunctionContext(asObject); 3451 if (!this.isChild) { 3452 var ret = { 3453 compiler: this.compilerInfo(), 3454 main: fn 3455 }; 3456 3457 if (this.decorators) { 3458 ret.main_d = this.decorators; // eslint-disable-line camelcase 3459 ret.useDecorators = true; 3460 } 3461 3462 var _context = this.context; 3463 var programs = _context.programs; 3464 var decorators = _context.decorators; 3465 3466 for (i = 0, l = programs.length; i < l; i++) { 3467 if (programs[i]) { 3468 ret[i] = programs[i]; 3469 if (decorators[i]) { 3470 ret[i + '_d'] = decorators[i]; 3471 ret.useDecorators = true; 3472 } 3473 } 3474 } 3475 3476 if (this.environment.usePartial) { 3477 ret.usePartial = true; 3478 } 3479 if (this.options.data) { 3480 ret.useData = true; 3481 } 3482 if (this.useDepths) { 3483 ret.useDepths = true; 3484 } 3485 if (this.useBlockParams) { 3486 ret.useBlockParams = true; 3487 } 3488 if (this.options.compat) { 3489 ret.compat = true; 3490 } 3491 3492 if (!asObject) { 3493 ret.compiler = JSON.stringify(ret.compiler); 3494 3495 this.source.currentLocation = { start: { line: 1, column: 0 } }; 3496 ret = this.objectLiteral(ret); 3497 3498 if (options.srcName) { 3499 ret = ret.toStringWithSourceMap({ file: options.destName }); 3500 ret.map = ret.map && ret.map.toString(); 3501 } else { 3502 ret = ret.toString(); 3503 } 3504 } else { 3505 ret.compilerOptions = this.options; 3506 } 3507 3508 return ret; 3509 } else { 3510 return fn; 3511 } 3512 }, 3513 3514 preamble: function preamble() { 3515 // track the last context pushed into place to allow skipping the 3516 // getContext opcode when it would be a noop 3517 this.lastContext = 0; 3518 this.source = new _codeGen2['default'](this.options.srcName); 3519 this.decorators = new _codeGen2['default'](this.options.srcName); 3520 }, 3521 3522 createFunctionContext: function createFunctionContext(asObject) { 3523 var varDeclarations = ''; 3524 3525 var locals = this.stackVars.concat(this.registers.list); 3526 if (locals.length > 0) { 3527 varDeclarations += ', ' + locals.join(', '); 3528 } 3529 3530 // Generate minimizer alias mappings 3531 // 3532 // When using true SourceNodes, this will update all references to the given alias 3533 // as the source nodes are reused in situ. For the non-source node compilation mode, 3534 // aliases will not be used, but this case is already being run on the client and 3535 // we aren't concern about minimizing the template size. 3536 var aliasCount = 0; 3537 for (var alias in this.aliases) { 3538 // eslint-disable-line guard-for-in 3539 var node = this.aliases[alias]; 3540 3541 if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { 3542 varDeclarations += ', alias' + ++aliasCount + '=' + alias; 3543 node.children[0] = 'alias' + aliasCount; 3544 } 3545 } 3546 3547 var params = ['container', 'depth0', 'helpers', 'partials', 'data']; 3548 3549 if (this.useBlockParams || this.useDepths) { 3550 params.push('blockParams'); 3551 } 3552 if (this.useDepths) { 3553 params.push('depths'); 3554 } 3555 3556 // Perform a second pass over the output to merge content when possible 3557 var source = this.mergeSource(varDeclarations); 3558 3559 if (asObject) { 3560 params.push(source); 3561 3562 return Function.apply(this, params); 3563 } else { 3564 return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); 3565 } 3566 }, 3567 mergeSource: function mergeSource(varDeclarations) { 3568 var isSimple = this.environment.isSimple, 3569 appendOnly = !this.forceBuffer, 3570 appendFirst = undefined, 3571 sourceSeen = undefined, 3572 bufferStart = undefined, 3573 bufferEnd = undefined; 3574 this.source.each(function (line) { 3575 if (line.appendToBuffer) { 3576 if (bufferStart) { 3577 line.prepend(' + '); 3578 } else { 3579 bufferStart = line; 3580 } 3581 bufferEnd = line; 3582 } else { 3583 if (bufferStart) { 3584 if (!sourceSeen) { 3585 appendFirst = true; 3586 } else { 3587 bufferStart.prepend('buffer += '); 3588 } 3589 bufferEnd.add(';'); 3590 bufferStart = bufferEnd = undefined; 3591 } 3592 3593 sourceSeen = true; 3594 if (!isSimple) { 3595 appendOnly = false; 3596 } 3597 } 3598 }); 3599 3600 if (appendOnly) { 3601 if (bufferStart) { 3602 bufferStart.prepend('return '); 3603 bufferEnd.add(';'); 3604 } else if (!sourceSeen) { 3605 this.source.push('return "";'); 3606 } 3607 } else { 3608 varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); 3609 3610 if (bufferStart) { 3611 bufferStart.prepend('return buffer + '); 3612 bufferEnd.add(';'); 3613 } else { 3614 this.source.push('return buffer;'); 3615 } 3616 } 3617 3618 if (varDeclarations) { 3619 this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); 3620 } 3621 3622 return this.source.merge(); 3623 }, 3624 3625 // [blockValue] 3626 // 3627 // On stack, before: hash, inverse, program, value 3628 // On stack, after: return value of blockHelperMissing 3629 // 3630 // The purpose of this opcode is to take a block of the form 3631 // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and 3632 // replace it on the stack with the result of properly 3633 // invoking blockHelperMissing. 3634 blockValue: function blockValue(name) { 3635 var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), 3636 params = [this.contextName(0)]; 3637 this.setupHelperArgs(name, 0, params); 3638 3639 var blockName = this.popStack(); 3640 params.splice(1, 0, blockName); 3641 3642 this.push(this.source.functionCall(blockHelperMissing, 'call', params)); 3643 }, 3644 3645 // [ambiguousBlockValue] 3646 // 3647 // On stack, before: hash, inverse, program, value 3648 // Compiler value, before: lastHelper=value of last found helper, if any 3649 // On stack, after, if no lastHelper: same as [blockValue] 3650 // On stack, after, if lastHelper: value 3651 ambiguousBlockValue: function ambiguousBlockValue() { 3652 // We're being a bit cheeky and reusing the options value from the prior exec 3653 var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), 3654 params = [this.contextName(0)]; 3655 this.setupHelperArgs('', 0, params, true); 3656 3657 this.flushInline(); 3658 3659 var current = this.topStack(); 3660 params.splice(1, 0, current); 3661 3662 this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); 3663 }, 3664 3665 // [appendContent] 3666 // 3667 // On stack, before: ... 3668 // On stack, after: ... 3669 // 3670 // Appends the string value of `content` to the current buffer 3671 appendContent: function appendContent(content) { 3672 if (this.pendingContent) { 3673 content = this.pendingContent + content; 3674 } else { 3675 this.pendingLocation = this.source.currentLocation; 3676 } 3677 3678 this.pendingContent = content; 3679 }, 3680 3681 // [append] 3682 // 3683 // On stack, before: value, ... 3684 // On stack, after: ... 3685 // 3686 // Coerces `value` to a String and appends it to the current buffer. 3687 // 3688 // If `value` is truthy, or 0, it is coerced into a string and appended 3689 // Otherwise, the empty string is appended 3690 append: function append() { 3691 if (this.isInline()) { 3692 this.replaceStack(function (current) { 3693 return [' != null ? ', current, ' : ""']; 3694 }); 3695 3696 this.pushSource(this.appendToBuffer(this.popStack())); 3697 } else { 3698 var local = this.popStack(); 3699 this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); 3700 if (this.environment.isSimple) { 3701 this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); 3702 } 3703 } 3704 }, 3705 3706 // [appendEscaped] 3707 // 3708 // On stack, before: value, ... 3709 // On stack, after: ... 3710 // 3711 // Escape `value` and append it to the buffer 3712 appendEscaped: function appendEscaped() { 3713 this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); 3714 }, 3715 3716 // [getContext] 3717 // 3718 // On stack, before: ... 3719 // On stack, after: ... 3720 // Compiler value, after: lastContext=depth 3721 // 3722 // Set the value of the `lastContext` compiler value to the depth 3723 getContext: function getContext(depth) { 3724 this.lastContext = depth; 3725 }, 3726 3727 // [pushContext] 3728 // 3729 // On stack, before: ... 3730 // On stack, after: currentContext, ... 3731 // 3732 // Pushes the value of the current context onto the stack. 3733 pushContext: function pushContext() { 3734 this.pushStackLiteral(this.contextName(this.lastContext)); 3735 }, 3736 3737 // [lookupOnContext] 3738 // 3739 // On stack, before: ... 3740 // On stack, after: currentContext[name], ... 3741 // 3742 // Looks up the value of `name` on the current context and pushes 3743 // it onto the stack. 3744 lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { 3745 var i = 0; 3746 3747 if (!scoped && this.options.compat && !this.lastContext) { 3748 // The depthed query is expected to handle the undefined logic for the root level that 3749 // is implemented below, so we evaluate that directly in compat mode 3750 this.push(this.depthedLookup(parts[i++])); 3751 } else { 3752 this.pushContext(); 3753 } 3754 3755 this.resolvePath('context', parts, i, falsy, strict); 3756 }, 3757 3758 // [lookupBlockParam] 3759 // 3760 // On stack, before: ... 3761 // On stack, after: blockParam[name], ... 3762 // 3763 // Looks up the value of `parts` on the given block param and pushes 3764 // it onto the stack. 3765 lookupBlockParam: function lookupBlockParam(blockParamId, parts) { 3766 this.useBlockParams = true; 3767 3768 this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); 3769 this.resolvePath('context', parts, 1); 3770 }, 3771 3772 // [lookupData] 3773 // 3774 // On stack, before: ... 3775 // On stack, after: data, ... 3776 // 3777 // Push the data lookup operator 3778 lookupData: function lookupData(depth, parts, strict) { 3779 if (!depth) { 3780 this.pushStackLiteral('data'); 3781 } else { 3782 this.pushStackLiteral('container.data(data, ' + depth + ')'); 3783 } 3784 3785 this.resolvePath('data', parts, 0, true, strict); 3786 }, 3787 3788 resolvePath: function resolvePath(type, parts, i, falsy, strict) { 3789 // istanbul ignore next 3790 3791 var _this = this; 3792 3793 if (this.options.strict || this.options.assumeObjects) { 3794 this.push(strictLookup(this.options.strict && strict, this, parts, type)); 3795 return; 3796 } 3797 3798 var len = parts.length; 3799 for (; i < len; i++) { 3800 /* eslint-disable no-loop-func */ 3801 this.replaceStack(function (current) { 3802 var lookup = _this.nameLookup(current, parts[i], type); 3803 // We want to ensure that zero and false are handled properly if the context (falsy flag) 3804 // needs to have the special handling for these values. 3805 if (!falsy) { 3806 return [' != null ? ', lookup, ' : ', current]; 3807 } else { 3808 // Otherwise we can use generic falsy handling 3809 return [' && ', lookup]; 3810 } 3811 }); 3812 /* eslint-enable no-loop-func */ 3813 } 3814 }, 3815 3816 // [resolvePossibleLambda] 3817 // 3818 // On stack, before: value, ... 3819 // On stack, after: resolved value, ... 3820 // 3821 // If the `value` is a lambda, replace it on the stack by 3822 // the return value of the lambda 3823 resolvePossibleLambda: function resolvePossibleLambda() { 3824 this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); 3825 }, 3826 3827 // [pushStringParam] 3828 // 3829 // On stack, before: ... 3830 // On stack, after: string, currentContext, ... 3831 // 3832 // This opcode is designed for use in string mode, which 3833 // provides the string value of a parameter along with its 3834 // depth rather than resolving it immediately. 3835 pushStringParam: function pushStringParam(string, type) { 3836 this.pushContext(); 3837 this.pushString(type); 3838 3839 // If it's a subexpression, the string result 3840 // will be pushed after this opcode. 3841 if (type !== 'SubExpression') { 3842 if (typeof string === 'string') { 3843 this.pushString(string); 3844 } else { 3845 this.pushStackLiteral(string); 3846 } 3847 } 3848 }, 3849 3850 emptyHash: function emptyHash(omitEmpty) { 3851 if (this.trackIds) { 3852 this.push('{}'); // hashIds 3853 } 3854 if (this.stringParams) { 3855 this.push('{}'); // hashContexts 3856 this.push('{}'); // hashTypes 3857 } 3858 this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); 3859 }, 3860 pushHash: function pushHash() { 3861 if (this.hash) { 3862 this.hashes.push(this.hash); 3863 } 3864 this.hash = { values: [], types: [], contexts: [], ids: [] }; 3865 }, 3866 popHash: function popHash() { 3867 var hash = this.hash; 3868 this.hash = this.hashes.pop(); 3869 3870 if (this.trackIds) { 3871 this.push(this.objectLiteral(hash.ids)); 3872 } 3873 if (this.stringParams) { 3874 this.push(this.objectLiteral(hash.contexts)); 3875 this.push(this.objectLiteral(hash.types)); 3876 } 3877 3878 this.push(this.objectLiteral(hash.values)); 3879 }, 3880 3881 // [pushString] 3882 // 3883 // On stack, before: ... 3884 // On stack, after: quotedString(string), ... 3885 // 3886 // Push a quoted version of `string` onto the stack 3887 pushString: function pushString(string) { 3888 this.pushStackLiteral(this.quotedString(string)); 3889 }, 3890 3891 // [pushLiteral] 3892 // 3893 // On stack, before: ... 3894 // On stack, after: value, ... 3895 // 3896 // Pushes a value onto the stack. This operation prevents 3897 // the compiler from creating a temporary variable to hold 3898 // it. 3899 pushLiteral: function pushLiteral(value) { 3900 this.pushStackLiteral(value); 3901 }, 3902 3903 // [pushProgram] 3904 // 3905 // On stack, before: ... 3906 // On stack, after: program(guid), ... 3907 // 3908 // Push a program expression onto the stack. This takes 3909 // a compile-time guid and converts it into a runtime-accessible 3910 // expression. 3911 pushProgram: function pushProgram(guid) { 3912 if (guid != null) { 3913 this.pushStackLiteral(this.programExpression(guid)); 3914 } else { 3915 this.pushStackLiteral(null); 3916 } 3917 }, 3918 3919 // [registerDecorator] 3920 // 3921 // On stack, before: hash, program, params..., ... 3922 // On stack, after: ... 3923 // 3924 // Pops off the decorator's parameters, invokes the decorator, 3925 // and inserts the decorator into the decorators list. 3926 registerDecorator: function registerDecorator(paramSize, name) { 3927 var foundDecorator = this.nameLookup('decorators', name, 'decorator'), 3928 options = this.setupHelperArgs(name, paramSize); 3929 3930 this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); 3931 }, 3932 3933 // [invokeHelper] 3934 // 3935 // On stack, before: hash, inverse, program, params..., ... 3936 // On stack, after: result of helper invocation 3937 // 3938 // Pops off the helper's parameters, invokes the helper, 3939 // and pushes the helper's return value onto the stack. 3940 // 3941 // If the helper is not found, `helperMissing` is called. 3942 invokeHelper: function invokeHelper(paramSize, name, isSimple) { 3943 var nonHelper = this.popStack(), 3944 helper = this.setupHelper(paramSize, name), 3945 simple = isSimple ? [helper.name, ' || '] : ''; 3946 3947 var lookup = ['('].concat(simple, nonHelper); 3948 if (!this.options.strict) { 3949 lookup.push(' || ', this.aliasable('helpers.helperMissing')); 3950 } 3951 lookup.push(')'); 3952 3953 this.push(this.source.functionCall(lookup, 'call', helper.callParams)); 3954 }, 3955 3956 // [invokeKnownHelper] 3957 // 3958 // On stack, before: hash, inverse, program, params..., ... 3959 // On stack, after: result of helper invocation 3960 // 3961 // This operation is used when the helper is known to exist, 3962 // so a `helperMissing` fallback is not required. 3963 invokeKnownHelper: function invokeKnownHelper(paramSize, name) { 3964 var helper = this.setupHelper(paramSize, name); 3965 this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); 3966 }, 3967 3968 // [invokeAmbiguous] 3969 // 3970 // On stack, before: hash, inverse, program, params..., ... 3971 // On stack, after: result of disambiguation 3972 // 3973 // This operation is used when an expression like `{{foo}}` 3974 // is provided, but we don't know at compile-time whether it 3975 // is a helper or a path. 3976 // 3977 // This operation emits more code than the other options, 3978 // and can be avoided by passing the `knownHelpers` and 3979 // `knownHelpersOnly` flags at compile-time. 3980 invokeAmbiguous: function invokeAmbiguous(name, helperCall) { 3981 this.useRegister('helper'); 3982 3983 var nonHelper = this.popStack(); 3984 3985 this.emptyHash(); 3986 var helper = this.setupHelper(0, name, helperCall); 3987 3988 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 3989 3990 var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; 3991 if (!this.options.strict) { 3992 lookup[0] = '(helper = '; 3993 lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing')); 3994 } 3995 3996 this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); 3997 }, 3998 3999 // [invokePartial] 4000 // 4001 // On stack, before: context, ... 4002 // On stack after: result of partial invocation 4003 // 4004 // This operation pops off a context, invokes a partial with that context, 4005 // and pushes the result of the invocation back. 4006 invokePartial: function invokePartial(isDynamic, name, indent) { 4007 var params = [], 4008 options = this.setupParams(name, 1, params); 4009 4010 if (isDynamic) { 4011 name = this.popStack(); 4012 delete options.name; 4013 } 4014 4015 if (indent) { 4016 options.indent = JSON.stringify(indent); 4017 } 4018 options.helpers = 'helpers'; 4019 options.partials = 'partials'; 4020 options.decorators = 'container.decorators'; 4021 4022 if (!isDynamic) { 4023 params.unshift(this.nameLookup('partials', name, 'partial')); 4024 } else { 4025 params.unshift(name); 4026 } 4027 4028 if (this.options.compat) { 4029 options.depths = 'depths'; 4030 } 4031 options = this.objectLiteral(options); 4032 params.push(options); 4033 4034 this.push(this.source.functionCall('container.invokePartial', '', params)); 4035 }, 4036 4037 // [assignToHash] 4038 // 4039 // On stack, before: value, ..., hash, ... 4040 // On stack, after: ..., hash, ... 4041 // 4042 // Pops a value off the stack and assigns it to the current hash 4043 assignToHash: function assignToHash(key) { 4044 var value = this.popStack(), 4045 context = undefined, 4046 type = undefined, 4047 id = undefined; 4048 4049 if (this.trackIds) { 4050 id = this.popStack(); 4051 } 4052 if (this.stringParams) { 4053 type = this.popStack(); 4054 context = this.popStack(); 4055 } 4056 4057 var hash = this.hash; 4058 if (context) { 4059 hash.contexts[key] = context; 4060 } 4061 if (type) { 4062 hash.types[key] = type; 4063 } 4064 if (id) { 4065 hash.ids[key] = id; 4066 } 4067 hash.values[key] = value; 4068 }, 4069 4070 pushId: function pushId(type, name, child) { 4071 if (type === 'BlockParam') { 4072 this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); 4073 } else if (type === 'PathExpression') { 4074 this.pushString(name); 4075 } else if (type === 'SubExpression') { 4076 this.pushStackLiteral('true'); 4077 } else { 4078 this.pushStackLiteral('null'); 4079 } 4080 }, 4081 4082 // HELPERS 4083 4084 compiler: JavaScriptCompiler, 4085 4086 compileChildren: function compileChildren(environment, options) { 4087 var children = environment.children, 4088 child = undefined, 4089 compiler = undefined; 4090 4091 for (var i = 0, l = children.length; i < l; i++) { 4092 child = children[i]; 4093 compiler = new this.compiler(); // eslint-disable-line new-cap 4094 4095 var index = this.matchExistingProgram(child); 4096 4097 if (index == null) { 4098 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 4099 index = this.context.programs.length; 4100 child.index = index; 4101 child.name = 'program' + index; 4102 this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); 4103 this.context.decorators[index] = compiler.decorators; 4104 this.context.environments[index] = child; 4105 4106 this.useDepths = this.useDepths || compiler.useDepths; 4107 this.useBlockParams = this.useBlockParams || compiler.useBlockParams; 4108 } else { 4109 child.index = index; 4110 child.name = 'program' + index; 4111 4112 this.useDepths = this.useDepths || child.useDepths; 4113 this.useBlockParams = this.useBlockParams || child.useBlockParams; 4114 } 4115 } 4116 }, 4117 matchExistingProgram: function matchExistingProgram(child) { 4118 for (var i = 0, len = this.context.environments.length; i < len; i++) { 4119 var environment = this.context.environments[i]; 4120 if (environment && environment.equals(child)) { 4121 return i; 4122 } 4123 } 4124 }, 4125 4126 programExpression: function programExpression(guid) { 4127 var child = this.environment.children[guid], 4128 programParams = [child.index, 'data', child.blockParams]; 4129 4130 if (this.useBlockParams || this.useDepths) { 4131 programParams.push('blockParams'); 4132 } 4133 if (this.useDepths) { 4134 programParams.push('depths'); 4135 } 4136 4137 return 'container.program(' + programParams.join(', ') + ')'; 4138 }, 4139 4140 useRegister: function useRegister(name) { 4141 if (!this.registers[name]) { 4142 this.registers[name] = true; 4143 this.registers.list.push(name); 4144 } 4145 }, 4146 4147 push: function push(expr) { 4148 if (!(expr instanceof Literal)) { 4149 expr = this.source.wrap(expr); 4150 } 4151 4152 this.inlineStack.push(expr); 4153 return expr; 4154 }, 4155 4156 pushStackLiteral: function pushStackLiteral(item) { 4157 this.push(new Literal(item)); 4158 }, 4159 4160 pushSource: function pushSource(source) { 4161 if (this.pendingContent) { 4162 this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); 4163 this.pendingContent = undefined; 4164 } 4165 4166 if (source) { 4167 this.source.push(source); 4168 } 4169 }, 4170 4171 replaceStack: function replaceStack(callback) { 4172 var prefix = ['('], 4173 stack = undefined, 4174 createdStack = undefined, 4175 usedLiteral = undefined; 4176 4177 /* istanbul ignore next */ 4178 if (!this.isInline()) { 4179 throw new _exception2['default']('replaceStack on non-inline'); 4180 } 4181 4182 // We want to merge the inline statement into the replacement statement via ',' 4183 var top = this.popStack(true); 4184 4185 if (top instanceof Literal) { 4186 // Literals do not need to be inlined 4187 stack = [top.value]; 4188 prefix = ['(', stack]; 4189 usedLiteral = true; 4190 } else { 4191 // Get or create the current stack name for use by the inline 4192 createdStack = true; 4193 var _name = this.incrStack(); 4194 4195 prefix = ['((', this.push(_name), ' = ', top, ')']; 4196 stack = this.topStack(); 4197 } 4198 4199 var item = callback.call(this, stack); 4200 4201 if (!usedLiteral) { 4202 this.popStack(); 4203 } 4204 if (createdStack) { 4205 this.stackSlot--; 4206 } 4207 this.push(prefix.concat(item, ')')); 4208 }, 4209 4210 incrStack: function incrStack() { 4211 this.stackSlot++; 4212 if (this.stackSlot > this.stackVars.length) { 4213 this.stackVars.push('stack' + this.stackSlot); 4214 } 4215 return this.topStackName(); 4216 }, 4217 topStackName: function topStackName() { 4218 return 'stack' + this.stackSlot; 4219 }, 4220 flushInline: function flushInline() { 4221 var inlineStack = this.inlineStack; 4222 this.inlineStack = []; 4223 for (var i = 0, len = inlineStack.length; i < len; i++) { 4224 var entry = inlineStack[i]; 4225 /* istanbul ignore if */ 4226 if (entry instanceof Literal) { 4227 this.compileStack.push(entry); 4228 } else { 4229 var stack = this.incrStack(); 4230 this.pushSource([stack, ' = ', entry, ';']); 4231 this.compileStack.push(stack); 4232 } 4233 } 4234 }, 4235 isInline: function isInline() { 4236 return this.inlineStack.length; 4237 }, 4238 4239 popStack: function popStack(wrapped) { 4240 var inline = this.isInline(), 4241 item = (inline ? this.inlineStack : this.compileStack).pop(); 4242 4243 if (!wrapped && item instanceof Literal) { 4244 return item.value; 4245 } else { 4246 if (!inline) { 4247 /* istanbul ignore next */ 4248 if (!this.stackSlot) { 4249 throw new _exception2['default']('Invalid stack pop'); 4250 } 4251 this.stackSlot--; 4252 } 4253 return item; 4254 } 4255 }, 4256 4257 topStack: function topStack() { 4258 var stack = this.isInline() ? this.inlineStack : this.compileStack, 4259 item = stack[stack.length - 1]; 4260 4261 /* istanbul ignore if */ 4262 if (item instanceof Literal) { 4263 return item.value; 4264 } else { 4265 return item; 4266 } 4267 }, 4268 4269 contextName: function contextName(context) { 4270 if (this.useDepths && context) { 4271 return 'depths[' + context + ']'; 4272 } else { 4273 return 'depth' + context; 4274 } 4275 }, 4276 4277 quotedString: function quotedString(str) { 4278 return this.source.quotedString(str); 4279 }, 4280 4281 objectLiteral: function objectLiteral(obj) { 4282 return this.source.objectLiteral(obj); 4283 }, 4284 4285 aliasable: function aliasable(name) { 4286 var ret = this.aliases[name]; 4287 if (ret) { 4288 ret.referenceCount++; 4289 return ret; 4290 } 4291 4292 ret = this.aliases[name] = this.source.wrap(name); 4293 ret.aliasable = true; 4294 ret.referenceCount = 1; 4295 4296 return ret; 4297 }, 4298 4299 setupHelper: function setupHelper(paramSize, name, blockHelper) { 4300 var params = [], 4301 paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); 4302 var foundHelper = this.nameLookup('helpers', name, 'helper'), 4303 callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : {}'); 4304 4305 return { 4306 params: params, 4307 paramsInit: paramsInit, 4308 name: foundHelper, 4309 callParams: [callContext].concat(params) 4310 }; 4311 }, 4312 4313 setupParams: function setupParams(helper, paramSize, params) { 4314 var options = {}, 4315 contexts = [], 4316 types = [], 4317 ids = [], 4318 objectArgs = !params, 4319 param = undefined; 4320 4321 if (objectArgs) { 4322 params = []; 4323 } 4324 4325 options.name = this.quotedString(helper); 4326 options.hash = this.popStack(); 4327 4328 if (this.trackIds) { 4329 options.hashIds = this.popStack(); 4330 } 4331 if (this.stringParams) { 4332 options.hashTypes = this.popStack(); 4333 options.hashContexts = this.popStack(); 4334 } 4335 4336 var inverse = this.popStack(), 4337 program = this.popStack(); 4338 4339 // Avoid setting fn and inverse if neither are set. This allows 4340 // helpers to do a check for `if (options.fn)` 4341 if (program || inverse) { 4342 options.fn = program || 'container.noop'; 4343 options.inverse = inverse || 'container.noop'; 4344 } 4345 4346 // The parameters go on to the stack in order (making sure that they are evaluated in order) 4347 // so we need to pop them off the stack in reverse order 4348 var i = paramSize; 4349 while (i--) { 4350 param = this.popStack(); 4351 params[i] = param; 4352 4353 if (this.trackIds) { 4354 ids[i] = this.popStack(); 4355 } 4356 if (this.stringParams) { 4357 types[i] = this.popStack(); 4358 contexts[i] = this.popStack(); 4359 } 4360 } 4361 4362 if (objectArgs) { 4363 options.args = this.source.generateArray(params); 4364 } 4365 4366 if (this.trackIds) { 4367 options.ids = this.source.generateArray(ids); 4368 } 4369 if (this.stringParams) { 4370 options.types = this.source.generateArray(types); 4371 options.contexts = this.source.generateArray(contexts); 4372 } 4373 4374 if (this.options.data) { 4375 options.data = 'data'; 4376 } 4377 if (this.useBlockParams) { 4378 options.blockParams = 'blockParams'; 4379 } 4380 return options; 4381 }, 4382 4383 setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { 4384 var options = this.setupParams(helper, paramSize, params); 4385 options = this.objectLiteral(options); 4386 if (useRegister) { 4387 this.useRegister('options'); 4388 params.push('options'); 4389 return ['options=', options]; 4390 } else if (params) { 4391 params.push(options); 4392 return ''; 4393 } else { 4394 return options; 4395 } 4396 } 4397 }; 4398 4399 (function () { 4400 var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); 4401 4402 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 4403 4404 for (var i = 0, l = reservedWords.length; i < l; i++) { 4405 compilerWords[reservedWords[i]] = true; 4406 } 4407 })(); 4408 4409 JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { 4410 return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); 4411 }; 4412 4413 function strictLookup(requireTerminal, compiler, parts, type) { 4414 var stack = compiler.popStack(), 4415 i = 0, 4416 len = parts.length; 4417 if (requireTerminal) { 4418 len--; 4419 } 4420 4421 for (; i < len; i++) { 4422 stack = compiler.nameLookup(stack, parts[i], type); 4423 } 4424 4425 if (requireTerminal) { 4426 return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; 4427 } else { 4428 return stack; 4429 } 4430 } 4431 4432 exports['default'] = JavaScriptCompiler; 4433 module.exports = exports['default']; 4434 4435 /***/ }, 4436 /* 29 */ 4437 /***/ function(module, exports, __webpack_require__) { 4438 4439 /* global define */ 4440 'use strict'; 4441 4442 exports.__esModule = true; 4443 4444 var _utils = __webpack_require__(5); 4445 4446 var SourceNode = undefined; 4447 4448 try { 4449 /* istanbul ignore next */ 4450 if (false) { 4451 // We don't support this in AMD environments. For these environments, we asusme that 4452 // they are running on the browser and thus have no need for the source-map library. 4453 var SourceMap = require('source-map'); 4454 SourceNode = SourceMap.SourceNode; 4455 } 4456 } catch (err) {} 4457 /* NOP */ 4458 4459 /* istanbul ignore if: tested but not covered in istanbul due to dist build */ 4460 if (!SourceNode) { 4461 SourceNode = function (line, column, srcFile, chunks) { 4462 this.src = ''; 4463 if (chunks) { 4464 this.add(chunks); 4465 } 4466 }; 4467 /* istanbul ignore next */ 4468 SourceNode.prototype = { 4469 add: function add(chunks) { 4470 if (_utils.isArray(chunks)) { 4471 chunks = chunks.join(''); 4472 } 4473 this.src += chunks; 4474 }, 4475 prepend: function prepend(chunks) { 4476 if (_utils.isArray(chunks)) { 4477 chunks = chunks.join(''); 4478 } 4479 this.src = chunks + this.src; 4480 }, 4481 toStringWithSourceMap: function toStringWithSourceMap() { 4482 return { code: this.toString() }; 4483 }, 4484 toString: function toString() { 4485 return this.src; 4486 } 4487 }; 4488 } 4489 4490 function castChunk(chunk, codeGen, loc) { 4491 if (_utils.isArray(chunk)) { 4492 var ret = []; 4493 4494 for (var i = 0, len = chunk.length; i < len; i++) { 4495 ret.push(codeGen.wrap(chunk[i], loc)); 4496 } 4497 return ret; 4498 } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { 4499 // Handle primitives that the SourceNode will throw up on 4500 return chunk + ''; 4501 } 4502 return chunk; 4503 } 4504 4505 function CodeGen(srcFile) { 4506 this.srcFile = srcFile; 4507 this.source = []; 4508 } 4509 4510 CodeGen.prototype = { 4511 isEmpty: function isEmpty() { 4512 return !this.source.length; 4513 }, 4514 prepend: function prepend(source, loc) { 4515 this.source.unshift(this.wrap(source, loc)); 4516 }, 4517 push: function push(source, loc) { 4518 this.source.push(this.wrap(source, loc)); 4519 }, 4520 4521 merge: function merge() { 4522 var source = this.empty(); 4523 this.each(function (line) { 4524 source.add([' ', line, '\n']); 4525 }); 4526 return source; 4527 }, 4528 4529 each: function each(iter) { 4530 for (var i = 0, len = this.source.length; i < len; i++) { 4531 iter(this.source[i]); 4532 } 4533 }, 4534 4535 empty: function empty() { 4536 var loc = this.currentLocation || { start: {} }; 4537 return new SourceNode(loc.start.line, loc.start.column, this.srcFile); 4538 }, 4539 wrap: function wrap(chunk) { 4540 var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; 4541 4542 if (chunk instanceof SourceNode) { 4543 return chunk; 4544 } 4545 4546 chunk = castChunk(chunk, this, loc); 4547 4548 return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); 4549 }, 4550 4551 functionCall: function functionCall(fn, type, params) { 4552 params = this.generateList(params); 4553 return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); 4554 }, 4555 4556 quotedString: function quotedString(str) { 4557 return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 4558 .replace(/\u2029/g, '\\u2029') + '"'; 4559 }, 4560 4561 objectLiteral: function objectLiteral(obj) { 4562 var pairs = []; 4563 4564 for (var key in obj) { 4565 if (obj.hasOwnProperty(key)) { 4566 var value = castChunk(obj[key], this); 4567 if (value !== 'undefined') { 4568 pairs.push([this.quotedString(key), ':', value]); 4569 } 4570 } 4571 } 4572 4573 var ret = this.generateList(pairs); 4574 ret.prepend('{'); 4575 ret.add('}'); 4576 return ret; 4577 }, 4578 4579 generateList: function generateList(entries) { 4580 var ret = this.empty(); 4581 4582 for (var i = 0, len = entries.length; i < len; i++) { 4583 if (i) { 4584 ret.add(','); 4585 } 4586 4587 ret.add(castChunk(entries[i], this)); 4588 } 4589 4590 return ret; 4591 }, 4592 4593 generateArray: function generateArray(entries) { 4594 var ret = this.generateList(entries); 4595 ret.prepend('['); 4596 ret.add(']'); 4597 4598 return ret; 4599 } 4600 }; 4601 4602 exports['default'] = CodeGen; 4603 module.exports = exports['default']; 4604 4605 /***/ } 4606 /******/ ]) 4607 }); 4608 ;