UNPKG

29.5 kBJavaScriptView Raw
1(function(){"use strict";var t={}.hasOwnProperty,e=[].slice;Function.nextTick=function(t,e,n){return 1===arguments.length&&(n=t)&&(t=null)&&(e=null),2===arguments.length&&(n=e)&&(e=t)&&(t=null),setTimeout(function(){return n.call(e)},t||5)},Function.perform=function(t,e){var n,r,i,o,u;return r=1,o=[null,void 0],u=function(){var t,e,i;if(!--r&&(e=n.operations.shift())){r=1,i=[].concat(o),o=[null,void 0];try{return e.apply(n.context,i)}catch(u){return t=u,Object.error(("perform: "+e).slice(0,151).replace(/\s+/g," ")).addDetails(t).log()}}},i=function(t){return function(e,n){return void 0===o[t]?(e&&(o[0]=Object.error(e).log()),o[t]=n,u()):void 0}},n={context:t,_error:new Error,next:i(1),wait:function(){var t;return t=o.length,o[t]=void 0,r+=1,i(t)}},n.operations=e.call(t,n),u()},Function.create=function(t,e){return t?Object.parse("function ("+(e?e.join(", "):"")+"){ return "+t+"; }"):null},Function.iterate=function(e,n,r,i){var o,u,s,a,l,c;if(n)if(u=n.length,u===+u)for(o=l=0,c=n.length;c>l;o=++l)a=n[o],e.call(r,a,o,i);else for(s in n)t.call(n,s)&&(a=n[s],e.call(r,a,s,i));return r},Object.update=function(e,n){var r;if(e&&n)for(r in n)t.call(n,r)&&(e[r]=n[r]);return e},Object.prop=function(t,e,n){var r,i,o;if(!t)return null;if(i=-1,arguments.length>2){for(;(i=e.indexOf(".",o=i+1))>-1;)t=t[r=e.slice(o,+(i-1)+1||9e9)]||(t[r]={});return t[e.slice(o)]=n}for(;t&&(i=e.indexOf(".",o=i+1))>-1;)t=t[e.slice(o,+(i-1)+1||9e9)];return null!=t?t[e.slice(o)]:void 0},Object.clone=function(e,n){var r,i;if(!e)return null;i=new e.constructor;for(r in e)t.call(e,r)&&(i[r]=e[r]);if(n)for(r in n)t.call(n,r)&&(i[r]=n[r]);return i},Object.parse=function(t,e){var n;if(!t)return null;try{return Function.call(Function,"return "+t).call(null!=e?e.ctx:void 0)}catch(r){return n=r,Object.error("bad-code: Object.parse: "+n.message).addDetails(t).log().end(null)}},Object.update.mixin=function(){var n,r,i,o,u,s,a;if(n=arguments[0],i=arguments[1],r=3<=arguments.length?e.call(arguments,2):[],!i)return n;s=i.apply(null,[a={}].concat(r));for(u in s)t.call(s,u)&&(o=s[u],a[u]=n[u]||function(){},n[u]=o);return n},String.LANGUAGE="en",String.capitalize=function(t){return(null!=t?t.length:void 0)?t[0].toUpperCase()+t.slice(1):""},String.camelize=function(t,e){var n,r;return null==e&&(e="_"),(null!=t?t.length:void 0)?function(){var i,o,u,s;for(u=t.split(e),s=[],n=i=0,o=u.length;o>i;n=++i)r=u[n],s.push(n?String.capitalize(r):r);return s}().join(""):""},String.format=function(){var t,n;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n?n.replace(/\{(\d+)\}/g,function(e,n){return t[+n]||""}):""},String.localize=function(t){var e;return e=function(e,n){var r;return null==n&&(n=String.LANGUAGE),e?(null!=(r=t[n])?r[e]:void 0)||String.capitalize(String.camelize(e)):""},e.get=function(e,n){var r;return null==n&&(n=String.LANGUAGE),e?(null!=(r=t[n])?r[e]:void 0)||null:null},e.add=function(e,n){return 1===arguments.length&&(n=e)&&(e=null),e||(e=String.LANGUAGE),Object.update(t[e]||(t[e]={}),n)},e.asEnum=function(t,e){var n,r,i,o,u;if(!(i=this.get(t,e)))return null;u=[];for(r in i)o=i[r],(n=+r||r)&&("object"==typeof o?(o.id=n,u.push(o)):u.push({id:n,name:""+o}));return u},e}({}),String.tokenize=function(t,e,n){var r,i,o;for(null==t&&(t=""),null==e&&(e=/\W/g),i=0;r=e.exec(t);)r.index&&(o=t.slice(i,+(r.index-1)+1||9e9))&&n(o),n(r[0],!0),i=e.lastIndex;return(o=t.slice(i))?n(o):void 0},Object.Uri=function(){function e(t){this.params=null!=t?t:{}}return e.prototype.isUri=!0,e.prototype.setParams=function(t){return this.params=t,this},e.prototype.updateParams=function(t){return Object.update(this.params,t),this},e.prototype.toString=function(){var e,n,r,i,o;n=(this.host?this.type?""+this.type+"://"+this.host+"/":"//"+this.host+"/":"")+this.path.join("/"),r="?",o=this.params;for(e in o)t.call(o,e)&&(i=o[e],n+=r+e+"="+encodeURIComponent(i),"?"===r&&(r="&"));return this.hash&&(n+="#"+this.hash),n},e.parse=function(t,n){var r,i,o,u,s,a,l;if(null!=t?t.isUri:void 0)return t;if(i=new e(n),!t)return i;if(t.split||(t=""+t),(r=t.indexOf("://"))>-1&&(i.type=t.slice(0,+(r-1)+1||9e9),t=t.slice(r+1)),(r=t.indexOf("#"))>-1&&(i.hash=t.slice(r+1),t=t.slice(0,+(r-1)+1||9e9)),a=t.split("?"),t=a[0],i.query=a[1],i.query)for(l=i.query.split("&"),u=0,s=l.length;s>u;u++)o=l[u],(r=o.split("=")).length>1&&(i.params[r[0]]=decodeURIComponent(r[1]));return i.id=t,r=t.split("/"),""===r[0]&&(r.shift(),""===r[0]&&(r.shift(),i.host=r.shift())),i.path=r,i},e}(),Object.error=function(){var t;return t=function(){function t(t){this.details=[],"string"==typeof t?(t&&(this.reason=t.split(":")[0]),t&&(this.message=t)):(t.reason&&(this.reason=t.reason),t.message&&(this.message=t.message))}return t.prototype.reason="unknown",t.prototype.message="",t.prototype.isError=!0,t.prototype.addDetails=function(){var t,e,n;for(e=0,n=arguments.length;n>e;e++)t=arguments[e],t&&(this.details.unshift(t),t.stack&&(this.stack=t.stack));return this},t.prototype.addPrefix=function(t){return t&&(this.prefix=""+t),this},t.prototype.log=function(){return Object.log(this),this},t.prototype.end=function(t){return t},t.prototype.toString=function(){return""+(this.prefix||"")+" "+this.message},t.prototype.printIntoLog=function(t){var e,n;return e=("function"==typeof this.details?this.details(1===length):void 0)?this.details[0]:this.details,n=this.stack||(new Error).stack,t.error(this.toString(),e,n)},t}(),function(e,n){return((null!=e?e.isError:void 0)?e:new t(e)).addDetails(n)}}(),Object.log=function(t){return t}}).call(this),function(){var t,e,n,r,i,o,u=[].slice,s={}.hasOwnProperty,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};r=function(){},i=0,o=function(t){var e;return e=function(e){return t[e]},e.define=function(e){return t[e.id]=e},e.findUnresolved=function(n){var r;return(r=t[n])?r._resolved||!r.superId?null:e.findUnresolved(r.superId):n},e.resolve=function(n,r){return Object.fire({uri:"axoid://require",dependencies:"entity://"+n,callback:function(){var i,o;if(!(i=t[n]))throw new Error("Can't resolve type "+n);return(o=e.findUnresolved(n))?e.resolve(o,r):(i._resolved=!0,r())}})},e}({}),t=function(e){var n,r;return n=function(){function e(t){this.id=t}var n;return n=function(){function t(t,e,n){var r;this.parent=t,this.propId=e,this.fn=n,r=this.parent.handlers||(this.parent.handlers={}),(r[e]||(r[e]=[])).push(this)}return t.prototype.handle=function(t){var e;try{return this.fn.call(null,t)}catch(n){return e=n,Object.error("notify: "+e.message).addDetails(Object.update(e,{op:(""+this.fn).replace(/\n+/g,"").slice(9,151)})).log()}},t.prototype.done=function(){var t,e;return(t=this.parent.handlers[this.propId])&&(e=t.indexOf(this))>-1&&t.splice(e,1),t.length||delete this.parent.handlers[this.propId],this.parent=this.fn=null},t}(),e.prototype.startListen=function(t){var e,n,r,i,o;if(this.handler=t,e=this.defered){for(delete this.defered,Object.log("!!! Fire "+e.length+" defered for ["+this.id+"] "),o=[],r=0,i=e.length;i>r;r++)n=e[r],o.push(this.handler(n));return o}},e.prototype.fire=function(t){return this.handler?this.handler(t):((this.defered||(this.defered=[])).push(t),Object.log("!!! Defer fire for ["+this.id+"]"))},e.prototype.addIncomingHandler=function(t){return(this.incomings||(this.incomings=[])).push(t)},e.prototype.addPropertyChangedHandler=function(e,r,i){var o;return o=new n(this,e,r),t.instance(i).addIncomingHandler(o)},e.prototype.notifyPropertyChanged=function(t,e){var n,r,i,o,u,s;if(r=null!=(u=this.handlers)?u[t]:void 0){for(s=[],i=0,o=r.length;o>i;i++)n=r[i],s.push(n.handle(e));return s}},e.prototype.done=function(){var t,e,n,r,i;if(this.handler=this.entity=null,this.incomings){for(r=this.incomings,i=[],e=0,n=r.length;n>e;e++)t=r[e],i.push(t.done());return i}},e}(),r=function(t){return e[t]},r.instance=function(t){return e[t]||(e[t]=new n(t))},r.release=function(t){var n;return(n=e[t])&&(delete e[t],n.done()),n},r}({}),n=function(){function e(t){var e,n,o,u,s,a,l;if(this.id=t,a=this.id.split(":"),this.id=a[0],u=a[1],"Uri"===this.id.slice(-3)&&(this.asyncTarget=this.id.slice(0,-3)),u){if(!(this.type=i[u]))throw new Error("ERROR: No such property type: "+u);if((e=this.type.methods)&&(o=e(l={})))for(n in o)s=o[n],"function"==typeof s&&(l[n]=this[n]||r),this[n]=s}}var n,i;return n={},i={},e.Expression=function(){function t(){}return t.prototype.compile=function(t){var e,n;return this.message=t,e={},n=this.sources=[],this.body=this.message.replace(/<(@?[\w\.$ ]+?)>/gm,function(t,r){var i,o,u,s,a;if(s=r.split(" "),r=s[0],i=s[1],a="@"===r[0]?["@",r.slice(1)]:r.split("."),o=a[0],u=a[1],u||(u="value"),r=o+"."+u,!o)throw new Error("No id for binding source in "+t);return e[r]||(e[r]=1,n.push({id:r,flag:i,entityId:o,propId:u})),'$["'+r+'"]'}),this.expression=Function.create(this.body,["$"])||function(){return Object.error("bad-code: Wrong binding expression: "+this.body).log()},this},t.instance=function(e){return(new t).compile(e)},t}(),e.prototype.attachToEntityCtor=function(t){var e;return(null!=(e=this.type)?e.mixin:void 0)?Object.update.mixin(t.prototype,this.type.mixin,this):void 0},e.prototype.extractDefaults=function(t,e){var n;return t[n=this.id]&&(e[n]=t[n])&&(t[n]=void 0),t[n=this.id+"Expression"]&&(e[n]=t[n])&&(t[n]=void 0),t[n=this.id+"Binding"]&&(e[n]=t[n])&&(t[n]=void 0),this.asyncTarget||(t[n=this.id+"Uri"]&&(e[n]=t[n])&&(t[n]=void 0),t[n=this.id+"UriExpression"]&&(e[n]=t[n])&&(t[n]=void 0)),e},e.prototype.init=function(t,n){var r,i,o;return i={locked:!1},(r=n[""+this.id+"Binding"])&&e.bind(t.id,this.id,r,i),(r=n[""+this.id+"Expression"])&&e.bindWithExpression(t,this.id,r,i),void 0===(o=n[this.id])||i.bound||t.prop(this.id,o,{force:!0}),n[""+this.id+"Uri"]||n[""+this.id+"UriExpression"]?e.instance(""+this.id+"Uri").init(t,n):void 0},e.prototype.done=function(t){return t[this.id]=null},e.prototype.getter=function(t){return t[this.id]},e.prototype.setter=function(t,e){return t[this.id]=e},e.prototype.comparator=function(t,e){return t===e},e.prototype.asyncAdapter=function(t,e){return t&&this.prop("asyncError",t),e||null},e.prototype.createAsyncValueCallback=function(t){var e;return null==t._monitor&&(t._monitor={}),e=t._monitor[this.id]=Object.math.uuid(),function(n){return function(r,i){return t.isDone?(t.log("!!! obsolete result at asyncValueCallback for property "+t+"."+n.id),void delete t._monitor[n.id]):e!==t._monitor[n.id]?void t.log("!!! out of monitor at asyncValueCallback for property "+t+"."+n.id):(t.prop(n.id,(t[""+n.id+"AsyncAdapter"]||n.asyncAdapter).call(t,r,i)),void delete t._monitor[n.id])}}(this)},e.prototype.setValue=function(t,e,n){var r,i,o;return r=Object.update({value:e},n),r.propId=this.id,r.entity=t,r.oldValue=this.getter(t),r.uri&&(i=r.uri,r.uri=null),void 0===(o=r.value)||!r.force&&this.comparator(o,r.oldValue)||(this.setter(t,o,r),this.asyncTarget&&o&&t.prop(this.asyncTarget,null,{uri:o,force:!0}),t.propertyChanged(r)),i&&Object.fire({uri:i,callback:this.createAsyncValueCallback(t)}),r},e.define=function(t){return i[t.id]=t},e.instance=function(t){return n[t]||(n[t]=new e(t))},e.bindWithExpression=function(n,r,i,o){var u,s,a,l,c,h,d;for(u=e.Expression.instance(i),o.locked=!1,h=function(t){return Object.DEBUG?Object.log("binding: "+n+"["+r+"] "+t):void 0},a=function(){var e,s,a,l,c,d,p;if(!o.locked){for(l={},p=u.sources,c=0,d=p.length;d>c;c++){if(s=p[c],!(e="@"===s.entityId?n:t(s.entityId).entity))return h("No source of "+s.id);if(!(a=e.prop(s.propId))&&(void 0===a&&"optional"!==s.flag||"required"===s.flag))return h("No value from "+s.id);l[s.id]=a}o.locked=!0;try{return i=u.expression.call(n,l),Object.LOG_LEVEL>4&&h("= ["+u.message+"] ("+(""+i).replace("\n"," ").slice(0,31)+")"),n.prop(r,i)}finally{o.locked=!1}}},d=u.sources,l=0,c=d.length;c>l;l++)s=d[l],t.instance("@"===s.entityId?n.id:s.entityId).addPropertyChangedHandler(s.propId,a,n.id);return o.bound?void 0:a()},e.bind=function(e,n,r,i){var o,u,s,a,l,c,h,d;return h=r.split("."),u=h[0],s=h[1],s||(s="value"),c=function(t){return Object.DEBUG?Object.log("duplex: "+e+"["+n+"] "+t):void 0},l=function(r){var o,a;if(!i.locked){i.locked=!0,Object.LOG_LEVEL>4&&c("= ["+u+"."+s+"] ("+(""+r.value).replace("\n"," ").slice(0,31)+")");try{if(!e)throw new Error("Binding target has no id");if(!(o=null!=(a=t(e))?a.entity:void 0))throw new Error("Lack of binding target with id ["+e+"]");return o.prop(n,r.value)}finally{i.locked=!1}}},t.instance(u).addPropertyChangedHandler(s,l,e),i.reverse||((o=null!=(d=t(u))?d.entity:void 0)&&void 0!==(a=o.prop(s))&&(l({entity:o,value:a}),i.bound=!0),i.reverse=!0,this.bind(u,s,e+"."+n,i)),!0},e}(),e=function(){function e(){}return e.prototype.launch=function(t){return this.init(),"function"==typeof t?t(null,this):void 0},e.prototype.init=function(){var t,e,n,r,i;t={},r=this.constructor.properties;for(e in r)n=r[e],n.extractDefaults(this,t);i=this.constructor.properties;for(e in i)n=i[e],n.init(this,t);return this.onEvent&&this.listenEvents(),"function"==typeof this.onInited?this.onInited(this):void 0},e.prototype.done=function(){var e,n,r;this.isDone=!0,r=this.constructor.properties;for(e in r)n=r[e],n.done(this);return t.release(this.id)},e.prototype.prop=function(t,e,r){var i;return this.isDone?null:(i=this.constructor.properties,1===arguments.length?i[t]?i[t].getter(this):this[t]:((i[t]||n.instance(t)).setValue(this,e,r),e))},e.prototype.propertyChanged=function(e){var n,r;return null!=(n=this[""+e.propId+"Changed"])&&n.call(this,e.value,e),null!=(r=t(this.id))?r.notifyPropertyChanged(e.propId,e):void 0},e.prototype.listenEvents=function(){if("#"===this.id[0])throw new Error(""+this+" attempts to listen events, but has no explicit id");return t.instance(this.id).startListen(function(t){return function(e){return t.onEvent(e)}}(this))},e.prototype.error=function(t,e){return Object.error(t).addPrefix(this).addDetails(e).log()},e.prototype.log=function(){var t;return t=1<=arguments.length?u.call(arguments,0):[],Object.LOG_LEVEL>4?(t.unshift(this.toString()),Object.log.apply(Object,t),t[1]):t[0]},e.prototype.toString=function(){return"#"===this.id[0]?"["+this.constructor.typeId+":"+this.id+"]":"["+this.id+"]"},e.getCtor=function(t){var e;return t.properties||t.methods?this.createCtor(Object.clone(t,{id:"T"+i++,superId:t.type,properties:t.properties||[],methods:t.methods})):(e=o(t.type))?e.ctor||(e.ctor=this.createCtor(e)):void 0},e.createCtor=function(){var r,u;return r=["id","superId","type","properties","methods","callback","uri"],u=function(t,e){var i,l,c,h,d,p,f;if(t.superId&&u.call(this,o(t.superId),e),t.properties)for(f=t.properties,d=0,p=f.length;p>d;d++){if(c=f[d],this.properties[c])throw Object.error("bad-code: Duplicate property "+c+" in type "+t.id).log();(this.properties[(l=n.instance(c)).id]=l).attachToEntityCtor(this)}for(i in t)s.call(t,i)&&(h=t[i],a.call(r,i)<0&&(e[i]=h));return Object.update.mixin(this.prototype,t.methods),this},function(n){var o,l,c,h,d;o=function(e){var n,o,u,l;if(n=null!=e?e.id:void 0){if(null!=(l=t(n))?l.entity:void 0)throw new Error("Duplicate entity id "+n);this.id=n,t.instance(this.id).entity=this}else this.id="#"+i++;if(e)for(o in e)s.call(e,o)&&(u=e[o],a.call(r,o)<0&&(this[o]=u));return this},d=e.prototype;for(c in d)s.call(d,c)&&(h=d[c],o.prototype[c]=h);o.typeId=n.id,o.properties={},u.call(o,n,l={});for(c in l)s.call(l,c)&&(h=l[c],o.prototype[c]=h);return o}}(),e.create=function(t){var e,n,r,i,u;return t.id&&(u=t.id.split(":"),t.id=u[0],r=u[1]),r&&(t.type=r),(i=o.findUnresolved(t.type))?o.resolve(i,function(e){return function(n){return n?void 0:e.create(t)}}(this)):(e=this.getCtor(t),n=new e(t),n.launch(t.callback),n)},e}(),o.define({id:"Axoid",methods:function(){return{onEvent:function(t){return this[t.uri.host](t)},define:function(t,e){var r;return null==e&&(e=t.uri),(r=e.path[0])&&(t.id=r),(r=e.path[1])&&(t.superId=t.id,t.id=r),"Property"===t.superId?n.define(t):o.define(t),t.callback()},create:function(t,n){var r;return null==n&&(n=t.uri),(r=n.hash)&&(t.id=r),(r=n.path[0])&&(t.type=r),e.create(t)},require:function(t){var e,n;return null==t&&(t={}),e=function(t){return function(e,n){var r;for(e&&Object.error(e).log(),e||(t.isDone=1);r=t.q.shift();)r(e,n);return 1}},n=function(n){var r;return r=n.dependencies,"string"==typeof r&&(r=[r]),(null!=r?r.length:void 0)?Function.perform(n,function(i){return[function(){var n,o,u,s;for(u=0,s=r.length;s>u;u++)o=r[u],o&&(n=t[o]||(t[o]={q:[],x:o}))&&!n.isDone&&(n.q.push(i.wait()),1===n.q.length&&Object.fire({uri:o,callback:e(n)}));return i.next(null,r.length)},n.callback]}):n.callback(null,0)}}()}}}),e.create({id:"axoid",type:"Axoid"}),Object.emit=Object.fire=function(e){if(!e.uri)throw new Error("No uri specified");return e.uri=Object.Uri.parse(e.uri),null==e.callback&&(e.callback=r),t.instance(e.uri.type).fire(e)}}.call(this),function(){Object.emit({uri:"axoid://define/EventHandler/Cache",uriPattern:"remote://{{host}}/{{path}}?_ver={{version}}",methods:function(){var t;return t={},{resolveUri:function(t){return t=Object.clone(t,t.params),t.path=t.path.join("/"),t.version||(t.version=this.getVersion()),Object.Uri.parse(String.template(this.uriPattern,t))},cacheDeserializer:function(t){return t?"object"==typeof t?t:Object.parse(t):null},cacheSerializer:function(t){return t?(t="object"==typeof t?JSON.stringify(t):t,t&&"{}"!==t?t:null):null},getVersion:function(){return""+(this.version||1)},fetch:function(t,e){return Object.emit({uri:this.resolveUri(t),callback:e,unmarshaller:this.fetchUnmarshaller})},restore:function(t){var e,n,r;return(e=null!=(r=this.storage)?r[t]:void 0)?(n=this.getVersion(),n===e.slice(0,+(n.length-1)+1||9e9)?e.slice(n.length+1):null):null},store:function(t,e){var n;try{return null!=(n=this.storage)?n.setItem(t,this.getVersion()+":"+e):void 0}catch(r){}},onEvent:function(e){var n,r,i;return i=e.uri,n=this.id+":"+i.id,(r=t[n]||(t[n]=this.cacheDeserializer(this.restore(n))))?e.callback(null,r):this.fetch(i,function(r){return function(i,o){var u;return(i=("undefined"!=typeof u&&null!==u?u.error:void 0)||i)&&(i=r.error(i,"fetch data for versioned cache")),!i&&(u=r.cacheSerializer(o))&&(t[n]=o=r.cacheDeserializer(u),r.store(n,u)),e.callback(i,o)}}(this))}}}})}.call(this),function(){!function(t,e){var n;return n=function(t){return t&&(t=""+t)&&(t.length<2?"0"+t:t)||"00"},Date.PATTERN_PARSE="yyyy-MM-dd",Date.PATTERN_FORMAT="dd MMM yyyy",Date.daysInMonth=function(e,n){return(1===e&&n%4===0?1:0)+t[e]},Date.getTimeZone=function(){var t,r,i;return t=-e.getTimezoneOffset(),i=""+Math.abs(t/60),r=""+Math.abs(t%60),"GMT"+(0===t&&""||"%2"+(t>0?"B":"D")+n(i)+":"+n(r))},Date.parse=function(t,e){var n,r,i;return null==e&&(e=Date.PATTERN_PARSE),t?t instanceof Date?t:(n=new Date,n.setDate(1),n.setHours(12),n.setMinutes(0),n.setSeconds(0),i=""+e,(r=i.indexOf("yyyy"))>-1?n.setFullYear(t.substr(r,4)):(r=i.indexOf("yy"))>-1&&n.setFullYear(2e3+t.substr(r,2)),(r=i.indexOf("MM"))>-1&&n.setMonth(+t.substr(r,2)-1),(r=i.indexOf("dd"))>-1&&n.setDate(+t.substr(r,2)),(r=i.indexOf("HH"))>-1&&(n.setHours(+t.substr(r,2)),(r=i.indexOf("mm"))>-1&&n.setMinutes(+t.substr(r,2)),(r=i.indexOf("ss"))>-1&&n.setSeconds(+t.substr(r,2))),n):null},Date.shift=function(t,e){var n;return n=new Date,n.setTime((t||n).getTime()+864e5*(e||0)),n},Date.days=function(t){return t&&t.getTime?(t=t.getTime(),(t-t%864e5)/864e5):0},Date.compare=function(t,e){return t&&e?t.getTime&&e.getTime?t.getTime()>e.getTime()?1:-1:0:t||e?t?1:-1:0},Date.monthName=function(t,e,r){var i;return null==r&&(r="MONTH"),null!=(i=String.localize.get(r,e))?i[n(t+1)]:void 0},Date.format=function(t,e,r){var i;return null==e&&(e=Date.PATTERN_FORMAT),i="",t&&t.getFullYear&&(i+=e||Date.PATTERN_FORMAT,i=i.replace("yyyy",""+t.getFullYear()),i=i.replace("yy",""+t.getFullYear()),i=i.replace("MMMM",Date.monthName(t.getMonth(),r)),i=i.replace("MMM",Date.monthName(t.getMonth(),r,"MONTH_SHORT")),i=i.replace("MM",n(t.getMonth()+1)),i=i.replace("dd",n(t.getDate())),i=i.replace("hh",n(t.getHours())),i=i.replace("mm",n(t.getMinutes())),i=i.replace("ss",n(t.getSeconds()))),i},String.localize.add("en",{DOW:{1:"Su",2:"Mo",3:"Tu",4:"We",5:"Th",6:"Fr",7:"Sa"},MONTH_SHORT:{"01":"Jan","02":"Feb","03":"Mar","04":"Apr","05":"May","06":"Jun","07":"Jul","08":"Aug","09":"Sep",10:"Oct",11:"Nov",12:"Dec"},MONTH:{"01":"January","02":"February","03":"March","04":"April","05":"May","06":"June","07":"July","08":"August","09":"September",10:"October",11:"November",12:"December"}})}([31,28,31,30,31,30,31,31,30,31,30,31,31],new Date)}.call(this),function(){Object.emit({uri:"axoid://define/EventHandler",properties:["readyForEvents"],readyForEventsExpression:"true",methods:function(t){return{listenEvents:function(){},readyForEventsChanged:function(e){return e?t.listenEvents.call(this):void 0},onEvent:function(t){return this.dispatchEvent(t)},resolveOperationId:function(t){return(t.method||"get")+String.capitalize(t.uri.path[0]||"default")},dispatchEvent:function(t){var e,n,r;if(r=this.resolveOperationId(t),!(n=this[r]))return"function"==typeof t.callback?t.callback(this.error("not-found: Operation not found: "+r).log()):void 0;try{return n.call(this,t)}catch(i){return e=i,"function"==typeof t.callback?t.callback(this.error("Error in "+r+" ").addDetails(e).log()):void 0}}}}})}.call(this),function(){Object.emit({uri:"axoid://define/L10nService/EnumService",methods:function(){var t;return t={},{onEvent:function(e,n,r){var i;return null==n&&(n=e.uri),null==r&&(r=n.host),(i=t[r])?e.callback(null,i):(i=String.localize.asEnum(r))?e.callback(null,t[r]=i):e.callback("not-found: enum ["+r+"]")}}}}),Object.emit({uri:"axoid://define/L10nService",properties:["requires:Requires"],methods:function(){return{onRequiredLoaded:function(t){var e,n,r,i;if(!t){for(i=[],n=0,r=arguments.length;r>n;n++)e=arguments[n],e&&i.push(String.localize.add(e));return i}},onEvent:function(t){return t.callback(null,String.localize(t.uri.host))}}}})}.call(this),function(){Object.log=function(t){return null==t&&(t={log:function(){}}),t.log.apply||(t._log=t.log,t.log=function(){var e;return t._log(function(){var t,n,r;for(r=[],t=0,n=arguments.length;n>t;t++)e=arguments[t],r.push(e);return r}.apply(this,arguments).join(", "))}),t.error||(t.error=function(){var e;return t.log.apply(t,["ERROR: "].concat(function(){var t,n,r;for(r=[],t=0,n=arguments.length;n>t;t++)e=arguments[t],r.push(e);return r}.apply(this,arguments)))}),function(e){var n;return(null!=e?e.printIntoLog:void 0)?e.printIntoLog(t):t.log.apply(t,function(){var t,e,r;for(r=[],t=0,e=arguments.length;e>t;t++)n=arguments[t],r.push(n);return r}.apply(this,arguments)),e}}(("object"==typeof window?window:this).console)}.call(this),function(){Object.math={decimalAdjust:function(t,e,n){return"undefined"==typeof n||0===+n?Math[t](e):(e=+e,n=+n,isNaN(e)||"number"!=typeof n||n%1!==0?0/0:(e=e.toString().split("e"),e=Math[t](+(e[0]+"e"+(e[1]?+e[1]-n:-n))),e=e.toString().split("e"),+(e[0]+"e"+(e[1]?+e[1]+n:n))))},round:function(t,e){return null==e&&(e=0),this.decimalAdjust("round",t,e)},uuid:function(){var t;return t=Date.now(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n;return n=(t+16*Math.random())%16|0,t=Math.floor(t/16),("x"===e?n:7&n|8).toString(16)})},sort:function(t,e,n){var r,i;return n||(n=1),i=-1*n,r="string"==typeof e?function(t){return null!=t?t[e]:void 0}:e||function(t){return t},t.sort(function(t,e){var o,u;return(o=r(t))>(u=r(e))?n:u>o?i:0})}}}.call(this),function(){Object.emit({uri:"axoid://define/Property/Liquid",methods:function(){return{comparator:function(){return!1}}}}),Object.emit({uri:"axoid://define/Property/Boolean",methods:function(){return{comparator:function(t,e){return!t==!e},setter:function(t,e){return t[this.id]=!!e}}}}),Object.emit({uri:"axoid://define/Property/Uri",methods:function(){return{comparator:function(t,e){return""+t==""+e},setter:function(t,e){return t[this.id]=Object.Uri.parse(e)}}}}),Object.emit({uri:"axoid://define/Property/Number",methods:function(){return{comparator:function(t,e){return Number(t)===Number(e)},setter:function(t,e){return t[this.id]=Number(e)}}},mixin:function(t,e){var n,r;return r={},n=e.id,r["increment"+String.capitalize(n)]=function(t){return null==t&&(t=1),this.prop(n,(this.prop(n)||0)+t)},r}}),Object.emit({uri:"axoid://define/Property/Date",methods:function(){return{comparator:function(t,e){return 0===Date.compare(t,e)}}}})}.call(this),function(){Object.emit({uri:"axoid://define/Property/Plugins",mixin:function(t){return{launch:function(e){return Function.perform(this,function(n){return[function(){var t,e,r,i;if(this.plugins)for(i=this.plugins,e=0,r=i.length;r>e;e++)t=i[e],Object.emit(Object.clone(t,{_parent:this,uri:"axoid://create",callback:n.wait()}));return n.next()},function(n){var r,i,o,u,s,a,l;for(n&&this.error(n,""+this+".onPluginsInitializing"),this.plugins=function(){var t,e,n;for(n=[],i=t=0,e=arguments.length;e>t;i=++t)r=arguments[i],i>1&&n.push(r);return n}.apply(this,arguments),l=this.plugins,s=0,a=l.length;a>s;s++)u=l[s],(o=u.id)&&(this[o]=u);return t.launch.call(this,e)}]})},done:function(){var e,n,r,i,o;if(t.done.call(this),this.plugins){for(i=this.plugins,o=[],n=0,r=i.length;r>n;n++)e=i[n],e.done(),e._parent=null,o.push(e.id?this[e.id]=null:void 0);return o}}}}})}.call(this),function(){Object.emit({uri:"axoid://define/Property/Requires",mixin:function(t){return{launch:function(e){return Object.emit({uri:"axoid://require",dependencies:this.requires,callback:function(n){return function(r){var i;return r&&Object.error(r,""+n+".onRequires").log(),"function"==typeof n.onRequiredLoaded&&n.onRequiredLoaded.apply(n,function(){var t,e,n;for(n=[],t=0,e=arguments.length;e>t;t++)i=arguments[t],n.push(i);return n}.apply(n,arguments)),t.launch.call(n,e)}}(this)})}}}})}.call(this),function(){String.template=function(){var t,e,n,r;return r=function(t){var e,n,r,i,o,u,s,a;for(i={tag:"top",children:[]},u=[],r=0,e=/{{([?\/:#]?)([a-zA-Z0-9\._]+)(\|[a-z]+)?}}/g;n=e.exec(t);)n.index&&(a=t.slice(r,+(n.index-1)+1||9e9))&&i.children.push({tag:"_",value:a}),s=n[2],"?"===n[1]||"#"===n[1]?(u.unshift(i),i.children.push(o={tag:s,children:[],flag:n[1]}),i=o):"/"===n[1]?i=u.shift():":"===n[1]?i=i["_"+s]={children:[]}:i.children.push({tag:s,opts:n[3]}),r=e.lastIndex;return(t=t.slice(r))&&i.children.push({tag:"_",value:t}),i},n=function(e,r){var i,o,u,s,a,l,c,h,d,p,f,g,v,y;if(s=[],e.children)for(y=e.children,h=0,f=y.length;f>h;h++)if(u=y[h],"_"===(a=u.tag))s.push(u.value);else if(l="."===a?r:Object.prop(r,a))if(Array.isArray(l))if(l.length)if("?"===u.flag)s.push(n(u,r));else for(d=0,g=l.length;g>d;d++)i=l[d],i&&s.push(n(u,i));else u._else&&s.push(n(u._else,"?"===u.flag?r:l));else s.push(n(u,"?"===u.flag?r:l));else if("#"===u.flag){if(l)for(c=p=0,v=l.length;v>p;c=++p)o=l[c],c&&s.push(n(u,{id:o,value:c}))}else u._else&&s.push(n(u._else,"?"===u.flag?r:l));else s.push(t.writeValue(r,s,e.opts));return s.join("")},t=function(t,e){return n(r(t),e)},t.filters={t:function(t){return String.localize(t)},d:function(t){return Date.format(t)}},e=function(t){return"&#"+t.charCodeAt(0)+";"},t.writeValue=function(t,n,r){var i,o,u,s;if(r)for(u=0,s=r.length;s>u;u++)i=r[u],(o=this.filters[i])&&(t=o(t));return n=""+t,r&&r.indexOf("u")||(n=n.replace(/[\u00A0-\u9999<>\&]/g,e)),n},t}()}.call(this),function(){var t=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},e={}.hasOwnProperty;Object.emit({uri:"axoid://define/Property/Value",mixin:function(){return{getValue:function(){return this.prop("value")},setValue:function(t){return this.prop("value",t)},isEmptyValue:function(){return!this.getValue()},equalsToValue:function(t){return t&&this.getValue()===""+t}}}}),Object.emit({uri:"axoid://define/Property/MultiValue",mixin:function(e){return{valueChanged:function(t){this.prop("mvalue",t?t.split&&t.length?t.split(this.mvalueSeparator||","):[""+t]:[]),e.valueChanged.apply(this,arguments)},getMultiValue:function(){return this.mvalue||[]},equalsValue:function(e){var n;return e&&(n=""+e,t.call(this.getMultiValue(),n)>=0)},putIntoMultiValue:function(e,n){var r,i,o,u,s,a;if(e){if(u=this.getMultiValue(),e=""+e,i=t.call(u,e)>=0,r=!1,-1===n&&(n=i?0:1),n&&!i&&(u.push(e),r=!0),!n&&i)for(o=s=0,a=u.length;a>s;o=++s)if(e=u[o],e===u[o]){u.splice(o,1),r=!0;break}return r&&this.setValue(u.sort().join(this.mvalueSeparator))}}}}}),Object.emit({uri:"axoid://define/Property/Values",methods:function(){return{comparator:function(){return!1}}},mixin:function(t){return{prop:function(e,n,r){var i,o;return this.isDone?null:(i=this.constructor.properties["Uri"===e.slice(-3)?e.slice(0,-3):e],1===arguments.length?i?t.prop.call(this,e):null!=(o=this.value)?o[e]:void 0:i?t.prop.call(this,e,"value"===e?Object.clone(n):n,r):(this.value||(this.value={}),this.value[e]!==n?(this.value[e]=n,this.propertyChanged.call(this,{entity:this,propId:e,value:n,oldValue:this.value[e]})):void 0))},propertyChanged:function(n){var r,i,o,u,s,a,l;if(t.propertyChanged.call(this,n),i=n.propId,"valueUri"!==i){if("value"===i){if(o=n.oldValue)for(u in o)e.call(o,u)&&(s=o[u],void 0===(null!=(a=n.value)?a[u]:void 0)&&t.propertyChanged.call(this,{entity:this,propId:u,value:null,oldValue:s}));if(n.value){l=n.value;for(u in l)e.call(l,u)&&(s=l[u],s!==(null!=o?o[u]:void 0)&&t.propertyChanged.call(this,{entity:this,propId:u,value:s,oldValue:null!=o?o[u]:void 0}))}}else(r=this.constructor.properties["Uri"===i.slice(-3)?i.slice(0,-3):i])||t.propertyChanged.call(this,{entity:this,propId:"value",value:this.value,oldValue:this.value});return n}}}}})}.call(this);
\No newline at end of file