Comparing version 1.1.15 to 1.1.16
@@ -1,1 +0,2 @@ | ||
var __isServer="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),zn={VERSION:"0.0.1",DEBUG:!0,ZN_PATH:"",PATH:"",isServer:__isServer,GLOBAL:function(){return __isServer?global:window}.call(null)};if(zn.GLOBAL.zn=zn,__isServer)zn.ZN_PATH=__dirname,zn.PATH=process.cwd(),module.exports=zn;else{var _zn_url="";try{__a__=__b__}catch(e){e.fileName?_zn_url=e.fileName:e.sourceURL?_zn_url=e.sourceURL:e.stacktrace?console.log(e.stacktrace):e.stack?(_zn_url=e.stack.split("\n")[1],_zn_url=_zn_url.replace(/\s/g,""),_zn_url=_zn_url.substring(2,_zn_url.length)):console.log(e.toString())}if(!_zn_url)for(var _scripts=document.getElementsByTagName("script"),_src="",_node,i=0,_len=scripts.length;_len>i;i++)if(_node=scripts[i],_node.getAttribute&&(_src=_node.getAttribute("src")||"","zn.js"===_src.slice(-5)||"zn.minx.js"===_src.slice(-10))){_zn_url=_src;break}if(!_zn_url)throw new Error("zn.js has not been included, please do it first.");zn.ZN_PATH=_zn_url.substring(0,_zn_url.lastIndexOf("/")+1)}!function(a){var b=Object.prototype.toString,c={idle:function(){},idleArray:function(){return[]},idleObject:function(){return{}},format:function(){var a=arguments,b=null,c=null;return a.length<2?a[0]:(b=a[0],b=b.toString?b.toString():b,c=a[1],d.each(c,function(a,c){null!==a&&void 0!==a&&(a=d.is(a,"object")?JSON.stringify(a):a.toString?a.toString():a,b=b.replace(new RegExp("\\{"+c+"\\}","gi"),a))}),b)},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)}).toUpperCase()},serializeJSON:function(a){return Object.keys(a).map(function(b){return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&")},fix:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&"function"!=typeof b[f]&&(b[f]=e[f])}return b},extend:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b},overwrite:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&void 0===b[f]&&(b[f]=e[f])}return b},path:function(a,b,c){var d=a||{};if(b){var e,f=b.split("."),g=f.length,h=0;if(arguments.length<3)for(;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e];else{for(g-=1;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e]=d[e]||{};e=f[h],d&&(d.__set__?d.__set__(e,c):d[e]=c,d=c)}}return d},invoke:function(b,c,d){if(b&&c){var e,f,g=c.lastIndexOf(".");g>0?(e=a.path(b,c.substring(0,g)),e&&(f=e[c.substring(g+1)])):(e=b,f=b[c]),f&&f.apply(e,d)}},deepEachObject:function(a,b,c){if(d.is(a,"object")){var e,f=null;for(var g in a)f=a[g],d.is(f,"object")?this.deepEachObject(f,b,c):(e=b&&b.call(c,f,g,a),void 0!==e&&null!==e&&(a[g]=e))}return a},arrayValueToObject:function(a,b,c){if(d.is(a,"array")){for(var e,f=null,g={},h=0,i=a.length;i>h;h++)f=a[h],e=b&&b.call(c,f,h,a),void 0!==e&&null!==e&&(g[f]=e);a=g}return a}},d={toString:function(a){return a&&a.toString?a.toString():b.call(a)},each:function(a,c,d){if(a&&c)if(a.__each__)a.__each__(c,d);else{var e=a.length,f=null;if(e>0&&"[object Array]"===b.call(a)){for(var g=0;e>g;g++)if(f=c.call(d,a[g],g),f===!1)return!1}else for(var h in a)if(a.hasOwnProperty(h)){if(f=c.call(d,a[h],h),f===!1)return!1;if(-1===f)continue}}},clone:function(b){if(b){if(b.__clone__)return b.__clone__();if(a.is(b,"array"))return b.slice(0);var c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c}return b},type:function(a){return a&&a.__type__?a.__type__:b.call(a).slice(8,-1).toLowerCase()},is:function(a,b){if(a&&a.__is__)return a.__is__(b);if("string"==typeof b)switch(b.toLowerCase()){case"plain":return a&&a.constructor===Object;default:return this.type(a)===b}else if("function"==typeof b)return a instanceof b},may:function(a,b){return a?a.__may__?a.__may__(b):a.hasOwnProperty("on"+b):!1},can:function(a,b){return a?a.__can__?a.__can__(b):"function"==typeof a[b]:!1},has:function(a,b){return a?a.__has__?a.__has__(b):a.hasOwnProperty(b):!1},get:function(a,b){return a?a.__get__?a.__get__(b):a[b]:void 0},set:function(a,b,c){a&&(a.__set__?a.__set__(b,c):a[b]=c)},gets:function(a){if(a){if(a.__gets__)return a.__gets__();var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}},sets:function(a,b){if(a&&b)if(a.__sets__)a.__sets__(b);else for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}};c.extend(a,c),c.extend(a,d)}(zn),function(a){{var b=Array.prototype.slice,c=Object.prototype.hasOwnProperty,d=Object.prototype.toString,e={format:function(){var b=arguments,c=this;return 1==b.length&&"object"==typeof b[0]&&(b=b[0]),a.each(b,function(b,d){null!==b&&void 0!==b&&(b="object"==a.type(b)?JSON.stringify(b):b.toString?b.toString():b,c=c.replace(new RegExp("\\{"+d+"\\}","gi"),b))}),c.toString()}},f={isArray:function(b){return b&&"[object Array]"===a.toString(b)&&b.constructor===Array}},g={forEach:function(a,b){if(!a)return!1;for(var c=0,d=this.length;d>c;c++)a.call(b,this[c],c);return this},indexOf:function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},lastIndexOf:function(a){for(var b=this.length-1;b>=0;b--)if(this[b]===a)return b;return-1}},h={bind:function(a){var c=this;return function(){return c.apply(a,b.call(arguments,1))}}},i={toArray:function(a){return b.call(a)},keys:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(b);return d},values:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(a[b]);return d},create:function(){var b=function(){};return function(c,d){if(null===c)throw new Error("Cannot set a null [[Prototype]]");if("object"!=typeof c)throw new TypeError("Argument must be an object");return a.each(d,function(a,b){i.defineProperty(c,a,b)}),b.prototype=c,new b}}(),defineProperty:function(a,b,c){return a&&b&&c&&c.hasOwnProperty("value")&&(a[b]=c.value),a}};({parse:function(){return""},stringify:function(){var a=d,b=Array.isArray,c={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},e=function(a){return c[a]||"\\u"+(a.charCodeAt(0)+65536).toString(16).substr(1)},f=/[\\"\u0000-\u001F\u2028\u2029]/g;return function g(c){if(null==c)return"null";if("number"==typeof c)return isFinite(c)?c.toString():"null";if("boolean"==typeof c)return c.toString();if("object"==typeof c){var d;if("function"==typeof c.toJSON)return g(c.toJSON());if(b(c)){d="[";for(var h=0;h<c.length;h++)d+=(h?", ":"")+g(c[h]);return d+"]"}if("[object Object]"===a.call(c)){d=[];for(var i in c)c.hasOwnProperty(i)&&d.push(g(i)+": "+g(c[i]));return"{"+d.join(", ")+"}"}}return'"'+c.toString().replace(f,e)+'"'}}()})}a.fix(Array,f),a.fix(Array.prototype,g),a.fix(Function.prototype,h),a.fix(String.prototype,e)}(zn),function(a){function b(){}function c(){var c,e,f,h=l._arguments.apply(this,arguments),i=h.name,j=h.super,k=h.meta,n=k.methods.init;if(j._static_)throw new Error("Static class cannot be inherited.");if(j._final_)throw new Error("Final class cannot be inherited.");if(i&&k.partial&&(c=a.path(d,i)),k.static){if(c){if(!c._static_)throw new Error('Partial class "'+i+'" must be static.')}else c=function(){throw new Error("Cannot instantiate static class.")};f=c.prototype}else{if(c){if(c._static_)throw new Error('Partial class "'+i+'" must not be static.');if(c._super_!==j&&c._super_!==b)throw new Error('Partial class "'+i+'" must have consistent super class.')}else c=k.abstract?function(){throw new Error("Cannot instantiate abstract class.")}:function(){var b=c._mixins_||[],d=c._ctors_||[],e=null,f=arguments;this.__id__=g++,this.__handlers__={},this.__initializing__=!0,this.__afters__=[];for(var h=null,i=null,j=0,k=b.length;k>j;j++)h=b[j],h["@init"]?(i=h["@init"].meta,i=a.is(i,"function")?i:i.value,m(h.prototype.__super__,this,f),i&&i.call(this)):m(h.prototype.__super__,this,f);m(this.__super__,this,f);for(var l=0,n=d.length;n>l;l++)e=d[l],e=a.is(e,"function")?e:e.value,e&&e.apply(this,f);for(;this.__afters__.length>0;){var o=this.__afters__.pop();o.handler.apply(o.context,f)}this.__afters__=null,delete this.__afters__,this.__initializing__=!1},c._ctors_=[];c._super_!==j?(e=function(){},e.prototype=j.prototype,f=new e,f.constructor=c,f.__type__=i||"Anonymous",f.__super__=j,c.prototype=f):f=c.prototype,f.class=f.constructor,n&&(c._ctors_.push(n),f.__ctor__||(f.__ctor__=n))}return l._meta(c,h),f.__define__&&f.__define__.call(c),i&&a.path(d,i,c),c}var d=a.GLOBAL,e="@",f=1,g=1,h={fixTargetCtor:function(a){return a instanceof b?a.constructor:a},fixTargetKey:function(a){return e+a},defineEvent:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d,g={};return f||(g=Object.defineProperty(a,"on"+b.toLowerCase(),{get:function(){var a=this.__handlers__[b];return a?a[0].handler:null},set:function(a){var c=this.__handlers__,d=c[b]=c[b]||[];d[0]={owner:this,handler:a,context:null}}})),d[e]={name:b,type:"event",meta:c,descriptor:g},f},defineProperty:function(b,c,d){var e,f,g=h.fixTargetCtor(b),i=h.fixTargetKey(c),j=i in g,k={};if("value"in d){var l=d.value,m="_"+c,n=d.get,o=d.set;e=n||function(){return m in this?this[m]:a.is(l,"function")?l.call(this):l},f=d.readonly?function(a,b){return b&&b.force?void(this[m]=a):!1}:o||function(a){this[m]=a}}else e=d.get||function(){return void 0},f=d.set||function(){return!1};return j&&(e.__super__=g[i].getter,f.__super__=g[i].setter),k=Object.defineProperty(b,c,{get:e,set:f,configurable:!0}),g[i]={name:c,type:"property",meta:d,getter:e,setter:f,descriptor:k},j},defineMethod:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d;return d[e]={name:b,type:"method",meta:c},b in a&&(c.value||(c.value=function(){}),c.value.__super__=a[b]),a[b]=c.value,f}},i={__handlers__:{},member:function(a,c){var d=h.fixTargetCtor(c||this),e=d[h.fixTargetKey(a)];return e||d===b?e:this.member(a,d._super_)},may:function(a){var b=this.member(a);return b&&"event"==b.type},has:function(a){var b=this.member(a);return b&&"property"==b.type},can:function(a){var b=this.member(a);return b&&"method"==b.type},get:function(a,b){var c=this.member(a);return c&&c.getter?c.getter.call(this,b):void 0},set:function(a,b,c){var d=this.member(a);return d&&d.setter&&d.setter.call(this,b,c),this},gets:function(b){var c={},d=h.fixTargetCtor(this)._properties_;return a.each(d,function(a){c[a]=this.get(a,b)},this),c},sets:function(a,b,c){if(a){var d=null;for(var e in a)a.hasOwnProperty(e)&&(d=a[e],(c&&c(d,e,b))!==!1&&this.set(e,d,b))}return this},each:function(a,b){for(var c=h.fixTargetCtor(this)._properties_,d=0,e=c.length;e>d;d++){var f=c[d],g=a.call(b,f,d,this.member(f),this.get(f));if(g===!1)return!1}return this},__may__:function(a){return this.may(a)},__has__:function(a){return this.has(a)},__can__:function(a){return this.can(a)},__get__:function(a){return this.get(a)},__gets__:function(){return this.gets()},__set__:function(a,b){this.set(a,b)},__sets__:function(a){this.sets(a)},__each__:function(a,b){return this.each(a,b)}},j={toString:function(){return"{ ClassName: "+(this._name_||"Anonymous")+", ClassID: "+this._id_+" }"},createSelf:function(){return new this.constructor.apply(this,Array.prototype.slice.call(arguments))},getProperties:function(b){var c={};if(!this.getMeta||"ZNObject"==this._name_)return c;var d=this._super_,e=this._mixins_;return d&&a.extend(c,d.getProperties(b)),e&&e.length&&a.each(e,function(d){a.extend(c,d.getProperties(b))}),a.each(this.getMeta("properties"),function(a,d){var e=b&&b(d,a)===!1;e||a.hidden||(c[d]=a)}),c},getPropertie:function(b){var c=null;return b&&a.each(this.getProperties(),function(a,d){return b==d&&(c=a),-1}),c},getMeta:function(a){return a?this._meta_[a]:this._meta_},setMeta:function(a,b){return this._meta_[a]=b,this},defineEvent:function(a,b,c){return h.defineEvent(c||this.prototype,a,b)||this._events_.push(a),this},defineProperty:function(a,b,c){return h.defineProperty(c||this.prototype,a,b)||this._properties_.push(a),this},defineMethod:function(a,b,c){return h.defineMethod(c||this.prototype,a,b)||this._methods_.push(a),this}},k={toString:function(){var a={ClassName:this.__name__||"Anonymous",InstanceID:this.__id__,Meta:this.constructor._meta_};return JSON.stringify(a)},toJson:function(){var b={};return a.each(this.constructor.getProperties(),function(a,c){b[c]=this.get(c)},this),b},getProperties:function(){return this.constructor.getProperties()},getPropertie:function(a){return this.constructor.getPropertie(a)},upon:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[];f[0]=a.extend({owner:this,handler:c},d)}return this},on:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[{owner:null,handler:null,context:null}];f.push(a.extend({owner:this,handler:c},d))}return this},off:function(a,b,c){var d,e=this.__handlers__[a]||[],f=c&&c.context;if(b)for(var g=e.length-1;g>=0;g--)d=e[g],d.handler!==b||f&&d.context!==f||this.__handlers__[a].splice(g,1);else this.__handlers__[a]=[{owner:null,handler:null,context:null}];return this},offs:function(){var b=Array.prototype.slice.call(arguments);return b.length?a.each(b,function(a){this.__handlers__[a]&&(this.__handlers__[a]=[{owner:null,handler:null,context:null}])}.bind(this)):this.__handlers__={},this},fire:function(a,b,c){var d,e=this.__handlers__[a],f=null;if(e)for(var g=0,h=e.length;h>g;g++)if(d=e[g],d&&d.handler&&(f=c&&"apply"==c.method?d.handler.apply(d.context||d.owner,b):d.handler.call(d.context||d.owner,d.owner,b,c),!1===f))return!1;return this},dispose:function(){return this.__handlers__={},this},destroy:function(){return this.dispose()},"super":function(){var a=this.super.caller.__super__;return a?a.apply(this,arguments):void 0},is:function(b){if("string"==typeof b&&(b=a.path(d,b)),b){if(this instanceof b)return!0;for(var c=this.constructor._mixins_,e=0,f=c.length;f>e;e++){var g=c[e];if(b===g)return!0}}return!1},__is__:function(a){return this.is(a)},__clone__:function(){}};a.extend(b,i,j,{_id_:0,_name_:"ZNObject",_statics_:{},_events_:[],_properties_:[],_methods_:[],_mixins_:[],_meta_:{}}),a.extend(b.prototype,i,k),a.isZNObject=function(a){return a instanceof b};var l={_arguments:function(){var c,d,e,f=arguments,g=f.length,h=f[0],i={"static":!1,statics:[],partial:!1,"abstract":!1,"final":!1,mixins:[],events:[],properties:[],methods:[]};if(3===g){if(c=h,d=f[1],e=f[2],!a.is(d,"function"))throw new Error("Invalid _super class.")}else if(2===g){if(a.is(h,"string"))c=h,d=null;else{if(!a.is(h,"function"))throw new Error("Invalid _super class.");c=null,d=h}e=f[1]}else{if(1!==g)throw new Error("Invalid arguments.");if(c=null,d=null,e=h,!a.is(e,"object"))throw new Error("The meta argument must be an object.")}return c=c||"",e=a.overwrite(e||{},i),d=d||b,{name:c,"super":d,meta:e}},_meta:function(b,c){var d=c.name,e=c.super,g=c.meta;return a.extend(b,i,j,{_id_:f++,_name_:d,_super_:e,_partial_:g.partial,_abstract_:g.abstract,_static_:g.static,_final_:g.final,_statics_:a.extend({},e._statics_,g.statics),_events_:e._events_.slice(0),_properties_:e._properties_.slice(0),_methods_:e._methods_.slice(0),_mixins_:e._mixins_.concat(g.mixins),_meta_:g}),a.extend(b,b._statics_),g.static?(a.each(g.events,function(a){b.defineEvent(a,{},b)}),a.each(g.properties||g.props,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c},b)}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c,b)}),g.methods.init&&g.methods.init.call(b,b)):(a.each(g.mixins,function(c){var d=c.prototype;a.each(c._events_,function(a){b.defineEvent(a,d.member(a).meta)}),a.each(c._properties_,function(a){b.defineProperty(a,d.member(a).meta)}),a.each(c._methods_,function(a){i[a]||k[a]||b.defineMethod(a,d.member(a).meta)})}),a.each(g.events,function(a){b.defineEvent(a,{})}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c})}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c)})),b}},m=function(c,d,e){if(c&&c!==b){var f=c.member("init"),g=c._mixins_,h=null;return f&&f.meta.after&&d.__afters__.push({context:d,handler:f.meta.after}),g.length&&a.each(g,function(b){b["@init"]&&(h=b["@init"].meta,h=a.is(h,"function")?h:h.value,m(b.prototype.__super__,b.prototype,e),h&&h.call(d))}),f&&f.meta.auto&&f.meta.value.apply(d,e),arguments.callee(c._super_,d)}};a.Class=c}(zn),function(a){var b=".",c="..",d="/",e={PENDING:0,LOADING:1,WAITING:2,LOADED:3},f=null;"undefined"!=typeof module&&module.exports?a.SLASH=d=require("path").sep:f=document;var g={normalizePath:function(a){for(var e,f=a.split(d),g=[f[0]],h=1,i=f.length;i>h;h++)switch(e=f[h]){case b:break;case c:var j=g[g.length-1];j===b||j===c?g.push(c):g.pop();break;default:g.push(e)}return g.join(d)},formatPath:function(b,c){var e=b;e="/"===d?e.split("\\").join(d):e.split("/").join(d);var f=c?c.get("path")||a.PATH:a.PATH,g=e.indexOf(d);return e.indexOf(a.PATH)>-1||e.indexOf(a.ZN_PATH)>-1?e:(e=g>0?f?f.substring(0,f.lastIndexOf(d)+1)+e:e:0===g?a.PATH.substring(0,a.PATH.lastIndexOf(d))+e:a.ZN_PATH+d+e+d,e.slice(-1)===d&&(e+="index.js"),e=this.normalizePath(e))}},h=a.Class("zn.Module",{events:["pending","loading","waiting","loaded"],statics:{all:{},current:null,counter:0,preLoadedPackage:{},unloadModule:function(b){try{if(!h.all[b])return this;b=require.resolve(b);var c=require.cache[b];c&&c.parent&&c.parent.children.splice(c.parent.children.indexOf(c),1),require.cache[b]=null;var d=h.all[b];h.all[b]=null,d&&d.parent&&h.unloadModule(d.parent.path)}catch(e){a.error(e.message)}return this},loadModule:function(b,c,d){if(a.is(b,h))return b.load(c);if("node:"===b.substring(0,5))return c(require(b.substring(5)));var i=null;if(a.NODE_PATHS&&a.NODE_PATHS.length&&a.NODE_PATHS.every(function(a){return 0===b.indexOf(a)?(i=b,!1):!0}),!i&&(i=g.formatPath(b,d),!f))try{i=require.resolve(i)}catch(j){return a.error("node require.resolve("+i+"): ",j.message),c({})}var k=h.all[i];k?k.load(c):(k=h.all[i]=new h(i),h.counter++,f?this.__webModule(i,function(a){if(h.counter--,a)throw new Error("Failed to load module:"+b);k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}):this.__nodeModule(i,function(){h.counter--,k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}))},__nodeModule:function(b,c){var d=b,e=c||a.idle,f={};try{f=require(d)}catch(g){console.error(g),a.error("Node.js require("+d+") error: ",g.message)}finally{e(f)}},__webModule:function(b,c){var e=f.head||f.getElementsByTagName("head")[0],g=f.createElement("script"),h=b,i=c||a.idle,j=function(a){g.onload=null,g.onerror=null,i(a)};h=h.slice(-1)===d?h+"index.js":h,h=".js"===h.slice(-3).toLowerCase()?h:h+".js",g.src=h,"onload"in g?g.onload=function(){j(null)}:g.onreadystatechange=function(a){var b=g.readyState;j("loaded"===b||"complete"===b?null:a)},g.onerror=function(a){j(a)},e.appendChild(g)}},properties:{parent:null,status:e.PENDING,path:"",dependencies:null,factory:null,value:{set:function(a){a._ctors_&&(a.$path=this.get("path")),this._value=a},get:function(){return this._value}}},methods:{init:function(a,b,c){this.sets({path:a,dependencies:b||[],factory:c,value:{}}),this._callbacks=[]},exec:function(a){var b=process.argv,c=b[1];return this.sets({path:c,status:e.LOADING}),this.load(a),this},__pending:function(a){this._callbacks.push(a)},__loading:function(b){var c=(this.get("path"),this.get("dependencies")),d=this._depHandler,f=this.get("factory"),g=this.get("value");this.set("status",e.WAITING),this._callbacks.push(b);var i=c.length;if(0===i)g=f.call(g)||g,this.set("value",g),this.set("status",e.LOADED),a.each(this._callbacks,function(a){a(g)});else{var j=[],k=this;a.each(c,function(b,c){d&&(b=d(b,c)),h.loadModule(b,function(b){j[c]=b,i--,0===i&&(g=f.apply(g,j)||g,k.set("value",g),k.set("status",e.LOADED),a.each(k._callbacks,function(a){a(g)}))},k)})}},__waiting:function(a){var b=this;setTimeout(function(){0===h.counter&&b.set("status",e.LOADING),b.load(a)})},__loaded:function(a){a(this.get("value"))},load:function(b){var c=this.get("status"),d=b||a.idle;switch(c){case e.PENDING:this.__pending(d);break;case e.LOADING:this.__loading(d);break;case e.WAITING:this.__waiting(d);break;case e.LOADED:this.__loaded(d)}return this}}});a.define=function(){var b=arguments,c=b.length,d=b[0],e=[],f=null;switch(c){case 1:a.is(d,"function")?f=d:a.is(d,"array")?(e=d,f=function(){var b={};return a.each(arguments,function(c){c._name_?b[c._name_]=c:a.extend(b,c)}),b}):f=function(){return d};break;case 2:e=d,f=b[1];break;case 3:e=d,f=b[1]}return e&&a.is(e,"string")&&(e=[e]),h.current=new h("",e,f),b[2]&&(h.current._depHandler=b[2]),h.current};var i=a.Class("zn.Loader",{"static":!0,properties:{preLoadPackages:[]},methods:{init:function(){for(var a=this.preLoadPackages,b=0,c=a.length;c>b;b++)this.loadPackage(a[b])},loadPackage:function(b){this.load(b+"index.js",function(b){a.extend(h.preLoadedPackage,b)})},load:function(a,b,c){return h.loadModule(a,b,c),this}}});a.load=i.load,a.module=h}(zn),function(a){var b={lower:[97,123],upper:[65,91]};a.char=a.Class({"static":!0,methods:{lowercase:function(b){return a.is(b,"string")?b.replace(/[A-Z]/g,function(a){return String.fromCharCode(32|a.charCodeAt(0))}):b},uppercase:function(b){return a.is(b,"string")?b.replace(/[a-z]/g,function(a){return String.fromCharCode(-33&a.charCodeAt(0))}):b},toUnicode:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a.charCodeAt(c));return b},toChar:function(a,b){for(var c=[],d=a;b>d;d++)c.push(String.fromCharCode(d));return c},getLowercaseLetters:function(){var a=b.lower;return this.toChar(a[0],a[1])},getUppercaseLetters:function(){var a=b.upper;return this.toChar(a[0],a[1])},getStringFromChar:function(a,b){for(var c=a||"A",d=b||26,e=[],f=0;d>f;f++)e.push(String.fromCharCode(c.charCodeAt(0)+f));return e.join("")}}})}(zn),function(a){var b={ISO8601:"yyyy-MM-dd hh:mm:ss.SSS",ISO8601_WITH_TZ_OFFSET:"yyyy-MM-ddThh:mm:ssO",DATETIME:"dd MM yyyy hh:mm:ss.SSS",ABSOLUTETIME:"hh:mm:ss.SSS"};a.date=a.Class({"static":!0,methods:{getSecond:function(a){var b=1*a.substring(1,a.length);switch(a.substring(0,1)){case"s":return 1e3*b;case"h":return 60*b*60*1e3;case"d":return 24*b*60*60*1e3}},asString:function(a){var c=b.ISO8601;"string"==typeof a&&(c=arguments[0],a=arguments[1]);var d=this.__addZero(a.getDate()),e=this.__addZero(a.getMonth()+1),f=this.__addZero(a.getFullYear()),g=this.__addZero(a.getFullYear().toString().substring(2,4)),h=c.indexOf("yyyy")>-1?f:g,i=this.__addZero(a.getHours()),j=this.__addZero(a.getMinutes()),k=this.__addZero(a.getSeconds()),l=this.__padWithZeros(a.getMilliseconds(),3),m=this.__offset(a),n=c.replace(/dd/g,d).replace(/MM/g,e).replace(/y{1,4}/g,h).replace(/hh/g,i).replace(/mm/g,j).replace(/ss/g,k).replace(/SSS/g,l).replace(/O/g,m);return n},__padWithZeros:function(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c},__addZero:function(a){return this.__padWithZeros(a,2)},__offset:function(a){var b=Math.abs(a.getTimezoneOffset()),c=String(Math.floor(b/60)),d=String(b%60);return 1==c.length&&(c="0"+c),1==d.length&&(d="0"+d),a.getTimezoneOffset()<0?"+"+c+d:"-"+c+d}}})}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,CANCLE:1,PAUSE:2,FINISHED:3},d=a.Class({events:["init","finished"],properties:{status:{value:c.PENDING,get:function(){return this._status}}},methods:{init:function(){},doTask:function(a,b){if(a){var c=b||[];c.unshift(this),a.handler.apply(a.context,c)}},done:function(){this._status=c.FINISHED,this._data=b.call(arguments),this.fire("finished",this._data),this.off("finished")}}}),e=a.Class({events:["clear","insert","pause","resume","exception","every","finally"],properties:{count:{get:function(){return this._tasks.length}}},methods:{init:function(a){this._exceptions=[],this._finallys=[],this._everys=[],this._tasks=[],this._taskProcessor=[],this._lastTask=null,this._data=[],this._max=(a||{}).max||1},destroy:function(){this._everys=[],this._tasks=[],this._taskProcessor=[],this.fire("finally",this._data,{method:"apply"}),this.super()},clear:function(){this._tasks=[]},pause:function(a){return this._paused=!0,a>0&&(this._pauseTimer=setTimeout(function(){this.resume()}.bind(this),a)),this.fire("pause"),this},resume:function(){return this._pauseTimer&&clearTimeout(this._pauseTimer),this._paused=!1,this.fire("resume"),this.doTask(),this},exception:function(a,b){return this.on("exception",a,b||this),this},"catch":function(a){return this.fire("exception",a),this},"finally":function(a,b){return this.on("finally",a,b||this),this},every:function(a,b){return this.on("every",a,b||this),this},unshift:function(a,b){return this.insert(a,b,0),this},push:function(a,b){return this.insert(a,b,-1),this},inserts:function(a,b,c){var d=a||[],e=c||0,f=this._tasks[0],g=null,h=null;return d.map(function(a){return h={handler:a,context:b||this},g&&(h.previous=g,g.next=h),g=h,h}.bind(this)),f&&(g.next=f,f.previous=g),d.unshift(0),d.unshift(e),this._tasks.splice.apply(this._tasks,d),this},insert:function(a,b,c){var d={handler:a,context:b||this},e=c||-1;switch(e){case-1:this._lastTask&&(d.previous=d,this._lastTask.next=d),this._lastTask=d,this._tasks.push(d);break;case 0:var f=this._tasks[0];f&&(d.next=f,f.previous=d),this._tasks.unshift(d);break;default:this._tasks.splice(e,0,d)}return this.fire("insert",d),this},getTaskProcessor:function(){for(var a=null,b=this._taskProcessor.length,e=0;b>e;e++)if(a=this._taskProcessor[e],a.status==c.FINISHED)return a;if(!a&&this._max>b){var f=new d;return f.queue=this,f.on("finished",this.__onProcessorFinished.bind(this),this),f}},start:function(){return this._data=[],this.doTask()},doTask:function(a){var b=this._tasks.shift();if(b){var c=this.getTaskProcessor();c&&(b.previousResult=a,c.doTask(b,a))}else this.destroy();return this},__onProcessorFinished:function(a,b){this._data.push(b),this.fire("every",b,{method:"apply"}),this.doTask(b)}}});a.queue=function(a){return new e(a)}}(zn),function(a){var b=["INFO","DEBUG","WARN","ERROR","TRACE","ALL"],c=["#100000","#2125a0","#a82c2c","#c045b7","1cb131","#100000"],d=[38,34,35,31,32,36,33],e={INFO:0,DEBUG:1,WARN:2,ERROR:3,TRACE:4,ALL:6},f=a.Class({events:["info","debug","warn","error","trace","all"],methods:{init:function(){this._config={only:null,levels:["info","debug","warn","error","trace","all"]}},config:function(b){this._config=a.overwrite(b,this._config)},info:function(){this.__log.call(this,e.INFO,arguments)},debug:function(){this.__log.call(this,e.DEBUG,arguments)},warn:function(){this.__log.call(this,e.WARN,arguments)},trace:function(){this.__log.call(this,e.TRACE,arguments)},error:function(){this.__log.call(this,e.ERROR,arguments)},all:function(){this.__log.call(this,e.ALL,arguments)},__getDateString:function(b){return a.date.asString(b||new Date)},__getPosition:function(){try{throw new Error}catch(b){return a.DEBUG&&a.CONSOLE_ERROR&&console.log(b),b.stack.split("\n")[5].replace(/\(/g,"").replace(/\)/g,"").split("/").pop()}},__formatLog4Server:function(a,c){var e="",f="",g="";return c&&(f="[",g="[0m",e=d[5]+"m",c=d[a.type]+"m"),[a.time," [",f,c,b[a.type],g,"] [",f,e,a.pos,g,"] ",a.message].join("")},__formatLog4Client:function(a){return["%c"+a.time," [",b[a.type],"] "].join("")},__log:function(d,e){var f=Array.prototype.slice.call(e),g=f.slice(0),h=b[d].toLowerCase(),i=this.__getDateString(),j=this.__getPosition();if(g.unshift(j),g.unshift(h),g.unshift(i),"undefined"!=typeof module&&module.exports?f.unshift(this.__formatLog4Server({type:d,time:i,pos:j},!0)):(f.unshift("color:"+c[d]),f.unshift(this.__formatLog4Client({type:d,time:i,pos:j},!0))),this.__isOk(h)){var k=this.fire(h,g);k!==!1&&a.DEBUG&&console.log.apply(this,f)}},__isOk:function(a){if(this._config.only){if(this._config.only===a)return!0}else{var b=-1!==this._config.levels.indexOf(a);if(b)return!0}return!1}}});a.logger=new f;var g={info:function(){a.logger.info.apply(a.logger,arguments)},debug:function(){a.logger.debug.apply(a.logger,arguments)},warn:function(){a.logger.warn.apply(a.logger,arguments)},trace:function(){a.logger.trace.apply(a.logger,arguments)},error:function(){a.logger.error.apply(a.logger,arguments)}};a.extend(a,g)}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,FULFILLED:1,REJECTED:2},d=a.Class({events:["complete"],properties:{promise:null},methods:{init:function(a,b){this._promise=new e,a&&this.resolve(a),b&&this.reject(b)},resolve:function(){var d=b.call(arguments);try{var e=this.get("promise"),g=this;if(e.get("readyState")!=c.PENDING)return;e.set("readyState",c.FULFILLED),e.set("data",d),a.each(e.get("resolves"),function(a){a.apply(g,d)})}catch(h){f.catch(h,this)}this.fire("complete",d)},reject:function(){var a=b.call(arguments);try{var d=this.get("promise");if(d.get("readyState")!=c.PENDING)return;d.set("readyState",c.REJECTED),d.set("reason",a);var e=d.get("rejects")[0];e&&e.apply(this,a)}catch(g){f.catch(g,this)}this.fire("complete",a)}}}),e=a.Class({statics:{isPromise:function(a){return null!==a&&void 0!==a&&"function"==typeof a.then},defer:null},properties:{resolves:null,rejects:null,data:null,reason:null,readyState:null},methods:{init:function(){this.set("resolves",[]),this.set("rejects",[]),this.set("exceptions",[]),this.set("readyState",c.PENDING)},then:function(a,f){function g(){var c=b.call(arguments),d=a?a.apply(this,c):c;return e.isPromise(d)?d.then(function(){h.resolve.apply(h,b.call(arguments))}):h.resolve.apply(h,d),d}var h=new d;if(this.get("readyState")===c.PENDING)this.get("resolves").push(g),this.get("rejects").push(f?f:function(){h.reject.apply(h,b.call(arguments))});else if(this.get("readyState")===c.FULFILLED){var i=this;setTimeout(function(){g.apply(i,i.get("data"))})}return h.promise},"catch":function(a){return f.exception(a)},"finally":function(a){return f.finally(a)},otherwise:function(a){return this.then(void 0,a)}}}),f=a.async=a.Class({"static":!0,methods:{init:function(){this._exceptions=[],this._finallys=[],this._count=0,this._currIndex=0,this._dataArray=[]},exception:function(a){return this._exceptions.push(a),this},"catch":function(b,c){return a.each(this._exceptions,function(a){a.call(c,b)}),this},"finally":function(a){return this._finallys.push(a),this},defer:function(b,c){var e=this,f=new d(b,c);return f.on("complete",function(b,c){e._currIndex++,e._dataArray.push(c),e._currIndex==e._count&&(a.each(e._finallys,function(b){try{b(e._dataArray)}catch(c){a.error(c.message)}}),e._finallys=[])}),e._count++,f},all:function(b){var c=f.defer(),d=0,e=[];return a.each(b,function(a){a.then(function(a){e.push(a),d++,d>=b.length&&c.resolve(e)})}),c.promise},any:function(b){var c=f.defer();return a.each(b,function(a){a.then(function(a){c.resolve(a)})}),c.promise}}})}(zn),function(){zn.querystring=zn.Class({"static":!0,properties:{config:{get:function(){}}},methods:{init:function(){this._config={separator:"&",equal:"=",minIndex:0,maxIndex:1e3}},config:function(a){return this.overwrite(this._config,a),this},parse:function(a,b){var c=zn.extend({},this._config,b),d={},e=c.equal,f=a.split(c.separator),g=f.length;c.maxIndex>0&&g>c.maxIndex&&(g=c.maxIndex);for(var h=c.minIndex;g>h;h++){var i=f[h].replace(/\+/g,"%20"),j=i.indexOf(e),k=null,l=null;j>=0?(k=i.substr(0,j),l=i.substr(j+1)):(k=i,l=""),k=decodeURIComponent(k),l=decodeURIComponent(l),hasOwnProperty(d,k)?zn.is(d[k],"array")?d[k].push(l):d[k]=[d[k],l]:d[k]=l}return d},stringify:function(a,b){var c=zn.extend({},this._config,b),d=[],e=c.equal,f={};if(f=zn.isZNObject(a)?a.gets():a,!zn.is(f,"object"))throw new Error("Agrument Error.");for(var g in a){var h=a[g],i=encodeURIComponent(this.__stringifyValue(g));h=encodeURIComponent(this.__stringifyValue(h)),d.push(i+e+h)}return d.join(c.separator)},__stringifyValue:function(a){switch(zn.type(a)){case"string":return a;case"boolean":return a?"true":"false";case"object":case"array":return JSON.stringify(a);case"number":return isFinite(a)?a:"";default:return""}}}})}(zn); | ||
var __isServer="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),zn={VERSION:"0.0.1",DEBUG:!0,ZN_PATH:"",PATH:"",isServer:__isServer,GLOBAL:function(){return __isServer?global:window}.call(null)};if(zn.GLOBAL.zn=zn,__isServer)zn.ZN_PATH=__dirname,zn.PATH=process.cwd(),module.exports=zn;else{var _zn_url="";try{__a__=__b__}catch(e){e.fileName?_zn_url=e.fileName:e.sourceURL?_zn_url=e.sourceURL:e.stacktrace?console.log(e.stacktrace):e.stack?(_zn_url=e.stack.split("\n")[1],_zn_url=_zn_url.replace(/\s/g,""),_zn_url=_zn_url.substring(2,_zn_url.length)):console.log(e.toString())}if(!_zn_url)for(var _scripts=document.getElementsByTagName("script"),_src="",_node,i=0,_len=scripts.length;_len>i;i++)if(_node=scripts[i],_node.getAttribute&&(_src=_node.getAttribute("src")||"","zn.js"===_src.slice(-5)||"zn.minx.js"===_src.slice(-10))){_zn_url=_src;break}if(!_zn_url)throw new Error("zn.js has not been included, please do it first.");zn.ZN_PATH=_zn_url.substring(0,_zn_url.lastIndexOf("/")+1)}!function(a){var b=Object.prototype.toString,c={isNull:function(a){return null===a||void 0===a},isNotNull:function(a){return null!==a&&void 0!==a},idle:function(){},idleArray:function(){return[]},idleObject:function(){return{}},format:function(){var a=arguments,b=null,c=null;return a.length<2?a[0]:(b=a[0],b=b.toString?b.toString():b,c=a[1],d.each(c,function(a,c){null!==a&&void 0!==a&&(a=d.is(a,"object")?JSON.stringify(a):a.toString?a.toString():a,b=b.replace(new RegExp("\\{"+c+"\\}","gi"),a))}),b)},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)}).toUpperCase()},serializeJSON:function(a){return Object.keys(a).map(function(b){return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&")},fix:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&"function"!=typeof b[f]&&(b[f]=e[f])}return b},extend:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b},overwrite:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&void 0===b[f]&&(b[f]=e[f])}return b},path:function(a,b,c){var d=a||{};if(b){var e,f=b.split("."),g=f.length,h=0;if(arguments.length<3)for(;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e];else{for(g-=1;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e]=d[e]||{};e=f[h],d&&(d.__set__?d.__set__(e,c):d[e]=c,d=c)}}return d},invoke:function(b,c,d){if(b&&c){var e,f,g=c.lastIndexOf(".");g>0?(e=a.path(b,c.substring(0,g)),e&&(f=e[c.substring(g+1)])):(e=b,f=b[c]),f&&f.apply(e,d)}},deepEachObject:function(a,b,c){if(d.is(a,"object")){var e,f=null;for(var g in a)f=a[g],d.is(f,"object")?this.deepEachObject(f,b,c):(e=b&&b.call(c,f,g,a),void 0!==e&&null!==e&&(a[g]=e))}return a},arrayValueToObject:function(a,b,c){if(d.is(a,"array")){for(var e,f=null,g={},h=0,i=a.length;i>h;h++)f=a[h],e=b&&b.call(c,f,h,a),void 0!==e&&null!==e&&(g[f]=e);a=g}return a}},d={toString:function(a){return a&&a.toString?a.toString():b.call(a)},each:function(a,c,d){if(a&&c)if(a.__each__)a.__each__(c,d);else{var e=a.length,f=null;if(e>0&&"[object Array]"===b.call(a)){for(var g=0;e>g;g++)if(f=c.call(d,a[g],g),f===!1)return!1}else for(var h in a)if(a.hasOwnProperty(h)){if(f=c.call(d,a[h],h),f===!1)return!1;if(-1===f)continue}}},clone:function(b){if(b){if(b.__clone__)return b.__clone__();if(a.is(b,"array"))return b.slice(0);var c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c}return b},type:function(a){return a&&a.__type__?a.__type__:b.call(a).slice(8,-1).toLowerCase()},is:function(a,b){if(a&&a.__is__)return a.__is__(b);if("string"==typeof b)switch(b.toLowerCase()){case"plain":return a&&a.constructor===Object;default:return this.type(a)===b}else if("function"==typeof b)return a instanceof b},may:function(a,b){return a?a.__may__?a.__may__(b):a.hasOwnProperty("on"+b):!1},can:function(a,b){return a?a.__can__?a.__can__(b):"function"==typeof a[b]:!1},has:function(a,b){return a?a.__has__?a.__has__(b):a.hasOwnProperty(b):!1},get:function(a,b){return a?a.__get__?a.__get__(b):a[b]:void 0},set:function(a,b,c){a&&(a.__set__?a.__set__(b,c):a[b]=c)},gets:function(a){if(a){if(a.__gets__)return a.__gets__();var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}},sets:function(a,b){if(a&&b)if(a.__sets__)a.__sets__(b);else for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}};c.extend(a,c),c.extend(a,d)}(zn),function(a){{var b=Array.prototype.slice,c=Object.prototype.hasOwnProperty,d=Object.prototype.toString,e={format:function(){var b=arguments,c=this;return 1==b.length&&"object"==typeof b[0]&&(b=b[0]),a.each(b,function(b,d){null!==b&&void 0!==b&&(b="object"==a.type(b)?JSON.stringify(b):b.toString?b.toString():b,c=c.replace(new RegExp("\\{"+d+"\\}","gi"),b))}),c.toString()},firstUpperCase:function(a){return a.replace(/\b(\w)(\w*)/g,function(a,b,c){return b.toUpperCase()+c})}},f={isArray:function(b){return b&&"[object Array]"===a.toString(b)&&b.constructor===Array}},g={forEach:function(a,b){if(!a)return!1;for(var c=0,d=this.length;d>c;c++)a.call(b,this[c],c);return this},indexOf:function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},lastIndexOf:function(a){for(var b=this.length-1;b>=0;b--)if(this[b]===a)return b;return-1}},h={bind:function(a){var c=this;return function(){return c.apply(a,b.call(arguments,1))}}},i={toArray:function(a){return b.call(a)},keys:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(b);return d},values:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(a[b]);return d},create:function(){var b=function(){};return function(c,d){if(null===c)throw new Error("Cannot set a null [[Prototype]]");if("object"!=typeof c)throw new TypeError("Argument must be an object");return a.each(d,function(a,b){i.defineProperty(c,a,b)}),b.prototype=c,new b}}(),defineProperty:function(a,b,c){return a&&b&&c&&c.hasOwnProperty("value")&&(a[b]=c.value),a}};({parse:function(){return""},stringify:function(){var a=d,b=Array.isArray,c={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},e=function(a){return c[a]||"\\u"+(a.charCodeAt(0)+65536).toString(16).substr(1)},f=/[\\"\u0000-\u001F\u2028\u2029]/g;return function g(c){if(null==c)return"null";if("number"==typeof c)return isFinite(c)?c.toString():"null";if("boolean"==typeof c)return c.toString();if("object"==typeof c){var d;if("function"==typeof c.toJSON)return g(c.toJSON());if(b(c)){d="[";for(var h=0;h<c.length;h++)d+=(h?", ":"")+g(c[h]);return d+"]"}if("[object Object]"===a.call(c)){d=[];for(var i in c)c.hasOwnProperty(i)&&d.push(g(i)+": "+g(c[i]));return"{"+d.join(", ")+"}"}}return'"'+c.toString().replace(f,e)+'"'}}()})}a.fix(Array,f),a.fix(Array.prototype,g),a.fix(Function.prototype,h),a.fix(String.prototype,e)}(zn),function(a){function b(){}function c(){var c=l._arguments.apply(this,arguments),e=c.name,f=c.super,h=c.meta,i=h.methods.init;h.properties=h.properties||h.props,h.props=null,delete h.props;var j,k,n;if(f._static_)throw new Error("Static class cannot be inherited.");if(f._final_)throw new Error("Final class cannot be inherited.");if(e&&h.partial&&(j=a.path(d,e)),h.static){if(j){if(!j._static_)throw new Error('Partial class "'+e+'" must be static.')}else j=function(){throw new Error("Cannot instantiate static class.")};n=j.prototype}else{if(j){if(j._static_)throw new Error('Partial class "'+e+'" must not be static.');if(j._super_!==f&&j._super_!==b)throw new Error('Partial class "'+e+'" must have consistent super class.')}else j=h.abstract?function(){throw new Error("Cannot instantiate abstract class.")}:function(){var b=j._mixins_||[],c=j._ctors_||[],d=null,e=arguments;this.__id__=g++,this.__handlers__={},this.__initializing__=!0,this.__afters__=[];for(var f=null,h=null,i=0,k=b.length;k>i;i++)f=b[i],f["@init"]?(h=f["@init"].meta,h=a.is(h,"function")?h:h.value,m(f.prototype.__super__,this,e),h&&h.call(this)):m(f.prototype.__super__,this,e);m(this.__super__,this,e);for(var l=0,n=c.length;n>l;l++)d=c[l],d=a.is(d,"function")?d:d.value,d&&d.apply(this,e);for(;this.__afters__.length>0;){var o=this.__afters__.pop();o.handler.apply(o.context,e)}this.__afters__=null,delete this.__afters__,this.__initializing__=!1},j._ctors_=[];j._super_!==f?(k=function(){},k.prototype=f.prototype,n=new k,n.constructor=j,n.__type__=e||"Anonymous",n.__super__=f,j.prototype=n):n=j.prototype,n.class=n.constructor,i&&(j._ctors_.push(i),n.__ctor__||(n.__ctor__=i))}return l._meta(j,c),n.__define__&&n.__define__.call(j),e&&a.path(d,e,j),j}var d=a.GLOBAL,e="@",f=1,g=1,h={fixTargetCtor:function(a){return a instanceof b?a.constructor:a},fixTargetKey:function(a){return e+a},defineEvent:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d,g={};return f||(g=Object.defineProperty(a,"on"+b.toLowerCase(),{get:function(){var a=this.__handlers__[b];return a?a[0].handler:null},set:function(a){var c=this.__handlers__,d=c[b]=c[b]||[];d[0]={owner:this,handler:a,context:null}}})),d[e]={name:b,type:"event",meta:c,descriptor:g},f},defineProperty:function(b,c,d){var e,f,g=h.fixTargetCtor(b),i=h.fixTargetKey(c),j=i in g,k={};if("value"in d){var l=d.value,m="_"+c,n=d.get,o=d.set;e=n||function(){return m in this?this[m]:a.is(l,"function")?l.call(this):l},f=d.readonly?function(a,b){return b&&b.force?void(this[m]=a):!1}:o||function(a){this[m]=a}}else e=d.get||function(){return void 0},f=d.set||function(){return!1};return j&&(e.__super__=g[i].getter,f.__super__=g[i].setter),k=Object.defineProperty(b,c,{get:e,set:f,configurable:!0}),g[i]={name:c,type:"property",meta:d,getter:e,setter:f,descriptor:k},j},defineMethod:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d;return d[e]={name:b,type:"method",meta:c},b in a&&(c.value||(c.value=function(){}),c.value.__super__=a[b]),a[b]=c.value,f}},i={__handlers__:{},member:function(a,c){var d=h.fixTargetCtor(c||this),e=d[h.fixTargetKey(a)];return e||d===b?e:this.member(a,d._super_)},may:function(a){var b=this.member(a);return b&&"event"==b.type},has:function(a){var b=this.member(a);return b&&"property"==b.type},can:function(a){var b=this.member(a);return b&&"method"==b.type},get:function(a,b){var c=this.member(a);return c&&c.getter?c.getter.call(this,b):void 0},set:function(a,b,c){var d=this.member(a);return d&&d.setter&&d.setter.call(this,b,c),this},gets:function(b){var c={},d=h.fixTargetCtor(this)._properties_;return a.each(d,function(a){c[a]=this.get(a,b)},this),c},sets:function(a,b,c){if(a){var d=null;for(var e in a)a.hasOwnProperty(e)&&(d=a[e],(c&&c(d,e,b))!==!1&&this.set(e,d,b))}return this},each:function(a,b){for(var c=h.fixTargetCtor(this)._properties_,d=0,e=c.length;e>d;d++){var f=c[d],g=a.call(b,f,d,this.member(f),this.get(f));if(g===!1)return!1}return this},__may__:function(a){return this.may(a)},__has__:function(a){return this.has(a)},__can__:function(a){return this.can(a)},__get__:function(a){return this.get(a)},__gets__:function(){return this.gets()},__set__:function(a,b){this.set(a,b)},__sets__:function(a){this.sets(a)},__each__:function(a,b){return this.each(a,b)}},j={toString:function(){return"{ ClassName: "+(this._name_||"Anonymous")+", ClassID: "+this._id_+" }"},createSelf:function(){return new this.constructor.apply(this,Array.prototype.slice.call(arguments))},getProperties:function(b,c){var d={};if(!this.getMeta||"ZNObject"==this._name_)return d;var e=this._super_,f=this._mixins_;return e&&a.extend(d,e.getProperties(b,c)),f&&f.length&&a.each(f,function(e){a.extend(d,e.getProperties(b,c))}),a.each(this.getMeta("properties"),function(a,e){var f=b&&b.call(c||this,a,e,d);return f===!1||-1===f?f:void(a.hidden||(d[e]=a))},this),d},getProperty:function(a){var b=null;return a&&this.getProperties(function(c,d){return a==d&&(b=field),-1}),b},existProperty:function(a){return!!this.getProperty(a)},getMeta:function(a){return a?this._meta_[a]:this._meta_},setMeta:function(a,b){return a&&b&&(this._meta_[a]=b),this},defineEvent:function(a,b,c){return h.defineEvent(c||this.prototype,a,b)||this._events_.push(a),this},defineProperty:function(a,b,c){return h.defineProperty(c||this.prototype,a,b)||this._properties_.push(a),this},defineMethod:function(a,b,c){return h.defineMethod(c||this.prototype,a,b)||this._methods_.push(a),this}},k={toString:function(){var a={ClassName:this.__name__||"Anonymous",InstanceID:this.__id__,Meta:this.constructor._meta_};return JSON.stringify(a)},toJson:function(){var b={};return a.each(this.constructor.getProperties(),function(a,c){b[c]=this.get(c)},this),b},getProperties:function(){return this.constructor.getProperties.apply(this,arguments)},getPropertie:function(a){return this.constructor.getPropertie(a)},upon:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[];f[0]=a.extend({owner:this,handler:c},d)}return this},on:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[{owner:null,handler:null,context:null}];f.push(a.extend({owner:this,handler:c},d))}return this},off:function(a,b,c){var d,e=this.__handlers__[a]||[],f=c&&c.context;if(b)for(var g=e.length-1;g>=0;g--)d=e[g],d.handler!==b||f&&d.context!==f||this.__handlers__[a].splice(g,1);else this.__handlers__[a]=[{owner:null,handler:null,context:null}];return this},offs:function(){var b=Array.prototype.slice.call(arguments);return b.length?a.each(b,function(a){this.__handlers__[a]&&(this.__handlers__[a]=[{owner:null,handler:null,context:null}])}.bind(this)):this.__handlers__={},this},fire:function(a,b,c){var d,e=this.__handlers__[a],f=null;if(e)for(var g=0,h=e.length;h>g;g++)if(d=e[g],d&&d.handler&&(f=c&&"apply"==c.method?d.handler.apply(d.context||d.owner,b):d.handler.call(d.context||d.owner,d.owner,b,c),!1===f))return!1;return this},dispose:function(){return this.__handlers__={},this},destroy:function(){return this.dispose()},"super":function(){var a=this.super.caller.__super__;return a?a.apply(this,arguments):void 0},is:function(b){if("string"==typeof b&&(b=a.path(d,b)),b){if(this instanceof b)return!0;for(var c=this.constructor._mixins_,e=0,f=c.length;f>e;e++){var g=c[e];if(b===g)return!0}}return!1},__is__:function(a){return this.is(a)},__clone__:function(){}};a.extend(b,i,j,{_id_:0,_name_:"ZNObject",_statics_:{},_events_:[],_properties_:[],_methods_:[],_mixins_:[],_meta_:{}}),a.extend(b.prototype,i,k),a.isZNObject=function(a){return a instanceof b};var l={_arguments:function(){var c,d,e,f=arguments,g=f.length,h=f[0],i={"static":!1,statics:[],partial:!1,"abstract":!1,"final":!1,mixins:[],events:[],properties:[],methods:[]};if(3===g){if(c=h,d=f[1],e=f[2],!a.is(d,"function"))throw new Error("Invalid _super class.")}else if(2===g){if(a.is(h,"string"))c=h,d=null;else{if(!a.is(h,"function"))throw new Error("Invalid _super class.");c=null,d=h}e=f[1]}else{if(1!==g)throw new Error("Invalid arguments.");if(c=null,d=null,e=h,!a.is(e,"object"))throw new Error("The meta argument must be an object.")}return c=c||"",e=a.overwrite(e||{},i),d=d||b,{name:c,"super":d,meta:e}},_meta:function(b,c){var d=c.name,e=c.super,g=c.meta;return a.extend(b,i,j,{_id_:f++,_name_:d,_super_:e,_partial_:g.partial,_abstract_:g.abstract,_static_:g.static,_final_:g.final,_statics_:a.extend({},e._statics_,g.statics),_events_:e._events_.slice(0),_properties_:e._properties_.slice(0),_methods_:e._methods_.slice(0),_mixins_:e._mixins_.concat(g.mixins),_meta_:g}),a.extend(b,b._statics_),g.static?(a.each(g.events,function(a){b.defineEvent(a,{},b)}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c},b)}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c,b)}),g.methods.init&&g.methods.init.call(b,b)):(a.each(g.mixins,function(c){var d=c.prototype;a.each(c._events_,function(a){b.defineEvent(a,d.member(a).meta)}),a.each(c._properties_,function(a){b.defineProperty(a,d.member(a).meta)}),a.each(c._methods_,function(a){i[a]||k[a]||b.defineMethod(a,d.member(a).meta)})}),a.each(g.events,function(a){b.defineEvent(a,{})}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c})}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c)})),b}},m=function(c,d,e){if(c&&c!==b){var f=c.member("init"),g=c._mixins_,h=null;return f&&f.meta.after&&d.__afters__.push({context:d,handler:f.meta.after}),g.length&&a.each(g,function(b){b["@init"]&&(h=b["@init"].meta,h=a.is(h,"function")?h:h.value,m(b.prototype.__super__,b.prototype,e),h&&h.call(d))}),f&&f.meta.auto&&f.meta.value.apply(d,e),arguments.callee(c._super_,d)}};a.Class=c}(zn),function(a){var b=".",c="..",d="/",e={PENDING:0,LOADING:1,WAITING:2,LOADED:3},f=null;"undefined"!=typeof module&&module.exports?a.SLASH=d=require("path").sep:f=document;var g={normalizePath:function(a){for(var e,f=a.split(d),g=[f[0]],h=1,i=f.length;i>h;h++)switch(e=f[h]){case b:break;case c:var j=g[g.length-1];j===b||j===c?g.push(c):g.pop();break;default:g.push(e)}return g.join(d)},formatPath:function(b,c){var e=b;e="/"===d?e.split("\\").join(d):e.split("/").join(d);var f=c?c.get("path")||a.PATH:a.PATH,g=e.indexOf(d);return e.indexOf(a.PATH)>-1||e.indexOf(a.ZN_PATH)>-1?e:(e=g>0?f?f.substring(0,f.lastIndexOf(d)+1)+e:e:0===g?a.PATH.substring(0,a.PATH.lastIndexOf(d))+e:a.ZN_PATH+d+e+d,e.slice(-1)===d&&(e+="index.js"),e=this.normalizePath(e))}},h=a.Class("zn.Module",{events:["pending","loading","waiting","loaded"],statics:{all:{},current:null,counter:0,preLoadedPackage:{},unloadModule:function(b){try{if(!h.all[b])return this;b=require.resolve(b);var c=require.cache[b];c&&c.parent&&c.parent.children.splice(c.parent.children.indexOf(c),1),require.cache[b]=null;var d=h.all[b];h.all[b]=null,d&&d.parent&&h.unloadModule(d.parent.path)}catch(e){a.error(e.message)}return this},loadModule:function(b,c,d){if(a.is(b,h))return b.load(c);if("node:"===b.substring(0,5))return c(require(b.substring(5)));var i=null;if(a.NODE_PATHS&&a.NODE_PATHS.length&&a.NODE_PATHS.every(function(a){return 0===b.indexOf(a)?(i=b,!1):!0}),!i&&(i=g.formatPath(b,d),!f))try{i=require.resolve(i)}catch(j){return a.error("node require.resolve("+i+"): ",j.message),c({})}var k=h.all[i];k?k.load(c):(k=h.all[i]=new h(i),h.counter++,f?this.__webModule(i,function(a){if(h.counter--,a)throw new Error("Failed to load module:"+b);k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}):this.__nodeModule(i,function(){h.counter--,k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}))},__nodeModule:function(b,c){var d=b,e=c||a.idle,f={};try{f=require(d)}catch(g){console.error(g),a.error("Node.js require("+d+") error: ",g.message)}finally{e(f)}},__webModule:function(b,c){var e=f.head||f.getElementsByTagName("head")[0],g=f.createElement("script"),h=b,i=c||a.idle,j=function(a){g.onload=null,g.onerror=null,i(a)};h=h.slice(-1)===d?h+"index.js":h,h=".js"===h.slice(-3).toLowerCase()?h:h+".js",g.src=h,"onload"in g?g.onload=function(){j(null)}:g.onreadystatechange=function(a){var b=g.readyState;j("loaded"===b||"complete"===b?null:a)},g.onerror=function(a){j(a)},e.appendChild(g)}},properties:{parent:null,status:e.PENDING,path:"",dependencies:null,factory:null,value:{set:function(a){a._ctors_&&(a.$path=this.get("path")),this._value=a},get:function(){return this._value}}},methods:{init:function(a,b,c){this.sets({path:a,dependencies:b||[],factory:c,value:{}}),this._callbacks=[]},exec:function(a){var b=process.argv,c=b[1];return this.sets({path:c,status:e.LOADING}),this.load(a),this},__pending:function(a){this._callbacks.push(a)},__loading:function(b){var c=(this.get("path"),this.get("dependencies")),d=this._depHandler,f=this.get("factory"),g=this.get("value");this.set("status",e.WAITING),this._callbacks.push(b);var i=c.length;if(0===i)g=f.call(g)||g,this.set("value",g),this.set("status",e.LOADED),a.each(this._callbacks,function(a){a(g)});else{var j=[],k=this;a.each(c,function(b,c){d&&(b=d(b,c)),h.loadModule(b,function(b){j[c]=b,i--,0===i&&(g=f.apply(g,j)||g,k.set("value",g),k.set("status",e.LOADED),a.each(k._callbacks,function(a){a(g)}))},k)})}},__waiting:function(a){var b=this;setTimeout(function(){0===h.counter&&b.set("status",e.LOADING),b.load(a)})},__loaded:function(a){a(this.get("value"))},load:function(b){var c=this.get("status"),d=b||a.idle;switch(c){case e.PENDING:this.__pending(d);break;case e.LOADING:this.__loading(d);break;case e.WAITING:this.__waiting(d);break;case e.LOADED:this.__loaded(d)}return this}}});a.define=function(){var b=arguments,c=b.length,d=b[0],e=[],f=null;switch(c){case 1:a.is(d,"function")?f=d:a.is(d,"array")?(e=d,f=function(){var b={};return a.each(arguments,function(c){c._name_?b[c._name_]=c:a.extend(b,c)}),b}):f=function(){return d};break;case 2:e=d,f=b[1];break;case 3:e=d,f=b[1]}return e&&a.is(e,"string")&&(e=[e]),h.current=new h("",e,f),b[2]&&(h.current._depHandler=b[2]),h.current};var i=a.Class("zn.Loader",{"static":!0,properties:{preLoadPackages:[]},methods:{init:function(){for(var a=this.preLoadPackages,b=0,c=a.length;c>b;b++)this.loadPackage(a[b])},loadPackage:function(b){this.load(b+"index.js",function(b){a.extend(h.preLoadedPackage,b)})},load:function(a,b,c){return h.loadModule(a,b,c),this}}});a.load=i.load,a.module=h}(zn),function(a){var b={lower:[97,123],upper:[65,91]};a.char=a.Class({"static":!0,methods:{lowercase:function(b){return a.is(b,"string")?b.replace(/[A-Z]/g,function(a){return String.fromCharCode(32|a.charCodeAt(0))}):b},uppercase:function(b){return a.is(b,"string")?b.replace(/[a-z]/g,function(a){return String.fromCharCode(-33&a.charCodeAt(0))}):b},toUnicode:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a.charCodeAt(c));return b},toChar:function(a,b){for(var c=[],d=a;b>d;d++)c.push(String.fromCharCode(d));return c},getLowercaseLetters:function(){var a=b.lower;return this.toChar(a[0],a[1])},getUppercaseLetters:function(){var a=b.upper;return this.toChar(a[0],a[1])},getStringFromChar:function(a,b){for(var c=a||"A",d=b||26,e=[],f=0;d>f;f++)e.push(String.fromCharCode(c.charCodeAt(0)+f));return e.join("")}}})}(zn),function(a){var b={ISO8601:"yyyy-MM-dd hh:mm:ss.SSS",ISO8601_WITH_TZ_OFFSET:"yyyy-MM-ddThh:mm:ssO",DATETIME:"dd MM yyyy hh:mm:ss.SSS",ABSOLUTETIME:"hh:mm:ss.SSS"};a.date=a.Class({"static":!0,methods:{getSecond:function(a){var b=1*a.substring(1,a.length);switch(a.substring(0,1)){case"s":return 1e3*b;case"h":return 60*b*60*1e3;case"d":return 24*b*60*60*1e3}},asString:function(a){var c=b.ISO8601;"string"==typeof a&&(c=arguments[0],a=arguments[1]);var d=this.__addZero(a.getDate()),e=this.__addZero(a.getMonth()+1),f=this.__addZero(a.getFullYear()),g=this.__addZero(a.getFullYear().toString().substring(2,4)),h=c.indexOf("yyyy")>-1?f:g,i=this.__addZero(a.getHours()),j=this.__addZero(a.getMinutes()),k=this.__addZero(a.getSeconds()),l=this.__padWithZeros(a.getMilliseconds(),3),m=this.__offset(a),n=c.replace(/dd/g,d).replace(/MM/g,e).replace(/y{1,4}/g,h).replace(/hh/g,i).replace(/mm/g,j).replace(/ss/g,k).replace(/SSS/g,l).replace(/O/g,m);return n},__padWithZeros:function(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c},__addZero:function(a){return this.__padWithZeros(a,2)},__offset:function(a){var b=Math.abs(a.getTimezoneOffset()),c=String(Math.floor(b/60)),d=String(b%60);return 1==c.length&&(c="0"+c),1==d.length&&(d="0"+d),a.getTimezoneOffset()<0?"+"+c+d:"-"+c+d}}})}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,CANCLE:1,PAUSE:2,FINISHED:3},d=a.Class({events:["init","finished"],properties:{status:{value:c.PENDING,get:function(){return this._status}}},methods:{init:function(){},doTask:function(a,b){if(a){var c=b||[];c.unshift(this),a.handler.apply(a.context,c)}},done:function(){this._status=c.FINISHED,this._data=b.call(arguments),this.fire("finished",this._data),this.off("finished")}}}),e=a.Class({events:["clear","insert","pause","resume","exception","every","finally"],properties:{count:{get:function(){return this._tasks.length}}},methods:{init:function(a){this._exceptions=[],this._finallys=[],this._everys=[],this._tasks=[],this._taskProcessor=[],this._lastTask=null,this._data=[],this._max=(a||{}).max||1},destroy:function(){this._everys=[],this._tasks=[],this._taskProcessor=[],this.fire("finally",this._data,{method:"apply"}),this.super()},clear:function(){this._tasks=[]},pause:function(a){return this._paused=!0,a>0&&(this._pauseTimer=setTimeout(function(){this.resume()}.bind(this),a)),this.fire("pause"),this},resume:function(){return this._pauseTimer&&clearTimeout(this._pauseTimer),this._paused=!1,this.fire("resume"),this.doTask(),this},exception:function(a,b){return this.on("exception",a,b||this),this},"catch":function(a){return this.fire("exception",a),this},"finally":function(a,b){return this.on("finally",a,b||this),this},every:function(a,b){return this.on("every",a,b||this),this},unshift:function(a,b){return this.insert(a,b,0),this},push:function(a,b){return this.insert(a,b,-1),this},inserts:function(a,b,c){var d=a||[],e=c||0,f=this._tasks[0],g=null,h=null;return d=d.map(function(a){return h={handler:a,context:b||this},g&&(h.previous=g,g.next=h),g=h,h}.bind(this)),f&&(g.next=f,f.previous=g),d.unshift(0),d.unshift(e),this._tasks.splice.apply(this._tasks,d),this},insert:function(a,b,c){var d={handler:a,context:b||this},e=c||-1;switch(e){case-1:this._lastTask&&(d.previous=d,this._lastTask.next=d),this._lastTask=d,this._tasks.push(d);break;case 0:var f=this._tasks[0];f&&(d.next=f,f.previous=d),this._tasks.unshift(d);break;default:this._tasks.splice(e,0,d)}return this.fire("insert",d),this},getTaskProcessor:function(){for(var a=null,b=this._taskProcessor.length,e=0;b>e;e++)if(a=this._taskProcessor[e],a.status==c.FINISHED)return a;if(!a&&this._max>b){var f=new d;return f.queue=this,f.on("finished",this.__onProcessorFinished.bind(this),this),f}},start:function(){return this._data=[],this.doTask()},doTask:function(a){var b=this._tasks.shift();if(b){var c=this.getTaskProcessor();c&&(b.previousResult=a,c.doTask(b,a))}else this.destroy();return this},__onProcessorFinished:function(a,b){this._data.push(b),this.fire("every",b,{method:"apply"}),this.doTask(b)}}});a.queue=function(a){return new e(a)}}(zn),function(a){var b=["INFO","DEBUG","WARN","ERROR","TRACE","ALL"],c=["#100000","#2125a0","#a82c2c","#c045b7","1cb131","#100000"],d=[38,34,35,31,32,36,33],e={INFO:0,DEBUG:1,WARN:2,ERROR:3,TRACE:4,ALL:6},f=a.Class({events:["info","debug","warn","error","trace","all"],methods:{init:function(){this._config={only:null,levels:["info","debug","warn","error","trace","all"]}},config:function(b){this._config=a.overwrite(b,this._config)},info:function(){this.__log.call(this,e.INFO,arguments)},debug:function(){this.__log.call(this,e.DEBUG,arguments)},warn:function(){this.__log.call(this,e.WARN,arguments)},trace:function(){this.__log.call(this,e.TRACE,arguments)},error:function(){this.__log.call(this,e.ERROR,arguments)},all:function(){this.__log.call(this,e.ALL,arguments)},__getDateString:function(b){return a.date.asString(b||new Date)},__getPosition:function(){try{throw new Error}catch(b){return a.DEBUG&&a.CONSOLE_ERROR&&console.log(b.stack),b.stack.split("\n")[5].replace(/\(/g,"").replace(/\)/g,"").split("/").pop()}},__formatLog4Server:function(a,c){var e="",f="",g="";return c&&(f="[",g="[0m",e=d[5]+"m",c=d[a.type]+"m"),[a.time," [",f,c,b[a.type],g,"] [",f,e,a.pos,g,"] ",a.message].join("")},__formatLog4Client:function(a){return["%c"+a.time," [",b[a.type],"] "].join("")},__log:function(d,e){var f=Array.prototype.slice.call(e),g=f.slice(0),h=b[d].toLowerCase(),i=this.__getDateString(),j=this.__getPosition();if(g.unshift(j),g.unshift(h),g.unshift(i),"undefined"!=typeof module&&module.exports?f.unshift(this.__formatLog4Server({type:d,time:i,pos:j},!0)):(f.unshift("color:"+c[d]),f.unshift(this.__formatLog4Client({type:d,time:i,pos:j},!0))),this.__isOk(h)){var k=this.fire(h,g);k!==!1&&a.DEBUG&&console.log.apply(this,f)}},__isOk:function(a){if(this._config.only){if(this._config.only===a)return!0}else{var b=-1!==this._config.levels.indexOf(a);if(b)return!0}return!1}}});a.logger=new f;var g={info:function(){a.logger.info.apply(a.logger,arguments)},debug:function(){a.logger.debug.apply(a.logger,arguments)},warn:function(){a.logger.warn.apply(a.logger,arguments)},trace:function(){a.logger.trace.apply(a.logger,arguments)},error:function(){a.logger.error.apply(a.logger,arguments)}};a.extend(a,g)}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,FULFILLED:1,REJECTED:2},d=a.Class({events:["complete"],properties:{promise:null},methods:{init:function(a,b){this._promise=new e,a&&this.resolve(a),b&&this.reject(b)},resolve:function(){var d=b.call(arguments);try{var e=this.get("promise"),g=this;if(e.get("readyState")!=c.PENDING)return;e.set("readyState",c.FULFILLED),e.set("data",d),a.each(e.get("resolves"),function(a){a.apply(g,d)})}catch(h){f.catch(h,this)}this.fire("complete",d)},reject:function(){var a=b.call(arguments);try{var d=this.get("promise");if(d.get("readyState")!=c.PENDING)return;d.set("readyState",c.REJECTED),d.set("reason",a);var e=d.get("rejects")[0];e&&e.apply(this,a)}catch(g){f.catch(g,this)}this.fire("complete",a)}}}),e=a.Class({statics:{isPromise:function(a){return null!==a&&void 0!==a&&"function"==typeof a.then},defer:null},properties:{resolves:null,rejects:null,data:null,reason:null,readyState:null},methods:{init:function(){this.set("resolves",[]),this.set("rejects",[]),this.set("exceptions",[]),this.set("readyState",c.PENDING)},then:function(a,f){function g(){var c=b.call(arguments),d=a?a.apply(this,c):c;return e.isPromise(d)?d.then(function(){h.resolve.apply(h,b.call(arguments))}):h.resolve.apply(h,d),d}var h=new d;if(this.get("readyState")===c.PENDING)this.get("resolves").push(g),this.get("rejects").push(f?f:function(){h.reject.apply(h,b.call(arguments))});else if(this.get("readyState")===c.FULFILLED){var i=this;setTimeout(function(){g.apply(i,i.get("data"))})}return h.promise},"catch":function(a){return f.exception(a)},"finally":function(a){return f.finally(a)},otherwise:function(a){return this.then(void 0,a)}}}),f=a.async=a.Class({"static":!0,methods:{init:function(){this._exceptions=[],this._finallys=[],this._count=0,this._currIndex=0,this._dataArray=[]},exception:function(a){return this._exceptions.push(a),this},"catch":function(b,c){return a.each(this._exceptions,function(a){a.call(c,b)}),this},"finally":function(a){return this._finallys.push(a),this},defer:function(b,c){var e=this,f=new d(b,c);return f.on("complete",function(b,c){e._currIndex++,e._dataArray.push(c),e._currIndex==e._count&&(a.each(e._finallys,function(b){try{b(e._dataArray)}catch(c){a.error(c.message)}}),e._finallys=[])}),e._count++,f},all:function(b){var c=f.defer(),d=0,e=[];return a.each(b,function(a){a.then(function(a){e.push(a),d++,d>=b.length&&c.resolve(e)})}),c.promise},any:function(b){var c=f.defer();return a.each(b,function(a){a.then(function(a){c.resolve(a)})}),c.promise}}})}(zn),function(){zn.querystring=zn.Class({"static":!0,properties:{config:{get:function(){}}},methods:{init:function(){this._config={separator:"&",equal:"=",minIndex:0,maxIndex:1e3}},config:function(a){return this.overwrite(this._config,a),this},parse:function(a,b){var c=zn.extend({},this._config,b),d={},e=c.equal,f=a.split(c.separator),g=f.length;c.maxIndex>0&&g>c.maxIndex&&(g=c.maxIndex);for(var h=c.minIndex;g>h;h++){var i=f[h].replace(/\+/g,"%20"),j=i.indexOf(e),k=null,l=null;j>=0?(k=i.substr(0,j),l=i.substr(j+1)):(k=i,l=""),k=decodeURIComponent(k),l=decodeURIComponent(l),hasOwnProperty(d,k)?zn.is(d[k],"array")?d[k].push(l):d[k]=[d[k],l]:d[k]=l}return d},stringify:function(a,b){var c=zn.extend({},this._config,b),d=[],e=c.equal,f={};if(f=zn.isZNObject(a)?a.gets():a,!zn.is(f,"object"))throw new Error("Agrument Error.");for(var g in a){var h=a[g],i=encodeURIComponent(this.__stringifyValue(g)); | ||
h=encodeURIComponent(this.__stringifyValue(h)),d.push(i+e+h)}return d.join(c.separator)},__stringifyValue:function(a){switch(zn.type(a)){case"string":return a;case"boolean":return a?"true":"false";case"object":case"array":return JSON.stringify(a);case"number":return isFinite(a)?a:"";default:return""}}}})}(zn); |
@@ -1,2 +0,2 @@ | ||
var __isServer="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),zn={VERSION:"0.0.1",DEBUG:!0,ZN_PATH:"",PATH:"",isServer:__isServer,GLOBAL:function(){return __isServer?global:window}.call(null)};if(zn.GLOBAL.zn=zn,__isServer)zn.ZN_PATH=__dirname,zn.PATH=process.cwd(),module.exports=zn;else{var _zn_url="";try{__a__=__b__}catch(e){e.fileName?_zn_url=e.fileName:e.sourceURL?_zn_url=e.sourceURL:e.stacktrace?console.log(e.stacktrace):e.stack?(_zn_url=e.stack.split("\n")[1],_zn_url=_zn_url.replace(/\s/g,""),_zn_url=_zn_url.substring(2,_zn_url.length)):console.log(e.toString())}if(!_zn_url)for(var _scripts=document.getElementsByTagName("script"),_src="",_node,i=0,_len=scripts.length;_len>i;i++)if(_node=scripts[i],_node.getAttribute&&(_src=_node.getAttribute("src")||"","zn.js"===_src.slice(-5)||"zn.minx.js"===_src.slice(-10))){_zn_url=_src;break}if(!_zn_url)throw new Error("zn.js has not been included, please do it first.");zn.ZN_PATH=_zn_url.substring(0,_zn_url.lastIndexOf("/")+1)}!function(a){var b=Object.prototype.toString,c={idle:function(){},idleArray:function(){return[]},idleObject:function(){return{}},format:function(){var a=arguments,b=null,c=null;return a.length<2?a[0]:(b=a[0],b=b.toString?b.toString():b,c=a[1],d.each(c,function(a,c){null!==a&&void 0!==a&&(a=d.is(a,"object")?JSON.stringify(a):a.toString?a.toString():a,b=b.replace(new RegExp("\\{"+c+"\\}","gi"),a))}),b)},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)}).toUpperCase()},serializeJSON:function(a){return Object.keys(a).map(function(b){return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&")},fix:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&"function"!=typeof b[f]&&(b[f]=e[f])}return b},extend:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b},overwrite:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&void 0===b[f]&&(b[f]=e[f])}return b},path:function(a,b,c){var d=a||{};if(b){var e,f=b.split("."),g=f.length,h=0;if(arguments.length<3)for(;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e];else{for(g-=1;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e]=d[e]||{};e=f[h],d&&(d.__set__?d.__set__(e,c):d[e]=c,d=c)}}return d},invoke:function(b,c,d){if(b&&c){var e,f,g=c.lastIndexOf(".");g>0?(e=a.path(b,c.substring(0,g)),e&&(f=e[c.substring(g+1)])):(e=b,f=b[c]),f&&f.apply(e,d)}},deepEachObject:function(a,b,c){if(d.is(a,"object")){var e,f=null;for(var g in a)f=a[g],d.is(f,"object")?this.deepEachObject(f,b,c):(e=b&&b.call(c,f,g,a),void 0!==e&&null!==e&&(a[g]=e))}return a},arrayValueToObject:function(a,b,c){if(d.is(a,"array")){for(var e,f=null,g={},h=0,i=a.length;i>h;h++)f=a[h],e=b&&b.call(c,f,h,a),void 0!==e&&null!==e&&(g[f]=e);a=g}return a}},d={toString:function(a){return a&&a.toString?a.toString():b.call(a)},each:function(a,c,d){if(a&&c)if(a.__each__)a.__each__(c,d);else{var e=a.length,f=null;if(e>0&&"[object Array]"===b.call(a)){for(var g=0;e>g;g++)if(f=c.call(d,a[g],g),f===!1)return!1}else for(var h in a)if(a.hasOwnProperty(h)){if(f=c.call(d,a[h],h),f===!1)return!1;if(-1===f)continue}}},clone:function(b){if(b){if(b.__clone__)return b.__clone__();if(a.is(b,"array"))return b.slice(0);var c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c}return b},type:function(a){return a&&a.__type__?a.__type__:b.call(a).slice(8,-1).toLowerCase()},is:function(a,b){if(a&&a.__is__)return a.__is__(b);if("string"==typeof b)switch(b.toLowerCase()){case"plain":return a&&a.constructor===Object;default:return this.type(a)===b}else if("function"==typeof b)return a instanceof b},may:function(a,b){return a?a.__may__?a.__may__(b):a.hasOwnProperty("on"+b):!1},can:function(a,b){return a?a.__can__?a.__can__(b):"function"==typeof a[b]:!1},has:function(a,b){return a?a.__has__?a.__has__(b):a.hasOwnProperty(b):!1},get:function(a,b){return a?a.__get__?a.__get__(b):a[b]:void 0},set:function(a,b,c){a&&(a.__set__?a.__set__(b,c):a[b]=c)},gets:function(a){if(a){if(a.__gets__)return a.__gets__();var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}},sets:function(a,b){if(a&&b)if(a.__sets__)a.__sets__(b);else for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}};c.extend(a,c),c.extend(a,d)}(zn),function(a){{var b=Array.prototype.slice,c=Object.prototype.hasOwnProperty,d=Object.prototype.toString,e={format:function(){var b=arguments,c=this;return 1==b.length&&"object"==typeof b[0]&&(b=b[0]),a.each(b,function(b,d){null!==b&&void 0!==b&&(b="object"==a.type(b)?JSON.stringify(b):b.toString?b.toString():b,c=c.replace(new RegExp("\\{"+d+"\\}","gi"),b))}),c.toString()}},f={isArray:function(b){return b&&"[object Array]"===a.toString(b)&&b.constructor===Array}},g={forEach:function(a,b){if(!a)return!1;for(var c=0,d=this.length;d>c;c++)a.call(b,this[c],c);return this},indexOf:function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},lastIndexOf:function(a){for(var b=this.length-1;b>=0;b--)if(this[b]===a)return b;return-1}},h={bind:function(a){var c=this;return function(){return c.apply(a,b.call(arguments,1))}}},i={toArray:function(a){return b.call(a)},keys:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(b);return d},values:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(a[b]);return d},create:function(){var b=function(){};return function(c,d){if(null===c)throw new Error("Cannot set a null [[Prototype]]");if("object"!=typeof c)throw new TypeError("Argument must be an object");return a.each(d,function(a,b){i.defineProperty(c,a,b)}),b.prototype=c,new b}}(),defineProperty:function(a,b,c){return a&&b&&c&&c.hasOwnProperty("value")&&(a[b]=c.value),a}};({parse:function(){return""},stringify:function(){var a=d,b=Array.isArray,c={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},e=function(a){return c[a]||"\\u"+(a.charCodeAt(0)+65536).toString(16).substr(1)},f=/[\\"\u0000-\u001F\u2028\u2029]/g;return function g(c){if(null==c)return"null";if("number"==typeof c)return isFinite(c)?c.toString():"null";if("boolean"==typeof c)return c.toString();if("object"==typeof c){var d;if("function"==typeof c.toJSON)return g(c.toJSON());if(b(c)){d="[";for(var h=0;h<c.length;h++)d+=(h?", ":"")+g(c[h]);return d+"]"}if("[object Object]"===a.call(c)){d=[];for(var i in c)c.hasOwnProperty(i)&&d.push(g(i)+": "+g(c[i]));return"{"+d.join(", ")+"}"}}return'"'+c.toString().replace(f,e)+'"'}}()})}a.fix(Array,f),a.fix(Array.prototype,g),a.fix(Function.prototype,h),a.fix(String.prototype,e)}(zn),function(a){function b(){}function c(){var c,e,f,h=l._arguments.apply(this,arguments),i=h.name,j=h.super,k=h.meta,n=k.methods.init;if(j._static_)throw new Error("Static class cannot be inherited.");if(j._final_)throw new Error("Final class cannot be inherited.");if(i&&k.partial&&(c=a.path(d,i)),k.static){if(c){if(!c._static_)throw new Error('Partial class "'+i+'" must be static.')}else c=function(){throw new Error("Cannot instantiate static class.")};f=c.prototype}else{if(c){if(c._static_)throw new Error('Partial class "'+i+'" must not be static.');if(c._super_!==j&&c._super_!==b)throw new Error('Partial class "'+i+'" must have consistent super class.')}else c=k.abstract?function(){throw new Error("Cannot instantiate abstract class.")}:function(){var b=c._mixins_||[],d=c._ctors_||[],e=null,f=arguments;this.__id__=g++,this.__handlers__={},this.__initializing__=!0,this.__afters__=[];for(var h=null,i=null,j=0,k=b.length;k>j;j++)h=b[j],h["@init"]?(i=h["@init"].meta,i=a.is(i,"function")?i:i.value,m(h.prototype.__super__,this,f),i&&i.call(this)):m(h.prototype.__super__,this,f);m(this.__super__,this,f);for(var l=0,n=d.length;n>l;l++)e=d[l],e=a.is(e,"function")?e:e.value,e&&e.apply(this,f);for(;this.__afters__.length>0;){var o=this.__afters__.pop();o.handler.apply(o.context,f)}this.__afters__=null,delete this.__afters__,this.__initializing__=!1},c._ctors_=[];c._super_!==j?(e=function(){},e.prototype=j.prototype,f=new e,f.constructor=c,f.__type__=i||"Anonymous",f.__super__=j,c.prototype=f):f=c.prototype,f.class=f.constructor,n&&(c._ctors_.push(n),f.__ctor__||(f.__ctor__=n))}return l._meta(c,h),f.__define__&&f.__define__.call(c),i&&a.path(d,i,c),c}var d=a.GLOBAL,e="@",f=1,g=1,h={fixTargetCtor:function(a){return a instanceof b?a.constructor:a},fixTargetKey:function(a){return e+a},defineEvent:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d,g={};return f||(g=Object.defineProperty(a,"on"+b.toLowerCase(),{get:function(){var a=this.__handlers__[b];return a?a[0].handler:null},set:function(a){var c=this.__handlers__,d=c[b]=c[b]||[];d[0]={owner:this,handler:a,context:null}}})),d[e]={name:b,type:"event",meta:c,descriptor:g},f},defineProperty:function(b,c,d){var e,f,g=h.fixTargetCtor(b),i=h.fixTargetKey(c),j=i in g,k={};if("value"in d){var l=d.value,m="_"+c,n=d.get,o=d.set;e=n||function(){return m in this?this[m]:a.is(l,"function")?l.call(this):l},f=d.readonly?function(a,b){return b&&b.force?void(this[m]=a):!1}:o||function(a){this[m]=a}}else e=d.get||function(){return void 0},f=d.set||function(){return!1};return j&&(e.__super__=g[i].getter,f.__super__=g[i].setter),k=Object.defineProperty(b,c,{get:e,set:f,configurable:!0}),g[i]={name:c,type:"property",meta:d,getter:e,setter:f,descriptor:k},j},defineMethod:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d;return d[e]={name:b,type:"method",meta:c},b in a&&(c.value||(c.value=function(){}),c.value.__super__=a[b]),a[b]=c.value,f}},i={__handlers__:{},member:function(a,c){var d=h.fixTargetCtor(c||this),e=d[h.fixTargetKey(a)];return e||d===b?e:this.member(a,d._super_)},may:function(a){var b=this.member(a);return b&&"event"==b.type},has:function(a){var b=this.member(a);return b&&"property"==b.type},can:function(a){var b=this.member(a);return b&&"method"==b.type},get:function(a,b){var c=this.member(a);return c&&c.getter?c.getter.call(this,b):void 0},set:function(a,b,c){var d=this.member(a);return d&&d.setter&&d.setter.call(this,b,c),this},gets:function(b){var c={},d=h.fixTargetCtor(this)._properties_;return a.each(d,function(a){c[a]=this.get(a,b)},this),c},sets:function(a,b,c){if(a){var d=null;for(var e in a)a.hasOwnProperty(e)&&(d=a[e],(c&&c(d,e,b))!==!1&&this.set(e,d,b))}return this},each:function(a,b){for(var c=h.fixTargetCtor(this)._properties_,d=0,e=c.length;e>d;d++){var f=c[d],g=a.call(b,f,d,this.member(f),this.get(f));if(g===!1)return!1}return this},__may__:function(a){return this.may(a)},__has__:function(a){return this.has(a)},__can__:function(a){return this.can(a)},__get__:function(a){return this.get(a)},__gets__:function(){return this.gets()},__set__:function(a,b){this.set(a,b)},__sets__:function(a){this.sets(a)},__each__:function(a,b){return this.each(a,b)}},j={toString:function(){return"{ ClassName: "+(this._name_||"Anonymous")+", ClassID: "+this._id_+" }"},createSelf:function(){return new this.constructor.apply(this,Array.prototype.slice.call(arguments))},getProperties:function(b){var c={};if(!this.getMeta||"ZNObject"==this._name_)return c;var d=this._super_,e=this._mixins_;return d&&a.extend(c,d.getProperties(b)),e&&e.length&&a.each(e,function(d){a.extend(c,d.getProperties(b))}),a.each(this.getMeta("properties"),function(a,d){var e=b&&b(d,a)===!1;e||a.hidden||(c[d]=a)}),c},getPropertie:function(b){var c=null;return b&&a.each(this.getProperties(),function(a,d){return b==d&&(c=a),-1}),c},getMeta:function(a){return a?this._meta_[a]:this._meta_},setMeta:function(a,b){return this._meta_[a]=b,this},defineEvent:function(a,b,c){return h.defineEvent(c||this.prototype,a,b)||this._events_.push(a),this},defineProperty:function(a,b,c){return h.defineProperty(c||this.prototype,a,b)||this._properties_.push(a),this},defineMethod:function(a,b,c){return h.defineMethod(c||this.prototype,a,b)||this._methods_.push(a),this}},k={toString:function(){var a={ClassName:this.__name__||"Anonymous",InstanceID:this.__id__,Meta:this.constructor._meta_};return JSON.stringify(a)},toJson:function(){var b={};return a.each(this.constructor.getProperties(),function(a,c){b[c]=this.get(c)},this),b},getProperties:function(){return this.constructor.getProperties()},getPropertie:function(a){return this.constructor.getPropertie(a)},upon:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[];f[0]=a.extend({owner:this,handler:c},d)}return this},on:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[{owner:null,handler:null,context:null}];f.push(a.extend({owner:this,handler:c},d))}return this},off:function(a,b,c){var d,e=this.__handlers__[a]||[],f=c&&c.context;if(b)for(var g=e.length-1;g>=0;g--)d=e[g],d.handler!==b||f&&d.context!==f||this.__handlers__[a].splice(g,1);else this.__handlers__[a]=[{owner:null,handler:null,context:null}];return this},offs:function(){var b=Array.prototype.slice.call(arguments);return b.length?a.each(b,function(a){this.__handlers__[a]&&(this.__handlers__[a]=[{owner:null,handler:null,context:null}])}.bind(this)):this.__handlers__={},this},fire:function(a,b,c){var d,e=this.__handlers__[a],f=null;if(e)for(var g=0,h=e.length;h>g;g++)if(d=e[g],d&&d.handler&&(f=c&&"apply"==c.method?d.handler.apply(d.context||d.owner,b):d.handler.call(d.context||d.owner,d.owner,b,c),!1===f))return!1;return this},dispose:function(){return this.__handlers__={},this},destroy:function(){return this.dispose()},"super":function(){var a=this.super.caller.__super__;return a?a.apply(this,arguments):void 0},is:function(b){if("string"==typeof b&&(b=a.path(d,b)),b){if(this instanceof b)return!0;for(var c=this.constructor._mixins_,e=0,f=c.length;f>e;e++){var g=c[e];if(b===g)return!0}}return!1},__is__:function(a){return this.is(a)},__clone__:function(){}};a.extend(b,i,j,{_id_:0,_name_:"ZNObject",_statics_:{},_events_:[],_properties_:[],_methods_:[],_mixins_:[],_meta_:{}}),a.extend(b.prototype,i,k),a.isZNObject=function(a){return a instanceof b};var l={_arguments:function(){var c,d,e,f=arguments,g=f.length,h=f[0],i={"static":!1,statics:[],partial:!1,"abstract":!1,"final":!1,mixins:[],events:[],properties:[],methods:[]};if(3===g){if(c=h,d=f[1],e=f[2],!a.is(d,"function"))throw new Error("Invalid _super class.")}else if(2===g){if(a.is(h,"string"))c=h,d=null;else{if(!a.is(h,"function"))throw new Error("Invalid _super class.");c=null,d=h}e=f[1]}else{if(1!==g)throw new Error("Invalid arguments.");if(c=null,d=null,e=h,!a.is(e,"object"))throw new Error("The meta argument must be an object.")}return c=c||"",e=a.overwrite(e||{},i),d=d||b,{name:c,"super":d,meta:e}},_meta:function(b,c){var d=c.name,e=c.super,g=c.meta;return a.extend(b,i,j,{_id_:f++,_name_:d,_super_:e,_partial_:g.partial,_abstract_:g.abstract,_static_:g.static,_final_:g.final,_statics_:a.extend({},e._statics_,g.statics),_events_:e._events_.slice(0),_properties_:e._properties_.slice(0),_methods_:e._methods_.slice(0),_mixins_:e._mixins_.concat(g.mixins),_meta_:g}),a.extend(b,b._statics_),g.static?(a.each(g.events,function(a){b.defineEvent(a,{},b)}),a.each(g.properties||g.props,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c},b)}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c,b)}),g.methods.init&&g.methods.init.call(b,b)):(a.each(g.mixins,function(c){var d=c.prototype;a.each(c._events_,function(a){b.defineEvent(a,d.member(a).meta)}),a.each(c._properties_,function(a){b.defineProperty(a,d.member(a).meta)}),a.each(c._methods_,function(a){i[a]||k[a]||b.defineMethod(a,d.member(a).meta)})}),a.each(g.events,function(a){b.defineEvent(a,{})}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c})}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c)})),b}},m=function(c,d,e){if(c&&c!==b){var f=c.member("init"),g=c._mixins_,h=null;return f&&f.meta.after&&d.__afters__.push({context:d,handler:f.meta.after}),g.length&&a.each(g,function(b){b["@init"]&&(h=b["@init"].meta,h=a.is(h,"function")?h:h.value,m(b.prototype.__super__,b.prototype,e),h&&h.call(d))}),f&&f.meta.auto&&f.meta.value.apply(d,e),arguments.callee(c._super_,d)}};a.Class=c}(zn),function(a){var b=".",c="..",d="/",e={PENDING:0,LOADING:1,WAITING:2,LOADED:3},f=null;"undefined"!=typeof module&&module.exports?a.SLASH=d=require("path").sep:f=document;var g={normalizePath:function(a){for(var e,f=a.split(d),g=[f[0]],h=1,i=f.length;i>h;h++)switch(e=f[h]){case b:break;case c:var j=g[g.length-1];j===b||j===c?g.push(c):g.pop();break;default:g.push(e)}return g.join(d)},formatPath:function(b,c){var e=b;e="/"===d?e.split("\\").join(d):e.split("/").join(d);var f=c?c.get("path")||a.PATH:a.PATH,g=e.indexOf(d);return e.indexOf(a.PATH)>-1||e.indexOf(a.ZN_PATH)>-1?e:(e=g>0?f?f.substring(0,f.lastIndexOf(d)+1)+e:e:0===g?a.PATH.substring(0,a.PATH.lastIndexOf(d))+e:a.ZN_PATH+d+e+d,e.slice(-1)===d&&(e+="index.js"),e=this.normalizePath(e))}},h=a.Class("zn.Module",{events:["pending","loading","waiting","loaded"],statics:{all:{},current:null,counter:0,preLoadedPackage:{},unloadModule:function(b){try{if(!h.all[b])return this;b=require.resolve(b);var c=require.cache[b];c&&c.parent&&c.parent.children.splice(c.parent.children.indexOf(c),1),require.cache[b]=null;var d=h.all[b];h.all[b]=null,d&&d.parent&&h.unloadModule(d.parent.path)}catch(e){a.error(e.message)}return this},loadModule:function(b,c,d){if(a.is(b,h))return b.load(c);if("node:"===b.substring(0,5))return c(require(b.substring(5)));var i=null;if(a.NODE_PATHS&&a.NODE_PATHS.length&&a.NODE_PATHS.every(function(a){return 0===b.indexOf(a)?(i=b,!1):!0}),!i&&(i=g.formatPath(b,d),!f))try{i=require.resolve(i)}catch(j){return a.error("node require.resolve("+i+"): ",j.message),c({})}var k=h.all[i];k?k.load(c):(k=h.all[i]=new h(i),h.counter++,f?this.__webModule(i,function(a){if(h.counter--,a)throw new Error("Failed to load module:"+b);k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}):this.__nodeModule(i,function(){h.counter--,k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}))},__nodeModule:function(b,c){var d=b,e=c||a.idle,f={};try{f=require(d)}catch(g){console.error(g),a.error("Node.js require("+d+") error: ",g.message)}finally{e(f)}},__webModule:function(b,c){var e=f.head||f.getElementsByTagName("head")[0],g=f.createElement("script"),h=b,i=c||a.idle,j=function(a){g.onload=null,g.onerror=null,i(a)};h=h.slice(-1)===d?h+"index.js":h,h=".js"===h.slice(-3).toLowerCase()?h:h+".js",g.src=h,"onload"in g?g.onload=function(){j(null)}:g.onreadystatechange=function(a){var b=g.readyState;j("loaded"===b||"complete"===b?null:a)},g.onerror=function(a){j(a)},e.appendChild(g)}},properties:{parent:null,status:e.PENDING,path:"",dependencies:null,factory:null,value:{set:function(a){a._ctors_&&(a.$path=this.get("path")),this._value=a},get:function(){return this._value}}},methods:{init:function(a,b,c){this.sets({path:a,dependencies:b||[],factory:c,value:{}}),this._callbacks=[]},exec:function(a){var b=process.argv,c=b[1];return this.sets({path:c,status:e.LOADING}),this.load(a),this},__pending:function(a){this._callbacks.push(a)},__loading:function(b){var c=(this.get("path"),this.get("dependencies")),d=this._depHandler,f=this.get("factory"),g=this.get("value");this.set("status",e.WAITING),this._callbacks.push(b);var i=c.length;if(0===i)g=f.call(g)||g,this.set("value",g),this.set("status",e.LOADED),a.each(this._callbacks,function(a){a(g)});else{var j=[],k=this;a.each(c,function(b,c){d&&(b=d(b,c)),h.loadModule(b,function(b){j[c]=b,i--,0===i&&(g=f.apply(g,j)||g,k.set("value",g),k.set("status",e.LOADED),a.each(k._callbacks,function(a){a(g)}))},k)})}},__waiting:function(a){var b=this;setTimeout(function(){0===h.counter&&b.set("status",e.LOADING),b.load(a)})},__loaded:function(a){a(this.get("value"))},load:function(b){var c=this.get("status"),d=b||a.idle;switch(c){case e.PENDING:this.__pending(d);break;case e.LOADING:this.__loading(d);break;case e.WAITING:this.__waiting(d);break;case e.LOADED:this.__loaded(d)}return this}}});a.define=function(){var b=arguments,c=b.length,d=b[0],e=[],f=null;switch(c){case 1:a.is(d,"function")?f=d:a.is(d,"array")?(e=d,f=function(){var b={};return a.each(arguments,function(c){c._name_?b[c._name_]=c:a.extend(b,c)}),b}):f=function(){return d};break;case 2:e=d,f=b[1];break;case 3:e=d,f=b[1]}return e&&a.is(e,"string")&&(e=[e]),h.current=new h("",e,f),b[2]&&(h.current._depHandler=b[2]),h.current};var i=a.Class("zn.Loader",{"static":!0,properties:{preLoadPackages:[]},methods:{init:function(){for(var a=this.preLoadPackages,b=0,c=a.length;c>b;b++)this.loadPackage(a[b])},loadPackage:function(b){this.load(b+"index.js",function(b){a.extend(h.preLoadedPackage,b)})},load:function(a,b,c){return h.loadModule(a,b,c),this}}});a.load=i.load,a.module=h}(zn),function(a){var b={lower:[97,123],upper:[65,91]};a.char=a.Class({"static":!0,methods:{lowercase:function(b){return a.is(b,"string")?b.replace(/[A-Z]/g,function(a){return String.fromCharCode(32|a.charCodeAt(0))}):b},uppercase:function(b){return a.is(b,"string")?b.replace(/[a-z]/g,function(a){return String.fromCharCode(-33&a.charCodeAt(0))}):b},toUnicode:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a.charCodeAt(c));return b},toChar:function(a,b){for(var c=[],d=a;b>d;d++)c.push(String.fromCharCode(d));return c},getLowercaseLetters:function(){var a=b.lower;return this.toChar(a[0],a[1])},getUppercaseLetters:function(){var a=b.upper;return this.toChar(a[0],a[1])},getStringFromChar:function(a,b){for(var c=a||"A",d=b||26,e=[],f=0;d>f;f++)e.push(String.fromCharCode(c.charCodeAt(0)+f));return e.join("")}}})}(zn),function(a){var b={ISO8601:"yyyy-MM-dd hh:mm:ss.SSS",ISO8601_WITH_TZ_OFFSET:"yyyy-MM-ddThh:mm:ssO",DATETIME:"dd MM yyyy hh:mm:ss.SSS",ABSOLUTETIME:"hh:mm:ss.SSS"};a.date=a.Class({"static":!0,methods:{getSecond:function(a){var b=1*a.substring(1,a.length);switch(a.substring(0,1)){case"s":return 1e3*b;case"h":return 60*b*60*1e3;case"d":return 24*b*60*60*1e3}},asString:function(a){var c=b.ISO8601;"string"==typeof a&&(c=arguments[0],a=arguments[1]);var d=this.__addZero(a.getDate()),e=this.__addZero(a.getMonth()+1),f=this.__addZero(a.getFullYear()),g=this.__addZero(a.getFullYear().toString().substring(2,4)),h=c.indexOf("yyyy")>-1?f:g,i=this.__addZero(a.getHours()),j=this.__addZero(a.getMinutes()),k=this.__addZero(a.getSeconds()),l=this.__padWithZeros(a.getMilliseconds(),3),m=this.__offset(a),n=c.replace(/dd/g,d).replace(/MM/g,e).replace(/y{1,4}/g,h).replace(/hh/g,i).replace(/mm/g,j).replace(/ss/g,k).replace(/SSS/g,l).replace(/O/g,m);return n},__padWithZeros:function(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c},__addZero:function(a){return this.__padWithZeros(a,2)},__offset:function(a){var b=Math.abs(a.getTimezoneOffset()),c=String(Math.floor(b/60)),d=String(b%60);return 1==c.length&&(c="0"+c),1==d.length&&(d="0"+d),a.getTimezoneOffset()<0?"+"+c+d:"-"+c+d}}})}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,CANCLE:1,PAUSE:2,FINISHED:3},d=a.Class({events:["init","finished"],properties:{status:{value:c.PENDING,get:function(){return this._status}}},methods:{init:function(){},doTask:function(a,b){if(a){var c=b||[];c.unshift(this),a.handler.apply(a.context,c)}},done:function(){this._status=c.FINISHED,this._data=b.call(arguments),this.fire("finished",this._data),this.off("finished")}}}),e=a.Class({events:["clear","insert","pause","resume","exception","every","finally"],properties:{count:{get:function(){return this._tasks.length}}},methods:{init:function(a){this._exceptions=[],this._finallys=[],this._everys=[],this._tasks=[],this._taskProcessor=[],this._lastTask=null,this._data=[],this._max=(a||{}).max||1},destroy:function(){this._everys=[],this._tasks=[],this._taskProcessor=[],this.fire("finally",this._data,{method:"apply"}),this.super()},clear:function(){this._tasks=[]},pause:function(a){return this._paused=!0,a>0&&(this._pauseTimer=setTimeout(function(){this.resume()}.bind(this),a)),this.fire("pause"),this},resume:function(){return this._pauseTimer&&clearTimeout(this._pauseTimer),this._paused=!1,this.fire("resume"),this.doTask(),this},exception:function(a,b){return this.on("exception",a,b||this),this},"catch":function(a){return this.fire("exception",a),this},"finally":function(a,b){return this.on("finally",a,b||this),this},every:function(a,b){return this.on("every",a,b||this),this},unshift:function(a,b){return this.insert(a,b,0),this},push:function(a,b){return this.insert(a,b,-1),this},inserts:function(a,b,c){var d=a||[],e=c||0,f=this._tasks[0],g=null,h=null;return d.map(function(a){return h={handler:a,context:b||this},g&&(h.previous=g,g.next=h),g=h,h}.bind(this)),f&&(g.next=f,f.previous=g),d.unshift(0),d.unshift(e),this._tasks.splice.apply(this._tasks,d),this},insert:function(a,b,c){var d={handler:a,context:b||this},e=c||-1;switch(e){case-1:this._lastTask&&(d.previous=d,this._lastTask.next=d),this._lastTask=d,this._tasks.push(d);break;case 0:var f=this._tasks[0];f&&(d.next=f,f.previous=d),this._tasks.unshift(d);break;default:this._tasks.splice(e,0,d)}return this.fire("insert",d),this},getTaskProcessor:function(){for(var a=null,b=this._taskProcessor.length,e=0;b>e;e++)if(a=this._taskProcessor[e],a.status==c.FINISHED)return a;if(!a&&this._max>b){var f=new d;return f.queue=this,f.on("finished",this.__onProcessorFinished.bind(this),this),f}},start:function(){return this._data=[],this.doTask()},doTask:function(a){var b=this._tasks.shift();if(b){var c=this.getTaskProcessor();c&&(b.previousResult=a,c.doTask(b,a))}else this.destroy();return this},__onProcessorFinished:function(a,b){this._data.push(b),this.fire("every",b,{method:"apply"}),this.doTask(b)}}});a.queue=function(a){return new e(a)}}(zn),function(a){var b=["INFO","DEBUG","WARN","ERROR","TRACE","ALL"],c=["#100000","#2125a0","#a82c2c","#c045b7","1cb131","#100000"],d=[38,34,35,31,32,36,33],e={INFO:0,DEBUG:1,WARN:2,ERROR:3,TRACE:4,ALL:6},f=a.Class({events:["info","debug","warn","error","trace","all"],methods:{init:function(){this._config={only:null,levels:["info","debug","warn","error","trace","all"]}},config:function(b){this._config=a.overwrite(b,this._config)},info:function(){this.__log.call(this,e.INFO,arguments)},debug:function(){this.__log.call(this,e.DEBUG,arguments)},warn:function(){this.__log.call(this,e.WARN,arguments)},trace:function(){this.__log.call(this,e.TRACE,arguments)},error:function(){this.__log.call(this,e.ERROR,arguments)},all:function(){this.__log.call(this,e.ALL,arguments)},__getDateString:function(b){return a.date.asString(b||new Date)},__getPosition:function(){try{throw new Error}catch(b){return a.DEBUG&&a.CONSOLE_ERROR&&console.log(b),b.stack.split("\n")[5].replace(/\(/g,"").replace(/\)/g,"").split("/").pop()}},__formatLog4Server:function(a,c){var e="",f="",g="";return c&&(f="[",g="[0m",e=d[5]+"m",c=d[a.type]+"m"),[a.time," [",f,c,b[a.type],g,"] [",f,e,a.pos,g,"] ",a.message].join("")},__formatLog4Client:function(a){return["%c"+a.time," [",b[a.type],"] "].join("")},__log:function(d,e){var f=Array.prototype.slice.call(e),g=f.slice(0),h=b[d].toLowerCase(),i=this.__getDateString(),j=this.__getPosition();if(g.unshift(j),g.unshift(h),g.unshift(i),"undefined"!=typeof module&&module.exports?f.unshift(this.__formatLog4Server({type:d,time:i,pos:j},!0)):(f.unshift("color:"+c[d]),f.unshift(this.__formatLog4Client({type:d,time:i,pos:j},!0))),this.__isOk(h)){var k=this.fire(h,g);k!==!1&&a.DEBUG&&console.log.apply(this,f)}},__isOk:function(a){if(this._config.only){if(this._config.only===a)return!0}else{var b=-1!==this._config.levels.indexOf(a);if(b)return!0}return!1}}});a.logger=new f;var g={info:function(){a.logger.info.apply(a.logger,arguments)},debug:function(){a.logger.debug.apply(a.logger,arguments)},warn:function(){a.logger.warn.apply(a.logger,arguments)},trace:function(){a.logger.trace.apply(a.logger,arguments)},error:function(){a.logger.error.apply(a.logger,arguments)}};a.extend(a,g)}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,FULFILLED:1,REJECTED:2},d=a.Class({events:["complete"],properties:{promise:null},methods:{init:function(a,b){this._promise=new e,a&&this.resolve(a),b&&this.reject(b)},resolve:function(){var d=b.call(arguments);try{var e=this.get("promise"),g=this;if(e.get("readyState")!=c.PENDING)return;e.set("readyState",c.FULFILLED),e.set("data",d),a.each(e.get("resolves"),function(a){a.apply(g,d)})}catch(h){f.catch(h,this)}this.fire("complete",d)},reject:function(){var a=b.call(arguments);try{var d=this.get("promise");if(d.get("readyState")!=c.PENDING)return;d.set("readyState",c.REJECTED),d.set("reason",a);var e=d.get("rejects")[0];e&&e.apply(this,a)}catch(g){f.catch(g,this)}this.fire("complete",a)}}}),e=a.Class({statics:{isPromise:function(a){return null!==a&&void 0!==a&&"function"==typeof a.then},defer:null},properties:{resolves:null,rejects:null,data:null,reason:null,readyState:null},methods:{init:function(){this.set("resolves",[]),this.set("rejects",[]),this.set("exceptions",[]),this.set("readyState",c.PENDING)},then:function(a,f){function g(){var c=b.call(arguments),d=a?a.apply(this,c):c;return e.isPromise(d)?d.then(function(){h.resolve.apply(h,b.call(arguments))}):h.resolve.apply(h,d),d}var h=new d;if(this.get("readyState")===c.PENDING)this.get("resolves").push(g),this.get("rejects").push(f?f:function(){h.reject.apply(h,b.call(arguments))});else if(this.get("readyState")===c.FULFILLED){var i=this;setTimeout(function(){g.apply(i,i.get("data"))})}return h.promise},"catch":function(a){return f.exception(a)},"finally":function(a){return f.finally(a)},otherwise:function(a){return this.then(void 0,a)}}}),f=a.async=a.Class({"static":!0,methods:{init:function(){this._exceptions=[],this._finallys=[],this._count=0,this._currIndex=0,this._dataArray=[]},exception:function(a){return this._exceptions.push(a),this},"catch":function(b,c){return a.each(this._exceptions,function(a){a.call(c,b)}),this},"finally":function(a){return this._finallys.push(a),this},defer:function(b,c){var e=this,f=new d(b,c);return f.on("complete",function(b,c){e._currIndex++,e._dataArray.push(c),e._currIndex==e._count&&(a.each(e._finallys,function(b){try{b(e._dataArray)}catch(c){a.error(c.message)}}),e._finallys=[])}),e._count++,f},all:function(b){var c=f.defer(),d=0,e=[];return a.each(b,function(a){a.then(function(a){e.push(a),d++,d>=b.length&&c.resolve(e)})}),c.promise},any:function(b){var c=f.defer();return a.each(b,function(a){a.then(function(a){c.resolve(a)})}),c.promise}}})}(zn),function(){zn.querystring=zn.Class({"static":!0,properties:{config:{get:function(){}}},methods:{init:function(){this._config={separator:"&",equal:"=",minIndex:0,maxIndex:1e3}},config:function(a){return this.overwrite(this._config,a),this},parse:function(a,b){var c=zn.extend({},this._config,b),d={},e=c.equal,f=a.split(c.separator),g=f.length;c.maxIndex>0&&g>c.maxIndex&&(g=c.maxIndex);for(var h=c.minIndex;g>h;h++){var i=f[h].replace(/\+/g,"%20"),j=i.indexOf(e),k=null,l=null;j>=0?(k=i.substr(0,j),l=i.substr(j+1)):(k=i,l=""),k=decodeURIComponent(k),l=decodeURIComponent(l),hasOwnProperty(d,k)?zn.is(d[k],"array")?d[k].push(l):d[k]=[d[k],l]:d[k]=l}return d},stringify:function(a,b){var c=zn.extend({},this._config,b),d=[],e=c.equal,f={};if(f=zn.isZNObject(a)?a.gets():a,!zn.is(f,"object"))throw new Error("Agrument Error.");for(var g in a){var h=a[g],i=encodeURIComponent(this.__stringifyValue(g));h=encodeURIComponent(this.__stringifyValue(h)),d.push(i+e+h)}return d.join(c.separator)},__stringifyValue:function(a){switch(zn.type(a)){case"string":return a;case"boolean":return a?"true":"false";case"object":case"array":return JSON.stringify(a);case"number":return isFinite(a)?a:"";default:return""}}}})}(zn),function(a){var b=Array.prototype,c=b.push,d=b.sort,e=b.join,f=b.slice,g=b.splice,h=b.indexOf,i=b.lastIndexOf,j=b.forEach,k=function(b){if(a.is(b,l))return b.toArray(); | ||
if(a.is(b,"array"))return b.slice(0);var c=[];return a.each(b,function(a){c.push(a)}),c},l=a.Class("zn.data.List",{properties:{count:{get:function(){return this.length},set:function(){throw new Error("Unable to set count of List")}}},methods:{init:{auto:!0,value:function(a){this.length=0,this.insertRange(a,0)}},unique:function(){},dispose:function(){this.clear()},add:function(a){var b=this.length;return c.call(this,a),b},addRange:function(a){return this.insertRange(a,this.length)},remove:function(a){var b=this.indexOf(a);return b>=0?(g.call(this,b,1),b):-1},removeAt:function(a){return g.call(this,a,1)[0]},insert:function(a,b){return g.call(this,b,0,a),a},insertRange:function(a,b){return g.apply(this,[b,0].concat(k(a))),b},clear:function(){return g.call(this,0)},getItem:function(a){if(a<this.length)return this[a];throw new Error("Index out of range.")},setItem:function(a,b){if(!(a<this.length))throw new Error("Index out of range.");this[a]=b},getRange:function(a,b){return new l(f.call(this,a,a+b))},indexOf:function(a){return h.call(this,a)},lastIndexOf:function(a){return i.call(this,a)},contains:function(a){return this.indexOf(a)>=0},toggle:function(a){this.contains(a)?this.remove(a):this.add(a)},sort:function(a){return d.call(this,a)},each:function(a,b){j.call(this,a,b)},toArray:function(){return f.call(this,0)},join:function(){return e.call(this)}}})}(zn),function(a){a.Class("zn.data.TList",{statics:{getInstance:function(a){return new this(a)}},properties:{min:0,max:100,TClass:null,TClassArgv:{}},methods:{init:function(a){this.sets(a),this.reset()},reset:function(){this._data=[];for(var a=0;a<(this.min||0);a++)this.push(this.TClassArgv)},push:function(a){if(this.TClass){var b=new this.TClass(a||this.TClassArgv);return this._data.push(b),b}},findOneT:function(b){var c=null,d=b||a.idle;return a.each(this._data,function(a,b){return d(a,b)?(c=a,-1):void 0}),c},findAllT:function(b){var c=[],d=b||a.idle;return a.each(this._data,function(a,b){d(a,b)&&c.push(a)}),c}}})}(zn),function(a){a.Class("zn.data.Task",{statics:{getInstance:function(a){return new this(a)},PANDING:0,WAITING:1,DOING:2,DONE:3},properties:{statue:0},methods:{init:function(a){this.sets(a)}}})}(zn),function(a){var b=a.Class("zn.data.Observable",{properties:{},methods:{init:{auto:!0,value:function(){this.__watchers__={}}},dispose:function(){a.each(this.__watchers__,function(a,b){this.__unbind(b,this.get(b))},this),this.__watchers__=null},watch:function(b,c,d){var e="*"===b?this.constructor._properties_:a.is(b,"array")?b:[b];return e.forEach(function(a){this.__watch(a,c,d)},this),this},unwatch:function(b,c,d){var e="*"===b?this.constructor._properties_:a.is(b,"array")?b:[b];return e.forEach(function(a){this.__unwatch(a,c,d)},this),this},notify:function(b){var c="*"===b?Object.keys(this.__watchers__):a.is(b,"array")?b:[b];return a.each(c,function(a){this.__notify(a)},this),this},__watch:function(a,c,d){var e=a.indexOf("."),f=a,g="",h=this.__watchers__;if(e>=0){f=a.slice(0,e),g=a.slice(e+1);var i=this.get(f);i&&i.watch&&i.watch(g,c,d)}var j=h[f]=h[f]||[];j.push({handler:c,context:d,fullPath:a,subPath:g});var k=this.member(f);if(k&&"property"===k.type){var l=k.meta;if(!l.watched){var m=k.getter,n=k.setter;b.defineProperty(f,{get:function(a){return m.call(this,a)},set:function(a,b){var c=m.call(this);(c!==a||b&&b.force)&&(this.__unbind(f,c),n.call(this,a,b)!==!1&&(this.__bind(f,a),this.notify(f)))},watched:!0},this)}}},__unwatch:function(a,b,c){var d=a.indexOf("."),e=a,f="",g=this.__watchers__;if(d>=0){e=a.slice(0,d),f=a.slice(d+1);var h=this.get(e);h&&h.unwatch&&h.unwatch(f,b,c)}var i,j=g[e];if(!j)return!1;if(b){for(var k=0,l=j.length;l>k;k++)if(i=j[k],i.handler===b&&i.context===c){j.splice(k,1);break}}else j.length=0},__bind:function(b,c){c&&c.watch&&a.each(this.__watchers__[b],function(a){a.subPath&&c.watch(a.subPath,a.handler,a.context)})},__unbind:function(b,c){c&&c.unwatch&&a.each(this.__watchers__[b],function(a){a.subPath&&c.unwatch(a.subPath,a.handler,a.context)})},__notify:function(b){var c=this.get(b);a.each(this.__watchers__[b],function(b){b&&b.handler&&b.handler.call(b.context,a.path(c,b.subPath),b.fullPath,this)},this)}}})}(zn),function(a){var b=a.Class({properties:{direction:{value:"oneway",readonly:!0},target:{value:null,readonly:!0},targetPath:{value:"",readonly:!0},source:{get:function(a){return a?this._owner:this._source},set:function(a){this._source=a,this.__rebind()}},sourcePaths:{get:function(){return this._sourcePaths},set:function(a){this._sourcePaths=this.__parseSourcePaths(a,function(a){a&&this.__rebind()}.bind(this))}},owner:{get:function(){return this._owner}},converter:{value:null},async:{value:!1}},methods:{init:function(b,c,d){{var e=d||{},f=b.member(c);f&&f.meta.binding||{}}a.overwrite(e,{direction:"oneway",converter:{}});var g=this._direction=e.direction;this._source=e.source,this._sourcePaths=this.__parseSourcePaths(e.sourcePaths),this._owner=e.owner||b,this._converter=this.__parseConverter(e),this._target=b,this._targetPath=c,("twoway"===g||"oneway"===g)&&this.__rebind(),("twoway"===g||"inverse"===g)&&b.watch(c,function(a){this.__updateSource(a)},this)},dispose:function(){this._source=null,this.__rebind()},__updateSource:function(b){var c=this._converter,d=null;return a.each(this.sourcePaths,function(e){d=c.revert.call(c.context,b),a.path(this.get("source",e[0]),e[1],d)},this),this},__updateTarget:function(){var b=this,c=[],d=null,e=this._owner,f=this._target,g=null,h=this._targetPath,i=this._converter;return a.each(this.sourcePaths,function(f){d=a.path(b.get("source",f[0]),f[1]),d=a.is(d,"function")?d.bind(e):d,c.push(d)}),g=i.convert.apply(i.context,c),f.set(h,g),this},__rebind:function(){var b=this._sourcePaths,c=this._watchers;return c&&(a.each(c,function(a){a.source.unwatch(a.path,a.handler)}),this._watchers=null),a.each(b,function(b){var d=b[0],e=b[1],f=this.get("source",d);a.can(f,"watch")&&(f.watch(e,this.__updateTarget.bind(this)),c=c||[],c.push({source:f,path:e,handler:this.__updateTarget}))},this),this.__updateTarget()},__parseSourcePaths:function(a,b){for(var c=a.split(","),d="",e=!1,f=0,g=c.length;g>f;f++)d=c[f].trim(),"#"===d.charAt(0)&&(d=d.substring(1),e=!0),c[f]=[e,d],b&&b(e,d);return c},__parseConverter:function(b){var c=b.converter;(a.is(c,"string")||a.is(c,"function"))&&(c={convert:c});var d=c.convert=b.convert||c.convert||function(a){return a};if(c.revert=b.revert||function(a){return a},c.context=b.context||this.owner,a.is(d,"string")){var e=d.lastIndexOf("."),f=d,g=this.source||this.owner,h="";e>0&&(h=d.slice(0,e),f=d.slice(e+1),g=a.path(this.source,h)),d=g&&g[f]}return c.convert=d,c}}}),c=a.Class("zn.data.Bindable",a.data.Observable,{statics:{parseOptions:function(b,c){var d=null;if("string"==typeof b&&"{"===b.charAt(0)&&"}"===b.charAt(b.length-1)){var e=b.slice(1,-1),f=e.split(";");d={owner:c,sourcePaths:f.shift()},a.each(f,function(a){if(!a)return-1;var b=a.split("=");d[b[0]]=b[1]})}else"object"==typeof b&&(d=b);return d}},properties:{model:{get:function(){return this._model},set:function(b){this._model=b,a.each(this.__bindings__,function(a){a.set("source",b)})}}},methods:{init:{auto:!0,value:function(){this.__bindings__={}},after:function(){this.__binding()}},dispose:function(){this.super(),a.each(this.__bindings__,function(a){a.dispose()}),this.__bindings__=null},let:function(a,b,d,e){var f=c.parseOptions(b);f?(f.owner=d,this.setBinding(a,f,e)):this.set(a,b)},getBinding:function(a){return this.__bindings__[a]},setBinding:function(a,c,d){return c.source=c.model||this.get("model"),c.owner=c.owner||this,this.clearBinding(a),this.__bindings__[a]=new b(d||this,c.targetPath||a,c),this},clearBinding:function(a){var b=this.__bindings__[a];b&&(b.dispose(),delete this.__bindings__[a])},__binding:function(){var b=this,c=this.constructor.getMeta("properties");a.each(c,function(a,c){a&&a.binding&&b.let(c,a.binding)})}}})}(zn),function(a){a.Class("zn.data.Map",{properties:{count:{get:function(){var a=0;return this.each(function(){a++}),a}},keys:{get:function(){return Object.keys(this._map)},set:function(){throw new Error("Unable to set keys of Map")}},values:{get:function(){return this.__getMapValues()},set:function(){throw new Error("Unable to set values of Map")}}},methods:{init:{auto:!0,value:function(a){this._map={},this.concat(a)}},concat:function(b){if(b){var c=(this._map,this);a.each(b,function(a,b){c.set(b,a)})}return this},contains:function(a){return a in this._map},getItem:function(a){return this._map[a]},get:function(a){if(this.has(a))return this.super(a);var b=this.getItem(a);return b&&b.value},set:function(a,b){if(this.has(a))return this.super(a);var c=a,d=this._map[c];return d||(d=this._map[c]={key:c}),d.value=b,this},remove:function(a){return delete this._map[a],this},clear:function(){return this._map={},this},each:function(b,c){return a.each(this._map,b,c),this},eachKey:function(b,c){return a.each(this.keys,b,c),this},eachValue:function(b,c){return a.each(this.values,b,c),this},toArray:function(){var a=[];return this.each(function(b){a.push(b)}),a},toObject:function(){var a={};return this.each(function(b){a[b.key]=b.value}),a},__getMapValues:function(){var a=[];return this.each(function(b){a.push(b.value)}),a}}})}(zn),function(a){a.Class("zn.data.ObservableList",a.data.List,{mixins:[a.data.Observable],events:["change"],methods:{add:function(a){var b=this.super(a);return this.notify("count"),this.fire("change",{action:"add",items:[a],index:b}),b},addRange:function(a){var b=this.super(a);return this.notify("count"),this.fire("change",{action:"add",items:a,index:b}),b},insert:function(a,b){return this.super(a,b),this.notify("count"),this.fire("change",{action:"add",items:[a],index:b}),b},insertRange:function(a,b){return this.super(a,b),this.notify("count"),this.fire("change",{action:"add",items:a,index:b}),b},remove:function(a){var b=this.super(a);return b>=0&&(this.notify("count"),this.fire("change",{action:"remove",items:[a],index:b})),index},removeAt:function(a){var b=this.super(a);return void 0!==b&&(this.notify("count"),this.fire("change",{action:"remove",items:[b],index:a})),b},clear:function(){var a=this.super();return this.notify("count"),this.fire("change",{action:"clear",items:a}),a},sort:function(a){var b=this.super(a);return this.notify("count"),this.fire("change",{action:"sort",sort:a||function(a,b){return a>b?1:b>a?-1:0}}),b}}})}(zn),function(a){a.Class("zn.data.ObservableMap",a.data.Map,{mixins:[a.data.Observable],events:["change"],methods:{set:function(a,b){if(this.has(a))return this.super(a);var c=this._map,d={key:a,value:b};if(a in c){var e=c[a];c[a]=d,this.fire("change",{action:"replace",oldItem:e,newItem:d})}else c[a]=d,this.notify("count"),this.fire("change",{action:"add",items:[d]})},remove:function(a){var b=this._map;if(a in b){var c=b[a];delete b[a],this.notify("count"),this.fire("change",{action:"remove",items:[c]})}},clear:function(){this.toArray();return this.super(),this.notify("count"),this.fire("change",{action:"clear",items:this.toArray()}),this}}})}(zn),function(a){var b=(a.Class({events:["init","start","stop","cancle","goNext","goPre"],properties:{pre:null,next:null,delay:null,action:null,args:[],context:this,taskList:null,status:{value:"",get:function(){return this._status}}},methods:{init:function(a){this.sets(a),this.fire("init",this)},start:function(){"started"!=this._status&&(this._action?(this._action.apply(this._context,this._args),this._status="started"):this.goNext(),this.fire("start",this))},stop:function(){this._status="stoped",this.fire("stop",this)},cancle:function(){this._status="cancle",this.fire("cancle",this)},goNext:function(){this._next&&this._next.start(),this.fire("goNext",this)},goPre:function(){this._pre&&this._pre.start(),this.fire("goPre",this)}}}),a.Class({properties:{url:"",data:{set:function(a){this._data=a},get:function(){return a.is(this._data,"object")?JSON.stringify(this._data):this._data}},method:"GET",asyns:!0,username:null,password:null,headers:{get:function(){return a.overwrite({"X-Requested-With":"XMLHttpRequest","Content-type":"application/json"},this._headers)},set:function(a){this._headers=a}},timeout:{get:function(){return this._timeout||2e4},set:function(a){this._timeout=a}}},events:["before","after","success","error","complete","timeout"],methods:{init:function(a){this.sets(a),this._isRunning=!1},__initXMLHttpRequest:function(){if(this._XMLHttpRequest)return this._XMLHttpRequest;if(!window.ActiveXObject)return this._XMLHttpRequest=new XMLHttpRequest,this._XMLHttpRequest;for(var a="MSXML2.XMLHTTP",b=["Microsoft.XMLHTTP",a,a+".3.0",a+".4.0",a+".5.0",a+".6.0"],c=b.length-1;c>-1;c--)try{return this._XMLHttpRequest=new ActiveXObject(b[c]),this._XMLHttpRequest}catch(d){continue}},__onComplete:function(a,b){clearTimeout(this._timeoutID),a.abort(),this._isRunning=!1,this.fire("complete",a,b),this.fire("after",a,b),this.offs()},__initRequestHeader:function(a,b){for(var c in b)a.setRequestHeader(c,b[c])},resetEvents:function(){this.offs()},send:function(b){if(this._isRunning)return!1;this.sets(b);var c=this.__initXMLHttpRequest(),d=this,e=a.async.defer();if(this._isRunning=!0,this.timeout&&(this._timeoutID=setTimeout(function(){d._isRunning&&(d.fire("timeout",d),d.__onComplete(c,"timeout"))},this.timeout)),this.fire("before",this)===!1||!this.url)return this.__onComplete(c),e.promise;var f=this.url,g=this.data,h=this._method.toUpperCase();return"GET"===h&&(g&&(f=f+"?"+g),g=null),c.readyState<2,c.open(h,f,this.asyns),c.onreadystatechange=function(a){var b=a.currentTarget;if(4==b.readyState){var c=b.status,d=b.responseText,f=b.getResponseHeader("Content-Type");if(c>=200&&300>c){try{d=f&&f.indexOf("application/json")>=0?JSON.parse(d):d}catch(g){d=d}this.fire("success",d),e.resolve(d,b)}else this.fire("error",b),e.reject(b,d);return this.__onComplete(b,d),d}}.bind(this),this.__initRequestHeader(c,this.headers),c.send(g),this.asyns||this.__onComplete(c),e.promise},abort:function(){this._XMLHttpRequest&&this._XMLHttpRequest.abort()}}})),c=a.Class({"static":!0,properties:{max:3,count:{get:function(){return this._data.length}}},methods:{init:function(){this._data=[]},getInstance:function(){for(var a=0,c=this._data.length;c>a;a++)if(!this._data[a]._isRunning)return this._data[a].resetEvents(),this._data[a];return function(a){var c=new b;return a._data.push(c),c}(this)}}});a.http=a.Class({"static":!0,properties:{timeout:1e3},methods:{request:function(b,d){var e=c.getInstance();return a.each(b,function(a,b){"function"==typeof a&&e.on(b,a,this)},this),d&&d(e),e.send(b)},get:function(a){return a.method="GET",this.request(a)},post:function(a){return a.method="POST",this.request(a)},put:function(a){return a.method="PUT",this.request(a)},"delete":function(a){return a.method="DELETE",this.request(a)}}})}(zn),function(a){var b=a.Class({events:["init","validate","before","success","error","complete","after"],properties:{url:null,data:null,method:"POST",headers:null},methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},validateArgv:function(a,b,c,d){var e=a||this._url||"",f=b||this._data||{},g=c||this._method||"POST",h=d||this._headers||{},i={url:e,data:f,method:g,headers:h};return i},exec:function(a,b,c,d){var e=this.validateArgv(a,b,c,d),f=Store.fire("before",e);return f===!1?!1:(f=this.fire("before",e),f===!1?!1:e)},__onComplete:function(a){var b=Store.fire("after",a);return b===!1?!1:(b=this.fire("complete",a),b===!1?!1:void 0)},__onSuccess:function(a,b){var c=Store.fire("success",a,b);return c===!1?!1:(c=this.fire("success",a,b),c===!1?!1:void 0)},__onError:function(a){var b=Store.fire("success",a);return b===!1?!1:(b=this.fire("success",a),b===!1?!1:void 0)},refresh:function(a,b,c,d){return this.exec(a,b,c,d)},clone:function(b){var c=this._data;return c="object"==typeof c?a.extend(JSON.parse(JSON.stringify(c)),b):b,new this.constructor(this._url,c,this._method,this._headers)},extend:function(b){return this._data=a.extend(this._data,b),this},overwrite:function(b){return this._data=a.overwrite(this._data,b),this}}}),c=a.Class(b,{methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},exec:function(b,c,d,e){var f=this.validateArgv(b,c,d,e),g=Store.fire("before",f);return g===!1?!1:(g=this.fire("before",f),g===!1?!1:f===!1?!1:a.http[f.method.toLowerCase()]({url:Store.fixURL(f.url),data:f.data,headers:f.headers,success:function(a,b,c){this.__onSuccess(b,c)}.bind(this),error:function(a,b){this.__onError(b)}.bind(this),complete:function(a,b){this.__onComplete(b)}.bind(this)}))}}}),d=a.Class(b,{methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},exec:function(b,c,d,e){var f=this.validateArgv(b,c,d,e),g=Store.fire("before",f);if(g===!1)return!1;if(g=this.fire("before",f),g===!1)return!1;if(f===!1)return!1;var h=f.url,i=f.method,j=f.data,k=f.headers,l=this,m={method:i.toUpperCase()};switch(i.toUpperCase()){case"POST":var n=new FormData;for(var o in j)n.append(o,j[o]);m.body=n,m.headers=a.overwrite(k,{Accept:"multipart/form-data","Content-Type":"multipart/form-data; charset=UTF-8"});break;case"GET":var p=[];a.each(j,function(a,b){p.push(b+"="+a)}),h+="?"+p.join("&");break;case"JSON":m.body=JSON.stringify(j),m.method="POST",m.headers=a.overwrite(k,{Accept:"multipart/form-data","Content-Type":"multipart/form-data; charset=UTF-8"})}return new Promise(function(a,b){fetch(Store.fixURL(h),m).then(function(a){return a.json()}).then(function(b){l.__onSuccess(b),l.__onComplete(b),a(b)}).catch(function(a){l.__onError(a),l.__onComplete(a),b(a)})})}}}),e=a.Class({events:["init","before","after"],properties:{data:null,argv:{set:function(a){this._argv=a},get:function(){return this._argv||{}}}},methods:{init:function(a,b){this.reset(a,b),this.fire("init",this)},reset:function(a,b){return a&&(this._data=a),b&&(this._argv=b),this._argv&&this._argv.autoLoad&&this.exec(),this},refresh:function(){return this.exec(),this},exec:function(){var a=this._data,b=this;if(!a)return!1;if((this._argv.onExec&&this._argv.onExec(a))===!1)return!1;var c=this.fire("before",a);return c===!1?!1:a.__id__?void a.on("success",function(a,c){b._argv.onSuccess&&b._argv.onSuccess(c)}).on("error",function(a,c){b._argv.onError&&b._argv.onError(c)}).on("complete",function(a,c){b._argv.onComplete&&b._argv.onComplete(c)}).exec():new Promise(function(c,d){if(a){if(Store.fire("success",a)===!1)return!1;b._argv.onSuccess&&b._argv.onSuccess(a),b._argv.onComplete&&b._argv.onComplete(a),c(a)}else{if(Store.fire("error",a)===!1)return!1;b._argv.onError&&b._argv.onError(a),b._argv.onComplete&&b._argv.onComplete(a),d(a)}})}}}),f=a.Class({events:["before","success","error","complete","after"],properties:{host:window.location.origin,engine:{set:function(a){this._engine=a},get:function(){return"Fetcher"==this._engine?d:c}},headers:{}},methods:{request:function(a,b,e,f){var g=null;return new(g="Fetcher"==this._engine?d:c)(a,b,e,f)},post:function(a,b,c){return this.request(a,b,"POST",c)},"delete":function(a,b,c){return this.request(a,b,"DELETE",c)},put:function(a,b,c){return this.request(a,b,"PUT",c)},get:function(b,c,d){var e=[];return a.each(c,function(b,c){e.push(c+"="+(a.is(b,"object")?JSON.stringify(b):b))}),this.request(b,e.join("&"),"GET",d)},setHost:function(a){this._host=a},getHost:function(){return this._host},fixURL:function(a){return a?(a&&-1===a.indexOf("http://")&&(a=this._host+a),a):""},dataSource:function(a,b){return new e(a,b)}}});a.store=a.GLOBAL.Store=new f}(zn),function(a){a.cookie=a.Class({"static":!0,methods:{setItem:function(a,b,c){var d=a+"="+encodeURIComponent(b);c&&(d+="; expires="+new Date(+new Date+36e5*c).toGMTString()),document.cookie=d},getItem:function(a){var b=new RegExp("(?:; )?"+a+"=([^;]*);?");return b.test(document.cookie)?decodeURIComponent(RegExp.$1):null},removeItem:function(a){this.setItem(a,null,-9999)},clear:function(){document.cookie=null}}})}(zn),function(a){var b=document.createElement("div"),c=b.style,d=/width|height|top|right|bottom|left|size|margin|padding/i,e=/[c-x%]/,f="px",g=/(?:^|-)([a-z])/g,h=/([A-Z])/g,i={lineHeight:!0,zIndex:!0,zoom:!0},j={"float":"cssFloat"};a.style=a.Class({"static":!0,methods:{each:function(a,b,c){if(a&&b){var d=a.length;if(d>=0)for(var e=0;d>e;e++)b.call(c,a[e],e);else for(var f in a)a.hasOwnProperty(f)&&b.call(c,a[f],f)}},getCssText:function(a){var b=[""];return this.each(a,function(a,c){b.push(this.getStyleProperty(c,!0)+":"+this.getStyleValue(c,a))},this),b.join(";")},getStyleValue:function(a,b){var c=this.getStyleProperty(a),g=b;return d.test(c)&&(e.test(b)||i[c]||(g+=f)),g},getStyleProperty:function(a,b){var d=this.lowerCamelCase(a);return d in c?b&&(d=this.deCamelCase(a)):d=b?env.prefix()[1]+a:env.prefix()[0]+this.upperCamelCase(a),j[a]||d},lowerCamelCase:function(a){var b=this.upperCamelCase(a);return b.charAt(0).toLowerCase()+b.substring(1)},upperCamelCase:function(a){return a.replace(g,function(a,b){return b.toUpperCase()})},deCamelCase:function(a){return a.replace(h,function(a,b){return"-"+b.toLowerCase()})},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)}}}),a.dom=a.Class({"static":!0,methods:{hasClass:function(a,b){return a.classList.contains(b)},addClass:function(a){var b=a.classList;return arguments.shift(),b.add.apply(b,arguments)},removeClass:function(a){var b=a.classList;return arguments.shift(),b.remove.apply(b,arguments)},toggleClass:function(a,b){return a.classList.toggle(b)},setStyle:function(b,c,d){var e=a.style.getStyleProperty(c);b.style[e]=a.style.getStyleValue(c,d)},getStyle:function(b,c,d){var e=b,f=a.style.getStyleProperty(c),g=d?b.style:window.getComputedStyle?getComputedStyle(e,null):e.currentStyle;return g[f]||""},removeStyle:function(b,c){var d=a.style.getStyleProperty(c,!0);b.style.removeProperty(d)},hasStyle:function(a,b){var c=a.style.cssText;return c.indexOf(b+":")>-1},setStyles:function(b,c){b.style.cssText+=a.style.getCssText(c)},getPosition:function(a){var b=a,c=0,d=0,e=0,f=0;if(b.getBoundingClientRect){var g=b.getBoundingClientRect();c=g.left+Math.max(document.documentElement.scrollLeft,document.body.scrollLeft)-document.documentElement.clientLeft,d=g.top+Math.max(document.documentElement.scrollTop,document.body.scrollTop)-document.documentElement.clientTop,e=g.width,f=g.height}else{for(;b!=document.body&&b;)c+=b.offsetLeft,d+=b.offsetTop,b=b.offsetParent;e=b.offsetWidth,f=b.offsetHeight}return{x:c,y:d,width:e,height:f}},on:function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):element.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},off:function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=null}}})}(zn); | ||
var __isServer="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),zn={VERSION:"0.0.1",DEBUG:!0,ZN_PATH:"",PATH:"",isServer:__isServer,GLOBAL:function(){return __isServer?global:window}.call(null)};if(zn.GLOBAL.zn=zn,__isServer)zn.ZN_PATH=__dirname,zn.PATH=process.cwd(),module.exports=zn;else{var _zn_url="";try{__a__=__b__}catch(e){e.fileName?_zn_url=e.fileName:e.sourceURL?_zn_url=e.sourceURL:e.stacktrace?console.log(e.stacktrace):e.stack?(_zn_url=e.stack.split("\n")[1],_zn_url=_zn_url.replace(/\s/g,""),_zn_url=_zn_url.substring(2,_zn_url.length)):console.log(e.toString())}if(!_zn_url)for(var _scripts=document.getElementsByTagName("script"),_src="",_node,i=0,_len=scripts.length;_len>i;i++)if(_node=scripts[i],_node.getAttribute&&(_src=_node.getAttribute("src")||"","zn.js"===_src.slice(-5)||"zn.minx.js"===_src.slice(-10))){_zn_url=_src;break}if(!_zn_url)throw new Error("zn.js has not been included, please do it first.");zn.ZN_PATH=_zn_url.substring(0,_zn_url.lastIndexOf("/")+1)}!function(a){var b=Object.prototype.toString,c={isNull:function(a){return null===a||void 0===a},isNotNull:function(a){return null!==a&&void 0!==a},idle:function(){},idleArray:function(){return[]},idleObject:function(){return{}},format:function(){var a=arguments,b=null,c=null;return a.length<2?a[0]:(b=a[0],b=b.toString?b.toString():b,c=a[1],d.each(c,function(a,c){null!==a&&void 0!==a&&(a=d.is(a,"object")?JSON.stringify(a):a.toString?a.toString():a,b=b.replace(new RegExp("\\{"+c+"\\}","gi"),a))}),b)},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)}).toUpperCase()},serializeJSON:function(a){return Object.keys(a).map(function(b){return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&")},fix:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&"function"!=typeof b[f]&&(b[f]=e[f])}return b},extend:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b},overwrite:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&void 0===b[f]&&(b[f]=e[f])}return b},path:function(a,b,c){var d=a||{};if(b){var e,f=b.split("."),g=f.length,h=0;if(arguments.length<3)for(;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e];else{for(g-=1;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e]=d[e]||{};e=f[h],d&&(d.__set__?d.__set__(e,c):d[e]=c,d=c)}}return d},invoke:function(b,c,d){if(b&&c){var e,f,g=c.lastIndexOf(".");g>0?(e=a.path(b,c.substring(0,g)),e&&(f=e[c.substring(g+1)])):(e=b,f=b[c]),f&&f.apply(e,d)}},deepEachObject:function(a,b,c){if(d.is(a,"object")){var e,f=null;for(var g in a)f=a[g],d.is(f,"object")?this.deepEachObject(f,b,c):(e=b&&b.call(c,f,g,a),void 0!==e&&null!==e&&(a[g]=e))}return a},arrayValueToObject:function(a,b,c){if(d.is(a,"array")){for(var e,f=null,g={},h=0,i=a.length;i>h;h++)f=a[h],e=b&&b.call(c,f,h,a),void 0!==e&&null!==e&&(g[f]=e);a=g}return a}},d={toString:function(a){return a&&a.toString?a.toString():b.call(a)},each:function(a,c,d){if(a&&c)if(a.__each__)a.__each__(c,d);else{var e=a.length,f=null;if(e>0&&"[object Array]"===b.call(a)){for(var g=0;e>g;g++)if(f=c.call(d,a[g],g),f===!1)return!1}else for(var h in a)if(a.hasOwnProperty(h)){if(f=c.call(d,a[h],h),f===!1)return!1;if(-1===f)continue}}},clone:function(b){if(b){if(b.__clone__)return b.__clone__();if(a.is(b,"array"))return b.slice(0);var c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c}return b},type:function(a){return a&&a.__type__?a.__type__:b.call(a).slice(8,-1).toLowerCase()},is:function(a,b){if(a&&a.__is__)return a.__is__(b);if("string"==typeof b)switch(b.toLowerCase()){case"plain":return a&&a.constructor===Object;default:return this.type(a)===b}else if("function"==typeof b)return a instanceof b},may:function(a,b){return a?a.__may__?a.__may__(b):a.hasOwnProperty("on"+b):!1},can:function(a,b){return a?a.__can__?a.__can__(b):"function"==typeof a[b]:!1},has:function(a,b){return a?a.__has__?a.__has__(b):a.hasOwnProperty(b):!1},get:function(a,b){return a?a.__get__?a.__get__(b):a[b]:void 0},set:function(a,b,c){a&&(a.__set__?a.__set__(b,c):a[b]=c)},gets:function(a){if(a){if(a.__gets__)return a.__gets__();var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}},sets:function(a,b){if(a&&b)if(a.__sets__)a.__sets__(b);else for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}};c.extend(a,c),c.extend(a,d)}(zn),function(a){{var b=Array.prototype.slice,c=Object.prototype.hasOwnProperty,d=Object.prototype.toString,e={format:function(){var b=arguments,c=this;return 1==b.length&&"object"==typeof b[0]&&(b=b[0]),a.each(b,function(b,d){null!==b&&void 0!==b&&(b="object"==a.type(b)?JSON.stringify(b):b.toString?b.toString():b,c=c.replace(new RegExp("\\{"+d+"\\}","gi"),b))}),c.toString()},firstUpperCase:function(a){return a.replace(/\b(\w)(\w*)/g,function(a,b,c){return b.toUpperCase()+c})}},f={isArray:function(b){return b&&"[object Array]"===a.toString(b)&&b.constructor===Array}},g={forEach:function(a,b){if(!a)return!1;for(var c=0,d=this.length;d>c;c++)a.call(b,this[c],c);return this},indexOf:function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},lastIndexOf:function(a){for(var b=this.length-1;b>=0;b--)if(this[b]===a)return b;return-1}},h={bind:function(a){var c=this;return function(){return c.apply(a,b.call(arguments,1))}}},i={toArray:function(a){return b.call(a)},keys:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(b);return d},values:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(a[b]);return d},create:function(){var b=function(){};return function(c,d){if(null===c)throw new Error("Cannot set a null [[Prototype]]");if("object"!=typeof c)throw new TypeError("Argument must be an object");return a.each(d,function(a,b){i.defineProperty(c,a,b)}),b.prototype=c,new b}}(),defineProperty:function(a,b,c){return a&&b&&c&&c.hasOwnProperty("value")&&(a[b]=c.value),a}};({parse:function(){return""},stringify:function(){var a=d,b=Array.isArray,c={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},e=function(a){return c[a]||"\\u"+(a.charCodeAt(0)+65536).toString(16).substr(1)},f=/[\\"\u0000-\u001F\u2028\u2029]/g;return function g(c){if(null==c)return"null";if("number"==typeof c)return isFinite(c)?c.toString():"null";if("boolean"==typeof c)return c.toString();if("object"==typeof c){var d;if("function"==typeof c.toJSON)return g(c.toJSON());if(b(c)){d="[";for(var h=0;h<c.length;h++)d+=(h?", ":"")+g(c[h]);return d+"]"}if("[object Object]"===a.call(c)){d=[];for(var i in c)c.hasOwnProperty(i)&&d.push(g(i)+": "+g(c[i]));return"{"+d.join(", ")+"}"}}return'"'+c.toString().replace(f,e)+'"'}}()})}a.fix(Array,f),a.fix(Array.prototype,g),a.fix(Function.prototype,h),a.fix(String.prototype,e)}(zn),function(a){function b(){}function c(){var c=l._arguments.apply(this,arguments),e=c.name,f=c.super,h=c.meta,i=h.methods.init;h.properties=h.properties||h.props,h.props=null,delete h.props;var j,k,n;if(f._static_)throw new Error("Static class cannot be inherited.");if(f._final_)throw new Error("Final class cannot be inherited.");if(e&&h.partial&&(j=a.path(d,e)),h.static){if(j){if(!j._static_)throw new Error('Partial class "'+e+'" must be static.')}else j=function(){throw new Error("Cannot instantiate static class.")};n=j.prototype}else{if(j){if(j._static_)throw new Error('Partial class "'+e+'" must not be static.');if(j._super_!==f&&j._super_!==b)throw new Error('Partial class "'+e+'" must have consistent super class.')}else j=h.abstract?function(){throw new Error("Cannot instantiate abstract class.")}:function(){var b=j._mixins_||[],c=j._ctors_||[],d=null,e=arguments;this.__id__=g++,this.__handlers__={},this.__initializing__=!0,this.__afters__=[];for(var f=null,h=null,i=0,k=b.length;k>i;i++)f=b[i],f["@init"]?(h=f["@init"].meta,h=a.is(h,"function")?h:h.value,m(f.prototype.__super__,this,e),h&&h.call(this)):m(f.prototype.__super__,this,e);m(this.__super__,this,e);for(var l=0,n=c.length;n>l;l++)d=c[l],d=a.is(d,"function")?d:d.value,d&&d.apply(this,e);for(;this.__afters__.length>0;){var o=this.__afters__.pop();o.handler.apply(o.context,e)}this.__afters__=null,delete this.__afters__,this.__initializing__=!1},j._ctors_=[];j._super_!==f?(k=function(){},k.prototype=f.prototype,n=new k,n.constructor=j,n.__type__=e||"Anonymous",n.__super__=f,j.prototype=n):n=j.prototype,n.class=n.constructor,i&&(j._ctors_.push(i),n.__ctor__||(n.__ctor__=i))}return l._meta(j,c),n.__define__&&n.__define__.call(j),e&&a.path(d,e,j),j}var d=a.GLOBAL,e="@",f=1,g=1,h={fixTargetCtor:function(a){return a instanceof b?a.constructor:a},fixTargetKey:function(a){return e+a},defineEvent:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d,g={};return f||(g=Object.defineProperty(a,"on"+b.toLowerCase(),{get:function(){var a=this.__handlers__[b];return a?a[0].handler:null},set:function(a){var c=this.__handlers__,d=c[b]=c[b]||[];d[0]={owner:this,handler:a,context:null}}})),d[e]={name:b,type:"event",meta:c,descriptor:g},f},defineProperty:function(b,c,d){var e,f,g=h.fixTargetCtor(b),i=h.fixTargetKey(c),j=i in g,k={};if("value"in d){var l=d.value,m="_"+c,n=d.get,o=d.set;e=n||function(){return m in this?this[m]:a.is(l,"function")?l.call(this):l},f=d.readonly?function(a,b){return b&&b.force?void(this[m]=a):!1}:o||function(a){this[m]=a}}else e=d.get||function(){return void 0},f=d.set||function(){return!1};return j&&(e.__super__=g[i].getter,f.__super__=g[i].setter),k=Object.defineProperty(b,c,{get:e,set:f,configurable:!0}),g[i]={name:c,type:"property",meta:d,getter:e,setter:f,descriptor:k},j},defineMethod:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d;return d[e]={name:b,type:"method",meta:c},b in a&&(c.value||(c.value=function(){}),c.value.__super__=a[b]),a[b]=c.value,f}},i={__handlers__:{},member:function(a,c){var d=h.fixTargetCtor(c||this),e=d[h.fixTargetKey(a)];return e||d===b?e:this.member(a,d._super_)},may:function(a){var b=this.member(a);return b&&"event"==b.type},has:function(a){var b=this.member(a);return b&&"property"==b.type},can:function(a){var b=this.member(a);return b&&"method"==b.type},get:function(a,b){var c=this.member(a);return c&&c.getter?c.getter.call(this,b):void 0},set:function(a,b,c){var d=this.member(a);return d&&d.setter&&d.setter.call(this,b,c),this},gets:function(b){var c={},d=h.fixTargetCtor(this)._properties_;return a.each(d,function(a){c[a]=this.get(a,b)},this),c},sets:function(a,b,c){if(a){var d=null;for(var e in a)a.hasOwnProperty(e)&&(d=a[e],(c&&c(d,e,b))!==!1&&this.set(e,d,b))}return this},each:function(a,b){for(var c=h.fixTargetCtor(this)._properties_,d=0,e=c.length;e>d;d++){var f=c[d],g=a.call(b,f,d,this.member(f),this.get(f));if(g===!1)return!1}return this},__may__:function(a){return this.may(a)},__has__:function(a){return this.has(a)},__can__:function(a){return this.can(a)},__get__:function(a){return this.get(a)},__gets__:function(){return this.gets()},__set__:function(a,b){this.set(a,b)},__sets__:function(a){this.sets(a)},__each__:function(a,b){return this.each(a,b)}},j={toString:function(){return"{ ClassName: "+(this._name_||"Anonymous")+", ClassID: "+this._id_+" }"},createSelf:function(){return new this.constructor.apply(this,Array.prototype.slice.call(arguments))},getProperties:function(b,c){var d={};if(!this.getMeta||"ZNObject"==this._name_)return d;var e=this._super_,f=this._mixins_;return e&&a.extend(d,e.getProperties(b,c)),f&&f.length&&a.each(f,function(e){a.extend(d,e.getProperties(b,c))}),a.each(this.getMeta("properties"),function(a,e){var f=b&&b.call(c||this,a,e,d);return f===!1||-1===f?f:void(a.hidden||(d[e]=a))},this),d},getProperty:function(a){var b=null;return a&&this.getProperties(function(c,d){return a==d&&(b=field),-1}),b},existProperty:function(a){return!!this.getProperty(a)},getMeta:function(a){return a?this._meta_[a]:this._meta_},setMeta:function(a,b){return a&&b&&(this._meta_[a]=b),this},defineEvent:function(a,b,c){return h.defineEvent(c||this.prototype,a,b)||this._events_.push(a),this},defineProperty:function(a,b,c){return h.defineProperty(c||this.prototype,a,b)||this._properties_.push(a),this},defineMethod:function(a,b,c){return h.defineMethod(c||this.prototype,a,b)||this._methods_.push(a),this}},k={toString:function(){var a={ClassName:this.__name__||"Anonymous",InstanceID:this.__id__,Meta:this.constructor._meta_};return JSON.stringify(a)},toJson:function(){var b={};return a.each(this.constructor.getProperties(),function(a,c){b[c]=this.get(c)},this),b},getProperties:function(){return this.constructor.getProperties.apply(this,arguments)},getPropertie:function(a){return this.constructor.getPropertie(a)},upon:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[];f[0]=a.extend({owner:this,handler:c},d)}return this},on:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[{owner:null,handler:null,context:null}];f.push(a.extend({owner:this,handler:c},d))}return this},off:function(a,b,c){var d,e=this.__handlers__[a]||[],f=c&&c.context;if(b)for(var g=e.length-1;g>=0;g--)d=e[g],d.handler!==b||f&&d.context!==f||this.__handlers__[a].splice(g,1);else this.__handlers__[a]=[{owner:null,handler:null,context:null}];return this},offs:function(){var b=Array.prototype.slice.call(arguments);return b.length?a.each(b,function(a){this.__handlers__[a]&&(this.__handlers__[a]=[{owner:null,handler:null,context:null}])}.bind(this)):this.__handlers__={},this},fire:function(a,b,c){var d,e=this.__handlers__[a],f=null;if(e)for(var g=0,h=e.length;h>g;g++)if(d=e[g],d&&d.handler&&(f=c&&"apply"==c.method?d.handler.apply(d.context||d.owner,b):d.handler.call(d.context||d.owner,d.owner,b,c),!1===f))return!1;return this},dispose:function(){return this.__handlers__={},this},destroy:function(){return this.dispose()},"super":function(){var a=this.super.caller.__super__;return a?a.apply(this,arguments):void 0},is:function(b){if("string"==typeof b&&(b=a.path(d,b)),b){if(this instanceof b)return!0;for(var c=this.constructor._mixins_,e=0,f=c.length;f>e;e++){var g=c[e];if(b===g)return!0}}return!1},__is__:function(a){return this.is(a)},__clone__:function(){}};a.extend(b,i,j,{_id_:0,_name_:"ZNObject",_statics_:{},_events_:[],_properties_:[],_methods_:[],_mixins_:[],_meta_:{}}),a.extend(b.prototype,i,k),a.isZNObject=function(a){return a instanceof b};var l={_arguments:function(){var c,d,e,f=arguments,g=f.length,h=f[0],i={"static":!1,statics:[],partial:!1,"abstract":!1,"final":!1,mixins:[],events:[],properties:[],methods:[]};if(3===g){if(c=h,d=f[1],e=f[2],!a.is(d,"function"))throw new Error("Invalid _super class.")}else if(2===g){if(a.is(h,"string"))c=h,d=null;else{if(!a.is(h,"function"))throw new Error("Invalid _super class.");c=null,d=h}e=f[1]}else{if(1!==g)throw new Error("Invalid arguments.");if(c=null,d=null,e=h,!a.is(e,"object"))throw new Error("The meta argument must be an object.")}return c=c||"",e=a.overwrite(e||{},i),d=d||b,{name:c,"super":d,meta:e}},_meta:function(b,c){var d=c.name,e=c.super,g=c.meta;return a.extend(b,i,j,{_id_:f++,_name_:d,_super_:e,_partial_:g.partial,_abstract_:g.abstract,_static_:g.static,_final_:g.final,_statics_:a.extend({},e._statics_,g.statics),_events_:e._events_.slice(0),_properties_:e._properties_.slice(0),_methods_:e._methods_.slice(0),_mixins_:e._mixins_.concat(g.mixins),_meta_:g}),a.extend(b,b._statics_),g.static?(a.each(g.events,function(a){b.defineEvent(a,{},b)}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c},b)}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c,b)}),g.methods.init&&g.methods.init.call(b,b)):(a.each(g.mixins,function(c){var d=c.prototype;a.each(c._events_,function(a){b.defineEvent(a,d.member(a).meta)}),a.each(c._properties_,function(a){b.defineProperty(a,d.member(a).meta)}),a.each(c._methods_,function(a){i[a]||k[a]||b.defineMethod(a,d.member(a).meta)})}),a.each(g.events,function(a){b.defineEvent(a,{})}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c})}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c)})),b}},m=function(c,d,e){if(c&&c!==b){var f=c.member("init"),g=c._mixins_,h=null;return f&&f.meta.after&&d.__afters__.push({context:d,handler:f.meta.after}),g.length&&a.each(g,function(b){b["@init"]&&(h=b["@init"].meta,h=a.is(h,"function")?h:h.value,m(b.prototype.__super__,b.prototype,e),h&&h.call(d))}),f&&f.meta.auto&&f.meta.value.apply(d,e),arguments.callee(c._super_,d)}};a.Class=c}(zn),function(a){var b=".",c="..",d="/",e={PENDING:0,LOADING:1,WAITING:2,LOADED:3},f=null;"undefined"!=typeof module&&module.exports?a.SLASH=d=require("path").sep:f=document;var g={normalizePath:function(a){for(var e,f=a.split(d),g=[f[0]],h=1,i=f.length;i>h;h++)switch(e=f[h]){case b:break;case c:var j=g[g.length-1];j===b||j===c?g.push(c):g.pop();break;default:g.push(e)}return g.join(d)},formatPath:function(b,c){var e=b;e="/"===d?e.split("\\").join(d):e.split("/").join(d);var f=c?c.get("path")||a.PATH:a.PATH,g=e.indexOf(d);return e.indexOf(a.PATH)>-1||e.indexOf(a.ZN_PATH)>-1?e:(e=g>0?f?f.substring(0,f.lastIndexOf(d)+1)+e:e:0===g?a.PATH.substring(0,a.PATH.lastIndexOf(d))+e:a.ZN_PATH+d+e+d,e.slice(-1)===d&&(e+="index.js"),e=this.normalizePath(e))}},h=a.Class("zn.Module",{events:["pending","loading","waiting","loaded"],statics:{all:{},current:null,counter:0,preLoadedPackage:{},unloadModule:function(b){try{if(!h.all[b])return this;b=require.resolve(b);var c=require.cache[b];c&&c.parent&&c.parent.children.splice(c.parent.children.indexOf(c),1),require.cache[b]=null;var d=h.all[b];h.all[b]=null,d&&d.parent&&h.unloadModule(d.parent.path)}catch(e){a.error(e.message)}return this},loadModule:function(b,c,d){if(a.is(b,h))return b.load(c);if("node:"===b.substring(0,5))return c(require(b.substring(5)));var i=null;if(a.NODE_PATHS&&a.NODE_PATHS.length&&a.NODE_PATHS.every(function(a){return 0===b.indexOf(a)?(i=b,!1):!0}),!i&&(i=g.formatPath(b,d),!f))try{i=require.resolve(i)}catch(j){return a.error("node require.resolve("+i+"): ",j.message),c({})}var k=h.all[i];k?k.load(c):(k=h.all[i]=new h(i),h.counter++,f?this.__webModule(i,function(a){if(h.counter--,a)throw new Error("Failed to load module:"+b);k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}):this.__nodeModule(i,function(){h.counter--,k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}))},__nodeModule:function(b,c){var d=b,e=c||a.idle,f={};try{f=require(d)}catch(g){console.error(g),a.error("Node.js require("+d+") error: ",g.message)}finally{e(f)}},__webModule:function(b,c){var e=f.head||f.getElementsByTagName("head")[0],g=f.createElement("script"),h=b,i=c||a.idle,j=function(a){g.onload=null,g.onerror=null,i(a)};h=h.slice(-1)===d?h+"index.js":h,h=".js"===h.slice(-3).toLowerCase()?h:h+".js",g.src=h,"onload"in g?g.onload=function(){j(null)}:g.onreadystatechange=function(a){var b=g.readyState;j("loaded"===b||"complete"===b?null:a)},g.onerror=function(a){j(a)},e.appendChild(g)}},properties:{parent:null,status:e.PENDING,path:"",dependencies:null,factory:null,value:{set:function(a){a._ctors_&&(a.$path=this.get("path")),this._value=a},get:function(){return this._value}}},methods:{init:function(a,b,c){this.sets({path:a,dependencies:b||[],factory:c,value:{}}),this._callbacks=[]},exec:function(a){var b=process.argv,c=b[1];return this.sets({path:c,status:e.LOADING}),this.load(a),this},__pending:function(a){this._callbacks.push(a)},__loading:function(b){var c=(this.get("path"),this.get("dependencies")),d=this._depHandler,f=this.get("factory"),g=this.get("value");this.set("status",e.WAITING),this._callbacks.push(b);var i=c.length;if(0===i)g=f.call(g)||g,this.set("value",g),this.set("status",e.LOADED),a.each(this._callbacks,function(a){a(g)});else{var j=[],k=this;a.each(c,function(b,c){d&&(b=d(b,c)),h.loadModule(b,function(b){j[c]=b,i--,0===i&&(g=f.apply(g,j)||g,k.set("value",g),k.set("status",e.LOADED),a.each(k._callbacks,function(a){a(g)}))},k)})}},__waiting:function(a){var b=this;setTimeout(function(){0===h.counter&&b.set("status",e.LOADING),b.load(a)})},__loaded:function(a){a(this.get("value"))},load:function(b){var c=this.get("status"),d=b||a.idle;switch(c){case e.PENDING:this.__pending(d);break;case e.LOADING:this.__loading(d);break;case e.WAITING:this.__waiting(d);break;case e.LOADED:this.__loaded(d)}return this}}});a.define=function(){var b=arguments,c=b.length,d=b[0],e=[],f=null;switch(c){case 1:a.is(d,"function")?f=d:a.is(d,"array")?(e=d,f=function(){var b={};return a.each(arguments,function(c){c._name_?b[c._name_]=c:a.extend(b,c)}),b}):f=function(){return d};break;case 2:e=d,f=b[1];break;case 3:e=d,f=b[1]}return e&&a.is(e,"string")&&(e=[e]),h.current=new h("",e,f),b[2]&&(h.current._depHandler=b[2]),h.current};var i=a.Class("zn.Loader",{"static":!0,properties:{preLoadPackages:[]},methods:{init:function(){for(var a=this.preLoadPackages,b=0,c=a.length;c>b;b++)this.loadPackage(a[b])},loadPackage:function(b){this.load(b+"index.js",function(b){a.extend(h.preLoadedPackage,b)})},load:function(a,b,c){return h.loadModule(a,b,c),this}}});a.load=i.load,a.module=h}(zn),function(a){var b={lower:[97,123],upper:[65,91]};a.char=a.Class({"static":!0,methods:{lowercase:function(b){return a.is(b,"string")?b.replace(/[A-Z]/g,function(a){return String.fromCharCode(32|a.charCodeAt(0))}):b},uppercase:function(b){return a.is(b,"string")?b.replace(/[a-z]/g,function(a){return String.fromCharCode(-33&a.charCodeAt(0))}):b},toUnicode:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a.charCodeAt(c));return b},toChar:function(a,b){for(var c=[],d=a;b>d;d++)c.push(String.fromCharCode(d));return c},getLowercaseLetters:function(){var a=b.lower;return this.toChar(a[0],a[1])},getUppercaseLetters:function(){var a=b.upper;return this.toChar(a[0],a[1])},getStringFromChar:function(a,b){for(var c=a||"A",d=b||26,e=[],f=0;d>f;f++)e.push(String.fromCharCode(c.charCodeAt(0)+f));return e.join("")}}})}(zn),function(a){var b={ISO8601:"yyyy-MM-dd hh:mm:ss.SSS",ISO8601_WITH_TZ_OFFSET:"yyyy-MM-ddThh:mm:ssO",DATETIME:"dd MM yyyy hh:mm:ss.SSS",ABSOLUTETIME:"hh:mm:ss.SSS"};a.date=a.Class({"static":!0,methods:{getSecond:function(a){var b=1*a.substring(1,a.length);switch(a.substring(0,1)){case"s":return 1e3*b;case"h":return 60*b*60*1e3;case"d":return 24*b*60*60*1e3}},asString:function(a){var c=b.ISO8601;"string"==typeof a&&(c=arguments[0],a=arguments[1]);var d=this.__addZero(a.getDate()),e=this.__addZero(a.getMonth()+1),f=this.__addZero(a.getFullYear()),g=this.__addZero(a.getFullYear().toString().substring(2,4)),h=c.indexOf("yyyy")>-1?f:g,i=this.__addZero(a.getHours()),j=this.__addZero(a.getMinutes()),k=this.__addZero(a.getSeconds()),l=this.__padWithZeros(a.getMilliseconds(),3),m=this.__offset(a),n=c.replace(/dd/g,d).replace(/MM/g,e).replace(/y{1,4}/g,h).replace(/hh/g,i).replace(/mm/g,j).replace(/ss/g,k).replace(/SSS/g,l).replace(/O/g,m);return n},__padWithZeros:function(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c},__addZero:function(a){return this.__padWithZeros(a,2)},__offset:function(a){var b=Math.abs(a.getTimezoneOffset()),c=String(Math.floor(b/60)),d=String(b%60);return 1==c.length&&(c="0"+c),1==d.length&&(d="0"+d),a.getTimezoneOffset()<0?"+"+c+d:"-"+c+d}}})}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,CANCLE:1,PAUSE:2,FINISHED:3},d=a.Class({events:["init","finished"],properties:{status:{value:c.PENDING,get:function(){return this._status}}},methods:{init:function(){},doTask:function(a,b){if(a){var c=b||[];c.unshift(this),a.handler.apply(a.context,c)}},done:function(){this._status=c.FINISHED,this._data=b.call(arguments),this.fire("finished",this._data),this.off("finished")}}}),e=a.Class({events:["clear","insert","pause","resume","exception","every","finally"],properties:{count:{get:function(){return this._tasks.length}}},methods:{init:function(a){this._exceptions=[],this._finallys=[],this._everys=[],this._tasks=[],this._taskProcessor=[],this._lastTask=null,this._data=[],this._max=(a||{}).max||1},destroy:function(){this._everys=[],this._tasks=[],this._taskProcessor=[],this.fire("finally",this._data,{method:"apply"}),this.super()},clear:function(){this._tasks=[]},pause:function(a){return this._paused=!0,a>0&&(this._pauseTimer=setTimeout(function(){this.resume()}.bind(this),a)),this.fire("pause"),this},resume:function(){return this._pauseTimer&&clearTimeout(this._pauseTimer),this._paused=!1,this.fire("resume"),this.doTask(),this},exception:function(a,b){return this.on("exception",a,b||this),this},"catch":function(a){return this.fire("exception",a),this},"finally":function(a,b){return this.on("finally",a,b||this),this},every:function(a,b){return this.on("every",a,b||this),this},unshift:function(a,b){return this.insert(a,b,0),this},push:function(a,b){return this.insert(a,b,-1),this},inserts:function(a,b,c){var d=a||[],e=c||0,f=this._tasks[0],g=null,h=null;return d=d.map(function(a){return h={handler:a,context:b||this},g&&(h.previous=g,g.next=h),g=h,h}.bind(this)),f&&(g.next=f,f.previous=g),d.unshift(0),d.unshift(e),this._tasks.splice.apply(this._tasks,d),this},insert:function(a,b,c){var d={handler:a,context:b||this},e=c||-1;switch(e){case-1:this._lastTask&&(d.previous=d,this._lastTask.next=d),this._lastTask=d,this._tasks.push(d);break;case 0:var f=this._tasks[0];f&&(d.next=f,f.previous=d),this._tasks.unshift(d);break;default:this._tasks.splice(e,0,d)}return this.fire("insert",d),this},getTaskProcessor:function(){for(var a=null,b=this._taskProcessor.length,e=0;b>e;e++)if(a=this._taskProcessor[e],a.status==c.FINISHED)return a;if(!a&&this._max>b){var f=new d;return f.queue=this,f.on("finished",this.__onProcessorFinished.bind(this),this),f}},start:function(){return this._data=[],this.doTask()},doTask:function(a){var b=this._tasks.shift();if(b){var c=this.getTaskProcessor();c&&(b.previousResult=a,c.doTask(b,a))}else this.destroy();return this},__onProcessorFinished:function(a,b){this._data.push(b),this.fire("every",b,{method:"apply"}),this.doTask(b)}}});a.queue=function(a){return new e(a)}}(zn),function(a){var b=["INFO","DEBUG","WARN","ERROR","TRACE","ALL"],c=["#100000","#2125a0","#a82c2c","#c045b7","1cb131","#100000"],d=[38,34,35,31,32,36,33],e={INFO:0,DEBUG:1,WARN:2,ERROR:3,TRACE:4,ALL:6},f=a.Class({events:["info","debug","warn","error","trace","all"],methods:{init:function(){this._config={only:null,levels:["info","debug","warn","error","trace","all"]}},config:function(b){this._config=a.overwrite(b,this._config)},info:function(){this.__log.call(this,e.INFO,arguments)},debug:function(){this.__log.call(this,e.DEBUG,arguments)},warn:function(){this.__log.call(this,e.WARN,arguments)},trace:function(){this.__log.call(this,e.TRACE,arguments)},error:function(){this.__log.call(this,e.ERROR,arguments)},all:function(){this.__log.call(this,e.ALL,arguments)},__getDateString:function(b){return a.date.asString(b||new Date)},__getPosition:function(){try{throw new Error}catch(b){return a.DEBUG&&a.CONSOLE_ERROR&&console.log(b.stack),b.stack.split("\n")[5].replace(/\(/g,"").replace(/\)/g,"").split("/").pop()}},__formatLog4Server:function(a,c){var e="",f="",g="";return c&&(f="[",g="[0m",e=d[5]+"m",c=d[a.type]+"m"),[a.time," [",f,c,b[a.type],g,"] [",f,e,a.pos,g,"] ",a.message].join("")},__formatLog4Client:function(a){return["%c"+a.time," [",b[a.type],"] "].join("")},__log:function(d,e){var f=Array.prototype.slice.call(e),g=f.slice(0),h=b[d].toLowerCase(),i=this.__getDateString(),j=this.__getPosition();if(g.unshift(j),g.unshift(h),g.unshift(i),"undefined"!=typeof module&&module.exports?f.unshift(this.__formatLog4Server({type:d,time:i,pos:j},!0)):(f.unshift("color:"+c[d]),f.unshift(this.__formatLog4Client({type:d,time:i,pos:j},!0))),this.__isOk(h)){var k=this.fire(h,g);k!==!1&&a.DEBUG&&console.log.apply(this,f)}},__isOk:function(a){if(this._config.only){if(this._config.only===a)return!0}else{var b=-1!==this._config.levels.indexOf(a);if(b)return!0}return!1}}});a.logger=new f;var g={info:function(){a.logger.info.apply(a.logger,arguments)},debug:function(){a.logger.debug.apply(a.logger,arguments)},warn:function(){a.logger.warn.apply(a.logger,arguments)},trace:function(){a.logger.trace.apply(a.logger,arguments)},error:function(){a.logger.error.apply(a.logger,arguments)}};a.extend(a,g)}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,FULFILLED:1,REJECTED:2},d=a.Class({events:["complete"],properties:{promise:null},methods:{init:function(a,b){this._promise=new e,a&&this.resolve(a),b&&this.reject(b)},resolve:function(){var d=b.call(arguments);try{var e=this.get("promise"),g=this;if(e.get("readyState")!=c.PENDING)return;e.set("readyState",c.FULFILLED),e.set("data",d),a.each(e.get("resolves"),function(a){a.apply(g,d)})}catch(h){f.catch(h,this)}this.fire("complete",d)},reject:function(){var a=b.call(arguments);try{var d=this.get("promise");if(d.get("readyState")!=c.PENDING)return;d.set("readyState",c.REJECTED),d.set("reason",a);var e=d.get("rejects")[0];e&&e.apply(this,a)}catch(g){f.catch(g,this)}this.fire("complete",a)}}}),e=a.Class({statics:{isPromise:function(a){return null!==a&&void 0!==a&&"function"==typeof a.then},defer:null},properties:{resolves:null,rejects:null,data:null,reason:null,readyState:null},methods:{init:function(){this.set("resolves",[]),this.set("rejects",[]),this.set("exceptions",[]),this.set("readyState",c.PENDING)},then:function(a,f){function g(){var c=b.call(arguments),d=a?a.apply(this,c):c;return e.isPromise(d)?d.then(function(){h.resolve.apply(h,b.call(arguments))}):h.resolve.apply(h,d),d}var h=new d;if(this.get("readyState")===c.PENDING)this.get("resolves").push(g),this.get("rejects").push(f?f:function(){h.reject.apply(h,b.call(arguments))});else if(this.get("readyState")===c.FULFILLED){var i=this;setTimeout(function(){g.apply(i,i.get("data"))})}return h.promise},"catch":function(a){return f.exception(a)},"finally":function(a){return f.finally(a)},otherwise:function(a){return this.then(void 0,a)}}}),f=a.async=a.Class({"static":!0,methods:{init:function(){this._exceptions=[],this._finallys=[],this._count=0,this._currIndex=0,this._dataArray=[]},exception:function(a){return this._exceptions.push(a),this},"catch":function(b,c){return a.each(this._exceptions,function(a){a.call(c,b)}),this},"finally":function(a){return this._finallys.push(a),this},defer:function(b,c){var e=this,f=new d(b,c);return f.on("complete",function(b,c){e._currIndex++,e._dataArray.push(c),e._currIndex==e._count&&(a.each(e._finallys,function(b){try{b(e._dataArray)}catch(c){a.error(c.message)}}),e._finallys=[])}),e._count++,f},all:function(b){var c=f.defer(),d=0,e=[];return a.each(b,function(a){a.then(function(a){e.push(a),d++,d>=b.length&&c.resolve(e)})}),c.promise},any:function(b){var c=f.defer();return a.each(b,function(a){a.then(function(a){c.resolve(a)})}),c.promise}}})}(zn),function(){zn.querystring=zn.Class({"static":!0,properties:{config:{get:function(){}}},methods:{init:function(){this._config={separator:"&",equal:"=",minIndex:0,maxIndex:1e3}},config:function(a){return this.overwrite(this._config,a),this},parse:function(a,b){var c=zn.extend({},this._config,b),d={},e=c.equal,f=a.split(c.separator),g=f.length;c.maxIndex>0&&g>c.maxIndex&&(g=c.maxIndex);for(var h=c.minIndex;g>h;h++){var i=f[h].replace(/\+/g,"%20"),j=i.indexOf(e),k=null,l=null;j>=0?(k=i.substr(0,j),l=i.substr(j+1)):(k=i,l=""),k=decodeURIComponent(k),l=decodeURIComponent(l),hasOwnProperty(d,k)?zn.is(d[k],"array")?d[k].push(l):d[k]=[d[k],l]:d[k]=l}return d},stringify:function(a,b){var c=zn.extend({},this._config,b),d=[],e=c.equal,f={};if(f=zn.isZNObject(a)?a.gets():a,!zn.is(f,"object"))throw new Error("Agrument Error.");for(var g in a){var h=a[g],i=encodeURIComponent(this.__stringifyValue(g)); | ||
h=encodeURIComponent(this.__stringifyValue(h)),d.push(i+e+h)}return d.join(c.separator)},__stringifyValue:function(a){switch(zn.type(a)){case"string":return a;case"boolean":return a?"true":"false";case"object":case"array":return JSON.stringify(a);case"number":return isFinite(a)?a:"";default:return""}}}})}(zn),function(a){var b=Array.prototype,c=b.push,d=b.sort,e=b.join,f=b.slice,g=b.splice,h=b.indexOf,i=b.lastIndexOf,j=b.forEach,k=function(b){if(a.is(b,l))return b.toArray();if(a.is(b,"array"))return b.slice(0);var c=[];return a.each(b,function(a){c.push(a)}),c},l=a.Class("zn.data.List",{properties:{count:{get:function(){return this.length},set:function(){throw new Error("Unable to set count of List")}}},methods:{init:{auto:!0,value:function(a){this.length=0,this.insertRange(a,0)}},unique:function(){},dispose:function(){this.clear()},add:function(a){var b=this.length;return c.call(this,a),b},addRange:function(a){return this.insertRange(a,this.length)},remove:function(a){var b=this.indexOf(a);return b>=0?(g.call(this,b,1),b):-1},removeAt:function(a){return g.call(this,a,1)[0]},insert:function(a,b){return g.call(this,b,0,a),a},insertRange:function(a,b){return g.apply(this,[b,0].concat(k(a))),b},clear:function(){return g.call(this,0)},getItem:function(a){if(a<this.length)return this[a];throw new Error("Index out of range.")},setItem:function(a,b){if(!(a<this.length))throw new Error("Index out of range.");this[a]=b},getRange:function(a,b){return new l(f.call(this,a,a+b))},indexOf:function(a){return h.call(this,a)},lastIndexOf:function(a){return i.call(this,a)},contains:function(a){return this.indexOf(a)>=0},toggle:function(a){this.contains(a)?this.remove(a):this.add(a)},sort:function(a){return d.call(this,a)},each:function(a,b){j.call(this,a,b)},toArray:function(){return f.call(this,0)},join:function(){return e.call(this)}}})}(zn),function(a){a.Class("zn.data.TList",{statics:{getInstance:function(a){return new this(a)}},properties:{min:0,max:100,TClass:null,TClassArgv:{}},methods:{init:function(a){this.sets(a),this.reset()},reset:function(){this._data=[];for(var a=0;a<(this.min||0);a++)this.push(this.TClassArgv)},push:function(a){if(this.TClass){var b=new this.TClass(a||this.TClassArgv);return this._data.push(b),b}},findOneT:function(b){var c=null,d=b||a.idle;return a.each(this._data,function(a,b){return d(a,b)?(c=a,-1):void 0}),c},findAllT:function(b){var c=[],d=b||a.idle;return a.each(this._data,function(a,b){d(a,b)&&c.push(a)}),c}}})}(zn),function(a){a.Class("zn.data.Task",{statics:{getInstance:function(a){return new this(a)},PANDING:0,WAITING:1,DOING:2,DONE:3},properties:{statue:0},methods:{init:function(a){this.sets(a)}}})}(zn),function(a){var b=a.Class("zn.data.Observable",{properties:{},methods:{init:{auto:!0,value:function(){this.__watchers__={}}},dispose:function(){a.each(this.__watchers__,function(a,b){this.__unbind(b,this.get(b))},this),this.__watchers__=null},watch:function(b,c,d){var e="*"===b?this.constructor._properties_:a.is(b,"array")?b:[b];return e.forEach(function(a){this.__watch(a,c,d)},this),this},unwatch:function(b,c,d){var e="*"===b?this.constructor._properties_:a.is(b,"array")?b:[b];return e.forEach(function(a){this.__unwatch(a,c,d)},this),this},notify:function(b){var c="*"===b?Object.keys(this.__watchers__):a.is(b,"array")?b:[b];return a.each(c,function(a){this.__notify(a)},this),this},__watch:function(a,c,d){var e=a.indexOf("."),f=a,g="",h=this.__watchers__;if(e>=0){f=a.slice(0,e),g=a.slice(e+1);var i=this.get(f);i&&i.watch&&i.watch(g,c,d)}var j=h[f]=h[f]||[];j.push({handler:c,context:d,fullPath:a,subPath:g});var k=this.member(f);if(k&&"property"===k.type){var l=k.meta;if(!l.watched){var m=k.getter,n=k.setter;b.defineProperty(f,{get:function(a){return m.call(this,a)},set:function(a,b){var c=m.call(this);(c!==a||b&&b.force)&&(this.__unbind(f,c),n.call(this,a,b)!==!1&&(this.__bind(f,a),this.notify(f)))},watched:!0},this)}}},__unwatch:function(a,b,c){var d=a.indexOf("."),e=a,f="",g=this.__watchers__;if(d>=0){e=a.slice(0,d),f=a.slice(d+1);var h=this.get(e);h&&h.unwatch&&h.unwatch(f,b,c)}var i,j=g[e];if(!j)return!1;if(b){for(var k=0,l=j.length;l>k;k++)if(i=j[k],i.handler===b&&i.context===c){j.splice(k,1);break}}else j.length=0},__bind:function(b,c){c&&c.watch&&a.each(this.__watchers__[b],function(a){a.subPath&&c.watch(a.subPath,a.handler,a.context)})},__unbind:function(b,c){c&&c.unwatch&&a.each(this.__watchers__[b],function(a){a.subPath&&c.unwatch(a.subPath,a.handler,a.context)})},__notify:function(b){var c=this.get(b);a.each(this.__watchers__[b],function(b){b&&b.handler&&b.handler.call(b.context,a.path(c,b.subPath),b.fullPath,this)},this)}}})}(zn),function(a){var b=a.Class({properties:{direction:{value:"oneway",readonly:!0},target:{value:null,readonly:!0},targetPath:{value:"",readonly:!0},source:{get:function(a){return a?this._owner:this._source},set:function(a){this._source=a,this.__rebind()}},sourcePaths:{get:function(){return this._sourcePaths},set:function(a){this._sourcePaths=this.__parseSourcePaths(a,function(a){a&&this.__rebind()}.bind(this))}},owner:{get:function(){return this._owner}},converter:{value:null},async:{value:!1}},methods:{init:function(b,c,d){{var e=d||{},f=b.member(c);f&&f.meta.binding||{}}a.overwrite(e,{direction:"oneway",converter:{}});var g=this._direction=e.direction;this._source=e.source,this._sourcePaths=this.__parseSourcePaths(e.sourcePaths),this._owner=e.owner||b,this._converter=this.__parseConverter(e),this._target=b,this._targetPath=c,("twoway"===g||"oneway"===g)&&this.__rebind(),("twoway"===g||"inverse"===g)&&b.watch(c,function(a){this.__updateSource(a)},this)},dispose:function(){this._source=null,this.__rebind()},__updateSource:function(b){var c=this._converter,d=null;return a.each(this.sourcePaths,function(e){d=c.revert.call(c.context,b),a.path(this.get("source",e[0]),e[1],d)},this),this},__updateTarget:function(){var b=this,c=[],d=null,e=this._owner,f=this._target,g=null,h=this._targetPath,i=this._converter;return a.each(this.sourcePaths,function(f){d=a.path(b.get("source",f[0]),f[1]),d=a.is(d,"function")?d.bind(e):d,c.push(d)}),g=i.convert.apply(i.context,c),f.set(h,g),this},__rebind:function(){var b=this._sourcePaths,c=this._watchers;return c&&(a.each(c,function(a){a.source.unwatch(a.path,a.handler)}),this._watchers=null),a.each(b,function(b){var d=b[0],e=b[1],f=this.get("source",d);a.can(f,"watch")&&(f.watch(e,this.__updateTarget.bind(this)),c=c||[],c.push({source:f,path:e,handler:this.__updateTarget}))},this),this.__updateTarget()},__parseSourcePaths:function(a,b){for(var c=a.split(","),d="",e=!1,f=0,g=c.length;g>f;f++)d=c[f].trim(),"#"===d.charAt(0)&&(d=d.substring(1),e=!0),c[f]=[e,d],b&&b(e,d);return c},__parseConverter:function(b){var c=b.converter;(a.is(c,"string")||a.is(c,"function"))&&(c={convert:c});var d=c.convert=b.convert||c.convert||function(a){return a};if(c.revert=b.revert||function(a){return a},c.context=b.context||this.owner,a.is(d,"string")){var e=d.lastIndexOf("."),f=d,g=this.source||this.owner,h="";e>0&&(h=d.slice(0,e),f=d.slice(e+1),g=a.path(this.source,h)),d=g&&g[f]}return c.convert=d,c}}}),c=a.Class("zn.data.Bindable",a.data.Observable,{statics:{parseOptions:function(b,c){var d=null;if("string"==typeof b&&"{"===b.charAt(0)&&"}"===b.charAt(b.length-1)){var e=b.slice(1,-1),f=e.split(";");d={owner:c,sourcePaths:f.shift()},a.each(f,function(a){if(!a)return-1;var b=a.split("=");d[b[0]]=b[1]})}else"object"==typeof b&&(d=b);return d}},properties:{model:{get:function(){return this._model},set:function(b){this._model=b,a.each(this.__bindings__,function(a){a.set("source",b)})}}},methods:{init:{auto:!0,value:function(){this.__bindings__={}},after:function(){this.__binding()}},dispose:function(){this.super(),a.each(this.__bindings__,function(a){a.dispose()}),this.__bindings__=null},let:function(a,b,d,e){var f=c.parseOptions(b);f?(f.owner=d,this.setBinding(a,f,e)):this.set(a,b)},getBinding:function(a){return this.__bindings__[a]},setBinding:function(a,c,d){return c.source=c.model||this.get("model"),c.owner=c.owner||this,this.clearBinding(a),this.__bindings__[a]=new b(d||this,c.targetPath||a,c),this},clearBinding:function(a){var b=this.__bindings__[a];b&&(b.dispose(),delete this.__bindings__[a])},__binding:function(){var b=this,c=this.constructor.getMeta("properties");a.each(c,function(a,c){a&&a.binding&&b.let(c,a.binding)})}}})}(zn),function(a){a.Class("zn.data.Map",{properties:{count:{get:function(){var a=0;return this.each(function(){a++}),a}},keys:{get:function(){return Object.keys(this._map)},set:function(){throw new Error("Unable to set keys of Map")}},values:{get:function(){return this.__getMapValues()},set:function(){throw new Error("Unable to set values of Map")}}},methods:{init:{auto:!0,value:function(a){this._map={},this.concat(a)}},concat:function(b){if(b){var c=(this._map,this);a.each(b,function(a,b){c.set(b,a)})}return this},contains:function(a){return a in this._map},getItem:function(a){return this._map[a]},get:function(a){if(this.has(a))return this.super(a);var b=this.getItem(a);return b&&b.value},set:function(a,b){if(this.has(a))return this.super(a);var c=a,d=this._map[c];return d||(d=this._map[c]={key:c}),d.value=b,this},remove:function(a){return delete this._map[a],this},clear:function(){return this._map={},this},each:function(b,c){return a.each(this._map,b,c),this},eachKey:function(b,c){return a.each(this.keys,b,c),this},eachValue:function(b,c){return a.each(this.values,b,c),this},toArray:function(){var a=[];return this.each(function(b){a.push(b)}),a},toObject:function(){var a={};return this.each(function(b){a[b.key]=b.value}),a},__getMapValues:function(){var a=[];return this.each(function(b){a.push(b.value)}),a}}})}(zn),function(a){a.Class("zn.data.ObservableList",a.data.List,{mixins:[a.data.Observable],events:["change"],methods:{add:function(a){var b=this.super(a);return this.notify("count"),this.fire("change",{action:"add",items:[a],index:b}),b},addRange:function(a){var b=this.super(a);return this.notify("count"),this.fire("change",{action:"add",items:a,index:b}),b},insert:function(a,b){return this.super(a,b),this.notify("count"),this.fire("change",{action:"add",items:[a],index:b}),b},insertRange:function(a,b){return this.super(a,b),this.notify("count"),this.fire("change",{action:"add",items:a,index:b}),b},remove:function(a){var b=this.super(a);return b>=0&&(this.notify("count"),this.fire("change",{action:"remove",items:[a],index:b})),index},removeAt:function(a){var b=this.super(a);return void 0!==b&&(this.notify("count"),this.fire("change",{action:"remove",items:[b],index:a})),b},clear:function(){var a=this.super();return this.notify("count"),this.fire("change",{action:"clear",items:a}),a},sort:function(a){var b=this.super(a);return this.notify("count"),this.fire("change",{action:"sort",sort:a||function(a,b){return a>b?1:b>a?-1:0}}),b}}})}(zn),function(a){a.Class("zn.data.ObservableMap",a.data.Map,{mixins:[a.data.Observable],events:["change"],methods:{set:function(a,b){if(this.has(a))return this.super(a);var c=this._map,d={key:a,value:b};if(a in c){var e=c[a];c[a]=d,this.fire("change",{action:"replace",oldItem:e,newItem:d})}else c[a]=d,this.notify("count"),this.fire("change",{action:"add",items:[d]})},remove:function(a){var b=this._map;if(a in b){var c=b[a];delete b[a],this.notify("count"),this.fire("change",{action:"remove",items:[c]})}},clear:function(){this.toArray();return this.super(),this.notify("count"),this.fire("change",{action:"clear",items:this.toArray()}),this}}})}(zn),function(a){var b=(a.Class({events:["init","start","stop","cancle","goNext","goPre"],properties:{pre:null,next:null,delay:null,action:null,args:[],context:this,taskList:null,status:{value:"",get:function(){return this._status}}},methods:{init:function(a){this.sets(a),this.fire("init",this)},start:function(){"started"!=this._status&&(this._action?(this._action.apply(this._context,this._args),this._status="started"):this.goNext(),this.fire("start",this))},stop:function(){this._status="stoped",this.fire("stop",this)},cancle:function(){this._status="cancle",this.fire("cancle",this)},goNext:function(){this._next&&this._next.start(),this.fire("goNext",this)},goPre:function(){this._pre&&this._pre.start(),this.fire("goPre",this)}}}),a.Class({properties:{url:"",data:{set:function(a){this._data=a},get:function(){return a.is(this._data,"object")?JSON.stringify(this._data):this._data}},method:"GET",asyns:!0,username:null,password:null,headers:{get:function(){return a.overwrite({"X-Requested-With":"XMLHttpRequest","Content-type":"application/json"},this._headers)},set:function(a){this._headers=a}},timeout:{get:function(){return this._timeout||2e4},set:function(a){this._timeout=a}}},events:["before","after","success","error","complete","timeout"],methods:{init:function(a){this.sets(a),this._isRunning=!1},__initXMLHttpRequest:function(){if(this._XMLHttpRequest)return this._XMLHttpRequest;if(!window.ActiveXObject)return this._XMLHttpRequest=new XMLHttpRequest,this._XMLHttpRequest;for(var a="MSXML2.XMLHTTP",b=["Microsoft.XMLHTTP",a,a+".3.0",a+".4.0",a+".5.0",a+".6.0"],c=b.length-1;c>-1;c--)try{return this._XMLHttpRequest=new ActiveXObject(b[c]),this._XMLHttpRequest}catch(d){continue}},__onComplete:function(a,b){clearTimeout(this._timeoutID),a.abort(),this._isRunning=!1,this.fire("complete",a,b),this.fire("after",a,b),this.offs()},__initRequestHeader:function(a,b){for(var c in b)a.setRequestHeader(c,b[c])},resetEvents:function(){this.offs()},send:function(b){if(this._isRunning)return!1;this.sets(b);var c=this.__initXMLHttpRequest(),d=this,e=a.async.defer();if(this._isRunning=!0,this.timeout&&(this._timeoutID=setTimeout(function(){d._isRunning&&(d.fire("timeout",d),d.__onComplete(c,"timeout"))},this.timeout)),this.fire("before",this)===!1||!this.url)return this.__onComplete(c),e.promise;var f=this.url,g=this.data,h=this._method.toUpperCase();return"GET"===h&&(g&&(f=f+"?"+g),g=null),c.readyState<2,c.open(h,f,this.asyns),c.onreadystatechange=function(a){var b=a.currentTarget;if(4==b.readyState){var c=b.status,d=b.responseText,f=b.getResponseHeader("Content-Type");if(c>=200&&300>c){try{d=f&&f.indexOf("application/json")>=0?JSON.parse(d):d}catch(g){d=d}this.fire("success",d),e.resolve(d,b)}else this.fire("error",b),e.reject(b,d);return this.__onComplete(b,d),d}}.bind(this),this.__initRequestHeader(c,this.headers),c.send(g),this.asyns||this.__onComplete(c),e.promise},abort:function(){this._XMLHttpRequest&&this._XMLHttpRequest.abort()}}})),c=a.Class({"static":!0,properties:{max:3,count:{get:function(){return this._data.length}}},methods:{init:function(){this._data=[]},getInstance:function(){for(var a=0,c=this._data.length;c>a;a++)if(!this._data[a]._isRunning)return this._data[a].resetEvents(),this._data[a];return function(a){var c=new b;return a._data.push(c),c}(this)}}});a.http=a.Class({"static":!0,properties:{timeout:1e3},methods:{request:function(b,d){var e=c.getInstance();return a.each(b,function(a,b){"function"==typeof a&&e.on(b,a,this)},this),d&&d(e),e.send(b)},get:function(a){return a.method="GET",this.request(a)},post:function(a){return a.method="POST",this.request(a)},put:function(a){return a.method="PUT",this.request(a)},"delete":function(a){return a.method="DELETE",this.request(a)}}})}(zn),function(a){var b=a.Class({events:["init","validate","before","success","error","complete","after"],properties:{url:null,data:null,method:"POST",headers:null},methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},validateArgv:function(a,b,c,d){var e=a||this._url||"",f=b||this._data||{},g=c||this._method||"POST",h=d||this._headers||{},i={url:e,data:f,method:g,headers:h};return i},exec:function(a,b,c,d){var e=this.validateArgv(a,b,c,d),f=Store.fire("before",e);return f===!1?!1:(f=this.fire("before",e),f===!1?!1:e)},__onComplete:function(a){var b=Store.fire("after",a);return b===!1?!1:(b=this.fire("complete",a),b===!1?!1:void 0)},__onSuccess:function(a,b){var c=Store.fire("success",a,b);return c===!1?!1:(c=this.fire("success",a,b),c===!1?!1:void 0)},__onError:function(a){var b=Store.fire("success",a);return b===!1?!1:(b=this.fire("success",a),b===!1?!1:void 0)},refresh:function(a,b,c,d){return this.exec(a,b,c,d)},clone:function(b){var c=this._data;return c="object"==typeof c?a.extend(JSON.parse(JSON.stringify(c)),b):b,new this.constructor(this._url,c,this._method,this._headers)},extend:function(b){return this._data=a.extend(this._data,b),this},overwrite:function(b){return this._data=a.overwrite(this._data,b),this}}}),c=a.Class(b,{methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},exec:function(b,c,d,e){var f=this.validateArgv(b,c,d,e),g=Store.fire("before",f);return g===!1?!1:(g=this.fire("before",f),g===!1?!1:f===!1?!1:a.http[f.method.toLowerCase()]({url:Store.fixURL(f.url),data:f.data,headers:f.headers,success:function(a,b,c){this.__onSuccess(b,c)}.bind(this),error:function(a,b){this.__onError(b)}.bind(this),complete:function(a,b){this.__onComplete(b)}.bind(this)}))}}}),d=a.Class(b,{methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},exec:function(b,c,d,e){var f=this.validateArgv(b,c,d,e),g=Store.fire("before",f);if(g===!1)return!1;if(g=this.fire("before",f),g===!1)return!1;if(f===!1)return!1;var h=f.url,i=f.method,j=f.data,k=f.headers,l=this,m={method:i.toUpperCase()};switch(i.toUpperCase()){case"POST":var n=new FormData;for(var o in j)n.append(o,j[o]);m.body=n,m.headers=a.overwrite(k,{Accept:"multipart/form-data","Content-Type":"multipart/form-data; charset=UTF-8"});break;case"GET":var p=[];a.each(j,function(a,b){p.push(b+"="+a)}),h+="?"+p.join("&");break;case"JSON":m.body=JSON.stringify(j),m.method="POST",m.headers=a.overwrite(k,{Accept:"multipart/form-data","Content-Type":"multipart/form-data; charset=UTF-8"})}return new Promise(function(a,b){fetch(Store.fixURL(h),m).then(function(a){return a.json()}).then(function(b){l.__onSuccess(b),l.__onComplete(b),a(b)}).catch(function(a){l.__onError(a),l.__onComplete(a),b(a)})})}}}),e=a.Class({events:["init","before","after"],properties:{data:null,argv:{set:function(a){this._argv=a},get:function(){return this._argv||{}}}},methods:{init:function(a,b){this.reset(a,b),this.fire("init",this)},reset:function(a,b){return a&&(this._data=a),b&&(this._argv=b),this._argv&&this._argv.autoLoad&&this.exec(),this},refresh:function(){return this.exec(),this},exec:function(){var a=this._data,b=this;if(!a)return!1;if((this._argv.onExec&&this._argv.onExec(a))===!1)return!1;var c=this.fire("before",a);return c===!1?!1:a.__id__?void a.on("success",function(a,c){b._argv.onSuccess&&b._argv.onSuccess(c)}).on("error",function(a,c){b._argv.onError&&b._argv.onError(c)}).on("complete",function(a,c){b._argv.onComplete&&b._argv.onComplete(c)}).exec():new Promise(function(c,d){if(a){if(Store.fire("success",a)===!1)return!1;b._argv.onSuccess&&b._argv.onSuccess(a),b._argv.onComplete&&b._argv.onComplete(a),c(a)}else{if(Store.fire("error",a)===!1)return!1;b._argv.onError&&b._argv.onError(a),b._argv.onComplete&&b._argv.onComplete(a),d(a)}})}}}),f=a.Class({events:["before","success","error","complete","after"],properties:{host:window.location.origin,engine:{set:function(a){this._engine=a},get:function(){return"Fetcher"==this._engine?d:c}},headers:{}},methods:{request:function(a,b,e,f){var g=null;return new(g="Fetcher"==this._engine?d:c)(a,b,e,f)},post:function(a,b,c){return this.request(a,b,"POST",c)},"delete":function(a,b,c){return this.request(a,b,"DELETE",c)},put:function(a,b,c){return this.request(a,b,"PUT",c)},get:function(b,c,d){var e=[];return a.each(c,function(b,c){e.push(c+"="+(a.is(b,"object")?JSON.stringify(b):b))}),this.request(b,e.join("&"),"GET",d)},setHost:function(a){this._host=a},getHost:function(){return this._host},fixURL:function(a){return a?(a&&-1===a.indexOf("http://")&&(a=this._host+a),a):""},dataSource:function(a,b){return new e(a,b)}}});a.store=a.GLOBAL.Store=new f}(zn),function(a){a.cookie=a.Class({"static":!0,methods:{setItem:function(a,b,c){var d=a+"="+encodeURIComponent(b);c&&(d+="; expires="+new Date(+new Date+36e5*c).toGMTString()),document.cookie=d},getItem:function(a){var b=new RegExp("(?:; )?"+a+"=([^;]*);?");return b.test(document.cookie)?decodeURIComponent(RegExp.$1):null},removeItem:function(a){this.setItem(a,null,-9999)},clear:function(){document.cookie=null}}})}(zn),function(a){var b=document.createElement("div"),c=b.style,d=/width|height|top|right|bottom|left|size|margin|padding/i,e=/[c-x%]/,f="px",g=/(?:^|-)([a-z])/g,h=/([A-Z])/g,i={lineHeight:!0,zIndex:!0,zoom:!0},j={"float":"cssFloat"};a.style=a.Class({"static":!0,methods:{each:function(a,b,c){if(a&&b){var d=a.length;if(d>=0)for(var e=0;d>e;e++)b.call(c,a[e],e);else for(var f in a)a.hasOwnProperty(f)&&b.call(c,a[f],f)}},getCssText:function(a){var b=[""];return this.each(a,function(a,c){b.push(this.getStyleProperty(c,!0)+":"+this.getStyleValue(c,a))},this),b.join(";")},getStyleValue:function(a,b){var c=this.getStyleProperty(a),g=b;return d.test(c)&&(e.test(b)||i[c]||(g+=f)),g},getStyleProperty:function(a,b){var d=this.lowerCamelCase(a);return d in c?b&&(d=this.deCamelCase(a)):d=b?env.prefix()[1]+a:env.prefix()[0]+this.upperCamelCase(a),j[a]||d},lowerCamelCase:function(a){var b=this.upperCamelCase(a);return b.charAt(0).toLowerCase()+b.substring(1)},upperCamelCase:function(a){return a.replace(g,function(a,b){return b.toUpperCase()})},deCamelCase:function(a){return a.replace(h,function(a,b){return"-"+b.toLowerCase()})},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)}}}),a.dom=a.Class({"static":!0,methods:{hasClass:function(a,b){return a.classList.contains(b)},addClass:function(a){var b=a.classList;return arguments.shift(),b.add.apply(b,arguments)},removeClass:function(a){var b=a.classList;return arguments.shift(),b.remove.apply(b,arguments)},toggleClass:function(a,b){return a.classList.toggle(b)},setStyle:function(b,c,d){var e=a.style.getStyleProperty(c);b.style[e]=a.style.getStyleValue(c,d)},getStyle:function(b,c,d){var e=b,f=a.style.getStyleProperty(c),g=d?b.style:window.getComputedStyle?getComputedStyle(e,null):e.currentStyle;return g[f]||""},removeStyle:function(b,c){var d=a.style.getStyleProperty(c,!0);b.style.removeProperty(d)},hasStyle:function(a,b){var c=a.style.cssText;return c.indexOf(b+":")>-1},setStyles:function(b,c){b.style.cssText+=a.style.getCssText(c)},getPosition:function(a){var b=a,c=0,d=0,e=0,f=0;if(b.getBoundingClientRect){var g=b.getBoundingClientRect();c=g.left+Math.max(document.documentElement.scrollLeft,document.body.scrollLeft)-document.documentElement.clientLeft,d=g.top+Math.max(document.documentElement.scrollTop,document.body.scrollTop)-document.documentElement.clientTop,e=g.width,f=g.height}else{for(;b!=document.body&&b;)c+=b.offsetLeft,d+=b.offsetTop,b=b.offsetParent;e=b.offsetWidth,f=b.offsetHeight}return{x:c,y:d,width:e,height:f}},on:function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):element.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},off:function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=null}}})}(zn); |
@@ -1,2 +0,2 @@ | ||
var __isServer="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),zn={VERSION:"0.0.1",DEBUG:!0,ZN_PATH:"",PATH:"",isServer:__isServer,GLOBAL:function(){return __isServer?global:window}.call(null)};if(zn.GLOBAL.zn=zn,__isServer)zn.ZN_PATH=__dirname,zn.PATH=process.cwd(),module.exports=zn;else{var _zn_url="";try{__a__=__b__}catch(e){e.fileName?_zn_url=e.fileName:e.sourceURL?_zn_url=e.sourceURL:e.stacktrace?console.log(e.stacktrace):e.stack?(_zn_url=e.stack.split("\n")[1],_zn_url=_zn_url.replace(/\s/g,""),_zn_url=_zn_url.substring(2,_zn_url.length)):console.log(e.toString())}if(!_zn_url)for(var _scripts=document.getElementsByTagName("script"),_src="",_node,i=0,_len=scripts.length;_len>i;i++)if(_node=scripts[i],_node.getAttribute&&(_src=_node.getAttribute("src")||"","zn.js"===_src.slice(-5)||"zn.minx.js"===_src.slice(-10))){_zn_url=_src;break}if(!_zn_url)throw new Error("zn.js has not been included, please do it first.");zn.ZN_PATH=_zn_url.substring(0,_zn_url.lastIndexOf("/")+1)}!function(a){var b=Object.prototype.toString,c={idle:function(){},idleArray:function(){return[]},idleObject:function(){return{}},format:function(){var a=arguments,b=null,c=null;return a.length<2?a[0]:(b=a[0],b=b.toString?b.toString():b,c=a[1],d.each(c,function(a,c){null!==a&&void 0!==a&&(a=d.is(a,"object")?JSON.stringify(a):a.toString?a.toString():a,b=b.replace(new RegExp("\\{"+c+"\\}","gi"),a))}),b)},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)}).toUpperCase()},serializeJSON:function(a){return Object.keys(a).map(function(b){return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&")},fix:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&"function"!=typeof b[f]&&(b[f]=e[f])}return b},extend:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b},overwrite:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&void 0===b[f]&&(b[f]=e[f])}return b},path:function(a,b,c){var d=a||{};if(b){var e,f=b.split("."),g=f.length,h=0;if(arguments.length<3)for(;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e];else{for(g-=1;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e]=d[e]||{};e=f[h],d&&(d.__set__?d.__set__(e,c):d[e]=c,d=c)}}return d},invoke:function(b,c,d){if(b&&c){var e,f,g=c.lastIndexOf(".");g>0?(e=a.path(b,c.substring(0,g)),e&&(f=e[c.substring(g+1)])):(e=b,f=b[c]),f&&f.apply(e,d)}},deepEachObject:function(a,b,c){if(d.is(a,"object")){var e,f=null;for(var g in a)f=a[g],d.is(f,"object")?this.deepEachObject(f,b,c):(e=b&&b.call(c,f,g,a),void 0!==e&&null!==e&&(a[g]=e))}return a},arrayValueToObject:function(a,b,c){if(d.is(a,"array")){for(var e,f=null,g={},h=0,i=a.length;i>h;h++)f=a[h],e=b&&b.call(c,f,h,a),void 0!==e&&null!==e&&(g[f]=e);a=g}return a}},d={toString:function(a){return a&&a.toString?a.toString():b.call(a)},each:function(a,c,d){if(a&&c)if(a.__each__)a.__each__(c,d);else{var e=a.length,f=null;if(e>0&&"[object Array]"===b.call(a)){for(var g=0;e>g;g++)if(f=c.call(d,a[g],g),f===!1)return!1}else for(var h in a)if(a.hasOwnProperty(h)){if(f=c.call(d,a[h],h),f===!1)return!1;if(-1===f)continue}}},clone:function(b){if(b){if(b.__clone__)return b.__clone__();if(a.is(b,"array"))return b.slice(0);var c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c}return b},type:function(a){return a&&a.__type__?a.__type__:b.call(a).slice(8,-1).toLowerCase()},is:function(a,b){if(a&&a.__is__)return a.__is__(b);if("string"==typeof b)switch(b.toLowerCase()){case"plain":return a&&a.constructor===Object;default:return this.type(a)===b}else if("function"==typeof b)return a instanceof b},may:function(a,b){return a?a.__may__?a.__may__(b):a.hasOwnProperty("on"+b):!1},can:function(a,b){return a?a.__can__?a.__can__(b):"function"==typeof a[b]:!1},has:function(a,b){return a?a.__has__?a.__has__(b):a.hasOwnProperty(b):!1},get:function(a,b){return a?a.__get__?a.__get__(b):a[b]:void 0},set:function(a,b,c){a&&(a.__set__?a.__set__(b,c):a[b]=c)},gets:function(a){if(a){if(a.__gets__)return a.__gets__();var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}},sets:function(a,b){if(a&&b)if(a.__sets__)a.__sets__(b);else for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}};c.extend(a,c),c.extend(a,d)}(zn),function(a){{var b=Array.prototype.slice,c=Object.prototype.hasOwnProperty,d=Object.prototype.toString,e={format:function(){var b=arguments,c=this;return 1==b.length&&"object"==typeof b[0]&&(b=b[0]),a.each(b,function(b,d){null!==b&&void 0!==b&&(b="object"==a.type(b)?JSON.stringify(b):b.toString?b.toString():b,c=c.replace(new RegExp("\\{"+d+"\\}","gi"),b))}),c.toString()}},f={isArray:function(b){return b&&"[object Array]"===a.toString(b)&&b.constructor===Array}},g={forEach:function(a,b){if(!a)return!1;for(var c=0,d=this.length;d>c;c++)a.call(b,this[c],c);return this},indexOf:function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},lastIndexOf:function(a){for(var b=this.length-1;b>=0;b--)if(this[b]===a)return b;return-1}},h={bind:function(a){var c=this;return function(){return c.apply(a,b.call(arguments,1))}}},i={toArray:function(a){return b.call(a)},keys:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(b);return d},values:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(a[b]);return d},create:function(){var b=function(){};return function(c,d){if(null===c)throw new Error("Cannot set a null [[Prototype]]");if("object"!=typeof c)throw new TypeError("Argument must be an object");return a.each(d,function(a,b){i.defineProperty(c,a,b)}),b.prototype=c,new b}}(),defineProperty:function(a,b,c){return a&&b&&c&&c.hasOwnProperty("value")&&(a[b]=c.value),a}};({parse:function(){return""},stringify:function(){var a=d,b=Array.isArray,c={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},e=function(a){return c[a]||"\\u"+(a.charCodeAt(0)+65536).toString(16).substr(1)},f=/[\\"\u0000-\u001F\u2028\u2029]/g;return function g(c){if(null==c)return"null";if("number"==typeof c)return isFinite(c)?c.toString():"null";if("boolean"==typeof c)return c.toString();if("object"==typeof c){var d;if("function"==typeof c.toJSON)return g(c.toJSON());if(b(c)){d="[";for(var h=0;h<c.length;h++)d+=(h?", ":"")+g(c[h]);return d+"]"}if("[object Object]"===a.call(c)){d=[];for(var i in c)c.hasOwnProperty(i)&&d.push(g(i)+": "+g(c[i]));return"{"+d.join(", ")+"}"}}return'"'+c.toString().replace(f,e)+'"'}}()})}a.fix(Array,f),a.fix(Array.prototype,g),a.fix(Function.prototype,h),a.fix(String.prototype,e)}(zn),function(a){function b(){}function c(){var c,e,f,h=l._arguments.apply(this,arguments),i=h.name,j=h.super,k=h.meta,n=k.methods.init;if(j._static_)throw new Error("Static class cannot be inherited.");if(j._final_)throw new Error("Final class cannot be inherited.");if(i&&k.partial&&(c=a.path(d,i)),k.static){if(c){if(!c._static_)throw new Error('Partial class "'+i+'" must be static.')}else c=function(){throw new Error("Cannot instantiate static class.")};f=c.prototype}else{if(c){if(c._static_)throw new Error('Partial class "'+i+'" must not be static.');if(c._super_!==j&&c._super_!==b)throw new Error('Partial class "'+i+'" must have consistent super class.')}else c=k.abstract?function(){throw new Error("Cannot instantiate abstract class.")}:function(){var b=c._mixins_||[],d=c._ctors_||[],e=null,f=arguments;this.__id__=g++,this.__handlers__={},this.__initializing__=!0,this.__afters__=[];for(var h=null,i=null,j=0,k=b.length;k>j;j++)h=b[j],h["@init"]?(i=h["@init"].meta,i=a.is(i,"function")?i:i.value,m(h.prototype.__super__,this,f),i&&i.call(this)):m(h.prototype.__super__,this,f);m(this.__super__,this,f);for(var l=0,n=d.length;n>l;l++)e=d[l],e=a.is(e,"function")?e:e.value,e&&e.apply(this,f);for(;this.__afters__.length>0;){var o=this.__afters__.pop();o.handler.apply(o.context,f)}this.__afters__=null,delete this.__afters__,this.__initializing__=!1},c._ctors_=[];c._super_!==j?(e=function(){},e.prototype=j.prototype,f=new e,f.constructor=c,f.__type__=i||"Anonymous",f.__super__=j,c.prototype=f):f=c.prototype,f.class=f.constructor,n&&(c._ctors_.push(n),f.__ctor__||(f.__ctor__=n))}return l._meta(c,h),f.__define__&&f.__define__.call(c),i&&a.path(d,i,c),c}var d=a.GLOBAL,e="@",f=1,g=1,h={fixTargetCtor:function(a){return a instanceof b?a.constructor:a},fixTargetKey:function(a){return e+a},defineEvent:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d,g={};return f||(g=Object.defineProperty(a,"on"+b.toLowerCase(),{get:function(){var a=this.__handlers__[b];return a?a[0].handler:null},set:function(a){var c=this.__handlers__,d=c[b]=c[b]||[];d[0]={owner:this,handler:a,context:null}}})),d[e]={name:b,type:"event",meta:c,descriptor:g},f},defineProperty:function(b,c,d){var e,f,g=h.fixTargetCtor(b),i=h.fixTargetKey(c),j=i in g,k={};if("value"in d){var l=d.value,m="_"+c,n=d.get,o=d.set;e=n||function(){return m in this?this[m]:a.is(l,"function")?l.call(this):l},f=d.readonly?function(a,b){return b&&b.force?void(this[m]=a):!1}:o||function(a){this[m]=a}}else e=d.get||function(){return void 0},f=d.set||function(){return!1};return j&&(e.__super__=g[i].getter,f.__super__=g[i].setter),k=Object.defineProperty(b,c,{get:e,set:f,configurable:!0}),g[i]={name:c,type:"property",meta:d,getter:e,setter:f,descriptor:k},j},defineMethod:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d;return d[e]={name:b,type:"method",meta:c},b in a&&(c.value||(c.value=function(){}),c.value.__super__=a[b]),a[b]=c.value,f}},i={__handlers__:{},member:function(a,c){var d=h.fixTargetCtor(c||this),e=d[h.fixTargetKey(a)];return e||d===b?e:this.member(a,d._super_)},may:function(a){var b=this.member(a);return b&&"event"==b.type},has:function(a){var b=this.member(a);return b&&"property"==b.type},can:function(a){var b=this.member(a);return b&&"method"==b.type},get:function(a,b){var c=this.member(a);return c&&c.getter?c.getter.call(this,b):void 0},set:function(a,b,c){var d=this.member(a);return d&&d.setter&&d.setter.call(this,b,c),this},gets:function(b){var c={},d=h.fixTargetCtor(this)._properties_;return a.each(d,function(a){c[a]=this.get(a,b)},this),c},sets:function(a,b,c){if(a){var d=null;for(var e in a)a.hasOwnProperty(e)&&(d=a[e],(c&&c(d,e,b))!==!1&&this.set(e,d,b))}return this},each:function(a,b){for(var c=h.fixTargetCtor(this)._properties_,d=0,e=c.length;e>d;d++){var f=c[d],g=a.call(b,f,d,this.member(f),this.get(f));if(g===!1)return!1}return this},__may__:function(a){return this.may(a)},__has__:function(a){return this.has(a)},__can__:function(a){return this.can(a)},__get__:function(a){return this.get(a)},__gets__:function(){return this.gets()},__set__:function(a,b){this.set(a,b)},__sets__:function(a){this.sets(a)},__each__:function(a,b){return this.each(a,b)}},j={toString:function(){return"{ ClassName: "+(this._name_||"Anonymous")+", ClassID: "+this._id_+" }"},createSelf:function(){return new this.constructor.apply(this,Array.prototype.slice.call(arguments))},getProperties:function(b){var c={};if(!this.getMeta||"ZNObject"==this._name_)return c;var d=this._super_,e=this._mixins_;return d&&a.extend(c,d.getProperties(b)),e&&e.length&&a.each(e,function(d){a.extend(c,d.getProperties(b))}),a.each(this.getMeta("properties"),function(a,d){var e=b&&b(d,a)===!1;e||a.hidden||(c[d]=a)}),c},getPropertie:function(b){var c=null;return b&&a.each(this.getProperties(),function(a,d){return b==d&&(c=a),-1}),c},getMeta:function(a){return a?this._meta_[a]:this._meta_},setMeta:function(a,b){return this._meta_[a]=b,this},defineEvent:function(a,b,c){return h.defineEvent(c||this.prototype,a,b)||this._events_.push(a),this},defineProperty:function(a,b,c){return h.defineProperty(c||this.prototype,a,b)||this._properties_.push(a),this},defineMethod:function(a,b,c){return h.defineMethod(c||this.prototype,a,b)||this._methods_.push(a),this}},k={toString:function(){var a={ClassName:this.__name__||"Anonymous",InstanceID:this.__id__,Meta:this.constructor._meta_};return JSON.stringify(a)},toJson:function(){var b={};return a.each(this.constructor.getProperties(),function(a,c){b[c]=this.get(c)},this),b},getProperties:function(){return this.constructor.getProperties()},getPropertie:function(a){return this.constructor.getPropertie(a)},upon:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[];f[0]=a.extend({owner:this,handler:c},d)}return this},on:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[{owner:null,handler:null,context:null}];f.push(a.extend({owner:this,handler:c},d))}return this},off:function(a,b,c){var d,e=this.__handlers__[a]||[],f=c&&c.context;if(b)for(var g=e.length-1;g>=0;g--)d=e[g],d.handler!==b||f&&d.context!==f||this.__handlers__[a].splice(g,1);else this.__handlers__[a]=[{owner:null,handler:null,context:null}];return this},offs:function(){var b=Array.prototype.slice.call(arguments);return b.length?a.each(b,function(a){this.__handlers__[a]&&(this.__handlers__[a]=[{owner:null,handler:null,context:null}])}.bind(this)):this.__handlers__={},this},fire:function(a,b,c){var d,e=this.__handlers__[a],f=null;if(e)for(var g=0,h=e.length;h>g;g++)if(d=e[g],d&&d.handler&&(f=c&&"apply"==c.method?d.handler.apply(d.context||d.owner,b):d.handler.call(d.context||d.owner,d.owner,b,c),!1===f))return!1;return this},dispose:function(){return this.__handlers__={},this},destroy:function(){return this.dispose()},"super":function(){var a=this.super.caller.__super__;return a?a.apply(this,arguments):void 0},is:function(b){if("string"==typeof b&&(b=a.path(d,b)),b){if(this instanceof b)return!0;for(var c=this.constructor._mixins_,e=0,f=c.length;f>e;e++){var g=c[e];if(b===g)return!0}}return!1},__is__:function(a){return this.is(a)},__clone__:function(){}};a.extend(b,i,j,{_id_:0,_name_:"ZNObject",_statics_:{},_events_:[],_properties_:[],_methods_:[],_mixins_:[],_meta_:{}}),a.extend(b.prototype,i,k),a.isZNObject=function(a){return a instanceof b};var l={_arguments:function(){var c,d,e,f=arguments,g=f.length,h=f[0],i={"static":!1,statics:[],partial:!1,"abstract":!1,"final":!1,mixins:[],events:[],properties:[],methods:[]};if(3===g){if(c=h,d=f[1],e=f[2],!a.is(d,"function"))throw new Error("Invalid _super class.")}else if(2===g){if(a.is(h,"string"))c=h,d=null;else{if(!a.is(h,"function"))throw new Error("Invalid _super class.");c=null,d=h}e=f[1]}else{if(1!==g)throw new Error("Invalid arguments.");if(c=null,d=null,e=h,!a.is(e,"object"))throw new Error("The meta argument must be an object.")}return c=c||"",e=a.overwrite(e||{},i),d=d||b,{name:c,"super":d,meta:e}},_meta:function(b,c){var d=c.name,e=c.super,g=c.meta;return a.extend(b,i,j,{_id_:f++,_name_:d,_super_:e,_partial_:g.partial,_abstract_:g.abstract,_static_:g.static,_final_:g.final,_statics_:a.extend({},e._statics_,g.statics),_events_:e._events_.slice(0),_properties_:e._properties_.slice(0),_methods_:e._methods_.slice(0),_mixins_:e._mixins_.concat(g.mixins),_meta_:g}),a.extend(b,b._statics_),g.static?(a.each(g.events,function(a){b.defineEvent(a,{},b)}),a.each(g.properties||g.props,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c},b)}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c,b)}),g.methods.init&&g.methods.init.call(b,b)):(a.each(g.mixins,function(c){var d=c.prototype;a.each(c._events_,function(a){b.defineEvent(a,d.member(a).meta)}),a.each(c._properties_,function(a){b.defineProperty(a,d.member(a).meta)}),a.each(c._methods_,function(a){i[a]||k[a]||b.defineMethod(a,d.member(a).meta)})}),a.each(g.events,function(a){b.defineEvent(a,{})}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c})}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c)})),b}},m=function(c,d,e){if(c&&c!==b){var f=c.member("init"),g=c._mixins_,h=null;return f&&f.meta.after&&d.__afters__.push({context:d,handler:f.meta.after}),g.length&&a.each(g,function(b){b["@init"]&&(h=b["@init"].meta,h=a.is(h,"function")?h:h.value,m(b.prototype.__super__,b.prototype,e),h&&h.call(d))}),f&&f.meta.auto&&f.meta.value.apply(d,e),arguments.callee(c._super_,d)}};a.Class=c}(zn),function(a){var b=".",c="..",d="/",e={PENDING:0,LOADING:1,WAITING:2,LOADED:3},f=null;"undefined"!=typeof module&&module.exports?a.SLASH=d=require("path").sep:f=document;var g={normalizePath:function(a){for(var e,f=a.split(d),g=[f[0]],h=1,i=f.length;i>h;h++)switch(e=f[h]){case b:break;case c:var j=g[g.length-1];j===b||j===c?g.push(c):g.pop();break;default:g.push(e)}return g.join(d)},formatPath:function(b,c){var e=b;e="/"===d?e.split("\\").join(d):e.split("/").join(d);var f=c?c.get("path")||a.PATH:a.PATH,g=e.indexOf(d);return e.indexOf(a.PATH)>-1||e.indexOf(a.ZN_PATH)>-1?e:(e=g>0?f?f.substring(0,f.lastIndexOf(d)+1)+e:e:0===g?a.PATH.substring(0,a.PATH.lastIndexOf(d))+e:a.ZN_PATH+d+e+d,e.slice(-1)===d&&(e+="index.js"),e=this.normalizePath(e))}},h=a.Class("zn.Module",{events:["pending","loading","waiting","loaded"],statics:{all:{},current:null,counter:0,preLoadedPackage:{},unloadModule:function(b){try{if(!h.all[b])return this;b=require.resolve(b);var c=require.cache[b];c&&c.parent&&c.parent.children.splice(c.parent.children.indexOf(c),1),require.cache[b]=null;var d=h.all[b];h.all[b]=null,d&&d.parent&&h.unloadModule(d.parent.path)}catch(e){a.error(e.message)}return this},loadModule:function(b,c,d){if(a.is(b,h))return b.load(c);if("node:"===b.substring(0,5))return c(require(b.substring(5)));var i=null;if(a.NODE_PATHS&&a.NODE_PATHS.length&&a.NODE_PATHS.every(function(a){return 0===b.indexOf(a)?(i=b,!1):!0}),!i&&(i=g.formatPath(b,d),!f))try{i=require.resolve(i)}catch(j){return a.error("node require.resolve("+i+"): ",j.message),c({})}var k=h.all[i];k?k.load(c):(k=h.all[i]=new h(i),h.counter++,f?this.__webModule(i,function(a){if(h.counter--,a)throw new Error("Failed to load module:"+b);k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}):this.__nodeModule(i,function(){h.counter--,k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}))},__nodeModule:function(b,c){var d=b,e=c||a.idle,f={};try{f=require(d)}catch(g){console.error(g),a.error("Node.js require("+d+") error: ",g.message)}finally{e(f)}},__webModule:function(b,c){var e=f.head||f.getElementsByTagName("head")[0],g=f.createElement("script"),h=b,i=c||a.idle,j=function(a){g.onload=null,g.onerror=null,i(a)};h=h.slice(-1)===d?h+"index.js":h,h=".js"===h.slice(-3).toLowerCase()?h:h+".js",g.src=h,"onload"in g?g.onload=function(){j(null)}:g.onreadystatechange=function(a){var b=g.readyState;j("loaded"===b||"complete"===b?null:a)},g.onerror=function(a){j(a)},e.appendChild(g)}},properties:{parent:null,status:e.PENDING,path:"",dependencies:null,factory:null,value:{set:function(a){a._ctors_&&(a.$path=this.get("path")),this._value=a},get:function(){return this._value}}},methods:{init:function(a,b,c){this.sets({path:a,dependencies:b||[],factory:c,value:{}}),this._callbacks=[]},exec:function(a){var b=process.argv,c=b[1];return this.sets({path:c,status:e.LOADING}),this.load(a),this},__pending:function(a){this._callbacks.push(a)},__loading:function(b){var c=(this.get("path"),this.get("dependencies")),d=this._depHandler,f=this.get("factory"),g=this.get("value");this.set("status",e.WAITING),this._callbacks.push(b);var i=c.length;if(0===i)g=f.call(g)||g,this.set("value",g),this.set("status",e.LOADED),a.each(this._callbacks,function(a){a(g)});else{var j=[],k=this;a.each(c,function(b,c){d&&(b=d(b,c)),h.loadModule(b,function(b){j[c]=b,i--,0===i&&(g=f.apply(g,j)||g,k.set("value",g),k.set("status",e.LOADED),a.each(k._callbacks,function(a){a(g)}))},k)})}},__waiting:function(a){var b=this;setTimeout(function(){0===h.counter&&b.set("status",e.LOADING),b.load(a)})},__loaded:function(a){a(this.get("value"))},load:function(b){var c=this.get("status"),d=b||a.idle;switch(c){case e.PENDING:this.__pending(d);break;case e.LOADING:this.__loading(d);break;case e.WAITING:this.__waiting(d);break;case e.LOADED:this.__loaded(d)}return this}}});a.define=function(){var b=arguments,c=b.length,d=b[0],e=[],f=null;switch(c){case 1:a.is(d,"function")?f=d:a.is(d,"array")?(e=d,f=function(){var b={};return a.each(arguments,function(c){c._name_?b[c._name_]=c:a.extend(b,c)}),b}):f=function(){return d};break;case 2:e=d,f=b[1];break;case 3:e=d,f=b[1]}return e&&a.is(e,"string")&&(e=[e]),h.current=new h("",e,f),b[2]&&(h.current._depHandler=b[2]),h.current};var i=a.Class("zn.Loader",{"static":!0,properties:{preLoadPackages:[]},methods:{init:function(){for(var a=this.preLoadPackages,b=0,c=a.length;c>b;b++)this.loadPackage(a[b])},loadPackage:function(b){this.load(b+"index.js",function(b){a.extend(h.preLoadedPackage,b)})},load:function(a,b,c){return h.loadModule(a,b,c),this}}});a.load=i.load,a.module=h}(zn),function(a){var b={lower:[97,123],upper:[65,91]};a.char=a.Class({"static":!0,methods:{lowercase:function(b){return a.is(b,"string")?b.replace(/[A-Z]/g,function(a){return String.fromCharCode(32|a.charCodeAt(0))}):b},uppercase:function(b){return a.is(b,"string")?b.replace(/[a-z]/g,function(a){return String.fromCharCode(-33&a.charCodeAt(0))}):b},toUnicode:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a.charCodeAt(c));return b},toChar:function(a,b){for(var c=[],d=a;b>d;d++)c.push(String.fromCharCode(d));return c},getLowercaseLetters:function(){var a=b.lower;return this.toChar(a[0],a[1])},getUppercaseLetters:function(){var a=b.upper;return this.toChar(a[0],a[1])},getStringFromChar:function(a,b){for(var c=a||"A",d=b||26,e=[],f=0;d>f;f++)e.push(String.fromCharCode(c.charCodeAt(0)+f));return e.join("")}}})}(zn),function(a){var b={ISO8601:"yyyy-MM-dd hh:mm:ss.SSS",ISO8601_WITH_TZ_OFFSET:"yyyy-MM-ddThh:mm:ssO",DATETIME:"dd MM yyyy hh:mm:ss.SSS",ABSOLUTETIME:"hh:mm:ss.SSS"};a.date=a.Class({"static":!0,methods:{getSecond:function(a){var b=1*a.substring(1,a.length);switch(a.substring(0,1)){case"s":return 1e3*b;case"h":return 60*b*60*1e3;case"d":return 24*b*60*60*1e3}},asString:function(a){var c=b.ISO8601;"string"==typeof a&&(c=arguments[0],a=arguments[1]);var d=this.__addZero(a.getDate()),e=this.__addZero(a.getMonth()+1),f=this.__addZero(a.getFullYear()),g=this.__addZero(a.getFullYear().toString().substring(2,4)),h=c.indexOf("yyyy")>-1?f:g,i=this.__addZero(a.getHours()),j=this.__addZero(a.getMinutes()),k=this.__addZero(a.getSeconds()),l=this.__padWithZeros(a.getMilliseconds(),3),m=this.__offset(a),n=c.replace(/dd/g,d).replace(/MM/g,e).replace(/y{1,4}/g,h).replace(/hh/g,i).replace(/mm/g,j).replace(/ss/g,k).replace(/SSS/g,l).replace(/O/g,m);return n},__padWithZeros:function(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c},__addZero:function(a){return this.__padWithZeros(a,2)},__offset:function(a){var b=Math.abs(a.getTimezoneOffset()),c=String(Math.floor(b/60)),d=String(b%60);return 1==c.length&&(c="0"+c),1==d.length&&(d="0"+d),a.getTimezoneOffset()<0?"+"+c+d:"-"+c+d}}})}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,CANCLE:1,PAUSE:2,FINISHED:3},d=a.Class({events:["init","finished"],properties:{status:{value:c.PENDING,get:function(){return this._status}}},methods:{init:function(){},doTask:function(a,b){if(a){var c=b||[];c.unshift(this),a.handler.apply(a.context,c)}},done:function(){this._status=c.FINISHED,this._data=b.call(arguments),this.fire("finished",this._data),this.off("finished")}}}),e=a.Class({events:["clear","insert","pause","resume","exception","every","finally"],properties:{count:{get:function(){return this._tasks.length}}},methods:{init:function(a){this._exceptions=[],this._finallys=[],this._everys=[],this._tasks=[],this._taskProcessor=[],this._lastTask=null,this._data=[],this._max=(a||{}).max||1},destroy:function(){this._everys=[],this._tasks=[],this._taskProcessor=[],this.fire("finally",this._data,{method:"apply"}),this.super()},clear:function(){this._tasks=[]},pause:function(a){return this._paused=!0,a>0&&(this._pauseTimer=setTimeout(function(){this.resume()}.bind(this),a)),this.fire("pause"),this},resume:function(){return this._pauseTimer&&clearTimeout(this._pauseTimer),this._paused=!1,this.fire("resume"),this.doTask(),this},exception:function(a,b){return this.on("exception",a,b||this),this},"catch":function(a){return this.fire("exception",a),this},"finally":function(a,b){return this.on("finally",a,b||this),this},every:function(a,b){return this.on("every",a,b||this),this},unshift:function(a,b){return this.insert(a,b,0),this},push:function(a,b){return this.insert(a,b,-1),this},inserts:function(a,b,c){var d=a||[],e=c||0,f=this._tasks[0],g=null,h=null;return d.map(function(a){return h={handler:a,context:b||this},g&&(h.previous=g,g.next=h),g=h,h}.bind(this)),f&&(g.next=f,f.previous=g),d.unshift(0),d.unshift(e),this._tasks.splice.apply(this._tasks,d),this},insert:function(a,b,c){var d={handler:a,context:b||this},e=c||-1;switch(e){case-1:this._lastTask&&(d.previous=d,this._lastTask.next=d),this._lastTask=d,this._tasks.push(d);break;case 0:var f=this._tasks[0];f&&(d.next=f,f.previous=d),this._tasks.unshift(d);break;default:this._tasks.splice(e,0,d)}return this.fire("insert",d),this},getTaskProcessor:function(){for(var a=null,b=this._taskProcessor.length,e=0;b>e;e++)if(a=this._taskProcessor[e],a.status==c.FINISHED)return a;if(!a&&this._max>b){var f=new d;return f.queue=this,f.on("finished",this.__onProcessorFinished.bind(this),this),f}},start:function(){return this._data=[],this.doTask()},doTask:function(a){var b=this._tasks.shift();if(b){var c=this.getTaskProcessor();c&&(b.previousResult=a,c.doTask(b,a))}else this.destroy();return this},__onProcessorFinished:function(a,b){this._data.push(b),this.fire("every",b,{method:"apply"}),this.doTask(b)}}});a.queue=function(a){return new e(a)}}(zn),function(a){var b=["INFO","DEBUG","WARN","ERROR","TRACE","ALL"],c=["#100000","#2125a0","#a82c2c","#c045b7","1cb131","#100000"],d=[38,34,35,31,32,36,33],e={INFO:0,DEBUG:1,WARN:2,ERROR:3,TRACE:4,ALL:6},f=a.Class({events:["info","debug","warn","error","trace","all"],methods:{init:function(){this._config={only:null,levels:["info","debug","warn","error","trace","all"]}},config:function(b){this._config=a.overwrite(b,this._config)},info:function(){this.__log.call(this,e.INFO,arguments)},debug:function(){this.__log.call(this,e.DEBUG,arguments)},warn:function(){this.__log.call(this,e.WARN,arguments)},trace:function(){this.__log.call(this,e.TRACE,arguments)},error:function(){this.__log.call(this,e.ERROR,arguments)},all:function(){this.__log.call(this,e.ALL,arguments)},__getDateString:function(b){return a.date.asString(b||new Date)},__getPosition:function(){try{throw new Error}catch(b){return a.DEBUG&&a.CONSOLE_ERROR&&console.log(b),b.stack.split("\n")[5].replace(/\(/g,"").replace(/\)/g,"").split("/").pop()}},__formatLog4Server:function(a,c){var e="",f="",g="";return c&&(f="[",g="[0m",e=d[5]+"m",c=d[a.type]+"m"),[a.time," [",f,c,b[a.type],g,"] [",f,e,a.pos,g,"] ",a.message].join("")},__formatLog4Client:function(a){return["%c"+a.time," [",b[a.type],"] "].join("")},__log:function(d,e){var f=Array.prototype.slice.call(e),g=f.slice(0),h=b[d].toLowerCase(),i=this.__getDateString(),j=this.__getPosition();if(g.unshift(j),g.unshift(h),g.unshift(i),"undefined"!=typeof module&&module.exports?f.unshift(this.__formatLog4Server({type:d,time:i,pos:j},!0)):(f.unshift("color:"+c[d]),f.unshift(this.__formatLog4Client({type:d,time:i,pos:j},!0))),this.__isOk(h)){var k=this.fire(h,g);k!==!1&&a.DEBUG&&console.log.apply(this,f)}},__isOk:function(a){if(this._config.only){if(this._config.only===a)return!0}else{var b=-1!==this._config.levels.indexOf(a);if(b)return!0}return!1}}});a.logger=new f;var g={info:function(){a.logger.info.apply(a.logger,arguments)},debug:function(){a.logger.debug.apply(a.logger,arguments)},warn:function(){a.logger.warn.apply(a.logger,arguments)},trace:function(){a.logger.trace.apply(a.logger,arguments)},error:function(){a.logger.error.apply(a.logger,arguments)}};a.extend(a,g)}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,FULFILLED:1,REJECTED:2},d=a.Class({events:["complete"],properties:{promise:null},methods:{init:function(a,b){this._promise=new e,a&&this.resolve(a),b&&this.reject(b)},resolve:function(){var d=b.call(arguments);try{var e=this.get("promise"),g=this;if(e.get("readyState")!=c.PENDING)return;e.set("readyState",c.FULFILLED),e.set("data",d),a.each(e.get("resolves"),function(a){a.apply(g,d)})}catch(h){f.catch(h,this)}this.fire("complete",d)},reject:function(){var a=b.call(arguments);try{var d=this.get("promise");if(d.get("readyState")!=c.PENDING)return;d.set("readyState",c.REJECTED),d.set("reason",a);var e=d.get("rejects")[0];e&&e.apply(this,a)}catch(g){f.catch(g,this)}this.fire("complete",a)}}}),e=a.Class({statics:{isPromise:function(a){return null!==a&&void 0!==a&&"function"==typeof a.then},defer:null},properties:{resolves:null,rejects:null,data:null,reason:null,readyState:null},methods:{init:function(){this.set("resolves",[]),this.set("rejects",[]),this.set("exceptions",[]),this.set("readyState",c.PENDING)},then:function(a,f){function g(){var c=b.call(arguments),d=a?a.apply(this,c):c;return e.isPromise(d)?d.then(function(){h.resolve.apply(h,b.call(arguments))}):h.resolve.apply(h,d),d}var h=new d;if(this.get("readyState")===c.PENDING)this.get("resolves").push(g),this.get("rejects").push(f?f:function(){h.reject.apply(h,b.call(arguments))});else if(this.get("readyState")===c.FULFILLED){var i=this;setTimeout(function(){g.apply(i,i.get("data"))})}return h.promise},"catch":function(a){return f.exception(a)},"finally":function(a){return f.finally(a)},otherwise:function(a){return this.then(void 0,a)}}}),f=a.async=a.Class({"static":!0,methods:{init:function(){this._exceptions=[],this._finallys=[],this._count=0,this._currIndex=0,this._dataArray=[]},exception:function(a){return this._exceptions.push(a),this},"catch":function(b,c){return a.each(this._exceptions,function(a){a.call(c,b)}),this},"finally":function(a){return this._finallys.push(a),this},defer:function(b,c){var e=this,f=new d(b,c);return f.on("complete",function(b,c){e._currIndex++,e._dataArray.push(c),e._currIndex==e._count&&(a.each(e._finallys,function(b){try{b(e._dataArray)}catch(c){a.error(c.message)}}),e._finallys=[])}),e._count++,f},all:function(b){var c=f.defer(),d=0,e=[];return a.each(b,function(a){a.then(function(a){e.push(a),d++,d>=b.length&&c.resolve(e)})}),c.promise},any:function(b){var c=f.defer();return a.each(b,function(a){a.then(function(a){c.resolve(a)})}),c.promise}}})}(zn),function(){zn.querystring=zn.Class({"static":!0,properties:{config:{get:function(){}}},methods:{init:function(){this._config={separator:"&",equal:"=",minIndex:0,maxIndex:1e3}},config:function(a){return this.overwrite(this._config,a),this},parse:function(a,b){var c=zn.extend({},this._config,b),d={},e=c.equal,f=a.split(c.separator),g=f.length;c.maxIndex>0&&g>c.maxIndex&&(g=c.maxIndex);for(var h=c.minIndex;g>h;h++){var i=f[h].replace(/\+/g,"%20"),j=i.indexOf(e),k=null,l=null;j>=0?(k=i.substr(0,j),l=i.substr(j+1)):(k=i,l=""),k=decodeURIComponent(k),l=decodeURIComponent(l),hasOwnProperty(d,k)?zn.is(d[k],"array")?d[k].push(l):d[k]=[d[k],l]:d[k]=l}return d},stringify:function(a,b){var c=zn.extend({},this._config,b),d=[],e=c.equal,f={};if(f=zn.isZNObject(a)?a.gets():a,!zn.is(f,"object"))throw new Error("Agrument Error.");for(var g in a){var h=a[g],i=encodeURIComponent(this.__stringifyValue(g));h=encodeURIComponent(this.__stringifyValue(h)),d.push(i+e+h)}return d.join(c.separator)},__stringifyValue:function(a){switch(zn.type(a)){case"string":return a;case"boolean":return a?"true":"false";case"object":case"array":return JSON.stringify(a);case"number":return isFinite(a)?a:"";default:return""}}}})}(zn),function(a){var b=(a.Class({events:["init","start","stop","cancle","goNext","goPre"],properties:{pre:null,next:null,delay:null,action:null,args:[],context:this,taskList:null,status:{value:"",get:function(){return this._status | ||
}}},methods:{init:function(a){this.sets(a),this.fire("init",this)},start:function(){"started"!=this._status&&(this._action?(this._action.apply(this._context,this._args),this._status="started"):this.goNext(),this.fire("start",this))},stop:function(){this._status="stoped",this.fire("stop",this)},cancle:function(){this._status="cancle",this.fire("cancle",this)},goNext:function(){this._next&&this._next.start(),this.fire("goNext",this)},goPre:function(){this._pre&&this._pre.start(),this.fire("goPre",this)}}}),a.Class({properties:{url:"",data:{set:function(a){this._data=a},get:function(){return a.is(this._data,"object")?JSON.stringify(this._data):this._data}},method:"GET",asyns:!0,username:null,password:null,headers:{get:function(){return a.overwrite({"X-Requested-With":"XMLHttpRequest","Content-type":"application/json"},this._headers)},set:function(a){this._headers=a}},timeout:{get:function(){return this._timeout||2e4},set:function(a){this._timeout=a}}},events:["before","after","success","error","complete","timeout"],methods:{init:function(a){this.sets(a),this._isRunning=!1},__initXMLHttpRequest:function(){if(this._XMLHttpRequest)return this._XMLHttpRequest;if(!window.ActiveXObject)return this._XMLHttpRequest=new XMLHttpRequest,this._XMLHttpRequest;for(var a="MSXML2.XMLHTTP",b=["Microsoft.XMLHTTP",a,a+".3.0",a+".4.0",a+".5.0",a+".6.0"],c=b.length-1;c>-1;c--)try{return this._XMLHttpRequest=new ActiveXObject(b[c]),this._XMLHttpRequest}catch(d){continue}},__onComplete:function(a,b){clearTimeout(this._timeoutID),a.abort(),this._isRunning=!1,this.fire("complete",a,b),this.fire("after",a,b),this.offs()},__initRequestHeader:function(a,b){for(var c in b)a.setRequestHeader(c,b[c])},resetEvents:function(){this.offs()},send:function(b){if(this._isRunning)return!1;this.sets(b);var c=this.__initXMLHttpRequest(),d=this,e=a.async.defer();if(this._isRunning=!0,this.timeout&&(this._timeoutID=setTimeout(function(){d._isRunning&&(d.fire("timeout",d),d.__onComplete(c,"timeout"))},this.timeout)),this.fire("before",this)===!1||!this.url)return this.__onComplete(c),e.promise;var f=this.url,g=this.data,h=this._method.toUpperCase();return"GET"===h&&(g&&(f=f+"?"+g),g=null),c.readyState<2,c.open(h,f,this.asyns),c.onreadystatechange=function(a){var b=a.currentTarget;if(4==b.readyState){var c=b.status,d=b.responseText,f=b.getResponseHeader("Content-Type");if(c>=200&&300>c){try{d=f&&f.indexOf("application/json")>=0?JSON.parse(d):d}catch(g){d=d}this.fire("success",d),e.resolve(d,b)}else this.fire("error",b),e.reject(b,d);return this.__onComplete(b,d),d}}.bind(this),this.__initRequestHeader(c,this.headers),c.send(g),this.asyns||this.__onComplete(c),e.promise},abort:function(){this._XMLHttpRequest&&this._XMLHttpRequest.abort()}}})),c=a.Class({"static":!0,properties:{max:3,count:{get:function(){return this._data.length}}},methods:{init:function(){this._data=[]},getInstance:function(){for(var a=0,c=this._data.length;c>a;a++)if(!this._data[a]._isRunning)return this._data[a].resetEvents(),this._data[a];return function(a){var c=new b;return a._data.push(c),c}(this)}}});a.http=a.Class({"static":!0,properties:{timeout:1e3},methods:{request:function(b,d){var e=c.getInstance();return a.each(b,function(a,b){"function"==typeof a&&e.on(b,a,this)},this),d&&d(e),e.send(b)},get:function(a){return a.method="GET",this.request(a)},post:function(a){return a.method="POST",this.request(a)},put:function(a){return a.method="PUT",this.request(a)},"delete":function(a){return a.method="DELETE",this.request(a)}}})}(zn),function(a){var b=a.Class({events:["init","validate","before","success","error","complete","after"],properties:{url:null,data:null,method:"POST",headers:null},methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},validateArgv:function(a,b,c,d){var e=a||this._url||"",f=b||this._data||{},g=c||this._method||"POST",h=d||this._headers||{},i={url:e,data:f,method:g,headers:h};return i},exec:function(a,b,c,d){var e=this.validateArgv(a,b,c,d),f=Store.fire("before",e);return f===!1?!1:(f=this.fire("before",e),f===!1?!1:e)},__onComplete:function(a){var b=Store.fire("after",a);return b===!1?!1:(b=this.fire("complete",a),b===!1?!1:void 0)},__onSuccess:function(a,b){var c=Store.fire("success",a,b);return c===!1?!1:(c=this.fire("success",a,b),c===!1?!1:void 0)},__onError:function(a){var b=Store.fire("success",a);return b===!1?!1:(b=this.fire("success",a),b===!1?!1:void 0)},refresh:function(a,b,c,d){return this.exec(a,b,c,d)},clone:function(b){var c=this._data;return c="object"==typeof c?a.extend(JSON.parse(JSON.stringify(c)),b):b,new this.constructor(this._url,c,this._method,this._headers)},extend:function(b){return this._data=a.extend(this._data,b),this},overwrite:function(b){return this._data=a.overwrite(this._data,b),this}}}),c=a.Class(b,{methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},exec:function(b,c,d,e){var f=this.validateArgv(b,c,d,e),g=Store.fire("before",f);return g===!1?!1:(g=this.fire("before",f),g===!1?!1:f===!1?!1:a.http[f.method.toLowerCase()]({url:Store.fixURL(f.url),data:f.data,headers:f.headers,success:function(a,b,c){this.__onSuccess(b,c)}.bind(this),error:function(a,b){this.__onError(b)}.bind(this),complete:function(a,b){this.__onComplete(b)}.bind(this)}))}}}),d=a.Class(b,{methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},exec:function(b,c,d,e){var f=this.validateArgv(b,c,d,e),g=Store.fire("before",f);if(g===!1)return!1;if(g=this.fire("before",f),g===!1)return!1;if(f===!1)return!1;var h=f.url,i=f.method,j=f.data,k=f.headers,l=this,m={method:i.toUpperCase()};switch(i.toUpperCase()){case"POST":var n=new FormData;for(var o in j)n.append(o,j[o]);m.body=n,m.headers=a.overwrite(k,{Accept:"multipart/form-data","Content-Type":"multipart/form-data; charset=UTF-8"});break;case"GET":var p=[];a.each(j,function(a,b){p.push(b+"="+a)}),h+="?"+p.join("&");break;case"JSON":m.body=JSON.stringify(j),m.method="POST",m.headers=a.overwrite(k,{Accept:"multipart/form-data","Content-Type":"multipart/form-data; charset=UTF-8"})}return new Promise(function(a,b){fetch(Store.fixURL(h),m).then(function(a){return a.json()}).then(function(b){l.__onSuccess(b),l.__onComplete(b),a(b)}).catch(function(a){l.__onError(a),l.__onComplete(a),b(a)})})}}}),e=a.Class({events:["init","before","after"],properties:{data:null,argv:{set:function(a){this._argv=a},get:function(){return this._argv||{}}}},methods:{init:function(a,b){this.reset(a,b),this.fire("init",this)},reset:function(a,b){return a&&(this._data=a),b&&(this._argv=b),this._argv&&this._argv.autoLoad&&this.exec(),this},refresh:function(){return this.exec(),this},exec:function(){var a=this._data,b=this;if(!a)return!1;if((this._argv.onExec&&this._argv.onExec(a))===!1)return!1;var c=this.fire("before",a);return c===!1?!1:a.__id__?void a.on("success",function(a,c){b._argv.onSuccess&&b._argv.onSuccess(c)}).on("error",function(a,c){b._argv.onError&&b._argv.onError(c)}).on("complete",function(a,c){b._argv.onComplete&&b._argv.onComplete(c)}).exec():new Promise(function(c,d){if(a){if(Store.fire("success",a)===!1)return!1;b._argv.onSuccess&&b._argv.onSuccess(a),b._argv.onComplete&&b._argv.onComplete(a),c(a)}else{if(Store.fire("error",a)===!1)return!1;b._argv.onError&&b._argv.onError(a),b._argv.onComplete&&b._argv.onComplete(a),d(a)}})}}}),f=a.Class({events:["before","success","error","complete","after"],properties:{host:window.location.origin,engine:{set:function(a){this._engine=a},get:function(){return"Fetcher"==this._engine?d:c}},headers:{}},methods:{request:function(a,b,e,f){var g=null;return new(g="Fetcher"==this._engine?d:c)(a,b,e,f)},post:function(a,b,c){return this.request(a,b,"POST",c)},"delete":function(a,b,c){return this.request(a,b,"DELETE",c)},put:function(a,b,c){return this.request(a,b,"PUT",c)},get:function(b,c,d){var e=[];return a.each(c,function(b,c){e.push(c+"="+(a.is(b,"object")?JSON.stringify(b):b))}),this.request(b,e.join("&"),"GET",d)},setHost:function(a){this._host=a},getHost:function(){return this._host},fixURL:function(a){return a?(a&&-1===a.indexOf("http://")&&(a=this._host+a),a):""},dataSource:function(a,b){return new e(a,b)}}});a.store=a.GLOBAL.Store=new f}(zn),function(a){a.cookie=a.Class({"static":!0,methods:{setItem:function(a,b,c){var d=a+"="+encodeURIComponent(b);c&&(d+="; expires="+new Date(+new Date+36e5*c).toGMTString()),document.cookie=d},getItem:function(a){var b=new RegExp("(?:; )?"+a+"=([^;]*);?");return b.test(document.cookie)?decodeURIComponent(RegExp.$1):null},removeItem:function(a){this.setItem(a,null,-9999)},clear:function(){document.cookie=null}}})}(zn),function(a){var b=document.createElement("div"),c=b.style,d=/width|height|top|right|bottom|left|size|margin|padding/i,e=/[c-x%]/,f="px",g=/(?:^|-)([a-z])/g,h=/([A-Z])/g,i={lineHeight:!0,zIndex:!0,zoom:!0},j={"float":"cssFloat"};a.style=a.Class({"static":!0,methods:{each:function(a,b,c){if(a&&b){var d=a.length;if(d>=0)for(var e=0;d>e;e++)b.call(c,a[e],e);else for(var f in a)a.hasOwnProperty(f)&&b.call(c,a[f],f)}},getCssText:function(a){var b=[""];return this.each(a,function(a,c){b.push(this.getStyleProperty(c,!0)+":"+this.getStyleValue(c,a))},this),b.join(";")},getStyleValue:function(a,b){var c=this.getStyleProperty(a),g=b;return d.test(c)&&(e.test(b)||i[c]||(g+=f)),g},getStyleProperty:function(a,b){var d=this.lowerCamelCase(a);return d in c?b&&(d=this.deCamelCase(a)):d=b?env.prefix()[1]+a:env.prefix()[0]+this.upperCamelCase(a),j[a]||d},lowerCamelCase:function(a){var b=this.upperCamelCase(a);return b.charAt(0).toLowerCase()+b.substring(1)},upperCamelCase:function(a){return a.replace(g,function(a,b){return b.toUpperCase()})},deCamelCase:function(a){return a.replace(h,function(a,b){return"-"+b.toLowerCase()})},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)}}}),a.dom=a.Class({"static":!0,methods:{hasClass:function(a,b){return a.classList.contains(b)},addClass:function(a){var b=a.classList;return arguments.shift(),b.add.apply(b,arguments)},removeClass:function(a){var b=a.classList;return arguments.shift(),b.remove.apply(b,arguments)},toggleClass:function(a,b){return a.classList.toggle(b)},setStyle:function(b,c,d){var e=a.style.getStyleProperty(c);b.style[e]=a.style.getStyleValue(c,d)},getStyle:function(b,c,d){var e=b,f=a.style.getStyleProperty(c),g=d?b.style:window.getComputedStyle?getComputedStyle(e,null):e.currentStyle;return g[f]||""},removeStyle:function(b,c){var d=a.style.getStyleProperty(c,!0);b.style.removeProperty(d)},hasStyle:function(a,b){var c=a.style.cssText;return c.indexOf(b+":")>-1},setStyles:function(b,c){b.style.cssText+=a.style.getCssText(c)},getPosition:function(a){var b=a,c=0,d=0,e=0,f=0;if(b.getBoundingClientRect){var g=b.getBoundingClientRect();c=g.left+Math.max(document.documentElement.scrollLeft,document.body.scrollLeft)-document.documentElement.clientLeft,d=g.top+Math.max(document.documentElement.scrollTop,document.body.scrollTop)-document.documentElement.clientTop,e=g.width,f=g.height}else{for(;b!=document.body&&b;)c+=b.offsetLeft,d+=b.offsetTop,b=b.offsetParent;e=b.offsetWidth,f=b.offsetHeight}return{x:c,y:d,width:e,height:f}},on:function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):element.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},off:function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=null}}})}(zn); | ||
var __isServer="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),zn={VERSION:"0.0.1",DEBUG:!0,ZN_PATH:"",PATH:"",isServer:__isServer,GLOBAL:function(){return __isServer?global:window}.call(null)};if(zn.GLOBAL.zn=zn,__isServer)zn.ZN_PATH=__dirname,zn.PATH=process.cwd(),module.exports=zn;else{var _zn_url="";try{__a__=__b__}catch(e){e.fileName?_zn_url=e.fileName:e.sourceURL?_zn_url=e.sourceURL:e.stacktrace?console.log(e.stacktrace):e.stack?(_zn_url=e.stack.split("\n")[1],_zn_url=_zn_url.replace(/\s/g,""),_zn_url=_zn_url.substring(2,_zn_url.length)):console.log(e.toString())}if(!_zn_url)for(var _scripts=document.getElementsByTagName("script"),_src="",_node,i=0,_len=scripts.length;_len>i;i++)if(_node=scripts[i],_node.getAttribute&&(_src=_node.getAttribute("src")||"","zn.js"===_src.slice(-5)||"zn.minx.js"===_src.slice(-10))){_zn_url=_src;break}if(!_zn_url)throw new Error("zn.js has not been included, please do it first.");zn.ZN_PATH=_zn_url.substring(0,_zn_url.lastIndexOf("/")+1)}!function(a){var b=Object.prototype.toString,c={isNull:function(a){return null===a||void 0===a},isNotNull:function(a){return null!==a&&void 0!==a},idle:function(){},idleArray:function(){return[]},idleObject:function(){return{}},format:function(){var a=arguments,b=null,c=null;return a.length<2?a[0]:(b=a[0],b=b.toString?b.toString():b,c=a[1],d.each(c,function(a,c){null!==a&&void 0!==a&&(a=d.is(a,"object")?JSON.stringify(a):a.toString?a.toString():a,b=b.replace(new RegExp("\\{"+c+"\\}","gi"),a))}),b)},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)}).toUpperCase()},serializeJSON:function(a){return Object.keys(a).map(function(b){return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&")},fix:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&"function"!=typeof b[f]&&(b[f]=e[f])}return b},extend:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b},overwrite:function(a){for(var b=a||{},c=1,d=arguments.length;d>c;c++){var e=arguments[c];for(var f in e)e.hasOwnProperty(f)&&void 0===b[f]&&(b[f]=e[f])}return b},path:function(a,b,c){var d=a||{};if(b){var e,f=b.split("."),g=f.length,h=0;if(arguments.length<3)for(;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e];else{for(g-=1;d&&g>h;h++)e=f[h],d=d.__get__?d.__get__(e):d[e]=d[e]||{};e=f[h],d&&(d.__set__?d.__set__(e,c):d[e]=c,d=c)}}return d},invoke:function(b,c,d){if(b&&c){var e,f,g=c.lastIndexOf(".");g>0?(e=a.path(b,c.substring(0,g)),e&&(f=e[c.substring(g+1)])):(e=b,f=b[c]),f&&f.apply(e,d)}},deepEachObject:function(a,b,c){if(d.is(a,"object")){var e,f=null;for(var g in a)f=a[g],d.is(f,"object")?this.deepEachObject(f,b,c):(e=b&&b.call(c,f,g,a),void 0!==e&&null!==e&&(a[g]=e))}return a},arrayValueToObject:function(a,b,c){if(d.is(a,"array")){for(var e,f=null,g={},h=0,i=a.length;i>h;h++)f=a[h],e=b&&b.call(c,f,h,a),void 0!==e&&null!==e&&(g[f]=e);a=g}return a}},d={toString:function(a){return a&&a.toString?a.toString():b.call(a)},each:function(a,c,d){if(a&&c)if(a.__each__)a.__each__(c,d);else{var e=a.length,f=null;if(e>0&&"[object Array]"===b.call(a)){for(var g=0;e>g;g++)if(f=c.call(d,a[g],g),f===!1)return!1}else for(var h in a)if(a.hasOwnProperty(h)){if(f=c.call(d,a[h],h),f===!1)return!1;if(-1===f)continue}}},clone:function(b){if(b){if(b.__clone__)return b.__clone__();if(a.is(b,"array"))return b.slice(0);var c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c}return b},type:function(a){return a&&a.__type__?a.__type__:b.call(a).slice(8,-1).toLowerCase()},is:function(a,b){if(a&&a.__is__)return a.__is__(b);if("string"==typeof b)switch(b.toLowerCase()){case"plain":return a&&a.constructor===Object;default:return this.type(a)===b}else if("function"==typeof b)return a instanceof b},may:function(a,b){return a?a.__may__?a.__may__(b):a.hasOwnProperty("on"+b):!1},can:function(a,b){return a?a.__can__?a.__can__(b):"function"==typeof a[b]:!1},has:function(a,b){return a?a.__has__?a.__has__(b):a.hasOwnProperty(b):!1},get:function(a,b){return a?a.__get__?a.__get__(b):a[b]:void 0},set:function(a,b,c){a&&(a.__set__?a.__set__(b,c):a[b]=c)},gets:function(a){if(a){if(a.__gets__)return a.__gets__();var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}},sets:function(a,b){if(a&&b)if(a.__sets__)a.__sets__(b);else for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}};c.extend(a,c),c.extend(a,d)}(zn),function(a){{var b=Array.prototype.slice,c=Object.prototype.hasOwnProperty,d=Object.prototype.toString,e={format:function(){var b=arguments,c=this;return 1==b.length&&"object"==typeof b[0]&&(b=b[0]),a.each(b,function(b,d){null!==b&&void 0!==b&&(b="object"==a.type(b)?JSON.stringify(b):b.toString?b.toString():b,c=c.replace(new RegExp("\\{"+d+"\\}","gi"),b))}),c.toString()},firstUpperCase:function(a){return a.replace(/\b(\w)(\w*)/g,function(a,b,c){return b.toUpperCase()+c})}},f={isArray:function(b){return b&&"[object Array]"===a.toString(b)&&b.constructor===Array}},g={forEach:function(a,b){if(!a)return!1;for(var c=0,d=this.length;d>c;c++)a.call(b,this[c],c);return this},indexOf:function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},lastIndexOf:function(a){for(var b=this.length-1;b>=0;b--)if(this[b]===a)return b;return-1}},h={bind:function(a){var c=this;return function(){return c.apply(a,b.call(arguments,1))}}},i={toArray:function(a){return b.call(a)},keys:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(b);return d},values:function(a){if(a!==Object(a))throw new TypeError("Object.keys called on a non-object");var b,d=[];for(b in a)c.call(a,b)&&d.push(a[b]);return d},create:function(){var b=function(){};return function(c,d){if(null===c)throw new Error("Cannot set a null [[Prototype]]");if("object"!=typeof c)throw new TypeError("Argument must be an object");return a.each(d,function(a,b){i.defineProperty(c,a,b)}),b.prototype=c,new b}}(),defineProperty:function(a,b,c){return a&&b&&c&&c.hasOwnProperty("value")&&(a[b]=c.value),a}};({parse:function(){return""},stringify:function(){var a=d,b=Array.isArray,c={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},e=function(a){return c[a]||"\\u"+(a.charCodeAt(0)+65536).toString(16).substr(1)},f=/[\\"\u0000-\u001F\u2028\u2029]/g;return function g(c){if(null==c)return"null";if("number"==typeof c)return isFinite(c)?c.toString():"null";if("boolean"==typeof c)return c.toString();if("object"==typeof c){var d;if("function"==typeof c.toJSON)return g(c.toJSON());if(b(c)){d="[";for(var h=0;h<c.length;h++)d+=(h?", ":"")+g(c[h]);return d+"]"}if("[object Object]"===a.call(c)){d=[];for(var i in c)c.hasOwnProperty(i)&&d.push(g(i)+": "+g(c[i]));return"{"+d.join(", ")+"}"}}return'"'+c.toString().replace(f,e)+'"'}}()})}a.fix(Array,f),a.fix(Array.prototype,g),a.fix(Function.prototype,h),a.fix(String.prototype,e)}(zn),function(a){function b(){}function c(){var c=l._arguments.apply(this,arguments),e=c.name,f=c.super,h=c.meta,i=h.methods.init;h.properties=h.properties||h.props,h.props=null,delete h.props;var j,k,n;if(f._static_)throw new Error("Static class cannot be inherited.");if(f._final_)throw new Error("Final class cannot be inherited.");if(e&&h.partial&&(j=a.path(d,e)),h.static){if(j){if(!j._static_)throw new Error('Partial class "'+e+'" must be static.')}else j=function(){throw new Error("Cannot instantiate static class.")};n=j.prototype}else{if(j){if(j._static_)throw new Error('Partial class "'+e+'" must not be static.');if(j._super_!==f&&j._super_!==b)throw new Error('Partial class "'+e+'" must have consistent super class.')}else j=h.abstract?function(){throw new Error("Cannot instantiate abstract class.")}:function(){var b=j._mixins_||[],c=j._ctors_||[],d=null,e=arguments;this.__id__=g++,this.__handlers__={},this.__initializing__=!0,this.__afters__=[];for(var f=null,h=null,i=0,k=b.length;k>i;i++)f=b[i],f["@init"]?(h=f["@init"].meta,h=a.is(h,"function")?h:h.value,m(f.prototype.__super__,this,e),h&&h.call(this)):m(f.prototype.__super__,this,e);m(this.__super__,this,e);for(var l=0,n=c.length;n>l;l++)d=c[l],d=a.is(d,"function")?d:d.value,d&&d.apply(this,e);for(;this.__afters__.length>0;){var o=this.__afters__.pop();o.handler.apply(o.context,e)}this.__afters__=null,delete this.__afters__,this.__initializing__=!1},j._ctors_=[];j._super_!==f?(k=function(){},k.prototype=f.prototype,n=new k,n.constructor=j,n.__type__=e||"Anonymous",n.__super__=f,j.prototype=n):n=j.prototype,n.class=n.constructor,i&&(j._ctors_.push(i),n.__ctor__||(n.__ctor__=i))}return l._meta(j,c),n.__define__&&n.__define__.call(j),e&&a.path(d,e,j),j}var d=a.GLOBAL,e="@",f=1,g=1,h={fixTargetCtor:function(a){return a instanceof b?a.constructor:a},fixTargetKey:function(a){return e+a},defineEvent:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d,g={};return f||(g=Object.defineProperty(a,"on"+b.toLowerCase(),{get:function(){var a=this.__handlers__[b];return a?a[0].handler:null},set:function(a){var c=this.__handlers__,d=c[b]=c[b]||[];d[0]={owner:this,handler:a,context:null}}})),d[e]={name:b,type:"event",meta:c,descriptor:g},f},defineProperty:function(b,c,d){var e,f,g=h.fixTargetCtor(b),i=h.fixTargetKey(c),j=i in g,k={};if("value"in d){var l=d.value,m="_"+c,n=d.get,o=d.set;e=n||function(){return m in this?this[m]:a.is(l,"function")?l.call(this):l},f=d.readonly?function(a,b){return b&&b.force?void(this[m]=a):!1}:o||function(a){this[m]=a}}else e=d.get||function(){return void 0},f=d.set||function(){return!1};return j&&(e.__super__=g[i].getter,f.__super__=g[i].setter),k=Object.defineProperty(b,c,{get:e,set:f,configurable:!0}),g[i]={name:c,type:"property",meta:d,getter:e,setter:f,descriptor:k},j},defineMethod:function(a,b,c){var d=h.fixTargetCtor(a),e=h.fixTargetKey(b),f=e in d;return d[e]={name:b,type:"method",meta:c},b in a&&(c.value||(c.value=function(){}),c.value.__super__=a[b]),a[b]=c.value,f}},i={__handlers__:{},member:function(a,c){var d=h.fixTargetCtor(c||this),e=d[h.fixTargetKey(a)];return e||d===b?e:this.member(a,d._super_)},may:function(a){var b=this.member(a);return b&&"event"==b.type},has:function(a){var b=this.member(a);return b&&"property"==b.type},can:function(a){var b=this.member(a);return b&&"method"==b.type},get:function(a,b){var c=this.member(a);return c&&c.getter?c.getter.call(this,b):void 0},set:function(a,b,c){var d=this.member(a);return d&&d.setter&&d.setter.call(this,b,c),this},gets:function(b){var c={},d=h.fixTargetCtor(this)._properties_;return a.each(d,function(a){c[a]=this.get(a,b)},this),c},sets:function(a,b,c){if(a){var d=null;for(var e in a)a.hasOwnProperty(e)&&(d=a[e],(c&&c(d,e,b))!==!1&&this.set(e,d,b))}return this},each:function(a,b){for(var c=h.fixTargetCtor(this)._properties_,d=0,e=c.length;e>d;d++){var f=c[d],g=a.call(b,f,d,this.member(f),this.get(f));if(g===!1)return!1}return this},__may__:function(a){return this.may(a)},__has__:function(a){return this.has(a)},__can__:function(a){return this.can(a)},__get__:function(a){return this.get(a)},__gets__:function(){return this.gets()},__set__:function(a,b){this.set(a,b)},__sets__:function(a){this.sets(a)},__each__:function(a,b){return this.each(a,b)}},j={toString:function(){return"{ ClassName: "+(this._name_||"Anonymous")+", ClassID: "+this._id_+" }"},createSelf:function(){return new this.constructor.apply(this,Array.prototype.slice.call(arguments))},getProperties:function(b,c){var d={};if(!this.getMeta||"ZNObject"==this._name_)return d;var e=this._super_,f=this._mixins_;return e&&a.extend(d,e.getProperties(b,c)),f&&f.length&&a.each(f,function(e){a.extend(d,e.getProperties(b,c))}),a.each(this.getMeta("properties"),function(a,e){var f=b&&b.call(c||this,a,e,d);return f===!1||-1===f?f:void(a.hidden||(d[e]=a))},this),d},getProperty:function(a){var b=null;return a&&this.getProperties(function(c,d){return a==d&&(b=field),-1}),b},existProperty:function(a){return!!this.getProperty(a)},getMeta:function(a){return a?this._meta_[a]:this._meta_},setMeta:function(a,b){return a&&b&&(this._meta_[a]=b),this},defineEvent:function(a,b,c){return h.defineEvent(c||this.prototype,a,b)||this._events_.push(a),this},defineProperty:function(a,b,c){return h.defineProperty(c||this.prototype,a,b)||this._properties_.push(a),this},defineMethod:function(a,b,c){return h.defineMethod(c||this.prototype,a,b)||this._methods_.push(a),this}},k={toString:function(){var a={ClassName:this.__name__||"Anonymous",InstanceID:this.__id__,Meta:this.constructor._meta_};return JSON.stringify(a)},toJson:function(){var b={};return a.each(this.constructor.getProperties(),function(a,c){b[c]=this.get(c)},this),b},getProperties:function(){return this.constructor.getProperties.apply(this,arguments)},getPropertie:function(a){return this.constructor.getPropertie(a)},upon:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[];f[0]=a.extend({owner:this,handler:c},d)}return this},on:function(b,c,d){if(c){var e=this.__handlers__,f=e[b]=e[b]||[{owner:null,handler:null,context:null}];f.push(a.extend({owner:this,handler:c},d))}return this},off:function(a,b,c){var d,e=this.__handlers__[a]||[],f=c&&c.context;if(b)for(var g=e.length-1;g>=0;g--)d=e[g],d.handler!==b||f&&d.context!==f||this.__handlers__[a].splice(g,1);else this.__handlers__[a]=[{owner:null,handler:null,context:null}];return this},offs:function(){var b=Array.prototype.slice.call(arguments);return b.length?a.each(b,function(a){this.__handlers__[a]&&(this.__handlers__[a]=[{owner:null,handler:null,context:null}])}.bind(this)):this.__handlers__={},this},fire:function(a,b,c){var d,e=this.__handlers__[a],f=null;if(e)for(var g=0,h=e.length;h>g;g++)if(d=e[g],d&&d.handler&&(f=c&&"apply"==c.method?d.handler.apply(d.context||d.owner,b):d.handler.call(d.context||d.owner,d.owner,b,c),!1===f))return!1;return this},dispose:function(){return this.__handlers__={},this},destroy:function(){return this.dispose()},"super":function(){var a=this.super.caller.__super__;return a?a.apply(this,arguments):void 0},is:function(b){if("string"==typeof b&&(b=a.path(d,b)),b){if(this instanceof b)return!0;for(var c=this.constructor._mixins_,e=0,f=c.length;f>e;e++){var g=c[e];if(b===g)return!0}}return!1},__is__:function(a){return this.is(a)},__clone__:function(){}};a.extend(b,i,j,{_id_:0,_name_:"ZNObject",_statics_:{},_events_:[],_properties_:[],_methods_:[],_mixins_:[],_meta_:{}}),a.extend(b.prototype,i,k),a.isZNObject=function(a){return a instanceof b};var l={_arguments:function(){var c,d,e,f=arguments,g=f.length,h=f[0],i={"static":!1,statics:[],partial:!1,"abstract":!1,"final":!1,mixins:[],events:[],properties:[],methods:[]};if(3===g){if(c=h,d=f[1],e=f[2],!a.is(d,"function"))throw new Error("Invalid _super class.")}else if(2===g){if(a.is(h,"string"))c=h,d=null;else{if(!a.is(h,"function"))throw new Error("Invalid _super class.");c=null,d=h}e=f[1]}else{if(1!==g)throw new Error("Invalid arguments.");if(c=null,d=null,e=h,!a.is(e,"object"))throw new Error("The meta argument must be an object.")}return c=c||"",e=a.overwrite(e||{},i),d=d||b,{name:c,"super":d,meta:e}},_meta:function(b,c){var d=c.name,e=c.super,g=c.meta;return a.extend(b,i,j,{_id_:f++,_name_:d,_super_:e,_partial_:g.partial,_abstract_:g.abstract,_static_:g.static,_final_:g.final,_statics_:a.extend({},e._statics_,g.statics),_events_:e._events_.slice(0),_properties_:e._properties_.slice(0),_methods_:e._methods_.slice(0),_mixins_:e._mixins_.concat(g.mixins),_meta_:g}),a.extend(b,b._statics_),g.static?(a.each(g.events,function(a){b.defineEvent(a,{},b)}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c},b)}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c,b)}),g.methods.init&&g.methods.init.call(b,b)):(a.each(g.mixins,function(c){var d=c.prototype;a.each(c._events_,function(a){b.defineEvent(a,d.member(a).meta)}),a.each(c._properties_,function(a){b.defineProperty(a,d.member(a).meta)}),a.each(c._methods_,function(a){i[a]||k[a]||b.defineMethod(a,d.member(a).meta)})}),a.each(g.events,function(a){b.defineEvent(a,{})}),a.each(g.properties,function(c,d){b.defineProperty(d,a.is(c,"object")?c:{value:c})}),a.each(g.methods,function(c,d){b.defineMethod(d,a.is(c,"function")?{value:c}:c)})),b}},m=function(c,d,e){if(c&&c!==b){var f=c.member("init"),g=c._mixins_,h=null;return f&&f.meta.after&&d.__afters__.push({context:d,handler:f.meta.after}),g.length&&a.each(g,function(b){b["@init"]&&(h=b["@init"].meta,h=a.is(h,"function")?h:h.value,m(b.prototype.__super__,b.prototype,e),h&&h.call(d))}),f&&f.meta.auto&&f.meta.value.apply(d,e),arguments.callee(c._super_,d)}};a.Class=c}(zn),function(a){var b=".",c="..",d="/",e={PENDING:0,LOADING:1,WAITING:2,LOADED:3},f=null;"undefined"!=typeof module&&module.exports?a.SLASH=d=require("path").sep:f=document;var g={normalizePath:function(a){for(var e,f=a.split(d),g=[f[0]],h=1,i=f.length;i>h;h++)switch(e=f[h]){case b:break;case c:var j=g[g.length-1];j===b||j===c?g.push(c):g.pop();break;default:g.push(e)}return g.join(d)},formatPath:function(b,c){var e=b;e="/"===d?e.split("\\").join(d):e.split("/").join(d);var f=c?c.get("path")||a.PATH:a.PATH,g=e.indexOf(d);return e.indexOf(a.PATH)>-1||e.indexOf(a.ZN_PATH)>-1?e:(e=g>0?f?f.substring(0,f.lastIndexOf(d)+1)+e:e:0===g?a.PATH.substring(0,a.PATH.lastIndexOf(d))+e:a.ZN_PATH+d+e+d,e.slice(-1)===d&&(e+="index.js"),e=this.normalizePath(e))}},h=a.Class("zn.Module",{events:["pending","loading","waiting","loaded"],statics:{all:{},current:null,counter:0,preLoadedPackage:{},unloadModule:function(b){try{if(!h.all[b])return this;b=require.resolve(b);var c=require.cache[b];c&&c.parent&&c.parent.children.splice(c.parent.children.indexOf(c),1),require.cache[b]=null;var d=h.all[b];h.all[b]=null,d&&d.parent&&h.unloadModule(d.parent.path)}catch(e){a.error(e.message)}return this},loadModule:function(b,c,d){if(a.is(b,h))return b.load(c);if("node:"===b.substring(0,5))return c(require(b.substring(5)));var i=null;if(a.NODE_PATHS&&a.NODE_PATHS.length&&a.NODE_PATHS.every(function(a){return 0===b.indexOf(a)?(i=b,!1):!0}),!i&&(i=g.formatPath(b,d),!f))try{i=require.resolve(i)}catch(j){return a.error("node require.resolve("+i+"): ",j.message),c({})}var k=h.all[i];k?k.load(c):(k=h.all[i]=new h(i),h.counter++,f?this.__webModule(i,function(a){if(h.counter--,a)throw new Error("Failed to load module:"+b);k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}):this.__nodeModule(i,function(){h.counter--,k.sets({parent:d,path:i,dependencies:h.current.get("dependencies"),factory:h.current.get("factory"),status:e.LOADING}),k.load(c)}))},__nodeModule:function(b,c){var d=b,e=c||a.idle,f={};try{f=require(d)}catch(g){console.error(g),a.error("Node.js require("+d+") error: ",g.message)}finally{e(f)}},__webModule:function(b,c){var e=f.head||f.getElementsByTagName("head")[0],g=f.createElement("script"),h=b,i=c||a.idle,j=function(a){g.onload=null,g.onerror=null,i(a)};h=h.slice(-1)===d?h+"index.js":h,h=".js"===h.slice(-3).toLowerCase()?h:h+".js",g.src=h,"onload"in g?g.onload=function(){j(null)}:g.onreadystatechange=function(a){var b=g.readyState;j("loaded"===b||"complete"===b?null:a)},g.onerror=function(a){j(a)},e.appendChild(g)}},properties:{parent:null,status:e.PENDING,path:"",dependencies:null,factory:null,value:{set:function(a){a._ctors_&&(a.$path=this.get("path")),this._value=a},get:function(){return this._value}}},methods:{init:function(a,b,c){this.sets({path:a,dependencies:b||[],factory:c,value:{}}),this._callbacks=[]},exec:function(a){var b=process.argv,c=b[1];return this.sets({path:c,status:e.LOADING}),this.load(a),this},__pending:function(a){this._callbacks.push(a)},__loading:function(b){var c=(this.get("path"),this.get("dependencies")),d=this._depHandler,f=this.get("factory"),g=this.get("value");this.set("status",e.WAITING),this._callbacks.push(b);var i=c.length;if(0===i)g=f.call(g)||g,this.set("value",g),this.set("status",e.LOADED),a.each(this._callbacks,function(a){a(g)});else{var j=[],k=this;a.each(c,function(b,c){d&&(b=d(b,c)),h.loadModule(b,function(b){j[c]=b,i--,0===i&&(g=f.apply(g,j)||g,k.set("value",g),k.set("status",e.LOADED),a.each(k._callbacks,function(a){a(g)}))},k)})}},__waiting:function(a){var b=this;setTimeout(function(){0===h.counter&&b.set("status",e.LOADING),b.load(a)})},__loaded:function(a){a(this.get("value"))},load:function(b){var c=this.get("status"),d=b||a.idle;switch(c){case e.PENDING:this.__pending(d);break;case e.LOADING:this.__loading(d);break;case e.WAITING:this.__waiting(d);break;case e.LOADED:this.__loaded(d)}return this}}});a.define=function(){var b=arguments,c=b.length,d=b[0],e=[],f=null;switch(c){case 1:a.is(d,"function")?f=d:a.is(d,"array")?(e=d,f=function(){var b={};return a.each(arguments,function(c){c._name_?b[c._name_]=c:a.extend(b,c)}),b}):f=function(){return d};break;case 2:e=d,f=b[1];break;case 3:e=d,f=b[1]}return e&&a.is(e,"string")&&(e=[e]),h.current=new h("",e,f),b[2]&&(h.current._depHandler=b[2]),h.current};var i=a.Class("zn.Loader",{"static":!0,properties:{preLoadPackages:[]},methods:{init:function(){for(var a=this.preLoadPackages,b=0,c=a.length;c>b;b++)this.loadPackage(a[b])},loadPackage:function(b){this.load(b+"index.js",function(b){a.extend(h.preLoadedPackage,b)})},load:function(a,b,c){return h.loadModule(a,b,c),this}}});a.load=i.load,a.module=h}(zn),function(a){var b={lower:[97,123],upper:[65,91]};a.char=a.Class({"static":!0,methods:{lowercase:function(b){return a.is(b,"string")?b.replace(/[A-Z]/g,function(a){return String.fromCharCode(32|a.charCodeAt(0))}):b},uppercase:function(b){return a.is(b,"string")?b.replace(/[a-z]/g,function(a){return String.fromCharCode(-33&a.charCodeAt(0))}):b},toUnicode:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a.charCodeAt(c));return b},toChar:function(a,b){for(var c=[],d=a;b>d;d++)c.push(String.fromCharCode(d));return c},getLowercaseLetters:function(){var a=b.lower;return this.toChar(a[0],a[1])},getUppercaseLetters:function(){var a=b.upper;return this.toChar(a[0],a[1])},getStringFromChar:function(a,b){for(var c=a||"A",d=b||26,e=[],f=0;d>f;f++)e.push(String.fromCharCode(c.charCodeAt(0)+f));return e.join("")}}})}(zn),function(a){var b={ISO8601:"yyyy-MM-dd hh:mm:ss.SSS",ISO8601_WITH_TZ_OFFSET:"yyyy-MM-ddThh:mm:ssO",DATETIME:"dd MM yyyy hh:mm:ss.SSS",ABSOLUTETIME:"hh:mm:ss.SSS"};a.date=a.Class({"static":!0,methods:{getSecond:function(a){var b=1*a.substring(1,a.length);switch(a.substring(0,1)){case"s":return 1e3*b;case"h":return 60*b*60*1e3;case"d":return 24*b*60*60*1e3}},asString:function(a){var c=b.ISO8601;"string"==typeof a&&(c=arguments[0],a=arguments[1]);var d=this.__addZero(a.getDate()),e=this.__addZero(a.getMonth()+1),f=this.__addZero(a.getFullYear()),g=this.__addZero(a.getFullYear().toString().substring(2,4)),h=c.indexOf("yyyy")>-1?f:g,i=this.__addZero(a.getHours()),j=this.__addZero(a.getMinutes()),k=this.__addZero(a.getSeconds()),l=this.__padWithZeros(a.getMilliseconds(),3),m=this.__offset(a),n=c.replace(/dd/g,d).replace(/MM/g,e).replace(/y{1,4}/g,h).replace(/hh/g,i).replace(/mm/g,j).replace(/ss/g,k).replace(/SSS/g,l).replace(/O/g,m);return n},__padWithZeros:function(a,b){for(var c=a+"";c.length<b;)c="0"+c;return c},__addZero:function(a){return this.__padWithZeros(a,2)},__offset:function(a){var b=Math.abs(a.getTimezoneOffset()),c=String(Math.floor(b/60)),d=String(b%60);return 1==c.length&&(c="0"+c),1==d.length&&(d="0"+d),a.getTimezoneOffset()<0?"+"+c+d:"-"+c+d}}})}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,CANCLE:1,PAUSE:2,FINISHED:3},d=a.Class({events:["init","finished"],properties:{status:{value:c.PENDING,get:function(){return this._status}}},methods:{init:function(){},doTask:function(a,b){if(a){var c=b||[];c.unshift(this),a.handler.apply(a.context,c)}},done:function(){this._status=c.FINISHED,this._data=b.call(arguments),this.fire("finished",this._data),this.off("finished")}}}),e=a.Class({events:["clear","insert","pause","resume","exception","every","finally"],properties:{count:{get:function(){return this._tasks.length}}},methods:{init:function(a){this._exceptions=[],this._finallys=[],this._everys=[],this._tasks=[],this._taskProcessor=[],this._lastTask=null,this._data=[],this._max=(a||{}).max||1},destroy:function(){this._everys=[],this._tasks=[],this._taskProcessor=[],this.fire("finally",this._data,{method:"apply"}),this.super()},clear:function(){this._tasks=[]},pause:function(a){return this._paused=!0,a>0&&(this._pauseTimer=setTimeout(function(){this.resume()}.bind(this),a)),this.fire("pause"),this},resume:function(){return this._pauseTimer&&clearTimeout(this._pauseTimer),this._paused=!1,this.fire("resume"),this.doTask(),this},exception:function(a,b){return this.on("exception",a,b||this),this},"catch":function(a){return this.fire("exception",a),this},"finally":function(a,b){return this.on("finally",a,b||this),this},every:function(a,b){return this.on("every",a,b||this),this},unshift:function(a,b){return this.insert(a,b,0),this},push:function(a,b){return this.insert(a,b,-1),this},inserts:function(a,b,c){var d=a||[],e=c||0,f=this._tasks[0],g=null,h=null;return d=d.map(function(a){return h={handler:a,context:b||this},g&&(h.previous=g,g.next=h),g=h,h}.bind(this)),f&&(g.next=f,f.previous=g),d.unshift(0),d.unshift(e),this._tasks.splice.apply(this._tasks,d),this},insert:function(a,b,c){var d={handler:a,context:b||this},e=c||-1;switch(e){case-1:this._lastTask&&(d.previous=d,this._lastTask.next=d),this._lastTask=d,this._tasks.push(d);break;case 0:var f=this._tasks[0];f&&(d.next=f,f.previous=d),this._tasks.unshift(d);break;default:this._tasks.splice(e,0,d)}return this.fire("insert",d),this},getTaskProcessor:function(){for(var a=null,b=this._taskProcessor.length,e=0;b>e;e++)if(a=this._taskProcessor[e],a.status==c.FINISHED)return a;if(!a&&this._max>b){var f=new d;return f.queue=this,f.on("finished",this.__onProcessorFinished.bind(this),this),f}},start:function(){return this._data=[],this.doTask()},doTask:function(a){var b=this._tasks.shift();if(b){var c=this.getTaskProcessor();c&&(b.previousResult=a,c.doTask(b,a))}else this.destroy();return this},__onProcessorFinished:function(a,b){this._data.push(b),this.fire("every",b,{method:"apply"}),this.doTask(b)}}});a.queue=function(a){return new e(a)}}(zn),function(a){var b=["INFO","DEBUG","WARN","ERROR","TRACE","ALL"],c=["#100000","#2125a0","#a82c2c","#c045b7","1cb131","#100000"],d=[38,34,35,31,32,36,33],e={INFO:0,DEBUG:1,WARN:2,ERROR:3,TRACE:4,ALL:6},f=a.Class({events:["info","debug","warn","error","trace","all"],methods:{init:function(){this._config={only:null,levels:["info","debug","warn","error","trace","all"]}},config:function(b){this._config=a.overwrite(b,this._config)},info:function(){this.__log.call(this,e.INFO,arguments)},debug:function(){this.__log.call(this,e.DEBUG,arguments)},warn:function(){this.__log.call(this,e.WARN,arguments)},trace:function(){this.__log.call(this,e.TRACE,arguments)},error:function(){this.__log.call(this,e.ERROR,arguments)},all:function(){this.__log.call(this,e.ALL,arguments)},__getDateString:function(b){return a.date.asString(b||new Date)},__getPosition:function(){try{throw new Error}catch(b){return a.DEBUG&&a.CONSOLE_ERROR&&console.log(b.stack),b.stack.split("\n")[5].replace(/\(/g,"").replace(/\)/g,"").split("/").pop()}},__formatLog4Server:function(a,c){var e="",f="",g="";return c&&(f="[",g="[0m",e=d[5]+"m",c=d[a.type]+"m"),[a.time," [",f,c,b[a.type],g,"] [",f,e,a.pos,g,"] ",a.message].join("")},__formatLog4Client:function(a){return["%c"+a.time," [",b[a.type],"] "].join("")},__log:function(d,e){var f=Array.prototype.slice.call(e),g=f.slice(0),h=b[d].toLowerCase(),i=this.__getDateString(),j=this.__getPosition();if(g.unshift(j),g.unshift(h),g.unshift(i),"undefined"!=typeof module&&module.exports?f.unshift(this.__formatLog4Server({type:d,time:i,pos:j},!0)):(f.unshift("color:"+c[d]),f.unshift(this.__formatLog4Client({type:d,time:i,pos:j},!0))),this.__isOk(h)){var k=this.fire(h,g);k!==!1&&a.DEBUG&&console.log.apply(this,f)}},__isOk:function(a){if(this._config.only){if(this._config.only===a)return!0}else{var b=-1!==this._config.levels.indexOf(a);if(b)return!0}return!1}}});a.logger=new f;var g={info:function(){a.logger.info.apply(a.logger,arguments)},debug:function(){a.logger.debug.apply(a.logger,arguments)},warn:function(){a.logger.warn.apply(a.logger,arguments)},trace:function(){a.logger.trace.apply(a.logger,arguments)},error:function(){a.logger.error.apply(a.logger,arguments)}};a.extend(a,g)}(zn),function(a){var b=Array.prototype.slice,c={PENDING:0,FULFILLED:1,REJECTED:2},d=a.Class({events:["complete"],properties:{promise:null},methods:{init:function(a,b){this._promise=new e,a&&this.resolve(a),b&&this.reject(b)},resolve:function(){var d=b.call(arguments);try{var e=this.get("promise"),g=this;if(e.get("readyState")!=c.PENDING)return;e.set("readyState",c.FULFILLED),e.set("data",d),a.each(e.get("resolves"),function(a){a.apply(g,d)})}catch(h){f.catch(h,this)}this.fire("complete",d)},reject:function(){var a=b.call(arguments);try{var d=this.get("promise");if(d.get("readyState")!=c.PENDING)return;d.set("readyState",c.REJECTED),d.set("reason",a);var e=d.get("rejects")[0];e&&e.apply(this,a)}catch(g){f.catch(g,this)}this.fire("complete",a)}}}),e=a.Class({statics:{isPromise:function(a){return null!==a&&void 0!==a&&"function"==typeof a.then},defer:null},properties:{resolves:null,rejects:null,data:null,reason:null,readyState:null},methods:{init:function(){this.set("resolves",[]),this.set("rejects",[]),this.set("exceptions",[]),this.set("readyState",c.PENDING)},then:function(a,f){function g(){var c=b.call(arguments),d=a?a.apply(this,c):c;return e.isPromise(d)?d.then(function(){h.resolve.apply(h,b.call(arguments))}):h.resolve.apply(h,d),d}var h=new d;if(this.get("readyState")===c.PENDING)this.get("resolves").push(g),this.get("rejects").push(f?f:function(){h.reject.apply(h,b.call(arguments))});else if(this.get("readyState")===c.FULFILLED){var i=this;setTimeout(function(){g.apply(i,i.get("data"))})}return h.promise},"catch":function(a){return f.exception(a)},"finally":function(a){return f.finally(a)},otherwise:function(a){return this.then(void 0,a)}}}),f=a.async=a.Class({"static":!0,methods:{init:function(){this._exceptions=[],this._finallys=[],this._count=0,this._currIndex=0,this._dataArray=[]},exception:function(a){return this._exceptions.push(a),this},"catch":function(b,c){return a.each(this._exceptions,function(a){a.call(c,b)}),this},"finally":function(a){return this._finallys.push(a),this},defer:function(b,c){var e=this,f=new d(b,c);return f.on("complete",function(b,c){e._currIndex++,e._dataArray.push(c),e._currIndex==e._count&&(a.each(e._finallys,function(b){try{b(e._dataArray)}catch(c){a.error(c.message)}}),e._finallys=[])}),e._count++,f},all:function(b){var c=f.defer(),d=0,e=[];return a.each(b,function(a){a.then(function(a){e.push(a),d++,d>=b.length&&c.resolve(e)})}),c.promise},any:function(b){var c=f.defer();return a.each(b,function(a){a.then(function(a){c.resolve(a)})}),c.promise}}})}(zn),function(){zn.querystring=zn.Class({"static":!0,properties:{config:{get:function(){}}},methods:{init:function(){this._config={separator:"&",equal:"=",minIndex:0,maxIndex:1e3}},config:function(a){return this.overwrite(this._config,a),this},parse:function(a,b){var c=zn.extend({},this._config,b),d={},e=c.equal,f=a.split(c.separator),g=f.length;c.maxIndex>0&&g>c.maxIndex&&(g=c.maxIndex);for(var h=c.minIndex;g>h;h++){var i=f[h].replace(/\+/g,"%20"),j=i.indexOf(e),k=null,l=null;j>=0?(k=i.substr(0,j),l=i.substr(j+1)):(k=i,l=""),k=decodeURIComponent(k),l=decodeURIComponent(l),hasOwnProperty(d,k)?zn.is(d[k],"array")?d[k].push(l):d[k]=[d[k],l]:d[k]=l}return d},stringify:function(a,b){var c=zn.extend({},this._config,b),d=[],e=c.equal,f={};if(f=zn.isZNObject(a)?a.gets():a,!zn.is(f,"object"))throw new Error("Agrument Error.");for(var g in a){var h=a[g],i=encodeURIComponent(this.__stringifyValue(g)); | ||
h=encodeURIComponent(this.__stringifyValue(h)),d.push(i+e+h)}return d.join(c.separator)},__stringifyValue:function(a){switch(zn.type(a)){case"string":return a;case"boolean":return a?"true":"false";case"object":case"array":return JSON.stringify(a);case"number":return isFinite(a)?a:"";default:return""}}}})}(zn),function(a){var b=(a.Class({events:["init","start","stop","cancle","goNext","goPre"],properties:{pre:null,next:null,delay:null,action:null,args:[],context:this,taskList:null,status:{value:"",get:function(){return this._status}}},methods:{init:function(a){this.sets(a),this.fire("init",this)},start:function(){"started"!=this._status&&(this._action?(this._action.apply(this._context,this._args),this._status="started"):this.goNext(),this.fire("start",this))},stop:function(){this._status="stoped",this.fire("stop",this)},cancle:function(){this._status="cancle",this.fire("cancle",this)},goNext:function(){this._next&&this._next.start(),this.fire("goNext",this)},goPre:function(){this._pre&&this._pre.start(),this.fire("goPre",this)}}}),a.Class({properties:{url:"",data:{set:function(a){this._data=a},get:function(){return a.is(this._data,"object")?JSON.stringify(this._data):this._data}},method:"GET",asyns:!0,username:null,password:null,headers:{get:function(){return a.overwrite({"X-Requested-With":"XMLHttpRequest","Content-type":"application/json"},this._headers)},set:function(a){this._headers=a}},timeout:{get:function(){return this._timeout||2e4},set:function(a){this._timeout=a}}},events:["before","after","success","error","complete","timeout"],methods:{init:function(a){this.sets(a),this._isRunning=!1},__initXMLHttpRequest:function(){if(this._XMLHttpRequest)return this._XMLHttpRequest;if(!window.ActiveXObject)return this._XMLHttpRequest=new XMLHttpRequest,this._XMLHttpRequest;for(var a="MSXML2.XMLHTTP",b=["Microsoft.XMLHTTP",a,a+".3.0",a+".4.0",a+".5.0",a+".6.0"],c=b.length-1;c>-1;c--)try{return this._XMLHttpRequest=new ActiveXObject(b[c]),this._XMLHttpRequest}catch(d){continue}},__onComplete:function(a,b){clearTimeout(this._timeoutID),a.abort(),this._isRunning=!1,this.fire("complete",a,b),this.fire("after",a,b),this.offs()},__initRequestHeader:function(a,b){for(var c in b)a.setRequestHeader(c,b[c])},resetEvents:function(){this.offs()},send:function(b){if(this._isRunning)return!1;this.sets(b);var c=this.__initXMLHttpRequest(),d=this,e=a.async.defer();if(this._isRunning=!0,this.timeout&&(this._timeoutID=setTimeout(function(){d._isRunning&&(d.fire("timeout",d),d.__onComplete(c,"timeout"))},this.timeout)),this.fire("before",this)===!1||!this.url)return this.__onComplete(c),e.promise;var f=this.url,g=this.data,h=this._method.toUpperCase();return"GET"===h&&(g&&(f=f+"?"+g),g=null),c.readyState<2,c.open(h,f,this.asyns),c.onreadystatechange=function(a){var b=a.currentTarget;if(4==b.readyState){var c=b.status,d=b.responseText,f=b.getResponseHeader("Content-Type");if(c>=200&&300>c){try{d=f&&f.indexOf("application/json")>=0?JSON.parse(d):d}catch(g){d=d}this.fire("success",d),e.resolve(d,b)}else this.fire("error",b),e.reject(b,d);return this.__onComplete(b,d),d}}.bind(this),this.__initRequestHeader(c,this.headers),c.send(g),this.asyns||this.__onComplete(c),e.promise},abort:function(){this._XMLHttpRequest&&this._XMLHttpRequest.abort()}}})),c=a.Class({"static":!0,properties:{max:3,count:{get:function(){return this._data.length}}},methods:{init:function(){this._data=[]},getInstance:function(){for(var a=0,c=this._data.length;c>a;a++)if(!this._data[a]._isRunning)return this._data[a].resetEvents(),this._data[a];return function(a){var c=new b;return a._data.push(c),c}(this)}}});a.http=a.Class({"static":!0,properties:{timeout:1e3},methods:{request:function(b,d){var e=c.getInstance();return a.each(b,function(a,b){"function"==typeof a&&e.on(b,a,this)},this),d&&d(e),e.send(b)},get:function(a){return a.method="GET",this.request(a)},post:function(a){return a.method="POST",this.request(a)},put:function(a){return a.method="PUT",this.request(a)},"delete":function(a){return a.method="DELETE",this.request(a)}}})}(zn),function(a){var b=a.Class({events:["init","validate","before","success","error","complete","after"],properties:{url:null,data:null,method:"POST",headers:null},methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},validateArgv:function(a,b,c,d){var e=a||this._url||"",f=b||this._data||{},g=c||this._method||"POST",h=d||this._headers||{},i={url:e,data:f,method:g,headers:h};return i},exec:function(a,b,c,d){var e=this.validateArgv(a,b,c,d),f=Store.fire("before",e);return f===!1?!1:(f=this.fire("before",e),f===!1?!1:e)},__onComplete:function(a){var b=Store.fire("after",a);return b===!1?!1:(b=this.fire("complete",a),b===!1?!1:void 0)},__onSuccess:function(a,b){var c=Store.fire("success",a,b);return c===!1?!1:(c=this.fire("success",a,b),c===!1?!1:void 0)},__onError:function(a){var b=Store.fire("success",a);return b===!1?!1:(b=this.fire("success",a),b===!1?!1:void 0)},refresh:function(a,b,c,d){return this.exec(a,b,c,d)},clone:function(b){var c=this._data;return c="object"==typeof c?a.extend(JSON.parse(JSON.stringify(c)),b):b,new this.constructor(this._url,c,this._method,this._headers)},extend:function(b){return this._data=a.extend(this._data,b),this},overwrite:function(b){return this._data=a.overwrite(this._data,b),this}}}),c=a.Class(b,{methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},exec:function(b,c,d,e){var f=this.validateArgv(b,c,d,e),g=Store.fire("before",f);return g===!1?!1:(g=this.fire("before",f),g===!1?!1:f===!1?!1:a.http[f.method.toLowerCase()]({url:Store.fixURL(f.url),data:f.data,headers:f.headers,success:function(a,b,c){this.__onSuccess(b,c)}.bind(this),error:function(a,b){this.__onError(b)}.bind(this),complete:function(a,b){this.__onComplete(b)}.bind(this)}))}}}),d=a.Class(b,{methods:{init:function(a,b,c,d){this.sets({url:a,data:b,method:c,headers:d}),this.fire("init",this.gets())},exec:function(b,c,d,e){var f=this.validateArgv(b,c,d,e),g=Store.fire("before",f);if(g===!1)return!1;if(g=this.fire("before",f),g===!1)return!1;if(f===!1)return!1;var h=f.url,i=f.method,j=f.data,k=f.headers,l=this,m={method:i.toUpperCase()};switch(i.toUpperCase()){case"POST":var n=new FormData;for(var o in j)n.append(o,j[o]);m.body=n,m.headers=a.overwrite(k,{Accept:"multipart/form-data","Content-Type":"multipart/form-data; charset=UTF-8"});break;case"GET":var p=[];a.each(j,function(a,b){p.push(b+"="+a)}),h+="?"+p.join("&");break;case"JSON":m.body=JSON.stringify(j),m.method="POST",m.headers=a.overwrite(k,{Accept:"multipart/form-data","Content-Type":"multipart/form-data; charset=UTF-8"})}return new Promise(function(a,b){fetch(Store.fixURL(h),m).then(function(a){return a.json()}).then(function(b){l.__onSuccess(b),l.__onComplete(b),a(b)}).catch(function(a){l.__onError(a),l.__onComplete(a),b(a)})})}}}),e=a.Class({events:["init","before","after"],properties:{data:null,argv:{set:function(a){this._argv=a},get:function(){return this._argv||{}}}},methods:{init:function(a,b){this.reset(a,b),this.fire("init",this)},reset:function(a,b){return a&&(this._data=a),b&&(this._argv=b),this._argv&&this._argv.autoLoad&&this.exec(),this},refresh:function(){return this.exec(),this},exec:function(){var a=this._data,b=this;if(!a)return!1;if((this._argv.onExec&&this._argv.onExec(a))===!1)return!1;var c=this.fire("before",a);return c===!1?!1:a.__id__?void a.on("success",function(a,c){b._argv.onSuccess&&b._argv.onSuccess(c)}).on("error",function(a,c){b._argv.onError&&b._argv.onError(c)}).on("complete",function(a,c){b._argv.onComplete&&b._argv.onComplete(c)}).exec():new Promise(function(c,d){if(a){if(Store.fire("success",a)===!1)return!1;b._argv.onSuccess&&b._argv.onSuccess(a),b._argv.onComplete&&b._argv.onComplete(a),c(a)}else{if(Store.fire("error",a)===!1)return!1;b._argv.onError&&b._argv.onError(a),b._argv.onComplete&&b._argv.onComplete(a),d(a)}})}}}),f=a.Class({events:["before","success","error","complete","after"],properties:{host:window.location.origin,engine:{set:function(a){this._engine=a},get:function(){return"Fetcher"==this._engine?d:c}},headers:{}},methods:{request:function(a,b,e,f){var g=null;return new(g="Fetcher"==this._engine?d:c)(a,b,e,f)},post:function(a,b,c){return this.request(a,b,"POST",c)},"delete":function(a,b,c){return this.request(a,b,"DELETE",c)},put:function(a,b,c){return this.request(a,b,"PUT",c)},get:function(b,c,d){var e=[];return a.each(c,function(b,c){e.push(c+"="+(a.is(b,"object")?JSON.stringify(b):b))}),this.request(b,e.join("&"),"GET",d)},setHost:function(a){this._host=a},getHost:function(){return this._host},fixURL:function(a){return a?(a&&-1===a.indexOf("http://")&&(a=this._host+a),a):""},dataSource:function(a,b){return new e(a,b)}}});a.store=a.GLOBAL.Store=new f}(zn),function(a){a.cookie=a.Class({"static":!0,methods:{setItem:function(a,b,c){var d=a+"="+encodeURIComponent(b);c&&(d+="; expires="+new Date(+new Date+36e5*c).toGMTString()),document.cookie=d},getItem:function(a){var b=new RegExp("(?:; )?"+a+"=([^;]*);?");return b.test(document.cookie)?decodeURIComponent(RegExp.$1):null},removeItem:function(a){this.setItem(a,null,-9999)},clear:function(){document.cookie=null}}})}(zn),function(a){var b=document.createElement("div"),c=b.style,d=/width|height|top|right|bottom|left|size|margin|padding/i,e=/[c-x%]/,f="px",g=/(?:^|-)([a-z])/g,h=/([A-Z])/g,i={lineHeight:!0,zIndex:!0,zoom:!0},j={"float":"cssFloat"};a.style=a.Class({"static":!0,methods:{each:function(a,b,c){if(a&&b){var d=a.length;if(d>=0)for(var e=0;d>e;e++)b.call(c,a[e],e);else for(var f in a)a.hasOwnProperty(f)&&b.call(c,a[f],f)}},getCssText:function(a){var b=[""];return this.each(a,function(a,c){b.push(this.getStyleProperty(c,!0)+":"+this.getStyleValue(c,a))},this),b.join(";")},getStyleValue:function(a,b){var c=this.getStyleProperty(a),g=b;return d.test(c)&&(e.test(b)||i[c]||(g+=f)),g},getStyleProperty:function(a,b){var d=this.lowerCamelCase(a);return d in c?b&&(d=this.deCamelCase(a)):d=b?env.prefix()[1]+a:env.prefix()[0]+this.upperCamelCase(a),j[a]||d},lowerCamelCase:function(a){var b=this.upperCamelCase(a);return b.charAt(0).toLowerCase()+b.substring(1)},upperCamelCase:function(a){return a.replace(g,function(a,b){return b.toUpperCase()})},deCamelCase:function(a){return a.replace(h,function(a,b){return"-"+b.toLowerCase()})},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)}}}),a.dom=a.Class({"static":!0,methods:{hasClass:function(a,b){return a.classList.contains(b)},addClass:function(a){var b=a.classList;return arguments.shift(),b.add.apply(b,arguments)},removeClass:function(a){var b=a.classList;return arguments.shift(),b.remove.apply(b,arguments)},toggleClass:function(a,b){return a.classList.toggle(b)},setStyle:function(b,c,d){var e=a.style.getStyleProperty(c);b.style[e]=a.style.getStyleValue(c,d)},getStyle:function(b,c,d){var e=b,f=a.style.getStyleProperty(c),g=d?b.style:window.getComputedStyle?getComputedStyle(e,null):e.currentStyle;return g[f]||""},removeStyle:function(b,c){var d=a.style.getStyleProperty(c,!0);b.style.removeProperty(d)},hasStyle:function(a,b){var c=a.style.cssText;return c.indexOf(b+":")>-1},setStyles:function(b,c){b.style.cssText+=a.style.getCssText(c)},getPosition:function(a){var b=a,c=0,d=0,e=0,f=0;if(b.getBoundingClientRect){var g=b.getBoundingClientRect();c=g.left+Math.max(document.documentElement.scrollLeft,document.body.scrollLeft)-document.documentElement.clientLeft,d=g.top+Math.max(document.documentElement.scrollTop,document.body.scrollTop)-document.documentElement.clientTop,e=g.width,f=g.height}else{for(;b!=document.body&&b;)c+=b.offsetLeft,d+=b.offsetTop,b=b.offsetParent;e=b.offsetWidth,f=b.offsetHeight}return{x:c,y:d,width:e,height:f}},on:function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):element.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},off:function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=null}}})}(zn); |
{ | ||
"name": "zeanium", | ||
"version": "1.1.15", | ||
"version": "1.1.16", | ||
"description": "Javascript framework for Node.js and Browser. Simple MVVM model in data and view module.", | ||
@@ -5,0 +5,0 @@ "main": "zn.core.js", |
@@ -8,2 +8,8 @@ /** | ||
var __builtin__ = { | ||
isNull: function (value){ | ||
return value === null || value === undefined; | ||
}, | ||
isNotNull: function (value){ | ||
return value !== null && value !== undefined; | ||
}, | ||
idle: function (){ | ||
@@ -10,0 +16,0 @@ // empty handler |
@@ -359,3 +359,3 @@ /** | ||
}, | ||
getProperties: function(callback){ | ||
getProperties: function(handler, context){ | ||
var _props = {}; | ||
@@ -370,3 +370,3 @@ if(!this.getMeta || this._name_ == 'ZNObject'){ | ||
if(_super){ | ||
zn.extend(_props, _super.getProperties(callback)); | ||
zn.extend(_props, _super.getProperties(handler, context)); | ||
} | ||
@@ -376,21 +376,23 @@ | ||
zn.each(_mixins, function (mixin){ | ||
zn.extend(_props, mixin.getProperties(callback)); | ||
zn.extend(_props, mixin.getProperties(handler, context)); | ||
}); | ||
} | ||
zn.each(this.getMeta('properties'), function (prop, index){ | ||
var _callback = callback && callback(index, prop)===false; | ||
if(!_callback){ | ||
if(!prop.hidden){ | ||
_props[index] = prop; | ||
} | ||
zn.each(this.getMeta('properties'), function (prop, name){ | ||
var _callback = handler && handler.call(context || this, prop, name, _props); | ||
if(_callback === false || _callback === -1){ | ||
return _callback; | ||
} | ||
}); | ||
if(!prop.hidden){ | ||
_props[name] = prop; | ||
} | ||
}, this); | ||
return _props; | ||
}, | ||
getPropertie: function (name){ | ||
getProperty: function (name){ | ||
var _prop = null; | ||
if(name){ | ||
zn.each(this.getProperties(), function (field, key){ | ||
this.getProperties(function (prop, key){ | ||
if(name == key){ | ||
@@ -405,2 +407,5 @@ _prop = field; | ||
}, | ||
existProperty: function (name){ | ||
return !!this.getProperty(name); | ||
}, | ||
/** | ||
@@ -421,3 +426,7 @@ * Get the meta data of the class. | ||
setMeta: function (name, value) { | ||
return this._meta_[name] = value, this; | ||
if(name && value){ | ||
this._meta_[name] = value; | ||
} | ||
return this; | ||
}, | ||
@@ -497,3 +506,3 @@ /** | ||
getProperties: function (){ | ||
return this.constructor.getProperties(); | ||
return this.constructor.getProperties.apply(this, arguments); | ||
}, | ||
@@ -799,3 +808,3 @@ getPropertie: function (name){ | ||
zn.each(_meta.properties || _meta.props, function (value, key) { | ||
zn.each(_meta.properties, function (value, key) { | ||
_Class.defineProperty(key, zn.is(value, 'object') ? value : { value: value }, _Class); | ||
@@ -896,2 +905,6 @@ }); | ||
_meta.properties = _meta.properties || _meta.props; | ||
_meta.props = null; | ||
delete _meta.props; | ||
var ZNClass, _SuperClass, _prototype; | ||
@@ -898,0 +911,0 @@ |
@@ -26,2 +26,7 @@ /** | ||
return _self.toString(); | ||
}, | ||
firstUpperCase: function (value){ | ||
return value.replace(/\b(\w)(\w*)/g, function($0, $1, $2) { | ||
return $1.toUpperCase() + $2; | ||
}); | ||
} | ||
@@ -28,0 +33,0 @@ }; |
@@ -68,3 +68,3 @@ /** | ||
if(zn.DEBUG && zn.CONSOLE_ERROR){ | ||
console.log(e); | ||
console.log(e.stack); | ||
} | ||
@@ -71,0 +71,0 @@ |
@@ -138,3 +138,3 @@ /** | ||
_task = null; | ||
_tasks.map(function (handler){ | ||
_tasks = _tasks.map(function (handler){ | ||
_task = { | ||
@@ -141,0 +141,0 @@ handler: handler, |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
696424
15966