(function(){"use strict";var e=Ember.get;var r=["description","fileName","lineNumber","message","name","number","stack"];function t(e){var t=Error.prototype.constructor.call(this,"The backend rejected the commit because it was invalid: "+Ember.inspect(e));this.errors=e;for(var i=0,n=r.length;i=t){o=0;s.push([])}o+=r;var i=s.length-1;s[i].push(e)});return s}var o=[];t.forEach(function(e,r){var t="&ids%5B%5D=".length;var i=a(e,n,t);v.call(i,function(e){o.push(e)})});return o},ajaxError:function(e,r,t){var i=e!==null&&typeof e==="object";if(i){e.then=null;if(!e.errorThrown){if(typeof t==="string"){e.errorThrown=new Error(t)}else{e.errorThrown=t}}}return e},ajaxSuccess:function(e,r){return r},ajax:function(e,r,i){var n=this;return new Ember.RSVP.Promise(function(a,o){var s=n.ajaxOptions(e,r,i);s.success=function(e,r,i){e=n.ajaxSuccess(i,e);if(e instanceof t){Ember.run(null,o,e)}else{Ember.run(null,a,e)}};s.error=function(e,r,t){Ember.run(null,o,n.ajaxError(e,e.responseText,t))};Ember.$.ajax(s)},"DS: RESTAdapter#ajax "+r+" to "+e)},ajaxOptions:function(e,r,t){var i=t||{};i.url=e;i.type=r;i.dataType="json";i.context=this;if(i.data&&r!=="GET"){i.contentType="application/json; charset=utf-8";i.data=JSON.stringify(i.data)}var n=m(this,"headers");if(n!==undefined){i.beforeSend=function(e){v.call(Ember.keys(n),function(r){e.setRequestHeader(r,n[r])})}}return i}});function b(e,r){if(typeof String.prototype.endsWith!=="function"){return e.indexOf(r,e.length-r.length)!==-1}else{return e.endsWith(r)}}var g=self.Ember;var R=g.String.capitalize;var E=/^\s*$/;var _=/(\w+[_-])([a-z\d]+$)/;var F=/(\w+)([A-Z][a-z\d]*$)/;var A=/[A-Z][a-z\d]*$/;function S(e,r){for(var t=0,i=r.length;tv;m--){i=r[m-1];p=i[0];if(p.test(e)){break}}i=i||[];p=i[0];n=i[1];a=e.replace(p,n);return a}};var C=T;function M(e){return C.inflector.pluralize(e)}function x(e){return C.inflector.singularize(e)}var w={plurals:[[/$/,"s"],[/s$/i,"s"],[/^(ax|test)is$/i,"$1es"],[/(octop|vir)us$/i,"$1i"],[/(octop|vir)i$/i,"$1i"],[/(alias|status)$/i,"$1es"],[/(bu)s$/i,"$1ses"],[/(buffal|tomat)o$/i,"$1oes"],[/([ti])um$/i,"$1a"],[/([ti])a$/i,"$1a"],[/sis$/i,"ses"],[/(?:([^f])fe|([lr])f)$/i,"$1$2ves"],[/(hive)$/i,"$1s"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/(x|ch|ss|sh)$/i,"$1es"],[/(matr|vert|ind)(?:ix|ex)$/i,"$1ices"],[/^(m|l)ouse$/i,"$1ice"],[/^(m|l)ice$/i,"$1ice"],[/^(ox)$/i,"$1en"],[/^(oxen)$/i,"$1"],[/(quiz)$/i,"$1zes"]],singular:[[/s$/i,""],[/(ss)$/i,"$1"],[/(n)ews$/i,"$1ews"],[/([ti])a$/i,"$1um"],[/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i,"$1sis"],[/(^analy)(sis|ses)$/i,"$1sis"],[/([^f])ves$/i,"$1fe"],[/(hive)s$/i,"$1"],[/(tive)s$/i,"$1"],[/([lr])ves$/i,"$1f"],[/([^aeiouy]|qu)ies$/i,"$1y"],[/(s)eries$/i,"$1eries"],[/(m)ovies$/i,"$1ovie"],[/(x|ch|ss|sh)es$/i,"$1"],[/^(m|l)ice$/i,"$1ouse"],[/(bus)(es)?$/i,"$1"],[/(o)es$/i,"$1"],[/(shoe)s$/i,"$1"],[/(cris|test)(is|es)$/i,"$1is"],[/^(a)x[ie]s$/i,"$1xis"],[/(octop|vir)(us|i)$/i,"$1us"],[/(alias|status)(es)?$/i,"$1"],[/^(ox)en/i,"$1"],[/(vert|ind)ices$/i,"$1ex"],[/(matr)ices$/i,"$1ix"],[/(quiz)zes$/i,"$1"],[/(database)s$/i,"$1"]],irregularPairs:[["person","people"],["man","men"],["child","children"],["sex","sexes"],["move","moves"],["cow","kine"],["zombie","zombies"]],uncountable:["equipment","information","rice","money","species","series","fish","sheep","jeans","police"]};C.inflector=new C(w);function D(e,r){g.HTMLBars.helpers[e]=r}function P(e,r){g.HTMLBars.registerHelper(e,r)}function O(e,r){g.HTMLBars._registerHelper(e,r)}function I(e,r){if(g.HTMLBars){var t=g.HTMLBars.makeBoundHelper(r);if(g.HTMLBars._registerHelper){if(g.HTMLBars.helpers){D(e,t)}else{O(e,t)}}else if(g.HTMLBars.registerHelper){P(e,t)}}else if(g.Handlebars){g.Handlebars.helper(e,r)}}var $=I;$("singularize",function(e){return x(e[0])});$("pluralize",function(e){var r,t;if(e.length===1){t=e[0];return M(t)}else{r=e[0];t=e[1];if(r!==1){t=M(t)}return r+" "+t}});if(g.EXTEND_PROTOTYPES===true||g.EXTEND_PROTOTYPES.String){String.prototype.pluralize=function(){return M(this)};String.prototype.singularize=function(){return x(this)}}C.defaultRules=w;g.Inflector=C;g.String.pluralize=M;g.String.singularize=x;var L=C;if(typeof define!=="undefined"&&define.amd){define("ember-inflector",["exports"],function(e){e["default"]=C;return C})}else if(typeof module!=="undefined"&&module["exports"]){module["exports"]=C}var K=Ember.String.decamelize;var j=Ember.String.underscore;var B=y.extend({defaultSerializer:"-active-model",pathForType:function(e){var r=K(e);var t=j(r);return M(t)},ajaxError:function(e){var r=this._super.apply(this,arguments);if(e&&e.status===422){return new t(Ember.$.parseJSON(e.responseText))}else{return r}}});var U=B;var N=Ember.Object.extend({extract:null,serialize:null,normalize:function(e,r){return r}});var H=N;var V=Ember.get;var W=Ember.isNone;var q=Ember.ArrayPolyfills.map;var Q=Ember.merge;var X=H.extend({primaryKey:"id",applyTransforms:function(e,r){e.eachTransformedAttribute(function t(e,i){if(!r.hasOwnProperty(e)){return}var n=this.transformFor(i);r[e]=n.deserialize(r[e])},this);return r},normalize:function(e,r){if(!r){return r}this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r);this.applyTransforms(e,r);return r},normalizePayload:function(e){return e},normalizeAttributes:function(e,r){var t;if(this.keyForAttribute){e.eachAttribute(function(e){t=this.keyForAttribute(e);if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeRelationships:function(e,r){var t;if(this.keyForRelationship){e.eachRelationship(function(e,i){t=this.keyForRelationship(e,i.kind);if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeUsingDeclaredMapping:function(e,r){var t=V(this,"attrs");var i,n;if(t){for(n in t){i=this._getMappedKey(n);if(!r.hasOwnProperty(i)){continue}if(i!==n){r[n]=r[i];delete r[i]}}}},normalizeId:function(e){var r=V(this,"primaryKey");if(r==="id"){return}e.id=e[r];delete e[r]},normalizeErrors:function(e,r){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r)},_getMappedKey:function(e){var r=V(this,"attrs");var t;if(r&&r[e]){t=r[e];if(t.key){t=t.key}if(typeof t==="string"){e=t}}return e},_canSerialize:function(e){var r=V(this,"attrs");return!r||!r[e]||r[e].serialize!==false},serialize:function(e,r){var t={};if(r&&r.includeId){var i=e.id;if(i){t[V(this,"primaryKey")]=i}}e.eachAttribute(function(r,i){this.serializeAttribute(e,t,r,i)},this);e.eachRelationship(function(r,i){if(i.kind==="belongsTo"){this.serializeBelongsTo(e,t,i)}else if(i.kind==="hasMany"){this.serializeHasMany(e,t,i)}},this);return t},serializeIntoHash:function(e,r,t,i){Q(e,this.serialize(t,i))},serializeAttribute:function(e,r,t,i){var n=i.type;if(this._canSerialize(t)){var a=e.attr(t);if(n){var o=this.transformFor(n);a=o.serialize(a)}var s=this._getMappedKey(t);if(s===t&&this.keyForAttribute){s=this.keyForAttribute(t)}r[s]=a}},serializeBelongsTo:function(e,r,t){var i=t.key;if(this._canSerialize(i)){var n=e.belongsTo(i,{id:true});var a=this._getMappedKey(i);if(a===i&&this.keyForRelationship){a=this.keyForRelationship(i,"belongsTo")}if(W(n)){r[a]=null}else{r[a]=n}if(t.options.polymorphic){this.serializePolymorphicType(e,r,t)}}},serializeHasMany:function(e,r,t){var i=t.key;if(this._canSerialize(i)){var n;n=this._getMappedKey(i);if(n===i&&this.keyForRelationship){n=this.keyForRelationship(i,"hasMany")}var a=e.type.determineRelationshipType(t);if(a==="manyToNone"||a==="manyToMany"){r[n]=e.hasMany(i,{ids:true})}}},serializePolymorphicType:Ember.K,extract:function(e,r,t,i,n){this.extractMeta(e,r,t);var a="extract"+n.charAt(0).toUpperCase()+n.substr(1);return this[a](e,r,t,i,n)},extractFindAll:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractFindQuery:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractFindMany:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractFindHasMany:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractCreateRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractUpdateRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractDeleteRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractFind:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractFindBelongsTo:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractSave:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractSingle:function(e,r,t,i,n){t=this.normalizePayload(t);return this.normalize(r,t)},extractArray:function(e,r,t,i,n){var a=this.normalizePayload(t);var o=this;return q.call(a,function(e){return o.normalize(r,e)})},extractMeta:function(e,r,t){if(t&&t.meta){e.setMetadataFor(r,t.meta);delete t.meta}},extractErrors:function(e,r,t,i){if(t&&typeof t==="object"&&t.errors){t=t.errors;this.normalizeErrors(r,t)}return t},keyForAttribute:function(e){return e},keyForRelationship:function(e,r){return e},transformFor:function(e,r){var t=this.container.lookup("transform:"+e);return t}});var G=Ember.ArrayPolyfills.forEach;var J=Ember.ArrayPolyfills.map;var Y=Ember.String.camelize;function Z(e){return e==null?null:e+""}var ee=X.extend({normalize:function(e,r,t){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r);if(this.normalizeHash&&this.normalizeHash[t]){this.normalizeHash[t](r)}this.applyTransforms(e,r);return r},extractSingle:function(e,r,t,i){var n=this.normalizePayload(t);var a=r.typeKey;var o;for(var s in n){var u=this.typeForRoot(s);if(!e.modelFactoryFor(u)){continue}var c=e.modelFor(u);var l=c.typeKey===a;var d=n[s];if(d===null){continue}if(l&&Ember.typeOf(d)!=="array"){o=this.normalize(r,d,s);continue}G.call(d,function(r){var t=this.typeForRoot(s);var n=e.modelFor(t);var a=e.serializerFor(n);r=a.normalize(n,r,s);var u=l&&!i&&!o;var c=l&&Z(r.id)===i;if(u||c){o=r}else{e.push(t,r)}},this)}return o},extractArray:function(e,r,t){var i=this.normalizePayload(t);var n=r.typeKey;var a;for(var o in i){var s=o;var u=false;if(o.charAt(0)==="_"){u=true;s=o.substr(1)}var c=this.typeForRoot(s);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var d=e.serializerFor(l);var h=!u&&l.typeKey===n;var f=J.call(i[o],function(e){return d.normalize(l,e,o)},this);if(h){a=f}else{e.pushMany(c,f)}}return a},pushPayload:function(e,r){var t=this.normalizePayload(r);for(var i in t){var n=this.typeForRoot(i);if(!e.modelFactoryFor(n,i)){continue}var a=e.modelFor(n);var o=e.serializerFor(a);var s=J.call(Ember.makeArray(t[i]),function(e){return o.normalize(a,e,i)},this);e.pushMany(n,s)}},typeForRoot:function(e){return Y(x(e))},serialize:function(e,r){return this._super.apply(this,arguments)},serializeIntoHash:function(e,r,t,i){e[r.typeKey]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var n=e.belongsTo(i);i=this.keyForAttribute?this.keyForAttribute(i):i;if(Ember.isNone(n)){r[i+"Type"]=null}else{r[i+"Type"]=Ember.String.camelize(n.typeKey)}}});var re=ee;var te=Ember.EnumerableUtils.forEach;var ie=Ember.String.camelize;var ne=Ember.String.capitalize;var ae=Ember.String.decamelize;var oe=Ember.String.underscore;var se=re.extend({keyForAttribute:function(e){return ae(e)},keyForRelationship:function(e,r){var t=ae(e);if(r==="belongsTo"){return t+"_id"}else if(r==="hasMany"){return x(t)+"_ids"}else{return t}},serializeHasMany:Ember.K,serializeIntoHash:function(e,r,t,i){var n=oe(ae(r.typeKey));e[n]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var n=e.belongsTo(i);var a=oe(i+"_type");if(Ember.isNone(n)){r[a]=null}else{r[a]=ne(ie(n.typeKey))}},normalize:function(e,r,t){this.normalizeLinks(r);return this._super(e,r,t)},normalizeLinks:function(e){if(e.links){var r=e.links;for(var t in r){var i=ie(t);if(i!==t){r[i]=r[t];delete r[t]}}}},normalizeRelationships:function(e,r){if(this.keyForRelationship){e.eachRelationship(function(e,t){var i,n;if(t.options.polymorphic){i=this.keyForAttribute(e);n=r[i];if(n&&n.type){n.type=this.typeForRoot(n.type)}else if(n&&t.kind==="hasMany"){var a=this;te(n,function(e){e.type=a.typeForRoot(e.type)})}}else{i=this.keyForRelationship(e,t.kind);if(!r.hasOwnProperty(i)){return}n=r[i]}r[e]=n;if(e!==i){delete r[i]}},this)}}});var ue=se;function ce(e){this.container=e}ce.prototype.aliasedFactory=function(e,r){var t=this;return{create:function(){if(r){r()}return t.container.lookup(e)}}};ce.prototype.registerAlias=function(e,r,t){var i=this.aliasedFactory(r,t);return this.container.register(e,i)};ce.prototype.registerDeprecation=function(e,r){var t=function(){};return this.registerAlias(e,r,t)};ce.prototype.registerDeprecations=function(e){var r,t,i,n;for(r=e.length;r>0;r--){t=e[r-1];i=t["deprecated"];n=t["valid"];this.registerDeprecation(i,n)}};var le=ce;function de(e,r){var t=new le(e);t.registerDeprecations([{deprecated:"serializer:_ams",valid:"serializer:-active-model"},{deprecated:"adapter:_ams",valid:"adapter:-active-model"}]);e.register("serializer:-active-model",ue);e.register("adapter:-active-model",U)}var he=de;var fe=Ember.Namespace.create({VERSION:"1.0.0-beta.16.1"});if(Ember.libraries){Ember.libraries.registerCoreLibrary("Ember Data",fe.VERSION)}var pe=fe;var me=Ember.RSVP.Promise;var ve=Ember.get;var ye=Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);var be=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var ge=function(e,r){return be.create({promise:me.resolve(e,r)})};var Re=function(e,r){return ye.create({promise:me.resolve(e,r)})};function Ee(e){return function(){var r=ve(this,"content");return r[e].apply(r,arguments)}}var _e=ye.extend({reload:function(){return _e.create({promise:ve(this,"content").reload()})},createRecord:Ee("createRecord"),on:Ee("on"),one:Ee("one"),trigger:Ee("trigger"),off:Ee("off"),has:Ee("has")});var Fe=function(e,r){return _e.create({promise:me.resolve(e,r)})};var Ae=Ember.get;function Se(e){var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(undefined,r)}}function ze(e,r){var t=e["finally"](function(){if(!r()){t._subscribers.length=0}});return t}function Te(e){return!(Ae(e,"isDestroyed")||Ae(e,"isDestroying"))}function ke(e,r,t){var i=r.serializer;if(i===undefined){i=e.serializerFor(t)}if(i===null||i===undefined){i={extract:function(e,r,t){return t}}}return i}var Ce=Ember.get;var Me=Ember.RSVP.Promise;function xe(e,r,t,i,n){var a=n._createSnapshot();var o=e.find(r,t,i,a);var s=ke(r,e,t);var u="DS: Handle Adapter#find of "+t+" with id: "+i;o=Me.cast(o,u);o=ze(o,Se(Te,r));return o.then(function(e){return r._adapterRun(function(){var n=s.extract(r,t,e,i,"find");return r.push(t,n)})},function(e){var n=r.getById(t,i);if(n){n.notFound();if(Ce(n,"isEmpty")){r.unloadRecord(n)}}throw e},"DS: Extract payload of '"+t+"'")}function we(e,r,t,i,n){var a=Ember.A(n).invoke("_createSnapshot");var o=e.findMany(r,t,i,a);var s=ke(r,e,t);var u="DS: Handle Adapter#findMany of "+t;if(o===undefined){throw new Error("adapter.findMany returned undefined, this was very likely a mistake")}o=Me.cast(o,u);o=ze(o,Se(Te,r));return o.then(function(e){return r._adapterRun(function(){var i=s.extract(r,t,e,null,"findMany");return r.pushMany(t,i)})},null,"DS: Extract payload of "+t)}function De(e,r,t,i,n){var a=t._createSnapshot();var o=e.findHasMany(r,a,i,n);var s=ke(r,e,n.type);var u="DS: Handle Adapter#findHasMany of "+t+" : "+n.type;o=Me.cast(o,u);o=ze(o,Se(Te,r));o=ze(o,Se(Te,t));return o.then(function(e){return r._adapterRun(function(){var t=s.extract(r,n.type,e,null,"findHasMany");var i=r.pushMany(n.type,t);return i})},null,"DS: Extract payload of "+t+" : hasMany "+n.type)}function Pe(e,r,t,i,n){var a=t._createSnapshot();var o=e.findBelongsTo(r,a,i,n);var s=ke(r,e,n.type);var u="DS: Handle Adapter#findBelongsTo of "+t+" : "+n.type;o=Me.cast(o,u);o=ze(o,Se(Te,r));o=ze(o,Se(Te,t));return o.then(function(e){return r._adapterRun(function(){var t=s.extract(r,n.type,e,null,"findBelongsTo");if(!t){return null}var i=r.push(n.type,t);return i})},null,"DS: Extract payload of "+t+" : "+n.type)}function Oe(e,r,t,i){var n=e.findAll(r,t,i);var a=ke(r,e,t);var o="DS: Handle Adapter#findAll of "+t;n=Me.cast(n,o);n=ze(n,Se(Te,r));return n.then(function(e){r._adapterRun(function(){var i=a.extract(r,t,e,null,"findAll");r.pushMany(t,i)});r.didUpdateAll(t);return r.all(t)},null,"DS: Extract payload of findAll "+t)}function Ie(e,r,t,i,n){var a=e.findQuery(r,t,i,n);var o=ke(r,e,t);var s="DS: Handle Adapter#findQuery of "+t;a=Me.cast(a,s);a=ze(a,Se(Te,r));return a.then(function(e){var i;r._adapterRun(function(){i=o.extract(r,t,e,null,"findQuery")});n.load(i);return n},null,"DS: Extract payload of findQuery "+t)}var $e=Ember.get;var Le=Ember.set;var Ke=Ember.ArrayProxy.extend(Ember.Evented,{type:null,content:null,isLoaded:false,isUpdating:false,store:null,objectAtContent:function(e){var r=$e(this,"content");return r.objectAt(e)},update:function(){if($e(this,"isUpdating")){return}var e=$e(this,"store");var r=$e(this,"type");return e.fetchAll(r,this)},addRecord:function(e,r){var t=$e(this,"content");if(r===undefined){t.addObject(e)}else if(!t.contains(e)){t.insertAt(r,e)}},_pushRecord:function(e){$e(this,"content").pushObject(e)},pushRecord:function(e){this._pushRecord(e)},removeRecord:function(e){$e(this,"content").removeObject(e)},save:function(){var e=this;var r="DS: RecordArray#save "+$e(this,"type");var t=Ember.RSVP.all(this.invoke("save"),r).then(function(r){return e},null,"DS: RecordArray#save return RecordArray");return ye.create({promise:t})},_dissociateFromOwnRecords:function(){var e=this;this.forEach(function(r){var t=r._recordArrays;if(t){t["delete"](e)}})},_unregisterFromManager:function(){var e=$e(this,"manager");if(e){e.unregisterFilteredRecordArray(this)}},willDestroy:function(){this._unregisterFromManager();this._dissociateFromOwnRecords();Le(this,"content",undefined);this._super.apply(this,arguments)}});var je=Ember.get;var Be=Ke.extend({filterFunction:null,isLoaded:true,replace:function(){var e=je(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=je(this,"manager");e.updateFilter(this,je(this,"type"),je(this,"filterFunction"))},updateFilter:Ember.observer(function(){Ember.run.once(this,this._updateFilter)},"filterFunction")});var Ue=Ember.get;function Ne(e){var r=Ember.create(null);for(var t in e){r[t]=e[t]}return r}var He=Ke.extend({query:null,replace:function(){var e=Ue(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},load:function(e){var r=Ue(this,"store");var t=Ue(this,"type");var i=r.pushMany(t,e);var n=r.metadataFor(t);this.setProperties({content:Ember.A(i),isLoaded:true,meta:Ne(n)});i.forEach(function(e){this.manager.recordArraysForRecord(e).add(this)},this);Ember.run.once(this,"trigger","didLoad")}});var Ve=Ember.OrderedSet;var We=Ember.guidFor;var qe=function(){this._super$constructor()};qe.create=function(){var e=this;return new e};qe.prototype=Ember.create(Ve.prototype);qe.prototype.constructor=qe;qe.prototype._super$constructor=Ve;qe.prototype.addWithIndex=function(e,r){var t=We(e);var i=this.presenceSet;var n=this.list;if(i[t]===true){return}i[t]=true;if(r===undefined||r==null){n.push(e)}else{n.splice(r,0,e)}this.size+=1;return this};var Qe=qe;var Xe=Ember.get;var Ge=Ember.EnumerableUtils.forEach;var Je=Ember.EnumerableUtils.indexOf;var Ye=Ember.Object.extend({init:function(){this.filteredRecordArrays=d.create({defaultValue:function(){return[]}});this.changedRecords=[];this._adapterPopulatedRecordArrays=[]},recordDidChange:function(e){if(this.changedRecords.push(e)!==1){return}Ember.run.schedule("actions",this,this.updateRecordArrays)},recordArraysForRecord:function(e){e._recordArrays=e._recordArrays||Qe.create();return e._recordArrays},updateRecordArrays:function(){Ge(this.changedRecords,function(e){if(Xe(e,"isDeleted")){this._recordWasDeleted(e)}else{this._recordWasChanged(e)}},this);this.changedRecords.length=0},_recordWasDeleted:function(e){var r=e._recordArrays;if(!r){return}r.forEach(function(r){r.removeRecord(e)});e._recordArrays=null},_recordWasChanged:function(e){var r=e.constructor;var t=this.filteredRecordArrays.get(r);var i;Ge(t,function(t){i=Xe(t,"filterFunction");if(i){this.updateRecordArray(t,i,r,e)}},this)},recordWasLoaded:function(e){var r=e.constructor;var t=this.filteredRecordArrays.get(r);var i;Ge(t,function(t){i=Xe(t,"filterFunction");this.updateRecordArray(t,i,r,e)},this)},updateRecordArray:function(e,r,t,i){var n;if(!r){n=true}else{n=r(i)}var a=this.recordArraysForRecord(i);if(n){if(!a.has(e)){e._pushRecord(i);a.add(e)}}else if(!n){a["delete"](e);e.removeRecord(i)}},updateFilter:function(e,r,t){var i=this.store.typeMapFor(r);var n=i.records;var a;for(var o=0,s=n.length;o0;if(!i){e.send("rolledBack")}},pushedData:Ember.K,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,r){r(rr(e,"store").reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollback();e.triggerLater("ready")}},inFlight:{isSaving:true,didSetProperty:ir,becomeDirty:Ember.K,pushedData:Ember.K,unloadRecord:function(e){},willCommit:Ember.K,didCommit:function(e){var r=rr(this,"dirtyType");e.transitionTo("saved");e.send("invokeLifecycleCallbacks",r)},becameInvalid:function(e){e.transitionTo("invalid");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},invalid:{isValid:false,deleteRecord:function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()},didSetProperty:function(e,r){rr(e,"errors").remove(r.name);ir(e,r)},becomeDirty:Ember.K,willCommit:function(e){rr(e,"errors").clear();e.transitionTo("inFlight")},rolledBack:function(e){rr(e,"errors").clear();e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)},exit:function(e){e._inFlightAttributes={}}}};function ar(e){var r={};var t;for(var i in e){t=e[i];if(t&&typeof t==="object"){r[i]=ar(t)}else{r[i]=t}}return r}function or(e,r){for(var t in r){e[t]=r[t]}return e}function sr(e){var r=ar(nr);return or(r,e)}var ur=sr({dirtyType:"created",isNew:true});ur.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var cr=sr({dirtyType:"updated"});ur.uncommitted.deleteRecord=function(e){e.disconnectRelationships();e.transitionTo("deleted.saved");e.send("invokeLifecycleCallbacks"); };ur.uncommitted.rollback=function(e){nr.uncommitted.rollback.apply(this,arguments);e.transitionTo("deleted.saved")};ur.uncommitted.pushedData=function(e){e.transitionTo("loaded.updated.uncommitted");e.triggerLater("didLoad")};ur.uncommitted.propertyWasReset=Ember.K;function lr(e){}cr.inFlight.unloadRecord=lr;cr.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()};var dr={isEmpty:false,isLoading:false,isLoaded:false,isDirty:false,isSaving:false,isDeleted:false,isNew:false,isValid:true,rolledBack:Ember.K,unloadRecord:function(e){e.clearRelationships();e.transitionTo("deleted.saved")},propertyWasReset:Ember.K,empty:{isEmpty:true,loadingData:function(e,r){e._loadingPromise=r;e.transitionTo("loading")},loadedData:function(e){e.transitionTo("loaded.created.uncommitted");e.triggerLater("ready")},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");e.triggerLater("ready")}},loading:{isLoading:true,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");e.triggerLater("ready");tr(e,"isError",false)},becameError:function(e){e.triggerLater("becameError",e)},notFound:function(e){e.transitionTo("empty")}},loaded:{initialState:"saved",isLoaded:true,loadingData:Ember.K,saved:{setup:function(e){var r=e._attributes;var t=Ember.keys(r).length>0;if(t){e.adapterDidDirty()}},didSetProperty:ir,pushedData:Ember.K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,r){r(rr(e,"store").reloadRecord(e))},deleteRecord:function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()},unloadRecord:function(e){e.clearRelationships();e.transitionTo("deleted.saved")},didCommit:function(e){e.send("invokeLifecycleCallbacks",rr(e,"lastDirtyType"))},notFound:Ember.K},created:ur,updated:cr},deleted:{initialState:"uncommitted",dirtyType:"deleted",isDeleted:true,isLoaded:true,isDirty:true,setup:function(e){e.updateRecordArrays()},uncommitted:{willCommit:function(e){e.transitionTo("inFlight")},rollback:function(e){e.rollback();e.triggerLater("ready")},becomeDirty:Ember.K,deleteRecord:Ember.K,rolledBack:function(e){e.transitionTo("loaded.saved");e.triggerLater("ready")}},inFlight:{isSaving:true,unloadRecord:lr,willCommit:Ember.K,didCommit:function(e){e.transitionTo("saved");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)},becameInvalid:function(e){e.transitionTo("invalid");e.triggerLater("becameInvalid",e)}},saved:{isDirty:false,setup:function(e){var r=rr(e,"store");r._dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e);e.triggerLater("didCommit",e)},willCommit:Ember.K,didCommit:Ember.K},invalid:{isValid:false,didSetProperty:function(e,r){rr(e,"errors").remove(r.name);ir(e,r)},deleteRecord:Ember.K,becomeDirty:Ember.K,willCommit:Ember.K,rolledBack:function(e){rr(e,"errors").clear();e.transitionTo("loaded.saved");e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")}}},invokeLifecycleCallbacks:function(e,r){if(r==="created"){e.triggerLater("didCreate",e)}else{e.triggerLater("didUpdate",e)}e.triggerLater("didCommit",e)}};function hr(e,r,t){e=or(r?Ember.create(r):{},e);e.parentState=r;e.stateName=t;for(var i in e){if(!e.hasOwnProperty(i)||i==="parentState"||i==="stateName"){continue}if(typeof e[i]==="object"){e[i]=hr(e[i],e,t+"."+i)}}return e}dr=hr(dr,null,"root");var fr=dr;var pr=Ember.get;var mr=Ember.isEmpty;var vr=Ember.EnumerableUtils.map;var yr=Ember.Object.extend(Ember.Enumerable,Ember.Evented,{registerHandlers:function(e,r,t){this.on("becameInvalid",e,r);this.on("becameValid",e,t)},errorsByAttributeName:Ember.reduceComputed("content",{initialValue:function(){return d.create({defaultValue:function(){return Ember.A()}})},addedItem:function(e,r){e.get(r.attribute).pushObject(r);return e},removedItem:function(e,r){e.get(r.attribute).removeObject(r);return e}}),errorsFor:function(e){return pr(this,"errorsByAttributeName").get(e)},messages:Ember.computed.mapBy("content","message"),content:Ember.computed(function(){return Ember.A()}),unknownProperty:function(e){var r=this.errorsFor(e);if(mr(r)){return null}return r},nextObject:function(e,r,t){return pr(this,"content").objectAt(e)},length:Ember.computed.oneWay("content.length").readOnly(),isEmpty:Ember.computed.not("length").readOnly(),add:function(e,r){var t=pr(this,"isEmpty");r=this._findOrCreateMessages(e,r);pr(this,"content").addObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(t&&!pr(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return vr(Ember.makeArray(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(pr(this,"isEmpty")){return}var r=pr(this,"content").rejectBy("attribute",e);pr(this,"content").setObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(pr(this,"isEmpty")){this.trigger("becameValid")}},clear:function(){if(pr(this,"isEmpty")){return}pr(this,"content").clear();this.enumerableContentDidChange();this.trigger("becameValid")},has:function(e){return!mr(this.errorsFor(e))}});function br(e,r){if(!r||typeof r!=="object"){return e}var t=Ember.keys(r);var i;var n=t.length;for(var a=0;a0){r=e[0];this.removeRecord(r)}},disconnect:function(){this.members.forEach(function(e){this.removeRecordFromInverse(e)},this)},reconnect:function(){this.members.forEach(function(e){this.addRecordToInverse(e)},this)},removeRecords:function(e){var r=this;Rr(e,function(e){r.removeRecord(e)})},addRecords:function(e,r){var t=this;Rr(e,function(e){t.addRecord(e,r);if(r!==undefined){r++}})},addCanonicalRecords:function(e,r){for(var t=0;t0){i=this.currentState.slice(e,e+r);this.get("relationship").removeRecords(i)}if(t){this.get("relationship").addRecords(t,e)}},promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--;if(this.loadingRecordsCount===0){Ar(this,"isLoaded",true);this.trigger("didLoad")}},reload:function(){return this.relationship.reload()},save:function(){var e=this;var r="DS: ManyArray#save "+Fr(this,"type");var t=Ember.RSVP.all(this.invoke("save"),r).then(function(r){return e},null,"DS: ManyArray#save return ManyArray");return ye.create({promise:t})},createRecord:function(e){var r=Fr(this,"store");var t=Fr(this,"type");var i;i=r.createRecord(t,e);this.pushObject(i);return i},addRecord:function(e){this.addObject(e)},removeRecord:function(e){this.removeObject(e)}});var Tr=function(e,r,t,i){this._super$constructor(e,r,t,i);this.belongsToType=i.type;this.canonicalState=[];this.manyArray=zr.create({canonicalState:this.canonicalState,store:this.store,relationship:this,type:this.belongsToType,record:r});this.isPolymorphic=i.options.polymorphic;this.manyArray.isPolymorphic=this.isPolymorphic};Tr.prototype=Ember.create(_r.prototype);Tr.prototype.constructor=Tr;Tr.prototype._super$constructor=_r;Tr.prototype.destroy=function(){this.manyArray.destroy()};Tr.prototype._super$addCanonicalRecord=_r.prototype.addCanonicalRecord;Tr.prototype.addCanonicalRecord=function(e,r){if(this.canonicalMembers.has(e)){return}if(r!==undefined){this.canonicalState.splice(r,0,e)}else{this.canonicalState.push(e)}this._super$addCanonicalRecord(e,r)};Tr.prototype._super$addRecord=_r.prototype.addRecord;Tr.prototype.addRecord=function(e,r){if(this.members.has(e)){return}this._super$addRecord(e,r);this.manyArray.internalAddRecords([e],r)};Tr.prototype._super$removeCanonicalRecordFromOwn=_r.prototype.removeCanonicalRecordFromOwn;Tr.prototype.removeCanonicalRecordFromOwn=function(e,r){var t=r;if(!this.canonicalMembers.has(e)){return}if(t===undefined){t=this.canonicalState.indexOf(e)}if(t>-1){this.canonicalState.splice(t,1)}this._super$removeCanonicalRecordFromOwn(e,r)};Tr.prototype._super$flushCanonical=_r.prototype.flushCanonical;Tr.prototype.flushCanonical=function(){this.manyArray.flushCanonical();this._super$flushCanonical()};Tr.prototype._super$removeRecordFromOwn=_r.prototype.removeRecordFromOwn;Tr.prototype.removeRecordFromOwn=function(e,r){if(!this.members.has(e)){return}this._super$removeRecordFromOwn(e,r);if(r!==undefined){this.manyArray.currentState.removeAt(r)}else{this.manyArray.internalRemoveRecords([e])}};Tr.prototype.notifyRecordRelationshipAdded=function(e,r){var t=this.relationshipMeta.type;this.record.notifyHasManyAdded(this.key,e,r)};Tr.prototype.reload=function(){var e=this;if(this.link){return this.fetchLink()}else{return this.store.scheduleFetchMany(this.manyArray.toArray()).then(function(){e.manyArray.set("isLoaded",true);return e.manyArray})}};Tr.prototype.computeChanges=function(e){var r=this.canonicalMembers;var t=[];var i;var n;var a;e=kr(e);r.forEach(function(r){if(e.has(r)){return}t.push(r)});this.removeCanonicalRecords(t);e=e.toArray();i=e.length;for(a=0;a1){var i=rt(this,e);if(t!==i){this._attributes[e]=t;this.send("didSetProperty",{name:e,oldValue:i,originalValue:this._data[e],value:t})}return t}else if(et(this,e)){return rt(this,e)}else{return Zr(this,r,e)}}).meta(t)}var it=tt;var nt=Jr;var at=Ember.__loader.require("backburner")["default"]||Ember.__loader.require("backburner")["Backburner"];if(!at.prototype.join){var ot=function(e){return typeof e==="string"};at.prototype.join=function(){var e,r;if(this.currentInstance){var t=arguments.length;if(t===1){e=arguments[0];r=null}else{r=arguments[0];e=arguments[1]}if(ot(e)){e=r[e]}if(t===1){return e()}else if(t===2){return e.call(r)}else{var i=new Array(t-2);for(var n=0,a=t-2;n1){we(i,t,r,d,l).then(s).then(u(l)).then(null,c(l))}else if(d.length===1){var h=Ember.A(e).findBy("record",a[0]);o(h)}else{}})}else{dt(e,o)}},getById:function(e,r){if(this.hasRecordForId(e,r)){return this.recordForId(e,r)}else{return null}},reloadRecord:function(e){var r=e.constructor;var t=this.adapterFor(r);var i=st(e,"id");return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=gt(r);var n=this.typeMapFor(t).idToRecord[i];return!!n&&st(n,"isLoaded")},recordForId:function(e,r){var t=this.modelFor(e);var i=gt(r);var n=this.typeMapFor(t).idToRecord;var a=n[i];if(!a||!n[i]){a=this.buildRecord(t,i)}return a},findMany:function(e){var r=this;return pt.all(ft(e,function(e){return r._findByRecord(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.constructor);return De(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.constructor);return Pe(i,this,e,r,t)},findQuery:function(e,r){var t=this.modelFor(e);var i=this.recordArrayManager.createAdapterPopulatedRecordArray(t,r);var n=this.adapterFor(t);return Re(Ie(n,this,t,r,i))},findAll:function(e){return this.fetchAll(e)},_fetchAll:function(e,r){var t=this.adapterFor(e);var i=this.typeMapFor(e).metadata.since;ut(r,"isUpdating",true);return Re(Oe(t,this,e,i))},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;ut(r,"isUpdating",false)},all:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.findAllCache;if(i){this.recordArrayManager.updateFilter(i,r);return i}var n=this.recordArrayManager.createRecordArray(r);t.findAllCache=n;return n},unloadAll:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.records.slice();var n;for(var a=0;ai.attributeLimit){return false}var a=Ht(Vt(n).replace("_"," "));r.push({name:n,desc:a})});return r},getRecords:function(e){return this.get("store").all(e)},getRecordColumnValues:function(e){var r=this;var t=0;var i={id:Nt(e,"id")};e.eachAttribute(function(n){if(t++>r.attributeLimit){return false}var a=Nt(e,n);i[n]=a});return i},getRecordKeywords:function(e){var r=[];var t=Ember.A(["id"]);e.eachAttribute(function(e){t.push(e)});t.forEach(function(t){r.push(Nt(e,t))});return r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("isDirty")&&!e.get("isNew"),isClean:!e.get("isDirty")}},getRecordColor:function(e){var r="black";if(e.get("isNew")){r="green"}else if(e.get("isDirty")){r="blue"}return r},observeRecord:function(e,r){var t=Ember.A();var i=this;var n=Ember.A(["id","isNew","isDirty"]);e.eachAttribute(function(e){n.push(e)});n.forEach(function(n){var a=function(){r(i.wrapRecord(e))};Ember.addObserver(e,n,a);t.push(function(){Ember.removeObserver(e,n,a)})});var a=function(){t.forEach(function(e){e()})};return a}});function qt(e){e.register("data-adapter:main",Wt)}var Qt=qt;function Xt(e,r){Qt(e,r);jt(e,r);Ut(e,r);Ct(e,r);he(e,r)}var Gt=Xt;var Jt=Ember.K;Ember.onLoad("Ember.Application",function(e){e.initializer({name:"ember-data",initialize:Gt});e.initializer({name:"store",after:"ember-data",initialize:Jt});e.initializer({name:"activeModelAdapter",before:"store",initialize:Jt});e.initializer({name:"transforms",before:"store",initialize:Jt});e.initializer({name:"data-adapter",before:"store",initialize:Jt});e.initializer({name:"injectStore",before:"store",initialize:Jt})});Ember.Date=Ember.Date||{};var Yt=Date.parse;var Zt=[1,4,5,6,7,10,11];Ember.Date.parse=function(e){var r,t;var i=0;if(t=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(e)){for(var n=0,a;a=Zt[n];++n){t[a]=+t[a]||0}t[2]=(+t[2]||1)-1;t[3]=+t[3]||1;if(t[8]!=="Z"&&t[9]!==undefined){i=t[10]*60+t[11];if(t[9]==="+"){i=0-i}}r=Date.UTC(t[1],t[2],t[3],t[4],t[5]+i,t[6],t[7])}else{r=Yt?Yt(e):NaN}return r};if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.Date){Date.parse=Ember.Date.parse}nt.reopen({_debugInfo:function(){var e=["id"];var r={belongsTo:[],hasMany:[]};var t=[];this.eachAttribute(function(r,t){e.push(r)},this);this.eachRelationship(function(e,i){r[i.kind].push(e);t.push(e)});var i=[{name:"Attributes",properties:e,expand:true},{name:"Belongs To",properties:r.belongsTo,expand:true},{name:"Has Many",properties:r.hasMany,expand:true},{name:"Flags",properties:["isLoaded","isDirty","isSaving","isDeleted","isError","isNew","isValid"]}];return{propertyInfo:{includeOtherProperties:true,groups:i,expensiveProperties:t}}}});var ei=nt;var ri=Wt;var ti=Ember.get;var ii=Ember.EnumerableUtils.forEach;var ni=Ember.String.camelize;var ai=Ember.Mixin.create({normalize:function(e,r,t){var i=this._super(e,r,t);return oi(this,this.store,e,i)},keyForRelationship:function(e,r){if(this.hasDeserializeRecordsOption(e)){return this.keyForAttribute(e)}else{return this._super(e,r)||e}},serializeBelongsTo:function(e,r,t){var i=t.key;if(this.noSerializeOptionSpecified(i)){this._super(e,r,t);return}var n=this.hasSerializeIdsOption(i);var a=this.hasSerializeRecordsOption(i);var o=e.belongsTo(i);var s;if(n){s=this.keyForRelationship(i,t.kind);if(!o){r[s]=null}else{r[s]=o.id}}else if(a){s=this.keyForAttribute(i);if(!o){r[s]=null}else{r[s]=o.record.serialize({includeId:true});this.removeEmbeddedForeignKey(e,o,t,r[s])}}},serializeHasMany:function(e,r,t){var i=t.key;if(this.noSerializeOptionSpecified(i)){this._super(e,r,t);return}var n=this.hasSerializeIdsOption(i);var a=this.hasSerializeRecordsOption(i);var o;if(n){o=this.keyForRelationship(i,t.kind);r[o]=e.hasMany(i,{ids:true})}else if(a){o=this.keyForAttribute(i);r[o]=e.hasMany(i).map(function(r){var i=r.record.serialize({includeId:true});this.removeEmbeddedForeignKey(e,r,t,i);return i},this)}},removeEmbeddedForeignKey:function(e,r,t,i){if(t.kind==="hasMany"){return}else if(t.kind==="belongsTo"){var n=e.type.inverseFor(t.key);if(n){var a=n.name;var o=this.store.serializerFor(r.type);var s=o.keyForRelationship(a,n.kind);if(s){delete i[s]}}}},hasEmbeddedAlwaysOption:function(e){var r=this.attrsOption(e);return r&&r.embedded==="always"},hasSerializeRecordsOption:function(e){var r=this.hasEmbeddedAlwaysOption(e);var t=this.attrsOption(e);return r||t&&t.serialize==="records"},hasSerializeIdsOption:function(e){var r=this.attrsOption(e);return r&&(r.serialize==="ids"||r.serialize==="id")},noSerializeOptionSpecified:function(e){var r=this.attrsOption(e);return!(r&&(r.serialize||r.embedded))},hasDeserializeRecordsOption:function(e){var r=this.hasEmbeddedAlwaysOption(e);var t=this.attrsOption(e);return r||t&&t.deserialize==="records"},attrsOption:function(e){var r=this.get("attrs");return r&&(r[ni(e)]||r[e])}});function oi(e,r,t,i){t.eachRelationship(function(t,n){if(e.hasDeserializeRecordsOption(t)){var a=r.modelFor(n.type.typeKey);if(n.kind==="hasMany"){if(n.options.polymorphic){ui(r,t,i)}else{si(r,t,a,i)}}if(n.kind==="belongsTo"){if(n.options.polymorphic){li(r,t,i)}else{ci(r,t,a,i)}}}});return i}function si(e,r,t,i){if(!i[r]){return i}var n=[];var a=e.serializerFor(t.typeKey);ii(i[r],function(r){var i=a.normalize(t,r,null);e.push(t,i);n.push(i.id)});i[r]=n;return i}function ui(e,r,t){if(!t[r]){return t}var i=[];ii(t[r],function(r){var t=r.type;var n=e.serializerFor(t);var a=e.modelFor(t);var o=ti(n,"primaryKey");var s=n.normalize(a,r,null);e.push(a,s);i.push({id:s[o],type:t})});t[r]=i;return t}function ci(e,r,t,i){if(!i[r]){return i}var n=e.serializerFor(t.typeKey);var a=n.normalize(t,i[r],null);e.push(t,a);i[r]=a.id;return i}function li(e,r,t){if(!t[r]){return t}var i=t[r];var n=i.type;var a=e.serializerFor(n);var o=e.modelFor(n);var s=ti(a,"primaryKey");var u=a.normalize(o,i,null);e.push(o,u);t[r]=u[s];t[r+"Type"]=n;return t}var di=ai;function hi(e,r){if(typeof e==="object"){r=e;e=undefined}r=r||{};var t={type:e,isRelationship:true,options:r,kind:"belongsTo",key:null};return Ember.computed(function(e,r){if(arguments.length>1){if(r===undefined){r=null}if(r&&r.then){this._relationships[e].setRecordPromise(r)}else{this._relationships[e].setRecord(r)}}return this._relationships[e].getRecord()}).meta(t)}nt.reopen({notifyBelongsToChanged:function(e){this.notifyPropertyChange(e)}});var fi=hi;function pi(e,r){if(typeof e==="object"){r=e;e=undefined}r=r||{};var t={type:e,isRelationship:true,options:r,kind:"hasMany",key:null};return Ember.computed(function(e){var r=this._relationships[e];return r.getRecords()}).meta(t).readOnly()}nt.reopen({notifyHasManyAdded:function(e){this.notifyPropertyChange(e)}});var mi=pi;function vi(e,r){var t,i;t=r.type||r.key;if(typeof t==="string"){if(r.kind==="hasMany"){t=x(t)}i=e.modelFor(t)}else{i=r.type}return i}function yi(e,r){return{key:r.key,kind:r.kind,type:vi(e,r),options:r.options,parentType:r.parentType,isRelationship:true}}var bi=Ember.get;var gi=Ember.ArrayPolyfills.filter;var Ri=Ember.computed(function(){if(Ember.testing===true&&Ri._cacheable===true){Ri._cacheable=false}var e=new d({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var i=e.get(vi(this.store,t));i.push({name:r,kind:t.kind})}});return e}).readOnly();var Ei=Ember.computed(function(){if(Ember.testing===true&&Ei._cacheable===true){Ei._cacheable=false}var e;var r=Ember.A();this.eachComputedProperty(function(t,i){if(i.isRelationship){i.key=t;e=vi(this.store,i);if(!r.contains(e)){r.push(e)}}});return r}).readOnly();var _i=Ember.computed(function(){if(Ember.testing===true&&_i._cacheable===true){_i._cacheable=false}var e=l.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var i=yi(this.store,t);i.type=vi(this.store,t);e.set(r,i)}});return e}).readOnly();nt.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});nt.reopenClass({typeForRelationship:function(e){var r=bi(this,"relationshipsByName").get(e);return r&&r.type},inverseMap:Ember.computed(function(){return Ember.create(null)}),inverseFor:function(e){var r=bi(this,"inverseMap");if(r[e]){return r[e]}else{var t=this._findInverseFor(e);r[e]=t;return t}},_findInverseFor:function(e){var r=this.typeForRelationship(e);if(!r){return null}var t=this.metaForProperty(e);var i=t.options;if(i.inverse===null){return null}var n,a,o;if(i.inverse){n=i.inverse;o=Ember.get(r,"relationshipsByName").get(n);a=o.kind}else{var s=c(this,r);if(s.length===0){return null}var u=gi.call(s,function(t){var i=r.metaForProperty(t.name).options;return e===i.inverse});if(u.length===1){s=u}n=s[0].name;a=s[0].kind}function c(r,t,i){var n=i||[];var a=bi(t,"relationships");if(!a){return}var o=a.get(r);o=gi.call(o,function(r){var i=t.metaForProperty(r.name).options;if(!i.inverse){return true}return e===i.inverse});if(o){n.push.apply(n,o)}if(r.superclass){c(r.superclass,t,n)}return n}return{type:r,name:n,kind:a}},relationships:Ri,relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};this.eachComputedProperty(function(r,t){if(t.isRelationship){e[t.kind].push(r)}});return e}),relatedTypes:Ei,relationshipsByName:_i,fields:Ember.computed(function(){var e=l.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){e.set(r,t.kind)}else if(t.isAttribute){e.set(r,"attribute")}});return e}).readOnly(),eachRelationship:function(e,r){bi(this,"relationshipsByName").forEach(function(t,i){e.call(r,i,t)})},eachRelatedType:function(e,r){bi(this,"relatedTypes").forEach(function(t){e.call(r,t)})},determineRelationshipType:function(e){var r=e.key;var t=e.kind;var i=this.inverseFor(r);var n,a;if(!i){return t==="belongsTo"?"oneToNone":"manyToNone"}n=i.name;a=i.kind;if(a==="belongsTo"){return t==="belongsTo"?"oneToOne":"manyToOne"}else{return t==="belongsTo"?"oneToMany":"manyToMany"}}});nt.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return bi(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e)}});Ember.RSVP.Promise.cast=Ember.RSVP.Promise.cast||Ember.RSVP.resolve;pe.Store=vt;pe.PromiseArray=ye;pe.PromiseObject=be;pe.PromiseManyArray=_e;pe.Model=nt;pe.RootState=fr;pe.attr=it;pe.Errors=yr;pe.Snapshot=Ir;pe.Adapter=i;pe.InvalidError=t;pe.Serializer=H;pe.DebugAdapter=ri;pe.RecordArray=Ke;pe.FilteredRecordArray=Be;pe.AdapterPopulatedRecordArray=He;pe.ManyArray=zr;pe.RecordArrayManager=Ye;pe.RESTAdapter=y;pe.BuildURLMixin=p;pe.FixtureAdapter=c;pe.RESTSerializer=re;pe.JSONSerializer=X;pe.Transform=Mt;pe.DateTransform=Ot;pe.StringTransform=$t;pe.NumberTransform=Dt;pe.BooleanTransform=Lt;pe.ActiveModelAdapter=U;pe.ActiveModelSerializer=ue;pe.EmbeddedRecordsMixin=di;pe.belongsTo=fi;pe.hasMany=mi;pe.Relationship=_r;pe.ContainerProxy=le;pe._setupContainer=Gt;Ember.lookup.DS=pe;var Fi=pe}).call(this);