ember-data-source 1.0.0.beta.10 → 1.0.0.beta.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/ember-data.js +571 -155
- data/dist/ember-data.min.js +3 -3
- data/dist/ember-data.named-amd.js +555 -155
- data/dist/ember-data.named-amd.min.js +3 -3
- data/dist/ember-data.named-amd.prod.js +540 -155
- data/dist/ember-data.prod.js +556 -155
- data/package.json +2 -2
- metadata +2 -2
@@ -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,E,R){"use strict";Ember.RSVP.Promise.cast=Ember.RSVP.Promise.cast||Ember.RSVP.resolve;var A=e["default"];var _=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 j=u.FixtureAdapter;var K=c["default"];var B=l["default"];var N=h["default"];var U=p.ActiveModelAdapter;var V=p.ActiveModelSerializer;var H=m.Transform;var q=m.DateTransform;var W=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=E.Relationship;A.Store=z;A.PromiseArray=_;A.PromiseObject=F;A.Model=x;A.RootState=S;A.attr=k;A.Errors=T;A.Adapter=D;A.InvalidError=M;A.DebugAdapter=P;A.RecordArray=O;A.FilteredRecordArray=C;A.AdapterPopulatedRecordArray=w;A.ManyArray=$;A.RecordArrayManager=I;A.RESTAdapter=L;A.FixtureAdapter=j;A.RESTSerializer=B;A.JSONSerializer=K;A.Transform=H;A.DateTransform=q;A.StringTransform=Q;A.NumberTransform=W;A.BooleanTransform=X;A.ActiveModelAdapter=U;A.ActiveModelSerializer=V;A.EmbeddedRecordsMixin=N;A.belongsTo=G;A.hasMany=J;A.Relationship=er;A.ContainerProxy=Z;A._setupContainer=Y;Ember.lookup.DS=A;R["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","exports"],function(e,r){"use strict";var t=e.Adapter;var i=e.InvalidError;var a=Ember.get;var n=Ember.ArrayPolyfills.forEach;r["default"]=t.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 n=a(this,"host");var s=a(r,"id");var o=r.constructor.typeKey;if(n&&t.charAt(0)==="/"&&t.charAt(1)!=="/"){t=n+t}return this.ajax(this.urlPrefix(t,this.buildURL(o,s)),"GET")},findBelongsTo:function(e,r,t,i){var n=a(r,"id");var s=r.constructor.typeKey;return this.ajax(this.urlPrefix(t,this.buildURL(s,n)),"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 n=e.serializerFor(r.typeKey);n.serializeIntoHash(i,r,t);var s=a(t,"id");return this.ajax(this.buildURL(r.typeKey,s,t),"PUT",{data:i})},deleteRecord:function(e,r,t){var i=a(t,"id");return this.ajax(this.buildURL(r.typeKey,i,t),"DELETE")},buildURL:function(e,r,t){var i=[],n=a(this,"host"),s=this.urlPrefix();if(e){i.push(this.pathForType(e))}if(r&&!Ember.isArray(r)){i.push(r)}if(s){i.unshift(s)}i=i.join("/");if(!n&&i){i="/"+i}return i},urlPrefix:function(e,r){var t=a(this,"host");var i=a(this,"namespace");var n=[];if(e){if(e.charAt(0)==="/"){if(t){e=e.slice(1);n.push(t)}}else if(!/^http(s)?:\/\//.test(e)){n.push(r)}}else{if(t){n.push(t)}if(i){n.push(i)}}if(e){n.push(e)}return n.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 o=r.get("id");if(n===o){a[a.length-1]=""}else if(s(n,"?id="+o)){a[a.length-1]=n.substring(0,n.length-o.length-1)}return a.join("/")},groupRecordsForFindMany:function(e,r){var t=Ember.MapWithDefault.create({defaultValue:function(){return[]}});var i=this;n.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 s=0;var o=[[]];n.call(r,function(e){var r="&ids[]=".length+e.get("id.length");if(a.length+s+r>=t){s=0;o.push([])}s+=r;var i=o.length-1;o[i].push(e)});return o}var s=[];t.forEach(function(e,r){var t=2048;var i=a(r,t);n.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 a=this;return new Ember.RSVP.Promise(function(n,s){var o=a.ajaxOptions(e,r,t);o.success=function(e,r,t){e=a.ajaxSuccess(t,e);if(e instanceof i){Ember.run(null,s,e)}else{Ember.run(null,n,e)}};o.error=function(e,r,t){Ember.run(null,s,a.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 s=a(this,"headers");if(s!==undefined){i.beforeSend=function(e){n.call(Ember.keys(s),function(r){e.setRequestHeader(r,s[r])})}}return i}});function s(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.10"});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)){i[o]=s}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+""}t["default"]=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);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);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);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)}}})});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(e).replace("_"," "));r.push({name:e,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/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","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;t.reopenClass({attributes:Ember.computed(function(){var e=Ember.Map.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=Ember.Map.create();this.eachAttribute(function(r,t){if(t.type){e.set(r,t.type)}});return e}).readOnly(),eachAttribute:function(e,r){i(this,"attributes").forEach(function(t,i){e.call(r,t,i)},r)},eachTransformedAttribute:function(e,r){i(this,"transformedAttributes").forEach(function(t,i){e.call(r,t,i)})}});t.reopen({eachAttribute:function(e,r){this.constructor.eachAttribute(e,r)}});function a(e,r,t){if(typeof r.defaultValue==="function"){return r.defaultValue.apply(null,arguments)}else{return r.defaultValue}}function n(e,r){return e._attributes.hasOwnProperty(r)||e._inFlightAttributes.hasOwnProperty(r)||e._data.hasOwnProperty(r)}function s(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]}}r["default"]=function o(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=s(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(n(this,e)){return s(this,e)}else{return a(this,r,e)}}).meta(t)}});define("ember-data/system/model/errors",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.isEmpty;var i=Ember.EnumerableUtils.map;e["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 Ember.MapWithDefault.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 r(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(t(r)){return null}return r},nextObject:function(e,t,i){return r(this,"content").objectAt(e)},length:Ember.computed.oneWay("content.length").readOnly(),isEmpty:Ember.computed.not("length").readOnly(),add:function(e,t){var i=r(this,"isEmpty");t=this._findOrCreateMessages(e,t);r(this,"content").addObjects(t);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(i&&!r(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return i(Ember.makeArray(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(r(this,"isEmpty")){return}var t=r(this,"content").rejectBy("attribute",e);r(this,"content").setObjects(t);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(r(this,"isEmpty")){this.trigger("becameValid")
|
2
|
-
}},clear:function(){if(r(this,"isEmpty")){return}r(this,"content").clear();this.enumerableContentDidChange();this.trigger("becameValid")},has:function(e){return!t(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 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=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={};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=E(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)},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,"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");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(e){Ember.tryInvoke(this,e,[].slice.call(arguments,1));this._super.apply(this,arguments)},triggerLater:function(){if(this._deferredTriggers.push(arguments)!==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.clearRelationships()},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.clearRelationships();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.clearRelationships()};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.clearRelationships()},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.ArrayProxy.extend(Ember.PromiseProxyMixin);var i=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var a=function(e,t){return i.create({promise:r.resolve(e,t)})};var n=function(e,i){return t.create({promise:r.resolve(e,i)})};e.PromiseArray=t;e.PromiseObject=i;e.promiseArray=n;e.promiseObject=a});define("ember-data/system/record_array_manager",["ember-data/system/record_arrays","exports"],function(e,r){"use strict";var t=e.RecordArray;var i=e.FilteredRecordArray;var a=e.AdapterPopulatedRecordArray;var n=e.ManyArray;var s=Ember.get;var o=Ember.EnumerableUtils.forEach;r["default"]=Ember.Object.extend({init:function(){this.filteredRecordArrays=Ember.MapWithDefault.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||Ember.OrderedSet.create();return e._recordArrays},updateRecordArrays:function(){o(this.changedRecords,function(e){if(s(e,"isDeleted")){this._recordWasDeleted(e)}else{this._recordWasChanged(e)}},this);this.changedRecords.length=0},_recordWasDeleted:function(e){var r=e._recordArrays;if(!r){return}o(r,function(r){r.removeRecord(e)})},_recordWasChanged:function(e){var r=e.constructor;var t=this.filteredRecordArrays.get(r);var i;o(t,function(t){i=s(t,"filterFunction");this.updateRecordArray(t,i,r,e)},this);var a=e._loadingRecordArrays;if(a){for(var n=0,d=a.length;n<d;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.remove(e);e.removeRecord(i)}},updateFilter:function(e,r,t){var i=this.store.typeMapFor(r);var a=i.records,n;for(var o=0,d=a.length;o<d;o++){n=a[o];if(!s(n,"isDeleted")&&!s(n,"isEmpty")){this.updateRecordArray(e,t,r,n)}}},createManyArray:function(e,r){var t=n.create({type:e,content:r,store:this.store});o(r,function(e){var r=this.recordArraysForRecord(e);r.add(t)},this);return t},createRecordArray:function(e){var r=t.create({type:e,content:Ember.A(),store:this.store,isLoaded:true});this.registerFilteredRecordArray(r,e);return r},createFilteredRecordArray:function(e,r,t){var a=i.create({query:t,type:e,content:Ember.A(),store:this.store,manager:this,filterFunction:r});this.registerFilteredRecordArray(a,e,r);return a},createAdapterPopulatedRecordArray:function(e,r){var t=a.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();o(c(d(this.filteredRecordArrays.values)),u);o(this._adapterPopulatedRecordArrays,u)}});function d(e){var r=[];var t=Ember.keys(e);for(var i=0;i<t.length;i++){r.push(e[t[i]])}return r}function u(e){e.destroy()}function c(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)},name:null,owner:null,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)}},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.remove(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}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"],function(e,r){"use strict";var t=e.typeForRelationshipMeta;var i=e.relationshipFromMeta;var a=r.Model;var n=Ember.get;a.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});a.reopenClass({typeForRelationship:function(e){var r=n(this,"relationshipsByName").get(e);return r&&r.type},inverseFor: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,s;if(t.inverse){i=t.inverse;s=Ember.get(r,"relationshipsByName").get(i);a=s.kind}else{var o=d(this,r);if(o.length===0){return null}i=o[0].name;a=o[0].kind}function d(e,r,t){t=t||[];var i=n(r,"relationships");if(!i){return}var a=i.get(e);if(a){t.push.apply(t,i.get(e))}if(e.superclass){d(e.superclass,r,t)}return t}return{type:r,name:i,kind:a}},relationships:Ember.computed(function(){var e=new Ember.MapWithDefault({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,i){if(i.isRelationship){i.key=r;var a=e.get(t(this.store,i));a.push({name:r,kind:i.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(i,a){if(a.isRelationship){a.key=i;e=t(this.store,a);if(!r.contains(e)){r.push(e)}}});return r}).cacheable(false).readOnly(),relationshipsByName:Ember.computed(function(){var e=Ember.Map.create();this.eachComputedProperty(function(r,a){if(a.isRelationship){a.key=r;var n=i(this.store,a);n.type=t(this.store,a);e.set(r,n)}});return e}).cacheable(false).readOnly(),fields:Ember.computed(function(){var e=Ember.Map.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){n(this,"relationshipsByName").forEach(function(t,i){e.call(r,t,i)})},eachRelatedType:function(e,r){n(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"}}});a.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return n(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","exports"],function(e,r){"use strict";var t=e.PromiseArray;var i=e.PromiseObject;var a=function(e,r,t,i){this.members=new Ember.OrderedSet;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};a.prototype={constructor:a,hasFetchedLink:false,destroy:Ember.K,clear:function(){this.members.forEach(function(e){this.removeRecord(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)}this.record.updateRecordArrays()}},removeRecord:function(e){if(this.members.has(e)){this.members.remove(e);this.notifyRecordRelationshipRemoved(e);if(this.inverseKey){var r=e._relationships[this.inverseKey];if(r){r.removeRecord(this.record)}}this.record.updateRecordArrays()}},updateLink:function(e){if(e!==this.link){this.link=e;this.hasFetchedLink=false;this.record.notifyPropertyChange(this.key)}},updateRecordsFromAdapter:function(e){this.computeChanges(e)}};var n=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};n.prototype=Object.create(a.prototype);n.prototype.constructor=n;n.prototype._super$constructor=a;n.prototype.destroy=function(){this.manyArray.destroy()};n.prototype.notifyRecordRelationshipAdded=function(e,r){this.record.notifyHasManyAdded(this.key,e,r)};n.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyHasManyRemoved(this.key,e)};n.prototype.computeChanges=function(e){var r=this.members;e=o(e);r.forEach(function(r){if(e.has(r))return;this.removeRecord(r)},this);var t=this.manyArray;e.forEach(function(e,r){if(t.objectAt(r)===e)return;this.removeRecord(e);this.addRecord(e,r)},this)};n.prototype.getRecords=function(){if(this.isAsync){var e=this;var r;if(this.link&&!this.hasFetchedLink){r=this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(r){e.updateRecordsFromAdapter(r);e.hasFetchedLink=true;e.manyArray.set("isLoaded",true);return e.manyArray})}else{var i=this.manyArray;r=this.store.findMany(i.toArray()).then(function(){e.manyArray.set("isLoaded",true);return i})}return t.create({promise:r})}else{this.manyArray.set("isLoaded",true);return this.manyArray}};var s=function(e,r,t,i){this._super$constructor(e,r,t,i);this.members.add(r);this.record=r;this.key=i.key;this.inverseKey=t;this.inverseRecord=null};s.prototype=Object.create(a.prototype);s.prototype.constructor=s;s.prototype._super$constructor=a;s.prototype.setRecord=function(e){if(e){this.addRecord(e)}else if(this.inverseRecord){this.removeRecord(this.inverseRecord)}};s.prototype._super$addRecord=a.prototype.addRecord;s.prototype.addRecord=function(e){if(this.members.has(e)){return}var r=this.relationshipMeta.type;if(this.inverseRecord&&this.inverseKey){this.removeRecord(this.inverseRecord)}this.inverseRecord=e;this._super$addRecord(e)};s.prototype.notifyRecordRelationshipAdded=function(e){this.record.notifyBelongsToAdded(this.key,this)};s.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyBelongsToRemoved(this.key,this)};s.prototype._super$removeRecord=a.prototype.removeRecord;s.prototype.removeRecord=function(e){if(!this.members.has(e)){return}this._super$removeRecord(e);this.inverseRecord=null};s.prototype.currentOtherSideFor=function(){return this.inverseRecord};s.prototype.getRecord=function(){if(this.isAsync){var e;if(this.link&&!this.hasFetchedLink){var r=this;e=this.store.findBelongsTo(this.record,this.link,this.relationshipMeta).then(function(e){r.addRecord(e);r.hasFetchedLink=true;return e})}else if(this.inverseRecord){e=this.store._findByRecord(this.inverseRecord)}else{e=Ember.RSVP.Promise.resolve(null)}return i.create({promise:e})}else{return this.inverseRecord}};function o(e){var r=new Ember.OrderedSet;if(e){for(var t=0,i=e.length;t<i;t++){r.add(e[t])}}return r}var d=function(e,r,t){var i;var a=e.constructor.inverseFor(r.key);if(a){i=a.name}if(r.kind==="hasMany"){return new n(t,e,i,r)}else{return new s(t,e,i,r)}};r.Relationship=a;r.ManyRelationship=n;r.BelongsToRelationship=s;r.createRelationshipFor=d});define("ember-data/system/store",["ember-data/system/adapter","ember-inflector/system/string","ember-data/system/promise_proxies","exports"],function(e,r,t,i){"use strict";var a=e.InvalidError;var n=e.Adapter;var s=r.singularize;var o=t.promiseArray;var d=t.promiseObject;var u=Ember.get;var c=Ember.set;var l=Ember.run.once;var f=Ember.isNone;var h=Ember.EnumerableUtils.forEach;var p=Ember.EnumerableUtils.indexOf;var m=Ember.EnumerableUtils.map;var y=Ember.RSVP.Promise;var v=Ember.copy;var b,g,E;var R=Ember.String.camelize;function A(e){return e==null?null:e+""}b=Ember.Object.extend({init:function(){if(!g){g=requireModule("ember-data/system/record_array_manager")["default"]}this.typeMaps={};this.recordArrayManager=g.create({store:this});this._pendingSave=[];this._pendingFetch=Ember.Map.create()},adapter:"-rest",serialize:function(e,r){return this.serializerFor(e.constructor.typeKey).serialize(e,r)},defaultAdapter:Ember.computed("adapter",function(){var e=u(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=v(r)||{};if(f(i.id)){i.id=this._generateId(t)}i.id=A(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,A(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(u(e,"isEmpty")){t=this.scheduleFetch(e)}else if(u(e,"isLoading")){t=e._loadingPromise}return d(t||e,"DS: Store#findByRecord "+e.typeKey+" with id: "+u(e,"id"))},findByIds:function(e,r){var t=this;return o(Ember.RSVP.all(m(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=u(e,"id");var i=this.adapterFor(r);var a=O(i,this,r,t,e);return a},scheduleFetchMany:function(e){return Ember.RSVP.all(m(e,this.scheduleFetch,this))},scheduleFetch:function(e){var r=e.constructor;if(f(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=Ember.Map.create()},_flushPendingFetchForType:function(e,r){var t=this;var i=t.adapterFor(e);var a=!!i.findMany&&i.coalesceFindRequests;var n=Ember.A(r).mapBy("record");
|
3
|
-
function s(e){e.resolver.resolve(t.fetchRecord(e.record))}function o(e){h(e,function(e){var t=Ember.A(r).findBy("record",e);if(t){var i=t.resolver;i.resolve(e)}})}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(e,t){h(e,function(e){var i=Ember.A(r).findBy("record",e);if(i){var a=i.resolver;a.reject(t)}})}if(r.length===1){s(r[0])}else if(a){var l=i.groupRecordsForFindMany(this,n);h(l,function(a){var n=Ember.A(a);var c=n.mapBy("id");if(c.length>1){C(i,t,e,c,n).then(o).then(d(n)).then(null,u(n))}else if(c.length===1){var l=Ember.A(r).findBy("record",a[0]);s(l)}else{}})}else{h(r,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=u(e,"id");return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=A(r);return!!this.typeMapFor(t).idToRecord[i]},recordForId:function(e,r){var t=this.modelFor(e);var i=A(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 y.all(m(e,function(e){return r._findByRecord(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.constructor);return w(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.constructor);return $(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 o(L(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;c(r,"isUpdating",true);return o(I(t,this,e,i))},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;c(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||y.cast(n);return o(i.then(function(){return n},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,r){if(!this.hasRecordForId(e,r)){return false}return!u(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]);l(this,"flushPendingSave")},flushPendingSave:function(){var e=this._pendingSave.slice();this._pendingSave=[];h(e,function(e){var r=e[0],t=e[1];var i=this.adapterFor(r.constructor);var a;if(u(r,"currentState.stateName")==="root.deleted.saved"){return t.resolve(r)}else if(u(r,"isNew")){a="createRecord"}else if(u(r,"isDeleted")){a="deleteRecord"}else{a="updateRecord"}t.resolve(j(i,this,a,r))},this)},didSaveRecord:function(e,r){if(r){r=_(this,e.constructor,r,e);K(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=u(e,"id");var i=A(r.id);this.typeMapFor(e.constructor).idToRecord[i]=e;c(e,"id",i)},typeMapFor:function(e){var r=u(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=A(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.container.lookupFactory("model:"+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},push:function(e,r,t){var i=this.modelFor(e);r=_(this,i,r);this._load(i,r,t);var a=this.recordForId(i,r.id);K(this,a,r);return a},pushPayload:function(e,r){var t;var i;if(!r){i=e;t=S(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=u(e,"id");e.updateRecordArrays();if(i){delete t.idToRecord[i]}var a=p(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||u(this,"defaultAdapter")},serializerFor:function(e){e=this.modelFor(e);var r=this.adapterFor(e);return T(this.container,e.typeKey,r&&r.defaultSerializer)},willDestroy:function(){var e=this.typeMaps;var r=Ember.keys(e);var t=m(r,i);this.recordArrayManager.destroy();h(t,this.unloadAll,this);function i(r){return e[r]["type"]}},_normalizeTypeKey:function(e){return R(s(e))}});function _(e,r,t,i){r.eachRelationship(function(r,i){var a=i.kind;var n=t[r];if(a==="belongsTo"){F(e,t,r,i,n)}else if(a==="hasMany"){x(e,t,r,i,n)}});return t}function F(e,r,t,i,a){if(!E){E=requireModule("ember-data/system/model")["Model"]}if(f(a)||a instanceof E){return}var n;if(typeof a==="number"||typeof a==="string"){n=z(i,t,r);r[t]=e.recordForId(n,a)}else if(typeof a==="object"){r[t]=e.recordForId(a.type,a.id)}}function z(e,r,t){if(e.options.polymorphic){return t[r+"Type"]}else{return e.type}}function x(e,r,t,i,a){if(!Ember.isArray(a)){return}for(var n=0,s=a.length;n<s;n++){F(e,a,n,i,a[n])}}function T(e,r,t){return e.lookup("serializer:"+r)||e.lookup("serializer:application")||e.lookup("serializer:"+t)||e.lookup("serializer:-default")}function S(e){return e.lookup("serializer:application")||e.lookup("serializer:-default")}function k(e,r){var t=e.serializer;var i=e.defaultSerializer;var a=e.container;if(a&&t===undefined){t=T(a,r.typeKey,i)}if(t===null||t===undefined){t={extract:function(e,r,t){return t}}}return t}function M(e){return!(u(e,"isDestroyed")||u(e,"isDestroying"))}function D(e,r){var t=e["finally"](function(){if(!r()){t._subscribers.length=0}});return t}function P(e){var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(undefined,r)}}function O(e,r,t,i,a){var n=e.find(r,t,i,a);var s=k(e,t);var o="DS: Handle Adapter#find of "+t+" with id: "+i;n=y.cast(n,o);n=D(n,P(M,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 C(e,r,t,i,a){var n=e.findMany(r,t,i,a);var s=k(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=y.cast(n,o);n=D(n,P(M,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 w(e,r,t,i,a){var n=e.findHasMany(r,t,i,a);var s=k(e,a.type);var o="DS: Handle Adapter#findHasMany of "+t+" : "+a.type;n=y.cast(n,o);n=D(n,P(M,r));n=D(n,P(M,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 $(e,r,t,i,a){var n=e.findBelongsTo(r,t,i,a);var s=k(e,a.type);var o="DS: Handle Adapter#findBelongsTo of "+t+" : "+a.type;n=y.cast(n,o);n=D(n,P(M,r));n=D(n,P(M,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 I(e,r,t,i){var a=e.findAll(r,t,i);var n=k(e,t);var s="DS: Handle Adapter#findAll of "+t;a=y.cast(a,s);a=D(a,P(M,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 L(e,r,t,i,a){var n=e.findQuery(r,t,i,a);var s=k(e,t);var o="DS: Handle Adapter#findQuery of "+t;n=y.cast(n,o);n=D(n,P(M,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 j(e,r,t,i){var n=i.constructor;var s=e[t](r,n,i);var o=k(e,n);var d="DS: Extract and notify about "+t+" completion of "+i;s=y.cast(s,d);s=D(s,P(M,r));s=D(s,P(M,i));return s.then(function(e){var a;if(e){a=o.extract(r,n,e,u(i,"id"),t)}else{a=e}r.didSaveRecord(i,a);return i},function(e){if(e instanceof a){r.recordWasInvalid(i,e.errors)}else{r.recordWasError(i,e)}throw e},d)}function K(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)}})}i.Store=b;i["default"]=b});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 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];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.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});
|
@@ -178,7 +178,7 @@ define("activemodel-adapter/system/active_model_adapter",
|
|
178
178
|
https://tools.ietf.org/html/rfc4918#section-11.2
|
179
179
|
|
180
180
|
@method ajaxError
|
181
|
-
@param jqXHR
|
181
|
+
@param {Object} jqXHR
|
182
182
|
@return error
|
183
183
|
*/
|
184
184
|
ajaxError: function(jqXHR) {
|
@@ -367,7 +367,7 @@ define("activemodel-adapter/system/active_model_serializer",
|
|
367
367
|
@method serializePolymorphicType
|
368
368
|
@param {DS.Model} record
|
369
369
|
@param {Object} json
|
370
|
-
@param relationship
|
370
|
+
@param {Object} relationship
|
371
371
|
*/
|
372
372
|
serializePolymorphicType: function(record, json, relationship) {
|
373
373
|
var key = relationship.key;
|
@@ -958,8 +958,8 @@ define("ember-data/adapters/fixture_adapter",
|
|
958
958
|
});
|
959
959
|
});
|
960
960
|
define("ember-data/adapters/rest_adapter",
|
961
|
-
["ember-data/system/adapter","exports"],
|
962
|
-
function(__dependency1__, __exports__) {
|
961
|
+
["ember-data/system/adapter","ember-data/system/map","exports"],
|
962
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
963
963
|
"use strict";
|
964
964
|
/**
|
965
965
|
@module ember-data
|
@@ -967,6 +967,7 @@ define("ember-data/adapters/rest_adapter",
|
|
967
967
|
|
968
968
|
var Adapter = __dependency1__.Adapter;
|
969
969
|
var InvalidError = __dependency1__.InvalidError;
|
970
|
+
var MapWithDefault = __dependency2__.MapWithDefault;
|
970
971
|
var get = Ember.get;
|
971
972
|
var forEach = Ember.ArrayPolyfills.forEach;
|
972
973
|
|
@@ -1166,6 +1167,9 @@ define("ember-data/adapters/rest_adapter",
|
|
1166
1167
|
|
1167
1168
|
will also send a request to: `GET /comments?ids[]=1&ids[]=2`
|
1168
1169
|
|
1170
|
+
Note: Requests coalescing rely on URL building strategy. So if you override `buildUrl` in your app
|
1171
|
+
`groupRecordsForFindMany` more likely should be overriden as well in order for coalescing to work.
|
1172
|
+
|
1169
1173
|
@property coalesceFindRequests
|
1170
1174
|
@type {boolean}
|
1171
1175
|
*/
|
@@ -1494,7 +1498,7 @@ define("ember-data/adapters/rest_adapter",
|
|
1494
1498
|
//We might get passed in an array of ids from findMany
|
1495
1499
|
//in which case we don't want to modify the url, as the
|
1496
1500
|
//ids will be passed in through a query param
|
1497
|
-
if (id && !Ember.isArray(id)) { url.push(id); }
|
1501
|
+
if (id && !Ember.isArray(id)) { url.push(encodeURIComponent(id)); }
|
1498
1502
|
|
1499
1503
|
if (prefix) { url.unshift(prefix); }
|
1500
1504
|
|
@@ -1579,7 +1583,7 @@ define("ember-data/adapters/rest_adapter",
|
|
1579
1583
|
loaded separately by `findMany`.
|
1580
1584
|
*/
|
1581
1585
|
groupRecordsForFindMany: function (store, records) {
|
1582
|
-
var groups =
|
1586
|
+
var groups = MapWithDefault.create({defaultValue: function(){return [];}});
|
1583
1587
|
var adapter = this;
|
1584
1588
|
|
1585
1589
|
forEach.call(records, function(record){
|
@@ -1609,7 +1613,7 @@ define("ember-data/adapters/rest_adapter",
|
|
1609
1613
|
}
|
1610
1614
|
|
1611
1615
|
var groupsArray = [];
|
1612
|
-
groups.forEach(function(
|
1616
|
+
groups.forEach(function(group, key){
|
1613
1617
|
// http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
|
1614
1618
|
var maxUrlLength = 2048;
|
1615
1619
|
var splitGroups = splitGroupToFitInUrl(group, maxUrlLength);
|
@@ -1828,11 +1832,11 @@ define("ember-data/core",
|
|
1828
1832
|
/**
|
1829
1833
|
@property VERSION
|
1830
1834
|
@type String
|
1831
|
-
@default '1.0.0-beta.
|
1835
|
+
@default '1.0.0-beta.11'
|
1832
1836
|
@static
|
1833
1837
|
*/
|
1834
1838
|
DS = Ember.Namespace.create({
|
1835
|
-
VERSION: '1.0.0-beta.
|
1839
|
+
VERSION: '1.0.0-beta.11'
|
1836
1840
|
});
|
1837
1841
|
|
1838
1842
|
if (Ember.libraries) {
|
@@ -1951,7 +1955,8 @@ define("ember-data/ext/date",
|
|
1951
1955
|
|
1952
1956
|
/**
|
1953
1957
|
@method parse
|
1954
|
-
@param date
|
1958
|
+
@param {Date} date
|
1959
|
+
@return {Number} timestamp
|
1955
1960
|
*/
|
1956
1961
|
Ember.Date.parse = function (date) {
|
1957
1962
|
var timestamp, struct, minutesOffset = 0;
|
@@ -2121,21 +2126,24 @@ define("ember-data/serializers/embedded_records_mixin",
|
|
2121
2126
|
```js
|
2122
2127
|
App.PostSerializer = DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
2123
2128
|
attrs: {
|
2124
|
-
author: {embedded: 'always'},
|
2125
|
-
comments: {serialize: 'ids'}
|
2129
|
+
author: { embedded: 'always' },
|
2130
|
+
comments: { serialize: 'ids' }
|
2126
2131
|
}
|
2127
|
-
})
|
2132
|
+
});
|
2128
2133
|
```
|
2129
|
-
Note that this use of `{embedded: 'always'}` is unrelated to
|
2130
|
-
the `{embedded: 'always'}` that is defined as an option on `DS.attr` as part of
|
2134
|
+
Note that this use of `{ embedded: 'always' }` is unrelated to
|
2135
|
+
the `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of
|
2131
2136
|
defining a model while working with the ActiveModelSerializer. Nevertheless,
|
2132
|
-
using `{embedded: 'always'}` as an option to DS.attr is not a valid way to setup
|
2137
|
+
using `{ embedded: 'always' }` as an option to DS.attr is not a valid way to setup
|
2133
2138
|
embedded records.
|
2134
2139
|
|
2135
|
-
The `attrs` option for a resource `{embedded: 'always'}` is shorthand for:
|
2140
|
+
The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:
|
2136
2141
|
|
2137
2142
|
```js
|
2138
|
-
{
|
2143
|
+
{
|
2144
|
+
serialize: 'records',
|
2145
|
+
deserialize: 'records'
|
2146
|
+
}
|
2139
2147
|
```
|
2140
2148
|
|
2141
2149
|
### Configuring Attrs
|
@@ -2159,8 +2167,8 @@ define("ember-data/serializers/embedded_records_mixin",
|
|
2159
2167
|
If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
|
2160
2168
|
will behave in the following way:
|
2161
2169
|
|
2162
|
-
BelongsTo: `{serialize:'id', deserialize:'id'}`
|
2163
|
-
HasMany: `{serialize:false,
|
2170
|
+
BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
|
2171
|
+
HasMany: `{ serialize: false, deserialize: 'ids' }`
|
2164
2172
|
|
2165
2173
|
### Model Relationships
|
2166
2174
|
|
@@ -3156,8 +3164,9 @@ define("ember-data/serializers/json_serializer",
|
|
3156
3164
|
payloadKey = this.keyForRelationship(key, "belongsTo");
|
3157
3165
|
}
|
3158
3166
|
|
3159
|
-
|
3160
|
-
|
3167
|
+
//Need to check whether the id is there for new&async records
|
3168
|
+
if (isNone(belongsTo) || isNone(get(belongsTo, 'id'))) {
|
3169
|
+
json[payloadKey] = null;
|
3161
3170
|
} else {
|
3162
3171
|
json[payloadKey] = get(belongsTo, 'id');
|
3163
3172
|
}
|
@@ -3664,7 +3673,7 @@ define("ember-data/serializers/rest_serializer",
|
|
3664
3673
|
@namespace DS
|
3665
3674
|
@extends DS.JSONSerializer
|
3666
3675
|
*/
|
3667
|
-
|
3676
|
+
var RESTSerializer = JSONSerializer.extend({
|
3668
3677
|
/**
|
3669
3678
|
If you want to do normalizations specific to some part of the payload, you
|
3670
3679
|
can specify those under `normalizeHash`.
|
@@ -3877,6 +3886,9 @@ define("ember-data/serializers/rest_serializer",
|
|
3877
3886
|
|
3878
3887
|
for (var prop in payload) {
|
3879
3888
|
var typeName = this.typeForRoot(prop);
|
3889
|
+
if (!store.modelFactoryFor(typeName)){
|
3890
|
+
continue;
|
3891
|
+
}
|
3880
3892
|
var type = store.modelFor(typeName);
|
3881
3893
|
var isPrimary = type.typeKey === primaryTypeName;
|
3882
3894
|
var value = payload[prop];
|
@@ -4030,6 +4042,9 @@ define("ember-data/serializers/rest_serializer",
|
|
4030
4042
|
}
|
4031
4043
|
|
4032
4044
|
var typeName = this.typeForRoot(typeKey);
|
4045
|
+
if (!store.modelFactoryFor(typeName)) {
|
4046
|
+
continue;
|
4047
|
+
}
|
4033
4048
|
var type = store.modelFor(typeName);
|
4034
4049
|
var typeSerializer = store.serializerFor(type);
|
4035
4050
|
var isPrimary = (!forcedSecondary && (type.typeKey === primaryTypeName));
|
@@ -4085,6 +4100,9 @@ define("ember-data/serializers/rest_serializer",
|
|
4085
4100
|
|
4086
4101
|
for (var prop in payload) {
|
4087
4102
|
var typeName = this.typeForRoot(prop);
|
4103
|
+
if (!store.modelFactoryFor(typeName, prop)){
|
4104
|
+
continue;
|
4105
|
+
}
|
4088
4106
|
var type = store.modelFor(typeName);
|
4089
4107
|
var typeSerializer = store.serializerFor(type);
|
4090
4108
|
|
@@ -4285,8 +4303,9 @@ define("ember-data/serializers/rest_serializer",
|
|
4285
4303
|
```
|
4286
4304
|
|
4287
4305
|
@method serialize
|
4288
|
-
@param record
|
4289
|
-
@param options
|
4306
|
+
@param {subclass of DS.Model} record
|
4307
|
+
@param {Object} options
|
4308
|
+
@return {Object} json
|
4290
4309
|
*/
|
4291
4310
|
serialize: function(record, options) {
|
4292
4311
|
return this._super.apply(this, arguments);
|
@@ -4339,6 +4358,9 @@ define("ember-data/serializers/rest_serializer",
|
|
4339
4358
|
}
|
4340
4359
|
}
|
4341
4360
|
});
|
4361
|
+
|
4362
|
+
|
4363
|
+
__exports__["default"] = RESTSerializer;
|
4342
4364
|
});
|
4343
4365
|
define("ember-data/setup-container",
|
4344
4366
|
["ember-data/initializers/store","ember-data/initializers/transforms","ember-data/initializers/store_injections","ember-data/initializers/data_adapter","activemodel-adapter/setup-container","exports"],
|
@@ -4932,7 +4954,7 @@ define("ember-data/system/debug/debug_adapter",
|
|
4932
4954
|
}];
|
4933
4955
|
var count = 0;
|
4934
4956
|
var self = this;
|
4935
|
-
get(type, 'attributes').forEach(function(
|
4957
|
+
get(type, 'attributes').forEach(function(meta, name) {
|
4936
4958
|
if (count++ > self.attributeLimit) { return false; }
|
4937
4959
|
var desc = capitalize(underscore(name).replace('_', ' '));
|
4938
4960
|
columns.push({ name: name, desc: desc });
|
@@ -5089,6 +5111,101 @@ define("ember-data/system/debug/debug_info",
|
|
5089
5111
|
|
5090
5112
|
__exports__["default"] = Model;
|
5091
5113
|
});
|
5114
|
+
define("ember-data/system/map",
|
5115
|
+
["exports"],
|
5116
|
+
function(__exports__) {
|
5117
|
+
"use strict";
|
5118
|
+
/**
|
5119
|
+
* Polyfill Ember.Map behavior for Ember <= 1.7
|
5120
|
+
* This can probably be removed before 1.0 final
|
5121
|
+
*/
|
5122
|
+
var mapForEach, deleteFn;
|
5123
|
+
|
5124
|
+
function OrderedSet(){
|
5125
|
+
Ember.OrderedSet.apply(this, arguments);
|
5126
|
+
}
|
5127
|
+
|
5128
|
+
function Map() {
|
5129
|
+
Ember.Map.apply(this, arguments);
|
5130
|
+
}
|
5131
|
+
|
5132
|
+
function MapWithDefault(){
|
5133
|
+
Ember.MapWithDefault.apply(this, arguments);
|
5134
|
+
}
|
5135
|
+
|
5136
|
+
var testMap = Ember.Map.create();
|
5137
|
+
testMap.set('key', 'value');
|
5138
|
+
|
5139
|
+
var usesOldBehavior = false;
|
5140
|
+
|
5141
|
+
testMap.forEach(function(value, key){
|
5142
|
+
usesOldBehavior = value === 'key' && key === 'value';
|
5143
|
+
});
|
5144
|
+
|
5145
|
+
Map.prototype = Object.create(Ember.Map.prototype);
|
5146
|
+
MapWithDefault.prototype = Object.create(Ember.MapWithDefault.prototype);
|
5147
|
+
OrderedSet.prototype = Object.create(Ember.OrderedSet.prototype);
|
5148
|
+
|
5149
|
+
OrderedSet.create = function(){
|
5150
|
+
return new OrderedSet();
|
5151
|
+
};
|
5152
|
+
|
5153
|
+
/**
|
5154
|
+
* returns a function that calls the original
|
5155
|
+
* callback function in the correct order.
|
5156
|
+
* if we are in pre-Ember.1.8 land, Map/MapWithDefault
|
5157
|
+
* forEach calls with key, value, in that order.
|
5158
|
+
* >= 1.8 forEach is called with the order value, key as per
|
5159
|
+
* the ES6 spec.
|
5160
|
+
*/
|
5161
|
+
function translate(valueKeyOrderedCallback){
|
5162
|
+
return function(key, value){
|
5163
|
+
valueKeyOrderedCallback.call(this, value, key);
|
5164
|
+
};
|
5165
|
+
}
|
5166
|
+
|
5167
|
+
// old, non ES6 compliant behavior
|
5168
|
+
if (usesOldBehavior){
|
5169
|
+
mapForEach = function(callback, thisArg){
|
5170
|
+
this.__super$forEach(translate(callback), thisArg);
|
5171
|
+
};
|
5172
|
+
|
5173
|
+
/* alias to remove */
|
5174
|
+
deleteFn = function(thing){
|
5175
|
+
this.remove(thing);
|
5176
|
+
};
|
5177
|
+
|
5178
|
+
Map.prototype.__super$forEach = Ember.Map.prototype.forEach;
|
5179
|
+
Map.prototype.forEach = mapForEach;
|
5180
|
+
Map.prototype["delete"] = deleteFn;
|
5181
|
+
|
5182
|
+
MapWithDefault.prototype.forEach = mapForEach;
|
5183
|
+
MapWithDefault.prototype.__super$forEach = Ember.MapWithDefault.prototype.forEach;
|
5184
|
+
MapWithDefault.prototype["delete"] = deleteFn;
|
5185
|
+
|
5186
|
+
OrderedSet.prototype["delete"] = deleteFn;
|
5187
|
+
}
|
5188
|
+
|
5189
|
+
MapWithDefault.constructor = MapWithDefault;
|
5190
|
+
Map.constructor = Map;
|
5191
|
+
|
5192
|
+
MapWithDefault.create = function(options){
|
5193
|
+
if (options) {
|
5194
|
+
return new MapWithDefault(options);
|
5195
|
+
} else {
|
5196
|
+
return new Map();
|
5197
|
+
}
|
5198
|
+
};
|
5199
|
+
|
5200
|
+
Map.create = function(){
|
5201
|
+
return new this.constructor();
|
5202
|
+
};
|
5203
|
+
|
5204
|
+
__exports__["default"] = Map;
|
5205
|
+
__exports__.Map = Map;
|
5206
|
+
__exports__.MapWithDefault = MapWithDefault;
|
5207
|
+
__exports__.OrderedSet = OrderedSet;
|
5208
|
+
});
|
5092
5209
|
define("ember-data/system/model",
|
5093
5210
|
["ember-data/system/model/model","ember-data/system/model/attributes","ember-data/system/model/states","ember-data/system/model/errors","exports"],
|
5094
5211
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
|
@@ -5108,10 +5225,11 @@ define("ember-data/system/model",
|
|
5108
5225
|
__exports__.Errors = Errors;
|
5109
5226
|
});
|
5110
5227
|
define("ember-data/system/model/attributes",
|
5111
|
-
["ember-data/system/model/model","exports"],
|
5112
|
-
function(__dependency1__, __exports__) {
|
5228
|
+
["ember-data/system/model/model","ember-data/system/map","exports"],
|
5229
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
5113
5230
|
"use strict";
|
5114
5231
|
var Model = __dependency1__["default"];
|
5232
|
+
var Map = __dependency2__.Map;
|
5115
5233
|
|
5116
5234
|
/**
|
5117
5235
|
@module ember-data
|
@@ -5157,7 +5275,7 @@ define("ember-data/system/model/attributes",
|
|
5157
5275
|
@readOnly
|
5158
5276
|
*/
|
5159
5277
|
attributes: Ember.computed(function() {
|
5160
|
-
var map =
|
5278
|
+
var map = Map.create();
|
5161
5279
|
|
5162
5280
|
this.eachComputedProperty(function(name, meta) {
|
5163
5281
|
if (meta.isAttribute) {
|
@@ -5202,7 +5320,7 @@ define("ember-data/system/model/attributes",
|
|
5202
5320
|
@readOnly
|
5203
5321
|
*/
|
5204
5322
|
transformedAttributes: Ember.computed(function() {
|
5205
|
-
var map =
|
5323
|
+
var map = Map.create();
|
5206
5324
|
|
5207
5325
|
this.eachAttribute(function(key, meta) {
|
5208
5326
|
if (meta.type) {
|
@@ -5255,7 +5373,7 @@ define("ember-data/system/model/attributes",
|
|
5255
5373
|
@static
|
5256
5374
|
*/
|
5257
5375
|
eachAttribute: function(callback, binding) {
|
5258
|
-
get(this, 'attributes').forEach(function(
|
5376
|
+
get(this, 'attributes').forEach(function(meta, name) {
|
5259
5377
|
callback.call(binding, name, meta);
|
5260
5378
|
}, binding);
|
5261
5379
|
},
|
@@ -5303,7 +5421,7 @@ define("ember-data/system/model/attributes",
|
|
5303
5421
|
@static
|
5304
5422
|
*/
|
5305
5423
|
eachTransformedAttribute: function(callback, binding) {
|
5306
|
-
get(this, 'transformedAttributes').forEach(function(
|
5424
|
+
get(this, 'transformedAttributes').forEach(function(type, name) {
|
5307
5425
|
callback.call(binding, name, type);
|
5308
5426
|
});
|
5309
5427
|
}
|
@@ -5416,13 +5534,15 @@ define("ember-data/system/model/attributes",
|
|
5416
5534
|
};
|
5417
5535
|
});
|
5418
5536
|
define("ember-data/system/model/errors",
|
5419
|
-
["exports"],
|
5420
|
-
function(__exports__) {
|
5537
|
+
["ember-data/system/map","exports"],
|
5538
|
+
function(__dependency1__, __exports__) {
|
5421
5539
|
"use strict";
|
5422
5540
|
var get = Ember.get;
|
5423
5541
|
var isEmpty = Ember.isEmpty;
|
5424
5542
|
var map = Ember.EnumerableUtils.map;
|
5425
5543
|
|
5544
|
+
var MapWithDefault = __dependency1__.MapWithDefault;
|
5545
|
+
|
5426
5546
|
/**
|
5427
5547
|
@module ember-data
|
5428
5548
|
*/
|
@@ -5519,7 +5639,7 @@ define("ember-data/system/model/errors",
|
|
5519
5639
|
*/
|
5520
5640
|
errorsByAttributeName: Ember.reduceComputed("content", {
|
5521
5641
|
initialValue: function() {
|
5522
|
-
return
|
5642
|
+
return MapWithDefault.create({
|
5523
5643
|
defaultValue: function() {
|
5524
5644
|
return Ember.A();
|
5525
5645
|
}
|
@@ -6211,6 +6331,27 @@ define("ember-data/system/model/model",
|
|
6211
6331
|
this._attributes = {};
|
6212
6332
|
this._inFlightAttributes = {};
|
6213
6333
|
this._relationships = {};
|
6334
|
+
/*
|
6335
|
+
implicit relationships are relationship which have not been declared but the inverse side exists on
|
6336
|
+
another record somewhere
|
6337
|
+
For example if there was
|
6338
|
+
```
|
6339
|
+
App.Comment = DS.Model.extend({
|
6340
|
+
name: DS.attr()
|
6341
|
+
})
|
6342
|
+
```
|
6343
|
+
but there is also
|
6344
|
+
```
|
6345
|
+
App.Post = DS.Model.extend({
|
6346
|
+
name: DS.attr(),
|
6347
|
+
comments: DS.hasMany('comment')
|
6348
|
+
})
|
6349
|
+
```
|
6350
|
+
|
6351
|
+
would have a implicit post relationship in order to be do things like remove ourselves from the post
|
6352
|
+
when we are deleted
|
6353
|
+
*/
|
6354
|
+
this._implicitRelationships = Object.create(null);
|
6214
6355
|
var model = this;
|
6215
6356
|
//TODO Move into a getter for better perf
|
6216
6357
|
this.constructor.eachRelationship(function(key, descriptor) {
|
@@ -6408,6 +6549,27 @@ define("ember-data/system/model/model",
|
|
6408
6549
|
}, this);
|
6409
6550
|
},
|
6410
6551
|
|
6552
|
+
disconnectRelationships: function() {
|
6553
|
+
this.eachRelationship(function(name, relationship) {
|
6554
|
+
this._relationships[name].disconnect();
|
6555
|
+
}, this);
|
6556
|
+
var model = this;
|
6557
|
+
forEach.call(Ember.keys(this._implicitRelationships), function(key) {
|
6558
|
+
model._implicitRelationships[key].disconnect();
|
6559
|
+
});
|
6560
|
+
},
|
6561
|
+
|
6562
|
+
reconnectRelationships: function() {
|
6563
|
+
this.eachRelationship(function(name, relationship) {
|
6564
|
+
this._relationships[name].reconnect();
|
6565
|
+
}, this);
|
6566
|
+
var model = this;
|
6567
|
+
forEach.call(Ember.keys(this._implicitRelationships), function(key) {
|
6568
|
+
model._implicitRelationships[key].reconnect();
|
6569
|
+
});
|
6570
|
+
},
|
6571
|
+
|
6572
|
+
|
6411
6573
|
/**
|
6412
6574
|
@method updateRecordArrays
|
6413
6575
|
@private
|
@@ -6627,6 +6789,13 @@ define("ember-data/system/model/model",
|
|
6627
6789
|
set(this, 'isError', false);
|
6628
6790
|
}
|
6629
6791
|
|
6792
|
+
//Eventually rollback will always work for relationships
|
6793
|
+
//For now we support it only out of deleted state, because we
|
6794
|
+
//have an explicit way of knowing when the server acked the relationship change
|
6795
|
+
if (get(this, 'isDeleted')) {
|
6796
|
+
this.reconnectRelationships();
|
6797
|
+
}
|
6798
|
+
|
6630
6799
|
if (!get(this, 'isValid')) {
|
6631
6800
|
this._inFlightAttributes = {};
|
6632
6801
|
}
|
@@ -6642,7 +6811,7 @@ define("ember-data/system/model/model",
|
|
6642
6811
|
|
6643
6812
|
/**
|
6644
6813
|
Save the record and persist any changes to the record to an
|
6645
|
-
|
6814
|
+
external source via the adapter.
|
6646
6815
|
|
6647
6816
|
Example
|
6648
6817
|
|
@@ -6709,7 +6878,9 @@ define("ember-data/system/model/model",
|
|
6709
6878
|
}, function(reason) {
|
6710
6879
|
record.set('isError', true);
|
6711
6880
|
throw reason;
|
6712
|
-
}, "DS: Model#reload complete, update flags")
|
6881
|
+
}, "DS: Model#reload complete, update flags")['finally'](function () {
|
6882
|
+
record.updateRecordArrays();
|
6883
|
+
});
|
6713
6884
|
|
6714
6885
|
return PromiseObject.create({
|
6715
6886
|
promise: promise
|
@@ -6765,15 +6936,32 @@ define("ember-data/system/model/model",
|
|
6765
6936
|
|
6766
6937
|
@method trigger
|
6767
6938
|
@private
|
6768
|
-
@param name
|
6939
|
+
@param {String} name
|
6769
6940
|
*/
|
6770
|
-
trigger: function(
|
6771
|
-
|
6941
|
+
trigger: function() {
|
6942
|
+
var length = arguments.length;
|
6943
|
+
var args = new Array(length - 1);
|
6944
|
+
var name = arguments[0];
|
6945
|
+
|
6946
|
+
for (var i = 1; i < length; i++ ){
|
6947
|
+
args[i - 1] = arguments[i];
|
6948
|
+
}
|
6949
|
+
|
6950
|
+
Ember.tryInvoke(this, name, args);
|
6772
6951
|
this._super.apply(this, arguments);
|
6773
6952
|
},
|
6774
6953
|
|
6775
6954
|
triggerLater: function() {
|
6776
|
-
|
6955
|
+
var length = arguments.length;
|
6956
|
+
var args = new Array(length);
|
6957
|
+
|
6958
|
+
for (var i = 0; i < length; i++ ){
|
6959
|
+
args[i] = arguments[i];
|
6960
|
+
}
|
6961
|
+
|
6962
|
+
if (this._deferredTriggers.push(args) !== 1) {
|
6963
|
+
return;
|
6964
|
+
}
|
6777
6965
|
Ember.run.schedule('actions', this, '_triggerDeferredTriggers');
|
6778
6966
|
},
|
6779
6967
|
|
@@ -7155,7 +7343,7 @@ define("ember-data/system/model/states",
|
|
7155
7343
|
// EVENTS
|
7156
7344
|
deleteRecord: function(record) {
|
7157
7345
|
record.transitionTo('deleted.uncommitted');
|
7158
|
-
record.
|
7346
|
+
record.disconnectRelationships();
|
7159
7347
|
},
|
7160
7348
|
|
7161
7349
|
didSetProperty: function(record, context) {
|
@@ -7236,7 +7424,7 @@ define("ember-data/system/model/states",
|
|
7236
7424
|
});
|
7237
7425
|
|
7238
7426
|
createdState.uncommitted.deleteRecord = function(record) {
|
7239
|
-
record.
|
7427
|
+
record.disconnectRelationships();
|
7240
7428
|
record.transitionTo('deleted.saved');
|
7241
7429
|
};
|
7242
7430
|
|
@@ -7254,7 +7442,7 @@ define("ember-data/system/model/states",
|
|
7254
7442
|
|
7255
7443
|
updatedState.uncommitted.deleteRecord = function(record) {
|
7256
7444
|
record.transitionTo('deleted.uncommitted');
|
7257
|
-
record.
|
7445
|
+
record.disconnectRelationships();
|
7258
7446
|
};
|
7259
7447
|
|
7260
7448
|
var RootState = {
|
@@ -7395,7 +7583,7 @@ define("ember-data/system/model/states",
|
|
7395
7583
|
|
7396
7584
|
deleteRecord: function(record) {
|
7397
7585
|
record.transitionTo('deleted.uncommitted');
|
7398
|
-
record.
|
7586
|
+
record.disconnectRelationships();
|
7399
7587
|
},
|
7400
7588
|
|
7401
7589
|
unloadRecord: function(record) {
|
@@ -7552,6 +7740,7 @@ define("ember-data/system/promise_proxies",
|
|
7552
7740
|
function(__exports__) {
|
7553
7741
|
"use strict";
|
7554
7742
|
var Promise = Ember.RSVP.Promise;
|
7743
|
+
var get = Ember.get;
|
7555
7744
|
|
7556
7745
|
/**
|
7557
7746
|
A `PromiseArray` is an object that acts like both an `Ember.Array`
|
@@ -7627,14 +7816,37 @@ define("ember-data/system/promise_proxies",
|
|
7627
7816
|
});
|
7628
7817
|
};
|
7629
7818
|
|
7819
|
+
/**
|
7820
|
+
A PromiseManyArray is a PromiseArray that also proxies certain method calls
|
7821
|
+
to the underlying manyArray.
|
7822
|
+
Right now we proxy:
|
7823
|
+
`reload()`
|
7824
|
+
*/
|
7825
|
+
|
7826
|
+
var PromiseManyArray = PromiseArray.extend({
|
7827
|
+
reload: function() {
|
7828
|
+
//I don't think this should ever happen right now, but worth guarding if we refactor the async relationships
|
7829
|
+
return get(this, 'content').reload();
|
7830
|
+
}
|
7831
|
+
});
|
7832
|
+
|
7833
|
+
var promiseManyArray = function(promise, label) {
|
7834
|
+
return PromiseManyArray.create({
|
7835
|
+
promise: Promise.resolve(promise, label)
|
7836
|
+
});
|
7837
|
+
};
|
7838
|
+
|
7839
|
+
|
7630
7840
|
__exports__.PromiseArray = PromiseArray;
|
7631
7841
|
__exports__.PromiseObject = PromiseObject;
|
7842
|
+
__exports__.PromiseManyArray = PromiseManyArray;
|
7632
7843
|
__exports__.promiseArray = promiseArray;
|
7633
7844
|
__exports__.promiseObject = promiseObject;
|
7845
|
+
__exports__.promiseManyArray = promiseManyArray;
|
7634
7846
|
});
|
7635
7847
|
define("ember-data/system/record_array_manager",
|
7636
|
-
["ember-data/system/record_arrays","exports"],
|
7637
|
-
function(__dependency1__, __exports__) {
|
7848
|
+
["ember-data/system/record_arrays","ember-data/system/map","exports"],
|
7849
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
7638
7850
|
"use strict";
|
7639
7851
|
/**
|
7640
7852
|
@module ember-data
|
@@ -7644,6 +7856,8 @@ define("ember-data/system/record_array_manager",
|
|
7644
7856
|
var FilteredRecordArray = __dependency1__.FilteredRecordArray;
|
7645
7857
|
var AdapterPopulatedRecordArray = __dependency1__.AdapterPopulatedRecordArray;
|
7646
7858
|
var ManyArray = __dependency1__.ManyArray;
|
7859
|
+
var MapWithDefault = __dependency2__.MapWithDefault;
|
7860
|
+
var OrderedSet = __dependency2__.OrderedSet;
|
7647
7861
|
var get = Ember.get;
|
7648
7862
|
var forEach = Ember.EnumerableUtils.forEach;
|
7649
7863
|
|
@@ -7655,7 +7869,7 @@ define("ember-data/system/record_array_manager",
|
|
7655
7869
|
*/
|
7656
7870
|
__exports__["default"] = Ember.Object.extend({
|
7657
7871
|
init: function() {
|
7658
|
-
this.filteredRecordArrays =
|
7872
|
+
this.filteredRecordArrays = MapWithDefault.create({
|
7659
7873
|
defaultValue: function() { return []; }
|
7660
7874
|
});
|
7661
7875
|
|
@@ -7670,7 +7884,7 @@ define("ember-data/system/record_array_manager",
|
|
7670
7884
|
},
|
7671
7885
|
|
7672
7886
|
recordArraysForRecord: function(record) {
|
7673
|
-
record._recordArrays = record._recordArrays ||
|
7887
|
+
record._recordArrays = record._recordArrays || OrderedSet.create();
|
7674
7888
|
return record._recordArrays;
|
7675
7889
|
},
|
7676
7890
|
|
@@ -7703,9 +7917,11 @@ define("ember-data/system/record_array_manager",
|
|
7703
7917
|
|
7704
7918
|
if (!recordArrays) { return; }
|
7705
7919
|
|
7706
|
-
forEach(
|
7920
|
+
recordArrays.forEach(function(array){
|
7707
7921
|
array.removeRecord(record);
|
7708
7922
|
});
|
7923
|
+
|
7924
|
+
record._recordArrays = null;
|
7709
7925
|
},
|
7710
7926
|
|
7711
7927
|
_recordWasChanged: function (record) {
|
@@ -7757,7 +7973,7 @@ define("ember-data/system/record_array_manager",
|
|
7757
7973
|
recordArrays.add(array);
|
7758
7974
|
}
|
7759
7975
|
} else if (!shouldBeInArray) {
|
7760
|
-
recordArrays
|
7976
|
+
recordArrays["delete"](array);
|
7761
7977
|
array.removeRecord(record);
|
7762
7978
|
}
|
7763
7979
|
},
|
@@ -7770,9 +7986,9 @@ define("ember-data/system/record_array_manager",
|
|
7770
7986
|
method is invoked when the filter is created in th first place.
|
7771
7987
|
|
7772
7988
|
@method updateFilter
|
7773
|
-
@param array
|
7774
|
-
@param type
|
7775
|
-
@param filter
|
7989
|
+
@param {Array} array
|
7990
|
+
@param {String} type
|
7991
|
+
@param {Function} filter
|
7776
7992
|
*/
|
7777
7993
|
updateFilter: function(array, type, filter) {
|
7778
7994
|
var typeMap = this.store.typeMapFor(type);
|
@@ -8146,22 +8362,6 @@ define("ember-data/system/record_arrays/many_array",
|
|
8146
8362
|
this._super.apply(this, arguments);
|
8147
8363
|
},
|
8148
8364
|
|
8149
|
-
/**
|
8150
|
-
The property name of the relationship
|
8151
|
-
|
8152
|
-
@property {String} name
|
8153
|
-
@private
|
8154
|
-
*/
|
8155
|
-
name: null,
|
8156
|
-
|
8157
|
-
/**
|
8158
|
-
The record to which this relationship belongs.
|
8159
|
-
|
8160
|
-
@property {DS.Model} owner
|
8161
|
-
@private
|
8162
|
-
*/
|
8163
|
-
owner: null,
|
8164
|
-
|
8165
8365
|
/**
|
8166
8366
|
`true` if the relationship is polymorphic, `false` otherwise.
|
8167
8367
|
|
@@ -8224,6 +8424,13 @@ define("ember-data/system/record_arrays/many_array",
|
|
8224
8424
|
this.get('relationship').addRecords(objects, idx);
|
8225
8425
|
}
|
8226
8426
|
},
|
8427
|
+
/**
|
8428
|
+
@method reload
|
8429
|
+
@public
|
8430
|
+
*/
|
8431
|
+
reload: function() {
|
8432
|
+
return this.relationship.reload();
|
8433
|
+
},
|
8227
8434
|
|
8228
8435
|
/**
|
8229
8436
|
Create a child record within the owner
|
@@ -8443,7 +8650,7 @@ define("ember-data/system/record_arrays/record_array",
|
|
8443
8650
|
var recordArrays = record._recordArrays;
|
8444
8651
|
|
8445
8652
|
if (recordArrays) {
|
8446
|
-
recordArrays
|
8653
|
+
recordArrays["delete"](array);
|
8447
8654
|
}
|
8448
8655
|
});
|
8449
8656
|
},
|
@@ -8580,7 +8787,11 @@ define("ember-data/system/relationships/belongs_to",
|
|
8580
8787
|
if ( value === undefined ) {
|
8581
8788
|
value = null;
|
8582
8789
|
}
|
8583
|
-
|
8790
|
+
if (value && value.then) {
|
8791
|
+
this._relationships[key].setRecordPromise(value);
|
8792
|
+
} else {
|
8793
|
+
this._relationships[key].setRecord(value);
|
8794
|
+
}
|
8584
8795
|
}
|
8585
8796
|
|
8586
8797
|
return this._relationships[key].getRecord();
|
@@ -8607,14 +8818,17 @@ define("ember-data/system/relationships/belongs_to",
|
|
8607
8818
|
__exports__["default"] = belongsTo;
|
8608
8819
|
});
|
8609
8820
|
define("ember-data/system/relationships/ext",
|
8610
|
-
["ember-data/system/relationship-meta","ember-data/system/model"],
|
8611
|
-
function(__dependency1__, __dependency2__) {
|
8821
|
+
["ember-data/system/relationship-meta","ember-data/system/model","ember-data/system/map"],
|
8822
|
+
function(__dependency1__, __dependency2__, __dependency3__) {
|
8612
8823
|
"use strict";
|
8613
8824
|
var typeForRelationshipMeta = __dependency1__.typeForRelationshipMeta;
|
8614
8825
|
var relationshipFromMeta = __dependency1__.relationshipFromMeta;
|
8615
8826
|
var Model = __dependency2__.Model;
|
8827
|
+
var Map = __dependency3__.Map;
|
8828
|
+
var MapWithDefault = __dependency3__.MapWithDefault;
|
8616
8829
|
|
8617
8830
|
var get = Ember.get;
|
8831
|
+
var filter = Ember.ArrayPolyfills.filter;
|
8618
8832
|
|
8619
8833
|
/**
|
8620
8834
|
@module ember-data
|
@@ -8653,9 +8867,9 @@ define("ember-data/system/relationships/ext",
|
|
8653
8867
|
property returned by `DS.belongsTo` as the value.
|
8654
8868
|
|
8655
8869
|
@method didDefineProperty
|
8656
|
-
@param proto
|
8657
|
-
@param key
|
8658
|
-
@param value
|
8870
|
+
@param {Object} proto
|
8871
|
+
@param {String} key
|
8872
|
+
@param {Ember.ComputedProperty} value
|
8659
8873
|
*/
|
8660
8874
|
didDefineProperty: function(proto, key, value) {
|
8661
8875
|
// Check if the value being set is a computed property.
|
@@ -8689,6 +8903,7 @@ define("ember-data/system/relationships/ext",
|
|
8689
8903
|
*/
|
8690
8904
|
|
8691
8905
|
Model.reopenClass({
|
8906
|
+
|
8692
8907
|
/**
|
8693
8908
|
For a given relationship name, returns the model type of the relationship.
|
8694
8909
|
|
@@ -8712,17 +8927,59 @@ define("ember-data/system/relationships/ext",
|
|
8712
8927
|
return relationship && relationship.type;
|
8713
8928
|
},
|
8714
8929
|
|
8930
|
+
inverseMap: Ember.computed(function() {
|
8931
|
+
return Object.create(null);
|
8932
|
+
}),
|
8933
|
+
|
8934
|
+
/*
|
8935
|
+
Find the relationship which is the inverse of the one asked for.
|
8936
|
+
|
8937
|
+
For example, if you define models like this:
|
8938
|
+
|
8939
|
+
```javascript
|
8940
|
+
App.Post = DS.Model.extend({
|
8941
|
+
comments: DS.hasMany('message')
|
8942
|
+
});
|
8943
|
+
|
8944
|
+
App.Message = DS.Model.extend({
|
8945
|
+
owner: DS.belongsTo('post')
|
8946
|
+
});
|
8947
|
+
```
|
8948
|
+
|
8949
|
+
App.Post.inverseFor('comments') -> {type: App.Message, name:'owner', kind:'belongsTo'}
|
8950
|
+
App.Message.inverseFor('owner') -> {type: App.Post, name:'comments', kind:'hasMany'}
|
8951
|
+
|
8952
|
+
@method inverseFor
|
8953
|
+
@static
|
8954
|
+
@param {String} name the name of the relationship
|
8955
|
+
@return {Object} the inverse relationship, or null
|
8956
|
+
*/
|
8715
8957
|
inverseFor: function(name) {
|
8716
|
-
var
|
8958
|
+
var inverseMap = get(this, 'inverseMap');
|
8959
|
+
if (inverseMap[name]) {
|
8960
|
+
return inverseMap[name];
|
8961
|
+
} else {
|
8962
|
+
var inverse = this._findInverseFor(name);
|
8963
|
+
inverseMap[name] = inverse;
|
8964
|
+
return inverse;
|
8965
|
+
}
|
8966
|
+
},
|
8717
8967
|
|
8718
|
-
|
8968
|
+
//Calculate the inverse, ignoring the cache
|
8969
|
+
_findInverseFor: function(name) {
|
8719
8970
|
|
8720
|
-
var
|
8971
|
+
var inverseType = this.typeForRelationship(name);
|
8972
|
+
if (!inverseType) {
|
8973
|
+
return null;
|
8974
|
+
}
|
8721
8975
|
|
8976
|
+
//If inverse is manually specified to be null, like `comments: DS.hasMany('message', {inverse: null})`
|
8977
|
+
var options = this.metaForProperty(name).options;
|
8722
8978
|
if (options.inverse === null) { return null; }
|
8723
8979
|
|
8724
8980
|
var inverseName, inverseKind, inverse;
|
8725
8981
|
|
8982
|
+
//If inverse is specified manually, return the inverse
|
8726
8983
|
if (options.inverse) {
|
8727
8984
|
inverseName = options.inverse;
|
8728
8985
|
inverse = Ember.get(inverseType, 'relationshipsByName').get(inverseName);
|
@@ -8730,26 +8987,49 @@ define("ember-data/system/relationships/ext",
|
|
8730
8987
|
|
8731
8988
|
inverseKind = inverse.kind;
|
8732
8989
|
} else {
|
8990
|
+
//No inverse was specified manually, we need to use a heuristic to guess one
|
8733
8991
|
var possibleRelationships = findPossibleInverses(this, inverseType);
|
8734
8992
|
|
8735
8993
|
if (possibleRelationships.length === 0) { return null; }
|
8736
8994
|
|
8995
|
+
var filteredRelationships = filter.call(possibleRelationships, function(possibleRelationship) {
|
8996
|
+
var optionsForRelationship = inverseType.metaForProperty(possibleRelationship.name).options;
|
8997
|
+
return name === optionsForRelationship.inverse;
|
8998
|
+
});
|
8999
|
+
|
9000
|
+
|
9001
|
+
if (filteredRelationships.length === 1 ) {
|
9002
|
+
possibleRelationships = filteredRelationships;
|
9003
|
+
}
|
9004
|
+
|
8737
9005
|
|
8738
9006
|
inverseName = possibleRelationships[0].name;
|
8739
9007
|
inverseKind = possibleRelationships[0].kind;
|
8740
9008
|
}
|
8741
9009
|
|
8742
|
-
function findPossibleInverses(type, inverseType,
|
8743
|
-
possibleRelationships =
|
9010
|
+
function findPossibleInverses(type, inverseType, relationshipsSoFar) {
|
9011
|
+
var possibleRelationships = relationshipsSoFar || [];
|
8744
9012
|
|
8745
9013
|
var relationshipMap = get(inverseType, 'relationships');
|
8746
9014
|
if (!relationshipMap) { return; }
|
8747
9015
|
|
8748
9016
|
var relationships = relationshipMap.get(type);
|
9017
|
+
|
9018
|
+
relationships = filter.call(relationships, function(relationship) {
|
9019
|
+
var optionsForRelationship = inverseType.metaForProperty(relationship.name).options;
|
9020
|
+
|
9021
|
+
if (!optionsForRelationship.inverse){
|
9022
|
+
return true;
|
9023
|
+
}
|
9024
|
+
|
9025
|
+
return name === optionsForRelationship.inverse;
|
9026
|
+
});
|
9027
|
+
|
8749
9028
|
if (relationships) {
|
8750
|
-
possibleRelationships.push.apply(possibleRelationships,
|
9029
|
+
possibleRelationships.push.apply(possibleRelationships, relationships);
|
8751
9030
|
}
|
8752
9031
|
|
9032
|
+
//Recurse to support polymorphism
|
8753
9033
|
if (type.superclass) {
|
8754
9034
|
findPossibleInverses(type.superclass, inverseType, possibleRelationships);
|
8755
9035
|
}
|
@@ -8798,7 +9078,7 @@ define("ember-data/system/relationships/ext",
|
|
8798
9078
|
@readOnly
|
8799
9079
|
*/
|
8800
9080
|
relationships: Ember.computed(function() {
|
8801
|
-
var map = new
|
9081
|
+
var map = new MapWithDefault({
|
8802
9082
|
defaultValue: function() { return []; }
|
8803
9083
|
});
|
8804
9084
|
|
@@ -8946,7 +9226,7 @@ define("ember-data/system/relationships/ext",
|
|
8946
9226
|
@readOnly
|
8947
9227
|
*/
|
8948
9228
|
relationshipsByName: Ember.computed(function() {
|
8949
|
-
var map =
|
9229
|
+
var map = Map.create();
|
8950
9230
|
|
8951
9231
|
this.eachComputedProperty(function(name, meta) {
|
8952
9232
|
if (meta.isRelationship) {
|
@@ -8996,7 +9276,7 @@ define("ember-data/system/relationships/ext",
|
|
8996
9276
|
@readOnly
|
8997
9277
|
*/
|
8998
9278
|
fields: Ember.computed(function() {
|
8999
|
-
var map =
|
9279
|
+
var map = Map.create();
|
9000
9280
|
|
9001
9281
|
this.eachComputedProperty(function(name, meta) {
|
9002
9282
|
if (meta.isRelationship) {
|
@@ -9020,7 +9300,7 @@ define("ember-data/system/relationships/ext",
|
|
9020
9300
|
@param {any} binding the value to which the callback's `this` should be bound
|
9021
9301
|
*/
|
9022
9302
|
eachRelationship: function(callback, binding) {
|
9023
|
-
get(this, 'relationshipsByName').forEach(function(
|
9303
|
+
get(this, 'relationshipsByName').forEach(function(relationship, name) {
|
9024
9304
|
callback.call(binding, name, relationship);
|
9025
9305
|
});
|
9026
9306
|
},
|
@@ -9224,14 +9504,15 @@ define("ember-data/system/relationships/has_many",
|
|
9224
9504
|
__exports__["default"] = hasMany;
|
9225
9505
|
});
|
9226
9506
|
define("ember-data/system/relationships/relationship",
|
9227
|
-
["ember-data/system/promise_proxies","exports"],
|
9228
|
-
function(__dependency1__, __exports__) {
|
9507
|
+
["ember-data/system/promise_proxies","ember-data/system/map","exports"],
|
9508
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
9229
9509
|
"use strict";
|
9230
|
-
var
|
9510
|
+
var PromiseManyArray = __dependency1__.PromiseManyArray;
|
9231
9511
|
var PromiseObject = __dependency1__.PromiseObject;
|
9512
|
+
var OrderedSet = __dependency2__.OrderedSet;
|
9232
9513
|
|
9233
9514
|
var Relationship = function(store, record, inverseKey, relationshipMeta) {
|
9234
|
-
this.members = new
|
9515
|
+
this.members = new OrderedSet();
|
9235
9516
|
this.store = store;
|
9236
9517
|
this.key = relationshipMeta.key;
|
9237
9518
|
this.inverseKey = inverseKey;
|
@@ -9239,11 +9520,15 @@ define("ember-data/system/relationships/relationship",
|
|
9239
9520
|
this.key = relationshipMeta.key;
|
9240
9521
|
this.isAsync = relationshipMeta.options.async;
|
9241
9522
|
this.relationshipMeta = relationshipMeta;
|
9523
|
+
//This probably breaks for polymorphic relationship in complex scenarios, due to
|
9524
|
+
//multiple possible typeKeys
|
9525
|
+
this.inverseKeyForImplicit = this.store.modelFor(this.record.constructor).typeKey + this.key;
|
9526
|
+
//Cached promise when fetching the relationship from a link
|
9527
|
+
this.linkPromise = null;
|
9242
9528
|
};
|
9243
9529
|
|
9244
9530
|
Relationship.prototype = {
|
9245
9531
|
constructor: Relationship,
|
9246
|
-
hasFetchedLink: false,
|
9247
9532
|
|
9248
9533
|
destroy: Ember.K,
|
9249
9534
|
|
@@ -9253,6 +9538,18 @@ define("ember-data/system/relationships/relationship",
|
|
9253
9538
|
}, this);
|
9254
9539
|
},
|
9255
9540
|
|
9541
|
+
disconnect: function(){
|
9542
|
+
this.members.forEach(function(member) {
|
9543
|
+
this.removeRecordFromInverse(member);
|
9544
|
+
}, this);
|
9545
|
+
},
|
9546
|
+
|
9547
|
+
reconnect: function(){
|
9548
|
+
this.members.forEach(function(member) {
|
9549
|
+
this.addRecordToInverse(member);
|
9550
|
+
}, this);
|
9551
|
+
},
|
9552
|
+
|
9256
9553
|
removeRecords: function(records){
|
9257
9554
|
var that = this;
|
9258
9555
|
records.forEach(function(record){
|
@@ -9270,13 +9567,17 @@ define("ember-data/system/relationships/relationship",
|
|
9270
9567
|
});
|
9271
9568
|
},
|
9272
9569
|
|
9273
|
-
|
9274
9570
|
addRecord: function(record, idx) {
|
9275
9571
|
if (!this.members.has(record)) {
|
9276
9572
|
this.members.add(record);
|
9277
9573
|
this.notifyRecordRelationshipAdded(record, idx);
|
9278
9574
|
if (this.inverseKey) {
|
9279
9575
|
record._relationships[this.inverseKey].addRecord(this.record);
|
9576
|
+
} else {
|
9577
|
+
if (!record._implicitRelationships[this.inverseKeyForImplicit]) {
|
9578
|
+
record._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, record, this.key, {options:{}});
|
9579
|
+
}
|
9580
|
+
record._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record);
|
9280
9581
|
}
|
9281
9582
|
this.record.updateRecordArrays();
|
9282
9583
|
}
|
@@ -9284,31 +9585,64 @@ define("ember-data/system/relationships/relationship",
|
|
9284
9585
|
|
9285
9586
|
removeRecord: function(record) {
|
9286
9587
|
if (this.members.has(record)) {
|
9287
|
-
this.
|
9288
|
-
this.notifyRecordRelationshipRemoved(record);
|
9588
|
+
this.removeRecordFromOwn(record);
|
9289
9589
|
if (this.inverseKey) {
|
9290
|
-
|
9291
|
-
|
9292
|
-
if (
|
9293
|
-
|
9590
|
+
this.removeRecordFromInverse(record);
|
9591
|
+
} else {
|
9592
|
+
if (record._implicitRelationships[this.inverseKeyForImplicit]) {
|
9593
|
+
record._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record);
|
9294
9594
|
}
|
9295
9595
|
}
|
9296
|
-
this.record.updateRecordArrays();
|
9297
9596
|
}
|
9298
9597
|
},
|
9299
9598
|
|
9599
|
+
addRecordToInverse: function(record) {
|
9600
|
+
if (this.inverseKey) {
|
9601
|
+
record._relationships[this.inverseKey].addRecord(this.record);
|
9602
|
+
}
|
9603
|
+
},
|
9604
|
+
|
9605
|
+
removeRecordFromInverse: function(record) {
|
9606
|
+
var inverseRelationship = record._relationships[this.inverseKey];
|
9607
|
+
//Need to check for existence, as the record might unloading at the moment
|
9608
|
+
if (inverseRelationship) {
|
9609
|
+
inverseRelationship.removeRecordFromOwn(this.record);
|
9610
|
+
}
|
9611
|
+
},
|
9612
|
+
|
9613
|
+
removeRecordFromOwn: function(record) {
|
9614
|
+
this.members["delete"](record);
|
9615
|
+
this.notifyRecordRelationshipRemoved(record);
|
9616
|
+
this.record.updateRecordArrays();
|
9617
|
+
},
|
9618
|
+
|
9300
9619
|
updateLink: function(link) {
|
9301
9620
|
if (link !== this.link) {
|
9302
9621
|
this.link = link;
|
9303
|
-
this.
|
9622
|
+
this.linkPromise = null;
|
9304
9623
|
this.record.notifyPropertyChange(this.key);
|
9305
9624
|
}
|
9306
9625
|
},
|
9307
9626
|
|
9627
|
+
findLink: function() {
|
9628
|
+
if (this.linkPromise) {
|
9629
|
+
return this.linkPromise;
|
9630
|
+
} else {
|
9631
|
+
var promise = this.fetchLink();
|
9632
|
+
this.linkPromise = promise;
|
9633
|
+
return promise.then(function(result) {
|
9634
|
+
return result;
|
9635
|
+
});
|
9636
|
+
}
|
9637
|
+
},
|
9638
|
+
|
9308
9639
|
updateRecordsFromAdapter: function(records) {
|
9309
9640
|
//TODO Once we have adapter support, we need to handle updated and canonical changes
|
9310
9641
|
this.computeChanges(records);
|
9311
|
-
}
|
9642
|
+
},
|
9643
|
+
|
9644
|
+
notifyRecordRelationshipAdded: Ember.K,
|
9645
|
+
notifyRecordRelationshipRemoved: Ember.K
|
9312
9646
|
};
|
9313
9647
|
|
9314
9648
|
var ManyRelationship = function(store, record, inverseKey, relationshipMeta) {
|
@@ -9336,49 +9670,84 @@ define("ember-data/system/relationships/relationship",
|
|
9336
9670
|
this.record.notifyHasManyRemoved(this.key, record);
|
9337
9671
|
};
|
9338
9672
|
|
9673
|
+
ManyRelationship.prototype.reload = function() {
|
9674
|
+
var self = this;
|
9675
|
+
if (this.link) {
|
9676
|
+
return this.fetchLink();
|
9677
|
+
} else {
|
9678
|
+
return this.store.scheduleFetchMany(this.manyArray.toArray()).then(function() {
|
9679
|
+
//Goes away after the manyArray refactor
|
9680
|
+
self.manyArray.set('isLoaded', true);
|
9681
|
+
return self.manyArray;
|
9682
|
+
});
|
9683
|
+
}
|
9684
|
+
};
|
9685
|
+
|
9339
9686
|
ManyRelationship.prototype.computeChanges = function(records) {
|
9340
9687
|
var members = this.members;
|
9688
|
+
var recordsToRemove = [];
|
9689
|
+
var length;
|
9690
|
+
var record;
|
9691
|
+
var i;
|
9341
9692
|
|
9342
9693
|
records = setForArray(records);
|
9343
9694
|
|
9344
9695
|
members.forEach(function(member) {
|
9345
9696
|
if (records.has(member)) return;
|
9346
9697
|
|
9347
|
-
|
9348
|
-
}
|
9698
|
+
recordsToRemove.push(member);
|
9699
|
+
});
|
9700
|
+
this.removeRecords(recordsToRemove);
|
9349
9701
|
|
9350
9702
|
var hasManyArray = this.manyArray;
|
9351
9703
|
|
9352
|
-
records.
|
9704
|
+
// Using records.toArray() since currently using
|
9705
|
+
// removeRecord can modify length, messing stuff up
|
9706
|
+
// forEach since it directly looks at "length" each
|
9707
|
+
// iteration
|
9708
|
+
records = records.toArray();
|
9709
|
+
length = records.length;
|
9710
|
+
for (i = 0; i < length; i++){
|
9711
|
+
record = records[i];
|
9353
9712
|
//Need to preserve the order of incoming records
|
9354
|
-
if (hasManyArray.objectAt(
|
9355
|
-
|
9713
|
+
if (hasManyArray.objectAt(i) === record ) {
|
9714
|
+
continue;
|
9715
|
+
}
|
9356
9716
|
this.removeRecord(record);
|
9357
|
-
this.addRecord(record,
|
9358
|
-
}
|
9717
|
+
this.addRecord(record, i);
|
9718
|
+
}
|
9359
9719
|
};
|
9360
9720
|
|
9721
|
+
ManyRelationship.prototype.fetchLink = function() {
|
9722
|
+
var self = this;
|
9723
|
+
return this.store.findHasMany(this.record, this.link, this.relationshipMeta).then(function(records){
|
9724
|
+
self.updateRecordsFromAdapter(records);
|
9725
|
+
return self.manyArray;
|
9726
|
+
});
|
9727
|
+
};
|
9728
|
+
|
9729
|
+
ManyRelationship.prototype.findRecords = function() {
|
9730
|
+
var manyArray = this.manyArray;
|
9731
|
+
return this.store.findMany(manyArray.toArray()).then(function(){
|
9732
|
+
//Goes away after the manyArray refactor
|
9733
|
+
manyArray.set('isLoaded', true);
|
9734
|
+
return manyArray;
|
9735
|
+
});
|
9736
|
+
};
|
9361
9737
|
|
9362
9738
|
ManyRelationship.prototype.getRecords = function() {
|
9363
9739
|
if (this.isAsync) {
|
9364
9740
|
var self = this;
|
9365
9741
|
var promise;
|
9366
|
-
if (this.link
|
9367
|
-
promise = this.
|
9368
|
-
self.
|
9369
|
-
self.hasFetchedLink = true;
|
9370
|
-
//TODO(Igor) try to abstract the isLoaded part
|
9371
|
-
self.manyArray.set('isLoaded', true);
|
9372
|
-
return self.manyArray;
|
9742
|
+
if (this.link) {
|
9743
|
+
promise = this.findLink().then(function() {
|
9744
|
+
return self.findRecords();
|
9373
9745
|
});
|
9374
9746
|
} else {
|
9375
|
-
|
9376
|
-
promise = this.store.findMany(manyArray.toArray()).then(function(){
|
9377
|
-
self.manyArray.set('isLoaded', true);
|
9378
|
-
return manyArray;
|
9379
|
-
});
|
9747
|
+
promise = this.findRecords();
|
9380
9748
|
}
|
9381
|
-
return
|
9749
|
+
return PromiseManyArray.create({
|
9750
|
+
content: this.manyArray,
|
9382
9751
|
promise: promise
|
9383
9752
|
});
|
9384
9753
|
} else {
|
@@ -9390,10 +9759,8 @@ define("ember-data/system/relationships/relationship",
|
|
9390
9759
|
|
9391
9760
|
var BelongsToRelationship = function(store, record, inverseKey, relationshipMeta) {
|
9392
9761
|
this._super$constructor(store, record, inverseKey, relationshipMeta);
|
9393
|
-
this.members.add(record);
|
9394
9762
|
this.record = record;
|
9395
9763
|
this.key = relationshipMeta.key;
|
9396
|
-
this.inverseKey = inverseKey;
|
9397
9764
|
this.inverseRecord = null;
|
9398
9765
|
};
|
9399
9766
|
|
@@ -9414,7 +9781,7 @@ define("ember-data/system/relationships/relationship",
|
|
9414
9781
|
if (this.members.has(newRecord)){ return;}
|
9415
9782
|
var type = this.relationshipMeta.type;
|
9416
9783
|
|
9417
|
-
if (this.inverseRecord
|
9784
|
+
if (this.inverseRecord) {
|
9418
9785
|
this.removeRecord(this.inverseRecord);
|
9419
9786
|
}
|
9420
9787
|
|
@@ -9422,6 +9789,11 @@ define("ember-data/system/relationships/relationship",
|
|
9422
9789
|
this._super$addRecord(newRecord);
|
9423
9790
|
};
|
9424
9791
|
|
9792
|
+
BelongsToRelationship.prototype.setRecordPromise = function(newPromise) {
|
9793
|
+
var content = newPromise.get && newPromise.get('content');
|
9794
|
+
this.setRecord(content);
|
9795
|
+
};
|
9796
|
+
|
9425
9797
|
BelongsToRelationship.prototype.notifyRecordRelationshipAdded = function(newRecord) {
|
9426
9798
|
this.record.notifyBelongsToAdded(this.key, this);
|
9427
9799
|
};
|
@@ -9430,36 +9802,44 @@ define("ember-data/system/relationships/relationship",
|
|
9430
9802
|
this.record.notifyBelongsToRemoved(this.key, this);
|
9431
9803
|
};
|
9432
9804
|
|
9433
|
-
BelongsToRelationship.prototype._super$
|
9434
|
-
BelongsToRelationship.prototype.
|
9805
|
+
BelongsToRelationship.prototype._super$removeRecordFromOwn = Relationship.prototype.removeRecordFromOwn;
|
9806
|
+
BelongsToRelationship.prototype.removeRecordFromOwn = function(record) {
|
9435
9807
|
if (!this.members.has(record)){ return;}
|
9436
|
-
this._super$
|
9808
|
+
this._super$removeRecordFromOwn(record);
|
9437
9809
|
this.inverseRecord = null;
|
9438
9810
|
};
|
9439
9811
|
|
9440
|
-
BelongsToRelationship.prototype.
|
9441
|
-
|
9812
|
+
BelongsToRelationship.prototype.findRecord = function() {
|
9813
|
+
if (this.inverseRecord) {
|
9814
|
+
return this.store._findByRecord(this.inverseRecord);
|
9815
|
+
} else {
|
9816
|
+
return Ember.RSVP.Promise.resolve(null);
|
9817
|
+
}
|
9818
|
+
};
|
9819
|
+
|
9820
|
+
BelongsToRelationship.prototype.fetchLink = function() {
|
9821
|
+
var self = this;
|
9822
|
+
return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function(record){
|
9823
|
+
self.addRecord(record);
|
9824
|
+
return record;
|
9825
|
+
});
|
9442
9826
|
};
|
9443
9827
|
|
9444
9828
|
BelongsToRelationship.prototype.getRecord = function() {
|
9445
9829
|
if (this.isAsync) {
|
9446
9830
|
var promise;
|
9447
|
-
|
9448
|
-
if (this.link && !this.hasFetchedLink){
|
9831
|
+
if (this.link){
|
9449
9832
|
var self = this;
|
9450
|
-
promise = this.
|
9451
|
-
self.
|
9452
|
-
self.hasFetchedLink = true;
|
9453
|
-
return record;
|
9833
|
+
promise = this.findLink().then(function() {
|
9834
|
+
return self.findRecord();
|
9454
9835
|
});
|
9455
|
-
} else if (this.inverseRecord) {
|
9456
|
-
promise = this.store._findByRecord(this.inverseRecord);
|
9457
9836
|
} else {
|
9458
|
-
promise =
|
9837
|
+
promise = this.findRecord();
|
9459
9838
|
}
|
9460
9839
|
|
9461
9840
|
return PromiseObject.create({
|
9462
|
-
promise: promise
|
9841
|
+
promise: promise,
|
9842
|
+
content: this.inverseRecord
|
9463
9843
|
});
|
9464
9844
|
} else {
|
9465
9845
|
return this.inverseRecord;
|
@@ -9467,7 +9847,7 @@ define("ember-data/system/relationships/relationship",
|
|
9467
9847
|
};
|
9468
9848
|
|
9469
9849
|
function setForArray(array) {
|
9470
|
-
var set = new
|
9850
|
+
var set = new OrderedSet();
|
9471
9851
|
|
9472
9852
|
if (array) {
|
9473
9853
|
for (var i=0, l=array.length; i<l; i++) {
|
@@ -9501,8 +9881,8 @@ define("ember-data/system/relationships/relationship",
|
|
9501
9881
|
__exports__.createRelationshipFor = createRelationshipFor;
|
9502
9882
|
});
|
9503
9883
|
define("ember-data/system/store",
|
9504
|
-
["ember-data/system/adapter","ember-inflector/system/string","ember-data/system/promise_proxies","exports"],
|
9505
|
-
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
9884
|
+
["ember-data/system/adapter","ember-inflector/system/string","ember-data/system/map","ember-data/system/promise_proxies","exports"],
|
9885
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) {
|
9506
9886
|
"use strict";
|
9507
9887
|
/*globals Ember*/
|
9508
9888
|
/*jshint eqnull:true*/
|
@@ -9514,9 +9894,10 @@ define("ember-data/system/store",
|
|
9514
9894
|
var InvalidError = __dependency1__.InvalidError;
|
9515
9895
|
var Adapter = __dependency1__.Adapter;
|
9516
9896
|
var singularize = __dependency2__.singularize;
|
9897
|
+
var Map = __dependency3__.Map;
|
9517
9898
|
|
9518
|
-
var promiseArray =
|
9519
|
-
var promiseObject =
|
9899
|
+
var promiseArray = __dependency4__.promiseArray;
|
9900
|
+
var promiseObject = __dependency4__.promiseObject;
|
9520
9901
|
|
9521
9902
|
|
9522
9903
|
var get = Ember.get;
|
@@ -9651,7 +10032,7 @@ define("ember-data/system/store",
|
|
9651
10032
|
});
|
9652
10033
|
this._pendingSave = [];
|
9653
10034
|
//Used to keep track of all the find requests that need to be coalesced
|
9654
|
-
this._pendingFetch =
|
10035
|
+
this._pendingFetch = Map.create();
|
9655
10036
|
},
|
9656
10037
|
|
9657
10038
|
/**
|
@@ -10034,10 +10415,10 @@ define("ember-data/system/store",
|
|
10034
10415
|
}
|
10035
10416
|
|
10036
10417
|
this._pendingFetch.forEach(this._flushPendingFetchForType, this);
|
10037
|
-
this._pendingFetch =
|
10418
|
+
this._pendingFetch = Map.create();
|
10038
10419
|
},
|
10039
10420
|
|
10040
|
-
_flushPendingFetchForType: function (
|
10421
|
+
_flushPendingFetchForType: function (recordResolverPairs, type) {
|
10041
10422
|
var store = this;
|
10042
10423
|
var adapter = store.adapterFor(type);
|
10043
10424
|
var shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;
|
@@ -10628,7 +11009,7 @@ define("ember-data/system/store",
|
|
10628
11009
|
|
10629
11010
|
@method typeMapFor
|
10630
11011
|
@private
|
10631
|
-
@param type
|
11012
|
+
@param {subclass of DS.Model} type
|
10632
11013
|
@return {Object} typeMap
|
10633
11014
|
*/
|
10634
11015
|
typeMapFor: function(type) {
|
@@ -10689,7 +11070,7 @@ define("ember-data/system/store",
|
|
10689
11070
|
var factory;
|
10690
11071
|
|
10691
11072
|
if (typeof key === 'string') {
|
10692
|
-
factory = this.
|
11073
|
+
factory = this.modelFactoryFor(key);
|
10693
11074
|
if (!factory) {
|
10694
11075
|
throw new Ember.Error("No model was found for '" + key + "'");
|
10695
11076
|
}
|
@@ -10706,6 +11087,10 @@ define("ember-data/system/store",
|
|
10706
11087
|
return factory;
|
10707
11088
|
},
|
10708
11089
|
|
11090
|
+
modelFactoryFor: function(key){
|
11091
|
+
return this.container.lookupFactory('model:' + key);
|
11092
|
+
},
|
11093
|
+
|
10709
11094
|
/**
|
10710
11095
|
Push some data for a given type into the store.
|
10711
11096
|
|
@@ -10867,7 +11252,7 @@ define("ember-data/system/store",
|
|
10867
11252
|
```
|
10868
11253
|
|
10869
11254
|
@method normalize
|
10870
|
-
@param {String} The name of the model type for this payload
|
11255
|
+
@param {String} type The name of the model type for this payload
|
10871
11256
|
@param {Object} payload
|
10872
11257
|
@return {Object} The normalized payload
|
10873
11258
|
*/
|
@@ -11437,8 +11822,8 @@ define("ember-data/transforms/base",
|
|
11437
11822
|
```
|
11438
11823
|
|
11439
11824
|
@method serialize
|
11440
|
-
@param deserialized The deserialized value
|
11441
|
-
@return The serialized value
|
11825
|
+
@param {mixed} deserialized The deserialized value
|
11826
|
+
@return {mixed} The serialized value
|
11442
11827
|
*/
|
11443
11828
|
serialize: Ember.required(),
|
11444
11829
|
|
@@ -11455,8 +11840,8 @@ define("ember-data/transforms/base",
|
|
11455
11840
|
```
|
11456
11841
|
|
11457
11842
|
@method deserialize
|
11458
|
-
@param serialized The serialized value
|
11459
|
-
@return The deserialized value
|
11843
|
+
@param {mixed} serialized The serialized value
|
11844
|
+
@return {mixed} The deserialized value
|
11460
11845
|
*/
|
11461
11846
|
deserialize: Ember.required()
|
11462
11847
|
});
|