siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
9 lines (7 loc) • 727 kB
JavaScript
/*
Siesta 5.6.1
Copyright(c) 2009-2022 Bryntum AB
https://bryntum.com/contact
https://bryntum.com/products/siesta/license
*/
var JSON;"undefined"==typeof Joose&&function(){var Joose={};Joose.C="undefined"!=typeof JOOSE_CFG?JOOSE_CFG:{},Joose.is_IE=!1,Joose.is_NodeJS=Boolean("undefined"!=typeof process&&process.pid),Joose.top=Joose.is_NodeJS&&global||this,Joose.stub=function(){return function(){throw new Error("Modules can not be instantiated")}},Joose.VERSION="3.50.1","undefined"!=typeof module&&(module.exports=Joose),(this.Joose=Joose).A={each:function(array,func,scope){scope=scope||this;for(var i=0,len=array.length;i<len;i++)if(!1===func.call(scope,array[i],i))return!1},eachR:function(array,func,scope){scope=scope||this;for(var i=array.length-1;0<=i;i--)if(!1===func.call(scope,array[i],i))return!1},exists:function(array,value){for(var i=0,len=array.length;i<len;i++)if(array[i]==value)return!0;return!1},map:function(array,func,scope){scope=scope||this;for(var res=[],i=0,len=array.length;i<len;i++)res.push(func.call(scope,array[i],i));return res},grep:function(array,func){var a=[];return Joose.A.each(array,function(t){func(t)&&a.push(t)}),a},remove:function(array,removeEle){var a=[];return Joose.A.each(array,function(t){t!==removeEle&&a.push(t)}),a}},Joose.S={saneSplit:function(str,delimeter){var res=(str||"").split(delimeter);return 1!=res.length||res[0]||res.shift(),res},uppercaseFirst:function(string){return string.substr(0,1).toUpperCase()+string.substr(1,string.length-1)},strToClass:function(name,top){var current=top||Joose.top;return Joose.A.each(name.split("."),function(segment){if(!current)return!1;current=current[segment]}),current}};function baseFunc(){}var enumProps=["hasOwnProperty","valueOf","toString","constructor"],manualEnum=!0;for(var i in{toString:1})manualEnum=!1;Joose.O={each:function(object,func,scope){for(var i in scope=scope||this,object)if(!1===func.call(scope,object[i],i))return!1;if(manualEnum)return Joose.A.each(enumProps,function(el){if(object.hasOwnProperty(el))return func.call(scope,object[el],el)})},eachOwn:function(object,func,scope){return scope=scope||this,Joose.O.each(object,function(value,name){if(object.hasOwnProperty(name))return func.call(scope,value,name)},scope)},copy:function(source,target){return target=target||{},Joose.O.each(source,function(value,name){target[name]=value}),target},copyOwn:function(source,target){return target=target||{},Joose.O.eachOwn(source,function(value,name){target[name]=value}),target},getMutableCopy:function(object){return baseFunc.prototype=object,new baseFunc},extend:function(target,source){return Joose.O.copy(source,target)},isEmpty:function(object){for(var i in object)if(object.hasOwnProperty(i))return!1;return!0},isInstance:function(obj){return obj&&obj.meta&&obj.constructor==obj.meta.c},isClass:function(obj){return obj&&obj.meta&&obj.meta.c==obj},wantArray:function(obj){return obj instanceof Array?obj:[obj]},isFunction:function(obj){return"function"==typeof obj&&obj.constructor!=/ /.constructor}},Joose.I={Array:function(){return[]},Object:function(){return{}},Function:function(){return arguments.callee},Now:function(){return new Date}},Joose.Proto=Joose.stub(),Joose.Proto.Empty=Joose.stub(),Joose.Proto.Empty.meta={},function(){Joose.Proto.Object=Joose.stub();var SUPER=function(){var self=SUPER.caller;if(self==SUPERARG&&(self=self.caller),!self.SUPER)throw"Invalid call to SUPER";return self.SUPER[self.methodName].apply(this,arguments)},SUPERARG=function(){return this.SUPER.apply(this,arguments[0])};Joose.Proto.Object.prototype={SUPERARG:SUPERARG,SUPER:SUPER,INNER:function(){throw"Invalid call to INNER"},BUILD:function(config){return 1==arguments.length&&"object"==typeof config&&config||{}},initialize:function(){},toString:function(){return"a "+this.meta.name}},Joose.Proto.Object.meta={constructor:Joose.Proto.Object,methods:Joose.O.copy(Joose.Proto.Object.prototype),attributes:{}},Joose.Proto.Object.prototype.meta=Joose.Proto.Object.meta}(),function(){Joose.Proto.Class=function(){return this.initialize(this.BUILD.apply(this,arguments))||this};var bootstrap={VERSION:null,AUTHORITY:null,constructor:Joose.Proto.Class,superClass:null,name:null,attributes:null,methods:null,meta:null,c:null,defaultSuperClass:Joose.Proto.Object,BUILD:function(name,extend){return this.name=name,{__extend__:extend||{}}},initialize:function(props){var extend=props.__extend__;this.VERSION=extend.VERSION,this.AUTHORITY=extend.AUTHORITY,delete extend.VERSION,delete extend.AUTHORITY,this.c=this.extractConstructor(extend),this.adaptConstructor(this.c),extend.constructorOnly?delete extend.constructorOnly:this.construct(extend)},construct:function(extend){if(this.prepareProps(extend)){var superClass=this.superClass=this.extractSuperClass(extend);this.processSuperClass(superClass),this.adaptPrototype(this.c.prototype),this.finalize(extend)}},finalize:function(extend){this.processStem(extend),this.extend(extend)},prepareProps:function(extend){return!0},extractConstructor:function(extend){var res=extend.hasOwnProperty("constructor")?extend.constructor:this.defaultConstructor();return delete extend.constructor,res},extractSuperClass:function(extend){if(extend.hasOwnProperty("isa")&&!extend.isa)throw new Error("Attempt to inherit from undefined superclass ["+this.name+"]");var res=extend.isa||this.defaultSuperClass;return delete extend.isa,res},processStem:function(){var superMeta=this.superClass.meta;this.methods=Joose.O.getMutableCopy(superMeta.methods||{}),this.attributes=Joose.O.getMutableCopy(superMeta.attributes||{})},initInstance:function(instance,props){Joose.O.copyOwn(props,instance)},defaultConstructor:function(){return function(arg){var BUILD=this.BUILD,args=BUILD&&BUILD.apply(this,arguments)||arg||{},thisMeta=this.meta;return thisMeta.initInstance(this,args),thisMeta.hasMethod("initialize")&&this.initialize(args)||this}},processSuperClass:function(superClass){var superProto=superClass.prototype;if(!superClass.meta){var extend=Joose.O.copy(superProto);extend.isa=Joose.Proto.Empty,delete extend.constructor;var meta=new this.defaultSuperClass.meta.constructor(null,extend);superClass.meta=superProto.meta=meta,meta.c=superClass}this.c.prototype=Joose.O.getMutableCopy(superProto),this.c.superClass=superProto},adaptConstructor:function(c){c.meta=this,c.hasOwnProperty("toString")||(c.toString=function(){return this.meta.name})},adaptPrototype:function(proto){proto.constructor=this.c,proto.meta=this},addMethod:function(name,func){func.SUPER=this.superClass.prototype,func.methodName=name,this.methods[name]=func,this.c.prototype[name]=func},addAttribute:function(name,init){this.attributes[name]=init,this.c.prototype[name]=init},removeMethod:function(name){delete this.methods[name],delete this.c.prototype[name]},removeAttribute:function(name){delete this.attributes[name],delete this.c.prototype[name]},hasMethod:function(name){return Boolean(this.methods[name])},hasAttribute:function(name){return void 0!==this.attributes[name]},hasOwnMethod:function(name){return this.hasMethod(name)&&this.methods.hasOwnProperty(name)},hasOwnAttribute:function(name){return this.hasAttribute(name)&&this.attributes.hasOwnProperty(name)},extend:function(props){Joose.O.eachOwn(props,function(value,name){"meta"!=name&&"constructor"!=name&&(Joose.O.isFunction(value)&&!value.meta?this.addMethod(name,value):this.addAttribute(name,value))},this)},subClassOf:function(classObject,extend){return this.subClass(extend,null,classObject)},subClass:function(extend,name,classObject){return(extend=extend||{}).isa=classObject||this.c,new this.constructor(name,extend).c},instantiate:function(){function f(){}f.prototype=this.c.prototype;var obj=new f;return this.c.apply(obj,arguments)||obj}};Joose.Proto.Class.prototype=Joose.O.getMutableCopy(Joose.Proto.Object.prototype),Joose.O.extend(Joose.Proto.Class.prototype,bootstrap),Joose.Proto.Class.prototype.meta=new Joose.Proto.Class("Joose.Proto.Class",bootstrap),Joose.Proto.Class.meta.addMethod("isa",function(someClass){function f(){}return f.prototype=this.c.prototype,new f instanceof someClass})}(),Joose.Managed=Joose.stub(),Joose.Managed.Property=new Joose.Proto.Class("Joose.Managed.Property",{name:null,init:null,value:null,definedIn:null,initialize:function(props){Joose.Managed.Property.superClass.initialize.call(this,props),this.computeValue()},computeValue:function(){this.value=this.init},preApply:function(targetClass){},postUnApply:function(targetClass){},apply:function(target){target[this.name]=this.value},isAppliedTo:function(target){return target[this.name]==this.value},unapply:function(from){if(!this.isAppliedTo(from))throw"Unapply of property ["+this.name+"] from ["+from+"] failed";delete from[this.name]},cloneProps:function(){return{name:this.name,init:this.init,definedIn:this.definedIn}},clone:function(name){var props=this.cloneProps();return props.name=name||props.name,new this.constructor(props)}}).c,Joose.Managed.Property.ConflictMarker=new Joose.Proto.Class("Joose.Managed.Property.ConflictMarker",{isa:Joose.Managed.Property,apply:function(target){throw new Error("Attempt to apply ConflictMarker ["+this.name+"] to ["+target+"]")}}).c,Joose.Managed.Property.Requirement=new Joose.Proto.Class("Joose.Managed.Property.Requirement",{isa:Joose.Managed.Property,apply:function(target){if(!target.meta.hasMethod(this.name))throw new Error("Requirement ["+this.name+"], defined in ["+this.definedIn.definedIn.name+"] is not satisfied for class ["+target+"]")},unapply:function(from){}}).c,Joose.Managed.Property.Attribute=new Joose.Proto.Class("Joose.Managed.Property.Attribute",{isa:Joose.Managed.Property,slot:null,initialize:function(){Joose.Managed.Property.Attribute.superClass.initialize.apply(this,arguments),this.slot=this.name},apply:function(target){target.prototype[this.slot]=this.value},isAppliedTo:function(target){return target.prototype[this.slot]==this.value},unapply:function(from){if(!this.isAppliedTo(from))throw"Unapply of property ["+this.name+"] from ["+from+"] failed";delete from.prototype[this.slot]},clearValue:function(instance){delete instance[this.slot]},hasValue:function(instance){return instance.hasOwnProperty(this.slot)},getRawValueFrom:function(instance){return instance[this.slot]},setRawValueTo:function(instance,value){return instance[this.slot]=value,this}}).c,Joose.Managed.Property.MethodModifier=new Joose.Proto.Class("Joose.Managed.Property.MethodModifier",{isa:Joose.Managed.Property,prepareWrapper:function(){throw"Abstract method [prepareWrapper] of "+this+" was called"},apply:function(target){var name=this.name,targetProto=target.prototype,isOwn=targetProto.hasOwnProperty(name),original=targetProto[name],superProto=target.meta.superClass.prototype,originalCall=isOwn?original:function(){return superProto[name].apply(this,arguments)},methodWrapper=this.prepareWrapper({name:name,modifier:this.value,isOwn:isOwn,originalCall:originalCall,superProto:superProto,target:target});isOwn&&(methodWrapper.__ORIGINAL__=original),methodWrapper.__CONTAIN__=this.value,(methodWrapper.__METHOD__=this).value.displayName=this.getDisplayName(target),methodWrapper.displayName="internal wrapper",targetProto[name]=methodWrapper},getDisplayName:function(target){return target.meta.name+"["+this.name+"]"},isAppliedTo:function(target){var targetCont=target.prototype[this.name];return targetCont&&targetCont.__CONTAIN__==this.value},unapply:function(from){var name=this.name,fromProto=from.prototype,original=fromProto[name].__ORIGINAL__;if(!this.isAppliedTo(from))throw"Unapply of method ["+name+"] from class ["+from+"] failed";original?fromProto[name]=original:delete fromProto[name]}}).c,Joose.Managed.Property.MethodModifier.Override=new Joose.Proto.Class("Joose.Managed.Property.MethodModifier.Override",{isa:Joose.Managed.Property.MethodModifier,prepareWrapper:function(params){var modifier=params.modifier,originalCall=params.originalCall,superProto=params.superProto,superMetaConst=superProto.meta.constructor,isCallToProto=!(superMetaConst!=Joose.Proto.Class&&superMetaConst!=Joose.Proto.Object||params.isOwn&&originalCall.IS_OVERRIDE),original=originalCall;isCallToProto&&(original=function(){var beforeSUPER=this.SUPER;this.SUPER=superProto.SUPER;var res=originalCall.apply(this,arguments);return this.SUPER=beforeSUPER,res});function override(){var beforeSUPER=this.SUPER;this.SUPER=original;var res=modifier.apply(this,arguments);return this.SUPER=beforeSUPER,res}return override.IS_OVERRIDE=!0,override},getDisplayName:function(target){return target.meta.name+"[override "+this.name+"]"}}).c,Joose.Managed.Property.MethodModifier.Put=new Joose.Proto.Class("Joose.Managed.Property.MethodModifier.Put",{isa:Joose.Managed.Property.MethodModifier.Override,prepareWrapper:function(params){if(params.isOwn)throw"Method ["+params.name+"] is applying over something ["+params.originalCall+"] in class ["+params.target+"]";return Joose.Managed.Property.MethodModifier.Put.superClass.prepareWrapper.call(this,params)},getDisplayName:function(target){return target.meta.name+"["+this.name+"]"}}).c,Joose.Managed.Property.MethodModifier.After=new Joose.Proto.Class("Joose.Managed.Property.MethodModifier.After",{isa:Joose.Managed.Property.MethodModifier,prepareWrapper:function(params){var modifier=params.modifier,originalCall=params.originalCall;return function(){var res=originalCall.apply(this,arguments);return modifier.apply(this,arguments),res}},getDisplayName:function(target){return target.meta.name+"[after "+this.name+"]"}}).c,Joose.Managed.Property.MethodModifier.Before=new Joose.Proto.Class("Joose.Managed.Property.MethodModifier.Before",{isa:Joose.Managed.Property.MethodModifier,prepareWrapper:function(params){var modifier=params.modifier,originalCall=params.originalCall;return function(){return modifier.apply(this,arguments),originalCall.apply(this,arguments)}},getDisplayName:function(target){return target.meta.name+"[before "+this.name+"]"}}).c,Joose.Managed.Property.MethodModifier.Around=new Joose.Proto.Class("Joose.Managed.Property.MethodModifier.Around",{isa:Joose.Managed.Property.MethodModifier,prepareWrapper:function(params){function bound(){return originalCall.apply(me,arguments)}var me,modifier=params.modifier,originalCall=params.originalCall;return function(){me=this;var boundArr=[bound];return boundArr.push.apply(boundArr,arguments),modifier.apply(this,boundArr)}},getDisplayName:function(target){return target.meta.name+"[around "+this.name+"]"}}).c,Joose.Managed.Property.MethodModifier.Augment=new Joose.Proto.Class("Joose.Managed.Property.MethodModifier.Augment",{isa:Joose.Managed.Property.MethodModifier,prepareWrapper:function(params){var AUGMENT=function(){for(var callstack=[],self=AUGMENT;callstack.push(self.IS_AUGMENT?self.__CONTAIN__:self),self=self.IS_AUGMENT&&(self.__ORIGINAL__||self.SUPER[self.methodName]););var beforeINNER=this.INNER;this.INNER=function(){var innerCall=callstack.pop();return innerCall?innerCall.apply(this,arguments):void 0};var res=this.INNER.apply(this,arguments);return this.INNER=beforeINNER,res};return AUGMENT.methodName=params.name,AUGMENT.SUPER=params.superProto,AUGMENT.IS_AUGMENT=!0,AUGMENT},getDisplayName:function(target){return target.meta.name+"[augment "+this.name+"]"}}).c,Joose.Managed.PropertySet=new Joose.Proto.Class("Joose.Managed.PropertySet",{isa:Joose.Managed.Property,properties:null,propertyMetaClass:Joose.Managed.Property,initialize:function(props){Joose.Managed.PropertySet.superClass.initialize.call(this,props),this.properties=props.properties||{}},addProperty:function(name,props){var metaClass=props.meta||this.propertyMetaClass;return delete props.meta,props.definedIn=this,props.name=name,this.properties[name]=new metaClass(props)},addPropertyObject:function(object){return this.properties[object.name]=object},removeProperty:function(name){var prop=this.properties[name];return delete this.properties[name],prop},haveProperty:function(name){return null!=this.properties[name]},haveOwnProperty:function(name){return this.haveProperty(name)&&this.properties.hasOwnProperty(name)},getProperty:function(name){return this.properties[name]},each:function(func,scope){Joose.O.each(this.properties,func,scope||this)},eachOwn:function(func,scope){Joose.O.eachOwn(this.properties,func,scope||this)},eachAll:function(func,scope){this.each(func,scope)},cloneProps:function(){var props=Joose.Managed.PropertySet.superClass.cloneProps.call(this);return props.propertyMetaClass=this.propertyMetaClass,props},clone:function(name){var clone=this.cleanClone(name);return clone.properties=Joose.O.copyOwn(this.properties),clone},cleanClone:function(name){var props=this.cloneProps();return props.name=name||props.name,new this.constructor(props)},alias:function(what){var props=this.properties;Joose.O.each(what,function(aliasName,originalName){var original=props[originalName];original&&this.addPropertyObject(original.clone(aliasName))},this)},exclude:function(what){var props=this.properties;Joose.A.each(what,function(name){delete props[name]})},beforeConsumedBy:function(){},flattenTo:function(target){var targetProps=target.properties;this.eachOwn(function(property,name){var targetProperty=targetProps[name];targetProperty instanceof Joose.Managed.Property.ConflictMarker||(targetProps.hasOwnProperty(name)&&null!=targetProperty?targetProperty!=property&&(target.removeProperty(name),target.addProperty(name,{meta:Joose.Managed.Property.ConflictMarker})):target.addPropertyObject(property))},this)},composeTo:function(target){this.eachOwn(function(property,name){target.haveOwnProperty(name)||target.addPropertyObject(property)})},composeFrom:function(){if(arguments.length){var flattening=this.cleanClone();Joose.A.each(arguments,function(arg){var isDescriptor=!(arg instanceof Joose.Managed.PropertySet),propSet=isDescriptor?arg.propertySet:arg;propSet.beforeConsumedBy(this,flattening),isDescriptor&&((arg.alias||arg.exclude)&&(propSet=propSet.clone()),arg.alias&&propSet.alias(arg.alias),arg.exclude&&propSet.exclude(arg.exclude)),propSet.flattenTo(flattening)},this),flattening.composeTo(this)}},preApply:function(target){this.eachOwn(function(property){property.preApply(target)})},apply:function(target){this.eachOwn(function(property){property.apply(target)})},unapply:function(from){this.eachOwn(function(property){property.unapply(from)})},postUnApply:function(target){this.eachOwn(function(property){property.postUnApply(target)})}}).c;var __ID__=1;Joose.Managed.PropertySet.Mutable=new Joose.Proto.Class("Joose.Managed.PropertySet.Mutable",{isa:Joose.Managed.PropertySet,ID:null,derivatives:null,opened:null,composedFrom:null,initialize:function(props){Joose.Managed.PropertySet.Mutable.superClass.initialize.call(this,props),this.opened=1,this.derivatives={},this.ID=__ID__++,this.composedFrom=[]},addComposeInfo:function(){this.ensureOpen(),Joose.A.each(arguments,function(arg){this.composedFrom.push(arg),(arg instanceof Joose.Managed.PropertySet?arg:arg.propertySet).derivatives[this.ID]=this},this)},removeComposeInfo:function(){this.ensureOpen(),Joose.A.each(arguments,function(arg){for(var i=0;i<this.composedFrom.length;){var propSet=this.composedFrom[i];arg==(propSet=propSet instanceof Joose.Managed.PropertySet?propSet:propSet.propertySet)?(delete propSet.derivatives[this.ID],this.composedFrom.splice(i,1)):i++}},this)},ensureOpen:function(){if(!this.opened)throw"Mutation of closed property set: ["+this.name+"]"},addProperty:function(name,props){return this.ensureOpen(),Joose.Managed.PropertySet.Mutable.superClass.addProperty.call(this,name,props)},addPropertyObject:function(object){return this.ensureOpen(),Joose.Managed.PropertySet.Mutable.superClass.addPropertyObject.call(this,object)},removeProperty:function(name){return this.ensureOpen(),Joose.Managed.PropertySet.Mutable.superClass.removeProperty.call(this,name)},composeFrom:function(){return this.ensureOpen(),Joose.Managed.PropertySet.Mutable.superClass.composeFrom.apply(this,this.composedFrom)},open:function(){this.opened++,1==this.opened&&(Joose.O.each(this.derivatives,function(propSet){propSet.open()}),this.deCompose())},close:function(){if(!this.opened)throw"Unmatched 'close' operation on property set: ["+this.name+"]";1==this.opened&&(this.reCompose(),Joose.O.each(this.derivatives,function(propSet){propSet.close()})),this.opened--},reCompose:function(){this.composeFrom()},deCompose:function(){this.eachOwn(function(property,name){property.definedIn!=this&&this.removeProperty(name)},this)}}).c,Joose.Managed.StemElement=function(){throw"Modules may not be instantiated."},Joose.Managed.StemElement.Attributes=new Joose.Proto.Class("Joose.Managed.StemElement.Attributes",{isa:Joose.Managed.PropertySet.Mutable,propertyMetaClass:Joose.Managed.Property.Attribute}).c,Joose.Managed.StemElement.Methods=new Joose.Proto.Class("Joose.Managed.StemElement.Methods",{isa:Joose.Managed.PropertySet.Mutable,propertyMetaClass:Joose.Managed.Property.MethodModifier.Put,preApply:function(){},postUnApply:function(){}}).c,Joose.Managed.StemElement.Requirements=new Joose.Proto.Class("Joose.Managed.StemElement.Requirements",{isa:Joose.Managed.PropertySet.Mutable,propertyMetaClass:Joose.Managed.Property.Requirement,alias:function(){},exclude:function(){},flattenTo:function(target){this.each(function(property,name){target.haveProperty(name)||target.addPropertyObject(property)})},composeTo:function(target){this.flattenTo(target)},preApply:function(){},postUnApply:function(){}}).c,Joose.Managed.StemElement.MethodModifiers=new Joose.Proto.Class("Joose.Managed.StemElement.MethodModifiers",{isa:Joose.Managed.PropertySet.Mutable,propertyMetaClass:null,addProperty:function(name,props){var metaClass=props.meta;delete props.meta,props.definedIn=this,props.name=name;var modifier=new metaClass(props),properties=this.properties;return properties[name]||(properties[name]=[]),properties[name].push(modifier),modifier},addPropertyObject:function(object){var name=object.name,properties=this.properties;return properties[name]||(properties[name]=[]),properties[name].push(object),object},removeProperty:function(name){if(this.haveProperty(name)){var properties=this.properties,modifier=properties[name].pop();return properties[name].length||Joose.Managed.StemElement.MethodModifiers.superClass.removeProperty.call(this,name),modifier}},alias:function(){},exclude:function(){},flattenTo:function(target){var targetProps=target.properties;this.each(function(modifiersArr,name){var targetModifiersArr=targetProps[name];null==targetModifiersArr&&(targetModifiersArr=targetProps[name]=[]),Joose.A.each(modifiersArr,function(modifier){Joose.A.exists(targetModifiersArr,modifier)||targetModifiersArr.push(modifier)})})},composeTo:function(target){this.flattenTo(target)},deCompose:function(){this.each(function(modifiersArr,name){for(var i=0;i<modifiersArr.length;)modifiersArr[i].definedIn!=this?modifiersArr.splice(i,1):i++})},preApply:function(target){},postUnApply:function(target){},apply:function(target){this.each(function(modifiersArr,name){Joose.A.each(modifiersArr,function(modifier){modifier.apply(target)})})},unapply:function(from){this.each(function(modifiersArr,name){for(var i=modifiersArr.length-1;0<=i;i--)modifiersArr[i].unapply(from)})}}).c,Joose.Managed.PropertySet.Composition=new Joose.Proto.Class("Joose.Managed.PropertySet.Composition",{isa:Joose.Managed.PropertySet.Mutable,propertyMetaClass:Joose.Managed.PropertySet.Mutable,processOrder:null,each:function(func,scope){var props=this.properties;scope=scope||this;Joose.A.each(this.processOrder,function(name){func.call(scope,props[name],name)})},eachR:function(func,scope){var props=this.properties;scope=scope||this;Joose.A.eachR(this.processOrder,function(name){func.call(scope,props[name],name)})},clone:function(name){var clone=this.cleanClone(name);return this.each(function(property){clone.addPropertyObject(property.clone())}),clone},alias:function(what){this.each(function(property){property.alias(what)})},exclude:function(what){this.each(function(property){property.exclude(what)})},flattenTo:function(target){var targetProps=target.properties;this.each(function(property,name){var subTarget=targetProps[name]||target.addProperty(name,{meta:property.constructor});property.flattenTo(subTarget)})},composeTo:function(target){var targetProps=target.properties;this.each(function(property,name){var subTarget=targetProps[name]||target.addProperty(name,{meta:property.constructor});property.composeTo(subTarget)})},deCompose:function(){this.eachR(function(property){property.open()}),Joose.Managed.PropertySet.Composition.superClass.deCompose.call(this)},reCompose:function(){Joose.Managed.PropertySet.Composition.superClass.reCompose.call(this),this.each(function(property){property.close()})},unapply:function(from){this.eachR(function(property){property.unapply(from)})}}).c,Joose.Managed.Stem=new Joose.Proto.Class("Joose.Managed.Stem",{isa:Joose.Managed.PropertySet.Composition,targetMeta:null,attributesMC:Joose.Managed.StemElement.Attributes,methodsMC:Joose.Managed.StemElement.Methods,requirementsMC:Joose.Managed.StemElement.Requirements,methodsModifiersMC:Joose.Managed.StemElement.MethodModifiers,processOrder:["attributes","methods","requirements","methodsModifiers"],initialize:function(props){Joose.Managed.Stem.superClass.initialize.call(this,props);var targetMeta=this.targetMeta;this.addProperty("attributes",{meta:this.attributesMC,properties:targetMeta?targetMeta.attributes:{}}),this.addProperty("methods",{meta:this.methodsMC,properties:targetMeta?targetMeta.methods:{}}),this.addProperty("requirements",{meta:this.requirementsMC}),this.addProperty("methodsModifiers",{meta:this.methodsModifiersMC})},reCompose:function(){var c=this.targetMeta.c;this.preApply(c),Joose.Managed.Stem.superClass.reCompose.call(this),this.apply(c)},deCompose:function(){var c=this.targetMeta.c;this.unapply(c),Joose.Managed.Stem.superClass.deCompose.call(this),this.postUnApply(c)}}).c,Joose.Managed.Builder=new Joose.Proto.Class("Joose.Managed.Builder",{targetMeta:null,_buildStart:function(targetMeta,props){targetMeta.stem.open(),Joose.A.each(["trait","traits","removeTrait","removeTraits","does","doesnot","doesnt"],function(builder){props[builder]&&(this[builder](targetMeta,props[builder]),delete props[builder])},this)},_extend:function(props){if(!Joose.O.isEmpty(props)){var targetMeta=this.targetMeta;this._buildStart(targetMeta,props),Joose.O.eachOwn(props,function(value,name){var handler=this[name];if(!handler)throw new Error("Unknown builder ["+name+"] was used during extending of ["+targetMeta.c+"]");handler.call(this,targetMeta,value)},this),this._buildComplete(targetMeta,props)}},_buildComplete:function(targetMeta,props){targetMeta.stem.close()},methods:function(targetMeta,info){Joose.O.eachOwn(info,function(value,name){targetMeta.addMethod(name,value)})},removeMethods:function(targetMeta,info){Joose.A.each(info,function(name){targetMeta.removeMethod(name)})},have:function(targetMeta,info){Joose.O.eachOwn(info,function(value,name){targetMeta.addAttribute(name,value)})},havenot:function(targetMeta,info){Joose.A.each(info,function(name){targetMeta.removeAttribute(name)})},havent:function(targetMeta,info){this.havenot(targetMeta,info)},after:function(targetMeta,info){Joose.O.each(info,function(value,name){targetMeta.addMethodModifier(name,value,Joose.Managed.Property.MethodModifier.After)})},before:function(targetMeta,info){Joose.O.each(info,function(value,name){targetMeta.addMethodModifier(name,value,Joose.Managed.Property.MethodModifier.Before)})},override:function(targetMeta,info){Joose.O.each(info,function(value,name){targetMeta.addMethodModifier(name,value,Joose.Managed.Property.MethodModifier.Override)})},around:function(targetMeta,info){Joose.O.each(info,function(value,name){targetMeta.addMethodModifier(name,value,Joose.Managed.Property.MethodModifier.Around)})},augment:function(targetMeta,info){Joose.O.each(info,function(value,name){targetMeta.addMethodModifier(name,value,Joose.Managed.Property.MethodModifier.Augment)})},removeModifier:function(targetMeta,info){Joose.A.each(info,function(name){targetMeta.removeMethodModifier(name)})},does:function(targetMeta,info){Joose.A.each(Joose.O.wantArray(info),function(desc){targetMeta.addRole(desc)})},doesnot:function(targetMeta,info){Joose.A.each(Joose.O.wantArray(info),function(desc){targetMeta.removeRole(desc)})},doesnt:function(targetMeta,info){this.doesnot(targetMeta,info)},trait:function(){this.traits.apply(this,arguments)},traits:function(targetMeta,info){if(!targetMeta.firstPass){if(!targetMeta.meta.isDetached)throw"Can't apply trait to not detached class";targetMeta.meta.extend({does:info})}},removeTrait:function(){this.removeTraits.apply(this,arguments)},removeTraits:function(targetMeta,info){if(!targetMeta.meta.isDetached)throw"Can't remove trait from not detached class";targetMeta.meta.extend({doesnot:info})},name:function(targetMeta,name){targetMeta.name=name}}).c,Joose.Managed.Class=new Joose.Proto.Class("Joose.Managed.Class",{isa:Joose.Proto.Class,stem:null,stemClass:Joose.Managed.Stem,stemClassCreated:!1,builder:null,builderClass:Joose.Managed.Builder,builderClassCreated:!1,isDetached:!1,firstPass:!0,skipTraitsAnchor:{},BUILD:function(){var sup=Joose.Managed.Class.superClass.BUILD.apply(this,arguments),props=sup.__extend__,traits=Joose.O.wantArray(props.trait||props.traits||[]);return delete props.trait,delete props.traits,Joose.A.each(Joose.O.wantArray(props.does||[]),function(arg){var role=arg.meta instanceof Joose.Managed.Class?arg:arg.role;role.meta.meta.isDetached&&traits.push(role.meta.constructor)}),traits.length&&(props.traits=traits),sup},initInstance:function(instance,props){Joose.O.each(this.attributes,function(attribute,name){attribute instanceof Joose.Managed.Attribute?attribute.initFromConfig(instance,props):props.hasOwnProperty(name)&&(instance[name]=props[name])})},defaultConstructor:function(){return function(skipTraitsAnchor,params){var thisMeta=this.meta,skipTraits=skipTraitsAnchor==thisMeta.skipTraitsAnchor,BUILD=this.BUILD,props=BUILD&&BUILD.apply(this,skipTraits?params:arguments)||(skipTraits?params[0]:skipTraitsAnchor)||{},extend=props.__extend__||props,traits=extend.trait||extend.traits;if(!traits&&!extend.detached||(delete extend.trait,delete extend.traits,delete extend.detached,skipTraits))return thisMeta.initInstance(this,props),thisMeta.hasMethod("initialize")&&this.initialize(props)||this;var meta=thisMeta.subClass({does:traits||[]},thisMeta.name).meta;return meta.isDetached=!0,meta.instantiate(thisMeta.skipTraitsAnchor,arguments)}},finalize:function(extend){Joose.Managed.Class.superClass.finalize.call(this,extend),this.stem.close(),this.afterMutate()},processStem:function(){Joose.Managed.Class.superClass.processStem.call(this),this.builder=new this.builderClass({targetMeta:this}),this.stem=new this.stemClass({name:this.name,targetMeta:this});var builderClass=this.getClassInAttribute("builderClass");builderClass&&(this.builderClassCreated=!0,this.addAttribute("builderClass",this.subClassOf(builderClass)));var stemClass=this.getClassInAttribute("stemClass");stemClass&&(this.stemClassCreated=!0,this.addAttribute("stemClass",this.subClassOf(stemClass)))},extend:function(props){props.builder&&(this.getBuilderTarget().meta.extend(props.builder),delete props.builder),props.stem&&(this.getStemTarget().meta.extend(props.stem),delete props.stem),this.builder._extend(props),this.firstPass=!1,this.stem.opened||this.afterMutate()},getBuilderTarget:function(){var builderClass=this.getClassInAttribute("builderClass");if(!builderClass)throw"Attempt to extend a builder on non-meta class";return builderClass},getStemTarget:function(){var stemClass=this.getClassInAttribute("stemClass");if(!stemClass)throw"Attempt to extend a stem on non-meta class";return stemClass},getClassInAttribute:function(attributeName){var attrClass=this.getAttribute(attributeName);return attrClass instanceof Joose.Managed.Property.Attribute&&(attrClass=attrClass.value),attrClass},addMethodModifier:function(name,func,type){var props={};return props.init=func,props.meta=type,this.stem.properties.methodsModifiers.addProperty(name,props)},removeMethodModifier:function(name){return this.stem.properties.methodsModifiers.removeProperty(name)},addMethod:function(name,func,props){return(props=props||{}).init=func,this.stem.properties.methods.addProperty(name,props)},addAttribute:function(name,init,props){return(props=props||{}).init=init,this.stem.properties.attributes.addProperty(name,props)},removeMethod:function(name){return this.stem.properties.methods.removeProperty(name)},removeAttribute:function(name){return this.stem.properties.attributes.removeProperty(name)},hasMethod:function(name){return this.stem.properties.methods.haveProperty(name)},hasAttribute:function(name){return this.stem.properties.attributes.haveProperty(name)},hasMethodModifiersFor:function(name){return this.stem.properties.methodsModifiers.haveProperty(name)},hasOwnMethod:function(name){return this.stem.properties.methods.haveOwnProperty(name)},hasOwnAttribute:function(name){return this.stem.properties.attributes.haveOwnProperty(name)},getMethod:function(name){return this.stem.properties.methods.getProperty(name)},getAttribute:function(name){return this.stem.properties.attributes.getProperty(name)},eachRole:function(roles,func,scope){Joose.A.each(roles,function(arg,index){var role=arg.meta instanceof Joose.Managed.Class?arg:arg.role;func.call(scope||this,arg,role,index)},this)},addRole:function(){this.eachRole(arguments,function(arg,role){this.beforeRoleAdd(role);var desc=arg;role!=arg?(desc.propertySet=role.meta.stem,delete desc.role):desc=desc.meta.stem,this.stem.addComposeInfo(desc)},this)},beforeRoleAdd:function(role){var roleMeta=role.meta;roleMeta.builderClassCreated&&this.getBuilderTarget().meta.extend({does:[roleMeta.getBuilderTarget()]}),roleMeta.stemClassCreated&&this.getStemTarget().meta.extend({does:[roleMeta.getStemTarget()]}),roleMeta.meta.isDetached&&!this.firstPass&&this.builder.traits(this,roleMeta.constructor)},beforeRoleRemove:function(role){var roleMeta=role.meta;roleMeta.builderClassCreated&&this.getBuilderTarget().meta.extend({doesnt:[roleMeta.getBuilderTarget()]}),roleMeta.stemClassCreated&&this.getStemTarget().meta.extend({doesnt:[roleMeta.getStemTarget()]}),roleMeta.meta.isDetached&&!this.firstPass&&this.builder.removeTraits(this,roleMeta.constructor)},removeRole:function(){this.eachRole(arguments,function(arg,role){this.beforeRoleRemove(role),this.stem.removeComposeInfo(role.meta.stem)},this)},getRoles:function(){return Joose.A.map(this.stem.composedFrom,function(composeDesc){return composeDesc instanceof Joose.Managed.PropertySet?composeDesc.targetMeta.c:composeDesc.propertySet})},does:function(role){for(var myRoles=this.getRoles(),i=0;i<myRoles.length;i++)if(role==myRoles[i])return!0;for(i=0;i<myRoles.length;i++)if(myRoles[i].meta.does(role))return!0;var superMeta=this.superClass.meta;return!!(this.superClass!=Joose.Proto.Empty&&superMeta&&superMeta.meta&&superMeta.meta.hasMethod("does"))&&superMeta.does(role)},getMethods:function(){return this.stem.properties.methods},getAttributes:function(){return this.stem.properties.attributes},afterMutate:function(){},getCurrentMethod:function(){for(var wrapper=arguments.callee.caller,count=0;wrapper&&count<5;wrapper=wrapper.caller,count++)if(wrapper.__METHOD__)return wrapper.__METHOD__;return null}}).c,Joose.Managed.Role=new Joose.Managed.Class("Joose.Managed.Role",{isa:Joose.Managed.Class,have:{defaultSuperClass:Joose.Proto.Empty,builderRole:null,stemRole:null},methods:{defaultConstructor:function(){return function(){throw new Error("Roles cant be instantiated")}},processSuperClass:function(){if(this.superClass!=this.defaultSuperClass)throw new Error("Roles can't inherit from anything")},getBuilderTarget:function(){return this.builderRole||(this.builderRole=(new this.constructor).c,this.builderClassCreated=!0),this.builderRole},getStemTarget:function(){return this.stemRole||(this.stemRole=(new this.constructor).c,this.stemClassCreated=!0),this.stemRole},addRequirement:function(methodName){this.stem.properties.requirements.addProperty(methodName,{})}},stem:{methods:{apply:function(){},unapply:function(){}}},builder:{methods:{requires:function(targetClassMeta,info){Joose.A.each(Joose.O.wantArray(info),function(methodName){targetClassMeta.addRequirement(methodName)},this)}}}}).c,Joose.Managed.Attribute=new Joose.Managed.Class("Joose.Managed.Attribute",{isa:Joose.Managed.Property.Attribute,have:{is:null,builder:null,isPrivate:!1,role:null,publicName:null,setterName:null,getterName:null,readable:!1,writeable:!1,hasGetter:!1,hasSetter:!1,required:!1,canInlineSetRaw:!0,canInlineGetRaw:!0},after:{initialize:function(){var name=this.name;this.publicName=name.replace(/^_+/,""),this.slot=this.isPrivate?"$"+name:name,this.setterName=this.setterName||this.getSetterName(),this.getterName=this.getterName||this.getGetterName(),this.readable=this.hasGetter=/^r/i.test(this.is),this.writeable=this.hasSetter=/^.w/i.test(this.is)}},override:{computeValue:function(){var init=this.init;!Joose.O.isClass(init)&&Joose.O.isFunction(init)||this.SUPER()},preApply:function(targetClass){targetClass.meta.extend({methods:this.getAccessorsFor(targetClass)})},postUnApply:function(from){from.meta.extend({removeMethods:this.getAccessorsFrom(from)})}},methods:{getAccessorsFor:function(targetClass){var targetMeta=targetClass.meta,setterName=this.setterName,getterName=this.getterName,methods={};return this.hasSetter&&!targetMeta.hasMethod(setterName)&&(methods[setterName]=this.getSetter(),methods[setterName].ACCESSOR_FROM=this),this.hasGetter&&!targetMeta.hasMethod(getterName)&&(methods[getterName]=this.getGetter(),methods[getterName].ACCESSOR_FROM=this),methods},getAccessorsFrom:function(from){var targetMeta=from.meta,setterName=this.setterName,getterName=this.getterName,setter=this.hasSetter&&targetMeta.getMethod(setterName),getter=this.hasGetter&&targetMeta.getMethod(getterName),removeMethods=[];return setter&&setter.value.ACCESSOR_FROM==this&&removeMethods.push(setterName),getter&&getter.value.ACCESSOR_FROM==this&&removeMethods.push(getterName),removeMethods},getGetterName:function(){return"get"+Joose.S.uppercaseFirst(this.publicName)},getSetterName:function(){return"set"+Joose.S.uppercaseFirst(this.publicName)},getSetter:function(){var me=this,slot=me.slot;return me.canInlineSetRaw?function(value){return this[slot]=value,this}:function(){return me.setRawValueTo.apply(this,arguments)}},getGetter:function(){var me=this,slot=me.slot;return me.canInlineGetRaw?function(value){return this[slot]}:function(){return me.getRawValueFrom.apply(this,arguments)}},getValueFrom:function(instance){var getterName=this.getterName;return this.readable&&instance.meta.hasMethod(getterName)?instance[getterName]():this.getRawValueFrom(instance)},setValueTo:function(instance,value){var setterName=this.setterName;this.writeable&&instance.meta.hasMethod(setterName)?instance[setterName](value):this.setRawValueTo(instance,value)},initFromConfig:function(instance,config){var value,name=this.name,isSet=!1;if(config.hasOwnProperty(name))value=config[name],isSet=!0;else{var init=this.init;Joose.O.isFunction(init)&&!Joose.O.isClass(init)?(value=init.call(instance,config,name),isSet=!0):this.builder&&(value=instance[this.builder.replace(/^this\./,"")](config,name),isSet=!0)}if(isSet)this.setRawValueTo(instance,value);else if(this.required)throw new Error("Required attribute ["+name+"] is missed during initialization of "+instance)}}}).c,Joose.Managed.Attribute.Builder=new Joose.Managed.Role("Joose.Managed.Attribute.Builder",{have:{defaultAttributeClass:Joose.Managed.Attribute},builder:{methods:{has:function(targetClassMeta,info){Joose.O.eachOwn(info,function(props,name){"object"==typeof props&&null!=props&&props.constructor!=/ /.constructor||(props={init:props}),props.meta=props.meta||targetClassMeta.defaultAttributeClass,/^__/.test(name)&&(name=name.replace(/^_+/,""),props.isPrivate=!0),targetClassMeta.addAttribute(name,props.init,props)},this)},hasnot:function(targetClassMeta,info){this.havenot(targetClassMeta,info)},hasnt:function(targetClassMeta,info){this.hasnot(targetClassMeta,info)}}}}).c,Joose.Managed.My=new Joose.Managed.Role("Joose.Managed.My",{have:{myClass:null,needToReAlias:!1},methods:{createMy:function(extend){this.meta;var isRole=this instanceof Joose.Managed.Role,myExtend=extend.my||{};delete extend.my;var superClassMy=this.superClass.meta.myClass;isRole||myExtend.isa||!superClassMy||(myExtend.isa=superClassMy),myExtend.meta||myExtend.isa||(myExtend.meta=this.constructor),myExtend.name=this.name+".my";var createdClass=this.myClass=Class(myExtend),c=this.c;c.prototype.my=c.my=isRole?createdClass:new createdClass({HOST:c}),this.needToReAlias=!0},aliasStaticMethods:function(){this.needToReAlias=!1;var c=this.c,myProto=this.myClass.prototype;Joose.O.eachOwn(c,function(property,name){property.IS_ALIAS&&delete c[name]}),this.myClass.meta.stem.properties.methods.each(function(method,name){c[name]||((c[name]=function(){return myProto[name].apply(c.my,arguments)}).IS_ALIAS=!0)})}},override:{extend:function(props){var myClass=this.myClass;!myClass&&this.superClass.meta.myClass&&this.createMy(props),props.my&&(myClass?(this.needToReAlias=!0,myClass.meta.extend(props.my),delete props.my):this.createMy(props)),this.SUPER(props),!this.needToReAlias||this instanceof Joose.Managed.Role||this.aliasStaticMethods()}},before:{addRole:function(){var myStem;Joose.A.each(arguments,function(arg){if(!arg)throw new Error("Attempt to consume an undefined Role into ["+this.name+"]");var role=arg.meta instanceof Joose.Managed.Class?arg:arg.role;if(role.meta.meta.hasAttribute("myClass")&&role.meta.myClass){if(!this.myClass)return void this.createMy({my:{does:role.meta.myClass}});(myStem=this.myClass.meta.stem).opened||myStem.open(),myStem.addComposeInfo(role.my.meta.stem)}},this),myStem&&(myStem.close(),this.needToReAlias=!0)},removeRole:function(){if(this.myClass){var myStem=this.myClass.meta.stem;myStem.open(),Joose.A.each(arguments,function(role){role.meta.meta.hasAttribute("myClass")&&role.meta.myClass&&(myStem.removeComposeInfo(role.my.meta.stem),this.needToReAlias=!0)},this),myStem.close()}}}}).c,Joose.Namespace=Joose.stub(),Joose.Namespace.Able=new Joose.Managed.Role("Joose.Namespace.Able",{have:{bodyFunc:null},before:{extend:function(extend){extend.body&&(this.bodyFunc=extend.body,delete extend.body)}},after:{afterMutate:function(){var bodyFunc=this.bodyFunc;delete this.bodyFunc,bodyFunc&&Joose.Namespace.Manager.my.executeIn(this.c,bodyFunc)}}}).c,Joose.Managed.Bootstrap=new Joose.Managed.Role("Joose.Managed.Bootstrap",{does:[Joose.Namespace.Able,Joose.Managed.My,Joose.Managed.Attribute.Builder]}).c,Joose.Meta=Joose.stub(),Joose.Meta.Object=new Joose.Proto.Class("Joose.Meta.Object",{isa:Joose.Proto.Object}).c,Joose.Meta.Class=new Joose.Managed.Class("Joose.Meta.Class",{isa:Joose.Managed.Class,does:Joose.Managed.Bootstrap,have:{defaultSuperClass:Joose.Meta.Object}}).c,Joose.Meta.Role=new Joose.Meta.Class("Joose.Meta.Role",{isa:Joose.Managed.Role,does:Joose.Managed.Bootstrap}).c,Joose.Namespace.Keeper=new Joose.Meta.Class("Joose.Namespace.Keeper",{isa:Joose.Meta.Class,have:{externalConstructor:null},methods:{defaultConstructor:function(){return function(){var thisMeta=arguments.callee.meta;if(thisMeta instanceof Joose.Namespace.Keeper)throw new Error("Module ["+thisMeta.c+"] may not be instantiated. Forgot to 'use' the class with the same name?");var externalConstructor=thisMeta.externalConstructor;if("function"==typeof externalConstructor)return externalConstructor.meta=thisMeta,externalConstructor.apply(this,arguments);throw"NamespaceKeeper of ["+thisMeta.name+"] was planted incorrectly."}},plant:function(withClass){var keeper=this.c;keeper.meta=withClass.meta,(keeper.meta.c=keeper).meta.externalConstructor=withClass}}}).c,Joose.Namespace.Manager=new Joose.Managed.Class("Joose.Namespace.Manager",{have:{current:null},methods:{initialize:function(){this.current=[Joose.top]},getCurrent:function(){return this.current[0]},executeIn:function(ns,func){var current=this.current;current.unshift(ns);var res=func.call(ns,ns);return current.shift(),res},earlyCreate:function(name,metaClass,props){return props.constructorOnly=!0,new metaClass(name,props).c},create:function(nsName,metaClass,extend){if(!nsName)return new metaClass(nsName,extend).c;var me=this;if(/^\./.test(nsName))return this.executeIn(Joose.top,function(){return me.create(nsName.replace(/^\./,""),metaClass,extend)});for(var props=extend||{},parts=Joose.S.saneSplit(nsName,"."),object=this.getCurrent(),soFar=object==Joose.top?[]:Joose.S.saneSplit(object.meta.name,"."),i=0;i<parts.length;i++){var part=parts[i],isLast=i==parts.length-1;if("meta"==part||"my"==part||!part)throw"Module name ["+nsName+"] may not include a part called 'meta' or 'my' or empty part.";var cur=object[part];soFar.push(part);var nsKeeper,soFarName=soFar.join("."),needFinalize=!1;if(void 0===cur)isLast?(nsKeeper=this.earlyCreate(soFarName,metaClass,props),needFinalize=!0):nsKeeper=new Joose.Namespace.Keeper(soFarName).c,cur=object[part]=nsKeeper;else if(isLast&&cur&&cur.meta){var currentMeta=cur.meta;if(metaClass==Joose.Namespace.Keeper)currentMeta.extend(props);else if(currentMeta instanceof Joose.Namespace.Keeper)currentMeta.plant(this.earlyCreate(soFarName,metaClass,props)),needFinalize=!0;else if(!Joose.C.ignoreRepeatedDeclarations)throw new Error("Double declaration of ["+soFarName+"]")}else if(isLast&&!(cur&&cur.meta&&cur.meta.meta))throw"Trying to setup module "+soFarName+" failed. There is already something: "+cur;isLast&&this.prepareMeta(cur.meta),needFinalize&&cur.meta.construct(props),object=cur}return object},prepareMeta:function(){},prepareProperties:function(name,props,defaultMeta,callback){var meta;return name&&"string"!=typeof name&&(props=name,name=null),props&&props.meta&&(meta=props.meta,delete props.meta),meta=meta||(props&&"function"==typeof props.isa&&props.isa.meta?props.isa.meta.constructor:defaultMeta),callback.call(this,name,meta,props)},getDefaultHelperFor:function(metaClass){var me=this;return function(name,props){return me.prepareProperties(name,props,metaClass,function(name,meta,props){return me.create(name,meta,props)})}},register:function(helperName,metaClass,func){var me=this;if(this.meta.hasMethod(helperName)){function helper(){return me[helperName].apply(me,arguments)}Joose.top[helperName]||(Joose.top[helperName]=helper),Joose[helperName]||(Joose[helperName]=helper),Joose.is_NodeJS&&"undefined"!=typeof exports&&(exports[helperName]=helper)}else{var methods={};methods[helperName]=func||this.getDefaultHelperFor(metaClass),this.meta.extend({methods:methods}),this.register(helperName)}},Module:function(name,props){return this.prepareProperties(name,props,Joose.Namespace.Keeper,function(name,meta,props){return"function"==typeof props&&(props={body:props}),this.create(name,meta,props)})}}}).c,Joose.Namespace.Manager.my=new Joose.Namespace.Manager,Joose.Namespace.Manager.my.register("Class",Joose.Meta.Class),Joose.Namespace.Manager.my.register("Role",Joose.Meta.Role),Joose.Namespace.Manager.my.register("Module");var Class=Joose.Class,Role=Joose.Role;Role("Joose.Attribute.Delegate",{have:{handles:null},override:{eachDelegate:function(handles,func,scope){return"string"==typeof handles?func.call(scope,handles,handles):handles instanceof Array?Joose.A.each(handles,function(delegateTo){func.call(scope,delegateTo,delegateTo)}):void(handles===Object(handles)&&Joose.O.eachOwn(handles,function(delegateTo,handleAs){func.call(scope,handleAs,delegateTo)}))},getAccessorsFor:function(targetClass){var targetMeta=targetClass.meta,methods=this.SUPER(targetClass),me=this;return this.eachDelegate(this.handles,function(handleAs,delegateTo){targetMeta.hasMethod(handleAs)||((methods[handleAs]=function(){var attrValue=me.getValueFrom(this);return attrValue[delegateTo].apply(attrValue,arguments)}).ACCESSOR_FROM=me)}),methods},getAccessorsFrom:function(from){var methods=this.SUPER(from),me=this,targetMeta=from.meta;return this.eachDelegate(this.handles,function(handleAs){var handler=targetMeta.getMethod(handleAs);handler&&handler.value.ACCESSOR_FROM==me&&methods.push(handleAs)}),methods}}}),Role("Joose.Attribute.Trigger",{have:{trigger:null},after:{initialize:function(){if(this.trigger){if(!this.writeable)throw new Error("Can't use `trigger` for read-only attributes");this.hasSetter=!0}}},override:{getSetter:function(){var original=this.SUPER(),trigger=this.trigger;if(!trigger)return original;var me=this,init=Joose.O.isFunction(me.init)?null:me.init;return function(){var oldValue=me.hasValue(this)?me.getValueFrom(this):init,res=original.apply(this,arguments);return trigger.call(this,me.getValueFrom(this),oldValue),res}}}}),Role("Joose.Attribute.Lazy",{have:{lazy:null},before:{computeValue:function(){"function"==typeof this.init&&this.lazy&&(this.lazy=this.init,delete this.init)}},after:{initialize:function(){this.lazy&&(this.readable=this.hasGetter=!0)}},override:{getGetter:function(){var original=this.SUPER(),lazy=this.lazy;if(!lazy)return original;var me=this;return function(){if(!me.hasValue(this)){var initializer="function"==typeof lazy?lazy:this[lazy.replace(/^this\./,"")];me.setValueTo(this,initializer.apply(this,arguments))}return original.call(this)}}}}),Role("Joose.Attribute.Accessor.Combined",{have:{isCombined:!1},after:{initialize:function(){this.isCombined=this.isCombined||/..c/i.test(this.is),this.isCombined&&(this.slot="$$"+this.name,this.hasGetter=!0,this.hasSetter=!1,this.setterName=this.getterName=this.publicName)}},override:{getGetter:function(){var getter=this.SUPER();if(!this.isCombined)return getter;var setter=this.getSetter(),me=this;return function(){if(!arguments.length){if(me.readable)return getter.call(this);throw new Error("Call to getter of unreadable attribute: ["+me.name+"]")}if(me.writeable)return setter.apply(this,arguments);throw new E