Comparing version 0.0.17 to 0.0.18
@@ -16,23 +16,15 @@ var MixinRegisterAndGetClass, RemoteBoundedContext, eventric, _; | ||
RemoteBoundedContext.prototype.command = function(boundedContextName, commandName, commandPayload, callback) { | ||
RemoteBoundedContext.prototype.command = function(boundedContextName, command, callback) { | ||
return this.rpc({ | ||
"class": 'BoundedContext', | ||
boundedContextName: boundedContextName, | ||
method: 'command', | ||
params: { | ||
boundedContextName: boundedContextName, | ||
methodName: commandName, | ||
methodParams: commandPayload | ||
} | ||
params: command | ||
}, callback); | ||
}; | ||
RemoteBoundedContext.prototype.query = function(boundedContextName, queryName, queryPayload, callback) { | ||
RemoteBoundedContext.prototype.query = function(boundedContextName, query, callback) { | ||
return this.rpc({ | ||
"class": 'BoundedContext', | ||
boundedContextName: boundedContextName, | ||
method: 'query', | ||
params: { | ||
boundedContextName: boundedContextName, | ||
methodName: queryName, | ||
methodParams: queryPayload | ||
} | ||
params: query | ||
}, callback); | ||
@@ -46,17 +38,13 @@ }; | ||
RemoteBoundedContext.prototype.handle = function(payload, callback) { | ||
var boundedContext, err, methodParams; | ||
boundedContext = this.getClass(payload.params.boundedContextName); | ||
var boundedContext, err; | ||
boundedContext = this.getClass(payload.boundedContextName); | ||
if (!boundedContext) { | ||
err = new Error("Tried to handle RPC class with not registered boundedContext " + payload.params[0]); | ||
err = new Error("Tried to handle RPC class with not registered boundedContext " + payload.boundedContextName); | ||
return callback(err, null); | ||
} | ||
if (!(payload.method in boundedContext)) { | ||
err = new Error("RPC method " + payload.method + " not found on Class " + payload.params[0]); | ||
err = new Error("RPC method " + payload.method + " not found on Class " + payload.boundedContextName); | ||
return callback(err, null); | ||
} | ||
methodParams = { | ||
name: payload.params.methodName, | ||
params: payload.params.methodParams | ||
}; | ||
return boundedContext[payload.method](methodParams, callback); | ||
return boundedContext[payload.method](payload.params, callback); | ||
}; | ||
@@ -63,0 +51,0 @@ |
@@ -1,2 +0,2 @@ | ||
require.register("eventric/aggregate_entity",function(e,t,r){var n,i,o,s,a;s=t("eventric"),a=s("HelperUnderscore"),o=s("MixinSetGet"),n=s("AggregateEntity"),i=s("AggregateEntityCollection"),s("HelperObserve"),n=function(){function e(e){var t,r,n;this._props=null!=e?e:{},n=this._props;for(t in n)r=n[t],Object.defineProperty(this,t,{get:function(){return this._props[t]},set:function(e){return this._set(t,e)}});this._isNew=!1,this._propsChanged={},this._domainEvents=[],this._entityClasses={},this._trackPropsChanged=!0,this._observerOpen()}return a.extend(e.prototype,o.prototype),e.prototype.create=function(){return this.id=this._generateUid(),this._isNew=!0,this._observerDiscard()},e.prototype._observerOpen=function(){return this._observer=new ObjectObserver(this),this._observer.open(function(e){return function(t,r,n){return Object.keys(t).forEach(function(r){return e._set(r,t[r])}),Object.keys(n).forEach(function(t){return e._set(t,n[t])})}}(this))},e.prototype._observerDiscard=function(){return this._observer.discardChanges()},e.prototype._observerClose=function(){return this._observer.close()},e.prototype._generateUid=function(e){var t,r;return t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)},r=e||"-",t()+t()+r+t()+r+t()+r+t()+r+t()+t()+t()},e.prototype.getMetaData=function(){return{id:this.id,name:this.constructor.name}},e.prototype.getChanges=function(){var e;return this._observer.deliver(),e={props:this._changesOnProperties(),entities:{},collections:this._changesOnCollections()},this._changesAreNotEmpty(e)?e:{}},e.prototype._changesOnProperties=function(){var e;return e={},Object.keys(this._propsChanged).length>0&&(e=this._propsChanged),e},e.prototype._changesOnCollections=function(){var e,t,r,n,o;e={},o=this._props;for(r in o)n=o[r],n instanceof i&&(t=this._changesOnCollection(r,n),t.length>0&&(e[r]=t));return e},e.prototype._changesOnCollection=function(e,t){var r,n,i,o,s,a,c;for(r=[],c=t.entities,s=0,a=c.length;a>s;s++)n=c[s],o=n.getChanges(),i=this._changesAreNotEmpty(o),(i||n._isNew)&&(n=n.getMetaData(),i&&(n.changed=o),r.push(n));return r},e.prototype._changesAreNotEmpty=function(e){var t,r;for(t in e)if(r=e[t],Object.keys(r).length>0)return!0;return!1},e.prototype.clearChanges=function(){var e,t,r;this._observerClose(),this._propsChanged={},r=this._props;for(e in r)t=r[e],t instanceof i&&this._clearCollectionChanges(t);return this._observerOpen()},e.prototype._clearCollectionChanges=function(e){var t,r,n,i,o;for(i=e.entities,o=[],r=0,n=i.length;n>r;r++)t=i[r],o.push(t.clearChanges());return o},e.prototype.applyChanges=function(e,t){var r;return null==t&&(t={}),this._observerClose(),r=this._trackPropsChanged,this._trackPropsChanged=!1,this._applyChangesToProps(e.props),this._applyChangesToCollections(e.collections),this._trackPropsChanged=r,this._observerOpen()},e.prototype._applyChangesToProps=function(e){var t,r,n;n=[];for(t in e)r=e[t],n.push(this[t]=r);return n},e.prototype._applyChangesToCollections=function(e){var t,r,n;n=[];for(r in e)t=e[r],this[r]||(this[r]=new i),n.push(this._applyChangesToCollection(r,t));return n},e.prototype._applyChangesToCollection=function(t,r){var n,i,o,s,a,c,u;for(u=[],s=0,a=r.length;a>s;s++)i=r[s],o=null!=(c=this[t])?c.get(i.id):void 0,o||(o=(n=this.getEntityClass(i.name))?new n:new e,o.id=i.id,this[t].add(o)),u.push(i.changed?o.applyChanges(i.changed):void 0);return u},e.prototype.getEntityClass=function(e){var t,r;return t=null!=(r=this._entityClasses[e])?r:!1},e.prototype.registerEntityClass=function(e,t){return this._entityClasses[e]=t},e}(),r.exports=n}),require.register("eventric/aggregate_entity_collection",function(e,t,r){var n,i,o;i=t("eventric"),o=i("HelperUnderscore"),Function.prototype.prop=function(e,t){return null==t&&(t={}),Object.defineProperty(this.prototype,e,o.defaults(t,{get:function(){return this["_"+e]},set:function(t){return this["_"+e]=t}}))},n=function(){function e(e){null==e&&(e={}),this._entities=[],e.entities&&this.add(e.entities)}return e.prototype.add=function(e){return e instanceof Array?this._entities=this._entities.concat(e):this._entities.push(e),this},e.prototype.remove=function(e){var t,r,n,i,o;for(o=this._entities,r=n=0,i=o.length;i>n;r=++n)if(t=o[r],t===e){this._entities=this._entities.slice(r+1);break}return this},e.prototype.get=function(e){var t,r,n,i;for(i=this._entities,r=0,n=i.length;n>r;r++)if(t=i[r],e===t.id)return t},e.prop("entities",{set:function(){throw"Don't set entities directly"},get:function(){return this._entities}}),e.prop("length",{set:function(){throw"Don't set length directly"},get:function(){return this._entities.length}}),e}(),r.exports=n}),require.register("eventric/aggregate_repository",function(e,t,r){var n,i,o,s;o=t("eventric"),s=o("HelperUnderscore"),i=o("MixinRegisterAndGetClass"),n=function(){function e(e){this._eventStore=e}return s.extend(e.prototype,i.prototype),e.prototype.findById=function(e,t,r){return this._eventStore.find(e,{"aggregate.id":t},function(n){return function(i,o){var s,a,c,u,l;if(i)return r(i,null);if(0===o.length)return r(null,null);if(s=n.getClass(e),!s)return i=new Error("Tried to command not registered Aggregate '"+e+"'"),void r(i,null);for(a=new s,a.id=t,u=0,l=o.length;l>u;u++)c=o[u],c.aggregate.changed&&a.applyChanges(c.aggregate.changed);return r(null,a)}}(this))},e}(),r.exports=n}),require.register("eventric/aggregate_root",function(e,t,r){var n,i,o,s,a,c,u,l={}.hasOwnProperty,h=function(e,t){function r(){this.constructor=e}for(var n in t)l.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};c=t("eventric"),u=c("HelperUnderscore"),n=c("AggregateEntity"),i=c("AggregateEntityCollection"),a=c("MixinSetGet"),s=c("DomainEvent"),o=function(e){function t(){this._domainEvents=[],t.__super__.constructor.apply(this,arguments)}return h(t,e),t.prototype.generateDomainEvent=function(e,t){var r,n,i;return null==t&&(t={}),t.includeAggregateChanges!==!1&&(t.includeAggregateChanges=!0),i={name:e,aggregate:this.getMetaData()},t.includeAggregateChanges&&(r=this.getChanges(),Object.keys(r).length>0&&(i.aggregate.changed=r)),n=new s(i),this._domainEvents.push(n)},t.prototype.getDomainEvents=function(){return this._domainEvents},t.prototype.getSnapshot=function(){var e,t;return t={name:"_snapshot",aggregate:this.getMetaData()},t.aggregate.changed=this.getChanges(),e=new s(t)},t.prototype.registerEntityCollection=function(e,t,r){return this[e]=new i,this.registerEntityClass(t,r)},t.prototype.addEntityToCollection=function(e,t){return this[t].add(e)},t}(n),r.exports=o}),require.register("eventric/bounded_context",function(e,t,r){var n,i,o,s,a;a=t("eventric"),n=a("AggregateRepository"),o=a("CommandService"),s=a("DomainEventService"),i=function(){function e(){}return e.prototype.aggregates={},e.prototype.readAggregateRepositories={},e.prototype._readAggregateRepositoriesInstances={},e.prototype.applicationServices=[],e.prototype._applicationServiceCommands={},e.prototype._applicationServiceQueries={},e.prototype.initialize=function(e){return this._initializeEventStore(e,function(e){return function(){return e._aggregateRepository=new n(e._eventStore),e._domainEventService=new s(e._eventStore),e._commandService=new o(e._domainEventService,e._aggregateRepository),e._initializeAggregates(),e._initializeReadAggregateRepositories(),e._initializeApplicationServices()}}(this))},e.prototype._initializeEventStore=function(e,r){var n;return e?(this._eventStore=e,r()):(n=t("eventric-store-mongodb"),this._eventStore=new n,this._eventStore.initialize(function(){return function(){return r()}}(this)))},e.prototype._initializeAggregates=function(){var e,t,r,n;r=this.aggregates,n=[];for(t in r)e=r[t],n.push(this._aggregateRepository.registerClass(t,e));return n},e.prototype._initializeReadAggregateRepositories=function(){var e,t,r,n;r=this.readAggregateRepositories,n=[];for(t in r)e=r[t],n.push(this._readAggregateRepositoriesInstances[t]=new e(t,this._eventStore));return n},e.prototype._initializeApplicationServices=function(){var e,t,r,n,i,o,s,a,c,u,l,h,p;for(u=this.applicationServices,p=[],a=0,c=u.length;c>a;a++){e=u[a],e.commandService=this._commandService,e.getReadAggregateRepository=function(e){return function(){return e.getReadAggregateRepository.apply(e,arguments)}}(this),e.onDomainEvent=function(e){return function(){return e.onDomainEvent.apply(e,arguments)}}(this),l=e.commands,o=function(e){return function(t,r,n){return e._applicationServiceCommands[t]=function(){return n[r].apply(n,arguments)}}}(this);for(r in l)t=l[r],o(r,t,e);h=e.queries,s=function(e){return function(t,r,n){return e._applicationServiceQueries[t]=function(){return n[r].apply(n,arguments)}}}(this);for(i in h)n=h[i],s(i,n,e);p.push("function"==typeof e.initialize?e.initialize():void 0)}return p},e.prototype.getReadAggregateRepository=function(e){return this._readAggregateRepositoriesInstances[e]},e.prototype.command=function(e,t){var r,n,i;return this._applicationServiceCommands[e.name]?this._applicationServiceCommands[e.name](e.params,t):(i=this._splitAggregateAndMethod(e.name),r=i[0],n=i[1],this._commandService.commandAggregate(r,e.id,n,e.params,t))},e.prototype.query=function(e,t){var r,n,i;return this._applicationServiceQueries[e.name]?this._applicationServiceQueries[e.name](e.params,t):(i=this._splitAggregateAndMethod(e.name),r=i[0],n=i[1],this.getReadAggregateRepository(r)[n](e.id,e.params,t))},e.prototype._splitAggregateAndMethod=function(e){return e.split(":")},e.prototype.onDomainEvent=function(e,t){return this._domainEventService.on(e,t)},e}(),r.exports=i}),require.register("eventric/bounded_context_service",function(e,t,r){var n;n=function(){function e(){}return e.prototype._boundedContexts={},e.prototype.load=function(e,r){var n;return n=t(r),n.initialize(),this._boundedContexts[e]=n},e.prototype.get=function(e){return this._boundedContexts[e]},e}(),r.exports=new n}),require.register("eventric/command_service",function(e,t,r){var n,i,o,s,a=[].slice;s=t("eventric"),o=s("HelperAsync"),i=s("DomainEventService"),n=function(){function e(e,t){var r,n,i,s;this._domainEventService=e,this._aggregateRepository=t,s=o.queue(function(e){return function(t,r){var n;return(n=t.originalFunction).call.apply(n,[e].concat(a.call(t.arguments),[r]))}}(this),1),i=function(e,t){return function(){var e;return e=arguments[arguments.length-1],delete arguments[arguments.length-1],s.push({originalFunction:t,arguments:arguments},e)}};for(n in this)r=this[n],"function"==typeof r&&"constructor"!==n&&0!==n.indexOf("_")&&(this[n]=i(n,r))}return e.prototype.createAggregate=function(){var e,t,r,n,i,o,s,c,u,l;if(u=2<=arguments.length?a.call(arguments,0,l=arguments.length-1):(l=0,[]),n=arguments[l++],r=u[0],s=u[1],e=this._aggregateRepository.getClass(r),!e)return i=new Error("Tried to create not registered Aggregate '"+r+"'"),void n(i,null);t=new e,t.create();for(o in s)c=s[o],t[o]=c;return this._aggregateRepository.findById(r,t.id,function(e){return function(r,i){return r?n(r,null):i?(r=new Error("Tried to create already existing aggregateId "+t.id),void n(r,null)):e._generateSaveAndTriggerDomainEvent("create",t,n)}}(this))},e.prototype.commandAggregate=function(){var e,t,r,n,i,o,s;return o=2<=arguments.length?a.call(arguments,0,s=arguments.length-1):(s=0,[]),r=arguments[s++],t=o[0],e=o[1],n=o[2],i=o[3],this._aggregateRepository.findById(t,e,function(o){return function(s,c){var u,l;return s?r(s,null):c?n in c?(i instanceof Array||(i=[i]),l=!1,u=function(e){return l=!0,r(e)},c[n].apply(c,a.call(i).concat([u])),l?void 0:o._generateSaveAndTriggerDomainEvent(n,c,r)):(s=new Error("Given commandName '"+n+"' not found as method in the "+t+" Aggregate"),void r(s,null)):(s=new Error("No "+t+" Aggregate with given aggregateId "+e+" found"),void r(s,null))}}(this))},e.prototype._generateSaveAndTriggerDomainEvent=function(e,t,r){var n;return t.generateDomainEvent(e),n=t.getDomainEvents(),this._domainEventService.saveAndTrigger(n,function(){return function(e){return e?r(e,null):(t.clearChanges(),"function"==typeof r?r(null,t.id):void 0)}}(this))},e}(),r.exports=n}),require.register("eventric/domain_event",function(e,t,r){var n;n=function(){function e(e){this.name=e.name,this.timestamp=(new Date).getTime(),this.aggregate=e.aggregate}return e.prototype.getAggregateChanges=function(e){switch(e){case"props":case"entities":case"collections":return this.aggregate.changed[e];default:return this.aggregate.changed}},e.prototype.getAggregateName=function(){return this.aggregate.name},e.prototype.getAggregateId=function(){return this.aggregate.id},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.getName=function(){return this.name},e}(),r.exports=n}),require.register("eventric/domain_event_service",function(e,t,r){var n,i,o,s,a;s=t("eventric"),a=s("HelperUnderscore"),o=s("HelperAsync"),i=s("MixinEvents"),n=function(){function e(e){this._eventStore=e}return a.extend(e.prototype,i),e.prototype.saveAndTrigger=function(e,t){return o.eachSeries(e,function(e){return function(t,r){return e._eventStore.save(t,function(n){var i,o,s;return n?r(n):(s=t.getName(),i=t.getAggregateId(),o=t.getAggregateName(),e.trigger("DomainEvent",t),e.trigger(o,t),e.trigger(""+o+":"+s,t),e.trigger(""+o+"/"+i,t),e.trigger(""+o+":"+s+"/"+i,t),r(null))})}}(this),function(){return function(e){return t(e?e:null)}}(this))},e}(),r.exports=n}),require.register("eventric/index",function(e,t,r){var n;n={AggregateRepository:"./aggregate_repository",ReadAggregateRepository:"./read_aggregate_repository",AggregateRoot:"./aggregate_root",AggregateEntity:"./aggregate_entity",AggregateEntityCollection:"./aggregate_entity_collection",ReadAggregateRoot:"./read_aggregate_root",ReadAggregateEntity:"./read_aggregate_entity",ReadMix:"./read_mix",ReadMixRepository:"./read_mix_repository",CommandService:"./command_service",DomainEventService:"./domain_event_service",RemoteService:"./remote_service",RemoteBoundedContext:"./remote_bounded_context",RemoteCommandService:"./remote_command_service",RemoteRepositoryService:"./remote_repository_service",MixinRegisterAndGetClass:"./mixin_registerandgetclass",MixinSetGet:"./mixin_setget",MixinEvents:"./mixin_events",HelperUnderscore:"./helper/underscore",HelperAsync:"./helper/async",HelperObserve:"./helper/observe",BoundedContext:"./bounded_context",BoundedContextService:"./bounded_context_service",DomainEvent:"./domain_event"},r.exports=function(e){var r,i,o;i=null!=(o=n[e])?o:e;try{return t(i)}catch(s){throw r=s,console.log(r),r}}}),require.register("eventric/mixin_events",function(e,t,r){var n,i,o,s,a,c,u,l,h,p;a=t("eventric"),p=a("HelperUnderscore"),o=[],l=o.slice,n=i={on:function(e,t,r){var n;return c(this,"on",e,[t,r])&&t?(this._events||(this._events={}),n=this._events[e]||(this._events[e]=[]),n.push({callback:t,context:r,ctx:r||this}),this):this},once:function(e,t,r){var n,i;return c(this,"once",e,[t,r])&&t?(i=this,n=p.once(function(){i.off(e,n),t.apply(this,arguments)}),n._callback=t,this.on(e,n,r)):this},off:function(e,t,r){var n,i,o,s,a,u,l,h;if(h=void 0,n=void 0,i=void 0,l=void 0,o=void 0,u=void 0,s=void 0,a=void 0,!this._events||!c(this,"off",e,[t,r]))return this;if(!e&&!t&&!r)return this._events=void 0,this;for(l=e?[e]:p.keys(this._events),o=0,u=l.length;u>o;){if(e=l[o],i=this._events[e]){if(this._events[e]=h=[],t||r)for(s=0,a=i.length;a>s;)n=i[s],(t&&t!==n.callback&&t!==n.callback._callback||r&&r!==n.context)&&h.push(n),s++;h.length||delete this._events[e]}o++}return this},trigger:function(e){var t,r,n;return this._events?(r=l.call(arguments,1),c(this,"trigger",e,r)?(n=this._events[e],t=this._events.all,n&&h(n,r),t&&h(t,arguments),this):this):this},stopListening:function(e,t,r){var n,i,o;if(i=this._listeningTo,!i)return this;o=!t&&!r,r||"object"!=typeof t||(r=this),e&&((i={})[e._listenId]=e);for(n in i)e=i[n],e.off(t,r,this),(o||p.isEmpty(e._events))&&delete this._listeningTo[n];return this}},s=/\s+/,c=function(e,t,r,n){var i,o,a,c;if(!r)return!0;if("object"==typeof r){for(o in r)e[t].apply(e,[o,r[o]].concat(n));return!1}if(s.test(r)){for(c=r.split(s),i=0,a=c.length;a>i;)e[t].apply(e,[c[i]].concat(n)),i++;return!1}return!0},h=function(e,t){var r,n,i,o,s,a;switch(o=void 0,s=-1,a=e.length,r=t[0],n=t[1],i=t[2],t.length){case 0:for(;++s<a;)(o=e[s]).callback.call(o.ctx);break;case 1:for(;++s<a;)(o=e[s]).callback.call(o.ctx,r);break;case 2:for(;++s<a;)(o=e[s]).callback.call(o.ctx,r,n);break;case 3:for(;++s<a;)(o=e[s]).callback.call(o.ctx,r,n,i);break;default:for(;++s<a;)(o=e[s]).callback.apply(o.ctx,t)}},u={listenTo:"on",listenToOnce:"once"},p.each(u,function(e,t){n[t]=function(t,r,n){var i,o;return o=this._listeningTo||(this._listeningTo={}),i=t._listenId||(t._listenId=p.uniqueId("l")),o[i]=t,n||"object"!=typeof r||(n=this),t[e](r,n,this),this}}),n.bind=n.on,n.unbind=n.off,r.exports=i}),require.register("eventric/mixin_registerandgetclass",function(e,t,r){var n;n=function(){function e(){}return e.prototype._classes={},e.prototype.registerClass=function(e,t){return this._classes[e]=t},e.prototype.getClass=function(e){return e in this._classes?this._classes[e]:!1},e}(),r.exports=n}),require.register("eventric/mixin_setget",function(e,t,r){var n,i,o;o=t("eventric"),n=o("AggregateEntityCollection"),i=function(){function e(){}return e.prototype._set=function(e,t){return null==this._props&&(this._props={}),null==this._propsChanged&&(this._propsChanged={}),this._shouldTrackChangePropertiesFor(e,t)&&(this._propsChanged[e]=t),this._props[e]=t},e.prototype._get=function(e){return this._props[e]},e.prototype._shouldTrackChangePropertiesFor=function(e,t){return this._trackPropsChanged&&!(t instanceof n)&&"id"!==e},e}(),r.exports=i}),require.register("eventric/read_aggregate_entity",function(e,t,r){var n,i,o,s,a={}.hasOwnProperty,c=function(e,t){function r(){this.constructor=e}for(var n in t)a.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};s=t("eventric"),n=s("AggregateEntity"),i=s("MixinSetGet"),o=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return c(t,e),t}(n),r.exports=o}),require.register("eventric/read_aggregate_repository",function(e,t,r){var n,i,o,s,a,c=function(e,t){return function(){return e.apply(t,arguments)}},u=[].slice,l=[].indexOf||function(e){for(var t=0,r=this.length;r>t;t++)if(t in this&&this[t]===e)return t;return-1};s=t("eventric"),a=s("HelperUnderscore"),o=s("HelperAsync"),n=s("MixinRegisterAndGetClass"),i=function(){function e(e,t){this._aggregateName=e,this._eventStore=t,this.findIds=c(this.findIds,this),this.findById=c(this.findById,this)}return a.extend(e.prototype,n.prototype),e.prototype.findById=function(){var e,t,r,n,i,o,s;return o=3<=arguments.length?u.call(arguments,0,s=arguments.length-2):(s=0,[]),t=arguments[s++],r=arguments[s++],i=o[0],this._callbackIsAFunction(r)&&(i=this._readAggregateNameNotSet(i,r))?(e=this.getClass(i),e?this._eventStore.find(this._aggregateName,{"aggregate.id":t},function(){return function(n,i){var o,s,a,c,u;if(n)return r(n,null);if(0===i.length)return r(null,[]);for(s=new e,a=0,c=i.length;c>a;a++)o=i[a],(null!=(u=o.aggregate)?u.changed:void 0)&&(s.applyChanges(o.aggregate.changed),s.id=t);return r(null,s)}}(this)):(n=new Error("Tried 'findById' on not registered ReadAggregate '"+i+"'"),r(n,null))):void 0},e.prototype.find=function(){var e,t,r,n,i;return n=3<=arguments.length?u.call(arguments,0,i=arguments.length-2):(i=0,[]),t=arguments[i++],e=arguments[i++],r=n[0],this._callbackIsAFunction(e)&&(r=this._readAggregateNameNotSet(r,e))?this.findIds(r,t,function(t){return function(n,i){var s;return n?e(n,null):(s=[],o.whilst(function(){return i.length>0},function(e){var n;return n=i.shift(),t.findById(r,n,function(t,r){return t?e(t):0===r.length?e(null):(s.push(r),e(null))})},function(t){return t?e(t,null):e(null,s)}))}}(this)):void 0},e.prototype.findOne=function(){var e,t,r,n,i;return n=3<=arguments.length?u.call(arguments,0,i=arguments.length-2):(i=0,[]),t=arguments[i++],e=arguments[i++],r=n[0],this._callbackIsAFunction(e)&&(r=this._readAggregateNameNotSet(r,e))?this.find(r,t,function(){return function(t,r){return t?e(t,null):0===r.length?e(null,!1):e(null,r[0])}}(this)):void 0},e.prototype.findIds=function(e,t,r){return this._callbackIsAFunction(r)?this._eventStore.find(this._aggregateName,t,{"aggregate.id":1},function(){return function(e,t){var n,i,o,s,a;if(e)return r(e,null);for(n=[],o=0,s=t.length;s>o;o++)i=t[o],a=i.aggregate.id,l.call(n,a)<0&&n.push(i.aggregate.id);return r(null,n)}}(this)):void 0},e.prototype._readAggregateNameNotSet=function(e,t){var r;if(!e){if(!this._readAggregateName)return r=new Error("No readAggregateName supplied"),t(r,null),!1;e=this._readAggregateName}return e},e.prototype._callbackIsAFunction=function(e){if("function"==typeof e)return!0;throw new Error("No callback provided")},e}(),r.exports=i}),require.register("eventric/read_aggregate_root",function(e,t,r){var n,i,o,s,a,c={}.hasOwnProperty,u=function(e,t){function r(){this.constructor=e}for(var n in t)c.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};s=t("eventric"),a=s("HelperUnderscore"),i=s("ReadAggregateEntity"),n=s("MixinEvents"),o=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return u(t,e),a.extend(t.prototype,n),t}(i),r.exports=o}),require.register("eventric/read_mix",function(e,t,r){var n,i,o;i=t("eventric"),o=i("HelperUnderscore"),n=function(){function e(){}return e.prototype.loadFromEvents=function(e){var t,r,n,i,o;if(this.domainEventHandlers){for(o=[],r=0,n=e.length;n>r;r++)t=e[r],o.push(this.domainEventHandlers[""+t.aggregate.name+":"+t.name]?this.domainEventHandlers[""+t.aggregate.name+":"+t.name](t,null!=(null!=(i=t.aggregate)?i.changed:void 0)):void 0);return o}},e.prototype.loadFromJSON=function(e){return this._props=e},e.prototype._set=function(e,t){return null==this._props&&(this._props={}),this._props[e]=t},e.prototype._get=function(e){return null==this._props&&(this._props={}),this._props[e]},e.prototype._isset=function(e){return null==this._props&&(this._props={}),e in this._props},e.prototype.toJSON=function(){return null==this._props&&(this._props={}),o.clone(this._props)},e}(),r.exports=n}),require.register("eventric/read_mix_repository",function(e,t,r){var n,i,o,s;o=t("eventric"),s=o("HelperUnderscore"),n=o("MixinRegisterAndGetClass"),i=function(){function e(e){this._eventStore=e}return s.extend(e.prototype,n.prototype),e.prototype.load=function(e,t){var r,n,i;return r=this.getClass(e),r?(i=new r,this._eventStore.findByAggregateName(i.applyDomainEventsFromAggregate,function(){return function(e,r){return e?t(e,null):(i.loadFromEvents(r),t(null,i))}}(this))):(n=new Error("Tried to load not registered ReadMix '"+e+"'"),t(n,null))},e}(),r.exports=i}),require.register("eventric/remote_bounded_context",function(e,t,r){var n,i,o,s;o=t("eventric"),s=o("HelperUnderscore"),n=o("MixinRegisterAndGetClass"),i=function(){function e(e){this._remoteService=e}return s.extend(e.prototype,n.prototype),e.prototype.command=function(e,t,r,n){return this.rpc({"class":"BoundedContext",method:"command",params:{boundedContextName:e,methodName:t,methodParams:r}},n)},e.prototype.query=function(e,t,r,n){return this.rpc({"class":"BoundedContext",method:"query",params:{boundedContextName:e,methodName:t,methodParams:r}},n)},e.prototype.rpc=function(e,t){return this._remoteService.rpc("RemoteBoundedContext",e,t)},e.prototype.handle=function(e,t){var r,n,i;return(r=this.getClass(e.params.boundedContextName))?e.method in r?(i={name:e.params.methodName,params:e.params.methodParams},r[e.method](i,t)):(n=new Error("RPC method "+e.method+" not found on Class "+e.params[0]),t(n,null)):(n=new Error("Tried to handle RPC class with not registered boundedContext "+e.params[0]),t(n,null))},e}(),r.exports=i}),require.register("eventric/remote_command_service",function(e,t,r){var n,i,o,s,a=[].slice;o=t("eventric"),s=o("HelperUnderscore"),n=o("MixinRegisterAndGetClass"),i=function(){function e(e){this._remoteService=e}return s.extend(e.prototype,n.prototype),e.prototype.createAggregate=function(){var e,t,r,n,i,o;return i=2<=arguments.length?a.call(arguments,0,o=arguments.length-1):(o=0,[]),r=arguments[o++],e=i[0],t=i[1],n=[],n.push(e),t&&n.push(t),this.rpc({"class":"CommandService",method:"createAggregate",params:n},r)},e.prototype.commandAggregate=function(){var e,t,r,n,i,o,s;return o=2<=arguments.length?a.call(arguments,0,s=arguments.length-1):(s=0,[]),r=arguments[s++],t=o[0],e=o[1],n=o[2],i=o[3],this.rpc({"class":"CommandService",method:"commandAggregate",params:[t,e,n,i]},r)},e.prototype.rpc=function(e,t){return this._remoteService.rpc("RemoteCommandService",e,t)},e.prototype.handle=function(e,t){var r,n;return r=this.getClass(e["class"]),r?e.method in r?r[e.method].apply(r,a.call(e.params).concat([function(e,r){return e?t(e,null):t(null,r)}])):(n=new Error("RPC method "+e.method+" not found on Class "+e["class"]),t(n,null)):(n=new Error("Tried to handle RPC class with not registered Class "+e["class"]),t(n,null))},e}(),r.exports=i}),require.register("eventric/remote_repository_service",function(e,t,r){var n,i,o,s,a=[].slice;o=t("eventric"),s=o("HelperUnderscore"),n=o("MixinRegisterAndGetClass"),i=function(){function e(e){this._remoteService=e}return s.extend(e.prototype,n.prototype),e.prototype.rpc=function(e,t){return this._remoteService.rpc("RemoteRepositoryService",e,function(e){return function(r,n){var i,o,s,a,c,u,l;if(r)return t(r,null);for(a=[],c=0,u=n.length;u>c;c++){if(s=n[c],i=e.getClass(null!=(l=s.aggregate)?l.name:void 0),!i)return r=new Error("Tried to built not registered Class "+s.aggregate.name+" from RPC Response"),t(r,null);o=new i,null!=s.aggregate.changed&&o.applyChanges(s.aggregate.changed),o.id=s.aggregate.id,a.push(o)}return t(null,a)}}(this))},e.prototype.handle=function(e,t){var r,n;return n=this.getClass(e.repository),n?e.method in n?n[e.method].apply(n,a.call(e.params).concat([function(e,r){var n,i,o,s;for(i=[],o=0,s=r.length;s>o;o++)n=r[o],i.push(n.getSnapshot());return t(null,i)}])):(r=new Error("RPC tried to execute not existing method "+e.method+" on repository "+e.repository),t(r,null)):(r=new Error("Tried to handle RPC with not registered repository "+e.repository),t(r,null))},e}(),r.exports=i}),require.register("eventric/remote_service",function(e,t,r){var n;n=function(){function e(e){this._adapter=e,this._serviceHandlers={}}return e.prototype.rpc=function(e,t,r){var n;return n={service:e,payload:t},this._adapter.rpc(n,r)},e.prototype.handle=function(e,t){var r,n;return n=this.getServiceHandler(e.service),n?"handle"in n?n.handle(e.payload,t):(r=new Error("Service "+e.service+" has no handle method"),t(r,null)):(r=new Error("Tried to handle RPC call with not registered service "+e.service),t(r,null))},e.prototype.registerServiceHandler=function(e,t){return this._serviceHandlers[e]=t},e.prototype.getServiceHandler=function(e){return e in this._serviceHandlers?this._serviceHandlers[e]:!1},e}(),r.exports=n}),require.register("eventric/helper/async",function(e,t,r){!function(){function e(e){var r=!1;return function(){if(r)throw new Error("Callback was already called.");r=!0,e.apply(t,arguments)}}var t,n,i={};t=this,null!=t&&(n=t.async),i.noConflict=function(){return t.async=n,i};var o=Object.prototype.toString,s=Array.isArray||function(e){return"[object Array]"===o.call(e)},a=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r+=1)t(e[r],r,e)};"undefined"!=typeof process&&process.nextTick?(i.nextTick=process.nextTick,i.setImmediate="undefined"!=typeof setImmediate?function(e){setImmediate(e)}:i.nextTick):"function"==typeof setImmediate?(i.nextTick=function(e){setImmediate(e)},i.setImmediate=i.nextTick):(i.nextTick=function(e){setTimeout(e,0)},i.setImmediate=i.nextTick),i.eachSeries=function(e,t,r){if(r=r||function(){},!e.length)return r();var n=0,i=function(){t(e[n],function(t){t?(r(t),r=function(){}):(n+=1,n>=e.length?r():i())})};i()},i.forEachSeries=i.eachSeries,i.iterator=function(e){var t=function(r){var n=function(){return e.length&&e[r].apply(null,arguments),n.next()};return n.next=function(){return r<e.length-1?t(r+1):null},n};return t(0)},i.whilst=function(e,t,r){e()?t(function(n){return n?r(n):void i.whilst(e,t,r)}):r()},i.queue=function(t,r){function n(e,t,r,n){return e.started||(e.started=!0),s(t)||(t=[t]),0==t.length?i.setImmediate(function(){e.drain&&e.drain()}):void a(t,function(t){var o={data:t,callback:"function"==typeof n?n:null};r?e.tasks.unshift(o):e.tasks.push(o),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),i.setImmediate(e.process)})}void 0===r&&(r=1);var o=0,c={tasks:[],concurrency:r,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(e,t){n(c,e,!1,t)},kill:function(){c.drain=null,c.tasks=[]},unshift:function(e,t){n(c,e,!0,t)},process:function(){if(!c.paused&&o<c.concurrency&&c.tasks.length){var r=c.tasks.shift();c.empty&&0===c.tasks.length&&c.empty(),o+=1;var n=function(){o-=1,r.callback&&r.callback.apply(r,arguments),c.drain&&c.tasks.length+o===0&&c.drain(),c.process()},i=e(n);t(r.data,i)}},length:function(){return c.tasks.length},running:function(){return o},idle:function(){return c.tasks.length+o===0},pause:function(){c.paused!==!0&&(c.paused=!0,c.process())},resume:function(){c.paused!==!1&&(c.paused=!1,c.process())}};return c},r.exports=i}()}),require.register("eventric/helper/observe",function(exports,require,module){!function(global){"use strict";function detectObjectObserve(){function e(e){t=e}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var t=[],r={},n=[];return Object.observe(r,e),Array.observe(n,e),r.id=1,r.id=2,delete r.id,n.push(1,2),n.length=0,Object.deliverChangeRecords(e),5!==t.length?!1:"add"!=t[0].type||"update"!=t[1].type||"delete"!=t[2].type||"splice"!=t[3].type||"splice"!=t[4].type?!1:(Object.unobserve(r,e),Array.unobserve(n,e),!0)}function detectEval(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;try{var e=new Function("","return true;");return e()}catch(t){return!1}}function isIndex(e){return+e===e>>>0}function toNumber(e){return+e}function isObject(e){return e===Object(e)}function areSameValue(e,t){return e===t?0!==e||1/e===1/t:numberIsNaN(e)&&numberIsNaN(t)?!0:e!==e&&t!==t}function isPathValid(e){return"string"!=typeof e?!1:(e=e.trim(),""==e?!0:"."==e[0]?!1:pathRegExp.test(e))}function Path(e,t){if(t!==constructorIsPrivate)throw Error("Use Path.get to retrieve path objects");return""==e.trim()?this:isIndex(e)?(this.push(e),this):(e.split(/\s*\.\s*/).filter(function(e){return e}).forEach(function(e){this.push(e)},this),void(hasEval&&this.length&&(this.getValueFrom=this.compiledGetValueFromFn())))}function getPath(e){if(e instanceof Path)return e;null==e&&(e=""),"string"!=typeof e&&(e=String(e));var t=pathCache[e];if(t)return t;if(!isPathValid(e))return invalidPath;var t=new Path(e,constructorIsPrivate);return pathCache[e]=t,t}function dirtyCheck(e){for(var t=0;MAX_DIRTY_CHECK_CYCLES>t&&e.check_();)t++;return global.testingExposeCycleCount&&(global.dirtyCheckCycleCount=t),t>0}function objectIsEmpty(e){for(var t in e)return!1;return!0}function diffIsEmpty(e){return objectIsEmpty(e.added)&&objectIsEmpty(e.removed)&&objectIsEmpty(e.changed)}function diffObjectFromOldObject(e,t){var r={},n={},i={};for(var o in t){var s=e[o];(void 0===s||s!==t[o])&&(o in e?s!==t[o]&&(i[o]=s):n[o]=void 0)}for(var o in e)o in t||(r[o]=e[o]);return Array.isArray(e)&&e.length!==t.length&&(i.length=e.length),{added:r,removed:n,changed:i}}function runEOMTasks(){if(!eomTasks.length)return!1;for(var e=0;e<eomTasks.length;e++)eomTasks[e]();return eomTasks.length=0,!0}function newObservedObject(){function e(e){t&&t.state_===OPENED&&!n&&t.check_(e)}var t,r,n=!1,i=!0;return{open:function(r){if(t)throw Error("ObservedObject in use");i||Object.deliverChangeRecords(e),t=r,i=!1},observe:function(t,n){r=t,n?Array.observe(r,e):Object.observe(r,e)},deliver:function(t){n=t,Object.deliverChangeRecords(e),n=!1 | ||
},close:function(){t=void 0,Object.unobserve(r,e),observedObjectCache.push(this)}}}function getObservedObject(e,t,r){var n=observedObjectCache.pop()||newObservedObject();return n.open(e),n.observe(t,r),n}function newObservedSet(){function e(t,o){t&&(t===n&&(i[o]=!0),a.indexOf(t)<0&&(a.push(t),Object.observe(t,r)),e(Object.getPrototypeOf(t),o))}function t(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.object!==n||i[r.name]||"setPrototype"===r.type)return!1}return!0}function r(r){if(!t(r)){for(var n,i=0;i<s.length;i++)n=s[i],n.state_==OPENED&&n.iterateObjects_(e);for(var i=0;i<s.length;i++)n=s[i],n.state_==OPENED&&n.check_()}}var n,i,o=0,s=[],a=[],c={object:void 0,objects:a,open:function(t,r){n||(n=r,i={}),s.push(t),o++,t.iterateObjects_(e)},close:function(){if(o--,!(o>0)){for(var e=0;e<a.length;e++)Object.unobserve(a[e],r),Observer.unobservedCount++;s.length=0,a.length=0,n=void 0,i=void 0,observedSetCache.push(this)}}};return c}function getObservedSet(e,t){return lastObservedSet&&lastObservedSet.object===t||(lastObservedSet=observedSetCache.pop()||newObservedSet(),lastObservedSet.object=t),lastObservedSet.open(e,t),lastObservedSet}function Observer(){this.state_=UNOPENED,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=nextObserverId++}function addToAll(e){Observer._allObserversCount++,collectObservers&&allObservers.push(e)}function removeFromAll(){Observer._allObserversCount--}function ObjectObserver(e){Observer.call(this),this.value_=e,this.oldObject_=void 0}function ArrayObserver(e){if(!Array.isArray(e))throw Error("Provided object is not an Array");ObjectObserver.call(this,e)}function PathObserver(e,t){Observer.call(this),this.object_=e,this.path_=getPath(t),this.directObserver_=void 0}function CompoundObserver(e){Observer.call(this),this.reportChangesOnOpen_=e,this.value_=[],this.directObserver_=void 0,this.observed_=[]}function identFn(e){return e}function ObserverTransform(e,t,r,n){this.callback_=void 0,this.target_=void 0,this.value_=void 0,this.observable_=e,this.getValueFn_=t||identFn,this.setValueFn_=r||identFn,this.dontPassThroughSet_=n}function notify(e,t,r,n){if(!areSameValue(r,n)&&("function"==typeof e.propertyChanged_&&e.propertyChanged_(t,r,n),hasObserve)){var i=e.notifier_;i||(i=e.notifier_=Object.getNotifier(e)),updateRecord.object=e,updateRecord.name=t,updateRecord.oldValue=n,i.notify(updateRecord)}}function diffObjectFromChangeRecords(e,t,r){for(var n={},i={},o=0;o<t.length;o++){var s=t[o];expectedRecordTypes[s.type]?(s.name in r||(r[s.name]=s.oldValue),"update"!=s.type&&("add"!=s.type?s.name in n?(delete n[s.name],delete r[s.name]):i[s.name]=!0:s.name in i?delete i[s.name]:n[s.name]=!0)):(console.error("Unknown changeRecord type: "+s.type),console.error(s))}for(var a in n)n[a]=e[a];for(var a in i)i[a]=void 0;var c={};for(var a in r)if(!(a in n||a in i)){var u=e[a];r[a]!==u&&(c[a]=u)}return{added:n,removed:i,changed:c}}function newSplice(e,t,r){return{index:e,removed:t,addedCount:r}}function ArraySplice(){}function calcSplices(e,t,r,n,i,o){return arraySplice.calcSplices(e,t,r,n,i,o)}function intersect(e,t,r,n){return r>t||e>n?-1:t==r||n==e?0:r>e?n>t?t-r:n-r:t>n?n-e:t-e}function mergeSplice(e,t,r,n){for(var i=newSplice(t,r,n),o=!1,s=0,a=0;a<e.length;a++){var c=e[a];if(c.index+=s,!o){var u=intersect(i.index,i.index+i.removed.length,c.index,c.index+c.addedCount);if(u>=0){e.splice(a,1),a--,s-=c.addedCount-c.removed.length,i.addedCount+=c.addedCount-u;var l=i.removed.length+c.removed.length-u;if(i.addedCount||l){var r=c.removed;if(i.index<c.index){var h=i.removed.slice(0,c.index-i.index);Array.prototype.push.apply(h,r),r=h}if(i.index+i.removed.length>c.index+c.addedCount){var p=i.removed.slice(c.index+c.addedCount-i.index);Array.prototype.push.apply(r,p)}i.removed=r,c.index<i.index&&(i.index=c.index)}else o=!0}else if(i.index<c.index){o=!0,e.splice(a,0,i),a++;var d=i.addedCount-i.removed.length;c.index+=d,s+=d}}}o||e.push(i)}function createInitialSplices(e,t){for(var r=[],n=0;n<t.length;n++){var i=t[n];switch(i.type){case"splice":mergeSplice(r,i.index,i.removed.slice(),i.addedCount);break;case"add":case"update":case"delete":if(!isIndex(i.name))continue;var o=toNumber(i.name);if(0>o)continue;mergeSplice(r,o,[i.oldValue],1);break;default:console.error("Unexpected record type: "+JSON.stringify(i))}}return r}function projectArraySplices(e,t){var r=[];return createInitialSplices(e,t).forEach(function(t){return 1==t.addedCount&&1==t.removed.length?void(t.removed[0]!==e[t.index]&&r.push(t)):void(r=r.concat(calcSplices(e,t.index,t.index+t.addedCount,t.removed,0,t.removed.length)))}),r}var hasObserve=detectObjectObserve(),hasEval=detectEval(),numberIsNaN=global.Number.isNaN||function(e){return"number"==typeof e&&global.isNaN(e)},createObject="__proto__"in{}?function(e){return e}:function(e){var t=e.__proto__;if(!t)return e;var r=Object.create(t);return Object.getOwnPropertyNames(e).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}),r},identStart="[$_a-zA-Z]",identPart="[$_a-zA-Z0-9]",ident=identStart+"+"+identPart+"*",elementIndex="(?:[0-9]|[1-9]+[0-9]+)",identOrElementIndex="(?:"+ident+"|"+elementIndex+")",path="(?:"+identOrElementIndex+")(?:\\s*\\.\\s*"+identOrElementIndex+")*",pathRegExp=new RegExp("^"+path+"$"),constructorIsPrivate={},pathCache={};Path.get=getPath,Path.prototype=createObject({__proto__:[],valid:!0,toString:function(){return this.join(".")},getValueFrom:function(e){for(var t=0;t<this.length;t++){if(null==e)return;e=e[this[t]]}return e},iterateObjects:function(e,t){for(var r=0;r<this.length;r++){if(r&&(e=e[this[r-1]]),!isObject(e))return;t(e,this[0])}},compiledGetValueFromFn:function(){var e=this.map(function(e){return isIndex(e)?'["'+e+'"]':"."+e}),t="",r="obj";t+="if (obj != null";for(var n=0;n<this.length-1;n++){{this[n]}r+=e[n],t+=" &&\n "+r+" != null"}return t+=")\n",r+=e[n],t+=" return "+r+";\nelse\n return undefined;",new Function("obj",t)},setValueFrom:function(e,t){if(!this.length)return!1;for(var r=0;r<this.length-1;r++){if(!isObject(e))return!1;e=e[this[r]]}return isObject(e)?(e[this[r]]=t,!0):!1}});var invalidPath=new Path("",constructorIsPrivate);invalidPath.valid=!1,invalidPath.getValueFrom=invalidPath.setValueFrom=function(){};var MAX_DIRTY_CHECK_CYCLES=1e3,eomTasks=[],runEOM=hasObserve?function(){var e={pingPong:!0},t=!1;return Object.observe(e,function(){runEOMTasks(),t=!1}),function(r){eomTasks.push(r),t||(t=!0,e.pingPong=!e.pingPong)}}():function(){return function(e){eomTasks.push(e)}}(),observedObjectCache=[],observedSetCache=[],lastObservedSet,UNOPENED=0,OPENED=1,CLOSED=2,RESETTING=3,nextObserverId=1;Observer.prototype={open:function(e,t){if(this.state_!=UNOPENED)throw Error("Observer has already been opened.");return addToAll(this),this.callback_=e,this.target_=t,this.connect_(),this.state_=OPENED,this.value_},close:function(){this.state_==OPENED&&(removeFromAll(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=CLOSED)},deliver:function(){this.state_==OPENED&&dirtyCheck(this)},report_:function(e){try{this.callback_.apply(this.target_,e)}catch(t){Observer._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(t.stack||t))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var collectObservers=!hasObserve,allObservers;Observer._allObserversCount=0,collectObservers&&(allObservers=[]);var runningMicrotaskCheckpoint=!1,hasDebugForceFullDelivery=hasObserve&&function(){try{return eval("%RunMicrotasks()"),!0}catch(ex){return!1}}();global.Platform=global.Platform||{},global.Platform.performMicrotaskCheckpoint=function(){if(!runningMicrotaskCheckpoint){if(hasDebugForceFullDelivery)return void eval("%RunMicrotasks()");if(collectObservers){runningMicrotaskCheckpoint=!0;var cycles=0,anyChanged,toCheck;do{cycles++,toCheck=allObservers,allObservers=[],anyChanged=!1;for(var i=0;i<toCheck.length;i++){var observer=toCheck[i];observer.state_==OPENED&&(observer.check_()&&(anyChanged=!0),allObservers.push(observer))}runEOMTasks()&&(anyChanged=!0)}while(MAX_DIRTY_CHECK_CYCLES>cycles&&anyChanged);global.testingExposeCycleCount&&(global.dirtyCheckCycleCount=cycles),runningMicrotaskCheckpoint=!1}}},collectObservers&&(global.Platform.clearObservers=function(){allObservers=[]}),ObjectObserver.prototype=createObject({__proto__:Observer.prototype,arrayObserve:!1,connect_:function(){hasObserve?this.directObserver_=getObservedObject(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(e){var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=e[r];return Array.isArray(e)&&(t.length=e.length),t},check_:function(e){var t,r;if(hasObserve){if(!e)return!1;r={},t=diffObjectFromChangeRecords(this.value_,e,r)}else r=this.oldObject_,t=diffObjectFromOldObject(this.value_,this.oldObject_);return diffIsEmpty(t)?!1:(hasObserve||(this.oldObject_=this.copyObject(this.value_)),this.report_([t.added||{},t.removed||{},t.changed||{},function(e){return r[e]}]),!0)},disconnect_:function(){hasObserve?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==OPENED&&(hasObserve?this.directObserver_.deliver(!1):dirtyCheck(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}}),ArrayObserver.prototype=createObject({__proto__:ObjectObserver.prototype,arrayObserve:!0,copyObject:function(e){return e.slice()},check_:function(e){var t;if(hasObserve){if(!e)return!1;t=projectArraySplices(this.value_,e)}else t=calcSplices(this.value_,0,this.value_.length,this.oldObject_,0,this.oldObject_.length);return t&&t.length?(hasObserve||(this.oldObject_=this.copyObject(this.value_)),this.report_([t]),!0):!1}}),ArrayObserver.applySplices=function(e,t,r){r.forEach(function(r){for(var n=[r.index,r.removed.length],i=r.index;i<r.index+r.addedCount;)n.push(t[i]),i++;Array.prototype.splice.apply(e,n)})},PathObserver.prototype=createObject({__proto__:Observer.prototype,connect_:function(){hasObserve&&(this.directObserver_=getObservedSet(this,this.object_)),this.check_(void 0,!0)},disconnect_:function(){this.value_=void 0,this.directObserver_&&(this.directObserver_.close(this),this.directObserver_=void 0)},iterateObjects_:function(e){this.path_.iterateObjects(this.object_,e)},check_:function(e,t){var r=this.value_;return this.value_=this.path_.getValueFrom(this.object_),t||areSameValue(this.value_,r)?!1:(this.report_([this.value_,r]),!0)},setValue:function(e){this.path_&&this.path_.setValueFrom(this.object_,e)}});var observerSentinel={};CompoundObserver.prototype=createObject({__proto__:Observer.prototype,connect_:function(){if(hasObserve){for(var e,t=!1,r=0;r<this.observed_.length;r+=2)if(e=this.observed_[r],e!==observerSentinel){t=!0;break}t&&(this.directObserver_=getObservedSet(this,e))}this.check_(void 0,!this.reportChangesOnOpen_)},disconnect_:function(){for(var e=0;e<this.observed_.length;e+=2)this.observed_[e]===observerSentinel&&this.observed_[e+1].close();this.observed_.length=0,this.value_.length=0,this.directObserver_&&(this.directObserver_.close(this),this.directObserver_=void 0)},addPath:function(e,t){if(this.state_!=UNOPENED&&this.state_!=RESETTING)throw Error("Cannot add paths once started.");var t=getPath(t);if(this.observed_.push(e,t),this.reportChangesOnOpen_){var r=this.observed_.length/2-1;this.value_[r]=t.getValueFrom(e)}},addObserver:function(e){if(this.state_!=UNOPENED&&this.state_!=RESETTING)throw Error("Cannot add observers once started.");if(this.observed_.push(observerSentinel,e),this.reportChangesOnOpen_){var t=this.observed_.length/2-1;this.value_[t]=e.open(this.deliver,this)}},startReset:function(){if(this.state_!=OPENED)throw Error("Can only reset while open");this.state_=RESETTING,this.disconnect_()},finishReset:function(){if(this.state_!=RESETTING)throw Error("Can only finishReset after startReset");return this.state_=OPENED,this.connect_(),this.value_},iterateObjects_:function(e){for(var t,r=0;r<this.observed_.length;r+=2)t=this.observed_[r],t!==observerSentinel&&this.observed_[r+1].iterateObjects(t,e)},check_:function(e,t){for(var r,n=0;n<this.observed_.length;n+=2){var i,o=this.observed_[n],s=this.observed_[n+1];if(o===observerSentinel){var a=s;i=this.state_===UNOPENED?a.open(this.deliver,this):a.discardChanges()}else i=s.getValueFrom(o);t?this.value_[n/2]=i:areSameValue(i,this.value_[n/2])||(r=r||[],r[n/2]=this.value_[n/2],this.value_[n/2]=i)}return r?(this.report_([this.value_,r,this.observed_]),!0):!1}}),ObserverTransform.prototype={open:function(e,t){return this.callback_=e,this.target_=t,this.value_=this.getValueFn_(this.observable_.open(this.observedCallback_,this)),this.value_},observedCallback_:function(e){if(e=this.getValueFn_(e),!areSameValue(e,this.value_)){var t=this.value_;this.value_=e,this.callback_.call(this.target_,this.value_,t)}},discardChanges:function(){return this.value_=this.getValueFn_(this.observable_.discardChanges()),this.value_},deliver:function(){return this.observable_.deliver()},setValue:function(e){return e=this.setValueFn_(e),!this.dontPassThroughSet_&&this.observable_.setValue?this.observable_.setValue(e):void 0},close:function(){this.observable_&&this.observable_.close(),this.callback_=void 0,this.target_=void 0,this.observable_=void 0,this.value_=void 0,this.getValueFn_=void 0,this.setValueFn_=void 0}};var expectedRecordTypes={add:!0,update:!0,"delete":!0},updateRecord={object:void 0,type:"update",name:void 0,oldValue:void 0};Observer.createBindablePrototypeAccessor=function(e,t){var r=t+"_",n=t+"Observable_";e[r]=e[t],Object.defineProperty(e,t,{get:function(){var e=this[n];return e&&e.deliver(),this[r]},set:function(e){var i=this[n];if(i)return void i.setValue(e);var o=this[r];return this[r]=e,notify(this,t,e,o),e},configurable:!0})},Observer.bindToInstance=function(e,t,r,n){var i=t+"_",o=t+"Observable_";e[o]=r;var s=e[i],a=r.open(function(r,n){e[i]=r,notify(e,t,r,n)});if(n&&!areSameValue(s,a)){var c=n(s,a);areSameValue(a,c)||(a=c,r.setValue&&r.setValue(a))}return e[i]=a,notify(e,t,a,s),{close:function(){r.close(),e[o]=void 0}}};var EDIT_LEAVE=0,EDIT_UPDATE=1,EDIT_ADD=2,EDIT_DELETE=3;ArraySplice.prototype={calcEditDistances:function(e,t,r,n,i,o){for(var s=o-i+1,a=r-t+1,c=new Array(s),u=0;s>u;u++)c[u]=new Array(a),c[u][0]=u;for(var l=0;a>l;l++)c[0][l]=l;for(var u=1;s>u;u++)for(var l=1;a>l;l++)if(this.equals(e[t+l-1],n[i+u-1]))c[u][l]=c[u-1][l-1];else{var h=c[u-1][l]+1,p=c[u][l-1]+1;c[u][l]=p>h?h:p}return c},spliceOperationsFromEditDistances:function(e){for(var t=e.length-1,r=e[0].length-1,n=e[t][r],i=[];t>0||r>0;)if(0!=t)if(0!=r){var o,s=e[t-1][r-1],a=e[t-1][r],c=e[t][r-1];o=c>a?s>a?a:s:s>c?c:s,o==s?(s==n?i.push(EDIT_LEAVE):(i.push(EDIT_UPDATE),n=s),t--,r--):o==a?(i.push(EDIT_DELETE),t--,n=a):(i.push(EDIT_ADD),r--,n=c)}else i.push(EDIT_DELETE),t--;else i.push(EDIT_ADD),r--;return i.reverse(),i},calcSplices:function(e,t,r,n,i,o){var s=0,a=0,c=Math.min(r-t,o-i);if(0==t&&0==i&&(s=this.sharedPrefix(e,n,c)),r==e.length&&o==n.length&&(a=this.sharedSuffix(e,n,c-s)),t+=s,i+=s,r-=a,o-=a,r-t==0&&o-i==0)return[];if(t==r){for(var u=newSplice(t,[],0);o>i;)u.removed.push(n[i++]);return[u]}if(i==o)return[newSplice(t,[],r-t)];for(var l=this.spliceOperationsFromEditDistances(this.calcEditDistances(e,t,r,n,i,o)),u=void 0,h=[],p=t,d=i,g=0;g<l.length;g++)switch(l[g]){case EDIT_LEAVE:u&&(h.push(u),u=void 0),p++,d++;break;case EDIT_UPDATE:u||(u=newSplice(p,[],0)),u.addedCount++,p++,u.removed.push(n[d]),d++;break;case EDIT_ADD:u||(u=newSplice(p,[],0)),u.addedCount++,p++;break;case EDIT_DELETE:u||(u=newSplice(p,[],0)),u.removed.push(n[d]),d++}return u&&h.push(u),h},sharedPrefix:function(e,t,r){for(var n=0;r>n;n++)if(!this.equals(e[n],t[n]))return n;return r},sharedSuffix:function(e,t,r){for(var n=e.length,i=t.length,o=0;r>o&&this.equals(e[--n],t[--i]);)o++;return o},calculateSplices:function(e,t){return this.calcSplices(e,0,e.length,t,0,t.length)},equals:function(e,t){return e===t}};var arraySplice=new ArraySplice;global.Observer=Observer,global.Observer.runEOM_=runEOM,global.Observer.observerSentinel_=observerSentinel,global.Observer.hasObjectObserve=hasObserve,global.ArrayObserver=ArrayObserver,global.ArrayObserver.calculateSplices=function(e,t){return arraySplice.calculateSplices(e,t)},global.ArraySplice=ArraySplice,global.ObjectObserver=ObjectObserver,global.PathObserver=PathObserver,global.CompoundObserver=CompoundObserver,global.Path=Path,global.ObserverTransform=ObserverTransform}("undefined"!=typeof global&&global&&"undefined"!=typeof module&&module?global:this||window)}),require.register("eventric/helper/underscore",function(e,t,r){(function(){var t=this,n=t._,i={},o=Array.prototype,s=Object.prototype,a=Function.prototype,c=o.push,u=o.slice,l=(o.concat,s.toString),h=s.hasOwnProperty,p=Array.isArray,d=Object.keys,g=(a.bind,function(e){return e instanceof g?e:this instanceof g?void(this._wrapped=e):new g(e)});"undefined"!=typeof e?("undefined"!=typeof r&&r.exports&&(e=r.exports=g),e._=g):t._=g,g.VERSION="1.6.0",g.each=g.forEach=function(e,t,r){if(null==e)return e;if(e.length===+e.length){for(var n=0,o=e.length;o>n;n++)if(t.call(r,e[n],n,e)===i)return}else for(var s=g.keys(e),n=0,o=s.length;o>n;n++)if(t.call(r,e[s[n]],s[n],e)===i)return;return e},g.keys=function(e){if(!g.isObject(e))return[];if(d)return d(e);var t=[];for(var r in e)g.has(e,r)&&t.push(r);return t},g.invert=function(e){for(var t={},r=g.keys(e),n=0,i=r.length;i>n;n++)t[e[r[n]]]=r[n];return t},g.functions=g.methods=function(e){var t=[];for(var r in e)g.isFunction(e[r])&&t.push(r);return t.sort()},g.extend=function(e){return g.isObject(e)?(g.each(u.call(arguments,1),function(t){for(var r in t)e[r]=t[r]}),e):e},g.defaults=function(e){return g.isObject(e)?(g.each(u.call(arguments,1),function(t){for(var r in t)void 0===e[r]&&(e[r]=t[r])}),e):e},g.isEqual=function(e,t){return eq(e,t,[],[])},g.isEmpty=function(e){if(null==e)return!0;if(g.isArray(e)||g.isString(e)||g.isArguments(e))return 0===e.length;for(var t in e)if(g.has(e,t))return!1;return!0},g.isElement=function(e){return!(!e||1!==e.nodeType)},g.isArray=p||function(e){return"[object Array]"==l.call(e)},g.isObject=function(e){return e===Object(e)},g.each(["Arguments","Function","String","Number","Date","RegExp"],function(e){g["is"+e]=function(t){return l.call(t)=="[object "+e+"]"}}),g.isArguments(arguments)||(g.isArguments=function(e){return g.has(e,"callee")}),"function"!=typeof/./&&(g.isFunction=function(e){return"function"==typeof e}),g.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},g.isNaN=function(e){return g.isNumber(e)&&e!=+e},g.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==l.call(e)},g.isNull=function(e){return null===e},g.isUndefined=function(e){return void 0===e},g.has=function(e,t){return null!=e&&h.call(e,t)},g.noConflict=function(){return t._=n,this},g.identity=function(e){return e},g.constant=function(e){return function(){return e}},g.noop=function(){},g.property=function(e){return function(t){return t[e]}},g.matches=function(e){return function(t){if(null==t)return g.isEmpty(e);if(t===e)return!0;for(var r in e)if(e[r]!==t[r])return!1;return!0}},g.times=function(e,t,r){for(var n=Array(Math.max(0,e)),i=0;e>i;i++)n[i]=t.call(r,i);return n},g.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},g.now=Date.now||function(){return(new Date).getTime()};var v={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};v.unescape=g.invert(v.escape);var f={escape:new RegExp("["+g.keys(v.escape).join("")+"]","g"),unescape:new RegExp("("+g.keys(v.unescape).join("|")+")","g")};g.each(["escape","unescape"],function(e){g[e]=function(t){return null==t?"":(""+t).replace(f[e],function(t){return v[e][t]})}}),g.result=function(e,t){if(null==e)return void 0;var r=e[t];return g.isFunction(r)?e[t]():r},g.mixin=function(e){g.each(g.functions(e),function(t){var r=g[t]=e[t];g.prototype[t]=function(){var e=[this._wrapped];return c.apply(e,arguments),m.call(this,r.apply(g,e))}})};var _=0;g.uniqueId=function(e){var t=++_+"";return e?e+t:t},g.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};g.chain=function(e){return g(e).chain()};var m=function(e){return this._chain?g(e).chain():e};g.mixin(g),g.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=o[e];g.prototype[e]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=e&&"splice"!=e||0!==r.length||delete r[0],m.call(this,r)}}),g.each(["concat","join","slice"],function(e){var t=o[e];g.prototype[e]=function(){return m.call(this,t.apply(this._wrapped,arguments))}}),g.extend(g.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)}); | ||
require.register("eventric/aggregate_entity",function(e,t,r){var n,i,o,s,a;s=t("eventric"),a=s("HelperUnderscore"),o=s("MixinSetGet"),n=s("AggregateEntity"),i=s("AggregateEntityCollection"),s("HelperObserve"),n=function(){function e(e){var t,r,n;this._props=null!=e?e:{},n=this._props;for(t in n)r=n[t],Object.defineProperty(this,t,{get:function(){return this._props[t]},set:function(e){return this._set(t,e)}});this._isNew=!1,this._propsChanged={},this._domainEvents=[],this._entityClasses={},this._trackPropsChanged=!0,this._observerOpen()}return a.extend(e.prototype,o.prototype),e.prototype.create=function(){return this.id=this._generateUid(),this._isNew=!0,this._observerDiscard()},e.prototype._observerOpen=function(){return this._observer=new ObjectObserver(this),this._observer.open(function(e){return function(t,r,n){return Object.keys(t).forEach(function(r){return e._set(r,t[r])}),Object.keys(n).forEach(function(t){return e._set(t,n[t])})}}(this))},e.prototype._observerDiscard=function(){return this._observer.discardChanges()},e.prototype._observerClose=function(){return this._observer.close()},e.prototype._generateUid=function(e){var t,r;return t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)},r=e||"-",t()+t()+r+t()+r+t()+r+t()+r+t()+t()+t()},e.prototype.getMetaData=function(){return{id:this.id,name:this.constructor.name}},e.prototype.getChanges=function(){var e;return this._observer.deliver(),e={props:this._changesOnProperties(),entities:{},collections:this._changesOnCollections()},this._changesAreNotEmpty(e)?e:{}},e.prototype._changesOnProperties=function(){var e;return e={},Object.keys(this._propsChanged).length>0&&(e=this._propsChanged),e},e.prototype._changesOnCollections=function(){var e,t,r,n,o;e={},o=this._props;for(r in o)n=o[r],n instanceof i&&(t=this._changesOnCollection(r,n),t.length>0&&(e[r]=t));return e},e.prototype._changesOnCollection=function(e,t){var r,n,i,o,s,a,c;for(r=[],c=t.entities,s=0,a=c.length;a>s;s++)n=c[s],o=n.getChanges(),i=this._changesAreNotEmpty(o),(i||n._isNew)&&(n=n.getMetaData(),i&&(n.changed=o),r.push(n));return r},e.prototype._changesAreNotEmpty=function(e){var t,r;for(t in e)if(r=e[t],Object.keys(r).length>0)return!0;return!1},e.prototype.clearChanges=function(){var e,t,r;this._observerClose(),this._propsChanged={},r=this._props;for(e in r)t=r[e],t instanceof i&&this._clearCollectionChanges(t);return this._observerOpen()},e.prototype._clearCollectionChanges=function(e){var t,r,n,i,o;for(i=e.entities,o=[],r=0,n=i.length;n>r;r++)t=i[r],o.push(t.clearChanges());return o},e.prototype.applyChanges=function(e,t){var r;return null==t&&(t={}),this._observerClose(),r=this._trackPropsChanged,this._trackPropsChanged=!1,this._applyChangesToProps(e.props),this._applyChangesToCollections(e.collections),this._trackPropsChanged=r,this._observerOpen()},e.prototype._applyChangesToProps=function(e){var t,r,n;n=[];for(t in e)r=e[t],n.push(this[t]=r);return n},e.prototype._applyChangesToCollections=function(e){var t,r,n;n=[];for(r in e)t=e[r],this[r]||(this[r]=new i),n.push(this._applyChangesToCollection(r,t));return n},e.prototype._applyChangesToCollection=function(t,r){var n,i,o,s,a,c,u;for(u=[],s=0,a=r.length;a>s;s++)i=r[s],o=null!=(c=this[t])?c.get(i.id):void 0,o||(o=(n=this.getEntityClass(i.name))?new n:new e,o.id=i.id,this[t].add(o)),u.push(i.changed?o.applyChanges(i.changed):void 0);return u},e.prototype.getEntityClass=function(e){var t,r;return t=null!=(r=this._entityClasses[e])?r:!1},e.prototype.registerEntityClass=function(e,t){return this._entityClasses[e]=t},e}(),r.exports=n}),require.register("eventric/aggregate_entity_collection",function(e,t,r){var n,i,o;i=t("eventric"),o=i("HelperUnderscore"),Function.prototype.prop=function(e,t){return null==t&&(t={}),Object.defineProperty(this.prototype,e,o.defaults(t,{get:function(){return this["_"+e]},set:function(t){return this["_"+e]=t}}))},n=function(){function e(e){null==e&&(e={}),this._entities=[],e.entities&&this.add(e.entities)}return e.prototype.add=function(e){return e instanceof Array?this._entities=this._entities.concat(e):this._entities.push(e),this},e.prototype.remove=function(e){var t,r,n,i,o;for(o=this._entities,r=n=0,i=o.length;i>n;r=++n)if(t=o[r],t===e){this._entities=this._entities.slice(r+1);break}return this},e.prototype.get=function(e){var t,r,n,i;for(i=this._entities,r=0,n=i.length;n>r;r++)if(t=i[r],e===t.id)return t},e.prop("entities",{set:function(){throw"Don't set entities directly"},get:function(){return this._entities}}),e.prop("length",{set:function(){throw"Don't set length directly"},get:function(){return this._entities.length}}),e}(),r.exports=n}),require.register("eventric/aggregate_repository",function(e,t,r){var n,i,o,s;o=t("eventric"),s=o("HelperUnderscore"),i=o("MixinRegisterAndGetClass"),n=function(){function e(e){this._eventStore=e}return s.extend(e.prototype,i.prototype),e.prototype.findById=function(e,t,r){return this._eventStore.find(e,{"aggregate.id":t},function(n){return function(i,o){var s,a,c,u,l;if(i)return r(i,null);if(0===o.length)return r(null,null);if(s=n.getClass(e),!s)return i=new Error("Tried to command not registered Aggregate '"+e+"'"),void r(i,null);for(a=new s,a.id=t,u=0,l=o.length;l>u;u++)c=o[u],c.aggregate.changed&&a.applyChanges(c.aggregate.changed);return r(null,a)}}(this))},e}(),r.exports=n}),require.register("eventric/aggregate_root",function(e,t,r){var n,i,o,s,a,c,u,l={}.hasOwnProperty,h=function(e,t){function r(){this.constructor=e}for(var n in t)l.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};c=t("eventric"),u=c("HelperUnderscore"),n=c("AggregateEntity"),i=c("AggregateEntityCollection"),a=c("MixinSetGet"),s=c("DomainEvent"),o=function(e){function t(){this._domainEvents=[],t.__super__.constructor.apply(this,arguments)}return h(t,e),t.prototype.generateDomainEvent=function(e,t){var r,n,i;return null==t&&(t={}),t.includeAggregateChanges!==!1&&(t.includeAggregateChanges=!0),i={name:e,aggregate:this.getMetaData()},t.includeAggregateChanges&&(r=this.getChanges(),Object.keys(r).length>0&&(i.aggregate.changed=r)),n=new s(i),this._domainEvents.push(n)},t.prototype.getDomainEvents=function(){return this._domainEvents},t.prototype.getSnapshot=function(){var e,t;return t={name:"_snapshot",aggregate:this.getMetaData()},t.aggregate.changed=this.getChanges(),e=new s(t)},t.prototype.registerEntityCollection=function(e,t,r){return this[e]=new i,this.registerEntityClass(t,r)},t.prototype.addEntityToCollection=function(e,t){return this[t].add(e)},t}(n),r.exports=o}),require.register("eventric/bounded_context",function(e,t,r){var n,i,o,s,a;a=t("eventric"),n=a("AggregateRepository"),o=a("CommandService"),s=a("DomainEventService"),i=function(){function e(){}return e.prototype.aggregates={},e.prototype.readAggregateRepositories={},e.prototype._readAggregateRepositoriesInstances={},e.prototype.applicationServices=[],e.prototype._applicationServiceCommands={},e.prototype._applicationServiceQueries={},e.prototype.initialize=function(e){return this._initializeEventStore(e,function(e){return function(){return e._aggregateRepository=new n(e._eventStore),e._domainEventService=new s(e._eventStore),e._commandService=new o(e._domainEventService,e._aggregateRepository),e._initializeAggregates(),e._initializeReadAggregateRepositories(),e._initializeApplicationServices()}}(this))},e.prototype._initializeEventStore=function(e,r){var n;return e?(this._eventStore=e,r()):(n=t("eventric-store-mongodb"),this._eventStore=new n,this._eventStore.initialize(function(){return function(){return r()}}(this)))},e.prototype._initializeAggregates=function(){var e,t,r,n;r=this.aggregates,n=[];for(t in r)e=r[t],n.push(this._aggregateRepository.registerClass(t,e));return n},e.prototype._initializeReadAggregateRepositories=function(){var e,t,r,n;r=this.readAggregateRepositories,n=[];for(t in r)e=r[t],n.push(this._readAggregateRepositoriesInstances[t]=new e(t,this._eventStore));return n},e.prototype._initializeApplicationServices=function(){var e,t,r,n,i,o,s,a,c,u,l,h,p;for(u=this.applicationServices,p=[],a=0,c=u.length;c>a;a++){e=u[a],e.commandService=this._commandService,e.getReadAggregateRepository=function(e){return function(){return e.getReadAggregateRepository.apply(e,arguments)}}(this),e.onDomainEvent=function(e){return function(){return e.onDomainEvent.apply(e,arguments)}}(this),l=e.commands,o=function(e){return function(t,r,n){return e._applicationServiceCommands[t]=function(){return n[r].apply(n,arguments)}}}(this);for(r in l)t=l[r],o(r,t,e);h=e.queries,s=function(e){return function(t,r,n){return e._applicationServiceQueries[t]=function(){return n[r].apply(n,arguments)}}}(this);for(i in h)n=h[i],s(i,n,e);p.push("function"==typeof e.initialize?e.initialize():void 0)}return p},e.prototype.getReadAggregateRepository=function(e){return this._readAggregateRepositoriesInstances[e]},e.prototype.command=function(e,t){var r,n,i;return this._applicationServiceCommands[e.name]?this._applicationServiceCommands[e.name](e.params,t):(i=this._splitAggregateAndMethod(e.name),r=i[0],n=i[1],this._commandService.commandAggregate(r,e.id,n,e.params,t))},e.prototype.query=function(e,t){var r,n,i;return this._applicationServiceQueries[e.name]?this._applicationServiceQueries[e.name](e.params,t):(i=this._splitAggregateAndMethod(e.name),r=i[0],n=i[1],this.getReadAggregateRepository(r)[n](e.id,e.params,t))},e.prototype._splitAggregateAndMethod=function(e){return e.split(":")},e.prototype.onDomainEvent=function(e,t){return this._domainEventService.on(e,t)},e}(),r.exports=i}),require.register("eventric/bounded_context_service",function(e,t,r){var n;n=function(){function e(){}return e.prototype._boundedContexts={},e.prototype.load=function(e,r){var n;return n=t(r),n.initialize(),this._boundedContexts[e]=n},e.prototype.get=function(e){return this._boundedContexts[e]},e}(),r.exports=new n}),require.register("eventric/command_service",function(e,t,r){var n,i,o,s,a=[].slice;s=t("eventric"),o=s("HelperAsync"),i=s("DomainEventService"),n=function(){function e(e,t){var r,n,i,s;this._domainEventService=e,this._aggregateRepository=t,s=o.queue(function(e){return function(t,r){var n;return(n=t.originalFunction).call.apply(n,[e].concat(a.call(t.arguments),[r]))}}(this),1),i=function(e,t){return function(){var e;return e=arguments[arguments.length-1],delete arguments[arguments.length-1],s.push({originalFunction:t,arguments:arguments},e)}};for(n in this)r=this[n],"function"==typeof r&&"constructor"!==n&&0!==n.indexOf("_")&&(this[n]=i(n,r))}return e.prototype.createAggregate=function(){var e,t,r,n,i,o,s,c,u,l;if(u=2<=arguments.length?a.call(arguments,0,l=arguments.length-1):(l=0,[]),n=arguments[l++],r=u[0],s=u[1],e=this._aggregateRepository.getClass(r),!e)return i=new Error("Tried to create not registered Aggregate '"+r+"'"),void n(i,null);t=new e,t.create();for(o in s)c=s[o],t[o]=c;return this._aggregateRepository.findById(r,t.id,function(e){return function(r,i){return r?n(r,null):i?(r=new Error("Tried to create already existing aggregateId "+t.id),void n(r,null)):e._generateSaveAndTriggerDomainEvent("create",t,n)}}(this))},e.prototype.commandAggregate=function(){var e,t,r,n,i,o,s;return o=2<=arguments.length?a.call(arguments,0,s=arguments.length-1):(s=0,[]),r=arguments[s++],t=o[0],e=o[1],n=o[2],i=o[3],this._aggregateRepository.findById(t,e,function(o){return function(s,c){var u,l;return s?r(s,null):c?n in c?(i instanceof Array||(i=[i]),l=!1,u=function(e){return l=!0,r(e)},c[n].apply(c,a.call(i).concat([u])),l?void 0:o._generateSaveAndTriggerDomainEvent(n,c,r)):(s=new Error("Given commandName '"+n+"' not found as method in the "+t+" Aggregate"),void r(s,null)):(s=new Error("No "+t+" Aggregate with given aggregateId "+e+" found"),void r(s,null))}}(this))},e.prototype._generateSaveAndTriggerDomainEvent=function(e,t,r){var n;return t.generateDomainEvent(e),n=t.getDomainEvents(),this._domainEventService.saveAndTrigger(n,function(){return function(e){return e?r(e,null):(t.clearChanges(),"function"==typeof r?r(null,t.id):void 0)}}(this))},e}(),r.exports=n}),require.register("eventric/domain_event",function(e,t,r){var n;n=function(){function e(e){this.name=e.name,this.timestamp=(new Date).getTime(),this.aggregate=e.aggregate}return e.prototype.getAggregateChanges=function(e){switch(e){case"props":case"entities":case"collections":return this.aggregate.changed[e];default:return this.aggregate.changed}},e.prototype.getAggregateName=function(){return this.aggregate.name},e.prototype.getAggregateId=function(){return this.aggregate.id},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.getName=function(){return this.name},e}(),r.exports=n}),require.register("eventric/domain_event_service",function(e,t,r){var n,i,o,s,a;s=t("eventric"),a=s("HelperUnderscore"),o=s("HelperAsync"),i=s("MixinEvents"),n=function(){function e(e){this._eventStore=e}return a.extend(e.prototype,i),e.prototype.saveAndTrigger=function(e,t){return o.eachSeries(e,function(e){return function(t,r){return e._eventStore.save(t,function(n){var i,o,s;return n?r(n):(s=t.getName(),i=t.getAggregateId(),o=t.getAggregateName(),e.trigger("DomainEvent",t),e.trigger(o,t),e.trigger(""+o+":"+s,t),e.trigger(""+o+"/"+i,t),e.trigger(""+o+":"+s+"/"+i,t),r(null))})}}(this),function(){return function(e){return t(e?e:null)}}(this))},e}(),r.exports=n}),require.register("eventric/index",function(e,t,r){var n;n={AggregateRepository:"./aggregate_repository",ReadAggregateRepository:"./read_aggregate_repository",AggregateRoot:"./aggregate_root",AggregateEntity:"./aggregate_entity",AggregateEntityCollection:"./aggregate_entity_collection",ReadAggregateRoot:"./read_aggregate_root",ReadAggregateEntity:"./read_aggregate_entity",ReadMix:"./read_mix",ReadMixRepository:"./read_mix_repository",CommandService:"./command_service",DomainEventService:"./domain_event_service",RemoteService:"./remote_service",RemoteBoundedContext:"./remote_bounded_context",RemoteCommandService:"./remote_command_service",RemoteRepositoryService:"./remote_repository_service",MixinRegisterAndGetClass:"./mixin_registerandgetclass",MixinSetGet:"./mixin_setget",MixinEvents:"./mixin_events",HelperUnderscore:"./helper/underscore",HelperAsync:"./helper/async",HelperObserve:"./helper/observe",BoundedContext:"./bounded_context",BoundedContextService:"./bounded_context_service",DomainEvent:"./domain_event"},r.exports=function(e){var r,i,o;i=null!=(o=n[e])?o:e;try{return t(i)}catch(s){throw r=s,console.log(r),r}}}),require.register("eventric/mixin_events",function(e,t,r){var n,i,o,s,a,c,u,l,h,p;a=t("eventric"),p=a("HelperUnderscore"),o=[],l=o.slice,n=i={on:function(e,t,r){var n;return c(this,"on",e,[t,r])&&t?(this._events||(this._events={}),n=this._events[e]||(this._events[e]=[]),n.push({callback:t,context:r,ctx:r||this}),this):this},once:function(e,t,r){var n,i;return c(this,"once",e,[t,r])&&t?(i=this,n=p.once(function(){i.off(e,n),t.apply(this,arguments)}),n._callback=t,this.on(e,n,r)):this},off:function(e,t,r){var n,i,o,s,a,u,l,h;if(h=void 0,n=void 0,i=void 0,l=void 0,o=void 0,u=void 0,s=void 0,a=void 0,!this._events||!c(this,"off",e,[t,r]))return this;if(!e&&!t&&!r)return this._events=void 0,this;for(l=e?[e]:p.keys(this._events),o=0,u=l.length;u>o;){if(e=l[o],i=this._events[e]){if(this._events[e]=h=[],t||r)for(s=0,a=i.length;a>s;)n=i[s],(t&&t!==n.callback&&t!==n.callback._callback||r&&r!==n.context)&&h.push(n),s++;h.length||delete this._events[e]}o++}return this},trigger:function(e){var t,r,n;return this._events?(r=l.call(arguments,1),c(this,"trigger",e,r)?(n=this._events[e],t=this._events.all,n&&h(n,r),t&&h(t,arguments),this):this):this},stopListening:function(e,t,r){var n,i,o;if(i=this._listeningTo,!i)return this;o=!t&&!r,r||"object"!=typeof t||(r=this),e&&((i={})[e._listenId]=e);for(n in i)e=i[n],e.off(t,r,this),(o||p.isEmpty(e._events))&&delete this._listeningTo[n];return this}},s=/\s+/,c=function(e,t,r,n){var i,o,a,c;if(!r)return!0;if("object"==typeof r){for(o in r)e[t].apply(e,[o,r[o]].concat(n));return!1}if(s.test(r)){for(c=r.split(s),i=0,a=c.length;a>i;)e[t].apply(e,[c[i]].concat(n)),i++;return!1}return!0},h=function(e,t){var r,n,i,o,s,a;switch(o=void 0,s=-1,a=e.length,r=t[0],n=t[1],i=t[2],t.length){case 0:for(;++s<a;)(o=e[s]).callback.call(o.ctx);break;case 1:for(;++s<a;)(o=e[s]).callback.call(o.ctx,r);break;case 2:for(;++s<a;)(o=e[s]).callback.call(o.ctx,r,n);break;case 3:for(;++s<a;)(o=e[s]).callback.call(o.ctx,r,n,i);break;default:for(;++s<a;)(o=e[s]).callback.apply(o.ctx,t)}},u={listenTo:"on",listenToOnce:"once"},p.each(u,function(e,t){n[t]=function(t,r,n){var i,o;return o=this._listeningTo||(this._listeningTo={}),i=t._listenId||(t._listenId=p.uniqueId("l")),o[i]=t,n||"object"!=typeof r||(n=this),t[e](r,n,this),this}}),n.bind=n.on,n.unbind=n.off,r.exports=i}),require.register("eventric/mixin_registerandgetclass",function(e,t,r){var n;n=function(){function e(){}return e.prototype._classes={},e.prototype.registerClass=function(e,t){return this._classes[e]=t},e.prototype.getClass=function(e){return e in this._classes?this._classes[e]:!1},e}(),r.exports=n}),require.register("eventric/mixin_setget",function(e,t,r){var n,i,o;o=t("eventric"),n=o("AggregateEntityCollection"),i=function(){function e(){}return e.prototype._set=function(e,t){return null==this._props&&(this._props={}),null==this._propsChanged&&(this._propsChanged={}),this._shouldTrackChangePropertiesFor(e,t)&&(this._propsChanged[e]=t),this._props[e]=t},e.prototype._get=function(e){return this._props[e]},e.prototype._shouldTrackChangePropertiesFor=function(e,t){return this._trackPropsChanged&&!(t instanceof n)&&"id"!==e},e}(),r.exports=i}),require.register("eventric/read_aggregate_entity",function(e,t,r){var n,i,o,s,a={}.hasOwnProperty,c=function(e,t){function r(){this.constructor=e}for(var n in t)a.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};s=t("eventric"),n=s("AggregateEntity"),i=s("MixinSetGet"),o=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return c(t,e),t}(n),r.exports=o}),require.register("eventric/read_aggregate_repository",function(e,t,r){var n,i,o,s,a,c=function(e,t){return function(){return e.apply(t,arguments)}},u=[].slice,l=[].indexOf||function(e){for(var t=0,r=this.length;r>t;t++)if(t in this&&this[t]===e)return t;return-1};s=t("eventric"),a=s("HelperUnderscore"),o=s("HelperAsync"),n=s("MixinRegisterAndGetClass"),i=function(){function e(e,t){this._aggregateName=e,this._eventStore=t,this.findIds=c(this.findIds,this),this.findById=c(this.findById,this)}return a.extend(e.prototype,n.prototype),e.prototype.findById=function(){var e,t,r,n,i,o,s;return o=3<=arguments.length?u.call(arguments,0,s=arguments.length-2):(s=0,[]),t=arguments[s++],r=arguments[s++],i=o[0],this._callbackIsAFunction(r)&&(i=this._readAggregateNameNotSet(i,r))?(e=this.getClass(i),e?this._eventStore.find(this._aggregateName,{"aggregate.id":t},function(){return function(n,i){var o,s,a,c,u;if(n)return r(n,null);if(0===i.length)return r(null,[]);for(s=new e,a=0,c=i.length;c>a;a++)o=i[a],(null!=(u=o.aggregate)?u.changed:void 0)&&(s.applyChanges(o.aggregate.changed),s.id=t);return r(null,s)}}(this)):(n=new Error("Tried 'findById' on not registered ReadAggregate '"+i+"'"),r(n,null))):void 0},e.prototype.find=function(){var e,t,r,n,i;return n=3<=arguments.length?u.call(arguments,0,i=arguments.length-2):(i=0,[]),t=arguments[i++],e=arguments[i++],r=n[0],this._callbackIsAFunction(e)&&(r=this._readAggregateNameNotSet(r,e))?this.findIds(r,t,function(t){return function(n,i){var s;return n?e(n,null):(s=[],o.whilst(function(){return i.length>0},function(e){var n;return n=i.shift(),t.findById(r,n,function(t,r){return t?e(t):0===r.length?e(null):(s.push(r),e(null))})},function(t){return t?e(t,null):e(null,s)}))}}(this)):void 0},e.prototype.findOne=function(){var e,t,r,n,i;return n=3<=arguments.length?u.call(arguments,0,i=arguments.length-2):(i=0,[]),t=arguments[i++],e=arguments[i++],r=n[0],this._callbackIsAFunction(e)&&(r=this._readAggregateNameNotSet(r,e))?this.find(r,t,function(){return function(t,r){return t?e(t,null):0===r.length?e(null,!1):e(null,r[0])}}(this)):void 0},e.prototype.findIds=function(e,t,r){return this._callbackIsAFunction(r)?this._eventStore.find(this._aggregateName,t,{"aggregate.id":1},function(){return function(e,t){var n,i,o,s,a;if(e)return r(e,null);for(n=[],o=0,s=t.length;s>o;o++)i=t[o],a=i.aggregate.id,l.call(n,a)<0&&n.push(i.aggregate.id);return r(null,n)}}(this)):void 0},e.prototype._readAggregateNameNotSet=function(e,t){var r;if(!e){if(!this._readAggregateName)return r=new Error("No readAggregateName supplied"),t(r,null),!1;e=this._readAggregateName}return e},e.prototype._callbackIsAFunction=function(e){if("function"==typeof e)return!0;throw new Error("No callback provided")},e}(),r.exports=i}),require.register("eventric/read_aggregate_root",function(e,t,r){var n,i,o,s,a,c={}.hasOwnProperty,u=function(e,t){function r(){this.constructor=e}for(var n in t)c.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};s=t("eventric"),a=s("HelperUnderscore"),i=s("ReadAggregateEntity"),n=s("MixinEvents"),o=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return u(t,e),a.extend(t.prototype,n),t}(i),r.exports=o}),require.register("eventric/read_mix",function(e,t,r){var n,i,o;i=t("eventric"),o=i("HelperUnderscore"),n=function(){function e(){}return e.prototype.loadFromEvents=function(e){var t,r,n,i,o;if(this.domainEventHandlers){for(o=[],r=0,n=e.length;n>r;r++)t=e[r],o.push(this.domainEventHandlers[""+t.aggregate.name+":"+t.name]?this.domainEventHandlers[""+t.aggregate.name+":"+t.name](t,null!=(null!=(i=t.aggregate)?i.changed:void 0)):void 0);return o}},e.prototype.loadFromJSON=function(e){return this._props=e},e.prototype._set=function(e,t){return null==this._props&&(this._props={}),this._props[e]=t},e.prototype._get=function(e){return null==this._props&&(this._props={}),this._props[e]},e.prototype._isset=function(e){return null==this._props&&(this._props={}),e in this._props},e.prototype.toJSON=function(){return null==this._props&&(this._props={}),o.clone(this._props)},e}(),r.exports=n}),require.register("eventric/read_mix_repository",function(e,t,r){var n,i,o,s;o=t("eventric"),s=o("HelperUnderscore"),n=o("MixinRegisterAndGetClass"),i=function(){function e(e){this._eventStore=e}return s.extend(e.prototype,n.prototype),e.prototype.load=function(e,t){var r,n,i;return r=this.getClass(e),r?(i=new r,this._eventStore.findByAggregateName(i.applyDomainEventsFromAggregate,function(){return function(e,r){return e?t(e,null):(i.loadFromEvents(r),t(null,i))}}(this))):(n=new Error("Tried to load not registered ReadMix '"+e+"'"),t(n,null))},e}(),r.exports=i}),require.register("eventric/remote_bounded_context",function(e,t,r){var n,i,o,s;o=t("eventric"),s=o("HelperUnderscore"),n=o("MixinRegisterAndGetClass"),i=function(){function e(e){this._remoteService=e}return s.extend(e.prototype,n.prototype),e.prototype.command=function(e,t,r){return this.rpc({boundedContextName:e,method:"command",params:t},r)},e.prototype.query=function(e,t,r){return this.rpc({boundedContextName:e,method:"query",params:t},r)},e.prototype.rpc=function(e,t){return this._remoteService.rpc("RemoteBoundedContext",e,t)},e.prototype.handle=function(e,t){var r,n;return r=this.getClass(e.boundedContextName),r?e.method in r?r[e.method](e.params,t):(n=new Error("RPC method "+e.method+" not found on Class "+e.boundedContextName),t(n,null)):(n=new Error("Tried to handle RPC class with not registered boundedContext "+e.boundedContextName),t(n,null))},e}(),r.exports=i}),require.register("eventric/remote_command_service",function(e,t,r){var n,i,o,s,a=[].slice;o=t("eventric"),s=o("HelperUnderscore"),n=o("MixinRegisterAndGetClass"),i=function(){function e(e){this._remoteService=e}return s.extend(e.prototype,n.prototype),e.prototype.createAggregate=function(){var e,t,r,n,i,o;return i=2<=arguments.length?a.call(arguments,0,o=arguments.length-1):(o=0,[]),r=arguments[o++],e=i[0],t=i[1],n=[],n.push(e),t&&n.push(t),this.rpc({"class":"CommandService",method:"createAggregate",params:n},r)},e.prototype.commandAggregate=function(){var e,t,r,n,i,o,s;return o=2<=arguments.length?a.call(arguments,0,s=arguments.length-1):(s=0,[]),r=arguments[s++],t=o[0],e=o[1],n=o[2],i=o[3],this.rpc({"class":"CommandService",method:"commandAggregate",params:[t,e,n,i]},r)},e.prototype.rpc=function(e,t){return this._remoteService.rpc("RemoteCommandService",e,t)},e.prototype.handle=function(e,t){var r,n;return r=this.getClass(e["class"]),r?e.method in r?r[e.method].apply(r,a.call(e.params).concat([function(e,r){return e?t(e,null):t(null,r)}])):(n=new Error("RPC method "+e.method+" not found on Class "+e["class"]),t(n,null)):(n=new Error("Tried to handle RPC class with not registered Class "+e["class"]),t(n,null))},e}(),r.exports=i}),require.register("eventric/remote_repository_service",function(e,t,r){var n,i,o,s,a=[].slice;o=t("eventric"),s=o("HelperUnderscore"),n=o("MixinRegisterAndGetClass"),i=function(){function e(e){this._remoteService=e}return s.extend(e.prototype,n.prototype),e.prototype.rpc=function(e,t){return this._remoteService.rpc("RemoteRepositoryService",e,function(e){return function(r,n){var i,o,s,a,c,u,l;if(r)return t(r,null);for(a=[],c=0,u=n.length;u>c;c++){if(s=n[c],i=e.getClass(null!=(l=s.aggregate)?l.name:void 0),!i)return r=new Error("Tried to built not registered Class "+s.aggregate.name+" from RPC Response"),t(r,null);o=new i,null!=s.aggregate.changed&&o.applyChanges(s.aggregate.changed),o.id=s.aggregate.id,a.push(o)}return t(null,a)}}(this))},e.prototype.handle=function(e,t){var r,n;return n=this.getClass(e.repository),n?e.method in n?n[e.method].apply(n,a.call(e.params).concat([function(e,r){var n,i,o,s;for(i=[],o=0,s=r.length;s>o;o++)n=r[o],i.push(n.getSnapshot());return t(null,i)}])):(r=new Error("RPC tried to execute not existing method "+e.method+" on repository "+e.repository),t(r,null)):(r=new Error("Tried to handle RPC with not registered repository "+e.repository),t(r,null))},e}(),r.exports=i}),require.register("eventric/remote_service",function(e,t,r){var n;n=function(){function e(e){this._adapter=e,this._serviceHandlers={}}return e.prototype.rpc=function(e,t,r){var n;return n={service:e,payload:t},this._adapter.rpc(n,r)},e.prototype.handle=function(e,t){var r,n;return n=this.getServiceHandler(e.service),n?"handle"in n?n.handle(e.payload,t):(r=new Error("Service "+e.service+" has no handle method"),t(r,null)):(r=new Error("Tried to handle RPC call with not registered service "+e.service),t(r,null))},e.prototype.registerServiceHandler=function(e,t){return this._serviceHandlers[e]=t},e.prototype.getServiceHandler=function(e){return e in this._serviceHandlers?this._serviceHandlers[e]:!1},e}(),r.exports=n}),require.register("eventric/helper/async",function(e,t,r){!function(){function e(e){var r=!1;return function(){if(r)throw new Error("Callback was already called.");r=!0,e.apply(t,arguments)}}var t,n,i={};t=this,null!=t&&(n=t.async),i.noConflict=function(){return t.async=n,i};var o=Object.prototype.toString,s=Array.isArray||function(e){return"[object Array]"===o.call(e)},a=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r+=1)t(e[r],r,e)};"undefined"!=typeof process&&process.nextTick?(i.nextTick=process.nextTick,i.setImmediate="undefined"!=typeof setImmediate?function(e){setImmediate(e)}:i.nextTick):"function"==typeof setImmediate?(i.nextTick=function(e){setImmediate(e)},i.setImmediate=i.nextTick):(i.nextTick=function(e){setTimeout(e,0)},i.setImmediate=i.nextTick),i.eachSeries=function(e,t,r){if(r=r||function(){},!e.length)return r();var n=0,i=function(){t(e[n],function(t){t?(r(t),r=function(){}):(n+=1,n>=e.length?r():i())})};i()},i.forEachSeries=i.eachSeries,i.iterator=function(e){var t=function(r){var n=function(){return e.length&&e[r].apply(null,arguments),n.next()};return n.next=function(){return r<e.length-1?t(r+1):null},n};return t(0)},i.whilst=function(e,t,r){e()?t(function(n){return n?r(n):void i.whilst(e,t,r)}):r()},i.queue=function(t,r){function n(e,t,r,n){return e.started||(e.started=!0),s(t)||(t=[t]),0==t.length?i.setImmediate(function(){e.drain&&e.drain()}):void a(t,function(t){var o={data:t,callback:"function"==typeof n?n:null};r?e.tasks.unshift(o):e.tasks.push(o),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),i.setImmediate(e.process)})}void 0===r&&(r=1);var o=0,c={tasks:[],concurrency:r,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(e,t){n(c,e,!1,t)},kill:function(){c.drain=null,c.tasks=[]},unshift:function(e,t){n(c,e,!0,t)},process:function(){if(!c.paused&&o<c.concurrency&&c.tasks.length){var r=c.tasks.shift();c.empty&&0===c.tasks.length&&c.empty(),o+=1;var n=function(){o-=1,r.callback&&r.callback.apply(r,arguments),c.drain&&c.tasks.length+o===0&&c.drain(),c.process()},i=e(n);t(r.data,i)}},length:function(){return c.tasks.length},running:function(){return o},idle:function(){return c.tasks.length+o===0},pause:function(){c.paused!==!0&&(c.paused=!0,c.process())},resume:function(){c.paused!==!1&&(c.paused=!1,c.process())}};return c},r.exports=i}()}),require.register("eventric/helper/observe",function(exports,require,module){!function(global){"use strict";function detectObjectObserve(){function e(e){t=e}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var t=[],r={},n=[];return Object.observe(r,e),Array.observe(n,e),r.id=1,r.id=2,delete r.id,n.push(1,2),n.length=0,Object.deliverChangeRecords(e),5!==t.length?!1:"add"!=t[0].type||"update"!=t[1].type||"delete"!=t[2].type||"splice"!=t[3].type||"splice"!=t[4].type?!1:(Object.unobserve(r,e),Array.unobserve(n,e),!0)}function detectEval(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;try{var e=new Function("","return true;");return e()}catch(t){return!1}}function isIndex(e){return+e===e>>>0}function toNumber(e){return+e}function isObject(e){return e===Object(e)}function areSameValue(e,t){return e===t?0!==e||1/e===1/t:numberIsNaN(e)&&numberIsNaN(t)?!0:e!==e&&t!==t}function isPathValid(e){return"string"!=typeof e?!1:(e=e.trim(),""==e?!0:"."==e[0]?!1:pathRegExp.test(e))}function Path(e,t){if(t!==constructorIsPrivate)throw Error("Use Path.get to retrieve path objects");return""==e.trim()?this:isIndex(e)?(this.push(e),this):(e.split(/\s*\.\s*/).filter(function(e){return e}).forEach(function(e){this.push(e)},this),void(hasEval&&this.length&&(this.getValueFrom=this.compiledGetValueFromFn())))}function getPath(e){if(e instanceof Path)return e;null==e&&(e=""),"string"!=typeof e&&(e=String(e));var t=pathCache[e];if(t)return t;if(!isPathValid(e))return invalidPath;var t=new Path(e,constructorIsPrivate);return pathCache[e]=t,t}function dirtyCheck(e){for(var t=0;MAX_DIRTY_CHECK_CYCLES>t&&e.check_();)t++;return global.testingExposeCycleCount&&(global.dirtyCheckCycleCount=t),t>0}function objectIsEmpty(e){for(var t in e)return!1;return!0}function diffIsEmpty(e){return objectIsEmpty(e.added)&&objectIsEmpty(e.removed)&&objectIsEmpty(e.changed)}function diffObjectFromOldObject(e,t){var r={},n={},i={};for(var o in t){var s=e[o];(void 0===s||s!==t[o])&&(o in e?s!==t[o]&&(i[o]=s):n[o]=void 0)}for(var o in e)o in t||(r[o]=e[o]);return Array.isArray(e)&&e.length!==t.length&&(i.length=e.length),{added:r,removed:n,changed:i}}function runEOMTasks(){if(!eomTasks.length)return!1;for(var e=0;e<eomTasks.length;e++)eomTasks[e]();return eomTasks.length=0,!0}function newObservedObject(){function e(e){t&&t.state_===OPENED&&!n&&t.check_(e)}var t,r,n=!1,i=!0;return{open:function(r){if(t)throw Error("ObservedObject in use");i||Object.deliverChangeRecords(e),t=r,i=!1},observe:function(t,n){r=t,n?Array.observe(r,e):Object.observe(r,e)},deliver:function(t){n=t,Object.deliverChangeRecords(e),n=!1},close:function(){t=void 0,Object.unobserve(r,e),observedObjectCache.push(this)}}}function getObservedObject(e,t,r){var n=observedObjectCache.pop()||newObservedObject(); | ||
return n.open(e),n.observe(t,r),n}function newObservedSet(){function e(t,o){t&&(t===n&&(i[o]=!0),a.indexOf(t)<0&&(a.push(t),Object.observe(t,r)),e(Object.getPrototypeOf(t),o))}function t(e){for(var t=0;t<e.length;t++){var r=e[t];if(r.object!==n||i[r.name]||"setPrototype"===r.type)return!1}return!0}function r(r){if(!t(r)){for(var n,i=0;i<s.length;i++)n=s[i],n.state_==OPENED&&n.iterateObjects_(e);for(var i=0;i<s.length;i++)n=s[i],n.state_==OPENED&&n.check_()}}var n,i,o=0,s=[],a=[],c={object:void 0,objects:a,open:function(t,r){n||(n=r,i={}),s.push(t),o++,t.iterateObjects_(e)},close:function(){if(o--,!(o>0)){for(var e=0;e<a.length;e++)Object.unobserve(a[e],r),Observer.unobservedCount++;s.length=0,a.length=0,n=void 0,i=void 0,observedSetCache.push(this)}}};return c}function getObservedSet(e,t){return lastObservedSet&&lastObservedSet.object===t||(lastObservedSet=observedSetCache.pop()||newObservedSet(),lastObservedSet.object=t),lastObservedSet.open(e,t),lastObservedSet}function Observer(){this.state_=UNOPENED,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=nextObserverId++}function addToAll(e){Observer._allObserversCount++,collectObservers&&allObservers.push(e)}function removeFromAll(){Observer._allObserversCount--}function ObjectObserver(e){Observer.call(this),this.value_=e,this.oldObject_=void 0}function ArrayObserver(e){if(!Array.isArray(e))throw Error("Provided object is not an Array");ObjectObserver.call(this,e)}function PathObserver(e,t){Observer.call(this),this.object_=e,this.path_=getPath(t),this.directObserver_=void 0}function CompoundObserver(e){Observer.call(this),this.reportChangesOnOpen_=e,this.value_=[],this.directObserver_=void 0,this.observed_=[]}function identFn(e){return e}function ObserverTransform(e,t,r,n){this.callback_=void 0,this.target_=void 0,this.value_=void 0,this.observable_=e,this.getValueFn_=t||identFn,this.setValueFn_=r||identFn,this.dontPassThroughSet_=n}function notify(e,t,r,n){if(!areSameValue(r,n)&&("function"==typeof e.propertyChanged_&&e.propertyChanged_(t,r,n),hasObserve)){var i=e.notifier_;i||(i=e.notifier_=Object.getNotifier(e)),updateRecord.object=e,updateRecord.name=t,updateRecord.oldValue=n,i.notify(updateRecord)}}function diffObjectFromChangeRecords(e,t,r){for(var n={},i={},o=0;o<t.length;o++){var s=t[o];expectedRecordTypes[s.type]?(s.name in r||(r[s.name]=s.oldValue),"update"!=s.type&&("add"!=s.type?s.name in n?(delete n[s.name],delete r[s.name]):i[s.name]=!0:s.name in i?delete i[s.name]:n[s.name]=!0)):(console.error("Unknown changeRecord type: "+s.type),console.error(s))}for(var a in n)n[a]=e[a];for(var a in i)i[a]=void 0;var c={};for(var a in r)if(!(a in n||a in i)){var u=e[a];r[a]!==u&&(c[a]=u)}return{added:n,removed:i,changed:c}}function newSplice(e,t,r){return{index:e,removed:t,addedCount:r}}function ArraySplice(){}function calcSplices(e,t,r,n,i,o){return arraySplice.calcSplices(e,t,r,n,i,o)}function intersect(e,t,r,n){return r>t||e>n?-1:t==r||n==e?0:r>e?n>t?t-r:n-r:t>n?n-e:t-e}function mergeSplice(e,t,r,n){for(var i=newSplice(t,r,n),o=!1,s=0,a=0;a<e.length;a++){var c=e[a];if(c.index+=s,!o){var u=intersect(i.index,i.index+i.removed.length,c.index,c.index+c.addedCount);if(u>=0){e.splice(a,1),a--,s-=c.addedCount-c.removed.length,i.addedCount+=c.addedCount-u;var l=i.removed.length+c.removed.length-u;if(i.addedCount||l){var r=c.removed;if(i.index<c.index){var h=i.removed.slice(0,c.index-i.index);Array.prototype.push.apply(h,r),r=h}if(i.index+i.removed.length>c.index+c.addedCount){var p=i.removed.slice(c.index+c.addedCount-i.index);Array.prototype.push.apply(r,p)}i.removed=r,c.index<i.index&&(i.index=c.index)}else o=!0}else if(i.index<c.index){o=!0,e.splice(a,0,i),a++;var d=i.addedCount-i.removed.length;c.index+=d,s+=d}}}o||e.push(i)}function createInitialSplices(e,t){for(var r=[],n=0;n<t.length;n++){var i=t[n];switch(i.type){case"splice":mergeSplice(r,i.index,i.removed.slice(),i.addedCount);break;case"add":case"update":case"delete":if(!isIndex(i.name))continue;var o=toNumber(i.name);if(0>o)continue;mergeSplice(r,o,[i.oldValue],1);break;default:console.error("Unexpected record type: "+JSON.stringify(i))}}return r}function projectArraySplices(e,t){var r=[];return createInitialSplices(e,t).forEach(function(t){return 1==t.addedCount&&1==t.removed.length?void(t.removed[0]!==e[t.index]&&r.push(t)):void(r=r.concat(calcSplices(e,t.index,t.index+t.addedCount,t.removed,0,t.removed.length)))}),r}var hasObserve=detectObjectObserve(),hasEval=detectEval(),numberIsNaN=global.Number.isNaN||function(e){return"number"==typeof e&&global.isNaN(e)},createObject="__proto__"in{}?function(e){return e}:function(e){var t=e.__proto__;if(!t)return e;var r=Object.create(t);return Object.getOwnPropertyNames(e).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}),r},identStart="[$_a-zA-Z]",identPart="[$_a-zA-Z0-9]",ident=identStart+"+"+identPart+"*",elementIndex="(?:[0-9]|[1-9]+[0-9]+)",identOrElementIndex="(?:"+ident+"|"+elementIndex+")",path="(?:"+identOrElementIndex+")(?:\\s*\\.\\s*"+identOrElementIndex+")*",pathRegExp=new RegExp("^"+path+"$"),constructorIsPrivate={},pathCache={};Path.get=getPath,Path.prototype=createObject({__proto__:[],valid:!0,toString:function(){return this.join(".")},getValueFrom:function(e){for(var t=0;t<this.length;t++){if(null==e)return;e=e[this[t]]}return e},iterateObjects:function(e,t){for(var r=0;r<this.length;r++){if(r&&(e=e[this[r-1]]),!isObject(e))return;t(e,this[0])}},compiledGetValueFromFn:function(){var e=this.map(function(e){return isIndex(e)?'["'+e+'"]':"."+e}),t="",r="obj";t+="if (obj != null";for(var n=0;n<this.length-1;n++){{this[n]}r+=e[n],t+=" &&\n "+r+" != null"}return t+=")\n",r+=e[n],t+=" return "+r+";\nelse\n return undefined;",new Function("obj",t)},setValueFrom:function(e,t){if(!this.length)return!1;for(var r=0;r<this.length-1;r++){if(!isObject(e))return!1;e=e[this[r]]}return isObject(e)?(e[this[r]]=t,!0):!1}});var invalidPath=new Path("",constructorIsPrivate);invalidPath.valid=!1,invalidPath.getValueFrom=invalidPath.setValueFrom=function(){};var MAX_DIRTY_CHECK_CYCLES=1e3,eomTasks=[],runEOM=hasObserve?function(){var e={pingPong:!0},t=!1;return Object.observe(e,function(){runEOMTasks(),t=!1}),function(r){eomTasks.push(r),t||(t=!0,e.pingPong=!e.pingPong)}}():function(){return function(e){eomTasks.push(e)}}(),observedObjectCache=[],observedSetCache=[],lastObservedSet,UNOPENED=0,OPENED=1,CLOSED=2,RESETTING=3,nextObserverId=1;Observer.prototype={open:function(e,t){if(this.state_!=UNOPENED)throw Error("Observer has already been opened.");return addToAll(this),this.callback_=e,this.target_=t,this.connect_(),this.state_=OPENED,this.value_},close:function(){this.state_==OPENED&&(removeFromAll(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=CLOSED)},deliver:function(){this.state_==OPENED&&dirtyCheck(this)},report_:function(e){try{this.callback_.apply(this.target_,e)}catch(t){Observer._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(t.stack||t))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var collectObservers=!hasObserve,allObservers;Observer._allObserversCount=0,collectObservers&&(allObservers=[]);var runningMicrotaskCheckpoint=!1,hasDebugForceFullDelivery=hasObserve&&function(){try{return eval("%RunMicrotasks()"),!0}catch(ex){return!1}}();global.Platform=global.Platform||{},global.Platform.performMicrotaskCheckpoint=function(){if(!runningMicrotaskCheckpoint){if(hasDebugForceFullDelivery)return void eval("%RunMicrotasks()");if(collectObservers){runningMicrotaskCheckpoint=!0;var cycles=0,anyChanged,toCheck;do{cycles++,toCheck=allObservers,allObservers=[],anyChanged=!1;for(var i=0;i<toCheck.length;i++){var observer=toCheck[i];observer.state_==OPENED&&(observer.check_()&&(anyChanged=!0),allObservers.push(observer))}runEOMTasks()&&(anyChanged=!0)}while(MAX_DIRTY_CHECK_CYCLES>cycles&&anyChanged);global.testingExposeCycleCount&&(global.dirtyCheckCycleCount=cycles),runningMicrotaskCheckpoint=!1}}},collectObservers&&(global.Platform.clearObservers=function(){allObservers=[]}),ObjectObserver.prototype=createObject({__proto__:Observer.prototype,arrayObserve:!1,connect_:function(){hasObserve?this.directObserver_=getObservedObject(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(e){var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=e[r];return Array.isArray(e)&&(t.length=e.length),t},check_:function(e){var t,r;if(hasObserve){if(!e)return!1;r={},t=diffObjectFromChangeRecords(this.value_,e,r)}else r=this.oldObject_,t=diffObjectFromOldObject(this.value_,this.oldObject_);return diffIsEmpty(t)?!1:(hasObserve||(this.oldObject_=this.copyObject(this.value_)),this.report_([t.added||{},t.removed||{},t.changed||{},function(e){return r[e]}]),!0)},disconnect_:function(){hasObserve?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==OPENED&&(hasObserve?this.directObserver_.deliver(!1):dirtyCheck(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}}),ArrayObserver.prototype=createObject({__proto__:ObjectObserver.prototype,arrayObserve:!0,copyObject:function(e){return e.slice()},check_:function(e){var t;if(hasObserve){if(!e)return!1;t=projectArraySplices(this.value_,e)}else t=calcSplices(this.value_,0,this.value_.length,this.oldObject_,0,this.oldObject_.length);return t&&t.length?(hasObserve||(this.oldObject_=this.copyObject(this.value_)),this.report_([t]),!0):!1}}),ArrayObserver.applySplices=function(e,t,r){r.forEach(function(r){for(var n=[r.index,r.removed.length],i=r.index;i<r.index+r.addedCount;)n.push(t[i]),i++;Array.prototype.splice.apply(e,n)})},PathObserver.prototype=createObject({__proto__:Observer.prototype,connect_:function(){hasObserve&&(this.directObserver_=getObservedSet(this,this.object_)),this.check_(void 0,!0)},disconnect_:function(){this.value_=void 0,this.directObserver_&&(this.directObserver_.close(this),this.directObserver_=void 0)},iterateObjects_:function(e){this.path_.iterateObjects(this.object_,e)},check_:function(e,t){var r=this.value_;return this.value_=this.path_.getValueFrom(this.object_),t||areSameValue(this.value_,r)?!1:(this.report_([this.value_,r]),!0)},setValue:function(e){this.path_&&this.path_.setValueFrom(this.object_,e)}});var observerSentinel={};CompoundObserver.prototype=createObject({__proto__:Observer.prototype,connect_:function(){if(hasObserve){for(var e,t=!1,r=0;r<this.observed_.length;r+=2)if(e=this.observed_[r],e!==observerSentinel){t=!0;break}t&&(this.directObserver_=getObservedSet(this,e))}this.check_(void 0,!this.reportChangesOnOpen_)},disconnect_:function(){for(var e=0;e<this.observed_.length;e+=2)this.observed_[e]===observerSentinel&&this.observed_[e+1].close();this.observed_.length=0,this.value_.length=0,this.directObserver_&&(this.directObserver_.close(this),this.directObserver_=void 0)},addPath:function(e,t){if(this.state_!=UNOPENED&&this.state_!=RESETTING)throw Error("Cannot add paths once started.");var t=getPath(t);if(this.observed_.push(e,t),this.reportChangesOnOpen_){var r=this.observed_.length/2-1;this.value_[r]=t.getValueFrom(e)}},addObserver:function(e){if(this.state_!=UNOPENED&&this.state_!=RESETTING)throw Error("Cannot add observers once started.");if(this.observed_.push(observerSentinel,e),this.reportChangesOnOpen_){var t=this.observed_.length/2-1;this.value_[t]=e.open(this.deliver,this)}},startReset:function(){if(this.state_!=OPENED)throw Error("Can only reset while open");this.state_=RESETTING,this.disconnect_()},finishReset:function(){if(this.state_!=RESETTING)throw Error("Can only finishReset after startReset");return this.state_=OPENED,this.connect_(),this.value_},iterateObjects_:function(e){for(var t,r=0;r<this.observed_.length;r+=2)t=this.observed_[r],t!==observerSentinel&&this.observed_[r+1].iterateObjects(t,e)},check_:function(e,t){for(var r,n=0;n<this.observed_.length;n+=2){var i,o=this.observed_[n],s=this.observed_[n+1];if(o===observerSentinel){var a=s;i=this.state_===UNOPENED?a.open(this.deliver,this):a.discardChanges()}else i=s.getValueFrom(o);t?this.value_[n/2]=i:areSameValue(i,this.value_[n/2])||(r=r||[],r[n/2]=this.value_[n/2],this.value_[n/2]=i)}return r?(this.report_([this.value_,r,this.observed_]),!0):!1}}),ObserverTransform.prototype={open:function(e,t){return this.callback_=e,this.target_=t,this.value_=this.getValueFn_(this.observable_.open(this.observedCallback_,this)),this.value_},observedCallback_:function(e){if(e=this.getValueFn_(e),!areSameValue(e,this.value_)){var t=this.value_;this.value_=e,this.callback_.call(this.target_,this.value_,t)}},discardChanges:function(){return this.value_=this.getValueFn_(this.observable_.discardChanges()),this.value_},deliver:function(){return this.observable_.deliver()},setValue:function(e){return e=this.setValueFn_(e),!this.dontPassThroughSet_&&this.observable_.setValue?this.observable_.setValue(e):void 0},close:function(){this.observable_&&this.observable_.close(),this.callback_=void 0,this.target_=void 0,this.observable_=void 0,this.value_=void 0,this.getValueFn_=void 0,this.setValueFn_=void 0}};var expectedRecordTypes={add:!0,update:!0,"delete":!0},updateRecord={object:void 0,type:"update",name:void 0,oldValue:void 0};Observer.createBindablePrototypeAccessor=function(e,t){var r=t+"_",n=t+"Observable_";e[r]=e[t],Object.defineProperty(e,t,{get:function(){var e=this[n];return e&&e.deliver(),this[r]},set:function(e){var i=this[n];if(i)return void i.setValue(e);var o=this[r];return this[r]=e,notify(this,t,e,o),e},configurable:!0})},Observer.bindToInstance=function(e,t,r,n){var i=t+"_",o=t+"Observable_";e[o]=r;var s=e[i],a=r.open(function(r,n){e[i]=r,notify(e,t,r,n)});if(n&&!areSameValue(s,a)){var c=n(s,a);areSameValue(a,c)||(a=c,r.setValue&&r.setValue(a))}return e[i]=a,notify(e,t,a,s),{close:function(){r.close(),e[o]=void 0}}};var EDIT_LEAVE=0,EDIT_UPDATE=1,EDIT_ADD=2,EDIT_DELETE=3;ArraySplice.prototype={calcEditDistances:function(e,t,r,n,i,o){for(var s=o-i+1,a=r-t+1,c=new Array(s),u=0;s>u;u++)c[u]=new Array(a),c[u][0]=u;for(var l=0;a>l;l++)c[0][l]=l;for(var u=1;s>u;u++)for(var l=1;a>l;l++)if(this.equals(e[t+l-1],n[i+u-1]))c[u][l]=c[u-1][l-1];else{var h=c[u-1][l]+1,p=c[u][l-1]+1;c[u][l]=p>h?h:p}return c},spliceOperationsFromEditDistances:function(e){for(var t=e.length-1,r=e[0].length-1,n=e[t][r],i=[];t>0||r>0;)if(0!=t)if(0!=r){var o,s=e[t-1][r-1],a=e[t-1][r],c=e[t][r-1];o=c>a?s>a?a:s:s>c?c:s,o==s?(s==n?i.push(EDIT_LEAVE):(i.push(EDIT_UPDATE),n=s),t--,r--):o==a?(i.push(EDIT_DELETE),t--,n=a):(i.push(EDIT_ADD),r--,n=c)}else i.push(EDIT_DELETE),t--;else i.push(EDIT_ADD),r--;return i.reverse(),i},calcSplices:function(e,t,r,n,i,o){var s=0,a=0,c=Math.min(r-t,o-i);if(0==t&&0==i&&(s=this.sharedPrefix(e,n,c)),r==e.length&&o==n.length&&(a=this.sharedSuffix(e,n,c-s)),t+=s,i+=s,r-=a,o-=a,r-t==0&&o-i==0)return[];if(t==r){for(var u=newSplice(t,[],0);o>i;)u.removed.push(n[i++]);return[u]}if(i==o)return[newSplice(t,[],r-t)];for(var l=this.spliceOperationsFromEditDistances(this.calcEditDistances(e,t,r,n,i,o)),u=void 0,h=[],p=t,d=i,g=0;g<l.length;g++)switch(l[g]){case EDIT_LEAVE:u&&(h.push(u),u=void 0),p++,d++;break;case EDIT_UPDATE:u||(u=newSplice(p,[],0)),u.addedCount++,p++,u.removed.push(n[d]),d++;break;case EDIT_ADD:u||(u=newSplice(p,[],0)),u.addedCount++,p++;break;case EDIT_DELETE:u||(u=newSplice(p,[],0)),u.removed.push(n[d]),d++}return u&&h.push(u),h},sharedPrefix:function(e,t,r){for(var n=0;r>n;n++)if(!this.equals(e[n],t[n]))return n;return r},sharedSuffix:function(e,t,r){for(var n=e.length,i=t.length,o=0;r>o&&this.equals(e[--n],t[--i]);)o++;return o},calculateSplices:function(e,t){return this.calcSplices(e,0,e.length,t,0,t.length)},equals:function(e,t){return e===t}};var arraySplice=new ArraySplice;global.Observer=Observer,global.Observer.runEOM_=runEOM,global.Observer.observerSentinel_=observerSentinel,global.Observer.hasObjectObserve=hasObserve,global.ArrayObserver=ArrayObserver,global.ArrayObserver.calculateSplices=function(e,t){return arraySplice.calculateSplices(e,t)},global.ArraySplice=ArraySplice,global.ObjectObserver=ObjectObserver,global.PathObserver=PathObserver,global.CompoundObserver=CompoundObserver,global.Path=Path,global.ObserverTransform=ObserverTransform}("undefined"!=typeof global&&global&&"undefined"!=typeof module&&module?global:this||window)}),require.register("eventric/helper/underscore",function(e,t,r){(function(){var t=this,n=t._,i={},o=Array.prototype,s=Object.prototype,a=Function.prototype,c=o.push,u=o.slice,l=(o.concat,s.toString),h=s.hasOwnProperty,p=Array.isArray,d=Object.keys,g=(a.bind,function(e){return e instanceof g?e:this instanceof g?void(this._wrapped=e):new g(e)});"undefined"!=typeof e?("undefined"!=typeof r&&r.exports&&(e=r.exports=g),e._=g):t._=g,g.VERSION="1.6.0",g.each=g.forEach=function(e,t,r){if(null==e)return e;if(e.length===+e.length){for(var n=0,o=e.length;o>n;n++)if(t.call(r,e[n],n,e)===i)return}else for(var s=g.keys(e),n=0,o=s.length;o>n;n++)if(t.call(r,e[s[n]],s[n],e)===i)return;return e},g.keys=function(e){if(!g.isObject(e))return[];if(d)return d(e);var t=[];for(var r in e)g.has(e,r)&&t.push(r);return t},g.invert=function(e){for(var t={},r=g.keys(e),n=0,i=r.length;i>n;n++)t[e[r[n]]]=r[n];return t},g.functions=g.methods=function(e){var t=[];for(var r in e)g.isFunction(e[r])&&t.push(r);return t.sort()},g.extend=function(e){return g.isObject(e)?(g.each(u.call(arguments,1),function(t){for(var r in t)e[r]=t[r]}),e):e},g.defaults=function(e){return g.isObject(e)?(g.each(u.call(arguments,1),function(t){for(var r in t)void 0===e[r]&&(e[r]=t[r])}),e):e},g.isEqual=function(e,t){return eq(e,t,[],[])},g.isEmpty=function(e){if(null==e)return!0;if(g.isArray(e)||g.isString(e)||g.isArguments(e))return 0===e.length;for(var t in e)if(g.has(e,t))return!1;return!0},g.isElement=function(e){return!(!e||1!==e.nodeType)},g.isArray=p||function(e){return"[object Array]"==l.call(e)},g.isObject=function(e){return e===Object(e)},g.each(["Arguments","Function","String","Number","Date","RegExp"],function(e){g["is"+e]=function(t){return l.call(t)=="[object "+e+"]"}}),g.isArguments(arguments)||(g.isArguments=function(e){return g.has(e,"callee")}),"function"!=typeof/./&&(g.isFunction=function(e){return"function"==typeof e}),g.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},g.isNaN=function(e){return g.isNumber(e)&&e!=+e},g.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==l.call(e)},g.isNull=function(e){return null===e},g.isUndefined=function(e){return void 0===e},g.has=function(e,t){return null!=e&&h.call(e,t)},g.noConflict=function(){return t._=n,this},g.identity=function(e){return e},g.constant=function(e){return function(){return e}},g.noop=function(){},g.property=function(e){return function(t){return t[e]}},g.matches=function(e){return function(t){if(null==t)return g.isEmpty(e);if(t===e)return!0;for(var r in e)if(e[r]!==t[r])return!1;return!0}},g.times=function(e,t,r){for(var n=Array(Math.max(0,e)),i=0;e>i;i++)n[i]=t.call(r,i);return n},g.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},g.now=Date.now||function(){return(new Date).getTime()};var v={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};v.unescape=g.invert(v.escape);var f={escape:new RegExp("["+g.keys(v.escape).join("")+"]","g"),unescape:new RegExp("("+g.keys(v.unescape).join("|")+")","g")};g.each(["escape","unescape"],function(e){g[e]=function(t){return null==t?"":(""+t).replace(f[e],function(t){return v[e][t]})}}),g.result=function(e,t){if(null==e)return void 0;var r=e[t];return g.isFunction(r)?e[t]():r},g.mixin=function(e){g.each(g.functions(e),function(t){var r=g[t]=e[t];g.prototype[t]=function(){var e=[this._wrapped];return c.apply(e,arguments),b.call(this,r.apply(g,e))}})};var _=0;g.uniqueId=function(e){var t=++_+"";return e?e+t:t},g.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};g.chain=function(e){return g(e).chain()};var b=function(e){return this._chain?g(e).chain():e};g.mixin(g),g.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=o[e];g.prototype[e]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=e&&"splice"!=e||0!==r.length||delete r[0],b.call(this,r)}}),g.each(["concat","join","slice"],function(e){var t=o[e];g.prototype[e]=function(){return b.call(this,t.apply(this._wrapped,arguments))}}),g.extend(g.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)}); |
@@ -21,3 +21,3 @@ { | ||
"author": "eFa Team <team@efa-gmbh.com>", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"repository": { | ||
@@ -24,0 +24,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
474315
97
9039