handlebars-source 3.0.8 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handlebars-source might be problematic. Click here for more details.

Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/handlebars.js +3642 -3227
  3. data/handlebars.runtime.js +675 -404
  4. metadata +6 -5
@@ -1,8 +1,8 @@
1
1
  /*!
2
2
 
3
- handlebars v3.0.8
3
+ handlebars v4.0.0
4
4
 
5
- Copyright (C) 2011-2014 by Yehuda Katz
5
+ Copyright (C) 2011-2015 by Yehuda Katz
6
6
 
7
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  of this software and associated documentation files (the "Software"), to deal
@@ -28,7 +28,7 @@ THE SOFTWARE.
28
28
  if(typeof exports === 'object' && typeof module === 'object')
29
29
  module.exports = factory();
30
30
  else if(typeof define === 'function' && define.amd)
31
- define([], factory);
31
+ define(factory);
32
32
  else if(typeof exports === 'object')
33
33
  exports["Handlebars"] = factory();
34
34
  else
@@ -78,28 +78,28 @@ return /******/ (function(modules) { // webpackBootstrap
78
78
  /************************************************************************/
79
79
  /******/ ([
80
80
  /* 0 */
81
- /***/ (function(module, exports, __webpack_require__) {
81
+ /***/ function(module, exports, __webpack_require__) {
82
82
 
83
83
  'use strict';
84
84
 
85
- var _interopRequireWildcard = __webpack_require__(1)['default'];
85
+ var _interopRequireWildcard = __webpack_require__(7)['default'];
86
86
 
87
- var _interopRequireDefault = __webpack_require__(2)['default'];
87
+ var _interopRequireDefault = __webpack_require__(8)['default'];
88
88
 
89
89
  exports.__esModule = true;
90
90
 
91
- var _handlebarsBase = __webpack_require__(3);
92
-
93
- var base = _interopRequireWildcard(_handlebarsBase);
91
+ var _handlebarsBase = __webpack_require__(1);
94
92
 
95
93
  // Each of these augment the Handlebars object. No need to setup here.
96
94
  // (This is done to easily share code between commonjs and browse envs)
97
95
 
98
- var _handlebarsSafeString = __webpack_require__(9);
96
+ var base = _interopRequireWildcard(_handlebarsBase);
97
+
98
+ var _handlebarsSafeString = __webpack_require__(2);
99
99
 
100
100
  var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString);
101
101
 
102
- var _handlebarsException = __webpack_require__(5);
102
+ var _handlebarsException = __webpack_require__(3);
103
103
 
104
104
  var _handlebarsException2 = _interopRequireDefault(_handlebarsException);
105
105
 
@@ -107,15 +107,16 @@ return /******/ (function(modules) { // webpackBootstrap
107
107
 
108
108
  var Utils = _interopRequireWildcard(_handlebarsUtils);
109
109
 
110
- var _handlebarsRuntime = __webpack_require__(10);
110
+ var _handlebarsRuntime = __webpack_require__(5);
111
111
 
112
112
  var runtime = _interopRequireWildcard(_handlebarsRuntime);
113
113
 
114
- var _handlebarsNoConflict = __webpack_require__(11);
114
+ var _handlebarsNoConflict = __webpack_require__(6);
115
+
116
+ // For compatibility and usage outside of module systems, make the Handlebars object a namespace
115
117
 
116
118
  var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict);
117
119
 
118
- // For compatibility and usage outside of module systems, make the Handlebars object a namespace
119
120
  function create() {
120
121
  var hb = new base.HandlebarsEnvironment();
121
122
 
@@ -143,70 +144,34 @@ return /******/ (function(modules) { // webpackBootstrap
143
144
  exports['default'] = inst;
144
145
  module.exports = exports['default'];
145
146
 
146
- /***/ }),
147
+ /***/ },
147
148
  /* 1 */
148
- /***/ (function(module, exports) {
149
-
150
- "use strict";
151
-
152
- exports["default"] = function (obj) {
153
- if (obj && obj.__esModule) {
154
- return obj;
155
- } else {
156
- var newObj = {};
157
-
158
- if (obj != null) {
159
- for (var key in obj) {
160
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
161
- }
162
- }
163
-
164
- newObj["default"] = obj;
165
- return newObj;
166
- }
167
- };
168
-
169
- exports.__esModule = true;
170
-
171
- /***/ }),
172
- /* 2 */
173
- /***/ (function(module, exports) {
174
-
175
- "use strict";
176
-
177
- exports["default"] = function (obj) {
178
- return obj && obj.__esModule ? obj : {
179
- "default": obj
180
- };
181
- };
182
-
183
- exports.__esModule = true;
184
-
185
- /***/ }),
186
- /* 3 */
187
- /***/ (function(module, exports, __webpack_require__) {
149
+ /***/ function(module, exports, __webpack_require__) {
188
150
 
189
151
  'use strict';
190
152
 
191
- var _interopRequireWildcard = __webpack_require__(1)['default'];
192
-
193
- var _interopRequireDefault = __webpack_require__(2)['default'];
153
+ var _interopRequireDefault = __webpack_require__(8)['default'];
194
154
 
195
155
  exports.__esModule = true;
196
156
  exports.HandlebarsEnvironment = HandlebarsEnvironment;
197
- exports.createFrame = createFrame;
198
157
 
199
158
  var _utils = __webpack_require__(4);
200
159
 
201
- var Utils = _interopRequireWildcard(_utils);
202
-
203
- var _exception = __webpack_require__(5);
160
+ var _exception = __webpack_require__(3);
204
161
 
205
162
  var _exception2 = _interopRequireDefault(_exception);
206
163
 
207
- var VERSION = '3.0.1';
164
+ var _helpers = __webpack_require__(9);
165
+
166
+ var _decorators = __webpack_require__(10);
167
+
168
+ var _logger = __webpack_require__(11);
169
+
170
+ var _logger2 = _interopRequireDefault(_logger);
171
+
172
+ var VERSION = '4.0.0';
208
173
  exports.VERSION = VERSION;
209
- var COMPILER_REVISION = 6;
174
+ var COMPILER_REVISION = 7;
210
175
 
211
176
  exports.COMPILER_REVISION = COMPILER_REVISION;
212
177
  var REVISION_CHANGES = {
@@ -215,34 +180,34 @@ return /******/ (function(modules) { // webpackBootstrap
215
180
  3: '== 1.0.0-rc.4',
216
181
  4: '== 1.x.x',
217
182
  5: '== 2.0.0-alpha.x',
218
- 6: '>= 2.0.0-beta.1'
183
+ 6: '>= 2.0.0-beta.1',
184
+ 7: '>= 4.0.0'
219
185
  };
220
186
 
221
187
  exports.REVISION_CHANGES = REVISION_CHANGES;
222
- var isArray = Utils.isArray,
223
- isFunction = Utils.isFunction,
224
- toString = Utils.toString,
225
- objectType = '[object Object]';
188
+ var objectType = '[object Object]';
226
189
 
227
- function HandlebarsEnvironment(helpers, partials) {
190
+ function HandlebarsEnvironment(helpers, partials, decorators) {
228
191
  this.helpers = helpers || {};
229
192
  this.partials = partials || {};
193
+ this.decorators = decorators || {};
230
194
 
231
- registerDefaultHelpers(this);
195
+ _helpers.registerDefaultHelpers(this);
196
+ _decorators.registerDefaultDecorators(this);
232
197
  }
233
198
 
234
199
  HandlebarsEnvironment.prototype = {
235
200
  constructor: HandlebarsEnvironment,
236
201
 
237
- logger: logger,
238
- log: log,
202
+ logger: _logger2['default'],
203
+ log: _logger2['default'].log,
239
204
 
240
205
  registerHelper: function registerHelper(name, fn) {
241
- if (toString.call(name) === objectType) {
206
+ if (_utils.toString.call(name) === objectType) {
242
207
  if (fn) {
243
208
  throw new _exception2['default']('Arg not supported with multiple helpers');
244
209
  }
245
- Utils.extend(this.helpers, name);
210
+ _utils.extend(this.helpers, name);
246
211
  } else {
247
212
  this.helpers[name] = fn;
248
213
  }
@@ -252,8 +217,8 @@ return /******/ (function(modules) { // webpackBootstrap
252
217
  },
253
218
 
254
219
  registerPartial: function registerPartial(name, partial) {
255
- if (toString.call(name) === objectType) {
256
- Utils.extend(this.partials, name);
220
+ if (_utils.toString.call(name) === objectType) {
221
+ _utils.extend(this.partials, name);
257
222
  } else {
258
223
  if (typeof partial === 'undefined') {
259
224
  throw new _exception2['default']('Attempting to register a partial as undefined');
@@ -263,212 +228,95 @@ return /******/ (function(modules) { // webpackBootstrap
263
228
  },
264
229
  unregisterPartial: function unregisterPartial(name) {
265
230
  delete this.partials[name];
266
- }
267
- };
268
-
269
- function registerDefaultHelpers(instance) {
270
- instance.registerHelper('helperMissing', function () /* [args, ]options */{
271
- if (arguments.length === 1) {
272
- // A missing field in a {{foo}} constuct.
273
- return undefined;
274
- } else {
275
- // Someone is actually trying to call something, blow up.
276
- throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
277
- }
278
- });
279
-
280
- instance.registerHelper('blockHelperMissing', function (context, options) {
281
- var inverse = options.inverse,
282
- fn = options.fn;
283
-
284
- if (context === true) {
285
- return fn(this);
286
- } else if (context === false || context == null) {
287
- return inverse(this);
288
- } else if (isArray(context)) {
289
- if (context.length > 0) {
290
- if (options.ids) {
291
- options.ids = [options.name];
292
- }
231
+ },
293
232
 
294
- return instance.helpers.each(context, options);
295
- } else {
296
- return inverse(this);
233
+ registerDecorator: function registerDecorator(name, fn) {
234
+ if (_utils.toString.call(name) === objectType) {
235
+ if (fn) {
236
+ throw new _exception2['default']('Arg not supported with multiple decorators');
297
237
  }
238
+ _utils.extend(this.decorators, name);
298
239
  } else {
299
- if (options.data && options.ids) {
300
- var data = createFrame(options.data);
301
- data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
302
- options = { data: data };
303
- }
304
-
305
- return fn(context, options);
306
- }
307
- });
308
-
309
- instance.registerHelper('each', function (context, options) {
310
- if (!options) {
311
- throw new _exception2['default']('Must pass iterator to #each');
312
- }
313
-
314
- var fn = options.fn,
315
- inverse = options.inverse,
316
- i = 0,
317
- ret = '',
318
- data = undefined,
319
- contextPath = undefined;
320
-
321
- if (options.data && options.ids) {
322
- contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
323
- }
324
-
325
- if (isFunction(context)) {
326
- context = context.call(this);
327
- }
328
-
329
- if (options.data) {
330
- data = createFrame(options.data);
331
- }
332
-
333
- function execIteration(field, index, last) {
334
- if (data) {
335
- data.key = field;
336
- data.index = index;
337
- data.first = index === 0;
338
- data.last = !!last;
339
-
340
- if (contextPath) {
341
- data.contextPath = contextPath + field;
342
- }
343
- }
344
-
345
- ret = ret + fn(context[field], {
346
- data: data,
347
- blockParams: Utils.blockParams([context[field], field], [contextPath + field, null])
348
- });
240
+ this.decorators[name] = fn;
349
241
  }
242
+ },
243
+ unregisterDecorator: function unregisterDecorator(name) {
244
+ delete this.decorators[name];
245
+ }
246
+ };
350
247
 
351
- if (context && typeof context === 'object') {
352
- if (isArray(context)) {
353
- for (var j = context.length; i < j; i++) {
354
- execIteration(i, i, i === context.length - 1);
355
- }
356
- } else {
357
- var priorKey = undefined;
248
+ var log = _logger2['default'].log;
358
249
 
359
- for (var key in context) {
360
- if (context.hasOwnProperty(key)) {
361
- // We're running the iterations one step out of sync so we can detect
362
- // the last iteration without have to scan the object twice and create
363
- // an itermediate keys array.
364
- if (priorKey) {
365
- execIteration(priorKey, i - 1);
366
- }
367
- priorKey = key;
368
- i++;
369
- }
370
- }
371
- if (priorKey) {
372
- execIteration(priorKey, i - 1, true);
373
- }
374
- }
375
- }
250
+ exports.log = log;
251
+ exports.createFrame = _utils.createFrame;
252
+ exports.logger = _logger2['default'];
376
253
 
377
- if (i === 0) {
378
- ret = inverse(this);
379
- }
254
+ /***/ },
255
+ /* 2 */
256
+ /***/ function(module, exports, __webpack_require__) {
380
257
 
381
- return ret;
382
- });
258
+ // Build out our basic SafeString type
259
+ 'use strict';
383
260
 
384
- instance.registerHelper('if', function (conditional, options) {
385
- if (isFunction(conditional)) {
386
- conditional = conditional.call(this);
387
- }
261
+ exports.__esModule = true;
262
+ function SafeString(string) {
263
+ this.string = string;
264
+ }
388
265
 
389
- // Default behavior is to render the positive path if the value is truthy and not empty.
390
- // The `includeZero` option may be set to treat the condtional as purely not empty based on the
391
- // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
392
- if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) {
393
- return options.inverse(this);
394
- } else {
395
- return options.fn(this);
396
- }
397
- });
266
+ SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
267
+ return '' + this.string;
268
+ };
398
269
 
399
- instance.registerHelper('unless', function (conditional, options) {
400
- return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
401
- });
270
+ exports['default'] = SafeString;
271
+ module.exports = exports['default'];
402
272
 
403
- instance.registerHelper('with', function (context, options) {
404
- if (isFunction(context)) {
405
- context = context.call(this);
406
- }
273
+ /***/ },
274
+ /* 3 */
275
+ /***/ function(module, exports, __webpack_require__) {
407
276
 
408
- var fn = options.fn;
277
+ 'use strict';
409
278
 
410
- if (!Utils.isEmpty(context)) {
411
- if (options.data && options.ids) {
412
- var data = createFrame(options.data);
413
- data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
414
- options = { data: data };
415
- }
279
+ exports.__esModule = true;
416
280
 
417
- return fn(context, options);
418
- } else {
419
- return options.inverse(this);
420
- }
421
- });
281
+ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
422
282
 
423
- instance.registerHelper('log', function (message, options) {
424
- var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
425
- instance.log(level, message);
426
- });
283
+ function Exception(message, node) {
284
+ var loc = node && node.loc,
285
+ line = undefined,
286
+ column = undefined;
287
+ if (loc) {
288
+ line = loc.start.line;
289
+ column = loc.start.column;
427
290
 
428
- instance.registerHelper('lookup', function (obj, field) {
429
- if (!obj) {
430
- return obj;
431
- }
432
- if (Utils.dangerousPropertyRegex.test(String(field)) && !Object.prototype.hasOwnProperty.call(obj, field)) {
433
- return undefined;
434
- }
435
- return obj[field];
436
- });
437
- }
291
+ message += ' - ' + line + ':' + column;
292
+ }
438
293
 
439
- var logger = {
440
- methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
294
+ var tmp = Error.prototype.constructor.call(this, message);
441
295
 
442
- // State enum
443
- DEBUG: 0,
444
- INFO: 1,
445
- WARN: 2,
446
- ERROR: 3,
447
- level: 1,
296
+ // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
297
+ for (var idx = 0; idx < errorProps.length; idx++) {
298
+ this[errorProps[idx]] = tmp[errorProps[idx]];
299
+ }
448
300
 
449
- // Can be overridden in the host environment
450
- log: function log(level, message) {
451
- if (typeof console !== 'undefined' && logger.level <= level) {
452
- var method = logger.methodMap[level];
453
- (console[method] || console.log).call(console, message); // eslint-disable-line no-console
454
- }
301
+ /* istanbul ignore else */
302
+ if (Error.captureStackTrace) {
303
+ Error.captureStackTrace(this, Exception);
455
304
  }
456
- };
457
305
 
458
- exports.logger = logger;
459
- var log = logger.log;
306
+ if (loc) {
307
+ this.lineNumber = line;
308
+ this.column = column;
309
+ }
310
+ }
460
311
 
461
- exports.log = log;
312
+ Exception.prototype = new Error();
462
313
 
463
- function createFrame(object) {
464
- var frame = Utils.extend({}, object);
465
- frame._parent = object;
466
- return frame;
467
- }
314
+ exports['default'] = Exception;
315
+ module.exports = exports['default'];
468
316
 
469
- /***/ }),
317
+ /***/ },
470
318
  /* 4 */
471
- /***/ (function(module, exports) {
319
+ /***/ function(module, exports, __webpack_require__) {
472
320
 
473
321
  'use strict';
474
322
 
@@ -477,6 +325,7 @@ return /******/ (function(modules) { // webpackBootstrap
477
325
  exports.indexOf = indexOf;
478
326
  exports.escapeExpression = escapeExpression;
479
327
  exports.isEmpty = isEmpty;
328
+ exports.createFrame = createFrame;
480
329
  exports.blockParams = blockParams;
481
330
  exports.appendContextPath = appendContextPath;
482
331
  var escape = {
@@ -485,13 +334,12 @@ return /******/ (function(modules) { // webpackBootstrap
485
334
  '>': '&gt;',
486
335
  '"': '&quot;',
487
336
  "'": '&#x27;',
488
- '`': '&#x60;'
489
- // The "equals-sign" is intentionally excluded from this list
490
- // due to semantic-versioning issues (see #1489)
337
+ '`': '&#x60;',
338
+ '=': '&#x3D;'
491
339
  };
492
340
 
493
- var badChars = /[&<>"'`]/g,
494
- possible = /[&<>"'`]/;
341
+ var badChars = /[&<>"'`=]/g,
342
+ possible = /[&<>"'`=]/;
495
343
 
496
344
  function escapeChar(chr) {
497
345
  return escape[chr];
@@ -511,10 +359,10 @@ return /******/ (function(modules) { // webpackBootstrap
511
359
 
512
360
  var toString = Object.prototype.toString;
513
361
 
514
- exports.toString = toString;
515
362
  // Sourced from lodash
516
363
  // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
517
- /*eslint-disable func-style, no-var */
364
+ /*eslint-disable func-style */
365
+ exports.toString = toString;
518
366
  var isFunction = function isFunction(value) {
519
367
  return typeof value === 'function';
520
368
  };
@@ -525,17 +373,17 @@ return /******/ (function(modules) { // webpackBootstrap
525
373
  return typeof value === 'function' && toString.call(value) === '[object Function]';
526
374
  };
527
375
  }
528
- var isFunction;
529
376
  exports.isFunction = isFunction;
530
- /*eslint-enable func-style, no-var */
377
+
378
+ /*eslint-enable func-style */
531
379
 
532
380
  /* istanbul ignore next */
533
381
  var isArray = Array.isArray || function (value) {
534
382
  return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
535
383
  };
536
384
 
537
- exports.isArray = isArray;
538
385
  // Older IE versions do not directly support indexOf so we must implement our own, sadly.
386
+ exports.isArray = isArray;
539
387
 
540
388
  function indexOf(array, value) {
541
389
  for (var i = 0, len = array.length; i < len; i++) {
@@ -579,6 +427,12 @@ return /******/ (function(modules) { // webpackBootstrap
579
427
  }
580
428
  }
581
429
 
430
+ function createFrame(object) {
431
+ var frame = extend({}, object);
432
+ frame._parent = object;
433
+ return frame;
434
+ }
435
+
582
436
  function blockParams(params, ids) {
583
437
  params.path = ids;
584
438
  return params;
@@ -588,148 +442,33 @@ return /******/ (function(modules) { // webpackBootstrap
588
442
  return (contextPath ? contextPath + '.' : '') + id;
589
443
  }
590
444
 
591
- var dangerousPropertyRegex = /^(constructor|__defineGetter__|__defineSetter__|__lookupGetter__|__proto__)$/;
592
- exports.dangerousPropertyRegex = dangerousPropertyRegex;
593
-
594
- /***/ }),
445
+ /***/ },
595
446
  /* 5 */
596
- /***/ (function(module, exports, __webpack_require__) {
447
+ /***/ function(module, exports, __webpack_require__) {
597
448
 
598
449
  'use strict';
599
450
 
600
- var _Object$defineProperty = __webpack_require__(6)['default'];
451
+ var _interopRequireWildcard = __webpack_require__(7)['default'];
452
+
453
+ var _interopRequireDefault = __webpack_require__(8)['default'];
601
454
 
602
455
  exports.__esModule = true;
603
-
604
- var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
605
-
606
- function Exception(message, node) {
607
- var loc = node && node.loc,
608
- line = undefined,
609
- column = undefined;
610
- if (loc) {
611
- line = loc.start.line;
612
- column = loc.start.column;
613
-
614
- message += ' - ' + line + ':' + column;
615
- }
616
-
617
- var tmp = Error.prototype.constructor.call(this, message);
618
-
619
- // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
620
- for (var idx = 0; idx < errorProps.length; idx++) {
621
- this[errorProps[idx]] = tmp[errorProps[idx]];
622
- }
623
-
624
- /* istanbul ignore else */
625
- if (Error.captureStackTrace) {
626
- Error.captureStackTrace(this, Exception);
627
- }
628
-
629
- try {
630
- if (loc) {
631
- this.lineNumber = line;
632
-
633
- // Work around issue under safari where we can't directly set the column value
634
- /* istanbul ignore next */
635
- if (_Object$defineProperty) {
636
- Object.defineProperty(this, 'column', {
637
- value: column,
638
- enumerable: true
639
- });
640
- } else {
641
- this.column = column;
642
- }
643
- }
644
- } catch (nop) {
645
- /* Ignore if the browser is very particular */
646
- }
647
- }
648
-
649
- Exception.prototype = new Error();
650
-
651
- exports['default'] = Exception;
652
- module.exports = exports['default'];
653
-
654
- /***/ }),
655
- /* 6 */
656
- /***/ (function(module, exports, __webpack_require__) {
657
-
658
- module.exports = { "default": __webpack_require__(7), __esModule: true };
659
-
660
- /***/ }),
661
- /* 7 */
662
- /***/ (function(module, exports, __webpack_require__) {
663
-
664
- var $ = __webpack_require__(8);
665
- module.exports = function defineProperty(it, key, desc){
666
- return $.setDesc(it, key, desc);
667
- };
668
-
669
- /***/ }),
670
- /* 8 */
671
- /***/ (function(module, exports) {
672
-
673
- var $Object = Object;
674
- module.exports = {
675
- create: $Object.create,
676
- getProto: $Object.getPrototypeOf,
677
- isEnum: {}.propertyIsEnumerable,
678
- getDesc: $Object.getOwnPropertyDescriptor,
679
- setDesc: $Object.defineProperty,
680
- setDescs: $Object.defineProperties,
681
- getKeys: $Object.keys,
682
- getNames: $Object.getOwnPropertyNames,
683
- getSymbols: $Object.getOwnPropertySymbols,
684
- each: [].forEach
685
- };
686
-
687
- /***/ }),
688
- /* 9 */
689
- /***/ (function(module, exports) {
690
-
691
- // Build out our basic SafeString type
692
- 'use strict';
693
-
694
- exports.__esModule = true;
695
- function SafeString(string) {
696
- this.string = string;
697
- }
698
-
699
- SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
700
- return '' + this.string;
701
- };
702
-
703
- exports['default'] = SafeString;
704
- module.exports = exports['default'];
705
-
706
- /***/ }),
707
- /* 10 */
708
- /***/ (function(module, exports, __webpack_require__) {
709
-
710
- 'use strict';
711
-
712
- var _interopRequireWildcard = __webpack_require__(1)['default'];
713
-
714
- var _interopRequireDefault = __webpack_require__(2)['default'];
715
-
716
- exports.__esModule = true;
717
- exports.checkRevision = checkRevision;
718
- exports.template = template;
719
- exports.wrapProgram = wrapProgram;
720
- exports.resolvePartial = resolvePartial;
721
- exports.invokePartial = invokePartial;
722
- exports.noop = noop;
456
+ exports.checkRevision = checkRevision;
457
+ exports.template = template;
458
+ exports.wrapProgram = wrapProgram;
459
+ exports.resolvePartial = resolvePartial;
460
+ exports.invokePartial = invokePartial;
461
+ exports.noop = noop;
723
462
 
724
463
  var _utils = __webpack_require__(4);
725
464
 
726
465
  var Utils = _interopRequireWildcard(_utils);
727
466
 
728
- var _exception = __webpack_require__(5);
467
+ var _exception = __webpack_require__(3);
729
468
 
730
469
  var _exception2 = _interopRequireDefault(_exception);
731
470
 
732
- var _base = __webpack_require__(3);
471
+ var _base = __webpack_require__(1);
733
472
 
734
473
  function checkRevision(compilerInfo) {
735
474
  var compilerRevision = compilerInfo && compilerInfo[0] || 1,
@@ -756,6 +495,8 @@ return /******/ (function(modules) { // webpackBootstrap
756
495
  throw new _exception2['default']('Unknown template object: ' + typeof templateSpec);
757
496
  }
758
497
 
498
+ templateSpec.main.decorator = templateSpec.main_d;
499
+
759
500
  // Note: Using env.VM references rather than local var references throughout this section to allow
760
501
  // for external users to override these as psuedo-supported APIs.
761
502
  env.VM.checkRevision(templateSpec.compiler);
@@ -763,6 +504,9 @@ return /******/ (function(modules) { // webpackBootstrap
763
504
  function invokePartialWrapper(partial, context, options) {
764
505
  if (options.hash) {
765
506
  context = Utils.extend({}, context, options.hash);
507
+ if (options.ids) {
508
+ options.ids[0] = true;
509
+ }
766
510
  }
767
511
 
768
512
  partial = env.VM.resolvePartial.call(this, partial, context, options);
@@ -814,7 +558,9 @@ return /******/ (function(modules) { // webpackBootstrap
814
558
  invokePartial: invokePartialWrapper,
815
559
 
816
560
  fn: function fn(i) {
817
- return templateSpec[i];
561
+ var ret = templateSpec[i];
562
+ ret.decorator = templateSpec[i + '_d'];
563
+ return ret;
818
564
  },
819
565
 
820
566
  programs: [],
@@ -861,10 +607,18 @@ return /******/ (function(modules) { // webpackBootstrap
861
607
  var depths = undefined,
862
608
  blockParams = templateSpec.useBlockParams ? [] : undefined;
863
609
  if (templateSpec.useDepths) {
864
- depths = options.depths ? [context].concat(options.depths) : [context];
610
+ if (options.depths) {
611
+ depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths;
612
+ } else {
613
+ depths = [context];
614
+ }
865
615
  }
866
616
 
867
- return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
617
+ function main(context /*, options*/) {
618
+ return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths);
619
+ }
620
+ main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams);
621
+ return main(context, options);
868
622
  }
869
623
  ret.isTop = true;
870
624
 
@@ -875,9 +629,13 @@ return /******/ (function(modules) { // webpackBootstrap
875
629
  if (templateSpec.usePartial) {
876
630
  container.partials = container.merge(options.partials, env.partials);
877
631
  }
632
+ if (templateSpec.useDecorators) {
633
+ container.decorators = container.merge(options.decorators, env.decorators);
634
+ }
878
635
  } else {
879
636
  container.helpers = options.helpers;
880
637
  container.partials = options.partials;
638
+ container.decorators = options.decorators;
881
639
  }
882
640
  };
883
641
 
@@ -898,8 +656,16 @@ return /******/ (function(modules) { // webpackBootstrap
898
656
  function prog(context) {
899
657
  var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
900
658
 
901
- return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
659
+ var currentDepths = depths;
660
+ if (depths && context !== depths[0]) {
661
+ currentDepths = [context].concat(depths);
662
+ }
663
+
664
+ return fn(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), currentDepths);
902
665
  }
666
+
667
+ prog = executeDecorators(fn, prog, container, depths, data, blockParams);
668
+
903
669
  prog.program = i;
904
670
  prog.depth = depths ? depths.length : 0;
905
671
  prog.blockParams = declaredBlockParams || 0;
@@ -908,7 +674,11 @@ return /******/ (function(modules) { // webpackBootstrap
908
674
 
909
675
  function resolvePartial(partial, context, options) {
910
676
  if (!partial) {
911
- partial = options.partials[options.name];
677
+ if (options.name === '@partial-block') {
678
+ partial = options.data['partial-block'];
679
+ } else {
680
+ partial = options.partials[options.name];
681
+ }
912
682
  } else if (!partial.call && !options.name) {
913
683
  // This is a dynamic partial that returned a string
914
684
  options.name = partial;
@@ -919,6 +689,22 @@ return /******/ (function(modules) { // webpackBootstrap
919
689
 
920
690
  function invokePartial(partial, context, options) {
921
691
  options.partial = true;
692
+ if (options.ids) {
693
+ options.data.contextPath = options.ids[0] || options.data.contextPath;
694
+ }
695
+
696
+ var partialBlock = undefined;
697
+ if (options.fn && options.fn !== noop) {
698
+ partialBlock = options.data['partial-block'] = options.fn;
699
+
700
+ if (partialBlock.partials) {
701
+ options.partials = Utils.extend({}, options.partials, partialBlock.partials);
702
+ }
703
+ }
704
+
705
+ if (partial === undefined && partialBlock) {
706
+ partial = partialBlock;
707
+ }
922
708
 
923
709
  if (partial === undefined) {
924
710
  throw new _exception2['default']('The partial ' + options.name + ' could not be found');
@@ -939,9 +725,18 @@ return /******/ (function(modules) { // webpackBootstrap
939
725
  return data;
940
726
  }
941
727
 
942
- /***/ }),
943
- /* 11 */
944
- /***/ (function(module, exports) {
728
+ function executeDecorators(fn, prog, container, depths, data, blockParams) {
729
+ if (fn.decorator) {
730
+ var props = {};
731
+ prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths);
732
+ Utils.extend(prog, props);
733
+ }
734
+ return prog;
735
+ }
736
+
737
+ /***/ },
738
+ /* 6 */
739
+ /***/ function(module, exports, __webpack_require__) {
945
740
 
946
741
  /* WEBPACK VAR INJECTION */(function(global) {/*global window */
947
742
  'use strict';
@@ -963,7 +758,483 @@ return /******/ (function(modules) { // webpackBootstrap
963
758
  module.exports = exports['default'];
964
759
  /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
965
760
 
966
- /***/ })
761
+ /***/ },
762
+ /* 7 */
763
+ /***/ function(module, exports, __webpack_require__) {
764
+
765
+ "use strict";
766
+
767
+ exports["default"] = function (obj) {
768
+ if (obj && obj.__esModule) {
769
+ return obj;
770
+ } else {
771
+ var newObj = {};
772
+
773
+ if (obj != null) {
774
+ for (var key in obj) {
775
+ if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
776
+ }
777
+ }
778
+
779
+ newObj["default"] = obj;
780
+ return newObj;
781
+ }
782
+ };
783
+
784
+ exports.__esModule = true;
785
+
786
+ /***/ },
787
+ /* 8 */
788
+ /***/ function(module, exports, __webpack_require__) {
789
+
790
+ "use strict";
791
+
792
+ exports["default"] = function (obj) {
793
+ return obj && obj.__esModule ? obj : {
794
+ "default": obj
795
+ };
796
+ };
797
+
798
+ exports.__esModule = true;
799
+
800
+ /***/ },
801
+ /* 9 */
802
+ /***/ function(module, exports, __webpack_require__) {
803
+
804
+ 'use strict';
805
+
806
+ var _interopRequireDefault = __webpack_require__(8)['default'];
807
+
808
+ exports.__esModule = true;
809
+ exports.registerDefaultHelpers = registerDefaultHelpers;
810
+
811
+ var _helpersBlockHelperMissing = __webpack_require__(12);
812
+
813
+ var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing);
814
+
815
+ var _helpersEach = __webpack_require__(13);
816
+
817
+ var _helpersEach2 = _interopRequireDefault(_helpersEach);
818
+
819
+ var _helpersHelperMissing = __webpack_require__(14);
820
+
821
+ var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing);
822
+
823
+ var _helpersIf = __webpack_require__(15);
824
+
825
+ var _helpersIf2 = _interopRequireDefault(_helpersIf);
826
+
827
+ var _helpersLog = __webpack_require__(16);
828
+
829
+ var _helpersLog2 = _interopRequireDefault(_helpersLog);
830
+
831
+ var _helpersLookup = __webpack_require__(17);
832
+
833
+ var _helpersLookup2 = _interopRequireDefault(_helpersLookup);
834
+
835
+ var _helpersWith = __webpack_require__(18);
836
+
837
+ var _helpersWith2 = _interopRequireDefault(_helpersWith);
838
+
839
+ function registerDefaultHelpers(instance) {
840
+ _helpersBlockHelperMissing2['default'](instance);
841
+ _helpersEach2['default'](instance);
842
+ _helpersHelperMissing2['default'](instance);
843
+ _helpersIf2['default'](instance);
844
+ _helpersLog2['default'](instance);
845
+ _helpersLookup2['default'](instance);
846
+ _helpersWith2['default'](instance);
847
+ }
848
+
849
+ /***/ },
850
+ /* 10 */
851
+ /***/ function(module, exports, __webpack_require__) {
852
+
853
+ 'use strict';
854
+
855
+ var _interopRequireDefault = __webpack_require__(8)['default'];
856
+
857
+ exports.__esModule = true;
858
+ exports.registerDefaultDecorators = registerDefaultDecorators;
859
+
860
+ var _decoratorsInline = __webpack_require__(19);
861
+
862
+ var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline);
863
+
864
+ function registerDefaultDecorators(instance) {
865
+ _decoratorsInline2['default'](instance);
866
+ }
867
+
868
+ /***/ },
869
+ /* 11 */
870
+ /***/ function(module, exports, __webpack_require__) {
871
+
872
+ 'use strict';
873
+
874
+ exports.__esModule = true;
875
+ var logger = {
876
+ methodMap: ['debug', 'info', 'warn', 'error'],
877
+ level: 'info',
878
+
879
+ // Maps a given level value to the `methodMap` indexes above.
880
+ lookupLevel: function lookupLevel(level) {
881
+ if (typeof level === 'string') {
882
+ var levelMap = logger.methodMap.indexOf(level.toLowerCase());
883
+ if (levelMap >= 0) {
884
+ level = levelMap;
885
+ } else {
886
+ level = parseInt(level, 10);
887
+ }
888
+ }
889
+
890
+ return level;
891
+ },
892
+
893
+ // Can be overridden in the host environment
894
+ log: function log(level) {
895
+ level = logger.lookupLevel(level);
896
+
897
+ if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) {
898
+ var method = logger.methodMap[level];
899
+ if (!console[method]) {
900
+ // eslint-disable-line no-console
901
+ method = 'log';
902
+ }
903
+
904
+ for (var _len = arguments.length, message = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
905
+ message[_key - 1] = arguments[_key];
906
+ }
907
+
908
+ console[method].apply(console, message); // eslint-disable-line no-console
909
+ }
910
+ }
911
+ };
912
+
913
+ exports['default'] = logger;
914
+ module.exports = exports['default'];
915
+
916
+ /***/ },
917
+ /* 12 */
918
+ /***/ function(module, exports, __webpack_require__) {
919
+
920
+ 'use strict';
921
+
922
+ exports.__esModule = true;
923
+
924
+ var _utils = __webpack_require__(4);
925
+
926
+ exports['default'] = function (instance) {
927
+ instance.registerHelper('blockHelperMissing', function (context, options) {
928
+ var inverse = options.inverse,
929
+ fn = options.fn;
930
+
931
+ if (context === true) {
932
+ return fn(this);
933
+ } else if (context === false || context == null) {
934
+ return inverse(this);
935
+ } else if (_utils.isArray(context)) {
936
+ if (context.length > 0) {
937
+ if (options.ids) {
938
+ options.ids = [options.name];
939
+ }
940
+
941
+ return instance.helpers.each(context, options);
942
+ } else {
943
+ return inverse(this);
944
+ }
945
+ } else {
946
+ if (options.data && options.ids) {
947
+ var data = _utils.createFrame(options.data);
948
+ data.contextPath = _utils.appendContextPath(options.data.contextPath, options.name);
949
+ options = { data: data };
950
+ }
951
+
952
+ return fn(context, options);
953
+ }
954
+ });
955
+ };
956
+
957
+ module.exports = exports['default'];
958
+
959
+ /***/ },
960
+ /* 13 */
961
+ /***/ function(module, exports, __webpack_require__) {
962
+
963
+ 'use strict';
964
+
965
+ var _interopRequireDefault = __webpack_require__(8)['default'];
966
+
967
+ exports.__esModule = true;
968
+
969
+ var _utils = __webpack_require__(4);
970
+
971
+ var _exception = __webpack_require__(3);
972
+
973
+ var _exception2 = _interopRequireDefault(_exception);
974
+
975
+ exports['default'] = function (instance) {
976
+ instance.registerHelper('each', function (context, options) {
977
+ if (!options) {
978
+ throw new _exception2['default']('Must pass iterator to #each');
979
+ }
980
+
981
+ var fn = options.fn,
982
+ inverse = options.inverse,
983
+ i = 0,
984
+ ret = '',
985
+ data = undefined,
986
+ contextPath = undefined;
987
+
988
+ if (options.data && options.ids) {
989
+ contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
990
+ }
991
+
992
+ if (_utils.isFunction(context)) {
993
+ context = context.call(this);
994
+ }
995
+
996
+ if (options.data) {
997
+ data = _utils.createFrame(options.data);
998
+ }
999
+
1000
+ function execIteration(field, index, last) {
1001
+ // Don't iterate over undefined values since we can't execute blocks against them
1002
+ // in non-strict (js) mode.
1003
+ if (context[field] == null) {
1004
+ return;
1005
+ }
1006
+
1007
+ if (data) {
1008
+ data.key = field;
1009
+ data.index = index;
1010
+ data.first = index === 0;
1011
+ data.last = !!last;
1012
+
1013
+ if (contextPath) {
1014
+ data.contextPath = contextPath + field;
1015
+ }
1016
+ }
1017
+
1018
+ ret = ret + fn(context[field], {
1019
+ data: data,
1020
+ blockParams: _utils.blockParams([context[field], field], [contextPath + field, null])
1021
+ });
1022
+ }
1023
+
1024
+ if (context && typeof context === 'object') {
1025
+ if (_utils.isArray(context)) {
1026
+ for (var j = context.length; i < j; i++) {
1027
+ execIteration(i, i, i === context.length - 1);
1028
+ }
1029
+ } else {
1030
+ var priorKey = undefined;
1031
+
1032
+ for (var key in context) {
1033
+ if (context.hasOwnProperty(key)) {
1034
+ // We're running the iterations one step out of sync so we can detect
1035
+ // the last iteration without have to scan the object twice and create
1036
+ // an itermediate keys array.
1037
+ if (priorKey !== undefined) {
1038
+ execIteration(priorKey, i - 1);
1039
+ }
1040
+ priorKey = key;
1041
+ i++;
1042
+ }
1043
+ }
1044
+ if (priorKey !== undefined) {
1045
+ execIteration(priorKey, i - 1, true);
1046
+ }
1047
+ }
1048
+ }
1049
+
1050
+ if (i === 0) {
1051
+ ret = inverse(this);
1052
+ }
1053
+
1054
+ return ret;
1055
+ });
1056
+ };
1057
+
1058
+ module.exports = exports['default'];
1059
+
1060
+ /***/ },
1061
+ /* 14 */
1062
+ /***/ function(module, exports, __webpack_require__) {
1063
+
1064
+ 'use strict';
1065
+
1066
+ var _interopRequireDefault = __webpack_require__(8)['default'];
1067
+
1068
+ exports.__esModule = true;
1069
+
1070
+ var _exception = __webpack_require__(3);
1071
+
1072
+ var _exception2 = _interopRequireDefault(_exception);
1073
+
1074
+ exports['default'] = function (instance) {
1075
+ instance.registerHelper('helperMissing', function () /* [args, ]options */{
1076
+ if (arguments.length === 1) {
1077
+ // A missing field in a {{foo}} construct.
1078
+ return undefined;
1079
+ } else {
1080
+ // Someone is actually trying to call something, blow up.
1081
+ throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
1082
+ }
1083
+ });
1084
+ };
1085
+
1086
+ module.exports = exports['default'];
1087
+
1088
+ /***/ },
1089
+ /* 15 */
1090
+ /***/ function(module, exports, __webpack_require__) {
1091
+
1092
+ 'use strict';
1093
+
1094
+ exports.__esModule = true;
1095
+
1096
+ var _utils = __webpack_require__(4);
1097
+
1098
+ exports['default'] = function (instance) {
1099
+ instance.registerHelper('if', function (conditional, options) {
1100
+ if (_utils.isFunction(conditional)) {
1101
+ conditional = conditional.call(this);
1102
+ }
1103
+
1104
+ // Default behavior is to render the positive path if the value is truthy and not empty.
1105
+ // The `includeZero` option may be set to treat the condtional as purely not empty based on the
1106
+ // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
1107
+ if (!options.hash.includeZero && !conditional || _utils.isEmpty(conditional)) {
1108
+ return options.inverse(this);
1109
+ } else {
1110
+ return options.fn(this);
1111
+ }
1112
+ });
1113
+
1114
+ instance.registerHelper('unless', function (conditional, options) {
1115
+ return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
1116
+ });
1117
+ };
1118
+
1119
+ module.exports = exports['default'];
1120
+
1121
+ /***/ },
1122
+ /* 16 */
1123
+ /***/ function(module, exports, __webpack_require__) {
1124
+
1125
+ 'use strict';
1126
+
1127
+ exports.__esModule = true;
1128
+
1129
+ exports['default'] = function (instance) {
1130
+ instance.registerHelper('log', function () /* message, options */{
1131
+ var args = [undefined],
1132
+ options = arguments[arguments.length - 1];
1133
+ for (var i = 0; i < arguments.length - 1; i++) {
1134
+ args.push(arguments[i]);
1135
+ }
1136
+
1137
+ var level = 1;
1138
+ if (options.hash.level != null) {
1139
+ level = options.hash.level;
1140
+ } else if (options.data && options.data.level != null) {
1141
+ level = options.data.level;
1142
+ }
1143
+ args[0] = level;
1144
+
1145
+ instance.log.apply(instance, args);
1146
+ });
1147
+ };
1148
+
1149
+ module.exports = exports['default'];
1150
+
1151
+ /***/ },
1152
+ /* 17 */
1153
+ /***/ function(module, exports, __webpack_require__) {
1154
+
1155
+ 'use strict';
1156
+
1157
+ exports.__esModule = true;
1158
+
1159
+ exports['default'] = function (instance) {
1160
+ instance.registerHelper('lookup', function (obj, field) {
1161
+ return obj && obj[field];
1162
+ });
1163
+ };
1164
+
1165
+ module.exports = exports['default'];
1166
+
1167
+ /***/ },
1168
+ /* 18 */
1169
+ /***/ function(module, exports, __webpack_require__) {
1170
+
1171
+ 'use strict';
1172
+
1173
+ exports.__esModule = true;
1174
+
1175
+ var _utils = __webpack_require__(4);
1176
+
1177
+ exports['default'] = function (instance) {
1178
+ instance.registerHelper('with', function (context, options) {
1179
+ if (_utils.isFunction(context)) {
1180
+ context = context.call(this);
1181
+ }
1182
+
1183
+ var fn = options.fn;
1184
+
1185
+ if (!_utils.isEmpty(context)) {
1186
+ var data = options.data;
1187
+ if (options.data && options.ids) {
1188
+ data = _utils.createFrame(options.data);
1189
+ data.contextPath = _utils.appendContextPath(options.data.contextPath, options.ids[0]);
1190
+ }
1191
+
1192
+ return fn(context, {
1193
+ data: data,
1194
+ blockParams: _utils.blockParams([context], [data && data.contextPath])
1195
+ });
1196
+ } else {
1197
+ return options.inverse(this);
1198
+ }
1199
+ });
1200
+ };
1201
+
1202
+ module.exports = exports['default'];
1203
+
1204
+ /***/ },
1205
+ /* 19 */
1206
+ /***/ function(module, exports, __webpack_require__) {
1207
+
1208
+ 'use strict';
1209
+
1210
+ exports.__esModule = true;
1211
+
1212
+ var _utils = __webpack_require__(4);
1213
+
1214
+ exports['default'] = function (instance) {
1215
+ instance.registerDecorator('inline', function (fn, props, container, options) {
1216
+ var ret = fn;
1217
+ if (!props.partials) {
1218
+ props.partials = {};
1219
+ ret = function (context, options) {
1220
+ // Create a new partials stack frame prior to exec.
1221
+ var original = container.partials;
1222
+ container.partials = _utils.extend({}, original, props.partials);
1223
+ var ret = fn(context, options);
1224
+ container.partials = original;
1225
+ return ret;
1226
+ };
1227
+ }
1228
+
1229
+ props.partials[options.args[0]] = options.fn;
1230
+
1231
+ return ret;
1232
+ });
1233
+ };
1234
+
1235
+ module.exports = exports['default'];
1236
+
1237
+ /***/ }
967
1238
  /******/ ])
968
1239
  });
969
1240
  ;