بۇ قوليازمىنى بىۋاسىتە قاچىلاشقا بولمايدۇ. بۇ باشقا قوليازمىلارنىڭ ئىشلىتىشى ئۈچۈن تەمىنلەنگەن ئامبار بولۇپ، ئىشلىتىش ئۈچۈن مېتا كۆرسەتمىسىگە قىستۇرىدىغان كود: // @require https://update.greasyfork.org/scripts/440537/1021756/nunjucks.js
/*! Browser bundle of nunjucks 2.4.2 */
var nunjucks = function (e) {
function t(i) {
if (n[i]) return n[i].exports;
var r = n[i] = {exports: {}, id: i, loaded: !1};
return e[i].call(r.exports, r, r.exports, t), r.loaded = !0, r.exports
}
var n = {};
return t.m = e, t.c = n, t.p = "", t(0)
}([function (e, t, n) {
"use strict";
var i = n(1), r = n(2), s = n(15), o = n(14), a = n(3);
e.exports = {}, e.exports.Environment = r.Environment, e.exports.Template = r.Template, e.exports.Loader = s, e.exports.FileSystemLoader = o.FileSystemLoader, e.exports.PrecompiledLoader = o.PrecompiledLoader, e.exports.WebLoader = o.WebLoader, e.exports.compiler = n(7), e.exports.parser = n(8), e.exports.lexer = n(9), e.exports.runtime = n(12), e.exports.lib = i, e.exports.nodes = n(10), e.exports.installJinjaCompat = n(18);
var l;
e.exports.configure = function (e, t) {
t = t || {}, i.isObject(e) && (t = e, e = null);
var n;
return o.FileSystemLoader ? n = new o.FileSystemLoader(e, {
watch: t.watch,
noCache: t.noCache
}) : o.WebLoader && (n = new o.WebLoader(e, {
useCache: t.web && t.web.useCache,
async: t.web && t.web.async
})), l = new r.Environment(n, t), t && t.express && l.express(t.express), l
}, e.exports.compile = function (t, n, i, r) {
return l || e.exports.configure(), new e.exports.Template(t, n, i, r)
}, e.exports.render = function (t, n, i) {
return l || e.exports.configure(), l.render(t, n, i)
}, e.exports.renderString = function (t, n, i) {
return l || e.exports.configure(), l.renderString(t, n, i)
}, a && (e.exports.precompile = a.precompile, e.exports.precompileString = a.precompileString)
}, function (e, t) {
"use strict";
var n = Array.prototype, i = Object.prototype,
r = {"&": "&", '"': """, "'": "'", "<": "<", ">": ">"}, s = /[&"'<>]/g, o = function (e) {
return r[e]
}, t = e.exports = {};
t.prettifyError = function (e, n, i) {
if (i.Update || (i = new t.TemplateError(i)), i.Update(e), !n) {
var r = i;
i = new Error(r.message), i.name = r.name
}
return i
}, t.TemplateError = function (e, t, n) {
var i = this;
if (e instanceof Error) {
i = e, e = e.name + ": " + e.message;
try {
i.name = ""
} catch (r) {
i = this
}
} else Error.captureStackTrace && Error.captureStackTrace(i);
return i.name = "Template render error", i.message = e, i.lineno = t, i.colno = n, i.firstUpdate = !0, i.Update = function (e) {
var t = "(" + (e || "unknown path") + ")";
return this.firstUpdate && (this.lineno && this.colno ? t += " [Line " + this.lineno + ", Column " + this.colno + "]" : this.lineno && (t += " [Line " + this.lineno + "]")), t += "\n ", this.firstUpdate && (t += " "), this.message = t + (this.message || ""), this.firstUpdate = !1, this
}, i
}, t.TemplateError.prototype = Error.prototype, t.escape = function (e) {
return e.replace(s, o)
}, t.isFunction = function (e) {
return "[object Function]" === i.toString.call(e)
}, t.isArray = Array.isArray || function (e) {
return "[object Array]" === i.toString.call(e)
}, t.isString = function (e) {
return "[object String]" === i.toString.call(e)
}, t.isObject = function (e) {
return "[object Object]" === i.toString.call(e)
}, t.groupBy = function (e, n) {
for (var i = {}, r = t.isFunction(n) ? n : function (e) {
return e[n]
}, s = 0; s < e.length; s++) {
var o = e[s], a = r(o, s);
(i[a] || (i[a] = [])).push(o)
}
return i
}, t.toArray = function (e) {
return Array.prototype.slice.call(e)
}, t.without = function (e) {
var n = [];
if (!e) return n;
for (var i = -1, r = e.length, s = t.toArray(arguments).slice(1); ++i < r;) -1 === t.indexOf(s, e[i]) && n.push(e[i]);
return n
}, t.extend = function (e, t) {
for (var n in t) e[n] = t[n];
return e
}, t.repeat = function (e, t) {
for (var n = "", i = 0; t > i; i++) n += e;
return n
}, t.each = function (e, t, i) {
if (null != e) if (n.each && e.each === n.each) e.forEach(t, i); else if (e.length === +e.length) for (var r = 0, s = e.length; s > r; r++) t.call(i, e[r], r, e)
}, t.map = function (e, t) {
var i = [];
if (null == e) return i;
if (n.map && e.map === n.map) return e.map(t);
for (var r = 0; r < e.length; r++) i[i.length] = t(e[r], r);
return e.length === +e.length && (i.length = e.length), i
}, t.asyncIter = function (e, t, n) {
function i() {
r++, r < e.length ? t(e[r], r, i, n) : n()
}
var r = -1;
i()
}, t.asyncFor = function (e, n, i) {
function r() {
a++;
var t = s[a];
o > a ? n(t, e[t], a, o, r) : i()
}
var s = t.keys(e), o = s.length, a = -1;
r()
}, t.indexOf = Array.prototype.indexOf ? function (e, t, n) {
return Array.prototype.indexOf.call(e, t, n)
} : function (e, t, n) {
var i = this.length >>> 0;
for (n = +n || 0, Math.abs(n) === 1 / 0 && (n = 0), 0 > n && (n += i, 0 > n && (n = 0)); i > n; n++) if (e[n] === t) return n;
return -1
}, Array.prototype.map || (Array.prototype.map = function () {
throw new Error("map is unimplemented for this js engine")
}), t.keys = function (e) {
if (Object.prototype.keys) return e.keys();
var t = [];
for (var n in e) e.hasOwnProperty(n) && t.push(n);
return t
}, t.inOperator = function (e, n) {
if (t.isArray(n)) return -1 !== t.indexOf(n, e);
if (t.isObject(n)) return e in n;
if (t.isString(n)) return -1 !== n.indexOf(e);
throw new Error('Cannot use "in" operator to search for "' + e + '" in unexpected types.')
}
}, function (e, t, n) {
"use strict";
function i(e, t, n) {
o(function () {
e(t, n)
})
}
var r, s = n(3), o = n(4), a = n(1), l = n(6), c = n(7), h = n(13), u = n(14), p = n(12), f = n(17), m = p.Frame;
u.PrecompiledLoader = n(16);
var d = l.extend({
init: function (e, t) {
t = this.opts = t || {}, this.opts.dev = !!t.dev, this.opts.autoescape = null != t.autoescape ? t.autoescape : !0, this.opts.throwOnUndefined = !!t.throwOnUndefined, this.opts.trimBlocks = !!t.trimBlocks, this.opts.lstripBlocks = !!t.lstripBlocks, this.loaders = [], e ? this.loaders = a.isArray(e) ? e : [e] : u.FileSystemLoader ? this.loaders = [new u.FileSystemLoader("views")] : u.WebLoader && (this.loaders = [new u.WebLoader("/views")]), window.nunjucksPrecompiled && this.loaders.unshift(new u.PrecompiledLoader(window.nunjucksPrecompiled)), this.initCache(), this.globals = f(), this.filters = {}, this.asyncFilters = [], this.extensions = {}, this.extensionsList = [];
for (var n in h) this.addFilter(n, h[n])
}, initCache: function () {
a.each(this.loaders, function (e) {
e.cache = {}, "function" == typeof e.on && e.on("update", function (t) {
e.cache[t] = null
})
})
}, addExtension: function (e, t) {
return t._name = e, this.extensions[e] = t, this.extensionsList.push(t), this
}, removeExtension: function (e) {
var t = this.getExtension(e);
t && (this.extensionsList = a.without(this.extensionsList, t), delete this.extensions[e])
}, getExtension: function (e) {
return this.extensions[e]
}, hasExtension: function (e) {
return !!this.extensions[e]
}, addGlobal: function (e, t) {
return this.globals[e] = t, this
}, getGlobal: function (e) {
if ("undefined" == typeof this.globals[e]) throw new Error("global not found: " + e);
return this.globals[e]
}, addFilter: function (e, t, n) {
var i = t;
return n && this.asyncFilters.push(e), this.filters[e] = i, this
}, getFilter: function (e) {
if (!this.filters[e]) throw new Error("filter not found: " + e);
return this.filters[e]
}, resolveTemplate: function (e, t, n) {
var i = e.isRelative && t ? e.isRelative(n) : !1;
return i && e.resolve ? e.resolve(t, n) : n
}, getTemplate: function (e, t, n, i, s) {
var o = this, l = null;
if (e && e.raw && (e = e.raw), a.isFunction(n) && (s = n, n = null, t = t || !1), a.isFunction(t) && (s = t, t = !1), e instanceof r) l = e; else {
if ("string" != typeof e) throw new Error("template names must be a string: " + e);
for (var c = 0; c < this.loaders.length; c++) {
var h = this.resolveTemplate(this.loaders[c], n, e);
if (l = this.loaders[c].cache[h]) break
}
}
if (!l) {
var u, p = this, f = function (n, o) {
if (o || n || i || (n = new Error("template not found: " + e)), n) {
if (!s) throw n;
s(n)
} else {
var a;
o ? (a = new r(o.src, p, o.path, t), o.noCache || (o.loader.cache[e] = a)) : a = new r("", p, "", t), s ? s(null, a) : u = a
}
};
return a.asyncIter(this.loaders, function (t, i, r, s) {
function a(e, n) {
e ? s(e) : n ? (n.loader = t, s(null, n)) : r()
}
e = o.resolveTemplate(t, n, e), t.async ? t.getSource(e, a) : a(null, t.getSource(e))
}, f), u
}
return t && l.compile(), s ? void s(null, l) : l
}, express: function (e) {
function t(e, t) {
if (this.name = e, this.path = e, this.defaultEngine = t.defaultEngine, this.ext = s.extname(e), !this.ext && !this.defaultEngine) throw new Error("No default engine was specified and no extension was provided.");
this.ext || (this.name += this.ext = ("." !== this.defaultEngine[0] ? "." : "") + this.defaultEngine)
}
var n = this;
return t.prototype.render = function (e, t) {
n.render(this.name, e, t)
}, e.set("view", t), this
}, render: function (e, t, n) {
a.isFunction(t) && (n = t, t = null);
var r = null;
return this.getTemplate(e, function (e, s) {
if (e && n) i(n, e); else {
if (e) throw e;
r = s.render(t, n)
}
}), r
}, renderString: function (e, t, n, i) {
a.isFunction(n) && (i = n, n = {}), n = n || {};
var s = new r(e, this, n.path);
return s.render(t, i)
}
}), v = l.extend({
init: function (e, t, n) {
this.env = n || new d, this.ctx = {};
for (var i in e) e.hasOwnProperty(i) && (this.ctx[i] = e[i]);
this.blocks = {}, this.exported = [];
for (var r in t) this.addBlock(r, t[r])
}, lookup: function (e) {
return e in this.env.globals && !(e in this.ctx) ? this.env.globals[e] : this.ctx[e]
}, setVariable: function (e, t) {
this.ctx[e] = t
}, getVariables: function () {
return this.ctx
}, addBlock: function (e, t) {
return this.blocks[e] = this.blocks[e] || [], this.blocks[e].push(t), this
}, getBlock: function (e) {
if (!this.blocks[e]) throw new Error('unknown block "' + e + '"');
return this.blocks[e][0]
}, getSuper: function (e, t, n, i, r, s) {
var o = a.indexOf(this.blocks[t] || [], n), l = this.blocks[t][o + 1], c = this;
if (-1 === o || !l) throw new Error('no super block available for "' + t + '"');
l(e, c, i, r, s)
}, addExport: function (e) {
this.exported.push(e)
}, getExported: function () {
for (var e = {}, t = 0; t < this.exported.length; t++) {
var n = this.exported[t];
e[n] = this.ctx[n]
}
return e
}
});
r = l.extend({
init: function (e, t, n, i) {
if (this.env = t || new d, a.isObject(e)) switch (e.type) {
case"code":
this.tmplProps = e.obj;
break;
case"string":
this.tmplStr = e.obj
} else {
if (!a.isString(e)) throw new Error("src must be a string or an object describing the source");
this.tmplStr = e
}
if (this.path = n, i) {
var r = this;
try {
r._compile()
} catch (s) {
throw a.prettifyError(this.path, this.env.opts.dev, s)
}
} else this.compiled = !1
}, render: function (e, t, n) {
"function" == typeof e ? (n = e, e = {}) : "function" == typeof t && (n = t, t = null);
var r = !0;
t && (r = !1);
var s = this;
try {
s.compile()
} catch (o) {
var l = a.prettifyError(this.path, this.env.opts.dev, o);
if (n) return i(n, l);
throw l
}
var c = new v(e || {}, s.blocks, s.env), h = t ? t.push(!0) : new m;
h.topLevel = !0;
var u = null;
return s.rootRenderFunc(s.env, c, h || new m, p, function (e, t) {
if (e && (e = a.prettifyError(s.path, s.env.opts.dev, e)), n) r ? i(n, e, t) : n(e, t); else {
if (e) throw e;
u = t
}
}), u
}, getExported: function (e, t, n) {
"function" == typeof e && (n = e, e = {}), "function" == typeof t && (n = t, t = null);
try {
this.compile()
} catch (i) {
if (n) return n(i);
throw i
}
var r = t ? t.push() : new m;
r.topLevel = !0;
var s = new v(e || {}, this.blocks, this.env);
this.rootRenderFunc(this.env, s, r, p, function (e) {
e ? n(e, null) : n(null, s.getExported())
})
}, compile: function () {
this.compiled || this._compile()
}, _compile: function () {
var e;
if (this.tmplProps) e = this.tmplProps; else {
var t = c.compile(this.tmplStr, this.env.asyncFilters, this.env.extensionsList, this.path, this.env.opts),
n = new Function(t);
e = n()
}
this.blocks = this._getBlocks(e), this.rootRenderFunc = e.root, this.compiled = !0
}, _getBlocks: function (e) {
var t = {};
for (var n in e) "b_" === n.slice(0, 2) && (t[n.slice(2)] = e[n]);
return t
}
}), e.exports = {Environment: d, Template: r}
}, function (e, t) {
}, function (e, t, n) {
"use strict";
function i() {
if (l.length) throw l.shift()
}
function r(e) {
var t;
t = a.length ? a.pop() : new s, t.task = e, o(t)
}
function s() {
this.task = null
}
var o = n(5), a = [], l = [], c = o.makeRequestCallFromTimer(i);
e.exports = r, s.prototype.call = function () {
try {
this.task.call()
} catch (e) {
r.onerror ? r.onerror(e) : (l.push(e), c())
} finally {
this.task = null, a[a.length] = this
}
}
}, function (e, t) {
(function (t) {
"use strict";
function n(e) {
a.length || (o(), l = !0), a[a.length] = e
}
function i() {
for (; c < a.length;) {
var e = c;
if (c += 1, a[e].call(), c > h) {
for (var t = 0, n = a.length - c; n > t; t++) a[t] = a[t + c];
a.length -= c, c = 0
}
}
a.length = 0, c = 0, l = !1
}
function r(e) {
var t = 1, n = new u(e), i = document.createTextNode("");
return n.observe(i, {characterData: !0}), function () {
t = -t, i.data = t
}
}
function s(e) {
return function () {
function t() {
clearTimeout(n), clearInterval(i), e()
}
var n = setTimeout(t, 0), i = setInterval(t, 50)
}
}
e.exports = n;
var o, a = [], l = !1, c = 0, h = 1024, u = t.MutationObserver || t.WebKitMutationObserver;
o = "function" == typeof u ? r(i) : s(i), n.requestFlush = o, n.makeRequestCallFromTimer = s
}).call(t, function () {
return this
}())
}, function (e, t) {
"use strict";
function n(e, t, i) {
var r = function () {
};
r.prototype = e.prototype;
var s = new r, o = /xyz/.test(function () {
xyz
}) ? /\bparent\b/ : /.*/;
i = i || {};
for (var a in i) {
var l = i[a], c = s[a];
"function" == typeof c && "function" == typeof l && o.test(l) ? s[a] = function (e, t) {
return function () {
var n = this.parent;
this.parent = t;
var i = e.apply(this, arguments);
return this.parent = n, i
}
}(l, c) : s[a] = l
}
s.typename = t;
var h = function () {
s.init && s.init.apply(this, arguments)
};
return h.prototype = s, h.prototype.constructor = h, h.extend = function (e, t) {
return "object" == typeof e && (t = e, e = "anonymous"), n(h, e, t)
}, h
}
e.exports = n(Object, "Object", {})
}, function (e, t, n) {
"use strict";
function i(e) {
return function (t, n) {
this.compile(t.left, n), this.emit(e), this.compile(t.right, n)
}
}
var r = n(1), s = n(8), o = n(11), a = n(10), l = n(6), c = n(12).Frame,
h = {"==": "==", "!=": "!=", "<": "<", ">": ">", "<=": "<=", ">=": ">="}, u = l.extend({
init: function (e, t) {
this.templateName = e, this.codebuf = [], this.lastId = 0, this.buffer = null, this.bufferStack = [], this.scopeClosers = "", this.inBlock = !1, this.throwOnUndefined = t
},
fail: function (e, t, n) {
throw void 0 !== t && (t += 1), void 0 !== n && (n += 1), new r.TemplateError(e, t, n)
},
pushBufferId: function (e) {
this.bufferStack.push(this.buffer), this.buffer = e, this.emit("var " + this.buffer + ' = "";')
},
popBufferId: function () {
this.buffer = this.bufferStack.pop()
},
emit: function (e) {
this.codebuf.push(e)
},
emitLine: function (e) {
this.emit(e + "\n")
},
emitLines: function () {
r.each(r.toArray(arguments), function (e) {
this.emitLine(e)
}, this)
},
emitFuncBegin: function (e) {
this.buffer = "output", this.scopeClosers = "", this.emitLine("function " + e + "(env, context, frame, runtime, cb) {"), this.emitLine("var lineno = null;"), this.emitLine("var colno = null;"), this.emitLine("var " + this.buffer + ' = "";'), this.emitLine("try {")
},
emitFuncEnd: function (e) {
e || this.emitLine("cb(null, " + this.buffer + ");"), this.closeScopeLevels(), this.emitLine("} catch (e) {"), this.emitLine(" cb(runtime.handleError(e, lineno, colno));"), this.emitLine("}"), this.emitLine("}"), this.buffer = null
},
addScopeLevel: function () {
this.scopeClosers += "})"
},
closeScopeLevels: function () {
this.emitLine(this.scopeClosers + ";"), this.scopeClosers = ""
},
withScopedSyntax: function (e) {
var t = this.scopeClosers;
this.scopeClosers = "", e.call(this), this.closeScopeLevels(), this.scopeClosers = t
},
makeCallback: function (e) {
var t = this.tmpid();
return "function(" + t + (e ? "," + e : "") + ") {\nif(" + t + ") { cb(" + t + "); return; }"
},
tmpid: function () {
return this.lastId++, "t_" + this.lastId
},
_templateName: function () {
return null == this.templateName ? "undefined" : JSON.stringify(this.templateName)
},
_compileChildren: function (e, t) {
for (var n = e.children, i = 0, r = n.length; r > i; i++) this.compile(n[i], t)
},
_compileAggregate: function (e, t, n, i) {
n && this.emit(n);
for (var r = 0; r < e.children.length; r++) r > 0 && this.emit(","), this.compile(e.children[r], t);
i && this.emit(i)
},
_compileExpression: function (e, t) {
this.assertType(e, a.Literal, a.Symbol, a.Group, a.Array, a.Dict, a.FunCall, a.Caller, a.Filter, a.LookupVal, a.Compare, a.InlineIf, a.In, a.And, a.Or, a.Not, a.Add, a.Concat, a.Sub, a.Mul, a.Div, a.FloorDiv, a.Mod, a.Pow, a.Neg, a.Pos, a.Compare, a.NodeList), this.compile(e, t)
},
assertType: function (e) {
for (var t = r.toArray(arguments).slice(1), n = !1, i = 0; i < t.length; i++) e instanceof t[i] && (n = !0);
n || this.fail("assertType: invalid type: " + e.typename, e.lineno, e.colno)
},
compileCallExtension: function (e, t, n) {
var i = e.args, s = e.contentArgs, o = "boolean" == typeof e.autoescape ? e.autoescape : !0;
if (n || this.emit(this.buffer + " += runtime.suppressValue("), this.emit('env.getExtension("' + e.extName + '")["' + e.prop + '"]('), this.emit("context"), (i || s) && this.emit(","), i && (i instanceof a.NodeList || this.fail("compileCallExtension: arguments must be a NodeList, use `parser.parseSignature`"), r.each(i.children, function (e, n) {
this._compileExpression(e, t), (n !== i.children.length - 1 || s.length) && this.emit(",")
}, this)), s.length && r.each(s, function (e, n) {
if (n > 0 && this.emit(","), e) {
var i = this.tmpid();
this.emitLine("function(cb) {"), this.emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}"), this.pushBufferId(i), this.withScopedSyntax(function () {
this.compile(e, t), this.emitLine("cb(null, " + i + ");")
}), this.popBufferId(), this.emitLine("return " + i + ";"), this.emitLine("}")
} else this.emit("null")
}, this), n) {
var l = this.tmpid();
this.emitLine(", " + this.makeCallback(l)), this.emitLine(this.buffer + " += runtime.suppressValue(" + l + ", " + o + " && env.opts.autoescape);"), this.addScopeLevel()
} else this.emit(")"), this.emit(", " + o + " && env.opts.autoescape);\n")
},
compileCallExtensionAsync: function (e, t) {
this.compileCallExtension(e, t, !0)
},
compileNodeList: function (e, t) {
this._compileChildren(e, t)
},
compileLiteral: function (e) {
if ("string" == typeof e.value) {
var t = e.value.replace(/\\/g, "\\\\");
t = t.replace(/"/g, '\\"'), t = t.replace(/\n/g, "\\n"), t = t.replace(/\r/g, "\\r"), t = t.replace(/\t/g, "\\t"), this.emit('"' + t + '"')
} else null === e.value ? this.emit("null") : this.emit(e.value.toString())
},
compileSymbol: function (e, t) {
var n, i = e.value;
(n = t.lookup(i)) ? this.emit(n) : this.emit('runtime.contextOrFrameLookup(context, frame, "' + i + '")')
},
compileGroup: function (e, t) {
this._compileAggregate(e, t, "(", ")")
},
compileArray: function (e, t) {
this._compileAggregate(e, t, "[", "]")
},
compileDict: function (e, t) {
this._compileAggregate(e, t, "{", "}")
},
compilePair: function (e, t) {
var n = e.key, i = e.value;
n instanceof a.Symbol ? n = new a.Literal(n.lineno, n.colno, n.value) : n instanceof a.Literal && "string" == typeof n.value || this.fail("compilePair: Dict keys must be strings or names", n.lineno, n.colno), this.compile(n, t), this.emit(": "), this._compileExpression(i, t)
},
compileInlineIf: function (e, t) {
this.emit("("), this.compile(e.cond, t), this.emit("?"), this.compile(e.body, t), this.emit(":"), null !== e.else_ ? this.compile(e.else_, t) : this.emit('""'), this.emit(")")
},
compileIn: function (e, t) {
this.emit("runtime.inOperator("), this.compile(e.left, t), this.emit(","), this.compile(e.right, t), this.emit(")")
},
compileOr: i(" || "),
compileAnd: i(" && "),
compileAdd: i(" + "),
compileConcat: i(' + "" + '),
compileSub: i(" - "),
compileMul: i(" * "),
compileDiv: i(" / "),
compileMod: i(" % "),
compileNot: function (e, t) {
this.emit("!"), this.compile(e.target, t)
},
compileFloorDiv: function (e, t) {
this.emit("Math.floor("), this.compile(e.left, t), this.emit(" / "), this.compile(e.right, t), this.emit(")")
},
compilePow: function (e, t) {
this.emit("Math.pow("), this.compile(e.left, t), this.emit(", "), this.compile(e.right, t), this.emit(")")
},
compileNeg: function (e, t) {
this.emit("-"), this.compile(e.target, t)
},
compilePos: function (e, t) {
this.emit("+"), this.compile(e.target, t)
},
compileCompare: function (e, t) {
this.compile(e.expr, t);
for (var n = 0; n < e.ops.length; n++) {
var i = e.ops[n];
this.emit(" " + h[i.type] + " "), this.compile(i.expr, t)
}
},
compileLookupVal: function (e, t) {
this.emit("runtime.memberLookup(("), this._compileExpression(e.target, t), this.emit("),"), this._compileExpression(e.val, t), this.emit(")")
},
_getNodeName: function (e) {
switch (e.typename) {
case"Symbol":
return e.value;
case"FunCall":
return "the return value of (" + this._getNodeName(e.name) + ")";
case"LookupVal":
return this._getNodeName(e.target) + '["' + this._getNodeName(e.val) + '"]';
case"Literal":
return e.value.toString();
default:
return "--expression--"
}
},
compileFunCall: function (e, t) {
this.emit("(lineno = " + e.lineno + ", colno = " + e.colno + ", "), this.emit("runtime.callWrap("), this._compileExpression(e.name, t), this.emit(', "' + this._getNodeName(e.name).replace(/"/g, '\\"') + '", context, '), this._compileAggregate(e.args, t, "[", "])"), this.emit(")")
},
compileFilter: function (e, t) {
var n = e.name;
this.assertType(n, a.Symbol), this.emit('env.getFilter("' + n.value + '").call(context, '), this._compileAggregate(e.args, t), this.emit(")")
},
compileFilterAsync: function (e, t) {
var n = e.name;
this.assertType(n, a.Symbol);
var i = e.symbol.value;
t.set(i, i), this.emit('env.getFilter("' + n.value + '").call(context, '), this._compileAggregate(e.args, t), this.emitLine(", " + this.makeCallback(i)), this.addScopeLevel()
},
compileKeywordArgs: function (e, t) {
var n = [];
r.each(e.children, function (e) {
n.push(e.key.value)
}), this.emit("runtime.makeKeywordArgs("), this.compileDict(e, t), this.emit(")")
},
compileSet: function (e, t) {
var n = [];
r.each(e.targets, function (e) {
var i = e.value, r = t.lookup(i);
(null === r || void 0 === r) && (r = this.tmpid(), this.emitLine("var " + r + ";")), n.push(r)
}, this), e.value ? (this.emit(n.join(" = ") + " = "), this._compileExpression(e.value, t), this.emitLine(";")) : (this.emit(n.join(" = ") + " = "), this.compile(e.body, t), this.emitLine(";")), r.each(e.targets, function (e, t) {
var i = n[t], r = e.value;
this.emitLine('frame.set("' + r + '", ' + i + ", true);"), this.emitLine("if(frame.topLevel) {"), this.emitLine('context.setVariable("' + r + '", ' + i + ");"), this.emitLine("}"), "_" !== r.charAt(0) && (this.emitLine("if(frame.topLevel) {"), this.emitLine('context.addExport("' + r + '", ' + i + ");"), this.emitLine("}"))
}, this)
},
compileIf: function (e, t, n) {
this.emit("if("), this._compileExpression(e.cond, t), this.emitLine(") {"), this.withScopedSyntax(function () {
this.compile(e.body, t), n && this.emit("cb()")
}), e.else_ ? (this.emitLine("}\nelse {"), this.withScopedSyntax(function () {
this.compile(e.else_, t), n && this.emit("cb()")
})) : n && (this.emitLine("}\nelse {"), this.emit("cb()")), this.emitLine("}")
},
compileIfAsync: function (e, t) {
this.emit("(function(cb) {"), this.compileIf(e, t, !0), this.emit("})(" + this.makeCallback()), this.addScopeLevel()
},
emitLoopBindings: function (e, t, n, i) {
var r = {
index: n + " + 1",
index0: n,
revindex: i + " - " + n,
revindex0: i + " - " + n + " - 1",
first: n + " === 0",
last: n + " === " + i + " - 1",
length: i
};
for (var s in r) this.emitLine('frame.set("loop.' + s + '", ' + r[s] + ");")
},
compileFor: function (e, t) {
var n, i = this.tmpid(), r = this.tmpid(), s = this.tmpid();
if (t = t.push(), this.emitLine("frame = frame.push();"), this.emit("var " + s + " = "), this._compileExpression(e.arr, t), this.emitLine(";"), this.emit("if(" + s + ") {"), e.name instanceof a.Array) {
this.emitLine("var " + i + ";"), this.emitLine("if(runtime.isArray(" + s + ")) {"), this.emitLine("var " + r + " = " + s + ".length;"), this.emitLine("for(" + i + "=0; " + i + " < " + s + ".length; " + i + "++) {");
for (var o = 0; o < e.name.children.length; o++) {
var l = this.tmpid();
this.emitLine("var " + l + " = " + s + "[" + i + "][" + o + "]"), this.emitLine('frame.set("' + e.name.children[o].value + '", ' + s + "[" + i + "][" + o + "]);"), t.set(e.name.children[o].value, l)
}
this.emitLoopBindings(e, s, i, r), this.withScopedSyntax(function () {
this.compile(e.body, t)
}), this.emitLine("}"), this.emitLine("} else {");
var c = e.name.children[0], h = e.name.children[1], u = this.tmpid();
n = this.tmpid(), t.set(c.value, u), t.set(h.value, n), this.emitLine(i + " = -1;"), this.emitLine("var " + r + " = runtime.keys(" + s + ").length;"), this.emitLine("for(var " + u + " in " + s + ") {"), this.emitLine(i + "++;"), this.emitLine("var " + n + " = " + s + "[" + u + "];"), this.emitLine('frame.set("' + c.value + '", ' + u + ");"), this.emitLine('frame.set("' + h.value + '", ' + n + ");"), this.emitLoopBindings(e, s, i, r), this.withScopedSyntax(function () {
this.compile(e.body, t)
}), this.emitLine("}"), this.emitLine("}")
} else n = this.tmpid(), t.set(e.name.value, n), this.emitLine("var " + r + " = " + s + ".length;"), this.emitLine("for(var " + i + "=0; " + i + " < " + s + ".length; " + i + "++) {"), this.emitLine("var " + n + " = " + s + "[" + i + "];"), this.emitLine('frame.set("' + e.name.value + '", ' + n + ");"), this.emitLoopBindings(e, s, i, r), this.withScopedSyntax(function () {
this.compile(e.body, t)
}), this.emitLine("}");
this.emitLine("}"), e.else_ && (this.emitLine("if (!" + r + ") {"), this.compile(e.else_, t), this.emitLine("}")), this.emitLine("frame = frame.pop();")
},
_compileAsyncLoop: function (e, t, n) {
var i = this.tmpid(), s = this.tmpid(), o = this.tmpid(), l = n ? "asyncAll" : "asyncEach";
if (t = t.push(), this.emitLine("frame = frame.push();"), this.emit("var " + o + " = "), this._compileExpression(e.arr, t), this.emitLine(";"), e.name instanceof a.Array) this.emit("runtime." + l + "(" + o + ", " + e.name.children.length + ", function("), r.each(e.name.children, function (e) {
this.emit(e.value + ",")
}, this), this.emit(i + "," + s + ",next) {"), r.each(e.name.children, function (e) {
var n = e.value;
t.set(n, n), this.emitLine('frame.set("' + n + '", ' + n + ");")
}, this); else {
var c = e.name.value;
this.emitLine("runtime." + l + "(" + o + ", 1, function(" + c + ", " + i + ", " + s + ",next) {"), this.emitLine('frame.set("' + c + '", ' + c + ");"), t.set(c, c)
}
this.emitLoopBindings(e, o, i, s), this.withScopedSyntax(function () {
var r;
n && (r = this.tmpid(), this.pushBufferId(r)), this.compile(e.body, t), this.emitLine("next(" + i + (r ? "," + r : "") + ");"), n && this.popBufferId()
});
var h = this.tmpid();
this.emitLine("}, " + this.makeCallback(h)), this.addScopeLevel(), n && this.emitLine(this.buffer + " += " + h + ";"), e.else_ && (this.emitLine("if (!" + o + ".length) {"), this.compile(e.else_, t), this.emitLine("}")), this.emitLine("frame = frame.pop();")
},
compileAsyncEach: function (e, t) {
this._compileAsyncLoop(e, t)
},
compileAsyncAll: function (e, t) {
this._compileAsyncLoop(e, t, !0)
},
_compileMacro: function (e, t) {
var n = [], i = null, s = "macro_" + this.tmpid();
r.each(e.args.children, function (t, r) {
r === e.args.children.length - 1 && t instanceof a.Dict ? i = t : (this.assertType(t, a.Symbol), n.push(t))
}, this);
var o = r.map(n, function (e) {
return "l_" + e.value
});
o.push("kwargs");
var l = r.map(n, function (e) {
return '"' + e.value + '"'
}), c = r.map(i && i.children || [], function (e) {
return '"' + e.key.value + '"'
});
t = t.push(), this.emitLines("var " + s + " = runtime.makeMacro(", "[" + l.join(", ") + "], ", "[" + c.join(", ") + "], ", "function (" + o.join(", ") + ") {", "frame = frame.push(true);", "kwargs = kwargs || {};", 'if (kwargs.hasOwnProperty("caller")) {', 'frame.set("caller", kwargs.caller); }'), r.each(n, function (e) {
this.emitLine('frame.set("' + e.value + '", l_' + e.value + ");"), t.set(e.value, "l_" + e.value)
}, this), i && r.each(i.children, function (e) {
var n = e.key.value;
this.emit('frame.set("' + n + '", kwargs.hasOwnProperty("' + n + '") ? kwargs["' + n + '"] : '), this._compileExpression(e.value, t), this.emitLine(");")
}, this);
var h = this.tmpid();
return this.pushBufferId(h), this.withScopedSyntax(function () {
this.compile(e.body, t)
}), t = t.pop(), this.emitLine("frame = frame.pop();"), this.emitLine("return new runtime.SafeString(" + h + ");"), this.emitLine("});"), this.popBufferId(), s
},
compileMacro: function (e, t) {
var n = this._compileMacro(e, t), i = e.name.value;
t.set(i, n), t.parent ? this.emitLine('frame.set("' + i + '", ' + n + ");") : ("_" !== e.name.value.charAt(0) && this.emitLine('context.addExport("' + i + '");'), this.emitLine('context.setVariable("' + i + '", ' + n + ");"))
},
compileCaller: function (e, t) {
this.emit("(function (){");
var n = this._compileMacro(e, t);
this.emit("return " + n + ";})()")
},
compileImport: function (e, t) {
var n = this.tmpid(), i = e.target.value;
this.emit("env.getTemplate("), this._compileExpression(e.template, t), this.emitLine(", false, " + this._templateName() + ", false, " + this.makeCallback(n)), this.addScopeLevel(), this.emitLine(n + ".getExported(" + (e.withContext ? "context.getVariables(), frame, " : "") + this.makeCallback(n)), this.addScopeLevel(), t.set(i, n), t.parent ? this.emitLine('frame.set("' + i + '", ' + n + ");") : this.emitLine('context.setVariable("' + i + '", ' + n + ");")
},
compileFromImport: function (e, t) {
var n = this.tmpid();
this.emit("env.getTemplate("), this._compileExpression(e.template, t), this.emitLine(", false, " + this._templateName() + ", false, " + this.makeCallback(n)), this.addScopeLevel(), this.emitLine(n + ".getExported(" + (e.withContext ? "context.getVariables(), frame, " : "") + this.makeCallback(n)), this.addScopeLevel(), r.each(e.names.children, function (e) {
var i, r, s = this.tmpid();
e instanceof a.Pair ? (i = e.key.value, r = e.value.value) : (i = e.value, r = i), this.emitLine("if(" + n + '.hasOwnProperty("' + i + '")) {'), this.emitLine("var " + s + " = " + n + "." + i + ";"), this.emitLine("} else {"), this.emitLine("cb(new Error(\"cannot import '" + i + "'\")); return;"), this.emitLine("}"), t.set(r, s), t.parent ? this.emitLine('frame.set("' + r + '", ' + s + ");") : this.emitLine('context.setVariable("' + r + '", ' + s + ");")
}, this)
},
compileBlock: function (e) {
var t = this.tmpid();
this.inBlock || this.emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '), this.emit('context.getBlock("' + e.name.value + '")'), this.inBlock || this.emit(")"), this.emitLine("(env, context, frame, runtime, " + this.makeCallback(t)), this.emitLine(this.buffer + " += " + t + ";"), this.addScopeLevel()
},
compileSuper: function (e, t) {
var n = e.blockName.value, i = e.symbol.value;
this.emitLine('context.getSuper(env, "' + n + '", b_' + n + ", frame, runtime, " + this.makeCallback(i)), this.emitLine(i + " = runtime.markSafe(" + i + ");"), this.addScopeLevel(), t.set(i, i)
},
compileExtends: function (e, t) {
var n = this.tmpid();
this.emit("env.getTemplate("), this._compileExpression(e.template, t), this.emitLine(", true, " + this._templateName() + ", false, " + this.makeCallback("_parentTemplate")), this.emitLine("parentTemplate = _parentTemplate"), this.emitLine("for(var " + n + " in parentTemplate.blocks) {"), this.emitLine("context.addBlock(" + n + ", parentTemplate.blocks[" + n + "]);"), this.emitLine("}"), this.addScopeLevel()
},
compileInclude: function (e, t) {
var n = this.tmpid(), i = this.tmpid();
this.emit("env.getTemplate("), this._compileExpression(e.template, t), this.emitLine(", false, " + this._templateName() + ", " + e.ignoreMissing + ", " + this.makeCallback(n)), this.addScopeLevel(), this.emitLine(n + ".render(context.getVariables(), frame, " + this.makeCallback(i)), this.emitLine(this.buffer + " += " + i), this.addScopeLevel()
},
compileTemplateData: function (e, t) {
this.compileLiteral(e, t)
},
compileCapture: function (e, t) {
this.emitLine("(function() {"), this.emitLine('var output = "";'), this.withScopedSyntax(function () {
this.compile(e.body, t)
}), this.emitLine("return output;"), this.emitLine("})()")
},
compileOutput: function (e, t) {
for (var n = e.children, i = 0, r = n.length; r > i; i++) n[i] instanceof a.TemplateData ? n[i].value && (this.emit(this.buffer + " += "), this.compileLiteral(n[i], t), this.emitLine(";")) : (this.emit(this.buffer + " += runtime.suppressValue("), this.throwOnUndefined && this.emit("runtime.ensureDefined("), this.compile(n[i], t), this.throwOnUndefined && this.emit("," + e.lineno + "," + e.colno + ")"), this.emit(", env.opts.autoescape);\n"))
},
compileRoot: function (e, t) {
t && this.fail("compileRoot: root node can't have frame"), t = new c, this.emitFuncBegin("root"), this.emitLine("var parentTemplate = null;"), this._compileChildren(e, t), this.emitLine("if(parentTemplate) {"), this.emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"), this.emitLine("} else {"), this.emitLine("cb(null, " + this.buffer + ");"), this.emitLine("}"), this.emitFuncEnd(!0), this.inBlock = !0;
var n, i, r, s = [], o = e.findAll(a.Block);
for (n = 0; n < o.length; n++) {
if (r = o[n], i = r.name.value, -1 !== s.indexOf(i)) throw new Error('Block "' + i + '" defined more than once.');
s.push(i), this.emitFuncBegin("b_" + i);
var l = new c;
this.compile(r.body, l), this.emitFuncEnd()
}
for (this.emitLine("return {"), n = 0; n < o.length; n++) r = o[n], i = "b_" + r.name.value, this.emitLine(i + ": " + i + ",");
this.emitLine("root: root\n};")
},
compile: function (e, t) {
var n = this["compile" + e.typename];
n ? n.call(this, e, t) : this.fail("compile: Cannot compile node: " + e.typename, e.lineno, e.colno)
},
getCode: function () {
return this.codebuf.join("")
}
});
e.exports = {
compile: function (e, t, n, i, r) {
var a = new u(i, r.throwOnUndefined);
if (n && n.length) for (var l = 0; l < n.length; l++) "preprocess" in n[l] && (e = n[l].preprocess(e, i));
return a.compile(o.transform(s.parse(e, n, r), t, i)), a.getCode()
}, Compiler: u
}
}, function (e, t, n) {
"use strict";
var i = n(9), r = n(10), s = n(6), o = n(1), a = s.extend({
init: function (e) {
this.tokens = e, this.peeked = null, this.breakOnBlocks = null, this.dropLeadingWhitespace = !1, this.extensions = []
}, nextToken: function (e) {
var t;
if (this.peeked) {
if (e || this.peeked.type !== i.TOKEN_WHITESPACE) return t = this.peeked, this.peeked = null, t;
this.peeked = null
}
if (t = this.tokens.nextToken(), !e) for (; t && t.type === i.TOKEN_WHITESPACE;) t = this.tokens.nextToken();
return t
}, peekToken: function () {
return this.peeked = this.peeked || this.nextToken(), this.peeked
}, pushToken: function (e) {
if (this.peeked) throw new Error("pushToken: can only push one token on between reads");
this.peeked = e
}, fail: function (e, t, n) {
if ((void 0 === t || void 0 === n) && this.peekToken()) {
var i = this.peekToken();
t = i.lineno, n = i.colno
}
throw void 0 !== t && (t += 1), void 0 !== n && (n += 1), new o.TemplateError(e, t, n)
}, skip: function (e) {
var t = this.nextToken();
return t && t.type === e ? !0 : (this.pushToken(t), !1)
}, expect: function (e) {
var t = this.nextToken();
return t.type !== e && this.fail("expected " + e + ", got " + t.type, t.lineno, t.colno), t
}, skipValue: function (e, t) {
var n = this.nextToken();
return n && n.type === e && n.value === t ? !0 : (this.pushToken(n), !1)
}, skipSymbol: function (e) {
return this.skipValue(i.TOKEN_SYMBOL, e)
}, advanceAfterBlockEnd: function (e) {
var t;
return e || (t = this.peekToken(), t || this.fail("unexpected end of file"), t.type !== i.TOKEN_SYMBOL && this.fail("advanceAfterBlockEnd: expected symbol token or explicit name to be passed"), e = this.nextToken().value), t = this.nextToken(), t && t.type === i.TOKEN_BLOCK_END ? "-" === t.value.charAt(0) && (this.dropLeadingWhitespace = !0) : this.fail("expected block end in " + e + " statement"), t
}, advanceAfterVariableEnd: function () {
this.skip(i.TOKEN_VARIABLE_END) || this.fail("expected variable end")
}, parseFor: function () {
var e, t, n = this.peekToken();
this.skipSymbol("for") ? (e = new r.For(n.lineno, n.colno), t = "endfor") : this.skipSymbol("asyncEach") ? (e = new r.AsyncEach(n.lineno, n.colno), t = "endeach") : this.skipSymbol("asyncAll") ? (e = new r.AsyncAll(n.lineno, n.colno),
t = "endall") : this.fail("parseFor: expected for{Async}", n.lineno, n.colno), e.name = this.parsePrimary(), e.name instanceof r.Symbol || this.fail("parseFor: variable name expected for loop");
var s = this.peekToken().type;
if (s === i.TOKEN_COMMA) {
var o = e.name;
for (e.name = new r.Array(o.lineno, o.colno), e.name.addChild(o); this.skip(i.TOKEN_COMMA);) {
var a = this.parsePrimary();
e.name.addChild(a)
}
}
return this.skipSymbol("in") || this.fail('parseFor: expected "in" keyword for loop', n.lineno, n.colno), e.arr = this.parseExpression(), this.advanceAfterBlockEnd(n.value), e.body = this.parseUntilBlocks(t, "else"), this.skipSymbol("else") && (this.advanceAfterBlockEnd("else"), e.else_ = this.parseUntilBlocks(t)), this.advanceAfterBlockEnd(), e
}, parseMacro: function () {
var e = this.peekToken();
this.skipSymbol("macro") || this.fail("expected macro");
var t = this.parsePrimary(!0), n = this.parseSignature(), i = new r.Macro(e.lineno, e.colno, t, n);
return this.advanceAfterBlockEnd(e.value), i.body = this.parseUntilBlocks("endmacro"), this.advanceAfterBlockEnd(), i
}, parseCall: function () {
var e = this.peekToken();
this.skipSymbol("call") || this.fail("expected call");
var t = this.parseSignature(!0) || new r.NodeList, n = this.parsePrimary();
this.advanceAfterBlockEnd(e.value);
var i = this.parseUntilBlocks("endcall");
this.advanceAfterBlockEnd();
var s = new r.Symbol(e.lineno, e.colno, "caller"), o = new r.Caller(e.lineno, e.colno, s, t, i),
a = n.args.children;
a[a.length - 1] instanceof r.KeywordArgs || a.push(new r.KeywordArgs);
var l = a[a.length - 1];
return l.addChild(new r.Pair(e.lineno, e.colno, s, o)), new r.Output(e.lineno, e.colno, [n])
}, parseWithContext: function () {
var e = this.peekToken(), t = null;
return this.skipSymbol("with") ? t = !0 : this.skipSymbol("without") && (t = !1), null !== t && (this.skipSymbol("context") || this.fail("parseFrom: expected context after with/without", e.lineno, e.colno)), t
}, parseImport: function () {
var e = this.peekToken();
this.skipSymbol("import") || this.fail("parseImport: expected import", e.lineno, e.colno);
var t = this.parseExpression();
this.skipSymbol("as") || this.fail('parseImport: expected "as" keyword', e.lineno, e.colno);
var n = this.parsePrimary(), i = this.parseWithContext(), s = new r.Import(e.lineno, e.colno, t, n, i);
return this.advanceAfterBlockEnd(e.value), s
}, parseFrom: function () {
var e = this.peekToken();
this.skipSymbol("from") || this.fail("parseFrom: expected from");
var t = this.parsePrimary();
this.skipSymbol("import") || this.fail("parseFrom: expected import", e.lineno, e.colno);
for (var n, s = new r.NodeList; ;) {
var o = this.peekToken();
if (o.type === i.TOKEN_BLOCK_END) {
s.children.length || this.fail("parseFrom: Expected at least one import name", e.lineno, e.colno), "-" === o.value.charAt(0) && (this.dropLeadingWhitespace = !0), this.nextToken();
break
}
s.children.length > 0 && !this.skip(i.TOKEN_COMMA) && this.fail("parseFrom: expected comma", e.lineno, e.colno);
var a = this.parsePrimary();
if ("_" === a.value.charAt(0) && this.fail("parseFrom: names starting with an underscore cannot be imported", a.lineno, a.colno), this.skipSymbol("as")) {
var l = this.parsePrimary();
s.addChild(new r.Pair(a.lineno, a.colno, a, l))
} else s.addChild(a);
n = this.parseWithContext()
}
return new r.FromImport(e.lineno, e.colno, t, s, n)
}, parseBlock: function () {
var e = this.peekToken();
this.skipSymbol("block") || this.fail("parseBlock: expected block", e.lineno, e.colno);
var t = new r.Block(e.lineno, e.colno);
t.name = this.parsePrimary(), t.name instanceof r.Symbol || this.fail("parseBlock: variable name expected", e.lineno, e.colno), this.advanceAfterBlockEnd(e.value), t.body = this.parseUntilBlocks("endblock"), this.skipSymbol("endblock"), this.skipSymbol(t.name.value);
var n = this.peekToken();
return n || this.fail("parseBlock: expected endblock, got end of file"), this.advanceAfterBlockEnd(n.value), t
}, parseExtends: function () {
var e = "extends", t = this.peekToken();
this.skipSymbol(e) || this.fail("parseTemplateRef: expected " + e);
var n = new r.Extends(t.lineno, t.colno);
return n.template = this.parseExpression(), this.advanceAfterBlockEnd(t.value), n
}, parseInclude: function () {
var e = "include", t = this.peekToken();
this.skipSymbol(e) || this.fail("parseInclude: expected " + e);
var n = new r.Include(t.lineno, t.colno);
return n.template = this.parseExpression(), this.skipSymbol("ignore") && this.skipSymbol("missing") && (n.ignoreMissing = !0), this.advanceAfterBlockEnd(t.value), n
}, parseIf: function () {
var e, t = this.peekToken();
this.skipSymbol("if") || this.skipSymbol("elif") ? e = new r.If(t.lineno, t.colno) : this.skipSymbol("ifAsync") ? e = new r.IfAsync(t.lineno, t.colno) : this.fail("parseIf: expected if or elif", t.lineno, t.colno), e.cond = this.parseExpression(), this.advanceAfterBlockEnd(t.value), e.body = this.parseUntilBlocks("elif", "else", "endif");
var n = this.peekToken();
switch (n && n.value) {
case"elif":
e.else_ = this.parseIf();
break;
case"else":
this.advanceAfterBlockEnd(), e.else_ = this.parseUntilBlocks("endif"), this.advanceAfterBlockEnd();
break;
case"endif":
e.else_ = null, this.advanceAfterBlockEnd();
break;
default:
this.fail("parseIf: expected elif, else, or endif, got end of file")
}
return e
}, parseSet: function () {
var e = this.peekToken();
this.skipSymbol("set") || this.fail("parseSet: expected set", e.lineno, e.colno);
for (var t, n = new r.Set(e.lineno, e.colno, []); (t = this.parsePrimary()) && (n.targets.push(t), this.skip(i.TOKEN_COMMA));) ;
return this.skipValue(i.TOKEN_OPERATOR, "=") ? (n.value = this.parseExpression(), this.advanceAfterBlockEnd(e.value)) : this.skip(i.TOKEN_BLOCK_END) ? (n.body = new r.Capture(e.lineno, e.colno, this.parseUntilBlocks("endset")), n.value = null, this.advanceAfterBlockEnd()) : this.fail("parseSet: expected = or block end in set tag", e.lineno, e.colno), n
}, parseStatement: function () {
var e, t = this.peekToken();
if (t.type !== i.TOKEN_SYMBOL && this.fail("tag name expected", t.lineno, t.colno), this.breakOnBlocks && -1 !== o.indexOf(this.breakOnBlocks, t.value)) return null;
switch (t.value) {
case"raw":
return this.parseRaw();
case"if":
case"ifAsync":
return this.parseIf();
case"for":
case"asyncEach":
case"asyncAll":
return this.parseFor();
case"block":
return this.parseBlock();
case"extends":
return this.parseExtends();
case"include":
return this.parseInclude();
case"set":
return this.parseSet();
case"macro":
return this.parseMacro();
case"call":
return this.parseCall();
case"import":
return this.parseImport();
case"from":
return this.parseFrom();
case"filter":
return this.parseFilterStatement();
default:
if (this.extensions.length) for (var n = 0; n < this.extensions.length; n++) {
var s = this.extensions[n];
if (-1 !== o.indexOf(s.tags || [], t.value)) return s.parse(this, r, i)
}
this.fail("unknown block tag: " + t.value, t.lineno, t.colno)
}
return e
}, parseRaw: function () {
for (var e = /([\s\S]*?){%\s*(raw|endraw)\s*(?=%})%}/, t = 1, n = "", i = null, s = this.advanceAfterBlockEnd(); (i = this.tokens._extractRegex(e)) && t > 0;) {
var o = i[0], a = i[1], l = i[2];
"raw" === l ? t += 1 : "endraw" === l && (t -= 1), 0 === t ? (n += a, this.tokens.backN(o.length - a.length)) : n += o
}
return new r.Output(s.lineno, s.colno, [new r.TemplateData(s.lineno, s.colno, n)])
}, parsePostfix: function (e) {
for (var t, n = this.peekToken(); n;) {
if (n.type === i.TOKEN_LEFT_PAREN) e = new r.FunCall(n.lineno, n.colno, e, this.parseSignature()); else if (n.type === i.TOKEN_LEFT_BRACKET) t = this.parseAggregate(), t.children.length > 1 && this.fail("invalid index"), e = new r.LookupVal(n.lineno, n.colno, e, t.children[0]); else {
if (n.type !== i.TOKEN_OPERATOR || "." !== n.value) break;
this.nextToken();
var s = this.nextToken();
s.type !== i.TOKEN_SYMBOL && this.fail("expected name as lookup value, got " + s.value, s.lineno, s.colno), t = new r.Literal(s.lineno, s.colno, s.value), e = new r.LookupVal(n.lineno, n.colno, e, t)
}
n = this.peekToken()
}
return e
}, parseExpression: function () {
var e = this.parseInlineIf();
return e
}, parseInlineIf: function () {
var e = this.parseOr();
if (this.skipSymbol("if")) {
var t = this.parseOr(), n = e;
e = new r.InlineIf(e.lineno, e.colno), e.body = n, e.cond = t, this.skipSymbol("else") ? e.else_ = this.parseOr() : e.else_ = null
}
return e
}, parseOr: function () {
for (var e = this.parseAnd(); this.skipSymbol("or");) {
var t = this.parseAnd();
e = new r.Or(e.lineno, e.colno, e, t)
}
return e
}, parseAnd: function () {
for (var e = this.parseNot(); this.skipSymbol("and");) {
var t = this.parseNot();
e = new r.And(e.lineno, e.colno, e, t)
}
return e
}, parseNot: function () {
var e = this.peekToken();
return this.skipSymbol("not") ? new r.Not(e.lineno, e.colno, this.parseNot()) : this.parseIn()
}, parseIn: function () {
for (var e = this.parseCompare(); ;) {
var t = this.nextToken();
if (!t) break;
var n = t.type === i.TOKEN_SYMBOL && "not" === t.value;
if (n || this.pushToken(t), !this.skipSymbol("in")) {
n && this.pushToken(t);
break
}
var s = this.parseCompare();
e = new r.In(e.lineno, e.colno, e, s), n && (e = new r.Not(e.lineno, e.colno, e))
}
return e
}, parseCompare: function () {
for (var e = ["==", "!=", "<", ">", "<=", ">="], t = this.parseConcat(), n = []; ;) {
var i = this.nextToken();
if (!i) break;
if (-1 === o.indexOf(e, i.value)) {
this.pushToken(i);
break
}
n.push(new r.CompareOperand(i.lineno, i.colno, this.parseConcat(), i.value))
}
return n.length ? new r.Compare(n[0].lineno, n[0].colno, t, n) : t
}, parseConcat: function () {
for (var e = this.parseAdd(); this.skipValue(i.TOKEN_TILDE, "~");) {
var t = this.parseAdd();
e = new r.Concat(e.lineno, e.colno, e, t)
}
return e
}, parseAdd: function () {
for (var e = this.parseSub(); this.skipValue(i.TOKEN_OPERATOR, "+");) {
var t = this.parseSub();
e = new r.Add(e.lineno, e.colno, e, t)
}
return e
}, parseSub: function () {
for (var e = this.parseMul(); this.skipValue(i.TOKEN_OPERATOR, "-");) {
var t = this.parseMul();
e = new r.Sub(e.lineno, e.colno, e, t)
}
return e
}, parseMul: function () {
for (var e = this.parseDiv(); this.skipValue(i.TOKEN_OPERATOR, "*");) {
var t = this.parseDiv();
e = new r.Mul(e.lineno, e.colno, e, t)
}
return e
}, parseDiv: function () {
for (var e = this.parseFloorDiv(); this.skipValue(i.TOKEN_OPERATOR, "/");) {
var t = this.parseFloorDiv();
e = new r.Div(e.lineno, e.colno, e, t)
}
return e
}, parseFloorDiv: function () {
for (var e = this.parseMod(); this.skipValue(i.TOKEN_OPERATOR, "//");) {
var t = this.parseMod();
e = new r.FloorDiv(e.lineno, e.colno, e, t)
}
return e
}, parseMod: function () {
for (var e = this.parsePow(); this.skipValue(i.TOKEN_OPERATOR, "%");) {
var t = this.parsePow();
e = new r.Mod(e.lineno, e.colno, e, t)
}
return e
}, parsePow: function () {
for (var e = this.parseUnary(); this.skipValue(i.TOKEN_OPERATOR, "**");) {
var t = this.parseUnary();
e = new r.Pow(e.lineno, e.colno, e, t)
}
return e
}, parseUnary: function (e) {
var t, n = this.peekToken();
return t = this.skipValue(i.TOKEN_OPERATOR, "-") ? new r.Neg(n.lineno, n.colno, this.parseUnary(!0)) : this.skipValue(i.TOKEN_OPERATOR, "+") ? new r.Pos(n.lineno, n.colno, this.parseUnary(!0)) : this.parsePrimary(), e || (t = this.parseFilter(t)), t
}, parsePrimary: function (e) {
var t, n = this.nextToken(), s = null;
return n ? n.type === i.TOKEN_STRING ? t = n.value : n.type === i.TOKEN_INT ? t = parseInt(n.value, 10) : n.type === i.TOKEN_FLOAT ? t = parseFloat(n.value) : n.type === i.TOKEN_BOOLEAN ? "true" === n.value ? t = !0 : "false" === n.value ? t = !1 : this.fail("invalid boolean: " + n.value, n.lineno, n.colno) : n.type === i.TOKEN_NONE ? t = null : n.type === i.TOKEN_REGEX && (t = new RegExp(n.value.body, n.value.flags)) : this.fail("expected expression, got end of file"), void 0 !== t ? s = new r.Literal(n.lineno, n.colno, t) : n.type === i.TOKEN_SYMBOL ? (s = new r.Symbol(n.lineno, n.colno, n.value), e || (s = this.parsePostfix(s))) : (this.pushToken(n), s = this.parseAggregate()), s ? s : void this.fail("unexpected token: " + n.value, n.lineno, n.colno)
}, parseFilterName: function () {
for (var e = this.expect(i.TOKEN_SYMBOL), t = e.value; this.skipValue(i.TOKEN_OPERATOR, ".");) t += "." + this.expect(i.TOKEN_SYMBOL).value;
return new r.Symbol(e.lineno, e.colno, t)
}, parseFilterArgs: function (e) {
if (this.peekToken().type === i.TOKEN_LEFT_PAREN) {
var t = this.parsePostfix(e);
return t.args.children
}
return []
}, parseFilter: function (e) {
for (; this.skip(i.TOKEN_PIPE);) {
var t = this.parseFilterName();
e = new r.Filter(t.lineno, t.colno, t, new r.NodeList(t.lineno, t.colno, [e].concat(this.parseFilterArgs(e))))
}
return e
}, parseFilterStatement: function () {
var e = this.peekToken();
this.skipSymbol("filter") || this.fail("parseFilterStatement: expected filter");
var t = this.parseFilterName(), n = this.parseFilterArgs(t);
this.advanceAfterBlockEnd(e.value);
var i = new r.Capture(t.lineno, t.colno, this.parseUntilBlocks("endfilter"));
this.advanceAfterBlockEnd();
var s = new r.Filter(t.lineno, t.colno, t, new r.NodeList(t.lineno, t.colno, [i].concat(n)));
return new r.Output(t.lineno, t.colno, [s])
}, parseAggregate: function () {
var e, t = this.nextToken();
switch (t.type) {
case i.TOKEN_LEFT_PAREN:
e = new r.Group(t.lineno, t.colno);
break;
case i.TOKEN_LEFT_BRACKET:
e = new r.Array(t.lineno, t.colno);
break;
case i.TOKEN_LEFT_CURLY:
e = new r.Dict(t.lineno, t.colno);
break;
default:
return null
}
for (; ;) {
var n = this.peekToken().type;
if (n === i.TOKEN_RIGHT_PAREN || n === i.TOKEN_RIGHT_BRACKET || n === i.TOKEN_RIGHT_CURLY) {
this.nextToken();
break
}
if (e.children.length > 0 && (this.skip(i.TOKEN_COMMA) || this.fail("parseAggregate: expected comma after expression", t.lineno, t.colno)), e instanceof r.Dict) {
var s = this.parsePrimary();
this.skip(i.TOKEN_COLON) || this.fail("parseAggregate: expected colon after dict key", t.lineno, t.colno);
var o = this.parseExpression();
e.addChild(new r.Pair(s.lineno, s.colno, s, o))
} else {
var a = this.parseExpression();
e.addChild(a)
}
}
return e
}, parseSignature: function (e, t) {
var n = this.peekToken();
if (!t && n.type !== i.TOKEN_LEFT_PAREN) {
if (e) return null;
this.fail("expected arguments", n.lineno, n.colno)
}
n.type === i.TOKEN_LEFT_PAREN && (n = this.nextToken());
for (var s = new r.NodeList(n.lineno, n.colno), o = new r.KeywordArgs(n.lineno, n.colno), a = !1; ;) {
if (n = this.peekToken(), !t && n.type === i.TOKEN_RIGHT_PAREN) {
this.nextToken();
break
}
if (t && n.type === i.TOKEN_BLOCK_END) break;
if (a && !this.skip(i.TOKEN_COMMA)) this.fail("parseSignature: expected comma after expression", n.lineno, n.colno); else {
var l = this.parseExpression();
this.skipValue(i.TOKEN_OPERATOR, "=") ? o.addChild(new r.Pair(l.lineno, l.colno, l, this.parseExpression())) : s.addChild(l)
}
a = !0
}
return o.children.length && s.addChild(o), s
}, parseUntilBlocks: function () {
var e = this.breakOnBlocks;
this.breakOnBlocks = o.toArray(arguments);
var t = this.parse();
return this.breakOnBlocks = e, t
}, parseNodes: function () {
for (var e, t = []; e = this.nextToken();) if (e.type === i.TOKEN_DATA) {
var n = e.value, s = this.peekToken(), o = s && s.value;
this.dropLeadingWhitespace && (n = n.replace(/^\s*/, ""), this.dropLeadingWhitespace = !1), s && (s.type === i.TOKEN_BLOCK_START && "-" === o.charAt(o.length - 1) || s.type === i.TOKEN_COMMENT && "-" === o.charAt(this.tokens.tags.COMMENT_START.length)) && (n = n.replace(/\s*$/, "")), t.push(new r.Output(e.lineno, e.colno, [new r.TemplateData(e.lineno, e.colno, n)]))
} else if (e.type === i.TOKEN_BLOCK_START) {
this.dropLeadingWhitespace = !1;
var a = this.parseStatement();
if (!a) break;
t.push(a)
} else if (e.type === i.TOKEN_VARIABLE_START) {
var l = this.parseExpression();
this.advanceAfterVariableEnd(), this.dropLeadingWhitespace = !1, t.push(new r.Output(e.lineno, e.colno, [l]))
} else e.type === i.TOKEN_COMMENT ? this.dropLeadingWhitespace = "-" === e.value.charAt(e.value.length - this.tokens.tags.COMMENT_END.length - 1) : this.fail("Unexpected token at top-level: " + e.type, e.lineno, e.colno);
return t
}, parse: function () {
return new r.NodeList(0, 0, this.parseNodes())
}, parseAsRoot: function () {
return new r.Root(0, 0, this.parseNodes())
}
});
e.exports = {
parse: function (e, t, n) {
var r = new a(i.lex(e, n));
return void 0 !== t && (r.extensions = t), r.parseAsRoot()
}
}
}, function (e, t, n) {
"use strict";
function i(e, t, n, i) {
return {type: e, value: t, lineno: n, colno: i}
}
function r(e, t) {
this.str = e, this.index = 0, this.len = e.length, this.lineno = 0, this.colno = 0, this.in_code = !1, t = t || {};
var n = t.tags || {};
this.tags = {
BLOCK_START: n.blockStart || c,
BLOCK_END: n.blockEnd || h,
VARIABLE_START: n.variableStart || u,
VARIABLE_END: n.variableEnd || p,
COMMENT_START: n.commentStart || f,
COMMENT_END: n.commentEnd || m
}, this.trimBlocks = !!t.trimBlocks, this.lstripBlocks = !!t.lstripBlocks
}
var s = n(1), o = " \n \r ", a = "()[]{}%*-+~/#,:|.<>=!", l = "0123456789", c = "{%", h = "%}", u = "{{",
p = "}}", f = "{#", m = "#}", d = "string", v = "whitespace", g = "data", y = "block-start", k = "block-end",
x = "variable-start", b = "variable-end", E = "comment", w = "left-paren", T = "right-paren",
L = "left-bracket", O = "right-bracket", _ = "left-curly", A = "right-curly", S = "operator", N = "comma",
C = "colon", B = "tilde", F = "pipe", K = "int", R = "float", I = "boolean", M = "none", P = "symbol",
D = "special", V = "regex";
r.prototype.nextToken = function () {
var e, t = this.lineno, n = this.colno;
if (this.in_code) {
var r = this.current();
if (this.is_finished()) return null;
if ('"' === r || "'" === r) return i(d, this.parseString(r), t, n);
if (e = this._extract(o)) return i(v, e, t, n);
if ((e = this._extractString(this.tags.BLOCK_END)) || (e = this._extractString("-" + this.tags.BLOCK_END))) return this.in_code = !1, this.trimBlocks && (r = this.current(), "\n" === r ? this.forward() : "\r" === r && (this.forward(), r = this.current(), "\n" === r ? this.forward() : this.back())), i(k, e, t, n);
if (e = this._extractString(this.tags.VARIABLE_END)) return this.in_code = !1, i(b, e, t, n);
if ("r" === r && "/" === this.str.charAt(this.index + 1)) {
this.forwardN(2);
for (var c = ""; !this.is_finished();) {
if ("/" === this.current() && "\\" !== this.previous()) {
this.forward();
break
}
c += this.current(), this.forward()
}
for (var h = ["g", "i", "m", "y"], u = ""; !this.is_finished();) {
var p = -1 !== h.indexOf(this.current());
if (!p) break;
u += this.current(), this.forward()
}
return i(V, {body: c, flags: u}, t, n)
}
if (-1 !== a.indexOf(r)) {
this.forward();
var f, m = ["==", "!=", "<=", ">=", "//", "**"], D = r + this.current();
switch (-1 !== s.indexOf(m, D) && (this.forward(), r = D), r) {
case"(":
f = w;
break;
case")":
f = T;
break;
case"[":
f = L;
break;
case"]":
f = O;
break;
case"{":
f = _;
break;
case"}":
f = A;
break;
case",":
f = N;
break;
case":":
f = C;
break;
case"~":
f = B;
break;
case"|":
f = F;
break;
default:
f = S
}
return i(f, r, t, n)
}
if (e = this._extractUntil(o + a), e.match(/^[-+]?[0-9]+$/)) {
if ("." === this.current()) {
this.forward();
var j = this._extract(l);
return i(R, e + "." + j, t, n)
}
return i(K, e, t, n)
}
if (e.match(/^(true|false)$/)) return i(I, e, t, n);
if ("none" === e) return i(M, e, t, n);
if (e) return i(P, e, t, n);
throw new Error("Unexpected value while parsing: " + e)
}
var U = this.tags.BLOCK_START.charAt(0) + this.tags.VARIABLE_START.charAt(0) + this.tags.COMMENT_START.charAt(0) + this.tags.COMMENT_END.charAt(0);
if (this.is_finished()) return null;
if ((e = this._extractString(this.tags.BLOCK_START + "-")) || (e = this._extractString(this.tags.BLOCK_START))) return this.in_code = !0, i(y, e, t, n);
if (e = this._extractString(this.tags.VARIABLE_START)) return this.in_code = !0, i(x, e, t, n);
e = "";
var W, G = !1;
for (this._matches(this.tags.COMMENT_START) && (G = !0, e = this._extractString(this.tags.COMMENT_START)); null !== (W = this._extractUntil(U));) {
if (e += W, (this._matches(this.tags.BLOCK_START) || this._matches(this.tags.VARIABLE_START) || this._matches(this.tags.COMMENT_START)) && !G) {
if (this.lstripBlocks && this._matches(this.tags.BLOCK_START) && this.colno > 0 && this.colno <= e.length) {
var Y = e.slice(-this.colno);
if (/^\s+$/.test(Y) && (e = e.slice(0, -this.colno), !e.length)) return this.nextToken()
}
break
}
if (this._matches(this.tags.COMMENT_END)) {
if (!G) throw new Error("unexpected end of comment");
e += this._extractString(this.tags.COMMENT_END);
break
}
e += this.current(), this.forward()
}
if (null === W && G) throw new Error("expected end of comment, got end of file");
return i(G ? E : g, e, t, n)
}, r.prototype.parseString = function (e) {
this.forward();
for (var t = ""; !this.is_finished() && this.current() !== e;) {
var n = this.current();
if ("\\" === n) {
switch (this.forward(), this.current()) {
case"n":
t += "\n";
break;
case"t":
t += " ";
break;
case"r":
t += "\r";
break;
default:
t += this.current()
}
this.forward()
} else t += n, this.forward()
}
return this.forward(), t
}, r.prototype._matches = function (e) {
if (this.index + e.length > this.len) return null;
var t = this.str.slice(this.index, this.index + e.length);
return t === e
}, r.prototype._extractString = function (e) {
return this._matches(e) ? (this.index += e.length, e) : null
}, r.prototype._extractUntil = function (e) {
return this._extractMatching(!0, e || "")
}, r.prototype._extract = function (e) {
return this._extractMatching(!1, e)
}, r.prototype._extractMatching = function (e, t) {
if (this.is_finished()) return null;
var n = t.indexOf(this.current());
if (e && -1 === n || !e && -1 !== n) {
var i = this.current();
this.forward();
for (var r = t.indexOf(this.current()); (e && -1 === r || !e && -1 !== r) && !this.is_finished();) i += this.current(), this.forward(), r = t.indexOf(this.current());
return i
}
return ""
}, r.prototype._extractRegex = function (e) {
var t = this.currentStr().match(e);
return t ? (this.forwardN(t[0].length), t) : null
}, r.prototype.is_finished = function () {
return this.index >= this.len
}, r.prototype.forwardN = function (e) {
for (var t = 0; e > t; t++) this.forward()
}, r.prototype.forward = function () {
this.index++, "\n" === this.previous() ? (this.lineno++, this.colno = 0) : this.colno++
}, r.prototype.backN = function (e) {
for (var t = 0; e > t; t++) this.back()
}, r.prototype.back = function () {
if (this.index--, "\n" === this.current()) {
this.lineno--;
var e = this.src.lastIndexOf("\n", this.index - 1);
-1 === e ? this.colno = this.index : this.colno = this.index - e
} else this.colno--
}, r.prototype.current = function () {
return this.is_finished() ? "" : this.str.charAt(this.index)
}, r.prototype.currentStr = function () {
return this.is_finished() ? "" : this.str.substr(this.index)
}, r.prototype.previous = function () {
return this.str.charAt(this.index - 1)
}, e.exports = {
lex: function (e, t) {
return new r(e, t)
},
TOKEN_STRING: d,
TOKEN_WHITESPACE: v,
TOKEN_DATA: g,
TOKEN_BLOCK_START: y,
TOKEN_BLOCK_END: k,
TOKEN_VARIABLE_START: x,
TOKEN_VARIABLE_END: b,
TOKEN_COMMENT: E,
TOKEN_LEFT_PAREN: w,
TOKEN_RIGHT_PAREN: T,
TOKEN_LEFT_BRACKET: L,
TOKEN_RIGHT_BRACKET: O,
TOKEN_LEFT_CURLY: _,
TOKEN_RIGHT_CURLY: A,
TOKEN_OPERATOR: S,
TOKEN_COMMA: N,
TOKEN_COLON: C,
TOKEN_TILDE: B,
TOKEN_PIPE: F,
TOKEN_INT: K,
TOKEN_FLOAT: R,
TOKEN_BOOLEAN: I,
TOKEN_NONE: M,
TOKEN_SYMBOL: P,
TOKEN_SPECIAL: D,
TOKEN_REGEX: V
}
}, function (e, t, n) {
(function (t) {
"use strict";
function i(e, t, n) {
e instanceof t && n.push(e), e instanceof a && e.findAll(t, n)
}
function r(e, n) {
function i(e, n, i) {
for (var r = e.split("\n"), s = 0; s < r.length; s++) {
if (r[s] && (i && s > 0 || !i)) for (var o = 0; n > o; o++) t.stdout.write(" ");
s === r.length - 1 ? t.stdout.write(r[s]) : t.stdout.write(r[s] + "\n")
}
}
if (n = n || 0, i(e.typename + ": ", n), e instanceof c) i("\n"), s.each(e.children, function (e) {
r(e, n + 2)
}); else if (e instanceof se) i(e.extName + "." + e.prop), i("\n"), e.args && r(e.args, n + 2), e.contentArgs && s.each(e.contentArgs, function (e) {
r(e, n + 2)
}); else {
var o = null, l = null;
if (e.iterFields(function (e, t) {
e instanceof a ? (o = o || {}, o[t] = e) : (l = l || {}, l[t] = e)
}), l ? i(JSON.stringify(l, null, 2) + "\n", null, !0) : i("\n"), o) for (var h in o) r(o[h], n + 2)
}
}
var s = n(1), o = n(6), a = o.extend("Node", {
init: function (e, t) {
this.lineno = e, this.colno = t;
for (var n = this.fields, i = 0, r = n.length; r > i; i++) {
var s = n[i], o = arguments[i + 2];
void 0 === o && (o = null), this[s] = o
}
}, findAll: function (e, t) {
t = t || [];
var n, r;
if (this instanceof c) {
var s = this.children;
for (n = 0, r = s.length; r > n; n++) i(s[n], e, t)
} else {
var o = this.fields;
for (n = 0, r = o.length; r > n; n++) i(this[o[n]], e, t)
}
return t
}, iterFields: function (e) {
s.each(this.fields, function (t) {
e(this[t], t)
}, this)
}
}), l = a.extend("Value", {fields: ["value"]}), c = a.extend("NodeList", {
fields: ["children"], init: function (e, t, n) {
this.parent(e, t, n || [])
}, addChild: function (e) {
this.children.push(e)
}
}), h = c.extend("Root"), u = l.extend("Literal"), p = l.extend("Symbol"), f = c.extend("Group"),
m = c.extend("Array"), d = a.extend("Pair", {fields: ["key", "value"]}), v = c.extend("Dict"),
g = a.extend("LookupVal", {fields: ["target", "val"]}),
y = a.extend("If", {fields: ["cond", "body", "else_"]}), k = y.extend("IfAsync"),
x = a.extend("InlineIf", {fields: ["cond", "body", "else_"]}),
b = a.extend("For", {fields: ["arr", "name", "body", "else_"]}), E = b.extend("AsyncEach"),
w = b.extend("AsyncAll"), T = a.extend("Macro", {fields: ["name", "args", "body"]}), L = T.extend("Caller"),
O = a.extend("Import", {fields: ["template", "target", "withContext"]}), _ = a.extend("FromImport", {
fields: ["template", "names", "withContext"], init: function (e, t, n, i, r) {
this.parent(e, t, n, i || new c, r)
}
}), A = a.extend("FunCall", {fields: ["name", "args"]}), S = A.extend("Filter"),
N = S.extend("FilterAsync", {fields: ["name", "args", "symbol"]}), C = v.extend("KeywordArgs"),
B = a.extend("Block", {fields: ["name", "body"]}), F = a.extend("Super", {fields: ["blockName", "symbol"]}),
K = a.extend("TemplateRef", {fields: ["template"]}), R = K.extend("Extends"),
I = a.extend("Include", {fields: ["template", "ignoreMissing"]}),
M = a.extend("Set", {fields: ["targets", "value"]}), P = c.extend("Output"),
D = a.extend("Capture", {fields: ["body"]}), V = u.extend("TemplateData"),
j = a.extend("UnaryOp", {fields: ["target"]}), U = a.extend("BinOp", {fields: ["left", "right"]}),
W = U.extend("In"), G = U.extend("Or"), Y = U.extend("And"), H = j.extend("Not"), $ = U.extend("Add"),
z = U.extend("Concat"), X = U.extend("Sub"), q = U.extend("Mul"), J = U.extend("Div"),
Q = U.extend("FloorDiv"), Z = U.extend("Mod"), ee = U.extend("Pow"), te = j.extend("Neg"),
ne = j.extend("Pos"), ie = a.extend("Compare", {fields: ["expr", "ops"]}),
re = a.extend("CompareOperand", {fields: ["expr", "type"]}), se = a.extend("CallExtension", {
fields: ["extName", "prop", "args", "contentArgs"],
init: function (e, t, n, i) {
this.extName = e._name || e, this.prop = t, this.args = n || new c, this.contentArgs = i || [], this.autoescape = e.autoescape
}
}), oe = se.extend("CallExtensionAsync");
e.exports = {
Node: a,
Root: h,
NodeList: c,
Value: l,
Literal: u,
Symbol: p,
Group: f,
Array: m,
Pair: d,
Dict: v,
Output: P,
Capture: D,
TemplateData: V,
If: y,
IfAsync: k,
InlineIf: x,
For: b,
AsyncEach: E,
AsyncAll: w,
Macro: T,
Caller: L,
Import: O,
FromImport: _,
FunCall: A,
Filter: S,
FilterAsync: N,
KeywordArgs: C,
Block: B,
Super: F,
Extends: R,
Include: I,
Set: M,
LookupVal: g,
BinOp: U,
In: W,
Or: G,
And: Y,
Not: H,
Add: $,
Concat: z,
Sub: X,
Mul: q,
Div: J,
FloorDiv: Q,
Mod: Z,
Pow: ee,
Neg: te,
Pos: ne,
Compare: ie,
CompareOperand: re,
CallExtension: se,
CallExtensionAsync: oe,
printNodes: r
}
}).call(t, n(3))
}, function (e, t, n) {
"use strict";
function i() {
return "hole_" + d++
}
function r(e, t) {
for (var n = null, i = 0; i < e.length; i++) {
var r = t(e[i]);
r !== e[i] && (n || (n = e.slice()), n[i] = r)
}
return n || e
}
function s(e, t, n) {
if (!(e instanceof f.Node)) return e;
if (!n) {
var i = t(e);
if (i && i !== e) return i
}
if (e instanceof f.NodeList) {
var o = r(e.children, function (e) {
return s(e, t, n)
});
o !== e.children && (e = new f[e.typename](e.lineno, e.colno, o))
} else if (e instanceof f.CallExtension) {
var a = s(e.args, t, n), l = r(e.contentArgs, function (e) {
return s(e, t, n)
});
(a !== e.args || l !== e.contentArgs) && (e = new f[e.typename](e.extName, e.prop, a, l))
} else {
var c = e.fields.map(function (t) {
return e[t]
}), h = r(c, function (e) {
return s(e, t, n)
});
h !== c && (e = new f[e.typename](e.lineno, e.colno), h.forEach(function (t, n) {
e[e.fields[n]] = t
}))
}
return n ? t(e) || e : e
}
function o(e, t) {
return s(e, t, !0)
}
function a(e, t, n) {
var r = [], s = o(n ? e[n] : e, function (e) {
if (e instanceof f.Block) return e;
if (e instanceof f.Filter && -1 !== m.indexOf(t, e.name.value) || e instanceof f.CallExtensionAsync) {
var n = new f.Symbol(e.lineno, e.colno, i());
return r.push(new f.FilterAsync(e.lineno, e.colno, e.name, e.args, n)), n
}
});
return n ? e[n] = s : e = s, r.length ? (r.push(e), new f.NodeList(e.lineno, e.colno, r)) : e
}
function l(e, t) {
return o(e, function (e) {
return e instanceof f.Output ? a(e, t) : e instanceof f.Set ? a(e, t, "value") : e instanceof f.For ? a(e, t, "arr") : e instanceof f.If ? a(e, t, "cond") : e instanceof f.CallExtension ? a(e, t, "args") : void 0
})
}
function c(e) {
return s(e, function (e) {
if (e instanceof f.Block) {
var t = !1, n = i();
e.body = s(e.body, function (e) {
return e instanceof f.FunCall && "super" === e.name.value ? (t = !0, new f.Symbol(e.lineno, e.colno, n)) : void 0
}), t && e.body.children.unshift(new f.Super(0, 0, e.name, new f.Symbol(0, 0, n)))
}
})
}
function h(e) {
return o(e, function (e) {
if (e instanceof f.If || e instanceof f.For) {
var t = !1;
if (s(e, function (e) {
return e instanceof f.FilterAsync || e instanceof f.IfAsync || e instanceof f.AsyncEach || e instanceof f.AsyncAll || e instanceof f.CallExtensionAsync ? (t = !0, e) : void 0
}), t) {
if (e instanceof f.If) return new f.IfAsync(e.lineno, e.colno, e.cond, e.body, e.else_);
if (e instanceof f.For) return new f.AsyncEach(e.lineno, e.colno, e.arr, e.name, e.body, e.else_)
}
}
})
}
function u(e, t) {
return h(c(l(e, t)))
}
function p(e, t) {
return u(e, t || [])
}
var f = n(10), m = n(1), d = 0;
e.exports = {transform: p}
}, function (e, t, n) {
"use strict";
function i(e, t, n) {
return function () {
var i, r, a = o(arguments), l = s(arguments);
if (a > e.length) {
i = Array.prototype.slice.call(arguments, 0, e.length);
var c = Array.prototype.slice.call(arguments, i.length, a);
for (r = 0; r < c.length; r++) r < t.length && (l[t[r]] = c[r]);
i.push(l)
} else if (a < e.length) {
for (i = Array.prototype.slice.call(arguments, 0, a), r = a; r < e.length; r++) {
var h = e[r];
i.push(l[h]), delete l[h]
}
i.push(l)
} else i = arguments;
return n.apply(this, i)
}
}
function r(e) {
return e.__keywords = !0, e
}
function s(e) {
var t = e.length;
if (t) {
var n = e[t - 1];
if (n && n.hasOwnProperty("__keywords")) return n
}
return {}
}
function o(e) {
var t = e.length;
if (0 === t) return 0;
var n = e[t - 1];
return n && n.hasOwnProperty("__keywords") ? t - 1 : t
}
function a(e) {
return "string" != typeof e ? e : (this.val = e, void (this.length = e.length))
}
function l(e, t) {
return e instanceof a ? new a(t) : t.toString()
}
function c(e) {
var t = typeof e;
return "string" === t ? new a(e) : "function" !== t ? e : function () {
var t = e.apply(this, arguments);
return "string" == typeof t ? new a(t) : t
}
}
function h(e, t) {
return e = void 0 !== e && null !== e ? e : "", t && "string" == typeof e && (e = y.escape(e)), e
}
function u(e, t, n) {
if (null === e || void 0 === e) throw new y.TemplateError("attempted to output null or undefined value", t + 1, n + 1);
return e
}
function p(e, t) {
return e = e || {}, "function" == typeof e[t] ? function () {
return e[t].apply(e, arguments)
} : e[t]
}
function f(e, t, n, i) {
if (!e) throw new Error("Unable to call `" + t + "`, which is undefined or falsey");
if ("function" != typeof e) throw new Error("Unable to call `" + t + "`, which is not a function");
return e.apply(n, i)
}
function m(e, t, n) {
var i = t.lookup(n);
return void 0 !== i && null !== i ? i : e.lookup(n)
}
function d(e, t, n) {
return e.lineno ? e : new y.TemplateError(e, t, n)
}
function v(e, t, n, i) {
if (y.isArray(e)) {
var r = e.length;
y.asyncIter(e, function (e, i, s) {
switch (t) {
case 1:
n(e, i, r, s);
break;
case 2:
n(e[0], e[1], i, r, s);
break;
case 3:
n(e[0], e[1], e[2], i, r, s);
break;
default:
e.push(i, s), n.apply(this, e)
}
}, i)
} else y.asyncFor(e, function (e, t, i, r, s) {
n(e, t, i, r, s)
}, i)
}
function g(e, t, n, i) {
function r(e, t) {
l++, a[e] = t, l === s && i(null, a.join(""))
}
var s, o, a, l = 0;
if (y.isArray(e)) if (s = e.length, a = new Array(s), 0 === s) i(null, ""); else for (o = 0; o < e.length; o++) {
var c = e[o];
switch (t) {
case 1:
n(c, o, s, r);
break;
case 2:
n(c[0], c[1], o, s, r);
break;
case 3:
n(c[0], c[1], c[2], o, s, r);
break;
default:
c.push(o, r), n.apply(this, c)
}
} else {
var h = y.keys(e);
if (s = h.length, a = new Array(s), 0 === s) i(null, ""); else for (o = 0; o < h.length; o++) {
var u = h[o];
n(u, e[u], o, s, r)
}
}
}
var y = n(1), k = n(6), x = k.extend({
init: function (e, t) {
this.variables = {}, this.parent = e, this.topLevel = !1, this.isolateWrites = t
}, set: function (e, t, n) {
var i = e.split("."), r = this.variables, s = this;
if (n && (s = this.resolve(i[0], !0))) return void s.set(e, t);
for (var o = 0; o < i.length - 1; o++) {
var a = i[o];
r[a] || (r[a] = {}), r = r[a]
}
r[i[i.length - 1]] = t
}, get: function (e) {
var t = this.variables[e];
return void 0 !== t && null !== t ? t : null
}, lookup: function (e) {
var t = this.parent, n = this.variables[e];
return void 0 !== n && null !== n ? n : t && t.lookup(e)
}, resolve: function (e, t) {
var n = t && this.isolateWrites ? void 0 : this.parent, i = this.variables[e];
return void 0 !== i && null !== i ? this : n && n.resolve(e)
}, push: function (e) {
return new x(this, e)
}, pop: function () {
return this.parent
}
});
a.prototype = Object.create(String.prototype, {
length: {
writable: !0,
configurable: !0,
value: 0
}
}), a.prototype.valueOf = function () {
return this.val
}, a.prototype.toString = function () {
return this.val
}, e.exports = {
Frame: x,
makeMacro: i,
makeKeywordArgs: r,
numArgs: o,
suppressValue: h,
ensureDefined: u,
memberLookup: p,
contextOrFrameLookup: m,
callWrap: f,
handleError: d,
isArray: y.isArray,
keys: y.keys,
SafeString: a,
copySafeness: l,
markSafe: c,
asyncEach: v,
asyncAll: g,
inOperator: y.inOperator
}
}, function (e, t, n) {
"use strict";
function i(e, t) {
return null === e || void 0 === e || e === !1 ? t : e
}
var r = n(1), s = n(12), o = {
abs: function (e) {
return Math.abs(e)
}, batch: function (e, t, n) {
var i, r = [], s = [];
for (i = 0; i < e.length; i++) i % t === 0 && s.length && (r.push(s), s = []), s.push(e[i]);
if (s.length) {
if (n) for (i = s.length; t > i; i++) s.push(n);
r.push(s)
}
return r
}, capitalize: function (e) {
e = i(e, "");
var t = e.toLowerCase();
return s.copySafeness(e, t.charAt(0).toUpperCase() + t.slice(1))
}, center: function (e, t) {
if (e = i(e, ""), t = t || 80, e.length >= t) return e;
var n = t - e.length, o = r.repeat(" ", n / 2 - n % 2), a = r.repeat(" ", n / 2);
return s.copySafeness(e, o + e + a)
}, "default": function (e, t, n) {
return n ? e ? e : t : void 0 !== e ? e : t
}, dictsort: function (e, t, n) {
if (!r.isObject(e)) throw new r.TemplateError("dictsort filter: val must be an object");
var i = [];
for (var s in e) i.push([s, e[s]]);
var o;
if (void 0 === n || "key" === n) o = 0; else {
if ("value" !== n) throw new r.TemplateError("dictsort filter: You can only sort by either key or value");
o = 1
}
return i.sort(function (e, n) {
var i = e[o], s = n[o];
return t || (r.isString(i) && (i = i.toUpperCase()), r.isString(s) && (s = s.toUpperCase())), i > s ? 1 : i === s ? 0 : -1
}), i
}, dump: function (e) {
return JSON.stringify(e)
}, escape: function (e) {
return "string" == typeof e ? s.markSafe(r.escape(e)) : e
}, safe: function (e) {
return s.markSafe(e)
}, first: function (e) {
return e[0]
}, groupby: function (e, t) {
return r.groupBy(e, t)
}, indent: function (e, t, n) {
if (e = i(e, ""), "" === e) return "";
t = t || 4;
for (var o = "", a = e.split("\n"), l = r.repeat(" ", t), c = 0; c < a.length; c++) o += 0 !== c || n ? l + a[c] + "\n" : a[c] + "\n";
return s.copySafeness(e, o)
}, join: function (e, t, n) {
return t = t || "", n && (e = r.map(e, function (e) {
return e[n]
})), e.join(t)
}, last: function (e) {
return e[e.length - 1]
}, length: function (e) {
var t = i(e, "");
return void 0 !== t ? "function" == typeof Map && t instanceof Map || "function" == typeof Set && t instanceof Set ? t.size : t.length : 0
}, list: function (e) {
if (r.isString(e)) return e.split("");
if (r.isObject(e)) {
var t = [];
if (Object.keys) t = Object.keys(e); else for (var n in e) t.push(n);
return r.map(t, function (t) {
return {key: t, value: e[t]}
})
}
if (r.isArray(e)) return e;
throw new r.TemplateError("list filter: type not iterable")
}, lower: function (e) {
return e = i(e, ""), e.toLowerCase()
}, random: function (e) {
return e[Math.floor(Math.random() * e.length)]
}, rejectattr: function (e, t) {
return e.filter(function (e) {
return !e[t]
})
}, selectattr: function (e, t) {
return e.filter(function (e) {
return !!e[t]
})
}, replace: function (e, t, n, i) {
var r = e;
if (t instanceof RegExp) return e.replace(t, n);
"undefined" == typeof i && (i = -1);
var o = "";
if ("number" == typeof t) t += ""; else if ("string" != typeof t) return e;
if ("number" == typeof e && (e += ""), "string" != typeof e && !(e instanceof s.SafeString)) return e;
if ("" === t) return o = n + e.split("").join(n) + n, s.copySafeness(e, o);
var a = e.indexOf(t);
if (0 === i || -1 === a) return e;
for (var l = 0, c = 0; a > -1 && (-1 === i || i > c);) o += e.substring(l, a) + n, l = a + t.length, c++, a = e.indexOf(t, l);
return l < e.length && (o += e.substring(l)), s.copySafeness(r, o)
}, reverse: function (e) {
var t;
return t = r.isString(e) ? o.list(e) : r.map(e, function (e) {
return e
}), t.reverse(), r.isString(e) ? s.copySafeness(e, t.join("")) : t
}, round: function (e, t, n) {
t = t || 0;
var i, r = Math.pow(10, t);
return i = "ceil" === n ? Math.ceil : "floor" === n ? Math.floor : Math.round, i(e * r) / r
}, slice: function (e, t, n) {
for (var i = Math.floor(e.length / t), r = e.length % t, s = 0, o = [], a = 0; t > a; a++) {
var l = s + a * i;
r > a && s++;
var c = s + (a + 1) * i, h = e.slice(l, c);
n && a >= r && h.push(n), o.push(h)
}
return o
}, sum: function (e, t, n) {
var i = 0;
"number" == typeof n && (i += n), t && (e = r.map(e, function (e) {
return e[t]
}));
for (var s = 0; s < e.length; s++) i += e[s];
return i
}, sort: s.makeMacro(["value", "reverse", "case_sensitive", "attribute"], [], function (e, t, n, i) {
return e = r.map(e, function (e) {
return e
}), e.sort(function (e, s) {
var o, a;
return i ? (o = e[i], a = s[i]) : (o = e, a = s), !n && r.isString(o) && r.isString(a) && (o = o.toLowerCase(), a = a.toLowerCase()), a > o ? t ? 1 : -1 : o > a ? t ? -1 : 1 : 0
}), e
}), string: function (e) {
return s.copySafeness(e, e)
}, striptags: function (e, t) {
e = i(e, ""), t = t || !1;
var n = /<\/?([a-z][a-z0-9]*)\b[^>]*>|<!--[\s\S]*?-->/gi, r = o.trim(e.replace(n, "")), a = "";
return a = t ? r.replace(/^ +| +$/gm, "").replace(/ +/g, " ").replace(/(\r\n)/g, "\n").replace(/\n\n\n+/g, "\n\n") : r.replace(/\s+/gi, " "), s.copySafeness(e, a)
}, title: function (e) {
e = i(e, "");
for (var t = e.split(" "), n = 0; n < t.length; n++) t[n] = o.capitalize(t[n]);
return s.copySafeness(e, t.join(" "))
}, trim: function (e) {
return s.copySafeness(e, e.replace(/^\s*|\s*$/g, ""))
}, truncate: function (e, t, n, r) {
var o = e;
if (e = i(e, ""), t = t || 255, e.length <= t) return e;
if (n) e = e.substring(0, t); else {
var a = e.lastIndexOf(" ", t);
-1 === a && (a = t), e = e.substring(0, a)
}
return e += void 0 !== r && null !== r ? r : "...", s.copySafeness(o, e)
}, upper: function (e) {
return e = i(e, ""), e.toUpperCase()
}, urlencode: function (e) {
var t = encodeURIComponent;
if (r.isString(e)) return t(e);
var n;
if (r.isArray(e)) n = e.map(function (e) {
return t(e[0]) + "=" + t(e[1])
}); else {
n = [];
for (var i in e) e.hasOwnProperty(i) && n.push(t(i) + "=" + t(e[i]))
}
return n.join("&")
}, urlize: function (e, t, n) {
isNaN(t) && (t = 1 / 0);
var i = n === !0 ? ' rel="nofollow"' : "", r = /^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,
s = /^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i, o = /^https?:\/\/.*$/, a = /^www\./,
l = /\.(?:org|net|com)(?:\:|\/|$)/, c = e.split(/(\s+)/).filter(function (e) {
return e && e.length
}).map(function (e) {
var n = e.match(r), c = n && n[1] || e;
return o.test(c) ? '<a href="' + c + '"' + i + ">" + c.substr(0, t) + "</a>" : a.test(c) ? '<a href="http://' + c + '"' + i + ">" + c.substr(0, t) + "</a>" : s.test(c) ? '<a href="mailto:' + c + '">' + c + "</a>" : l.test(c) ? '<a href="http://' + c + '"' + i + ">" + c.substr(0, t) + "</a>" : e
});
return c.join("")
}, wordcount: function (e) {
e = i(e, "");
var t = e ? e.match(/\w+/g) : null;
return t ? t.length : null
}, "float": function (e, t) {
var n = parseFloat(e);
return isNaN(n) ? t : n
}, "int": function (e, t) {
var n = parseInt(e, 10);
return isNaN(n) ? t : n
}
};
o.d = o["default"], o.e = o.escape, e.exports = o
}, function (e, t, n) {
"use strict";
var i = n(15), r = n(16), s = i.extend({
init: function (e, t) {
this.baseURL = e || ".", t = t || {}, this.useCache = !!t.useCache, this.async = !!t.async
}, resolve: function (e, t) {
throw new Error("relative templates not support in the browser yet")
}, getSource: function (e, t) {
var n, i = this.useCache;
return this.fetch(this.baseURL + "/" + e, function (r, s) {
if (r) if (t) t(r.content); else {
if (404 !== r.status) throw r.content;
n = null
} else n = {src: s, path: e, noCache: !i}, t && t(null, n)
}), n
}, fetch: function (e, t) {
var n, i = !0;
window.XMLHttpRequest ? n = new XMLHttpRequest : window.ActiveXObject && (n = new ActiveXObject("Microsoft.XMLHTTP")), n.onreadystatechange = function () {
4 === n.readyState && i && (i = !1, 0 === n.status || 200 === n.status ? t(null, n.responseText) : t({
status: n.status,
content: n.responseText
}))
}, e += (-1 === e.indexOf("?") ? "?" : "&") + "s=" + (new Date).getTime(), n.open("GET", e, this.async), n.send()
}
});
e.exports = {WebLoader: s, PrecompiledLoader: r}
}, function (e, t, n) {
"use strict";
var i = n(3), r = n(6), s = n(1), o = r.extend({
on: function (e, t) {
this.listeners = this.listeners || {}, this.listeners[e] = this.listeners[e] || [], this.listeners[e].push(t)
}, emit: function (e) {
var t = Array.prototype.slice.call(arguments, 1);
this.listeners && this.listeners[e] && s.each(this.listeners[e], function (e) {
e.apply(null, t)
})
}, resolve: function (e, t) {
return i.resolve(i.dirname(e), t)
}, isRelative: function (e) {
return 0 === e.indexOf("./") || 0 === e.indexOf("../")
}
});
e.exports = o
}, function (e, t, n) {
"use strict";
var i = n(15), r = i.extend({
init: function (e) {
this.precompiled = e || {}
}, getSource: function (e) {
return this.precompiled[e] ? {src: {type: "code", obj: this.precompiled[e]}, path: e} : null
}
});
e.exports = r
}, function (e, t) {
"use strict";
function n(e) {
var t = -1;
return {
current: null, reset: function () {
t = -1, this.current = null
}, next: function () {
return t++, t >= e.length && (t = 0), this.current = e[t], this.current
}
}
}
function i(e) {
e = e || ",";
var t = !0;
return function () {
var n = t ? "" : e;
return t = !1, n
}
}
function r() {
return {
range: function (e, t, n) {
"undefined" == typeof t ? (t = e, e = 0, n = 1) : n || (n = 1);
var i, r = [];
if (n > 0) for (i = e; t > i; i += n) r.push(i); else for (i = e; i > t; i += n) r.push(i);
return r
}, cycler: function () {
return n(Array.prototype.slice.call(arguments))
}, joiner: function (e) {
return i(e)
}
}
}
e.exports = r
}, function (e, t) {
function n() {
"use strict";
var e = this.runtime, t = this.lib, n = e.contextOrFrameLookup;
e.contextOrFrameLookup = function (e, t, i) {
var r = n.apply(this, arguments);
if (void 0 === r) switch (i) {
case"True":
return !0;
case"False":
return !1;
case"None":
return null
}
return r
};
var i = e.memberLookup, r = {
pop: function (e) {
if (void 0 === e) return this.pop();
if (e >= this.length || 0 > e) throw new Error("KeyError");
return this.splice(e, 1)
}, remove: function (e) {
for (var t = 0; t < this.length; t++) if (this[t] === e) return this.splice(t, 1);
throw new Error("ValueError")
}, count: function (e) {
for (var t = 0, n = 0; n < this.length; n++) this[n] === e && t++;
return t
}, index: function (e) {
var t;
if (-1 === (t = this.indexOf(e))) throw new Error("ValueError");
return t
}, find: function (e) {
return this.indexOf(e)
}, insert: function (e, t) {
return this.splice(e, 0, t)
}
}, s = {
items: function () {
var e = [];
for (var t in this) e.push([t, this[t]]);
return e
}, values: function () {
var e = [];
for (var t in this) e.push(this[t]);
return e
}, keys: function () {
var e = [];
for (var t in this) e.push(t);
return e
}, get: function (e, t) {
var n = this[e];
return void 0 === n && (n = t), n
}, has_key: function (e) {
return this.hasOwnProperty(e)
}, pop: function (e, t) {
var n = this[e];
if (void 0 === n && void 0 !== t) n = t; else {
if (void 0 === n) throw new Error("KeyError");
delete this[e]
}
return n
}, popitem: function () {
for (var e in this) {
var t = this[e];
return delete this[e], [e, t]
}
throw new Error("KeyError")
}, setdefault: function (e, t) {
return e in this ? this[e] : (void 0 === t && (t = null), this[e] = t)
}, update: function (e) {
for (var t in e) this[t] = e[t];
return null
}
};
s.iteritems = s.items, s.itervalues = s.values, s.iterkeys = s.keys, e.memberLookup = function (e, n, o) {
return e = e || {}, t.isArray(e) && r.hasOwnProperty(n) ? function () {
return r[n].apply(e, arguments)
} : t.isObject(e) && s.hasOwnProperty(n) ? function () {
return s[n].apply(e, arguments)
} : i.apply(this, arguments)
}
}
e.exports = n
}]);