1import { G as getDefaultExportFromCjs, p as prop, i as if_block, d as bind_this, a as set_attribute, b as set_class, h as clsx } from './i18n-CGlVUOvE.js'; 2import { M as push, ab as state, ac as proxy, a1 as createEventDispatcher, ad as user_effect, Z as get, $ as set, a3 as comment, N as first_child, a as append, O as pop, Q as child, S as sibling, T as reset, a5 as next, t as template_effect, X as set_text, R as from_html, a2 as user_derived, as as to_array, a$ as noop } from './index-Bq2njFOY.js'; 3import { s as snippet } from './snippet-BG7qkY_1.js'; 4 5var handlebars = {exports: {}}; 6 7var handlebars_runtime = {exports: {}}; 8 9var base$1 = {}; 10 11var utils = {}; 12 13var hasRequiredUtils; 14 15function requireUtils () { 16 if (hasRequiredUtils) return utils; 17 hasRequiredUtils = 1; 18 19 utils.__esModule = true; 20 utils.extend = extend; 21 utils.indexOf = indexOf; 22 utils.escapeExpression = escapeExpression; 23 utils.isEmpty = isEmpty; 24 utils.createFrame = createFrame; 25 utils.blockParams = blockParams; 26 utils.appendContextPath = appendContextPath; 27 var escape = { 28 '&': '&', 29 '<': '<', 30 '>': '>', 31 '"': '"', 32 "'": ''', 33 '`': '`', 34 '=': '=' 35 }; 36 37 var badChars = /[&<>"'`=]/g, 38 possible = /[&<>"'`=]/; 39 40 function escapeChar(chr) { 41 return escape[chr]; 42 } 43 44 function extend(obj /* , ...source */) { 45 for (var i = 1; i < arguments.length; i++) { 46 for (var key in arguments[i]) { 47 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { 48 obj[key] = arguments[i][key]; 49 } 50 } 51 } 52 53 return obj; 54 } 55 56 var toString = Object.prototype.toString; 57 58 utils.toString = toString; 59 // Sourced from lodash 60 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 61 /* eslint-disable func-style */ 62 var isFunction = function isFunction(value) { 63 return typeof value === 'function'; 64 }; 65 // fallback for older versions of Chrome and Safari 66 /* istanbul ignore next */ 67 if (isFunction(/x/)) { 68 utils.isFunction = isFunction = function (value) { 69 return typeof value === 'function' && toString.call(value) === '[object Function]'; 70 }; 71 } 72 utils.isFunction = isFunction; 73 74 /* eslint-enable func-style */ 75 76 /* istanbul ignore next */ 77 var isArray = Array.isArray || function (value) { 78 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; 79 }; 80 81 utils.isArray = isArray; 82 // Older IE versions do not directly support indexOf so we must implement our own, sadly. 83 84 function indexOf(array, value) { 85 for (var i = 0, len = array.length; i < len; i++) { 86 if (array[i] === value) { 87 return i; 88 } 89 } 90 return -1; 91 } 92 93 function escapeExpression(string) { 94 if (typeof string !== 'string') { 95 // don't escape SafeStrings, since they're already safe 96 if (string && string.toHTML) { 97 return string.toHTML(); 98 } else if (string == null) { 99 return ''; 100 } else if (!string) { 101 return string + ''; 102 } 103 104 // Force a string conversion as this will be done by the append regardless and 105 // the regex test will do this transparently behind the scenes, causing issues if 106 // an object's to string has escaped characters in it. 107 string = '' + string; 108 } 109 110 if (!possible.test(string)) { 111 return string; 112 } 113 return string.replace(badChars, escapeChar); 114 } 115 116 function isEmpty(value) { 117 if (!value && value !== 0) { 118 return true; 119 } else if (isArray(value) && value.length === 0) { 120 return true; 121 } else { 122 return false; 123 } 124 } 125 126 function createFrame(object) { 127 var frame = extend({}, object); 128 frame._parent = object; 129 return frame; 130 } 131 132 function blockParams(params, ids) { 133 params.path = ids; 134 return params; 135 } 136 137 function appendContextPath(contextPath, id) { 138 return (contextPath ? contextPath + '.' : '') + id; 139 } 140 141 return utils; 142} 143 144var exception = {exports: {}}; 145 146var hasRequiredException; 147 148function requireException () { 149 if (hasRequiredException) return exception.exports; 150 hasRequiredException = 1; 151 (function (module, exports$1) { 152 153 exports$1.__esModule = true; 154 var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; 155 156 function Exception(message, node) { 157 var loc = node && node.loc, 158 line = undefined, 159 endLineNumber = undefined, 160 column = undefined, 161 endColumn = undefined; 162 163 if (loc) { 164 line = loc.start.line; 165 endLineNumber = loc.end.line; 166 column = loc.start.column; 167 endColumn = loc.end.column; 168
vendor: 10,174 bytes, lines 169-539
169 message += ' - ' + line + ':' + column; 170 } 171 172 var tmp = Error.prototype.constructor.call(this, message); 173 174 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 175 for (var idx = 0; idx < errorProps.length; idx++) { 176 this[errorProps[idx]] = tmp[errorProps[idx]]; 177 } 178 179 /* istanbul ignore else */ 180 if (Error.captureStackTrace) { 181 Error.captureStackTrace(this, Exception); 182 } 183 184 try { 185 if (loc) { 186 this.lineNumber = line; 187 this.endLineNumber = endLineNumber; 188 189 // Work around issue under safari where we can't directly set the column value 190 /* istanbul ignore next */ 191 if (Object.defineProperty) { 192 Object.defineProperty(this, 'column', { 193 value: column, 194 enumerable: true 195 }); 196 Object.defineProperty(this, 'endColumn', { 197 value: endColumn, 198 enumerable: true 199 }); 200 } else { 201 this.column = column; 202 this.endColumn = endColumn; 203 } 204 } 205 } catch (nop) { 206 /* Ignore if the browser is very particular */ 207 } 208 } 209 210 Exception.prototype = new Error(); 211 212 exports$1['default'] = Exception; 213 module.exports = exports$1['default']; 214 215 } (exception, exception.exports)); 216 return exception.exports; 217} 218 219var helpers$1 = {}; 220 221var blockHelperMissing = {exports: {}}; 222 223var hasRequiredBlockHelperMissing; 224 225function requireBlockHelperMissing () { 226 if (hasRequiredBlockHelperMissing) return blockHelperMissing.exports; 227 hasRequiredBlockHelperMissing = 1; 228 (function (module, exports$1) { 229 230 exports$1.__esModule = true; 231 232 var _utils = requireUtils(); 233 234 exports$1['default'] = function (instance) { 235 instance.registerHelper('blockHelperMissing', function (context, options) { 236 var inverse = options.inverse, 237 fn = options.fn; 238 239 if (context === true) { 240 return fn(this); 241 } else if (context === false || context == null) { 242 return inverse(this); 243 } else if (_utils.isArray(context)) { 244 if (context.length > 0) { 245 if (options.ids) { 246 options.ids = [options.name]; 247 } 248 249 return instance.helpers.each(context, options); 250 } else { 251 return inverse(this); 252 } 253 } else { 254 if (options.data && options.ids) { 255 var data = _utils.createFrame(options.data); 256 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name); 257 options = { data: data }; 258 } 259 260 return fn(context, options); 261 } 262 }); 263 }; 264 265 module.exports = exports$1['default']; 266 267 } (blockHelperMissing, blockHelperMissing.exports)); 268 return blockHelperMissing.exports; 269} 270 271var each = {exports: {}}; 272 273var hasRequiredEach; 274 275function requireEach () { 276 if (hasRequiredEach) return each.exports; 277 hasRequiredEach = 1; 278 (function (module, exports$1) { 279 280 exports$1.__esModule = true; 281 // istanbul ignore next 282 283 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 284 285 var _utils = requireUtils(); 286 287 var _exception = requireException(); 288 289 var _exception2 = _interopRequireDefault(_exception); 290 291 exports$1['default'] = function (instance) { 292 instance.registerHelper('each', function (context, options) { 293 if (!options) { 294 throw new _exception2['default']('Must pass iterator to #each'); 295 } 296 297 var fn = options.fn, 298 inverse = options.inverse, 299 i = 0, 300 ret = '', 301 data = undefined, 302 contextPath = undefined; 303 304 if (options.data && options.ids) { 305 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; 306 } 307 308 if (_utils.isFunction(context)) { 309 context = context.call(this); 310 } 311 312 if (options.data) { 313 data = _utils.createFrame(options.data); 314 } 315 316 function execIteration(field, index, last) { 317 if (data) { 318 data.key = field; 319 data.index = index; 320 data.first = index === 0; 321 data.last = !!last; 322 323 if (contextPath) { 324 data.contextPath = contextPath + field; 325 } 326 } 327 328 ret = ret + fn(context[field], { 329 data: data, 330 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null]) 331 }); 332 } 333 334 if (context && typeof context === 'object') { 335 if (_utils.isArray(context)) { 336 for (var j = context.length; i < j; i++) { 337 if (i in context) { 338 execIteration(i, i, i === context.length - 1); 339 } 340 } 341 } else if (typeof Symbol === 'function' && context[Symbol.iterator]) { 342 var newContext = []; 343 var iterator = context[Symbol.iterator](); 344 for (var it = iterator.next(); !it.done; it = iterator.next()) { 345 newContext.push(it.value); 346 } 347 context = newContext; 348 for (var j = context.length; i < j; i++) { 349 execIteration(i, i, i === context.length - 1); 350 } 351 } else { 352 (function () { 353 var priorKey = undefined; 354 355 Object.keys(context).forEach(function (key) { 356 // We're running the iterations one step out of sync so we can detect 357 // the last iteration without have to scan the object twice and create 358 // an itermediate keys array. 359 if (priorKey !== undefined) { 360 execIteration(priorKey, i - 1); 361 } 362 priorKey = key; 363 i++; 364 }); 365 if (priorKey !== undefined) { 366 execIteration(priorKey, i - 1, true); 367 } 368 })(); 369 } 370 } 371 372 if (i === 0) { 373 ret = inverse(this); 374 } 375 376 return ret; 377 }); 378 }; 379 380 module.exports = exports$1['default']; 381 382 } (each, each.exports)); 383 return each.exports; 384} 385 386var helperMissing = {exports: {}}; 387 388var hasRequiredHelperMissing; 389 390function requireHelperMissing () { 391 if (hasRequiredHelperMissing) return helperMissing.exports; 392 hasRequiredHelperMissing = 1; 393 (function (module, exports$1) { 394 395 exports$1.__esModule = true; 396 // istanbul ignore next 397 398 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 399 400 var _exception = requireException(); 401 402 var _exception2 = _interopRequireDefault(_exception); 403 404 exports$1['default'] = function (instance) { 405 instance.registerHelper('helperMissing', function () /* [args, ]options */{ 406 if (arguments.length === 1) { 407 // A missing field in a {{foo}} construct. 408 return undefined; 409 } else { 410 // Someone is actually trying to call something, blow up. 411 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); 412 } 413 }); 414 }; 415 416 module.exports = exports$1['default']; 417 418 } (helperMissing, helperMissing.exports)); 419 return helperMissing.exports; 420} 421 422var _if = {exports: {}}; 423 424var hasRequired_if; 425 426function require_if () { 427 if (hasRequired_if) return _if.exports; 428 hasRequired_if = 1; 429 (function (module, exports$1) { 430 431 exports$1.__esModule = true; 432 // istanbul ignore next 433 434 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 435 436 var _utils = requireUtils(); 437 438 var _exception = requireException(); 439 440 var _exception2 = _interopRequireDefault(_exception); 441 442 exports$1['default'] = function (instance) { 443 instance.registerHelper('if', function (conditional, options) { 444 if (arguments.length != 2) { 445 throw new _exception2['default']('#if requires exactly one argument'); 446 } 447 if (_utils.isFunction(conditional)) { 448 conditional = conditional.call(this); 449 } 450 451 // Default behavior is to render the positive path if the value is truthy and not empty. 452 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 453 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 454 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) { 455 return options.inverse(this); 456 } else { 457 return options.fn(this); 458 } 459 }); 460 461 instance.registerHelper('unless', function (conditional, options) { 462 if (arguments.length != 2) { 463 throw new _exception2['default']('#unless requires exactly one argument'); 464 } 465 return instance.helpers['if'].call(this, conditional, { 466 fn: options.inverse, 467 inverse: options.fn, 468 hash: options.hash 469 }); 470 }); 471 }; 472 473 module.exports = exports$1['default']; 474 475 } (_if, _if.exports)); 476 return _if.exports; 477} 478 479var log = {exports: {}}; 480 481var hasRequiredLog; 482 483function requireLog () { 484 if (hasRequiredLog) return log.exports; 485 hasRequiredLog = 1; 486 (function (module, exports$1) { 487 488 exports$1.__esModule = true; 489 490 exports$1['default'] = function (instance) { 491 instance.registerHelper('log', function () /* message, options */{ 492 var args = [undefined], 493 options = arguments[arguments.length - 1]; 494 for (var i = 0; i < arguments.length - 1; i++) { 495 args.push(arguments[i]); 496 } 497 498 var level = 1; 499 if (options.hash.level != null) { 500 level = options.hash.level; 501 } else if (options.data && options.data.level != null) { 502 level = options.data.level; 503 } 504 args[0] = level; 505 506 instance.log.apply(instance, args); 507 }); 508 }; 509 510 module.exports = exports$1['default']; 511 512 } (log, log.exports)); 513 return log.exports; 514} 515 516var lookup = {exports: {}}; 517 518var hasRequiredLookup; 519 520function requireLookup () { 521 if (hasRequiredLookup) return lookup.exports; 522 hasRequiredLookup = 1; 523 (function (module, exports$1) { 524 525 exports$1.__esModule = true; 526 527 exports$1['default'] = function (instance) { 528 instance.registerHelper('lookup', function (obj, field, options) { 529 if (!obj) { 530 // Note for 5.0: Change to "obj == null" in 5.0 531 return obj; 532 } 533 return options.lookupProperty(obj, field); 534 }); 535 }; 536 537 module.exports = exports$1['default']; 538 539 }
539 (lookup, lookup.exports)); 540 return lookup.exports; 541} 542 543var _with = {exports: {}}; 544 545var hasRequired_with; 546 547function require_with () { 548 if (hasRequired_with) return _with.exports; 549 hasRequired_with = 1; 550 (function (module, exports$1) { 551 552 exports$1.__esModule = true; 553 // istanbul ignore next 554 555 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 556 557 var _utils = requireUtils(); 558 559 var _exception = requireException(); 560 561 var _exception2 = _interopRequireDefault(_exception); 562 563 exports$1['default'] = function (instance) { 564 instance.registerHelper('with', function (context, options) { 565 if (arguments.length != 2) { 566 throw new _exception2['default']('#with requires exactly one argument'); 567 } 568 if (_utils.isFunction(context)) { 569 context = context.call(this); 570 } 571 572 var fn = options.fn; 573 574 if (!_utils.isEmpty(context)) { 575 var data = options.data; 576 if (options.data && options.ids) { 577 data = _utils.createFrame(options.data); 578 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]); 579 } 580 581 return fn(context, { 582 data: data, 583 blockParams: _utils.blockParams([context], [data && data.contextPath]) 584 }); 585 } else { 586 return options.inverse(this); 587 } 588 }); 589 }; 590 591 module.exports = exports$1['default']; 592 593 } (_with, _with.exports)); 594 return _with.exports; 595} 596 597var hasRequiredHelpers$1; 598 599function requireHelpers$1 () { 600 if (hasRequiredHelpers$1) return helpers$1; 601 hasRequiredHelpers$1 = 1; 602 603 helpers$1.__esModule = true; 604 helpers$1.registerDefaultHelpers = registerDefaultHelpers; 605 helpers$1.moveHelperToHooks = moveHelperToHooks; 606 // istanbul ignore next 607 608 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 609 610 var _helpersBlockHelperMissing = requireBlockHelperMissing(); 611 612 var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); 613 614 var _helpersEach = requireEach(); 615 616 var _helpersEach2 = _interopRequireDefault(_helpersEach); 617 618 var _helpersHelperMissing = requireHelperMissing(); 619 620 var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); 621 622 var _helpersIf = require_if(); 623 624 var _helpersIf2 = _interopRequireDefault(_helpersIf); 625 626 var _helpersLog = requireLog(); 627 628 var _helpersLog2 = _interopRequireDefault(_helpersLog); 629 630 var _helpersLookup = requireLookup(); 631 632 var _helpersLookup2 = _interopRequireDefault(_helpersLookup); 633 634 var _helpersWith = require_with(); 635 636 var _helpersWith2 = _interopRequireDefault(_helpersWith); 637 638 function registerDefaultHelpers(instance) { 639 _helpersBlockHelperMissing2['default'](instance); 640 _helpersEach2['default'](instance); 641 _helpersHelperMissing2['default'](instance); 642 _helpersIf2['default'](instance); 643 _helpersLog2['default'](instance); 644 _helpersLookup2['default'](instance); 645 _helpersWith2['default'](instance); 646 } 647 648 function moveHelperToHooks(instance, helperName, keepHelper) { 649 if (instance.helpers[helperName]) { 650 instance.hooks[helperName] = instance.helpers[helperName]; 651 if (!keepHelper) { 652 delete instance.helpers[helperName]; 653 } 654 } 655 } 656 657 return helpers$1; 658} 659 660var decorators = {}; 661 662var inline = {exports: {}}; 663 664var hasRequiredInline; 665 666function requireInline () { 667 if (hasRequiredInline) return inline.exports; 668 hasRequiredInline = 1; 669 (function (module, exports$1) { 670 671 exports$1.__esModule = true; 672 673 var _utils = requireUtils(); 674 675 exports$1['default'] = function (instance) { 676 instance.registerDecorator('inline', function (fn, props, container, options) { 677 var ret = fn; 678 if (!props.partials) { 679 props.partials = {}; 680 ret = function (context, options) { 681 // Create a new partials stack frame prior to exec. 682 var original = container.partials; 683 container.partials = _utils.extend({}, original, props.partials); 684 var ret = fn(context, options); 685 container.partials = original; 686 return ret; 687 }; 688 } 689 690 props.partials[options.args[0]] = options.fn; 691 692 return ret; 693 }); 694 }; 695 696 module.exports = exports$1['default']; 697 698 } (inline, inline.exports)); 699 return inline.exports; 700} 701 702var hasRequiredDecorators; 703 704function requireDecorators () { 705 if (hasRequiredDecorators) return decorators; 706 hasRequiredDecorators = 1; 707 708 decorators.__esModule = true; 709 decorators.registerDefaultDecorators = registerDefaultDecorators; 710 // istanbul ignore next 711 712 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 713 714 var _decoratorsInline = requireInline(); 715 716 var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); 717 718 function registerDefaultDecorators(instance) { 719 _decoratorsInline2['default'](instance); 720 } 721 722 return decorators; 723} 724 725var logger = {exports: {}}; 726 727var hasRequiredLogger; 728 729function requireLogger () { 730 if (hasRequiredLogger) return logger.exports; 731 hasRequiredLogger = 1; 732 (function (module, exports$1) { 733 734 exports$1.__esModule = true; 735 736 var _utils = requireUtils(); 737 738 var logger = { 739 methodMap: ['debug', 'info', 'warn', 'error'], 740 level: 'info', 741 742 // Maps a given level value to the `methodMap` indexes above. 743 lookupLevel: function lookupLevel(level) { 744 if (typeof level === 'string') { 745 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase()); 746 if (levelMap >= 0) { 747 level = levelMap; 748 } else { 749 level = parseInt(level, 10); 750 } 751 } 752 753 return level; 754 }, 755 756 // Can be overridden in the host environment 757 log: function log(level) { 758 level = logger.lookupLevel(level); 759 760 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { 761 var method = logger.methodMap[level]; 762 // eslint-disable-next-line no-console 763 if (!console[method]) { 764 method = 'log'; 765 } 766 767 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 768 message[_key - 1] = arguments[_key]; 769 } 770 771 console[method].apply(console, message); // eslint-disable-line no-console 772 } 773 } 774 }; 775 776 exports$1['default'] = logger; 777 module.exports = exports$1['default']; 778 779 } (logger, logger.exports)); 780 return logger.exports; 781} 782 783var protoAccess = {}; 784 785var createNewLookupObject = {}; 786 787var hasRequiredCreateNewLookupObject; 788 789function requireCreateNewLookupObject () { 790 if (hasRequiredCreateNewLookupObject) return createNewLookupObject; 791 hasRequiredCreateNewLookupObject = 1; 792
793 createNewLookupObject.__esModule = true; 794 createNewLookupObject.createNewLookupObject = createNewLookupObject$1; 795 796 var _utils = requireUtils(); 797 798 /** 799 * Create a new object with "null"-prototype to avoid truthy results on prototype properties. 800 * The resulting object can be used with "object[property]" to check if a property exists 801 * @param {...object} sources a varargs parameter of source objects that will be merged 802 * @returns {object} 803 */ 804 805 function createNewLookupObject$1() { 806 for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { 807 sources[_key] = arguments[_key]; 808 } 809 810 return _utils.extend.apply(undefined, [Object.create(null)].concat(sources)); 811 } 812 813 return createNewLookupObject; 814} 815 816var hasRequiredProtoAccess; 817 818function requireProtoAccess () { 819 if (hasRequiredProtoAccess) return protoAccess; 820 hasRequiredProtoAccess = 1; 821 822 protoAccess.__esModule = true; 823 protoAccess.createProtoAccessControl = createProtoAccessControl; 824 protoAccess.resultIsAllowed = resultIsAllowed; 825 protoAccess.resetLoggedProperties = resetLoggedProperties; 826 // istanbul ignore next 827 828 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 829 830 var _createNewLookupObject = requireCreateNewLookupObject(); 831 832 var _logger = requireLogger(); 833 834 var _logger2 = _interopRequireDefault(_logger); 835 836 var loggedProperties = Object.create(null); 837 838 function createProtoAccessControl(runtimeOptions) { 839 var defaultMethodWhiteList = Object.create(null); 840 defaultMethodWhiteList['constructor'] = false; 841 defaultMethodWhiteList['__defineGetter__'] = false; 842 defaultMethodWhiteList['__defineSetter__'] = false; 843 defaultMethodWhiteList['__lookupGetter__'] = false; 844 845 var defaultPropertyWhiteList = Object.create(null); 846 // eslint-disable-next-line no-proto 847 defaultPropertyWhiteList['__proto__'] = false; 848 849 return { 850 properties: { 851 whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), 852 defaultValue: runtimeOptions.allowProtoPropertiesByDefault 853 }, 854 methods: { 855 whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), 856 defaultValue: runtimeOptions.allowProtoMethodsByDefault 857 } 858 }; 859 } 860 861 function resultIsAllowed(result, protoAccessControl, propertyName) { 862 if (typeof result === 'function') { 863 return checkWhiteList(protoAccessControl.methods, propertyName); 864 } else { 865 return checkWhiteList(protoAccessControl.properties, propertyName); 866 } 867 } 868 869 function checkWhiteList(protoAccessControlForType, propertyName) { 870 if (protoAccessControlForType.whitelist[propertyName] !== undefined) { 871 return protoAccessControlForType.whitelist[propertyName] === true; 872 } 873 if (protoAccessControlForType.defaultValue !== undefined) { 874 return protoAccessControlForType.defaultValue; 875 } 876 logUnexpecedPropertyAccessOnce(propertyName); 877 return false; 878 } 879 880 function logUnexpecedPropertyAccessOnce(propertyName) { 881 if (loggedProperties[propertyName] !== true) { 882 loggedProperties[propertyName] = true; 883 _logger2['default'].log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); 884 } 885 } 886 887 function resetLoggedProperties() { 888 Object.keys(loggedProperties).forEach(function (propertyName) { 889 delete loggedProperties[propertyName]; 890 }); 891 } 892 893 return protoAccess; 894} 895 896var hasRequiredBase$1; 897 898function requireBase$1 () { 899 if (hasRequiredBase$1) return base$1; 900 hasRequiredBase$1 = 1; 901 902 base$1.__esModule = true; 903 base$1.HandlebarsEnvironment = HandlebarsEnvironment; 904 // istanbul ignore next 905 906 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 907 908 var _utils = requireUtils(); 909 910 var _exception = requireException(); 911 912 var _exception2 = _interopRequireDefault(_exception); 913 914 var _helpers = requireHelpers$1(); 915 916 var _decorators = requireDecorators(); 917 918 var _logger = requireLogger(); 919 920 var _logger2 = _interopRequireDefault(_logger); 921 922 var _internalProtoAccess = requireProtoAccess(); 923 924 var VERSION = '4.7.8'; 925 base$1.VERSION = VERSION;
926 var COMPILER_REVISION = 8; 927 base$1.COMPILER_REVISION = COMPILER_REVISION; 928 var LAST_COMPATIBLE_COMPILER_REVISION = 7; 929 930 base$1.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; 931 var REVISION_CHANGES = { 932 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 933 2: '== 1.0.0-rc.3', 934 3: '== 1.0.0-rc.4', 935 4: '== 1.x.x', 936 5: '== 2.0.0-alpha.x', 937 6: '>= 2.0.0-beta.1', 938 7: '>= 4.0.0 <4.3.0', 939 8: '>= 4.3.0' 940 }; 941 942 base$1.REVISION_CHANGES = REVISION_CHANGES; 943 var objectType = '[object Object]'; 944 945 function HandlebarsEnvironment(helpers, partials, decorators) { 946 this.helpers = helpers || {}; 947 this.partials = partials || {}; 948 this.decorators = decorators || {}; 949 950 _helpers.registerDefaultHelpers(this); 951 _decorators.registerDefaultDecorators(this); 952 } 953 954 HandlebarsEnvironment.prototype = { 955 constructor: HandlebarsEnvironment, 956 957 logger: _logger2['default'], 958 log: _logger2['default'].log, 959 960 registerHelper: function registerHelper(name, fn) { 961 if (_utils.toString.call(name) === objectType) { 962 if (fn) { 963 throw new _exception2['default']('Arg not supported with multiple helpers'); 964 } 965 _utils.extend(this.helpers, name); 966 } else { 967 this.helpers[name] = fn; 968 } 969 }, 970 unregisterHelper: function unregisterHelper(name) { 971 delete this.helpers[name]; 972 }, 973 974 registerPartial: function registerPartial(name, partial) { 975 if (_utils.toString.call(name) === objectType) { 976 _utils.extend(this.partials, name); 977 } else { 978 if (typeof partial === 'undefined') { 979 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined'); 980 } 981 this.partials[name] = partial; 982 } 983 }, 984 unregisterPartial: function unregisterPartial(name) { 985 delete this.partials[name]; 986 }, 987 988 registerDecorator: function registerDecorator(name, fn) { 989 if (_utils.toString.call(name) === objectType) { 990 if (fn) { 991 throw new _exception2['default']('Arg not supported with multiple decorators'); 992 } 993 _utils.extend(this.decorators, name); 994 } else { 995 this.decorators[name] = fn; 996 } 997 }, 998 unregisterDecorator: function unregisterDecorator(name) { 999 delete this.decorators[name]; 1000 }, 1001 /** 1002 * Reset the memory of illegal property accesses that have already been logged. 1003 * @deprecated should only be used in handlebars test-cases 1004 */ 1005 resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { 1006 _internalProtoAccess.resetLoggedProperties(); 1007 } 1008 }; 1009 1010 var log = _logger2['default'].log; 1011 1012 base$1.log = log; 1013 base$1.createFrame = _utils.createFrame; 1014 base$1.logger = _logger2['default']; 1015 1016 return base$1; 1017} 1018 1019var safeString = {exports: {}}; 1020 1021var hasRequiredSafeString; 1022 1023function requireSafeString () { 1024 if (hasRequiredSafeString) return safeString.exports; 1025 hasRequiredSafeString = 1; 1026 (function (module, exports$1) { 1027 1028 exports$1.__esModule = true; 1029 function SafeString(string) { 1030 this.string = string; 1031 } 1032 1033 SafeString.prototype.toString = SafeString.prototype.toHTML = function () { 1034 return '' + this.string; 1035 }; 1036 1037 exports$1['default'] = SafeString; 1038 module.exports = exports$1['default']; 1039 1040 } (safeString, safeString.exports)); 1041 return safeString.exports; 1042} 1043 1044var runtime = {}; 1045 1046var wrapHelper = {}; 1047 1048var hasRequiredWrapHelper; 1049 1050function requireWrapHelper () { 1051 if (hasRequiredWrapHelper) return wrapHelper; 1052 hasRequiredWrapHelper = 1; 1053 1054 wrapHelper.__esModule = true; 1055 wrapHelper.wrapHelper = wrapHelper$1; 1056 1057 function wrapHelper$1(helper, transformOptionsFn) { 1058 if (typeof helper !== 'function') { 1059 // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 1060 // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. 1061 return helper; 1062 } 1063 var wrapper = function wrapper() /* dynamic arguments */{ 1064 var options = arguments[arguments.length - 1]; 1065 arguments[arguments.length - 1] = transformOptionsFn(options); 1066 return helper.apply(this, arguments); 1067 }; 1068 return wrapper; 1069 } 1070 1071 return wrapHelper; 1072} 1073 1074var hasRequiredRuntime; 1075
vendor: 8,283 bytes, lines 1076-1307
1076function requireRuntime () { 1077 if (hasRequiredRuntime) return runtime; 1078 hasRequiredRuntime = 1; 1079 1080 runtime.__esModule = true; 1081 runtime.checkRevision = checkRevision; 1082 runtime.template = template; 1083 runtime.wrapProgram = wrapProgram; 1084 runtime.resolvePartial = resolvePartial; 1085 runtime.invokePartial = invokePartial; 1086 runtime.noop = noop; 1087 // istanbul ignore next 1088 1089 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 1090 1091 // istanbul ignore next 1092 1093 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 1094 1095 var _utils = requireUtils(); 1096 1097 var Utils = _interopRequireWildcard(_utils); 1098 1099 var _exception = requireException(); 1100 1101 var _exception2 = _interopRequireDefault(_exception); 1102 1103 var _base = requireBase$1(); 1104 1105 var _helpers = requireHelpers$1(); 1106 1107 var _internalWrapHelper = requireWrapHelper(); 1108 1109 var _internalProtoAccess = requireProtoAccess(); 1110 1111 function checkRevision(compilerInfo) { 1112 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 1113 currentRevision = _base.COMPILER_REVISION; 1114 1115 if (compilerRevision >= _base.LAST_COMPATIBLE_COMPILER_REVISION && compilerRevision <= _base.COMPILER_REVISION) { 1116 return; 1117 } 1118 1119 if (compilerRevision < _base.LAST_COMPATIBLE_COMPILER_REVISION) { 1120 var runtimeVersions = _base.REVISION_CHANGES[currentRevision], 1121 compilerVersions = _base.REVISION_CHANGES[compilerRevision]; 1122 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 + ').'); 1123 } else { 1124 // Use the embedded version info since the runtime doesn't know about this revision yet 1125 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] + ').'); 1126 } 1127 } 1128 1129 function template(templateSpec, env) { 1130 /* istanbul ignore next */ 1131 if (!env) { 1132 throw new _exception2['default']('No environment passed to template'); 1133 } 1134 if (!templateSpec || !templateSpec.main) { 1135 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec); 1136 } 1137 1138 templateSpec.main.decorator = templateSpec.main_d; 1139 1140 // Note: Using env.VM references rather than local var references throughout this section to allow 1141 // for external users to override these as pseudo-supported APIs. 1142 env.VM.checkRevision(templateSpec.compiler); 1143 1144 // backwards compatibility for precompiled templates with compiler-version 7 (<4.3.0) 1145 var templateWasPrecompiledWithCompilerV7 = templateSpec.compiler && templateSpec.compiler[0] === 7; 1146 1147 function invokePartialWrapper(partial, context, options) { 1148 if (options.hash) { 1149 context = Utils.extend({}, context, options.hash); 1150 if (options.ids) { 1151 options.ids[0] = true; 1152 } 1153 } 1154 partial = env.VM.resolvePartial.call(this, partial, context, options); 1155 1156 var extendedOptions = Utils.extend({}, options, { 1157 hooks: this.hooks, 1158 protoAccessControl: this.protoAccessControl 1159 }); 1160 1161 var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); 1162 1163 if (result == null && env.compile) { 1164 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); 1165 result = options.partials[options.name](context, extendedOptions); 1166 } 1167 if (result != null) { 1168 if (options.indent) { 1169 var lines = result.split('\n'); 1170 for (var i = 0, l = lines.length; i < l; i++) { 1171 if (!lines[i] && i + 1 === l) { 1172 break; 1173 } 1174 1175 lines[i] = options.indent + lines[i]; 1176 } 1177 result = lines.join('\n'); 1178 } 1179 return result; 1180 } else { 1181 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); 1182 } 1183 } 1184 1185 // Just add water 1186 var container = { 1187 strict: function strict(obj, name, loc) { 1188 if (!obj || !(name in obj)) { 1189 throw new _exception2['default']('"' + name + '" not defined in ' + obj, { 1190 loc: loc 1191 }); 1192 } 1193 return container.lookupProperty(obj, name); 1194 }, 1195 lookupProperty: function lookupProperty(parent, propertyName) { 1196 var result = parent[propertyName]; 1197 if (result == null) { 1198 return result; 1199 } 1200 if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { 1201 return result; 1202 } 1203 1204 if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { 1205 return result; 1206 } 1207 return undefined; 1208 }, 1209 lookup: function lookup(depths, name) { 1210 var len = depths.length; 1211 for (var i = 0; i < len; i++) { 1212 var result = depths[i] && container.lookupProperty(depths[i], name); 1213 if (result != null) { 1214 return depths[i][name]; 1215 } 1216 } 1217 }, 1218 lambda: function lambda(current, context) { 1219 return typeof current === 'function' ? current.call(context) : current; 1220 }, 1221 1222 escapeExpression: Utils.escapeExpression, 1223 invokePartial: invokePartialWrapper, 1224 1225 fn: function fn(i) { 1226 var ret = templateSpec[i]; 1227 ret.decorator = templateSpec[i + '_d']; 1228 return ret; 1229 }, 1230 1231 programs: [], 1232 program: function program(i, data, declaredBlockParams, blockParams, depths) { 1233 var programWrapper = this.programs[i], 1234 fn = this.fn(i); 1235 if (data || depths || blockParams || declaredBlockParams) { 1236 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); 1237 } else if (!programWrapper) { 1238 programWrapper = this.programs[i] = wrapProgram(this, i, fn); 1239 } 1240 return programWrapper; 1241 }, 1242 1243 data: function data(value, depth) { 1244 while (value && depth--) { 1245 value = value._parent; 1246 } 1247 return value; 1248 }, 1249 mergeIfNeeded: function mergeIfNeeded(param, common) { 1250 var obj = param || common; 1251 1252 if (param && common && param !== common) { 1253 obj = Utils.extend({}, common, param); 1254 } 1255 1256 return obj; 1257 }, 1258 // An empty object to use as replacement for null-contexts 1259 nullContext: Object.seal({}), 1260 1261 noop: env.VM.noop, 1262 compilerInfo: templateSpec.compiler 1263 }; 1264 1265 function ret(context) { 1266 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1267 1268 var data = options.data; 1269 1270 ret._setup(options); 1271 if (!options.partial && templateSpec.useData) { 1272 data = initData(context, data); 1273 } 1274 var depths = undefined, 1275 blockParams = templateSpec.useBlockParams ? [] : undefined; 1276 if (templateSpec.useDepths) { 1277 if (options.depths) { 1278 depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; 1279 } else { 1280 depths = [context]; 1281 } 1282 } 1283 1284 function main(context /*, options*/) { 1285 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); 1286 } 1287 1288 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); 1289 return main(context, options); 1290 } 1291 1292 ret.isTop = true; 1293 1294 ret._setup = function (options) { 1295 if (!options.partial) { 1296 var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); 1297 wrapHelpersToPassLookupProperty(mergedHelpers, container); 1298 container.helpers = mergedHelpers; 1299 1300 if (templateSpec.usePartial) { 1301 // Use mergeIfNeeded here to prevent compiling global partials multiple times 1302 container.partials = container.mergeIfNeeded(options.partials, env.partials); 1303 } 1304 if (templateSpec.usePartial || templateSpec.useDecorators) { 1305 container.decorators = Utils.extend({}, env.decorators, options.decorators); 1306 } 1307
vendor: 4,565 bytes, lines 1308-1436
1308 container.hooks = {}; 1309 container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); 1310 1311 var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; 1312 _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); 1313 _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); 1314 } else { 1315 container.protoAccessControl = options.protoAccessControl; // internal option 1316 container.helpers = options.helpers; 1317 container.partials = options.partials; 1318 container.decorators = options.decorators; 1319 container.hooks = options.hooks; 1320 } 1321 }; 1322 1323 ret._child = function (i, data, blockParams, depths) { 1324 if (templateSpec.useBlockParams && !blockParams) { 1325 throw new _exception2['default']('must pass block params'); 1326 } 1327 if (templateSpec.useDepths && !depths) { 1328 throw new _exception2['default']('must pass parent depths'); 1329 } 1330 1331 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); 1332 }; 1333 return ret; 1334 } 1335 1336 function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { 1337 function prog(context) { 1338 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1339 1340 var currentDepths = depths; 1341 if (depths && context != depths[0] && !(context === container.nullContext && depths[0] === null)) { 1342 currentDepths = [context].concat(depths); 1343 } 1344 1345 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths); 1346 } 1347 1348 prog = executeDecorators(fn, prog, container, depths, data, blockParams); 1349 1350 prog.program = i; 1351 prog.depth = depths ? depths.length : 0; 1352 prog.blockParams = declaredBlockParams || 0; 1353 return prog; 1354 } 1355 1356 /** 1357 * This is currently part of the official API, therefore implementation details should not be changed. 1358 */ 1359 1360 function resolvePartial(partial, context, options) { 1361 if (!partial) { 1362 if (options.name === '@partial-block') { 1363 partial = options.data['partial-block']; 1364 } else { 1365 partial = options.partials[options.name]; 1366 } 1367 } else if (!partial.call && !options.name) { 1368 // This is a dynamic partial that returned a string 1369 options.name = partial; 1370 partial = options.partials[partial]; 1371 } 1372 return partial; 1373 } 1374 1375 function invokePartial(partial, context, options) { 1376 // Use the current closure context to save the partial-block if this partial 1377 var currentPartialBlock = options.data && options.data['partial-block']; 1378 options.partial = true; 1379 if (options.ids) { 1380 options.data.contextPath = options.ids[0] || options.data.contextPath; 1381 } 1382 1383 var partialBlock = undefined; 1384 if (options.fn && options.fn !== noop) { 1385 (function () { 1386 options.data = _base.createFrame(options.data); 1387 // Wrapper function to get access to currentPartialBlock from the closure 1388 var fn = options.fn; 1389 partialBlock = options.data['partial-block'] = function partialBlockWrapper(context) { 1390 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 1391 1392 // Restore the partial-block from the closure for the execution of the block 1393 // i.e. the part inside the block of the partial call. 1394 options.data = _base.createFrame(options.data); 1395 options.data['partial-block'] = currentPartialBlock; 1396 return fn(context, options); 1397 }; 1398 if (fn.partials) { 1399 options.partials = Utils.extend({}, options.partials, fn.partials); 1400 } 1401 })(); 1402 } 1403 1404 if (partial === undefined && partialBlock) { 1405 partial = partialBlock; 1406 } 1407 1408 if (partial === undefined) { 1409 throw new _exception2['default']('The partial ' + options.name + ' could not be found'); 1410 } else if (partial instanceof Function) { 1411 return partial(context, options); 1412 } 1413 } 1414 1415 function noop() { 1416 return ''; 1417 } 1418 1419 function initData(context, data) { 1420 if (!data || !('root' in data)) { 1421 data = data ? _base.createFrame(data) : {}; 1422 data.root = context; 1423 } 1424 return data; 1425 } 1426 1427 function executeDecorators(fn, prog, container, depths, data, blockParams) { 1428 if (fn.decorator) { 1429 var props = {}; 1430 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); 1431 Utils.extend(prog, props); 1432 } 1433 return prog; 1434 } 1435 1436 function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
1437 Object.keys(mergedHelpers).forEach(function (helperName) { 1438 var helper = mergedHelpers[helperName]; 1439 mergedHelpers[helperName] = passLookupPropertyOption(helper, container); 1440 }); 1441 } 1442 1443 function passLookupPropertyOption(helper, container) { 1444 var lookupProperty = container.lookupProperty; 1445 return _internalWrapHelper.wrapHelper(helper, function (options) { 1446 return Utils.extend({ lookupProperty: lookupProperty }, options); 1447 }); 1448 } 1449 1450 return runtime; 1451} 1452 1453var noConflict = {exports: {}}; 1454 1455/* global globalThis */ 1456 1457var hasRequiredNoConflict; 1458 1459function requireNoConflict () { 1460 if (hasRequiredNoConflict) return noConflict.exports; 1461 hasRequiredNoConflict = 1; 1462 (function (module, exports$1) { 1463 1464 exports$1.__esModule = true; 1465 1466 exports$1['default'] = function (Handlebars) { 1467 /* istanbul ignore next */ 1468 // https://mathiasbynens.be/notes/globalthis 1469 (function () { 1470 if (typeof globalThis === 'object') return; 1471 Object.prototype.__defineGetter__('__magic__', function () { 1472 return this; 1473 }); 1474 __magic__.globalThis = __magic__; // eslint-disable-line no-undef 1475 delete Object.prototype.__magic__; 1476 })(); 1477 1478 var $Handlebars = globalThis.Handlebars; 1479 1480 /* istanbul ignore next */ 1481 Handlebars.noConflict = function () { 1482 if (globalThis.Handlebars === Handlebars) { 1483 globalThis.Handlebars = $Handlebars; 1484 } 1485 return Handlebars; 1486 }; 1487 }; 1488 1489 module.exports = exports$1['default']; 1490 1491 } (noConflict, noConflict.exports)); 1492 return noConflict.exports; 1493} 1494 1495var hasRequiredHandlebars_runtime; 1496 1497function requireHandlebars_runtime () { 1498 if (hasRequiredHandlebars_runtime) return handlebars_runtime.exports; 1499 hasRequiredHandlebars_runtime = 1; 1500 (function (module, exports$1) { 1501 1502 exports$1.__esModule = true; 1503 // istanbul ignore next 1504 1505 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 1506 1507 // istanbul ignore next 1508 1509 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 1510 1511 var _handlebarsBase = requireBase$1(); 1512 1513 var base = _interopRequireWildcard(_handlebarsBase); 1514 1515 // Each of these augment the Handlebars object. No need to setup here. 1516 // (This is done to easily share code between commonjs and browse envs) 1517 1518 var _handlebarsSafeString = requireSafeString(); 1519 1520 var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); 1521 1522 var _handlebarsException = requireException(); 1523 1524 var _handlebarsException2 = _interopRequireDefault(_handlebarsException); 1525 1526 var _handlebarsUtils = requireUtils(); 1527 1528 var Utils = _interopRequireWildcard(_handlebarsUtils); 1529 1530 var _handlebarsRuntime = requireRuntime(); 1531 1532 var runtime = _interopRequireWildcard(_handlebarsRuntime); 1533 1534 var _handlebarsNoConflict = requireNoConflict(); 1535 1536 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 1537 1538 // For compatibility and usage outside of module systems, make the Handlebars object a namespace 1539 function create() { 1540 var hb = new base.HandlebarsEnvironment(); 1541 1542 Utils.extend(hb, base); 1543 hb.SafeString = _handlebarsSafeString2['default']; 1544 hb.Exception = _handlebarsException2['default']; 1545 hb.Utils = Utils; 1546 hb.escapeExpression = Utils.escapeExpression; 1547 1548 hb.VM = runtime; 1549 hb.template = function (spec) { 1550 return runtime.template(spec, hb); 1551 }; 1552 1553 return hb; 1554 } 1555 1556 var inst = create(); 1557 inst.create = create; 1558 1559 _handlebarsNoConflict2['default'](inst); 1560 1561 inst['default'] = inst; 1562 1563 exports$1['default'] = inst; 1564 module.exports = exports$1['default']; 1565 1566 } (handlebars_runtime, handlebars_runtime.exports)); 1567 return handlebars_runtime.exports; 1568} 1569 1570var ast = {exports: {}}; 1571 1572var hasRequiredAst; 1573 1574function requireAst () { 1575 if (hasRequiredAst) return ast.exports; 1576 hasRequiredAst = 1; 1577 (function (module, exports$1) { 1578 1579 exports$1.__esModule = true; 1580 var AST = { 1581 // Public API used to evaluate derived attributes regarding AST nodes 1582 helpers: { 1583 // a mustache is definitely a helper if: 1584 // * it is an eligible helper, and 1585 // * it has at least one parameter or hash segment 1586 helperExpression: function helperExpression(node) { 1587 return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash); 1588 }, 1589 1590 scopedId: function scopedId(path) { 1591 return (/^\.|this\b/.test(path.original) 1592 ); 1593 }, 1594 1595 // an ID is simple if it only has one part, and that part is not 1596 // `..` or `this`. 1597 simpleId: function simpleId(path) { 1598 return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; 1599 } 1600 } 1601 }; 1602 1603 // Must be exported as an object rather than the root of the module as the jison lexer 1604 // must modify the object to operate properly. 1605 exports$1['default'] = AST; 1606 module.exports = exports$1['default']; 1607 1608 } (ast, ast.exports)); 1609 return ast.exports; 1610} 1611 1612var base = {}; 1613 1614var parser = {exports: {}}; 1615 1616var hasRequiredParser; 1617 1618function requireParser () { 1619 if (hasRequiredParser) return parser.exports; 1620 hasRequiredParser = 1; 1621 (function (module, exports$1) { 1622 1623 exports$1.__esModule = true; 1624 var handlebars = (function () { 1625 var parser = { trace: function trace() {}, 1626 yy: {}, 1627 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_repetition0": 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 }, 1628 terminals_: { 2: "error", 5: "EOF", 14: "COMMENT", 15: "CONTENT",
vendor: 11,617 bytes, lines 1628-1881
162818: "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" }, 1629 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, 0], [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]], 1630 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { 1631 1632 var $0 = $$.length - 1; 1633 switch (yystate) { 1634 case 1: 1635 return $$[$0 - 1]; 1636 case 2: 1637 this.$ = yy.prepareProgram($$[$0]); 1638 break; 1639 case 3: 1640 this.$ = $$[$0]; 1641 break; 1642 case 4: 1643 this.$ = $$[$0]; 1644 break; 1645 case 5: 1646 this.$ = $$[$0]; 1647 break; 1648 case 6: 1649 this.$ = $$[$0]; 1650 break; 1651 case 7: 1652 this.$ = $$[$0]; 1653 break; 1654 case 8: 1655 this.$ = $$[$0]; 1656 break; 1657 case 9: 1658 this.$ = { 1659 type: 'CommentStatement', 1660 value: yy.stripComment($$[$0]), 1661 strip: yy.stripFlags($$[$0], $$[$0]), 1662 loc: yy.locInfo(this._$) 1663 }; 1664 1665 break; 1666 case 10: 1667 this.$ = { 1668 type: 'ContentStatement', 1669 original: $$[$0], 1670 value: $$[$0], 1671 loc: yy.locInfo(this._$) 1672 }; 1673 1674 break; 1675 case 11: 1676 this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 1677 break; 1678 case 12: 1679 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; 1680 break; 1681 case 13: 1682 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); 1683 break; 1684 case 14: 1685 this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); 1686 break; 1687 case 15: 1688 this.$ = { open: $$[$0 - 5], path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1689 break; 1690 case 16: 1691 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1692 break; 1693 case 17: 1694 this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; 1695 break; 1696 case 18: 1697 this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; 1698 break; 1699 case 19: 1700 var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), 1701 program = yy.prepareProgram([inverse], $$[$0 - 1].loc); 1702 program.chained = true; 1703 1704 this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; 1705 1706 break; 1707 case 20: 1708 this.$ = $$[$0]; 1709 break; 1710 case 21: 1711 this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; 1712 break; 1713 case 22: 1714 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 1715 break; 1716 case 23: 1717 this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); 1718 break; 1719 case 24: 1720 this.$ = { 1721 type: 'PartialStatement', 1722 name: $$[$0 - 3], 1723 params: $$[$0 - 2], 1724 hash: $$[$0 - 1], 1725 indent: '', 1726 strip: yy.stripFlags($$[$0 - 4], $$[$0]), 1727 loc: yy.locInfo(this._$) 1728 }; 1729 1730 break; 1731 case 25: 1732 this.$ = yy.preparePartialBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); 1733 break; 1734 case 26: 1735 this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 4], $$[$0]) }; 1736 break; 1737 case 27: 1738 this.$ = $$[$0]; 1739 break; 1740 case 28: 1741 this.$ = $$[$0]; 1742 break; 1743 case 29: 1744 this.$ = { 1745 type: 'SubExpression', 1746 path: $$[$0 - 3], 1747 params: $$[$0 - 2], 1748 hash: $$[$0 - 1], 1749 loc: yy.locInfo(this._$) 1750 }; 1751 1752 break; 1753 case 30: 1754 this.$ = { type: 'Hash', pairs: $$[$0], loc: yy.locInfo(this._$) }; 1755 break; 1756 case 31: 1757 this.$ = { type: 'HashPair', key: yy.id($$[$0 - 2]), value: $$[$0], loc: yy.locInfo(this._$) }; 1758 break; 1759 case 32: 1760 this.$ = yy.id($$[$0 - 1]); 1761 break; 1762 case 33: 1763 this.$ = $$[$0]; 1764 break; 1765 case 34: 1766 this.$ = $$[$0]; 1767 break; 1768 case 35: 1769 this.$ = { type: 'StringLiteral', value: $$[$0], original: $$[$0], loc: yy.locInfo(this._$) }; 1770 break; 1771 case 36: 1772 this.$ = { type: 'NumberLiteral', value: Number($$[$0]), original: Number($$[$0]), loc: yy.locInfo(this._$) }; 1773 break; 1774 case 37: 1775 this.$ = { type: 'BooleanLiteral', value: $$[$0] === 'true', original: $$[$0] === 'true', loc: yy.locInfo(this._$) }; 1776 break; 1777 case 38: 1778 this.$ = { type: 'UndefinedLiteral', original: undefined, value: undefined, loc: yy.locInfo(this._$) }; 1779 break; 1780 case 39: 1781 this.$ = { type: 'NullLiteral', original: null, value: null, loc: yy.locInfo(this._$) }; 1782 break; 1783 case 40: 1784 this.$ = $$[$0]; 1785 break; 1786 case 41: 1787 this.$ = $$[$0]; 1788 break; 1789 case 42: 1790 this.$ = yy.preparePath(true, $$[$0], this._$); 1791 break; 1792 case 43: 1793 this.$ = yy.preparePath(false, $$[$0], this._$); 1794 break; 1795 case 44: 1796 $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; 1797 break; 1798 case 45: 1799 this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; 1800 break; 1801 case 46: 1802 this.$ = []; 1803 break; 1804 case 47: 1805 $$[$0 - 1].push($$[$0]); 1806 break; 1807 case 48: 1808 this.$ = []; 1809 break; 1810 case 49: 1811 $$[$0 - 1].push($$[$0]); 1812 break; 1813 case 50: 1814 this.$ = []; 1815 break; 1816 case 51: 1817 $$[$0 - 1].push($$[$0]); 1818 break; 1819 case 58: 1820 this.$ = []; 1821 break; 1822 case 59: 1823 $$[$0 - 1].push($$[$0]); 1824 break; 1825 case 64: 1826 this.$ = []; 1827 break; 1828 case 65: 1829 $$[$0 - 1].push($$[$0]); 1830 break; 1831 case 70: 1832 this.$ = []; 1833 break; 1834 case 71: 1835 $$[$0 - 1].push($$[$0]); 1836 break; 1837 case 78: 1838 this.$ = []; 1839 break; 1840 case 79: 1841 $$[$0 - 1].push($$[$0]); 1842 break; 1843 case 82: 1844 this.$ = []; 1845 break; 1846 case 83: 1847 $$[$0 - 1].push($$[$0]); 1848 break; 1849 case 86: 1850 this.$ = []; 1851 break; 1852 case 87: 1853 $$[$0 - 1].push($$[$0]); 1854 break; 1855 case 90: 1856 this.$ = []; 1857 break; 1858 case 91: 1859 $$[$0 - 1].push($$[$0]); 1860 break; 1861 case 94: 1862 this.$ = []; 1863 break; 1864 case 95: 1865 $$[$0 - 1].push($$[$0]); 1866 break; 1867 case 98: 1868 this.$ = [$$[$0]]; 1869 break; 1870 case 99: 1871 $$[$0 - 1].push($$[$0]); 1872 break; 1873 case 100: 1874 this.$ = [$$[$0]]; 1875 break; 1876 case 101: 1877 $$[$0 - 1].push($$[$0]); 1878 break; 1879 } 1880 }, 1881
vendor: 14,911 bytes, line 1881
1881 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] }, { 15: [2, 48], 17: 39, 18: [2, 48] }, { 20: 41, 56: 40, 64: 42, 65: [1, 43], 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: 44, 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: 45, 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: 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: 41, 56: 48, 64: 42, 65: [1, 43], 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: 49, 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, 50] }, { 72: [1, 35], 86: 51 }, { 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: 52, 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: 53, 38: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 54, 47: [2, 54] }, { 28: 59, 43: 60, 44: [1, 58], 47: [2, 56] }, { 13: 62, 15: [1, 20], 18: [1, 61] }, { 33: [2, 86], 57: 63, 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: 64, 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: 65, 47: [1, 66] }, { 30: 67, 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: 68, 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: 69, 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: 70, 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: 74, 33: [2, 80], 50: 71, 63: 72, 64: 75, 65: [1, 43], 69: 73, 70: 76, 71: 77, 72: [1, 78], 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, 79] }, { 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, 50] }, { 20: 74, 53: 80, 54: [2, 84], 63: 81, 64: 75, 65: [1, 43], 69: 82, 70: 76, 71: 77, 72: [1, 78], 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: 83, 47: [1, 66] }, { 47: [2, 55] }, { 4: 84, 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: 85, 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: 86, 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: 87, 47: [1, 66] }, { 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: 74, 33: [2, 88], 58: 88, 63: 89, 64: 75, 65: [1, 43], 69: 90, 70: 76, 71: 77, 72: [1, 78], 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: 91, 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: 92, 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: 74, 31: 93, 33: [2, 60], 63: 94, 64: 75, 65: [1, 43], 69: 95, 70: 76, 71: 77, 72: [1, 78], 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: 74, 33: [2, 66], 36: 96, 63: 97, 64: 75, 65: [1, 43], 69: 98, 70: 76, 71: 77, 72: [1, 78], 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: 74, 22: 99, 23: [2, 52], 63: 100, 64: 75, 65: [1, 43], 69: 101, 70: 76, 71: 77, 72: [1, 78], 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: 74, 33: [2, 92], 62: 102, 63: 103, 64: 75, 65: [1, 43], 69: 104, 70: 76, 71: 77, 72: [1, 78], 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, 105] }, { 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: 106, 72: [1, 107], 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, 108], 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, 109] }, { 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: 55, 39: [1, 57], 43: 56, 44: [1, 58], 45: 111, 46: 110, 47: [2, 76] }, { 33: [2, 70], 40: 112, 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, 113] }, { 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: 74, 63: 115, 64: 75, 65: [1, 43], 67: 114, 68: [2, 96], 69: 116, 70: 76, 71: 77, 72: [1, 78], 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, 117] }, { 32: 118, 33: [2, 62], 74: 119, 75: [1, 120] }, { 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: 121, 74: 122, 75: [1, 120] }, { 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, 123] }, { 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, 124] }, { 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, 108] }, { 20: 74, 63: 125, 64: 75, 65: [1, 43], 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: 74, 33: [2, 72], 41: 126, 63: 127, 64: 75, 65: [1, 43], 69: 128, 70: 76, 71: 77, 72: [1, 78], 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, 129] }, { 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, 130] }, { 33: [2, 63] }, { 72: [1, 132], 76: 131 }, { 33: [1, 133] }, { 33: [2, 69] }, { 15: [2, 12], 18: [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: 134, 74: 135, 75: [1, 120] }, { 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, 137], 77: [1, 136] }, { 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, 138] }, { 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] }],
vendor: 12,957 bytes, lines 1882-2144
1882 defaultActions: { 4: [2, 1], 54: [2, 55], 56: [2, 20], 60: [2, 57], 73: [2, 81], 82: [2, 85], 86: [2, 18], 90: [2, 89], 101: [2, 53], 104: [2, 93], 110: [2, 19], 111: [2, 77], 116: [2, 97], 119: [2, 63], 122: [2, 69], 135: [2, 75], 136: [2, 32] }, 1883 parseError: function parseError(str, hash) { 1884 throw new Error(str); 1885 }, 1886 parse: function parse(input) { 1887 var self = this, 1888 stack = [0], 1889 vstack = [null], 1890 lstack = [], 1891 table = this.table, 1892 yytext = "", 1893 yylineno = 0, 1894 yyleng = 0; 1895 this.lexer.setInput(input); 1896 this.lexer.yy = this.yy; 1897 this.yy.lexer = this.lexer; 1898 this.yy.parser = this; 1899 if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; 1900 var yyloc = this.lexer.yylloc; 1901 lstack.push(yyloc); 1902 var ranges = this.lexer.options && this.lexer.options.ranges; 1903 if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; 1904 function lex() { 1905 var token; 1906 token = self.lexer.lex() || 1; 1907 if (typeof token !== "number") { 1908 token = self.symbols_[token] || token; 1909 } 1910 return token; 1911 } 1912 var symbol, 1913 state, 1914 action, 1915 r, 1916 yyval = {}, 1917 p, 1918 len, 1919 newState, 1920 expected; 1921 while (true) { 1922 state = stack[stack.length - 1]; 1923 if (this.defaultActions[state]) { 1924 action = this.defaultActions[state]; 1925 } else { 1926 if (symbol === null || typeof symbol == "undefined") { 1927 symbol = lex(); 1928 } 1929 action = table[state] && table[state][symbol]; 1930 } 1931 if (typeof action === "undefined" || !action.length || !action[0]) { 1932 var errStr = ""; 1933 { 1934 expected = []; 1935 for (p in table[state]) if (this.terminals_[p] && p > 2) { 1936 expected.push("'" + this.terminals_[p] + "'"); 1937 } 1938 if (this.lexer.showPosition) { 1939 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 1940 } else { 1941 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); 1942 } 1943 this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); 1944 } 1945 } 1946 if (action[0] instanceof Array && action.length > 1) { 1947 throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 1948 } 1949 switch (action[0]) { 1950 case 1: 1951 stack.push(symbol); 1952 vstack.push(this.lexer.yytext); 1953 lstack.push(this.lexer.yylloc); 1954 stack.push(action[1]); 1955 symbol = null; 1956 { 1957 yyleng = this.lexer.yyleng; 1958 yytext = this.lexer.yytext; 1959 yylineno = this.lexer.yylineno; 1960 yyloc = this.lexer.yylloc; 1961 } 1962 break; 1963 case 2: 1964 len = this.productions_[action[1]][1]; 1965 yyval.$ = vstack[vstack.length - len]; 1966 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 }; 1967 if (ranges) { 1968 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 1969 } 1970 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 1971 if (typeof r !== "undefined") { 1972 return r; 1973 } 1974 if (len) { 1975 stack = stack.slice(0, -1 * len * 2); 1976 vstack = vstack.slice(0, -1 * len); 1977 lstack = lstack.slice(0, -1 * len); 1978 } 1979 stack.push(this.productions_[action[1]][0]); 1980 vstack.push(yyval.$); 1981 lstack.push(yyval._$); 1982 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 1983 stack.push(newState); 1984 break; 1985 case 3: 1986 return true; 1987 } 1988 } 1989 return true; 1990 } 1991 }; 1992 /* Jison generated lexer */ 1993 var lexer = (function () { 1994 var lexer = { EOF: 1, 1995 parseError: function parseError(str, hash) { 1996 if (this.yy.parser) { 1997 this.yy.parser.parseError(str, hash); 1998 } else { 1999 throw new Error(str); 2000 } 2001 }, 2002 setInput: function setInput(input) { 2003 this._input = input; 2004 this._more = this._less = this.done = false; 2005 this.yylineno = this.yyleng = 0; 2006 this.yytext = this.matched = this.match = ''; 2007 this.conditionStack = ['INITIAL']; 2008 this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; 2009 if (this.options.ranges) this.yylloc.range = [0, 0]; 2010 this.offset = 0; 2011 return this; 2012 }, 2013 input: function input() { 2014 var ch = this._input[0]; 2015 this.yytext += ch; 2016 this.yyleng++; 2017 this.offset++; 2018 this.match += ch; 2019 this.matched += ch; 2020 var lines = ch.match(/(?:\r\n?|\n).*/g); 2021 if (lines) { 2022 this.yylineno++; 2023 this.yylloc.last_line++; 2024 } else { 2025 this.yylloc.last_column++; 2026 } 2027 if (this.options.ranges) this.yylloc.range[1]++; 2028 2029 this._input = this._input.slice(1); 2030 return ch; 2031 }, 2032 unput: function unput(ch) { 2033 var len = ch.length; 2034 var lines = ch.split(/(?:\r\n?|\n)/g); 2035 2036 this._input = ch + this._input; 2037 this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); 2038 //this.yyleng -= len; 2039 this.offset -= len; 2040 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 2041 this.match = this.match.substr(0, this.match.length - 1); 2042 this.matched = this.matched.substr(0, this.matched.length - 1); 2043 2044 if (lines.length - 1) this.yylineno -= lines.length - 1; 2045 var r = this.yylloc.range; 2046 2047 this.yylloc = { first_line: this.yylloc.first_line, 2048 last_line: this.yylineno + 1, 2049 first_column: this.yylloc.first_column, 2050 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 2051 }; 2052 2053 if (this.options.ranges) { 2054 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 2055 } 2056 return this; 2057 }, 2058 more: function more() { 2059 this._more = true; 2060 return this; 2061 }, 2062 less: function less(n) { 2063 this.unput(this.match.slice(n)); 2064 }, 2065 pastInput: function pastInput() { 2066 var past = this.matched.substr(0, this.matched.length - this.match.length); 2067 return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, ""); 2068 }, 2069 upcomingInput: function upcomingInput() { 2070 var next = this.match; 2071 if (next.length < 20) { 2072 next += this._input.substr(0, 20 - next.length); 2073 } 2074 return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 2075 }, 2076 showPosition: function showPosition() { 2077 var pre = this.pastInput(); 2078 var c = new Array(pre.length + 1).join("-"); 2079 return pre + this.upcomingInput() + "\n" + c + "^"; 2080 }, 2081 next: function next() { 2082 if (this.done) { 2083 return this.EOF; 2084 } 2085 if (!this._input) this.done = true; 2086 2087 var token, match, tempMatch, index, lines; 2088 if (!this._more) { 2089 this.yytext = ''; 2090 this.match = ''; 2091 } 2092 var rules = this._currentRules(); 2093 for (var i = 0; i < rules.length; i++) { 2094 tempMatch = this._input.match(this.rules[rules[i]]); 2095 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 2096 match = tempMatch; 2097 index = i; 2098 if (!this.options.flex) break; 2099 } 2100 } 2101 if (match) { 2102 lines = match[0].match(/(?:\r\n?|\n).*/g); 2103 if (lines) this.yylineno += lines.length; 2104 this.yylloc = { first_line: this.yylloc.last_line, 2105 last_line: this.yylineno + 1, 2106 first_column: this.yylloc.last_column, 2107 last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; 2108 this.yytext += match[0]; 2109 this.match += match[0]; 2110 this.matches = match; 2111 this.yyleng = this.yytext.length; 2112 if (this.options.ranges) { 2113 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 2114 } 2115 this._more = false; 2116 this._input = this._input.slice(match[0].length); 2117 this.matched += match[0]; 2118 token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); 2119 if (this.done && this._input) this.done = false; 2120 if (token) return token;else return; 2121 } 2122 if (this._input === "") { 2123 return this.EOF; 2124 } else { 2125 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: "", token: null, line: this.yylineno }); 2126 } 2127 }, 2128 lex: function lex() { 2129 var r = this.next(); 2130 if (typeof r !== 'undefined') { 2131 return r; 2132 } else { 2133 return this.lex(); 2134 } 2135 }, 2136 begin: function begin(condition) { 2137 this.conditionStack.push(condition); 2138 }, 2139 popState: function popState() { 2140 return this.conditionStack.pop(); 2141 }, 2142 _currentRules: function _currentRules() { 2143 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 2144 },
2145 topState: function topState() { 2146 return this.conditionStack[this.conditionStack.length - 2]; 2147 }, 2148 pushState: function begin(condition) { 2149 this.begin(condition); 2150 } }; 2151 lexer.options = {}; 2152 lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { 2153 2154 function strip(start, end) { 2155 return yy_.yytext = yy_.yytext.substring(start, yy_.yyleng - end + start); 2156 } 2157 switch ($avoiding_name_collisions) { 2158 case 0: 2159 if (yy_.yytext.slice(-2) === "\\\\") { 2160 strip(0, 1); 2161 this.begin("mu"); 2162 } else if (yy_.yytext.slice(-1) === "\\") { 2163 strip(0, 1); 2164 this.begin("emu"); 2165 } else { 2166 this.begin("mu"); 2167 } 2168 if (yy_.yytext) return 15; 2169 2170 break; 2171 case 1: 2172 return 15; 2173 case 2: 2174 this.popState(); 2175 return 15; 2176 case 3: 2177 this.begin('raw');return 15; 2178 case 4: 2179 this.popState(); 2180 // Should be using `this.topState()` below, but it currently 2181 // returns the second top instead of the first top. Opened an 2182 // issue about it at https://github.com/zaach/jison/issues/291 2183 if (this.conditionStack[this.conditionStack.length - 1] === 'raw') { 2184 return 15; 2185 } else { 2186 strip(5, 9); 2187 return 'END_RAW_BLOCK'; 2188 } 2189 case 5: 2190 return 15; 2191 case 6: 2192 this.popState(); 2193 return 14; 2194 case 7: 2195 return 65; 2196 case 8: 2197 return 68; 2198 case 9: 2199 return 19; 2200 case 10: 2201 this.popState(); 2202 this.begin('raw'); 2203 return 23; 2204 case 11: 2205 return 55; 2206 case 12: 2207 return 60; 2208 case 13: 2209 return 29; 2210 case 14: 2211 return 47; 2212 case 15: 2213 this.popState();return 44; 2214 case 16: 2215 this.popState();return 44; 2216 case 17: 2217 return 34; 2218 case 18: 2219 return 39; 2220 case 19: 2221 return 51; 2222 case 20: 2223 return 48; 2224 case 21: 2225 this.unput(yy_.yytext); 2226 this.popState(); 2227 this.begin('com'); 2228 2229 break; 2230 case 22: 2231 this.popState(); 2232 return 14; 2233 case 23: 2234 return 48; 2235 case 24: 2236 return 73; 2237 case 25: 2238 return 72; 2239 case 26: 2240 return 72; 2241 case 27: 2242 return 87; 2243 case 28: 2244 // ignore whitespace 2245 break; 2246 case 29: 2247 this.popState();return 54; 2248 case 30: 2249 this.popState();return 33; 2250 case 31: 2251 yy_.yytext = strip(1, 2).replace(/\\"/g, '"');return 80; 2252 case 32: 2253 yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 80; 2254 case 33: 2255 return 85; 2256 case 34: 2257 return 82; 2258 case 35: 2259 return 82; 2260 case 36: 2261 return 83; 2262 case 37: 2263 return 84; 2264 case 38: 2265 return 81; 2266 case 39: 2267 return 75; 2268 case 40: 2269 return 77; 2270 case 41: 2271 return 72; 2272 case 42: 2273 yy_.yytext = yy_.yytext.replace(/\\([\\\]])/g, '$1');return 72; 2274 case 43: 2275 return 'INVALID'; 2276 case 44: 2277 return 5; 2278 } 2279 }; 2280 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\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/]; 2281 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 } }; 2282 return lexer;
2283 })(); 2284 parser.lexer = lexer; 2285 function Parser() { 2286 this.yy = {}; 2287 }Parser.prototype = parser;parser.Parser = Parser; 2288 return new Parser(); 2289 })();exports$1["default"] = handlebars; 2290 module.exports = exports$1["default"]; 2291 2292 } (parser, parser.exports)); 2293 return parser.exports; 2294} 2295 2296var whitespaceControl = {exports: {}}; 2297 2298var visitor = {exports: {}}; 2299 2300var hasRequiredVisitor; 2301 2302function requireVisitor () { 2303 if (hasRequiredVisitor) return visitor.exports; 2304 hasRequiredVisitor = 1; 2305 (function (module, exports$1) { 2306 2307 exports$1.__esModule = true; 2308 // istanbul ignore next 2309 2310 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2311 2312 var _exception = requireException(); 2313 2314 var _exception2 = _interopRequireDefault(_exception); 2315 2316 function Visitor() { 2317 this.parents = []; 2318 } 2319 2320 Visitor.prototype = { 2321 constructor: Visitor, 2322 mutating: false, 2323 2324 // Visits a given value. If mutating, will replace the value if necessary. 2325 acceptKey: function acceptKey(node, name) { 2326 var value = this.accept(node[name]); 2327 if (this.mutating) { 2328 // Hacky sanity check: This may have a few false positives for type for the helper 2329 // methods but will generally do the right thing without a lot of overhead. 2330 if (value && !Visitor.prototype[value.type]) { 2331 throw new _exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); 2332 } 2333 node[name] = value; 2334 } 2335 }, 2336 2337 // Performs an accept operation with added sanity check to ensure 2338 // required keys are not removed. 2339 acceptRequired: function acceptRequired(node, name) { 2340 this.acceptKey(node, name); 2341 2342 if (!node[name]) { 2343 throw new _exception2['default'](node.type + ' requires ' + name); 2344 } 2345 }, 2346 2347 // Traverses a given array. If mutating, empty respnses will be removed 2348 // for child elements. 2349 acceptArray: function acceptArray(array) { 2350 for (var i = 0, l = array.length; i < l; i++) { 2351 this.acceptKey(array, i); 2352 2353 if (!array[i]) { 2354 array.splice(i, 1); 2355 i--; 2356 l--; 2357 } 2358 } 2359 }, 2360 2361 accept: function accept(object) { 2362 if (!object) { 2363 return; 2364 } 2365 2366 /* istanbul ignore next: Sanity code */ 2367 if (!this[object.type]) { 2368 throw new _exception2['default']('Unknown type: ' + object.type, object); 2369 } 2370 2371 if (this.current) { 2372 this.parents.unshift(this.current); 2373 } 2374 this.current = object; 2375 2376 var ret = this[object.type](object); 2377 2378 this.current = this.parents.shift(); 2379 2380 if (!this.mutating || ret) { 2381 return ret; 2382 } else if (ret !== false) { 2383 return object; 2384 } 2385 }, 2386 2387 Program: function Program(program) { 2388 this.acceptArray(program.body); 2389 }, 2390 2391 MustacheStatement: visitSubExpression, 2392 Decorator: visitSubExpression, 2393 2394 BlockStatement: visitBlock, 2395 DecoratorBlock: visitBlock, 2396 2397 PartialStatement: visitPartial, 2398 PartialBlockStatement: function PartialBlockStatement(partial) { 2399 visitPartial.call(this, partial); 2400 2401 this.acceptKey(partial, 'program'); 2402 }, 2403 2404 ContentStatement: function ContentStatement() /* content */{}, 2405 CommentStatement: function CommentStatement() /* comment */{}, 2406 2407 SubExpression: visitSubExpression, 2408 2409 PathExpression: function PathExpression() /* path */{}, 2410 2411 StringLiteral: function StringLiteral() /* string */{}, 2412 NumberLiteral: function NumberLiteral() /* number */{}, 2413 BooleanLiteral: function BooleanLiteral() /* bool */{}, 2414 UndefinedLiteral: function UndefinedLiteral() /* literal */{}, 2415 NullLiteral: function NullLiteral() /* literal */{}, 2416 2417 Hash: function Hash(hash) { 2418 this.acceptArray(hash.pairs); 2419 }, 2420 HashPair: function HashPair(pair) { 2421 this.acceptRequired(pair, 'value'); 2422 } 2423 }; 2424 2425 function visitSubExpression(mustache) { 2426 this.acceptRequired(mustache, 'path'); 2427 this.acceptArray(mustache.params); 2428 this.acceptKey(mustache, 'hash'); 2429 } 2430 function visitBlock(block) { 2431 visitSubExpression.call(this, block); 2432 2433 this.acceptKey(block, 'program'); 2434 this.acceptKey(block, 'inverse'); 2435 } 2436 function visitPartial(partial) { 2437 this.acceptRequired(partial, 'name'); 2438 this.acceptArray(partial.params); 2439 this.acceptKey(partial, 'hash'); 2440 } 2441 2442 exports$1['default'] = Visitor; 2443 module.exports = exports$1['default']; 2444 2445 } (visitor, visitor.exports)); 2446 return visitor.exports; 2447} 2448 2449var hasRequiredWhitespaceControl; 2450 2451function requireWhitespaceControl () { 2452 if (hasRequiredWhitespaceControl) return whitespaceControl.exports; 2453 hasRequiredWhitespaceControl = 1; 2454 (function (module, exports$1) { 2455 2456 exports$1.__esModule = true; 2457 // istanbul ignore next 2458 2459 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2460 2461 var _visitor = requireVisitor(); 2462 2463 var _visitor2 = _interopRequireDefault(_visitor); 2464 2465 function WhitespaceControl() { 2466 var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 2467 2468 this.options = options; 2469 } 2470 WhitespaceControl.prototype = new _visitor2['default'](); 2471 2472 WhitespaceControl.prototype.Program = function (program) { 2473 var doStandalone = !this.options.ignoreStandalone; 2474
vendor: 6,942 bytes, lines 2475-2696
2475 var isRoot = !this.isRootSeen; 2476 this.isRootSeen = true; 2477 2478 var body = program.body; 2479 for (var i = 0, l = body.length; i < l; i++) { 2480 var current = body[i], 2481 strip = this.accept(current); 2482 2483 if (!strip) { 2484 continue; 2485 } 2486 2487 var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), 2488 _isNextWhitespace = isNextWhitespace(body, i, isRoot), 2489 openStandalone = strip.openStandalone && _isPrevWhitespace, 2490 closeStandalone = strip.closeStandalone && _isNextWhitespace, 2491 inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; 2492 2493 if (strip.close) { 2494 omitRight(body, i, true); 2495 } 2496 if (strip.open) { 2497 omitLeft(body, i, true); 2498 } 2499 2500 if (doStandalone && inlineStandalone) { 2501 omitRight(body, i); 2502 2503 if (omitLeft(body, i)) { 2504 // If we are on a standalone node, save the indent info for partials 2505 if (current.type === 'PartialStatement') { 2506 // Pull out the whitespace from the final line 2507 current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; 2508 } 2509 } 2510 } 2511 if (doStandalone && openStandalone) { 2512 omitRight((current.program || current.inverse).body); 2513 2514 // Strip out the previous content node if it's whitespace only 2515 omitLeft(body, i); 2516 } 2517 if (doStandalone && closeStandalone) { 2518 // Always strip the next node 2519 omitRight(body, i); 2520 2521 omitLeft((current.inverse || current.program).body); 2522 } 2523 } 2524 2525 return program; 2526 }; 2527 2528 WhitespaceControl.prototype.BlockStatement = WhitespaceControl.prototype.DecoratorBlock = WhitespaceControl.prototype.PartialBlockStatement = function (block) { 2529 this.accept(block.program); 2530 this.accept(block.inverse); 2531 2532 // Find the inverse program that is involed with whitespace stripping. 2533 var program = block.program || block.inverse, 2534 inverse = block.program && block.inverse, 2535 firstInverse = inverse, 2536 lastInverse = inverse; 2537 2538 if (inverse && inverse.chained) { 2539 firstInverse = inverse.body[0].program; 2540 2541 // Walk the inverse chain to find the last inverse that is actually in the chain. 2542 while (lastInverse.chained) { 2543 lastInverse = lastInverse.body[lastInverse.body.length - 1].program; 2544 } 2545 } 2546 2547 var strip = { 2548 open: block.openStrip.open, 2549 close: block.closeStrip.close, 2550 2551 // Determine the standalone candiacy. Basically flag our content as being possibly standalone 2552 // so our parent can determine if we actually are standalone 2553 openStandalone: isNextWhitespace(program.body), 2554 closeStandalone: isPrevWhitespace((firstInverse || program).body) 2555 }; 2556 2557 if (block.openStrip.close) { 2558 omitRight(program.body, null, true); 2559 } 2560 2561 if (inverse) { 2562 var inverseStrip = block.inverseStrip; 2563 2564 if (inverseStrip.open) { 2565 omitLeft(program.body, null, true); 2566 } 2567 2568 if (inverseStrip.close) { 2569 omitRight(firstInverse.body, null, true); 2570 } 2571 if (block.closeStrip.open) { 2572 omitLeft(lastInverse.body, null, true); 2573 } 2574 2575 // Find standalone else statments 2576 if (!this.options.ignoreStandalone && isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { 2577 omitLeft(program.body); 2578 omitRight(firstInverse.body); 2579 } 2580 } else if (block.closeStrip.open) { 2581 omitLeft(program.body, null, true); 2582 } 2583 2584 return strip; 2585 }; 2586 2587 WhitespaceControl.prototype.Decorator = WhitespaceControl.prototype.MustacheStatement = function (mustache) { 2588 return mustache.strip; 2589 }; 2590 2591 WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { 2592 /* istanbul ignore next */ 2593 var strip = node.strip || {}; 2594 return { 2595 inlineStandalone: true, 2596 open: strip.open, 2597 close: strip.close 2598 }; 2599 }; 2600 2601 function isPrevWhitespace(body, i, isRoot) { 2602 if (i === undefined) { 2603 i = body.length; 2604 } 2605 2606 // Nodes that end with newlines are considered whitespace (but are special 2607 // cased for strip operations) 2608 var prev = body[i - 1], 2609 sibling = body[i - 2]; 2610 if (!prev) { 2611 return isRoot; 2612 } 2613 2614 if (prev.type === 'ContentStatement') { 2615 return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); 2616 } 2617 } 2618 function isNextWhitespace(body, i, isRoot) { 2619 if (i === undefined) { 2620 i = -1; 2621 } 2622 2623 var next = body[i + 1], 2624 sibling = body[i + 2]; 2625 if (!next) { 2626 return isRoot; 2627 } 2628 2629 if (next.type === 'ContentStatement') { 2630 return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); 2631 } 2632 } 2633 2634 // Marks the node to the right of the position as omitted. 2635 // I.e. {{foo}}' ' will mark the ' ' node as omitted. 2636 // 2637 // If i is undefined, then the first child will be marked as such. 2638 // 2639 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 2640 // content is met. 2641 function omitRight(body, i, multiple) { 2642 var current = body[i == null ? 0 : i + 1]; 2643 if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { 2644 return; 2645 } 2646 2647 var original = current.value; 2648 current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); 2649 current.rightStripped = current.value !== original; 2650 } 2651 2652 // Marks the node to the left of the position as omitted. 2653 // I.e. ' '{{foo}} will mark the ' ' node as omitted. 2654 // 2655 // If i is undefined then the last child will be marked as such. 2656 // 2657 // If mulitple is truthy then all whitespace will be stripped out until non-whitespace 2658 // content is met. 2659 function omitLeft(body, i, multiple) { 2660 var current = body[i == null ? body.length - 1 : i - 1]; 2661 if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { 2662 return; 2663 } 2664 2665 // We omit the last node if it's whitespace only and not preceded by a non-content node. 2666 var original = current.value; 2667 current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); 2668 current.leftStripped = current.value !== original; 2669 return current.leftStripped; 2670 } 2671 2672 exports$1['default'] = WhitespaceControl; 2673 module.exports = exports$1['default']; 2674 2675 } (whitespaceControl, whitespaceControl.exports)); 2676 return whitespaceControl.exports; 2677} 2678 2679var helpers = {}; 2680 2681var hasRequiredHelpers; 2682 2683function requireHelpers () { 2684 if (hasRequiredHelpers) return helpers; 2685 hasRequiredHelpers = 1; 2686 2687 helpers.__esModule = true; 2688 helpers.SourceLocation = SourceLocation; 2689 helpers.id = id; 2690 helpers.stripFlags = stripFlags; 2691 helpers.stripComment = stripComment; 2692 helpers.preparePath = preparePath; 2693 helpers.prepareMustache = prepareMustache; 2694 helpers.prepareRawBlock = prepareRawBlock; 2695 helpers.prepareBlock = prepareBlock; 2696 helpers.prepareProgram = prepareProgram;
vendor: 3,259 bytes, lines 2697-2828
2697 helpers.preparePartialBlock = preparePartialBlock; 2698 // istanbul ignore next 2699 2700 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2701 2702 var _exception = requireException(); 2703 2704 var _exception2 = _interopRequireDefault(_exception); 2705 2706 function validateClose(open, close) { 2707 close = close.path ? close.path.original : close; 2708 2709 if (open.path.original !== close) { 2710 var errorNode = { loc: open.path.loc }; 2711 2712 throw new _exception2['default'](open.path.original + " doesn't match " + close, errorNode); 2713 } 2714 } 2715 2716 function SourceLocation(source, locInfo) { 2717 this.source = source; 2718 this.start = { 2719 line: locInfo.first_line, 2720 column: locInfo.first_column 2721 }; 2722 this.end = { 2723 line: locInfo.last_line, 2724 column: locInfo.last_column 2725 }; 2726 } 2727 2728 function id(token) { 2729 if (/^\[.*\]$/.test(token)) { 2730 return token.substring(1, token.length - 1); 2731 } else { 2732 return token; 2733 } 2734 } 2735 2736 function stripFlags(open, close) { 2737 return { 2738 open: open.charAt(2) === '~', 2739 close: close.charAt(close.length - 3) === '~' 2740 }; 2741 } 2742 2743 function stripComment(comment) { 2744 return comment.replace(/^\{\{~?!-?-?/, '').replace(/-?-?~?\}\}$/, ''); 2745 } 2746 2747 function preparePath(data, parts, loc) { 2748 loc = this.locInfo(loc); 2749 2750 var original = data ? '@' : '', 2751 dig = [], 2752 depth = 0; 2753 2754 for (var i = 0, l = parts.length; i < l; i++) { 2755 var part = parts[i].part, 2756 2757 // If we have [] syntax then we do not treat path references as operators, 2758 // i.e. foo.[this] resolves to approximately context.foo['this'] 2759 isLiteral = parts[i].original !== part; 2760 original += (parts[i].separator || '') + part; 2761 2762 if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { 2763 if (dig.length > 0) { 2764 throw new _exception2['default']('Invalid path: ' + original, { loc: loc }); 2765 } else if (part === '..') { 2766 depth++; 2767 } 2768 } else { 2769 dig.push(part); 2770 } 2771 } 2772 2773 return { 2774 type: 'PathExpression', 2775 data: data, 2776 depth: depth, 2777 parts: dig, 2778 original: original, 2779 loc: loc 2780 }; 2781 } 2782 2783 function prepareMustache(path, params, hash, open, strip, locInfo) { 2784 // Must use charAt to support IE pre-10 2785 var escapeFlag = open.charAt(3) || open.charAt(2), 2786 escaped = escapeFlag !== '{' && escapeFlag !== '&'; 2787 2788 var decorator = /\*/.test(open); 2789 return { 2790 type: decorator ? 'Decorator' : 'MustacheStatement', 2791 path: path, 2792 params: params, 2793 hash: hash, 2794 escaped: escaped, 2795 strip: strip, 2796 loc: this.locInfo(locInfo) 2797 }; 2798 } 2799 2800 function prepareRawBlock(openRawBlock, contents, close, locInfo) { 2801 validateClose(openRawBlock, close); 2802 2803 locInfo = this.locInfo(locInfo); 2804 var program = { 2805 type: 'Program', 2806 body: contents, 2807 strip: {}, 2808 loc: locInfo 2809 }; 2810 2811 return { 2812 type: 'BlockStatement', 2813 path: openRawBlock.path, 2814 params: openRawBlock.params, 2815 hash: openRawBlock.hash, 2816 program: program, 2817 openStrip: {}, 2818 inverseStrip: {}, 2819 closeStrip: {}, 2820 loc: locInfo 2821 }; 2822 } 2823 2824 function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { 2825 if (close && close.path) { 2826 validateClose(openBlock, close); 2827 } 2828
2829 var decorator = /\*/.test(openBlock.open); 2830 2831 program.blockParams = openBlock.blockParams; 2832 2833 var inverse = undefined, 2834 inverseStrip = undefined; 2835 2836 if (inverseAndProgram) { 2837 if (decorator) { 2838 throw new _exception2['default']('Unexpected inverse block on decorator', inverseAndProgram); 2839 } 2840 2841 if (inverseAndProgram.chain) { 2842 inverseAndProgram.program.body[0].closeStrip = close.strip; 2843 } 2844 2845 inverseStrip = inverseAndProgram.strip; 2846 inverse = inverseAndProgram.program; 2847 } 2848 2849 if (inverted) { 2850 inverted = inverse; 2851 inverse = program; 2852 program = inverted; 2853 } 2854 2855 return { 2856 type: decorator ? 'DecoratorBlock' : 'BlockStatement', 2857 path: openBlock.path, 2858 params: openBlock.params, 2859 hash: openBlock.hash, 2860 program: program, 2861 inverse: inverse, 2862 openStrip: openBlock.strip, 2863 inverseStrip: inverseStrip, 2864 closeStrip: close && close.strip, 2865 loc: this.locInfo(locInfo) 2866 }; 2867 } 2868 2869 function prepareProgram(statements, loc) { 2870 if (!loc && statements.length) { 2871 var firstLoc = statements[0].loc, 2872 lastLoc = statements[statements.length - 1].loc; 2873 2874 /* istanbul ignore else */ 2875 if (firstLoc && lastLoc) { 2876 loc = { 2877 source: firstLoc.source, 2878 start: { 2879 line: firstLoc.start.line, 2880 column: firstLoc.start.column 2881 }, 2882 end: { 2883 line: lastLoc.end.line, 2884 column: lastLoc.end.column 2885 } 2886 }; 2887 } 2888 } 2889 2890 return { 2891 type: 'Program', 2892 body: statements, 2893 strip: {}, 2894 loc: loc 2895 }; 2896 } 2897 2898 function preparePartialBlock(open, program, close, locInfo) { 2899 validateClose(open, close); 2900 2901 return { 2902 type: 'PartialBlockStatement', 2903 name: open.path, 2904 params: open.params, 2905 hash: open.hash, 2906 program: program, 2907 openStrip: open.strip, 2908 closeStrip: close && close.strip, 2909 loc: this.locInfo(locInfo) 2910 }; 2911 } 2912 2913 return helpers; 2914} 2915 2916var hasRequiredBase; 2917 2918function requireBase () { 2919 if (hasRequiredBase) return base; 2920 hasRequiredBase = 1; 2921 2922 base.__esModule = true; 2923 base.parseWithoutProcessing = parseWithoutProcessing; 2924 base.parse = parse; 2925 // istanbul ignore next 2926 2927 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } 2928 2929 // istanbul ignore next 2930 2931 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2932 2933 var _parser = requireParser(); 2934 2935 var _parser2 = _interopRequireDefault(_parser); 2936 2937 var _whitespaceControl = requireWhitespaceControl(); 2938 2939 var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); 2940 2941 var _helpers = requireHelpers(); 2942 2943 var Helpers = _interopRequireWildcard(_helpers); 2944 2945 var _utils = requireUtils(); 2946 2947 base.parser = _parser2['default']; 2948 2949 var yy = {}; 2950 _utils.extend(yy, Helpers); 2951 2952 function parseWithoutProcessing(input, options) { 2953 // Just return if an already-compiled AST was passed in. 2954 if (input.type === 'Program') { 2955 return input; 2956 } 2957 2958 _parser2['default'].yy = yy; 2959 2960 // Altering the shared object here, but this is ok as parser is a sync operation 2961 yy.locInfo = function (locInfo) { 2962 return new yy.SourceLocation(options && options.srcName, locInfo); 2963 }; 2964 2965 var ast = _parser2['default'].parse(input); 2966 2967 return ast; 2968 } 2969 2970 function parse(input, options) { 2971 var ast = parseWithoutProcessing(input, options); 2972 var strip = new _whitespaceControl2['default'](options); 2973 2974 return strip.accept(ast); 2975 } 2976 2977 return base; 2978} 2979 2980var compiler = {}; 2981 2982/* eslint-disable new-cap */ 2983 2984var hasRequiredCompiler; 2985 2986function requireCompiler () { 2987 if (hasRequiredCompiler) return compiler; 2988 hasRequiredCompiler = 1; 2989 2990 compiler.__esModule = true; 2991 compiler.Compiler = Compiler; 2992 compiler.precompile = precompile; 2993 compiler.compile = compile; 2994 // istanbul ignore next 2995 2996 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 2997 2998 var _exception = requireException(); 2999 3000 var _exception2 = _interopRequireDefault(_exception); 3001 3002 var _utils = requireUtils(); 3003 3004 var _ast = requireAst(); 3005 3006 var _ast2 = _interopRequireDefault(_ast); 3007 3008 var slice = [].slice; 3009 3010 function Compiler() {} 3011 3012 // the foundHelper register will disambiguate helper lookup from finding a 3013 // function in a context. This is necessary for mustache compatibility, which 3014 // requires that context functions in blocks are evaluated by blockHelperMissing, 3015 // and then proceed as if the resulting value was provided to blockHelperMissing. 3016 3017 Compiler.prototype = { 3018 compiler: Compiler, 3019 3020 equals: function equals(other) { 3021 var len = this.opcodes.length; 3022 if (other.opcodes.length !== len) { 3023 return false;
vendor: 14,589 bytes, lines 3024-3521
3024 } 3025 3026 for (var i = 0; i < len; i++) { 3027 var opcode = this.opcodes[i], 3028 otherOpcode = other.opcodes[i]; 3029 if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { 3030 return false; 3031 } 3032 } 3033 3034 // We know that length is the same between the two arrays because they are directly tied 3035 // to the opcode behavior above. 3036 len = this.children.length; 3037 for (var i = 0; i < len; i++) { 3038 if (!this.children[i].equals(other.children[i])) { 3039 return false; 3040 } 3041 } 3042 3043 return true; 3044 }, 3045 3046 guid: 0, 3047 3048 compile: function compile(program, options) { 3049 this.sourceNode = []; 3050 this.opcodes = []; 3051 this.children = []; 3052 this.options = options; 3053 this.stringParams = options.stringParams; 3054 this.trackIds = options.trackIds; 3055 3056 options.blockParams = options.blockParams || []; 3057 3058 options.knownHelpers = _utils.extend(Object.create(null), { 3059 helperMissing: true, 3060 blockHelperMissing: true, 3061 each: true, 3062 'if': true, 3063 unless: true, 3064 'with': true, 3065 log: true, 3066 lookup: true 3067 }, options.knownHelpers); 3068 3069 return this.accept(program); 3070 }, 3071 3072 compileProgram: function compileProgram(program) { 3073 var childCompiler = new this.compiler(), 3074 // eslint-disable-line new-cap 3075 result = childCompiler.compile(program, this.options), 3076 guid = this.guid++; 3077 3078 this.usePartial = this.usePartial || result.usePartial; 3079 3080 this.children[guid] = result; 3081 this.useDepths = this.useDepths || result.useDepths; 3082 3083 return guid; 3084 }, 3085 3086 accept: function accept(node) { 3087 /* istanbul ignore next: Sanity code */ 3088 if (!this[node.type]) { 3089 throw new _exception2['default']('Unknown type: ' + node.type, node); 3090 } 3091 3092 this.sourceNode.unshift(node); 3093 var ret = this[node.type](node); 3094 this.sourceNode.shift(); 3095 return ret; 3096 }, 3097 3098 Program: function Program(program) { 3099 this.options.blockParams.unshift(program.blockParams); 3100 3101 var body = program.body, 3102 bodyLength = body.length; 3103 for (var i = 0; i < bodyLength; i++) { 3104 this.accept(body[i]); 3105 } 3106 3107 this.options.blockParams.shift(); 3108 3109 this.isSimple = bodyLength === 1; 3110 this.blockParams = program.blockParams ? program.blockParams.length : 0; 3111 3112 return this; 3113 }, 3114 3115 BlockStatement: function BlockStatement(block) { 3116 transformLiteralToPath(block); 3117 3118 var program = block.program, 3119 inverse = block.inverse; 3120 3121 program = program && this.compileProgram(program); 3122 inverse = inverse && this.compileProgram(inverse); 3123 3124 var type = this.classifySexpr(block); 3125 3126 if (type === 'helper') { 3127 this.helperSexpr(block, program, inverse); 3128 } else if (type === 'simple') { 3129 this.simpleSexpr(block); 3130 3131 // now that the simple mustache is resolved, we need to 3132 // evaluate it by executing `blockHelperMissing` 3133 this.opcode('pushProgram', program); 3134 this.opcode('pushProgram', inverse); 3135 this.opcode('emptyHash'); 3136 this.opcode('blockValue', block.path.original); 3137 } else { 3138 this.ambiguousSexpr(block, program, inverse); 3139 3140 // now that the simple mustache is resolved, we need to 3141 // evaluate it by executing `blockHelperMissing` 3142 this.opcode('pushProgram', program); 3143 this.opcode('pushProgram', inverse); 3144 this.opcode('emptyHash'); 3145 this.opcode('ambiguousBlockValue'); 3146 } 3147 3148 this.opcode('append'); 3149 }, 3150 3151 DecoratorBlock: function DecoratorBlock(decorator) { 3152 var program = decorator.program && this.compileProgram(decorator.program); 3153 var params = this.setupFullMustacheParams(decorator, program, undefined), 3154 path = decorator.path; 3155 3156 this.useDecorators = true; 3157 this.opcode('registerDecorator', params.length, path.original); 3158 }, 3159 3160 PartialStatement: function PartialStatement(partial) { 3161 this.usePartial = true; 3162 3163 var program = partial.program; 3164 if (program) { 3165 program = this.compileProgram(partial.program); 3166 } 3167 3168 var params = partial.params; 3169 if (params.length > 1) { 3170 throw new _exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); 3171 } else if (!params.length) { 3172 if (this.options.explicitPartialContext) { 3173 this.opcode('pushLiteral', 'undefined'); 3174 } else { 3175 params.push({ type: 'PathExpression', parts: [], depth: 0 }); 3176 } 3177 } 3178 3179 var partialName = partial.name.original, 3180 isDynamic = partial.name.type === 'SubExpression'; 3181 if (isDynamic) { 3182 this.accept(partial.name); 3183 } 3184 3185 this.setupFullMustacheParams(partial, program, undefined, true); 3186 3187 var indent = partial.indent || ''; 3188 if (this.options.preventIndent && indent) { 3189 this.opcode('appendContent', indent); 3190 indent = ''; 3191 } 3192 3193 this.opcode('invokePartial', isDynamic, partialName, indent); 3194 this.opcode('append'); 3195 }, 3196 PartialBlockStatement: function PartialBlockStatement(partialBlock) { 3197 this.PartialStatement(partialBlock); 3198 }, 3199 3200 MustacheStatement: function MustacheStatement(mustache) { 3201 this.SubExpression(mustache); 3202 3203 if (mustache.escaped && !this.options.noEscape) { 3204 this.opcode('appendEscaped'); 3205 } else { 3206 this.opcode('append'); 3207 } 3208 }, 3209 Decorator: function Decorator(decorator) { 3210 this.DecoratorBlock(decorator); 3211 }, 3212 3213 ContentStatement: function ContentStatement(content) { 3214 if (content.value) { 3215 this.opcode('appendContent', content.value); 3216 } 3217 }, 3218 3219 CommentStatement: function CommentStatement() {}, 3220 3221 SubExpression: function SubExpression(sexpr) { 3222 transformLiteralToPath(sexpr); 3223 var type = this.classifySexpr(sexpr); 3224 3225 if (type === 'simple') { 3226 this.simpleSexpr(sexpr); 3227 } else if (type === 'helper') { 3228 this.helperSexpr(sexpr); 3229 } else { 3230 this.ambiguousSexpr(sexpr); 3231 } 3232 }, 3233 ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { 3234 var path = sexpr.path, 3235 name = path.parts[0], 3236 isBlock = program != null || inverse != null; 3237 3238 this.opcode('getContext', path.depth); 3239 3240 this.opcode('pushProgram', program); 3241 this.opcode('pushProgram', inverse); 3242 3243 path.strict = true; 3244 this.accept(path); 3245 3246 this.opcode('invokeAmbiguous', name, isBlock); 3247 }, 3248 3249 simpleSexpr: function simpleSexpr(sexpr) { 3250 var path = sexpr.path; 3251 path.strict = true; 3252 this.accept(path); 3253 this.opcode('resolvePossibleLambda'); 3254 }, 3255 3256 helperSexpr: function helperSexpr(sexpr, program, inverse) { 3257 var params = this.setupFullMustacheParams(sexpr, program, inverse), 3258 path = sexpr.path, 3259 name = path.parts[0]; 3260 3261 if (this.options.knownHelpers[name]) { 3262 this.opcode('invokeKnownHelper', params.length, name); 3263 } else if (this.options.knownHelpersOnly) { 3264 throw new _exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); 3265 } else { 3266 path.strict = true; 3267 path.falsy = true; 3268 3269 this.accept(path); 3270 this.opcode('invokeHelper', params.length, path.original, _ast2['default'].helpers.simpleId(path)); 3271 } 3272 }, 3273 3274 PathExpression: function PathExpression(path) { 3275 this.addDepth(path.depth); 3276 this.opcode('getContext', path.depth); 3277 3278 var name = path.parts[0], 3279 scoped = _ast2['default'].helpers.scopedId(path), 3280 blockParamId = !path.depth && !scoped && this.blockParamIndex(name); 3281 3282 if (blockParamId) { 3283 this.opcode('lookupBlockParam', blockParamId, path.parts); 3284 } else if (!name) { 3285 // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` 3286 this.opcode('pushContext'); 3287 } else if (path.data) { 3288 this.options.data = true; 3289 this.opcode('lookupData', path.depth, path.parts, path.strict); 3290 } else { 3291 this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped); 3292 } 3293 }, 3294 3295 StringLiteral: function StringLiteral(string) { 3296 this.opcode('pushString', string.value); 3297 }, 3298 3299 NumberLiteral: function NumberLiteral(number) { 3300 this.opcode('pushLiteral', number.value); 3301 }, 3302 3303 BooleanLiteral: function BooleanLiteral(bool) { 3304 this.opcode('pushLiteral', bool.value); 3305 }, 3306 3307 UndefinedLiteral: function UndefinedLiteral() { 3308 this.opcode('pushLiteral', 'undefined'); 3309 }, 3310 3311 NullLiteral: function NullLiteral() { 3312 this.opcode('pushLiteral', 'null'); 3313 }, 3314 3315 Hash: function Hash(hash) { 3316 var pairs = hash.pairs, 3317 i = 0, 3318 l = pairs.length; 3319 3320 this.opcode('pushHash'); 3321 3322 for (; i < l; i++) { 3323 this.pushParam(pairs[i].value); 3324 } 3325 while (i--) { 3326 this.opcode('assignToHash', pairs[i].key); 3327 } 3328 this.opcode('popHash'); 3329 }, 3330 3331 // HELPERS 3332 opcode: function opcode(name) { 3333 this.opcodes.push({ 3334 opcode: name, 3335 args: slice.call(arguments, 1), 3336 loc: this.sourceNode[0].loc 3337 }); 3338 }, 3339 3340 addDepth: function addDepth(depth) { 3341 if (!depth) { 3342 return; 3343 } 3344 3345 this.useDepths = true; 3346 }, 3347 3348 classifySexpr: function classifySexpr(sexpr) { 3349 var isSimple = _ast2['default'].helpers.simpleId(sexpr.path); 3350 3351 var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); 3352 3353 // a mustache is an eligible helper if: 3354 // * its id is simple (a single part, not `this` or `..`) 3355 var isHelper = !isBlockParam && _ast2['default'].helpers.helperExpression(sexpr); 3356 3357 // if a mustache is an eligible helper but not a definite 3358 // helper, it is ambiguous, and will be resolved in a later 3359 // pass or at runtime. 3360 var isEligible = !isBlockParam && (isHelper || isSimple); 3361 3362 // if ambiguous, we can possibly resolve the ambiguity now 3363 // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. 3364 if (isEligible && !isHelper) { 3365 var _name = sexpr.path.parts[0], 3366 options = this.options; 3367 if (options.knownHelpers[_name]) { 3368 isHelper = true; 3369 } else if (options.knownHelpersOnly) { 3370 isEligible = false; 3371 } 3372 } 3373 3374 if (isHelper) { 3375 return 'helper'; 3376 } else if (isEligible) { 3377 return 'ambiguous'; 3378 } else { 3379 return 'simple'; 3380 } 3381 }, 3382 3383 pushParams: function pushParams(params) { 3384 for (var i = 0, l = params.length; i < l; i++) { 3385 this.pushParam(params[i]); 3386 } 3387 }, 3388 3389 pushParam: function pushParam(val) { 3390 var value = val.value != null ? val.value : val.original || ''; 3391 3392 if (this.stringParams) { 3393 if (value.replace) { 3394 value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); 3395 } 3396 3397 if (val.depth) { 3398 this.addDepth(val.depth); 3399 } 3400 this.opcode('getContext', val.depth || 0); 3401 this.opcode('pushStringParam', value, val.type); 3402 3403 if (val.type === 'SubExpression') { 3404 // SubExpressions get evaluated and passed in 3405 // in string params mode. 3406 this.accept(val); 3407 } 3408 } else { 3409 if (this.trackIds) { 3410 var blockParamIndex = undefined; 3411 if (val.parts && !_ast2['default'].helpers.scopedId(val) && !val.depth) { 3412 blockParamIndex = this.blockParamIndex(val.parts[0]); 3413 } 3414 if (blockParamIndex) { 3415 var blockParamChild = val.parts.slice(1).join('.'); 3416 this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); 3417 } else { 3418 value = val.original || value; 3419 if (value.replace) { 3420 value = value.replace(/^this(?:\.|$)/, '').replace(/^\.\//, '').replace(/^\.$/, ''); 3421 } 3422 3423 this.opcode('pushId', val.type, value); 3424 } 3425 } 3426 this.accept(val); 3427 } 3428 }, 3429 3430 setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { 3431 var params = sexpr.params; 3432 this.pushParams(params); 3433 3434 this.opcode('pushProgram', program); 3435 this.opcode('pushProgram', inverse); 3436 3437 if (sexpr.hash) { 3438 this.accept(sexpr.hash); 3439 } else { 3440 this.opcode('emptyHash', omitEmpty); 3441 } 3442 3443 return params; 3444 }, 3445 3446 blockParamIndex: function blockParamIndex(name) { 3447 for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { 3448 var blockParams = this.options.blockParams[depth], 3449 param = blockParams && _utils.indexOf(blockParams, name); 3450 if (blockParams && param >= 0) { 3451 return [depth, param]; 3452 } 3453 } 3454 } 3455 }; 3456 3457 function precompile(input, options, env) { 3458 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 3459 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); 3460 } 3461 3462 options = options || {}; 3463 if (!('data' in options)) { 3464 options.data = true; 3465 } 3466 if (options.compat) { 3467 options.useDepths = true; 3468 } 3469 3470 var ast = env.parse(input, options), 3471 environment = new env.Compiler().compile(ast, options); 3472 return new env.JavaScriptCompiler().compile(environment, options); 3473 } 3474 3475 function compile(input, options, env) { 3476 if (options === undefined) options = {}; 3477 3478 if (input == null || typeof input !== 'string' && input.type !== 'Program') { 3479 throw new _exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); 3480 } 3481 3482 options = _utils.extend({}, options); 3483 if (!('data' in options)) { 3484 options.data = true; 3485 } 3486 if (options.compat) { 3487 options.useDepths = true; 3488 } 3489 3490 var compiled = undefined; 3491 3492 function compileInput() { 3493 var ast = env.parse(input, options), 3494 environment = new env.Compiler().compile(ast, options), 3495 templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); 3496 return env.template(templateSpec); 3497 } 3498 3499 // Template is only compiled on first use and cached after that point. 3500 function ret(context, execOptions) { 3501 if (!compiled) { 3502 compiled = compileInput(); 3503 } 3504 return compiled.call(this, context, execOptions); 3505 } 3506 ret._setup = function (setupOptions) { 3507 if (!compiled) { 3508 compiled = compileInput(); 3509 } 3510 return compiled._setup(setupOptions); 3511 }; 3512 ret._child = function (i, data, blockParams, depths) { 3513 if (!compiled) { 3514 compiled = compileInput(); 3515 } 3516 return compiled._child(i, data, blockParams, depths); 3517 }; 3518 return ret; 3519 } 3520 3521 function argEquals(a, b) {
3522 if (a === b) { 3523 return true; 3524 } 3525 3526 if (_utils.isArray(a) && _utils.isArray(b) && a.length === b.length) { 3527 for (var i = 0; i < a.length; i++) { 3528 if (!argEquals(a[i], b[i])) { 3529 return false; 3530 } 3531 } 3532 return true; 3533 } 3534 } 3535 3536 function transformLiteralToPath(sexpr) { 3537 if (!sexpr.path.parts) { 3538 var literal = sexpr.path; 3539 // Casting to string here to make false and 0 literal values play nicely with the rest 3540 // of the system. 3541 sexpr.path = { 3542 type: 'PathExpression', 3543 data: false, 3544 depth: 0, 3545 parts: [literal.original + ''], 3546 original: literal.original + '', 3547 loc: literal.loc 3548 }; 3549 } 3550 } 3551 3552 return compiler; 3553} 3554 3555var javascriptCompiler = {exports: {}}; 3556 3557var codeGen = {exports: {}}; 3558 3559var sourceMap = {}; 3560 3561var sourceMapGenerator = {}; 3562 3563var base64Vlq = {}; 3564 3565var base64 = {}; 3566 3567/* -*- Mode: js; js-indent-level: 2; -*- */ 3568 3569var hasRequiredBase64; 3570 3571function requireBase64 () { 3572 if (hasRequiredBase64) return base64; 3573 hasRequiredBase64 = 1; 3574 /* 3575 * Copyright 2011 Mozilla Foundation and contributors 3576 * Licensed under the New BSD license. See LICENSE or: 3577 * http://opensource.org/licenses/BSD-3-Clause 3578 */ 3579 3580 var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); 3581 3582 /** 3583 * Encode an integer in the range of 0 to 63 to a single base 64 digit. 3584 */ 3585 base64.encode = function (number) { 3586 if (0 <= number && number < intToCharMap.length) { 3587 return intToCharMap[number]; 3588 } 3589 throw new TypeError("Must be between 0 and 63: " + number); 3590 }; 3591 3592 /** 3593 * Decode a single base 64 character code digit to an integer. Returns -1 on 3594 * failure. 3595 */ 3596 base64.decode = function (charCode) { 3597 var bigA = 65; // 'A' 3598 var bigZ = 90; // 'Z' 3599 3600 var littleA = 97; // 'a' 3601 var littleZ = 122; // 'z' 3602 3603 var zero = 48; // '0' 3604 var nine = 57; // '9' 3605 3606 var plus = 43; // '+' 3607 var slash = 47; // '/' 3608 3609 var littleOffset = 26; 3610 var numberOffset = 52; 3611 3612 // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ 3613 if (bigA <= charCode && charCode <= bigZ) { 3614 return (charCode - bigA); 3615 } 3616 3617 // 26 - 51: abcdefghijklmnopqrstuvwxyz 3618 if (littleA <= charCode && charCode <= littleZ) { 3619 return (charCode - littleA + littleOffset); 3620 } 3621 3622 // 52 - 61: 0123456789 3623 if (zero <= charCode && charCode <= nine) { 3624 return (charCode - zero + numberOffset); 3625 } 3626 3627 // 62: + 3628 if (charCode == plus) { 3629 return 62; 3630 } 3631 3632 // 63: / 3633 if (charCode == slash) { 3634 return 63; 3635 } 3636 3637 // Invalid base64 digit. 3638 return -1; 3639 }; 3640 return base64; 3641} 3642 3643/* -*- Mode: js; js-indent-level: 2; -*- */ 3644 3645var hasRequiredBase64Vlq; 3646 3647function requireBase64Vlq () { 3648 if (hasRequiredBase64Vlq) return base64Vlq; 3649 hasRequiredBase64Vlq = 1; 3650 /* 3651 * Copyright 2011 Mozilla Foundation and contributors 3652 * Licensed under the New BSD license. See LICENSE or: 3653 * http://opensource.org/licenses/BSD-3-Clause 3654 * 3655 * Based on the Base 64 VLQ implementation in Closure Compiler: 3656 * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java 3657 * 3658 * Copyright 2011 The Closure Compiler Authors. All rights reserved. 3659 * Redistribution and use in source and binary forms, with or without 3660 * modification, are permitted provided that the following conditions are 3661 * met: 3662 * 3663 * * Redistributions of source code must retain the above copyright 3664 * notice, this list of conditions and the following disclaimer. 3665 * * Redistributions in binary form must reproduce the above 3666 * copyright notice, this list of conditions and the following 3667 * disclaimer in the documentation and/or other materials provided 3668 * with the distribution. 3669 * * Neither the name of Google Inc. nor the names of its 3670 * contributors may be used to endorse or promote products derived 3671 * from this software without specific prior written permission. 3672 * 3673 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3674 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3675 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3676 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3677 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
vendor: 23,888 bytes, lines 3678-4531
3678 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3679 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3680 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3681 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3682 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3683 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3684 */ 3685 3686 var base64 = requireBase64(); 3687 3688 // A single base 64 digit can contain 6 bits of data. For the base 64 variable 3689 // length quantities we use in the source map spec, the first bit is the sign, 3690 // the next four bits are the actual value, and the 6th bit is the 3691 // continuation bit. The continuation bit tells us whether there are more 3692 // digits in this value following this digit. 3693 // 3694 // Continuation 3695 // | Sign 3696 // | | 3697 // V V 3698 // 101011 3699 3700 var VLQ_BASE_SHIFT = 5; 3701 3702 // binary: 100000 3703 var VLQ_BASE = 1 << VLQ_BASE_SHIFT; 3704 3705 // binary: 011111 3706 var VLQ_BASE_MASK = VLQ_BASE - 1; 3707 3708 // binary: 100000 3709 var VLQ_CONTINUATION_BIT = VLQ_BASE; 3710 3711 /** 3712 * Converts from a two-complement value to a value where the sign bit is 3713 * placed in the least significant bit. For example, as decimals: 3714 * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) 3715 * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) 3716 */ 3717 function toVLQSigned(aValue) { 3718 return aValue < 0 3719 ? ((-aValue) << 1) + 1 3720 : (aValue << 1) + 0; 3721 } 3722 3723 /** 3724 * Converts to a two-complement value from a value where the sign bit is 3725 * placed in the least significant bit. For example, as decimals: 3726 * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 3727 * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 3728 */ 3729 function fromVLQSigned(aValue) { 3730 var isNegative = (aValue & 1) === 1; 3731 var shifted = aValue >> 1; 3732 return isNegative 3733 ? -shifted 3734 : shifted; 3735 } 3736 3737 /** 3738 * Returns the base 64 VLQ encoded value. 3739 */ 3740 base64Vlq.encode = function base64VLQ_encode(aValue) { 3741 var encoded = ""; 3742 var digit; 3743 3744 var vlq = toVLQSigned(aValue); 3745 3746 do { 3747 digit = vlq & VLQ_BASE_MASK; 3748 vlq >>>= VLQ_BASE_SHIFT; 3749 if (vlq > 0) { 3750 // There are still more digits in this value, so we must make sure the 3751 // continuation bit is marked. 3752 digit |= VLQ_CONTINUATION_BIT; 3753 } 3754 encoded += base64.encode(digit); 3755 } while (vlq > 0); 3756 3757 return encoded; 3758 }; 3759 3760 /** 3761 * Decodes the next base 64 VLQ value from the given string and returns the 3762 * value and the rest of the string via the out parameter. 3763 */ 3764 base64Vlq.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { 3765 var strLen = aStr.length; 3766 var result = 0; 3767 var shift = 0; 3768 var continuation, digit; 3769 3770 do { 3771 if (aIndex >= strLen) { 3772 throw new Error("Expected more digits in base 64 VLQ value."); 3773 } 3774 3775 digit = base64.decode(aStr.charCodeAt(aIndex++)); 3776 if (digit === -1) { 3777 throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); 3778 } 3779 3780 continuation = !!(digit & VLQ_CONTINUATION_BIT); 3781 digit &= VLQ_BASE_MASK; 3782 result = result + (digit << shift); 3783 shift += VLQ_BASE_SHIFT; 3784 } while (continuation); 3785 3786 aOutParam.value = fromVLQSigned(result); 3787 aOutParam.rest = aIndex; 3788 }; 3789 return base64Vlq; 3790} 3791 3792var util = {}; 3793 3794/* -*- Mode: js; js-indent-level: 2; -*- */ 3795 3796var hasRequiredUtil; 3797 3798function requireUtil () { 3799 if (hasRequiredUtil) return util; 3800 hasRequiredUtil = 1; 3801 (function (exports$1) { 3802 /* 3803 * Copyright 2011 Mozilla Foundation and contributors 3804 * Licensed under the New BSD license. See LICENSE or: 3805 * http://opensource.org/licenses/BSD-3-Clause 3806 */ 3807 3808 /** 3809 * This is a helper function for getting values from parameter/options 3810 * objects. 3811 * 3812 * @param args The object we are extracting values from 3813 * @param name The name of the property we are getting. 3814 * @param defaultValue An optional value to return if the property is missing 3815 * from the object. If this is not specified and the property is missing, an 3816 * error will be thrown. 3817 */ 3818 function getArg(aArgs, aName, aDefaultValue) { 3819 if (aName in aArgs) { 3820 return aArgs[aName]; 3821 } else if (arguments.length === 3) { 3822 return aDefaultValue; 3823 } else { 3824 throw new Error('"' + aName + '" is a required argument.'); 3825 } 3826 } 3827 exports$1.getArg = getArg; 3828 3829 var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; 3830 var dataUrlRegexp = /^data:.+\,.+$/; 3831 3832 function urlParse(aUrl) { 3833 var match = aUrl.match(urlRegexp); 3834 if (!match) { 3835 return null; 3836 } 3837 return { 3838 scheme: match[1], 3839 auth: match[2], 3840 host: match[3], 3841 port: match[4], 3842 path: match[5] 3843 }; 3844 } 3845 exports$1.urlParse = urlParse; 3846 3847 function urlGenerate(aParsedUrl) { 3848 var url = ''; 3849 if (aParsedUrl.scheme) { 3850 url += aParsedUrl.scheme + ':'; 3851 } 3852 url += '//'; 3853 if (aParsedUrl.auth) { 3854 url += aParsedUrl.auth + '@'; 3855 } 3856 if (aParsedUrl.host) { 3857 url += aParsedUrl.host; 3858 } 3859 if (aParsedUrl.port) { 3860 url += ":" + aParsedUrl.port; 3861 } 3862 if (aParsedUrl.path) { 3863 url += aParsedUrl.path; 3864 } 3865 return url; 3866 } 3867 exports$1.urlGenerate = urlGenerate; 3868 3869 /** 3870 * Normalizes a path, or the path portion of a URL: 3871 * 3872 * - Replaces consecutive slashes with one slash. 3873 * - Removes unnecessary '.' parts. 3874 * - Removes unnecessary '<dir>/..' parts. 3875 * 3876 * Based on code in the Node.js 'path' core module. 3877 * 3878 * @param aPath The path or url to normalize. 3879 */ 3880 function normalize(aPath) { 3881 var path = aPath; 3882 var url = urlParse(aPath); 3883 if (url) { 3884 if (!url.path) { 3885 return aPath; 3886 } 3887 path = url.path; 3888 } 3889 var isAbsolute = exports$1.isAbsolute(path); 3890 3891 var parts = path.split(/\/+/); 3892 for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { 3893 part = parts[i]; 3894 if (part === '.') { 3895 parts.splice(i, 1); 3896 } else if (part === '..') { 3897 up++; 3898 } else if (up > 0) { 3899 if (part === '') { 3900 // The first part is blank if the path is absolute. Trying to go 3901 // above the root is a no-op. Therefore we can remove all '..' parts 3902 // directly after the root. 3903 parts.splice(i + 1, up); 3904 up = 0; 3905 } else { 3906 parts.splice(i, 2); 3907 up--; 3908 } 3909 } 3910 } 3911 path = parts.join('/'); 3912 3913 if (path === '') { 3914 path = isAbsolute ? '/' : '.'; 3915 } 3916 3917 if (url) { 3918 url.path = path; 3919 return urlGenerate(url); 3920 } 3921 return path; 3922 } 3923 exports$1.normalize = normalize; 3924 3925 /** 3926 * Joins two paths/URLs. 3927 * 3928 * @param aRoot The root path or URL. 3929 * @param aPath The path or URL to be joined with the root. 3930 * 3931 * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a 3932 * scheme-relative URL: Then the scheme of aRoot, if any, is prepended 3933 * first. 3934 * - Otherwise aPath is a path. If aRoot is a URL, then its path portion 3935 * is updated with the result and aRoot is returned. Otherwise the result 3936 * is returned. 3937 * - If aPath is absolute, the result is aPath. 3938 * - Otherwise the two paths are joined with a slash. 3939 * - Joining for example 'http://' and 'www.example.com' is also supported. 3940 */ 3941 function join(aRoot, aPath) { 3942 if (aRoot === "") { 3943 aRoot = "."; 3944 } 3945 if (aPath === "") { 3946 aPath = "."; 3947 } 3948 var aPathUrl = urlParse(aPath); 3949 var aRootUrl = urlParse(aRoot); 3950 if (aRootUrl) { 3951 aRoot = aRootUrl.path || '/'; 3952 } 3953 3954 // `join(foo, '//www.example.org')` 3955 if (aPathUrl && !aPathUrl.scheme) { 3956 if (aRootUrl) { 3957 aPathUrl.scheme = aRootUrl.scheme; 3958 } 3959 return urlGenerate(aPathUrl); 3960 } 3961 3962 if (aPathUrl || aPath.match(dataUrlRegexp)) { 3963 return aPath; 3964 } 3965 3966 // `join('http://', 'www.example.com')` 3967 if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { 3968 aRootUrl.host = aPath; 3969 return urlGenerate(aRootUrl); 3970 } 3971 3972 var joined = aPath.charAt(0) === '/' 3973 ? aPath 3974 : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); 3975 3976 if (aRootUrl) { 3977 aRootUrl.path = joined; 3978 return urlGenerate(aRootUrl); 3979 } 3980 return joined; 3981 } 3982 exports$1.join = join; 3983 3984 exports$1.isAbsolute = function (aPath) { 3985 return aPath.charAt(0) === '/' || urlRegexp.test(aPath); 3986 }; 3987 3988 /** 3989 * Make a path relative to a URL or another path. 3990 * 3991 * @param aRoot The root path or URL. 3992 * @param aPath The path or URL to be made relative to aRoot. 3993 */ 3994 function relative(aRoot, aPath) { 3995 if (aRoot === "") { 3996 aRoot = "."; 3997 } 3998 3999 aRoot = aRoot.replace(/\/$/, ''); 4000 4001 // It is possible for the path to be above the root. In this case, simply 4002 // checking whether the root is a prefix of the path won't work. Instead, we 4003 // need to remove components from the root one by one, until either we find 4004 // a prefix that fits, or we run out of components to remove. 4005 var level = 0; 4006 while (aPath.indexOf(aRoot + '/') !== 0) { 4007 var index = aRoot.lastIndexOf("/"); 4008 if (index < 0) { 4009 return aPath; 4010 } 4011 4012 // If the only part of the root that is left is the scheme (i.e. http://, 4013 // file:///, etc.), one or more slashes (/), or simply nothing at all, we 4014 // have exhausted all components, so the path is not relative to the root. 4015 aRoot = aRoot.slice(0, index); 4016 if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { 4017 return aPath; 4018 } 4019 4020 ++level; 4021 } 4022 4023 // Make sure we add a "../" for each component we removed from the root. 4024 return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); 4025 } 4026 exports$1.relative = relative; 4027 4028 var supportsNullProto = (function () { 4029 var obj = Object.create(null); 4030 return !('__proto__' in obj); 4031 }()); 4032 4033 function identity (s) { 4034 return s; 4035 } 4036 4037 /** 4038 * Because behavior goes wacky when you set `__proto__` on objects, we 4039 * have to prefix all the strings in our set with an arbitrary character. 4040 * 4041 * See https://github.com/mozilla/source-map/pull/31 and 4042 * https://github.com/mozilla/source-map/issues/30 4043 * 4044 * @param String aStr 4045 */ 4046 function toSetString(aStr) { 4047 if (isProtoString(aStr)) { 4048 return '$' + aStr; 4049 } 4050 4051 return aStr; 4052 } 4053 exports$1.toSetString = supportsNullProto ? identity : toSetString; 4054 4055 function fromSetString(aStr) { 4056 if (isProtoString(aStr)) { 4057 return aStr.slice(1); 4058 } 4059 4060 return aStr; 4061 } 4062 exports$1.fromSetString = supportsNullProto ? identity : fromSetString; 4063 4064 function isProtoString(s) { 4065 if (!s) { 4066 return false; 4067 } 4068 4069 var length = s.length; 4070 4071 if (length < 9 /* "__proto__".length */) { 4072 return false; 4073 } 4074 4075 if (s.charCodeAt(length - 1) !== 95 /* '_' */ || 4076 s.charCodeAt(length - 2) !== 95 /* '_' */ || 4077 s.charCodeAt(length - 3) !== 111 /* 'o' */ || 4078 s.charCodeAt(length - 4) !== 116 /* 't' */ || 4079 s.charCodeAt(length - 5) !== 111 /* 'o' */ || 4080 s.charCodeAt(length - 6) !== 114 /* 'r' */ || 4081 s.charCodeAt(length - 7) !== 112 /* 'p' */ || 4082 s.charCodeAt(length - 8) !== 95 /* '_' */ || 4083 s.charCodeAt(length - 9) !== 95 /* '_' */) { 4084 return false; 4085 } 4086 4087 for (var i = length - 10; i >= 0; i--) { 4088 if (s.charCodeAt(i) !== 36 /* '$' */) { 4089 return false; 4090 } 4091 } 4092 4093 return true; 4094 } 4095 4096 /** 4097 * Comparator between two mappings where the original positions are compared. 4098 * 4099 * Optionally pass in `true` as `onlyCompareGenerated` to consider two 4100 * mappings with the same original source/line/column, but different generated 4101 * line and column the same. Useful when searching for a mapping with a 4102 * stubbed out mapping. 4103 */ 4104 function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { 4105 var cmp = strcmp(mappingA.source, mappingB.source); 4106 if (cmp !== 0) { 4107 return cmp; 4108 } 4109 4110 cmp = mappingA.originalLine - mappingB.originalLine; 4111 if (cmp !== 0) { 4112 return cmp; 4113 } 4114 4115 cmp = mappingA.originalColumn - mappingB.originalColumn; 4116 if (cmp !== 0 || onlyCompareOriginal) { 4117 return cmp; 4118 } 4119 4120 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 4121 if (cmp !== 0) { 4122 return cmp; 4123 } 4124 4125 cmp = mappingA.generatedLine - mappingB.generatedLine; 4126 if (cmp !== 0) { 4127 return cmp; 4128 } 4129 4130 return strcmp(mappingA.name, mappingB.name); 4131 } 4132 exports$1.compareByOriginalPositions = compareByOriginalPositions; 4133 4134 /** 4135 * Comparator between two mappings with deflated source and name indices where 4136 * the generated positions are compared. 4137 * 4138 * Optionally pass in `true` as `onlyCompareGenerated` to consider two 4139 * mappings with the same generated line and column, but different 4140 * source/name/original line and column the same. Useful when searching for a 4141 * mapping with a stubbed out mapping. 4142 */ 4143 function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { 4144 var cmp = mappingA.generatedLine - mappingB.generatedLine; 4145 if (cmp !== 0) { 4146 return cmp; 4147 } 4148 4149 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 4150 if (cmp !== 0 || onlyCompareGenerated) { 4151 return cmp; 4152 } 4153 4154 cmp = strcmp(mappingA.source, mappingB.source); 4155 if (cmp !== 0) { 4156 return cmp; 4157 } 4158 4159 cmp = mappingA.originalLine - mappingB.originalLine; 4160 if (cmp !== 0) { 4161 return cmp; 4162 } 4163 4164 cmp = mappingA.originalColumn - mappingB.originalColumn; 4165 if (cmp !== 0) { 4166 return cmp; 4167 } 4168 4169 return strcmp(mappingA.name, mappingB.name); 4170 } 4171 exports$1.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; 4172 4173 function strcmp(aStr1, aStr2) { 4174 if (aStr1 === aStr2) { 4175 return 0; 4176 } 4177 4178 if (aStr1 === null) { 4179 return 1; // aStr2 !== null 4180 } 4181 4182 if (aStr2 === null) { 4183 return -1; // aStr1 !== null 4184 } 4185 4186 if (aStr1 > aStr2) { 4187 return 1; 4188 } 4189 4190 return -1; 4191 } 4192 4193 /** 4194 * Comparator between two mappings with inflated source and name strings where 4195 * the generated positions are compared. 4196 */ 4197 function compareByGeneratedPositionsInflated(mappingA, mappingB) { 4198 var cmp = mappingA.generatedLine - mappingB.generatedLine; 4199 if (cmp !== 0) { 4200 return cmp; 4201 } 4202 4203 cmp = mappingA.generatedColumn - mappingB.generatedColumn; 4204 if (cmp !== 0) { 4205 return cmp; 4206 } 4207 4208 cmp = strcmp(mappingA.source, mappingB.source); 4209 if (cmp !== 0) { 4210 return cmp; 4211 } 4212 4213 cmp = mappingA.originalLine - mappingB.originalLine; 4214 if (cmp !== 0) { 4215 return cmp; 4216 } 4217 4218 cmp = mappingA.originalColumn - mappingB.originalColumn; 4219 if (cmp !== 0) { 4220 return cmp; 4221 } 4222 4223 return strcmp(mappingA.name, mappingB.name); 4224 } 4225 exports$1.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; 4226 4227 /** 4228 * Strip any JSON XSSI avoidance prefix from the string (as documented 4229 * in the source maps specification), and then parse the string as 4230 * JSON. 4231 */ 4232 function parseSourceMapInput(str) { 4233 return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); 4234 } 4235 exports$1.parseSourceMapInput = parseSourceMapInput; 4236 4237 /** 4238 * Compute the URL of a source given the the source root, the source's 4239 * URL, and the source map's URL. 4240 */ 4241 function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { 4242 sourceURL = sourceURL || ''; 4243 4244 if (sourceRoot) { 4245 // This follows what Chrome does. 4246 if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { 4247 sourceRoot += '/'; 4248 } 4249 // The spec says: 4250 // Line 4: An optional source root, useful for relocating source 4251 // files on a server or removing repeated values in the 4252 // âsourcesâ entry. This value is prepended to the individual 4253 // entries in the âsourceâ field. 4254 sourceURL = sourceRoot + sourceURL; 4255 } 4256 4257 // Historically, SourceMapConsumer did not take the sourceMapURL as 4258 // a parameter. This mode is still somewhat supported, which is why 4259 // this code block is conditional. However, it's preferable to pass 4260 // the source map URL to SourceMapConsumer, so that this function 4261 // can implement the source URL resolution algorithm as outlined in 4262 // the spec. This block is basically the equivalent of: 4263 // new URL(sourceURL, sourceMapURL).toString() 4264 // ... except it avoids using URL, which wasn't available in the 4265 // older releases of node still supported by this library. 4266 // 4267 // The spec says: 4268 // If the sources are not absolute URLs after prepending of the 4269 // âsourceRootâ, the sources are resolved relative to the 4270 // SourceMap (like resolving script src in a html document). 4271 if (sourceMapURL) { 4272 var parsed = urlParse(sourceMapURL); 4273 if (!parsed) { 4274 throw new Error("sourceMapURL could not be parsed"); 4275 } 4276 if (parsed.path) { 4277 // Strip the last path component, but keep the "/". 4278 var index = parsed.path.lastIndexOf('/'); 4279 if (index >= 0) { 4280 parsed.path = parsed.path.substring(0, index + 1); 4281 } 4282 } 4283 sourceURL = join(urlGenerate(parsed), sourceURL); 4284 } 4285 4286 return normalize(sourceURL); 4287 } 4288 exports$1.computeSourceURL = computeSourceURL; 4289 } (util)); 4290 return util; 4291} 4292 4293var arraySet = {}; 4294 4295/* -*- Mode: js; js-indent-level: 2; -*- */ 4296 4297var hasRequiredArraySet; 4298 4299function requireArraySet () { 4300 if (hasRequiredArraySet) return arraySet; 4301 hasRequiredArraySet = 1; 4302 /* 4303 * Copyright 2011 Mozilla Foundation and contributors 4304 * Licensed under the New BSD license. See LICENSE or: 4305 * http://opensource.org/licenses/BSD-3-Clause 4306 */ 4307 4308 var util = requireUtil(); 4309 var has = Object.prototype.hasOwnProperty; 4310 var hasNativeMap = typeof Map !== "undefined"; 4311 4312 /** 4313 * A data structure which is a combination of an array and a set. Adding a new 4314 * member is O(1), testing for membership is O(1), and finding the index of an 4315 * element is O(1). Removing elements from the set is not supported. Only 4316 * strings are supported for membership. 4317 */ 4318 function ArraySet() { 4319 this._array = []; 4320 this._set = hasNativeMap ? new Map() : Object.create(null); 4321 } 4322 4323 /** 4324 * Static method for creating ArraySet instances from an existing array. 4325 */ 4326 ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { 4327 var set = new ArraySet(); 4328 for (var i = 0, len = aArray.length; i < len; i++) { 4329 set.add(aArray[i], aAllowDuplicates); 4330 } 4331 return set; 4332 }; 4333 4334 /** 4335 * Return how many unique items are in this ArraySet. If duplicates have been 4336 * added, than those do not count towards the size. 4337 * 4338 * @returns Number 4339 */ 4340 ArraySet.prototype.size = function ArraySet_size() { 4341 return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; 4342 }; 4343 4344 /** 4345 * Add the given string to this set. 4346 * 4347 * @param String aStr 4348 */ 4349 ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { 4350 var sStr = hasNativeMap ? aStr : util.toSetString(aStr); 4351 var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); 4352 var idx = this._array.length; 4353 if (!isDuplicate || aAllowDuplicates) { 4354 this._array.push(aStr); 4355 } 4356 if (!isDuplicate) { 4357 if (hasNativeMap) { 4358 this._set.set(aStr, idx); 4359 } else { 4360 this._set[sStr] = idx; 4361 } 4362 } 4363 }; 4364 4365 /** 4366 * Is the given string a member of this set? 4367 * 4368 * @param String aStr 4369 */ 4370 ArraySet.prototype.has = function ArraySet_has(aStr) { 4371 if (hasNativeMap) { 4372 return this._set.has(aStr); 4373 } else { 4374 var sStr = util.toSetString(aStr); 4375 return has.call(this._set, sStr); 4376 } 4377 }; 4378 4379 /** 4380 * What is the index of the given string in the array? 4381 * 4382 * @param String aStr 4383 */ 4384 ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { 4385 if (hasNativeMap) { 4386 var idx = this._set.get(aStr); 4387 if (idx >= 0) { 4388 return idx; 4389 } 4390 } else { 4391 var sStr = util.toSetString(aStr); 4392 if (has.call(this._set, sStr)) { 4393 return this._set[sStr]; 4394 } 4395 } 4396 4397 throw new Error('"' + aStr + '" is not in the set.'); 4398 }; 4399 4400 /** 4401 * What is the element at the given index? 4402 * 4403 * @param Number aIdx 4404 */ 4405 ArraySet.prototype.at = function ArraySet_at(aIdx) { 4406 if (aIdx >= 0 && aIdx < this._array.length) { 4407 return this._array[aIdx]; 4408 } 4409 throw new Error('No element indexed by ' + aIdx); 4410 }; 4411 4412 /** 4413 * Returns the array representation of this set (which has the proper indices 4414 * indicated by indexOf). Note that this is a copy of the internal array used 4415 * for storing the members so that no one can mess with internal state. 4416 */ 4417 ArraySet.prototype.toArray = function ArraySet_toArray() { 4418 return this._array.slice(); 4419 }; 4420 4421 arraySet.ArraySet = ArraySet; 4422 return arraySet; 4423} 4424 4425var mappingList = {}; 4426 4427/* -*- Mode: js; js-indent-level: 2; -*- */ 4428 4429var hasRequiredMappingList; 4430 4431function requireMappingList () { 4432 if (hasRequiredMappingList) return mappingList; 4433 hasRequiredMappingList = 1; 4434 /* 4435 * Copyright 2014 Mozilla Foundation and contributors 4436 * Licensed under the New BSD license. See LICENSE or: 4437 * http://opensource.org/licenses/BSD-3-Clause 4438 */ 4439 4440 var util = requireUtil(); 4441 4442 /** 4443 * Determine whether mappingB is after mappingA with respect to generated 4444 * position. 4445 */ 4446 function generatedPositionAfter(mappingA, mappingB) { 4447 // Optimized for most common case 4448 var lineA = mappingA.generatedLine; 4449 var lineB = mappingB.generatedLine; 4450 var columnA = mappingA.generatedColumn; 4451 var columnB = mappingB.generatedColumn; 4452 return lineB > lineA || lineB == lineA && columnB >= columnA || 4453 util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; 4454 } 4455 4456 /** 4457 * A data structure to provide a sorted view of accumulated mappings in a 4458 * performance conscious manner. It trades a neglibable overhead in general 4459 * case for a large speedup in case of mappings being added in order. 4460 */ 4461 function MappingList() { 4462 this._array = []; 4463 this._sorted = true; 4464 // Serves as infimum 4465 this._last = {generatedLine: -1, generatedColumn: 0}; 4466 } 4467 4468 /** 4469 * Iterate through internal items. This method takes the same arguments that 4470 * `Array.prototype.forEach` takes. 4471 * 4472 * NOTE: The order of the mappings is NOT guaranteed. 4473 */ 4474 MappingList.prototype.unsortedForEach = 4475 function MappingList_forEach(aCallback, aThisArg) { 4476 this._array.forEach(aCallback, aThisArg); 4477 }; 4478 4479 /** 4480 * Add the given source mapping. 4481 * 4482 * @param Object aMapping 4483 */ 4484 MappingList.prototype.add = function MappingList_add(aMapping) { 4485 if (generatedPositionAfter(this._last, aMapping)) { 4486 this._last = aMapping; 4487 this._array.push(aMapping); 4488 } else { 4489 this._sorted = false; 4490 this._array.push(aMapping); 4491 } 4492 }; 4493 4494 /** 4495 * Returns the flat, sorted array of mappings. The mappings are sorted by 4496 * generated position. 4497 * 4498 * WARNING: This method returns internal data without copying, for 4499 * performance. The return value must NOT be mutated, and should be treated as 4500 * an immutable borrow. If you want to take ownership, you must make your own 4501 * copy. 4502 */ 4503 MappingList.prototype.toArray = function MappingList_toArray() { 4504 if (!this._sorted) { 4505 this._array.sort(util.compareByGeneratedPositionsInflated); 4506 this._sorted = true; 4507 } 4508 return this._array; 4509 }; 4510 4511 mappingList.MappingList = MappingList; 4512 return mappingList; 4513} 4514 4515/* -*- Mode: js; js-indent-level: 2; -*- */ 4516 4517var hasRequiredSourceMapGenerator; 4518 4519function requireSourceMapGenerator () { 4520 if (hasRequiredSourceMapGenerator) return sourceMapGenerator; 4521 hasRequiredSourceMapGenerator = 1; 4522 /* 4523 * Copyright 2011 Mozilla Foundation and contributors 4524 * Licensed under the New BSD license. See LICENSE or: 4525 * http://opensource.org/licenses/BSD-3-Clause 4526 */ 4527 4528 var base64VLQ = requireBase64Vlq(); 4529 var util = requireUtil(); 4530 var ArraySet = requireArraySet().ArraySet; 4531 var MappingList =
vendor: 14,688 bytes, lines 4531-4960
4531 requireMappingList().MappingList; 4532 4533 /** 4534 * An instance of the SourceMapGenerator represents a source map which is 4535 * being built incrementally. You may pass an object with the following 4536 * properties: 4537 * 4538 * - file: The filename of the generated source. 4539 * - sourceRoot: A root for all relative URLs in this source map. 4540 */ 4541 function SourceMapGenerator(aArgs) { 4542 if (!aArgs) { 4543 aArgs = {}; 4544 } 4545 this._file = util.getArg(aArgs, 'file', null); 4546 this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); 4547 this._skipValidation = util.getArg(aArgs, 'skipValidation', false); 4548 this._sources = new ArraySet(); 4549 this._names = new ArraySet(); 4550 this._mappings = new MappingList(); 4551 this._sourcesContents = null; 4552 } 4553 4554 SourceMapGenerator.prototype._version = 3; 4555 4556 /** 4557 * Creates a new SourceMapGenerator based on a SourceMapConsumer 4558 * 4559 * @param aSourceMapConsumer The SourceMap. 4560 */ 4561 SourceMapGenerator.fromSourceMap = 4562 function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { 4563 var sourceRoot = aSourceMapConsumer.sourceRoot; 4564 var generator = new SourceMapGenerator({ 4565 file: aSourceMapConsumer.file, 4566 sourceRoot: sourceRoot 4567 }); 4568 aSourceMapConsumer.eachMapping(function (mapping) { 4569 var newMapping = { 4570 generated: { 4571 line: mapping.generatedLine, 4572 column: mapping.generatedColumn 4573 } 4574 }; 4575 4576 if (mapping.source != null) { 4577 newMapping.source = mapping.source; 4578 if (sourceRoot != null) { 4579 newMapping.source = util.relative(sourceRoot, newMapping.source); 4580 } 4581 4582 newMapping.original = { 4583 line: mapping.originalLine, 4584 column: mapping.originalColumn 4585 }; 4586 4587 if (mapping.name != null) { 4588 newMapping.name = mapping.name; 4589 } 4590 } 4591 4592 generator.addMapping(newMapping); 4593 }); 4594 aSourceMapConsumer.sources.forEach(function (sourceFile) { 4595 var sourceRelative = sourceFile; 4596 if (sourceRoot !== null) { 4597 sourceRelative = util.relative(sourceRoot, sourceFile); 4598 } 4599 4600 if (!generator._sources.has(sourceRelative)) { 4601 generator._sources.add(sourceRelative); 4602 } 4603 4604 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 4605 if (content != null) { 4606 generator.setSourceContent(sourceFile, content); 4607 } 4608 }); 4609 return generator; 4610 }; 4611 4612 /** 4613 * Add a single mapping from original source line and column to the generated 4614 * source's line and column for this source map being created. The mapping 4615 * object should have the following properties: 4616 * 4617 * - generated: An object with the generated line and column positions. 4618 * - original: An object with the original line and column positions. 4619 * - source: The original source file (relative to the sourceRoot). 4620 * - name: An optional original token name for this mapping. 4621 */ 4622 SourceMapGenerator.prototype.addMapping = 4623 function SourceMapGenerator_addMapping(aArgs) { 4624 var generated = util.getArg(aArgs, 'generated'); 4625 var original = util.getArg(aArgs, 'original', null); 4626 var source = util.getArg(aArgs, 'source', null); 4627 var name = util.getArg(aArgs, 'name', null); 4628 4629 if (!this._skipValidation) { 4630 this._validateMapping(generated, original, source, name); 4631 } 4632 4633 if (source != null) { 4634 source = String(source); 4635 if (!this._sources.has(source)) { 4636 this._sources.add(source); 4637 } 4638 } 4639 4640 if (name != null) { 4641 name = String(name); 4642 if (!this._names.has(name)) { 4643 this._names.add(name); 4644 } 4645 } 4646 4647 this._mappings.add({ 4648 generatedLine: generated.line, 4649 generatedColumn: generated.column, 4650 originalLine: original != null && original.line, 4651 originalColumn: original != null && original.column, 4652 source: source, 4653 name: name 4654 }); 4655 }; 4656 4657 /** 4658 * Set the source content for a source file. 4659 */ 4660 SourceMapGenerator.prototype.setSourceContent = 4661 function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { 4662 var source = aSourceFile; 4663 if (this._sourceRoot != null) { 4664 source = util.relative(this._sourceRoot, source); 4665 } 4666 4667 if (aSourceContent != null) { 4668 // Add the source content to the _sourcesContents map. 4669 // Create a new _sourcesContents map if the property is null. 4670 if (!this._sourcesContents) { 4671 this._sourcesContents = Object.create(null); 4672 } 4673 this._sourcesContents[util.toSetString(source)] = aSourceContent; 4674 } else if (this._sourcesContents) { 4675 // Remove the source file from the _sourcesContents map. 4676 // If the _sourcesContents map is empty, set the property to null. 4677 delete this._sourcesContents[util.toSetString(source)]; 4678 if (Object.keys(this._sourcesContents).length === 0) { 4679 this._sourcesContents = null; 4680 } 4681 } 4682 }; 4683 4684 /** 4685 * Applies the mappings of a sub-source-map for a specific source file to the 4686 * source map being generated. Each mapping to the supplied source file is 4687 * rewritten using the supplied source map. Note: The resolution for the 4688 * resulting mappings is the minimium of this map and the supplied map. 4689 * 4690 * @param aSourceMapConsumer The source map to be applied. 4691 * @param aSourceFile Optional. The filename of the source file. 4692 * If omitted, SourceMapConsumer's file property will be used. 4693 * @param aSourceMapPath Optional. The dirname of the path to the source map 4694 * to be applied. If relative, it is relative to the SourceMapConsumer. 4695 * This parameter is needed when the two source maps aren't in the same 4696 * directory, and the source map to be applied contains relative source 4697 * paths. If so, those relative source paths need to be rewritten 4698 * relative to the SourceMapGenerator. 4699 */ 4700 SourceMapGenerator.prototype.applySourceMap = 4701 function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { 4702 var sourceFile = aSourceFile; 4703 // If aSourceFile is omitted, we will use the file property of the SourceMap 4704 if (aSourceFile == null) { 4705 if (aSourceMapConsumer.file == null) { 4706 throw new Error( 4707 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 4708 'or the source map\'s "file" property. Both were omitted.' 4709 ); 4710 } 4711 sourceFile = aSourceMapConsumer.file; 4712 } 4713 var sourceRoot = this._sourceRoot; 4714 // Make "sourceFile" relative if an absolute Url is passed. 4715 if (sourceRoot != null) { 4716 sourceFile = util.relative(sourceRoot, sourceFile); 4717 } 4718 // Applying the SourceMap can add and remove items from the sources and 4719 // the names array. 4720 var newSources = new ArraySet(); 4721 var newNames = new ArraySet(); 4722 4723 // Find mappings for the "sourceFile" 4724 this._mappings.unsortedForEach(function (mapping) { 4725 if (mapping.source === sourceFile && mapping.originalLine != null) { 4726 // Check if it can be mapped by the source map, then update the mapping. 4727 var original = aSourceMapConsumer.originalPositionFor({ 4728 line: mapping.originalLine, 4729 column: mapping.originalColumn 4730 }); 4731 if (original.source != null) { 4732 // Copy mapping 4733 mapping.source = original.source; 4734 if (aSourceMapPath != null) { 4735 mapping.source = util.join(aSourceMapPath, mapping.source); 4736 } 4737 if (sourceRoot != null) { 4738 mapping.source = util.relative(sourceRoot, mapping.source); 4739 } 4740 mapping.originalLine = original.line; 4741 mapping.originalColumn = original.column; 4742 if (original.name != null) { 4743 mapping.name = original.name; 4744 } 4745 } 4746 } 4747 4748 var source = mapping.source; 4749 if (source != null && !newSources.has(source)) { 4750 newSources.add(source); 4751 } 4752 4753 var name = mapping.name; 4754 if (name != null && !newNames.has(name)) { 4755 newNames.add(name); 4756 } 4757 4758 }, this); 4759 this._sources = newSources; 4760 this._names = newNames; 4761 4762 // Copy sourcesContents of applied map. 4763 aSourceMapConsumer.sources.forEach(function (sourceFile) { 4764 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 4765 if (content != null) { 4766 if (aSourceMapPath != null) { 4767 sourceFile = util.join(aSourceMapPath, sourceFile); 4768 } 4769 if (sourceRoot != null) { 4770 sourceFile = util.relative(sourceRoot, sourceFile); 4771 } 4772 this.setSourceContent(sourceFile, content); 4773 } 4774 }, this); 4775 }; 4776 4777 /** 4778 * A mapping can have one of the three levels of data: 4779 * 4780 * 1. Just the generated position. 4781 * 2. The Generated position, original position, and original source. 4782 * 3. Generated and original position, original source, as well as a name 4783 * token. 4784 * 4785 * To maintain consistency, we validate that any new mapping being added falls 4786 * in to one of these categories. 4787 */ 4788 SourceMapGenerator.prototype._validateMapping = 4789 function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, 4790 aName) { 4791 // When aOriginal is truthy but has empty values for .line and .column, 4792 // it is most likely a programmer error. In this case we throw a very 4793 // specific error message to try to guide them the right way. 4794 // For example: https://github.com/Polymer/polymer-bundler/pull/519 4795 if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { 4796 throw new Error( 4797 'original.line and original.column are not numbers -- you probably meant to omit ' + 4798 'the original mapping entirely and only map the generated position. If so, pass ' + 4799 'null for the original mapping instead of an object with empty or null values.' 4800 ); 4801 } 4802 4803 if (aGenerated && 'line' in aGenerated && 'column' in aGenerated 4804 && aGenerated.line > 0 && aGenerated.column >= 0 4805 && !aOriginal && !aSource && !aName) { 4806 // Case 1. 4807 return; 4808 } 4809 else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated 4810 && aOriginal && 'line' in aOriginal && 'column' in aOriginal 4811 && aGenerated.line > 0 && aGenerated.column >= 0 4812 && aOriginal.line > 0 && aOriginal.column >= 0 4813 && aSource) { 4814 // Cases 2 and 3. 4815 return; 4816 } 4817 else { 4818 throw new Error('Invalid mapping: ' + JSON.stringify({ 4819 generated: aGenerated, 4820 source: aSource, 4821 original: aOriginal, 4822 name: aName 4823 })); 4824 } 4825 }; 4826 4827 /** 4828 * Serialize the accumulated mappings in to the stream of base 64 VLQs 4829 * specified by the source map format. 4830 */ 4831 SourceMapGenerator.prototype._serializeMappings = 4832 function SourceMapGenerator_serializeMappings() { 4833 var previousGeneratedColumn = 0; 4834 var previousGeneratedLine = 1; 4835 var previousOriginalColumn = 0; 4836 var previousOriginalLine = 0; 4837 var previousName = 0; 4838 var previousSource = 0; 4839 var result = ''; 4840 var next; 4841 var mapping; 4842 var nameIdx; 4843 var sourceIdx; 4844 4845 var mappings = this._mappings.toArray(); 4846 for (var i = 0, len = mappings.length; i < len; i++) { 4847 mapping = mappings[i]; 4848 next = ''; 4849 4850 if (mapping.generatedLine !== previousGeneratedLine) { 4851 previousGeneratedColumn = 0; 4852 while (mapping.generatedLine !== previousGeneratedLine) { 4853 next += ';'; 4854 previousGeneratedLine++; 4855 } 4856 } 4857 else { 4858 if (i > 0) { 4859 if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { 4860 continue; 4861 } 4862 next += ','; 4863 } 4864 } 4865 4866 next += base64VLQ.encode(mapping.generatedColumn 4867 - previousGeneratedColumn); 4868 previousGeneratedColumn = mapping.generatedColumn; 4869 4870 if (mapping.source != null) { 4871 sourceIdx = this._sources.indexOf(mapping.source); 4872 next += base64VLQ.encode(sourceIdx - previousSource); 4873 previousSource = sourceIdx; 4874 4875 // lines are stored 0-based in SourceMap spec version 3 4876 next += base64VLQ.encode(mapping.originalLine - 1 4877 - previousOriginalLine); 4878 previousOriginalLine = mapping.originalLine - 1; 4879 4880 next += base64VLQ.encode(mapping.originalColumn 4881 - previousOriginalColumn); 4882 previousOriginalColumn = mapping.originalColumn; 4883 4884 if (mapping.name != null) { 4885 nameIdx = this._names.indexOf(mapping.name); 4886 next += base64VLQ.encode(nameIdx - previousName); 4887 previousName = nameIdx; 4888 } 4889 } 4890 4891 result += next; 4892 } 4893 4894 return result; 4895 }; 4896 4897 SourceMapGenerator.prototype._generateSourcesContent = 4898 function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { 4899 return aSources.map(function (source) { 4900 if (!this._sourcesContents) { 4901 return null; 4902 } 4903 if (aSourceRoot != null) { 4904 source = util.relative(aSourceRoot, source); 4905 } 4906 var key = util.toSetString(source); 4907 return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) 4908 ? this._sourcesContents[key] 4909 : null; 4910 }, this); 4911 }; 4912 4913 /** 4914 * Externalize the source map. 4915 */ 4916 SourceMapGenerator.prototype.toJSON = 4917 function SourceMapGenerator_toJSON() { 4918 var map = { 4919 version: this._version, 4920 sources: this._sources.toArray(), 4921 names: this._names.toArray(), 4922 mappings: this._serializeMappings() 4923 }; 4924 if (this._file != null) { 4925 map.file = this._file; 4926 } 4927 if (this._sourceRoot != null) { 4928 map.sourceRoot = this._sourceRoot; 4929 } 4930 if (this._sourcesContents) { 4931 map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); 4932 } 4933 4934 return map; 4935 }; 4936 4937 /** 4938 * Render the source map being generated to a string. 4939 */ 4940 SourceMapGenerator.prototype.toString = 4941 function SourceMapGenerator_toString() { 4942 return JSON.stringify(this.toJSON()); 4943 }; 4944 4945 sourceMapGenerator.SourceMapGenerator = SourceMapGenerator; 4946 return sourceMapGenerator; 4947} 4948 4949var sourceMapConsumer = {}; 4950 4951var binarySearch = {}; 4952 4953/* -*- Mode: js; js-indent-level: 2; -*- */ 4954 4955var hasRequiredBinarySearch; 4956 4957function requireBinarySearch () { 4958 if (hasRequiredBinarySearch) return binarySearch; 4959 hasRequiredBinarySearch = 1; 4960 (function (exports
vendor: 2,949 bytes, lines 4960-5034
4960$1) { 4961 /* 4962 * Copyright 2011 Mozilla Foundation and contributors 4963 * Licensed under the New BSD license. See LICENSE or: 4964 * http://opensource.org/licenses/BSD-3-Clause 4965 */ 4966 4967 exports$1.GREATEST_LOWER_BOUND = 1; 4968 exports$1.LEAST_UPPER_BOUND = 2; 4969 4970 /** 4971 * Recursive implementation of binary search. 4972 * 4973 * @param aLow Indices here and lower do not contain the needle. 4974 * @param aHigh Indices here and higher do not contain the needle. 4975 * @param aNeedle The element being searched for. 4976 * @param aHaystack The non-empty array being searched. 4977 * @param aCompare Function which takes two elements and returns -1, 0, or 1. 4978 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or 4979 * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the 4980 * closest element that is smaller than or greater than the one we are 4981 * searching for, respectively, if the exact element cannot be found. 4982 */ 4983 function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { 4984 // This function terminates when one of the following is true: 4985 // 4986 // 1. We find the exact element we are looking for. 4987 // 4988 // 2. We did not find the exact element, but we can return the index of 4989 // the next-closest element. 4990 // 4991 // 3. We did not find the exact element, and there is no next-closest 4992 // element than the one we are searching for, so we return -1. 4993 var mid = Math.floor((aHigh - aLow) / 2) + aLow; 4994 var cmp = aCompare(aNeedle, aHaystack[mid], true); 4995 if (cmp === 0) { 4996 // Found the element we are looking for. 4997 return mid; 4998 } 4999 else if (cmp > 0) { 5000 // Our needle is greater than aHaystack[mid]. 5001 if (aHigh - mid > 1) { 5002 // The element is in the upper half. 5003 return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); 5004 } 5005 5006 // The exact needle element was not found in this haystack. Determine if 5007 // we are in termination case (3) or (2) and return the appropriate thing. 5008 if (aBias == exports$1.LEAST_UPPER_BOUND) { 5009 return aHigh < aHaystack.length ? aHigh : -1; 5010 } else { 5011 return mid; 5012 } 5013 } 5014 else { 5015 // Our needle is less than aHaystack[mid]. 5016 if (mid - aLow > 1) { 5017 // The element is in the lower half. 5018 return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); 5019 } 5020 5021 // we are in termination case (3) or (2) and return the appropriate thing. 5022 if (aBias == exports$1.LEAST_UPPER_BOUND) { 5023 return mid; 5024 } else { 5025 return aLow < 0 ? -1 : aLow; 5026 } 5027 } 5028 } 5029 5030 /** 5031 * This is an implementation of binary search which will always try and return 5032 * the index of the closest element if there is no exact hit. This is because 5033 * mappings between original and generated line/col pairs are single points, 5034 * and there is an implicit region between each of them, so a miss just means
5035 * that you aren't on the very start of a region. 5036 * 5037 * @param aNeedle The element you are looking for. 5038 * @param aHaystack The array that is being searched. 5039 * @param aCompare A function which takes the needle and an element in the 5040 * array and returns -1, 0, or 1 depending on whether the needle is less 5041 * than, equal to, or greater than the element, respectively. 5042 * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or 5043 * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the 5044 * closest element that is smaller than or greater than the one we are 5045 * searching for, respectively, if the exact element cannot be found. 5046 * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. 5047 */ 5048 exports$1.search = function search(aNeedle, aHaystack, aCompare, aBias) { 5049 if (aHaystack.length === 0) { 5050 return -1; 5051 } 5052 5053 var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, 5054 aCompare, aBias || exports$1.GREATEST_LOWER_BOUND); 5055 if (index < 0) { 5056 return -1; 5057 } 5058 5059 // We have found either the exact element, or the next-closest element than 5060 // the one we are searching for. However, there may be more than one such 5061 // element. Make sure we always return the smallest of these. 5062 while (index - 1 >= 0) { 5063 if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { 5064 break; 5065 } 5066 --index; 5067 } 5068 5069 return index; 5070 }; 5071 } (binarySearch)); 5072 return binarySearch; 5073} 5074 5075var quickSort = {}; 5076 5077/* -*- Mode: js; js-indent-level: 2; -*- */ 5078 5079var hasRequiredQuickSort; 5080 5081function requireQuickSort () { 5082 if (hasRequiredQuickSort) return quickSort; 5083 hasRequiredQuickSort = 1; 5084 /* 5085 * Copyright 2011 Mozilla Foundation and contributors 5086 * Licensed under the New BSD license. See LICENSE or: 5087 * http://opensource.org/licenses/BSD-3-Clause 5088 */ 5089 5090 // It turns out that some (most?) JavaScript engines don't self-host 5091 // `Array.prototype.sort`. This makes sense because C++ will likely remain 5092 // faster than JS when doing raw CPU-intensive sorting. However, when using a 5093 // custom comparator function, calling back and forth between the VM's C++ and 5094 // JIT'd JS is rather slow *and* loses JIT type information, resulting in 5095 // worse generated code for the comparator function than would be optimal. In 5096 // fact, when sorting with a comparator, these costs outweigh the benefits of 5097 // sorting in C++. By using our own JS-implemented Quick Sort (below), we get 5098 // a ~3500ms mean speed-up in `bench/bench.html`. 5099 5100 /** 5101 * Swap the elements indexed by `x` and `y` in the array `ary`. 5102 * 5103 * @param {Array} ary 5104 * The array. 5105 * @param {Number} x 5106 * The index of the first item. 5107 * @param {Number} y 5108 * The index of the second item. 5109 */ 5110 function swap(ary, x, y) { 5111 var temp = ary[x]; 5112 ary[x] = ary[y]; 5113 ary[y] = temp; 5114 } 5115 5116 /** 5117 * Returns a random integer within the range `low .. high` inclusive. 5118 * 5119 * @param {Number} low 5120 * The lower bound on the range. 5121 * @param {Number} high 5122 * The upper bound on the range. 5123 */ 5124 function randomIntInRange(low, high) { 5125 return Math.round(low + (Math.random() * (high - low))); 5126 } 5127 5128 /** 5129 * The Quick Sort algorithm. 5130 * 5131 * @param {Array} ary 5132 * An array to sort. 5133 * @param {function} comparator 5134 * Function to use to compare two items. 5135 * @param {Number} p 5136 * Start index of the array 5137 * @param {Number} r 5138 * End index of the array 5139 */ 5140 function doQuickSort(ary, comparator, p, r) { 5141 // If our lower bound is less than our upper bound, we (1) partition the 5142 // array into two pieces and (2) recurse on each half. If it is not, this is 5143 // the empty array and our base case. 5144 5145 if (p < r) { 5146 // (1) Partitioning. 5147 // 5148 // The partitioning chooses a pivot between `p` and `r` and moves all 5149 // elements that are less than or equal to the pivot to the before it, and 5150 // all the elements that are greater than it after it. The effect is that 5151 // once partition is done, the pivot is in the exact place it will be when 5152 // the array is put in sorted order, and it will not need to be moved 5153 // again. This runs in O(n) time. 5154 5155 // Always choose a random pivot so that an input array which is reverse 5156 // sorted does not cause O(n^2) running time. 5157 var pivotIndex = randomIntInRange(p, r); 5158 var i = p - 1; 5159 5160 swap(ary, pivotIndex, r); 5161 var pivot = ary[r]; 5162 5163 // Immediately after `j` is incremented in this loop, the following hold 5164 // true: 5165 // 5166 // * Every element in `ary[p .. i]` is less than or equal to the pivot. 5167 // 5168 // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. 5169 for (var j = p; j < r; j++) { 5170 if (comparator(ary[j], pivot) <= 0) { 5171 i += 1; 5172 swap(ary, i, j); 5173 } 5174 } 5175 5176 swap(ary, i + 1, j); 5177 var q = i + 1; 5178 5179 // (2) Recurse on each half. 5180 5181 doQuickSort(ary, comparator, p, q - 1); 5182 doQuickSort(ary, comparator, q + 1, r); 5183 } 5184 } 5185
5186 /** 5187 * Sort the given array in-place with the given comparator function. 5188 * 5189 * @param {Array} ary 5190 * An array to sort. 5191 * @param {function} comparator 5192 * Function to use to compare two items. 5193 */ 5194 quickSort.quickSort = function (ary, comparator) { 5195 doQuickSort(ary, comparator, 0, ary.length - 1); 5196 }; 5197 return quickSort; 5198} 5199 5200/* -*- Mode: js; js-indent-level: 2; -*- */ 5201 5202var hasRequiredSourceMapConsumer; 5203 5204function requireSourceMapConsumer () { 5205 if (hasRequiredSourceMapConsumer) return sourceMapConsumer; 5206 hasRequiredSourceMapConsumer = 1; 5207 /* 5208 * Copyright 2011 Mozilla Foundation and contributors 5209 * Licensed under the New BSD license. See LICENSE or: 5210 * http://opensource.org/licenses/BSD-3-Clause 5211 */ 5212 5213 var util = requireUtil(); 5214 var binarySearch = requireBinarySearch(); 5215 var ArraySet = requireArraySet().ArraySet; 5216 var base64VLQ = requireBase64Vlq(); 5217 var quickSort =
vendor: 41,635 bytes, lines 5217-6369
5217 requireQuickSort().quickSort; 5218 5219 function SourceMapConsumer(aSourceMap, aSourceMapURL) { 5220 var sourceMap = aSourceMap; 5221 if (typeof aSourceMap === 'string') { 5222 sourceMap = util.parseSourceMapInput(aSourceMap); 5223 } 5224 5225 return sourceMap.sections != null 5226 ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) 5227 : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); 5228 } 5229 5230 SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { 5231 return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); 5232 }; 5233 5234 /** 5235 * The version of the source mapping spec that we are consuming. 5236 */ 5237 SourceMapConsumer.prototype._version = 3; 5238 5239 // `__generatedMappings` and `__originalMappings` are arrays that hold the 5240 // parsed mapping coordinates from the source map's "mappings" attribute. They 5241 // are lazily instantiated, accessed via the `_generatedMappings` and 5242 // `_originalMappings` getters respectively, and we only parse the mappings 5243 // and create these arrays once queried for a source location. We jump through 5244 // these hoops because there can be many thousands of mappings, and parsing 5245 // them is expensive, so we only want to do it if we must. 5246 // 5247 // Each object in the arrays is of the form: 5248 // 5249 // { 5250 // generatedLine: The line number in the generated code, 5251 // generatedColumn: The column number in the generated code, 5252 // source: The path to the original source file that generated this 5253 // chunk of code, 5254 // originalLine: The line number in the original source that 5255 // corresponds to this chunk of generated code, 5256 // originalColumn: The column number in the original source that 5257 // corresponds to this chunk of generated code, 5258 // name: The name of the original symbol which generated this chunk of 5259 // code. 5260 // } 5261 // 5262 // All properties except for `generatedLine` and `generatedColumn` can be 5263 // `null`. 5264 // 5265 // `_generatedMappings` is ordered by the generated positions. 5266 // 5267 // `_originalMappings` is ordered by the original positions. 5268 5269 SourceMapConsumer.prototype.__generatedMappings = null; 5270 Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { 5271 configurable: true, 5272 enumerable: true, 5273 get: function () { 5274 if (!this.__generatedMappings) { 5275 this._parseMappings(this._mappings, this.sourceRoot); 5276 } 5277 5278 return this.__generatedMappings; 5279 } 5280 }); 5281 5282 SourceMapConsumer.prototype.__originalMappings = null; 5283 Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { 5284 configurable: true, 5285 enumerable: true, 5286 get: function () { 5287 if (!this.__originalMappings) { 5288 this._parseMappings(this._mappings, this.sourceRoot); 5289 } 5290 5291 return this.__originalMappings; 5292 } 5293 }); 5294 5295 SourceMapConsumer.prototype._charIsMappingSeparator = 5296 function SourceMapConsumer_charIsMappingSeparator(aStr, index) { 5297 var c = aStr.charAt(index); 5298 return c === ";" || c === ","; 5299 }; 5300 5301 /** 5302 * Parse the mappings in a string in to a data structure which we can easily 5303 * query (the ordered arrays in the `this.__generatedMappings` and 5304 * `this.__originalMappings` properties). 5305 */ 5306 SourceMapConsumer.prototype._parseMappings = 5307 function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { 5308 throw new Error("Subclasses must implement _parseMappings"); 5309 }; 5310 5311 SourceMapConsumer.GENERATED_ORDER = 1; 5312 SourceMapConsumer.ORIGINAL_ORDER = 2; 5313 5314 SourceMapConsumer.GREATEST_LOWER_BOUND = 1; 5315 SourceMapConsumer.LEAST_UPPER_BOUND = 2; 5316 5317 /** 5318 * Iterate over each mapping between an original source/line/column and a 5319 * generated line/column in this source map. 5320 * 5321 * @param Function aCallback 5322 * The function that is called with each mapping. 5323 * @param Object aContext 5324 * Optional. If specified, this object will be the value of `this` every 5325 * time that `aCallback` is called. 5326 * @param aOrder 5327 * Either `SourceMapConsumer.GENERATED_ORDER` or 5328 * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to 5329 * iterate over the mappings sorted by the generated file's line/column 5330 * order or the original's source/line/column order, respectively. Defaults to 5331 * `SourceMapConsumer.GENERATED_ORDER`. 5332 */ 5333 SourceMapConsumer.prototype.eachMapping = 5334 function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { 5335 var context = aContext || null; 5336 var order = aOrder || SourceMapConsumer.GENERATED_ORDER; 5337 5338 var mappings; 5339 switch (order) { 5340 case SourceMapConsumer.GENERATED_ORDER: 5341 mappings = this._generatedMappings; 5342 break; 5343 case SourceMapConsumer.ORIGINAL_ORDER: 5344 mappings = this._originalMappings; 5345 break; 5346 default: 5347 throw new Error("Unknown order of iteration."); 5348 } 5349 5350 var sourceRoot = this.sourceRoot; 5351 mappings.map(function (mapping) { 5352 var source = mapping.source === null ? null : this._sources.at(mapping.source); 5353 source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); 5354 return { 5355 source: source, 5356 generatedLine: mapping.generatedLine, 5357 generatedColumn: mapping.generatedColumn, 5358 originalLine: mapping.originalLine, 5359 originalColumn: mapping.originalColumn, 5360 name: mapping.name === null ? null : this._names.at(mapping.name) 5361 }; 5362 }, this).forEach(aCallback, context); 5363 }; 5364 5365 /** 5366 * Returns all generated line and column information for the original source, 5367 * line, and column provided. If no column is provided, returns all mappings 5368 * corresponding to a either the line we are searching for or the next 5369 * closest line that has any mappings. Otherwise, returns all mappings 5370 * corresponding to the given line and either the column we are searching for 5371 * or the next closest column that has any offsets. 5372 * 5373 * The only argument is an object with the following properties: 5374 * 5375 * - source: The filename of the original source. 5376 * - line: The line number in the original source. The line number is 1-based. 5377 * - column: Optional. the column number in the original source. 5378 * The column number is 0-based. 5379 * 5380 * and an array of objects is returned, each with the following properties: 5381 * 5382 * - line: The line number in the generated source, or null. The 5383 * line number is 1-based. 5384 * - column: The column number in the generated source, or null. 5385 * The column number is 0-based. 5386 */ 5387 SourceMapConsumer.prototype.allGeneratedPositionsFor = 5388 function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { 5389 var line = util.getArg(aArgs, 'line'); 5390 5391 // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping 5392 // returns the index of the closest mapping less than the needle. By 5393 // setting needle.originalColumn to 0, we thus find the last mapping for 5394 // the given line, provided such a mapping exists. 5395 var needle = { 5396 source: util.getArg(aArgs, 'source'), 5397 originalLine: line, 5398 originalColumn: util.getArg(aArgs, 'column', 0) 5399 }; 5400 5401 needle.source = this._findSourceIndex(needle.source); 5402 if (needle.source < 0) { 5403 return []; 5404 } 5405 5406 var mappings = []; 5407 5408 var index = this._findMapping(needle, 5409 this._originalMappings, 5410 "originalLine", 5411 "originalColumn", 5412 util.compareByOriginalPositions, 5413 binarySearch.LEAST_UPPER_BOUND); 5414 if (index >= 0) { 5415 var mapping = this._originalMappings[index]; 5416 5417 if (aArgs.column === undefined) { 5418 var originalLine = mapping.originalLine; 5419 5420 // Iterate until either we run out of mappings, or we run into 5421 // a mapping for a different line than the one we found. Since 5422 // mappings are sorted, this is guaranteed to find all mappings for 5423 // the line we found. 5424 while (mapping && mapping.originalLine === originalLine) { 5425 mappings.push({ 5426 line: util.getArg(mapping, 'generatedLine', null), 5427 column: util.getArg(mapping, 'generatedColumn', null), 5428 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 5429 }); 5430 5431 mapping = this._originalMappings[++index]; 5432 } 5433 } else { 5434 var originalColumn = mapping.originalColumn; 5435 5436 // Iterate until either we run out of mappings, or we run into 5437 // a mapping for a different line than the one we were searching for. 5438 // Since mappings are sorted, this is guaranteed to find all mappings for 5439 // the line we are searching for. 5440 while (mapping && 5441 mapping.originalLine === line && 5442 mapping.originalColumn == originalColumn) { 5443 mappings.push({ 5444 line: util.getArg(mapping, 'generatedLine', null), 5445 column: util.getArg(mapping, 'generatedColumn', null), 5446 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 5447 }); 5448 5449 mapping = this._originalMappings[++index]; 5450 } 5451 } 5452 } 5453 5454 return mappings; 5455 }; 5456 5457 sourceMapConsumer.SourceMapConsumer = SourceMapConsumer; 5458 5459 /** 5460 * A BasicSourceMapConsumer instance represents a parsed source map which we can 5461 * query for information about the original file positions by giving it a file 5462 * position in the generated source. 5463 * 5464 * The first parameter is the raw source map (either as a JSON string, or 5465 * already parsed to an object). According to the spec, source maps have the 5466 * following attributes: 5467 * 5468 * - version: Which version of the source map spec this map is following. 5469 * - sources: An array of URLs to the original source files. 5470 * - names: An array of identifiers which can be referrenced by individual mappings. 5471 * - sourceRoot: Optional. The URL root from which all sources are relative. 5472 * - sourcesContent: Optional. An array of contents of the original source files. 5473 * - mappings: A string of base64 VLQs which contain the actual mappings. 5474 * - file: Optional. The generated file this source map is associated with. 5475 * 5476 * Here is an example source map, taken from the source map spec[0]: 5477 * 5478 * { 5479 * version : 3, 5480 * file: "out.js", 5481 * sourceRoot : "", 5482 * sources: ["foo.js", "bar.js"], 5483 * names: ["src", "maps", "are", "fun"], 5484 * mappings: "AA,AB;;ABCDE;" 5485 * } 5486 * 5487 * The second parameter, if given, is a string whose value is the URL 5488 * at which the source map was found. This URL is used to compute the 5489 * sources array. 5490 * 5491 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# 5492 */ 5493 function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { 5494 var sourceMap = aSourceMap; 5495 if (typeof aSourceMap === 'string') { 5496 sourceMap = util.parseSourceMapInput(aSourceMap); 5497 } 5498 5499 var version = util.getArg(sourceMap, 'version'); 5500 var sources = util.getArg(sourceMap, 'sources'); 5501 // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which 5502 // requires the array) to play nice here. 5503 var names = util.getArg(sourceMap, 'names', []); 5504 var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); 5505 var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); 5506 var mappings = util.getArg(sourceMap, 'mappings'); 5507 var file = util.getArg(sourceMap, 'file', null); 5508 5509 // Once again, Sass deviates from the spec and supplies the version as a 5510 // string rather than a number, so we use loose equality checking here. 5511 if (version != this._version) { 5512 throw new Error('Unsupported version: ' + version); 5513 } 5514 5515 if (sourceRoot) { 5516 sourceRoot = util.normalize(sourceRoot); 5517 } 5518 5519 sources = sources 5520 .map(String) 5521 // Some source maps produce relative source paths like "./foo.js" instead of 5522 // "foo.js". Normalize these first so that future comparisons will succeed. 5523 // See bugzil.la/1090768. 5524 .map(util.normalize) 5525 // Always ensure that absolute sources are internally stored relative to 5526 // the source root, if the source root is absolute. Not doing this would 5527 // be particularly problematic when the source root is a prefix of the 5528 // source (valid, but why??). See github issue #199 and bugzil.la/1188982. 5529 .map(function (source) { 5530 return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) 5531 ? util.relative(sourceRoot, source) 5532 : source; 5533 }); 5534 5535 // Pass `true` below to allow duplicate names and sources. While source maps 5536 // are intended to be compressed and deduplicated, the TypeScript compiler 5537 // sometimes generates source maps with duplicates in them. See Github issue 5538 // #72 and bugzil.la/889492. 5539 this._names = ArraySet.fromArray(names.map(String), true); 5540 this._sources = ArraySet.fromArray(sources, true); 5541 5542 this._absoluteSources = this._sources.toArray().map(function (s) { 5543 return util.computeSourceURL(sourceRoot, s, aSourceMapURL); 5544 }); 5545 5546 this.sourceRoot = sourceRoot; 5547 this.sourcesContent = sourcesContent; 5548 this._mappings = mappings; 5549 this._sourceMapURL = aSourceMapURL; 5550 this.file = file; 5551 } 5552 5553 BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); 5554 BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; 5555 5556 /** 5557 * Utility function to find the index of a source. Returns -1 if not 5558 * found. 5559 */ 5560 BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { 5561 var relativeSource = aSource; 5562 if (this.sourceRoot != null) { 5563 relativeSource = util.relative(this.sourceRoot, relativeSource); 5564 } 5565 5566 if (this._sources.has(relativeSource)) { 5567 return this._sources.indexOf(relativeSource); 5568 } 5569 5570 // Maybe aSource is an absolute URL as returned by |sources|. In 5571 // this case we can't simply undo the transform. 5572 var i; 5573 for (i = 0; i < this._absoluteSources.length; ++i) { 5574 if (this._absoluteSources[i] == aSource) { 5575 return i; 5576 } 5577 } 5578 5579 return -1; 5580 }; 5581 5582 /** 5583 * Create a BasicSourceMapConsumer from a SourceMapGenerator. 5584 * 5585 * @param SourceMapGenerator aSourceMap 5586 * The source map that will be consumed. 5587 * @param String aSourceMapURL 5588 * The URL at which the source map can be found (optional) 5589 * @returns BasicSourceMapConsumer 5590 */ 5591 BasicSourceMapConsumer.fromSourceMap = 5592 function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { 5593 var smc = Object.create(BasicSourceMapConsumer.prototype); 5594 5595 var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); 5596 var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); 5597 smc.sourceRoot = aSourceMap._sourceRoot; 5598 smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), 5599 smc.sourceRoot); 5600 smc.file = aSourceMap._file; 5601 smc._sourceMapURL = aSourceMapURL; 5602 smc._absoluteSources = smc._sources.toArray().map(function (s) { 5603 return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); 5604 }); 5605 5606 // Because we are modifying the entries (by converting string sources and 5607 // names to indices into the sources and names ArraySets), we have to make 5608 // a copy of the entry or else bad things happen. Shared mutable state 5609 // strikes again! See github issue #191. 5610 5611 var generatedMappings = aSourceMap._mappings.toArray().slice(); 5612 var destGeneratedMappings = smc.__generatedMappings = []; 5613 var destOriginalMappings = smc.__originalMappings = []; 5614 5615 for (var i = 0, length = generatedMappings.length; i < length; i++) { 5616 var srcMapping = generatedMappings[i]; 5617 var destMapping = new Mapping; 5618 destMapping.generatedLine = srcMapping.generatedLine; 5619 destMapping.generatedColumn = srcMapping.generatedColumn; 5620 5621 if (srcMapping.source) { 5622 destMapping.source = sources.indexOf(srcMapping.source); 5623 destMapping.originalLine = srcMapping.originalLine; 5624 destMapping.originalColumn = srcMapping.originalColumn; 5625 5626 if (srcMapping.name) { 5627 destMapping.name = names.indexOf(srcMapping.name); 5628 } 5629 5630 destOriginalMappings.push(destMapping); 5631 } 5632 5633 destGeneratedMappings.push(destMapping); 5634 } 5635 5636 quickSort(smc.__originalMappings, util.compareByOriginalPositions); 5637 5638 return smc; 5639 }; 5640 5641 /** 5642 * The version of the source mapping spec that we are consuming. 5643 */ 5644 BasicSourceMapConsumer.prototype._version = 3; 5645 5646 /** 5647 * The list of original sources. 5648 */ 5649 Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { 5650 get: function () { 5651 return this._absoluteSources.slice(); 5652 } 5653 }); 5654 5655 /** 5656 * Provide the JIT with a nice shape / hidden class. 5657 */ 5658 function Mapping() { 5659 this.generatedLine = 0; 5660 this.generatedColumn = 0; 5661 this.source = null; 5662 this.originalLine = null; 5663 this.originalColumn = null; 5664 this.name = null; 5665 } 5666 5667 /** 5668 * Parse the mappings in a string in to a data structure which we can easily 5669 * query (the ordered arrays in the `this.__generatedMappings` and 5670 * `this.__originalMappings` properties). 5671 */ 5672 BasicSourceMapConsumer.prototype._parseMappings = 5673 function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { 5674 var generatedLine = 1; 5675 var previousGeneratedColumn = 0; 5676 var previousOriginalLine = 0; 5677 var previousOriginalColumn = 0; 5678 var previousSource = 0; 5679 var previousName = 0; 5680 var length = aStr.length; 5681 var index = 0; 5682 var cachedSegments = {}; 5683 var temp = {}; 5684 var originalMappings = []; 5685 var generatedMappings = []; 5686 var mapping, str, segment, end, value; 5687 5688 while (index < length) { 5689 if (aStr.charAt(index) === ';') { 5690 generatedLine++; 5691 index++; 5692 previousGeneratedColumn = 0; 5693 } 5694 else if (aStr.charAt(index) === ',') { 5695 index++; 5696 } 5697 else { 5698 mapping = new Mapping(); 5699 mapping.generatedLine = generatedLine; 5700 5701 // Because each offset is encoded relative to the previous one, 5702 // many segments often have the same encoding. We can exploit this 5703 // fact by caching the parsed variable length fields of each segment, 5704 // allowing us to avoid a second parse if we encounter the same 5705 // segment again. 5706 for (end = index; end < length; end++) { 5707 if (this._charIsMappingSeparator(aStr, end)) { 5708 break; 5709 } 5710 } 5711 str = aStr.slice(index, end); 5712 5713 segment = cachedSegments[str]; 5714 if (segment) { 5715 index += str.length; 5716 } else { 5717 segment = []; 5718 while (index < end) { 5719 base64VLQ.decode(aStr, index, temp); 5720 value = temp.value; 5721 index = temp.rest; 5722 segment.push(value); 5723 } 5724 5725 if (segment.length === 2) { 5726 throw new Error('Found a source, but no line and column'); 5727 } 5728 5729 if (segment.length === 3) { 5730 throw new Error('Found a source and line, but no column'); 5731 } 5732 5733 cachedSegments[str] = segment; 5734 } 5735 5736 // Generated column. 5737 mapping.generatedColumn = previousGeneratedColumn + segment[0]; 5738 previousGeneratedColumn = mapping.generatedColumn; 5739 5740 if (segment.length > 1) { 5741 // Original source. 5742 mapping.source = previousSource + segment[1]; 5743 previousSource += segment[1]; 5744 5745 // Original line. 5746 mapping.originalLine = previousOriginalLine + segment[2]; 5747 previousOriginalLine = mapping.originalLine; 5748 // Lines are stored 0-based 5749 mapping.originalLine += 1; 5750 5751 // Original column. 5752 mapping.originalColumn = previousOriginalColumn + segment[3]; 5753 previousOriginalColumn = mapping.originalColumn; 5754 5755 if (segment.length > 4) { 5756 // Original name. 5757 mapping.name = previousName + segment[4]; 5758 previousName += segment[4]; 5759 } 5760 } 5761 5762 generatedMappings.push(mapping); 5763 if (typeof mapping.originalLine === 'number') { 5764 originalMappings.push(mapping); 5765 } 5766 } 5767 } 5768 5769 quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); 5770 this.__generatedMappings = generatedMappings; 5771 5772 quickSort(originalMappings, util.compareByOriginalPositions); 5773 this.__originalMappings = originalMappings; 5774 }; 5775 5776 /** 5777 * Find the mapping that best matches the hypothetical "needle" mapping that 5778 * we are searching for in the given "haystack" of mappings. 5779 */ 5780 BasicSourceMapConsumer.prototype._findMapping = 5781 function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, 5782 aColumnName, aComparator, aBias) { 5783 // To return the position we are searching for, we must first find the 5784 // mapping for the given position and then return the opposite position it 5785 // points to. Because the mappings are sorted, we can use binary search to 5786 // find the best mapping. 5787 5788 if (aNeedle[aLineName] <= 0) { 5789 throw new TypeError('Line must be greater than or equal to 1, got ' 5790 + aNeedle[aLineName]); 5791 } 5792 if (aNeedle[aColumnName] < 0) { 5793 throw new TypeError('Column must be greater than or equal to 0, got ' 5794 + aNeedle[aColumnName]); 5795 } 5796 5797 return binarySearch.search(aNeedle, aMappings, aComparator, aBias); 5798 }; 5799 5800 /** 5801 * Compute the last column for each generated mapping. The last column is 5802 * inclusive. 5803 */ 5804 BasicSourceMapConsumer.prototype.computeColumnSpans = 5805 function SourceMapConsumer_computeColumnSpans() { 5806 for (var index = 0; index < this._generatedMappings.length; ++index) { 5807 var mapping = this._generatedMappings[index]; 5808 5809 // Mappings do not contain a field for the last generated columnt. We 5810 // can come up with an optimistic estimate, however, by assuming that 5811 // mappings are contiguous (i.e. given two consecutive mappings, the 5812 // first mapping ends where the second one starts). 5813 if (index + 1 < this._generatedMappings.length) { 5814 var nextMapping = this._generatedMappings[index + 1]; 5815 5816 if (mapping.generatedLine === nextMapping.generatedLine) { 5817 mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; 5818 continue; 5819 } 5820 } 5821 5822 // The last mapping for each line spans the entire line. 5823 mapping.lastGeneratedColumn = Infinity; 5824 } 5825 }; 5826 5827 /** 5828 * Returns the original source, line, and column information for the generated 5829 * source's line and column positions provided. The only argument is an object 5830 * with the following properties: 5831 * 5832 * - line: The line number in the generated source. The line number 5833 * is 1-based. 5834 * - column: The column number in the generated source. The column 5835 * number is 0-based. 5836 * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or 5837 * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the 5838 * closest element that is smaller than or greater than the one we are 5839 * searching for, respectively, if the exact element cannot be found. 5840 * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. 5841 * 5842 * and an object is returned with the following properties: 5843 * 5844 * - source: The original source file, or null. 5845 * - line: The line number in the original source, or null. The 5846 * line number is 1-based. 5847 * - column: The column number in the original source, or null. The 5848 * column number is 0-based. 5849 * - name: The original identifier, or null. 5850 */ 5851 BasicSourceMapConsumer.prototype.originalPositionFor = 5852 function SourceMapConsumer_originalPositionFor(aArgs) { 5853 var needle = { 5854 generatedLine: util.getArg(aArgs, 'line'), 5855 generatedColumn: util.getArg(aArgs, 'column') 5856 }; 5857 5858 var index = this._findMapping( 5859 needle, 5860 this._generatedMappings, 5861 "generatedLine", 5862 "generatedColumn", 5863 util.compareByGeneratedPositionsDeflated, 5864 util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) 5865 ); 5866 5867 if (index >= 0) { 5868 var mapping = this._generatedMappings[index]; 5869 5870 if (mapping.generatedLine === needle.generatedLine) { 5871 var source = util.getArg(mapping, 'source', null); 5872 if (source !== null) { 5873 source = this._sources.at(source); 5874 source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); 5875 } 5876 var name = util.getArg(mapping, 'name', null); 5877 if (name !== null) { 5878 name = this._names.at(name); 5879 } 5880 return { 5881 source: source, 5882 line: util.getArg(mapping, 'originalLine', null), 5883 column: util.getArg(mapping, 'originalColumn', null), 5884 name: name 5885 }; 5886 } 5887 } 5888 5889 return { 5890 source: null, 5891 line: null, 5892 column: null, 5893 name: null 5894 }; 5895 }; 5896 5897 /** 5898 * Return true if we have the source content for every source in the source 5899 * map, false otherwise. 5900 */ 5901 BasicSourceMapConsumer.prototype.hasContentsOfAllSources = 5902 function BasicSourceMapConsumer_hasContentsOfAllSources() { 5903 if (!this.sourcesContent) { 5904 return false; 5905 } 5906 return this.sourcesContent.length >= this._sources.size() && 5907 !this.sourcesContent.some(function (sc) { return sc == null; }); 5908 }; 5909 5910 /** 5911 * Returns the original source content. The only argument is the url of the 5912 * original source file. Returns null if no original source content is 5913 * available. 5914 */ 5915 BasicSourceMapConsumer.prototype.sourceContentFor = 5916 function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { 5917 if (!this.sourcesContent) { 5918 return null; 5919 } 5920 5921 var index = this._findSourceIndex(aSource); 5922 if (index >= 0) { 5923 return this.sourcesContent[index]; 5924 } 5925 5926 var relativeSource = aSource; 5927 if (this.sourceRoot != null) { 5928 relativeSource = util.relative(this.sourceRoot, relativeSource); 5929 } 5930 5931 var url; 5932 if (this.sourceRoot != null 5933 && (url = util.urlParse(this.sourceRoot))) { 5934 // XXX: file:// URIs and absolute paths lead to unexpected behavior for 5935 // many users. We can help them out when they expect file:// URIs to 5936 // behave like it would if they were running a local HTTP server. See 5937 // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. 5938 var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); 5939 if (url.scheme == "file" 5940 && this._sources.has(fileUriAbsPath)) { 5941 return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] 5942 } 5943 5944 if ((!url.path || url.path == "/") 5945 && this._sources.has("/" + relativeSource)) { 5946 return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; 5947 } 5948 } 5949 5950 // This function is used recursively from 5951 // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we 5952 // don't want to throw if we can't find the source - we just want to 5953 // return null, so we provide a flag to exit gracefully. 5954 if (nullOnMissing) { 5955 return null; 5956 } 5957 else { 5958 throw new Error('"' + relativeSource + '" is not in the SourceMap.'); 5959 } 5960 }; 5961 5962 /** 5963 * Returns the generated line and column information for the original source, 5964 * line, and column positions provided. The only argument is an object with 5965 * the following properties: 5966 * 5967 * - source: The filename of the original source. 5968 * - line: The line number in the original source. The line number 5969 * is 1-based. 5970 * - column: The column number in the original source. The column 5971 * number is 0-based. 5972 * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or 5973 * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the 5974 * closest element that is smaller than or greater than the one we are 5975 * searching for, respectively, if the exact element cannot be found. 5976 * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. 5977 * 5978 * and an object is returned with the following properties: 5979 * 5980 * - line: The line number in the generated source, or null. The 5981 * line number is 1-based. 5982 * - column: The column number in the generated source, or null. 5983 * The column number is 0-based. 5984 */ 5985 BasicSourceMapConsumer.prototype.generatedPositionFor = 5986 function SourceMapConsumer_generatedPositionFor(aArgs) { 5987 var source = util.getArg(aArgs, 'source'); 5988 source = this._findSourceIndex(source); 5989 if (source < 0) { 5990 return { 5991 line: null, 5992 column: null, 5993 lastColumn: null 5994 }; 5995 } 5996 5997 var needle = { 5998 source: source, 5999 originalLine: util.getArg(aArgs, 'line'), 6000 originalColumn: util.getArg(aArgs, 'column') 6001 }; 6002 6003 var index = this._findMapping( 6004 needle, 6005 this._originalMappings, 6006 "originalLine", 6007 "originalColumn", 6008 util.compareByOriginalPositions, 6009 util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) 6010 ); 6011 6012 if (index >= 0) { 6013 var mapping = this._originalMappings[index]; 6014 6015 if (mapping.source === needle.source) { 6016 return { 6017 line: util.getArg(mapping, 'generatedLine', null), 6018 column: util.getArg(mapping, 'generatedColumn', null), 6019 lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) 6020 }; 6021 } 6022 } 6023 6024 return { 6025 line: null, 6026 column: null, 6027 lastColumn: null 6028 }; 6029 }; 6030 6031 sourceMapConsumer.BasicSourceMapConsumer = BasicSourceMapConsumer; 6032 6033 /** 6034 * An IndexedSourceMapConsumer instance represents a parsed source map which 6035 * we can query for information. It differs from BasicSourceMapConsumer in 6036 * that it takes "indexed" source maps (i.e. ones with a "sections" field) as 6037 * input. 6038 * 6039 * The first parameter is a raw source map (either as a JSON string, or already 6040 * parsed to an object). According to the spec for indexed source maps, they 6041 * have the following attributes: 6042 * 6043 * - version: Which version of the source map spec this map is following. 6044 * - file: Optional. The generated file this source map is associated with. 6045 * - sections: A list of section definitions. 6046 * 6047 * Each value under the "sections" field has two fields: 6048 * - offset: The offset into the original specified at which this section 6049 * begins to apply, defined as an object with a "line" and "column" 6050 * field. 6051 * - map: A source map definition. This source map could also be indexed, 6052 * but doesn't have to be. 6053 * 6054 * Instead of the "map" field, it's also possible to have a "url" field 6055 * specifying a URL to retrieve a source map from, but that's currently 6056 * unsupported. 6057 * 6058 * Here's an example source map, taken from the source map spec[0], but 6059 * modified to omit a section which uses the "url" field. 6060 * 6061 * { 6062 * version : 3, 6063 * file: "app.js", 6064 * sections: [{ 6065 * offset: {line:100, column:10}, 6066 * map: { 6067 * version : 3, 6068 * file: "section.js", 6069 * sources: ["foo.js", "bar.js"], 6070 * names: ["src", "maps", "are", "fun"], 6071 * mappings: "AAAA,E;;ABCDE;" 6072 * } 6073 * }], 6074 * } 6075 * 6076 * The second parameter, if given, is a string whose value is the URL 6077 * at which the source map was found. This URL is used to compute the 6078 * sources array. 6079 * 6080 * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt 6081 */ 6082 function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { 6083 var sourceMap = aSourceMap; 6084 if (typeof aSourceMap === 'string') { 6085 sourceMap = util.parseSourceMapInput(aSourceMap); 6086 } 6087 6088 var version = util.getArg(sourceMap, 'version'); 6089 var sections = util.getArg(sourceMap, 'sections'); 6090 6091 if (version != this._version) { 6092 throw new Error('Unsupported version: ' + version); 6093 } 6094 6095 this._sources = new ArraySet(); 6096 this._names = new ArraySet(); 6097 6098 var lastOffset = { 6099 line: -1, 6100 column: 0 6101 }; 6102 this._sections = sections.map(function (s) { 6103 if (s.url) { 6104 // The url field will require support for asynchronicity. 6105 // See https://github.com/mozilla/source-map/issues/16 6106 throw new Error('Support for url field in sections not implemented.'); 6107 } 6108 var offset = util.getArg(s, 'offset'); 6109 var offsetLine = util.getArg(offset, 'line'); 6110 var offsetColumn = util.getArg(offset, 'column'); 6111 6112 if (offsetLine < lastOffset.line || 6113 (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { 6114 throw new Error('Section offsets must be ordered and non-overlapping.'); 6115 } 6116 lastOffset = offset; 6117 6118 return { 6119 generatedOffset: { 6120 // The offset fields are 0-based, but we use 1-based indices when 6121 // encoding/decoding from VLQ. 6122 generatedLine: offsetLine + 1, 6123 generatedColumn: offsetColumn + 1 6124 }, 6125 consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) 6126 } 6127 }); 6128 } 6129 6130 IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); 6131 IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; 6132 6133 /** 6134 * The version of the source mapping spec that we are consuming. 6135 */ 6136 IndexedSourceMapConsumer.prototype._version = 3; 6137 6138 /** 6139 * The list of original sources. 6140 */ 6141 Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { 6142 get: function () { 6143 var sources = []; 6144 for (var i = 0; i < this._sections.length; i++) { 6145 for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { 6146 sources.push(this._sections[i].consumer.sources[j]); 6147 } 6148 } 6149 return sources; 6150 } 6151 }); 6152 6153 /** 6154 * Returns the original source, line, and column information for the generated 6155 * source's line and column positions provided. The only argument is an object 6156 * with the following properties: 6157 * 6158 * - line: The line number in the generated source. The line number 6159 * is 1-based. 6160 * - column: The column number in the generated source. The column 6161 * number is 0-based. 6162 * 6163 * and an object is returned with the following properties: 6164 * 6165 * - source: The original source file, or null. 6166 * - line: The line number in the original source, or null. The 6167 * line number is 1-based. 6168 * - column: The column number in the original source, or null. The 6169 * column number is 0-based. 6170 * - name: The original identifier, or null. 6171 */ 6172 IndexedSourceMapConsumer.prototype.originalPositionFor = 6173 function IndexedSourceMapConsumer_originalPositionFor(aArgs) { 6174 var needle = { 6175 generatedLine: util.getArg(aArgs, 'line'), 6176 generatedColumn: util.getArg(aArgs, 'column') 6177 }; 6178 6179 // Find the section containing the generated position we're trying to map 6180 // to an original position. 6181 var sectionIndex = binarySearch.search(needle, this._sections, 6182 function(needle, section) { 6183 var cmp = needle.generatedLine - section.generatedOffset.generatedLine; 6184 if (cmp) { 6185 return cmp; 6186 } 6187 6188 return (needle.generatedColumn - 6189 section.generatedOffset.generatedColumn); 6190 }); 6191 var section = this._sections[sectionIndex]; 6192 6193 if (!section) { 6194 return { 6195 source: null, 6196 line: null, 6197 column: null, 6198 name: null 6199 }; 6200 } 6201 6202 return section.consumer.originalPositionFor({ 6203 line: needle.generatedLine - 6204 (section.generatedOffset.generatedLine - 1), 6205 column: needle.generatedColumn - 6206 (section.generatedOffset.generatedLine === needle.generatedLine 6207 ? section.generatedOffset.generatedColumn - 1 6208 : 0), 6209 bias: aArgs.bias 6210 }); 6211 }; 6212 6213 /** 6214 * Return true if we have the source content for every source in the source 6215 * map, false otherwise. 6216 */ 6217 IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = 6218 function IndexedSourceMapConsumer_hasContentsOfAllSources() { 6219 return this._sections.every(function (s) { 6220 return s.consumer.hasContentsOfAllSources(); 6221 }); 6222 }; 6223 6224 /** 6225 * Returns the original source content. The only argument is the url of the 6226 * original source file. Returns null if no original source content is 6227 * available. 6228 */ 6229 IndexedSourceMapConsumer.prototype.sourceContentFor = 6230 function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { 6231 for (var i = 0; i < this._sections.length; i++) { 6232 var section = this._sections[i]; 6233 6234 var content = section.consumer.sourceContentFor(aSource, true); 6235 if (content) { 6236 return content; 6237 } 6238 } 6239 if (nullOnMissing) { 6240 return null; 6241 } 6242 else { 6243 throw new Error('"' + aSource + '" is not in the SourceMap.'); 6244 } 6245 }; 6246 6247 /** 6248 * Returns the generated line and column information for the original source, 6249 * line, and column positions provided. The only argument is an object with 6250 * the following properties: 6251 * 6252 * - source: The filename of the original source. 6253 * - line: The line number in the original source. The line number 6254 * is 1-based. 6255 * - column: The column number in the original source. The column 6256 * number is 0-based. 6257 * 6258 * and an object is returned with the following properties: 6259 * 6260 * - line: The line number in the generated source, or null. The 6261 * line number is 1-based. 6262 * - column: The column number in the generated source, or null. 6263 * The column number is 0-based. 6264 */ 6265 IndexedSourceMapConsumer.prototype.generatedPositionFor = 6266 function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { 6267 for (var i = 0; i < this._sections.length; i++) { 6268 var section = this._sections[i]; 6269 6270 // Only consider this section if the requested source is in the list of 6271 // sources of the consumer. 6272 if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { 6273 continue; 6274 } 6275 var generatedPosition = section.consumer.generatedPositionFor(aArgs); 6276 if (generatedPosition) { 6277 var ret = { 6278 line: generatedPosition.line + 6279 (section.generatedOffset.generatedLine - 1), 6280 column: generatedPosition.column + 6281 (section.generatedOffset.generatedLine === generatedPosition.line 6282 ? section.generatedOffset.generatedColumn - 1 6283 : 0) 6284 }; 6285 return ret; 6286 } 6287 } 6288 6289 return { 6290 line: null, 6291 column: null 6292 }; 6293 }; 6294 6295 /** 6296 * Parse the mappings in a string in to a data structure which we can easily 6297 * query (the ordered arrays in the `this.__generatedMappings` and 6298 * `this.__originalMappings` properties). 6299 */ 6300 IndexedSourceMapConsumer.prototype._parseMappings = 6301 function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { 6302 this.__generatedMappings = []; 6303 this.__originalMappings = []; 6304 for (var i = 0; i < this._sections.length; i++) { 6305 var section = this._sections[i]; 6306 var sectionMappings = section.consumer._generatedMappings; 6307 for (var j = 0; j < sectionMappings.length; j++) { 6308 var mapping = sectionMappings[j]; 6309 6310 var source = section.consumer._sources.at(mapping.source); 6311 source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); 6312 this._sources.add(source); 6313 source = this._sources.indexOf(source); 6314 6315 var name = null; 6316 if (mapping.name) { 6317 name = section.consumer._names.at(mapping.name); 6318 this._names.add(name); 6319 name = this._names.indexOf(name); 6320 } 6321 6322 // The mappings coming from the consumer for the section have 6323 // generated positions relative to the start of the section, so we 6324 // need to offset them to be relative to the start of the concatenated 6325 // generated file. 6326 var adjustedMapping = { 6327 source: source, 6328 generatedLine: mapping.generatedLine + 6329 (section.generatedOffset.generatedLine - 1), 6330 generatedColumn: mapping.generatedColumn + 6331 (section.generatedOffset.generatedLine === mapping.generatedLine 6332 ? section.generatedOffset.generatedColumn - 1 6333 : 0), 6334 originalLine: mapping.originalLine, 6335 originalColumn: mapping.originalColumn, 6336 name: name 6337 }; 6338 6339 this.__generatedMappings.push(adjustedMapping); 6340 if (typeof adjustedMapping.originalLine === 'number') { 6341 this.__originalMappings.push(adjustedMapping); 6342 } 6343 } 6344 } 6345 6346 quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); 6347 quickSort(this.__originalMappings, util.compareByOriginalPositions); 6348 }; 6349 6350 sourceMapConsumer.IndexedSourceMapConsumer = IndexedSourceMapConsumer; 6351 return sourceMapConsumer; 6352} 6353 6354var sourceNode = {}; 6355 6356/* -*- Mode: js; js-indent-level: 2; -*- */ 6357 6358var hasRequiredSourceNode; 6359 6360function requireSourceNode () { 6361 if (hasRequiredSourceNode) return sourceNode; 6362 hasRequiredSourceNode = 1; 6363 /* 6364 * Copyright 2011 Mozilla Foundation and contributors 6365 * Licensed under the New BSD license. See LICENSE or: 6366 * http://opensource.org/licenses/BSD-3-Clause 6367 */ 6368 6369 var SourceMapGenerator =
6369requireSourceMapGenerator().SourceMapGenerator; 6370 var util = requireUtil
vendor: 14,235 bytes, lines 6370-6789
6370(); 6371 6372 // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other 6373 // operating systems these days (capturing the result). 6374 var REGEX_NEWLINE = /(\r?\n)/; 6375 6376 // Newline character code for charCodeAt() comparisons 6377 var NEWLINE_CODE = 10; 6378 6379 // Private symbol for identifying `SourceNode`s when multiple versions of 6380 // the source-map library are loaded. This MUST NOT CHANGE across 6381 // versions! 6382 var isSourceNode = "$$$isSourceNode$$$"; 6383 6384 /** 6385 * SourceNodes provide a way to abstract over interpolating/concatenating 6386 * snippets of generated JavaScript source code while maintaining the line and 6387 * column information associated with the original source code. 6388 * 6389 * @param aLine The original line number. 6390 * @param aColumn The original column number. 6391 * @param aSource The original source's filename. 6392 * @param aChunks Optional. An array of strings which are snippets of 6393 * generated JS, or other SourceNodes. 6394 * @param aName The original identifier. 6395 */ 6396 function SourceNode(aLine, aColumn, aSource, aChunks, aName) { 6397 this.children = []; 6398 this.sourceContents = {}; 6399 this.line = aLine == null ? null : aLine; 6400 this.column = aColumn == null ? null : aColumn; 6401 this.source = aSource == null ? null : aSource; 6402 this.name = aName == null ? null : aName; 6403 this[isSourceNode] = true; 6404 if (aChunks != null) this.add(aChunks); 6405 } 6406 6407 /** 6408 * Creates a SourceNode from generated code and a SourceMapConsumer. 6409 * 6410 * @param aGeneratedCode The generated code 6411 * @param aSourceMapConsumer The SourceMap for the generated code 6412 * @param aRelativePath Optional. The path that relative sources in the 6413 * SourceMapConsumer should be relative to. 6414 */ 6415 SourceNode.fromStringWithSourceMap = 6416 function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { 6417 // The SourceNode we want to fill with the generated code 6418 // and the SourceMap 6419 var node = new SourceNode(); 6420 6421 // All even indices of this array are one line of the generated code, 6422 // while all odd indices are the newlines between two adjacent lines 6423 // (since `REGEX_NEWLINE` captures its match). 6424 // Processed fragments are accessed by calling `shiftNextLine`. 6425 var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); 6426 var remainingLinesIndex = 0; 6427 var shiftNextLine = function() { 6428 var lineContents = getNextLine(); 6429 // The last line of a file might not have a newline. 6430 var newLine = getNextLine() || ""; 6431 return lineContents + newLine; 6432 6433 function getNextLine() { 6434 return remainingLinesIndex < remainingLines.length ? 6435 remainingLines[remainingLinesIndex++] : undefined; 6436 } 6437 }; 6438 6439 // We need to remember the position of "remainingLines" 6440 var lastGeneratedLine = 1, lastGeneratedColumn = 0; 6441 6442 // The generate SourceNodes we need a code range. 6443 // To extract it current and last mapping is used. 6444 // Here we store the last mapping. 6445 var lastMapping = null; 6446 6447 aSourceMapConsumer.eachMapping(function (mapping) { 6448 if (lastMapping !== null) { 6449 // We add the code from "lastMapping" to "mapping": 6450 // First check if there is a new line in between. 6451 if (lastGeneratedLine < mapping.generatedLine) { 6452 // Associate first line with "lastMapping" 6453 addMappingWithCode(lastMapping, shiftNextLine()); 6454 lastGeneratedLine++; 6455 lastGeneratedColumn = 0; 6456 // The remaining code is added without mapping 6457 } else { 6458 // There is no new line in between. 6459 // Associate the code between "lastGeneratedColumn" and 6460 // "mapping.generatedColumn" with "lastMapping" 6461 var nextLine = remainingLines[remainingLinesIndex] || ''; 6462 var code = nextLine.substr(0, mapping.generatedColumn - 6463 lastGeneratedColumn); 6464 remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - 6465 lastGeneratedColumn); 6466 lastGeneratedColumn = mapping.generatedColumn; 6467 addMappingWithCode(lastMapping, code); 6468 // No more remaining code, continue 6469 lastMapping = mapping; 6470 return; 6471 } 6472 } 6473 // We add the generated code until the first mapping 6474 // to the SourceNode without any mapping. 6475 // Each line is added as separate string. 6476 while (lastGeneratedLine < mapping.generatedLine) { 6477 node.add(shiftNextLine()); 6478 lastGeneratedLine++; 6479 } 6480 if (lastGeneratedColumn < mapping.generatedColumn) { 6481 var nextLine = remainingLines[remainingLinesIndex] || ''; 6482 node.add(nextLine.substr(0, mapping.generatedColumn)); 6483 remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); 6484 lastGeneratedColumn = mapping.generatedColumn; 6485 } 6486 lastMapping = mapping; 6487 }, this); 6488 // We have processed all mappings. 6489 if (remainingLinesIndex < remainingLines.length) { 6490 if (lastMapping) { 6491 // Associate the remaining code in the current line with "lastMapping" 6492 addMappingWithCode(lastMapping, shiftNextLine()); 6493 } 6494 // and add the remaining lines without any mapping 6495 node.add(remainingLines.splice(remainingLinesIndex).join("")); 6496 } 6497 6498 // Copy sourcesContent into SourceNode 6499 aSourceMapConsumer.sources.forEach(function (sourceFile) { 6500 var content = aSourceMapConsumer.sourceContentFor(sourceFile); 6501 if (content != null) { 6502 if (aRelativePath != null) { 6503 sourceFile = util.join(aRelativePath, sourceFile); 6504 } 6505 node.setSourceContent(sourceFile, content); 6506 } 6507 }); 6508 6509 return node; 6510 6511 function addMappingWithCode(mapping, code) { 6512 if (mapping === null || mapping.source === undefined) { 6513 node.add(code); 6514 } else { 6515 var source = aRelativePath 6516 ? util.join(aRelativePath, mapping.source) 6517 : mapping.source; 6518 node.add(new SourceNode(mapping.originalLine, 6519 mapping.originalColumn, 6520 source, 6521 code, 6522 mapping.name)); 6523 } 6524 } 6525 }; 6526 6527 /** 6528 * Add a chunk of generated JS to this source node. 6529 * 6530 * @param aChunk A string snippet of generated JS code, another instance of 6531 * SourceNode, or an array where each member is one of those things. 6532 */ 6533 SourceNode.prototype.add = function SourceNode_add(aChunk) { 6534 if (Array.isArray(aChunk)) { 6535 aChunk.forEach(function (chunk) { 6536 this.add(chunk); 6537 }, this); 6538 } 6539 else if (aChunk[isSourceNode] || typeof aChunk === "string") { 6540 if (aChunk) { 6541 this.children.push(aChunk); 6542 } 6543 } 6544 else { 6545 throw new TypeError( 6546 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk 6547 ); 6548 } 6549 return this; 6550 }; 6551 6552 /** 6553 * Add a chunk of generated JS to the beginning of this source node. 6554 * 6555 * @param aChunk A string snippet of generated JS code, another instance of 6556 * SourceNode, or an array where each member is one of those things. 6557 */ 6558 SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { 6559 if (Array.isArray(aChunk)) { 6560 for (var i = aChunk.length-1; i >= 0; i--) { 6561 this.prepend(aChunk[i]); 6562 } 6563 } 6564 else if (aChunk[isSourceNode] || typeof aChunk === "string") { 6565 this.children.unshift(aChunk); 6566 } 6567 else { 6568 throw new TypeError( 6569 "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk 6570 ); 6571 } 6572 return this; 6573 }; 6574 6575 /** 6576 * Walk over the tree of JS snippets in this node and its children. The 6577 * walking function is called once for each snippet of JS and is passed that 6578 * snippet and the its original associated source's line/column location. 6579 * 6580 * @param aFn The traversal function. 6581 */ 6582 SourceNode.prototype.walk = function SourceNode_walk(aFn) { 6583 var chunk; 6584 for (var i = 0, len = this.children.length; i < len; i++) { 6585 chunk = this.children[i]; 6586 if (chunk[isSourceNode]) { 6587 chunk.walk(aFn); 6588 } 6589 else { 6590 if (chunk !== '') { 6591 aFn(chunk, { source: this.source, 6592 line: this.line, 6593 column: this.column, 6594 name: this.name }); 6595 } 6596 } 6597 } 6598 }; 6599 6600 /** 6601 * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between 6602 * each of `this.children`. 6603 * 6604 * @param aSep The separator. 6605 */ 6606 SourceNode.prototype.join = function SourceNode_join(aSep) { 6607 var newChildren; 6608 var i; 6609 var len = this.children.length; 6610 if (len > 0) { 6611 newChildren = []; 6612 for (i = 0; i < len-1; i++) { 6613 newChildren.push(this.children[i]); 6614 newChildren.push(aSep); 6615 } 6616 newChildren.push(this.children[i]); 6617 this.children = newChildren; 6618 } 6619 return this; 6620 }; 6621 6622 /** 6623 * Call String.prototype.replace on the very right-most source snippet. Useful 6624 * for trimming whitespace from the end of a source node, etc. 6625 * 6626 * @param aPattern The pattern to replace. 6627 * @param aReplacement The thing to replace the pattern with. 6628 */ 6629 SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { 6630 var lastChild = this.children[this.children.length - 1]; 6631 if (lastChild[isSourceNode]) { 6632 lastChild.replaceRight(aPattern, aReplacement); 6633 } 6634 else if (typeof lastChild === 'string') { 6635 this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); 6636 } 6637 else { 6638 this.children.push(''.replace(aPattern, aReplacement)); 6639 } 6640 return this; 6641 }; 6642 6643 /** 6644 * Set the source content for a source file. This will be added to the SourceMapGenerator 6645 * in the sourcesContent field. 6646 * 6647 * @param aSourceFile The filename of the source file 6648 * @param aSourceContent The content of the source file 6649 */ 6650 SourceNode.prototype.setSourceContent = 6651 function SourceNode_setSourceContent(aSourceFile, aSourceContent) { 6652 this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; 6653 }; 6654 6655 /** 6656 * Walk over the tree of SourceNodes. The walking function is called for each 6657 * source file content and is passed the filename and source content. 6658 * 6659 * @param aFn The traversal function. 6660 */ 6661 SourceNode.prototype.walkSourceContents = 6662 function SourceNode_walkSourceContents(aFn) { 6663 for (var i = 0, len = this.children.length; i < len; i++) { 6664 if (this.children[i][isSourceNode]) { 6665 this.children[i].walkSourceContents(aFn); 6666 } 6667 } 6668 6669 var sources = Object.keys(this.sourceContents); 6670 for (var i = 0, len = sources.length; i < len; i++) { 6671 aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); 6672 } 6673 }; 6674 6675 /** 6676 * Return the string representation of this source node. Walks over the tree 6677 * and concatenates all the various snippets together to one string. 6678 */ 6679 SourceNode.prototype.toString = function SourceNode_toString() { 6680 var str = ""; 6681 this.walk(function (chunk) { 6682 str += chunk; 6683 }); 6684 return str; 6685 }; 6686 6687 /** 6688 * Returns the string representation of this source node along with a source 6689 * map. 6690 */ 6691 SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { 6692 var generated = { 6693 code: "", 6694 line: 1, 6695 column: 0 6696 }; 6697 var map = new SourceMapGenerator(aArgs); 6698 var sourceMappingActive = false; 6699 var lastOriginalSource = null; 6700 var lastOriginalLine = null; 6701 var lastOriginalColumn = null; 6702 var lastOriginalName = null; 6703 this.walk(function (chunk, original) { 6704 generated.code += chunk; 6705 if (original.source !== null 6706 && original.line !== null 6707 && original.column !== null) { 6708 if(lastOriginalSource !== original.source 6709 || lastOriginalLine !== original.line 6710 || lastOriginalColumn !== original.column 6711 || lastOriginalName !== original.name) { 6712 map.addMapping({ 6713 source: original.source, 6714 original: { 6715 line: original.line, 6716 column: original.column 6717 }, 6718 generated: { 6719 line: generated.line, 6720 column: generated.column 6721 }, 6722 name: original.name 6723 }); 6724 } 6725 lastOriginalSource = original.source; 6726 lastOriginalLine = original.line; 6727 lastOriginalColumn = original.column; 6728 lastOriginalName = original.name; 6729 sourceMappingActive = true; 6730 } else if (sourceMappingActive) { 6731 map.addMapping({ 6732 generated: { 6733 line: generated.line, 6734 column: generated.column 6735 } 6736 }); 6737 lastOriginalSource = null; 6738 sourceMappingActive = false; 6739 } 6740 for (var idx = 0, length = chunk.length; idx < length; idx++) { 6741 if (chunk.charCodeAt(idx) === NEWLINE_CODE) { 6742 generated.line++; 6743 generated.column = 0; 6744 // Mappings end at eol 6745 if (idx + 1 === length) { 6746 lastOriginalSource = null; 6747 sourceMappingActive = false; 6748 } else if (sourceMappingActive) { 6749 map.addMapping({ 6750 source: original.source, 6751 original: { 6752 line: original.line, 6753 column: original.column 6754 }, 6755 generated: { 6756 line: generated.line, 6757 column: generated.column 6758 }, 6759 name: original.name 6760 }); 6761 } 6762 } else { 6763 generated.column++; 6764 } 6765 } 6766 }); 6767 this.walkSourceContents(function (sourceFile, sourceContent) { 6768 map.setSourceContent(sourceFile, sourceContent); 6769 }); 6770 6771 return { code: generated.code, map: map }; 6772 }; 6773 6774 sourceNode.SourceNode = SourceNode; 6775 return sourceNode; 6776} 6777 6778/* 6779 * Copyright 2009-2011 Mozilla Foundation and contributors 6780 * Licensed under the New BSD license. See LICENSE.txt or: 6781 * http://opensource.org/licenses/BSD-3-Clause 6782 */ 6783 6784var hasRequiredSourceMap; 6785 6786function requireSourceMap () { 6787 if (hasRequiredSourceMap) return sourceMap; 6788 hasRequiredSourceMap = 1; 6789 sourceMap.SourceMapGenerator =
6789requireSourceMapGenerator().SourceMapGenerator; 6790 sourceMap.SourceMapConsumer = requireSourceMapConsumer().SourceMapConsumer; 6791 sourceMap.SourceNode = requireSourceNode().SourceNode;
vendor: 4,640 bytes, lines 6792-6969
6792 return sourceMap; 6793} 6794 6795/* global define, require */ 6796 6797var hasRequiredCodeGen; 6798 6799function requireCodeGen () { 6800 if (hasRequiredCodeGen) return codeGen.exports; 6801 hasRequiredCodeGen = 1; 6802 (function (module, exports$1) { 6803 6804 exports$1.__esModule = true; 6805 6806 var _utils = requireUtils(); 6807 6808 var SourceNode = undefined; 6809 6810 try { 6811 /* istanbul ignore next */ 6812 if (typeof undefined !== 'function' || !undefined.amd) { 6813 // We don't support this in AMD environments. For these environments, we assume that 6814 // they are running on the browser and thus have no need for the source-map library. 6815 var SourceMap = requireSourceMap(); 6816 SourceNode = SourceMap.SourceNode; 6817 } 6818 } catch (err) {} 6819 /* NOP */ 6820 6821 /* istanbul ignore if: tested but not covered in istanbul due to dist build */ 6822 if (!SourceNode) { 6823 SourceNode = function (line, column, srcFile, chunks) { 6824 this.src = ''; 6825 if (chunks) { 6826 this.add(chunks); 6827 } 6828 }; 6829 /* istanbul ignore next */ 6830 SourceNode.prototype = { 6831 add: function add(chunks) { 6832 if (_utils.isArray(chunks)) { 6833 chunks = chunks.join(''); 6834 } 6835 this.src += chunks; 6836 }, 6837 prepend: function prepend(chunks) { 6838 if (_utils.isArray(chunks)) { 6839 chunks = chunks.join(''); 6840 } 6841 this.src = chunks + this.src; 6842 }, 6843 toStringWithSourceMap: function toStringWithSourceMap() { 6844 return { code: this.toString() }; 6845 }, 6846 toString: function toString() { 6847 return this.src; 6848 } 6849 }; 6850 } 6851 6852 function castChunk(chunk, codeGen, loc) { 6853 if (_utils.isArray(chunk)) { 6854 var ret = []; 6855 6856 for (var i = 0, len = chunk.length; i < len; i++) { 6857 ret.push(codeGen.wrap(chunk[i], loc)); 6858 } 6859 return ret; 6860 } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { 6861 // Handle primitives that the SourceNode will throw up on 6862 return chunk + ''; 6863 } 6864 return chunk; 6865 } 6866 6867 function CodeGen(srcFile) { 6868 this.srcFile = srcFile; 6869 this.source = []; 6870 } 6871 6872 CodeGen.prototype = { 6873 isEmpty: function isEmpty() { 6874 return !this.source.length; 6875 }, 6876 prepend: function prepend(source, loc) { 6877 this.source.unshift(this.wrap(source, loc)); 6878 }, 6879 push: function push(source, loc) { 6880 this.source.push(this.wrap(source, loc)); 6881 }, 6882 6883 merge: function merge() { 6884 var source = this.empty(); 6885 this.each(function (line) { 6886 source.add([' ', line, '\n']); 6887 }); 6888 return source; 6889 }, 6890 6891 each: function each(iter) { 6892 for (var i = 0, len = this.source.length; i < len; i++) { 6893 iter(this.source[i]); 6894 } 6895 }, 6896 6897 empty: function empty() { 6898 var loc = this.currentLocation || { start: {} }; 6899 return new SourceNode(loc.start.line, loc.start.column, this.srcFile); 6900 }, 6901 wrap: function wrap(chunk) { 6902 var loc = arguments.length <= 1 || arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; 6903 6904 if (chunk instanceof SourceNode) { 6905 return chunk; 6906 } 6907 6908 chunk = castChunk(chunk, this, loc); 6909 6910 return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); 6911 }, 6912 6913 functionCall: function functionCall(fn, type, params) { 6914 params = this.generateList(params); 6915 return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); 6916 }, 6917 6918 quotedString: function quotedString(str) { 6919 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 6920 .replace(/\u2029/g, '\\u2029') + '"'; 6921 }, 6922 6923 objectLiteral: function objectLiteral(obj) { 6924 // istanbul ignore next 6925 6926 var _this = this; 6927 6928 var pairs = []; 6929 6930 Object.keys(obj).forEach(function (key) { 6931 var value = castChunk(obj[key], _this); 6932 if (value !== 'undefined') { 6933 pairs.push([_this.quotedString(key), ':', value]); 6934 } 6935 }); 6936 6937 var ret = this.generateList(pairs); 6938 ret.prepend('{'); 6939 ret.add('}'); 6940 return ret; 6941 }, 6942 6943 generateList: function generateList(entries) { 6944 var ret = this.empty(); 6945 6946 for (var i = 0, len = entries.length; i < len; i++) { 6947 if (i) { 6948 ret.add(','); 6949 } 6950 6951 ret.add(castChunk(entries[i], this)); 6952 } 6953 6954 return ret; 6955 }, 6956 6957 generateArray: function generateArray(entries) { 6958 var ret = this.generateList(entries); 6959 ret.prepend('['); 6960 ret.add(']'); 6961 6962 return ret; 6963 } 6964 }; 6965 6966 exports$1['default'] = CodeGen; 6967 module.exports = exports$1['default']; 6968 6969 }
vendor: 13,116 bytes, lines 6969-7373
6969 (codeGen, codeGen.exports)); 6970 return codeGen.exports; 6971} 6972 6973var hasRequiredJavascriptCompiler; 6974 6975function requireJavascriptCompiler () { 6976 if (hasRequiredJavascriptCompiler) return javascriptCompiler.exports; 6977 hasRequiredJavascriptCompiler = 1; 6978 (function (module, exports$1) { 6979 6980 exports$1.__esModule = true; 6981 // istanbul ignore next 6982 6983 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 6984 6985 var _base = requireBase$1(); 6986 6987 var _exception = requireException(); 6988 6989 var _exception2 = _interopRequireDefault(_exception); 6990 6991 var _utils = requireUtils(); 6992 6993 var _codeGen = requireCodeGen(); 6994 6995 var _codeGen2 = _interopRequireDefault(_codeGen); 6996 6997 function Literal(value) { 6998 this.value = value; 6999 } 7000 7001 function JavaScriptCompiler() {} 7002 7003 JavaScriptCompiler.prototype = { 7004 // PUBLIC API: You can override these methods in a subclass to provide 7005 // alternative compiled forms for name lookup and buffering semantics 7006 nameLookup: function nameLookup(parent, name /*, type */) { 7007 return this.internalNameLookup(parent, name); 7008 }, 7009 depthedLookup: function depthedLookup(name) { 7010 return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; 7011 }, 7012 7013 compilerInfo: function compilerInfo() { 7014 var revision = _base.COMPILER_REVISION, 7015 versions = _base.REVISION_CHANGES[revision]; 7016 return [revision, versions]; 7017 }, 7018 7019 appendToBuffer: function appendToBuffer(source, location, explicit) { 7020 // Force a source as this simplifies the merge logic. 7021 if (!_utils.isArray(source)) { 7022 source = [source]; 7023 } 7024 source = this.source.wrap(source, location); 7025 7026 if (this.environment.isSimple) { 7027 return ['return ', source, ';']; 7028 } else if (explicit) { 7029 // This is a case where the buffer operation occurs as a child of another 7030 // construct, generally braces. We have to explicitly output these buffer 7031 // operations to ensure that the emitted code goes in the correct location. 7032 return ['buffer += ', source, ';']; 7033 } else { 7034 source.appendToBuffer = true; 7035 return source; 7036 } 7037 }, 7038 7039 initializeBuffer: function initializeBuffer() { 7040 return this.quotedString(''); 7041 }, 7042 // END PUBLIC API 7043 internalNameLookup: function internalNameLookup(parent, name) { 7044 this.lookupPropertyFunctionIsUsed = true; 7045 return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; 7046 }, 7047 7048 lookupPropertyFunctionIsUsed: false, 7049 7050 compile: function compile(environment, options, context, asObject) { 7051 this.environment = environment; 7052 this.options = options; 7053 this.stringParams = this.options.stringParams; 7054 this.trackIds = this.options.trackIds; 7055 this.precompile = !asObject; 7056 7057 this.name = this.environment.name; 7058 this.isChild = !!context; 7059 this.context = context || { 7060 decorators: [], 7061 programs: [], 7062 environments: [] 7063 }; 7064 7065 this.preamble(); 7066 7067 this.stackSlot = 0; 7068 this.stackVars = []; 7069 this.aliases = {}; 7070 this.registers = { list: [] }; 7071 this.hashes = []; 7072 this.compileStack = []; 7073 this.inlineStack = []; 7074 this.blockParams = []; 7075 7076 this.compileChildren(environment, options); 7077 7078 this.useDepths = this.useDepths || environment.useDepths || environment.useDecorators || this.options.compat; 7079 this.useBlockParams = this.useBlockParams || environment.useBlockParams; 7080 7081 var opcodes = environment.opcodes, 7082 opcode = undefined, 7083 firstLoc = undefined, 7084 i = undefined, 7085 l = undefined; 7086 7087 for (i = 0, l = opcodes.length; i < l; i++) { 7088 opcode = opcodes[i]; 7089 7090 this.source.currentLocation = opcode.loc; 7091 firstLoc = firstLoc || opcode.loc; 7092 this[opcode.opcode].apply(this, opcode.args); 7093 } 7094 7095 // Flush any trailing content that might be pending. 7096 this.source.currentLocation = firstLoc; 7097 this.pushSource(''); 7098 7099 /* istanbul ignore next */ 7100 if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { 7101 throw new _exception2['default']('Compile completed with content left on stack'); 7102 } 7103 7104 if (!this.decorators.isEmpty()) { 7105 this.useDecorators = true; 7106 7107 this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); 7108 this.decorators.push('return fn;'); 7109 7110 if (asObject) { 7111 this.decorators = Function.apply(this, ['fn', 'props', 'container', 'depth0', 'data', 'blockParams', 'depths', this.decorators.merge()]); 7112 } else { 7113 this.decorators.prepend('function(fn, props, container, depth0, data, blockParams, depths) {\n'); 7114 this.decorators.push('}\n'); 7115 this.decorators = this.decorators.merge(); 7116 } 7117 } else { 7118 this.decorators = undefined; 7119 } 7120 7121 var fn = this.createFunctionContext(asObject); 7122 if (!this.isChild) { 7123 var ret = { 7124 compiler: this.compilerInfo(), 7125 main: fn 7126 }; 7127 7128 if (this.decorators) { 7129 ret.main_d = this.decorators; // eslint-disable-line camelcase 7130 ret.useDecorators = true; 7131 } 7132 7133 var _context = this.context; 7134 var programs = _context.programs; 7135 var decorators = _context.decorators; 7136 7137 for (i = 0, l = programs.length; i < l; i++) { 7138 if (programs[i]) { 7139 ret[i] = programs[i]; 7140 if (decorators[i]) { 7141 ret[i + '_d'] = decorators[i]; 7142 ret.useDecorators = true; 7143 } 7144 } 7145 } 7146 7147 if (this.environment.usePartial) { 7148 ret.usePartial = true; 7149 } 7150 if (this.options.data) { 7151 ret.useData = true; 7152 } 7153 if (this.useDepths) { 7154 ret.useDepths = true; 7155 } 7156 if (this.useBlockParams) { 7157 ret.useBlockParams = true; 7158 } 7159 if (this.options.compat) { 7160 ret.compat = true; 7161 } 7162 7163 if (!asObject) { 7164 ret.compiler = JSON.stringify(ret.compiler); 7165 7166 this.source.currentLocation = { start: { line: 1, column: 0 } }; 7167 ret = this.objectLiteral(ret); 7168 7169 if (options.srcName) { 7170 ret = ret.toStringWithSourceMap({ file: options.destName }); 7171 ret.map = ret.map && ret.map.toString(); 7172 } else { 7173 ret = ret.toString(); 7174 } 7175 } else { 7176 ret.compilerOptions = this.options; 7177 } 7178 7179 return ret; 7180 } else { 7181 return fn; 7182 } 7183 }, 7184 7185 preamble: function preamble() { 7186 // track the last context pushed into place to allow skipping the 7187 // getContext opcode when it would be a noop 7188 this.lastContext = 0; 7189 this.source = new _codeGen2['default'](this.options.srcName); 7190 this.decorators = new _codeGen2['default'](this.options.srcName); 7191 }, 7192 7193 createFunctionContext: function createFunctionContext(asObject) { 7194 // istanbul ignore next 7195 7196 var _this = this; 7197 7198 var varDeclarations = ''; 7199 7200 var locals = this.stackVars.concat(this.registers.list); 7201 if (locals.length > 0) { 7202 varDeclarations += ', ' + locals.join(', '); 7203 } 7204 7205 // Generate minimizer alias mappings 7206 // 7207 // When using true SourceNodes, this will update all references to the given alias 7208 // as the source nodes are reused in situ. For the non-source node compilation mode, 7209 // aliases will not be used, but this case is already being run on the client and 7210 // we aren't concern about minimizing the template size. 7211 var aliasCount = 0; 7212 Object.keys(this.aliases).forEach(function (alias) { 7213 var node = _this.aliases[alias]; 7214 if (node.children && node.referenceCount > 1) { 7215 varDeclarations += ', alias' + ++aliasCount + '=' + alias; 7216 node.children[0] = 'alias' + aliasCount; 7217 } 7218 }); 7219 7220 if (this.lookupPropertyFunctionIsUsed) { 7221 varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); 7222 } 7223 7224 var params = ['container', 'depth0', 'helpers', 'partials', 'data']; 7225 7226 if (this.useBlockParams || this.useDepths) { 7227 params.push('blockParams'); 7228 } 7229 if (this.useDepths) { 7230 params.push('depths'); 7231 } 7232 7233 // Perform a second pass over the output to merge content when possible 7234 var source = this.mergeSource(varDeclarations); 7235 7236 if (asObject) { 7237 params.push(source); 7238 7239 return Function.apply(this, params); 7240 } else { 7241 return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); 7242 } 7243 }, 7244 mergeSource: function mergeSource(varDeclarations) { 7245 var isSimple = this.environment.isSimple, 7246 appendOnly = !this.forceBuffer, 7247 appendFirst = undefined, 7248 sourceSeen = undefined, 7249 bufferStart = undefined, 7250 bufferEnd = undefined; 7251 this.source.each(function (line) { 7252 if (line.appendToBuffer) { 7253 if (bufferStart) { 7254 line.prepend(' + '); 7255 } else { 7256 bufferStart = line; 7257 } 7258 bufferEnd = line; 7259 } else { 7260 if (bufferStart) { 7261 if (!sourceSeen) { 7262 appendFirst = true; 7263 } else { 7264 bufferStart.prepend('buffer += '); 7265 } 7266 bufferEnd.add(';'); 7267 bufferStart = bufferEnd = undefined; 7268 } 7269 7270 sourceSeen = true; 7271 if (!isSimple) { 7272 appendOnly = false; 7273 } 7274 } 7275 }); 7276 7277 if (appendOnly) { 7278 if (bufferStart) { 7279 bufferStart.prepend('return '); 7280 bufferEnd.add(';'); 7281 } else if (!sourceSeen) { 7282 this.source.push('return "";'); 7283 } 7284 } else { 7285 varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); 7286 7287 if (bufferStart) { 7288 bufferStart.prepend('return buffer + '); 7289 bufferEnd.add(';'); 7290 } else { 7291 this.source.push('return buffer;'); 7292 } 7293 } 7294 7295 if (varDeclarations) { 7296 this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); 7297 } 7298 7299 return this.source.merge(); 7300 }, 7301 7302 lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { 7303 return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); 7304 }, 7305 7306 // [blockValue] 7307 // 7308 // On stack, before: hash, inverse, program, value 7309 // On stack, after: return value of blockHelperMissing 7310 // 7311 // The purpose of this opcode is to take a block of the form 7312 // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and 7313 // replace it on the stack with the result of properly 7314 // invoking blockHelperMissing. 7315 blockValue: function blockValue(name) { 7316 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 7317 params = [this.contextName(0)]; 7318 this.setupHelperArgs(name, 0, params); 7319 7320 var blockName = this.popStack(); 7321 params.splice(1, 0, blockName); 7322 7323 this.push(this.source.functionCall(blockHelperMissing, 'call', params)); 7324 }, 7325 7326 // [ambiguousBlockValue] 7327 // 7328 // On stack, before: hash, inverse, program, value 7329 // Compiler value, before: lastHelper=value of last found helper, if any 7330 // On stack, after, if no lastHelper: same as [blockValue] 7331 // On stack, after, if lastHelper: value 7332 ambiguousBlockValue: function ambiguousBlockValue() { 7333 // We're being a bit cheeky and reusing the options value from the prior exec 7334 var blockHelperMissing = this.aliasable('container.hooks.blockHelperMissing'), 7335 params = [this.contextName(0)]; 7336 this.setupHelperArgs('', 0, params, true); 7337 7338 this.flushInline(); 7339 7340 var current = this.topStack(); 7341 params.splice(1, 0, current); 7342 7343 this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); 7344 }, 7345 7346 // [appendContent] 7347 // 7348 // On stack, before: ... 7349 // On stack, after: ... 7350 // 7351 // Appends the string value of `content` to the current buffer 7352 appendContent: function appendContent(content) { 7353 if (this.pendingContent) { 7354 content = this.pendingContent + content; 7355 } else { 7356 this.pendingLocation = this.source.currentLocation; 7357 } 7358 7359 this.pendingContent = content; 7360 }, 7361 7362 // [append] 7363 // 7364 // On stack, before: value, ... 7365 // On stack, after: ... 7366 // 7367 // Coerces `value` to a String and appends it to the current buffer. 7368 // 7369 // If `value` is truthy, or 0, it is coerced into a string and appended 7370 // Otherwise, the empty string is appended 7371 append: function append() { 7372 if (this.isInline()) { 7373 this.replaceStack(function (current) {
vendor: 13,784 bytes, lines 7374-7798
7374 return [' != null ? ', current, ' : ""']; 7375 }); 7376 7377 this.pushSource(this.appendToBuffer(this.popStack())); 7378 } else { 7379 var local = this.popStack(); 7380 this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); 7381 if (this.environment.isSimple) { 7382 this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']); 7383 } 7384 } 7385 }, 7386 7387 // [appendEscaped] 7388 // 7389 // On stack, before: value, ... 7390 // On stack, after: ... 7391 // 7392 // Escape `value` and append it to the buffer 7393 appendEscaped: function appendEscaped() { 7394 this.pushSource(this.appendToBuffer([this.aliasable('container.escapeExpression'), '(', this.popStack(), ')'])); 7395 }, 7396 7397 // [getContext] 7398 // 7399 // On stack, before: ... 7400 // On stack, after: ... 7401 // Compiler value, after: lastContext=depth 7402 // 7403 // Set the value of the `lastContext` compiler value to the depth 7404 getContext: function getContext(depth) { 7405 this.lastContext = depth; 7406 }, 7407 7408 // [pushContext] 7409 // 7410 // On stack, before: ... 7411 // On stack, after: currentContext, ... 7412 // 7413 // Pushes the value of the current context onto the stack. 7414 pushContext: function pushContext() { 7415 this.pushStackLiteral(this.contextName(this.lastContext)); 7416 }, 7417 7418 // [lookupOnContext] 7419 // 7420 // On stack, before: ... 7421 // On stack, after: currentContext[name], ... 7422 // 7423 // Looks up the value of `name` on the current context and pushes 7424 // it onto the stack. 7425 lookupOnContext: function lookupOnContext(parts, falsy, strict, scoped) { 7426 var i = 0; 7427 7428 if (!scoped && this.options.compat && !this.lastContext) { 7429 // The depthed query is expected to handle the undefined logic for the root level that 7430 // is implemented below, so we evaluate that directly in compat mode 7431 this.push(this.depthedLookup(parts[i++])); 7432 } else { 7433 this.pushContext(); 7434 } 7435 7436 this.resolvePath('context', parts, i, falsy, strict); 7437 }, 7438 7439 // [lookupBlockParam] 7440 // 7441 // On stack, before: ... 7442 // On stack, after: blockParam[name], ... 7443 // 7444 // Looks up the value of `parts` on the given block param and pushes 7445 // it onto the stack. 7446 lookupBlockParam: function lookupBlockParam(blockParamId, parts) { 7447 this.useBlockParams = true; 7448 7449 this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); 7450 this.resolvePath('context', parts, 1); 7451 }, 7452 7453 // [lookupData] 7454 // 7455 // On stack, before: ... 7456 // On stack, after: data, ... 7457 // 7458 // Push the data lookup operator 7459 lookupData: function lookupData(depth, parts, strict) { 7460 if (!depth) { 7461 this.pushStackLiteral('data'); 7462 } else { 7463 this.pushStackLiteral('container.data(data, ' + depth + ')'); 7464 } 7465 7466 this.resolvePath('data', parts, 0, true, strict); 7467 }, 7468 7469 resolvePath: function resolvePath(type, parts, i, falsy, strict) { 7470 // istanbul ignore next 7471 7472 var _this2 = this; 7473 7474 if (this.options.strict || this.options.assumeObjects) { 7475 this.push(strictLookup(this.options.strict && strict, this, parts, i, type)); 7476 return; 7477 } 7478 7479 var len = parts.length; 7480 for (; i < len; i++) { 7481 /* eslint-disable no-loop-func */ 7482 this.replaceStack(function (current) { 7483 var lookup = _this2.nameLookup(current, parts[i], type); 7484 // We want to ensure that zero and false are handled properly if the context (falsy flag) 7485 // needs to have the special handling for these values. 7486 if (!falsy) { 7487 return [' != null ? ', lookup, ' : ', current]; 7488 } else { 7489 // Otherwise we can use generic falsy handling 7490 return [' && ', lookup]; 7491 } 7492 }); 7493 /* eslint-enable no-loop-func */ 7494 } 7495 }, 7496 7497 // [resolvePossibleLambda] 7498 // 7499 // On stack, before: value, ... 7500 // On stack, after: resolved value, ... 7501 // 7502 // If the `value` is a lambda, replace it on the stack by 7503 // the return value of the lambda 7504 resolvePossibleLambda: function resolvePossibleLambda() { 7505 this.push([this.aliasable('container.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); 7506 }, 7507 7508 // [pushStringParam] 7509 // 7510 // On stack, before: ... 7511 // On stack, after: string, currentContext, ... 7512 // 7513 // This opcode is designed for use in string mode, which 7514 // provides the string value of a parameter along with its 7515 // depth rather than resolving it immediately. 7516 pushStringParam: function pushStringParam(string, type) { 7517 this.pushContext(); 7518 this.pushString(type); 7519 7520 // If it's a subexpression, the string result 7521 // will be pushed after this opcode. 7522 if (type !== 'SubExpression') { 7523 if (typeof string === 'string') { 7524 this.pushString(string); 7525 } else { 7526 this.pushStackLiteral(string); 7527 } 7528 } 7529 }, 7530 7531 emptyHash: function emptyHash(omitEmpty) { 7532 if (this.trackIds) { 7533 this.push('{}'); // hashIds 7534 } 7535 if (this.stringParams) { 7536 this.push('{}'); // hashContexts 7537 this.push('{}'); // hashTypes 7538 } 7539 this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); 7540 }, 7541 pushHash: function pushHash() { 7542 if (this.hash) { 7543 this.hashes.push(this.hash); 7544 } 7545 this.hash = { values: {}, types: [], contexts: [], ids: [] }; 7546 }, 7547 popHash: function popHash() { 7548 var hash = this.hash; 7549 this.hash = this.hashes.pop(); 7550 7551 if (this.trackIds) { 7552 this.push(this.objectLiteral(hash.ids)); 7553 } 7554 if (this.stringParams) { 7555 this.push(this.objectLiteral(hash.contexts)); 7556 this.push(this.objectLiteral(hash.types)); 7557 } 7558 7559 this.push(this.objectLiteral(hash.values)); 7560 }, 7561 7562 // [pushString] 7563 // 7564 // On stack, before: ... 7565 // On stack, after: quotedString(string), ... 7566 // 7567 // Push a quoted version of `string` onto the stack 7568 pushString: function pushString(string) { 7569 this.pushStackLiteral(this.quotedString(string)); 7570 }, 7571 7572 // [pushLiteral] 7573 // 7574 // On stack, before: ... 7575 // On stack, after: value, ... 7576 // 7577 // Pushes a value onto the stack. This operation prevents 7578 // the compiler from creating a temporary variable to hold 7579 // it. 7580 pushLiteral: function pushLiteral(value) { 7581 this.pushStackLiteral(value); 7582 }, 7583 7584 // [pushProgram] 7585 // 7586 // On stack, before: ... 7587 // On stack, after: program(guid), ... 7588 // 7589 // Push a program expression onto the stack. This takes 7590 // a compile-time guid and converts it into a runtime-accessible 7591 // expression. 7592 pushProgram: function pushProgram(guid) { 7593 if (guid != null) { 7594 this.pushStackLiteral(this.programExpression(guid)); 7595 } else { 7596 this.pushStackLiteral(null); 7597 } 7598 }, 7599 7600 // [registerDecorator] 7601 // 7602 // On stack, before: hash, program, params..., ... 7603 // On stack, after: ... 7604 // 7605 // Pops off the decorator's parameters, invokes the decorator, 7606 // and inserts the decorator into the decorators list. 7607 registerDecorator: function registerDecorator(paramSize, name) { 7608 var foundDecorator = this.nameLookup('decorators', name, 'decorator'), 7609 options = this.setupHelperArgs(name, paramSize); 7610 7611 this.decorators.push(['fn = ', this.decorators.functionCall(foundDecorator, '', ['fn', 'props', 'container', options]), ' || fn;']); 7612 }, 7613 7614 // [invokeHelper] 7615 // 7616 // On stack, before: hash, inverse, program, params..., ... 7617 // On stack, after: result of helper invocation 7618 // 7619 // Pops off the helper's parameters, invokes the helper, 7620 // and pushes the helper's return value onto the stack. 7621 // 7622 // If the helper is not found, `helperMissing` is called. 7623 invokeHelper: function invokeHelper(paramSize, name, isSimple) { 7624 var nonHelper = this.popStack(), 7625 helper = this.setupHelper(paramSize, name); 7626 7627 var possibleFunctionCalls = []; 7628 7629 if (isSimple) { 7630 // direct call to helper 7631 possibleFunctionCalls.push(helper.name); 7632 } 7633 // call a function from the input object 7634 possibleFunctionCalls.push(nonHelper); 7635 if (!this.options.strict) { 7636 possibleFunctionCalls.push(this.aliasable('container.hooks.helperMissing')); 7637 } 7638 7639 var functionLookupCode = ['(', this.itemsSeparatedBy(possibleFunctionCalls, '||'), ')']; 7640 var functionCall = this.source.functionCall(functionLookupCode, 'call', helper.callParams); 7641 this.push(functionCall); 7642 }, 7643 7644 itemsSeparatedBy: function itemsSeparatedBy(items, separator) { 7645 var result = []; 7646 result.push(items[0]); 7647 for (var i = 1; i < items.length; i++) { 7648 result.push(separator, items[i]); 7649 } 7650 return result; 7651 }, 7652 // [invokeKnownHelper] 7653 // 7654 // On stack, before: hash, inverse, program, params..., ... 7655 // On stack, after: result of helper invocation 7656 // 7657 // This operation is used when the helper is known to exist, 7658 // so a `helperMissing` fallback is not required. 7659 invokeKnownHelper: function invokeKnownHelper(paramSize, name) { 7660 var helper = this.setupHelper(paramSize, name); 7661 this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); 7662 }, 7663 7664 // [invokeAmbiguous] 7665 // 7666 // On stack, before: hash, inverse, program, params..., ... 7667 // On stack, after: result of disambiguation 7668 // 7669 // This operation is used when an expression like `{{foo}}` 7670 // is provided, but we don't know at compile-time whether it 7671 // is a helper or a path. 7672 // 7673 // This operation emits more code than the other options, 7674 // and can be avoided by passing the `knownHelpers` and 7675 // `knownHelpersOnly` flags at compile-time. 7676 invokeAmbiguous: function invokeAmbiguous(name, helperCall) { 7677 this.useRegister('helper'); 7678 7679 var nonHelper = this.popStack(); 7680 7681 this.emptyHash(); 7682 var helper = this.setupHelper(0, name, helperCall); 7683 7684 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 7685 7686 var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; 7687 if (!this.options.strict) { 7688 lookup[0] = '(helper = '; 7689 lookup.push(' != null ? helper : ', this.aliasable('container.hooks.helperMissing')); 7690 } 7691 7692 this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); 7693 }, 7694 7695 // [invokePartial] 7696 // 7697 // On stack, before: context, ... 7698 // On stack after: result of partial invocation 7699 // 7700 // This operation pops off a context, invokes a partial with that context, 7701 // and pushes the result of the invocation back. 7702 invokePartial: function invokePartial(isDynamic, name, indent) { 7703 var params = [], 7704 options = this.setupParams(name, 1, params); 7705 7706 if (isDynamic) { 7707 name = this.popStack(); 7708 delete options.name; 7709 } 7710 7711 if (indent) { 7712 options.indent = JSON.stringify(indent); 7713 } 7714 options.helpers = 'helpers'; 7715 options.partials = 'partials'; 7716 options.decorators = 'container.decorators'; 7717 7718 if (!isDynamic) { 7719 params.unshift(this.nameLookup('partials', name, 'partial')); 7720 } else { 7721 params.unshift(name); 7722 } 7723 7724 if (this.options.compat) { 7725 options.depths = 'depths'; 7726 } 7727 options = this.objectLiteral(options); 7728 params.push(options); 7729 7730 this.push(this.source.functionCall('container.invokePartial', '', params)); 7731 }, 7732 7733 // [assignToHash] 7734 // 7735 // On stack, before: value, ..., hash, ... 7736 // On stack, after: ..., hash, ... 7737 // 7738 // Pops a value off the stack and assigns it to the current hash 7739 assignToHash: function assignToHash(key) { 7740 var value = this.popStack(), 7741 context = undefined, 7742 type = undefined, 7743 id = undefined; 7744 7745 if (this.trackIds) { 7746 id = this.popStack(); 7747 } 7748 if (this.stringParams) { 7749 type = this.popStack(); 7750 context = this.popStack(); 7751 } 7752 7753 var hash = this.hash; 7754 if (context) { 7755 hash.contexts[key] = context; 7756 } 7757 if (type) { 7758 hash.types[key] = type; 7759 } 7760 if (id) { 7761 hash.ids[key] = id; 7762 } 7763 hash.values[key] = value; 7764 }, 7765 7766 pushId: function pushId(type, name, child) { 7767 if (type === 'BlockParam') { 7768 this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); 7769 } else if (type === 'PathExpression') { 7770 this.pushString(name); 7771 } else if (type === 'SubExpression') { 7772 this.pushStackLiteral('true'); 7773 } else { 7774 this.pushStackLiteral('null'); 7775 } 7776 }, 7777 7778 // HELPERS 7779 7780 compiler: JavaScriptCompiler, 7781 7782 compileChildren: function compileChildren(environment, options) { 7783 var children = environment.children, 7784 child = undefined, 7785 compiler = undefined; 7786 7787 for (var i = 0, l = children.length; i < l; i++) { 7788 child = children[i]; 7789 compiler = new this.compiler(); // eslint-disable-line new-cap 7790 7791 var existing = this.matchExistingProgram(child); 7792 7793 if (existing == null) { 7794 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 7795 var index = this.context.programs.length; 7796 child.index = index; 7797 child.name = 'program' + index; 7798 this.context.programs[index] = compiler.compile(child, options, this.context, !this.prec
vendor: 9,414 bytes, lines 7798-8110
7798ompile); 7799 this.context.decorators[index] = compiler.decorators; 7800 this.context.environments[index] = child; 7801 7802 this.useDepths = this.useDepths || compiler.useDepths; 7803 this.useBlockParams = this.useBlockParams || compiler.useBlockParams; 7804 child.useDepths = this.useDepths; 7805 child.useBlockParams = this.useBlockParams; 7806 } else { 7807 child.index = existing.index; 7808 child.name = 'program' + existing.index; 7809 7810 this.useDepths = this.useDepths || existing.useDepths; 7811 this.useBlockParams = this.useBlockParams || existing.useBlockParams; 7812 } 7813 } 7814 }, 7815 matchExistingProgram: function matchExistingProgram(child) { 7816 for (var i = 0, len = this.context.environments.length; i < len; i++) { 7817 var environment = this.context.environments[i]; 7818 if (environment && environment.equals(child)) { 7819 return environment; 7820 } 7821 } 7822 }, 7823 7824 programExpression: function programExpression(guid) { 7825 var child = this.environment.children[guid], 7826 programParams = [child.index, 'data', child.blockParams]; 7827 7828 if (this.useBlockParams || this.useDepths) { 7829 programParams.push('blockParams'); 7830 } 7831 if (this.useDepths) { 7832 programParams.push('depths'); 7833 } 7834 7835 return 'container.program(' + programParams.join(', ') + ')'; 7836 }, 7837 7838 useRegister: function useRegister(name) { 7839 if (!this.registers[name]) { 7840 this.registers[name] = true; 7841 this.registers.list.push(name); 7842 } 7843 }, 7844 7845 push: function push(expr) { 7846 if (!(expr instanceof Literal)) { 7847 expr = this.source.wrap(expr); 7848 } 7849 7850 this.inlineStack.push(expr); 7851 return expr; 7852 }, 7853 7854 pushStackLiteral: function pushStackLiteral(item) { 7855 this.push(new Literal(item)); 7856 }, 7857 7858 pushSource: function pushSource(source) { 7859 if (this.pendingContent) { 7860 this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); 7861 this.pendingContent = undefined; 7862 } 7863 7864 if (source) { 7865 this.source.push(source); 7866 } 7867 }, 7868 7869 replaceStack: function replaceStack(callback) { 7870 var prefix = ['('], 7871 stack = undefined, 7872 createdStack = undefined, 7873 usedLiteral = undefined; 7874 7875 /* istanbul ignore next */ 7876 if (!this.isInline()) { 7877 throw new _exception2['default']('replaceStack on non-inline'); 7878 } 7879 7880 // We want to merge the inline statement into the replacement statement via ',' 7881 var top = this.popStack(true); 7882 7883 if (top instanceof Literal) { 7884 // Literals do not need to be inlined 7885 stack = [top.value]; 7886 prefix = ['(', stack]; 7887 usedLiteral = true; 7888 } else { 7889 // Get or create the current stack name for use by the inline 7890 createdStack = true; 7891 var _name = this.incrStack(); 7892 7893 prefix = ['((', this.push(_name), ' = ', top, ')']; 7894 stack = this.topStack(); 7895 } 7896 7897 var item = callback.call(this, stack); 7898 7899 if (!usedLiteral) { 7900 this.popStack(); 7901 } 7902 if (createdStack) { 7903 this.stackSlot--; 7904 } 7905 this.push(prefix.concat(item, ')')); 7906 }, 7907 7908 incrStack: function incrStack() { 7909 this.stackSlot++; 7910 if (this.stackSlot > this.stackVars.length) { 7911 this.stackVars.push('stack' + this.stackSlot); 7912 } 7913 return this.topStackName(); 7914 }, 7915 topStackName: function topStackName() { 7916 return 'stack' + this.stackSlot; 7917 }, 7918 flushInline: function flushInline() { 7919 var inlineStack = this.inlineStack; 7920 this.inlineStack = []; 7921 for (var i = 0, len = inlineStack.length; i < len; i++) { 7922 var entry = inlineStack[i]; 7923 /* istanbul ignore if */ 7924 if (entry instanceof Literal) { 7925 this.compileStack.push(entry); 7926 } else { 7927 var stack = this.incrStack(); 7928 this.pushSource([stack, ' = ', entry, ';']); 7929 this.compileStack.push(stack); 7930 } 7931 } 7932 }, 7933 isInline: function isInline() { 7934 return this.inlineStack.length; 7935 }, 7936 7937 popStack: function popStack(wrapped) { 7938 var inline = this.isInline(), 7939 item = (inline ? this.inlineStack : this.compileStack).pop(); 7940 7941 if (!wrapped && item instanceof Literal) { 7942 return item.value; 7943 } else { 7944 if (!inline) { 7945 /* istanbul ignore next */ 7946 if (!this.stackSlot) { 7947 throw new _exception2['default']('Invalid stack pop'); 7948 } 7949 this.stackSlot--; 7950 } 7951 return item; 7952 } 7953 }, 7954 7955 topStack: function topStack() { 7956 var stack = this.isInline() ? this.inlineStack : this.compileStack, 7957 item = stack[stack.length - 1]; 7958 7959 /* istanbul ignore if */ 7960 if (item instanceof Literal) { 7961 return item.value; 7962 } else { 7963 return item; 7964 } 7965 }, 7966 7967 contextName: function contextName(context) { 7968 if (this.useDepths && context) { 7969 return 'depths[' + context + ']'; 7970 } else { 7971 return 'depth' + context; 7972 } 7973 }, 7974 7975 quotedString: function quotedString(str) { 7976 return this.source.quotedString(str); 7977 }, 7978 7979 objectLiteral: function objectLiteral(obj) { 7980 return this.source.objectLiteral(obj); 7981 }, 7982 7983 aliasable: function aliasable(name) { 7984 var ret = this.aliases[name]; 7985 if (ret) { 7986 ret.referenceCount++; 7987 return ret; 7988 } 7989 7990 ret = this.aliases[name] = this.source.wrap(name); 7991 ret.aliasable = true; 7992 ret.referenceCount = 1; 7993 7994 return ret; 7995 }, 7996 7997 setupHelper: function setupHelper(paramSize, name, blockHelper) { 7998 var params = [], 7999 paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); 8000 var foundHelper = this.nameLookup('helpers', name, 'helper'), 8001 callContext = this.aliasable(this.contextName(0) + ' != null ? ' + this.contextName(0) + ' : (container.nullContext || {})'); 8002 8003 return { 8004 params: params, 8005 paramsInit: paramsInit, 8006 name: foundHelper, 8007 callParams: [callContext].concat(params) 8008 }; 8009 }, 8010 8011 setupParams: function setupParams(helper, paramSize, params) { 8012 var options = {}, 8013 contexts = [], 8014 types = [], 8015 ids = [], 8016 objectArgs = !params, 8017 param = undefined; 8018 8019 if (objectArgs) { 8020 params = []; 8021 } 8022 8023 options.name = this.quotedString(helper); 8024 options.hash = this.popStack(); 8025 8026 if (this.trackIds) { 8027 options.hashIds = this.popStack(); 8028 } 8029 if (this.stringParams) { 8030 options.hashTypes = this.popStack(); 8031 options.hashContexts = this.popStack(); 8032 } 8033 8034 var inverse = this.popStack(), 8035 program = this.popStack(); 8036 8037 // Avoid setting fn and inverse if neither are set. This allows 8038 // helpers to do a check for `if (options.fn)` 8039 if (program || inverse) { 8040 options.fn = program || 'container.noop'; 8041 options.inverse = inverse || 'container.noop'; 8042 } 8043 8044 // The parameters go on to the stack in order (making sure that they are evaluated in order) 8045 // so we need to pop them off the stack in reverse order 8046 var i = paramSize; 8047 while (i--) { 8048 param = this.popStack(); 8049 params[i] = param; 8050 8051 if (this.trackIds) { 8052 ids[i] = this.popStack(); 8053 } 8054 if (this.stringParams) { 8055 types[i] = this.popStack(); 8056 contexts[i] = this.popStack(); 8057 } 8058 } 8059 8060 if (objectArgs) { 8061 options.args = this.source.generateArray(params); 8062 } 8063 8064 if (this.trackIds) { 8065 options.ids = this.source.generateArray(ids); 8066 } 8067 if (this.stringParams) { 8068 options.types = this.source.generateArray(types); 8069 options.contexts = this.source.generateArray(contexts); 8070 } 8071 8072 if (this.options.data) { 8073 options.data = 'data'; 8074 } 8075 if (this.useBlockParams) { 8076 options.blockParams = 'blockParams'; 8077 } 8078 return options; 8079 }, 8080 8081 setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { 8082 var options = this.setupParams(helper, paramSize, params); 8083 options.loc = JSON.stringify(this.source.currentLocation); 8084 options = this.objectLiteral(options); 8085 if (useRegister) { 8086 this.useRegister('options'); 8087 params.push('options'); 8088 return ['options=', options]; 8089 } else if (params) { 8090 params.push(options); 8091 return ''; 8092 } else { 8093 return options; 8094 } 8095 } 8096 }; 8097 8098 (function () { 8099 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(' '); 8100 8101 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 8102 8103 for (var i = 0, l = reservedWords.length; i < l; i++) { 8104 compilerWords[reservedWords[i]] = true; 8105 } 8106 })(); 8107 8108 /** 8109 * @deprecated May be removed in the next major version 8110 */
8111 JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { 8112 return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); 8113 }; 8114 8115 function strictLookup(requireTerminal, compiler, parts, i, type) { 8116 var stack = compiler.popStack(), 8117 len = parts.length; 8118 if (requireTerminal) { 8119 len--; 8120 } 8121 8122 for (; i < len; i++) { 8123 stack = compiler.nameLookup(stack, parts[i], type); 8124 } 8125 8126 if (requireTerminal) { 8127 return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; 8128 } else { 8129 return stack; 8130 } 8131 } 8132 8133 exports$1['default'] = JavaScriptCompiler; 8134 module.exports = exports$1['default']; 8135 8136 } (javascriptCompiler, javascriptCompiler.exports)); 8137 return javascriptCompiler.exports; 8138} 8139 8140var hasRequiredHandlebars; 8141 8142function requireHandlebars () { 8143 if (hasRequiredHandlebars) return handlebars.exports; 8144 hasRequiredHandlebars = 1; 8145 (function (module, exports$1) { 8146 8147 exports$1.__esModule = true; 8148 // istanbul ignore next 8149 8150 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 8151 8152 var _handlebarsRuntime = requireHandlebars_runtime(); 8153 8154 var _handlebarsRuntime2 = _interopRequireDefault(_handlebarsRuntime); 8155 8156 // Compiler imports 8157 8158 var _handlebarsCompilerAst = requireAst(); 8159 8160 var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); 8161 8162 var _handlebarsCompilerBase = requireBase(); 8163 8164 var _handlebarsCompilerCompiler = requireCompiler(); 8165 8166 var _handlebarsCompilerJavascriptCompiler = requireJavascriptCompiler(); 8167 8168 var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); 8169 8170 var _handlebarsCompilerVisitor = requireVisitor(); 8171 8172 var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); 8173 8174 var _handlebarsNoConflict = requireNoConflict(); 8175 8176 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); 8177 8178 var _create = _handlebarsRuntime2['default'].create; 8179 function create() { 8180 var hb = _create(); 8181 8182 hb.compile = function (input, options) { 8183 return _handlebarsCompilerCompiler.compile(input, options, hb); 8184 }; 8185 hb.precompile = function (input, options) { 8186 return _handlebarsCompilerCompiler.precompile(input, options, hb); 8187 }; 8188 8189 hb.AST = _handlebarsCompilerAst2['default']; 8190 hb.Compiler = _handlebarsCompilerCompiler.Compiler; 8191 hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; 8192 hb.Parser = _handlebarsCompilerBase.parser; 8193 hb.parse = _handlebarsCompilerBase.parse; 8194 hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; 8195 8196 return hb; 8197 } 8198 8199 var inst = create(); 8200 inst.create = create; 8201 8202 _handlebarsNoConflict2['default'](inst); 8203 8204 inst.Visitor = _handlebarsCompilerVisitor2['default']; 8205 8206 inst['default'] = inst; 8207 8208 exports$1['default'] = inst; 8209 module.exports = exports$1['default']; 8210 8211 } (handlebars, handlebars.exports)); 8212 return handlebars.exports; 8213} 8214 8215var handlebarsExports = requireHandlebars(); 8216const Handlebars = /*@__PURE__*/getDefaultExportFromCjs(handlebarsExports); 8217 8218var root_1 = from_html(`<div class="error-container svelte-26mp0t"><strong class="error-title svelte-26mp0t">Error rendering <code class="error-component-name svelte-26mp0t"> </code>:</strong> <code class="error-message svelte-26mp0t"> </code></div>`); 8219var root_3 = from_html(`<div></div> <!> <div></div>`, 1); 8220var root_2 = from_html(`<div><!></div>`); 8221 8222function HTML($$anchor, $$props) { 8223 push($$props, true); 8224 8225 let elem_classes = prop($$props, 'elem_classes', 19, () => []), 8226 props = prop($$props, 'props', 23, () => ({})), 8227 html_template = prop($$props, 'html_template', 3, "${value}"), 8228 css_template = prop($$props, 'css_template', 3, ""), 8229 js_on_load = prop($$props, 'js_on_load', 3, null), 8230 head = prop($$props, 'head', 3, null), 8231 visible = prop($$props, 'visible', 3, true), 8232 autoscroll = prop($$props, 'autoscroll', 3, false), 8233 apply_default_css = prop($$props, 'apply_default_css', 3, true), 8234 component_class_name = prop($$props, 'component_class_name', 3, "HTML"), 8235 upload = prop($$props, 'upload', 3, null), 8236 server = prop($$props, 'server', 19, () => ({})); 8237 8238 let $$d = user_derived(() => { 8239 if (html_template().includes("@children") && $$props.children) { 8240 const parts = html_template().split("@children"); 8241 8242 return [true, parts[0] || "", parts.slice(1).join("@children") || ""]; 8243 } 8244 8245 return [false, html_template(), ""]; 8246 }), 8247 $$array = user_derived(() => to_array(get($$d), 3)), 8248 has_children = user_derived(() => get($$array)[0]), 8249 pre_html_template = user_derived(() => get($$array)[1]), 8250 post_html_template = user_derived(() => get($$array)[2]); 8251 8252 let old_props = state(proxy(JSON.parse(JSON.stringify(props())))); 8253 const dispatch = createEventDispatcher(); 8254 8255 const trigger = (event_type, event_data = {}) => { 8256 dispatch("event", { type: event_type, data: event_data }); 8257 }; 8258 8259 let element; 8260 let pre_element; 8261 let post_element; 8262 let scrollable_parent = null; 8263 let random_id = `html-${Math.random().toString(36).substring(2, 11)}`; 8264 let style_element = null; 8265 let reactiveProps = {}; 8266 let currentHtml = state(""); 8267 let currentPreHtml = state(""); 8268 let currentPostHtml = state(""); 8269 let currentCss = state(""); 8270 let renderScheduled = state(false); 8271 let mounted = state(false); 8272 let html_error_message = state(null); 8273 let css_error_message = state(null); 8274 8275 function get_scrollable_parent(element) { 8276 let parent = element.parentElement; 8277 8278 while (parent) { 8279 const style = window.getComputedStyle(parent); 8280 8281 if (style.overflow === "auto" || style.overflow === "scroll" || style.overflowY === "auto" || style.overflowY === "scroll") { 8282 return parent; 8283 } 8284 8285 parent = parent.parentElement; 8286 } 8287 8288 return null; 8289 } 8290 8291 function is_at_bottom() { 8292 if (!element) return true; 8293 8294 if (!scrollable_parent) { 8295 return window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 100; 8296 } 8297 8298 return scrollable_parent.offsetHeight + scrollable_parent.scrollTop >= scrollable_parent.scrollHeight - 100; 8299 } 8300 8301 function scroll_to_bottom() { 8302 if (!element) return; 8303 8304 if (scrollable_parent) { 8305 scrollable_parent.scrollTo(0, scrollable_parent.scrollHeight); 8306 } else { 8307 window.scrollTo(0, document.documentElement.scrollHeight); 8308 } 8309 } 8310 8311 async function scroll_on_html_update() { 8312 if (!autoscroll() || !element) return; 8313 8314 if (!scrollable_parent) { 8315 scrollable_parent = get_scrollable_parent(element); 8316 } 8317 8318 if (is_at_bottom()) { 8319 await new Promise((resolve) => setTimeout(resolve, 300)); 8320 scroll_to_bottom(); 8321 } 8322 } 8323 8324 function render_template(template, props, language = "html") { 8325 try { 8326 const handlebarsTemplate = Handlebars.compile(template); 8327 const handlebarsRendered = handlebarsTemplate(props); 8328 const propKeys = Object.keys(props); 8329 const propValues = Object.values(props); 8330 const templateFunc = new Function(...propKeys, `return \`${handlebarsRendered}\`;`); 8331 8332 if (language === "html") { 8333 set(html_error_message, null); 8334 } else if (language === "css") { 8335 set(css_error_message, null); 8336 } 8337 8338 return templateFunc(...propValues); 8339 } catch(e) { 8340 console.error("Error evaluating template:", e); 8341 8342 if (language === "html") {
8343 set(html_error_message, e instanceof Error ? e.message : String(e), true); 8344 } else if (language === "css") { 8345 set(css_error_message, e instanceof Error ? e.message : String(e), true); 8346 } 8347 8348 return ""; 8349 } 8350 } 8351 8352 function update_css() { 8353 if (typeof document === "undefined") return; 8354 8355 if (!style_element) { 8356 style_element = document.createElement("style"); 8357 document.head.appendChild(style_element); 8358 } 8359 8360 set(currentCss, render_template(css_template(), reactiveProps, "css"), true); 8361 8362 if (get(currentCss)) { 8363 style_element.textContent = `#${random_id} { ${get(currentCss)} }`; 8364 } else { 8365 style_element.textContent = ""; 8366 } 8367 } 8368 8369 function updateDOM(_element, oldHtml, newHtml) { 8370 if (!_element || oldHtml === newHtml) return; 8371 8372 const tempContainer = document.createElement("div"); 8373 8374 tempContainer.innerHTML = newHtml; 8375 8376 const oldNodes = Array.from(_element.childNodes); 8377 const newNodes = Array.from(tempContainer.childNodes); 8378 const maxLength = Math.max(oldNodes.length, newNodes.length); 8379 8380 for (let i = 0; i < maxLength; i++) { 8381 const oldNode = oldNodes[i]; 8382 const newNode = newNodes[i]; 8383 8384 if (!oldNode && newNode) { 8385 _element.appendChild(newNode.cloneNode(true)); 8386 } else if (oldNode && !newNode) { 8387 _element.removeChild(oldNode); 8388 } else if (oldNode && newNode) { 8389 updateNode(oldNode, newNode); 8390 } 8391 } 8392 } 8393 8394 // eslint-disable-next-line complexity 8395 function updateNode(oldNode, newNode) { 8396 if (oldNode.nodeType === Node.TEXT_NODE && newNode.nodeType === Node.TEXT_NODE) { 8397 if (oldNode.textContent !== newNode.textContent) { 8398 oldNode.textContent = newNode.textContent; 8399 } 8400 8401 return; 8402 } 8403 8404 if (oldNode.nodeType === Node.ELEMENT_NODE && newNode.nodeType === Node.ELEMENT_NODE) { 8405 const oldElement = oldNode; 8406 const newElement = newNode; 8407 8408 if (oldElement.tagName !== newElement.tagName) { 8409 oldNode.parentNode?.replaceChild(newNode.cloneNode(true), oldNode); 8410 8411 return; 8412 } 8413 8414 const oldAttrs = Array.from(oldElement.attributes); 8415 const newAttrs = Array.from(newElement.attributes); 8416 8417 for (const attr of oldAttrs) { 8418 if (!newElement.hasAttribute(attr.name)) { 8419 oldElement.removeAttribute(attr.name); 8420 } 8421 } 8422 8423 for (const attr of newAttrs) { 8424 if (oldElement.getAttribute(attr.name) !== attr.value) { 8425 oldElement.setAttribute(attr.name, attr.value); 8426 8427 if (attr.name === "value" && (oldElement.tagName === "INPUT" || oldElement.tagName === "TEXTAREA" || oldElement.tagName === "SELECT")) { 8428 oldElement.value = attr.value; 8429 } 8430 } 8431 } 8432 8433 const oldChildren = Array.from(oldElement.childNodes); 8434 const newChildren = Array.from(newElement.childNodes); 8435 const maxChildren = Math.max(oldChildren.length, newChildren.length); 8436 8437 for (let i = 0; i < maxChildren; i++) { 8438 const oldChild = oldChildren[i]; 8439 const newChild = newChildren[i]; 8440 8441 if (!oldChild && newChild) { 8442 oldElement.appendChild(newChild.cloneNode(true)); 8443 } else if (oldChild && !newChild) { 8444 oldElement.removeChild(oldChild); 8445 } else if (oldChild && newChild) { 8446 updateNode(oldChild, newChild); 8447 } 8448 } 8449 } else { 8450 oldNode.parentNode?.replaceChild(newNode.cloneNode(true), oldNode); 8451 } 8452 } 8453 8454 function renderHTML() { 8455 if (get(has_children)) { 8456 const newPreHtml = render_template(get(pre_html_template), reactiveProps, "html"); 8457 8458 updateDOM(pre_element, get(currentPreHtml), newPreHtml); 8459 set(currentPreHtml, newPreHtml, true); 8460 8461 const newPostHtml = render_template(get(post_html_template), reactiveProps, "html"); 8462 8463 updateDOM(post_element, get(currentPostHtml), newPostHtml); 8464 set(currentPostHtml, newPostHtml, true); 8465 } else { 8466 const newHtml = render_template(html_template(), reactiveProps, "html"); 8467 8468 updateDOM(element, get(currentHtml), newHtml); 8469 set(currentHtml, newHtml, true); 8470 } 8471 8472 if (autoscroll()) { 8473 scroll_on_html_update(); 8474 } 8475 } 8476 8477 function scheduleRender() { 8478 if (!get(renderScheduled)) { 8479 set(renderScheduled, true); 8480 8481 queueMicrotask(() => { 8482 set(renderScheduled, false); 8483 renderHTML(); 8484 update_css(); 8485 }); 8486 } 8487 } 8488 8489 async function loadHead(headHtml) { 8490 if (!headHtml) return; 8491 8492 const parser = new DOMParser(); 8493 const doc = parser.parseFromString(`<head>${headHtml}</head>`, "text/html");
8494 const promises = []; 8495 8496 for (const el of Array.from(doc.head.children)) { 8497 if (el.tagName === "SCRIPT") { 8498 const src = el.src; 8499 8500 if (src) { 8501 if (document.querySelector(`script[src="${src}"]`)) continue; 8502 8503 const script = document.createElement("script"); 8504 8505 script.src = src; 8506 8507 promises.push(new Promise((resolve, reject) => { 8508 script.onload = () => resolve(); 8509 script.onerror = () => reject(new Error(`Failed to load script: ${src}`)); 8510 })); 8511 8512 document.head.appendChild(script); 8513 } else { 8514 const script = document.createElement("script"); 8515 8516 script.textContent = el.textContent; 8517 document.head.appendChild(script); 8518 } 8519 } else { 8520 const existing = el.tagName === "LINK" && el.href 8521 ? document.querySelector(`link[href="${el.href}"]`) 8522 : null; 8523 8524 if (!existing) { 8525 document.head.appendChild(el.cloneNode(true)); 8526 } 8527 } 8528 } 8529 8530 await Promise.all(promises); 8531 } 8532 8533 // Mount effect 8534 user_effect(() => { 8535 if (!element || get(mounted)) return; 8536 8537 set(mounted, true); 8538 8539 reactiveProps = new Proxy({ ...props() }, { 8540 set(target, property, value) { 8541 const oldValue = target[property]; 8542 8543 target[property] = value; 8544 8545 if (oldValue !== value) { 8546 scheduleRender(); 8547 8548 if (property === "value" || property === "label" || property === "visible") { 8549 props()[property] = value; 8550 get(old_props)[property] = value; 8551 dispatch("update_value", { data: value, property }); 8552 } 8553 } 8554 8555 return true; 8556 } 8557 }); 8558 8559 if (get(has_children)) { 8560 set(currentPreHtml, render_template(get(pre_html_template), reactiveProps, "html"), true); 8561 pre_element.innerHTML = get(currentPreHtml); 8562 set(currentPostHtml, render_template(get(post_html_template), reactiveProps, "html"), true); 8563 post_element.innerHTML = get(currentPostHtml); 8564 } else { 8565 set(currentHtml, render_template(html_template(), reactiveProps, "html"), true); 8566 element.innerHTML = get(currentHtml); 8567 } 8568 8569 update_css(); 8570 8571 if (autoscroll()) { 8572 scroll_to_bottom(); 8573 } 8574 8575 scroll_on_html_update(); 8576 8577 (async () => { 8578 if (head()) { 8579 await loadHead(head()); 8580 } 8581 8582 if (js_on_load() && element) { 8583 try { 8584 const upload_func = upload() ?? (async (_file) => { 8585 throw new Error("upload is not available in this context"); 8586 }); 8587 8588 const func = new Function("element", "trigger", "props", "server", "upload", js_on_load()); 8589 8590 func(element, trigger, reactiveProps, server(), upload_func); 8591 } catch(error) { 8592 console.error("Error executing js_on_load:", error); 8593 } 8594 } 8595 })(); 8596 }); 8597 8598 // Props update effect 8599 user_effect(() => { 8600 if (reactiveProps && props() && JSON.stringify(get(old_props)) !== JSON.stringify(props())) { 8601 for (const key in props()) { 8602 if (reactiveProps[key] !== props()[key]) { 8603 reactiveProps[key] = props()[key]; 8604 } 8605 } 8606 8607 set(old_props, props(), true); 8608 } 8609 }); 8610 8611 var fragment = comment(); 8612 var node = first_child(fragment); 8613 8614 { 8615 var consequent = ($$anchor) => { 8616 var div = root_1(); 8617 var strong = child(div); 8618 var code = sibling(child(strong)); 8619 var text = child(code, true); 8620 8621 reset(code); 8622 next(); 8623 reset(strong); 8624 8625 var code_1 = sibling(strong, 2); 8626 var text_1 = child(code_1, true); 8627 8628 reset(code_1); 8629 reset(div); 8630 8631 template_effect(() => { 8632 set_text(text, component_class_name()); 8633 set_text(text_1, get(html_error_message) || get(css_error_message)); 8634 }); 8635 8636 append($$anchor, div); 8637 }; 8638 8639 var alternate = ($$anchor) => { 8640 var div_1 = root_2(); 8641 let classes; 8642 var node_1 = child(div_1); 8643 8644 { 8645 var consequent_1 = ($$anchor) => { 8646 var fragment_1 = root_3(); 8647 var div_2 = first_child(fragment_1); 8648 8649 bind_this(div_2, ($$value) => pre_element = $$value, () => pre_element); 8650 8651 var node_2 = sibling(div_2, 2); 8652 8653 snippet(node_2, () => $$props.children ?? noop); 8654 8655 var div_3 = sibling(node_2, 2); 8656 8657 bind_this(div_3, ($$value) => post_element = $$value, () => post_element); 8658 8659 template_effect(() => { 8660 set_class(div_2, 1, clsx(apply_default_css() ? "prose gradio-style" : "")); 8661 set_class(div_3, 1, clsx(apply_default_css() ? "prose gradio-style" : "")); 8662 }); 8663 8664 append($$anchor, fragment_1); 8665 }; 8666 8667 if_block(node_1, ($$render) => { 8668 if (get(has_children)) $$render(consequent_1); 8669 }); 8670 } 8671 8672 reset(div_1); 8673 bind_this(div_1, ($$value) => element = $$value, () => element); 8674 8675 template_effect( 8676 ($0) => {
8677 set_attribute(div_1, 'id', random_id); 8678 classes = set_class(div_1, 1, `${apply_default_css() && !get(has_children) ? 'prose gradio-style' : ''} ${$0 ?? ''}`, 'svelte-26mp0t', classes, { hide: !visible(), has_children: get(has_children) }); 8679 }, 8680 [() => elem_classes().join(' ')] 8681 ); 8682 8683 append($$anchor, div_1); 8684 }; 8685 8686 if_block(node, ($$render) => { 8687 if (get(html_error_message) || get(css_error_message)) $$render(consequent); else $$render(alternate, false); 8688 }); 8689 } 8690 8691 append($$anchor, fragment); 8692 pop(); 8693} 8694 8695export { HTML as default }; 8696//# sourceMappingURL=HTML-DlbkPABy.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.