UNPKG

forerunnerdb

Version:

A NoSQL document store database for browsers and Node.js.

2 lines 59.4 kB
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("../lib/AutoBind");b.exports=d},{"../lib/AutoBind":2}],2:[function(a,b,c){"use strict";var d,e=window.ForerunnerDB.shared,f={};if(e.addModule("AutoBind",f),f.extendCollection=function(a){var b=a.prototype.init,c=a.prototype._dataReplace,d=a.prototype._dataInsertAtIndex,e=a.prototype._dataRemoveAtIndex,f=a.prototype._updateProperty,g=a.prototype._updateIncrement,h=a.prototype._updateSpliceMove,i=a.prototype._updateSplicePush,j=a.prototype._updatePush,k=a.prototype._updatePull,l=a.prototype._updateMultiply,m=a.prototype._updateRename,n=a.prototype._updateOverwrite,o=a.prototype._updateUnset,p=a.prototype._updatePop,q=a.prototype.drop;a.prototype.init=function(){this._linked=0,b.apply(this,arguments)},a.prototype.isLinked=function(){return Boolean(this._linked)},a.prototype.link=function(a,b,c){if(window.jQuery){this._links=this._links||new ForerunnerDB.shared.modules.Collection(this.instanceIdentifier()+"_links"),this._linked||(this._linked=0);var d,e,f;if(a&&b){if(f="string"==typeof a?a:a.selector,b&&"object"==typeof b?b.template&&"string"==typeof b.template&&(d=this.objectId(b.template),e=b.template):d=b,!this._links.count({target:f,template:b})){if(window.jQuery(a).length){if(!window.jQuery.templates[d]){if(!e){var g=window.jQuery(b);if(!g.length)throw"ForerunnerDB.AutoBind : "+this.instanceIdentifier()+' Unable to bind to target because template "'+b+'" does not exist';e=window.jQuery(g[0]).html()}window.jQuery.views.templates(d,e)}if(c&&c.$wrap){var h,i,j;if(c.$wrapIn)if(c.$wrapIn instanceof window.ForerunnerDB.shared.modules.Document)j=c.$wrapIn,i=j._data,i[c.$wrap]=this._data,j.setData(i,{$decouple:!1}),j._linked=1,h=j._data;else{if("object"!=typeof c.$wrapIn)throw"ForerunnerDB.AutoBind: "+this.instanceIdentifier()+" Unable to use passed $wrapIn option, should be either a ForerunnerDB Document instance or a JavaScript object!";h=c.$wrapIn,h[c.$wrap]=this._data}else h={},h[c.$wrap]=this._data;this.debug()&&console.log("ForerunnerDB.AutoBind: "+this.instanceIdentifier()+' Binding data wrapped in an object with field called "'+c.$wrap+'" to output target: '+a),window.jQuery.templates[d].link(a,h)}else window.jQuery.templates[d].link(a,this._data);return this._links.insert({target:f,template:b,templateId:d}),this._linked++,this.debug()&&console.log(this.logIdentifier()+" Binding to output target: "+a),this}throw this.logIdentifier()+' Cannot bind collection to target selector "'+a+'" because it does not exist in the DOM!'}throw this.logIdentifier()+" Attempt to bind a duplicate link from collection to the target: "+a+" with the template: "+d}throw this.logIdentifier()+" Cannot bind without a target / template!"}throw this.logIdentifier()+" Cannot data-bind without jQuery. Please add jQuery to your page!"},a.prototype.unlink=function(a,b){if(this._links){if(!window.jQuery)throw this.logIdentifier()+" Cannot data-bind without jQuery. Please add jQuery to your page!";var c,d,e,f,g;if(a&&b){if(d="string"==typeof a?a:a.selector,b&&"object"==typeof b?b.template&&"string"==typeof b.template&&(c=this.objectId(b.template)):c=b,e=this._links.findOne({target:d,template:b}))return window.jQuery.templates[c].unlink(a),this._links.remove(e),this._linked--,this.debug()&&console.log(this.logIdentifier()+" Removed binding document to target: "+a),this;this.debug()&&console.log(this.logIdentifier()+" Cannot remove binding as it does not exist to the target: "+a+" with the template: "+b)}else{for(f=this._links.find(),g=0;g<f.length;g++)e=f[g],window.jQuery.templates[e.templateId].unlink(jQuery(e.target)),this.debug()&&console.log(this.logIdentifier()+" Removed binding to output target: "+e.target);this._links.remove(),this._linked=0}}return this},a.prototype.links=function(){return this._links},a.prototype._dataReplace=function(a){this._linked?(this.debug()&&console.log(this.logIdentifier()+" Replacing some data in document"),window.jQuery.observable(this._data).refresh(a)):c.apply(this,arguments)},a.prototype._dataInsertAtIndex=function(a,b){this._linked?(this.debug()&&console.log(this.logIdentifier()+" Inserting some data"),window.jQuery.observable(this._data).insert(a,b)):d.apply(this,arguments)},a.prototype._dataRemoveAtIndex=function(a){this._linked?(this.debug()&&console.log(this.logIdentifier()+" Removing some data"),window.jQuery.observable(this._data).remove(a)):e.apply(this,arguments)},a.prototype._updateProperty=function(a,b,c){this._linked?(this.debug()&&console.log(this.logIdentifier()+' Setting document property "'+b+'"'),window.jQuery.observable(a).setProperty(b,c)):f.apply(this,arguments)},a.prototype._updateIncrement=function(a,b,c){this._linked?(this.debug()&&console.log(this.logIdentifier()+' Incrementing document property "'+b+'"'),window.jQuery.observable(a).setProperty(b,a[b]+c)):g.apply(this,arguments)},a.prototype._updateSpliceMove=function(a,b,c){this._linked?(this.debug()&&console.log(this.logIdentifier()+' Moving document array index from "'+b+'" to "'+c+'"'),window.jQuery.observable(a).move(b,c)):h.apply(this,arguments)},a.prototype._updateSplicePush=function(a,b,c){this._linked?(this.debug()&&console.log(this.logIdentifier()+" Pushing item into document sub-array"),a.length>b?window.jQuery.observable(a).insert(b,c):window.jQuery.observable(a).insert(c)):i.apply(this,arguments)},a.prototype._updatePush=function(a,b){this._linked?(this.debug()&&console.log(this.logIdentifier()+" Pushing item into document sub-array"),window.jQuery.observable(a).insert(b)):j.apply(this,arguments)},a.prototype._updatePull=function(a,b){this._linked?(this.debug()&&console.log(this.logIdentifier()+" Pulling item from document sub-array"),window.jQuery.observable(a).remove(b)):k.apply(this,arguments)},a.prototype._updateMultiply=function(a,b,c){this._linked?(this.debug()&&console.log(this.logIdentifier()+" Multiplying value"),window.jQuery.observable(a).setProperty(b,a[b]*c)):l.apply(this,arguments)},a.prototype._updateRename=function(a,b,c){this._linked?(this.debug()&&console.log(this.logIdentifier()+' Renaming property "'+b+'" to "'+c+'" on document'),window.jQuery.observable(a).setProperty(c,a[b]),window.jQuery.observable(a).removeProperty(b)):m.apply(this,arguments)},a.prototype._updateOverwrite=function(a,b,c){this._linked?(this.debug()&&console.log(this.logIdentifier()+' Setting document property "'+b+'"'),window.jQuery.observable(a).setProperty(b,c)):n.apply(this,arguments)},a.prototype._updateUnset=function(a,b){this._linked?(this.debug()&&console.log(this.logIdentifier()+' Removing property "'+b+'" from document'),window.jQuery.observable(a).removeProperty(b)):o.apply(this,arguments)},a.prototype._updatePop=function(a,b){var c,d,e=!1;if(this._linked){if(a.length>0)if(this.debug()&&console.log(this.logIdentifier()+" Popping item from sub-array in document"),b>0){for(d=0;b>d;d++)c=a.length-1,c>-1&&window.jQuery.observable(a).remove(c);e=!0}else if(0>b){for(c=0,d=0;d>b;d--)a.length&&window.jQuery.observable(a).remove(c);e=!0}}else e=p.apply(this,arguments);return e},a.prototype.drop=function(){if(this._linked){var a,b=this._links.find();for(a=0;a<b.length;a++)this.unlink(jQuery(b[a].target),b[a].template)}return this._links&&(this._links.drop(),delete this._links),q.apply(this,arguments)}},f.extendView=function(a){var b=a.prototype.init;a.prototype.init=function(){this._linked=0,b.apply(this,arguments)},a.prototype.isLinked=function(){return this.publicData().isLinked()},a.prototype.link=function(a,b,c){var d=this.publicData();return d.link(a,b,c),this},a.prototype.unlink=function(a,b){var c=this.publicData();return c.unlink(a,b),this},a.prototype.links=function(){return this.publicData().links()}},f.extendOverview=function(a){a.prototype.isLinked=function(){return this.data().isLinked()},a.prototype.link=function(a,b,c){this._data.link.apply(this._data,arguments),this._refresh()},a.prototype.unlink=function(a,b){this._data.unlink.apply(this._data,arguments),this._refresh()},a.prototype.links=function(){return this._data.links()}},f.extendDocument=function(a){var b=a.prototype._updatePop;a.prototype.isLinked=function(){return Boolean(this._linked)},a.prototype.link=function(a,b,c){if(window.jQuery){if(this._links=this._links||new ForerunnerDB.shared.modules.Collection(this.instanceIdentifier()+"_links"),this._linked||(this._linked=0),a&&b){var d,e,f="string"==typeof a?a:a.selector;if(b&&"object"==typeof b?b.template&&"string"==typeof b.template&&(d=this.objectId(b.template),e=b.template):d=b,!this._links.count({target:f,template:b})){if(window.jQuery(a).length){if(!window.jQuery.templates[d]){if(!e){var g=window.jQuery(b);if(!g.length)throw this.logIdentifier()+" Unable to bind document to target because template does not exist: "+b;e=window.jQuery(g[0]).html()}window.jQuery.views.templates(d,e)}if(c&&c.$wrap){var h,i,j;c.$wrapIn?c.$wrapIn instanceof Document&&(j=c.$wrapIn,i=j._data,i[c.$wrap]=this._data,j.setData(i,{$decouple:!1}),j._linked=1,h=c.$wrap._data):(h={},h[c.$wrap]=this._data),window.jQuery.templates[d].link(a,h)}else window.jQuery.templates[d].link(a,this._data);return this._links.insert({target:f,template:b,templateId:d}),this._linked++,this.debug()&&console.log(this.logIdentifier()+" Added binding to target: "+a),this}throw this.logIdentifier()+' Cannot bind document to target "'+a+'" because it does not exist in the DOM!'}throw this.logIdentifier()+" Cannot create a duplicate link from document to the target: "+a+" with the template: "+d}throw this.logIdentifier()+" Cannot bind without a target / template!"}throw this.logIdentifier()+" Cannot data-bind without jQuery. Please add jQuery to your page!"},a.prototype.unlink=function(a,b){if(this._links){if(!window.jQuery)throw this.logIdentifier()+" Cannot data-bind without jQuery. Please add jQuery to your page!";var c,d,e,f,g;if(a&&b){if(d="string"==typeof a?a:a.selector,b&&"object"==typeof b?b.template&&"string"==typeof b.template&&(c=this.objectId(b.template)):c=b,e=this._links.findOne({target:d,template:b}))return window.jQuery.templates[c].unlink(a),this._links.remove(e),this._linked--,this.debug()&&console.log(this.logIdentifier()+" Removed binding document to target: "+a),this;this.debug()&&console.log(this.logIdentifier()+" Cannot remove link from document, one does not exist to the target: "+a+" with the template: "+b)}else{for(f=this._links.find(),g=0;g<f.length;g++)e=f[g],window.jQuery.templates[e.templateId].unlink(jQuery(e.target)),this.debug()&&console.log(this.logIdentifier()+" Removed binding to output target: "+e.target);this._links.remove(),this._linked=0}}return this},a.prototype.links=function(){return this._links},a.prototype._updatePop=function(a,c){var d,e,f=!1;if(this._linked){if(a.length>0)if(this.debug()&&console.log(this.logIdentifier()+" Popping item from sub-array"),c>0){for(e=0;c>e;e++)d=a.length-1,d>-1&&window.jQuery.observable(a).remove(d);f=!0}else if(0>c){for(d=0,e=0;e>c;e--)a.length&&window.jQuery.observable(a).remove(d);f=!0}}else f=b.apply(this,arguments);return f}},"undefined"==typeof window.jQuery)throw"ForerunnerDB.AutoBind : Cannot data-bind without jQuery. Please add jQuery to your page!";if(d=a("../lib/vendor/jsviews"),"undefined"==typeof window.jQuery.views)throw"ForerunnerDB.AutoBind : Plugin cannot continue because jsViews is not loaded. Check your error log for url errors; it should have automatically loaded with this plugin.";var g,h=["Collection","View","Overview","Document"],i=function(a,b){f["extend"+a]&&f["extend"+a](b)};for(g=0;g<h.length;g++)e.moduleFinished(h[g],i);e.finishModule("AutoBind"),e.finishModule("AutoBind"),b.exports=f},{"../lib/vendor/jsviews":3}],3:[function(a,b,c){var d=function(){!function(a,b,c){"use strict";function d(a,b){for(var c in b.props)ja.test(c)&&(a[c]=b.props[c])}function e(a){return a}function f(a){return a}function g(a){ya._dbgMode=a,U=a?"Unavailable (nested view): use #getIndex()":"",wa("dbg",va.dbg=ua.dbg=a?f:e)}function h(a){this.name=(Q.link?"JsViews":"JsRender")+" Error",this.message=a||this.name}function i(a,b){var c;for(c in b)a[c]=b[c];return a}function j(a){return"function"==typeof a}function k(a,b,c){return(!xa.rTag||a)&&(W=a?a.charAt(0):W,X=a?a.charAt(1):X,Y=b?b.charAt(0):Y,Z=b?b.charAt(1):Z,$=c||$,a="\\"+W+"(\\"+$+")?\\"+X,b="\\"+Y+"\\"+Z,S="(?:(?:(\\w+(?=[\\/\\s\\"+Y+"]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))\\s*((?:[^\\"+Y+"]|\\"+Y+"(?!\\"+Z+"))*?)",xa.rTag=S+")",S=new RegExp(a+S+"(\\/)?|(?:\\/(\\w+)))"+b,"g"),T=new RegExp("<.*>|([^\\\\]|^)[{}]|"+a+".*"+b)),[W,X,Y,Z,$]}function l(a,b){b||(b=a,a=c);var d,e,f,g,h=this,i=!b||"root"===b;if(a){if(g=h.type===b?h:c,!g)if(d=h.views,h._.useKey){for(e in d)if(g=d[e].get(a,b))break}else for(e=0,f=d.length;!g&&f>e;e++)g=d[e].get(a,b)}else if(i)for(;h.parent.parent;)g=h=h.parent;else for(;h&&!g;)g=h.type===b?h:c,h=h.parent;return g}function m(){var a=this.get("item");return a?a.index:c}function n(){return this.index}function o(b){var d,e=this,f=e.linkCtx,g=(e.ctx||{})[b];return g===c&&f&&f.ctx&&(g=f.ctx[b]),g===c&&(g=va[b]),g&&j(g)&&!g._wrp&&(d=function(){return g.apply(this&&this!==a?this:e,arguments)},d._wrp=!0,i(d,g)),d||g}function p(a,b,e,f){var g,h,i=+e===e&&b.tmpl.bnds[e-1],j=b.linkCtx;return f=f!==c&&{props:{},args:[f]},e=f||(i?i(b.data,b,sa):e),h=e.args[0],(a||i)&&(g=j&&j.tag,g||(g={_:{inline:!j,bnd:i},tagName:":",cvt:a,flow:!0,tagCtx:e,_is:"tag"},j&&(j.tag=g,g.linkCtx=j,e.ctx=M(e.ctx,j.view.ctx)),xa._lnk(g)),g._er=f&&h,d(g,e),e.view=b,g.ctx=e.ctx||{},delete e.ctx,b._.tag=g,h=q(g,g.convert||"true"!==a&&a)[0],h=i&&b._.onRender?b._.onRender(h,b,i):h,b._.tag=c),h!=c?h:""}function q(a,b){var c=a.tagCtx,d=c.view,e=c.args;return b=b&&(""+b===b?d.getRsc("converters",b)||E("Unknown converter: '"+b+"'"):b),e=e.length||c.index?b?e.slice():e:[d.data],b&&(b.depends&&(a.depends=xa.getDeps(a.depends,a,b.depends,b)),e[0]=b.apply(a,e)),e}function r(a,b){for(var d,e,f=this;d===c&&f;)e=f.tmpl[a],d=e&&e[b],f=f.parent;return d||sa[a][b]}function s(a,b,e,f,g,h){var j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B="",C=b.linkCtx||0,F=b.ctx,G=e||b.tmpl,H=+f===f&&G.bnds[f-1];for("tag"===a._is&&(j=a,a=j.tagName,f=j.tagCtxs),j=j||C.tag,h=h!==c&&(B+=h,[{props:{},args:[]}]),f=h||(H?H(b.data,b,sa):f),o=f.length,n=0;o>n;n++)n||e&&j||(u=b.getRsc("tags",a)||E("Unknown tag: {{"+a+"}}")),r=f[n],(!C.tag||j._er)&&(t=r.tmpl,t=r.content=t&&G.tmpls[t-1],i(r,{tmpl:(j?j:u).template||t,render:D,index:n,view:b,ctx:M(r.ctx,F)})),(e=r.props.tmpl)&&(e=""+e===e?b.getRsc("templates",e)||ta(e):e,r.tmpl=e),j||(u._ctr?(j=new u._ctr,v=!!j.init):xa._lnk(j={render:u.render}),j._={inline:!C},C&&(C.tag=j,j.linkCtx=C),(j._.bnd=H||C.fn)?j._.arrVws={}:j.dataBoundOnly&&E("{^{"+a+"}} tag must be data-bound"),j.tagName=a,j.parent=m=F&&F.tag,j._is="tag",j._def=u,j.tagCtxs=f),r.tag=j,j.dataMap&&j.tagCtxs&&(r.map=j.tagCtxs[n].map),j.flow||(s=r.ctx=r.ctx||{},k=j.parents=s.parentTags=F&&M(s.parentTags,F.parentTags)||{},m&&(k[m.tagName]=m),k[j.tagName]=s.tag=j);if(b._.tag=j,!(j._er=h)){for(d(j,f[0]),j.rendering={},n=0;o>n;n++)r=j.tagCtx=j.tagCtxs[n],z=r.props,y=q(j,j.convert),(w=z.dataMap||j.dataMap)&&(y.length||z.dataMap)&&(x=r.map,(!x||x.src!==y[0]||g)&&(x&&x.src&&x.unmap(),x=r.map=w.map(y[0],z)),y=[x.tgt]),j.ctx=r.ctx,!n&&v&&(A=j.template,j.init(r,C,j.ctx),v=c,j.template!==A&&(j._.tmpl=j.template),C&&(C.attr=j.attr=C.attr||j.attr)),p=c,j.render&&(p=j.render.apply(j,y)),y=y.length?y:[b],p=p!==c?p:r.render(y[0],!0)||(g?c:""),B=B?B+(p||""):p;delete j.rendering}return j.tagCtx=j.tagCtxs[0],j.ctx=j.tagCtx.ctx,j._.inline&&(l=j.attr)&&l!==oa&&(B="text"===l?ua.html(B):""),H&&b._.onRender?b._.onRender(B,b,H):B}function t(a,b,c,d,e,f,g,h){var i,j,k,l=this,n="array"===b,o={key:0,useKey:n?0:1,id:""+ma++,onRender:h,bnds:{}};l.data=d,l.tmpl=e,l.content=g,l.views=n?[]:{},l.parent=c,l.type=b||"top",l._=o,l.linked=!!h,c?(i=c.views,j=c._,j.useKey?(i[o.key="_"+j.useKey++]=l,l.index=U,l.getIndex=m,k=j.tag,o.bnd=n&&(!k||!!k._.bnd&&k)):i.splice(o.key=l.index=f,0,l),l.ctx=a||c.ctx):l.ctx=a}function u(a){var b,c,d,e,f,g,h;for(b in ra)if(f=ra[b],(g=f.compile)&&(c=a[b+"s"]))for(d in c)e=c[d]=g(d,c[d],a),e&&(h=xa.onStore[b])&&h(d,e,g)}function v(a,b,d){var e,f;return j(b)?b={depends:b.depends,render:b}:(b.baseTag&&(b.flow=!!b.flow,b=i(i({},b.baseTag),b)),(f=b.template)!==c&&(b.template=""+f===f?ta[f]||ta(f):f),b.init!==!1&&(e=b._ctr=function(){},(e.prototype=b).constructor=e)),d&&(b._parentTmpl=d),b}function w(d,e,f,g){function h(e){if(""+e===e||e.nodeType>0){try{j=e.nodeType>0?e:!T.test(e)&&b&&b(a.document).find(e)[0]}catch(h){}return j&&(e=ta[d=d||j.getAttribute(pa)],e||(d=d||"_"+la++,j.setAttribute(pa,d),e=ta[d]=w(d,j.innerHTML,f,g)),j=c),e}}var i,j;return e=e||"",i=h(e),g=g||(e.markup?e:{}),g.tmplName=d,f&&(g._parentTmpl=f),!i&&e.markup&&(i=h(e.markup))&&(!i.fn||i.debug===e.debug&&i.allowCode===e.allowCode||(i=i.markup)),i!==c?(d&&!f&&(qa[d]=function(){return e.render.apply(e,arguments)}),i.fn||e.fn?i.fn&&(e=d&&d!==i.tmplName?M(g,i):i):(e=y(i,g),G(i.replace(da,"\\$&"),e)),u(g),e):void 0}function x(a){function b(b,c){this.tgt=a.getTgt(b,c)}return j(a)&&(a={getTgt:a}),a.baseMap&&(a=i(i({},a.baseMap),a)),a.map=function(a,c){return new b(a,c)},a}function y(a,b){var c,d=ya.wrapMap||{},e=i({markup:a,tmpls:[],links:{},tags:{},bnds:[],_is:"template",render:C},b);return b.htmlTag||(c=ga.exec(a),e.htmlTag=c?c[1].toLowerCase():""),c=d[e.htmlTag],c&&c!==d.div&&(e.markup=Q.trim(e.markup)),e}function z(a,b){function d(f,g,h){var i,j,k,l;if(f&&"object"==typeof f&&!f.nodeType&&!f.markup&&!f.getTgt){for(k in f)d(k,f[k],g);return sa}return g===c&&(g=f,f=c),f&&""+f!==f&&(h=g,g=f,f=c),l=h?h[e]=h[e]||{}:d,j=b.compile,null===g?f&&delete l[f]:(g=j?g=j(f,g,h):g,f&&(l[f]=g)),j&&g&&(g._is=a),g&&(i=xa.onStore[a])&&i(f,g,j),g}var e=a+"s";sa[e]=d,ra[a]=b}function A(a,b,c){var d=this.jquery&&(this[0]||E('Unknown template: "'+this.selector+'"')),e=d.getAttribute(pa);return C.call(e?ta[e]:ta(d),a,b,c)}function B(a,b,c){if(ya._dbgMode)try{return a.fn(b,c,sa)}catch(d){return E(d,c)}return a.fn(b,c,sa)}function C(a,b,c,d,e,f){var g=this;return d||!g.fn._nvw||Q.isArray(a)?D.call(g,a,b,c,d,e,f):B(g,a,{tmpl:g})}function D(a,b,d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r,s,u,v,w=this,x="";if(!!b===b&&(d=b,b=c),f===!0&&(n=!0,f=0),w.tag?(o=w,w=w.tag,q=w._,s=w.tagName,u=q.tmpl||o.tmpl,v=w.attr&&w.attr!==oa,b=M(b,w.ctx),p=o.content,o.props.link===!1&&(b=b||{},b.link=!1),e=e||o.view,a=arguments.length?a:e):u=w,u&&(!e&&a&&"view"===a._is&&(e=a),e&&(p=p||e.content,g=g||e._.onRender,a===e&&(a=e.data),b=M(b,e.ctx)),e&&"top"!==e.type||((b=b||{}).root=a),u.fn||(u=ta[u]||ta(u)),u)){if(g=(b&&b.link)!==!1&&!v&&g,r=g,g===!0&&(r=c,g=e._.onRender),b=u.helpers?M(u.helpers,b):b,Q.isArray(a)&&!d)for(k=n?e:f!==c&&e||new t(b,"array",e,a,u,f,p,g),h=0,i=a.length;i>h;h++)j=a[h],l=new t(b,"item",k,j,u,(f||0)+h,p,g),m=B(u,j,l),x+=k._.onRender?k._.onRender(m,l):m;else(e||!u.fn._nvw)&&(k=n?e:new t(b,s||"data",e,a,u,f,p,g),q&&!w.flow&&(k.tag=w)),x+=B(u,a,k);return r?r(x,k):x}return""}function E(a,b,c){var d=ya.onError(a,b,c);if(""+a===a)throw new xa.Err(d);return!b.linkCtx&&b.linked?ua.html(d):d}function F(a){E("Syntax error\n"+a)}function G(a,b,c,d){function e(b){b-=m,b&&o.push(a.substr(m,b).replace(ba,"\\n"))}function f(b){b&&F('Unmatched or missing tag: "{{/'+b+'}}" in template:\n'+a)}function g(g,h,l,q,r,s,t,u,v,w,x,y){s&&(r=":",q=oa),w=w||c;var z=(h||c)&&[[]],A="",B="",C="",D="",E="",G="",H="",J="",L=!w&&!r&&!t;l=l||(v=v||"#data",r),e(y),m=y+g.length,u?k&&o.push(["*","\n"+v.replace(ca,"$1")+"\n"]):l?("else"===l&&(fa.test(v)&&F('for "{{else if expr}}" use "{{else expr}}"'),z=p[7],p[8]=a.substring(p[8],y),p=n.pop(),o=p[2],L=!0),v&&(K(v.replace(ba," "),z,b).replace(ea,function(a,b,c,d,e,f,g,h){return g?(B+=f+",",D+="'"+h+"',"):c?(C+=d+f+",",G+=d+"'"+h+"',"):b?H+=f:("trigger"===e&&(J+=f),A+=d+f+",",E+=d+"'"+h+"',",j=j||ja.test(e)),""}).slice(0,-1),z&&z[0]&&z.pop()),i=[l,q||!!d||j||"",L&&[],I(D,E,G),I(B,A,C),H,J,z||0],o.push(i),L&&(n.push(p),p=i,p[8]=m)):x&&(f(x!==p[0]&&"else"!==p[0]&&x),p[8]=a.substring(p[8],y),p=n.pop()),f(!p&&x),o=p[2]}var h,i,j,k=b&&b.allowCode,l=[],m=0,n=[],o=l,p=[,,l];return c&&(a=W+a+Z),f(n[0]&&n[0][2].pop()[0]),a.replace(S,g),e(a.length),(m=l[l.length-1])&&f(""+m!==m&&+m[8]===m[8]&&m[0]),c?(h=L(l,a,c),H(h,l[0][7])):h=L(l,b),h._nvw&&(h._nvw=!/[~#]/.test(a)),h}function H(a,b){a.deps=[];for(var c in b)"_jsvto"!==c&&b[c].length&&(a.deps=a.deps.concat(b[c]));a.paths=b}function I(a,b,c){return[a.slice(0,-1),b.slice(0,-1),c.slice(0,-1)]}function J(a,b){return"\n "+(b?b+":{":"")+"args:["+a[0]+"]"+(a[1]||!b?",\n props:{"+a[1]+"}":"")+(a[2]?",\n ctx:{"+a[2]+"}":"")}function K(a,b,c){function d(d,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,H,I,J){function K(a,c,d,h,i,k,l,m){if(d&&(j&&("linkTo"===e&&(f=b._jsvto=b._jsvto||[],f.push(s)),(!e||g)&&j.push(s.slice(c.length))),"."!==d)){var n=(h?'view.hlp("'+h+'")':i?"view":"data")+(m?(k?"."+k:h?"":i?"":"."+d)+(l||""):(m=h?"":i?k||"":d,""));return n+=m?"."+m:"",c+("view.data"===n.slice(0,9)?n.slice(5):n)}return a}t=t||"",q=q||p||z,s=s||w,x=x||E||"";var L,M,N,O=J.length-1;return!u||i||h?(j&&D&&!i&&!h&&(!e||g||f)&&(L=n[o],O>I-L&&(L=J.slice(L,I+1),D=X+":"+L+" onerror=''"+Y,N=l[D],N||(l[D]=!0,l[D]=N=G(D,c||j,!0),N.paths.push({_jsvOb:N})),N!==!0&&(f||j).push({_jsvOb:N}))),i?(i=!A,i?d:'"'):h?(h=!B,h?d:'"'):(q?(o++,n[o]=I++,q):"")+(H?o?"":(k=J.slice(k,I),(e?(e=g=f=!1,"\b"):"\b,")+k+(k=I+d.length,j&&b.push(j=[]),"\b")):v?(o&&F(a),j&&b.pop(),e=s,g=r,k=I+d.length,r&&(j=b[e]=[]),s+":"):s?s.split("^").join(".").replace(_,K)+(x?(m[++o]=!0,"."!==s.charAt(0)&&(n[o]=I),M?"":x):t):t?t:C?(m[o--]=!1,C+(x?(m[++o]=!0,x):"")):y?(m[o]||F(a),","):p?"":(i=A,h=B,'"'))):void F(a)}var e,f,g,h,i,j=b&&b[0],k=0,l=c?c.links:j&&(j.links=j.links||{}),m={},n={0:-1},o=0;return(a+(c?" ":"")).replace(/\)\^/g,").").replace(aa,d)}function L(a,b,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,z,A,B,C,D,E,G,I,K,M,N,O=0,P="",Q={},R=a.length;for(""+b===b?(w=d?'data-link="'+b.replace(ba," ").slice(1,-1)+'"':b,b=0):(w=b.tmplName||"unnamed",b.allowCode&&(Q.allowCode=!0),b.debug&&(Q.debug=!0),p=b.bnds,v=b.tmpls),e=0;R>e;e++)if(f=a[e],""+f===f)P+='\n+"'+f+'"';else if(g=f[0],"*"===g)P+=";\n"+f[1]+"\nret=ret";else{if(h=f[1],A=f[2],i=J(f[3],"params")+"},"+J(r=f[4]),K=f[5],N=f[6],B=f[8],(E="else"===g)||(O=0,p&&(q=f[7])&&(O=p.push(q))),(G=":"===g)?h&&(g=h===oa?">":h+g):(A&&(x=y(B,Q),x.tmplName=w+"/"+g,L(A,x),v.push(x)),E||(z=g,D=P,P=""),C=a[e+1],C=C&&"else"===C[0]),M=K?";\ntry{\nret+=":"\n+",s="",t="",G&&(q||N||h&&h!==oa)){if(I="return {"+i+"};",u='c("'+h+'",view,',I=new Function("data,view,j,u"," // "+w+" "+O+" "+g+"\n"+I),I._er=K,s=u+O+",",t=")",I._tag=g,d)return I;H(I,q),o=!0}if(P+=G?(d?(K?"\ntry{\n":"")+"return ":M)+(o?(o=c,n=m=!0,u+(q?(p[O-1]=I,O):"{"+i+"}")+")"):">"===g?(k=!0,"h("+r[0]+")"):(l=!0,"((v="+r[0]+')!=null?v:"")')):(n=j=!0,"\n{view:view,tmpl:"+(A?v.length:"0")+","+i+"},"),z&&!C){if(P="["+P.slice(0,-1)+"]",u='t("'+z+'",view,this,',d||q){if(P=new Function("data,view,j,u"," // "+w+" "+O+" "+z+"\nreturn "+P+";"),P._er=K,P._tag=g,q&&H(p[O-1]=P,q),d)return P;s=u+O+",undefined,",t=")"}P=D+M+u+(O||P)+")",q=0,z=0}K&&(n=!0,P+=";\n}catch(e){ret"+(d?"urn ":"+=")+s+"j._err(e,view,"+K+")"+t+";}\n"+(d?"":"ret=ret"))}P="// "+w+"\nvar v"+(j?",t=j._tag":"")+(m?",c=j._cnvt":"")+(k?",h=j.converters.html":"")+(d?";\n":',ret=""\n')+(Q.debug?"debugger;":"")+P+(d?"\n":";\nreturn ret;");try{P=new Function("data,view,j,u",P)}catch(S){F("Compiled template code:\n\n"+P+'\n: "'+S.message+'"')}return b&&(b.fn=P),n||(P._nvw=!0),P}function M(a,b){return a&&a!==b?b?i(i({},b),a):a:b&&i({},b)}function N(a){return na[a]||(na[a]="&#"+a.charCodeAt(0)+";")}function O(a){var b,c,d=[];if("object"==typeof a)for(b in a)c=a[b],c&&c.toJSON&&!c.toJSON()||j(c)||d.push({key:b,prop:c});return d}function P(a){return null!=a?ia.test(a)&&(""+a).replace(ka,N)||a:""}if(!(b&&b.render||a.jsviews)){var Q,R,S,T,U,V="v1.0.0-beta",W="{",X="{",Y="}",Z="}",$="^",_=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,aa=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*\.|\s*\^|\s*$)|[)\]])([([]?))|(\s+)/g,ba=/[ \t]*(\r\n|\n|\r)/g,ca=/\\(['"])/g,da=/['"\\]/g,ea=/(?:\x08|^)(onerror:)?(?:(~?)(([\w$]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi,fa=/^if\s/,ga=/<(\w+)[>\s]/,ha=/[\x00`><"'&]/g,ia=/[\x00`><\"'&]/,ja=/^on[A-Z]|^convert(Back)?$/,ka=ha,la=0,ma=0,na={"&":"&amp;","<":"&lt;",">":"&gt;","\x00":"&#0;","'":"&#39;",'"':"&#34;","`":"&#96;"},oa="html",pa="data-jsv-tmpl",qa={},ra={template:{compile:w},tag:{compile:v},helper:{},converter:{}},sa={jsviews:V,settings:function(a){i(ya,a),g(ya._dbgMode),ya.jsv&&ya.jsv()},sub:{View:t,Err:h,tmplFn:G,cvt:q,parse:K,extend:i,syntaxErr:F,onStore:{},_lnk:e,_ths:d},map:x,_cnvt:p,_tag:s,_err:E};(h.prototype=new Error).constructor=h,m.depends=function(){return[this.get("item"),"index"]},n.depends=function(){return["index"]},t.prototype={get:l,getIndex:n,getRsc:r,hlp:o,_is:"view"};for(R in ra)z(R,ra[R]);var ta=sa.templates,ua=sa.converters,va=sa.helpers,wa=sa.tags,xa=sa.sub,ya=sa.settings;b?(Q=b,Q.fn.render=A,Q.observable&&(i(xa,Q.views.sub),sa.map=Q.views.map)):(Q=a.jsviews={},Q.isArray=Array&&Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Q.render=qa,Q.views=sa,Q.templates=ta=sa.templates,ya({debugMode:g,delimiters:k,onError:function(a,b,d){return b&&(a=d===c?"{Error: "+a+"}":j(d)?d(a,b):d),a==c?"":a},_dbgMode:!0}),wa({"else":function(){},"if":{render:function(a){var b=this,c=b.rendering.done||!a&&(arguments.length||!b.tagCtx.index)?"":(b.rendering.done=!0,b.selected=b.tagCtx.index,b.tagCtx.render(b.tagCtx.view,!0));return c},onUpdate:function(a,b,c){var d,e,f;for(d=0;(e=this.tagCtxs[d])&&e.args.length;d++)if(e=e.args[0],f=!e!=!c[d].args[0],!this.convert&&e||f)return f;return!1},flow:!0},"for":{render:function(a){var b,d=this,e=d.tagCtx,f="",g=0;return d.rendering.done||((b=!arguments.length)&&(a=e.view.data),a!==c&&(f+=e.render(a,b),g+=Q.isArray(a)?a.length:1),(d.rendering.done=g)&&(d.selected=e.index)),f},flow:!0},include:{flow:!0},"*":{render:e,flow:!0}}),wa("props",{baseTag:wa["for"],dataMap:x(O)}),ua({html:P,attr:P,url:function(a){return a!=c?encodeURI(""+a):null===a?a:""}}),k()}}(this,this.jQuery),function(a,b,c){"use strict";function d(a){return w(a)?new f(a):new e(a)}function e(a){return this._data=a,this}function f(a){return this._data=a,this}function g(a){return w(a)?[a]:a}function h(a,b){a=w(a)?a:[a];var c,d,e=b,f=e,g=a.length,i=[];for(c=0;g>c;c++)d=a[c],F(d)?i=i.concat(h(d.call(b,b),b)):""+d===d?(f!==e&&i.push(e=f),i.push(d)):(b=f=d,f!==e&&i.push(e=f));return i}function i(a,b){var c,d;for(c in a){d=!0;break}d||delete D[b]}function j(a,b){if(!a.data||!a.data.off){var d,e,f,g,h,i=b.oldValue,j=b.value,k=a.data,l=k.observeAll,n=!k.cb.noArray,o=k.paths;a.type===C?(k.cb.array||k.cb).call(k,a,b):(k.prop===b.path||"*"===k.prop)&&(g=typeof i===y&&(o[0]||n&&w(i)),h=typeof j===y&&(o[0]||n&&w(j)),l?(d=l._path+"."+b.path,e=l.filter,f=[a.target].concat(l.parents()),g&&m(n,l.ns,[i],o,k.cb,!0,e,[f],d),h&&m(n,l.ns,[j],o,k.cb,c,e,[f],d)):(g&&m(n,[i],o,k.cb,!0),h&&m(n,[j],o,k.cb)),k.cb(a,b))}}function k(){function a(a,c,d,e){var f,h,i=I(aa),k=g(aa);if(a=S?a+"."+S:a,s||e)i&&b(k).off(a,j);else{if(J=i&&b._data(aa))for(J=J&&J.events,J=J&&J[d?C:B],x=J&&J.length;x--;)if((z=J[x].data)&&z.cb._cId===t._cId&&z.ns===S){if(d)return;("*"===c&&z.prop!==c||z.prop===p)&&b(aa).off(a,j)}h=d?{}:{fullPath:q,paths:c?[c]:[],prop:p},h.ns=S,h.cb=t,Q&&(h.observeAll={_path:Q,path:function(){return f=P.length,Q.replace(/[[.]/g,function(a){return f--,"["===a?"["+b.inArray(P[f-1],P[f]):"."})},parents:function(){return P},filter:R,ns:S}),b(k).on(a,null,h,j),M&&((D[t._cId]=M)[b.data(aa,"obId")||b.data(aa,"obId",G++)]=aa)}}function e(a,b){a._ob=K(a,$);var c=$;return function(d,e){var g=a._ob,h=b.length;typeof g===y&&(f(g,!0),(h||V&&w(g))&&m(V,[g],b,t,K,!0)),g=a._ob=K(a,c),typeof g===y&&(f(g),(h||V&&w(g))&&m(V,[g],b,t,K,[c])),t(d,e)}}function f(b,e,f,g){if(V){var h=aa,i=Q;aa=b,g&&(aa=b[g],Q+="."+g),R&&aa&&(aa=d._fltr(Q,aa,g?[b].concat(P):P,R)),aa&&(f||w(aa))&&a(C+".observe"+(t?".obs"+(u=t._cId=t._cId||H++):""),c,!0,e),aa=h,Q=i}}var k,l,n,o,p,q,r,s,t,u,x,z,J,K,L,M,N,O,P,Q,R,S,T,U,V=0!=this,W=!0,X=E,Y=Array.apply(0,arguments),Z=Y.pop(),$=Y.shift(),_=$,aa=_,ba=Y.length;for($+""===$&&V&&(S=$,$=aa=_=Y.shift(),ba--),F(Z)?t=Z:(Z+""===Z&&(Q=Z,P=Y.pop(),R=Y.pop(),Z=Y.pop(),ba-=3),Z===!0?s=Z:Z&&($=Z,W=c),Z=Y[ba-1],(ba&&Z===c||F(Z))&&(t=Y.pop(),ba--)),ba&&F(Y[ba-1])&&(K=t,t=Y.pop(),ba--),X+=s?t?".obs"+t._cId:"":".obs"+(u=t._cId=t._cId||H++),s||(M=D[u]=D[u]||{}),T=S&&S.match(A)||[""],U=T.length;U--;)for(S=T[U],w(_)?f(_,s,!0):s&&0===ba&&_&&a(X,""),N=0,k=0;ba>k;k++)if(q=Y[k],""!==q){if(aa=_,""+q===q){if(o=q.split("^"),o[1]&&(N=o[0].split(".").length,q=o.join("."),N=q.split(".").length-N),K&&(L=K(q,_))){ba+=L.length-1,v.apply(Y,[k--,1].concat(L));continue}o=q.split(".")}else W&&!F(q)&&(q&&q._jsvOb&&(O=e(q,Y.slice(k+1)),O.noArray=!V,O._cId=t._cId,m(V,[$],Y.slice(0,k),O,K),O=c,q=q._ob),aa=q),_=q,o=[_];for(;aa&&(p=o.shift())!==c;)if(typeof aa===y){if(""+p===p){if(""===p)continue;if(o.length<N+1&&!aa.nodeType){if(!s&&(J=I(aa)&&b._data(aa))){for(J=J.events,J=J&&J[B],x=J&&J.length,n=0;x--;)z=J[x].data,z&&z.cb===t&&z.ns===S&&(z.prop===p||"*"===z.prop)&&((l=o.join("."))&&z.paths.push(l),n++);if(n){aa=aa[p];continue}}if("*"===p){!s&&J&&J.length&&a(X,"",!1,!0),F(aa)?(r=aa.depends)&&m(V,[r],t,s||$):a(X,"");for(l in aa)f(aa,s,c,l);break}p&&a(X+"."+p,o.join("^"))}Q&&(Q+="."+p),p=aa[p]}if(F(p)){(r=p.depends)&&m(V,[aa],h(r,aa),t,K,s||[$]);break}aa=p}f(aa,s)}return u&&i(M,u),{cbId:u,bnd:M}}function l(){return[].push.call(arguments,!0),k.apply(this,arguments)}function m(){var a=[].concat.apply([],arguments);return k.apply(a.shift(),a)}function n(a,b,c,d){a+""!==a&&(c=b,b=a,a=""),p(a,this._data,b,c,[],"root",d)}function o(a,b,c){n.call(this,a,b,c,!0)}function p(a,b,e,f,g,h,i){function j(a,b){for(n=a.length,r=[[a]].concat(r),q=h+"[]";n--;)l(a,n,b,1)}function l(b,g,h,i){var j;g!==x&&(j=d._fltr(q,b[g],r,f))&&p(a,j,e,f||(i?c:0),r.slice(),q,h)}function m(a,b){var c=g;switch(h=a.data.observeAll._path,r=[a.target].concat(g),b.change){case"insert":j(b.items);break;case"remove":j(b.items,!0);break;case"refresh":j(b.oldItems,!0),j(a.target);break;case"set":q=h+"."+b.path,l(b,"oldValue",!0),l(b,"value")}e.apply(this,arguments),g=c}var n,o,q,r;if(typeof b===y)if(o=w(b)?"":"*",e?(o||0!==f)&&(m._cId=e._cId=e._cId||H++,k(a,b,o,m,i,f,g,h)):k(a,b,o,c,i,f,g,h),o){r=[b].concat(g);for(n in b)q=h+"."+n,l(b,n,i)}else j(b,i)}function q(a){return a.indexOf(".")<0&&a.indexOf("[")<0}if(!b)throw"jsViews/jsObservable require jQuery";if(!b.observable){var r="v1.0.0-alpha",s=b.views=b.views||{jsviews:r,sub:{}},t=s.sub,u=b.event.special,v=[].splice,w=b.isArray,x=b.expando,y="object",z=parseInt,A=/\S+/g,B=t.propChng=t.propChng||"propertyChange",C=t.arrChng=t.arrChng||"arrayChange",D=t._cbBnds=t._cbBnds||{},E=B+".observe",F=b.isFunction,G=1,H=1,I=b.hasData,J={};t.getDeps=function(){var a=arguments;return function(){for(var b,c,d=[],e=a.length;e--;)b=a[e--],c=a[e],c&&(d=d.concat(F(c)?c(b,b):c));return d}},b.observable=d,d._fltr=function(a,b,c,d){return(d&&F(d)?d(a,b,c):!0)?(b=F(b)?b.set&&b.call(c[0]):b,typeof b===y&&b):void 0},d.Object=e,d.Array=f,b.observe=d.observe=k,b.unobserve=d.unobserve=l,d._apply=m,e.prototype={_data:null,observeAll:n,unobserveAll:o,data:function(){return this._data},setProperty:function(a,b,d){var e,f,g,h=this,i=h._data;if(a=a||"",i)if(w(a))for(e=a.length;e--;)f=a[e], h.setProperty(f.name,f.value,d===c||d);else if(""+a!==a)for(e in a)h.setProperty(e,a[e],b);else if(a!==x){for(g=a.split(".");i&&g.length>1;)i=i[g.shift()];i&&h._setProperty(i,g[0],b,d)}return h},removeProperty:function(a){return this.setProperty(a,J),this},_setProperty:function(a,b,d,e){var f,g,h,i=b?a[b]:a;F(i)&&i.set&&(g=i,f=i.set===!0?i:i.set,i=i.call(a)),(i!==d||e&&i!=d)&&(!(i instanceof Date)||i>d||d>i)&&(f?(f.call(a,d),d=g.call(a)):(h=d===J)?(delete a[b],d=c):b&&(a[b]=d),this._trigger(a,{change:"set",path:b,value:d,oldValue:i,remove:h}))},_trigger:function(a,c){b(a).triggerHandler(B,c)}},f.prototype={_data:null,observeAll:n,unobserveAll:o,data:function(){return this._data},insert:function(a,b){var c=this._data;return 1===arguments.length&&(b=a,a=c.length),a=z(a),a>-1&&a<=c.length&&(b=w(b)?b:[b],b.length&&this._insert(a,b)),this},_insert:function(a,b){var c=this._data,d=c.length;v.apply(c,[a,0].concat(b)),this._trigger({change:"insert",index:a,items:b},d)},remove:function(a,b){var d,e=this._data;return a===c&&(a=e.length-1),a=z(a),b=b?z(b):0===b?0:1,b>-1&&a>-1&&(d=e.slice(a,a+b),b=d.length,b&&this._remove(a,b,d)),this},_remove:function(a,b,c){var d=this._data,e=d.length;d.splice(a,b),this._trigger({change:"remove",index:a,items:c},e)},move:function(a,b,c){if(c=c?z(c):0===c?0:1,a=z(a),b=z(b),c>0&&a>-1&&b>-1&&a!==b){var d=this._data.slice(a,a+c);c=d.length,c&&this._move(a,b,c,d)}return this},_move:function(a,b,c,d){var e=this._data,f=e.length;e.splice(a,c),e.splice.apply(e,[b,0].concat(d)),this._trigger({change:"move",oldIndex:a,index:b,items:d},f)},refresh:function(a){var b=this._data.slice();return this._refresh(b,a),this},_refresh:function(a,b){var c=this._data,d=c.length;v.apply(c,[0,c.length].concat(b)),this._trigger({change:"refresh",oldItems:a},d)},_trigger:function(a,c){var d=this._data,e=d.length,f=b([d]);f.triggerHandler(C,a),e!==c&&f.triggerHandler(B,{change:"set",path:"length",value:e,oldValue:c})}},u[B]=u[C]={remove:function(a){var c,d,e,f,g,h=a.data;if(h&&(h.off=!0,h=h.cb)&&(c=D[h._cId])){for(e=b._data(this).events[a.type],f=e.length;f--&&!d;)d=(g=e[f].data)&&g.cb===h;d||(delete c[b.data(this,"obId")],i(c,h._cId))}}},s.map=function(a){function e(b,e,f){var g,h=this;this.src&&this.unmap(),"object"==typeof b&&(h.src=b,h.tgt=f||h.tgt||[],h.options=e||h.options,h.update(),a.obsSrc&&d(h.src).observeAll(h.obs=function(b,d){g||(g=!0,a.obsSrc(h,b,d),g=c)},h.srcFlt),a.obsTgt&&d(h.tgt).observeAll(h.obt=function(b,d){g||(g=!0,a.obsTgt(h,b,d),g=c)},h.tgtFlt))}return F(a)&&(a={getTgt:a}),a.baseMap&&(a=b.extend({},a.baseMap,a)),a.map=function(a,b,c){return new e(a,b,c)},(e.prototype={srcFlt:a.srcFlt||q,tgtFlt:a.tgtFlt||q,update:function(b){var c=this;d(c.tgt).refresh(a.getTgt(c.src,c.options=b||c.options))},unmap:function(){var a=this;a.src&&(a.obs&&d(a.src).unobserveAll(a.obs,a.srcFlt),a.obt&&d(a.tgt).unobserveAll(a.obt,a.tgtFlt),a.src=c)},map:e,_def:a}).constructor=e,a}}}(this,this.jQuery),function(a,b,c){"use strict";function d(a,d,e){var f,g,h,i,j,l,m,n,o,p,q,r,s,t,u,v,w=a.target,x=w._jsvBnd,y=/&(\d+)\+?/g;if(x)for(;p=y.exec(x);)(p=Ta[p[1]])&&(u=p.to)&&(i=p.linkCtx,o=i.view,t=i.tag,n=b(w),r=o.hlp(sa),s=o.hlp(ta),h=k(w),f=Fa[h],e===c&&(e=ja(h)?h(w):f?n[f]():n.attr(h)),l=u[1],u=u[0],l&&(j=ja(l)?l:o.getRsc("converters",l)),j&&(e=j.call(t,e)),q=o.linkCtx,o.linkCtx=i,v={change:"change",oldValue:i._val,value:e},r&&(g=r.call(i,a,v)===!1)||t&&t.onBeforeChange&&(g=t.onBeforeChange(a,v)===!1)||e===c||(m=u[0],e!==c&&m&&(m=m._jsvOb?m._ob:m,t&&(t._.chging=!0),ma(m).setProperty(u[2]||u[1],e),s&&s.call(i,a,v),t&&(t.onAfterChange&&t.onAfterChange(a,v),delete t._.chging),i._val=e)),o.linkCtx=q)}function e(a,b,d){var e,g,i,j,l,m,o=this,p=o.tag,q=o.data,r=o.elem,s=o.convert,t=r.parentNode,u=o.view,v=u.linkCtx,w=u.hlp(sa);if(u.linkCtx=o,t&&(!w||!b||w.call(o,a,b)!==!1)&&(!b||"*"===a.data.prop||a.data.prop===b.path)){if(b&&(o.eventArgs=b),b||o._initVal){if(delete o._initVal,d._er)try{g=d(q,u)}catch(x){l=d._er,m=Y(x,u,new Function("data,view","return "+l+";")(q,u)),g=[{props:{},args:[m]}]}else g=d(q,u,fa);if(e=f(g,o,p=o.tag,o.attr||k(r,!0,s!==c)),p){if(j=l||p._er,g=g[0]?g:[g],i=!j&&b&&p.onUpdate&&p.onUpdate(a,b,g)===!1,D(p,g,j),i||e===ya)return e===Ea&&p.onBeforeLink&&p.onBeforeLink(),z(p,p.tagCtx),n(o,q,r),void(u.linkCtx=v);if(p._.chging)return;g=":"===p.tagName?fa._cnvt(p.cvt,u,g[0]):fa._tag(p,u,u.tmpl,g,!0,m)}else d._tag&&(s=""===s?za:s,g=s?fa._cnvt(s,u,g[0]||g):fa._tag(d._tag,u,u.tmpl,g,!0,m),p=o.tag,e=o.attr||e);h(g,o,e,p)&&b&&(w=u.hlp(ta))&&w.call(o,a,b),p&&(p._er=l,z(p,p.tagCtx))}n(o,q,r),u.linkCtx=v}}function f(a,d,e,f){var g,h,i,j,k=e&&e.parentElem||d.elem;if(a!==c){if(j=b(k),f=e&&e.attr||f,ja(a)&&Y(d.expr+": missing parens"),i=/^css-/.test(f)&&f.slice(4))g=b.style(k,i),+a===a&&(g=parseInt(g));else if("link"!==f){if("value"===f)k.type===wa&&(g=j.prop(f=va));else if(f===xa){if(k.value!==""+a)return f;g=j.prop(va)}g===c&&(h=Fa[f],g=h?j[h]():j.attr(f))}d._val=g}return f}function g(a,b){a._df=b,a[(b?"set":"remove")+"Attribute"](Ca,"")}function h(d,e,f,h){var i,j,k,l,m,o,p,q,r,s,t,u,v,w=d!==c,x=e.data,y=h&&h.parentElem||e.elem,z=b(y),A=e.view,B=e._val,C=A.linkCtx,D=h||f===Ea;if(h&&(h.parentElem=h.parentElem||e.expr||h._elCnt?y:y.parentNode,j=h._prv,k=h._nxt),!w)return void(f===Ea&&h&&h.onBeforeLink&&h.onBeforeLink());if("visible"===f&&(f="css-display"),/^css-/.test(f))"visible"===e.attr&&(v=(y.currentStyle||ab.call(a,y,"")).display,d?(d=y._jsvd||v,d!==ya||(d=Sa[u=y.nodeName])||(t=ea.createElement(u),ea.body.appendChild(t),d=Sa[u]=(t.currentStyle||ab.call(a,t,"")).display,ea.body.removeChild(t))):(y._jsvd=v,d=ya)),(D=D||B!==d)&&b.style(y,f.slice(4),d);else if("link"!==f){if(f===va)o=!0,d=d&&"false"!==d;else if(f===xa){if(y.value!==""+d)return void n(e,x,y);d=o=!0,f=va}else("selected"===f||"disabled"===f||"multiple"===f||"readonly"===f)&&(d=d&&"false"!==d?f:null);(i=Fa[f])?f===Ea?(A.linkCtx=e,h&&h._.inline?(m=h.nodes(!0),h._elCnt&&(j&&j!==k?K(j,k,y,h._tgId,"^",!0):(p=y._df)&&(q=h._tgId+"^",r=p.indexOf("#"+q)+1,s=p.indexOf("/"+q),r&&s>0&&(r+=q.length,s>r&&(g(y,p.slice(0,r)+p.slice(s)),L(p.slice(r,s))))),j=j?j.previousSibling:k?k.previousSibling:y.lastChild),b(m).remove(),h&&h.onBeforeLink&&h.onBeforeLink(),l=A.link(A.data,y,j,k,d,h&&{tag:h._tgId,lazyLink:h.tagCtx.props.lazyLink})):(w&&z.empty(),h&&h.onBeforeLink&&h.onBeforeLink(),w&&(l=A.link(x,y,j,k,d,h&&{tag:h._tgId}))),A.linkCtx=C):(D=D||B!==d)&&("text"===f&&y.children&&!y.children[0]?y.textContent!==c?y.textContent=d:y.innerText=null===d?"":d:z[i](d)):(D=D||B!==d)&&z[o?"prop":"attr"](f,d!==c||o?d:null),e._val=d}return l||D}function i(a,b){var c=this,d=c.hlp(sa),e=c.hlp(ta);if(!d||d.call(this,a,b)!==!1){if(b){var f=b.change,g=b.index,h=b.items;switch(f){case"insert":c.addViews(g,h);break;case"remove":c.removeViews(g,h.length);break;case"move":c.refresh();break;case"refresh":c.refresh()}}e&&e.call(this,a,b)}}function j(a){var d,e,f=a.type,g=a.data,h=a._.bnd;!a._.useKey&&h&&((e=a._.bndArr)&&(b([e[1]]).off(qa,e[0]),a._.bndArr=c),h!==!!h&&h._.inline?f?h._.arrVws[a._.id]=a:delete h._.arrVws[a._.id]:f&&g&&(d=function(b){b.data&&b.data.off||i.apply(a,arguments)},b([g]).on(qa,d),a._.bndArr=[d,g]))}function k(a,b,c){var d=a.nodeName.toLowerCase(),e=ha.merge[d]||a.contentEditable===za&&{to:Ea,from:Ea};return e?b?"input"===d&&a.type===xa?xa:e.to:e.from:b?c?"text":Ea:""}function l(a,d,e,f,g,h,i){var j,k,l,m,n,o=a.parentElem,p=a._prv,q=a._nxt,r=a._elCnt;if(p&&p.parentNode!==o&&Y("Missing parentNode"),i){m=a.nodes(),r&&p&&p!==q&&K(p,q,o,a._.id,"_",!0),a.removeViews(c,c,!0),k=q,r&&(p=p?p.previousSibling:q?q.previousSibling:o.lastChild),b(m).remove();for(n in a._.bnds)F(n)}else{if(d){if(l=f[d-1],!l)return!1;p=l._nxt}r?(k=p,p=k?k.previousSibling:o.lastChild):k=p.nextSibling}j=e.render(g,h,a._.useKey&&i,a,i||d,!0),a.link(g,o,p,k,j,l)}function m(a,b,d){var e,f,g;return d?(g="^`",f=b._.tag,e=f._tgId,e||(Ta[e=Ua++]=f,f._tgId=""+e)):(g="_`",ca[e=b._.id]=b),"#"+e+g+(a!=c?a:"")+"/"+e+g}function n(a,b,d){var e,f,g,h=a.tag,i=a.convertBack,j=[],k=a._bndId||""+Ua++,l=a._hdlr;if(delete a._bndId,h&&(j=h.depends||j,j=ja(j)?h.depends(h):j,g=h.linkedElem),a._depends&&""+a._depends==""+j||(a._depends&&ma._apply(!1,[b],a._depends,l,!0),e=ma._apply(!1,[b],a.fn.deps,j,l,a._ctxCb),e.elem=d,e.linkCtx=a,e._tgId=k,d._jsvBnd=d._jsvBnd||"",d._jsvBnd+="&"+k,a._depends=j,a.view._.bnds[k]=k,Ta[k]=e,g&&(e.to=[[],i]),(g||i!==c)&&C(e,h&&h.convertBack||i),h&&(h.onAfterBind&&h.onAfterBind(e),h.flow||h._.inline||(d.setAttribute(oa,(d.getAttribute(oa)||"")+"#"+k+"^/"+k+"^"),h._tgId=""+k))),g&&g[0])for(h._.radio&&(g=g.children("input[type=radio]")),f=g.length;f--;)g[f]._jsvBnd=g[f]._jsvBnd||d._jsvBnd+"+",g[f]._jsvLkEl=h}function o(a,b,c,d,e,f,g){return p(this,a,b,c,d,e,f,g)}function p(a,e,f,h,i,j,k,l){if(a&&e){e=e.jquery?e:b(e),P||(P=ea.body,b(P).on(ra,d).on("blur","[contenteditable]",d));for(var n,o,p,q,s,t,u,w,x=m,y=h&&"replace"===h.target,z=e.length;z--;)if(u=e[z],""+a===a)r(a,u,Q(u),c,!0,f,h);else{if(j=j||Q(u),a.markup!==c)j.link===!1&&(h=h||{},h.link=x=!1),y&&(t=u.parentNode),p=a.render(f,h,i,j,c,x),t?(k=u.previousSibling,l=u.nextSibling,b.cleanData([u],!0),t.removeChild(u),u=t):(k=l=c,b(u).empty());else{if(a!==!0||j!==ba)break;w={lnk:1}}if(u._df&&!l){for(q=v(u._df,!0,Xa),n=0,o=q.length;o>n;n++)s=q[n],(s=ca[s.id])&&s.data!==c&&s.parent.removeViews(s._.key,c,!0);g(u)}j.link(f,u,k,l,p,w,h)}}return e}function q(a,d,e,f,h,k,l,n){function o(a,b,d,e,f,g,i,j,k,l,m,n,o){var p,q="";return o?(y=0,a):(B=j||k||"",e=e||l,d=d||n,ia&&!d&&(e||B||g)&&(ia=c,ga=Ga.shift()),e=e||d,e&&(y=0,ia=c,V&&(d||n?Ra[ga]||/;svg;|;math;/.test(";"+Ga.join(";")+";")||(p="'<"+ga+".../"):Ra[e]?p="'</"+e:Ga.length&&e===ga||(p="Mismatch: '</"+e),p&&Ka(p+">' in:\n"+h)),na=ma,ga=Ga.shift(),ma=Pa[ga],l=l?"</"+l+">":"",na&&(Ea+=qa,qa="",ma?Ea+="-":(q=l+Ba+"@"+Ea+Aa+(m||""),Ea=Ha.shift()))),ma?(g?qa+=g:b=l||n||"",B&&(b+=B,qa&&(b+=" "+oa+'="'+qa+'"',qa=""))):b=g?b+q+f+Ba+g+Aa+i+B:q||a,y&&g&&Ka(" No {^{ tags within elem markup ("+y+' ). Use data-link="..."'),B&&(y=B,Ga.unshift(ga),ga=B.slice(1),Ga[0]&&Ga[0]===Qa[ga]&&Y("Parent of <tr> must be <tbody>"),ia=Ra[ga],(ma=Pa[ga])&&!na&&(Ha.unshift(Ea),Ea=""),na=ma,Ea&&ma&&(Ea+="+")),b)}function p(a,b){var e,f,h,k,l,n,o,p=[];if(a){for("@"===a._tkns.charAt(0)&&(b=H.previousSibling,H.parentNode.removeChild(H),H=c),F=a.length;F--;){if(J=a[F],h=J.ch,e=J.path)for(E=e.length-1;f=e.charAt(E--);)"+"===f?"-"===e.charAt(E)?(E--,b=b.previousSibling):b=b.parentNode:b=b.lastChild;"^"===h?(B=Ta[l=J.id])&&(o=b&&(!H||H.parentNode!==b),(!H||o)&&(B.parentElem=b),J.elCnt&&o&&g(b,(J.open?"#":"/")+l+h+(b._df||"")),p.push([o?null:H,J])):(I=ca[l=J.id])&&(I.parentElem||(I.parentElem=b||H&&H.parentNode||d,I._.onRender=m,I._.onArrayChange=i,j(I)),k=I.parentElem,J.open?(I._elCnt=J.elCnt,b&&!H?g(b,"#"+l+h+(b._df||"")):(I._prv||g(k,t(k._df,"#"+l+h)),I._prv=H)):(!b||H&&H.parentNode===b?H&&(I._nxt||g(k,t(k._df,"/"+l+h)),I._nxt=H):(g(b,"/"+l+h+(b._df||"")),I._nxt=c),A=I.linkCtx,(n=I.ctx&&I.ctx.onAfterCreate||Ia)&&n.call(A,I)))}for(F=p.length;F--;)Fa.push(p[F])}return!a||a.elCnt}function q(a){var b,c;if(a)for(F=a.length,E=0;F>E;E++)if(J=a[E],c=B=Ta[J.id].linkCtx.tag,!B.flow){if(!S){for(b=1;c=c.parent;)b++;W=W||b}!S&&b!==W||T&&B.tagName!==T||R.push(B)}}function s(){var g,i,j="",k={},m=_+(xa?",["+Ca+"]":"");for(G=Oa?d.querySelectorAll(m):b(m,d).get(),D=G.length,e&&e.innerHTML&&(L=Oa?e.querySelectorAll(m):b(m,e).get(),e=L.length?L[L.length-1]:e),W=0,C=0;D>C;C++)if(H=G[C],e&&!sa)sa=H===e;else{if(f&&H===f){xa&&(j+=u(H));break}if(H.parentNode)if(xa){if(j+=u(H),H._df){for(g=C+1;D>g&&H.contains(G[g]);)g++;k[g-1]=H._df}k[C]&&(j+=k[C]||"")}else wa&&(J=v(H,c,Za))&&(J=J[0])&&(ta=ta?J.id!==ta&&ta:J.open&&J.id),!ta&&Ja(v(H))&&H.getAttribute(Z)&&Fa.push([H])}if(xa&&(j+=d._df||"",(i=j.indexOf("#"+xa.id)+1)&&(j=j.slice(i+xa.id.length)),i=j.indexOf("/"+xa.id),i+1&&(j=j.slice(0,i)),q(v(j,c,$a))),h===c&&d.getAttribute(Z)&&Fa.push([d]),w(e,ma),w(f,ma),xa)return void(va&&va.resolve());for(ma&&Ea+qa&&(H=f,Ea&&(f?p(v(Ea+"+",!0),f):p(v(Ea,!0),d)),p(v(qa,!0),d),f&&(j=f.getAttribute(oa),(D=j.indexOf(ra)+1)&&(j=j.slice(D+ra.length-1)),f.setAttribute(oa,qa+j))),D=Fa.length,C=0;D>C;C++)H=Fa[C],K=H[1],H=H[0],K?(B=Ta[K.id])&&((A=B.linkCtx)&&(B=A.tag,B.linkCtx=A),K.open?(H&&(B.parentElem=H.parentNode,B._prv=H),B._elCnt=K.elCnt,!B||B.onBeforeLink&&B.onBeforeLink()===!1||B._.bound||(B._.bound=!0,I=B.tagCtx.view,r(c,B._prv,I,K.id)),B._.linking=!0):(B._nxt=H,B._.linking&&(U=B.tagCtx,I=U.view,delete B._.linking,B._.bound||(B._.bound=!0,r(c,B._prv,I,K.id)),z(B,U)))):r(H.getAttribute(Z),H,Q(H),c,wa,a,l);va&&va.resolve()}var y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,T,U,V,W,$,ba,da,fa,ga,ia,ja,ka,la,ma,na,pa,qa,ra,sa,ta,va,wa,xa,ya=this,Da=ya._.id+"_",Ea="",Fa=[],Ga=[],Ha=[],Ia=ya.hlp(ua),Ja=p;if(k&&(va=k.lazyLink&&b.Deferred(),k.tmpl?N="/"+k._.id+"_":(wa=k.lnk,k.tag&&(Da=k.tag+"^",k=!0),(xa=k.get)&&(Ja=q,R=xa.tags,S=xa.deep,T=xa.name)),k=k===!0),d=d?""+d===d?b(d)[0]:d.jquery?d[0]:d:ya.parentElem||ea.body,V=!ha.noValidate&&d.contentEditable!==za,ga=d.tagName.toLowerCase(),ma=!!Pa[ga],e=e&&x(e,ma),f=f&&x(f,ma)||null,h!=c){if(ka=ea.createElement("div"),ja=ka,ra=qa="",pa="http://www.w3.org/2000/svg"===d.namespaceURI?"svg_ns":(fa=La.exec(h))&&fa[1]||"",X&&fa&&fa[2]&&Y("Unsupported: "+fa[2]),ma){for(P=f;P&&!(O=v(P));)P=P.nextSibling;(la=O?O._tkns:d._df)&&(M=N||"",(k||!N)&&(M+="#"+Da),E=la.indexOf(M),E+1&&(E+=M.length,ra=qa=la.slice(0,E),la=la.slice(E),O?P.setAttribute(oa,la):g(d,la)))}if(ia=c,h=(""+h).replace(Wa,o),V&&Ga.length&&Ka("Mismatched '<"+ga+"...>' in:\n"+h),n)return;for(Na.appendChild(ka),pa=aa[pa]||aa.div,$=pa[0],ja.innerHTML=pa[1]+h+pa[2];$--;)ja=ja.lastChild;for(Na.removeChild(ka),ba=ea.createDocumentFragment();da=ja.firstChild;)ba.appendChild(da);d.insertBefore(ba,f)}return va?setTimeout(s,0):s(),va&&va.promise()}function r(a,b,d,e,f,g,h){var i,j,l,m,n,o,p,q,r,t,u;if(e)t=Ta[e],t=t.linkCtx?t.linkCtx.tag:t,r=t.linkCtx||{data:d.data,elem:t._elCnt?t.parentElem:b,view:d,ctx:d.ctx,attr:Ea,fn:t._.bnd,tag:t,_bndId:e},s(r,r.fn);else if(a&&b)for(g=f?g:d.data,i=d.tmpl,a=y(a,k(b)),R.lastIndex=0;j=R.exec(a);)u=R.lastIndex,l=j[1],p=j[3],n=j[10],m=c,r={data:g,elem:b,view:d,ctx:h,attr:l,isLk:f,_initVal:!j[2]},j[6]&&(!l&&(m=/:([\w$]*)$/.exec(n))&&(m=m[1],m!==c&&(o=-m.length-1,p=p.slice(0,o-1)+U)),null===m&&(m=c),r.convert=j[5]||""),r.expr=l+p,q=i.links[p],q||(i.links[p]=q=ga.tmplFn(p,i,!0,m)),r.fn=q,l||m===c||(r.convertBack=m),s(r,q),R.lastIndex=u}function s(a,b){function d(c,d){e.call(a,c,d,b)}d.noArray=!0,a.isLk&&(a.view=new ga.View(a.ctx,"link",ba,a.data,ba.tmpl,c,c,m)),a._ctxCb=I(a.view),a._hdlr=d,d(!0)}function t(a,b){var c;return a?(c=a.indexOf(b),c+1?a.slice(0,c)+a.slice(c+b.length):a):""}function u(a){return a&&(""+a===a?a:"SCRIPT"===a.tagName?a.type.slice(3):1===a.nodeType&&a.getAttribute(oa)||"")}function v(a,b,c){function d(a,b,c,d,f,h){g.push({elCnt:e,id:d,ch:f,open:b,close:c,path:h,token:a})}var e,f,g=[];return(f=b?a:u(a))?(g.elCnt=!a.type,e="@"===f.charAt(0)||!a.type,g._tkns=f,f.replace(c||_a,d),g):void 0}function w(a,b){a&&("jsv"===a.type?a.parentNode.removeChild(a):b&&""===a.getAttribute(Z)&&a.removeAttribute(Z))}function x(a,b){for(var c=a;b&&c&&1!==c.nodeType;)c=c.previousSibling;return c&&(1!==c.nodeType?(c=ea.createElement("SCRIPT"),c.type="jsv",a.parentNode.insertBefore(c,a)):u(c)||c.getAttribute(Z)||c.setAttribute(Z,"")),c}function y(a,c){return a=b.trim(a).replace(Ma,"\\$&"),a.slice(-1)!==U?a=T+":"+a+(c?":":"")+U:a}function z(a,d){var e,f,g,h,i,j,k,l,m,n,o=d.view,p=a.linkCtx=a.linkCtx||{tag:a,data:o.data,view:o,ctx:o.ctx};if(a.onAfterLink&&a.onAfterLink(d,p),e=a.targetTag?a.targetTag.linkedElem:a.linkedElem,(f=e&&e[0])&&((g=a._.radio)&&(e=e.children("input[type=radio]")),g||!a._.chging)){if(h=ga.cvt(a,a.convert)[0],g||f!==p.elem){for(k=e.length;k--;){if(f=e[k],l=f._jsvLkEl,a._.inline&&(!l||l!==a&&l.targetTag!==a))for(f._jsvLkEl=a,i=p.elem?p.elem._jsvBnd:a._prv._jsvBnd,f._jsvBnd=i+"+",i=i.slice(1).split("&"),j=i.length;j--;)C(Ta[i[j]],a.convertBack);g&&(f[va]=h===f.value)}p._val=h}h!==c&&(g||f.value===c?f.contentEditable===za&&(f.innerHTML=h):f.type===wa?f[va]=h&&"false"!==h:e.val(h))}(f=f||":"===a.tagName&&p.elem)&&(m=f._jsvTr,n=d.props.trigger,m!==n&&(f._jsvTr=n,e=e||b(f),B(e,m,"off"),B(e,n,"on")))}function A(a){setTimeout(function(){d(a)},0)}function B(a,b,c){b&&a[c](b===!0?"keydown":b,b===!0?A:d)}function C(a,b){var c,d,e,f,g,h=a.linkCtx,i=h.data,j=h.fn.paths;if(a&&j){for(j=(c=j._jsvto)||j[0],d=j&&j.length;d&&""+(f=j[--d])!==f;);!f||h.tag&&!h.tag.tagCtx.args.length?a.to=[[],b]:(f=f.split("^").join("."),a.to="."===f.charAt(0)?[[g=j[d-1],f.slice(1)],b]:[h._ctxCb(e=d?j[0].split("^").join("."):f)||[i,e],b],c&&g&&(a.to[0][0]=h._ctxCb(g,i)))}}function D(a,b,c){var d,e,f=a.tagCtx.view,g=a.tagCtxs||[a.tagCtx],h=g.length,i=!b;if(b=b||a._.bnd.call(f.tmpl,(a.linkCtx||f).data,f,fa),c)g=a.tagCtxs=b,a.tagCtx=g[0];else for(;h--;)d=g[h],e=b[h],ma(d.props).setProperty(e.props),ia(d.ctx,e.ctx),d.args=e.args,i&&(d.tmpl=e.tmpl);return ga._ths(a,g[0]),g}function E(a){for(var b,c,d,e=[],f=a.length,g=f;g--;)e.push(a[g]);for(g=f;g--;)if(c=e[g],c.parentNode){if(d=c._jsvBnd)for(d=d.slice(1).split("&"),c._jsvBnd="",b=d.length;b--;)F(d[b],c._jsvLkEl,c);L(u(c)+(c._df||""))}}function F(a,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=Ta[a];if(d)e===d.linkedElem[0]&&(delete e._jsvLkEl,delete d.linkedElem);else if(q){delete Ta[a];for(f in q.bnd)i=q.bnd[f],j=".obs"+q.cbId,b.isArray(i)?b([i]).off(qa+j).off(pa+j):b(i).off(pa+j),delete q.bnd[f];if(g=q.linkCtx){if(h=g.tag){if(k=h.tagCtxs)for(l=k.length;l--;)(m=k[l].map)&&m.unmap();n=h.linkedElem,o=n&&n[0]||g.elem,(p=o&&o._jsvTr)&&(B(n||b(o),p,"off"),o._jsvTr=c),h.onDispose&&h.onDispose(),h._elCnt||(h._prv&&h._prv.parentNode.removeChild(h._prv),h._nxt&&h._nxt.parentNode.removeChild(h._nxt))}delete g.view._.bnds[a]}delete ga._cbBnds[q.cbId]}}function G(a,e){return a===c?(P&&(b(P).off(ra,d).off("blur","[contenteditable]",d),P=c),a=!0,ba.removeViews(),E(ea.body.getElementsByTagName("*"))):e&&a===!0&&(e=e.jquery?e:b(e)