o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1337093725.9058108: @value"€ٌ{I" class:EFI"ProcessedAsset;FI"logical_path;F"1ems/lib/batman/lib/dist/batman.jquery.min.jsI" pathname;F"}/private/var/www/html/development/projects/rails/ems/app/assets/javascripts/ems/lib/batman/lib/dist/batman.jquery.min.jsI"content_type;FI"application/javascript;FI" mtime;FI"2012-05-14T17:32:22+01:00;FI" length;FiهيI" digest;F"%83426e6383f460f8b02ef2c5979189e6I" source;FI"هي(function(){var a,b=[].slice;a=function(){var c;return c=1<=arguments.length?b.call(arguments,0):[],function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b),f=typeof e;return f=="object"||f=="function"?e||d:d}(a.Object,c,function(){})},a.version="0.9.0",a.config={pathPrefix:"/",usePushState:!1,minificationErrors:!0},a.container=typeof exports!="undefined"&&exports!==null?(global.Batman=a,global):(window.Batman=a,window),typeof define=="function"&&define("batman",[],function(){return a}),a.exportHelpers=function(b){var c,d,e,f;f=["mixin","extend","unmixin","redirect","typeOf","redirect","setImmediate","clearImmediate"];for(d=0,e=f.length;d=0)return a+"th";switch(c%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd";default:return a+"th"}},c.prototype.pluralize=function(a){var b,c,d,e,f,g,h,i,j,k;i=this.uncountable;for(e=0,g=i.length;e=0?(Batman.setImmediate=function(a){var b,c;return b=f(),c=document.createElement("script"),c.onreadystatechange=function(){var a;return typeof (a=i.get(b))=="function"&&a(),c.onreadystatechange=null,c.parentNode.removeChild(c),c=null},document.documentElement.appendChild(c),b},Batman.clearImmediate=function(a){return i.unset(a)}):(Batman.setImmediate=function(a){return setTimeout(a,0)},Batman.clearImmediate=function(a){return clearTimeout(a)}),Batman.setImmediate=Batman.setImmediate,Batman.clearImmediate=Batman.clearImmediate},Batman.setImmediate=function(){return a(Batman.container),Batman.setImmediate.apply(this,arguments)},Batman.clearImmediate=function(){return a(Batman.container),Batman.clearImmediate.apply(this,arguments)},Batman.forEach=function(a,b,c){var d,e,f,g,h,i,j,k;if(a.forEach)return a.forEach(b,c);if(a.indexOf){j=[];for(e=h=0,i=a.length;h=0:typeof a.has=="function"?a.has(b):Batman.objectHasKey(a,b)},Batman.get=function(a,b){return typeof a.get=="function"?a.get(b):Batman.Property.forBaseAndKey(a,b).getValue()},Batman.getPath=function(a,b){var c,d,e;for(d=0,e=b.length;d":">",'"':""","'":"'"},function(b){return(""+b).replace(/[&<>'"]/g,function(b){return a[b]})}}(),Batman.translate=function(a,b){return b==null&&(b={}),Batman.helpers.interpolate(Batman.get(Batman.translate.messages,a),b)},Batman.translate.messages={},Batman.t=function(){return Batman.translate.apply(Batman,arguments)},Batman.redirect=function(a){var b;return(b=Batman.navigator)!=null?b.redirect(a):void 0},Batman.initializeObject=function(a){return a._batman!=null?a._batman.check(a):a._batman=new Batman._Batman(a)}}.call(this),function(){}.call(this),function(){var a;Batman._Batman=a=function(){function a(a){this.object=a}return a.name="_Batman",a.prototype.check=function(a){return a!==this.object?(a._batman=new Batman._Batman(a),!1):!0},a.prototype.get=function(a){var b,c;c=this.getAll(a);switch(c.length){case 0:return;case 1:return c[0];default:return b=c[0].concat!=null?function(a,b){return a.concat(b)}:c[0].merge!=null?function(a,b){return a.merge(b)}:c.every(function(a){return typeof a=="object"})?(c.unshift({}),function(a,b){return Batman.extend(a,b)}):void 0,b?c.reduceRight(b):c}},a.prototype.getFirst=function(a){var b;return b=this.getAll(a),b[0]},a.prototype.getAll=function(a){var b,c,d;return typeof a=="function"?b=a:b=function(b){var c;return(c=b._batman)!=null?c[a]:void 0},c=this.ancestors(b),(d=b(this.object))&&c.unshift(d),c},a.prototype.ancestors=function(a){var b,c,d,e,f,g,h;return a==null&&(a=function(a){return a}),e=[],b=!!this.object.prototype,c=b?(g=this.object.__super__)!=null?g.constructor:void 0:(d=Object.getPrototypeOf(this.object))===this.object?this.object.constructor.__super__:d,c!=null&&((h=c._batman)!=null&&h.check(c),f=a(c),f!=null&&e.push(f),c._batman!=null&&(e=e.concat(c._batman.ancestors(a)))),e},a.prototype.set=function(a,b){return this[a]=b},a}()}.call(this),function(){Batman.Event=function(){function a(a,b){this.base=a,this.key=b,this.handlers=[],this._preventCount=0}return a.name="Event",a.forBaseAndKey=function(a,b){return a.isEventEmitter?a.event(b):new Batman.Event(a,b)},a.prototype.isEvent=!0,a.prototype.isEqual=function(a){return this.constructor===a.constructor&&this.base===a.base&&this.key===a.key},a.prototype.hashKey=function(){var a;return this.hashKey=function(){return a},a="'},a.prototype.addHandler=function(a){return this.handlers.indexOf(a)===-1&&this.handlers.push(a),this.oneShot&&this.autofireHandler(a),this},a.prototype.removeHandler=function(a){var b;return(b=this.handlers.indexOf(a))!==-1&&this.handlers.splice(b,1),this},a.prototype.eachHandler=function(a){var b,c,d;this.handlers.slice().forEach(a);if((c=this.base)!=null?c.isEventEmitter:void 0)return b=this.key,(d=this.base._batman)!=null?d.ancestors(function(c){var d,e,f;if(c.isEventEmitter&&((e=c._batman)!=null?(f=e.events)!=null?f.hasOwnProperty(b):void 0:void 0))return d=c.event(b).handlers,d.slice().forEach(a)}):void 0},a.prototype.clearHandlers=function(){return this.handlers=[]},a.prototype.handlerContext=function(){return this.base},a.prototype.prevent=function(){return++this._preventCount},a.prototype.allow=function(){return this._preventCount&&--this._preventCount,this._preventCount},a.prototype.isPrevented=function(){return this._preventCount>0},a.prototype.autofireHandler=function(a){if(this._oneShotFired&&this._oneShotArgs!=null)return a.apply(this.handlerContext(),this._oneShotArgs)},a.prototype.resetOneShot=function(){return this._oneShotFired=!1,this._oneShotArgs=null},a.prototype.fire=function(){var a,b;return this.isPrevented()||this._oneShotFired?!1:(b=this.handlerContext(),a=arguments,this.oneShot&&(this._oneShotFired=!0,this._oneShotArgs=arguments),this.eachHandler(function(c){return c.apply(b,a)}))},a.prototype.allowAndFire=function(){return this.allow(),this.fire.apply(this,arguments)},a}()}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.PropertyEvent=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="PropertyEvent",c.prototype.eachHandler=function(a){return this.base.eachObserver(a)},c.prototype.handlerContext=function(){return this.base.base},c}(Batman.Event)}.call(this),function(){var a=[].slice;Batman.EventEmitter={isEventEmitter:!0,hasEvent:function(a){var b,c;return(b=this._batman)!=null?typeof b.get=="function"?(c=b.get("events"))!=null?c.hasOwnProperty(a):void 0:void 0:void 0},event:function(a){var b,c,d,e,f;return Batman.initializeObject(this),b=this.eventClass||Batman.Event,c=(f=this._batman).events||(f.events={}),c.hasOwnProperty(a)?d=c[a]:(this._batman.ancestors(function(b){var c,e;return d||(d=(c=b._batman)!=null?(e=c.events)!=null?e[a]:void 0:void 0)}),e=c[a]=new b(this,a),e.oneShot=d!=null?d.oneShot:void 0,e)},on:function(a,b){return this.event(a).addHandler(b)},once:function(a,b){var c,d;return c=this.event(a),d=function(){return b.apply(this,arguments),c.removeHandler(d)},c.addHandler(d)},registerAsMutableSource:function(){return Batman.Property.registerSource(this)},mutation:function(a){return function(){var b;return b=a.apply(this,arguments),this.event("change").fire(this,this),b}},prevent:function(a){return this.event(a).prevent(),this},allow:function(a){return this.event(a).allow(),this},isPrevented:function(a){return this.event(a).isPrevented()},fire:function(){var b,c,d;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],(d=this.event(c)).fire.apply(d,b)},allowAndFire:function(){var b,c,d;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],(d=this.event(c)).allowAndFire.apply(d,b)}}}.call(this),function(){var a=[].slice;Batman.Enumerable={isEnumerable:!0,map:function(a,b){var c;return b==null&&(b=Batman.container),c=[],this.forEach(function(){return c.push(a.apply(b,arguments))}),c},mapToProperty:function(a){var b;return b=[],this.forEach(function(c){return b.push(c.get(a))}),b},every:function(a,b){var c;return b==null&&(b=Batman.container),c=!0,this.forEach(function(){return c=c&&a.apply(b,arguments)}),c},some:function(a,b){var c;return b==null&&(b=Batman.container),c=!1,this.forEach(function(){return c=c||a.apply(b,arguments)}),c},reduce:function(b,c){var d,e;return d=0,e=this,this.forEach(function(){return c!=null?c=b.apply(null,[c].concat(a.call(arguments),[d],[e])):c=arguments[0]}),c},filter:function(a){var b,c;return b=new this.constructor,b.add?c=function(b,c){return a(c)&&b.add(c),b}:b.set?c=function(b,c,d){return a(c,d)&&b.set(c,d),b}:(b.push||(b=[]),c=function(b,c){return a(c)&&b.push(c),b}),this.reduce(c,b)},inGroupsOf:function(a){var b,c,d;return d=[],b=!1,c=0,this.forEach(function(e){return c++%a===0&&(b=[],d.push(b)),b.push(e)}),d}}}.call(this),function(){var a=[].slice;Batman.SimpleSet=function(){function b(){this._storage=[],this.length=0,arguments.length>0&&this.add.apply(this,arguments)}return b.name="SimpleSet",Batman.extend(b.prototype,Batman.Enumerable),b.prototype.has=function(a){return!!~this._storage.indexOf(a)},b.prototype.add=function(){var b,c,d,e,f;d=1<=arguments.length?a.call(arguments,0):[],b=[];for(e=0,f=d.length;e'},a.prototype.event=function(a){var b,c;return b=this.eventClass||Batman.Event,this.events||(this.events={}),(c=this.events)[a]||(c[a]=new b(this,a)),this.events[a]},a.prototype.changeEvent=function(){var a;return a=this.event("change"),this.changeEvent=function(){return a},a},a.prototype.accessor=function(){var a;return a=this.constructor.accessorForBaseAndKey(this.base,this.key),this.accessor=function(){return a},a},a.prototype.eachObserver=function(a){var b;b=this.key,this.changeEvent().handlers.slice().forEach(a);if(this.base.isObservable)return this.base._batman.ancestors(function(c){var d,e;if(c.isObservable&&c.hasProperty(b))return e=c.property(b),d=e.changeEvent().handlers,d.slice().forEach(a)})},a.prototype.observers=function(){var a;return a=[],this.eachObserver(function(b){return a.push(b)}),a},a.prototype.hasObservers=function(){return this.observers().length>0},a.prototype.updateSourcesFromTracker=function(){var a,b;return b=this.constructor.popSourceTracker(),a=this.sourceChangeHandler(),this._eachSourceChangeEvent(function(b){return b.removeHandler(a)}),this.sources=b,this._eachSourceChangeEvent(function(b){return b.addHandler(a)})},a.prototype._eachSourceChangeEvent=function(a){if(this.sources==null)return;return this.sources.forEach(function(b){return a(b.event("change"))})},a.prototype.getValue=function(){this.registerAsMutableSource();if(!this.isCached()){this.constructor.pushSourceTracker();try{this.value=this.valueFromAccessor(),this.cached=!0}finally{this.updateSourcesFromTracker()}}return this.value},a.prototype.isCachable=function(){var a;return this.isFinal()?!0:(a=this.accessor().cache,a!=null?!!a:!0)},a.prototype.isCached=function(){return this.isCachable()&&this.cached},a.prototype.isFinal=function(){return!!this.accessor()["final"]},a.prototype.refresh=function(){var a,b;this.cached=!1,a=this.value,b=this.getValue(),b!==a&&!this.isIsolated()&&this.fire(b,a);if(this.value!==void 0&&this.isFinal())return this.lockValue()},a.prototype.sourceChangeHandler=function(){var a,b=this;return a=this._handleSourceChange.bind(this),this.sourceChangeHandler=function(){return a},a},a.prototype._handleSourceChange=function(){return this.isIsolated()?this._needsRefresh=!0:!this.isFinal()&&!this.hasObservers()?this.cached=!1:this.refresh()},a.prototype.valueFromAccessor=function(){var a;return(a=this.accessor().get)!=null?a.call(this.base,this.key):void 0},a.prototype.setValue=function(a){var b;if(!(b=this.accessor().set))return;return this._changeValue(function(){return b.call(this.base,this.key,a)})},a.prototype.unsetValue=function(){var a;if(!(a=this.accessor().unset))return;return this._changeValue(function(){return a.call(this.base,this.key)})},a.prototype._changeValue=function(a){var b;this.cached=!1,this.constructor.pushDummySourceTracker();try{b=a.apply(this),this.refresh()}finally{this.constructor.popSourceTracker()}return!this.isCached()&&!this.hasObservers()&&this.die(),b},a.prototype.forget=function(a){return a!=null?this.changeEvent().removeHandler(a):this.changeEvent().clearHandlers()},a.prototype.observeAndFire=function(a){return this.observe(a),a.call(this.base,this.value,this.value)},a.prototype.observe=function(a){return this.changeEvent().addHandler(a),this.sources==null&&this.getValue(),this},a.prototype._removeHandlers=function(){var a;return a=this.sourceChangeHandler(),this._eachSourceChangeEvent(function(b){return b.removeHandler(a)}),delete this.sources,this.changeEvent().clearHandlers()},a.prototype.lockValue=function(){return this._removeHandlers(),this.getValue=function(){return this.value},this.setValue=this.unsetValue=this.refresh=this.observe=function(){}},a.prototype.die=function(){var a,b;return this._removeHandlers(),(a=this.base._batman)!=null&&(b=a.properties)!=null&&b.unset(this.key),this.isDead=!0},a.prototype.fire=function(){var a;return(a=this.changeEvent()).fire.apply(a,arguments)},a.prototype.isolate=function(){return this._isolationCount===0&&(this._preIsolationValue=this.getValue()),this._isolationCount++},a.prototype.expose=function(){if(this._isolationCount===1)return this._isolationCount--,this._needsRefresh?(this.value=this._preIsolationValue,this.refresh()):this.value!==this._preIsolationValue&&this.fire(this.value,this._preIsolationValue),this._preIsolationValue=null;if(this._isolationCount>0)return this._isolationCount--},a.prototype.isIsolated=function(){return this._isolationCount>0},a}()}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.Keypath=function(a){function c(a,b){typeof b=="string"?(this.segments=b.split("."),this.depth=this.segments.length):(this.segments=[b],this.depth=1),c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="Keypath",c.prototype.isCachable=function(){return this.depth===1?c.__super__.isCachable.apply(this,arguments):!0},c.prototype.terminalProperty=function(){var a;a=Batman.getPath(this.base,this.segments.slice(0,-1));if(a==null)return;return Batman.Keypath.forBaseAndKey(a,this.segments[this.depth-1])},c.prototype.valueFromAccessor=function(){return this.depth===1?c.__super__.valueFromAccessor.apply(this,arguments):Batman.getPath(this.base,this.segments)},c.prototype.setValue=function(a){var b;return this.depth===1?c.__super__.setValue.apply(this,arguments):(b=this.terminalProperty())!=null?b.setValue(a):void 0},c.prototype.unsetValue=function(){var a;return this.depth===1?c.__super__.unsetValue.apply(this,arguments):(a=this.terminalProperty())!=null?a.unsetValue():void 0},c}(Batman.Property)}.call(this),function(){var a=[].slice;Batman.Observable={isObservable:!0,hasProperty:function(a){var b,c;return(b=this._batman)!=null?(c=b.properties)!=null?typeof c.hasKey=="function"?c.hasKey(a):void 0:void 0:void 0},property:function(a){var b,c,d;return Batman.initializeObject(this),c=this.propertyClass||Batman.Keypath,b=(d=this._batman).properties||(d.properties=new Batman.SimpleHash),b.get(a)||b.set(a,new c(this,a))},get:function(a){return this.property(a).getValue()},set:function(a,b){return this.property(a).setValue(b)},unset:function(a){return this.property(a).unsetValue()},getOrSet:function(a,b){var c;return c=this.get(a),c||(c=b(),this.set(a,c)),c},forget:function(a,b){var c;return a?this.property(a).forget(b):(c=this._batman.properties)!=null&&c.forEach(function(a,b){return b.forget()}),this},observe:function(){var b,c,d;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],(d=this.property(c)).observe.apply(d,b),this},observeAndFire:function(){var b,c,d;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],(d=this.property(c)).observeAndFire.apply(d,b),this}}}.call(this),function(){var a=[].slice;Batman.SimpleHash=function(){function b(a){this._storage={},this.length=0,a!=null&&this.update(a)}return b.name="SimpleHash",Batman.extend(b.prototype,Batman.Enumerable),b.prototype.propertyClass=Batman.Property,b.prototype.hasKey=function(a){var b,c,d,e;if(this.objectKey(a)){if(!this._objectStorage)return!1;if(c=this._objectStorage[this.hashKeyFor(a)])for(d=0,e=c.length;d"},i.prototype.toJSON=function(){var a,c,d;c={};for(a in this){if(!b.call(this,a))continue;d=this[a],a!=="_batman"&&a!=="hashKey"&&a!=="_objectID"&&(c[a]=(d!=null?d.toJSON:void 0)?d.toJSON():d)}return c},f=function(a,b){var c,d,e,f;typeof b=="function"&&(b={get:b}),f=["cachable","cacheable"];for(d=0,e=f.length;dd?1:d>c?-1:a[0]>b[0]?1:b[0]>a[0]?-1:0},o.prototype.parseNode=function(a){var b,c,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w=this;if(this.deferEvery&&new Date-this.startTime>this.deferEvery){this.resumeNode=a,this.timeout=Batman.setImmediate(this.resume);return}if(a.getAttribute&&a.attributes){e=[],s=a.attributes;for(o=0,q=s.length;o1?[g[0],g.slice(1,g.length+1||9e9).join("-"),c.value]:[h,void 0,c.value])}u=e.sort(this._sortBindings);for(p=0,r=u.length;p=0)&&(a+="/"+b.action.toLowerCase()),a},k.prototype.urlForRecord=function(a,b){var c,d;if(a.url)d=this._execWithOptions(a,"url",b.options);else{d=a.constructor.url?this._execWithOptions(a.constructor,"url",b.options):this._defaultCollectionUrl(a.constructor);if(b.action!=="create"){if((c=a.get("id"))==null)throw new this.constructor.StorageError("Couldn't get/set record primary key on "+b.action+"!");d=d+"/"+c}}return d=this._addParams(d,b.options),this.urlPrefix(a,b)+d+this.urlSuffix(a,b)},k.prototype.urlForCollection=function(a,b){var c;return c=a.url?this._execWithOptions(a,"url",b.options):this._defaultCollectionUrl(a,b.options),c=this._addParams(c,b.options),this.urlPrefix(a,b)+c+this.urlSuffix(a,b)},k.prototype.urlPrefix=function(a,b){return this._execWithOptions(a,"urlPrefix",b.options)||""},k.prototype.urlSuffix=function(a,b){return this._execWithOptions(a,"urlSuffix",b.options)||""},k.prototype.request=function(a,b){var c;return c=Batman.extend(a.options,{success:function(b){return a.data=b},error:function(b){return a.error=b},loaded:function(){return a.response=a.request.get("response"),b()}}),a.request=new Batman.Request(c)},k.prototype.perform=function(a,b,c,d){return c||(c={}),Batman.extend(c,this.defaultRequestOptions),k.__super__.perform.call(this,a,b,c,d)},k.prototype.before("all",k.skipIfError(function(a,b){try{a.options.url=a.subject.prototype?this.urlForCollection(a.subject,a):this.urlForRecord(a.subject,a)}catch(c){a.error=c}return b()})),k.prototype.before("get","put","post","delete",k.skipIfError(function(a,b){return a.options.method=a.action.toUpperCase(),b()})),k.prototype.before("create","update",k.skipIfError(function(a,b){var c,d,e;return d=a.subject.toJSON(),(e=this.recordJsonNamespace(a.subject))?(c={},c[e]=d):c=d,this.serializeAsForm?a.options.contentType=this.constructor.PostBodyContentType:(c=JSON.stringify(c),a.options.contentType=this.constructor.JSONContentType),a.options.data=c,b()})),k.prototype.after("all",k.skipIfError(function(a,b){var c;if(a.data==null)return b();if(typeof a.data=="string"){if(a.data.length>0)try{c=this._jsonToAttributes(a.data)}catch(d){return a.error=d,b()}}else c=a.data;return a.json=c,b()})),k.prototype.after("create","read","update",k.skipIfError(function(a,b){var c,d;return a.json!=null&&(d=this.recordJsonNamespace(a.subject),c=d&&a.json[d]!=null?a.json[d]:a.json,a.subject._withoutDirtyTracking(function(){return this.fromJSON(c)})),a.result=a.subject,b()})),k.prototype.after("readAll",k.skipIfError(function(a,b){var c,d;return d=this.collectionJsonNamespace(a.subject),a.recordsAttributes=d&&a.json[d]!=null?a.json[d]:a.json,a.result=a.records=function(){var b,d,e,f;e=a.recordsAttributes,f=[];for(b=0,d=e.length;be;b=0<=e?++d:--d)c=this.storage.key(b),a.call(this,c,this.storage.getItem(c));return!0},c.prototype._storageEntriesMatching=function(a,b){var c,d;return c=this.storageRegExpForRecord(a.prototype),d=[],this._forAllStorageEntries(function(e,f){var g,h;if(h=c.exec(e)){g=this._jsonToAttributes(f),g[a.primaryKey]=h[1];if(this._dataMatches(b,g))return d.push(g)}}),d},c.prototype._dataMatches=function(a,b){var c,d,e;d=!0;for(c in a){e=a[c];if(b[c]!==e){d=!1;break}}return d},c.prototype.before("read","create","update","destroy",c.skipIfError(function(a,b){return a.action==="create"?a.id=a.subject.get("id")||a.subject.set("id",this.nextIdForRecord(a.subject)):a.id=a.subject.get("id"),a.id==null?a.error=new this.constructor.StorageError("Couldn't get/set record primary key on "+a.action+"!"):a.key=this.storageKey(a.subject)+a.id,b()})),c.prototype.before("create","update",c.skipIfError(function(a,b){return a.recordAttributes=JSON.stringify(a.subject),b()})),c.prototype.after("read",c.skipIfError(function(a,b){if(typeof a.recordAttributes=="string")try{a.recordAttributes=this._jsonToAttributes(a.recordAttributes)}catch(c){return a.error=c,b()}return a.subject._withoutDirtyTracking(function(){return this.fromJSON(a.recordAttributes)}),b()})),c.prototype.after("read","create","update","destroy",c.skipIfError(function(a,b){return a.result=a.subject,b()})),c.prototype.after("readAll",c.skipIfError(function(a,b){var c;return a.result=a.records=function(){var b,d,e,f;e=a.recordsAttributes,f=[];for(b=0,d=e.length;b"+b,c)},c.prototype.onEnter=function(a,b){return this.on("enter "+a,b)},c.prototype.onExit=function(a,b){return this.on("exit "+a,b)},c.prototype.startTransition=Batman.Property.wrapTrackingPrevention(function(a){var b,c;if(this.isTransitioning){this.nextEvents.push(a);return}return c=this.get("state"),b=this.nextStateForEvent(a),b?(this.isTransitioning=!0,this.fire("exit "+c),this.set("_state",b),this.fire(""+c+"->"+b),this.fire("enter "+b),this.fire(a),this.isTransitioning=!1,this.nextEvents.length>0&&this.startTransition(this.nextEvents.shift()),!0):!1}),c.prototype.canStartTransition=function(a,b){return b==null&&(b=this.get("state")),!!this.nextStateForEvent(a,b)},c.prototype.nextStateForEvent=function(a,b){var c;return b==null&&(b=this.get("state")),(c=this.transitionTable[a])!=null?c[b]:void 0},c}(Batman.Object),Batman.DelegatingStateMachine=function(a){function c(a,b){this.base=b,c.__super__.constructor.call(this,a)}return b(c,a),c.name="DelegatingStateMachine",c.prototype.fire=function(){var a,b;return a=c.__super__.fire.apply(this,arguments),(b=this.base).fire.apply(b,arguments),a},c}(Batman.StateMachine)}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}},b={}.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a},d=[].slice;Batman.Model=function(b){function l(b){b==null&&(b={}),this.destroy=a(this.destroy,this),this.save=a(this.save,this),this.load=a(this.load,this),Batman.typeOf(b)==="Object"?l.__super__.constructor.call(this,b):(l.__super__.constructor.call(this),this.set("id",b))}var e,f,g,h,i,j,k;c(l,b),l.name="Model",l.primaryKey="id",l.storageKey=null,l.persist=function(a,b){return Batman.initializeObject(this.prototype),a=a.isStorageAdapter?a:new a(this),b&&Batman.mixin(a,b),this.prototype._batman.storage=a,a},l.storageAdapter=function(){return Batman.initializeObject(this.prototype),this.prototype._batman.storage},l.encode=function(){var a,b,c,e,f,g,h,i,j,k,l,m,n,o;f=2<=arguments.length?d.call(arguments,0,j=arguments.length-1):(j=0,[]),b=arguments[j++],Batman.initializeObject(this.prototype),(h=this.prototype._batman).encoders||(h.encoders=new Batman.SimpleHash),(i=this.prototype._batman).decoders||(i.decoders=new Batman.SimpleHash),a={};switch(Batman.typeOf(b)){case"String":f.push(b);break;case"Function":a.encode=b;break;default:b.encode!=null&&(a.encode=b.encode),b.decode!=null&&(a.decode=b.decode)}a=Batman.extend({},this.defaultEncoder,a),o=["encode","decode"];for(k=0,m=o.length;k0)return this.fire.apply(this,["itemsWereAdded"].concat(c.call(b)))}),m.prototype.replace=m.mutation(function(a){var b,d;b=[],d=[],this._preventMutationEvents(function(){var c=this;return this.forEach(function(b,e){if(!Batman.objectHasKey(a,b))return c.unset(b),d.push(b)}),Batman.forEach(a,function(a,d){return c.hasKey(a)||b.push(a),c.set(a,d)})}),b.length>0&&this.fire.apply(this,["itemsWereAdded"].concat(c.call(b)));if(d.length>0)return this.fire.apply(this,["itemsWereRemoved"].concat(c.call(d)))}),j=["equality","hashKeyFor","objectKey","prefixedKey","unprefixedKey"];for(f=0,h=j.length;fb?1:a0)return a.call(b,d,e,c)})},d.prototype.toArray=function(){var a;return a=[],this._storage.forEach(function(b,c){if(c.get("length")>0)return a.push(b)}),a},d.prototype._addItem=function(a){return this._addItemToKey(a,this._keyForItem(a))},d.prototype._addItemToKey=function(a,b){return this._resultSetForKey(b).add(a)},d.prototype._removeItem=function(a){return this._removeItemFromKey(a,this._keyForItem(a))},d.prototype._removeItemFromKey=function(a,b){return this._resultSetForKey(b).remove(a)},d.prototype._resultSetForKey=function(a){return this._storage.getOrSet(a,function(){return new Batman.Set})},d.prototype._keyForItem=function(a){return Batman.Keypath.forBaseAndKey(a,this.key).getValue()},d}(Batman.Object)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.PolymorphicAssociationSetIndex=function(a){function c(a,b,d){this.association=a,this.type=b,c.__super__.constructor.call(this,this.association.getRelatedModelForType(b).get("loaded"),d)}return b(c,a),c.name="PolymorphicAssociationSetIndex",c.prototype._resultSetForKey=function(a){var b=this;return this._storage.getOrSet(a,function(){return new Batman.PolymorphicAssociationSet(a,b.type,b.association)})},c}(Batman.SetIndex)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.AssociationSetIndex=function(a){function c(a,b){this.association=a,c.__super__.constructor.call(this,this.association.getRelatedModel().get("loaded"),b)}return b(c,a),c.name="AssociationSetIndex",c.prototype._resultSetForKey=function(a){var b=this;return this._storage.getOrSet(a,function(){return new Batman.AssociationSet(a,b.association)})},c.prototype._setResultSet=function(a,b){return this._storage.set(a,b)},c}(Batman.SetIndex)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.UniqueSetIndex=function(a){function c(){this._uniqueIndex=new Batman.Hash,c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="UniqueSetIndex",c.accessor(function(a){return this._uniqueIndex.get(a)}),c.prototype._addItemToKey=function(a,b){this._resultSetForKey(b).add(a);if(!this._uniqueIndex.hasKey(b))return this._uniqueIndex.set(b,a)},c.prototype._removeItemFromKey=function(a,b){var d;return d=this._resultSetForKey(b),c.__super__._removeItemFromKey.apply(this,arguments),d.isEmpty()?this._uniqueIndex.unset(b):this._uniqueIndex.set(b,d.toArray()[0])},c}(Batman.SetIndex)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.UniqueAssociationSetIndex=function(a){function c(a,b){this.association=a,c.__super__.constructor.call(this,this.association.getRelatedModel().get("loaded"),b)}return b(c,a),c.name="UniqueAssociationSetIndex",c}(Batman.UniqueSetIndex)}.call(this),function(){Batman.URI=function(){function g(b){var c,d;d=f.exec(b),c=14;while(c--)this[a[c]]=d[c]||""}var a,b,c,d,e,f;return g.name="URI",g.paramsFromQuery=function(a){var b,c;return c={},b=this.decodeQueryComponent,a.replace(d,function(a,d,e){if(d)return c[b(d)]=b(e)}),c},g.queryFromParams=function(a){var b,c,d;return b=this.encodeQueryComponent,function(){var e;e=[];for(c in a)d=a[c],e.push(""+b(c)+"="+b(d));return e}().join("&")},f=/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,a=["source","protocol","authority","userInfo","user","password","hostname","port","relative","path","directory","file","query","hash"],d=/(?:^|&)([^&=]*)=?([^&]*)/g,c=/\+/g,e=/%20/g,g.prototype.queryParams=function(){return this.constructor.paramsFromQuery(this.query)},g.decodeQueryComponent=function(a){return decodeURIComponent(a.replace(c,"%20"))},g.encodeComponent=b=function(a){return a!=null?encodeURIComponent(a):""},g.encodeQueryComponent=function(a){return b(a).replace(e,"+")},g}()}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.Request=function(a){function d(a){var b,c,e;c={};for(e in a){b=a[e];if(e!=="success"&&e!=="error"&&e!=="loading"&&e!=="loaded")continue;c[e]=b,delete a[e]}d.__super__.constructor.call(this,a);for(e in c)b=c[e],this.on(e,b)}var c;return b(d,a),d.name="Request",d.objectToFormData=function(a){var b,c,d,e,f,g,h,i;d=function(a,b,c){var e,f,g;return c==null&&(c=!1),f=function(){switch(Batman.typeOf(b)){case"Object":return f=function(){var f;f=[];for(e in b)g=b[e],f.push(d(c?e:""+a+"["+e+"]",g));return f}(),f.reduce(function(a,b){return a.concat(b)},[]);case"Array":return b.reduce(function(b,c){return b.concat(d(""+a+"[]",c))},[]);default:return[[a,b]]}}()},b=new Batman.container.FormData,h=d("",a,!0);for(f=0,g=h.length;f0&&(d=a.split(".")).length>0?(c=d.shift(),this.childrenByName[c]||(this.childrenByName[c]=new Batman.RouteMap),this.childrenByName[c].addRoute(d.join("."),b)):b.get("member")?this.memberRoute=b:this.collectionRoute=b,!0},a}()}.call(this),function(){var a=[].slice;Batman.RouteMapBuilder=function(){function b(a,b,c,d){this.app=a,this.routeMap=b,this.parent=c,this.baseOptions=d!=null?d:{},this.parent?(this.rootPath=this.parent._nestingPath(),this.rootName=this.parent._nestingName()):(this.rootPath="",this.rootName="")}return b.name="RouteMapBuilder",b.BUILDER_FUNCTIONS=["resources","member","collection","route","root"],b.ROUTES={index:{cardinality:"collection",path:function(a){return a},name:function(a){return a}},"new":{cardinality:"collection",path:function(a){return""+a+"/new"},name:function(a){return""+a+".new"}},show:{cardinality:"member",path:function(a){return""+a+"/:id"},name:function(a){return a}},edit:{cardinality:"member",path:function(a){return""+a+"/:id/edit"},name:function(a){return""+a+".edit"}},collection:{cardinality:"collection",path:function(a,b){return""+a+"/"+b},name:function(a,b){return""+a+"."+b}},member:{cardinality:"member",path:function(a,b){return""+a+"/:id/"+b},name:function(a,b){return""+a+"."+b}}},b.prototype.resources=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A;e=1<=arguments.length?a.call(arguments,0):[],o=function(){var a,b,c;c=[];for(a=0,b=e.length;a0)return Batman.navigator.start()})),this.observe("layout",function(a){return a!=null?a.on("ready",function(){return c.fire("ready")}):void 0}),a=this.get("layout"),a?typeof a=="string"&&(b=this[Batman.helpers.camelize(a)+"View"]):a!==null&&(b=Batman.View),b&&(a=this.set("layout",new b({context:this,node:document}))),this.hasRun=!0,this.fire("run"),this)},i.event("ready").oneShot=!0,i.event("stop").oneShot=!0,i.stop=function(){var a;return(a=this.navigator)!=null&&a.stop(),Batman.navigator=null,this.hasRun=!1,this.fire("stop"),this},i}.call(this,Batman.Object)}.call(this),function(){Batman.Association=function(){function a(a,b,c){var d,e,f,g;this.model=a,this.label=b,c==null&&(c={}),d={namespace:Batman.currentApp,name:Batman.helpers.camelize(Batman.helpers.singularize(this.label))},this.options=Batman.extend(d,this.defaultOptions,c),this.model.encode(b,this.encoder()),f=this,e=function(){return f.getAccessor.call(this,f,this.model,this.label)},this.model.accessor(this.label,{get:e,set:a.defaultAccessor.set,unset:a.defaultAccessor.unset}),this.url&&((g=this.model).url||(g.url=function(a){return f.url(a)}))}return a.name="Association",a.prototype.associationType="",a.prototype.isPolymorphic=!1,a.prototype.defaultOptions={saveInline:!0,autoload:!0},a.prototype.getRelatedModel=function(){var a,b,c;return c=this.options.namespace||Batman.currentApp,a=this.options.name,b=c!=null?c[a]:void 0,b},a.prototype.getFromAttributes=function(a){return a.get("attributes."+this.label)},a.prototype.setIntoAttributes=function(a,b){return a.get("attributes").set(this.label,b)},a.prototype.encoder=function(){},a.prototype.setIndex=function(){},a.prototype.inverse=function(){var a,b,c=this;if(b=this.getRelatedModel()._batman.get("associations"))return this.options.inverseOf?b.getByLabel(this.options.inverseOf):(a=null,b.forEach(function(b,d){if(d.getRelatedModel()===c.model)return a=d}),a)},a.prototype.reset=function(){return delete this.index,!0},a}()}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.PluralAssociation=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="PluralAssociation",c.prototype.isSingular=!1,c.prototype.setForRecord=Batman.Property.wrapTrackingPrevention(function(a){var b;return(b=a.get(this.primaryKey))?this.setIndex().get(b):new Batman.AssociationSet(void 0,this)}),c.prototype.getAccessor=function(a,b,c){var d,e,f=this;if(!a.getRelatedModel())return;return(e=a.getFromAttributes(this))?e:(d=a.setForRecord(this),a.setIntoAttributes(this,d),Batman.Property.withoutTracking(function(){if(a.options.autoload&&!f.isNew()&&!d.loaded)return d.load(function(a,b){if(a)throw a})}),d)},c.prototype.setIndex=function(){return this.index||(this.index=new Batman.AssociationSetIndex(this,this[this.indexRelatedModelOn])),this.index},c}(Batman.Association)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.HasManyAssociation=function(a){function c(a,b,d){if(d!=null?d.as:void 0)return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b),f=typeof e;return f=="object"||f=="function"?e||d:d}(Batman.PolymorphicHasManyAssociation,arguments,function(){});c.__super__.constructor.apply(this,arguments),this.primaryKey=this.options.primaryKey||"id",this.foreignKey=this.options.foreignKey||""+Batman.helpers.underscore(a.get("resourceName"))+"_id"}return b(c,a),c.name="HasManyAssociation",c.prototype.associationType="hasMany",c.prototype.indexRelatedModelOn="foreignKey",c.prototype.apply=function(a,b){var c,d=this;if(!a)return(c=this.getFromAttributes(b))&&c.forEach(function(a){return a.set(d.foreignKey,b.get(d.primaryKey))}),b.set(this.label,this.setForRecord(b))},c.prototype.encoder=function(){var a;return a=this,{encode:function(b,c,d,e){var f;if(a._beingEncoded)return;a._beingEncoded=!0;if(!a.options.saveInline)return;return b!=null&&(f=[],b.forEach(function(b){var c;return c=b.toJSON(),c[a.foreignKey]=e.get(a.primaryKey),f.push(c)})),delete a._beingEncoded,f},decode:function(b,c,d,e,f){var g,h,i,j,k,l,m,n,o;if(l=a.getRelatedModel()){h=a.getFromAttributes(f)||a.setForRecord(f),j=h.filter(function(a){return a.isNew()}).toArray();for(n=0,o=b.length;n0&&(m=j.shift(),m._withoutDirtyTracking(function(){return this.fromJSON(i)}),k=m),k=l._mapIdentity(k),h.add(k),a.options.inverseOf&&k.set(a.options.inverseOf,f);h.set("loaded",!0)}return h}}},c}(Batman.PluralAssociation)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.PolymorphicHasManyAssociation=function(a){function c(a,b,d){d.inverseOf=this.foreignLabel=d.as,delete d.as,d.foreignKey||(d.foreignKey=""+this.foreignLabel+"_id"),c.__super__.constructor.call(this,a,b,d),this.foreignTypeKey=d.foreignTypeKey||""+this.foreignLabel+"_type",this.model.encode(this.foreignTypeKey)}return b(c,a),c.name="PolymorphicHasManyAssociation",c.prototype.isPolymorphic=!0,c.prototype.apply=function(a,b){var d,e=this;return!a&&(d=this.getFromAttributes(b))&&(c.__super__.apply.apply(this,arguments),d.forEach(function(a){return a.set(e.foreignTypeKey,e.modelType())})),!0},c.prototype.getRelatedModelForType=function(){return this.getRelatedModel()},c.prototype.modelType=function(){return this.model.get("resourceName")},c.prototype.setIndex=function(){return this.typeIndex||(this.typeIndex=new Batman.PolymorphicAssociationSetIndex(this,this.modelType(),this[this.indexRelatedModelOn])),this.typeIndex},c.prototype.encoder=function(){var a,b;return a=this,b=c.__super__.encoder.apply(this,arguments),b.encode=function(b,c,d,e){var f;if(a._beingEncoded)return;a._beingEncoded=!0;if(!a.options.saveInline)return;return b!=null&&(f=[],b.forEach(function(b){var c;return c=b.toJSON(),c[a.foreignKey]=e.get(a.primaryKey),c[a.foreignTypeKey]=a.modelType(),f.push(c)})),delete a._beingEncoded,f},b},c}(Batman.HasManyAssociation)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.SingularAssociation=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="SingularAssociation",c.prototype.isSingular=!0,c.prototype.getAccessor=function(a,b,c){var d,e;if(e=a.getFromAttributes(this))return e;if(a.getRelatedModel())return d=this.associationProxy(a),Batman.Property.withoutTracking(function(){if(!d.get("loaded")&&a.options.autoload)return d.load()}),d},c.prototype.setIndex=function(){return this.index||(this.index=new Batman.UniqueAssociationSetIndex(this,this[this.indexRelatedModelOn])),this.index},c}(Batman.Association)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.HasOneAssociation=function(a){function c(){c.__super__.constructor.apply(this,arguments),this.primaryKey=this.options.primaryKey||"id",this.foreignKey=this.options.foreignKey||""+Batman.helpers.underscore(this.model.get("resourceName"))+"_id"}return b(c,a),c.name="HasOneAssociation",c.prototype.associationType="hasOne",c.prototype.proxyClass=Batman.HasOneProxy,c.prototype.indexRelatedModelOn="foreignKey",c.prototype.apply=function(a,b){var c;if(c=this.getFromAttributes(b))return c.set(this.foreignKey,b.get(this.primaryKey))},c.prototype.encoder=function(){var a;return a=this,{encode:function(b,c,d,e){var f;if(!a.options.saveInline)return;if(f=b.toJSON())f[a.foreignKey]=e.get(a.primaryKey);return f},decode:function(b,c,d,e,f){var g,h;return h=a.getRelatedModel(),g=new h,g._withoutDirtyTracking(function(){return this.fromJSON(b)}),a.options.inverseOf&&g.set(a.options.inverseOf,f),g=h._mapIdentity(g),g}}},c}(Batman.SingularAssociation)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.BelongsToAssociation=function(a){function c(a,b,d){if(d!=null?d.polymorphic:void 0)return delete d.polymorphic,function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b),f=typeof e;return f=="object"||f=="function"?e||d:d}(Batman.PolymorphicBelongsToAssociation,arguments,function(){});c.__super__.constructor.apply(this,arguments),this.foreignKey=this.options.foreignKey||""+this.label+"_id",this.primaryKey=this.options.primaryKey||"id",this.model.encode(this.foreignKey)}return b(c,a),c.name="BelongsToAssociation",c.prototype.associationType="belongsTo",c.prototype.proxyClass=Batman.BelongsToProxy,c.prototype.indexRelatedModelOn="primaryKey",c.prototype.defaultOptions={saveInline:!1,autoload:!0},c.prototype.url=function(a){var b,c,d,e,f,g;if(e=this.inverse())return f=Batman.helpers.pluralize(this.label),d=(g=a.data)!=null?g[this.foreignKey]:void 0,c=e.isSingular?"singularize":"pluralize",b=Batman.helpers[c](e.label),"/"+f+"/"+d+"/"+b},c.prototype.encoder=function(){var a,b;return a=this,b={encode:!1,decode:function(b,c,d,e,f){var g,h,i;return i=a.getRelatedModel(),h=new i,h._withoutDirtyTracking(function(){return this.fromJSON(b)}),h=i._mapIdentity(h),a.options.inverseOf&&(g=a.inverse())&&(g instanceof Batman.HasManyAssociation?f.set(a.foreignKey,h.get(a.primaryKey)):h.set(g.label,f)),f.set(a.label,h),h}},this.options.saveInline&&(b.encode=function(a){return a.toJSON()}),b},c.prototype.apply=function(a){var b,c;if(c=a.get(this.label)){b=c.get(this.primaryKey);if(b!==void 0)return a.set(this.foreignKey,b)}},c}(Batman.SingularAssociation)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.PolymorphicBelongsToAssociation=function(a){function c(){c.__super__.constructor.apply(this,arguments),this.foreignTypeKey=this.options.foreignTypeKey||""+this.label+"_type",this.model.encode(this.foreignTypeKey),this.typeIndicies={}}return b(c,a),c.name="PolymorphicBelongsToAssociation",c.prototype.isPolymorphic=!0,c.prototype.proxyClass=Batman.PolymorphicBelongsToProxy,c.prototype.getRelatedModel=!1,c.prototype.setIndex=!1,c.prototype.inverse=!1,c.prototype.apply=function(a){var b,d,e;c.__super__.apply.apply(this,arguments);if(d=a.get(this.label))return d instanceof Batman.AssociationProxy?e=d.association.model:e=d.constructor,b=e.get("resourceName"),a.set(this.foreignTypeKey,b)},c.prototype.getAccessor=function(a,b,c){var d,e;if(e=a.getFromAttributes(this))return e;if(a.getRelatedModelForType(this.get(a.foreignTypeKey)))return d=this.associationProxy(a),Batman.Property.withoutTracking(function(){if(!d.get("loaded")&&a.options.autoload)return d.load()}),d},c.prototype.url=function(a){var b,c,d,e,f,g,h,i;g=(h=a.data)!=null?h[this.foreignTypeKey]:void 0;if(g&&(e=this.inverseForType(g)))return f=Batman.helpers.pluralize(g).toLowerCase(),d=(i=a.data)!=null?i[this.foreignKey]:void 0,c=e.isSingular?"singularize":"pluralize",b=Batman.helpers[c](e.label),"/"+f+"/"+d+"/"+b},c.prototype.getRelatedModelForType=function(a){var b,c;return c=this.options.namespace||Batman.currentApp,a&&(b=c!=null?c[a]:void 0,b||(b=c!=null?c[Batman.helpers.camelize(a)]:void 0)),b},c.prototype.setIndexForType=function(a){var b;return(b=this.typeIndicies)[a]||(b[a]=new Batman.PolymorphicUniqueAssociationSetIndex(this,a,this.primaryKey)),this.typeIndicies[a]},c.prototype.inverseForType=function(a){var b,c,d,e=this;if(c=(d=this.getRelatedModelForType(a))!=null?d._batman.get("associations"):void 0)return this.options.inverseOf?c.getByLabel(this.options.inverseOf):(b=null,c.forEach(function(a,c){if(c.getRelatedModel()===e.model)return b=c}),b)},c.prototype.encoder=function(){var a,b;return a=this,b={encode:!1,decode:function(b,c,d,e,f){var g,h,i,j;return g=d[a.foreignTypeKey]||f.get(a.foreignTypeKey),j=a.getRelatedModelForType(g),i=new j,i._withoutDirtyTracking(function(){return this.fromJSON(b)}),i=j._mapIdentity(i),a.options.inverseOf&&(h=a.inverseForType(g))&&(h instanceof Batman.PolymorphicHasManyAssociation?(f.set(a.foreignKey,i.get(a.primaryKey)),f.set(a.foreignTypeKey,g)):i.set(h.label,f)),f.set(a.label,i),i}},this.options.saveInline&&(b.encode=function(a){return a.toJSON()}),b},c}(Batman.BelongsToAssociation)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.PolymorphicUniqueAssociationSetIndex=function(a){function c(a,b,d){this.association=a,this.type=b,c.__super__.constructor.call(this,this.association.getRelatedModelForType(b).get("loaded"),d)}return b(c,a),c.name="PolymorphicUniqueAssociationSetIndex",c}(Batman.UniqueSetIndex)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b},c=[].slice;Batman.Validator=function(a){function d(){var a;options=arguments[0],a=2<=arguments.length?c.call(arguments,1):[],this.options=options,d.__super__.constructor.apply(this,a)}return b(d,a),d.name="Validator",d.prototype.validate=function(a){},d.prototype.format=function(a,b,c){return Batman.t("errors.format",{attribute:a,message:Batman.t("errors.messages."+b,c)})},d.options=function(){var a;return a=1<=arguments.length?c.call(arguments,0):[],Batman.initializeObject(this),this._batman.options?this._batman.options.concat(a):this._batman.options=a},d.matches=function(a){var b,c,d,e,f,g;c={},d=!1;for(b in a)e=a[b],~((f=this._batman)!=null?(g=f.options)!=null?g.indexOf(b):void 0:void 0)&&(c[b]=e,d=!0);if(d)return c},d}(Batman.Object)}.call(this),function(){Batman.Validators=[],Batman.extend(Batman.translate.messages,{errors:{format:"%{attribute} %{message}",messages:{too_short:"must be at least %{count} characters",too_long:"must be less than %{count} characters",wrong_length:"must be %{count} characters",blank:"can't be blank",not_numeric:"must be a number"}}})}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.PresenceValidator=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="PresenceValidator",c.options("presence"),c.prototype.validateEach=function(a,b,c,d){var e;return e=b.get(c),this.options.presence&&(e==null||e==="")&&a.add(c,this.format(c,"blank")),d()},c}(Batman.Validator),Batman.Validators.push(Batman.PresenceValidator)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.NumericValidator=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="NumericValidator",c.options("numeric"),c.prototype.validateEach=function(a,b,c,d){var e;return e=b.get(c),this.options.numeric&&isNaN(parseFloat(e))&&a.add(c,this.format(c,"not_numeric")),d()},c}(Batman.Validator),Batman.Validators.push(Batman.NumericValidator)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.LengthValidator=function(a){function c(a){var b;if(b=a.lengthIn||a.lengthWithin)a.minLength=b[0],a.maxLength=b[1]||-1,delete a.lengthWithin,delete a.lengthIn;c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="LengthValidator",c.options("minLength","maxLength","length","lengthWithin","lengthIn"),c.prototype.validateEach=function(a,b,c,d){var e,f,g;return e=this.options,f=(g=b.get(c))!=null?g:[],e.minLength&&f.lengthe.maxLength&&a.add(c,this.format(c,"too_long",{count:e.maxLength})),e.length&&f.length!==e.length&&a.add(c,this.format(c,"wrong_length",{count:e.length})),d()},c}(Batman.Validator),Batman.Validators.push(Batman.LengthValidator)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.RenderCache=function(a){function c(){c.__super__.constructor.apply(this,arguments),this.keyQueue=[]}return b(c,a),c.name="RenderCache",c.prototype.maximumLength=4,c.prototype.viewForOptions=function(a){var b=this;return this.getOrSet(a,function(){return b._newViewFromOptions(Batman.extend({},a))})},c.prototype._newViewFromOptions=function(a){return new a.viewClass(a)},c.wrapAccessor(function(a){return{cache:!1,get:function(b){var c;return c=a.get.call(this,b),c&&this._addOrBubbleKey(b),c},set:function(b,c){var d;return d=a.set.apply(this,arguments),d.set("cached",!0),this._addOrBubbleKey(b),this._evictExpiredKeys(),d},unset:function(b){var c;return c=a.unset.apply(this,arguments),c.set("cached",!1),this._removeKeyFromQueue(b),c}}}),c.prototype.equality=function(a,b){var c;if(Object.keys(a).length!==Object.keys(b).length)return!1;for(c in a)if(c!=="view"&&a[c]!==b[c])return!1;return!0},c.prototype._addOrBubbleKey=function(a){return this._removeKeyFromQueue(a),this.keyQueue.unshift(a)},c.prototype._removeKeyFromQueue=function(a){var b,c,d,e,f;f=this.keyQueue;for(b=d=0,e=f.length;dthis.maximumLength){a=this.keyQueue.slice(0);for(b=d=e=this.maximumLength,f=a.length;e<=f?df;b=e<=f?++d:--d)c=a[b],this.get(c).isInDOM()||this.unset(c)}},c}(Batman.Hash)}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}},b={}.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a},d=[].indexOf||function(a){for(var b=0,c=this.length;b=0)return;return g=e.block,typeof g=="function"?g.call(f,b):typeof f[g]=="function"?f[g](b):void 0})},f}(Batman.Object)}.call(this),function(){Batman.DOM={textInputTypes:["text","search","tel","url","email","password"],partial:function(a,b,c,d){var e;return d.prevent("rendered"),e=new Batman.View({source:b,context:c}),e.on("ready",function(){return Batman.setInnerHTML(a,""),Batman.appendChild(a,e.get("node")),d.allowAndFire("rendered")})},propagateBindingEvent:Batman.propagateBindingEvent=function(a,b){var c,d,e,f,g;while(c=(c||b).parentNode){e=Batman._data(c,"bindings");if(e!=null)for(f=0,g=e.length;f1;switch(a.nodeName.toUpperCase()){case"INPUT":case"TEXTAREA":return d?a.value=b:a.value;case"SELECT":if(d)return a.value=b;break;default:return d?Batman.setInnerHTML(a,c?Batman.escapeHTML(b):b):a.innerHTML}},nodeIsEditable:function(a){var b;return(b=a.nodeName.toUpperCase())==="INPUT"||b==="TEXTAREA"||b==="SELECT"},addEventListener:Batman.addEventListener=function(a,b,c){var d;return(d=Batman._data(a,"listeners"))||(d=Batman._data(a,"listeners",{})),d[b]||(d[b]=[]),d[b].push(c),Batman.hasAddEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},removeEventListener:Batman.removeEventListener=function(a,b,c){var d,e,f;if(f=Batman._data(a,"listeners"))if(d=f[b])e=d.indexOf(c),e!==-1&&d.splice(e,1);return Batman.hasAddEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c)},hasAddEventListener:Batman.hasAddEventListener=typeof window!="undefined"&&window!==null?!!window.addEventListener:!!void 0,preventDefault:Batman.preventDefault=function(a){return typeof a.preventDefault=="function"?a.preventDefault():a.returnValue=!1},stopPropagation:Batman.stopPropagation=function(a){return a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},willInsertNode:function(a){var b,c,d,e,f,g;c=Batman._data(a,"view"),c!=null&&c.fire("beforeAppear",a),(f=Batman.data(a,"show"))!=null&&f.call(a),g=a.childNodes;for(d=0,e=g.length;d=0)?(h=d,d=function(a){var b;if(a.type==="keyup"&&13<=(b=a.keyCode)&&b<=14)return;return h.apply(null,arguments)},["keyup","change"]):["change"];default:return["change"]}}(),k=[];for(i=0,j=g.length;i0?(b=this.filterFunctions.reduce(function(b,d,e){var f;return f=c.filterArguments[e].map(function(a){return a._keypath?c.renderContext.get(a._keypath):a}),f.unshift(b),f.push(c),d.apply(a,f)},d),b):d},set:function(a,b){return this.set("unfilteredValue",b)}}),g.accessor("unfilteredValue",{get:function(){var a;return(a=this.get("key"))?Batman.RenderContext.deProxy(Batman.getPath(this,["keyContext",a])):this.get("value")},set:function(a,b){var c,d,e;if(!(c=this.get("key")))return this.set("value",b);d=this.get("keyContext");if(d&&d!==Batman.container)return e=Batman.Property.forBaseAndKey(d,c),e.setValue(b)}}),g.accessor("keyContext",function(){return this.renderContext.contextForKey(this.key)}),g.prototype.bindImmediately=!0,g.prototype.shouldSet=!0,g.prototype.isInputBinding=!1,g.prototype.escapeValue=!0,g.prototype.isTwoWay=function(){return this.key!=null&&this.filterFunctions.length===0},g.prototype.bind=function(){var a,b;this.node!=null&&((a=this.only)===!1||a==="nodeChange")&&Batman.DOM.nodeIsEditable(this.node)&&(Batman.DOM.events.change(this.node,this._fireNodeChange,this.renderContext),this.only==="nodeChange"&&this._fireNodeChange()),((b=this.only)===!1||b==="dataChange")&&this.observeAndFire("filteredValue",this._fireDataChange);if(this.node!=null)return Batman.DOM.trackBinding(this,this.node)},g.prototype._fireNodeChange=function(){var a;return this.shouldSet=!1,a=this.value||this.get("keyContext"),typeof this.nodeChange=="function"&&this.nodeChange(this.node,a),this.fire("nodeChange",this.node,a),this.shouldSet=!0},g.prototype._fireDataChange=function(a){if(this.shouldSet)return typeof this.dataChange=="function"&&this.dataChange(a,this.node),this.fire("dataChange",a,this.node)},g.prototype.die=function(){var a;return this.forget(),(a=this._batman.properties)!=null&&a.forEach(function(a,b){return b.die()}),this.fire("die"),!0},g.prototype.parseFilter=function(){var a,b,c,f,g,h,i,j,k;this.filterFunctions=[],this.filterArguments=[],i=this.keyPath;while(d.test(i))i=i.replace(d,"]['$1']");g=i.replace(e," | get $1 ").replace(/'/g,'"').split(/(?!")\s+\|\s+(?!")/);try{h=this.parseSegment(j=g.shift())[0]}catch(l){}h&&h._keypath?this.key=h._keypath:this.value=h;if(g.length){while(f=g.shift()){k=f.indexOf(" "),~k?(c=f.substr(0,k),a=f.substr(k)):c=f;if(b=Batman.Filters[c]){this.filterFunctions.push(b);if(a)try{this.filterArguments.push(this.parseSegment(a))}catch(l){}else this.filterArguments.push([])}}return!0}},g.prototype.parseSegment=function(a){return a=a.replace(f,function(a,b,c,d,e,f,g){var h;return b==null&&(b=""),h=f?'{"_keypath": "'+f+'"}':c||d||e,b+h}),JSON.parse("["+a+"]")},g}(Batman.Object)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.DOM.ViewBinding=function(a){function c(){c.__super__.constructor.apply(this,arguments),this.renderer.prevent("rendered"),this.node.removeAttribute("data-view")}return b(c,a),c.name="ViewBinding",c.prototype.dataChange=function(a){var b=this;if(a==null)return;return a.isView?(this.view=a,this.view.set("context",this.renderContext),this.view.set("node",this.node)):this.view=new a({node:this.node,context:this.renderContext,parentView:this.renderer.view}),this.view.on("ready",function(){return b.renderer.allowAndFire("rendered")}),this.die()},c}(Batman.DOM.AbstractBinding)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.DOM.ViewArgumentBinding=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="ViewArgumentBinding",c}(Batman.DOM.AbstractBinding)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.DOM.ShowHideBinding=function(a){function c(a,b,d,e,f,g){var h;this.invert=g!=null?g:!1,h=a.style.display;if(!h||h==="none")h="";this.originalDisplay=h,c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="ShowHideBinding",c.prototype.dataChange=function(a){var b,c,d;return c=Batman._data(this.node,"view"),!!a==!this.invert?(c!=null&&c.fire("beforeAppear",this.node),(d=Batman.data(this.node,"show"))!=null&&d.call(this.node),this.node.style.display=this.originalDisplay,c!=null?c.fire("appear",this.node):void 0):(c!=null&&c.fire("beforeDisappear",this.node),typeof (b=Batman.data(this.node,"hide"))=="function"?b.call(this.node):Batman.setStyleProperty(this.node,"display","none","important"),c!=null?c.fire("disappear",this.node):void 0)},c}(Batman.DOM.AbstractBinding)}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}},b={}.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};Batman.DOM.SelectBinding=function(b){function d(){this.updateOptionBindings=a(this.updateOptionBindings,this),this.nodeChange=a(this.nodeChange,this),this.dataChange=a(this.dataChange,this),this.childBindingAdded=a(this.childBindingAdded,this),this.selectedBindings=new Batman.SimpleSet,d.__super__.constructor.apply(this,arguments)}return c(d,b),d.name="SelectBinding",d.prototype.isInputBinding=!0,d.prototype.firstBind=!0,d.prototype.childBindingAdded=function(a){var b,c=this;if(a instanceof Batman.DOM.CheckedBinding)a.on("dataChange",b=function(){return c.nodeChange()}),a.on("die",function(){return a.forget("dataChange",b),c.selectedBindings.remove(a)}),this.selectedBindings.add(a);else{if(!(a instanceof Batman.DOM.IteratorBinding))return;a.on("nodeAdded",b=function(){return c._fireDataChange(c.get("filteredValue"))}),a.on("nodeRemoved",b),a.on("die",function(){return a.forget("nodeAdded",b),a.forget("nodeRemoved",b)})}return this._fireDataChange(this.get("filteredValue"))},d.prototype.dataChange=function(a){var b,c,d,e,f,g,h,i=this;if(a!=null?a.forEach:void 0){d={},h=this.node.children;for(e=0,f=h.length;e\n
  • \n'},d}(Batman.DOM.AbstractAttributeBinding)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.DOM.EventBinding=function(a){function c(a,b,d,e){var f,g,h,i=this;c.__super__.constructor.apply(this,arguments),h=this.node.getAttribute("data-confirm"),g=function(){var a;if(h&&!confirm(h))return;return(a=i.get("filteredValue"))!=null?a.apply(i.get("callbackContext"),arguments):void 0},(f=Batman.DOM.events[this.attributeName])?f(this.node,g,e):Batman.DOM.events.other(this.node,this.attributeName,g,e),this.bind()}return b(c,a),c.name="EventBinding",c.prototype.bindImmediately=!1,c.accessor("callbackContext",function(){var a;return a=this.key.split("."),a.pop(),a.length>0?this.get("keyContext").get(a.join(".")):this.get("keyContext")}),c.wrapAccessor("unfilteredValue",function(a){return{get:function(){var b,c,d,e;if(c=this.get("key")){e=c.split(".");if(e.length>1){b=e.pop(),d=Batman.getPath(this,["keyContext"].concat(e));if(d!=null)return d=Batman.RenderContext.deProxy(d),d[b]}}return a.get.apply(this,arguments)}}}),c}(Batman.DOM.AbstractAttributeBinding)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.DOM.NodeAttributeBinding=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="NodeAttributeBinding",c.prototype.dataChange=function(a){return a==null&&(a=""),this.node[this.attributeName]=a},c.prototype.nodeChange=function(a){if(this.isTwoWay())return this.set("filteredValue",Batman.DOM.attrReaders._parseAttribute(a[this.attributeName]))},c}(Batman.DOM.AbstractAttributeBinding)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.DOM.CheckedBinding=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="CheckedBinding",c.prototype.isInputBinding=!0,c.prototype.dataChange=function(a){return this.node[this.attributeName]=!!a},c}(Batman.DOM.NodeAttributeBinding)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.DOM.AttributeBinding=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="AttributeBinding",c.prototype.dataChange=function(a){return this.node.setAttribute(this.attributeName,a)},c.prototype.nodeChange=function(a){if(this.isTwoWay())return this.set("filteredValue",Batman.DOM.attrReaders._parseAttribute(a.getAttribute(this.attributeName)))},c}(Batman.DOM.AbstractAttributeBinding)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};Batman.DOM.AddClassBinding=function(a){function c(a,b,d,e,f,g,h){var i,j;this.invert=h!=null?h:!1,j=b.split("|"),this.classes=function(){var a,b,c;c=[];for(a=0,b=j.length;ac.actionNumber?this.actions[c.actionNumber]=function(){}:(d&&this.cancelExistingItemActions(a),this.actionMap.set(a,c.actionNumber),this.actions[c.actionNumber]=function(){var d,e;return c.fragment?this.fragment.appendChild(b):c.fragment?this.fragment.appendChild(b):(Batman.insertBefore(this.parentNode(),b,this.siblingNode),Batman.propagateBindingEvents(b)),(d=b.getAttribute("data-additem"))&&(e=this.renderer.context.contextForKey(d))!=null&&typeof e[d]=="function"&&e[d](a,b),this.fire("nodeAdded",b,a)},this.actions[c.actionNumber].item=a),this.processActionQueue()},f.prototype.cancelExistingItem=function(a){return this.cancelExistingItemActions(a),this.cancelExistingItemRender(a)},f.prototype.cancelExistingItemActions=function(a){var b;return b=this.actionMap.get(a),b!=null&&b>=this.currentActionNumber&&(this.actions[b]=!1),this.actionMap.unset(a)},f.prototype.cancelExistingItemRender=function(a){var b;return b=this.rendererMap.get(a),b&&(b.stop(),Batman.destroyNode(b.node)),this.rendererMap.unset(a)},f.prototype.processActionQueue=function(){var a=this;if(this.dead)return;if(!this.actionQueueTimeout)return this.actionQueueTimeout=Batman.setImmediate(function(){var b,c,d,e,f,g;if(a.dead)return;delete a.actionQueueTimeout,e=new Date;while((c=a.actions[a.currentActionNumber])!=null){delete a.actions[a.currentActionNumber],a.actionMap.unset(c.item),c&&c.call(a),a.currentActionNumber++;if(a.deferEvery&&new Date-e>a.deferEvery)return a.processActionQueue()}if(a.fragment&&a.rendererMap.length===0&&a.fragment.hasChildNodes()){b=Array.prototype.slice.call(a.fragment.childNodes),Batman.insertBefore(a.parentNode(),a.fragment,a.siblingNode);for(f=0,g=b.length;fb&&(a=a.substr(0,b-c.length)+c),a}),"default":b,prepend:function(a,b,c){return b+a},append:function(a,b,c){return a+b},replace:a(function(a,b,c,d,e){return e||(e=d,d=void 0),d===void 0?a.replace(b,c):a.replace(b,c,d)}),downcase:a(function(a){return a.toLowerCase()}),upcase:a(function(a){return a.toUpperCase()}),pluralize:a(function(a,b,c,d){return d||(d=c,c=!0,d||(d=b,b=void 0)),b?Batman.helpers.pluralize(b,a,void 0,c):Batman.helpers.pluralize(a)}),join:a(function(a,b,c){return b==null&&(b=""),c||(c=b,b=""),a.join(b)}),sort:a(function(a){return a.sort()}),map:a(function(a,b){return a.map(function(a){return Batman.get(a,b)})}),has:function(a,b){return a==null?!1:Batman.contains(a,b)},first:a(function(a){return a[0]}),meta:a(function(a,b){return a.meta.get(b)}),interpolate:function(a,b,c){var d,e,f;c||(c=b,b=void 0);if(!a)return;f={};for(d in b)e=b[d],f[d]=this.get(e),f[d]==null&&(f[d]="");return Batman.helpers.interpolate(a,f)},withArguments:function(){var a,b,d,e;b=arguments[0],d=3<=arguments.length?c.call(arguments,1,e=arguments.length-1):(e=1,[]),a=arguments[e++];if(!b)return;return function(){var a;return a=1<=arguments.length?c.call(arguments,0):[],b.call.apply(b,[this].concat(c.call(d),c.call(a)))}},routeToAction:a(function(a,b){var c;return c=Batman.Dispatcher.paramsFromArgument(a),c.action=b,c}),escape:a(Batman.escapeHTML)},function(){var b,c,d,e,f;e=["capitalize","singularize","underscore","camelize"],f=[];for(c=0,d=e.length;c0)return this.html;if(!(a=this.get("source")))return;return a=Batman.Navigator.normalizePath(a),this.html=this.constructor.store.get(a)},set:function(a,b){return this.html=b}}),d.accessor("node",{get:function(){var a;if(!this.node){a=this.get("html");if(!(a&&a.length>0))return;this.node=document.createElement("div"),this._setNodeOwner(this.node),Batman.setInnerHTML(this.node,a)}return this.node},set:function(a,b){var c,d=this;return this.node=b,this._setNodeOwner(b),c=function(a){if(a!=null)return Batman.setInnerHTML(d.get("node"),a),d.forget("html",c)},this.observeAndFire("html",c)}}),d.YieldStorage=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="YieldStorage",c.wrapAccessor(function(a){return{get:function(b){var c;return c=a.get.call(this,b),c==null&&(c=this.set(b,[])),c}}}),c}(Batman.Hash),d.accessor("yields",function(){return new this.constructor.YieldStorage}),d.prototype.render=function(a){var b=this;if(this._rendered)return;this._rendered=!0,this.event("ready").resetOneShot();if(a)return this._renderer=new Batman.Renderer(a,null,this.context,this),this._renderer.on("rendered",function(){return b.fire("ready",a)})},d.prototype.isInDOM=function(){var a;return(a=this.get("node"))?a.parentNode!=null||this.get("yields").some(function(b,c){var d,e;for(d=0,e=c.length;d