avalon-rails 1.4.7.1 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avalon-rails/version.rb +1 -1
- data/vendor/assets/javascripts/avalon.js +3016 -2365
- data/vendor/assets/javascripts/avalon.min.js +3 -3
- data/vendor/assets/javascripts/avalon.mobile.js +3283 -2629
- data/vendor/assets/javascripts/avalon.mobile.min.js +3 -3
- data/vendor/assets/javascripts/avalon.mobile.old.js +349 -374
- data/vendor/assets/javascripts/avalon.mobile.shim.js +3302 -2643
- data/vendor/assets/javascripts/avalon.mobile.shim.min.js +3 -0
- data/vendor/assets/javascripts/avalon.modern.js +2808 -2155
- data/vendor/assets/javascripts/avalon.modern.min.js +3 -2
- data/vendor/assets/javascripts/avalon.modern.shim.js +2816 -2159
- data/vendor/assets/javascripts/avalon.modern.shim.min.js +2 -0
- data/vendor/assets/javascripts/avalon.shim.js +3002 -2325
- data/vendor/assets/javascripts/avalon.shim.min.js +3 -3
- metadata +4 -2
@@ -1,3 +1,3 @@
|
|
1
|
-
!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("Avalon requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(){avalon.config.debug&&console.log.apply(console,arguments)}function r(){return Object.create(null)}function i(){}function o(e,t){"string"==typeof e&&(e=e.match(Tt)||[]);for(var n={},a=void 0!==t?t:1,r=0,i=e.length;i>r;r++)n[e[r]]=a;return n}function l(){if(e.VBArray){var t=document.documentMode;return t?t:e.XMLHttpRequest?7:6}return 0/0}function s(e){if(e&&"object"==typeof e){var t=e.length,n=Ot.call(e);if(/(Array|List|Collection|Map|Arguments)\]$/.test(n))return!0;if("[object Object]"===n&&t===t>>>0)return!0}return!1}function c(e,t){if(e&&e.childNodes)for(var n,a=e.childNodes,r=0;n=a[r++];)if(n.tagName){var i=yt.createElementNS(Xt,n.tagName.toLowerCase());Nt.forEach.call(n.attributes,function(e){i.setAttribute(e.name,e.value)}),c(n,i),t.appendChild(i)}}function u(e){for(var t in e)if(Mt.call(e,t)){var n=e[t];"function"==typeof u.plugins[t]?u.plugins[t](n):"object"==typeof u[t]?avalon.mix(u[t],n):u[t]=n}return this}function f(e){return(e+"").replace(Jt,"\\$&")}function d(e,t,n){if(Array.isArray(e)){var a=e.concat();e.length=0;var i=$(e);return i.pushArray(a),i}if(!e||e.$id&&e.$events||e.nodeName&&e.nodeType>0)return e;var o=Array.isArray(e.$skipArray)?e.$skipArray:[];o.$special=t||r();var l={};n=n||{};var s=r(),c=r(),u=[];nn.forEach(function(t){delete e[t]});var f=Object.keys(e);f.forEach(function(t,a){var r=e[t];if(n[t]=r,x(t,r,o)){s[t]=[];var i=avalon.type(r);"object"===i&&_t(r.get)&&Object.keys(r).length<=2?(a=m(t,r),u.push(a)):a=Ct.test(i)?g(t,r,i,s[t],n):h(t,r),c[t]=a}}),l=Object.defineProperties(l,rn(c));for(var d=0;d<f.length;d++){var p=f[d];c[p]||(l[p]=e[p])}v(l,"$id",Rt()),v(l,"$model",n),v(l,"$events",s),v(l,"hasOwnProperty",function(e){return e in this.$model});for(d in en)v(l,d,en[d]);return l.$reinitialize=function(){u.forEach(function(e){delete e._value,delete e.oldArgs,e.digest=function(){e.call(l)},sn.begin({callback:function(t,n){var a=n._name;if(n!==e){var r=t.$events[a];e.vm=l,E(r,e.digest)}}});try{e.get.call(l)}finally{sn.end()}})},l.$reinitialize(),l}function v(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})}function p(e){for(var t=Object.keys(e),n=0;n<nn.length;n++){var a=t.indexOf(nn[n]);-1!==a&&t.splice(a,1)}return t}function h(e,t){function n(e){var t=n._value;return arguments.length>0?($t||an(e,t)||(n.updateValue(this,e),n.notify(this,e,t)),this):(sn.collectDependency(this,n),t)}return w(n,e),n._value=t,n}function m(e,t){function n(t){var a=n._value,r="_value"in n;if(arguments.length>0){if($t)return this;if("function"==typeof n.set&&n.oldArgs!==t){n.oldArgs=t;var i=this.$events,o=i[e];i[e]=[],n.set.call(this,t),i[e]=o,t=n.get.call(this),t!==a&&(n.updateValue(this,t),n.notify(this,t,a))}return this}return t=n.get.call(this),n.updateValue(this,t),r&&a!==t&&n.notify(this,t,a),t}return n.set=t.set,n.get=t.get,w(n,e),n}function g(e,t,n,a,r){function i(t){var a=i._value,r=i._vmodel;if(arguments.length>0){if($t)return this;if("array"===n){var o=r,l=t,s=o.length,c=l.length;o.$lock=!0,s>c?o.splice(c,s-c):c>s&&o.push.apply(o,l.slice(s));for(var u=Math.min(s,c),f=0;u>f;f++)o.set(f,l[f]);delete o.$lock,o._fire("set")}else if("object"===n){t=t.$model?t.$model:t;var v=this.$events[e]||[],p=avalon.mix(!0,{},t);for(f in r)r.hasOwnProperty(f)&&Mt.call(p,f)&&(r[f]=p[f]);r=i._vmodel=d(t),r.$events[xt]=v,v.length&&v.forEach(function(e){e.type&&(e.rollback&&e.rollback(),Bt[e.type](e,e.vmodels))})}return i.updateValue(this,r.$model),i.notify(this,this._value,a),this}return sn.collectDependency(this,i),r}w(i,e),r[e]=Array.isArray(t)?t:r[e]||{};var o=i._vmodel=d(t,0,r[e]);return o.$events[xt]=a,i}function y(e,t){e.$model[this._name]=this._value=t}function b(e,t,n){var a=this._name,r=e.$events[a];r&&(k(r),en.$fire.call(e,a,t,n))}function w(e,t){e._name=t,e.updateValue=y,e.notify=b}function x(e,t,n){if(_t(t)||t&&t.nodeName&&t.nodeType>0)return!1;if(-1!==n.indexOf(e))return!1;var a=n.$special;return e&&"$"===e.charAt(0)&&!a[e]?!1:!0}function $(e){var t=[];t.$id=Rt(),t.$model=e,t.$events={},t.$events[xt]=[],t._=d({length:e.length}),t._.$watch("length",function(e,n){t.$fire("length",e,n)});for(var n in en)t[n]=en[n];return avalon.mix(t,ln),t}function T(e,t,n,a,r,i,o){for(var l=this.length,s=2;--s;){switch(e){case"add":var c=this.$model.slice(t,t+n).map(function(e){return Ct.test(avalon.type(e))?e.$id?e:d(e,0,e):e});on.apply(this,[t,0].concat(c)),this._fire("add",t,n);break;case"del":var u=this._splice(t,n);this._fire("del",t,n)}r&&(e=r,t=i,n=o,s=2,r=0)}return this._fire("index",a),this.length!==l&&(this._.length=this.length),u}function C(e,t){for(var n={},a=0,r=t.length;r>a;a++){n[a]=e[a];var i=t[a];i in n?(e[a]=n[i],delete n[i]):e[a]=e[i]}}function E(e,t){t.oneTime||e&&avalon.Array.ensure(e,t)&&t.element&&(M(t,e),new Date-dn>444&&O())}function k(e){if(e&&e.length){new Date-dn>444&&"object"==typeof e[0]&&O();for(var t,n=St.call(arguments,1),a=e.length;t=e[--a];){var r=t.element;if(r&&r.parentNode)try{var i=t.evaluator;if(t.$repeat)t.handler.apply(t,n);else if("$repeat"in t||!i)Bt[t.type](t,t.vmodels);else if("on"!==t.type){var o=i.apply(0,t.args||[]);t.handler(o,r,t)}}catch(l){console.log(l)}}}}function A(e,t){return e.uuid||t||(e.uuid=++un),e.uuid}function M(e,t){var n=e.element;e.uuid||(e.uuid=1!==n.nodeType?e.type+A(n.parentNode)+"-"+ ++un:e.name+"-"+A(n));var a=e.lists||(e.lists=[]);avalon.Array.ensure(a,t),t.$uuid=t.$uuid||Rt(),fn[e.uuid]||(fn[e.uuid]=1,fn.push(e))}function O(e){if(!avalon.optimize){for(var t=fn.length,n=t,a=[],r={},i={};e=fn[--t];){var o=e.type;i[o]?i[o]++:(i[o]=1,a.push(o))}var l=!1;if(a.forEach(function(e){vn[e]!==i[e]&&(r[e]=1,l=!0)}),t=n,l)for(;e=fn[--t];)if(null!==e.element){if(r[e.type]&&S(e.element)){fn.splice(t,1),delete fn[e.uuid];for(var s,c=e.lists,u=0;s=c[u++];)avalon.Array.remove(c,s),avalon.Array.remove(s,e);N(e)}}else fn.splice(t,1);vn=i,dn=new Date}}function N(e){delete fn[e.uuid],e.element=null,e.rollback&&e.rollback();for(var t in e)e[t]=null}function S(e){try{{e.parentNode.nodeType}}catch(t){return!0}return e.ifRemove&&!Lt.contains(e.ifRemove)&&wt===e.parentNode?(e.parentNode&&e.parentNode.removeChild(e),!0):e.msRetain?0:1===e.nodeType?!Lt.contains(e):!avalon.contains(Lt,e)}function j(e){return e.replace(/([a-z\d])([A-Z]+)/g,"$1-$2").toLowerCase()}function L(e){return e.indexOf("-")<0&&e.indexOf("_")<0?e:e.replace(/[-_][^-_]/g,function(e){return e.charAt(1).toUpperCase()})}function H(e){try{if("object"==typeof e)return e;e="true"===e?!0:"false"===e?!1:"null"===e?null:+e+""===e?+e:wn.test(e)?JSON.parse(e):e}catch(t){}return e}function D(e){return e.window&&e.document?e:9===e.nodeType?e.defaultView:!1}function P(e,t){if(e.offsetWidth<=0){var n=getComputedStyle(e,null);if(En.test(n.display)){var a={node:e};for(var r in Cn)a[r]=n[r],e.style[r]=Cn[r];t.push(a)}var i=e.parentNode;i&&1===i.nodeType&&P(i,t)}}function R(e){var t=e.tagName.toLowerCase();return"input"===t&&/checkbox|radio/.test(e.type)?"checked":t}function I(e,t,n,a){for(var r,i=[],o=" = "+n+".",l=e.length;r=e[--l];)t.hasOwnProperty(r)&&(i.push(r+o+r),a.vars.push(r),"duplex"===a.type&&(e.get=n+"."+r),e.splice(l,1));return i}function _(e){for(var t=[],n={},a=0;a<e.length;a++){var r=e[a],i=r&&"string"==typeof r.$id?r.$id:r;n[i]||(n[i]=t.push(r))}return t}function B(e,t){return t=t.replace(_n,"").replace(Bn,function(){return"],|"}).replace(Fn,function(e,t){return"["+An(t)}).replace(Vn,function(){return'"],["'}).replace(Xn,function(){return'",'})+"]","return this.filters.$filter("+e+", "+t+")"}function F(e,t,a){var r=a.type,o=a.filters||"",l=t.map(function(e){return String(e.$id).replace(In,"$1")})+e+r+o,s=Dn(e).concat(),c=[],u=[],f=[],d="";t=_(t),a.vars=[];for(var v=0,p=t.length;p>v;v++)if(s.length){var h="vm"+gt+"_"+v;u.push(h),f.push(t[v]),c.push.apply(c,I(s,t[v],h,a))}if(c.length||"duplex"!==r){"duplex"!==r&&(e.indexOf("||")>-1||e.indexOf("&&")>-1)&&a.vars.forEach(function(t){var n=new RegExp("\\b"+t+"(?:\\.\\w+|\\[\\w+\\])+","ig");e=e.replace(n,function(n,a){var r=n.charAt(t.length),i=e.slice(a+n.length),o=/^\s*\(/.test(i);if("."===r||"["===r||o){var l="var"+String(Math.random()).replace(/^0\./,"");if(o){var s=n.split(".");if(s.length>2){var u=s.pop();return c.push(l+" = "+s.join(".")),l+"."+u}return n}return c.push(l+" = "+n),l}return n})}),a.args=f,delete a.vars;var m=Pn.get(l);if(m)return void(a.evaluator=m);if(d=c.join(", "),d&&(d="var "+d),/\S/.test(o)){if(!/text|html/.test(a.type))throw Error("ms-"+a.type+"不支持过滤器");e="\nvar ret"+gt+" = "+e+";\r\n",e+=B("ret"+gt,o);try{m=Function.apply(i,u.concat("'use strict';\n"+d+e)),a.evaluator=Pn.put(l,function(){return m.apply(avalon,arguments)})}catch(g){n("debug: parse error,"+g.message)}return void(s=c=u=null)}if("duplex"===r){var y="'use strict';\nreturn function(vvv){\n "+d+";\n if(!arguments.length){\n return "+e+"\n }\n "+(Rn.test(e)?e:s.get)+"= vvv;\n} ";try{m=Function.apply(i,u.concat(y)),a.evaluator=Pn.put(l,m)}catch(g){n("debug: parse error,"+g.message)}return void(s=c=u=null)}if("on"===r){-1===e.indexOf("(")?e+=".call(this, $event)":e=e.replace("(",".call(this,"),u.push("$event"),e="\nreturn "+e+";";var b=e.lastIndexOf("\nreturn"),w=e.slice(0,b),x=e.slice(b);e=w+"\n"+x}else e="\nreturn "+e+";";try{m=Function.apply(i,u.concat("'use strict';\n"+d+e)),a.evaluator=Pn.put(l,m)}catch(g){n("debug: parse error,"+g.message)}s=c=u=null}}function V(e){var t=Wt.test(e);if(t){var n=K(e);return 1===n.length?n[0].value:n.map(function(e){return e.expr?"("+e.value+")":An(e.value)}).join(" + ")}return e}function X(e,t,n,a){e=e||"",F(e,t,n),n.evaluator&&!a&&(n.handler=Ft[n.handlerName||n.type],avalon.injectBinding(n))}function U(e,t,n){var a=setTimeout(function(){var r=e.innerHTML;clearTimeout(a),r===n?t():U(e,t,r)})}function Y(e,t){var n=e.getAttribute("avalonctrl")||t.$id;e.setAttribute("avalonctrl",n),t.$events.expr=e.tagName+'[avalonctrl="'+n+'"]'}function q(e,t){for(var n,a=0;n=e[a++];)n.vmodels=t,Bt[n.type](n,t),n.evaluator&&n.element&&1===n.element.nodeType&&n.element.removeAttribute(n.name);e.length=0}function z(e,t){return e.priority-t.priority}function W(e,t,a){var i=!0;if(t.length){for(var o,l=e.attributes,s=[],c=[],u={},f=r(),d=0;o=l[d++];)if(o.specified&&(a=o.name.match(Wn))){var v=a[1],p=a[2]||"",h=o.value,m=o.name;if(u[m])continue;if(u[m]=1,Zn[v]?(p=v,v="on"):Jn[v]&&("enabled"===v&&(n("warning!ms-enabled或ms-attr-enabled已经被废弃"),v="disabled",h="!("+h+")"),p=v,v="attr",m="ms-"+v+"-"+p,c.push([o.name,m,h])),f[m]=h,"function"==typeof Bt[v]){var g=h.replace(zn,""),y=h!==g,b={type:v,param:p,element:e,name:m,value:g,oneTime:y,priority:(Gn[v]||10*v.charCodeAt(0))+(Number(p.replace(/\D/g,""))||0)};if("html"===v||"text"===v){var w=Q(h);avalon.mix(b,w),b.filters=b.filters.replace(ea,function(){return b.type="html",b.group=1,""})}else if("duplex"===v)var x=m;else"ms-if-loop"===m&&(b.priority+=100);s.push(b),"widget"===v&&(e.msData=e.msData||f)}}if(s.length){s.sort(z),c.forEach(function(t){n("warning!请改用"+t[1]+"代替"+t[0]+"!"),e.removeAttribute(t[0]),e.setAttribute(t[1],t[2])});var $=e.type;for($&&x&&f["ms-attr-value"]&&"text"===e.type&&n("warning!"+$+"控件不能同时定义ms-attr-value与"+x),d=0;b=s[d];d++){if(v=b.type,Qn.test(v))return q(s.slice(0,d+1),t);i&&(i=!Kn.test(v))}q(s,t)}}i&&!Un[e.tagName]&&Zt.test(e.innerHTML+e.textContent)&&(qn&&qn(e),G(e,t))}function G(e,t){var n=avalon.slice(e.childNodes);Z(n,t)}function Z(e,t){for(var n,a=0;n=e[a++];)switch(n.nodeType){case 1:J(n,t),n.msCallback&&(n.msCallback(),n.msCallback=void 0);break;case 3:Wt.test(n.nodeValue)&&et(n,t,a)}}function J(e,t,n){var a=e.getAttribute("ms-skip"),r=e.getAttributeNode("ms-important"),i=e.getAttributeNode("ms-controller");if("string"!=typeof a){if(n=r||i){var o=avalon.vmodels[n.value];if(!o)return;t=n===r?[o]:[o].concat(t),e.removeAttribute(n.name),e.classList.remove(n.name),Y(e,o)}W(e,t)}}function Q(e){if(e.indexOf("|")>0){var t=e.replace(na,function(e){return Array(e.length+1).join("1")}),n=t.replace(ta,"ᄢ㍄").indexOf("|");if(n>-1)return{filters:e.slice(n),value:e.slice(0,n),expr:!0}}return{value:e,filters:"",expr:!0}}function K(e){for(var t,n,a=[],r=0;;){if(n=e.indexOf(qt,r),-1===n)break;if(t=e.slice(r,n),t&&a.push({value:t,filters:"",expr:!1}),r=n+qt.length,n=e.indexOf(zt,r),-1===n)break;t=e.slice(r,n),t&&a.push(Q(t)),r=n+zt.length}return t=e.slice(r),t&&a.push({value:t,expr:!1,filters:""}),a}function et(e,t){var n=[],a=K(e.data);if(a.length){for(var r,i=0;r=a[i++];){var o=yt.createTextNode(r.value);r.expr&&(r.value=r.value.replace(zn,function(){return r.oneTime=!0,""}),r.type="text",r.element=o,r.filters=r.filters.replace(ea,function(){return r.type="html",""}),n.push(r)),Ht.appendChild(o)}e.parentNode.replaceChild(Ht,e),n.length&&q(n,t)}}function tt(e,t,n){var a=e.templateCache&&e.templateCache[t];if(a){for(var r,i=yt.createDocumentFragment();r=a.firstChild;)i.appendChild(r);return i}return avalon.parseHTML(n)}function nt(e){return null==e?"":e}function at(e,t,n){return t.param.replace(/\w+/g,function(a){var r=avalon.duplexHooks[a];r&&"function"==typeof r[n]&&(e=r[n](e,t))}),e}function rt(){for(var e=va.length-1;e>=0;e--){var t=va[e];t()===!1&&va.splice(e,1)}va.length||clearInterval(da)}function it(e,t,n,a){var r=e.template.cloneNode(!0),i=avalon.slice(r.childNodes);r.insertBefore(yt.createComment(e.signature),r.firstChild),t.appendChild(r);var o=[n].concat(e.vmodels),l={nodes:i,vmodels:o};a.push(l)}function ot(e){for(var t,n=[],a=e.element.parentNode.childNodes,r=0;t=a[r++];)if(t.nodeValue===e.signature)n.push(t);else if(t.nodeValue===e.signature+":end")break;return n}function lt(e,t,n){for(;;){var a=t.previousSibling;if(!a)break;if(a.parentNode.removeChild(a),n&&n.call(a),a===e)break}}function st(){var e=d({$key:"",$outer:{},$host:{},$val:{get:function(){return this.$host[this.$key]},set:function(e){this.$host[this.$key]=e}}},{$val:1});return e.$id=Rt("$proxy$with"),e}function ct(e,t,n){e=e||ga.pop(),e?e.$reinitialize():e=st();var a=n.$repeat;return e.$key=t,e.$host=a,e.$outer=n.$outer,a.$events?e.$events.$val=a.$events[t]:e.$events={},e}function ut(e){ft(e)}function ft(e){e.forEach(function(e){pt(e,ya)}),e.length=0}function dt(e){var t={$host:[],$outer:{},$index:0,$first:!1,$last:!1,$remove:avalon.noop};t[e]={get:function(){var t=this.$events,n=t.$index;t.$index=t[e];try{return this.$host[this.$index]}finally{t.$index=n}},set:function(e){try{var t=this.$events,n=t.$index;t.$index=[],this.$host.set(this.$index,e)}finally{t.$index=n}}};var n={$last:1,$first:1,$index:1},a=d(t,n);return a.$id=Rt("$proxy$each"),a}function vt(e,t){for(var n,a=t.param||"el",r=0,i=ya.length;i>r;r++){var o=ya[r];o&&o.hasOwnProperty(a)&&(n=o,ya.splice(r,1))}n||(n=dt(a));var l=t.$repeat,s=l.length-1;return n.$index=e,n.$first=0===e,n.$last=e===s,n.$host=l,n.$outer=t.$outer,n.$remove=function(){return l.removeAt(n.$index)},n}function pt(e,t){for(var n in e.$events){var a=e.$events[n];Array.isArray(a)&&(a.forEach(function(e){"object"==typeof e&&N(e)}),a.length=0)}e.$host=e.$outer={},t.unshift(e)>u.maxRepeatSize&&t.pop()}function ht(e,t){var n="_"+e;if(!ht[n]){var a=yt.createElement(e);Lt.appendChild(a),t=jt?getComputedStyle(a,null).display:a.currentStyle.display,Lt.removeChild(a),ht[n]=t}return ht[n]}function mt(e,t,n,a){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var r=isFinite(+e)?+e:0,i=isFinite(+t)?Math.abs(t):3,o=a||",",l=n||".",s="",c=function(e,t){var n=Math.pow(10,t);return""+(Math.round(e*n)/n).toFixed(t)};return s=(i?c(r,i):""+Math.round(r)).split("."),s[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)),(s[1]||"").length<i&&(s[1]=s[1]||"",s[1]+=new Array(i-s[1].length+1).join("0")),s.join(l)}var gt=Date.now(),yt=e.document,bt=yt.head;bt.insertAdjacentHTML("afterBegin",'<avalon ms-skip class="avalonHide"><style id="avalonStyle">.avalonHide{ display: none!important }</style></avalon>');var wt=bt.firstChild,xt="$"+gt,$t=!1,Tt=/[^, ]+/g,Ct=/^(?:object|array)$/,Et=/^\[object SVG\w*Element\]$/,kt=/^\[object (?:Window|DOMWindow|global)\]$/,At=Object.prototype,Mt=At.hasOwnProperty,Ot=At.toString,Nt=Array.prototype,St=Nt.slice,jt=e.dispatchEvent,Lt=yt.documentElement,Ht=yt.createDocumentFragment(),Dt=yt.createElement("div"),Pt={};"Boolean Number String Function Array Date RegExp Object Error".replace(Tt,function(e){Pt["[object "+e+"]"]=e.toLowerCase()});var Rt=function(e){return e=e||"avalon",String(Math.random()+Math.random()).replace(/\d\.\d{4}/,e)},It=l();avalon=function(e){return new avalon.init(e)},avalon.profile=function(){e.console&&avalon.config.profile&&Function.apply.call(console.log,console,arguments)},avalon.nextTick=new function(){function t(){for(var e=r.length,t=0;e>t;t++)r[t]();r=r.slice(e)}var n=e.setImmediate,a=e.MutationObserver;if(n)return n.bind(e);var r=[];if(a){var i=document.createTextNode("avalon");return new a(t).observe(i,{characterData:!0}),function(e){r.push(e),i.data=Math.random()}}return e.VBArray?function(e){r.push(e);var n=yt.createElement("script");n.onreadystatechange=function(){t(),n.onreadystatechange=null,bt.removeChild(n),n=null},bt.appendChild(n)}:function(e){setTimeout(e,4)}},avalon.init=function(e){this[0]=this.element=e},avalon.fn=avalon.prototype=avalon.init.prototype,avalon.type=function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?Pt[Ot.call(e)]||"object":typeof e};var _t=function(e){return"[object Function]"===Ot.call(e)};avalon.isFunction=_t,avalon.isWindow=function(e){return kt.test(Ot.call(e))},avalon.isPlainObject=function(e){return"[object Object]"===Ot.call(e)&&Object.getPrototypeOf(e)===At},avalon.mix=avalon.fn.mix=function(){var e,t,n,a,r,i,o=arguments[0]||{},l=1,s=arguments.length,c=!1;for("boolean"==typeof o&&(c=o,o=arguments[1]||{},l++),"object"==typeof o||_t(o)||(o={}),l===s&&(o=this,l--);s>l;l++)if(null!=(e=arguments[l]))for(t in e)n=o[t],a=e[t],o!==a&&(c&&a&&(avalon.isPlainObject(a)||(r=Array.isArray(a)))?(r?(r=!1,i=n&&Array.isArray(n)?n:[]):i=n&&avalon.isPlainObject(n)?n:{},o[t]=avalon.mix(c,i,a)):void 0!==a&&(o[t]=a));return o},avalon.mix({rword:Tt,subscribers:xt,version:1.471,ui:{},log:n,slice:function(e,t,n){return St.call(e,t,n)},noop:i,error:function(e,t){throw new(t||Error)(e)},oneObject:o,range:function(e,t,n){n||(n=1),null==t&&(t=e||0,e=0);for(var a=-1,r=Math.max(0,Math.ceil((t-e)/n)),i=new Array(r);++a<r;)i[a]=e,e+=n;return i},eventHooks:{},bind:function(e,t,n,a){var r=avalon.eventHooks,i=r[t];return"object"==typeof i&&(t=i.type||t,a=i.phase||!!a,n=i.fn?i.fn(e,n):n),e.addEventListener(t,n,a),n},unbind:function(e,t,n,a){var r=avalon.eventHooks,o=r[t],l=n||i;"object"==typeof o&&(t=o.type||t,a=o.phase||!!a),e.removeEventListener(t,l,a)},css:function(e,t,n){e instanceof avalon&&(e=e[0]);var a,r=/[_-]/.test(t)?L(t):t;if(t=avalon.cssName(r)||r,void 0===n||"boolean"==typeof n){a=xn[r+":get"]||xn["@:get"],"background"===t&&(t="backgroundColor");var i=a(e,t);return n===!0?parseFloat(i)||0:i}if(""===n)e.style[t]="";else{if(null==n||n!==n)return;isFinite(n)&&!avalon.cssNumber[r]&&(n+="px"),a=xn[r+":set"]||xn["@:set"],a(e,t,n)}},each:function(e,t){if(e){var n=0;if(s(e))for(var a=e.length;a>n&&t(n,e[n])!==!1;n++);else for(n in e)if(e.hasOwnProperty(n)&&t(n,e[n])===!1)break}},getWidgetData:function(e,t){var n=avalon(e).data(),a={};for(var r in n)0===r.indexOf(t)&&(a[r.replace(t,"").replace(/\w/,function(e){return e.toLowerCase()})]=n[r]);return a},Array:{ensure:function(e,t){return-1===e.indexOf(t)?e.push(t):void 0},removeAt:function(e,t){return!!e.splice(t,1).length},remove:function(e,t){var n=e.indexOf(t);return~n?avalon.Array.removeAt(e,n):!1}}});var Bt=avalon.bindingHandlers={},Ft=avalon.bindingExecutors={},Vt=new function(){function e(e){this.size=0,this.limit=e,this.head=this.tail=void 0,this._keymap={}}var t=e.prototype;return t.put=function(e,t){var n={key:e,value:t};return this._keymap[e]=n,this.tail?(this.tail.newer=n,n.older=this.tail):this.head=n,this.tail=n,this.size===this.limit?this.shift():this.size++,t},t.shift=function(){var e=this.head;e&&(this.head=this.head.newer,this.head.older=e.newer=e.older=this._keymap[e.key]=void 0,delete this._keymap[e.key])},t.get=function(e){var t=this._keymap[e];if(void 0!==t)return t===this.tail?t.value:(t.newer&&(t===this.head&&(this.head=t.newer),t.newer.older=t.older),t.older&&(t.older.newer=t.newer),t.newer=void 0,t.older=this.tail,this.tail&&(this.tail.newer=t),this.tail=t,t.value)},e};if(yt.contains||(Node.prototype.contains=function(e){return!!(16&this.compareDocumentPosition(e))}),avalon.contains=function(e,t){try{for(;t=t.parentNode;)if(t===e)return!0;return!1}catch(n){return!1}},e.SVGElement){var Xt="http://www.w3.org/2000/svg",Ut=yt.createElementNS(Xt,"svg");Ut.innerHTML='<circle cx="50" cy="50" r="40" fill="red" />',Et.test(Ut.firstChild)||Object.defineProperties(SVGElement.prototype,{outerHTML:{enumerable:!0,configurable:!0,get:function(){return(new XMLSerializer).serializeToString(this)},set:function(e){var t=this.tagName.toLowerCase(),n=this.parentNode,a=avalon.parseHTML(e);if("svg"===t)n.insertBefore(a,this);else{var r=yt.createDocumentFragment();c(a,r),n.insertBefore(r,this)}n.removeChild(this)}},innerHTML:{enumerable:!0,configurable:!0,get:function(){var e=this.outerHTML,t=new RegExp("<"+this.nodeName+'\\b(?:(["\'])[^"]*?(\\1)|[^>])*>',"i"),n=new RegExp("</"+this.nodeName+">$","i");return e.replace(t,"").replace(n,"")},set:function(e){if(avalon.clearHTML){avalon.clearHTML(this);var t=avalon.parseHTML(e);c(t,this)}}}})}var Yt=avalon.eventHooks;"onmouseenter"in Lt||avalon.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){Yt[e]={type:t,deel:function(t,n,a){return function(n){var r=n.relatedTarget;return r&&(r===t||16&t.compareDocumentPosition(r))?void 0:(delete n.type,n.type=e,a.call(t,n))}}}}),avalon.each({AnimationEvent:"animationend",WebKitAnimationEvent:"webkitAnimationEnd"},function(t,n){e[t]&&!Yt.animationend&&(Yt.animationend={type:n})}),void 0===yt.onmousewheel&&(Yt.mousewheel={type:"wheel",fn:function(e,t){return function(n){n.wheelDeltaY=n.wheelDelta=n.deltaY>0?-120:120,n.wheelDeltaX=0,Object.defineProperty(n,"type",{value:"mousewheel"}),t.call(e,n)}}});var qt,zt,Wt,Gt,Zt,Jt=/[-.*+?^${}()|[\]\/\\]/g,Qt={interpolate:function(e){if(qt=e[0],zt=e[1],qt===zt)throw new SyntaxError("openTag===closeTag");var t=qt+"test"+zt;if(Dt.innerHTML=t,Dt.innerHTML!==t&&Dt.innerHTML.indexOf("<")>-1)throw new SyntaxError("此定界符不合法");u.openTag=qt,u.closeTag=zt,Dt.innerHTML="";var n=f(qt),a=f(zt);Wt=new RegExp(n+"(.*?)"+a),Gt=new RegExp(n+"(.*?)"+a,"g"),Zt=new RegExp(n+".*?"+a+"|\\sms-")}};u.debug=!0,u.plugins=Qt,u.plugins.interpolate(["{{","}}"]),u.paths={},u.shim={},u.maxRepeatSize=100,avalon.config=u;var Kt=function(e){return yt.querySelectorAll(e)},en={$watch:function(e,t){if("function"==typeof t){var n=this.$events[e];n?n.push(t):this.$events[e]=[t]}else this.$events=this.$watch.backup;return this},$unwatch:function(e,t){var n=arguments.length;if(0===n)this.$watch.backup=this.$events,this.$events={};else if(1===n)this.$events[e]=[];else for(var a=this.$events[e]||[],r=a.length;~--r<0;)if(a[r]===t)return a.splice(r,1);return this},$fire:function(e){var t,n,a,r;/^(\w+)!(\S+)$/.test(e)&&(t=RegExp.$1,e=RegExp.$2);var i=this.$events;if(i){var o=St.call(arguments,1),l=[e].concat(o);if("all"===t)for(n in avalon.vmodels)a=avalon.vmodels[n],a!==this&&a.$fire.apply(a,l);else if("up"===t||"down"===t){var s=i.expr?Kt(i.expr):[];if(0===s.length)return;for(n in avalon.vmodels)if(a=avalon.vmodels[n],a!==this&&a.$events.expr){var c=Kt(a.$events.expr);if(0===c.length)continue;Nt.forEach.call(c,function(e){Nt.forEach.call(s,function(n){var r="down"===t?n.contains(e):e.contains(n);r&&(e._avalon=a)})})}var u=yt.getElementsByTagName("*"),f=[];for(Nt.forEach.call(u,function(e){e._avalon&&(f.push(e._avalon),e._avalon="",e.removeAttribute("_avalon"))}),"up"===t&&f.reverse(),n=0;(r=f[n++])&&r.$fire.apply(r,l)!==!1;);}else{var d=i[e]||[],v=i.$all||[];for(n=0;r=d[n++];)_t(r)&&r.apply(this,o);for(n=0;r=v[n++];)_t(r)&&r.apply(this,arguments)}}}},tn=avalon.vmodels={};avalon.define=function(e,t){var a=e.$id||e;if(a||n("warning: vm必须指定$id"),tn[a]&&n("warning: "+a+" 已经存在于avalon.vmodels中"),"object"==typeof e)var r=d(e);else{var o={$watch:i};t(o),r=d(o),$t=!0,t(r),$t=!1}return r.$id=a,tn[a]=r};var nn=String("$id,$watch,$unwatch,$fire,$events,$model,$skipArray,$reinitialize").match(Tt),an=Object.is||function(e,t){return 0===e&&0===t?1/e===1/t:e!==e?t!==t:e===t},rn=function(e){var t={};for(var n in e)t[n]={get:e[n],set:e[n],enumerable:!0,configurable:!0};return t},on=Nt.splice,ln={_splice:on,_fire:function(e,t,n){k(this.$events[xt],e,t,n)},size:function(){return this._.length},pushArray:function(e){var t=e.length,n=this.length;return t&&(Nt.push.apply(this.$model,e),T.call(this,"add",n,t,Math.max(0,n-1))),t+n},push:function(){var e,t=[],n=arguments.length;for(e=0;n>e;e++)t[e]=arguments[e];return this.pushArray(t)},unshift:function(){var e=arguments.length,t=this.length;return e&&(Nt.unshift.apply(this.$model,arguments),T.call(this,"add",0,e,0)),e+t},shift:function(){if(this.length){var e=this.$model.shift();return T.call(this,"del",0,1,0),e}},pop:function(){var e=this.length;if(e){var t=this.$model.pop();return T.call(this,"del",e-1,1,Math.max(0,e-2)),t}},splice:function(e){var t,n=arguments.length,a=[],r=on.apply(this.$model,arguments);return r.length&&(a.push("del",e,r.length,0),t=!0),n>2&&(t?a.splice(3,1,0,"add",e,n-2):a.push("add",e,n-2,0),t=!0),t?T.apply(this,a):[]},contains:function(e){return-1!==this.indexOf(e)},remove:function(e){return this.removeAt(this.indexOf(e))},removeAt:function(e){return e>=0?(this.$model.splice(e,1),T.call(this,"del",e,1,0)):[]},clear:function(){return this.$model.length=this.length=this._.length=0,this._fire("clear",0),this},removeAll:function(e){if(Array.isArray(e))for(var t=this.length-1;t>=0;t--)-1!==e.indexOf(this[t])&&this.removeAt(t);else if("function"==typeof e)for(t=this.length-1;t>=0;t--){var n=this[t];e(n,t)&&this.removeAt(t)}else this.clear()},ensure:function(e){return this.contains(e)||this.push(e),this},set:function(e,t){if(e<this.length&&e>-1){var n=avalon.type(t);t&&t.$model&&(t=t.$model);var a=this[e];if("object"===n)for(var r in t)a.hasOwnProperty(r)&&(a[r]=t[r]);else"array"===n?a.clear().push.apply(a,t):a!==t&&(this[e]=t,this.$model[e]=t,this._fire("set",e,t))}return this}};"sort,reverse".replace(Tt,function(e){ln[e]=function(){var t,n=this.$model,a=n.concat(),r=Math.random(),i=[];Nt[e].apply(n,arguments);for(var o=0,l=a.length;l>o;o++){var s=n[o],c=a[o];if(an(s,c))i.push(o);else{var u=a.indexOf(s);i.push(u),a[u]=r,t=!0}}return t&&(C(this,i),this._fire("move",i),this._fire("index",0)),this}});var sn=function(){var e,t=[];return{begin:function(n){t.push(e),e=n},end:function(){e=t.pop()},collectDependency:function(t,n){e&&e.callback(t,n)}}}(),cn=/^(duplex|on)$/;avalon.injectBinding=function(e){var t=e.evaluator;if(t){sn.begin({callback:function(t,n){E(t.$events[n._name],e)}});try{var a=cn.test(e.type)?e:t.apply(0,e.args);void 0===a&&delete e.evaluator,e.handler&&e.handler(a,e.element,e)}catch(r){n("warning:exception throwed in [avalon.injectBinding] ",r),delete e.evaluator;var i=e.element;if(i&&3===i.nodeType){var o=i.parentNode;u.commentInterpolate?o.replaceChild(yt.createComment(e.value),i):i.data=qt+(e.oneTime?"::":"")+e.value+zt}}finally{sn.end()}}};var un=0,fn=avalon.$$subscribers=[],dn=new Date,vn={},pn=new function(){avalon.mix(this,{option:yt.createElement("select"),thead:yt.createElement("table"),td:yt.createElement("tr"),area:yt.createElement("map"),tr:yt.createElement("tbody"),col:yt.createElement("colgroup"),legend:yt.createElement("fieldset"),_default:yt.createElement("div"),g:yt.createElementNS("http://www.w3.org/2000/svg","svg")}),this.optgroup=this.option,this.tbody=this.tfoot=this.colgroup=this.caption=this.thead,this.th=this.td};String("circle,defs,ellipse,image,line,path,polygon,polyline,rect,symbol,text,use").replace(Tt,function(e){pn[e]=pn.g});var hn=/<([\w:]+)/,mn=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,gn=o(["","text/javascript","text/ecmascript","application/ecmascript","application/javascript"]),yn=yt.createElement("script"),bn=/<|&#?\w+;/;avalon.parseHTML=function(e){var t=Ht.cloneNode(!1);if("string"!=typeof e)return t;if(!bn.test(e))return t.appendChild(yt.createTextNode(e)),t;e=e.replace(mn,"<$1></$2>").trim();var n,a=(hn.exec(e)||["",""])[1].toLowerCase(),r=pn[a]||pn._default;r.innerHTML=e;var i=r.getElementsByTagName("script");if(i.length)for(var o,l=0;o=i[l++];)if(gn[o.type]){var s=yn.cloneNode(!1);Nt.forEach.call(o.attributes,function(e){s.setAttribute(e.name,e.value)}),s.text=o.text,o.parentNode.replaceChild(s,o)}for(;n=r.firstChild;)t.appendChild(n);return t},avalon.innerHTML=function(e,t){var n=this.parseHTML(t);this.clearHTML(e).appendChild(n)},avalon.clearHTML=function(e){for(e.textContent="";e.firstChild;)e.removeChild(e.firstChild);return e},"add,remove".replace(Tt,function(e){avalon.fn[e+"Class"]=function(t){var n=this[0];return t&&"string"==typeof t&&n&&1===n.nodeType&&t.replace(/\S+/g,function(t){n.classList[e](t)}),this}}),avalon.fn.mix({hasClass:function(e){var t=this[0]||{};return 1===t.nodeType&&t.classList.contains(e)},toggleClass:function(e,t){for(var n,a=0,r=String(e).split(/\s+/),i="boolean"==typeof t;n=r[a++];){var o=i?t:!this.hasClass(n);this[o?"addClass":"removeClass"](n)}return this},attr:function(e,t){return 2===arguments.length?(this[0].setAttribute(e,t),this):this[0].getAttribute(e)},data:function(e,t){switch(e="data-"+j(e||""),arguments.length){case 2:return this.attr(e,t),this;case 1:var n=this.attr(e);return H(n);case 0:var a={};return Nt.forEach.call(this[0].attributes,function(t){t&&(e=t.name,e.indexOf("data-")||(e=L(e.slice(5)),a[e]=H(t.value)))}),a}},removeData:function(e){return e="data-"+j(e),this[0].removeAttribute(e),this},css:function(e,t){if(avalon.isPlainObject(e))for(var n in e)avalon.css(this,n,e[n]);else var a=avalon.css(this,e,t);return void 0!==a?a:this},position:function(){var e,t,n=this[0],a={top:0,left:0};if(n)return"fixed"===this.css("position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),"HTML"!==e[0].tagName&&(a=e.offset()),a.top+=avalon.css(e[0],"borderTopWidth",!0),a.left+=avalon.css(e[0],"borderLeftWidth",!0),a.top-=e.scrollTop(),a.left-=e.scrollLeft()),{top:t.top-a.top-avalon.css(n,"marginTop",!0),left:t.left-a.left-avalon.css(n,"marginLeft",!0)}},offsetParent:function(){for(var e=this[0].offsetParent;e&&"static"===avalon.css(e,"position");)e=e.offsetParent;return avalon(e||Lt)},bind:function(e,t,n){return this[0]?avalon.bind(this[0],e,t,n):void 0},unbind:function(e,t,n){return this[0]&&avalon.unbind(this[0],e,t,n),this},val:function(e){var t=this[0];if(t&&1===t.nodeType){var n=0===arguments.length,a=n?":get":":set",r=kn[R(t)+a];if(r)var i=r(t,e);else{if(n)return(t.value||"").replace(/\r/g,"");t.value=e}}return n?i:this}}),Lt.dataset&&(avalon.fn.data=function(e,t){e=e&&L(e);var n=this[0].dataset;switch(arguments.length){case 2:return n[e]=t,this;case 1:return t=n[e],H(t);case 0:var a=r();for(e in n)a[e]=H(n[e]);return a}});var wn=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/;avalon.parseJSON=JSON.parse,avalon.fireDom=function(e,t,n){var a=yt.createEvent("Events");a.initEvent(t,!0,!0),avalon.mix(a,n),e.dispatchEvent(a)},avalon.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){avalon.fn[e]=function(n){var a=this[0]||{},r=D(a),i="scrollTop"===e;return arguments.length?void(r?r.scrollTo(i?r[t]:n,i?n:r[t]):a[e]=n):r?r[t]:a[e]}});var xn=avalon.cssHooks=r(),$n=["","-webkit-","-moz-","-ms-"],Tn={"float":"cssFloat"};avalon.cssNumber=o("animationIterationCount,columnCount,order,flex,flexGrow,flexShrink,fillOpacity,fontWeight,lineHeight,opacity,orphans,widows,zIndex,zoom"),avalon.cssName=function(e,t,n){if(Tn[e])return Tn[e];t=t||Lt.style;for(var a=0,r=$n.length;r>a;a++)if(n=L($n[a]+e),n in t)return Tn[e]=n;
|
2
|
-
return null},xn["@:set"]=function(e,t,n){e.style[t]=n},xn["@:get"]=function(e,t){if(!e||!e.style)throw new Error("getComputedStyle要求传入一个节点 "+e);var n,a=getComputedStyle(e);return a&&(n="filter"===t?a.getPropertyValue(t):a[t],""===n&&(n=e.style[t])),n},xn["opacity:get"]=function(e){var t=xn["@:get"](e,"opacity");return""===t?"1":t},"top,left".replace(Tt,function(e){xn[e+":get"]=function(t){var n=xn["@:get"](t,e);return/px$/.test(n)?n:avalon(t).position()[e]+"px"}});var Cn={position:"absolute",visibility:"hidden",display:"block"},En=/^(none|table(?!-c[ea]).+)/;"Width,Height".replace(Tt,function(e){var t=e.toLowerCase(),n="client"+e,a="scroll"+e,r="offset"+e;xn[t+":get"]=function(t,n,a){var i=-4;"number"==typeof a&&(i=a),n="Width"===e?["Left","Right"]:["Top","Bottom"];var o=t[r];return 2===i?o+avalon.css(t,"margin"+n[0],!0)+avalon.css(t,"margin"+n[1],!0):(0>i&&(o=o-avalon.css(t,"border"+n[0]+"Width",!0)-avalon.css(t,"border"+n[1]+"Width",!0)),-4===i&&(o=o-avalon.css(t,"padding"+n[0],!0)-avalon.css(t,"padding"+n[1],!0)),o)},xn[t+"&get"]=function(e){var n=[];P(e,n);for(var a,r=xn[t+":get"](e),i=0;a=n[i++];){e=a.node;for(var o in a)"string"==typeof a[o]&&(e.style[o]=a[o])}return r},avalon.fn[t]=function(i){var o=this[0];if(0===arguments.length){if(o.setTimeout)return o["inner"+e];if(9===o.nodeType){var l=o.documentElement;return Math.max(o.body[a],l[a],o.body[r],l[r],l[n])}return xn[t+"&get"](o)}return this.css(t,i)},avalon.fn["inner"+e]=function(){return xn[t+":get"](this[0],void 0,-2)},avalon.fn["outer"+e]=function(e){return xn[t+":get"](this[0],void 0,e===!0?2:0)}}),avalon.fn.offset=function(){var e=this[0];try{var t=e.getBoundingClientRect();if(t.width||t.height||e.getClientRects().length){var n=e.ownerDocument,a=n.documentElement,r=n.defaultView;return{top:t.top+r.pageYOffset-a.clientTop,left:t.left+r.pageXOffset-a.clientLeft}}}catch(i){return{left:0,top:0}}};var kn={"select:get":function(e,t){for(var n,a=e.options,r=e.selectedIndex,i="select-one"===e.type||0>r,o=i?null:[],l=i?r+1:a.length,s=0>r?l:i?r:0;l>s;s++)if(n=a[s],(n.selected||s===r)&&!n.disabled){if(t=n.value,i)return t;o.push(t)}return o},"select:set":function(e,t,n){t=[].concat(t);for(var a,r=0;a=e.options[r++];)(a.selected=t.indexOf(a.value)>-1)&&(n=!0);n||(e.selectedIndex=-1)}},An=JSON.stringify,Mn=["break,case,catch,continue,debugger,default,delete,do,else,false","finally,for,function,if,in,instanceof,new,null,return,switch,this","throw,true,try,typeof,var,void,while,with","abstract,boolean,byte,char,class,const,double,enum,export,extends","final,float,goto,implements,import,int,interface,long,native","package,private,protected,public,short,static,super,synchronized","throws,transient,volatile","arguments,let,yield,undefined"].join(","),On=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g,Nn=/[^\w$]+/g,Sn=new RegExp(["\\b"+Mn.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),jn=/\b\d[^,]*/g,Ln=/^,+|,+$/g,Hn=new Vt(512),Dn=function(e){var t=","+e.trim(),n=Hn.get(t);if(n)return n;var a=e.replace(On,"").replace(Nn,",").replace(Sn,"").replace(jn,"").replace(Ln,"").split(/^$|,+/);return Hn.put(t,_(a))},Pn=new Vt(128),Rn=/\w\[.*\]|\w\.\w/,In=/(\$proxy\$[a-z]+)\d+$/,_n=/\)\s*$/,Bn=/\)\s*\|/g,Fn=/\|\s*([$\w]+)/g,Vn=/"\s*\["/g,Xn=/"\s*\(/g;avalon.parseExprProxy=X,avalon.scan=function(e,t){e=e||Lt;var n=t?[].concat(t):[];J(e,n)};var Un=o("area,base,basefont,br,col,command,embed,hr,img,input,link,meta,param,source,track,wbr,noscript,script,style,textarea".toUpperCase()),Yn=function(e,t,n){var a=e.getAttribute(t);if(a)for(var r,i=0;r=n[i++];)if(r.hasOwnProperty(a)&&"function"==typeof r[a])return r[a]},qn=It&&e.MutationObserver?function(e){for(var t,n=e.firstChild;n;){var a=n.nextSibling;3===n.nodeType?t?(t.nodeValue+=n.nodeValue,e.removeChild(n)):t=n:t=null,n=a}}:0,zn=/^\s*::/,Wn=/ms-(\w+)-?(.*)/,Gn={"if":10,repeat:90,data:100,widget:110,each:1400,"with":1500,duplex:2e3,on:3e3},Zn=o("animationend,blur,change,input,click,dblclick,focus,keydown,keypress,keyup,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,mouseup,scan,scroll,submit"),Jn=o("value,title,alt,checked,selected,disabled,readonly,enabled"),Qn=/^if|widget|repeat$/,Kn=/^each|with|html|include$/,ea=/\|\s*html(?:\b|$)/,ta=/\|\|/g,na=/(['"])(\\\1|.)+?\1/g,aa=["autofocus,autoplay,async,allowTransparency,checked,controls","declare,disabled,defer,defaultChecked,defaultSelected","contentEditable,isMap,loop,multiple,noHref,noResize,noShade","open,readOnly,selected"].join(","),ra={};aa.replace(Tt,function(e){ra[e.toLowerCase()]=e});var ia={"accept-charset":"acceptCharset","char":"ch",charoff:"chOff","class":"className","for":"htmlFor","http-equiv":"httpEquiv"},oa=["accessKey,bgColor,cellPadding,cellSpacing,codeBase,codeType,colSpan","dateTime,defaultValue,frameBorder,longDesc,maxLength,marginWidth,marginHeight","rowSpan,tabIndex,useMap,vSpace,valueType,vAlign"].join(",");oa.replace(Tt,function(e){ia[e.toLowerCase()]=e});var la=/<noscript.*?>(?:[\s\S]+?)<\/noscript>/gim,sa=/<noscript.*?>([\s\S]+?)<\/noscript>/im,ca=function(){return new(e.XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP")},ua=avalon.templateCache={};Bt.attr=function(e,t){var n=V(e.value.trim());if("include"===e.type){var a=e.element;e.includeRendered=Yn(a,"data-include-rendered",t),e.includeLoaded=Yn(a,"data-include-loaded",t);var r=e.includeReplace=!!avalon(a).data("includeReplace");avalon(a).data("includeCache")&&(e.templateCache={}),e.startInclude=yt.createComment("ms-include"),e.endInclude=yt.createComment("ms-include-end"),r?(e.element=e.startInclude,a.parentNode.insertBefore(e.startInclude,a),a.parentNode.insertBefore(e.endInclude,a.nextSibling)):(a.insertBefore(e.startInclude,a.firstChild),a.appendChild(e.endInclude))}e.handlerName="attr",X(n,t,e)},Ft.attr=function(t,n,a){var r=a.type,i=a.param;if("css"===r)avalon(n).css(i,t);else if("attr"===r){var o=t===!1||null===t||void 0===t;!jt&&ia[i]&&(i=ia[i]);var l=ra[i];if("boolean"==typeof n[l]&&(n[l]=!!t,t||(o=!0)),o)return n.removeAttribute(i);var s=Et.test(n)?!1:yt.namespaces&&isVML(n)?!0:i in n.cloneNode(!1);s?n[i]=t+"":n.setAttribute(i,t)}else if("include"===r&&t){var c=a.vmodels,u=a.includeRendered,f=a.includeLoaded,d=a.includeReplace,v=d?n.parentNode:n,p=function(e){if(null!==a.vmodels){if(f){var n=f.apply(v,[e].concat(c));"string"==typeof n&&(e=n)}u&&U(v,function(){u.call(v)},0/0);var r=a.includeLastID;if(a.templateCache&&r&&r!==t){var i=a.templateCache[r];i||(i=a.templateCache[r]=yt.createElement("div"),wt.appendChild(i))}for(a.includeLastID=t;a.startInclude;){var o=a.startInclude.nextSibling;if(!o||o===a.endInclude)break;v.removeChild(o),i&&i.appendChild(o)}var l=tt(a,t,e),s=avalon.slice(l.childNodes);v.insertBefore(l,a.endInclude),Z(s,c)}};if("src"===a.param)if("string"==typeof ua[t])avalon.nextTick(function(){p(ua[t])});else if(Array.isArray(ua[t]))ua[t].push(p);else{var h=ca();h.onreadystatechange=function(){if(4===h.readyState){var e=h.status;if(e>=200&&300>e||304===e||1223===e){for(var n,a=h.responseText,r=0;n=ua[t][r++];)n(a);ua[t]=a}}},ua[t]=[p],h.open("GET",t,!0),"withCredentials"in h&&(h.withCredentials=!0),h.setRequestHeader("X-Requested-With","XMLHttpRequest"),h.send(null)}else{var m=t&&1===t.nodeType?t:yt.getElementById(t);if(m){if("NOSCRIPT"===m.tagName&&!m.innerHTML&&!m.fixIE78){h=ca(),h.open("GET",location,!1),h.send(null);for(var g=yt.getElementsByTagName("noscript"),y=(h.responseText||"").match(la)||[],b=y.length,w=0;b>w;w++){var x=g[w];x&&(x.style.display="none",x.fixIE78=(y[w].match(sa)||[""," "])[1])}}avalon.nextTick(function(){p(m.fixIE78||m.value||m.innerText||m.innerHTML)})}}}else if(Lt.hasAttribute||"string"!=typeof t||"src"!==r&&"href"!==r||(t=t.replace(/&/g,"&")),n[r]=t,e.chrome&&"EMBED"===n.tagName){var $=n.parentNode,T=document.createComment("ms-src");$.replaceChild(T,n),$.replaceChild(n,T)}},"title,alt,src,value,css,include,href".replace(Tt,function(e){Bt[e]=Bt.attr}),Bt["class"]=function(e,t){var n,a=e.param,r=e.value;if(e.handlerName="class",!a||isFinite(a)){e.param="";var i=r.replace(Gt,function(e){return e.replace(/./g,"0")}).indexOf(":");if(-1===i){var o=r;n=!0}else o=r.slice(0,i),n=r.slice(i+1);o=Wt.test(r)?V(o):An(o),e.expr="["+o+","+n+"]"}else e.expr="["+An(a)+","+r+"]",e.oldStyle=a;var l=e.type;if("hover"===l||"active"===l){if(!e.hasBindEvent){var s=e.element,c=avalon(s),u="mouseenter",f="mouseleave";if("active"===l){s.tabIndex=s.tabIndex||-1,u="mousedown",f="mouseup";var d=c.bind("mouseleave",function(){e.toggleClass&&c.removeClass(e.newClass)})}}var v=c.bind(u,function(){e.toggleClass&&c.addClass(e.newClass)}),p=c.bind(f,function(){e.toggleClass&&c.removeClass(e.newClass)});e.rollback=function(){c.unbind("mouseleave",d),c.unbind(u,v),c.unbind(f,p)},e.hasBindEvent=!0}X(e.expr,t,e)},Ft["class"]=function(e,t,n){var a=avalon(t);n.newClass=e[0],n.toggleClass=!!e[1],n.oldClass&&n.newClass!==n.oldClass&&a.removeClass(n.oldClass),n.oldClass=n.newClass,"class"===n.type&&(n.oldStyle?a.toggleClass(n.oldStyle,!!e[1]):a.toggleClass(n.newClass,n.toggleClass))},"hover,active".replace(Tt,function(e){Bt[e]=Bt["class"]}),Ft.data=function(e,t,n){var a="data-"+n.param;e&&"object"==typeof e?t[a]=e:t.setAttribute(a,String(e))};var fa=Bt.duplex=function(e,t){var a,r=e.element;if(X(e.value,t,e,1),e.changed=Yn(r,"data-duplex-changed",t)||i,e.evaluator&&e.args){var l=[],s=o("string,number,boolean,checked");"radio"===r.type&&""===e.param&&(e.param="checked"),r.msData&&(r.msData["ms-duplex"]=e.value),e.param.replace(/\w+/g,function(t){/^(checkbox|radio)$/.test(r.type)&&/^(radio|checked)$/.test(t)&&("radio"===t&&n("ms-duplex-radio已经更名为ms-duplex-checked"),t="checked",e.isChecked=!0),"bool"===t?(t="boolean",n("ms-duplex-bool已经更名为ms-duplex-boolean")):"text"===t&&(t="string",n("ms-duplex-text已经更名为ms-duplex-string")),s[t]&&(a=!0),avalon.Array.ensure(l,t)}),a||l.push("string"),e.param=l.join("-"),e.bound=function(t,n){r.addEventListener?r.addEventListener(t,n,!1):r.attachEvent("on"+t,n);var a=e.rollback;e.rollback=function(){r.avalonSetter=null,avalon.unbind(r,t,n),a&&a()}};for(var c in avalon.vmodels){var u=avalon.vmodels[c];u.$fire("avalon-ms-duplex-init",e)}var f=e.pipe||(e.pipe=at);f(null,e,"init");var d=r.tagName;fa[d]&&fa[d](r,e.evaluator.apply(null,e.args),e)}};avalon.duplexHooks={checked:{get:function(e,t){return!t.element.oldValue}},string:{get:function(e){return e},set:nt},"boolean":{get:function(e){return"true"===e},set:nt},number:{get:function(e,t){var n=parseFloat(e);if(-e===-n)return n;var a=/strong|medium|weak/.exec(t.element.getAttribute("data-duplex-number"))||["medium"];switch(a[0]){case"strong":return 0;case"medium":return""===e?"":0;case"weak":return e}},set:nt}};var da,va=[];avalon.tick=function(e){1===va.push(e)&&(da=setInterval(rt,60))};var pa=i;!new function(){function e(e){t[this.tagName].call(this,e),!this.msFocus&&this.avalonSetter&&this.avalonSetter()}try{var t={},n=HTMLInputElement.prototype,a=HTMLTextAreaElement.prototype,r=HTMLInputElement.prototype;Object.getOwnPropertyNames(r),t.INPUT=Object.getOwnPropertyDescriptor(n,"value").set,Object.defineProperty(n,"value",{set:e}),t.TEXTAREA=Object.getOwnPropertyDescriptor(a,"value").set,Object.defineProperty(a,"value",{set:e})}catch(i){pa=avalon.tick}};var ha=/^(file|button|reset|submit|checkbox|radio|range)$/;fa.INPUT=function(e,t,a){function r(e){a.changed.call(this,e,a)}function i(){f=!0}function o(){f=!1}var l,s=e.type,c=a.bound,u=avalon(e),f=!1,d=function(){var n=e.value;if(!f&&n!==l){var i=a.pipe(n,a,"get");u.data("duplexObserve")!==!1&&(l=n,t(i),r.call(e,i))}};if(a.handler=function(){var n=a.pipe(t(),a,"set");if(n!==l){var r=!1;if(e.msFocus)try{var i=e.selectionStart,o=e.selectionEnd;if(i===o){var s=i;r=!0}}catch(c){}e.value=l=n,r&&!e.readyOnly&&(e.selectionStart=e.selectionEnd=s)}},a.isChecked||"radio"===s)d=function(){if(u.data("duplexObserve")!==!1){var n=a.pipe(e.value,a,"get");t(n),r.call(e,n)}},a.handler=function(){var n=t(),r=a.isChecked?!!n:n+""===e.value;e.checked=e.oldValue=r},c("click",d);else if("checkbox"===s)d=function(){if(u.data("duplexObserve")!==!1){var i=e.checked?"ensure":"remove",o=t();Array.isArray(o)||(n("ms-duplex应用于checkbox上要对应一个数组"),o=[o]),avalon.Array[i](o,a.pipe(e.value,a,"get")),r.call(e,o)}},a.handler=function(){var n=[].concat(t());e.checked=n.indexOf(a.pipe(e.value,a,"get"))>-1},c("change",d);else{var v=e.getAttribute("data-duplex-event")||"input";e.attributes["data-event"]&&n("data-event指令已经废弃,请改用data-duplex-event"),v.replace(Tt,function(e){switch(e){case"input":c("input",d),c("keyup",d),It||(c("compositionstart",i),c("compositionend",o),c("DOMAutoComplete",d));break;default:c(e,d)}}),ha.test(s)||("hidden"!==s&&(c("focus",function(){e.msFocus=!0}),c("blur",function(){e.msFocus=!1})),e.avalonSetter=d,pa(function(){if(Lt.contains(e))e.msFocus||d();else if(!e.msRetain)return!1}))}avalon.injectBinding(a),r.call(e,e.value)},fa.TEXTAREA=fa.INPUT,fa.SELECT=function(e,t,a){function r(){if(i.data("duplexObserve")!==!1){var n=i.val();n=Array.isArray(n)?n.map(function(e){return a.pipe(e,a,"get")}):a.pipe(n,a,"get"),n+""!==e.oldValue&&t(n),a.changed.call(e,n,a)}}var i=avalon(e);a.handler=function(){var a=t();a=a&&a.$model||a,Array.isArray(a)?e.multiple||n("ms-duplex在<select multiple=true>上要求对应一个数组"):e.multiple&&n("ms-duplex在<select multiple=false>不能对应一个数组"),a=Array.isArray(a)?a.map(String):a+"",a+""!==e.oldValue&&(i.val(a),e.oldValue=a+"")},a.bound("change",r),e.msCallback=function(){avalon.injectBinding(a),a.changed.call(e,t(),a)}},Ft.html=function(e,t,n){var a=1!==t.nodeType,r=a?t.parentNode:t;if(r&&(e=null==e?"":e,n.oldText!==e)){if(n.oldText=e,3===t.nodeType){var i=Rt("html");r.insertBefore(yt.createComment(i),t),n.element=yt.createComment(i+":end"),r.replaceChild(n.element,t),t=n.element}if("object"!=typeof e)var o=avalon.parseHTML(String(e));else if(11===e.nodeType)o=e;else if(1===e.nodeType||e.item){var l=1===e.nodeType?e.childNodes:e.item;for(o=Ht.cloneNode(!0);l[0];)o.appendChild(l[0])}if(l=avalon.slice(o.childNodes),a){for(var s=t.nodeValue.slice(0,-4);;){var c=t.previousSibling;if(!c||8===c.nodeType&&c.nodeValue===s)break;r.removeChild(c)}r.insertBefore(o,t)}else avalon.clearHTML(t).appendChild(o);Z(l,n.vmodels)}},Bt["if"]=Bt.data=Bt.text=Bt.html=function(e,t){X(e.value,t,e)},Ft["if"]=function(e,t,n){try{if(!t.parentNode)return}catch(a){return}if(e)8===t.nodeType&&(t.parentNode.replaceChild(n.template,t),t.ifRemove=null,t=n.element=n.template),t.getAttribute(n.name)&&(t.removeAttribute(n.name),W(t,n.vmodels)),n.rollback=null;else if(1===t.nodeType){var r=n.element=yt.createComment("ms-if");t.parentNode.replaceChild(r,t),t.ifRemove=r,n.template=t,wt.appendChild(t),n.rollback=function(){t.parentNode===wt&&wt.removeChild(t)}}};var ma=/\(([^)]*)\)/;Bt.on=function(e,t){var n=e.value;e.type="on";var a=e.param.replace(/-\d+$/,"");if("function"==typeof Bt.on[a+"Hook"]&&Bt.on[a+"Hook"](e),n.indexOf("(")>0&&n.indexOf(")")>-1){var r=(n.match(ma)||["",""])[1].trim();(""===r||"$event"===r)&&(n=n.replace(ma,""))}X(n,t,e)},Ft.on=function(e,t,n){e=function(e){var t=n.evaluator||i;return t.apply(this,n.args.concat(e))};var a=n.param.replace(/-\d+$/,"");if("scan"===a)e.call(t,{type:a});else if("function"==typeof n.specialBind)n.specialBind(t,e);else var r=avalon.bind(t,a,e);n.rollback=function(){"function"==typeof n.specialUnbind?n.specialUnbind():avalon.unbind(t,a,r)}},Bt.repeat=function(e,t){var n=e.type;X(e.value,t,e,1),e.proxies=[];var a=!1;try{var r=e.$repeat=e.evaluator.apply(0,e.args||[]),o=avalon.type(r);"object"!==o&&"array"!==o?(a=!0,avalon.log("warning:"+e.value+"只能是对象或数组")):e.xtype=o}catch(l){a=!0}var s=e.value.split(".")||[];if(s.length>1){s.pop();for(var c,u=s[0],f=0;c=t[f++];)if(c&&c.hasOwnProperty(u)){var d=c[u].$events||{};d[xt]=d[xt]||[],d[xt].push(e);break}}var v=e.handler;e.handler=i,avalon.injectBinding(e),e.handler=v;var p=e.element;if(1===p.nodeType){p.removeAttribute(e.name),e.sortedCallback=Yn(p,"data-with-sorted",t),e.renderedCallback=Yn(p,"data-"+n+"-rendered",t);var h=Rt(n),m=yt.createComment(h),g=yt.createComment(h+":end");if(e.signature=h,e.template=Ht.cloneNode(!1),"repeat"===n){var y=p.parentNode;y.replaceChild(g,p),y.insertBefore(m,g),e.template.appendChild(p)}else{for(;p.firstChild;)e.template.appendChild(p.firstChild);p.appendChild(m),p.appendChild(g)}e.element=g,e.handler=Ft.repeat,e.rollback=function(){var t=e.element;t&&e.handler("clear")}}if(!a){e.$outer={};var b="$key",w="$val";for(Array.isArray(r)&&(b="$first",w="$last"),f=0;c=t[f++];)if(c.hasOwnProperty(b)&&c.hasOwnProperty(w)){e.$outer=c;break}var x=r.$events,$=(x||{})[xt];E($,e),"object"===o?e.handler("append"):r.length&&e.handler("add",0,r.length)}},Ft.repeat=function(e,t,n){var a=this;if(!e&&a.xtype){var r=a.$repeat,o=a.evaluator.apply(0,a.args||[]);if("array"===a.xtype){if(r.length===o.length){if(!(r!==o&&r.length>0))return;Ft.repeat.call(this,"clear",t,n)}e="add",t=0,a.$repeat=o,n=o.length}else{if(p(r).join(";;")===p(o).join(";;"))return;e="append",a.$repeat=o}}if(e){var l,s,c=a.element,u=ot(a),f=c.parentNode,d=a.proxies,v=Ht.cloneNode(!1);switch(e){case"add":for(var h=t+n,m=[],g=t;h>g;g++){var y=vt(g,a);d.splice(g,0,y),it(a,v,y,m)}for(f.insertBefore(v,u[t]||c),g=0;s=m[g++];)Z(s.nodes,s.vmodels),s.nodes=s.vmodels=null;break;case"del":lt(u[t],u[t+n]||c);var b=d.splice(t,n);ut(b,"each");break;case"clear":l=u[0],l&&(lt(l,c),"object"===a.xtype?f.insertBefore(l,c):ut(d,"each"));break;case"move":if(l=u[0]){var w,x=l.nodeValue,$=[],T=[];for(lt(l,c,function(){T.unshift(this),this.nodeValue===x&&($.unshift(T),T=[])}),C($,t),C(d,t);T=$.shift();)for(;w=T.shift();)v.appendChild(w);f.insertBefore(v,c)}break;case"index":for(var E=d.length-1;n=d[t];t++)n.$index=t,n.$first=0===t,n.$last=t===E;return;case"set":y=d[t],y&&k(y.$events[a.param||"el"]);break;case"append":var A=a.$repeat,M=Array.isArray(d)||!d?{}:d;a.proxies=M;var O=[];m=[];for(var N in M)A.hasOwnProperty(N)||(pt(M[N],ga),delete M[N]);for(N in A)A.hasOwnProperty(N)&&"hasOwnProperty"!==N&&O.push(N);if(a.sortedCallback){var S=a.sortedCallback.call(f,O);S&&Array.isArray(S)&&S.length&&(O=S)}for(g=0;N=O[g++];)"hasOwnProperty"!==N&&(M[N]=ct(M[N],N,a),it(a,v,M[N],m));for(f.insertBefore(v,c),g=0;s=m[g++];)Z(s.nodes,s.vmodels),s.nodes=s.vmodels=null}if(!a.$repeat||a.$repeat.hasOwnProperty("$lock"))return;"clear"===e&&(e="del");var j=a.renderedCallback||i,L=arguments;f.oldValue&&"SELECT"===f.tagName&&avalon(f).val(f.oldValue.split(",")),j.apply(f,L)}},"with,each".replace(Tt,function(e){Bt[e]=Bt.repeat});var ga=[],ya=[];Ft.text=function(e,t){if(e=null==e?"":e,3===t.nodeType)try{t.data=e}catch(n){}else t.textContent=e},avalon.parseDisplay=ht,Bt.visible=function(e,t){X(e.value,t,e)},Ft.visible=function(e,t,n){e?(t.style.display=n.display||"","none"===avalon(t).css("display")&&(t.style.display=n.display=ht(t.nodeName))):t.style.display="none"},Bt.widget=function(t,a){var r=t.value.match(Tt),o=t.element,l=r[0],s=r[1];s&&"$"!==s||(s=Rt(l));var c=r[2]||l,u=avalon.ui[l];if("function"==typeof u){a=o.vmodels||a;for(var f,d=0;f=a[d++];)if(f.hasOwnProperty(c)&&"object"==typeof f[c]){var v=f[c];v=v.$model||v;break}if(v){var p=v[l+"Id"];"string"==typeof p&&(n("warning!不再支持"+l+"Id"),s=p)}var h=avalon.getWidgetData(o,l);t.value=[l,s,c].join(","),t[l+"Id"]=s,t.evaluator=i,o.msData["ms-widget-id"]=s;var m=t[l+"Options"]=avalon.mix({},u.defaults,v||{},h);o.removeAttribute("ms-widget");var g=u(o,t,a)||{};if(g.$id){avalon.vmodels[s]=g,Y(o,g);try{g.$init(function(){avalon.scan(o,[g].concat(a)),"function"==typeof m.onInit&&m.onInit.call(o,g,m,a)})}catch(y){n(y)}t.rollback=function(){try{g.$remove(),g.widgetElement=null}catch(e){}o.msData={},delete avalon.vmodels[g.$id]},M(t,ba),e.chrome&&o.addEventListener("DOMNodeRemovedFromDocument",function(){setTimeout(O)})}else avalon.scan(o,a)}else a.length&&(o.vmodels=a)};var ba=[],wa=/<script[^>]*>([\S\s]*?)<\/script\s*>/gim,xa=/\s+(on[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,$a=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/gi,Ta={a:/\b(href)\=("javascript[^"]*"|'javascript[^']*')/gi,img:/\b(src)\=("javascript[^"]*"|'javascript[^']*')/gi,form:/\b(action)\=("javascript[^"]*"|'javascript[^']*')/gi},Ca=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ea=/([^\#-~| |!])/g,ka=avalon.filters={uppercase:function(e){return e.toUpperCase()},lowercase:function(e){return e.toLowerCase()},truncate:function(e,t,n){return t=t||30,n="string"==typeof n?n:"...",e.length>t?e.slice(0,t-n.length)+n:String(e)},$filter:function(e){for(var t=1,n=arguments.length;n>t;t++){var a=arguments[t],r=avalon.filters[a[0]];if("function"==typeof r){var i=[e].concat(a.slice(1));e=r.apply(null,i)}}return e},camelize:L,sanitize:function(e){return e.replace(wa,"").replace($a,function(e){var t=e.toLowerCase().match(/<(\w+)\s/);if(t){var n=Ta[t[1]];n&&(e=e.replace(n,function(e,t,n){var a=n.charAt(0);return t+"="+a+"javascript:void(0)"+a}))}return e.replace(xa," ").replace(/\s+/g," ")})},escape:function(e){return String(e).replace(/&/g,"&").replace(Ca,function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1);return"&#"+(1024*(t-55296)+(n-56320)+65536)+";"}).replace(Ea,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")},currency:function(e,t,n){return(t||"¥")+mt(e,isFinite(n)?n:2)},number:mt};!new function(){function e(e){return parseInt(e,10)||0}function t(e,t,n){var a="";for(0>e&&(a="-",e=-e),e=""+e;e.length<t;)e="0"+e;return n&&(e=e.substr(e.length-t)),a+e}function n(e,n,a,r){return function(i){var o=i["get"+e]();return(a>0||o>-a)&&(o+=a),0===o&&-12===a&&(o=12),t(o,n,r)}}function a(e,t){return function(n,a){var r=n["get"+e](),i=(t?"SHORT"+e:e).toUpperCase();return a[i][r]}}function r(e){var n=-1*e.getTimezoneOffset(),a=n>=0?"+":"";return a+=t(Math[n>0?"floor":"ceil"](n/60),2)+t(Math.abs(n%60),2)}function i(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}var o={yyyy:n("FullYear",4),yy:n("FullYear",2,0,!0),y:n("FullYear",1),MMMM:a("Month"),MMM:a("Month",!0),MM:n("Month",2,1),M:n("Month",1,1),dd:n("Date",2),d:n("Date",1),HH:n("Hours",2),H:n("Hours",1),hh:n("Hours",2,-12),h:n("Hours",1,-12),mm:n("Minutes",2),m:n("Minutes",1),ss:n("Seconds",2),s:n("Seconds",1),sss:n("Milliseconds",3),EEEE:a("Day"),EEE:a("Day",!0),a:i,Z:r},l=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,s=/^\/Date\((\d+)\)\/$/;ka.date=function(t,n){var a,r,i=ka.date.locate,c="",u=[];if(n=n||"mediumDate",n=i[n]||n,"string"==typeof t)if(/^\d+$/.test(t))t=e(t);else if(s.test(t))t=+RegExp.$1;else{var f=t.trim(),d=[0,0,0,0,0,0,0],v=new Date(0);f=f.replace(/^(\d+)\D(\d+)\D(\d+)/,function(t,n,a,r){var i=4===r.length?[r,n,a]:[n,a,r];return d[0]=e(i[0]),d[1]=e(i[1])-1,d[2]=e(i[2]),""});var p=v.setFullYear,h=v.setHours;f=f.replace(/[T\s](\d+):(\d+):?(\d+)?\.?(\d)?/,function(t,n,a,r,i){return d[3]=e(n),d[4]=e(a),d[5]=e(r),i&&(d[6]=Math.round(1e3*parseFloat("0."+i))),""});var m=0,g=0;f=f.replace(/Z|([+-])(\d\d):?(\d\d)/,function(t,n,a,r){return p=v.setUTCFullYear,h=v.setUTCHours,n&&(m=e(n+a),g=e(n+r)),""}),d[3]-=m,d[4]-=g,p.apply(v,d.slice(0,3)),h.apply(v,d.slice(3)),t=v}if("number"==typeof t&&(t=new Date(t)),"date"===avalon.type(t)){for(;n;)r=l.exec(n),r?(u=u.concat(r.slice(1)),n=u.pop()):(u.push(n),n=null);return u.forEach(function(e){a=o[e],c+=a?a(t,i):e.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),c}};var c={AMPMS:{0:"上午",1:"下午"},DAY:{0:"星期日",1:"星期一",2:"星期二",3:"星期三",4:"星期四",5:"星期五",6:"星期六"},MONTH:{0:"1月",1:"2月",2:"3月",3:"4月",4:"5月",5:"6月",6:"7月",7:"8月",8:"9月",9:"10月",10:"11月",11:"12月"},SHORTDAY:{0:"周日",1:"周一",2:"周二",3:"周三",4:"周四",5:"周五",6:"周六"},fullDate:"y年M月d日EEEE",longDate:"y年M月d日",medium:"yyyy-M-d H:mm:ss",mediumDate:"yyyy-M-d",mediumTime:"H:mm:ss","short":"yy-M-d ah:mm",shortDate:"yy-M-d",shortTime:"ah:mm"};c.SHORTMONTH=c.MONTH,ka.date.locate=c};var Aa,Ma=avalon.modules={"domReady!":{exports:avalon,state:3},avalon:{exports:avalon,state:4}},Oa=e.require,Na=e.define;Qt.loader=function(t){var n=Aa&&t;e.require=n?Aa:Oa,e.define=n?Aa.define:Na},Ma.exports=Ma.avalon,new function(){function t(e,t){var a="js";e=e.replace(/^(\w+)\!/,function(e,t){return a=t,""}),"ready"===a&&(n("debug: ready!已经被废弃,请使用domReady!"),a="domReady");var r="";e=e.replace(D,function(e){return r=e,""});var i="."+a,o=/js|css/.test(i)?i:"";e=e.replace(/\.[a-z0-9]+$/g,function(e){return e===i?(o=e,""):e});var l=avalon.mix({query:r,ext:o,res:a,name:e,toUrl:m},t);return l.toUrl(e),l}function o(e){var t=e.name,n=e.res,a=Ma[t],r=t&&e.urlNoQuery;if(a&&a.state>=1)return t;if(a=Ma[r],a&&a.state>=3)return Aa(a.deps||[],a.factory,r),r;if(t&&!a){a=Ma[r]={id:r,state:1};var i=function(r){H[n]=r,r.load(t,e,function(e){arguments.length&&void 0!==e&&(a.exports=e),a.state=4,c()})};H[n]?i(H[n]):Aa([n],i)}return t?r:n+"!"}function l(e,t){for(var n,a=0;n=e[a++];)if(4!==Ma[n].state&&(n===t||l(Ma[n].deps,t)))return!0}function s(e,t){var a=d(e.src);return e.onload=e.onerror=null,t?(setTimeout(function(){bt.removeChild(e),e=null}),void n("debug: 加载 "+a+" 失败"+t+" "+!Ma[a].state)):!0}function c(){e:for(var e,t=E.length;e=E[--t];){var n=Ma[e],a=n.deps;if(a){for(var r,i=0;r=a[i];i++)if(4!==Object(Ma[r]).state)continue e;4!==n.state&&(E.splice(t,1),h(n.id,n.deps,n.factory),c())}}}function f(e,t,a){var r=yt.createElement("script");r.className=xt,r.onload=function(){var r=k.pop();r&&r.require(t),a&&a(),n("debug: 已成功加载 "+e),t&&E.push(t),c()},r.onerror=function(){s(r,!0)},bt.insertBefore(r,bt.firstChild),r.src=e,n("debug: 正准备加载 "+e)}function d(e){return(e||"").replace(D,"")}function v(e){return/^(?:[a-z]+:)?\/\//i.test(String(e))}function p(){var e;try{a.b.c()}catch(t){e=t.stack}if(e)return e=e.split(/[@ ]/g).pop(),e="("===e[0]?e.slice(1,-1):e.replace(/\s/,""),d(e.replace(/(:\d+)?:\d+$/i,""));for(var n,r=bt.getElementsByTagName("script"),i=r.length;n=r[--i];)if(n.className===xt&&"interactive"===n.readyState){var o=n.src;return n.className=d(o)}}function h(t,a,i){var o=Object(Ma[t]);o.state=4;for(var l,s=0,c=[];l=a[s++];)if("exports"===l){var u=o.exports||(o.exports=r());c.push(u)}else c.push(Ma[l].exports);try{var f=i.apply(e,c)}catch(d){n("执行["+t+"]模块的factory抛错: ",d)}return void 0!==f&&(o.exports=f),P.test(t)&&delete Ma[t],delete o.factory,f}function m(e){0===e.indexOf(this.res+"!")&&(e=e.slice(this.res.length+1));var t=e,n=0,a=this.baseUrl,r=this.parentUrl||a;x(e,u.paths,function(e,a){t=t.replace(a,e),n=1}),n||x(e,u.packages,function(e,n,a){t=t.replace(a.name,a.location)}),this.mapUrl&&x(this.mapUrl,u.map,function(e){x(t,e,function(e,n){t=t.replace(n,e),r=a})});var i=this.ext;i&&n&&t.slice(-i.length)===i&&(t=t.slice(0,-i.length)),v(t)||(r=this.built||/^\w/.test(t)?a:r,t=T(r,t));var o=t+i;return t=o+this.query,o=t.replace(D,function(e){return this.query=e,""}),x(e,u.urlArgs,function(e){t+=(-1===t.indexOf("?")?"?":"&")+e}),this.url=t,this.urlNoQuery=o}function g(e,t,n){var a=w(e,t,n);return a.sort($),a}function y(e){return new RegExp("^"+e+"(/|$)")}function b(t){return function(){var n;return t.init&&(n=t.init.apply(e,arguments)),n||t.exports&&C(t.exports)}}function w(e,t,n){var a=[];for(var r in e){var i={name:r,val:e[r]};a.push(i),i.reg="*"===r&&t?/^/:y(r),n&&"*"!==r&&(i.reg=new RegExp("/"+r.replace(/^\//,"")+"(/|$)"))}return a}function x(e,t,n){t=t||[];for(var a,r=0;a=t[r++];)if(a.reg.test(e))return n(a.val,a.name,a),!1}function $(e,t){var n=e.name,a=t.name;return"*"===a?-1:"*"===n?1:a.length-n.length}function T(e,t){if("/"!==e.charAt(e.length-1)&&(e+="/"),"./"===t.slice(0,2))return e+t.slice(2);if(".."===t.slice(0,2)){for(e+=t;R.test(e);)e=e.replace(R,"");return e}return"/"===t.slice(0,1)?e+t.slice(1):e+t}function C(t){if(!t)return t;var n=e;return t.split(".").forEach(function(e){n=n[e]}),n}var E=[],k=[],A=/\.js$/i,M=[],O=!1;Aa=avalon.require=function(e,n,a,l){if(O){Array.isArray(e)||avalon.error("require方法的第一个参数应为数组 "+e);var s=[],f=r(),d=a||"callback"+setTimeout("1");l=l||r(),l.baseUrl=u.baseUrl;var v=!!l.built;if(a&&(l.parentUrl=a.substr(0,a.lastIndexOf("/")),l.mapUrl=a.replace(A,"")),v){var p=t(l.defineName,l);d=p.urlNoQuery}else e.forEach(function(e){var n=t(e,l),a=o(n);a&&(f[a]||(s.push(a),f[a]="司徒正美"))});var h=Ma[d];h&&4===h.state||(Ma[d]={id:d,deps:v?e.concat():s,factory:n||i,state:3}),h||E.push(d),c()}else if(M.push(avalon.slice(arguments)),arguments.length<=2){O=!0;for(var m,g=M.splice(0,M.length);m=g.shift();)Aa.apply(null,m)}},Aa.define=function(e,t,n){"string"!=typeof e&&(n=t,t=e,e="anonymous"),Array.isArray(t)||(n=t,t=[]);var a={built:!O,defineName:e},r=[t,n,a];n.require=function(e){if(r.splice(2,0,e),Ma[e]){Ma[e].state=3;var t=!1;try{t=l(Ma[e].deps,e)}catch(a){}t&&avalon.error(e+"模块与之前的模块存在循环依赖,请不要直接用script标签引入"+e+"模块")}delete n.require,Aa.apply(null,r)};var i=a.built?"unknown":p();if(i){var o=Ma[i];o&&(o.state=2),n.require(i)}else k.push(n)},Aa.config=u,Aa.define.amd=Ma;var N=u["orig.paths"]=r(),S=u["orig.map"]=r(),j=u.packages=[],L=u["orig.args"]=r();avalon.mix(Qt,{paths:function(e){avalon.mix(N,e),u.paths=g(N)},map:function(e){avalon.mix(S,e);var t=g(S,1,1);avalon.each(t,function(e,t){t.val=g(t.val)}),u.map=t},packages:function(e){e=e.concat(j);for(var t,n=r(),a=[],i=0;t=e[i++];){t="string"==typeof t?{name:t}:t;var o=t.name;if(!n[o]){var l=T(t.location||o,t.main||"main");l=l.replace(A,""),a.push(t),n[o]=t.location=l,t.reg=y(o)}}u.packages=a.sort()},urlArgs:function(e){"string"==typeof e&&(e={"*":e}),avalon.mix(L,e),u.urlArgs=g(L,1)},baseUrl:function(e){if(!v(e)){var t=bt.getElementsByTagName("base")[0];t&&bt.removeChild(t);var n=yt.createElement("a");n.href=e,e=n.href,t&&bt.insertBefore(t,bt.firstChild)}e.length>3&&(u.baseUrl=e)},shim:function(e){for(var t in e){var n=e[t];Array.isArray(n)&&(n=e[t]={deps:n}),n.exportsFn||!n.exports&&!n.init||(n.exportsFn=b(n))}u.shim=e}});var H=Aa.plugins={ready:{load:i},js:{load:function(e,t,n){var a=t.url,r=t.urlNoQuery,i=u.shim[e.replace(A,"")];i?Aa(i.deps||[],function(){var e=avalon.slice(arguments);f(a,r,function(){n(i.exportsFn?i.exportsFn.apply(0,e):void 0)})}):f(a,r)}},css:{load:function(e,t,a){var r=t.url;bt.insertAdjacentHTML("afterBegin",'<link rel="stylesheet" href="'+r+'">'),n("debug: 已成功加载 "+r),a()}},text:{load:function(e,t,a){var r=t.url,i=ca();i.onload=function(){var e=i.status;e>399&&600>e?avalon.error(r+" 对应资源不存在或没有开启 CORS"):(n("debug: 已成功加载 "+r),a(i.responseText))};var o="_="+(new Date-0),l=-1===r.indexOf("?")?r+"?"+o:r+"&"+o;i.open("GET",l,!0),"withCredentials"in i&&(i.withCredentials=!0),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(),n("debug: 正准备加载 "+r)}}};Aa.checkDeps=c;var D=/(\?[^#]*)$/,P=/^callback\d+$/,R=/\/\w+\/\.\./,I=yt.scripts[yt.scripts.length-1],_=I.getAttribute("data-main");if(_){Qt.baseUrl(_);var B=u.baseUrl;u.baseUrl=B.slice(0,B.lastIndexOf("/")+1),f(B.replace(A,"")+".js")}else{var F=d(I.src);u.baseUrl=F.slice(0,F.lastIndexOf("/")+1)}};var Sa,ja=[],La=function(e){Sa=!0;var t=avalon.require;for(t&&t.checkDeps&&(Ma["domReady!"].state=4,t.checkDeps());e=ja.shift();)e(avalon)};"complete"===yt.readyState?setTimeout(La):yt.addEventListener("DOMContentLoaded",La),e.addEventListener("load",La),avalon.ready=function(e){Sa?e(avalon):ja.push(e)},avalon.config({loader:!0}),avalon.ready(function(){avalon.scan(yt.body)}),new function(){function t(){return/iPad|iPhone|iPod/i.test(a)&&!e.MSStream?"backdropFilter"in document.documentElement.style?9:e.indexedDB?8:e.SpeechSynthesisUtterance?7:e.webkitAudioContext?6:e.matchMedia?5:e.history&&"pushState"in e.history?4:3:0/0}function n(e,t){return t&&s.forEach(function(n){e[n]=t[n]}),e}var a=navigator.userAgent.toLowerCase(),r=a.indexOf("android")>0,o=t(),l=avalon.gestureHooks={pointers:{},start:function(e,t){for(var a=0;a<e.changedTouches.length;a++){var r=e.changedTouches[a],i={startTouch:n({},r),startTime:Date.now(),status:"tapping",element:e.target};l.pointers[r.identifier]=i,t(i,r)}},move:function(e,t){for(var a=0;a<e.changedTouches.length;a++){var r=e.changedTouches[a],i=l.pointers[r.identifier];if(!i)return;"lastTouch"in i||(i.lastTouch=i.startTouch,i.lastTime=i.startTime,i.deltaX=i.deltaY=i.duration=i.distance=0);var o=Date.now()-i.lastTime;if(o>0){var s=70;o>s&&(o=s),i.duration+o>s&&(i.duration=s-o),i.duration+=o,i.lastTouch=n({},r),i.lastTime=Date.now(),i.deltaX=r.clientX-i.startTouch.clientX,i.deltaY=r.clientY-i.startTouch.clientY;
|
3
|
-
var c=i.deltaX*i.deltaX,u=i.deltaY*i.deltaY;i.distance=Math.sqrt(c+u),i.isVertical=u>c,t(i,r)}}},end:function(e,t){for(var n=0;n<e.changedTouches.length;n++){var a=e.changedTouches[n],r=a.identifier,i=l.pointers[r];i&&(t(i,a),delete l.pointers[r])}},fire:function(e,t,n){if(e){var a=document.createEvent("Events");a.initEvent(t,!0,!0),avalon.mix(a,n),e.dispatchEvent(a)}},add:function(e,t){function n(e){t.touchmove(e)}function a(e){t.touchend(e),document.removeEventListener("touchmove",n),document.removeEventListener("touchend",a),document.removeEventListener("touchcancel",r)}function r(e){t.touchcancel(e),document.removeEventListener("touchmove",n),document.removeEventListener("touchend",a),document.removeEventListener("touchcancel",r)}t.events.forEach(function(i){avalon.eventHooks[i]={fn:function(i,o){return i["touch-"+e]||(i["touch-"+e]="1",i.addEventListener("touchstart",function(e){t.touchstart(e),document.addEventListener("touchmove",n),document.addEventListener("touchend",a),document.addEventListener("touchcancel",r)})),o}}})}},s=["screenX","screenY","clientX","clientY","pageX","pageY"],c=!!navigator.pointerEnabled||!!navigator.msPointerEnabled;c&&(Lt.style.msTouchAction=Lt.style.touchAction="none");var u={events:["tap"],touchBoundary:10,tapDelay:200,needClick:function(e){switch(e.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(e.disabled)return!0;break;case"input":if(o&&"file"===e.type||e.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return!1},needFocus:function(e){switch(e.nodeName.toLowerCase()){case"textarea":case"select":return!0;case"input":switch(e.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!e.disabled&&!e.readOnly;default:return!1}},focus:function(e){var t,n=e.type;o&&e.setSelectionRange&&0!==n.indexOf("date")&&"time"!==n&&"month"!==n?(t=e.value.length,e.setSelectionRange(t,t)):e.focus()},findControl:function(e){return void 0!==e.control?e.control:e.htmlFor?document.getElementById(e.htmlFor):e.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},fixTarget:function(t){return 3===t.nodeType?t.parentNode:e.SVGElementInstance&&t instanceof SVGElementInstance?t.correspondingUseElement:t},updateScrollParent:function(e){var t=e.tapScrollParent;if(!t||!t.contains(e)){var n=e;do{if(n.scrollHeight>n.offsetHeight){t=n,e.tapScrollParent=n;break}n=n.parentElement}while(n)}t&&(t.lastScrollTop=t.scrollTop)},touchHasMoved:function(e){var t=e.changedTouches[0],n=u.touchBoundary;return Math.abs(t.pageX-u.touchStartX)>n||Math.abs(t.pageY-u.touchStartY)>n},findType:function(e){return r&&"select"===e.tagName.toLowerCase()?"mousedown":"click"},sendClick:function(t,n){l.fire(t,"tap",{touchEvent:n});var a,r;document.activeElement&&document.activeElement!==t&&document.activeElement.blur(),r=n.changedTouches[0],a=document.createEvent("MouseEvents"),a.initMouseEvent(u.findType(t),!0,!0,e,1,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),a.touchEvent=n,t.dispatchEvent(a)},touchstart:function(t){if(1!==t.targetTouches.length)return!0;var n=u.fixTarget(t.target),a=t.targetTouches[0];if(o){var r=e.getSelection();if(r.rangeCount&&!r.isCollapsed)return!0;var i=a.identifier;if(i&&isFinite(u.lastTouchIdentifier)&&u.lastTouchIdentifier===i)return t.preventDefault(),!1;u.lastTouchIdentifier=i,u.updateScrollParent(n)}u.status="tapping",u.startTime=Date.now(),u.element=n,u.pageX=a.pageX,u.pageY=a.pageY,u.startTime-u.lastTime<u.tapDelay&&t.preventDefault()},touchmove:function(e){return"tapping"!==u.status?!0:void((u.element!==u.fixTarget(e.target)||u.touchHasMoved(e))&&(u.status=u.element=0))},touchend:function(t){var n=u.element,a=Date.now();if(!n||a-u.startTime>u.tapDelay)return!0;u.lastTime=a;var i=u.startTime;if(u.status=u.startTime=0,targetTagName=n.tagName.toLowerCase(),"label"===targetTagName){l.fire(n,"tap",{touchEvent:t});var s=u.findControl(n);s&&(u.focus(n),n=s)}else if(u.needFocus(n))return a-i>100||o&&e.top!==e&&"input"===targetTagName?(u.element=0,!1):(u.focus(n),r&&u.sendClick(n,t),!1);if(o){var c=n.tapScrollParent;if(c&&c.lastScrollTop!==c.scrollTop)return!0}u.needClick(n)||(t.preventDefault(),u.sendClick(n,t))},touchcancel:function(){u.startTime=u.element=0}};l.add("tap",u);var f={events:["longtap","doubletap"],cancelPress:function(e){clearTimeout(e.pressingHandler),e.pressingHandler=null},touchstart:function(e){l.start(e,function(t,n){t.pressingHandler=setTimeout(function(){"tapping"===t.status&&l.fire(e.target,"longtap",{touch:n,touchEvent:e}),f.cancelPress(t)},500),1!==e.changedTouches.length&&(t.status=0)})},touchmove:function(e){l.move(e,function(e){e.distance>10&&e.pressingHandler&&(f.cancelPress(e),"tapping"===e.status&&(e.status="panning"))})},touchend:function(e){l.end(e,function(t,n){f.cancelPress(t),"tapping"===t.status&&(t.lastTime=Date.now(),f.lastTap&&t.lastTime-f.lastTap.lastTime<300&&l.fire(t.element,"doubletap",{touch:n,touchEvent:e}),f.lastTap=t)})},touchcancel:function(e){l.end(e,function(e){f.cancelPress(e)})}};l.add("press",f);var d={events:["swipe","swipeleft","swiperight","swipeup","swipedown"],getAngle:function(e,t){var n=Math.atan2(t,e),a=Math.round(180*n/Math.PI);return 0>a?360-Math.abs(a):a},getDirection:function(e,t){var n=d.getAngle(e,t);return 45>=n&&n>=0?"left":360>=n&&n>=315?"left":n>=135&&225>=n?"right":n>45&&135>n?"down":"up"},touchstart:function(e){l.start(e,i)},touchmove:function(e){l.move(e,i)},touchend:function(e){1===e.changedTouches.length&&l.end(e,function(t,n){var a=t.distance>30&&t.distance/t.duration>.65;if(a){var r={deltaX:t.deltaX,deltaY:t.deltaY,touch:n,touchEvent:e,direction:d.getDirection(t.deltaX,t.deltaY),isVertical:t.isVertical},i=t.element;l.fire(i,"swipe",r),l.fire(i,"swipe"+r.direction,r)}})}};d.touchcancel=d.touchend,l.add("swipe",d)},"function"==typeof define&&define.amd&&define("avalon",[],function(){return avalon});var Ha=e.avalon;return avalon.noConflict=function(t){return t&&e.avalon===avalon&&(e.avalon=Ha),avalon},void 0===t&&(e.avalon=avalon),avalon});
|
1
|
+
!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("Avalon requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(){avalon.config.debug&&console.log.apply(console,arguments)}function r(){return Object.create(null)}function i(e){return Function.apply(o,e)}function o(){}function l(e,t){"string"==typeof e&&(e=e.match(_t)||[]);for(var n={},a=void 0!==t?t:1,r=0,i=e.length;i>r;r++)n[e[r]]=a;return n}function s(){if(e.VBArray){var t=document.documentMode;return t?t:e.XMLHttpRequest?7:6}return 0/0}function c(e){if(e&&"object"==typeof e){var t=e.length,n=zt.call(e);if(/(Array|List|Collection|Map|Arguments)\]$/.test(n))return!0;if("[object Object]"===n&&t===t>>>0)return!0}return!1}function u(e,t){if(e&&e.childNodes)for(var n,a=e.childNodes,r=0;n=a[r++];)if(n.tagName){var i=Pt.createElementNS(sn,n.tagName.toLowerCase());Wt.forEach.call(n.attributes,function(e){i.setAttribute(e.name,e.value)}),u(n,i),t.appendChild(i)}}function f(e){for(var t in e)if(Ut.call(e,t)){var n=e[t];"function"==typeof f.plugins[t]?f.plugins[t](n):"object"==typeof f[t]?avalon.mix(f[t],n):f[t]=n}return this}function d(e){return(e+"").replace(mn,"\\$&")}function p(e,t){var n=this.$events||(this.$events={}),a=n[e]||(n[e]=[]);if("function"==typeof t){var r=t;r.uniqueNumber=Math.random(),t={element:Jt,type:"user-watcher",handler:o,vmodels:[this],expr:e,uniqueNumber:r.uniqueNumber},t.wildcard=/\*/.test(e)}if(t.update)t.oneTime||avalon.Array.ensure(a,t);else{if(/\w\.*\B/.test(e)){t.getter=o;var i=this;t.update=function(){var e=this.fireArgs||[];e[2]&&t.handler.apply(i,e),delete this.fireArgs},a.sync=!0,avalon.Array.ensure(a,t)}else avalon.injectBinding(t);r&&(t.handler=r)}return function(){t.update=t.getter=t.handler=o,t.element=Pt.createElement("a")}}function v(e,t){var n=this.$events;if(n&&n[e]){t&&(t[2]=e);var a=n[e];m(a,t);var r=this.$up;r&&(this.$pathname&&v.call(r,this.$pathname+"."+e,t),v.call(r,"*."+e,t))}else{if(r=this.$up,this.$ups){for(var i in this.$ups)v.call(this.$ups[i],i+"."+e,t);return}if(r){var o=this.$pathname;""===o&&(o="*");var l=o+"."+e;a=l.split("."),-1===a.indexOf("*")?(v.call(r,l,t),a[1]="*",v.call(r,a.join("."),t)):v.call(r,l,t)}}}function h(e,t){for(;;){if(e.$watch){var n=e.$events||(e.$events={}),a=n[t]||(n[t]=[]);return void kn.collectDependency(a)}if(e=e.$up,!e)break;t=e.$pathname+"."+t}}function m(e,t){if(e){new Date-An>444&&"object"==typeof e[0]&&D();for(var n,a=[],r=[],i=0;n=e[i++];)"user-watcher"===n.type?a.push(n):r.push(n);if(f.async){for(ma.render(),i=0;n=r[i++];)if(n.update){var o=S(n);ma.queue[o]||(ma.queue[o]=1,ma.queue.push(n))}}else for(i=0;n=r[i++];)n.update&&n.update();for(i=0;n=a[i++];)(t&&t[2]===n.expr||n.wildcard)&&(n.fireArgs=t),n.update()}}function g(e,t){return t=t||{},t.watch=!0,b(e,t)}function y(){}function b(e,t){function a(e){return u[e]===!0}if(!e||e.$id&&e.$accessors||e.nodeName&&e.nodeType>0)return e;t=t||Ft;var r=t.force||Ft,i=t.old,o=i&&i.$accessors||Ft,s=new y,c={},u={},f=[],d=[],h={};e.$skipArray&&(h=l(e.$skipArray),delete e.$skipArray);var m=e.$computed;if(m){delete e.$computed;for(var g in m)u[g]=!0,function(e,t){var n;c[e]={get:function(){return n=t.get.call(this)},set:function(a){if("function"==typeof t.set){var r=n;t.set.call(this,a);var i=this[e];this.$fire&&i!==r&&this.$fire(e,i,r)}},enumerable:!0,configurable:!0}}(g,m[g])}for(g in e){var b=e[g];bn[g]||(u[g]=!0),"function"==typeof b||b&&b.nodeName&&b.nodeType>0||!r[g]&&("$"===g.charAt(0)||bn[g]||h[g])?f.push(g):$(b)?(n("warning:计算属性建议放在$computed对象中统一定义"),function(e,t){var n;c[e]={get:function(){return n=t.get.call(this)},set:function(a){if("function"==typeof t.set){var r=n;t.set.call(this,a);var i=this[e];this.$fire&&i!==r&&this.$fire(e,i,r)}},enumerable:!0,configurable:!0}}(g,b)):(d.push(g),c[g]=o[g]?o[g]:x(g,b))}c.$model=$n,s=Object.defineProperties(s,c,e),f.forEach(function(t){s[t]=e[t]}),T(s,"$ups",null),T(s,"$id","anonymous"),T(s,"$up",i?i.$up:null),T(s,"$track",Object.keys(u)),T(s,"$active",!1),T(s,"$pathname",i?i.$pathname:""),T(s,"$accessors",c),T(s,"hasOwnProperty",a),t.watch&&(T(s,"$watch",function(){return p.apply(s,arguments)}),T(s,"$fire",function(e,t){if(0===e.indexOf("all!")){var n=e.slice(4);for(var a in avalon.vmodels){var r=avalon.vmodels[a];r.$fire&&r.$fire.apply(r,[n,t])}}else v.call(s,e,[t])})),d.forEach(function(t){var n=i&&i[t],a=s[t]=e[t];a&&"object"==typeof a&&(a.$up=s,a.$pathname=t),v.call(s,t,[a,n])});for(g in m)b=s[g];return s.$active=!0,s}function $(e){if(e&&"object"==typeof e){for(var t in e)if("get"!==t&&"set"!==t)return!1;return"function"==typeof e.get}}function x(e,t){var n,t=0/0;return{get:function(){return this.$active&&h(this,e),t},set:function(a){if(t!==a){var r=t;n=w(a,t),n?t=n:(n=void 0,t=a),Object(n)===n&&(n.$pathname=e,n.$up=this),this.$active&&v.call(this,e,[t,r])}},enumerable:!0,configurable:!0}}function w(e,t,n,a){if(Array.isArray(e))return C(e,t,a);if(avalon.isPlainObject(e)){if(t&&"object"==typeof t){var r=Object.keys(e),i=Object.keys(t);if(r.join(";")===i.join(";")){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);return t}t.$active=!1}return b(e,{old:t,watch:a})}return n?e:void 0}function C(e,t,n){if(t){var a=[0,t.length].concat(e);return t.splice.apply(t,a),t}for(var r in Cn)e[r]=Cn[r];T(e,"$up",null),T(e,"$pathname",""),T(e,"$track",N(e.length)),e._=b({length:0/0},{watch:!0}),e._.length=e.length,e._.$watch("length",function(t,n){v.call(e.$up,e.$pathname+".length",[t,n])}),n&&T(e,"$watch",function(){return p.apply(e,arguments)}),Object.defineProperty(e,"$model",$n);for(var i=0,o=e.length;o>i;i++){var l=e[i]=w(e[i],0,1,1);Object(l)===l&&(l.$up=e)}return e}function T(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})}function k(e){var t=avalon.type(e);if("array"===t){for(var n=[],a=0;a<e.length;a++)n[a]=k(e[a]);return n}if("object"===t){var r={};for(a in e)if(e.hasOwnProperty(a)){var i=e[a];r[a]=i&&i.nodeType?i:k(i)}return r}return e}function E(e,t){for(var n={},a=0,r=t.length;r>a;a++){n[a]=e[a];var i=t[a];i in n?(e[a]=n[i],delete n[i]):e[a]=e[i]}}function N(e){for(var t=[],n=0;e>n;n++)t[n]=en("$proxy$each");return t}function A(e,t,n){switch(t){case"push":case"unshift":n=N(n.length);break;case"splice":if(n.length>2){{n[1],n.length-2}n=[n[0],n[1]].concat(N(n.length-2))}}Array.prototype[t].apply(e,n)}function O(e,t){t.oneTime||e&&avalon.Array.ensure(e,t)&&t.element&&(j(t,e),new Date-An>444&&D())}function M(e,t){for(var n,a=[],r=0;n=e[r++];)a.push(t?n.$id:n.$key);return a.join(";")}function S(e){if(!e.uniqueNumber){var t=e.element;e.uniqueNumber=t?1!==t.nodeType?e.type+"-"+S(t.parentNode)+"-"+ ++En:e.name+"-"+S(t):++En}return e.uniqueNumber}function j(e,t){var n=e.lists||(e.lists=[]),a=S(e);avalon.Array.ensure(n,t),t.$uuid=t.$uuid||en(),Nn[a]||(Nn[a]=1,Nn.push(e))}function D(e){for(var t=Nn.length,n=t,a=[],r={},i={};e=Nn[--t];){var o=e.type;i[o]?i[o]++:(i[o]=1,a.push(o))}var l=!1;if(a.forEach(function(e){On[e]!==i[e]&&(r[e]=1,l=!0)}),t=n,l)for(;e=Nn[--t];)if(null!==e.element){if(r[e.type]&&H(e.element)){Nn.splice(t,1),delete Nn[e.uniqueNumber];for(var s,c=e.lists,u=0;s=c[u++];)avalon.Array.remove(c,s),avalon.Array.remove(s,e);L(e)}}else Nn.splice(t,1);On=i,An=new Date}function L(e){delete Nn[e.uniqueNumber],e.element=null,e.rollback&&e.rollback();for(var t in e)e[t]=null}function H(e){try{{e.parentNode.nodeType}}catch(t){return!0}return e.ifRemove&&!Jt.contains(e.ifRemove)&&qt===e.parentNode?(e.parentNode&&e.parentNode.removeChild(e),!0):e.msRetain?0:1===e.nodeType?!Jt.contains(e):!avalon.contains(Jt,e)}function P(e){return e.replace(/([a-z\d])([A-Z]+)/g,"$1-$2").toLowerCase()}function R(e){return e.indexOf("-")<0&&e.indexOf("_")<0?e:e.replace(/[-_][^-_]/g,function(e){return e.charAt(1).toUpperCase()})}function q(e){try{if("object"==typeof e)return e;e="true"===e?!0:"false"===e?!1:"null"===e?null:+e+""===e?+e:Pn.test(e)?JSON.parse(e):e}catch(t){}return e}function B(e){return e.window&&e.document?e:9===e.nodeType?e.defaultView:!1}function F(e,t){if(e.offsetWidth<=0){var n=getComputedStyle(e,null);if(_n.test(n.display)){var a={node:e};for(var r in Fn)a[r]=n[r],e.style[r]=Fn[r];t.push(a)}var i=e.parentNode;i&&1===i.nodeType&&F(i,t)}}function _(e){var t=e.tagName.toLowerCase();return"input"===t&&/checkbox|radio/.test(e.type)?"checked":t}function I(e,t){var n=[],a=!!t;t=t||0;for(var r="unknown",o="",l=0;l<e.length;l++){var s=e.charAt(l);if("'"===s||'"'===s)"unknown"===r?r=s:r===s&&(r="unknown");else if("\\"===s)("'"===r||'"'===r)&&l++;else if(Yn.test(s))"unknown"===r?(r="variable",o=s):"maybePath"===r?(o=n.pop(),o+="."+s,r="variable"):"variable"===r&&(o+=s);else if(/\w/.test(s))"variable"===r&&(o+=s);else if("."===s)"variable"===r&&o&&(n.push(o),o="",r="maybePath");else if("["===s){if("variable"===r||"maybePath"===r){o&&(n.push(o),o="");var c=n.length,u=n[c-1],f=I(e.slice(l),l);if(f.length)n[c-1]=u+".*",n=f.concat(n);else{var d=e.slice(l+1,f.i);try{var p=i(["return "+d])();n[c-1]=u+"."+p}catch(v){}}r="maybePath",l=f.i}}else if("]"===s){if(a)return n.i=l+t,V(n,o),n}else Un.test(s)&&"\r"!==s&&"\n"!==s?"variable"===r&&(V(n,o)&&(r="maybePath"),o=""):(V(n,o),r="unknown",o="")}return V(n,o),n}function V(e,t){return t&&!Vn[t]?(e.push(t),!0):void 0}function X(e,t,n,a){for(var r,i=[],o=" = "+n+".",l=e.length;r=e[--l];)for(var s,c=r.split("."),u=c[0];s=c.shift();)t.hasOwnProperty(s)&&(i.push(u+o+u),a.observers.push({v:t,p:r}),e.splice(l,1));return i}function Y(e){e=e.trim();var t=Wn.get(e);if(t)return t.concat();for(var n,a=I(e),r={},i=[],o=0;n=a[o++];)r[n]||(r[n]=1,i.push(n));return Wn.put(e,i).concat()}function U(e,t,n){var a=n.filters;"string"==typeof a&&a.trim()&&!n._filters&&(n._filters=W(a.trim()));var r=Y(e),o=new Date-0,l=[],s=[],c=[];n.observers=[];for(var u=0,f=t.length;f>u;u++)if(r.length){var d="vm"+o+"_"+u;s.push(d),c.push(t[u]),l.push.apply(l,X(r,t[u],d,n))}n.args=c;var p=n.type,v=t.map(function(e){return String(e.$id).replace(zn,"$1")})+e+p,h=Gn.get(v);if(h){if("duplex"===p){var m=Gn.get(v+"setter");n.setter=m.apply(m,n.args)}return n.getter=h}if(l.length||l.push("fix"+o),"duplex"===p){var g={};l.forEach(function(e){var t=e.split("=");g[t[0].trim()]=t[1].trim()}),e=e.replace(/[\$\w]+/,function(e){return g[e]?g[e]:e});var y=i(s.concat("'use strict';return function(vvv){"+e+" = vvv\n}\n"));Gn.put(v+"setter",y),n.setter=y.apply(y,n.args)}if("on"===p){-1===e.indexOf("(")?e+=".call(this, $event)":e=e.replace("(",".call(this,"),s.push("$event"),e="\nreturn "+e+";";var b=e.lastIndexOf("\nreturn"),$=e.slice(0,b),x=e.slice(b);e=$+"\n"+x}else e="\nreturn "+e+";";return h=i(s.concat("'use strict';\nvar "+l.join(",\n")+e)),Gn.put(v,h)}function z(e){var t=pn.test(e);if(t){var n=it(e);return 1===n.length?n[0].expr:n.map(function(e){return e.type?"("+e.expr+")":ta(e.expr)}).join(" + ")}return e}function W(e){return e=e.replace(Zn,"").replace(Jn,function(){return"],|"}).replace(Kn,function(e,t){return"["+ta(t)}).replace(Qn,function(){return'"],["'}).replace(ea,function(){return'",'})+"]",i(["return ["+e+"]"])()}function G(e,t,n){var a=setTimeout(function(){var r=e.innerHTML;clearTimeout(a),r===n?t():G(e,t,r)})}function Z(e,t){var n=e.getAttribute("avalonctrl")||t.$id;e.setAttribute("avalonctrl",n),t.$events&&(t.$events.expr=e.tagName+'[avalonctrl="'+n+'"]')}function J(e,t){for(var n,a=0;n=e[a++];)n.vmodels=t,on[n.type].init(n),avalon.injectBinding(n),n.getter&&1===n.element.nodeType&&n.element.removeAttribute(n.name);e.length=0}function K(e,t){return e.priority-t.priority}function Q(e,t,a){var r=!0;if(t.length){for(var i,o=e.attributes,l=[],s={},c=0;i=o[c++];){var u=i.name;if(!s[u]&&(s[u]=1,i.specified&&(a=u.match(oa)))){var f=a[1],d=a[2]||"",p=i.value;if(la[f]?(d=f,f="on"):sa[f]&&(d=f,f="attr",u="ms-"+f+"-"+d,n("warning!请改用"+u+"代替"+i.name+"!")),on[f]){var v=p.replace(ia,""),h=p!==v,m={type:f,param:d,element:e,name:u,expr:v,oneTime:h,priority:(on[f].priority||10*f.charCodeAt(0))+(Number(d.replace(/\D/g,""))||0)};if("html"===f||"text"===f){var g=rt(p).filters;m.expr=m.expr.replace(g,""),m.filters=g.replace(da,function(){return m.type="html",m.group=1,""}).trim()}else if("duplex"===f)var y=u;else if("ms-if-loop"===u)m.priority+=100;else if("ms-attr-value"===u)var b=u;l.push(m)}}}if(l.length){for(l.sort(K),y&&b&&"text"===e.type&&n("warning!一个控件不能同时定义ms-attr-value与"+y),c=0;m=l[c];c++){if(f=m.type,ca.test(f))return J(l.slice(0,c+1),t);r&&(r=!ua.test(f))}J(l,t)}}r&&!na[e.tagName]&&(ra&&ra(e),tt(e,t))}function et(e){for(var t,n=e.attributes,a={},r=0;t=n[r++];)t.specified&&!fa.test(t.name)&&(a[R(t.name)]=q(t.value));return a}function tt(e,t){var n=avalon.slice(e.childNodes);nt(n,t)}function nt(e,t){for(var n,a=0;n=e[a++];)switch(n.nodeType){case 1:var r=n;if(!r.msResolved&&r.parentNode&&1===r.parentNode.nodeType){var i=st(r);if(i){var o=r.localName?r.localName.replace(i+":",""):r.nodeName,l=i+":"+R(o);ga.push({library:i,element:r,fullName:l,widget:o,vmodels:t,name:"widget"}),avalon.components[l]&&avalon.component(l)}}at(n,t),n.msHasEvent&&avalon.fireDom(n,"datasetchanged",{bubble:n.msHasEvent});break;case 3:pn.test(n.nodeValue)&&ot(n,t,a)}}function at(e,t,n){var a=e.getAttribute("ms-skip"),r=e.getAttributeNode("ms-important"),i=e.getAttributeNode("ms-controller");if("string"!=typeof a){if(n=r||i){var o=avalon.vmodels[n.value];if(!o)return;t=n===r?[o]:[o].concat(t),e.removeAttribute(n.name),e.classList.remove(n.name),Z(e,o)}Q(e,t)}}function rt(e){if(e.indexOf("|")>0){var t=e.replace(va,function(e){return Array(e.length+1).join("1")}),n=t.replace(pa,"ᄢ㍄").indexOf("|");if(n>-1)return{type:"text",filters:e.slice(n).trim(),expr:e.slice(0,n)}}return{type:"text",expr:e,filters:""}}function it(e){for(var t,n,a=[],r=0;;){if(n=e.indexOf(fn,r),-1===n)break;if(t=e.slice(r,n),t&&a.push({expr:t}),r=n+fn.length,n=e.indexOf(dn,r),-1===n)break;t=e.slice(r,n),t&&a.push(rt(t,r)),r=n+dn.length}return t=e.slice(r),t&&a.push({expr:t}),a}function ot(e,t,n){var a=[],r=it(e.data);if(r.length){for(var i,o=0;i=r[o++];){var l=Pt.createTextNode(i.expr);i.type&&(i.expr=i.expr.replace(ia,function(){return i.oneTime=!0,""}),i.element=l,i.filters=i.filters.replace(da,function(){return i.type="html",""}),i.pos=1e3*n+o,a.push(i)),Kt.appendChild(l)}e.parentNode.replaceChild(Kt,e),a.length&&J(a,t)}}function lt(e,t){if(t)for(var n,a=0;n=e[a++];)if(n.hasOwnProperty(t)&&"object"==typeof n[t]){var r=n[t];return r.$model||r}return{}}function st(e){if(e.scopeName&&"HTML"!==e.scopeName)return e.scopeName;var t=e.nodeName.toLowerCase(),n=t.indexOf(":");return n>0?t.slice(0,n):void 0}function ct(e){return null==e?"":e}function ut(e,t,n){return t.param.replace(It,function(a){var r=avalon.duplexHooks[a];r&&"function"==typeof r[n]&&(e=r[n](e,t))}),e}function ft(){for(var e=Oa.length-1;e>=0;e--){var t=Oa[e];t()===!1&&Oa.splice(e,1)}Oa.length||clearInterval(Aa)}function dt(e,t){if(!e||1!==e.nodeType)return null;if(t)var n=t.effectName,a=t.effectDriver;else n=e.getAttribute("data-effect-name"),a=e.getAttribute("data-effect-driver");if(!n||!a)return null;var r=Ra.pop()||new ht;return r.el=e,r.driver=a,r.useCss="j"!==a,r.useCss&&(t&&avalon(e).addClass(t.effectClass),r.cssEvent="t"===a?Sa:ja),r.name=n,r.callbacks=avalon.effects[n]||{},r}function pt(e,t){var n=e.getAttribute("data-effect-name");if(n){t.effectName=n,t.effectDriver=e.getAttribute("data-effect-driver");var a=+e.getAttribute("data-effect-stagger");t.effectLeaveStagger=+e.getAttribute("data-effect-leave-stagger")||a,t.effectEnterStagger=+e.getAttribute("data-effect-enter-stagger")||a,t.effectClass=e.className||0/0}}function vt(e){return e.replace(/^[\S]/g,function(e){return e.toUpperCase()})}function ht(){}function mt(e,t){var n=e.callbacks[t+"Class"];return"string"==typeof n?n:"function"==typeof n?n():e.name+"-"+t}function gt(e,t,n){var a=e.callbacks[t];a&&a.call(e,e.el,n)}function yt(e,t,n){var a=e.templateCache&&e.templateCache[t];if(a){for(var r,i=Pt.createDocumentFragment();r=a.firstChild;)i.appendChild(r);return i}return avalon.parseHTML(n)}function bt(e){for(var t=Pt.createDocumentFragment(),n=0,a=e.length;a>n;n++)t.appendChild(e[n]);return t}function $t(e,t,n){for(var a,r=0;a=e[r++];)a.className===n.effectClass&&avalon.effect.apply(a,t,o,o,n)}function xt(e,t,n){return e?setTimeout(t,++n*e):t(),n}function wt(e,t){for(var n=Kt.cloneNode(!1),a=e,r=a.nodeValue,i=t&&Math.max(+t.staggerIndex,0),l=avalon.slice(a.parentNode.childNodes),s=l.indexOf(a);;){var c=l[--s];if(!c||0===String(c.nodeValue).indexOf(r))break;t&&c.className===t.effectClass?(e=c,function(e){t.staggerIndex=xt(t.effectLeaveStagger,function(){avalon.effect.apply(e,0,o,function(){n.appendChild(e)},t)},i)}(c)):n.insertBefore(c,n.firstChild)}return n.appendChild(a),n}function Ct(e,t,n,a,r){var i=e.template.cloneNode(!0),o=avalon.slice(i.childNodes);i.appendChild(n.$anchor),r&&t.appendChild(i);var l=[n].concat(e.vmodels),s={nodes:o,vmodels:l,content:i};a.push(s)}function Tt(e){var t="object"===e.xtype?At:kt,n=t(e),a=n.$anchor||(n.$anchor=e.element.cloneNode(!1));return a.nodeValue=e.signature,n.$outer=e.$outer,n}function kt(e,t){for(var n=e.param||"el",a=0,r=Xa.length;r>a;a++){var i=Xa[a];if(i&&i.hasOwnProperty(n)){Xa.splice(a,1),t=i;break}}return t||(t=Et(n)),t}function Et(e){var t={$outer:{},$index:0,$oldIndex:0,$anchor:null,$first:!1,$last:!1,$remove:avalon.noop};t[e]=0/0;var n={$last:1,$first:1,$index:1};n[e]=1;var a=g(t,{force:n});return a.$id=en("$proxy$each"),a}function Nt(e,t,n){if("array"===n){e.$remove=function(){t.$repeat.removeAt(e.$index)};var a=t.param;e.$watch(a,function(n){var a=e.$index;t.$repeat[a]=n})}else e.$watch("$val",function(n){t.$repeat[e.$key]=n})}function At(){return Ya.pop()||Ot()}function Ot(){var e=g({$key:"",$val:0/0,$index:0,$oldIndex:0,$outer:{},$anchor:null},{force:{$key:1,$val:1,$index:1}});return e.$id=en("$proxy$with"),e}function Mt(e,t,n){var a=e[t];if(a){var r=0===a.$id.indexOf("$proxy$each")?Xa:Ya;a.$outer={};for(var i in a.$events){var o=a.$events[i];Array.isArray(o)&&(o.length=0,i===n?a[n]=0/0:"$val"===i&&(a.$val=0/0))}r.unshift(a)>f.maxRepeatSize&&r.pop(),delete e[t]}}function St(e,t){var n="_"+e;if(!St[n]){var a=Pt.createElement(e);Jt.appendChild(a),t=Zt?getComputedStyle(a,null).display:a.currentStyle.display,Jt.removeChild(a),St[n]=t}return St[n]}function jt(e,t,n,a){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var r=isFinite(+e)?+e:0,i=isFinite(+t)?Math.abs(t):3,o=a||",",l=n||".",s="",c=function(e,t){var n=Math.pow(10,t);return""+(Math.round(e*n)/n).toFixed(t)};return s=(i?c(r,i):""+Math.round(r)).split("."),s[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,o)),(s[1]||"").length<i&&(s[1]=s[1]||"",s[1]+=new Array(i-s[1].length+1).join("0")),s.join(l)}function Dt(){return/iPad|iPhone|iPod/i.test(or)&&!e.MSStream?"backdropFilter"in document.documentElement.style?9:e.indexedDB?8:e.SpeechSynthesisUtterance?7:e.webkitAudioContext?6:e.matchMedia?5:e.history&&"pushState"in e.history?4:3:0/0}function Lt(e,t){return t&&ur.forEach(function(n){e[n]=t[n]}),e}var Ht=Date.now(),Pt=e.document,Rt=Pt.head;Rt.insertAdjacentHTML("afterBegin",'<avalon ms-skip class="avalonHide"><style id="avalonStyle">.avalonHide{ display: none!important }</style></avalon>');var qt=Rt.firstChild,Bt="$"+Ht,Ft={},_t=/[^, ]+/g,It=/\w+/g,Vt=/^\[object SVG\w*Element\]$/,Xt=/^\[object (?:Window|DOMWindow|global)\]$/,Yt=Object.prototype,Ut=Yt.hasOwnProperty,zt=Yt.toString,Wt=Array.prototype,Gt=Wt.slice,Zt=e.dispatchEvent,Jt=Pt.documentElement,Kt=Pt.createDocumentFragment(),Qt=(Pt.createElement("div"),{});"Boolean Number String Function Array Date RegExp Object Error".replace(_t,function(e){Qt["[object "+e+"]"]=e.toLowerCase()});var en=function(e){return e=e||"avalon",String(Math.random()+Math.random()).replace(/\d\.\d{4}/,e)},tn=s();avalon=function(e){return new avalon.init(e)},avalon.nextTick=new function(){function t(){for(var e=r.length,t=0;e>t;t++)r[t]();r=r.slice(e)}var n=e.setImmediate,a=e.MutationObserver;if(n)return n.bind(e);var r=[];if(a){var i=document.createTextNode("avalon");new a(t).observe(i,{characterData:!0});var o=!1;return function(e){r.push(e),o=!o,i.data=o}}return function(e){setTimeout(e,4)}},avalon.init=function(e){this[0]=this.element=e},avalon.fn=avalon.prototype=avalon.init.prototype,avalon.type=function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?Qt[zt.call(e)]||"object":typeof e};var nn=function(e){return"[object Function]"===zt.call(e)};avalon.isFunction=nn,avalon.isWindow=function(e){return Xt.test(zt.call(e))},avalon.isPlainObject=function(e){return"[object Object]"===zt.call(e)&&Object.getPrototypeOf(e)===Yt},avalon.mix=avalon.fn.mix=function(){var e,t,n,a,r,i,o=arguments[0]||{},l=1,s=arguments.length,c=!1;for("boolean"==typeof o&&(c=o,o=arguments[1]||{},l++),"object"==typeof o||nn(o)||(o={}),l===s&&(o=this,l--);s>l;l++)if(null!=(e=arguments[l]))for(t in e)n=o[t],a=e[t],o!==a&&(c&&a&&(avalon.isPlainObject(a)||(r=Array.isArray(a)))?(r?(r=!1,i=n&&Array.isArray(n)?n:[]):i=n&&avalon.isPlainObject(n)?n:{},o[t]=avalon.mix(c,i,a)):void 0!==a&&(o[t]=a));return o},avalon.mix({rword:_t,subscribers:Bt,version:1.55,ui:{},log:n,slice:function(e,t,n){return Gt.call(e,t,n)},noop:o,error:function(e,t){throw new(t||Error)(e)},oneObject:l,range:function(e,t,n){n||(n=1),null==t&&(t=e||0,e=0);for(var a=-1,r=Math.max(0,Math.ceil((t-e)/n)),i=new Array(r);++a<r;)i[a]=e,e+=n;return i},eventHooks:{},bind:function(e,t,n,a){var r=avalon.eventHooks,i=r[t];return"object"==typeof i&&(t=i.type||t,a=i.phase||!!a,n=i.fn?i.fn(e,n):n),e.addEventListener(t,n,a),n},unbind:function(e,t,n,a){var r=avalon.eventHooks,i=r[t],l=n||o;"object"==typeof i&&(t=i.type||t,a=i.phase||!!a),e.removeEventListener(t,l,a)},css:function(e,t,n){e instanceof avalon&&(e=e[0]);var a,r=/[_-]/.test(t)?R(t):t;if(t=avalon.cssName(r)||r,void 0===n||"boolean"==typeof n){a=Rn[r+":get"]||Rn["@:get"],"background"===t&&(t="backgroundColor");var i=a(e,t);return n===!0?parseFloat(i)||0:i}if(""===n)e.style[t]="";else{if(null==n||n!==n)return;isFinite(n)&&!avalon.cssNumber[r]&&(n+="px"),a=Rn[r+":set"]||Rn["@:set"],a(e,t,n)}},each:function(e,t){if(e){var n=0;if(c(e))for(var a=e.length;a>n&&t(n,e[n])!==!1;n++);else for(n in e)if(e.hasOwnProperty(n)&&t(n,e[n])===!1)break}},getWidgetData:function(e,t){var n=avalon(e).data(),a={};for(var r in n)0===r.indexOf(t)&&(a[r.replace(t,"").replace(/\w/,function(e){return e.toLowerCase()})]=n[r]);return a},Array:{ensure:function(e,t){return-1===e.indexOf(t)?e.push(t):void 0},removeAt:function(e,t){return!!e.splice(t,1).length},remove:function(e,t){var n=e.indexOf(t);return~n?avalon.Array.removeAt(e,n):!1}}});var an=avalon.bindingHandlers={},rn=avalon.bindingExecutors={},on=avalon.directives={};avalon.directive=function(e,t){return an[e]=t.init=t.init||o,rn[e]=t.update=t.update||o,on[e]=t};var ln=new function(){function e(e){this.size=0,this.limit=e,this.head=this.tail=void 0,this._keymap={}}var t=e.prototype;return t.put=function(e,t){var n={key:e,value:t};return this._keymap[e]=n,this.tail?(this.tail.newer=n,n.older=this.tail):this.head=n,this.tail=n,this.size===this.limit?this.shift():this.size++,t},t.shift=function(){var e=this.head;e&&(this.head=this.head.newer,this.head.older=e.newer=e.older=this._keymap[e.key]=void 0,delete this._keymap[e.key])},t.get=function(e){var t=this._keymap[e];if(void 0!==t)return t===this.tail?t.value:(t.newer&&(t===this.head&&(this.head=t.newer),t.newer.older=t.older),t.older&&(t.older.newer=t.newer),t.newer=void 0,t.older=this.tail,this.tail&&(this.tail.newer=t),this.tail=t,t.value)},e};if(Pt.contains||(Node.prototype.contains=function(e){return!!(16&this.compareDocumentPosition(e))}),avalon.contains=function(e,t){try{for(;t=t.parentNode;)if(t===e)return!0;return!1}catch(n){return!1}},e.SVGElement){var sn="http://www.w3.org/2000/svg",cn=Pt.createElementNS(sn,"svg");cn.innerHTML='<circle cx="50" cy="50" r="40" fill="red" />',Vt.test(cn.firstChild)||Object.defineProperties(SVGElement.prototype,{outerHTML:{enumerable:!0,configurable:!0,get:function(){return(new XMLSerializer).serializeToString(this)},set:function(e){var t=this.tagName.toLowerCase(),n=this.parentNode,a=avalon.parseHTML(e);if("svg"===t)n.insertBefore(a,this);else{var r=Pt.createDocumentFragment();u(a,r),n.insertBefore(r,this)}n.removeChild(this)}},innerHTML:{enumerable:!0,configurable:!0,get:function(){var e=this.outerHTML,t=new RegExp("<"+this.nodeName+'\\b(?:(["\'])[^"]*?(\\1)|[^>])*>',"i"),n=new RegExp("</"+this.nodeName+">$","i");return e.replace(t,"").replace(n,"")},set:function(e){if(avalon.clearHTML){avalon.clearHTML(this);var t=avalon.parseHTML(e);u(t,this)}}}})}var un=avalon.eventHooks;"onmouseenter"in Jt||avalon.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){un[e]={type:t,fn:function(t,n){return function(a){var r=a.relatedTarget;return r&&(r===t||16&t.compareDocumentPosition(r))?void 0:(delete a.type,a.type=e,n.call(t,a))}}}}),avalon.each({AnimationEvent:"animationend",WebKitAnimationEvent:"webkitAnimationEnd"},function(t,n){e[t]&&!un.animationend&&(un.animationend={type:n})}),void 0===Pt.onmousewheel&&(un.mousewheel={type:"wheel",fn:function(e,t){return function(n){n.wheelDeltaY=n.wheelDelta=n.deltaY>0?-120:120,n.wheelDeltaX=0,Object.defineProperty(n,"type",{value:"mousewheel"}),t.call(e,n)}}});var fn,dn,pn,vn,hn,mn=/[-.*+?^${}()|[\]\/\\]/g,gn={interpolate:function(e){if(fn=e[0],dn=e[1],fn===dn){throw new SyntaxError("openTag!==closeTag")}f.openTag=fn,f.closeTag=dn;var t=d(fn),n=d(dn);pn=new RegExp(t+"(.*?)"+n),vn=new RegExp(t+"(.*?)"+n,"g"),hn=new RegExp(t+".*?"+n+"|\\sms-")}};f.async=!0,f.debug=!0,f.plugins=gn,f.plugins.interpolate(["{{","}}"]),f.paths={},f.shim={},f.maxRepeatSize=100,avalon.config=f;var yn=avalon.vmodels={};avalon.define=function(e){var t=e.$id;t||n("warning: vm必须指定$id");var a=g(e);return a.$id=t,yn[t]=a};var bn=l("$id,$watch,$fire,$events,$model,$skipArray,$active,$pathname,$up,$ups,$track,$accessors"),$n={get:function(){return k(this)},set:o,enumerable:!1,configurable:!0},xn=["push","pop","shift","unshift","splice"],wn=Array.prototype,Cn={notify:function(){v.call(this.$up,this.$pathname)},set:function(e,t){if(e>>>0===e&&this[e]!==t){if(e>this.length)throw Error(e+"set方法的第一个参数不能大于原数组长度");v.call(this.$up,this.$pathname+".*",[t,this[e]]),this.splice(e,1,t)}},contains:function(e){return-1!==this.indexOf(e)},ensure:function(e){return this.contains(e)||this.push(e),this},pushArray:function(e){return this.push.apply(this,e)},remove:function(e){return this.removeAt(this.indexOf(e))},removeAt:function(e){return e>>>0===e?this.splice(e,1):[]},size:function(){return this._.length},removeAll:function(e){if(Array.isArray(e))for(var t=this.length-1;t>=0;t--)-1!==e.indexOf(this[t])&&(Tn.call(this.$track,t,1),Tn.call(this,t,1));else if("function"==typeof e)for(t=this.length-1;t>=0;t--){var n=this[t];e(n,t)&&(Tn.call(this.$track,t,1),Tn.call(this,t,1))}else Tn.call(this.$track,0,this.length),Tn.call(this,0,this.length);Zt||(this.$model=k(this)),this.notify(),this._.length=this.length},clear:function(){return this.removeAll()}},Tn=wn.splice;xn.forEach(function(e){var t=wn[e];Cn[e]=function(){for(var n=[],a=0,r=arguments.length;r>a;a++)n[a]=w(arguments[a],0,1,1);var i=t.apply(this,n);return A(this.$track,e,n),Zt||(this.$model=k(this)),this.notify(),this._.length=this.length,i}}),"sort,reverse".replace(_t,function(e){Cn[e]=function(){var t=this.concat(),n=this,a=Math.random(),r=[],i=!1;wn[e].apply(n,arguments);for(var o=0,l=t.length;l>o;o++){var s=n[o],c=t[o];if(s===c)r.push(o);else{var u=t.indexOf(s);r.push(u),t[u]=a,i=!0}}return i&&(E(this.$track,r),Zt||(this.$model=k(this)),this.notify()),this}});var kn=function(){var e,t=[];return{begin:function(n){t.push(e),e=n},end:function(){e=t.pop()},collectDependency:function(t){e&&e.callback(t)}}}();avalon.injectBinding=function(e){e.handler=e.handler||on[e.type].update||o,e.update=function(){var t=!1;e.getter||(t=!0,kn.begin({callback:function(t){O(t,e)}}),e.getter=U(e.expr,e.vmodels,e),e.observers.forEach(function(t){t.v.$watch(t.p,e)}),delete e.observers);try{var a,r,i=e.fireArgs;if(delete e.fireArgs,i?(a=i[0],r=i[1]):a="on"===e.type?e.getter+"":e.getter.apply(0,e.args),r="undefined"==typeof r?e.oldValue:r,e._filters&&(a=Ka.$filter.apply(0,[a].concat(e._filters))),e.signature){var o=avalon.type(a);if("array"!==o&&"object"!==o)throw Error("warning:"+e.expr+"只能是对象或数组");e.xtype=o;var l=M(e.proxies||[],o),s=a.$track||("array"===o?N(a.length):Object.keys(a));e.track=s,l!==s.join(";")&&(e.handler(a,r),e.oldValue=1)}else(Array.isArray(a)?a.length===(r&&r.length):1)?"oldValue"in e&&a===r||(e.handler(a,r),e.oldValue=a):(e.handler(a,r),e.oldValue=a.concat())}catch(c){delete e.getter,n("warning:exception throwed in [avalon.injectBinding] ",c);var u=e.element;u&&3===u.nodeType&&(u.nodeValue=fn+(e.oneTime?"::":"")+e.expr+dn)}finally{t&&kn.end()}},e.update()};var En=0,Nn=avalon.$$subscribers=[],An=new Date,On={},Mn=new function(){avalon.mix(this,{option:Pt.createElement("select"),thead:Pt.createElement("table"),td:Pt.createElement("tr"),area:Pt.createElement("map"),tr:Pt.createElement("tbody"),col:Pt.createElement("colgroup"),legend:Pt.createElement("fieldset"),_default:Pt.createElement("div"),g:Pt.createElementNS("http://www.w3.org/2000/svg","svg")}),this.optgroup=this.option,this.tbody=this.tfoot=this.colgroup=this.caption=this.thead,this.th=this.td};String("circle,defs,ellipse,image,line,path,polygon,polyline,rect,symbol,text,use").replace(_t,function(e){Mn[e]=Mn.g});var Sn=/<([\w:]+)/,jn=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Dn=l(["","text/javascript","text/ecmascript","application/ecmascript","application/javascript"]),Ln=Pt.createElement("script"),Hn=/<|&#?\w+;/;avalon.parseHTML=function(e){var t=Kt.cloneNode(!1);if("string"!=typeof e)return t;if(!Hn.test(e))return t.appendChild(Pt.createTextNode(e)),t;e=e.replace(jn,"<$1></$2>").trim();var n,a=(Sn.exec(e)||["",""])[1].toLowerCase(),r=Mn[a]||Mn._default;r.innerHTML=e;var i=r.getElementsByTagName("script");if(i.length)for(var o,l=0;o=i[l++];)if(Dn[o.type]){var s=Ln.cloneNode(!1);Wt.forEach.call(o.attributes,function(e){s.setAttribute(e.name,e.value)}),s.text=o.text,o.parentNode.replaceChild(s,o)}for(;n=r.firstChild;)t.appendChild(n);return t},avalon.innerHTML=function(e,t){var n=this.parseHTML(t);this.clearHTML(e).appendChild(n)},avalon.clearHTML=function(e){for(e.textContent="";e.firstChild;)e.removeChild(e.firstChild);return e},"add,remove".replace(_t,function(e){avalon.fn[e+"Class"]=function(t){var n=this[0];return t&&"string"==typeof t&&n&&1===n.nodeType&&t.replace(/\S+/g,function(t){n.classList[e](t)}),this}}),avalon.fn.mix({hasClass:function(e){var t=this[0]||{};return 1===t.nodeType&&t.classList.contains(e)},toggleClass:function(e,t){for(var n,a=0,r=String(e).split(/\s+/),i="boolean"==typeof t;n=r[a++];){var o=i?t:!this.hasClass(n);this[o?"addClass":"removeClass"](n)}return this},attr:function(e,t){return 2===arguments.length?(this[0].setAttribute(e,t),this):this[0].getAttribute(e)},data:function(e,t){switch(e="data-"+P(e||""),arguments.length){case 2:return this.attr(e,t),this;case 1:var n=this.attr(e);return q(n);case 0:var a={};return Wt.forEach.call(this[0].attributes,function(t){t&&(e=t.name,e.indexOf("data-")||(e=R(e.slice(5)),a[e]=q(t.value)))}),a}},removeData:function(e){return e="data-"+P(e),this[0].removeAttribute(e),this},css:function(e,t){if(avalon.isPlainObject(e))for(var n in e)avalon.css(this,n,e[n]);else var a=avalon.css(this,e,t);return void 0!==a?a:this},position:function(){var e,t,n=this[0],a={top:0,left:0};if(n)return"fixed"===this.css("position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),"HTML"!==e[0].tagName&&(a=e.offset()),a.top+=avalon.css(e[0],"borderTopWidth",!0),a.left+=avalon.css(e[0],"borderLeftWidth",!0),a.top-=e.scrollTop(),a.left-=e.scrollLeft()),{top:t.top-a.top-avalon.css(n,"marginTop",!0),left:t.left-a.left-avalon.css(n,"marginLeft",!0)}},offsetParent:function(){for(var e=this[0].offsetParent;e&&"static"===avalon.css(e,"position");)e=e.offsetParent;
|
2
|
+
return avalon(e||Jt)},bind:function(e,t,n){return this[0]?avalon.bind(this[0],e,t,n):void 0},unbind:function(e,t,n){return this[0]&&avalon.unbind(this[0],e,t,n),this},val:function(e){var t=this[0];if(t&&1===t.nodeType){var n=0===arguments.length,a=n?":get":":set",r=In[_(t)+a];if(r)var i=r(t,e);else{if(n)return(t.value||"").replace(/\r/g,"");t.value=e}}return n?i:this}}),Jt.dataset&&(avalon.fn.data=function(e,t){e=e&&R(e);var n=this[0].dataset;switch(arguments.length){case 2:return n[e]=t,this;case 1:return t=n[e],q(t);case 0:var a=r();for(e in n)a[e]=q(n[e]);return a}});var Pn=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/;avalon.parseJSON=JSON.parse,avalon.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){avalon.fn[e]=function(n){var a=this[0]||{},r=B(a),i="scrollTop"===e;return arguments.length?void(r?r.scrollTo(i?r[t]:n,i?n:r[t]):a[e]=n):r?r[t]:a[e]}});var Rn=avalon.cssHooks=r(),qn=["","-webkit-","-moz-","-ms-"],Bn={"float":"cssFloat"};avalon.cssNumber=l("animationIterationCount,animationIterationCount,columnCount,order,flex,flexGrow,flexShrink,fillOpacity,fontWeight,lineHeight,opacity,orphans,widows,zIndex,zoom"),avalon.cssName=function(e,t,n){if(Bn[e])return Bn[e];t=t||Jt.style;for(var a=0,r=qn.length;r>a;a++)if(n=R(qn[a]+e),n in t)return Bn[e]=n;return null},Rn["@:set"]=function(e,t,n){e.style[t]=n},Rn["@:get"]=function(e,t){if(!e||!e.style)throw new Error("getComputedStyle要求传入一个节点 "+e);var n,a=getComputedStyle(e);return a&&(n="filter"===t?a.getPropertyValue(t):a[t],""===n&&(n=e.style[t])),n},Rn["opacity:get"]=function(e){var t=Rn["@:get"](e,"opacity");return""===t?"1":t},"top,left".replace(_t,function(e){Rn[e+":get"]=function(t){var n=Rn["@:get"](t,e);return/px$/.test(n)?n:avalon(t).position()[e]+"px"}});var Fn={position:"absolute",visibility:"hidden",display:"block"},_n=/^(none|table(?!-c[ea]).+)/;"Width,Height".replace(_t,function(e){var t=e.toLowerCase(),n="client"+e,a="scroll"+e,r="offset"+e;Rn[t+":get"]=function(t,n,a){var i=-4;"number"==typeof a&&(i=a),n="Width"===e?["Left","Right"]:["Top","Bottom"];var o=t[r];return 2===i?o+avalon.css(t,"margin"+n[0],!0)+avalon.css(t,"margin"+n[1],!0):(0>i&&(o=o-avalon.css(t,"border"+n[0]+"Width",!0)-avalon.css(t,"border"+n[1]+"Width",!0)),-4===i&&(o=o-avalon.css(t,"padding"+n[0],!0)-avalon.css(t,"padding"+n[1],!0)),o)},Rn[t+"&get"]=function(e){var n=[];F(e,n);for(var a,r=Rn[t+":get"](e),i=0;a=n[i++];){e=a.node;for(var o in a)"string"==typeof a[o]&&(e.style[o]=a[o])}return r},avalon.fn[t]=function(i){var o=this[0];if(0===arguments.length){if(o.setTimeout)return o["inner"+e];if(9===o.nodeType){var l=o.documentElement;return Math.max(o.body[a],l[a],o.body[r],l[r],l[n])}return Rn[t+"&get"](o)}return this.css(t,i)},avalon.fn["inner"+e]=function(){return Rn[t+":get"](this[0],void 0,-2)},avalon.fn["outer"+e]=function(e){return Rn[t+":get"](this[0],void 0,e===!0?2:0)}}),avalon.fn.offset=function(){var e=this[0];try{var t=e.getBoundingClientRect();if(t.width||t.height||e.getClientRects().length){var n=e.ownerDocument,a=n.documentElement,r=n.defaultView;return{top:t.top+r.pageYOffset-a.clientTop,left:t.left+r.pageXOffset-a.clientLeft}}}catch(i){return{left:0,top:0}}};var In={"select:get":function(e,t){for(var n,a=e.options,r=e.selectedIndex,i="select-one"===e.type||0>r,o=i?null:[],l=i?r+1:a.length,s=0>r?l:i?r:0;l>s;s++)if(n=a[s],(n.selected||s===r)&&!n.disabled){if(t=n.value,i)return t;o.push(t)}return o},"select:set":function(e,t,n){t=[].concat(t);for(var a,r=0;a=e.options[r++];)(a.selected=t.indexOf(a.value)>-1)&&(n=!0);n||(e.selectedIndex=-1)}},Vn={},Xn=["break,case,catch,continue,debugger,default,delete,do,else,false","finally,for,function,if,in,instanceof,new,null,return,switch,this","throw,true,try,typeof,var,void,while,with","abstract,boolean,byte,char,class,const,double,enum,export,extends","final,float,goto,implements,import,int,interface,long,native","package,private,protected,public,short,static,super,synchronized","throws,transient,volatile","arguments,let,yield,undefined"].join(",");Xn.replace(/\w+/g,function(e){Vn[e]=!0});var Yn=/[a-z_$]/i,Un=/[\s\uFEFF\xA0]/,zn=/(\$proxy\$[a-z]+)\d+$/,Wn=new ln(218),Gn=new ln(128);avalon.normalizeExpr=z,avalon.parseExprProxy=U;var Zn=/\)\s*$/,Jn=/\)\s*\|/g,Kn=/\|\s*([$\w]+)/g,Qn=/"\s*\["/g,ea=/"\s*\(/g,ta=JSON.stringify;avalon.scan=function(e,t){e=e||Jt;var n=t?[].concat(t):[];at(e,n)};var na=l("area,base,basefont,br,col,command,embed,hr,img,input,link,meta,param,source,track,wbr,noscript,script,style,textarea".toUpperCase()),aa=function(e,t,n){var a=e.getAttribute(t);if(a)for(var r,i=0;r=n[i++];)if(r.hasOwnProperty(a)&&"function"==typeof r[a])return r[a]},ra=tn&&e.MutationObserver?function(e){for(var t,n=e.firstChild;n;){var a=n.nextSibling;3===n.nodeType?t?(t.nodeValue+=n.nodeValue,e.removeChild(n)):t=n:t=null,n=a}}:0,ia=/^\s*::/,oa=/ms-(\w+)-?(.*)/,la=l("animationend,blur,change,input,click,dblclick,focus,keydown,keypress,keyup,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,mouseup,scan,scroll,submit"),sa=l("value,title,alt,checked,selected,disabled,readonly,enabled,href,src"),ca=/^if|widget|repeat$/,ua=/^each|with|html|include$/,fa=/^(ms-\S+|data-\S+|on[a-z]+|id|style|class|tabindex)$/,da=/\|\s*html(?:\b|$)/,pa=/\|\|/g,va=/(['"])(\\\1|.)+?\1/g,ha=function(){this.queue=[]};ha.prototype={render:function(e){if(!this.locked){this.locked=e?Jt.offsetHeight+10:1;var t=this;avalon.nextTick(function(){t.flush()})}},flush:function(){for(var e,t=0;e=this.queue[t++];)e.update&&e.update();this.locked=0,this.queue=[]}};var ma=new ha,ga=[],ya=[],ba={$construct:function(){return avalon.mix.apply(null,arguments)},$ready:o,$init:o,$dispose:o,$container:null,$childReady:o,$replace:!1,$extend:null,$$template:function(e){return e}};avalon.components={},avalon.component=function(t,n){n&&(avalon.components[t]=avalon.mix({},ba,n));for(var a,r=0;a=ga[r];r++)t===a.fullName&&(ga.splice(r,1),r--,function(n,a,r,i){var o=1,l=n.library,s=avalon.libraries[l]||ba,c=et(r),u=lt(n.vmodels,c.config||n.widget),f=c.$id||c.identifier||en(i);delete c.config,delete c.$id,delete c.identifier;var d={},p=avalon.components[a.$extend];p?(avalon.mix(!0,d,p),d=p.$construct.call(r,d,{},{})):avalon.mix(!0,d,a),d=avalon.components[t].$construct.call(r,d,u,c),d.$refs={},d.$id=f;var v=d.$slot,h=d.$replace,m=d.$container,g=d.$template;delete d.$slot,delete d.$replace,delete d.$container,delete d.$construct;var y=avalon.define(d)||{};r.msResolved=1,y.$init(y,r),s.$init(y,r);for(var b,$,x=r.childNodes,w={},C=0;$=x[C++];){var T=1===$.nodeType&&$.getAttribute("slot")||v;T&&(w[T]?w[T].push($):w[T]=[$])}y.$$template&&(avalon.clearHTML(r),r.innerHTML=y.$$template(g));for(C in w)if(y.hasOwnProperty(C)){var k=w[C];if(k.length){for(var E=Kt.cloneNode(!0),N=0;b=k[N++];)E.appendChild(b);y[C]=E}w[C]=null}w=null;var A=r.firstChild;h&&(A=r.firstChild,r.parentNode.replaceChild(A,r),A.msResolved=1,r=n.element=A),m&&m.appendChild(r),avalon.fireDom(r,"datasetchanged",{library:l,vm:y,childReady:1});var O=0,M=avalon.bind(r,"datasetchanged",function(t){if(t.childReady&&t.library===l&&(o+=t.childReady,y!==t.vm&&(y.$refs[t.vm.$id]=t.vm,-1===t.childReady&&(O++,y.$childReady(y,r,t)),t.stopPropagation())),0===o){var a=setTimeout(function(){clearTimeout(a),y.$ready(y,r,n.vmodels),s.$ready(y,r,n.vmodels)},O?Math.max(17*O,100):17);avalon.unbind(r,"datasetchanged",M),n.rollback=function(){try{y.$dispose(y,r),s.$dispose(y,r)}catch(e){}delete avalon.vmodels[y.$id]},j(n,ya),e.chrome&&r.addEventListener("DOMNodeRemovedFromDocument",function(){setTimeout(D)})}});if(at(r,[y].concat(n.vmodels)),avalon.vmodels[y.$id]=y,r.childNodes.length)var S=setTimeout(function(){clearTimeout(S),avalon.fireDom(r,"datasetchanged",{library:l,vm:y,childReady:-1})},17);else avalon.fireDom(r,"datasetchanged",{library:l,vm:y,childReady:-1})}(a,avalon.components[t],a.element,a.widget))},avalon.fireDom=function(e,t,n){if(Pt.createEvent){var a=Pt.createEvent("Events");a.initEvent(t,!0,!0,n),avalon.mix(a,n),e.dispatchEvent(a)}else Jt.contains(e)&&(a=Pt.createEventObject(),avalon.mix(a,n),e.fireEvent("on"+t,a))},avalon.libraries=[],avalon.library=function(e,t){Pt.namespaces&&Pt.namespaces.add(e,"http://www.w3.org/1999/xhtml"),avalon.libraries[e]=avalon.mix({$init:o,$ready:o,$dispose:o},t||{})},avalon.library("ms");var $a=["autofocus,autoplay,async,allowTransparency,checked,controls","declare,disabled,defer,defaultChecked,defaultSelected","contentEditable,isMap,loop,multiple,noHref,noResize,noShade","open,readOnly,selected"].join(","),xa={};$a.replace(_t,function(e){xa[e.toLowerCase()]=e});var wa={"accept-charset":"acceptCharset","char":"ch",charoff:"chOff","class":"className","for":"htmlFor","http-equiv":"httpEquiv"},Ca=["accessKey,bgColor,cellPadding,cellSpacing,codeBase,codeType,colSpan","dateTime,defaultValue,frameBorder,longDesc,maxLength,marginWidth,marginHeight","rowSpan,tabIndex,useMap,vSpace,valueType,vAlign"].join(",");Ca.replace(_t,function(e){wa[e.toLowerCase()]=e});var Ta=avalon.directive("attr",{init:function(e){if(e.expr=z(e.expr.trim()),"include"===e.type){var t=e.element;pt(t,e),e.includeRendered=aa(t,"data-include-rendered",e.vmodels),e.includeLoaded=aa(t,"data-include-loaded",e.vmodels);var n=e.includeReplace=!!avalon(t).data("includeReplace");avalon(t).data("includeCache")&&(e.templateCache={}),e.start=Pt.createComment("ms-include"),e.end=Pt.createComment("ms-include-end"),n?(e.element=e.end,e._element=t,t.parentNode.insertBefore(e.start,t),t.parentNode.insertBefore(e.end,t.nextSibling)):(t.insertBefore(e.start,t.firstChild),t.appendChild(e.end))}},update:function(t){var n=this.element,a=this.param;if("href"===a||"src"===a){if("string"!=typeof t||Jt.hasAttribute||(t=t.replace(/&/g,"&")),n[a]=t,e.chrome&&"EMBED"===n.tagName){var r=n.parentNode,i=document.createComment("ms-src");r.replaceChild(i,n),r.replaceChild(n,i)}}else{var o=t===!1||null===t||void 0===t;!Zt&&wa[a]&&(a=wa[a]);var l=xa[a];if("boolean"==typeof n[l]&&(n[l]=!!t,t||(o=!0)),o)return n.removeAttribute(a);var s=Vt.test(n)?!1:Pt.namespaces&&isVML(n)?!0:a in n.cloneNode(!1);s?n[a]=t+"":n.setAttribute(a,t)}}});"title,alt,src,value,css,include,href".replace(_t,function(e){on[e]=Ta}),avalon.directive("class",{init:function(e){var t=e.param,a=e.type;if(!t||isFinite(t)?(e.param="",on.effect.init(e)):(n("ms-"+a+'-xxx="yyy"这种用法已经过时,请使用ms-'+a+'="xxx:yyy"'),e.expr="["+ta(t)+","+e.expr+"]",e.oldStyle=t),"hover"===a||"active"===a){if(!e.hasBindEvent){var r=e.element,i=avalon(r),o="mouseenter",l="mouseleave";if("active"===a){r.tabIndex=r.tabIndex||-1,o="mousedown",l="mouseup";var s=i.bind("mouseleave",function(){e.toggleClass&&i.removeClass(e.newClass)})}}var c=i.bind(o,function(){e.toggleClass&&i.addClass(e.newClass)}),u=i.bind(l,function(){e.toggleClass&&i.removeClass(e.newClass)});e.rollback=function(){i.unbind("mouseleave",s),i.unbind(o,c),i.unbind(l,u)},e.hasBindEvent=!0}},update:function(e){var t=this,n=avalon(this.element);t.newClass=e[0],t.toggleClass=!!e[1],t.oldClass&&t.newClass!==t.oldClass&&n.removeClass(t.oldClass),t.oldClass=t.newClass,"class"===t.type&&(t.oldStyle?n.toggleClass(t.oldStyle,!!e[1]):n.toggleClass(t.newClass,t.toggleClass))}}),"hover,active".replace(_t,function(e){on[e]=on["class"]}),avalon.directive("css",{init:on.attr.init,update:function(e){avalon(this.element).css(this.param,e)}}),avalon.directive("data",{priority:100,update:function(e){var t=this.element,n="data-"+this.param;e&&"object"==typeof e?t[n]=e:t.setAttribute(n,String(e))}});{var ka=/^(?:checkbox|radio)$/,Ea=/^(?:radio|checked)$/,Na=/^(file|button|reset|submit|checkbox|radio|range)$/;avalon.directive("duplex",{priority:2e3,init:function(e,t){function a(t){e.changed.call(this,t,e)}function r(){d=!0}function i(){d=!1}var s=e.element,c=e.vmodels;e.changed=aa(s,"data-duplex-changed",c)||o;var u=[],f=l("string,number,boolean,checked");"radio"===s.type&&""===e.param&&(e.param="checked"),e.param.replace(It,function(a){ka.test(s.type)&&Ea.test(a)&&("radio"===a&&n("ms-duplex-radio已经更名为ms-duplex-checked"),a="checked",e.isChecked=!0,e.xtype="radio"),"bool"===a?(a="boolean",n("ms-duplex-bool已经更名为ms-duplex-boolean")):"text"===a&&(a="string",n("ms-duplex-text已经更名为ms-duplex-string")),f[a]&&(t=!0),avalon.Array.ensure(u,a)}),t||u.push("string"),e.param=u.join("-"),e.xtype||(e.xtype="SELECT"===s.tagName?"select":"checkbox"===s.type?"checkbox":"radio"===s.type?"radio":/^change/.test(s.getAttribute("data-duplex-event"))?"change":"input"),e.bound=function(t,n){s.addEventListener(t,n,!1);var a=e.rollback;e.rollback=function(){s.avalonSetter=null,avalon.unbind(s,t,n),a&&a()}};var d=!1,p=function(){var t=s.value;if(!d&&t!==e.oldValue&&null!==e.pipe){var n=e.pipe(t,e,"get");e.setter(n),a.call(s,n)}};switch(e.xtype){case"radio":e.bound("click",function(){var t=e.pipe(s.value,e,"get");e.setter(t),a.call(s,t)});break;case"checkbox":e.bound("change",function(){var t=s.checked?"ensure":"remove",r=e.getter.apply(0,e.vmodels);Array.isArray(r)||(n("ms-duplex应用于checkbox上要对应一个数组"),r=[r]);var i=e.pipe(s.value,e,"get");avalon.Array[t](r,i),a.call(s,r)});break;case"change":e.bound("change",p);break;case"input":tn?e.bound("input",p):(e.bound("input",p),e.bound("compositionstart",r),e.bound("compositionend",i),e.bound("DOMAutoComplete",p));break;case"select":e.bound("change",function(){var t=avalon(s).val();if(t=Array.isArray(t)?t.map(function(t){return e.pipe(t,e,"get")}):e.pipe(t,e,"get"),t+""!==e.oldValue)try{e.setter(t)}catch(a){n(a)}}),e.bound("datasetchanged",function(t){if("selectDuplex"===t.bubble){var n=e._value,r=Array.isArray(n)?n.map(String):n+"";avalon(s).val(r),s.oldValue=r+"",a.call(s,r)}})}"input"!==e.xtype||Na.test(s.type)||("hidden"!==s.type&&(e.bound("focus",function(){s.msFocus=!0}),e.bound("blur",function(){s.msFocus=!1})),s.avalonSetter=p,Ma(function(){if(Jt.contains(s))s.msFocus||e.oldValue===s.value||p();else if(!s.msRetain)return!1}))},update:function(e){var t,n=this.element,a=this;if(!this.init){for(var r in avalon.vmodels){var i=avalon.vmodels[r];i.$fire("avalon-ms-duplex-init",a)}var o=a.pipe||(a.pipe=ut);o(null,a,"init"),this.init=1}switch(this.xtype){case"input":case"change":if(t=this.pipe(e,this,"set"),t!==this.oldValue){var l=!1;if(n.msFocus)try{var s=n.selectionStart,c=n.selectionEnd;if(s===c){var u=s;l=!0}}catch(f){}n.value=this.oldValue=t,l&&(n.selectionStart=n.selectionEnd=u)}break;case"radio":t=a.isChecked?!!e:e+""===n.value,n.checked=t;break;case"checkbox":var d=[].concat(e);t=this.pipe(n.value,this,"get"),n.checked=d.indexOf(t)>-1;break;case"select":a._value=e,n.msHasEvent?avalon.fireDom(n,"datasetchanged",{bubble:n.msHasEvent}):n.msHasEvent="selectDuplex"}"select"!==a.xtype&&a.changed.call(n,t,a)}})}avalon.duplexHooks={checked:{get:function(e,t){return!t.oldValue}},string:{get:function(e){return e},set:ct},"boolean":{get:function(e){return"true"===e},set:ct},number:{get:function(e,t){var n=parseFloat(e);if(-e===-n)return n;var a=/strong|medium|weak/.exec(t.element.getAttribute("data-duplex-number"))||["medium"];switch(a[0]){case"strong":return 0;case"medium":return""===e?"":0;case"weak":return e}},set:ct}};var Aa,Oa=[];avalon.tick=function(e){1===Oa.push(e)&&(Aa=setInterval(ft,60))};var Ma=o;!new function(){function e(e){t[this.tagName].call(this,e),!this.msFocus&&this.avalonSetter&&this.avalonSetter()}try{var t={},n=HTMLInputElement.prototype,a=HTMLTextAreaElement.prototype,r=HTMLInputElement.prototype;Object.getOwnPropertyNames(r),t.INPUT=Object.getOwnPropertyDescriptor(n,"value").set,Object.defineProperty(n,"value",{set:e}),t.TEXTAREA=Object.getOwnPropertyDescriptor(a,"value").set,Object.defineProperty(a,"value",{set:e})}catch(i){Ma=avalon.tick}},avalon.directive("effect",{priority:5,init:function(e){var t,n,a=e.expr,r=a.replace(vn,function(e){return e.replace(/./g,"0")}).indexOf(":");-1===r?(t=a,n=!0):(t=a.slice(0,r),n=a.slice(r+1)),t=pn.test(a)?z(t):ta(t),e.expr="["+t+","+n+"]"},update:function(t){var n=t[0],a=this.element;if(a.getAttribute("data-effect-name")!==n){a.removeAttribute("data-effect-driver");var r=a.style,i=e.getComputedStyle?e.getComputedStyle(a):null,o=!1;if(i&&(Da||La)){var l=r[Ha]||i[Ha];l&&"0s"!==l&&(a.setAttribute("data-effect-driver","t"),o=!0),o||(l=r[Pa]||i[Pa],l&&"0s"!==l&&(a.setAttribute("data-effect-driver","a"),o=!0))}o||avalon.effects[n]&&(a.setAttribute("data-effect-driver","j"),o=!0),o&&a.setAttribute("data-effect-name",n)}}}),avalon.effects={},avalon.effect=function(e,t){avalon.effects[e]=t};var Sa,ja,Da=!1,La=!1,Ha=avalon.cssName("transition-duration"),Pa=avalon.cssName("animation-duration");!new function(){var t,n={TransitionEvent:"transitionend",WebKitTransitionEvent:"webkitTransitionEnd",OTransitionEvent:"oTransitionEnd",otransitionEvent:"otransitionEnd"};for(var a in n){if(e[a]){t=n[a];break}try{{document.createEvent(a)}t=n[a];break}catch(r){}}"string"==typeof t&&(Da=!0,Sa=t),n={AnimationEvent:"animationend",WebKitAnimationEvent:"webkitAnimationEnd"};var i;for(a in n)if(e[a]){i=n[a];break}"string"==typeof i&&(Da=!0,ja=i)};var Ra=[],qa=new ha;ht.prototype={contrustor:ht,enterClass:function(){return mt(this,"enter")},leaveClass:function(){return mt(this,"leave")},actionFun:function(e,t,n){if(!document.hidden){var a=this,r=a.el,i="leave"===e;e=i?"leave":"enter";var o=i?"enter":"leave";gt(a,"abort"+vt(o)),gt(a,"before"+vt(e)),i||t(r);var l=function(o){r.removeEventListener(a.cssEvent,a.cssCallback),i?(t(r),avalon(r).removeClass(a.cssClass)):"a"===a.driver&&avalon(r).removeClass(a.cssClass),o!==!0&&(gt(a,"after"+vt(e)),n&&n(r)),a.dispose()};a.useCss?(a.cssCallback&&a.cssCallback(!0),a.cssClass=mt(a,e),a.cssCallback=l,a.update=function(){r.addEventListener(a.cssEvent,a.cssCallback),i||"t"!==a.driver||avalon(r).removeClass(a.cssClass)},avalon(r).addClass(a.cssClass),qa.render(!0),qa.queue.push(a)):gt(a,e,l)}},enter:function(){this.actionFun.apply(this,["enter"].concat(avalon.slice(arguments)))},leave:function(){this.actionFun.apply(this,["leave"].concat(avalon.slice(arguments)))},dispose:function(){this.update=this.cssCallback=null,Ra.unshift(this)>100&&Ra.pop()}};var Ba=function(e,t){var n=Gt.call(arguments,0);"function"!=typeof n[2]&&n.splice(2,0,o),"function"!=typeof n[3]&&n.splice(3,0,o);var a=n[2],r=n[3],i=n[4],l=dt(e,i);if(!l)return a(),r(),!1;var s=t?"enter":"leave";l[s](a,r)};avalon.mix(avalon.effect,{apply:Ba,append:function(e,t,n,a){return Ba(e,1,function(){t.appendChild(e)},n,a)},before:function(e,t,n,a){return Ba(e,1,function(){t.parentNode.insertBefore(e,t)},n,a)},remove:function(e,t,n,a){return Ba(e,0,function(){e.parentNode===t&&t.removeChild(e)},n,a)}}),avalon.directive("html",{update:function(e){var t=this,n=this.element,a=1!==n.nodeType,r=a?n.parentNode:n;if(r){if(e=null==e?"":e,3===n.nodeType){var i=en("html");r.insertBefore(Pt.createComment(i),n),t.element=Pt.createComment(i+":end"),r.replaceChild(t.element,n),n=t.element}if("object"!=typeof e)var o=avalon.parseHTML(String(e));else if(11===e.nodeType)o=e;else if(1===e.nodeType||e.item){var l=1===e.nodeType?e.childNodes:e.item;for(o=Kt.cloneNode(!0);l[0];)o.appendChild(l[0])}if(l=avalon.slice(o.childNodes),a){for(var s=n.nodeValue.slice(0,-4);;){var c=n.previousSibling;if(!c||8===c.nodeType&&c.nodeValue===s)break;r.removeChild(c)}r.insertBefore(o,n)}else avalon.clearHTML(n).appendChild(o);nt(l,t.vmodels)}}}),avalon.directive("if",{priority:10,update:function(e){function t(){r.getAttribute(a.name)&&(r.removeAttribute(a.name),Q(r,a.vmodels)),a.rollback=null}var n,a=this,r=this.element,i=a.stamp=+new Date,o=function(){i===a.stamp&&(a.recoverNode=null)};a.recoverNode&&a.recoverNode();try{if(!r.parentNode)return;n=r.parentNode}catch(l){return}if(e){if(8===r.nodeType){var s=a.keep,c=avalon.effect.apply(s,1,function(){i===a.stamp&&(r.parentNode.replaceChild(s,r),r=a.element=s,s.getAttribute("_required")&&(r.required=!0,r.removeAttribute("_required")),r.querySelectorAll&&avalon.each(r.querySelectorAll("[_required=true]"),function(e){e.required=!0,e.removeAttribute("_required")}),t())},o);c=c===!1}c||t()}else if(1===r.nodeType){r.required===!0&&(r.required=!1,r.setAttribute("_required","true"));try{avalon.each(r.querySelectorAll(":required"),function(e){r.required=!1,e.setAttribute("_required","true")})}catch(l){}var u=a.element=Pt.createComment("ms-if"),f=r.nextSibling;a.recoverNode=function(){a.recoverNode=null,u.parentNode!==n&&(n.insertBefore(u,f),a.keep=r)},avalon.effect.apply(r,0,function(){a.recoverNode=null,i===a.stamp&&(r.parentNode.replaceChild(u,r),a.keep=r,qt.appendChild(r),a.rollback=function(){r.parentNode===qt&&qt.removeChild(r)})},o)}}});var Fa=function(){return new e.XMLHttpRequest},_a=avalon.templateCache={};avalon.directive("include",{init:on.attr.init,update:function(e){var t=this,a=this.element,r=t.vmodels,i=t.includeRendered,o=t.effectName&&t.effectClass,l=t.templateCache,s=t.includeReplace,c=t.includeLoaded,u=s?a.parentNode:a,f=t._element;t.recoverNodes=t.recoverNodes||avalon.noop;var d=function(n){var d=t._stamp=+new Date;if(c){var p=c.apply(u,[n].concat(r));"string"==typeof p&&(n=p)}i&&G(u,function(){i.call(u)},0/0);var v=t.includeLastID||"_default";t.includeLastID=e;var h=l&&l[v]||Pt.createElement(a.tagName||t._element.tagName);o&&(h.className=o,u.insertBefore(h,t.start)),(l||{})[v]=h;var m=t.recoverNodes();for(m&&u.insertBefore(m,t.end);;){var g=t.start.nextSibling;if(!g||g===h||g===t.end)break;h.appendChild(g)}avalon.effect.remove(h,u,function(){l&&d===t._stamp&&qt.appendChild(h)},t);var y=u,b=avalon.noop,$=avalon.noop,x=yt(t,e,n),w=avalon.slice(x.childNodes);s&&o?(y=f,y.innerHTML="",y.setAttribute("ms-skip","true"),u.insertBefore(y,t.end.nextSibling),b=function(){y.insertBefore(x,null)},$=function(){t.recoverNodes=avalon.noop,d===t._stamp&&(x=bt(w),u.insertBefore(x,t.end),nt(w,r)),y.parentNode===u&&u.removeChild(y)},t.recoverNodes=function(){return t.recoverNodes=avalon.noop,bt(w)}):b=function(){u.insertBefore(x,t.end),nt(w,r)},avalon.effect.apply(y,"enter",b,$)};if("src"===t.param)if("string"==typeof _a[e])avalon.nextTick(function(){d(_a[e])});else if(Array.isArray(_a[e]))_a[e].push(d);else{var p=Fa();p.onload=function(){for(var t,n=p.responseText,a=0;t=_a[e][a++];)t(n);_a[e]=n},p.onerror=function(){n("ms-include load ["+e+"] error")},_a[e]=[d],p.open("GET",e,!0),"withCredentials"in p&&(p.withCredentials=!0),p.setRequestHeader("X-Requested-With","XMLHttpRequest"),p.send(null)}else{var v=e&&1===e.nodeType?e:Pt.getElementById(e);v&&avalon.nextTick(function(){d(v.value||v.innerText||v.innerHTML)})}}});var Ia=/\(([^)]*)\)/,Va=avalon.directive("on",{priority:3e3,init:function(e){var t=e.expr;e.type="on";var n=e.param.replace(/-\d+$/,"");if("function"==typeof Va[n+"Hook"]&&Va[n+"Hook"](e),t.indexOf("(")>0&&t.indexOf(")")>-1){var a=(t.match(Ia)||["",""])[1].trim();(""===a||"$event"===a)&&(t=t.replace(Ia,""))}e.expr=t},update:function(e){var t=this,n=this.element;e=function(e){var n=t.getter||o;return n.apply(this,t.args.concat(e))};var a=t.param.replace(/-\d+$/,"");if("scan"===a)e.call(n,{type:a});else if("function"==typeof t.specialBind)t.specialBind(n,e);else var r=avalon.bind(n,a,e);t.rollback=function(){"function"==typeof t.specialUnbind?t.specialUnbind():avalon.unbind(n,a,r)}}});avalon.directive("repeat",{priority:90,init:function(e){var t=e.type;e.cache={},e.enterCount=0;var n=e.element;if(1===n.nodeType){n.removeAttribute(e.name),pt(n,e),e.param=e.param||"el",e.sortedCallback=aa(n,"data-with-sorted",e.vmodels);var a=aa(n,"data-"+t+"-rendered",e.vmodels),r=en(t),i=Pt.createComment(r+":start"),o=e.element=Pt.createComment(r+":end");if(e.signature=r,e.start=i,e.template=Kt.cloneNode(!1),"repeat"===t){var l=n.parentNode;l.replaceChild(o,n),l.insertBefore(i,o),e.template.appendChild(n)}else{for(;n.firstChild;)e.template.appendChild(n.firstChild);n.appendChild(i),n.appendChild(o),l=n}if(e.element=o,a)var s=avalon.bind(l,"datasetchanged",function(){a.apply(l,l.args),avalon.unbind(l,"datasetchanged",s),l.msRendered=a})}},update:function(e,t){var n=this,a=this.xtype;this.enterCount+=1;var r=!t;if(r){n.$outer={};var i="$key",o="$val";"array"===a&&(i="$first",o="$last");for(var l,s=0;l=n.vmodels[s++];)if(l.hasOwnProperty(i)&&l.hasOwnProperty(o)){n.$outer=l;break}}var c=this.track;if(n.sortedCallback){var u=n.sortedCallback.call($,c);u&&Array.isArray(u)&&(c=u)}var d="move";n.$repeat=e;var p=[],v=r&&Kt.cloneNode(!1),h=[],m=this.param,g=avalon.mix({},this.cache),y=this.element,b=c.length,$=y.parentNode;for(s=0;b>s;s++){var x=c[s],w=g[x];if(w)p.push({}),g[x]=!0;else{if(w=Tt(this),w.$up=null,"array"===a){d="add",w.$id=x;var C=e[s];w[m]=C,Object(C)===C&&(C.$ups=C.$ups||{},C.$ups[m]=w)}else d="append",w.$key=x,w.$val=e[x];this.cache[x]=w;var T=w.$anchor||(w.$anchor=y.cloneNode(!1));T.nodeValue=this.signature,Ct(n,v,w,p,r&&!n.effectDriver),Nt(w,n,a)}1===this.enterCount&&(w.$active=!1,w.$oldIndex=w.$index,w.$active=!0,w.$index=s),"array"===a?(w.$first=0===s,w.$last=s===b-1):w.$val=k(e[x]),h.push(w)}if(this.proxies=h,r&&!n.effectDriver)$.insertBefore(v,y),p.forEach(function(e){nt(e.nodes||[],e.vmodels),e.nodes=e.vmodels=null});else{var E=n.staggerIndex=0;for(x in g)g[x]!==!0&&(d="del",wt(g[x].$anchor,n),Mt(this.cache,x,m),g[x]=null);for(s=0;b>s;s++){w=h[s],x="array"===a?w.$id:w.$key;var N=h[s-1],A=N?N.$anchor:n.start;g[x]?w.$index!==w.$oldIndex&&!function(e,t){E=xt(n.effectEnterStagger,function(){var a=wt(e.$anchor),r=avalon.slice(a.childNodes);$.insertBefore(a,t.nextSibling),$t(r,1,n)},E)}(w,A):!function(e,t){var a=e.nodes,r=e.vmodels;a&&(E=xt(n.effectEnterStagger,function(){$.insertBefore(e.content,t.nextSibling),nt(a,r),$t(a,1,n)},E)),e.nodes=e.vmodels=null}(p[s],A)}}if(!e.$track)for(x in this.cache)Mt(this.cache,x,m);!function(e){$.args=e,$.msRendered&&$.msRendered.apply($,e)}(f.newWatch?arguments:[d]);var O=setTimeout(function(){clearTimeout(O),avalon.fireDom($,"datasetchanged",{bubble:$.msHasEvent})});this.enterCount-=1}}),"with,each".replace(_t,function(e){on[e]=avalon.mix({},on.repeat,{priority:1400})});var Xa=[],Ya=[];avalon.directive("text",{update:function(e){var t=this.element;if(e=null==e?"":e,3===t.nodeType)try{t.data=e}catch(n){}else t.textContent=e}}),avalon.parseDisplay=St,avalon.directive("visible",{init:function(e){pt(e.element,e)},update:function(e){var t,n=this,a=this.element,r=!this.effectName;return this.stamp?(t=this.stamp=+new Date,void(e?avalon.effect.apply(a,1,function(){if(t===n.stamp){var e=a.getAttribute("data-effect-driver")||"a";r&&(a.style.display=n.display||""),("a"===e||"t"===e)&&"none"===avalon(a).css("display")&&(a.style.display=n.display||St(a.nodeName))}}):avalon.effect.apply(a,0,function(){t===n.stamp&&(a.style.display="none")}))):(t=this.stamp=+new Date,void(e?(a.style.display=n.display||"","none"===avalon(a).css("display")&&(a.style.display=n.display=St(a.nodeName))):a.style.display="none"))}});var Ua=/<script[^>]*>([\S\s]*?)<\/script\s*>/gim,za=/\s+(on[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,Wa=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/gi,Ga={a:/\b(href)\=("javascript[^"]*"|'javascript[^']*')/gi,img:/\b(src)\=("javascript[^"]*"|'javascript[^']*')/gi,form:/\b(action)\=("javascript[^"]*"|'javascript[^']*')/gi},Za=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ja=/([^\#-~| |!])/g,Ka=avalon.filters={uppercase:function(e){return e.toUpperCase()},lowercase:function(e){return e.toLowerCase()},truncate:function(e,t,n){return t=t||30,n="string"==typeof n?n:"...",e.length>t?e.slice(0,t-n.length)+n:String(e)},$filter:function(e){for(var t=1,n=arguments.length;n>t;t++){var a=arguments[t],r=avalon.filters[a[0]];if("function"==typeof r){var i=[e].concat(a.slice(1));e=r.apply(null,i)}}return e},camelize:R,sanitize:function(e){return e.replace(Ua,"").replace(Wa,function(e){var t=e.toLowerCase().match(/<(\w+)\s/);if(t){var n=Ga[t[1]];n&&(e=e.replace(n,function(e,t,n){var a=n.charAt(0);return t+"="+a+"javascript:void(0)"+a}))}return e.replace(za," ").replace(/\s+/g," ")})},escape:function(e){return String(e).replace(/&/g,"&").replace(Za,function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1);return"&#"+(1024*(t-55296)+(n-56320)+65536)+";"}).replace(Ja,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")},currency:function(e,t,n){return(t||"¥")+jt(e,isFinite(n)?n:2)},number:jt};!new function(){function e(e){return parseInt(e,10)||0}function t(e,t,n){var a="";for(0>e&&(a="-",e=-e),e=""+e;e.length<t;)e="0"+e;return n&&(e=e.substr(e.length-t)),a+e}function n(e,n,a,r){return function(i){var o=i["get"+e]();return(a>0||o>-a)&&(o+=a),0===o&&-12===a&&(o=12),t(o,n,r)}}function a(e,t){return function(n,a){var r=n["get"+e](),i=(t?"SHORT"+e:e).toUpperCase();return a[i][r]}}function r(e){var n=-1*e.getTimezoneOffset(),a=n>=0?"+":"";return a+=t(Math[n>0?"floor":"ceil"](n/60),2)+t(Math.abs(n%60),2)}function i(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}var o={yyyy:n("FullYear",4),yy:n("FullYear",2,0,!0),y:n("FullYear",1),MMMM:a("Month"),MMM:a("Month",!0),MM:n("Month",2,1),M:n("Month",1,1),dd:n("Date",2),d:n("Date",1),HH:n("Hours",2),H:n("Hours",1),hh:n("Hours",2,-12),h:n("Hours",1,-12),mm:n("Minutes",2),m:n("Minutes",1),ss:n("Seconds",2),s:n("Seconds",1),sss:n("Milliseconds",3),EEEE:a("Day"),EEE:a("Day",!0),a:i,Z:r},l=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,s=/^\/Date\((\d+)\)\/$/;Ka.date=function(t,n){var a,r,i=Ka.date.locate,c="",u=[];if(n=n||"mediumDate",n=i[n]||n,"string"==typeof t)if(/^\d+$/.test(t))t=e(t);else if(s.test(t))t=+RegExp.$1;else{var f=t.trim(),d=[0,0,0,0,0,0,0],p=new Date(0);f=f.replace(/^(\d+)\D(\d+)\D(\d+)/,function(t,n,a,r){var i=4===r.length?[r,n,a]:[n,a,r];return d[0]=e(i[0]),d[1]=e(i[1])-1,d[2]=e(i[2]),""});var v=p.setFullYear,h=p.setHours;f=f.replace(/[T\s](\d+):(\d+):?(\d+)?\.?(\d)?/,function(t,n,a,r,i){return d[3]=e(n),d[4]=e(a),d[5]=e(r),i&&(d[6]=Math.round(1e3*parseFloat("0."+i))),""});var m=0,g=0;f=f.replace(/Z|([+-])(\d\d):?(\d\d)/,function(t,n,a,r){return v=p.setUTCFullYear,h=p.setUTCHours,n&&(m=e(n+a),g=e(n+r)),""}),d[3]-=m,d[4]-=g,v.apply(p,d.slice(0,3)),h.apply(p,d.slice(3)),t=p}if("number"==typeof t&&(t=new Date(t)),"date"===avalon.type(t)){for(;n;)r=l.exec(n),r?(u=u.concat(r.slice(1)),n=u.pop()):(u.push(n),n=null);return u.forEach(function(e){a=o[e],c+=a?a(t,i):e.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),c}};var c={AMPMS:{0:"上午",1:"下午"},DAY:{0:"星期日",1:"星期一",2:"星期二",3:"星期三",4:"星期四",5:"星期五",6:"星期六"},MONTH:{0:"1月",1:"2月",2:"3月",3:"4月",4:"5月",5:"6月",6:"7月",7:"8月",8:"9月",9:"10月",10:"11月",11:"12月"},SHORTDAY:{0:"周日",1:"周一",2:"周二",3:"周三",4:"周四",5:"周五",6:"周六"},fullDate:"y年M月d日EEEE",longDate:"y年M月d日",medium:"yyyy-M-d H:mm:ss",mediumDate:"yyyy-M-d",mediumTime:"H:mm:ss","short":"yy-M-d ah:mm",shortDate:"yy-M-d",shortTime:"ah:mm"};c.SHORTMONTH=c.MONTH,Ka.date.locate=c};var Qa=avalon.modules={"domReady!":{exports:avalon,state:3},avalon:{exports:avalon,state:4}};Qa.exports=Qa.avalon;var er,tr=e.require,nr=e.define;gn.loader=function(t){var n=er&&t;e.require=n?er:tr,e.define=n?er.define:nr},new function(){function t(e,t){var a="js";e=e.replace(/^(\w+)\!/,function(e,t){return a=t,""}),"ready"===a&&(n("debug: ready!已经被废弃,请使用domReady!"),a="domReady");var r="";e=e.replace(H,function(e){return r=e,""});var i="."+a,o=/js|css/.test(i)?i:"";e=e.replace(/\.[a-z0-9]+$/g,function(e){return e===i?(o=e,""):e});var l=avalon.mix({query:r,ext:o,res:a,name:e,toUrl:m},t);return l.toUrl(e),l}function i(e){var t=e.name,n=e.res,a=Qa[t],r=t&&e.urlNoQuery;if(a&&a.state>=1)return t;if(a=Qa[r],a&&a.state>=3)return er(a.deps||[],a.factory,r),r;if(t&&!a){a=Qa[r]={id:r,state:1};var i=function(r){L[n]=r,r.load(t,e,function(e){arguments.length&&void 0!==e&&(a.exports=e),a.state=4,c()})};L[n]?i(L[n]):er([n],i)}return t?r:n+"!"}function l(e,t){for(var n,a=0;n=e[a++];)if(4!==Qa[n].state&&(n===t||l(Qa[n].deps,t)))return!0}function s(e,t){var a=d(e.src);return e.onload=e.onerror=null,t?(setTimeout(function(){Rt.removeChild(e),e=null}),void n("debug: 加载 "+a+" 失败"+t+" "+!Qa[a].state)):!0}function c(){e:for(var e,t=k.length;e=k[--t];){var n=Qa[e],a=n.deps;if(a){for(var r,i=0;r=a[i];i++)if(4!==Object(Qa[r]).state)continue e;4!==n.state&&(k.splice(t,1),h(n.id,n.deps,n.factory),c())
|
3
|
+
}}}function u(e,t,a){var r=Pt.createElement("script");r.className=Bt,r.onload=function(){var r=E.pop();r&&r.require(t),a&&a(),n("debug: 已成功加载 "+e),t&&k.push(t),c()},r.onerror=function(){s(r,!0)},Rt.insertBefore(r,Rt.firstChild),r.src=e,n("debug: 正准备加载 "+e)}function d(e){return(e||"").replace(H,"")}function p(e){return/^(?:[a-z]+:)?\/\//i.test(String(e))}function v(){var e;try{a.b.c()}catch(t){e=t.stack}if(e)return e=e.split(/[@ ]/g).pop(),e="("===e[0]?e.slice(1,-1):e.replace(/\s/,""),d(e.replace(/(:\d+)?:\d+$/i,""));for(var n,r=Rt.getElementsByTagName("script"),i=r.length;n=r[--i];)if(n.className===Bt&&"interactive"===n.readyState){var o=n.src;return n.className=d(o)}}function h(t,a,i){var o=Object(Qa[t]);o.state=4;for(var l,s=0,c=[];l=a[s++];)if("exports"===l){var u=o.exports||(o.exports=r());c.push(u)}else c.push(Qa[l].exports);try{var f=i.apply(e,c)}catch(d){n("执行["+t+"]模块的factory抛错: ",d)}return void 0!==f&&(o.exports=f),P.test(t)&&delete Qa[t],delete o.factory,f}function m(e){0===e.indexOf(this.res+"!")&&(e=e.slice(this.res.length+1));var t=e,n=0,a=this.baseUrl,r=this.parentUrl||a;x(e,f.paths,function(e,a){t=t.replace(a,e),n=1}),n||x(e,f.packages,function(e,n,a){t=t.replace(a.name,a.location)}),this.mapUrl&&x(this.mapUrl,f.map,function(e){x(t,e,function(e,n){t=t.replace(n,e),r=a})});var i=this.ext;i&&n&&t.slice(-i.length)===i&&(t=t.slice(0,-i.length)),p(t)||(r=this.built||/^\w/.test(t)?a:r,t=C(r,t));var o=t+i;return t=o+this.query,o=t.replace(H,function(e){return this.query=e,""}),x(e,f.urlArgs,function(e){t+=(-1===t.indexOf("?")?"?":"&")+e}),this.url=t,this.urlNoQuery=o}function g(e,t,n){var a=$(e,t,n);return a.sort(w),a}function y(e){return new RegExp("^"+e+"(/|$)")}function b(t){return function(){var n;return t.init&&(n=t.init.apply(e,arguments)),n||t.exports&&T(t.exports)}}function $(e,t,n){var a=[];for(var r in e){var i={name:r,val:e[r]};a.push(i),i.reg="*"===r&&t?/^/:y(r),n&&"*"!==r&&(i.reg=new RegExp("/"+r.replace(/^\//,"")+"(/|$)"))}return a}function x(e,t,n){t=t||[];for(var a,r=0;a=t[r++];)if(a.reg.test(e))return n(a.val,a.name,a),!1}function w(e,t){var n=e.name,a=t.name;return"*"===a?-1:"*"===n?1:a.length-n.length}function C(e,t){if("/"!==e.charAt(e.length-1)&&(e+="/"),"./"===t.slice(0,2))return e+t.slice(2);if(".."===t.slice(0,2)){for(e+=t;R.test(e);)e=e.replace(R,"");return e}return"/"===t.slice(0,1)?e+t.slice(1):e+t}function T(t){if(!t)return t;var n=e;return t.split(".").forEach(function(e){n=n[e]}),n}var k=[],E=[],N=/\.js$/i,A=[],O=!1;er=avalon.require=function(e,n,a,l){if(O){Array.isArray(e)||avalon.error("require方法的第一个参数应为数组 "+e);var s=[],u=r(),d=a||"callback"+setTimeout("1");l=l||r(),l.baseUrl=f.baseUrl;var p=!!l.built;if(a&&(l.parentUrl=a.substr(0,a.lastIndexOf("/")),l.mapUrl=a.replace(N,"")),p){var v=t(l.defineName,l);d=v.urlNoQuery}else e.forEach(function(e){var n=t(e,l),a=i(n);a&&(u[a]||(s.push(a),u[a]="司徒正美"))});var h=Qa[d];h&&4===h.state||(Qa[d]={id:d,deps:p?e.concat():s,factory:n||o,state:3}),h||k.push(d),c()}else if(A.push(avalon.slice(arguments)),arguments.length<=2){O=!0;for(var m,g=A.splice(0,A.length);m=g.shift();)er.apply(null,m)}},er.define=function(e,t,n){"string"!=typeof e&&(n=t,t=e,e="anonymous"),Array.isArray(t)||(n=t,t=[]);var a={built:!O,defineName:e},r=[t,n,a];n.require=function(e){if(r.splice(2,0,e),Qa[e]){Qa[e].state=3;var t=!1;try{t=l(Qa[e].deps,e)}catch(a){}t&&avalon.error(e+"模块与之前的模块存在循环依赖,请不要直接用script标签引入"+e+"模块")}delete n.require,er.apply(null,r)};var i=a.built?"unknown":v();if(i){var o=Qa[i];o&&(o.state=2),n.require(i)}else E.push(n)},er.config=f,er.define.amd=Qa;var M=f["orig.paths"]=r(),S=f["orig.map"]=r(),j=f.packages=[],D=f["orig.args"]=r();avalon.mix(gn,{paths:function(e){avalon.mix(M,e),f.paths=g(M)},map:function(e){avalon.mix(S,e);var t=g(S,1,1);avalon.each(t,function(e,t){t.val=g(t.val)}),f.map=t},packages:function(e){e=e.concat(j);for(var t,n=r(),a=[],i=0;t=e[i++];){t="string"==typeof t?{name:t}:t;var o=t.name;if(!n[o]){var l=C(t.location||o,t.main||"main");l=l.replace(N,""),a.push(t),n[o]=t.location=l,t.reg=y(o)}}f.packages=a.sort()},urlArgs:function(e){"string"==typeof e&&(e={"*":e}),avalon.mix(D,e),f.urlArgs=g(D,1)},baseUrl:function(e){if(!p(e)){var t=Rt.getElementsByTagName("base")[0];t&&Rt.removeChild(t);var n=Pt.createElement("a");n.href=e,e=n.href,t&&Rt.insertBefore(t,Rt.firstChild)}e.length>3&&(f.baseUrl=e)},shim:function(e){for(var t in e){var n=e[t];Array.isArray(n)&&(n=e[t]={deps:n}),n.exportsFn||!n.exports&&!n.init||(n.exportsFn=b(n))}f.shim=e}});var L=er.plugins={domReady:{load:o},js:{load:function(e,t,n){var a=t.url,r=t.urlNoQuery,i=f.shim[e.replace(N,"")];i?er(i.deps||[],function(){var e=avalon.slice(arguments);u(a,r,function(){n(i.exportsFn?i.exportsFn.apply(0,e):void 0)})}):u(a,r)}},css:{load:function(e,t,a){var r=t.url;Rt.insertAdjacentHTML("afterBegin",'<link rel="stylesheet" href="'+r+'">'),n("debug: 已成功加载 "+r),a()}},text:{load:function(e,t,a){var r=t.url,i=Fa();i.onload=function(){var e=i.status;e>399&&600>e?avalon.error(r+" 对应资源不存在或没有开启 CORS"):(n("debug: 已成功加载 "+r),a(i.responseText))};var o="_="+(new Date-0),l=-1===r.indexOf("?")?r+"?"+o:r+"&"+o;i.open("GET",l,!0),"withCredentials"in i&&(i.withCredentials=!0),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(),n("debug: 正准备加载 "+r)}}};er.checkDeps=c;var H=/(\?[^#]*)$/,P=/^callback\d+$/,R=/\/\w+\/\.\./,q=Pt.scripts[Pt.scripts.length-1],B=q.getAttribute("data-main");if(B){gn.baseUrl(B);var F=f.baseUrl;f.baseUrl=F.slice(0,F.lastIndexOf("/")+1),u(F.replace(N,"")+".js")}else{var _=d(q.src);f.baseUrl=_.slice(0,_.lastIndexOf("/")+1)}};var ar,rr=[],ir=function(e){ar=!0;var t=avalon.require;for(t&&t.checkDeps&&(Qa["domReady!"].state=4,t.checkDeps());e=rr.shift();)e(avalon)};"complete"===Pt.readyState?setTimeout(ir):Pt.addEventListener("DOMContentLoaded",ir),e.addEventListener("load",ir),avalon.ready=function(e){ar?e(avalon):rr.push(e)},avalon.config({loader:!0}),avalon.ready(function(){avalon.scan(Pt.body)});var or=navigator.userAgent.toLowerCase(),lr=or.indexOf("android")>0,sr=Dt(),cr=avalon.gestureHooks={pointers:{},start:function(e,t){for(var n=0;n<e.changedTouches.length;n++){var a=e.changedTouches[n],r={startTouch:Lt({},a),startTime:Date.now(),status:"tapping",element:e.target};cr.pointers[a.identifier]=r,t(r,a)}},move:function(e,t){for(var n=0;n<e.changedTouches.length;n++){var a=e.changedTouches[n],r=cr.pointers[a.identifier];if(!r)return;"lastTouch"in r||(r.lastTouch=r.startTouch,r.lastTime=r.startTime,r.deltaX=r.deltaY=r.duration=r.distance=0);var i=Date.now()-r.lastTime;if(i>0){var o=70;i>o&&(i=o),r.duration+i>o&&(r.duration=o-i),r.duration+=i,r.lastTouch=Lt({},a),r.lastTime=Date.now(),r.deltaX=a.clientX-r.startTouch.clientX,r.deltaY=a.clientY-r.startTouch.clientY;var l=r.deltaX*r.deltaX,s=r.deltaY*r.deltaY;r.distance=Math.sqrt(l+s),r.isVertical=s>l,t(r,a)}}},end:function(e,t){for(var n=0;n<e.changedTouches.length;n++){var a=e.changedTouches[n],r=a.identifier,i=cr.pointers[r];i&&(t(i,a),delete cr.pointers[r])}},fire:function(e,t,n){if(e){var a=document.createEvent("Events");a.initEvent(t,!0,!0),avalon.mix(a,n),e.dispatchEvent(a)}},add:function(e,t){function n(e){t.touchmove(e)}function a(e){t.touchend(e),document.removeEventListener("touchmove",n),document.removeEventListener("touchend",a),document.removeEventListener("touchcancel",r)}function r(e){t.touchcancel(e),document.removeEventListener("touchmove",n),document.removeEventListener("touchend",a),document.removeEventListener("touchcancel",r)}t.events.forEach(function(i){avalon.eventHooks[i]={fn:function(i,o){return i["touch-"+e]||(i["touch-"+e]="1",i.addEventListener("touchstart",function(e){t.touchstart(e),document.addEventListener("touchmove",n),document.addEventListener("touchend",a),document.addEventListener("touchcancel",r)})),o}}})}},ur=["screenX","screenY","clientX","clientY","pageX","pageY"],fr=!!navigator.pointerEnabled||!!navigator.msPointerEnabled;fr&&(Jt.style.msTouchAction=Jt.style.touchAction="none");var dr={events:["tap"],touchBoundary:10,tapDelay:200,needClick:function(e){switch(e.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(e.disabled)return!0;break;case"input":if(sr&&"file"===e.type||e.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return!1},needFocus:function(e){switch(e.nodeName.toLowerCase()){case"textarea":case"select":return!0;case"input":switch(e.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!e.disabled&&!e.readOnly;default:return!1}},focus:function(e){var t,n=e.type;sr&&e.setSelectionRange&&0!==n.indexOf("date")&&"time"!==n&&"month"!==n?(t=e.value.length,e.setSelectionRange(t,t)):e.focus()},findControl:function(e){return void 0!==e.control?e.control:e.htmlFor?document.getElementById(e.htmlFor):e.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},fixTarget:function(t){return 3===t.nodeType?t.parentNode:e.SVGElementInstance&&t instanceof SVGElementInstance?t.correspondingUseElement:t},updateScrollParent:function(e){var t=e.tapScrollParent;if(!t||!t.contains(e)){var n=e;do{if(n.scrollHeight>n.offsetHeight){t=n,e.tapScrollParent=n;break}n=n.parentElement}while(n)}t&&(t.lastScrollTop=t.scrollTop)},touchHasMoved:function(e){var t=e.changedTouches[0],n=dr.touchBoundary;return Math.abs(t.pageX-dr.touchStartX)>n||Math.abs(t.pageY-dr.touchStartY)>n},findType:function(e){return lr&&"select"===e.tagName.toLowerCase()?"mousedown":"click"},sendClick:function(t,n){cr.fire(t,"tap",{touchEvent:n});var a,r;document.activeElement&&document.activeElement!==t&&document.activeElement.blur(),r=n.changedTouches[0],a=document.createEvent("MouseEvents"),a.initMouseEvent(dr.findType(t),!0,!0,e,1,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),a.touchEvent=n,t.dispatchEvent(a)},touchstart:function(t){if(1!==t.targetTouches.length)return!0;var n=dr.fixTarget(t.target),a=t.targetTouches[0];if(sr){var r=e.getSelection();if(r.rangeCount&&!r.isCollapsed)return!0;var i=a.identifier;if(i&&isFinite(dr.lastTouchIdentifier)&&dr.lastTouchIdentifier===i)return t.preventDefault(),!1;dr.lastTouchIdentifier=i,dr.updateScrollParent(n)}dr.status="tapping",dr.startTime=Date.now(),dr.element=n,dr.pageX=a.pageX,dr.pageY=a.pageY,dr.startTime-dr.lastTime<dr.tapDelay&&t.preventDefault()},touchmove:function(e){return"tapping"!==dr.status?!0:void((dr.element!==dr.fixTarget(e.target)||dr.touchHasMoved(e))&&(dr.status=dr.element=0))},touchend:function(t){var n=dr.element,a=Date.now();if(!n||a-dr.startTime>dr.tapDelay)return!0;dr.lastTime=a;var r=dr.startTime;if(dr.status=dr.startTime=0,targetTagName=n.tagName.toLowerCase(),"label"===targetTagName){cr.fire(n,"tap",{touchEvent:t});var i=dr.findControl(n);i&&(dr.focus(n),n=i)}else if(dr.needFocus(n))return a-r>100||sr&&e.top!==e&&"input"===targetTagName?(dr.element=0,!1):(dr.focus(n),lr&&dr.sendClick(n,t),!1);if(sr){var o=n.tapScrollParent;if(o&&o.lastScrollTop!==o.scrollTop)return!0}dr.needClick(n)||(t.preventDefault(),dr.sendClick(n,t))},touchcancel:function(){dr.startTime=dr.element=0}};cr.add("tap",dr);var pr={events:["longtap","doubletap"],cancelPress:function(e){clearTimeout(e.pressingHandler),e.pressingHandler=null},touchstart:function(e){cr.start(e,function(t,n){t.pressingHandler=setTimeout(function(){"tapping"===t.status&&cr.fire(e.target,"longtap",{touch:n,touchEvent:e}),pr.cancelPress(t)},500),1!==e.changedTouches.length&&(t.status=0)})},touchmove:function(e){cr.move(e,function(e){e.distance>10&&e.pressingHandler&&(pr.cancelPress(e),"tapping"===e.status&&(e.status="panning"))})},touchend:function(e){cr.end(e,function(t,n){pr.cancelPress(t),"tapping"===t.status&&(t.lastTime=Date.now(),pr.lastTap&&t.lastTime-pr.lastTap.lastTime<300&&cr.fire(t.element,"doubletap",{touch:n,touchEvent:e}),pr.lastTap=t)})},touchcancel:function(e){cr.end(e,function(e){pr.cancelPress(e)})}};cr.add("press",pr);var vr={events:["swipe","swipeleft","swiperight","swipeup","swipedown"],getAngle:function(e,t){var n=Math.atan2(t,e),a=Math.round(180*n/Math.PI);return 0>a?360-Math.abs(a):a},getDirection:function(e,t){var n=vr.getAngle(e,t);return 45>=n&&n>=0?"left":360>=n&&n>=315?"left":n>=135&&225>=n?"right":n>45&&135>n?"down":"up"},touchstart:function(e){cr.start(e,o)},touchmove:function(e){cr.move(e,o)},touchend:function(e){1===e.changedTouches.length&&cr.end(e,function(t,n){var a=t.distance>30&&t.distance/t.duration>.65;if(a){var r={deltaX:t.deltaX,deltaY:t.deltaY,touch:n,touchEvent:e,direction:vr.getDirection(t.deltaX,t.deltaY),isVertical:t.isVertical},i=t.element;cr.fire(i,"swipe",r),cr.fire(i,"swipe"+r.direction,r)}})}};vr.touchcancel=vr.touchend,cr.add("swipe",vr),"function"==typeof define&&define.amd&&define("avalon",[],function(){return avalon});var hr=e.avalon;return avalon.noConflict=function(t){return t&&e.avalon===avalon&&(e.avalon=hr),avalon},void 0===t&&(e.avalon=avalon),avalon});
|
@@ -5,7 +5,7 @@
|
|
5
5
|
http://weibo.com/jslouvre/
|
6
6
|
|
7
7
|
Released under the MIT license
|
8
|
-
avalon.mobile.old.js 1.4.7.1 built in 2015.
|
8
|
+
avalon.mobile.old.js 1.4.7.1 built in 2015.10.30
|
9
9
|
support IE8 and other browsers
|
10
10
|
==================================================*/
|
11
11
|
(function(global, factory) {
|
@@ -61,6 +61,7 @@ var ohasOwn = oproto.hasOwnProperty
|
|
61
61
|
var serialize = oproto.toString
|
62
62
|
var ap = Array.prototype
|
63
63
|
var aslice = ap.slice
|
64
|
+
var Registry = {} //将函数曝光到此对象上,方便访问器收集依赖
|
64
65
|
var W3C = window.dispatchEvent
|
65
66
|
var root = DOC.documentElement
|
66
67
|
var avalonFragment = DOC.createDocumentFragment()
|
@@ -2137,30 +2138,30 @@ function camelize(target) {
|
|
2137
2138
|
return target
|
2138
2139
|
}
|
2139
2140
|
//转换为驼峰风格
|
2140
|
-
return target.replace(/[-_][^-_]/g, function
|
2141
|
+
return target.replace(/[-_][^-_]/g, function(match) {
|
2141
2142
|
return match.charAt(1).toUpperCase()
|
2142
2143
|
})
|
2143
2144
|
}
|
2144
2145
|
|
2145
2146
|
var fakeClassListMethods = {
|
2146
|
-
_toString: function
|
2147
|
+
_toString: function() {
|
2147
2148
|
var node = this.node
|
2148
2149
|
var cls = node.className
|
2149
2150
|
var str = typeof cls === "string" ? cls : cls.baseVal
|
2150
2151
|
return str.split(/\s+/).join(" ")
|
2151
2152
|
},
|
2152
|
-
_contains: function
|
2153
|
+
_contains: function(cls) {
|
2153
2154
|
return (" " + this + " ").indexOf(" " + cls + " ") > -1
|
2154
2155
|
},
|
2155
|
-
_add: function
|
2156
|
+
_add: function(cls) {
|
2156
2157
|
if (!this.contains(cls)) {
|
2157
2158
|
this._set(this + " " + cls)
|
2158
2159
|
}
|
2159
2160
|
},
|
2160
|
-
_remove: function
|
2161
|
+
_remove: function(cls) {
|
2161
2162
|
this._set((" " + this + " ").replace(" " + cls + " ", " "))
|
2162
2163
|
},
|
2163
|
-
__set: function
|
2164
|
+
__set: function(cls) {
|
2164
2165
|
cls = cls.trim()
|
2165
2166
|
var node = this.node
|
2166
2167
|
if (rsvg.test(node)) {
|
@@ -2172,181 +2173,180 @@ var fakeClassListMethods = {
|
|
2172
2173
|
} //toggle存在版本差异,因此不使用它
|
2173
2174
|
}
|
2174
2175
|
|
2175
|
-
function fakeClassList(node) {
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2176
|
+
function fakeClassList(node) {
|
2177
|
+
if (!("classList" in node)) {
|
2178
|
+
node.classList = {
|
2179
|
+
node: node
|
2180
|
+
}
|
2181
|
+
for (var k in fakeClassListMethods) {
|
2182
|
+
node.classList[k.slice(1)] = fakeClassListMethods[k]
|
2183
|
+
}
|
2182
2184
|
}
|
2185
|
+
return node.classList
|
2183
2186
|
}
|
2184
|
-
return node.classList
|
2185
|
-
}
|
2186
2187
|
|
2187
2188
|
|
2188
|
-
"add,remove".replace(rword, function
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
|
2193
|
-
|
2194
|
-
|
2195
|
-
|
2196
|
-
|
2197
|
-
return this
|
2198
|
-
}
|
2199
|
-
})
|
2200
|
-
avalon.fn.mix({
|
2201
|
-
hasClass: function (cls) {
|
2202
|
-
var el = this[0] || {}
|
2203
|
-
return el.nodeType === 1 && fakeClassList(el).contains(cls)
|
2204
|
-
},
|
2205
|
-
toggleClass: function (value, stateVal) {
|
2206
|
-
var className, i = 0
|
2207
|
-
var classNames = String(value).split(/\s+/)
|
2208
|
-
var isBool = typeof stateVal === "boolean"
|
2209
|
-
while ((className = classNames[i++])) {
|
2210
|
-
var state = isBool ? stateVal : !this.hasClass(className)
|
2211
|
-
this[state ? "addClass" : "removeClass"](className)
|
2212
|
-
}
|
2213
|
-
return this
|
2214
|
-
},
|
2215
|
-
attr: function (name, value) {
|
2216
|
-
if (arguments.length === 2) {
|
2217
|
-
this[0].setAttribute(name, value)
|
2189
|
+
"add,remove".replace(rword, function(method) {
|
2190
|
+
avalon.fn[method + "Class"] = function(cls) {
|
2191
|
+
var el = this[0]
|
2192
|
+
//https://developer.mozilla.org/zh-CN/docs/Mozilla/Firefox/Releases/26
|
2193
|
+
if (cls && typeof cls === "string" && el && el.nodeType === 1) {
|
2194
|
+
cls.replace(/\S+/g, function(c) {
|
2195
|
+
fakeClassList(el)[method](c)
|
2196
|
+
})
|
2197
|
+
}
|
2218
2198
|
return this
|
2219
|
-
} else {
|
2220
|
-
return this[0].getAttribute(name)
|
2221
2199
|
}
|
2222
|
-
}
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2200
|
+
})
|
2201
|
+
avalon.fn.mix({
|
2202
|
+
hasClass: function(cls) {
|
2203
|
+
var el = this[0] || {}
|
2204
|
+
return el.nodeType === 1 && fakeClassList(el).contains(cls)
|
2205
|
+
},
|
2206
|
+
toggleClass: function(value, stateVal) {
|
2207
|
+
var className, i = 0
|
2208
|
+
var classNames = String(value).split(/\s+/)
|
2209
|
+
var isBool = typeof stateVal === "boolean"
|
2210
|
+
while ((className = classNames[i++])) {
|
2211
|
+
var state = isBool ? stateVal : !this.hasClass(className)
|
2212
|
+
this[state ? "addClass" : "removeClass"](className)
|
2213
|
+
}
|
2214
|
+
return this
|
2215
|
+
},
|
2216
|
+
attr: function(name, value) {
|
2217
|
+
if (arguments.length === 2) {
|
2218
|
+
this[0].setAttribute(name, value)
|
2228
2219
|
return this
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2220
|
+
} else {
|
2221
|
+
return this[0].getAttribute(name)
|
2222
|
+
}
|
2223
|
+
},
|
2224
|
+
data: function(name, value) {
|
2225
|
+
name = "data-" + hyphen(name || "")
|
2226
|
+
switch (arguments.length) {
|
2227
|
+
case 2:
|
2228
|
+
this.attr(name, value)
|
2229
|
+
return this
|
2230
|
+
case 1:
|
2231
|
+
var val = this.attr(name)
|
2232
|
+
return parseData(val)
|
2233
|
+
case 0:
|
2234
|
+
var ret = {}
|
2235
|
+
ap.forEach.call(this[0].attributes, function(attr) {
|
2236
|
+
if (attr) {
|
2237
|
+
name = attr.name
|
2238
|
+
if (!name.indexOf("data-")) {
|
2239
|
+
name = camelize(name.slice(5))
|
2240
|
+
ret[name] = parseData(attr.value)
|
2241
|
+
}
|
2240
2242
|
}
|
2241
|
-
}
|
2242
|
-
|
2243
|
-
return ret
|
2244
|
-
}
|
2245
|
-
},
|
2246
|
-
removeData: function (name) {
|
2247
|
-
name = "data-" + hyphen(name)
|
2248
|
-
this[0].removeAttribute(name)
|
2249
|
-
return this
|
2250
|
-
},
|
2251
|
-
css: function (name, value) {
|
2252
|
-
if (avalon.isPlainObject(name)) {
|
2253
|
-
for (var i in name) {
|
2254
|
-
avalon.css(this, i, name[i])
|
2243
|
+
})
|
2244
|
+
return ret
|
2255
2245
|
}
|
2256
|
-
}
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2246
|
+
},
|
2247
|
+
removeData: function(name) {
|
2248
|
+
name = "data-" + hyphen(name)
|
2249
|
+
this[0].removeAttribute(name)
|
2250
|
+
return this
|
2251
|
+
},
|
2252
|
+
css: function(name, value) {
|
2253
|
+
if (avalon.isPlainObject(name)) {
|
2254
|
+
for (var i in name) {
|
2255
|
+
avalon.css(this, i, name[i])
|
2256
|
+
}
|
2257
|
+
} else {
|
2258
|
+
var ret = avalon.css(this, name, value)
|
2259
|
+
}
|
2260
|
+
return ret !== void 0 ? ret : this
|
2261
|
+
},
|
2262
|
+
position: function() {
|
2263
|
+
var offsetParent, offset,
|
2263
2264
|
elem = this[0],
|
2264
2265
|
parentOffset = {
|
2265
2266
|
top: 0,
|
2266
2267
|
left: 0
|
2267
2268
|
}
|
2268
|
-
|
2269
|
-
|
2270
|
-
}
|
2271
|
-
if (this.css("position") === "fixed") {
|
2272
|
-
offset = elem.getBoundingClientRect()
|
2273
|
-
} else {
|
2274
|
-
offsetParent = this.offsetParent() //得到真正的offsetParent
|
2275
|
-
offset = this.offset() // 得到正确的offsetParent
|
2276
|
-
if (offsetParent[0].tagName !== "HTML") {
|
2277
|
-
parentOffset = offsetParent.offset()
|
2269
|
+
if (!elem) {
|
2270
|
+
return
|
2278
2271
|
}
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
// Subtract offsetParent scroll positions
|
2283
|
-
parentOffset.top -= offsetParent.scrollTop()
|
2284
|
-
parentOffset.left -= offsetParent.scrollLeft()
|
2285
|
-
}
|
2286
|
-
return {
|
2287
|
-
top: offset.top - parentOffset.top - avalon.css(elem, "marginTop", true),
|
2288
|
-
left: offset.left - parentOffset.left - avalon.css(elem, "marginLeft", true)
|
2289
|
-
}
|
2290
|
-
},
|
2291
|
-
offsetParent: function () {
|
2292
|
-
var offsetParent = this[0].offsetParent
|
2293
|
-
while (offsetParent && avalon.css(offsetParent, "position") === "static") {
|
2294
|
-
offsetParent = offsetParent.offsetParent;
|
2295
|
-
}
|
2296
|
-
return avalon(offsetParent || root)
|
2297
|
-
},
|
2298
|
-
bind: function (type, fn, phase) {
|
2299
|
-
if (this[0]) { //此方法不会链
|
2300
|
-
return avalon.bind(this[0], type, fn, phase)
|
2301
|
-
}
|
2302
|
-
},
|
2303
|
-
unbind: function (type, fn, phase) {
|
2304
|
-
if (this[0]) {
|
2305
|
-
avalon.unbind(this[0], type, fn, phase)
|
2306
|
-
}
|
2307
|
-
return this
|
2308
|
-
},
|
2309
|
-
val: function (value) {
|
2310
|
-
var node = this[0]
|
2311
|
-
if (node && node.nodeType === 1) {
|
2312
|
-
var get = arguments.length === 0
|
2313
|
-
var access = get ? ":get" : ":set"
|
2314
|
-
var fn = valHooks[getValType(node) + access]
|
2315
|
-
if (fn) {
|
2316
|
-
var val = fn(node, value)
|
2317
|
-
} else if (get) {
|
2318
|
-
return (node.value || "").replace(/\r/g, "")
|
2272
|
+
if (this.css("position") === "fixed") {
|
2273
|
+
offset = elem.getBoundingClientRect()
|
2319
2274
|
} else {
|
2320
|
-
|
2275
|
+
offsetParent = this.offsetParent() //得到真正的offsetParent
|
2276
|
+
offset = this.offset() // 得到正确的offsetParent
|
2277
|
+
if (offsetParent[0].tagName !== "HTML") {
|
2278
|
+
parentOffset = offsetParent.offset()
|
2279
|
+
}
|
2280
|
+
parentOffset.top += avalon.css(offsetParent[0], "borderTopWidth", true)
|
2281
|
+
parentOffset.left += avalon.css(offsetParent[0], "borderLeftWidth", true)
|
2282
|
+
|
2283
|
+
// Subtract offsetParent scroll positions
|
2284
|
+
parentOffset.top -= offsetParent.scrollTop()
|
2285
|
+
parentOffset.left -= offsetParent.scrollLeft()
|
2286
|
+
}
|
2287
|
+
return {
|
2288
|
+
top: offset.top - parentOffset.top - avalon.css(elem, "marginTop", true),
|
2289
|
+
left: offset.left - parentOffset.left - avalon.css(elem, "marginLeft", true)
|
2290
|
+
}
|
2291
|
+
},
|
2292
|
+
offsetParent: function() {
|
2293
|
+
var offsetParent = this[0].offsetParent
|
2294
|
+
while (offsetParent && avalon.css(offsetParent, "position") === "static") {
|
2295
|
+
offsetParent = offsetParent.offsetParent;
|
2296
|
+
}
|
2297
|
+
return avalon(offsetParent || root)
|
2298
|
+
},
|
2299
|
+
bind: function(type, fn, phase) {
|
2300
|
+
if (this[0]) { //此方法不会链
|
2301
|
+
return avalon.bind(this[0], type, fn, phase)
|
2302
|
+
}
|
2303
|
+
},
|
2304
|
+
unbind: function(type, fn, phase) {
|
2305
|
+
if (this[0]) {
|
2306
|
+
avalon.unbind(this[0], type, fn, phase)
|
2321
2307
|
}
|
2308
|
+
return this
|
2309
|
+
},
|
2310
|
+
val: function(value) {
|
2311
|
+
var node = this[0]
|
2312
|
+
if (node && node.nodeType === 1) {
|
2313
|
+
var get = arguments.length === 0
|
2314
|
+
var access = get ? ":get" : ":set"
|
2315
|
+
var fn = valHooks[getValType(node) + access]
|
2316
|
+
if (fn) {
|
2317
|
+
var val = fn(node, value)
|
2318
|
+
} else if (get) {
|
2319
|
+
return (node.value || "").replace(/\r/g, "")
|
2320
|
+
} else {
|
2321
|
+
node.value = value
|
2322
|
+
}
|
2323
|
+
}
|
2324
|
+
return get ? val : this
|
2322
2325
|
}
|
2323
|
-
|
2324
|
-
}
|
2325
|
-
})
|
2326
|
+
})
|
2326
2327
|
|
2327
|
-
function parseData(data) {
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2328
|
+
function parseData(data) {
|
2329
|
+
try {
|
2330
|
+
if (typeof data === "object")
|
2331
|
+
return data
|
2332
|
+
data = data === "true" ? true :
|
2332
2333
|
data === "false" ? false :
|
2333
2334
|
data === "null" ? null : +data + "" === data ? +data : rbrace.test(data) ? avalon.parseJSON(data) : data
|
2334
|
-
|
2335
|
+
} catch (e) {}
|
2336
|
+
return data
|
2335
2337
|
}
|
2336
|
-
return data
|
2337
|
-
}
|
2338
2338
|
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
avalon.parseJSON = window.JSON ? JSON.parse : function
|
2339
|
+
rvalidchars = /^[\],:{}\s]*$/,
|
2340
|
+
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
2341
|
+
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
|
2342
|
+
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g
|
2343
|
+
avalon.parseJSON = window.JSON ? JSON.parse : function(data) {
|
2344
2344
|
if (typeof data === "string") {
|
2345
2345
|
data = data.trim();
|
2346
2346
|
if (data) {
|
2347
2347
|
if (rvalidchars.test(data.replace(rvalidescape, "@")
|
2348
|
-
|
2349
|
-
|
2348
|
+
.replace(rvalidtokens, "]")
|
2349
|
+
.replace(rvalidbraces, ""))) {
|
2350
2350
|
return (new Function("return " + data))() // jshint ignore:line
|
2351
2351
|
}
|
2352
2352
|
}
|
@@ -2354,30 +2354,15 @@ avalon.parseJSON = window.JSON ? JSON.parse : function (data) {
|
|
2354
2354
|
}
|
2355
2355
|
return data
|
2356
2356
|
}
|
2357
|
-
avalon.fireDom = function (elem, type, opts) {
|
2358
|
-
if (DOC.createEvent) {
|
2359
|
-
var hackEvent = DOC.createEvent("Events");
|
2360
|
-
hackEvent.initEvent(type, true, true)
|
2361
|
-
avalon.mix(hackEvent, opts)
|
2362
|
-
elem.dispatchEvent(hackEvent)
|
2363
|
-
} else {
|
2364
|
-
try {
|
2365
|
-
hackEvent = DOC.createEventObject()
|
2366
|
-
avalon.mix(hackEvent, opts)
|
2367
|
-
elem.fireEvent("on" + type, hackEvent)
|
2368
|
-
} catch (e) {//IE6-8触发事件必须保证在DOM树中,否则报"SCRIPT16389: 未指明的错误"
|
2369
|
-
}
|
2370
|
-
}
|
2371
|
-
}
|
2372
2357
|
|
2373
2358
|
//生成avalon.fn.scrollLeft, avalon.fn.scrollTop方法
|
2374
2359
|
avalon.each({
|
2375
2360
|
scrollLeft: "pageXOffset",
|
2376
2361
|
scrollTop: "pageYOffset"
|
2377
|
-
}, function
|
2378
|
-
avalon.fn[method] = function
|
2362
|
+
}, function(method, prop) {
|
2363
|
+
avalon.fn[method] = function(val) {
|
2379
2364
|
var node = this[0] || {}, win = getWindow(node),
|
2380
|
-
|
2365
|
+
top = method === "scrollTop"
|
2381
2366
|
if (!arguments.length) {
|
2382
2367
|
return win ? (prop in win) ? win[prop] : root[method] : node[method]
|
2383
2368
|
} else {
|
@@ -2401,7 +2386,7 @@ var cssMap = {
|
|
2401
2386
|
}
|
2402
2387
|
avalon.cssNumber = oneObject("animationIterationCount,columnCount,order,flex,flexGrow,flexShrink,fillOpacity,fontWeight,lineHeight,opacity,orphans,widows,zIndex,zoom")
|
2403
2388
|
|
2404
|
-
avalon.cssName = function
|
2389
|
+
avalon.cssName = function(name, host, camelCase) {
|
2405
2390
|
if (cssMap[name]) {
|
2406
2391
|
return cssMap[name]
|
2407
2392
|
}
|
@@ -2414,27 +2399,26 @@ avalon.cssName = function (name, host, camelCase) {
|
|
2414
2399
|
}
|
2415
2400
|
return null
|
2416
2401
|
}
|
2417
|
-
cssHooks["@:set"] = function
|
2402
|
+
cssHooks["@:set"] = function(node, name, value) {
|
2418
2403
|
try { //node.style.width = NaN;node.style.width = "xxxxxxx";node.style.width = undefine 在旧式IE下会抛异常
|
2419
2404
|
node.style[name] = value
|
2420
|
-
} catch (e) {
|
2421
|
-
}
|
2405
|
+
} catch (e) {}
|
2422
2406
|
}
|
2423
2407
|
if (window.getComputedStyle) {
|
2424
|
-
cssHooks["@:get"] = function
|
2408
|
+
cssHooks["@:get"] = function(node, name) {
|
2425
2409
|
if (!node || !node.style) {
|
2426
2410
|
throw new Error("getComputedStyle要求传入一个节点 " + node)
|
2427
2411
|
}
|
2428
2412
|
var ret, styles = getComputedStyle(node, null)
|
2429
|
-
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2413
|
+
if (styles) {
|
2414
|
+
ret = name === "filter" ? styles.getPropertyValue(name) : styles[name]
|
2415
|
+
if (ret === "") {
|
2416
|
+
ret = node.style[name] //其他浏览器需要我们手动取内联样式
|
2417
|
+
}
|
2433
2418
|
}
|
2434
|
-
}
|
2435
2419
|
return ret
|
2436
2420
|
}
|
2437
|
-
cssHooks["opacity:get"] = function
|
2421
|
+
cssHooks["opacity:get"] = function(node) {
|
2438
2422
|
var ret = cssHooks["@:get"](node, "opacity")
|
2439
2423
|
return ret === "" ? "1" : ret
|
2440
2424
|
}
|
@@ -2442,31 +2426,31 @@ if (window.getComputedStyle) {
|
|
2442
2426
|
var rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i
|
2443
2427
|
var rposition = /^(top|right|bottom|left)$/
|
2444
2428
|
var ralpha = /alpha\([^)]*\)/i
|
2445
|
-
var ie8 = !!window.XDomainRequest
|
2429
|
+
var ie8 = !! window.XDomainRequest
|
2446
2430
|
var salpha = "DXImageTransform.Microsoft.Alpha"
|
2447
2431
|
var border = {
|
2448
2432
|
thin: ie8 ? '1px' : '2px',
|
2449
2433
|
medium: ie8 ? '3px' : '4px',
|
2450
2434
|
thick: ie8 ? '5px' : '6px'
|
2451
2435
|
}
|
2452
|
-
cssHooks["@:get"] = function
|
2436
|
+
cssHooks["@:get"] = function(node, name) {
|
2453
2437
|
//取得精确值,不过它有可能是带em,pc,mm,pt,%等单位
|
2454
2438
|
var currentStyle = node.currentStyle
|
2455
2439
|
var ret = currentStyle[name]
|
2456
2440
|
if ((rnumnonpx.test(ret) && !rposition.test(ret))) {
|
2457
2441
|
//①,保存原有的style.left, runtimeStyle.left,
|
2458
2442
|
var style = node.style,
|
2459
|
-
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2443
|
+
left = style.left,
|
2444
|
+
rsLeft = node.runtimeStyle.left
|
2445
|
+
//②由于③处的style.left = xxx会影响到currentStyle.left,
|
2446
|
+
//因此把它currentStyle.left放到runtimeStyle.left,
|
2447
|
+
//runtimeStyle.left拥有最高优先级,不会style.left影响
|
2448
|
+
node.runtimeStyle.left = currentStyle.left
|
2449
|
+
//③将精确值赋给到style.left,然后通过IE的另一个私有属性 style.pixelLeft
|
2450
|
+
//得到单位为px的结果;fontSize的分支见http://bugs.jquery.com/ticket/760
|
2451
|
+
style.left = name === 'fontSize' ? '1em' : (ret || 0)
|
2452
|
+
ret = style.pixelLeft + "px"
|
2453
|
+
//④还原 style.left,runtimeStyle.left
|
2470
2454
|
style.left = left
|
2471
2455
|
node.runtimeStyle.left = rsLeft
|
2472
2456
|
}
|
@@ -2479,7 +2463,7 @@ if (window.getComputedStyle) {
|
|
2479
2463
|
}
|
2480
2464
|
return ret === "" ? "auto" : border[ret] || ret
|
2481
2465
|
}
|
2482
|
-
cssHooks["opacity:set"] = function
|
2466
|
+
cssHooks["opacity:set"] = function(node, name, value) {
|
2483
2467
|
var style = node.style
|
2484
2468
|
var opacity = isFinite(value) && value <= 1 ? "alpha(opacity=" + value * 100 + ")" : ""
|
2485
2469
|
var filter = style.filter || "";
|
@@ -2487,25 +2471,25 @@ if (window.getComputedStyle) {
|
|
2487
2471
|
//不能使用以下方式设置透明度
|
2488
2472
|
//node.filters.alpha.opacity = value * 100
|
2489
2473
|
style.filter = (ralpha.test(filter) ?
|
2490
|
-
|
2491
|
-
|
2474
|
+
filter.replace(ralpha, opacity) :
|
2475
|
+
filter + " " + opacity).trim()
|
2492
2476
|
if (!style.filter) {
|
2493
2477
|
style.removeAttribute("filter")
|
2494
2478
|
}
|
2495
2479
|
}
|
2496
|
-
cssHooks["opacity:get"] = function
|
2480
|
+
cssHooks["opacity:get"] = function(node) {
|
2497
2481
|
//这是最快的获取IE透明值的方式,不需要动用正则了!
|
2498
2482
|
var alpha = node.filters.alpha || node.filters[salpha],
|
2499
|
-
|
2483
|
+
op = alpha && alpha.enabled ? alpha.opacity : 100
|
2500
2484
|
return (op / 100) + "" //确保返回的是字符串
|
2501
2485
|
}
|
2502
2486
|
}
|
2503
2487
|
|
2504
|
-
"top,left".replace(rword, function
|
2505
|
-
cssHooks[name + ":get"] = function
|
2488
|
+
"top,left".replace(rword, function(name) {
|
2489
|
+
cssHooks[name + ":get"] = function(node) {
|
2506
2490
|
var computed = cssHooks["@:get"](node, name)
|
2507
2491
|
return /px$/.test(computed) ? computed :
|
2508
|
-
|
2492
|
+
avalon(node).position()[name] + "px"
|
2509
2493
|
}
|
2510
2494
|
})
|
2511
2495
|
|
@@ -2517,147 +2501,147 @@ var cssShow = {
|
|
2517
2501
|
|
2518
2502
|
var rdisplayswap = /^(none|table(?!-c[ea]).+)/
|
2519
2503
|
|
2520
|
-
function showHidden(node, array) {
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2504
|
+
function showHidden(node, array) {
|
2505
|
+
//http://www.cnblogs.com/rubylouvre/archive/2012/10/27/2742529.html
|
2506
|
+
if (node.offsetWidth <= 0) { //opera.offsetWidth可能小于0
|
2507
|
+
if (rdisplayswap.test(cssHooks["@:get"](node, "display"))) {
|
2508
|
+
var obj = {
|
2509
|
+
node: node
|
2510
|
+
}
|
2511
|
+
for (var name in cssShow) {
|
2512
|
+
obj[name] = node.style[name]
|
2513
|
+
node.style[name] = cssShow[name]
|
2514
|
+
}
|
2515
|
+
array.push(obj)
|
2526
2516
|
}
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2517
|
+
var parent = node.parentNode
|
2518
|
+
if (parent && parent.nodeType === 1) {
|
2519
|
+
showHidden(parent, array)
|
2530
2520
|
}
|
2531
|
-
array.push(obj)
|
2532
|
-
}
|
2533
|
-
var parent = node.parentNode
|
2534
|
-
if (parent && parent.nodeType === 1) {
|
2535
|
-
showHidden(parent, array)
|
2536
2521
|
}
|
2537
2522
|
}
|
2538
|
-
|
2539
|
-
|
2540
|
-
var method = name.toLowerCase(),
|
2523
|
+
"Width,Height".replace(rword, function(name) { //fix 481
|
2524
|
+
var method = name.toLowerCase(),
|
2541
2525
|
clientProp = "client" + name,
|
2542
2526
|
scrollProp = "scroll" + name,
|
2543
2527
|
offsetProp = "offset" + name
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
}
|
2557
|
-
if (boxSizing === -4) { // content-box -4
|
2558
|
-
ret = ret - avalon.css(node, "padding" + which[0], true) - avalon.css(node, "padding" + which[1], true)
|
2559
|
-
}
|
2560
|
-
return ret
|
2561
|
-
}
|
2562
|
-
cssHooks[method + "&get"] = function (node) {
|
2563
|
-
var hidden = [];
|
2564
|
-
showHidden(node, hidden);
|
2565
|
-
var val = cssHooks[method + ":get"](node)
|
2566
|
-
for (var i = 0, obj; obj = hidden[i++]; ) {
|
2567
|
-
node = obj.node
|
2568
|
-
for (var n in obj) {
|
2569
|
-
if (typeof obj[n] === "string") {
|
2570
|
-
node.style[n] = obj[n]
|
2528
|
+
cssHooks[method + ":get"] = function(node, which, override) {
|
2529
|
+
var boxSizing = -4
|
2530
|
+
if (typeof override === "number") {
|
2531
|
+
boxSizing = override
|
2532
|
+
}
|
2533
|
+
which = name === "Width" ? ["Left", "Right"] : ["Top", "Bottom"]
|
2534
|
+
var ret = node[offsetProp] // border-box 0
|
2535
|
+
if (boxSizing === 2) { // margin-box 2
|
2536
|
+
return ret + avalon.css(node, "margin" + which[0], true) + avalon.css(node, "margin" + which[1], true)
|
2537
|
+
}
|
2538
|
+
if (boxSizing < 0) { // padding-box -2
|
2539
|
+
ret = ret - avalon.css(node, "border" + which[0] + "Width", true) - avalon.css(node, "border" + which[1] + "Width", true)
|
2571
2540
|
}
|
2541
|
+
if (boxSizing === -4) { // content-box -4
|
2542
|
+
ret = ret - avalon.css(node, "padding" + which[0], true) - avalon.css(node, "padding" + which[1], true)
|
2543
|
+
}
|
2544
|
+
return ret
|
2572
2545
|
}
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
node.
|
2546
|
+
cssHooks[method + "&get"] = function(node) {
|
2547
|
+
var hidden = [];
|
2548
|
+
showHidden(node, hidden);
|
2549
|
+
var val = cssHooks[method + ":get"](node)
|
2550
|
+
for (var i = 0, obj; obj = hidden[i++];) {
|
2551
|
+
node = obj.node
|
2552
|
+
for (var n in obj) {
|
2553
|
+
if (typeof obj[n] === "string") {
|
2554
|
+
node.style[n] = obj[n]
|
2555
|
+
}
|
2556
|
+
}
|
2582
2557
|
}
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2558
|
+
return val;
|
2559
|
+
}
|
2560
|
+
avalon.fn[method] = function(value) { //会忽视其display
|
2561
|
+
var node = this[0]
|
2562
|
+
if (arguments.length === 0) {
|
2563
|
+
if (node.setTimeout) { //取得窗口尺寸,IE9后可以用node.innerWidth /innerHeight代替
|
2564
|
+
return node["inner" + name] || node.document.documentElement[clientProp] ||
|
2565
|
+
node.document.body[clientProp]//IE6下前两个分别为undefine,0
|
2566
|
+
}
|
2567
|
+
if (node.nodeType === 9) { //取得页面尺寸
|
2568
|
+
var doc = node.documentElement
|
2569
|
+
//FF chrome html.scrollHeight< body.scrollHeight
|
2570
|
+
//IE 标准模式 : html.scrollHeight> body.scrollHeight
|
2571
|
+
//IE 怪异模式 : html.scrollHeight 最大等于可视窗口多一点?
|
2572
|
+
return Math.max(node.body[scrollProp], doc[scrollProp], node.body[offsetProp], doc[offsetProp], doc[clientProp])
|
2573
|
+
}
|
2574
|
+
return cssHooks[method + "&get"](node)
|
2575
|
+
} else {
|
2576
|
+
return this.css(method, value)
|
2589
2577
|
}
|
2590
|
-
return cssHooks[method + "&get"](node)
|
2591
|
-
} else {
|
2592
|
-
return this.css(method, value)
|
2593
2578
|
}
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
}
|
2601
|
-
|
2602
|
-
|
2603
|
-
var node = this[0],
|
2579
|
+
avalon.fn["inner" + name] = function() {
|
2580
|
+
return cssHooks[method + ":get"](this[0], void 0, -2)
|
2581
|
+
}
|
2582
|
+
avalon.fn["outer" + name] = function(includeMargin) {
|
2583
|
+
return cssHooks[method + ":get"](this[0], void 0, includeMargin === true ? 2 : 0)
|
2584
|
+
}
|
2585
|
+
})
|
2586
|
+
avalon.fn.offset = function() { //取得距离页面左右角的坐标
|
2587
|
+
var node = this[0],
|
2604
2588
|
box = {
|
2605
2589
|
left: 0,
|
2606
2590
|
top: 0
|
2607
2591
|
}
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2592
|
+
if (!node || !node.tagName || !node.ownerDocument) {
|
2593
|
+
return box
|
2594
|
+
}
|
2595
|
+
var doc = node.ownerDocument,
|
2612
2596
|
body = doc.body,
|
2613
2597
|
root = doc.documentElement,
|
2614
2598
|
win = doc.defaultView || doc.parentWindow
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2599
|
+
if (!avalon.contains(root, node)) {
|
2600
|
+
return box
|
2601
|
+
}
|
2602
|
+
//http://hkom.blog1.fc2.com/?mode=m&no=750 body的偏移量是不包含margin的
|
2603
|
+
//我们可以通过getBoundingClientRect来获得元素相对于client的rect.
|
2604
|
+
//http://msdn.microsoft.com/en-us/library/ms536433.aspx
|
2605
|
+
if (node.getBoundingClientRect) {
|
2606
|
+
box = node.getBoundingClientRect() // BlackBerry 5, iOS 3 (original iPhone)
|
2607
|
+
}
|
2608
|
+
//chrome/IE6: body.scrollTop, firefox/other: root.scrollTop
|
2609
|
+
var clientTop = root.clientTop || body.clientTop,
|
2626
2610
|
clientLeft = root.clientLeft || body.clientLeft,
|
2627
2611
|
scrollTop = Math.max(win.pageYOffset || 0, root.scrollTop, body.scrollTop),
|
2628
2612
|
scrollLeft = Math.max(win.pageXOffset || 0, root.scrollLeft, body.scrollLeft)
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2613
|
+
// 把滚动距离加到left,top中去。
|
2614
|
+
// IE一些版本中会自动为HTML元素加上2px的border,我们需要去掉它
|
2615
|
+
// http://msdn.microsoft.com/en-us/library/ms533564(VS.85).aspx
|
2616
|
+
return {
|
2617
|
+
top: box.top + scrollTop - clientTop,
|
2618
|
+
left: box.left + scrollLeft - clientLeft
|
2619
|
+
}
|
2635
2620
|
}
|
2636
|
-
}
|
2637
2621
|
|
2638
|
-
//==================================val相关============================
|
2622
|
+
//==================================val相关============================
|
2639
2623
|
|
2640
|
-
function getValType(elem) {
|
2641
|
-
|
2642
|
-
|
2643
|
-
}
|
2624
|
+
function getValType(elem) {
|
2625
|
+
var ret = elem.tagName.toLowerCase()
|
2626
|
+
return ret === "input" && /checkbox|radio/.test(elem.type) ? "checked" : ret
|
2627
|
+
}
|
2644
2628
|
var roption = /^<option(?:\s+\w+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s+value[\s=]/i
|
2645
2629
|
var valHooks = {
|
2646
|
-
"option:get": IEVersion ? function
|
2630
|
+
"option:get": IEVersion ? function(node) {
|
2647
2631
|
//在IE11及W3C,如果没有指定value,那么node.value默认为node.text(存在trim作),但IE9-10则是取innerHTML(没trim操作)
|
2648
2632
|
//specified并不可靠,因此通过分析outerHTML判定用户有没有显示定义value
|
2649
2633
|
return roption.test(node.outerHTML) ? node.value : node.text.trim()
|
2650
|
-
} : function
|
2634
|
+
} : function(node) {
|
2651
2635
|
return node.value
|
2652
2636
|
},
|
2653
|
-
"select:get": function
|
2637
|
+
"select:get": function(node, value) {
|
2654
2638
|
var option, options = node.options,
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2639
|
+
index = node.selectedIndex,
|
2640
|
+
getter = valHooks["option:get"],
|
2641
|
+
one = node.type === "select-one" || index < 0,
|
2642
|
+
values = one ? null : [],
|
2643
|
+
max = one ? index + 1 : options.length,
|
2644
|
+
i = index < 0 ? max : one ? index : 0
|
2661
2645
|
for (; i < max; i++) {
|
2662
2646
|
option = options[i]
|
2663
2647
|
//旧式IE在reset后不会改变selected,需要改用i === index判定
|
@@ -2674,10 +2658,10 @@ var valHooks = {
|
|
2674
2658
|
}
|
2675
2659
|
return values
|
2676
2660
|
},
|
2677
|
-
"select:set": function
|
2661
|
+
"select:set": function(node, values, optionSet) {
|
2678
2662
|
values = [].concat(values) //强制转换为数组
|
2679
2663
|
var getter = valHooks["option:get"]
|
2680
|
-
for (var i = 0, el; el = node.options[i++];
|
2664
|
+
for (var i = 0, el; el = node.options[i++];) {
|
2681
2665
|
if ((el.selected = values.indexOf(getter(el)) > -1)) {
|
2682
2666
|
optionSet = true
|
2683
2667
|
}
|
@@ -3793,7 +3777,7 @@ new function() { // jshint ignore:line
|
|
3793
3777
|
var bproto = HTMLTextAreaElement.prototype
|
3794
3778
|
function newSetter(value) { // jshint ignore:line
|
3795
3779
|
setters[this.tagName].call(this, value)
|
3796
|
-
if (!this.msFocus && this.avalonSetter) {
|
3780
|
+
if (!this.msFocus && this.avalonSetter && this.oldValue !== value) {
|
3797
3781
|
this.avalonSetter()
|
3798
3782
|
}
|
3799
3783
|
}
|
@@ -3817,18 +3801,18 @@ new function() { // jshint ignore:line
|
|
3817
3801
|
} // jshint ignore:line
|
3818
3802
|
if (IEVersion) {
|
3819
3803
|
avalon.bind(DOC, "selectionchange", function (e) {
|
3820
|
-
var el = DOC.activeElement
|
3821
|
-
if (
|
3804
|
+
var el = DOC.activeElement
|
3805
|
+
if (el && typeof el.avalonSetter === "function") {
|
3822
3806
|
el.avalonSetter()
|
3823
3807
|
}
|
3824
3808
|
})
|
3825
3809
|
}
|
3826
3810
|
var rnoduplex = /^(file|button|reset|submit|checkbox|radio|range)$/
|
3827
3811
|
//处理radio, checkbox, text, textarea, password
|
3828
|
-
duplexBinding.INPUT = function (
|
3829
|
-
var $type =
|
3812
|
+
duplexBinding.INPUT = function (element, evaluator, data) {
|
3813
|
+
var $type = element.type,
|
3830
3814
|
bound = data.bound,
|
3831
|
-
$elem = avalon(
|
3815
|
+
$elem = avalon(element),
|
3832
3816
|
composing = false
|
3833
3817
|
|
3834
3818
|
function callback(value) {
|
@@ -3842,27 +3826,25 @@ duplexBinding.INPUT = function (elem, evaluator, data) {
|
|
3842
3826
|
function compositionEnd() {
|
3843
3827
|
composing = false
|
3844
3828
|
}
|
3845
|
-
var IE9Value
|
3846
3829
|
//当value变化时改变model的值
|
3847
3830
|
var updateVModel = function () {
|
3848
|
-
var val =
|
3849
|
-
if (composing || val ===
|
3831
|
+
var val = element.value //防止递归调用形成死循环
|
3832
|
+
if (composing || val === element.oldValue) //处理中文输入法在minlengh下引发的BUG
|
3850
3833
|
return
|
3851
3834
|
var lastValue = data.pipe(val, data, "get")
|
3852
3835
|
if ($elem.data("duplexObserve") !== false) {
|
3853
|
-
IE9Value = val
|
3854
3836
|
evaluator(lastValue)
|
3855
|
-
callback.call(
|
3837
|
+
callback.call(element, lastValue)
|
3856
3838
|
}
|
3857
3839
|
}
|
3858
3840
|
//当model变化时,它就会改变value的值
|
3859
3841
|
data.handler = function () {
|
3860
3842
|
var val = data.pipe(evaluator(), data, "set") //fix #673 #1106
|
3861
|
-
if (val !==
|
3843
|
+
if (val !== element.oldValue) {
|
3862
3844
|
var fixCaret = false
|
3863
|
-
if (
|
3845
|
+
if (element.msFocus) {
|
3864
3846
|
try {
|
3865
|
-
var pos = getCaret(
|
3847
|
+
var pos = getCaret(element)
|
3866
3848
|
if (pos.start === pos.end) {
|
3867
3849
|
pos = pos.start
|
3868
3850
|
fixCaret = true
|
@@ -3870,9 +3852,9 @@ duplexBinding.INPUT = function (elem, evaluator, data) {
|
|
3870
3852
|
} catch (e) {
|
3871
3853
|
}
|
3872
3854
|
}
|
3873
|
-
|
3874
|
-
if (fixCaret
|
3875
|
-
setCaret(
|
3855
|
+
element.value = element.oldValue = val
|
3856
|
+
if (fixCaret) {
|
3857
|
+
setCaret(element, pos, pos)
|
3876
3858
|
}
|
3877
3859
|
}
|
3878
3860
|
}
|
@@ -3880,52 +3862,52 @@ duplexBinding.INPUT = function (elem, evaluator, data) {
|
|
3880
3862
|
var IE6 = IEVersion === 6
|
3881
3863
|
updateVModel = function () {
|
3882
3864
|
if ($elem.data("duplexObserve") !== false) {
|
3883
|
-
var lastValue = data.pipe(
|
3865
|
+
var lastValue = data.pipe(element.value, data, "get")
|
3884
3866
|
evaluator(lastValue)
|
3885
|
-
callback.call(
|
3867
|
+
callback.call(element, lastValue)
|
3886
3868
|
}
|
3887
3869
|
}
|
3888
3870
|
data.handler = function () {
|
3889
3871
|
var val = evaluator()
|
3890
|
-
var checked = data.isChecked ? !!val : val + "" ===
|
3891
|
-
|
3872
|
+
var checked = data.isChecked ? !!val : val + "" === element.value
|
3873
|
+
element.oldValue = checked
|
3892
3874
|
if (IE6) {
|
3893
3875
|
setTimeout(function () {
|
3894
3876
|
//IE8 checkbox, radio是使用defaultChecked控制选中状态,
|
3895
3877
|
//并且要先设置defaultChecked后设置checked
|
3896
3878
|
//并且必须设置延迟
|
3897
|
-
|
3898
|
-
|
3879
|
+
element.defaultChecked = checked
|
3880
|
+
element.checked = checked
|
3899
3881
|
}, 31)
|
3900
3882
|
} else {
|
3901
|
-
|
3883
|
+
element.checked = checked
|
3902
3884
|
}
|
3903
3885
|
}
|
3904
3886
|
bound("click", updateVModel)
|
3905
3887
|
} else if ($type === "checkbox") {
|
3906
3888
|
updateVModel = function () {
|
3907
3889
|
if ($elem.data("duplexObserve") !== false) {
|
3908
|
-
var method =
|
3890
|
+
var method = element.checked ? "ensure" : "remove"
|
3909
3891
|
var array = evaluator()
|
3910
3892
|
if (!Array.isArray(array)) {
|
3911
3893
|
log("ms-duplex应用于checkbox上要对应一个数组")
|
3912
3894
|
array = [array]
|
3913
3895
|
}
|
3914
|
-
var val = data.pipe(
|
3896
|
+
var val = data.pipe(element.value, data, "get")
|
3915
3897
|
avalon.Array[method](array, val)
|
3916
|
-
callback.call(
|
3898
|
+
callback.call(element, array)
|
3917
3899
|
}
|
3918
3900
|
}
|
3919
3901
|
|
3920
3902
|
data.handler = function () {
|
3921
3903
|
var array = [].concat(evaluator()) //强制转换为数组
|
3922
|
-
var val = data.pipe(
|
3923
|
-
|
3904
|
+
var val = data.pipe(element.value, data, "get")
|
3905
|
+
element.checked = array.indexOf(val) > -1
|
3924
3906
|
}
|
3925
3907
|
bound(W3C ? "change" : "click", updateVModel)
|
3926
3908
|
} else {
|
3927
|
-
var events =
|
3928
|
-
if (
|
3909
|
+
var events = element.getAttribute("data-duplex-event") || "input"
|
3910
|
+
if (element.attributes["data-event"]) {
|
3929
3911
|
log("data-event指令已经废弃,请改用data-duplex-event")
|
3930
3912
|
}
|
3931
3913
|
|
@@ -3943,19 +3925,12 @@ duplexBinding.INPUT = function (elem, evaluator, data) {
|
|
3943
3925
|
bound("compositionstart", compositionStart)
|
3944
3926
|
bound("compositionend", compositionEnd)
|
3945
3927
|
bound("DOMAutoComplete", updateVModel)
|
3946
|
-
} else {
|
3928
|
+
} else { //onpropertychange事件无法区分是程序触发还是用户触发
|
3947
3929
|
// IE下通过selectionchange事件监听IE9+点击input右边的X的清空行为,及粘贴,剪切,删除行为
|
3948
3930
|
if (IEVersion > 8) {
|
3949
|
-
|
3950
|
-
//IE9删除字符后再失去焦点不会同步 #1167
|
3951
|
-
bound("keyup", updateVModel)
|
3952
|
-
}
|
3953
|
-
//IE9使用propertychange无法监听中文输入改动
|
3954
|
-
bound("input", updateVModel)
|
3931
|
+
bound("input", updateVModel) //IE9使用propertychange无法监听中文输入改动
|
3955
3932
|
} else {
|
3956
|
-
//
|
3957
|
-
//IE6-8下第一次修改时不会触发,需要使用keydown或selectionchange修正
|
3958
|
-
bound("propertychange", function (e) {
|
3933
|
+
bound("propertychange", function (e) { //IE6-8下第一次修改时不会触发,需要使用keydown或selectionchange修正
|
3959
3934
|
if (e.propertyName === "value") {
|
3960
3935
|
updateVModel()
|
3961
3936
|
}
|
@@ -3973,23 +3948,23 @@ duplexBinding.INPUT = function (elem, evaluator, data) {
|
|
3973
3948
|
})
|
3974
3949
|
|
3975
3950
|
|
3976
|
-
if (!rnoduplex.test(
|
3977
|
-
if (
|
3951
|
+
if (!rnoduplex.test(element.type)) {
|
3952
|
+
if (element.type !== "hidden") {
|
3978
3953
|
bound("focus", function () {
|
3979
|
-
|
3954
|
+
element.msFocus = true
|
3980
3955
|
})
|
3981
3956
|
bound("blur", function () {
|
3982
|
-
|
3957
|
+
element.msFocus = false
|
3983
3958
|
})
|
3984
3959
|
}
|
3985
3960
|
|
3986
|
-
|
3961
|
+
element.avalonSetter = updateVModel //#765
|
3987
3962
|
watchValueInTimer(function () {
|
3988
|
-
if (root.contains(
|
3989
|
-
if (!
|
3963
|
+
if (root.contains(element)) {
|
3964
|
+
if (!element.msFocus && element.oldValue !== element.value) {
|
3990
3965
|
updateVModel()
|
3991
3966
|
}
|
3992
|
-
} else if (!
|
3967
|
+
} else if (!element.msRetain) {
|
3993
3968
|
return false
|
3994
3969
|
}
|
3995
3970
|
})
|
@@ -3998,16 +3973,14 @@ duplexBinding.INPUT = function (elem, evaluator, data) {
|
|
3998
3973
|
}
|
3999
3974
|
|
4000
3975
|
avalon.injectBinding(data)
|
4001
|
-
callback.call(
|
3976
|
+
callback.call(element, element.value)
|
4002
3977
|
}
|
4003
3978
|
duplexBinding.TEXTAREA = duplexBinding.INPUT
|
4004
|
-
function getCaret(ctrl) {
|
4005
|
-
var start = NaN, end = NaN
|
4006
|
-
//https://github.com/RobinHerbots/jquery.inputmask/blob/3.x/js/inputmask.js#L1736
|
3979
|
+
function getCaret(ctrl, start, end) {
|
4007
3980
|
if (ctrl.setSelectionRange) {
|
4008
3981
|
start = ctrl.selectionStart
|
4009
3982
|
end = ctrl.selectionEnd
|
4010
|
-
} else {
|
3983
|
+
} else if (document.selection && document.selection.createRange) {
|
4011
3984
|
var range = document.selection.createRange()
|
4012
3985
|
start = 0 - range.duplicate().moveStart('character', -100000)
|
4013
3986
|
end = start + range.text.length
|
@@ -4020,11 +3993,13 @@ function getCaret(ctrl) {
|
|
4020
3993
|
function setCaret(ctrl, begin, end) {
|
4021
3994
|
if (!ctrl.value || ctrl.readOnly)
|
4022
3995
|
return
|
4023
|
-
if (ctrl.createTextRange) {//IE6-
|
4024
|
-
|
4025
|
-
|
4026
|
-
|
4027
|
-
|
3996
|
+
if (ctrl.createTextRange) {//IE6-9
|
3997
|
+
setTimeout(function () {
|
3998
|
+
var range = ctrl.createTextRange()
|
3999
|
+
range.collapse(true);
|
4000
|
+
range.moveStart("character", begin)
|
4001
|
+
range.select()
|
4002
|
+
}, 17)
|
4028
4003
|
} else {
|
4029
4004
|
ctrl.selectionStart = begin
|
4030
4005
|
ctrl.selectionEnd = end
|