!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=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(){t.apply(e,s.concat(n.call(arguments)))}}function r(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}function o(t,e,i){t.addEventListener?t.removeEventListener(e,i,!1):t.detachEvent("on"+e,i)}function a(){return"_san_"+me++}function h(t,e){if(e&&(t=s(t,e)),xe.push(t),!Ne)if(Ne=function(){var t=xe.slice(0);xe=[],Ne=null;for(var e=0,i=t.length;i>e;e++)t[e]()},"function"==typeof MutationObserver){var i=1,n=new MutationObserver(Ne),r=document.createTextNode(i);n.observe(r,{characterData:!0}),r.data=++i}else"function"==typeof setImmediate?setImmediate(Ne):setTimeout(Ne,0)}function p(){this.raw=Ce?[]:"",this.length=0}function c(){this.raw=[],this.index={}}function u(t){return/^(img|input)$/i.test(t)}function l(t){this.source=t,this.len=this.source.length,this.index=0}function d(t){this.directives=new c,this.binds=new c,this.events=new c,this.childs=[],e(this,t)}function f(t){function e(t){t&&a.childs.push(new d({isText:!0,text:t,parent:a}))}var i=new d;if("string"!=typeof t)return i;t=t.replace(//gm,"").replace(/(^\s+|\s+$)/g,"");for(var n,s=new l(t),r=/<(\/)?([a-z0-9-]+)\s*/gi,o=/([-:0-9a-z\(\)\[\]]+)(=(['"])([^\3]+?)\3)?\s*/gi,a=i,h=0;null!=(n=s.match(r));){var p=n[1],c=n[2].toLowerCase();if(e(t.slice(h,s.currentIndex()-n[0].length)),p&&62===s.currentCode()){for(var f=a;f&&f.tagName!==c;)f=f.parent;f&&(a=f.parent),s.go(1)}else if(!p){for(var y=new d({tagName:c,parent:a}),g=u(c);;){var N=s.currentCode();if(62===N){s.go(1);break}if(47===N&&62===s.charCode(s.currentIndex()+1)){s.go(2),g=!0;break}var m=s.match(o);m&&v(y,m[1],m[2]?m[4]:"")}a.childs.push(y),g||(a=y)}h=s.currentIndex()}return e(s.cut(h)),i}function v(t,e,i,n){if("id"===e)return void(t.id=i);var s,r=e.indexOf("-");switch(r>0&&(s=e.slice(0,r),e=e.slice(r+1)),s){case"on":t.events.push({name:e,expr:C(i)});break;case"san":var o=N(e,i);o&&t.directives.push(o);break;case"prop":y(t,e,i);break;default:n||y(t,e,i)}}function y(t,e,i){var n=i.match(/^\{=\s*(\S[\s\S]*?)\s*=\}$/);if(n)return void t.binds.push({name:e,expr:w(n[1]),twoWay:!0});var s=m(i);1===s.segs.length&&(s=s.segs[0]),t.binds.push(g({name:e,expr:s,raw:i}))}function g(t){switch(t.name){case"class":n(t.expr.segs,function(t){t.type===Ae.INTERPOLATION&&t.filters.push({type:Ae.CALL,name:{type:Ae.IDENT,name:"join"},args:[{type:Ae.STRING,value:" "}]})})}return t}function N(t,e){var i=Ee[t];if(i){var n=i(e);return n.name=t,n}return null}function m(t){for(var e,i=/\{\{\s*([\s\S]+?)\s*\}\}/gi,n=new l(t),s=[],r=0;null!=(e=n.match(i));){var o=n.cut(r,n.currentIndex()-e[0].length);o&&s.push({type:Ae.STRING,value:o}),s.push(x(e[1])),r=n.currentIndex()}var a=n.cut(r);return a&&s.push({type:Ae.STRING,value:a}),{type:Ae.TEXT,segs:s}}function x(t){for(var e=new l(t),i=b(e),n=[];e.goUntil(124);)n.push(U(e));return{type:Ae.INTERPOLATION,expr:i,filters:n}}function w(t){return"object"==typeof t&&t.type?t:b(new l(t))}function C(t){return U(new l(t))}function _(t){var e,i=t.currentCode(),n=t.currentIndex();t:for(;e=t.nextCode();)switch(e){case 92:t.go(1);break;case i:t.go(1);break t}return{type:Ae.STRING,literal:t.cut(n,t.currentIndex())}}function A(t){var e=t.match(/\s*([\$0-9a-z_]+)/gi);return{type:Ae.IDENT,name:e[1]}}function E(t){var e=t.match(/\s*(-?[0-9]+(.[0-9]+)?)/g);return{type:Ae.NUMBER,literal:e[1]}}function T(t){var e={type:Ae.PROP_ACCESSOR,paths:[]},i=A(t);if(!i)return null;e.paths.push(i);t:for(;;){var n=t.currentCode();switch(n){case 46:t.go(1),e.paths.push(A(t));break;case 91:t.go(1);var s=b(t);s.type===Ae.IDENT&&(s={type:Ae.PROP_ACCESSOR,paths:[s]}),e.paths.push(s),t.goUntil(93);break;default:break t}}return 1===e.paths.length?i:e}function b(t){var e=R(t);if(t.goUntil(),124===t.currentCode()){if(124===t.nextCode())return t.go(1),{type:Ae.BINARY,operator:Te[248],segs:[e,b(t)]};t.go(-1)}return e}function R(t){var e=S(t);if(t.goUntil(),38===t.currentCode()){if(38===t.nextCode())return t.go(1),{type:Ae.BINARY,operator:Te[76],segs:[e,R(t)]};t.go(-1)}return e}function S(t){var e=O(t);t.goUntil();var i=t.currentCode();switch(i){case 61:case 33:if(61===t.nextCode())return i+=61,61===t.nextCode()&&(t.go(1),i+=61),{type:Ae.BINARY,operator:Te[i],segs:[e,S(t)]};t.go(-1)}return e}function O(t){var e=I(t);t.goUntil();var i=t.currentCode();switch(i){case 60:case 62:return 61===t.nextCode()&&(i+=61,t.go(1)),{type:Ae.BINARY,operator:Te[i],segs:[e,O(t)]}}return e}function I(t){var e=P(t);t.goUntil();var i=t.currentCode();switch(i){case 43:case 45:return t.go(1),{type:Ae.BINARY,operator:Te[i],segs:[e,I(t)]}}return e}function P(t){var e=k(t);t.goUntil();var i=t.currentCode();switch(i){case 42:case 47:return t.go(1),{type:Ae.BINARY,operator:Te[i],segs:[e,P(t)]}}return e}function k(t){switch(t.goUntil(),t.currentCode()){case 33:return t.go(1),{type:Ae.UNARY,expr:k(t)};case 34:case 39:return _(t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return E(t);case 40:return L(t)}return T(t)}function L(t){t.go(1);var e=b(t);return t.goUntil(41),e}function U(t){t.goUntil();var e=A(t),i=[];if(t.goUntil(40))for(;!t.goUntil(41);)i.push(b(t)),t.goUntil(44);return{type:Ae.CALL,name:e,args:i}}function H(t,e,i){var s=!1;return n(t,function(t){return s=Y(t,e,i),!s}),s}function Y(t,e,i){switch(e.type===Ae.IDENT&&(e={type:Ae.PROP_ACCESSOR,paths:[e]}),t.type){case Ae.UNARY:return Y(t.expr,e,i);case Ae.TEXT:case Ae.BINARY:return H(t.segs,e,i);case Ae.IDENT:return t.name===e.paths[0].name;case Ae.INTERPOLATION:if(!Y(t.expr,e,i)){var s=!1;return n(t.filters,function(t){return s=H(t.args,e,i),!s}),s}return!0;case Ae.PROP_ACCESSOR:for(var r=t.paths,o=e.paths,s=!0,a=0,h=r.length,p=o.length;h>a;a++){var c=r[a];if(c.type===Ae.PROP_ACCESSOR&&Y(c,e,i))return!0;s&&p>a&&B(c,i)!=B(o[a],i)&&(s=!1)}return s}return!1}function D(t){this.parent=t,this.listeners=[],this.data={}}function M(t){return be[t]}function B(t,e){return t.type===Ae.IDENT?t.name:F(t,e)}function F(t,e,i){switch(t.type){case Ae.UNARY:return!F(t.expr,e,i);case Ae.BINARY:return t.operator(F(t.segs[0],e,i),F(t.segs[1],e,i));case Ae.STRING:case Ae.NUMBER:return null==t.value&&(t.value=new Function("return "+t.literal)()),t.value;case Ae.IDENT:case Ae.PROP_ACCESSOR:return e.get(t);case Ae.INTERPOLATION:var s=F(t.expr,e,i);return i&&n(t.filters,function(t){var r=t.name.name,o=i.filters[r]||Re[r];if("function"==typeof o){var a=[s];n(t.args,function(t){a.push(F(t,e,i))}),s=o.apply(i,a)}}),null==s&&(s=""),s;case Ae.TEXT:var r=new p;return n(t.segs,function(t){var n=F(t,e,i);t.type!==Ae.INTERPOLATION||t.filters[0]||(n=Re.html(n)),r.push(n)}),r.toString()}}function V(t,e,i){var n=e instanceof se?e:e.owner;i=i||(e instanceof se?e.data:e.scope);var s={aNode:t,owner:n,scope:i,parent:e};if(t.directives.get("if"))return new ce(s);if(t.directives.get("else"))return new le(s);if(t.directives.get("for"))return new de(s);if(t.isText)return new G(s);var r=n.components&&n.components[t.tagName];if(r){var o=new r(s);return o}return"slot"===t.tagName?new X(s):new q(s)}function j(){this.raw={}}function z(t,e){if(!t.lifeCycle.is(e)){t.lifeCycle.set(e),"function"==typeof t["_"+e]&&t["_"+e].call(t),"function"==typeof t[e]&&t[e].call(t);var i=t.hooks&&t.hooks[e];i&&i.call(t)}}function W(t){t=t||{},this.lifeCycle=new j,this.init(t)}function $(t){return''}function G(t){W.call(this,t)}function X(t){this.childs=[],W.call(this,t)}function q(t){this.childs=[],this.eventListeners={},this._updatedOp=0,this._updateOpCount=0,W.call(this,t)}function J(t){var e=this.propHandlers[t.name]||this.propHandlers["*"];e.output(this,t)}function K(t,e){("input"===e.type||"value"===e.propertyName)&&(e.value=(e.target||e.srcElement).value,Q.call(this,t,e))}function Q(t,e){var i=[],s=t.expr;e=e||window.event,n(s.args,function(t){i.push(t.type===Ae.IDENT&&"$event"===t.name?e:this.evalExpr(t))},this);var r=this.owner;this instanceof se&&t.isOwn&&(r=this);var o=r[s.name.name];"function"==typeof o&&o.apply(r,i)}function Z(t,e){t.tagName&&(e.push("<"),e.push(t.tagName),e.push(' id="'),e.push(t.id),e.push('"'),t.aNode.binds.each(function(t){var i;i=this instanceof se&&t.isOwn?F(t.expr,this.data,this):this.evalExpr(t.expr);var n=this.propHandlers[t.name]||this.propHandlers["*"];e.push(n.input.attr(this,t.name,i))},t),e.push(">"))}function te(t,e){var i=t.tagName;i&&(u(i)||(e.push(""),e.push(i),e.push(">")))}function ee(t){var e=new p;return n(t.aNode.childs,function(i){var n=V(i,t);t.childs.push(n),e.push(n.genHTML())}),e.toString()}function ie(t,e){var i=!1;return n(t,function(t){return i=t===e,!i}),i}function ne(t,e){return t=t.toLowerCase(),{input:{attr:function(e,i,n){return n?" "+t+'="'+t+'"':""},prop:function(e,i,n){var s=Pe[t]||t;e.el[s]=!!n}},choose:function(i){return"function"!=typeof e||e(i)?t:void 0}}}function se(t){this.slotChilds=[],q.call(this,t)}function re(t){for(var e,i=new pe(t.el);e=i.current;){var n=oe(e,t,i);n&&t.childs.push(n),i.goNext()}}function oe(t,e,i){var n=e instanceof se?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 h=ae(t),p=t.getAttribute("san-stump");return a.aNode=h,h.directives.get("if")||"if"===p?new ce(a):h.directives.get("else")||"else"===p?new le(a):h.directives.get("for")||"for"===p?new de(a):he(t)?new G(a):new q(a)}function ae(t){var e=new d;return e.tagName=t.tagName.toLowerCase(),n(t.attributes,function(t){v(e,t.name,t.value,!0)}),e}function he(t){return"SCRIPT"===t.tagName&&"text/san"===t.type}function pe(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 ce(t){q.call(this,t)}function ue(t){var e=t.aNode,i=new d({text:e.text,isText:e.isText,childs:e.childs,binds:e.binds,events:e.events,tagName:e.tagName});return t.aNode.directives.each(function(t){"if"!==t.name&&i.directives.push(t)}),V(i,t)}function le(t){for(var e=t.parent.childs,i=e.length;i--;){var n=e[i];if(!(n instanceof G)){if(n instanceof ce){var s={name:"if",value:{type:Ae.UNARY,expr:n.aNode.directives.get("if").value}};return t.aNode.directives.push(s),t.aNode.directives.remove("else"),t.el&&(he(t.el)?t.el.setAttribute("san-stump","if"):t.el.removeAttribute("san-else")),t.ifDirective=s,new ce(t)}break}}throw new Error("[SAN FATEL] else not match if.")}function de(t){q.call(this,t)}function fe(t,e){var i=t.aNode.directives.get("for");n(t.evalExpr(i.list),e,t)}function ve(t,e,i){function s(t){var e,i=t;switch(t.type){case Ae.IDENT:e=t;break;case Ae.PROP_ACCESSOR:e=t.paths[0]}return e&&e.name===r.item&&(i={type:Ae.PROP_ACCESSOR,paths:r.list.type===Ae.PROP_ACCESSOR?r.list.paths.slice(0):[r.list]},i.paths.push({type:Ae.NUMBER,value:o.get(r.index)}),t.type===Ae.PROP_ACCESSOR&&(i.paths=i.paths.concat(t.paths.slice(1)))),i}var r=t.aNode.directives.get("for"),o=new D(t.scope);o.set(r.item,e),o.set(r.index,i),n(["set","remove","unshift","shift","push","pop"],function(e){var i=t.scope[e];o[e]=function(e){e=s(w(e)),i.apply(t.scope,[e].concat(Array.prototype.slice.call(arguments,1)))}});var a=t.aNode;return V(new d({text:a.text,isText:a.isText,childs:a.childs,binds:a.binds,events:a.events,tagName:a.tagName}),t,o)}function ye(t,e,i){for(var n=t.childs,s=t.aNode.directives.get("for"),r=n.length;r>e;e++){var o=n[e].scope.get(s.index);null!=o&&D.prototype.set.call(n[e].scope,s.index,i(o))}}function ge(t){if(t.el){var e=t.el.previousSibling;if(e&&3===e.nodeType){var i="string"==typeof e.textContent?"textContent":"data",n=e[i];n&&""!==n||e.parentNode.removeChild(e)}}}var Ne,me=1,xe=[],we=function(){var t="undefined"!=typeof navigator&&navigator.userAgent.match(/msie\s*([0-9]+)/i);return t?t[1]-0:0}(),Ce=we&&8>we,_e=we&&9>we;p.prototype.toString=function(){return Ce?this.raw.join(""):this.raw},p.prototype.push=Ce?function(t){this.length++,this.raw.push(t)}:function(t){this.length++,this.raw+=t},c.prototype.push=function(t){if(!t.name)throw new Error('Object must have "name" property');this.index[t.name]||(this.raw.push(t),this.index[t.name]=t)},c.prototype.getAt=function(t){return this.raw[t]},c.prototype.get=function(t){return this.index[t]},c.prototype.each=function(t,e){n(this.raw,s(t,e||this))},c.prototype.removeAt=function(t){var e=this.raw[t].name;this.index[e]=null,this.raw.splice(t,1)},c.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}},c.prototype.concat=function(t){var e=new c;return n(this.raw.concat(t.raw),function(t){e.push(t)}),e};var Ae={STRING:1,NUMBER:2,IDENT:3,PROP_ACCESSOR:4,INTERPOLATION:5,CALL:6,TEXT:7,BINARY:8,UNARY:9};l.prototype.currentCode=function(){return this.charCode(this.index)},l.prototype.currentIndex=function(){return this.index},l.prototype.cut=function(t,e){return this.source.slice(t,e)},l.prototype.go=function(t){this.index+=t},l.prototype.nextCode=function(){return this.go(1),this.currentCode()},l.prototype.charCode=function(t){return this.source.charCodeAt(t)},l.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}};D.ChangeType={SET:1,ARRAY_PUSH:2,ARRAY_POP:3,ARRAY_SHIFT:4,ARRAY_UNSHIFT:5,ARRAY_REMOVE:6},D.prototype.onChange=function(t){"function"==typeof t&&this.listeners.push(t)},D.prototype.unChange=function(t){for(var e=this.listeners.length;e--;)this.listeners[e]===t&&this.listeners.splice(e,1)},D.prototype.fireChange=function(t){for(var e=0;en;n++){var r=i[n],o=B(r,this);e=e[o]}}return null==e&&this.parent?this.parent.get(t):e},D.prototype.set=function(t,e,i){i=i||{},"string"==typeof t&&(t=w(t));var n,s=this.data;switch(t.type){case Ae.IDENT:n=t.name;break;case Ae.PROP_ACCESSOR:for(var r=t.paths,o=0,a=r.length;a-1>o;o++){var h=r[o],p=B(h,this);null==s[p]&&(s[p]={}),s=s[p]}n=B(r[o],this)}null!=n&&(s[n]=e,!i.silence&&this.fireChange({type:D.ChangeType.SET,expr:t,value:e,option:i}))},D.prototype.push=function(t,e,i){i=i||{},"string"==typeof t&&(t=w(t));var n=this.get(t);n instanceof Array&&(n.push(e),!i.silence&&this.fireChange({expr:t,type:D.ChangeType.ARRAY_PUSH,value:e,index:n.length-1,option:i}))},D.prototype.pop=function(t,e){e=e||{},"string"==typeof t&&(t=w(t));var i=this.get(t);if(i instanceof Array){var n=i.pop();!e.silence&&this.fireChange({expr:t,type:D.ChangeType.ARRAY_POP,value:n,index:i.length,option:e})}},D.prototype.shift=function(t,e){e=e||{},"string"==typeof t&&(t=w(t));var i=this.get(t);if(i instanceof Array){var n=i.shift();!e.silence&&this.fireChange({expr:t,type:D.ChangeType.ARRAY_SHIFT,value:n,option:e})}},D.prototype.unshift=function(t,e,i){i=i||{},"string"==typeof t&&(t=w(t));var n=this.get(t);n instanceof Array&&(n.unshift(e),!i.silence&&this.fireChange({expr:t,type:D.ChangeType.ARRAY_UNSHIFT,value:e,option:i}))},D.prototype.removeAt=function(t,e,i){i=i||{},"string"==typeof t&&(t=w(t));var n=this.get(t);if(n instanceof Array){if(0>e||e>=n.length)return;var s=n[e];n.splice(e,1),!i.silence&&this.fireChange({expr:t,type:D.ChangeType.ARRAY_REMOVE,value:s,index:e,option:i})}},D.prototype.remove=function(t,e,i){i=i||{},"string"==typeof t&&(t=w(t));var n=this.get(t);if(n instanceof Array)for(var s=n.length;s--;)if(n[s]===e){this.removeAt(t,s,i);break}};var be={"&":"&","<":"<",">":">",'"':""","'":"'"},Re={html:function(t){return null==t?"":String(t).replace(/[&<>"']/g,M)},url:encodeURIComponent,raw:function(t){return t},yesToBe:function(t,e){return t?e:""},nullToBe:function(t,e){return null==t?e:t},yesOrNoToBe:function(t,e,i){return t?e:i},join:function(t,e){return t instanceof Array?t.join(e):t}},Se={inited:{name:"inited",value:1},compiled:{name:"compiled",value:2},created:{name:"created",value:3},attached:{name:"attached",value:4,mutex:"detached"},detached:{name:"detached",value:5,mutex:"attached"},disposed:{name:"disposed",value:6,mutex:"*"}};j.prototype.set=function(t){var e=Se[t];e&&("object"!=typeof e&&(e={value:e}),e.mutex&&("*"===e.mutex?this.raw={}:this.raw[Se[e.mutex].value]=0),this.raw[e.value]=1)},j.prototype.is=function(t){var e=Se[t];return"object"!=typeof e&&(e={value:e}),!!this.raw[e.value]},W.prototype.init=function(t){this._init(t),z(this,"inited")},W.prototype._init=function(t){this.owner=t.owner,this.parent=t.parent,this.scope=t.scope,this.aNode=t.aNode,this.el=t.el,this.id=this.el&&this.el.id||this.aNode&&this.aNode.id||a()},W.prototype._created=function(){this.el||(this.el=document.getElementById(this.id))},W.prototype._noticeAttached=function(){for(var t=0,e=this.childs?this.childs.length:0;e>t;t++)this.childs[t]._noticeAttached();z(this,"created"),z(this,"attached")},W.prototype.dispose=function(){this._dispose(),z(this,"disposed")},W.prototype._dispose=function(){this.el=null,this.owner=null,this.scope=null,this.aNode=null,this.parent=null},W.prototype.evalExpr=function(t){return F(t,this.scope,this.owner)},i(G,W),G.prototype._init=function(t){W.prototype._init.call(this,t),this.el&&(this.aNode.isText=!0,this.aNode.tagName=null,this.aNode.text=this.el.innerHTML,this.parent._pushChildANode(this.aNode)),this.expr=m(this.aNode.text)},G.prototype._inited=function(){this.el&&(z(this,"created"),this.el.parentNode&&z(this,"attached"))},G.prototype.genHTML=function(){var t=_e?"":"";return(this.evalExpr(this.expr)||t)+$(this)},G.prototype.update=function(){var t=this.el.previousSibling;if(t&&3===t.nodeType){var e="string"==typeof t.textContent?"textContent":"data";t[e]=this.evalExpr(this.expr)}else this.el.insertAdjacentHTML("beforebegin",this.evalExpr(this.expr));this.hasUpdateOpInNextTick=0,z(this,"updated")},G.prototype.updateView=function(t){return!this.hasUpdateOpInNextTick&&Y(this.expr,t.expr,this.scope)?(this.hasUpdateOpInNextTick=1,h(this.update,this),!0):void 0},G.prototype._dispose=function(){this.expr=null,W.prototype._dispose.call(this)},i(X,W),X.prototype._init=function(t){this.literalOwner=t.owner,t.owner=t.owner.owner,t.scope=t.owner&&t.owner.data;var e=t.aNode.binds.get("name");this.name=e?e.raw:"__default__";var i=new d,n=this.literalOwner.aNode.givenSlots,s=n&&n[this.name];i.childs=s||t.aNode.childs,t.aNode=i,W.prototype._init.call(this,t)},X.prototype._inited=function(){this.owner.slotChilds.push(this)},X.prototype.genHTML=function(){return ee(this)},X.prototype.updateView=function(){return!1},X.prototype.slotUpdateView=function(t){return this.lifeCycle.is("disposed")?void 0:(n(this.childs,function(e){needUpdate=e.updateView(t)||needUpdate}),needUpdate)},X.prototype._dispose=function(){this.literalOwner=null,q.prototype._disposeChilds.call(this),this.childs=null,W.prototype._dispose.call(this)};var Oe={};i(q,W),q.prototype._init=function(t){W.prototype._init.call(this,t),this._initFromEl(t),Oe[this.id]=this,this.tagName=this.tagName||this.aNode&&this.aNode.tagName||"div",this._initPropHandlers()},q.prototype._initFromEl=function(){this.el&&(this.aNode=ae(this.el),this.parent._pushChildANode(this.aNode),this.tagName=this.aNode.tagName)},q.prototype._inited=function(){this.el&&(this.tagName=this.el.tagName.toLowerCase(),re(this),z(this,"created"),this.el.parentNode&&z(this,"attached"))},q.prototype._create=function(){this.el||(this.el=document.createElement(this.tagName),this.el.id=this.id,this.aNode.binds.each(function(t){var e;e=this instanceof se&&t.isOwn?F(t.expr,this.data,this):this.evalExpr(t.expr),null!=e&&"object"!=typeof e&&this.el.setAttribute(t.name,e)},this))},q.prototype.create=function(){this.lifeCycle.is("created")||(this._create(),z(this,"created"))},q.prototype._created=function(){W.prototype._created.call(this),this._initBindx(),this.bindEvents()},q.prototype._initBindx=function(){this.aNode.binds.each(function(t){if(t.twoWay){var e=this.el.tagName,i=this.el.type;switch(t.name){case"value":switch(e){case"INPUT":case"TEXTAREA":this.on("oninput"in this.el?"input":"propertychange",s(J,this,t));break;case"SELECT":this.on("change",s(J,this,t))}break;case"checked":"INPUT"!==e||"checkbox"!==i&&"radio"!==i||this.on("click",s(J,this,t))}}},this)},q.prototype.attach=function(t,e){this.lifeCycle.is("attached")||(this._attach(t,e),this.bindEvents(),this._noticeAttached())},q.prototype._attach=function(t,e){this.create(),this.el.innerHTML=ee(this),t&&(e?t.insertBefore(this.el,e):t.appendChild(this.el))};var Ie={input:function(t,e){return{name:"oninput"in t.el?"input":"propertychange",fn:s(K,t,e)}},"*":function(t,e){return{name:e.name,fn:s(Q,t,e)}}};q.prototype.bindEvents=function(){this.aNode.events.each(function(t){var e=Ie[t.name]||Ie["*"],i=e(this,t);this.on(i.name,i.fn)},this)},q.prototype.unbindEvents=function(){var t=this.eventListeners;for(var e in t)t.hasOwnProperty(e)&&(this.un(e),t[e]=null);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),r(this.el,t,e))},q.prototype.un=function(t,e){for(var i=this.eventListeners[t],n=i instanceof Array&&i.length;n--;){var s=i[n];e&&e!==s||(i.splice(n,1),o(this.el,t,s))}},q.prototype.genHTML=function(){var t=new p;return Z(this,t),t.push(ee(this)),te(this,t),t.toString()};var Pe={readonly:"readOnly",cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",usemap:"useMap",frameborder:"frameBorder","for":"htmlFor","class":"className"},ke=[ne("disabled",function(t){switch(t.tagName.toLowerCase()){case"input":case"textarea":case"button":case"select":return!0}}),ne("readonly",function(t){switch(t.tagName.toLowerCase()){case"input":case"textarea":return!0}}),{input:{attr:function(t,e,i){var n=t.aNode.binds.get("value");if(n){var s=t.evalExpr(n.expr);if(ie(i,s))return' checked="checked"'}return""},prop:function(t,e,i){var n=t.aNode.binds.get("value");if(n){var s=t.evalExpr(n.expr);if(ie(i,s))return void(t.el.checked=!0)}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.aNode.binds.get("type");return"input"===t.tagName.toLowerCase()&&e&&"checkbox"===t.evalExpr(e.expr)&&"checked"}}},{input:{attr:function(t,e,i){var n=t.aNode.binds.get("value");if(n){var s=t.evalExpr(n.expr);if(i===s)return' checked="checked"'}return""},prop:function(t,e,i){var n=t.aNode.binds.get("value");if(n){var s=t.evalExpr(n.expr);if(i===s)return void(t.el.checked=!0)}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.aNode.binds.get("type");return"input"===t.tagName.toLowerCase()&&e&&"radio"===t.evalExpr(e.expr)&&"checked"}}},{input:{attr:function(t,e,i){h(function(){t.el[e]=i})},prop:function(t,e,i){t.el[e]=i}},output:function(t,e){t.scope.set(e.expr,t.el[e.name],{target:{id:t.id,prop:e.name}})},choose:function(t){return"select"===t.tagName.toLowerCase()&&"value"}},{input:{attr:function(t,e,i){return i?' style="'+i+'"':""},prop:function(t,e,i){t.el.style.cssText=i}},choose:function(){return"style"}},{input:{attr:function(t,e,i){return null==i?"":" "+e+'="'+i+'"'},prop:function(t,e,i){e=Pe[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}})},choose:function(){return"*"}}];q.prototype._initPropHandlers=function(){this.propHandlers={},n(ke,function(t){var e=t.choose(this);e&&(this.propHandlers[e]=t)},this)},q.prototype.setProp=function(t,e){if(this.el&&this.lifeCycle.is("created")){var i=this.propHandlers[t]||this.propHandlers["*"];i.input.prop(this,t,e)}},q.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var e=t.option.target,i=!1;return this.aNode.binds.each(function(n){e&&e.id===this.id&&e.prop===n.name||Y(n.expr,t.expr,this.scope)&&(h(function(){this.lifeCycle.is("disposed")||this.setProp(n.name,this.evalExpr(n.expr))},this),i=!0)},this),n(this.childs,function(e){i=e.updateView(t)||i}),i&&this._noticeUpdatedSoon(),i}},q.prototype._noticeUpdatedSoon=function(){this._updateOpCount++,h(this._noticeUpdated,this)},q.prototype._noticeUpdated=function(){this._updatedOp++,this._updatedOp>=this._updateOpCount&&(this._updateOpCount=0,this._updatedOp=0,z(this,"updated"))},q.prototype.detach=function(){this.lifeCycle.is("attached")&&(this._detach(),z(this,"detached"))},q.prototype._detach=function(){this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},q.prototype._dispose=function(){this.listeners=null,this._disposeChilds(),this.detach(),this.unbindEvents(),this.valueSynchronizer&&o(this.el,this.valueSynchronizerEvent,this.valueSynchronizer),this.el=null,this.childs=null,delete Oe[this.id],W.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(se,q),se.prototype.init=function(t){q.prototype._init.call(this,t),this.filters=t.filters||this.filters||{},this.owner||(this.owner=this),this.data=new D;var e=t.data;e||"function"!=typeof this.initData||(e=this.initData());for(var i in e)e.hasOwnProperty(i)&&this.data.set(i,e[i]);z(this,"inited"),this._compile(),z(this,"compiled"),this.scope&&this.aNode.binds.each(function(t){this.data.set(t.name,this.evalExpr(t.expr))},this),this.isCompileFromEl&&(z(this,"created"),z(this,"attached"),this._listenDataChange())},se.prototype._initFromEl=se.prototype._inited=function(){},se.prototype.ref=function(t){function e(s){for(var r=0,o=s.childs.length;o>r;r++){if(i)return;var a=s.childs[r];if(a instanceof se){var h=a.aNode.directives.get("ref");if(h&&F(h.value,n.data,n)===t)return void(i=a)}else a instanceof q&&e(a)}}var i=null,n=this;return e(n),i},se.prototype._compileFromEl=function(){this.isCompileFromEl=!0,this.aNode=ae(this.el),this.parent&&this.parent._pushChildANode(this.aNode),re(this)},pe.prototype.goNext=function(){this.current=this.raw[++this.index],this.next=this.raw[this.index+1]},se.prototype._compile=function(){if(!this.lifeCycle.is("compiled")){if(this.el)return void this._compileFromEl();var t=this.constructor.prototype;if(!t.aNode){if(t.template){var e=f(t.template),i=e.childs[0];if(!i||i.isText)throw new Error("[SAN FATEL] template shoule have a root element.");t.aNode=i,"template"===i.tagName&&(i.tagName=null),i.binds.each(function(t){t.isOwn=!0}),i.events.each(function(t){t.isOwn=!0}),t.template=null}t.aNode=t.aNode||new d}var s=t.aNode;this.aNode?this.aNode!==s&&(this.aNode.givenSlots={__default__:[]},n(this.aNode.childs,function(t){var e="__default__",i=t.binds.get("slot");i&&(e=i.raw),this.aNode.givenSlots[e]||(this.aNode.givenSlots[e]=[]),this.aNode.givenSlots[e].push(t)},this),this.aNode.childs=s.childs,this.aNode.binds=this.aNode.binds.concat(s.binds),this.aNode.directives=this.aNode.directives.concat(s.directives),this.aNode.events=this.aNode.events.concat(s.events)):this.aNode=s,this.tagName=s.tagName||this.aNode.tagName||"div",we&&9>we&&/^[a-z0-9]+-[a-z0-9]+$/i.test(this.tagName)&&(this.tagName="div")}},se.prototype._initBindx=function(){this.aNode.binds.each(function(t){t.twoWay&&this.watch(t.name,function(e,i){var n=t.expr;if(i.expr.type===Ae.PROP_ACCESSOR){switch(n={type:Ae.PROP_ACCESSOR,paths:[]},t.expr.type){case Ae.IDENT:n.paths.push(t.expr);break;case Ae.PROP_ACCESSOR:Array.prototype.push.apply(n.paths,t.expr.paths)}Array.prototype.push.apply(n.paths,i.expr.paths.slice(1))}this.scope.set(n,F(i.expr,this.data,this),{target:{id:this.id,prop:t.name}})})},this)},se.prototype.watch=function(t,e){var i=w(t),n=this;this.data.onChange(function(t){Y(i,t.expr,this)&&e.call(n,F(i,this,n),t)})},se.prototype._listenDataChange=function(){this.dataChanger||(this.dataChanger=s(this._dataChanger,this),this.data.onChange(this.dataChanger))},se.prototype._dataChanger=function(t){if(!this.lifeCycle.is("disposed")){var e=!1,i=t.option.target;this.aNode.binds.each(function(t){if(t.isOwn){if(i&&i.id===this.id&&i.prop===t.name)return;h(function(){this.lifeCycle.is("disposed")||this.setProp(t.name,F(t.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()}},se.prototype._unlistenDataChange=function(){this.dataChanger&&(this.data.unChange(this.dataChanger),this.dataChanger=null)},se.prototype.updateView=function(t){var e=t.option.target;if(!(this.lifeCycle.is("disposed")||this===this.owner||e&&e.id===this.id)){var i=!1;return this.aNode.binds.each(function(e){!e.isOwn&&Y(e.expr,t.expr,this.scope)&&(this.data.set(e.name,this.evalExpr(e.expr)),i=!0)},this),i}},se.prototype._attached=function(){this._listenDataChange()},se.prototype._dispose=function(){this.slotChilds=null,this._unlistenDataChange(),q.prototype._dispose.call(this)},i(ce,q),ce.prototype._initFromEl=function(t){if(t.el){if("if"===t.el.getAttribute("san-stump")){var e=f(t.el.innerHTML);e=e.childs[0],e.directives.remove("else"),this.aNode=e,this.tagName=this.aNode.tagName}else{this.el=null,this._create(),t.el.parentNode.insertBefore(this.el,t.el.nextSibling),t.el.removeAttribute("san-if");var i=oe(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)}},ce.prototype._pushChildANode=function(){},ce.prototype._create=function(){this.el||(this.el=document.createElement("script"),this.el.type="text/san",this.el.id=this.id)},ce.prototype._inited=function(){this.el&&(z(this,"created"),this.el.parentNode&&z(this,"attached"))},ce.prototype.genHTML=function(){var t=new p,e=this.aNode.directives.get("if");if(this.evalExpr(e.value)){var i=ue(this);this.childs.push(i),t.push(i.genHTML())}return _e&&!t.length&&t.push(""),t.push($(this)),t.toString()},ce.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var e=this.aNode.directives.get("if").value,i=this.childs[0];if(Y(e,t.expr,this.scope)){var n=!!this.evalExpr(e);return n?i?i.updateView(t):h(function(){i=ue(this),i.attach(this.el.parentNode,this.el),this.childs[0]=i},this):i&&h(function(){i.dispose(),this.childs.length=0},this),!0}return i&&i.updateView(t)}},ce.prototype._noticeAttached=function(){var t=this.aNode.directives.get("if");this.evalExpr(t.value)&&this.childs[0]._noticeAttached(),z(this,"created"),z(this,"attached")
},i(de,q),de.prototype._pushChildANode=function(){},de.prototype.genHTML=function(){var t=new p;return fe(this,function(e,i){var n=ve(this,e,i);this.childs.push(n),t.push(n.genHTML())}),_e&&!t.length&&t.push(""),t.push($(this)),t.toString()},de.prototype._initFromEl=function(t){if(t.el){for(;;){var e=t.elWalker.current;if("for"===e.getAttribute("san-stump")){var i=f(e.innerHTML);i=i.childs[0],this.aNode=i,this.tagName=this.aNode.tagName;break}e.removeAttribute("san-for");var n=oe(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)}},de.prototype._inited=function(){this.el&&(z(this,"created"),this.el.parentNode&&z(this,"attached"))},de.prototype._attach=function(t,e){this.create(),t&&(e?t.insertBefore(this.el,e):t.appendChild(this.el));var i=new p;fe(this,function(t,e){var n=ve(this,t,e);this.childs.push(n),i.push(n.genHTML())}),this.el.insertAdjacentHTML("beforebegin",i.toString())},de.prototype._detach=function(){n(this.childs,function(t){t.dispose()}),this.childs.length=0,this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},de.prototype._create=function(){this.el||(this.el=document.createElement("script"),this.el.type="text/san",this.el.id=this.id)},de.prototype.updateView=function(t){if(!this.lifeCycle.is("disposed")){var i=this.aNode.directives.get("for"),s=t.expr,r=s.paths;s.type===Ae.IDENT&&(r=[s]);var o=r.length,a=i.list,c=a.paths;a.type===Ae.IDENT&&(c=[a]);for(var u,l=c.length,d=0,f=0;o>f&&l>f;f++)if(B(r[f])!==B(c[f])){d=-1;break}d>=0&&o>l&&(u=+B(r[l]),d=o-l===1?1:2);var v=!1;switch(d){case-1:n(this.childs,function(e){v=e.updateView(t)||v});break;case 0:switch(t.type){case D.ChangeType.ARRAY_PUSH:h(function(){if(!this.lifeCycle.is("disposed")){var e=ve(this,t.value,t.index);this.childs.push(e),e.attach(this.el.parentNode,this.el)}},this);break;case D.ChangeType.ARRAY_POP:h(function(){if(!this.lifeCycle.is("disposed")){var t=this.childs.length-1;this.childs[t].dispose(),this.childs.splice(t,1)}},this);break;case D.ChangeType.ARRAY_UNSHIFT:h(function(){if(!this.lifeCycle.is("disposed")){var e=ve(this,t.value,0),i=this.childs[0]||this;this.childs.unshift(e),e.attach(i.el.parentNode,i.el)}},this),ye(this,0,function(t){return t+1});break;case D.ChangeType.ARRAY_SHIFT:h(function(){this.lifeCycle.is("disposed")||(this.childs[0].dispose(),this.childs.splice(0,1))},this),ye(this,1,function(t){return t-1});break;case D.ChangeType.ARRAY_REMOVE:h(function(){this.lifeCycle.is("disposed")||(this.childs[t.index].dispose(),this.childs.splice(t.index,1))},this),ye(this,t.index,function(t){return t-1});break;case D.ChangeType.SET:h(function(){if(!this.lifeCycle.is("disposed")){this._disposeChilds();var t=new p;fe(this,function(e,i){var n=ve(this,e,i);this.childs.push(n),t.push(n.genHTML())}),this.el.insertAdjacentHTML("beforebegin",t.toString()),this._noticeAttached()}},this)}v=!0;break;case 1:case 2:t.type===D.ChangeType.SET&&(t=e({},t),t.expr={type:Ae.PROP_ACCESSOR,paths:[{name:i.item,type:Ae.IDENT}].concat(r.slice(l+1))},D.prototype.set.call(this.childs[u].scope,t.expr,t.value,{silence:!0}),this.childs[u].updateView(t),v=!0)}return v&&this._noticeUpdatedSoon(),v}},_e&&(ce.prototype.attached=G.prototype.attached=de.prototype.attached=function(){ge(this)});var Le={};Le.Component=se,Le.defineComponent=function(t){function e(t){se.call(this,t)}return e.prototype=t,Le.inherits(e,se),e},Le.nextTick=h,Le.version="3.0.0",Le.getEl=function(t){return Oe[t]},Le.inherits=i,"object"==typeof exports&&"object"==typeof module?exports=module.exports=Le:"function"==typeof define&&define.amd?define("san",[],Le):t.san=Le}(this);