/*! xtpl 0.1.0 - MIT | git://github.com/rubaxa/xtpl.git */ "use strict";(function(t){"function"==typeof define&&define.amd?define("xtpl",[],t):"undefined"!=typeof module&&module.exports!==void 0?module.exports=t():window.xtpl=t()})(function(){function t(n,r){var i={exports:{}};r(i,i.exports,e),t[n]=i.exports}function e(e){return t[e]}return t("utils",function(t){var e,n=/[&<>"]/,r=/&/g,i=/>/g,a=/=0&&0 in t)for(;i>r;r++)e.call(n,t[r],r,t);else for(r in t)t.hasOwnProperty(r)&&e.call(n,t[r],r,t)}},map:Array.map||function(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++)r.push(e.call(n,t[i],i,t));return r},filter:Array.filter||function(t,e,n){for(var r=[],i=0,a=t.length;a>i;i++)e.call(n,t[i],i,t)&&r.push(t[i]);return r},inArray:Array.indexOf||function(t,e){for(var n=t.length;n--;)if(t[n]===e)return n;return-1},isEmptyObject:function(t){for(var e in t)return!1;return!0},escapeHTML:function(t){return"string"==typeof t?n.test(t)&&(~t.indexOf("&")&&(t=t.replace(r,"&")),~t.indexOf("<")&&(t=t.replace(a,"<")),~t.indexOf(">")&&(t=t.replace(i,">")),~t.indexOf('"')&&(t=t.replace(o,"""))):void 0===t&&(t=""),t},notEqual:function l(t,e){var n,r=typeof e;if(typeof t!==r&&"object"===r)return!0;if(e instanceof Array){if(n=e.length,t.length!==n)return!0;for(;n--;)if(l(t[n],e[n]))return!0}else{if("object"!==r||null===t||null===e)return t!=e;for(n in e)if(e.hasOwnProperty(n)&&l(t[n],e[n]))return!0;for(n in t)if(t.hasOwnProperty(n)&&l(t[n],e[n]))return!0}return!1},simpleNotEqual:function l(t,e){var n,r=typeof e;if(typeof t!==r&&"object"===r)return!0;if(e instanceof Array){if(n=e.length,t.length!==n)return!0;for(;n--;)if(t[n]!==e[n])return!0}else{if("object"!==r)return t!=e;for(n in e)if(e.hasOwnProperty(n)&&l(t[n],e[n]))return!0;for(n in t)if(t.hasOwnProperty(n)&&l(t[n],e[n]))return!0}return!1},simpleClone:function(t){var e,n=t;if(t instanceof Array)for(e=t.length,n=[];e--;)n[e]=t[e];else if(t instanceof Function)n=t;else if(t instanceof Object){n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e])}return n},print:function(){console.log(e.map(arguments,function(t){return t?(""+JSON.stringify(t)).replace(/^"|"$/g,""):t}))},error:function(t,e,n){console.log(t.message+"\nline: "+(n||t.line||t.lineNumber)+"\nfile: "+(e||t.file||t.filename))},matchAll:function(t,e){for(var n,r=[];n=e.exec(t);)void 0!==n[1]&&r.push(n.slice(1));return r},throttle:function(t,e,n){var r,i,a,o,s=function(){t.apply(n,o)};return function(){a=(new Date).getTime(),o=arguments,void 0===r?(i=a,r=setTimeout(s,e)):a-i>=e&&(clearTimeout(r),r=void 0,s())}},readFile:function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText}},e.isClient&&(e.support.touch=function(){var t=document.createElement("div");return"ontouchstart"in t}(),window.jQuery)){var c=e.support.touch?"toucstart":"click";jQuery.event.special.tap={delegateType:c,bindType:c}}}),t("xmlparser",function(t,e,n){function r(t,e){return new i(t,e)}function i(t,e){this.name=t||"#",this.shorty=void 0!==$[t],this.value="",this.attrs=e||{},this.length=0,this.children=[],this.binding=[]}var a=function(t){return t.charCodeAt(0)},o=/^[\r\n\s\t]+$/,s=a("\n"),l=a("<"),c=a(">"),u=a("="),f=a("a"),d=a("z"),p=a("0"),h=a("9"),x=a("-"),v=a(":"),m=a('"'),_=a("/"),g=(a("\\"),33),y=1,b=2,w=n("utils"),C=w.each,$=w.shortTags,E=function(t,e,n){function i(t){var e,r=n[t.name];void 0!==r&&(e="string"==typeof r?r:r(t,t.attrs),"string"==typeof e&&t.replace(e))}function a(t){var r,i=n["#text"],a=t.value;if(void 0!==i&&(r=i(a,t),r!==a)){var o=e.line;r=E(r,e,n),e.line=o,t.replace(r.children)}}function w(e){var n=t.indexOf("\n",S),r=S-P+1;throw 0>=n&&(n=t.length),{file:F,line:z+":"+r,message:e+"\n"+t.substring(P,n).replace(/\t/g," ")+"\n"+Array(r).join("-")+"^"}}function C(){var e=t.charCodeAt(++S);for(e!==m&&w('"'+j+'" expected value of the attribute in quotes'),L=++S;M>S;){if($=t.charCodeAt(S),e===$)return t.substring(L,S);S++}S-=0|(S-L)/2+1,w('Unclosed string literal in "'+j+'" attribute')}n=n||{},e=e||{};for(var $,k,A,T,O,j,N,S=0,L=0,M=t.length,D=r("#root"),z=e.line||1,F=e.file,P=0,q=0,B=null==e.trim?1:e.trim;M>S;)$=t.charCodeAt(S),g>$&&$===s&&(P=S+1,z++),T===y?$===c||$===_&&t.charCodeAt(++S)===c?(O=t.substring(k,q+1),T=void 0,q=S+1,"#"===D.name?(D.name=O,$===_&&(D.shorty=!0,i(D),D=D.parent)):D.name===O?(i(D),D=D.parent):w('Wrong close "'+O+'" tag should be "'+D.name+'"')):g>$?(L=S,T=b,A=void 0):$>=f&&d>=$||$>=p&&h>=$||$===x||$===v?q=S:w("Invalid character in node name"):T===b?$===_||$===c?(void 0!==A&&D.attr(t.substring(A,S).trim(),!0),S--,T=y):$===u||g>$?void 0!==A&&(j=t.substring(A,S).trim(),D.attr(j,g>$?!0:C()),A=void 0):(f>$||$>d)&&$!==x&&$!==v?w("Invalid character in attrbiute name"):void 0===A&&(A=S):$===l&&(S-q>0&&(N=t.substring(q,S),(0===B||o.test(N)===!1)&&(D.appendText(N),a(D.last))),t.charCodeAt(S+1)===_?S++:(D=D.newChild(),D.file=F,D.line=z),k=S+1,T=y),S++;return T===y?w('"'+t.substring(k,S)+'" tag should be closed'):"#root"!==D.name&&w('"'+D.name+'" tag should be closed'),S-q>0&&(N=t.substring(q,S),(0===B||o.test(N)===!1)&&(D.appendText(N),a(D.last))),D};i.prototype={create:function(t,e){return r(t,e)},attr:function(t,e){return this.attrs[t]=e,this},bind:function(t){t.binded=this.binded=!0,this.binding.push(t)},on:function(t,e,n){void 0===this.events&&(this.events=[]),this.events.push(t.replace(/^.+[:-]+/,""),e,n)},bindDecl:function(t,e){void 0===this.decl&&(this.decl=[]),this.decl.push(t,e)},closest:function(t){var e=this.parent;if(e.name!==t)for(;(e=e.parent)&&e.name!==t;);return e},index:function(){for(var t=this.parent.children,e=t.length;e--;)if(t[e]===this)return e;return-1},append:function(t,e){var n=this.children;return void 0===e?n.push(t):n.splice(e.index(),0,t),this.first=n[0],this.last=n[(this.length=n.length)-1],t.parent=this,this},appendArray:function(t){return C(t,function(t){this.append(t)},this),this},empty:function(){return this.children=[],this.length,delete this.first,delete this.last,this},remove:function(){var t=this.parent,e=t.children,n=this.index();return-1!==n&&e.splice(n,1),t.first=e[0],t.last=e[(t.length=e.length)-1],this},find:function(t){var e=[],n=">"!=t.charAt(0);return t=t.replace(">",""),C(this.children,function r(i){(i.name===t||"*"===t)&&e.push(i),n&&C(i.children,r)}),e},wrap:function(t,e){var n=r(t,e);return n.file=this.file,n.line=this.line,this.parent.append(n,this),n.append(this.remove()),n},innerWrap:function(t,e){var n=r(t,e),i=this.children,a=0,o=i.length;for(this.children=[];o>a;a++)n.append(i[a]);return this.append(n)},replace:function(t){var e=this.parent,n=[].concat(t),r=0,i=n.length;for(this.remove();i>r;r++)t=n[r],"string"==typeof t?e.appendText(t):e.append(t);return this},appendText:function(t){if(""!==t){var e=this.last;void 0===e||"#text"!==e.name?this.newChild("#text").value=t:e.value+=t}return this},newChild:function(t,e){var n=r(t,e);return n.file=this.file,n.line=this.line,this.append(n),n},exception:function(t){throw{message:'Tag "'+this.name+'", '+t,line:this.line,file:this.file}},each:function(t){t(this,this.attrs),C(this.children,function(e){e.each(t)})},clone:function(){var t=r();return C(this,function(e,n){"children"===n?C(e,function(e){t.append(e.clone())}):/first|last/.test(n)||(t[n]=w.simpleClone(e))}),t},toString:function(t,e){e=t&&e||"",t=t?"\n":"";var n=e+this.value;if(C(this.children,function(r){n+=r.toString(t," "+e)}),"#"!=this.name.charAt(0)){var r,i,a=t+e+"<"+this.name,o=[];for(r in this.attrs)i=this.attrs[r],i===!0?o.push(r):o.push(r+'="'+i+'"');o.length&&(a+=" "+o.join(" ")),n=a+(this.shorty&&!this.length?"/>":">"+n+t+e+"")}return n}},E.newNode=r,t.exports=E}),t("xparser",function(t,e,n){(function(){var e=n("xmlparser"),r=e.newNode,i=function(t){return t.charCodeAt(0)},a=function(t){return String.fromCharCode(t)},o=0,s=i("\n"),l=i("{"),c=i("}"),u=i("("),f=(i(")"),i("[")),d=i("]"),p=i("="),h=i("a"),x=(i("z"),i("0")),v=i("9"),m=i("\n"),_=i(">"),g=i("&"),y=i("."),b=i("#"),w=i("|"),C=i(","),$=i(":"),E=i("-"),k=i('"'),A=i("'"),T=i("/"),O=i("\\"),j=32,N=++o,S=++o,L=++o,M=++o,D=++o,z=(++o,++o),F=++o,P=++o,q=++o,B=(++o,n("utils").each),H=/(width|height|left|right|top|bottom|font-size|text-indent)$/,I="a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br canvas caption center cite code col colgroup command datalist dd del details dfn dialog dir div dl dt em embed fieldset figcaption figure font footer form frame frameset h1 to h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link map mark menu meta meter nav noframes noscript object ol optgroup option output p param pre progress q rp rt ruby s samp script section select small source span strike strong style sub summary sup table tbody td textarea tfoot th thead time title tr track tt u ul var video wbr".split(" "),W={"if":function(t){return r("x:if",{test:t})},"else":function(t,e){var n=r("x:else");return n.shorty=!0,/^if\b/.test(t)&&(n.attrs["if"]=t.substr(2).trim()),e.last.append(n)},elseif:function(t,e){return W["else"]("if "+t,e)},"for":function(t,e){return W.each(t,e)},each:function(t){return t=t.match(/^\(?(\w+)(?:\s|,)\s*(\w+)?\)?\s*in\s*([^\|]+)(\|.+)?/i),r("x:each",{data:t[3],as:t[2]||t[1],key:t[2]?t[1]:"$index",filter:/^\|/.test(t[t.length-1])?t.pop().substr(1):void 0})}};B(I,function(t){I[t]=1});var J=function(t,n,i){function o(e,n){var r=t.indexOf("\n",oe),i=oe-de+1;0>=r&&(r=t.length);try{r()}catch(a){console.log(a.stack.split("\n").slice(1).join("\n"))}throw{file:fe,line:ue+":"+i,message:e+"\n"+t.substring(de,r).replace(/\t/g," ")+"\n"+Array(i+(0|n)).join("-")+"^"}}function I(t,e){var n;try{t="string"==typeof t?t.replace(/(\w)->(\w)/g,"$1.xxx.$2"):t,n=Function("ctx,Soul","return "+t)()}catch(r){if(t=t.replace(/(\w)\.xxx\.(\w)/g,"$1->$2"),r instanceof ReferenceError||r instanceof TypeError)return e?{expr:t,str:t}:"{{"+t+"}}";o(r.message+"\n---\n"+t+"\n---")}return e?{value:t,str:t,result:n}:n}function J(t){var r,a=ce.newChild("#text"),o=i["#text"],s=a.value=t;if(void 0!==o&&(r=o(s,a),r!==s)){var l=n.line;r=e(r,n,i),n.line=l,a.replace(r.children)}return a}function Q(){var e,n;for(se=oe;le>oe;){if(Y=t.charCodeAt(oe),Y===k||Y===A||Y===O&&!/["')]/.test(a(Z))){for(oe++,Z=Y;le>oe;){if(Y=t.charCodeAt(oe),Y===O)e=!e;else{if(Y===Z&&!e)break;e=0}oe++}oe>=le&&o("Unterminated string")}else{if(Y===C||Y===c||Y===m)return n=t.substring(se,oe).trim().replace(/[;,]$/,""),se=oe+1,oe--,n;if(Y===l)break}Y>j&&(Z=Y),oe++}oe=se}function R(e){for(se=oe+(0|e);le>oe&&(Y=t.charCodeAt(oe),Y!==s);)oe++;return t.substring(se,oe)}function U(t){var e,n=i[t.name];void 0!==n&&(e="string"==typeof n?n:n(t,t.attrs),"string"==typeof e&&t.replace(e))}function G(t){var e={};return B(t.attrs,function(n,r){var i=n,a=t.name;"string"==typeof n?/^x[:-](if|each)/.test(a)||/^x-/.test(r)||(i=I(i)):n instanceof Object&&(i="",B(n,function(t,n){t=I(t,!0),"class"===r?void 0!==t.expr?(n=n.replace(/^([^'"])/,'"$1').replace(/([^'"])$/,'$1"'),i+=" {{"+t.expr+" ? "+n+' : ""}}'):t.result&&(i+=" "+n.trim().replace(/(^["']|["']$)/g,"")):"style"===r?i+=n+":"+(void 0!==t.expr?"{{"+t.expr+"}}":t.result)+(H.test(n)&&(t.expr?!/(\+\s*["'](%|[a-z]{2,3})['"]|%)$/.test(t.str):/^\d+(\.\d+)?$/.test(t.str))?"px":"")+";":(i=void 0,e[r+"-"+n]=void 0!==t.expr?"{{"+t.expr+"}}":t.result)})),null!=i&&(e[r]=i)}),t.attrs=e,t.parent||o("Too many close"),U(t),"x:decl"==t.parent.name&&(t=t.parent,U(t)),t.parent.single?G(t.parent):t.parent}function V(e){var n=t.substring(se+(0|e),oe);return se=oe,n}function X(e){for(;le>oe;){if(Y=t.charCodeAt(oe),Y===l){var n=W[e](V().trim(),ce);return n.line=ue,n.file=fe,n.parent||ce.append(n),n}oe++}o("Syntax error")}i=i||{},n=n||{};for(var K,Y,Z,te,ee,ne,re,ie,ae,oe=0,se=0,le=t.length,ce=r("#root"),ue=n.line||1,fe=n.file,de=0;le>oe;){if(Y=t.charCodeAt(oe),Y===s&&(ue++,de=oe),void 0===te)Y===g?(se=oe,te=q):Y===w?(J(R(1).trim().replace(/\|$/,"")),ee&&(ee=!1,ce=G(ce),se=oe)):Y===T?R():Y===b?(se=oe,ce=ce.newChild("div"),te=N):Y===y?(ce=ce.newChild("div"),te=D):Y===_||Y===C?se=oe:Y===l||(Y===c?(ce=G(ce),se=oe):Y>j&&(se=oe,te=S)),ce.file=fe,ce.line=ue;else if(te===S){if((Y===u||h>Z)&&(ne=t.substring(se,oe).trim(),W[ne])){se=oe,ce=X(ne),te=void 0;continue}if(Y===y)te=D;else if(Y===f)te=L;else if(Y===b)te=N;else if(Y===w)te=void 0,ee=!0;else{if(Y===$){te=z;continue}Y===_?te=M:Y===l?te=M:Y>j&&h>Y&&Y!==E&&(x>Y||Y>v)&&o("Syntax error")}te!==S&&(ce=ce.newChild(V().trim()),ne=ce.name,oe--,/^[a-z_-][a-z0-9_-]*$/i.test(ne)||o('Invalid node name "'+ne+'"',-ne.length/2))}else te===N?(Y===y||j>=Y||Y===f)&&(te=Y===y?D:Y===f?L:M,ce.attrs.id='"'+V(1).trim()+'"',oe--):te===D?(j>=Y||Y===w||Y===l||Y===f)&&(ce.attrs["class"]='"'+V().trim().split(".").slice(1).join(" ")+'"',oe--,re=void 0,te=Y===f?L:M):te===L?(Y===p||Y===d)&&(void 0===re&&(re=V(1)),Y===d&&(ae=V(1),se=oe+1,ce.attrs[re]="]"===ae?"true":ae,re=void 0,t.charCodeAt(oe+1)!==f&&(te=M))):te===M?Y===w?(J(R(1).trim().replace(/\|$/,"")),se=oe,ce=G(ce),te=void 0):Y===_?(se=oe+1,te=void 0,ce.single=!0):Y===l&&(te=void 0):te===z||te===P?Y===$?(ae=V().trim(),te===z?(re=ae,K=ce.attrs[re],ce.attrs[re]="",void 0!==K&&"class"===re&&(ce.attrs[re]=K+" ")):(ie=ae,ce.attrs[re][ie]=""),te=F):Y===c&&(te=void 0,void 0===re&&(ce=G(ce))):te===F?Y===l?(K=ce.attrs[re],ce.attrs[re]={},""!==K&&"class"===re&&(ce.attrs[re][K]=1),se=oe+1,te=P):Y>j&&(ae=Q(),void 0===ie?ce.attrs[re]="class"===re?(ce.attrs[re]+ae).replace(/"\s"/," "):ae:(te=P,ce.attrs[re][ie]=ae,ie=void 0),Y===c?(te===P&&oe++,re=void 0,ie=void 0,te=void 0):te!==P&&(re=void 0,ie=void 0,te=void 0)):te===q&&(Y===p?(ce=ce.newChild("x:decl",{name:V(1).trim()}),te=void 0):Y===l?(ce=ce.newChild("x:"+V(1).trim()),se=++oe,te=z):Y>j&&j>=Z&&(ce.newChild("x:"+V(1).trim(),{"x:context":R()}),te=void 0));Z=Y,oe++}return"#root"!==ce.name&&(console.log(ce),ce.exception("not closed")),ce};t.exports=J})()}),t("compile",function(t){function e(t,n,r){return e.pre(t,n),e.code(t,r)}e.pre=function n(t,e){var r,i=t.name,a=e[i],o=t.attrs;if(!t.noPre){if(void 0===a||(r=a(t,t.attrs)),r!==!0&&(r=e["**"](t,t.attrs)),r===!0)return n(t.parent,e),void 0;for(i in o)if(a=e["@"+i],void 0!==a&&a.call(e,t,i,o[i])===!0||e["@"].call(e,t,i,o[i])===!0)return delete o[i],n(t.parent,e),void 0}for(var s=t.children.slice(0),l=0,c=s.length;c>l;l++)n(s[l],e)},e.code=function r(t,n){var i,a,o,s,l,c=t.name,u=n[c],f=t.children,d="",p=t.binding,h=t.decl,x=t.events,v=(p.length||h||x)&&e.xpath(t),m="",_="",g="";if(i=void 0===u?n["**"](c,t,t.attrs):""===u?["",""]:u(t,t.attrs),t.xctrl&&(i[0]=e.tryCatch(t,'xtpl.ctrl["_'+t.xctrl+'"](ctx)')+i[0]),a=p.length){var y,b=0;for(o=0;a>o;o++){if(l=p[o],m+=",__xbind"+o,"x:if"==l.name)s=e.getExpr(l,"test"),b=1,l.attrs.test="__xbind"+o;else if("x:else"==l.name)s=e.getExpr(l,"if"),b=1,l.attrs.test="__xbind"+o;else if("x:value"==l.name)s=e.getExpr(l,"data"),l.attrs.data="__xbind"+o;else if("x:var"==l.name){var w=l.key;if(l.expr){var C=e.getExpr(l,w,l.value);s=e.tryCatch(l,"__xval="+C),"context"==w?(_=s+"if( __xval instanceof Object ) for( var key in __xval ){"+" __xval0 = __xval[key];"+" __xargs[key] = __xval0;"+' __xargs["__"+key] = __xclone(__xval0);'+" __xc = 1;"+"}"+_,g='for( var key in __xargs ){ if( !/^__/.test(key) ){ __xval = __xargs[key]; if( __xnotEq(__xval, __xargs["__"+key]) ){'+e.tryCatch(l,C+"[key] = __xval;")+" __xc = 1;"+" }"+" }"+"}"+g):(_+=s+' __xargs["'+w+'"] = __xval;',l.sync!==!1&&(_+=' __xargs["__'+w+'"] = __xclone(__xval);'+" __xc = 1;"),l.sync===!1||/[\*\-\+\\!%\/=><]/.test(C)||(g+='__xval=__xargs["'+w+'"];'+'if( __xnotEq(__xval, __xargs["__'+w+'"]) ){'+e.tryCatch(l,C+" = __xval;")+" __xc = 1;"+"}"))}else _+='__xargs["'+w+'"]='+e.lex(l.value)+";";continue}_+=e.tryCatch(l,"__xargs["+o+"]="+s),l.attrs.safe=!0}"x:attr"==c?(b=3,y=e.lex(t.attrs.name)):"x:decl"===c&&(b=5,y=e.lex(t.declName),m=" ctx,__xsync",_="var __xc;if(apply===void 0){"+_+"}else{"+g+"}return __xc"),i[0]+="__buf.b("+b+", ["+v+"],function (__xargs,apply){"+_+"},function "+(t.fnName||"")+"("+m.substr(1)+"){",i[1]="}"+(y?","+y:"")+");"+i[1],"x:decl"===c&&(i[0]+="var ___$apply=__buf.$apply, __$apply=__buf.$apply=function(force){if( __xsync(ctx,true) || force === true ){ ___$apply(true) }};",i[1]="__buf.$apply=___$apply;"+i[1])}if(x)for(o=0,a=x.length;a>o;o+=3)i[1]+="__buf.b(4,["+v+"],"+e.lex(x[o])+",function(evt){evt.preventDefault();"+"var el = evt.currentTarget;"+x[o+1]+"\n __$apply()"+"},"+e.lex(x[o+2]||0)+");";if(h)for(o=0,a=h.length;a>o;o+=2)s=h[o+1],s instanceof Object&&(s=JSON.stringify(s)),i[1]+="__buf.b(5,["+v+"],function(__xargs){"+e.tryCatch(t,"__xargs["+o+"]="+s)+"\nreturn __xargs},"+e.lex(h[o])+");";for(a=f.length,o=0;a>o;o++)d+=r(f[o],n);return(i[0]+d+i[1]).replace(/"\)\n__buf\.s\("/g,"").replace(/{;_/g,"{_")},e.lex=function(t){return JSON.stringify(t)},e.str=function(t){return"__buf.s("+e.lex(t)+")\n"},e.variable=function(t,n,r){return e.expr(t,"__buf.w($"+n+(r?',"'+r+'"':"")+");")},e.tryCatch=function(t,e,n){return"try{"+e+"}catch(e){"+(n||"")+(t.file?';__xerr(e,"'+t.file+'",'+t.line+")}":"}")},e.expr=function(t,n){var r="",i=0;return n=n.replace(/([\$@&])([\w-]+)/g,function(n,a,o){var s=t.attrs[o];return"$"!=a||t.attrs.safe?"@"==a&&(s=e.lex(s)):(s=e.getExpr(t,o),o="__xval"+i++,r+=e.tryCatch(t,o+"="+s,o+"=void 0"),s=o),void 0===s?"undefined":s}),r+n},e.getExpr=function(t,e,n){var r=(void 0===n?t.attrs[e]:n).replace(/(\w|\))->(\w)/g,"$1.attributes.$2");try{Function('"use strict";\n'+r)}catch(i){try{Function('"use strict";\n('+r+")")}catch(a){t.exception(' attribute "'+e+'": '+i.message+"\n---\n"+r+"\n---")}}return r},e.wrap=function(t,e){if(!t.binded){do{var n=t.parent,r=n.children,i=r.length,a=i,o=/#text|value/,s=0;if(e=e||t.attrs.bind,i>1){for(;a--;)r[a].hidden&&t!==r[a]&&i--;a=i}if("both"==e&&(1!=t.length||o.test(t.first.name)))return t.innerWrap("x"),!0;if(1===i)"both"==n.bindMod&&n.innerWrap("x"),t.sys&&n.sys&&(n=t.wrap("#scope"),n.sys=1,n.hidden=1),t.manualBind||n.manualBind||n.bind(t);else if(o.test(t.name)){for(;a--;)if(!o.test(r[a].name)&&!r[a].hidden)return t.wrap("x"),!0;t.manualBind||n.manualBind||n.bind(t)}else("wrap"==e||"both"==e)&&(t.wrap("x"),s=1)}while(s);t.bindMod=e,delete t.attrs.bind}},e.xpath=function(t,e){var n=t.xpath;if(e=t.attrs.x||e,void 0!==n)return n;if(n=[],e&&console.group(t.name+": "+JSON.stringify(t.attrs)),t.parent)do for(var r=t.parent.children,i=0,a=r.length,o=0;a>i;i++)if(e&&console.log(r[i].hidden,o,""+r[i]),r[i].pseudoRoot)o=0;else if(!r[i].hidden){if(r[i]===t){n.push(o);break}o++}while((t=t.parent)&&t.parent&&!t.sys);return e&&(console.log("xpath:",n),console.groupEnd()),n},t.exports=e}),t("buffer",function(t,e,n){function r(t){var e,n=t.min,i=n,a=t.max;if(void 0!==n)for(;a>=i;i++)e=t[i],void 0!==e&&(e.zmb=1,r(e))}function i(t,e,n,r,i,s){var l=0,u=e.childNodes,f=r.extra,d=document.createElement("div"),p=r.render,h=[];x(i,function(i,c){if(void 0===f||f(i)){var x,v=s[l],m=u[l];i!==v&&(n.remove(l),t.idx=l,t.xpath=r.xpath,t.clear(),p(i,c),x=a(d,""+t),void 0===m?e.appendChild(x):o(m,x,e)),h[l]=i,l++}});for(var v=u.length-1;v>=l;v--)c(u[v],t._decl,!0),n.remove(v),e.removeChild(u[v]);return d=null,h}function a(t,e){return/^