!function(t){function e(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function i(t,i){var n=t.prototype,s=new Function;s.prototype=i.prototype,t.prototype=new s,t.prototype.constructor=t,e(t.prototype,n)}function n(t,e,i){if(t&&t.length>0)for(var n=0,s=t.length;s>n&&e.call(i||t,t[n],n)!==!1;n++);}function s(t,e){var i;return n(t,function(t){return i=t===e,!i}),i}function r(t,e){var i=Function.prototype.bind,n=Array.prototype.slice;if(i&&t.bind===i)return i.apply(t,n.call(arguments,1));var s=n.call(arguments,2);return function(){return t.apply(e,s.concat(n.call(arguments)))}}function o(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}function a(t,e,i){t.addEventListener?t.removeEventListener(e,i,!1):t.detachEvent("on"+e,i)}function p(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function c(t){return xe[t]?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function h(){return"_san_"+Ne++}function u(t,e){if(e&&(t=r(t,e)),Ce.push(t),!we)if(we=function(){var t=Ce.slice(0);Ce=[],we=null,n(t,function(t){t()})},"function"==typeof MutationObserver){var i=1,s=new MutationObserver(we),o=document.createTextNode(i);s.observe(o,{characterData:!0}),o.data=++i}else"function"==typeof setImmediate?setImmediate(we):setTimeout(we,0)}function l(){this.raw=be?[]:"",this.length=0}function d(){this.raw=[],this.index={}}function f(t){return/^(area|base|br|col|embed|hr|img|input|keygen|param|source|track|wbr)$/i.test(t)}function v(t){this.source=t,this.len=this.source.length,this.index=0}function g(t){t&&t.isText||(this.directives=new d,this.props=new d,this.events=new d,this.childs=[]),e(this,t)}function y(t){function e(t){t&&a.childs.push(new g({isText:!0,text:t,textExpr:C(t),parent:a}))}var i=new g;if("string"!=typeof t)return i;t=t.replace(//gm,"").replace(/(^\s+|\s+$)/g,"");for(var n,s=new v(t),r=/<(\/)?([a-z0-9-]+)\s*/gi,o=/([-:0-9a-z\(\)\[\]]+)(=(['"])([^\3]*?)\3)?\s*/gi,a=i,p=0;null!=(n=s.match(r));){var c=n[1],h=n[2].toLowerCase();if(e(t.slice(p,s.index-n[0].length)),c&&62===s.currentCode()){for(var u=a;u&&u.tagName!==h;)u=u.parent;u&&(a=u.parent),s.go(1)}else if(!c){for(var l=new g({tagName:h,parent:a}),d=f(h);;){var y=s.currentCode();if(62===y){s.go(1);break}if(47===y&&62===s.charCode(s.index+1)){s.go(2),d=1;break}var x=s.match(o);x&&m(l,x[1],x[2]?x[4]:x[1])}a.childs.push(l),d||(a=l)}p=s.index}return e(s.cut(p)),i}function m(t,e,i,n){if("id"===e)return void(t.id=i);var s,r,o=e.indexOf("-");switch(o>0&&(r=e.slice(0,o),s=e.slice(o+1)),r){case"on":t.events.push({name:s,expr:b(i)});break;case"san":var a=N(s,i);a&&t.directives.push(a);break;case"prop":x(t,s,i);break;default:n||x(t,e,i)}}function x(t,e,i){var n=i.match(/^\{=\s*(.*?)\s*=\}$/);return n?void t.props.push({name:e,expr:E(n[1]),x:!0}):void t.props.push(w({name:e,expr:C(i),raw:i}))}function w(t){return"class"===t.name&&n(t.expr.segs,function(t){t.type===Se.INTERP&&t.filters.push({type:Se.CALL,name:"join",args:[{type:Se.STRING,value:" "}]})}),t}function N(t,e){var i=Te[t];if(i){var n=i(e);return n.name=t,n}}function C(t){function e(t){t&&o.push({type:Se.STRING,value:t})}for(var i,n=/\{\{\s*([\s\S]+?)\s*\}\}/gi,s=new v(t),r=0,o=[];null!=(i=s.match(n));)e(s.cut(r,s.index-i[0].length)),o.push(_(i[1])),r=s.index;return e(s.cut(r)),{type:Se.TEXT,segs:o}}function _(t){for(var e=new v(t),i=R(e),n=[];e.goUntil(124);)n.push(Y(e));return{type:Se.INTERP,expr:i,filters:n}}function E(t){return"object"==typeof t&&t.type?t:R(new v(t))}function b(t){return Y(new v(t))}function A(t){var e,i=t.currentCode(),n=t.index;t:for(;e=t.nextCode();)switch(e){case 92:t.go(1);break;case i:t.go(1);break t}var s=t.cut(n,t.index);return{type:Se.STRING,value:new Function("return "+s)()}}function S(t){var e=t.match(/\s*([\$0-9a-z_]+)/gi);return e[1]}function T(t){var e=t.match(/\s*(-?[0-9]+(.[0-9]+)?)/g);return{type:Se.NUMBER,value:e[1]-0}}function k(t){var e={type:Se.ACCESSOR,paths:[{type:Se.STRING,value:S(t)}]};t:for(;;)switch(t.currentCode()){case 46:t.go(1),e.paths.push({type:Se.STRING,value:S(t)});break;case 91:t.go(1),e.paths.push(R(t)),t.goUntil(93);break;default:break t}return e}function R(t){var e=L(t);if(t.goUntil(),63===t.currentCode()){t.go(1);var i=R(t);if(t.goUntil(),58===t.currentCode())return t.go(1),{type:Se.TERTIARY,segs:[e,i,R(t)]}}return e}function L(t){var e=H(t);if(t.goUntil(),124===t.currentCode()){if(124===t.nextCode())return t.go(1),{type:Se.BINARY,operator:248,segs:[e,L(t)]};t.go(-1)}return e}function H(t){var e=I(t);if(t.goUntil(),38===t.currentCode()){if(38===t.nextCode())return t.go(1),{type:Se.BINARY,operator:76,segs:[e,H(t)]};t.go(-1)}return e}function I(t){var e=U(t);t.goUntil();var i=t.currentCode();switch(i){case 61:case 33:if(61===t.nextCode())return i+=61,61===t.nextCode()&&(i+=61,t.go(1)),{type:Se.BINARY,operator:i,segs:[e,I(t)]};t.go(-1)}return e}function U(t){var e=O(t);t.goUntil();var i=t.currentCode();switch(i){case 60:case 62:return 61===t.nextCode()&&(i+=61,t.go(1)),{type:Se.BINARY,operator:i,segs:[e,U(t)]}}return e}function O(t){var e=M(t);t.goUntil();var i=t.currentCode();switch(i){case 43:case 45:return t.go(1),{type:Se.BINARY,operator:i,segs:[e,O(t)]}}return e}function M(t){var e=P(t);t.goUntil();var i=t.currentCode();switch(i){case 42:case 47:return t.go(1),{type:Se.BINARY,operator:i,segs:[e,M(t)]}}return e}function P(t){switch(t.goUntil(),t.currentCode()){case 33:return t.go(1),{type:Se.UNARY,expr:P(t)};case 34:case 39:return A(t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return T(t);case 40:return B(t)}return k(t)}function B(t){t.go(1);var e=R(t);return t.goUntil(41),e}function Y(t){t.goUntil();var e=S(t),i=[];if(t.goUntil(40))for(;!t.goUntil(41);)i.push(R(t)),t.goUntil(44);return{type:Se.CALL,name:e,args:i}}function V(t,e,i){var s;return n(t,function(t){return s=F(t,e,i),!s}),s}function F(t,e,i){switch(t.type){case Se.UNARY:return F(t.expr,e,i);case Se.TEXT:case Se.BINARY:case Se.TERTIARY:return V(t.segs,e,i);case Se.INTERP:if(!F(t.expr,e,i)){var s;return n(t.filters,function(t){return s=V(t.args,e,i),!s}),s}return!0;case Se.ACCESSOR:for(var r=t.paths,o=e.paths,s=!0,a=0,p=r.length,c=o.length;p>a;a++){var h=r[a];switch(h.type){case Se.ACCESSOR:if(F(h,e,i))return!0}s&&c>a&&$(h,i)!=$(o[a],i)&&(s=!1)}return s}return!1}function j(t){this.parent=t,this.listeners=[],this.data={}}function D(t){return Le[t]}function G(t){return null==t?"":String(t).replace(/[&<>"']/g,D)}function $(t,e,i,s){switch(t.type){case Se.UNARY:return!$(t.expr,e,i);case Se.BINARY:var r=ke[t.operator];if("function"==typeof r)return r($(t.segs[0],e,i),$(t.segs[1],e,i));return;case Se.TERTIARY:var o=$(t.segs[0],e,i);return $(o?t.segs[1]:t.segs[2],e,i);case Se.STRING:case Se.NUMBER:return t.value;case Se.ACCESSOR:return e.get(t);case Se.INTERP:var a=$(t.expr,e,i);return i&&n(t.filters,function(t){var s=t.name,r=i.filters[s]||He[s];if("function"==typeof r){var o=[a];n(t.args,function(t){o.push($(t,e,i))}),a=r.apply(i,o)}}),null==a&&(a=""),a;case Se.TEXT:var p=new l;return n(t.segs,function(t){var n=$(t,e,i);s&&t.type===Se.INTERP&&!t.filters[0]&&(n=G(n)),p.push(n)}),p.toString()}}function z(t,e,i){var n=e instanceof ae?e:e.owner;i=i||(e instanceof ae?e.data:e.scope);var s={aNode:t,owner:n,scope:i,parent:e};if(t.isText)return new J(s);if(t.directives.get("if"))return new de(s);if(t.directives.get("else"))return new ve(s);if(t.directives.get("for"))return new ge(s);var r=n.components[t.tagName];return r?new r(s):"slot"===t.tagName?new K(s):new Q(s)}function W(){this.raw={}}function X(t){t=t||{},this.lifeCycle=new W,this.init(t)}function q(t){return''}function J(t){X.call(this,t)}function K(t){this.childs=[],X.call(this,t)}function Q(t){this.childs=[],this.eventListeners={},this._updatedOp=0,this._updateOpCount=0,X.call(this,t)}function Z(t,e){return t.propHandlers[e]||Me}function te(t){Z(this,t.name).output(this,t)}function ee(t,e){var i=[],s=t.expr;n(s.args,function(t){i.push(t.type===Se.ACCESSOR&&1===t.paths.length&&"$event"===t.paths[0].value?this instanceof ae?e:e||window.event:this.evalExpr(t))},this);var r=this.owner;this instanceof ae&&t.isOwn&&(r=this);var o=r[s.name];"function"==typeof o&&o.apply(r,i)}function ie(t,e){t.tagName&&(e.push("<"),e.push(t.tagName),e.push(' id="'),e.push(t.id),e.push('"'),t.props.each(function(t){var i=this instanceof ae?$(t.expr,this.data,this):this.evalExpr(t.expr,1);e.push(Z(this,t.name).input.attr(this,t.name,i)||"")},t),e.push(">"))}function ne(t,e){var i=t.tagName;f(i)||(e.push(""),e.push(i),e.push(">"))}function se(t){if("textarea"===t.tagName){var e=t.props.get("value");return e?G(t.evalExpr(e.expr)):""}var i=new l;return n(t.aNode.childs,function(e){var n=z(e,t);t.childs.push(n),i.push(n.genHTML())}),i.toString()}function re(t,e){return t=t.toLowerCase(),{input:{attr:function(e,i,n){return n&&"false"!==n&&"0"!==n?" "+t+'="'+t+'"':void 0},prop:function(e,i,n){var s=Oe[t]||t;e.el[s]=!(!n||"false"===n||"0"===n)}},choose:function(i){return e(i)?t:void 0}}}function oe(t,e,i){var n=t.option.target;return n&&n.id===e.id&&(!i||n.prop===i)}function ae(t){this.slotChilds=[],this.data=new j,Q.call(this,t)}function pe(t){for(var e,i=new le(t.el);e=i.current;){var n=ce(e,t,i);n&&t.childs.push(n),i.goNext()}}function ce(t,e,i){var n=e instanceof ae?e:e.owner,s=t.tagName.toLowerCase(),r=null;s.indexOf("-")>0&&(r=n.components[s]);var o=t.getAttribute("san-component");o&&(r=n.components[o]);var a={owner:n,scope:n.data,parent:e,el:t,elWalker:i};if(r)return new r(a);var p=he(t),c=t.getAttribute("san-stump");return a.aNode=p,p.directives.get("if")||"if"===c?new de(a):p.directives.get("else")||"else"===c?new ve(a):p.directives.get("for")||"for"===c?new ge(a):ue(t)?new J(a):new Q(a)}function he(t){var e=new g;return e.tagName=t.tagName.toLowerCase(),n(t.attributes,function(t){m(e,t.name,t.value,!0)}),e}function ue(t){return"SCRIPT"===t.tagName&&"text/san"===t.type}function le(t){this.raw=[],this.index=0;for(var e=t.firstChild;e;)1===e.nodeType&&this.raw.push(e),e=e.nextSibling;this.current=this.raw[this.index],this.next=this.raw[this.index+1]}function de(t){Q.call(this,t)}function fe(t){var e=t.aNode,i=new g({childs:e.childs,props:e.props,events:e.events,tagName:e.tagName,directives:(new d).concat(e.directives)});return i.directives.remove("if"),i.directives.remove("else"),z(i,t)}function ve(t){for(var e=t.parent.childs,i=e.length;i--;){var n=e[i];if(n instanceof de){var s={name:"if",value:{type:Se.UNARY,expr:n.aNode.directives.get("if").value}};return t.aNode.directives.push(s),t.el&&(ue(t.el)?t.el.setAttribute("san-stump","if"):t.el.removeAttribute("san-else")),t.ifDirective=s,new de(t)}if(!(n instanceof J))throw new Error("[SAN FATEL] else not match if.")}}function ge(t){Q.call(this,t)}function ye(t,e,i){function s(t){if(t.type===Se.ACCESSOR&&t.paths[0].value===r.item){var e={type:Se.ACCESSOR,paths:r.list.paths.slice(0)};return e.paths.push({type:Se.NUMBER,value:o.get(r.index)}),e.paths=e.paths.concat(t.paths.slice(1)),e}return t}var r=t.aNode.directives.get("for"),o=new j(t.scope);o.set(r.item,e),o.set(r.index,i),n(["set","remove","unshift","shift","push","pop","splice"],function(e){var i=t.scope[e];o[e]=function(e){e=s(E(e)),i.apply(t.scope,[e].concat(Array.prototype.slice.call(arguments,1)))}});var a=t.aNode,p=new g({childs:a.childs,props:a.props,events:a.events,tagName:a.tagName,directives:(new d).concat(a.directives)});p.directives.remove("for");var c=z(p,t,o);return o.onChange(function(t){t.expr.name===r.index&&c.updateView(t)}),c}function me(t){function e(t){ae.call(this,t)}return e.prototype=t,i(e,ae),e}var xe={};n("svg,g,defs,desc,metadata,symbol,use,image,path,rect,circle,line,ellipse,polyline,polygon,text,tspan,tref,textpath,marker,pattern,clippath,mask,filter,cursor,view,animate,font,font-face,glyph,missing-glyph".split(","),function(t){xe[t]=1});var we,Ne=1,Ce=[],_e="undefined"!=typeof navigator&&navigator.userAgent.match(/msie\s*([0-9]+)/i),Ee=_e?_e[1]-0:0,be=Ee&&8>Ee,Ae=Ee&&9>Ee;l.prototype.toString=function(){return be?this.raw.join(""):this.raw},l.prototype.push=be?function(t){this.raw[this.length++]=t}:function(t){this.length++,this.raw+=t},d.prototype.push=function(t){if(!t.name)throw new Error('Miss "name" property');this.index[t.name]||(this.raw.push(t),this.index[t.name]=t)},d.prototype.getAt=function(t){return this.raw[t]},d.prototype.get=function(t){return this.index[t]},d.prototype.each=function(t,e){n(this.raw,r(t,e||this))},d.prototype.remove=function(t){this.index[t]=null;for(var e=this.raw.length;e--;)if(this.raw[e].name===t){this.raw.splice(e,1);break}},d.prototype.concat=function(t){var e=new d;return n(this.raw.concat(t.raw),function(t){e.push(t)}),e};var Se={STRING:1,NUMBER:2,ACCESSOR:3,INTERP:4,CALL:5,TEXT:6,BINARY:7,UNARY:8,TERTIARY:9};v.prototype.currentCode=function(){return this.charCode(this.index)},v.prototype.cut=function(t,e){return this.source.slice(t,e)},v.prototype.go=function(t){this.index+=t},v.prototype.nextCode=function(){return this.go(1),this.currentCode()},v.prototype.charCode=function(t){return this.source.charCodeAt(t)},v.prototype.goUntil=function(t){for(var e;this.indext},62:function(t,e){return t>e},76:function(t,e){return t&&e},94:function(t,e){return t!=e},121:function(t,e){return e>=t},122:function(t,e){return t==e},123:function(t,e){return t>=e},155:function(t,e){return t!==e},183:function(t,e){return t===e},248:function(t,e){return t||e}},Re={SET:1,SPLICE:2};j.prototype.onChange=function(t){"function"==typeof t&&this.listeners.push(t)},j.prototype.unChange=function(t){for(var e=this.listeners.length;e--;)t&&this.listeners[e]!==t||this.listeners.splice(e,1)},j.prototype.fireChange=function(t){n(this.listeners,function(e){e.call(this,t)},this)},j.prototype.get=function(t){if(t=E(t),t.type===Se.ACCESSOR){for(var e=this.data,i=t.paths,n=0,s=i.length;null!=e&&s>n;n++){var r=$(i[n],this);e=e[r]}return null==e&&this.parent?this.parent.get(t):e}},j.prototype.set=function(t,e,i){if(i=i||{},t=E(t),t.type===Se.ACCESSOR){for(var n,s=this.data,r=t.paths,o=0,a=r.length;a-1>o;o++){var p=$(r[o],this);null==s[p]&&(s[p]={}),s=s[p]}n=$(r[o],this),null!=n&&(s[n]=e,!i.silence&&this.fireChange({type:Re.SET,expr:t,value:e,option:i}))}},j.prototype.push=function(t,e,i){var n=this.get(t);n instanceof Array&&this.splice(t,[n.length,0,e],i)},j.prototype.pop=function(t,e){var i=this.get(t);if(i instanceof Array){var n=i.length;if(n)return this.splice(t,[n-1,1],e)[0]}},j.prototype.shift=function(t,e){return this.splice(t,[0,1],e)[0]},j.prototype.unshift=function(t,e,i){this.splice(t,[0,0,e],i)},j.prototype.removeAt=function(t,e,i){this.splice(t,[e,1],i)},j.prototype.remove=function(t,e,i){var n=this.get(t);if(n instanceof Array)for(var s=n.length;s--;)if(n[s]===e){this.splice(t,[s,1],i);break}},j.prototype.splice=function(t,e,i){i=i||{},t=E(t);var n=this.get(t),s=[];if(n instanceof Array){var r=e[0];if(0>r||r>n.length)return;s=n.splice.apply(n,e),!i.silence&&this.fireChange({expr:t,type:Re.SPLICE,index:r,deleteCount:s.length,value:s,insertions:e.slice(2),option:i})}return s};var Le={"&":"&","<":"<",">":">",'"':""","'":"'"},He={html:G,url:encodeURIComponent,raw:function(t){return t},join:function(t,e){return t instanceof Array?t.join(e):t}},Ie={compiled:{value:1},inited:{value:2},created:{value:3},attached:{value:4,mutex:"detached"},detached:{value:5,mutex:"attached"},disposed:{value:6,mutex:"*"}};W.prototype.set=function(t){var e=Ie[t];e&&("*"===e.mutex?this.raw={}:e.mutex&&(this.raw[Ie[e.mutex].value]=0),this.raw[e.value]=1)},W.prototype.is=function(t){var e=Ie[t];return e?!!this.raw[e.value]:!1},X.prototype._callHook=function(t){this.lifeCycle.is(t)||(this.lifeCycle.set(t),"function"==typeof this["_"+t]&&this["_"+t].call(this),"function"==typeof this[t]&&this[t].call(this))},X.prototype.init=function(t){this._init(t),this._callHook("inited")},X.prototype._init=function(t){this.owner=t.owner,this.parent=t.parent,this.parentComponent=this.parent instanceof ae?this.parent:this.parent&&this.parent.parentComponent,this.scope=t.scope,this.aNode=this.aNode||t.aNode,this.el=t.el,this.id=this.el&&this.el.id||this.aNode&&this.aNode.id||h()},X.prototype._created=function(){this.el||(this.el=document.getElementById(this.id))},X.prototype._noticeAttached=function(){n(this.childs,function(t){t._noticeAttached()}),this._callHook("created"),this._callHook("attached")},X.prototype.dispose=function(){this._dispose(),this._callHook("disposed")},X.prototype._dispose=function(){this.el=null,this.owner=null,this.scope=null,this.aNode=null,this.parent=null,this.parentComponent=null},X.prototype.evalExpr=function(t,e){return $(t,this.scope,this.owner,e)},i(J,X),J.prototype._init=function(t){X.prototype._init.call(this,t),this.el&&(this.aNode.isText=!0,this.aNode.textExpr=C(this.el.innerHTML),this.parent._pushChildANode(this.aNode))},J.prototype._inited=function(){this.el&&(this._callHook("created"),this.el.parentNode&&this._callHook("attached"))},J.prototype.genHTML=function(){var t=Ae?"":"";return(this.evalExpr(this.aNode.textExpr,1)||t)+q(this)},J.prototype.update=function(){if(!this.lifeCycle.is("disposed")){var t=this.el.previousSibling;if(t&&3===t.nodeType){var e="string"==typeof t.textContent?"textContent":"data";t[e]=this.evalExpr(this.aNode.textExpr)}else this.el.insertAdjacentHTML("beforebegin",this.evalExpr(this.aNode.textExpr,1));this.wait4Update=0}},J.prototype.updateView=function(t){return!this.wait4Update&&F(this.aNode.textExpr,t.expr,this.scope)?(this.wait4Update=1,u(this.update,this),!0):void 0},i(K,X),K.prototype._init=function(t){var e=t.aNode.props.get("name");this.name=e?e.raw:"____";var i=t.owner,n=i.aNode.givenSlots,s=n&&n[this.name],r=new g;s?(r.childs=s,t.owner=i.owner,t.scope=i.scope):r.childs=t.aNode.childs.slice(0),t.aNode=r,X.prototype._init.call(this,t)},K.prototype._inited=function(){this.owner.slotChilds.push(this)},K.prototype.genHTML=function(){return se(this)},K.prototype.updateView=function(){},K.prototype.slotUpdateView=function(t){if(!this.lifeCycle.is("disposed")){var e;return n(this.childs,function(i){e=i.updateView(t)||e}),e}},K.prototype._dispose=function(){Q.prototype._disposeChilds.call(this),this.childs=null,X.prototype._dispose.call(this)};var Ue={};i(Q,X),Q.prototype._init=function(t){X.prototype._init.call(this,t),this.el&&this._initFromEl(t),Ue[this.id]=this,this.tagName=this.tagName||this.aNode.tagName||"div",Ee&&9>Ee&&/^[a-z0-9]+-[a-z0-9]+$/i.test(this.tagName)&&(this.tagName="div")},Q.prototype._initFromEl=function(){this.aNode=he(this.el),this.parent._pushChildANode(this.aNode),this.tagName=this.aNode.tagName},Q.prototype._inited=function(){this.props=this.binds=this.aNode.props,this._initPropHandlers(),this.el&&(this.tagName=this.el.tagName.toLowerCase(),pe(this),this._callHook("created"),this.el.parentNode&&this._callHook("attached"))},Q.prototype._create=function(){this.el||(this.el=c(this.tagName),this.el.id=this.id,this.props.each(function(t){var e=this instanceof ae?$(t.expr,this.data,this):this.evalExpr(t.expr,1),i=/^\s+([a-z0-9_-]+)="(.*)"$/.exec(Z(this,t.name).input.attr(this,t.name,e));i&&this.el.setAttribute(i[1],i[2])},this))},Q.prototype.create=function(){this.lifeCycle.is("created")||(this._create(),this._callHook("created"))},Q.prototype._created=function(){X.prototype._created.call(this),this._initSelfChanger(),this.bindEvents()},Q.prototype._initSelfChanger=function(){this.binds&&this.binds.each(function(t){if(t.x)switch(t.name){case"value":switch(this.tagName){case"input":case"textarea":this.on("oninput"in this.el?"input":"propertychange",r(te,this,t));break;case"select":this.on("change",r(te,this,t))}break;case"checked":if("input"===this.tagName)switch(this.el.type){case"checkbox":case"radio":this.on("click",r(te,this,t))}}},this)},Q.prototype.attach=function(t,e){this.lifeCycle.is("attached")||(this._attach(t,e),this._noticeAttached())},Q.prototype._attach=function(t,e){this.create(),this.el.innerHTML=se(this),t&&(e?t.insertBefore(this.el,e):t.appendChild(this.el))},Q.prototype.bindEvents=function(){this.aNode.events.each(function(t){this.on(t.name,r(ee,this,t))},this)},Q.prototype.unbindEvents=function(){var t=this.eventListeners;for(var e in t)t.hasOwnProperty(e)&&this.un(e);this.eventListeners=null},Q.prototype.fire=function(t,e){n(this.eventListeners[t],function(t){t.call(this,e)},this)},Q.prototype.on=function(t,e){"function"==typeof e&&(this.eventListeners[t]||(this.eventListeners[t]=[]),this.eventListeners[t].push(e),o(this.el,t,e))},Q.prototype.un=function(t,e){for(var i=this.eventListeners[t],n=i&&i.length;n--;){var s=i[n];e&&e!==s||(i.splice(n,1),a(this.el,t,s))}},Q.prototype.genHTML=function(){var t=new l;return ie(this,t),t.push(se(this)),ne(this,t),t.toString()};var Oe={readonly:"readOnly",cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",usemap:"useMap",frameborder:"frameBorder","for":"htmlFor","class":"className"},Me={input:{attr:function(t,e,i){return null!=i?" "+e+'="'+i+'"':void 0},prop:function(t,e,i){e=Oe[e]||e,t.el[e]=i}},output:function(t,e){t.scope.set(e.expr,t.el[e.name],{target:{id:t.id,prop:e.name}})}},Pe=[re("disabled",function(t){switch(t.tagName){case"input":case"textarea":case"button":case"select":return!0}}),re("readonly",function(t){switch(t.tagName){case"input":case"textarea":return!0}}),{input:{attr:function(t,e,i){var n=t.props.get("value");return n&&s(i,t.evalExpr(n.expr))?' checked="checked"':void 0},prop:function(t,e,i){var n=t.props.get("value");return n&&s(i,t.evalExpr(n.expr))?void(t.el.checked=!0):void(t.el.checked=!1)}},output:function(t,e){var i=t.el;t.scope[i.checked?"push":"remove"](e.expr,i.value)},choose:function(t){if(t.aNode){var e=t.props.get("type");return"input"===t.tagName&&e&&"checkbox"===e.raw&&"checked"}}},{input:{attr:function(t,e,i){var n=t.props.get("value");return n&&i===t.evalExpr(n.expr)?' checked="checked"':void 0},prop:function(t,e,i){var n=t.props.get("value");return n&&i===t.evalExpr(n.expr)?void(t.el.checked=!0):void(t.el.checked=!1)}},output:function(t,e){var i=t.el;t.scope.set(e.expr,i.checked?i.value:"",{target:{id:t.id,prop:e.name}})},choose:function(t){if(t.aNode){var e=t.props.get("type");return"input"===t.tagName&&e&&"radio"===e.raw&&"checked"}}},{input:{attr:function(t,e,i){i&&u(function(){t.lifeCycle.is("created")&&(t.el[e]=i)})},prop:function(t,e,i){t.el[e]=i}},output:Me.output,choose:function(t){return"select"===t.tagName&&"value"}},{input:{attr:function(){},prop:function(t,e,i){t.el[e]=i}},output:Me.output,choose:function(t){return"textarea"===t.tagName&&"value"}},{input:{attr:function(t,e,i){return i?' style="'+i+'"':void 0},prop:function(t,e,i){t.el.style.cssText=i}},choose:function(){return"style"}}];Q.prototype._initPropHandlers=function(){this.propHandlers={},n(Pe,function(t){var e=t.choose(this);e&&(this.propHandlers[e]=t)},this)},Q.prototype.setProp=function(t,e){this.lifeCycle.is("created")&&Z(this,t).input.prop(this,t,e)},Q.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var e;return this.props.each(function(i){!oe(t,this,i.name)&&F(i.expr,t.expr,this.scope)&&(u(function(){this.lifeCycle.is("disposed")||this.setProp(i.name,this.evalExpr(i.expr))},this),e=1)},this),n(this.childs,function(i){e=i.updateView(t)||e}),e&&this._noticeUpdatedSoon(),e}},Q.prototype._noticeUpdatedSoon=function(){this._updateOpCount++,u(this._noticeUpdated,this)},Q.prototype._noticeUpdated=function(){this._updatedOp++,this._updatedOp>=this._updateOpCount&&(this._updateOpCount=0,this._updatedOp=0,this._callHook("updated"))},Q.prototype.detach=function(){this.lifeCycle.is("attached")&&(this._detach(),this._callHook("detached"))},Q.prototype._detach=function(){p(this.el)},Q.prototype._dispose=function(){this._disposeChilds(),this.detach(),this.unbindEvents(),this.el=null,this.childs=null,this.propHandlers=null,this.props=null,this.binds=null,Ue[this.id]=null,X.prototype._dispose.call(this)},Q.prototype._disposeChilds=function(){n(this.childs,function(t){t.dispose()}),this.childs.length=0},Q.prototype._pushChildANode=function(t){this.aNode.childs.push(t)},i(ae,Q),ae.prototype.init=function(t){if(this.filters=t.filters||this.filters||{},this.messages=t.messages||this.messages||{},this._compile(),!t.el){var e=this.constructor.prototype.aNode;if(t.aNode){var i=t.aNode,s={};n(i.childs,function(t){var e="____",i=!t.isText&&t.props.get("slot");i&&(e=i.raw),s[e]||(s[e]=[]),s[e].push(t)},this),this.aNode=new g({tagName:e.tagName||i.tagName,givenSlots:s,childs:e.childs,props:e.props,binds:i.props,events:i.events.concat(e.events),directives:i.directives.concat(e.directives)})}}this._callHook("compiled"),Q.prototype._init.call(this,t),this.binds=this.aNode.binds||new d,this.binds.each(function(t){var e=t.expr;e.type===Se.TEXT&&1===e.segs.length&&(e=e.segs[0],e.type===Se.INTERP&&(t.expr=e.expr))}),this.props=this.aNode.props;var r=t.data||"function"==typeof this.initData&&this.initData();for(var o in r)r.hasOwnProperty(o)&&this.data.set(o,r[o]);this.scope&&this.binds.each(function(t){this.data.set(t.name,this.evalExpr(t.expr))},this),this.computedDeps={};for(var a in this.computed)this.computedDeps[a]||this._calcComputed(a);this._callHook("inited")},ae.prototype._calcComputed=function(t){var e=this.computedDeps[t];e||(e=this.computedDeps[t]={}),this.data.set(t,this.computed[t].call({data:{get:r(function(i){return e[i]||(e[i]=1,this.computed[i]&&this._calcComputed(i),this.watch(i,function(){this._calcComputed(t)})),this.data.get(i)},this)}}))},ae.prototype._inited=function(){this._initPropHandlers(),this._isInitFromEl&&(this._callHook("created"),this._callHook("attached"))},ae.prototype.dispatch=function(t,e){for(var i=this.parentComponent;i;){if("function"==typeof i.messages[t]){i.messages[t].call(i,{target:this,value:e});break}i=i.parentComponent}},ae.prototype.ref=function(t){function e(r){n(r.childs,function(n){if(n instanceof ae){var r=n.aNode.directives.get("ref");r&&$(r.value,n.scope||s.data,s)===t&&(i=n)}else n instanceof Q&&e(n);return!i})}var i,s=this;return e(this),n(this.slotChilds,function(t){return e(t),!i}),i},ae.prototype._initFromEl=function(){this._isInitFromEl=!0,this.aNode=he(this.el),this.aNode.binds=this.aNode.props,this.aNode.props=new d,this.parent&&this.parent._pushChildANode(this.aNode),pe(this)},le.prototype.goNext=function(){this.current=this.raw[++this.index],this.next=this.raw[this.index+1]},ae.prototype._compile=function(){var t=this.constructor.prototype;if(!t._isComponentsReady){t.components=t.components||{};var e=t.components;for(var i in e){var n=e[i];"object"==typeof n?e[i]=me(n):"self"===n&&(e[i]=this.constructor)}t._isComponentsReady=!0}if(!t.aNode&&(t.aNode=new g,t.template)){var s=y(t.template),r=s.childs[0];if(1!==s.childs.length||r.isText)throw new Error("[SAN FATEL] template must have a root element.");t.aNode=r,"template"===r.tagName&&(r.tagName=null),r.events.each(function(t){t.isOwn=!0}),t.template=null}},ae.prototype._initSelfChanger=function(){this.dataChanger||(this.dataChanger=r(this._dataChanger,this),this.data.onChange(this.dataChanger))},ae.prototype._dataChanger=function(t){var e;this.props.each(function(e){F(e.expr,t.expr,this.data)&&u(function(){this.lifeCycle.is("disposed")||this.setProp(e.name,$(e.expr,this.data,this))},this)},this),n(this.childs,function(i){e=i.updateView(t)||e}),n(this.slotChilds,function(i){e=i.slotUpdateView(t)||e}),e&&this._noticeUpdatedSoon(),this.binds.each(function(e){var i=t.expr;if(e.x&&!oe(t,this.owner)&&F(E(e.name),i,this.data)){var n=e.expr;i.paths.length>1&&(n={type:Se.ACCESSOR,paths:e.expr.paths.slice(0).concat(i.paths.slice(1))}),this.scope.set(n,$(i,this.data,this),{target:{id:this.id,prop:e.name}})}},this)},ae.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var e,i=t.expr;return this.binds.each(function(s){var r=s.expr;if(!oe(t,this,s.name)&&F(r,i,this.scope)){var o=0;r.type===Se.ACCESSOR&&i.paths.length>r.paths.length&&n(r.paths,function(t){switch(t.type){case Se.STRING:case Se.NUMBER:o++;break;default:return o=0,!1}});var a,p=s.name;o?(p={type:Se.ACCESSOR,paths:[{type:Se.STRING,value:p}].concat(i.paths.slice(o))},a=this.evalExpr(i)):a=this.evalExpr(r),this.data.set(p,a,{target:{id:this.owner.id}}),e=1}},this),e}},ae.prototype.watch=function(t,e){var i=E(t);this.data.onChange(r(function(t){F(i,t.expr,this.data)&&e.call(this,$(i,this.data,this),t)},this))},ae.prototype._dispose=function(){this.slotChilds=null,this.data.unChange(),this.dataChanger=null,this.data=null,Q.prototype._dispose.call(this)},i(de,Q),de.prototype._initFromEl=function(t){if(t.el){if("if"===t.el.getAttribute("san-stump")){var e=y(t.el.innerHTML);e=e.childs[0],this.aNode=e}else{this.el=null,this._create(),t.el.parentNode.insertBefore(this.el,t.el.nextSibling),t.el.removeAttribute("san-if");var i=ce(t.el,this,t.elWalker);this.childs.push(i),this.aNode.childs=i.aNode.childs.slice(0)}t.ifDirective&&this.aNode.directives.push(t.ifDirective),this.parent._pushChildANode(this.aNode)}},de.prototype._create=function(){this.el||(this.el=document.createElement("script"),this.el.type="text/san",this.el.id=this.id)},de.prototype._inited=function(){this.el&&(this._callHook("created"),this.el.parentNode&&this._callHook("attached"))},de.prototype._created=X.prototype._created,de.prototype.genHTML=function(){var t=new l;if(this.evalExpr(this.aNode.directives.get("if").value)){var e=fe(this);this.childs[0]=e,t.push(e.genHTML())}return Ae&&!t.length&&t.push(""),t.push(q(this)),t.toString()},de.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var e=this.aNode.directives.get("if").value,i=this.childs[0];return F(e,t.expr,this.scope)?(this.evalExpr(e)&&i&&i.updateView(t),u(function(){var t=this.evalExpr(e),i=this.childs[0];t?i||(i=fe(this),i.attach(this.el.parentNode,this.el),this.childs[0]=i):i&&(i.dispose(),this.childs.length=0)},this),!0):i&&i.updateView(t)}},de.prototype._pushChildANode=function(){},i(ge,Q),ge.prototype._pushChildANode=function(){},ge.prototype._created=X.prototype._created,ge.prototype.genHTML=function(t){var e=new l;return n(this.evalExpr(this.aNode.directives.get("for").list),function(t,i){var n=ye(this,t,i);this.childs.push(n),e.push(n.genHTML())},this),t||(Ae&&!e.length&&e.push(""),e.push(q(this))),e.toString()},ge.prototype._initFromEl=function(t){if(t.el){for(;;){var e=t.elWalker.current;if("for"===e.getAttribute("san-stump")){var i=y(e.innerHTML);i=i.childs[0],this.aNode=i;break}e.removeAttribute("san-for");var n=ce(e,this,t.elWalker);this.childs.push(n);var s=t.elWalker.next;if(!s||!s.getAttribute("san-for")&&"for"!==s.getAttribute("san-stump"))break;t.elWalker.goNext()}this.parent._pushChildANode(this.aNode)}},ge.prototype._inited=function(){this.el&&(this._callHook("created"),this.el.parentNode&&this._callHook("attached"))},ge.prototype._attach=function(t,e){this.create(),t&&(e?t.insertBefore(this.el,e):t.appendChild(this.el)),this.el.insertAdjacentHTML("beforebegin",this.genHTML(1))},ge.prototype._detach=function(){this._disposeChilds(),p(this.el)},ge.prototype._create=function(){this.el||(this.el=document.createElement("script"),this.el.type="text/san",this.el.id=this.id)},ge.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){for(var i,s=this.aNode.directives.get("for"),r=t.expr,o=r.paths,a=o.length,p=s.list,c=p.paths,h=c.length,l=0,d=0;a>d&&h>d;d++)if(this.evalExpr(o[d])!==this.evalExpr(c[d])){l=-1;
break}l>=0&&a>h&&(i=+this.evalExpr(o[h]),l=a-h===1?1:2);var f;switch(l){case-1:n(this.childs,function(e){f=e.updateView(t)||f});break;case 0:switch(t.type){case Re.SPLICE:var v=t.index,g=t.deleteCount;u(function(){if(!this.lifeCycle.is("disposed")){for(var e=[v,g],i=0;g>i;i++)this.childs[v+i].dispose();var s=this.childs[v+g]||this;n(t.insertions,function(t,i){var n=ye(this,t,v+i);e.push(n),n.attach(s.el.parentNode,s.el)},this),this.childs.splice.apply(this.childs,e)}},this);var y=t.insertions.length;n(this.childs,function(e,i){f=e.updateView(t)||f,i>=v+g&&j.prototype.set.call(e.scope,s.index,i-g+y)});break;case Re.SET:u(function(){this.lifeCycle.is("disposed")||(this._disposeChilds(),this.el.insertAdjacentHTML("beforebegin",this.genHTML(1)),this._noticeAttached())},this)}f=1;break;case 1:case 2:t.type===Re.SET&&(t=e({},t),t.expr={type:Se.ACCESSOR,paths:[{value:s.item,type:Se.STRING}].concat(o.slice(h+1))},j.prototype.set.call(this.childs[i].scope,t.expr,t.value,{silence:!0}),this.childs[i].updateView(t),f=1)}return f&&this._noticeUpdatedSoon(),f}},Ae&&(de.prototype.attached=J.prototype.attached=ge.prototype.attached=function(){if(this.el){var t=this.el.previousSibling;if(t&&3===t.nodeType){var e="string"==typeof t.textContent?"textContent":"data",i=t[e];i&&""!==i||p(t)}}});var Be={version:"3.0.3-rc.11",Component:ae,defineComponent:me,parseTemplate:y,parseExpr:E,ExprType:Se,LifeCycle:W,nextTick:u,inherits:i};"object"==typeof exports&&"object"==typeof module?exports=module.exports=Be:"function"==typeof define&&define.amd?define("san",[],Be):t.san=Be}(this);