├── bg.png ├── preview.png ├── FootprintCourt ├── negx.hdr ├── negy.hdr ├── negz.hdr ├── posx.hdr ├── posy.hdr └── posz.hdr ├── index.js ├── README.md ├── package.json ├── index.html └── handlebars-v4.0.11.js /bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donmccurdy/glTF-Asset-Generator-ThreeJS-Test/master/bg.png -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donmccurdy/glTF-Asset-Generator-ThreeJS-Test/master/preview.png -------------------------------------------------------------------------------- /FootprintCourt/negx.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donmccurdy/glTF-Asset-Generator-ThreeJS-Test/master/FootprintCourt/negx.hdr -------------------------------------------------------------------------------- /FootprintCourt/negy.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donmccurdy/glTF-Asset-Generator-ThreeJS-Test/master/FootprintCourt/negy.hdr -------------------------------------------------------------------------------- /FootprintCourt/negz.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donmccurdy/glTF-Asset-Generator-ThreeJS-Test/master/FootprintCourt/negz.hdr -------------------------------------------------------------------------------- /FootprintCourt/posx.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donmccurdy/glTF-Asset-Generator-ThreeJS-Test/master/FootprintCourt/posx.hdr -------------------------------------------------------------------------------- /FootprintCourt/posy.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donmccurdy/glTF-Asset-Generator-ThreeJS-Test/master/FootprintCourt/posy.hdr -------------------------------------------------------------------------------- /FootprintCourt/posz.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/donmccurdy/glTF-Asset-Generator-ThreeJS-Test/master/FootprintCourt/posz.hdr -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const THREE = window.THREE = require('three'); 2 | require('three/examples/js/loaders/GLTFLoader'); 3 | require('three/examples/js/loaders/RGBELoader'); 4 | require('three/examples/js/loaders/HDRCubeTextureLoader'); 5 | require('three/examples/js/pmrem/PMREMGenerator'); 6 | require('three/examples/js/pmrem/PMREMCubeUVPacker'); 7 | module.exports = THREE; 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # glTF-Asset-Generator-ThreeJS-Test 2 | 3 | Displays three.js renders of simple unit test models from [glTF-Asset-Generator](https://github.com/bghgary/glTF-Asset-Generator). Includes comparison to BabylonJS; neither engine is normative. 4 | 5 | Quickstart: 6 | 7 | ``` 8 | npm install 9 | npm run build 10 | npm run dev 11 | ``` 12 | 13 | ![screenshot](preview.png) 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gltf-asset-generator-threejs-tests", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "build": "browserify index.js -o bundle.js --standalone THREE", 9 | "dev": "serve ." 10 | }, 11 | "author": "Don McCurdy ", 12 | "license": "MIT", 13 | "dependencies": { 14 | "three": "^0.92.0" 15 | }, 16 | "devDependencies": { 17 | "browserify": "^16.2.0", 18 | "budo": "^11.2.0", 19 | "serve": "^6.5.6" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Preview glTF - three.js 5 | 6 | 47 | 48 | 49 |
50 |

Preview glTF - three.js r92

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