ember-data-source 1.0.0.beta.11 → 1.0.0.beta.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
- define("activemodel-adapter",["activemodel-adapter/system","exports"],function(e,r){"use strict";var t=e.ActiveModelAdapter;var i=e.ActiveModelSerializer;r.ActiveModelAdapter=t;r.ActiveModelSerializer=i});define("activemodel-adapter/setup-container",["ember-data/system/container_proxy","activemodel-adapter/system/active_model_serializer","activemodel-adapter/system/active_model_adapter","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];var s=t["default"];i["default"]=function o(e,r){var t=new a(e);t.registerDeprecations([{deprecated:"serializer:_ams",valid:"serializer:-active-model"},{deprecated:"adapter:_ams",valid:"adapter:-active-model"}]);e.register("serializer:-active-model",n);e.register("adapter:-active-model",s)}});define("activemodel-adapter/system",["activemodel-adapter/system/active_model_adapter","activemodel-adapter/system/active_model_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.ActiveModelAdapter=i;t.ActiveModelSerializer=a});define("activemodel-adapter/system/active_model_adapter",["ember-data/adapters","ember-data/system/adapter","ember-inflector","exports"],function(e,r,t,i){"use strict";var a=e.RESTAdapter;var n=r.InvalidError;var s=t.pluralize;var o=Ember.EnumerableUtils.forEach;var d=Ember.String.decamelize,u=Ember.String.underscore;var c=a.extend({defaultSerializer:"-active-model",pathForType:function(e){var r=d(e);var t=u(r);return s(t)},ajaxError:function(e){var r=this._super(e);if(e&&e.status===422){var t=Ember.$.parseJSON(e.responseText),i={};if(t.errors!==undefined){var a=t.errors;o(Ember.keys(a),function(e){i[Ember.String.camelize(e)]=a[e]})}return new n(i)}else{return r}}});i["default"]=c});define("activemodel-adapter/system/active_model_serializer",["ember-inflector","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e.singularize;var a=r["default"];var n=Ember.get,s=Ember.EnumerableUtils.forEach,o=Ember.String.camelize,d=Ember.String.capitalize,u=Ember.String.decamelize,c=Ember.String.underscore;var l=a.extend({keyForAttribute:function(e){return u(e)},keyForRelationship:function(e,r){var t=u(e);if(r==="belongsTo"){return t+"_id"}else if(r==="hasMany"){return i(t)+"_ids"}else{return t}},serializeHasMany:Ember.K,serializeIntoHash:function(e,r,t,i){var a=c(u(r.typeKey));e[a]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var a=n(e,i);var s=c(i+"_type");if(Ember.isNone(a)){r[s]=null}else{r[s]=d(o(a.constructor.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=o(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,a;if(t.options.polymorphic){i=this.keyForAttribute(e);a=r[i];if(a&&a.type){a.type=this.typeForRoot(a.type)}else if(a&&t.kind==="hasMany"){var n=this;s(a,function(e){e.type=n.typeForRoot(e.type)})}}else{i=this.keyForRelationship(e,t.kind);if(!r.hasOwnProperty(i)){return}a=r[i]}r[e]=a;if(e!==i){delete r[i]}},this)}}});t["default"]=l});define("ember-data",["ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],function(e,r,t,i,a,n,s,o,d,u,c,l,f,h,p,m,y,v,b,g,R,E){"use strict";Ember.RSVP.Promise.cast=Ember.RSVP.Promise.cast||Ember.RSVP.resolve;var _=e["default"];var A=t.PromiseArray;var F=t.PromiseObject;var z=i.Store;var x=a.Model;var T=a.Errors;var S=a.RootState;var k=a.attr;var M=n.InvalidError;var D=n.Adapter;var P=s["default"];var O=o.RecordArray;var C=o.FilteredRecordArray;var w=o.AdapterPopulatedRecordArray;var $=o.ManyArray;var I=d["default"];var L=u.RESTAdapter;var K=u.FixtureAdapter;var j=c["default"];var U=l["default"];var B=h["default"];var N=p.ActiveModelAdapter;var V=p.ActiveModelSerializer;var H=m.Transform;var W=m.DateTransform;var q=m.NumberTransform;var Q=m.StringTransform;var X=m.BooleanTransform;var J=y.hasMany;var G=y.belongsTo;var Y=b["default"];var Z=g["default"];var er=R.Relationship;_.Store=z;_.PromiseArray=A;_.PromiseObject=F;_.Model=x;_.RootState=S;_.attr=k;_.Errors=T;_.Adapter=D;_.InvalidError=M;_.DebugAdapter=P;_.RecordArray=O;_.FilteredRecordArray=C;_.AdapterPopulatedRecordArray=w;_.ManyArray=$;_.RecordArrayManager=I;_.RESTAdapter=L;_.FixtureAdapter=K;_.RESTSerializer=U;_.JSONSerializer=j;_.Transform=H;_.DateTransform=W;_.StringTransform=Q;_.NumberTransform=q;_.BooleanTransform=X;_.ActiveModelAdapter=N;_.ActiveModelSerializer=V;_.EmbeddedRecordsMixin=B;_.belongsTo=G;_.hasMany=J;_.Relationship=er;_.ContainerProxy=Z;_._setupContainer=Y;Ember.lookup.DS=_;E["default"]=_});define("ember-data/adapters",["ember-data/adapters/fixture_adapter","ember-data/adapters/rest_adapter","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.RESTAdapter=a;t.FixtureAdapter=i});define("ember-data/adapters/fixture_adapter",["ember-data/system/adapter","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.String.fmt;var a=Ember.EnumerableUtils.indexOf;var n=0;var s=e["default"];r["default"]=s.extend({serializer:null,simulateRemoteResponse:true,latency:50,fixturesForType:function(e){if(e.FIXTURES){var r=Ember.A(e.FIXTURES);return r.map(function(e){var r=typeof e.id;if(r!=="number"&&r!=="string"){throw new Error(i("the id property must be defined as a number or string for fixture %@",[e]))}e.id=e.id+"";return e})}return null},queryFixtures:function(e,r,t){},updateFixtures:function(e,r){if(!e.FIXTURES){e.FIXTURES=[]}var t=e.FIXTURES;this.deleteLoadedFixture(e,r);t.push(r)},mockJSON:function(e,r,t){return e.serializerFor(r).serialize(t,{includeId:true})},generateIdForRecord:function(e){return"fixture-"+n++},find:function(e,r,t){var i=this.fixturesForType(r);var a;if(i){a=Ember.A(i).findBy("id",t)}if(a){return this.simulateRemoteCall(function(){return a},this)}},findMany:function(e,r,t){var i=this.fixturesForType(r);if(i){i=i.filter(function(e){return a(t,e.id)!==-1})}if(i){return this.simulateRemoteCall(function(){return i},this)}},findAll:function(e,r){var t=this.fixturesForType(r);return this.simulateRemoteCall(function(){return t},this)},findQuery:function(e,r,t,i){var a=this.fixturesForType(r);a=this.queryFixtures(a,t,r);if(a){return this.simulateRemoteCall(function(){return a},this)}},createRecord:function(e,r,t){var i=this.mockJSON(e,r,t);this.updateFixtures(r,i);return this.simulateRemoteCall(function(){return i},this)},updateRecord:function(e,r,t){var i=this.mockJSON(e,r,t);this.updateFixtures(r,i);return this.simulateRemoteCall(function(){return i},this)},deleteRecord:function(e,r,t){this.deleteLoadedFixture(r,t);return this.simulateRemoteCall(function(){return null})},deleteLoadedFixture:function(e,r){var t=this.findExistingFixture(e,r);if(t){var i=a(e.FIXTURES,t);e.FIXTURES.splice(i,1);return true}},findExistingFixture:function(e,r){var i=this.fixturesForType(e);var a=t(r,"id");return this.findFixtureById(i,a)},findFixtureById:function(e,r){return Ember.A(e).find(function(e){if(""+t(e,"id")===""+r){return true}else{return false}})},simulateRemoteCall:function(e,r){var i=this;return new Ember.RSVP.Promise(function(a){var n=Ember.copy(e.call(r),true);if(t(i,"simulateRemoteResponse")){Ember.run.later(function(){a(n)},t(i,"latency"))}else{Ember.run.schedule("actions",null,function(){a(n)})}},"DS: FixtureAdapter#simulateRemoteCall")}})});define("ember-data/adapters/rest_adapter",["ember-data/system/adapter","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.Adapter;var a=e.InvalidError;var n=r.MapWithDefault;var s=Ember.get;var o=Ember.ArrayPolyfills.forEach;t["default"]=i.extend({defaultSerializer:"-rest",coalesceFindRequests:false,find:function(e,r,t,i){return this.ajax(this.buildURL(r.typeKey,t,i),"GET")},findAll:function(e,r,t){var i;if(t){i={since:t}}return this.ajax(this.buildURL(r.typeKey),"GET",{data:i})},findQuery:function(e,r,t){return this.ajax(this.buildURL(r.typeKey),"GET",{data:t})},findMany:function(e,r,t,i){return this.ajax(this.buildURL(r.typeKey,t,i),"GET",{data:{ids:t}})},findHasMany:function(e,r,t,i){var a=s(this,"host");var n=s(r,"id");var o=r.constructor.typeKey;if(a&&t.charAt(0)==="/"&&t.charAt(1)!=="/"){t=a+t}return this.ajax(this.urlPrefix(t,this.buildURL(o,n)),"GET")},findBelongsTo:function(e,r,t,i){var a=s(r,"id");var n=r.constructor.typeKey;return this.ajax(this.urlPrefix(t,this.buildURL(n,a)),"GET")},createRecord:function(e,r,t){var i={};var a=e.serializerFor(r.typeKey);a.serializeIntoHash(i,r,t,{includeId:true});return this.ajax(this.buildURL(r.typeKey,null,t),"POST",{data:i})},updateRecord:function(e,r,t){var i={};var a=e.serializerFor(r.typeKey);a.serializeIntoHash(i,r,t);var n=s(t,"id");return this.ajax(this.buildURL(r.typeKey,n,t),"PUT",{data:i})},deleteRecord:function(e,r,t){var i=s(t,"id");return this.ajax(this.buildURL(r.typeKey,i,t),"DELETE")},buildURL:function(e,r,t){var i=[],a=s(this,"host"),n=this.urlPrefix();if(e){i.push(this.pathForType(e))}if(r&&!Ember.isArray(r)){i.push(encodeURIComponent(r))}if(n){i.unshift(n)}i=i.join("/");if(!a&&i){i="/"+i}return i},urlPrefix:function(e,r){var t=s(this,"host");var i=s(this,"namespace");var a=[];if(e){if(e.charAt(0)==="/"){if(t){e=e.slice(1);a.push(t)}}else if(!/^http(s)?:\/\//.test(e)){a.push(r)}}else{if(t){a.push(t)}if(i){a.push(i)}}if(e){a.push(e)}return a.join("/")},_stripIDFromURL:function(e,r){var t=e.modelFor(r);var i=this.buildURL(t.typeKey,r.get("id"),r);var a=i.split("/");var n=a[a.length-1];var s=r.get("id");if(n===s){a[a.length-1]=""}else if(d(n,"?id="+s)){a[a.length-1]=n.substring(0,n.length-s.length-1)}return a.join("/")},groupRecordsForFindMany:function(e,r){var t=n.create({defaultValue:function(){return[]}});var i=this;o.call(r,function(r){var a=i._stripIDFromURL(e,r);t.get(a).push(r)});function a(r,t){var a=i._stripIDFromURL(e,r[0]);var n=0;var s=[[]];o.call(r,function(e){var r="&ids[]=".length+e.get("id.length");if(a.length+n+r>=t){n=0;s.push([])}n+=r;var i=s.length-1;s[i].push(e)});return s}var s=[];t.forEach(function(e,r){var t=2048;var i=a(e,t);o.call(i,function(e){s.push(e)})});return s},pathForType:function(e){var r=Ember.String.camelize(e);return Ember.String.pluralize(r)},ajaxError:function(e,r){if(e&&typeof e==="object"){e.then=null}return e},ajaxSuccess:function(e,r){return r},ajax:function(e,r,t){var i=this;return new Ember.RSVP.Promise(function(n,s){var o=i.ajaxOptions(e,r,t);o.success=function(e,r,t){e=i.ajaxSuccess(t,e);if(e instanceof a){Ember.run(null,s,e)}else{Ember.run(null,n,e)}};o.error=function(e,r,t){Ember.run(null,s,i.ajaxError(e,e.responseText))};Ember.$.ajax(o)},"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 a=s(this,"headers");if(a!==undefined){i.beforeSend=function(e){o.call(Ember.keys(a),function(r){e.setRequestHeader(r,a[r])})}}return i}});function d(e,r){if(typeof String.prototype.endsWith!=="function"){return e.indexOf(r,e.length-r.length)!==-1}else{return e.endsWith(r)}}});define("ember-data/core",["exports"],function(e){"use strict";var r;if("undefined"===typeof r){r=Ember.Namespace.create({VERSION:"1.0.0-beta.11"});if(Ember.libraries){Ember.libraries.registerCoreLibrary("Ember Data",r.VERSION)}}e["default"]=r});define("ember-data/ember-initializer",["ember-data/setup-container"],function(e){"use strict";var r=e["default"];var t=Ember.K;Ember.onLoad("Ember.Application",function(e){e.initializer({name:"ember-data",initialize:r});e.initializer({name:"store",after:"ember-data",initialize:t});e.initializer({name:"activeModelAdapter",before:"store",initialize:t});e.initializer({name:"transforms",before:"store",initialize:t});e.initializer({name:"data-adapter",before:"store",initialize:t});e.initializer({name:"injectStore",before:"store",initialize:t})})});define("ember-data/ext/date",[],function(){"use strict";Ember.Date=Ember.Date||{};var e=Date.parse,r=[1,4,5,6,7,10,11];Ember.Date.parse=function(t){var i,a,n=0;if(a=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)){for(var s=0,o;o=r[s];++s){a[o]=+a[o]||0}a[2]=(+a[2]||1)-1;a[3]=+a[3]||1;if(a[8]!=="Z"&&a[9]!==undefined){n=a[10]*60+a[11];if(a[9]==="+"){n=0-n}}i=Date.UTC(a[1],a[2],a[3],a[4],a[5]+n,a[6],a[7])}else{i=e?e(t):NaN}return i};if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.Date){Date.parse=Ember.Date.parse}});define("ember-data/initializers/data_adapter",["ember-data/system/debug/debug_adapter","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=function i(e){e.register("data-adapter:main",t)}});define("ember-data/initializers/store",["ember-data/serializers","ember-data/adapters","ember-data/system/container_proxy","ember-data/system/store","exports"],function(e,r,t,i,a){"use strict";var n=e.JSONSerializer;var s=e.RESTSerializer;var o=r.RESTAdapter;var d=t["default"];var u=i["default"];a["default"]=function c(e,r){e.register("store:main",e.lookupFactory("store:application")||r&&r.Store||u);var t=new d(e);t.registerDeprecations([{deprecated:"serializer:_default",valid:"serializer:-default"},{deprecated:"serializer:_rest",valid:"serializer:-rest"},{deprecated:"adapter:_rest",valid:"adapter:-rest"}]);e.register("serializer:-default",n);e.register("serializer:-rest",s);e.register("adapter:-rest",o);e.lookup("store:main")}});define("ember-data/initializers/store_injections",["exports"],function(e){"use strict";e["default"]=function r(e){e.injection("controller","store","store:main");e.injection("route","store","store:main");e.injection("serializer","store","store:main");e.injection("data-adapter","store","store:main")}});define("ember-data/initializers/transforms",["ember-data/transforms","exports"],function(e,r){"use strict";var t=e.BooleanTransform;var i=e.DateTransform;var a=e.StringTransform;var n=e.NumberTransform;r["default"]=function s(e){e.register("transform:boolean",t);e.register("transform:date",i);e.register("transform:number",n);e.register("transform:string",a)}});define("ember-data/serializers",["ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.JSONSerializer=i;t.RESTSerializer=a});define("ember-data/serializers/embedded_records_mixin",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.EnumerableUtils.forEach;var i=Ember.String.camelize;var a=Ember.Mixin.create({normalize:function(e,r,t){var i=this._super(e,r,t);return n(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,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o=e.get(a);var d;if(n){d=this.keyForRelationship(a,i.kind);if(!o){t[d]=null}else{t[d]=r(o,"id")}}else if(s){d=this.keyForAttribute(a);if(!o){t[d]=null}else{t[d]=o.serialize({includeId:true});this.removeEmbeddedForeignKey(e,o,i,t[d])}}},serializeHasMany:function(e,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o;if(n){o=this.keyForRelationship(a,i.kind);t[o]=r(e,a).mapBy("id")}else if(s){o=this.keyForAttribute(a);t[o]=r(e,a).map(function(r){var t=r.serialize({includeId:true});this.removeEmbeddedForeignKey(e,r,i,t);return t},this)}},removeEmbeddedForeignKey:function(e,r,t,i){if(t.kind==="hasMany"){return}else if(t.kind==="belongsTo"){var a=e.constructor.inverseFor(t.key);if(a){var n=a.name;var s=this.store.serializerFor(r.constructor);var o=s.keyForRelationship(n,a.kind);if(o){delete i[o]}}}},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[i(e)]||r[e])}});function n(e,r,t,i){t.eachRelationship(function(t,a){if(e.hasDeserializeRecordsOption(t)){var n=r.modelFor(a.type.typeKey);if(a.kind==="hasMany"){if(a.options.polymorphic){o(r,t,i)}else{s(r,t,n,i)}}if(a.kind==="belongsTo"){d(r,t,n,i)}}});return i}function s(e,r,i,a){if(!a[r]){return a}var n=[];var s=e.serializerFor(i.typeKey);t(a[r],function(r){var t=s.normalize(i,r,null);e.push(i,t);n.push(t.id)});a[r]=n;return a}function o(e,i,a){if(!a[i]){return a}var n=[];t(a[i],function(t){var i=t.type;var a=e.serializerFor(i);var s=e.modelFor(i);var o=r(a,"primaryKey");var d=a.normalize(s,t,null);e.push(s,d);n.push({id:d[o],type:i})});a[i]=n;return a}function d(e,r,t,i){if(!i[r]){return i}var a=e.serializerFor(t.typeKey);var n=a.normalize(t,i[r],null);e.push(t,n);i[r]=n.id;return i}e["default"]=a});define("ember-data/serializers/json_serializer",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.isNone;var i=Ember.ArrayPolyfills.map;var a=Ember.merge;e["default"]=Ember.Object.extend({primaryKey:"id",applyTransforms:function(e,r){e.eachTransformedAttribute(function t(e,i){if(!r.hasOwnProperty(e)){return}var a=this.transformFor(i);r[e]=a.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,t){var i=r(this,"attrs"),a,n;if(i){for(n in i){a=this._getMappedKey(n);if(!t.hasOwnProperty(a)){continue}if(a!==n){t[n]=t[a];delete t[a]}}}},normalizeId:function(e){var t=r(this,"primaryKey");if(t==="id"){return}e.id=e[t];delete e[t]},_getMappedKey:function(e){var t=r(this,"attrs");var i;if(t&&t[e]){i=t[e];if(i.key){i=i.key}if(typeof i==="string"){e=i}}return e},_canSerialize:function(e){var t=r(this,"attrs");return!t||!t[e]||t[e].serialize!==false},serialize:function(e,t){var i={};if(t&&t.includeId){var a=r(e,"id");if(a){i[r(this,"primaryKey")]=a}}e.eachAttribute(function(r,t){this.serializeAttribute(e,i,r,t)},this);e.eachRelationship(function(r,t){if(t.kind==="belongsTo"){this.serializeBelongsTo(e,i,t)}else if(t.kind==="hasMany"){this.serializeHasMany(e,i,t)}},this);return i},serializeIntoHash:function(e,r,t,i){a(e,this.serialize(t,i))},serializeAttribute:function(e,t,i,a){var n=a.type;if(this._canSerialize(i)){var s=r(e,i);if(n){var o=this.transformFor(n);s=o.serialize(s)}var d=this._getMappedKey(i);if(d===i&&this.keyForAttribute){d=this.keyForAttribute(i)}t[d]=s}},serializeBelongsTo:function(e,i,a){var n=a.key;if(this._canSerialize(n)){var s=r(e,n);var o=this._getMappedKey(n);if(o===n&&this.keyForRelationship){o=this.keyForRelationship(n,"belongsTo")}if(t(s)||t(r(s,"id"))){i[o]=null}else{i[o]=r(s,"id")}if(a.options.polymorphic){this.serializePolymorphicType(e,i,a)}}},serializeHasMany:function(e,t,i){var a=i.key;if(this._canSerialize(a)){var n;n=this._getMappedKey(a);if(n===a&&this.keyForRelationship){n=this.keyForRelationship(a,"hasMany")}var s=e.constructor.determineRelationshipType(i);if(s==="manyToNone"||s==="manyToMany"){t[n]=r(e,a).mapBy("id")}}},serializePolymorphicType:Ember.K,extract:function(e,r,t,i,a){this.extractMeta(e,r,t);var n="extract"+a.charAt(0).toUpperCase()+a.substr(1);return this[n](e,r,t,i,a)},extractFindAll:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindQuery:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindHasMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractCreateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractUpdateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractDeleteRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractFind:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractFindBelongsTo:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSave:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSingle:function(e,r,t,i,a){t=this.normalizePayload(t);return this.normalize(r,t)},extractArray:function(e,r,t,a,n){var s=this.normalizePayload(t);var o=this;return i.call(s,function(e){return o.normalize(r,e)})},extractMeta:function(e,r,t){if(t&&t.meta){e.metaForType(r,t.meta);delete t.meta}},keyForAttribute:function(e){return e},keyForRelationship:function(e,r){return e},transformFor:function(e,r){var t=this.container.lookup("transform:"+e);return t}})});define("ember-data/serializers/rest_serializer",["ember-data/serializers/json_serializer","ember-inflector/system/string","exports"],function(e,r,t){"use strict";var i=e["default"];var a=Ember.get;var n=Ember.ArrayPolyfills.forEach;var s=Ember.ArrayPolyfills.map;var o=Ember.String.camelize;var d=r.singularize;function u(e){return e==null?null:e+""}var c=i.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 a=this.normalizePayload(t);var s=r.typeKey;var o;for(var d in a){var c=this.typeForRoot(d);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=l.typeKey===s;var h=a[d];if(f&&Ember.typeOf(h)!=="array"){o=this.normalize(r,h,d);continue}n.call(h,function(r){var t=this.typeForRoot(d);var a=e.modelFor(t);var n=e.serializerFor(a);r=n.normalize(a,r,d);var s=f&&!i&&!o;var c=f&&u(r.id)===i;if(s||c){o=r}else{e.push(t,r)}},this)}return o},extractArray:function(e,r,t){var i=this.normalizePayload(t);var a=r.typeKey;var n;for(var o in i){var d=o;var u=false;if(o.charAt(0)==="_"){u=true;d=o.substr(1)}var c=this.typeForRoot(d);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=e.serializerFor(l);var h=!u&&l.typeKey===a;var p=s.call(i[o],function(e){return f.normalize(l,e,o)},this);if(h){n=p}else{e.pushMany(c,p)}}return n},pushPayload:function(e,r){var t=this.normalizePayload(r);for(var i in t){var a=this.typeForRoot(i);if(!e.modelFactoryFor(a,i)){continue}var n=e.modelFor(a);var o=e.serializerFor(n);var d=s.call(Ember.makeArray(t[i]),function(e){return o.normalize(n,e,i)},this);e.pushMany(a,d)}},typeForRoot:function(e){return o(d(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=a(e,i);i=this.keyForAttribute?this.keyForAttribute(i):i;if(Ember.isNone(n)){r[i+"Type"]=null}else{r[i+"Type"]=Ember.String.camelize(n.constructor.typeKey)}}});t["default"]=c});define("ember-data/setup-container",["ember-data/initializers/store","ember-data/initializers/transforms","ember-data/initializers/store_injections","ember-data/initializers/data_adapter","activemodel-adapter/setup-container","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var d=t["default"];var u=i["default"];var c=a["default"];n["default"]=function l(e,r){u(e,r);o(e,r);d(e,r);s(e,r);c(e,r)}});define("ember-data/system/adapter",["exports"],function(e){"use strict";var r=Ember.get;var t=["description","fileName","lineNumber","message","name","number","stack"];function i(e){var r=Error.prototype.constructor.call(this,"The backend rejected the commit because it was invalid: "+Ember.inspect(e));this.errors=e;for(var i=0,a=t.length;i<a;i++){this[t[i]]=r[t[i]]}}i.prototype=Ember.create(Error.prototype);var a=Ember.Object.extend({find:Ember.required(Function),findAll:null,findQuery:null,generateIdForRecord:null,serialize:function(e,t){return r(e,"store").serializerFor(e.constructor.typeKey).serialize(e,t)},createRecord:Ember.required(Function),updateRecord:Ember.required(Function),deleteRecord:Ember.required(Function),coalesceFindRequests:true,groupRecordsForFindMany:function(e,r){return[r]}});e.InvalidError=i;e.Adapter=a;e["default"]=a});define("ember-data/system/container_proxy",["exports"],function(e){"use strict";function r(e){this.container=e}r.prototype.aliasedFactory=function(e,r){var t=this;return{create:function(){if(r){r()}return t.container.lookup(e)}}};r.prototype.registerAlias=function(e,r,t){var i=this.aliasedFactory(r,t);return this.container.register(e,i)};r.prototype.registerDeprecation=function(e,r){var t=function(){};return this.registerAlias(e,r,t)};r.prototype.registerDeprecations=function(e){var r,t,i,a;for(r=e.length;r>0;r--){t=e[r-1];i=t["deprecated"];a=t["valid"];this.registerDeprecation(i,a)}};e["default"]=r});define("ember-data/system/debug",["ember-data/system/debug/debug_info","ember-data/system/debug/debug_adapter","exports"],function(e,r,t){"use strict";var i=r["default"];t["default"]=i});define("ember-data/system/debug/debug_adapter",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;var i=Ember.get;var a=Ember.String.capitalize;var n=Ember.String.underscore;r["default"]=Ember.DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==t&&t.detect(e)},columnsForType:function(e){var r=[{name:"id",desc:"Id"}];var t=0;var s=this;i(e,"attributes").forEach(function(e,i){if(t++>s.attributeLimit){return false}var o=a(n(i).replace("_"," "));r.push({name:i,desc:o})});return r},getRecords:function(e){return this.get("store").all(e)},getRecordColumnValues:function(e){var r=this,t=0;var a={id:i(e,"id")};e.eachAttribute(function(n){if(t++>r.attributeLimit){return false}var s=i(e,n);a[n]=s});return a},getRecordKeywords:function(e){var r=[];var t=Ember.A(["id"]);e.eachAttribute(function(e){t.push(e)});t.forEach(function(t){r.push(i(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(),i=this;var a=Ember.A(["id","isNew","isDirty"]);e.eachAttribute(function(e){a.push(e)});a.forEach(function(a){var n=function(){r(i.wrapRecord(e))};Ember.addObserver(e,a,n);t.push(function(){Ember.removeObserver(e,a,n)})});var n=function(){t.forEach(function(e){e()})};return n}})});define("ember-data/system/debug/debug_info",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;t.reopen({_debugInfo:function(){var e=["id"],r={belongsTo:[],hasMany:[]},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}}}});r["default"]=t});define("ember-data/system/map",["exports"],function(e){"use strict";var r,t;function i(){Ember.OrderedSet.apply(this,arguments)}function a(){Ember.Map.apply(this,arguments)}function n(){Ember.MapWithDefault.apply(this,arguments)}var s=Ember.Map.create();s.set("key","value");var o=false;s.forEach(function(e,r){o=e==="key"&&r==="value"});a.prototype=Object.create(Ember.Map.prototype);n.prototype=Object.create(Ember.MapWithDefault.prototype);i.prototype=Object.create(Ember.OrderedSet.prototype);i.create=function(){return new i};function d(e){return function(r,t){e.call(this,t,r)}}if(o){r=function(e,r){this.__super$forEach(d(e),r)};t=function(e){this.remove(e)};a.prototype.__super$forEach=Ember.Map.prototype.forEach;a.prototype.forEach=r;a.prototype["delete"]=t;n.prototype.forEach=r;n.prototype.__super$forEach=Ember.MapWithDefault.prototype.forEach;n.prototype["delete"]=t;i.prototype["delete"]=t}n.constructor=n;a.constructor=a;n.create=function(e){if(e){return new n(e)}else{return new a}};a.create=function(){return new this.constructor};e["default"]=a;e.Map=a;e.MapWithDefault=n;e.OrderedSet=i});define("ember-data/system/model",["ember-data/system/model/model","ember-data/system/model/attributes","ember-data/system/model/states","ember-data/system/model/errors","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var d=i["default"];a.Model=n;a.RootState=o;a.attr=s;a.Errors=d});define("ember-data/system/model/attributes",["ember-data/system/model/model","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r.Map;var n=Ember.get;i.reopenClass({attributes:Ember.computed(function(){var e=a.create();this.eachComputedProperty(function(r,t){if(t.isAttribute){t.name=r;e.set(r,t)}});return e}).readOnly(),transformedAttributes:Ember.computed(function(){var e=a.create();this.eachAttribute(function(r,t){if(t.type){e.set(r,t.type)}});return e}).readOnly(),eachAttribute:function(e,r){n(this,"attributes").forEach(function(t,i){e.call(r,i,t)},r)},eachTransformedAttribute:function(e,r){n(this,"transformedAttributes").forEach(function(t,i){e.call(r,i,t)})}});i.reopen({eachAttribute:function(e,r){this.constructor.eachAttribute(e,r)}});function s(e,r,t){if(typeof r.defaultValue==="function"){return r.defaultValue.apply(null,arguments)}else{return r.defaultValue}}function o(e,r){return e._attributes.hasOwnProperty(r)||e._inFlightAttributes.hasOwnProperty(r)||e._data.hasOwnProperty(r)}function d(e,r){if(e._attributes.hasOwnProperty(r)){return e._attributes[r]}else if(e._inFlightAttributes.hasOwnProperty(r)){return e._inFlightAttributes[r]}else{return e._data[r]}}t["default"]=function u(e,r){r=r||{};var t={type:e,isAttribute:true,options:r};return Ember.computed("data",function(e,t){if(arguments.length>1){var i=d(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(o(this,e)){return d(this,e)}else{return s(this,r,e)}}).meta(t)}});define("ember-data/system/model/errors",["ember-data/system/map","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.isEmpty;var a=Ember.EnumerableUtils.map;var n=e.MapWithDefault;r["default"]=Ember.Object.extend(Ember.Enumerable,Ember.Evented,{registerHandlers:function(e,r,t){this.on("becameInvalid",e,r);
2
- this.on("becameValid",e,t)},errorsByAttributeName:Ember.reduceComputed("content",{initialValue:function(){return n.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 t(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(i(r)){return null}return r},nextObject:function(e,r,i){return t(this,"content").objectAt(e)},length:Ember.computed.oneWay("content.length").readOnly(),isEmpty:Ember.computed.not("length").readOnly(),add:function(e,r){var i=t(this,"isEmpty");r=this._findOrCreateMessages(e,r);t(this,"content").addObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(i&&!t(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return a(Ember.makeArray(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(t(this,"isEmpty")){return}var r=t(this,"content").rejectBy("attribute",e);t(this,"content").setObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(t(this,"isEmpty")){this.trigger("becameValid")}},clear:function(){if(t(this,"isEmpty")){return}t(this,"content").clear();this.enumerableContentDidChange();this.trigger("becameValid")},has:function(e){return!i(this.errorsFor(e))}})});define("ember-data/system/model/model",["ember-data/system/model/states","ember-data/system/model/errors","ember-data/system/promise_proxies","ember-data/system/relationships/relationship","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t.PromiseObject;var d=i.createRelationshipFor;var u=Ember.get;var c=Ember.set;var l=Ember.merge;var f=Ember.RSVP.Promise;var h=Ember.ArrayPolyfills.forEach;var p=Ember.ArrayPolyfills.map;var m;var y=Ember.computed("currentState",function(e,r){return u(u(this,"currentState"),e)}).readOnly();var v=Object.create(null);var b=Object.create(null);function g(e){return b[e]||(b[e]=e.split("."))}function R(e){return v[e]||(v[e]=g(e)[0])}var E=Ember.Object.extend(Ember.Evented,{_recordArrays:undefined,_relationships:undefined,_loadingRecordArrays:undefined,isEmpty:y,isLoading:y,isLoaded:y,isDirty:y,isSaving:y,isDeleted:y,isNew:y,isValid:y,dirtyType:y,isError:false,isReloading:false,clientId:null,id:null,currentState:n.empty,errors:Ember.computed(function(){var e=s.create();e.registerHandlers(this,function(){this.send("becameInvalid")},function(){this.send("becameValid")});return e}).readOnly(),serialize:function(e){var r=u(this,"store");return r.serialize(this,e)},toJSON:function(e){if(!m){m=requireModule("ember-data/serializers/json_serializer")["default"]}var r=m.create({container:this.container});return r.serialize(this,e)},didLoad:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,data:Ember.computed(function(){this._data=this._data||{};return this._data}).readOnly(),_data:null,init:function(){this._super();this._setup()},_setup:function(){this._changesToSync={};this._deferredTriggers=[];this._data={};this._attributes={};this._inFlightAttributes={};this._relationships={};this._implicitRelationships=Object.create(null);var e=this;this.constructor.eachRelationship(function(r,t){e._relationships[r]=d(e,t,e.store)})},send:function(e,r){var t=u(this,"currentState");if(!t[e]){this._unhandledEvent(t,e,r)}return t[e](this,r)},transitionTo:function(e){var r=R(e);var t=u(this,"currentState");var i=t;do{if(i.exit){i.exit(this)}i=i.parentState}while(!i.hasOwnProperty(r));var a=g(e);var n=[],s=[],o,d;for(o=0,d=a.length;o<d;o++){i=i[a[o]];if(i.enter){s.push(i)}if(i.setup){n.push(i)}}for(o=0,d=s.length;o<d;o++){s[o].enter(this)}c(this,"currentState",i);for(o=0,d=n.length;o<d;o++){n[o].setup(this)}this.updateRecordArraysLater()},_unhandledEvent:function(e,r,t){var i="Attempted to handle event `"+r+"` ";i+="on "+String(this)+" while in state ";i+=e.stateName+". ";if(t!==undefined){i+="Called with "+Ember.inspect(t)+"."}throw new Ember.Error(i)},withTransaction:function(e){var r=u(this,"transaction");if(r){e(r)}},loadingData:function(e){this.send("loadingData",e)},loadedData:function(){this.send("loadedData")},notFound:function(){this.send("notFound")},pushedData:function(){this.send("pushedData")},deleteRecord:function(){this.send("deleteRecord")},destroyRecord:function(){this.deleteRecord();return this.save()},unloadRecord:function(){if(this.isDestroyed){return}this.send("unloadRecord")},clearRelationships:function(){this.eachRelationship(function(e,r){var t=this._relationships[e];if(t){t.clear();t.destroy()}},this)},disconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships[e].disconnect()},this);var e=this;h.call(Ember.keys(this._implicitRelationships),function(r){e._implicitRelationships[r].disconnect()})},reconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships[e].reconnect()},this);var e=this;h.call(Ember.keys(this._implicitRelationships),function(r){e._implicitRelationships[r].reconnect()})},updateRecordArrays:function(){this._updatingRecordArraysLater=false;u(this,"store").dataWasUpdated(this.constructor,this)},_preloadData:function(e){var r=this;h.call(Ember.keys(e),function(t){var i=u(e,t);var a=r.constructor.metaForProperty(t);if(a.isRelationship){r._preloadRelationship(t,i)}else{u(r,"_data")[t]=i}})},_preloadRelationship:function(e,r){var t=this.constructor.metaForProperty(e);var i=t.type;if(t.kind==="hasMany"){this._preloadHasMany(e,r,i)}else{this._preloadBelongsTo(e,r,i)}},_preloadHasMany:function(e,r,t){var i=this;var a=p.call(r,function(e){return i._convertStringOrNumberIntoRecord(e,t)});this._relationships[e].updateRecordsFromAdapter(a)},_preloadBelongsTo:function(e,r,t){var i=this._convertStringOrNumberIntoRecord(r,t);this._relationships[e].setRecord(i)},_convertStringOrNumberIntoRecord:function(e,r){if(Ember.typeOf(e)==="string"||Ember.typeOf(e)==="number"){return this.store.recordForId(r,e)}return e},changedAttributes:function(){var e=u(this,"_data");var r=u(this,"_attributes");var t={};var i;for(i in r){t[i]=[e[i],r[i]]}return t},adapterWillCommit:function(){this.send("willCommit")},adapterDidCommit:function(e){c(this,"isError",false);if(e){this._data=e}else{Ember.mixin(this._data,this._inFlightAttributes)}this._inFlightAttributes={};this.send("didCommit");this.updateRecordArraysLater();if(!e){return}this.notifyPropertyChange("data")},adapterDidDirty:function(){this.send("becomeDirty");this.updateRecordArraysLater()},updateRecordArraysLater:function(){if(this._updatingRecordArraysLater){return}this._updatingRecordArraysLater=true;Ember.run.schedule("actions",this,this.updateRecordArrays)},setupData:function(e,r){if(r){Ember.merge(this._data,e)}else{this._data=e}if(e){this.pushedData()}this.notifyPropertyChange("data")},materializeId:function(e){c(this,"id",e)},materializeAttributes:function(e){l(this._data,e)},materializeAttribute:function(e,r){this._data[e]=r},rollback:function(){this._attributes={};if(u(this,"isError")){this._inFlightAttributes={};c(this,"isError",false)}if(u(this,"isDeleted")){this.reconnectRelationships()}if(!u(this,"isValid")){this._inFlightAttributes={}}this.send("rolledBack");this.notifyPropertyChange("data")},toStringExtension:function(){return u(this,"id")},save:function(){var e="DS: Model#save "+this;var r=Ember.RSVP.defer(e);this.get("store").scheduleSave(this,r);this._inFlightAttributes=this._attributes;this._attributes={};return o.create({promise:r.promise})},reload:function(){c(this,"isReloading",true);var e=this;var r="DS: Model#reload of "+this;var t=new f(function(r){e.send("reloadRecord",r)},r).then(function(){e.set("isReloading",false);e.set("isError",false);return e},function(r){e.set("isError",true);throw r},"DS: Model#reload complete, update flags")["finally"](function(){e.updateRecordArrays()});return o.create({promise:t})},adapterDidUpdateAttribute:function(e,r){if(r!==undefined){this._data[e]=r;this.notifyPropertyChange(e)}else{this._data[e]=this._inFlightAttributes[e]}this.updateRecordArraysLater()},adapterDidInvalidate:function(e){var r=u(this,"errors");function t(t){if(e[t]){r.add(t,e[t])}}this.eachAttribute(t);this.eachRelationship(t)},adapterDidError:function(){this.send("becameError");c(this,"isError",true)},trigger:function(){var e=arguments.length;var r=new Array(e-1);var t=arguments[0];for(var i=1;i<e;i++){r[i-1]=arguments[i]}Ember.tryInvoke(this,t,r);this._super.apply(this,arguments)},triggerLater:function(){var e=arguments.length;var r=new Array(e);for(var t=0;t<e;t++){r[t]=arguments[t]}if(this._deferredTriggers.push(r)!==1){return}Ember.run.schedule("actions",this,"_triggerDeferredTriggers")},_triggerDeferredTriggers:function(){for(var e=0,r=this._deferredTriggers.length;e<r;e++){this.trigger.apply(this,this._deferredTriggers[e])}this._deferredTriggers.length=0},willDestroy:function(){this._super();this.clearRelationships()},willMergeMixin:function(e){}});E.reopenClass({_create:E.create,create:function(){throw new Ember.Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.")}});a["default"]=E});define("ember-data/system/model/states",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.set;function i(e,r){if(r.value===r.originalValue){delete e._attributes[r.name];e.send("propertyWasReset",r.name)}else if(r.value!==r.oldValue){e.send("becomeDirty")}e.updateRecordArraysLater()}var a={initialState:"uncommitted",isDirty:true,uncommitted:{didSetProperty:i,loadingData:Ember.K,propertyWasReset:function(e,r){var t=Ember.keys(e._attributes);var i=t>0;if(!i){e.send("rolledBack")}},pushedData:Ember.K,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,t){t(r(e,"store").reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollback()}},inFlight:{isSaving:true,didSetProperty:i,becomeDirty:Ember.K,pushedData:Ember.K,unloadRecord:function(e){},willCommit:Ember.K,didCommit:function(e){var t=r(this,"dirtyType");e.transitionTo("saved");e.send("invokeLifecycleCallbacks",t)},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,t){r(e,"errors").remove(t.name);i(e,t)},becomeDirty:Ember.K,willCommit:function(e){r(e,"errors").clear();e.transitionTo("inFlight")},rolledBack:function(e){r(e,"errors").clear()},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)},exit:function(e){e._inFlightAttributes={}}}};function n(e){var r={},t;for(var i in e){t=e[i];if(t&&typeof t==="object"){r[i]=n(t)}else{r[i]=t}}return r}function s(e,r){for(var t in r){e[t]=r[t]}return e}function o(e){var r=n(a);return s(r,e)}var d=o({dirtyType:"created",isNew:true});d.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var u=o({dirtyType:"updated"});d.uncommitted.deleteRecord=function(e){e.disconnectRelationships();e.transitionTo("deleted.saved")};d.uncommitted.rollback=function(e){a.uncommitted.rollback.apply(this,arguments);e.transitionTo("deleted.saved")};d.uncommitted.propertyWasReset=Ember.K;function c(e){}u.inFlight.unloadRecord=c;u.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()};var l={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.notifyPropertyChange("data")},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad")}},loading:{isLoading:true,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");t(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=false;for(var i in r){if(r.hasOwnProperty(i)){t=true;break}}if(t){e.adapterDidDirty()}},didSetProperty:i,pushedData:Ember.K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,t){t(r(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",r(e,"lastDirtyType"))},notFound:Ember.K},created:d,updated:u},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()},becomeDirty:Ember.K,deleteRecord:Ember.K,rolledBack:function(e){e.transitionTo("loaded.saved")}},inFlight:{isSaving:true,unloadRecord:c,willCommit:Ember.K,didCommit:function(e){e.transitionTo("saved");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},saved:{isDirty:false,setup:function(e){var t=r(e,"store");t.dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e);e.triggerLater("didCommit",e)},willCommit:Ember.K,didCommit:Ember.K}},invokeLifecycleCallbacks:function(e,r){if(r==="created"){e.triggerLater("didCreate",e)}else{e.triggerLater("didUpdate",e)}e.triggerLater("didCommit",e)}};function f(e,r,t){e=s(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]=f(e[i],e,t+"."+i)}}return e}l=f(l,null,"root");e["default"]=l});define("ember-data/system/promise_proxies",["exports"],function(e){"use strict";var r=Ember.RSVP.Promise;var t=Ember.get;var i=Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);var a=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var n=function(e,t){return a.create({promise:r.resolve(e,t)})};var s=function(e,t){return i.create({promise:r.resolve(e,t)})};var o=i.extend({reload:function(){return t(this,"content").reload()}});var d=function(e,t){return o.create({promise:r.resolve(e,t)})};e.PromiseArray=i;e.PromiseObject=a;e.PromiseManyArray=o;e.promiseArray=s;e.promiseObject=n;e.promiseManyArray=d});define("ember-data/system/record_array_manager",["ember-data/system/record_arrays","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.RecordArray;var a=e.FilteredRecordArray;var n=e.AdapterPopulatedRecordArray;var s=e.ManyArray;var o=r.MapWithDefault;var d=r.OrderedSet;var u=Ember.get;var c=Ember.EnumerableUtils.forEach;t["default"]=Ember.Object.extend({init:function(){this.filteredRecordArrays=o.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||d.create();return e._recordArrays},updateRecordArrays:function(){c(this.changedRecords,function(e){if(u(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;c(t,function(t){i=u(t,"filterFunction");this.updateRecordArray(t,i,r,e)},this);var a=e._loadingRecordArrays;if(a){for(var n=0,s=a.length;n<s;n++){a[n].loadedRecord()}e._loadingRecordArrays=[]}},updateRecordArray:function(e,r,t,i){var a;if(!r){a=true}else{a=r(i)}var n=this.recordArraysForRecord(i);if(a){if(!n.has(e)){e.pushRecord(i);n.add(e)}}else if(!a){n["delete"](e);e.removeRecord(i)}},updateFilter:function(e,r,t){var i=this.store.typeMapFor(r);var a=i.records,n;for(var s=0,o=a.length;s<o;s++){n=a[s];if(!u(n,"isDeleted")&&!u(n,"isEmpty")){this.updateRecordArray(e,t,r,n)}}},createManyArray:function(e,r){var t=s.create({type:e,content:r,store:this.store});c(r,function(e){var r=this.recordArraysForRecord(e);r.add(t)},this);return t},createRecordArray:function(e){var r=i.create({type:e,content:Ember.A(),store:this.store,isLoaded:true});this.registerFilteredRecordArray(r,e);return r},createFilteredRecordArray:function(e,r,t){var i=a.create({query:t,type:e,content:Ember.A(),store:this.store,manager:this,filterFunction:r});this.registerFilteredRecordArray(i,e,r);return i},createAdapterPopulatedRecordArray:function(e,r){var t=n.create({type:e,query:r,content:Ember.A(),store:this.store,manager:this});this._adapterPopulatedRecordArrays.push(t);return t},registerFilteredRecordArray:function(e,r,t){var i=this.filteredRecordArrays.get(r);i.push(e);this.updateFilter(e,r,t)},registerWaitingRecordArray:function(e,r){var t=e._loadingRecordArrays||[];t.push(r);e._loadingRecordArrays=t},willDestroy:function(){this._super();c(h(l(this.filteredRecordArrays.values)),f);c(this._adapterPopulatedRecordArrays,f)}});function l(e){var r=[];var t=Ember.keys(e);for(var i=0;i<t.length;i++){r.push(e[t[i]])}return r}function f(e){e.destroy()}function h(e){var r=e.length;var t=Ember.A();for(var i=0;i<r;i++){t=t.concat(e[i])}return t}});define("ember-data/system/record_arrays",["ember-data/system/record_arrays/record_array","ember-data/system/record_arrays/filtered_record_array","ember-data/system/record_arrays/adapter_populated_record_array","ember-data/system/record_arrays/many_array","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var d=i["default"];a.RecordArray=n;a.FilteredRecordArray=s;a.AdapterPopulatedRecordArray=o;a.ManyArray=d});define("ember-data/system/record_arrays/adapter_populated_record_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;function a(e){var r=Object.create(null);for(var t in e){r[t]=e[t]}return r}r["default"]=t.extend({query:null,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},load:function(e){var r=i(this,"store");var t=i(this,"type");var n=r.pushMany(t,e);var s=r.metadataFor(t);this.setProperties({content:Ember.A(n),isLoaded:true,meta:a(s)});n.forEach(function(e){this.manager.recordArraysForRecord(e).add(this)},this);Ember.run.once(this,"trigger","didLoad")}})});define("ember-data/system/record_arrays/filtered_record_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;r["default"]=t.extend({filterFunction:null,isLoaded:true,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=i(this,"manager");e.updateFilter(this,i(this,"type"),i(this,"filterFunction"))},updateFilter:Ember.observer(function(){Ember.run.once(this,this._updateFilter)},"filterFunction")})});define("ember-data/system/record_arrays/many_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get,a=Ember.set;r["default"]=t.extend({init:function(){this._super.apply(this,arguments)},isPolymorphic:false,isLoaded:false,relationship:null,promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--;if(this.loadingRecordsCount===0){a(this,"isLoaded",true);this.trigger("didLoad")}},replaceContent:function(e,r,t){var a;if(r>0){a=i(this,"content").slice(e,e+r);this.get("relationship").removeRecords(a)}if(t){this.get("relationship").addRecords(t,e)}},reload:function(){return this.relationship.reload()},createRecord:function(e){var r=i(this,"store");var t=i(this,"type");var a;a=r.createRecord.call(r,t,e);this.pushObject(a);return a}})});define("ember-data/system/record_arrays/record_array",["ember-data/system/promise_proxies","exports"],function(e,r){"use strict";var t=e.PromiseArray;var i=Ember.get;r["default"]=Ember.ArrayProxy.extend(Ember.Evented,{type:null,content:null,isLoaded:false,isUpdating:false,store:null,objectAtContent:function(e){var r=i(this,"content");return r.objectAt(e)},update:function(){if(i(this,"isUpdating")){return}var e=i(this,"store");var r=i(this,"type");return e.fetchAll(r,this)},addRecord:function(e,r){var t=i(this,"content");if(r===undefined){t.addObject(e)}else{if(!t.contains(e)){t.insertAt(r,e)}}},pushRecord:function(e){i(this,"content").pushObject(e)},removeRecord:function(e){i(this,"content").removeObject(e)},save:function(){var e="DS: RecordArray#save "+i(this,"type");var r=Ember.RSVP.all(this.invoke("save"),e).then(function(e){return Ember.A(e)},null,"DS: RecordArray#save apply Ember.NativeArray");return t.create({promise:r})},_dissociateFromOwnRecords:function(){var e=this;this.forEach(function(r){var t=r._recordArrays;if(t){t["delete"](e)}})},willDestroy:function(){this._dissociateFromOwnRecords();this._super()}})});define("ember-data/system/relationship-meta",["ember-inflector/system","exports"],function(e,r){"use strict";var t=e.singularize;function i(e,r){var i,a;i=r.type||r.key;if(typeof i==="string"){if(r.kind==="hasMany"){i=t(i)}a=e.modelFor(i)}else{a=r.type}return a}r.typeForRelationshipMeta=i;function a(e,r){return{key:r.key,kind:r.kind,type:i(e,r),options:r.options,parentType:r.parentType,isRelationship:true}}r.relationshipFromMeta=a});define("ember-data/system/relationships",["./relationships/belongs_to","./relationships/has_many","ember-data/system/relationships/ext","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];i.belongsTo=a;i.hasMany=n});define("ember-data/system/relationships/belongs_to",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(e,r){if(typeof e==="object"){r=e;e=undefined}else{}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)}t.reopen({notifyBelongsToAdded:function(e,r){this.notifyPropertyChange(e)},notifyBelongsToRemoved:function(e){this.notifyPropertyChange(e)}});r["default"]=i});define("ember-data/system/relationships/ext",["ember-data/system/relationship-meta","ember-data/system/model","ember-data/system/map"],function(e,r,t){"use strict";var i=e.typeForRelationshipMeta;var a=e.relationshipFromMeta;var n=r.Model;var s=t.Map;var o=t.MapWithDefault;var d=Ember.get;var u=Ember.ArrayPolyfills.filter;n.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});n.reopenClass({typeForRelationship:function(e){var r=d(this,"relationshipsByName").get(e);return r&&r.type},inverseMap:Ember.computed(function(){return Object.create(null)}),inverseFor:function(e){var r=d(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).options;if(t.inverse===null){return null}var i,a,n;if(t.inverse){i=t.inverse;n=Ember.get(r,"relationshipsByName").get(i);a=n.kind}else{var s=c(this,r);if(s.length===0){return null}var o=u.call(s,function(t){var i=r.metaForProperty(t.name).options;return e===i.inverse});if(o.length===1){s=o}i=s[0].name;a=s[0].kind}function c(r,t,i){var a=i||[];var n=d(t,"relationships");if(!n){return}var s=n.get(r);s=u.call(s,function(r){var i=t.metaForProperty(r.name).options;if(!i.inverse){return true}return e===i.inverse});if(s){a.push.apply(a,s)}if(r.superclass){c(r.superclass,t,a)}return a}return{type:r,name:i,kind:a}},relationships:Ember.computed(function(){var e=new o({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var a=e.get(i(this.store,t));a.push({name:r,kind:t.kind})}});return e}).cacheable(false).readOnly(),relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};this.eachComputedProperty(function(r,t){if(t.isRelationship){e[t.kind].push(r)}});return e}),relatedTypes:Ember.computed(function(){var e;var r=Ember.A();this.eachComputedProperty(function(t,a){if(a.isRelationship){a.key=t;e=i(this.store,a);if(!r.contains(e)){r.push(e)}}});return r}).cacheable(false).readOnly(),relationshipsByName:Ember.computed(function(){var e=s.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var n=a(this.store,t);n.type=i(this.store,t);e.set(r,n)}});return e}).cacheable(false).readOnly(),fields:Ember.computed(function(){var e=s.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){d(this,"relationshipsByName").forEach(function(t,i){e.call(r,i,t)})},eachRelatedType:function(e,r){d(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 a,n;if(!i){return t==="belongsTo"?"oneToNone":"manyToNone"}a=i.name;n=i.kind;if(n==="belongsTo"){return t==="belongsTo"?"oneToOne":"manyToOne"}else{return t==="belongsTo"?"oneToMany":"manyToMany"}}});n.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return d(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e)}})});define("ember-data/system/relationships/has_many",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(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()}t.reopen({notifyHasManyAdded:function(e,r,t){var i=this._relationships[e];var a=i.manyArray;a.addRecord(r,t);this.notifyPropertyChange(e)},notifyHasManyRemoved:function(e,r){var t=this._relationships[e];var i=t.manyArray;i.removeRecord(r)}});r["default"]=i});define("ember-data/system/relationships/relationship",["ember-data/system/promise_proxies","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.PromiseManyArray;var a=e.PromiseObject;var n=r.OrderedSet;var s=function(e,r,t,i){this.members=new n;this.store=e;this.key=i.key;this.inverseKey=t;this.record=r;this.key=i.key;this.isAsync=i.options.async;this.relationshipMeta=i;this.inverseKeyForImplicit=this.store.modelFor(this.record.constructor).typeKey+this.key;this.linkPromise=null};s.prototype={constructor:s,destroy:Ember.K,clear:function(){this.members.forEach(function(e){this.removeRecord(e)},this)},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;e.forEach(function(e){r.removeRecord(e)})},addRecords:function(e,r){var t=this;e.forEach(function(e){t.addRecord(e,r);if(r!==undefined){r++}})},addRecord:function(e,r){if(!this.members.has(e)){this.members.add(e);this.notifyRecordRelationshipAdded(e,r);if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new s(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)}this.record.updateRecordArrays()}},removeRecord:function(e){if(this.members.has(e)){this.removeRecordFromOwn(e);if(this.inverseKey){this.removeRecordFromInverse(e)}else{if(e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record)}}}},addRecordToInverse:function(e){if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}},removeRecordFromInverse:function(e){var r=e._relationships[this.inverseKey];if(r){r.removeRecordFromOwn(this.record)}},removeRecordFromOwn:function(e){this.members["delete"](e);this.notifyRecordRelationshipRemoved(e);this.record.updateRecordArrays()},updateLink:function(e){if(e!==this.link){this.link=e;this.linkPromise=null;this.record.notifyPropertyChange(this.key)}},findLink:function(){if(this.linkPromise){return this.linkPromise}else{var e=this.fetchLink();this.linkPromise=e;return e.then(function(e){return e})}},updateRecordsFromAdapter:function(e){this.computeChanges(e)},notifyRecordRelationshipAdded:Ember.K,notifyRecordRelationshipRemoved:Ember.K};var o=function(e,r,t,i){this._super$constructor(e,r,t,i);this.belongsToType=i.type;this.manyArray=e.recordArrayManager.createManyArray(this.belongsToType,Ember.A());this.manyArray.relationship=this;this.isPolymorphic=i.options.polymorphic;this.manyArray.isPolymorphic=this.isPolymorphic};o.prototype=Object.create(s.prototype);o.prototype.constructor=o;o.prototype._super$constructor=s;o.prototype.destroy=function(){this.manyArray.destroy()};o.prototype.notifyRecordRelationshipAdded=function(e,r){this.record.notifyHasManyAdded(this.key,e,r)};o.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyHasManyRemoved(this.key,e)};o.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})}};o.prototype.computeChanges=function(e){var r=this.members;var t=[];var i;var a;var n;e=u(e);r.forEach(function(r){if(e.has(r))return;t.push(r)});this.removeRecords(t);var s=this.manyArray;e=e.toArray();i=e.length;for(n=0;n<i;n++){a=e[n];if(s.objectAt(n)===a){continue}this.removeRecord(a);this.addRecord(a,n)}};o.prototype.fetchLink=function(){var e=this;return this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(r){e.updateRecordsFromAdapter(r);return e.manyArray})};o.prototype.findRecords=function(){var e=this.manyArray;return this.store.findMany(e.toArray()).then(function(){e.set("isLoaded",true);return e})};o.prototype.getRecords=function(){if(this.isAsync){var e=this;var r;if(this.link){r=this.findLink().then(function(){return e.findRecords()})}else{r=this.findRecords()}return i.create({content:this.manyArray,promise:r})}else{this.manyArray.set("isLoaded",true);return this.manyArray}};var d=function(e,r,t,i){this._super$constructor(e,r,t,i);this.record=r;this.key=i.key;this.inverseRecord=null};d.prototype=Object.create(s.prototype);d.prototype.constructor=d;d.prototype._super$constructor=s;d.prototype.setRecord=function(e){if(e){this.addRecord(e)}else if(this.inverseRecord){this.removeRecord(this.inverseRecord)}};d.prototype._super$addRecord=s.prototype.addRecord;d.prototype.addRecord=function(e){if(this.members.has(e)){return}var r=this.relationshipMeta.type;if(this.inverseRecord){this.removeRecord(this.inverseRecord)}this.inverseRecord=e;
3
- this._super$addRecord(e)};d.prototype.setRecordPromise=function(e){var r=e.get&&e.get("content");this.setRecord(r)};d.prototype.notifyRecordRelationshipAdded=function(e){this.record.notifyBelongsToAdded(this.key,this)};d.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyBelongsToRemoved(this.key,this)};d.prototype._super$removeRecordFromOwn=s.prototype.removeRecordFromOwn;d.prototype.removeRecordFromOwn=function(e){if(!this.members.has(e)){return}this._super$removeRecordFromOwn(e);this.inverseRecord=null};d.prototype.findRecord=function(){if(this.inverseRecord){return this.store._findByRecord(this.inverseRecord)}else{return Ember.RSVP.Promise.resolve(null)}};d.prototype.fetchLink=function(){var e=this;return this.store.findBelongsTo(this.record,this.link,this.relationshipMeta).then(function(r){e.addRecord(r);return r})};d.prototype.getRecord=function(){if(this.isAsync){var e;if(this.link){var r=this;e=this.findLink().then(function(){return r.findRecord()})}else{e=this.findRecord()}return a.create({promise:e,content:this.inverseRecord})}else{return this.inverseRecord}};function u(e){var r=new n;if(e){for(var t=0,i=e.length;t<i;t++){r.add(e[t])}}return r}var c=function(e,r,t){var i;var a=e.constructor.inverseFor(r.key);if(a){i=a.name}if(r.kind==="hasMany"){return new o(t,e,i,r)}else{return new d(t,e,i,r)}};t.Relationship=s;t.ManyRelationship=o;t.BelongsToRelationship=d;t.createRelationshipFor=c});define("ember-data/system/store",["ember-data/system/adapter","ember-inflector/system/string","ember-data/system/map","ember-data/system/promise_proxies","exports"],function(e,r,t,i,a){"use strict";var n=e.InvalidError;var s=e.Adapter;var o=r.singularize;var d=t.Map;var u=i.promiseArray;var c=i.promiseObject;var l=Ember.get;var f=Ember.set;var h=Ember.run.once;var p=Ember.isNone;var m=Ember.EnumerableUtils.forEach;var y=Ember.EnumerableUtils.indexOf;var v=Ember.EnumerableUtils.map;var b=Ember.RSVP.Promise;var g=Ember.copy;var R,E,_;var A=Ember.String.camelize;function F(e){return e==null?null:e+""}R=Ember.Object.extend({init:function(){if(!E){E=requireModule("ember-data/system/record_array_manager")["default"]}this.typeMaps={};this.recordArrayManager=E.create({store:this});this._pendingSave=[];this._pendingFetch=d.create()},adapter:"-rest",serialize:function(e,r){return this.serializerFor(e.constructor.typeKey).serialize(e,r)},defaultAdapter:Ember.computed("adapter",function(){var e=l(this,"adapter");if(typeof e==="string"){e=this.container.lookup("adapter:"+e)||this.container.lookup("adapter:application")||this.container.lookup("adapter:-rest")}if(DS.Adapter.detect(e)){e=e.create({container:this.container})}return e}),createRecord:function(e,r){var t=this.modelFor(e);var i=g(r)||{};if(p(i.id)){i.id=this._generateId(t)}i.id=F(i.id);var a=this.buildRecord(t,i.id);a.loadedData();a.setProperties(i);return a},_generateId:function(e){var r=this.adapterFor(e);if(r&&r.generateIdForRecord){return r.generateIdForRecord(this)}return null},deleteRecord:function(e){e.deleteRecord()},unloadRecord:function(e){e.unloadRecord()},find:function(e,r,t){if(arguments.length===1){return this.findAll(e)}if(Ember.typeOf(r)==="object"){return this.findQuery(e,r)}return this.findById(e,F(r),t)},findById:function(e,r,t){var i=this.modelFor(e);var a=this.recordForId(i,r);return this._findByRecord(a,t)},_findByRecord:function(e,r){var t;if(r){e._preloadData(r)}if(l(e,"isEmpty")){t=this.scheduleFetch(e)}else if(l(e,"isLoading")){t=e._loadingPromise}return c(t||e,"DS: Store#findByRecord "+e.typeKey+" with id: "+l(e,"id"))},findByIds:function(e,r){var t=this;return u(Ember.RSVP.all(v(r,function(r){return t.findById(e,r)})).then(Ember.A,null,"DS: Store#findByIds of "+e+" complete"))},fetchRecord:function(e){var r=e.constructor;var t=l(e,"id");var i=this.adapterFor(r);var a=w(i,this,r,t,e);return a},scheduleFetchMany:function(e){return Ember.RSVP.all(v(e,this.scheduleFetch,this))},scheduleFetch:function(e){var r=e.constructor;if(p(e)){return null}if(e._loadingPromise){return e._loadingPromise}var t=Ember.RSVP.defer("Fetching "+r+"with id: "+e.get("id"));var i={record:e,resolver:t};var a=t.promise;e.loadingData(a);if(!this._pendingFetch.get(r)){this._pendingFetch.set(r,[i])}else{this._pendingFetch.get(r).push(i)}Ember.run.scheduleOnce("afterRender",this,this.flushAllPendingFetches);return a},flushAllPendingFetches:function(){if(this.isDestroyed||this.isDestroying){return}this._pendingFetch.forEach(this._flushPendingFetchForType,this);this._pendingFetch=d.create()},_flushPendingFetchForType:function(e,r){var t=this;var i=t.adapterFor(r);var a=!!i.findMany&&i.coalesceFindRequests;var n=Ember.A(e).mapBy("record");function s(e){e.resolver.resolve(t.fetchRecord(e.record))}function o(r){m(r,function(r){var t=Ember.A(e).findBy("record",r);if(t){var i=t.resolver;i.resolve(r)}})}function d(e){return function r(t){var i=e.without(t);c(i)}}function u(e){return function(r){c(e,r)}}function c(r,t){m(r,function(r){var i=Ember.A(e).findBy("record",r);if(i){var a=i.resolver;a.reject(t)}})}if(e.length===1){s(e[0])}else if(a){var l=i.groupRecordsForFindMany(this,n);m(l,function(a){var n=Ember.A(a);var c=n.mapBy("id");if(c.length>1){$(i,t,r,c,n).then(o).then(d(n)).then(null,u(n))}else if(c.length===1){var l=Ember.A(e).findBy("record",a[0]);s(l)}else{}})}else{m(e,s)}},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=l(e,"id");return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=F(r);return!!this.typeMapFor(t).idToRecord[i]},recordForId:function(e,r){var t=this.modelFor(e);var i=F(r);var a=this.typeMapFor(t).idToRecord;var n=a[i];if(!n||!a[i]){n=this.buildRecord(t,i)}return n},findMany:function(e){var r=this;return b.all(v(e,function(e){return r._findByRecord(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.constructor);return I(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.constructor);return L(i,this,e,r,t)},findQuery:function(e,r){var t=this.modelFor(e);var i=this.recordArrayManager.createAdapterPopulatedRecordArray(t,r);var a=this.adapterFor(t);return u(j(a,this,t,r,i))},findAll:function(e){var r=this.modelFor(e);return this.fetchAll(r,this.all(r))},fetchAll:function(e,r){var t=this.adapterFor(e);var i=this.typeMapFor(e).metadata.since;f(r,"isUpdating",true);return u(K(t,this,e,i))},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;f(r,"isUpdating",false)},all:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.findAllCache;if(i){return i}var a=this.recordArrayManager.createRecordArray(r);t.findAllCache=a;return a},unloadAll:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.records.slice();var a;for(var n=0;n<i.length;n++){a=i[n];a.unloadRecord();a.destroy()}t.findAllCache=null},filter:function(e,r,t){var i;var a=arguments.length;var n;var s=a===3;if(s){i=this.findQuery(e,r)}else if(arguments.length===2){t=r}e=this.modelFor(e);if(s){n=this.recordArrayManager.createFilteredRecordArray(e,t,r)}else{n=this.recordArrayManager.createFilteredRecordArray(e,t)}i=i||b.cast(n);return u(i.then(function(){return n},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,r){if(!this.hasRecordForId(e,r)){return false}return!l(this.recordForId(e,r),"isEmpty")},metadataFor:function(e){e=this.modelFor(e);return this.typeMapFor(e).metadata},dataWasUpdated:function(e,r){this.recordArrayManager.recordDidChange(r)},scheduleSave:function(e,r){e.adapterWillCommit();this._pendingSave.push([e,r]);h(this,"flushPendingSave")},flushPendingSave:function(){var e=this._pendingSave.slice();this._pendingSave=[];m(e,function(e){var r=e[0],t=e[1];var i=this.adapterFor(r.constructor);var a;if(l(r,"currentState.stateName")==="root.deleted.saved"){return t.resolve(r)}else if(l(r,"isNew")){a="createRecord"}else if(l(r,"isDeleted")){a="deleteRecord"}else{a="updateRecord"}t.resolve(U(i,this,a,r))},this)},didSaveRecord:function(e,r){if(r){r=z(this,e.constructor,r,e);B(this,e,r);this.updateId(e,r)}e.adapterDidCommit(r)},recordWasInvalid:function(e,r){e.adapterDidInvalidate(r)},recordWasError:function(e){e.adapterDidError()},updateId:function(e,r){var t=l(e,"id");var i=F(r.id);this.typeMapFor(e.constructor).idToRecord[i]=e;f(e,"id",i)},typeMapFor:function(e){var r=l(this,"typeMaps");var t=Ember.guidFor(e);var i;i=r[t];if(i){return i}i={idToRecord:Object.create(null),records:[],metadata:Object.create(null),type:e};r[t]=i;return i},_load:function(e,r,t){var i=F(r.id);var a=this.recordForId(e,i);a.setupData(r,t);this.recordArrayManager.recordDidChange(a);return a},modelFor:function(e){var r;if(typeof e==="string"){r=this.modelFactoryFor(e);if(!r){throw new Ember.Error("No model was found for '"+e+"'")}r.typeKey=r.typeKey||this._normalizeTypeKey(e)}else{r=e;if(r.typeKey){r.typeKey=this._normalizeTypeKey(r.typeKey)}}r.store=this;return r},modelFactoryFor:function(e){return this.container.lookupFactory("model:"+e)},push:function(e,r,t){var i=this.modelFor(e);r=z(this,i,r);this._load(i,r,t);var a=this.recordForId(i,r.id);B(this,a,r);return a},pushPayload:function(e,r){var t;var i;if(!r){i=e;t=M(this.container)}else{i=r;t=this.serializerFor(e)}t.pushPayload(this,i)},normalize:function(e,r){var t=this.serializerFor(e);var i=this.modelFor(e);return t.normalize(i,r)},update:function(e,r){return this.push(e,r,true)},pushMany:function(e,r){var t=r.length;var i=new Array(t);for(var a=0;a<t;a++){i[a]=this.push(e,r[a])}return i},metaForType:function(e,r){var t=this.modelFor(e);Ember.merge(this.typeMapFor(t).metadata,r)},buildRecord:function(e,r,t){var i=this.typeMapFor(e);var a=i.idToRecord;var n=e._create({id:r,store:this,container:this.container});if(t){n.setupData(t)}if(r){a[r]=n}i.records.push(n);return n},dematerializeRecord:function(e){var r=e.constructor;var t=this.typeMapFor(r);var i=l(e,"id");e.updateRecordArrays();if(i){delete t.idToRecord[i]}var a=y(t.records,e);t.records.splice(a,1)},adapterFor:function(e){var r=this.container,t;if(r){t=r.lookup("adapter:"+e.typeKey)||r.lookup("adapter:application")}return t||l(this,"defaultAdapter")},serializerFor:function(e){e=this.modelFor(e);var r=this.adapterFor(e);return k(this.container,e.typeKey,r&&r.defaultSerializer)},willDestroy:function(){var e=this.typeMaps;var r=Ember.keys(e);var t=v(r,i);this.recordArrayManager.destroy();m(t,this.unloadAll,this);function i(r){return e[r]["type"]}},_normalizeTypeKey:function(e){return A(o(e))}});function z(e,r,t,i){r.eachRelationship(function(r,i){var a=i.kind;var n=t[r];if(a==="belongsTo"){x(e,t,r,i,n)}else if(a==="hasMany"){S(e,t,r,i,n)}});return t}function x(e,r,t,i,a){if(!_){_=requireModule("ember-data/system/model")["Model"]}if(p(a)||a instanceof _){return}var n;if(typeof a==="number"||typeof a==="string"){n=T(i,t,r);r[t]=e.recordForId(n,a)}else if(typeof a==="object"){r[t]=e.recordForId(a.type,a.id)}}function T(e,r,t){if(e.options.polymorphic){return t[r+"Type"]}else{return e.type}}function S(e,r,t,i,a){if(!Ember.isArray(a)){return}for(var n=0,s=a.length;n<s;n++){x(e,a,n,i,a[n])}}function k(e,r,t){return e.lookup("serializer:"+r)||e.lookup("serializer:application")||e.lookup("serializer:"+t)||e.lookup("serializer:-default")}function M(e){return e.lookup("serializer:application")||e.lookup("serializer:-default")}function D(e,r){var t=e.serializer;var i=e.defaultSerializer;var a=e.container;if(a&&t===undefined){t=k(a,r.typeKey,i)}if(t===null||t===undefined){t={extract:function(e,r,t){return t}}}return t}function P(e){return!(l(e,"isDestroyed")||l(e,"isDestroying"))}function O(e,r){var t=e["finally"](function(){if(!r()){t._subscribers.length=0}});return t}function C(e){var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(undefined,r)}}function w(e,r,t,i,a){var n=e.find(r,t,i,a);var s=D(e,t);var o="DS: Handle Adapter#find of "+t+" with id: "+i;n=b.cast(n,o);n=O(n,C(P,r));return n.then(function(e){var a=s.extract(r,t,e,i,"find");return r.push(t,a)},function(e){var a=r.getById(t,i);if(a){a.notFound()}throw e},"DS: Extract payload of '"+t+"'")}function $(e,r,t,i,a){var n=e.findMany(r,t,i,a);var s=D(e,t);var o="DS: Handle Adapter#findMany of "+t;if(n===undefined){throw new Error("adapter.findMany returned undefined, this was very likely a mistake")}n=b.cast(n,o);n=O(n,C(P,r));return n.then(function(e){var i=s.extract(r,t,e,null,"findMany");return r.pushMany(t,i)},null,"DS: Extract payload of "+t)}function I(e,r,t,i,a){var n=e.findHasMany(r,t,i,a);var s=D(e,a.type);var o="DS: Handle Adapter#findHasMany of "+t+" : "+a.type;n=b.cast(n,o);n=O(n,C(P,r));n=O(n,C(P,t));return n.then(function(e){var t=s.extract(r,a.type,e,null,"findHasMany");var i=r.pushMany(a.type,t);return i},null,"DS: Extract payload of "+t+" : hasMany "+a.type)}function L(e,r,t,i,a){var n=e.findBelongsTo(r,t,i,a);var s=D(e,a.type);var o="DS: Handle Adapter#findBelongsTo of "+t+" : "+a.type;n=b.cast(n,o);n=O(n,C(P,r));n=O(n,C(P,t));return n.then(function(e){var t=s.extract(r,a.type,e,null,"findBelongsTo");var i=r.push(a.type,t);return i},null,"DS: Extract payload of "+t+" : "+a.type)}function K(e,r,t,i){var a=e.findAll(r,t,i);var n=D(e,t);var s="DS: Handle Adapter#findAll of "+t;a=b.cast(a,s);a=O(a,C(P,r));return a.then(function(e){var i=n.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 j(e,r,t,i,a){var n=e.findQuery(r,t,i,a);var s=D(e,t);var o="DS: Handle Adapter#findQuery of "+t;n=b.cast(n,o);n=O(n,C(P,r));return n.then(function(e){var i=s.extract(r,t,e,null,"findQuery");a.load(i);return a},null,"DS: Extract payload of findQuery "+t)}function U(e,r,t,i){var a=i.constructor;var s=e[t](r,a,i);var o=D(e,a);var d="DS: Extract and notify about "+t+" completion of "+i;s=b.cast(s,d);s=O(s,C(P,r));s=O(s,C(P,i));return s.then(function(e){var n;if(e){n=o.extract(r,a,e,l(i,"id"),t)}else{n=e}r.didSaveRecord(i,n);return i},function(e){if(e instanceof n){r.recordWasInvalid(i,e.errors)}else{r.recordWasError(i,e)}throw e},d)}function B(e,r,t){var i=r.constructor;i.eachRelationship(function(e,i){var a=i.kind;var n=t[e];var s=r._relationships[e];if(t.links&&t.links[e]){s.updateLink(t.links[e])}if(a==="belongsTo"){if(n===undefined){return}s.setRecord(n)}else if(a==="hasMany"&&n){s.updateRecordsFromAdapter(n)}})}a.Store=R;a["default"]=R});define("ember-data/transforms",["ember-data/transforms/base","ember-data/transforms/number","ember-data/transforms/date","ember-data/transforms/string","ember-data/transforms/boolean","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var d=t["default"];var u=i["default"];var c=a["default"];n.Transform=s;n.NumberTransform=o;n.DateTransform=d;n.StringTransform=u;n.BooleanTransform=c});define("ember-data/transforms/base",["exports"],function(e){"use strict";e["default"]=Ember.Object.extend({serialize:Ember.required(),deserialize:Ember.required()})});define("ember-data/transforms/boolean",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=t.extend({deserialize:function(e){var r=typeof e;if(r==="boolean"){return e}else if(r==="string"){return e.match(/^true$|^t$|^1$/i)!==null}else if(r==="number"){return e===1}else{return false}},serialize:function(e){return Boolean(e)}})});define("ember-data/transforms/date",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Date.prototype.toISOString||function(){function e(e){if(e<10){return"0"+e}return e}return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};if(Ember.SHIM_ES5){if(!Date.prototype.toISOString){Date.prototype.toISOString=i}}r["default"]=t.extend({deserialize:function(e){var r=typeof e;if(r==="string"){return new Date(Ember.Date.parse(e))}else if(r==="number"){return new Date(e)}else if(e===null||e===undefined){return e}else{return null}},serialize:function(e){if(e instanceof Date){return i.call(e)}else{return null}}})});define("ember-data/transforms/number",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.isEmpty;r["default"]=t.extend({deserialize:function(e){return i(e)?null:Number(e)},serialize:function(e){return i(e)?null:Number(e)}})});define("ember-data/transforms/string",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.isNone;r["default"]=t.extend({deserialize:function(e){return i(e)?null:String(e)},serialize:function(e){return i(e)?null:String(e)}})});define("ember-inflector",["./system","./helpers","./ext/string","exports"],function(e,r,t,i){"use strict";var a=e.Inflector;var n=e.defaultRules;var s=e.pluralize;var o=e.singularize;a.defaultRules=n;Ember.Inflector=a;Ember.String.pluralize=s;Ember.String.singularize=o;i["default"]=a;i.pluralize=s;i.singularize=o});define("ember-inflector/ext/string",["../system/string"],function(e){"use strict";var r=e.pluralize;var t=e.singularize;if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.String){String.prototype.pluralize=function(){return r(this)};String.prototype.singularize=function(){return t(this)}}});define("ember-inflector/helpers",["./system/string"],function(e){"use strict";var r=e.singularize;var t=e.pluralize;Ember.Handlebars.helper("singularize",r);Ember.Handlebars.helper("pluralize",t)});define("ember-inflector/system",["./system/inflector","./system/string","./system/inflections","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r.pluralize;var s=r.singularize;var o=t["default"];a.inflector=new a(o);i.Inflector=a;i.singularize=s;i.pluralize=n;i.defaultRules=o});define("ember-inflector/system/inflections",["exports"],function(e){"use strict";e["default"]={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"]}});define("ember-inflector/system/inflector",["exports"],function(e){"use strict";var r=/^\s*$/;var t=/(\w+[_-])([a-z\d]+$)/;var i=/(\w+)([A-Z][a-z\d]*$)/;var a=/[A-Z][a-z\d]*$/;function n(e,r){for(var t=0,i=r.length;t<i;t++){e.uncountable[r[t].toLowerCase()]=true}}function s(e,r){var t;for(var i=0,a=r.length;i<a;i++){t=r[i];e.irregular[t[0].toLowerCase()]=t[1];e.irregular[t[1].toLowerCase()]=t[1];e.irregularInverse[t[1].toLowerCase()]=t[0];e.irregularInverse[t[0].toLowerCase()]=t[0]}}function o(e){e=e||{};e.uncountable=e.uncountable||d();e.irregularPairs=e.irregularPairs||d();var r=this.rules={plurals:e.plurals||[],singular:e.singular||[],irregular:d(),irregularInverse:d(),uncountable:d()};n(r,e.uncountable);s(r,e.irregularPairs);this.enableCache()}if(!Object.create&&!Object.create(null).hasOwnProperty){throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg")}function d(){var e=Object.create(null);e["_dict"]=null;delete e["_dict"];return e}o.prototype={enableCache:function(){this.purgeCache();this.singularize=function(e){this._cacheUsed=true;return this._sCache[e]||(this._sCache[e]=this._singularize(e))};this.pluralize=function(e){this._cacheUsed=true;return this._pCache[e]||(this._pCache[e]=this._pluralize(e))}},purgeCache:function(){this._cacheUsed=false;this._sCache=d();this._pCache=d()},disableCache:function(){this._sCache=null;this._pCache=null;this.singularize=function(e){return this._singularize(e)};this.pluralize=function(e){return this._pluralize(e)}},plural:function(e,r){if(this._cacheUsed){this.purgeCache()}this.rules.plurals.push([e,r.toLowerCase()])},singular:function(e,r){if(this._cacheUsed){this.purgeCache()}this.rules.singular.push([e,r.toLowerCase()])},uncountable:function(e){if(this._cacheUsed){this.purgeCache()}n(this.rules,[e.toLowerCase()])},irregular:function(e,r){if(this._cacheUsed){this.purgeCache()}s(this.rules,[[e,r]])},pluralize:function(e){return this._pluralize(e)},_pluralize:function(e){return this.inflect(e,this.rules.plurals,this.rules.irregular)},singularize:function(e){return this._singularize(e)},_singularize:function(e){return this.inflect(e,this.rules.singular,this.rules.irregularInverse)},inflect:function(e,n,s){var o,d,u,c,l,f,h,p,m,y,v,b,g;p=r.test(e);m=a.test(e);f="";if(p){return e}c=e.toLowerCase();l=t.exec(e)||i.exec(e);if(l){f=l[1];h=l[2].toLowerCase()}y=this.rules.uncountable[c]||this.rules.uncountable[h];if(y){return e}v=s&&(s[c]||s[h]);if(v){if(s[c]){return v}else{v=m?v.capitalize():v;return f+v}}for(var R=n.length,E=0;R>E;R--){o=n[R-1];g=o[0];if(g.test(e)){break}}o=o||[];g=o[0];d=o[1];u=e.replace(g,d);return u}};e["default"]=o});define("ember-inflector/system/string",["./inflector","exports"],function(e,r){"use strict";var t=e["default"];function i(e){return t.inflector.pluralize(e)}function a(e){return t.inflector.singularize(e)}r.pluralize=i;r.singularize=a});
1
+ define("activemodel-adapter",["activemodel-adapter/system","exports"],function(e,r){"use strict";var t=e.ActiveModelAdapter;var i=e.ActiveModelSerializer;r.ActiveModelAdapter=t;r.ActiveModelSerializer=i});define("activemodel-adapter/setup-container",["ember-data/system/container_proxy","activemodel-adapter/system/active_model_serializer","activemodel-adapter/system/active_model_adapter","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];var s=t["default"];i["default"]=function o(e,r){var t=new a(e);t.registerDeprecations([{deprecated:"serializer:_ams",valid:"serializer:-active-model"},{deprecated:"adapter:_ams",valid:"adapter:-active-model"}]);e.register("serializer:-active-model",n);e.register("adapter:-active-model",s)}});define("activemodel-adapter/system",["activemodel-adapter/system/active_model_adapter","activemodel-adapter/system/active_model_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.ActiveModelAdapter=i;t.ActiveModelSerializer=a});define("activemodel-adapter/system/active_model_adapter",["ember-data/adapters","ember-data/system/adapter","ember-inflector","exports"],function(e,r,t,i){"use strict";var a=e.RESTAdapter;var n=r.InvalidError;var s=t.pluralize;var o=Ember.String.decamelize,u=Ember.String.underscore;var d=a.extend({defaultSerializer:"-active-model",pathForType:function(e){var r=o(e);var t=u(r);return s(t)},ajaxError:function(e){var r=this._super(e);if(e&&e.status===422){return new n(Ember.$.parseJSON(e.responseText))}else{return r}}});i["default"]=d});define("activemodel-adapter/system/active_model_serializer",["ember-inflector","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e.singularize;var a=r["default"];var n=Ember.get,s=Ember.EnumerableUtils.forEach,o=Ember.String.camelize,u=Ember.String.capitalize,d=Ember.String.decamelize,c=Ember.String.underscore;var l=a.extend({keyForAttribute:function(e){return d(e)},keyForRelationship:function(e,r){var t=d(e);if(r==="belongsTo"){return t+"_id"}else if(r==="hasMany"){return i(t)+"_ids"}else{return t}},serializeHasMany:Ember.K,serializeIntoHash:function(e,r,t,i){var a=c(d(r.typeKey));e[a]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var a=n(e,i);var s=c(i+"_type");if(Ember.isNone(a)){r[s]=null}else{r[s]=u(o(a.constructor.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=o(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,a;if(t.options.polymorphic){i=this.keyForAttribute(e);a=r[i];if(a&&a.type){a.type=this.typeForRoot(a.type)}else if(a&&t.kind==="hasMany"){var n=this;s(a,function(e){e.type=n.typeForRoot(e.type)})}}else{i=this.keyForRelationship(e,t.kind);if(!r.hasOwnProperty(i)){return}a=r[i]}r[e]=a;if(e!==i){delete r[i]}},this)}}});t["default"]=l});define("ember-data",["ember-data/system/create","ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],function(e,r,t,i,a,n,s,o,u,d,c,l,f,h,p,m,y,v,b,g,E,R,_){"use strict";Ember.RSVP.Promise.cast=Ember.RSVP.Promise.cast||Ember.RSVP.resolve;var A=r["default"];var F=i.PromiseArray;var z=i.PromiseObject;var x=a.Store;var T=n.Model;var S=n.Errors;var k=n.RootState;var M=n.attr;var D=s.InvalidError;var P=s.Adapter;var O=o["default"];var w=u.RecordArray;var C=u.FilteredRecordArray;var I=u.AdapterPopulatedRecordArray;var $=u.ManyArray;var L=d["default"];var K=c.RESTAdapter;var j=c.FixtureAdapter;var U=l["default"];var B=f["default"];var N=p["default"];var H=m.ActiveModelAdapter;var V=m.ActiveModelSerializer;var W=y.Transform;var q=y.DateTransform;var Q=y.NumberTransform;var X=y.StringTransform;var J=y.BooleanTransform;var G=v.hasMany;var Y=v.belongsTo;var Z=g["default"];var er=E["default"];var rr=R.Relationship;A.Store=x;A.PromiseArray=F;A.PromiseObject=z;A.Model=T;A.RootState=k;A.attr=M;A.Errors=S;A.Adapter=P;A.InvalidError=D;A.DebugAdapter=O;A.RecordArray=w;A.FilteredRecordArray=C;A.AdapterPopulatedRecordArray=I;A.ManyArray=$;A.RecordArrayManager=L;A.RESTAdapter=K;A.FixtureAdapter=j;A.RESTSerializer=B;A.JSONSerializer=U;A.Transform=W;A.DateTransform=q;A.StringTransform=X;A.NumberTransform=Q;A.BooleanTransform=J;A.ActiveModelAdapter=H;A.ActiveModelSerializer=V;A.EmbeddedRecordsMixin=N;A.belongsTo=Y;A.hasMany=G;A.Relationship=rr;A.ContainerProxy=er;A._setupContainer=Z;Ember.lookup.DS=A;_["default"]=A});define("ember-data/adapters",["ember-data/adapters/fixture_adapter","ember-data/adapters/rest_adapter","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.RESTAdapter=a;t.FixtureAdapter=i});define("ember-data/adapters/fixture_adapter",["ember-data/system/adapter","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.String.fmt;var a=Ember.EnumerableUtils.indexOf;var n=0;var s=e["default"];r["default"]=s.extend({serializer:null,simulateRemoteResponse:true,latency:50,fixturesForType:function(e){if(e.FIXTURES){var r=Ember.A(e.FIXTURES);return r.map(function(e){var r=typeof e.id;if(r!=="number"&&r!=="string"){throw new Error(i("the id property must be defined as a number or string for fixture %@",[e]))}e.id=e.id+"";return e})}return null},queryFixtures:function(e,r,t){},updateFixtures:function(e,r){if(!e.FIXTURES){e.FIXTURES=[]}var t=e.FIXTURES;this.deleteLoadedFixture(e,r);t.push(r)},mockJSON:function(e,r,t){return e.serializerFor(r).serialize(t,{includeId:true})},generateIdForRecord:function(e){return"fixture-"+n++},find:function(e,r,t){var i=this.fixturesForType(r);var a;if(i){a=Ember.A(i).findBy("id",t)}if(a){return this.simulateRemoteCall(function(){return a},this)}},findMany:function(e,r,t){var i=this.fixturesForType(r);if(i){i=i.filter(function(e){return a(t,e.id)!==-1})}if(i){return this.simulateRemoteCall(function(){return i},this)}},findAll:function(e,r){var t=this.fixturesForType(r);return this.simulateRemoteCall(function(){return t},this)},findQuery:function(e,r,t,i){var a=this.fixturesForType(r);a=this.queryFixtures(a,t,r);if(a){return this.simulateRemoteCall(function(){return a},this)}},createRecord:function(e,r,t){var i=this.mockJSON(e,r,t);this.updateFixtures(r,i);return this.simulateRemoteCall(function(){return i},this)},updateRecord:function(e,r,t){var i=this.mockJSON(e,r,t);this.updateFixtures(r,i);return this.simulateRemoteCall(function(){return i},this)},deleteRecord:function(e,r,t){this.deleteLoadedFixture(r,t);return this.simulateRemoteCall(function(){return null})},deleteLoadedFixture:function(e,r){var t=this.findExistingFixture(e,r);if(t){var i=a(e.FIXTURES,t);e.FIXTURES.splice(i,1);return true}},findExistingFixture:function(e,r){var i=this.fixturesForType(e);var a=t(r,"id");return this.findFixtureById(i,a)},findFixtureById:function(e,r){return Ember.A(e).find(function(e){if(""+t(e,"id")===""+r){return true}else{return false}})},simulateRemoteCall:function(e,r){var i=this;return new Ember.RSVP.Promise(function(a){var n=Ember.copy(e.call(r),true);if(t(i,"simulateRemoteResponse")){Ember.run.later(function(){a(n)},t(i,"latency"))}else{Ember.run.schedule("actions",null,function(){a(n)})}},"DS: FixtureAdapter#simulateRemoteCall")}})});define("ember-data/adapters/rest_adapter",["ember-data/system/adapter","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.Adapter;var a=e.InvalidError;var n=r.MapWithDefault;var s=Ember.get;var o=Ember.ArrayPolyfills.forEach;t["default"]=i.extend({defaultSerializer:"-rest",coalesceFindRequests:false,find:function(e,r,t,i){return this.ajax(this.buildURL(r.typeKey,t,i),"GET")},findAll:function(e,r,t){var i;if(t){i={since:t}}return this.ajax(this.buildURL(r.typeKey),"GET",{data:i})},findQuery:function(e,r,t){return this.ajax(this.buildURL(r.typeKey),"GET",{data:t})},findMany:function(e,r,t,i){return this.ajax(this.buildURL(r.typeKey,t,i),"GET",{data:{ids:t}})},findHasMany:function(e,r,t,i){var a=s(this,"host");var n=s(r,"id");var o=r.constructor.typeKey;if(a&&t.charAt(0)==="/"&&t.charAt(1)!=="/"){t=a+t}return this.ajax(this.urlPrefix(t,this.buildURL(o,n)),"GET")},findBelongsTo:function(e,r,t,i){var a=s(r,"id");var n=r.constructor.typeKey;return this.ajax(this.urlPrefix(t,this.buildURL(n,a)),"GET")},createRecord:function(e,r,t){var i={};var a=e.serializerFor(r.typeKey);a.serializeIntoHash(i,r,t,{includeId:true});return this.ajax(this.buildURL(r.typeKey,null,t),"POST",{data:i})},updateRecord:function(e,r,t){var i={};var a=e.serializerFor(r.typeKey);a.serializeIntoHash(i,r,t);var n=s(t,"id");return this.ajax(this.buildURL(r.typeKey,n,t),"PUT",{data:i})},deleteRecord:function(e,r,t){var i=s(t,"id");return this.ajax(this.buildURL(r.typeKey,i,t),"DELETE")},buildURL:function(e,r,t){var i=[],a=s(this,"host"),n=this.urlPrefix();if(e){i.push(this.pathForType(e))}if(r&&!Ember.isArray(r)){i.push(encodeURIComponent(r))}if(n){i.unshift(n)}i=i.join("/");if(!a&&i){i="/"+i}return i},urlPrefix:function(e,r){var t=s(this,"host");var i=s(this,"namespace");var a=[];if(e){if(e.charAt(0)==="/"){if(t){e=e.slice(1);a.push(t)}}else if(!/^http(s)?:\/\//.test(e)){a.push(r)}}else{if(t){a.push(t)}if(i){a.push(i)}}if(e){a.push(e)}return a.join("/")},_stripIDFromURL:function(e,r){var t=r.constructor;var i=this.buildURL(t.typeKey,r.get("id"),r);var a=i.split("/");var n=a[a.length-1];var s=r.get("id");if(n===s){a[a.length-1]=""}else if(u(n,"?id="+s)){a[a.length-1]=n.substring(0,n.length-s.length-1)}return a.join("/")},maxUrlLength:2048,groupRecordsForFindMany:function(e,r){var t=n.create({defaultValue:function(){return[]}});var i=this;var a=this.maxUrlLength;o.call(r,function(r){var a=i._stripIDFromURL(e,r);t.get(a).push(r)});function s(r,t,a){var n=i._stripIDFromURL(e,r[0]);var s=0;var u=[[]];o.call(r,function(e){var r=encodeURIComponent(e.get("id")).length+a;if(n.length+s+r>=t){s=0;u.push([])}s+=r;var i=u.length-1;u[i].push(e)});return u}var u=[];t.forEach(function(e,r){var t="&ids%5B%5D=".length;var i=s(e,a,t);o.call(i,function(e){u.push(e)})});return u},pathForType:function(e){var r=Ember.String.camelize(e);return Ember.String.pluralize(r)},ajaxError:function(e,r){if(e&&typeof e==="object"){e.then=null}return e},ajaxSuccess:function(e,r){return r},ajax:function(e,r,t){var i=this;return new Ember.RSVP.Promise(function(n,s){var o=i.ajaxOptions(e,r,t);o.success=function(e,r,t){e=i.ajaxSuccess(t,e);if(e instanceof a){Ember.run(null,s,e)}else{Ember.run(null,n,e)}};o.error=function(e,r,t){Ember.run(null,s,i.ajaxError(e,e.responseText))};Ember.$.ajax(o)},"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 a=s(this,"headers");if(a!==undefined){i.beforeSend=function(e){o.call(Ember.keys(a),function(r){e.setRequestHeader(r,a[r])})}}return i}});function u(e,r){if(typeof String.prototype.endsWith!=="function"){return e.indexOf(r,e.length-r.length)!==-1}else{return e.endsWith(r)}}});define("ember-data/core",["exports"],function(e){"use strict";var r;if("undefined"===typeof r){r=Ember.Namespace.create({VERSION:"1.0.0-beta.12"});if(Ember.libraries){Ember.libraries.registerCoreLibrary("Ember Data",r.VERSION)}}e["default"]=r});define("ember-data/ember-initializer",["ember-data/setup-container"],function(e){"use strict";var r=e["default"];var t=Ember.K;Ember.onLoad("Ember.Application",function(e){e.initializer({name:"ember-data",initialize:r});e.initializer({name:"store",after:"ember-data",initialize:t});e.initializer({name:"activeModelAdapter",before:"store",initialize:t});e.initializer({name:"transforms",before:"store",initialize:t});e.initializer({name:"data-adapter",before:"store",initialize:t});e.initializer({name:"injectStore",before:"store",initialize:t})})});define("ember-data/ext/date",[],function(){"use strict";Ember.Date=Ember.Date||{};var e=Date.parse,r=[1,4,5,6,7,10,11];Ember.Date.parse=function(t){var i,a,n=0;if(a=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)){for(var s=0,o;o=r[s];++s){a[o]=+a[o]||0}a[2]=(+a[2]||1)-1;a[3]=+a[3]||1;if(a[8]!=="Z"&&a[9]!==undefined){n=a[10]*60+a[11];if(a[9]==="+"){n=0-n}}i=Date.UTC(a[1],a[2],a[3],a[4],a[5]+n,a[6],a[7])}else{i=e?e(t):NaN}return i};if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.Date){Date.parse=Ember.Date.parse}});define("ember-data/initializers/data_adapter",["ember-data/system/debug/debug_adapter","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=function i(e){e.register("data-adapter:main",t)}});define("ember-data/initializers/store",["ember-data/serializers","ember-data/adapters","ember-data/system/container_proxy","ember-data/system/store","exports"],function(e,r,t,i,a){"use strict";var n=e.JSONSerializer;var s=e.RESTSerializer;var o=r.RESTAdapter;var u=t["default"];var d=i["default"];a["default"]=function c(e,r){e.register("store:main",e.lookupFactory("store:application")||r&&r.Store||d);var t=new u(e);t.registerDeprecations([{deprecated:"serializer:_default",valid:"serializer:-default"},{deprecated:"serializer:_rest",valid:"serializer:-rest"},{deprecated:"adapter:_rest",valid:"adapter:-rest"}]);e.register("serializer:-default",n);e.register("serializer:-rest",s);e.register("adapter:-rest",o);e.lookup("store:main")}});define("ember-data/initializers/store_injections",["exports"],function(e){"use strict";e["default"]=function r(e){e.injection("controller","store","store:main");e.injection("route","store","store:main");e.injection("serializer","store","store:main");e.injection("data-adapter","store","store:main")}});define("ember-data/initializers/transforms",["ember-data/transforms","exports"],function(e,r){"use strict";var t=e.BooleanTransform;var i=e.DateTransform;var a=e.StringTransform;var n=e.NumberTransform;r["default"]=function s(e){e.register("transform:boolean",t);e.register("transform:date",i);e.register("transform:number",n);e.register("transform:string",a)}});define("ember-data/serializers",["ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.JSONSerializer=i;t.RESTSerializer=a});define("ember-data/serializers/embedded_records_mixin",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.EnumerableUtils.forEach;var i=Ember.String.camelize;var a=Ember.Mixin.create({normalize:function(e,r,t){var i=this._super(e,r,t);return n(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,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o=e.get(a);var u;if(n){u=this.keyForRelationship(a,i.kind);if(!o){t[u]=null}else{t[u]=r(o,"id")}}else if(s){u=this.keyForAttribute(a);if(!o){t[u]=null}else{t[u]=o.serialize({includeId:true});this.removeEmbeddedForeignKey(e,o,i,t[u])}}},serializeHasMany:function(e,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o;if(n){o=this.keyForRelationship(a,i.kind);t[o]=r(e,a).mapBy("id")}else if(s){o=this.keyForAttribute(a);t[o]=r(e,a).map(function(r){var t=r.serialize({includeId:true});this.removeEmbeddedForeignKey(e,r,i,t);return t},this)}},removeEmbeddedForeignKey:function(e,r,t,i){if(t.kind==="hasMany"){return}else if(t.kind==="belongsTo"){var a=e.constructor.inverseFor(t.key);if(a){var n=a.name;var s=this.store.serializerFor(r.constructor);var o=s.keyForRelationship(n,a.kind);if(o){delete i[o]}}}},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[i(e)]||r[e])}});function n(e,r,t,i){t.eachRelationship(function(t,a){if(e.hasDeserializeRecordsOption(t)){var n=r.modelFor(a.type.typeKey);if(a.kind==="hasMany"){if(a.options.polymorphic){o(r,t,i)}else{s(r,t,n,i)}}if(a.kind==="belongsTo"){u(r,t,n,i)}}});return i}function s(e,r,i,a){if(!a[r]){return a}var n=[];var s=e.serializerFor(i.typeKey);t(a[r],function(r){var t=s.normalize(i,r,null);e.push(i,t);n.push(t.id)});a[r]=n;return a}function o(e,i,a){if(!a[i]){return a}var n=[];t(a[i],function(t){var i=t.type;var a=e.serializerFor(i);var s=e.modelFor(i);var o=r(a,"primaryKey");var u=a.normalize(s,t,null);e.push(s,u);n.push({id:u[o],type:i})});a[i]=n;return a}function u(e,r,t,i){if(!i[r]){return i}var a=e.serializerFor(t.typeKey);var n=a.normalize(t,i[r],null);e.push(t,n);i[r]=n.id;return i}e["default"]=a});define("ember-data/serializers/json_serializer",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.isNone;var i=Ember.ArrayPolyfills.map;var a=Ember.merge;e["default"]=Ember.Object.extend({primaryKey:"id",applyTransforms:function(e,r){e.eachTransformedAttribute(function t(e,i){if(!r.hasOwnProperty(e)){return}var a=this.transformFor(i);r[e]=a.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,t){var i=r(this,"attrs"),a,n;if(i){for(n in i){a=this._getMappedKey(n);if(!t.hasOwnProperty(a)){continue}if(a!==n){t[n]=t[a];delete t[a]}}}},normalizeId:function(e){var t=r(this,"primaryKey");if(t==="id"){return}e.id=e[t];delete e[t]},normalizeErrors:function(e,r){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r)},_getMappedKey:function(e){var t=r(this,"attrs");var i;if(t&&t[e]){i=t[e];if(i.key){i=i.key}if(typeof i==="string"){e=i}}return e},_canSerialize:function(e){var t=r(this,"attrs");return!t||!t[e]||t[e].serialize!==false},serialize:function(e,t){var i={};if(t&&t.includeId){var a=r(e,"id");if(a){i[r(this,"primaryKey")]=a}}e.eachAttribute(function(r,t){this.serializeAttribute(e,i,r,t)},this);e.eachRelationship(function(r,t){if(t.kind==="belongsTo"){this.serializeBelongsTo(e,i,t)}else if(t.kind==="hasMany"){this.serializeHasMany(e,i,t)}},this);return i},serializeIntoHash:function(e,r,t,i){a(e,this.serialize(t,i))},serializeAttribute:function(e,t,i,a){var n=a.type;if(this._canSerialize(i)){var s=r(e,i);if(n){var o=this.transformFor(n);s=o.serialize(s)}var u=this._getMappedKey(i);if(u===i&&this.keyForAttribute){u=this.keyForAttribute(i)}t[u]=s}},serializeBelongsTo:function(e,i,a){var n=a.key;if(this._canSerialize(n)){var s=r(e,n);var o=this._getMappedKey(n);if(o===n&&this.keyForRelationship){o=this.keyForRelationship(n,"belongsTo")}if(t(s)||t(r(s,"id"))){i[o]=null}else{i[o]=r(s,"id")}if(a.options.polymorphic){this.serializePolymorphicType(e,i,a)}}},serializeHasMany:function(e,t,i){var a=i.key;if(this._canSerialize(a)){var n;n=this._getMappedKey(a);if(n===a&&this.keyForRelationship){n=this.keyForRelationship(a,"hasMany")}var s=e.constructor.determineRelationshipType(i);if(s==="manyToNone"||s==="manyToMany"){t[n]=r(e,a).mapBy("id")}}},serializePolymorphicType:Ember.K,extract:function(e,r,t,i,a){this.extractMeta(e,r,t);var n="extract"+a.charAt(0).toUpperCase()+a.substr(1);return this[n](e,r,t,i,a)},extractFindAll:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindQuery:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindHasMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractCreateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractUpdateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractDeleteRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractFind:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractFindBelongsTo:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSave:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSingle:function(e,r,t,i,a){t=this.normalizePayload(t);return this.normalize(r,t)},extractArray:function(e,r,t,a,n){var s=this.normalizePayload(t);var o=this;return i.call(s,function(e){return o.normalize(r,e)})},extractMeta:function(e,r,t){if(t&&t.meta){e.metaForType(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}})});define("ember-data/serializers/rest_serializer",["ember-data/serializers/json_serializer","ember-inflector/system/string","exports"],function(e,r,t){"use strict";var i=e["default"];var a=Ember.get;var n=Ember.ArrayPolyfills.forEach;var s=Ember.ArrayPolyfills.map;var o=Ember.String.camelize;var u=r.singularize;function d(e){return e==null?null:e+""}var c=i.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 a=this.normalizePayload(t);var s=r.typeKey;var o;for(var u in a){var c=this.typeForRoot(u);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=l.typeKey===s;var h=a[u];if(h===null){continue}if(f&&Ember.typeOf(h)!=="array"){o=this.normalize(r,h,u);continue}n.call(h,function(r){var t=this.typeForRoot(u);var a=e.modelFor(t);var n=e.serializerFor(a);r=n.normalize(a,r,u);var s=f&&!i&&!o;var c=f&&d(r.id)===i;if(s||c){o=r}else{e.push(t,r)}},this)}return o},extractArray:function(e,r,t){var i=this.normalizePayload(t);var a=r.typeKey;var n;for(var o in i){var u=o;var d=false;if(o.charAt(0)==="_"){d=true;u=o.substr(1)}var c=this.typeForRoot(u);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=e.serializerFor(l);var h=!d&&l.typeKey===a;var p=s.call(i[o],function(e){return f.normalize(l,e,o)},this);if(h){n=p}else{e.pushMany(c,p)}}return n},pushPayload:function(e,r){var t=this.normalizePayload(r);for(var i in t){var a=this.typeForRoot(i);if(!e.modelFactoryFor(a,i)){continue}var n=e.modelFor(a);var o=e.serializerFor(n);var u=s.call(Ember.makeArray(t[i]),function(e){return o.normalize(n,e,i)},this);e.pushMany(a,u)}},typeForRoot:function(e){return o(u(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=a(e,i);i=this.keyForAttribute?this.keyForAttribute(i):i;if(Ember.isNone(n)){r[i+"Type"]=null}else{r[i+"Type"]=Ember.String.camelize(n.constructor.typeKey)}}});t["default"]=c});define("ember-data/setup-container",["ember-data/initializers/store","ember-data/initializers/transforms","ember-data/initializers/store_injections","ember-data/initializers/data_adapter","activemodel-adapter/setup-container","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=t["default"];var d=i["default"];var c=a["default"];n["default"]=function l(e,r){d(e,r);o(e,r);u(e,r);s(e,r);c(e,r)}});define("ember-data/system/adapter",["exports"],function(e){"use strict";var r=Ember.get;var t=["description","fileName","lineNumber","message","name","number","stack"];function i(e){var r=Error.prototype.constructor.call(this,"The backend rejected the commit because it was invalid: "+Ember.inspect(e));this.errors=e;for(var i=0,a=t.length;i<a;i++){this[t[i]]=r[t[i]]}}i.prototype=Ember.create(Error.prototype);var a=Ember.Object.extend({find:Ember.required(Function),findAll:null,findQuery:null,generateIdForRecord:null,serialize:function(e,t){return r(e,"store").serializerFor(e.constructor.typeKey).serialize(e,t)},createRecord:Ember.required(Function),updateRecord:Ember.required(Function),deleteRecord:Ember.required(Function),coalesceFindRequests:true,groupRecordsForFindMany:function(e,r){return[r]}});e.InvalidError=i;e.Adapter=a;e["default"]=a});define("ember-data/system/container_proxy",["exports"],function(e){"use strict";function r(e){this.container=e}r.prototype.aliasedFactory=function(e,r){var t=this;return{create:function(){if(r){r()}return t.container.lookup(e)}}};r.prototype.registerAlias=function(e,r,t){var i=this.aliasedFactory(r,t);return this.container.register(e,i)};r.prototype.registerDeprecation=function(e,r){var t=function(){};return this.registerAlias(e,r,t)};r.prototype.registerDeprecations=function(e){var r,t,i,a;for(r=e.length;r>0;r--){t=e[r-1];i=t["deprecated"];a=t["valid"];this.registerDeprecation(i,a)}};e["default"]=r});define("ember-data/system/create",[],function(){"use strict";var e=Ember.create(null);if(e.toString!==undefined&&Ember.keys(Ember.create({}))[0]==="__proto__"){throw new Error("Ember Data requires a correct Object.create shim. You should upgrade to Ember >= 1.8 which provides one for you. If you are using ES5-shim, you should try removing that after upgrading Ember.")}});define("ember-data/system/debug",["ember-data/system/debug/debug_info","ember-data/system/debug/debug_adapter","exports"],function(e,r,t){"use strict";var i=r["default"];t["default"]=i});define("ember-data/system/debug/debug_adapter",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;var i=Ember.get;var a=Ember.String.capitalize;var n=Ember.String.underscore;r["default"]=Ember.DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==t&&t.detect(e)},columnsForType:function(e){var r=[{name:"id",desc:"Id"}];var t=0;var s=this;i(e,"attributes").forEach(function(e,i){if(t++>s.attributeLimit){return false}var o=a(n(i).replace("_"," "));r.push({name:i,desc:o})});return r},getRecords:function(e){return this.get("store").all(e)},getRecordColumnValues:function(e){var r=this,t=0;var a={id:i(e,"id")};e.eachAttribute(function(n){if(t++>r.attributeLimit){return false}var s=i(e,n);a[n]=s});return a},getRecordKeywords:function(e){var r=[];var t=Ember.A(["id"]);e.eachAttribute(function(e){t.push(e)});t.forEach(function(t){r.push(i(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(),i=this;var a=Ember.A(["id","isNew","isDirty"]);e.eachAttribute(function(e){a.push(e)});a.forEach(function(a){var n=function(){r(i.wrapRecord(e))};Ember.addObserver(e,a,n);t.push(function(){Ember.removeObserver(e,a,n)})});var n=function(){t.forEach(function(e){e()})};return n}})});define("ember-data/system/debug/debug_info",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;t.reopen({_debugInfo:function(){var e=["id"],r={belongsTo:[],hasMany:[]},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}}}});r["default"]=t});define("ember-data/system/map",["exports"],function(e){"use strict";var r,t;function i(){Ember.OrderedSet.apply(this,arguments)}function a(){Ember.Map.apply(this,arguments)}function n(){Ember.MapWithDefault.apply(this,arguments)}var s=Ember.Map.create();s.set("key","value");var o=false;s.forEach(function(e,r){o=e==="key"&&r==="value"});a.prototype=Ember.create(Ember.Map.prototype);n.prototype=Ember.create(Ember.MapWithDefault.prototype);i.prototype=Ember.create(Ember.OrderedSet.prototype);i.create=function(){return new i};function u(e){return function(r,t){e.call(this,t,r)}}if(o){r=function(e,r){this.__super$forEach(u(e),r)};t=function(e){this.remove(e)};a.prototype.__super$forEach=Ember.Map.prototype.forEach;a.prototype.forEach=r;a.prototype["delete"]=t;n.prototype.forEach=r;n.prototype.__super$forEach=Ember.MapWithDefault.prototype.forEach;n.prototype["delete"]=t;i.prototype["delete"]=t}n.constructor=n;a.constructor=a;n.create=function(e){if(e){return new n(e)}else{return new a}};a.create=function(){return new this.constructor};e["default"]=a;e.Map=a;e.MapWithDefault=n;e.OrderedSet=i});define("ember-data/system/model",["ember-data/system/model/model","ember-data/system/model/attributes","ember-data/system/model/states","ember-data/system/model/errors","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var u=i["default"];a.Model=n;a.RootState=o;a.attr=s;a.Errors=u});define("ember-data/system/model/attributes",["ember-data/system/model/model","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r.Map;var n=Ember.get;i.reopenClass({attributes:Ember.computed(function(){var e=a.create();this.eachComputedProperty(function(r,t){if(t.isAttribute){t.name=r;e.set(r,t)}});return e}).readOnly(),transformedAttributes:Ember.computed(function(){var e=a.create();this.eachAttribute(function(r,t){if(t.type){e.set(r,t.type)}});return e}).readOnly(),eachAttribute:function(e,r){n(this,"attributes").forEach(function(t,i){e.call(r,i,t)},r)},eachTransformedAttribute:function(e,r){n(this,"transformedAttributes").forEach(function(t,i){e.call(r,i,t)})}});i.reopen({eachAttribute:function(e,r){this.constructor.eachAttribute(e,r)}});function s(e,r,t){if(typeof r.defaultValue==="function"){return r.defaultValue.apply(null,arguments)}else{return r.defaultValue}}function o(e,r){return e._attributes.hasOwnProperty(r)||e._inFlightAttributes.hasOwnProperty(r)||e._data.hasOwnProperty(r)}function u(e,r){if(e._attributes.hasOwnProperty(r)){return e._attributes[r]}else if(e._inFlightAttributes.hasOwnProperty(r)){return e._inFlightAttributes[r]}else{return e._data[r]}}t["default"]=function d(e,r){r=r||{};var t={type:e,isAttribute:true,options:r};return Ember.computed(function(e,t){if(arguments.length>1){var i=u(this,e);
2
+ if(t!==i){this._attributes[e]=t;this.send("didSetProperty",{name:e,oldValue:i,originalValue:this._data[e],value:t})}return t}else if(o(this,e)){return u(this,e)}else{return s(this,r,e)}}).meta(t)}});define("ember-data/system/model/errors",["ember-data/system/map","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.isEmpty;var a=Ember.EnumerableUtils.map;var n=e.MapWithDefault;r["default"]=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 n.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 t(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(i(r)){return null}return r},nextObject:function(e,r,i){return t(this,"content").objectAt(e)},length:Ember.computed.oneWay("content.length").readOnly(),isEmpty:Ember.computed.not("length").readOnly(),add:function(e,r){var i=t(this,"isEmpty");r=this._findOrCreateMessages(e,r);t(this,"content").addObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(i&&!t(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return a(Ember.makeArray(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(t(this,"isEmpty")){return}var r=t(this,"content").rejectBy("attribute",e);t(this,"content").setObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(t(this,"isEmpty")){this.trigger("becameValid")}},clear:function(){if(t(this,"isEmpty")){return}t(this,"content").clear();this.enumerableContentDidChange();this.trigger("becameValid")},has:function(e){return!i(this.errorsFor(e))}})});define("ember-data/system/model/model",["ember-data/system/model/states","ember-data/system/model/errors","ember-data/system/promise_proxies","ember-data/system/relationships/relationship","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t.PromiseObject;var u=i.createRelationshipFor;var d=Ember.get;var c=Ember.set;var l=Ember.merge;var f=Ember.RSVP.Promise;var h=Ember.ArrayPolyfills.forEach;var p=Ember.ArrayPolyfills.map;var m;var y=Ember.computed("currentState",function(e,r){return d(d(this,"currentState"),e)}).readOnly();var v=Ember.create(null);var b=Ember.create(null);function g(e){return b[e]||(b[e]=e.split("."))}function E(e){return v[e]||(v[e]=g(e)[0])}var R=Ember.Object.extend(Ember.Evented,{_recordArrays:undefined,_relationships:undefined,_loadingRecordArrays:undefined,isEmpty:y,isLoading:y,isLoaded:y,isDirty:y,isSaving:y,isDeleted:y,isNew:y,isValid:y,dirtyType:y,isError:false,isReloading:false,clientId:null,id:null,currentState:n.empty,errors:Ember.computed(function(){var e=s.create();e.registerHandlers(this,function(){this.send("becameInvalid")},function(){this.send("becameValid")});return e}).readOnly(),serialize:function(e){var r=d(this,"store");return r.serialize(this,e)},toJSON:function(e){if(!m){m=requireModule("ember-data/serializers/json_serializer")["default"]}var r=m.create({container:this.container});return r.serialize(this,e)},didLoad:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,data:Ember.computed(function(){this._data=this._data||{};return this._data}).readOnly(),_data:null,init:function(){this._super();this._setup()},_setup:function(){this._changesToSync={};this._deferredTriggers=[];this._data={};this._attributes={};this._inFlightAttributes={};this._relationships={};this._implicitRelationships=Ember.create(null);var e=this;this.constructor.eachRelationship(function(r,t){e._relationships[r]=u(e,t,e.store)})},send:function(e,r){var t=d(this,"currentState");if(!t[e]){this._unhandledEvent(t,e,r)}return t[e](this,r)},transitionTo:function(e){var r=E(e);var t=d(this,"currentState");var i=t;do{if(i.exit){i.exit(this)}i=i.parentState}while(!i.hasOwnProperty(r));var a=g(e);var n=[],s=[],o,u;for(o=0,u=a.length;o<u;o++){i=i[a[o]];if(i.enter){s.push(i)}if(i.setup){n.push(i)}}for(o=0,u=s.length;o<u;o++){s[o].enter(this)}c(this,"currentState",i);for(o=0,u=n.length;o<u;o++){n[o].setup(this)}this.updateRecordArraysLater()},_unhandledEvent:function(e,r,t){var i="Attempted to handle event `"+r+"` ";i+="on "+String(this)+" while in state ";i+=e.stateName+". ";if(t!==undefined){i+="Called with "+Ember.inspect(t)+"."}throw new Ember.Error(i)},withTransaction:function(e){var r=d(this,"transaction");if(r){e(r)}},loadingData:function(e){this.send("loadingData",e)},loadedData:function(){this.send("loadedData")},notFound:function(){this.send("notFound")},pushedData:function(){this.send("pushedData")},deleteRecord:function(){this.send("deleteRecord")},destroyRecord:function(){this.deleteRecord();return this.save()},unloadRecord:function(){if(this.isDestroyed){return}this.send("unloadRecord")},clearRelationships:function(){this.eachRelationship(function(e,r){var t=this._relationships[e];if(t){t.clear();t.destroy()}},this)},disconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships[e].disconnect()},this);var e=this;h.call(Ember.keys(this._implicitRelationships),function(r){e._implicitRelationships[r].disconnect()})},reconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships[e].reconnect()},this);var e=this;h.call(Ember.keys(this._implicitRelationships),function(r){e._implicitRelationships[r].reconnect()})},updateRecordArrays:function(){this._updatingRecordArraysLater=false;d(this,"store").dataWasUpdated(this.constructor,this)},_preloadData:function(e){var r=this;h.call(Ember.keys(e),function(t){var i=d(e,t);var a=r.constructor.metaForProperty(t);if(a.isRelationship){r._preloadRelationship(t,i)}else{d(r,"_data")[t]=i}})},_preloadRelationship:function(e,r){var t=this.constructor.metaForProperty(e);var i=t.type;if(t.kind==="hasMany"){this._preloadHasMany(e,r,i)}else{this._preloadBelongsTo(e,r,i)}},_preloadHasMany:function(e,r,t){var i=this;var a=p.call(r,function(e){return i._convertStringOrNumberIntoRecord(e,t)});this._relationships[e].updateRecordsFromAdapter(a)},_preloadBelongsTo:function(e,r,t){var i=this._convertStringOrNumberIntoRecord(r,t);this._relationships[e].setRecord(i)},_convertStringOrNumberIntoRecord:function(e,r){if(Ember.typeOf(e)==="string"||Ember.typeOf(e)==="number"){return this.store.recordForId(r,e)}return e},_notifyProperties:function(e){Ember.beginPropertyChanges();var r;for(var t=0,i=e.length;t<i;t++){r=e[t];this.notifyPropertyChange(r)}Ember.endPropertyChanges()},changedAttributes:function(){var e=d(this,"_data");var r=d(this,"_attributes");var t={};var i;for(i in r){t[i]=[e[i],r[i]]}return t},adapterWillCommit:function(){this.send("willCommit")},adapterDidCommit:function(e){c(this,"isError",false);if(e){this._data=e}else{Ember.mixin(this._data,this._inFlightAttributes)}this._inFlightAttributes={};this.send("didCommit");this.updateRecordArraysLater();if(!e){return}this._notifyProperties(Ember.keys(e))},adapterDidDirty:function(){this.send("becomeDirty");this.updateRecordArraysLater()},updateRecordArraysLater:function(){if(this._updatingRecordArraysLater){return}this._updatingRecordArraysLater=true;Ember.run.schedule("actions",this,this.updateRecordArrays)},setupData:function(e,r){if(r){Ember.merge(this._data,e)}else{this._data=e}this.pushedData();this._notifyProperties(Ember.keys(e))},materializeId:function(e){c(this,"id",e)},materializeAttributes:function(e){l(this._data,e)},materializeAttribute:function(e,r){this._data[e]=r},rollback:function(){this._attributes={};if(d(this,"isError")){this._inFlightAttributes={};c(this,"isError",false)}if(d(this,"isDeleted")){this.reconnectRelationships()}if(d(this,"isNew")){this.clearRelationships()}if(!d(this,"isValid")){this._inFlightAttributes={}}this.send("rolledBack");this._notifyProperties(Ember.keys(this._data))},toStringExtension:function(){return d(this,"id")},save:function(){var e="DS: Model#save "+this;var r=Ember.RSVP.defer(e);this.get("store").scheduleSave(this,r);this._inFlightAttributes=this._attributes;this._attributes={};return o.create({promise:r.promise})},reload:function(){c(this,"isReloading",true);var e=this;var r="DS: Model#reload of "+this;var t=new f(function(r){e.send("reloadRecord",r)},r).then(function(){e.set("isReloading",false);e.set("isError",false);return e},function(r){e.set("isError",true);throw r},"DS: Model#reload complete, update flags")["finally"](function(){e.updateRecordArrays()});return o.create({promise:t})},adapterDidUpdateAttribute:function(e,r){if(r!==undefined){this._data[e]=r;this.notifyPropertyChange(e)}else{this._data[e]=this._inFlightAttributes[e]}this.updateRecordArraysLater()},adapterDidInvalidate:function(e){var r=d(this,"errors");function t(t){if(e[t]){r.add(t,e[t])}}this.eachAttribute(t);this.eachRelationship(t)},adapterDidError:function(){this.send("becameError");c(this,"isError",true)},trigger:function(){var e=arguments.length;var r=new Array(e-1);var t=arguments[0];for(var i=1;i<e;i++){r[i-1]=arguments[i]}Ember.tryInvoke(this,t,r);this._super.apply(this,arguments)},triggerLater:function(){var e=arguments.length;var r=new Array(e);for(var t=0;t<e;t++){r[t]=arguments[t]}if(this._deferredTriggers.push(r)!==1){return}Ember.run.schedule("actions",this,"_triggerDeferredTriggers")},_triggerDeferredTriggers:function(){for(var e=0,r=this._deferredTriggers.length;e<r;e++){this.trigger.apply(this,this._deferredTriggers[e])}this._deferredTriggers.length=0},willDestroy:function(){this._super();this.clearRelationships()},willMergeMixin:function(e){}});R.reopenClass({_create:R.create,create:function(){throw new Ember.Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.")}});a["default"]=R});define("ember-data/system/model/states",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.set;function i(e,r){if(r.value===r.originalValue){delete e._attributes[r.name];e.send("propertyWasReset",r.name)}else if(r.value!==r.oldValue){e.send("becomeDirty")}e.updateRecordArraysLater()}var a={initialState:"uncommitted",isDirty:true,uncommitted:{didSetProperty:i,loadingData:Ember.K,propertyWasReset:function(e,r){var t=Ember.keys(e._attributes);var i=t>0;if(!i){e.send("rolledBack")}},pushedData:Ember.K,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,t){t(r(e,"store").reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollback()}},inFlight:{isSaving:true,didSetProperty:i,becomeDirty:Ember.K,pushedData:Ember.K,unloadRecord:function(e){},willCommit:Ember.K,didCommit:function(e){var t=r(this,"dirtyType");e.transitionTo("saved");e.send("invokeLifecycleCallbacks",t)},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,t){r(e,"errors").remove(t.name);i(e,t)},becomeDirty:Ember.K,willCommit:function(e){r(e,"errors").clear();e.transitionTo("inFlight")},rolledBack:function(e){r(e,"errors").clear()},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)},exit:function(e){e._inFlightAttributes={}}}};function n(e){var r={},t;for(var i in e){t=e[i];if(t&&typeof t==="object"){r[i]=n(t)}else{r[i]=t}}return r}function s(e,r){for(var t in r){e[t]=r[t]}return e}function o(e){var r=n(a);return s(r,e)}var u=o({dirtyType:"created",isNew:true});u.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var d=o({dirtyType:"updated"});u.uncommitted.deleteRecord=function(e){e.disconnectRelationships();e.transitionTo("deleted.saved")};u.uncommitted.rollback=function(e){a.uncommitted.rollback.apply(this,arguments);e.transitionTo("deleted.saved")};u.uncommitted.propertyWasReset=Ember.K;function c(e){}d.inFlight.unloadRecord=c;d.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()};var l={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.notifyPropertyChange("data")},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad")}},loading:{isLoading:true,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");t(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=false;for(var i in r){if(r.hasOwnProperty(i)){t=true;break}}if(t){e.adapterDidDirty()}},didSetProperty:i,pushedData:Ember.K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,t){t(r(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",r(e,"lastDirtyType"))},notFound:Ember.K},created:u,updated:d},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()},becomeDirty:Ember.K,deleteRecord:Ember.K,rolledBack:function(e){e.transitionTo("loaded.saved")}},inFlight:{isSaving:true,unloadRecord:c,willCommit:Ember.K,didCommit:function(e){e.transitionTo("saved");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},saved:{isDirty:false,setup:function(e){var t=r(e,"store");t.dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e);e.triggerLater("didCommit",e)},willCommit:Ember.K,didCommit:Ember.K}},invokeLifecycleCallbacks:function(e,r){if(r==="created"){e.triggerLater("didCreate",e)}else{e.triggerLater("didUpdate",e)}e.triggerLater("didCommit",e)}};function f(e,r,t){e=s(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]=f(e[i],e,t+"."+i)}}return e}l=f(l,null,"root");e["default"]=l});define("ember-data/system/promise_proxies",["exports"],function(e){"use strict";var r=Ember.RSVP.Promise;var t=Ember.get;var i=Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);var a=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var n=function(e,t){return a.create({promise:r.resolve(e,t)})};var s=function(e,t){return i.create({promise:r.resolve(e,t)})};function o(e){return function(){var r=t(this,"content");return r[e].apply(r,arguments)}}var u=i.extend({reload:function(){return t(this,"content").reload()},createRecord:o("createRecord"),on:o("on"),one:o("one"),trigger:o("trigger"),off:o("off"),has:o("has")});var d=function(e,t){return u.create({promise:r.resolve(e,t)})};e.PromiseArray=i;e.PromiseObject=a;e.PromiseManyArray=u;e.promiseArray=s;e.promiseObject=n;e.promiseManyArray=d});define("ember-data/system/record_array_manager",["ember-data/system/record_arrays","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.RecordArray;var a=e.FilteredRecordArray;var n=e.AdapterPopulatedRecordArray;var s=e.ManyArray;var o=r.MapWithDefault;var u=r.OrderedSet;var d=Ember.get;var c=Ember.EnumerableUtils.forEach;var l=Ember.EnumerableUtils.indexOf;t["default"]=Ember.Object.extend({init:function(){this.filteredRecordArrays=o.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||u.create();return e._recordArrays},updateRecordArrays:function(){c(this.changedRecords,function(e){if(d(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;c(t,function(t){i=d(t,"filterFunction");this.updateRecordArray(t,i,r,e)},this);var a=e._loadingRecordArrays;if(a){for(var n=0,s=a.length;n<s;n++){a[n].loadedRecord()}e._loadingRecordArrays=[]}},updateRecordArray:function(e,r,t,i){var a;if(!r){a=true}else{a=r(i)}var n=this.recordArraysForRecord(i);if(a){if(!n.has(e)){e.pushRecord(i);n.add(e)}}else if(!a){n["delete"](e);e.removeRecord(i)}},updateFilter:function(e,r,t){var i=this.store.typeMapFor(r);var a=i.records,n;for(var s=0,o=a.length;s<o;s++){n=a[s];if(!d(n,"isDeleted")&&!d(n,"isEmpty")){this.updateRecordArray(e,t,r,n)}}},createManyArray:function(e,r){var t=s.create({type:e,content:r,store:this.store});c(r,function(e){var r=this.recordArraysForRecord(e);r.add(t)},this);return t},createRecordArray:function(e){var r=i.create({type:e,content:Ember.A(),store:this.store,isLoaded:true});this.registerFilteredRecordArray(r,e);return r},createFilteredRecordArray:function(e,r,t){var i=a.create({query:t,type:e,content:Ember.A(),store:this.store,manager:this,filterFunction:r});this.registerFilteredRecordArray(i,e,r);return i},createAdapterPopulatedRecordArray:function(e,r){var t=n.create({type:e,query:r,content:Ember.A(),store:this.store,manager:this});this._adapterPopulatedRecordArrays.push(t);return t},registerFilteredRecordArray:function(e,r,t){var i=this.filteredRecordArrays.get(r);i.push(e);this.updateFilter(e,r,t)},unregisterFilteredRecordArray:function(e){var r=this.filteredRecordArrays.get(e.type);var t=l(r,e);r.splice(t,1)},registerWaitingRecordArray:function(e,r){var t=e._loadingRecordArrays||[];t.push(r);e._loadingRecordArrays=t},willDestroy:function(){this._super();c(p(f(this.filteredRecordArrays.values)),h);c(this._adapterPopulatedRecordArrays,h)}});function f(e){var r=[];var t=Ember.keys(e);for(var i=0;i<t.length;i++){r.push(e[t[i]])}return r}function h(e){e.destroy()}function p(e){var r=e.length;var t=Ember.A();for(var i=0;i<r;i++){t=t.concat(e[i])}return t}});define("ember-data/system/record_arrays",["ember-data/system/record_arrays/record_array","ember-data/system/record_arrays/filtered_record_array","ember-data/system/record_arrays/adapter_populated_record_array","ember-data/system/record_arrays/many_array","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var u=i["default"];a.RecordArray=n;a.FilteredRecordArray=s;a.AdapterPopulatedRecordArray=o;a.ManyArray=u});define("ember-data/system/record_arrays/adapter_populated_record_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;function a(e){var r=Ember.create(null);for(var t in e){r[t]=e[t]}return r}r["default"]=t.extend({query:null,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},load:function(e){var r=i(this,"store");var t=i(this,"type");var n=r.pushMany(t,e);var s=r.metadataFor(t);this.setProperties({content:Ember.A(n),isLoaded:true,meta:a(s)});n.forEach(function(e){this.manager.recordArraysForRecord(e).add(this)},this);Ember.run.once(this,"trigger","didLoad")}})});define("ember-data/system/record_arrays/filtered_record_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;r["default"]=t.extend({filterFunction:null,isLoaded:true,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=i(this,"manager");e.updateFilter(this,i(this,"type"),i(this,"filterFunction"))},updateFilter:Ember.observer(function(){Ember.run.once(this,this._updateFilter)},"filterFunction"),_unregisterFromManager:function(){this.manager.unregisterFilteredRecordArray(this)},willDestroy:function(){this._unregisterFromManager();this._super()}})});define("ember-data/system/record_arrays/many_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get,a=Ember.set;r["default"]=t.extend({init:function(){this._super.apply(this,arguments)},isPolymorphic:false,isLoaded:false,relationship:null,promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--;if(this.loadingRecordsCount===0){a(this,"isLoaded",true);this.trigger("didLoad")}},replaceContent:function(e,r,t){var a;if(r>0){a=i(this,"content").slice(e,e+r);this.get("relationship").removeRecords(a)}if(t){this.get("relationship").addRecords(t,e)}},reload:function(){return this.relationship.reload()},createRecord:function(e){var r=i(this,"store");var t=i(this,"type");var a;a=r.createRecord(t,e);this.pushObject(a);return a}})});define("ember-data/system/record_arrays/record_array",["ember-data/system/promise_proxies","exports"],function(e,r){"use strict";var t=e.PromiseArray;var i=Ember.get;r["default"]=Ember.ArrayProxy.extend(Ember.Evented,{type:null,content:null,isLoaded:false,isUpdating:false,store:null,objectAtContent:function(e){var r=i(this,"content");return r.objectAt(e)},update:function(){if(i(this,"isUpdating")){return}var e=i(this,"store");var r=i(this,"type");return e.fetchAll(r,this)},addRecord:function(e,r){var t=i(this,"content");if(r===undefined){t.addObject(e)}else{if(!t.contains(e)){t.insertAt(r,e)}}},pushRecord:function(e){i(this,"content").pushObject(e)},removeRecord:function(e){i(this,"content").removeObject(e)},save:function(){var e="DS: RecordArray#save "+i(this,"type");var r=Ember.RSVP.all(this.invoke("save"),e).then(function(e){return Ember.A(e)},null,"DS: RecordArray#save apply Ember.NativeArray");return t.create({promise:r})},_dissociateFromOwnRecords:function(){var e=this;this.forEach(function(r){var t=r._recordArrays;if(t){t["delete"](e)}})},willDestroy:function(){this._dissociateFromOwnRecords();this._super()}})});define("ember-data/system/relationship-meta",["ember-inflector/system","exports"],function(e,r){"use strict";var t=e.singularize;function i(e,r){var i,a;i=r.type||r.key;if(typeof i==="string"){if(r.kind==="hasMany"){i=t(i)}a=e.modelFor(i)}else{a=r.type}return a}r.typeForRelationshipMeta=i;function a(e,r){return{key:r.key,kind:r.kind,type:i(e,r),options:r.options,parentType:r.parentType,isRelationship:true}}r.relationshipFromMeta=a});define("ember-data/system/relationships",["./relationships/belongs_to","./relationships/has_many","ember-data/system/relationships/ext","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];i.belongsTo=a;i.hasMany=n});define("ember-data/system/relationships/belongs_to",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(e,r){if(typeof e==="object"){r=e;e=undefined}else{}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)}t.reopen({notifyBelongsToAdded:function(e,r){this.notifyPropertyChange(e)},notifyBelongsToRemoved:function(e){this.notifyPropertyChange(e)}});r["default"]=i});define("ember-data/system/relationships/ext",["ember-data/system/relationship-meta","ember-data/system/model","ember-data/system/map"],function(e,r,t){"use strict";var i=e.typeForRelationshipMeta;var a=e.relationshipFromMeta;var n=r.Model;var s=t.Map;var o=t.MapWithDefault;var u=Ember.get;var d=Ember.ArrayPolyfills.filter;n.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});n.reopenClass({typeForRelationship:function(e){var r=u(this,"relationshipsByName").get(e);return r&&r.type},inverseMap:Ember.computed(function(){return Ember.create(null)}),inverseFor:function(e){var r=u(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).options;if(t.inverse===null){return null}var i,a,n;if(t.inverse){i=t.inverse;n=Ember.get(r,"relationshipsByName").get(i);a=n.kind}else{var s=c(this,r);if(s.length===0){return null}var o=d.call(s,function(t){var i=r.metaForProperty(t.name).options;return e===i.inverse});if(o.length===1){s=o}i=s[0].name;a=s[0].kind}function c(r,t,i){var a=i||[];var n=u(t,"relationships");if(!n){return}var s=n.get(r);s=d.call(s,function(r){var i=t.metaForProperty(r.name).options;if(!i.inverse){return true}return e===i.inverse});if(s){a.push.apply(a,s)}if(r.superclass){c(r.superclass,t,a)}return a}return{type:r,name:i,kind:a}},relationships:Ember.computed(function(){var e=new o({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var a=e.get(i(this.store,t));a.push({name:r,kind:t.kind})}});return e}).cacheable(false).readOnly(),relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};this.eachComputedProperty(function(r,t){if(t.isRelationship){e[t.kind].push(r)}});return e}),relatedTypes:Ember.computed(function(){var e;var r=Ember.A();this.eachComputedProperty(function(t,a){if(a.isRelationship){a.key=t;e=i(this.store,a);if(!r.contains(e)){r.push(e)}}});return r}).cacheable(false).readOnly(),relationshipsByName:Ember.computed(function(){var e=s.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var n=a(this.store,t);n.type=i(this.store,t);e.set(r,n)}});return e}).cacheable(false).readOnly(),fields:Ember.computed(function(){var e=s.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){u(this,"relationshipsByName").forEach(function(t,i){e.call(r,i,t)})},eachRelatedType:function(e,r){u(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 a,n;if(!i){return t==="belongsTo"?"oneToNone":"manyToNone"}a=i.name;n=i.kind;if(n==="belongsTo"){return t==="belongsTo"?"oneToOne":"manyToOne"}else{return t==="belongsTo"?"oneToMany":"manyToMany"}}});n.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return u(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e)}})});define("ember-data/system/relationships/has_many",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(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()}t.reopen({notifyHasManyAdded:function(e,r,t){var i=this._relationships[e];var a=i.manyArray;a.addRecord(r,t);this.notifyPropertyChange(e)},notifyHasManyRemoved:function(e,r){var t=this._relationships[e];var i=t.manyArray;i.removeRecord(r)}});r["default"]=i});define("ember-data/system/relationships/relationship",["ember-data/system/promise_proxies","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.PromiseManyArray;var a=e.PromiseObject;var n=r.OrderedSet;var s=function(e,r,t,i){this.members=new n;this.store=e;this.key=i.key;this.inverseKey=t;this.record=r;this.isAsync=i.options.async;this.relationshipMeta=i;this.inverseKeyForImplicit=this.store.modelFor(this.record.constructor).typeKey+this.key;this.linkPromise=null};s.prototype={constructor:s,destroy:Ember.K,clear:function(){this.members.forEach(function(e){this.removeRecord(e)},this)},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=Ember.get(e,"length");var t;for(var i=0;i<r;i++){t=e[i];this.removeRecord(t)}},addRecords:function(e,r){var t=Ember.get(e,"length");var i;for(var a=0;a<t;a++){i=e[a];this.addRecord(i,r);if(r!==undefined){r++}}},addRecord:function(e,r){if(!this.members.has(e)){this.members.add(e);this.notifyRecordRelationshipAdded(e,r);if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new s(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)}this.record.updateRecordArrays()}},removeRecord:function(e){if(this.members.has(e)){this.removeRecordFromOwn(e);if(this.inverseKey){this.removeRecordFromInverse(e)}else{if(e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record)}}}},addRecordToInverse:function(e){if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}},removeRecordFromInverse:function(e){var r=e._relationships[this.inverseKey];if(r){r.removeRecordFromOwn(this.record)}},removeRecordFromOwn:function(e){this.members["delete"](e);this.notifyRecordRelationshipRemoved(e);this.record.updateRecordArrays()},updateLink:function(e){if(e!==this.link){this.link=e;this.linkPromise=null;this.record.notifyPropertyChange(this.key)}},findLink:function(){if(this.linkPromise){return this.linkPromise}else{var e=this.fetchLink();this.linkPromise=e;return e.then(function(e){return e})}},updateRecordsFromAdapter:function(e){this.computeChanges(e)},notifyRecordRelationshipAdded:Ember.K,notifyRecordRelationshipRemoved:Ember.K};var o=function(e,r,t,i){this._super$constructor(e,r,t,i);this.belongsToType=i.type;this.manyArray=e.recordArrayManager.createManyArray(this.belongsToType,Ember.A());this.manyArray.relationship=this;this.isPolymorphic=i.options.polymorphic;this.manyArray.isPolymorphic=this.isPolymorphic};o.prototype=Ember.create(s.prototype);o.prototype.constructor=o;o.prototype._super$constructor=s;o.prototype.destroy=function(){this.manyArray.destroy()};o.prototype.notifyRecordRelationshipAdded=function(e,r){this.record.notifyHasManyAdded(this.key,e,r)};o.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyHasManyRemoved(this.key,e)};o.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})}};o.prototype.computeChanges=function(e){var r=this.members;var t=[];var i;var a;var n;e=d(e);r.forEach(function(r){if(e.has(r))return;t.push(r)});this.removeRecords(t);var s=this.manyArray;e=e.toArray();i=e.length;for(n=0;n<i;n++){a=e[n];
3
+ if(s.objectAt(n)===a){continue}this.removeRecord(a);this.addRecord(a,n)}};o.prototype.fetchLink=function(){var e=this;return this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(r){e.updateRecordsFromAdapter(r);return e.manyArray})};o.prototype.findRecords=function(){var e=this.manyArray;return this.store.findMany(e.toArray()).then(function(){e.set("isLoaded",true);return e})};o.prototype.getRecords=function(){if(this.isAsync){var e=this;var r;if(this.link){r=this.findLink().then(function(){return e.findRecords()})}else{r=this.findRecords()}return i.create({content:this.manyArray,promise:r})}else{if(!this.manyArray.get("isDestroyed")){this.manyArray.set("isLoaded",true)}return this.manyArray}};var u=function(e,r,t,i){this._super$constructor(e,r,t,i);this.record=r;this.key=i.key;this.inverseRecord=null};u.prototype=Ember.create(s.prototype);u.prototype.constructor=u;u.prototype._super$constructor=s;u.prototype.setRecord=function(e){if(e){this.addRecord(e)}else if(this.inverseRecord){this.removeRecord(this.inverseRecord)}};u.prototype._super$addRecord=s.prototype.addRecord;u.prototype.addRecord=function(e){if(this.members.has(e)){return}var r=this.relationshipMeta.type;if(this.inverseRecord){this.removeRecord(this.inverseRecord)}this.inverseRecord=e;this._super$addRecord(e)};u.prototype.setRecordPromise=function(e){var r=e.get&&e.get("content");this.setRecord(r)};u.prototype.notifyRecordRelationshipAdded=function(e){this.record.notifyBelongsToAdded(this.key,this)};u.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyBelongsToRemoved(this.key,this)};u.prototype._super$removeRecordFromOwn=s.prototype.removeRecordFromOwn;u.prototype.removeRecordFromOwn=function(e){if(!this.members.has(e)){return}this.inverseRecord=null;this._super$removeRecordFromOwn(e)};u.prototype.findRecord=function(){if(this.inverseRecord){return this.store._findByRecord(this.inverseRecord)}else{return Ember.RSVP.Promise.resolve(null)}};u.prototype.fetchLink=function(){var e=this;return this.store.findBelongsTo(this.record,this.link,this.relationshipMeta).then(function(r){if(r){e.addRecord(r)}return r})};u.prototype.getRecord=function(){if(this.isAsync){var e;if(this.link){var r=this;e=this.findLink().then(function(){return r.findRecord()})}else{e=this.findRecord()}return a.create({promise:e,content:this.inverseRecord})}else{return this.inverseRecord}};function d(e){var r=new n;if(e){for(var t=0,i=e.length;t<i;t++){r.add(e[t])}}return r}var c=function(e,r,t){var i;var a=e.constructor.inverseFor(r.key);if(a){i=a.name}if(r.kind==="hasMany"){return new o(t,e,i,r)}else{return new u(t,e,i,r)}};t.Relationship=s;t.ManyRelationship=o;t.BelongsToRelationship=u;t.createRelationshipFor=c});define("ember-data/system/store",["ember-data/system/adapter","ember-inflector/system/string","ember-data/system/map","ember-data/system/promise_proxies","exports"],function(e,r,t,i,a){"use strict";var n=e.InvalidError;var s=e.Adapter;var o=r.singularize;var u=t.Map;var d=i.promiseArray;var c=i.promiseObject;var l=Ember.get;var f=Ember.set;var h=Ember.run.once;var p=Ember.isNone;var m=Ember.EnumerableUtils.forEach;var y=Ember.EnumerableUtils.indexOf;var v=Ember.EnumerableUtils.map;var b=Ember.RSVP.Promise;var g=Ember.copy;var E,R,_;var A=Ember.String.camelize;function F(e){return e==null?null:e+""}E=Ember.Object.extend({init:function(){if(!R){R=requireModule("ember-data/system/record_array_manager")["default"]}this.typeMaps={};this.recordArrayManager=R.create({store:this});this._pendingSave=[];this._pendingFetch=u.create()},adapter:"-rest",serialize:function(e,r){return this.serializerFor(e.constructor.typeKey).serialize(e,r)},defaultAdapter:Ember.computed("adapter",function(){var e=l(this,"adapter");if(typeof e==="string"){e=this.container.lookup("adapter:"+e)||this.container.lookup("adapter:application")||this.container.lookup("adapter:-rest")}if(DS.Adapter.detect(e)){e=e.create({container:this.container})}return e}),createRecord:function(e,r){var t=this.modelFor(e);var i=g(r)||{};if(p(i.id)){i.id=this._generateId(t)}i.id=F(i.id);var a=this.buildRecord(t,i.id);a.loadedData();a.setProperties(i);return a},_generateId:function(e){var r=this.adapterFor(e);if(r&&r.generateIdForRecord){return r.generateIdForRecord(this)}return null},deleteRecord:function(e){e.deleteRecord()},unloadRecord:function(e){e.unloadRecord()},find:function(e,r,t){if(arguments.length===1){return this.findAll(e)}if(Ember.typeOf(r)==="object"){return this.findQuery(e,r)}return this.findById(e,F(r),t)},fetch:function(e,r,t){if(this.hasRecordForId(e,r)){return this.getById(e,r).reload()}else{return this.find(e,r,t)}},findById:function(e,r,t){var i=this.modelFor(e);var a=this.recordForId(i,r);return this._findByRecord(a,t)},_findByRecord:function(e,r){var t;if(r){e._preloadData(r)}if(l(e,"isEmpty")){t=this.scheduleFetch(e)}else if(l(e,"isLoading")){t=e._loadingPromise}return c(t||e,"DS: Store#findByRecord "+e.typeKey+" with id: "+l(e,"id"))},findByIds:function(e,r){var t=this;return d(Ember.RSVP.all(v(r,function(r){return t.findById(e,r)})).then(Ember.A,null,"DS: Store#findByIds of "+e+" complete"))},fetchRecord:function(e){var r=e.constructor;var t=l(e,"id");var i=this.adapterFor(r);var a=C(i,this,r,t,e);return a},scheduleFetchMany:function(e){return b.all(v(e,this.scheduleFetch,this))},scheduleFetch:function(e){var r=e.constructor;if(p(e)){return null}if(e._loadingPromise){return e._loadingPromise}var t=Ember.RSVP.defer("Fetching "+r+"with id: "+e.get("id"));var i={record:e,resolver:t};var a=t.promise;e.loadingData(a);if(!this._pendingFetch.get(r)){this._pendingFetch.set(r,[i])}else{this._pendingFetch.get(r).push(i)}Ember.run.scheduleOnce("afterRender",this,this.flushAllPendingFetches);return a},flushAllPendingFetches:function(){if(this.isDestroyed||this.isDestroying){return}this._pendingFetch.forEach(this._flushPendingFetchForType,this);this._pendingFetch=u.create()},_flushPendingFetchForType:function(e,r){var t=this;var i=t.adapterFor(r);var a=!!i.findMany&&i.coalesceFindRequests;var n=Ember.A(e).mapBy("record");function s(e){e.resolver.resolve(t.fetchRecord(e.record))}function o(r){m(r,function(r){var t=Ember.A(e).findBy("record",r);if(t){var i=t.resolver;i.resolve(r)}})}function u(e){return function r(t){var i=e.without(t);c(i)}}function d(e){return function(r){c(e,r)}}function c(r,t){m(r,function(r){var i=Ember.A(e).findBy("record",r);if(i){var a=i.resolver;a.reject(t)}})}if(e.length===1){s(e[0])}else if(a){var l=i.groupRecordsForFindMany(this,n);m(l,function(a){var n=Ember.A(a);var c=n.mapBy("id");if(c.length>1){I(i,t,r,c,n).then(o).then(u(n)).then(null,d(n))}else if(c.length===1){var l=Ember.A(e).findBy("record",a[0]);s(l)}else{}})}else{m(e,s)}},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=l(e,"id");return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=F(r);return!!this.typeMapFor(t).idToRecord[i]},recordForId:function(e,r){var t=this.modelFor(e);var i=F(r);var a=this.typeMapFor(t).idToRecord;var n=a[i];if(!n||!a[i]){n=this.buildRecord(t,i)}return n},findMany:function(e){var r=this;return b.all(v(e,function(e){return r._findByRecord(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.constructor);return $(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.constructor);return L(i,this,e,r,t)},findQuery:function(e,r){var t=this.modelFor(e);var i=this.recordArrayManager.createAdapterPopulatedRecordArray(t,r);var a=this.adapterFor(t);return d(j(a,this,t,r,i))},findAll:function(e){var r=this.modelFor(e);return this.fetchAll(r,this.all(r))},fetchAll:function(e,r){var t=this.adapterFor(e);var i=this.typeMapFor(e).metadata.since;f(r,"isUpdating",true);return d(K(t,this,e,i))},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;f(r,"isUpdating",false)},all:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.findAllCache;if(i){return i}var a=this.recordArrayManager.createRecordArray(r);t.findAllCache=a;return a},unloadAll:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.records.slice();var a;for(var n=0;n<i.length;n++){a=i[n];a.unloadRecord();a.destroy()}t.findAllCache=null},filter:function(e,r,t){var i;var a=arguments.length;var n;var s=a===3;if(s){i=this.findQuery(e,r)}else if(arguments.length===2){t=r}e=this.modelFor(e);if(s){n=this.recordArrayManager.createFilteredRecordArray(e,t,r)}else{n=this.recordArrayManager.createFilteredRecordArray(e,t)}i=i||b.cast(n);return d(i.then(function(){return n},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,r){if(!this.hasRecordForId(e,r)){return false}return!l(this.recordForId(e,r),"isEmpty")},metadataFor:function(e){e=this.modelFor(e);return this.typeMapFor(e).metadata},dataWasUpdated:function(e,r){this.recordArrayManager.recordDidChange(r)},scheduleSave:function(e,r){e.adapterWillCommit();this._pendingSave.push([e,r]);h(this,"flushPendingSave")},flushPendingSave:function(){var e=this._pendingSave.slice();this._pendingSave=[];m(e,function(e){var r=e[0],t=e[1];var i=this.adapterFor(r.constructor);var a;if(l(r,"currentState.stateName")==="root.deleted.saved"){return t.resolve(r)}else if(l(r,"isNew")){a="createRecord"}else if(l(r,"isDeleted")){a="deleteRecord"}else{a="updateRecord"}t.resolve(U(i,this,a,r))},this)},didSaveRecord:function(e,r){if(r){r=z(this,e.constructor,r,e);B(this,e,r);this.updateId(e,r)}e.adapterDidCommit(r)},recordWasInvalid:function(e,r){e.adapterDidInvalidate(r)},recordWasError:function(e){e.adapterDidError()},updateId:function(e,r){var t=l(e,"id");var i=F(r.id);this.typeMapFor(e.constructor).idToRecord[i]=e;f(e,"id",i)},typeMapFor:function(e){var r=l(this,"typeMaps");var t=Ember.guidFor(e);var i;i=r[t];if(i){return i}i={idToRecord:Ember.create(null),records:[],metadata:Ember.create(null),type:e};r[t]=i;return i},_load:function(e,r,t){var i=F(r.id);var a=this.recordForId(e,i);a.setupData(r,t);this.recordArrayManager.recordDidChange(a);return a},modelFor:function(e){var r;if(typeof e==="string"){r=this.modelFactoryFor(e);if(!r){throw new Ember.Error("No model was found for '"+e+"'")}r.typeKey=r.typeKey||this._normalizeTypeKey(e)}else{r=e;if(r.typeKey){r.typeKey=this._normalizeTypeKey(r.typeKey)}}r.store=this;return r},modelFactoryFor:function(e){return this.container.lookupFactory("model:"+e)},push:function(e,r,t){var i=this.modelFor(e);var a=Ember.EnumerableUtils.filter;r=z(this,i,r);this._load(i,r,t);var n=this.recordForId(i,r.id);B(this,n,r);return n},pushPayload:function(e,r){var t;var i;if(!r){i=e;t=M(this.container)}else{i=r;t=this.serializerFor(e)}t.pushPayload(this,i)},normalize:function(e,r){var t=this.serializerFor(e);var i=this.modelFor(e);return t.normalize(i,r)},update:function(e,r){return this.push(e,r,true)},pushMany:function(e,r){var t=r.length;var i=new Array(t);for(var a=0;a<t;a++){i[a]=this.push(e,r[a])}return i},metaForType:function(e,r){var t=this.modelFor(e);Ember.merge(this.typeMapFor(t).metadata,r)},buildRecord:function(e,r,t){var i=this.typeMapFor(e);var a=i.idToRecord;var n=e._create({id:r,store:this,container:this.container});if(t){n.setupData(t)}if(r){a[r]=n}i.records.push(n);return n},dematerializeRecord:function(e){var r=e.constructor;var t=this.typeMapFor(r);var i=l(e,"id");e.updateRecordArrays();if(i){delete t.idToRecord[i]}var a=y(t.records,e);t.records.splice(a,1)},adapterFor:function(e){var r=this.container,t;if(r){t=r.lookup("adapter:"+e.typeKey)||r.lookup("adapter:application")}return t||l(this,"defaultAdapter")},serializerFor:function(e){e=this.modelFor(e);var r=this.adapterFor(e);return k(this.container,e.typeKey,r&&r.defaultSerializer)},willDestroy:function(){var e=this.typeMaps;var r=Ember.keys(e);var t=v(r,i);this.recordArrayManager.destroy();m(t,this.unloadAll,this);function i(r){return e[r]["type"]}},_normalizeTypeKey:function(e){return A(o(e))}});function z(e,r,t,i){r.eachRelationship(function(r,i){var a=i.kind;var n=t[r];if(a==="belongsTo"){x(e,t,r,i,n)}else if(a==="hasMany"){S(e,t,r,i,n)}});return t}function x(e,r,t,i,a){if(!_){_=requireModule("ember-data/system/model")["Model"]}if(p(a)||a instanceof _){return}var n;if(typeof a==="number"||typeof a==="string"){n=T(i,t,r);r[t]=e.recordForId(n,a)}else if(typeof a==="object"){r[t]=e.recordForId(a.type,a.id)}}function T(e,r,t){if(e.options.polymorphic){return t[r+"Type"]}else{return e.type}}function S(e,r,t,i,a){if(p(a)){return}for(var n=0,s=a.length;n<s;n++){x(e,a,n,i,a[n])}}function k(e,r,t){return e.lookup("serializer:"+r)||e.lookup("serializer:application")||e.lookup("serializer:"+t)||e.lookup("serializer:-default")}function M(e){return e.lookup("serializer:application")||e.lookup("serializer:-default")}function D(e,r){var t=e.serializer;var i=e.defaultSerializer;var a=e.container;if(a&&t===undefined){t=k(a,r.typeKey,i)}if(t===null||t===undefined){t={extract:function(e,r,t){return t}}}return t}function P(e){return!(l(e,"isDestroyed")||l(e,"isDestroying"))}function O(e,r){var t=e["finally"](function(){if(!r()){t._subscribers.length=0}});return t}function w(e){var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(undefined,r)}}function C(e,r,t,i,a){var n=e.find(r,t,i,a);var s=D(e,t);var o="DS: Handle Adapter#find of "+t+" with id: "+i;n=b.cast(n,o);n=O(n,w(P,r));return n.then(function(e){var a=s.extract(r,t,e,i,"find");return r.push(t,a)},function(e){var a=r.getById(t,i);if(a){a.notFound()}throw e},"DS: Extract payload of '"+t+"'")}function I(e,r,t,i,a){var n=e.findMany(r,t,i,a);var s=D(e,t);var o="DS: Handle Adapter#findMany of "+t;if(n===undefined){throw new Error("adapter.findMany returned undefined, this was very likely a mistake")}n=b.cast(n,o);n=O(n,w(P,r));return n.then(function(e){var i=s.extract(r,t,e,null,"findMany");return r.pushMany(t,i)},null,"DS: Extract payload of "+t)}function $(e,r,t,i,a){var n=e.findHasMany(r,t,i,a);var s=D(e,a.type);var o="DS: Handle Adapter#findHasMany of "+t+" : "+a.type;n=b.cast(n,o);n=O(n,w(P,r));n=O(n,w(P,t));return n.then(function(e){var t=s.extract(r,a.type,e,null,"findHasMany");var i=r.pushMany(a.type,t);return i},null,"DS: Extract payload of "+t+" : hasMany "+a.type)}function L(e,r,t,i,a){var n=e.findBelongsTo(r,t,i,a);var s=D(e,a.type);var o="DS: Handle Adapter#findBelongsTo of "+t+" : "+a.type;n=b.cast(n,o);n=O(n,w(P,r));n=O(n,w(P,t));return n.then(function(e){var t=s.extract(r,a.type,e,null,"findBelongsTo");if(!t){return null}var i=r.push(a.type,t);return i},null,"DS: Extract payload of "+t+" : "+a.type)}function K(e,r,t,i){var a=e.findAll(r,t,i);var n=D(e,t);var s="DS: Handle Adapter#findAll of "+t;a=b.cast(a,s);a=O(a,w(P,r));return a.then(function(e){var i=n.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 j(e,r,t,i,a){var n=e.findQuery(r,t,i,a);var s=D(e,t);var o="DS: Handle Adapter#findQuery of "+t;n=b.cast(n,o);n=O(n,w(P,r));return n.then(function(e){var i=s.extract(r,t,e,null,"findQuery");a.load(i);return a},null,"DS: Extract payload of findQuery "+t)}function U(e,r,t,i){var a=i.constructor;var s=e[t](r,a,i);var o=D(e,a);var u="DS: Extract and notify about "+t+" completion of "+i;s=b.cast(s,u);s=O(s,w(P,r));s=O(s,w(P,i));return s.then(function(e){var n;if(e){n=o.extract(r,a,e,l(i,"id"),t)}else{n=e}r.didSaveRecord(i,n);return i},function(e){if(e instanceof n){var t=o.extractErrors(r,a,e.errors,l(i,"id"));r.recordWasInvalid(i,t);e=new n(t)}else{r.recordWasError(i,e)}throw e},u)}function B(e,r,t){var i=r.constructor;i.eachRelationship(function(e,i){var a=i.kind;var n=t[e];var s=r._relationships[e];if(t.links&&t.links[e]){s.updateLink(t.links[e])}if(a==="belongsTo"){if(n===undefined){return}s.setRecord(n)}else if(a==="hasMany"&&n){s.updateRecordsFromAdapter(n)}})}a.Store=E;a["default"]=E});define("ember-data/transforms",["ember-data/transforms/base","ember-data/transforms/number","ember-data/transforms/date","ember-data/transforms/string","ember-data/transforms/boolean","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=t["default"];var d=i["default"];var c=a["default"];n.Transform=s;n.NumberTransform=o;n.DateTransform=u;n.StringTransform=d;n.BooleanTransform=c});define("ember-data/transforms/base",["exports"],function(e){"use strict";e["default"]=Ember.Object.extend({serialize:Ember.required(),deserialize:Ember.required()})});define("ember-data/transforms/boolean",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=t.extend({deserialize:function(e){var r=typeof e;if(r==="boolean"){return e}else if(r==="string"){return e.match(/^true$|^t$|^1$/i)!==null}else if(r==="number"){return e===1}else{return false}},serialize:function(e){return Boolean(e)}})});define("ember-data/transforms/date",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Date.prototype.toISOString||function(){function e(e){if(e<10){return"0"+e}return e}return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};if(Ember.SHIM_ES5){if(!Date.prototype.toISOString){Date.prototype.toISOString=i}}r["default"]=t.extend({deserialize:function(e){var r=typeof e;if(r==="string"){return new Date(Ember.Date.parse(e))}else if(r==="number"){return new Date(e)}else if(e===null||e===undefined){return e}else{return null}},serialize:function(e){if(e instanceof Date){return i.call(e)}else{return null}}})});define("ember-data/transforms/number",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.isEmpty;r["default"]=t.extend({deserialize:function(e){return i(e)?null:Number(e)},serialize:function(e){return i(e)?null:Number(e)}})});define("ember-data/transforms/string",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.isNone;r["default"]=t.extend({deserialize:function(e){return i(e)?null:String(e)},serialize:function(e){return i(e)?null:String(e)}})});define("ember-inflector",["./system","./helpers","./ext/string","exports"],function(e,r,t,i){"use strict";var a=e.Inflector;var n=e.defaultRules;var s=e.pluralize;var o=e.singularize;a.defaultRules=n;Ember.Inflector=a;Ember.String.pluralize=s;Ember.String.singularize=o;i["default"]=a;i.pluralize=s;i.singularize=o});define("ember-inflector/ext/string",["../system/string"],function(e){"use strict";var r=e.pluralize;var t=e.singularize;if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.String){String.prototype.pluralize=function(){return r(this)};String.prototype.singularize=function(){return t(this)}}});define("ember-inflector/helpers",["./system/string"],function(e){"use strict";var r=e.singularize;var t=e.pluralize;Ember.Handlebars.helper("singularize",r);Ember.Handlebars.helper("pluralize",t)});define("ember-inflector/system",["./system/inflector","./system/string","./system/inflections","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r.pluralize;var s=r.singularize;var o=t["default"];a.inflector=new a(o);i.Inflector=a;i.singularize=s;i.pluralize=n;i.defaultRules=o});define("ember-inflector/system/inflections",["exports"],function(e){"use strict";e["default"]={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"]}});define("ember-inflector/system/inflector",["exports"],function(e){"use strict";var r=/^\s*$/;var t=/(\w+[_-])([a-z\d]+$)/;var i=/(\w+)([A-Z][a-z\d]*$)/;var a=/[A-Z][a-z\d]*$/;function n(e,r){for(var t=0,i=r.length;t<i;t++){e.uncountable[r[t].toLowerCase()]=true}}function s(e,r){var t;for(var i=0,a=r.length;i<a;i++){t=r[i];e.irregular[t[0].toLowerCase()]=t[1];e.irregular[t[1].toLowerCase()]=t[1];e.irregularInverse[t[1].toLowerCase()]=t[0];e.irregularInverse[t[0].toLowerCase()]=t[0]}}function o(e){e=e||{};e.uncountable=e.uncountable||u();e.irregularPairs=e.irregularPairs||u();var r=this.rules={plurals:e.plurals||[],singular:e.singular||[],irregular:u(),irregularInverse:u(),uncountable:u()};n(r,e.uncountable);s(r,e.irregularPairs);this.enableCache()}if(!Object.create&&!Object.create(null).hasOwnProperty){throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg")}function u(){var e=Object.create(null);e["_dict"]=null;delete e["_dict"];return e}o.prototype={enableCache:function(){this.purgeCache();this.singularize=function(e){this._cacheUsed=true;return this._sCache[e]||(this._sCache[e]=this._singularize(e))};this.pluralize=function(e){this._cacheUsed=true;return this._pCache[e]||(this._pCache[e]=this._pluralize(e))}},purgeCache:function(){this._cacheUsed=false;this._sCache=u();this._pCache=u()},disableCache:function(){this._sCache=null;this._pCache=null;this.singularize=function(e){return this._singularize(e)};this.pluralize=function(e){return this._pluralize(e)}},plural:function(e,r){if(this._cacheUsed){this.purgeCache()}this.rules.plurals.push([e,r.toLowerCase()])},singular:function(e,r){if(this._cacheUsed){this.purgeCache()}this.rules.singular.push([e,r.toLowerCase()])},uncountable:function(e){if(this._cacheUsed){this.purgeCache()}n(this.rules,[e.toLowerCase()])},irregular:function(e,r){if(this._cacheUsed){this.purgeCache()}s(this.rules,[[e,r]])},pluralize:function(e){return this._pluralize(e)},_pluralize:function(e){return this.inflect(e,this.rules.plurals,this.rules.irregular)},singularize:function(e){return this._singularize(e)},_singularize:function(e){return this.inflect(e,this.rules.singular,this.rules.irregularInverse)},inflect:function(e,n,s){var o,u,d,c,l,f,h,p,m,y,v,b,g;p=r.test(e);m=a.test(e);f="";if(p){return e}c=e.toLowerCase();l=t.exec(e)||i.exec(e);if(l){f=l[1];h=l[2].toLowerCase()}y=this.rules.uncountable[c]||this.rules.uncountable[h];if(y){return e}v=s&&(s[c]||s[h]);if(v){if(s[c]){return v}else{v=m?v.capitalize():v;return f+v}}for(var E=n.length,R=0;E>R;E--){o=n[E-1];g=o[0];if(g.test(e)){break}}o=o||[];g=o[0];u=o[1];d=e.replace(g,u);return d}};e["default"]=o});define("ember-inflector/system/string",["./inflector","exports"],function(e,r){"use strict";var t=e["default"];function i(e){return t.inflector.pluralize(e)}function a(e){return t.inflector.singularize(e)}r.pluralize=i;r.singularize=a});
@@ -49,7 +49,6 @@ define("activemodel-adapter/system/active_model_adapter",
49
49
  @module ember-data
50
50
  */
51
51
 
52
- var forEach = Ember.EnumerableUtils.forEach;
53
52
  var decamelize = Ember.String.decamelize,
54
53
  underscore = Ember.String.underscore;
55
54
 
@@ -59,7 +58,7 @@ define("activemodel-adapter/system/active_model_adapter",
59
58
  It has been designed to work out of the box with the
60
59
  [active_model_serializers](http://github.com/rails-api/active_model_serializers)
61
60
  Ruby gem. This Adapter expects specific settings using ActiveModel::Serializers,
62
- `embed :ids, include: true` which sideloads the records.
61
+ `embed :ids, embed_in_root: true` which sideloads the records.
63
62
 
64
63
  This adapter extends the DS.RESTAdapter by making consistent use of the camelization,
65
64
  decamelization and pluralization methods to normalize the serialized JSON into a
@@ -185,18 +184,7 @@ define("activemodel-adapter/system/active_model_adapter",
185
184
  var error = this._super(jqXHR);
186
185
 
187
186
  if (jqXHR && jqXHR.status === 422) {
188
- var response = Ember.$.parseJSON(jqXHR.responseText),
189
- errors = {};
190
-
191
- if (response.errors !== undefined) {
192
- var jsonErrors = response.errors;
193
-
194
- forEach(Ember.keys(jsonErrors), function(key) {
195
- errors[Ember.String.camelize(key)] = jsonErrors[key];
196
- });
197
- }
198
-
199
- return new InvalidError(errors);
187
+ return new InvalidError(Ember.$.parseJSON(jqXHR.responseText));
200
188
  } else {
201
189
  return error;
202
190
  }
@@ -227,7 +215,7 @@ define("activemodel-adapter/system/active_model_serializer",
227
215
  It has been designed to work out of the box with the
228
216
  [active_model_serializers](http://github.com/rails-api/active_model_serializers)
229
217
  Ruby gem. This Serializer expects specific settings using ActiveModel::Serializers,
230
- `embed :ids, include: true` which sideloads the records.
218
+ `embed :ids, embed_in_root: true` which sideloads the records.
231
219
 
232
220
  This serializer extends the DS.RESTSerializer by making consistent
233
221
  use of the camelization, decamelization and pluralization methods to
@@ -502,8 +490,8 @@ define("activemodel-adapter/system/active_model_serializer",
502
490
  __exports__["default"] = ActiveModelSerializer;
503
491
  });
504
492
  define("ember-data",
505
- ["ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],
506
- function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __exports__) {
493
+ ["ember-data/system/create","ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],
494
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __dependency22__, __exports__) {
507
495
  "use strict";
508
496
  /**
509
497
  Ember Data
@@ -515,43 +503,43 @@ define("ember-data",
515
503
  // support RSVP 2.x via resolve, but prefer RSVP 3.x's Promise.cast
516
504
  Ember.RSVP.Promise.cast = Ember.RSVP.Promise.cast || Ember.RSVP.resolve;
517
505
 
518
- var DS = __dependency1__["default"];
519
-
520
- var PromiseArray = __dependency3__.PromiseArray;
521
- var PromiseObject = __dependency3__.PromiseObject;
522
- var Store = __dependency4__.Store;
523
- var Model = __dependency5__.Model;
524
- var Errors = __dependency5__.Errors;
525
- var RootState = __dependency5__.RootState;
526
- var attr = __dependency5__.attr;
527
- var InvalidError = __dependency6__.InvalidError;
528
- var Adapter = __dependency6__.Adapter;
529
- var DebugAdapter = __dependency7__["default"];
530
- var RecordArray = __dependency8__.RecordArray;
531
- var FilteredRecordArray = __dependency8__.FilteredRecordArray;
532
- var AdapterPopulatedRecordArray = __dependency8__.AdapterPopulatedRecordArray;
533
- var ManyArray = __dependency8__.ManyArray;
534
- var RecordArrayManager = __dependency9__["default"];
535
- var RESTAdapter = __dependency10__.RESTAdapter;
536
- var FixtureAdapter = __dependency10__.FixtureAdapter;
537
- var JSONSerializer = __dependency11__["default"];
538
- var RESTSerializer = __dependency12__["default"];
539
- var EmbeddedRecordsMixin = __dependency14__["default"];
540
- var ActiveModelAdapter = __dependency15__.ActiveModelAdapter;
541
- var ActiveModelSerializer = __dependency15__.ActiveModelSerializer;
542
-
543
- var Transform = __dependency16__.Transform;
544
- var DateTransform = __dependency16__.DateTransform;
545
- var NumberTransform = __dependency16__.NumberTransform;
546
- var StringTransform = __dependency16__.StringTransform;
547
- var BooleanTransform = __dependency16__.BooleanTransform;
548
-
549
- var hasMany = __dependency17__.hasMany;
550
- var belongsTo = __dependency17__.belongsTo;
551
- var setupContainer = __dependency19__["default"];
552
-
553
- var ContainerProxy = __dependency20__["default"];
554
- var Relationship = __dependency21__.Relationship;
506
+ var DS = __dependency2__["default"];
507
+
508
+ var PromiseArray = __dependency4__.PromiseArray;
509
+ var PromiseObject = __dependency4__.PromiseObject;
510
+ var Store = __dependency5__.Store;
511
+ var Model = __dependency6__.Model;
512
+ var Errors = __dependency6__.Errors;
513
+ var RootState = __dependency6__.RootState;
514
+ var attr = __dependency6__.attr;
515
+ var InvalidError = __dependency7__.InvalidError;
516
+ var Adapter = __dependency7__.Adapter;
517
+ var DebugAdapter = __dependency8__["default"];
518
+ var RecordArray = __dependency9__.RecordArray;
519
+ var FilteredRecordArray = __dependency9__.FilteredRecordArray;
520
+ var AdapterPopulatedRecordArray = __dependency9__.AdapterPopulatedRecordArray;
521
+ var ManyArray = __dependency9__.ManyArray;
522
+ var RecordArrayManager = __dependency10__["default"];
523
+ var RESTAdapter = __dependency11__.RESTAdapter;
524
+ var FixtureAdapter = __dependency11__.FixtureAdapter;
525
+ var JSONSerializer = __dependency12__["default"];
526
+ var RESTSerializer = __dependency13__["default"];
527
+ var EmbeddedRecordsMixin = __dependency15__["default"];
528
+ var ActiveModelAdapter = __dependency16__.ActiveModelAdapter;
529
+ var ActiveModelSerializer = __dependency16__.ActiveModelSerializer;
530
+
531
+ var Transform = __dependency17__.Transform;
532
+ var DateTransform = __dependency17__.DateTransform;
533
+ var NumberTransform = __dependency17__.NumberTransform;
534
+ var StringTransform = __dependency17__.StringTransform;
535
+ var BooleanTransform = __dependency17__.BooleanTransform;
536
+
537
+ var hasMany = __dependency18__.hasMany;
538
+ var belongsTo = __dependency18__.belongsTo;
539
+ var setupContainer = __dependency20__["default"];
540
+
541
+ var ContainerProxy = __dependency21__["default"];
542
+ var Relationship = __dependency22__.Relationship;
555
543
 
556
544
  DS.Store = Store;
557
545
  DS.PromiseArray = PromiseArray;
@@ -1544,7 +1532,7 @@ define("ember-data/adapters/rest_adapter",
1544
1532
  },
1545
1533
 
1546
1534
  _stripIDFromURL: function(store, record) {
1547
- var type = store.modelFor(record);
1535
+ var type = record.constructor;
1548
1536
  var url = this.buildURL(type.typeKey, record.get('id'), record);
1549
1537
 
1550
1538
  var expandedURL = url.split('/');
@@ -1561,6 +1549,11 @@ define("ember-data/adapters/rest_adapter",
1561
1549
  return expandedURL.join('/');
1562
1550
  },
1563
1551
 
1552
+ /**
1553
+ http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
1554
+ */
1555
+ maxUrlLength: 2048,
1556
+
1564
1557
  /**
1565
1558
  Organize records into groups, each of which is to be passed to separate
1566
1559
  calls to `findMany`.
@@ -1578,6 +1571,7 @@ define("ember-data/adapters/rest_adapter",
1578
1571
  and `/posts/2/comments/3`
1579
1572
 
1580
1573
  @method groupRecordsForFindMany
1574
+ @param {DS.Store} store
1581
1575
  @param {Array} records
1582
1576
  @return {Array} an array of arrays of records, each of which is to be
1583
1577
  loaded separately by `findMany`.
@@ -1585,19 +1579,20 @@ define("ember-data/adapters/rest_adapter",
1585
1579
  groupRecordsForFindMany: function (store, records) {
1586
1580
  var groups = MapWithDefault.create({defaultValue: function(){return [];}});
1587
1581
  var adapter = this;
1582
+ var maxUrlLength = this.maxUrlLength;
1588
1583
 
1589
1584
  forEach.call(records, function(record){
1590
1585
  var baseUrl = adapter._stripIDFromURL(store, record);
1591
1586
  groups.get(baseUrl).push(record);
1592
1587
  });
1593
1588
 
1594
- function splitGroupToFitInUrl(group, maxUrlLength) {
1589
+ function splitGroupToFitInUrl(group, maxUrlLength, paramNameLength) {
1595
1590
  var baseUrl = adapter._stripIDFromURL(store, group[0]);
1596
1591
  var idsSize = 0;
1597
1592
  var splitGroups = [[]];
1598
1593
 
1599
1594
  forEach.call(group, function(record) {
1600
- var additionalLength = '&ids[]='.length + record.get('id.length');
1595
+ var additionalLength = encodeURIComponent(record.get('id')).length + paramNameLength;
1601
1596
  if (baseUrl.length + idsSize + additionalLength >= maxUrlLength) {
1602
1597
  idsSize = 0;
1603
1598
  splitGroups.push([]);
@@ -1614,9 +1609,8 @@ define("ember-data/adapters/rest_adapter",
1614
1609
 
1615
1610
  var groupsArray = [];
1616
1611
  groups.forEach(function(group, key){
1617
- // http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
1618
- var maxUrlLength = 2048;
1619
- var splitGroups = splitGroupToFitInUrl(group, maxUrlLength);
1612
+ var paramNameLength = '&ids%5B%5D='.length;
1613
+ var splitGroups = splitGroupToFitInUrl(group, maxUrlLength, paramNameLength);
1620
1614
 
1621
1615
  forEach.call(splitGroups, function(splitGroup) {
1622
1616
  groupsArray.push(splitGroup);
@@ -1656,19 +1650,25 @@ define("ember-data/adapters/rest_adapter",
1656
1650
  },
1657
1651
 
1658
1652
  /**
1659
- Takes an ajax response, and returns a relevant error.
1653
+ Takes an ajax response, and returns an error payload.
1660
1654
 
1661
1655
  Returning a `DS.InvalidError` from this method will cause the
1662
1656
  record to transition into the `invalid` state and make the
1663
1657
  `errors` object available on the record.
1664
1658
 
1659
+ This function should return the entire payload as received from the
1660
+ server. Error object extraction and normalization of model errors
1661
+ should be performed by `extractErrors` on the serializer.
1662
+
1663
+ Example
1664
+
1665
1665
  ```javascript
1666
1666
  App.ApplicationAdapter = DS.RESTAdapter.extend({
1667
1667
  ajaxError: function(jqXHR) {
1668
1668
  var error = this._super(jqXHR);
1669
1669
 
1670
1670
  if (jqXHR && jqXHR.status === 422) {
1671
- var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"];
1671
+ var jsonErrors = Ember.$.parseJSON(jqXHR.responseText);
1672
1672
 
1673
1673
  return new DS.InvalidError(jsonErrors);
1674
1674
  } else {
@@ -1712,12 +1712,12 @@ define("ember-data/adapters/rest_adapter",
1712
1712
  2. Your API might return errors as successful responses with status code
1713
1713
  200 and an Errors text or object. You can return a DS.InvalidError from
1714
1714
  this hook and it will automatically reject the promise and put your record
1715
- into the invald state.
1715
+ into the invalid state.
1716
1716
 
1717
- @method ajaxError
1717
+ @method ajaxSuccess
1718
1718
  @param {Object} jqXHR
1719
1719
  @param {Object} jsonPayload
1720
- @return {Object} jqXHR
1720
+ @return {Object} jsonPayload
1721
1721
  */
1722
1722
 
1723
1723
  ajaxSuccess: function(jqXHR, jsonPayload) {
@@ -1832,11 +1832,11 @@ define("ember-data/core",
1832
1832
  /**
1833
1833
  @property VERSION
1834
1834
  @type String
1835
- @default '1.0.0-beta.11'
1835
+ @default '1.0.0-beta.12'
1836
1836
  @static
1837
1837
  */
1838
1838
  DS = Ember.Namespace.create({
1839
- VERSION: '1.0.0-beta.11'
1839
+ VERSION: '1.0.0-beta.12'
1840
1840
  });
1841
1841
 
1842
1842
  if (Ember.libraries) {
@@ -2841,6 +2841,16 @@ define("ember-data/serializers/json_serializer",
2841
2841
  delete hash[primaryKey];
2842
2842
  },
2843
2843
 
2844
+ /**
2845
+ @method normalizeErrors
2846
+ @private
2847
+ */
2848
+ normalizeErrors: function(type, hash) {
2849
+ this.normalizeId(hash);
2850
+ this.normalizeAttributes(type, hash);
2851
+ this.normalizeRelationships(type, hash);
2852
+ },
2853
+
2844
2854
  /**
2845
2855
  Looks up the property key that was set by the custom `attr` mapping
2846
2856
  passed to the serializer.
@@ -3551,6 +3561,41 @@ define("ember-data/serializers/json_serializer",
3551
3561
  }
3552
3562
  },
3553
3563
 
3564
+ /**
3565
+ `extractErrors` is used to extract model errors when a call is made
3566
+ to `DS.Model#save` which fails with an InvalidError`. By default
3567
+ Ember Data expects error information to be located on the `errors`
3568
+ property of the payload object.
3569
+
3570
+ Example
3571
+
3572
+ ```javascript
3573
+ App.PostSerializer = DS.JSONSerializer.extend({
3574
+ extractErrors: function(store, type, payload, id) {
3575
+ if (payload && typeof payload === 'object' && payload._problems) {
3576
+ payload = payload._problems;
3577
+ this.normalizeErrors(type, payload);
3578
+ }
3579
+ return payload;
3580
+ }
3581
+ });
3582
+ ```
3583
+
3584
+ @method extractErrors
3585
+ @param {DS.Store} store
3586
+ @param {subclass of DS.Model} type
3587
+ @param {Object} payload
3588
+ @param {String or Number} id
3589
+ @return {Object} json The deserialized errors
3590
+ */
3591
+ extractErrors: function(store, type, payload, id) {
3592
+ if (payload && typeof payload === 'object' && payload.errors) {
3593
+ payload = payload.errors;
3594
+ this.normalizeErrors(type, payload);
3595
+ }
3596
+ return payload;
3597
+ },
3598
+
3554
3599
  /**
3555
3600
  `keyForAttribute` can be used to define rules for how to convert an
3556
3601
  attribute name in your model to a key in your JSON.
@@ -3886,6 +3931,7 @@ define("ember-data/serializers/rest_serializer",
3886
3931
 
3887
3932
  for (var prop in payload) {
3888
3933
  var typeName = this.typeForRoot(prop);
3934
+
3889
3935
  if (!store.modelFactoryFor(typeName)){
3890
3936
  continue;
3891
3937
  }
@@ -3893,6 +3939,10 @@ define("ember-data/serializers/rest_serializer",
3893
3939
  var isPrimary = type.typeKey === primaryTypeName;
3894
3940
  var value = payload[prop];
3895
3941
 
3942
+ if (value === null) {
3943
+ continue;
3944
+ }
3945
+
3896
3946
  // legacy support for singular resources
3897
3947
  if (isPrimary && Ember.typeOf(value) !== "array" ) {
3898
3948
  primaryRecord = this.normalize(primaryType, value, prop);
@@ -4413,6 +4463,10 @@ define("ember-data/system/adapter",
4413
4463
  transition to the `invalid` state and the errors will be set to the
4414
4464
  `errors` property on the record.
4415
4465
 
4466
+ This function should return the entire payload as received from the
4467
+ server. Error object extraction and normalization of model errors
4468
+ should be performed by `extractErrors` on the serializer.
4469
+
4416
4470
  Example
4417
4471
 
4418
4472
  ```javascript
@@ -4421,7 +4475,7 @@ define("ember-data/system/adapter",
4421
4475
  var error = this._super(jqXHR);
4422
4476
 
4423
4477
  if (jqXHR && jqXHR.status === 422) {
4424
- var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"];
4478
+ var jsonErrors = Ember.$.parseJSON(jqXHR.responseText);
4425
4479
  return new DS.InvalidError(jsonErrors);
4426
4480
  } else {
4427
4481
  return error;
@@ -4437,7 +4491,7 @@ define("ember-data/system/adapter",
4437
4491
  ```javascript
4438
4492
  return new DS.InvalidError({
4439
4493
  length: 'Must be less than 15',
4440
- name: 'Must not be blank
4494
+ name: 'Must not be blank'
4441
4495
  });
4442
4496
  ```
4443
4497
 
@@ -4836,6 +4890,7 @@ define("ember-data/system/adapter",
4836
4890
  The default implementation returns the records as a single group.
4837
4891
 
4838
4892
  @method groupRecordsForFindMany
4893
+ @param {DS.Store} store
4839
4894
  @param {Array} records
4840
4895
  @return {Array} an array of arrays of records, each of which is to be
4841
4896
  loaded separately by `findMany`.
@@ -4902,6 +4957,20 @@ define("ember-data/system/container_proxy",
4902
4957
 
4903
4958
  __exports__["default"] = ContainerProxy;
4904
4959
  });
4960
+ define("ember-data/system/create",
4961
+ [],
4962
+ function() {
4963
+ "use strict";
4964
+ /*
4965
+ Detect if the user has a correct Object.create shim.
4966
+ Ember has provided this for a long time but has had an incorrect shim before 1.8
4967
+ TODO: Remove for Ember Data 1.0.
4968
+ */
4969
+ var object = Ember.create(null);
4970
+ if (object.toString !== undefined && Ember.keys(Ember.create({}))[0] === '__proto__'){
4971
+ throw new Error("Ember Data requires a correct Object.create shim. You should upgrade to Ember >= 1.8 which provides one for you. If you are using ES5-shim, you should try removing that after upgrading Ember.");
4972
+ }
4973
+ });
4905
4974
  define("ember-data/system/debug",
4906
4975
  ["ember-data/system/debug/debug_info","ember-data/system/debug/debug_adapter","exports"],
4907
4976
  function(__dependency1__, __dependency2__, __exports__) {
@@ -5142,9 +5211,9 @@ define("ember-data/system/map",
5142
5211
  usesOldBehavior = value === 'key' && key === 'value';
5143
5212
  });
5144
5213
 
5145
- Map.prototype = Object.create(Ember.Map.prototype);
5146
- MapWithDefault.prototype = Object.create(Ember.MapWithDefault.prototype);
5147
- OrderedSet.prototype = Object.create(Ember.OrderedSet.prototype);
5214
+ Map.prototype = Ember.create(Ember.Map.prototype);
5215
+ MapWithDefault.prototype = Ember.create(Ember.MapWithDefault.prototype);
5216
+ OrderedSet.prototype = Ember.create(Ember.OrderedSet.prototype);
5148
5217
 
5149
5218
  OrderedSet.create = function(){
5150
5219
  return new OrderedSet();
@@ -5503,7 +5572,7 @@ define("ember-data/system/model/attributes",
5503
5572
  options: options
5504
5573
  };
5505
5574
 
5506
- return Ember.computed('data', function(key, value) {
5575
+ return Ember.computed(function(key, value) {
5507
5576
  if (arguments.length > 1) {
5508
5577
  var oldValue = getValue(this, key);
5509
5578
 
@@ -5554,7 +5623,7 @@ define("ember-data/system/model/errors",
5554
5623
  `DS.Errors`. This can be used to display validation error
5555
5624
  messages returned from the server when a `record.save()` rejects.
5556
5625
  This works automatically with `DS.ActiveModelAdapter`, but you
5557
- can implement [ajaxError](api/data/classes/DS.RESTAdapter.html#method_ajaxError)
5626
+ can implement [ajaxError](/api/data/classes/DS.RESTAdapter.html#method_ajaxError)
5558
5627
  in other adapters as well.
5559
5628
 
5560
5629
  For Example, if you had an `User` model that looked like this:
@@ -5905,8 +5974,8 @@ define("ember-data/system/model/model",
5905
5974
  return get(get(this, 'currentState'), key);
5906
5975
  }).readOnly();
5907
5976
 
5908
- var _extractPivotNameCache = Object.create(null);
5909
- var _splitOnDotCache = Object.create(null);
5977
+ var _extractPivotNameCache = Ember.create(null);
5978
+ var _splitOnDotCache = Ember.create(null);
5910
5979
 
5911
5980
  function splitOnDot(name) {
5912
5981
  return _splitOnDotCache[name] || (
@@ -6351,7 +6420,7 @@ define("ember-data/system/model/model",
6351
6420
  would have a implicit post relationship in order to be do things like remove ourselves from the post
6352
6421
  when we are deleted
6353
6422
  */
6354
- this._implicitRelationships = Object.create(null);
6423
+ this._implicitRelationships = Ember.create(null);
6355
6424
  var model = this;
6356
6425
  //TODO Move into a getter for better perf
6357
6426
  this.constructor.eachRelationship(function(key, descriptor) {
@@ -6644,6 +6713,20 @@ define("ember-data/system/model/model",
6644
6713
  return value;
6645
6714
  },
6646
6715
 
6716
+ /**
6717
+ @method _notifyProperties
6718
+ @private
6719
+ */
6720
+ _notifyProperties: function(keys) {
6721
+ Ember.beginPropertyChanges();
6722
+ var key;
6723
+ for (var i = 0, length = keys.length; i < length; i++){
6724
+ key = keys[i];
6725
+ this.notifyPropertyChange(key);
6726
+ }
6727
+ Ember.endPropertyChanges();
6728
+ },
6729
+
6647
6730
  /**
6648
6731
  Returns an object, whose keys are changed properties, and value is
6649
6732
  an [oldProp, newProp] array.
@@ -6709,7 +6792,7 @@ define("ember-data/system/model/model",
6709
6792
 
6710
6793
  if (!data) { return; }
6711
6794
 
6712
- this.notifyPropertyChange('data');
6795
+ this._notifyProperties(Ember.keys(data));
6713
6796
  },
6714
6797
 
6715
6798
  /**
@@ -6742,15 +6825,16 @@ define("ember-data/system/model/model",
6742
6825
  the existing data, not replace it.
6743
6826
  */
6744
6827
  setupData: function(data, partial) {
6828
+
6745
6829
  if (partial) {
6746
6830
  Ember.merge(this._data, data);
6747
6831
  } else {
6748
6832
  this._data = data;
6749
6833
  }
6750
6834
 
6751
- if (data) { this.pushedData(); }
6835
+ this.pushedData();
6752
6836
 
6753
- this.notifyPropertyChange('data');
6837
+ this._notifyProperties(Ember.keys(data));
6754
6838
  },
6755
6839
 
6756
6840
  materializeId: function(id) {
@@ -6796,13 +6880,18 @@ define("ember-data/system/model/model",
6796
6880
  this.reconnectRelationships();
6797
6881
  }
6798
6882
 
6883
+ if (get(this, 'isNew')) {
6884
+ this.clearRelationships();
6885
+ }
6886
+
6799
6887
  if (!get(this, 'isValid')) {
6800
6888
  this._inFlightAttributes = {};
6801
6889
  }
6802
6890
 
6803
6891
  this.send('rolledBack');
6804
6892
 
6805
- this.notifyPropertyChange('data');
6893
+ this._notifyProperties(Ember.keys(this._data));
6894
+
6806
6895
  },
6807
6896
 
6808
6897
  toStringExtension: function() {
@@ -6853,7 +6942,9 @@ define("ember-data/system/model/model",
6853
6942
  App.ModelViewRoute = Ember.Route.extend({
6854
6943
  actions: {
6855
6944
  reload: function() {
6856
- this.controller.get('model').reload();
6945
+ this.controller.get('model').reload().then(function(model) {
6946
+ // do something with the reloaded model
6947
+ });
6857
6948
  }
6858
6949
  }
6859
6950
  });
@@ -7821,13 +7912,38 @@ define("ember-data/system/promise_proxies",
7821
7912
  to the underlying manyArray.
7822
7913
  Right now we proxy:
7823
7914
  `reload()`
7915
+ `createRecord()`
7916
+ `on()`
7917
+ `one()`
7918
+ `trigger()`
7919
+ `off()`
7920
+ `has()`
7824
7921
  */
7825
7922
 
7923
+ function proxyToContent(method) {
7924
+ return function() {
7925
+ var content = get(this, 'content');
7926
+ return content[method].apply(content, arguments);
7927
+ };
7928
+ }
7929
+
7826
7930
  var PromiseManyArray = PromiseArray.extend({
7827
7931
  reload: function() {
7828
7932
  //I don't think this should ever happen right now, but worth guarding if we refactor the async relationships
7829
7933
  return get(this, 'content').reload();
7830
- }
7934
+ },
7935
+
7936
+ createRecord: proxyToContent('createRecord'),
7937
+
7938
+ on: proxyToContent('on'),
7939
+
7940
+ one: proxyToContent('one'),
7941
+
7942
+ trigger: proxyToContent('trigger'),
7943
+
7944
+ off: proxyToContent('off'),
7945
+
7946
+ has: proxyToContent('has')
7831
7947
  });
7832
7948
 
7833
7949
  var promiseManyArray = function(promise, label) {
@@ -7860,6 +7976,7 @@ define("ember-data/system/record_array_manager",
7860
7976
  var OrderedSet = __dependency2__.OrderedSet;
7861
7977
  var get = Ember.get;
7862
7978
  var forEach = Ember.EnumerableUtils.forEach;
7979
+ var indexOf = Ember.EnumerableUtils.indexOf;
7863
7980
 
7864
7981
  /**
7865
7982
  @class RecordArrayManager
@@ -8112,6 +8229,19 @@ define("ember-data/system/record_array_manager",
8112
8229
  this.updateFilter(array, type, filter);
8113
8230
  },
8114
8231
 
8232
+ /**
8233
+ Unregister a FilteredRecordArray.
8234
+ So manager will not update this array.
8235
+
8236
+ @method unregisterFilteredRecordArray
8237
+ @param {DS.RecordArray} array
8238
+ */
8239
+ unregisterFilteredRecordArray: function(array) {
8240
+ var recordArrays = this.filteredRecordArrays.get(array.type);
8241
+ var index = indexOf(recordArrays, array);
8242
+ recordArrays.splice(index, 1);
8243
+ },
8244
+
8115
8245
  // Internally, we maintain a map of all unloaded IDs requested by
8116
8246
  // a ManyArray. As the adapter loads data into the store, the
8117
8247
  // store notifies any interested ManyArrays. When the ManyArray's
@@ -8187,7 +8317,7 @@ define("ember-data/system/record_arrays/adapter_populated_record_array",
8187
8317
  var get = Ember.get;
8188
8318
 
8189
8319
  function cloneNull(source) {
8190
- var clone = Object.create(null);
8320
+ var clone = Ember.create(null);
8191
8321
  for (var key in source) {
8192
8322
  clone[key] = source[key];
8193
8323
  }
@@ -8306,7 +8436,20 @@ define("ember-data/system/record_arrays/filtered_record_array",
8306
8436
 
8307
8437
  updateFilter: Ember.observer(function() {
8308
8438
  Ember.run.once(this, this._updateFilter);
8309
- }, 'filterFunction')
8439
+ }, 'filterFunction'),
8440
+
8441
+ /**
8442
+ @method _unregisterFromManager
8443
+ @private
8444
+ */
8445
+ _unregisterFromManager: function(){
8446
+ this.manager.unregisterFilteredRecordArray(this);
8447
+ },
8448
+
8449
+ willDestroy: function(){
8450
+ this._unregisterFromManager();
8451
+ this._super();
8452
+ }
8310
8453
  });
8311
8454
  });
8312
8455
  define("ember-data/system/record_arrays/many_array",
@@ -8370,17 +8513,19 @@ define("ember-data/system/record_arrays/many_array",
8370
8513
  */
8371
8514
  isPolymorphic: false,
8372
8515
 
8373
- // LOADING STATE
8516
+ /**
8517
+ The loading state of this array
8374
8518
 
8519
+ @property {Boolean} isLoaded
8520
+ */
8375
8521
  isLoaded: false,
8376
8522
 
8377
8523
  /**
8378
8524
  The relationship which manages this array.
8379
8525
 
8380
- @property {DS.Model} owner
8526
+ @property {ManyRelationship} relationship
8381
8527
  @private
8382
8528
  */
8383
-
8384
8529
  relationship: null,
8385
8530
 
8386
8531
 
@@ -8446,7 +8591,7 @@ define("ember-data/system/record_arrays/many_array",
8446
8591
  var record;
8447
8592
 
8448
8593
 
8449
- record = store.createRecord.call(store, type, hash);
8594
+ record = store.createRecord(type, hash);
8450
8595
  this.pushObject(record);
8451
8596
 
8452
8597
  return record;
@@ -8928,10 +9073,10 @@ define("ember-data/system/relationships/ext",
8928
9073
  },
8929
9074
 
8930
9075
  inverseMap: Ember.computed(function() {
8931
- return Object.create(null);
9076
+ return Ember.create(null);
8932
9077
  }),
8933
9078
 
8934
- /*
9079
+ /**
8935
9080
  Find the relationship which is the inverse of the one asked for.
8936
9081
 
8937
9082
  For example, if you define models like this:
@@ -9259,7 +9404,7 @@ define("ember-data/system/relationships/ext",
9259
9404
  });
9260
9405
 
9261
9406
  var fields = Ember.get(App.Blog, 'fields');
9262
- fields.forEach(function(field, kind) {
9407
+ fields.forEach(function(kind, field) {
9263
9408
  console.log(field, kind);
9264
9409
  });
9265
9410
 
@@ -9517,7 +9662,6 @@ define("ember-data/system/relationships/relationship",
9517
9662
  this.key = relationshipMeta.key;
9518
9663
  this.inverseKey = inverseKey;
9519
9664
  this.record = record;
9520
- this.key = relationshipMeta.key;
9521
9665
  this.isAsync = relationshipMeta.options.async;
9522
9666
  this.relationshipMeta = relationshipMeta;
9523
9667
  //This probably breaks for polymorphic relationship in complex scenarios, due to
@@ -9551,20 +9695,24 @@ define("ember-data/system/relationships/relationship",
9551
9695
  },
9552
9696
 
9553
9697
  removeRecords: function(records){
9554
- var that = this;
9555
- records.forEach(function(record){
9556
- that.removeRecord(record);
9557
- });
9698
+ var length = Ember.get(records, 'length');
9699
+ var record;
9700
+ for (var i = 0; i < length; i++){
9701
+ record = records[i];
9702
+ this.removeRecord(record);
9703
+ }
9558
9704
  },
9559
9705
 
9560
9706
  addRecords: function(records, idx){
9561
- var that = this;
9562
- records.forEach(function(record){
9563
- that.addRecord(record, idx);
9707
+ var length = Ember.get(records, 'length');
9708
+ var record;
9709
+ for (var i = 0; i < length; i++){
9710
+ record = records[i];
9711
+ this.addRecord(record, idx);
9564
9712
  if (idx !== undefined) {
9565
9713
  idx++;
9566
9714
  }
9567
- });
9715
+ }
9568
9716
  },
9569
9717
 
9570
9718
  addRecord: function(record, idx) {
@@ -9617,7 +9765,7 @@ define("ember-data/system/relationships/relationship",
9617
9765
  },
9618
9766
 
9619
9767
  updateLink: function(link) {
9620
- if (link !== this.link) {
9768
+ if (link !== this.link) {
9621
9769
  this.link = link;
9622
9770
  this.linkPromise = null;
9623
9771
  this.record.notifyPropertyChange(this.key);
@@ -9654,7 +9802,7 @@ define("ember-data/system/relationships/relationship",
9654
9802
  this.manyArray.isPolymorphic = this.isPolymorphic;
9655
9803
  };
9656
9804
 
9657
- ManyRelationship.prototype = Object.create(Relationship.prototype);
9805
+ ManyRelationship.prototype = Ember.create(Relationship.prototype);
9658
9806
  ManyRelationship.prototype.constructor = ManyRelationship;
9659
9807
  ManyRelationship.prototype._super$constructor = Relationship;
9660
9808
 
@@ -9752,7 +9900,9 @@ define("ember-data/system/relationships/relationship",
9752
9900
  });
9753
9901
  } else {
9754
9902
 
9755
- this.manyArray.set('isLoaded', true);
9903
+ if (!this.manyArray.get('isDestroyed')) {
9904
+ this.manyArray.set('isLoaded', true);
9905
+ }
9756
9906
  return this.manyArray;
9757
9907
  }
9758
9908
  };
@@ -9764,7 +9914,7 @@ define("ember-data/system/relationships/relationship",
9764
9914
  this.inverseRecord = null;
9765
9915
  };
9766
9916
 
9767
- BelongsToRelationship.prototype = Object.create(Relationship.prototype);
9917
+ BelongsToRelationship.prototype = Ember.create(Relationship.prototype);
9768
9918
  BelongsToRelationship.prototype.constructor = BelongsToRelationship;
9769
9919
  BelongsToRelationship.prototype._super$constructor = Relationship;
9770
9920
 
@@ -9804,9 +9954,9 @@ define("ember-data/system/relationships/relationship",
9804
9954
 
9805
9955
  BelongsToRelationship.prototype._super$removeRecordFromOwn = Relationship.prototype.removeRecordFromOwn;
9806
9956
  BelongsToRelationship.prototype.removeRecordFromOwn = function(record) {
9807
- if (!this.members.has(record)){ return;}
9808
- this._super$removeRecordFromOwn(record);
9957
+ if (!this.members.has(record)) { return; }
9809
9958
  this.inverseRecord = null;
9959
+ this._super$removeRecordFromOwn(record);
9810
9960
  };
9811
9961
 
9812
9962
  BelongsToRelationship.prototype.findRecord = function() {
@@ -9820,7 +9970,9 @@ define("ember-data/system/relationships/relationship",
9820
9970
  BelongsToRelationship.prototype.fetchLink = function() {
9821
9971
  var self = this;
9822
9972
  return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function(record){
9823
- self.addRecord(record);
9973
+ if (record) {
9974
+ self.addRecord(record);
9975
+ }
9824
9976
  return record;
9825
9977
  });
9826
9978
  };
@@ -9961,14 +10113,6 @@ define("ember-data/system/store",
9961
10113
  });
9962
10114
  ```
9963
10115
 
9964
- If your application has multiple `DS.Store` instances (an unusual case), you can
9965
- specify which store should be used:
9966
-
9967
- ```javascript
9968
- store.find('person', 123).then(function (person) {
9969
- });
9970
- ```
9971
-
9972
10116
  By default, the store will talk to your backend using a standard
9973
10117
  REST mechanism. You can customize how the store talks to your
9974
10118
  backend by specifying a custom adapter:
@@ -10308,6 +10452,25 @@ define("ember-data/system/store",
10308
10452
  return this.findById(type, coerceId(id), preload);
10309
10453
  },
10310
10454
 
10455
+ /**
10456
+ This method returns a fresh record for a given type and id combination.
10457
+
10458
+ If a record is available for the given type/id combination, then it will fetch this record from the store then reload it. If there's no record corresponding in the store it will simply call store.find.
10459
+
10460
+ @method fetch
10461
+ @param {String or subclass of DS.Model} type
10462
+ @param {Object|String|Integer|null} id
10463
+ @param {Object} preload - optional set of attributes and relationships passed in either as IDs or as actual models
10464
+ @return {Promise} promise
10465
+ */
10466
+ fetch: function(type, id, preload) {
10467
+ if (this.hasRecordForId(type, id)) {
10468
+ return this.getById(type, id).reload();
10469
+ } else {
10470
+ return this.find(type, id, preload);
10471
+ }
10472
+ },
10473
+
10311
10474
  /**
10312
10475
  This method returns a record for a given type and id combination.
10313
10476
 
@@ -10382,7 +10545,7 @@ define("ember-data/system/store",
10382
10545
  },
10383
10546
 
10384
10547
  scheduleFetchMany: function(records) {
10385
- return Ember.RSVP.all(map(records, this.scheduleFetch, this));
10548
+ return Promise.all(map(records, this.scheduleFetch, this));
10386
10549
  },
10387
10550
 
10388
10551
  scheduleFetch: function(record) {
@@ -10581,7 +10744,7 @@ define("ember-data/system/store",
10581
10744
  */
10582
10745
  findMany: function(records) {
10583
10746
  var store = this;
10584
- return Promise.all( map(records, function(record) {
10747
+ return Promise.all(map(records, function(record) {
10585
10748
  return store._findByRecord(record);
10586
10749
  }));
10587
10750
  },
@@ -10698,14 +10861,17 @@ define("ember-data/system/store",
10698
10861
  },
10699
10862
 
10700
10863
  /**
10701
- This method returns a filtered array that contains all of the known records
10702
- for a given type.
10864
+ This method returns a filtered array that contains all of the
10865
+ known records for a given type in the store.
10703
10866
 
10704
- Note that because it's just a filter, it will have any locally
10705
- created records of the type.
10867
+ Note that because it's just a filter, the result will contain any
10868
+ locally created records of the type, however, it will not make a
10869
+ request to the backend to retrieve additional records. If you
10870
+ would like to request all the records from the backend please use
10871
+ [store.find](#method_find).
10706
10872
 
10707
10873
  Also note that multiple calls to `all` for a given type will always
10708
- return the same RecordArray.
10874
+ return the same `RecordArray`.
10709
10875
 
10710
10876
  Example
10711
10877
 
@@ -10761,10 +10927,18 @@ define("ember-data/system/store",
10761
10927
  remains up to date as new records are loaded into the store or created
10762
10928
  locally.
10763
10929
 
10764
- The callback function takes a materialized record, and returns true
10930
+ The filter function takes a materialized record, and returns true
10765
10931
  if the record should be included in the filter and false if it should
10766
10932
  not.
10767
10933
 
10934
+ Example
10935
+
10936
+ ```javascript
10937
+ store.filter('post', function(post) {
10938
+ return post.get('unread');
10939
+ });
10940
+ ```
10941
+
10768
10942
  The filter function is called once on all records for the type when
10769
10943
  it is created, and then once on each newly loaded or created record.
10770
10944
 
@@ -10772,14 +10946,19 @@ define("ember-data/system/store",
10772
10946
  filter function will be invoked again to determine whether it should
10773
10947
  still be in the array.
10774
10948
 
10775
- Optionally you can pass a query which will be triggered at first. The
10776
- results returned by the server could then appear in the filter if they
10777
- match the filter function.
10949
+ Optionally you can pass a query, which is the equivalent of calling
10950
+ [find](#method_find) with that same query, to fetch additional records
10951
+ from the server. The results returned by the server could then appear
10952
+ in the filter if they match the filter function.
10953
+
10954
+ The query itself is not used to filter records, it's only sent to your
10955
+ server for you to be able to do server-side filtering. The filter
10956
+ function will be applied on the returned results regardless.
10778
10957
 
10779
10958
  Example
10780
10959
 
10781
10960
  ```javascript
10782
- store.filter('post', {unread: true}, function(post) {
10961
+ store.filter('post', { unread: true }, function(post) {
10783
10962
  return post.get('unread');
10784
10963
  }).then(function(unreadPosts) {
10785
10964
  unreadPosts.get('length'); // 5
@@ -11022,9 +11201,9 @@ define("ember-data/system/store",
11022
11201
  if (typeMap) { return typeMap; }
11023
11202
 
11024
11203
  typeMap = {
11025
- idToRecord: Object.create(null),
11204
+ idToRecord: Ember.create(null),
11026
11205
  records: [],
11027
- metadata: Object.create(null),
11206
+ metadata: Ember.create(null),
11028
11207
  type: type
11029
11208
  };
11030
11209
 
@@ -11158,6 +11337,7 @@ define("ember-data/system/store",
11158
11337
  // merged into the existing data, not replace it.
11159
11338
 
11160
11339
  var type = this.modelFor(typeName);
11340
+ var filter = Ember.EnumerableUtils.filter;
11161
11341
 
11162
11342
  // If the payload contains relationships that are specified as
11163
11343
  // IDs, normalizeRelationships will convert them into DS.Model instances
@@ -11166,6 +11346,7 @@ define("ember-data/system/store",
11166
11346
 
11167
11347
  data = normalizeRelationships(this, type, data);
11168
11348
 
11349
+
11169
11350
  // Actually load the record into the store.
11170
11351
 
11171
11352
  this._load(type, data, _partial);
@@ -11295,7 +11476,6 @@ define("ember-data/system/store",
11295
11476
  @return {DS.Model} the record that was updated.
11296
11477
  */
11297
11478
  update: function(type, data) {
11298
-
11299
11479
  return this.push(type, data, true);
11300
11480
  },
11301
11481
 
@@ -11500,7 +11680,7 @@ define("ember-data/system/store",
11500
11680
  if (isNone(id) || id instanceof Model) {
11501
11681
  return;
11502
11682
  }
11503
-
11683
+
11504
11684
  var type;
11505
11685
 
11506
11686
  if (typeof id === 'number' || typeof id === 'string') {
@@ -11521,10 +11701,11 @@ define("ember-data/system/store",
11521
11701
  }
11522
11702
 
11523
11703
  function deserializeRecordIds(store, data, key, relationship, ids) {
11524
- if (!Ember.isArray(ids)) {
11704
+ if (isNone(ids)) {
11525
11705
  return;
11526
11706
  }
11527
- for (var i=0, l=ids.length; i<l; i++) {
11707
+
11708
+ for (var i=0, l=ids.length; i<l; i++) {
11528
11709
  deserializeRecordId(store, ids, i, relationship, ids[i]);
11529
11710
  }
11530
11711
  }
@@ -11655,6 +11836,11 @@ define("ember-data/system/store",
11655
11836
 
11656
11837
  return promise.then(function(adapterPayload) {
11657
11838
  var payload = serializer.extract(store, relationship.type, adapterPayload, null, 'findBelongsTo');
11839
+
11840
+ if (!payload) {
11841
+ return null;
11842
+ }
11843
+
11658
11844
  var record = store.push(relationship.type, payload);
11659
11845
  return record;
11660
11846
  }, null, "DS: Extract payload of " + record + " : " + relationship.type);
@@ -11719,7 +11905,9 @@ define("ember-data/system/store",
11719
11905
  return record;
11720
11906
  }, function(reason) {
11721
11907
  if (reason instanceof InvalidError) {
11722
- store.recordWasInvalid(record, reason.errors);
11908
+ var errors = serializer.extractErrors(store, type, reason.errors, get(record, 'id'));
11909
+ store.recordWasInvalid(record, errors);
11910
+ reason = new InvalidError(errors);
11723
11911
  } else {
11724
11912
  store.recordWasError(record, reason);
11725
11913
  }
@@ -11945,7 +12133,6 @@ define("ember-data/transforms/date",
11945
12133
  }
11946
12134
 
11947
12135
  __exports__["default"] = Transform.extend({
11948
-
11949
12136
  deserialize: function(serialized) {
11950
12137
  var type = typeof serialized;
11951
12138