// ========================================================================== // Project: Ember Data // Copyright: ©2011-2012 Tilde Inc. and contributors. // Portions ©2011 Living Social Inc. and contributors. // License: Licensed under MIT license (see license.js) // ========================================================================== // Last commit: 73ad70c (2013-02-23 22:52:20 -0800) (function(){window.DS=Ember.Namespace.create({CURRENT_API_REVISION:11})})(),function(){var e=Ember.DeferredMixin,t=Ember.Evented,n=Ember.run,r=Ember.get,i=Ember.Mixin.create(t,e,{init:function(){this._super.apply(this,arguments),this.one("didLoad",function(){n(this,"resolve",this)}),r(this,"isLoaded")&&this.trigger("didLoad")}});DS.LoadPromise=i}(),function(){var e=Ember.get,t=Ember.set,n=DS.LoadPromise;DS.RecordArray=Ember.ArrayProxy.extend(Ember.Evented,n,{type:null,content:null,isLoaded:!1,isUpdating:!1,store:null,objectAtContent:function(t){var n=e(this,"content"),r=n.objectAt(t),i=e(this,"store");if(r)return i.recordForReference(r)},materializedObjectAt:function(t){var n=e(this,"content").objectAt(t);if(!n)return;if(e(this,"store").recordIsMaterialized(n))return this.objectAt(t)},update:function(){if(e(this,"isUpdating"))return;var t=e(this,"store"),n=e(this,"type");t.fetchAll(n,this)},addReference:function(t){e(this,"content").addObject(t)},removeReference:function(t){e(this,"content").removeObject(t)}})}(),function(){var e=Ember.get;DS.FilteredRecordArray=DS.RecordArray.extend({filterFunction:null,isLoaded:!0,replace:function(){var t=e(this,"type").toString();throw new Error("The result of a client-side filter (on "+t+") is immutable.")},updateFilter:Ember.observer(function(){var t=e(this,"store");t.updateRecordArrayFilter(this,e(this,"type"),e(this,"filterFunction"))},"filterFunction")})}(),function(){var e=Ember.get,t=Ember.set;DS.AdapterPopulatedRecordArray=DS.RecordArray.extend({query:null,replace:function(){var t=e(this,"type").toString();throw new Error("The result of a server query (on "+t+") is immutable.")},load:function(n){var r=e(this,"store"),i=e(this,"type");this.beginPropertyChanges(),t(this,"content",Ember.A(n)),t(this,"isLoaded",!0),this.endPropertyChanges();var s=this;Ember.run.once(function(){s.trigger("didLoad")})}})}(),function(){var e=Ember.get,t=Ember.set;DS.ManyArray=DS.RecordArray.extend({init:function(){this._super.apply(this,arguments),this._changesToSync=Ember.OrderedSet.create()},owner:null,isLoaded:!1,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--,this.loadingRecordsCount===0&&(t(this,"isLoaded",!0),this.trigger("didLoad"))},fetch:function(){var t=e(this,"content"),n=e(this,"store"),r=e(this,"type"),i=e(this,"owner");n.fetchUnloadedReferences(r,t,i)},replaceContent:function(t,n,r){r=r.map(function(t){return e(t,"_reference")},this),this._super(t,n,r)},arrangedContentDidChange:function(){this.fetch()},arrayContentWillChange:function(t,n,r){var i=e(this,"owner"),s=e(this,"name");if(!i._suspendedRelationships)for(var o=t;o1||(r=n(this,t,e)),r}).property("data").meta(r)}}(),function(){}(),function(){var e=Ember.get,t=Ember.set,n=Ember.isNone;DS.belongsTo=function(t,n){n=n||{};var r={type:t,isRelationship:!0,options:n,kind:"belongsTo"};return Ember.computed(function(n,r){if(arguments.length===2)return r=== undefined?null:r;var i=e(this,"data").belongsTo,s=e(this,"store"),o;return typeof t=="string"&&(t=e(this,t,!1)||e(Ember.lookup,t)),o=i[n],o?typeof o=="object"?s.recordForReference(o):s.find(t,o):null}).property("data").meta(r)},DS.Model.reopen({belongsToWillChange:Ember.beforeObserver(function(t,n){if(e(t,"isLoaded")){var r=e(t,n),i=e(t,"_reference"),s=e(t,"store");if(r){var o=DS.RelationshipChange.createChange(i,e(r,"_reference"),s,{key:n,kind:"belongsTo",changeType:"remove"});o.sync(),this._changesToSync[n]=o}}}),belongsToDidChange:Ember.immediateObserver(function(t,n){if(e(t,"isLoaded")){var r=e(t,n);if(r){var i=e(t,"_reference"),s=e(t,"store"),o=DS.RelationshipChange.createChange(i,e(r,"_reference"),s,{key:n,kind:"belongsTo",changeType:"add"});o.sync(),this._changesToSync[n]&&DS.OneToManyChange.ensureSameTransaction([o,this._changesToSync[n]],s)}}delete this._changesToSync[n]})})}(),function(){var e=Ember.get,t=Ember.set,n=function(n,r){r=r||{};var i={type:n,isRelationship:!0,options:r,kind:"hasMany"};return Ember.computed(function(r,s){var o=e(this,"data").hasMany,u=e(this,"store"),a,f;return typeof n=="string"&&(n=e(this,n,!1)||e(Ember.lookup,n)),a=o[r],f=u.findMany(n,a||[],this,i),t(f,"owner",this),t(f,"name",r),f}).property().meta(i)};DS.hasMany=function(e,t){return n(e,t)}}(),function(){var e=Ember.get,t=Ember.set;DS.Model.reopen({didDefineProperty:function(e,t,n){if(n instanceof Ember.Descriptor){var r=n.meta();r.isRelationship&&r.kind==="belongsTo"&&(Ember.addObserver(e,t,null,"belongsToDidChange"),Ember.addBeforeObserver(e,t,null,"belongsToWillChange")),r.isAttribute&&(Ember.addObserver(e,t,null,"attributeDidChange"),Ember.addBeforeObserver(e,t,null,"attributeWillChange")),r.parentType=e.constructor}}}),DS.Model.reopenClass({typeForRelationship:function(t){var n=e(this,"relationshipsByName").get(t);return n&&n.type},relationships:Ember.computed(function(){var e=new Ember.MapWithDefault({defaultValue:function(){return[]}});return this.eachComputedProperty(function(t,n){if(n.isRelationship){typeof n.type=="string"&&(n.type=Ember.get(Ember.lookup,n.type));var r=e.get(n.type);r.push({name:t,kind:n.kind})}}),e}),relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};return this.eachComputedProperty(function(t,n){n.isRelationship&&e[n.kind].push(t)}),e}),relationshipsByName:Ember.computed(function(){var t=Ember.Map.create(),n;return this.eachComputedProperty(function(r,i){i.isRelationship&&(i.key=r,n=i.type,typeof n=="string"&&(n=e(this,n,!1)||e(Ember.lookup,n),i.type=n),t.set(r,i))}),t}),fields:Ember.computed(function(){var e=Ember.Map.create(),t;return this.eachComputedProperty(function(t,n){n.isRelationship?e.set(t,n.kind):n.isAttribute&&e.set(t,"attribute")}),e}),eachRelationship:function(t,n){e(this,"relationshipsByName").forEach(function(e,r){t.call(n,e,r)})}}),DS.Model.reopen({eachRelationship:function(e,t){this.constructor.eachRelationship(e,t)}}),DS._inverseRelationshipFor=function(t,n){var r=e(t,"relationships"),i=r.get(n),s,o,u;if(!i)return;if(i.length>1)return;return i[0]},DS._inverseTypeFor=function(t,n){var r=e(t,"relationshipsByName"),i=r.get(n);if(i)return i.type}}(),function(){function r(e,t,n){var r=e.metaForProperty(n).options,i;return(i=r.inverse)?i:DS._inverseRelationshipFor(t,e).name}function i(e,t,n){var r=t.metaForProperty(n).options,i;return(i=r.inverse)?i:DS._inverseRelationshipFor(e,t).name}var e=Ember.get,t=Ember.set,n=Ember.EnumerableUtils.forEach;DS.RelationshipChange=function(e){this.parentReference=e.parentReference,this.childReference=e.childReference,this.firstRecordReference=e.firstRecordReference,this.firstRecordKind=e.firstRecordKind,this.firstRecordName=e.firstRecordName,this.secondRecordReference=e.secondRecordReference,this.secondRecordKind=e.secondRecordKind,this.secondRecordName=e.secondRecordName,this.store=e.store,this.committed={},this.changeType=e.changeType},DS.RelationshipChangeAdd=function(e){DS.RelationshipChange.call(this,e)},DS.RelationshipChangeRemove=function(e){DS.RelationshipChange.call(this,e)},DS.RelationshipChange.create=function(e){return new DS.RelationshipChange(e)},DS.RelationshipChangeAdd.create=function(e){return new DS.RelationshipChangeAdd(e)},DS.RelationshipChangeRemove.create=function(e){return new DS.RelationshipChangeRemove(e)},DS.OneToManyChange={},DS.OneToNoneChange={},DS.ManyToNoneChange={},DS.OneToOneChange={},DS.ManyToManyChange={},DS.RelationshipChange._createChange=function(e){if(e.changeType==="add")return DS.RelationshipChangeAdd.create(e);if(e.changeType==="remove")return DS.RelationshipChangeRemove.create(e)},DS.RelationshipChange.determineRelationshipType=function(t,n){var r=n.key,i,s,o,u,a=n.kind,f=t.metaForProperty(r).options,l=DS._inverseTypeFor(t,r);if(f.inverse)i=f.inverse,o=e(l,"relationshipsByName").get(i).kind;else if(u=DS._inverseRelationshipFor(l,t))i=u.name,o=u.kind;return i?o==="belongsTo"?a==="belongsTo"?"oneToOne":"manyToOne":a==="belongsTo"?"oneToMany":"manyToMany":a==="belongsTo"?"oneToNone":"manyToNone"},DS.RelationshipChange.createChange=function(e,t,n,r){var i=e.type,s,o;o=DS.RelationshipChange.determineRelationshipType(i,r);if(o==="oneToMany")return DS.OneToManyChange.createChange(e,t,n,r);if(o==="manyToOne")return DS.OneToManyChange.createChange(t,e,n,r);if(o==="oneToNone")return DS.OneToNoneChange.createChange(e,t,n,r);if(o==="manyToNone")return DS.ManyToNoneChange.createChange(e,t,n,r);if(o==="oneToOne")return DS.OneToOneChange.createChange(e,t,n,r);if(o==="manyToMany")return DS.ManyToManyChange.createChange(e,t,n,r)},DS.OneToNoneChange.createChange=function(e,t,n,r){var i=r.key,s=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,store:n,changeType:r.changeType,firstRecordName:i,firstRecordKind:"belongsTo"});return n.addRelationshipChangeFor(e,i,t,null,s),s},DS.ManyToNoneChange.createChange=function(e,t,n,r){var i=r.key,s=DS.RelationshipChange._createChange({parentReference:e,childReference:t,secondRecordReference:e,store:n,changeType:r.changeType,secondRecordName:r.key,secondRecordKind:"hasMany"});return n.addRelationshipChangeFor(e,i,t,null,s),s},DS.ManyToManyChange.createChange=function(e,t,n,r){var i=e.type,s;s=r.key;var o=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"hasMany",secondRecordKind:"hasMany",store:n,changeType:r.changeType,firstRecordName:s});return n.addRelationshipChangeFor(e,s,t,null,o),o},DS.OneToOneChange.createChange=function(e,t,n,i){var s=e.type,o;i.parentType?o=r(i.parentType,s,i.key):i.key&&(o=i.key);var u=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"belongsTo",secondRecordKind:"belongsTo",store:n,changeType:i.changeType,firstRecordName:o});return n.addRelationshipChangeFor(e,o,t,null,u),u},DS.OneToOneChange.maintainInvariant=function(t,n,r,i){if(t.changeType==="add"&&n.recordIsMaterialized(r)){var s=n.recordForReference(r),o=e(s,i);if(o){var u=DS.OneToOneChange.createChange(r,o.get("_reference"),n,{parentType:t.parentType,hasManyName:t.hasManyName,changeType:"remove",key:t.key});n.addRelationshipChangeFor(r,i,t.parentReference,null,u),u.sync()}}},DS.OneToManyChange.createChange=function(e,t,n,i){var s=e.type,o;i.parentType?(o=r(i.parentType,s,i.key),DS.OneToManyChange.maintainInvariant(i,n,e,o)):i.key&&(o=i.key);var u=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"belongsTo",secondRecordKind:"hasMany",store:n,changeType:i.changeType,firstRecordName:o});return n.addRelationshipChangeFor(e,o,t,null,u),u},DS.OneToManyChange.maintainInvariant=function(t,n,r,i){if(t.changeType==="add"&&n.recordIsMaterialized(r)){var s=n.recordForReference(r),o=e(s,i);if(o){var u=DS.OneToManyChange.createChange(r,o.get("_reference"),n,{parentType:t.parentType,hasManyName:t.hasManyName,changeType:"remove",key:t.key});n.addRelationshipChangeFor(r,i,t.parentReference,null,u),u.sync()}}},DS.OneToManyChange.ensureSameTransaction=function(e,t){var r=Ember.A();n(e,function(e){r.addObject(e.getSecondRecord()),r.addObject(e.getFirstRecord())});var i=t.ensureSameTransaction(r);n(e,function(e){e.transaction=i})},DS.RelationshipChange.prototype={getSecondRecordName:function(){var e=this.secondRecordName,t=this.store,n;if(!e){n=this.secondRecordReference;if(!n)return;var r=this.firstRecordReference.type,s=DS._inverseTypeFor(r,this.firstRecordName);e=i(s,r,this.firstRecordName),this.secondRecordName=e}return e},getFirstRecordName:function(){var e=this.firstRecordName,t=this.store,n,r;if(!e){n=this.secondRecordReference,r=this.firstRecordReference;if(!r||!n)return;e=DS._inverseRelationshipFor(r.type,n.type).name,this.firstRecordName=e}return e},destroy:function(){var e=this.childReference,t=this.getFirstRecordName(),n=this.getSecondRecordName(),r=this.store,i,s,o,u,a;r.removeRelationshipChangeFor(e,t,this.parentReference,n,this.changeType),(a=this.transaction)&&a.relationshipBecameClean(this)},getByReference:function(e){var t=this.store;if(!e)return e;if(t.recordIsMaterialized(e))return t.recordForReference(e)},getSecondRecord:function(){return this.getByReference(this.secondRecordReference)},getFirstRecord:function(){return this.getByReference(this.firstRecordReference)},ensureSameTransaction:function(){var e=this.getFirstRecord(),t=this.getSecondRecord(),n=this.store.ensureSameTransaction([e,t]);return this.transaction=n,n},callChangeEvents:function(){var t=this.getSecondRecordName(),n=this.getFirstRecordName(),r=this.getFirstRecord(),i=this.getSecondRecord(),s=new Ember.OrderedSet;i&&e(i,"isLoaded")&&this.store.recordHasManyDidChange(s,i,this),r&&this.store.recordBelongsToDidChange(s,r,this),s.forEach(function(e){e.adapterDidDirty()})},coalesce:function(){var e=this.store.relationshipChangePairsFor(this.firstRecordReference);n(e,function(e){var t=e.add,n=e.remove;t&&n&&(t.destroy(),n.destroy())})}},DS.RelationshipChangeAdd.prototype=Ember.create(DS.RelationshipChange.create({})),DS.RelationshipChangeRemove.prototype=Ember.create(DS.RelationshipChange.create({})),DS.RelationshipChangeAdd.prototype.changeType="add",DS.RelationshipChangeAdd.prototype.sync=function(){var n=this.getSecondRecordName(),r=this.getFirstRecordName(),i=this.getFirstRecord(),s=this.getSecondRecord(),o=this.ensureSameTransaction();o.relationshipBecameDirty(this),this.callChangeEvents(),s&&i&&(this.secondRecordKind==="belongsTo"?s.suspendRelationshipObservers(function(){t(s,n,i)}):this.secondRecordKind==="hasMany"&&s.suspendRelationshipObservers(function(){e(s,n).addObject(i)})),i&&s&&e(i,r)!==s&&(this.firstRecordKind==="belongsTo"?i.suspendRelationshipObservers(function(){t(i,r,s)}):this.firstdRecordKind==="hasMany"&&i.suspendRelationshipObservers(function(){e(i,r).addObject(s)})),this.coalesce()},DS.RelationshipChangeRemove.prototype.changeType="remove",DS.RelationshipChangeRemove.prototype.sync=function(){var n=this.getSecondRecordName(),r=this.getFirstRecordName(),i=this.getFirstRecord(),s=this.getSecondRecord(),o=this.ensureSameTransaction(i,s,n,r);o.relationshipBecameDirty(this),this.callChangeEvents(),s&&i&&(this.secondRecordKind==="belongsTo"?s.suspendRelationshipObservers(function(){t(s,n,null)}):this.secondRecordKind==="hasMany"&&s.suspendRelationshipObservers(function(){e(s,n).removeObject(i)})),i&&e(i,r)&&(this.firstRecordKind==="belongsTo"?i.suspendRelationshipObservers(function(){t(i,r,null)}):this.firstdRecordKind==="hasMany"&&i.suspendRelationshipObservers(function(){e(i,r).removeObject(s)})),this.coalesce()}}(),function(){}(),function(){var e=Ember.set;Ember.onLoad("Ember.Application",function(t){t.registerInjection?(t.registerInjection({name:"store",before:"controllers",injection:function(t,n,r){if(!n)return;r==="Store"&&e(n,"store",t[r].create())}}),t.registerInjection({name:"giveStoreToControllers",after:["store","controllers"],injection:function(e,t,n){if(!t)return;if(/^[A-Z].*Controller$/.test(n)){var r=n.charAt(0).toLowerCase()+n.substr(1),i=t.get("store"),s=t.get(r);if(!s)return;s.set("store",i)}}})):t.initializer&&(t.initializer({name:"store",initialize:function(e,t){e.register("store","main",t.Store),e.lookup("store:main")}}),t.initializer({name:"injectStore",initialize:function(e){e.typeInjection("controller","store","store:main"),e.typeInjection("route","store","store:main")}}))})}(),function(){function i(e){return function(){throw new Ember.Error("Your serializer "+this.toString()+" does not implement the required method "+e)}}var e=Ember.get,t=Ember.set,n=Ember.ArrayPolyfills.map,r=Ember.isNone;DS.Serializer=Ember.Object.extend({init:function(){this.mappings=Ember.Map.create(),this.configurations=Ember.Map.create(),this.globalConfigurations={}},extract:i("extract"),extractMany:i("extractMany"),extractRecordRepresentation:function(e,t,n,i){var s=this.mappingForType(t),o,u={},a;return i?a=e.sideload(t,n):a=e.load(t,n),this.eachEmbeddedHasMany(t,function(t,i){var s=n[this.keyFor(i)];r(s)||this.extractEmbeddedHasMany(e,i,s,a,u)},this),this.eachEmbeddedBelongsTo(t,function(t,i){var s=n[this.keyFor(i)];r(s)||this.extractEmbeddedBelongsTo(e,i,s,a,u)},this),e.prematerialize(a,u),a},extractEmbeddedHasMany:function(e,t,r,i,s){var o=n.call(r,function(n){if(!n)return;var r=this.extractRecordRepresentation(e,t.type,n,!0),s=this.embeddedType(i.type,t.key);return s==="always"&&(r.parent=i),r},this);s[t.key]=o},extractEmbeddedBelongsTo:function(e,t,n,r,i){var s=this.extractRecordRepresentation(e,t.type,n,!0);i[t.key]=s;var o=this.embeddedType(r.type,t.key);o==="always"&&(s.parent=r)},serialize:function(t,n){n=n||{};var r=this.createSerializedForm(),i;return n.includeId&&(i=e(t,"id"))&&this._addId(r,t.constructor,i),this.addAttributes(r,t),this.addRelationships(r,t),r},serializeValue:function(e,t){var n=this.transforms?this.transforms[t]:null;return n.serialize(e)},serializeId:function(e){return isNaN(e)?e:+e},addAttributes:function(e,t){t.eachAttribute(function(n,r){this._addAttribute(e,t,n,r.type)},this)},addAttribute:Ember.K,addId:Ember.K,addRelationships:function(e,t){t.eachRelationship(function(n,r){r.kind==="belongsTo"?this._addBelongsTo(e,t,n,r):r.kind==="hasMany"&&this._addHasMany(e,t,n,r)},this)},addBelongsTo:Ember.K,addHasMany:Ember.K,keyForAttributeName:function(e,t){return t},primaryKey:function(e){return"id"},keyForBelongsTo:function(e,t){return this.keyForAttributeName(e,t)},keyForHasMany:function(e,t){return this.keyForAttributeName(e,t)},materialize:function(t,n,r){var i;Ember.isNone(e(t,"id"))&&(r&&r.hasOwnProperty("id")?i=r.id:i=this.extractId(t.constructor,n),t.materializeId(i)),this.materializeAttributes(t,n,r),this.materializeRelationships(t,n,r)},deserializeValue:function(e,t){var n=this.transforms?this.transforms[t]:null;return n.deserialize(e)},materializeAttributes:function(e,t,n){e.eachAttribute(function(r,i){n&&n.hasOwnProperty(r)?e.materializeAttribute(r,n[r]):this.materializeAttribute(e,t,r,i.type)},this)},materializeAttribute:function(e,t,n,r){var i=this.extractAttribute(e.constructor,t,n);i=this.deserializeValue(i,r),e.materializeAttribute(n,i)},materializeRelationships:function(e,t,n){e.eachRelationship(function(r,i){i.kind==="hasMany"?n&&n.hasOwnProperty(r)?e.materializeHasMany(r,n[r]):this.materializeHasMany(r,e,t,i,n):i.kind==="belongsTo"&&(n&&n.hasOwnProperty(r)?e.materializeBelongsTo(r,n[r]):this.materializeBelongsTo(r,e,t,i,n))},this)},materializeHasMany:function(e,t,n,r){var i=this._keyForHasMany(t.constructor,r.key);t.materializeHasMany(e,this.extractHasMany(t.constructor,n,i))},materializeBelongsTo:function(e,t,n,r){var i=this._keyForBelongsTo(t.constructor,r.key);t.materializeBelongsTo(e,this.extractBelongsTo(t.constructor,n,i))},_extractEmbeddedRelationship:function(e,t,n,r){var i=this["_keyFor"+r](e,n);if(this.embeddedType(e,n))return this["extractEmbedded"+r](e,t,i)},_extractEmbeddedBelongsTo:function(e,t,n){return this._extractEmbeddedRelationship(e,t,n,"BelongsTo")},_extractEmbeddedHasMany:function(e,t,n){return this._extractEmbeddedRelationship(e,t,n,"HasMany")},_primaryKey:function(e){var t=this.configurationForType(e),n=t&&t.primaryKey;return n?n:this.primaryKey(e)},_addAttribute:function(t,n,r,i){var s=this._keyForAttributeName(n.constructor,r),o=e(n,r);this.addAttribute(t,s,this.serializeValue(o,i))},_addId:function(e,t,n){var r=this._primaryKey(t);this.addId(e,r,this.serializeId(n))},_keyForAttributeName:function(e,t){return this._keyFromMappingOrHook("keyForAttributeName",e,t)},_keyForBelongsTo:function(e,t){return this._keyFromMappingOrHook("keyForBelongsTo",e,t)},keyFor:function(e){var t=e.parentType,n=e.key;switch(e.kind){case"belongsTo":return this._keyForBelongsTo(t,n);case"hasMany":return this._keyForHasMany(t,n)}},_keyForHasMany:function(e,t){return this._keyFromMappingOrHook("keyForHasMany",e,t)},_addBelongsTo:function(e,t,n,r){var i=this._keyForBelongsTo(t.constructor,n);this.addBelongsTo(e,t,i,r)},_addHasMany:function(e,t,n,r){var i=this._keyForHasMany(t.constructor,n);this.addHasMany(e,t,i,r)},_keyFromMappingOrHook:function(e,t,n){var r=this.mappingOption(t,n,"key");return r?r:this[e](t,n)},registerTransform:function(e,t){this.transforms[e]=t},registerEnumTransform:function(e,t){var n={deserialize:function(e){return Ember.A(t).objectAt(e)},serialize:function(e){return Ember.EnumerableUtils.indexOf(t,e)},values:t};this.registerTransform(e,n)},map:function(e,t){this.mappings.set(e,t)},configure:function(e,t){if(e&&!t){Ember.merge(this.globalConfigurations,e);return}var n=Ember.create(this.globalConfigurations);Ember.merge(n,t),this.configurations.set(e,n)},mappingForType:function(e){return this._reifyMappings(),this.mappings.get(e)||{}},configurationForType:function(e){return this._reifyConfigurations(),this.configurations.get(e)||this.globalConfigurations},_reifyMappings:function(){if(this._didReifyMappings)return;var e=this.mappings,t=Ember.Map.create();e.forEach(function(e,n){if(typeof e=="string"){var r=Ember.get(Ember.lookup,e);t.set(r,n)}else t.set(e,n)}),this.mappings=t,this._didReifyMappings=!0},_reifyConfigurations:function(){if(this._didReifyConfigurations)return;var e=this.configurations,t=Ember.Map.create();e.forEach(function(e,n){if(typeof e=="string"&&e!=="plurals"){var r=Ember.get(Ember.lookup,e);t.set(r,n)}else t.set(e,n)}),this.configurations=t,this._didReifyConfigurations=!0},mappingOption:function(e,t,n){var r=this.mappingForType(e)[t];return r&&r[n]},configOption:function(e,t){var n=this.configurationForType(e);return n[t]},embeddedType:function(e,t){return this.mappingOption(e,t,"embedded")},eachEmbeddedRecord:function(e,t,n){this.eachEmbeddedBelongsToRecord(e,t,n),this.eachEmbeddedHasManyRecord(e,t,n)},eachEmbeddedBelongsToRecord:function(t,n,r){var i=t.constructor;this.eachEmbeddedBelongsTo(t.constructor,function(i,s,o){var u=e(t,i);u&&n.call(r,u,o)})},eachEmbeddedHasManyRecord:function(t,n,r){var i=t.constructor;this.eachEmbeddedHasMany(t.constructor,function(i,s,o){var u=e(t,i);for(var a=0,f=e(u,"length");a