You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
70 KiB
9 lines
70 KiB
/*! jsviews.js v0.9.80 (Beta) single-file version: http://jsviews.com/ */
|
|
/*! includes JsRender, JsObservable and JsViews - see: http://jsviews.com/#download */
|
|
!function (e, t) { var n = t.jQuery; "object" == typeof exports ? module.exports = n ? e(t, n) : function (n) { return e(t, n) } : "function" == typeof define && define.amd ? define(["jquery"], function (n) { return e(t, n) }) : e(t, !1) }(function (e, t) {
|
|
"use strict"; function n(e, t) { return function () { var n, r = this, i = r.base; return r.base = e, n = t.apply(r, arguments), r.base = i, n } } function r(e, t) { return Oe(t) && (t = n(e ? e._d ? e : n(a, e) : a, t), t._d = 1), t } function i(e, t) { for (var n in t.props) vt.test(n) && (e[n] = r(e[n], t.props[n])) } function o(e) { return e } function a() { return "" } function s(e) { try { throw console.log("JsRender dbg breakpoint: " + e), "dbg breakpoint" } catch (t) { } return this.base ? this.baseApply(arguments) : e } function l(e) { this.name = (t.link ? "JsViews" : "JsRender") + " Error", this.message = e || this.name } function d(e, t) { for (var n in t) e[n] = t[n]; return e } function p(e, t, n) { return e ? qe(e) ? p.apply(Me, e) : (ze.delimiters = [e, t, et = n ? n.charAt(0) : et], Xe = e.charAt(0), Ze = e.charAt(1), Ge = t.charAt(0), Ye = t.charAt(1), e = "\\" + Xe + "(\\" + et + ")?\\" + Ze, t = "\\" + Ge + "\\" + Ye, Be = "(?:(\\w+(?=[\\/\\s\\" + Ge + "]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\" + Ge + "]|\\" + Ge + "(?!\\" + Ye + "))*?)", Je.rTag = "(?:" + Be + ")", Be = new RegExp("(?:" + e + Be + "(\\/)?|\\" + Xe + "(\\" + et + ")?\\" + Ze + "(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))" + t, "g"), Je.rTmpl = new RegExp("<.*>|([^\\\\]|^)[{}]|" + e + ".*" + t), We) : ze.delimiters } function c(e, t) { t || e === !0 || (t = e, e = void 0); var n, r, i, o, a = this, s = !t || "root" === t; if (e) { if (o = t && a.type === t && a, !o) if (n = a.views, a._.useKey) { for (r in n) if (o = t ? n[r].get(e, t) : n[r]) break } else for (r = 0, i = n.length; !o && i > r; r++) o = t ? n[r].get(e, t) : n[r] } else if (s) for (; a.parent;) o = a, a = a.parent; else for (; a && !o;) o = a.type === t ? a : void 0, a = a.parent; return o } function f() { var e = this.get("item"); return e ? e.index : void 0 } function u() { return this.index } function v(t, n) { var r, i, o = this, a = o.ctx; if (a && (a = a[t]), void 0 === a && (a = Ke[t]), a && a._cp) { if (n) return i = Je._ceo(a[1].deps), i.unshift(a[0].data), i._cp = !0, i; a = Me.getCtx(a) } return a && Oe(a) && !a._wrp && (r = function () { return a.apply(this && this !== e ? this : o, arguments) }, r._wrp = o, d(r, a)), r || a } function g(e) { return e && (e.fn ? e : this.getRsc("templates", e) || De(e)) } function h(e, t, n, r) { var o, a, s = "number" == typeof n && t.tmpl.bnds[n - 1], l = t.linkCtx; return void 0 !== r ? n = r = { props: {}, args: [r] } : s && (n = s(t.data, t, Je)), a = n.args[0], (e || s) && (o = l && l.tag, o || (o = d(new Je._tg, { _: { inline: !l, bnd: s, unlinked: !0 }, tagName: ":", cvt: e, flow: !0, tagCtx: n }), l && (l.tag = o, o.linkCtx = l), n.ctx = U(n.ctx, (l ? l.view : t).ctx)), o._er = r && a, i(o, n), n.view = t, o.ctx = n.ctx || o.ctx || {}, n.ctx = void 0, a = o.cvtArgs("true" !== e && e)[0], a = s && t._.onRender ? t._.onRender(a, t, o) : a), void 0 != a ? a : "" } function _(e) { var t = this, n = t.tagCtx, r = n.view, i = n.args; return e = e || t.convert, e = e && ("" + e === e ? r.getRsc("converters", e) || F("Unknown converter: '" + e + "'") : e), i = i.length || n.index ? e ? i.slice() : i : [r.data], e && (e.depends && (t.depends = Je.getDeps(t.depends, t, e.depends, e)), i[0] = e.apply(t, i)), i } function m(e, t) { for (var n, r, i = this; void 0 === n && i;) r = i.tmpl && i.tmpl[e], n = r && r[t], i = i.parent; return n || Me[e][t] } function b(e, t, n, r, o, a) { t = t || Fe; var s, l, d, p, c, f, u, v, g, h, _, m, b, x, y, w, k, C, j, A = "", I = t.linkCtx || 0, E = t.ctx, T = n || t.tmpl, S = "number" == typeof r && t.tmpl.bnds[r - 1]; for ("tag" === e._is ? (s = e, e = s.tagName, r = s.tagCtxs, d = s.template) : (l = t.getRsc("tags", e) || F("Unknown tag: {{" + e + "}} "), d = l.template), void 0 !== a ? (A += a, r = a = [{ props: {}, args: [] }]) : S && (r = S(t.data, t, Je)), v = r.length, u = 0; v > u; u++) h = r[u], (!I || !I.tag || u && !I.tag._.inline || s._er) && ((m = T.tmpls && h.tmpl) && (m = h.content = T.tmpls[m - 1]), h.index = u, h.tmpl = m, h.render = N, h.view = t, h.ctx = U(h.ctx, E)), (n = h.props.tmpl) && (h.tmpl = t.getTmpl(n)), s || (s = new l._ctr, b = !!s.init, s.parent = f = E && E.tag, s.tagCtxs = r, j = s.dataMap, I && (s._.inline = !1, I.tag = s, s.linkCtx = I), (s._.bnd = S || I.fn) ? s._.arrVws = {} : s.dataBoundOnly && F("{^{" + e + "}} tag must be data-bound")), r = s.tagCtxs, j = s.dataMap, h.tag = s, j && r && (h.map = r[u].map), s.flow || (_ = h.ctx = h.ctx || {}, p = s.parents = _.parentTags = E && U(_.parentTags, E.parentTags) || {}, f && (p[f.tagName] = f), p[s.tagName] = _.tag = s); if (!(s._er = a)) { for (i(s, r[0]), s.rendering = {}, u = 0; v > u; u++) h = s.tagCtx = r[u], k = h.props, w = s.cvtArgs(), (x = k.dataMap || j) && (w.length || k.dataMap) && (y = h.map, y && y.src === w[0] && !o || (y && y.src && y.unmap(), y = h.map = x.map(w[0], k, void 0, !s._.bnd)), w = [y.tgt]), s.ctx = h.ctx, u || (b && (C = s.template, s.init(h, I, s.ctx), b = void 0), I && (I.attr = s.attr = I.attr || s.attr), c = s.attr, s._.noVws = c && c !== mt), g = void 0, s.render && (g = s.render.apply(s, w)), w.length || (w = [t]), void 0 === g && (g = h.render(w[0], !0) || (o ? void 0 : "")), A = A ? A + (g || "") : g; s.rendering = void 0 } return s.tagCtx = r[0], s.ctx = s.tagCtx.ctx, s._.noVws && s._.inline && (A = "text" === c ? Ue.html(A) : ""), S && t._.onRender ? t._.onRender(A, t, s) : A } function x(e, t, n, r, i, o, a, s) { var l, d, p, c = this, u = "array" === t; c.content = s, c.views = u ? [] : {}, c.parent = n, c.type = t || "top", c.data = r, c.tmpl = i, p = c._ = { key: 0, useKey: u ? 0 : 1, id: "" + ht++, onRender: a, bnds: {} }, c.linked = !!a, n ? (l = n.views, d = n._, d.useKey ? (l[p.key = "_" + d.useKey++] = c, c.index = wt, c.getIndex = f) : l.length === (p.key = c.index = o) ? l.push(c) : l.splice(o, 0, c), c.ctx = e || n.ctx) : c.ctx = e } function y(e) { var t, n, r; for (t in At) n = t + "s", e[n] && (r = e[n], e[n] = {}, Me[n](r, e)) } function w(e, t, n) { function i() { var t = this; t._ = { inline: !0, unlinked: !0 }, t.tagName = e } var o, a, s, l = new Je._tg; if (Oe(t) ? t = { depends: t.depends, render: t } : "" + t === t && (t = { template: t }), a = t.baseTag) { t.flow = !!t.flow, t.baseTag = a = "" + a === a ? n && n.tags[a] || He[a] : a, l = d(l, a); for (s in t) l[s] = r(a[s], t[s]) } else l = d(l, t); return void 0 !== (o = l.template) && (l.template = "" + o === o ? De[o] || De(o) : o), l.init !== !1 && ((i.prototype = l).constructor = l._ctr = i), n && (l._parentTmpl = n), l } function k(e) { return this.base.apply(this, e) } function C(e, n, r, i) { function o(n) { var o, s; if ("" + n === n || n.nodeType > 0 && (a = n)) { if (!a) if (/^\.\/[^\\:*?"<>]*$/.test(n)) (s = De[e = e || n]) ? n = s : a = document.getElementById(n); else if (t.fn && !Je.rTmpl.test(n)) try { a = t(document).find(n)[0] } catch (l) { } a && (i ? n = a.innerHTML : (o = a.getAttribute(xt), o ? o !== yt ? (n = De[o], delete De[o]) : t.fn && (n = t.data(a)[yt]) : (e = e || (t.fn ? yt : n), n = C(e, a.innerHTML, r, i)), n.tmplName = e = e || o, e !== yt && (De[e] = n), a.setAttribute(xt, e), t.fn && t.data(a, yt, n))), a = void 0 } else n.fn || (n = void 0); return n } var a, s, l = n = n || ""; return 0 === i && (i = void 0, l = o(l)), i = i || (n.markup ? n : {}), i.tmplName = e, r && (i._parentTmpl = r), !l && n.markup && (l = o(n.markup)) && l.fn && (l = l.markup), void 0 !== l ? (l.fn || n.fn ? l.fn && (s = l) : (n = E(l, i), R(l.replace(lt, "\\$&"), n)), s || (s = d(function () { return s.render.apply(s, arguments) }, n), y(s)), e && !r && e !== yt && (kt[e] = s), s) : void 0 } function j(e, n) { return t.isFunction(e) ? e.call(n) : e } function A(e) { var t, n = [], r = e.length; for (t = 0; r > t; t++) n.push(e[t].unmap()); return n } function I(e, n) { function r(e) { p.apply(this, e) } function i() { return new r(arguments) } function o(e, t) { var n, r, i, o, a, s = f.length; for (n = 0; s > n; n++) o = f[n], r = void 0, o + "" !== o && (r = o, o = r.getter), void 0 === (a = e[o]) && r && void 0 !== (i = r.defaultVal) && (a = j(i, e)), t(a, r && c[r.type], o) } function a(t) { t = t + "" === t ? JSON.parse(t) : t; var n, r, i, a = t, d = []; if (qe(t)) { for (t = t || [], r = t.length, n = 0; r > n; n++) d.push(this.map(t[n])); return d._is = e, d.unmap = l, d.merge = s, d } if (t) { o(t, function (e, t) { t && (e = t.map(e)), d.push(e) }), a = this.apply(this, d); for (i in t) i === Pe || x[i] || (a[i] = t[i]) } return a } function s(e) { e = e + "" === e ? JSON.parse(e) : e; var t, n, r, a, s, l, d, p, c, f, u = this; if (qe(u)) { for (p = {}, f = [], r = e.length, a = u.length, t = 0; r > t; t++) { for (c = e[t], d = !1, n = 0; a > n && !d; n++) p[n] || (l = u[n], v && (p[n] = d = v + "" === v ? c[v] && (x[v] ? l[v]() : l[v]) === c[v] : v(l, c))); d ? (l.merge(c), f.push(l)) : f.push(i.map(c)) } return void (b ? b(u).refresh(f, !0) : u.splice.apply(u, [0, u.length].concat(f))) } o(e, function (e, t, n) { t ? u[n]().merge(e) : u[n](e) }); for (s in e) s === Pe || x[s] || (u[s] = e[s]) } function l() { var e, n, r, i, o, a, s = this; if (qe(s)) return A(s); for (e = {}, i = f.length, r = 0; i > r; r++) n = f[r], o = void 0, n + "" !== n && (o = n, n = o.getter), a = s[n](), e[n] = o && a && c[o.type] ? qe(a) ? A(a) : a.unmap() : a; for (n in s) "_is" === n || x[n] || n === Pe || "_" === n.charAt(0) && x[n.slice(1)] || t.isFunction(s[n]) || (e[n] = s[n]); return e } var d, p, c = this, f = n.getters, u = n.extend, v = n.id, g = t.extend({ _is: e || "unnamed", unmap: l, merge: s }, u), h = "", _ = "", m = f ? f.length : 0, b = t.observable, x = {}; for (r.prototype = g, d = 0; m > d; d++) !function (e) { e = e.getter || e, x[e] = d + 1; var t = "_" + e; h += (h ? "," : "") + e, _ += "this." + t + " = " + e + ";\n", g[e] = g[e] || function (n) { return arguments.length ? void (b ? b(this).setProperty(e, n) : this[t] = n) : this[t] }, b && (g[e].set = g[e].set || function (e) { this[t] = e }) }(f[d]); return p = new Function(h, _.slice(0, -1)), p.prototype = g, g.constructor = p, i.map = a, i.getters = f, i.extend = u, i.id = v, i } function E(e, n) { var r, i = Qe._wm || {}, o = d({ tmpls: [], links: {}, bnds: [], _is: "template", render: N }, n); return o.markup = e, n.htmlTag || (r = ct.exec(e), o.htmlTag = r ? r[1].toLowerCase() : ""), r = i[o.htmlTag], r && r !== i.div && (o.markup = t.trim(o.markup)), o } function T(e, t) { function n(i, o, a) { var s, l, d, p; if (i && typeof i === bt && !i.nodeType && !i.markup && !i.getTgt && !("viewModel" === e && i.getters || i.extend)) { for (d in i) n(d, i[d], o); return o || Me } return void 0 === o && (o = i, i = void 0), i && "" + i !== i && (a = o, o = i, i = void 0), p = a ? "viewModel" === e ? a : a[r] = a[r] || {} : n, l = t.compile, null === o ? i && delete p[i] : (o = l ? l.call(p, i, o, a, 0) : o, i && (p[i] = o)), l && o && (o._is = e), o && (s = Je.onStore[e]) && s(i, o, l), o } var r = e + "s"; Me[r] = n } function S(e) { We[e] = function (t) { return arguments.length ? (ze[e] = t, We) : ze[e] } } function V(e) { function t(t, n) { this.tgt = e.getTgt(t, n) } return Oe(e) && (e = { getTgt: e }), e.baseMap && (e = d(d({}, e.baseMap), e)), e.map = function (e, n) { return new t(e, n) }, e } function N(e, t, n, r, i, o) { var a, s, l, d, p, c, f, u, v = r, g = ""; if (t === !0 ? (n = t, t = void 0) : typeof t !== bt && (t = void 0), (l = this.tag) ? (p = this, v = v || p.view, d = v.getTmpl(l.template || p.tmpl), arguments.length || (e = v)) : d = this, d) { if (!v && e && "view" === e._is && (v = e), v && e === v && (e = v.data), c = !v, nt = nt || c, v || ((t = t || {}).root = e), !nt || Qe.useViews || d.useViews || v && v !== Fe) g = L(d, e, t, n, v, i, o, l); else { if (v ? (f = v.data, u = v.index, v.index = wt) : (v = Fe, v.data = e, v.ctx = t), qe(e) && !n) for (a = 0, s = e.length; s > a; a++) v.index = a, v.data = e[a], g += d.fn(e[a], v, Je); else v.data = e, g += d.fn(e, v, Je); v.data = f, v.index = u } c && (nt = void 0) } return g } function L(e, t, n, r, i, o, a, s) { function l(e) { y = d({}, n), y[b] = e } var p, c, f, u, v, g, h, _, m, b, y, w, k = ""; if (s && (m = s.tagName, w = s.tagCtx, n = n ? U(n, s.ctx) : s.ctx, e === i.content ? h = e !== i.ctx._wrp ? i.ctx._wrp : void 0 : e !== w.content ? e === s.template ? (h = w.tmpl, n._wrp = w.content) : h = w.content || i.content : h = i.content, w.props.link === !1 && (n = n || {}, n.link = !1), (b = w.props.itemVar) && ("~" !== b.charAt(0) && M("Use itemVar='~myItem'"), b = b.slice(1))), i && (a = a || i._.onRender, n = U(n, i.ctx)), o === !0 && (g = !0, o = 0), a && (n && n.link === !1 || s && s._.noVws) && (a = void 0), _ = a, a === !0 && (_ = void 0, a = i._.onRender), n = e.helpers ? U(e.helpers, n) : n, y = n, qe(t) && !r) for (f = g ? i : void 0 !== o && i || new x(n, "array", i, t, e, o, a), i && i._.useKey && (f._.bnd = !s || s._.bnd && s), b && (f.it = b), b = f.it, p = 0, c = t.length; c > p; p++) b && l(t[p]), u = new x(y, "item", f, t[p], e, (o || 0) + p, a, h), v = e.fn(t[p], u, Je), k += f._.onRender ? f._.onRender(v, u) : v; else b && l(t), f = g ? i : new x(y, m || "data", i, t, e, o, a, h), s && !s.flow && (f.tag = s), k += e.fn(t, f, Je); return _ ? _(k, f) : k } function B(e, t, n) { var r = void 0 !== n ? Oe(n) ? n.call(t.data, e, t) : n || "" : "{Error: " + e.message + "}"; return ze.onError && void 0 !== (n = ze.onError.call(t.data, e, n && r, t)) && (r = n), t && !t.linkCtx ? Ue.html(r) : r } function F(e) { throw new Je.Err(e) } function M(e) { F("Syntax error\n" + e) } function R(e, t, n, r, i) { function o(t) { t -= g, t && _.push(e.substr(g, t).replace(at, "\\n")) } function a(t, n) { t && (t += "}}", M((n ? "{{" + n + "}} block has {{/" + t + " without {{" + t : "Unmatched or missing {{/" + t) + ", in template:\n" + e)) } function s(s, l, d, f, v, b, x, y, w, k, C, j) { (x && l || w && !d || y && ":" === y.slice(-1) || k) && M(s), b && (v = ":", f = mt), w = w || n && !i; var A = (l || n) && [[]], I = "", E = "", T = "", S = "", V = "", N = "", L = "", B = "", F = !w && !v; d = d || (y = y || "#data", v), o(j), g = j + s.length, x ? u && _.push(["*", "\n" + y.replace(/^:/, "ret+= ").replace(st, "$1") + ";\n"]) : d ? ("else" === d && (pt.test(y) && M('for "{{else if expr}}" use "{{else expr}}"'), A = m[7] && [[]], m[8] = e.substring(m[8], j), m = h.pop(), _ = m[2], F = !0), y && q(y.replace(at, " "), A, t).replace(dt, function (e, t, n, r, i, o, a, s) { return r = "'" + i + "':", a ? (E += o + ",", S += "'" + s + "',") : n ? (T += r + "j._cp(" + o + ',"' + s + '",view),', N += r + "'" + s + "',") : t ? L += o : ("trigger" === i && (B += o), I += r + o + ",", V += r + "'" + s + "',", c = c || vt.test(i)), "" }).slice(0, -1), A && A[0] && A.pop(), p = [d, f || !!r || c || "", F && [], P(S || (":" === d ? "'#data'," : ""), V, N), P(E || (":" === d ? "data," : ""), I, T), L, B, A || 0], _.push(p), F && (h.push(m), m = p, m[8] = g)) : C && (a(C !== m[0] && "else" !== m[0] && C, m[0]), m[8] = e.substring(m[8], j), m = h.pop()), a(!m && C), _ = m[2] } var l, d, p, c, f, u = ze.allowCode || t && t.allowCode || We.allowCode === !0, v = [], g = 0, h = [], _ = v, m = [, , v]; if (u && t._is && (t.allowCode = u), n && (void 0 !== r && (e = e.slice(0, -r.length - 2) + Ye), e = Xe + e + Ye), a(h[0] && h[0][2].pop()[0]), e.replace(Be, s), o(e.length), (g = v[v.length - 1]) && a("" + g !== g && +g[8] === g[8] && g[0]), n) { for (d = D(v, e, n), f = [], l = v.length; l--;) f.unshift(v[l][7]); $(d, f) } else d = D(v, t); return d } function $(e, t) { var n, r, i = 0, o = t.length; for (e.deps = []; o > i; i++) { r = t[i]; for (n in r) "_jsvto" !== n && r[n].length && (e.deps = e.deps.concat(r[n])) } e.paths = r } function P(e, t, n) { return [e.slice(0, -1), t.slice(0, -1), n.slice(0, -1)] } function O(e, t) { return "\n " + (t ? t + ":{" : "") + "args:[" + e[0] + "]" + (e[1] || !t ? ",\n props:{" + e[1] + "}" : "") + (e[2] ? ",\n ctx:{" + e[2] + "}" : "") } function q(e, t, n) { function r(r, _, m, b, x, y, w, k, C, j, A, I, E, T, S, V, N, L, B, F) { function $(e, n, r, a, s, l, c, f) { var u = "." === r; if (r && (x = x.slice(n.length), /^\.?constructor$/.test(f || x) && M(e), u || (e = (a ? 'view.hlp("' + a + '")' : s ? "view" : "data") + (f ? (l ? "." + l : a ? "" : s ? "" : "." + r) + (c || "") : (f = a ? "" : s ? l || "" : r, "")), e += f ? "." + f : "", e = n + ("view.data" === e.slice(0, 9) ? e.slice(5) : e)), d)) { if (q = "linkTo" === i ? o = t._jsvto = t._jsvto || [] : p.bd, D = u && q[q.length - 1]) { if (D._jsv) { for (; D.sb;) D = D.sb; D.bnd && (x = "^" + x.slice(1)), D.sb = x, D.bnd = D.bnd || "^" === x.charAt(0) } } else q.push(x); h[v] = B + (u ? 1 : 0) } return e } b && !k && (x = b + x), y = y || "", m = m || _ || I, x = x || C, j = j || N || ""; var P, O, q, D, U, K = ")"; if ("[" === j && (j = "[j._sq(", K = ")]"), !w || l || s) { if (d && V && !l && !s && (!i || a || o) && (P = h[v - 1], F.length - 1 > B - (P || 0))) { if (P = F.slice(P, B + r.length), O !== !0) if (q = o || c[v - 1].bd, D = q[q.length - 1], D && D.prm) { for (; D.sb && D.sb.prm;) D = D.sb; U = D.sb = { path: D.sb, bnd: D.bnd } } else q.push(U = { path: q.pop() }); V = Ze + ":" + P + " onerror=''" + Ge, O = u[V], O || (u[V] = !0, u[V] = O = R(V, n, !0)), O !== !0 && U && (U._jsv = O, U.prm = p.bd, U.bnd = U.bnd || U.path && U.path.indexOf("^") >= 0) } return l ? (l = !E, l ? r : I + '"') : s ? (s = !T, s ? r : I + '"') : (m ? (h[v] = B++, p = c[++v] = { bd: [] }, m) : "") + (L ? v ? "" : (f = F.slice(f, B), (i ? (i = a = o = !1, "\b") : "\b,") + f + (f = B + r.length, d && t.push(p.bd = []), "\b")) : k ? (v && M(e), d && t.pop(), i = x, a = b, f = B + r.length, b && (d = p.bd = t[i] = []), x + ":") : x ? x.split("^").join(".").replace(it, $) + (j ? (p = c[++v] = { bd: [] }, g[v] = K, j) : y) : y ? y : S ? (S = g[v] || S, g[v] = !1, p = c[--v], S + (j ? (p = c[++v], g[v] = K, j) : "")) : A ? (g[v] || M(e), ",") : _ ? "" : (l = E, s = T, '"')) } M(e) } var i, o, a, s, l, d = t && t[0], p = { bd: d }, c = { 0: p }, f = 0, u = (n ? n.links : d && (d.links = d.links || {})) || Fe.tmpl.links, v = 0, g = {}, h = {}, _ = (e + (n ? " " : "")).replace(ot, r); return !v && _ || M(e) } function D(e, t, n) { var r, i, o, a, s, l, d, p, c, f, u, v, g, h, _, m, b, x, y, w, k, C, j, A, I, T, S, V, N, L, B = 0, F = Qe.useViews || t.useViews || t.tags || t.templates || t.helpers || t.converters, R = "", P = {}, q = e.length; for ("" + t === t ? (x = n ? 'data-link="' + t.replace(at, " ").slice(1, -1) + '"' : t, t = 0) : (x = t.tmplName || "unnamed", t.allowCode && (P.allowCode = !0), t.debug && (P.debug = !0), u = t.bnds, b = t.tmpls), r = 0; q > r; r++) if (i = e[r], "" + i === i) R += '\n+"' + i + '"'; else if (o = i[0], "*" === o) R += ";\n" + i[1] + "\nret=ret"; else { if (a = i[1], k = !n && i[2], s = O(i[3], "params") + "}," + O(g = i[4]), V = i[5], L = i[6], C = i[8] && i[8].replace(st, "$1"), (I = "else" === o) ? v && v.push(i[7]) : (B = 0, u && (v = i[7]) && (v = [v], B = u.push(1))), F = F || g[1] || g[2] || v || /view.(?!index)/.test(g[0]), (T = ":" === o) ? a && (o = a === mt ? ">" : a + o) : (k && (y = E(C, P), y.tmplName = x + "/" + o, y.useViews = y.useViews || F, D(k, y), F = y.useViews, b.push(y)), I || (w = o, F = F || o && (!He[o] || !He[o].flow), A = R, R = ""), j = e[r + 1], j = j && "else" === j[0]), N = V ? ";\ntry{\nret+=" : "\n+", h = "", _ = "", T && (v || L || a && a !== mt)) { if (S = new Function("data,view,j,u", " // " + x + " " + B + " " + o + "\nreturn {" + s + "};"), S._er = V, S._tag = o, n) return S; $(S, v), m = 'c("' + a + '",view,', f = !0, h = m + B + ",", _ = ")" } if (R += T ? (n ? (V ? "try{\n" : "") + "return " : N) + (f ? (f = void 0, F = c = !0, m + (v ? (u[B - 1] = S, B) : "{" + s + "}") + ")") : ">" === o ? (d = !0, "h(" + g[0] + ")") : (p = !0, "((v=" + g[0] + ")!=null?v:" + (n ? "null)" : '"")'))) : (l = !0, "\n{view:view,tmpl:" + (k ? b.length : "0") + "," + s + "},"), w && !j) { if (R = "[" + R.slice(0, -1) + "]", m = 't("' + w + '",view,this,', n || v) { if (R = new Function("data,view,j,u", " // " + x + " " + B + " " + w + "\nreturn " + R + ";"), R._er = V, R._tag = w, v && $(u[B - 1] = R, v), n) return R; h = m + B + ",undefined,", _ = ")" } R = A + N + m + (B || R) + ")", v = 0, w = 0 } V && (F = !0, R += ";\n}catch(e){ret" + (n ? "urn " : "+=") + h + "j._err(e,view," + V + ")" + _ + ";}" + (n ? "" : "ret=ret")) } R = "// " + x + "\nvar v" + (l ? ",t=j._tag" : "") + (c ? ",c=j._cnvt" : "") + (d ? ",h=j._html" : "") + (n ? ";\n" : ',ret=""\n') + (P.debug ? "debugger;" : "") + R + (n ? "\n" : ";\nreturn ret;"), ze.debugMode !== !1 && (R = "try {\n" + R + "\n}catch(e){\nreturn j._err(e, view);\n}"); try { R = new Function("data,view,j,u", R) } catch (U) { M("Compiled template code:\n\n" + R + '\n: "' + U.message + '"') } return t && (t.fn = R, t.useViews = !!F), R } function U(e, t) { return e && e !== t ? t ? d(d({}, t), e) : e : t && d({}, t) } function K(e) { return _t[e] || (_t[e] = "&#" + e.charCodeAt(0) + ";") } function H(e) { var t, n, r = []; if (typeof e === bt) for (t in e) n = e[t], t === Pe || Oe(n) || r.push({ key: t, prop: n }); return r } function J(e, n, r) { var i = this.jquery && (this[0] || F('Unknown template: "' + this.selector + '"')), o = i.getAttribute(xt); return N.call(o ? t.data(i)[yt] : De(i), e, n, r) } function z(e) { return void 0 != e ? ut.test(e) && ("" + e).replace(gt, K) || e : "" } function Q(e, n, r) { var i, o, a, s, l, d, p, c, f, u, v, g, h, _, m, b, x, y = e.target, w = y._jsvBnd; if (w) for (; u = zn.exec(w) ;) if ((u = $n[u[1]]) && (m = u.to)) { if (s = u.linkCtx, f = s.view, _ = s.tag, c = t(y), g = f.hlp(un), h = f.hlp(vn), a = te(y), i = In[a], void 0 === r && (r = Oe(a) ? a(y) : i ? c[i]() : c.attr(a)), d = m[1], m = m[0], m = m + "" === m ? [s.data, m] : m, d && (l = Oe(d) ? d : f.getRsc("converters", d)), "SELECT" === s.elem.nodeName && (s.elem._jsvSel = r = r || (s.elem.multiple ? [] : r)), l && (r = l.call(_, r)), v = f.linkCtx, f.linkCtx = s, b = { change: "change", oldValue: s._val, value: r }, !(g && (o = g.call(s, e, b) === !1) || _ && _.onBeforeChange && (o = _.onBeforeChange(e, b) === !1) || void 0 === r) && (p = m[0], void 0 !== r && p)) { if (p._jsv) for (x = p, p = s.data; x && x.sb;) p = s._ctxCb(x, p), x = x.sb; _ && (_._.chging = !0), $e(p).setProperty(m[1], r), h && h.call(s, e, b), _ && (_.onAfterChange && _.onAfterChange(e, b), _._.chging = void 0), s._val = r } f.linkCtx = v } } function W(e, t, n) { var r, i, o, a, s, l, d = this, p = d.tag, c = d.data, f = d.elem, u = d.convert, v = f.parentNode, g = d.view, h = g.linkCtx, _ = g.hlp(un); if (g.linkCtx = d, v && (!_ || !t || _.call(d, e, t) !== !1) && (!t || "*" === e.data.prop || e.data.prop === t.path)) { if (t && (d.eventArgs = t), t || d._toLk) { if (d._toLk = 0, n._er) try { i = n(c, g) } catch (m) { s = n._er, l = B(m, g, new Function("data,view", "return " + s + ";")(c, g)), i = [{ props: {}, args: [l] }] } else i = n(c, g, Je); if (r = X(i, d, p = d.tag, d.attr || te(f, !0, void 0 !== u)), p) { if (a = s || p._er, i = i[0] ? i : [i], o = !a && t && p.onUpdate && p.onUpdate(e, t, i) === !1, xe(p, i, a), o || r === xn) return r === mt && p.onBeforeLink && p.onBeforeLink(), he(p), ie(d, c, f), void (g.linkCtx = h); if (p._.chging) return; i = ":" === p.tagName ? Je._cnvt(p.cvt, g, i[0]) : Je._tag(p, g, g.tmpl, i, !0, l) } else n._tag && (u = "" === u ? wn : u, i = u ? Je._cnvt(u, g, i[0] || i) : Je._tag(n._tag, g, g.tmpl, i, !0, l), Ee(p = d.tag, !0), r = d.attr || r); G(i, d, r, p) && t && (_ = g.hlp(vn)) && _.call(d, e, t), d._noUpd = 0, p && (p._er = s, he(p, t)) } ie(d, c, f), g.linkCtx = h } } function X(e, n, r, i) { var o, a, s, l, d = r && r.parentElem || n.elem; if (void 0 !== e) { if (l = t(d), i = r && r.attr || i, Oe(e) && F(n.expr + ": missing parens"), s = /^css-/.test(i) && i.slice(4)) o = t.style(d, s), +e === e && (o = parseInt(o)); else if ("link" !== i) { if ("value" === i) d.type === _n && (o = l.prop(i = hn)); else if (i === mn) { if (d.value !== "" + e) return i; o = l.prop(hn) } void 0 === o && (a = In[i], o = a ? l[a]() : l.attr(i)) } n._val = o } return i } function Z(e, t) { e._df = t, e[(t ? "set" : "remove") + "Attribute"](jn, "") } function G(n, r, i, o) { var a, s, l, d, p, c, f, u, v, g, h, _, m, b, x = i !== xn && void 0 !== n && !r._noUpd, y = r.data, w = o && o.parentElem || r.elem, k = w.parentNode, C = t(w), j = r.view, A = r._val, I = j.linkCtx, E = o; if (o && (o.parentElem = o.parentElem || r.expr || o._elCnt ? w : k, s = o._prv, l = o._nxt), !x) return void (i === mt && o && o.onBeforeLink && o.onBeforeLink()); if ("visible" === i && (i = "css-display"), /^css-/.test(i)) "visible" === r.attr && (m = (w.currentStyle || Qn.call(e, w, "")).display, n ? (n = w._jsvd || m, n !== xn || (n = Rn[_ = w.nodeName]) || (h = document.createElement(_), document.body.appendChild(h), n = Rn[_] = (h.currentStyle || Qn.call(e, h, "")).display, document.body.removeChild(h))) : (w._jsvd = m, n = xn)), (E = E || A !== n) && t.style(w, i.slice(4), n); else if ("link" !== i) { if (/^data-/.test(i) && t.data(w, i.slice(5), n), i === hn) c = !0, n = n && "false" !== n; else if (i === mn) { if (w.value !== "" + n) return void ie(r, y, w); n = c = !0, i = hn } else "selected" === i || "disabled" === i || "multiple" === i || "readonly" === i ? n = n && "false" !== n ? i : null : "value" === i && "SELECT" === w.nodeName && (w._jsvSel = qe(n) ? n : "" + n); (a = In[i]) ? i === mt ? (j.linkCtx = r, o && o._.inline ? (p = o.nodes(!0), o._elCnt && (s && s !== l ? Ae(s, l, w, o._tgId, "^", !0) : (f = w._df) && (u = o._tgId + "^", v = f.indexOf("#" + u) + 1, g = f.indexOf("/" + u), v && g > 0 && (v += u.length, g > v && (Z(w, f.slice(0, v) + f.slice(g)), Ie(f.slice(v, g))))), s = s ? s.previousSibling : l ? l.previousSibling : w.lastChild), t(p).remove(), o && o.onBeforeLink && o.onBeforeLink(), d = j.link(j.data, w, s, l, n, o && { tag: o._tgId, lazyLink: o.tagCtx.props.lazyLink })) : (x = x && A !== n, x && C.empty(), o && o.onBeforeLink && o.onBeforeLink(), x && (d = j.link(y, w, s, l, n, o && { tag: o._tgId }))), j.linkCtx = I) : ((E = E || A !== n) && ("text" === i && w.children && !w.children[0] ? void 0 !== w.textContent ? w.textContent = n : w.innerText = null === n ? "" : n : C[a](n)), !(b = k._jsvSel) || "value" !== i && C.attr("value") || (w.selected = t.inArray("" + n, qe(b) ? b : [b]) > -1)) : (E = E || A !== n) && C[c ? "prop" : "attr"](i, void 0 !== n || c ? n : null), r._val = n } return d || E } function Y(e, t) { var n = this, r = n.hlp(un), i = n.hlp(vn); if (!r || r.call(this, e, t) !== !1) { if (t) { var o = t.change, a = t.index, s = t.items; switch (n._.srt = t.refresh, o) { case "insert": n.addViews(a, s); break; case "remove": n.removeViews(a, s.length); break; case "move": n.removeViews(t.oldIndex, s.length, void 0, !0), n.addViews(a, s); break; case "refresh": n._.srt = void 0, n.fixIndex(0) } } i && i.call(this, e, t) } } function ee(e) { var n, r, i = e.type, o = e.data, a = e._.bnd; !e._.useKey && a && ((r = e._.bndArr) && (t([r[1]]).off(Bt, r[0]), e._.bndArr = void 0), a !== !!a ? i ? a._.arrVws[e._.id] = e : delete a._.arrVws[e._.id] : i && o && (n = function (t) { t.data && t.data.off || Y.apply(e, arguments) }, t([o]).on(Bt, n), e._.bndArr = [n, o])) } function te(e, t, n) { var r = e.nodeName.toLowerCase(), i = Qe._fe[r] || e.contentEditable === wn && { to: mt, from: mt }; return i ? t ? "input" === r && e.type === mn ? mn : i.to : i.from : t ? n ? "text" : mt : "" } function ne(e, n, r, i, o, a, s) { var l, d, p, c, f, u = e.parentElem, v = e._prv, g = e._nxt, h = e._elCnt; if (v && v.parentNode !== u && F("Missing parentNode"), s) { c = e.nodes(), h && v && v !== g && Ae(v, g, u, e._.id, "_", !0), e.removeViews(void 0, void 0, !0), d = g, h && (v = v ? v.previousSibling : g ? g.previousSibling : u.lastChild), t(c).remove(); for (f in e._.bnds) we(f) } else { if (n) { if (p = i[n - 1], !p) return !1; v = p._nxt } h ? (d = v, v = d ? d.previousSibling : u.lastChild) : d = v.nextSibling } l = r.render(o, a, e._.useKey && s, e, s || n, !0), e.link(o, u, v, d, l, p) } function re(e, t, n) { var r, i; return n ? (i = "^`", Ee(n, !0), r = n._tgId, r || ($n[r = Pn++] = n, n._tgId = "" + r)) : (i = "_`", Ee(dn[r = t._.id] = t)), "#" + r + i + (void 0 != e ? e : "") + "/" + r + i } function ie(e, t, n) { var r, i, o, a, s, l = e.tag, p = e.convertBack, c = [], f = e._bndId || "" + Pn++, u = e._hdl; if (e._bndId = void 0, l && (c = l.depends || c, c = Oe(c) ? l.depends(l) : c, o = l.linkedElem), !e._depends || "" + e._depends != "" + c) { for (e._depends && $e._apply(!1, [t], e._depends, u, !0), a = e.fn.deps.slice(), i = a.length; i--;) s = a[i], s._jsv && (a[i] = d({}, s)); r = $e._apply(!1, [t], a, c, u, e._ctxCb), r.elem = n, r.linkCtx = e, r._tgId = f, n._jsvBnd = n._jsvBnd || "", n._jsvBnd += "&" + f, e._depends = c, e.view._.bnds[f] = f, $n[f] = r, o && (r.to = [[], p]), (o || void 0 !== p) && be(r, l, o && o[0] || n, p), l && (l.onAfterBind && l.onAfterBind(r), l.flow || l._.inline || (n.setAttribute(cn, (n.getAttribute(cn) || "") + "#" + f + "^/" + f + "^"), l._tgId = "" + f)) } if (o && o[0]) for (l._.radio && (o = o.find(bn)), i = o.length; i--;) o[i]._jsvBnd = o[i]._jsvBnd || n._jsvBnd + "+", o[i]._jsvLkEl = l } function oe(e, t, n, r, i, o, a) { return ae(this, e, t, n, r, i, o, a) } function ae(e, n, r, i, o, a, s, l) { if (i === !0 ? (o = i, i = void 0) : i = "object" != typeof i ? void 0 : d({}, i), e && n) { n = n.jquery ? n : t(n), nn || (nn = document.body, t(nn).on(fn, Q).on("blur", "[contenteditable]", Q)); for (var p, c, f, u, v, g, h, _, m, b = re, x = i && "replace" === i.target, y = n.length; y--;) { if (h = n[y], a = a || on(h), (m = a === Fe) && (Fe.data = (Fe.ctx = i || {}).root = r), "" + e === e) le(e, h, a, void 0, !0, r, i); else { if (void 0 !== e.markup) x && (g = h.parentNode), f = e.render(r, i, o, a, void 0, b), g ? (s = h.previousSibling, l = h.nextSibling, t.cleanData([h], !0), g.removeChild(h), h = g) : (s = l = void 0, t(h).empty()); else { if (e !== !0 || a !== Fe) break; _ = { lnk: 1 } } if (h._df && !l) { for (u = fe(h._df, !0, Dn), p = 0, c = u.length; c > p; p++) v = u[p], (v = dn[v.id]) && void 0 !== v.data && v.parent.removeViews(v._.key, void 0, !0); Z(h) } a.link(r, h, s, l, f, _, i) } m && (Fe.data = Fe.ctx = void 0) } } return n } function se(e, n, r, i, o, a, s, l) { function d(e, t, n, r, i, a, s, l, d, p, c, f, v, h) { var _, m, b = ""; return h ? (u = 0, e) : (g = d || p || "", r = r || c, n = n || v, U && !n && (!e || r || g || a && !u) && (U = void 0, D = me.shift()), r = r || n, r && (u = 0, U = void 0, B && (n || v ? Mn[D] || /;svg;|;math;/.test(";" + me.join(";") + ";") || (_ = "'<" + D + ".../") : Mn[r] ? _ = "'</" + r : me.length && r === D || (_ = "Mismatch: '</" + r), _ && M(_ + ">' in:\n" + o)), Q = z, D = me.shift(), z = Bn[D], c = c ? "</" + c + ">" : "", Q && (ge += X, X = "", z ? ge += "-" : (b = c + Cn + "@" + ge + kn + (f || ""), ge = be.shift()))), z ? (a ? X += a : t = c || v || "", g && (t += g, X && (t += " " + cn + '="' + X + '"', X = ""))) : t = a ? t + b + i + (u ? "" : Cn + a + kn) + l + g : b || e, B && s && (u && M("{^{ within elem markup (" + u + ' ). Use data-link="..."'), "#" === a.charAt(0) ? me.unshift(a.slice(1)) : a.slice(1) !== (m = me.shift()) && M("Closing tag for {^{...}} under different elem: <" + m + ">")), g && (u = g, me.unshift(D), D = g.slice(1), B && me[0] && me[0] === Fn[D] && F("Parent of <tr> must be <tbody>"), U = Mn[D], (z = Bn[D]) && !Q && (be.unshift(ge), ge = ""), Q = z, ge && z && (ge += "+")), t) } function p(e, t) { var r, i, o, a, s, l, d, p = []; if (e) { for ("@" === e._tkns.charAt(0) && (t = y.previousSibling, y.parentNode.removeChild(y), y = void 0), b = e.length; b--;) { if (k = e[b], o = k.ch, r = k.path) for (m = r.length - 1; i = r.charAt(m--) ;) "+" === i ? "-" === r.charAt(m) ? (m--, t = t.previousSibling) : t = t.parentNode : t = t.lastChild; "^" === o ? (g = $n[s = k.id]) && (d = t && (!y || y.parentNode !== t), y && !d || (g.parentElem = t), k.elCnt && d && Z(t, (k.open ? "#" : "/") + s + o + (t._df || "")), p.push([d ? null : y, k])) : (w = dn[s = k.id]) && (w.parentElem || (w.parentElem = t || y && y.parentNode || n, w._.onRender = re, w._.onArrayChange = Y, ee(w)), a = w.parentElem, k.open ? (w._elCnt = k.elCnt, t && !y ? Z(t, "#" + s + o + (t._df || "")) : (w._prv || Z(a, pe(a._df, "#" + s + o)), w._prv = y)) : (!t || y && y.parentNode === t ? y && (w._nxt || Z(a, pe(a._df, "/" + s + o)), w._nxt = y) : (Z(t, "/" + s + o + (t._df || "")), w._nxt = void 0), v = w.linkCtx, (l = w.ctx && w.ctx.onAfterCreate || xe) && l.call(v, w))) } for (b = p.length; b--;) _e.push(p[b]) } return !e || e.elCnt } function c(e) { var t, n, r; if (e) for (b = e.length, m = 0; b > m; m++) if (k = e[m], n = g = $n[k.id].linkCtx.tag, r = g.tagName === N, !g.flow || r) { if (!V) { for (t = 1; n = n.parent;) t++; R = R || t } !V && t !== R || N && !r || S.push(g) } } function f() { var a, l, d = "", f = {}, u = sn + (ae ? ",[" + jn + "]" : ""); for (x = Ln ? n.querySelectorAll(u) : t(u, n).get(), _ = x.length, r && r.innerHTML && (j = Ln ? r.querySelectorAll(u) : t(u, r).get(), r = j.length ? j[j.length - 1] : r), R = 0, h = 0; _ > h; h++) if (y = x[h], r && !te) te = y === r; else { if (i && y === i) { ae && (d += ce(y)); break } if (y.parentNode) if (ae) { if (d += ce(y), y._df) { for (a = h + 1; _ > a && y.contains(x[a]) ;) a++; f[a - 1] = y._df } f[h] && (d += f[h] || "") } else oe && (k = fe(y, void 0, Kn)) && (k = k[0]) && (ne = ne ? k.id !== ne && ne : k.open && k.id), !ne && ye(fe(y)) && y.getAttribute(an) && _e.push([y]) } if (ae && (d += n._df || "", (l = d.indexOf("#" + ae.id) + 1) && (d = d.slice(l + ae.id.length)), l = d.indexOf("/" + ae.id), l + 1 && (d = d.slice(0, l)), c(fe(d, void 0, Hn))), void 0 === o && n.getAttribute(an) && _e.push([n]), ue(r, z), ue(i, z), ae) return void (ie && ie.resolve()); for (z && ge + X && (y = i, ge && (i ? p(fe(ge + "+", !0), i) : p(fe(ge, !0), n)), p(fe(X, !0), n), i && (d = i.getAttribute(cn), (_ = d.indexOf(G) + 1) && (d = d.slice(_ + G.length - 1)), i.setAttribute(cn, X + d))), _ = _e.length, h = 0; _ > h; h++) y = _e[h], C = y[1], y = y[0], C ? (g = $n[C.id]) && ((v = g.linkCtx) && (g = v.tag, g.linkCtx = v), C.open ? (y && (g.parentElem = y.parentNode, g._prv = y), g._elCnt = C.elCnt, g.onBeforeLink && g.onBeforeLink(), w = g.tagCtx.view, le(void 0, g._prv, w, C.id)) : (g._nxt = y, g._.unlinked && (L = g.tagCtx, w = L.view, he(g)))) : le(y.getAttribute(an), y, on(y), void 0, oe, e, s); ie && ie.resolve() } var u, v, g, h, _, m, b, x, y, w, k, C, j, A, I, E, T, S, V, N, L, B, R, $, P, O, q, D, U, K, H, J, z, Q, W, X, G, te, ne, ie, oe, ae, se = this, de = se._.id + "_", ge = "", _e = [], me = [], be = [], xe = se.hlp(gn), ye = p; if (a && (ie = a.lazyLink && t.Deferred(), a.tmpl ? I = "/" + a._.id + "_" : (oe = a.lnk, a.tag && (de = a.tag + "^", a = !0), (ae = a.get) && (ye = c, S = ae.tags, V = ae.deep, N = ae.name)), a = a === !0), n = n ? "" + n === n ? t(n)[0] : n.jquery ? n[0] : n : se.parentElem || document.body, B = !Qe.noValidate && n.contentEditable !== wn, D = n.tagName.toLowerCase(), z = !!Bn[D], r = r && ve(r, z), i = i && ve(i, z) || null, void 0 != o) { if (H = document.createElement("div"), K = H, G = X = "", W = "http://www.w3.org/2000/svg" === n.namespaceURI ? "svg_ns" : (q = ct.exec(o)) && q[1] || "", z) { for (T = i; T && !(E = fe(T)) ;) T = T.nextSibling; (J = E ? E._tkns : n._df) && (A = I || "", !a && I || (A += "#" + de), m = J.indexOf(A), m + 1 && (m += A.length, G = X = J.slice(0, m), J = J.slice(m), E ? T.setAttribute(cn, J) : Z(n, J))) } if (U = void 0, o = ("" + o).replace(qn, d), B && me.length && M("Mismatched '<" + D + "...>' in:\n" + o), l) return; for (Nn.appendChild(H), W = ln[W] || ln.div, $ = W[0], K.innerHTML = W[1] + o + W[2]; $--;) K = K.lastChild; for (Nn.removeChild(H), P = document.createDocumentFragment() ; O = K.firstChild;) P.appendChild(O); n.insertBefore(P, i) } return ie ? setTimeout(f, 0) : f(), ie && ie.promise() } function le(e, t, n, r, i, o, a) { var s, l, d, p, c, f, u, v, g, h, _, m = []; if (r) v = $n[r], v = v.linkCtx ? v.linkCtx.tag : v, u = v.linkCtx || { type: "inline", data: n.data, elem: v._elCnt ? v.parentElem : t, view: n, ctx: n.ctx, attr: mt, fn: v._.bnd, tag: v, _bndId: r }, de(u, u.fn); else if (e && t) { for (o = i ? o : n.data, s = n.tmpl, e = ge(e, te(t)), _ = rn.lastIndex = 0; l = rn.exec(e) ;) m.push(l), _ = rn.lastIndex; for (_ < e.length && M(e) ; l = m.shift() ;) { for (g = rn.lastIndex, d = l[1], c = l[3]; m[0] && "else" === m[0][4];) c += "}{" + m.shift()[3], h = !0; h && (c += "}{{/" + l[4] + "}"), u = { type: i ? "top" : "link", data: o, elem: t, view: n, ctx: a, attr: d, isLk: i, _toLk: 1, _noUpd: l[2] }, p = void 0, l[6] && (p = l[10] || void 0, u.convert = l[5] || "", !d && void 0 !== p && te(t) && (u.convertBack = p = p.slice(1))), u.expr = d + c, f = s.links[c], f || (s.links[c] = f = Je.tmplFn(c, s, !0, p, h)), u.fn = f, de(u, f), rn.lastIndex = g } } } function de(e, t) { function n(n, r) { W.call(e, n, r, t) } n.noArray = !0, e.isLk && Ee(e.view = new Je.View(Je.extendCtx(e.ctx, e.view.ctx), "link", e.view, e.data, e.expr, void 0, re)), e._ctxCb = Ce(e.view), e._hdl = n, n(!0) } function pe(e, t) { var n; return e ? (n = e.indexOf(t), n + 1 ? e.slice(0, n) + e.slice(n + t.length) : e) : "" } function ce(e) { return e && ("" + e === e ? e : e.tagName === yn ? e.type.slice(3) : 1 === e.nodeType && e.getAttribute(cn) || "") } function fe(e, t, n) { function r(e, t, n, r, o, s) { a.push({ elCnt: i, id: r, ch: o, open: t, close: n, path: s, token: e }) } var i, o, a = []; return (o = t ? e : ce(e)) ? (i = a.elCnt = e.tagName !== yn, i = "@" === o.charAt(0) || i, a._tkns = o, o.replace(n || Jn, r), a) : void 0 } function ue(e, t) { e && ("jsv" === e.type ? e.parentNode.removeChild(e) : t && "" === e.getAttribute(an) && e.removeAttribute(an)) } function ve(e, t) { for (var n = e; t && n && 1 !== n.nodeType;) n = n.previousSibling; return n && (1 !== n.nodeType ? (n = document.createElement(yn), n.type = "jsv", e.parentNode.insertBefore(n, e)) : ce(n) || n.getAttribute(an) || n.setAttribute(an, "")), n } function ge(e, n) { return e = t.trim(e).replace(lt, "\\$&"), e.slice(-1) !== Ge ? e = Ze + ":" + e + (n ? ":" : "") + Ge : e } function he(e, t) { var n, r, i, o, a, s, l = e.tagCtx, d = (l.view, l.props), p = e.linkCtx; if (e.onAfterLink && e.onAfterLink(l, p, t), e._.unlinked = void 0, n = e.targetTag ? e.targetTag.linkedElem : e.linkedElem, !e.noVal && (r = n && n[0])) { if ((i = e._.radio) && (n = n.find(bn)), i || !e._.chging) { if (o = e.cvtArgs()[0], i || r !== p.elem) { for (a = n.length; a--;) r = n[a], s = r._jsvLkEl, e._.inline && (!s || s !== e && s.targetTag !== e) && (r._jsvLkEl = e, be($n[e._tgId], e, r), r._jsvBnd = "&" + e._tgId + "+"), i && (r[hn] = o === r.value); p._val = o } void 0 !== o && (i || void 0 === r.value ? r.contentEditable === wn && (r.innerHTML = o) : r.type === _n ? r[hn] = o && "false" !== o : n.val(o)) } e.setSize && (d.height && n.height(d.height), d.width && n.width(d.width)), d["class"] && n.addClass(d["class"]), d.id && (n[0].id = d.id), d.name && n.attr("name", d.name) } } function _e(e) { setTimeout(function () { Q(e) }, 0) } function me(e, t, n) { t && (t = "" + t === t ? t : "keydown", e[n](t, "keydown" === t ? _e : Q)) } function be(e, n, r, i) { var o, a, s, l, d, p, c, f, u, v, g, h = e.linkCtx, _ = h.data, m = h.fn.paths; if (e && m) { if (f = r._jsvTr || !1, n && (i = n.convertBack || i, c = n.tagCtx.props.trigger), c = void 0 === c ? ze.trigger : c, f !== c && (p = t(r), me(p, f, "off"), me(p, r._jsvTr = ("INPUT" === r.tagName && r.type !== _n && r.type !== mn || "textarea" === r.type || r.contentEditable === wn) && c, "on")), m = (o = m._jsvto) || m[0], a = m && m.length, !a || n && !n.tagCtx.args.length) u = []; else { if (l = m[a - 1], l._jsv) { for (d = l; l.sb && l.sb._jsv;) s = l = l.sb; s = l.sb || s && s.path, l = s ? s.slice(1) : d.path } if (s) u = [d, l]; else { for (; (g = h._ctxCb(s = l.split("^").join("."), _)) && (v = g.length) ;) { if (u = g, u._cp) { if (u = [u[v - 3], u[v - 2]], l = u[1], l._jsv) { for (d = l; l.sb && l.sb._jsv;) s = l = l.sb; s = l.sb || s && s.path, l = s ? s.slice(1) : d.path, u = [d, l] } } else u = v > 2 ? [u[v - 3], u[v - 2]] : [u[v - 2]]; _ = u[0], l = u[1] } u = u || [_, s] } } e.to = [u, i] } } function xe(e, t, n) {
|
|
var r, i, o = e.tagCtx.view, a = e.tagCtxs || [e.tagCtx], s = a.length, l = !t; if (t = t || e._.bnd.call(o.tmpl, (e.linkCtx || o).data, o, Je), n) a = e.tagCtxs = t, e.tagCtx = a[0]; else for (; s--;) r = a[s], i = t[s], $e(r.props).setProperty(i.props), d(r.ctx, i.ctx),
|
|
r.args = i.args, l && (r.tmpl = i.tmpl); return Je._ths(e, a[0]), a
|
|
} function ye(e) { for (var t, n, r, i = [], o = e.length, a = o; a--;) i.push(e[a]); for (a = o; a--;) if (n = i[a], n.parentNode) { if (r = n._jsvBnd) for (r = r.slice(1).split("&"), n._jsvBnd = "", t = r.length; t--;) we(r[t], n._jsvLkEl, n); Ie(ce(n) + (n._df || "")) } } function we(e, n, r) { var i, o, a, s, l, d, p, c, f, u, v, g, h = $n[e]; if (n) r === n.linkedElem[0] && (r._jsvLkEl = void 0, n.linkedElem = void 0); else if (h) { delete $n[e]; for (i in h.bnd) s = h.bnd[i], l = h.cbId, qe(s) ? t([s]).off(Bt + l).off(Lt + l) : t(s).off(Lt + l), delete h.bnd[i]; if (o = h.linkCtx) { if (a = o.tag) { if (d = a.tagCtxs) for (p = d.length; p--;) (c = d[p].map) && c.unmap(); f = a.linkedElem, a.onDispose && a.onDispose(), a._elCnt || (a._prv && a._prv.parentNode.removeChild(a._prv), a._nxt && a._nxt.parentNode.removeChild(a._nxt)) } u = f && f[0] || o.elem, (v = u && u._jsvTr) && (me(f || t(u), v, "off"), u._jsvTr = void 0), g = o.view, "link" === g.type ? g.parent.removeViews(g._.key, void 0, !0) : delete g._.bnds[e] } delete Ft[h.cbId] } } function ke(e) { e ? (e = e.jquery ? e : t(e), e.each(function () { for (var e; (e = on(this, !0)) && e.parent;) e.parent.removeViews(e._.key, void 0, !0); ye(this.getElementsByTagName("*")) }), ye(e)) : (nn && (t(nn).off(fn, Q).off("blur", "[contenteditable]", Q), nn = void 0), Fe.removeViews(), ye(document.body.getElementsByTagName("*"))) } function Ce(e) { return function (t, n, r) { var i, o, a, s, l, d, p; if (e && t) { if (t._jsv) return t._jsv.call(e.tmpl, n, e, Je); if ("~" === t.charAt(0)) return "~tag" === t.slice(0, 4) && (o = e.ctx, "." === t.charAt(4) && (i = t.slice(5).split("."), o = o.tag), i) ? o ? [o, i.join("."), n] : [] : (t = t.slice(1).split("."), (s = e.hlp(l = t.shift(), !0)) && (s._cp ? (t.length && (d = "." + t.join("."), l = s[p = s.length - 1], l._jsv ? (l.sb = d, l.bnd = !!r) : (s[p] = (l + d).replace("#data.", ""), "#view" === l.slice(0, 5) && (s[p] = s[p].slice(6), s.splice(p, 0, e)))), s.push(n), a = s) : (t.length || Oe(s)) && (a = [s, t.join("."), n])), a || []); if ("#" === t.charAt(0)) return "#data" === t ? [] : [e, t.replace(On, ""), n] } } } function je(e) { return e.type === _n ? e[hn] : e.value } function Ae(e, t, n, r, i, o) { var a, s, l, d, p, c, f, u = 0, v = e === t; if (e) { for (l = fe(e) || [], a = 0, s = l.length; s > a; a++) { if (d = l[a], c = d.id, c === r && d.ch === i) { if (!o) break; s = 0 } v || (p = "_" === d.ch ? dn[c] : $n[c].linkCtx.tag, d.open ? p._prv = t : d.close && (p._nxt = t)), u += c.length + 2 } u && e.setAttribute(cn, e.getAttribute(cn).slice(u)), f = t ? t.getAttribute(cn) : n._df, (s = f.indexOf("/" + r + i) + 1) && (f = l._tkns.slice(0, u) + f.slice(s + (o ? -1 : r.length + 1))), f && (t ? t.setAttribute(cn, f) : Z(n, f)) } else Z(n, pe(n._df, "#" + r + i)), o || t || Z(n, pe(n._df, "/" + r + i)) } function Ie(e) { var t, n, r, i; if (i = fe(e, !0, Un)) for (t = 0, n = i.length; n > t; t++) r = i[t], "_" === r.ch ? (r = dn[r.id]) && r.type && r.parent.removeViews(r._.key, void 0, !0) : we(r.id) } function Ee(e, n) { e.contents = function (e, n) { e !== !!e && (n = e, e = void 0); var r, i = t(this.nodes()); return i[0] && (r = n ? i.filter(n) : i, i = e && n ? r.add(i.find(n)) : r), i }, e.nodes = function (e, t, n) { var r, i = this, o = i._elCnt, a = !t && o, s = []; for (t = t || i._prv, n = n || i._nxt, r = a ? t === i._nxt ? i.parentElem.lastSibling : t : i._.inline === !1 ? t || i.linkCtx.elem.firstChild : t && t.nextSibling; r && (!n || r !== n) ;) (e || o || r.tagName !== yn) && s.push(r), r = r.nextSibling; return s }, e.childTags = function (e, t) { e !== !!e && (t = e, e = void 0); var n = this, r = n.link ? n : n.tagCtx.view, i = n._prv, o = n._elCnt, a = []; return r.link(void 0, n.parentElem, o ? i && i.previousSibling : i, n._nxt, void 0, { get: { tags: a, deep: e, name: t, id: n.link ? n._.id + "_" : n._tgId + "^" } }), a }, e.refresh = function (e) { var t, n, r = this, i = r.linkCtx, o = r.tagCtx.view; return r.disposed && F("Removed tag"), void 0 === e && (e = Je._tag(r, o, o.tmpl, xe(r), !0)), e + "" === e && (n = r._.inline ? mt : i.attr || te(r.parentElem, !0), t = G(e, i, n, r)), he(r), t || r }, e.update = function (e) { var t = this.linkedElem; t && Q({ target: t[0] }, void 0, e) }, n ? e.domChange = function () { var e = this.parentElem, n = t.hasData(e) && t._data(e).events, r = "jsv-domchange"; n && n[r] && t(e).triggerHandler(r, arguments) } : (e.addViews = function (e, t) { var n, r = this, i = t.length, o = r.views; !r._.useKey && i && (n = o.length + i, n === r.data.length && ne(r, e, r.tmpl, o, t, r.ctx) !== !1 && (r._.srt || r.fixIndex(e + i))) }, e.removeViews = function (e, n, r, i) { function o(e) { var n, i, o, a, s, l, d = c[e]; if (d && d.link) { if (n = d._.id, r || (l = d.nodes()), d.removeViews(void 0, void 0, !0), d.type = void 0, a = d._prv, s = d._nxt, o = d.parentElem, r || (d._elCnt && Ae(a, s, o, n, "_"), t(l).remove()), !d._elCnt) try { a.parentNode.removeChild(a), s.parentNode.removeChild(s) } catch (p) { } ee(d); for (i in d._.bnds) we(i); delete dn[n] } } var a, s, l, d = this, p = !d._.useKey, c = d.views; if (p && (l = c.length), void 0 === e) if (p) { for (a = l; a--;) o(a); d.views = [] } else { for (s in c) o(s); d.views = {} } else if (void 0 === n && (p ? n = 1 : (o(e), delete c[e])), p && n && (i || l - n === d.data.length)) { for (a = e + n; a-- > e;) o(a); c.splice(e, n), d._.sort || d.fixIndex(e) } }, e.refresh = function () { var e = this, t = e.parent; t && (ne(e, e.index, e.tmpl, t.views, e.data, void 0, !0), ee(e)) }, e.fixIndex = function (e) { for (var t = this.views, n = t.length; e < n--;) t[n].index !== n && $e(t[n]).setProperty("index", n) }, e.link = se) } function Te(e, t, n) { if ("set" === n.change) { for (var r = e.tgt, i = r.length; i-- && r[i].key !== n.path;); -1 === i ? n.path && !n.remove && $e(r).insert({ key: n.path, prop: n.value }) : n.remove ? $e(r).remove(i) : $e(r[i]).setProperty("prop", n.value) } } function Se(e, t, n) { var r, i = e.src, o = n.change; "set" === o ? "prop" === n.path ? $e(i).setProperty(t.target.key, n.value) : ($e(i).removeProperty(n.oldValue), $e(i).setProperty(n.value, t.target.prop)) : "remove" === o ? (r = n.items[0], $e(i).removeProperty(r.key), delete i[r.key]) : "insert" === o && (r = n.items[0], r.key && $e(i).setProperty(r.key, r.prop)) } function Ve(e) { return e.indexOf(".") < 0 } var Ne = t === !1; if (t = t || e.jQuery, !t || !t.fn) throw "JsViews requires jQuery"; var Le, Be, Fe, Me, Re, $e, Pe, Oe, qe, De, Ue, Ke, He, Je, ze, Qe, We, Xe, Ze, Ge, Ye, et, tt, nt, rt = "v0.9.80", it = /^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g, ot = /(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g, at = /[ \t]*(\r\n|\n|\r)/g, st = /\\(['"])/g, lt = /['"\\]/g, dt = /(?:\x08|^)(onerror:)?(?:(~?)(([\w$_\.]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi, pt = /^if\s/, ct = /<(\w+)[>\s]/, ft = /[\x00`><"'&=]/g, ut = /[\x00`><\"'&=]/, vt = /^on[A-Z]|^convert(Back)?$/, gt = ft, ht = 0, _t = { "&": "&", "<": "<", ">": ">", "\x00": "�", "'": "'", '"': """, "`": "`", "=": "=" }, mt = "html", bt = "object", xt = "data-jsv-tmpl", yt = "jsvTmpl", wt = "For #index in nested block use #getIndex().", kt = {}, Ct = e.jsrender, jt = Ct && t && !t.render, At = { template: { compile: C }, tag: { compile: w }, viewModel: { compile: I }, helper: {}, converter: {} }; if (Me = { jsviews: rt, sub: { View: x, Err: l, tmplFn: R, parse: q, extend: d, extendCtx: U, syntaxErr: M, onStore: {}, addSetting: S, settings: { allowCode: !1 }, advSet: a, _ths: i, _tg: function () { }, _cnvt: h, _tag: b, _er: F, _err: B, _html: z, _cp: o, _sq: function (e) { return "constructor" === e && M(""), e } }, settings: { delimiters: p, advanced: function (e) { return e ? (d(Qe, e), Je.advSet(), We) : Qe } }, getCtx: o, map: V }, (l.prototype = new Error).constructor = l, f.depends = function () { return [this.get("item"), "index"] }, u.depends = "index", x.prototype = { get: c, getIndex: u, getRsc: m, getTmpl: g, hlp: v, _is: "view" }, Je = Me.sub, We = Me.settings, !(Ct || t && t.render)) { for (Le in At) T(Le, At[Le]); Ue = Me.converters, Ke = Me.helpers, He = Me.tags, Je._tg.prototype = { baseApply: k, cvtArgs: _ }, Fe = Je.topView = new x, t ? (t.fn.render = J, Pe = t.expando, t.observable && (d(Je, t.views.sub), Me.map = t.views.map)) : (t = {}, Ne && (e.jsrender = t), t.renderFile = t.__express = t.compile = function () { throw "Node.js: use npm jsrender, or jsrender-node.js" }, t.isFunction = function (e) { return "function" == typeof e }, t.isArray = Array.isArray || function (e) { return "[object Array]" === {}.toString.call(e) }, Je._jq = function (e) { e !== t && (d(e, t), t = e, t.fn.render = J, delete t.jsrender, Pe = t.expando) }, t.jsrender = rt), ze = Je.settings, ze.allowCode = !1, Oe = t.isFunction, t.render = kt, t.views = Me, t.templates = De = Me.templates; for (tt in ze) S(tt); (We.debugMode = function (e) { return void 0 === e ? ze.debugMode : (ze.debugMode = e, ze.onError = e + "" === e ? new Function("", "return '" + e + "';") : Oe(e) ? e : void 0, We) })(!1), Qe = ze.advanced = { useViews: !1, _jsv: !1 }, He({ "if": { render: function (e) { var t = this, n = t.tagCtx, r = t.rendering.done || !e && (arguments.length || !n.index) ? "" : (t.rendering.done = !0, t.selected = n.index, n.render(n.view, !0)); return r }, flow: !0 }, "for": { render: function (e) { var t, n = !arguments.length, r = this, i = r.tagCtx, o = "", a = 0; return r.rendering.done || (t = n ? i.view.data : e, void 0 !== t && (o += i.render(t, n), a += qe(t) ? t.length : 1), (r.rendering.done = a) && (r.selected = i.index)), o }, flow: !0 }, props: { baseTag: "for", dataMap: V(H), flow: !0 }, include: { flow: !0 }, "*": { render: o, flow: !0 }, ":*": { render: o, flow: !0 }, dbg: Ke.dbg = Ue.dbg = s }), Ue({ html: z, attr: z, url: function (e) { return void 0 != e ? encodeURI("" + e) : null === e ? e : "" } }) } if (ze = Je.settings, qe = t.isArray, We.delimiters("{{", "}}", "^"), jt && Ct.views.sub._jq(t), Me = t.views, Je = Me.sub, Oe = t.isFunction, qe = t.isArray, Pe = t.expando, !t.observe) { var It = t.event.special, Et = [].slice, Tt = [].splice, St = [].concat, Vt = parseInt, Nt = /\S+/g, Lt = Je.propChng = Je.propChng || "propertyChange", Bt = Je.arrChng = Je.arrChng || "arrayChange", Ft = {}, Mt = Lt + ".observe", Rt = 1, $t = 1, Pt = 1, Ot = t.hasData, qt = t.data, Dt = {}, Ut = function (e) { return e._cId = e._cId || ".obs" + $t++ }, Kt = function (e, t) { return this._data = t, this._ns = e, this }, Ht = function (e, t) { return this._data = t, this._ns = e, this }, Jt = function (e) { return qe(e) ? [e] : e }, zt = function (e, t, n) { e = e ? qe(e) ? e : [e] : []; var r, i, o = t, a = o, s = e && e.length, l = []; for (r = 0; s > r; r++) i = e[r], Oe(i) ? l = l.concat(zt(i.call(t, t, n), t)) : "" + i === i ? (a !== o && l.push(o = a), l.push(i)) : (t = a = i, a !== o && l.push(o = a)); return l }, Qt = function (e, t) { for (var n in e) return; delete Ft[t] }, Wt = function (e, t) { function n(e) { return typeof e === bt && (f[0] || c && qe(e)) } if (!e.data || !e.data.off) { var r, i, o, a = t.oldValue, s = t.value, l = e.data, d = l.observeAll, p = l.cb, c = !p.noArray, f = l.paths, u = l.ns; e.type === Bt ? (p.array || p).call(l, e, t) : l.prop !== t.path && "*" !== l.prop || (d ? (r = d._path + "." + t.path, i = d.filter, o = [e.target].concat(d.parents()), n(a) && Xt(c, u, [a], f, p, !0, i, [o], r), n(s) && Xt(c, u, [s], f, p, void 0, i, [o], r)) : (n(a) && Xt(c, u, [a], f, p, !0), n(s) && Xt(c, u, [s], f, p)), l.cb(e, t)) } }, Xt = function () { var e = St.apply([], arguments); return Re.apply(e.shift(), e) }, Zt = function (e, t, n) { Yt(this._ns, this._data, e, t, [], "root", n) }, Gt = function (e, t) { Zt.call(this, e, t, !0) }, Yt = function (e, t, n, r, i, o, a, s) { function l(e, t) { for (c = e.length, u = o + "[]"; c--;) d(e, c, t, 1) } function d(t, i, o, a) { var l, d; i !== Pe && (l = $e._fltr(u, t[i], v, r)) && (d = v.slice(), a && g && d[0] !== g && d.unshift(g), Yt(e, l, n, r || (a ? void 0 : 0), d, u, o, s)) } function p(e, t) { switch (o = e.data.observeAll._path, g = e.target, t.change) { case "insert": l(t.items); break; case "remove": l(t.items, !0); break; case "set": u = o + "." + t.path, d(t, "oldValue", !0), d(t, "value") } g = void 0, n.apply(this, arguments) } var c, f, u, v, g, h, _ = !s || s.un || !a; if (t && typeof t === bt) { if (v = [t].concat(i), f = qe(t) ? "" : "*", s && _ && Ot(t) && s[h = qt(t).obId]) return void s[h]++; if (s || (s = { un: a }), n) { if (f || 0 !== r) if (p._cId = Ut(n), _) Re(e, t, f, p, a, r, v, o), h = qt(t).obId, s[h] = (s[h] || 0) + 1; else { if (--s[qt(t).obId]) return; Re(e, t, f, p, a, r, v, o) } } else s && (s[qt(t).obId] = 1), Re(e, t, f, void 0, a, r, v, o); if (f) for (c in t) u = o + "." + c, d(t, c, a); else l(t, a) } }, en = function (e) { return e.indexOf(".") < 0 && e.indexOf("[") < 0 }, tn = function () { return [].push.call(arguments, !0), Re.apply(this, arguments) }; Re = function () { function e() { function i(e, r, i, o) { var a, s, l = Ot(M), d = Jt(M), p = I, c = E; if (e = n ? e + "." + n : e, !g && (o || i)) for (y = l && t._data(M), y = y && y.events, y = y && y[i ? Bt : Lt], b = y && y.length; b--;) if (x = y[b] && y[b].data, x && (o && x.ns !== n || !o && x.ns === n && x.cb && x.cb._cId === h._cId)) return; g || o ? t(d).off(e, Wt) : (s = i ? {} : { fullPath: u, paths: r ? [r] : [], prop: f }, s.ns = n, s.cb = h, E && (s.observeAll = { _path: c, path: function () { return a = p.length, c.replace(/[[.]/g, function (e) { return a--, "[" === e ? "[" + t.inArray(p[a - 1], p[a]) : "." }) }, parents: function () { return p }, filter: T }), t(d).on(e, null, s, Wt), C && (C[qt(M).obId || qt(M, "obId", Rt++)] = M)) } function a(t) { var n = F; return t.ob = w(t, n), t.cb = function (i, o) { var a = t.ob, l = t.sb, d = w(t, n); d !== a && (typeof a === bt && (s(a, !0), (l || r && qe(a)) && e([a], l, h, w, !0)), t.ob = d, typeof d === bt && (s(d), (l || r && qe(d)) && e([d], l, h, w))), h(i, o) } } function s(e, t, n, o) { if (r) { var a = M, s = E; M = e, o && (M = e[o], E += "." + o), T && M && (M = $e._fltr(E, M, o ? [e].concat(I) : I, T)), M && (n || qe(M)) && i(Bt + ".observe" + (h ? Ut(h) : ""), void 0, !0, t), M = a, E = s } } var l, d, p, c, f, u, v, g, h, _, m, b, x, y, w, k, C, j, A, I, E, T, S, V, N = Mt, L = 1 != this ? St.apply([], arguments) : Et.call(arguments), B = L.pop() || !1, F = L.shift(), M = F, R = L.length; if (B + "" === B && (E = B, I = L.pop(), T = L.pop(), B = !!L.pop(), R -= 3), B === !!B && (g = B, B = L[R - 1], B = !R || B + "" === B || B && !Oe(B) ? void 0 : (R--, L.pop()), g && !R && Oe(F) && (B = F, F = void 0)), h = B, R && Oe(L[R - 1]) && (w = h, h = L.pop(), R--), !g || !h || h._cId) { for (N += h ? (m = h._inId || "", g ? h._cId + m : (_ = Ut(h)) + m) : "", _ && !g && (C = Ft[_] = Ft[_] || {}), S = n && n.match(Nt) || [""], V = S.length; V--;) { if (n = S[V], F && (u = L[0], !u || u + "" !== u) && (qe(F) ? s(F, g, !0) : g && i(N, "")), g && !R && !F) for (d in Ft) { d = Ft[d]; for (x in d) M = d[x], qe(M) ? s(M, g, g) : i(N, "") } for (j = 0, l = 0; R > l; l++) if (u = L[l], "" !== u) { if (M = F, "" + u === u) { if (c = u.split("^"), c[1] && (j = c[0].split(".").length, u = c.join("."), j = u.split(".").length - j), w && (k = w(u, F, j))) { R += k.length - 1, Tt.apply(L, [l--, 1].concat(k)); continue } c = u.split(".") } else Oe(u) || (u && u._jsv ? (A = g ? u.cb : a(u), A.noArray = !r, A._cId = h._cId, A._inId = A._inId || ".obIn" + Pt++, (u.bnd || u.prm && u.prm.length || !u.sb) && e([M], u.path, [o], u.prm, A, w, g), u.sb && e([u.ob], u.sb, h, w, g), u = o, M = void 0) : M = u), c = [F = u]; for (; M && void 0 !== (f = c.shift()) ;) if (typeof M === bt) { if ("" + f === f) { if ("" === f) continue; if (c.length < j + 1 && !M.nodeType) { if (!g && (y = Ot(M) && t._data(M))) { for (y = y.events, y = y && y[Lt], b = y && y.length, p = 0; b--;) x = y[b].data, !x || x.ns !== n || x.cb._cId !== h._cId || x.cb._inId !== h._inId || x.prop !== f && "*" !== x.prop && "**" !== x.prop || ((d = c.join(".")) && x.paths.push(d), p++); if (p) { M = M[f]; continue } } if ("*" === f || "**" === f) { if (!g && y && y.length && i(N, "", !1, !0), "*" === f) { i(N, ""); for (d in M) d !== Pe && s(M, g, void 0, d) } else t.observable(n, M)[(g ? "un" : "") + "observeAll"](h); break } f && i(N + ".p_" + f, c.join("^")) } E && (E += "." + f), f = M[f] } if (Oe(f)) { (v = f.depends) && e([M], zt(v, M, h), h, w, g); break } M = f, g && M === F && (l > R - 2 || L[l + 1] + "" !== L[l + 1]) && i(N, "") } s(M, g) } } return _ && Qt(C, _), { cbId: _, bnd: C } } } var n, r = 0 != this, i = Et.call(arguments), o = i[0]; return o + "" === o && r && (n = o, i.shift(), o = i[0]), e.apply(1, i) }, $e = function (e, t) { return 1 === arguments.length && (t = e, e = ""), qe(t) ? new Ht(e, t) : new Kt(e, t) }, Je.getDeps = function () { var e = arguments; return function () { for (var t, n, r = [], i = e.length; i--;) t = e[i--], n = e[i], n && (r = r.concat(Oe(n) ? n(t, t) : n)); return r } }, t.observable = $e, $e._fltr = function (e, t, n, r) { return (r && Oe(r) ? r(e, t, n) : !0) ? (t = Oe(t) ? t.set && t.call(n[0]) : t, typeof t === bt && t) : void 0 }, $e.Object = Kt, $e.Array = Ht, t.observe = $e.observe = Re, t.unobserve = $e.unobserve = tn, $e._apply = Xt, Kt.prototype = { _data: null, observeAll: Zt, unobserveAll: Gt, data: function () { return this._data }, setProperty: function (e, t, n) { e = e || ""; var r, i, o, a = e + "" !== e, s = this, l = s._data; if (l) if (a) if (n = t, qe(e)) for (r = e.length; r--;) i = e[r], s.setProperty(i.name, i.value, void 0 === n || n); else for (r in e) s.setProperty(r, e[r], n); else if (e !== Pe) { for (o = e.split(/[.^]/) ; l && o.length > 1;) l = l[o.shift()]; l && s._setProperty(l, o[0], t, n) } return s }, removeProperty: function (e) { return this.setProperty(e, Dt), this }, _setProperty: function (e, t, n, r) { var i, o, a, s = t ? e[t] : e; Oe(s) && s.set && (e = e._wrp || e, o = s, i = o.set === !0 ? o : o.set, s = o.call(e)), (s !== n || r && s != n) && (!(s instanceof Date) || s > n || n > s) && (i ? (i.call(e, n), n = o.call(e)) : (a = n === Dt) ? void 0 !== s ? (delete e[t], n = void 0) : t = void 0 : t && (e[t] = n), t && this._trigger(e, { change: "set", path: t, value: n, oldValue: s, remove: a })) }, _trigger: function (e, n) { t(e).triggerHandler(Lt + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), n) } }, Ht.prototype = { _data: null, observeAll: Zt, unobserveAll: Gt, data: function () { return this._data }, insert: function (e, t) { var n = this._data; return 1 === arguments.length && (t = e, e = n.length), e = Vt(e), e > -1 && (t = qe(t) ? t : [t], t.length && this._insert(e, t)), this }, _insert: function (e, t) { var n = this._data, r = n.length; e > r && (e = r), Tt.apply(n, [e, 0].concat(t)), this._trigger({ change: "insert", index: e, items: t }, r) }, remove: function (e, t) { var n, r = this._data; return void 0 === e && (e = r.length - 1), e = Vt(e), t = t ? Vt(t) : 0 === t ? 0 : 1, t > 0 && e > -1 && (n = r.slice(e, e + t), (t = n.length) && this._remove(e, t, n)), this }, _remove: function (e, t, n) { var r = this._data, i = r.length; r.splice(e, t), this._trigger({ change: "remove", index: e, items: n }, i) }, move: function (e, t, n) { return n = n ? Vt(n) : 0 === n ? 0 : 1, e = Vt(e), t = Vt(t), n > 0 && e > -1 && t > -1 && e !== t && this._move(e, t, n), this }, _move: function (e, t, n) { var r, i = this._data, o = i.length, a = e + n - o; a > 0 && (n -= a), n && (r = i.splice(e, n), t > i.length && (t = i.length), Tt.apply(i, [t, 0].concat(r)), this._trigger({ change: "move", oldIndex: e, index: t, items: r }, o)) }, refresh: function (e, t) { function n() { o && (l.insert(i - o, d), u += o, r += o, o = 0, d = []) } var r, i, o, a, s, l = this, d = [], p = l._data, c = p.slice(), f = p.length, u = f, v = e.length; for (l._srt = !0, i = o = 0; v > i; i++) if ((a = e[i]) === p[i - o]) n(); else { for (r = i - o; u > r && a !== p[r]; r++); if (u > r) { for (n(), s = 0; s++ < v - r && e[i + s] === p[r + s];); l.move(r, i, s), i += s - 1 } else o++, d.push(a) } return n(), u > i && l.remove(i, u - i), l._srt = void 0, l._trigger({ change: "refresh", oldItems: c }, f), l }, _trigger: function (e, n) { var r = this, i = r._data, o = i.length, a = t([i]); r._srt ? e.refresh = !0 : o !== n && a.triggerHandler(Lt, { change: "set", path: "length", value: o, oldValue: n }), a.triggerHandler(Bt + (r._ns ? "." + /^\S+/.exec(r._ns)[0] : ""), e) } }, It[Lt] = It[Bt] = { remove: function (e) { var n, r, i, o, a, s = e.data; if (s && (s.off = !0, s = s.cb) && (n = Ft[s._cId])) { for (i = t._data(this).events[e.type], o = i.length; o-- && !r;) r = (a = i[o].data) && a.cb && a.cb._cId === s._cId; r || (delete n[qt(this).obId], Qt(n, s._cId)) } } }, Me.map = function (e) { function n(t, n, r, i) { var o, a = this; this.src && this.unmap(), typeof t === bt && (a.src = t, a.tgt = r || a.tgt || [], a.options = n || a.options, a.update(), i || (e.obsSrc && $e(a.src).observeAll(a.obs = function (t, n) { o || (o = !0, e.obsSrc(a, t, n), o = void 0) }, a.srcFlt), e.obsTgt && $e(a.tgt).observeAll(a.obt = function (t, n) { o || (o = !0, e.obsTgt(a, t, n), o = void 0) }, a.tgtFlt))) } return Oe(e) && (e = { getTgt: e }), e.baseMap && (e = t.extend({}, e.baseMap, e)), e.map = function (e, t, r, i) { return new n(e, t, r, i) }, (n.prototype = { srcFlt: e.srcFlt || en, tgtFlt: e.tgtFlt || en, update: function (t) { var n = this; $e(n.tgt).refresh(e.getTgt(n.src, n.options = t || n.options)) }, unmap: function () { var e = this; e.src && (e.obs && $e(e.src).unobserveAll(e.obs, e.srcFlt), e.obt && $e(e.tgt).unobserveAll(e.obt, e.tgtFlt), e.src = void 0) }, map: n, _def: e }).constructor = n, e }, Je.advSet = function () { e._jsv = ze.advanced._jsv ? { cbBindings: Ft } : void 0 } } if (We = Me.settings, ze = Je.settings, Qe = ze.advanced, Ue = Me.converters, t.templates = De = Me.templates, He = Me.tags, ct = /<(?!script)(\w+)[>\s]/, t.link) return t; ze.trigger = !0; var nn, rn, on, an, sn, ln, dn, pn, cn = "data-jsv", fn = "change.jsv", un = "onBeforeChange", vn = "onAfterChange", gn = "onAfterCreate", hn = "checked", _n = "checkbox", mn = "radio", bn = "input[type=radio]", xn = "none", yn = "SCRIPT", wn = "true", kn = '"></script>', Cn = '<script type="jsv', jn = cn + "-df", An = "script,[" + cn + "]", In = { value: "val", input: "val", html: mt, text: "text" }, En = { from: "value", to: "value" }, Tn = 0, Sn = t.cleanData, Vn = We.delimiters, Nn = document.createDocumentFragment(), Ln = document.querySelector, Bn = { ol: 1, ul: 1, table: 1, tbody: 1, thead: 1, tfoot: 1, tr: 1, colgroup: 1, dl: 1, select: 1, optgroup: 1, svg: 1, svg_ns: 1 }, Fn = { tr: "table" }, Mn = { br: 1, img: 1, input: 1, hr: 1, area: 1, base: 1, col: 1, link: 1, meta: 1, command: 1, embed: 1, keygen: 1, param: 1, source: 1, track: 1, wbr: 1 }, Rn = {}, $n = {}, Pn = 1, On = /^#(view\.?)?/, qn = /((\/>)|<\/(\w+)>|)(\s*)([#\/]\d+(?:_|(\^)))`(\s*)(<\w+(?=[\s\/>]))?|\s*(?:(<\w+(?=[\s\/>]))|<\/(\w+)>(\s*)|(\/>)\s*|(>)|$)/g, Dn = /(#)()(\d+)(_)/g, Un = /(#)()(\d+)([_^])/g, Kn = /(?:(#)|(\/))(\d+)(_)/g, Hn = /(#)()(\d+)(\^)/g, Jn = /(?:(#)|(\/))(\d+)([_^])([-+@\d]+)?/g, zn = /&(\d+)\+?/g, Qn = e.getComputedStyle; if ($e = t.observable, !$e) throw requiresStr + "JsObservable"; return Re = $e.observe, Je.onStore.template = function (e, n) { n.link = oe, e && (t.link[e] = function () { return oe.apply(n, arguments) }) }, Je.viewInfos = fe, (We.delimiters = function () { var e = Vn.apply(0, arguments); return Vn !== p && (e = p.apply(0, arguments)), rn = new RegExp("(?:^|\\s*)([\\w-]*)(\\" + et + ")?(\\" + Ze + Je.rTag + "(:\\w*)?\\" + Ge + ")", "g"), e })(), Je.addSetting("trigger"), Ue.merge = function (e) { var t, n = this.linkCtx._val || "", r = this.tagCtx.props.toggle; return r && (t = r.replace(/[\\^$.|?*+()[{]/g, "\\$&"), t = "(\\s(?=" + t + "$)|(\\s)|^)(" + t + "(\\s|$))", n = n.replace(new RegExp(t), "$2"), e = n + (e ? (n && " ") + r : "")), e }, He("on", { attr: xn, init: function (e) { for (var n, r = this, i = 0, o = e.args, a = o.length; a > i && !Oe(o[i]) ; i++); r._hi = a > i && i + 1, r._.inline && (Je.rTmpl.exec(n = e.tmpl.markup) || (r.template = "<button>" + (t.trim(n) || e.params.args[i] || "noop") + "</button>"), r.attr = mt) }, render: function () { var e = this.tagCtx; return e.render(e.view, !0) }, onAfterLink: function (e, n) { var r, i, o, a = this, s = a._hi, l = e.args, d = l.length, p = e.props, c = p.data, f = e.view, u = p.context; s && (r = l[s - 1], i = l.slice(s), l = l.slice(0, s - 1), a._sel = l[1], o = a.activeElem = a.activeElem || t(a._.inline ? (a._sel = l[1] || "*", a.parentElem) : n.elem), u || (u = /^(.*)[\.^][\w$]+$/.exec(e.params.args.slice(-i.length - 1)[0]), u = u && Je.tmplFn("{:" + u[1] + "}", f.tmpl, !0)(n.data, f)), a._evs && a.onDispose(), o.on(a._evs = l[0] || "click", a._sel, void 0 == c ? null : c, a._hlr = function (e) { var t, o = !a._.inline; if (!o) for (t = a.contents("*"), d = t.length; !o && d--;) t[d].contains(e.target) && (o = !0); return o ? r.apply(u || n.data, [].concat(i, e, { change: e.type, view: f, linkCtx: n }, i.slice.call(arguments, 1))) : void 0 })) }, onUpdate: function () { return !1 }, onDispose: function () { var e = this; e.activeElem && e.activeElem.off(e._evs, e._sel, e._hlr) }, flow: !0, dataBoundOnly: !0 }), d(He["for"], { onArrayChange: function (e, t, n, r) { var i, o = e.target, a = o.length, s = this, l = t.change; if (s._.noVws || s.tagCtxs[1] && ("insert" === l && a === t.items.length || "remove" === l && !a)) s.refresh(); else for (i in s._.arrVws) i = s._.arrVws[i], i.data === o && i._.onArrayChange.apply(i, arguments); s.domChange(n, r, t), e.done = !0 }, onAfterLink: function (e, t) { var n, r, i, o, a = this, s = a._ars || {}, l = a.tagCtxs, d = l.length, p = a.selected || 0; for (n = 0; p >= n; n++) e = l[n], o = e.map ? e.map.tgt : e.args.length ? e.args[0] : e.view.data, (i = s[n]) && o !== i[0] && (Re(i[0], i[1], !0), delete s[n]), !s[n] && qe(o) && (Re(o, r = function (n, r) { var i = e; a.onArrayChange(n, r, i, t) }), s[n] = [o, r]); for (n = p + 1; d > n; n++) (i = s[n]) && (Re(i[0], i[1], !0), delete s[n]); a._ars = s }, onDispose: function () { var e, t = this; for (e in t._ars) Re(t._ars[e][0], t._ars[e][1], !0) } }), d(He["if"], { onUpdate: function (e, t, n) { var r, i, o; for (r = 0; i = this.tagCtxs[r]; r++) if (o = i.props.tmpl !== n[r].props.tmpl || i.args.length && !(i = i.args[0]) != !n[r].args[0], !this.convert && i || o) return o; return !1 }, onAfterLink: function (e, t, n) { n && this.domChange(e, t, n) } }), He("props", { baseTag: "for", dataMap: Me.map({ getTgt: He.props.dataMap.getTgt, obsSrc: Te, obsTgt: Se, tgtFlt: Ve }), flow: !0 }), d(t, { view: on = function (e, n, r) { function i(e, t) { if (e) for (a = fe(e, t, Dn), l = 0, d = a.length; d > l && (!(o = dn[a[l].id]) || !(o = o && r ? o.get(!0, r) : o)) ; l++); } n !== !!n && (r = n, n = void 0); var o, a, s, l, d, p, c, f = 0, u = document.body; if (e && e !== u && Fe._.useKey > 1 && (e = "" + e === e ? t(e)[0] : e.jquery ? e[0] : e)) { if (n) { if (i(e._df, !0), !o) for (c = Ln ? e.querySelectorAll(An) : t(An, e).get(), p = c.length, s = 0; !o && p > s; s++) i(c[s]); return o } for (; e;) { if (a = fe(e, void 0, Kn)) for (p = a.length; p--;) if (o = a[p], o.open) { if (1 > f) return o = dn[o.id], o && r ? o.get(r) : o || Fe; f-- } else f++; e = e.previousSibling || e.parentNode } } return Fe }, link: ae, unlink: ke, cleanData: function (e) { e.length && Tn && ye(e), Sn.apply(t, arguments) } }), d(t.fn, { link: function (e, t, n, r, i, o, a) { return ae(e, this, t, n, r, i, o, a) }, unlink: function () { return ke(this) }, view: function (e, t) { return on(this[0], e, t) } }), t.each([mt, "replaceWith", "empty", "remove"], function (e, n) { var r = t.fn[n]; t.fn[n] = function () { var e; Tn = 1; try { e = r.apply(this, arguments) } finally { Tn = 0 } return e } }), Ee(d(Fe = Je.topView, { tmpl: { links: {} } })), dn = { 0: Fe }, Me.getCtx = function (e) { return e && e._cp && (e = e[1](e[0].data, e[0], Je)), e }, Je._cp = function (e, t, n) { if (n.linked) { t = "{:" + t + "}"; var r = n.tmpl, i = Fe.tmpl.links, o = i[t]; o || (i[t] = o = Je.tmplFn(t, r, !0)), e = [n, o], e._cp = !0 } return e }, Je._ceo = function Wn(e) { var t, n = e, r = e.length; if (r) for (n = []; r--;) t = e[r], t._jsv && (t = d({}, t), t.prm = Wn(t.prm)), n.unshift(t); return n }, pn = Je.advSet, Je.advSet = function () { pn(), e._jsv = Qe._jsv ? d(e._jsv || {}, { views: dn, bindings: $n }) : void 0, an = Qe.linkAttr, sn = An + ",[" + an + "]", ln = Qe._wm, ln.optgroup = ln.option, ln.tbody = ln.tfoot = ln.colgroup = ln.caption = ln.thead, ln.th = ln.td }, We.advanced({ linkAttr: "data-link", useViews: !1, noValidate: !1, _wm: { option: [1, "<select multiple='multiple'>", "</select>"], legend: [1, "<fieldset>", "</fieldset>"], area: [1, "<map>", "</map>"], param: [1, "<object>", "</object>"], thead: [1, "<table>", "</table>"], tr: [2, "<table><tbody>", "</tbody></table>"], td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], svg_ns: [1, "<svg>", "</svg>"], div: t.support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"] }, _fe: { input: { from: je, to: "value" }, textarea: En, select: En, optgroup: { to: "label" } } }), t
|
|
}, window);
|
|
//# sourceMappingURL=jsviews.min.js.map
|