ember-data-source 2.4.0.beta.2 → 2.4.0.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- !function(){"use strict";var e,t,r,a;!function(){function i(e,t){try{return e()}finally{t()}}function n(e){throw new Error("an unsupported module was defined, expected `define(name, deps, module)` instead got: `"+e+"` arguments to define`")}function o(e,t,r,a){this.id=y++,this.name=e,this.deps=!t.length&&r.length?v:t,this.exports=a||{},this.callback=r,this.state=void 0,this._require=void 0}function s(e){this.name=e}function d(e,t,r){for(var a,i=e.deps,n=i.length,o=new Array(n),s={},d=0,u=n;u>d;d++)a=i[d],"exports"===a?s.exports=o[d]=r:"require"===a?o[d]=e.makeRequire():"module"===a?(e.exports=r,s=o[d]=e):o[d]=l(c(a,t),t);return{deps:o,module:s}}function l(e,t){var a=p[e];if(!a)throw new Error("Could not find module `"+e+"` imported from `"+t+"`");return r(e)}function u(e){throw new Error("Could not find module "+e)}function c(e,t){if("."!==e.charAt(0))return e;for(var r=e.split("/"),a=t.split("/"),i=a.slice(0,-1),n=0,o=r.length;o>n;n++){var s=r[n];if(".."===s){if(0===i.length)throw new Error("Cannot access parent module of root");i.pop()}else{if("."===s)continue;i.push(s)}}return i.join("/")}var h;h=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var p={},f={},m=!1,y=0,v=["require","exports","module"];o.prototype.makeRequire=function(){var e=this.name;return this._require||(this._require=function(t){return r(c(t,e))})},e=function(e,t,r){arguments.length<2&&n(arguments.length),h(t)||(r=t,t=[]),p[e]=new o(e,t,r)},e.petal={},e.alias=function(e){return new s(e)},a=r=t=function(e){var t=p[e];if(t&&t.callback instanceof s&&(t=p[t.callback.name]),t||u(e),t.state!==m&&f.hasOwnProperty(e))return f[e];var r,a,n=!1;f[e]={},i(function(){r=d(t,e,f[e]),a=t.callback.apply(this,r.deps),n=!0},function(){n||(t.state=m)});var o;return o=void 0===a&&r.module.exports?r.module.exports:f[e]=a,null===o||"object"!=typeof o&&"function"!=typeof o||void 0!==o["default"]||(o["default"]=o),f[e]=o},a.entries=a._eak_seen=p,a.unsee=function(e){delete f[e]},a.clear=function(){a.entries=a._eak_seen=p={},f=state={}}}(),e("ember-data/-private/adapters",["exports","ember-data/adapters/json-api","ember-data/adapters/rest"],function(e,t,r){e.JSONAPIAdapter=t["default"],e.RESTAdapter=r["default"]}),e("ember-data/-private/adapters/build-url-mixin",["exports","ember"],function(e,t){var r=t["default"].get;e["default"]=t["default"].Mixin.create({buildURL:function(e,t,r,a,i){switch(a){case"findRecord":return this.urlForFindRecord(t,e,r);case"findAll":return this.urlForFindAll(e);case"query":return this.urlForQuery(i,e);case"queryRecord":return this.urlForQueryRecord(i,e);case"findMany":return this.urlForFindMany(t,e,r);case"findHasMany":return this.urlForFindHasMany(t,e);case"findBelongsTo":return this.urlForFindBelongsTo(t,e);case"createRecord":return this.urlForCreateRecord(e,r);case"updateRecord":return this.urlForUpdateRecord(t,e,r);case"deleteRecord":return this.urlForDeleteRecord(t,e,r);default:return this._buildURL(e,t)}},_buildURL:function(e,t){var a,i=[],n=r(this,"host"),o=this.urlPrefix();return e&&(a=this.pathForType(e),a&&i.push(a)),t&&i.push(encodeURIComponent(t)),o&&i.unshift(o),i=i.join("/"),!n&&i&&"/"!==i.charAt(0)&&(i="/"+i),i},urlForFindRecord:function(e,t,r){return this._buildURL(t,e)},urlForFindAll:function(e){return this._buildURL(e)},urlForQuery:function(e,t){return this._buildURL(t)},urlForQueryRecord:function(e,t){return this._buildURL(t)},urlForFindMany:function(e,t,r){return this._buildURL(t)},urlForFindHasMany:function(e,t){return this._buildURL(t,e)},urlForFindBelongsTo:function(e,t){return this._buildURL(t,e)},urlForCreateRecord:function(e,t){return this._buildURL(e)},urlForUpdateRecord:function(e,t,r){return this._buildURL(t,e)},urlForDeleteRecord:function(e,t,r){return this._buildURL(t,e)},urlPrefix:function(e,t){var a=r(this,"host"),i=r(this,"namespace");if(a&&"/"!==a||(a=""),e)return/^\/\//.test(e)||/http(s)?:\/\//.test(e)?e:"/"===e.charAt(0)?""+a+e:t+"/"+e;var n=[];return a&&n.push(a),i&&n.push(i),n.join("/")},pathForType:function(e){var r=t["default"].String.camelize(e);return t["default"].String.pluralize(r)}})}),e("ember-data/-private/adapters/errors",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){var t=arguments.length<=1||void 0===arguments[1]?"Adapter operation failed":arguments[1];this.isAdapterError=!0,l.call(this,t),this.errors=e||[{title:"Adapter Error",detail:t}]}function i(e){a.call(this,e,"The adapter rejected the commit because it was invalid")}function n(){a.call(this,null,"The adapter operation timed out")}function o(){a.call(this,null,"The adapter operation was aborted")}function s(e){var r=[];return t["default"].isPresent(e)&&Object.keys(e).forEach(function(a){for(var i=t["default"].makeArray(e[a]),n=0;n<i.length;n++){var o="Invalid Attribute",s="/data/attributes/"+a;a===h&&(o="Invalid Document",s="/data"),r.push({title:o,detail:i[n],source:{pointer:s}})}}),r}function d(e){var r={};return t["default"].isPresent(e)&&e.forEach(function(e){if(e.source&&e.source.pointer){var t=e.source.pointer.match(u);t?t=t[2]:-1!==e.source.pointer.search(c)&&(t=h),t&&(r[t]=r[t]||[],r[t].push(e.detail||e.title))}}),r}e.AdapterError=a,e.InvalidError=i,e.TimeoutError=n,e.AbortError=o,e.errorsHashToArray=s,e.errorsArrayToHash=d;var l=t["default"].Error,u=/^\/?data\/(attributes|relationships)\/(.*)/,c=/^\/?data/,h="base";a.prototype=Object.create(l.prototype),i.prototype=Object.create(a.prototype),n.prototype=Object.create(a.prototype),o.prototype=Object.create(a.prototype)}),e("ember-data/-private/core",["exports","ember","ember-data/version"],function(e,t,r){var a=t["default"].Namespace.create({VERSION:r["default"]});t["default"].libraries&&t["default"].libraries.registerCoreLibrary("Ember Data",a.VERSION),e["default"]=a}),e("ember-data/-private/debug",["exports","ember"],function(e,t){function r(){return t["default"].assert.apply(t["default"],arguments)}function a(){return t["default"].debug.apply(t["default"],arguments)}function i(){return t["default"].deprecate.apply(t["default"],arguments)}function n(){return t["default"].info.apply(t["default"],arguments)}function o(){return t["default"].runInDebug.apply(t["default"],arguments)}function s(){return t["default"].warn.apply(t["default"],arguments)}function d(){return t["default"].debugSeal.apply(t["default"],arguments)}e.assert=r,e.debug=a,e.deprecate=i,e.info=n,e.runInDebug=o,e.warn=s,e.debugSeal=d}),e("ember-data/-private/ext/date",["exports","ember"],function(e,t){t["default"].Date=t["default"].Date||{};var r=Date.parse,a=[1,4,5,6,7,10,11];t["default"].Date.parse=function(e){var t,i,n=0;if(i=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(e)){for(var o,s=0;o=a[s];++s)i[o]=+i[o]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,"Z"!==i[8]&&void 0!==i[9]&&(n=60*i[10]+i[11],"+"===i[9]&&(n=0-n)),t=Date.UTC(i[1],i[2],i[3],i[4],i[5]+n,i[6],i[7])}else t=r?r(e):NaN;return t},(t["default"].EXTEND_PROTOTYPES===!0||t["default"].EXTEND_PROTOTYPES.Date)&&(Date.parse=t["default"].Date.parse)}),e("ember-data/-private/features",["exports","ember"],function(e,t){function r(){var e;return(e=t["default"].FEATURES).isEnabled.apply(e,arguments)}e["default"]=r}),e("ember-data/-private/initializers/data-adapter",["exports","ember-data/-private/system/debug/debug-adapter"],function(e,t){function r(e){e.register("data-adapter:main",t["default"])}e["default"]=r}),e("ember-data/-private/initializers/store-injections",["exports"],function(e){function t(e){var t=e.inject||e.injection;t.call(e,"controller","store","service:store"),t.call(e,"route","store","service:store"),t.call(e,"data-adapter","store","service:store")}e["default"]=t}),e("ember-data/-private/initializers/store",["exports","ember-data/-private/system/store","ember-data/-private/serializers","ember-data/-private/adapters"],function(e,t,r,a){function i(e,t){return e.has?e.has(t):e.hasRegistration(t)}function n(e){var n=e.registerOptionsForType||e.optionsForType;n.call(e,"serializer",{singleton:!1}),n.call(e,"adapter",{singleton:!1}),e.register("serializer:-default",r.JSONSerializer),e.register("serializer:-rest",r.RESTSerializer),e.register("adapter:-rest",a.RESTAdapter),e.register("adapter:-json-api",a.JSONAPIAdapter),e.register("serializer:-json-api",r.JSONAPISerializer),i(e,"service:store")||e.register("service:store",t["default"])}e["default"]=n}),e("ember-data/-private/initializers/transforms",["exports","ember-data/-private/transforms"],function(e,t){function r(e){e.register("transform:boolean",t.BooleanTransform),e.register("transform:date",t.DateTransform),e.register("transform:number",t.NumberTransform),e.register("transform:string",t.StringTransform)}e["default"]=r}),e("ember-data/-private/instance-initializers/initialize-store-service",["exports"],function(e){function t(e){var t=e.lookup?e:e.container;t.lookup("service:store")}e["default"]=t}),e("ember-data/-private/serializers",["exports","ember-data/serializers/json-api","ember-data/serializers/json","ember-data/serializers/rest"],function(e,t,r,a){e.JSONAPISerializer=t["default"],e.JSONSerializer=r["default"],e.RESTSerializer=a["default"]}),e("ember-data/-private/serializers/embedded-records-mixin",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var i=t["default"].get,n=t["default"].set,o=t["default"].String.camelize;e["default"]=t["default"].Mixin.create({normalize:function(e,t,r){var a=this._super(e,t,r);return this._extractEmbeddedRecords(this,this.store,e,a)},keyForRelationship:function(e,t,r){return"serialize"===r&&this.hasSerializeRecordsOption(e)||"deserialize"===r&&this.hasDeserializeRecordsOption(e)?this.keyForAttribute(e,r):this._super(e,t,r)||e},serializeBelongsTo:function(e,t,r){var a=r.key;if(this.noSerializeOptionSpecified(a))return void this._super(e,t,r);var i,n=this.hasSerializeIdsOption(a),o=this.hasSerializeRecordsOption(a),s=e.belongsTo(a);n?(i=this.keyForRelationship(a,r.kind,"serialize"),s?(t[i]=s.id,r.options.polymorphic&&this.serializePolymorphicType(e,t,r)):t[i]=null):o&&this._serializeEmbeddedBelongsTo(e,t,r)},_serializeEmbeddedBelongsTo:function(e,t,r){var a=e.belongsTo(r.key),i=this.keyForRelationship(r.key,r.kind,"serialize");a?(t[i]=a.record.serialize({includeId:!0}),this.removeEmbeddedForeignKey(e,a,r,t[i]),r.options.polymorphic&&this.serializePolymorphicType(e,t,r)):t[i]=null},serializeHasMany:function(e,t,r){var a=r.key;if(this.noSerializeOptionSpecified(a))return void this._super(e,t,r);var i=this.hasSerializeIdsOption(a),n=this.hasSerializeRecordsOption(a);if(i){var o=this.keyForRelationship(a,r.kind,"serialize");t[o]=e.hasMany(a,{ids:!0})}else n&&this._serializeEmbeddedHasMany(e,t,r)},_serializeEmbeddedHasMany:function(e,t,r){var a=this.keyForRelationship(r.key,r.kind,"serialize");t[a]=this._generateSerializedHasMany(e,r)},_generateSerializedHasMany:function(e,r){for(var a=e.hasMany(r.key),i=t["default"].A(a),n=new Array(i.length),o=0;o<i.length;o++){var s=i[o],d=s.record.serialize({includeId:!0});this.removeEmbeddedForeignKey(e,s,r,d),n[o]=d}return n},removeEmbeddedForeignKey:function(e,t,r,a){if("hasMany"!==r.kind&&"belongsTo"===r.kind){var i=e.type.inverseFor(r.key,this.store);if(i){var n=i.name,o=this.store.serializerFor(t.modelName),s=o.keyForRelationship(n,i.kind,"deserialize");s&&delete a[s]}}},hasEmbeddedAlwaysOption:function(e){var t=this.attrsOption(e);return t&&"always"===t.embedded},hasSerializeRecordsOption:function(e){var t=this.hasEmbeddedAlwaysOption(e),r=this.attrsOption(e);return t||r&&"records"===r.serialize},hasSerializeIdsOption:function(e){var t=this.attrsOption(e);return t&&("ids"===t.serialize||"id"===t.serialize)},noSerializeOptionSpecified:function(e){var t=this.attrsOption(e);return!(t&&(t.serialize||t.embedded))},hasDeserializeRecordsOption:function(e){var t=this.hasEmbeddedAlwaysOption(e),r=this.attrsOption(e);return t||r&&"records"===r.deserialize},attrsOption:function(e){var t=this.get("attrs");return t&&(t[o(e)]||t[e])},_extractEmbeddedRecords:function(e,t,r,a){var i=this;return r.eachRelationship(function(r,n){e.hasDeserializeRecordsOption(r)&&("hasMany"===n.kind&&i._extractEmbeddedHasMany(t,r,a,n),"belongsTo"===n.kind&&i._extractEmbeddedBelongsTo(t,r,a,n))}),a},_extractEmbeddedHasMany:function(e,t,r,o){var s=i(r,"data.relationships."+t+".data");if(s){for(var d=new Array(s.length),l=0;l<s.length;l++){var u=s[l],c=this._normalizeEmbeddedRelationship(e,o,u),h=c.data,p=c.included;if(r.included=r.included||[],r.included.push(h),p){var f;(f=r.included).push.apply(f,a(p))}d[l]={id:h.id,type:h.type}}var m={data:d};n(r,"data.relationships."+t,m)}},_extractEmbeddedBelongsTo:function(e,t,r,o){var s=i(r,"data.relationships."+t+".data");if(s){var d=this._normalizeEmbeddedRelationship(e,o,s),l=d.data,u=d.included;if(r.included=r.included||[],r.included.push(l),u){var c;(c=r.included).push.apply(c,a(u))}var h={id:l.id,type:l.type},p={data:h};n(r,"data.relationships."+t,p)}},_normalizeEmbeddedRelationship:function(e,t,r){var a=t.type;t.options.polymorphic&&(a=r.type);var i=e.modelFor(a),n=e.serializerFor(a);return n.normalize(i,r,null)}})}),e("ember-data/-private/system/clone-null",["exports","ember-data/-private/system/empty-object"],function(e,t){function r(e){var r=new t["default"];for(var a in e)r[a]=e[a];return r}e["default"]=r}),e("ember-data/-private/system/coerce-id",["exports"],function(e){function t(e){return null==e||""===e?null:e+""}e["default"]=t}),e("ember-data/-private/system/container-proxy",["exports","ember-data/-private/debug"],function(e,t){function r(e){this.container=e}e["default"]=r,r.prototype.aliasedFactory=function(e,t){var r=this;return{create:function(){return t&&t(),r.container.lookup(e)}}},r.prototype.registerAlias=function(e,t,r){var a=this.aliasedFactory(t,r);return this.container.register(e,a)},r.prototype.registerDeprecation=function(e,t){var r=function(){};return this.registerAlias(e,t,r)},r.prototype.registerDeprecations=function(e){var t,r,a,i;for(t=e.length;t>0;t--)r=e[t-1],a=r.deprecated,i=r.valid,this.registerDeprecation(a,i)}}),e("ember-data/-private/system/debug",["exports","ember-data/-private/system/debug/debug-adapter"],function(e,t){e["default"]=t["default"]}),e("ember-data/-private/system/debug/debug-adapter",["exports","ember","ember-data/model"],function(e,t,r){var a=t["default"].get,i=t["default"].String.capitalize,n=t["default"].String.underscore,o=t["default"].assert;e["default"]=t["default"].DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==r["default"]&&r["default"].detect(e)},columnsForType:function(e){var t=[{name:"id",desc:"Id"}],r=0,o=this;return a(e,"attributes").forEach(function(e,a){if(r++>o.attributeLimit)return!1;var s=i(n(a).replace("_"," "));t.push({name:a,desc:s})}),t},getRecords:function(e,t){if(arguments.length<2){var r=e._debugContainerKey;if(r){var a=r.match(/model:(.*)/);a&&(t=a[1])}}return o("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support",!!t),this.get("store").peekAll(t)},getRecordColumnValues:function(e){var t=this,r=0,i={id:a(e,"id")};return e.eachAttribute(function(n){if(r++>t.attributeLimit)return!1;var o=a(e,n);i[n]=o}),i},getRecordKeywords:function(e){var r=[],i=t["default"].A(["id"]);return e.eachAttribute(function(e){return i.push(e)}),i.forEach(function(t){return r.push(a(e,t))}),r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("hasDirtyAttributes")&&!e.get("isNew"),isClean:!e.get("hasDirtyAttributes")}},getRecordColor:function(e){var t="black";return e.get("isNew")?t="green":e.get("hasDirtyAttributes")&&(t="blue"),t},observeRecord:function(e,r){var a=t["default"].A(),i=t["default"].A(["id","isNew","hasDirtyAttributes"]);e.eachAttribute(function(e){return i.push(e)});var n=this;i.forEach(function(i){var o=function(){r(n.wrapRecord(e))};t["default"].addObserver(e,i,o),a.push(function(){t["default"].removeObserver(e,i,o)})});var o=function(){a.forEach(function(e){return e()})};return o}})}),e("ember-data/-private/system/debug/debug-info",["exports","ember"],function(e,t){e["default"]=t["default"].Mixin.create({_debugInfo:function(){var e=["id"],t={belongsTo:[],hasMany:[]},r=[];this.eachAttribute(function(t,r){return e.push(t)}),this.eachRelationship(function(e,a){t[a.kind].push(e),r.push(e)});var a=[{name:"Attributes",properties:e,expand:!0},{name:"Belongs To",properties:t.belongsTo,expand:!0},{name:"Has Many",properties:t.hasMany,expand:!0},{name:"Flags",properties:["isLoaded","hasDirtyAttributes","isSaving","isDeleted","isError","isNew","isValid"]}];return{propertyInfo:{includeOtherProperties:!0,groups:a,expensiveProperties:r}}}})}),e("ember-data/-private/system/empty-object",["exports"],function(e){function t(){}e["default"]=t;var r=Object.create(null,{constructor:{value:void 0,enumerable:!1,writable:!0}});t.prototype=r}),e("ember-data/-private/system/is-array-like",["exports","ember"],function(e,t){function r(e){if(!e||e.setInterval)return!1;if(Array.isArray(e))return!0;if(t["default"].Array.detect(e))return!0;var r=t["default"].typeOf(e);return"array"===r?!0:void 0!==e.length&&"object"===r?!0:!1}e["default"]=r}),e("ember-data/-private/system/many-array",["exports","ember","ember-data/-private/debug","ember-data/-private/system/promise-proxies"],function(e,t,r,a){var i=t["default"].get,n=t["default"].set;e["default"]=t["default"].Object.extend(t["default"].MutableArray,t["default"].Evented,{init:function(){this._super.apply(this,arguments),this.currentState=t["default"].A([])},record:null,canonicalState:null,currentState:null,length:0,objectAt:function(e){return this.currentState[e]?this.currentState[e].getRecord():void 0},flushCanonical:function(){var e=this.canonicalState.filter(function(e){return!e.isDeleted()}),t=this.currentState.filter(function(e){return e.isNew()});e=e.concat(t);var r=this.length;this.arrayContentWillChange(0,this.length,e.length),this.set("length",e.length),this.currentState=e,this.arrayContentDidChange(0,r,this.length),this.relationship.notifyHasManyChanged(),this.record.updateRecordArrays()},isPolymorphic:!1,isLoaded:!1,relationship:null,meta:null,internalReplace:function(e,t,r){r||(r=[]),this.arrayContentWillChange(e,t,r.length),this.currentState.splice.apply(this.currentState,[e,t].concat(r)),this.set("length",this.currentState.length),this.arrayContentDidChange(e,t,r.length),r&&this.relationship.notifyHasManyChanged(),this.record.updateRecordArrays()},internalRemoveRecords:function(e){for(var t,r=0;r<e.length;r++)t=this.currentState.indexOf(e[r]),this.internalReplace(t,1)},internalAddRecords:function(e,t){void 0===t&&(t=this.currentState.length),this.internalReplace(t,0,e)},replace:function(e,t,r){var a;t>0&&(a=this.currentState.slice(e,e+t),this.get("relationship").removeRecords(a)),r&&this.get("relationship").addRecords(r.map(function(e){return e._internalModel}),e)},promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--,0===this.loadingRecordsCount&&(n(this,"isLoaded",!0),this.trigger("didLoad"))},reload:function(){return this.relationship.reload()},save:function(){var e=this,r="DS: ManyArray#save "+i(this,"type"),n=t["default"].RSVP.all(this.invoke("save"),r).then(function(t){return e},null,"DS: ManyArray#save return ManyArray");return a.PromiseArray.create({promise:n})},createRecord:function(e){var t,r=i(this,"store"),a=i(this,"type");return t=r.createRecord(a.modelName,e),this.pushObject(t),t}})}),e("ember-data/-private/system/merge",["exports"],function(e){function t(e,t){if(!t||"object"!=typeof t)return e;for(var r,a=Object.keys(t),i=a.length,n=0;i>n;n++)r=a[n],e[r]=t[r];return e}e["default"]=t}),e("ember-data/-private/system/model",["exports","ember-data/-private/system/model/model","ember-data/attr","ember-data/-private/system/model/states","ember-data/-private/system/model/errors"],function(e,t,r,a,i){e.RootState=a["default"],e.attr=r["default"],e.Errors=i["default"],e["default"]=t["default"]}),e("ember-data/-private/system/model/attr",["exports","ember","ember-data/-private/debug"],function(e,t,r){var a=t["default"].get,i=t["default"].Map,n=t["default"].Mixin.create({attributes:t["default"].computed(function(){var e=i.create();return this.eachComputedProperty(function(t,r){r.isAttribute&&(r.name=t,e.set(t,r))}),e}).readOnly(),transformedAttributes:t["default"].computed(function(){var e=i.create();return this.eachAttribute(function(t,r){r.type&&e.set(t,r.type)}),e}).readOnly(),eachAttribute:function(e,t){a(this,"attributes").forEach(function(r,a){e.call(t,a,r)})},eachTransformedAttribute:function(e,t){a(this,"transformedAttributes").forEach(function(r,a){e.call(t,a,r)})}});e.AttrClassMethodsMixin=n;var o=t["default"].Mixin.create({eachAttribute:function(e,t){this.constructor.eachAttribute(e,t)}});e.AttrInstanceMethodsMixin=o}),e("ember-data/-private/system/model/errors",["exports","ember","ember-data/-private/debug"],function(e,t,r){var a=t["default"].get,i=t["default"].set,n=t["default"].isEmpty,o=t["default"].makeArray,s=t["default"].MapWithDefault;e["default"]=t["default"].ArrayProxy.extend(t["default"].Evented,{registerHandlers:function(e,t,r){this._registerHandlers(e,t,r)},_registerHandlers:function(e,t,r){this.on("becameInvalid",e,t),this.on("becameValid",e,r)},errorsByAttributeName:t["default"].computed(function(){return s.create({defaultValue:function(){return t["default"].A()}})}),errorsFor:function(e){return a(this,"errorsByAttributeName").get(e)},messages:t["default"].computed.mapBy("content","message"),content:t["default"].computed(function(){return t["default"].A()}),unknownProperty:function(e){var t=this.errorsFor(e);return n(t)?null:t},isEmpty:t["default"].computed.not("length").readOnly(),add:function(e,t){var r=a(this,"isEmpty");this._add(e,t),r&&!a(this,"isEmpty")&&this.trigger("becameInvalid")},_add:function(e,t){t=this._findOrCreateMessages(e,t),this.addObjects(t),a(this,"errorsByAttributeName").get(e).addObjects(t),this.notifyPropertyChange(e)},_findOrCreateMessages:function(e,t){for(var r=this.errorsFor(e),a=o(t),i=new Array(a.length),n=0;n<a.length;n++){var s=a[n],d=r.findBy("message",s);d?i[n]=d:i[n]={attribute:e,message:s}}return i},remove:function(e){a(this,"isEmpty")||(this._remove(e),a(this,"isEmpty")&&this.trigger("becameValid"))},_remove:function(e){if(!a(this,"isEmpty")){var t=this.rejectBy("attribute",e);i(this,"content",t),a(this,"errorsByAttributeName")["delete"](e),this.notifyPropertyChange(e)}},clear:function(){a(this,"isEmpty")||(this._clear(),this.trigger("becameValid"))},_clear:function(){if(!a(this,"isEmpty")){var e=a(this,"errorsByAttributeName"),r=t["default"].A();e.forEach(function(e,t){r.push(t)}),e.clear(),r.forEach(function(e){this.notifyPropertyChange(e)},this),t["default"].ArrayProxy.prototype.clear.call(this)}},has:function(e){return!n(this.errorsFor(e))}})}),e("ember-data/-private/system/model/errors/invalid",["exports","ember"],function(e,t){function r(e){a.call(this,"The backend rejected the commit because it was invalid: "+t["default"].inspect(e)),this.errors=e}e["default"]=r;var a=t["default"].Error;r.prototype=Object.create(a.prototype)}),e("ember-data/-private/system/model/internal-model",["exports","ember","ember-data/-private/debug","ember-data/-private/system/merge","ember-data/-private/system/model/states","ember-data/-private/system/relationships/state/create","ember-data/-private/system/snapshot","ember-data/-private/system/empty-object","ember-data/-private/features","ember-data/-private/utils","ember-data/-private/system/references"],function(e,t,r,a,i,n,o,s,d,l,u){function c(e){return _[e]||(_[e]=e.split("."))}function h(e){return R[e]||(R[e]=c(e)[0])}function p(e){return function(){return v(this.currentState,e)}}function f(e,r,a,o,d){this.type=e,this.id=r,this.store=a,this._data=d||new s["default"],this.modelName=e.modelName,this.dataHasInitialized=!1,this._deferredTriggers=[],this._attributes=new s["default"],this._inFlightAttributes=new s["default"],this._relationships=new n["default"](this),this._recordArrays=void 0,this.currentState=i["default"].empty,this.recordReference=new u.RecordReference(a,this),this.references={},this.isReloading=!1,this.isError=!1,this.error=null,this.__ember_meta__=null,this[t["default"].GUID_KEY]=A++ +"internal-model",this._implicitRelationships=new s["default"]}var m=function(){function e(e,t){var r=[],a=!0,i=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(d){i=!0,n=d}finally{try{!a&&s["return"]&&s["return"]()}finally{if(i)throw n}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e["default"]=f;var y=t["default"].RSVP.Promise,v=t["default"].get,b=t["default"].set,g=t["default"].copy,R=new s["default"],_=new s["default"],A=0;f.prototype={isEmpty:p("isEmpty"),isLoading:p("isLoading"),isLoaded:p("isLoaded"),hasDirtyAttributes:p("hasDirtyAttributes"),isSaving:p("isSaving"),isDeleted:p("isDeleted"),isNew:p("isNew"),isValid:p("isValid"),dirtyType:p("dirtyType"),constructor:f,materializeRecord:function(){var e={store:this.store,_internalModel:this,id:this.id,currentState:v(this,"currentState"),isError:this.isError,adapterError:this.error};t["default"].setOwner?t["default"].setOwner(e,(0,l.getOwner)(this.store)):e.container=this.store.container,this.record=this.type._create(e),this._triggerDeferredTriggers()},recordObjectWillDestroy:function(){this.record=null},deleteRecord:function(){this.send("deleteRecord")},save:function(e){var r="DS: Model#save "+this,a=t["default"].RSVP.defer(r);return this.store.scheduleSave(this,a,e),a.promise},startedReloading:function(){this.isReloading=!0,this.record&&b(this.record,"isReloading",!0)},finishedReloading:function(){this.isReloading=!1,this.record&&b(this.record,"isReloading",!1)},reload:function(){this.startedReloading();var e=this,t="DS: Model#reload of "+this;return new y(function(t){e.send("reloadRecord",t)},t).then(function(){return e.didCleanError(),e},function(t){throw e.didError(t),t},"DS: Model#reload complete, update flags")["finally"](function(){e.finishedReloading(),e.updateRecordArrays()})},getRecord:function(){return this.record||this.materializeRecord(),this.record},unloadRecord:function(){this.send("unloadRecord")},eachRelationship:function(e,t){return this.type.eachRelationship(e,t)},eachAttribute:function(e,t){return this.type.eachAttribute(e,t)},inverseFor:function(e){return this.type.inverseFor(e)},setupData:function(e){var t=this._changedKeys(e.attributes);(0,a["default"])(this._data,e.attributes),this.pushedData(),this.record&&this.record._notifyProperties(t),this.didInitalizeData()},becameReady:function(){t["default"].run.schedule("actions",this.store.recordArrayManager,this.store.recordArrayManager.recordWasLoaded,this)},didInitalizeData:function(){this.dataHasInitialized||(this.becameReady(),this.dataHasInitialized=!0)},destroy:function(){return this.record?this.record.destroy():void 0},createSnapshot:function(e){return new o["default"](this,e)},loadingData:function(e){this.send("loadingData",e)},loadedData:function(){this.send("loadedData"),this.didInitalizeData()},notFound:function(){this.send("notFound")},pushedData:function(){this.send("pushedData")},flushChangedAttributes:function(){this._inFlightAttributes=this._attributes,this._attributes=new s["default"]},hasChangedAttributes:function(){return Object.keys(this._attributes).length>0},updateChangedAttributes:function(){for(var e=this.changedAttributes(),t=Object.keys(e),r=0,a=t.length;a>r;r++){var i=t[r],n=m(e[i],2),o=n[0],s=n[1];o===s&&delete this._attributes[i]}},changedAttributes:function(){for(var e=this._data,t=this._attributes,r=this._inFlightAttributes,i=(0,a["default"])(g(r),t),n=new s["default"],o=Object.keys(i),d=0,l=o.length;l>d;d++){var u=o[d];n[u]=[e[u],i[u]]}return n},adapterWillCommit:function(){this.send("willCommit")},adapterDidDirty:function(){this.send("becomeDirty"),this.updateRecordArraysLater()},send:function(e,t){var r=v(this,"currentState");return r[e]||this._unhandledEvent(r,e,t),r[e](this,t)},notifyHasManyAdded:function(e,t,r){this.record&&this.record.notifyHasManyAdded(e,t,r)},notifyHasManyRemoved:function(e,t,r){this.record&&this.record.notifyHasManyRemoved(e,t,r)},notifyBelongsToChanged:function(e,t){this.record&&this.record.notifyBelongsToChanged(e,t)},notifyPropertyChange:function(e){this.record&&this.record.notifyPropertyChange(e)},rollbackAttributes:function(){var e=Object.keys(this._attributes);this._attributes=new s["default"],v(this,"isError")&&(this._inFlightAttributes=new s["default"],this.didCleanError()),this.isDeleted()&&this.becameReady(),this.isNew()&&this.clearRelationships(),this.isValid()&&(this._inFlightAttributes=new s["default"]),this.send("rolledBack"),this.record._notifyProperties(e)},transitionTo:function(e){var t=h(e),r=v(this,"currentState"),a=r;do a.exit&&a.exit(this),a=a.parentState;while(!a.hasOwnProperty(t));var i,n,o=c(e),s=[],d=[];for(i=0,n=o.length;n>i;i++)a=a[o[i]],a.enter&&d.push(a),a.setup&&s.push(a);for(i=0,n=d.length;n>i;i++)d[i].enter(this);for(b(this,"currentState",a),this.record&&b(this.record,"currentState",a),i=0,n=s.length;n>i;i++)s[i].setup(this);this.updateRecordArraysLater()},_unhandledEvent:function(e,r,a){var i="Attempted to handle event `"+r+"` ";throw i+="on "+String(this)+" while in state ",i+=e.stateName+". ",void 0!==a&&(i+="Called with "+t["default"].inspect(a)+"."),new t["default"].Error(i)},triggerLater:function(){for(var e=arguments.length,r=new Array(e),a=0;e>a;a++)r[a]=arguments[a];1===this._deferredTriggers.push(r)&&t["default"].run.scheduleOnce("actions",this,"_triggerDeferredTriggers")},_triggerDeferredTriggers:function(){if(this.record){for(var e=0,t=this._deferredTriggers.length;t>e;e++)this.record.trigger.apply(this.record,this._deferredTriggers[e]);this._deferredTriggers.length=0}},clearRelationships:function(){var e=this;this.eachRelationship(function(t,r){if(e._relationships.has(t)){var a=e._relationships.get(t);a.clear(),a.destroy()}}),Object.keys(this._implicitRelationships).forEach(function(t){e._implicitRelationships[t].clear(),e._implicitRelationships[t].destroy()})},_preloadData:function(e){var t=this;Object.keys(e).forEach(function(r){var a=v(e,r),i=t.type.metaForProperty(r);i.isRelationship?t._preloadRelationship(r,a):t._data[r]=a})},_preloadRelationship:function(e,t){var r=this.type.metaForProperty(e),a=r.type;"hasMany"===r.kind?this._preloadHasMany(e,t,a):this._preloadBelongsTo(e,t,a)},_preloadHasMany:function(e,t,r){for(var a=new Array(t.length),i=0;i<t.length;i++){var n=t[i];a[i]=this._convertStringOrNumberIntoInternalModel(n,r)}this._relationships.get(e).updateRecordsFromAdapter(a)},_preloadBelongsTo:function(e,t,r){var a=this._convertStringOrNumberIntoInternalModel(t,r);this._relationships.get(e).setRecord(a)},_convertStringOrNumberIntoInternalModel:function(e,t){return"string"==typeof e||"number"==typeof e?this.store._internalModelForId(t,e):e._internalModel?e._internalModel:e},updateRecordArrays:function(){this._updatingRecordArraysLater=!1,this.store.dataWasUpdated(this.type,this)},setId:function(e){this.id=e,this.record.get("id")!==e&&this.record.set("id",e)},didError:function(e){this.error=e,this.isError=!0,this.record&&this.record.setProperties({isError:!0,adapterError:e})},didCleanError:function(){this.error=null,this.isError=!1,this.record&&this.record.setProperties({isError:!1,adapterError:null})},adapterDidCommit:function(e){e&&(e=e.attributes),this.didCleanError();var t=this._changedKeys(e);(0,a["default"])(this._data,this._inFlightAttributes),e&&(0,a["default"])(this._data,e),this._inFlightAttributes=new s["default"],
2
- this.send("didCommit"),this.updateRecordArraysLater(),e&&this.record._notifyProperties(t)},updateRecordArraysLater:function(){this._updatingRecordArraysLater||(this._updatingRecordArraysLater=!0,t["default"].run.schedule("actions",this,this.updateRecordArrays))},addErrorMessageToAttribute:function(e,t){var r=this.getRecord();v(r,"errors")._add(e,t)},removeErrorMessageFromAttribute:function(e){var t=this.getRecord();v(t,"errors")._remove(e)},clearErrorMessages:function(){var e=this.getRecord();v(e,"errors")._clear()},hasErrors:function(){var e=this.getRecord(),r=v(e,"errors");return!t["default"].isEmpty(r)},adapterDidInvalidate:function(e){var t;for(t in e)e.hasOwnProperty(t)&&this.addErrorMessageToAttribute(t,e[t]);this.send("becameInvalid"),this._saveWasRejected()},adapterDidError:function(e){this.send("becameError"),this.didError(e),this._saveWasRejected()},_saveWasRejected:function(){for(var e=Object.keys(this._inFlightAttributes),t=0;t<e.length;t++)void 0===this._attributes[e[t]]&&(this._attributes[e[t]]=this._inFlightAttributes[e[t]]);this._inFlightAttributes=new s["default"]},_changedKeys:function(e){var r=[];if(e){var i,n,o,d,l=Object.keys(e),u=l.length;for(i=(0,a["default"])(new s["default"],this._data),i=(0,a["default"])(i,this._inFlightAttributes),n=0;u>n;n++)d=l[n],o=e[d],void 0===this._attributes[d]&&(t["default"].isEqual(i[d],o)||r.push(d))}return r},toString:function(){return this.record?this.record.toString():"<"+this.modelName+":"+this.id+">"}}}),e("ember-data/-private/system/model/model",["exports","ember","ember-data/-private/debug","ember-data/-private/system/promise-proxies","ember-data/-private/system/model/errors","ember-data/-private/features","ember-data/-private/system/debug/debug-info","ember-data/-private/system/relationships/belongs-to","ember-data/-private/system/relationships/has-many","ember-data/-private/system/relationships/ext","ember-data/-private/system/model/attr"],function(e,t,r,a,i,n,o,s,d,l,u){var c=t["default"].get,h=t["default"].computed("currentState",function(e){return c(this._internalModel.currentState,e)}).readOnly(),p=t["default"].Object.extend(t["default"].Evented,{_internalModel:null,store:null,isEmpty:h,isLoading:h,isLoaded:h,hasDirtyAttributes:t["default"].computed("currentState.isDirty",function(){return this.get("currentState.isDirty")}),isSaving:h,isDeleted:h,isNew:h,isValid:h,dirtyType:h,isError:!1,isReloading:!1,id:null,errors:t["default"].computed(function(){var e=i["default"].create();return e._registerHandlers(this._internalModel,function(){this.send("becameInvalid")},function(){this.send("becameValid")}),e}).readOnly(),adapterError:null,serialize:function(e){return this.store.serialize(this,e)},toJSON:function(e){var t=this.store.serializerFor("-default"),r=this._internalModel.createSnapshot();return t.serialize(r,e)},ready:t["default"].K,didLoad:t["default"].K,didUpdate:t["default"].K,didCreate:t["default"].K,didDelete:t["default"].K,becameInvalid:t["default"].K,becameError:t["default"].K,rolledBack:t["default"].K,data:t["default"].computed.readOnly("_internalModel._data"),send:function(e,t){return this._internalModel.send(e,t)},transitionTo:function(e){return this._internalModel.transitionTo(e)},deleteRecord:function(){this._internalModel.deleteRecord()},destroyRecord:function(e){return this.deleteRecord(),this.save(e)},unloadRecord:function(){this.isDestroyed||this._internalModel.unloadRecord()},_notifyProperties:function(e){t["default"].beginPropertyChanges();for(var r,a=0,i=e.length;i>a;a++)r=e[a],this.notifyPropertyChange(r);t["default"].endPropertyChanges()},changedAttributes:function(){return this._internalModel.changedAttributes()},rollbackAttributes:function(){this._internalModel.rollbackAttributes()},_createSnapshot:function(){return this._internalModel.createSnapshot()},toStringExtension:function(){return c(this,"id")},save:function(e){var t=this;return a.PromiseObject.create({promise:this._internalModel.save(e).then(function(){return t})})},reload:function(){var e=this;return a.PromiseObject.create({promise:this._internalModel.reload().then(function(){return e})})},trigger:function(e){for(var r=arguments.length,a=new Array(r-1),i=1;r>i;i++)a[i-1]=arguments[i];t["default"].tryInvoke(this,e,a),this._super.apply(this,arguments)},willDestroy:function(){this._super.apply(this,arguments),this._internalModel.clearRelationships(),this._internalModel.recordObjectWillDestroy()},willMergeMixin:function(e){this.constructor},attr:function(){},belongsTo:function(){},hasMany:function(){},setId:t["default"].observer("id",function(){this._internalModel.setId(this.get("id"))})});p.reopenClass({_create:p.create,create:function(){throw new t["default"].Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.")},modelName:null}),t["default"].setOwner&&Object.defineProperty(p.prototype,"container",{configurable:!0,enumerable:!1,get:function(){return this.store.container}}),p.reopenClass(l.RelationshipsClassMethodsMixin),p.reopenClass(u.AttrClassMethodsMixin),e["default"]=p.extend(o["default"],s.BelongsToMixin,l.DidDefinePropertyMixin,l.RelationshipsInstanceMethodsMixin,d.HasManyMixin,u.AttrInstanceMethodsMixin)}),e("ember-data/-private/system/model/states",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e,t){t.value===t.originalValue?(delete e._attributes[t.name],e.send("propertyWasReset",t.name)):t.value!==t.oldValue&&e.send("becomeDirty"),e.updateRecordArraysLater()}function i(e){var t,r={};for(var a in e)t=e[a],t&&"object"==typeof t?r[a]=i(t):r[a]=t;return r}function n(e,t){for(var r in t)e[r]=t[r];return e}function o(e){var t=i(u);return n(t,e)}function s(e){}function d(e,t,r){e=n(t?Object.create(t):{},e),e.parentState=t,e.stateName=r;for(var a in e)e.hasOwnProperty(a)&&"parentState"!==a&&"stateName"!==a&&"object"==typeof e[a]&&(e[a]=d(e[a],e,r+"."+a));return e}var l=t["default"].get,u={initialState:"uncommitted",isDirty:!0,uncommitted:{didSetProperty:a,loadingData:t["default"].K,propertyWasReset:function(e,t){e.hasChangedAttributes()||e.send("rolledBack")},pushedData:function(e){e.updateChangedAttributes(),e.hasChangedAttributes()||e.transitionTo("loaded.saved")},becomeDirty:t["default"].K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,t){t(e.store.reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollbackAttributes(),e.triggerLater("ready")}},inFlight:{isSaving:!0,didSetProperty:a,becomeDirty:t["default"].K,pushedData:t["default"].K,unloadRecord:s,willCommit:t["default"].K,didCommit:function(e){var t=l(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:!1,deleteRecord:function(e){e.transitionTo("deleted.uncommitted")},didSetProperty:function(e,t){e.removeErrorMessageFromAttribute(t.name),a(e,t),e.hasErrors()||this.becameValid(e)},becameInvalid:t["default"].K,becomeDirty:t["default"].K,pushedData:t["default"].K,willCommit:function(e){e.clearErrorMessages(),e.transitionTo("inFlight")},rolledBack:function(e){e.clearErrorMessages(),e.transitionTo("loaded.saved"),e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)}}},c=o({dirtyType:"created",isNew:!0});c.invalid.rolledBack=function(e){e.transitionTo("deleted.saved")},c.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var h=o({dirtyType:"updated"});c.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.saved"),e.send("invokeLifecycleCallbacks")},c.uncommitted.rollback=function(e){u.uncommitted.rollback.apply(this,arguments),e.transitionTo("deleted.saved")},c.uncommitted.pushedData=function(e){e.transitionTo("loaded.updated.uncommitted"),e.triggerLater("didLoad")},c.uncommitted.propertyWasReset=t["default"].K,h.inFlight.unloadRecord=s,h.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted")};var p={isEmpty:!1,isLoading:!1,isLoaded:!1,isDirty:!1,isSaving:!1,isDeleted:!1,isNew:!1,isValid:!0,rolledBack:t["default"].K,unloadRecord:function(e){e.clearRelationships(),e.transitionTo("deleted.saved")},propertyWasReset:t["default"].K,empty:{isEmpty:!0,loadingData:function(e,t){e._loadingPromise=t,e.transitionTo("loading")},loadedData:function(e){e.transitionTo("loaded.created.uncommitted"),e.triggerLater("ready")},pushedData:function(e){e.transitionTo("loaded.saved"),e.triggerLater("didLoad"),e.triggerLater("ready")}},loading:{isLoading:!0,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved"),e.triggerLater("didLoad"),e.triggerLater("ready"),e.didCleanError()},becameError:function(e){e.triggerLater("becameError",e)},notFound:function(e){e.transitionTo("empty")}},loaded:{initialState:"saved",isLoaded:!0,loadingData:t["default"].K,saved:{setup:function(e){e.hasChangedAttributes()&&e.adapterDidDirty()},didSetProperty:a,pushedData:t["default"].K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,t){t(e.store.reloadRecord(e))},deleteRecord:function(e){e.transitionTo("deleted.uncommitted")},unloadRecord:function(e){e.clearRelationships(),e.transitionTo("deleted.saved")},didCommit:function(e){e.send("invokeLifecycleCallbacks",l(e,"lastDirtyType"))},notFound:t["default"].K},created:c,updated:h},deleted:{initialState:"uncommitted",dirtyType:"deleted",isDeleted:!0,isLoaded:!0,isDirty:!0,setup:function(e){e.updateRecordArrays()},uncommitted:{willCommit:function(e){e.transitionTo("inFlight")},rollback:function(e){e.rollbackAttributes(),e.triggerLater("ready")},pushedData:t["default"].K,becomeDirty:t["default"].K,deleteRecord:t["default"].K,rolledBack:function(e){e.transitionTo("loaded.saved"),e.triggerLater("ready")}},inFlight:{isSaving:!0,unloadRecord:s,willCommit:t["default"].K,didCommit:function(e){e.transitionTo("saved"),e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted"),e.triggerLater("becameError",e)},becameInvalid:function(e){e.transitionTo("invalid"),e.triggerLater("becameInvalid",e)}},saved:{isDirty:!1,setup:function(e){e.clearRelationships();var t=e.store;t._dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e),e.triggerLater("didCommit",e)},willCommit:t["default"].K,didCommit:t["default"].K},invalid:{isValid:!1,didSetProperty:function(e,t){e.removeErrorMessageFromAttribute(t.name),a(e,t),e.hasErrors()||this.becameValid(e)},becameInvalid:t["default"].K,becomeDirty:t["default"].K,deleteRecord:t["default"].K,willCommit:t["default"].K,rolledBack:function(e){e.clearErrorMessages(),e.transitionTo("loaded.saved"),e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")}}},invokeLifecycleCallbacks:function(e,t){"created"===t?e.triggerLater("didCreate",e):e.triggerLater("didUpdate",e),e.triggerLater("didCommit",e)}};p=d(p,null,"root"),e["default"]=p}),e("ember-data/-private/system/normalize-link",["exports"],function(e){function t(e){switch(typeof e){case"object":return e;case"string":return{href:e}}return null}e["default"]=t}),e("ember-data/-private/system/normalize-model-name",["exports","ember"],function(e,t){function r(e){return t["default"].String.dasherize(e)}e["default"]=r}),e("ember-data/-private/system/ordered-set",["exports","ember"],function(e,t){function r(){this._super$constructor()}e["default"]=r;var a=t["default"].OrderedSet,i=t["default"].guidFor;r.create=function(){var e=this;return new e},r.prototype=Object.create(a.prototype),r.prototype.constructor=r,r.prototype._super$constructor=a,r.prototype.addWithIndex=function(e,t){var r=i(e),a=this.presenceSet,n=this.list;return a[r]!==!0?(a[r]=!0,void 0===t||null==t?n.push(e):n.splice(t,0,e),this.size+=1,this):void 0}}),e("ember-data/-private/system/promise-proxies",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){return function(){var t=n(this,"content");return t[e].apply(t,arguments)}}var i=t["default"].RSVP.Promise,n=t["default"].get,o=t["default"].ArrayProxy.extend(t["default"].PromiseProxyMixin),s=t["default"].ObjectProxy.extend(t["default"].PromiseProxyMixin),d=function(e,t){return s.create({promise:i.resolve(e,t)})},l=function(e,t){return o.create({promise:i.resolve(e,t)})},u=o.extend({reload:function(){return u.create({promise:n(this,"content").reload()})},createRecord:a("createRecord"),on:a("on"),one:a("one"),trigger:a("trigger"),off:a("off"),has:a("has")}),c=function(e,t){return u.create({promise:i.resolve(e,t)})};e.PromiseArray=o,e.PromiseObject=s,e.PromiseManyArray=u,e.promiseArray=l,e.promiseObject=d,e.promiseManyArray=c}),e("ember-data/-private/system/record-array-manager",["exports","ember","ember-data/-private/system/record-arrays","ember-data/-private/system/ordered-set"],function(e,t,r,a){function i(e){e.destroy()}function n(e){for(var r=e.length,a=t["default"].A(),i=0;r>i;i++)a=a.concat(e[i]);return a}function o(e,t){var r=e.indexOf(t);return-1!==r?(e.splice(r,1),!0):!1}var s=t["default"].MapWithDefault,d=t["default"].get;e["default"]=t["default"].Object.extend({init:function(){var e=this;this.filteredRecordArrays=s.create({defaultValue:function(){return[]}}),this.liveRecordArrays=s.create({defaultValue:function(t){return e.createRecordArray(t)}}),this.changedRecords=[],this._adapterPopulatedRecordArrays=[]},recordDidChange:function(e){1===this.changedRecords.push(e)&&t["default"].run.schedule("actions",this,this.updateRecordArrays)},recordArraysForRecord:function(e){return e._recordArrays=e._recordArrays||a["default"].create(),e._recordArrays},updateRecordArrays:function(){var e=this;this.changedRecords.forEach(function(t){d(t,"record.isDestroyed")||d(t,"record.isDestroying")||"root.deleted.saved"===d(t,"currentState.stateName")?e._recordWasDeleted(t):e._recordWasChanged(t)}),this.changedRecords.length=0},_recordWasDeleted:function(e){var t=e._recordArrays;t&&(t.forEach(function(t){return t.removeInternalModel(e)}),e._recordArrays=null)},_recordWasChanged:function(e){var t,r=this,a=e.type,i=this.filteredRecordArrays.get(a);i.forEach(function(i){t=d(i,"filterFunction"),r.updateFilterRecordArray(i,t,a,e)})},recordWasLoaded:function(e){var t,r=this,a=e.type,i=this.filteredRecordArrays.get(a);if(i.forEach(function(i){t=d(i,"filterFunction"),r.updateFilterRecordArray(i,t,a,e)}),this.liveRecordArrays.has(a)){var n=this.liveRecordArrays.get(a);this._addRecordToRecordArray(n,e)}},updateFilterRecordArray:function(e,t,r,a){var i=t(a.getRecord()),n=this.recordArraysForRecord(a);i?this._addRecordToRecordArray(e,a):(n["delete"](e),e.removeInternalModel(a))},_addRecordToRecordArray:function(e,t){var r=this.recordArraysForRecord(t);r.has(e)||(e.addInternalModel(t),r.add(e))},populateLiveRecordArray:function(e,t){for(var r,a=this.store.typeMapFor(t),i=a.records,n=0;n<i.length;n++)r=i[n],r.isDeleted()||r.isEmpty()||this._addRecordToRecordArray(e,r)},updateFilter:function(e,t,r){for(var a,i=this.store.typeMapFor(t),n=i.records,o=0;o<n.length;o++)a=n[o],a.isDeleted()||a.isEmpty()||this.updateFilterRecordArray(e,r,t,a)},liveRecordArrayFor:function(e){return this.liveRecordArrays.get(e)},createRecordArray:function(e){var a=r.RecordArray.create({type:e,content:t["default"].A(),store:this.store,isLoaded:!0,manager:this});return a},createFilteredRecordArray:function(e,a,i){var n=r.FilteredRecordArray.create({query:i,type:e,content:t["default"].A(),store:this.store,manager:this,filterFunction:a});return this.registerFilteredRecordArray(n,e,a),n},createAdapterPopulatedRecordArray:function(e,a){var i=r.AdapterPopulatedRecordArray.create({type:e,query:a,content:t["default"].A(),store:this.store,manager:this});return this._adapterPopulatedRecordArrays.push(i),i},registerFilteredRecordArray:function(e,t,r){var a=this.filteredRecordArrays.get(t);a.push(e),this.updateFilter(e,t,r)},unregisterRecordArray:function(e){var t=e.type,r=this.filteredRecordArrays.get(t),a=o(r,e),i=o(this._adapterPopulatedRecordArrays,e);if(!a&&!i&&this.liveRecordArrays.has(t)){var n=this.liveRecordArrayFor(t);e===n&&this.liveRecordArrays["delete"](t)}},willDestroy:function(){this._super.apply(this,arguments),this.filteredRecordArrays.forEach(function(e){return n(e).forEach(i)}),this.liveRecordArrays.forEach(i),this._adapterPopulatedRecordArrays.forEach(i)}})}),e("ember-data/-private/system/record-arrays",["exports","ember-data/-private/system/record-arrays/record-array","ember-data/-private/system/record-arrays/filtered-record-array","ember-data/-private/system/record-arrays/adapter-populated-record-array"],function(e,t,r,a){e.RecordArray=t["default"],e.FilteredRecordArray=r["default"],e.AdapterPopulatedRecordArray=a["default"]}),e("ember-data/-private/system/record-arrays/adapter-populated-record-array",["exports","ember","ember-data/-private/system/record-arrays/record-array","ember-data/-private/system/clone-null"],function(e,t,r,a){var i=t["default"].get;e["default"]=r["default"].extend({query:null,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},loadRecords:function(e,r){var i=this,n=t["default"].A(e).mapBy("_internalModel");this.setProperties({content:t["default"].A(n),isLoaded:!0,meta:(0,a["default"])(r.meta)}),n.forEach(function(e){i.manager.recordArraysForRecord(e).add(i)}),t["default"].run.once(this,"trigger","didLoad")}})}),e("ember-data/-private/system/record-arrays/filtered-record-array",["exports","ember","ember-data/-private/system/record-arrays/record-array"],function(e,t,r){var a=t["default"].get;e["default"]=r["default"].extend({filterFunction:null,isLoaded:!0,replace:function(){var e=a(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=a(this,"manager");e.updateFilter(this,a(this,"type"),a(this,"filterFunction"))},updateFilter:t["default"].observer("filterFunction",function(){t["default"].run.once(this,this._updateFilter)})})}),e("ember-data/-private/system/record-arrays/record-array",["exports","ember","ember-data/-private/system/promise-proxies","ember-data/-private/system/snapshot-record-array"],function(e,t,r,a){var i=t["default"].get,n=t["default"].set;e["default"]=t["default"].ArrayProxy.extend(t["default"].Evented,{type:null,content:null,isLoaded:!1,isUpdating:!1,store:null,objectAtContent:function(e){var t=i(this,"content"),r=t.objectAt(e);return r&&r.getRecord()},update:function(){if(!i(this,"isUpdating")){var e=i(this,"store"),t=i(this,"type.modelName"),r=i(this,"query");return r?e._query(t,r,this):e.findAll(t,{reload:!0})}},addInternalModel:function(e,t){var r=i(this,"content");void 0===t?r.addObject(e):r.contains(e)||r.insertAt(t,e)},removeInternalModel:function(e){i(this,"content").removeObject(e)},save:function(){var e=this,a="DS: RecordArray#save "+i(this,"type"),n=t["default"].RSVP.all(this.invoke("save"),a).then(function(t){return e},null,"DS: RecordArray#save return RecordArray");return r.PromiseArray.create({promise:n})},_dissociateFromOwnRecords:function(){var e=this;this.get("content").forEach(function(t){var r=t._recordArrays;r&&r["delete"](e)})},_unregisterFromManager:function(){var e=i(this,"manager");e.unregisterRecordArray(this)},willDestroy:function(){this._unregisterFromManager(),this._dissociateFromOwnRecords(),n(this,"content",void 0),this._super.apply(this,arguments)},createSnapshot:function(e){var t=this.get("meta");return new a["default"](this,t,e)}})}),e("ember-data/-private/system/references",["exports","ember-data/-private/system/references/record","ember-data/-private/system/references/belongs-to","ember-data/-private/system/references/has-many"],function(e,t,r,a){e.RecordReference=t["default"],e.BelongsToReference=r["default"],e.HasManyReference=a["default"]}),e("ember-data/-private/system/references/belongs-to",["exports","ember-data/model","ember","ember-data/-private/system/references/reference","ember-data/-private/utils"],function(e,t,r,a,i){var n=function(e,t,r){this._super$constructor(e,t),this.belongsToRelationship=r,this.type=r.relationshipMeta.type,this.parent=t.recordReference};n.prototype=Object.create(a["default"].prototype),n.prototype.constructor=n,n.prototype._super$constructor=a["default"],n.prototype.remoteType=function(){return this.belongsToRelationship.link?"link":"id"},n.prototype.id=function(){var e=this.belongsToRelationship.inverseRecord;return e&&e.id},n.prototype.link=function(){return this.belongsToRelationship.link},n.prototype.meta=function(){return this.belongsToRelationship.meta},n.prototype.push=function(e){var a=this;return r["default"].RSVP.resolve(e).then(function(e){var r;return r=e instanceof t["default"]?e:a.store.push(e),(0,i.assertPolymorphicType)(a.internalModel,a.belongsToRelationship.relationshipMeta,r._internalModel),a.belongsToRelationship.setCanonicalRecord(r._internalModel),r})},n.prototype.value=function(){var e=this.belongsToRelationship.inverseRecord;return e&&e.record},n.prototype.load=function(){var e=this;return"id"===this.remoteType()?this.belongsToRelationship.getRecord():"link"===this.remoteType()?this.belongsToRelationship.findLink().then(function(t){return e.value()}):void 0},n.prototype.reload=function(){var e=this;return this.belongsToRelationship.reload().then(function(t){return e.value()})},e["default"]=n}),e("ember-data/-private/system/references/has-many",["exports","ember","ember-data/-private/system/references/reference"],function(e,t,r){var a=t["default"].get,i=function(e,t,r){this._super$constructor(e,t),this.hasManyRelationship=r,this.type=r.relationshipMeta.type,this.parent=t.recordReference};i.prototype=Object.create(r["default"].prototype),i.prototype.constructor=i,i.prototype._super$constructor=r["default"],i.prototype.remoteType=function(){return this.hasManyRelationship.link?"link":"ids"},i.prototype.link=function(){return this.hasManyRelationship.link},i.prototype.ids=function(){var e=this.hasManyRelationship.members,t=e.toArray().map(function(e){return e.id});return t},i.prototype.meta=function(){return this.hasManyRelationship.manyArray.meta},i.prototype.push=function(e){var r=this;return t["default"].RSVP.resolve(e).then(function(e){var t=e;"object"==typeof e&&e.data&&(t=e.data);var a=t.map(function(e){var t=r.store.push(e);return t._internalModel});return r.hasManyRelationship.computeChanges(a),r.hasManyRelationship.manyArray})},i.prototype._isLoaded=function(){var e=a(this.hasManyRelationship,"hasData");if(!e)return!1;var t=this.hasManyRelationship.members.toArray(),r=t.every(function(e){return e.isLoaded()===!0});return r},i.prototype.value=function(){return this._isLoaded()?this.hasManyRelationship.manyArray:null},i.prototype.load=function(){if(!this._isLoaded())return this.hasManyRelationship.getRecords();var e=this.hasManyRelationship.manyArray;return t["default"].RSVP.resolve(e)},i.prototype.reload=function(){return this.hasManyRelationship.reload()},e["default"]=i}),e("ember-data/-private/system/references/record",["exports","ember","ember-data/-private/system/references/reference"],function(e,t,r){var a=function(e,t){this._super$constructor(e,t),this.type=t.modelName,this._id=t.id};a.prototype=Object.create(r["default"].prototype),a.prototype.constructor=a,a.prototype._super$constructor=r["default"],a.prototype.id=function(){return this._id},a.prototype.remoteType=function(){return"identity"},a.prototype.push=function(e){var r=this;return t["default"].RSVP.resolve(e).then(function(e){var t=r.store.push(e);return t})},a.prototype.value=function(){return this.internalModel.record},a.prototype.load=function(){return this.store.findRecord(this.type,this._id)},a.prototype.reload=function(){var e=this.value();return e?e.reload():this.load()},e["default"]=a}),e("ember-data/-private/system/references/reference",["exports"],function(e){var t=function(e,t){this.store=e,this.internalModel=t};t.prototype={constructor:t},e["default"]=t}),e("ember-data/-private/system/relationship-meta",["exports","ember-inflector","ember-data/-private/system/normalize-model-name"],function(e,t,r){function a(e){var a;return a=e.type||e.key,"hasMany"===e.kind&&(a=(0,t.singularize)((0,r["default"])(a))),a}function i(e){return{key:e.key,kind:e.kind,type:a(e),options:e.options,parentType:e.parentType,isRelationship:!0}}e.typeForRelationshipMeta=a,e.relationshipFromMeta=i}),e("ember-data/-private/system/relationships/belongs-to",["exports","ember","ember-data/-private/debug","ember-data/-private/system/normalize-model-name"],function(e,t,r,a){function i(e,r){var i,n;"object"==typeof e?(i=e,n=void 0):(i=r,n=e),"string"==typeof n&&(n=(0,a["default"])(n)),i=i||{};var o={type:n,isRelationship:!0,options:i,kind:"belongsTo",key:null};return t["default"].computed({get:function(e){return i.hasOwnProperty("serialize"),i.hasOwnProperty("embedded"),this._internalModel._relationships.get(e).getRecord()},set:function(e,t){return void 0===t&&(t=null),t&&t.then?this._internalModel._relationships.get(e).setRecordPromise(t):t?this._internalModel._relationships.get(e).setRecord(t._internalModel):this._internalModel._relationships.get(e).setRecord(t),this._internalModel._relationships.get(e).getRecord()}}).meta(o)}e["default"]=i;var n=t["default"].Mixin.create({notifyBelongsToChanged:function(e){this.notifyPropertyChange(e)}});e.BelongsToMixin=n}),e("ember-data/-private/system/relationships/ext",["exports","ember","ember-data/-private/debug","ember-data/-private/system/relationship-meta","ember-data/-private/system/empty-object"],function(e,t,r,a,i){var n=t["default"].get,o=t["default"].Map,s=t["default"].MapWithDefault,d=t["default"].computed(function(){t["default"].testing===!0&&d._cacheable===!0&&(d._cacheable=!1);var e=new s({defaultValue:function(){return[]}});return this.eachComputedProperty(function(t,r){if(r.isRelationship){r.key=t;var i=e.get((0,a.typeForRelationshipMeta)(r));i.push({name:t,kind:r.kind})}}),e}).readOnly(),l=t["default"].computed(function(){t["default"].testing===!0&&l._cacheable===!0&&(l._cacheable=!1);var e,r=t["default"].A();return this.eachComputedProperty(function(t,i){i.isRelationship&&(i.key=t,e=(0,a.typeForRelationshipMeta)(i),r.contains(e)||r.push(e))}),r}).readOnly(),u=t["default"].computed(function(){t["default"].testing===!0&&u._cacheable===!0&&(u._cacheable=!1);var e=o.create();return this.eachComputedProperty(function(t,r){if(r.isRelationship){r.key=t;var i=(0,a.relationshipFromMeta)(r);i.type=(0,a.typeForRelationshipMeta)(r),e.set(t,i)}}),e}).readOnly(),c=t["default"].Mixin.create({didDefineProperty:function(e,r,a){if(a instanceof t["default"].ComputedProperty){var i=a.meta();i.parentType=e.constructor}}});e.DidDefinePropertyMixin=c;var h=t["default"].Mixin.create({typeForRelationship:function(e,t){var r=n(this,"relationshipsByName").get(e);return r&&t.modelFor(r.type)},inverseMap:t["default"].computed(function(){return new i["default"]}),inverseFor:function(e,t){var r=n(this,"inverseMap");if(r[e])return r[e];var a=this._findInverseFor(e,t);return r[e]=a,a},_findInverseFor:function(e,r){function a(t,r,i){var o=i||[],s=n(r,"relationships");if(!s)return o;var d=s.get(t.modelName);return d=d.filter(function(t){var a=r.metaForProperty(t.name).options;return a.inverse?e===a.inverse:!0}),d&&o.push.apply(o,d),t.superclass&&a(t.superclass,r,o),o}var i=this.typeForRelationship(e,r);if(!i)return null;var o=this.metaForProperty(e),s=o.options;if(null===s.inverse)return null;var d,l,u;if(s.inverse)d=s.inverse,u=t["default"].get(i,"relationshipsByName").get(d),l=u.kind;else{o.type===o.parentType.modelName;var c=a(this,i);if(0===c.length)return null;var h=c.filter(function(t){var r=i.metaForProperty(t.name).options;return e===r.inverse});1===h.length&&(c=h),d=c[0].name,l=c[0].kind}return{type:i,name:d,kind:l}},relationships:d,relationshipNames:t["default"].computed(function(){var e={hasMany:[],belongsTo:[]};return this.eachComputedProperty(function(t,r){r.isRelationship&&e[r.kind].push(t)}),e}),relatedTypes:l,relationshipsByName:u,fields:t["default"].computed(function(){var e=o.create();return this.eachComputedProperty(function(t,r){r.isRelationship?e.set(t,r.kind):r.isAttribute&&e.set(t,"attribute")}),e}).readOnly(),eachRelationship:function(e,t){n(this,"relationshipsByName").forEach(function(r,a){e.call(t,a,r)})},eachRelatedType:function(e,t){for(var r=n(this,"relatedTypes"),a=0;a<r.length;a++){var i=r[a];e.call(t,i)}},determineRelationshipType:function(e,t){var r=e.key,a=e.kind,i=this.inverseFor(r,t),n=void 0,o=void 0;return i?(n=i.name,o=i.kind,"belongsTo"===o?"belongsTo"===a?"oneToOne":"manyToOne":"belongsTo"===a?"oneToMany":"manyToMany"):"belongsTo"===a?"oneToNone":"manyToNone"}});e.RelationshipsClassMethodsMixin=h;var p=t["default"].Mixin.create({eachRelationship:function(e,t){this.constructor.eachRelationship(e,t)},relationshipFor:function(e){return n(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e,this.store)}});e.RelationshipsInstanceMethodsMixin=p}),e("ember-data/-private/system/relationships/has-many",["exports","ember","ember-data/-private/debug","ember-data/-private/system/normalize-model-name","ember-data/-private/system/is-array-like"],function(e,t,a,i,n){function o(e,a){"object"==typeof e&&(a=e,e=void 0),a=a||{},"string"==typeof e&&(e=(0,i["default"])(e));var n={type:e,isRelationship:!0,options:a,kind:"hasMany",key:null};return t["default"].computed({get:function(e){var t=this._internalModel._relationships.get(e);return t.getRecords()},set:function(e,a){var i=(r("ember-data/model")["default"],this._internalModel._relationships.get(e));return i.clear(),i.addRecords(t["default"].A(a).mapBy("_internalModel")),i.getRecords()}}).meta(n)}e["default"]=o;var s=t["default"].Mixin.create({notifyHasManyAdded:function(e){this.notifyPropertyChange(e)}});e.HasManyMixin=s}),e("ember-data/-private/system/relationships/state/belongs-to",["exports","ember","ember-data/-private/debug","ember-data/-private/system/promise-proxies","ember-data/-private/utils","ember-data/-private/system/relationships/state/relationship"],function(e,t,r,a,i,n){function o(e,t,r,a){this._super$constructor(e,t,r,a),this.record=t,this.key=a.key,this.inverseRecord=null,this.canonicalState=null}e["default"]=o,o.prototype=Object.create(n["default"].prototype),o.prototype.constructor=o,o.prototype._super$constructor=n["default"],o.prototype.setRecord=function(e){e?this.addRecord(e):this.inverseRecord&&this.removeRecord(this.inverseRecord),this.setHasData(!0),this.setHasLoaded(!0)},o.prototype.setCanonicalRecord=function(e){e?this.addCanonicalRecord(e):this.inverseRecord&&this.removeCanonicalRecord(this.inverseRecord),this.setHasData(!0),this.setHasLoaded(!0)},o.prototype._super$addCanonicalRecord=n["default"].prototype.addCanonicalRecord,o.prototype.addCanonicalRecord=function(e){this.canonicalMembers.has(e)||(this.canonicalState&&this.removeCanonicalRecord(this.canonicalState),this.canonicalState=e,this._super$addCanonicalRecord(e))},o.prototype._super$flushCanonical=n["default"].prototype.flushCanonical,o.prototype.flushCanonical=function(){this.inverseRecord&&this.inverseRecord.isNew()&&!this.canonicalState||(this.inverseRecord=this.canonicalState,this.record.notifyBelongsToChanged(this.key),this._super$flushCanonical())},o.prototype._super$addRecord=n["default"].prototype.addRecord,o.prototype.addRecord=function(e){this.members.has(e)||((0,i.assertPolymorphicType)(this.record,this.relationshipMeta,e),this.inverseRecord&&this.removeRecord(this.inverseRecord),this.inverseRecord=e,this._super$addRecord(e),this.record.notifyBelongsToChanged(this.key))},o.prototype.setRecordPromise=function(e){var t=e.get&&e.get("content");this.setRecord(t?t._internalModel:t);
3
- },o.prototype._super$removeRecordFromOwn=n["default"].prototype.removeRecordFromOwn,o.prototype.removeRecordFromOwn=function(e){this.members.has(e)&&(this.inverseRecord=null,this._super$removeRecordFromOwn(e),this.record.notifyBelongsToChanged(this.key))},o.prototype._super$removeCanonicalRecordFromOwn=n["default"].prototype.removeCanonicalRecordFromOwn,o.prototype.removeCanonicalRecordFromOwn=function(e){this.canonicalMembers.has(e)&&(this.canonicalState=null,this._super$removeCanonicalRecordFromOwn(e))},o.prototype.findRecord=function(){return this.inverseRecord?this.store._findByInternalModel(this.inverseRecord):t["default"].RSVP.Promise.resolve(null)},o.prototype.fetchLink=function(){var e=this;return this.store.findBelongsTo(this.record,this.link,this.relationshipMeta).then(function(t){return t&&e.addRecord(t),t})},o.prototype.getRecord=function(){var e=this;if(this.isAsync){var t;return t=this.link?this.hasLoaded?this.findRecord():this.findLink().then(function(){return e.findRecord()}):this.findRecord(),a.PromiseObject.create({promise:t,content:this.inverseRecord?this.inverseRecord.getRecord():null})}if(null===this.inverseRecord)return null;var r=this.inverseRecord.getRecord();return r},o.prototype.reload=function(){return this.link?this.fetchLink():this.inverseRecord&&this.inverseRecord.record?this.inverseRecord.record.reload():this.findRecord()}}),e("ember-data/-private/system/relationships/state/create",["exports","ember","ember-data/-private/system/relationships/state/has-many","ember-data/-private/system/relationships/state/belongs-to","ember-data/-private/system/empty-object"],function(e,t,r,a,i){function n(e,t,i){var n,o=e.type.inverseFor(t.key,i);return o&&(n=o.name),"hasMany"===t.kind?new r["default"](i,e,n,t):new a["default"](i,e,n,t)}function o(e){this.record=e,this.initializedRelationships=new i["default"]}e["default"]=o;var s=t["default"].get;o.prototype.has=function(e){return!!this.initializedRelationships[e]},o.prototype.get=function(e){var t=this.initializedRelationships,r=s(this.record.type,"relationshipsByName");return!t[e]&&r.get(e)&&(t[e]=n(this.record,r.get(e),this.record.store)),t[e]}}),e("ember-data/-private/system/relationships/state/has-many",["exports","ember-data/-private/debug","ember-data/-private/system/promise-proxies","ember-data/-private/system/relationships/state/relationship","ember-data/-private/system/ordered-set","ember-data/-private/system/many-array","ember-data/-private/utils"],function(e,t,r,a,i,n,o){function s(e,t,r,a){this._super$constructor(e,t,r,a),this.belongsToType=a.type,this.canonicalState=[],this.manyArray=n["default"].create({canonicalState:this.canonicalState,store:this.store,relationship:this,type:this.store.modelFor(this.belongsToType),record:t}),this.isPolymorphic=a.options.polymorphic,this.manyArray.isPolymorphic=this.isPolymorphic}function d(e){var t=new i["default"];if(e)for(var r=0,a=e.length;a>r;r++)t.add(e[r]);return t}e["default"]=s,s.prototype=Object.create(a["default"].prototype),s.prototype.constructor=s,s.prototype._super$constructor=a["default"],s.prototype.destroy=function(){this.manyArray.destroy()},s.prototype._super$updateMeta=a["default"].prototype.updateMeta,s.prototype.updateMeta=function(e){this._super$updateMeta(e),this.manyArray.set("meta",e)},s.prototype._super$addCanonicalRecord=a["default"].prototype.addCanonicalRecord,s.prototype.addCanonicalRecord=function(e,t){this.canonicalMembers.has(e)||(void 0!==t?this.canonicalState.splice(t,0,e):this.canonicalState.push(e),this._super$addCanonicalRecord(e,t))},s.prototype._super$addRecord=a["default"].prototype.addRecord,s.prototype.addRecord=function(e,t){this.members.has(e)||(this._super$addRecord(e,t),this.manyArray.internalAddRecords([e],t))},s.prototype._super$removeCanonicalRecordFromOwn=a["default"].prototype.removeCanonicalRecordFromOwn,s.prototype.removeCanonicalRecordFromOwn=function(e,t){var r=t;this.canonicalMembers.has(e)&&(void 0===r&&(r=this.canonicalState.indexOf(e)),r>-1&&this.canonicalState.splice(r,1),this._super$removeCanonicalRecordFromOwn(e,t))},s.prototype._super$flushCanonical=a["default"].prototype.flushCanonical,s.prototype.flushCanonical=function(){this.manyArray.flushCanonical(),this._super$flushCanonical()},s.prototype._super$removeRecordFromOwn=a["default"].prototype.removeRecordFromOwn,s.prototype.removeRecordFromOwn=function(e,t){this.members.has(e)&&(this._super$removeRecordFromOwn(e,t),void 0!==t?this.manyArray.currentState.removeAt(t):this.manyArray.internalRemoveRecords([e]))},s.prototype.notifyRecordRelationshipAdded=function(e,t){(0,o.assertPolymorphicType)(this.record,this.relationshipMeta,e),this.record.notifyHasManyAdded(this.key,e,t)},s.prototype.reload=function(){var e=this,t=this.manyArray.get("isLoaded");if(this._loadingPromise){if(this._loadingPromise.get("isPending"))return this._loadingPromise;this._loadingPromise.get("isRejected")&&this.manyArray.set("isLoaded",t)}return this.link?this.fetchLink():this.store.scheduleFetchMany(this.manyArray.toArray()).then(function(){return e.manyArray.set("isLoaded",!0),e.manyArray})},s.prototype.computeChanges=function(e){var t,r,a,i=this.canonicalMembers,n=[];for(e=d(e),i.forEach(function(t){e.has(t)||n.push(t)}),this.removeCanonicalRecords(n),e=e.toArray(),t=e.length,a=0;t>a;a++)r=e[a],this.removeCanonicalRecord(r),this.addCanonicalRecord(r,a)},s.prototype.fetchLink=function(){var e=this;return this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(t){return t.hasOwnProperty("meta")&&e.updateMeta(t.meta),e.store._backburner.join(function(){e.updateRecordsFromAdapter(t),e.manyArray.set("isLoaded",!0)}),e.manyArray})},s.prototype.findRecords=function(){for(var e=this,t=this.manyArray.toArray(),r=new Array(t.length),a=0;a<t.length;a++)r[a]=t[a]._internalModel;return this.store.findMany(r).then(function(){return e.manyArray.get("isDestroyed")||e.manyArray.set("isLoaded",!0),e.manyArray})},s.prototype.notifyHasManyChanged=function(){this.record.notifyHasManyAdded(this.key)},s.prototype.getRecords=function(){var e=this;if(this.isAsync){var t;return t=this.link?this.hasLoaded?this.findRecords():this.findLink().then(function(){return e.findRecords()}):this.findRecords(),this._loadingPromise=r.PromiseManyArray.create({content:this.manyArray,promise:t}),this._loadingPromise}return this.manyArray.get("isDestroyed")||this.manyArray.set("isLoaded",!0),this.manyArray}}),e("ember-data/-private/system/relationships/state/relationship",["exports","ember","ember-data/-private/debug","ember-data/-private/system/ordered-set"],function(e,t,r,a){function i(e,t,r,i){var n=i.options.async;this.members=new a["default"],this.canonicalMembers=new a["default"],this.store=e,this.key=i.key,this.inverseKey=r,this.record=t,this.isAsync="undefined"==typeof n?!0:n,this.relationshipMeta=i,this.inverseKeyForImplicit=this.record.constructor.modelName+this.key,this.linkPromise=null,this.meta=null,this.hasData=!1,this.hasLoaded=!1}e["default"]=i,i.prototype={constructor:i,destroy:t["default"].K,updateMeta:function(e){this.meta=e},clear:function(){for(var e,t=this.members.list;t.length>0;)e=t[0],this.removeRecord(e)},removeRecords:function(e){var t=this;e.forEach(function(e){return t.removeRecord(e)})},addRecords:function(e,t){var r=this;e.forEach(function(e){r.addRecord(e,t),void 0!==t&&t++})},addCanonicalRecords:function(e,t){for(var r=0;r<e.length;r++)void 0!==t?this.addCanonicalRecord(e[r],r+t):this.addCanonicalRecord(e[r])},addCanonicalRecord:function(e,t){this.canonicalMembers.has(e)||(this.canonicalMembers.add(e),this.inverseKey?e._relationships.get(this.inverseKey).addCanonicalRecord(this.record):(e._implicitRelationships[this.inverseKeyForImplicit]||(e._implicitRelationships[this.inverseKeyForImplicit]=new i(this.store,e,this.key,{options:{}})),e._implicitRelationships[this.inverseKeyForImplicit].addCanonicalRecord(this.record))),this.flushCanonicalLater(),this.setHasData(!0)},removeCanonicalRecords:function(e,t){for(var r=0;r<e.length;r++)void 0!==t?this.removeCanonicalRecord(e[r],r+t):this.removeCanonicalRecord(e[r])},removeCanonicalRecord:function(e,t){this.canonicalMembers.has(e)&&(this.removeCanonicalRecordFromOwn(e),this.inverseKey?this.removeCanonicalRecordFromInverse(e):e._implicitRelationships[this.inverseKeyForImplicit]&&e._implicitRelationships[this.inverseKeyForImplicit].removeCanonicalRecord(this.record)),this.flushCanonicalLater()},addRecord:function(e,t){this.members.has(e)||(this.members.addWithIndex(e,t),this.notifyRecordRelationshipAdded(e,t),this.inverseKey?e._relationships.get(this.inverseKey).addRecord(this.record):(e._implicitRelationships[this.inverseKeyForImplicit]||(e._implicitRelationships[this.inverseKeyForImplicit]=new i(this.store,e,this.key,{options:{}})),e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)),this.record.updateRecordArraysLater()),this.setHasData(!0)},removeRecord:function(e){this.members.has(e)&&(this.removeRecordFromOwn(e),this.inverseKey?this.removeRecordFromInverse(e):e._implicitRelationships[this.inverseKeyForImplicit]&&e._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record))},removeRecordFromInverse:function(e){var t=e._relationships.get(this.inverseKey);t&&t.removeRecordFromOwn(this.record)},removeRecordFromOwn:function(e){this.members["delete"](e),this.notifyRecordRelationshipRemoved(e),this.record.updateRecordArrays()},removeCanonicalRecordFromInverse:function(e){var t=e._relationships.get(this.inverseKey);t&&t.removeCanonicalRecordFromOwn(this.record)},removeCanonicalRecordFromOwn:function(e){this.canonicalMembers["delete"](e),this.flushCanonicalLater()},flushCanonical:function(){this.willSync=!1;for(var e=[],t=0;t<this.members.list.length;t++)this.members.list[t].isNew()&&e.push(this.members.list[t]);for(this.members=this.canonicalMembers.copy(),t=0;t<e.length;t++)this.members.add(e[t])},flushCanonicalLater:function(){var e=this;this.willSync||(this.willSync=!0,this.store._backburner.join(function(){return e.store._backburner.schedule("syncRelationships",e,e.flushCanonical)}))},updateLink:function(e){e!==this.link&&(this.link=e,this.linkPromise=null,this.setHasLoaded(!1),this.record.notifyPropertyChange(this.key))},findLink:function(){if(this.linkPromise)return this.linkPromise;var e=this.fetchLink();return this.linkPromise=e,e.then(function(e){return e})},updateRecordsFromAdapter:function(e){this.computeChanges(e),this.setHasData(!0),this.setHasLoaded(!0)},notifyRecordRelationshipAdded:t["default"].K,notifyRecordRelationshipRemoved:t["default"].K,setHasData:function(e){this.hasData=e},setHasLoaded:function(e){this.hasLoaded=e}}}),e("ember-data/-private/system/serializer",["exports","ember"],function(e,t){e["default"]=t["default"].Object.extend({normalizeResponse:null,serialize:null,normalize:function(e,t){return t}})}),e("ember-data/-private/system/snapshot-record-array",["exports","ember-data/-private/features"],function(e,t){function r(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];this._snapshots=null,this._recordArray=e,this.length=e.get("length"),this.type=e.get("type"),this.meta=t,this.adapterOptions=r.adapterOptions}e["default"]=r,r.prototype.snapshots=function(){if(this._snapshots)return this._snapshots;var e=this._recordArray;return this._snapshots=e.invoke("createSnapshot"),this._snapshots}}),e("ember-data/-private/system/snapshot",["exports","ember","ember-data/-private/system/empty-object","ember-data/-private/features"],function(e,t,r,a){function i(e){var t=this,a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this._attributes=new r["default"],this._belongsToRelationships=new r["default"],this._belongsToIds=new r["default"],this._hasManyRelationships=new r["default"],this._hasManyIds=new r["default"];var i=e.getRecord();this.record=i,i.eachAttribute(function(e){return t._attributes[e]=n(i,e)}),this.id=e.id,this._internalModel=e,this.type=e.type,this.modelName=e.type.modelName,this.adapterOptions=a.adapterOptions,this._changedAttributes=i.changedAttributes()}e["default"]=i;var n=t["default"].get;i.prototype={constructor:i,id:null,record:null,type:null,modelName:null,attr:function(e){if(e in this._attributes)return this._attributes[e];throw new t["default"].Error("Model '"+t["default"].inspect(this.record)+"' has no attribute named '"+e+"' defined.")},attributes:function(){return t["default"].copy(this._attributes)},changedAttributes:function(){for(var e=new r["default"],a=Object.keys(this._changedAttributes),i=0,n=a.length;n>i;i++){var o=a[i];e[o]=t["default"].copy(this._changedAttributes[o])}return e},belongsTo:function(e,r){var a,i,o,s,d=r&&r.id;if(d&&e in this._belongsToIds)return this._belongsToIds[e];if(!d&&e in this._belongsToRelationships)return this._belongsToRelationships[e];if(a=this._internalModel._relationships.get(e),!a||"belongsTo"!==a.relationshipMeta.kind)throw new t["default"].Error("Model '"+t["default"].inspect(this.record)+"' has no belongsTo relationship named '"+e+"' defined.");return o=n(a,"hasData"),i=n(a,"inverseRecord"),o&&(s=i&&!i.isDeleted()?d?n(i,"id"):i.createSnapshot():null),d?this._belongsToIds[e]=s:this._belongsToRelationships[e]=s,s},hasMany:function(e,r){var a,i,o,s,d=r&&r.ids;if(d&&e in this._hasManyIds)return this._hasManyIds[e];if(!d&&e in this._hasManyRelationships)return this._hasManyRelationships[e];if(a=this._internalModel._relationships.get(e),!a||"hasMany"!==a.relationshipMeta.kind)throw new t["default"].Error("Model '"+t["default"].inspect(this.record)+"' has no hasMany relationship named '"+e+"' defined.");return o=n(a,"hasData"),i=n(a,"members"),o&&(s=[],i.forEach(function(e){e.isDeleted()||(d?s.push(e.id):s.push(e.createSnapshot()))})),d?this._hasManyIds[e]=s:this._hasManyRelationships[e]=s,s},eachAttribute:function(e,t){this.record.eachAttribute(e,t)},eachRelationship:function(e,t){this.record.eachRelationship(e,t)},serialize:function(e){return this.record.store.serializerFor(this.modelName).serialize(this,e)}}}),e("ember-data/-private/system/store",["exports","ember","ember-data/model","ember-data/-private/debug","ember-data/-private/system/normalize-link","ember-data/-private/system/normalize-model-name","ember-data/-private/adapters/errors","ember-data/-private/system/promise-proxies","ember-data/-private/system/store/common","ember-data/-private/system/store/serializer-response","ember-data/-private/system/store/serializers","ember-data/-private/system/store/finders","ember-data/-private/utils","ember-data/-private/system/coerce-id","ember-data/-private/system/record-array-manager","ember-data/-private/system/store/container-instance-cache","ember-data/-private/system/model/internal-model","ember-data/-private/system/empty-object","ember-data/-private/features"],function(e,t,r,a,i,n,o,s,d,l,u,c,h,p,f,m,y,v,b){function g(e,t){var r=e.then(function(e){return e.getRecord()});return(0,s.promiseObject)(r,t)}function R(e,t,r,a){return C(a)?void 0:e._internalModelForId(a.type,a.id)}function _(e,t,r,a){if(!C(a)){for(var i=new Array(a.length),n=0;n<a.length;n++)i[n]=R(e,t,r,a[n]);return i}}function A(e){return e.serializerFor("application")}function F(e,t,r,a){var i=a._internalModel,n=a.modelName,s=t.modelFor(n),c=e[r](t,s,a),h=(0,u.serializerForAdapter)(t,e,n),p="DS: Extract and notify about "+r+" completion of "+i;return c=I.resolve(c,p),c=(0,d._guard)(c,(0,d._bind)(d._objectIsAlive,t)),c=(0,d._guard)(c,(0,d._bind)(d._objectIsAlive,i)),c.then(function(e){return t._adapterRun(function(){var n,o;e&&(n=(0,l.normalizeResponseHelper)(h,t,s,e,a.id,r),n.included&&t.push({data:n.included}),o=n.data),t.didSaveRecord(i,{data:o})}),i},function(e){if(e instanceof o.InvalidError){var r=h.extractErrors(t,s,e,a.id);t.recordWasInvalid(i,r)}else t.recordWasError(i,e);throw e},p)}function z(e,t,r){r.relationships&&t.type.eachRelationship(function(a,n){var o=n.kind;if(r.relationships[a]){var s;if(r.relationships[a].links&&r.relationships[a].links.related){var d=(0,i["default"])(r.relationships[a].links.related);d&&d.href&&(s=t._relationships.get(a),s.updateLink(d.href))}r.relationships[a].meta&&(s=t._relationships.get(a),s.updateMeta(r.relationships[a].meta)),M(e,a,n,r.relationships[a]);var l=r.relationships[a].data;void 0!==l&&("belongsTo"===o?(s=t._relationships.get(a),s.setCanonicalRecord(l)):"hasMany"===o&&(s=t._relationships.get(a),s.updateRecordsFromAdapter(l)))}})}function M(e,t,r,a){var i=a.data;if(i){var n=r.kind;"belongsTo"===n?a.data=R(e,t,r,i):"hasMany"===n&&(a.data=_(e,t,r,i))}}var S="`id` has to be non-empty string or number";e.badIdFormatAssertion=S;var T=t["default"]._Backburner||t["default"].Backburner||t["default"].__loader.require("backburner")["default"]||t["default"].__loader.require("backburner").Backburner,x=t["default"].Map,k=Array.isArray||t["default"].isArray;if(!T.prototype.join){var w=function(e){return"string"==typeof e};T.prototype.join=function(){var e,t;if(this.currentInstance){var r=arguments.length;if(1===r?(e=arguments[0],t=null):(t=arguments[0],e=arguments[1]),w(e)&&(e=t[e]),1===r)return e();if(2===r)return e.call(t);for(var a=new Array(r-2),i=0;i<a.length;i++)a[i]=arguments[i+2];return e.apply(t,a)}return this.run.apply(this,arguments)}}var E,P=t["default"].get,D=t["default"].set,O=t["default"].run.once,C=t["default"].isNone,I=t["default"].RSVP.Promise,j=t["default"].copy,N=t["default"].Service;N||(N=t["default"].Object),e.Store=E=N.extend({init:function(){this._super.apply(this,arguments),this._backburner=new T(["normalizeRelationships","syncRelationships","finished"]),this.typeMaps={},this.recordArrayManager=f["default"].create({store:this}),this._pendingSave=[],this._instanceCache=new m["default"]((0,h.getOwner)(this)),this._pendingFetch=x.create()},adapter:"-json-api",serialize:function(e,t){var r=e._internalModel.createSnapshot();return r.serialize(t)},defaultAdapter:t["default"].computed("adapter",function(){var e=P(this,"adapter");return e=this.retrieveManagedInstance("adapter",e)}),createRecord:function(e,t){var r=this.modelFor(e),a=j(t)||new v["default"];C(a.id)&&(a.id=this._generateId(e,a)),a.id=(0,p["default"])(a.id);var i=this.buildInternalModel(r,a.id),n=i.getRecord();return i.loadedData(),n.setProperties(a),i.eachRelationship(function(e,t){i._relationships.get(e).setHasData(!0)}),n},_generateId:function(e,t){var r=this.adapterFor(e);return r&&r.generateIdForRecord?r.generateIdForRecord(this,e,t):null},deleteRecord:function(e){e.deleteRecord()},unloadRecord:function(e){e.unloadRecord()},find:function(e,r,a){return 1===arguments.length,"object"===t["default"].typeOf(r),this.findRecord(e,r)},findRecord:function(e,t,r){var a=this._internalModelForId(e,t);if(r=r||{},!this.hasRecordForId(e,t))return this._findByInternalModel(a,r);var i=this._findRecord(a,r);return g(i,"DS: Store#findRecord "+a.typeKey+" with id: "+P(a,"id"))},_findRecord:function(e,t){if(t.reload)return this.scheduleFetch(e,t);var r=e.createSnapshot(t),a=e.type,i=this.adapterFor(a.modelName);return i.shouldReloadRecord(this,r)?this.scheduleFetch(e,t):(i.shouldBackgroundReloadRecord(this,r)&&this.scheduleFetch(e,t),I.resolve(e))},_findByInternalModel:function(e,t){t=t||{},t.preload&&e._preloadData(t.preload);var r=this._findEmptyInternalModel(e,t);return g(r,"DS: Store#findRecord "+e.typeKey+" with id: "+P(e,"id"))},_findEmptyInternalModel:function(e,t){return e.isEmpty()?this.scheduleFetch(e,t):e.isLoading()?e._loadingPromise:I.resolve(e)},findByIds:function(e,r){for(var a=new Array(r.length),i=0;i<r.length;i++)a[i]=this.findRecord(e,r[i]);return(0,s.promiseArray)(t["default"].RSVP.all(a).then(t["default"].A,null,"DS: Store#findByIds of "+e+" complete"))},fetchRecord:function(e,t){var r=e.type,a=e.id,i=this.adapterFor(r.modelName),n=(0,c._find)(i,this,r,a,e,t);return n},scheduleFetchMany:function(e){for(var r=new Array(e.length),a=new Array(e.length),i=0;i<e.length;i++)r[i]=e[i]._internalModel;for(var i=0;i<r.length;i++)a[i]=this.scheduleFetch(r[i]);return t["default"].RSVP.Promise.all(a)},scheduleFetch:function(e,r){var a=e.type;if(e._loadingPromise)return e._loadingPromise;var i=t["default"].RSVP.defer("Fetching "+a+"with id: "+e.id),n={record:e,resolver:i,options:r},o=i.promise;return e.loadingData(o),this._pendingFetch.get(a)?this._pendingFetch.get(a).push(n):this._pendingFetch.set(a,[n]),t["default"].run.scheduleOnce("afterRender",this,this.flushAllPendingFetches),o},flushAllPendingFetches:function(){this.isDestroyed||this.isDestroying||(this._pendingFetch.forEach(this._flushPendingFetchForType,this),this._pendingFetch=x.create())},_flushPendingFetchForType:function(e,r){function a(e){e.resolver.resolve(d.fetchRecord(e.record,e.options))}function i(r){return r.forEach(function(r){var a=t["default"].A(e).findBy("record",r);if(a){var i=a.resolver;i.resolve(r)}}),r}function n(e){return function(r){r=t["default"].A(r);var a=e.reject(function(e){return r.contains(e)});a.length,s(a)}}function o(e){return function(t){s(e,t)}}function s(r,a){r.forEach(function(r){var i=t["default"].A(e).findBy("record",r);if(i){var n=i.resolver;n.reject(a)}})}var d=this,l=d.adapterFor(r.modelName),u=!!l.findMany&&l.coalesceFindRequests,h=t["default"].A(e).mapBy("record");if(1===e.length)a(e[0]);else if(u){var p=t["default"].A(h).invoke("createSnapshot"),f=l.groupRecordsForFindMany(this,p);f.forEach(function(s){var u=t["default"].A(s).mapBy("_internalModel"),h=t["default"].A(u),p=h.mapBy("id");if(p.length>1)(0,c._findMany)(l,d,r,p,h).then(i).then(n(h)).then(null,o(h));else if(1===p.length){var f=t["default"].A(e).findBy("record",u[0]);a(f)}})}else e.forEach(a)},peekRecord:function(e,t){return this.hasRecordForId(e,t)?this._internalModelForId(e,t).getRecord():null},reloadRecord:function(e){var t=e.type.modelName;this.adapterFor(t),e.id;return this.scheduleFetch(e)},hasRecordForId:function(e,t){var r=this.modelFor(e),a=(0,p["default"])(t),i=this.typeMapFor(r).idToRecord[a];return!!i&&i.isLoaded()},recordForId:function(e,t){return this._internalModelForId(e,t).getRecord()},_internalModelForId:function(e,t){var r=this.modelFor(e),a=(0,p["default"])(t),i=this.typeMapFor(r).idToRecord,n=i[a];return n&&i[a]||(n=this.buildInternalModel(r,a)),n},findMany:function(e){for(var t=new Array(e.length),r=0;r<e.length;r++)t[r]=this._findByInternalModel(e[r]);return I.all(t)},findHasMany:function(e,t,r){var a=this.adapterFor(e.type.modelName);return(0,c._findHasMany)(a,this,e,t,r)},findBelongsTo:function(e,t,r){var a=this.adapterFor(e.type.modelName);return(0,c._findBelongsTo)(a,this,e,t,r)},query:function(e,t){return this._query(e,t)},_query:function(e,t,r){var a=this.modelFor(e);r=r||this.recordArrayManager.createAdapterPopulatedRecordArray(a,t);var i=this.adapterFor(e);return(0,s.promiseArray)((0,c._query)(i,this,a,t,r))},queryRecord:function(e,t){var r=this.modelFor(e),a=this.adapterFor(e);return(0,s.promiseObject)((0,c._queryRecord)(a,this,r,t))},findAll:function(e,t){var r=this.modelFor(e);return this._fetchAll(r,this.peekAll(e),t)},_fetchAll:function(e,t,r){r=r||{};var a=this.adapterFor(e.modelName),i=this.typeMapFor(e).metadata.since;if(D(t,"isUpdating",!0),r.reload)return(0,s.promiseArray)((0,c._findAll)(a,this,e,i,r));var n=t.createSnapshot(r);return a.shouldReloadAll(this,n)?(0,s.promiseArray)((0,c._findAll)(a,this,e,i,r)):(a.shouldBackgroundReloadAll(this,n)&&(0,c._findAll)(a,this,e,i,r),(0,s.promiseArray)(I.resolve(t)))},didUpdateAll:function(e){var t=this.recordArrayManager.liveRecordArrayFor(e);D(t,"isUpdating",!1)},peekAll:function(e){var t=this.modelFor(e),r=this.recordArrayManager.liveRecordArrayFor(t);return this.recordArrayManager.populateLiveRecordArray(r,t),r},unloadAll:function(e){if(0===arguments.length){for(var t=this.typeMaps,r=Object.keys(t),a=new Array(r.length),i=0;i<r.length;i++)a[i]=t[r[i]].type.modelName;a.forEach(this.unloadAll,this)}else{for(var n=this.modelFor(e),o=this.typeMapFor(n),s=o.records.slice(),d=void 0,i=0;i<s.length;i++)d=s[i],d.unloadRecord(),d.destroy();o.metadata=new v["default"]}},filter:function(e,r,a){!t["default"].ENV.ENABLE_DS_FILTER;var i,n,o=arguments.length,d=3===o;return d?i=this.query(e,r):2===arguments.length&&(a=r),e=this.modelFor(e),n=d?this.recordArrayManager.createFilteredRecordArray(e,a,r):this.recordArrayManager.createFilteredRecordArray(e,a),i=i||I.resolve(n),(0,s.promiseArray)(i.then(function(){return n},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,t){return this.hasRecordForId(e,t)},dataWasUpdated:function(e,t){this.recordArrayManager.recordDidChange(t)},scheduleSave:function(e,t,r){var a=e.createSnapshot(r);e.flushChangedAttributes(),e.adapterWillCommit(),this._pendingSave.push({snapshot:a,resolver:t}),O(this,"flushPendingSave")},flushPendingSave:function(){var e=this,t=this._pendingSave.slice();this._pendingSave=[],t.forEach(function(t){var r,a=t.snapshot,i=t.resolver,n=a._internalModel,o=e.adapterFor(n.type.modelName);return"root.deleted.saved"===P(n,"currentState.stateName")?i.resolve():(r=n.isNew()?"createRecord":n.isDeleted()?"deleteRecord":"updateRecord",void i.resolve(F(o,e,r,a)))})},didSaveRecord:function(e,t){var r;t&&(r=t.data),r&&(this._backburner.schedule("normalizeRelationships",this,"_setupRelationships",e,r),this.updateId(e,r)),e.adapterDidCommit(r)},recordWasInvalid:function(e,t){e.adapterDidInvalidate(t)},recordWasError:function(e,t){e.adapterDidError(t)},updateId:function(e,t){var r=(e.id,(0,p["default"])(t.id));this.typeMapFor(e.type).idToRecord[r]=e,e.setId(r)},typeMapFor:function(e){var r=P(this,"typeMaps"),a=t["default"].guidFor(e),i=r[a];return i?i:(i={idToRecord:new v["default"],records:[],metadata:new v["default"],type:e},r[a]=i,i)},_load:function(e){var t=this._internalModelForId(e.type,e.id);return t.setupData(e),this.recordArrayManager.recordDidChange(t),t},_modelForMixin:function(e){var t=(0,n["default"])(e),a=(0,h.getOwner)(this),i=a._lookupFactory("mixin:"+t);i&&a.register("model:"+t,r["default"].extend(i));var o=this.modelFactoryFor(t);return o&&(o.__isMixin=!0,o.__mixin=i),o},modelFor:function(e){var r=this.modelFactoryFor(e);if(r||(r=this._modelForMixin(e)),!r)throw new t["default"].Error("No model was found for '"+e+"'");return r.modelName=r.modelName||(0,n["default"])(e),r},modelFactoryFor:function(e){var t=(0,n["default"])(e),r=(0,h.getOwner)(this);return r._lookupFactory("model:"+t)},push:function(e){var t,r,a=e.included;if(a)for(t=0,r=a.length;r>t;t++)this._pushInternalModel(a[t]);if(k(e.data)){r=e.data.length;var i=new Array(r);for(t=0;r>t;t++)i[t]=this._pushInternalModel(e.data[t]).getRecord();return i}if(null===e.data)return null;var n=this._pushInternalModel(e.data);return n.getRecord()},_hasModelFor:function(e){return(0,h.getOwner)(this)._lookupFactory("model:"+e)},_pushInternalModel:function(e){var r=this,a=e.type;this.modelFor(a);t["default"].ENV.DS_WARN_ON_UNKNOWN_KEYS;var i=this._load(e);return this._backburner.join(function(){r._backburner.schedule("normalizeRelationships",r,"_setupRelationships",i,e)}),i},_setupRelationships:function(e,t){z(this,e,t)},pushPayload:function(e,t){var r,a,i=this;t?(a=t,r=this.serializerFor(e)):(a=e,r=A(this)),this._adapterRun(function(){return r.pushPayload(i,a)})},normalize:function(e,t){var r=this.serializerFor(e),a=this.modelFor(e);return r.normalize(a,t)},buildInternalModel:function(e,t,r){var a=this.typeMapFor(e),i=a.idToRecord,n=new y["default"](e,t,this,null,r);return t&&(i[t]=n),a.records.push(n),n},recordWasLoaded:function(e){this.recordArrayManager.recordWasLoaded(e)},_dematerializeRecord:function(e){var t=e.type,r=this.typeMapFor(t),a=e.id;e.updateRecordArrays(),a&&delete r.idToRecord[a];var i=r.records.indexOf(e);r.records.splice(i,1)},adapterFor:function(e){return this.lookupAdapter(e)},_adapterRun:function(e){return this._backburner.run(e)},serializerFor:function(e){var t=["application",this.adapterFor(e).get("defaultSerializer"),"-default"],r=this.lookupSerializer(e,t);return r},retrieveManagedInstance:function(e,t,r){var a=(0,n["default"])(t),i=this._instanceCache.get(e,a,r);return D(i,"store",this),i},lookupAdapter:function(e){return this.retrieveManagedInstance("adapter",e,this.get("_adapterFallbacks"))},_adapterFallbacks:t["default"].computed("adapter",function(){var e=this.get("adapter");return["application",e,"-json-api"]}),lookupSerializer:function(e,t){return this.retrieveManagedInstance("serializer",e,t)},willDestroy:function(){this._super.apply(this,arguments),this.recordArrayManager.destroy(),this.unloadAll()}}),e.Store=E,e["default"]=E}),e("ember-data/-private/system/store/common",["exports","ember"],function(e,t){function r(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(void 0,t)}}function a(e,t){var r=e["finally"](function(){t()||(r._subscribers.length=0)});return r}function i(e){return!(n(e,"isDestroyed")||n(e,"isDestroying"))}e._bind=r,e._guard=a,e._objectIsAlive=i;var n=t["default"].get}),e("ember-data/-private/system/store/container-instance-cache",["exports","ember","ember-data/-private/system/empty-object"],function(e,t,r){function a(e){this._owner=e,this._cache=new r["default"]}e["default"]=a,a.prototype=new r["default"],t["default"].merge(a.prototype,{get:function(e,t,r){var a=this._cache,i=e+":"+t;if(!(i in a)){var n=this.instanceFor(i)||this._findInstance(e,r);n&&(a[i]=n)}return a[i]},_findInstance:function(e,t){for(var r=0,a=t.length;a>r;r++){var i=t[r],n=e+":"+i,o=this.instanceFor(n);if(o)return o}},instanceFor:function(e){var t=this._cache;if(!t[e]){var r=this._owner.lookup(e);r&&(t[e]=r)}return t[e]},destroy:function(){for(var e=this._cache,t=Object.keys(e),r=0,a=t.length;a>r;r++){var i=t[r],n=e[i];n&&n.destroy()}this._owner=null},constructor:a,toString:function(){return"ContainerInstanceCache"}})}),e("ember-data/-private/system/store/finders",["exports","ember","ember-data/-private/debug","ember-data/-private/system/store/common","ember-data/-private/system/store/serializer-response","ember-data/-private/system/store/serializers"],function(e,t,r,a,i,n){function o(e,t,r,o,s,d){var l=s.createSnapshot(d),u=e.findRecord(t,r,o,l),c=(0,n.serializerForAdapter)(t,e,s.type.modelName),h="DS: Handle Adapter#findRecord of "+r+" with id: "+o;return u=p.resolve(u,h),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,t)),u.then(function(e){return t._adapterRun(function(){var a=(0,i.normalizeResponseHelper)(c,t,r,e,o,"findRecord"),n=t.push(a);return n._internalModel})},function(e){throw s.notFound(),s.isEmpty()&&s.unloadRecord(),e},"DS: Extract payload of '"+r+"'")}function s(e,r,o,s,d){var l=t["default"].A(d).invoke("createSnapshot"),u=e.findMany(r,o,s,l),c=(0,n.serializerForAdapter)(r,e,o.modelName),h="DS: Handle Adapter#findMany of "+o;if(void 0===u)throw new Error("adapter.findMany returned undefined, this was very likely a mistake");return u=p.resolve(u,h),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,r)),u.then(function(e){return r._adapterRun(function(){for(var t=(0,i.normalizeResponseHelper)(c,r,o,e,null,"findMany"),a=r.push(t),n=new Array(a.length),s=0;s<a.length;s++)n[s]=a[s]._internalModel;return n})},null,"DS: Extract payload of "+o)}function d(e,t,r,o,s){var d=r.createSnapshot(),l=t.modelFor(s.type),u=e.findHasMany(t,d,o,s),c=(0,n.serializerForAdapter)(t,e,s.type),h="DS: Handle Adapter#findHasMany of "+r+" : "+s.type;return u=p.resolve(u,h),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,t)),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,r)),u.then(function(e){return t._adapterRun(function(){var r=(0,i.normalizeResponseHelper)(c,t,l,e,null,"findHasMany"),a=t.push(r),n=a.map(function(e){return e._internalModel});return n.meta=r.meta,n})},null,"DS: Extract payload of "+r+" : hasMany "+s.type)}function l(e,t,r,o,s){var d=r.createSnapshot(),l=t.modelFor(s.type),u=e.findBelongsTo(t,d,o,s),c=(0,n.serializerForAdapter)(t,e,s.type),h="DS: Handle Adapter#findBelongsTo of "+r+" : "+s.type;return u=p.resolve(u,h),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,t)),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,r)),u.then(function(e){return t._adapterRun(function(){var r=(0,i.normalizeResponseHelper)(c,t,l,e,null,"findBelongsTo");
4
- if(!r.data)return null;var a=t.push(r);return a._internalModel})},null,"DS: Extract payload of "+r+" : "+s.type)}function u(e,t,r,o,s){var d=r.modelName,l=t.peekAll(d),u=l.createSnapshot(s),c=e.findAll(t,r,o,u),h=(0,n.serializerForAdapter)(t,e,d),f="DS: Handle Adapter#findAll of "+r;return c=p.resolve(c,f),c=(0,a._guard)(c,(0,a._bind)(a._objectIsAlive,t)),c.then(function(e){return t._adapterRun(function(){var a=(0,i.normalizeResponseHelper)(h,t,r,e,null,"findAll");t.push(a)}),t.didUpdateAll(r),t.peekAll(d)},null,"DS: Extract payload of findAll "+r)}function c(e,t,r,o,s){var d=r.modelName,l=e.query(t,r,o,s),u=(0,n.serializerForAdapter)(t,e,d),c="DS: Handle Adapter#query of "+r;return l=p.resolve(l,c),l=(0,a._guard)(l,(0,a._bind)(a._objectIsAlive,t)),l.then(function(e){var a,n;return t._adapterRun(function(){n=(0,i.normalizeResponseHelper)(u,t,r,e,null,"query"),a=t.push(n)}),s.loadRecords(a,n),s},null,"DS: Extract payload of query "+r)}function h(e,r,o,s){var d=o.modelName,l=e.queryRecord(r,o,s),u=(0,n.serializerForAdapter)(r,e,d),c="DS: Handle Adapter#queryRecord of "+o;return l=p.resolve(l,c),l=(0,a._guard)(l,(0,a._bind)(a._objectIsAlive,r)),l.then(function(e){var a;return r._adapterRun(function(){var n=(0,i.normalizeResponseHelper)(u,r,o,e,null,"queryRecord");t["default"].assert("`store.queryRecord` expected the adapter to return one record but the response from the adapter was empty.",n.data),a=r.push(n)}),a},null,"DS: Extract payload of queryRecord "+o)}e._find=o,e._findMany=s,e._findHasMany=d,e._findBelongsTo=l,e._findAll=u,e._query=c,e._queryRecord=h;var p=t["default"].RSVP.Promise}),e("ember-data/-private/system/store/serializer-response",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){var r=[];return e&&"object"==typeof e?("data"in e||"errors"in e||"meta"in e?"data"in e&&"errors"in e&&r.push('Top level keys "errors" and "data" cannot both be present in a JSON API document'):r.push('One or more of the following keys must be present: "data", "errors", "meta".'),"data"in e&&(null===e.data||t["default"].isArray(e.data)||"object"==typeof e.data||r.push("data must be null, an object, or an array")),"meta"in e&&"object"!=typeof e.meta&&r.push("meta must be an object"),"errors"in e&&(t["default"].isArray(e.errors)||r.push("errors must be an array")),"links"in e&&"object"!=typeof e.links&&r.push("links must be an object"),"jsonapi"in e&&"object"!=typeof e.jsonapi&&r.push("jsonapi must be an object"),"included"in e&&"object"!=typeof e.included&&r.push("included must be an array")):r.push("Top level of a JSON API document must be an object"),r}function i(e,t,r,a,i,n){var o=e.normalizeResponse(t,r,a,i,n);return o}e.validateDocumentStructure=a,e.normalizeResponseHelper=i}),e("ember-data/-private/system/store/serializers",["exports"],function(e){function t(e,t,r){var a=t.serializer;return void 0===a&&(a=e.serializerFor(r)),(null===a||void 0===a)&&(a={extract:function(e,t,r){return r}}),a}e.serializerForAdapter=t}),e("ember-data/-private/transforms",["exports","ember-data/transform","ember-data/-private/transforms/number","ember-data/-private/transforms/date","ember-data/-private/transforms/string","ember-data/-private/transforms/boolean"],function(e,t,r,a,i,n){e.Transform=t["default"],e.NumberTransform=r["default"],e.DateTransform=a["default"],e.StringTransform=i["default"],e.BooleanTransform=n["default"]}),e("ember-data/-private/transforms/boolean",["exports","ember-data/transform"],function(e,t){e["default"]=t["default"].extend({deserialize:function(e){var t=typeof e;return"boolean"===t?e:"string"===t?null!==e.match(/^true$|^t$|^1$/i):"number"===t?1===e:!1},serialize:function(e){return Boolean(e)}})}),e("ember-data/-private/transforms/date",["exports","ember","ember-data/-private/ext/date","ember-data/transform"],function(e,t,r,a){e["default"]=a["default"].extend({deserialize:function(e){var r=typeof e;return"string"===r?new Date(t["default"].Date.parse(e)):"number"===r?new Date(e):null===e||void 0===e?e:null},serialize:function(e){return e instanceof Date?e.toISOString():null}})}),e("ember-data/-private/transforms/number",["exports","ember","ember-data/transform"],function(e,t,r){function a(e){return e===e&&e!==1/0&&e!==-(1/0)}var i=t["default"].isEmpty;e["default"]=r["default"].extend({deserialize:function(e){var t;return i(e)?null:(t=Number(e),a(t)?t:null)},serialize:function(e){var t;return i(e)?null:(t=Number(e),a(t)?t:null)}})}),e("ember-data/-private/transforms/string",["exports","ember","ember-data/transform"],function(e,t,r){var a=t["default"].isNone;e["default"]=r["default"].extend({deserialize:function(e){return a(e)?null:String(e)},serialize:function(e){return a(e)?null:String(e)}})}),e("ember-data/-private/utils",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){return n(e,"attributes").has("type")||n(e,"relationshipsByName").has("type")}function i(e){var r;return t["default"].getOwner&&(r=t["default"].getOwner(e)),!r&&e.container&&(r=e.container),r&&r.lookupFactory&&!r._lookupFactory&&(r._lookupFactory=r.lookupFactory,r.register=function(){var e=r.registry||r._registry||r;return e.register.apply(e,arguments)}),r}var n=t["default"].get,o=function(e,t,r){var a=r.type.modelName,i=e.type.modelName,n=t.key,o=e.store.modelFor(t.type);"You cannot add a record of type '"+a+"' to the '"+i+"."+n+"' relationship (only '"+o.modelName+"' allowed)"};e.assertPolymorphicType=o,e.modelHasAttributeOrRelationshipNamedType=a,e.getOwner=i}),e("ember-data/adapter",["exports","ember"],function(e,t){var r=t["default"].get;e["default"]=t["default"].Object.extend({defaultSerializer:"-default",findRecord:null,findAll:null,query:null,queryRecord:null,generateIdForRecord:null,serialize:function(e,t){return r(e.record,"store").serializerFor(e.modelName).serialize(e,t)},createRecord:null,updateRecord:null,deleteRecord:null,coalesceFindRequests:!0,findMany:null,groupRecordsForFindMany:function(e,t){return[t]},shouldReloadRecord:function(e,t){return!1},shouldReloadAll:function(e,t){return!t.length},shouldBackgroundReloadRecord:function(e,t){return!0},shouldBackgroundReloadAll:function(e,t){return!0}})}),e("ember-data/adapters/json-api",["exports","ember","ember-data/adapters/rest"],function(e,t,r){e["default"]=r["default"].extend({defaultSerializer:"-json-api",ajaxOptions:function(e,t,r){var a=this._super.apply(this,arguments);a.contentType&&(a.contentType="application/vnd.api+json");var i=a.beforeSend;return a.beforeSend=function(e){e.setRequestHeader("Accept","application/vnd.api+json"),i&&i(e)},a},coalesceFindRequests:!1,findMany:function(e,t,r,a){var i=this.buildURL(t.modelName,r,a,"findMany");return this.ajax(i,"GET",{data:{filter:{id:r.join(",")}}})},pathForType:function(e){var r=t["default"].String.dasherize(e);return t["default"].String.pluralize(r)},updateRecord:function(e,t,r){var a={},i=e.serializerFor(t.modelName);i.serializeIntoHash(a,t,r,{includeId:!0});var n=r.id,o=this.buildURL(t.modelName,n,r,"updateRecord");return this.ajax(o,"PATCH",{data:a})}})}),e("ember-data/adapters/rest",["exports","ember","ember-data/adapter","ember-data/-private/adapters/errors","ember-data/-private/system/empty-object","ember-data/-private/adapters/build-url-mixin","ember-data/-private/features"],function(e,t,r,a,i,n,o){function s(e){var t=new i["default"];if(!e)return t;for(var r=e.split("\r\n"),a=0;a<r.length;a++){var n=r[a],o=n.indexOf(": ");if(o>0){var s=n.substring(0,o),d=n.substring(o+2);t[s]=d}}return t}function d(e,t){return"function"!=typeof String.prototype.endsWith?-1!==e.indexOf(t,e.length-t.length):e.endsWith(t)}var l=t["default"].MapWithDefault,u=t["default"].get;e["default"]=r["default"].extend(n["default"],{defaultSerializer:"-rest",sortQueryParams:function(e){var t=Object.keys(e),r=t.length;if(2>r)return e;for(var a={},i=t.sort(),n=0;r>n;n++)a[i[n]]=e[i[n]];return a},coalesceFindRequests:!1,findRecord:function(e,t,r,a){var i=this.buildURL(t.modelName,r,a,"findRecord"),n=this.buildQuery(a);return this.ajax(i,"GET",{data:n})},findAll:function(e,t,r,a){var i=this.buildURL(t.modelName,null,null,"findAll"),n=this.buildQuery(a);return r&&(n.since=r),this.ajax(i,"GET",{data:n})},query:function(e,t,r){var a=this.buildURL(t.modelName,null,null,"query",r);return this.sortQueryParams&&(r=this.sortQueryParams(r)),this.ajax(a,"GET",{data:r})},queryRecord:function(e,t,r){var a=this.buildURL(t.modelName,null,null,"queryRecord",r);return this.sortQueryParams&&(r=this.sortQueryParams(r)),this.ajax(a,"GET",{data:r})},findMany:function(e,t,r,a){var i=this.buildURL(t.modelName,r,a,"findMany");return this.ajax(i,"GET",{data:{ids:r}})},findHasMany:function(e,t,r,a){var i=t.id,n=t.modelName;return r=this.urlPrefix(r,this.buildURL(n,i,null,"findHasMany")),this.ajax(r,"GET")},findBelongsTo:function(e,t,r,a){var i=t.id,n=t.modelName;return r=this.urlPrefix(r,this.buildURL(n,i,null,"findBelongsTo")),this.ajax(r,"GET")},createRecord:function(e,t,r){var a={},i=e.serializerFor(t.modelName),n=this.buildURL(t.modelName,null,r,"createRecord");return i.serializeIntoHash(a,t,r,{includeId:!0}),this.ajax(n,"POST",{data:a})},updateRecord:function(e,t,r){var a={},i=e.serializerFor(t.modelName);i.serializeIntoHash(a,t,r);var n=r.id,o=this.buildURL(t.modelName,n,r,"updateRecord");return this.ajax(o,"PUT",{data:a})},deleteRecord:function(e,t,r){var a=r.id;return this.ajax(this.buildURL(t.modelName,a,r,"deleteRecord"),"DELETE")},_stripIDFromURL:function(e,t){var r=this.buildURL(t.modelName,t.id,t),a=r.split("/"),i=a[a.length-1],n=t.id;return i===n?a[a.length-1]="":d(i,"?id="+n)&&(a[a.length-1]=i.substring(0,i.length-n.length-1)),a.join("/")},maxURLLength:2048,groupRecordsForFindMany:function(e,t){function r(t,r,a){var n=i._stripIDFromURL(e,t[0]),o=0,s=[[]];return t.forEach(function(e){var t=encodeURIComponent(e.id).length+a;n.length+o+t>=r&&(o=0,s.push([])),o+=t;var i=s.length-1;s[i].push(e)}),s}var a=l.create({defaultValue:function(){return[]}}),i=this,n=this.maxURLLength;t.forEach(function(t){var r=i._stripIDFromURL(e,t);a.get(r).push(t)});var o=[];return a.forEach(function(e,t){var a="&ids%5B%5D=".length,i=r(e,n,a);i.forEach(function(e){return o.push(e)})}),o},handleResponse:function(e,t,r,i){if(this.isSuccess(e,t,r))return r;if(this.isInvalid(e,t,r))return new a.InvalidError(r.errors);var n=this.normalizeErrorResponse(e,t,r),o=this.generatedDetailedMessage(e,t,r,i);return new a.AdapterError(n,o)},isSuccess:function(e,t,r){return e>=200&&300>e||304===e},isInvalid:function(e,t,r){return 422===e},ajax:function(e,r,i){var n=this,o={url:e,method:r};return new t["default"].RSVP.Promise(function(d,l){var u=n.ajaxOptions(e,r,i);u.success=function(e,r,a){var i=n.handleResponse(a.status,s(a.getAllResponseHeaders()),e,o);i&&i.isAdapterError?t["default"].run.join(null,l,i):t["default"].run.join(null,d,i)},u.error=function(e,r,i){var d=void 0;d=i instanceof Error?i:"timeout"===r?new a.TimeoutError:"abort"===r?new a.AbortError:n.handleResponse(e.status,s(e.getAllResponseHeaders()),n.parseErrorResponse(e.responseText)||i,o),t["default"].run.join(null,l,d)},n._ajaxRequest(u)},"DS: RESTAdapter#ajax "+r+" to "+e)},_ajaxRequest:function(e){t["default"].$.ajax(e)},ajaxOptions:function(e,t,r){var a=r||{};a.url=e,a.type=t,a.dataType="json",a.context=this,a.data&&"GET"!==t&&(a.contentType="application/json; charset=utf-8",a.data=JSON.stringify(a.data));var i=u(this,"headers");return void 0!==i&&(a.beforeSend=function(e){Object.keys(i).forEach(function(t){return e.setRequestHeader(t,i[t])})}),a},parseErrorResponse:function(e){var r=e;try{r=t["default"].$.parseJSON(e)}catch(a){}return r},normalizeErrorResponse:function(e,t,r){return r&&"object"==typeof r&&r.errors?r.errors:[{status:""+e,title:"The backend responded with an error",detail:""+r}]},generatedDetailedMessage:function(e,t,r,a){var i,n=t["Content-Type"]||"Empty Content-Type";i="text/html"===n&&r.length>250?"[Omitted Lengthy HTML]":r;var o=a.method+" "+a.url,s="Payload ("+n+")";return["Ember Data Request "+o+" returned a "+e,s,i].join("\n")},buildQuery:function(e){var t=(e.include,{});return t}})}),e("ember-data/attr",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e,t,r){if("function"==typeof t.defaultValue)return t.defaultValue.apply(null,arguments);var a=t.defaultValue;return a}function i(e,t){return t in e._attributes||t in e._inFlightAttributes||t in e._data}function n(e,t){return t in e._attributes?e._attributes[t]:t in e._inFlightAttributes?e._inFlightAttributes[t]:e._data[t]}function o(e,r){"object"==typeof e?(r=e,e=void 0):r=r||{};var o={type:e,isAttribute:!0,options:r};return t["default"].computed({get:function(e){var t=this._internalModel;return i(t,e)?n(t,e):a(this,r,e)},set:function(e,t){var r=this._internalModel,a=n(r,e);return t!==a&&(r._attributes[e]=t,this._internalModel.send("didSetProperty",{name:e,oldValue:a,originalValue:r._data[e],value:t})),t}}).meta(o)}e["default"]=o}),e("ember-data",["exports","ember","ember-data/-private/debug","ember-data/-private/core","ember-data/-private/system/normalize-model-name","ember-data/-private/system/model/internal-model","ember-data/-private/system/promise-proxies","ember-data/-private/system/store","ember-data/-private/system/model","ember-data/model","ember-data/-private/system/snapshot","ember-data/adapter","ember-data/-private/system/serializer","ember-data/-private/system/debug","ember-data/-private/adapters/errors","ember-data/-private/system/record-arrays","ember-data/-private/system/many-array","ember-data/-private/system/record-array-manager","ember-data/-private/adapters","ember-data/-private/adapters/build-url-mixin","ember-data/-private/serializers","ember-inflector","ember-data/-private/serializers/embedded-records-mixin","ember-data/-private/transforms","ember-data/relationships","ember-data/setup-container","ember-data/-private/instance-initializers/initialize-store-service","ember-data/-private/system/container-proxy","ember-data/-private/system/relationships/state/relationship"],function(e,t,r,a,i,n,o,s,d,l,u,c,h,p,f,m,y,v,b,g,R,_,A,F,z,M,S,T,x){if(t["default"].VERSION.match(/^1\.([0-9]|1[0-2])\./))throw new t["default"].Error("Ember Data requires at least Ember 1.13.0, but you have "+t["default"].VERSION+". Please upgrade your version of Ember, then upgrade Ember Data.");t["default"].VERSION.match(/^1\.13\./),a["default"].Store=s.Store,a["default"].PromiseArray=o.PromiseArray,a["default"].PromiseObject=o.PromiseObject,a["default"].PromiseManyArray=o.PromiseManyArray,a["default"].Model=l["default"],a["default"].RootState=d.RootState,a["default"].attr=d.attr,a["default"].Errors=d.Errors,a["default"].InternalModel=n["default"],a["default"].Snapshot=u["default"],a["default"].Adapter=c["default"],a["default"].AdapterError=f.AdapterError,a["default"].InvalidError=f.InvalidError,a["default"].TimeoutError=f.TimeoutError,a["default"].AbortError=f.AbortError,a["default"].errorsHashToArray=f.errorsHashToArray,a["default"].errorsArrayToHash=f.errorsArrayToHash,a["default"].Serializer=h["default"],a["default"].DebugAdapter=p["default"],a["default"].RecordArray=m.RecordArray,a["default"].FilteredRecordArray=m.FilteredRecordArray,a["default"].AdapterPopulatedRecordArray=m.AdapterPopulatedRecordArray,a["default"].ManyArray=y["default"],a["default"].RecordArrayManager=v["default"],a["default"].RESTAdapter=b.RESTAdapter,a["default"].BuildURLMixin=g["default"],a["default"].RESTSerializer=R.RESTSerializer,a["default"].JSONSerializer=R.JSONSerializer,a["default"].JSONAPIAdapter=b.JSONAPIAdapter,a["default"].JSONAPISerializer=R.JSONAPISerializer,a["default"].Transform=F.Transform,a["default"].DateTransform=F.DateTransform,a["default"].StringTransform=F.StringTransform,a["default"].NumberTransform=F.NumberTransform,a["default"].BooleanTransform=F.BooleanTransform,a["default"].EmbeddedRecordsMixin=A["default"],a["default"].belongsTo=z.belongsTo,a["default"].hasMany=z.hasMany,a["default"].Relationship=x["default"],a["default"].ContainerProxy=T["default"],a["default"]._setupContainer=M["default"],a["default"]._initializeStoreService=S["default"],Object.defineProperty(a["default"],"normalizeModelName",{enumerable:!0,writable:!1,configurable:!1,value:i["default"]}),t["default"].lookup.DS=a["default"],e["default"]=a["default"]}),e("ember-data/model",["exports","ember-data/-private/system/model"],function(e,t){e["default"]=t["default"]}),e("ember-data/relationships",["exports","ember-data/-private/system/relationships/belongs-to","ember-data/-private/system/relationships/has-many"],function(e,t,r){e.belongsTo=t["default"],e.hasMany=r["default"]}),e("ember-data/serializers/json-api",["exports","ember","ember-data/-private/debug","ember-data/serializers/json","ember-data/-private/system/normalize-model-name","ember-inflector"],function(e,t,r,a,i,n){var o=t["default"].String.dasherize,s=a["default"].extend({_normalizeDocumentHelper:function(e){if("object"===t["default"].typeOf(e.data))e.data=this._normalizeResourceHelper(e.data);else if(Array.isArray(e.data)){for(var r=new Array(e.data.length),a=0;a<e.data.length;a++){var i=e.data[a];r[a]=this._normalizeResourceHelper(i)}e.data=r}if(Array.isArray(e.included)){for(var r=new Array(e.included.length),a=0;a<e.included.length;a++){var n=e.included[a];r[a]=this._normalizeResourceHelper(n)}e.included=r}return e},_normalizeRelationshipDataHelper:function(e){var t=this.modelNameFromPayloadKey(e.type);return e.type=t,e},_normalizeResourceHelper:function(e){var t=this.modelNameFromPayloadKey(e.type);if(!this.store._hasModelFor(t))return null;var r=this.store.modelFor(t),a=this.store.serializerFor(t),i=a.normalize(r,e),n=i.data;return n},pushPayload:function(e,t){var r=this._normalizeDocumentHelper(t);e.push(r)},_normalizeResponse:function(e,t,r,a,i,n){var o=this._normalizeDocumentHelper(r);return o},extractAttributes:function(e,t){var r=this,a={};return t.attributes&&e.eachAttribute(function(e){var i=r.keyForAttribute(e,"deserialize");t.attributes.hasOwnProperty(i)&&(a[e]=t.attributes[i])}),a},extractRelationship:function(e){if("object"===t["default"].typeOf(e.data)&&(e.data=this._normalizeRelationshipDataHelper(e.data)),Array.isArray(e.data)){for(var r=new Array(e.data.length),a=0;a<e.data.length;a++){var i=e.data[a];r[a]=this._normalizeRelationshipDataHelper(i)}e.data=r}return e},extractRelationships:function(e,t){var r=this,a={};return t.relationships&&e.eachRelationship(function(e,i){var n=r.keyForRelationship(e,i.kind,"deserialize");if(t.relationships.hasOwnProperty(n)){var o=t.relationships[n];a[e]=r.extractRelationship(o)}}),a},_extractType:function(e,t){return this.modelNameFromPayloadKey(t.type)},modelNameFromPayloadKey:function(e){return(0,n.singularize)((0,i["default"])(e))},payloadKeyFromModelName:function(e){return(0,n.pluralize)(e)},normalize:function(e,t){t.attributes&&this.normalizeUsingDeclaredMapping(e,t.attributes),t.relationships&&this.normalizeUsingDeclaredMapping(e,t.relationships);var r={id:this.extractId(e,t),type:this._extractType(e,t),attributes:this.extractAttributes(e,t),relationships:this.extractRelationships(e,t)};return this.applyTransforms(e,r.attributes),{data:r}},keyForAttribute:function(e,t){return o(e)},keyForRelationship:function(e,t,r){return o(e)},serialize:function(e,t){var r=this._super.apply(this,arguments);return r.type=this.payloadKeyFromModelName(e.modelName),{data:r}},serializeAttribute:function(e,t,r,a){var i=a.type;if(this._canSerialize(r)){t.attributes=t.attributes||{};var n=e.attr(r);if(i){var o=this.transformFor(i);n=o.serialize(n)}var s=this._getMappedKey(r,e.type);s===r&&(s=this.keyForAttribute(r,"serialize")),t.attributes[s]=n}},serializeBelongsTo:function(e,t,r){var a=r.key;if(this._canSerialize(a)){var i=e.belongsTo(a);if(void 0!==i){t.relationships=t.relationships||{};var n=this._getMappedKey(a,e.type);n===a&&(n=this.keyForRelationship(a,"belongsTo","serialize"));var o=null;i&&(o={type:this.payloadKeyFromModelName(i.modelName),id:i.id}),t.relationships[n]={data:o}}}},serializeHasMany:function(e,t,r){var a=r.key;if(this._shouldSerializeHasMany(e,a,r)){var i=e.hasMany(a);if(void 0!==i){t.relationships=t.relationships||{};var n=this._getMappedKey(a,e.type);n===a&&this.keyForRelationship&&(n=this.keyForRelationship(a,"hasMany","serialize"));for(var o=new Array(i.length),s=0;s<i.length;s++){var d=i[s];o[s]={type:this.payloadKeyFromModelName(d.modelName),id:d.id}}t.relationships[n]={data:o}}}}});e["default"]=s}),e("ember-data/serializers/json",["exports","ember","ember-data/-private/debug","ember-data/-private/system/serializer","ember-data/-private/system/coerce-id","ember-data/-private/system/normalize-model-name","ember-data/-private/utils","ember-data/-private/adapters/errors"],function(e,t,r,a,i,n,o,s){function d(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var l=t["default"].get,u=t["default"].isNone,c=t["default"].merge;e["default"]=a["default"].extend({primaryKey:"id",mergedProperties:["attrs"],applyTransforms:function(e,t){var r=this;return e.eachTransformedAttribute(function(e,a){if(t.hasOwnProperty(e)){var i=r.transformFor(a);t[e]=i.deserialize(t[e])}}),t},normalizeResponse:function(e,t,r,a,i){switch(i){case"findRecord":return this.normalizeFindRecordResponse.apply(this,arguments);case"queryRecord":return this.normalizeQueryRecordResponse.apply(this,arguments);case"findAll":return this.normalizeFindAllResponse.apply(this,arguments);case"findBelongsTo":return this.normalizeFindBelongsToResponse.apply(this,arguments);case"findHasMany":return this.normalizeFindHasManyResponse.apply(this,arguments);case"findMany":return this.normalizeFindManyResponse.apply(this,arguments);case"query":return this.normalizeQueryResponse.apply(this,arguments);case"createRecord":return this.normalizeCreateRecordResponse.apply(this,arguments);case"deleteRecord":return this.normalizeDeleteRecordResponse.apply(this,arguments);case"updateRecord":return this.normalizeUpdateRecordResponse.apply(this,arguments)}},normalizeFindRecordResponse:function(e,t,r,a,i){return this.normalizeSingleResponse.apply(this,arguments)},normalizeQueryRecordResponse:function(e,t,r,a,i){return this.normalizeSingleResponse.apply(this,arguments)},normalizeFindAllResponse:function(e,t,r,a,i){return this.normalizeArrayResponse.apply(this,arguments)},normalizeFindBelongsToResponse:function(e,t,r,a,i){return this.normalizeSingleResponse.apply(this,arguments)},normalizeFindHasManyResponse:function(e,t,r,a,i){return this.normalizeArrayResponse.apply(this,arguments)},normalizeFindManyResponse:function(e,t,r,a,i){return this.normalizeArrayResponse.apply(this,arguments)},normalizeQueryResponse:function(e,t,r,a,i){return this.normalizeArrayResponse.apply(this,arguments)},normalizeCreateRecordResponse:function(e,t,r,a,i){return this.normalizeSaveResponse.apply(this,arguments)},normalizeDeleteRecordResponse:function(e,t,r,a,i){return this.normalizeSaveResponse.apply(this,arguments)},normalizeUpdateRecordResponse:function(e,t,r,a,i){return this.normalizeSaveResponse.apply(this,arguments)},normalizeSaveResponse:function(e,t,r,a,i){return this.normalizeSingleResponse.apply(this,arguments)},normalizeSingleResponse:function(e,t,r,a,i){return this._normalizeResponse(e,t,r,a,i,!0)},normalizeArrayResponse:function(e,t,r,a,i){return this._normalizeResponse(e,t,r,a,i,!1)},_normalizeResponse:function(e,t,r,a,i,n){var o={data:null,included:[]},s=this.extractMeta(e,t,r);if(s&&(o.meta=s),n){var l=this.normalize(t,r),u=l.data,c=l.included;o.data=u,c&&(o.included=c)}else{for(var h=new Array(r.length),p=0,f=r.length;f>p;p++){var m=r[p],y=this.normalize(t,m),u=y.data,c=y.included;if(c){var v;(v=o.included).push.apply(v,d(c))}h[p]=u}o.data=h}return o},normalize:function(e,t){var r=null;return t&&(this.normalizeUsingDeclaredMapping(e,t),r={id:this.extractId(e,t),type:e.modelName,attributes:this.extractAttributes(e,t),relationships:this.extractRelationships(e,t)},this.applyTransforms(e,r.attributes)),{data:r}},extractId:function(e,t){var r=l(this,"primaryKey"),a=t[r];return(0,i["default"])(a)},extractAttributes:function(e,t){var r,a=this,i={};return e.eachAttribute(function(e){r=a.keyForAttribute(e,"deserialize"),t.hasOwnProperty(r)&&(i[e]=t[r])}),i},extractRelationship:function(e,r){if(t["default"].isNone(r))return null;if("object"===t["default"].typeOf(r)){r.id&&(r.id=(0,i["default"])(r.id));var a=this.store.modelFor(e);return r.type&&!(0,o.modelHasAttributeOrRelationshipNamedType)(a)&&(r.type=this.modelNameFromPayloadKey(r.type)),r}return{id:(0,i["default"])(r),type:e}},extractPolymorphicRelationship:function(e,t,r){return this.extractRelationship(e,t)},extractRelationships:function(e,r){var a=this,i={};return e.eachRelationship(function(e,n){var o=null,s=a.keyForRelationship(e,n.kind,"deserialize");if(r.hasOwnProperty(s)){var d=null,l=r[s];if("belongsTo"===n.kind)d=n.options.polymorphic?a.extractPolymorphicRelationship(n.type,l,{key:e,resourceHash:r,relationshipMeta:n}):a.extractRelationship(n.type,l);else if("hasMany"===n.kind&&!t["default"].isNone(l)){d=new Array(l.length);for(var u=0,c=l.length;c>u;u++){var h=l[u];d[u]=a.extractRelationship(n.type,h)}}o={data:d}}var p=a.keyForLink(e,n.kind);if(r.links&&r.links.hasOwnProperty(p)){var f=r.links[p];o=o||{},o.links={related:f}}o&&(i[e]=o)}),i},modelNameFromPayloadKey:function(e){return(0,n["default"])(e)},normalizeAttributes:function(e,t){var r,a=this;this.keyForAttribute&&e.eachAttribute(function(e){r=a.keyForAttribute(e,"deserialize"),e!==r&&t.hasOwnProperty(r)&&(t[e]=t[r],delete t[r])})},normalizeRelationships:function(e,t){var r,a=this;this.keyForRelationship&&e.eachRelationship(function(e,i){r=a.keyForRelationship(e,i.kind,"deserialize"),e!==r&&t.hasOwnProperty(r)&&(t[e]=t[r],delete t[r])})},normalizeUsingDeclaredMapping:function(e,t){var r,a,i,n=l(this,"attrs");if(n)for(i in n)r=a=this._getMappedKey(i,e),t.hasOwnProperty(a)&&(l(e,"attributes").has(i)&&(r=this.keyForAttribute(i)),l(e,"relationshipsByName").has(i)&&(r=this.keyForRelationship(i)),a!==r&&(t[r]=t[a],delete t[a]))},_getMappedKey:function(e,t){var r,a=l(this,"attrs");return a&&a[e]&&(r=a[e],r.key&&(r=r.key),"string"==typeof r&&(e=r)),e},_canSerialize:function(e){var t=l(this,"attrs");return!t||!t[e]||t[e].serialize!==!1},_mustSerialize:function(e){var t=l(this,"attrs");return t&&t[e]&&t[e].serialize===!0},_shouldSerializeHasMany:function(e,t,r){var a=e.type.determineRelationshipType(r,this.store);return this._mustSerialize(t)?!0:this._canSerialize(t)&&("manyToNone"===a||"manyToMany"===a)},serialize:function(e,t){var r=this,a={};if(t&&t.includeId){var i=e.id;i&&(a[l(this,"primaryKey")]=i)}return e.eachAttribute(function(t,i){r.serializeAttribute(e,a,t,i)}),e.eachRelationship(function(t,i){"belongsTo"===i.kind?r.serializeBelongsTo(e,a,i):"hasMany"===i.kind&&r.serializeHasMany(e,a,i)}),a},serializeIntoHash:function(e,t,r,a){c(e,this.serialize(r,a))},serializeAttribute:function(e,t,r,a){var i=a.type;if(this._canSerialize(r)){var n=e.attr(r);if(i){var o=this.transformFor(i);n=o.serialize(n)}var s=this._getMappedKey(r,e.type);s===r&&this.keyForAttribute&&(s=this.keyForAttribute(r,"serialize")),t[s]=n}},serializeBelongsTo:function(e,t,r){var a=r.key;if(this._canSerialize(a)){var i=e.belongsTo(a,{id:!0}),n=this._getMappedKey(a,e.type);n===a&&this.keyForRelationship&&(n=this.keyForRelationship(a,"belongsTo","serialize")),u(i)?t[n]=null:t[n]=i,r.options.polymorphic&&this.serializePolymorphicType(e,t,r)}},serializeHasMany:function(e,t,r){var a=r.key;if(this._shouldSerializeHasMany(e,a,r)){var i=e.hasMany(a,{ids:!0});if(void 0!==i){var n=this._getMappedKey(a,e.type);n===a&&this.keyForRelationship&&(n=this.keyForRelationship(a,"hasMany","serialize")),t[n]=i}}},serializePolymorphicType:t["default"].K,extractMeta:function(e,t,r){if(r&&r.hasOwnProperty("meta")){var a=r.meta;return delete r.meta,a}},extractErrors:function(e,t,r,a){var i=this;return r&&"object"==typeof r&&r.errors&&(r=(0,s.errorsArrayToHash)(r.errors),this.normalizeUsingDeclaredMapping(t,r),t.eachAttribute(function(e){var t=i.keyForAttribute(e,"deserialize");t!==e&&r.hasOwnProperty(t)&&(r[e]=r[t],delete r[t])}),t.eachRelationship(function(e){var t=i.keyForRelationship(e,"deserialize");t!==e&&r.hasOwnProperty(t)&&(r[e]=r[t],delete r[t])})),r},keyForAttribute:function(e,t){return e},keyForRelationship:function(e,t,r){return e},keyForLink:function(e,t){return e},transformFor:function(e,t){var r=(0,o.getOwner)(this).lookup("transform:"+e);return r}})}),e("ember-data/serializers/rest",["exports","ember","ember-data/-private/debug","ember-data/serializers/json","ember-data/-private/system/normalize-model-name","ember-inflector","ember-data/-private/system/coerce-id","ember-data/-private/utils"],function(e,t,r,a,i,n,o,s){function d(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var l=t["default"].String.camelize,u=a["default"].extend({keyForPolymorphicType:function(e,t,r){var a=this.keyForRelationship(e);return a+"Type"},normalize:function(e,t,r){return this.normalizeHash&&this.normalizeHash[r]&&this.normalizeHash[r](t),this._super(e,t,r)},_normalizeArray:function(e,t,r,a){var i=this,n={data:[],included:[]},o=e.modelFor(t),s=e.serializerFor(t);return r.forEach(function(t){var r=i._normalizePolymorphicRecord(e,t,a,o,s),l=r.data,u=r.included;if(n.data.push(l),u){var c;(c=n.included).push.apply(c,d(u))}}),n},_normalizePolymorphicRecord:function(e,t,r,a,i){var n=void 0,o=void 0,d=(0,s.modelHasAttributeOrRelationshipNamedType)(a);return!d&&t.type&&e._hasModelFor(this.modelNameFromPayloadKey(t.type))?(n=e.serializerFor(t.type),o=e.modelFor(t.type)):(n=i,o=a),n.normalize(o,t,r)},_normalizeResponse:function(e,r,a,i,n,s){var l={data:null,included:[]},u=this.extractMeta(e,r,a);u&&(l.meta=u);for(var c=Object.keys(a),h=0,p=c.length;p>h;h++){var f=c[h],m=f,y=!1;"_"===f.charAt(0)&&(y=!0,m=f.substr(1));var v=this.modelNameFromPayloadKey(m);if(e.modelFactoryFor(v)){var b=!y&&this.isPrimaryType(e,v,r),g=a[f];if(null!==g)if(b&&"array"!==t["default"].typeOf(g)){var R=this._normalizePolymorphicRecord(e,g,f,r,this),_=R.data,A=R.included;if(l.data=_,A){var F;(F=l.included).push.apply(F,d(A))}}else{var z=this._normalizeArray(e,v,g,f),M=z.data,S=z.included;if(S){var T;(T=l.included).push.apply(T,d(S))}if(s)M.forEach(function(e){var t=b&&(0,o["default"])(e.id)===i,r=b&&!i&&!l.data;r||t?l.data=e:l.included.push(e)});else if(b)l.data=M;else if(M){var x;(x=l.included).push.apply(x,d(M))}}}}return l},isPrimaryType:function(e,t,r){var a=e.modelFor(t);return a.modelName===r.modelName},pushPayload:function(e,r){var a={data:[],included:[]};for(var i in r){var n=this.modelNameFromPayloadKey(i);if(e.modelFactoryFor(n)){var o=e.modelFor(n),s=e.serializerFor(o.modelName);t["default"].makeArray(r[i]).forEach(function(e){var t=s.normalize(o,e,i),r=t.data,n=t.included;if(a.data.push(r),n){var l;(l=a.included).push.apply(l,d(n))}})}}e.push(a)},modelNameFromPayloadKey:function(e){return(0,n.singularize)((0,i["default"])(e))},serialize:function(e,t){return this._super.apply(this,arguments)},serializeIntoHash:function(e,t,r,a){var i=this.payloadKeyFromModelName(t.modelName);e[i]=this.serialize(r,a)},payloadKeyFromModelName:function(e){return l(e)},serializePolymorphicType:function(e,r,a){var i=a.key,n=e.belongsTo(i),o=this.keyForPolymorphicType(i,a.type,"serialize");i=this.keyForAttribute?this.keyForAttribute(i,"serialize"):i,i+="Type",i!==o&&this.keyForPolymorphicType===u.prototype.keyForPolymorphicType&&(o=i),t["default"].isNone(n)?r[o]=null:r[o]=l(n.modelName)},extractPolymorphicRelationship:function(e,t,r){var a=r.key,i=r.resourceHash,n=r.relationshipMeta,o=n.options.polymorphic,s=this.keyForPolymorphicType(a,e,"deserialize");if(o&&i.hasOwnProperty(s)&&"object"!=typeof t){var d=this.modelNameFromPayloadKey(i[s]);return{id:t,type:d}}return this._super.apply(this,arguments)}});e["default"]=u}),e("ember-data/setup-container",["exports","ember-data/-private/initializers/store","ember-data/-private/initializers/transforms","ember-data/-private/initializers/store-injections","ember-data/-private/initializers/data-adapter"],function(e,t,r,a,i){
5
- function n(e){(0,i["default"])(e),(0,r["default"])(e),(0,a["default"])(e),(0,t["default"])(e)}e["default"]=n}),e("ember-data/store",["exports","ember-data/-private/system/store"],function(e,t){e["default"]=t["default"]}),e("ember-data/transform",["exports","ember"],function(e,t){e["default"]=t["default"].Object.extend({serialize:null,deserialize:null})}),e("ember-data/version",["exports"],function(e){e["default"]="2.4.0-beta.2"}),e("ember-inflector",["exports","ember","ember-inflector/lib/system","ember-inflector/lib/ext/string"],function(t,r,a,i){a.Inflector.defaultRules=a.defaultRules,r["default"].Inflector=a.Inflector,r["default"].String.pluralize=a.pluralize,r["default"].String.singularize=a.singularize,t["default"]=a.Inflector,t.pluralize=a.pluralize,t.singularize=a.singularize,t.defaultRules=a.defaultRules,"undefined"!=typeof e&&e.amd?e("ember-inflector",["exports"],function(e){return e["default"]=a.Inflector,a.Inflector}):"undefined"!=typeof module&&module.exports&&(module.exports=a.Inflector)}),e("ember-inflector/lib/ext/string",["exports","ember","ember-inflector/lib/system/string"],function(e,t,r){(t["default"].EXTEND_PROTOTYPES===!0||t["default"].EXTEND_PROTOTYPES.String)&&(String.prototype.pluralize=function(){return(0,r.pluralize)(this)},String.prototype.singularize=function(){return(0,r.singularize)(this)})}),e("ember-inflector/lib/helpers/pluralize",["exports","ember-inflector","ember-inflector/lib/utils/make-helper"],function(e,t,r){e["default"]=(0,r["default"])(function(e){var r=void 0,a=void 0;return 1===e.length?(a=e[0],(0,t.pluralize)(a)):(r=e[0],a=e[1],1!==parseFloat(r)&&(a=(0,t.pluralize)(a)),r+" "+a)})}),e("ember-inflector/lib/helpers/singularize",["exports","ember-inflector","ember-inflector/lib/utils/make-helper"],function(e,t,r){e["default"]=(0,r["default"])(function(e){return(0,t.singularize)(e[0])})}),e("ember-inflector/lib/system",["exports","ember-inflector/lib/system/inflector","ember-inflector/lib/system/string","ember-inflector/lib/system/inflections"],function(e,t,r,a){t["default"].inflector=new t["default"](a["default"]),e.Inflector=t["default"],e.singularize=r.singularize,e.pluralize=r.pluralize,e.defaultRules=a["default"]}),e("ember-inflector/lib/system/inflections",["exports"],function(e){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"]}}),e("ember-inflector/lib/system/inflector",["exports","ember"],function(e,t){function r(e,t){for(var r=0,a=t.length;a>r;r++)e.uncountable[t[r].toLowerCase()]=!0}function a(e,t){for(var r,a=0,i=t.length;i>a;a++)r=t[a],e.irregular[r[0].toLowerCase()]=r[1],e.irregular[r[1].toLowerCase()]=r[1],e.irregularInverse[r[1].toLowerCase()]=r[0],e.irregularInverse[r[0].toLowerCase()]=r[0]}function i(e){e=e||{},e.uncountable=e.uncountable||n(),e.irregularPairs=e.irregularPairs||n();var t=this.rules={plurals:e.plurals||[],singular:e.singular||[],irregular:n(),irregularInverse:n(),uncountable:n()};r(t,e.uncountable),a(t,e.irregularPairs),this.enableCache()}function n(){var e=Object.create(null);return e._dict=null,delete e._dict,e}var o=t["default"].String.capitalize,s=/^\s*$/,d=/([\w\/-]+[_\/\s-])([a-z\d]+$)/,l=/([\w\/\s-]+)([A-Z][a-z\d]*$)/,u=/[A-Z][a-z\d]*$/;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");i.prototype={enableCache:function(){this.purgeCache(),this.singularize=function(e){return this._cacheUsed=!0,this._sCache[e]||(this._sCache[e]=this._singularize(e))},this.pluralize=function(e){return this._cacheUsed=!0,this._pCache[e]||(this._pCache[e]=this._pluralize(e))}},purgeCache:function(){this._cacheUsed=!1,this._sCache=n(),this._pCache=n()},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,t){this._cacheUsed&&this.purgeCache(),this.rules.plurals.push([e,t.toLowerCase()])},singular:function(e,t){this._cacheUsed&&this.purgeCache(),this.rules.singular.push([e,t.toLowerCase()])},uncountable:function(e){this._cacheUsed&&this.purgeCache(),r(this.rules,[e.toLowerCase()])},irregular:function(e,t){this._cacheUsed&&this.purgeCache(),a(this.rules,[[e,t]])},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,t,r){var a,i,n,c,h,p,f,m,y,v,b;if(m=!e||s.test(e),y=u.test(e),p="",m)return e;if(c=e.toLowerCase(),h=d.exec(e)||l.exec(e),h&&(p=h[1],f=h[2].toLowerCase()),b=this.rules.uncountable[c]||this.rules.uncountable[f])return e;for(v in this.rules.irregular)if(c.match(v+"$"))return i=r[v],y&&r[f]&&(i=o(i),v=o(v)),e.replace(v,i);for(var g=t.length,R=0;g>R&&(a=t[g-1],v=a[0],!v.test(e));g--);return a=a||[],v=a[0],i=a[1],n=e.replace(v,i)}},e["default"]=i}),e("ember-inflector/lib/system/string",["exports","ember-inflector/lib/system/inflector"],function(e,t){function r(e){return t["default"].inflector.pluralize(e)}function a(e){return t["default"].inflector.singularize(e)}e.pluralize=r,e.singularize=a}),e("ember-inflector/lib/utils/make-helper",["exports","ember"],function(e,t){function r(e){return t["default"].Helper?t["default"].Helper.helper(e):t["default"].HTMLBars?t["default"].HTMLBars.makeBoundHelper(e):t["default"].Handlebars.makeBoundHelper(e)}e["default"]=r}),e("ember",[],function(){return{"default":Ember}}),r("ember-data")}(),function(){function e(){var e={"ember-data":{"default":DS},"ember-data/model":{"default":DS.Model},"ember-data/serializers/rest":{"default":DS.RESTSerializer},"ember-data/serializers/active-model":{"default":DS.ActiveModelSerializer},"ember-data/serializers/json":{"default":DS.JSONSerializer},"ember-data/serializers/json-api":{"default":DS.JSONAPISerializer},"ember-data/adapters/json-api":{"default":DS.JSONAPIAdapter},"ember-data/adapters/rest":{"default":DS.RESTAdapter},"ember-data/adapter":{"default":DS.Adapter},"ember-data/adapters/active-model":{"default":DS.ActiveModelAdapter},"ember-data/store":{"default":DS.Store},"ember-data/transform":{"default":DS.Transform},"ember-data/attr":{"default":DS.attr},"ember-data/relationships":{hasMany:DS.hasMany,belongsTo:DS.belongsTo}};for(var r in e)t(r,e[r])}function t(e,t){define(e,[],function(){"use strict";return t})}"undefined"!=typeof define&&define&&define.petal&&e()}(),function(){var e=Ember.K;Ember.onLoad("Ember.Application",function(t){t.initializer({name:"ember-data",initialize:DS._setupContainer}),t.instanceInitializer({name:"ember-data",initialize:DS._initializeStoreService}),t.initializer({name:"store",after:"ember-data",initialize:e}),t.initializer({name:"transforms",before:"store",initialize:e}),t.initializer({name:"data-adapter",before:"store",initialize:e}),t.initializer({name:"injectStore",before:"store",initialize:e})})}();
1
+ !function(){"use strict";var e,t,r,a;!function(){function i(e,t){try{return e()}finally{t()}}function n(e){throw new Error("an unsupported module was defined, expected `define(name, deps, module)` instead got: `"+e+"` arguments to define`")}function o(e,t,r,a){this.id=y++,this.name=e,this.deps=!t.length&&r.length?v:t,this.exports=a||{},this.callback=r,this.state=void 0,this._require=void 0}function s(e){this.name=e}function d(e,t,r){for(var a,i=e.deps,n=i.length,o=new Array(n),s={},d=0,u=n;u>d;d++)a=i[d],"exports"===a?s.exports=o[d]=r:"require"===a?o[d]=e.makeRequire():"module"===a?(e.exports=r,s=o[d]=e):o[d]=l(c(a,t),t);return{deps:o,module:s}}function l(e,t){var a=p[e];if(!a)throw new Error("Could not find module `"+e+"` imported from `"+t+"`");return r(e)}function u(e){throw new Error("Could not find module "+e)}function c(e,t){if("."!==e.charAt(0))return e;for(var r=e.split("/"),a=t.split("/"),i=a.slice(0,-1),n=0,o=r.length;o>n;n++){var s=r[n];if(".."===s){if(0===i.length)throw new Error("Cannot access parent module of root");i.pop()}else{if("."===s)continue;i.push(s)}}return i.join("/")}var h;h=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var p={},f={},m=!1,y=0,v=["require","exports","module"];o.prototype.makeRequire=function(){var e=this.name;return this._require||(this._require=function(t){return r(c(t,e))})},e=function(e,t,r){arguments.length<2&&n(arguments.length),h(t)||(r=t,t=[]),p[e]=new o(e,t,r)},e.petal={},e.alias=function(e){return new s(e)},a=r=t=function(e){var t=p[e];if(t&&t.callback instanceof s&&(t=p[t.callback.name]),t||u(e),t.state!==m&&f.hasOwnProperty(e))return f[e];var r,a,n=!1;f[e]={},i(function(){r=d(t,e,f[e]),a=t.callback.apply(this,r.deps),n=!0},function(){n||(t.state=m)});var o;return o=void 0===a&&r.module.exports?r.module.exports:f[e]=a,null===o||"object"!=typeof o&&"function"!=typeof o||void 0!==o["default"]||(o["default"]=o),f[e]=o},a.entries=a._eak_seen=p,a.unsee=function(e){delete f[e]},a.clear=function(){a.entries=a._eak_seen=p={},f=state={}}}(),e("ember-data/-private/adapters",["exports","ember-data/adapters/json-api","ember-data/adapters/rest"],function(e,t,r){e.JSONAPIAdapter=t["default"],e.RESTAdapter=r["default"]}),e("ember-data/-private/adapters/build-url-mixin",["exports","ember"],function(e,t){var r=t["default"].get;e["default"]=t["default"].Mixin.create({buildURL:function(e,t,r,a,i){switch(a){case"findRecord":return this.urlForFindRecord(t,e,r);case"findAll":return this.urlForFindAll(e);case"query":return this.urlForQuery(i,e);case"queryRecord":return this.urlForQueryRecord(i,e);case"findMany":return this.urlForFindMany(t,e,r);case"findHasMany":return this.urlForFindHasMany(t,e);case"findBelongsTo":return this.urlForFindBelongsTo(t,e);case"createRecord":return this.urlForCreateRecord(e,r);case"updateRecord":return this.urlForUpdateRecord(t,e,r);case"deleteRecord":return this.urlForDeleteRecord(t,e,r);default:return this._buildURL(e,t)}},_buildURL:function(e,t){var a,i=[],n=r(this,"host"),o=this.urlPrefix();return e&&(a=this.pathForType(e),a&&i.push(a)),t&&i.push(encodeURIComponent(t)),o&&i.unshift(o),i=i.join("/"),!n&&i&&"/"!==i.charAt(0)&&(i="/"+i),i},urlForFindRecord:function(e,t,r){return this._buildURL(t,e)},urlForFindAll:function(e){return this._buildURL(e)},urlForQuery:function(e,t){return this._buildURL(t)},urlForQueryRecord:function(e,t){return this._buildURL(t)},urlForFindMany:function(e,t,r){return this._buildURL(t)},urlForFindHasMany:function(e,t){return this._buildURL(t,e)},urlForFindBelongsTo:function(e,t){return this._buildURL(t,e)},urlForCreateRecord:function(e,t){return this._buildURL(e)},urlForUpdateRecord:function(e,t,r){return this._buildURL(t,e)},urlForDeleteRecord:function(e,t,r){return this._buildURL(t,e)},urlPrefix:function(e,t){var a=r(this,"host"),i=r(this,"namespace");if(a&&"/"!==a||(a=""),e)return/^\/\//.test(e)||/http(s)?:\/\//.test(e)?e:"/"===e.charAt(0)?""+a+e:t+"/"+e;var n=[];return a&&n.push(a),i&&n.push(i),n.join("/")},pathForType:function(e){var r=t["default"].String.camelize(e);return t["default"].String.pluralize(r)}})}),e("ember-data/-private/adapters/errors",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){var t=arguments.length<=1||void 0===arguments[1]?"Adapter operation failed":arguments[1];this.isAdapterError=!0,l.call(this,t),this.errors=e||[{title:"Adapter Error",detail:t}]}function i(e){a.call(this,e,"The adapter rejected the commit because it was invalid")}function n(){a.call(this,null,"The adapter operation timed out")}function o(){a.call(this,null,"The adapter operation was aborted")}function s(e){var r=[];return t["default"].isPresent(e)&&Object.keys(e).forEach(function(a){for(var i=t["default"].makeArray(e[a]),n=0;n<i.length;n++){var o="Invalid Attribute",s="/data/attributes/"+a;a===h&&(o="Invalid Document",s="/data"),r.push({title:o,detail:i[n],source:{pointer:s}})}}),r}function d(e){var r={};return t["default"].isPresent(e)&&e.forEach(function(e){if(e.source&&e.source.pointer){var t=e.source.pointer.match(u);t?t=t[2]:-1!==e.source.pointer.search(c)&&(t=h),t&&(r[t]=r[t]||[],r[t].push(e.detail||e.title))}}),r}e.AdapterError=a,e.InvalidError=i,e.TimeoutError=n,e.AbortError=o,e.errorsHashToArray=s,e.errorsArrayToHash=d;var l=t["default"].Error,u=/^\/?data\/(attributes|relationships)\/(.*)/,c=/^\/?data/,h="base";a.prototype=Object.create(l.prototype),i.prototype=Object.create(a.prototype),n.prototype=Object.create(a.prototype),o.prototype=Object.create(a.prototype)}),e("ember-data/-private/core",["exports","ember","ember-data/version"],function(e,t,r){var a=t["default"].Namespace.create({VERSION:r["default"]});t["default"].libraries&&t["default"].libraries.registerCoreLibrary("Ember Data",a.VERSION),e["default"]=a}),e("ember-data/-private/debug",["exports","ember"],function(e,t){function r(){return t["default"].assert.apply(t["default"],arguments)}function a(){return t["default"].debug.apply(t["default"],arguments)}function i(){return t["default"].deprecate.apply(t["default"],arguments)}function n(){return t["default"].info.apply(t["default"],arguments)}function o(){return t["default"].runInDebug.apply(t["default"],arguments)}function s(){return t["default"].warn.apply(t["default"],arguments)}function d(){return t["default"].debugSeal.apply(t["default"],arguments)}e.assert=r,e.debug=a,e.deprecate=i,e.info=n,e.runInDebug=o,e.warn=s,e.debugSeal=d}),e("ember-data/-private/ext/date",["exports","ember"],function(e,t){t["default"].Date=t["default"].Date||{};var r=Date.parse,a=[1,4,5,6,7,10,11];t["default"].Date.parse=function(e){var t,i,n=0;if(i=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(e)){for(var o,s=0;o=a[s];++s)i[o]=+i[o]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,"Z"!==i[8]&&void 0!==i[9]&&(n=60*i[10]+i[11],"+"===i[9]&&(n=0-n)),t=Date.UTC(i[1],i[2],i[3],i[4],i[5]+n,i[6],i[7])}else t=r?r(e):NaN;return t},(t["default"].EXTEND_PROTOTYPES===!0||t["default"].EXTEND_PROTOTYPES.Date)&&(Date.parse=t["default"].Date.parse)}),e("ember-data/-private/features",["exports","ember"],function(e,t){function r(){var e;return(e=t["default"].FEATURES).isEnabled.apply(e,arguments)}e["default"]=r}),e("ember-data/-private/initializers/data-adapter",["exports","ember-data/-private/system/debug/debug-adapter"],function(e,t){function r(e){e.register("data-adapter:main",t["default"])}e["default"]=r}),e("ember-data/-private/initializers/store-injections",["exports"],function(e){function t(e){var t=e.inject||e.injection;t.call(e,"controller","store","service:store"),t.call(e,"route","store","service:store"),t.call(e,"data-adapter","store","service:store")}e["default"]=t}),e("ember-data/-private/initializers/store",["exports","ember-data/-private/system/store","ember-data/-private/serializers","ember-data/-private/adapters"],function(e,t,r,a){function i(e,t){return e.has?e.has(t):e.hasRegistration(t)}function n(e){var n=e.registerOptionsForType||e.optionsForType;n.call(e,"serializer",{singleton:!1}),n.call(e,"adapter",{singleton:!1}),e.register("serializer:-default",r.JSONSerializer),e.register("serializer:-rest",r.RESTSerializer),e.register("adapter:-rest",a.RESTAdapter),e.register("adapter:-json-api",a.JSONAPIAdapter),e.register("serializer:-json-api",r.JSONAPISerializer),i(e,"service:store")||e.register("service:store",t["default"])}e["default"]=n}),e("ember-data/-private/initializers/transforms",["exports","ember-data/-private/transforms"],function(e,t){function r(e){e.register("transform:boolean",t.BooleanTransform),e.register("transform:date",t.DateTransform),e.register("transform:number",t.NumberTransform),e.register("transform:string",t.StringTransform)}e["default"]=r}),e("ember-data/-private/instance-initializers/initialize-store-service",["exports"],function(e){function t(e){var t=e.lookup?e:e.container;t.lookup("service:store")}e["default"]=t}),e("ember-data/-private/serializers",["exports","ember-data/serializers/json-api","ember-data/serializers/json","ember-data/serializers/rest"],function(e,t,r,a){e.JSONAPISerializer=t["default"],e.JSONSerializer=r["default"],e.RESTSerializer=a["default"]}),e("ember-data/-private/system/clone-null",["exports","ember-data/-private/system/empty-object"],function(e,t){function r(e){var r=new t["default"];for(var a in e)r[a]=e[a];return r}e["default"]=r}),e("ember-data/-private/system/coerce-id",["exports"],function(e){function t(e){return null==e||""===e?null:e+""}e["default"]=t}),e("ember-data/-private/system/container-proxy",["exports","ember-data/-private/debug"],function(e,t){function r(e){this.container=e}e["default"]=r,r.prototype.aliasedFactory=function(e,t){var r=this;return{create:function(){return t&&t(),r.container.lookup(e)}}},r.prototype.registerAlias=function(e,t,r){var a=this.aliasedFactory(t,r);return this.container.register(e,a)},r.prototype.registerDeprecation=function(e,t){var r=function(){};return this.registerAlias(e,t,r)},r.prototype.registerDeprecations=function(e){var t,r,a,i;for(t=e.length;t>0;t--)r=e[t-1],a=r.deprecated,i=r.valid,this.registerDeprecation(a,i)}}),e("ember-data/-private/system/debug",["exports","ember-data/-private/system/debug/debug-adapter"],function(e,t){e["default"]=t["default"]}),e("ember-data/-private/system/debug/debug-adapter",["exports","ember","ember-data/model"],function(e,t,r){var a=t["default"].get,i=t["default"].String.capitalize,n=t["default"].String.underscore,o=t["default"].assert;e["default"]=t["default"].DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==r["default"]&&r["default"].detect(e)},columnsForType:function(e){var t=[{name:"id",desc:"Id"}],r=0,o=this;return a(e,"attributes").forEach(function(e,a){if(r++>o.attributeLimit)return!1;var s=i(n(a).replace("_"," "));t.push({name:a,desc:s})}),t},getRecords:function(e,t){if(arguments.length<2){var r=e._debugContainerKey;if(r){var a=r.match(/model:(.*)/);a&&(t=a[1])}}return o("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support",!!t),this.get("store").peekAll(t)},getRecordColumnValues:function(e){var t=this,r=0,i={id:a(e,"id")};return e.eachAttribute(function(n){if(r++>t.attributeLimit)return!1;var o=a(e,n);i[n]=o}),i},getRecordKeywords:function(e){var r=[],i=t["default"].A(["id"]);return e.eachAttribute(function(e){return i.push(e)}),i.forEach(function(t){return r.push(a(e,t))}),r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("hasDirtyAttributes")&&!e.get("isNew"),isClean:!e.get("hasDirtyAttributes")}},getRecordColor:function(e){var t="black";return e.get("isNew")?t="green":e.get("hasDirtyAttributes")&&(t="blue"),t},observeRecord:function(e,r){var a=t["default"].A(),i=t["default"].A(["id","isNew","hasDirtyAttributes"]);e.eachAttribute(function(e){return i.push(e)});var n=this;i.forEach(function(i){var o=function(){r(n.wrapRecord(e))};t["default"].addObserver(e,i,o),a.push(function(){t["default"].removeObserver(e,i,o)})});var o=function(){a.forEach(function(e){return e()})};return o}})}),e("ember-data/-private/system/debug/debug-info",["exports","ember"],function(e,t){e["default"]=t["default"].Mixin.create({_debugInfo:function(){var e=["id"],t={belongsTo:[],hasMany:[]},r=[];this.eachAttribute(function(t,r){return e.push(t)}),this.eachRelationship(function(e,a){t[a.kind].push(e),r.push(e)});var a=[{name:"Attributes",properties:e,expand:!0},{name:"Belongs To",properties:t.belongsTo,expand:!0},{name:"Has Many",properties:t.hasMany,expand:!0},{name:"Flags",properties:["isLoaded","hasDirtyAttributes","isSaving","isDeleted","isError","isNew","isValid"]}];return{propertyInfo:{includeOtherProperties:!0,groups:a,expensiveProperties:r}}}})}),e("ember-data/-private/system/empty-object",["exports"],function(e){function t(){}e["default"]=t;var r=Object.create(null,{constructor:{value:void 0,enumerable:!1,writable:!0}});t.prototype=r}),e("ember-data/-private/system/is-array-like",["exports","ember"],function(e,t){function r(e){if(!e||e.setInterval)return!1;if(Array.isArray(e))return!0;if(t["default"].Array.detect(e))return!0;var r=t["default"].typeOf(e);return"array"===r?!0:void 0!==e.length&&"object"===r?!0:!1}e["default"]=r}),e("ember-data/-private/system/many-array",["exports","ember","ember-data/-private/debug","ember-data/-private/system/promise-proxies"],function(e,t,r,a){var i=t["default"].get,n=t["default"].set;e["default"]=t["default"].Object.extend(t["default"].MutableArray,t["default"].Evented,{init:function(){this._super.apply(this,arguments),this.currentState=t["default"].A([])},record:null,canonicalState:null,currentState:null,length:0,objectAt:function(e){return this.currentState[e]?this.currentState[e].getRecord():void 0},flushCanonical:function(){var e=this.canonicalState.filter(function(e){return!e.isDeleted()}),t=this.currentState.filter(function(e){return e.isNew()});e=e.concat(t);var r=this.length;this.arrayContentWillChange(0,this.length,e.length),this.set("length",e.length),this.currentState=e,this.arrayContentDidChange(0,r,this.length),this.relationship.notifyHasManyChanged(),this.record.updateRecordArrays()},isPolymorphic:!1,isLoaded:!1,relationship:null,meta:null,internalReplace:function(e,t,r){r||(r=[]),this.arrayContentWillChange(e,t,r.length),this.currentState.splice.apply(this.currentState,[e,t].concat(r)),this.set("length",this.currentState.length),this.arrayContentDidChange(e,t,r.length),r&&this.relationship.notifyHasManyChanged(),this.record.updateRecordArrays()},internalRemoveRecords:function(e){for(var t,r=0;r<e.length;r++)t=this.currentState.indexOf(e[r]),this.internalReplace(t,1)},internalAddRecords:function(e,t){void 0===t&&(t=this.currentState.length),this.internalReplace(t,0,e)},replace:function(e,t,r){var a;t>0&&(a=this.currentState.slice(e,e+t),this.get("relationship").removeRecords(a)),r&&this.get("relationship").addRecords(r.map(function(e){return e._internalModel}),e)},promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--,0===this.loadingRecordsCount&&(n(this,"isLoaded",!0),this.trigger("didLoad"))},reload:function(){return this.relationship.reload()},save:function(){var e=this,r="DS: ManyArray#save "+i(this,"type"),n=t["default"].RSVP.all(this.invoke("save"),r).then(function(t){return e},null,"DS: ManyArray#save return ManyArray");return a.PromiseArray.create({promise:n})},createRecord:function(e){var t,r=i(this,"store"),a=i(this,"type");return t=r.createRecord(a.modelName,e),this.pushObject(t),t}})}),e("ember-data/-private/system/merge",["exports"],function(e){function t(e,t){if(!t||"object"!=typeof t)return e;for(var r,a=Object.keys(t),i=a.length,n=0;i>n;n++)r=a[n],e[r]=t[r];return e}e["default"]=t}),e("ember-data/-private/system/model",["exports","ember-data/-private/system/model/model","ember-data/attr","ember-data/-private/system/model/states","ember-data/-private/system/model/errors"],function(e,t,r,a,i){e.RootState=a["default"],e.attr=r["default"],e.Errors=i["default"],e["default"]=t["default"]}),e("ember-data/-private/system/model/attr",["exports","ember","ember-data/-private/debug"],function(e,t,r){var a=t["default"].get,i=t["default"].Map,n=t["default"].Mixin.create({attributes:t["default"].computed(function(){var e=i.create();return this.eachComputedProperty(function(t,r){r.isAttribute&&(r.name=t,e.set(t,r))}),e}).readOnly(),transformedAttributes:t["default"].computed(function(){var e=i.create();return this.eachAttribute(function(t,r){r.type&&e.set(t,r.type)}),e}).readOnly(),eachAttribute:function(e,t){a(this,"attributes").forEach(function(r,a){e.call(t,a,r)})},eachTransformedAttribute:function(e,t){a(this,"transformedAttributes").forEach(function(r,a){e.call(t,a,r)})}});e.AttrClassMethodsMixin=n;var o=t["default"].Mixin.create({eachAttribute:function(e,t){this.constructor.eachAttribute(e,t)}});e.AttrInstanceMethodsMixin=o}),e("ember-data/-private/system/model/errors",["exports","ember","ember-data/-private/debug"],function(e,t,r){var a=t["default"].get,i=t["default"].set,n=t["default"].isEmpty,o=t["default"].makeArray,s=t["default"].MapWithDefault;e["default"]=t["default"].ArrayProxy.extend(t["default"].Evented,{registerHandlers:function(e,t,r){this._registerHandlers(e,t,r)},_registerHandlers:function(e,t,r){this.on("becameInvalid",e,t),this.on("becameValid",e,r)},errorsByAttributeName:t["default"].computed(function(){return s.create({defaultValue:function(){return t["default"].A()}})}),errorsFor:function(e){return a(this,"errorsByAttributeName").get(e)},messages:t["default"].computed.mapBy("content","message"),content:t["default"].computed(function(){return t["default"].A()}),unknownProperty:function(e){var t=this.errorsFor(e);return n(t)?null:t},isEmpty:t["default"].computed.not("length").readOnly(),add:function(e,t){var r=a(this,"isEmpty");this._add(e,t),r&&!a(this,"isEmpty")&&this.trigger("becameInvalid")},_add:function(e,t){t=this._findOrCreateMessages(e,t),this.addObjects(t),a(this,"errorsByAttributeName").get(e).addObjects(t),this.notifyPropertyChange(e)},_findOrCreateMessages:function(e,t){for(var r=this.errorsFor(e),a=o(t),i=new Array(a.length),n=0;n<a.length;n++){var s=a[n],d=r.findBy("message",s);d?i[n]=d:i[n]={attribute:e,message:s}}return i},remove:function(e){a(this,"isEmpty")||(this._remove(e),a(this,"isEmpty")&&this.trigger("becameValid"))},_remove:function(e){if(!a(this,"isEmpty")){var t=this.rejectBy("attribute",e);i(this,"content",t),a(this,"errorsByAttributeName")["delete"](e),this.notifyPropertyChange(e)}},clear:function(){a(this,"isEmpty")||(this._clear(),this.trigger("becameValid"))},_clear:function(){if(!a(this,"isEmpty")){var e=a(this,"errorsByAttributeName"),r=t["default"].A();e.forEach(function(e,t){r.push(t)}),e.clear(),r.forEach(function(e){this.notifyPropertyChange(e)},this),t["default"].ArrayProxy.prototype.clear.call(this)}},has:function(e){return!n(this.errorsFor(e))}})}),e("ember-data/-private/system/model/errors/invalid",["exports","ember"],function(e,t){function r(e){a.call(this,"The backend rejected the commit because it was invalid: "+t["default"].inspect(e)),this.errors=e}e["default"]=r;var a=t["default"].Error;r.prototype=Object.create(a.prototype)}),e("ember-data/-private/system/model/internal-model",["exports","ember","ember-data/-private/debug","ember-data/-private/system/merge","ember-data/-private/system/model/states","ember-data/-private/system/relationships/state/create","ember-data/-private/system/snapshot","ember-data/-private/system/empty-object","ember-data/-private/features","ember-data/-private/utils","ember-data/-private/system/references"],function(e,t,r,a,i,n,o,s,d,l,u){function c(e){return _[e]||(_[e]=e.split("."))}function h(e){return R[e]||(R[e]=c(e)[0])}function p(e){return function(){return v(this.currentState,e)}}function f(e,r,a,o,d){this.type=e,this.id=r,this.store=a,this._data=d||new s["default"],this.modelName=e.modelName,this.dataHasInitialized=!1,this._deferredTriggers=[],this._attributes=new s["default"],this._inFlightAttributes=new s["default"],this._relationships=new n["default"](this),this._recordArrays=void 0,this.currentState=i["default"].empty,this.recordReference=new u.RecordReference(a,this),this.references={},this.isReloading=!1,this.isError=!1,this.error=null,this.__ember_meta__=null,this[t["default"].GUID_KEY]=A++ +"internal-model",this._implicitRelationships=new s["default"]}var m=function(){function e(e,t){var r=[],a=!0,i=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(a=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(d){i=!0,n=d}finally{try{!a&&s["return"]&&s["return"]()}finally{if(i)throw n}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e["default"]=f;var y=t["default"].RSVP.Promise,v=t["default"].get,b=t["default"].set,g=t["default"].copy,R=new s["default"],_=new s["default"],A=0;f.prototype={isEmpty:p("isEmpty"),isLoading:p("isLoading"),isLoaded:p("isLoaded"),hasDirtyAttributes:p("hasDirtyAttributes"),isSaving:p("isSaving"),isDeleted:p("isDeleted"),isNew:p("isNew"),isValid:p("isValid"),dirtyType:p("dirtyType"),constructor:f,materializeRecord:function(){var e={store:this.store,_internalModel:this,id:this.id,currentState:v(this,"currentState"),isError:this.isError,adapterError:this.error};t["default"].setOwner?t["default"].setOwner(e,(0,l.getOwner)(this.store)):e.container=this.store.container,this.record=this.type._create(e),this._triggerDeferredTriggers()},recordObjectWillDestroy:function(){this.record=null},deleteRecord:function(){this.send("deleteRecord")},save:function(e){var r="DS: Model#save "+this,a=t["default"].RSVP.defer(r);return this.store.scheduleSave(this,a,e),a.promise},startedReloading:function(){this.isReloading=!0,this.record&&b(this.record,"isReloading",!0)},finishedReloading:function(){this.isReloading=!1,this.record&&b(this.record,"isReloading",!1)},reload:function(){this.startedReloading();var e=this,t="DS: Model#reload of "+this;return new y(function(t){e.send("reloadRecord",t)},t).then(function(){return e.didCleanError(),e},function(t){throw e.didError(t),t},"DS: Model#reload complete, update flags")["finally"](function(){e.finishedReloading(),e.updateRecordArrays()})},getRecord:function(){return this.record||this.materializeRecord(),this.record},unloadRecord:function(){this.send("unloadRecord")},eachRelationship:function(e,t){return this.type.eachRelationship(e,t)},eachAttribute:function(e,t){return this.type.eachAttribute(e,t)},inverseFor:function(e){return this.type.inverseFor(e)},setupData:function(e){var t=this._changedKeys(e.attributes);(0,a["default"])(this._data,e.attributes),this.pushedData(),this.record&&this.record._notifyProperties(t),this.didInitalizeData()},becameReady:function(){t["default"].run.schedule("actions",this.store.recordArrayManager,this.store.recordArrayManager.recordWasLoaded,this)},didInitalizeData:function(){this.dataHasInitialized||(this.becameReady(),this.dataHasInitialized=!0)},destroy:function(){return this.record?this.record.destroy():void 0},createSnapshot:function(e){return new o["default"](this,e)},loadingData:function(e){this.send("loadingData",e)},loadedData:function(){this.send("loadedData"),this.didInitalizeData()},notFound:function(){this.send("notFound")},pushedData:function(){this.send("pushedData")},flushChangedAttributes:function(){this._inFlightAttributes=this._attributes,this._attributes=new s["default"]},hasChangedAttributes:function(){return Object.keys(this._attributes).length>0},updateChangedAttributes:function(){for(var e=this.changedAttributes(),t=Object.keys(e),r=0,a=t.length;a>r;r++){var i=t[r],n=m(e[i],2),o=n[0],s=n[1];o===s&&delete this._attributes[i]}},changedAttributes:function(){for(var e=this._data,t=this._attributes,r=this._inFlightAttributes,i=(0,a["default"])(g(r),t),n=new s["default"],o=Object.keys(i),d=0,l=o.length;l>d;d++){var u=o[d];n[u]=[e[u],i[u]]}return n},adapterWillCommit:function(){this.send("willCommit")},adapterDidDirty:function(){this.send("becomeDirty"),this.updateRecordArraysLater()},send:function(e,t){var r=v(this,"currentState");return r[e]||this._unhandledEvent(r,e,t),r[e](this,t)},notifyHasManyAdded:function(e,t,r){this.record&&this.record.notifyHasManyAdded(e,t,r)},notifyHasManyRemoved:function(e,t,r){this.record&&this.record.notifyHasManyRemoved(e,t,r)},notifyBelongsToChanged:function(e,t){this.record&&this.record.notifyBelongsToChanged(e,t)},notifyPropertyChange:function(e){this.record&&this.record.notifyPropertyChange(e)},rollbackAttributes:function(){var e=Object.keys(this._attributes);this._attributes=new s["default"],v(this,"isError")&&(this._inFlightAttributes=new s["default"],this.didCleanError()),this.isDeleted()&&this.becameReady(),this.isNew()&&this.clearRelationships(),this.isValid()&&(this._inFlightAttributes=new s["default"]),this.send("rolledBack"),this.record._notifyProperties(e)},transitionTo:function(e){var t=h(e),r=v(this,"currentState"),a=r;do a.exit&&a.exit(this),a=a.parentState;while(!a.hasOwnProperty(t));var i,n,o=c(e),s=[],d=[];for(i=0,n=o.length;n>i;i++)a=a[o[i]],a.enter&&d.push(a),a.setup&&s.push(a);for(i=0,n=d.length;n>i;i++)d[i].enter(this);for(b(this,"currentState",a),this.record&&b(this.record,"currentState",a),i=0,n=s.length;n>i;i++)s[i].setup(this);this.updateRecordArraysLater()},_unhandledEvent:function(e,r,a){var i="Attempted to handle event `"+r+"` ";throw i+="on "+String(this)+" while in state ",i+=e.stateName+". ",void 0!==a&&(i+="Called with "+t["default"].inspect(a)+"."),new t["default"].Error(i)},triggerLater:function(){for(var e=arguments.length,r=new Array(e),a=0;e>a;a++)r[a]=arguments[a];1===this._deferredTriggers.push(r)&&t["default"].run.scheduleOnce("actions",this,"_triggerDeferredTriggers")},_triggerDeferredTriggers:function(){if(this.record){for(var e=0,t=this._deferredTriggers.length;t>e;e++)this.record.trigger.apply(this.record,this._deferredTriggers[e]);this._deferredTriggers.length=0}},clearRelationships:function(){var e=this;this.eachRelationship(function(t,r){if(e._relationships.has(t)){var a=e._relationships.get(t);a.clear(),a.destroy()}}),Object.keys(this._implicitRelationships).forEach(function(t){e._implicitRelationships[t].clear(),e._implicitRelationships[t].destroy()})},_preloadData:function(e){var t=this;Object.keys(e).forEach(function(r){var a=v(e,r),i=t.type.metaForProperty(r);i.isRelationship?t._preloadRelationship(r,a):t._data[r]=a})},_preloadRelationship:function(e,t){var r=this.type.metaForProperty(e),a=r.type;"hasMany"===r.kind?this._preloadHasMany(e,t,a):this._preloadBelongsTo(e,t,a)},_preloadHasMany:function(e,t,r){for(var a=new Array(t.length),i=0;i<t.length;i++){var n=t[i];a[i]=this._convertStringOrNumberIntoInternalModel(n,r)}this._relationships.get(e).updateRecordsFromAdapter(a)},_preloadBelongsTo:function(e,t,r){var a=this._convertStringOrNumberIntoInternalModel(t,r);this._relationships.get(e).setRecord(a)},_convertStringOrNumberIntoInternalModel:function(e,t){return"string"==typeof e||"number"==typeof e?this.store._internalModelForId(t,e):e._internalModel?e._internalModel:e},updateRecordArrays:function(){this._updatingRecordArraysLater=!1,this.store.dataWasUpdated(this.type,this)},setId:function(e){this.id=e,this.record.get("id")!==e&&this.record.set("id",e)},didError:function(e){this.error=e,this.isError=!0,this.record&&this.record.setProperties({isError:!0,adapterError:e})},didCleanError:function(){this.error=null,this.isError=!1,this.record&&this.record.setProperties({isError:!1,adapterError:null})},adapterDidCommit:function(e){e&&(e=e.attributes),this.didCleanError();var t=this._changedKeys(e);(0,a["default"])(this._data,this._inFlightAttributes),e&&(0,a["default"])(this._data,e),this._inFlightAttributes=new s["default"],this.send("didCommit"),this.updateRecordArraysLater(),e&&this.record._notifyProperties(t)},updateRecordArraysLater:function(){this._updatingRecordArraysLater||(this._updatingRecordArraysLater=!0,t["default"].run.schedule("actions",this,this.updateRecordArrays))},addErrorMessageToAttribute:function(e,t){var r=this.getRecord();v(r,"errors")._add(e,t)},removeErrorMessageFromAttribute:function(e){var t=this.getRecord();v(t,"errors")._remove(e)},clearErrorMessages:function(){var e=this.getRecord();v(e,"errors")._clear()},hasErrors:function(){var e=this.getRecord(),r=v(e,"errors");return!t["default"].isEmpty(r)},adapterDidInvalidate:function(e){var t;for(t in e)e.hasOwnProperty(t)&&this.addErrorMessageToAttribute(t,e[t]);this.send("becameInvalid"),this._saveWasRejected()},adapterDidError:function(e){this.send("becameError"),this.didError(e),this._saveWasRejected()},_saveWasRejected:function(){for(var e=Object.keys(this._inFlightAttributes),t=0;t<e.length;t++)void 0===this._attributes[e[t]]&&(this._attributes[e[t]]=this._inFlightAttributes[e[t]]);this._inFlightAttributes=new s["default"]},_changedKeys:function(e){var r=[];if(e){var i,n,o,d,l=Object.keys(e),u=l.length;for(i=(0,a["default"])(new s["default"],this._data),i=(0,a["default"])(i,this._inFlightAttributes),n=0;u>n;n++)d=l[n],o=e[d],void 0===this._attributes[d]&&(t["default"].isEqual(i[d],o)||r.push(d))}return r},toString:function(){return this.record?this.record.toString():"<"+this.modelName+":"+this.id+">"}}}),e("ember-data/-private/system/model/model",["exports","ember","ember-data/-private/debug","ember-data/-private/system/promise-proxies","ember-data/-private/system/model/errors","ember-data/-private/features","ember-data/-private/system/debug/debug-info","ember-data/-private/system/relationships/belongs-to","ember-data/-private/system/relationships/has-many","ember-data/-private/system/relationships/ext","ember-data/-private/system/model/attr"],function(e,t,r,a,i,n,o,s,d,l,u){var c=t["default"].get,h=t["default"].computed("currentState",function(e){return c(this._internalModel.currentState,e)}).readOnly(),p=t["default"].Object.extend(t["default"].Evented,{_internalModel:null,store:null,isEmpty:h,isLoading:h,isLoaded:h,hasDirtyAttributes:t["default"].computed("currentState.isDirty",function(){return this.get("currentState.isDirty")}),isSaving:h,isDeleted:h,isNew:h,isValid:h,dirtyType:h,isError:!1,isReloading:!1,id:null,errors:t["default"].computed(function(){var e=i["default"].create();return e._registerHandlers(this._internalModel,function(){this.send("becameInvalid")},function(){this.send("becameValid")}),e}).readOnly(),adapterError:null,serialize:function(e){return this.store.serialize(this,e)},toJSON:function(e){var t=this.store.serializerFor("-default"),r=this._internalModel.createSnapshot();return t.serialize(r,e)},ready:t["default"].K,didLoad:t["default"].K,didUpdate:t["default"].K,didCreate:t["default"].K,didDelete:t["default"].K,becameInvalid:t["default"].K,becameError:t["default"].K,rolledBack:t["default"].K,data:t["default"].computed.readOnly("_internalModel._data"),send:function(e,t){return this._internalModel.send(e,t)},transitionTo:function(e){return this._internalModel.transitionTo(e)},deleteRecord:function(){this._internalModel.deleteRecord()},destroyRecord:function(e){return this.deleteRecord(),this.save(e)},unloadRecord:function(){this.isDestroyed||this._internalModel.unloadRecord()},_notifyProperties:function(e){t["default"].beginPropertyChanges();for(var r,a=0,i=e.length;i>a;a++)r=e[a],this.notifyPropertyChange(r);t["default"].endPropertyChanges()},changedAttributes:function(){return this._internalModel.changedAttributes()},rollbackAttributes:function(){this._internalModel.rollbackAttributes()},_createSnapshot:function(){return this._internalModel.createSnapshot()},toStringExtension:function(){return c(this,"id")},save:function(e){var t=this;return a.PromiseObject.create({promise:this._internalModel.save(e).then(function(){return t})})},reload:function(){var e=this;return a.PromiseObject.create({
2
+ promise:this._internalModel.reload().then(function(){return e})})},trigger:function(e){for(var r=arguments.length,a=new Array(r-1),i=1;r>i;i++)a[i-1]=arguments[i];t["default"].tryInvoke(this,e,a),this._super.apply(this,arguments)},willDestroy:function(){this._super.apply(this,arguments),this._internalModel.clearRelationships(),this._internalModel.recordObjectWillDestroy()},willMergeMixin:function(e){this.constructor},attr:function(){},belongsTo:function(){},hasMany:function(){},setId:t["default"].observer("id",function(){this._internalModel.setId(this.get("id"))})});p.reopenClass({_create:p.create,create:function(){throw new t["default"].Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.")},modelName:null}),t["default"].setOwner&&Object.defineProperty(p.prototype,"container",{configurable:!0,enumerable:!1,get:function(){return this.store.container}}),p.reopenClass(l.RelationshipsClassMethodsMixin),p.reopenClass(u.AttrClassMethodsMixin),e["default"]=p.extend(o["default"],s.BelongsToMixin,l.DidDefinePropertyMixin,l.RelationshipsInstanceMethodsMixin,d.HasManyMixin,u.AttrInstanceMethodsMixin)}),e("ember-data/-private/system/model/states",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e,t){t.value===t.originalValue?(delete e._attributes[t.name],e.send("propertyWasReset",t.name)):t.value!==t.oldValue&&e.send("becomeDirty"),e.updateRecordArraysLater()}function i(e){var t,r={};for(var a in e)t=e[a],t&&"object"==typeof t?r[a]=i(t):r[a]=t;return r}function n(e,t){for(var r in t)e[r]=t[r];return e}function o(e){var t=i(u);return n(t,e)}function s(e){}function d(e,t,r){e=n(t?Object.create(t):{},e),e.parentState=t,e.stateName=r;for(var a in e)e.hasOwnProperty(a)&&"parentState"!==a&&"stateName"!==a&&"object"==typeof e[a]&&(e[a]=d(e[a],e,r+"."+a));return e}var l=t["default"].get,u={initialState:"uncommitted",isDirty:!0,uncommitted:{didSetProperty:a,loadingData:t["default"].K,propertyWasReset:function(e,t){e.hasChangedAttributes()||e.send("rolledBack")},pushedData:function(e){e.updateChangedAttributes(),e.hasChangedAttributes()||e.transitionTo("loaded.saved")},becomeDirty:t["default"].K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,t){t(e.store.reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollbackAttributes(),e.triggerLater("ready")}},inFlight:{isSaving:!0,didSetProperty:a,becomeDirty:t["default"].K,pushedData:t["default"].K,unloadRecord:s,willCommit:t["default"].K,didCommit:function(e){var t=l(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:!1,deleteRecord:function(e){e.transitionTo("deleted.uncommitted")},didSetProperty:function(e,t){e.removeErrorMessageFromAttribute(t.name),a(e,t),e.hasErrors()||this.becameValid(e)},becameInvalid:t["default"].K,becomeDirty:t["default"].K,pushedData:t["default"].K,willCommit:function(e){e.clearErrorMessages(),e.transitionTo("inFlight")},rolledBack:function(e){e.clearErrorMessages(),e.transitionTo("loaded.saved"),e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)}}},c=o({dirtyType:"created",isNew:!0});c.invalid.rolledBack=function(e){e.transitionTo("deleted.saved")},c.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var h=o({dirtyType:"updated"});c.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.saved"),e.send("invokeLifecycleCallbacks")},c.uncommitted.rollback=function(e){u.uncommitted.rollback.apply(this,arguments),e.transitionTo("deleted.saved")},c.uncommitted.pushedData=function(e){e.transitionTo("loaded.updated.uncommitted"),e.triggerLater("didLoad")},c.uncommitted.propertyWasReset=t["default"].K,h.inFlight.unloadRecord=s,h.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted")};var p={isEmpty:!1,isLoading:!1,isLoaded:!1,isDirty:!1,isSaving:!1,isDeleted:!1,isNew:!1,isValid:!0,rolledBack:t["default"].K,unloadRecord:function(e){e.clearRelationships(),e.transitionTo("deleted.saved")},propertyWasReset:t["default"].K,empty:{isEmpty:!0,loadingData:function(e,t){e._loadingPromise=t,e.transitionTo("loading")},loadedData:function(e){e.transitionTo("loaded.created.uncommitted"),e.triggerLater("ready")},pushedData:function(e){e.transitionTo("loaded.saved"),e.triggerLater("didLoad"),e.triggerLater("ready")}},loading:{isLoading:!0,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved"),e.triggerLater("didLoad"),e.triggerLater("ready"),e.didCleanError()},becameError:function(e){e.triggerLater("becameError",e)},notFound:function(e){e.transitionTo("empty")}},loaded:{initialState:"saved",isLoaded:!0,loadingData:t["default"].K,saved:{setup:function(e){e.hasChangedAttributes()&&e.adapterDidDirty()},didSetProperty:a,pushedData:t["default"].K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,t){t(e.store.reloadRecord(e))},deleteRecord:function(e){e.transitionTo("deleted.uncommitted")},unloadRecord:function(e){e.clearRelationships(),e.transitionTo("deleted.saved")},didCommit:function(e){e.send("invokeLifecycleCallbacks",l(e,"lastDirtyType"))},notFound:t["default"].K},created:c,updated:h},deleted:{initialState:"uncommitted",dirtyType:"deleted",isDeleted:!0,isLoaded:!0,isDirty:!0,setup:function(e){e.updateRecordArrays()},uncommitted:{willCommit:function(e){e.transitionTo("inFlight")},rollback:function(e){e.rollbackAttributes(),e.triggerLater("ready")},pushedData:t["default"].K,becomeDirty:t["default"].K,deleteRecord:t["default"].K,rolledBack:function(e){e.transitionTo("loaded.saved"),e.triggerLater("ready")}},inFlight:{isSaving:!0,unloadRecord:s,willCommit:t["default"].K,didCommit:function(e){e.transitionTo("saved"),e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted"),e.triggerLater("becameError",e)},becameInvalid:function(e){e.transitionTo("invalid"),e.triggerLater("becameInvalid",e)}},saved:{isDirty:!1,setup:function(e){e.clearRelationships();var t=e.store;t._dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e),e.triggerLater("didCommit",e)},willCommit:t["default"].K,didCommit:t["default"].K},invalid:{isValid:!1,didSetProperty:function(e,t){e.removeErrorMessageFromAttribute(t.name),a(e,t),e.hasErrors()||this.becameValid(e)},becameInvalid:t["default"].K,becomeDirty:t["default"].K,deleteRecord:t["default"].K,willCommit:t["default"].K,rolledBack:function(e){e.clearErrorMessages(),e.transitionTo("loaded.saved"),e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")}}},invokeLifecycleCallbacks:function(e,t){"created"===t?e.triggerLater("didCreate",e):e.triggerLater("didUpdate",e),e.triggerLater("didCommit",e)}};p=d(p,null,"root"),e["default"]=p}),e("ember-data/-private/system/normalize-link",["exports"],function(e){function t(e){switch(typeof e){case"object":return e;case"string":return{href:e}}return null}e["default"]=t}),e("ember-data/-private/system/normalize-model-name",["exports","ember"],function(e,t){function r(e){return t["default"].String.dasherize(e)}e["default"]=r}),e("ember-data/-private/system/ordered-set",["exports","ember"],function(e,t){function r(){this._super$constructor()}e["default"]=r;var a=t["default"].OrderedSet,i=t["default"].guidFor;r.create=function(){var e=this;return new e},r.prototype=Object.create(a.prototype),r.prototype.constructor=r,r.prototype._super$constructor=a,r.prototype.addWithIndex=function(e,t){var r=i(e),a=this.presenceSet,n=this.list;return a[r]!==!0?(a[r]=!0,void 0===t||null==t?n.push(e):n.splice(t,0,e),this.size+=1,this):void 0}}),e("ember-data/-private/system/promise-proxies",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){return function(){var t=n(this,"content");return t[e].apply(t,arguments)}}var i=t["default"].RSVP.Promise,n=t["default"].get,o=t["default"].ArrayProxy.extend(t["default"].PromiseProxyMixin),s=t["default"].ObjectProxy.extend(t["default"].PromiseProxyMixin),d=function(e,t){return s.create({promise:i.resolve(e,t)})},l=function(e,t){return o.create({promise:i.resolve(e,t)})},u=o.extend({reload:function(){return u.create({promise:n(this,"content").reload()})},createRecord:a("createRecord"),on:a("on"),one:a("one"),trigger:a("trigger"),off:a("off"),has:a("has")}),c=function(e,t){return u.create({promise:i.resolve(e,t)})};e.PromiseArray=o,e.PromiseObject=s,e.PromiseManyArray=u,e.promiseArray=l,e.promiseObject=d,e.promiseManyArray=c}),e("ember-data/-private/system/record-array-manager",["exports","ember","ember-data/-private/system/record-arrays","ember-data/-private/system/ordered-set"],function(e,t,r,a){function i(e){e.destroy()}function n(e){for(var r=e.length,a=t["default"].A(),i=0;r>i;i++)a=a.concat(e[i]);return a}function o(e,t){var r=e.indexOf(t);return-1!==r?(e.splice(r,1),!0):!1}var s=t["default"].MapWithDefault,d=t["default"].get;e["default"]=t["default"].Object.extend({init:function(){var e=this;this.filteredRecordArrays=s.create({defaultValue:function(){return[]}}),this.liveRecordArrays=s.create({defaultValue:function(t){return e.createRecordArray(t)}}),this.changedRecords=[],this._adapterPopulatedRecordArrays=[]},recordDidChange:function(e){1===this.changedRecords.push(e)&&t["default"].run.schedule("actions",this,this.updateRecordArrays)},recordArraysForRecord:function(e){return e._recordArrays=e._recordArrays||a["default"].create(),e._recordArrays},updateRecordArrays:function(){var e=this;this.changedRecords.forEach(function(t){d(t,"record.isDestroyed")||d(t,"record.isDestroying")||"root.deleted.saved"===d(t,"currentState.stateName")?e._recordWasDeleted(t):e._recordWasChanged(t)}),this.changedRecords.length=0},_recordWasDeleted:function(e){var t=e._recordArrays;t&&(t.forEach(function(t){return t.removeInternalModel(e)}),e._recordArrays=null)},_recordWasChanged:function(e){var t,r=this,a=e.type,i=this.filteredRecordArrays.get(a);i.forEach(function(i){t=d(i,"filterFunction"),r.updateFilterRecordArray(i,t,a,e)})},recordWasLoaded:function(e){var t,r=this,a=e.type,i=this.filteredRecordArrays.get(a);if(i.forEach(function(i){t=d(i,"filterFunction"),r.updateFilterRecordArray(i,t,a,e)}),this.liveRecordArrays.has(a)){var n=this.liveRecordArrays.get(a);this._addRecordToRecordArray(n,e)}},updateFilterRecordArray:function(e,t,r,a){var i=t(a.getRecord()),n=this.recordArraysForRecord(a);i?this._addRecordToRecordArray(e,a):(n["delete"](e),e.removeInternalModel(a))},_addRecordToRecordArray:function(e,t){var r=this.recordArraysForRecord(t);r.has(e)||(e.addInternalModel(t),r.add(e))},populateLiveRecordArray:function(e,t){for(var r,a=this.store.typeMapFor(t),i=a.records,n=0;n<i.length;n++)r=i[n],r.isDeleted()||r.isEmpty()||this._addRecordToRecordArray(e,r)},updateFilter:function(e,t,r){for(var a,i=this.store.typeMapFor(t),n=i.records,o=0;o<n.length;o++)a=n[o],a.isDeleted()||a.isEmpty()||this.updateFilterRecordArray(e,r,t,a)},liveRecordArrayFor:function(e){return this.liveRecordArrays.get(e)},createRecordArray:function(e){var a=r.RecordArray.create({type:e,content:t["default"].A(),store:this.store,isLoaded:!0,manager:this});return a},createFilteredRecordArray:function(e,a,i){var n=r.FilteredRecordArray.create({query:i,type:e,content:t["default"].A(),store:this.store,manager:this,filterFunction:a});return this.registerFilteredRecordArray(n,e,a),n},createAdapterPopulatedRecordArray:function(e,a){var i=r.AdapterPopulatedRecordArray.create({type:e,query:a,content:t["default"].A(),store:this.store,manager:this});return this._adapterPopulatedRecordArrays.push(i),i},registerFilteredRecordArray:function(e,t,r){var a=this.filteredRecordArrays.get(t);a.push(e),this.updateFilter(e,t,r)},unregisterRecordArray:function(e){var t=e.type,r=this.filteredRecordArrays.get(t),a=o(r,e),i=o(this._adapterPopulatedRecordArrays,e);if(!a&&!i&&this.liveRecordArrays.has(t)){var n=this.liveRecordArrayFor(t);e===n&&this.liveRecordArrays["delete"](t)}},willDestroy:function(){this._super.apply(this,arguments),this.filteredRecordArrays.forEach(function(e){return n(e).forEach(i)}),this.liveRecordArrays.forEach(i),this._adapterPopulatedRecordArrays.forEach(i)}})}),e("ember-data/-private/system/record-arrays",["exports","ember-data/-private/system/record-arrays/record-array","ember-data/-private/system/record-arrays/filtered-record-array","ember-data/-private/system/record-arrays/adapter-populated-record-array"],function(e,t,r,a){e.RecordArray=t["default"],e.FilteredRecordArray=r["default"],e.AdapterPopulatedRecordArray=a["default"]}),e("ember-data/-private/system/record-arrays/adapter-populated-record-array",["exports","ember","ember-data/-private/system/record-arrays/record-array","ember-data/-private/system/clone-null"],function(e,t,r,a){var i=t["default"].get;e["default"]=r["default"].extend({query:null,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},loadRecords:function(e,r){var i=this,n=t["default"].A(e).mapBy("_internalModel");this.setProperties({content:t["default"].A(n),isLoaded:!0,meta:(0,a["default"])(r.meta)}),n.forEach(function(e){i.manager.recordArraysForRecord(e).add(i)}),t["default"].run.once(this,"trigger","didLoad")}})}),e("ember-data/-private/system/record-arrays/filtered-record-array",["exports","ember","ember-data/-private/system/record-arrays/record-array"],function(e,t,r){var a=t["default"].get;e["default"]=r["default"].extend({filterFunction:null,isLoaded:!0,replace:function(){var e=a(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=a(this,"manager");e.updateFilter(this,a(this,"type"),a(this,"filterFunction"))},updateFilter:t["default"].observer("filterFunction",function(){t["default"].run.once(this,this._updateFilter)})})}),e("ember-data/-private/system/record-arrays/record-array",["exports","ember","ember-data/-private/system/promise-proxies","ember-data/-private/system/snapshot-record-array"],function(e,t,r,a){var i=t["default"].get,n=t["default"].set;e["default"]=t["default"].ArrayProxy.extend(t["default"].Evented,{type:null,content:null,isLoaded:!1,isUpdating:!1,store:null,objectAtContent:function(e){var t=i(this,"content"),r=t.objectAt(e);return r&&r.getRecord()},update:function(){if(!i(this,"isUpdating")){var e=i(this,"store"),t=i(this,"type.modelName"),r=i(this,"query");return r?e._query(t,r,this):e.findAll(t,{reload:!0})}},addInternalModel:function(e,t){var r=i(this,"content");void 0===t?r.addObject(e):r.contains(e)||r.insertAt(t,e)},removeInternalModel:function(e){i(this,"content").removeObject(e)},save:function(){var e=this,a="DS: RecordArray#save "+i(this,"type"),n=t["default"].RSVP.all(this.invoke("save"),a).then(function(t){return e},null,"DS: RecordArray#save return RecordArray");return r.PromiseArray.create({promise:n})},_dissociateFromOwnRecords:function(){var e=this;this.get("content").forEach(function(t){var r=t._recordArrays;r&&r["delete"](e)})},_unregisterFromManager:function(){var e=i(this,"manager");e.unregisterRecordArray(this)},willDestroy:function(){this._unregisterFromManager(),this._dissociateFromOwnRecords(),n(this,"content",void 0),this._super.apply(this,arguments)},createSnapshot:function(e){var t=this.get("meta");return new a["default"](this,t,e)}})}),e("ember-data/-private/system/references",["exports","ember-data/-private/system/references/record","ember-data/-private/system/references/belongs-to","ember-data/-private/system/references/has-many"],function(e,t,r,a){e.RecordReference=t["default"],e.BelongsToReference=r["default"],e.HasManyReference=a["default"]}),e("ember-data/-private/system/references/belongs-to",["exports","ember-data/model","ember","ember-data/-private/system/references/reference","ember-data/-private/utils"],function(e,t,r,a,i){var n=function(e,t,r){this._super$constructor(e,t),this.belongsToRelationship=r,this.type=r.relationshipMeta.type,this.parent=t.recordReference};n.prototype=Object.create(a["default"].prototype),n.prototype.constructor=n,n.prototype._super$constructor=a["default"],n.prototype.remoteType=function(){return this.belongsToRelationship.link?"link":"id"},n.prototype.id=function(){var e=this.belongsToRelationship.inverseRecord;return e&&e.id},n.prototype.link=function(){return this.belongsToRelationship.link},n.prototype.meta=function(){return this.belongsToRelationship.meta},n.prototype.push=function(e){var a=this;return r["default"].RSVP.resolve(e).then(function(e){var r;return r=e instanceof t["default"]?e:a.store.push(e),(0,i.assertPolymorphicType)(a.internalModel,a.belongsToRelationship.relationshipMeta,r._internalModel),a.belongsToRelationship.setCanonicalRecord(r._internalModel),r})},n.prototype.value=function(){var e=this.belongsToRelationship.inverseRecord;return e&&e.record},n.prototype.load=function(){var e=this;return"id"===this.remoteType()?this.belongsToRelationship.getRecord():"link"===this.remoteType()?this.belongsToRelationship.findLink().then(function(t){return e.value()}):void 0},n.prototype.reload=function(){var e=this;return this.belongsToRelationship.reload().then(function(t){return e.value()})},e["default"]=n}),e("ember-data/-private/system/references/has-many",["exports","ember","ember-data/-private/system/references/reference"],function(e,t,r){var a=t["default"].get,i=function(e,t,r){this._super$constructor(e,t),this.hasManyRelationship=r,this.type=r.relationshipMeta.type,this.parent=t.recordReference};i.prototype=Object.create(r["default"].prototype),i.prototype.constructor=i,i.prototype._super$constructor=r["default"],i.prototype.remoteType=function(){return this.hasManyRelationship.link?"link":"ids"},i.prototype.link=function(){return this.hasManyRelationship.link},i.prototype.ids=function(){var e=this.hasManyRelationship.members,t=e.toArray().map(function(e){return e.id});return t},i.prototype.meta=function(){return this.hasManyRelationship.manyArray.meta},i.prototype.push=function(e){var r=this;return t["default"].RSVP.resolve(e).then(function(e){var t=e;"object"==typeof e&&e.data&&(t=e.data);var a=t.map(function(e){var t=r.store.push(e);return t._internalModel});return r.hasManyRelationship.computeChanges(a),r.hasManyRelationship.manyArray})},i.prototype._isLoaded=function(){var e=a(this.hasManyRelationship,"hasData");if(!e)return!1;var t=this.hasManyRelationship.members.toArray(),r=t.every(function(e){return e.isLoaded()===!0});return r},i.prototype.value=function(){return this._isLoaded()?this.hasManyRelationship.manyArray:null},i.prototype.load=function(){if(!this._isLoaded())return this.hasManyRelationship.getRecords();var e=this.hasManyRelationship.manyArray;return t["default"].RSVP.resolve(e)},i.prototype.reload=function(){return this.hasManyRelationship.reload()},e["default"]=i}),e("ember-data/-private/system/references/record",["exports","ember","ember-data/-private/system/references/reference"],function(e,t,r){var a=function(e,t){this._super$constructor(e,t),this.type=t.modelName,this._id=t.id};a.prototype=Object.create(r["default"].prototype),a.prototype.constructor=a,a.prototype._super$constructor=r["default"],a.prototype.id=function(){return this._id},a.prototype.remoteType=function(){return"identity"},a.prototype.push=function(e){var r=this;return t["default"].RSVP.resolve(e).then(function(e){var t=r.store.push(e);return t})},a.prototype.value=function(){return this.internalModel.record},a.prototype.load=function(){return this.store.findRecord(this.type,this._id)},a.prototype.reload=function(){var e=this.value();return e?e.reload():this.load()},e["default"]=a}),e("ember-data/-private/system/references/reference",["exports"],function(e){var t=function(e,t){this.store=e,this.internalModel=t};t.prototype={constructor:t},e["default"]=t}),e("ember-data/-private/system/relationship-meta",["exports","ember-inflector","ember-data/-private/system/normalize-model-name"],function(e,t,r){function a(e){var a;return a=e.type||e.key,"hasMany"===e.kind&&(a=(0,t.singularize)((0,r["default"])(a))),a}function i(e){return{key:e.key,kind:e.kind,type:a(e),options:e.options,parentType:e.parentType,isRelationship:!0}}e.typeForRelationshipMeta=a,e.relationshipFromMeta=i}),e("ember-data/-private/system/relationships/belongs-to",["exports","ember","ember-data/-private/debug","ember-data/-private/system/normalize-model-name"],function(e,t,r,a){function i(e,r){var i,n;"object"==typeof e?(i=e,n=void 0):(i=r,n=e),"string"==typeof n&&(n=(0,a["default"])(n)),i=i||{};var o={type:n,isRelationship:!0,options:i,kind:"belongsTo",key:null};return t["default"].computed({get:function(e){return i.hasOwnProperty("serialize"),i.hasOwnProperty("embedded"),this._internalModel._relationships.get(e).getRecord()},set:function(e,t){return void 0===t&&(t=null),t&&t.then?this._internalModel._relationships.get(e).setRecordPromise(t):t?this._internalModel._relationships.get(e).setRecord(t._internalModel):this._internalModel._relationships.get(e).setRecord(t),this._internalModel._relationships.get(e).getRecord()}}).meta(o)}e["default"]=i;var n=t["default"].Mixin.create({notifyBelongsToChanged:function(e){this.notifyPropertyChange(e)}});e.BelongsToMixin=n}),e("ember-data/-private/system/relationships/ext",["exports","ember","ember-data/-private/debug","ember-data/-private/system/relationship-meta","ember-data/-private/system/empty-object"],function(e,t,r,a,i){var n=t["default"].get,o=t["default"].Map,s=t["default"].MapWithDefault,d=t["default"].computed(function(){t["default"].testing===!0&&d._cacheable===!0&&(d._cacheable=!1);var e=new s({defaultValue:function(){return[]}});return this.eachComputedProperty(function(t,r){if(r.isRelationship){r.key=t;var i=e.get((0,a.typeForRelationshipMeta)(r));i.push({name:t,kind:r.kind})}}),e}).readOnly(),l=t["default"].computed(function(){t["default"].testing===!0&&l._cacheable===!0&&(l._cacheable=!1);var e,r=t["default"].A();return this.eachComputedProperty(function(t,i){i.isRelationship&&(i.key=t,e=(0,a.typeForRelationshipMeta)(i),r.contains(e)||r.push(e))}),r}).readOnly(),u=t["default"].computed(function(){t["default"].testing===!0&&u._cacheable===!0&&(u._cacheable=!1);var e=o.create();return this.eachComputedProperty(function(t,r){if(r.isRelationship){r.key=t;var i=(0,a.relationshipFromMeta)(r);i.type=(0,a.typeForRelationshipMeta)(r),e.set(t,i)}}),e}).readOnly(),c=t["default"].Mixin.create({didDefineProperty:function(e,r,a){if(a instanceof t["default"].ComputedProperty){var i=a.meta();i.parentType=e.constructor}}});e.DidDefinePropertyMixin=c;var h=t["default"].Mixin.create({typeForRelationship:function(e,t){var r=n(this,"relationshipsByName").get(e);return r&&t.modelFor(r.type)},inverseMap:t["default"].computed(function(){return new i["default"]}),inverseFor:function(e,t){var r=n(this,"inverseMap");if(r[e])return r[e];var a=this._findInverseFor(e,t);return r[e]=a,a},_findInverseFor:function(e,r){function a(t,r,i){var o=i||[],s=n(r,"relationships");if(!s)return o;var d=s.get(t.modelName);return d=d.filter(function(t){var a=r.metaForProperty(t.name).options;return a.inverse?e===a.inverse:!0}),d&&o.push.apply(o,d),t.superclass&&a(t.superclass,r,o),o}var i=this.typeForRelationship(e,r);if(!i)return null;var o=this.metaForProperty(e),s=o.options;if(null===s.inverse)return null;var d,l,u;if(s.inverse)d=s.inverse,u=t["default"].get(i,"relationshipsByName").get(d),l=u.kind;else{o.type===o.parentType.modelName;var c=a(this,i);if(0===c.length)return null;var h=c.filter(function(t){var r=i.metaForProperty(t.name).options;return e===r.inverse});1===h.length&&(c=h),d=c[0].name,l=c[0].kind}return{type:i,name:d,kind:l}},relationships:d,relationshipNames:t["default"].computed(function(){var e={hasMany:[],belongsTo:[]};return this.eachComputedProperty(function(t,r){r.isRelationship&&e[r.kind].push(t)}),e}),relatedTypes:l,relationshipsByName:u,fields:t["default"].computed(function(){var e=o.create();return this.eachComputedProperty(function(t,r){r.isRelationship?e.set(t,r.kind):r.isAttribute&&e.set(t,"attribute")}),e}).readOnly(),eachRelationship:function(e,t){n(this,"relationshipsByName").forEach(function(r,a){e.call(t,a,r)})},eachRelatedType:function(e,t){for(var r=n(this,"relatedTypes"),a=0;a<r.length;a++){var i=r[a];e.call(t,i)}},determineRelationshipType:function(e,t){var r=e.key,a=e.kind,i=this.inverseFor(r,t),n=void 0,o=void 0;return i?(n=i.name,o=i.kind,"belongsTo"===o?"belongsTo"===a?"oneToOne":"manyToOne":"belongsTo"===a?"oneToMany":"manyToMany"):"belongsTo"===a?"oneToNone":"manyToNone"}});e.RelationshipsClassMethodsMixin=h;var p=t["default"].Mixin.create({eachRelationship:function(e,t){this.constructor.eachRelationship(e,t)},relationshipFor:function(e){return n(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e,this.store)}});e.RelationshipsInstanceMethodsMixin=p}),e("ember-data/-private/system/relationships/has-many",["exports","ember","ember-data/-private/debug","ember-data/-private/system/normalize-model-name","ember-data/-private/system/is-array-like"],function(e,t,r,a,i){function n(e,r){"object"==typeof e&&(r=e,e=void 0),r=r||{},"string"==typeof e&&(e=(0,a["default"])(e));var i={type:e,isRelationship:!0,options:r,kind:"hasMany",key:null};return t["default"].computed({get:function(e){var t=this._internalModel._relationships.get(e);return t.getRecords()},set:function(e,r){var a=this._internalModel._relationships.get(e);return a.clear(),a.addRecords(t["default"].A(r).mapBy("_internalModel")),a.getRecords()}}).meta(i)}e["default"]=n;var o=t["default"].Mixin.create({notifyHasManyAdded:function(e){this.notifyPropertyChange(e)}});e.HasManyMixin=o}),e("ember-data/-private/system/relationships/state/belongs-to",["exports","ember","ember-data/-private/debug","ember-data/-private/system/promise-proxies","ember-data/-private/utils","ember-data/-private/system/relationships/state/relationship"],function(e,t,r,a,i,n){function o(e,t,r,a){this._super$constructor(e,t,r,a),this.record=t,this.key=a.key,this.inverseRecord=null,this.canonicalState=null}e["default"]=o,o.prototype=Object.create(n["default"].prototype),o.prototype.constructor=o,o.prototype._super$constructor=n["default"],o.prototype.setRecord=function(e){e?this.addRecord(e):this.inverseRecord&&this.removeRecord(this.inverseRecord),this.setHasData(!0),this.setHasLoaded(!0)},o.prototype.setCanonicalRecord=function(e){e?this.addCanonicalRecord(e):this.inverseRecord&&this.removeCanonicalRecord(this.inverseRecord),this.setHasData(!0),this.setHasLoaded(!0)},o.prototype._super$addCanonicalRecord=n["default"].prototype.addCanonicalRecord,o.prototype.addCanonicalRecord=function(e){this.canonicalMembers.has(e)||(this.canonicalState&&this.removeCanonicalRecord(this.canonicalState),this.canonicalState=e,this._super$addCanonicalRecord(e))},o.prototype._super$flushCanonical=n["default"].prototype.flushCanonical,o.prototype.flushCanonical=function(){this.inverseRecord&&this.inverseRecord.isNew()&&!this.canonicalState||(this.inverseRecord=this.canonicalState,this.record.notifyBelongsToChanged(this.key),this._super$flushCanonical())},o.prototype._super$addRecord=n["default"].prototype.addRecord,o.prototype.addRecord=function(e){this.members.has(e)||((0,i.assertPolymorphicType)(this.record,this.relationshipMeta,e),this.inverseRecord&&this.removeRecord(this.inverseRecord),this.inverseRecord=e,this._super$addRecord(e),this.record.notifyBelongsToChanged(this.key))},o.prototype.setRecordPromise=function(e){var t=e.get&&e.get("content");this.setRecord(t?t._internalModel:t)},o.prototype._super$removeRecordFromOwn=n["default"].prototype.removeRecordFromOwn,o.prototype.removeRecordFromOwn=function(e){this.members.has(e)&&(this.inverseRecord=null,this._super$removeRecordFromOwn(e),this.record.notifyBelongsToChanged(this.key))},o.prototype._super$removeCanonicalRecordFromOwn=n["default"].prototype.removeCanonicalRecordFromOwn,o.prototype.removeCanonicalRecordFromOwn=function(e){this.canonicalMembers.has(e)&&(this.canonicalState=null,this._super$removeCanonicalRecordFromOwn(e))},o.prototype.findRecord=function(){return this.inverseRecord?this.store._findByInternalModel(this.inverseRecord):t["default"].RSVP.Promise.resolve(null)},o.prototype.fetchLink=function(){var e=this;return this.store.findBelongsTo(this.record,this.link,this.relationshipMeta).then(function(t){return t&&e.addRecord(t),t})},o.prototype.getRecord=function(){var e=this;if(this.isAsync){var t;return t=this.link?this.hasLoaded?this.findRecord():this.findLink().then(function(){return e.findRecord()}):this.findRecord(),a.PromiseObject.create({promise:t,content:this.inverseRecord?this.inverseRecord.getRecord():null})}if(null===this.inverseRecord)return null;var r=this.inverseRecord.getRecord();return r},o.prototype.reload=function(){return this.link?this.fetchLink():this.inverseRecord&&this.inverseRecord.record?this.inverseRecord.record.reload():this.findRecord()}}),e("ember-data/-private/system/relationships/state/create",["exports","ember","ember-data/-private/system/relationships/state/has-many","ember-data/-private/system/relationships/state/belongs-to","ember-data/-private/system/empty-object"],function(e,t,r,a,i){function n(e,t,i){var n,o=e.type.inverseFor(t.key,i);return o&&(n=o.name),"hasMany"===t.kind?new r["default"](i,e,n,t):new a["default"](i,e,n,t)}function o(e){this.record=e,this.initializedRelationships=new i["default"]}e["default"]=o;var s=t["default"].get;o.prototype.has=function(e){return!!this.initializedRelationships[e]},o.prototype.get=function(e){var t=this.initializedRelationships,r=s(this.record.type,"relationshipsByName");return!t[e]&&r.get(e)&&(t[e]=n(this.record,r.get(e),this.record.store)),t[e]}}),e("ember-data/-private/system/relationships/state/has-many",["exports","ember-data/-private/debug","ember-data/-private/system/promise-proxies","ember-data/-private/system/relationships/state/relationship","ember-data/-private/system/ordered-set","ember-data/-private/system/many-array","ember-data/-private/utils"],function(e,t,r,a,i,n,o){function s(e,t,r,a){this._super$constructor(e,t,r,a),this.belongsToType=a.type,this.canonicalState=[],this.manyArray=n["default"].create({canonicalState:this.canonicalState,store:this.store,relationship:this,type:this.store.modelFor(this.belongsToType),record:t}),this.isPolymorphic=a.options.polymorphic,this.manyArray.isPolymorphic=this.isPolymorphic}function d(e){var t=new i["default"];if(e)for(var r=0,a=e.length;a>r;r++)t.add(e[r]);return t}e["default"]=s,s.prototype=Object.create(a["default"].prototype),s.prototype.constructor=s,s.prototype._super$constructor=a["default"],s.prototype.destroy=function(){this.manyArray.destroy()},s.prototype._super$updateMeta=a["default"].prototype.updateMeta,s.prototype.updateMeta=function(e){this._super$updateMeta(e),this.manyArray.set("meta",e)},s.prototype._super$addCanonicalRecord=a["default"].prototype.addCanonicalRecord,s.prototype.addCanonicalRecord=function(e,t){this.canonicalMembers.has(e)||(void 0!==t?this.canonicalState.splice(t,0,e):this.canonicalState.push(e),this._super$addCanonicalRecord(e,t))},s.prototype._super$addRecord=a["default"].prototype.addRecord,s.prototype.addRecord=function(e,t){this.members.has(e)||(this._super$addRecord(e,t),this.manyArray.internalAddRecords([e],t))},s.prototype._super$removeCanonicalRecordFromOwn=a["default"].prototype.removeCanonicalRecordFromOwn,s.prototype.removeCanonicalRecordFromOwn=function(e,t){var r=t;this.canonicalMembers.has(e)&&(void 0===r&&(r=this.canonicalState.indexOf(e)),r>-1&&this.canonicalState.splice(r,1),this._super$removeCanonicalRecordFromOwn(e,t));
3
+ },s.prototype._super$flushCanonical=a["default"].prototype.flushCanonical,s.prototype.flushCanonical=function(){this.manyArray.flushCanonical(),this._super$flushCanonical()},s.prototype._super$removeRecordFromOwn=a["default"].prototype.removeRecordFromOwn,s.prototype.removeRecordFromOwn=function(e,t){this.members.has(e)&&(this._super$removeRecordFromOwn(e,t),void 0!==t?this.manyArray.currentState.removeAt(t):this.manyArray.internalRemoveRecords([e]))},s.prototype.notifyRecordRelationshipAdded=function(e,t){(0,o.assertPolymorphicType)(this.record,this.relationshipMeta,e),this.record.notifyHasManyAdded(this.key,e,t)},s.prototype.reload=function(){var e=this,t=this.manyArray.get("isLoaded");if(this._loadingPromise){if(this._loadingPromise.get("isPending"))return this._loadingPromise;this._loadingPromise.get("isRejected")&&this.manyArray.set("isLoaded",t)}return this.link?this.fetchLink():this.store.scheduleFetchMany(this.manyArray.toArray()).then(function(){return e.manyArray.set("isLoaded",!0),e.manyArray})},s.prototype.computeChanges=function(e){var t,r,a,i=this.canonicalMembers,n=[];for(e=d(e),i.forEach(function(t){e.has(t)||n.push(t)}),this.removeCanonicalRecords(n),e=e.toArray(),t=e.length,a=0;t>a;a++)r=e[a],this.removeCanonicalRecord(r),this.addCanonicalRecord(r,a)},s.prototype.fetchLink=function(){var e=this;return this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(t){return t.hasOwnProperty("meta")&&e.updateMeta(t.meta),e.store._backburner.join(function(){e.updateRecordsFromAdapter(t),e.manyArray.set("isLoaded",!0)}),e.manyArray})},s.prototype.findRecords=function(){for(var e=this,t=this.manyArray.toArray(),r=new Array(t.length),a=0;a<t.length;a++)r[a]=t[a]._internalModel;return this.store.findMany(r).then(function(){return e.manyArray.get("isDestroyed")||e.manyArray.set("isLoaded",!0),e.manyArray})},s.prototype.notifyHasManyChanged=function(){this.record.notifyHasManyAdded(this.key)},s.prototype.getRecords=function(){var e=this;if(this.isAsync){var t;return t=this.link?this.hasLoaded?this.findRecords():this.findLink().then(function(){return e.findRecords()}):this.findRecords(),this._loadingPromise=r.PromiseManyArray.create({content:this.manyArray,promise:t}),this._loadingPromise}return this.manyArray.get("isDestroyed")||this.manyArray.set("isLoaded",!0),this.manyArray}}),e("ember-data/-private/system/relationships/state/relationship",["exports","ember","ember-data/-private/debug","ember-data/-private/system/ordered-set"],function(e,t,r,a){function i(e,t,r,i){var n=i.options.async;this.members=new a["default"],this.canonicalMembers=new a["default"],this.store=e,this.key=i.key,this.inverseKey=r,this.record=t,this.isAsync="undefined"==typeof n?!0:n,this.relationshipMeta=i,this.inverseKeyForImplicit=this.record.constructor.modelName+this.key,this.linkPromise=null,this.meta=null,this.hasData=!1,this.hasLoaded=!1}e["default"]=i,i.prototype={constructor:i,destroy:t["default"].K,updateMeta:function(e){this.meta=e},clear:function(){for(var e,t=this.members.list;t.length>0;)e=t[0],this.removeRecord(e)},removeRecords:function(e){var t=this;e.forEach(function(e){return t.removeRecord(e)})},addRecords:function(e,t){var r=this;e.forEach(function(e){r.addRecord(e,t),void 0!==t&&t++})},addCanonicalRecords:function(e,t){for(var r=0;r<e.length;r++)void 0!==t?this.addCanonicalRecord(e[r],r+t):this.addCanonicalRecord(e[r])},addCanonicalRecord:function(e,t){this.canonicalMembers.has(e)||(this.canonicalMembers.add(e),this.inverseKey?e._relationships.get(this.inverseKey).addCanonicalRecord(this.record):(e._implicitRelationships[this.inverseKeyForImplicit]||(e._implicitRelationships[this.inverseKeyForImplicit]=new i(this.store,e,this.key,{options:{}})),e._implicitRelationships[this.inverseKeyForImplicit].addCanonicalRecord(this.record))),this.flushCanonicalLater(),this.setHasData(!0)},removeCanonicalRecords:function(e,t){for(var r=0;r<e.length;r++)void 0!==t?this.removeCanonicalRecord(e[r],r+t):this.removeCanonicalRecord(e[r])},removeCanonicalRecord:function(e,t){this.canonicalMembers.has(e)&&(this.removeCanonicalRecordFromOwn(e),this.inverseKey?this.removeCanonicalRecordFromInverse(e):e._implicitRelationships[this.inverseKeyForImplicit]&&e._implicitRelationships[this.inverseKeyForImplicit].removeCanonicalRecord(this.record)),this.flushCanonicalLater()},addRecord:function(e,t){this.members.has(e)||(this.members.addWithIndex(e,t),this.notifyRecordRelationshipAdded(e,t),this.inverseKey?e._relationships.get(this.inverseKey).addRecord(this.record):(e._implicitRelationships[this.inverseKeyForImplicit]||(e._implicitRelationships[this.inverseKeyForImplicit]=new i(this.store,e,this.key,{options:{}})),e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)),this.record.updateRecordArraysLater()),this.setHasData(!0)},removeRecord:function(e){this.members.has(e)&&(this.removeRecordFromOwn(e),this.inverseKey?this.removeRecordFromInverse(e):e._implicitRelationships[this.inverseKeyForImplicit]&&e._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record))},removeRecordFromInverse:function(e){var t=e._relationships.get(this.inverseKey);t&&t.removeRecordFromOwn(this.record)},removeRecordFromOwn:function(e){this.members["delete"](e),this.notifyRecordRelationshipRemoved(e),this.record.updateRecordArrays()},removeCanonicalRecordFromInverse:function(e){var t=e._relationships.get(this.inverseKey);t&&t.removeCanonicalRecordFromOwn(this.record)},removeCanonicalRecordFromOwn:function(e){this.canonicalMembers["delete"](e),this.flushCanonicalLater()},flushCanonical:function(){this.willSync=!1;for(var e=[],t=0;t<this.members.list.length;t++)this.members.list[t].isNew()&&e.push(this.members.list[t]);for(this.members=this.canonicalMembers.copy(),t=0;t<e.length;t++)this.members.add(e[t])},flushCanonicalLater:function(){var e=this;this.willSync||(this.willSync=!0,this.store._backburner.join(function(){return e.store._backburner.schedule("syncRelationships",e,e.flushCanonical)}))},updateLink:function(e){e!==this.link&&(this.link=e,this.linkPromise=null,this.setHasLoaded(!1),this.record.notifyPropertyChange(this.key))},findLink:function(){if(this.linkPromise)return this.linkPromise;var e=this.fetchLink();return this.linkPromise=e,e.then(function(e){return e})},updateRecordsFromAdapter:function(e){this.computeChanges(e),this.setHasData(!0),this.setHasLoaded(!0)},notifyRecordRelationshipAdded:t["default"].K,notifyRecordRelationshipRemoved:t["default"].K,setHasData:function(e){this.hasData=e},setHasLoaded:function(e){this.hasLoaded=e}}}),e("ember-data/-private/system/snapshot-record-array",["exports","ember-data/-private/features"],function(e,t){function r(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];this._snapshots=null,this._recordArray=e,this.length=e.get("length"),this.type=e.get("type"),this.meta=t,this.adapterOptions=r.adapterOptions}e["default"]=r,r.prototype.snapshots=function(){if(this._snapshots)return this._snapshots;var e=this._recordArray;return this._snapshots=e.invoke("createSnapshot"),this._snapshots}}),e("ember-data/-private/system/snapshot",["exports","ember","ember-data/-private/system/empty-object","ember-data/-private/features"],function(e,t,r,a){function i(e){var t=this,a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this._attributes=new r["default"],this._belongsToRelationships=new r["default"],this._belongsToIds=new r["default"],this._hasManyRelationships=new r["default"],this._hasManyIds=new r["default"];var i=e.getRecord();this.record=i,i.eachAttribute(function(e){return t._attributes[e]=n(i,e)}),this.id=e.id,this._internalModel=e,this.type=e.type,this.modelName=e.type.modelName,this.adapterOptions=a.adapterOptions,this._changedAttributes=i.changedAttributes()}e["default"]=i;var n=t["default"].get;i.prototype={constructor:i,id:null,record:null,type:null,modelName:null,attr:function(e){if(e in this._attributes)return this._attributes[e];throw new t["default"].Error("Model '"+t["default"].inspect(this.record)+"' has no attribute named '"+e+"' defined.")},attributes:function(){return t["default"].copy(this._attributes)},changedAttributes:function(){for(var e=new r["default"],a=Object.keys(this._changedAttributes),i=0,n=a.length;n>i;i++){var o=a[i];e[o]=t["default"].copy(this._changedAttributes[o])}return e},belongsTo:function(e,r){var a,i,o,s,d=r&&r.id;if(d&&e in this._belongsToIds)return this._belongsToIds[e];if(!d&&e in this._belongsToRelationships)return this._belongsToRelationships[e];if(a=this._internalModel._relationships.get(e),!a||"belongsTo"!==a.relationshipMeta.kind)throw new t["default"].Error("Model '"+t["default"].inspect(this.record)+"' has no belongsTo relationship named '"+e+"' defined.");return o=n(a,"hasData"),i=n(a,"inverseRecord"),o&&(s=i&&!i.isDeleted()?d?n(i,"id"):i.createSnapshot():null),d?this._belongsToIds[e]=s:this._belongsToRelationships[e]=s,s},hasMany:function(e,r){var a,i,o,s,d=r&&r.ids;if(d&&e in this._hasManyIds)return this._hasManyIds[e];if(!d&&e in this._hasManyRelationships)return this._hasManyRelationships[e];if(a=this._internalModel._relationships.get(e),!a||"hasMany"!==a.relationshipMeta.kind)throw new t["default"].Error("Model '"+t["default"].inspect(this.record)+"' has no hasMany relationship named '"+e+"' defined.");return o=n(a,"hasData"),i=n(a,"members"),o&&(s=[],i.forEach(function(e){e.isDeleted()||(d?s.push(e.id):s.push(e.createSnapshot()))})),d?this._hasManyIds[e]=s:this._hasManyRelationships[e]=s,s},eachAttribute:function(e,t){this.record.eachAttribute(e,t)},eachRelationship:function(e,t){this.record.eachRelationship(e,t)},serialize:function(e){return this.record.store.serializerFor(this.modelName).serialize(this,e)}}}),e("ember-data/-private/system/store",["exports","ember","ember-data/model","ember-data/-private/debug","ember-data/-private/system/normalize-link","ember-data/-private/system/normalize-model-name","ember-data/-private/adapters/errors","ember-data/-private/system/promise-proxies","ember-data/-private/system/store/common","ember-data/-private/system/store/serializer-response","ember-data/-private/system/store/serializers","ember-data/-private/system/store/finders","ember-data/-private/utils","ember-data/-private/system/coerce-id","ember-data/-private/system/record-array-manager","ember-data/-private/system/store/container-instance-cache","ember-data/-private/system/model/internal-model","ember-data/-private/system/empty-object","ember-data/-private/features"],function(e,t,r,a,i,n,o,s,d,l,u,c,h,p,f,m,y,v,b){function g(e,t){var r=e.then(function(e){return e.getRecord()});return(0,s.promiseObject)(r,t)}function R(e,t,r,a){return C(a)?void 0:e._internalModelForId(a.type,a.id)}function _(e,t,r,a){if(!C(a)){for(var i=new Array(a.length),n=0;n<a.length;n++)i[n]=R(e,t,r,a[n]);return i}}function A(e){return e.serializerFor("application")}function F(e,t,r,a){var i=a._internalModel,n=a.modelName,s=t.modelFor(n),c=e[r](t,s,a),h=(0,u.serializerForAdapter)(t,e,n),p="DS: Extract and notify about "+r+" completion of "+i;return c=I.resolve(c,p),c=(0,d._guard)(c,(0,d._bind)(d._objectIsAlive,t)),c=(0,d._guard)(c,(0,d._bind)(d._objectIsAlive,i)),c.then(function(e){return t._adapterRun(function(){var n,o;e&&(n=(0,l.normalizeResponseHelper)(h,t,s,e,a.id,r),n.included&&t.push({data:n.included}),o=n.data),t.didSaveRecord(i,{data:o})}),i},function(e){if(e instanceof o.InvalidError){var r=h.extractErrors(t,s,e,a.id);t.recordWasInvalid(i,r)}else t.recordWasError(i,e);throw e},p)}function z(e,t,r){r.relationships&&t.type.eachRelationship(function(a,n){var o=n.kind;if(r.relationships[a]){var s;if(r.relationships[a].links&&r.relationships[a].links.related){var d=(0,i["default"])(r.relationships[a].links.related);d&&d.href&&(s=t._relationships.get(a),s.updateLink(d.href))}r.relationships[a].meta&&(s=t._relationships.get(a),s.updateMeta(r.relationships[a].meta)),M(e,a,n,r.relationships[a]);var l=r.relationships[a].data;void 0!==l&&("belongsTo"===o?(s=t._relationships.get(a),s.setCanonicalRecord(l)):"hasMany"===o&&(s=t._relationships.get(a),s.updateRecordsFromAdapter(l)))}})}function M(e,t,r,a){var i=a.data;if(i){var n=r.kind;"belongsTo"===n?a.data=R(e,t,r,i):"hasMany"===n&&(a.data=_(e,t,r,i))}}var S="`id` has to be non-empty string or number";e.badIdFormatAssertion=S;var T=t["default"]._Backburner||t["default"].Backburner||t["default"].__loader.require("backburner")["default"]||t["default"].__loader.require("backburner").Backburner,k=t["default"].Map,x=Array.isArray||t["default"].isArray;if(!T.prototype.join){var w=function(e){return"string"==typeof e};T.prototype.join=function(){var e,t;if(this.currentInstance){var r=arguments.length;if(1===r?(e=arguments[0],t=null):(t=arguments[0],e=arguments[1]),w(e)&&(e=t[e]),1===r)return e();if(2===r)return e.call(t);for(var a=new Array(r-2),i=0;i<a.length;i++)a[i]=arguments[i+2];return e.apply(t,a)}return this.run.apply(this,arguments)}}var E,P=t["default"].get,D=t["default"].set,O=t["default"].run.once,C=t["default"].isNone,I=t["default"].RSVP.Promise,j=t["default"].copy,N=t["default"].Service;N||(N=t["default"].Object),e.Store=E=N.extend({init:function(){this._super.apply(this,arguments),this._backburner=new T(["normalizeRelationships","syncRelationships","finished"]),this.typeMaps={},this.recordArrayManager=f["default"].create({store:this}),this._pendingSave=[],this._instanceCache=new m["default"]((0,h.getOwner)(this)),this._pendingFetch=k.create()},adapter:"-json-api",serialize:function(e,t){var r=e._internalModel.createSnapshot();return r.serialize(t)},defaultAdapter:t["default"].computed("adapter",function(){var e=P(this,"adapter");return e=this.retrieveManagedInstance("adapter",e)}),createRecord:function(e,t){var r=this.modelFor(e),a=j(t)||new v["default"];C(a.id)&&(a.id=this._generateId(e,a)),a.id=(0,p["default"])(a.id);var i=this.buildInternalModel(r,a.id),n=i.getRecord();return i.loadedData(),n.setProperties(a),i.eachRelationship(function(e,t){i._relationships.get(e).setHasData(!0)}),n},_generateId:function(e,t){var r=this.adapterFor(e);return r&&r.generateIdForRecord?r.generateIdForRecord(this,e,t):null},deleteRecord:function(e){e.deleteRecord()},unloadRecord:function(e){e.unloadRecord()},find:function(e,r,a){return 1===arguments.length,"object"===t["default"].typeOf(r),this.findRecord(e,r)},findRecord:function(e,t,r){var a=this._internalModelForId(e,t);if(r=r||{},!this.hasRecordForId(e,t))return this._findByInternalModel(a,r);var i=this._findRecord(a,r);return g(i,"DS: Store#findRecord "+a.typeKey+" with id: "+P(a,"id"))},_findRecord:function(e,t){if(t.reload)return this.scheduleFetch(e,t);var r=e.createSnapshot(t),a=e.type,i=this.adapterFor(a.modelName);return i.shouldReloadRecord(this,r)?this.scheduleFetch(e,t):(i.shouldBackgroundReloadRecord(this,r)&&this.scheduleFetch(e,t),I.resolve(e))},_findByInternalModel:function(e,t){t=t||{},t.preload&&e._preloadData(t.preload);var r=this._findEmptyInternalModel(e,t);return g(r,"DS: Store#findRecord "+e.typeKey+" with id: "+P(e,"id"))},_findEmptyInternalModel:function(e,t){return e.isEmpty()?this.scheduleFetch(e,t):e.isLoading()?e._loadingPromise:I.resolve(e)},findByIds:function(e,r){for(var a=new Array(r.length),i=0;i<r.length;i++)a[i]=this.findRecord(e,r[i]);return(0,s.promiseArray)(t["default"].RSVP.all(a).then(t["default"].A,null,"DS: Store#findByIds of "+e+" complete"))},fetchRecord:function(e,t){var r=e.type,a=e.id,i=this.adapterFor(r.modelName),n=(0,c._find)(i,this,r,a,e,t);return n},scheduleFetchMany:function(e){for(var r=new Array(e.length),a=new Array(e.length),i=0;i<e.length;i++)r[i]=e[i]._internalModel;for(var i=0;i<r.length;i++)a[i]=this.scheduleFetch(r[i]);return t["default"].RSVP.Promise.all(a)},scheduleFetch:function(e,r){var a=e.type;if(e._loadingPromise)return e._loadingPromise;var i=t["default"].RSVP.defer("Fetching "+a+"with id: "+e.id),n={record:e,resolver:i,options:r},o=i.promise;return e.loadingData(o),this._pendingFetch.get(a)?this._pendingFetch.get(a).push(n):this._pendingFetch.set(a,[n]),t["default"].run.scheduleOnce("afterRender",this,this.flushAllPendingFetches),o},flushAllPendingFetches:function(){this.isDestroyed||this.isDestroying||(this._pendingFetch.forEach(this._flushPendingFetchForType,this),this._pendingFetch=k.create())},_flushPendingFetchForType:function(e,r){function a(e){e.resolver.resolve(d.fetchRecord(e.record,e.options))}function i(r){return r.forEach(function(r){var a=t["default"].A(e).findBy("record",r);if(a){var i=a.resolver;i.resolve(r)}}),r}function n(e){return function(r){r=t["default"].A(r);var a=e.reject(function(e){return r.contains(e)});a.length,s(a)}}function o(e){return function(t){s(e,t)}}function s(r,a){r.forEach(function(r){var i=t["default"].A(e).findBy("record",r);if(i){var n=i.resolver;n.reject(a)}})}var d=this,l=d.adapterFor(r.modelName),u=!!l.findMany&&l.coalesceFindRequests,h=t["default"].A(e).mapBy("record");if(1===e.length)a(e[0]);else if(u){var p=t["default"].A(h).invoke("createSnapshot"),f=l.groupRecordsForFindMany(this,p);f.forEach(function(s){var u=t["default"].A(s).mapBy("_internalModel"),h=t["default"].A(u),p=h.mapBy("id");if(p.length>1)(0,c._findMany)(l,d,r,p,h).then(i).then(n(h)).then(null,o(h));else if(1===p.length){var f=t["default"].A(e).findBy("record",u[0]);a(f)}})}else e.forEach(a)},peekRecord:function(e,t){return this.hasRecordForId(e,t)?this._internalModelForId(e,t).getRecord():null},reloadRecord:function(e){var t=e.type.modelName;this.adapterFor(t),e.id;return this.scheduleFetch(e)},hasRecordForId:function(e,t){var r=this.modelFor(e),a=(0,p["default"])(t),i=this.typeMapFor(r).idToRecord[a];return!!i&&i.isLoaded()},recordForId:function(e,t){return this._internalModelForId(e,t).getRecord()},_internalModelForId:function(e,t){var r=this.modelFor(e),a=(0,p["default"])(t),i=this.typeMapFor(r).idToRecord,n=i[a];return n&&i[a]||(n=this.buildInternalModel(r,a)),n},findMany:function(e){for(var t=new Array(e.length),r=0;r<e.length;r++)t[r]=this._findByInternalModel(e[r]);return I.all(t)},findHasMany:function(e,t,r){var a=this.adapterFor(e.type.modelName);return(0,c._findHasMany)(a,this,e,t,r)},findBelongsTo:function(e,t,r){var a=this.adapterFor(e.type.modelName);return(0,c._findBelongsTo)(a,this,e,t,r)},query:function(e,t){return this._query(e,t)},_query:function(e,t,r){var a=this.modelFor(e);r=r||this.recordArrayManager.createAdapterPopulatedRecordArray(a,t);var i=this.adapterFor(e);return(0,s.promiseArray)((0,c._query)(i,this,a,t,r))},queryRecord:function(e,t){var r=this.modelFor(e),a=this.adapterFor(e);return(0,s.promiseObject)((0,c._queryRecord)(a,this,r,t))},findAll:function(e,t){var r=this.modelFor(e);return this._fetchAll(r,this.peekAll(e),t)},_fetchAll:function(e,t,r){r=r||{};var a=this.adapterFor(e.modelName),i=this.typeMapFor(e).metadata.since;if(D(t,"isUpdating",!0),r.reload)return(0,s.promiseArray)((0,c._findAll)(a,this,e,i,r));var n=t.createSnapshot(r);return a.shouldReloadAll(this,n)?(0,s.promiseArray)((0,c._findAll)(a,this,e,i,r)):(a.shouldBackgroundReloadAll(this,n)&&(0,c._findAll)(a,this,e,i,r),(0,s.promiseArray)(I.resolve(t)))},didUpdateAll:function(e){var t=this.recordArrayManager.liveRecordArrayFor(e);D(t,"isUpdating",!1)},peekAll:function(e){var t=this.modelFor(e),r=this.recordArrayManager.liveRecordArrayFor(t);return this.recordArrayManager.populateLiveRecordArray(r,t),r},unloadAll:function(e){if(0===arguments.length){for(var t=this.typeMaps,r=Object.keys(t),a=new Array(r.length),i=0;i<r.length;i++)a[i]=t[r[i]].type.modelName;a.forEach(this.unloadAll,this)}else{for(var n=this.modelFor(e),o=this.typeMapFor(n),s=o.records.slice(),d=void 0,i=0;i<s.length;i++)d=s[i],d.unloadRecord(),d.destroy();o.metadata=new v["default"]}},filter:function(e,r,a){!t["default"].ENV.ENABLE_DS_FILTER;var i,n,o=arguments.length,d=3===o;return d?i=this.query(e,r):2===arguments.length&&(a=r),e=this.modelFor(e),n=d?this.recordArrayManager.createFilteredRecordArray(e,a,r):this.recordArrayManager.createFilteredRecordArray(e,a),i=i||I.resolve(n),(0,s.promiseArray)(i.then(function(){return n},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,t){return this.hasRecordForId(e,t)},dataWasUpdated:function(e,t){this.recordArrayManager.recordDidChange(t)},scheduleSave:function(e,t,r){var a=e.createSnapshot(r);e.flushChangedAttributes(),e.adapterWillCommit(),this._pendingSave.push({snapshot:a,resolver:t}),O(this,"flushPendingSave")},flushPendingSave:function(){var e=this,t=this._pendingSave.slice();this._pendingSave=[],t.forEach(function(t){var r,a=t.snapshot,i=t.resolver,n=a._internalModel,o=e.adapterFor(n.type.modelName);return"root.deleted.saved"===P(n,"currentState.stateName")?i.resolve():(r=n.isNew()?"createRecord":n.isDeleted()?"deleteRecord":"updateRecord",void i.resolve(F(o,e,r,a)))})},didSaveRecord:function(e,t){var r;t&&(r=t.data),r&&(this._backburner.schedule("normalizeRelationships",this,"_setupRelationships",e,r),this.updateId(e,r)),e.adapterDidCommit(r)},recordWasInvalid:function(e,t){e.adapterDidInvalidate(t)},recordWasError:function(e,t){e.adapterDidError(t)},updateId:function(e,t){var r=(e.id,(0,p["default"])(t.id));this.typeMapFor(e.type).idToRecord[r]=e,e.setId(r)},typeMapFor:function(e){var r=P(this,"typeMaps"),a=t["default"].guidFor(e),i=r[a];return i?i:(i={idToRecord:new v["default"],records:[],metadata:new v["default"],type:e},r[a]=i,i)},_load:function(e){var t=this._internalModelForId(e.type,e.id);return t.setupData(e),this.recordArrayManager.recordDidChange(t),t},_modelForMixin:function(e){var t=(0,n["default"])(e),a=(0,h.getOwner)(this),i=a._lookupFactory("mixin:"+t);i&&a.register("model:"+t,r["default"].extend(i));var o=this.modelFactoryFor(t);return o&&(o.__isMixin=!0,o.__mixin=i),o},modelFor:function(e){var r=this.modelFactoryFor(e);if(r||(r=this._modelForMixin(e)),!r)throw new t["default"].Error("No model was found for '"+e+"'");return r.modelName=r.modelName||(0,n["default"])(e),r},modelFactoryFor:function(e){var t=(0,n["default"])(e),r=(0,h.getOwner)(this);return r._lookupFactory("model:"+t)},push:function(e){var t,r,a=e.included;if(a)for(t=0,r=a.length;r>t;t++)this._pushInternalModel(a[t]);if(x(e.data)){r=e.data.length;var i=new Array(r);for(t=0;r>t;t++)i[t]=this._pushInternalModel(e.data[t]).getRecord();return i}if(null===e.data)return null;var n=this._pushInternalModel(e.data);return n.getRecord()},_hasModelFor:function(e){return(0,h.getOwner)(this)._lookupFactory("model:"+e)},_pushInternalModel:function(e){var r=this,a=e.type;this.modelFor(a);t["default"].ENV.DS_WARN_ON_UNKNOWN_KEYS;var i=this._load(e);return this._backburner.join(function(){r._backburner.schedule("normalizeRelationships",r,"_setupRelationships",i,e)}),i},_setupRelationships:function(e,t){z(this,e,t)},pushPayload:function(e,t){var r,a,i=this;t?(a=t,r=this.serializerFor(e)):(a=e,r=A(this)),this._adapterRun(function(){return r.pushPayload(i,a)})},normalize:function(e,t){var r=this.serializerFor(e),a=this.modelFor(e);return r.normalize(a,t)},buildInternalModel:function(e,t,r){var a=this.typeMapFor(e),i=a.idToRecord,n=new y["default"](e,t,this,null,r);return t&&(i[t]=n),a.records.push(n),n},recordWasLoaded:function(e){this.recordArrayManager.recordWasLoaded(e)},_dematerializeRecord:function(e){var t=e.type,r=this.typeMapFor(t),a=e.id;e.updateRecordArrays(),a&&delete r.idToRecord[a];var i=r.records.indexOf(e);r.records.splice(i,1)},adapterFor:function(e){return this.lookupAdapter(e)},_adapterRun:function(e){return this._backburner.run(e)},serializerFor:function(e){var t=["application",this.adapterFor(e).get("defaultSerializer"),"-default"],r=this.lookupSerializer(e,t);return r},retrieveManagedInstance:function(e,t,r){var a=(0,n["default"])(t),i=this._instanceCache.get(e,a,r);return D(i,"store",this),i},lookupAdapter:function(e){return this.retrieveManagedInstance("adapter",e,this.get("_adapterFallbacks"))},_adapterFallbacks:t["default"].computed("adapter",function(){var e=this.get("adapter");return["application",e,"-json-api"]}),lookupSerializer:function(e,t){return this.retrieveManagedInstance("serializer",e,t)},willDestroy:function(){this._super.apply(this,arguments),this.recordArrayManager.destroy(),this.unloadAll()}}),e.Store=E,e["default"]=E}),e("ember-data/-private/system/store/common",["exports","ember"],function(e,t){function r(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(void 0,t)}}function a(e,t){var r=e["finally"](function(){t()||(r._subscribers.length=0)});return r}function i(e){return!(n(e,"isDestroyed")||n(e,"isDestroying"))}e._bind=r,e._guard=a,e._objectIsAlive=i;var n=t["default"].get}),e("ember-data/-private/system/store/container-instance-cache",["exports","ember","ember-data/-private/system/empty-object"],function(e,t,r){function a(e){this._owner=e,this._cache=new r["default"]}e["default"]=a,a.prototype=new r["default"],t["default"].merge(a.prototype,{get:function(e,t,r){var a=this._cache,i=e+":"+t;if(!(i in a)){var n=this.instanceFor(i)||this._findInstance(e,r);n&&(a[i]=n)}return a[i]},_findInstance:function(e,t){for(var r=0,a=t.length;a>r;r++){var i=t[r],n=e+":"+i,o=this.instanceFor(n);if(o)return o}},instanceFor:function(e){var t=this._cache;if(!t[e]){var r=this._owner.lookup(e);r&&(t[e]=r)}return t[e]},destroy:function(){for(var e=this._cache,t=Object.keys(e),r=0,a=t.length;a>r;r++){var i=t[r],n=e[i];n&&n.destroy()}this._owner=null},constructor:a,toString:function(){return"ContainerInstanceCache"}})}),e("ember-data/-private/system/store/finders",["exports","ember","ember-data/-private/debug","ember-data/-private/system/store/common","ember-data/-private/system/store/serializer-response","ember-data/-private/system/store/serializers"],function(e,t,r,a,i,n){function o(e,t,r,o,s,d){var l=s.createSnapshot(d),u=e.findRecord(t,r,o,l),c=(0,n.serializerForAdapter)(t,e,s.type.modelName),h="DS: Handle Adapter#findRecord of "+r+" with id: "+o;return u=p.resolve(u,h),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,t)),u.then(function(e){return t._adapterRun(function(){var a=(0,i.normalizeResponseHelper)(c,t,r,e,o,"findRecord"),n=t.push(a);return n._internalModel})},function(e){throw s.notFound(),s.isEmpty()&&s.unloadRecord(),e},"DS: Extract payload of '"+r+"'")}function s(e,r,o,s,d){var l=t["default"].A(d).invoke("createSnapshot"),u=e.findMany(r,o,s,l),c=(0,n.serializerForAdapter)(r,e,o.modelName),h="DS: Handle Adapter#findMany of "+o;if(void 0===u)throw new Error("adapter.findMany returned undefined, this was very likely a mistake");return u=p.resolve(u,h),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,r)),u.then(function(e){return r._adapterRun(function(){for(var t=(0,i.normalizeResponseHelper)(c,r,o,e,null,"findMany"),a=r.push(t),n=new Array(a.length),s=0;s<a.length;s++)n[s]=a[s]._internalModel;return n})},null,"DS: Extract payload of "+o)}function d(e,t,r,o,s){var d=r.createSnapshot(),l=t.modelFor(s.type),u=e.findHasMany(t,d,o,s),c=(0,n.serializerForAdapter)(t,e,s.type),h="DS: Handle Adapter#findHasMany of "+r+" : "+s.type;return u=p.resolve(u,h),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,t)),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,r)),u.then(function(e){return t._adapterRun(function(){var r=(0,i.normalizeResponseHelper)(c,t,l,e,null,"findHasMany"),a=t.push(r),n=a.map(function(e){return e._internalModel});return n.meta=r.meta,n})},null,"DS: Extract payload of "+r+" : hasMany "+s.type)}function l(e,t,r,o,s){var d=r.createSnapshot(),l=t.modelFor(s.type),u=e.findBelongsTo(t,d,o,s),c=(0,n.serializerForAdapter)(t,e,s.type),h="DS: Handle Adapter#findBelongsTo of "+r+" : "+s.type;return u=p.resolve(u,h),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,t)),u=(0,a._guard)(u,(0,a._bind)(a._objectIsAlive,r)),u.then(function(e){return t._adapterRun(function(){var r=(0,i.normalizeResponseHelper)(c,t,l,e,null,"findBelongsTo");if(!r.data)return null;var a=t.push(r);return a._internalModel})},null,"DS: Extract payload of "+r+" : "+s.type)}function u(e,t,r,o,s){var d=r.modelName,l=t.peekAll(d),u=l.createSnapshot(s),c=e.findAll(t,r,o,u),h=(0,n.serializerForAdapter)(t,e,d),f="DS: Handle Adapter#findAll of "+r;return c=p.resolve(c,f),c=(0,a._guard)(c,(0,a._bind)(a._objectIsAlive,t)),c.then(function(e){return t._adapterRun(function(){var a=(0,i.normalizeResponseHelper)(h,t,r,e,null,"findAll");t.push(a)}),t.didUpdateAll(r),t.peekAll(d)},null,"DS: Extract payload of findAll "+r)}function c(e,t,r,o,s){var d=r.modelName,l=e.query(t,r,o,s),u=(0,n.serializerForAdapter)(t,e,d),c="DS: Handle Adapter#query of "+r;return l=p.resolve(l,c),l=(0,a._guard)(l,(0,a._bind)(a._objectIsAlive,t)),l.then(function(e){var a,n;return t._adapterRun(function(){n=(0,i.normalizeResponseHelper)(u,t,r,e,null,"query"),a=t.push(n)}),s.loadRecords(a,n),s},null,"DS: Extract payload of query "+r)}function h(e,r,o,s){var d=o.modelName,l=e.queryRecord(r,o,s),u=(0,n.serializerForAdapter)(r,e,d),c="DS: Handle Adapter#queryRecord of "+o;return l=p.resolve(l,c),l=(0,a._guard)(l,(0,a._bind)(a._objectIsAlive,r)),l.then(function(e){var a;return r._adapterRun(function(){var n=(0,i.normalizeResponseHelper)(u,r,o,e,null,"queryRecord");t["default"].assert("`store.queryRecord` expected the adapter to return one record but the response from the adapter was empty.",n.data),a=r.push(n)}),a},null,"DS: Extract payload of queryRecord "+o)}e._find=o,e._findMany=s,e._findHasMany=d,e._findBelongsTo=l,e._findAll=u,e._query=c,e._queryRecord=h;var p=t["default"].RSVP.Promise}),e("ember-data/-private/system/store/serializer-response",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){var r=[];return e&&"object"==typeof e?("data"in e||"errors"in e||"meta"in e?"data"in e&&"errors"in e&&r.push('Top level keys "errors" and "data" cannot both be present in a JSON API document'):r.push('One or more of the following keys must be present: "data", "errors", "meta".'),"data"in e&&(null===e.data||t["default"].isArray(e.data)||"object"==typeof e.data||r.push("data must be null, an object, or an array")),"meta"in e&&"object"!=typeof e.meta&&r.push("meta must be an object"),"errors"in e&&(t["default"].isArray(e.errors)||r.push("errors must be an array")),"links"in e&&"object"!=typeof e.links&&r.push("links must be an object"),"jsonapi"in e&&"object"!=typeof e.jsonapi&&r.push("jsonapi must be an object"),"included"in e&&"object"!=typeof e.included&&r.push("included must be an array")):r.push("Top level of a JSON API document must be an object"),r}function i(e,t,r,a,i,n){var o=e.normalizeResponse(t,r,a,i,n);return o}e.validateDocumentStructure=a,e.normalizeResponseHelper=i}),e("ember-data/-private/system/store/serializers",["exports"],function(e){function t(e,t,r){var a=t.serializer;return void 0===a&&(a=e.serializerFor(r)),(null===a||void 0===a)&&(a={extract:function(e,t,r){return r}}),a}e.serializerForAdapter=t}),e("ember-data/-private/transforms",["exports","ember-data/transform","ember-data/-private/transforms/number","ember-data/-private/transforms/date","ember-data/-private/transforms/string","ember-data/-private/transforms/boolean"],function(e,t,r,a,i,n){e.Transform=t["default"],e.NumberTransform=r["default"],e.DateTransform=a["default"],e.StringTransform=i["default"],e.BooleanTransform=n["default"]}),e("ember-data/-private/transforms/boolean",["exports","ember-data/transform"],function(e,t){e["default"]=t["default"].extend({deserialize:function(e){var t=typeof e;return"boolean"===t?e:"string"===t?null!==e.match(/^true$|^t$|^1$/i):"number"===t?1===e:!1},serialize:function(e){return Boolean(e)}})}),e("ember-data/-private/transforms/date",["exports","ember","ember-data/-private/ext/date","ember-data/transform"],function(e,t,r,a){e["default"]=a["default"].extend({deserialize:function(e){var r=typeof e;return"string"===r?new Date(t["default"].Date.parse(e)):"number"===r?new Date(e):null===e||void 0===e?e:null},serialize:function(e){return e instanceof Date?e.toISOString():null}})}),e("ember-data/-private/transforms/number",["exports","ember","ember-data/transform"],function(e,t,r){function a(e){return e===e&&e!==1/0&&e!==-(1/0)}var i=t["default"].isEmpty;
4
+ e["default"]=r["default"].extend({deserialize:function(e){var t;return i(e)?null:(t=Number(e),a(t)?t:null)},serialize:function(e){var t;return i(e)?null:(t=Number(e),a(t)?t:null)}})}),e("ember-data/-private/transforms/string",["exports","ember","ember-data/transform"],function(e,t,r){var a=t["default"].isNone;e["default"]=r["default"].extend({deserialize:function(e){return a(e)?null:String(e)},serialize:function(e){return a(e)?null:String(e)}})}),e("ember-data/-private/utils",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){return n(e,"attributes").has("type")||n(e,"relationshipsByName").has("type")}function i(e){var r;return t["default"].getOwner&&(r=t["default"].getOwner(e)),!r&&e.container&&(r=e.container),r&&r.lookupFactory&&!r._lookupFactory&&(r._lookupFactory=r.lookupFactory,r.register=function(){var e=r.registry||r._registry||r;return e.register.apply(e,arguments)}),r}var n=t["default"].get,o=function(e,t,r){var a=r.type.modelName,i=e.type.modelName,n=t.key,o=e.store.modelFor(t.type);"You cannot add a record of type '"+a+"' to the '"+i+"."+n+"' relationship (only '"+o.modelName+"' allowed)"};e.assertPolymorphicType=o,e.modelHasAttributeOrRelationshipNamedType=a,e.getOwner=i}),e("ember-data/-private/utils/parse-response-headers",["exports","ember-data/-private/system/empty-object"],function(e,t){function r(e){return Array.isArray(e)?e:Array.from(e)}function a(e){var a=new t["default"];if(!e)return a;var n=e.split(i);return n.forEach(function(e){var t=e.split(":"),i=r(t),n=i[0],o=i.slice(1);n=n.trim(),o=o.join(":").trim(),o&&(a[n]=o)}),a}e["default"]=a;var i="\r\n"}),e("ember-data/adapter",["exports","ember"],function(e,t){var r=t["default"].get;e["default"]=t["default"].Object.extend({defaultSerializer:"-default",findRecord:null,findAll:null,query:null,queryRecord:null,generateIdForRecord:null,serialize:function(e,t){return r(e.record,"store").serializerFor(e.modelName).serialize(e,t)},createRecord:null,updateRecord:null,deleteRecord:null,coalesceFindRequests:!0,findMany:null,groupRecordsForFindMany:function(e,t){return[t]},shouldReloadRecord:function(e,t){return!1},shouldReloadAll:function(e,t){return!t.length},shouldBackgroundReloadRecord:function(e,t){return!0},shouldBackgroundReloadAll:function(e,t){return!0}})}),e("ember-data/adapters/json-api",["exports","ember","ember-data/adapters/rest"],function(e,t,r){e["default"]=r["default"].extend({defaultSerializer:"-json-api",ajaxOptions:function(e,t,r){var a=this._super.apply(this,arguments);a.contentType&&(a.contentType="application/vnd.api+json");var i=a.beforeSend;return a.beforeSend=function(e){e.setRequestHeader("Accept","application/vnd.api+json"),i&&i(e)},a},coalesceFindRequests:!1,findMany:function(e,t,r,a){var i=this.buildURL(t.modelName,r,a,"findMany");return this.ajax(i,"GET",{data:{filter:{id:r.join(",")}}})},pathForType:function(e){var r=t["default"].String.dasherize(e);return t["default"].String.pluralize(r)},updateRecord:function(e,t,r){var a={},i=e.serializerFor(t.modelName);i.serializeIntoHash(a,t,r,{includeId:!0});var n=r.id,o=this.buildURL(t.modelName,n,r,"updateRecord");return this.ajax(o,"PATCH",{data:a})}})}),e("ember-data/adapters/rest",["exports","ember","ember-data/adapter","ember-data/-private/adapters/errors","ember-data/-private/adapters/build-url-mixin","ember-data/-private/features","ember-data/-private/utils/parse-response-headers"],function(e,t,r,a,i,n,o){function s(e,t){return"function"!=typeof String.prototype.endsWith?-1!==e.indexOf(t,e.length-t.length):e.endsWith(t)}var d=t["default"].MapWithDefault,l=t["default"].get;e["default"]=r["default"].extend(i["default"],{defaultSerializer:"-rest",sortQueryParams:function(e){var t=Object.keys(e),r=t.length;if(2>r)return e;for(var a={},i=t.sort(),n=0;r>n;n++)a[i[n]]=e[i[n]];return a},coalesceFindRequests:!1,findRecord:function(e,t,r,a){var i=this.buildURL(t.modelName,r,a,"findRecord"),n=this.buildQuery(a);return this.ajax(i,"GET",{data:n})},findAll:function(e,t,r,a){var i=this.buildURL(t.modelName,null,null,"findAll"),n=this.buildQuery(a);return r&&(n.since=r),this.ajax(i,"GET",{data:n})},query:function(e,t,r){var a=this.buildURL(t.modelName,null,null,"query",r);return this.sortQueryParams&&(r=this.sortQueryParams(r)),this.ajax(a,"GET",{data:r})},queryRecord:function(e,t,r){var a=this.buildURL(t.modelName,null,null,"queryRecord",r);return this.sortQueryParams&&(r=this.sortQueryParams(r)),this.ajax(a,"GET",{data:r})},findMany:function(e,t,r,a){var i=this.buildURL(t.modelName,r,a,"findMany");return this.ajax(i,"GET",{data:{ids:r}})},findHasMany:function(e,t,r,a){var i=t.id,n=t.modelName;return r=this.urlPrefix(r,this.buildURL(n,i,null,"findHasMany")),this.ajax(r,"GET")},findBelongsTo:function(e,t,r,a){var i=t.id,n=t.modelName;return r=this.urlPrefix(r,this.buildURL(n,i,null,"findBelongsTo")),this.ajax(r,"GET")},createRecord:function(e,t,r){var a={},i=e.serializerFor(t.modelName),n=this.buildURL(t.modelName,null,r,"createRecord");return i.serializeIntoHash(a,t,r,{includeId:!0}),this.ajax(n,"POST",{data:a})},updateRecord:function(e,t,r){var a={},i=e.serializerFor(t.modelName);i.serializeIntoHash(a,t,r);var n=r.id,o=this.buildURL(t.modelName,n,r,"updateRecord");return this.ajax(o,"PUT",{data:a})},deleteRecord:function(e,t,r){var a=r.id;return this.ajax(this.buildURL(t.modelName,a,r,"deleteRecord"),"DELETE")},_stripIDFromURL:function(e,t){var r=this.buildURL(t.modelName,t.id,t),a=r.split("/"),i=a[a.length-1],n=t.id;return i===n?a[a.length-1]="":s(i,"?id="+n)&&(a[a.length-1]=i.substring(0,i.length-n.length-1)),a.join("/")},maxURLLength:2048,groupRecordsForFindMany:function(e,t){function r(t,r,a){var n=i._stripIDFromURL(e,t[0]),o=0,s=[[]];return t.forEach(function(e){var t=encodeURIComponent(e.id).length+a;n.length+o+t>=r&&(o=0,s.push([])),o+=t;var i=s.length-1;s[i].push(e)}),s}var a=d.create({defaultValue:function(){return[]}}),i=this,n=this.maxURLLength;t.forEach(function(t){var r=i._stripIDFromURL(e,t);a.get(r).push(t)});var o=[];return a.forEach(function(e,t){var a="&ids%5B%5D=".length,i=r(e,n,a);i.forEach(function(e){return o.push(e)})}),o},handleResponse:function(e,t,r,i){if(this.isSuccess(e,t,r))return r;if(this.isInvalid(e,t,r))return new a.InvalidError(r.errors);var n=this.normalizeErrorResponse(e,t,r),o=this.generatedDetailedMessage(e,t,r,i);return new a.AdapterError(n,o)},isSuccess:function(e,t,r){return e>=200&&300>e||304===e},isInvalid:function(e,t,r){return 422===e},ajax:function(e,r,i){var n=this,s={url:e,method:r};return new t["default"].RSVP.Promise(function(d,l){var u=n.ajaxOptions(e,r,i);u.success=function(e,r,a){var i=n.handleResponse(a.status,(0,o["default"])(a.getAllResponseHeaders()),e,s);i&&i.isAdapterError?t["default"].run.join(null,l,i):t["default"].run.join(null,d,i)},u.error=function(e,r,i){var d=void 0;d=i instanceof Error?i:"timeout"===r?new a.TimeoutError:"abort"===r?new a.AbortError:n.handleResponse(e.status,(0,o["default"])(e.getAllResponseHeaders()),n.parseErrorResponse(e.responseText)||i,s),t["default"].run.join(null,l,d)},n._ajaxRequest(u)},"DS: RESTAdapter#ajax "+r+" to "+e)},_ajaxRequest:function(e){t["default"].$.ajax(e)},ajaxOptions:function(e,t,r){var a=r||{};a.url=e,a.type=t,a.dataType="json",a.context=this,a.data&&"GET"!==t&&(a.contentType="application/json; charset=utf-8",a.data=JSON.stringify(a.data));var i=l(this,"headers");return void 0!==i&&(a.beforeSend=function(e){Object.keys(i).forEach(function(t){return e.setRequestHeader(t,i[t])})}),a},parseErrorResponse:function(e){var r=e;try{r=t["default"].$.parseJSON(e)}catch(a){}return r},normalizeErrorResponse:function(e,t,r){return r&&"object"==typeof r&&r.errors?r.errors:[{status:""+e,title:"The backend responded with an error",detail:""+r}]},generatedDetailedMessage:function(e,t,r,a){var i,n=t["Content-Type"]||"Empty Content-Type";i="text/html"===n&&r.length>250?"[Omitted Lengthy HTML]":r;var o=a.method+" "+a.url,s="Payload ("+n+")";return["Ember Data Request "+o+" returned a "+e,s,i].join("\n")},buildQuery:function(e){var t=(e.include,{});return t}})}),e("ember-data/attr",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e,t,r){if("function"==typeof t.defaultValue)return t.defaultValue.apply(null,arguments);var a=t.defaultValue;return a}function i(e,t){return t in e._attributes||t in e._inFlightAttributes||t in e._data}function n(e,t){return t in e._attributes?e._attributes[t]:t in e._inFlightAttributes?e._inFlightAttributes[t]:e._data[t]}function o(e,r){"object"==typeof e?(r=e,e=void 0):r=r||{};var o={type:e,isAttribute:!0,options:r};return t["default"].computed({get:function(e){var t=this._internalModel;return i(t,e)?n(t,e):a(this,r,e)},set:function(e,t){var r=this._internalModel,a=n(r,e);return t!==a&&(r._attributes[e]=t,this._internalModel.send("didSetProperty",{name:e,oldValue:a,originalValue:r._data[e],value:t})),t}}).meta(o)}e["default"]=o}),e("ember-data",["exports","ember","ember-data/-private/debug","ember-data/-private/core","ember-data/-private/system/normalize-model-name","ember-data/-private/system/model/internal-model","ember-data/-private/system/promise-proxies","ember-data/-private/system/store","ember-data/-private/system/model","ember-data/model","ember-data/-private/system/snapshot","ember-data/adapter","ember-data/serializer","ember-data/-private/system/debug","ember-data/-private/adapters/errors","ember-data/-private/system/record-arrays","ember-data/-private/system/many-array","ember-data/-private/system/record-array-manager","ember-data/-private/adapters","ember-data/-private/adapters/build-url-mixin","ember-data/-private/serializers","ember-inflector","ember-data/serializers/embedded-records-mixin","ember-data/-private/transforms","ember-data/relationships","ember-data/setup-container","ember-data/-private/instance-initializers/initialize-store-service","ember-data/-private/system/container-proxy","ember-data/-private/system/relationships/state/relationship"],function(e,t,r,a,i,n,o,s,d,l,u,c,h,p,f,m,y,v,b,g,R,_,A,F,z,M,S,T,k){if(t["default"].VERSION.match(/^1\.([0-9]|1[0-2])\./))throw new t["default"].Error("Ember Data requires at least Ember 1.13.0, but you have "+t["default"].VERSION+". Please upgrade your version of Ember, then upgrade Ember Data.");t["default"].VERSION.match(/^1\.13\./),a["default"].Store=s.Store,a["default"].PromiseArray=o.PromiseArray,a["default"].PromiseObject=o.PromiseObject,a["default"].PromiseManyArray=o.PromiseManyArray,a["default"].Model=l["default"],a["default"].RootState=d.RootState,a["default"].attr=d.attr,a["default"].Errors=d.Errors,a["default"].InternalModel=n["default"],a["default"].Snapshot=u["default"],a["default"].Adapter=c["default"],a["default"].AdapterError=f.AdapterError,a["default"].InvalidError=f.InvalidError,a["default"].TimeoutError=f.TimeoutError,a["default"].AbortError=f.AbortError,a["default"].errorsHashToArray=f.errorsHashToArray,a["default"].errorsArrayToHash=f.errorsArrayToHash,a["default"].Serializer=h["default"],a["default"].DebugAdapter=p["default"],a["default"].RecordArray=m.RecordArray,a["default"].FilteredRecordArray=m.FilteredRecordArray,a["default"].AdapterPopulatedRecordArray=m.AdapterPopulatedRecordArray,a["default"].ManyArray=y["default"],a["default"].RecordArrayManager=v["default"],a["default"].RESTAdapter=b.RESTAdapter,a["default"].BuildURLMixin=g["default"],a["default"].RESTSerializer=R.RESTSerializer,a["default"].JSONSerializer=R.JSONSerializer,a["default"].JSONAPIAdapter=b.JSONAPIAdapter,a["default"].JSONAPISerializer=R.JSONAPISerializer,a["default"].Transform=F.Transform,a["default"].DateTransform=F.DateTransform,a["default"].StringTransform=F.StringTransform,a["default"].NumberTransform=F.NumberTransform,a["default"].BooleanTransform=F.BooleanTransform,a["default"].EmbeddedRecordsMixin=A["default"],a["default"].belongsTo=z.belongsTo,a["default"].hasMany=z.hasMany,a["default"].Relationship=k["default"],a["default"].ContainerProxy=T["default"],a["default"]._setupContainer=M["default"],a["default"]._initializeStoreService=S["default"],Object.defineProperty(a["default"],"normalizeModelName",{enumerable:!0,writable:!1,configurable:!1,value:i["default"]}),t["default"].lookup.DS=a["default"],e["default"]=a["default"]}),e("ember-data/model",["exports","ember-data/-private/system/model"],function(e,t){e["default"]=t["default"]}),e("ember-data/relationships",["exports","ember-data/-private/system/relationships/belongs-to","ember-data/-private/system/relationships/has-many"],function(e,t,r){e.belongsTo=t["default"],e.hasMany=r["default"]}),e("ember-data/serializer",["exports","ember"],function(e,t){e["default"]=t["default"].Object.extend({normalizeResponse:null,serialize:null,normalize:function(e,t){return t}})}),e("ember-data/serializers/embedded-records-mixin",["exports","ember","ember-data/-private/debug"],function(e,t,r){function a(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var i=t["default"].get,n=t["default"].set,o=t["default"].String.camelize;e["default"]=t["default"].Mixin.create({normalize:function(e,t,r){var a=this._super(e,t,r);return this._extractEmbeddedRecords(this,this.store,e,a)},keyForRelationship:function(e,t,r){return"serialize"===r&&this.hasSerializeRecordsOption(e)||"deserialize"===r&&this.hasDeserializeRecordsOption(e)?this.keyForAttribute(e,r):this._super(e,t,r)||e},serializeBelongsTo:function(e,t,r){var a=r.key;if(this.noSerializeOptionSpecified(a))return void this._super(e,t,r);var i,n=this.hasSerializeIdsOption(a),o=this.hasSerializeRecordsOption(a),s=e.belongsTo(a);n?(i=this.keyForRelationship(a,r.kind,"serialize"),s?(t[i]=s.id,r.options.polymorphic&&this.serializePolymorphicType(e,t,r)):t[i]=null):o&&this._serializeEmbeddedBelongsTo(e,t,r)},_serializeEmbeddedBelongsTo:function(e,t,r){var a=e.belongsTo(r.key),i=this._getMappedKey(r.key,e.type);i===r.key&&this.keyForRelationship&&(i=this.keyForRelationship(r.key,r.kind,"serialize")),a?(t[i]=a.record.serialize({includeId:!0}),this.removeEmbeddedForeignKey(e,a,r,t[i]),r.options.polymorphic&&this.serializePolymorphicType(e,t,r)):t[i]=null},serializeHasMany:function(e,t,r){var a=r.key;if(this.noSerializeOptionSpecified(a))return void this._super(e,t,r);var i=this.hasSerializeIdsOption(a),n=this.hasSerializeRecordsOption(a);if(i){var o=this.keyForRelationship(a,r.kind,"serialize");t[o]=e.hasMany(a,{ids:!0})}else n&&this._serializeEmbeddedHasMany(e,t,r)},_serializeEmbeddedHasMany:function(e,t,r){var a=this._getMappedKey(r.key,e.type);a===r.key&&this.keyForRelationship&&(a=this.keyForRelationship(r.key,r.kind,"serialize")),t[a]=this._generateSerializedHasMany(e,r)},_generateSerializedHasMany:function(e,r){for(var a=e.hasMany(r.key),i=t["default"].A(a),n=new Array(i.length),o=0;o<i.length;o++){var s=i[o],d=s.record.serialize({includeId:!0});this.removeEmbeddedForeignKey(e,s,r,d),n[o]=d}return n},removeEmbeddedForeignKey:function(e,t,r,a){if("hasMany"!==r.kind&&"belongsTo"===r.kind){var i=e.type.inverseFor(r.key,this.store);if(i){var n=i.name,o=this.store.serializerFor(t.modelName),s=o.keyForRelationship(n,i.kind,"deserialize");s&&delete a[s]}}},hasEmbeddedAlwaysOption:function(e){var t=this.attrsOption(e);return t&&"always"===t.embedded},hasSerializeRecordsOption:function(e){var t=this.hasEmbeddedAlwaysOption(e),r=this.attrsOption(e);return t||r&&"records"===r.serialize},hasSerializeIdsOption:function(e){var t=this.attrsOption(e);return t&&("ids"===t.serialize||"id"===t.serialize)},noSerializeOptionSpecified:function(e){var t=this.attrsOption(e);return!(t&&(t.serialize||t.embedded))},hasDeserializeRecordsOption:function(e){var t=this.hasEmbeddedAlwaysOption(e),r=this.attrsOption(e);return t||r&&"records"===r.deserialize},attrsOption:function(e){var t=this.get("attrs");return t&&(t[o(e)]||t[e])},_extractEmbeddedRecords:function(e,t,r,a){var i=this;return r.eachRelationship(function(r,n){e.hasDeserializeRecordsOption(r)&&("hasMany"===n.kind&&i._extractEmbeddedHasMany(t,r,a,n),"belongsTo"===n.kind&&i._extractEmbeddedBelongsTo(t,r,a,n))}),a},_extractEmbeddedHasMany:function(e,t,r,o){var s=i(r,"data.relationships."+t+".data");if(s){for(var d=new Array(s.length),l=0;l<s.length;l++){var u=s[l],c=this._normalizeEmbeddedRelationship(e,o,u),h=c.data,p=c.included;if(r.included=r.included||[],r.included.push(h),p){var f;(f=r.included).push.apply(f,a(p))}d[l]={id:h.id,type:h.type}}var m={data:d};n(r,"data.relationships."+t,m)}},_extractEmbeddedBelongsTo:function(e,t,r,o){var s=i(r,"data.relationships."+t+".data");if(s){var d=this._normalizeEmbeddedRelationship(e,o,s),l=d.data,u=d.included;if(r.included=r.included||[],r.included.push(l),u){var c;(c=r.included).push.apply(c,a(u))}var h={id:l.id,type:l.type},p={data:h};n(r,"data.relationships."+t,p)}},_normalizeEmbeddedRelationship:function(e,t,r){var a=t.type;t.options.polymorphic&&(a=r.type);var i=e.modelFor(a),n=e.serializerFor(a);return n.normalize(i,r,null)}})}),e("ember-data/serializers/json-api",["exports","ember","ember-data/-private/debug","ember-data/serializers/json","ember-data/-private/system/normalize-model-name","ember-inflector"],function(e,t,r,a,i,n){var o=t["default"].String.dasherize,s=a["default"].extend({_normalizeDocumentHelper:function(e){if("object"===t["default"].typeOf(e.data))e.data=this._normalizeResourceHelper(e.data);else if(Array.isArray(e.data)){for(var r=new Array(e.data.length),a=0;a<e.data.length;a++){var i=e.data[a];r[a]=this._normalizeResourceHelper(i)}e.data=r}if(Array.isArray(e.included)){for(var r=new Array(e.included.length),a=0;a<e.included.length;a++){var n=e.included[a];r[a]=this._normalizeResourceHelper(n)}e.included=r}return e},_normalizeRelationshipDataHelper:function(e){var t=this.modelNameFromPayloadKey(e.type);return e.type=t,e},_normalizeResourceHelper:function(e){var t=this.modelNameFromPayloadKey(e.type);if(!this.store._hasModelFor(t))return null;var r=this.store.modelFor(t),a=this.store.serializerFor(t),i=a.normalize(r,e),n=i.data;return n},pushPayload:function(e,t){var r=this._normalizeDocumentHelper(t);e.push(r)},_normalizeResponse:function(e,t,r,a,i,n){var o=this._normalizeDocumentHelper(r);return o},extractAttributes:function(e,t){var r=this,a={};return t.attributes&&e.eachAttribute(function(e){var i=r.keyForAttribute(e,"deserialize");t.attributes.hasOwnProperty(i)&&(a[e]=t.attributes[i])}),a},extractRelationship:function(e){if("object"===t["default"].typeOf(e.data)&&(e.data=this._normalizeRelationshipDataHelper(e.data)),Array.isArray(e.data)){for(var r=new Array(e.data.length),a=0;a<e.data.length;a++){var i=e.data[a];r[a]=this._normalizeRelationshipDataHelper(i)}e.data=r}return e},extractRelationships:function(e,t){var r=this,a={};return t.relationships&&e.eachRelationship(function(e,i){var n=r.keyForRelationship(e,i.kind,"deserialize");if(t.relationships.hasOwnProperty(n)){var o=t.relationships[n];a[e]=r.extractRelationship(o)}}),a},_extractType:function(e,t){return this.modelNameFromPayloadKey(t.type)},modelNameFromPayloadKey:function(e){return(0,n.singularize)((0,i["default"])(e))},payloadKeyFromModelName:function(e){return(0,n.pluralize)(e)},normalize:function(e,t){t.attributes&&this.normalizeUsingDeclaredMapping(e,t.attributes),t.relationships&&this.normalizeUsingDeclaredMapping(e,t.relationships);var r={id:this.extractId(e,t),type:this._extractType(e,t),attributes:this.extractAttributes(e,t),relationships:this.extractRelationships(e,t)};return this.applyTransforms(e,r.attributes),{data:r}},keyForAttribute:function(e,t){return o(e)},keyForRelationship:function(e,t,r){return o(e)},serialize:function(e,t){var r=this._super.apply(this,arguments);return r.type=this.payloadKeyFromModelName(e.modelName),{data:r}},serializeAttribute:function(e,t,r,a){var i=a.type;if(this._canSerialize(r)){t.attributes=t.attributes||{};var n=e.attr(r);if(i){var o=this.transformFor(i);n=o.serialize(n)}var s=this._getMappedKey(r,e.type);s===r&&(s=this.keyForAttribute(r,"serialize")),t.attributes[s]=n}},serializeBelongsTo:function(e,t,r){var a=r.key;if(this._canSerialize(a)){var i=e.belongsTo(a);if(void 0!==i){t.relationships=t.relationships||{};var n=this._getMappedKey(a,e.type);n===a&&(n=this.keyForRelationship(a,"belongsTo","serialize"));var o=null;i&&(o={type:this.payloadKeyFromModelName(i.modelName),id:i.id}),t.relationships[n]={data:o}}}},serializeHasMany:function(e,t,r){var a=r.key;if(this._shouldSerializeHasMany(e,a,r)){var i=e.hasMany(a);if(void 0!==i){t.relationships=t.relationships||{};var n=this._getMappedKey(a,e.type);n===a&&this.keyForRelationship&&(n=this.keyForRelationship(a,"hasMany","serialize"));for(var o=new Array(i.length),s=0;s<i.length;s++){var d=i[s];o[s]={type:this.payloadKeyFromModelName(d.modelName),id:d.id}}t.relationships[n]={data:o}}}}});e["default"]=s}),e("ember-data/serializers/json",["exports","ember","ember-data/-private/debug","ember-data/serializer","ember-data/-private/system/coerce-id","ember-data/-private/system/normalize-model-name","ember-data/-private/utils","ember-data/-private/adapters/errors"],function(e,t,r,a,i,n,o,s){function d(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var l=t["default"].get,u=t["default"].isNone,c=t["default"].merge;e["default"]=a["default"].extend({primaryKey:"id",mergedProperties:["attrs"],applyTransforms:function(e,t){var r=this;return e.eachTransformedAttribute(function(e,a){if(t.hasOwnProperty(e)){var i=r.transformFor(a);t[e]=i.deserialize(t[e])}}),t},normalizeResponse:function(e,t,r,a,i){switch(i){case"findRecord":return this.normalizeFindRecordResponse.apply(this,arguments);case"queryRecord":return this.normalizeQueryRecordResponse.apply(this,arguments);case"findAll":return this.normalizeFindAllResponse.apply(this,arguments);case"findBelongsTo":return this.normalizeFindBelongsToResponse.apply(this,arguments);case"findHasMany":return this.normalizeFindHasManyResponse.apply(this,arguments);case"findMany":return this.normalizeFindManyResponse.apply(this,arguments);case"query":return this.normalizeQueryResponse.apply(this,arguments);case"createRecord":return this.normalizeCreateRecordResponse.apply(this,arguments);case"deleteRecord":return this.normalizeDeleteRecordResponse.apply(this,arguments);case"updateRecord":return this.normalizeUpdateRecordResponse.apply(this,arguments)}},normalizeFindRecordResponse:function(e,t,r,a,i){return this.normalizeSingleResponse.apply(this,arguments)},normalizeQueryRecordResponse:function(e,t,r,a,i){return this.normalizeSingleResponse.apply(this,arguments)},normalizeFindAllResponse:function(e,t,r,a,i){return this.normalizeArrayResponse.apply(this,arguments)},normalizeFindBelongsToResponse:function(e,t,r,a,i){return this.normalizeSingleResponse.apply(this,arguments)},normalizeFindHasManyResponse:function(e,t,r,a,i){return this.normalizeArrayResponse.apply(this,arguments)},normalizeFindManyResponse:function(e,t,r,a,i){return this.normalizeArrayResponse.apply(this,arguments)},normalizeQueryResponse:function(e,t,r,a,i){return this.normalizeArrayResponse.apply(this,arguments)},normalizeCreateRecordResponse:function(e,t,r,a,i){return this.normalizeSaveResponse.apply(this,arguments)},normalizeDeleteRecordResponse:function(e,t,r,a,i){return this.normalizeSaveResponse.apply(this,arguments)},normalizeUpdateRecordResponse:function(e,t,r,a,i){return this.normalizeSaveResponse.apply(this,arguments)},normalizeSaveResponse:function(e,t,r,a,i){return this.normalizeSingleResponse.apply(this,arguments)},normalizeSingleResponse:function(e,t,r,a,i){return this._normalizeResponse(e,t,r,a,i,!0)},normalizeArrayResponse:function(e,t,r,a,i){return this._normalizeResponse(e,t,r,a,i,!1)},_normalizeResponse:function(e,t,r,a,i,n){var o={data:null,included:[]},s=this.extractMeta(e,t,r);if(s&&(o.meta=s),n){var l=this.normalize(t,r),u=l.data,c=l.included;o.data=u,c&&(o.included=c)}else{for(var h=new Array(r.length),p=0,f=r.length;f>p;p++){var m=r[p],y=this.normalize(t,m),u=y.data,c=y.included;if(c){var v;(v=o.included).push.apply(v,d(c))}h[p]=u}o.data=h}return o},normalize:function(e,t){var r=null;return t&&(this.normalizeUsingDeclaredMapping(e,t),r={id:this.extractId(e,t),type:e.modelName,attributes:this.extractAttributes(e,t),relationships:this.extractRelationships(e,t)},this.applyTransforms(e,r.attributes)),{data:r}},extractId:function(e,t){var r=l(this,"primaryKey"),a=t[r];return(0,i["default"])(a)},extractAttributes:function(e,t){var r,a=this,i={};return e.eachAttribute(function(e){r=a.keyForAttribute(e,"deserialize"),t.hasOwnProperty(r)&&(i[e]=t[r])}),i},extractRelationship:function(e,r){if(t["default"].isNone(r))return null;if("object"===t["default"].typeOf(r)){r.id&&(r.id=(0,i["default"])(r.id));var a=this.store.modelFor(e);return r.type&&!(0,o.modelHasAttributeOrRelationshipNamedType)(a)&&(r.type=this.modelNameFromPayloadKey(r.type)),r}return{id:(0,i["default"])(r),type:e}},extractPolymorphicRelationship:function(e,t,r){return this.extractRelationship(e,t)},extractRelationships:function(e,r){var a=this,i={};return e.eachRelationship(function(e,n){var o=null,s=a.keyForRelationship(e,n.kind,"deserialize");if(r.hasOwnProperty(s)){var d=null,l=r[s];if("belongsTo"===n.kind)d=n.options.polymorphic?a.extractPolymorphicRelationship(n.type,l,{key:e,resourceHash:r,relationshipMeta:n}):a.extractRelationship(n.type,l);else if("hasMany"===n.kind&&!t["default"].isNone(l)){d=new Array(l.length);for(var u=0,c=l.length;c>u;u++){var h=l[u];d[u]=a.extractRelationship(n.type,h)}}o={data:d}}var p=a.keyForLink(e,n.kind);if(r.links&&r.links.hasOwnProperty(p)){var f=r.links[p];o=o||{},o.links={related:f}}o&&(i[e]=o)}),i},modelNameFromPayloadKey:function(e){return(0,n["default"])(e)},normalizeAttributes:function(e,t){var r,a=this;this.keyForAttribute&&e.eachAttribute(function(e){r=a.keyForAttribute(e,"deserialize"),e!==r&&t.hasOwnProperty(r)&&(t[e]=t[r],delete t[r])})},normalizeRelationships:function(e,t){var r,a=this;this.keyForRelationship&&e.eachRelationship(function(e,i){r=a.keyForRelationship(e,i.kind,"deserialize"),e!==r&&t.hasOwnProperty(r)&&(t[e]=t[r],delete t[r])})},normalizeUsingDeclaredMapping:function(e,t){var r,a,i,n=l(this,"attrs");if(n)for(i in n)r=a=this._getMappedKey(i,e),t.hasOwnProperty(a)&&(l(e,"attributes").has(i)&&(r=this.keyForAttribute(i)),l(e,"relationshipsByName").has(i)&&(r=this.keyForRelationship(i)),a!==r&&(t[r]=t[a],delete t[a]))},_getMappedKey:function(e,t){var r,a=l(this,"attrs");return a&&a[e]&&(r=a[e],r.key&&(r=r.key),"string"==typeof r&&(e=r)),e},_canSerialize:function(e){var t=l(this,"attrs");return!t||!t[e]||t[e].serialize!==!1},_mustSerialize:function(e){var t=l(this,"attrs");return t&&t[e]&&t[e].serialize===!0},_shouldSerializeHasMany:function(e,t,r){var a=e.type.determineRelationshipType(r,this.store);return this._mustSerialize(t)?!0:this._canSerialize(t)&&("manyToNone"===a||"manyToMany"===a)},serialize:function(e,t){var r=this,a={};if(t&&t.includeId){var i=e.id;i&&(a[l(this,"primaryKey")]=i)}return e.eachAttribute(function(t,i){r.serializeAttribute(e,a,t,i)}),e.eachRelationship(function(t,i){"belongsTo"===i.kind?r.serializeBelongsTo(e,a,i):"hasMany"===i.kind&&r.serializeHasMany(e,a,i)}),a},serializeIntoHash:function(e,t,r,a){c(e,this.serialize(r,a))},serializeAttribute:function(e,t,r,a){var i=a.type;if(this._canSerialize(r)){var n=e.attr(r);if(i){var o=this.transformFor(i);n=o.serialize(n)}var s=this._getMappedKey(r,e.type);s===r&&this.keyForAttribute&&(s=this.keyForAttribute(r,"serialize")),t[s]=n}},serializeBelongsTo:function(e,t,r){var a=r.key;if(this._canSerialize(a)){var i=e.belongsTo(a,{id:!0}),n=this._getMappedKey(a,e.type);n===a&&this.keyForRelationship&&(n=this.keyForRelationship(a,"belongsTo","serialize")),u(i)?t[n]=null:t[n]=i,r.options.polymorphic&&this.serializePolymorphicType(e,t,r)}},serializeHasMany:function(e,t,r){var a=r.key;if(this._shouldSerializeHasMany(e,a,r)){var i=e.hasMany(a,{ids:!0});if(void 0!==i){var n=this._getMappedKey(a,e.type);n===a&&this.keyForRelationship&&(n=this.keyForRelationship(a,"hasMany","serialize")),t[n]=i}}},serializePolymorphicType:t["default"].K,extractMeta:function(e,t,r){if(r&&r.hasOwnProperty("meta")){var a=r.meta;return delete r.meta,a}},extractErrors:function(e,t,r,a){var i=this;return r&&"object"==typeof r&&r.errors&&(r=(0,s.errorsArrayToHash)(r.errors),this.normalizeUsingDeclaredMapping(t,r),t.eachAttribute(function(e){var t=i.keyForAttribute(e,"deserialize");t!==e&&r.hasOwnProperty(t)&&(r[e]=r[t],delete r[t])}),t.eachRelationship(function(e){var t=i.keyForRelationship(e,"deserialize");t!==e&&r.hasOwnProperty(t)&&(r[e]=r[t],delete r[t])})),r},keyForAttribute:function(e,t){return e},keyForRelationship:function(e,t,r){return e},keyForLink:function(e,t){return e},transformFor:function(e,t){var r=(0,o.getOwner)(this).lookup("transform:"+e);return r}})}),e("ember-data/serializers/rest",["exports","ember","ember-data/-private/debug","ember-data/serializers/json","ember-data/-private/system/normalize-model-name","ember-inflector","ember-data/-private/system/coerce-id","ember-data/-private/utils"],function(e,t,r,a,i,n,o,s){function d(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var l=t["default"].String.camelize,u=a["default"].extend({keyForPolymorphicType:function(e,t,r){var a=this.keyForRelationship(e);return a+"Type"},normalize:function(e,t,r){return this.normalizeHash&&this.normalizeHash[r]&&this.normalizeHash[r](t),this._super(e,t,r)},_normalizeArray:function(e,t,r,a){var i=this,n={data:[],included:[]},o=e.modelFor(t),s=e.serializerFor(t);return r.forEach(function(t){var r=i._normalizePolymorphicRecord(e,t,a,o,s),l=r.data,u=r.included;if(n.data.push(l),u){var c;(c=n.included).push.apply(c,d(u))}}),n},_normalizePolymorphicRecord:function(e,t,r,a,i){var n=void 0,o=void 0,d=(0,s.modelHasAttributeOrRelationshipNamedType)(a);return!d&&t.type&&e._hasModelFor(this.modelNameFromPayloadKey(t.type))?(n=e.serializerFor(t.type),o=e.modelFor(t.type)):(n=i,o=a),n.normalize(o,t,r)},_normalizeResponse:function(e,r,a,i,n,s){var l={data:null,included:[]},u=this.extractMeta(e,r,a);u&&(l.meta=u);for(var c=Object.keys(a),h=0,p=c.length;p>h;h++){var f=c[h],m=f,y=!1;"_"===f.charAt(0)&&(y=!0,m=f.substr(1));var v=this.modelNameFromPayloadKey(m);if(e.modelFactoryFor(v)){var b=!y&&this.isPrimaryType(e,v,r),g=a[f];if(null!==g)if(b&&"array"!==t["default"].typeOf(g)){var R=this._normalizePolymorphicRecord(e,g,f,r,this),_=R.data,A=R.included;if(l.data=_,A){var F;(F=l.included).push.apply(F,d(A))}}else{var z=this._normalizeArray(e,v,g,f),M=z.data,S=z.included;if(S){var T;(T=l.included).push.apply(T,d(S))}if(s)M.forEach(function(e){var t=b&&(0,o["default"])(e.id)===i,r=b&&!i&&!l.data;r||t?l.data=e:l.included.push(e)});else if(b)l.data=M;else if(M){var k;(k=l.included).push.apply(k,d(M))}}}}return l},isPrimaryType:function(e,t,r){var a=e.modelFor(t);return a.modelName===r.modelName},pushPayload:function(e,r){var a={data:[],included:[]};for(var i in r){var n=this.modelNameFromPayloadKey(i);if(e.modelFactoryFor(n)){var o=e.modelFor(n),s=e.serializerFor(o.modelName);t["default"].makeArray(r[i]).forEach(function(e){var t=s.normalize(o,e,i),r=t.data,n=t.included;if(a.data.push(r),n){var l;(l=a.included).push.apply(l,d(n))}})}}e.push(a)},modelNameFromPayloadKey:function(e){return(0,n.singularize)((0,i["default"])(e))},serialize:function(e,t){return this._super.apply(this,arguments)},serializeIntoHash:function(e,t,r,a){var i=this.payloadKeyFromModelName(t.modelName);e[i]=this.serialize(r,a)},payloadKeyFromModelName:function(e){return l(e)},serializePolymorphicType:function(e,r,a){var i=a.key,n=e.belongsTo(i),o=this.keyForPolymorphicType(i,a.type,"serialize");i=this.keyForAttribute?this.keyForAttribute(i,"serialize"):i,i+="Type",i!==o&&this.keyForPolymorphicType===u.prototype.keyForPolymorphicType&&(o=i),t["default"].isNone(n)?r[o]=null:r[o]=l(n.modelName)},extractPolymorphicRelationship:function(e,t,r){var a=r.key,i=r.resourceHash,n=r.relationshipMeta,o=n.options.polymorphic,s=this.keyForPolymorphicType(a,e,"deserialize");
5
+ if(o&&i.hasOwnProperty(s)&&"object"!=typeof t){var d=this.modelNameFromPayloadKey(i[s]);return{id:t,type:d}}return this._super.apply(this,arguments)}});e["default"]=u}),e("ember-data/setup-container",["exports","ember-data/-private/initializers/store","ember-data/-private/initializers/transforms","ember-data/-private/initializers/store-injections","ember-data/-private/initializers/data-adapter"],function(e,t,r,a,i){function n(e){(0,i["default"])(e),(0,r["default"])(e),(0,a["default"])(e),(0,t["default"])(e)}e["default"]=n}),e("ember-data/store",["exports","ember-data/-private/system/store"],function(e,t){e["default"]=t["default"]}),e("ember-data/transform",["exports","ember"],function(e,t){e["default"]=t["default"].Object.extend({serialize:null,deserialize:null})}),e("ember-data/version",["exports"],function(e){e["default"]="2.4.0-beta.3"}),e("ember-inflector",["exports","ember","ember-inflector/lib/system","ember-inflector/lib/ext/string"],function(t,r,a,i){a.Inflector.defaultRules=a.defaultRules,r["default"].Inflector=a.Inflector,r["default"].String.pluralize=a.pluralize,r["default"].String.singularize=a.singularize,t["default"]=a.Inflector,t.pluralize=a.pluralize,t.singularize=a.singularize,t.defaultRules=a.defaultRules,"undefined"!=typeof e&&e.amd?e("ember-inflector",["exports"],function(e){return e["default"]=a.Inflector,a.Inflector}):"undefined"!=typeof module&&module.exports&&(module.exports=a.Inflector)}),e("ember-inflector/lib/ext/string",["exports","ember","ember-inflector/lib/system/string"],function(e,t,r){(t["default"].EXTEND_PROTOTYPES===!0||t["default"].EXTEND_PROTOTYPES.String)&&(String.prototype.pluralize=function(){return(0,r.pluralize)(this)},String.prototype.singularize=function(){return(0,r.singularize)(this)})}),e("ember-inflector/lib/helpers/pluralize",["exports","ember-inflector","ember-inflector/lib/utils/make-helper"],function(e,t,r){e["default"]=(0,r["default"])(function(e){var r=void 0,a=void 0;return 1===e.length?(a=e[0],(0,t.pluralize)(a)):(r=e[0],a=e[1],1!==parseFloat(r)&&(a=(0,t.pluralize)(a)),r+" "+a)})}),e("ember-inflector/lib/helpers/singularize",["exports","ember-inflector","ember-inflector/lib/utils/make-helper"],function(e,t,r){e["default"]=(0,r["default"])(function(e){return(0,t.singularize)(e[0])})}),e("ember-inflector/lib/system",["exports","ember-inflector/lib/system/inflector","ember-inflector/lib/system/string","ember-inflector/lib/system/inflections"],function(e,t,r,a){t["default"].inflector=new t["default"](a["default"]),e.Inflector=t["default"],e.singularize=r.singularize,e.pluralize=r.pluralize,e.defaultRules=a["default"]}),e("ember-inflector/lib/system/inflections",["exports"],function(e){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"]}}),e("ember-inflector/lib/system/inflector",["exports","ember"],function(e,t){function r(e,t){for(var r=0,a=t.length;a>r;r++)e.uncountable[t[r].toLowerCase()]=!0}function a(e,t){for(var r,a=0,i=t.length;i>a;a++)r=t[a],e.irregular[r[0].toLowerCase()]=r[1],e.irregular[r[1].toLowerCase()]=r[1],e.irregularInverse[r[1].toLowerCase()]=r[0],e.irregularInverse[r[0].toLowerCase()]=r[0]}function i(e){e=e||{},e.uncountable=e.uncountable||n(),e.irregularPairs=e.irregularPairs||n();var t=this.rules={plurals:e.plurals||[],singular:e.singular||[],irregular:n(),irregularInverse:n(),uncountable:n()};r(t,e.uncountable),a(t,e.irregularPairs),this.enableCache()}function n(){var e=Object.create(null);return e._dict=null,delete e._dict,e}var o=t["default"].String.capitalize,s=/^\s*$/,d=/([\w\/-]+[_\/\s-])([a-z\d]+$)/,l=/([\w\/\s-]+)([A-Z][a-z\d]*$)/,u=/[A-Z][a-z\d]*$/;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");i.prototype={enableCache:function(){this.purgeCache(),this.singularize=function(e){return this._cacheUsed=!0,this._sCache[e]||(this._sCache[e]=this._singularize(e))},this.pluralize=function(e){return this._cacheUsed=!0,this._pCache[e]||(this._pCache[e]=this._pluralize(e))}},purgeCache:function(){this._cacheUsed=!1,this._sCache=n(),this._pCache=n()},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,t){this._cacheUsed&&this.purgeCache(),this.rules.plurals.push([e,t.toLowerCase()])},singular:function(e,t){this._cacheUsed&&this.purgeCache(),this.rules.singular.push([e,t.toLowerCase()])},uncountable:function(e){this._cacheUsed&&this.purgeCache(),r(this.rules,[e.toLowerCase()])},irregular:function(e,t){this._cacheUsed&&this.purgeCache(),a(this.rules,[[e,t]])},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,t,r){var a,i,n,c,h,p,f,m,y,v,b;if(m=!e||s.test(e),y=u.test(e),p="",m)return e;if(c=e.toLowerCase(),h=d.exec(e)||l.exec(e),h&&(p=h[1],f=h[2].toLowerCase()),b=this.rules.uncountable[c]||this.rules.uncountable[f])return e;for(v in this.rules.irregular)if(c.match(v+"$"))return i=r[v],y&&r[f]&&(i=o(i),v=o(v)),e.replace(v,i);for(var g=t.length,R=0;g>R&&(a=t[g-1],v=a[0],!v.test(e));g--);return a=a||[],v=a[0],i=a[1],n=e.replace(v,i)}},e["default"]=i}),e("ember-inflector/lib/system/string",["exports","ember-inflector/lib/system/inflector"],function(e,t){function r(e){return t["default"].inflector.pluralize(e)}function a(e){return t["default"].inflector.singularize(e)}e.pluralize=r,e.singularize=a}),e("ember-inflector/lib/utils/make-helper",["exports","ember"],function(e,t){function r(e){return t["default"].Helper?t["default"].Helper.helper(e):t["default"].HTMLBars?t["default"].HTMLBars.makeBoundHelper(e):t["default"].Handlebars.makeBoundHelper(e)}e["default"]=r}),e("ember",[],function(){return{"default":Ember}}),r("ember-data")}(),function(){function e(){var e={"ember-data":{"default":DS},"ember-data/model":{"default":DS.Model},"ember-data/mixins/embedded-records":{"default":DS.EmbeddedRecordsMixin},"ember-data/serializers/rest":{"default":DS.RESTSerializer},"ember-data/serializers/active-model":{"default":DS.ActiveModelSerializer},"ember-data/serializers/json":{"default":DS.JSONSerializer},"ember-data/serializers/json-api":{"default":DS.JSONAPISerializer},"ember-data/serializer":{"default":DS.Serializer},"ember-data/adapters/json-api":{"default":DS.JSONAPIAdapter},"ember-data/adapters/rest":{"default":DS.RESTAdapter},"ember-data/adapter":{"default":DS.Adapter},"ember-data/adapters/active-model":{"default":DS.ActiveModelAdapter},"ember-data/store":{"default":DS.Store},"ember-data/transform":{"default":DS.Transform},"ember-data/attr":{"default":DS.attr},"ember-data/relationships":{hasMany:DS.hasMany,belongsTo:DS.belongsTo}};for(var r in e)t(r,e[r])}function t(e,t){define(e,[],function(){"use strict";return t})}"undefined"!=typeof define&&define&&define.petal&&e()}(),function(){var e=Ember.K;Ember.onLoad("Ember.Application",function(t){t.initializer({name:"ember-data",initialize:DS._setupContainer}),t.instanceInitializer({name:"ember-data",initialize:DS._initializeStoreService}),t.initializer({name:"store",after:"ember-data",initialize:e}),t.initializer({name:"transforms",before:"store",initialize:e}),t.initializer({name:"data-adapter",before:"store",initialize:e}),t.initializer({name:"injectStore",before:"store",initialize:e})})}();
@@ -6,7 +6,7 @@
6
6
  * @copyright Copyright 2011-2016 Tilde Inc. and contributors.
7
7
  * Portions Copyright 2011 LivingSocial Inc.
8
8
  * @license Licensed under MIT license (see license.js)
9
- * @version 2.4.0-beta.2
9
+ * @version 2.4.0-beta.3
10
10
  */
11
11
 
12
12
  var define, requireModule, require, requirejs;
@@ -931,1317 +931,818 @@ define("ember-data/-private/serializers", ["exports", "ember-data/serializers/js
931
931
  /**
932
932
  @module ember-data
933
933
  */
934
- define('ember-data/-private/serializers/embedded-records-mixin', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
935
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
934
+ define("ember-data/-private/system/clone-null", ["exports", "ember-data/-private/system/empty-object"], function (exports, _emberDataPrivateSystemEmptyObject) {
935
+ exports.default = cloneNull;
936
936
 
937
- var get = _ember.default.get;
938
- var set = _ember.default.set;
939
- var camelize = _ember.default.String.camelize;
937
+ function cloneNull(source) {
938
+ var clone = new _emberDataPrivateSystemEmptyObject.default();
939
+ for (var key in source) {
940
+ clone[key] = source[key];
941
+ }
942
+ return clone;
943
+ }
944
+ });
945
+ define('ember-data/-private/system/coerce-id', ['exports'], function (exports) {
946
+ exports.default = coerceId;
947
+ // Used by the store to normalize IDs entering the store. Despite the fact
948
+ // that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),
949
+ // it is important that internally we use strings, since IDs may be serialized
950
+ // and lose type information. For example, Ember's router may put a record's
951
+ // ID into the URL, and if we later try to deserialize that URL and find the
952
+ // corresponding record, we will not know if it is a string or a number.
940
953
 
941
- /**
942
- ## Using Embedded Records
943
-
944
- `DS.EmbeddedRecordsMixin` supports serializing embedded records.
945
-
946
- To set up embedded records, include the mixin when extending a serializer,
947
- then define and configure embedded (model) relationships.
948
-
949
- Below is an example of a per-type serializer (`post` type).
950
-
951
- ```app/serializers/post.js
952
- import DS from 'ember-data';
954
+ function coerceId(id) {
955
+ return id == null || id === '' ? null : id + '';
956
+ }
957
+ });
958
+ define('ember-data/-private/system/container-proxy', ['exports', 'ember-data/-private/debug'], function (exports, _emberDataPrivateDebug) {
959
+ exports.default = ContainerProxy;
960
+
961
+ /*
962
+ This is used internally to enable deprecation of container paths and provide
963
+ a decent message to the user indicating how to fix the issue.
953
964
 
954
- export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
955
- attrs: {
956
- author: { embedded: 'always' },
957
- comments: { serialize: 'ids' }
965
+ @class ContainerProxy
966
+ @namespace DS
967
+ @private
968
+ */
969
+
970
+ function ContainerProxy(container) {
971
+ this.container = container;
972
+ }
973
+
974
+ ContainerProxy.prototype.aliasedFactory = function (path, preLookup) {
975
+ var _this = this;
976
+
977
+ return {
978
+ create: function () {
979
+ if (preLookup) {
980
+ preLookup();
981
+ }
982
+
983
+ return _this.container.lookup(path);
958
984
  }
959
- });
960
- ```
961
- Note that this use of `{ embedded: 'always' }` is unrelated to
962
- the `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of
963
- defining a model while working with the `ActiveModelSerializer`. Nevertheless,
964
- using `{ embedded: 'always' }` as an option to `DS.attr` is not a valid way to setup
965
- embedded records.
966
-
967
- The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:
968
-
969
- ```js
970
- {
971
- serialize: 'records',
972
- deserialize: 'records'
985
+ };
986
+ };
987
+
988
+ ContainerProxy.prototype.registerAlias = function (source, dest, preLookup) {
989
+ var factory = this.aliasedFactory(dest, preLookup);
990
+
991
+ return this.container.register(source, factory);
992
+ };
993
+
994
+ ContainerProxy.prototype.registerDeprecation = function (deprecated, valid) {
995
+ var preLookupCallback = function () {};
996
+
997
+ return this.registerAlias(deprecated, valid, preLookupCallback);
998
+ };
999
+
1000
+ ContainerProxy.prototype.registerDeprecations = function (proxyPairs) {
1001
+ var i, proxyPair, deprecated, valid;
1002
+
1003
+ for (i = proxyPairs.length; i > 0; i--) {
1004
+ proxyPair = proxyPairs[i - 1];
1005
+ deprecated = proxyPair['deprecated'];
1006
+ valid = proxyPair['valid'];
1007
+
1008
+ this.registerDeprecation(deprecated, valid);
973
1009
  }
974
- ```
975
-
976
- ### Configuring Attrs
977
-
978
- A resource's `attrs` option may be set to use `ids`, `records` or false for the
979
- `serialize` and `deserialize` settings.
980
-
981
- The `attrs` property can be set on the `ApplicationSerializer` or a per-type
982
- serializer.
983
-
984
- In the case where embedded JSON is expected while extracting a payload (reading)
985
- the setting is `deserialize: 'records'`, there is no need to use `ids` when
986
- extracting as that is the default behavior without this mixin if you are using
987
- the vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while
988
- serializing `serialize: 'records'` is the setting to use. There is an option of
989
- not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you
990
- do not want the relationship sent at all, you can use `serialize: false`.
991
-
992
-
993
- ### EmbeddedRecordsMixin defaults
994
- If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
995
- will behave in the following way:
996
-
997
- BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
998
- HasMany: `{ serialize: false, deserialize: 'ids' }`
999
-
1000
- ### Model Relationships
1001
-
1002
- Embedded records must have a model defined to be extracted and serialized. Note that
1003
- when defining any relationships on your model such as `belongsTo` and `hasMany`, you
1004
- should not both specify `async: true` and also indicate through the serializer's
1005
- `attrs` attribute that the related model should be embedded for deserialization.
1006
- If a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),
1007
- then do not use `async: true`.
1008
-
1009
- To successfully extract and serialize embedded records the model relationships
1010
- must be setup correcty. See the
1011
- [defining relationships](/guides/models/defining-models/#toc_defining-relationships)
1012
- section of the **Defining Models** guide page.
1013
-
1014
- Records without an `id` property are not considered embedded records, model
1015
- instances must have an `id` property to be used with Ember Data.
1016
-
1017
- ### Example JSON payloads, Models and Serializers
1018
-
1019
- **When customizing a serializer it is important to grok what the customizations
1020
- are. Please read the docs for the methods this mixin provides, in case you need
1021
- to modify it to fit your specific needs.**
1022
-
1023
- For example review the docs for each method of this mixin:
1024
- * [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize)
1025
- * [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo)
1026
- * [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany)
1010
+ };
1011
+ });
1012
+ define("ember-data/-private/system/debug", ["exports", "ember-data/-private/system/debug/debug-adapter"], function (exports, _emberDataPrivateSystemDebugDebugAdapter) {
1013
+ exports.default = _emberDataPrivateSystemDebugDebugAdapter.default;
1014
+ });
1015
+ /**
1016
+ @module ember-data
1017
+ */
1018
+ define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'ember-data/model'], function (exports, _ember, _emberDataModel) {
1019
+ var get = _ember.default.get;
1020
+ var capitalize = _ember.default.String.capitalize;
1021
+ var underscore = _ember.default.String.underscore;
1022
+ var assert = _ember.default.assert;
1023
+
1024
+ /*
1025
+ Extend `Ember.DataAdapter` with ED specific code.
1027
1026
 
1028
- @class EmbeddedRecordsMixin
1027
+ @class DebugAdapter
1029
1028
  @namespace DS
1029
+ @extends Ember.DataAdapter
1030
+ @private
1030
1031
  */
1031
- exports.default = _ember.default.Mixin.create({
1032
+ exports.default = _ember.default.DataAdapter.extend({
1033
+ getFilters: function () {
1034
+ return [{ name: 'isNew', desc: 'New' }, { name: 'isModified', desc: 'Modified' }, { name: 'isClean', desc: 'Clean' }];
1035
+ },
1032
1036
 
1033
- /**
1034
- Normalize the record and recursively normalize/extract all the embedded records
1035
- while pushing them into the store as they are encountered
1036
- A payload with an attr configured for embedded records needs to be extracted:
1037
- ```js
1038
- {
1039
- "post": {
1040
- "id": "1"
1041
- "title": "Rails is omakase",
1042
- "comments": [{
1043
- "id": "1",
1044
- "body": "Rails is unagi"
1045
- }, {
1046
- "id": "2",
1047
- "body": "Omakase O_o"
1048
- }]
1037
+ detect: function (typeClass) {
1038
+ return typeClass !== _emberDataModel.default && _emberDataModel.default.detect(typeClass);
1039
+ },
1040
+
1041
+ columnsForType: function (typeClass) {
1042
+ var columns = [{
1043
+ name: 'id',
1044
+ desc: 'Id'
1045
+ }];
1046
+ var count = 0;
1047
+ var self = this;
1048
+ get(typeClass, 'attributes').forEach(function (meta, name) {
1049
+ if (count++ > self.attributeLimit) {
1050
+ return false;
1049
1051
  }
1050
- }
1051
- ```
1052
- @method normalize
1053
- @param {DS.Model} typeClass
1054
- @param {Object} hash to be normalized
1055
- @param {String} prop the hash has been referenced by
1056
- @return {Object} the normalized hash
1057
- **/
1058
- normalize: function (typeClass, hash, prop) {
1059
- var normalizedHash = this._super(typeClass, hash, prop);
1060
- return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);
1052
+ var desc = capitalize(underscore(name).replace('_', ' '));
1053
+ columns.push({ name: name, desc: desc });
1054
+ });
1055
+ return columns;
1061
1056
  },
1062
1057
 
1063
- keyForRelationship: function (key, typeClass, method) {
1064
- if (method === 'serialize' && this.hasSerializeRecordsOption(key) || method === 'deserialize' && this.hasDeserializeRecordsOption(key)) {
1065
- return this.keyForAttribute(key, method);
1066
- } else {
1067
- return this._super(key, typeClass, method) || key;
1058
+ getRecords: function (modelClass, modelName) {
1059
+ if (arguments.length < 2) {
1060
+ // Legacy Ember.js < 1.13 support
1061
+ var containerKey = modelClass._debugContainerKey;
1062
+ if (containerKey) {
1063
+ var match = containerKey.match(/model:(.*)/);
1064
+ if (match) {
1065
+ modelName = match[1];
1066
+ }
1067
+ }
1068
1068
  }
1069
+ assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName);
1070
+ return this.get('store').peekAll(modelName);
1069
1071
  },
1070
1072
 
1071
- /**
1072
- Serialize `belongsTo` relationship when it is configured as an embedded object.
1073
- This example of an author model belongs to a post model:
1074
- ```js
1075
- Post = DS.Model.extend({
1076
- title: DS.attr('string'),
1077
- body: DS.attr('string'),
1078
- author: DS.belongsTo('author')
1079
- });
1080
- Author = DS.Model.extend({
1081
- name: DS.attr('string'),
1082
- post: DS.belongsTo('post')
1083
- });
1084
- ```
1085
- Use a custom (type) serializer for the post model to configure embedded author
1086
- ```app/serializers/post.js
1087
- import DS from 'ember-data;
1088
- export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
1089
- attrs: {
1090
- author: { embedded: 'always' }
1091
- }
1092
- })
1093
- ```
1094
- A payload with an attribute configured for embedded records can serialize
1095
- the records together under the root attribute's payload:
1096
- ```js
1097
- {
1098
- "post": {
1099
- "id": "1"
1100
- "title": "Rails is omakase",
1101
- "author": {
1102
- "id": "2"
1103
- "name": "dhh"
1104
- }
1105
- }
1106
- }
1107
- ```
1108
- @method serializeBelongsTo
1109
- @param {DS.Snapshot} snapshot
1110
- @param {Object} json
1111
- @param {Object} relationship
1112
- */
1113
- serializeBelongsTo: function (snapshot, json, relationship) {
1114
- var attr = relationship.key;
1115
- if (this.noSerializeOptionSpecified(attr)) {
1116
- this._super(snapshot, json, relationship);
1117
- return;
1118
- }
1119
- var includeIds = this.hasSerializeIdsOption(attr);
1120
- var includeRecords = this.hasSerializeRecordsOption(attr);
1121
- var embeddedSnapshot = snapshot.belongsTo(attr);
1122
- var key;
1123
- if (includeIds) {
1124
- key = this.keyForRelationship(attr, relationship.kind, 'serialize');
1125
- if (!embeddedSnapshot) {
1126
- json[key] = null;
1127
- } else {
1128
- json[key] = embeddedSnapshot.id;
1129
-
1130
- if (relationship.options.polymorphic) {
1131
- this.serializePolymorphicType(snapshot, json, relationship);
1132
- }
1133
- }
1134
- } else if (includeRecords) {
1135
- this._serializeEmbeddedBelongsTo(snapshot, json, relationship);
1136
- }
1137
- },
1073
+ getRecordColumnValues: function (record) {
1074
+ var _this = this;
1138
1075
 
1139
- _serializeEmbeddedBelongsTo: function (snapshot, json, relationship) {
1140
- var embeddedSnapshot = snapshot.belongsTo(relationship.key);
1141
- var serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');
1142
- if (!embeddedSnapshot) {
1143
- json[serializedKey] = null;
1144
- } else {
1145
- json[serializedKey] = embeddedSnapshot.record.serialize({ includeId: true });
1146
- this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);
1076
+ var count = 0;
1077
+ var columnValues = { id: get(record, 'id') };
1147
1078
 
1148
- if (relationship.options.polymorphic) {
1149
- this.serializePolymorphicType(snapshot, json, relationship);
1079
+ record.eachAttribute(function (key) {
1080
+ if (count++ > _this.attributeLimit) {
1081
+ return false;
1150
1082
  }
1151
- }
1083
+ var value = get(record, key);
1084
+ columnValues[key] = value;
1085
+ });
1086
+ return columnValues;
1152
1087
  },
1153
1088
 
1154
- /**
1155
- Serialize `hasMany` relationship when it is configured as embedded objects.
1156
- This example of a post model has many comments:
1157
- ```js
1158
- Post = DS.Model.extend({
1159
- title: DS.attr('string'),
1160
- body: DS.attr('string'),
1161
- comments: DS.hasMany('comment')
1089
+ getRecordKeywords: function (record) {
1090
+ var keywords = [];
1091
+ var keys = _ember.default.A(['id']);
1092
+ record.eachAttribute(function (key) {
1093
+ return keys.push(key);
1162
1094
  });
1163
- Comment = DS.Model.extend({
1164
- body: DS.attr('string'),
1165
- post: DS.belongsTo('post')
1095
+ keys.forEach(function (key) {
1096
+ return keywords.push(get(record, key));
1166
1097
  });
1167
- ```
1168
- Use a custom (type) serializer for the post model to configure embedded comments
1169
- ```app/serializers/post.js
1170
- import DS from 'ember-data;
1171
- export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
1172
- attrs: {
1173
- comments: { embedded: 'always' }
1174
- }
1175
- })
1176
- ```
1177
- A payload with an attribute configured for embedded records can serialize
1178
- the records together under the root attribute's payload:
1179
- ```js
1180
- {
1181
- "post": {
1182
- "id": "1"
1183
- "title": "Rails is omakase",
1184
- "body": "I want this for my ORM, I want that for my template language..."
1185
- "comments": [{
1186
- "id": "1",
1187
- "body": "Rails is unagi"
1188
- }, {
1189
- "id": "2",
1190
- "body": "Omakase O_o"
1191
- }]
1192
- }
1193
- }
1194
- ```
1195
- The attrs options object can use more specific instruction for extracting and
1196
- serializing. When serializing, an option to embed `ids` or `records` can be set.
1197
- When extracting the only option is `records`.
1198
- So `{ embedded: 'always' }` is shorthand for:
1199
- `{ serialize: 'records', deserialize: 'records' }`
1200
- To embed the `ids` for a related object (using a hasMany relationship):
1201
- ```app/serializers/post.js
1202
- import DS from 'ember-data;
1203
- export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
1204
- attrs: {
1205
- comments: { serialize: 'ids', deserialize: 'records' }
1206
- }
1207
- })
1208
- ```
1209
- ```js
1210
- {
1211
- "post": {
1212
- "id": "1"
1213
- "title": "Rails is omakase",
1214
- "body": "I want this for my ORM, I want that for my template language..."
1215
- "comments": ["1", "2"]
1216
- }
1217
- }
1218
- ```
1219
- @method serializeHasMany
1220
- @param {DS.Snapshot} snapshot
1221
- @param {Object} json
1222
- @param {Object} relationship
1223
- */
1224
- serializeHasMany: function (snapshot, json, relationship) {
1225
- var attr = relationship.key;
1226
- if (this.noSerializeOptionSpecified(attr)) {
1227
- this._super(snapshot, json, relationship);
1228
- return;
1229
- }
1230
- var includeIds = this.hasSerializeIdsOption(attr);
1231
- var includeRecords = this.hasSerializeRecordsOption(attr);
1232
- if (includeIds) {
1233
- var serializedKey = this.keyForRelationship(attr, relationship.kind, 'serialize');
1234
- json[serializedKey] = snapshot.hasMany(attr, { ids: true });
1235
- } else if (includeRecords) {
1236
- this._serializeEmbeddedHasMany(snapshot, json, relationship);
1237
- }
1098
+ return keywords;
1238
1099
  },
1239
1100
 
1240
- _serializeEmbeddedHasMany: function (snapshot, json, relationship) {
1241
- var serializedKey = this.keyForRelationship(relationship.key, relationship.kind, 'serialize');
1242
-
1243
- json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
1101
+ getRecordFilterValues: function (record) {
1102
+ return {
1103
+ isNew: record.get('isNew'),
1104
+ isModified: record.get('hasDirtyAttributes') && !record.get('isNew'),
1105
+ isClean: !record.get('hasDirtyAttributes')
1106
+ };
1244
1107
  },
1245
1108
 
1246
- /*
1247
- Returns an array of embedded records serialized to JSON
1248
- */
1249
- _generateSerializedHasMany: function (snapshot, relationship) {
1250
- var hasMany = snapshot.hasMany(relationship.key);
1251
- var manyArray = _ember.default.A(hasMany);
1252
- var ret = new Array(manyArray.length);
1253
-
1254
- for (var i = 0; i < manyArray.length; i++) {
1255
- var embeddedSnapshot = manyArray[i];
1256
- var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
1257
- this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
1258
- ret[i] = embeddedJson;
1109
+ getRecordColor: function (record) {
1110
+ var color = 'black';
1111
+ if (record.get('isNew')) {
1112
+ color = 'green';
1113
+ } else if (record.get('hasDirtyAttributes')) {
1114
+ color = 'blue';
1259
1115
  }
1260
-
1261
- return ret;
1116
+ return color;
1262
1117
  },
1263
1118
 
1264
- /**
1265
- When serializing an embedded record, modify the property (in the json payload)
1266
- that refers to the parent record (foreign key for relationship).
1267
- Serializing a `belongsTo` relationship removes the property that refers to the
1268
- parent record
1269
- Serializing a `hasMany` relationship does not remove the property that refers to
1270
- the parent record.
1271
- @method removeEmbeddedForeignKey
1272
- @param {DS.Snapshot} snapshot
1273
- @param {DS.Snapshot} embeddedSnapshot
1274
- @param {Object} relationship
1275
- @param {Object} json
1276
- */
1277
- removeEmbeddedForeignKey: function (snapshot, embeddedSnapshot, relationship, json) {
1278
- if (relationship.kind === 'hasMany') {
1279
- return;
1280
- } else if (relationship.kind === 'belongsTo') {
1281
- var parentRecord = snapshot.type.inverseFor(relationship.key, this.store);
1282
- if (parentRecord) {
1283
- var name = parentRecord.name;
1284
- var embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);
1285
- var parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');
1286
- if (parentKey) {
1287
- delete json[parentKey];
1288
- }
1289
- }
1290
- }
1291
- },
1119
+ observeRecord: function (record, recordUpdated) {
1120
+ var releaseMethods = _ember.default.A();
1121
+ var keysToObserve = _ember.default.A(['id', 'isNew', 'hasDirtyAttributes']);
1292
1122
 
1293
- // checks config for attrs option to embedded (always) - serialize and deserialize
1294
- hasEmbeddedAlwaysOption: function (attr) {
1295
- var option = this.attrsOption(attr);
1296
- return option && option.embedded === 'always';
1297
- },
1123
+ record.eachAttribute(function (key) {
1124
+ return keysToObserve.push(key);
1125
+ });
1126
+ var adapter = this;
1298
1127
 
1299
- // checks config for attrs option to serialize ids
1300
- hasSerializeRecordsOption: function (attr) {
1301
- var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
1302
- var option = this.attrsOption(attr);
1303
- return alwaysEmbed || option && option.serialize === 'records';
1304
- },
1128
+ keysToObserve.forEach(function (key) {
1129
+ var handler = function () {
1130
+ recordUpdated(adapter.wrapRecord(record));
1131
+ };
1132
+ _ember.default.addObserver(record, key, handler);
1133
+ releaseMethods.push(function () {
1134
+ _ember.default.removeObserver(record, key, handler);
1135
+ });
1136
+ });
1305
1137
 
1306
- // checks config for attrs option to serialize records
1307
- hasSerializeIdsOption: function (attr) {
1308
- var option = this.attrsOption(attr);
1309
- return option && (option.serialize === 'ids' || option.serialize === 'id');
1310
- },
1311
-
1312
- // checks config for attrs option to serialize records
1313
- noSerializeOptionSpecified: function (attr) {
1314
- var option = this.attrsOption(attr);
1315
- return !(option && (option.serialize || option.embedded));
1316
- },
1317
-
1318
- // checks config for attrs option to deserialize records
1319
- // a defined option object for a resource is treated the same as
1320
- // `deserialize: 'records'`
1321
- hasDeserializeRecordsOption: function (attr) {
1322
- var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
1323
- var option = this.attrsOption(attr);
1324
- return alwaysEmbed || option && option.deserialize === 'records';
1325
- },
1138
+ var release = function () {
1139
+ releaseMethods.forEach(function (fn) {
1140
+ return fn();
1141
+ });
1142
+ };
1326
1143
 
1327
- attrsOption: function (attr) {
1328
- var attrs = this.get('attrs');
1329
- return attrs && (attrs[camelize(attr)] || attrs[attr]);
1330
- },
1144
+ return release;
1145
+ }
1146
+ });
1147
+ });
1148
+ /**
1149
+ @module ember-data
1150
+ */
1151
+ define('ember-data/-private/system/debug/debug-info', ['exports', 'ember'], function (exports, _ember) {
1152
+ exports.default = _ember.default.Mixin.create({
1331
1153
 
1332
1154
  /**
1333
- @method _extractEmbeddedRecords
1334
- @private
1155
+ Provides info about the model for debugging purposes
1156
+ by grouping the properties into more semantic groups.
1157
+ Meant to be used by debugging tools such as the Chrome Ember Extension.
1158
+ - Groups all attributes in "Attributes" group.
1159
+ - Groups all belongsTo relationships in "Belongs To" group.
1160
+ - Groups all hasMany relationships in "Has Many" group.
1161
+ - Groups all flags in "Flags" group.
1162
+ - Flags relationship CPs as expensive properties.
1163
+ @method _debugInfo
1164
+ @for DS.Model
1165
+ @private
1335
1166
  */
1336
- _extractEmbeddedRecords: function (serializer, store, typeClass, partial) {
1337
- var _this = this;
1167
+ _debugInfo: function () {
1168
+ var attributes = ['id'];
1169
+ var relationships = { belongsTo: [], hasMany: [] };
1170
+ var expensiveProperties = [];
1338
1171
 
1339
- typeClass.eachRelationship(function (key, relationship) {
1340
- if (serializer.hasDeserializeRecordsOption(key)) {
1341
- if (relationship.kind === "hasMany") {
1342
- _this._extractEmbeddedHasMany(store, key, partial, relationship);
1343
- }
1344
- if (relationship.kind === "belongsTo") {
1345
- _this._extractEmbeddedBelongsTo(store, key, partial, relationship);
1346
- }
1347
- }
1172
+ this.eachAttribute(function (name, meta) {
1173
+ return attributes.push(name);
1348
1174
  });
1349
- return partial;
1350
- },
1351
-
1352
- /**
1353
- @method _extractEmbeddedHasMany
1354
- @private
1355
- */
1356
- _extractEmbeddedHasMany: function (store, key, hash, relationshipMeta) {
1357
- var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
1358
-
1359
- if (!relationshipHash) {
1360
- return;
1361
- }
1362
-
1363
- var hasMany = new Array(relationshipHash.length);
1364
1175
 
1365
- for (var i = 0; i < relationshipHash.length; i++) {
1366
- var item = relationshipHash[i];
1367
-
1368
- var _normalizeEmbeddedRelationship = this._normalizeEmbeddedRelationship(store, relationshipMeta, item);
1369
-
1370
- var data = _normalizeEmbeddedRelationship.data;
1371
- var included = _normalizeEmbeddedRelationship.included;
1176
+ this.eachRelationship(function (name, relationship) {
1177
+ relationships[relationship.kind].push(name);
1178
+ expensiveProperties.push(name);
1179
+ });
1372
1180
 
1373
- hash.included = hash.included || [];
1374
- hash.included.push(data);
1375
- if (included) {
1376
- var _hash$included;
1181
+ var groups = [{
1182
+ name: 'Attributes',
1183
+ properties: attributes,
1184
+ expand: true
1185
+ }, {
1186
+ name: 'Belongs To',
1187
+ properties: relationships.belongsTo,
1188
+ expand: true
1189
+ }, {
1190
+ name: 'Has Many',
1191
+ properties: relationships.hasMany,
1192
+ expand: true
1193
+ }, {
1194
+ name: 'Flags',
1195
+ properties: ['isLoaded', 'hasDirtyAttributes', 'isSaving', 'isDeleted', 'isError', 'isNew', 'isValid']
1196
+ }];
1377
1197
 
1378
- (_hash$included = hash.included).push.apply(_hash$included, _toConsumableArray(included));
1198
+ return {
1199
+ propertyInfo: {
1200
+ // include all other mixins / properties (not just the grouped ones)
1201
+ includeOtherProperties: true,
1202
+ groups: groups,
1203
+ // don't pre-calculate unless cached
1204
+ expensiveProperties: expensiveProperties
1379
1205
  }
1380
-
1381
- hasMany[i] = { id: data.id, type: data.type };
1382
- }
1383
-
1384
- var relationship = { data: hasMany };
1385
- set(hash, 'data.relationships.' + key, relationship);
1386
- },
1387
-
1388
- /**
1389
- @method _extractEmbeddedBelongsTo
1390
- @private
1391
- */
1392
- _extractEmbeddedBelongsTo: function (store, key, hash, relationshipMeta) {
1393
- var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
1394
- if (!relationshipHash) {
1395
- return;
1396
- }
1397
-
1398
- var _normalizeEmbeddedRelationship2 = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);
1399
-
1400
- var data = _normalizeEmbeddedRelationship2.data;
1401
- var included = _normalizeEmbeddedRelationship2.included;
1402
-
1403
- hash.included = hash.included || [];
1404
- hash.included.push(data);
1405
- if (included) {
1406
- var _hash$included2;
1407
-
1408
- (_hash$included2 = hash.included).push.apply(_hash$included2, _toConsumableArray(included));
1409
- }
1410
-
1411
- var belongsTo = { id: data.id, type: data.type };
1412
- var relationship = { data: belongsTo };
1413
-
1414
- set(hash, 'data.relationships.' + key, relationship);
1415
- },
1416
-
1417
- /**
1418
- @method _normalizeEmbeddedRelationship
1419
- @private
1420
- */
1421
- _normalizeEmbeddedRelationship: function (store, relationshipMeta, relationshipHash) {
1422
- var modelName = relationshipMeta.type;
1423
- if (relationshipMeta.options.polymorphic) {
1424
- modelName = relationshipHash.type;
1425
- }
1426
- var modelClass = store.modelFor(modelName);
1427
- var serializer = store.serializerFor(modelName);
1428
-
1429
- return serializer.normalize(modelClass, relationshipHash, null);
1206
+ };
1430
1207
  }
1431
1208
  });
1432
1209
  });
1433
- define("ember-data/-private/system/clone-null", ["exports", "ember-data/-private/system/empty-object"], function (exports, _emberDataPrivateSystemEmptyObject) {
1434
- exports.default = cloneNull;
1435
-
1436
- function cloneNull(source) {
1437
- var clone = new _emberDataPrivateSystemEmptyObject.default();
1438
- for (var key in source) {
1439
- clone[key] = source[key];
1210
+ define("ember-data/-private/system/empty-object", ["exports"], function (exports) {
1211
+ exports.default = EmptyObject;
1212
+ // This exists because `Object.create(null)` is absurdly slow compared
1213
+ // to `new EmptyObject()`. In either case, you want a null prototype
1214
+ // when you're treating the object instances as arbitrary dictionaries
1215
+ // and don't want your keys colliding with build-in methods on the
1216
+ // default object prototype.
1217
+ var proto = Object.create(null, {
1218
+ // without this, we will always still end up with (new
1219
+ // EmptyObject()).constructor === Object
1220
+ constructor: {
1221
+ value: undefined,
1222
+ enumerable: false,
1223
+ writable: true
1440
1224
  }
1441
- return clone;
1442
- }
1443
- });
1444
- define('ember-data/-private/system/coerce-id', ['exports'], function (exports) {
1445
- exports.default = coerceId;
1446
- // Used by the store to normalize IDs entering the store. Despite the fact
1447
- // that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),
1448
- // it is important that internally we use strings, since IDs may be serialized
1449
- // and lose type information. For example, Ember's router may put a record's
1450
- // ID into the URL, and if we later try to deserialize that URL and find the
1451
- // corresponding record, we will not know if it is a string or a number.
1225
+ });
1452
1226
 
1453
- function coerceId(id) {
1454
- return id == null || id === '' ? null : id + '';
1455
- }
1227
+ function EmptyObject() {}
1228
+
1229
+ EmptyObject.prototype = proto;
1456
1230
  });
1457
- define('ember-data/-private/system/container-proxy', ['exports', 'ember-data/-private/debug'], function (exports, _emberDataPrivateDebug) {
1458
- exports.default = ContainerProxy;
1231
+ define('ember-data/-private/system/is-array-like', ['exports', 'ember'], function (exports, _ember) {
1232
+ exports.default = isArrayLike;
1459
1233
 
1460
1234
  /*
1461
- This is used internally to enable deprecation of container paths and provide
1462
- a decent message to the user indicating how to fix the issue.
1235
+ We're using this to detect arrays and "array-like" objects.
1463
1236
 
1464
- @class ContainerProxy
1465
- @namespace DS
1466
- @private
1467
- */
1237
+ This is a copy of the `isArray` method found in `ember-runtime/utils` as we're
1238
+ currently unable to import non-exposed modules.
1239
+
1240
+ This method was previously exposed as `Ember.isArray` but since
1241
+ https://github.com/emberjs/ember.js/pull/11463 `Ember.isArray` is an alias of
1242
+ `Array.isArray` hence removing the "array-like" part.
1243
+ */
1468
1244
 
1469
- function ContainerProxy(container) {
1470
- this.container = container;
1245
+ function isArrayLike(obj) {
1246
+ if (!obj || obj.setInterval) {
1247
+ return false;
1248
+ }
1249
+ if (Array.isArray(obj)) {
1250
+ return true;
1251
+ }
1252
+ if (_ember.default.Array.detect(obj)) {
1253
+ return true;
1254
+ }
1255
+
1256
+ var type = _ember.default.typeOf(obj);
1257
+ if ('array' === type) {
1258
+ return true;
1259
+ }
1260
+ if (obj.length !== undefined && 'object' === type) {
1261
+ return true;
1262
+ }
1263
+ return false;
1471
1264
  }
1265
+ });
1266
+ define("ember-data/-private/system/many-array", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies) {
1472
1267
 
1473
- ContainerProxy.prototype.aliasedFactory = function (path, preLookup) {
1474
- var _this = this;
1268
+ var get = _ember.default.get;
1269
+ var set = _ember.default.set;
1475
1270
 
1476
- return {
1477
- create: function () {
1478
- if (preLookup) {
1479
- preLookup();
1480
- }
1481
-
1482
- return _this.container.lookup(path);
1483
- }
1484
- };
1485
- };
1486
-
1487
- ContainerProxy.prototype.registerAlias = function (source, dest, preLookup) {
1488
- var factory = this.aliasedFactory(dest, preLookup);
1489
-
1490
- return this.container.register(source, factory);
1491
- };
1492
-
1493
- ContainerProxy.prototype.registerDeprecation = function (deprecated, valid) {
1494
- var preLookupCallback = function () {};
1495
-
1496
- return this.registerAlias(deprecated, valid, preLookupCallback);
1497
- };
1498
-
1499
- ContainerProxy.prototype.registerDeprecations = function (proxyPairs) {
1500
- var i, proxyPair, deprecated, valid;
1501
-
1502
- for (i = proxyPairs.length; i > 0; i--) {
1503
- proxyPair = proxyPairs[i - 1];
1504
- deprecated = proxyPair['deprecated'];
1505
- valid = proxyPair['valid'];
1506
-
1507
- this.registerDeprecation(deprecated, valid);
1508
- }
1509
- };
1510
- });
1511
- define("ember-data/-private/system/debug", ["exports", "ember-data/-private/system/debug/debug-adapter"], function (exports, _emberDataPrivateSystemDebugDebugAdapter) {
1512
- exports.default = _emberDataPrivateSystemDebugDebugAdapter.default;
1513
- });
1514
- /**
1515
- @module ember-data
1516
- */
1517
- define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'ember-data/model'], function (exports, _ember, _emberDataModel) {
1518
- var get = _ember.default.get;
1519
- var capitalize = _ember.default.String.capitalize;
1520
- var underscore = _ember.default.String.underscore;
1521
- var assert = _ember.default.assert;
1522
-
1523
- /*
1524
- Extend `Ember.DataAdapter` with ED specific code.
1271
+ /**
1272
+ A `ManyArray` is a `MutableArray` that represents the contents of a has-many
1273
+ relationship.
1525
1274
 
1526
- @class DebugAdapter
1275
+ The `ManyArray` is instantiated lazily the first time the relationship is
1276
+ requested.
1277
+
1278
+ ### Inverses
1279
+
1280
+ Often, the relationships in Ember Data applications will have
1281
+ an inverse. For example, imagine the following models are
1282
+ defined:
1283
+
1284
+ ```app/models/post.js
1285
+ import DS from 'ember-data';
1286
+
1287
+ export default DS.Model.extend({
1288
+ comments: DS.hasMany('comment')
1289
+ });
1290
+ ```
1291
+
1292
+ ```app/models/comment.js
1293
+ import DS from 'ember-data';
1294
+
1295
+ export default DS.Model.extend({
1296
+ post: DS.belongsTo('post')
1297
+ });
1298
+ ```
1299
+
1300
+ If you created a new instance of `App.Post` and added
1301
+ a `App.Comment` record to its `comments` has-many
1302
+ relationship, you would expect the comment's `post`
1303
+ property to be set to the post that contained
1304
+ the has-many.
1305
+
1306
+ We call the record to which a relationship belongs the
1307
+ relationship's _owner_.
1308
+
1309
+ @class ManyArray
1527
1310
  @namespace DS
1528
- @extends Ember.DataAdapter
1529
- @private
1311
+ @extends Ember.Object
1312
+ @uses Ember.MutableArray, Ember.Evented
1530
1313
  */
1531
- exports.default = _ember.default.DataAdapter.extend({
1532
- getFilters: function () {
1533
- return [{ name: 'isNew', desc: 'New' }, { name: 'isModified', desc: 'Modified' }, { name: 'isClean', desc: 'Clean' }];
1314
+ exports.default = _ember.default.Object.extend(_ember.default.MutableArray, _ember.default.Evented, {
1315
+ init: function () {
1316
+ this._super.apply(this, arguments);
1317
+ this.currentState = _ember.default.A([]);
1534
1318
  },
1535
1319
 
1536
- detect: function (typeClass) {
1537
- return typeClass !== _emberDataModel.default && _emberDataModel.default.detect(typeClass);
1320
+ record: null,
1321
+
1322
+ canonicalState: null,
1323
+ currentState: null,
1324
+
1325
+ length: 0,
1326
+
1327
+ objectAt: function (index) {
1328
+ //Ember observers such as 'firstObject', 'lastObject' might do out of bounds accesses
1329
+ if (!this.currentState[index]) {
1330
+ return undefined;
1331
+ }
1332
+ return this.currentState[index].getRecord();
1538
1333
  },
1539
1334
 
1540
- columnsForType: function (typeClass) {
1541
- var columns = [{
1542
- name: 'id',
1543
- desc: 'Id'
1544
- }];
1545
- var count = 0;
1546
- var self = this;
1547
- get(typeClass, 'attributes').forEach(function (meta, name) {
1548
- if (count++ > self.attributeLimit) {
1549
- return false;
1550
- }
1551
- var desc = capitalize(underscore(name).replace('_', ' '));
1552
- columns.push({ name: name, desc: desc });
1335
+ flushCanonical: function () {
1336
+ //TODO make this smarter, currently its plenty stupid
1337
+ var toSet = this.canonicalState.filter(function (internalModel) {
1338
+ return !internalModel.isDeleted();
1553
1339
  });
1554
- return columns;
1555
- },
1556
1340
 
1557
- getRecords: function (modelClass, modelName) {
1558
- if (arguments.length < 2) {
1559
- // Legacy Ember.js < 1.13 support
1560
- var containerKey = modelClass._debugContainerKey;
1561
- if (containerKey) {
1562
- var match = containerKey.match(/model:(.*)/);
1563
- if (match) {
1564
- modelName = match[1];
1565
- }
1566
- }
1567
- }
1568
- assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName);
1569
- return this.get('store').peekAll(modelName);
1341
+ //a hack for not removing new records
1342
+ //TODO remove once we have proper diffing
1343
+ var newRecords = this.currentState.filter(function (internalModel) {
1344
+ return internalModel.isNew();
1345
+ });
1346
+ toSet = toSet.concat(newRecords);
1347
+ var oldLength = this.length;
1348
+ this.arrayContentWillChange(0, this.length, toSet.length);
1349
+ this.set('length', toSet.length);
1350
+ this.currentState = toSet;
1351
+ this.arrayContentDidChange(0, oldLength, this.length);
1352
+ //TODO Figure out to notify only on additions and maybe only if unloaded
1353
+ this.relationship.notifyHasManyChanged();
1354
+ this.record.updateRecordArrays();
1570
1355
  },
1356
+ /**
1357
+ `true` if the relationship is polymorphic, `false` otherwise.
1358
+ @property {Boolean} isPolymorphic
1359
+ @private
1360
+ */
1361
+ isPolymorphic: false,
1571
1362
 
1572
- getRecordColumnValues: function (record) {
1573
- var _this = this;
1363
+ /**
1364
+ The loading state of this array
1365
+ @property {Boolean} isLoaded
1366
+ */
1367
+ isLoaded: false,
1574
1368
 
1575
- var count = 0;
1576
- var columnValues = { id: get(record, 'id') };
1369
+ /**
1370
+ The relationship which manages this array.
1371
+ @property {ManyRelationship} relationship
1372
+ @private
1373
+ */
1374
+ relationship: null,
1577
1375
 
1578
- record.eachAttribute(function (key) {
1579
- if (count++ > _this.attributeLimit) {
1580
- return false;
1376
+ /**
1377
+ Metadata associated with the request for async hasMany relationships.
1378
+ Example
1379
+ Given that the server returns the following JSON payload when fetching a
1380
+ hasMany relationship:
1381
+ ```js
1382
+ {
1383
+ "comments": [{
1384
+ "id": 1,
1385
+ "comment": "This is the first comment",
1386
+ }, {
1387
+ // ...
1388
+ }],
1389
+ "meta": {
1390
+ "page": 1,
1391
+ "total": 5
1581
1392
  }
1582
- var value = get(record, key);
1583
- columnValues[key] = value;
1393
+ }
1394
+ ```
1395
+ You can then access the metadata via the `meta` property:
1396
+ ```js
1397
+ post.get('comments').then(function(comments) {
1398
+ var meta = comments.get('meta');
1399
+ // meta.page => 1
1400
+ // meta.total => 5
1584
1401
  });
1585
- return columnValues;
1586
- },
1402
+ ```
1403
+ @property {Object} meta
1404
+ @public
1405
+ */
1406
+ meta: null,
1587
1407
 
1588
- getRecordKeywords: function (record) {
1589
- var keywords = [];
1590
- var keys = _ember.default.A(['id']);
1591
- record.eachAttribute(function (key) {
1592
- return keys.push(key);
1593
- });
1594
- keys.forEach(function (key) {
1595
- return keywords.push(get(record, key));
1596
- });
1597
- return keywords;
1408
+ internalReplace: function (idx, amt, objects) {
1409
+ if (!objects) {
1410
+ objects = [];
1411
+ }
1412
+ this.arrayContentWillChange(idx, amt, objects.length);
1413
+ this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
1414
+ this.set('length', this.currentState.length);
1415
+ this.arrayContentDidChange(idx, amt, objects.length);
1416
+ if (objects) {
1417
+ //TODO(Igor) probably needed only for unloaded records
1418
+ this.relationship.notifyHasManyChanged();
1419
+ }
1420
+ this.record.updateRecordArrays();
1598
1421
  },
1599
1422
 
1600
- getRecordFilterValues: function (record) {
1601
- return {
1602
- isNew: record.get('isNew'),
1603
- isModified: record.get('hasDirtyAttributes') && !record.get('isNew'),
1604
- isClean: !record.get('hasDirtyAttributes')
1605
- };
1423
+ //TODO(Igor) optimize
1424
+ internalRemoveRecords: function (records) {
1425
+ var index;
1426
+ for (var i = 0; i < records.length; i++) {
1427
+ index = this.currentState.indexOf(records[i]);
1428
+ this.internalReplace(index, 1);
1429
+ }
1606
1430
  },
1607
1431
 
1608
- getRecordColor: function (record) {
1609
- var color = 'black';
1610
- if (record.get('isNew')) {
1611
- color = 'green';
1612
- } else if (record.get('hasDirtyAttributes')) {
1613
- color = 'blue';
1432
+ //TODO(Igor) optimize
1433
+ internalAddRecords: function (records, idx) {
1434
+ if (idx === undefined) {
1435
+ idx = this.currentState.length;
1614
1436
  }
1615
- return color;
1437
+ this.internalReplace(idx, 0, records);
1616
1438
  },
1617
1439
 
1618
- observeRecord: function (record, recordUpdated) {
1619
- var releaseMethods = _ember.default.A();
1620
- var keysToObserve = _ember.default.A(['id', 'isNew', 'hasDirtyAttributes']);
1440
+ replace: function (idx, amt, objects) {
1441
+ var records;
1442
+ if (amt > 0) {
1443
+ records = this.currentState.slice(idx, idx + amt);
1444
+ this.get('relationship').removeRecords(records);
1445
+ }
1446
+ if (objects) {
1447
+ this.get('relationship').addRecords(objects.map(function (obj) {
1448
+ return obj._internalModel;
1449
+ }), idx);
1450
+ }
1451
+ },
1452
+ /**
1453
+ Used for async `hasMany` arrays
1454
+ to keep track of when they will resolve.
1455
+ @property {Ember.RSVP.Promise} promise
1456
+ @private
1457
+ */
1458
+ promise: null,
1621
1459
 
1622
- record.eachAttribute(function (key) {
1623
- return keysToObserve.push(key);
1624
- });
1625
- var adapter = this;
1460
+ /**
1461
+ @method loadingRecordsCount
1462
+ @param {Number} count
1463
+ @private
1464
+ */
1465
+ loadingRecordsCount: function (count) {
1466
+ this.loadingRecordsCount = count;
1467
+ },
1626
1468
 
1627
- keysToObserve.forEach(function (key) {
1628
- var handler = function () {
1629
- recordUpdated(adapter.wrapRecord(record));
1630
- };
1631
- _ember.default.addObserver(record, key, handler);
1632
- releaseMethods.push(function () {
1633
- _ember.default.removeObserver(record, key, handler);
1634
- });
1635
- });
1469
+ /**
1470
+ @method loadedRecord
1471
+ @private
1472
+ */
1473
+ loadedRecord: function () {
1474
+ this.loadingRecordsCount--;
1475
+ if (this.loadingRecordsCount === 0) {
1476
+ set(this, 'isLoaded', true);
1477
+ this.trigger('didLoad');
1478
+ }
1479
+ },
1636
1480
 
1637
- var release = function () {
1638
- releaseMethods.forEach(function (fn) {
1639
- return fn();
1481
+ /**
1482
+ @method reload
1483
+ @public
1484
+ */
1485
+ reload: function () {
1486
+ return this.relationship.reload();
1487
+ },
1488
+
1489
+ /**
1490
+ Saves all of the records in the `ManyArray`.
1491
+ Example
1492
+ ```javascript
1493
+ store.findRecord('inbox', 1).then(function(inbox) {
1494
+ inbox.get('messages').then(function(messages) {
1495
+ messages.forEach(function(message) {
1496
+ message.set('isRead', true);
1497
+ });
1498
+ messages.save()
1640
1499
  });
1641
- };
1500
+ });
1501
+ ```
1502
+ @method save
1503
+ @return {DS.PromiseArray} promise
1504
+ */
1505
+ save: function () {
1506
+ var manyArray = this;
1507
+ var promiseLabel = "DS: ManyArray#save " + get(this, 'type');
1508
+ var promise = _ember.default.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
1509
+ return manyArray;
1510
+ }, null, "DS: ManyArray#save return ManyArray");
1642
1511
 
1643
- return release;
1644
- }
1645
- });
1646
- });
1647
- /**
1648
- @module ember-data
1649
- */
1650
- define('ember-data/-private/system/debug/debug-info', ['exports', 'ember'], function (exports, _ember) {
1651
- exports.default = _ember.default.Mixin.create({
1512
+ return _emberDataPrivateSystemPromiseProxies.PromiseArray.create({ promise: promise });
1513
+ },
1652
1514
 
1653
1515
  /**
1654
- Provides info about the model for debugging purposes
1655
- by grouping the properties into more semantic groups.
1656
- Meant to be used by debugging tools such as the Chrome Ember Extension.
1657
- - Groups all attributes in "Attributes" group.
1658
- - Groups all belongsTo relationships in "Belongs To" group.
1659
- - Groups all hasMany relationships in "Has Many" group.
1660
- - Groups all flags in "Flags" group.
1661
- - Flags relationship CPs as expensive properties.
1662
- @method _debugInfo
1663
- @for DS.Model
1516
+ Create a child record within the owner
1517
+ @method createRecord
1664
1518
  @private
1519
+ @param {Object} hash
1520
+ @return {DS.Model} record
1665
1521
  */
1666
- _debugInfo: function () {
1667
- var attributes = ['id'];
1668
- var relationships = { belongsTo: [], hasMany: [] };
1669
- var expensiveProperties = [];
1670
-
1671
- this.eachAttribute(function (name, meta) {
1672
- return attributes.push(name);
1673
- });
1674
-
1675
- this.eachRelationship(function (name, relationship) {
1676
- relationships[relationship.kind].push(name);
1677
- expensiveProperties.push(name);
1678
- });
1522
+ createRecord: function (hash) {
1523
+ var store = get(this, 'store');
1524
+ var type = get(this, 'type');
1525
+ var record;
1679
1526
 
1680
- var groups = [{
1681
- name: 'Attributes',
1682
- properties: attributes,
1683
- expand: true
1684
- }, {
1685
- name: 'Belongs To',
1686
- properties: relationships.belongsTo,
1687
- expand: true
1688
- }, {
1689
- name: 'Has Many',
1690
- properties: relationships.hasMany,
1691
- expand: true
1692
- }, {
1693
- name: 'Flags',
1694
- properties: ['isLoaded', 'hasDirtyAttributes', 'isSaving', 'isDeleted', 'isError', 'isNew', 'isValid']
1695
- }];
1527
+ record = store.createRecord(type.modelName, hash);
1528
+ this.pushObject(record);
1696
1529
 
1697
- return {
1698
- propertyInfo: {
1699
- // include all other mixins / properties (not just the grouped ones)
1700
- includeOtherProperties: true,
1701
- groups: groups,
1702
- // don't pre-calculate unless cached
1703
- expensiveProperties: expensiveProperties
1704
- }
1705
- };
1530
+ return record;
1706
1531
  }
1707
1532
  });
1708
1533
  });
1709
- define("ember-data/-private/system/empty-object", ["exports"], function (exports) {
1710
- exports.default = EmptyObject;
1711
- // This exists because `Object.create(null)` is absurdly slow compared
1712
- // to `new EmptyObject()`. In either case, you want a null prototype
1713
- // when you're treating the object instances as arbitrary dictionaries
1714
- // and don't want your keys colliding with build-in methods on the
1715
- // default object prototype.
1716
- var proto = Object.create(null, {
1717
- // without this, we will always still end up with (new
1718
- // EmptyObject()).constructor === Object
1719
- constructor: {
1720
- value: undefined,
1721
- enumerable: false,
1722
- writable: true
1723
- }
1724
- });
1725
-
1726
- function EmptyObject() {}
1534
+ /**
1535
+ @module ember-data
1536
+ */
1537
+ define('ember-data/-private/system/merge', ['exports'], function (exports) {
1538
+ exports.default = merge;
1727
1539
 
1728
- EmptyObject.prototype = proto;
1729
- });
1730
- define('ember-data/-private/system/is-array-like', ['exports', 'ember'], function (exports, _ember) {
1731
- exports.default = isArrayLike;
1540
+ function merge(original, updates) {
1541
+ if (!updates || typeof updates !== 'object') {
1542
+ return original;
1543
+ }
1732
1544
 
1733
- /*
1734
- We're using this to detect arrays and "array-like" objects.
1735
-
1736
- This is a copy of the `isArray` method found in `ember-runtime/utils` as we're
1737
- currently unable to import non-exposed modules.
1738
-
1739
- This method was previously exposed as `Ember.isArray` but since
1740
- https://github.com/emberjs/ember.js/pull/11463 `Ember.isArray` is an alias of
1741
- `Array.isArray` hence removing the "array-like" part.
1742
- */
1545
+ var props = Object.keys(updates);
1546
+ var prop;
1547
+ var length = props.length;
1743
1548
 
1744
- function isArrayLike(obj) {
1745
- if (!obj || obj.setInterval) {
1746
- return false;
1747
- }
1748
- if (Array.isArray(obj)) {
1749
- return true;
1750
- }
1751
- if (_ember.default.Array.detect(obj)) {
1752
- return true;
1549
+ for (var i = 0; i < length; i++) {
1550
+ prop = props[i];
1551
+ original[prop] = updates[prop];
1753
1552
  }
1754
1553
 
1755
- var type = _ember.default.typeOf(obj);
1756
- if ('array' === type) {
1757
- return true;
1758
- }
1759
- if (obj.length !== undefined && 'object' === type) {
1760
- return true;
1761
- }
1762
- return false;
1554
+ return original;
1763
1555
  }
1764
1556
  });
1765
- define("ember-data/-private/system/many-array", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies) {
1557
+ define("ember-data/-private/system/model", ["exports", "ember-data/-private/system/model/model", "ember-data/attr", "ember-data/-private/system/model/states", "ember-data/-private/system/model/errors"], function (exports, _emberDataPrivateSystemModelModel, _emberDataAttr, _emberDataPrivateSystemModelStates, _emberDataPrivateSystemModelErrors) {
1558
+ exports.RootState = _emberDataPrivateSystemModelStates.default;
1559
+ exports.attr = _emberDataAttr.default;
1560
+ exports.Errors = _emberDataPrivateSystemModelErrors.default;
1561
+ exports.default = _emberDataPrivateSystemModelModel.default;
1562
+ });
1563
+ /**
1564
+ @module ember-data
1565
+ */
1566
+ define("ember-data/-private/system/model/attr", ["exports", "ember", "ember-data/-private/debug"], function (exports, _ember, _emberDataPrivateDebug) {
1766
1567
 
1767
1568
  var get = _ember.default.get;
1768
- var set = _ember.default.set;
1569
+ var Map = _ember.default.Map;
1769
1570
 
1770
1571
  /**
1771
- A `ManyArray` is a `MutableArray` that represents the contents of a has-many
1772
- relationship.
1773
-
1774
- The `ManyArray` is instantiated lazily the first time the relationship is
1775
- requested.
1776
-
1777
- ### Inverses
1778
-
1779
- Often, the relationships in Ember Data applications will have
1780
- an inverse. For example, imagine the following models are
1781
- defined:
1782
-
1783
- ```app/models/post.js
1784
- import DS from 'ember-data';
1785
-
1786
- export default DS.Model.extend({
1787
- comments: DS.hasMany('comment')
1788
- });
1789
- ```
1790
-
1791
- ```app/models/comment.js
1792
- import DS from 'ember-data';
1793
-
1794
- export default DS.Model.extend({
1795
- post: DS.belongsTo('post')
1796
- });
1797
- ```
1798
-
1799
- If you created a new instance of `App.Post` and added
1800
- a `App.Comment` record to its `comments` has-many
1801
- relationship, you would expect the comment's `post`
1802
- property to be set to the post that contained
1803
- the has-many.
1804
-
1805
- We call the record to which a relationship belongs the
1806
- relationship's _owner_.
1807
-
1808
- @class ManyArray
1809
- @namespace DS
1810
- @extends Ember.Object
1811
- @uses Ember.MutableArray, Ember.Evented
1572
+ @module ember-data
1812
1573
  */
1813
- exports.default = _ember.default.Object.extend(_ember.default.MutableArray, _ember.default.Evented, {
1814
- init: function () {
1815
- this._super.apply(this, arguments);
1816
- this.currentState = _ember.default.A([]);
1817
- },
1818
-
1819
- record: null,
1820
-
1821
- canonicalState: null,
1822
- currentState: null,
1823
-
1824
- length: 0,
1825
1574
 
1826
- objectAt: function (index) {
1827
- //Ember observers such as 'firstObject', 'lastObject' might do out of bounds accesses
1828
- if (!this.currentState[index]) {
1829
- return undefined;
1830
- }
1831
- return this.currentState[index].getRecord();
1832
- },
1575
+ /**
1576
+ @class Model
1577
+ @namespace DS
1578
+ */
1833
1579
 
1834
- flushCanonical: function () {
1835
- //TODO make this smarter, currently its plenty stupid
1836
- var toSet = this.canonicalState.filter(function (internalModel) {
1837
- return !internalModel.isDeleted();
1580
+ var AttrClassMethodsMixin = _ember.default.Mixin.create({
1581
+ /**
1582
+ A map whose keys are the attributes of the model (properties
1583
+ described by DS.attr) and whose values are the meta object for the
1584
+ property.
1585
+ Example
1586
+ ```app/models/person.js
1587
+ import DS from 'ember-data';
1588
+ export default DS.Model.extend({
1589
+ firstName: attr('string'),
1590
+ lastName: attr('string'),
1591
+ birthday: attr('date')
1838
1592
  });
1839
-
1840
- //a hack for not removing new records
1841
- //TODO remove once we have proper diffing
1842
- var newRecords = this.currentState.filter(function (internalModel) {
1843
- return internalModel.isNew();
1593
+ ```
1594
+ ```javascript
1595
+ import Ember from 'ember';
1596
+ import Person from 'app/models/person';
1597
+ var attributes = Ember.get(Person, 'attributes')
1598
+ attributes.forEach(function(meta, name) {
1599
+ console.log(name, meta);
1844
1600
  });
1845
- toSet = toSet.concat(newRecords);
1846
- var oldLength = this.length;
1847
- this.arrayContentWillChange(0, this.length, toSet.length);
1848
- this.set('length', toSet.length);
1849
- this.currentState = toSet;
1850
- this.arrayContentDidChange(0, oldLength, this.length);
1851
- //TODO Figure out to notify only on additions and maybe only if unloaded
1852
- this.relationship.notifyHasManyChanged();
1853
- this.record.updateRecordArrays();
1854
- },
1855
- /**
1856
- `true` if the relationship is polymorphic, `false` otherwise.
1857
- @property {Boolean} isPolymorphic
1858
- @private
1601
+ // prints:
1602
+ // firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
1603
+ // lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
1604
+ // birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
1605
+ ```
1606
+ @property attributes
1607
+ @static
1608
+ @type {Ember.Map}
1609
+ @readOnly
1859
1610
  */
1860
- isPolymorphic: false,
1611
+ attributes: _ember.default.computed(function () {
1612
+ var map = Map.create();
1861
1613
 
1862
- /**
1863
- The loading state of this array
1864
- @property {Boolean} isLoaded
1865
- */
1866
- isLoaded: false,
1614
+ this.eachComputedProperty(function (name, meta) {
1615
+ if (meta.isAttribute) {
1867
1616
 
1868
- /**
1869
- The relationship which manages this array.
1870
- @property {ManyRelationship} relationship
1871
- @private
1872
- */
1873
- relationship: null,
1617
+ meta.name = name;
1618
+ map.set(name, meta);
1619
+ }
1620
+ });
1621
+
1622
+ return map;
1623
+ }).readOnly(),
1874
1624
 
1875
1625
  /**
1876
- Metadata associated with the request for async hasMany relationships.
1626
+ A map whose keys are the attributes of the model (properties
1627
+ described by DS.attr) and whose values are type of transformation
1628
+ applied to each attribute. This map does not include any
1629
+ attributes that do not have an transformation type.
1877
1630
  Example
1878
- Given that the server returns the following JSON payload when fetching a
1879
- hasMany relationship:
1880
- ```js
1881
- {
1882
- "comments": [{
1883
- "id": 1,
1884
- "comment": "This is the first comment",
1885
- }, {
1886
- // ...
1887
- }],
1888
- "meta": {
1889
- "page": 1,
1890
- "total": 5
1891
- }
1892
- }
1631
+ ```app/models/person.js
1632
+ import DS from 'ember-data';
1633
+ export default DS.Model.extend({
1634
+ firstName: attr(),
1635
+ lastName: attr('string'),
1636
+ birthday: attr('date')
1637
+ });
1893
1638
  ```
1894
- You can then access the metadata via the `meta` property:
1895
- ```js
1896
- post.get('comments').then(function(comments) {
1897
- var meta = comments.get('meta');
1898
- // meta.page => 1
1899
- // meta.total => 5
1639
+ ```javascript
1640
+ import Ember from 'ember';
1641
+ import Person from 'app/models/person';
1642
+ var transformedAttributes = Ember.get(Person, 'transformedAttributes')
1643
+ transformedAttributes.forEach(function(field, type) {
1644
+ console.log(field, type);
1900
1645
  });
1646
+ // prints:
1647
+ // lastName string
1648
+ // birthday date
1901
1649
  ```
1902
- @property {Object} meta
1903
- @public
1650
+ @property transformedAttributes
1651
+ @static
1652
+ @type {Ember.Map}
1653
+ @readOnly
1904
1654
  */
1905
- meta: null,
1655
+ transformedAttributes: _ember.default.computed(function () {
1656
+ var map = Map.create();
1906
1657
 
1907
- internalReplace: function (idx, amt, objects) {
1908
- if (!objects) {
1909
- objects = [];
1910
- }
1911
- this.arrayContentWillChange(idx, amt, objects.length);
1912
- this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
1913
- this.set('length', this.currentState.length);
1914
- this.arrayContentDidChange(idx, amt, objects.length);
1915
- if (objects) {
1916
- //TODO(Igor) probably needed only for unloaded records
1917
- this.relationship.notifyHasManyChanged();
1918
- }
1919
- this.record.updateRecordArrays();
1920
- },
1658
+ this.eachAttribute(function (key, meta) {
1659
+ if (meta.type) {
1660
+ map.set(key, meta.type);
1661
+ }
1662
+ });
1921
1663
 
1922
- //TODO(Igor) optimize
1923
- internalRemoveRecords: function (records) {
1924
- var index;
1925
- for (var i = 0; i < records.length; i++) {
1926
- index = this.currentState.indexOf(records[i]);
1927
- this.internalReplace(index, 1);
1928
- }
1929
- },
1664
+ return map;
1665
+ }).readOnly(),
1930
1666
 
1931
- //TODO(Igor) optimize
1932
- internalAddRecords: function (records, idx) {
1933
- if (idx === undefined) {
1934
- idx = this.currentState.length;
1935
- }
1936
- this.internalReplace(idx, 0, records);
1667
+ /**
1668
+ Iterates through the attributes of the model, calling the passed function on each
1669
+ attribute.
1670
+ The callback method you provide should have the following signature (all
1671
+ parameters are optional):
1672
+ ```javascript
1673
+ function(name, meta);
1674
+ ```
1675
+ - `name` the name of the current property in the iteration
1676
+ - `meta` the meta object for the attribute property in the iteration
1677
+ Note that in addition to a callback, you can also pass an optional target
1678
+ object that will be set as `this` on the context.
1679
+ Example
1680
+ ```javascript
1681
+ import DS from 'ember-data';
1682
+ var Person = DS.Model.extend({
1683
+ firstName: attr('string'),
1684
+ lastName: attr('string'),
1685
+ birthday: attr('date')
1686
+ });
1687
+ Person.eachAttribute(function(name, meta) {
1688
+ console.log(name, meta);
1689
+ });
1690
+ // prints:
1691
+ // firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
1692
+ // lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
1693
+ // birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
1694
+ ```
1695
+ @method eachAttribute
1696
+ @param {Function} callback The callback to execute
1697
+ @param {Object} [binding] the value to which the callback's `this` should be bound
1698
+ @static
1699
+ */
1700
+ eachAttribute: function (callback, binding) {
1701
+ get(this, 'attributes').forEach(function (meta, name) {
1702
+ callback.call(binding, name, meta);
1703
+ });
1937
1704
  },
1938
1705
 
1939
- replace: function (idx, amt, objects) {
1940
- var records;
1941
- if (amt > 0) {
1942
- records = this.currentState.slice(idx, idx + amt);
1943
- this.get('relationship').removeRecords(records);
1944
- }
1945
- if (objects) {
1946
- this.get('relationship').addRecords(objects.map(function (obj) {
1947
- return obj._internalModel;
1948
- }), idx);
1949
- }
1950
- },
1951
- /**
1952
- Used for async `hasMany` arrays
1953
- to keep track of when they will resolve.
1954
- @property {Ember.RSVP.Promise} promise
1955
- @private
1956
- */
1957
- promise: null,
1958
-
1959
- /**
1960
- @method loadingRecordsCount
1961
- @param {Number} count
1962
- @private
1963
- */
1964
- loadingRecordsCount: function (count) {
1965
- this.loadingRecordsCount = count;
1966
- },
1967
-
1968
- /**
1969
- @method loadedRecord
1970
- @private
1971
- */
1972
- loadedRecord: function () {
1973
- this.loadingRecordsCount--;
1974
- if (this.loadingRecordsCount === 0) {
1975
- set(this, 'isLoaded', true);
1976
- this.trigger('didLoad');
1977
- }
1978
- },
1979
-
1980
- /**
1981
- @method reload
1982
- @public
1983
- */
1984
- reload: function () {
1985
- return this.relationship.reload();
1986
- },
1987
-
1988
- /**
1989
- Saves all of the records in the `ManyArray`.
1990
- Example
1991
- ```javascript
1992
- store.findRecord('inbox', 1).then(function(inbox) {
1993
- inbox.get('messages').then(function(messages) {
1994
- messages.forEach(function(message) {
1995
- message.set('isRead', true);
1996
- });
1997
- messages.save()
1998
- });
1999
- });
2000
- ```
2001
- @method save
2002
- @return {DS.PromiseArray} promise
2003
- */
2004
- save: function () {
2005
- var manyArray = this;
2006
- var promiseLabel = "DS: ManyArray#save " + get(this, 'type');
2007
- var promise = _ember.default.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
2008
- return manyArray;
2009
- }, null, "DS: ManyArray#save return ManyArray");
2010
-
2011
- return _emberDataPrivateSystemPromiseProxies.PromiseArray.create({ promise: promise });
2012
- },
2013
-
2014
- /**
2015
- Create a child record within the owner
2016
- @method createRecord
2017
- @private
2018
- @param {Object} hash
2019
- @return {DS.Model} record
2020
- */
2021
- createRecord: function (hash) {
2022
- var store = get(this, 'store');
2023
- var type = get(this, 'type');
2024
- var record;
2025
-
2026
- record = store.createRecord(type.modelName, hash);
2027
- this.pushObject(record);
2028
-
2029
- return record;
2030
- }
2031
- });
2032
- });
2033
- /**
2034
- @module ember-data
2035
- */
2036
- define('ember-data/-private/system/merge', ['exports'], function (exports) {
2037
- exports.default = merge;
2038
-
2039
- function merge(original, updates) {
2040
- if (!updates || typeof updates !== 'object') {
2041
- return original;
2042
- }
2043
-
2044
- var props = Object.keys(updates);
2045
- var prop;
2046
- var length = props.length;
2047
-
2048
- for (var i = 0; i < length; i++) {
2049
- prop = props[i];
2050
- original[prop] = updates[prop];
2051
- }
2052
-
2053
- return original;
2054
- }
2055
- });
2056
- define("ember-data/-private/system/model", ["exports", "ember-data/-private/system/model/model", "ember-data/attr", "ember-data/-private/system/model/states", "ember-data/-private/system/model/errors"], function (exports, _emberDataPrivateSystemModelModel, _emberDataAttr, _emberDataPrivateSystemModelStates, _emberDataPrivateSystemModelErrors) {
2057
- exports.RootState = _emberDataPrivateSystemModelStates.default;
2058
- exports.attr = _emberDataAttr.default;
2059
- exports.Errors = _emberDataPrivateSystemModelErrors.default;
2060
- exports.default = _emberDataPrivateSystemModelModel.default;
2061
- });
2062
- /**
2063
- @module ember-data
2064
- */
2065
- define("ember-data/-private/system/model/attr", ["exports", "ember", "ember-data/-private/debug"], function (exports, _ember, _emberDataPrivateDebug) {
2066
-
2067
- var get = _ember.default.get;
2068
- var Map = _ember.default.Map;
2069
-
2070
- /**
2071
- @module ember-data
2072
- */
2073
-
2074
- /**
2075
- @class Model
2076
- @namespace DS
2077
- */
2078
-
2079
- var AttrClassMethodsMixin = _ember.default.Mixin.create({
2080
- /**
2081
- A map whose keys are the attributes of the model (properties
2082
- described by DS.attr) and whose values are the meta object for the
2083
- property.
2084
- Example
2085
- ```app/models/person.js
2086
- import DS from 'ember-data';
2087
- export default DS.Model.extend({
2088
- firstName: attr('string'),
2089
- lastName: attr('string'),
2090
- birthday: attr('date')
2091
- });
2092
- ```
2093
- ```javascript
2094
- import Ember from 'ember';
2095
- import Person from 'app/models/person';
2096
- var attributes = Ember.get(Person, 'attributes')
2097
- attributes.forEach(function(meta, name) {
2098
- console.log(name, meta);
2099
- });
2100
- // prints:
2101
- // firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
2102
- // lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
2103
- // birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
2104
- ```
2105
- @property attributes
2106
- @static
2107
- @type {Ember.Map}
2108
- @readOnly
2109
- */
2110
- attributes: _ember.default.computed(function () {
2111
- var map = Map.create();
2112
-
2113
- this.eachComputedProperty(function (name, meta) {
2114
- if (meta.isAttribute) {
2115
-
2116
- meta.name = name;
2117
- map.set(name, meta);
2118
- }
2119
- });
2120
-
2121
- return map;
2122
- }).readOnly(),
2123
-
2124
- /**
2125
- A map whose keys are the attributes of the model (properties
2126
- described by DS.attr) and whose values are type of transformation
2127
- applied to each attribute. This map does not include any
2128
- attributes that do not have an transformation type.
2129
- Example
2130
- ```app/models/person.js
2131
- import DS from 'ember-data';
2132
- export default DS.Model.extend({
2133
- firstName: attr(),
2134
- lastName: attr('string'),
2135
- birthday: attr('date')
2136
- });
2137
- ```
2138
- ```javascript
2139
- import Ember from 'ember';
2140
- import Person from 'app/models/person';
2141
- var transformedAttributes = Ember.get(Person, 'transformedAttributes')
2142
- transformedAttributes.forEach(function(field, type) {
2143
- console.log(field, type);
2144
- });
2145
- // prints:
2146
- // lastName string
2147
- // birthday date
2148
- ```
2149
- @property transformedAttributes
2150
- @static
2151
- @type {Ember.Map}
2152
- @readOnly
2153
- */
2154
- transformedAttributes: _ember.default.computed(function () {
2155
- var map = Map.create();
2156
-
2157
- this.eachAttribute(function (key, meta) {
2158
- if (meta.type) {
2159
- map.set(key, meta.type);
2160
- }
2161
- });
2162
-
2163
- return map;
2164
- }).readOnly(),
2165
-
2166
1706
  /**
2167
- Iterates through the attributes of the model, calling the passed function on each
2168
- attribute.
1707
+ Iterates through the transformedAttributes of the model, calling
1708
+ the passed function on each attribute. Note the callback will not be
1709
+ called for any attributes that do not have an transformation type.
2169
1710
  The callback method you provide should have the following signature (all
2170
1711
  parameters are optional):
2171
1712
  ```javascript
2172
- function(name, meta);
1713
+ function(name, type);
2173
1714
  ```
2174
1715
  - `name` the name of the current property in the iteration
2175
- - `meta` the meta object for the attribute property in the iteration
1716
+ - `type` a string containing the name of the type of transformed
1717
+ applied to the attribute
2176
1718
  Note that in addition to a callback, you can also pass an optional target
2177
1719
  object that will be set as `this` on the context.
2178
1720
  Example
2179
1721
  ```javascript
2180
1722
  import DS from 'ember-data';
2181
1723
  var Person = DS.Model.extend({
2182
- firstName: attr('string'),
1724
+ firstName: attr(),
2183
1725
  lastName: attr('string'),
2184
1726
  birthday: attr('date')
2185
1727
  });
2186
- Person.eachAttribute(function(name, meta) {
2187
- console.log(name, meta);
1728
+ Person.eachTransformedAttribute(function(name, type) {
1729
+ console.log(name, type);
2188
1730
  });
2189
1731
  // prints:
2190
- // firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
2191
- // lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
2192
- // birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
1732
+ // lastName string
1733
+ // birthday date
2193
1734
  ```
2194
- @method eachAttribute
1735
+ @method eachTransformedAttribute
2195
1736
  @param {Function} callback The callback to execute
2196
1737
  @param {Object} [binding] the value to which the callback's `this` should be bound
2197
1738
  @static
2198
1739
  */
2199
- eachAttribute: function (callback, binding) {
2200
- get(this, 'attributes').forEach(function (meta, name) {
2201
- callback.call(binding, name, meta);
1740
+ eachTransformedAttribute: function (callback, binding) {
1741
+ get(this, 'transformedAttributes').forEach(function (type, name) {
1742
+ callback.call(binding, name, type);
2202
1743
  });
2203
- },
2204
-
2205
- /**
2206
- Iterates through the transformedAttributes of the model, calling
2207
- the passed function on each attribute. Note the callback will not be
2208
- called for any attributes that do not have an transformation type.
2209
- The callback method you provide should have the following signature (all
2210
- parameters are optional):
2211
- ```javascript
2212
- function(name, type);
2213
- ```
2214
- - `name` the name of the current property in the iteration
2215
- - `type` a string containing the name of the type of transformed
2216
- applied to the attribute
2217
- Note that in addition to a callback, you can also pass an optional target
2218
- object that will be set as `this` on the context.
2219
- Example
2220
- ```javascript
2221
- import DS from 'ember-data';
2222
- var Person = DS.Model.extend({
2223
- firstName: attr(),
2224
- lastName: attr('string'),
2225
- birthday: attr('date')
2226
- });
2227
- Person.eachTransformedAttribute(function(name, type) {
2228
- console.log(name, type);
2229
- });
2230
- // prints:
2231
- // lastName string
2232
- // birthday date
2233
- ```
2234
- @method eachTransformedAttribute
2235
- @param {Function} callback The callback to execute
2236
- @param {Object} [binding] the value to which the callback's `this` should be bound
2237
- @static
2238
- */
2239
- eachTransformedAttribute: function (callback, binding) {
2240
- get(this, 'transformedAttributes').forEach(function (type, name) {
2241
- callback.call(binding, name, type);
2242
- });
2243
- }
2244
- });
1744
+ }
1745
+ });
2245
1746
 
2246
1747
  exports.AttrClassMethodsMixin = AttrClassMethodsMixin;
2247
1748
  var AttrInstanceMethodsMixin = _ember.default.Mixin.create({
@@ -2348,6 +1849,33 @@ define('ember-data/-private/system/model/errors', ['exports', 'ember', 'ember-da
2348
1849
  {{/each}}
2349
1850
  ```
2350
1851
 
1852
+ The JSON API spec also allows for object level errors to be placed
1853
+ in an object with pointer `data`.
1854
+
1855
+ ```javascript
1856
+ {
1857
+ "errors": [
1858
+ {
1859
+ "detail": "Some generic non property error message",
1860
+ "source": {
1861
+ "pointer": "data"
1862
+ }
1863
+ }
1864
+ ]
1865
+ }
1866
+ ```
1867
+
1868
+ You can access these errors by using the `base` property on the errors
1869
+ object.
1870
+
1871
+ ```handlebars
1872
+ {{#each model.errors.base as |error|}}
1873
+ <div class="error">
1874
+ {{error.message}}
1875
+ </div>
1876
+ {{/each}}
1877
+ ```
1878
+
2351
1879
  @class Errors
2352
1880
  @namespace DS
2353
1881
  @extends Ember.Object
@@ -7172,7 +6700,6 @@ define("ember-data/-private/system/relationships/has-many", ["exports", "ember",
7172
6700
  return relationship.getRecords();
7173
6701
  },
7174
6702
  set: function (key, records) {
7175
- var Model = require('ember-data/model').default;
7176
6703
 
7177
6704
  var relationship = this._internalModel._relationships.get(key);
7178
6705
  relationship.clear();
@@ -7891,86 +7418,6 @@ define("ember-data/-private/system/relationships/state/relationship", ["exports"
7891
7418
  }
7892
7419
  };
7893
7420
  });
7894
- define('ember-data/-private/system/serializer', ['exports', 'ember'], function (exports, _ember) {
7895
-
7896
- /**
7897
- `DS.Serializer` is an abstract base class that you should override in your
7898
- application to customize it for your backend. The minimum set of methods
7899
- that you should implement is:
7900
-
7901
- * `normalizeResponse()`
7902
- * `serialize()`
7903
-
7904
- And you can optionally override the following methods:
7905
-
7906
- * `normalize()`
7907
-
7908
- For an example implementation, see
7909
- [DS.JSONSerializer](DS.JSONSerializer.html), the included JSON serializer.
7910
-
7911
- @class Serializer
7912
- @namespace DS
7913
- @extends Ember.Object
7914
- */
7915
-
7916
- exports.default = _ember.default.Object.extend({
7917
-
7918
- /**
7919
- The `store` property is the application's `store` that contains all records.
7920
- It's injected as a service.
7921
- It can be used to push records from a non flat data structure server
7922
- response.
7923
- @property store
7924
- @type {DS.Store}
7925
- @public
7926
- */
7927
-
7928
- /**
7929
- The `normalizeResponse` method is used to normalize a payload from the
7930
- server to a JSON-API Document.
7931
- http://jsonapi.org/format/#document-structure
7932
- @method normalizeResponse
7933
- @param {DS.Store} store
7934
- @param {DS.Model} primaryModelClass
7935
- @param {Object} payload
7936
- @param {String|Number} id
7937
- @param {String} requestType
7938
- @return {Object} JSON-API Document
7939
- */
7940
- normalizeResponse: null,
7941
-
7942
- /**
7943
- The `serialize` method is used when a record is saved in order to convert
7944
- the record into the form that your external data source expects.
7945
- `serialize` takes an optional `options` hash with a single option:
7946
- - `includeId`: If this is `true`, `serialize` should include the ID
7947
- in the serialized object it builds.
7948
- @method serialize
7949
- @param {DS.Model} record
7950
- @param {Object} [options]
7951
- @return {Object}
7952
- */
7953
- serialize: null,
7954
-
7955
- /**
7956
- The `normalize` method is used to convert a payload received from your
7957
- external data source into the normalized form `store.push()` expects. You
7958
- should override this method, munge the hash and return the normalized
7959
- payload.
7960
- @method normalize
7961
- @param {DS.Model} typeClass
7962
- @param {Object} hash
7963
- @return {Object}
7964
- */
7965
- normalize: function (typeClass, hash) {
7966
- return hash;
7967
- }
7968
-
7969
- });
7970
- });
7971
- /**
7972
- @module ember-data
7973
- */
7974
7421
  define('ember-data/-private/system/snapshot-record-array', ['exports', 'ember-data/-private/features'], function (exports, _emberDataPrivateFeatures) {
7975
7422
  exports.default = SnapshotRecordArray;
7976
7423
 
@@ -10965,6 +10412,42 @@ define('ember-data/-private/utils', ['exports', 'ember', 'ember-data/-private/de
10965
10412
  exports.modelHasAttributeOrRelationshipNamedType = modelHasAttributeOrRelationshipNamedType;
10966
10413
  exports.getOwner = getOwner;
10967
10414
  });
10415
+ define('ember-data/-private/utils/parse-response-headers', ['exports', 'ember-data/-private/system/empty-object'], function (exports, _emberDataPrivateSystemEmptyObject) {
10416
+ exports.default = parseResponseHeaders;
10417
+
10418
+ function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
10419
+
10420
+ var CLRF = '\u000d\u000a';
10421
+
10422
+ function parseResponseHeaders(headersString) {
10423
+ var headers = new _emberDataPrivateSystemEmptyObject.default();
10424
+
10425
+ if (!headersString) {
10426
+ return headers;
10427
+ }
10428
+
10429
+ var headerPairs = headersString.split(CLRF);
10430
+
10431
+ headerPairs.forEach(function (header) {
10432
+ var _header$split = header.split(':');
10433
+
10434
+ var _header$split2 = _toArray(_header$split);
10435
+
10436
+ var field = _header$split2[0];
10437
+
10438
+ var value = _header$split2.slice(1);
10439
+
10440
+ field = field.trim();
10441
+ value = value.join(':').trim();
10442
+
10443
+ if (value) {
10444
+ headers[field] = value;
10445
+ }
10446
+ });
10447
+
10448
+ return headers;
10449
+ }
10450
+ });
10968
10451
  define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) {
10969
10452
  var get = _ember.default.get;
10970
10453
 
@@ -11557,7 +11040,7 @@ define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-data/adapters
11557
11040
  /**
11558
11041
  @module ember-data
11559
11042
  */
11560
- define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'ember-data/-private/adapters/errors', 'ember-data/-private/system/empty-object', 'ember-data/-private/adapters/build-url-mixin', 'ember-data/-private/features'], function (exports, _ember, _emberDataAdapter, _emberDataPrivateAdaptersErrors, _emberDataPrivateSystemEmptyObject, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateFeatures) {
11043
+ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'ember-data/-private/adapters/errors', 'ember-data/-private/adapters/build-url-mixin', 'ember-data/-private/features', 'ember-data/-private/utils/parse-response-headers'], function (exports, _ember, _emberDataAdapter, _emberDataPrivateAdaptersErrors, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateFeatures, _emberDataPrivateUtilsParseResponseHeaders) {
11561
11044
  var MapWithDefault = _ember.default.MapWithDefault;
11562
11045
  var get = _ember.default.get;
11563
11046
 
@@ -12301,7 +11784,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
12301
11784
 
12302
11785
  hash.success = function (payload, textStatus, jqXHR) {
12303
11786
 
12304
- var response = adapter.handleResponse(jqXHR.status, parseResponseHeaders(jqXHR.getAllResponseHeaders()), payload, requestData);
11787
+ var response = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), payload, requestData);
12305
11788
 
12306
11789
  if (response && response.isAdapterError) {
12307
11790
  _ember.default.run.join(null, reject, response);
@@ -12320,7 +11803,7 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
12320
11803
  } else if (textStatus === 'abort') {
12321
11804
  error = new _emberDataPrivateAdaptersErrors.AbortError();
12322
11805
  } else {
12323
- error = adapter.handleResponse(jqXHR.status, parseResponseHeaders(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || errorThrown, requestData);
11806
+ error = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || errorThrown, requestData);
12324
11807
  }
12325
11808
 
12326
11809
  _ember.default.run.join(null, reject, error);
@@ -12442,28 +11925,6 @@ define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'e
12442
11925
  }
12443
11926
  });
12444
11927
 
12445
- function parseResponseHeaders(headerStr) {
12446
- var headers = new _emberDataPrivateSystemEmptyObject.default();
12447
- if (!headerStr) {
12448
- return headers;
12449
- }
12450
-
12451
- var headerPairs = headerStr.split('\u000d\u000a');
12452
- for (var i = 0; i < headerPairs.length; i++) {
12453
- var headerPair = headerPairs[i];
12454
- // Can't use split() here because it does the wrong thing
12455
- // if the header value has the string ": " in it.
12456
- var index = headerPair.indexOf('\u003a\u0020');
12457
- if (index > 0) {
12458
- var key = headerPair.substring(0, index);
12459
- var val = headerPair.substring(index + 2);
12460
- headers[key] = val;
12461
- }
12462
- }
12463
-
12464
- return headers;
12465
- }
12466
-
12467
11928
  //From http://stackoverflow.com/questions/280634/endswith-in-javascript
12468
11929
  function endsWith(string, suffix) {
12469
11930
  if (typeof String.prototype.endsWith !== 'function') {
@@ -12566,139 +12027,725 @@ define("ember-data/attr", ["exports", "ember", "ember-data/-private/debug"], fun
12566
12027
  options = options || {};
12567
12028
  }
12568
12029
 
12569
- var meta = {
12570
- type: type,
12571
- isAttribute: true,
12572
- options: options
12573
- };
12030
+ var meta = {
12031
+ type: type,
12032
+ isAttribute: true,
12033
+ options: options
12034
+ };
12035
+
12036
+ return _ember.default.computed({
12037
+ get: function (key) {
12038
+ var internalModel = this._internalModel;
12039
+ if (hasValue(internalModel, key)) {
12040
+ return getValue(internalModel, key);
12041
+ } else {
12042
+ return getDefaultValue(this, options, key);
12043
+ }
12044
+ },
12045
+ set: function (key, value) {
12046
+ var internalModel = this._internalModel;
12047
+ var oldValue = getValue(internalModel, key);
12048
+
12049
+ if (value !== oldValue) {
12050
+ // Add the new value to the changed attributes hash; it will get deleted by
12051
+ // the 'didSetProperty' handler if it is no different from the original value
12052
+ internalModel._attributes[key] = value;
12053
+
12054
+ this._internalModel.send('didSetProperty', {
12055
+ name: key,
12056
+ oldValue: oldValue,
12057
+ originalValue: internalModel._data[key],
12058
+ value: value
12059
+ });
12060
+ }
12061
+
12062
+ return value;
12063
+ }
12064
+ }).meta(meta);
12065
+ }
12066
+ });
12067
+ define("ember-data", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/core", "ember-data/-private/system/normalize-model-name", "ember-data/-private/system/model/internal-model", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store", "ember-data/-private/system/model", "ember-data/model", "ember-data/-private/system/snapshot", "ember-data/adapter", "ember-data/serializer", "ember-data/-private/system/debug", "ember-data/-private/adapters/errors", "ember-data/-private/system/record-arrays", "ember-data/-private/system/many-array", "ember-data/-private/system/record-array-manager", "ember-data/-private/adapters", "ember-data/-private/adapters/build-url-mixin", "ember-data/-private/serializers", "ember-inflector", "ember-data/serializers/embedded-records-mixin", "ember-data/-private/transforms", "ember-data/relationships", "ember-data/setup-container", "ember-data/-private/instance-initializers/initialize-store-service", "ember-data/-private/system/container-proxy", "ember-data/-private/system/relationships/state/relationship"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateCore, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateSystemModelInternalModel, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStore, _emberDataPrivateSystemModel, _emberDataModel, _emberDataPrivateSystemSnapshot, _emberDataAdapter, _emberDataSerializer, _emberDataPrivateSystemDebug, _emberDataPrivateAdaptersErrors, _emberDataPrivateSystemRecordArrays, _emberDataPrivateSystemManyArray, _emberDataPrivateSystemRecordArrayManager, _emberDataPrivateAdapters, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateSerializers, _emberInflector, _emberDataSerializersEmbeddedRecordsMixin, _emberDataPrivateTransforms, _emberDataRelationships, _emberDataSetupContainer, _emberDataPrivateInstanceInitializersInitializeStoreService, _emberDataPrivateSystemContainerProxy, _emberDataPrivateSystemRelationshipsStateRelationship) {
12068
+ /**
12069
+ Ember Data
12070
+ @module ember-data
12071
+ @main ember-data
12072
+ */
12073
+
12074
+ if (_ember.default.VERSION.match(/^1\.([0-9]|1[0-2])\./)) {
12075
+ throw new _ember.default.Error("Ember Data requires at least Ember 1.13.0, but you have " + _ember.default.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data.");
12076
+ }
12077
+
12078
+ if (_ember.default.VERSION.match(/^1\.13\./)) {}
12079
+
12080
+ _emberDataPrivateCore.default.Store = _emberDataPrivateSystemStore.Store;
12081
+ _emberDataPrivateCore.default.PromiseArray = _emberDataPrivateSystemPromiseProxies.PromiseArray;
12082
+ _emberDataPrivateCore.default.PromiseObject = _emberDataPrivateSystemPromiseProxies.PromiseObject;
12083
+
12084
+ _emberDataPrivateCore.default.PromiseManyArray = _emberDataPrivateSystemPromiseProxies.PromiseManyArray;
12085
+
12086
+ _emberDataPrivateCore.default.Model = _emberDataModel.default;
12087
+ _emberDataPrivateCore.default.RootState = _emberDataPrivateSystemModel.RootState;
12088
+ _emberDataPrivateCore.default.attr = _emberDataPrivateSystemModel.attr;
12089
+ _emberDataPrivateCore.default.Errors = _emberDataPrivateSystemModel.Errors;
12090
+
12091
+ _emberDataPrivateCore.default.InternalModel = _emberDataPrivateSystemModelInternalModel.default;
12092
+ _emberDataPrivateCore.default.Snapshot = _emberDataPrivateSystemSnapshot.default;
12093
+
12094
+ _emberDataPrivateCore.default.Adapter = _emberDataAdapter.default;
12095
+
12096
+ _emberDataPrivateCore.default.AdapterError = _emberDataPrivateAdaptersErrors.AdapterError;
12097
+ _emberDataPrivateCore.default.InvalidError = _emberDataPrivateAdaptersErrors.InvalidError;
12098
+ _emberDataPrivateCore.default.TimeoutError = _emberDataPrivateAdaptersErrors.TimeoutError;
12099
+ _emberDataPrivateCore.default.AbortError = _emberDataPrivateAdaptersErrors.AbortError;
12100
+
12101
+ _emberDataPrivateCore.default.errorsHashToArray = _emberDataPrivateAdaptersErrors.errorsHashToArray;
12102
+ _emberDataPrivateCore.default.errorsArrayToHash = _emberDataPrivateAdaptersErrors.errorsArrayToHash;
12103
+
12104
+ _emberDataPrivateCore.default.Serializer = _emberDataSerializer.default;
12105
+
12106
+ _emberDataPrivateCore.default.DebugAdapter = _emberDataPrivateSystemDebug.default;
12107
+
12108
+ _emberDataPrivateCore.default.RecordArray = _emberDataPrivateSystemRecordArrays.RecordArray;
12109
+ _emberDataPrivateCore.default.FilteredRecordArray = _emberDataPrivateSystemRecordArrays.FilteredRecordArray;
12110
+ _emberDataPrivateCore.default.AdapterPopulatedRecordArray = _emberDataPrivateSystemRecordArrays.AdapterPopulatedRecordArray;
12111
+ _emberDataPrivateCore.default.ManyArray = _emberDataPrivateSystemManyArray.default;
12112
+
12113
+ _emberDataPrivateCore.default.RecordArrayManager = _emberDataPrivateSystemRecordArrayManager.default;
12114
+
12115
+ _emberDataPrivateCore.default.RESTAdapter = _emberDataPrivateAdapters.RESTAdapter;
12116
+ _emberDataPrivateCore.default.BuildURLMixin = _emberDataPrivateAdaptersBuildUrlMixin.default;
12117
+
12118
+ _emberDataPrivateCore.default.RESTSerializer = _emberDataPrivateSerializers.RESTSerializer;
12119
+ _emberDataPrivateCore.default.JSONSerializer = _emberDataPrivateSerializers.JSONSerializer;
12120
+
12121
+ _emberDataPrivateCore.default.JSONAPIAdapter = _emberDataPrivateAdapters.JSONAPIAdapter;
12122
+ _emberDataPrivateCore.default.JSONAPISerializer = _emberDataPrivateSerializers.JSONAPISerializer;
12123
+
12124
+ _emberDataPrivateCore.default.Transform = _emberDataPrivateTransforms.Transform;
12125
+ _emberDataPrivateCore.default.DateTransform = _emberDataPrivateTransforms.DateTransform;
12126
+ _emberDataPrivateCore.default.StringTransform = _emberDataPrivateTransforms.StringTransform;
12127
+ _emberDataPrivateCore.default.NumberTransform = _emberDataPrivateTransforms.NumberTransform;
12128
+ _emberDataPrivateCore.default.BooleanTransform = _emberDataPrivateTransforms.BooleanTransform;
12129
+
12130
+ _emberDataPrivateCore.default.EmbeddedRecordsMixin = _emberDataSerializersEmbeddedRecordsMixin.default;
12131
+
12132
+ _emberDataPrivateCore.default.belongsTo = _emberDataRelationships.belongsTo;
12133
+ _emberDataPrivateCore.default.hasMany = _emberDataRelationships.hasMany;
12134
+
12135
+ _emberDataPrivateCore.default.Relationship = _emberDataPrivateSystemRelationshipsStateRelationship.default;
12136
+
12137
+ _emberDataPrivateCore.default.ContainerProxy = _emberDataPrivateSystemContainerProxy.default;
12138
+
12139
+ _emberDataPrivateCore.default._setupContainer = _emberDataSetupContainer.default;
12140
+ _emberDataPrivateCore.default._initializeStoreService = _emberDataPrivateInstanceInitializersInitializeStoreService.default;
12141
+
12142
+ Object.defineProperty(_emberDataPrivateCore.default, 'normalizeModelName', {
12143
+ enumerable: true,
12144
+ writable: false,
12145
+ configurable: false,
12146
+ value: _emberDataPrivateSystemNormalizeModelName.default
12147
+ });
12148
+
12149
+ _ember.default.lookup.DS = _emberDataPrivateCore.default;
12150
+
12151
+ exports.default = _emberDataPrivateCore.default;
12152
+ });
12153
+ define("ember-data/model", ["exports", "ember-data/-private/system/model"], function (exports, _emberDataPrivateSystemModel) {
12154
+ exports.default = _emberDataPrivateSystemModel.default;
12155
+ });
12156
+ define("ember-data/relationships", ["exports", "ember-data/-private/system/relationships/belongs-to", "ember-data/-private/system/relationships/has-many"], function (exports, _emberDataPrivateSystemRelationshipsBelongsTo, _emberDataPrivateSystemRelationshipsHasMany) {
12157
+ exports.belongsTo = _emberDataPrivateSystemRelationshipsBelongsTo.default;
12158
+ exports.hasMany = _emberDataPrivateSystemRelationshipsHasMany.default;
12159
+ });
12160
+ /**
12161
+ @module ember-data
12162
+ */
12163
+ define('ember-data/serializer', ['exports', 'ember'], function (exports, _ember) {
12164
+
12165
+ /**
12166
+ `DS.Serializer` is an abstract base class that you should override in your
12167
+ application to customize it for your backend. The minimum set of methods
12168
+ that you should implement is:
12169
+
12170
+ * `normalizeResponse()`
12171
+ * `serialize()`
12172
+
12173
+ And you can optionally override the following methods:
12174
+
12175
+ * `normalize()`
12176
+
12177
+ For an example implementation, see
12178
+ [DS.JSONSerializer](DS.JSONSerializer.html), the included JSON serializer.
12179
+
12180
+ @class Serializer
12181
+ @namespace DS
12182
+ @extends Ember.Object
12183
+ */
12184
+
12185
+ exports.default = _ember.default.Object.extend({
12186
+
12187
+ /**
12188
+ The `store` property is the application's `store` that contains all records.
12189
+ It's injected as a service.
12190
+ It can be used to push records from a non flat data structure server
12191
+ response.
12192
+ @property store
12193
+ @type {DS.Store}
12194
+ @public
12195
+ */
12196
+
12197
+ /**
12198
+ The `normalizeResponse` method is used to normalize a payload from the
12199
+ server to a JSON-API Document.
12200
+ http://jsonapi.org/format/#document-structure
12201
+ @method normalizeResponse
12202
+ @param {DS.Store} store
12203
+ @param {DS.Model} primaryModelClass
12204
+ @param {Object} payload
12205
+ @param {String|Number} id
12206
+ @param {String} requestType
12207
+ @return {Object} JSON-API Document
12208
+ */
12209
+ normalizeResponse: null,
12210
+
12211
+ /**
12212
+ The `serialize` method is used when a record is saved in order to convert
12213
+ the record into the form that your external data source expects.
12214
+ `serialize` takes an optional `options` hash with a single option:
12215
+ - `includeId`: If this is `true`, `serialize` should include the ID
12216
+ in the serialized object it builds.
12217
+ @method serialize
12218
+ @param {DS.Model} record
12219
+ @param {Object} [options]
12220
+ @return {Object}
12221
+ */
12222
+ serialize: null,
12223
+
12224
+ /**
12225
+ The `normalize` method is used to convert a payload received from your
12226
+ external data source into the normalized form `store.push()` expects. You
12227
+ should override this method, munge the hash and return the normalized
12228
+ payload.
12229
+ @method normalize
12230
+ @param {DS.Model} typeClass
12231
+ @param {Object} hash
12232
+ @return {Object}
12233
+ */
12234
+ normalize: function (typeClass, hash) {
12235
+ return hash;
12236
+ }
12237
+
12238
+ });
12239
+ });
12240
+ /**
12241
+ @module ember-data
12242
+ */
12243
+ define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateDebug) {
12244
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
12245
+
12246
+ var get = _ember.default.get;
12247
+ var set = _ember.default.set;
12248
+ var camelize = _ember.default.String.camelize;
12249
+
12250
+ /**
12251
+ ## Using Embedded Records
12252
+
12253
+ `DS.EmbeddedRecordsMixin` supports serializing embedded records.
12254
+
12255
+ To set up embedded records, include the mixin when extending a serializer,
12256
+ then define and configure embedded (model) relationships.
12257
+
12258
+ Below is an example of a per-type serializer (`post` type).
12259
+
12260
+ ```app/serializers/post.js
12261
+ import DS from 'ember-data';
12262
+
12263
+ export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
12264
+ attrs: {
12265
+ author: { embedded: 'always' },
12266
+ comments: { serialize: 'ids' }
12267
+ }
12268
+ });
12269
+ ```
12270
+ Note that this use of `{ embedded: 'always' }` is unrelated to
12271
+ the `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of
12272
+ defining a model while working with the `ActiveModelSerializer`. Nevertheless,
12273
+ using `{ embedded: 'always' }` as an option to `DS.attr` is not a valid way to setup
12274
+ embedded records.
12275
+
12276
+ The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:
12277
+
12278
+ ```js
12279
+ {
12280
+ serialize: 'records',
12281
+ deserialize: 'records'
12282
+ }
12283
+ ```
12284
+
12285
+ ### Configuring Attrs
12286
+
12287
+ A resource's `attrs` option may be set to use `ids`, `records` or false for the
12288
+ `serialize` and `deserialize` settings.
12289
+
12290
+ The `attrs` property can be set on the `ApplicationSerializer` or a per-type
12291
+ serializer.
12292
+
12293
+ In the case where embedded JSON is expected while extracting a payload (reading)
12294
+ the setting is `deserialize: 'records'`, there is no need to use `ids` when
12295
+ extracting as that is the default behavior without this mixin if you are using
12296
+ the vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while
12297
+ serializing `serialize: 'records'` is the setting to use. There is an option of
12298
+ not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you
12299
+ do not want the relationship sent at all, you can use `serialize: false`.
12300
+
12301
+
12302
+ ### EmbeddedRecordsMixin defaults
12303
+ If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
12304
+ will behave in the following way:
12305
+
12306
+ BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
12307
+ HasMany: `{ serialize: false, deserialize: 'ids' }`
12308
+
12309
+ ### Model Relationships
12310
+
12311
+ Embedded records must have a model defined to be extracted and serialized. Note that
12312
+ when defining any relationships on your model such as `belongsTo` and `hasMany`, you
12313
+ should not both specify `async: true` and also indicate through the serializer's
12314
+ `attrs` attribute that the related model should be embedded for deserialization.
12315
+ If a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),
12316
+ then do not use `async: true`.
12317
+
12318
+ To successfully extract and serialize embedded records the model relationships
12319
+ must be setup correcty. See the
12320
+ [defining relationships](/guides/models/defining-models/#toc_defining-relationships)
12321
+ section of the **Defining Models** guide page.
12322
+
12323
+ Records without an `id` property are not considered embedded records, model
12324
+ instances must have an `id` property to be used with Ember Data.
12325
+
12326
+ ### Example JSON payloads, Models and Serializers
12327
+
12328
+ **When customizing a serializer it is important to grok what the customizations
12329
+ are. Please read the docs for the methods this mixin provides, in case you need
12330
+ to modify it to fit your specific needs.**
12331
+
12332
+ For example review the docs for each method of this mixin:
12333
+ * [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize)
12334
+ * [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo)
12335
+ * [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany)
12336
+
12337
+ @class EmbeddedRecordsMixin
12338
+ @namespace DS
12339
+ */
12340
+ exports.default = _ember.default.Mixin.create({
12341
+
12342
+ /**
12343
+ Normalize the record and recursively normalize/extract all the embedded records
12344
+ while pushing them into the store as they are encountered
12345
+ A payload with an attr configured for embedded records needs to be extracted:
12346
+ ```js
12347
+ {
12348
+ "post": {
12349
+ "id": "1"
12350
+ "title": "Rails is omakase",
12351
+ "comments": [{
12352
+ "id": "1",
12353
+ "body": "Rails is unagi"
12354
+ }, {
12355
+ "id": "2",
12356
+ "body": "Omakase O_o"
12357
+ }]
12358
+ }
12359
+ }
12360
+ ```
12361
+ @method normalize
12362
+ @param {DS.Model} typeClass
12363
+ @param {Object} hash to be normalized
12364
+ @param {String} prop the hash has been referenced by
12365
+ @return {Object} the normalized hash
12366
+ **/
12367
+ normalize: function (typeClass, hash, prop) {
12368
+ var normalizedHash = this._super(typeClass, hash, prop);
12369
+ return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);
12370
+ },
12371
+
12372
+ keyForRelationship: function (key, typeClass, method) {
12373
+ if (method === 'serialize' && this.hasSerializeRecordsOption(key) || method === 'deserialize' && this.hasDeserializeRecordsOption(key)) {
12374
+ return this.keyForAttribute(key, method);
12375
+ } else {
12376
+ return this._super(key, typeClass, method) || key;
12377
+ }
12378
+ },
12379
+
12380
+ /**
12381
+ Serialize `belongsTo` relationship when it is configured as an embedded object.
12382
+ This example of an author model belongs to a post model:
12383
+ ```js
12384
+ Post = DS.Model.extend({
12385
+ title: DS.attr('string'),
12386
+ body: DS.attr('string'),
12387
+ author: DS.belongsTo('author')
12388
+ });
12389
+ Author = DS.Model.extend({
12390
+ name: DS.attr('string'),
12391
+ post: DS.belongsTo('post')
12392
+ });
12393
+ ```
12394
+ Use a custom (type) serializer for the post model to configure embedded author
12395
+ ```app/serializers/post.js
12396
+ import DS from 'ember-data;
12397
+ export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
12398
+ attrs: {
12399
+ author: { embedded: 'always' }
12400
+ }
12401
+ })
12402
+ ```
12403
+ A payload with an attribute configured for embedded records can serialize
12404
+ the records together under the root attribute's payload:
12405
+ ```js
12406
+ {
12407
+ "post": {
12408
+ "id": "1"
12409
+ "title": "Rails is omakase",
12410
+ "author": {
12411
+ "id": "2"
12412
+ "name": "dhh"
12413
+ }
12414
+ }
12415
+ }
12416
+ ```
12417
+ @method serializeBelongsTo
12418
+ @param {DS.Snapshot} snapshot
12419
+ @param {Object} json
12420
+ @param {Object} relationship
12421
+ */
12422
+ serializeBelongsTo: function (snapshot, json, relationship) {
12423
+ var attr = relationship.key;
12424
+ if (this.noSerializeOptionSpecified(attr)) {
12425
+ this._super(snapshot, json, relationship);
12426
+ return;
12427
+ }
12428
+ var includeIds = this.hasSerializeIdsOption(attr);
12429
+ var includeRecords = this.hasSerializeRecordsOption(attr);
12430
+ var embeddedSnapshot = snapshot.belongsTo(attr);
12431
+ var key;
12432
+ if (includeIds) {
12433
+ key = this.keyForRelationship(attr, relationship.kind, 'serialize');
12434
+ if (!embeddedSnapshot) {
12435
+ json[key] = null;
12436
+ } else {
12437
+ json[key] = embeddedSnapshot.id;
12438
+
12439
+ if (relationship.options.polymorphic) {
12440
+ this.serializePolymorphicType(snapshot, json, relationship);
12441
+ }
12442
+ }
12443
+ } else if (includeRecords) {
12444
+ this._serializeEmbeddedBelongsTo(snapshot, json, relationship);
12445
+ }
12446
+ },
12447
+
12448
+ _serializeEmbeddedBelongsTo: function (snapshot, json, relationship) {
12449
+ var embeddedSnapshot = snapshot.belongsTo(relationship.key);
12450
+ var serializedKey = this._getMappedKey(relationship.key, snapshot.type);
12451
+ if (serializedKey === relationship.key && this.keyForRelationship) {
12452
+ serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize");
12453
+ }
12454
+
12455
+ if (!embeddedSnapshot) {
12456
+ json[serializedKey] = null;
12457
+ } else {
12458
+ json[serializedKey] = embeddedSnapshot.record.serialize({ includeId: true });
12459
+ this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[serializedKey]);
12460
+
12461
+ if (relationship.options.polymorphic) {
12462
+ this.serializePolymorphicType(snapshot, json, relationship);
12463
+ }
12464
+ }
12465
+ },
12466
+
12467
+ /**
12468
+ Serialize `hasMany` relationship when it is configured as embedded objects.
12469
+ This example of a post model has many comments:
12470
+ ```js
12471
+ Post = DS.Model.extend({
12472
+ title: DS.attr('string'),
12473
+ body: DS.attr('string'),
12474
+ comments: DS.hasMany('comment')
12475
+ });
12476
+ Comment = DS.Model.extend({
12477
+ body: DS.attr('string'),
12478
+ post: DS.belongsTo('post')
12479
+ });
12480
+ ```
12481
+ Use a custom (type) serializer for the post model to configure embedded comments
12482
+ ```app/serializers/post.js
12483
+ import DS from 'ember-data;
12484
+ export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
12485
+ attrs: {
12486
+ comments: { embedded: 'always' }
12487
+ }
12488
+ })
12489
+ ```
12490
+ A payload with an attribute configured for embedded records can serialize
12491
+ the records together under the root attribute's payload:
12492
+ ```js
12493
+ {
12494
+ "post": {
12495
+ "id": "1"
12496
+ "title": "Rails is omakase",
12497
+ "body": "I want this for my ORM, I want that for my template language..."
12498
+ "comments": [{
12499
+ "id": "1",
12500
+ "body": "Rails is unagi"
12501
+ }, {
12502
+ "id": "2",
12503
+ "body": "Omakase O_o"
12504
+ }]
12505
+ }
12506
+ }
12507
+ ```
12508
+ The attrs options object can use more specific instruction for extracting and
12509
+ serializing. When serializing, an option to embed `ids` or `records` can be set.
12510
+ When extracting the only option is `records`.
12511
+ So `{ embedded: 'always' }` is shorthand for:
12512
+ `{ serialize: 'records', deserialize: 'records' }`
12513
+ To embed the `ids` for a related object (using a hasMany relationship):
12514
+ ```app/serializers/post.js
12515
+ import DS from 'ember-data;
12516
+ export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
12517
+ attrs: {
12518
+ comments: { serialize: 'ids', deserialize: 'records' }
12519
+ }
12520
+ })
12521
+ ```
12522
+ ```js
12523
+ {
12524
+ "post": {
12525
+ "id": "1"
12526
+ "title": "Rails is omakase",
12527
+ "body": "I want this for my ORM, I want that for my template language..."
12528
+ "comments": ["1", "2"]
12529
+ }
12530
+ }
12531
+ ```
12532
+ @method serializeHasMany
12533
+ @param {DS.Snapshot} snapshot
12534
+ @param {Object} json
12535
+ @param {Object} relationship
12536
+ */
12537
+ serializeHasMany: function (snapshot, json, relationship) {
12538
+ var attr = relationship.key;
12539
+ if (this.noSerializeOptionSpecified(attr)) {
12540
+ this._super(snapshot, json, relationship);
12541
+ return;
12542
+ }
12543
+ var includeIds = this.hasSerializeIdsOption(attr);
12544
+ var includeRecords = this.hasSerializeRecordsOption(attr);
12545
+ if (includeIds) {
12546
+ var serializedKey = this.keyForRelationship(attr, relationship.kind, 'serialize');
12547
+ json[serializedKey] = snapshot.hasMany(attr, { ids: true });
12548
+ } else if (includeRecords) {
12549
+ this._serializeEmbeddedHasMany(snapshot, json, relationship);
12550
+ }
12551
+ },
12552
+
12553
+ _serializeEmbeddedHasMany: function (snapshot, json, relationship) {
12554
+ var serializedKey = this._getMappedKey(relationship.key, snapshot.type);
12555
+ if (serializedKey === relationship.key && this.keyForRelationship) {
12556
+ serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize");
12557
+ }
12558
+
12559
+ json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship);
12560
+ },
12561
+
12562
+ /*
12563
+ Returns an array of embedded records serialized to JSON
12564
+ */
12565
+ _generateSerializedHasMany: function (snapshot, relationship) {
12566
+ var hasMany = snapshot.hasMany(relationship.key);
12567
+ var manyArray = _ember.default.A(hasMany);
12568
+ var ret = new Array(manyArray.length);
12574
12569
 
12575
- return _ember.default.computed({
12576
- get: function (key) {
12577
- var internalModel = this._internalModel;
12578
- if (hasValue(internalModel, key)) {
12579
- return getValue(internalModel, key);
12580
- } else {
12581
- return getDefaultValue(this, options, key);
12582
- }
12583
- },
12584
- set: function (key, value) {
12585
- var internalModel = this._internalModel;
12586
- var oldValue = getValue(internalModel, key);
12570
+ for (var i = 0; i < manyArray.length; i++) {
12571
+ var embeddedSnapshot = manyArray[i];
12572
+ var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
12573
+ this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
12574
+ ret[i] = embeddedJson;
12575
+ }
12587
12576
 
12588
- if (value !== oldValue) {
12589
- // Add the new value to the changed attributes hash; it will get deleted by
12590
- // the 'didSetProperty' handler if it is no different from the original value
12591
- internalModel._attributes[key] = value;
12577
+ return ret;
12578
+ },
12592
12579
 
12593
- this._internalModel.send('didSetProperty', {
12594
- name: key,
12595
- oldValue: oldValue,
12596
- originalValue: internalModel._data[key],
12597
- value: value
12598
- });
12580
+ /**
12581
+ When serializing an embedded record, modify the property (in the json payload)
12582
+ that refers to the parent record (foreign key for relationship).
12583
+ Serializing a `belongsTo` relationship removes the property that refers to the
12584
+ parent record
12585
+ Serializing a `hasMany` relationship does not remove the property that refers to
12586
+ the parent record.
12587
+ @method removeEmbeddedForeignKey
12588
+ @param {DS.Snapshot} snapshot
12589
+ @param {DS.Snapshot} embeddedSnapshot
12590
+ @param {Object} relationship
12591
+ @param {Object} json
12592
+ */
12593
+ removeEmbeddedForeignKey: function (snapshot, embeddedSnapshot, relationship, json) {
12594
+ if (relationship.kind === 'hasMany') {
12595
+ return;
12596
+ } else if (relationship.kind === 'belongsTo') {
12597
+ var parentRecord = snapshot.type.inverseFor(relationship.key, this.store);
12598
+ if (parentRecord) {
12599
+ var name = parentRecord.name;
12600
+ var embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);
12601
+ var parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');
12602
+ if (parentKey) {
12603
+ delete json[parentKey];
12604
+ }
12599
12605
  }
12600
-
12601
- return value;
12602
12606
  }
12603
- }).meta(meta);
12604
- }
12605
- });
12606
- define("ember-data", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/core", "ember-data/-private/system/normalize-model-name", "ember-data/-private/system/model/internal-model", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store", "ember-data/-private/system/model", "ember-data/model", "ember-data/-private/system/snapshot", "ember-data/adapter", "ember-data/-private/system/serializer", "ember-data/-private/system/debug", "ember-data/-private/adapters/errors", "ember-data/-private/system/record-arrays", "ember-data/-private/system/many-array", "ember-data/-private/system/record-array-manager", "ember-data/-private/adapters", "ember-data/-private/adapters/build-url-mixin", "ember-data/-private/serializers", "ember-inflector", "ember-data/-private/serializers/embedded-records-mixin", "ember-data/-private/transforms", "ember-data/relationships", "ember-data/setup-container", "ember-data/-private/instance-initializers/initialize-store-service", "ember-data/-private/system/container-proxy", "ember-data/-private/system/relationships/state/relationship"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateCore, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateSystemModelInternalModel, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStore, _emberDataPrivateSystemModel, _emberDataModel, _emberDataPrivateSystemSnapshot, _emberDataAdapter, _emberDataPrivateSystemSerializer, _emberDataPrivateSystemDebug, _emberDataPrivateAdaptersErrors, _emberDataPrivateSystemRecordArrays, _emberDataPrivateSystemManyArray, _emberDataPrivateSystemRecordArrayManager, _emberDataPrivateAdapters, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateSerializers, _emberInflector, _emberDataPrivateSerializersEmbeddedRecordsMixin, _emberDataPrivateTransforms, _emberDataRelationships, _emberDataSetupContainer, _emberDataPrivateInstanceInitializersInitializeStoreService, _emberDataPrivateSystemContainerProxy, _emberDataPrivateSystemRelationshipsStateRelationship) {
12607
- /**
12608
- Ember Data
12609
- @module ember-data
12610
- @main ember-data
12611
- */
12607
+ },
12612
12608
 
12613
- if (_ember.default.VERSION.match(/^1\.([0-9]|1[0-2])\./)) {
12614
- throw new _ember.default.Error("Ember Data requires at least Ember 1.13.0, but you have " + _ember.default.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data.");
12615
- }
12609
+ // checks config for attrs option to embedded (always) - serialize and deserialize
12610
+ hasEmbeddedAlwaysOption: function (attr) {
12611
+ var option = this.attrsOption(attr);
12612
+ return option && option.embedded === 'always';
12613
+ },
12616
12614
 
12617
- if (_ember.default.VERSION.match(/^1\.13\./)) {}
12615
+ // checks config for attrs option to serialize ids
12616
+ hasSerializeRecordsOption: function (attr) {
12617
+ var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
12618
+ var option = this.attrsOption(attr);
12619
+ return alwaysEmbed || option && option.serialize === 'records';
12620
+ },
12618
12621
 
12619
- _emberDataPrivateCore.default.Store = _emberDataPrivateSystemStore.Store;
12620
- _emberDataPrivateCore.default.PromiseArray = _emberDataPrivateSystemPromiseProxies.PromiseArray;
12621
- _emberDataPrivateCore.default.PromiseObject = _emberDataPrivateSystemPromiseProxies.PromiseObject;
12622
+ // checks config for attrs option to serialize records
12623
+ hasSerializeIdsOption: function (attr) {
12624
+ var option = this.attrsOption(attr);
12625
+ return option && (option.serialize === 'ids' || option.serialize === 'id');
12626
+ },
12622
12627
 
12623
- _emberDataPrivateCore.default.PromiseManyArray = _emberDataPrivateSystemPromiseProxies.PromiseManyArray;
12628
+ // checks config for attrs option to serialize records
12629
+ noSerializeOptionSpecified: function (attr) {
12630
+ var option = this.attrsOption(attr);
12631
+ return !(option && (option.serialize || option.embedded));
12632
+ },
12624
12633
 
12625
- _emberDataPrivateCore.default.Model = _emberDataModel.default;
12626
- _emberDataPrivateCore.default.RootState = _emberDataPrivateSystemModel.RootState;
12627
- _emberDataPrivateCore.default.attr = _emberDataPrivateSystemModel.attr;
12628
- _emberDataPrivateCore.default.Errors = _emberDataPrivateSystemModel.Errors;
12634
+ // checks config for attrs option to deserialize records
12635
+ // a defined option object for a resource is treated the same as
12636
+ // `deserialize: 'records'`
12637
+ hasDeserializeRecordsOption: function (attr) {
12638
+ var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
12639
+ var option = this.attrsOption(attr);
12640
+ return alwaysEmbed || option && option.deserialize === 'records';
12641
+ },
12629
12642
 
12630
- _emberDataPrivateCore.default.InternalModel = _emberDataPrivateSystemModelInternalModel.default;
12631
- _emberDataPrivateCore.default.Snapshot = _emberDataPrivateSystemSnapshot.default;
12643
+ attrsOption: function (attr) {
12644
+ var attrs = this.get('attrs');
12645
+ return attrs && (attrs[camelize(attr)] || attrs[attr]);
12646
+ },
12632
12647
 
12633
- _emberDataPrivateCore.default.Adapter = _emberDataAdapter.default;
12648
+ /**
12649
+ @method _extractEmbeddedRecords
12650
+ @private
12651
+ */
12652
+ _extractEmbeddedRecords: function (serializer, store, typeClass, partial) {
12653
+ var _this = this;
12634
12654
 
12635
- _emberDataPrivateCore.default.AdapterError = _emberDataPrivateAdaptersErrors.AdapterError;
12636
- _emberDataPrivateCore.default.InvalidError = _emberDataPrivateAdaptersErrors.InvalidError;
12637
- _emberDataPrivateCore.default.TimeoutError = _emberDataPrivateAdaptersErrors.TimeoutError;
12638
- _emberDataPrivateCore.default.AbortError = _emberDataPrivateAdaptersErrors.AbortError;
12655
+ typeClass.eachRelationship(function (key, relationship) {
12656
+ if (serializer.hasDeserializeRecordsOption(key)) {
12657
+ if (relationship.kind === "hasMany") {
12658
+ _this._extractEmbeddedHasMany(store, key, partial, relationship);
12659
+ }
12660
+ if (relationship.kind === "belongsTo") {
12661
+ _this._extractEmbeddedBelongsTo(store, key, partial, relationship);
12662
+ }
12663
+ }
12664
+ });
12665
+ return partial;
12666
+ },
12639
12667
 
12640
- _emberDataPrivateCore.default.errorsHashToArray = _emberDataPrivateAdaptersErrors.errorsHashToArray;
12641
- _emberDataPrivateCore.default.errorsArrayToHash = _emberDataPrivateAdaptersErrors.errorsArrayToHash;
12668
+ /**
12669
+ @method _extractEmbeddedHasMany
12670
+ @private
12671
+ */
12672
+ _extractEmbeddedHasMany: function (store, key, hash, relationshipMeta) {
12673
+ var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
12674
+
12675
+ if (!relationshipHash) {
12676
+ return;
12677
+ }
12642
12678
 
12643
- _emberDataPrivateCore.default.Serializer = _emberDataPrivateSystemSerializer.default;
12679
+ var hasMany = new Array(relationshipHash.length);
12644
12680
 
12645
- _emberDataPrivateCore.default.DebugAdapter = _emberDataPrivateSystemDebug.default;
12681
+ for (var i = 0; i < relationshipHash.length; i++) {
12682
+ var item = relationshipHash[i];
12646
12683
 
12647
- _emberDataPrivateCore.default.RecordArray = _emberDataPrivateSystemRecordArrays.RecordArray;
12648
- _emberDataPrivateCore.default.FilteredRecordArray = _emberDataPrivateSystemRecordArrays.FilteredRecordArray;
12649
- _emberDataPrivateCore.default.AdapterPopulatedRecordArray = _emberDataPrivateSystemRecordArrays.AdapterPopulatedRecordArray;
12650
- _emberDataPrivateCore.default.ManyArray = _emberDataPrivateSystemManyArray.default;
12684
+ var _normalizeEmbeddedRelationship = this._normalizeEmbeddedRelationship(store, relationshipMeta, item);
12651
12685
 
12652
- _emberDataPrivateCore.default.RecordArrayManager = _emberDataPrivateSystemRecordArrayManager.default;
12686
+ var data = _normalizeEmbeddedRelationship.data;
12687
+ var included = _normalizeEmbeddedRelationship.included;
12653
12688
 
12654
- _emberDataPrivateCore.default.RESTAdapter = _emberDataPrivateAdapters.RESTAdapter;
12655
- _emberDataPrivateCore.default.BuildURLMixin = _emberDataPrivateAdaptersBuildUrlMixin.default;
12689
+ hash.included = hash.included || [];
12690
+ hash.included.push(data);
12691
+ if (included) {
12692
+ var _hash$included;
12656
12693
 
12657
- _emberDataPrivateCore.default.RESTSerializer = _emberDataPrivateSerializers.RESTSerializer;
12658
- _emberDataPrivateCore.default.JSONSerializer = _emberDataPrivateSerializers.JSONSerializer;
12694
+ (_hash$included = hash.included).push.apply(_hash$included, _toConsumableArray(included));
12695
+ }
12659
12696
 
12660
- _emberDataPrivateCore.default.JSONAPIAdapter = _emberDataPrivateAdapters.JSONAPIAdapter;
12661
- _emberDataPrivateCore.default.JSONAPISerializer = _emberDataPrivateSerializers.JSONAPISerializer;
12697
+ hasMany[i] = { id: data.id, type: data.type };
12698
+ }
12662
12699
 
12663
- _emberDataPrivateCore.default.Transform = _emberDataPrivateTransforms.Transform;
12664
- _emberDataPrivateCore.default.DateTransform = _emberDataPrivateTransforms.DateTransform;
12665
- _emberDataPrivateCore.default.StringTransform = _emberDataPrivateTransforms.StringTransform;
12666
- _emberDataPrivateCore.default.NumberTransform = _emberDataPrivateTransforms.NumberTransform;
12667
- _emberDataPrivateCore.default.BooleanTransform = _emberDataPrivateTransforms.BooleanTransform;
12700
+ var relationship = { data: hasMany };
12701
+ set(hash, 'data.relationships.' + key, relationship);
12702
+ },
12668
12703
 
12669
- _emberDataPrivateCore.default.EmbeddedRecordsMixin = _emberDataPrivateSerializersEmbeddedRecordsMixin.default;
12704
+ /**
12705
+ @method _extractEmbeddedBelongsTo
12706
+ @private
12707
+ */
12708
+ _extractEmbeddedBelongsTo: function (store, key, hash, relationshipMeta) {
12709
+ var relationshipHash = get(hash, 'data.relationships.' + key + '.data');
12710
+ if (!relationshipHash) {
12711
+ return;
12712
+ }
12670
12713
 
12671
- _emberDataPrivateCore.default.belongsTo = _emberDataRelationships.belongsTo;
12672
- _emberDataPrivateCore.default.hasMany = _emberDataRelationships.hasMany;
12714
+ var _normalizeEmbeddedRelationship2 = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);
12673
12715
 
12674
- _emberDataPrivateCore.default.Relationship = _emberDataPrivateSystemRelationshipsStateRelationship.default;
12716
+ var data = _normalizeEmbeddedRelationship2.data;
12717
+ var included = _normalizeEmbeddedRelationship2.included;
12675
12718
 
12676
- _emberDataPrivateCore.default.ContainerProxy = _emberDataPrivateSystemContainerProxy.default;
12719
+ hash.included = hash.included || [];
12720
+ hash.included.push(data);
12721
+ if (included) {
12722
+ var _hash$included2;
12677
12723
 
12678
- _emberDataPrivateCore.default._setupContainer = _emberDataSetupContainer.default;
12679
- _emberDataPrivateCore.default._initializeStoreService = _emberDataPrivateInstanceInitializersInitializeStoreService.default;
12724
+ (_hash$included2 = hash.included).push.apply(_hash$included2, _toConsumableArray(included));
12725
+ }
12680
12726
 
12681
- Object.defineProperty(_emberDataPrivateCore.default, 'normalizeModelName', {
12682
- enumerable: true,
12683
- writable: false,
12684
- configurable: false,
12685
- value: _emberDataPrivateSystemNormalizeModelName.default
12686
- });
12727
+ var belongsTo = { id: data.id, type: data.type };
12728
+ var relationship = { data: belongsTo };
12687
12729
 
12688
- _ember.default.lookup.DS = _emberDataPrivateCore.default;
12730
+ set(hash, 'data.relationships.' + key, relationship);
12731
+ },
12689
12732
 
12690
- exports.default = _emberDataPrivateCore.default;
12691
- });
12692
- define("ember-data/model", ["exports", "ember-data/-private/system/model"], function (exports, _emberDataPrivateSystemModel) {
12693
- exports.default = _emberDataPrivateSystemModel.default;
12694
- });
12695
- define("ember-data/relationships", ["exports", "ember-data/-private/system/relationships/belongs-to", "ember-data/-private/system/relationships/has-many"], function (exports, _emberDataPrivateSystemRelationshipsBelongsTo, _emberDataPrivateSystemRelationshipsHasMany) {
12696
- exports.belongsTo = _emberDataPrivateSystemRelationshipsBelongsTo.default;
12697
- exports.hasMany = _emberDataPrivateSystemRelationshipsHasMany.default;
12733
+ /**
12734
+ @method _normalizeEmbeddedRelationship
12735
+ @private
12736
+ */
12737
+ _normalizeEmbeddedRelationship: function (store, relationshipMeta, relationshipHash) {
12738
+ var modelName = relationshipMeta.type;
12739
+ if (relationshipMeta.options.polymorphic) {
12740
+ modelName = relationshipHash.type;
12741
+ }
12742
+ var modelClass = store.modelFor(modelName);
12743
+ var serializer = store.serializerFor(modelName);
12744
+
12745
+ return serializer.normalize(modelClass, relationshipHash, null);
12746
+ }
12747
+ });
12698
12748
  });
12699
- /**
12700
- @module ember-data
12701
- */
12702
12749
  define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-private/debug', 'ember-data/serializers/json', 'ember-data/-private/system/normalize-model-name', 'ember-inflector'], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializersJson, _emberDataPrivateSystemNormalizeModelName, _emberInflector) {
12703
12750
 
12704
12751
  var dasherize = _ember.default.String.dasherize;
@@ -13183,7 +13230,7 @@ define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-data/-priv
13183
13230
  /**
13184
13231
  @module ember-data
13185
13232
  */
13186
- define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/debug', 'ember-data/-private/system/serializer', 'ember-data/-private/system/coerce-id', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/utils', 'ember-data/-private/adapters/errors'], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemSerializer, _emberDataPrivateSystemCoerceId, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateUtils, _emberDataPrivateAdaptersErrors) {
13233
+ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/debug', 'ember-data/serializer', 'ember-data/-private/system/coerce-id', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/utils', 'ember-data/-private/adapters/errors'], function (exports, _ember, _emberDataPrivateDebug, _emberDataSerializer, _emberDataPrivateSystemCoerceId, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateUtils, _emberDataPrivateAdaptersErrors) {
13187
13234
  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
13188
13235
 
13189
13236
  var get = _ember.default.get;
@@ -13256,7 +13303,7 @@ define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/-private/
13256
13303
  @namespace DS
13257
13304
  @extends DS.Serializer
13258
13305
  */
13259
- exports.default = _emberDataPrivateSystemSerializer.default.extend({
13306
+ exports.default = _emberDataSerializer.default.extend({
13260
13307
 
13261
13308
  /**
13262
13309
  The `primaryKey` is used when serializing and deserializing
@@ -15271,7 +15318,7 @@ define('ember-data/transform', ['exports', 'ember'], function (exports, _ember)
15271
15318
  });
15272
15319
  });
15273
15320
  define("ember-data/version", ["exports"], function (exports) {
15274
- exports.default = "2.4.0-beta.2";
15321
+ exports.default = "2.4.0-beta.3";
15275
15322
  });
15276
15323
  define("ember-inflector", ["exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (exports, _ember, _emberInflectorLibSystem, _emberInflectorLibExtString) {
15277
15324
 
@@ -15742,10 +15789,12 @@ require("ember-data");
15742
15789
  var shims = {
15743
15790
  'ember-data': { default: DS },
15744
15791
  'ember-data/model': { default: DS.Model },
15792
+ 'ember-data/mixins/embedded-records': { default: DS.EmbeddedRecordsMixin },
15745
15793
  'ember-data/serializers/rest': { default: DS.RESTSerializer },
15746
15794
  'ember-data/serializers/active-model': { default: DS.ActiveModelSerializer },
15747
15795
  'ember-data/serializers/json': { default: DS.JSONSerializer },
15748
15796
  'ember-data/serializers/json-api': { default: DS.JSONAPISerializer },
15797
+ 'ember-data/serializer': { default: DS.Serializer },
15749
15798
  'ember-data/adapters/json-api': { default: DS.JSONAPIAdapter },
15750
15799
  'ember-data/adapters/rest': { default: DS.RESTAdapter },
15751
15800
  'ember-data/adapter': { default: DS.Adapter },