diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..2fb3ef20 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,35 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..79ee123c --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..4db521f9 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index 3c03a690..03acf3f1 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,8 +1,6 @@ - - + - - + \ No newline at end of file diff --git a/.idea/webgcode.iml b/.idea/webgcode.iml index 9d4d4c2c..31d599a2 100644 --- a/.idea/webgcode.iml +++ b/.idea/webgcode.iml @@ -1,15 +1,497 @@ - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/webapp/cnc/app/controller.js b/webapp/cnc/app/controller.js index a2d8b4af..4cbc402e 100644 --- a/webapp/cnc/app/controller.js +++ b/webapp/cnc/app/controller.js @@ -3,30 +3,6 @@ define(['Ember', 'cnc/cam/operations', 'cnc/util', 'cnc/cad/wabble', 'cnc/cam/text', 'cnc/app/job/jobController'], function (Ember, Operations, util, Wabble, text, JobController) { var wabble = new Wabble(13, 15, 1, 1, 5, 8, 3); - var LoginController = Ember.ObjectController.extend({ - actions: { - loginWithToken: function (authData) { - var _this = this; - var service = this.get('model'); - var payload; - if (service == 'twitter') - payload = { - user_id: authData.twitter.id, - oauth_token: authData.twitter.accessToken, - oauth_token_secret: authData.twitter.accessTokenSecret - }; - else - payload = authData[service].accessToken; - this.get('firebase.firebase').authWithOAuthToken(service, payload, function () { - console.log(arguments); - _this.transitionToRoute('index').then(function () { - Visucam.reset(); - }); - }); - } - } - }); - var IndexController = Ember.ObjectController.extend({ needs: ['application'], actions: { @@ -74,28 +50,14 @@ define(['Ember', 'cnc/cam/operations', 'cnc/util', 'cnc/cad/wabble', 'cnc/cam/te }, createJob: function () { var job = this.store.createRecord('job'); - job.saveAll(); - this.transitionToRoute('job', job); + var _this = this; + return job.saveAll().then(function () { + _this.transitionToRoute('job', job); + }); } } }); - var ApplicationController = Ember.ObjectController.extend({ - authProviderIcon: function () { - var icons = { - facebook: 'fa fa-facebook', - twitter: 'fa fa-twitter', - github: 'fa fa-github', - google: 'fa fa-google-plus', - anonymous: 'fa fa-eye-slash' - }; - return icons[this.get('firebase.auth.provider')]; - }.property('firebase.auth.provider'), - authTitle: function () { - return 'Authenticated with ' + this.get('firebase.auth.provider'); - }.property('firebase.auth.provider') - }); - var ShapeController = Ember.ObjectController.extend({ init: function () { var _this = this; @@ -105,22 +67,22 @@ define(['Ember', 'cnc/cam/operations', 'cnc/util', 'cnc/cad/wabble', 'cnc/cam/te }, shapeTypes: ['rectangle', 'circle', 'text', 'point', 'slice'], isManual: function () { - return this.get('type') == 'manual'; + return this.get('type') === 'manual'; }.property('type'), isRectangle: function () { - return this.get('isManual') && this.get('manualDefinition.type') == 'rectangle'; + return this.get('isManual') && this.get('manualDefinition.type') === 'rectangle'; }.property('isManual', 'manualDefinition.type'), isCircle: function () { - return this.get('isManual') && this.get('manualDefinition.type') == 'circle'; + return this.get('isManual') && this.get('manualDefinition.type') === 'circle'; }.property('isManual', 'manualDefinition.type'), isText: function () { - return this.get('isManual') && this.get('manualDefinition.type') == 'text'; + return this.get('isManual') && this.get('manualDefinition.type') === 'text'; }.property('isManual', 'manualDefinition.type'), isPoint: function () { - return this.get('isManual') && this.get('manualDefinition.type') == 'point'; + return this.get('isManual') && this.get('manualDefinition.type') === 'point'; }.property('isManual', 'manualDefinition.type'), isSlice: function () { - return this.get('isManual') && this.get('manualDefinition.type') == 'slice'; + return this.get('isManual') && this.get('manualDefinition.type') === 'slice'; }.property('isManual', 'manualDefinition.type'), fonts: null, fontChanged: function () { @@ -144,7 +106,7 @@ define(['Ember', 'cnc/cam/operations', 'cnc/util', 'cnc/cad/wabble', 'cnc/cam/te return shape.get('stlModel') == null; }), suitableShapes: function () { - if (this.get('type') == '3DlinearOperation') + if (this.get('type') === '3DlinearOperation') return this.get('stlShapes'); return this.get('NonStlShapes'); }.property('stlShapes', 'NonStlShapes', 'type'), @@ -154,7 +116,7 @@ define(['Ember', 'cnc/cam/operations', 'cnc/util', 'cnc/cad/wabble', 'cnc/cam/te }); }.property(), isVTool: function () { - return this.get('3d_toolType').indexOf('v') == 0; + return this.get('3d_toolType').indexOf('v') === 0; }.property('3d_toolType'), toolShapes: function () { return [ @@ -240,9 +202,7 @@ define(['Ember', 'cnc/cam/operations', 'cnc/util', 'cnc/cad/wabble', 'cnc/cam/te }.property('controllers.job.currentShape') }); return { - LoginController: LoginController, IndexController: IndexController, - ApplicationController: ApplicationController, JobController: JobController, ShapeController: ShapeController, OperationController: OperationController, diff --git a/webapp/cnc/app/job/jobAdapter.js b/webapp/cnc/app/job/jobAdapter.js new file mode 100644 index 00000000..cf792ef5 --- /dev/null +++ b/webapp/cnc/app/job/jobAdapter.js @@ -0,0 +1,115 @@ +"use strict"; + +define(['Ember', 'EmberData'], function (Ember, DS) { + + // this adapter is also used for JobSummary. + // jobsummry is a model of job that just shows a few fields and doesn't trigger a full toolpath computation. + // it's used for the job list on the front page + // by using the same adapter, the same on disk data get either hydrated as a Job or a JobSummary + return DS.Adapter.extend({ + init() { + return new Ember.RSVP.Promise(function (resolve, reject) { + var request = window.indexedDB.open("Jobs", 2); + request.onerror = function (event) { + reject(event.target.errorCode) + } + request.onupgradeneeded = function (event) { + var db = event.target.result; + db.createObjectStore("jobs", {autoIncrement: true}); + } + request.onsuccess = function (event) { + resolve(); + } + }); + }, + openDB() { + return new Ember.RSVP.Promise(function (resolve, reject) { + var request = window.indexedDB.open("Jobs", 2); + request.onerror = function (event) { + reject(event.target.errorCode) + } + request.onsuccess = function (event) { + event.target.result; + resolve(event.target.result); + } + }); + }, + makeQuery(idbQueryFunction) { + return this.openDB().then(function (db) { + let idbObjectStore = db.transaction(["jobs"], "readwrite").objectStore("jobs"); + var request = idbQueryFunction(idbObjectStore); + return new Ember.RSVP.Promise(function (resolve, reject) { + request.onsuccess = function (event) { + resolve(event.target.result); + }; + request.onerror = function (event) { + console.error('IndexedDB error: ' + event.target.errorCode); + reject(event); + }; + }); + }); + }, + find: function (store, type, id, opts) { + return this.makeQuery(function (objectStore) { + return objectStore.get(parseInt(id)); + }).then(function (data) { + if (data) + data.id = id; + return data + }); + }, + findRecord: function (store, type, id, opts) { + console.log('JobAdapter.find()') + }, + createRecord: function (store, type, snapshot) { + var data = this.serialize(snapshot); + return this.makeQuery(function (objectStore) { + return objectStore.add(data); + }).then(function (id) { + data.id = id; + return data + }); + }, + updateRecord: function (store, type, snapshot) { + var data = snapshot.serialize(); + return this.makeQuery(function (objectStore) { + return objectStore.put(data, parseInt(snapshot.id)); + }).then(function () { + data.id = snapshot.id; + return data; + }); + }, + deleteRecord: function (store, type, snapshot) { + return this.makeQuery(function (objectStore) { + return objectStore.delete(parseInt(snapshot.id)); + }).then(function () { + return true; + }); + }, + findAll: function (store, type) { + var result = []; + return this.openDB().then(function (db) { + var request = db.transaction(["jobs"], "readonly").objectStore("jobs").openCursor(); + return new Ember.RSVP.Promise(function (resolve, reject) { + request.onsuccess = function (event) { + let cursor = event.target.result; + if (cursor) { + result.push({...cursor.value, id: cursor.primaryKey + ''}) + cursor.continue(); + } else { + Ember.run(null, resolve, result); + } + }; + request.onerror = function (event) { + console.log('IndexedDB error: ' + event.target.errorCode); + reject(event); + }; + }); + }); + }, + query: function (records, query) { + return [] + } + }); + +}); \ No newline at end of file diff --git a/webapp/cnc/app/job/jobController.js b/webapp/cnc/app/job/jobController.js index 1452c082..90574473 100644 --- a/webapp/cnc/app/job/jobController.js +++ b/webapp/cnc/app/job/jobController.js @@ -7,7 +7,7 @@ define(['Ember', 'jQuery', 'cnc/util', 'cnc/cam/cam'], function (Ember, $, util, this._super(); var _this = this; window.addEventListener("message", Ember.run.bind(this, function (event) { - if (event.data['type'] == 'gimme program') { + if (event.data['type'] === 'gimme program') { _this.syncStartPoint(); var parameters = event.data.parameters; var toolPath = _this.get('model').computeCompactToolPath(); @@ -24,7 +24,7 @@ define(['Ember', 'jQuery', 'cnc/util', 'cnc/cam/cam'], function (Ember, $, util, }); console.timeEnd('postMessage'); } - if (event.data['type'] == 'toolPosition') { + if (event.data['type'] === 'toolPosition') { var pos = event.data['position']; var newPos = new util.Point(pos.x, pos.y, pos.z); if (!_this.get('toolPosition') || _this.get('toolPosition').sqDistance(newPos)) { @@ -32,7 +32,7 @@ define(['Ember', 'jQuery', 'cnc/util', 'cnc/cam/cam'], function (Ember, $, util, Ember.run.debounce(_this, _this.syncStartPoint, 5000); } } - if (event.data['type'] == 'current operations') { + if (event.data['type'] === 'current operations') { _this.set('runningOperations', event.data['operations']); } }), false); @@ -76,11 +76,12 @@ define(['Ember', 'jQuery', 'cnc/util', 'cnc/cam/cam'], function (Ember, $, util, }, 'delete': function () { var _this = this; - this.get('model.jobSummary').then(function (jobSummary) { - return Ember.RSVP.hash({ - summary: jobSummary.destroyRecord(), - job: _this.get('model').destroyRecord() - }); + var ops = this.get('operations').toArray(); + return Ember.RSVP.all(ops.map(function (op) { + _this.get('operations').removeObject(op); + return op.destroyRecord(); + })).finally(function () { + return _this.get('model').destroyRecord(); }).then(function () { _this.transitionToRoute('index'); }); @@ -94,9 +95,9 @@ define(['Ember', 'jQuery', 'cnc/util', 'cnc/cam/cam'], function (Ember, $, util, if (fragment.feedrate) collector.changeWorkSpeed(fragment.feedrate); var gotoFunc; - if (fragment.speedTag == 'normal') + if (fragment.speedTag === 'normal') gotoFunc = collector.goToWorkSpeed.bind(collector); - if (fragment.speedTag == 'rapid') + if (fragment.speedTag === 'rapid') gotoFunc = collector.goToTravelSpeed.bind(collector); for (var j = 0; j < fragment.path.length; j++) gotoFunc(fragment.path[j]); diff --git a/webapp/cnc/app/job/jobModel.js b/webapp/cnc/app/job/jobModel.js index 189509d5..9882d233 100644 --- a/webapp/cnc/app/job/jobModel.js +++ b/webapp/cnc/app/job/jobModel.js @@ -9,7 +9,7 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' toolDiameter: attr('number', {defaultValue: 3}), userFeedrate: attr('number', {defaultValue: 100}), startPoint: attr('point', {defaultValue: new util.Point(0, 0, 10)}), - jobSummary: DS.belongsTo('jobSummary', {inverse: 'job', async: true}), + jobSummary: DS.belongsTo('jobSummary', {inverse: 'job', async: false}), shapes: DS.hasMany('shape', {inverse: 'job', embedded: true}), operations: DS.hasMany('operation', {inverse: 'job', embedded: true}), offsetX: attr('number', {defaultValue: 0}), @@ -35,9 +35,9 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' }); }, deleteOperation: function (operation) { + operation.terminateWorkerWhenDeleted(); this.get('operations').removeObject(operation); operation.destroyRecord(); - this.save(); }, deleteShape: function (shape) { this.get('shapes').removeObject(shape); @@ -100,25 +100,17 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' }, createShape: function (def, name, params) { var shape = this.store.createRecord('shape', $.extend({definition: def, name: name}, params)); + //shape.set('id', this.get('shapes.length')) this.get('shapes').pushObject(shape); return shape; }, saveAll: function () { - var summaryPromise = this.get('jobSummary'); - var _this = this; - summaryPromise.then(function (summary) { - if (summary == null) { - summary = _this.store.createRecord('jobSummary', {job: _this, name: _this.get('name')}); - _this.set('jobSummary', summary); - } else - summary.set('name', _this.get('name')); - return Ember.RSVP.all([summary.save(), _this.save()]); - }); + return this.save(); }, feedrate: Ember.computed.alias('userFeedrate'), canSendProgram: function () { var operations = this.get('operations'); - if (operations.length == 0) + if (operations.length === 0) return false; var oneIsComputing = false; var oneIsEnabled = false; @@ -137,12 +129,11 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' this.set('duration', 'computing...'); if (this.get('durationWorker')) this.get('durationWorker').terminate(); - var worker = new Worker(require.toUrl('worker.js')); + var worker = new Worker(require.toUrl('worker.js') + '#jobdurationWorker'); this.set('durationWorker', worker); var _this = this; worker.onmessage = Ember.run.bind(this, function (event) { _this.set('duration', event.data.duration); - worker.terminate(); _this.set('durationWorker', null); }); worker.postMessage({ @@ -152,11 +143,10 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' }, observeOperationDuration: function () { this.set('duration', null); - if (this.get('enabledOperations').filterBy('computing', true).length == 0) + if (this.get('enabledOperations').filterBy('computing', true).length === 0) Ember.run.debounce(this, 'computeDuration', 100); }.observes('wholeProgram', 'operations.@each.actualFeedrate', 'operations.@each.computing'), computeCompactToolPath: function () { - console.log('computeCompactToolPath'); var operations = this.get('enabledOperations'); var safetyZ = this.get('safetyZ'); var travelBits = []; diff --git a/webapp/cnc/app/job/jobView.js b/webapp/cnc/app/job/jobView.js index 08add83e..6011f948 100644 --- a/webapp/cnc/app/job/jobView.js +++ b/webapp/cnc/app/job/jobView.js @@ -11,39 +11,16 @@ define(['Ember', 'cnc/import/svgImporter', 'cnc/import/gerberImporter', 'cnc/imp _this.displayFakeDelete(false); }, function () { $(this).data('hovering', false); - if (_this.get('controller.deleteSlider') == 0) + if (_this.get('controller.deleteSlider') === 0) _this.displayFakeDelete(true); }); this.$('#deleteSlider').mouseup(function () { - if (_this.get('controller.deleteSlider') == 1) { + if (_this.get('controller.deleteSlider') === 1) { _this.get('controller').send('delete'); _this.displayFakeDelete(true); } _this.set('controller.deleteSlider', 0); }); - var currentSwap1 = null; - var currentSwap2 = null; - /* - //sadly removed because drag/drop doesn't work in chrome applications. - Sortable.create(this.$('#operationList')[0], { - draggable: ".list-group-item", - filter: "script", - animation: 150, - scroll: this.$('.jobDetail')[0], - handle: ".arrow-panel", - ghostClass: 'drag-ghost', - onEnd: function (evt) { - var tmp = currentSwap1.get('index'); - currentSwap1.set('index', currentSwap2.get('index')); - currentSwap2.set('index', tmp); - }, - onMove: function (evt) { - currentSwap1 = Ember.View.views[$(evt.dragged).attr('id')].get('parameters.context.model'); - var view = Ember.View.views[$(evt.related).attr('id')]; - if (view) - currentSwap2 = view.get('parameters.context.model'); - } - });*/ }, dragEnter: function (event) { event.preventDefault(); @@ -86,7 +63,7 @@ define(['Ember', 'cnc/import/svgImporter', 'cnc/import/gerberImporter', 'cnc/imp var res = gerberImporter(e.target.result); _this.get('controller').addShapes([res], file.name); } catch (error) { - if (error.message == 'unrecognized file') { + if (error.message === 'unrecognized file') { console.log('unrecognized gerber, trying excellon'); var res2 = excellonImporter(e.target.result); var keys = Object.keys(res2.holes); @@ -129,9 +106,9 @@ define(['Ember', 'cnc/import/svgImporter', 'cnc/import/gerberImporter', 'cnc/imp var files = event.dataTransfer.files; for (var i = 0; i < files.length; i++) { var file = files[i]; - if (file.type.indexOf('svg') != -1 || file.name.match(/\.svg/i)) + if (file.type.indexOf('svg') !== -1 || file.name.match(/\.svg/i)) loadSvg(file); - else if (file.type.indexOf('stl') != -1 || file.name.match(/\.stl/i)) + else if (file.type.indexOf('stl') !== -1 || file.name.match(/\.stl/i)) loadStl(file); else loadGerber(file); } @@ -144,14 +121,14 @@ define(['Ember', 'cnc/import/svgImporter', 'cnc/import/gerberImporter', 'cnc/imp var val = this.get('controller.deleteSlider'); if (this.$()) { this.$('#deleteBlock').css('background-color', 'rgba(255, 0, 0, ' + val + ')'); - if (val == 1) { + if (val === 1) { $('#slideToDelete').hide(); $('#releaseToDelete').show(); } else { $('#slideToDelete').show(); $('#releaseToDelete').hide(); } - if (val == 0 && !this.$('#deleteBlock').data('hovering')) + if (val === 0 && !this.$('#deleteBlock').data('hovering')) this.displayFakeDelete(true); } }.observes('controller.deleteSlider') diff --git a/webapp/cnc/app/models.js b/webapp/cnc/app/models.js index e583d638..fcfa29b1 100644 --- a/webapp/cnc/app/models.js +++ b/webapp/cnc/app/models.js @@ -1,8 +1,8 @@ "use strict"; define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'libs/pako.min', 'base64', 'THREE', - 'libs/threejs/STLLoader', 'cnc/cam/text', 'cnc/app/job/jobModel', 'cnc/app/operationModel', 'require'], - function (Ember, DS, cam, util, pako, base64, THREE, STLLoader, Text, Job, Operation, require) { + 'libs/threejs/STLLoader', 'cnc/cam/text', 'cnc/app/job/jobModel', 'cnc/app/operationModel', 'cnc/app/job/jobAdapter', 'require'], + function (Ember, DS, cam, util, pako, base64, THREE, STLLoader, Text, Job, Operation, JobAdapter, require) { var attr = DS.attr; var PointTransform = DS.Transform.extend({ @@ -20,6 +20,27 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'libs/pako.min', 'base6 return json; } }); + + var JobSerializer = DS.JSONSerializer.extend(DS.EmbeddedRecordsMixin, { + attrs: { + shapes: {embedded: 'always'}, + operations: {embedded: 'always'} + } + }); + + var ShapeSerializer = DS.JSONSerializer.extend(DS.EmbeddedRecordsMixin, { + attrs: { + manualDefinition: {embedded: 'always'} + } + }); + + var OperationSerializer = DS.JSONSerializer.extend(DS.EmbeddedRecordsMixin, { + attrs: { + outline: {serialize: 'ids', deserialize: 'ids'}, + job: {serialize: 'ids', deserialize: 'ids'} + } + }); + var ManualShape = DS.Model.extend({ type: attr('string', {defaultValue: 'rectangle'}), width: attr('number', {defaultValue: 10}), @@ -57,7 +78,7 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'libs/pako.min', 'base6 var worker = _this.get('svgWorker'); if (worker) worker.terminate(); - worker = new Worker(require.toUrl('worker.js')); + worker = new Worker(require.toUrl('worker.js') + '#slice'); _this.set('svgWorker', worker); worker.onmessage = Ember.run.bind(this, function (event) { _this.set('svgWorker', null); @@ -165,7 +186,7 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'libs/pako.min', 'base6 }.property('encodedStlModel'), manualDefinitionChanged: function () { var _this = this; - if (this.get('type') == 'manual') { + if (this.get('type') === 'manual') { this.set('computing', true); Ember.RSVP.resolve(this.get('manualDefinition.svgRepresentation')) .then(function (result) { @@ -180,7 +201,7 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'libs/pako.min', 'base6 if (stlModel == null) return null; var geometry = new STLLoader().parse(stlModel); - if (geometry.type != 'BufferGeometry') + if (geometry.type !== 'BufferGeometry') geometry = new THREE.BufferGeometry().fromGeometry(geometry); return geometry; }.property('stlModel'), @@ -193,8 +214,8 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'libs/pako.min', 'base6 return model.toJSON(); }.property('meshGeometry'), shapeType: function () { - var isManual = this.get('type') == 'manual'; - if (isManual && this.get('manualDefinition.type') == 'point' + var isManual = this.get('type') === 'manual'; + if (isManual && this.get('manualDefinition.type') === 'point' || !isManual && this.get('drillData')) return 'points'; if (!isManual && this.get('stlModel')) @@ -215,6 +236,11 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'libs/pako.min', 'base6 Shape: Shape, ManualShape: ManualShape, PointTransform: PointTransform, - ManualShapeSerializer: ManualShapeSerializer + ManualShapeSerializer: ManualShapeSerializer, + JobSerializer: JobSerializer, + ShapeSerializer: ShapeSerializer, + JobAdapter: JobAdapter, + JobSummaryAdapter: JobAdapter, + OperationSerializer: OperationSerializer } }); \ No newline at end of file diff --git a/webapp/cnc/app/operationModel.js b/webapp/cnc/app/operationModel.js index e4b2107a..e4cb4ea9 100644 --- a/webapp/cnc/app/operationModel.js +++ b/webapp/cnc/app/operationModel.js @@ -43,15 +43,16 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' }.observes('operationComputer').on('didLoad'), computeToolpathObeserved: function () { if (!this.get('outline.computing')) - if (this.get('type') != '3DlinearOperation') { + if (this.get('type') !== '3DlinearOperation') { if (this.get('outline.definition')) Ember.run.debounce(this, this.computeToolpath, 100); - } - else + } else Ember.run.debounce(this, this.compute3D, 100); }.observes('type', 'outline.polyline', 'job.toolRadius', 'job.safetyZ', 'outline.manualDefinition.x', 'outline.manualDefinition.y', 'outline.computing', 'outline.meshGeometry').on('didLoad'), computeToolpath: function () { + if (this.get('isDeleted')) + return; var _this = this; var id = this.get('id'); if (this.get('type')) { @@ -62,7 +63,7 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' _this.set('toolpath', null); _this.set('missedArea', null); _this.set('leftStock', null); - var worker = new Worker(require.toUrl('worker.js')); + var worker = new Worker(require.toUrl('worker.js') + "#toolpathWorker-" + id); this.set('toolpathWorker', worker); worker.onmessage = Ember.run.bind(this, function (event) { if (event.data.terminate && _this.get('toolpathWorker')) { @@ -92,6 +93,8 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' } }, compute3D: function () { + if (this.get('isDeleted')) + return; var _this = this; var safetyZ = this.get('job.safetyZ'); var toolDiameter = this.get('job.toolDiameter'); @@ -132,8 +135,8 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' }, computing: function () { return !!((this.get('task') && !this.get('task.isDone')) - || this.get('toolpathWorker') - || this.get('outline.computing')); + || this.get('toolpathWorker') + || this.get('outline.computing')); }.property('task', 'task.isDone', 'toolpathWorker', 'outline.computing'), paused: function () { return this.get('task.isPaused'); @@ -149,7 +152,7 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' actualFeedrate: function () { if (this.get('feedrateOverride')) { var f = this.get('feedrate'); - return f == 0 ? this.get('job.feedrate') : f; + return f === 0 ? this.get('job.feedrate') : f; } else return this.get('job.feedrate'); }.property('feedrate', 'job.feedrate', 'feedrateOverride'), operationComputer: function () { @@ -193,10 +196,12 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' }, this.get('job.safetyZ'), this.get('toolpath'), this.get('id')); }.property('toolpath', 'job.safetyZ'), computeOperationDuration: function () { + if (this.get('isDeleted')) + return; this.set('operationDuration', 'computing duration...'); if (this.get('durationWorker')) this.get('durationWorker').terminate(); - var worker = new Worker(require.toUrl('worker.js')); + var worker = new Worker(require.toUrl('worker.js' + '#durationWorker')); this.set('durationWorker', worker); var _this = this; worker.onmessage = Ember.run.bind(this, function (event) { @@ -212,7 +217,7 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' observeOperationDuration: function () { this.set('operationDuration', null); if (!this.get('computing')) - Ember.run.debounce(this, 'computeOperationDuration', 100); + Ember.run.debounce(this, 'computeOperationDuration', 500); }.observes('assembledPath', 'actualFeedrate', 'computing'), pushCompactToolpathOn: function (collector) { var feedrate = this.get('actualFeedrate'); @@ -220,7 +225,7 @@ define(['Ember', 'EmberData', 'cnc/cam/cam', 'cnc/util', 'cnc/cam/operations', ' var travelBits = this.get('travelBits'); for (var i = 0; i < travelBits.length; i++) { var fragment = travelBits[i]; - if (fragment.path.length == 0) + if (fragment.path.length === 0) continue; collector.push({ operation: id, diff --git a/webapp/cnc/app/view.js b/webapp/cnc/app/view.js index cb4be660..5cef751b 100644 --- a/webapp/cnc/app/view.js +++ b/webapp/cnc/app/view.js @@ -5,30 +5,6 @@ define(['Ember', 'cnc/ui/threeDView', 'THREE', 'cnc/util', 'cnc/cam/3D/toolProfi classNames: ['rootview'] }); - var LoginView = Ember.View.extend({ - tagName: 'webview', - classNames: ['loginFrame'], - attributeBindings: ['src', ''], - didInsertElement: function () { - this.$().on('loadstop', Ember.run.bind(this, this.loadstop)); - }, - src: function () { - return 'https://auth.firebase.com/v2/popping-fire-1042/auth/' + this.get('controller.model') - + '?v=js-0.0.0&transport=json&suppress_status_codes=true' - }.property('controller.model'), - loadstop: function () { - var _this = this; - var service = _this.get('controller.model'); - var url = this.$().attr('src').split('?')[0]; - if (url.indexOf('/auth/' + service + '/callback') != -1) { - this.$()[0].executeScript({code: 'document.getElementsByTagName("pre")[0].innerHTML;'}, function (res) { - var authData = JSON.parse(res[0]); - _this.get('controller').send('loginWithToken', authData); - }); - } - } - }); - function collectVertices(toolpath, defaultZ) { var res = []; if (toolpath.initialPoint) @@ -115,7 +91,7 @@ define(['Ember', 'cnc/ui/threeDView', 'THREE', 'cnc/util', 'cnc/cam/3D/toolProfi Ember.run.debounce(this, 'syncLeaveStock', 1); }.observes('operation.leftStock').on('init'), visibleChanged: function () { - this.get('threeDNode').setVisibility(this.get('controller.currentOperation') == this.get('operation')); + this.get('threeDNode').setVisibility(this.get('controller.currentOperation') === this.get('operation')); }.observes('controller.currentOperation').on('init') }); @@ -256,7 +232,7 @@ define(['Ember', 'cnc/ui/threeDView', 'THREE', 'cnc/util', 'cnc/cam/3D/toolProfi var startX = middleX - radius * factor; for (i = 0; i < profile.length; i++) { var x = startX + (i / profile.length * radius) * factor; - if (i == 0) + if (i === 0) ctx.moveTo(x, 0); ctx.lineTo(x, Math.max(ctx.canvas.height - (profile[profile.length - i - 1] - min) * factor, 0)); } @@ -285,7 +261,6 @@ define(['Ember', 'cnc/ui/threeDView', 'THREE', 'cnc/util', 'cnc/cam/3D/toolProfi return { ThreeDView: ThreeDView, - LoginView: LoginView, ApplicationView: ApplicationView, JobView: JobView, ToolView: ToolView diff --git a/webapp/cnc/cam/3D/3Dcomputer.js b/webapp/cnc/cam/3D/3Dcomputer.js index c6adc3cc..83f0d490 100644 --- a/webapp/cnc/cam/3D/3Dcomputer.js +++ b/webapp/cnc/cam/3D/3Dcomputer.js @@ -86,7 +86,7 @@ define(['RSVP', 'THREE', 'Piecon', 'cnc/cam/3D/modelProjector', 'cnc/cam/3D/mink var resultHeightField = new HeightField(resultBuffer, bbox, resultBufferWidth, resultBufferHeight, transformMatrix, startRatio, stopRatio, leaveStock + bbox.min.z); - var worker = new Worker(require.toUrl('worker.js')); + var worker = new Worker(require.toUrl('worker.js') + '#3Dping'); var gl = renderer.getContext(); var minkowskiBuffer = new THREE.WebGLRenderTarget(resultTileX, resultTileY, { stencilBuffer: false, generateMipmaps: false, diff --git a/webapp/cnc/cam/pocket.js b/webapp/cnc/cam/pocket.js index 025a0eec..6e1dbc85 100644 --- a/webapp/cnc/cam/pocket.js +++ b/webapp/cnc/cam/pocket.js @@ -257,7 +257,7 @@ define(['RSVP', 'clipper', 'cnc/cam/cam', 'require', 'cnc/util'], function (RSVP var workArray = polygons.map(function (poly) { return createWork(poly, scaledToolRadius, radialEngagementRatio); }); - self.workerPool = createWorkerPool(require.toUrl('worker.js'), workArray, 6); + self.workerPool = createWorkerPool(require.toUrl('worker.js') + '#pocket', workArray, 6); return {workArray: workArray, abort: self.workerPool.abort}; } diff --git a/webapp/cnc/ui/threeDView.js b/webapp/cnc/ui/threeDView.js index c69188c0..a21e7ef7 100644 --- a/webapp/cnc/ui/threeDView.js +++ b/webapp/cnc/ui/threeDView.js @@ -7,11 +7,11 @@ define(['THREE', 'TWEEN', 'cnc/util', 'libs/threejs/OrbitControls', 'cnc/ui/cube return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = (d + Math.random() * 16) % 16 | 0; d = Math.floor(d / 16); - return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); + return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); }); } - var worker = new Worker(require.toUrl('worker.js')); + var worker = new Worker(require.toUrl('worker.js') + '#3DView'); var resultMap = {}; @@ -295,7 +295,7 @@ define(['THREE', 'TWEEN', 'cnc/util', 'libs/threejs/OrbitControls', 'cnc/ui/cube ThreeDView.prototype = { addToolpathFragment: function (fragment) { - this[fragment.speedTag == 'rapid' ? 'rapidToolpathNode' : 'normalToolpathNode'].addCollated(fragment.vertices); + this[fragment.speedTag === 'rapid' ? 'rapidToolpathNode' : 'normalToolpathNode'].addCollated(fragment.vertices); }, clearView: function () { this.clearToolpath(); diff --git a/webapp/compile_ember.sh b/webapp/compile_ember.sh index 3e9046bc..53f41880 100755 --- a/webapp/compile_ember.sh +++ b/webapp/compile_ember.sh @@ -1,3 +1,4 @@ #!/bin/sh -node_modules/ember-precompile/bin/ember-precompile `find templates -name *.hbs` -b templates/ -f templates.js \ No newline at end of file +pwd +./node_modules/ember-precompile/bin/ember-precompile `find templates -name *.hbs` -b templates/ -f templates.js \ No newline at end of file diff --git a/webapp/config.js b/webapp/config.js index a4bb10e4..a6acfb7b 100644 --- a/webapp/config.js +++ b/webapp/config.js @@ -2,10 +2,8 @@ requirejs.config({ paths: { text: 'libs/require_text', shader: 'require_shader', - Firebase: 'libs/firebase', Ember: "libs/ember.min", EmberData: "libs/ember-data.min", - EmberFire: "libs/emberfire", Handlebars: "libs/handlebars-v1.3.0", jQuery: "libs/jquery-1.11.1.min", THREE: 'libs/threejs/three-depthtextures', @@ -30,8 +28,6 @@ requirejs.config({ }, canvg: {deps: ["libs/canvg/rgbcolor.js"], exports: "canvg"}, EmberData: {deps: ["Ember"], exports: "DS"}, - Firebase: {exports: 'Firebase'}, - EmberFire: {deps: ["EmberData", "Firebase"], exports: "DS"}, THREE: {exports: 'THREE'}, TWEEN: {exports: 'TWEEN'}, 'libs/threejs/OrbitControls': {deps: ['THREE'], exports: 'THREE.OrbitControls'}, diff --git a/webapp/libs/ember-data.min.js b/webapp/libs/ember-data.min.js index 6a3cc07b..eb95339f 100644 --- a/webapp/libs/ember-data.min.js +++ b/webapp/libs/ember-data.min.js @@ -1,3 +1,4244 @@ -(function(e){var r,t,i,a;(function(){var e;if(!Array.isArray){e=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}else{e=Array.isArray}var n={},s={},o={};var u=false;r=function(r,t,i){if(!e(t)){i=t;t=[]}n[r]={deps:t,callback:i}};function d(e,r,t){var a=e.length;var n=new Array(a);var s;var o;for(var u=0,d=a;u=t){n=0;s.push([])}n+=r;var i=s.length-1;s[i].push(e)});return s}var s=[];t.forEach(function(e,r){var t=2048;var i=a(e,t);o.call(i,function(e){s.push(e)})});return s},pathForType:function(e){var r=Ember.String.camelize(e);return Ember.String.pluralize(r)},ajaxError:function(e,r){if(e&&typeof e==="object"){e.then=null}return e},ajaxSuccess:function(e,r){return r},ajax:function(e,r,t){var i=this;return new Ember.RSVP.Promise(function(n,s){var o=i.ajaxOptions(e,r,t);o.success=function(e,r,t){e=i.ajaxSuccess(t,e);if(e instanceof a){Ember.run(null,s,e)}else{Ember.run(null,n,e)}};o.error=function(e,r,t){Ember.run(null,s,i.ajaxError(e,e.responseText))};Ember.$.ajax(o)},"DS: RESTAdapter#ajax "+r+" to "+e)},ajaxOptions:function(e,r,t){var i=t||{};i.url=e;i.type=r;i.dataType="json";i.context=this;if(i.data&&r!=="GET"){i.contentType="application/json; charset=utf-8";i.data=JSON.stringify(i.data)}var a=s(this,"headers");if(a!==undefined){i.beforeSend=function(e){o.call(Ember.keys(a),function(r){e.setRequestHeader(r,a[r])})}}return i}});function u(e,r){if(typeof String.prototype.endsWith!=="function"){return e.indexOf(r,e.length-r.length)!==-1}else{return e.endsWith(r)}}});r("ember-data/core",["exports"],function(e){"use strict";var r;if("undefined"===typeof r){r=Ember.Namespace.create({VERSION:"1.0.0-beta.11"});if(Ember.libraries){Ember.libraries.registerCoreLibrary("Ember Data",r.VERSION)}}e["default"]=r});r("ember-data/ember-initializer",["ember-data/setup-container"],function(e){"use strict";var r=e["default"];var t=Ember.K;Ember.onLoad("Ember.Application",function(e){e.initializer({name:"ember-data",initialize:r});e.initializer({name:"store",after:"ember-data",initialize:t});e.initializer({name:"activeModelAdapter",before:"store",initialize:t});e.initializer({name:"transforms",before:"store",initialize:t});e.initializer({name:"data-adapter",before:"store",initialize:t});e.initializer({name:"injectStore",before:"store",initialize:t})})});r("ember-data/ext/date",[],function(){"use strict";Ember.Date=Ember.Date||{};var e=Date.parse,r=[1,4,5,6,7,10,11];Ember.Date.parse=function(t){var i,a,n=0;if(a=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)){for(var s=0,o;o=r[s];++s){a[o]=+a[o]||0}a[2]=(+a[2]||1)-1;a[3]=+a[3]||1;if(a[8]!=="Z"&&a[9]!==undefined){n=a[10]*60+a[11];if(a[9]==="+"){n=0-n}}i=Date.UTC(a[1],a[2],a[3],a[4],a[5]+n,a[6],a[7])}else{i=e?e(t):NaN}return i};if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.Date){Date.parse=Ember.Date.parse}});r("ember-data/initializers/data_adapter",["ember-data/system/debug/debug_adapter","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=function i(e){e.register("data-adapter:main",t)}});r("ember-data/initializers/store",["ember-data/serializers","ember-data/adapters","ember-data/system/container_proxy","ember-data/system/store","exports"],function(e,r,t,i,a){"use strict";var n=e.JSONSerializer;var s=e.RESTSerializer;var o=r.RESTAdapter;var u=t["default"];var d=i["default"];a["default"]=function c(e,r){e.register("store:main",e.lookupFactory("store:application")||r&&r.Store||d);var t=new u(e);t.registerDeprecations([{deprecated:"serializer:_default",valid:"serializer:-default"},{deprecated:"serializer:_rest",valid:"serializer:-rest"},{deprecated:"adapter:_rest",valid:"adapter:-rest"}]);e.register("serializer:-default",n);e.register("serializer:-rest",s);e.register("adapter:-rest",o);e.lookup("store:main")}});r("ember-data/initializers/store_injections",["exports"],function(e){"use strict";e["default"]=function r(e){e.injection("controller","store","store:main");e.injection("route","store","store:main");e.injection("serializer","store","store:main");e.injection("data-adapter","store","store:main")}});r("ember-data/initializers/transforms",["ember-data/transforms","exports"],function(e,r){"use strict";var t=e.BooleanTransform;var i=e.DateTransform;var a=e.StringTransform;var n=e.NumberTransform;r["default"]=function s(e){e.register("transform:boolean",t);e.register("transform:date",i);e.register("transform:number",n);e.register("transform:string",a)}});r("ember-data/serializers",["ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.JSONSerializer=i;t.RESTSerializer=a});r("ember-data/serializers/embedded_records_mixin",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.EnumerableUtils.forEach;var i=Ember.String.camelize;var a=Ember.Mixin.create({normalize:function(e,r,t){var i=this._super(e,r,t);return n(this,this.store,e,i)},keyForRelationship:function(e,r){if(this.hasDeserializeRecordsOption(e)){return this.keyForAttribute(e)}else{return this._super(e,r)||e}},serializeBelongsTo:function(e,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o=e.get(a);var u;if(n){u=this.keyForRelationship(a,i.kind);if(!o){t[u]=null}else{t[u]=r(o,"id")}}else if(s){u=this.keyForAttribute(a);if(!o){t[u]=null}else{t[u]=o.serialize({includeId:true});this.removeEmbeddedForeignKey(e,o,i,t[u])}}},serializeHasMany:function(e,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o;if(n){o=this.keyForRelationship(a,i.kind);t[o]=r(e,a).mapBy("id")}else if(s){o=this.keyForAttribute(a);t[o]=r(e,a).map(function(r){var t=r.serialize({includeId:true});this.removeEmbeddedForeignKey(e,r,i,t);return t},this)}},removeEmbeddedForeignKey:function(e,r,t,i){if(t.kind==="hasMany"){return}else if(t.kind==="belongsTo"){var a=e.constructor.inverseFor(t.key);if(a){var n=a.name;var s=this.store.serializerFor(r.constructor);var o=s.keyForRelationship(n,a.kind);if(o){delete i[o]}}}},hasEmbeddedAlwaysOption:function(e){var r=this.attrsOption(e);return r&&r.embedded==="always"},hasSerializeRecordsOption:function(e){var r=this.hasEmbeddedAlwaysOption(e);var t=this.attrsOption(e);return r||t&&t.serialize==="records"},hasSerializeIdsOption:function(e){var r=this.attrsOption(e);return r&&(r.serialize==="ids"||r.serialize==="id")},noSerializeOptionSpecified:function(e){var r=this.attrsOption(e);return!(r&&(r.serialize||r.embedded))},hasDeserializeRecordsOption:function(e){var r=this.hasEmbeddedAlwaysOption(e);var t=this.attrsOption(e);return r||t&&t.deserialize==="records"},attrsOption:function(e){var r=this.get("attrs");return r&&(r[i(e)]||r[e])}});function n(e,r,t,i){t.eachRelationship(function(t,a){if(e.hasDeserializeRecordsOption(t)){var n=r.modelFor(a.type.typeKey);if(a.kind==="hasMany"){if(a.options.polymorphic){o(r,t,i)}else{s(r,t,n,i)}}if(a.kind==="belongsTo"){u(r,t,n,i)}}});return i}function s(e,r,i,a){if(!a[r]){return a}var n=[];var s=e.serializerFor(i.typeKey);t(a[r],function(r){var t=s.normalize(i,r,null);e.push(i,t);n.push(t.id)});a[r]=n;return a}function o(e,i,a){if(!a[i]){return a}var n=[];t(a[i],function(t){var i=t.type;var a=e.serializerFor(i);var s=e.modelFor(i);var o=r(a,"primaryKey");var u=a.normalize(s,t,null);e.push(s,u);n.push({id:u[o],type:i})});a[i]=n;return a}function u(e,r,t,i){if(!i[r]){return i}var a=e.serializerFor(t.typeKey);var n=a.normalize(t,i[r],null);e.push(t,n);i[r]=n.id;return i}e["default"]=a});r("ember-data/serializers/json_serializer",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.isNone;var i=Ember.ArrayPolyfills.map;var a=Ember.merge;e["default"]=Ember.Object.extend({primaryKey:"id",applyTransforms:function(e,r){e.eachTransformedAttribute(function t(e,i){if(!r.hasOwnProperty(e)){return}var a=this.transformFor(i);r[e]=a.deserialize(r[e])},this);return r},normalize:function(e,r){if(!r){return r}this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r);this.applyTransforms(e,r);return r},normalizePayload:function(e){return e},normalizeAttributes:function(e,r){var t;if(this.keyForAttribute){e.eachAttribute(function(e){t=this.keyForAttribute(e);if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeRelationships:function(e,r){var t;if(this.keyForRelationship){e.eachRelationship(function(e,i){t=this.keyForRelationship(e,i.kind);if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeUsingDeclaredMapping:function(e,t){var i=r(this,"attrs"),a,n;if(i){for(n in i){a=this._getMappedKey(n);if(!t.hasOwnProperty(a)){continue}if(a!==n){t[n]=t[a];delete t[a]}}}},normalizeId:function(e){var t=r(this,"primaryKey");if(t==="id"){return}e.id=e[t];delete e[t]},_getMappedKey:function(e){var t=r(this,"attrs");var i;if(t&&t[e]){i=t[e];if(i.key){i=i.key}if(typeof i==="string"){e=i}}return e},_canSerialize:function(e){var t=r(this,"attrs");return!t||!t[e]||t[e].serialize!==false},serialize:function(e,t){var i={};if(t&&t.includeId){var a=r(e,"id");if(a){i[r(this,"primaryKey")]=a}}e.eachAttribute(function(r,t){this.serializeAttribute(e,i,r,t)},this);e.eachRelationship(function(r,t){if(t.kind==="belongsTo"){this.serializeBelongsTo(e,i,t)}else if(t.kind==="hasMany"){this.serializeHasMany(e,i,t)}},this);return i},serializeIntoHash:function(e,r,t,i){a(e,this.serialize(t,i))},serializeAttribute:function(e,t,i,a){var n=a.type;if(this._canSerialize(i)){var s=r(e,i);if(n){var o=this.transformFor(n);s=o.serialize(s)}var u=this._getMappedKey(i);if(u===i&&this.keyForAttribute){u=this.keyForAttribute(i)}t[u]=s}},serializeBelongsTo:function(e,i,a){var n=a.key;if(this._canSerialize(n)){var s=r(e,n);var o=this._getMappedKey(n);if(o===n&&this.keyForRelationship){o=this.keyForRelationship(n,"belongsTo")}if(t(s)||t(r(s,"id"))){i[o]=null}else{i[o]=r(s,"id")}if(a.options.polymorphic){this.serializePolymorphicType(e,i,a)}}},serializeHasMany:function(e,t,i){var a=i.key;if(this._canSerialize(a)){var n;n=this._getMappedKey(a);if(n===a&&this.keyForRelationship){n=this.keyForRelationship(a,"hasMany")}var s=e.constructor.determineRelationshipType(i);if(s==="manyToNone"||s==="manyToMany"){t[n]=r(e,a).mapBy("id")}}},serializePolymorphicType:Ember.K,extract:function(e,r,t,i,a){this.extractMeta(e,r,t);var n="extract"+a.charAt(0).toUpperCase()+a.substr(1);return this[n](e,r,t,i,a)},extractFindAll:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindQuery:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindHasMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractCreateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractUpdateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractDeleteRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractFind:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractFindBelongsTo:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSave:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSingle:function(e,r,t,i,a){t=this.normalizePayload(t);return this.normalize(r,t)},extractArray:function(e,r,t,a,n){var s=this.normalizePayload(t);var o=this;return i.call(s,function(e){return o.normalize(r,e)})},extractMeta:function(e,r,t){if(t&&t.meta){e.metaForType(r,t.meta);delete t.meta}},keyForAttribute:function(e){return e},keyForRelationship:function(e,r){return e},transformFor:function(e,r){var t=this.container.lookup("transform:"+e);return t}})});r("ember-data/serializers/rest_serializer",["ember-data/serializers/json_serializer","ember-inflector/system/string","exports"],function(e,r,t){"use strict";var i=e["default"];var a=Ember.get;var n=Ember.ArrayPolyfills.forEach;var s=Ember.ArrayPolyfills.map;var o=Ember.String.camelize;var u=r.singularize;function d(e){return e==null?null:e+""}var c=i.extend({normalize:function(e,r,t){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r);if(this.normalizeHash&&this.normalizeHash[t]){this.normalizeHash[t](r)}this.applyTransforms(e,r);return r},extractSingle:function(e,r,t,i){var a=this.normalizePayload(t);var s=r.typeKey;var o;for(var u in a){var c=this.typeForRoot(u);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=l.typeKey===s;var h=a[u];if(f&&Ember.typeOf(h)!=="array"){o=this.normalize(r,h,u);continue}n.call(h,function(r){var t=this.typeForRoot(u);var a=e.modelFor(t);var n=e.serializerFor(a);r=n.normalize(a,r,u);var s=f&&!i&&!o;var c=f&&d(r.id)===i;if(s||c){o=r}else{e.push(t,r)}},this)}return o},extractArray:function(e,r,t){var i=this.normalizePayload(t);var a=r.typeKey;var n;for(var o in i){var u=o;var d=false;if(o.charAt(0)==="_"){d=true;u=o.substr(1)}var c=this.typeForRoot(u);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=e.serializerFor(l);var h=!d&&l.typeKey===a;var p=s.call(i[o],function(e){return f.normalize(l,e,o)},this);if(h){n=p}else{e.pushMany(c,p)}}return n},pushPayload:function(e,r){var t=this.normalizePayload(r);for(var i in t){var a=this.typeForRoot(i);if(!e.modelFactoryFor(a,i)){continue}var n=e.modelFor(a);var o=e.serializerFor(n);var u=s.call(Ember.makeArray(t[i]),function(e){return o.normalize(n,e,i)},this);e.pushMany(a,u)}},typeForRoot:function(e){return o(u(e))},serialize:function(e,r){return this._super.apply(this,arguments)},serializeIntoHash:function(e,r,t,i){e[r.typeKey]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var n=a(e,i);i=this.keyForAttribute?this.keyForAttribute(i):i;if(Ember.isNone(n)){r[i+"Type"]=null}else{r[i+"Type"]=Ember.String.camelize(n.constructor.typeKey)}}});t["default"]=c});r("ember-data/setup-container",["ember-data/initializers/store","ember-data/initializers/transforms","ember-data/initializers/store_injections","ember-data/initializers/data_adapter","activemodel-adapter/setup-container","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=t["default"];var d=i["default"];var c=a["default"];n["default"]=function l(e,r){d(e,r);o(e,r);u(e,r);s(e,r);c(e,r)}});r("ember-data/system/adapter",["exports"],function(e){"use strict";var r=Ember.get;var t=["description","fileName","lineNumber","message","name","number","stack"];function i(e){var r=Error.prototype.constructor.call(this,"The backend rejected the commit because it was invalid: "+Ember.inspect(e));this.errors=e;for(var i=0,a=t.length;i0;r--){t=e[r-1];i=t["deprecated"];a=t["valid"];this.registerDeprecation(i,a)}};e["default"]=r});r("ember-data/system/debug",["ember-data/system/debug/debug_info","ember-data/system/debug/debug_adapter","exports"],function(e,r,t){"use strict";var i=r["default"];t["default"]=i});r("ember-data/system/debug/debug_adapter",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;var i=Ember.get;var a=Ember.String.capitalize;var n=Ember.String.underscore;r["default"]=Ember.DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==t&&t.detect(e)},columnsForType:function(e){var r=[{name:"id",desc:"Id"}];var t=0;var s=this;i(e,"attributes").forEach(function(e,i){if(t++>s.attributeLimit){return false}var o=a(n(i).replace("_"," "));r.push({name:i,desc:o})});return r},getRecords:function(e){return this.get("store").all(e)},getRecordColumnValues:function(e){var r=this,t=0;var a={id:i(e,"id")};e.eachAttribute(function(n){if(t++>r.attributeLimit){return false}var s=i(e,n);a[n]=s});return a},getRecordKeywords:function(e){var r=[];var t=Ember.A(["id"]);e.eachAttribute(function(e){t.push(e)});t.forEach(function(t){r.push(i(e,t))});return r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("isDirty")&&!e.get("isNew"),isClean:!e.get("isDirty")}},getRecordColor:function(e){var r="black";if(e.get("isNew")){r="green"}else if(e.get("isDirty")){r="blue"}return r},observeRecord:function(e,r){var t=Ember.A(),i=this;var a=Ember.A(["id","isNew","isDirty"]);e.eachAttribute(function(e){a.push(e)});a.forEach(function(a){var n=function(){r(i.wrapRecord(e))};Ember.addObserver(e,a,n);t.push(function(){Ember.removeObserver(e,a,n)})});var n=function(){t.forEach(function(e){e()})};return n}})});r("ember-data/system/debug/debug_info",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;t.reopen({_debugInfo:function(){var e=["id"],r={belongsTo:[],hasMany:[]},t=[];this.eachAttribute(function(r,t){e.push(r)},this);this.eachRelationship(function(e,i){r[i.kind].push(e);t.push(e)});var i=[{name:"Attributes",properties:e,expand:true},{name:"Belongs To",properties:r.belongsTo,expand:true},{name:"Has Many",properties:r.hasMany,expand:true},{name:"Flags",properties:["isLoaded","isDirty","isSaving","isDeleted","isError","isNew","isValid"]}];return{propertyInfo:{includeOtherProperties:true,groups:i,expensiveProperties:t}}}});r["default"]=t});r("ember-data/system/map",["exports"],function(e){"use strict";var r,t;function i(){Ember.OrderedSet.apply(this,arguments)}function a(){Ember.Map.apply(this,arguments)}function n(){Ember.MapWithDefault.apply(this,arguments)}var s=Ember.Map.create();s.set("key","value");var o=false;s.forEach(function(e,r){o=e==="key"&&r==="value"});a.prototype=Object.create(Ember.Map.prototype);n.prototype=Object.create(Ember.MapWithDefault.prototype);i.prototype=Object.create(Ember.OrderedSet.prototype);i.create=function(){return new i};function u(e){return function(r,t){e.call(this,t,r)}}if(o){r=function(e,r){this.__super$forEach(u(e),r)};t=function(e){this.remove(e)};a.prototype.__super$forEach=Ember.Map.prototype.forEach;a.prototype.forEach=r;a.prototype["delete"]=t;n.prototype.forEach=r;n.prototype.__super$forEach=Ember.MapWithDefault.prototype.forEach;n.prototype["delete"]=t;i.prototype["delete"]=t}n.constructor=n;a.constructor=a;n.create=function(e){if(e){return new n(e)}else{return new a}};a.create=function(){return new this.constructor};e["default"]=a;e.Map=a;e.MapWithDefault=n;e.OrderedSet=i});r("ember-data/system/model",["ember-data/system/model/model","ember-data/system/model/attributes","ember-data/system/model/states","ember-data/system/model/errors","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var u=i["default"];a.Model=n;a.RootState=o;a.attr=s;a.Errors=u});r("ember-data/system/model/attributes",["ember-data/system/model/model","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r.Map;var n=Ember.get;i.reopenClass({attributes:Ember.computed(function(){var e=a.create();this.eachComputedProperty(function(r,t){if(t.isAttribute){t.name=r;e.set(r,t)}});return e}).readOnly(),transformedAttributes:Ember.computed(function(){var e=a.create();this.eachAttribute(function(r,t){if(t.type){e.set(r,t.type)}});return e}).readOnly(),eachAttribute:function(e,r){n(this,"attributes").forEach(function(t,i){e.call(r,i,t)},r)},eachTransformedAttribute:function(e,r){n(this,"transformedAttributes").forEach(function(t,i){e.call(r,i,t)})}});i.reopen({eachAttribute:function(e,r){this.constructor.eachAttribute(e,r)}});function s(e,r,t){if(typeof r.defaultValue==="function"){return r.defaultValue.apply(null,arguments)}else{return r.defaultValue}}function o(e,r){return e._attributes.hasOwnProperty(r)||e._inFlightAttributes.hasOwnProperty(r)||e._data.hasOwnProperty(r) -}function u(e,r){if(e._attributes.hasOwnProperty(r)){return e._attributes[r]}else if(e._inFlightAttributes.hasOwnProperty(r)){return e._inFlightAttributes[r]}else{return e._data[r]}}t["default"]=function d(e,r){r=r||{};var t={type:e,isAttribute:true,options:r};return Ember.computed("data",function(e,t){if(arguments.length>1){var i=u(this,e);if(t!==i){this._attributes[e]=t;this.send("didSetProperty",{name:e,oldValue:i,originalValue:this._data[e],value:t})}return t}else if(o(this,e)){return u(this,e)}else{return s(this,r,e)}}).meta(t)}});r("ember-data/system/model/errors",["ember-data/system/map","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.isEmpty;var a=Ember.EnumerableUtils.map;var n=e.MapWithDefault;r["default"]=Ember.Object.extend(Ember.Enumerable,Ember.Evented,{registerHandlers:function(e,r,t){this.on("becameInvalid",e,r);this.on("becameValid",e,t)},errorsByAttributeName:Ember.reduceComputed("content",{initialValue:function(){return n.create({defaultValue:function(){return Ember.A()}})},addedItem:function(e,r){e.get(r.attribute).pushObject(r);return e},removedItem:function(e,r){e.get(r.attribute).removeObject(r);return e}}),errorsFor:function(e){return t(this,"errorsByAttributeName").get(e)},messages:Ember.computed.mapBy("content","message"),content:Ember.computed(function(){return Ember.A()}),unknownProperty:function(e){var r=this.errorsFor(e);if(i(r)){return null}return r},nextObject:function(e,r,i){return t(this,"content").objectAt(e)},length:Ember.computed.oneWay("content.length").readOnly(),isEmpty:Ember.computed.not("length").readOnly(),add:function(e,r){var i=t(this,"isEmpty");r=this._findOrCreateMessages(e,r);t(this,"content").addObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(i&&!t(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return a(Ember.makeArray(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(t(this,"isEmpty")){return}var r=t(this,"content").rejectBy("attribute",e);t(this,"content").setObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(t(this,"isEmpty")){this.trigger("becameValid")}},clear:function(){if(t(this,"isEmpty")){return}t(this,"content").clear();this.enumerableContentDidChange();this.trigger("becameValid")},has:function(e){return!i(this.errorsFor(e))}})});r("ember-data/system/model/model",["ember-data/system/model/states","ember-data/system/model/errors","ember-data/system/promise_proxies","ember-data/system/relationships/relationship","exports"],function(e,r,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=i.PromiseObject;var d=a.createRelationshipFor;var c=Ember.get;var l=Ember.set;var f=Ember.merge;var h=Ember.RSVP.Promise;var p=Ember.ArrayPolyfills.forEach;var m=Ember.ArrayPolyfills.map;var y;var v=Ember.computed("currentState",function(e,r){return c(c(this,"currentState"),e)}).readOnly();var b=Object.create(null);var g=Object.create(null);function R(e){return g[e]||(g[e]=e.split("."))}function E(e){return b[e]||(b[e]=R(e)[0])}var _=Ember.Object.extend(Ember.Evented,{_recordArrays:undefined,_relationships:undefined,_loadingRecordArrays:undefined,isEmpty:v,isLoading:v,isLoaded:v,isDirty:v,isSaving:v,isDeleted:v,isNew:v,isValid:v,dirtyType:v,isError:false,isReloading:false,clientId:null,id:null,currentState:s.empty,errors:Ember.computed(function(){var e=o.create();e.registerHandlers(this,function(){this.send("becameInvalid")},function(){this.send("becameValid")});return e}).readOnly(),serialize:function(e){var r=c(this,"store");return r.serialize(this,e)},toJSON:function(e){if(!y){y=t("ember-data/serializers/json_serializer")["default"]}var r=y.create({container:this.container});return r.serialize(this,e)},didLoad:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,data:Ember.computed(function(){this._data=this._data||{};return this._data}).readOnly(),_data:null,init:function(){this._super();this._setup()},_setup:function(){this._changesToSync={};this._deferredTriggers=[];this._data={};this._attributes={};this._inFlightAttributes={};this._relationships={};this._implicitRelationships=Object.create(null);var e=this;this.constructor.eachRelationship(function(r,t){e._relationships[r]=d(e,t,e.store)})},send:function(e,r){var t=c(this,"currentState");if(!t[e]){this._unhandledEvent(t,e,r)}return t[e](this,r)},transitionTo:function(e){var r=E(e);var t=c(this,"currentState");var i=t;do{if(i.exit){i.exit(this)}i=i.parentState}while(!i.hasOwnProperty(r));var a=R(e);var n=[],s=[],o,u;for(o=0,u=a.length;o0;if(!i){e.send("rolledBack")}},pushedData:Ember.K,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,t){t(r(e,"store").reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollback()}},inFlight:{isSaving:true,didSetProperty:i,becomeDirty:Ember.K,pushedData:Ember.K,unloadRecord:function(e){},willCommit:Ember.K,didCommit:function(e){var t=r(this,"dirtyType");e.transitionTo("saved");e.send("invokeLifecycleCallbacks",t)},becameInvalid:function(e){e.transitionTo("invalid");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},invalid:{isValid:false,deleteRecord:function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()},didSetProperty:function(e,t){r(e,"errors").remove(t.name);i(e,t)},becomeDirty:Ember.K,willCommit:function(e){r(e,"errors").clear();e.transitionTo("inFlight")},rolledBack:function(e){r(e,"errors").clear()},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)},exit:function(e){e._inFlightAttributes={}}}};function n(e){var r={},t;for(var i in e){t=e[i];if(t&&typeof t==="object"){r[i]=n(t)}else{r[i]=t}}return r}function s(e,r){for(var t in r){e[t]=r[t]}return e}function o(e){var r=n(a);return s(r,e)}var u=o({dirtyType:"created",isNew:true});u.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var d=o({dirtyType:"updated"});u.uncommitted.deleteRecord=function(e){e.disconnectRelationships();e.transitionTo("deleted.saved")};u.uncommitted.rollback=function(e){a.uncommitted.rollback.apply(this,arguments);e.transitionTo("deleted.saved")};u.uncommitted.propertyWasReset=Ember.K;function c(e){}d.inFlight.unloadRecord=c;d.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()};var l={isEmpty:false,isLoading:false,isLoaded:false,isDirty:false,isSaving:false,isDeleted:false,isNew:false,isValid:true,rolledBack:Ember.K,unloadRecord:function(e){e.clearRelationships();e.transitionTo("deleted.saved")},propertyWasReset:Ember.K,empty:{isEmpty:true,loadingData:function(e,r){e._loadingPromise=r;e.transitionTo("loading")},loadedData:function(e){e.transitionTo("loaded.created.uncommitted");e.notifyPropertyChange("data")},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad")}},loading:{isLoading:true,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");t(e,"isError",false)},becameError:function(e){e.triggerLater("becameError",e)},notFound:function(e){e.transitionTo("empty")}},loaded:{initialState:"saved",isLoaded:true,loadingData:Ember.K,saved:{setup:function(e){var r=e._attributes;var t=false;for(var i in r){if(r.hasOwnProperty(i)){t=true;break}}if(t){e.adapterDidDirty()}},didSetProperty:i,pushedData:Ember.K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,t){t(r(e,"store").reloadRecord(e))},deleteRecord:function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()},unloadRecord:function(e){e.clearRelationships();e.transitionTo("deleted.saved")},didCommit:function(e){e.send("invokeLifecycleCallbacks",r(e,"lastDirtyType"))},notFound:Ember.K},created:u,updated:d},deleted:{initialState:"uncommitted",dirtyType:"deleted",isDeleted:true,isLoaded:true,isDirty:true,setup:function(e){e.updateRecordArrays()},uncommitted:{willCommit:function(e){e.transitionTo("inFlight")},rollback:function(e){e.rollback()},becomeDirty:Ember.K,deleteRecord:Ember.K,rolledBack:function(e){e.transitionTo("loaded.saved")}},inFlight:{isSaving:true,unloadRecord:c,willCommit:Ember.K,didCommit:function(e){e.transitionTo("saved");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},saved:{isDirty:false,setup:function(e){var t=r(e,"store");t.dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e);e.triggerLater("didCommit",e)},willCommit:Ember.K,didCommit:Ember.K}},invokeLifecycleCallbacks:function(e,r){if(r==="created"){e.triggerLater("didCreate",e)}else{e.triggerLater("didUpdate",e)}e.triggerLater("didCommit",e)}};function f(e,r,t){e=s(r?Ember.create(r):{},e);e.parentState=r;e.stateName=t;for(var i in e){if(!e.hasOwnProperty(i)||i==="parentState"||i==="stateName"){continue}if(typeof e[i]==="object"){e[i]=f(e[i],e,t+"."+i)}}return e}l=f(l,null,"root");e["default"]=l});r("ember-data/system/promise_proxies",["exports"],function(e){"use strict";var r=Ember.RSVP.Promise;var t=Ember.get;var i=Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);var a=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var n=function(e,t){return a.create({promise:r.resolve(e,t)})};var s=function(e,t){return i.create({promise:r.resolve(e,t)})};var o=i.extend({reload:function(){return t(this,"content").reload()}});var u=function(e,t){return o.create({promise:r.resolve(e,t)})};e.PromiseArray=i;e.PromiseObject=a;e.PromiseManyArray=o;e.promiseArray=s;e.promiseObject=n;e.promiseManyArray=u});r("ember-data/system/record_array_manager",["ember-data/system/record_arrays","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.RecordArray;var a=e.FilteredRecordArray;var n=e.AdapterPopulatedRecordArray;var s=e.ManyArray;var o=r.MapWithDefault;var u=r.OrderedSet;var d=Ember.get;var c=Ember.EnumerableUtils.forEach;t["default"]=Ember.Object.extend({init:function(){this.filteredRecordArrays=o.create({defaultValue:function(){return[]}});this.changedRecords=[];this._adapterPopulatedRecordArrays=[]},recordDidChange:function(e){if(this.changedRecords.push(e)!==1){return}Ember.run.schedule("actions",this,this.updateRecordArrays)},recordArraysForRecord:function(e){e._recordArrays=e._recordArrays||u.create();return e._recordArrays},updateRecordArrays:function(){c(this.changedRecords,function(e){if(d(e,"isDeleted")){this._recordWasDeleted(e)}else{this._recordWasChanged(e)}},this);this.changedRecords.length=0},_recordWasDeleted:function(e){var r=e._recordArrays;if(!r){return}r.forEach(function(r){r.removeRecord(e)});e._recordArrays=null},_recordWasChanged:function(e){var r=e.constructor;var t=this.filteredRecordArrays.get(r);var i;c(t,function(t){i=d(t,"filterFunction");this.updateRecordArray(t,i,r,e)},this);var a=e._loadingRecordArrays;if(a){for(var n=0,s=a.length;n0){a=i(this,"content").slice(e,e+r);this.get("relationship").removeRecords(a)}if(t){this.get("relationship").addRecords(t,e)}},reload:function(){return this.relationship.reload()},createRecord:function(e){var r=i(this,"store");var t=i(this,"type");var a;a=r.createRecord.call(r,t,e);this.pushObject(a);return a}})});r("ember-data/system/record_arrays/record_array",["ember-data/system/promise_proxies","exports"],function(e,r){"use strict";var t=e.PromiseArray;var i=Ember.get;r["default"]=Ember.ArrayProxy.extend(Ember.Evented,{type:null,content:null,isLoaded:false,isUpdating:false,store:null,objectAtContent:function(e){var r=i(this,"content");return r.objectAt(e)},update:function(){if(i(this,"isUpdating")){return}var e=i(this,"store");var r=i(this,"type");return e.fetchAll(r,this)},addRecord:function(e,r){var t=i(this,"content");if(r===undefined){t.addObject(e)}else{if(!t.contains(e)){t.insertAt(r,e)}}},pushRecord:function(e){i(this,"content").pushObject(e)},removeRecord:function(e){i(this,"content").removeObject(e)},save:function(){var e="DS: RecordArray#save "+i(this,"type");var r=Ember.RSVP.all(this.invoke("save"),e).then(function(e){return Ember.A(e)},null,"DS: RecordArray#save apply Ember.NativeArray");return t.create({promise:r})},_dissociateFromOwnRecords:function(){var e=this;this.forEach(function(r){var t=r._recordArrays;if(t){t["delete"](e)}})},willDestroy:function(){this._dissociateFromOwnRecords();this._super()}})});r("ember-data/system/relationship-meta",["ember-inflector/system","exports"],function(e,r){"use strict";var t=e.singularize;function i(e,r){var i,a;i=r.type||r.key;if(typeof i==="string"){if(r.kind==="hasMany"){i=t(i)}a=e.modelFor(i)}else{a=r.type}return a}r.typeForRelationshipMeta=i;function a(e,r){return{key:r.key,kind:r.kind,type:i(e,r),options:r.options,parentType:r.parentType,isRelationship:true}}r.relationshipFromMeta=a});r("ember-data/system/relationships",["./relationships/belongs_to","./relationships/has_many","ember-data/system/relationships/ext","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];i.belongsTo=a;i.hasMany=n});r("ember-data/system/relationships/belongs_to",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(e,r){if(typeof e==="object"){r=e;e=undefined}else{}r=r||{};var t={type:e,isRelationship:true,options:r,kind:"belongsTo",key:null};return Ember.computed(function(e,r){if(arguments.length>1){if(r===undefined){r=null}if(r&&r.then){this._relationships[e].setRecordPromise(r)}else{this._relationships[e].setRecord(r)}}return this._relationships[e].getRecord()}).meta(t)}t.reopen({notifyBelongsToAdded:function(e,r){this.notifyPropertyChange(e)},notifyBelongsToRemoved:function(e){this.notifyPropertyChange(e)}});r["default"]=i});r("ember-data/system/relationships/ext",["ember-data/system/relationship-meta","ember-data/system/model","ember-data/system/map"],function(e,r,t){"use strict";var i=e.typeForRelationshipMeta;var a=e.relationshipFromMeta;var n=r.Model;var s=t.Map;var o=t.MapWithDefault;var u=Ember.get;var d=Ember.ArrayPolyfills.filter;n.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});n.reopenClass({typeForRelationship:function(e){var r=u(this,"relationshipsByName").get(e);return r&&r.type},inverseMap:Ember.computed(function(){return Object.create(null)}),inverseFor:function(e){var r=u(this,"inverseMap");if(r[e]){return r[e]}else{var t=this._findInverseFor(e);r[e]=t;return t}},_findInverseFor:function(e){var r=this.typeForRelationship(e);if(!r){return null}var t=this.metaForProperty(e).options;if(t.inverse===null){return null}var i,a,n;if(t.inverse){i=t.inverse;n=Ember.get(r,"relationshipsByName").get(i);a=n.kind}else{var s=c(this,r);if(s.length===0){return null}var o=d.call(s,function(t){var i=r.metaForProperty(t.name).options;return e===i.inverse});if(o.length===1){s=o}i=s[0].name;a=s[0].kind}function c(r,t,i){var a=i||[];var n=u(t,"relationships");if(!n){return}var s=n.get(r);s=d.call(s,function(r){var i=t.metaForProperty(r.name).options;if(!i.inverse){return true}return e===i.inverse});if(s){a.push.apply(a,s)}if(r.superclass){c(r.superclass,t,a)}return a}return{type:r,name:i,kind:a}},relationships:Ember.computed(function(){var e=new o({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var a=e.get(i(this.store,t));a.push({name:r,kind:t.kind})}});return e}).cacheable(false).readOnly(),relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};this.eachComputedProperty(function(r,t){if(t.isRelationship){e[t.kind].push(r)}});return e}),relatedTypes:Ember.computed(function(){var e;var r=Ember.A();this.eachComputedProperty(function(t,a){if(a.isRelationship){a.key=t;e=i(this.store,a);if(!r.contains(e)){r.push(e)}}});return r}).cacheable(false).readOnly(),relationshipsByName:Ember.computed(function(){var e=s.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var n=a(this.store,t);n.type=i(this.store,t);e.set(r,n)}});return e}).cacheable(false).readOnly(),fields:Ember.computed(function(){var e=s.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){e.set(r,t.kind)}else if(t.isAttribute){e.set(r,"attribute")}});return e}).readOnly(),eachRelationship:function(e,r){u(this,"relationshipsByName").forEach(function(t,i){e.call(r,i,t)})},eachRelatedType:function(e,r){u(this,"relatedTypes").forEach(function(t){e.call(r,t)})},determineRelationshipType:function(e){var r=e.key;var t=e.kind;var i=this.inverseFor(r);var a,n;if(!i){return t==="belongsTo"?"oneToNone":"manyToNone"}a=i.name;n=i.kind;if(n==="belongsTo"){return t==="belongsTo"?"oneToOne":"manyToOne"}else{return t==="belongsTo"?"oneToMany":"manyToMany"}}});n.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return u(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e)}})});r("ember-data/system/relationships/has_many",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(e,r){if(typeof e==="object"){r=e;e=undefined}r=r||{};var t={type:e,isRelationship:true,options:r,kind:"hasMany",key:null};return Ember.computed(function(e){var r=this._relationships[e];return r.getRecords()}).meta(t).readOnly()}t.reopen({notifyHasManyAdded:function(e,r,t){var i=this._relationships[e];var a=i.manyArray;a.addRecord(r,t);this.notifyPropertyChange(e)},notifyHasManyRemoved:function(e,r){var t=this._relationships[e];var i=t.manyArray;i.removeRecord(r)}});r["default"]=i});r("ember-data/system/relationships/relationship",["ember-data/system/promise_proxies","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.PromiseManyArray;var a=e.PromiseObject;var n=r.OrderedSet;var s=function(e,r,t,i){this.members=new n;this.store=e;this.key=i.key;this.inverseKey=t;this.record=r;this.key=i.key;this.isAsync=i.options.async;this.relationshipMeta=i;this.inverseKeyForImplicit=this.store.modelFor(this.record.constructor).typeKey+this.key;this.linkPromise=null};s.prototype={constructor:s,destroy:Ember.K,clear:function(){this.members.forEach(function(e){this.removeRecord(e)},this)},disconnect:function(){this.members.forEach(function(e){this.removeRecordFromInverse(e)},this)},reconnect:function(){this.members.forEach(function(e){this.addRecordToInverse(e)},this)},removeRecords:function(e){var r=this;e.forEach(function(e){r.removeRecord(e)})},addRecords:function(e,r){var t=this;e.forEach(function(e){t.addRecord(e,r);if(r!==undefined){r++}})},addRecord:function(e,r){if(!this.members.has(e)){this.members.add(e);this.notifyRecordRelationshipAdded(e,r);if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new s(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)}this.record.updateRecordArrays()}},removeRecord:function(e){if(this.members.has(e)){this.removeRecordFromOwn(e);if(this.inverseKey){this.removeRecordFromInverse(e)}else{if(e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record)}}}},addRecordToInverse:function(e){if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}},removeRecordFromInverse:function(e){var r=e._relationships[this.inverseKey];if(r){r.removeRecordFromOwn(this.record)}},removeRecordFromOwn:function(e){this.members["delete"](e);this.notifyRecordRelationshipRemoved(e);this.record.updateRecordArrays()},updateLink:function(e){if(e!==this.link){this.link=e;this.linkPromise=null;this.record.notifyPropertyChange(this.key)}},findLink:function(){if(this.linkPromise){return this.linkPromise}else{var e=this.fetchLink();this.linkPromise=e;return e.then(function(e){return e})}},updateRecordsFromAdapter:function(e){this.computeChanges(e)},notifyRecordRelationshipAdded:Ember.K,notifyRecordRelationshipRemoved:Ember.K};var o=function(e,r,t,i){this._super$constructor(e,r,t,i);this.belongsToType=i.type;this.manyArray=e.recordArrayManager.createManyArray(this.belongsToType,Ember.A());this.manyArray.relationship=this;this.isPolymorphic=i.options.polymorphic;this.manyArray.isPolymorphic=this.isPolymorphic};o.prototype=Object.create(s.prototype);o.prototype.constructor=o;o.prototype._super$constructor=s;o.prototype.destroy=function(){this.manyArray.destroy()};o.prototype.notifyRecordRelationshipAdded=function(e,r){this.record.notifyHasManyAdded(this.key,e,r)};o.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyHasManyRemoved(this.key,e)};o.prototype.reload=function(){var e=this;if(this.link){return this.fetchLink()}else{return this.store.scheduleFetchMany(this.manyArray.toArray()).then(function(){e.manyArray.set("isLoaded",true);return e.manyArray})}};o.prototype.computeChanges=function(e){var r=this.members;var t=[];var i;var a;var n;e=d(e);r.forEach(function(r){if(e.has(r))return;t.push(r)});this.removeRecords(t);var s=this.manyArray;e=e.toArray();i=e.length;for(n=0;n1){I(i,t,r,c,n).then(o).then(u(n)).then(null,d(n))}else if(c.length===1){var l=Ember.A(e).findBy("record",a[0]);s(l)}else{}})}else{y(e,s)}},getById:function(e,r){if(this.hasRecordForId(e,r)){return this.recordForId(e,r)}else{return null}},reloadRecord:function(e){var r=e.constructor;var t=this.adapterFor(r);var i=f(e,"id");return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=z(r);return!!this.typeMapFor(t).idToRecord[i]},recordForId:function(e,r){var t=this.modelFor(e);var i=z(r);var a=this.typeMapFor(t).idToRecord;var n=a[i];if(!n||!a[i]){n=this.buildRecord(t,i)}return n},findMany:function(e){var r=this;return g.all(b(e,function(e){return r._findByRecord(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.constructor);return L(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.constructor);return j(i,this,e,r,t)},findQuery:function(e,r){var t=this.modelFor(e);var i=this.recordArrayManager.createAdapterPopulatedRecordArray(t,r);var a=this.adapterFor(t);return c(U(a,this,t,r,i))},findAll:function(e){var r=this.modelFor(e);return this.fetchAll(r,this.all(r))},fetchAll:function(e,r){var t=this.adapterFor(e);var i=this.typeMapFor(e).metadata.since;h(r,"isUpdating",true);return c(K(t,this,e,i))},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;h(r,"isUpdating",false)},all:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.findAllCache;if(i){return i}var a=this.recordArrayManager.createRecordArray(r);t.findAllCache=a;return a},unloadAll:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.records.slice();var a;for(var n=0;nE;R--){o=n[R-1];g=o[0];if(g.test(e)){break}}o=o||[];g=o[0];u=o[1];d=e.replace(g,u);return d}};e["default"]=o});r("ember-inflector/system/string",["./inflector","exports"],function(e,r){"use strict";var t=e["default"];function i(e){return t.inflector.pluralize(e)}function a(e){return t.inflector.singularize(e)}r.pluralize=i;r.singularize=a});e.DS=t("ember-data")["default"]})(this); \ No newline at end of file +(function (e) { + var r, t, i, a; + (function () { + var e; + if (!Array.isArray) { + e = function (e) { + return Object.prototype.toString.call(e) === "[object Array]" + } + } else { + e = Array.isArray + } + var n = {}, s = {}, o = {}; + var u = false; + r = function (r, t, i) { + if (!e(t)) { + i = t; + t = [] + } + n[r] = {deps: t, callback: i} + }; + + function d(e, r, t) { + var a = e.length; + var n = new Array(a); + var s; + var o; + for (var u = 0, d = a; u < d; u++) { + s = e[u]; + if (s === "exports") { + o = n[u] = t + } else { + n[u] = i(c(s, r)) + } + } + return {deps: n, exports: o} + } + + a = i = t = function (e) { + if (o[e] !== u && s.hasOwnProperty(e)) { + return s[e] + } + if (!n[e]) { + throw new Error("Could not find module " + e) + } + var r = n[e]; + var t; + var i; + var a = false; + s[e] = {}; + try { + t = d(r.deps, e, s[e]); + i = r.callback.apply(this, t.deps); + a = true + } finally { + if (!a) { + o[e] = u + } + } + return t.exports ? s[e] : s[e] = i + }; + + function c(e, r) { + if (e.charAt(0) !== ".") { + return e + } + var t = e.split("/"); + var i = r.split("/"); + var a; + if (i.length === 1) { + a = i + } else { + a = i.slice(0, -1) + } + for (var n = 0, s = t.length; n < s; n++) { + var o = t[n]; + if (o === "..") { + a.pop() + } else if (o === ".") { + continue + } else { + a.push(o) + } + } + return a.join("/") + } + + a.entries = a._eak_seen = n; + a.clear = function () { + a.entries = a._eak_seen = n = {}; + s = o = {} + } + })(); + r("activemodel-adapter", ["activemodel-adapter/system", "exports"], function (e, r) { + "use strict"; + var t = e.ActiveModelAdapter; + var i = e.ActiveModelSerializer; + r.ActiveModelAdapter = t; + r.ActiveModelSerializer = i + }); + r("activemodel-adapter/setup-container", ["ember-data/system/container_proxy", "activemodel-adapter/system/active_model_serializer", "activemodel-adapter/system/active_model_adapter", "exports"], function (e, r, t, i) { + "use strict"; + var a = e["default"]; + var n = r["default"]; + var s = t["default"]; + i["default"] = function o(e, r) { + var t = new a(e); + t.registerDeprecations([{ + deprecated: "serializer:_ams", + valid: "serializer:-active-model" + }, {deprecated: "adapter:_ams", valid: "adapter:-active-model"}]); + e.register("serializer:-active-model", n); + e.register("adapter:-active-model", s) + } + }); + r("activemodel-adapter/system", ["activemodel-adapter/system/active_model_adapter", "activemodel-adapter/system/active_model_serializer", "exports"], function (e, r, t) { + "use strict"; + var i = e["default"]; + var a = r["default"]; + t.ActiveModelAdapter = i; + t.ActiveModelSerializer = a + }); + r("activemodel-adapter/system/active_model_adapter", ["ember-data/adapters", "ember-data/system/adapter", "ember-inflector", "exports"], function (e, r, t, i) { + "use strict"; + var a = e.RESTAdapter; + var n = r.InvalidError; + var s = t.pluralize; + var o = Ember.EnumerableUtils.forEach; + var u = Ember.String.decamelize, d = Ember.String.underscore; + var c = a.extend({ + defaultSerializer: "-active-model", pathForType: function (e) { + var r = u(e); + var t = d(r); + return s(t) + }, ajaxError: function (e) { + var r = this._super(e); + if (e && e.status === 422) { + var t = Ember.$.parseJSON(e.responseText), i = {}; + if (t.errors !== undefined) { + var a = t.errors; + o(Ember.keys(a), function (e) { + i[Ember.String.camelize(e)] = a[e] + }) + } + return new n(i) + } else { + return r + } + } + }); + i["default"] = c + }); + r("activemodel-adapter/system/active_model_serializer", ["ember-inflector", "ember-data/serializers/rest_serializer", "exports"], function (e, r, t) { + "use strict"; + var i = e.singularize; + var a = r["default"]; + var n = Ember.get, s = Ember.EnumerableUtils.forEach, o = Ember.String.camelize, u = Ember.String.capitalize, + d = Ember.String.decamelize, c = Ember.String.underscore; + var l = a.extend({ + keyForAttribute: function (e) { + return d(e) + }, keyForRelationship: function (e, r) { + var t = d(e); + if (r === "belongsTo") { + return t + "_id" + } else if (r === "hasMany") { + return i(t) + "_ids" + } else { + return t + } + }, serializeHasMany: Ember.K, serializeIntoHash: function (e, r, t, i) { + var a = c(d(r.typeKey)); + e[a] = this.serialize(t, i) + }, serializePolymorphicType: function (e, r, t) { + var i = t.key; + var a = n(e, i); + var s = c(i + "_type"); + if (Ember.isNone(a)) { + r[s] = null + } else { + r[s] = u(o(a.constructor.typeKey)) + } + }, normalize: function (e, r, t) { + this.normalizeLinks(r); + return this._super(e, r, t) + }, normalizeLinks: function (e) { + if (e.links) { + var r = e.links; + for (var t in r) { + var i = o(t); + if (i !== t) { + r[i] = r[t]; + delete r[t] + } + } + } + }, normalizeRelationships: function (e, r) { + if (this.keyForRelationship) { + e.eachRelationship(function (e, t) { + var i, a; + if (t.options.polymorphic) { + i = this.keyForAttribute(e); + a = r[i]; + if (a && a.type) { + a.type = this.typeForRoot(a.type) + } else if (a && t.kind === "hasMany") { + var n = this; + s(a, function (e) { + e.type = n.typeForRoot(e.type) + }) + } + } else { + i = this.keyForRelationship(e, t.kind); + if (!r.hasOwnProperty(i)) { + return + } + a = r[i] + } + r[e] = a; + if (e !== i) { + delete r[i] + } + }, this) + } + } + }); + t["default"] = l + }); + r("ember-data", ["ember-data/core", "ember-data/ext/date", "ember-data/system/promise_proxies", "ember-data/system/store", "ember-data/system/model", "ember-data/system/adapter", "ember-data/system/debug", "ember-data/system/record_arrays", "ember-data/system/record_array_manager", "ember-data/adapters", "ember-data/serializers/json_serializer", "ember-data/serializers/rest_serializer", "ember-inflector", "ember-data/serializers/embedded_records_mixin", "activemodel-adapter", "ember-data/transforms", "ember-data/system/relationships", "ember-data/ember-initializer", "ember-data/setup-container", "ember-data/system/container_proxy", "ember-data/system/relationships/relationship", "exports"], function (e, r, t, i, a, n, s, o, u, d, c, l, f, h, p, m, y, v, b, g, R, E) { + "use strict"; + Ember.RSVP.Promise.cast = Ember.RSVP.Promise.cast || Ember.RSVP.resolve; + var _ = e["default"]; + var A = t.PromiseArray; + var F = t.PromiseObject; + var z = i.Store; + var x = a.Model; + var T = a.Errors; + var S = a.RootState; + var k = a.attr; + var M = n.InvalidError; + var D = n.Adapter; + var P = s["default"]; + var O = o.RecordArray; + var C = o.FilteredRecordArray; + var w = o.AdapterPopulatedRecordArray; + var $ = o.ManyArray; + var I = u["default"]; + var L = d.RESTAdapter; + var j = d.FixtureAdapter; + var K = c["default"]; + var U = l["default"]; + var B = h["default"]; + var N = p.ActiveModelAdapter; + var V = p.ActiveModelSerializer; + var H = m.Transform; + var W = m.DateTransform; + var q = m.NumberTransform; + var Q = m.StringTransform; + var X = m.BooleanTransform; + var J = y.hasMany; + var G = y.belongsTo; + var Y = b["default"]; + var Z = g["default"]; + var er = R.Relationship; + _.Store = z; + _.PromiseArray = A; + _.PromiseObject = F; + _.Model = x; + _.RootState = S; + _.attr = k; + _.Errors = T; + _.Adapter = D; + _.InvalidError = M; + _.DebugAdapter = P; + _.RecordArray = O; + _.FilteredRecordArray = C; + _.AdapterPopulatedRecordArray = w; + _.ManyArray = $; + _.RecordArrayManager = I; + _.RESTAdapter = L; + _.FixtureAdapter = j; + _.RESTSerializer = U; + _.JSONSerializer = K; + _.Transform = H; + _.DateTransform = W; + _.StringTransform = Q; + _.NumberTransform = q; + _.BooleanTransform = X; + _.ActiveModelAdapter = N; + _.ActiveModelSerializer = V; + _.EmbeddedRecordsMixin = B; + _.belongsTo = G; + _.hasMany = J; + _.Relationship = er; + _.ContainerProxy = Z; + _._setupContainer = Y; + Ember.lookup.DS = _; + E["default"] = _ + }); + r("ember-data/adapters", ["ember-data/adapters/fixture_adapter", "ember-data/adapters/rest_adapter", "exports"], function (e, r, t) { + "use strict"; + var i = e["default"]; + var a = r["default"]; + t.RESTAdapter = a; + t.FixtureAdapter = i + }); + r("ember-data/adapters/fixture_adapter", ["ember-data/system/adapter", "exports"], function (e, r) { + "use strict"; + var t = Ember.get; + var i = Ember.String.fmt; + var a = Ember.EnumerableUtils.indexOf; + var n = 0; + var s = e["default"]; + r["default"] = s.extend({ + serializer: null, simulateRemoteResponse: true, latency: 50, fixturesForType: function (e) { + if (e.FIXTURES) { + var r = Ember.A(e.FIXTURES); + return r.map(function (e) { + var r = typeof e.id; + if (r !== "number" && r !== "string") { + throw new Error(i("the id property must be defined as a number or string for fixture %@", [e])) + } + e.id = e.id + ""; + return e + }) + } + return null + }, queryFixtures: function (e, r, t) { + }, updateFixtures: function (e, r) { + if (!e.FIXTURES) { + e.FIXTURES = [] + } + var t = e.FIXTURES; + this.deleteLoadedFixture(e, r); + t.push(r) + }, mockJSON: function (e, r, t) { + return e.serializerFor(r).serialize(t, {includeId: true}) + }, generateIdForRecord: function (e) { + return "fixture-" + n++ + }, find: function (e, r, t) { + var i = this.fixturesForType(r); + var a; + if (i) { + a = Ember.A(i).findBy("id", t) + } + if (a) { + return this.simulateRemoteCall(function () { + return a + }, this) + } + }, findMany: function (e, r, t) { + var i = this.fixturesForType(r); + if (i) { + i = i.filter(function (e) { + return a(t, e.id) !== -1 + }) + } + if (i) { + return this.simulateRemoteCall(function () { + return i + }, this) + } + }, findAll: function (e, r) { + var t = this.fixturesForType(r); + return this.simulateRemoteCall(function () { + return t + }, this) + }, findQuery: function (e, r, t, i) { + var a = this.fixturesForType(r); + a = this.queryFixtures(a, t, r); + if (a) { + return this.simulateRemoteCall(function () { + return a + }, this) + } + }, createRecord: function (e, r, t) { + var i = this.mockJSON(e, r, t); + this.updateFixtures(r, i); + return this.simulateRemoteCall(function () { + return i + }, this) + }, updateRecord: function (e, r, t) { + var i = this.mockJSON(e, r, t); + this.updateFixtures(r, i); + return this.simulateRemoteCall(function () { + return i + }, this) + }, deleteRecord: function (e, r, t) { + this.deleteLoadedFixture(r, t); + return this.simulateRemoteCall(function () { + return null + }) + }, deleteLoadedFixture: function (e, r) { + var t = this.findExistingFixture(e, r); + if (t) { + var i = a(e.FIXTURES, t); + e.FIXTURES.splice(i, 1); + return true + } + }, findExistingFixture: function (e, r) { + var i = this.fixturesForType(e); + var a = t(r, "id"); + return this.findFixtureById(i, a) + }, findFixtureById: function (e, r) { + return Ember.A(e).find(function (e) { + if ("" + t(e, "id") === "" + r) { + return true + } else { + return false + } + }) + }, simulateRemoteCall: function (e, r) { + var i = this; + return new Ember.RSVP.Promise(function (a) { + var n = Ember.copy(e.call(r), true); + if (t(i, "simulateRemoteResponse")) { + Ember.run.later(function () { + a(n) + }, t(i, "latency")) + } else { + Ember.run.schedule("actions", null, function () { + a(n) + }) + } + }, "DS: FixtureAdapter#simulateRemoteCall") + } + }) + }); + r("ember-data/adapters/rest_adapter", ["ember-data/system/adapter", "ember-data/system/map", "exports"], function (e, r, t) { + "use strict"; + var i = e.Adapter; + var a = e.InvalidError; + var n = r.MapWithDefault; + var s = Ember.get; + var o = Ember.ArrayPolyfills.forEach; + t["default"] = i.extend({ + defaultSerializer: "-rest", coalesceFindRequests: false, find: function (e, r, t, i) { + return this.ajax(this.buildURL(r.typeKey, t, i), "GET") + }, findAll: function (e, r, t) { + var i; + if (t) { + i = {since: t} + } + return this.ajax(this.buildURL(r.typeKey), "GET", {data: i}) + }, findQuery: function (e, r, t) { + return this.ajax(this.buildURL(r.typeKey), "GET", {data: t}) + }, findMany: function (e, r, t, i) { + return this.ajax(this.buildURL(r.typeKey, t, i), "GET", {data: {ids: t}}) + }, findHasMany: function (e, r, t, i) { + var a = s(this, "host"); + var n = s(r, "id"); + var o = r.constructor.typeKey; + if (a && t.charAt(0) === "/" && t.charAt(1) !== "/") { + t = a + t + } + return this.ajax(this.urlPrefix(t, this.buildURL(o, n)), "GET") + }, findBelongsTo: function (e, r, t, i) { + var a = s(r, "id"); + var n = r.constructor.typeKey; + return this.ajax(this.urlPrefix(t, this.buildURL(n, a)), "GET") + }, createRecord: function (e, r, t) { + var i = {}; + var a = e.serializerFor(r.typeKey); + a.serializeIntoHash(i, r, t, {includeId: true}); + return this.ajax(this.buildURL(r.typeKey, null, t), "POST", {data: i}) + }, updateRecord: function (e, r, t) { + var i = {}; + var a = e.serializerFor(r.typeKey); + a.serializeIntoHash(i, r, t); + var n = s(t, "id"); + return this.ajax(this.buildURL(r.typeKey, n, t), "PUT", {data: i}) + }, deleteRecord: function (e, r, t) { + var i = s(t, "id"); + return this.ajax(this.buildURL(r.typeKey, i, t), "DELETE") + }, buildURL: function (e, r, t) { + var i = [], a = s(this, "host"), n = this.urlPrefix(); + if (e) { + i.push(this.pathForType(e)) + } + if (r && !Ember.isArray(r)) { + i.push(encodeURIComponent(r)) + } + if (n) { + i.unshift(n) + } + i = i.join("/"); + if (!a && i) { + i = "/" + i + } + return i + }, urlPrefix: function (e, r) { + var t = s(this, "host"); + var i = s(this, "namespace"); + var a = []; + if (e) { + if (e.charAt(0) === "/") { + if (t) { + e = e.slice(1); + a.push(t) + } + } else if (!/^http(s)?:\/\//.test(e)) { + a.push(r) + } + } else { + if (t) { + a.push(t) + } + if (i) { + a.push(i) + } + } + if (e) { + a.push(e) + } + return a.join("/") + }, _stripIDFromURL: function (e, r) { + var t = e.modelFor(r); + var i = this.buildURL(t.typeKey, r.get("id"), r); + var a = i.split("/"); + var n = a[a.length - 1]; + var s = r.get("id"); + if (n === s) { + a[a.length - 1] = "" + } else if (u(n, "?id=" + s)) { + a[a.length - 1] = n.substring(0, n.length - s.length - 1) + } + return a.join("/") + }, groupRecordsForFindMany: function (e, r) { + var t = n.create({ + defaultValue: function () { + return [] + } + }); + var i = this; + o.call(r, function (r) { + var a = i._stripIDFromURL(e, r); + t.get(a).push(r) + }); + + function a(r, t) { + var a = i._stripIDFromURL(e, r[0]); + var n = 0; + var s = [[]]; + o.call(r, function (e) { + var r = "&ids[]=".length + e.get("id.length"); + if (a.length + n + r >= t) { + n = 0; + s.push([]) + } + n += r; + var i = s.length - 1; + s[i].push(e) + }); + return s + } + + var s = []; + t.forEach(function (e, r) { + var t = 2048; + var i = a(e, t); + o.call(i, function (e) { + s.push(e) + }) + }); + return s + }, pathForType: function (e) { + var r = Ember.String.camelize(e); + return Ember.String.pluralize(r) + }, ajaxError: function (e, r) { + if (e && typeof e === "object") { + e.then = null + } + return e + }, ajaxSuccess: function (e, r) { + return r + }, ajax: function (e, r, t) { + var i = this; + return new Ember.RSVP.Promise(function (n, s) { + var o = i.ajaxOptions(e, r, t); + o.success = function (e, r, t) { + e = i.ajaxSuccess(t, e); + if (e instanceof a) { + Ember.run(null, s, e) + } else { + Ember.run(null, n, e) + } + }; + o.error = function (e, r, t) { + Ember.run(null, s, i.ajaxError(e, e.responseText)) + }; + Ember.$.ajax(o) + }, "DS: RESTAdapter#ajax " + r + " to " + e) + }, ajaxOptions: function (e, r, t) { + var i = t || {}; + i.url = e; + i.type = r; + i.dataType = "json"; + i.context = this; + if (i.data && r !== "GET") { + i.contentType = "application/json; charset=utf-8"; + i.data = JSON.stringify(i.data) + } + var a = s(this, "headers"); + if (a !== undefined) { + i.beforeSend = function (e) { + o.call(Ember.keys(a), function (r) { + e.setRequestHeader(r, a[r]) + }) + } + } + return i + } + }); + + function u(e, r) { + if (typeof String.prototype.endsWith !== "function") { + return e.indexOf(r, e.length - r.length) !== -1 + } else { + return e.endsWith(r) + } + } + }); + r("ember-data/core", ["exports"], function (e) { + "use strict"; + var r; + if ("undefined" === typeof r) { + r = Ember.Namespace.create({VERSION: "1.0.0-beta.11"}); + if (Ember.libraries) { + Ember.libraries.registerCoreLibrary("Ember Data", r.VERSION) + } + } + e["default"] = r + }); + r("ember-data/ember-initializer", ["ember-data/setup-container"], function (e) { + "use strict"; + var r = e["default"]; + var t = Ember.K; + Ember.onLoad("Ember.Application", function (e) { + e.initializer({name: "ember-data", initialize: r}); + e.initializer({name: "store", after: "ember-data", initialize: t}); + e.initializer({name: "activeModelAdapter", before: "store", initialize: t}); + e.initializer({name: "transforms", before: "store", initialize: t}); + e.initializer({name: "data-adapter", before: "store", initialize: t}); + e.initializer({name: "injectStore", before: "store", initialize: t}) + }) + }); + r("ember-data/ext/date", [], function () { + "use strict"; + Ember.Date = Ember.Date || {}; + var e = Date.parse, r = [1, 4, 5, 6, 7, 10, 11]; + Ember.Date.parse = function (t) { + var i, a, n = 0; + if (a = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)) { + for (var s = 0, o; o = r[s]; ++s) { + a[o] = +a[o] || 0 + } + a[2] = (+a[2] || 1) - 1; + a[3] = +a[3] || 1; + if (a[8] !== "Z" && a[9] !== undefined) { + n = a[10] * 60 + a[11]; + if (a[9] === "+") { + n = 0 - n + } + } + i = Date.UTC(a[1], a[2], a[3], a[4], a[5] + n, a[6], a[7]) + } else { + i = e ? e(t) : NaN + } + return i + }; + if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Date) { + Date.parse = Ember.Date.parse + } + }); + r("ember-data/initializers/data_adapter", ["ember-data/system/debug/debug_adapter", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + r["default"] = function i(e) { + e.register("data-adapter:main", t) + } + }); + r("ember-data/initializers/store", ["ember-data/serializers", "ember-data/adapters", "ember-data/system/container_proxy", "ember-data/system/store", "exports"], function (e, r, t, i, a) { + "use strict"; + var n = e.JSONSerializer; + var s = e.RESTSerializer; + var o = r.RESTAdapter; + var u = t["default"]; + var d = i["default"]; + a["default"] = function c(e, r) { + e.register("store:main", e.lookupFactory("store:application") || r && r.Store || d); + var t = new u(e); + t.registerDeprecations([{ + deprecated: "serializer:_default", + valid: "serializer:-default" + }, {deprecated: "serializer:_rest", valid: "serializer:-rest"}, { + deprecated: "adapter:_rest", + valid: "adapter:-rest" + }]); + e.register("serializer:-default", n); + e.register("serializer:-rest", s); + e.register("adapter:-rest", o); + e.lookup("store:main") + } + }); + r("ember-data/initializers/store_injections", ["exports"], function (e) { + "use strict"; + e["default"] = function r(e) { + e.injection("controller", "store", "store:main"); + e.injection("route", "store", "store:main"); + e.injection("serializer", "store", "store:main"); + e.injection("data-adapter", "store", "store:main") + } + }); + r("ember-data/initializers/transforms", ["ember-data/transforms", "exports"], function (e, r) { + "use strict"; + var t = e.BooleanTransform; + var i = e.DateTransform; + var a = e.StringTransform; + var n = e.NumberTransform; + r["default"] = function s(e) { + e.register("transform:boolean", t); + e.register("transform:date", i); + e.register("transform:number", n); + e.register("transform:string", a) + } + }); + r("ember-data/serializers", ["ember-data/serializers/json_serializer", "ember-data/serializers/rest_serializer", "exports"], function (e, r, t) { + "use strict"; + var i = e["default"]; + var a = r["default"]; + t.JSONSerializer = i; + t.RESTSerializer = a + }); + r("ember-data/serializers/embedded_records_mixin", ["exports"], function (e) { + "use strict"; + var r = Ember.get; + var t = Ember.EnumerableUtils.forEach; + var i = Ember.String.camelize; + var a = Ember.Mixin.create({ + normalize: function (e, r, t) { + var i = this._super(e, r, t); + return n(this, this.store, e, i) + }, keyForRelationship: function (e, r) { + if (this.hasDeserializeRecordsOption(e)) { + return this.keyForAttribute(e) + } else { + return this._super(e, r) || e + } + }, serializeBelongsTo: function (e, t, i) { + var a = i.key; + if (this.noSerializeOptionSpecified(a)) { + this._super(e, t, i); + return + } + var n = this.hasSerializeIdsOption(a); + var s = this.hasSerializeRecordsOption(a); + var o = e.get(a); + var u; + if (n) { + u = this.keyForRelationship(a, i.kind); + if (!o) { + t[u] = null + } else { + t[u] = r(o, "id") + } + } else if (s) { + u = this.keyForAttribute(a); + if (!o) { + t[u] = null + } else { + t[u] = o.serialize({includeId: true}); + this.removeEmbeddedForeignKey(e, o, i, t[u]) + } + } + }, serializeHasMany: function (e, t, i) { + var a = i.key; + if (this.noSerializeOptionSpecified(a)) { + this._super(e, t, i); + return + } + var n = this.hasSerializeIdsOption(a); + var s = this.hasSerializeRecordsOption(a); + var o; + if (n) { + o = this.keyForRelationship(a, i.kind); + t[o] = r(e, a).mapBy("id") + } else if (s) { + o = this.keyForAttribute(a); + t[o] = r(e, a).map(function (r) { + var t = r.serialize({includeId: true}); + this.removeEmbeddedForeignKey(e, r, i, t); + return t + }, this) + } + }, removeEmbeddedForeignKey: function (e, r, t, i) { + if (t.kind === "hasMany") { + return + } else if (t.kind === "belongsTo") { + var a = e.constructor.inverseFor(t.key); + if (a) { + var n = a.name; + var s = this.store.serializerFor(r.constructor); + var o = s.keyForRelationship(n, a.kind); + if (o) { + delete i[o] + } + } + } + }, hasEmbeddedAlwaysOption: function (e) { + var r = this.attrsOption(e); + return r && r.embedded === "always" + }, hasSerializeRecordsOption: function (e) { + var r = this.hasEmbeddedAlwaysOption(e); + var t = this.attrsOption(e); + return r || t && t.serialize === "records" + }, hasSerializeIdsOption: function (e) { + var r = this.attrsOption(e); + return r && (r.serialize === "ids" || r.serialize === "id") + }, noSerializeOptionSpecified: function (e) { + var r = this.attrsOption(e); + return !(r && (r.serialize || r.embedded)) + }, hasDeserializeRecordsOption: function (e) { + var r = this.hasEmbeddedAlwaysOption(e); + var t = this.attrsOption(e); + return r || t && t.deserialize === "records" + }, attrsOption: function (e) { + var r = this.get("attrs"); + return r && (r[i(e)] || r[e]) + } + }); + + function n(e, r, t, i) { + t.eachRelationship(function (t, a) { + if (e.hasDeserializeRecordsOption(t)) { + var n = r.modelFor(a.type.typeKey); + if (a.kind === "hasMany") { + if (a.options.polymorphic) { + o(r, t, i) + } else { + s(r, t, n, i) + } + } + if (a.kind === "belongsTo") { + u(r, t, n, i) + } + } + }); + return i + } + + function s(e, r, i, a) { + if (!a[r]) { + return a + } + var n = []; + var s = e.serializerFor(i.typeKey); + t(a[r], function (r) { + var t = s.normalize(i, r, null); + e.push(i, t); + n.push(t.id) + }); + a[r] = n; + return a + } + + function o(e, i, a) { + if (!a[i]) { + return a + } + var n = []; + t(a[i], function (t) { + var i = t.type; + var a = e.serializerFor(i); + var s = e.modelFor(i); + var o = r(a, "primaryKey"); + var u = a.normalize(s, t, null); + e.push(s, u); + n.push({id: u[o], type: i}) + }); + a[i] = n; + return a + } + + function u(e, r, t, i) { + if (!i[r]) { + return i + } + var a = e.serializerFor(t.typeKey); + var n = a.normalize(t, i[r], null); + e.push(t, n); + i[r] = n.id; + return i + } + + e["default"] = a + }); + r("ember-data/serializers/json_serializer", ["exports"], function (e) { + "use strict"; + var r = Ember.get; + var t = Ember.isNone; + var i = Ember.ArrayPolyfills.map; + var a = Ember.merge; + e["default"] = Ember.Object.extend({ + primaryKey: "id", applyTransforms: function (e, r) { + e.eachTransformedAttribute(function t(e, i) { + if (!r.hasOwnProperty(e)) { + return + } + var a = this.transformFor(i); + r[e] = a.deserialize(r[e]) + }, this); + return r + }, normalize: function (e, r) { + if (!r) { + return r + } + this.normalizeId(r); + this.normalizeAttributes(e, r); + this.normalizeRelationships(e, r); + this.normalizeUsingDeclaredMapping(e, r); + this.applyTransforms(e, r); + return r + }, normalizePayload: function (e) { + return e + }, normalizeAttributes: function (e, r) { + var t; + if (this.keyForAttribute) { + e.eachAttribute(function (e) { + t = this.keyForAttribute(e); + if (e === t) { + return + } + if (!r.hasOwnProperty(t)) { + return + } + r[e] = r[t]; + delete r[t] + }, this) + } + }, normalizeRelationships: function (e, r) { + var t; + if (this.keyForRelationship) { + e.eachRelationship(function (e, i) { + t = this.keyForRelationship(e, i.kind); + if (e === t) { + return + } + if (!r.hasOwnProperty(t)) { + return + } + r[e] = r[t]; + delete r[t] + }, this) + } + }, normalizeUsingDeclaredMapping: function (e, t) { + var i = r(this, "attrs"), a, n; + if (i) { + for (n in i) { + a = this._getMappedKey(n); + if (!t.hasOwnProperty(a)) { + continue + } + if (a !== n) { + t[n] = t[a]; + delete t[a] + } + } + } + }, normalizeId: function (e) { + var t = r(this, "primaryKey"); + if (t === "id") { + return + } + e.id = e[t]; + delete e[t] + }, _getMappedKey: function (e) { + var t = r(this, "attrs"); + var i; + if (t && t[e]) { + i = t[e]; + if (i.key) { + i = i.key + } + if (typeof i === "string") { + e = i + } + } + return e + }, _canSerialize: function (e) { + var t = r(this, "attrs"); + return !t || !t[e] || t[e].serialize !== false + }, serialize: function (e, t) { + var i = {}; + if (t && t.includeId) { + var a = r(e, "id"); + if (a) { + i[r(this, "primaryKey")] = a + } + } + e.eachAttribute(function (r, t) { + this.serializeAttribute(e, i, r, t) + }, this); + e.eachRelationship(function (r, t) { + if (t.kind === "belongsTo") { + this.serializeBelongsTo(e, i, t) + } else if (t.kind === "hasMany") { + this.serializeHasMany(e, i, t) + } + }, this); + return i + }, serializeIntoHash: function (e, r, t, i) { + a(e, this.serialize(t, i)) + }, serializeAttribute: function (e, t, i, a) { + var n = a.type; + if (this._canSerialize(i)) { + var s = r(e, i); + if (n) { + var o = this.transformFor(n); + s = o.serialize(s) + } + var u = this._getMappedKey(i); + if (u === i && this.keyForAttribute) { + u = this.keyForAttribute(i) + } + t[u] = s + } + }, serializeBelongsTo: function (e, i, a) { + var n = a.key; + if (this._canSerialize(n)) { + var s = r(e, n); + var o = this._getMappedKey(n); + if (o === n && this.keyForRelationship) { + o = this.keyForRelationship(n, "belongsTo") + } + if (t(s) || t(r(s, "id"))) { + i[o] = null + } else { + i[o] = r(s, "id") + } + if (a.options.polymorphic) { + this.serializePolymorphicType(e, i, a) + } + } + }, serializeHasMany: function (e, t, i) { + var a = i.key; + if (this._canSerialize(a)) { + var n; + n = this._getMappedKey(a); + if (n === a && this.keyForRelationship) { + n = this.keyForRelationship(a, "hasMany") + } + var s = e.constructor.determineRelationshipType(i); + if (s === "manyToNone" || s === "manyToMany") { + t[n] = r(e, a).mapBy("id") + } + } + }, serializePolymorphicType: Ember.K, extract: function (e, r, t, i, a) { + this.extractMeta(e, r, t); + var n = "extract" + a.charAt(0).toUpperCase() + a.substr(1); + return this[n](e, r, t, i, a) + }, extractFindAll: function (e, r, t, i, a) { + return this.extractArray(e, r, t, i, a) + }, extractFindQuery: function (e, r, t, i, a) { + return this.extractArray(e, r, t, i, a) + }, extractFindMany: function (e, r, t, i, a) { + return this.extractArray(e, r, t, i, a) + }, extractFindHasMany: function (e, r, t, i, a) { + return this.extractArray(e, r, t, i, a) + }, extractCreateRecord: function (e, r, t, i, a) { + return this.extractSave(e, r, t, i, a) + }, extractUpdateRecord: function (e, r, t, i, a) { + return this.extractSave(e, r, t, i, a) + }, extractDeleteRecord: function (e, r, t, i, a) { + return this.extractSave(e, r, t, i, a) + }, extractFind: function (e, r, t, i, a) { + return this.extractSingle(e, r, t, i, a) + }, extractFindBelongsTo: function (e, r, t, i, a) { + return this.extractSingle(e, r, t, i, a) + }, extractSave: function (e, r, t, i, a) { + return this.extractSingle(e, r, t, i, a) + }, extractSingle: function (e, r, t, i, a) { + t = this.normalizePayload(t); + return this.normalize(r, t) + }, extractArray: function (e, r, t, a, n) { + var s = this.normalizePayload(t); + var o = this; + return i.call(s, function (e) { + return o.normalize(r, e) + }) + }, extractMeta: function (e, r, t) { + if (t && t.meta) { + e.metaForType(r, t.meta); + delete t.meta + } + }, keyForAttribute: function (e) { + return e + }, keyForRelationship: function (e, r) { + return e + }, transformFor: function (e, r) { + var t = this.container.lookup("transform:" + e); + return t + } + }) + }); + r("ember-data/serializers/rest_serializer", ["ember-data/serializers/json_serializer", "ember-inflector/system/string", "exports"], function (e, r, t) { + "use strict"; + var i = e["default"]; + var a = Ember.get; + var n = Ember.ArrayPolyfills.forEach; + var s = Ember.ArrayPolyfills.map; + var o = Ember.String.camelize; + var u = r.singularize; + + function d(e) { + return e == null ? null : e + "" + } + + var c = i.extend({ + normalize: function (e, r, t) { + this.normalizeId(r); + this.normalizeAttributes(e, r); + this.normalizeRelationships(e, r); + this.normalizeUsingDeclaredMapping(e, r); + if (this.normalizeHash && this.normalizeHash[t]) { + this.normalizeHash[t](r) + } + this.applyTransforms(e, r); + return r + }, extractSingle: function (e, r, t, i) { + var a = this.normalizePayload(t); + var s = r.typeKey; + var o; + for (var u in a) { + var c = this.typeForRoot(u); + if (!e.modelFactoryFor(c)) { + continue + } + var l = e.modelFor(c); + var f = l.typeKey === s; + var h = a[u]; + if (f && Ember.typeOf(h) !== "array") { + o = this.normalize(r, h, u); + continue + } + n.call(h, function (r) { + var t = this.typeForRoot(u); + var a = e.modelFor(t); + var n = e.serializerFor(a); + r = n.normalize(a, r, u); + var s = f && !i && !o; + var c = f && d(r.id) === i; + if (s || c) { + o = r + } else { + e.push(t, r) + } + }, this) + } + return o + }, extractArray: function (e, r, t) { + var i = this.normalizePayload(t); + var a = r.typeKey; + var n; + for (var o in i) { + var u = o; + var d = false; + if (o.charAt(0) === "_") { + d = true; + u = o.substr(1) + } + var c = this.typeForRoot(u); + if (!e.modelFactoryFor(c)) { + continue + } + var l = e.modelFor(c); + var f = e.serializerFor(l); + var h = !d && l.typeKey === a; + var p = s.call(i[o], function (e) { + return f.normalize(l, e, o) + }, this); + if (h) { + n = p + } else { + e.pushMany(c, p) + } + } + return n + }, pushPayload: function (e, r) { + var t = this.normalizePayload(r); + for (var i in t) { + var a = this.typeForRoot(i); + if (!e.modelFactoryFor(a, i)) { + continue + } + var n = e.modelFor(a); + var o = e.serializerFor(n); + var u = s.call(Ember.makeArray(t[i]), function (e) { + return o.normalize(n, e, i) + }, this); + e.pushMany(a, u) + } + }, typeForRoot: function (e) { + return o(u(e)) + }, serialize: function (e, r) { + return this._super.apply(this, arguments) + }, serializeIntoHash: function (e, r, t, i) { + e[r.typeKey] = this.serialize(t, i) + }, serializePolymorphicType: function (e, r, t) { + var i = t.key; + var n = a(e, i); + i = this.keyForAttribute ? this.keyForAttribute(i) : i; + if (Ember.isNone(n)) { + r[i + "Type"] = null + } else { + r[i + "Type"] = Ember.String.camelize(n.constructor.typeKey) + } + } + }); + t["default"] = c + }); + r("ember-data/setup-container", ["ember-data/initializers/store", "ember-data/initializers/transforms", "ember-data/initializers/store_injections", "ember-data/initializers/data_adapter", "activemodel-adapter/setup-container", "exports"], function (e, r, t, i, a, n) { + "use strict"; + var s = e["default"]; + var o = r["default"]; + var u = t["default"]; + var d = i["default"]; + var c = a["default"]; + n["default"] = function l(e, r) { + d(e, r); + o(e, r); + u(e, r); + s(e, r); + c(e, r) + } + }); + r("ember-data/system/adapter", ["exports"], function (e) { + "use strict"; + var r = Ember.get; + var t = ["description", "fileName", "lineNumber", "message", "name", "number", "stack"]; + + function i(e) { + var r = Error.prototype.constructor.call(this, "The backend rejected the commit because it was invalid: " + Ember.inspect(e)); + this.errors = e; + for (var i = 0, a = t.length; i < a; i++) { + this[t[i]] = r[t[i]] + } + } + + i.prototype = Ember.create(Error.prototype); + var a = Ember.Object.extend({ + find: Ember.required(Function), + findAll: null, + findQuery: null, + generateIdForRecord: null, + serialize: function (e, t) { + return r(e, "store").serializerFor(e.constructor.typeKey).serialize(e, t) + }, + createRecord: Ember.required(Function), + updateRecord: Ember.required(Function), + deleteRecord: Ember.required(Function), + coalesceFindRequests: true, + groupRecordsForFindMany: function (e, r) { + return [r] + } + }); + e.InvalidError = i; + e.Adapter = a; + e["default"] = a + }); + r("ember-data/system/container_proxy", ["exports"], function (e) { + "use strict"; + + function r(e) { + this.container = e + } + + r.prototype.aliasedFactory = function (e, r) { + var t = this; + return { + create: function () { + if (r) { + r() + } + return t.container.lookup(e) + } + } + }; + r.prototype.registerAlias = function (e, r, t) { + var i = this.aliasedFactory(r, t); + return this.container.register(e, i) + }; + r.prototype.registerDeprecation = function (e, r) { + var t = function () { + }; + return this.registerAlias(e, r, t) + }; + r.prototype.registerDeprecations = function (e) { + var r, t, i, a; + for (r = e.length; r > 0; r--) { + t = e[r - 1]; + i = t["deprecated"]; + a = t["valid"]; + this.registerDeprecation(i, a) + } + }; + e["default"] = r + }); + r("ember-data/system/debug", ["ember-data/system/debug/debug_info", "ember-data/system/debug/debug_adapter", "exports"], function (e, r, t) { + "use strict"; + var i = r["default"]; + t["default"] = i + }); + r("ember-data/system/debug/debug_adapter", ["ember-data/system/model", "exports"], function (e, r) { + "use strict"; + var t = e.Model; + var i = Ember.get; + var a = Ember.String.capitalize; + var n = Ember.String.underscore; + r["default"] = Ember.DataAdapter.extend({ + getFilters: function () { + return [{name: "isNew", desc: "New"}, {name: "isModified", desc: "Modified"}, { + name: "isClean", + desc: "Clean" + }] + }, detect: function (e) { + return e !== t && t.detect(e) + }, columnsForType: function (e) { + var r = [{name: "id", desc: "Id"}]; + var t = 0; + var s = this; + i(e, "attributes").forEach(function (e, i) { + if (t++ > s.attributeLimit) { + return false + } + var o = a(n(i).replace("_", " ")); + r.push({name: i, desc: o}) + }); + return r + }, getRecords: function (e) { + return this.get("store").all(e) + }, getRecordColumnValues: function (e) { + var r = this, t = 0; + var a = {id: i(e, "id")}; + e.eachAttribute(function (n) { + if (t++ > r.attributeLimit) { + return false + } + var s = i(e, n); + a[n] = s + }); + return a + }, getRecordKeywords: function (e) { + var r = []; + var t = Ember.A(["id"]); + e.eachAttribute(function (e) { + t.push(e) + }); + t.forEach(function (t) { + r.push(i(e, t)) + }); + return r + }, getRecordFilterValues: function (e) { + return { + isNew: e.get("isNew"), + isModified: e.get("isDirty") && !e.get("isNew"), + isClean: !e.get("isDirty") + } + }, getRecordColor: function (e) { + var r = "black"; + if (e.get("isNew")) { + r = "green" + } else if (e.get("isDirty")) { + r = "blue" + } + return r + }, observeRecord: function (e, r) { + var t = Ember.A(), i = this; + var a = Ember.A(["id", "isNew", "isDirty"]); + e.eachAttribute(function (e) { + a.push(e) + }); + a.forEach(function (a) { + var n = function () { + r(i.wrapRecord(e)) + }; + Ember.addObserver(e, a, n); + t.push(function () { + Ember.removeObserver(e, a, n) + }) + }); + var n = function () { + t.forEach(function (e) { + e() + }) + }; + return n + } + }) + }); + r("ember-data/system/debug/debug_info", ["ember-data/system/model", "exports"], function (e, r) { + "use strict"; + var t = e.Model; + t.reopen({ + _debugInfo: function () { + var e = ["id"], r = {belongsTo: [], hasMany: []}, t = []; + this.eachAttribute(function (r, t) { + e.push(r) + }, this); + this.eachRelationship(function (e, i) { + r[i.kind].push(e); + t.push(e) + }); + var i = [{name: "Attributes", properties: e, expand: true}, { + name: "Belongs To", + properties: r.belongsTo, + expand: true + }, {name: "Has Many", properties: r.hasMany, expand: true}, { + name: "Flags", + properties: ["isLoaded", "isDirty", "isSaving", "isDeleted", "isError", "isNew", "isValid"] + }]; + return {propertyInfo: {includeOtherProperties: true, groups: i, expensiveProperties: t}} + } + }); + r["default"] = t + }); + r("ember-data/system/map", ["exports"], function (e) { + "use strict"; + var r, t; + + function i() { + Ember.OrderedSet.apply(this, arguments) + } + + function a() { + Ember.Map.apply(this, arguments) + } + + function n() { + Ember.MapWithDefault.apply(this, arguments) + } + + var s = Ember.Map.create(); + s.set("key", "value"); + var o = false; + s.forEach(function (e, r) { + o = e === "key" && r === "value" + }); + a.prototype = Object.create(Ember.Map.prototype); + n.prototype = Object.create(Ember.MapWithDefault.prototype); + i.prototype = Object.create(Ember.OrderedSet.prototype); + i.create = function () { + return new i + }; + + function u(e) { + return function (r, t) { + e.call(this, t, r) + } + } + + if (o) { + r = function (e, r) { + this.__super$forEach(u(e), r) + }; + t = function (e) { + this.remove(e) + }; + a.prototype.__super$forEach = Ember.Map.prototype.forEach; + a.prototype.forEach = r; + a.prototype["delete"] = t; + n.prototype.forEach = r; + n.prototype.__super$forEach = Ember.MapWithDefault.prototype.forEach; + n.prototype["delete"] = t; + i.prototype["delete"] = t + } + n.constructor = n; + a.constructor = a; + n.create = function (e) { + if (e) { + return new n(e) + } else { + return new a + } + }; + a.create = function () { + return new this.constructor + }; + e["default"] = a; + e.Map = a; + e.MapWithDefault = n; + e.OrderedSet = i + }); + r("ember-data/system/model", ["ember-data/system/model/model", "ember-data/system/model/attributes", "ember-data/system/model/states", "ember-data/system/model/errors", "exports"], function (e, r, t, i, a) { + "use strict"; + var n = e["default"]; + var s = r["default"]; + var o = t["default"]; + var u = i["default"]; + a.Model = n; + a.RootState = o; + a.attr = s; + a.Errors = u + }); + r("ember-data/system/model/attributes", ["ember-data/system/model/model", "ember-data/system/map", "exports"], function (e, r, t) { + "use strict"; + var i = e["default"]; + var a = r.Map; + var n = Ember.get; + i.reopenClass({ + attributes: Ember.computed(function () { + var e = a.create(); + this.eachComputedProperty(function (r, t) { + if (t.isAttribute) { + t.name = r; + e.set(r, t) + } + }); + return e + }).readOnly(), transformedAttributes: Ember.computed(function () { + var e = a.create(); + this.eachAttribute(function (r, t) { + if (t.type) { + e.set(r, t.type) + } + }); + return e + }).readOnly(), eachAttribute: function (e, r) { + n(this, "attributes").forEach(function (t, i) { + e.call(r, i, t) + }, r) + }, eachTransformedAttribute: function (e, r) { + n(this, "transformedAttributes").forEach(function (t, i) { + e.call(r, i, t) + }) + } + }); + i.reopen({ + eachAttribute: function (e, r) { + this.constructor.eachAttribute(e, r) + } + }); + + function s(e, r, t) { + if (typeof r.defaultValue === "function") { + return r.defaultValue.apply(null, arguments) + } else { + return r.defaultValue + } + } + + function o(e, r) { + return e._attributes.hasOwnProperty(r) || e._inFlightAttributes.hasOwnProperty(r) || e._data.hasOwnProperty(r) + } + + function u(e, r) { + if (e._attributes.hasOwnProperty(r)) { + return e._attributes[r] + } else if (e._inFlightAttributes.hasOwnProperty(r)) { + return e._inFlightAttributes[r] + } else { + return e._data[r] + } + } + + t["default"] = function d(e, r) { + r = r || {}; + var t = {type: e, isAttribute: true, options: r}; + return Ember.computed("data", function (e, t) { + if (arguments.length > 1) { + var i = u(this, e); + if (t !== i) { + this._attributes[e] = t; + this.send("didSetProperty", {name: e, oldValue: i, originalValue: this._data[e], value: t}) + } + return t + } else if (o(this, e)) { + return u(this, e) + } else { + return s(this, r, e) + } + }).meta(t) + } + }); + r("ember-data/system/model/errors", ["ember-data/system/map", "exports"], function (e, r) { + "use strict"; + var t = Ember.get; + var i = Ember.isEmpty; + var a = Ember.EnumerableUtils.map; + var n = e.MapWithDefault; + r["default"] = Ember.Object.extend(Ember.Enumerable, Ember.Evented, { + registerHandlers: function (e, r, t) { + this.on("becameInvalid", e, r); + this.on("becameValid", e, t) + }, + errorsByAttributeName: Ember.reduceComputed("content", { + initialValue: function () { + return n.create({ + defaultValue: function () { + return Ember.A() + } + }) + }, addedItem: function (e, r) { + e.get(r.attribute).pushObject(r); + return e + }, removedItem: function (e, r) { + e.get(r.attribute).removeObject(r); + return e + } + }), + errorsFor: function (e) { + return t(this, "errorsByAttributeName").get(e) + }, + messages: Ember.computed.mapBy("content", "message"), + content: Ember.computed(function () { + return Ember.A() + }), + unknownProperty: function (e) { + var r = this.errorsFor(e); + if (i(r)) { + return null + } + return r + }, + nextObject: function (e, r, i) { + return t(this, "content").objectAt(e) + }, + length: Ember.computed.oneWay("content.length").readOnly(), + isEmpty: Ember.computed.not("length").readOnly(), + add: function (e, r) { + var i = t(this, "isEmpty"); + r = this._findOrCreateMessages(e, r); + t(this, "content").addObjects(r); + this.notifyPropertyChange(e); + this.enumerableContentDidChange(); + if (i && !t(this, "isEmpty")) { + this.trigger("becameInvalid") + } + }, + _findOrCreateMessages: function (e, r) { + var t = this.errorsFor(e); + return a(Ember.makeArray(r), function (r) { + return t.findBy("message", r) || {attribute: e, message: r} + }) + }, + remove: function (e) { + if (t(this, "isEmpty")) { + return + } + var r = t(this, "content").rejectBy("attribute", e); + t(this, "content").setObjects(r); + this.notifyPropertyChange(e); + this.enumerableContentDidChange(); + if (t(this, "isEmpty")) { + this.trigger("becameValid") + } + }, + clear: function () { + if (t(this, "isEmpty")) { + return + } + t(this, "content").clear(); + this.enumerableContentDidChange(); + this.trigger("becameValid") + }, + has: function (e) { + return !i(this.errorsFor(e)) + } + }) + }); + r("ember-data/system/model/model", ["ember-data/system/model/states", "ember-data/system/model/errors", "ember-data/system/promise_proxies", "ember-data/system/relationships/relationship", "exports"], function (e, r, i, a, n) { + "use strict"; + var s = e["default"]; + var o = r["default"]; + var u = i.PromiseObject; + var d = a.createRelationshipFor; + var c = Ember.get; + var l = Ember.set; + var f = Ember.merge; + var h = Ember.RSVP.Promise; + var p = Ember.ArrayPolyfills.forEach; + var m = Ember.ArrayPolyfills.map; + var y; + var v = Ember.computed("currentState", function (e, r) { + return c(c(this, "currentState"), e) + }).readOnly(); + var b = Object.create(null); + var g = Object.create(null); + + function R(e) { + return g[e] || (g[e] = e.split(".")) + } + + function E(e) { + return b[e] || (b[e] = R(e)[0]) + } + + var _ = Ember.Object.extend(Ember.Evented, { + _recordArrays: undefined, + _relationships: undefined, + _loadingRecordArrays: undefined, + isEmpty: v, + isLoading: v, + isLoaded: v, + isDirty: v, + isSaving: v, + isDeleted: v, + isNew: v, + isValid: v, + dirtyType: v, + isError: false, + isReloading: false, + clientId: null, + id: null, + currentState: s.empty, + errors: Ember.computed(function () { + var e = o.create(); + e.registerHandlers(this, function () { + this.send("becameInvalid") + }, function () { + this.send("becameValid") + }); + return e + }).readOnly(), + serialize: function (e) { + var r = c(this, "store"); + return r.serialize(this, e) + }, + toJSON: function (e) { + if (!y) { + y = t("ember-data/serializers/json_serializer")["default"] + } + var r = y.create({container: this.container}); + return r.serialize(this, e) + }, + didLoad: Ember.K, + didUpdate: Ember.K, + didCreate: Ember.K, + didDelete: Ember.K, + becameInvalid: Ember.K, + becameError: Ember.K, + data: Ember.computed(function () { + this._data = this._data || {}; + return this._data + }).readOnly(), + _data: null, + init: function () { + this._super(); + this._setup() + }, + _setup: function () { + this._changesToSync = {}; + this._deferredTriggers = []; + this._data = {}; + this._attributes = {}; + this._inFlightAttributes = {}; + this._relationships = {}; + this._implicitRelationships = Object.create(null); + var e = this; + this.constructor.eachRelationship(function (r, t) { + e._relationships[r] = d(e, t, e.store) + }) + }, + send: function (e, r) { + var t = c(this, "currentState"); + if (!t[e]) { + this._unhandledEvent(t, e, r) + } + return t[e](this, r) + }, + transitionTo: function (e) { + var r = E(e); + var t = c(this, "currentState"); + var i = t; + do { + if (i.exit) { + i.exit(this) + } + i = i.parentState + } while (!i.hasOwnProperty(r)); + var a = R(e); + var n = [], s = [], o, u; + for (o = 0, u = a.length; o < u; o++) { + i = i[a[o]]; + if (i.enter) { + s.push(i) + } + if (i.setup) { + n.push(i) + } + } + for (o = 0, u = s.length; o < u; o++) { + s[o].enter(this) + } + l(this, "currentState", i); + for (o = 0, u = n.length; o < u; o++) { + n[o].setup(this) + } + this.updateRecordArraysLater() + }, + _unhandledEvent: function (e, r, t) { + var i = "Attempted to handle event `" + r + "` "; + i += "on " + String(this) + " while in state "; + i += e.stateName + ". "; + if (t !== undefined) { + i += "Called with " + Ember.inspect(t) + "." + } + throw new Ember.Error(i) + }, + withTransaction: function (e) { + var r = c(this, "transaction"); + if (r) { + e(r) + } + }, + loadingData: function (e) { + this.send("loadingData", e) + }, + loadedData: function () { + this.send("loadedData") + }, + notFound: function () { + this.send("notFound") + }, + pushedData: function () { + this.send("pushedData") + }, + deleteRecord: function () { + this.send("deleteRecord") + }, + destroyRecord: function () { + this.deleteRecord(); + return this.save() + }, + unloadRecord: function () { + if (this.isDestroyed) { + return + } + this.send("unloadRecord") + }, + clearRelationships: function () { + this.eachRelationship(function (e, r) { + var t = this._relationships[e]; + if (t) { + t.clear(); + t.destroy() + } + }, this) + }, + disconnectRelationships: function () { + this.eachRelationship(function (e, r) { + this._relationships[e].disconnect() + }, this); + var e = this; + p.call(Ember.keys(this._implicitRelationships), function (r) { + e._implicitRelationships[r].disconnect() + }) + }, + reconnectRelationships: function () { + this.eachRelationship(function (e, r) { + this._relationships[e].reconnect() + }, this); + var e = this; + p.call(Ember.keys(this._implicitRelationships), function (r) { + e._implicitRelationships[r].reconnect() + }) + }, + updateRecordArrays: function () { + this._updatingRecordArraysLater = false; + c(this, "store").dataWasUpdated(this.constructor, this) + }, + _preloadData: function (e) { + var r = this; + p.call(Ember.keys(e), function (t) { + var i = c(e, t); + var a = r.constructor.metaForProperty(t); + if (a.isRelationship) { + r._preloadRelationship(t, i) + } else { + c(r, "_data")[t] = i + } + }) + }, + _preloadRelationship: function (e, r) { + var t = this.constructor.metaForProperty(e); + var i = t.type; + if (t.kind === "hasMany") { + this._preloadHasMany(e, r, i) + } else { + this._preloadBelongsTo(e, r, i) + } + }, + _preloadHasMany: function (e, r, t) { + var i = this; + var a = m.call(r, function (e) { + return i._convertStringOrNumberIntoRecord(e, t) + }); + this._relationships[e].updateRecordsFromAdapter(a) + }, + _preloadBelongsTo: function (e, r, t) { + var i = this._convertStringOrNumberIntoRecord(r, t); + this._relationships[e].setRecord(i) + }, + _convertStringOrNumberIntoRecord: function (e, r) { + if (Ember.typeOf(e) === "string" || Ember.typeOf(e) === "number") { + return this.store.recordForId(r, e) + } + return e + }, + changedAttributes: function () { + var e = c(this, "_data"); + var r = c(this, "_attributes"); + var t = {}; + var i; + for (i in r) { + t[i] = [e[i], r[i]] + } + return t + }, + adapterWillCommit: function () { + this.send("willCommit") + }, + adapterDidCommit: function (e) { + l(this, "isError", false); + if (e) { + this._data = e + } else { + Ember.mixin(this._data, this._inFlightAttributes) + } + this._inFlightAttributes = {}; + this.send("didCommit"); + this.updateRecordArraysLater(); + if (!e) { + return + } + this.notifyPropertyChange("data") + }, + adapterDidDirty: function () { + this.send("becomeDirty"); + this.updateRecordArraysLater() + }, + updateRecordArraysLater: function () { + if (this._updatingRecordArraysLater) { + return + } + this._updatingRecordArraysLater = true; + Ember.run.schedule("actions", this, this.updateRecordArrays) + }, + setupData: function (e, r) { + if (r) { + Ember.merge(this._data, e) + } else { + this._data = e + } + if (e) { + this.pushedData() + } + this.notifyPropertyChange("data") + }, + materializeId: function (e) { + l(this, "id", e) + }, + materializeAttributes: function (e) { + f(this._data, e) + }, + materializeAttribute: function (e, r) { + this._data[e] = r + }, + rollback: function () { + this._attributes = {}; + if (c(this, "isError")) { + this._inFlightAttributes = {}; + l(this, "isError", false) + } + if (c(this, "isDeleted")) { + this.reconnectRelationships() + } + if (!c(this, "isValid")) { + this._inFlightAttributes = {} + } + this.send("rolledBack"); + this.notifyPropertyChange("data") + }, + toStringExtension: function () { + return c(this, "id") + }, + save: function () { + var e = "DS: Model#save " + this; + var r = Ember.RSVP.defer(e); + this.get("store").scheduleSave(this, r); + this._inFlightAttributes = this._attributes; + this._attributes = {}; + return u.create({promise: r.promise}) + }, + reload: function () { + l(this, "isReloading", true); + var e = this; + var r = "DS: Model#reload of " + this; + var t = new h(function (r) { + e.send("reloadRecord", r) + }, r).then(function () { + e.set("isReloading", false); + e.set("isError", false); + return e + }, function (r) { + e.set("isError", true); + throw r + }, "DS: Model#reload complete, update flags")["finally"](function () { + e.updateRecordArrays() + }); + return u.create({promise: t}) + }, + adapterDidUpdateAttribute: function (e, r) { + if (r !== undefined) { + this._data[e] = r; + this.notifyPropertyChange(e) + } else { + this._data[e] = this._inFlightAttributes[e] + } + this.updateRecordArraysLater() + }, + adapterDidInvalidate: function (e) { + var r = c(this, "errors"); + + function t(t) { + if (e[t]) { + r.add(t, e[t]) + } + } + + this.eachAttribute(t); + this.eachRelationship(t) + }, + adapterDidError: function () { + this.send("becameError"); + l(this, "isError", true) + }, + trigger: function () { + var e = arguments.length; + var r = new Array(e - 1); + var t = arguments[0]; + for (var i = 1; i < e; i++) { + r[i - 1] = arguments[i] + } + Ember.tryInvoke(this, t, r); + this._super.apply(this, arguments) + }, + triggerLater: function () { + var e = arguments.length; + var r = new Array(e); + for (var t = 0; t < e; t++) { + r[t] = arguments[t] + } + if (this._deferredTriggers.push(r) !== 1) { + return + } + Ember.run.schedule("actions", this, "_triggerDeferredTriggers") + }, + _triggerDeferredTriggers: function () { + for (var e = 0, r = this._deferredTriggers.length; e < r; e++) { + this.trigger.apply(this, this._deferredTriggers[e]) + } + this._deferredTriggers.length = 0 + }, + willDestroy: function () { + this._super(); + this.clearRelationships() + }, + willMergeMixin: function (e) { + } + }); + _.reopenClass({ + _create: _.create, create: function () { + throw new Ember.Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.") + } + }); + n["default"] = _ + }); + r("ember-data/system/model/states", ["exports"], function (e) { + "use strict"; + var r = Ember.get; + var t = Ember.set; + + function i(e, r) { + if (r.value === r.originalValue) { + delete e._attributes[r.name]; + e.send("propertyWasReset", r.name) + } else if (r.value !== r.oldValue) { + e.send("becomeDirty") + } + e.updateRecordArraysLater() + } + + var a = { + initialState: "uncommitted", + isDirty: true, + uncommitted: { + didSetProperty: i, loadingData: Ember.K, propertyWasReset: function (e, r) { + var t = Ember.keys(e._attributes); + var i = t > 0; + if (!i) { + e.send("rolledBack") + } + }, pushedData: Ember.K, becomeDirty: Ember.K, willCommit: function (e) { + e.transitionTo("inFlight") + }, reloadRecord: function (e, t) { + t(r(e, "store").reloadRecord(e)) + }, rolledBack: function (e) { + e.transitionTo("loaded.saved") + }, becameInvalid: function (e) { + e.transitionTo("invalid") + }, rollback: function (e) { + e.rollback() + } + }, + inFlight: { + isSaving: true, + didSetProperty: i, + becomeDirty: Ember.K, + pushedData: Ember.K, + unloadRecord: function (e) { + }, + willCommit: Ember.K, + didCommit: function (e) { + var t = r(this, "dirtyType"); + e.transitionTo("saved"); + e.send("invokeLifecycleCallbacks", t) + }, + becameInvalid: function (e) { + e.transitionTo("invalid"); + e.send("invokeLifecycleCallbacks") + }, + becameError: function (e) { + e.transitionTo("uncommitted"); + e.triggerLater("becameError", e) + } + }, + invalid: { + isValid: false, deleteRecord: function (e) { + e.transitionTo("deleted.uncommitted"); + e.disconnectRelationships() + }, didSetProperty: function (e, t) { + r(e, "errors").remove(t.name); + i(e, t) + }, becomeDirty: Ember.K, willCommit: function (e) { + r(e, "errors").clear(); + e.transitionTo("inFlight") + }, rolledBack: function (e) { + r(e, "errors").clear() + }, becameValid: function (e) { + e.transitionTo("uncommitted") + }, invokeLifecycleCallbacks: function (e) { + e.triggerLater("becameInvalid", e) + }, exit: function (e) { + e._inFlightAttributes = {} + } + } + }; + + function n(e) { + var r = {}, t; + for (var i in e) { + t = e[i]; + if (t && typeof t === "object") { + r[i] = n(t) + } else { + r[i] = t + } + } + return r + } + + function s(e, r) { + for (var t in r) { + e[t] = r[t] + } + return e + } + + function o(e) { + var r = n(a); + return s(r, e) + } + + var u = o({dirtyType: "created", isNew: true}); + u.uncommitted.rolledBack = function (e) { + e.transitionTo("deleted.saved") + }; + var d = o({dirtyType: "updated"}); + u.uncommitted.deleteRecord = function (e) { + e.disconnectRelationships(); + e.transitionTo("deleted.saved") + }; + u.uncommitted.rollback = function (e) { + a.uncommitted.rollback.apply(this, arguments); + e.transitionTo("deleted.saved") + }; + u.uncommitted.propertyWasReset = Ember.K; + + function c(e) { + } + + d.inFlight.unloadRecord = c; + d.uncommitted.deleteRecord = function (e) { + e.transitionTo("deleted.uncommitted"); + e.disconnectRelationships() + }; + var l = { + isEmpty: false, + isLoading: false, + isLoaded: false, + isDirty: false, + isSaving: false, + isDeleted: false, + isNew: false, + isValid: true, + rolledBack: Ember.K, + unloadRecord: function (e) { + e.clearRelationships(); + e.transitionTo("deleted.saved") + }, + propertyWasReset: Ember.K, + empty: { + isEmpty: true, loadingData: function (e, r) { + e._loadingPromise = r; + e.transitionTo("loading") + }, loadedData: function (e) { + e.transitionTo("loaded.created.uncommitted"); + e.notifyPropertyChange("data") + }, pushedData: function (e) { + e.transitionTo("loaded.saved"); + e.triggerLater("didLoad") + } + }, + loading: { + isLoading: true, exit: function (e) { + e._loadingPromise = null + }, pushedData: function (e) { + e.transitionTo("loaded.saved"); + e.triggerLater("didLoad"); + t(e, "isError", false) + }, becameError: function (e) { + e.triggerLater("becameError", e) + }, notFound: function (e) { + e.transitionTo("empty") + } + }, + loaded: { + initialState: "saved", isLoaded: true, loadingData: Ember.K, saved: { + setup: function (e) { + var r = e._attributes; + var t = false; + for (var i in r) { + if (r.hasOwnProperty(i)) { + t = true; + break + } + } + if (t) { + e.adapterDidDirty() + } + }, didSetProperty: i, pushedData: Ember.K, becomeDirty: function (e) { + e.transitionTo("updated.uncommitted") + }, willCommit: function (e) { + e.transitionTo("updated.inFlight") + }, reloadRecord: function (e, t) { + t(r(e, "store").reloadRecord(e)) + }, deleteRecord: function (e) { + e.transitionTo("deleted.uncommitted"); + e.disconnectRelationships() + }, unloadRecord: function (e) { + e.clearRelationships(); + e.transitionTo("deleted.saved") + }, didCommit: function (e) { + e.send("invokeLifecycleCallbacks", r(e, "lastDirtyType")) + }, notFound: Ember.K + }, created: u, updated: d + }, + deleted: { + initialState: "uncommitted", + dirtyType: "deleted", + isDeleted: true, + isLoaded: true, + isDirty: true, + setup: function (e) { + e.updateRecordArrays() + }, + uncommitted: { + willCommit: function (e) { + e.transitionTo("inFlight") + }, rollback: function (e) { + e.rollback() + }, becomeDirty: Ember.K, deleteRecord: Ember.K, rolledBack: function (e) { + e.transitionTo("loaded.saved") + } + }, + inFlight: { + isSaving: true, unloadRecord: c, willCommit: Ember.K, didCommit: function (e) { + e.transitionTo("saved"); + e.send("invokeLifecycleCallbacks") + }, becameError: function (e) { + e.transitionTo("uncommitted"); + e.triggerLater("becameError", e) + } + }, + saved: { + isDirty: false, setup: function (e) { + var t = r(e, "store"); + t.dematerializeRecord(e) + }, invokeLifecycleCallbacks: function (e) { + e.triggerLater("didDelete", e); + e.triggerLater("didCommit", e) + }, willCommit: Ember.K, didCommit: Ember.K + } + }, + invokeLifecycleCallbacks: function (e, r) { + if (r === "created") { + e.triggerLater("didCreate", e) + } else { + e.triggerLater("didUpdate", e) + } + e.triggerLater("didCommit", e) + } + }; + + function f(e, r, t) { + e = s(r ? Ember.create(r) : {}, e); + e.parentState = r; + e.stateName = t; + for (var i in e) { + if (!e.hasOwnProperty(i) || i === "parentState" || i === "stateName") { + continue + } + if (typeof e[i] === "object") { + e[i] = f(e[i], e, t + "." + i) + } + } + return e + } + + l = f(l, null, "root"); + e["default"] = l + }); + r("ember-data/system/promise_proxies", ["exports"], function (e) { + "use strict"; + var r = Ember.RSVP.Promise; + var t = Ember.get; + var i = Ember.ArrayProxy.extend(Ember.PromiseProxyMixin); + var a = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin); + var n = function (e, t) { + return a.create({promise: r.resolve(e, t)}) + }; + var s = function (e, t) { + return i.create({promise: r.resolve(e, t)}) + }; + var o = i.extend({ + reload: function () { + return t(this, "content").reload() + } + }); + var u = function (e, t) { + return o.create({promise: r.resolve(e, t)}) + }; + e.PromiseArray = i; + e.PromiseObject = a; + e.PromiseManyArray = o; + e.promiseArray = s; + e.promiseObject = n; + e.promiseManyArray = u + }); + r("ember-data/system/record_array_manager", ["ember-data/system/record_arrays", "ember-data/system/map", "exports"], function (e, r, t) { + "use strict"; + var i = e.RecordArray; + var a = e.FilteredRecordArray; + var n = e.AdapterPopulatedRecordArray; + var s = e.ManyArray; + var o = r.MapWithDefault; + var u = r.OrderedSet; + var d = Ember.get; + var c = Ember.EnumerableUtils.forEach; + t["default"] = Ember.Object.extend({ + init: function () { + this.filteredRecordArrays = o.create({ + defaultValue: function () { + return [] + } + }); + this.changedRecords = []; + this._adapterPopulatedRecordArrays = [] + }, recordDidChange: function (e) { + if (this.changedRecords.push(e) !== 1) { + return + } + Ember.run.schedule("actions", this, this.updateRecordArrays) + }, recordArraysForRecord: function (e) { + e._recordArrays = e._recordArrays || u.create(); + return e._recordArrays + }, updateRecordArrays: function () { + c(this.changedRecords, function (e) { + if (d(e, "isDeleted")) { + this._recordWasDeleted(e) + } else { + this._recordWasChanged(e) + } + }, this); + this.changedRecords.length = 0 + }, _recordWasDeleted: function (e) { + var r = e._recordArrays; + if (!r) { + return + } + r.forEach(function (r) { + r.removeRecord(e) + }); + e._recordArrays = null + }, _recordWasChanged: function (e) { + var r = e.constructor; + var t = this.filteredRecordArrays.get(r); + var i; + c(t, function (t) { + i = d(t, "filterFunction"); + this.updateRecordArray(t, i, r, e) + }, this); + var a = e._loadingRecordArrays; + if (a) { + for (var n = 0, s = a.length; n < s; n++) { + a[n].loadedRecord() + } + e._loadingRecordArrays = [] + } + }, updateRecordArray: function (e, r, t, i) { + var a; + if (!r) { + a = true + } else { + a = r(i) + } + var n = this.recordArraysForRecord(i); + if (a) { + if (!n.has(e)) { + e.pushRecord(i); + n.add(e) + } + } else if (!a) { + n["delete"](e); + e.removeRecord(i) + } + }, updateFilter: function (e, r, t) { + var i = this.store.typeMapFor(r); + var a = i.records, n; + for (var s = 0, o = a.length; s < o; s++) { + n = a[s]; + if (!d(n, "isDeleted") && !d(n, "isEmpty")) { + this.updateRecordArray(e, t, r, n) + } + } + }, createManyArray: function (e, r) { + var t = s.create({type: e, content: r, store: this.store}); + c(r, function (e) { + var r = this.recordArraysForRecord(e); + r.add(t) + }, this); + return t + }, createRecordArray: function (e) { + var r = i.create({type: e, content: Ember.A(), store: this.store, isLoaded: true}); + this.registerFilteredRecordArray(r, e); + return r + }, createFilteredRecordArray: function (e, r, t) { + var i = a.create({ + query: t, + type: e, + content: Ember.A(), + store: this.store, + manager: this, + filterFunction: r + }); + this.registerFilteredRecordArray(i, e, r); + return i + }, createAdapterPopulatedRecordArray: function (e, r) { + var t = n.create({type: e, query: r, content: Ember.A(), store: this.store, manager: this}); + this._adapterPopulatedRecordArrays.push(t); + return t + }, registerFilteredRecordArray: function (e, r, t) { + var i = this.filteredRecordArrays.get(r); + i.push(e); + this.updateFilter(e, r, t) + }, registerWaitingRecordArray: function (e, r) { + var t = e._loadingRecordArrays || []; + t.push(r); + e._loadingRecordArrays = t + }, willDestroy: function () { + this._super(); + c(h(l(this.filteredRecordArrays.values)), f); + c(this._adapterPopulatedRecordArrays, f) + } + }); + + function l(e) { + var r = []; + var t = Ember.keys(e); + for (var i = 0; i < t.length; i++) { + r.push(e[t[i]]) + } + return r + } + + function f(e) { + e.destroy() + } + + function h(e) { + var r = e.length; + var t = Ember.A(); + for (var i = 0; i < r; i++) { + t = t.concat(e[i]) + } + return t + } + }); + r("ember-data/system/record_arrays", ["ember-data/system/record_arrays/record_array", "ember-data/system/record_arrays/filtered_record_array", "ember-data/system/record_arrays/adapter_populated_record_array", "ember-data/system/record_arrays/many_array", "exports"], function (e, r, t, i, a) { + "use strict"; + var n = e["default"]; + var s = r["default"]; + var o = t["default"]; + var u = i["default"]; + a.RecordArray = n; + a.FilteredRecordArray = s; + a.AdapterPopulatedRecordArray = o; + a.ManyArray = u + }); + r("ember-data/system/record_arrays/adapter_populated_record_array", ["ember-data/system/record_arrays/record_array", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + var i = Ember.get; + + function a(e) { + var r = Object.create(null); + for (var t in e) { + r[t] = e[t] + } + return r + } + + r["default"] = t.extend({ + query: null, replace: function () { + var e = i(this, "type").toString(); + throw new Error("The result of a server query (on " + e + ") is immutable.") + }, load: function (e) { + var r = i(this, "store"); + var t = i(this, "type"); + var n = r.pushMany(t, e); + var s = r.metadataFor(t); + this.setProperties({content: Ember.A(n), isLoaded: true, meta: a(s)}); + n.forEach(function (e) { + this.manager.recordArraysForRecord(e).add(this) + }, this); + Ember.run.once(this, "trigger", "didLoad") + } + }) + }); + r("ember-data/system/record_arrays/filtered_record_array", ["ember-data/system/record_arrays/record_array", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + var i = Ember.get; + r["default"] = t.extend({ + filterFunction: null, isLoaded: true, replace: function () { + var e = i(this, "type").toString(); + throw new Error("The result of a client-side filter (on " + e + ") is immutable.") + }, _updateFilter: function () { + var e = i(this, "manager"); + e.updateFilter(this, i(this, "type"), i(this, "filterFunction")) + }, updateFilter: Ember.observer(function () { + Ember.run.once(this, this._updateFilter) + }, "filterFunction") + }) + }); + r("ember-data/system/record_arrays/many_array", ["ember-data/system/record_arrays/record_array", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + var i = Ember.get, a = Ember.set; + r["default"] = t.extend({ + init: function () { + this._super.apply(this, arguments) + }, + isPolymorphic: false, + isLoaded: false, + relationship: null, + promise: null, + loadingRecordsCount: function (e) { + this.loadingRecordsCount = e + }, + loadedRecord: function () { + this.loadingRecordsCount--; + if (this.loadingRecordsCount === 0) { + a(this, "isLoaded", true); + this.trigger("didLoad") + } + }, + replaceContent: function (e, r, t) { + var a; + if (r > 0) { + a = i(this, "content").slice(e, e + r); + this.get("relationship").removeRecords(a) + } + if (t) { + this.get("relationship").addRecords(t, e) + } + }, + reload: function () { + return this.relationship.reload() + }, + createRecord: function (e) { + var r = i(this, "store"); + var t = i(this, "type"); + var a; + a = r.createRecord.call(r, t, e); + this.pushObject(a); + return a + } + }) + }); + r("ember-data/system/record_arrays/record_array", ["ember-data/system/promise_proxies", "exports"], function (e, r) { + "use strict"; + var t = e.PromiseArray; + var i = Ember.get; + r["default"] = Ember.ArrayProxy.extend(Ember.Evented, { + type: null, + content: null, + isLoaded: false, + isUpdating: false, + store: null, + objectAtContent: function (e) { + var r = i(this, "content"); + return r.objectAt(e) + }, + update: function () { + if (i(this, "isUpdating")) { + return + } + var e = i(this, "store"); + var r = i(this, "type"); + return e.fetchAll(r, this) + }, + addRecord: function (e, r) { + var t = i(this, "content"); + if (r === undefined) { + t.addObject(e) + } else { + if (!t.contains(e)) { + t.insertAt(r, e) + } + } + }, + pushRecord: function (e) { + i(this, "content").pushObject(e) + }, + removeRecord: function (e) { + i(this, "content").removeObject(e) + }, + save: function () { + var e = "DS: RecordArray#save " + i(this, "type"); + var r = Ember.RSVP.all(this.invoke("save"), e).then(function (e) { + return Ember.A(e) + }, null, "DS: RecordArray#save apply Ember.NativeArray"); + return t.create({promise: r}) + }, + _dissociateFromOwnRecords: function () { + var e = this; + this.forEach(function (r) { + var t = r._recordArrays; + if (t) { + t["delete"](e) + } + }) + }, + willDestroy: function () { + this._dissociateFromOwnRecords(); + this._super() + } + }) + }); + r("ember-data/system/relationship-meta", ["ember-inflector/system", "exports"], function (e, r) { + "use strict"; + var t = e.singularize; + + function i(e, r) { + var i, a; + i = r.type || r.key; + if (typeof i === "string") { + if (r.kind === "hasMany") { + i = t(i) + } + a = e.modelFor(i) + } else { + a = r.type + } + return a + } + + r.typeForRelationshipMeta = i; + + function a(e, r) { + return { + key: r.key, + kind: r.kind, + type: i(e, r), + options: r.options, + parentType: r.parentType, + isRelationship: true + } + } + + r.relationshipFromMeta = a + }); + r("ember-data/system/relationships", ["./relationships/belongs_to", "./relationships/has_many", "ember-data/system/relationships/ext", "exports"], function (e, r, t, i) { + "use strict"; + var a = e["default"]; + var n = r["default"]; + i.belongsTo = a; + i.hasMany = n + }); + r("ember-data/system/relationships/belongs_to", ["ember-data/system/model", "exports"], function (e, r) { + "use strict"; + var t = e.Model; + + function i(e, r) { + if (typeof e === "object") { + r = e; + e = undefined + } else { + } + r = r || {}; + var t = {type: e, isRelationship: true, options: r, kind: "belongsTo", key: null}; + return Ember.computed(function (e, r) { + if (arguments.length > 1) { + if (r === undefined) { + r = null + } + if (r && r.then) { + this._relationships[e].setRecordPromise(r) + } else { + this._relationships[e].setRecord(r) + } + } + return this._relationships[e].getRecord() + }).meta(t) + } + + t.reopen({ + notifyBelongsToAdded: function (e, r) { + this.notifyPropertyChange(e) + }, notifyBelongsToRemoved: function (e) { + this.notifyPropertyChange(e) + } + }); + r["default"] = i + }); + r("ember-data/system/relationships/ext", ["ember-data/system/relationship-meta", "ember-data/system/model", "ember-data/system/map"], function (e, r, t) { + "use strict"; + var i = e.typeForRelationshipMeta; + var a = e.relationshipFromMeta; + var n = r.Model; + var s = t.Map; + var o = t.MapWithDefault; + var u = Ember.get; + var d = Ember.ArrayPolyfills.filter; + n.reopen({ + didDefineProperty: function (e, r, t) { + if (t instanceof Ember.ComputedProperty) { + var i = t.meta(); + i.parentType = e.constructor + } + } + }); + n.reopenClass({ + typeForRelationship: function (e) { + var r = u(this, "relationshipsByName").get(e); + return r && r.type + }, inverseMap: Ember.computed(function () { + return Object.create(null) + }), inverseFor: function (e) { + var r = u(this, "inverseMap"); + if (r[e]) { + return r[e] + } else { + var t = this._findInverseFor(e); + r[e] = t; + return t + } + }, _findInverseFor: function (e) { + var r = this.typeForRelationship(e); + if (!r) { + return null + } + var t = this.metaForProperty(e).options; + if (t.inverse === null) { + return null + } + var i, a, n; + if (t.inverse) { + i = t.inverse; + n = Ember.get(r, "relationshipsByName").get(i); + a = n.kind + } else { + var s = c(this, r); + if (s.length === 0) { + return null + } + var o = d.call(s, function (t) { + var i = r.metaForProperty(t.name).options; + return e === i.inverse + }); + if (o.length === 1) { + s = o + } + i = s[0].name; + a = s[0].kind + } + + function c(r, t, i) { + var a = i || []; + var n = u(t, "relationships"); + if (!n) { + return + } + var s = n.get(r); + s = d.call(s, function (r) { + var i = t.metaForProperty(r.name).options; + if (!i.inverse) { + return true + } + return e === i.inverse + }); + if (s) { + a.push.apply(a, s) + } + if (r.superclass) { + c(r.superclass, t, a) + } + return a + } + + return {type: r, name: i, kind: a} + }, relationships: Ember.computed(function () { + var e = new o({ + defaultValue: function () { + return [] + } + }); + this.eachComputedProperty(function (r, t) { + if (t.isRelationship) { + t.key = r; + var a = e.get(i(this.store, t)); + a.push({name: r, kind: t.kind}) + } + }); + return e + }).cacheable(false).readOnly(), relationshipNames: Ember.computed(function () { + var e = {hasMany: [], belongsTo: []}; + this.eachComputedProperty(function (r, t) { + if (t.isRelationship) { + e[t.kind].push(r) + } + }); + return e + }), relatedTypes: Ember.computed(function () { + var e; + var r = Ember.A(); + this.eachComputedProperty(function (t, a) { + if (a.isRelationship) { + a.key = t; + e = i(this.store, a); + if (!r.contains(e)) { + r.push(e) + } + } + }); + return r + }).cacheable(false).readOnly(), relationshipsByName: Ember.computed(function () { + var e = s.create(); + this.eachComputedProperty(function (r, t) { + if (t.isRelationship) { + t.key = r; + var n = a(this.store, t); + n.type = i(this.store, t); + e.set(r, n) + } + }); + return e + }).cacheable(false).readOnly(), fields: Ember.computed(function () { + var e = s.create(); + this.eachComputedProperty(function (r, t) { + if (t.isRelationship) { + e.set(r, t.kind) + } else if (t.isAttribute) { + e.set(r, "attribute") + } + }); + return e + }).readOnly(), eachRelationship: function (e, r) { + u(this, "relationshipsByName").forEach(function (t, i) { + e.call(r, i, t) + }) + }, eachRelatedType: function (e, r) { + u(this, "relatedTypes").forEach(function (t) { + e.call(r, t) + }) + }, determineRelationshipType: function (e) { + var r = e.key; + var t = e.kind; + var i = this.inverseFor(r); + var a, n; + if (!i) { + return t === "belongsTo" ? "oneToNone" : "manyToNone" + } + a = i.name; + n = i.kind; + if (n === "belongsTo") { + return t === "belongsTo" ? "oneToOne" : "manyToOne" + } else { + return t === "belongsTo" ? "oneToMany" : "manyToMany" + } + } + }); + n.reopen({ + eachRelationship: function (e, r) { + this.constructor.eachRelationship(e, r) + }, relationshipFor: function (e) { + return u(this.constructor, "relationshipsByName").get(e) + }, inverseFor: function (e) { + return this.constructor.inverseFor(e) + } + }) + }); + r("ember-data/system/relationships/has_many", ["ember-data/system/model", "exports"], function (e, r) { + "use strict"; + var t = e.Model; + + function i(e, r) { + if (typeof e === "object") { + r = e; + e = undefined + } + r = r || {}; + var t = {type: e, isRelationship: true, options: r, kind: "hasMany", key: null}; + return Ember.computed(function (e) { + var r = this._relationships[e]; + return r.getRecords() + }).meta(t).readOnly() + } + + t.reopen({ + notifyHasManyAdded: function (e, r, t) { + var i = this._relationships[e]; + var a = i.manyArray; + a.addRecord(r, t); + this.notifyPropertyChange(e) + }, notifyHasManyRemoved: function (e, r) { + var t = this._relationships[e]; + var i = t.manyArray; + i.removeRecord(r) + } + }); + r["default"] = i + }); + r("ember-data/system/relationships/relationship", ["ember-data/system/promise_proxies", "ember-data/system/map", "exports"], function (e, r, t) { + "use strict"; + var i = e.PromiseManyArray; + var a = e.PromiseObject; + var n = r.OrderedSet; + var s = function (e, r, t, i) { + this.members = new n; + this.store = e; + this.key = i.key; + this.inverseKey = t; + this.record = r; + this.key = i.key; + this.isAsync = i.options.async; + this.relationshipMeta = i; + this.inverseKeyForImplicit = this.store.modelFor(this.record.constructor).typeKey + this.key; + this.linkPromise = null + }; + s.prototype = { + constructor: s, destroy: Ember.K, clear: function () { + this.members.forEach(function (e) { + this.removeRecord(e) + }, this) + }, disconnect: function () { + this.members.forEach(function (e) { + this.removeRecordFromInverse(e) + }, this) + }, reconnect: function () { + this.members.forEach(function (e) { + this.addRecordToInverse(e) + }, this) + }, removeRecords: function (e) { + var r = this; + e.forEach(function (e) { + r.removeRecord(e) + }) + }, addRecords: function (e, r) { + var t = this; + e.forEach(function (e) { + t.addRecord(e, r); + if (r !== undefined) { + r++ + } + }) + }, addRecord: function (e, r) { + if (!this.members.has(e)) { + this.members.add(e); + this.notifyRecordRelationshipAdded(e, r); + if (this.inverseKey) { + e._relationships[this.inverseKey].addRecord(this.record) + } else { + if (!e._implicitRelationships[this.inverseKeyForImplicit]) { + e._implicitRelationships[this.inverseKeyForImplicit] = new s(this.store, e, this.key, {options: {}}) + } + e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record) + } + this.record.updateRecordArrays() + } + }, removeRecord: function (e) { + if (this.members.has(e)) { + this.removeRecordFromOwn(e); + if (this.inverseKey) { + this.removeRecordFromInverse(e) + } else { + if (e._implicitRelationships[this.inverseKeyForImplicit]) { + e._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record) + } + } + } + }, addRecordToInverse: function (e) { + if (this.inverseKey) { + e._relationships[this.inverseKey].addRecord(this.record) + } + }, removeRecordFromInverse: function (e) { + var r = e._relationships[this.inverseKey]; + if (r) { + r.removeRecordFromOwn(this.record) + } + }, removeRecordFromOwn: function (e) { + this.members["delete"](e); + this.notifyRecordRelationshipRemoved(e); + this.record.updateRecordArrays() + }, updateLink: function (e) { + if (e !== this.link) { + this.link = e; + this.linkPromise = null; + this.record.notifyPropertyChange(this.key) + } + }, findLink: function () { + if (this.linkPromise) { + return this.linkPromise + } else { + var e = this.fetchLink(); + this.linkPromise = e; + return e.then(function (e) { + return e + }) + } + }, updateRecordsFromAdapter: function (e) { + this.computeChanges(e) + }, notifyRecordRelationshipAdded: Ember.K, notifyRecordRelationshipRemoved: Ember.K + }; + var o = function (e, r, t, i) { + this._super$constructor(e, r, t, i); + this.belongsToType = i.type; + this.manyArray = e.recordArrayManager.createManyArray(this.belongsToType, Ember.A()); + this.manyArray.relationship = this; + this.isPolymorphic = i.options.polymorphic; + this.manyArray.isPolymorphic = this.isPolymorphic + }; + o.prototype = Object.create(s.prototype); + o.prototype.constructor = o; + o.prototype._super$constructor = s; + o.prototype.destroy = function () { + this.manyArray.destroy() + }; + o.prototype.notifyRecordRelationshipAdded = function (e, r) { + this.record.notifyHasManyAdded(this.key, e, r) + }; + o.prototype.notifyRecordRelationshipRemoved = function (e) { + this.record.notifyHasManyRemoved(this.key, e) + }; + o.prototype.reload = function () { + var e = this; + if (this.link) { + return this.fetchLink() + } else { + return this.store.scheduleFetchMany(this.manyArray.toArray()).then(function () { + e.manyArray.set("isLoaded", true); + return e.manyArray + }) + } + }; + o.prototype.computeChanges = function (e) { + var r = this.members; + var t = []; + var i; + var a; + var n; + e = d(e); + r.forEach(function (r) { + if (e.has(r)) return; + t.push(r) + }); + this.removeRecords(t); + var s = this.manyArray; + e = e.toArray(); + i = e.length; + for (n = 0; n < i; n++) { + a = e[n]; + if (s.objectAt(n) === a) { + continue + } + this.removeRecord(a); + this.addRecord(a, n) + } + }; + o.prototype.fetchLink = function () { + var e = this; + return this.store.findHasMany(this.record, this.link, this.relationshipMeta).then(function (r) { + e.updateRecordsFromAdapter(r); + return e.manyArray + }) + }; + o.prototype.findRecords = function () { + var e = this.manyArray; + return this.store.findMany(e.toArray()).then(function () { + e.set("isLoaded", true); + return e + }) + }; + o.prototype.getRecords = function () { + if (this.isAsync) { + var e = this; + var r; + if (this.link) { + r = this.findLink().then(function () { + return e.findRecords() + }) + } else { + r = this.findRecords() + } + return i.create({content: this.manyArray, promise: r}) + } else { + this.manyArray.set("isLoaded", true); + return this.manyArray + } + }; + var u = function (e, r, t, i) { + this._super$constructor(e, r, t, i); + this.record = r; + this.key = i.key; + this.inverseRecord = null + }; + u.prototype = Object.create(s.prototype); + u.prototype.constructor = u; + u.prototype._super$constructor = s; + u.prototype.setRecord = function (e) { + if (e) { + this.addRecord(e) + } else if (this.inverseRecord) { + this.removeRecord(this.inverseRecord) + } + }; + u.prototype._super$addRecord = s.prototype.addRecord; + u.prototype.addRecord = function (e) { + if (this.members.has(e)) { + return + } + var r = this.relationshipMeta.type; + if (this.inverseRecord) { + this.removeRecord(this.inverseRecord) + } + this.inverseRecord = e; + this._super$addRecord(e) + }; + u.prototype.setRecordPromise = function (e) { + var r = e.get && e.get("content"); + this.setRecord(r) + }; + u.prototype.notifyRecordRelationshipAdded = function (e) { + this.record.notifyBelongsToAdded(this.key, this) + }; + u.prototype.notifyRecordRelationshipRemoved = function (e) { + this.record.notifyBelongsToRemoved(this.key, this) + }; + u.prototype._super$removeRecordFromOwn = s.prototype.removeRecordFromOwn; + u.prototype.removeRecordFromOwn = function (e) { + if (!this.members.has(e)) { + return + } + this._super$removeRecordFromOwn(e); + this.inverseRecord = null + }; + u.prototype.findRecord = function () { + if (this.inverseRecord) { + return this.store._findByRecord(this.inverseRecord) + } else { + return Ember.RSVP.Promise.resolve(null) + } + }; + u.prototype.fetchLink = function () { + var e = this; + return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function (r) { + e.addRecord(r); + return r + }) + }; + u.prototype.getRecord = function () { + if (this.isAsync) { + var e; + if (this.link) { + var r = this; + e = this.findLink().then(function () { + return r.findRecord() + }) + } else { + e = this.findRecord() + } + return a.create({promise: e, content: this.inverseRecord}) + } else { + return this.inverseRecord + } + }; + + function d(e) { + var r = new n; + if (e) { + for (var t = 0, i = e.length; t < i; t++) { + r.add(e[t]) + } + } + return r + } + + var c = function (e, r, t) { + var i; + var a = e.constructor.inverseFor(r.key); + if (a) { + i = a.name + } + if (r.kind === "hasMany") { + return new o(t, e, i, r) + } else { + return new u(t, e, i, r) + } + }; + t.Relationship = s; + t.ManyRelationship = o; + t.BelongsToRelationship = u; + t.createRelationshipFor = c + }); + r("ember-data/system/store", ["ember-data/system/adapter", "ember-inflector/system/string", "ember-data/system/map", "ember-data/system/promise_proxies", "exports"], function (e, r, i, a, n) { + "use strict"; + var s = e.InvalidError; + var o = e.Adapter; + var u = r.singularize; + var d = i.Map; + var c = a.promiseArray; + var l = a.promiseObject; + var f = Ember.get; + var h = Ember.set; + var p = Ember.run.once; + var m = Ember.isNone; + var y = Ember.EnumerableUtils.forEach; + var v = Ember.EnumerableUtils.indexOf; + var b = Ember.EnumerableUtils.map; + var g = Ember.RSVP.Promise; + var R = Ember.copy; + var E, _, A; + var F = Ember.String.camelize; + + function z(e) { + return e == null ? null : e + "" + } + + E = Ember.Object.extend({ + init: function () { + if (!_) { + _ = t("ember-data/system/record_array_manager")["default"] + } + this.typeMaps = {}; + this.recordArrayManager = _.create({store: this}); + this._pendingSave = []; + this._pendingFetch = d.create() + }, adapter: "-rest", serialize: function (e, r) { + return this.serializerFor(e.constructor.typeKey).serialize(e, r) + }, defaultAdapter: Ember.computed("adapter", function () { + var e = f(this, "adapter"); + if (typeof e === "string") { + e = this.container.lookup("adapter:" + e) || this.container.lookup("adapter:application") || this.container.lookup("adapter:-rest") + } + if (DS.Adapter.detect(e)) { + e = e.create({container: this.container}) + } + return e + }), createRecord: function (e, r) { + var t = this.modelFor(e); + var i = R(r) || {}; + if (m(i.id)) { + i.id = this._generateId(t) + } + i.id = z(i.id); + var a = this.buildRecord(t, i.id); + a.loadedData(); + a.setProperties(i); + return a + }, _generateId: function (e) { + var r = this.adapterFor(e); + if (r && r.generateIdForRecord) { + return r.generateIdForRecord(this) + } + return null + }, deleteRecord: function (e) { + e.deleteRecord() + }, unloadRecord: function (e) { + e.unloadRecord() + }, find: function (e, r, t) { + if (arguments.length === 1) { + return this.findAll(e) + } + if (Ember.typeOf(r) === "object") { + return this.findQuery(e, r) + } + return this.findById(e, z(r), t) + }, findById: function (e, r, t) { + var i = this.modelFor(e); + var a = this.recordForId(i, r); + return this._findByRecord(a, t) + }, _findByRecord: function (e, r) { + var t; + if (r) { + e._preloadData(r) + } + if (f(e, "isEmpty")) { + t = this.scheduleFetch(e) + } else if (f(e, "isLoading")) { + t = e._loadingPromise + } + return l(t || e, "DS: Store#findByRecord " + e.typeKey + " with id: " + f(e, "id")) + }, findByIds: function (e, r) { + var t = this; + return c(Ember.RSVP.all(b(r, function (r) { + return t.findById(e, r) + })).then(Ember.A, null, "DS: Store#findByIds of " + e + " complete")) + }, fetchRecord: function (e) { + var r = e.constructor; + var t = f(e, "id"); + var i = this.adapterFor(r); + var a = $(i, this, r, t, e); + return a + }, scheduleFetchMany: function (e) { + return Ember.RSVP.all(b(e, this.scheduleFetch, this)) + }, scheduleFetch: function (e) { + var r = e.constructor; + if (m(e)) { + return null + } + if (e._loadingPromise) { + return e._loadingPromise + } + var t = Ember.RSVP.defer("Fetching " + r + "with id: " + e.get("id")); + var i = {record: e, resolver: t}; + var a = t.promise; + e.loadingData(a); + if (!this._pendingFetch.get(r)) { + this._pendingFetch.set(r, [i]) + } else { + this._pendingFetch.get(r).push(i) + } + Ember.run.scheduleOnce("afterRender", this, this.flushAllPendingFetches); + return a + }, flushAllPendingFetches: function () { + if (this.isDestroyed || this.isDestroying) { + return + } + this._pendingFetch.forEach(this._flushPendingFetchForType, this); + this._pendingFetch = d.create() + }, _flushPendingFetchForType: function (e, r) { + var t = this; + var i = t.adapterFor(r); + var a = !!i.findMany && i.coalesceFindRequests; + var n = Ember.A(e).mapBy("record"); + + function s(e) { + e.resolver.resolve(t.fetchRecord(e.record)) + } + + function o(r) { + y(r, function (r) { + var t = Ember.A(e).findBy("record", r); + if (t) { + var i = t.resolver; + i.resolve(r) + } + }) + } + + function u(e) { + return function r(t) { + var i = e.without(t); + c(i) + } + } + + function d(e) { + return function (r) { + c(e, r) + } + } + + function c(r, t) { + y(r, function (r) { + var i = Ember.A(e).findBy("record", r); + if (i) { + var a = i.resolver; + a.reject(t) + } + }) + } + + if (e.length === 1) { + s(e[0]) + } else if (a) { + var l = i.groupRecordsForFindMany(this, n); + y(l, function (a) { + var n = Ember.A(a); + var c = n.mapBy("id"); + if (c.length > 1) { + I(i, t, r, c, n).then(o).then(u(n)).then(null, d(n)) + } else if (c.length === 1) { + var l = Ember.A(e).findBy("record", a[0]); + s(l) + } else { + } + }) + } else { + y(e, s) + } + }, getById: function (e, r) { + if (this.hasRecordForId(e, r)) { + return this.recordForId(e, r) + } else { + return null + } + }, reloadRecord: function (e) { + var r = e.constructor; + var t = this.adapterFor(r); + var i = f(e, "id"); + return this.scheduleFetch(e) + }, hasRecordForId: function (e, r) { + var t = this.modelFor(e); + var i = z(r); + return !!this.typeMapFor(t).idToRecord[i] + }, recordForId: function (e, r) { + var t = this.modelFor(e); + var i = z(r); + var a = this.typeMapFor(t).idToRecord; + var n = a[i]; + if (!n || !a[i]) { + n = this.buildRecord(t, i) + } + return n + }, findMany: function (e) { + var r = this; + return g.all(b(e, function (e) { + return r._findByRecord(e) + })) + }, findHasMany: function (e, r, t) { + var i = this.adapterFor(e.constructor); + return L(i, this, e, r, t) + }, findBelongsTo: function (e, r, t) { + var i = this.adapterFor(e.constructor); + return j(i, this, e, r, t) + }, findQuery: function (e, r) { + var t = this.modelFor(e); + var i = this.recordArrayManager.createAdapterPopulatedRecordArray(t, r); + var a = this.adapterFor(t); + return c(U(a, this, t, r, i)) + }, findAll: function (e) { + var r = this.modelFor(e); + return this.fetchAll(r, this.all(r)) + }, fetchAll: function (e, r) { + var t = this.adapterFor(e); + var i = this.typeMapFor(e).metadata.since; + h(r, "isUpdating", true); + return c(K(t, this, e, i)) + }, didUpdateAll: function (e) { + var r = this.typeMapFor(e).findAllCache; + h(r, "isUpdating", false) + }, all: function (e) { + var r = this.modelFor(e); + var t = this.typeMapFor(r); + var i = t.findAllCache; + if (i) { + return i + } + var a = this.recordArrayManager.createRecordArray(r); + t.findAllCache = a; + return a + }, unloadAll: function (e) { + var r = this.modelFor(e); + var t = this.typeMapFor(r); + var i = t.records.slice(); + var a; + for (var n = 0; n < i.length; n++) { + a = i[n]; + a.unloadRecord(); + a.destroy() + } + t.findAllCache = null + }, filter: function (e, r, t) { + var i; + var a = arguments.length; + var n; + var s = a === 3; + if (s) { + i = this.findQuery(e, r) + } else if (arguments.length === 2) { + t = r + } + e = this.modelFor(e); + if (s) { + n = this.recordArrayManager.createFilteredRecordArray(e, t, r) + } else { + n = this.recordArrayManager.createFilteredRecordArray(e, t) + } + i = i || g.cast(n); + return c(i.then(function () { + return n + }, null, "DS: Store#filter of " + e)) + }, recordIsLoaded: function (e, r) { + if (!this.hasRecordForId(e, r)) { + return false + } + return !f(this.recordForId(e, r), "isEmpty") + }, metadataFor: function (e) { + e = this.modelFor(e); + return this.typeMapFor(e).metadata + }, dataWasUpdated: function (e, r) { + this.recordArrayManager.recordDidChange(r) + }, scheduleSave: function (e, r) { + e.adapterWillCommit(); + this._pendingSave.push([e, r]); + p(this, "flushPendingSave") + }, flushPendingSave: function () { + var e = this._pendingSave.slice(); + this._pendingSave = []; + y(e, function (e) { + var r = e[0], t = e[1]; + var i = this.adapterFor(r.constructor); + var a; + if (f(r, "currentState.stateName") === "root.deleted.saved") { + return t.resolve(r) + } else if (f(r, "isNew")) { + a = "createRecord" + } else if (f(r, "isDeleted")) { + a = "deleteRecord" + } else { + a = "updateRecord" + } + t.resolve(B(i, this, a, r)) + }, this) + }, didSaveRecord: function (e, r) { + if (r) { + r = x(this, e.constructor, r, e); + N(this, e, r); + this.updateId(e, r) + } + e.adapterDidCommit(r) + }, recordWasInvalid: function (e, r) { + e.adapterDidInvalidate(r) + }, recordWasError: function (e) { + e.adapterDidError() + }, updateId: function (e, r) { + var t = f(e, "id"); + var i = z(r.id); + this.typeMapFor(e.constructor).idToRecord[i] = e; + h(e, "id", i) + }, typeMapFor: function (e) { + var r = f(this, "typeMaps"); + var t = Ember.guidFor(e); + var i; + i = r[t]; + if (i) { + return i + } + i = {idToRecord: Object.create(null), records: [], metadata: Object.create(null), type: e}; + r[t] = i; + return i + }, _load: function (e, r, t) { + var i = z(r.id); + var a = this.recordForId(e, i); + a.setupData(r, t); + this.recordArrayManager.recordDidChange(a); + return a + }, modelFor: function (e) { + var r; + if (typeof e === "string") { + r = this.modelFactoryFor(e); + if (!r) { + throw new Ember.Error("No model was found for '" + e + "'") + } + r.typeKey = r.typeKey || this._normalizeTypeKey(e) + } else { + r = e; + if (r.typeKey) { + r.typeKey = this._normalizeTypeKey(r.typeKey) + } + } + r.store = this; + return r + }, modelFactoryFor: function (e) { + return this.container.lookupFactory("model:" + e) + }, push: function (e, r, t) { + var i = this.modelFor(e); + r = x(this, i, r); + this._load(i, r, t); + var a = this.recordForId(i, r.id); + N(this, a, r); + return a + }, pushPayload: function (e, r) { + var t; + var i; + if (!r) { + i = e; + t = D(this.container) + } else { + i = r; + t = this.serializerFor(e) + } + t.pushPayload(this, i) + }, normalize: function (e, r) { + var t = this.serializerFor(e); + var i = this.modelFor(e); + return t.normalize(i, r) + }, update: function (e, r) { + return this.push(e, r, true) + }, pushMany: function (e, r) { + var t = r.length; + var i = new Array(t); + for (var a = 0; a < t; a++) { + i[a] = this.push(e, r[a]) + } + return i + }, metaForType: function (e, r) { + var t = this.modelFor(e); + Ember.merge(this.typeMapFor(t).metadata, r) + }, buildRecord: function (e, r, t) { + var i = this.typeMapFor(e); + var a = i.idToRecord; + var n = e._create({id: r, store: this, container: this.container}); + if (t) { + n.setupData(t) + } + if (r) { + a[r] = n + } + i.records.push(n); + return n + }, dematerializeRecord: function (e) { + var r = e.constructor; + var t = this.typeMapFor(r); + var i = f(e, "id"); + e.updateRecordArrays(); + if (i) { + delete t.idToRecord[i] + } + var a = v(t.records, e); + t.records.splice(a, 1) + }, adapterFor: function (e) { + var r = this.container, t; + if (r) { + t = r.lookup("adapter:" + e.typeKey) || r.lookup("adapter:application") + } + return t || f(this, "defaultAdapter") + }, serializerFor: function (e) { + e = this.modelFor(e); + var r = this.adapterFor(e); + return M(this.container, e.typeKey, r && r.defaultSerializer) + }, willDestroy: function () { + var e = this.typeMaps; + var r = Ember.keys(e); + var t = b(r, i); + this.recordArrayManager.destroy(); + y(t, this.unloadAll, this); + + function i(r) { + return e[r]["type"] + } + }, _normalizeTypeKey: function (e) { + return F(u(e)) + } + }); + + function x(e, r, t, i) { + r.eachRelationship(function (r, i) { + var a = i.kind; + var n = t[r]; + if (a === "belongsTo") { + T(e, t, r, i, n) + } else if (a === "hasMany") { + k(e, t, r, i, n) + } + }); + return t + } + + function T(e, r, i, a, n) { + if (!A) { + A = t("ember-data/system/model")["Model"] + } + if (m(n) || n instanceof A) { + return + } + var s; + if (typeof n === "number" || typeof n === "string") { + s = S(a, i, r); + r[i] = e.recordForId(s, n) + } else if (typeof n === "object") { + r[i] = e.recordForId(n.type, n.id) + } + } + + function S(e, r, t) { + if (e.options.polymorphic) { + return t[r + "Type"] + } else { + return e.type + } + } + + function k(e, r, t, i, a) { + if (!Ember.isArray(a)) { + return + } + for (var n = 0, s = a.length; n < s; n++) { + T(e, a, n, i, a[n]) + } + } + + function M(e, r, t) { + return e.lookup("serializer:" + r) || e.lookup("serializer:application") || e.lookup("serializer:" + t) || e.lookup("serializer:-default") + } + + function D(e) { + return e.lookup("serializer:application") || e.lookup("serializer:-default") + } + + function P(e, r) { + var t = e.serializer; + var i = e.defaultSerializer; + var a = e.container; + if (a && t === undefined) { + t = M(a, r.typeKey, i) + } + if (t === null || t === undefined) { + t = { + extract: function (e, r, t) { + return t + } + } + } + return t + } + + function O(e) { + return !(f(e, "isDestroyed") || f(e, "isDestroying")) + } + + function C(e, r) { + var t = e["finally"](function () { + if (!r()) { + t._subscribers.length = 0 + } + }); + return t + } + + function w(e) { + var r = Array.prototype.slice.call(arguments, 1); + return function () { + return e.apply(undefined, r) + } + } + + function $(e, r, t, i, a) { + var n = e.find(r, t, i, a); + var s = P(e, t); + var o = "DS: Handle Adapter#find of " + t + " with id: " + i; + n = g.cast(n, o); + n = C(n, w(O, r)); + return n.then(function (e) { + var a = s.extract(r, t, e, i, "find"); + return r.push(t, a) + }, function (e) { + var a = r.getById(t, i); + if (a) { + a.notFound() + } + throw e + }, "DS: Extract payload of '" + t + "'") + } + + function I(e, r, t, i, a) { + var n = e.findMany(r, t, i, a); + var s = P(e, t); + var o = "DS: Handle Adapter#findMany of " + t; + if (n === undefined) { + throw new Error("adapter.findMany returned undefined, this was very likely a mistake") + } + n = g.cast(n, o); + n = C(n, w(O, r)); + return n.then(function (e) { + var i = s.extract(r, t, e, null, "findMany"); + return r.pushMany(t, i) + }, null, "DS: Extract payload of " + t) + } + + function L(e, r, t, i, a) { + var n = e.findHasMany(r, t, i, a); + var s = P(e, a.type); + var o = "DS: Handle Adapter#findHasMany of " + t + " : " + a.type; + n = g.cast(n, o); + n = C(n, w(O, r)); + n = C(n, w(O, t)); + return n.then(function (e) { + var t = s.extract(r, a.type, e, null, "findHasMany"); + var i = r.pushMany(a.type, t); + return i + }, null, "DS: Extract payload of " + t + " : hasMany " + a.type) + } + + function j(e, r, t, i, a) { + var n = e.findBelongsTo(r, t, i, a); + var s = P(e, a.type); + var o = "DS: Handle Adapter#findBelongsTo of " + t + " : " + a.type; + n = g.cast(n, o); + n = C(n, w(O, r)); + n = C(n, w(O, t)); + return n.then(function (e) { + var t = s.extract(r, a.type, e, null, "findBelongsTo"); + var i = r.push(a.type, t); + return i + }, null, "DS: Extract payload of " + t + " : " + a.type) + } + + function K(e, r, t, i) { + var a = e.findAll(r, t, i); + var n = P(e, t); + var s = "DS: Handle Adapter#findAll of " + t; + a = g.cast(a, s); + a = C(a, w(O, r)); + return a.then(function (e) { + var i = n.extract(r, t, e, null, "findAll"); + r.pushMany(t, i); + r.didUpdateAll(t); + return r.all(t) + }, null, "DS: Extract payload of findAll " + t) + } + + function U(e, r, t, i, a) { + var n = e.findQuery(r, t, i, a); + var s = P(e, t); + var o = "DS: Handle Adapter#findQuery of " + t; + n = g.cast(n, o); + n = C(n, w(O, r)); + return n.then(function (e) { + var i = s.extract(r, t, e, null, "findQuery"); + a.load(i); + return a + }, null, "DS: Extract payload of findQuery " + t) + } + + function B(e, r, t, i) { + var a = i.constructor; + var n = e[t](r, a, i); + var o = P(e, a); + var u = "DS: Extract and notify about " + t + " completion of " + i; + n = g.cast(n, u); + n = C(n, w(O, r)); + n = C(n, w(O, i)); + return n.then(function (e) { + var n; + if (e) { + n = o.extract(r, a, e, f(i, "id"), t) + } else { + n = e + } + r.didSaveRecord(i, n); + return i + }, function (e) { + if (e instanceof s) { + r.recordWasInvalid(i, e.errors) + } else { + r.recordWasError(i, e) + } + throw e + }, u) + } + + function N(e, r, t) { + var i = r.constructor; + i.eachRelationship(function (e, i) { + var a = i.kind; + var n = t[e]; + var s = r._relationships[e]; + if (t.links && t.links[e]) { + s.updateLink(t.links[e]) + } + if (a === "belongsTo") { + if (n === undefined) { + return + } + s.setRecord(n) + } else if (a === "hasMany" && n) { + s.updateRecordsFromAdapter(n) + } + }) + } + + n.Store = E; + n["default"] = E + }); + r("ember-data/transforms", ["ember-data/transforms/base", "ember-data/transforms/number", "ember-data/transforms/date", "ember-data/transforms/string", "ember-data/transforms/boolean", "exports"], function (e, r, t, i, a, n) { + "use strict"; + var s = e["default"]; + var o = r["default"]; + var u = t["default"]; + var d = i["default"]; + var c = a["default"]; + n.Transform = s; + n.NumberTransform = o; + n.DateTransform = u; + n.StringTransform = d; + n.BooleanTransform = c + }); + r("ember-data/transforms/base", ["exports"], function (e) { + "use strict"; + e["default"] = Ember.Object.extend({serialize: Ember.required(), deserialize: Ember.required()}) + }); + r("ember-data/transforms/boolean", ["ember-data/transforms/base", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + r["default"] = t.extend({ + deserialize: function (e) { + var r = typeof e; + if (r === "boolean") { + return e + } else if (r === "string") { + return e.match(/^true$|^t$|^1$/i) !== null + } else if (r === "number") { + return e === 1 + } else { + return false + } + }, serialize: function (e) { + return Boolean(e) + } + }) + }); + r("ember-data/transforms/date", ["ember-data/transforms/base", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + var i = Date.prototype.toISOString || function () { + function e(e) { + if (e < 10) { + return "0" + e + } + return e + } + + return this.getUTCFullYear() + "-" + e(this.getUTCMonth() + 1) + "-" + e(this.getUTCDate()) + "T" + e(this.getUTCHours()) + ":" + e(this.getUTCMinutes()) + ":" + e(this.getUTCSeconds()) + "." + (this.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z" + }; + if (Ember.SHIM_ES5) { + if (!Date.prototype.toISOString) { + Date.prototype.toISOString = i + } + } + r["default"] = t.extend({ + deserialize: function (e) { + var r = typeof e; + if (r === "string") { + return new Date(Ember.Date.parse(e)) + } else if (r === "number") { + return new Date(e) + } else if (e === null || e === undefined) { + return e + } else { + return null + } + }, serialize: function (e) { + if (e instanceof Date) { + return i.call(e) + } else { + return null + } + } + }) + }); + r("ember-data/transforms/number", ["ember-data/transforms/base", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + var i = Ember.isEmpty; + r["default"] = t.extend({ + deserialize: function (e) { + return i(e) ? null : Number(e) + }, serialize: function (e) { + return i(e) ? null : Number(e) + } + }) + }); + r("ember-data/transforms/string", ["ember-data/transforms/base", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + var i = Ember.isNone; + r["default"] = t.extend({ + deserialize: function (e) { + return i(e) ? null : String(e) + }, serialize: function (e) { + return i(e) ? null : String(e) + } + }) + }); + r("ember-inflector", ["./system", "./helpers", "./ext/string", "exports"], function (e, r, t, i) { + "use strict"; + var a = e.Inflector; + var n = e.defaultRules; + var s = e.pluralize; + var o = e.singularize; + a.defaultRules = n; + Ember.Inflector = a; + Ember.String.pluralize = s; + Ember.String.singularize = o; + i["default"] = a; + i.pluralize = s; + i.singularize = o + }); + r("ember-inflector/ext/string", ["../system/string"], function (e) { + "use strict"; + var r = e.pluralize; + var t = e.singularize; + if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) { + String.prototype.pluralize = function () { + return r(this) + }; + String.prototype.singularize = function () { + return t(this) + } + } + }); + r("ember-inflector/helpers", ["./system/string"], function (e) { + "use strict"; + var r = e.singularize; + var t = e.pluralize; + Ember.Handlebars.helper("singularize", r); + Ember.Handlebars.helper("pluralize", t) + }); + r("ember-inflector/system", ["./system/inflector", "./system/string", "./system/inflections", "exports"], function (e, r, t, i) { + "use strict"; + var a = e["default"]; + var n = r.pluralize; + var s = r.singularize; + var o = t["default"]; + a.inflector = new a(o); + i.Inflector = a; + i.singularize = s; + i.pluralize = n; + i.defaultRules = o + }); + r("ember-inflector/system/inflections", ["exports"], function (e) { + "use strict"; + e["default"] = { + plurals: [[/$/, "s"], [/s$/i, "s"], [/^(ax|test)is$/i, "$1es"], [/(octop|vir)us$/i, "$1i"], [/(octop|vir)i$/i, "$1i"], [/(alias|status)$/i, "$1es"], [/(bu)s$/i, "$1ses"], [/(buffal|tomat)o$/i, "$1oes"], [/([ti])um$/i, "$1a"], [/([ti])a$/i, "$1a"], [/sis$/i, "ses"], [/(?:([^f])fe|([lr])f)$/i, "$1$2ves"], [/(hive)$/i, "$1s"], [/([^aeiouy]|qu)y$/i, "$1ies"], [/(x|ch|ss|sh)$/i, "$1es"], [/(matr|vert|ind)(?:ix|ex)$/i, "$1ices"], [/^(m|l)ouse$/i, "$1ice"], [/^(m|l)ice$/i, "$1ice"], [/^(ox)$/i, "$1en"], [/^(oxen)$/i, "$1"], [/(quiz)$/i, "$1zes"]], + singular: [[/s$/i, ""], [/(ss)$/i, "$1"], [/(n)ews$/i, "$1ews"], [/([ti])a$/i, "$1um"], [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, "$1sis"], [/(^analy)(sis|ses)$/i, "$1sis"], [/([^f])ves$/i, "$1fe"], [/(hive)s$/i, "$1"], [/(tive)s$/i, "$1"], [/([lr])ves$/i, "$1f"], [/([^aeiouy]|qu)ies$/i, "$1y"], [/(s)eries$/i, "$1eries"], [/(m)ovies$/i, "$1ovie"], [/(x|ch|ss|sh)es$/i, "$1"], [/^(m|l)ice$/i, "$1ouse"], [/(bus)(es)?$/i, "$1"], [/(o)es$/i, "$1"], [/(shoe)s$/i, "$1"], [/(cris|test)(is|es)$/i, "$1is"], [/^(a)x[ie]s$/i, "$1xis"], [/(octop|vir)(us|i)$/i, "$1us"], [/(alias|status)(es)?$/i, "$1"], [/^(ox)en/i, "$1"], [/(vert|ind)ices$/i, "$1ex"], [/(matr)ices$/i, "$1ix"], [/(quiz)zes$/i, "$1"], [/(database)s$/i, "$1"]], + irregularPairs: [["person", "people"], ["man", "men"], ["child", "children"], ["sex", "sexes"], ["move", "moves"], ["cow", "kine"], ["zombie", "zombies"]], + uncountable: ["equipment", "information", "rice", "money", "species", "series", "fish", "sheep", "jeans", "police"] + } + }); + r("ember-inflector/system/inflector", ["exports"], function (e) { + "use strict"; + var r = /^\s*$/; + var t = /(\w+[_-])([a-z\d]+$)/; + var i = /(\w+)([A-Z][a-z\d]*$)/; + var a = /[A-Z][a-z\d]*$/; + + function n(e, r) { + for (var t = 0, i = r.length; t < i; t++) { + e.uncountable[r[t].toLowerCase()] = true + } + } + + function s(e, r) { + var t; + for (var i = 0, a = r.length; i < a; i++) { + t = r[i]; + e.irregular[t[0].toLowerCase()] = t[1]; + e.irregular[t[1].toLowerCase()] = t[1]; + e.irregularInverse[t[1].toLowerCase()] = t[0]; + e.irregularInverse[t[0].toLowerCase()] = t[0] + } + } + + function o(e) { + e = e || {}; + e.uncountable = e.uncountable || u(); + e.irregularPairs = e.irregularPairs || u(); + var r = this.rules = { + plurals: e.plurals || [], + singular: e.singular || [], + irregular: u(), + irregularInverse: u(), + uncountable: u() + }; + n(r, e.uncountable); + s(r, e.irregularPairs); + this.enableCache() + } + + if (!Object.create && !Object.create(null).hasOwnProperty) { + throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg") + } + + function u() { + var e = Object.create(null); + e["_dict"] = null; + delete e["_dict"]; + return e + } + + o.prototype = { + enableCache: function () { + this.purgeCache(); + this.singularize = function (e) { + this._cacheUsed = true; + return this._sCache[e] || (this._sCache[e] = this._singularize(e)) + }; + this.pluralize = function (e) { + this._cacheUsed = true; + return this._pCache[e] || (this._pCache[e] = this._pluralize(e)) + } + }, purgeCache: function () { + this._cacheUsed = false; + this._sCache = u(); + this._pCache = u() + }, disableCache: function () { + this._sCache = null; + this._pCache = null; + this.singularize = function (e) { + return this._singularize(e) + }; + this.pluralize = function (e) { + return this._pluralize(e) + } + }, plural: function (e, r) { + if (this._cacheUsed) { + this.purgeCache() + } + this.rules.plurals.push([e, r.toLowerCase()]) + }, singular: function (e, r) { + if (this._cacheUsed) { + this.purgeCache() + } + this.rules.singular.push([e, r.toLowerCase()]) + }, uncountable: function (e) { + if (this._cacheUsed) { + this.purgeCache() + } + n(this.rules, [e.toLowerCase()]) + }, irregular: function (e, r) { + if (this._cacheUsed) { + this.purgeCache() + } + s(this.rules, [[e, r]]) + }, pluralize: function (e) { + return this._pluralize(e) + }, _pluralize: function (e) { + return this.inflect(e, this.rules.plurals, this.rules.irregular) + }, singularize: function (e) { + return this._singularize(e) + }, _singularize: function (e) { + return this.inflect(e, this.rules.singular, this.rules.irregularInverse) + }, inflect: function (e, n, s) { + var o, u, d, c, l, f, h, p, m, y, v, b, g; + p = r.test(e); + m = a.test(e); + f = ""; + if (p) { + return e + } + c = e.toLowerCase(); + l = t.exec(e) || i.exec(e); + if (l) { + f = l[1]; + h = l[2].toLowerCase() + } + y = this.rules.uncountable[c] || this.rules.uncountable[h]; + if (y) { + return e + } + v = s && (s[c] || s[h]); + if (v) { + if (s[c]) { + return v + } else { + v = m ? v.capitalize() : v; + return f + v + } + } + for (var R = n.length, E = 0; R > E; R--) { + o = n[R - 1]; + g = o[0]; + if (g.test(e)) { + break + } + } + o = o || []; + g = o[0]; + u = o[1]; + d = e.replace(g, u); + return d + } + }; + e["default"] = o + }); + r("ember-inflector/system/string", ["./inflector", "exports"], function (e, r) { + "use strict"; + var t = e["default"]; + + function i(e) { + return t.inflector.pluralize(e) + } + + function a(e) { + return t.inflector.singularize(e) + } + + r.pluralize = i; + r.singularize = a + }); + e.DS = t("ember-data")["default"] +})(this); \ No newline at end of file diff --git a/webapp/libs/firebase-debug.js b/webapp/libs/firebase-debug.js deleted file mode 100644 index 4f51c55b..00000000 --- a/webapp/libs/firebase-debug.js +++ /dev/null @@ -1,12275 +0,0 @@ -/*! @license Firebase v2.0.6 - License: https://www.firebase.com/terms/terms-of-service.html */ -var CLOSURE_NO_DEPS = true; -var COMPILED = false; -var goog = goog || {}; -goog.global = this; -goog.global.CLOSURE_UNCOMPILED_DEFINES; -goog.global.CLOSURE_DEFINES; -goog.isDef = function (val) { - return val !== void 0; -}; -goog.exportPath_ = function (name, opt_object, opt_objectToExportTo) { - var parts = name.split("."); - var cur = opt_objectToExportTo || goog.global; - if (!(parts[0] in cur) && cur.execScript) { - cur.execScript("var " + parts[0]); - } - for (var part; parts.length && (part = parts.shift());) { - if (!parts.length && goog.isDef(opt_object)) { - cur[part] = opt_object; - } else { - if (cur[part]) { - cur = cur[part]; - } else { - cur = cur[part] = {}; - } - } - } -}; -goog.define = function (name, defaultValue) { - var value = defaultValue; - if (!COMPILED) { - if (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, name)) { - value = goog.global.CLOSURE_UNCOMPILED_DEFINES[name]; - } else { - if (goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, name)) { - value = goog.global.CLOSURE_DEFINES[name]; - } - } - } - goog.exportPath_(name, value); -}; -goog.DEBUG = true; -goog.define("goog.LOCALE", "en"); -goog.define("goog.TRUSTED_SITE", true); -goog.define("goog.STRICT_MODE_COMPATIBLE", false); -goog.provide = function (name) { - if (!COMPILED) { - if (goog.isProvided_(name)) { - throw Error('Namespace "' + name + '" already declared.'); - } - delete goog.implicitNamespaces_[name]; - var namespace = name; - while (namespace = namespace.substring(0, namespace.lastIndexOf("."))) { - if (goog.getObjectByName(namespace)) { - break; - } - goog.implicitNamespaces_[namespace] = true; - } - } - goog.exportPath_(name); -}; -goog.setTestOnly = function (opt_message) { - if (COMPILED && !goog.DEBUG) { - opt_message = opt_message || ""; - throw Error("Importing test-only code into non-debug environment" + opt_message ? ": " + opt_message : "."); - } -}; -goog.forwardDeclare = function (name) { -}; -if (!COMPILED) { - goog.isProvided_ = function (name) { - return!goog.implicitNamespaces_[name] && goog.isDefAndNotNull(goog.getObjectByName(name)); - }; - goog.implicitNamespaces_ = {}; -} -goog.getObjectByName = function (name, opt_obj) { - var parts = name.split("."); - var cur = opt_obj || goog.global; - for (var part; part = parts.shift();) { - if (goog.isDefAndNotNull(cur[part])) { - cur = cur[part]; - } else { - return null; - } - } - return cur; -}; -goog.globalize = function (obj, opt_global) { - var global = opt_global || goog.global; - for (var x in obj) { - global[x] = obj[x]; - } -}; -goog.addDependency = function (relPath, provides, requires) { - if (goog.DEPENDENCIES_ENABLED) { - var provide, require; - var path = relPath.replace(/\\/g, "/"); - var deps = goog.dependencies_; - for (var i = 0; provide = provides[i]; i++) { - deps.nameToPath[provide] = path; - if (!(path in deps.pathToNames)) { - deps.pathToNames[path] = {}; - } - deps.pathToNames[path][provide] = true; - } - for (var j = 0; require = requires[j]; j++) { - if (!(path in deps.requires)) { - deps.requires[path] = {}; - } - deps.requires[path][require] = true; - } - } -}; -goog.define("goog.ENABLE_DEBUG_LOADER", true); -goog.require = function (name) { - if (!COMPILED) { - if (goog.isProvided_(name)) { - return; - } - if (goog.ENABLE_DEBUG_LOADER) { - var path = goog.getPathFromDeps_(name); - if (path) { - goog.included_[path] = true; - goog.writeScripts_(); - return; - } - } - var errorMessage = "goog.require could not find: " + name; - if (goog.global.console) { - goog.global.console["error"](errorMessage); - } - throw Error(errorMessage); - } -}; -goog.basePath = ""; -goog.global.CLOSURE_BASE_PATH; -goog.global.CLOSURE_NO_DEPS; -goog.global.CLOSURE_IMPORT_SCRIPT; -goog.nullFunction = function () { -}; -goog.identityFunction = function (opt_returnValue, var_args) { - return opt_returnValue; -}; -goog.abstractMethod = function () { - throw Error("unimplemented abstract method"); -}; -goog.addSingletonGetter = function (ctor) { - ctor.getInstance = function () { - if (ctor.instance_) { - return ctor.instance_; - } - if (goog.DEBUG) { - goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor; - } - return ctor.instance_ = new ctor; - }; -}; -goog.instantiatedSingletons_ = []; -goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; -if (goog.DEPENDENCIES_ENABLED) { - goog.included_ = {}; - goog.dependencies_ = {pathToNames: {}, nameToPath: {}, requires: {}, visited: {}, written: {}}; - goog.inHtmlDocument_ = function () { - var doc = goog.global.document; - return typeof doc != "undefined" && "write" in doc; - }; - goog.findBasePath_ = function () { - if (goog.global.CLOSURE_BASE_PATH) { - goog.basePath = goog.global.CLOSURE_BASE_PATH; - return; - } else { - if (!goog.inHtmlDocument_()) { - return; - } - } - var doc = goog.global.document; - var scripts = doc.getElementsByTagName("script"); - for (var i = scripts.length - 1; i >= 0; --i) { - var src = scripts[i].src; - var qmark = src.lastIndexOf("?"); - var l = qmark == -1 ? src.length : qmark; - if (src.substr(l - 7, 7) == "base.js") { - goog.basePath = src.substr(0, l - 7); - return; - } - } - }; - goog.importScript_ = function (src) { - var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; - if (!goog.dependencies_.written[src] && importScript(src)) { - goog.dependencies_.written[src] = true; - } - }; - goog.writeScriptTag_ = function (src) { - if (goog.inHtmlDocument_()) { - var doc = goog.global.document; - if (doc.readyState == "complete") { - var isDeps = /\bdeps.js$/.test(src); - if (isDeps) { - return false; - } else { - throw Error('Cannot write "' + src + '" after document load'); - } - } - doc.write('