6 Copyright (C) 2011-2016 by Yehuda Katz
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
32 Copyright (C) 2011-2016 by Yehuda Katz
34 Permission is hereby granted, free of charge, to any person obtaining a copy
35 of this software and associated documentation files (the "Software"), to deal
36 in the Software without restriction, including without limitation the rights
37 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
38 copies of the Software, and to permit persons to whom the Software is
39 furnished to do so, subject to the following conditions:
41 The above copyright notice and this permission notice shall be included in
42 all copies or substantial portions of the Software.
44 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
58 Copyright (C) 2011-2016 by Yehuda Katz
60 Permission is hereby granted, free of charge, to any person obtaining a copy
61 of this software and associated documentation files (the "Software"), to deal
62 in the Software without restriction, including without limitation the rights
63 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
64 copies of the Software, and to permit persons to whom the Software is
65 furnished to do so, subject to the following conditions:
67 The above copyright notice and this permission notice shall be included in
68 all copies or substantial portions of the Software.
70 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
71 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
72 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
73 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
74 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
75 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
79 (function webpackUniversalModuleDefinition(root, factory) {
80 if(typeof exports === 'object' && typeof module === 'object')
81 module.exports = factory();
82 else if(typeof define === 'function' && define.amd)
84 else if(typeof exports === 'object')
85 exports["Handlebars"] = factory();
87 root["Handlebars"] = factory();
89 return /******/ (function(modules) { // webpackBootstrap
90 /******/ // The module cache
91 /******/ var installedModules = {};
93 /******/ // The require function
94 /******/ function __webpack_require__(moduleId) {
96 /******/ // Check if module is in cache
97 /******/ if(installedModules[moduleId])
98 /******/ return installedModules[moduleId].exports;
100 /******/ // Create a new module (and put it into the cache)
101 /******/ var module = installedModules[moduleId] = {
102 /******/ exports: {},
103 /******/ id: moduleId,
104 /******/ loaded: false
107 /******/ // Execute the module function
108 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
110 /******/ // Flag the module as loaded
111 /******/ module.loaded = true;
113 /******/ // Return the exports of the module
114 /******/ return module.exports;
118 /******/ // expose the modules object (__webpack_modules__)
119 /******/ __webpack_require__.m = modules;
121 /******/ // expose the module cache
122 /******/ __webpack_require__.c = installedModules;
124 /******/ // __webpack_public_path__
125 /******/ __webpack_require__.p = "";
127 /******/ // Load entry module and return exports
128 /******/ return __webpack_require__(0);
130 /************************************************************************/
133 /***/ function(module, exports, __webpack_require__) {
137 var _interopRequireWildcard = __webpack_require__(1)['default'];
139 var _interopRequireDefault = __webpack_require__(2)['default'];
141 exports.__esModule = true;
143 var _handlebarsBase = __webpack_require__(3);
145 var base = _interopRequireWildcard(_handlebarsBase);
147 // Each of these augment the Handlebars object. No need to setup here.
148 // (This is done to easily share code between commonjs and browse envs)
150 var _handlebarsSafeString = __webpack_require__(20);
152 var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString);
154 var _handlebarsException = __webpack_require__(5);
156 var _handlebarsException2 = _interopRequireDefault(_handlebarsException);
158 var _handlebarsUtils = __webpack_require__(4);
160 var Utils = _interopRequireWildcard(_handlebarsUtils);
162 var _handlebarsRuntime = __webpack_require__(21);
164 var runtime = _interopRequireWildcard(_handlebarsRuntime);
166 var _handlebarsNoConflict = __webpack_require__(22);
168 var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
170 // For compatibility and usage outside of module systems, make the Handlebars object a namespace
172 var hb = new base.HandlebarsEnvironment();
174 Utils.extend(hb, base);
175 hb.SafeString = _handlebarsSafeString2['default'];
176 hb.Exception = _handlebarsException2['default'];
178 hb.escapeExpression = Utils.escapeExpression;
181 hb.template = function (spec) {
182 return runtime.template(spec, hb);
189 inst.create = create;
191 _handlebarsNoConflict2['default'](inst);
193 inst['default'] = inst;
195 exports['default'] = inst;
196 module.exports = exports['default'];
200 /***/ function(module, exports) {
204 exports["default"] = function (obj) {
205 if (obj && obj.__esModule) {
211 for (var key in obj) {
212 if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
216 newObj["default"] = obj;
221 exports.__esModule = true;
225 /***/ function(module, exports) {
229 exports["default"] = function (obj) {
230 return obj && obj.__esModule ? obj : {
235 exports.__esModule = true;
239 /***/ function(module, exports, __webpack_require__) {
243 var _interopRequireDefault = __webpack_require__(2)['default'];
245 exports.__esModule = true;
246 exports.HandlebarsEnvironment = HandlebarsEnvironment;
248 var _utils = __webpack_require__(4);
250 var _exception = __webpack_require__(5);
252 var _exception2 = _interopRequireDefault(_exception);
254 var _helpers = __webpack_require__(9);
256 var _decorators = __webpack_require__(17);
258 var _logger = __webpack_require__(19);
260 var _logger2 = _interopRequireDefault(_logger);
262 var VERSION = '4.0.5';
263 exports.VERSION = VERSION;
264 var COMPILER_REVISION = 7;
266 exports.COMPILER_REVISION = COMPILER_REVISION;
267 var REVISION_CHANGES = {
268 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
272 5: '== 2.0.0-alpha.x',
273 6: '>= 2.0.0-beta.1',
277 exports.REVISION_CHANGES = REVISION_CHANGES;
278 var objectType = '[object Object]';
280 function HandlebarsEnvironment(helpers, partials, decorators) {
281 this.helpers = helpers || {};
282 this.partials = partials || {};
283 this.decorators = decorators || {};
285 _helpers.registerDefaultHelpers(this);
286 _decorators.registerDefaultDecorators(this);
289 HandlebarsEnvironment.prototype = {
290 constructor: HandlebarsEnvironment,
292 logger: _logger2['default'],
293 log: _logger2['default'].log,
295 registerHelper: function registerHelper(name, fn) {
296 if (_utils.toString.call(name) === objectType) {
298 throw new _exception2['default']('Arg not supported with multiple helpers');
300 _utils.extend(this.helpers, name);
302 this.helpers[name] = fn;
305 unregisterHelper: function unregisterHelper(name) {
306 delete this.helpers[name];
309 registerPartial: function registerPartial(name, partial) {
310 if (_utils.toString.call(name) === objectType) {
311 _utils.extend(this.partials, name);
313 if (typeof partial === 'undefined') {
314 throw new _exception2['default']('Attempting to register a partial called "' + name + '" as undefined');
316 this.partials[name] = partial;
319 unregisterPartial: function unregisterPartial(name) {
320 delete this.partials[name];
323 registerDecorator: function registerDecorator(name, fn) {
324 if (_utils.toString.call(name) === objectType) {
326 throw new _exception2['default']('Arg not supported with multiple decorators');
328 _utils.extend(this.decorators, name);
330 this.decorators[name] = fn;
333 unregisterDecorator: function unregisterDecorator(name) {
334 delete this.decorators[name];
338 var log = _logger2['default'].log;
341 exports.createFrame = _utils.createFrame;
342 exports.logger = _logger2['default'];
346 /***/ function(module, exports) {
350 exports.__esModule = true;
351 exports.extend = extend;
352 exports.indexOf = indexOf;
353 exports.escapeExpression = escapeExpression;
354 exports.isEmpty = isEmpty;
355 exports.createFrame = createFrame;
356 exports.blockParams = blockParams;
357 exports.appendContextPath = appendContextPath;
368 var badChars = /[&<>"'`=]/g,
369 possible = /[&<>"'`=]/;
371 function escapeChar(chr) {
375 function extend(obj /* , ...source */) {
376 for (var i = 1; i < arguments.length; i++) {
377 for (var key in arguments[i]) {
378 if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
379 obj[key] = arguments[i][key];
387 var toString = Object.prototype.toString;
389 exports.toString = toString;
390 // Sourced from lodash
391 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
392 /* eslint-disable func-style */
393 var isFunction = function isFunction(value) {
394 return typeof value === 'function';
396 // fallback for older versions of Chrome and Safari
397 /* istanbul ignore next */
398 if (isFunction(/x/)) {
399 exports.isFunction = isFunction = function (value) {
400 return typeof value === 'function' && toString.call(value) === '[object Function]';
403 exports.isFunction = isFunction;
405 /* eslint-enable func-style */
407 /* istanbul ignore next */
408 var isArray = Array.isArray || function (value) {
409 return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
412 exports.isArray = isArray;
413 // Older IE versions do not directly support indexOf so we must implement our own, sadly.
415 function indexOf(array, value) {
416 for (var i = 0, len = array.length; i < len; i++) {
417 if (array[i] === value) {
424 function escapeExpression(string) {
425 if (typeof string !== 'string') {
426 // don't escape SafeStrings, since they're already safe
427 if (string && string.toHTML) {
428 return string.toHTML();
429 } else if (string == null) {
431 } else if (!string) {
435 // Force a string conversion as this will be done by the append regardless and
436 // the regex test will do this transparently behind the scenes, causing issues if
437 // an object's to string has escaped characters in it.
438 string = '' + string;
441 if (!possible.test(string)) {
444 return string.replace(badChars, escapeChar);
447 function isEmpty(value) {
448 if (!value && value !== 0) {
450 } else if (isArray(value) && value.length === 0) {
457 function createFrame(object) {
458 var frame = extend({}, object);
459 frame._parent = object;
463 function blockParams(params, ids) {
468 function appendContextPath(contextPath, id) {
469 return (contextPath ? contextPath + '.' : '') + id;
474 /***/ function(module, exports, __webpack_require__) {
478 var _Object$defineProperty = __webpack_require__(6)['default'];
480 exports.__esModule = true;
482 var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
484 function Exception(message, node) {
485 var loc = node && node.loc,
489 line = loc.start.line;
490 column = loc.start.column;
492 message += ' - ' + line + ':' + column;
495 var tmp = Error.prototype.constructor.call(this, message);
497 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
498 for (var idx = 0; idx < errorProps.length; idx++) {
499 this[errorProps[idx]] = tmp[errorProps[idx]];
502 /* istanbul ignore else */
503 if (Error.captureStackTrace) {
504 Error.captureStackTrace(this, Exception);
509 this.lineNumber = line;
511 // Work around issue under safari where we can't directly set the column value
512 /* istanbul ignore next */
513 if (_Object$defineProperty) {
514 Object.defineProperty(this, 'column', { value: column });
516 this.column = column;
520 /* Ignore if the browser is very particular */
524 Exception.prototype = new Error();
526 exports['default'] = Exception;
527 module.exports = exports['default'];
531 /***/ function(module, exports, __webpack_require__) {
533 module.exports = { "default": __webpack_require__(7), __esModule: true };
537 /***/ function(module, exports, __webpack_require__) {
539 var $ = __webpack_require__(8);
540 module.exports = function defineProperty(it, key, desc){
541 return $.setDesc(it, key, desc);
546 /***/ function(module, exports) {
548 var $Object = Object;
550 create: $Object.create,
551 getProto: $Object.getPrototypeOf,
552 isEnum: {}.propertyIsEnumerable,
553 getDesc: $Object.getOwnPropertyDescriptor,
554 setDesc: $Object.defineProperty,
555 setDescs: $Object.defineProperties,
556 getKeys: $Object.keys,
557 getNames: $Object.getOwnPropertyNames,
558 getSymbols: $Object.getOwnPropertySymbols,
564 /***/ function(module, exports, __webpack_require__) {
568 var _interopRequireDefault = __webpack_require__(2)['default'];
570 exports.__esModule = true;
571 exports.registerDefaultHelpers = registerDefaultHelpers;
573 var _helpersBlockHelperMissing = __webpack_require__(10);
575 var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing);
577 var _helpersEach = __webpack_require__(11);
579 var _helpersEach2 = _interopRequireDefault(_helpersEach);
581 var _helpersHelperMissing = __webpack_require__(12);
583 var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing);
585 var _helpersIf = __webpack_require__(13);
587 var _helpersIf2 = _interopRequireDefault(_helpersIf);
589 var _helpersLog = __webpack_require__(14);
591 var _helpersLog2 = _interopRequireDefault(_helpersLog);
593 var _helpersLookup = __webpack_require__(15);
595 var _helpersLookup2 = _interopRequireDefault(_helpersLookup);
597 var _helpersWith = __webpack_require__(16);
599 var _helpersWith2 = _interopRequireDefault(_helpersWith);
601 function registerDefaultHelpers(instance) {
602 _helpersBlockHelperMissing2['default'](instance);
603 _helpersEach2['default'](instance);
604 _helpersHelperMissing2['default'](instance);
605 _helpersIf2['default'](instance);
606 _helpersLog2['default'](instance);
607 _helpersLookup2['default'](instance);
608 _helpersWith2['default'](instance);
613 /***/ function(module, exports, __webpack_require__) {
617 exports.__esModule = true;
619 var _utils = __webpack_require__(4);
621 exports['default'] = function (instance) {
622 instance.registerHelper('blockHelperMissing', function (context, options) {
623 var inverse = options.inverse,
626 if (context === true) {
628 } else if (context === false || context == null) {
629 return inverse(this);
630 } else if (_utils.isArray(context)) {
631 if (context.length > 0) {
633 options.ids = [options.name];
636 return instance.helpers.each(context, options);
638 return inverse(this);
641 if (options.data && options.ids) {
642 var data = _utils.createFrame(options.data);
643 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name);
644 options = { data: data };
647 return fn(context, options);
652 module.exports = exports['default'];
656 /***/ function(module, exports, __webpack_require__) {
660 var _interopRequireDefault = __webpack_require__(2)['default'];
662 exports.__esModule = true;
664 var _utils = __webpack_require__(4);
666 var _exception = __webpack_require__(5);
668 var _exception2 = _interopRequireDefault(_exception);
670 exports['default'] = function (instance) {
671 instance.registerHelper('each', function (context, options) {
673 throw new _exception2['default']('Must pass iterator to #each');
677 inverse = options.inverse,
681 contextPath = undefined;
683 if (options.data && options.ids) {
684 contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
687 if (_utils.isFunction(context)) {
688 context = context.call(this);
692 data = _utils.createFrame(options.data);
695 function execIteration(field, index, last) {
699 data.first = index === 0;
703 data.contextPath = contextPath + field;
707 ret = ret + fn(context[field], {
709 blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
713 if (context && typeof context === 'object') {
714 if (_utils.isArray(context)) {
715 for (var j = context.length; i < j; i++) {
717 execIteration(i, i, i === context.length - 1);
721 var priorKey = undefined;
723 for (var key in context) {
724 if (context.hasOwnProperty(key)) {
725 // We're running the iterations one step out of sync so we can detect
726 // the last iteration without have to scan the object twice and create
727 // an itermediate keys array.
728 if (priorKey !== undefined) {
729 execIteration(priorKey, i - 1);
735 if (priorKey !== undefined) {
736 execIteration(priorKey, i - 1, true);
749 module.exports = exports['default'];
753 /***/ function(module, exports, __webpack_require__) {
757 var _interopRequireDefault = __webpack_require__(2)['default'];
759 exports.__esModule = true;
761 var _exception = __webpack_require__(5);
763 var _exception2 = _interopRequireDefault(_exception);
765 exports['default'] = function (instance) {
766 instance.registerHelper('helperMissing', function () /* [args, ]options */{
767 if (arguments.length === 1) {
768 // A missing field in a {{foo}} construct.
771 // Someone is actually trying to call something, blow up.
772 throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
777 module.exports = exports['default'];
781 /***/ function(module, exports, __webpack_require__) {
785 exports.__esModule = true;
787 var _utils = __webpack_require__(4);
789 exports['default'] = function (instance) {
790 instance.registerHelper('if', function (conditional, options) {
791 if (_utils.isFunction(conditional)) {
792 conditional = conditional.call(this);
795 // Default behavior is to render the positive path if the value is truthy and not empty.
796 // The `includeZero` option may be set to treat the condtional as purely not empty based on the
797 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
798 if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
799 return options.inverse(this);
801 return options.fn(this);
805 instance.registerHelper('unless', function (conditional, options) {
806 return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
810 module.exports = exports['default'];
814 /***/ function(module, exports) {
818 exports.__esModule = true;
820 exports['default'] = function (instance) {
821 instance.registerHelper('log', function () /* message, options */{
822 var args = [undefined],
823 options = arguments[arguments.length - 1];
824 for (var i = 0; i < arguments.length - 1; i++) {
825 args.push(arguments[i]);
829 if (options.hash.level != null) {
830 level = options.hash.level;
831 } else if (options.data && options.data.level != null) {
832 level = options.data.level;
836 instance.log.apply(instance, args);
840 module.exports = exports['default'];
844 /***/ function(module, exports) {
848 exports.__esModule = true;
850 exports['default'] = function (instance) {
851 instance.registerHelper('lookup', function (obj, field) {
852 return obj && obj[field];
856 module.exports = exports['default'];
860 /***/ function(module, exports, __webpack_require__) {
864 exports.__esModule = true;
866 var _utils = __webpack_require__(4);
868 exports['default'] = function (instance) {
869 instance.registerHelper('with', function (context, options) {
870 if (_utils.isFunction(context)) {
871 context = context.call(this);
876 if (!_utils.isEmpty(context)) {
877 var data = options.data;
878 if (options.data && options.ids) {
879 data = _utils.createFrame(options.data);
880 data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
885 blockParams: _utils.blockParams([context], [data && data.contextPath])
888 return options.inverse(this);
893 module.exports = exports['default'];
897 /***/ function(module, exports, __webpack_require__) {
901 var _interopRequireDefault = __webpack_require__(2)['default'];
903 exports.__esModule = true;
904 exports.registerDefaultDecorators = registerDefaultDecorators;
906 var _decoratorsInline = __webpack_require__(18);
908 var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline);
910 function registerDefaultDecorators(instance) {
911 _decoratorsInline2['default'](instance);
916 /***/ function(module, exports, __webpack_require__) {
920 exports.__esModule = true;
922 var _utils = __webpack_require__(4);
924 exports['default'] = function (instance) {
925 instance.registerDecorator('inline', function (fn, props, container, options) {
927 if (!props.partials) {
929 ret = function (context, options) {
930 // Create a new partials stack frame prior to exec.
931 var original = container.partials;
932 container.partials = _utils.extend({}, original, props.partials);
933 var ret = fn(context, options);
934 container.partials = original;
939 props.partials[options.args[0]] = options.fn;
945 module.exports = exports['default'];
949 /***/ function(module, exports, __webpack_require__) {
953 exports.__esModule = true;
955 var _utils = __webpack_require__(4);
958 methodMap: ['debug', 'info', 'warn', 'error'],
961 // Maps a given level value to the `methodMap` indexes above.
962 lookupLevel: function lookupLevel(level) {
963 if (typeof level === 'string') {
964 var levelMap = _utils.indexOf(logger.methodMap, level.toLowerCase());
968 level = parseInt(level, 10);
975 // Can be overridden in the host environment
976 log: function log(level) {
977 level = logger.lookupLevel(level);
979 if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
980 var method = logger.methodMap[level];
981 if (!console[method]) {
982 // eslint-disable-line no-console
986 for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
987 message[_key - 1] = arguments[_key];
990 console[method].apply(console, message); // eslint-disable-line no-console
995 exports['default'] = logger;
996 module.exports = exports['default'];
1000 /***/ function(module, exports) {
1002 // Build out our basic SafeString type
1005 exports.__esModule = true;
1006 function SafeString(string) {
1007 this.string = string;
1010 SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
1011 return '' + this.string;
1014 exports['default'] = SafeString;
1015 module.exports = exports['default'];
1019 /***/ function(module, exports, __webpack_require__) {
1023 var _interopRequireWildcard = __webpack_require__(1)['default'];
1025 var _interopRequireDefault = __webpack_require__(2)['default'];
1027 exports.__esModule = true;
1028 exports.checkRevision = checkRevision;
1029 exports.template = template;
1030 exports.wrapProgram = wrapProgram;
1031 exports.resolvePartial = resolvePartial;
1032 exports.invokePartial = invokePartial;
1033 exports.noop = noop;
1035 var _utils = __webpack_require__(4);
1037 var Utils = _interopRequireWildcard(_utils);
1039 var _exception = __webpack_require__(5);
1041 var _exception2 = _interopRequireDefault(_exception);
1043 var _base = __webpack_require__(3);
1045 function checkRevision(compilerInfo) {
1046 var compilerRevision = compilerInfo && compilerInfo[0] || 1,
1047 currentRevision = _base.COMPILER_REVISION;
1049 if (compilerRevision !== currentRevision) {
1050 if (compilerRevision < currentRevision) {
1051 var runtimeVersions = _base.REVISION_CHANGES[currentRevision],
1052 compilerVersions = _base.REVISION_CHANGES[compilerRevision];
1053 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 + ').');
1055 // Use the embedded version info since the runtime doesn't know about this revision yet
1056 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] + ').');
1061 function template(templateSpec, env) {
1062 /* istanbul ignore next */
1064 throw new _exception2['default']('No environment passed to template');
1066 if (!templateSpec || !templateSpec.main) {
1067 throw new _exception2['default']('Unknown template object: ' + typeof templateSpec);
1070 templateSpec.main.decorator = templateSpec.main_d;
1072 // Note: Using env.VM references rather than local var references throughout this section to allow
1073 // for external users to override these as psuedo-supported APIs.
1074 env.VM.checkRevision(templateSpec.compiler);
1076 function invokePartialWrapper(partial, context, options) {
1078 context = Utils.extend({}, context, options.hash);
1080 options.ids[0] = true;
1084 partial = env.VM.resolvePartial.call(this, partial, context, options);
1085 var result = env.VM.invokePartial.call(this, partial, context, options);
1087 if (result == null && env.compile) {
1088 options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
1089 result = options.partials[options.name](context, options);
1091 if (result != null) {
1092 if (options.indent) {
1093 var lines = result.split('\n');
1094 for (var i = 0, l = lines.length; i < l; i++) {
1095 if (!lines[i] && i + 1 === l) {
1099 lines[i] = options.indent + lines[i];
1101 result = lines.join('\n');
1105 throw new _exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
1111 strict: function strict(obj, name) {
1112 if (!(name in obj)) {
1113 throw new _exception2['default']('"' + name + '" not defined in ' + obj);
1117 lookup: function lookup(depths, name) {
1118 var len = depths.length;
1119 for (var i = 0; i < len; i++) {
1120 if (depths[i] && depths[i][name] != null) {
1121 return depths[i][name];
1125 lambda: function lambda(current, context) {
1126 return typeof current === 'function' ? current.call(context) : current;
1129 escapeExpression: Utils.escapeExpression,
1130 invokePartial: invokePartialWrapper,
1132 fn: function fn(i) {
1133 var ret = templateSpec[i];
1134 ret.decorator = templateSpec[i + '_d'];
1139 program: function program(i, data, declaredBlockParams, blockParams, depths) {
1140 var programWrapper = this.programs[i],
1142 if (data || depths || blockParams || declaredBlockParams) {
1143 programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
1144 } else if (!programWrapper) {
1145 programWrapper = this.programs[i] = wrapProgram(this, i, fn);
1147 return programWrapper;
1150 data: function data(value, depth) {
1151 while (value && depth--) {
1152 value = value._parent;
1156 merge: function merge(param, common) {
1157 var obj = param || common;
1159 if (param && common && param !== common) {
1160 obj = Utils.extend({}, common, param);
1167 compilerInfo: templateSpec.compiler
1170 function ret(context) {
1171 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1173 var data = options.data;
1175 ret._setup(options);
1176 if (!options.partial && templateSpec.useData) {
1177 data = initData(context, data);
1179 var depths = undefined,
1180 blockParams = templateSpec.useBlockParams ? [] : undefined;
1181 if (templateSpec.useDepths) {
1182 if (options.depths) {
1183 depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths;
1189 function main(context /*, options*/) {
1190 return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths);
1192 main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams);
1193 return main(context, options);
1197 ret._setup = function (options) {
1198 if (!options.partial) {
1199 container.helpers = container.merge(options.helpers, env.helpers);
1201 if (templateSpec.usePartial) {
1202 container.partials = container.merge(options.partials, env.partials);
1204 if (templateSpec.usePartial || templateSpec.useDecorators) {
1205 container.decorators = container.merge(options.decorators, env.decorators);
1208 container.helpers = options.helpers;
1209 container.partials = options.partials;
1210 container.decorators = options.decorators;
1214 ret._child = function (i, data, blockParams, depths) {
1215 if (templateSpec.useBlockParams && !blockParams) {
1216 throw new _exception2['default']('must pass block params');
1218 if (templateSpec.useDepths && !depths) {
1219 throw new _exception2['default']('must pass parent depths');
1222 return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
1227 function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
1228 function prog(context) {
1229 var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1231 var currentDepths = depths;
1232 if (depths && context != depths[0]) {
1233 currentDepths = [context].concat(depths);
1236 return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths);
1239 prog = executeDecorators(fn, prog, container, depths, data, blockParams);
1242 prog.depth = depths ? depths.length : 0;
1243 prog.blockParams = declaredBlockParams || 0;
1247 function resolvePartial(partial, context, options) {
1249 if (options.name === '@partial-block') {
1250 var data = options.data;
1251 while (data['partial-block'] === noop) {
1252 data = data._parent;
1254 partial = data['partial-block'];
1255 data['partial-block'] = noop;
1257 partial = options.partials[options.name];
1259 } else if (!partial.call && !options.name) {
1260 // This is a dynamic partial that returned a string
1261 options.name = partial;
1262 partial = options.partials[partial];
1267 function invokePartial(partial, context, options) {
1268 options.partial = true;
1270 options.data.contextPath = options.ids[0] || options.data.contextPath;
1273 var partialBlock = undefined;
1274 if (options.fn && options.fn !== noop) {
1275 options.data = _base.createFrame(options.data);
1276 partialBlock = options.data['partial-block'] = options.fn;
1278 if (partialBlock.partials) {
1279 options.partials = Utils.extend({}, options.partials, partialBlock.partials);
1283 if (partial === undefined && partialBlock) {
1284 partial = partialBlock;
1287 if (partial === undefined) {
1288 throw new _exception2['default']('The partial ' + options.name + ' could not be found');
1289 } else if (partial instanceof Function) {
1290 return partial(context, options);
1298 function initData(context, data) {
1299 if (!data || !('root' in data)) {
1300 data = data ? _base.createFrame(data) : {};
1301 data.root = context;
1306 function executeDecorators(fn, prog, container, depths, data, blockParams) {
1309 prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths);
1310 Utils.extend(prog, props);
1317 /***/ function(module, exports) {
1319 /* WEBPACK VAR INJECTION */(function(global) {/* global window */
1322 exports.__esModule = true;
1324 exports['default'] = function (Handlebars) {
1325 /* istanbul ignore next */
1326 var root = typeof global !== 'undefined' ? global : window,
1327 $Handlebars = root.Handlebars;
1328 /* istanbul ignore next */
1329 Handlebars.noConflict = function () {
1330 if (root.Handlebars === Handlebars) {
1331 root.Handlebars = $Handlebars;
1337 module.exports = exports['default'];
1338 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))