mutton 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mutton/version.rb +1 -1
- data/test/dummy/log/test.log +2033 -0
- data/vendor/assets/javascripts/mutton/handlebars.js +4131 -0
- data/vendor/assets/javascripts/mutton/handlebars.runtime.js +912 -0
- metadata +3 -1
@@ -0,0 +1,912 @@
|
|
1
|
+
/*!
|
2
|
+
|
3
|
+
handlebars v3.0.3
|
4
|
+
|
5
|
+
Copyright (C) 2011-2014 by Yehuda Katz
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
9
|
+
in the Software without restriction, including without limitation the rights
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
15
|
+
all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
THE SOFTWARE.
|
24
|
+
|
25
|
+
@license
|
26
|
+
*/
|
27
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
28
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
29
|
+
module.exports = factory();
|
30
|
+
else if(typeof define === 'function' && define.amd)
|
31
|
+
define(factory);
|
32
|
+
else if(typeof exports === 'object')
|
33
|
+
exports["Handlebars"] = factory();
|
34
|
+
else
|
35
|
+
root["Handlebars"] = factory();
|
36
|
+
})(this, function() {
|
37
|
+
return /******/ (function(modules) { // webpackBootstrap
|
38
|
+
/******/ // The module cache
|
39
|
+
/******/ var installedModules = {};
|
40
|
+
|
41
|
+
/******/ // The require function
|
42
|
+
/******/ function __webpack_require__(moduleId) {
|
43
|
+
|
44
|
+
/******/ // Check if module is in cache
|
45
|
+
/******/ if(installedModules[moduleId])
|
46
|
+
/******/ return installedModules[moduleId].exports;
|
47
|
+
|
48
|
+
/******/ // Create a new module (and put it into the cache)
|
49
|
+
/******/ var module = installedModules[moduleId] = {
|
50
|
+
/******/ exports: {},
|
51
|
+
/******/ id: moduleId,
|
52
|
+
/******/ loaded: false
|
53
|
+
/******/ };
|
54
|
+
|
55
|
+
/******/ // Execute the module function
|
56
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
57
|
+
|
58
|
+
/******/ // Flag the module as loaded
|
59
|
+
/******/ module.loaded = true;
|
60
|
+
|
61
|
+
/******/ // Return the exports of the module
|
62
|
+
/******/ return module.exports;
|
63
|
+
/******/ }
|
64
|
+
|
65
|
+
|
66
|
+
/******/ // expose the modules object (__webpack_modules__)
|
67
|
+
/******/ __webpack_require__.m = modules;
|
68
|
+
|
69
|
+
/******/ // expose the module cache
|
70
|
+
/******/ __webpack_require__.c = installedModules;
|
71
|
+
|
72
|
+
/******/ // __webpack_public_path__
|
73
|
+
/******/ __webpack_require__.p = "";
|
74
|
+
|
75
|
+
/******/ // Load entry module and return exports
|
76
|
+
/******/ return __webpack_require__(0);
|
77
|
+
/******/ })
|
78
|
+
/************************************************************************/
|
79
|
+
/******/ ([
|
80
|
+
/* 0 */
|
81
|
+
/***/ function(module, exports, __webpack_require__) {
|
82
|
+
|
83
|
+
'use strict';
|
84
|
+
|
85
|
+
var _interopRequireWildcard = __webpack_require__(7)['default'];
|
86
|
+
|
87
|
+
var _interopRequireDefault = __webpack_require__(8)['default'];
|
88
|
+
|
89
|
+
exports.__esModule = true;
|
90
|
+
|
91
|
+
var _import = __webpack_require__(1);
|
92
|
+
|
93
|
+
var base = _interopRequireWildcard(_import);
|
94
|
+
|
95
|
+
// Each of these augment the Handlebars object. No need to setup here.
|
96
|
+
// (This is done to easily share code between commonjs and browse envs)
|
97
|
+
|
98
|
+
var _SafeString = __webpack_require__(2);
|
99
|
+
|
100
|
+
var _SafeString2 = _interopRequireDefault(_SafeString);
|
101
|
+
|
102
|
+
var _Exception = __webpack_require__(3);
|
103
|
+
|
104
|
+
var _Exception2 = _interopRequireDefault(_Exception);
|
105
|
+
|
106
|
+
var _import2 = __webpack_require__(4);
|
107
|
+
|
108
|
+
var Utils = _interopRequireWildcard(_import2);
|
109
|
+
|
110
|
+
var _import3 = __webpack_require__(5);
|
111
|
+
|
112
|
+
var runtime = _interopRequireWildcard(_import3);
|
113
|
+
|
114
|
+
var _noConflict = __webpack_require__(6);
|
115
|
+
|
116
|
+
var _noConflict2 = _interopRequireDefault(_noConflict);
|
117
|
+
|
118
|
+
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
|
119
|
+
function create() {
|
120
|
+
var hb = new base.HandlebarsEnvironment();
|
121
|
+
|
122
|
+
Utils.extend(hb, base);
|
123
|
+
hb.SafeString = _SafeString2['default'];
|
124
|
+
hb.Exception = _Exception2['default'];
|
125
|
+
hb.Utils = Utils;
|
126
|
+
hb.escapeExpression = Utils.escapeExpression;
|
127
|
+
|
128
|
+
hb.VM = runtime;
|
129
|
+
hb.template = function (spec) {
|
130
|
+
return runtime.template(spec, hb);
|
131
|
+
};
|
132
|
+
|
133
|
+
return hb;
|
134
|
+
}
|
135
|
+
|
136
|
+
var inst = create();
|
137
|
+
inst.create = create;
|
138
|
+
|
139
|
+
_noConflict2['default'](inst);
|
140
|
+
|
141
|
+
inst['default'] = inst;
|
142
|
+
|
143
|
+
exports['default'] = inst;
|
144
|
+
module.exports = exports['default'];
|
145
|
+
|
146
|
+
/***/ },
|
147
|
+
/* 1 */
|
148
|
+
/***/ function(module, exports, __webpack_require__) {
|
149
|
+
|
150
|
+
'use strict';
|
151
|
+
|
152
|
+
var _interopRequireWildcard = __webpack_require__(7)['default'];
|
153
|
+
|
154
|
+
var _interopRequireDefault = __webpack_require__(8)['default'];
|
155
|
+
|
156
|
+
exports.__esModule = true;
|
157
|
+
exports.HandlebarsEnvironment = HandlebarsEnvironment;
|
158
|
+
exports.createFrame = createFrame;
|
159
|
+
|
160
|
+
var _import = __webpack_require__(4);
|
161
|
+
|
162
|
+
var Utils = _interopRequireWildcard(_import);
|
163
|
+
|
164
|
+
var _Exception = __webpack_require__(3);
|
165
|
+
|
166
|
+
var _Exception2 = _interopRequireDefault(_Exception);
|
167
|
+
|
168
|
+
var VERSION = '3.0.1';
|
169
|
+
exports.VERSION = VERSION;
|
170
|
+
var COMPILER_REVISION = 6;
|
171
|
+
|
172
|
+
exports.COMPILER_REVISION = COMPILER_REVISION;
|
173
|
+
var REVISION_CHANGES = {
|
174
|
+
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
|
175
|
+
2: '== 1.0.0-rc.3',
|
176
|
+
3: '== 1.0.0-rc.4',
|
177
|
+
4: '== 1.x.x',
|
178
|
+
5: '== 2.0.0-alpha.x',
|
179
|
+
6: '>= 2.0.0-beta.1'
|
180
|
+
};
|
181
|
+
|
182
|
+
exports.REVISION_CHANGES = REVISION_CHANGES;
|
183
|
+
var isArray = Utils.isArray,
|
184
|
+
isFunction = Utils.isFunction,
|
185
|
+
toString = Utils.toString,
|
186
|
+
objectType = '[object Object]';
|
187
|
+
|
188
|
+
function HandlebarsEnvironment(helpers, partials) {
|
189
|
+
this.helpers = helpers || {};
|
190
|
+
this.partials = partials || {};
|
191
|
+
|
192
|
+
registerDefaultHelpers(this);
|
193
|
+
}
|
194
|
+
|
195
|
+
HandlebarsEnvironment.prototype = {
|
196
|
+
constructor: HandlebarsEnvironment,
|
197
|
+
|
198
|
+
logger: logger,
|
199
|
+
log: log,
|
200
|
+
|
201
|
+
registerHelper: function registerHelper(name, fn) {
|
202
|
+
if (toString.call(name) === objectType) {
|
203
|
+
if (fn) {
|
204
|
+
throw new _Exception2['default']('Arg not supported with multiple helpers');
|
205
|
+
}
|
206
|
+
Utils.extend(this.helpers, name);
|
207
|
+
} else {
|
208
|
+
this.helpers[name] = fn;
|
209
|
+
}
|
210
|
+
},
|
211
|
+
unregisterHelper: function unregisterHelper(name) {
|
212
|
+
delete this.helpers[name];
|
213
|
+
},
|
214
|
+
|
215
|
+
registerPartial: function registerPartial(name, partial) {
|
216
|
+
if (toString.call(name) === objectType) {
|
217
|
+
Utils.extend(this.partials, name);
|
218
|
+
} else {
|
219
|
+
if (typeof partial === 'undefined') {
|
220
|
+
throw new _Exception2['default']('Attempting to register a partial as undefined');
|
221
|
+
}
|
222
|
+
this.partials[name] = partial;
|
223
|
+
}
|
224
|
+
},
|
225
|
+
unregisterPartial: function unregisterPartial(name) {
|
226
|
+
delete this.partials[name];
|
227
|
+
}
|
228
|
+
};
|
229
|
+
|
230
|
+
function registerDefaultHelpers(instance) {
|
231
|
+
instance.registerHelper('helperMissing', function () {
|
232
|
+
if (arguments.length === 1) {
|
233
|
+
// A missing field in a {{foo}} constuct.
|
234
|
+
return undefined;
|
235
|
+
} else {
|
236
|
+
// Someone is actually trying to call something, blow up.
|
237
|
+
throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
|
238
|
+
}
|
239
|
+
});
|
240
|
+
|
241
|
+
instance.registerHelper('blockHelperMissing', function (context, options) {
|
242
|
+
var inverse = options.inverse,
|
243
|
+
fn = options.fn;
|
244
|
+
|
245
|
+
if (context === true) {
|
246
|
+
return fn(this);
|
247
|
+
} else if (context === false || context == null) {
|
248
|
+
return inverse(this);
|
249
|
+
} else if (isArray(context)) {
|
250
|
+
if (context.length > 0) {
|
251
|
+
if (options.ids) {
|
252
|
+
options.ids = [options.name];
|
253
|
+
}
|
254
|
+
|
255
|
+
return instance.helpers.each(context, options);
|
256
|
+
} else {
|
257
|
+
return inverse(this);
|
258
|
+
}
|
259
|
+
} else {
|
260
|
+
if (options.data && options.ids) {
|
261
|
+
var data = createFrame(options.data);
|
262
|
+
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
|
263
|
+
options = { data: data };
|
264
|
+
}
|
265
|
+
|
266
|
+
return fn(context, options);
|
267
|
+
}
|
268
|
+
});
|
269
|
+
|
270
|
+
instance.registerHelper('each', function (context, options) {
|
271
|
+
if (!options) {
|
272
|
+
throw new _Exception2['default']('Must pass iterator to #each');
|
273
|
+
}
|
274
|
+
|
275
|
+
var fn = options.fn,
|
276
|
+
inverse = options.inverse,
|
277
|
+
i = 0,
|
278
|
+
ret = '',
|
279
|
+
data = undefined,
|
280
|
+
contextPath = undefined;
|
281
|
+
|
282
|
+
if (options.data && options.ids) {
|
283
|
+
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
|
284
|
+
}
|
285
|
+
|
286
|
+
if (isFunction(context)) {
|
287
|
+
context = context.call(this);
|
288
|
+
}
|
289
|
+
|
290
|
+
if (options.data) {
|
291
|
+
data = createFrame(options.data);
|
292
|
+
}
|
293
|
+
|
294
|
+
function execIteration(field, index, last) {
|
295
|
+
if (data) {
|
296
|
+
data.key = field;
|
297
|
+
data.index = index;
|
298
|
+
data.first = index === 0;
|
299
|
+
data.last = !!last;
|
300
|
+
|
301
|
+
if (contextPath) {
|
302
|
+
data.contextPath = contextPath + field;
|
303
|
+
}
|
304
|
+
}
|
305
|
+
|
306
|
+
ret = ret + fn(context[field], {
|
307
|
+
data: data,
|
308
|
+
blockParams: Utils.blockParams([context[field], field], [contextPath + field, null])
|
309
|
+
});
|
310
|
+
}
|
311
|
+
|
312
|
+
if (context && typeof context === 'object') {
|
313
|
+
if (isArray(context)) {
|
314
|
+
for (var j = context.length; i < j; i++) {
|
315
|
+
execIteration(i, i, i === context.length - 1);
|
316
|
+
}
|
317
|
+
} else {
|
318
|
+
var priorKey = undefined;
|
319
|
+
|
320
|
+
for (var key in context) {
|
321
|
+
if (context.hasOwnProperty(key)) {
|
322
|
+
// We're running the iterations one step out of sync so we can detect
|
323
|
+
// the last iteration without have to scan the object twice and create
|
324
|
+
// an itermediate keys array.
|
325
|
+
if (priorKey) {
|
326
|
+
execIteration(priorKey, i - 1);
|
327
|
+
}
|
328
|
+
priorKey = key;
|
329
|
+
i++;
|
330
|
+
}
|
331
|
+
}
|
332
|
+
if (priorKey) {
|
333
|
+
execIteration(priorKey, i - 1, true);
|
334
|
+
}
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
if (i === 0) {
|
339
|
+
ret = inverse(this);
|
340
|
+
}
|
341
|
+
|
342
|
+
return ret;
|
343
|
+
});
|
344
|
+
|
345
|
+
instance.registerHelper('if', function (conditional, options) {
|
346
|
+
if (isFunction(conditional)) {
|
347
|
+
conditional = conditional.call(this);
|
348
|
+
}
|
349
|
+
|
350
|
+
// Default behavior is to render the positive path if the value is truthy and not empty.
|
351
|
+
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
|
352
|
+
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
|
353
|
+
if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) {
|
354
|
+
return options.inverse(this);
|
355
|
+
} else {
|
356
|
+
return options.fn(this);
|
357
|
+
}
|
358
|
+
});
|
359
|
+
|
360
|
+
instance.registerHelper('unless', function (conditional, options) {
|
361
|
+
return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
|
362
|
+
});
|
363
|
+
|
364
|
+
instance.registerHelper('with', function (context, options) {
|
365
|
+
if (isFunction(context)) {
|
366
|
+
context = context.call(this);
|
367
|
+
}
|
368
|
+
|
369
|
+
var fn = options.fn;
|
370
|
+
|
371
|
+
if (!Utils.isEmpty(context)) {
|
372
|
+
if (options.data && options.ids) {
|
373
|
+
var data = createFrame(options.data);
|
374
|
+
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
|
375
|
+
options = { data: data };
|
376
|
+
}
|
377
|
+
|
378
|
+
return fn(context, options);
|
379
|
+
} else {
|
380
|
+
return options.inverse(this);
|
381
|
+
}
|
382
|
+
});
|
383
|
+
|
384
|
+
instance.registerHelper('log', function (message, options) {
|
385
|
+
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
386
|
+
instance.log(level, message);
|
387
|
+
});
|
388
|
+
|
389
|
+
instance.registerHelper('lookup', function (obj, field) {
|
390
|
+
return obj && obj[field];
|
391
|
+
});
|
392
|
+
}
|
393
|
+
|
394
|
+
var logger = {
|
395
|
+
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
|
396
|
+
|
397
|
+
// State enum
|
398
|
+
DEBUG: 0,
|
399
|
+
INFO: 1,
|
400
|
+
WARN: 2,
|
401
|
+
ERROR: 3,
|
402
|
+
level: 1,
|
403
|
+
|
404
|
+
// Can be overridden in the host environment
|
405
|
+
log: function log(level, message) {
|
406
|
+
if (typeof console !== 'undefined' && logger.level <= level) {
|
407
|
+
var method = logger.methodMap[level];
|
408
|
+
(console[method] || console.log).call(console, message); // eslint-disable-line no-console
|
409
|
+
}
|
410
|
+
}
|
411
|
+
};
|
412
|
+
|
413
|
+
exports.logger = logger;
|
414
|
+
var log = logger.log;
|
415
|
+
|
416
|
+
exports.log = log;
|
417
|
+
|
418
|
+
function createFrame(object) {
|
419
|
+
var frame = Utils.extend({}, object);
|
420
|
+
frame._parent = object;
|
421
|
+
return frame;
|
422
|
+
}
|
423
|
+
|
424
|
+
/* [args, ]options */
|
425
|
+
|
426
|
+
/***/ },
|
427
|
+
/* 2 */
|
428
|
+
/***/ function(module, exports, __webpack_require__) {
|
429
|
+
|
430
|
+
'use strict';
|
431
|
+
|
432
|
+
exports.__esModule = true;
|
433
|
+
// Build out our basic SafeString type
|
434
|
+
function SafeString(string) {
|
435
|
+
this.string = string;
|
436
|
+
}
|
437
|
+
|
438
|
+
SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
|
439
|
+
return '' + this.string;
|
440
|
+
};
|
441
|
+
|
442
|
+
exports['default'] = SafeString;
|
443
|
+
module.exports = exports['default'];
|
444
|
+
|
445
|
+
/***/ },
|
446
|
+
/* 3 */
|
447
|
+
/***/ function(module, exports, __webpack_require__) {
|
448
|
+
|
449
|
+
'use strict';
|
450
|
+
|
451
|
+
exports.__esModule = true;
|
452
|
+
|
453
|
+
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
|
454
|
+
|
455
|
+
function Exception(message, node) {
|
456
|
+
var loc = node && node.loc,
|
457
|
+
line = undefined,
|
458
|
+
column = undefined;
|
459
|
+
if (loc) {
|
460
|
+
line = loc.start.line;
|
461
|
+
column = loc.start.column;
|
462
|
+
|
463
|
+
message += ' - ' + line + ':' + column;
|
464
|
+
}
|
465
|
+
|
466
|
+
var tmp = Error.prototype.constructor.call(this, message);
|
467
|
+
|
468
|
+
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
|
469
|
+
for (var idx = 0; idx < errorProps.length; idx++) {
|
470
|
+
this[errorProps[idx]] = tmp[errorProps[idx]];
|
471
|
+
}
|
472
|
+
|
473
|
+
if (Error.captureStackTrace) {
|
474
|
+
Error.captureStackTrace(this, Exception);
|
475
|
+
}
|
476
|
+
|
477
|
+
if (loc) {
|
478
|
+
this.lineNumber = line;
|
479
|
+
this.column = column;
|
480
|
+
}
|
481
|
+
}
|
482
|
+
|
483
|
+
Exception.prototype = new Error();
|
484
|
+
|
485
|
+
exports['default'] = Exception;
|
486
|
+
module.exports = exports['default'];
|
487
|
+
|
488
|
+
/***/ },
|
489
|
+
/* 4 */
|
490
|
+
/***/ function(module, exports, __webpack_require__) {
|
491
|
+
|
492
|
+
'use strict';
|
493
|
+
|
494
|
+
exports.__esModule = true;
|
495
|
+
exports.extend = extend;
|
496
|
+
|
497
|
+
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
|
498
|
+
exports.indexOf = indexOf;
|
499
|
+
exports.escapeExpression = escapeExpression;
|
500
|
+
exports.isEmpty = isEmpty;
|
501
|
+
exports.blockParams = blockParams;
|
502
|
+
exports.appendContextPath = appendContextPath;
|
503
|
+
var escape = {
|
504
|
+
'&': '&',
|
505
|
+
'<': '<',
|
506
|
+
'>': '>',
|
507
|
+
'"': '"',
|
508
|
+
'\'': ''',
|
509
|
+
'`': '`'
|
510
|
+
};
|
511
|
+
|
512
|
+
var badChars = /[&<>"'`]/g,
|
513
|
+
possible = /[&<>"'`]/;
|
514
|
+
|
515
|
+
function escapeChar(chr) {
|
516
|
+
return escape[chr];
|
517
|
+
}
|
518
|
+
|
519
|
+
function extend(obj /* , ...source */) {
|
520
|
+
for (var i = 1; i < arguments.length; i++) {
|
521
|
+
for (var key in arguments[i]) {
|
522
|
+
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
|
523
|
+
obj[key] = arguments[i][key];
|
524
|
+
}
|
525
|
+
}
|
526
|
+
}
|
527
|
+
|
528
|
+
return obj;
|
529
|
+
}
|
530
|
+
|
531
|
+
var toString = Object.prototype.toString;
|
532
|
+
|
533
|
+
exports.toString = toString;
|
534
|
+
// Sourced from lodash
|
535
|
+
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
|
536
|
+
/*eslint-disable func-style, no-var */
|
537
|
+
var isFunction = function isFunction(value) {
|
538
|
+
return typeof value === 'function';
|
539
|
+
};
|
540
|
+
// fallback for older versions of Chrome and Safari
|
541
|
+
/* istanbul ignore next */
|
542
|
+
if (isFunction(/x/)) {
|
543
|
+
exports.isFunction = isFunction = function (value) {
|
544
|
+
return typeof value === 'function' && toString.call(value) === '[object Function]';
|
545
|
+
};
|
546
|
+
}
|
547
|
+
var isFunction;
|
548
|
+
exports.isFunction = isFunction;
|
549
|
+
/*eslint-enable func-style, no-var */
|
550
|
+
|
551
|
+
/* istanbul ignore next */
|
552
|
+
var isArray = Array.isArray || function (value) {
|
553
|
+
return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
|
554
|
+
};exports.isArray = isArray;
|
555
|
+
|
556
|
+
function indexOf(array, value) {
|
557
|
+
for (var i = 0, len = array.length; i < len; i++) {
|
558
|
+
if (array[i] === value) {
|
559
|
+
return i;
|
560
|
+
}
|
561
|
+
}
|
562
|
+
return -1;
|
563
|
+
}
|
564
|
+
|
565
|
+
function escapeExpression(string) {
|
566
|
+
if (typeof string !== 'string') {
|
567
|
+
// don't escape SafeStrings, since they're already safe
|
568
|
+
if (string && string.toHTML) {
|
569
|
+
return string.toHTML();
|
570
|
+
} else if (string == null) {
|
571
|
+
return '';
|
572
|
+
} else if (!string) {
|
573
|
+
return string + '';
|
574
|
+
}
|
575
|
+
|
576
|
+
// Force a string conversion as this will be done by the append regardless and
|
577
|
+
// the regex test will do this transparently behind the scenes, causing issues if
|
578
|
+
// an object's to string has escaped characters in it.
|
579
|
+
string = '' + string;
|
580
|
+
}
|
581
|
+
|
582
|
+
if (!possible.test(string)) {
|
583
|
+
return string;
|
584
|
+
}
|
585
|
+
return string.replace(badChars, escapeChar);
|
586
|
+
}
|
587
|
+
|
588
|
+
function isEmpty(value) {
|
589
|
+
if (!value && value !== 0) {
|
590
|
+
return true;
|
591
|
+
} else if (isArray(value) && value.length === 0) {
|
592
|
+
return true;
|
593
|
+
} else {
|
594
|
+
return false;
|
595
|
+
}
|
596
|
+
}
|
597
|
+
|
598
|
+
function blockParams(params, ids) {
|
599
|
+
params.path = ids;
|
600
|
+
return params;
|
601
|
+
}
|
602
|
+
|
603
|
+
function appendContextPath(contextPath, id) {
|
604
|
+
return (contextPath ? contextPath + '.' : '') + id;
|
605
|
+
}
|
606
|
+
|
607
|
+
/***/ },
|
608
|
+
/* 5 */
|
609
|
+
/***/ function(module, exports, __webpack_require__) {
|
610
|
+
|
611
|
+
'use strict';
|
612
|
+
|
613
|
+
var _interopRequireWildcard = __webpack_require__(7)['default'];
|
614
|
+
|
615
|
+
var _interopRequireDefault = __webpack_require__(8)['default'];
|
616
|
+
|
617
|
+
exports.__esModule = true;
|
618
|
+
exports.checkRevision = checkRevision;
|
619
|
+
|
620
|
+
// TODO: Remove this line and break up compilePartial
|
621
|
+
|
622
|
+
exports.template = template;
|
623
|
+
exports.wrapProgram = wrapProgram;
|
624
|
+
exports.resolvePartial = resolvePartial;
|
625
|
+
exports.invokePartial = invokePartial;
|
626
|
+
exports.noop = noop;
|
627
|
+
|
628
|
+
var _import = __webpack_require__(4);
|
629
|
+
|
630
|
+
var Utils = _interopRequireWildcard(_import);
|
631
|
+
|
632
|
+
var _Exception = __webpack_require__(3);
|
633
|
+
|
634
|
+
var _Exception2 = _interopRequireDefault(_Exception);
|
635
|
+
|
636
|
+
var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(1);
|
637
|
+
|
638
|
+
function checkRevision(compilerInfo) {
|
639
|
+
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
|
640
|
+
currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION;
|
641
|
+
|
642
|
+
if (compilerRevision !== currentRevision) {
|
643
|
+
if (compilerRevision < currentRevision) {
|
644
|
+
var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision],
|
645
|
+
compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision];
|
646
|
+
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 + ').');
|
647
|
+
} else {
|
648
|
+
// Use the embedded version info since the runtime doesn't know about this revision yet
|
649
|
+
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] + ').');
|
650
|
+
}
|
651
|
+
}
|
652
|
+
}
|
653
|
+
|
654
|
+
function template(templateSpec, env) {
|
655
|
+
/* istanbul ignore next */
|
656
|
+
if (!env) {
|
657
|
+
throw new _Exception2['default']('No environment passed to template');
|
658
|
+
}
|
659
|
+
if (!templateSpec || !templateSpec.main) {
|
660
|
+
throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec);
|
661
|
+
}
|
662
|
+
|
663
|
+
// Note: Using env.VM references rather than local var references throughout this section to allow
|
664
|
+
// for external users to override these as psuedo-supported APIs.
|
665
|
+
env.VM.checkRevision(templateSpec.compiler);
|
666
|
+
|
667
|
+
function invokePartialWrapper(partial, context, options) {
|
668
|
+
if (options.hash) {
|
669
|
+
context = Utils.extend({}, context, options.hash);
|
670
|
+
}
|
671
|
+
|
672
|
+
partial = env.VM.resolvePartial.call(this, partial, context, options);
|
673
|
+
var result = env.VM.invokePartial.call(this, partial, context, options);
|
674
|
+
|
675
|
+
if (result == null && env.compile) {
|
676
|
+
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
|
677
|
+
result = options.partials[options.name](context, options);
|
678
|
+
}
|
679
|
+
if (result != null) {
|
680
|
+
if (options.indent) {
|
681
|
+
var lines = result.split('\n');
|
682
|
+
for (var i = 0, l = lines.length; i < l; i++) {
|
683
|
+
if (!lines[i] && i + 1 === l) {
|
684
|
+
break;
|
685
|
+
}
|
686
|
+
|
687
|
+
lines[i] = options.indent + lines[i];
|
688
|
+
}
|
689
|
+
result = lines.join('\n');
|
690
|
+
}
|
691
|
+
return result;
|
692
|
+
} else {
|
693
|
+
throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
|
694
|
+
}
|
695
|
+
}
|
696
|
+
|
697
|
+
// Just add water
|
698
|
+
var container = {
|
699
|
+
strict: function strict(obj, name) {
|
700
|
+
if (!(name in obj)) {
|
701
|
+
throw new _Exception2['default']('"' + name + '" not defined in ' + obj);
|
702
|
+
}
|
703
|
+
return obj[name];
|
704
|
+
},
|
705
|
+
lookup: function lookup(depths, name) {
|
706
|
+
var len = depths.length;
|
707
|
+
for (var i = 0; i < len; i++) {
|
708
|
+
if (depths[i] && depths[i][name] != null) {
|
709
|
+
return depths[i][name];
|
710
|
+
}
|
711
|
+
}
|
712
|
+
},
|
713
|
+
lambda: function lambda(current, context) {
|
714
|
+
return typeof current === 'function' ? current.call(context) : current;
|
715
|
+
},
|
716
|
+
|
717
|
+
escapeExpression: Utils.escapeExpression,
|
718
|
+
invokePartial: invokePartialWrapper,
|
719
|
+
|
720
|
+
fn: function fn(i) {
|
721
|
+
return templateSpec[i];
|
722
|
+
},
|
723
|
+
|
724
|
+
programs: [],
|
725
|
+
program: function program(i, data, declaredBlockParams, blockParams, depths) {
|
726
|
+
var programWrapper = this.programs[i],
|
727
|
+
fn = this.fn(i);
|
728
|
+
if (data || depths || blockParams || declaredBlockParams) {
|
729
|
+
programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
|
730
|
+
} else if (!programWrapper) {
|
731
|
+
programWrapper = this.programs[i] = wrapProgram(this, i, fn);
|
732
|
+
}
|
733
|
+
return programWrapper;
|
734
|
+
},
|
735
|
+
|
736
|
+
data: function data(value, depth) {
|
737
|
+
while (value && depth--) {
|
738
|
+
value = value._parent;
|
739
|
+
}
|
740
|
+
return value;
|
741
|
+
},
|
742
|
+
merge: function merge(param, common) {
|
743
|
+
var obj = param || common;
|
744
|
+
|
745
|
+
if (param && common && param !== common) {
|
746
|
+
obj = Utils.extend({}, common, param);
|
747
|
+
}
|
748
|
+
|
749
|
+
return obj;
|
750
|
+
},
|
751
|
+
|
752
|
+
noop: env.VM.noop,
|
753
|
+
compilerInfo: templateSpec.compiler
|
754
|
+
};
|
755
|
+
|
756
|
+
function ret(context) {
|
757
|
+
var options = arguments[1] === undefined ? {} : arguments[1];
|
758
|
+
|
759
|
+
var data = options.data;
|
760
|
+
|
761
|
+
ret._setup(options);
|
762
|
+
if (!options.partial && templateSpec.useData) {
|
763
|
+
data = initData(context, data);
|
764
|
+
}
|
765
|
+
var depths = undefined,
|
766
|
+
blockParams = templateSpec.useBlockParams ? [] : undefined;
|
767
|
+
if (templateSpec.useDepths) {
|
768
|
+
depths = options.depths ? [context].concat(options.depths) : [context];
|
769
|
+
}
|
770
|
+
|
771
|
+
return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
|
772
|
+
}
|
773
|
+
ret.isTop = true;
|
774
|
+
|
775
|
+
ret._setup = function (options) {
|
776
|
+
if (!options.partial) {
|
777
|
+
container.helpers = container.merge(options.helpers, env.helpers);
|
778
|
+
|
779
|
+
if (templateSpec.usePartial) {
|
780
|
+
container.partials = container.merge(options.partials, env.partials);
|
781
|
+
}
|
782
|
+
} else {
|
783
|
+
container.helpers = options.helpers;
|
784
|
+
container.partials = options.partials;
|
785
|
+
}
|
786
|
+
};
|
787
|
+
|
788
|
+
ret._child = function (i, data, blockParams, depths) {
|
789
|
+
if (templateSpec.useBlockParams && !blockParams) {
|
790
|
+
throw new _Exception2['default']('must pass block params');
|
791
|
+
}
|
792
|
+
if (templateSpec.useDepths && !depths) {
|
793
|
+
throw new _Exception2['default']('must pass parent depths');
|
794
|
+
}
|
795
|
+
|
796
|
+
return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
|
797
|
+
};
|
798
|
+
return ret;
|
799
|
+
}
|
800
|
+
|
801
|
+
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
|
802
|
+
function prog(context) {
|
803
|
+
var options = arguments[1] === undefined ? {} : arguments[1];
|
804
|
+
|
805
|
+
return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
|
806
|
+
}
|
807
|
+
prog.program = i;
|
808
|
+
prog.depth = depths ? depths.length : 0;
|
809
|
+
prog.blockParams = declaredBlockParams || 0;
|
810
|
+
return prog;
|
811
|
+
}
|
812
|
+
|
813
|
+
function resolvePartial(partial, context, options) {
|
814
|
+
if (!partial) {
|
815
|
+
partial = options.partials[options.name];
|
816
|
+
} else if (!partial.call && !options.name) {
|
817
|
+
// This is a dynamic partial that returned a string
|
818
|
+
options.name = partial;
|
819
|
+
partial = options.partials[partial];
|
820
|
+
}
|
821
|
+
return partial;
|
822
|
+
}
|
823
|
+
|
824
|
+
function invokePartial(partial, context, options) {
|
825
|
+
options.partial = true;
|
826
|
+
|
827
|
+
if (partial === undefined) {
|
828
|
+
throw new _Exception2['default']('The partial ' + options.name + ' could not be found');
|
829
|
+
} else if (partial instanceof Function) {
|
830
|
+
return partial(context, options);
|
831
|
+
}
|
832
|
+
}
|
833
|
+
|
834
|
+
function noop() {
|
835
|
+
return '';
|
836
|
+
}
|
837
|
+
|
838
|
+
function initData(context, data) {
|
839
|
+
if (!data || !('root' in data)) {
|
840
|
+
data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {};
|
841
|
+
data.root = context;
|
842
|
+
}
|
843
|
+
return data;
|
844
|
+
}
|
845
|
+
|
846
|
+
/***/ },
|
847
|
+
/* 6 */
|
848
|
+
/***/ function(module, exports, __webpack_require__) {
|
849
|
+
|
850
|
+
/* WEBPACK VAR INJECTION */(function(global) {'use strict';
|
851
|
+
|
852
|
+
exports.__esModule = true;
|
853
|
+
/*global window */
|
854
|
+
|
855
|
+
exports['default'] = function (Handlebars) {
|
856
|
+
/* istanbul ignore next */
|
857
|
+
var root = typeof global !== 'undefined' ? global : window,
|
858
|
+
$Handlebars = root.Handlebars;
|
859
|
+
/* istanbul ignore next */
|
860
|
+
Handlebars.noConflict = function () {
|
861
|
+
if (root.Handlebars === Handlebars) {
|
862
|
+
root.Handlebars = $Handlebars;
|
863
|
+
}
|
864
|
+
};
|
865
|
+
};
|
866
|
+
|
867
|
+
module.exports = exports['default'];
|
868
|
+
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
869
|
+
|
870
|
+
/***/ },
|
871
|
+
/* 7 */
|
872
|
+
/***/ function(module, exports, __webpack_require__) {
|
873
|
+
|
874
|
+
"use strict";
|
875
|
+
|
876
|
+
exports["default"] = function (obj) {
|
877
|
+
if (obj && obj.__esModule) {
|
878
|
+
return obj;
|
879
|
+
} else {
|
880
|
+
var newObj = {};
|
881
|
+
|
882
|
+
if (typeof obj === "object" && obj !== null) {
|
883
|
+
for (var key in obj) {
|
884
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
|
885
|
+
}
|
886
|
+
}
|
887
|
+
|
888
|
+
newObj["default"] = obj;
|
889
|
+
return newObj;
|
890
|
+
}
|
891
|
+
};
|
892
|
+
|
893
|
+
exports.__esModule = true;
|
894
|
+
|
895
|
+
/***/ },
|
896
|
+
/* 8 */
|
897
|
+
/***/ function(module, exports, __webpack_require__) {
|
898
|
+
|
899
|
+
"use strict";
|
900
|
+
|
901
|
+
exports["default"] = function (obj) {
|
902
|
+
return obj && obj.__esModule ? obj : {
|
903
|
+
"default": obj
|
904
|
+
};
|
905
|
+
};
|
906
|
+
|
907
|
+
exports.__esModule = true;
|
908
|
+
|
909
|
+
/***/ }
|
910
|
+
/******/ ])
|
911
|
+
});
|
912
|
+
;
|