minispade.register('ember-data/adapters/fixture_adapter', "(function() {minispade.require(\"ember-data/core\");\nminispade.require(\"ember-data/system/adapters\");\n\nvar get = Ember.get;\n\nDS.FixtureAdapter = DS.Adapter.extend({\n\n simulateRemoteResponse: true,\n\n latency: 50,\n\n /*\n Implement this method in order to provide data associated with a type\n */\n fixturesForType: function(type) {\n return type.FIXTURES ? Ember.A(type.FIXTURES) : null;\n },\n\n /*\n Implement this method in order to query fixtures data\n */\n queryFixtures: function(fixtures, query) {\n return fixtures;\n },\n\n /*\n Implement this method in order to provide provide json for CRUD methods\n */\n mockJSON: function(type, record) {\n return record.toJSON({associations: true});\n },\n\n /*\n Adapter methods\n */\n generateIdForRecord: function(store, record) {\n return Ember.guidFor(record);\n },\n\n find: function(store, type, id) {\n var fixtures = this.fixturesForType(type);\n\n Ember.assert(\"Unable to find fixtures for model type \"+type.toString(), !!fixtures);\n\n if (fixtures) {\n fixtures = fixtures.findProperty('id', id);\n }\n\n if (fixtures) {\n this.simulateRemoteCall(function() {\n store.load(type, fixtures);\n }, store, type);\n }\n },\n\n findMany: function(store, type, ids) {\n var fixtures = this.fixturesForType(type);\n\n Ember.assert(\"Unable to find fixtures for model type \"+type.toString(), !!fixtures);\n\n if (fixtures) {\n fixtures = fixtures.filter(function(item) {\n return ids.indexOf(item.id) !== -1;\n });\n }\n \n if (fixtures) {\n this.simulateRemoteCall(function() {\n store.loadMany(type, fixtures);\n }, store, type);\n }\n },\n\n findAll: function(store, type) {\n var fixtures = this.fixturesForType(type);\n\n Ember.assert(\"Unable to find fixtures for model type \"+type.toString(), !!fixtures);\n\n this.simulateRemoteCall(function() {\n store.loadMany(type, fixtures);\n }, store, type);\n },\n\n findQuery: function(store, type, query, array) {\n var fixtures = this.fixturesForType(type);\n \n Ember.assert(\"Unable to find fixtures for model type \"+type.toString(), !!fixtures);\n\n fixtures = this.queryFixtures(fixtures, query);\n\n if (fixtures) {\n this.simulateRemoteCall(function() {\n array.load(fixtures);\n }, store, type);\n }\n },\n\n createRecord: function(store, type, record) {\n var fixture = this.mockJSON(type, record);\n\n fixture.id = this.generateIdForRecord(store, record);\n\n this.simulateRemoteCall(function() {\n store.didCreateRecord(record, fixture);\n }, store, type, record);\n },\n\n updateRecord: function(store, type, record) {\n var fixture = this.mockJSON(type, record);\n\n this.simulateRemoteCall(function() {\n store.didUpdateRecord(record, fixture);\n }, store, type, record);\n },\n\n deleteRecord: function(store, type, record) {\n this.simulateRemoteCall(function() {\n store.didDeleteRecord(record);\n }, store, type, record);\n },\n\n /*\n @private\n */\n simulateRemoteCall: function(callback, store, type, record) {\n if (get(this, 'simulateRemoteResponse')) {\n setTimeout(callback, get(this, 'latency'));\n } else {\n callback();\n }\n }\n});\n\nDS.fixtureAdapter = DS.FixtureAdapter.create();\n\n})();\n//@ sourceURL=ember-data/adapters/fixture_adapter");minispade.register('ember-data/adapters/rest_adapter', "(function() {minispade.require(\"ember-data/core\");\nminispade.require('ember-data/system/adapters');\n/*global jQuery*/\n\nvar get = Ember.get, set = Ember.set;\n\nDS.RESTAdapter = DS.Adapter.extend({\n bulkCommit: false,\n\t\n createRecord: function(store, type, record) {\n var root = this.rootForType(type);\n\n var data = {};\n data[root] = record.toJSON();\n\n this.ajax(this.buildURL(root), \"POST\", {\n data: data,\n context: this,\n success: function(json) {\n this.didCreateRecord(store, type, record, json);\n }\n });\n },\n\n didCreateRecord: function(store, type, record, json) {\n var root = this.rootForType(type);\n\n this.sideload(store, type, json, root);\n store.didCreateRecord(record, json[root]);\n },\n\n createRecords: function(store, type, records) {\n if (get(this, 'bulkCommit') === false) {\n return this._super(store, type, records);\n }\n\n var root = this.rootForType(type),\n plural = this.pluralize(root);\n\n var data = {};\n data[plural] = records.map(function(record) {\n return record.toJSON();\n });\n\n this.ajax(this.buildURL(root), \"POST\", {\n data: data,\n context: this,\n success: function(json) {\n this.didCreateRecords(store, type, records, json);\n }\n });\n },\n\n didCreateRecords: function(store, type, records, json) {\n var root = this.pluralize(this.rootForType(type));\n\n this.sideload(store, type, json, root);\n store.didCreateRecords(type, records, json[root]);\n },\n\n updateRecord: function(store, type, record) {\n var id = get(record, 'id');\n var root = this.rootForType(type);\n\n var data = {};\n data[root] = record.toJSON();\n\n this.ajax(this.buildURL(root, id), \"PUT\", {\n data: data,\n context: this,\n success: function(json) {\n this.didUpdateRecord(store, type, record, json);\n }\n });\n },\n\n didUpdateRecord: function(store, type, record, json) {\n var root = this.rootForType(type);\n\n this.sideload(store, type, json, root);\n store.didUpdateRecord(record, json && json[root]);\n },\n\n updateRecords: function(store, type, records) {\n if (get(this, 'bulkCommit') === false) {\n return this._super(store, type, records);\n }\n\n var root = this.rootForType(type),\n plural = this.pluralize(root);\n\n var data = {};\n data[plural] = records.map(function(record) {\n return record.toJSON();\n });\n\n this.ajax(this.buildURL(root, \"bulk\"), \"PUT\", {\n data: data,\n context: this,\n success: function(json) {\n this.didUpdateRecords(store, type, records, json);\n }\n });\n },\n\n didUpdateRecords: function(store, type, records, json) {\n var root = this.pluralize(this.rootForType(type));\n\n this.sideload(store, type, json, root);\n store.didUpdateRecords(records, json[root]);\n },\n\n deleteRecord: function(store, type, record) {\n var id = get(record, 'id');\n var root = this.rootForType(type);\n\n this.ajax(this.buildURL(root, id), \"DELETE\", {\n context: this,\n success: function(json) {\n this.didDeleteRecord(store, type, record, json);\n }\n });\n },\n\n didDeleteRecord: function(store, type, record, json) {\n if (json) { this.sideload(store, type, json); }\n store.didDeleteRecord(record);\n },\n\n deleteRecords: function(store, type, records) {\n if (get(this, 'bulkCommit') === false) {\n return this._super(store, type, records);\n }\n\n var root = this.rootForType(type),\n plural = this.pluralize(root);\n\n var data = {};\n data[plural] = records.map(function(record) {\n return get(record, 'id');\n });\n\n this.ajax(this.buildURL(root, 'bulk'), \"DELETE\", {\n data: data,\n context: this,\n success: function(json) {\n this.didDeleteRecords(store, type, records, json);\n }\n });\n },\n\n didDeleteRecords: function(store, type, records, json) {\n if (json) { this.sideload(store, type, json); }\n store.didDeleteRecords(records);\n },\n\n find: function(store, type, id) {\n var root = this.rootForType(type);\n\n this.ajax(this.buildURL(root, id), \"GET\", {\n success: function(json) {\n this.sideload(store, type, json, root);\n store.load(type, json[root]);\n }\n });\n },\n\n findMany: function(store, type, ids) {\n var root = this.rootForType(type), plural = this.pluralize(root);\n\n this.ajax(this.buildURL(root), \"GET\", {\n data: { ids: ids },\n success: function(json) {\n this.sideload(store, type, json, plural);\n store.loadMany(type, json[plural]);\n }\n });\n },\n\n findAll: function(store, type) {\n var root = this.rootForType(type), plural = this.pluralize(root);\n\n this.ajax(this.buildURL(root), \"GET\", {\n success: function(json) {\n this.sideload(store, type, json, plural);\n store.loadMany(type, json[plural]);\n }\n });\n },\n\n findQuery: function(store, type, query, recordArray) {\n var root = this.rootForType(type), plural = this.pluralize(root);\n\n this.ajax(this.buildURL(root), \"GET\", {\n data: query,\n success: function(json) {\n this.sideload(store, type, json, plural);\n recordArray.load(json[plural]);\n }\n });\n },\n\n // HELPERS\n\n plurals: {},\n\n // define a plurals hash in your subclass to define\n // special-case pluralization\n pluralize: function(name) {\n return this.plurals[name] || name + \"s\";\n },\n\n rootForType: function(type) {\n if (type.url) { return type.url; }\n\n // use the last part of the name as the URL\n var parts = type.toString().split(\".\");\n var name = parts[parts.length - 1];\n return name.replace(/([A-Z])/g, '_$1').toLowerCase().slice(1);\n },\n\n ajax: function(url, type, hash) {\n hash.url = url;\n hash.type = type;\n hash.dataType = 'json';\n hash.contentType = 'application/json; charset=utf-8';\n hash.context = this;\n\n if (hash.data && type !== 'GET') {\n hash.data = JSON.stringify(hash.data);\n }\n\n jQuery.ajax(hash);\n },\n\n sideload: function(store, type, json, root) {\n var sideloadedType, mappings, loaded = {};\n\n loaded[root] = true;\n\n for (var prop in json) {\n if (!json.hasOwnProperty(prop)) { continue; }\n if (prop === root) { continue; }\n\n sideloadedType = type.typeForAssociation(prop);\n\n if (!sideloadedType) {\n mappings = get(this, 'mappings');\n Ember.assert(\"Your server returned a hash with the key \" + prop + \" but you have no mappings\", !!mappings);\n\n sideloadedType = get(mappings, prop);\n\n if (typeof sideloadedType === 'string') {\n sideloadedType = get(window, sideloadedType);\n }\n\n Ember.assert(\"Your server returned a hash with the key \" + prop + \" but you have no mapping for it\", !!sideloadedType);\n }\n\n this.sideloadAssociations(store, sideloadedType, json, prop, loaded);\n }\n },\n\n sideloadAssociations: function(store, type, json, prop, loaded) {\n loaded[prop] = true;\n\n get(type, 'associationsByName').forEach(function(key, meta) {\n key = meta.key || key;\n if (meta.kind === 'belongsTo') {\n key = this.pluralize(key);\n }\n if (json[key] && !loaded[key]) {\n this.sideloadAssociations(store, meta.type, json, key, loaded);\n }\n }, this);\n\n this.loadValue(store, type, json[prop]);\n },\n\n loadValue: function(store, type, value) {\n if (value instanceof Array) {\n store.loadMany(type, value);\n } else {\n store.load(type, value);\n }\n },\n\n buildURL: function(record, suffix) {\n var url = [\"\"];\n\n Ember.assert(\"Namespace URL (\" + this.namespace + \") must not start with slash\", !this.namespace || this.namespace.toString().charAt(0) !== \"/\");\n Ember.assert(\"Record URL (\" + record + \") must not start with slash\", !record || record.toString().charAt(0) !== \"/\");\n Ember.assert(\"URL suffix (\" + suffix + \") must not start with slash\", !suffix || suffix.toString().charAt(0) !== \"/\");\n\n if (this.namespace !== undefined) {\n url.push(this.namespace);\n }\n\n url.push(this.pluralize(record));\n if (suffix !== undefined) {\n url.push(suffix);\n }\n\n return url.join(\"/\");\n }\n});\n\n\n})();\n//@ sourceURL=ember-data/adapters/rest_adapter");minispade.register('ember-data/core', "(function() {window.DS = Ember.Namespace.create({\n CURRENT_API_REVISION: 4\n});\n\n})();\n//@ sourceURL=ember-data/core");minispade.register('ember-data', "(function() {//Copyright (C) 2011 by Living Social, Inc.\n\n//Permission is hereby granted, free of charge, to any person obtaining a copy of\n//this software and associated documentation files (the \"Software\"), to deal in\n//the Software without restriction, including without limitation the rights to\n//use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n//of the Software, and to permit persons to whom the Software is furnished to do\n//so, subject to the following conditions:\n\n//The above copyright notice and this permission notice shall be included in all\n//copies or substantial portions of the Software.\n\n//THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n//SOFTWARE.\nminispade.require(\"ember-data/core\");\nminispade.require(\"ember-data/system/store\");\nminispade.require(\"ember-data/system/record_arrays\");\nminispade.require(\"ember-data/system/model\");\nminispade.require(\"ember-data/system/associations\");\nminispade.require(\"ember-data/system/adapters\");\nminispade.require(\"ember-data/system/application_ext\");\nminispade.require(\"ember-data/adapters/fixture_adapter\");\nminispade.require(\"ember-data/adapters/rest_adapter\");\n\n})();\n//@ sourceURL=ember-data");minispade.register('ember-data/system/adapters', "(function() {/**\n An adapter is an object that receives requests from a store and\n translates them into the appropriate action to take against your\n persistence layer. The persistence layer is usually an HTTP API, but may\n be anything, such as the browser's local storage.\n\n ### Creating an Adapter\n\n First, create a new subclass of `DS.Adapter`:\n\n App.MyAdapter = DS.Adapter.extend({\n // ...your code here\n });\n\n To tell your store which adapter to use, set its `adapter` property:\n\n App.store = DS.Store.create({\n revision: 3,\n adapter: App.MyAdapter.create()\n });\n\n `DS.Adapter` is an abstract base class that you should override in your\n application to customize it for your backend. The minimum set of methods\n that you should implement is:\n\n * `find()`\n * `createRecord()`\n * `updateRecord()`\n * `deleteRecord()`\n\n To improve the network performance of your application, you can optimize\n your adapter by overriding these lower-level methods:\n\n * `findMany()`\n * `createRecords()`\n * `updateRecords()`\n * `deleteRecords()`\n * `commit()`\n\n For more information about the adapter API, please see `README.md`.\n*/\n\nDS.Adapter = Ember.Object.extend({\n /**\n The `find()` method is invoked when the store is asked for a record that\n has not previously been loaded. In response to `find()` being called, you\n should query your persistence layer for a record with the given ID. Once\n found, you can asynchronously call the store's `load()` method to load\n the record.\n\n Here is an example `find` implementation:\n\n find: function(store, type, id) {\n var url = type.url;\n url = url.fmt(id);\n\n jQuery.getJSON(url, function(data) {\n // data is a Hash of key/value pairs. If your server returns a\n // root, simply do something like:\n // store.load(type, id, data.person)\n store.load(type, id, data);\n });\n }\n */\n find: null,\n\n /**\n If the globally unique IDs for your records should be generated on the client,\n implement the `generateIdForRecord()` method. This method will be invoked\n each time you create a new record, and the value returned from it will be\n assigned to the record's `primaryKey`.\n\n Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\n of the record will be set by the server, and your adapter will update the store\n with the new ID when it calls `didCreateRecord()`. Only implement this method if\n you intend to generate record IDs on the client-side.\n\n The `generateIdForRecord()` method will be invoked with the requesting store as\n the first parameter and the newly created record as the second parameter:\n\n generateIdForRecord: function(store, record) {\n var uuid = App.generateUUIDWithStatisticallyLowOddsOfCollision();\n return uuid;\n }\n */\n generateIdForRecord: null,\n\n commit: function(store, commitDetails) {\n commitDetails.updated.eachType(function(type, array) {\n this.updateRecords(store, type, array.slice());\n }, this);\n\n commitDetails.created.eachType(function(type, array) {\n this.createRecords(store, type, array.slice());\n }, this);\n\n commitDetails.deleted.eachType(function(type, array) {\n this.deleteRecords(store, type, array.slice());\n }, this);\n },\n\n createRecords: function(store, type, records) {\n records.forEach(function(record) {\n this.createRecord(store, type, record);\n }, this);\n },\n\n updateRecords: function(store, type, records) {\n records.forEach(function(record) {\n this.updateRecord(store, type, record);\n }, this);\n },\n\n deleteRecords: function(store, type, records) {\n records.forEach(function(record) {\n this.deleteRecord(store, type, record);\n }, this);\n },\n\n findMany: function(store, type, ids) {\n ids.forEach(function(id) {\n this.find(store, type, id);\n }, this);\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/adapters");minispade.register('ember-data/system/application_ext', "(function() {var set = Ember.set;\n\nEmber.onLoad('application', function(app) {\n app.registerInjection({\n name: \"store\",\n before: \"controllers\",\n\n injection: function(app, stateManager, property) {\n if (property === 'Store') {\n set(stateManager, 'store', app[property].create());\n }\n }\n });\n\n app.registerInjection({\n name: \"giveStoreToControllers\",\n\n injection: function(app, stateManager, property) {\n if (property.match(/Controller$/)) {\n var controllerName = property.charAt(0).toLowerCase() + property.substr(1);\n var store = stateManager.get('store');\n var controller = stateManager.get(controllerName);\n\n controller.set('store', store);\n }\n }\n });\n});\n\n})();\n//@ sourceURL=ember-data/system/application_ext");minispade.register('ember-data/system/associations', "(function() {minispade.require(\"ember-data/system/associations/belongs_to\");\nminispade.require(\"ember-data/system/associations/has_many\");\nminispade.require(\"ember-data/system/associations/ext\");\n\n})();\n//@ sourceURL=ember-data/system/associations");minispade.register('ember-data/system/associations/belongs_to', "(function() {var get = Ember.get, set = Ember.set,\n none = Ember.none;\n\nvar embeddedFindRecord = function(store, type, data, key, one) {\n var association = get(data, key);\n return none(association) ? undefined : store.load(type, association).id;\n};\n\nvar referencedFindRecord = function(store, type, data, key, one) {\n return get(data, key);\n};\n\nvar hasAssociation = function(type, options, one) {\n options = options || {};\n\n var embedded = options.embedded,\n findRecord = embedded ? embeddedFindRecord : referencedFindRecord;\n\n var meta = { type: type, isAssociation: true, options: options, kind: 'belongsTo' };\n\n return Ember.computed(function(key, value) {\n var data = get(this, 'data'), ids, id, association,\n store = get(this, 'store');\n\n if (typeof type === 'string') {\n type = get(this, type, false) || get(window, type);\n }\n\n if (arguments.length === 2) {\n key = options.key || get(this, 'namingConvention').foreignKey(key);\n this.send('setAssociation', { key: key, value: Ember.none(value) ? null : get(value, 'clientId') });\n //data.setAssociation(key, get(value, 'clientId'));\n // put the client id in `key` in the data hash\n return value;\n } else {\n // Embedded belongsTo associations should not look for\n // a foreign key.\n if (embedded) {\n key = options.key || get(this, 'namingConvention').keyToJSONKey(key);\n\n // Non-embedded associations should look for a foreign key.\n // For example, instead of person, we might look for person_id\n } else {\n key = options.key || get(this, 'namingConvention').foreignKey(key);\n }\n id = findRecord(store, type, data, key, true);\n association = id ? store.find(type, id) : null;\n }\n\n return association;\n }).property('data').cacheable().meta(meta);\n};\n\nDS.belongsTo = function(type, options) {\n Ember.assert(\"The type passed to DS.belongsTo must be defined\", !!type);\n return hasAssociation(type, options);\n};\n\n})();\n//@ sourceURL=ember-data/system/associations/belongs_to");minispade.register('ember-data/system/associations/ext', "(function() {var get = Ember.get;\n\nDS.Model.reopenClass({\n typeForAssociation: function(name) {\n var association = get(this, 'associationsByName').get(name);\n return association && association.type;\n },\n\n associations: Ember.computed(function() {\n var map = Ember.Map.create();\n\n this.eachComputedProperty(function(name, meta) {\n if (meta.isAssociation) {\n var type = meta.type,\n typeList = map.get(type);\n\n if (typeof type === 'string') {\n type = get(this, type, false) || get(window, type);\n meta.type = type;\n }\n\n if (!typeList) {\n typeList = [];\n map.set(type, typeList);\n }\n\n typeList.push({ name: name, kind: meta.kind });\n }\n });\n\n return map;\n }).cacheable(),\n\n associationsByName: Ember.computed(function() {\n var map = Ember.Map.create(), type;\n\n this.eachComputedProperty(function(name, meta) {\n if (meta.isAssociation) {\n meta.key = name;\n type = meta.type;\n\n if (typeof type === 'string') {\n type = get(this, type, false) || get(window, type);\n meta.type = type;\n }\n\n map.set(name, meta);\n }\n });\n\n return map;\n }).cacheable()\n});\n\n})();\n//@ sourceURL=ember-data/system/associations/ext");minispade.register('ember-data/system/associations/has_many', "(function() {var get = Ember.get, set = Ember.set;\nminispade.require(\"ember-data/system/model/model\");\n\nvar embeddedFindRecord = function(store, type, data, key) {\n var association = get(data, key);\n return association ? store.loadMany(type, association).ids : [];\n};\n\nvar referencedFindRecord = function(store, type, data, key, one) {\n return get(data, key);\n};\n\nvar hasAssociation = function(type, options) {\n options = options || {};\n\n var embedded = options.embedded,\n findRecord = embedded ? embeddedFindRecord : referencedFindRecord;\n\n var meta = { type: type, isAssociation: true, options: options, kind: 'hasMany' };\n\n return Ember.computed(function(key, value) {\n var data = get(this, 'data'),\n store = get(this, 'store'),\n ids, id, association;\n\n if (typeof type === 'string') {\n type = get(this, type, false) || get(window, type);\n }\n\n key = options.key || get(this, 'namingConvention').keyToJSONKey(key);\n ids = findRecord(store, type, data, key);\n association = store.findMany(type, ids || []);\n set(association, 'parentRecord', this);\n\n return association;\n }).property().cacheable().meta(meta);\n};\n\nDS.hasMany = function(type, options) {\n Ember.assert(\"The type passed to DS.hasMany must be defined\", !!type);\n return hasAssociation(type, options);\n};\n\n})();\n//@ sourceURL=ember-data/system/associations/has_many");minispade.register('ember-data/system/model', "(function() {minispade.require(\"ember-data/system/model/model\");\nminispade.require(\"ember-data/system/model/states\");\nminispade.require(\"ember-data/system/model/attributes\");\nminispade.require(\"ember-data/system/model/data_proxy\");\n\n})();\n//@ sourceURL=ember-data/system/model");minispade.register('ember-data/system/model/attributes', "(function() {var get = Ember.get;\nminispade.require(\"ember-data/system/model/model\");\n\nDS.Model.reopenClass({\n attributes: Ember.computed(function() {\n var map = Ember.Map.create();\n\n this.eachComputedProperty(function(name, meta) {\n if (meta.isAttribute) { map.set(name, meta); }\n });\n\n return map;\n }).cacheable(),\n\n processAttributeKeys: function() {\n if (this.processedAttributeKeys) { return; }\n\n var namingConvention = this.proto().namingConvention;\n\n this.eachComputedProperty(function(name, meta) {\n if (meta.isAttribute && !meta.options.key) {\n meta.options.key = namingConvention.keyToJSONKey(name, this);\n }\n }, this);\n }\n});\n\nfunction getAttr(record, options, key) {\n var data = get(record, 'data');\n var value = get(data, key);\n\n if (value === undefined) {\n value = options.defaultValue;\n }\n\n return value;\n}\n\nDS.attr = function(type, options) {\n var transform = DS.attr.transforms[type];\n Ember.assert(\"Could not find model attribute of type \" + type, !!transform);\n\n var transformFrom = transform.from;\n var transformTo = transform.to;\n\n options = options || {};\n\n var meta = {\n type: type,\n isAttribute: true,\n options: options,\n\n // this will ensure that the key always takes naming\n // conventions into consideration.\n key: function(recordType) {\n recordType.processAttributeKeys();\n return options.key;\n }\n };\n\n return Ember.computed(function(key, value) {\n var data;\n\n key = meta.key(this.constructor);\n\n if (arguments.length === 2) {\n value = transformTo(value);\n\n if (value !== getAttr(this, options, key)) {\n this.setProperty(key, value);\n }\n } else {\n value = getAttr(this, options, key);\n }\n\n return transformFrom(value);\n // `data` is never set directly. However, it may be\n // invalidated from the state manager's setData\n // event.\n }).property('data').cacheable().meta(meta);\n};\n\nDS.attr.transforms = {\n string: {\n from: function(serialized) {\n return Ember.none(serialized) ? null : String(serialized);\n },\n\n to: function(deserialized) {\n return Ember.none(deserialized) ? null : String(deserialized);\n }\n },\n\n number: {\n from: function(serialized) {\n return Ember.none(serialized) ? null : Number(serialized);\n },\n\n to: function(deserialized) {\n return Ember.none(deserialized) ? null : Number(deserialized);\n }\n },\n\n 'boolean': {\n from: function(serialized) {\n return Boolean(serialized);\n },\n\n to: function(deserialized) {\n return Boolean(deserialized);\n }\n },\n\n date: {\n from: function(serialized) {\n var type = typeof serialized;\n\n if (type === \"string\" || type === \"number\") {\n return new Date(serialized);\n } else if (serialized === null || serialized === undefined) {\n // if the value is not present in the data,\n // return undefined, not null.\n return serialized;\n } else {\n return null;\n }\n },\n\n to: function(date) {\n if (date instanceof Date) {\n var days = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n var months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\n var pad = function(num) {\n return num < 10 ? \"0\"+num : \"\"+num;\n };\n\n var utcYear = date.getUTCFullYear(),\n utcMonth = date.getUTCMonth(),\n utcDayOfMonth = date.getUTCDate(),\n utcDay = date.getUTCDay(),\n utcHours = date.getUTCHours(),\n utcMinutes = date.getUTCMinutes(),\n utcSeconds = date.getUTCSeconds();\n\n\n var dayOfWeek = days[utcDay];\n var dayOfMonth = pad(utcDayOfMonth);\n var month = months[utcMonth];\n\n return dayOfWeek + \", \" + dayOfMonth + \" \" + month + \" \" + utcYear + \" \" +\n pad(utcHours) + \":\" + pad(utcMinutes) + \":\" + pad(utcSeconds) + \" GMT\";\n } else if (date === undefined) {\n return undefined;\n } else {\n return null;\n }\n }\n }\n};\n\n\n})();\n//@ sourceURL=ember-data/system/model/attributes");minispade.register('ember-data/system/model/data_proxy', "(function() {var get = Ember.get, set = Ember.set;\n\n// When a record is changed on the client, it is considered \"dirty\"--there are\n// pending changes that need to be saved to a persistence layer, such as a\n// server.\n//\n// If the record is rolled back, it re-enters a clean state, any changes are\n// discarded, and its attributes are reset back to the last known good copy\n// of the data that came from the server.\n//\n// If the record is committed, the changes are sent to the server to be saved,\n// and once the server confirms that they are valid, the record's \"canonical\"\n// data becomes the original canonical data plus the changes merged in.\n//\n// A DataProxy is an object that encapsulates this change tracking. It\n// contains three buckets:\n//\n// * `savedData` - the last-known copy of the data from the server\n// * `unsavedData` - a hash that contains any changes that have not yet\n// been committed\n// * `associations` - this is similar to `savedData`, but holds the client\n// ids of associated records\n//\n// When setting a property on the object, the value is placed into the\n// `unsavedData` bucket:\n//\n// proxy.set('key', 'value');\n//\n// // unsavedData:\n// {\n// key: \"value\"\n// }\n//\n// When retrieving a property from the object, it first looks to see\n// if that value exists in the `unsavedData` bucket, and returns it if so.\n// Otherwise, it returns the value from the `savedData` bucket.\n//\n// When the adapter notifies a record that it has been saved, it merges the\n// `unsavedData` bucket into the `savedData` bucket. If the record's\n// transaction is rolled back, the `unsavedData` hash is simply discarded.\n//\n// This object is a regular JS object for performance. It is only\n// used internally for bookkeeping purposes.\n\nvar DataProxy = DS._DataProxy = function(record) {\n this.record = record;\n\n this.unsavedData = {};\n\n this.associations = {};\n};\n\nDataProxy.prototype = {\n get: function(key) { return Ember.get(this, key); },\n set: function(key, value) { return Ember.set(this, key, value); },\n\n setAssociation: function(key, value) {\n this.associations[key] = value;\n },\n\n savedData: function() {\n var savedData = this._savedData;\n if (savedData) { return savedData; }\n\n var record = this.record,\n clientId = get(record, 'clientId'),\n store = get(record, 'store');\n\n if (store) {\n savedData = store.dataForRecord(record);\n this._savedData = savedData;\n return savedData;\n }\n },\n\n unknownProperty: function(key) {\n var unsavedData = this.unsavedData,\n associations = this.associations,\n savedData = this.savedData(),\n store;\n\n var value = unsavedData[key], association;\n\n // if this is a belongsTo association, this will\n // be a clientId.\n association = associations[key];\n\n if (association !== undefined) {\n store = get(this.record, 'store');\n return store.clientIdToId[association];\n }\n\n if (savedData && value === undefined) {\n value = savedData[key];\n }\n\n return value;\n },\n\n setUnknownProperty: function(key, value) {\n var record = this.record,\n unsavedData = this.unsavedData;\n\n unsavedData[key] = value;\n\n record.hashWasUpdated();\n\n return value;\n },\n\n commit: function() {\n this.saveData();\n\n this.record.notifyPropertyChange('data');\n },\n\n rollback: function() {\n this.unsavedData = {};\n\n this.record.notifyPropertyChange('data');\n },\n\n saveData: function() {\n var record = this.record;\n\n var unsavedData = this.unsavedData;\n var savedData = this.savedData();\n\n for (var prop in unsavedData) {\n if (unsavedData.hasOwnProperty(prop)) {\n savedData[prop] = unsavedData[prop];\n delete unsavedData[prop];\n }\n }\n },\n\n adapterDidUpdate: function() {\n this.unsavedData = {};\n }\n};\n\n})();\n//@ sourceURL=ember-data/system/model/data_proxy");minispade.register('ember-data/system/model/model', "(function() {minispade.require(\"ember-data/system/model/states\");\nminispade.require(\"ember-data/system/model/data_proxy\");\n\nvar get = Ember.get, set = Ember.set, none = Ember.none;\n\nvar retrieveFromCurrentState = Ember.computed(function(key) {\n return get(get(this, 'stateManager.currentState'), key);\n}).property('stateManager.currentState').cacheable();\n\nDS.Model = Ember.Object.extend(Ember.Evented, {\n isLoaded: retrieveFromCurrentState,\n isDirty: retrieveFromCurrentState,\n isSaving: retrieveFromCurrentState,\n isDeleted: retrieveFromCurrentState,\n isError: retrieveFromCurrentState,\n isNew: retrieveFromCurrentState,\n isPending: retrieveFromCurrentState,\n isValid: retrieveFromCurrentState,\n\n clientId: null,\n transaction: null,\n stateManager: null,\n pendingQueue: null,\n errors: null,\n\n // because unknownProperty is used, any internal property\n // must be initialized here.\n primaryKey: 'id',\n id: Ember.computed(function(key, value) {\n var primaryKey = get(this, 'primaryKey'),\n data = get(this, 'data');\n\n if (arguments.length === 2) {\n set(data, primaryKey, value);\n return value;\n }\n\n var id = get(data, primaryKey);\n return id ? id : this._id;\n }).property('primaryKey', 'data'),\n\n // The following methods are callbacks invoked by `toJSON`. You\n // can override one of the callbacks to override specific behavior,\n // or toJSON itself.\n //\n // If you override toJSON, you can invoke these callbacks manually\n // to get the default behavior.\n\n /**\n Add the record's primary key to the JSON hash.\n\n The default implementation uses the record's specified `primaryKey`\n and the `id` computed property, which are passed in as parameters.\n\n @param {Object} json the JSON hash being built\n @param {Number|String} id the record's id\n @param {String} key the primaryKey for the record\n */\n addIdToJSON: function(json, id, key) {\n if (id) { json[key] = id; }\n },\n\n /**\n Add the attributes' current values to the JSON hash.\n\n The default implementation gets the current value of each\n attribute from the `data`, and uses a `defaultValue` if\n specified in the `DS.attr` definition.\n\n @param {Object} json the JSON hash being build\n @param {Ember.Map} attributes a Map of attributes\n @param {DataProxy} data the record's data, accessed with `get` and `set`.\n */\n addAttributesToJSON: function(json, attributes, data) {\n attributes.forEach(function(name, meta) {\n var key = meta.key(this.constructor),\n value = get(data, key);\n\n if (value === undefined) {\n value = meta.options.defaultValue;\n }\n\n json[key] = value;\n }, this);\n },\n\n /**\n Add the value of a `hasMany` association to the JSON hash.\n\n The default implementation honors the `embedded` option\n passed to `DS.hasMany`. If embedded, `toJSON` is recursively\n called on the child records. If not, the `id` of each\n record is added.\n\n Note that if a record is not embedded and does not\n yet have an `id` (usually provided by the server), it\n will not be included in the output.\n\n @param {Object} json the JSON hash being built\n @param {DataProxy} data the record's data, accessed with `get` and `set`.\n @param {Object} meta information about the association\n @param {Object} options options passed to `toJSON`\n */\n addHasManyToJSON: function(json, data, meta, options) {\n var key = meta.key,\n manyArray = get(this, key),\n records = [], i, l,\n clientId, id;\n\n if (meta.options.embedded) {\n // TODO: Avoid materializing embedded hashes if possible\n manyArray.forEach(function(record) {\n records.push(record.toJSON(options));\n });\n } else {\n var clientIds = get(manyArray, 'content');\n\n for (i=0, l=clientIds.length; i \"created.uncommitted\"\n\n The `DS.Model` states are themselves stateless. What we mean is that,\n though each instance of a record also has a unique instance of a\n `DS.StateManager`, the hierarchical states that each of *those* points\n to is a shared data structure. For performance reasons, instead of each\n record getting its own copy of the hierarchy of states, each state\n manager points to this global, immutable shared instance. How does a\n state know which record it should be acting on? We pass a reference to\n the current state manager as the first parameter to every method invoked\n on a state.\n\n The state manager passed as the first parameter is where you should stash\n state about the record if needed; you should never store data on the state\n object itself. If you need access to the record being acted on, you can\n retrieve the state manager's `record` property. For example, if you had\n an event handler `myEvent`:\n\n myEvent: function(manager) {\n var record = manager.get('record');\n record.doSomething();\n }\n\n For more information about state managers in general, see the Ember.js\n documentation on `Ember.StateManager`.\n\n ### Events, Flags, and Transitions\n\n A state may implement zero or more events, flags, or transitions.\n\n #### Events\n\n Events are named functions that are invoked when sent to a record. The\n state manager will first look for a method with the given name on the\n current state. If no method is found, it will search the current state's\n parent, and then its grandparent, and so on until reaching the top of\n the hierarchy. If the root is reached without an event handler being found,\n an exception will be raised. This can be very helpful when debugging new\n features.\n\n Here's an example implementation of a state with a `myEvent` event handler:\n\n aState: DS.State.create({\n myEvent: function(manager, param) {\n console.log(\"Received myEvent with \"+param);\n }\n })\n\n To trigger this event:\n\n record.send('myEvent', 'foo');\n //=> \"Received myEvent with foo\"\n\n Note that an optional parameter can be sent to a record's `send()` method,\n which will be passed as the second parameter to the event handler.\n\n Events should transition to a different state if appropriate. This can be\n done by calling the state manager's `goToState()` method with a path to the\n desired state. The state manager will attempt to resolve the state path\n relative to the current state. If no state is found at that path, it will\n attempt to resolve it relative to the current state's parent, and then its\n parent, and so on until the root is reached. For example, imagine a hierarchy\n like this:\n\n * created\n * start <-- currentState\n * inFlight\n * updated\n * inFlight\n\n If we are currently in the `start` state, calling\n `goToState('inFlight')` would transition to the `created.inFlight` state,\n while calling `goToState('updated.inFlight')` would transition to\n the `updated.inFlight` state.\n\n Remember that *only events* should ever cause a state transition. You should\n never call `goToState()` from outside a state's event handler. If you are\n tempted to do so, create a new event and send that to the state manager.\n\n #### Flags\n\n Flags are Boolean values that can be used to introspect a record's current\n state in a more user-friendly way than examining its state path. For example,\n instead of doing this:\n\n var statePath = record.get('stateManager.currentState.path');\n if (statePath === 'created.inFlight') {\n doSomething();\n }\n\n You can say:\n\n if (record.get('isNew') && record.get('isSaving')) {\n doSomething();\n }\n\n If your state does not set a value for a given flag, the value will\n be inherited from its parent (or the first place in the state hierarchy\n where it is defined).\n\n The current set of flags are defined below. If you want to add a new flag,\n in addition to the area below, you will also need to declare it in the\n `DS.Model` class.\n\n #### Transitions\n\n Transitions are like event handlers but are called automatically upon\n entering or exiting a state. To implement a transition, just call a method\n either `enter` or `exit`:\n\n myState: DS.State.create({\n // Gets called automatically when entering\n // this state.\n enter: function(manager) {\n console.log(\"Entered myState\");\n }\n })\n\n Note that enter and exit events are called once per transition. If the\n current state changes, but changes to another child state of the parent,\n the transition event on the parent will not be triggered.\n*/\n\nvar stateProperty = Ember.computed(function(key) {\n var parent = get(this, 'parentState');\n if (parent) {\n return get(parent, key);\n }\n}).property();\n\nvar isEmptyObject = function(object) {\n for (var name in object) {\n if (object.hasOwnProperty(name)) { return false; }\n }\n\n return true;\n};\n\nvar hasDefinedProperties = function(object) {\n for (var name in object) {\n if (object.hasOwnProperty(name) && object[name]) { return true; }\n }\n\n return false;\n};\n\nDS.State = Ember.State.extend({\n isLoaded: stateProperty,\n isDirty: stateProperty,\n isSaving: stateProperty,\n isDeleted: stateProperty,\n isError: stateProperty,\n isNew: stateProperty,\n isValid: stateProperty,\n isPending: stateProperty,\n\n // For states that are substates of a\n // DirtyState (updated or created), it is\n // useful to be able to determine which\n // type of dirty state it is.\n dirtyType: stateProperty\n});\n\nvar setProperty = function(manager, context) {\n var key = context.key, value = context.value;\n\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n set(data, key, value);\n};\n\nvar setAssociation = function(manager, context) {\n var key = context.key, value = context.value;\n\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n data.setAssociation(key, value);\n};\n\nvar didChangeData = function(manager) {\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n data._savedData = null;\n record.notifyPropertyChange('data');\n};\n\n// The waitingOn event shares common functionality\n// between the different dirty states, but each is\n// treated slightly differently. This method is exposed\n// so that each implementation can invoke the common\n// behavior, and then implement the behavior specific\n// to the state.\nvar waitingOn = function(manager, object) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue'),\n objectGuid = guidFor(object);\n\n var observer = function() {\n if (get(object, 'id')) {\n manager.send('doneWaitingOn', object);\n Ember.removeObserver(object, 'id', observer);\n }\n };\n\n pendingQueue[objectGuid] = [object, observer];\n Ember.addObserver(object, 'id', observer);\n};\n\n// Implementation notes:\n//\n// Each state has a boolean value for all of the following flags:\n//\n// * isLoaded: The record has a populated `data` property. When a\n// record is loaded via `store.find`, `isLoaded` is false\n// until the adapter sets it. When a record is created locally,\n// its `isLoaded` property is always true.\n// * isDirty: The record has local changes that have not yet been\n// saved by the adapter. This includes records that have been\n// created (but not yet saved) or deleted.\n// * isSaving: The record's transaction has been committed, but\n// the adapter has not yet acknowledged that the changes have\n// been persisted to the backend.\n// * isDeleted: The record was marked for deletion. When `isDeleted`\n// is true and `isDirty` is true, the record is deleted locally\n// but the deletion was not yet persisted. When `isSaving` is\n// true, the change is in-flight. When both `isDirty` and\n// `isSaving` are false, the change has persisted.\n// * isError: The adapter reported that it was unable to save\n// local changes to the backend. This may also result in the\n// record having its `isValid` property become false if the\n// adapter reported that server-side validations failed.\n// * isNew: The record was created on the client and the adapter\n// did not yet report that it was successfully saved.\n// * isValid: No client-side validations have failed and the\n// adapter did not report any server-side validation failures.\n// * isPending: A record `isPending` when it belongs to an\n// association on another record and that record has not been\n// saved. A record in this state cannot be saved because it\n// lacks a \"foreign key\" that will be supplied by its parent\n// association when the parent record has been created. When\n// the adapter reports that the parent has saved, the\n// `isPending` property on all children will become `false`\n// and the transaction will try to commit the records.\n\n// This mixin is mixed into various uncommitted states. Make\n// sure to mix it in *after* the class definition, so its\n// super points to the class definition.\nvar Uncommitted = Ember.Mixin.create({\n setProperty: setProperty,\n setAssociation: setAssociation\n});\n\n// These mixins are mixed into substates of the concrete\n// subclasses of DirtyState.\n\nvar CreatedUncommitted = Ember.Mixin.create({\n deleteRecord: function(manager) {\n var record = get(manager, 'record');\n this._super(manager);\n\n record.withTransaction(function(t) {\n t.recordBecameClean('created', record);\n });\n manager.goToState('deleted.saved');\n }\n});\n\nvar UpdatedUncommitted = Ember.Mixin.create({\n deleteRecord: function(manager) {\n this._super(manager);\n\n var record = get(manager, 'record');\n\n record.withTransaction(function(t) {\n t.recordBecameClean('updated', record);\n });\n\n manager.goToState('deleted');\n }\n});\n\n// The dirty state is a abstract state whose functionality is\n// shared between the `created` and `updated` states.\n//\n// The deleted state shares the `isDirty` flag with the\n// subclasses of `DirtyState`, but with a very different\n// implementation.\nvar DirtyState = DS.State.extend({\n initialState: 'uncommitted',\n\n // FLAGS\n isDirty: true,\n\n // SUBSTATES\n\n // When a record first becomes dirty, it is `uncommitted`.\n // This means that there are local pending changes,\n // but they have not yet begun to be saved.\n uncommitted: DS.State.extend({\n // TRANSITIONS\n enter: function(manager) {\n var dirtyType = get(this, 'dirtyType'),\n record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameDirty(dirtyType, record);\n });\n },\n\n // EVENTS\n deleteRecord: Ember.K,\n\n waitingOn: function(manager, object) {\n waitingOn(manager, object);\n manager.goToState('pending');\n },\n\n willCommit: function(manager) {\n manager.goToState('inFlight');\n },\n\n becameInvalid: function(manager) {\n var dirtyType = get(this, 'dirtyType'),\n record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameInFlight(dirtyType, record);\n });\n\n manager.goToState('invalid');\n },\n\n rollback: function(manager) {\n var record = get(manager, 'record'),\n dirtyType = get(this, 'dirtyType'),\n data = get(record, 'data');\n\n data.rollback();\n\n record.withTransaction(function(t) {\n t.recordBecameClean(dirtyType, record);\n });\n\n manager.goToState('saved');\n }\n }, Uncommitted),\n\n // Once a record has been handed off to the adapter to be\n // saved, it is in the 'in flight' state. Changes to the\n // record cannot be made during this window.\n inFlight: DS.State.extend({\n // FLAGS\n isSaving: true,\n\n // TRANSITIONS\n enter: function(manager) {\n var dirtyType = get(this, 'dirtyType'),\n record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameInFlight(dirtyType, record);\n });\n },\n\n // EVENTS\n didCommit: function(manager) {\n var dirtyType = get(this, 'dirtyType'),\n record = get(manager, 'record');\n\n record.withTransaction(function(t) {\n t.recordBecameClean('inflight', record);\n });\n\n manager.goToState('saved');\n manager.send('invokeLifecycleCallbacks', dirtyType);\n },\n\n becameInvalid: function(manager, errors) {\n var record = get(manager, 'record');\n\n set(record, 'errors', errors);\n\n manager.goToState('invalid');\n manager.send('invokeLifecycleCallbacks');\n },\n\n becameError: function(manager) {\n manager.goToState('error');\n manager.send('invokeLifecycleCallbacks');\n },\n\n didChangeData: didChangeData\n }),\n\n // If a record becomes associated with a newly created\n // parent record, it will be `pending` until the parent\n // record has successfully persisted. Once this happens,\n // this record can use the parent's primary key as its\n // foreign key.\n //\n // If the record's transaction had already started to\n // commit, the record will transition to the `inFlight`\n // state. If it had not, the record will transition to\n // the `uncommitted` state.\n pending: DS.State.extend({\n initialState: 'uncommitted',\n\n // FLAGS\n isPending: true,\n\n // SUBSTATES\n\n // A pending record whose transaction has not yet\n // started to commit is in this state.\n uncommitted: DS.State.extend({\n // EVENTS\n deleteRecord: function(manager) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue'),\n tuple;\n\n // since we are leaving the pending state, remove any\n // observers we have registered on other records.\n for (var prop in pendingQueue) {\n if (!pendingQueue.hasOwnProperty(prop)) { continue; }\n\n tuple = pendingQueue[prop];\n Ember.removeObserver(tuple[0], 'id', tuple[1]);\n }\n },\n\n willCommit: function(manager) {\n manager.goToState('committing');\n },\n\n doneWaitingOn: function(manager, object) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue'),\n objectGuid = guidFor(object);\n\n delete pendingQueue[objectGuid];\n\n if (isEmptyObject(pendingQueue)) {\n manager.send('doneWaiting');\n }\n },\n\n doneWaiting: function(manager) {\n var dirtyType = get(this, 'dirtyType');\n manager.goToState(dirtyType + '.uncommitted');\n }\n }, Uncommitted),\n\n // A pending record whose transaction has started\n // to commit is in this state. Since it has not yet\n // been sent to the adapter, it is not `inFlight`\n // until all of its dependencies have been committed.\n committing: DS.State.extend({\n // FLAGS\n isSaving: true,\n\n // EVENTS\n doneWaitingOn: function(manager, object) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue'),\n objectGuid = guidFor(object);\n\n delete pendingQueue[objectGuid];\n\n if (isEmptyObject(pendingQueue)) {\n manager.send('doneWaiting');\n }\n },\n\n doneWaiting: function(manager) {\n var record = get(manager, 'record'),\n transaction = get(record, 'transaction');\n\n // Now that the record is no longer pending, schedule\n // the transaction to commit.\n Ember.run.once(transaction, transaction.commit);\n },\n\n willCommit: function(manager) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue');\n\n if (isEmptyObject(pendingQueue)) {\n var dirtyType = get(this, 'dirtyType');\n manager.goToState(dirtyType + '.inFlight');\n }\n }\n })\n }),\n\n // A record is in the `invalid` state when its client-side\n // invalidations have failed, or if the adapter has indicated\n // the the record failed server-side invalidations.\n invalid: DS.State.extend({\n // FLAGS\n isValid: false,\n\n exit: function(manager) {\n var record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameClean('inflight', record);\n });\n },\n\n // EVENTS\n deleteRecord: function(manager) {\n manager.goToState('deleted');\n },\n\n setAssociation: setAssociation,\n\n setProperty: function(manager, context) {\n setProperty(manager, context);\n\n var record = get(manager, 'record'),\n errors = get(record, 'errors'),\n key = context.key;\n\n set(errors, key, null);\n\n if (!hasDefinedProperties(errors)) {\n manager.send('becameValid');\n }\n },\n\n rollback: function(manager) {\n manager.send('becameValid');\n manager.send('rollback');\n },\n\n becameValid: function(manager) {\n manager.goToState('uncommitted');\n },\n\n invokeLifecycleCallbacks: function(manager) {\n var record = get(manager, 'record');\n record.trigger('becameInvalid', record);\n }\n })\n});\n\n// The created and updated states are created outside the state\n// chart so we can reopen their substates and add mixins as\n// necessary.\n\nvar createdState = DirtyState.create({\n dirtyType: 'created',\n\n // FLAGS\n isNew: true\n});\n\nvar updatedState = DirtyState.create({\n dirtyType: 'updated'\n});\n\n// The created.uncommitted state and created.pending.uncommitted share\n// some logic defined in CreatedUncommitted.\ncreatedState.states.uncommitted.reopen(CreatedUncommitted);\ncreatedState.states.pending.states.uncommitted.reopen(CreatedUncommitted);\n\n// The created.uncommitted state needs to immediately transition to the\n// deleted state if it is rolled back.\ncreatedState.states.uncommitted.reopen({\n rollback: function(manager) {\n this._super(manager);\n manager.goToState('deleted.saved');\n }\n});\n\n// The updated.uncommitted state and updated.pending.uncommitted share\n// some logic defined in UpdatedUncommitted.\nupdatedState.states.uncommitted.reopen(UpdatedUncommitted);\nupdatedState.states.pending.states.uncommitted.reopen(UpdatedUncommitted);\nupdatedState.states.inFlight.reopen({\n didSaveData: function(manager) {\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n data.saveData();\n data.adapterDidUpdate();\n }\n});\n\nvar states = {\n rootState: Ember.State.create({\n // FLAGS\n isLoaded: false,\n isDirty: false,\n isSaving: false,\n isDeleted: false,\n isError: false,\n isNew: false,\n isValid: true,\n isPending: false,\n\n // SUBSTATES\n\n // A record begins its lifecycle in the `empty` state.\n // If its data will come from the adapter, it will\n // transition into the `loading` state. Otherwise, if\n // the record is being created on the client, it will\n // transition into the `created` state.\n empty: DS.State.create({\n // EVENTS\n loadingData: function(manager) {\n manager.goToState('loading');\n },\n\n didChangeData: function(manager) {\n didChangeData(manager);\n\n manager.goToState('loaded.created');\n }\n }),\n\n // A record enters this state when the store askes\n // the adapter for its data. It remains in this state\n // until the adapter provides the requested data.\n //\n // Usually, this process is asynchronous, using an\n // XHR to retrieve the data.\n loading: DS.State.create({\n // TRANSITIONS\n exit: function(manager) {\n var record = get(manager, 'record');\n record.trigger('didLoad');\n },\n\n // EVENTS\n didChangeData: function(manager, data) {\n didChangeData(manager);\n manager.send('loadedData');\n },\n\n loadedData: function(manager) {\n manager.goToState('loaded');\n }\n }),\n\n // A record enters this state when its data is populated.\n // Most of a record's lifecycle is spent inside substates\n // of the `loaded` state.\n loaded: DS.State.create({\n initialState: 'saved',\n\n // FLAGS\n isLoaded: true,\n\n // SUBSTATES\n\n // If there are no local changes to a record, it remains\n // in the `saved` state.\n saved: DS.State.create({\n\n // EVENTS\n setProperty: function(manager, context) {\n setProperty(manager, context);\n manager.goToState('updated');\n },\n\n setAssociation: function(manager, context) {\n setAssociation(manager, context);\n manager.goToState('updated');\n },\n\n didChangeData: didChangeData,\n\n deleteRecord: function(manager) {\n manager.goToState('deleted');\n },\n\n waitingOn: function(manager, object) {\n waitingOn(manager, object);\n manager.goToState('updated.pending');\n },\n\n invokeLifecycleCallbacks: function(manager, dirtyType) {\n var record = get(manager, 'record');\n if (dirtyType === 'created') {\n record.trigger('didCreate', record);\n } else {\n record.trigger('didUpdate', record);\n }\n }\n }),\n\n // A record is in this state after it has been locally\n // created but before the adapter has indicated that\n // it has been saved.\n created: createdState,\n\n // A record is in this state if it has already been\n // saved to the server, but there are new local changes\n // that have not yet been saved.\n updated: updatedState\n }),\n\n // A record is in this state if it was deleted from the store.\n deleted: DS.State.create({\n // FLAGS\n isDeleted: true,\n isLoaded: true,\n isDirty: true,\n\n // TRANSITIONS\n enter: function(manager) {\n var record = get(manager, 'record'),\n store = get(record, 'store');\n\n store.removeFromRecordArrays(record);\n },\n\n // SUBSTATES\n\n // When a record is deleted, it enters the `start`\n // state. It will exit this state when the record's\n // transaction starts to commit.\n start: DS.State.create({\n // TRANSITIONS\n enter: function(manager) {\n var record = get(manager, 'record');\n\n record.withTransaction(function(t) {\n t.recordBecameDirty('deleted', record);\n });\n },\n\n // EVENTS\n willCommit: function(manager) {\n manager.goToState('inFlight');\n },\n\n rollback: function(manager) {\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n data.rollback();\n record.withTransaction(function(t) {\n t.recordBecameClean('deleted', record);\n });\n manager.goToState('loaded');\n }\n }),\n\n // After a record's transaction is committing, but\n // before the adapter indicates that the deletion\n // has saved to the server, a record is in the\n // `inFlight` substate of `deleted`.\n inFlight: DS.State.create({\n // FLAGS\n isSaving: true,\n\n // TRANSITIONS\n enter: function(manager) {\n var record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameInFlight('deleted', record);\n });\n },\n\n // EVENTS\n didCommit: function(manager) {\n var record = get(manager, 'record');\n\n record.withTransaction(function(t) {\n t.recordBecameClean('inflight', record);\n });\n\n manager.goToState('saved');\n\n manager.send('invokeLifecycleCallbacks');\n }\n }),\n\n // Once the adapter indicates that the deletion has\n // been saved, the record enters the `saved` substate\n // of `deleted`.\n saved: DS.State.create({\n // FLAGS\n isDirty: false,\n\n invokeLifecycleCallbacks: function(manager) {\n var record = get(manager, 'record');\n record.trigger('didDelete', record);\n }\n })\n }),\n\n // If the adapter indicates that there was an unknown\n // error saving a record, the record enters the `error`\n // state.\n error: DS.State.create({\n isError: true,\n\n // EVENTS\n\n invokeLifecycleCallbacks: function(manager) {\n var record = get(manager, 'record');\n record.trigger('becameError', record);\n }\n })\n })\n};\n\nDS.StateManager = Ember.StateManager.extend({\n record: null,\n initialState: 'rootState',\n states: states\n});\n\n})();\n//@ sourceURL=ember-data/system/model/states");minispade.register('ember-data/system/record_arrays', "(function() {minispade.require('ember-data/system/record_arrays/record_array');\nminispade.require('ember-data/system/record_arrays/filtered_record_array');\nminispade.require('ember-data/system/record_arrays/adapter_populated_record_array');\nminispade.require('ember-data/system/record_arrays/many_array');\n\n})();\n//@ sourceURL=ember-data/system/record_arrays");minispade.register('ember-data/system/record_arrays/adapter_populated_record_array', "(function() {minispade.require(\"ember-data/system/record_arrays/record_array\");\n\nvar get = Ember.get, set = Ember.set;\n\nDS.AdapterPopulatedRecordArray = DS.RecordArray.extend({\n query: null,\n isLoaded: false,\n\n replace: function() {\n var type = get(this, 'type').toString();\n throw new Error(\"The result of a server query (on \" + type + \") is immutable.\");\n },\n\n load: function(array) {\n var store = get(this, 'store'), type = get(this, 'type');\n\n var clientIds = store.loadMany(type, array).clientIds;\n\n this.beginPropertyChanges();\n set(this, 'content', Ember.A(clientIds));\n set(this, 'isLoaded', true);\n this.endPropertyChanges();\n }\n});\n\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/adapter_populated_record_array");minispade.register('ember-data/system/record_arrays/filtered_record_array', "(function() {minispade.require(\"ember-data/system/record_arrays/record_array\");\n\nvar get = Ember.get;\n\nDS.FilteredRecordArray = DS.RecordArray.extend({\n filterFunction: null,\n\n replace: function() {\n var type = get(this, 'type').toString();\n throw new Error(\"The result of a client-side filter (on \" + type + \") is immutable.\");\n },\n\n updateFilter: Ember.observer(function() {\n var store = get(this, 'store');\n store.updateRecordArrayFilter(this, get(this, 'type'), get(this, 'filterFunction'));\n }, 'filterFunction')\n});\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/filtered_record_array");minispade.register('ember-data/system/record_arrays/many_array', "(function() {minispade.require(\"ember-data/system/record_arrays/record_array\");\nminispade.require(\"ember-data/system/record_arrays/many_array_states\");\n\nvar get = Ember.get, set = Ember.set;\n\nDS.ManyArray = DS.RecordArray.extend({\n init: function() {\n set(this, 'stateManager', DS.ManyArrayStateManager.create({ manyArray: this }));\n\n return this._super();\n },\n\n parentRecord: null,\n\n isDirty: Ember.computed(function() {\n return get(this, 'stateManager.currentState.isDirty');\n }).property('stateManager.currentState').cacheable(),\n\n isLoaded: Ember.computed(function() {\n return get(this, 'stateManager.currentState.isLoaded');\n }).property('stateManager.currentState').cacheable(),\n\n send: function(event, context) {\n this.get('stateManager').send(event, context);\n },\n\n fetch: function() {\n var clientIds = get(this, 'content'),\n store = get(this, 'store'),\n type = get(this, 'type');\n\n store.fetchUnloadedClientIds(type, clientIds);\n },\n\n // Overrides Ember.Array's replace method to implement\n replaceContent: function(index, removed, added) {\n var parentRecord = get(this, 'parentRecord');\n var pendingParent = parentRecord && !get(parentRecord, 'id');\n var stateManager = get(this, 'stateManager');\n\n // Map the array of record objects into an array of client ids.\n added = added.map(function(record) {\n Ember.assert(\"You can only add records of \" + (get(this, 'type') && get(this, 'type').toString()) + \" to this association.\", !get(this, 'type') || (get(this, 'type') === record.constructor));\n\n // If the record to which this many array belongs does not yet\n // have an id, notify the newly-added record that it must wait\n // for the parent to receive an id before the child can be\n // saved.\n if (pendingParent) {\n record.send('waitingOn', parentRecord);\n }\n\n var oldParent = this.assignInverse(record, parentRecord);\n\n record.get('transaction')\n .relationshipBecameDirty(record, oldParent, parentRecord);\n\n stateManager.send('recordWasAdded', record);\n\n return record.get('clientId');\n }, this);\n\n var store = this.store;\n\n var len = index+removed, record;\n for (var i = index; i < len; i++) {\n // TODO: null out inverse FK\n record = this.objectAt(i);\n var oldParent = this.assignInverse(record, parentRecord, true);\n\n record.get('transaction')\n .relationshipBecameDirty(record, parentRecord, null);\n\n // If we put the child record into a pending state because\n // we were waiting on the parent record to get an id, we\n // can tell the child it no longer needs to wait.\n if (pendingParent) {\n record.send('doneWaitingOn', parentRecord);\n }\n\n stateManager.send('recordWasAdded', record);\n }\n\n this._super(index, removed, added);\n },\n\n assignInverse: function(record, parentRecord, remove) {\n var associationMap = get(record.constructor, 'associations'),\n possibleAssociations = associationMap.get(parentRecord.constructor),\n possible, actual, oldParent;\n\n if (!possibleAssociations) { return; }\n\n for (var i = 0, l = possibleAssociations.length; i < l; i++) {\n possible = possibleAssociations[i];\n\n if (possible.kind === 'belongsTo') {\n actual = possible;\n break;\n }\n }\n\n if (actual) {\n oldParent = get(record, actual.name);\n set(record, actual.name, remove ? null : parentRecord);\n return oldParent;\n }\n },\n\n // Create a child record within the parentRecord\n createRecord: function(hash, transaction) {\n var parentRecord = get(this, 'parentRecord'),\n store = get(parentRecord, 'store'),\n type = get(this, 'type'),\n record;\n\n transaction = transaction || get(parentRecord, 'transaction');\n\n record = store.createRecord.call(store, type, hash, transaction);\n this.pushObject(record);\n\n return record;\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/many_array");minispade.register('ember-data/system/record_arrays/many_array_states', "(function() {var get = Ember.get, set = Ember.set, guidFor = Ember.guidFor;\n\nvar Set = function() {\n this.hash = {};\n this.list = [];\n};\n\nSet.prototype = {\n add: function(item) {\n var hash = this.hash,\n guid = guidFor(item);\n\n if (hash.hasOwnProperty(guid)) { return; }\n\n hash[guid] = true;\n this.list.push(item);\n },\n\n remove: function(item) {\n var hash = this.hash,\n guid = guidFor(item);\n\n if (!hash.hasOwnProperty(guid)) { return; }\n\n delete hash[guid];\n var list = this.list,\n index = Ember.EnumerableUtils.indexOf(this, item);\n\n list.splice(index, 1);\n },\n\n isEmpty: function() {\n return this.list.length === 0;\n }\n};\n\nvar LoadedState = Ember.State.extend({\n recordWasAdded: function(manager, record) {\n var dirty = manager.dirty, observer;\n dirty.add(record);\n\n observer = function() {\n if (!get(record, 'isDirty')) {\n record.removeObserver('isDirty', observer);\n manager.send('childWasSaved', record);\n }\n };\n\n record.addObserver('isDirty', observer);\n },\n\n recordWasRemoved: function(manager, record) {\n var dirty = manager.dirty, observer;\n dirty.add(record);\n\n observer = function() {\n record.removeObserver('isDirty', observer);\n if (!get(record, 'isDirty')) { manager.send('childWasSaved', record); }\n };\n\n record.addObserver('isDirty', observer);\n }\n});\n\nvar states = {\n loading: Ember.State.create({\n isLoaded: false,\n isDirty: false,\n\n loadedRecords: function(manager, count) {\n manager.decrement(count);\n },\n\n becameLoaded: function(manager) {\n manager.transitionTo('clean');\n }\n }),\n\n clean: LoadedState.create({\n isLoaded: true,\n isDirty: false,\n\n recordWasAdded: function(manager, record) {\n this._super(manager, record);\n manager.goToState('dirty');\n },\n\n update: function(manager, clientIds) {\n var manyArray = manager.manyArray;\n set(manyArray, 'content', clientIds);\n }\n }),\n\n dirty: LoadedState.create({\n isLoaded: true,\n isDirty: true,\n\n childWasSaved: function(manager, child) {\n var dirty = manager.dirty;\n dirty.remove(child);\n\n if (dirty.isEmpty()) { manager.send('arrayBecameSaved'); }\n },\n\n arrayBecameSaved: function(manager) {\n manager.goToState('clean');\n }\n })\n};\n\nDS.ManyArrayStateManager = Ember.StateManager.extend({\n manyArray: null,\n initialState: 'loading',\n states: states,\n\n /**\n This number is used to keep track of the number of outstanding\n records that must be loaded before the array is considered\n loaded. As results stream in, this number is decremented until\n it becomes zero, at which case the `isLoaded` flag will be set\n to true\n */\n counter: 0,\n\n init: function() {\n this._super();\n this.dirty = new Set();\n this.counter = get(this, 'manyArray.length');\n },\n\n decrement: function(count) {\n var counter = this.counter = this.counter - count;\n\n Ember.assert(\"Somehow the ManyArray loaded counter went below 0. This is probably an ember-data bug. Please report it at https://github.com/emberjs/data/issues\", counter >= 0);\n\n if (counter === 0) {\n this.send('becameLoaded');\n }\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/many_array_states");minispade.register('ember-data/system/record_arrays/record_array', "(function() {var get = Ember.get, set = Ember.set;\n\n/**\n A record array is an array that contains records of a certain type. The record\n array materializes records as needed when they are retrieved for the first\n time. You should not create record arrays yourself. Instead, an instance of\n DS.RecordArray or its subclasses will be returned by your application's store\n in response to queries.\n*/\n\nDS.RecordArray = Ember.ArrayProxy.extend({\n\n /**\n The model type contained by this record array.\n\n @type DS.Model\n */\n type: null,\n\n // The array of client ids backing the record array. When a\n // record is requested from the record array, the record\n // for the client id at the same index is materialized, if\n // necessary, by the store.\n content: null,\n\n // The store that created this record array.\n store: null,\n\n objectAtContent: function(index) {\n var content = get(this, 'content'),\n clientId = content.objectAt(index),\n store = get(this, 'store');\n\n if (clientId !== undefined) {\n return store.findByClientId(get(this, 'type'), clientId);\n }\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/record_array");minispade.register('ember-data/system/store', "(function() {/*globals Ember*/\nminispade.require(\"ember-data/system/record_arrays\");\nminispade.require(\"ember-data/system/transaction\");\n\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\n\nvar DATA_PROXY = {\n get: function(name) {\n return this.savedData[name];\n }\n};\n\n// These values are used in the data cache when clientIds are\n// needed but the underlying data has not yet been loaded by\n// the server.\nvar UNLOADED = 'unloaded';\nvar LOADING = 'loading';\n\n// Implementors Note:\n//\n// The variables in this file are consistently named according to the following\n// scheme:\n//\n// * +id+ means an identifier managed by an external source, provided inside the\n// data hash provided by that source.\n// * +clientId+ means a transient numerical identifier generated at runtime by\n// the data store. It is important primarily because newly created objects may\n// not yet have an externally generated id.\n// * +type+ means a subclass of DS.Model.\n\n/**\n The store contains all of the hashes for records loaded from the server.\n It is also responsible for creating instances of DS.Model when you request one\n of these data hashes, so that they can be bound to in your Handlebars templates.\n\n Create a new store like this:\n\n MyApp.store = DS.Store.create();\n\n You can retrieve DS.Model instances from the store in several ways. To retrieve\n a record for a specific id, use the `find()` method:\n\n var record = MyApp.store.find(MyApp.Contact, 123);\n\n By default, the store will talk to your backend using a standard REST mechanism.\n You can customize how the store talks to your backend by specifying a custom adapter:\n\n MyApp.store = DS.Store.create({\n adapter: 'MyApp.CustomAdapter'\n });\n\n You can learn more about writing a custom adapter by reading the `DS.Adapter`\n documentation.\n*/\nDS.Store = Ember.Object.extend({\n\n /**\n Many methods can be invoked without specifying which store should be used.\n In those cases, the first store created will be used as the default. If\n an application has multiple stores, it should specify which store to use\n when performing actions, such as finding records by id.\n\n The init method registers this store as the default if none is specified.\n */\n init: function() {\n // Enforce API revisioning. See BREAKING_CHANGES.md for more.\n var revision = get(this, 'revision');\n\n if (revision !== DS.CURRENT_API_REVISION && !Ember.ENV.TESTING) {\n throw new Error(\"Error: The Ember Data library has had breaking API changes since the last time you updated the library. Please review the list of breaking changes at https://github.com/emberjs/data/blob/master/BREAKING_CHANGES.md, then update your store's `revision` property to \" + DS.CURRENT_API_REVISION);\n }\n\n if (!get(DS, 'defaultStore') || get(this, 'isDefaultStore')) {\n set(DS, 'defaultStore', this);\n }\n\n // internal bookkeeping; not observable\n this.typeMaps = {};\n this.recordCache = [];\n this.clientIdToId = {};\n this.recordArraysByClientId = {};\n\n // Internally, we maintain a map of all unloaded IDs requested by\n // a ManyArray. As the adapter loads hashes into the store, the\n // store notifies any interested ManyArrays. When the ManyArray's\n // total number of loading records drops to zero, it becomes\n // `isLoaded` and fires a `didLoad` event.\n this.loadingRecordArrays = {};\n\n set(this, 'defaultTransaction', this.transaction());\n\n return this._super();\n },\n\n /**\n Returns a new transaction scoped to this store.\n\n @see {DS.Transaction}\n @returns DS.Transaction\n */\n transaction: function() {\n return DS.Transaction.create({ store: this });\n },\n\n /**\n @private\n\n This is used only by the record's DataProxy. Do not use this directly.\n */\n dataForRecord: function(record) {\n var type = record.constructor,\n clientId = get(record, 'clientId'),\n typeMap = this.typeMapFor(type);\n\n return typeMap.cidToHash[clientId];\n },\n\n /**\n The adapter to use to communicate to a backend server or other persistence layer.\n\n This can be specified as an instance, a class, or a property path that specifies\n where the adapter can be located.\n\n @property {DS.Adapter|String}\n */\n adapter: null,\n\n /**\n @private\n\n This property returns the adapter, after resolving a possible String.\n\n @returns DS.Adapter\n */\n _adapter: Ember.computed(function() {\n var adapter = get(this, 'adapter');\n if (typeof adapter === 'string') {\n return get(this, adapter, false) || get(window, adapter);\n }\n return adapter;\n }).property('adapter').cacheable(),\n\n // A monotonically increasing number to be used to uniquely identify\n // data hashes and records.\n clientIdCounter: 1,\n\n // .....................\n // . CREATE NEW RECORD .\n // .....................\n\n /**\n Create a new record in the current store. The properties passed\n to this method are set on the newly created record.\n\n @param {subclass of DS.Model} type\n @param {Object} properties a hash of properties to set on the\n newly created record.\n @returns DS.Model\n */\n createRecord: function(type, properties, transaction) {\n properties = properties || {};\n\n // Create a new instance of the model `type` and put it\n // into the specified `transaction`. If no transaction is\n // specified, the default transaction will be used.\n //\n // NOTE: A `transaction` is specified when the\n // `transaction.createRecord` API is used.\n var record = type._create({\n store: this\n });\n\n transaction = transaction || get(this, 'defaultTransaction');\n transaction.adoptRecord(record);\n\n // Extract the primary key from the `properties` hash,\n // based on the `primaryKey` for the model type.\n var primaryKey = get(record, 'primaryKey'),\n id = properties[primaryKey] || null;\n\n // If the passed properties do not include a primary key,\n // give the adapter an opportunity to generate one.\n var adapter;\n if (Ember.none(id)) {\n adapter = get(this, 'adapter');\n if (adapter && adapter.generateIdForRecord) {\n id = adapter.generateIdForRecord(this, record);\n properties.id = id;\n }\n }\n\n var hash = {}, clientId;\n\n // Push the hash into the store. If present, associate the\n // extracted `id` with the hash.\n clientId = this.pushHash(hash, id, type);\n\n record.send('didChangeData');\n\n var recordCache = get(this, 'recordCache');\n\n // Now that we have a clientId, attach it to the record we\n // just created.\n set(record, 'clientId', clientId);\n\n // Store the record we just created in the record cache for\n // this clientId.\n recordCache[clientId] = record;\n\n // Set the properties specified on the record.\n record.setProperties(properties);\n\n this.updateRecordArrays(type, clientId, get(record, 'data'));\n\n return record;\n },\n\n // .................\n // . DELETE RECORD .\n // .................\n\n /**\n For symmetry, a record can be deleted via the store.\n\n @param {DS.Model} record\n */\n deleteRecord: function(record) {\n record.send('deleteRecord');\n },\n\n // ................\n // . FIND RECORDS .\n // ................\n\n /**\n This is the main entry point into finding records. The first\n parameter to this method is always a subclass of `DS.Model`.\n\n You can use the `find` method on a subclass of `DS.Model`\n directly if your application only has one store. For\n example, instead of `store.find(App.Person, 1)`, you could\n say `App.Person.find(1)`.\n\n ---\n\n To find a record by ID, pass the `id` as the second parameter:\n\n store.find(App.Person, 1);\n App.Person.find(1);\n\n If the record with that `id` had not previously been loaded,\n the store will return an empty record immediately and ask\n the adapter to find the data by calling the adapter's `find`\n method.\n\n The `find` method will always return the same object for a\n given type and `id`. To check whether the adapter has populated\n a record, you can check its `isLoaded` property.\n\n ---\n\n To find all records for a type, call `find` with no additional\n parameters:\n\n store.find(App.Person);\n App.Person.find();\n\n This will return a `RecordArray` representing all known records\n for the given type and kick off a request to the adapter's\n `findAll` method to load any additional records for the type.\n\n The `RecordArray` returned by `find()` is live. If any more\n records for the type are added at a later time through any\n mechanism, it will automatically update to reflect the change.\n\n ---\n\n To find a record by a query, call `find` with a hash as the\n second parameter:\n\n store.find(App.Person, { page: 1 });\n App.Person.find({ page: 1 });\n\n This will return a `RecordArray` immediately, but it will always\n be an empty `RecordArray` at first. It will call the adapter's\n `findQuery` method, which will populate the `RecordArray` once\n the server has returned results.\n\n You can check whether a query results `RecordArray` has loaded\n by checking its `isLoaded` property.\n */\n find: function(type, id, query) {\n if (id === undefined) {\n return this.findAll(type);\n }\n\n if (query !== undefined) {\n return this.findMany(type, id, query);\n } else if (Ember.typeOf(id) === 'object') {\n return this.findQuery(type, id);\n }\n\n if (Ember.isArray(id)) {\n return this.findMany(type, id);\n }\n\n var clientId = this.typeMapFor(type).idToCid[id];\n\n return this.findByClientId(type, clientId, id);\n },\n\n findByClientId: function(type, clientId, id) {\n var recordCache = get(this, 'recordCache'),\n dataCache, record;\n\n // If there is already a clientId assigned for this\n // type/id combination, try to find an existing\n // record for that id and return. Otherwise,\n // materialize a new record and set its data to the\n // value we already have.\n if (clientId !== undefined) {\n record = recordCache[clientId];\n\n if (!record) {\n // create a new instance of the model type in the\n // 'isLoading' state\n record = this.materializeRecord(type, clientId);\n\n dataCache = this.typeMapFor(type).cidToHash;\n\n if (typeof dataCache[clientId] === 'object') {\n record.send('didChangeData');\n }\n }\n } else {\n clientId = this.pushHash(LOADING, id, type);\n\n // create a new instance of the model type in the\n // 'isLoading' state\n record = this.materializeRecord(type, clientId, id);\n\n // let the adapter set the data, possibly async\n var adapter = get(this, '_adapter');\n if (adapter && adapter.find) { adapter.find(this, type, id); }\n else { throw fmt(\"Adapter is either null or does not implement `find` method\", this); }\n }\n\n return record;\n },\n\n /**\n @private\n\n Given a type and array of `clientId`s, determines which of those\n `clientId`s has not yet been loaded.\n\n In preparation for loading, this method also marks any unloaded\n `clientId`s as loading.\n */\n neededClientIds: function(type, clientIds) {\n var neededClientIds = [],\n typeMap = this.typeMapFor(type),\n dataCache = typeMap.cidToHash,\n clientId;\n\n for (var i=0, l=clientIds.length; i B\n // B -> C\n //\n // In this case, there is no need to remember the A->B\n // change. We can collapse both changes into:\n //\n // A -> C\n //\n // Another possible case is:\n //\n // A -> B\n // B -> A\n //\n // In this case, we don't need to do anything. We can\n // simply remove the original A->B change and call it\n // a day.\n if (relationship.newParent === oldParent) {\n oldParent = relationship.oldParent;\n this.removeRelationship(relationship);\n\n // This is the case of A->B followed by B->A.\n if (relationship.oldParent === newParent) {\n needsNewEntries = false;\n }\n }\n }\n }\n\n relationship = {\n child: child,\n oldParent: oldParent,\n newParent: newParent\n };\n\n // If we didn't go A->B and then B->A, add new dirty relationship\n // entries.\n if (needsNewEntries) {\n this.addRelationshipTo('byChild', child, relationship);\n this.addRelationshipTo('byOldParent', oldParent, relationship);\n this.addRelationshipTo('byNewParent', newParent, relationship);\n }\n },\n\n removeRelationship: function(relationship) {\n var relationships = this.dirtyRelationships;\n\n removeObject(relationships.byOldParent.get(relationship.oldParent), relationship);\n removeObject(relationships.byNewParent.get(relationship.newParent), relationship);\n removeObject(relationships.byChild.get(relationship.child), relationship);\n },\n\n addRelationshipTo: function(type, record, description) {\n var map = this.dirtyRelationships[type];\n\n var relationships = map.get(record);\n\n if (!relationships) {\n relationships = [ description ];\n map.set(record, relationships);\n } else {\n relationships.push(description);\n }\n },\n\n /**\n @private\n\n Called by a record's state manager to indicate that the record has entered\n a dirty state. The record will be moved from the `clean` bucket and into\n the appropriate dirty bucket.\n\n @param {String} bucketType one of `created`, `updated`, or `deleted`\n */\n recordBecameDirty: function(bucketType, record) {\n this.removeFromBucket('clean', record);\n this.addToBucket(bucketType, record);\n },\n\n /**\n @private\n\n Called by a record's state manager to indicate that the record has entered\n inflight state. The record will be moved from its current dirty bucket and into\n the `inflight` bucket.\n\n @param {String} bucketType one of `created`, `updated`, or `deleted`\n */\n recordBecameInFlight: function(kind, record) {\n this.removeFromBucket(kind, record);\n this.addToBucket('inflight', record);\n },\n\n /**\n @private\n\n Called by a record's state manager to indicate that the record has entered\n a clean state. The record will be moved from its current dirty or inflight bucket and into\n the `clean` bucket.\n\n @param {String} bucketType one of `created`, `updated`, or `deleted`\n */\n recordBecameClean: function(kind, record) {\n this.removeFromBucket(kind, record);\n\n this.remove(record);\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/transaction");minispade.register('ember', "(function() {// Version: v0.9.8.1-644-g620e78b\n// Last commit: 620e78b (2012-07-19 10:28:13 -0700)\n\n\n(function() {\n/*global __fail__*/\n\nif ('undefined' === typeof Ember) {\n Ember = {};\n\n if ('undefined' !== typeof window) {\n window.Em = window.Ember = Em = Ember;\n }\n}\n\nEmber.ENV = 'undefined' === typeof ENV ? {} : ENV;\n\nif (!('MANDATORY_SETTER' in Ember.ENV)) {\n Ember.ENV.MANDATORY_SETTER = true; // default to true for debug dist\n}\n\n/**\n Define an assertion that will throw an exception if the condition is not\n met. Ember build tools will remove any calls to Ember.assert() when\n doing a production build. Example:\n\n // Test for truthiness\n Ember.assert('Must pass a valid object', obj);\n // Fail unconditionally\n Ember.assert('This code path should never be run')\n\n @static\n @function\n @param {String} desc\n A description of the assertion. This will become the text of the Error\n thrown if the assertion fails.\n\n @param {Boolean} test\n Must be truthy for the assertion to pass. If falsy, an exception will be\n thrown.\n*/\nEmber.assert = function(desc, test) {\n if (!test) throw new Error(\"assertion failed: \"+desc);\n};\n\n\n/**\n Display a warning with the provided message. Ember build tools will\n remove any calls to Ember.warn() when doing a production build.\n\n @static\n @function\n @param {String} message\n A warning to display.\n\n @param {Boolean} test\n An optional boolean. If falsy, the warning will be displayed.\n*/\nEmber.warn = function(message, test) {\n if (!test) {\n Ember.Logger.warn(\"WARNING: \"+message);\n if ('trace' in Ember.Logger) Ember.Logger.trace();\n }\n};\n\n/**\n Display a deprecation warning with the provided message and a stack trace\n (Chrome and Firefox only). Ember build tools will remove any calls to\n Ember.deprecate() when doing a production build.\n\n @static\n @function\n @param {String} message\n A description of the deprecation.\n\n @param {Boolean} test\n An optional boolean. If falsy, the deprecation will be displayed.\n*/\nEmber.deprecate = function(message, test) {\n if (Ember && Ember.TESTING_DEPRECATION) { return; }\n\n if (arguments.length === 1) { test = false; }\n if (test) { return; }\n\n if (Ember && Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); }\n\n var error;\n\n // When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome\n try { __fail__.fail(); } catch (e) { error = e; }\n\n if (Ember.LOG_STACKTRACE_ON_DEPRECATION && error.stack) {\n var stack, stackStr = '';\n if (error['arguments']) {\n // Chrome\n stack = error.stack.replace(/^\\s+at\\s+/gm, '').\n replace(/^([^\\(]+?)([\\n$])/gm, '{anonymous}($1)$2').\n replace(/^Object.\\s*\\(([^\\)]+)\\)/gm, '{anonymous}($1)').split('\\n');\n stack.shift();\n } else {\n // Firefox\n stack = error.stack.replace(/(?:\\n@:0)?\\s+$/m, '').\n replace(/^\\(/gm, '{anonymous}(').split('\\n');\n }\n\n stackStr = \"\\n \" + stack.slice(2).join(\"\\n \");\n message = message + stackStr;\n }\n\n Ember.Logger.warn(\"DEPRECATION: \"+message);\n};\n\n\n\n/**\n Display a deprecation warning with the provided message and a stack trace\n (Chrome and Firefox only) when the wrapped method is called.\n\n Ember build tools will not remove calls to Ember.deprecateFunc(), though\n no warnings will be shown in production.\n\n @static\n @function\n @param {String} message\n A description of the deprecation.\n\n @param {Function} func\n The function to be deprecated.\n*/\nEmber.deprecateFunc = function(message, func) {\n return function() {\n Ember.deprecate(message);\n return func.apply(this, arguments);\n };\n};\n\n\nwindow.ember_assert = Ember.deprecateFunc(\"ember_assert is deprecated. Please use Ember.assert instead.\", Ember.assert);\nwindow.ember_warn = Ember.deprecateFunc(\"ember_warn is deprecated. Please use Ember.warn instead.\", Ember.warn);\nwindow.ember_deprecate = Ember.deprecateFunc(\"ember_deprecate is deprecated. Please use Ember.deprecate instead.\", Ember.deprecate);\nwindow.ember_deprecateFunc = Ember.deprecateFunc(\"ember_deprecateFunc is deprecated. Please use Ember.deprecateFunc instead.\", Ember.deprecateFunc);\n\n})();\n\n// Version: v0.9.8.1-659-g396c08b\n// Last commit: 396c08b (2012-07-22 10:18:55 -0400)\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Em:true ENV */\n\nif ('undefined' === typeof Ember) {\n // Create core object. Make it act like an instance of Ember.Namespace so that\n // objects assigned to it are given a sane string representation.\n Ember = {};\n}\n\n/**\n @namespace\n @name Ember\n @version 1.0.pre\n\n All Ember methods and functions are defined inside of this namespace.\n You generally should not add new properties to this namespace as it may be\n overwritten by future versions of Ember.\n\n You can also use the shorthand \"Em\" instead of \"Ember\".\n\n Ember-Runtime is a framework that provides core functions for\n Ember including cross-platform functions, support for property\n observing and objects. Its focus is on small size and performance. You can\n use this in place of or along-side other cross-platform libraries such as\n jQuery.\n\n The core Runtime framework is based on the jQuery API with a number of\n performance optimizations.\n*/\n\n// aliases needed to keep minifiers from removing the global context\nif ('undefined' !== typeof window) {\n window.Em = window.Ember = Em = Ember;\n}\n\n// Make sure these are set whether Ember was already defined or not\n\nEmber.isNamespace = true;\n\nEmber.toString = function() { return \"Ember\"; };\n\n\n/**\n @static\n @type String\n @default '1.0.pre'\n @constant\n*/\nEmber.VERSION = '1.0.pre';\n\n/**\n @static\n @type Hash\n @constant\n\n Standard environmental variables. You can define these in a global `ENV`\n variable before loading Ember to control various configuration\n settings.\n*/\nEmber.ENV = Ember.ENV || ('undefined' === typeof ENV ? {} : ENV);\n\nEmber.config = Ember.config || {};\n\n// ..........................................................\n// BOOTSTRAP\n//\n\n/**\n @static\n @type Boolean\n @default true\n @constant\n\n Determines whether Ember should enhances some built-in object\n prototypes to provide a more friendly API. If enabled, a few methods\n will be added to Function, String, and Array. Object.prototype will not be\n enhanced, which is the one that causes most troubles for people.\n\n In general we recommend leaving this option set to true since it rarely\n conflicts with other code. If you need to turn it off however, you can\n define an ENV.EXTEND_PROTOTYPES config to disable it.\n*/\nEmber.EXTEND_PROTOTYPES = (Ember.ENV.EXTEND_PROTOTYPES !== false);\n\n/**\n @static\n @type Boolean\n @default true\n @constant\n\n Determines whether Ember logs a full stack trace during deprecation warnings\n*/\nEmber.LOG_STACKTRACE_ON_DEPRECATION = (Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION !== false);\n\n/**\n @static\n @type Boolean\n @default Ember.EXTEND_PROTOTYPES\n @constant\n\n Determines whether Ember should add ECMAScript 5 shims to older browsers.\n*/\nEmber.SHIM_ES5 = (Ember.ENV.SHIM_ES5 === false) ? false : Ember.EXTEND_PROTOTYPES;\n\n\n/**\n @static\n @type Boolean\n @default true\n @constant\n\n Determines whether computed properties are cacheable by default.\n This option will be removed for the 1.1 release.\n\n When caching is enabled by default, you can use `volatile()` to disable\n caching on individual computed properties.\n*/\nEmber.CP_DEFAULT_CACHEABLE = (Ember.ENV.CP_DEFAULT_CACHEABLE !== false);\n\n/**\n @static\n @type Boolean\n @default true\n @constant\n\n Determines whether views render their templates using themselves\n as the context, or whether it is inherited from the parent. This option\n will be removed in the 1.1 release.\n\n If you need to update your application to use the new context rules, simply\n prefix property access with `view.`:\n\n // Before:\n {{#each App.photosController}}\n Photo Title: {{title}}\n {{#view App.InfoView contentBinding=\"this\"}}\n {{content.date}}\n {{content.cameraType}}\n {{otherViewProperty}}\n {{/view}}\n {{/each}}\n\n // After:\n {{#each App.photosController}}\n Photo Title: {{title}}\n {{#view App.InfoView}}\n {{date}}\n {{cameraType}}\n {{view.otherViewProperty}}\n {{/view}}\n {{/each}}\n*/\nEmber.VIEW_PRESERVES_CONTEXT = (Ember.ENV.VIEW_PRESERVES_CONTEXT !== false);\n\n/**\n Empty function. Useful for some operations.\n\n @returns {Object}\n @private\n*/\nEmber.K = function() { return this; };\n\n/**\n @namespace\n @name window\n @description The global window object\n*/\n\n\n// Stub out the methods defined by the ember-debug package in case it's not loaded\n\nif ('undefined' === typeof Ember.assert) { Ember.assert = Ember.K; }\nif ('undefined' === typeof Ember.warn) { Ember.warn = Ember.K; }\nif ('undefined' === typeof Ember.deprecate) { Ember.deprecate = Ember.K; }\nif ('undefined' === typeof Ember.deprecateFunc) {\n Ember.deprecateFunc = function(_, func) { return func; };\n}\n\n// These are deprecated but still supported\n\nif ('undefined' === typeof ember_assert) { window.ember_assert = Ember.K; }\nif ('undefined' === typeof ember_warn) { window.ember_warn = Ember.K; }\nif ('undefined' === typeof ember_deprecate) { window.ember_deprecate = Ember.K; }\nif ('undefined' === typeof ember_deprecateFunc) {\n /** @private */\n window.ember_deprecateFunc = function(_, func) { return func; };\n}\n\n\n// ..........................................................\n// LOGGER\n//\n\n/**\n @class\n\n Inside Ember-Metal, simply uses the window.console object.\n Override this to provide more robust logging functionality.\n*/\nEmber.Logger = window.console || { log: Ember.K, warn: Ember.K, error: Ember.K, info: Ember.K, debug: Ember.K };\n\n})();\n\n\n\n(function() {\n/*jshint newcap:false*/\n\n// NOTE: There is a bug in jshint that doesn't recognize `Object()` without `new`\n// as being ok unless both `newcap:false` and not `use strict`.\n// https://github.com/jshint/jshint/issues/392\n\n// Testing this is not ideal, but we want to use native functions\n// if available, but not to use versions created by libraries like Prototype\n/** @private */\nvar isNativeFunc = function(func) {\n // This should probably work in all browsers likely to have ES5 array methods\n return func && Function.prototype.toString.call(func).indexOf('[native code]') > -1;\n};\n\n// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/map\n/** @private */\nvar arrayMap = isNativeFunc(Array.prototype.map) ? Array.prototype.map : function(fun /*, thisp */) {\n //\"use strict\";\n\n if (this === void 0 || this === null) {\n throw new TypeError();\n }\n\n var t = Object(this);\n var len = t.length >>> 0;\n if (typeof fun !== \"function\") {\n throw new TypeError();\n }\n\n var res = new Array(len);\n var thisp = arguments[1];\n for (var i = 0; i < len; i++) {\n if (i in t) {\n res[i] = fun.call(thisp, t[i], i, t);\n }\n }\n\n return res;\n};\n\n// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach\n/** @private */\nvar arrayForEach = isNativeFunc(Array.prototype.forEach) ? Array.prototype.forEach : function(fun /*, thisp */) {\n //\"use strict\";\n\n if (this === void 0 || this === null) {\n throw new TypeError();\n }\n\n var t = Object(this);\n var len = t.length >>> 0;\n if (typeof fun !== \"function\") {\n throw new TypeError();\n }\n\n var thisp = arguments[1];\n for (var i = 0; i < len; i++) {\n if (i in t) {\n fun.call(thisp, t[i], i, t);\n }\n }\n};\n\n/** @private */\nvar arrayIndexOf = isNativeFunc(Array.prototype.indexOf) ? Array.prototype.indexOf : function (obj, fromIndex) {\n if (fromIndex === null || fromIndex === undefined) { fromIndex = 0; }\n else if (fromIndex < 0) { fromIndex = Math.max(0, this.length + fromIndex); }\n for (var i = fromIndex, j = this.length; i < j; i++) {\n if (this[i] === obj) { return i; }\n }\n return -1;\n};\n\nEmber.ArrayPolyfills = {\n map: arrayMap,\n forEach: arrayForEach,\n indexOf: arrayIndexOf\n};\n\nvar utils = Ember.EnumerableUtils = {\n map: function(obj, callback, thisArg) {\n return obj.map ? obj.map.call(obj, callback, thisArg) : arrayMap.call(obj, callback, thisArg);\n },\n\n forEach: function(obj, callback, thisArg) {\n return obj.forEach ? obj.forEach.call(obj, callback, thisArg) : arrayForEach.call(obj, callback, thisArg);\n },\n\n indexOf: function(obj, element, index) {\n return obj.indexOf ? obj.indexOf.call(obj, element, index) : arrayIndexOf.call(obj, element, index);\n },\n\n indexesOf: function(obj, elements) {\n return elements === undefined ? [] : utils.map(elements, function(item) {\n return utils.indexOf(obj, item);\n });\n },\n\n removeObject: function(array, item) {\n var index = utils.indexOf(array, item);\n if (index !== -1) { array.splice(index, 1); }\n }\n};\n\n\nif (Ember.SHIM_ES5) {\n if (!Array.prototype.map) {\n /** @private */\n Array.prototype.map = arrayMap;\n }\n\n if (!Array.prototype.forEach) {\n /** @private */\n Array.prototype.forEach = arrayForEach;\n }\n\n if (!Array.prototype.indexOf) {\n /** @private */\n Array.prototype.indexOf = arrayIndexOf;\n }\n}\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Node */\n/**\n @class\n\n Platform specific methods and feature detectors needed by the framework.\n\n @name Ember.platform\n*/\nvar platform = Ember.platform = {};\n\n/**\n Identical to Object.create(). Implements if not available natively.\n @memberOf Ember.platform\n @name create\n*/\nEmber.create = Object.create;\n\nif (!Ember.create) {\n /** @private */\n var K = function() {};\n\n Ember.create = function(obj, props) {\n K.prototype = obj;\n obj = new K();\n if (props) {\n K.prototype = obj;\n for (var prop in props) {\n K.prototype[prop] = props[prop].value;\n }\n obj = new K();\n }\n K.prototype = null;\n\n return obj;\n };\n\n Ember.create.isSimulated = true;\n}\n\n/** @private */\nvar defineProperty = Object.defineProperty;\nvar canRedefineProperties, canDefinePropertyOnDOM;\n\n// Catch IE8 where Object.defineProperty exists but only works on DOM elements\nif (defineProperty) {\n try {\n defineProperty({}, 'a',{get:function(){}});\n } catch (e) {\n /** @private */\n defineProperty = null;\n }\n}\n\nif (defineProperty) {\n // Detects a bug in Android <3.2 where you cannot redefine a property using\n // Object.defineProperty once accessors have already been set.\n /** @private */\n canRedefineProperties = (function() {\n var obj = {};\n\n defineProperty(obj, 'a', {\n configurable: true,\n enumerable: true,\n get: function() { },\n set: function() { }\n });\n\n defineProperty(obj, 'a', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: true\n });\n\n return obj.a === true;\n })();\n\n // This is for Safari 5.0, which supports Object.defineProperty, but not\n // on DOM nodes.\n /** @private */\n canDefinePropertyOnDOM = (function(){\n try {\n defineProperty(document.createElement('div'), 'definePropertyOnDOM', {});\n return true;\n } catch(e) { }\n\n return false;\n })();\n\n if (!canRedefineProperties) {\n /** @private */\n defineProperty = null;\n } else if (!canDefinePropertyOnDOM) {\n /** @private */\n defineProperty = function(obj, keyName, desc){\n var isNode;\n\n if (typeof Node === \"object\") {\n isNode = obj instanceof Node;\n } else {\n isNode = typeof obj === \"object\" && typeof obj.nodeType === \"number\" && typeof obj.nodeName === \"string\";\n }\n\n if (isNode) {\n // TODO: Should we have a warning here?\n return (obj[keyName] = desc.value);\n } else {\n return Object.defineProperty(obj, keyName, desc);\n }\n };\n }\n}\n\n/**\n Identical to Object.defineProperty(). Implements as much functionality\n as possible if not available natively.\n\n @memberOf Ember.platform\n @name defineProperty\n @param {Object} obj The object to modify\n @param {String} keyName property name to modify\n @param {Object} desc descriptor hash\n @returns {void}\n*/\nplatform.defineProperty = defineProperty;\n\n/**\n Set to true if the platform supports native getters and setters.\n\n @memberOf Ember.platform\n @name hasPropertyAccessors\n*/\nplatform.hasPropertyAccessors = true;\n\nif (!platform.defineProperty) {\n platform.hasPropertyAccessors = false;\n\n platform.defineProperty = function(obj, keyName, desc) {\n if (!desc.get) { obj[keyName] = desc.value; }\n };\n\n platform.defineProperty.isSimulated = true;\n}\n\nif (Ember.ENV.MANDATORY_SETTER && !platform.hasPropertyAccessors) {\n Ember.ENV.MANDATORY_SETTER = false;\n}\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar o_defineProperty = Ember.platform.defineProperty,\n o_create = Ember.create,\n // Used for guid generation...\n GUID_KEY = '__ember'+ (+ new Date()),\n uuid = 0,\n numberCache = [],\n stringCache = {};\n\nvar MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;\n\n/**\n @private\n @static\n @type String\n @constant\n\n A unique key used to assign guids and other private metadata to objects.\n If you inspect an object in your browser debugger you will often see these.\n They can be safely ignored.\n\n On browsers that support it, these properties are added with enumeration\n disabled so they won't show up when you iterate over your properties.\n*/\nEmber.GUID_KEY = GUID_KEY;\n\nvar GUID_DESC = {\n writable: false,\n configurable: false,\n enumerable: false,\n value: null\n};\n\n/**\n @private\n\n Generates a new guid, optionally saving the guid to the object that you\n pass in. You will rarely need to use this method. Instead you should\n call Ember.guidFor(obj), which return an existing guid if available.\n\n @param {Object} obj\n Optional object the guid will be used for. If passed in, the guid will\n be saved on the object and reused whenever you pass the same object\n again.\n\n If no object is passed, just generate a new guid.\n\n @param {String} prefix\n Optional prefix to place in front of the guid. Useful when you want to\n separate the guid into separate namespaces.\n\n @returns {String} the guid\n*/\nEmber.generateGuid = function generateGuid(obj, prefix) {\n if (!prefix) prefix = 'ember';\n var ret = (prefix + (uuid++));\n if (obj) {\n GUID_DESC.value = ret;\n o_defineProperty(obj, GUID_KEY, GUID_DESC);\n }\n return ret ;\n};\n\n/**\n @private\n\n Returns a unique id for the object. If the object does not yet have\n a guid, one will be assigned to it. You can call this on any object,\n Ember.Object-based or not, but be aware that it will add a _guid property.\n\n You can also use this method on DOM Element objects.\n\n @method\n @param obj {Object} any object, string, number, Element, or primitive\n @returns {String} the unique guid for this instance.\n*/\nEmber.guidFor = function guidFor(obj) {\n\n // special cases where we don't want to add a key to object\n if (obj === undefined) return \"(undefined)\";\n if (obj === null) return \"(null)\";\n\n var cache, ret;\n var type = typeof obj;\n\n // Don't allow prototype changes to String etc. to change the guidFor\n switch(type) {\n case 'number':\n ret = numberCache[obj];\n if (!ret) ret = numberCache[obj] = 'nu'+obj;\n return ret;\n\n case 'string':\n ret = stringCache[obj];\n if (!ret) ret = stringCache[obj] = 'st'+(uuid++);\n return ret;\n\n case 'boolean':\n return obj ? '(true)' : '(false)';\n\n default:\n if (obj[GUID_KEY]) return obj[GUID_KEY];\n if (obj === Object) return '(Object)';\n if (obj === Array) return '(Array)';\n ret = 'ember'+(uuid++);\n GUID_DESC.value = ret;\n o_defineProperty(obj, GUID_KEY, GUID_DESC);\n return ret;\n }\n};\n\n// ..........................................................\n// META\n//\n\nvar META_DESC = {\n writable: true,\n configurable: false,\n enumerable: false,\n value: null\n};\n\nvar META_KEY = Ember.GUID_KEY+'_meta';\n\n/**\n The key used to store meta information on object for property observing.\n\n @static\n @type String\n*/\nEmber.META_KEY = META_KEY;\n\n// Placeholder for non-writable metas.\nvar EMPTY_META = {\n descs: {},\n watching: {}\n};\n\nif (MANDATORY_SETTER) { EMPTY_META.values = {}; }\n\nEmber.EMPTY_META = EMPTY_META;\n\nif (Object.freeze) Object.freeze(EMPTY_META);\n\nvar isDefinePropertySimulated = Ember.platform.defineProperty.isSimulated;\n\nfunction Meta(obj) {\n this.descs = {};\n this.watching = {};\n this.cache = {};\n this.source = obj;\n}\n\nif (isDefinePropertySimulated) {\n // on platforms that don't support enumerable false\n // make meta fail jQuery.isPlainObject() to hide from\n // jQuery.extend() by having a property that fails\n // hasOwnProperty check.\n Meta.prototype.__preventPlainObject__ = true;\n}\n\n/**\n @private\n @function\n\n Retrieves the meta hash for an object. If 'writable' is true ensures the\n hash is writable for this object as well.\n\n The meta object contains information about computed property descriptors as\n well as any watched properties and other information. You generally will\n not access this information directly but instead work with higher level\n methods that manipulate this hash indirectly.\n\n @param {Object} obj\n The object to retrieve meta for\n\n @param {Boolean} writable\n Pass false if you do not intend to modify the meta hash, allowing the\n method to avoid making an unnecessary copy.\n\n @returns {Hash}\n*/\nEmber.meta = function meta(obj, writable) {\n\n var ret = obj[META_KEY];\n if (writable===false) return ret || EMPTY_META;\n\n if (!ret) {\n if (!isDefinePropertySimulated) o_defineProperty(obj, META_KEY, META_DESC);\n\n ret = new Meta(obj);\n\n if (MANDATORY_SETTER) { ret.values = {}; }\n\n obj[META_KEY] = ret;\n\n // make sure we don't accidentally try to create constructor like desc\n ret.descs.constructor = null;\n\n } else if (ret.source !== obj) {\n if (!isDefinePropertySimulated) o_defineProperty(obj, META_KEY, META_DESC);\n\n ret = o_create(ret);\n ret.descs = o_create(ret.descs);\n ret.watching = o_create(ret.watching);\n ret.cache = {};\n ret.source = obj;\n\n if (MANDATORY_SETTER) { ret.values = o_create(ret.values); }\n\n obj[META_KEY] = ret;\n }\n return ret;\n};\n\nEmber.getMeta = function getMeta(obj, property) {\n var meta = Ember.meta(obj, false);\n return meta[property];\n};\n\nEmber.setMeta = function setMeta(obj, property, value) {\n var meta = Ember.meta(obj, true);\n meta[property] = value;\n return value;\n};\n\n/**\n @private\n\n In order to store defaults for a class, a prototype may need to create\n a default meta object, which will be inherited by any objects instantiated\n from the class's constructor.\n\n However, the properties of that meta object are only shallow-cloned,\n so if a property is a hash (like the event system's `listeners` hash),\n it will by default be shared across all instances of that class.\n\n This method allows extensions to deeply clone a series of nested hashes or\n other complex objects. For instance, the event system might pass\n ['listeners', 'foo:change', 'ember157'] to `prepareMetaPath`, which will\n walk down the keys provided.\n\n For each key, if the key does not exist, it is created. If it already\n exists and it was inherited from its constructor, the constructor's\n key is cloned.\n\n You can also pass false for `writable`, which will simply return\n undefined if `prepareMetaPath` discovers any part of the path that\n shared or undefined.\n\n @param {Object} obj The object whose meta we are examining\n @param {Array} path An array of keys to walk down\n @param {Boolean} writable whether or not to create a new meta\n (or meta property) if one does not already exist or if it's\n shared with its constructor\n*/\nEmber.metaPath = function metaPath(obj, path, writable) {\n var meta = Ember.meta(obj, writable), keyName, value;\n\n for (var i=0, l=path.length; i []\n Ember.makeArray(null); => []\n Ember.makeArray(undefined); => []\n Ember.makeArray('lindsay'); => ['lindsay']\n Ember.makeArray([1,2,42]); => [1,2,42]\n\n var controller = Ember.ArrayProxy.create({ content: [] });\n Ember.makeArray(controller) === controller; => true\n\n @param {Object} obj the object\n @returns {Array}\n*/\nEmber.makeArray = function(obj) {\n if (obj === null || obj === undefined) { return []; }\n return Ember.isArray(obj) ? obj : [obj];\n};\n\nfunction canInvoke(obj, methodName) {\n return !!(obj && typeof obj[methodName] === 'function');\n}\n\n/**\n Checks to see if the `methodName` exists on the `obj`.\n\n @param {Object} obj The object to check for the method\n @param {String} methodName The method name to check for\n*/\nEmber.canInvoke = canInvoke;\n\n/**\n Checks to see if the `methodName` exists on the `obj`,\n and if it does, invokes it with the arguments passed.\n\n @function\n\n @param {Object} obj The object to check for the method\n @param {String} methodName The method name to check for\n @param {Array} args The arguments to pass to the method\n\n @returns {Boolean} true if the method does not return false\n @returns {Boolean} false otherwise\n*/\nEmber.tryInvoke = function(obj, methodName, args) {\n if (canInvoke(obj, methodName)) {\n return obj[methodName].apply(obj, args);\n }\n};\n\n})();\n\n\n\n(function() {\n/**\n JavaScript (before ES6) does not have a Map implementation. Objects,\n which are often used as dictionaries, may only have Strings as keys.\n\n Because Ember has a way to get a unique identifier for every object\n via `Ember.guidFor`, we can implement a performant Map with arbitrary\n keys. Because it is commonly used in low-level bookkeeping, Map is\n implemented as a pure JavaScript object for performance.\n\n This implementation follows the current iteration of the ES6 proposal\n for maps (http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets),\n with two exceptions. First, because we need our implementation to be\n pleasant on older browsers, we do not use the `delete` name (using\n `remove` instead). Second, as we do not have the luxury of in-VM\n iteration, we implement a forEach method for iteration.\n\n Map is mocked out to look like an Ember object, so you can do\n `Ember.Map.create()` for symmetry with other Ember classes.\n*/\n/** @private */\nvar guidFor = Ember.guidFor,\n indexOf = Ember.ArrayPolyfills.indexOf;\n\nvar copy = function(obj) {\n var output = {};\n\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) { output[prop] = obj[prop]; }\n }\n\n return output;\n};\n\nvar copyMap = function(original, newObject) {\n var keys = original.keys.copy(),\n values = copy(original.values);\n\n newObject.keys = keys;\n newObject.values = values;\n\n return newObject;\n};\n\n// This class is used internally by Ember.js and Ember Data.\n// Please do not use it at this time. We plan to clean it up\n// and add many tests soon.\nvar OrderedSet = Ember.OrderedSet = function() {\n this.clear();\n};\n\nOrderedSet.create = function() {\n return new OrderedSet();\n};\n\nOrderedSet.prototype = {\n clear: function() {\n this.presenceSet = {};\n this.list = [];\n },\n\n add: function(obj) {\n var guid = guidFor(obj),\n presenceSet = this.presenceSet,\n list = this.list;\n\n if (guid in presenceSet) { return; }\n\n presenceSet[guid] = true;\n list.push(obj);\n },\n\n remove: function(obj) {\n var guid = guidFor(obj),\n presenceSet = this.presenceSet,\n list = this.list;\n\n delete presenceSet[guid];\n\n var index = indexOf.call(list, obj);\n if (index > -1) {\n list.splice(index, 1);\n }\n },\n\n isEmpty: function() {\n return this.list.length === 0;\n },\n\n forEach: function(fn, self) {\n // allow mutation during iteration\n var list = this.list.slice();\n\n for (var i = 0, j = list.length; i < j; i++) {\n fn.call(self, list[i]);\n }\n },\n\n toArray: function() {\n return this.list.slice();\n },\n\n copy: function() {\n var set = new OrderedSet();\n\n set.presenceSet = copy(this.presenceSet);\n set.list = this.list.slice();\n\n return set;\n }\n};\n\n/**\n A Map stores values indexed by keys. Unlike JavaScript's\n default Objects, the keys of a Map can be any JavaScript\n object.\n\n Internally, a Map has two data structures:\n\n `keys`: an OrderedSet of all of the existing keys\n `values`: a JavaScript Object indexed by the\n Ember.guidFor(key)\n\n When a key/value pair is added for the first time, we\n add the key to the `keys` OrderedSet, and create or\n replace an entry in `values`. When an entry is deleted,\n we delete its entry in `keys` and `values`.\n*/\n\n/** @private */\nvar Map = Ember.Map = function() {\n this.keys = Ember.OrderedSet.create();\n this.values = {};\n};\n\nMap.create = function() {\n return new Map();\n};\n\nMap.prototype = {\n /**\n Retrieve the value associated with a given key.\n\n @param {anything} key\n @return {anything} the value associated with the key, or undefined\n */\n get: function(key) {\n var values = this.values,\n guid = guidFor(key);\n\n return values[guid];\n },\n\n /**\n Adds a value to the map. If a value for the given key has already been\n provided, the new value will replace the old value.\n\n @param {anything} key\n @param {anything} value\n */\n set: function(key, value) {\n var keys = this.keys,\n values = this.values,\n guid = guidFor(key);\n\n keys.add(key);\n values[guid] = value;\n },\n\n /**\n Removes a value from the map for an associated key.\n\n @param {anything} key\n @returns {Boolean} true if an item was removed, false otherwise\n */\n remove: function(key) {\n // don't use ES6 \"delete\" because it will be annoying\n // to use in browsers that are not ES6 friendly;\n var keys = this.keys,\n values = this.values,\n guid = guidFor(key),\n value;\n\n if (values.hasOwnProperty(guid)) {\n keys.remove(key);\n value = values[guid];\n delete values[guid];\n return true;\n } else {\n return false;\n }\n },\n\n /**\n Check whether a key is present.\n\n @param {anything} key\n @returns {Boolean} true if the item was present, false otherwise\n */\n has: function(key) {\n var values = this.values,\n guid = guidFor(key);\n\n return values.hasOwnProperty(guid);\n },\n\n /**\n Iterate over all the keys and values. Calls the function once\n for each key, passing in the key and value, in that order.\n\n The keys are guaranteed to be iterated over in insertion order.\n\n @param {Function} callback\n @param {anything} self if passed, the `this` value inside the\n callback. By default, `this` is the map.\n */\n forEach: function(callback, self) {\n var keys = this.keys,\n values = this.values;\n\n keys.forEach(function(key) {\n var guid = guidFor(key);\n callback.call(self, key, values[guid]);\n });\n },\n\n copy: function() {\n return copyMap(this, new Map());\n }\n};\n\nvar MapWithDefault = Ember.MapWithDefault = function(options) {\n Map.call(this);\n this.defaultValue = options.defaultValue;\n};\n\nMapWithDefault.create = function(options) {\n if (options) {\n return new MapWithDefault(options);\n } else {\n return new Map();\n }\n};\n\nMapWithDefault.prototype = Ember.create(Map.prototype);\n\nMapWithDefault.prototype.get = function(key) {\n var hasValue = this.has(key);\n\n if (hasValue) {\n return Map.prototype.get.call(this, key);\n } else {\n var defaultValue = this.defaultValue(key);\n this.set(key, defaultValue);\n return defaultValue;\n }\n};\n\nMapWithDefault.prototype.copy = function() {\n return copyMap(this, new MapWithDefault({\n defaultValue: this.defaultValue\n }));\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar META_KEY = Ember.META_KEY, get, set;\n\nvar MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;\n\n/** @private */\nvar IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/;\nvar IS_GLOBAL_PATH = /^([A-Z$]|([0-9][A-Z$])).*[\\.\\*]/;\nvar HAS_THIS = /^this[\\.\\*]/;\nvar FIRST_KEY = /^([^\\.\\*]+)/;\n\n// ..........................................................\n// GET AND SET\n//\n// If we are on a platform that supports accessors we can get use those.\n// Otherwise simulate accessors by looking up the property directly on the\n// object.\n\n/** @private */\nget = function get(obj, keyName) {\n // Helpers that operate with 'this' within an #each\n if (keyName === '') {\n return obj;\n }\n\n if (!keyName && 'string'===typeof obj) {\n keyName = obj;\n obj = null;\n }\n\n if (!obj || keyName.indexOf('.') !== -1) {\n return getPath(obj, keyName);\n }\n\n Ember.assert(\"You need to provide an object and key to `get`.\", !!obj && keyName);\n\n var meta = obj[META_KEY], desc = meta && meta.descs[keyName], ret;\n if (desc) {\n return desc.get(obj, keyName);\n } else {\n if (MANDATORY_SETTER && meta && meta.watching[keyName] > 0) {\n ret = meta.values[keyName];\n } else {\n ret = obj[keyName];\n }\n\n if (ret === undefined &&\n 'object' === typeof obj && !(keyName in obj) && 'function' === typeof obj.unknownProperty) {\n return obj.unknownProperty(keyName);\n }\n\n return ret;\n }\n};\n\n/** @private */\nset = function set(obj, keyName, value, tolerant) {\n if (typeof obj === 'string') {\n Ember.assert(\"Path '\" + obj + \"' must be global if no obj is given.\", IS_GLOBAL.test(obj));\n value = keyName;\n keyName = obj;\n obj = null;\n }\n\n if (!obj || keyName.indexOf('.') !== -1) {\n return setPath(obj, keyName, value, tolerant);\n }\n\n Ember.assert(\"You need to provide an object and key to `set`.\", !!obj && keyName !== undefined);\n Ember.assert('calling set on destroyed object', !obj.isDestroyed);\n\n var meta = obj[META_KEY], desc = meta && meta.descs[keyName],\n isUnknown, currentValue;\n if (desc) {\n desc.set(obj, keyName, value);\n }\n else {\n isUnknown = 'object' === typeof obj && !(keyName in obj);\n\n // setUnknownProperty is called if `obj` is an object,\n // the property does not already exist, and the\n // `setUnknownProperty` method exists on the object\n if (isUnknown && 'function' === typeof obj.setUnknownProperty) {\n obj.setUnknownProperty(keyName, value);\n } else if (meta && meta.watching[keyName] > 0) {\n if (MANDATORY_SETTER) {\n currentValue = meta.values[keyName];\n } else {\n currentValue = obj[keyName];\n }\n // only trigger a change if the value has changed\n if (value !== currentValue) {\n Ember.propertyWillChange(obj, keyName);\n if (MANDATORY_SETTER) {\n meta.values[keyName] = value;\n } else {\n obj[keyName] = value;\n }\n Ember.propertyDidChange(obj, keyName);\n }\n } else {\n obj[keyName] = value;\n }\n }\n return value;\n};\n\n/** @private */\nfunction firstKey(path) {\n return path.match(FIRST_KEY)[0];\n}\n\n// assumes path is already normalized\n/** @private */\nfunction normalizeTuple(target, path) {\n var hasThis = HAS_THIS.test(path),\n isGlobal = !hasThis && IS_GLOBAL_PATH.test(path),\n key;\n\n if (!target || isGlobal) target = window;\n if (hasThis) path = path.slice(5);\n\n if (target === window) {\n key = firstKey(path);\n target = get(target, key);\n path = path.slice(key.length+1);\n }\n\n // must return some kind of path to be valid else other things will break.\n if (!path || path.length===0) throw new Error('Invalid Path');\n\n return [ target, path ];\n}\n\n/** @private */\nfunction getPath(root, path) {\n var hasThis, parts, tuple, idx, len;\n\n // If there is no root and path is a key name, return that\n // property from the global object.\n // E.g. get('Ember') -> Ember\n if (root === null && path.indexOf('.') === -1) { return get(window, path); }\n\n // detect complicated paths and normalize them\n hasThis = HAS_THIS.test(path);\n\n if (!root || hasThis) {\n tuple = normalizeTuple(root, path);\n root = tuple[0];\n path = tuple[1];\n tuple.length = 0;\n }\n\n parts = path.split(\".\");\n len = parts.length;\n for (idx=0; root && idx 0;\n\n if (existingDesc instanceof Ember.Descriptor) {\n existingDesc.teardown(obj, keyName);\n }\n\n if (desc instanceof Ember.Descriptor) {\n descs[keyName] = desc;\n if (MANDATORY_SETTER && watching) {\n objectDefineProperty(obj, keyName, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: undefined // make enumerable\n });\n } else {\n obj[keyName] = undefined; // make enumerable\n }\n desc.setup(obj, keyName);\n } else {\n descs[keyName] = undefined; // shadow descriptor in proto\n if (desc == null) {\n if (MANDATORY_SETTER && watching) {\n meta.values[keyName] = val;\n objectDefineProperty(obj, keyName, {\n configurable: true,\n enumerable: true,\n set: function() {\n Ember.assert('Must use Ember.set() to access this property', false);\n },\n get: function() {\n var meta = this[META_KEY];\n return meta && meta.values[keyName];\n }\n });\n } else {\n obj[keyName] = val;\n }\n } else {\n // compatibility with ES5\n objectDefineProperty(obj, keyName, desc);\n }\n }\n\n // if key is being watched, override chains that\n // were initialized with the prototype\n if (watching) { Ember.overrideChains(obj, keyName, meta); }\n\n return this;\n};\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar AFTER_OBSERVERS = ':change';\nvar BEFORE_OBSERVERS = ':before';\nvar guidFor = Ember.guidFor;\n\nvar deferred = 0;\nvar array_Slice = [].slice;\n\n/** @private */\nvar ObserverSet = function () {\n this.targetSet = {};\n};\nObserverSet.prototype.add = function (target, path) {\n var targetSet = this.targetSet,\n targetGuid = Ember.guidFor(target),\n pathSet = targetSet[targetGuid];\n if (!pathSet) {\n targetSet[targetGuid] = pathSet = {};\n }\n if (pathSet[path]) {\n return false;\n } else {\n return pathSet[path] = true;\n }\n};\nObserverSet.prototype.clear = function () {\n this.targetSet = {};\n};\n\n/** @private */\nvar DeferredEventQueue = function() {\n this.targetSet = {};\n this.queue = [];\n};\n\nDeferredEventQueue.prototype.push = function(target, eventName, keyName) {\n var targetSet = this.targetSet,\n queue = this.queue,\n targetGuid = Ember.guidFor(target),\n eventNameSet = targetSet[targetGuid],\n index;\n\n if (!eventNameSet) {\n targetSet[targetGuid] = eventNameSet = {};\n }\n index = eventNameSet[eventName];\n if (index === undefined) {\n eventNameSet[eventName] = queue.push(Ember.deferEvent(target, eventName, [target, keyName])) - 1;\n } else {\n queue[index] = Ember.deferEvent(target, eventName, [target, keyName]);\n }\n};\n\nDeferredEventQueue.prototype.flush = function() {\n var queue = this.queue;\n this.queue = [];\n this.targetSet = {};\n for (var i=0, len=queue.length; i < len; ++i) {\n queue[i]();\n }\n};\n\nvar queue = new DeferredEventQueue(), beforeObserverSet = new ObserverSet();\n\n/** @private */\nfunction notifyObservers(obj, eventName, keyName, forceNotification) {\n if (deferred && !forceNotification) {\n queue.push(obj, eventName, keyName);\n } else {\n Ember.sendEvent(obj, eventName, [obj, keyName]);\n }\n}\n\n/** @private */\nfunction flushObserverQueue() {\n beforeObserverSet.clear();\n\n queue.flush();\n}\n\nEmber.beginPropertyChanges = function() {\n deferred++;\n return this;\n};\n\nEmber.endPropertyChanges = function() {\n deferred--;\n if (deferred<=0) flushObserverQueue();\n};\n\n/**\n Make a series of property changes together in an\n exception-safe way.\n\n Ember.changeProperties(function() {\n obj1.set('foo', mayBlowUpWhenSet);\n obj2.set('bar', baz);\n });\n*/\nEmber.changeProperties = function(cb, binding){\n Ember.beginPropertyChanges();\n try {\n cb.call(binding);\n } finally {\n Ember.endPropertyChanges();\n }\n};\n\n/**\n Set a list of properties on an object. These properties are set inside\n a single `beginPropertyChanges` and `endPropertyChanges` batch, so\n observers will be buffered.\n*/\nEmber.setProperties = function(self, hash) {\n Ember.changeProperties(function(){\n for(var prop in hash) {\n if (hash.hasOwnProperty(prop)) Ember.set(self, prop, hash[prop]);\n }\n });\n return self;\n};\n\n\n/** @private */\nfunction changeEvent(keyName) {\n return keyName+AFTER_OBSERVERS;\n}\n\n/** @private */\nfunction beforeEvent(keyName) {\n return keyName+BEFORE_OBSERVERS;\n}\n\nEmber.addObserver = function(obj, path, target, method) {\n Ember.addListener(obj, changeEvent(path), target, method);\n Ember.watch(obj, path);\n return this;\n};\n\n/** @private */\nEmber.observersFor = function(obj, path) {\n return Ember.listenersFor(obj, changeEvent(path));\n};\n\nEmber.removeObserver = function(obj, path, target, method) {\n Ember.unwatch(obj, path);\n Ember.removeListener(obj, changeEvent(path), target, method);\n return this;\n};\n\nEmber.addBeforeObserver = function(obj, path, target, method) {\n Ember.addListener(obj, beforeEvent(path), target, method);\n Ember.watch(obj, path);\n return this;\n};\n\n// Suspend observer during callback.\n//\n// This should only be used by the target of the observer\n// while it is setting the observed path.\n/** @private */\nEmber._suspendBeforeObserver = function(obj, path, target, method, callback) {\n return Ember._suspendListener(obj, beforeEvent(path), target, method, callback);\n};\n\nEmber._suspendObserver = function(obj, path, target, method, callback) {\n return Ember._suspendListener(obj, changeEvent(path), target, method, callback);\n};\n\n/** @private */\nEmber.beforeObserversFor = function(obj, path) {\n return Ember.listenersFor(obj, beforeEvent(path));\n};\n\nEmber.removeBeforeObserver = function(obj, path, target, method) {\n Ember.unwatch(obj, path);\n Ember.removeListener(obj, beforeEvent(path), target, method);\n return this;\n};\n\n/** @private */\nEmber.notifyObservers = function(obj, keyName) {\n if (obj.isDestroying) { return; }\n\n notifyObservers(obj, changeEvent(keyName), keyName);\n};\n\n/** @private */\nEmber.notifyBeforeObservers = function(obj, keyName) {\n if (obj.isDestroying) { return; }\n\n var guid, set, forceNotification = false;\n\n if (deferred) {\n if (beforeObserverSet.add(obj, keyName)) {\n forceNotification = true;\n } else {\n return;\n }\n }\n\n notifyObservers(obj, beforeEvent(keyName), keyName, forceNotification);\n};\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar guidFor = Ember.guidFor, // utils.js\n metaFor = Ember.meta, // utils.js\n get = Ember.get, // accessors.js\n set = Ember.set, // accessors.js\n normalizeTuple = Ember.normalizeTuple, // accessors.js\n GUID_KEY = Ember.GUID_KEY, // utils.js\n META_KEY = Ember.META_KEY, // utils.js\n // circular reference observer depends on Ember.watch\n // we should move change events to this file or its own property_events.js\n notifyObservers = Ember.notifyObservers, // observer.js\n forEach = Ember.ArrayPolyfills.forEach, // array.js\n FIRST_KEY = /^([^\\.\\*]+)/,\n IS_PATH = /[\\.\\*]/;\n\nvar MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER,\no_defineProperty = Ember.platform.defineProperty;\n\n/** @private */\nfunction firstKey(path) {\n return path.match(FIRST_KEY)[0];\n}\n\n// returns true if the passed path is just a keyName\n/** @private */\nfunction isKeyName(path) {\n return path==='*' || !IS_PATH.test(path);\n}\n\n// ..........................................................\n// DEPENDENT KEYS\n//\n\nvar DEP_SKIP = { __emberproto__: true }; // skip some keys and toString\n\n/** @private */\nfunction iterDeps(method, obj, depKey, seen, meta) {\n\n var guid = guidFor(obj);\n if (!seen[guid]) seen[guid] = {};\n if (seen[guid][depKey]) return;\n seen[guid][depKey] = true;\n\n var deps = meta.deps;\n deps = deps && deps[depKey];\n if (deps) {\n for(var key in deps) {\n if (DEP_SKIP[key]) continue;\n method(obj, key);\n }\n }\n}\n\n\nvar WILL_SEEN, DID_SEEN;\n\n// called whenever a property is about to change to clear the cache of any dependent keys (and notify those properties of changes, etc...)\n/** @private */\nfunction dependentKeysWillChange(obj, depKey, meta) {\n if (obj.isDestroying) { return; }\n\n var seen = WILL_SEEN, top = !seen;\n if (top) { seen = WILL_SEEN = {}; }\n iterDeps(propertyWillChange, obj, depKey, seen, meta);\n if (top) { WILL_SEEN = null; }\n}\n\n// called whenever a property has just changed to update dependent keys\n/** @private */\nfunction dependentKeysDidChange(obj, depKey, meta) {\n if (obj.isDestroying) { return; }\n\n var seen = DID_SEEN, top = !seen;\n if (top) { seen = DID_SEEN = {}; }\n iterDeps(propertyDidChange, obj, depKey, seen, meta);\n if (top) { DID_SEEN = null; }\n}\n\n// ..........................................................\n// CHAIN\n//\n\n/** @private */\nfunction addChainWatcher(obj, keyName, node) {\n if (!obj || ('object' !== typeof obj)) return; // nothing to do\n var m = metaFor(obj);\n var nodes = m.chainWatchers;\n if (!nodes || nodes.__emberproto__ !== obj) {\n nodes = m.chainWatchers = { __emberproto__: obj };\n }\n\n if (!nodes[keyName]) { nodes[keyName] = {}; }\n nodes[keyName][guidFor(node)] = node;\n Ember.watch(obj, keyName);\n}\n\n/** @private */\nfunction removeChainWatcher(obj, keyName, node) {\n if (!obj || 'object' !== typeof obj) { return; } // nothing to do\n var m = metaFor(obj, false),\n nodes = m.chainWatchers;\n if (!nodes || nodes.__emberproto__ !== obj) { return; } //nothing to do\n if (nodes[keyName]) { delete nodes[keyName][guidFor(node)]; }\n Ember.unwatch(obj, keyName);\n}\n\nvar pendingQueue = [];\n\n// attempts to add the pendingQueue chains again. If some of them end up\n// back in the queue and reschedule is true, schedules a timeout to try\n// again.\n/** @private */\nfunction flushPendingChains() {\n if (pendingQueue.length === 0) { return; } // nothing to do\n\n var queue = pendingQueue;\n pendingQueue = [];\n\n forEach.call(queue, function(q) { q[0].add(q[1]); });\n\n Ember.warn('Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos', pendingQueue.length === 0);\n}\n\n/** @private */\nfunction isProto(pvalue) {\n return metaFor(pvalue, false).proto === pvalue;\n}\n\n// A ChainNode watches a single key on an object. If you provide a starting\n// value for the key then the node won't actually watch it. For a root node\n// pass null for parent and key and object for value.\n/** @private */\nvar ChainNode = function(parent, key, value, separator) {\n var obj;\n this._parent = parent;\n this._key = key;\n\n // _watching is true when calling get(this._parent, this._key) will\n // return the value of this node.\n //\n // It is false for the root of a chain (because we have no parent)\n // and for global paths (because the parent node is the object with\n // the observer on it)\n this._watching = value===undefined;\n\n this._value = value;\n this._separator = separator || '.';\n this._paths = {};\n if (this._watching) {\n this._object = parent.value();\n if (this._object) { addChainWatcher(this._object, this._key, this); }\n }\n\n // Special-case: the EachProxy relies on immediate evaluation to\n // establish its observers.\n //\n // TODO: Replace this with an efficient callback that the EachProxy\n // can implement.\n if (this._parent && this._parent._key === '@each') {\n this.value();\n }\n};\n\nvar ChainNodePrototype = ChainNode.prototype;\n\nChainNodePrototype.value = function() {\n if (this._value === undefined && this._watching) {\n var obj = this._parent.value();\n this._value = (obj && !isProto(obj)) ? get(obj, this._key) : undefined;\n }\n return this._value;\n};\n\nChainNodePrototype.destroy = function() {\n if (this._watching) {\n var obj = this._object;\n if (obj) { removeChainWatcher(obj, this._key, this); }\n this._watching = false; // so future calls do nothing\n }\n};\n\n// copies a top level object only\nChainNodePrototype.copy = function(obj) {\n var ret = new ChainNode(null, null, obj, this._separator),\n paths = this._paths, path;\n for (path in paths) {\n if (paths[path] <= 0) { continue; } // this check will also catch non-number vals.\n ret.add(path);\n }\n return ret;\n};\n\n// called on the root node of a chain to setup watchers on the specified\n// path.\nChainNodePrototype.add = function(path) {\n var obj, tuple, key, src, separator, paths;\n\n paths = this._paths;\n paths[path] = (paths[path] || 0) + 1;\n\n obj = this.value();\n tuple = normalizeTuple(obj, path);\n\n // the path was a local path\n if (tuple[0] && tuple[0] === obj) {\n path = tuple[1];\n key = firstKey(path);\n path = path.slice(key.length+1);\n\n // global path, but object does not exist yet.\n // put into a queue and try to connect later.\n } else if (!tuple[0]) {\n pendingQueue.push([this, path]);\n tuple.length = 0;\n return;\n\n // global path, and object already exists\n } else {\n src = tuple[0];\n key = path.slice(0, 0-(tuple[1].length+1));\n separator = path.slice(key.length, key.length+1);\n path = tuple[1];\n }\n\n tuple.length = 0;\n this.chain(key, path, src, separator);\n};\n\n// called on the root node of a chain to teardown watcher on the specified\n// path\nChainNodePrototype.remove = function(path) {\n var obj, tuple, key, src, paths;\n\n paths = this._paths;\n if (paths[path] > 0) { paths[path]--; }\n\n obj = this.value();\n tuple = normalizeTuple(obj, path);\n if (tuple[0] === obj) {\n path = tuple[1];\n key = firstKey(path);\n path = path.slice(key.length+1);\n } else {\n src = tuple[0];\n key = path.slice(0, 0-(tuple[1].length+1));\n path = tuple[1];\n }\n\n tuple.length = 0;\n this.unchain(key, path);\n};\n\nChainNodePrototype.count = 0;\n\nChainNodePrototype.chain = function(key, path, src, separator) {\n var chains = this._chains, node;\n if (!chains) { chains = this._chains = {}; }\n\n node = chains[key];\n if (!node) { node = chains[key] = new ChainNode(this, key, src, separator); }\n node.count++; // count chains...\n\n // chain rest of path if there is one\n if (path && path.length>0) {\n key = firstKey(path);\n path = path.slice(key.length+1);\n node.chain(key, path); // NOTE: no src means it will observe changes...\n }\n};\n\nChainNodePrototype.unchain = function(key, path) {\n var chains = this._chains, node = chains[key];\n\n // unchain rest of path first...\n if (path && path.length>1) {\n key = firstKey(path);\n path = path.slice(key.length+1);\n node.unchain(key, path);\n }\n\n // delete node if needed.\n node.count--;\n if (node.count<=0) {\n delete chains[node._key];\n node.destroy();\n }\n\n};\n\nChainNodePrototype.willChange = function() {\n var chains = this._chains;\n if (chains) {\n for(var key in chains) {\n if (!chains.hasOwnProperty(key)) { continue; }\n chains[key].willChange();\n }\n }\n\n if (this._parent) { this._parent.chainWillChange(this, this._key, 1); }\n};\n\nChainNodePrototype.chainWillChange = function(chain, path, depth) {\n if (this._key) { path = this._key + this._separator + path; }\n\n if (this._parent) {\n this._parent.chainWillChange(this, path, depth+1);\n } else {\n if (depth > 1) { Ember.propertyWillChange(this.value(), path); }\n path = 'this.' + path;\n if (this._paths[path] > 0) { Ember.propertyWillChange(this.value(), path); }\n }\n};\n\nChainNodePrototype.chainDidChange = function(chain, path, depth) {\n if (this._key) { path = this._key + this._separator + path; }\n if (this._parent) {\n this._parent.chainDidChange(this, path, depth+1);\n } else {\n if (depth > 1) { Ember.propertyDidChange(this.value(), path); }\n path = 'this.' + path;\n if (this._paths[path] > 0) { Ember.propertyDidChange(this.value(), path); }\n }\n};\n\nChainNodePrototype.didChange = function(suppressEvent) {\n // invalidate my own value first.\n if (this._watching) {\n var obj = this._parent.value();\n if (obj !== this._object) {\n removeChainWatcher(this._object, this._key, this);\n this._object = obj;\n addChainWatcher(obj, this._key, this);\n }\n this._value = undefined;\n\n // Special-case: the EachProxy relies on immediate evaluation to\n // establish its observers.\n if (this._parent && this._parent._key === '@each')\n this.value();\n }\n\n // then notify chains...\n var chains = this._chains;\n if (chains) {\n for(var key in chains) {\n if (!chains.hasOwnProperty(key)) { continue; }\n chains[key].didChange(suppressEvent);\n }\n }\n\n if (suppressEvent) { return; }\n\n // and finally tell parent about my path changing...\n if (this._parent) { this._parent.chainDidChange(this, this._key, 1); }\n};\n\n// get the chains for the current object. If the current object has\n// chains inherited from the proto they will be cloned and reconfigured for\n// the current object.\n/** @private */\nfunction chainsFor(obj) {\n var m = metaFor(obj), ret = m.chains;\n if (!ret) {\n ret = m.chains = new ChainNode(null, null, obj);\n } else if (ret.value() !== obj) {\n ret = m.chains = ret.copy(obj);\n }\n return ret;\n}\n\n/** @private */\nfunction notifyChains(obj, m, keyName, methodName, arg) {\n var nodes = m.chainWatchers;\n\n if (!nodes || nodes.__emberproto__ !== obj) { return; } // nothing to do\n\n nodes = nodes[keyName];\n if (!nodes) { return; }\n\n for(var key in nodes) {\n if (!nodes.hasOwnProperty(key)) { continue; }\n nodes[key][methodName](arg);\n }\n}\n\nEmber.overrideChains = function(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'didChange', true);\n};\n\n/** @private */\nfunction chainsWillChange(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'willChange');\n}\n\n/** @private */\nfunction chainsDidChange(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'didChange');\n}\n\n// ..........................................................\n// WATCH\n//\n\n/**\n @private\n\n Starts watching a property on an object. Whenever the property changes,\n invokes Ember.propertyWillChange and Ember.propertyDidChange. This is the\n primitive used by observers and dependent keys; usually you will never call\n this method directly but instead use higher level methods like\n Ember.addObserver().\n*/\nEmber.watch = function(obj, keyName) {\n // can't watch length on Array - it is special...\n if (keyName === 'length' && Ember.typeOf(obj) === 'array') { return this; }\n\n var m = metaFor(obj), watching = m.watching, desc;\n\n // activate watching first time\n if (!watching[keyName]) {\n watching[keyName] = 1;\n if (isKeyName(keyName)) {\n desc = m.descs[keyName];\n if (desc && desc.willWatch) { desc.willWatch(obj, keyName); }\n\n if ('function' === typeof obj.willWatchProperty) {\n obj.willWatchProperty(keyName);\n }\n\n if (MANDATORY_SETTER && keyName in obj) {\n m.values[keyName] = obj[keyName];\n o_defineProperty(obj, keyName, {\n configurable: true,\n enumerable: true,\n set: function() {\n Ember.assert('Must use Ember.set() to access this property', false);\n },\n get: function() {\n var meta = this[META_KEY];\n return meta && meta.values[keyName];\n }\n });\n }\n } else {\n chainsFor(obj).add(keyName);\n }\n\n } else {\n watching[keyName] = (watching[keyName] || 0) + 1;\n }\n return this;\n};\n\nEmber.isWatching = function isWatching(obj, key) {\n var meta = obj[META_KEY];\n return (meta && meta.watching[key]) > 0;\n};\n\nEmber.watch.flushPending = flushPendingChains;\n\n/** @private */\nEmber.unwatch = function(obj, keyName) {\n // can't watch length on Array - it is special...\n if (keyName === 'length' && Ember.typeOf(obj) === 'array') { return this; }\n\n var m = metaFor(obj), watching = m.watching, desc;\n\n if (watching[keyName] === 1) {\n watching[keyName] = 0;\n\n if (isKeyName(keyName)) {\n desc = m.descs[keyName];\n if (desc && desc.didUnwatch) { desc.didUnwatch(obj, keyName); }\n\n if ('function' === typeof obj.didUnwatchProperty) {\n obj.didUnwatchProperty(keyName);\n }\n\n if (MANDATORY_SETTER && keyName in obj) {\n o_defineProperty(obj, keyName, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: m.values[keyName]\n });\n delete m.values[keyName];\n }\n } else {\n chainsFor(obj).remove(keyName);\n }\n\n } else if (watching[keyName]>1) {\n watching[keyName]--;\n }\n\n return this;\n};\n\n/**\n @private\n\n Call on an object when you first beget it from another object. This will\n setup any chained watchers on the object instance as needed. This method is\n safe to call multiple times.\n*/\nEmber.rewatch = function(obj) {\n var m = metaFor(obj, false), chains = m.chains;\n\n // make sure the object has its own guid.\n if (GUID_KEY in obj && !obj.hasOwnProperty(GUID_KEY)) {\n Ember.generateGuid(obj, 'ember');\n }\n\n // make sure any chained watchers update.\n if (chains && chains.value() !== obj) {\n m.chains = chains.copy(obj);\n }\n\n return this;\n};\n\nEmber.finishChains = function(obj) {\n var m = metaFor(obj, false), chains = m.chains;\n if (chains) {\n if (chains.value() !== obj) {\n m.chains = chains = chains.copy(obj);\n }\n chains.didChange(true);\n }\n};\n\n// ..........................................................\n// PROPERTY CHANGES\n//\n\n/**\n This function is called just before an object property is about to change.\n It will notify any before observers and prepare caches among other things.\n\n Normally you will not need to call this method directly but if for some\n reason you can't directly watch a property you can invoke this method\n manually along with `Ember.propertyDidChange()` which you should call just\n after the property value changes.\n\n @memberOf Ember\n\n @param {Object} obj\n The object with the property that will change\n\n @param {String} keyName\n The property key (or path) that will change.\n\n @returns {void}\n*/\nfunction propertyWillChange(obj, keyName, value) {\n var m = metaFor(obj, false),\n watching = m.watching[keyName] > 0 || keyName === 'length',\n proto = m.proto,\n desc = m.descs[keyName];\n\n if (!watching) { return; }\n if (proto === obj) { return; }\n if (desc && desc.willChange) { desc.willChange(obj, keyName); }\n dependentKeysWillChange(obj, keyName, m);\n chainsWillChange(obj, keyName, m);\n Ember.notifyBeforeObservers(obj, keyName);\n}\n\nEmber.propertyWillChange = propertyWillChange;\n\n/**\n This function is called just after an object property has changed.\n It will notify any observers and clear caches among other things.\n\n Normally you will not need to call this method directly but if for some\n reason you can't directly watch a property you can invoke this method\n manually along with `Ember.propertyWilLChange()` which you should call just\n before the property value changes.\n\n @memberOf Ember\n\n @param {Object} obj\n The object with the property that will change\n\n @param {String} keyName\n The property key (or path) that will change.\n\n @returns {void}\n*/\nfunction propertyDidChange(obj, keyName) {\n var m = metaFor(obj, false),\n watching = m.watching[keyName] > 0 || keyName === 'length',\n proto = m.proto,\n desc = m.descs[keyName];\n\n if (proto === obj) { return; }\n\n // shouldn't this mean that we're watching this key?\n if (desc && desc.didChange) { desc.didChange(obj, keyName); }\n if (!watching && keyName !== 'length') { return; }\n\n dependentKeysDidChange(obj, keyName, m);\n chainsDidChange(obj, keyName, m);\n Ember.notifyObservers(obj, keyName);\n}\n\nEmber.propertyDidChange = propertyDidChange;\n\nvar NODE_STACK = [];\n\n/**\n Tears down the meta on an object so that it can be garbage collected.\n Multiple calls will have no effect.\n\n @param {Object} obj the object to destroy\n @returns {void}\n*/\nEmber.destroy = function (obj) {\n var meta = obj[META_KEY], node, nodes, key, nodeObject;\n if (meta) {\n obj[META_KEY] = null;\n // remove chainWatchers to remove circular references that would prevent GC\n node = meta.chains;\n if (node) {\n NODE_STACK.push(node);\n // process tree\n while (NODE_STACK.length > 0) {\n node = NODE_STACK.pop();\n // push children\n nodes = node._chains;\n if (nodes) {\n for (key in nodes) {\n if (nodes.hasOwnProperty(key)) {\n NODE_STACK.push(nodes[key]);\n }\n }\n }\n // remove chainWatcher in node object\n if (node._watching) {\n nodeObject = node._object;\n if (nodeObject) {\n removeChainWatcher(nodeObject, node._key, node);\n }\n }\n }\n }\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nEmber.warn(\"Computed properties will soon be cacheable by default. To enable this in your app, set `ENV.CP_DEFAULT_CACHEABLE = true`.\", Ember.CP_DEFAULT_CACHEABLE);\n\n\nvar get = Ember.get,\n metaFor = Ember.meta,\n guidFor = Ember.guidFor,\n a_slice = [].slice,\n o_create = Ember.create,\n META_KEY = Ember.META_KEY,\n watch = Ember.watch,\n unwatch = Ember.unwatch;\n\n// ..........................................................\n// DEPENDENT KEYS\n//\n\n// data structure:\n// meta.deps = {\n// 'depKey': {\n// 'keyName': count,\n// __emberproto__: SRC_OBJ [to detect clones]\n// },\n// __emberproto__: SRC_OBJ\n// }\n\n/**\n @private\n\n This function returns a map of unique dependencies for a\n given object and key.\n*/\nfunction keysForDep(obj, depsMeta, depKey) {\n var keys = depsMeta[depKey];\n if (!keys) {\n // if there are no dependencies yet for a the given key\n // create a new empty list of dependencies for the key\n keys = depsMeta[depKey] = { __emberproto__: obj };\n } else if (keys.__emberproto__ !== obj) {\n // otherwise if the dependency list is inherited from\n // a superclass, clone the hash\n keys = depsMeta[depKey] = o_create(keys);\n keys.__emberproto__ = obj;\n }\n return keys;\n}\n\n/**\n @private\n\n return obj[META_KEY].deps\n */\nfunction metaForDeps(obj, meta) {\n var deps = meta.deps;\n // If the current object has no dependencies...\n if (!deps) {\n // initialize the dependencies with a pointer back to\n // the current object\n deps = meta.deps = { __emberproto__: obj };\n } else if (deps.__emberproto__ !== obj) {\n // otherwise if the dependencies are inherited from the\n // object's superclass, clone the deps\n deps = meta.deps = o_create(deps);\n deps.__emberproto__ = obj;\n }\n return deps;\n}\n\n/** @private */\nfunction addDependentKeys(desc, obj, keyName, meta) {\n // the descriptor has a list of dependent keys, so\n // add all of its dependent keys.\n var depKeys = desc._dependentKeys, depsMeta, idx, len, depKey, keys;\n if (!depKeys) return;\n\n depsMeta = metaForDeps(obj, meta);\n\n for(idx = 0, len = depKeys.length; idx < len; idx++) {\n depKey = depKeys[idx];\n // Lookup keys meta for depKey\n keys = keysForDep(obj, depsMeta, depKey);\n // Increment the number of times depKey depends on keyName.\n keys[keyName] = (keys[keyName] || 0) + 1;\n // Watch the depKey\n watch(obj, depKey);\n }\n}\n\n/** @private */\nfunction removeDependentKeys(desc, obj, keyName, meta) {\n // the descriptor has a list of dependent keys, so\n // add all of its dependent keys.\n var depKeys = desc._dependentKeys, depsMeta, idx, len, depKey, keys;\n if (!depKeys) return;\n\n depsMeta = metaForDeps(obj, meta);\n\n for(idx = 0, len = depKeys.length; idx < len; idx++) {\n depKey = depKeys[idx];\n // Lookup keys meta for depKey\n keys = keysForDep(obj, depsMeta, depKey);\n // Increment the number of times depKey depends on keyName.\n keys[keyName] = (keys[keyName] || 0) - 1;\n // Watch the depKey\n unwatch(obj, depKey);\n }\n}\n\n// ..........................................................\n// COMPUTED PROPERTY\n//\n\n/** @private */\nfunction ComputedProperty(func, opts) {\n this.func = func;\n this._cacheable = (opts && opts.cacheable !== undefined) ? opts.cacheable : Ember.CP_DEFAULT_CACHEABLE;\n this._dependentKeys = opts && opts.dependentKeys;\n}\n\n/**\n @constructor\n*/\nEmber.ComputedProperty = ComputedProperty;\nComputedProperty.prototype = new Ember.Descriptor();\n\n/**\n @extends Ember.ComputedProperty\n @private\n*/\nvar ComputedPropertyPrototype = ComputedProperty.prototype;\n\n/**\n Call on a computed property to set it into cacheable mode. When in this\n mode the computed property will automatically cache the return value of\n your function until one of the dependent keys changes.\n\n MyApp.president = Ember.Object.create({\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // After calculating the value of this function, Ember.js will\n // return that value without re-executing this function until\n // one of the dependent properties change.\n }.property('firstName', 'lastName').cacheable()\n });\n\n Properties are cacheable by default.\n\n @name Ember.ComputedProperty.cacheable\n @param {Boolean} aFlag optional set to false to disable caching\n @returns {Ember.ComputedProperty} receiver\n*/\nComputedPropertyPrototype.cacheable = function(aFlag) {\n this._cacheable = aFlag !== false;\n return this;\n};\n\n/**\n Call on a computed property to set it into non-cached mode. When in this\n mode the computed property will not automatically cache the return value.\n\n MyApp.outsideService = Ember.Object.create({\n value: function() {\n return OutsideService.getValue();\n }.property().volatile()\n });\n\n @name Ember.ComputedProperty.volatile\n @returns {Ember.ComputedProperty} receiver\n*/\nComputedPropertyPrototype.volatile = function() {\n return this.cacheable(false);\n};\n\n/**\n Sets the dependent keys on this computed property. Pass any number of\n arguments containing key paths that this computed property depends on.\n\n MyApp.president = Ember.Object.create({\n fullName: Ember.computed(function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Tell Ember.js that this computed property depends on firstName\n // and lastName\n }).property('firstName', 'lastName')\n });\n\n @name Ember.ComputedProperty.property\n @param {String} path... zero or more property paths\n @returns {Ember.ComputedProperty} receiver\n*/\nComputedPropertyPrototype.property = function() {\n var args = [];\n for (var i = 0, l = arguments.length; i < l; i++) {\n args.push(arguments[i]);\n }\n this._dependentKeys = args;\n return this;\n};\n\n/**\n In some cases, you may want to annotate computed properties with additional\n metadata about how they function or what values they operate on. For example,\n computed property functions may close over variables that are then no longer\n available for introspection.\n\n You can pass a hash of these values to a computed property like this:\n\n person: function() {\n var personId = this.get('personId');\n return App.Person.create({ id: personId });\n }.property().meta({ type: App.Person })\n\n The hash that you pass to the `meta()` function will be saved on the\n computed property descriptor under the `_meta` key. Ember runtime\n exposes a public API for retrieving these values from classes,\n via the `metaForProperty()` function.\n\n @name Ember.ComputedProperty.meta\n @param {Hash} metadata\n @returns {Ember.ComputedProperty} property descriptor instance\n*/\n\nComputedPropertyPrototype.meta = function(meta) {\n this._meta = meta;\n return this;\n};\n\n/** @private - impl descriptor API */\nComputedPropertyPrototype.willWatch = function(obj, keyName) {\n // watch already creates meta for this instance\n var meta = obj[META_KEY];\n Ember.assert('watch should have setup meta to be writable', meta.source === obj);\n if (!(keyName in meta.cache)) {\n addDependentKeys(this, obj, keyName, meta);\n }\n};\n\nComputedPropertyPrototype.didUnwatch = function(obj, keyName) {\n var meta = obj[META_KEY];\n Ember.assert('unwatch should have setup meta to be writable', meta.source === obj);\n if (!(keyName in meta.cache)) {\n // unwatch already creates meta for this instance\n removeDependentKeys(this, obj, keyName, meta);\n }\n};\n\n/** @private - impl descriptor API */\nComputedPropertyPrototype.didChange = function(obj, keyName) {\n // _suspended is set via a CP.set to ensure we don't clear\n // the cached value set by the setter\n if (this._cacheable && this._suspended !== obj) {\n var meta = metaFor(obj);\n if (keyName in meta.cache) {\n delete meta.cache[keyName];\n if (!meta.watching[keyName]) {\n removeDependentKeys(this, obj, keyName, meta);\n }\n }\n }\n};\n\n/** @private - impl descriptor API */\nComputedPropertyPrototype.get = function(obj, keyName) {\n var ret, cache, meta;\n if (this._cacheable) {\n meta = metaFor(obj);\n cache = meta.cache;\n if (keyName in cache) { return cache[keyName]; }\n ret = cache[keyName] = this.func.call(obj, keyName);\n if (!meta.watching[keyName]) {\n addDependentKeys(this, obj, keyName, meta);\n }\n } else {\n ret = this.func.call(obj, keyName);\n }\n return ret;\n};\n\n/** @private - impl descriptor API */\nComputedPropertyPrototype.set = function(obj, keyName, value) {\n var cacheable = this._cacheable,\n meta = metaFor(obj, cacheable),\n watched = meta.watching[keyName],\n oldSuspended = this._suspended,\n hadCachedValue,\n ret;\n\n this._suspended = obj;\n\n if (watched) { Ember.propertyWillChange(obj, keyName); }\n if (cacheable) {\n if (keyName in meta.cache) {\n delete meta.cache[keyName];\n hadCachedValue = true;\n }\n }\n ret = this.func.call(obj, keyName, value);\n if (cacheable) {\n if (!watched && !hadCachedValue) {\n addDependentKeys(this, obj, keyName, meta);\n }\n meta.cache[keyName] = ret;\n }\n if (watched) { Ember.propertyDidChange(obj, keyName); }\n this._suspended = oldSuspended;\n return ret;\n};\n\n/** @private - called when property is defined */\nComputedPropertyPrototype.setup = function(obj, keyName) {\n var meta = obj[META_KEY];\n if (meta && meta.watching[keyName]) {\n addDependentKeys(this, obj, keyName, metaFor(obj));\n }\n};\n\n/** @private - called before property is overridden */\nComputedPropertyPrototype.teardown = function(obj, keyName) {\n var meta = metaFor(obj);\n\n if (meta.watching[keyName] || keyName in meta.cache) {\n removeDependentKeys(this, obj, keyName, meta);\n }\n\n if (this._cacheable) { delete meta.cache[keyName]; }\n\n return null; // no value to restore\n};\n\n/**\n This helper returns a new property descriptor that wraps the passed\n computed property function. You can use this helper to define properties\n with mixins or via Ember.defineProperty().\n\n The function you pass will be used to both get and set property values.\n The function should accept two parameters, key and value. If value is not\n undefined you should set the value first. In either case return the\n current value of the property.\n\n @param {Function} func\n The computed property function.\n\n @returns {Ember.ComputedProperty} property descriptor instance\n*/\nEmber.computed = function(func) {\n var args;\n\n if (arguments.length > 1) {\n args = a_slice.call(arguments, 0, -1);\n func = a_slice.call(arguments, -1)[0];\n }\n\n var cp = new ComputedProperty(func);\n\n if (args) {\n cp.property.apply(cp, args);\n }\n\n return cp;\n};\n\n/**\n Returns the cached value for a property, if one exists.\n This can be useful for peeking at the value of a computed\n property that is generated lazily, without accidentally causing\n it to be created.\n\n @param {Object} obj the object whose property you want to check\n @param {String} key the name of the property whose cached value you want\n to return\n\n*/\nEmber.cacheFor = function cacheFor(obj, key) {\n var cache = metaFor(obj, false).cache;\n\n if (cache && key in cache) {\n return cache[key];\n }\n};\n\nEmber.computed.not = function(dependentKey) {\n return Ember.computed(dependentKey, function(key) {\n return !get(this, dependentKey);\n }).cacheable();\n};\n\nEmber.computed.empty = function(dependentKey) {\n return Ember.computed(dependentKey, function(key) {\n var val = get(this, dependentKey);\n return val === undefined || val === null || val === '' || (Ember.isArray(val) && get(val, 'length') === 0);\n }).cacheable();\n};\n\nEmber.computed.bool = function(dependentKey) {\n return Ember.computed(dependentKey, function(key) {\n return !!get(this, dependentKey);\n }).cacheable();\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar o_create = Ember.create,\n meta = Ember.meta,\n metaPath = Ember.metaPath,\n guidFor = Ember.guidFor,\n a_slice = [].slice;\n\n/**\n The event system uses a series of nested hashes to store listeners on an\n object. When a listener is registered, or when an event arrives, these\n hashes are consulted to determine which target and action pair to invoke.\n\n The hashes are stored in the object's meta hash, and look like this:\n\n // Object's meta hash\n {\n listeners: { // variable name: `listenerSet`\n \"foo:changed\": { // variable name: `targetSet`\n [targetGuid]: { // variable name: `actionSet`\n [methodGuid]: { // variable name: `action`\n target: [Object object],\n method: [Function function]\n }\n }\n }\n }\n }\n\n*/\n\n// Gets the set of all actions, keyed on the guid of each action's\n// method property.\n/** @private */\nfunction actionSetFor(obj, eventName, target, writable) {\n return metaPath(obj, ['listeners', eventName, guidFor(target)], writable);\n}\n\n// Gets the set of all targets, keyed on the guid of each action's\n// target property.\n/** @private */\nfunction targetSetFor(obj, eventName) {\n var listenerSet = meta(obj, false).listeners;\n if (!listenerSet) { return false; }\n\n return listenerSet[eventName] || false;\n}\n\n// TODO: This knowledge should really be a part of the\n// meta system.\nvar SKIP_PROPERTIES = { __ember_source__: true };\n\n/** @private */\nfunction iterateSet(obj, eventName, callback, params) {\n var targetSet = targetSetFor(obj, eventName);\n if (!targetSet) { return false; }\n // Iterate through all elements of the target set\n for(var targetGuid in targetSet) {\n if (SKIP_PROPERTIES[targetGuid]) { continue; }\n\n var actionSet = targetSet[targetGuid];\n if (actionSet) {\n // Iterate through the elements of the action set\n for(var methodGuid in actionSet) {\n if (SKIP_PROPERTIES[methodGuid]) { continue; }\n\n var action = actionSet[methodGuid];\n if (action) {\n if (callback(action, params, obj) === true) {\n return true;\n }\n }\n }\n }\n }\n return false;\n}\n\n/** @private */\nfunction invokeAction(action, params, sender) {\n var method = action.method, target = action.target;\n // If there is no target, the target is the object\n // on which the event was fired.\n if (!target) { target = sender; }\n if ('string' === typeof method) { method = target[method]; }\n if (params) {\n method.apply(target, params);\n } else {\n method.apply(target);\n }\n}\n\n/**\n The sendEvent arguments > 2 are passed to an event listener.\n\n @memberOf Ember\n*/\nfunction addListener(obj, eventName, target, method) {\n Ember.assert(\"You must pass at least an object and event name to Ember.addListener\", !!obj && !!eventName);\n\n if (!method && 'function' === typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method);\n\n if (!actionSet[methodGuid]) {\n actionSet[methodGuid] = { target: target, method: method };\n }\n\n if ('function' === typeof obj.didAddListener) {\n obj.didAddListener(eventName, target, method);\n }\n}\n\n/** @memberOf Ember */\nfunction removeListener(obj, eventName, target, method) {\n Ember.assert(\"You must pass at least an object and event name to Ember.removeListener\", !!obj && !!eventName);\n\n if (!method && 'function' === typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method);\n\n // we can't simply delete this parameter, because if we do, we might\n // re-expose the property from the prototype chain.\n if (actionSet && actionSet[methodGuid]) { actionSet[methodGuid] = null; }\n\n if ('function' === typeof obj.didRemoveListener) {\n obj.didRemoveListener(eventName, target, method);\n }\n}\n\n// Suspend listener during callback.\n//\n// This should only be used by the target of the event listener\n// when it is taking an action that would cause the event, e.g.\n// an object might suspend its property change listener while it is\n// setting that property.\n/** @private */\nfunction suspendListener(obj, eventName, target, method, callback) {\n if (!method && 'function' === typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method),\n action = actionSet && actionSet[methodGuid];\n\n actionSet[methodGuid] = null;\n try {\n return callback.call(target);\n } finally {\n actionSet[methodGuid] = action;\n }\n}\n\n// returns a list of currently watched events\n/** @memberOf Ember */\nfunction watchedEvents(obj) {\n var listeners = meta(obj, false).listeners, ret = [];\n\n if (listeners) {\n for(var eventName in listeners) {\n if (!SKIP_PROPERTIES[eventName] && listeners[eventName]) {\n ret.push(eventName);\n }\n }\n }\n return ret;\n}\n\n/** @memberOf Ember */\nfunction sendEvent(obj, eventName, params) {\n // first give object a chance to handle it\n if (obj !== Ember && 'function' === typeof obj.sendEvent) {\n obj.sendEvent(eventName, params);\n }\n\n iterateSet(obj, eventName, invokeAction, params);\n return true;\n}\n\n/** @memberOf Ember */\nfunction deferEvent(obj, eventName, params) {\n var actions = [];\n iterateSet(obj, eventName, function (action) {\n actions.push(action);\n });\n\n return function() {\n if (obj.isDestroyed) { return; }\n\n if (obj !== Ember && 'function' === typeof obj.sendEvent) {\n obj.sendEvent(eventName, params);\n }\n\n for (var i=0, len=actions.length; i < len; ++i) {\n invokeAction(actions[i], params, obj);\n }\n };\n}\n\n/** @memberOf Ember */\nfunction hasListeners(obj, eventName) {\n if (iterateSet(obj, eventName, function() { return true; })) {\n return true;\n }\n\n // no listeners! might as well clean this up so it is faster later.\n var set = metaPath(obj, ['listeners'], true);\n set[eventName] = null;\n\n return false;\n}\n\n/** @memberOf Ember */\nfunction listenersFor(obj, eventName) {\n var ret = [];\n iterateSet(obj, eventName, function (action) {\n ret.push([action.target, action.method]);\n });\n return ret;\n}\n\nEmber.addListener = addListener;\nEmber.removeListener = removeListener;\nEmber._suspendListener = suspendListener;\nEmber.sendEvent = sendEvent;\nEmber.hasListeners = hasListeners;\nEmber.watchedEvents = watchedEvents;\nEmber.listenersFor = listenersFor;\nEmber.deferEvent = deferEvent;\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// Ember.Logger\n// Ember.watch.flushPending\n// Ember.beginPropertyChanges, Ember.endPropertyChanges\n// Ember.guidFor\n\n// ..........................................................\n// HELPERS\n//\n\nvar slice = [].slice,\n forEach = Ember.ArrayPolyfills.forEach;\n\n// invokes passed params - normalizing so you can pass target/func,\n// target/string or just func\n/** @private */\nfunction invoke(target, method, args, ignore) {\n\n if (method === undefined) {\n method = target;\n target = undefined;\n }\n\n if ('string' === typeof method) { method = target[method]; }\n if (args && ignore > 0) {\n args = args.length > ignore ? slice.call(args, ignore) : null;\n }\n\n // Unfortunately in some browsers we lose the backtrace if we rethrow the existing error,\n // so in the event that we don't have an `onerror` handler we don't wrap in a try/catch\n if ('function' === typeof Ember.onerror) {\n try {\n // IE8's Function.prototype.apply doesn't accept undefined/null arguments.\n return method.apply(target || this, args || []);\n } catch (error) {\n Ember.onerror(error);\n }\n } else {\n // IE8's Function.prototype.apply doesn't accept undefined/null arguments.\n return method.apply(target || this, args || []);\n }\n}\n\n\n// ..........................................................\n// RUNLOOP\n//\n\nvar timerMark; // used by timers...\n\n/** @private */\nvar RunLoop = function(prev) {\n this._prev = prev || null;\n this.onceTimers = {};\n};\n\nRunLoop.prototype = {\n end: function() {\n this.flush();\n },\n\n prev: function() {\n return this._prev;\n },\n\n // ..........................................................\n // Delayed Actions\n //\n\n schedule: function(queueName, target, method) {\n var queues = this._queues, queue;\n if (!queues) { queues = this._queues = {}; }\n queue = queues[queueName];\n if (!queue) { queue = queues[queueName] = []; }\n\n var args = arguments.length > 3 ? slice.call(arguments, 3) : null;\n queue.push({ target: target, method: method, args: args });\n return this;\n },\n\n flush: function(queueName) {\n var queueNames, idx, len, queue, log;\n\n if (!this._queues) { return this; } // nothing to do\n\n function iter(item) {\n invoke(item.target, item.method, item.args);\n }\n\n Ember.watch.flushPending(); // make sure all chained watchers are setup\n\n if (queueName) {\n while (this._queues && (queue = this._queues[queueName])) {\n this._queues[queueName] = null;\n\n // the sync phase is to allow property changes to propagate. don't\n // invoke observers until that is finished.\n if (queueName === 'sync') {\n log = Ember.LOG_BINDINGS;\n if (log) { Ember.Logger.log('Begin: Flush Sync Queue'); }\n\n Ember.beginPropertyChanges();\n try {\n forEach.call(queue, iter);\n } finally {\n Ember.endPropertyChanges();\n }\n\n if (log) { Ember.Logger.log('End: Flush Sync Queue'); }\n\n } else {\n forEach.call(queue, iter);\n }\n }\n\n } else {\n queueNames = Ember.run.queues;\n len = queueNames.length;\n idx = 0;\n\n outerloop:\n while (idx < len) {\n queueName = queueNames[idx];\n queue = this._queues && this._queues[queueName];\n delete this._queues[queueName];\n\n if (queue) {\n // the sync phase is to allow property changes to propagate. don't\n // invoke observers until that is finished.\n if (queueName === 'sync') {\n log = Ember.LOG_BINDINGS;\n if (log) { Ember.Logger.log('Begin: Flush Sync Queue'); }\n\n Ember.beginPropertyChanges();\n try {\n forEach.call(queue, iter);\n } finally {\n Ember.endPropertyChanges();\n }\n\n if (log) { Ember.Logger.log('End: Flush Sync Queue'); }\n } else {\n forEach.call(queue, iter);\n }\n }\n\n // Loop through prior queues\n for (var i = 0; i <= idx; i++) {\n if (this._queues && this._queues[queueNames[i]]) {\n // Start over at the first queue with contents\n idx = i;\n continue outerloop;\n }\n }\n\n idx++;\n }\n }\n\n timerMark = null;\n\n return this;\n }\n\n};\n\nEmber.RunLoop = RunLoop;\n\n// ..........................................................\n// Ember.run - this is ideally the only public API the dev sees\n//\n/**\n* @namespace Ember.run is both a function and a namespace for\n* RunLoop-related functions.\n* @name Ember.run\n*/\n\n/**\n Runs the passed target and method inside of a RunLoop, ensuring any\n deferred actions including bindings and views updates are flushed at the\n end.\n\n Normally you should not need to invoke this method yourself. However if\n you are implementing raw event handlers when interfacing with other\n libraries or plugins, you should probably wrap all of your code inside this\n call.\n\n Ember.run(function(){\n // code to be execute within a RunLoop \n });\n\n @name run\n @methodOf Ember.run\n @param {Object} target\n (Optional) target of method to call\n\n @param {Function|String} method\n Method to invoke. May be a function or a string. If you pass a string\n then it will be looked up on the passed target.\n\n @param {Object...} args\n Any additional arguments you wish to pass to the method.\n\n @returns {Object} return value from invoking the passed function.\n*/\nEmber.run = function(target, method) {\n var ret, loop;\n run.begin();\n try {\n if (target || method) { ret = invoke(target, method, arguments, 2); }\n } finally {\n run.end();\n }\n return ret;\n};\n\n/** @private */\nvar run = Ember.run;\n\n\n/**\n Begins a new RunLoop. Any deferred actions invoked after the begin will\n be buffered until you invoke a matching call to Ember.run.end(). This is\n an lower-level way to use a RunLoop instead of using Ember.run().\n\n Ember.run.begin();\n // code to be execute within a RunLoop \n Ember.run.end();\n\n\n @returns {void}\n*/\nEmber.run.begin = function() {\n run.currentRunLoop = new RunLoop(run.currentRunLoop);\n};\n\n/**\n Ends a RunLoop. This must be called sometime after you call Ember.run.begin()\n to flush any deferred actions. This is a lower-level way to use a RunLoop\n instead of using Ember.run().\n\n Ember.run.begin();\n // code to be execute within a RunLoop \n Ember.run.end();\n\n @returns {void}\n*/\nEmber.run.end = function() {\n Ember.assert('must have a current run loop', run.currentRunLoop);\n try {\n run.currentRunLoop.end();\n }\n finally {\n run.currentRunLoop = run.currentRunLoop.prev();\n }\n};\n\n/**\n Array of named queues. This array determines the order in which queues\n are flushed at the end of the RunLoop. You can define your own queues by\n simply adding the queue name to this array. Normally you should not need\n to inspect or modify this property.\n\n @type Array\n @default ['sync', 'actions', 'destroy', 'timers']\n*/\nEmber.run.queues = ['sync', 'actions', 'destroy', 'timers'];\n\n/**\n Adds the passed target/method and any optional arguments to the named\n queue to be executed at the end of the RunLoop. If you have not already\n started a RunLoop when calling this method one will be started for you\n automatically.\n\n At the end of a RunLoop, any methods scheduled in this way will be invoked.\n Methods will be invoked in an order matching the named queues defined in\n the run.queues property.\n\n Ember.run.schedule('timers', this, function(){\n // this will be executed at the end of the RunLoop, when timers are run\n console.log(\"scheduled on timers queue\");\n });\n Ember.run.schedule('sync', this, function(){\n // this will be executed at the end of the RunLoop, when bindings are synced\n console.log(\"scheduled on sync queue\");\n });\n // Note the functions will be run in order based on the run queues order. Output would be:\n // scheduled on sync queue\n // scheduled on timers queue\n\n @param {String} queue\n The name of the queue to schedule against. Default queues are 'sync' and\n 'actions'\n\n @param {Object} target\n (Optional) target object to use as the context when invoking a method.\n\n @param {String|Function} method\n The method to invoke. If you pass a string it will be resolved on the\n target object at the time the scheduled item is invoked allowing you to\n change the target function.\n\n @param {Object} arguments...\n Optional arguments to be passed to the queued method.\n\n @returns {void}\n*/\nEmber.run.schedule = function(queue, target, method) {\n var loop = run.autorun();\n loop.schedule.apply(loop, arguments);\n};\n\nvar scheduledAutorun;\n/** @private */\nfunction autorun() {\n scheduledAutorun = null;\n if (run.currentRunLoop) { run.end(); }\n}\n\n// Used by global test teardown\n/** @private */\nEmber.run.hasScheduledTimers = function() {\n return !!(scheduledAutorun || scheduledLater || scheduledNext);\n};\n\n// Used by global test teardown\n/** @private */\nEmber.run.cancelTimers = function () {\n if (scheduledAutorun) {\n clearTimeout(scheduledAutorun);\n scheduledAutorun = null;\n }\n if (scheduledLater) {\n clearTimeout(scheduledLater);\n scheduledLater = null;\n }\n if (scheduledNext) {\n clearTimeout(scheduledNext);\n scheduledNext = null;\n }\n timers = {};\n};\n\n/**\n Begins a new RunLoop if necessary and schedules a timer to flush the\n RunLoop at a later time. This method is used by parts of Ember to\n ensure the RunLoop always finishes. You normally do not need to call this\n method directly. Instead use Ember.run().\n\n Ember.run.autorun();\n\n @returns {Ember.RunLoop} the new current RunLoop\n*/\nEmber.run.autorun = function() {\n if (!run.currentRunLoop) {\n Ember.assert(\"You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run\", !Ember.testing);\n\n run.begin();\n\n if (!scheduledAutorun) {\n scheduledAutorun = setTimeout(autorun, 1);\n }\n }\n\n return run.currentRunLoop;\n};\n\n/**\n Immediately flushes any events scheduled in the 'sync' queue. Bindings\n use this queue so this method is a useful way to immediately force all\n bindings in the application to sync.\n\n You should call this method anytime you need any changed state to propagate\n throughout the app immediately without repainting the UI.\n\n Ember.run.sync();\n\n @returns {void}\n*/\nEmber.run.sync = function() {\n run.autorun();\n run.currentRunLoop.flush('sync');\n};\n\n// ..........................................................\n// TIMERS\n//\n\nvar timers = {}; // active timers...\n\nvar scheduledLater;\n/** @private */\nfunction invokeLaterTimers() {\n scheduledLater = null;\n var now = (+ new Date()), earliest = -1;\n for (var key in timers) {\n if (!timers.hasOwnProperty(key)) { continue; }\n var timer = timers[key];\n if (timer && timer.expires) {\n if (now >= timer.expires) {\n delete timers[key];\n invoke(timer.target, timer.method, timer.args, 2);\n } else {\n if (earliest<0 || (timer.expires < earliest)) earliest=timer.expires;\n }\n }\n }\n\n // schedule next timeout to fire...\n if (earliest > 0) { scheduledLater = setTimeout(invokeLaterTimers, earliest-(+ new Date())); }\n}\n\n/**\n Invokes the passed target/method and optional arguments after a specified\n period if time. The last parameter of this method must always be a number\n of milliseconds.\n\n You should use this method whenever you need to run some action after a\n period of time instead of using setTimeout(). This method will ensure that\n items that expire during the same script execution cycle all execute\n together, which is often more efficient than using a real setTimeout.\n\n Ember.run.later(myContext, function(){\n // code here will execute within a RunLoop in about 500ms with this == myContext\n }, 500);\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n @param {Number} wait\n Number of milliseconds to wait.\n\n @returns {String} a string you can use to cancel the timer in Ember.run.cancel() later.\n*/\nEmber.run.later = function(target, method) {\n var args, expires, timer, guid, wait;\n\n // setTimeout compatibility...\n if (arguments.length===2 && 'function' === typeof target) {\n wait = method;\n method = target;\n target = undefined;\n args = [target, method];\n } else {\n args = slice.call(arguments);\n wait = args.pop();\n }\n\n expires = (+ new Date()) + wait;\n timer = { target: target, method: method, expires: expires, args: args };\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n run.once(timers, invokeLaterTimers);\n return guid;\n};\n\n/** @private */\nfunction invokeOnceTimer(guid, onceTimers) {\n if (onceTimers[this.tguid]) { delete onceTimers[this.tguid][this.mguid]; }\n if (timers[guid]) { invoke(this.target, this.method, this.args, 2); }\n delete timers[guid];\n}\n\n/**\n Schedules an item to run one time during the current RunLoop. Calling\n this method with the same target/method combination will have no effect.\n\n Note that although you can pass optional arguments these will not be\n considered when looking for duplicates. New arguments will replace previous\n calls.\n\n Ember.run(function(){\n var doFoo = function() { foo(); }\n Ember.run.once(myContext, doFoo);\n Ember.run.once(myContext, doFoo);\n // doFoo will only be executed once at the end of the RunLoop\n });\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n\n @returns {Object} timer\n*/\nEmber.run.once = function(target, method) {\n var tguid = Ember.guidFor(target),\n mguid = Ember.guidFor(method),\n onceTimers = run.autorun().onceTimers,\n guid = onceTimers[tguid] && onceTimers[tguid][mguid],\n timer;\n\n if (guid && timers[guid]) {\n timers[guid].args = slice.call(arguments); // replace args\n } else {\n timer = {\n target: target,\n method: method,\n args: slice.call(arguments),\n tguid: tguid,\n mguid: mguid\n };\n\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n if (!onceTimers[tguid]) { onceTimers[tguid] = {}; }\n onceTimers[tguid][mguid] = guid; // so it isn't scheduled more than once\n\n run.schedule('actions', timer, invokeOnceTimer, guid, onceTimers);\n }\n\n return guid;\n};\n\nvar scheduledNext;\n/** @private */\nfunction invokeNextTimers() {\n scheduledNext = null;\n for(var key in timers) {\n if (!timers.hasOwnProperty(key)) { continue; }\n var timer = timers[key];\n if (timer.next) {\n delete timers[key];\n invoke(timer.target, timer.method, timer.args, 2);\n }\n }\n}\n\n/**\n Schedules an item to run after control has been returned to the system.\n This is often equivalent to calling setTimeout(function...,1).\n\n Ember.run.next(myContext, function(){\n // code to be executed in the next RunLoop, which will be scheduled after the current one\n });\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n @returns {Object} timer\n*/\nEmber.run.next = function(target, method) {\n var guid,\n timer = {\n target: target,\n method: method,\n args: slice.call(arguments),\n next: true\n };\n\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n\n if (!scheduledNext) { scheduledNext = setTimeout(invokeNextTimers, 1); }\n return guid;\n};\n\n/**\n Cancels a scheduled item. Must be a value returned by `Ember.run.later()`,\n `Ember.run.once()`, or `Ember.run.next()`.\n\n var runNext = Ember.run.next(myContext, function(){\n // will not be executed\n });\n Ember.run.cancel(runNext);\n\n var runLater = Ember.run.later(myContext, function(){\n // will not be executed\n }, 500);\n Ember.run.cancel(runLater);\n\n var runOnce = Ember.run.once(myContext, function(){\n // will not be executed\n });\n Ember.run.cancel(runOnce);\n\n @param {Object} timer\n Timer object to cancel\n\n @returns {void}\n*/\nEmber.run.cancel = function(timer) {\n delete timers[timer];\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// Ember.Logger\n// get, set, trySet\n// guidFor, isArray, meta\n// addObserver, removeObserver\n// Ember.run.schedule\n// ..........................................................\n// CONSTANTS\n//\n\n/**\n @static\n\n Debug parameter you can turn on. This will log all bindings that fire to\n the console. This should be disabled in production code. Note that you\n can also enable this from the console or temporarily.\n\n @type Boolean\n @default false\n*/\nEmber.LOG_BINDINGS = false || !!Ember.ENV.LOG_BINDINGS;\n\nvar get = Ember.get,\n set = Ember.set,\n guidFor = Ember.guidFor,\n isGlobalPath = Ember.isGlobalPath;\n\n\n/** @private */\nfunction getWithGlobals(obj, path) {\n return get(isGlobalPath(path) ? window : obj, path);\n}\n\n// ..........................................................\n// BINDING\n//\n\n/** @private */\nvar Binding = function(toPath, fromPath) {\n this._direction = 'fwd';\n this._from = fromPath;\n this._to = toPath;\n this._directionMap = Ember.Map.create();\n};\n\nBinding.prototype = /** @scope Ember.Binding.prototype */ {\n /**\n This copies the Binding so it can be connected to another object.\n @returns {Ember.Binding}\n */\n copy: function () {\n var copy = new Binding(this._to, this._from);\n if (this._oneWay) { copy._oneWay = true; }\n return copy;\n },\n\n // ..........................................................\n // CONFIG\n //\n\n /**\n This will set \"from\" property path to the specified value. It will not\n attempt to resolve this property path to an actual object until you\n connect the binding.\n\n The binding will search for the property path starting at the root object\n you pass when you connect() the binding. It follows the same rules as\n `get()` - see that method for more information.\n\n @param {String} propertyPath the property path to connect to\n @returns {Ember.Binding} receiver\n */\n from: function(path) {\n this._from = path;\n return this;\n },\n\n /**\n This will set the \"to\" property path to the specified value. It will not\n attempt to resolve this property path to an actual object until you\n connect the binding.\n\n The binding will search for the property path starting at the root object\n you pass when you connect() the binding. It follows the same rules as\n `get()` - see that method for more information.\n\n @param {String|Tuple} propertyPath A property path or tuple\n @returns {Ember.Binding} this\n */\n to: function(path) {\n this._to = path;\n return this;\n },\n\n /**\n Configures the binding as one way. A one-way binding will relay changes\n on the \"from\" side to the \"to\" side, but not the other way around. This\n means that if you change the \"to\" side directly, the \"from\" side may have\n a different value.\n\n @returns {Ember.Binding} receiver\n */\n oneWay: function() {\n this._oneWay = true;\n return this;\n },\n\n /** @private */\n toString: function() {\n var oneWay = this._oneWay ? '[oneWay]' : '';\n return \"Ember.Binding<\" + guidFor(this) + \">(\" + this._from + \" -> \" + this._to + \")\" + oneWay;\n },\n\n // ..........................................................\n // CONNECT AND SYNC\n //\n\n /**\n Attempts to connect this binding instance so that it can receive and relay\n changes. This method will raise an exception if you have not set the\n from/to properties yet.\n\n @param {Object} obj The root object for this binding.\n @returns {Ember.Binding} this\n */\n connect: function(obj) {\n Ember.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);\n\n var fromPath = this._from, toPath = this._to;\n Ember.trySet(obj, toPath, getWithGlobals(obj, fromPath));\n\n // add an observer on the object to be notified when the binding should be updated\n Ember.addObserver(obj, fromPath, this, this.fromDidChange);\n\n // if the binding is a two-way binding, also set up an observer on the target\n if (!this._oneWay) { Ember.addObserver(obj, toPath, this, this.toDidChange); }\n\n this._readyToSync = true;\n\n return this;\n },\n\n /**\n Disconnects the binding instance. Changes will no longer be relayed. You\n will not usually need to call this method.\n\n @param {Object} obj\n The root object you passed when connecting the binding.\n\n @returns {Ember.Binding} this\n */\n disconnect: function(obj) {\n Ember.assert('Must pass a valid object to Ember.Binding.disconnect()', !!obj);\n\n var twoWay = !this._oneWay;\n\n // remove an observer on the object so we're no longer notified of\n // changes that should update bindings.\n Ember.removeObserver(obj, this._from, this, this.fromDidChange);\n\n // if the binding is two-way, remove the observer from the target as well\n if (twoWay) { Ember.removeObserver(obj, this._to, this, this.toDidChange); }\n\n this._readyToSync = false; // disable scheduled syncs...\n return this;\n },\n\n // ..........................................................\n // PRIVATE\n //\n\n /** @private - called when the from side changes */\n fromDidChange: function(target) {\n this._scheduleSync(target, 'fwd');\n },\n\n /** @private - called when the to side changes */\n toDidChange: function(target) {\n this._scheduleSync(target, 'back');\n },\n\n /** @private */\n _scheduleSync: function(obj, dir) {\n var directionMap = this._directionMap;\n var existingDir = directionMap.get(obj);\n\n // if we haven't scheduled the binding yet, schedule it\n if (!existingDir) {\n Ember.run.schedule('sync', this, this._sync, obj);\n directionMap.set(obj, dir);\n }\n\n // If both a 'back' and 'fwd' sync have been scheduled on the same object,\n // default to a 'fwd' sync so that it remains deterministic.\n if (existingDir === 'back' && dir === 'fwd') {\n directionMap.set(obj, 'fwd');\n }\n },\n\n /** @private */\n _sync: function(obj) {\n var log = Ember.LOG_BINDINGS;\n\n // don't synchronize destroyed objects or disconnected bindings\n if (obj.isDestroyed || !this._readyToSync) { return; }\n\n // get the direction of the binding for the object we are\n // synchronizing from\n var directionMap = this._directionMap;\n var direction = directionMap.get(obj);\n\n var fromPath = this._from, toPath = this._to;\n\n directionMap.remove(obj);\n\n // if we're synchronizing from the remote object...\n if (direction === 'fwd') {\n var fromValue = getWithGlobals(obj, this._from);\n if (log) {\n Ember.Logger.log(' ', this.toString(), '->', fromValue, obj);\n }\n if (this._oneWay) {\n Ember.trySet(obj, toPath, fromValue);\n } else {\n Ember._suspendObserver(obj, toPath, this, this.toDidChange, function () {\n Ember.trySet(obj, toPath, fromValue);\n });\n }\n // if we're synchronizing *to* the remote object\n } else if (direction === 'back') {\n var toValue = get(obj, this._to);\n if (log) {\n Ember.Logger.log(' ', this.toString(), '<-', toValue, obj);\n }\n Ember._suspendObserver(obj, fromPath, this, this.fromDidChange, function () {\n Ember.trySet(Ember.isGlobalPath(fromPath) ? window : obj, fromPath, toValue);\n });\n }\n }\n\n};\n\n/** @private */\nfunction mixinProperties(to, from) {\n for (var key in from) {\n if (from.hasOwnProperty(key)) {\n to[key] = from[key];\n }\n }\n}\n\nmixinProperties(Binding,\n/** @scope Ember.Binding */ {\n\n /**\n @see Ember.Binding.prototype.from\n */\n from: function() {\n var C = this, binding = new C();\n return binding.from.apply(binding, arguments);\n },\n\n /**\n @see Ember.Binding.prototype.to\n */\n to: function() {\n var C = this, binding = new C();\n return binding.to.apply(binding, arguments);\n },\n\n /**\n Creates a new Binding instance and makes it apply in a single direction.\n A one-way binding will relay changes on the \"from\" side object (supplies\n as the `from` argument) the \"to\" side, but not the other way around.\n This means that if you change the \"to\" side directly, the \"from\" side may have\n a different value.\n\n @param {String} from from path.\n @param {Boolean} [flag] (Optional) passing nothing here will make the binding oneWay. You can\n instead pass false to disable oneWay, making the binding two way again.\n\n @see Ember.Binding.prototype.oneWay\n */\n oneWay: function(from, flag) {\n var C = this, binding = new C(null, from);\n return binding.oneWay(flag);\n }\n\n});\n\n/**\n @class\n\n An Ember.Binding connects the properties of two objects so that whenever the\n value of one property changes, the other property will be changed also.\n\n ## Automatic Creation of Bindings with `/^*Binding/`-named Properties\n You do not usually create Binding objects directly but instead describe\n bindings in your class or object definition using automatic binding detection.\n\n Properties ending in a `Binding` suffix will be converted to Ember.Binding instances.\n The value of this property should be a string representing a path to another object or\n a custom binding instanced created using Binding helpers (see \"Customizing Your Bindings\"):\n\n valueBinding: \"MyApp.someController.title\"\n\n This will create a binding from `MyApp.someController.title` to the `value`\n property of your object instance automatically. Now the two values will be\n kept in sync.\n\n ## One Way Bindings\n\n One especially useful binding customization you can use is the `oneWay()`\n helper. This helper tells Ember that you are only interested in\n receiving changes on the object you are binding from. For example, if you\n are binding to a preference and you want to be notified if the preference\n has changed, but your object will not be changing the preference itself, you\n could do:\n\n bigTitlesBinding: Ember.Binding.oneWay(\"MyApp.preferencesController.bigTitles\")\n\n This way if the value of MyApp.preferencesController.bigTitles changes the\n \"bigTitles\" property of your object will change also. However, if you\n change the value of your \"bigTitles\" property, it will not update the\n preferencesController.\n\n One way bindings are almost twice as fast to setup and twice as fast to\n execute because the binding only has to worry about changes to one side.\n\n You should consider using one way bindings anytime you have an object that\n may be created frequently and you do not intend to change a property; only\n to monitor it for changes. (such as in the example above).\n\n ## Adding Bindings Manually\n\n All of the examples above show you how to configure a custom binding, but\n the result of these customizations will be a binding template, not a fully\n active Binding instance. The binding will actually become active only when you\n instantiate the object the binding belongs to. It is useful however, to\n understand what actually happens when the binding is activated.\n\n For a binding to function it must have at least a \"from\" property and a \"to\"\n property. The from property path points to the object/key that you want to\n bind from while the to path points to the object/key you want to bind to.\n\n When you define a custom binding, you are usually describing the property\n you want to bind from (such as \"MyApp.someController.value\" in the examples\n above). When your object is created, it will automatically assign the value\n you want to bind \"to\" based on the name of your binding key. In the\n examples above, during init, Ember objects will effectively call\n something like this on your binding:\n\n binding = Ember.Binding.from(this.valueBinding).to(\"value\");\n\n This creates a new binding instance based on the template you provide, and\n sets the to path to the \"value\" property of the new object. Now that the\n binding is fully configured with a \"from\" and a \"to\", it simply needs to be\n connected to become active. This is done through the connect() method:\n\n binding.connect(this);\n\n Note that when you connect a binding you pass the object you want it to be\n connected to. This object will be used as the root for both the from and\n to side of the binding when inspecting relative paths. This allows the\n binding to be automatically inherited by subclassed objects as well.\n\n Now that the binding is connected, it will observe both the from and to side\n and relay changes.\n\n If you ever needed to do so (you almost never will, but it is useful to\n understand this anyway), you could manually create an active binding by\n using the Ember.bind() helper method. (This is the same method used by\n to setup your bindings on objects):\n\n Ember.bind(MyApp.anotherObject, \"value\", \"MyApp.someController.value\");\n\n Both of these code fragments have the same effect as doing the most friendly\n form of binding creation like so:\n\n MyApp.anotherObject = Ember.Object.create({\n valueBinding: \"MyApp.someController.value\",\n\n // OTHER CODE FOR THIS OBJECT...\n\n });\n\n Ember's built in binding creation method makes it easy to automatically\n create bindings for you. You should always use the highest-level APIs\n available, even if you understand how it works underneath.\n\n @since Ember 0.9\n*/\nEmber.Binding = Binding;\n\n/**\n Global helper method to create a new binding. Just pass the root object\n along with a to and from path to create and connect the binding.\n\n @param {Object} obj\n The root object of the transform.\n\n @param {String} to\n The path to the 'to' side of the binding. Must be relative to obj.\n\n @param {String} from\n The path to the 'from' side of the binding. Must be relative to obj or\n a global path.\n\n @returns {Ember.Binding} binding instance\n*/\nEmber.bind = function(obj, to, from) {\n return new Ember.Binding(to, from).connect(obj);\n};\n\nEmber.oneWay = function(obj, to, from) {\n return new Ember.Binding(to, from).oneWay().connect(obj);\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar Mixin, REQUIRED, Alias,\n classToString, superClassString,\n a_map = Ember.ArrayPolyfills.map,\n a_indexOf = Ember.ArrayPolyfills.indexOf,\n a_forEach = Ember.ArrayPolyfills.forEach,\n a_slice = [].slice,\n EMPTY_META = {}, // dummy for non-writable meta\n META_SKIP = { __emberproto__: true, __ember_count__: true },\n o_create = Ember.create,\n defineProperty = Ember.defineProperty,\n guidFor = Ember.guidFor;\n\n/** @private */\nfunction mixinsMeta(obj) {\n var m = Ember.meta(obj, true), ret = m.mixins;\n if (!ret) {\n ret = m.mixins = { __emberproto__: obj };\n } else if (ret.__emberproto__ !== obj) {\n ret = m.mixins = o_create(ret);\n ret.__emberproto__ = obj;\n }\n return ret;\n}\n\n/** @private */\nfunction initMixin(mixin, args) {\n if (args && args.length > 0) {\n mixin.mixins = a_map.call(args, function(x) {\n if (x instanceof Mixin) { return x; }\n\n // Note: Manually setup a primitive mixin here. This is the only\n // way to actually get a primitive mixin. This way normal creation\n // of mixins will give you combined mixins...\n var mixin = new Mixin();\n mixin.properties = x;\n return mixin;\n });\n }\n return mixin;\n}\n\n/** @private */\nfunction isMethod(obj) {\n return 'function' === typeof obj &&\n obj.isMethod !== false &&\n obj !== Boolean && obj !== Object && obj !== Number && obj !== Array && obj !== Date && obj !== String;\n}\n\n/** @private */\nfunction mergeMixins(mixins, m, descs, values, base) {\n var len = mixins.length, idx, mixin, guid, props, value, key, ovalue, concats;\n\n /** @private */\n function removeKeys(keyName) {\n delete descs[keyName];\n delete values[keyName];\n }\n\n for(idx=0; idx < len; idx++) {\n mixin = mixins[idx];\n Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin), typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');\n\n if (mixin instanceof Mixin) {\n guid = guidFor(mixin);\n if (m[guid]) { continue; }\n m[guid] = mixin;\n props = mixin.properties;\n } else {\n props = mixin; // apply anonymous mixin properties\n }\n\n if (props) {\n // reset before adding each new mixin to pickup concats from previous\n concats = values.concatenatedProperties || base.concatenatedProperties;\n if (props.concatenatedProperties) {\n concats = concats ? concats.concat(props.concatenatedProperties) : props.concatenatedProperties;\n }\n\n for (key in props) {\n if (!props.hasOwnProperty(key)) { continue; }\n value = props[key];\n if (value instanceof Ember.Descriptor) {\n if (value === REQUIRED && descs[key]) { continue; }\n\n descs[key] = value;\n values[key] = undefined;\n } else {\n // impl super if needed...\n if (isMethod(value)) {\n ovalue = descs[key] === undefined && values[key];\n if (!ovalue) { ovalue = base[key]; }\n if ('function' !== typeof ovalue) { ovalue = null; }\n if (ovalue) {\n var o = value.__ember_observes__, ob = value.__ember_observesBefore__;\n value = Ember.wrap(value, ovalue);\n value.__ember_observes__ = o;\n value.__ember_observesBefore__ = ob;\n }\n } else if ((concats && a_indexOf.call(concats, key) >= 0) || key === 'concatenatedProperties') {\n var baseValue = values[key] || base[key];\n value = baseValue ? baseValue.concat(value) : Ember.makeArray(value);\n }\n\n descs[key] = undefined;\n values[key] = value;\n }\n }\n\n // manually copy toString() because some JS engines do not enumerate it\n if (props.hasOwnProperty('toString')) {\n base.toString = props.toString;\n }\n\n } else if (mixin.mixins) {\n mergeMixins(mixin.mixins, m, descs, values, base);\n if (mixin._without) { a_forEach.call(mixin._without, removeKeys); }\n }\n }\n}\n\n/** @private */\nfunction writableReq(obj) {\n var m = Ember.meta(obj), req = m.required;\n if (!req || req.__emberproto__ !== obj) {\n req = m.required = req ? o_create(req) : { __ember_count__: 0 };\n req.__emberproto__ = obj;\n }\n return req;\n}\n\nvar IS_BINDING = Ember.IS_BINDING = /^.+Binding$/;\n\n/** @private */\nfunction detectBinding(obj, key, value, m) {\n if (IS_BINDING.test(key)) {\n var bindings = m.bindings;\n if (!bindings) {\n bindings = m.bindings = { __emberproto__: obj };\n } else if (bindings.__emberproto__ !== obj) {\n bindings = m.bindings = o_create(m.bindings);\n bindings.__emberproto__ = obj;\n }\n bindings[key] = value;\n }\n}\n\n/** @private */\nfunction connectBindings(obj, m) {\n // TODO Mixin.apply(instance) should disconnect binding if exists\n var bindings = m.bindings, key, binding, to;\n if (bindings) {\n for (key in bindings) {\n binding = key !== '__emberproto__' && bindings[key];\n if (binding) {\n to = key.slice(0, -7); // strip Binding off end\n if (binding instanceof Ember.Binding) {\n binding = binding.copy(); // copy prototypes' instance\n binding.to(to);\n } else { // binding is string path\n binding = new Ember.Binding(to, binding);\n }\n binding.connect(obj);\n obj[key] = binding;\n }\n }\n // mark as applied\n m.bindings = { __emberproto__: obj };\n }\n}\n\nfunction finishPartial(obj, m) {\n connectBindings(obj, m || Ember.meta(obj));\n return obj;\n}\n\n/** @private */\nfunction applyMixin(obj, mixins, partial) {\n var descs = {}, values = {}, m = Ember.meta(obj), req = m.required,\n key, value, desc, prevValue, paths, len, idx;\n\n // Go through all mixins and hashes passed in, and:\n //\n // * Handle concatenated properties\n // * Set up _super wrapping if necessary\n // * Set up computed property descriptors\n // * Copying `toString` in broken browsers\n mergeMixins(mixins, mixinsMeta(obj), descs, values, obj);\n\n for(key in values) {\n if (key === 'contructor') { continue; }\n if (!values.hasOwnProperty(key)) { continue; }\n\n desc = descs[key];\n value = values[key];\n\n if (desc === REQUIRED) {\n if (!(key in obj)) {\n Ember.assert('Required property not defined: '+key, !!partial);\n\n // for partial applies add to hash of required keys\n req = writableReq(obj);\n req.__ember_count__++;\n req[key] = true;\n }\n } else {\n while (desc && desc instanceof Alias) {\n var altKey = desc.methodName;\n if (descs[altKey] || values[altKey]) {\n value = values[altKey];\n desc = descs[altKey];\n } else if (m.descs[altKey]) {\n desc = m.descs[altKey];\n value = undefined;\n } else {\n desc = undefined;\n value = obj[altKey];\n }\n }\n\n if (desc === undefined && value === undefined) { continue; }\n\n prevValue = obj[key];\n\n if ('function' === typeof prevValue) {\n if ((paths = prevValue.__ember_observesBefore__)) {\n len = paths.length;\n for (idx=0; idx < len; idx++) {\n Ember.removeBeforeObserver(obj, paths[idx], null, key);\n }\n } else if ((paths = prevValue.__ember_observes__)) {\n len = paths.length;\n for (idx=0; idx < len; idx++) {\n Ember.removeObserver(obj, paths[idx], null, key);\n }\n }\n }\n\n detectBinding(obj, key, value, m);\n\n defineProperty(obj, key, desc, value, m);\n\n if ('function' === typeof value) {\n if (paths = value.__ember_observesBefore__) {\n len = paths.length;\n for (idx=0; idx < len; idx++) {\n Ember.addBeforeObserver(obj, paths[idx], null, key);\n }\n } else if (paths = value.__ember_observes__) {\n len = paths.length;\n for (idx=0; idx < len; idx++) {\n Ember.addObserver(obj, paths[idx], null, key);\n }\n }\n }\n\n if (req && req[key]) {\n req = writableReq(obj);\n req.__ember_count__--;\n req[key] = false;\n }\n }\n }\n\n if (!partial) { // don't apply to prototype\n finishPartial(obj, m);\n }\n\n // Make sure no required attrs remain\n if (!partial && req && req.__ember_count__>0) {\n var keys = [];\n for (key in req) {\n if (META_SKIP[key]) { continue; }\n keys.push(key);\n }\n // TODO: Remove surrounding if clause from production build\n Ember.assert('Required properties not defined: '+keys.join(','));\n }\n return obj;\n}\n\nEmber.mixin = function(obj) {\n var args = a_slice.call(arguments, 1);\n applyMixin(obj, args, false);\n return obj;\n};\n\n/**\n @class\n\n The `Ember.Mixin` class allows you to create mixins, whose properties can be\n added to other classes. For instance,\n\n App.Editable = Ember.Mixin.create({\n edit: function() {\n console.log('starting to edit');\n this.set('isEditing', true);\n },\n isEditing: false\n });\n\n // Mix mixins into classes by passing them as the first arguments to\n // .extend or .create.\n App.CommentView = Ember.View.extend(App.Editable, {\n template: Ember.Handlebars.compile('{{#if isEditing}}...{{else}}...{{/if}}')\n });\n\n commentView = App.CommentView.create();\n commentView.edit(); // => outputs 'starting to edit'\n\n Note that Mixins are created with `Ember.Mixin.create`, not\n `Ember.Mixin.extend`.\n*/\nEmber.Mixin = function() { return initMixin(this, arguments); };\n\n/** @private */\nMixin = Ember.Mixin;\n\n/** @private */\nMixin._apply = applyMixin;\n\nMixin.applyPartial = function(obj) {\n var args = a_slice.call(arguments, 1);\n return applyMixin(obj, args, true);\n};\n\nMixin.finishPartial = finishPartial;\n\nMixin.create = function() {\n classToString.processed = false;\n var M = this;\n return initMixin(new M(), arguments);\n};\n\nvar MixinPrototype = Mixin.prototype;\n\nMixinPrototype.reopen = function() {\n var mixin, tmp;\n\n if (this.properties) {\n mixin = Mixin.create();\n mixin.properties = this.properties;\n delete this.properties;\n this.mixins = [mixin];\n } else if (!this.mixins) {\n this.mixins = [];\n }\n\n var len = arguments.length, mixins = this.mixins, idx;\n\n for(idx=0; idx < len; idx++) {\n mixin = arguments[idx];\n Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin), typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');\n\n if (mixin instanceof Mixin) {\n mixins.push(mixin);\n } else {\n tmp = Mixin.create();\n tmp.properties = mixin;\n mixins.push(tmp);\n }\n }\n\n return this;\n};\n\nMixinPrototype.apply = function(obj) {\n return applyMixin(obj, [this], false);\n};\n\nMixinPrototype.applyPartial = function(obj) {\n return applyMixin(obj, [this], true);\n};\n\n/** @private */\nfunction _detect(curMixin, targetMixin, seen) {\n var guid = guidFor(curMixin);\n\n if (seen[guid]) { return false; }\n seen[guid] = true;\n\n if (curMixin === targetMixin) { return true; }\n var mixins = curMixin.mixins, loc = mixins ? mixins.length : 0;\n while (--loc >= 0) {\n if (_detect(mixins[loc], targetMixin, seen)) { return true; }\n }\n return false;\n}\n\nMixinPrototype.detect = function(obj) {\n if (!obj) { return false; }\n if (obj instanceof Mixin) { return _detect(obj, this, {}); }\n var mixins = Ember.meta(obj, false).mixins;\n if (mixins) {\n return !!mixins[guidFor(this)];\n }\n return false;\n};\n\nMixinPrototype.without = function() {\n var ret = new Mixin(this);\n ret._without = a_slice.call(arguments);\n return ret;\n};\n\n/** @private */\nfunction _keys(ret, mixin, seen) {\n if (seen[guidFor(mixin)]) { return; }\n seen[guidFor(mixin)] = true;\n\n if (mixin.properties) {\n var props = mixin.properties;\n for (var key in props) {\n if (props.hasOwnProperty(key)) { ret[key] = true; }\n }\n } else if (mixin.mixins) {\n a_forEach.call(mixin.mixins, function(x) { _keys(ret, x, seen); });\n }\n}\n\nMixinPrototype.keys = function() {\n var keys = {}, seen = {}, ret = [];\n _keys(keys, this, seen);\n for(var key in keys) {\n if (keys.hasOwnProperty(key)) { ret.push(key); }\n }\n return ret;\n};\n\n/** @private - make Mixin's have nice displayNames */\n\nvar NAME_KEY = Ember.GUID_KEY+'_name';\nvar get = Ember.get;\n\n/** @private */\nfunction processNames(paths, root, seen) {\n var idx = paths.length;\n for(var key in root) {\n if (!root.hasOwnProperty || !root.hasOwnProperty(key)) { continue; }\n var obj = root[key];\n paths[idx] = key;\n\n if (obj && obj.toString === classToString) {\n obj[NAME_KEY] = paths.join('.');\n } else if (obj && get(obj, 'isNamespace')) {\n if (seen[guidFor(obj)]) { continue; }\n seen[guidFor(obj)] = true;\n processNames(paths, obj, seen);\n }\n }\n paths.length = idx; // cut out last item\n}\n\n/** @private */\nfunction findNamespaces() {\n var Namespace = Ember.Namespace, obj, isNamespace;\n\n if (Namespace.PROCESSED) { return; }\n\n for (var prop in window) {\n // get(window.globalStorage, 'isNamespace') would try to read the storage for domain isNamespace and cause exception in Firefox.\n // globalStorage is a storage obsoleted by the WhatWG storage specification. See https://developer.mozilla.org/en/DOM/Storage#globalStorage\n if (prop === \"globalStorage\" && window.StorageList && window.globalStorage instanceof window.StorageList) { continue; }\n // Unfortunately, some versions of IE don't support window.hasOwnProperty\n if (window.hasOwnProperty && !window.hasOwnProperty(prop)) { continue; }\n\n // At times we are not allowed to access certain properties for security reasons.\n // There are also times where even if we can access them, we are not allowed to access their properties.\n try {\n obj = window[prop];\n isNamespace = obj && get(obj, 'isNamespace');\n } catch (e) {\n continue;\n }\n\n if (isNamespace) {\n Ember.deprecate(\"Namespaces should not begin with lowercase.\", /^[A-Z]/.test(prop));\n obj[NAME_KEY] = prop;\n }\n }\n}\n\nEmber.identifyNamespaces = findNamespaces;\n\n/** @private */\nsuperClassString = function(mixin) {\n var superclass = mixin.superclass;\n if (superclass) {\n if (superclass[NAME_KEY]) { return superclass[NAME_KEY]; }\n else { return superClassString(superclass); }\n } else {\n return;\n }\n};\n\n/** @private */\nclassToString = function() {\n var Namespace = Ember.Namespace, namespace;\n\n // TODO: Namespace should really be in Metal\n if (Namespace) {\n if (!this[NAME_KEY] && !classToString.processed) {\n if (!Namespace.PROCESSED) {\n findNamespaces();\n Namespace.PROCESSED = true;\n }\n\n classToString.processed = true;\n\n var namespaces = Namespace.NAMESPACES;\n for (var i=0, l=namespaces.length; i 'undefined'\n Ember.typeOf(null); => 'null'\n Ember.typeOf(undefined); => 'undefined'\n Ember.typeOf('michael'); => 'string'\n Ember.typeOf(101); => 'number'\n Ember.typeOf(true); => 'boolean'\n Ember.typeOf(Ember.makeArray); => 'function'\n Ember.typeOf([1,2,90]); => 'array'\n Ember.typeOf(Ember.Object.extend()); => 'class'\n Ember.typeOf(Ember.Object.create()); => 'instance'\n Ember.typeOf(new Error('teamocil')); => 'error'\n\n // \"normal\" JavaScript object\n Ember.typeOf({a: 'b'}); => 'object'\n\n @param item {Object} the item to check\n @returns {String} the type\n*/\nEmber.typeOf = function(item) {\n var ret;\n\n ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object';\n\n if (ret === 'function') {\n if (Ember.Object && Ember.Object.detect(item)) ret = 'class';\n } else if (ret === 'object') {\n if (item instanceof Error) ret = 'error';\n else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';\n else ret = 'object';\n }\n\n return ret;\n};\n\n/**\n Returns true if the passed value is null or undefined. This avoids errors\n from JSLint complaining about use of ==, which can be technically\n confusing.\n\n Ember.none(); => true\n Ember.none(null); => true\n Ember.none(undefined); => true\n Ember.none(''); => false\n Ember.none([]); => false\n Ember.none(function(){}); => false\n\n @param {Object} obj Value to test\n @returns {Boolean}\n*/\nEmber.none = function(obj) {\n return obj === null || obj === undefined;\n};\n\n/**\n Verifies that a value is null or an empty string | array | function.\n\n Constrains the rules on `Ember.none` by returning false for empty\n string and empty arrays.\n\n Ember.empty(); => true\n Ember.empty(null); => true\n Ember.empty(undefined); => true\n Ember.empty(''); => true\n Ember.empty([]); => true\n Ember.empty('tobias fünke'); => false\n Ember.empty([0,1,2]); => false\n\n @param {Object} obj Value to test\n @returns {Boolean}\n*/\nEmber.empty = function(obj) {\n return obj === null || obj === undefined || (obj.length === 0 && typeof obj !== 'function');\n};\n\n/**\n This will compare two javascript values of possibly different types.\n It will tell you which one is greater than the other by returning:\n\n - -1 if the first is smaller than the second,\n - 0 if both are equal,\n - 1 if the first is greater than the second.\n\n The order is calculated based on Ember.ORDER_DEFINITION, if types are different.\n In case they have the same type an appropriate comparison for this type is made.\n\n Ember.compare('hello', 'hello'); => 0\n Ember.compare('abc', 'dfg'); => -1\n Ember.compare(2, 1); => 1\n\n @param {Object} v First value to compare\n @param {Object} w Second value to compare\n @returns {Number} -1 if v < w, 0 if v = w and 1 if v > w.\n*/\nEmber.compare = function compare(v, w) {\n if (v === w) { return 0; }\n\n var type1 = Ember.typeOf(v);\n var type2 = Ember.typeOf(w);\n\n var Comparable = Ember.Comparable;\n if (Comparable) {\n if (type1==='instance' && Comparable.detect(v.constructor)) {\n return v.constructor.compare(v, w);\n }\n\n if (type2 === 'instance' && Comparable.detect(w.constructor)) {\n return 1-w.constructor.compare(w, v);\n }\n }\n\n // If we haven't yet generated a reverse-mapping of Ember.ORDER_DEFINITION,\n // do so now.\n var mapping = Ember.ORDER_DEFINITION_MAPPING;\n if (!mapping) {\n var order = Ember.ORDER_DEFINITION;\n mapping = Ember.ORDER_DEFINITION_MAPPING = {};\n var idx, len;\n for (idx = 0, len = order.length; idx < len; ++idx) {\n mapping[order[idx]] = idx;\n }\n\n // We no longer need Ember.ORDER_DEFINITION.\n delete Ember.ORDER_DEFINITION;\n }\n\n var type1Index = mapping[type1];\n var type2Index = mapping[type2];\n\n if (type1Index < type2Index) { return -1; }\n if (type1Index > type2Index) { return 1; }\n\n // types are equal - so we have to check values now\n switch (type1) {\n case 'boolean':\n case 'number':\n if (v < w) { return -1; }\n if (v > w) { return 1; }\n return 0;\n\n case 'string':\n var comp = v.localeCompare(w);\n if (comp < 0) { return -1; }\n if (comp > 0) { return 1; }\n return 0;\n\n case 'array':\n var vLen = v.length;\n var wLen = w.length;\n var l = Math.min(vLen, wLen);\n var r = 0;\n var i = 0;\n while (r === 0 && i < l) {\n r = compare(v[i],w[i]);\n i++;\n }\n if (r !== 0) { return r; }\n\n // all elements are equal now\n // shorter array should be ordered first\n if (vLen < wLen) { return -1; }\n if (vLen > wLen) { return 1; }\n // arrays are equal now\n return 0;\n\n case 'instance':\n if (Ember.Comparable && Ember.Comparable.detect(v)) {\n return v.compare(v, w);\n }\n return 0;\n\n case 'date':\n var vNum = v.getTime();\n var wNum = w.getTime();\n if (vNum < wNum) { return -1; }\n if (vNum > wNum) { return 1; }\n return 0;\n\n default:\n return 0;\n }\n};\n\n/** @private */\nfunction _copy(obj, deep, seen, copies) {\n var ret, loc, key;\n\n // primitive data types are immutable, just return them.\n if ('object' !== typeof obj || obj===null) return obj;\n\n // avoid cyclical loops\n if (deep && (loc=indexOf(seen, obj))>=0) return copies[loc];\n\n Ember.assert('Cannot clone an Ember.Object that does not implement Ember.Copyable', !(obj instanceof Ember.Object) || (Ember.Copyable && Ember.Copyable.detect(obj)));\n\n // IMPORTANT: this specific test will detect a native array only. Any other\n // object will need to implement Copyable.\n if (Ember.typeOf(obj) === 'array') {\n ret = obj.slice();\n if (deep) {\n loc = ret.length;\n while(--loc>=0) ret[loc] = _copy(ret[loc], deep, seen, copies);\n }\n } else if (Ember.Copyable && Ember.Copyable.detect(obj)) {\n ret = obj.copy(deep, seen, copies);\n } else {\n ret = {};\n for(key in obj) {\n if (!obj.hasOwnProperty(key)) continue;\n ret[key] = deep ? _copy(obj[key], deep, seen, copies) : obj[key];\n }\n }\n\n if (deep) {\n seen.push(obj);\n copies.push(ret);\n }\n\n return ret;\n}\n\n/**\n Creates a clone of the passed object. This function can take just about\n any type of object and create a clone of it, including primitive values\n (which are not actually cloned because they are immutable).\n\n If the passed object implements the clone() method, then this function\n will simply call that method and return the result.\n\n @param {Object} object The object to clone\n @param {Boolean} deep If true, a deep copy of the object is made\n @returns {Object} The cloned object\n*/\nEmber.copy = function(obj, deep) {\n // fast paths\n if ('object' !== typeof obj || obj===null) return obj; // can't copy primitives\n if (Ember.Copyable && Ember.Copyable.detect(obj)) return obj.copy(deep);\n return _copy(obj, deep, deep ? [] : null, deep ? [] : null);\n};\n\n/**\n Convenience method to inspect an object. This method will attempt to\n convert the object into a useful string description.\n\n @param {Object} obj The object you want to inspect.\n @returns {String} A description of the object\n*/\nEmber.inspect = function(obj) {\n var v, ret = [];\n for(var key in obj) {\n if (obj.hasOwnProperty(key)) {\n v = obj[key];\n if (v === 'toString') { continue; } // ignore useless items\n if (Ember.typeOf(v) === 'function') { v = \"function() { ... }\"; }\n ret.push(key + \": \" + v);\n }\n }\n return \"{\" + ret.join(\" , \") + \"}\";\n};\n\n/**\n Compares two objects, returning true if they are logically equal. This is\n a deeper comparison than a simple triple equal. For sets it will compare the\n internal objects. For any other object that implements `isEqual()` it will \n respect that method.\n\n Ember.isEqual('hello', 'hello'); => true\n Ember.isEqual(1, 2); => false\n Ember.isEqual([4,2], [4,2]); => false\n\n @param {Object} a first object to compare\n @param {Object} b second object to compare\n @returns {Boolean}\n*/\nEmber.isEqual = function(a, b) {\n if (a && 'function'===typeof a.isEqual) return a.isEqual(b);\n return a === b;\n};\n\n/**\n @private\n Used by Ember.compare\n*/\nEmber.ORDER_DEFINITION = Ember.ENV.ORDER_DEFINITION || [\n 'undefined',\n 'null',\n 'boolean',\n 'number',\n 'string',\n 'array',\n 'object',\n 'instance',\n 'function',\n 'class',\n 'date'\n];\n\n/**\n Returns all of the keys defined on an object or hash. This is useful\n when inspecting objects for debugging. On browsers that support it, this\n uses the native Object.keys implementation.\n\n @function\n @param {Object} obj\n @returns {Array} Array containing keys of obj\n*/\nEmber.keys = Object.keys;\n\nif (!Ember.keys) {\n Ember.keys = function(obj) {\n var ret = [];\n for(var key in obj) {\n if (obj.hasOwnProperty(key)) { ret.push(key); }\n }\n return ret;\n };\n}\n\n// ..........................................................\n// ERROR\n//\n\n/**\n @class\n\n A subclass of the JavaScript Error object for use in Ember.\n*/\nEmber.Error = function() {\n var tmp = Error.prototype.constructor.apply(this, arguments);\n\n for (var p in tmp) {\n if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }\n }\n this.message = tmp.message;\n};\n\nEmber.Error.prototype = Ember.create(Error.prototype);\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/** @private **/\nvar STRING_DASHERIZE_REGEXP = (/[ _]/g);\nvar STRING_DASHERIZE_CACHE = {};\nvar STRING_DECAMELIZE_REGEXP = (/([a-z])([A-Z])/g);\nvar STRING_CAMELIZE_REGEXP = (/(\\-|_|\\s)+(.)?/g);\nvar STRING_UNDERSCORE_REGEXP_1 = (/([a-z\\d])([A-Z]+)/g);\nvar STRING_UNDERSCORE_REGEXP_2 = (/\\-|\\s+/g);\n\n/**\n Defines the hash of localized strings for the current language. Used by\n the `Ember.String.loc()` helper. To localize, add string values to this\n hash.\n\n @type Hash\n*/\nEmber.STRINGS = {};\n\n/**\n Defines string helper methods including string formatting and localization.\n Unless Ember.EXTEND_PROTOTYPES = false these methods will also be added to the\n String.prototype as well.\n\n @namespace\n*/\nEmber.String = {\n\n /**\n Apply formatting options to the string. This will look for occurrences\n of %@ in your string and substitute them with the arguments you pass into\n this method. If you want to control the specific order of replacement,\n you can add a number after the key as well to indicate which argument\n you want to insert.\n\n Ordered insertions are most useful when building loc strings where values\n you need to insert may appear in different orders.\n\n \"Hello %@ %@\".fmt('John', 'Doe') => \"Hello John Doe\"\n \"Hello %@2, %@1\".fmt('John', 'Doe') => \"Hello Doe, John\"\n\n @param {Object...} [args]\n @returns {String} formatted string\n */\n fmt: function(str, formats) {\n // first, replace any ORDERED replacements.\n var idx = 0; // the current index for non-numerical replacements\n return str.replace(/%@([0-9]+)?/g, function(s, argIndex) {\n argIndex = (argIndex) ? parseInt(argIndex,0) - 1 : idx++ ;\n s = formats[argIndex];\n return ((s === null) ? '(null)' : (s === undefined) ? '' : s).toString();\n }) ;\n },\n\n /**\n Formats the passed string, but first looks up the string in the localized\n strings hash. This is a convenient way to localize text. See\n `Ember.String.fmt()` for more information on formatting.\n\n Note that it is traditional but not required to prefix localized string\n keys with an underscore or other character so you can easily identify\n localized strings.\n\n Ember.STRINGS = {\n '_Hello World': 'Bonjour le monde',\n '_Hello %@ %@': 'Bonjour %@ %@'\n };\n\n Ember.String.loc(\"_Hello World\");\n => 'Bonjour le monde';\n\n Ember.String.loc(\"_Hello %@ %@\", [\"John\", \"Smith\"]);\n => \"Bonjour John Smith\";\n\n @param {String} str\n The string to format\n\n @param {Array} formats\n Optional array of parameters to interpolate into string.\n\n @returns {String} formatted string\n */\n loc: function(str, formats) {\n str = Ember.STRINGS[str] || str;\n return Ember.String.fmt(str, formats) ;\n },\n\n /**\n Splits a string into separate units separated by spaces, eliminating any\n empty strings in the process. This is a convenience method for split that\n is mostly useful when applied to the String.prototype.\n\n Ember.String.w(\"alpha beta gamma\").forEach(function(key) {\n console.log(key);\n });\n > alpha\n > beta\n > gamma\n\n @param {String} str \n The string to split\n\n @returns {String} split string\n */\n w: function(str) { return str.split(/\\s+/); },\n\n /**\n Converts a camelized string into all lower case separated by underscores.\n \n 'innerHTML'.decamelize() => 'inner_html'\n 'action_name'.decamelize() => 'action_name'\n 'css-class-name'.decamelize() => 'css-class-name'\n 'my favorite items'.decamelize() => 'my favorite items'\n\n @param {String} str\n The string to decamelize.\n\n @returns {String} the decamelized string.\n */\n decamelize: function(str) {\n return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();\n },\n\n /**\n Replaces underscores or spaces with dashes.\n \n 'innerHTML'.dasherize() => 'inner-html'\n 'action_name'.dasherize() => 'action-name'\n 'css-class-name'.dasherize() => 'css-class-name'\n 'my favorite items'.dasherize() => 'my-favorite-items'\n\n @param {String} str\n The string to dasherize.\n\n @returns {String} the dasherized string.\n */\n dasherize: function(str) {\n var cache = STRING_DASHERIZE_CACHE,\n ret = cache[str];\n\n if (ret) {\n return ret;\n } else {\n ret = Ember.String.decamelize(str).replace(STRING_DASHERIZE_REGEXP,'-');\n cache[str] = ret;\n }\n\n return ret;\n },\n\n /**\n Returns the lowerCaseCamel form of a string.\n\n 'innerHTML'.camelize() => 'innerHTML'\n 'action_name'.camelize() => 'actionName'\n 'css-class-name'.camelize() => 'cssClassName'\n 'my favorite items'.camelize() => 'myFavoriteItems'\n\n @param {String} str\n The string to camelize.\n\n @returns {String} the camelized string.\n */\n camelize: function(str) {\n return str.replace(STRING_CAMELIZE_REGEXP, function(match, separator, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n },\n\n /**\n Returns the UpperCamelCase form of a string.\n\n 'innerHTML'.classify() => 'InnerHTML'\n 'action_name'.classify() => 'ActionName'\n 'css-class-name'.classify() => 'CssClassName'\n 'my favorite items'.classift() => 'MyFavoriteItems'\n */\n classify: function(str) {\n var camelized = Ember.String.camelize(str);\n return camelized.charAt(0).toUpperCase() + camelized.substr(1);\n },\n\n /**\n More general than decamelize. Returns the lower_case_and_underscored\n form of a string.\n\n 'innerHTML'.underscore() => 'inner_html'\n 'action_name'.underscore() => 'action_name'\n 'css-class-name'.underscore() => 'css_class_name'\n 'my favorite items'.underscore() => 'my_favorite_items'\n\n @param {String} str\n The string to underscore.\n\n @returns {String} the underscored string.\n */\n underscore: function(str) {\n return str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').\n replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase();\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar fmt = Ember.String.fmt,\n w = Ember.String.w,\n loc = Ember.String.loc,\n camelize = Ember.String.camelize,\n decamelize = Ember.String.decamelize,\n dasherize = Ember.String.dasherize,\n underscore = Ember.String.underscore;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n @see Ember.String.fmt\n */\n String.prototype.fmt = function() {\n return fmt(this, arguments);\n };\n\n /**\n @see Ember.String.w\n */\n String.prototype.w = function() {\n return w(this);\n };\n\n /**\n @see Ember.String.loc\n */\n String.prototype.loc = function() {\n return loc(this, arguments);\n };\n\n /**\n @see Ember.String.camelize\n */\n String.prototype.camelize = function() {\n return camelize(this);\n };\n\n /**\n @see Ember.String.decamelize\n */\n String.prototype.decamelize = function() {\n return decamelize(this);\n };\n\n /**\n @see Ember.String.dasherize\n */\n String.prototype.dasherize = function() {\n return dasherize(this);\n };\n\n /**\n @see Ember.String.underscore\n */\n String.prototype.underscore = function() {\n return underscore(this);\n };\n\n}\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar a_slice = Array.prototype.slice;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n The `property` extension of Javascript's Function prototype is available\n when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n Computed properties allow you to treat a function like a property:\n\n MyApp.president = Ember.Object.create({\n firstName: \"Barack\",\n lastName: \"Obama\",\n\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Call this flag to mark the function as a property\n }.property()\n });\n\n MyApp.president.get('fullName'); => \"Barack Obama\"\n\n Treating a function like a property is useful because they can work with\n bindings, just like any other property.\n\n Many computed properties have dependencies on other properties. For\n example, in the above example, the `fullName` property depends on\n `firstName` and `lastName` to determine its value. You can tell Ember.js\n about these dependencies like this:\n\n MyApp.president = Ember.Object.create({\n firstName: \"Barack\",\n lastName: \"Obama\",\n\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Tell Ember.js that this computed property depends on firstName\n // and lastName\n }.property('firstName', 'lastName')\n });\n\n Make sure you list these dependencies so Ember.js knows when to update\n bindings that connect to a computed property. Changing a dependency\n will not immediately trigger an update of the computed property, but\n will instead clear the cache so that it is updated when the next `get`\n is called on the property.\n\n Note: you will usually want to use `property(...)` with `cacheable()`.\n\n @see Ember.ComputedProperty\n @see Ember.computed\n */\n Function.prototype.property = function() {\n var ret = Ember.computed(this);\n return ret.property.apply(ret, arguments);\n };\n\n /**\n The `observes` extension of Javascript's Function prototype is available\n when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n You can observe property changes simply by adding the `observes`\n call to the end of your method declarations in classes that you write.\n For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property changes\n }.observes('value')\n });\n \n @see Ember.Observable\n */\n Function.prototype.observes = function() {\n this.__ember_observes__ = a_slice.call(arguments);\n return this;\n };\n\n /**\n The `observesBefore` extension of Javascript's Function prototype is\n available when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n You can get notified when a property changes is about to happen by\n by adding the `observesBefore` call to the end of your method\n declarations in classes that you write. For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property is about to change\n }.observesBefore('value')\n });\n \n @see Ember.Observable\n */\n Function.prototype.observesBefore = function() {\n this.__ember_observesBefore__ = a_slice.call(arguments);\n return this;\n };\n\n}\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n\n\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set;\nvar a_slice = Array.prototype.slice;\nvar a_indexOf = Ember.EnumerableUtils.indexOf;\n\nvar contexts = [];\n/** @private */\nfunction popCtx() {\n return contexts.length===0 ? {} : contexts.pop();\n}\n\n/** @private */\nfunction pushCtx(ctx) {\n contexts.push(ctx);\n return null;\n}\n\n/** @private */\nfunction iter(key, value) {\n var valueProvided = arguments.length === 2;\n\n function i(item) {\n var cur = get(item, key);\n return valueProvided ? value===cur : !!cur;\n }\n return i ;\n}\n\n/**\n @class\n\n This mixin defines the common interface implemented by enumerable objects\n in Ember. Most of these methods follow the standard Array iteration\n API defined up to JavaScript 1.8 (excluding language-specific features that\n cannot be emulated in older versions of JavaScript).\n\n This mixin is applied automatically to the Array class on page load, so you\n can use any of these methods on simple arrays. If Array already implements\n one of these methods, the mixin will not override them.\n\n h3. Writing Your Own Enumerable\n\n To make your own custom class enumerable, you need two items:\n\n 1. You must have a length property. This property should change whenever\n the number of items in your enumerable object changes. If you using this\n with an Ember.Object subclass, you should be sure to change the length\n property using set().\n\n 2. If you must implement nextObject(). See documentation.\n\n Once you have these two methods implement, apply the Ember.Enumerable mixin\n to your class and you will be able to enumerate the contents of your object\n like any other collection.\n\n h3. Using Ember Enumeration with Other Libraries\n\n Many other libraries provide some kind of iterator or enumeration like\n facility. This is often where the most common API conflicts occur.\n Ember's API is designed to be as friendly as possible with other\n libraries by implementing only methods that mostly correspond to the\n JavaScript 1.8 API.\n\n @extends Ember.Mixin\n @since Ember 0.9\n*/\nEmber.Enumerable = Ember.Mixin.create(\n /** @scope Ember.Enumerable.prototype */ {\n\n /** @private - compatibility */\n isEnumerable: true,\n\n /**\n Implement this method to make your class enumerable.\n\n This method will be call repeatedly during enumeration. The index value\n will always begin with 0 and increment monotonically. You don't have to\n rely on the index value to determine what object to return, but you should\n always check the value and start from the beginning when you see the\n requested index is 0.\n\n The previousObject is the object that was returned from the last call\n to nextObject for the current iteration. This is a useful way to\n manage iteration if you are tracing a linked list, for example.\n\n Finally the context parameter will always contain a hash you can use as\n a \"scratchpad\" to maintain any other state you need in order to iterate\n properly. The context object is reused and is not reset between\n iterations so make sure you setup the context with a fresh state whenever\n the index parameter is 0.\n\n Generally iterators will continue to call nextObject until the index\n reaches the your current length-1. If you run out of data before this\n time for some reason, you should simply return undefined.\n\n The default implementation of this method simply looks up the index.\n This works great on any Array-like objects.\n\n @param {Number} index the current index of the iteration\n @param {Object} previousObject the value returned by the last call to nextObject.\n @param {Object} context a context object you can use to maintain state.\n @returns {Object} the next object in the iteration or undefined\n */\n nextObject: Ember.required(Function),\n\n /**\n Helper method returns the first object from a collection. This is usually\n used by bindings and other parts of the framework to extract a single\n object if the enumerable contains only one item.\n\n If you override this method, you should implement it so that it will\n always return the same value each time it is called. If your enumerable\n contains only one object, this method should always return that object.\n If your enumerable is empty, this method should return undefined.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.firstObject(); => \"a\"\n\n var arr = [];\n arr.firstObject(); => undefined\n\n @returns {Object} the object or undefined\n */\n firstObject: Ember.computed(function() {\n if (get(this, 'length')===0) return undefined ;\n\n // handle generic enumerables\n var context = popCtx(), ret;\n ret = this.nextObject(0, null, context);\n pushCtx(context);\n return ret ;\n }).property('[]').cacheable(),\n\n /**\n Helper method returns the last object from a collection. If your enumerable\n contains only one object, this method should always return that object.\n If your enumerable is empty, this method should return undefined.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.lastObject(); => \"c\"\n\n var arr = [];\n arr.lastObject(); => undefined\n\n @returns {Object} the last object or undefined\n */\n lastObject: Ember.computed(function() {\n var len = get(this, 'length');\n if (len===0) return undefined ;\n var context = popCtx(), idx=0, cur, last = null;\n do {\n last = cur;\n cur = this.nextObject(idx++, last, context);\n } while (cur !== undefined);\n pushCtx(context);\n return last;\n }).property('[]').cacheable(),\n\n /**\n Returns true if the passed object can be found in the receiver. The\n default version will iterate through the enumerable until the object\n is found. You may want to override this with a more efficient version.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.contains(\"a\"); => true\n arr.contains(\"z\"); => false\n\n @param {Object} obj\n The object to search for.\n\n @returns {Boolean} true if object is found in enumerable.\n */\n contains: function(obj) {\n return this.find(function(item) { return item===obj; }) !== undefined;\n },\n\n /**\n Iterates through the enumerable, calling the passed function on each\n item. This method corresponds to the forEach() method defined in\n JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} [target] The target object to use\n @returns {Object} receiver\n */\n forEach: function(callback, target) {\n if (typeof callback !== \"function\") throw new TypeError() ;\n var len = get(this, 'length'), last = null, context = popCtx();\n\n if (target === undefined) target = null;\n\n for(var idx=0;idx1) args = a_slice.call(arguments, 1);\n\n this.forEach(function(x, idx) {\n var method = x && x[methodName];\n if ('function' === typeof method) {\n ret[idx] = args ? method.apply(x, args) : method.call(x);\n }\n }, this);\n\n return ret;\n },\n\n /**\n Simply converts the enumerable into a genuine array. The order is not\n guaranteed. Corresponds to the method implemented by Prototype.\n\n @returns {Array} the enumerable as an array.\n */\n toArray: function() {\n var ret = [];\n this.forEach(function(o, idx) { ret[idx] = o; });\n return ret ;\n },\n\n /**\n Returns a copy of the array with all null elements removed.\n\n var arr = [\"a\", null, \"c\", null];\n arr.compact(); => [\"a\", \"c\"]\n\n @returns {Array} the array without null elements.\n */\n compact: function() { return this.without(null); },\n\n /**\n Returns a new enumerable that excludes the passed value. The default\n implementation returns an array regardless of the receiver type unless\n the receiver does not contain the value.\n\n var arr = [\"a\", \"b\", \"a\", \"c\"];\n arr.without(\"a\"); => [\"b\", \"c\"]\n\n @param {Object} value\n @returns {Ember.Enumerable}\n */\n without: function(value) {\n if (!this.contains(value)) return this; // nothing to do\n var ret = [] ;\n this.forEach(function(k) {\n if (k !== value) ret[ret.length] = k;\n }) ;\n return ret ;\n },\n\n /**\n Returns a new enumerable that contains only unique values. The default\n implementation returns an array regardless of the receiver type.\n\n var arr = [\"a\", \"a\", \"b\", \"b\"];\n arr.uniq(); => [\"a\", \"b\"]\n\n @returns {Ember.Enumerable}\n */\n uniq: function() {\n var ret = [];\n this.forEach(function(k){\n if (a_indexOf(ret, k)<0) ret.push(k);\n });\n return ret;\n },\n\n /**\n This property will trigger anytime the enumerable's content changes.\n You can observe this property to be notified of changes to the enumerables\n content.\n\n For plain enumerables, this property is read only. Ember.Array overrides\n this method.\n\n @type Ember.Array\n */\n '[]': Ember.computed(function(key, value) {\n return this;\n }).property().cacheable(),\n\n // ..........................................................\n // ENUMERABLE OBSERVERS\n //\n\n /**\n Registers an enumerable observer. Must implement Ember.EnumerableObserver\n mixin.\n */\n addEnumerableObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'enumerableWillChange',\n didChange = (opts && opts.didChange) || 'enumerableDidChange';\n\n var hasObservers = get(this, 'hasEnumerableObservers');\n if (!hasObservers) Ember.propertyWillChange(this, 'hasEnumerableObservers');\n Ember.addListener(this, '@enumerable:before', target, willChange);\n Ember.addListener(this, '@enumerable:change', target, didChange);\n if (!hasObservers) Ember.propertyDidChange(this, 'hasEnumerableObservers');\n return this;\n },\n\n /**\n Removes a registered enumerable observer.\n */\n removeEnumerableObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'enumerableWillChange',\n didChange = (opts && opts.didChange) || 'enumerableDidChange';\n\n var hasObservers = get(this, 'hasEnumerableObservers');\n if (hasObservers) Ember.propertyWillChange(this, 'hasEnumerableObservers');\n Ember.removeListener(this, '@enumerable:before', target, willChange);\n Ember.removeListener(this, '@enumerable:change', target, didChange);\n if (hasObservers) Ember.propertyDidChange(this, 'hasEnumerableObservers');\n return this;\n },\n\n /**\n Becomes true whenever the array currently has observers watching changes\n on the array.\n\n @type Boolean\n */\n hasEnumerableObservers: Ember.computed(function() {\n return Ember.hasListeners(this, '@enumerable:change') || Ember.hasListeners(this, '@enumerable:before');\n }).property().cacheable(),\n\n\n /**\n Invoke this method just before the contents of your enumerable will\n change. You can either omit the parameters completely or pass the objects\n to be removed or added if available or just a count.\n\n @param {Ember.Enumerable|Number} removing\n An enumerable of the objects to be removed or the number of items to\n be removed.\n\n @param {Ember.Enumerable|Number} adding\n An enumerable of the objects to be added or the number of items to be\n added.\n\n @returns {Ember.Enumerable} receiver\n */\n enumerableContentWillChange: function(removing, adding) {\n\n var removeCnt, addCnt, hasDelta;\n\n if ('number' === typeof removing) removeCnt = removing;\n else if (removing) removeCnt = get(removing, 'length');\n else removeCnt = removing = -1;\n\n if ('number' === typeof adding) addCnt = adding;\n else if (adding) addCnt = get(adding,'length');\n else addCnt = adding = -1;\n\n hasDelta = addCnt<0 || removeCnt<0 || addCnt-removeCnt!==0;\n\n if (removing === -1) removing = null;\n if (adding === -1) adding = null;\n\n Ember.propertyWillChange(this, '[]');\n if (hasDelta) Ember.propertyWillChange(this, 'length');\n Ember.sendEvent(this, '@enumerable:before', [this, removing, adding]);\n\n return this;\n },\n\n /**\n Invoke this method when the contents of your enumerable has changed.\n This will notify any observers watching for content changes. If your are\n implementing an ordered enumerable (such as an array), also pass the\n start and end values where the content changed so that it can be used to\n notify range observers.\n\n @param {Number} start\n optional start offset for the content change. For unordered\n enumerables, you should always pass -1.\n\n @param {Ember.Enumerable|Number} removing\n An enumerable of the objects to be removed or the number of items to\n be removed.\n\n @param {Ember.Enumerable|Number} adding\n An enumerable of the objects to be added or the number of items to be\n added.\n\n @returns {Object} receiver\n */\n enumerableContentDidChange: function(removing, adding) {\n var notify = this.propertyDidChange, removeCnt, addCnt, hasDelta;\n\n if ('number' === typeof removing) removeCnt = removing;\n else if (removing) removeCnt = get(removing, 'length');\n else removeCnt = removing = -1;\n\n if ('number' === typeof adding) addCnt = adding;\n else if (adding) addCnt = get(adding, 'length');\n else addCnt = adding = -1;\n\n hasDelta = addCnt<0 || removeCnt<0 || addCnt-removeCnt!==0;\n\n if (removing === -1) removing = null;\n if (adding === -1) adding = null;\n\n Ember.sendEvent(this, '@enumerable:change', [this, removing, adding]);\n if (hasDelta) Ember.propertyDidChange(this, 'length');\n Ember.propertyDidChange(this, '[]');\n\n return this ;\n }\n\n}) ;\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set, meta = Ember.meta, map = Ember.EnumerableUtils.map, cacheFor = Ember.cacheFor;\n\n/** @private */\nfunction none(obj) { return obj===null || obj===undefined; }\n\n// ..........................................................\n// ARRAY\n//\n/**\n @namespace\n\n This module implements Observer-friendly Array-like behavior. This mixin is\n picked up by the Array class as well as other controllers, etc. that want to\n appear to be arrays.\n\n Unlike Ember.Enumerable, this mixin defines methods specifically for\n collections that provide index-ordered access to their contents. When you\n are designing code that needs to accept any kind of Array-like object, you\n should use these methods instead of Array primitives because these will\n properly notify observers of changes to the array.\n\n Although these methods are efficient, they do add a layer of indirection to\n your application so it is a good idea to use them only when you need the\n flexibility of using both true JavaScript arrays and \"virtual\" arrays such\n as controllers and collections.\n\n You can use the methods defined in this module to access and modify array\n contents in a KVO-friendly way. You can also be notified whenever the\n membership if an array changes by changing the syntax of the property to\n .observes('*myProperty.[]') .\n\n To support Ember.Array in your own class, you must override two\n primitives to use it: replace() and objectAt().\n\n Note that the Ember.Array mixin also incorporates the Ember.Enumerable mixin. All\n Ember.Array-like objects are also enumerable.\n\n @extends Ember.Enumerable\n @since Ember 0.9.0\n*/\nEmber.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.prototype */ {\n\n /** @private - compatibility */\n isSCArray: true,\n\n /**\n @field {Number} length\n\n Your array must support the length property. Your replace methods should\n set this property whenever it changes.\n */\n length: Ember.required(),\n\n /**\n Returns the object at the given index. If the given index is negative or\n is greater or equal than the array length, returns `undefined`.\n\n This is one of the primitives you must implement to support `Ember.Array`.\n If your object supports retrieving the value of an array item using `get()`\n (i.e. `myArray.get(0)`), then you do not need to implement this method\n yourself.\n\n var arr = ['a', 'b', 'c', 'd'];\n arr.objectAt(0); => \"a\"\n arr.objectAt(3); => \"d\"\n arr.objectAt(-1); => undefined\n arr.objectAt(4); => undefined\n arr.objectAt(5); => undefined\n\n @param {Number} idx\n The index of the item to return.\n */\n objectAt: function(idx) {\n if ((idx < 0) || (idx>=get(this, 'length'))) return undefined ;\n return get(this, idx);\n },\n\n /**\n This returns the objects at the specified indexes, using `objectAt`.\n\n var arr = ['a', 'b', 'c', 'd'];\n arr.objectsAt([0, 1, 2]) => [\"a\", \"b\", \"c\"]\n arr.objectsAt([2, 3, 4]) => [\"c\", \"d\", undefined]\n\n @param {Array} indexes\n An array of indexes of items to return.\n */\n objectsAt: function(indexes) {\n var self = this;\n return map(indexes, function(idx){ return self.objectAt(idx); });\n },\n\n /** @private (nodoc) - overrides Ember.Enumerable version */\n nextObject: function(idx) {\n return this.objectAt(idx);\n },\n\n /**\n @field []\n\n This is the handler for the special array content property. If you get\n this property, it will return this. If you set this property it a new\n array, it will replace the current content.\n\n This property overrides the default property defined in Ember.Enumerable.\n */\n '[]': Ember.computed(function(key, value) {\n if (value !== undefined) this.replace(0, get(this, 'length'), value) ;\n return this ;\n }).property().cacheable(),\n\n firstObject: Ember.computed(function() {\n return this.objectAt(0);\n }).property().cacheable(),\n\n lastObject: Ember.computed(function() {\n return this.objectAt(get(this, 'length')-1);\n }).property().cacheable(),\n\n /** @private (nodoc) - optimized version from Enumerable */\n contains: function(obj){\n return this.indexOf(obj) >= 0;\n },\n\n // Add any extra methods to Ember.Array that are native to the built-in Array.\n /**\n Returns a new array that is a slice of the receiver. This implementation\n uses the observable array methods to retrieve the objects for the new\n slice.\n\n var arr = ['red', 'green', 'blue'];\n arr.slice(0); => ['red', 'green', 'blue']\n arr.slice(0, 2); => ['red', 'green']\n arr.slice(1, 100); => ['green', 'blue']\n\n @param beginIndex {Integer} (Optional) index to begin slicing from.\n @param endIndex {Integer} (Optional) index to end the slice at.\n @returns {Array} New array with specified slice\n */\n slice: function(beginIndex, endIndex) {\n var ret = [];\n var length = get(this, 'length') ;\n if (none(beginIndex)) beginIndex = 0 ;\n if (none(endIndex) || (endIndex > length)) endIndex = length ;\n while(beginIndex < endIndex) {\n ret[ret.length] = this.objectAt(beginIndex++) ;\n }\n return ret ;\n },\n\n /**\n Returns the index of the given object's first occurrence.\n If no startAt argument is given, the starting location to\n search is 0. If it's negative, will count backward from\n the end of the array. Returns -1 if no match is found.\n\n var arr = [\"a\", \"b\", \"c\", \"d\", \"a\"];\n arr.indexOf(\"a\"); => 0\n arr.indexOf(\"z\"); => -1\n arr.indexOf(\"a\", 2); => 4\n arr.indexOf(\"a\", -1); => 4\n arr.indexOf(\"b\", 3); => -1\n arr.indexOf(\"a\", 100); => -1\n\n @param {Object} object the item to search for\n @param {Number} startAt optional starting location to search, default 0\n @returns {Number} index or -1 if not found\n */\n indexOf: function(object, startAt) {\n var idx, len = get(this, 'length');\n\n if (startAt === undefined) startAt = 0;\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx 4\n arr.lastIndexOf(\"z\"); => -1\n arr.lastIndexOf(\"a\", 2); => 0\n arr.lastIndexOf(\"a\", -1); => 4\n arr.lastIndexOf(\"b\", 3); => 1\n arr.lastIndexOf(\"a\", 100); => 4\n\n @param {Object} object the item to search for\n @param {Number} startAt optional starting location to search, default 0\n @returns {Number} index or -1 if not found\n */\n lastIndexOf: function(object, startAt) {\n var idx, len = get(this, 'length');\n\n if (startAt === undefined || startAt >= len) startAt = len-1;\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx>=0;idx--) {\n if (this.objectAt(idx) === object) return idx ;\n }\n return -1;\n },\n\n // ..........................................................\n // ARRAY OBSERVERS\n //\n\n /**\n Adds an array observer to the receiving array. The array observer object\n normally must implement two methods:\n\n * `arrayWillChange(start, removeCount, addCount)` - This method will be\n called just before the array is modified.\n * `arrayDidChange(start, removeCount, addCount)` - This method will be\n called just after the array is modified.\n\n Both callbacks will be passed the starting index of the change as well a\n a count of the items to be removed and added. You can use these callbacks\n to optionally inspect the array during the change, clear caches, or do\n any other bookkeeping necessary.\n\n In addition to passing a target, you can also include an options hash\n which you can use to override the method names that will be invoked on the\n target.\n\n @param {Object} target\n The observer object.\n\n @param {Hash} opts\n Optional hash of configuration options including willChange, didChange,\n and a context option.\n\n @returns {Ember.Array} receiver\n */\n addArrayObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'arrayWillChange',\n didChange = (opts && opts.didChange) || 'arrayDidChange';\n\n var hasObservers = get(this, 'hasArrayObservers');\n if (!hasObservers) Ember.propertyWillChange(this, 'hasArrayObservers');\n Ember.addListener(this, '@array:before', target, willChange);\n Ember.addListener(this, '@array:change', target, didChange);\n if (!hasObservers) Ember.propertyDidChange(this, 'hasArrayObservers');\n return this;\n },\n\n /**\n Removes an array observer from the object if the observer is current\n registered. Calling this method multiple times with the same object will\n have no effect.\n\n @param {Object} target\n The object observing the array.\n\n @returns {Ember.Array} receiver\n */\n removeArrayObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'arrayWillChange',\n didChange = (opts && opts.didChange) || 'arrayDidChange';\n\n var hasObservers = get(this, 'hasArrayObservers');\n if (hasObservers) Ember.propertyWillChange(this, 'hasArrayObservers');\n Ember.removeListener(this, '@array:before', target, willChange);\n Ember.removeListener(this, '@array:change', target, didChange);\n if (hasObservers) Ember.propertyDidChange(this, 'hasArrayObservers');\n return this;\n },\n\n /**\n Becomes true whenever the array currently has observers watching changes\n on the array.\n\n @type Boolean\n */\n hasArrayObservers: Ember.computed(function() {\n return Ember.hasListeners(this, '@array:change') || Ember.hasListeners(this, '@array:before');\n }).property().cacheable(),\n\n /**\n If you are implementing an object that supports Ember.Array, call this\n method just before the array content changes to notify any observers and\n invalidate any related properties. Pass the starting index of the change\n as well as a delta of the amounts to change.\n\n @param {Number} startIdx\n The starting index in the array that will change.\n\n @param {Number} removeAmt\n The number of items that will be removed. If you pass null assumes 0\n\n @param {Number} addAmt\n The number of items that will be added. If you pass null assumes 0.\n\n @returns {Ember.Array} receiver\n */\n arrayContentWillChange: function(startIdx, removeAmt, addAmt) {\n\n // if no args are passed assume everything changes\n if (startIdx===undefined) {\n startIdx = 0;\n removeAmt = addAmt = -1;\n } else {\n if (removeAmt === undefined) removeAmt=-1;\n if (addAmt === undefined) addAmt=-1;\n }\n\n // Make sure the @each proxy is set up if anyone is observing @each\n if (Ember.isWatching(this, '@each')) { get(this, '@each'); }\n\n Ember.sendEvent(this, '@array:before', [this, startIdx, removeAmt, addAmt]);\n\n var removing, lim;\n if (startIdx>=0 && removeAmt>=0 && get(this, 'hasEnumerableObservers')) {\n removing = [];\n lim = startIdx+removeAmt;\n for(var idx=startIdx;idx=0 && addAmt>=0 && get(this, 'hasEnumerableObservers')) {\n adding = [];\n lim = startIdx+addAmt;\n for(var idx=startIdx;idx b`\n\n Default implementation raises an exception.\n\n @param a {Object} the first object to compare\n @param b {Object} the second object to compare\n @returns {Integer} the result of the comparison\n */\n compare: Ember.required(Function)\n\n});\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @namespace\n\n Implements some standard methods for copying an object. Add this mixin to\n any object you create that can create a copy of itself. This mixin is\n added automatically to the built-in array.\n\n You should generally implement the copy() method to return a copy of the\n receiver.\n\n Note that frozenCopy() will only work if you also implement Ember.Freezable.\n\n @extends Ember.Mixin\n @since Ember 0.9\n*/\nEmber.Copyable = Ember.Mixin.create(\n/** @scope Ember.Copyable.prototype */ {\n\n /**\n Override to return a copy of the receiver. Default implementation raises\n an exception.\n\n @param deep {Boolean} if true, a deep copy of the object should be made\n @returns {Object} copy of receiver\n */\n copy: Ember.required(Function),\n\n /**\n If the object implements Ember.Freezable, then this will return a new copy\n if the object is not frozen and the receiver if the object is frozen.\n\n Raises an exception if you try to call this method on a object that does\n not support freezing.\n\n You should use this method whenever you want a copy of a freezable object\n since a freezable object can simply return itself without actually\n consuming more memory.\n\n @returns {Object} copy of receiver or receiver\n */\n frozenCopy: function() {\n if (Ember.Freezable && Ember.Freezable.detect(this)) {\n return get(this, 'isFrozen') ? this : this.copy().freeze();\n } else {\n throw new Error(Ember.String.fmt(\"%@ does not support freezing\", [this]));\n }\n }\n});\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @namespace\n\n The Ember.Freezable mixin implements some basic methods for marking an object\n as frozen. Once an object is frozen it should be read only. No changes\n may be made the internal state of the object.\n\n ## Enforcement\n\n To fully support freezing in your subclass, you must include this mixin and\n override any method that might alter any property on the object to instead\n raise an exception. You can check the state of an object by checking the\n isFrozen property.\n\n Although future versions of JavaScript may support language-level freezing\n object objects, that is not the case today. Even if an object is freezable,\n it is still technically possible to modify the object, even though it could\n break other parts of your application that do not expect a frozen object to\n change. It is, therefore, very important that you always respect the\n isFrozen property on all freezable objects.\n\n ## Example Usage\n\n The example below shows a simple object that implement the Ember.Freezable\n protocol.\n\n Contact = Ember.Object.extend(Ember.Freezable, {\n\n firstName: null,\n\n lastName: null,\n\n // swaps the names\n swapNames: function() {\n if (this.get('isFrozen')) throw Ember.FROZEN_ERROR;\n var tmp = this.get('firstName');\n this.set('firstName', this.get('lastName'));\n this.set('lastName', tmp);\n return this;\n }\n\n });\n\n c = Context.create({ firstName: \"John\", lastName: \"Doe\" });\n c.swapNames(); => returns c\n c.freeze();\n c.swapNames(); => EXCEPTION\n\n ## Copying\n\n Usually the Ember.Freezable protocol is implemented in cooperation with the\n Ember.Copyable protocol, which defines a frozenCopy() method that will return\n a frozen object, if the object implements this method as well.\n\n @extends Ember.Mixin\n @since Ember 0.9\n*/\nEmber.Freezable = Ember.Mixin.create(\n/** @scope Ember.Freezable.prototype */ {\n\n /**\n Set to true when the object is frozen. Use this property to detect whether\n your object is frozen or not.\n\n @type Boolean\n */\n isFrozen: false,\n\n /**\n Freezes the object. Once this method has been called the object should\n no longer allow any properties to be edited.\n\n @returns {Object} receiver\n */\n freeze: function() {\n if (get(this, 'isFrozen')) return this;\n set(this, 'isFrozen', true);\n return this;\n }\n\n});\n\nEmber.FROZEN_ERROR = \"Frozen object cannot be modified.\";\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar forEach = Ember.EnumerableUtils.forEach;\n\n/**\n @class\n\n This mixin defines the API for modifying generic enumerables. These methods\n can be applied to an object regardless of whether it is ordered or\n unordered.\n\n Note that an Enumerable can change even if it does not implement this mixin.\n For example, a MappedEnumerable cannot be directly modified but if its\n underlying enumerable changes, it will change also.\n\n ## Adding Objects\n\n To add an object to an enumerable, use the addObject() method. This\n method will only add the object to the enumerable if the object is not\n already present and the object if of a type supported by the enumerable.\n\n set.addObject(contact);\n\n ## Removing Objects\n\n To remove an object form an enumerable, use the removeObject() method. This\n will only remove the object if it is already in the enumerable, otherwise\n this method has no effect.\n\n set.removeObject(contact);\n\n ## Implementing In Your Own Code\n\n If you are implementing an object and want to support this API, just include\n this mixin in your class and implement the required methods. In your unit\n tests, be sure to apply the Ember.MutableEnumerableTests to your object.\n\n @extends Ember.Mixin\n @extends Ember.Enumerable\n*/\nEmber.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,\n /** @scope Ember.MutableEnumerable.prototype */ {\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n Attempts to add the passed object to the receiver if the object is not\n already present in the collection. If the object is present, this method\n has no effect.\n\n If the passed object is of a type not supported by the receiver\n then this method should raise an exception.\n\n @param {Object} object\n The object to add to the enumerable.\n\n @returns {Object} the passed object\n */\n addObject: Ember.required(Function),\n\n /**\n Adds each object in the passed enumerable to the receiver.\n\n @param {Ember.Enumerable} objects the objects to add.\n @returns {Object} receiver\n */\n addObjects: function(objects) {\n Ember.beginPropertyChanges(this);\n forEach(objects, function(obj) { this.addObject(obj); }, this);\n Ember.endPropertyChanges(this);\n return this;\n },\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n Attempts to remove the passed object from the receiver collection if the\n object is in present in the collection. If the object is not present,\n this method has no effect.\n\n If the passed object is of a type not supported by the receiver\n then this method should raise an exception.\n\n @param {Object} object\n The object to remove from the enumerable.\n\n @returns {Object} the passed object\n */\n removeObject: Ember.required(Function),\n\n\n /**\n Removes each objects in the passed enumerable from the receiver.\n\n @param {Ember.Enumerable} objects the objects to remove\n @returns {Object} receiver\n */\n removeObjects: function(objects) {\n Ember.beginPropertyChanges(this);\n forEach(objects, function(obj) { this.removeObject(obj); }, this);\n Ember.endPropertyChanges(this);\n return this;\n }\n\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// ..........................................................\n// CONSTANTS\n//\n\nvar OUT_OF_RANGE_EXCEPTION = \"Index out of range\" ;\nvar EMPTY = [];\n\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set, forEach = Ember.EnumerableUtils.forEach;\n\n/**\n @class\n\n This mixin defines the API for modifying array-like objects. These methods\n can be applied only to a collection that keeps its items in an ordered set.\n\n Note that an Array can change even if it does not implement this mixin.\n For example, one might implement a SparseArray that cannot be directly\n modified, but if its underlying enumerable changes, it will change also.\n\n @extends Ember.Mixin\n @extends Ember.Array\n @extends Ember.MutableEnumerable\n*/\nEmber.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,\n /** @scope Ember.MutableArray.prototype */ {\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n This is one of the primitives you must implement to support Ember.Array. You\n should replace amt objects started at idx with the objects in the passed\n array. You should also call this.enumerableContentDidChange() ;\n\n @param {Number} idx\n Starting index in the array to replace. If idx >= length, then append\n to the end of the array.\n\n @param {Number} amt\n Number of elements that should be removed from the array, starting at\n *idx*.\n\n @param {Array} objects\n An array of zero or more objects that should be inserted into the array\n at *idx*\n */\n replace: Ember.required(),\n\n /**\n Remove all elements from self. This is useful if you\n want to reuse an existing array without having to recreate it.\n\n var colors = [\"red\", \"green\", \"blue\"];\n color.length(); => 3\n colors.clear(); => []\n colors.length(); => 0\n\n @returns {Ember.Array} An empty Array. \n */\n clear: function () {\n var len = get(this, 'length');\n if (len === 0) return this;\n this.replace(0, len, EMPTY);\n return this;\n },\n\n /**\n This will use the primitive replace() method to insert an object at the\n specified index.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.insertAt(2, \"yellow\"); => [\"red\", \"green\", \"yellow\", \"blue\"]\n colors.insertAt(5, \"orange\"); => Error: Index out of range\n\n @param {Number} idx index of insert the object at.\n @param {Object} object object to insert\n */\n insertAt: function(idx, object) {\n if (idx > get(this, 'length')) throw new Error(OUT_OF_RANGE_EXCEPTION) ;\n this.replace(idx, 0, [object]) ;\n return this ;\n },\n\n /**\n Remove an object at the specified index using the replace() primitive\n method. You can pass either a single index, or a start and a length.\n\n If you pass a start and length that is beyond the\n length this method will throw an Ember.OUT_OF_RANGE_EXCEPTION\n\n var colors = [\"red\", \"green\", \"blue\", \"yellow\", \"orange\"];\n colors.removeAt(0); => [\"green\", \"blue\", \"yellow\", \"orange\"]\n colors.removeAt(2, 2); => [\"green\", \"blue\"]\n colors.removeAt(4, 2); => Error: Index out of range\n\n @param {Number} start index, start of range\n @param {Number} len length of passing range\n @returns {Object} receiver\n */\n removeAt: function(start, len) {\n\n var delta = 0;\n\n if ('number' === typeof start) {\n\n if ((start < 0) || (start >= get(this, 'length'))) {\n throw new Error(OUT_OF_RANGE_EXCEPTION);\n }\n\n // fast case\n if (len === undefined) len = 1;\n this.replace(start, len, EMPTY);\n }\n\n return this ;\n },\n\n /**\n Push the object onto the end of the array. Works just like push() but it\n is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.pushObject(\"black\"); => [\"red\", \"green\", \"blue\", \"black\"]\n colors.pushObject([\"yellow\", \"orange\"]); => [\"red\", \"green\", \"blue\", \"black\", [\"yellow\", \"orange\"]]\n\n */\n pushObject: function(obj) {\n this.insertAt(get(this, 'length'), obj) ;\n return obj ;\n },\n\n /**\n Add the objects in the passed numerable to the end of the array. Defers\n notifying observers of the change until all objects are added.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.pushObjects(\"black\"); => [\"red\", \"green\", \"blue\", \"black\"]\n colors.pushObjects([\"yellow\", \"orange\"]); => [\"red\", \"green\", \"blue\", \"black\", \"yellow\", \"orange\"]\n\n @param {Ember.Enumerable} objects the objects to add\n @returns {Ember.Array} receiver\n */\n pushObjects: function(objects) {\n this.replace(get(this, 'length'), 0, objects);\n return this;\n },\n\n /**\n Pop object from array or nil if none are left. Works just like pop() but\n it is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.popObject(); => \"blue\"\n console.log(colors); => [\"red\", \"green\"]\n\n */\n popObject: function() {\n var len = get(this, 'length') ;\n if (len === 0) return null ;\n\n var ret = this.objectAt(len-1) ;\n this.removeAt(len-1, 1) ;\n return ret ;\n },\n\n /**\n Shift an object from start of array or nil if none are left. Works just\n like shift() but it is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.shiftObject(); => \"red\"\n console.log(colors); => [\"green\", \"blue\"]\n\n */\n shiftObject: function() {\n if (get(this, 'length') === 0) return null ;\n var ret = this.objectAt(0) ;\n this.removeAt(0) ;\n return ret ;\n },\n\n /**\n Unshift an object to start of array. Works just like unshift() but it is\n KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.unshiftObject(\"yellow\"); => [\"yellow\", \"red\", \"green\", \"blue\"]\n colors.unshiftObject([\"black\", \"white\"]); => [[\"black\", \"white\"], \"yellow\", \"red\", \"green\", \"blue\"]\n\n */\n unshiftObject: function(obj) {\n this.insertAt(0, obj) ;\n return obj ;\n },\n\n /**\n Adds the named objects to the beginning of the array. Defers notifying\n observers until all objects have been added.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.unshiftObjects([\"black\", \"white\"]); => [\"black\", \"white\", \"red\", \"green\", \"blue\"]\n colors.unshiftObjects(\"yellow\"); => Type Error: 'undefined' is not a function\n\n @param {Ember.Enumerable} objects the objects to add\n @returns {Ember.Array} receiver\n */\n unshiftObjects: function(objects) {\n this.replace(0, 0, objects);\n return this;\n },\n\n /**\n Reverse objects in the array. Works just like reverse() but it is\n KVO-compliant.\n\n @return {Ember.Array} receiver\n */\n reverseObjects: function() {\n var len = get(this, 'length');\n if (len === 0) return this;\n var objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n },\n\n // ..........................................................\n // IMPLEMENT Ember.MutableEnumerable\n //\n\n /** @private (nodoc) */\n removeObject: function(obj) {\n var loc = get(this, 'length') || 0;\n while(--loc >= 0) {\n var curObject = this.objectAt(loc) ;\n if (curObject === obj) this.removeAt(loc) ;\n }\n return this ;\n },\n\n /** @private (nodoc) */\n addObject: function(obj) {\n if (!this.contains(obj)) this.pushObject(obj);\n return this ;\n }\n\n});\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set, defineProperty = Ember.defineProperty;\n\n/**\n @class\n\n ## Overview\n \n This mixin provides properties and property observing functionality, core\n features of the Ember object model.\n \n Properties and observers allow one object to observe changes to a\n property on another object. This is one of the fundamental ways that\n models, controllers and views communicate with each other in an Ember\n application.\n \n Any object that has this mixin applied can be used in observer\n operations. That includes Ember.Object and most objects you will\n interact with as you write your Ember application.\n\n Note that you will not generally apply this mixin to classes yourself,\n but you will use the features provided by this module frequently, so it\n is important to understand how to use it.\n \n ## Using get() and set()\n \n Because of Ember's support for bindings and observers, you will always\n access properties using the get method, and set properties using the\n set method. This allows the observing objects to be notified and\n computed properties to be handled properly.\n \n More documentation about `get` and `set` are below.\n \n ## Observing Property Changes\n\n You typically observe property changes simply by adding the `observes`\n call to the end of your method declarations in classes that you write.\n For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property changes\n }.observes('value')\n });\n \n Although this is the most common way to add an observer, this capability\n is actually built into the Ember.Object class on top of two methods\n defined in this mixin: `addObserver` and `removeObserver`. You can use\n these two methods to add and remove observers yourself if you need to\n do so at runtime.\n\n To add an observer for a property, call:\n\n object.addObserver('propertyKey', targetObject, targetAction)\n\n This will call the `targetAction` method on the `targetObject` to be called\n whenever the value of the `propertyKey` changes.\n \n Note that if `propertyKey` is a computed property, the observer will be \n called when any of the property dependencies are changed, even if the \n resulting value of the computed property is unchanged. This is necessary\n because computed properties are not computed until `get` is called.\n \n @extends Ember.Mixin\n*/\nEmber.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {\n\n /** @private - compatibility */\n isObserverable: true,\n\n /**\n Retrieves the value of a property from the object.\n\n This method is usually similar to using object[keyName] or object.keyName,\n however it supports both computed properties and the unknownProperty\n handler.\n \n Because `get` unifies the syntax for accessing all these kinds\n of properties, it can make many refactorings easier, such as replacing a\n simple property with a computed property, or vice versa.\n\n ### Computed Properties\n\n Computed properties are methods defined with the `property` modifier\n declared at the end, such as:\n\n fullName: function() {\n return this.getEach('firstName', 'lastName').compact().join(' ');\n }.property('firstName', 'lastName')\n\n When you call `get` on a computed property, the function will be\n called and the return value will be returned instead of the function\n itself.\n\n ### Unknown Properties\n\n Likewise, if you try to call `get` on a property whose value is\n undefined, the unknownProperty() method will be called on the object.\n If this method returns any value other than undefined, it will be returned\n instead. This allows you to implement \"virtual\" properties that are\n not defined upfront.\n\n @param {String} key The property to retrieve\n @returns {Object} The property value or undefined.\n */\n get: function(keyName) {\n return get(this, keyName);\n },\n\n /**\n To get multiple properties at once, call getProperties\n with a list of strings or an array:\n\n record.getProperties('firstName', 'lastName', 'zipCode'); // => { firstName: 'John', lastName: 'Doe', zipCode: '10011' }\n\n is equivalent to:\n\n record.getProperties(['firstName', 'lastName', 'zipCode']); // => { firstName: 'John', lastName: 'Doe', zipCode: '10011' }\n\n @param {String...|Array} list of keys to get\n @returns {Hash}\n */\n getProperties: function() {\n var ret = {};\n var propertyNames = arguments;\n if (arguments.length === 1 && Ember.typeOf(arguments[0]) === 'array') {\n propertyNames = arguments[0];\n }\n for(var i = 0; i < propertyNames.length; i++) {\n ret[propertyNames[i]] = get(this, propertyNames[i]);\n }\n return ret;\n },\n\n /**\n Sets the provided key or path to the value.\n\n This method is generally very similar to calling object[key] = value or\n object.key = value, except that it provides support for computed\n properties, the unknownProperty() method and property observers.\n\n ### Computed Properties\n\n If you try to set a value on a key that has a computed property handler\n defined (see the get() method for an example), then set() will call\n that method, passing both the value and key instead of simply changing\n the value itself. This is useful for those times when you need to\n implement a property that is composed of one or more member\n properties.\n\n ### Unknown Properties\n\n If you try to set a value on a key that is undefined in the target\n object, then the unknownProperty() handler will be called instead. This\n gives you an opportunity to implement complex \"virtual\" properties that\n are not predefined on the object. If unknownProperty() returns\n undefined, then set() will simply set the value on the object.\n\n ### Property Observers\n\n In addition to changing the property, set() will also register a\n property change with the object. Unless you have placed this call\n inside of a beginPropertyChanges() and endPropertyChanges(), any \"local\"\n observers (i.e. observer methods declared on the same object), will be\n called immediately. Any \"remote\" observers (i.e. observer methods\n declared on another object) will be placed in a queue and called at a\n later time in a coalesced manner.\n\n ### Chaining\n\n In addition to property changes, set() returns the value of the object\n itself so you can do chaining like this:\n\n record.set('firstName', 'Charles').set('lastName', 'Jolley');\n\n @param {String} key The property to set\n @param {Object} value The value to set or null.\n @returns {Ember.Observable}\n */\n set: function(keyName, value) {\n set(this, keyName, value);\n return this;\n },\n\n /**\n To set multiple properties at once, call setProperties\n with a Hash:\n\n record.setProperties({ firstName: 'Charles', lastName: 'Jolley' });\n\n @param {Hash} hash the hash of keys and values to set\n @returns {Ember.Observable}\n */\n setProperties: function(hash) {\n return Ember.setProperties(this, hash);\n },\n\n /**\n Begins a grouping of property changes.\n\n You can use this method to group property changes so that notifications\n will not be sent until the changes are finished. If you plan to make a\n large number of changes to an object at one time, you should call this\n method at the beginning of the changes to begin deferring change\n notifications. When you are done making changes, call endPropertyChanges()\n to deliver the deferred change notifications and end deferring.\n\n @returns {Ember.Observable}\n */\n beginPropertyChanges: function() {\n Ember.beginPropertyChanges();\n return this;\n },\n\n /**\n Ends a grouping of property changes.\n\n You can use this method to group property changes so that notifications\n will not be sent until the changes are finished. If you plan to make a\n large number of changes to an object at one time, you should call\n beginPropertyChanges() at the beginning of the changes to defer change\n notifications. When you are done making changes, call this method to\n deliver the deferred change notifications and end deferring.\n\n @returns {Ember.Observable}\n */\n endPropertyChanges: function() {\n Ember.endPropertyChanges();\n return this;\n },\n\n /**\n Notify the observer system that a property is about to change.\n\n Sometimes you need to change a value directly or indirectly without\n actually calling get() or set() on it. In this case, you can use this\n method and propertyDidChange() instead. Calling these two methods\n together will notify all observers that the property has potentially\n changed value.\n\n Note that you must always call propertyWillChange and propertyDidChange as\n a pair. If you do not, it may get the property change groups out of order\n and cause notifications to be delivered more often than you would like.\n\n @param {String} key The property key that is about to change.\n @returns {Ember.Observable}\n */\n propertyWillChange: function(keyName){\n Ember.propertyWillChange(this, keyName);\n return this;\n },\n\n /**\n Notify the observer system that a property has just changed.\n\n Sometimes you need to change a value directly or indirectly without\n actually calling get() or set() on it. In this case, you can use this\n method and propertyWillChange() instead. Calling these two methods\n together will notify all observers that the property has potentially\n changed value.\n\n Note that you must always call propertyWillChange and propertyDidChange as\n a pair. If you do not, it may get the property change groups out of order\n and cause notifications to be delivered more often than you would like.\n\n @param {String} keyName The property key that has just changed.\n @returns {Ember.Observable}\n */\n propertyDidChange: function(keyName) {\n Ember.propertyDidChange(this, keyName);\n return this;\n },\n \n /**\n Convenience method to call `propertyWillChange` and `propertyDidChange` in\n succession.\n \n @param {String} keyName The property key to be notified about.\n @returns {Ember.Observable}\n */\n notifyPropertyChange: function(keyName) {\n this.propertyWillChange(keyName);\n this.propertyDidChange(keyName);\n return this;\n },\n\n addBeforeObserver: function(key, target, method) {\n Ember.addBeforeObserver(this, key, target, method);\n },\n\n /**\n Adds an observer on a property.\n\n This is the core method used to register an observer for a property.\n\n Once you call this method, anytime the key's value is set, your observer\n will be notified. Note that the observers are triggered anytime the\n value is set, regardless of whether it has actually changed. Your\n observer should be prepared to handle that.\n\n You can also pass an optional context parameter to this method. The\n context will be passed to your observer method whenever it is triggered.\n Note that if you add the same target/method pair on a key multiple times\n with different context parameters, your observer will only be called once\n with the last context you passed.\n\n ### Observer Methods\n\n Observer methods you pass should generally have the following signature if\n you do not pass a \"context\" parameter:\n\n fooDidChange: function(sender, key, value, rev);\n\n The sender is the object that changed. The key is the property that\n changes. The value property is currently reserved and unused. The rev\n is the last property revision of the object when it changed, which you can\n use to detect if the key value has really changed or not.\n\n If you pass a \"context\" parameter, the context will be passed before the\n revision like so:\n\n fooDidChange: function(sender, key, value, context, rev);\n\n Usually you will not need the value, context or revision parameters at\n the end. In this case, it is common to write observer methods that take\n only a sender and key value as parameters or, if you aren't interested in\n any of these values, to write an observer that has no parameters at all.\n\n @param {String} key The key to observer\n @param {Object} target The target object to invoke\n @param {String|Function} method The method to invoke.\n @returns {Ember.Object} self\n */\n addObserver: function(key, target, method) {\n Ember.addObserver(this, key, target, method);\n },\n\n /**\n Remove an observer you have previously registered on this object. Pass\n the same key, target, and method you passed to addObserver() and your\n target will no longer receive notifications.\n\n @param {String} key The key to observer\n @param {Object} target The target object to invoke\n @param {String|Function} method The method to invoke.\n @returns {Ember.Observable} receiver\n */\n removeObserver: function(key, target, method) {\n Ember.removeObserver(this, key, target, method);\n },\n\n /**\n Returns true if the object currently has observers registered for a\n particular key. You can use this method to potentially defer performing\n an expensive action until someone begins observing a particular property\n on the object.\n\n @param {String} key Key to check\n @returns {Boolean}\n */\n hasObserverFor: function(key) {\n return Ember.hasListeners(this, key+':change');\n },\n\n /**\n This method will be called when a client attempts to get the value of a\n property that has not been defined in one of the typical ways. Override\n this method to create \"virtual\" properties.\n \n @param {String} key The name of the unknown property that was requested.\n @returns {Object} The property value or undefined. Default is undefined.\n */\n unknownProperty: function(key) {\n return undefined;\n },\n\n /**\n This method will be called when a client attempts to set the value of a\n property that has not been defined in one of the typical ways. Override\n this method to create \"virtual\" properties.\n \n @param {String} key The name of the unknown property to be set.\n @param {Object} value The value the unknown property is to be set to.\n */\n setUnknownProperty: function(key, value) {\n defineProperty(this, key);\n set(this, key, value);\n },\n\n /**\n @deprecated\n @param {String} path The property path to retrieve\n @returns {Object} The property value or undefined.\n */\n getPath: function(path) {\n Ember.deprecate(\"getPath is deprecated since get now supports paths\");\n return this.get(path);\n },\n\n /**\n @deprecated\n @param {String} path The path to the property that will be set\n @param {Object} value The value to set or null.\n @returns {Ember.Observable}\n */\n setPath: function(path, value) {\n Ember.deprecate(\"setPath is deprecated since set now supports paths\");\n return this.set(path, value);\n },\n\n /**\n Retrieves the value of a property, or a default value in the case that the property\n returns undefined.\n \n person.getWithDefault('lastName', 'Doe');\n \n @param {String} keyName The name of the property to retrieve\n @param {Object} defaultValue The value to return if the property value is undefined\n @returns {Object} The property value or the defaultValue.\n */\n getWithDefault: function(keyName, defaultValue) {\n return Ember.getWithDefault(this, keyName, defaultValue);\n },\n\n /**\n Set the value of a property to the current value plus some amount.\n \n person.incrementProperty('age');\n team.incrementProperty('score', 2);\n \n @param {String} keyName The name of the property to increment\n @param {Object} increment The amount to increment by. Defaults to 1\n @returns {Object} The new property value\n */\n incrementProperty: function(keyName, increment) {\n if (!increment) { increment = 1; }\n set(this, keyName, (get(this, keyName) || 0)+increment);\n return get(this, keyName);\n },\n \n /**\n Set the value of a property to the current value minus some amount.\n \n player.decrementProperty('lives');\n orc.decrementProperty('health', 5);\n \n @param {String} keyName The name of the property to decrement\n @param {Object} increment The amount to decrement by. Defaults to 1\n @returns {Object} The new property value\n */\n decrementProperty: function(keyName, increment) {\n if (!increment) { increment = 1; }\n set(this, keyName, (get(this, keyName) || 0)-increment);\n return get(this, keyName);\n },\n\n /**\n Set the value of a boolean property to the opposite of it's\n current value.\n \n starship.toggleProperty('warpDriveEnaged');\n \n @param {String} keyName The name of the property to toggle\n @returns {Object} The new property value\n */\n toggleProperty: function(keyName) {\n set(this, keyName, !get(this, keyName));\n return get(this, keyName);\n },\n\n /**\n Returns the cached value of a computed property, if it exists.\n This allows you to inspect the value of a computed property\n without accidentally invoking it if it is intended to be\n generated lazily.\n\n @param {String} keyName\n @returns {Object} The cached value of the computed property, if any\n */\n cacheFor: function(keyName) {\n return Ember.cacheFor(this, keyName);\n },\n\n /** @private - intended for debugging purposes */\n observersForKey: function(keyName) {\n return Ember.observersFor(this, keyName);\n }\n});\n\n\n\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\nEmber.TargetActionSupport = Ember.Mixin.create({\n target: null,\n action: null,\n\n targetObject: Ember.computed(function() {\n var target = get(this, 'target');\n\n if (Ember.typeOf(target) === \"string\") {\n var value = get(this, target);\n if (value === undefined) { value = get(window, target); }\n return value;\n } else {\n return target;\n }\n }).property('target').cacheable(),\n\n triggerAction: function() {\n var action = get(this, 'action'),\n target = get(this, 'targetObject');\n\n if (target && action) {\n var ret;\n\n if (typeof target.send === 'function') {\n ret = target.send(action, this);\n } else {\n if (typeof action === 'string') {\n action = target[action];\n }\n ret = action.call(target, this);\n }\n if (ret !== false) ret = true;\n\n return ret;\n } else {\n return false;\n }\n }\n});\n\n})();\n\n\n\n(function() {\n/**\n @class\n\n @extends Ember.Mixin\n */\nEmber.Evented = Ember.Mixin.create(\n /** @scope Ember.Evented.prototype */ {\n on: function(name, target, method) {\n Ember.addListener(this, name, target, method);\n },\n\n one: function(name, target, method) {\n if (!method) {\n method = target;\n target = null;\n }\n\n var self = this;\n var wrapped = function() {\n Ember.removeListener(self, name, target, wrapped);\n\n if ('string' === typeof method) { method = this[method]; }\n\n // Internally, a `null` target means that the target is\n // the first parameter to addListener. That means that\n // the `this` passed into this function is the target\n // determined by the event system.\n method.apply(this, arguments);\n };\n\n this.on(name, target, wrapped);\n },\n\n trigger: function(name) {\n var args = [], i, l;\n for (i = 1, l = arguments.length; i < l; i++) {\n args.push(arguments[i]);\n }\n Ember.sendEvent(this, name, args);\n },\n\n fire: function(name) {\n Ember.deprecate(\"Ember.Evented#fire() has been deprecated in favor of trigger() for compatibility with jQuery. It will be removed in 1.0. Please update your code to call trigger() instead.\");\n this.trigger.apply(this, arguments);\n },\n\n off: function(name, target, method) {\n Ember.removeListener(this, name, target, method);\n },\n\n has: function(name) {\n return Ember.hasListeners(this, name);\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n// NOTE: this object should never be included directly. Instead use Ember.\n// Ember.Object. We only define this separately so that Ember.Set can depend on it\n\n\n\nvar classToString = Ember.Mixin.prototype.toString;\nvar set = Ember.set, get = Ember.get;\nvar o_create = Ember.create,\n o_defineProperty = Ember.platform.defineProperty,\n a_slice = Array.prototype.slice,\n meta = Ember.meta,\n rewatch = Ember.rewatch,\n finishChains = Ember.finishChains,\n finishPartial = Ember.Mixin.finishPartial,\n reopen = Ember.Mixin.prototype.reopen;\n\nvar undefinedDescriptor = {\n configurable: true,\n writable: true,\n enumerable: false,\n value: undefined\n};\n\n/** @private */\nfunction makeCtor() {\n\n // Note: avoid accessing any properties on the object since it makes the\n // method a lot faster. This is glue code so we want it to be as fast as\n // possible.\n\n var wasApplied = false, initMixins;\n\n var Class = function() {\n if (!wasApplied) {\n Class.proto(); // prepare prototype...\n }\n var m = Ember.meta(this);\n m.proto = this;\n if (initMixins) {\n this.reopen.apply(this, initMixins);\n initMixins = null;\n }\n o_defineProperty(this, Ember.GUID_KEY, undefinedDescriptor);\n o_defineProperty(this, '_super', undefinedDescriptor);\n finishPartial(this, m);\n delete m.proto;\n finishChains(this);\n this.init.apply(this, arguments);\n };\n\n Class.toString = classToString;\n Class.willReopen = function() {\n if (wasApplied) {\n Class.PrototypeMixin = Ember.Mixin.create(Class.PrototypeMixin);\n }\n\n wasApplied = false;\n };\n Class._initMixins = function(args) { initMixins = args; };\n\n Class.proto = function() {\n var superclass = Class.superclass;\n if (superclass) { superclass.proto(); }\n\n if (!wasApplied) {\n wasApplied = true;\n Class.PrototypeMixin.applyPartial(Class.prototype);\n rewatch(Class.prototype);\n }\n\n return this.prototype;\n };\n\n return Class;\n\n}\n\nvar CoreObject = makeCtor();\n\nCoreObject.PrototypeMixin = Ember.Mixin.create(\n/** @scope Ember.CoreObject.prototype */ {\n\n reopen: function() {\n Ember.Mixin._apply(this, arguments, true);\n return this;\n },\n\n isInstance: true,\n\n /** @private */\n init: function() {},\n\n /** @field */\n isDestroyed: false,\n\n /** @field */\n isDestroying: false,\n\n /**\n Destroys an object by setting the isDestroyed flag and removing its\n metadata, which effectively destroys observers and bindings.\n\n If you try to set a property on a destroyed object, an exception will be\n raised.\n\n Note that destruction is scheduled for the end of the run loop and does not\n happen immediately.\n\n @returns {Ember.Object} receiver\n */\n destroy: function() {\n if (this.isDestroying) { return; }\n\n this.isDestroying = true;\n\n if (this.willDestroy) { this.willDestroy(); }\n\n set(this, 'isDestroyed', true);\n Ember.run.schedule('destroy', this, this._scheduledDestroy);\n return this;\n },\n\n /**\n Invoked by the run loop to actually destroy the object. This is\n scheduled for execution by the `destroy` method.\n\n @private\n */\n _scheduledDestroy: function() {\n Ember.destroy(this);\n if (this.didDestroy) { this.didDestroy(); }\n },\n\n bind: function(to, from) {\n if (!(from instanceof Ember.Binding)) { from = Ember.Binding.from(from); }\n from.to(to).connect(this);\n return from;\n },\n\n toString: function() {\n return '<'+this.constructor.toString()+':'+Ember.guidFor(this)+'>';\n }\n});\n\nif (Ember.config.overridePrototypeMixin) {\n Ember.config.overridePrototypeMixin(CoreObject.PrototypeMixin);\n}\n\nCoreObject.__super__ = null;\n\nvar ClassMixin = Ember.Mixin.create(\n/** @scope Ember.ClassMixin.prototype */ {\n\n ClassMixin: Ember.required(),\n\n PrototypeMixin: Ember.required(),\n\n isClass: true,\n\n isMethod: false,\n\n extend: function() {\n var Class = makeCtor(), proto;\n Class.ClassMixin = Ember.Mixin.create(this.ClassMixin);\n Class.PrototypeMixin = Ember.Mixin.create(this.PrototypeMixin);\n\n Class.ClassMixin.ownerConstructor = Class;\n Class.PrototypeMixin.ownerConstructor = Class;\n\n reopen.apply(Class.PrototypeMixin, arguments);\n\n Class.superclass = this;\n Class.__super__ = this.prototype;\n\n proto = Class.prototype = o_create(this.prototype);\n proto.constructor = Class;\n Ember.generateGuid(proto, 'ember');\n meta(proto).proto = proto; // this will disable observers on prototype\n\n Class.ClassMixin.apply(Class);\n return Class;\n },\n\n create: function() {\n var C = this;\n if (arguments.length>0) { this._initMixins(arguments); }\n return new C();\n },\n\n reopen: function() {\n this.willReopen();\n reopen.apply(this.PrototypeMixin, arguments);\n return this;\n },\n\n reopenClass: function() {\n reopen.apply(this.ClassMixin, arguments);\n Ember.Mixin._apply(this, arguments, false);\n return this;\n },\n\n detect: function(obj) {\n if ('function' !== typeof obj) { return false; }\n while(obj) {\n if (obj===this) { return true; }\n obj = obj.superclass;\n }\n return false;\n },\n\n detectInstance: function(obj) {\n return obj instanceof this;\n },\n\n /**\n In some cases, you may want to annotate computed properties with additional\n metadata about how they function or what values they operate on. For example,\n computed property functions may close over variables that are then no longer\n available for introspection.\n\n You can pass a hash of these values to a computed property like this:\n\n person: function() {\n var personId = this.get('personId');\n return App.Person.create({ id: personId });\n }.property().meta({ type: App.Person })\n\n Once you've done this, you can retrieve the values saved to the computed\n property from your class like this:\n\n MyClass.metaForProperty('person');\n\n This will return the original hash that was passed to `meta()`.\n */\n metaForProperty: function(key) {\n var desc = meta(this.proto(), false).descs[key];\n\n Ember.assert(\"metaForProperty() could not find a computed property with key '\"+key+\"'.\", !!desc && desc instanceof Ember.ComputedProperty);\n return desc._meta || {};\n },\n\n /**\n Iterate over each computed property for the class, passing its name\n and any associated metadata (see `metaForProperty`) to the callback.\n */\n eachComputedProperty: function(callback, binding) {\n var proto = this.proto(),\n descs = meta(proto).descs,\n empty = {},\n property;\n\n for (var name in descs) {\n property = descs[name];\n\n if (property instanceof Ember.ComputedProperty) {\n callback.call(binding || this, name, property._meta || empty);\n }\n }\n }\n\n});\n\nif (Ember.config.overrideClassMixin) {\n Ember.config.overrideClassMixin(ClassMixin);\n}\n\nCoreObject.ClassMixin = ClassMixin;\nClassMixin.apply(CoreObject);\n\n/**\n @class\n*/\nEmber.CoreObject = CoreObject;\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, guidFor = Ember.guidFor, none = Ember.none;\n\n/**\n @class\n\n An unordered collection of objects.\n\n A Set works a bit like an array except that its items are not ordered.\n You can create a set to efficiently test for membership for an object. You\n can also iterate through a set just like an array, even accessing objects\n by index, however there is no guarantee as to their order.\n\n All Sets are observable via the Enumerable Observer API - which works\n on any enumerable object including both Sets and Arrays.\n\n ## Creating a Set\n\n You can create a set like you would most objects using\n `new Ember.Set()`. Most new sets you create will be empty, but you can\n also initialize the set with some content by passing an array or other\n enumerable of objects to the constructor.\n\n Finally, you can pass in an existing set and the set will be copied. You\n can also create a copy of a set by calling `Ember.Set#copy()`.\n\n #js\n // creates a new empty set\n var foundNames = new Ember.Set();\n\n // creates a set with four names in it.\n var names = new Ember.Set([\"Charles\", \"Tom\", \"Juan\", \"Alex\"]); // :P\n\n // creates a copy of the names set.\n var namesCopy = new Ember.Set(names);\n\n // same as above.\n var anotherNamesCopy = names.copy();\n\n ## Adding/Removing Objects\n\n You generally add or remove objects from a set using `add()` or\n `remove()`. You can add any type of object including primitives such as\n numbers, strings, and booleans.\n\n Unlike arrays, objects can only exist one time in a set. If you call `add()`\n on a set with the same object multiple times, the object will only be added\n once. Likewise, calling `remove()` with the same object multiple times will\n remove the object the first time and have no effect on future calls until\n you add the object to the set again.\n\n NOTE: You cannot add/remove null or undefined to a set. Any attempt to do so\n will be ignored.\n\n In addition to add/remove you can also call `push()`/`pop()`. Push behaves\n just like `add()` but `pop()`, unlike `remove()` will pick an arbitrary\n object, remove it and return it. This is a good way to use a set as a job\n queue when you don't care which order the jobs are executed in.\n\n ## Testing for an Object\n\n To test for an object's presence in a set you simply call\n `Ember.Set#contains()`.\n\n ## Observing changes\n\n When using `Ember.Set`, you can observe the `\"[]\"` property to be\n alerted whenever the content changes. You can also add an enumerable\n observer to the set to be notified of specific objects that are added and\n removed from the set. See `Ember.Enumerable` for more information on\n enumerables.\n\n This is often unhelpful. If you are filtering sets of objects, for instance,\n it is very inefficient to re-filter all of the items each time the set\n changes. It would be better if you could just adjust the filtered set based\n on what was changed on the original set. The same issue applies to merging\n sets, as well.\n\n ## Other Methods\n\n `Ember.Set` primary implements other mixin APIs. For a complete reference\n on the methods you will use with `Ember.Set`, please consult these mixins.\n The most useful ones will be `Ember.Enumerable` and\n `Ember.MutableEnumerable` which implement most of the common iterator\n methods you are used to on Array.\n\n Note that you can also use the `Ember.Copyable` and `Ember.Freezable`\n APIs on `Ember.Set` as well. Once a set is frozen it can no longer be\n modified. The benefit of this is that when you call frozenCopy() on it,\n Ember will avoid making copies of the set. This allows you to write\n code that can know with certainty when the underlying set data will or\n will not be modified.\n\n @extends Ember.Enumerable\n @extends Ember.MutableEnumerable\n @extends Ember.Copyable\n @extends Ember.Freezable\n\n @since Ember 0.9\n*/\nEmber.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Ember.Freezable,\n /** @scope Ember.Set.prototype */ {\n\n // ..........................................................\n // IMPLEMENT ENUMERABLE APIS\n //\n\n /**\n This property will change as the number of objects in the set changes.\n\n @type number\n @default 0\n */\n length: 0,\n\n /**\n Clears the set. This is useful if you want to reuse an existing set\n without having to recreate it.\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.length; => 3\n colors.clear();\n colors.length; => 0\n\n @returns {Ember.Set} An empty Set\n */\n clear: function() {\n if (this.isFrozen) { throw new Error(Ember.FROZEN_ERROR); }\n\n var len = get(this, 'length');\n if (len === 0) { return this; }\n\n var guid;\n\n this.enumerableContentWillChange(len, 0);\n Ember.propertyWillChange(this, 'firstObject');\n Ember.propertyWillChange(this, 'lastObject');\n\n for (var i=0; i < len; i++){\n guid = guidFor(this[i]);\n delete this[guid];\n delete this[i];\n }\n\n set(this, 'length', 0);\n\n Ember.propertyDidChange(this, 'firstObject');\n Ember.propertyDidChange(this, 'lastObject');\n this.enumerableContentDidChange(len, 0);\n\n return this;\n },\n\n /**\n Returns true if the passed object is also an enumerable that contains the\n same objects as the receiver.\n\n var colors = [\"red\", \"green\", \"blue\"],\n same_colors = new Ember.Set(colors);\n same_colors.isEqual(colors); => true\n same_colors.isEqual([\"purple\", \"brown\"]); => false\n\n @param {Ember.Set} obj the other object.\n @returns {Boolean}\n */\n isEqual: function(obj) {\n // fail fast\n if (!Ember.Enumerable.detect(obj)) return false;\n\n var loc = get(this, 'length');\n if (get(obj, 'length') !== loc) return false;\n\n while(--loc >= 0) {\n if (!obj.contains(this[loc])) return false;\n }\n\n return true;\n },\n\n /**\n Adds an object to the set. Only non-null objects can be added to a set\n and those can only be added once. If the object is already in the set or\n the passed value is null this method will have no effect.\n\n This is an alias for `Ember.MutableEnumerable.addObject()`.\n\n var colors = new Ember.Set();\n colors.add(\"blue\"); => [\"blue\"]\n colors.add(\"blue\"); => [\"blue\"]\n colors.add(\"red\"); => [\"blue\", \"red\"]\n colors.add(null); => [\"blue\", \"red\"]\n colors.add(undefined); => [\"blue\", \"red\"]\n\n @function\n @param {Object} obj The object to add.\n @returns {Ember.Set} The set itself.\n */\n add: Ember.alias('addObject'),\n\n /**\n Removes the object from the set if it is found. If you pass a null value\n or an object that is already not in the set, this method will have no\n effect. This is an alias for `Ember.MutableEnumerable.removeObject()`.\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.remove(\"red\"); => [\"blue\", \"green\"]\n colors.remove(\"purple\"); => [\"blue\", \"green\"]\n colors.remove(null); => [\"blue\", \"green\"]\n\n @function\n @param {Object} obj The object to remove\n @returns {Ember.Set} The set itself.\n */\n remove: Ember.alias('removeObject'),\n\n /**\n Removes the last element from the set and returns it, or null if it's empty.\n\n var colors = new Ember.Set([\"green\", \"blue\"]);\n colors.pop(); => \"blue\"\n colors.pop(); => \"green\"\n colors.pop(); => null\n\n @returns {Object} The removed object from the set or null.\n */\n pop: function() {\n if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);\n var obj = this.length > 0 ? this[this.length-1] : null;\n this.remove(obj);\n return obj;\n },\n\n /**\n Inserts the given object on to the end of the set. It returns\n the set itself.\n\n This is an alias for `Ember.MutableEnumerable.addObject()`.\n\n var colors = new Ember.Set();\n colors.push(\"red\"); => [\"red\"]\n colors.push(\"green\"); => [\"red\", \"green\"]\n colors.push(\"blue\"); => [\"red\", \"green\", \"blue\"]\n\n @function\n @returns {Ember.Set} The set itself.\n */\n push: Ember.alias('addObject'),\n\n /**\n Removes the last element from the set and returns it, or null if it's empty.\n\n This is an alias for `Ember.Set.pop()`.\n\n var colors = new Ember.Set([\"green\", \"blue\"]);\n colors.shift(); => \"blue\"\n colors.shift(); => \"green\"\n colors.shift(); => null\n\n @function\n @returns {Object} The removed object from the set or null.\n */\n shift: Ember.alias('pop'),\n\n /**\n Inserts the given object on to the end of the set. It returns\n the set itself.\n\n This is an alias of `Ember.Set.push()`\n\n var colors = new Ember.Set();\n colors.unshift(\"red\"); => [\"red\"]\n colors.unshift(\"green\"); => [\"red\", \"green\"]\n colors.unshift(\"blue\"); => [\"red\", \"green\", \"blue\"]\n\n @function\n @returns {Ember.Set} The set itself.\n */\n unshift: Ember.alias('push'),\n\n /**\n Adds each object in the passed enumerable to the set.\n\n This is an alias of `Ember.MutableEnumerable.addObjects()`\n\n var colors = new Ember.Set();\n colors.addEach([\"red\", \"green\", \"blue\"]); => [\"red\", \"green\", \"blue\"]\n\n @function\n @param {Ember.Enumerable} objects the objects to add.\n @returns {Ember.Set} The set itself.\n */\n addEach: Ember.alias('addObjects'),\n\n /**\n Removes each object in the passed enumerable to the set.\n\n This is an alias of `Ember.MutableEnumerable.removeObjects()`\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.removeEach([\"red\", \"blue\"]); => [\"green\"]\n\n @function\n @param {Ember.Enumerable} objects the objects to remove.\n @returns {Ember.Set} The set itself.\n */\n removeEach: Ember.alias('removeObjects'),\n\n // ..........................................................\n // PRIVATE ENUMERABLE SUPPORT\n //\n\n /** @private */\n init: function(items) {\n this._super();\n if (items) this.addObjects(items);\n },\n\n /** @private (nodoc) - implement Ember.Enumerable */\n nextObject: function(idx) {\n return this[idx];\n },\n\n /** @private - more optimized version */\n firstObject: Ember.computed(function() {\n return this.length > 0 ? this[0] : undefined;\n }).property().cacheable(),\n\n /** @private - more optimized version */\n lastObject: Ember.computed(function() {\n return this.length > 0 ? this[this.length-1] : undefined;\n }).property().cacheable(),\n\n /** @private (nodoc) - implements Ember.MutableEnumerable */\n addObject: function(obj) {\n if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);\n if (none(obj)) return this; // nothing to do\n\n var guid = guidFor(obj),\n idx = this[guid],\n len = get(this, 'length'),\n added ;\n\n if (idx>=0 && idx=0 && idx=0;\n },\n\n /** @private (nodoc) */\n copy: function() {\n var C = this.constructor, ret = new C(), loc = get(this, 'length');\n set(ret, 'length', loc);\n while(--loc>=0) {\n ret[loc] = this[loc];\n ret[guidFor(this[loc])] = loc;\n }\n return ret;\n },\n\n /** @private */\n toString: function() {\n var len = this.length, idx, array = [];\n for(idx = 0; idx < len; idx++) {\n array[idx] = this[idx];\n }\n return \"Ember.Set<%@>\".fmt(array.join(','));\n }\n\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/**\n @class\n\n `Ember.Object` is the main base class for all Ember objects. It is a subclass\n of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,\n see the documentation for each of these.\n\n @extends Ember.CoreObject\n @extends Ember.Observable\n*/\nEmber.Object = Ember.CoreObject.extend(Ember.Observable);\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar indexOf = Ember.ArrayPolyfills.indexOf;\n\n/**\n @private\n A Namespace is an object usually used to contain other objects or methods\n such as an application or framework. Create a namespace anytime you want\n to define one of these new containers.\n\n # Example Usage\n\n MyFramework = Ember.Namespace.create({\n VERSION: '1.0.0'\n });\n\n*/\nEmber.Namespace = Ember.Object.extend({\n isNamespace: true,\n\n init: function() {\n Ember.Namespace.NAMESPACES.push(this);\n Ember.Namespace.PROCESSED = false;\n },\n\n toString: function() {\n Ember.identifyNamespaces();\n return this[Ember.GUID_KEY+'_name'];\n },\n\n destroy: function() {\n var namespaces = Ember.Namespace.NAMESPACES;\n window[this.toString()] = undefined;\n namespaces.splice(indexOf.call(namespaces, this), 1);\n this._super();\n }\n});\n\nEmber.Namespace.NAMESPACES = [Ember];\nEmber.Namespace.PROCESSED = false;\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/**\n @private\n\n Defines a namespace that will contain an executable application. This is\n very similar to a normal namespace except that it is expected to include at\n least a 'ready' function which can be run to initialize the application.\n\n Currently Ember.Application is very similar to Ember.Namespace. However, this\n class may be augmented by additional frameworks so it is important to use\n this instance when building new applications.\n\n # Example Usage\n\n MyApp = Ember.Application.create({\n VERSION: '1.0.0',\n store: Ember.Store.create().from(Ember.fixtures)\n });\n\n MyApp.ready = function() {\n //..init code goes here...\n }\n\n*/\nEmber.Application = Ember.Namespace.extend();\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n An ArrayProxy wraps any other object that implements Ember.Array and/or\n Ember.MutableArray, forwarding all requests. This makes it very useful for\n a number of binding use cases or other cases where being able to swap\n out the underlying array is useful.\n\n A simple example of usage:\n\n var pets = ['dog', 'cat', 'fish'];\n var ap = Ember.ArrayProxy.create({ content: Ember.A(pets) });\n ap.get('firstObject'); // => 'dog'\n ap.set('content', ['amoeba', 'paramecium']);\n ap.get('firstObject'); // => 'amoeba'\n\n This class can also be useful as a layer to transform the contents of\n an array, as they are accessed. This can be done by overriding\n `objectAtContent`:\n\n var pets = ['dog', 'cat', 'fish'];\n var ap = Ember.ArrayProxy.create({\n content: Ember.A(pets),\n objectAtContent: function(idx) {\n return this.get('content').objectAt(idx).toUpperCase();\n }\n });\n ap.get('firstObject'); // => 'DOG'\n\n\n @extends Ember.Object\n @extends Ember.Array\n @extends Ember.MutableArray\n*/\nEmber.ArrayProxy = Ember.Object.extend(Ember.MutableArray,\n/** @scope Ember.ArrayProxy.prototype */ {\n\n /**\n The content array. Must be an object that implements Ember.Array and/or\n Ember.MutableArray.\n\n @type Ember.Array\n */\n content: null,\n\n /**\n The array that the proxy pretends to be. In the default `ArrayProxy`\n implementation, this and `content` are the same. Subclasses of `ArrayProxy`\n can override this property to provide things like sorting and filtering.\n */\n arrangedContent: Ember.computed('content', function() {\n return get(this, 'content');\n }).cacheable(),\n\n /**\n Should actually retrieve the object at the specified index from the\n content. You can override this method in subclasses to transform the\n content item to something new.\n\n This method will only be called if content is non-null.\n\n @param {Number} idx\n The index to retrieve.\n\n @returns {Object} the value or undefined if none found\n */\n objectAtContent: function(idx) {\n return get(this, 'arrangedContent').objectAt(idx);\n },\n\n /**\n Should actually replace the specified objects on the content array.\n You can override this method in subclasses to transform the content item\n into something new.\n\n This method will only be called if content is non-null.\n\n @param {Number} idx\n The starting index\n\n @param {Number} amt\n The number of items to remove from the content.\n\n @param {Array} objects\n Optional array of objects to insert or null if no objects.\n\n @returns {void}\n */\n replaceContent: function(idx, amt, objects) {\n get(this, 'arrangedContent').replace(idx, amt, objects);\n },\n\n /**\n Invoked when the content property is about to change. Notifies observers that the\n entire array content will change.\n */\n _contentWillChange: Ember.beforeObserver(function() {\n var content = get(this, 'content');\n\n if (content) {\n content.removeArrayObserver(this, {\n willChange: 'contentArrayWillChange',\n didChange: 'contentArrayDidChange'\n });\n }\n }, 'content'),\n\n\n contentArrayWillChange: Ember.K,\n contentArrayDidChange: Ember.K,\n\n /**\n Invoked when the content property changes. Notifies observers that the\n entire array content has changed.\n */\n _contentDidChange: Ember.observer(function() {\n var content = get(this, 'content'),\n len = content ? get(content, 'length') : 0;\n\n Ember.assert(\"Can't set ArrayProxy's content to itself\", content !== this);\n\n if (content) {\n content.addArrayObserver(this, {\n willChange: 'contentArrayWillChange',\n didChange: 'contentArrayDidChange'\n });\n }\n }, 'content'),\n\n _arrangedContentWillChange: Ember.beforeObserver(function() {\n var arrangedContent = get(this, 'arrangedContent'),\n len = arrangedContent ? get(arrangedContent, 'length') : 0;\n\n this.arrangedContentArrayWillChange(this, 0, len, undefined);\n\n if (arrangedContent) {\n arrangedContent.removeArrayObserver(this, {\n willChange: 'arrangedContentArrayWillChange',\n didChange: 'arrangedContentArrayDidChange'\n });\n }\n }, 'arrangedContent'),\n\n _arrangedContentDidChange: Ember.observer(function() {\n var arrangedContent = get(this, 'arrangedContent'),\n len = arrangedContent ? get(arrangedContent, 'length') : 0;\n\n Ember.assert(\"Can't set ArrayProxy's content to itself\", arrangedContent !== this);\n\n if (arrangedContent) {\n arrangedContent.addArrayObserver(this, {\n willChange: 'arrangedContentArrayWillChange',\n didChange: 'arrangedContentArrayDidChange'\n });\n }\n\n this.arrangedContentArrayDidChange(this, 0, undefined, len);\n }, 'arrangedContent'),\n\n /** @private (nodoc) */\n objectAt: function(idx) {\n return get(this, 'content') && this.objectAtContent(idx);\n },\n\n /** @private (nodoc) */\n length: Ember.computed(function() {\n var arrangedContent = get(this, 'arrangedContent');\n return arrangedContent ? get(arrangedContent, 'length') : 0;\n // No dependencies since Enumerable notifies length of change\n }).property().cacheable(),\n\n /** @private (nodoc) */\n replace: function(idx, amt, objects) {\n if (get(this, 'content')) this.replaceContent(idx, amt, objects);\n return this;\n },\n\n /** @private (nodoc) */\n arrangedContentArrayWillChange: function(item, idx, removedCnt, addedCnt) {\n this.arrayContentWillChange(idx, removedCnt, addedCnt);\n },\n\n /** @private (nodoc) */\n arrangedContentArrayDidChange: function(item, idx, removedCnt, addedCnt) {\n this.arrayContentDidChange(idx, removedCnt, addedCnt);\n },\n\n /** @private (nodoc) */\n init: function() {\n this._super();\n this._contentWillChange();\n this._contentDidChange();\n this._arrangedContentWillChange();\n this._arrangedContentDidChange();\n }\n\n});\n\n\n\n\n})();\n\n\n\n(function() {\nvar get = Ember.get,\n set = Ember.set,\n fmt = Ember.String.fmt,\n addBeforeObserver = Ember.addBeforeObserver,\n addObserver = Ember.addObserver,\n removeBeforeObserver = Ember.removeBeforeObserver,\n removeObserver = Ember.removeObserver,\n propertyWillChange = Ember.propertyWillChange,\n propertyDidChange = Ember.propertyDidChange;\n\nfunction contentPropertyWillChange(content, contentKey) {\n var key = contentKey.slice(8); // remove \"content.\"\n if (key in this) { return; } // if shadowed in proxy\n propertyWillChange(this, key);\n}\n\nfunction contentPropertyDidChange(content, contentKey) {\n var key = contentKey.slice(8); // remove \"content.\"\n if (key in this) { return; } // if shadowed in proxy\n propertyDidChange(this, key);\n}\n\n/**\n @class\n\n `Ember.ObjectProxy` forwards all properties not defined by the proxy itself\n to a proxied `content` object.\n\n object = Ember.Object.create({\n name: 'Foo'\n });\n proxy = Ember.ObjectProxy.create({\n content: object\n });\n\n // Access and change existing properties\n proxy.get('name') // => 'Foo'\n proxy.set('name', 'Bar');\n object.get('name') // => 'Bar'\n\n // Create new 'description' property on `object`\n proxy.set('description', 'Foo is a whizboo baz');\n object.get('description') // => 'Foo is a whizboo baz'\n\n While `content` is unset, setting a property to be delegated will throw an Error.\n\n proxy = Ember.ObjectProxy.create({\n content: null,\n flag: null\n });\n proxy.set('flag', true);\n proxy.get('flag'); // => true\n proxy.get('foo'); // => undefined\n proxy.set('foo', 'data'); // throws Error\n\n Delegated properties can be bound to and will change when content is updated.\n\n Computed properties on the proxy itself can depend on delegated properties.\n\n ProxyWithComputedProperty = Ember.ObjectProxy.extend({\n fullName: function () {\n var firstName = this.get('firstName'),\n lastName = this.get('lastName');\n if (firstName && lastName) {\n return firstName + ' ' + lastName;\n }\n return firstName || lastName;\n }.property('firstName', 'lastName')\n });\n proxy = ProxyWithComputedProperty.create();\n proxy.get('fullName'); => undefined\n proxy.set('content', {\n firstName: 'Tom', lastName: 'Dale'\n }); // triggers property change for fullName on proxy\n proxy.get('fullName'); => 'Tom Dale'\n*/\nEmber.ObjectProxy = Ember.Object.extend(\n/** @scope Ember.ObjectProxy.prototype */ {\n /**\n The object whose properties will be forwarded.\n\n @type Ember.Object\n @default null\n */\n content: null,\n _contentDidChange: Ember.observer(function() {\n Ember.assert(\"Can't set ObjectProxy's content to itself\", this.get('content') !== this);\n }, 'content'),\n /** @private */\n willWatchProperty: function (key) {\n var contentKey = 'content.' + key;\n addBeforeObserver(this, contentKey, null, contentPropertyWillChange);\n addObserver(this, contentKey, null, contentPropertyDidChange);\n },\n /** @private */\n didUnwatchProperty: function (key) {\n var contentKey = 'content.' + key;\n removeBeforeObserver(this, contentKey, null, contentPropertyWillChange);\n removeObserver(this, contentKey, null, contentPropertyDidChange);\n },\n /** @private */\n unknownProperty: function (key) {\n var content = get(this, 'content');\n if (content) {\n return get(content, key);\n }\n },\n /** @private */\n setUnknownProperty: function (key, value) {\n var content = get(this, 'content');\n Ember.assert(fmt(\"Cannot delegate set('%@', %@) to the 'content' property of object proxy %@: its 'content' is undefined.\", [key, value, this]), content);\n return set(content, key, value);\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar set = Ember.set, get = Ember.get, guidFor = Ember.guidFor;\nvar forEach = Ember.EnumerableUtils.forEach;\n\nvar EachArray = Ember.Object.extend(Ember.Array, {\n\n init: function(content, keyName, owner) {\n this._super();\n this._keyName = keyName;\n this._owner = owner;\n this._content = content;\n },\n\n objectAt: function(idx) {\n var item = this._content.objectAt(idx);\n return item && get(item, this._keyName);\n },\n\n length: Ember.computed(function() {\n var content = this._content;\n return content ? get(content, 'length') : 0;\n }).property().cacheable()\n\n});\n\nvar IS_OBSERVER = /^.+:(before|change)$/;\n\n/** @private */\nfunction addObserverForContentKey(content, keyName, proxy, idx, loc) {\n var objects = proxy._objects, guid;\n if (!objects) objects = proxy._objects = {};\n\n while(--loc>=idx) {\n var item = content.objectAt(loc);\n if (item) {\n Ember.addBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');\n Ember.addObserver(item, keyName, proxy, 'contentKeyDidChange');\n\n // keep track of the indicies each item was found at so we can map\n // it back when the obj changes.\n guid = guidFor(item);\n if (!objects[guid]) objects[guid] = [];\n objects[guid].push(loc);\n }\n }\n}\n\n/** @private */\nfunction removeObserverForContentKey(content, keyName, proxy, idx, loc) {\n var objects = proxy._objects;\n if (!objects) objects = proxy._objects = {};\n var indicies, guid;\n\n while(--loc>=idx) {\n var item = content.objectAt(loc);\n if (item) {\n Ember.removeBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');\n Ember.removeObserver(item, keyName, proxy, 'contentKeyDidChange');\n\n guid = guidFor(item);\n indicies = objects[guid];\n indicies[indicies.indexOf(loc)] = null;\n }\n }\n}\n\n/**\n @private\n @class\n\n This is the object instance returned when you get the @each property on an\n array. It uses the unknownProperty handler to automatically create\n EachArray instances for property names.\n\n @extends Ember.Object\n*/\nEmber.EachProxy = Ember.Object.extend({\n\n init: function(content) {\n this._super();\n this._content = content;\n content.addArrayObserver(this);\n\n // in case someone is already observing some keys make sure they are\n // added\n forEach(Ember.watchedEvents(this), function(eventName) {\n this.didAddListener(eventName);\n }, this);\n },\n\n /**\n You can directly access mapped properties by simply requesting them.\n The unknownProperty handler will generate an EachArray of each item.\n */\n unknownProperty: function(keyName, value) {\n var ret;\n ret = new EachArray(this._content, keyName, this);\n Ember.defineProperty(this, keyName, null, ret);\n this.beginObservingContentKey(keyName);\n return ret;\n },\n\n // ..........................................................\n // ARRAY CHANGES\n // Invokes whenever the content array itself changes.\n\n arrayWillChange: function(content, idx, removedCnt, addedCnt) {\n var keys = this._keys, key, array, lim;\n\n lim = removedCnt>0 ? idx+removedCnt : -1;\n Ember.beginPropertyChanges(this);\n\n for(key in keys) {\n if (!keys.hasOwnProperty(key)) { continue; }\n\n if (lim>0) removeObserverForContentKey(content, key, this, idx, lim);\n\n Ember.propertyWillChange(this, key);\n }\n\n Ember.propertyWillChange(this._content, '@each');\n Ember.endPropertyChanges(this);\n },\n\n arrayDidChange: function(content, idx, removedCnt, addedCnt) {\n var keys = this._keys, key, array, lim;\n\n lim = addedCnt>0 ? idx+addedCnt : -1;\n Ember.beginPropertyChanges(this);\n\n for(key in keys) {\n if (!keys.hasOwnProperty(key)) { continue; }\n\n if (lim>0) addObserverForContentKey(content, key, this, idx, lim);\n\n Ember.propertyDidChange(this, key);\n }\n\n Ember.propertyDidChange(this._content, '@each');\n Ember.endPropertyChanges(this);\n },\n\n // ..........................................................\n // LISTEN FOR NEW OBSERVERS AND OTHER EVENT LISTENERS\n // Start monitoring keys based on who is listening...\n\n didAddListener: function(eventName) {\n if (IS_OBSERVER.test(eventName)) {\n this.beginObservingContentKey(eventName.slice(0, -7));\n }\n },\n\n didRemoveListener: function(eventName) {\n if (IS_OBSERVER.test(eventName)) {\n this.stopObservingContentKey(eventName.slice(0, -7));\n }\n },\n\n // ..........................................................\n // CONTENT KEY OBSERVING\n // Actual watch keys on the source content.\n\n beginObservingContentKey: function(keyName) {\n var keys = this._keys;\n if (!keys) keys = this._keys = {};\n if (!keys[keyName]) {\n keys[keyName] = 1;\n var content = this._content,\n len = get(content, 'length');\n addObserverForContentKey(content, keyName, this, 0, len);\n } else {\n keys[keyName]++;\n }\n },\n\n stopObservingContentKey: function(keyName) {\n var keys = this._keys;\n if (keys && (keys[keyName]>0) && (--keys[keyName]<=0)) {\n var content = this._content,\n len = get(content, 'length');\n removeObserverForContentKey(content, keyName, this, 0, len);\n }\n },\n\n contentKeyWillChange: function(obj, keyName) {\n Ember.propertyWillChange(this, keyName);\n },\n\n contentKeyDidChange: function(obj, keyName) {\n Ember.propertyDidChange(this, keyName);\n }\n\n});\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n// Add Ember.Array to Array.prototype. Remove methods with native\n// implementations and supply some more optimized versions of generic methods\n// because they are so common.\nvar NativeArray = Ember.Mixin.create(Ember.MutableArray, Ember.Observable, Ember.Copyable, {\n\n // because length is a built-in property we need to know to just get the\n // original property.\n get: function(key) {\n if (key==='length') return this.length;\n else if ('number' === typeof key) return this[key];\n else return this._super(key);\n },\n\n objectAt: function(idx) {\n return this[idx];\n },\n\n // primitive for array support.\n replace: function(idx, amt, objects) {\n\n if (this.isFrozen) throw Ember.FROZEN_ERROR ;\n\n // if we replaced exactly the same number of items, then pass only the\n // replaced range. Otherwise, pass the full remaining array length\n // since everything has shifted\n var len = objects ? get(objects, 'length') : 0;\n this.arrayContentWillChange(idx, amt, len);\n\n if (!objects || objects.length === 0) {\n this.splice(idx, amt) ;\n } else {\n var args = [idx, amt].concat(objects) ;\n this.splice.apply(this,args) ;\n }\n\n this.arrayContentDidChange(idx, amt, len);\n return this ;\n },\n\n // If you ask for an unknown property, then try to collect the value\n // from member items.\n unknownProperty: function(key, value) {\n var ret;// = this.reducedProperty(key, value) ;\n if ((value !== undefined) && ret === undefined) {\n ret = this[key] = value;\n }\n return ret ;\n },\n\n // If browser did not implement indexOf natively, then override with\n // specialized version\n indexOf: function(object, startAt) {\n var idx, len = this.length;\n\n if (startAt === undefined) startAt = 0;\n else startAt = (startAt < 0) ? Math.ceil(startAt) : Math.floor(startAt);\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx=0;idx--) {\n if (this[idx] === object) return idx ;\n }\n return -1;\n },\n\n copy: function() {\n return this.slice();\n }\n});\n\n// Remove any methods implemented natively so we don't override them\nvar ignore = ['length'];\nEmber.EnumerableUtils.forEach(NativeArray.keys(), function(methodName) {\n if (Array.prototype[methodName]) ignore.push(methodName);\n});\n\nif (ignore.length>0) {\n NativeArray = NativeArray.without.apply(NativeArray, ignore);\n}\n\n/**\n The NativeArray mixin contains the properties needed to to make the native\n Array support Ember.MutableArray and all of its dependent APIs. Unless you\n have Ember.EXTEND_PROTOTYPES set to false, this will be applied automatically.\n Otherwise you can apply the mixin at anytime by calling\n `Ember.NativeArray.activate`.\n\n @namespace\n @extends Ember.MutableArray\n @extends Ember.Array\n @extends Ember.Enumerable\n @extends Ember.MutableEnumerable\n @extends Ember.Copyable\n @extends Ember.Freezable\n*/\nEmber.NativeArray = NativeArray;\n\n/**\n Creates an Ember.NativeArray from an Array like object.\n Does not modify the original object.\n\n @returns {Ember.NativeArray}\n*/\nEmber.A = function(arr){\n if (arr === undefined) { arr = []; }\n return Ember.NativeArray.apply(arr);\n};\n\n/**\n Activates the mixin on the Array.prototype if not already applied. Calling\n this method more than once is safe.\n\n @returns {void}\n*/\nEmber.NativeArray.activate = function() {\n NativeArray.apply(Array.prototype);\n\n Ember.A = function(arr) { return arr || []; };\n};\n\nif (Ember.EXTEND_PROTOTYPES) Ember.NativeArray.activate();\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\nEmber._PromiseChain = Ember.Object.extend({\n promises: null,\n failureCallback: Ember.K,\n successCallback: Ember.K,\n abortCallback: Ember.K,\n promiseSuccessCallback: Ember.K,\n\n /**\n @private\n */\n runNextPromise: function() {\n if (get(this, 'isDestroyed')) { return; }\n\n var item = get(this, 'promises').shiftObject();\n if (item) {\n var promise = get(item, 'promise') || item;\n Ember.assert(\"Cannot find promise to invoke\", Ember.canInvoke(promise, 'then'));\n\n var self = this;\n\n var successCallback = function() {\n self.promiseSuccessCallback.call(this, item, arguments);\n self.runNextPromise();\n };\n\n var failureCallback = get(self, 'failureCallback');\n\n promise.then(successCallback, failureCallback);\n } else {\n this.successCallback();\n }\n },\n\n start: function() {\n this.runNextPromise();\n return this;\n },\n\n abort: function() {\n this.abortCallback();\n this.destroy();\n },\n\n init: function() {\n set(this, 'promises', Ember.A(get(this, 'promises')));\n this._super();\n }\n});\n\n\n})();\n\n\n\n(function() {\nvar loadHooks = {};\nvar loaded = {};\n\nEmber.onLoad = function(name, callback) {\n var object;\n\n loadHooks[name] = loadHooks[name] || Ember.A();\n loadHooks[name].pushObject(callback);\n\n if (object = loaded[name]) {\n callback(object);\n }\n};\n\nEmber.runLoadHooks = function(name, object) {\n var hooks;\n\n loaded[name] = object;\n\n if (hooks = loadHooks[name]) {\n loadHooks[name].forEach(function(callback) {\n callback(object);\n });\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\nEmber.ControllerMixin = Ember.Mixin.create({\n /**\n The object to which events from the view should be sent.\n\n For example, when a Handlebars template uses the `{{action}}` helper,\n it will attempt to send the event to the view's controller's `target`.\n\n By default, a controller's `target` is set to the router after it is\n instantiated by `Ember.Application#initialize`.\n */\n target: null,\n store: null\n});\n\nEmber.Controller = Ember.Object.extend(Ember.ControllerMixin);\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set, forEach = Ember.EnumerableUtils.forEach;\n\n/**\n @class\n\n @extends Ember.Mixin\n @extends Ember.MutableEnumerable\n*/\nEmber.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable,\n /** @scope Ember.Observable.prototype */ {\n sortProperties: null,\n sortAscending: true,\n\n addObject: function(obj) {\n var content = get(this, 'content');\n content.pushObject(obj);\n },\n\n removeObject: function(obj) {\n var content = get(this, 'content');\n content.removeObject(obj);\n },\n\n orderBy: function(item1, item2) {\n var result = 0,\n sortProperties = get(this, 'sortProperties'),\n sortAscending = get(this, 'sortAscending');\n\n Ember.assert(\"you need to define `sortProperties`\", !!sortProperties);\n\n forEach(sortProperties, function(propertyName) {\n if (result === 0) {\n result = Ember.compare(get(item1, propertyName), get(item2, propertyName));\n if ((result !== 0) && !sortAscending) {\n result = (-1) * result;\n }\n }\n });\n\n return result;\n },\n\n destroy: function() {\n var content = get(this, 'content'),\n sortProperties = get(this, 'sortProperties');\n\n if (content && sortProperties) {\n forEach(content, function(item) {\n forEach(sortProperties, function(sortProperty) {\n Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');\n }, this);\n }, this);\n }\n\n return this._super();\n },\n\n isSorted: Ember.computed('sortProperties', function() {\n return !!get(this, 'sortProperties');\n }),\n\n arrangedContent: Ember.computed('content', 'sortProperties.@each', function(key, value) {\n var content = get(this, 'content'),\n isSorted = get(this, 'isSorted'),\n sortProperties = get(this, 'sortProperties'),\n self = this;\n\n if (content && isSorted) {\n content = content.slice();\n content.sort(function(item1, item2) {\n return self.orderBy(item1, item2);\n });\n forEach(content, function(item) {\n forEach(sortProperties, function(sortProperty) {\n Ember.addObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');\n }, this);\n }, this);\n return Ember.A(content);\n }\n\n return content;\n }).cacheable(),\n\n _contentWillChange: Ember.beforeObserver(function() {\n var content = get(this, 'content'),\n sortProperties = get(this, 'sortProperties');\n\n if (content && sortProperties) {\n forEach(content, function(item) {\n forEach(sortProperties, function(sortProperty) {\n Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');\n }, this);\n }, this);\n }\n\n this._super();\n }, 'content'),\n\n sortAscendingWillChange: Ember.beforeObserver(function() {\n this._lastSortAscending = get(this, 'sortAscending');\n }, 'sortAscending'),\n\n sortAscendingDidChange: Ember.observer(function() {\n if (get(this, 'sortAscending') !== this._lastSortAscending) {\n var arrangedContent = get(this, 'arrangedContent');\n arrangedContent.reverseObjects();\n }\n }, 'sortAscending'),\n\n contentArrayWillChange: function(array, idx, removedCount, addedCount) {\n var isSorted = get(this, 'isSorted');\n\n if (isSorted) {\n var arrangedContent = get(this, 'arrangedContent');\n var removedObjects = array.slice(idx, idx+removedCount);\n var sortProperties = get(this, 'sortProperties');\n\n forEach(removedObjects, function(item) {\n arrangedContent.removeObject(item);\n\n forEach(sortProperties, function(sortProperty) {\n Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');\n }, this);\n });\n }\n\n return this._super(array, idx, removedCount, addedCount);\n },\n\n contentArrayDidChange: function(array, idx, removedCount, addedCount) {\n var isSorted = get(this, 'isSorted'),\n sortProperties = get(this, 'sortProperties');\n\n if (isSorted) {\n var addedObjects = array.slice(idx, idx+addedCount);\n var arrangedContent = get(this, 'arrangedContent');\n\n forEach(addedObjects, function(item) {\n this.insertItemSorted(item);\n\n forEach(sortProperties, function(sortProperty) {\n Ember.addObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');\n }, this);\n }, this);\n }\n\n return this._super(array, idx, removedCount, addedCount);\n },\n\n insertItemSorted: function(item) {\n var arrangedContent = get(this, 'arrangedContent');\n var length = get(arrangedContent, 'length');\n\n var idx = this._binarySearch(item, 0, length);\n arrangedContent.insertAt(idx, item);\n },\n\n contentItemSortPropertyDidChange: function(item) {\n var arrangedContent = get(this, 'arrangedContent'),\n index = arrangedContent.indexOf(item);\n\n arrangedContent.removeObject(item);\n this.insertItemSorted(item);\n },\n\n _binarySearch: function(item, low, high) {\n var mid, midItem, res, arrangedContent;\n\n if (low === high) {\n return low;\n }\n\n arrangedContent = get(this, 'arrangedContent');\n\n mid = low + Math.floor((high - low) / 2);\n midItem = arrangedContent.objectAt(mid);\n\n res = this.orderBy(midItem, item);\n\n if (res < 0) {\n return this._binarySearch(item, mid+1, high);\n } else if (res > 0) {\n return this._binarySearch(item, low, mid);\n }\n\n return mid;\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n Ember.ArrayController provides a way for you to publish a collection of objects\n so that you can easily bind to the collection from a Handlebars #each helper,\n an Ember.CollectionView, or other controllers.\n\n The advantage of using an ArrayController is that you only have to set up\n your view bindings once; to change what's displayed, simply swap out the\n `content` property on the controller.\n\n For example, imagine you wanted to display a list of items fetched via an XHR\n request. Create an Ember.ArrayController and set its `content` property:\n\n MyApp.listController = Ember.ArrayController.create();\n\n $.get('people.json', function(data) {\n MyApp.listController.set('content', data);\n });\n\n Then, create a view that binds to your new controller:\n\n {{#each MyApp.listController}}\n {{firstName}} {{lastName}}\n {{/each}}\n\n Although you are binding to the controller, the behavior of this controller\n is to pass through any methods or properties to the underlying array. This\n capability comes from `Ember.ArrayProxy`, which this class inherits from.\n\n Note: As of this writing, `ArrayController` does not add any functionality\n to its superclass, `ArrayProxy`. The Ember team plans to add additional\n controller-specific functionality in the future, e.g. single or multiple\n selection support. If you are creating something that is conceptually a\n controller, use this class.\n\n @extends Ember.ArrayProxy\n*/\n\nEmber.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,\n Ember.SortableMixin);\n\n})();\n\n\n\n(function() {\nEmber.ObjectController = Ember.ObjectProxy.extend(Ember.ControllerMixin);\n\n})();\n\n\n\n(function() {\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n An Ember.Application instance serves as the namespace in which you define your\n application's classes. You can also override the configuration of your\n application.\n\n By default, Ember.Application will begin listening for events on the document.\n If your application is embedded inside a page, instead of controlling the\n entire document, you can specify which DOM element to attach to by setting\n the `rootElement` property:\n\n MyApp = Ember.Application.create({\n rootElement: $('#my-app')\n });\n\n The root of an Ember.Application must not be removed during the course of the\n page's lifetime. If you have only a single conceptual application for the\n entire page, and are not embedding any third-party Ember applications\n in your page, use the default document root for your application.\n\n You only need to specify the root if your page contains multiple instances\n of Ember.Application.\n\n @extends Ember.Object\n*/\nEmber.Application = Ember.Namespace.extend(\n/** @scope Ember.Application.prototype */{\n\n /**\n The root DOM element of the Application.\n\n Can be specified as DOMElement or a selector string.\n\n @type DOMElement\n @default 'body'\n */\n rootElement: 'body',\n\n /**\n @type Ember.EventDispatcher\n @default null\n */\n eventDispatcher: null,\n\n /**\n @type Object\n @default null\n */\n customEvents: null,\n\n /** @private */\n init: function() {\n var eventDispatcher,\n rootElement = get(this, 'rootElement');\n this._super();\n\n eventDispatcher = Ember.EventDispatcher.create({\n rootElement: rootElement\n });\n\n set(this, 'eventDispatcher', eventDispatcher);\n\n // jQuery 1.7 doesn't call the ready callback if already ready\n if (Ember.$.isReady) {\n Ember.run.once(this, this.didBecomeReady);\n } else {\n var self = this;\n Ember.$(document).ready(function() {\n Ember.run.once(self, self.didBecomeReady);\n });\n }\n },\n\n /**\n Instantiate all controllers currently available on the namespace\n and inject them onto a router.\n\n Example:\n\n App.PostsController = Ember.ArrayController.extend();\n App.CommentsController = Ember.ArrayController.extend();\n\n var router = Ember.Router.create({\n ...\n });\n\n App.initialize(router);\n\n router.get('postsController') // \n router.get('commentsController') // \n\n router.get('postsController.router') // router\n */\n initialize: function(router) {\n var properties = Ember.A(Ember.keys(this)),\n injections = get(this.constructor, 'injections'),\n namespace = this, controller, name;\n\n if (!router && Ember.Router.detect(namespace['Router'])) {\n router = namespace['Router'].create();\n this._createdRouter = router;\n }\n\n if (router) {\n set(this, 'router', router);\n\n // By default, the router's namespace is the current application.\n //\n // This allows it to find model classes when a state has a\n // route like `/posts/:post_id`. In that case, it would first\n // convert `post_id` into `Post`, and then look it up on its\n // namespace.\n set(router, 'namespace', this);\n }\n\n Ember.runLoadHooks('application', this);\n\n injections.forEach(function(injection) {\n properties.forEach(function(property) {\n injection[1](namespace, router, property);\n });\n });\n\n if (router && router instanceof Ember.Router) {\n this.startRouting(router);\n }\n },\n\n /** @private */\n didBecomeReady: function() {\n var eventDispatcher = get(this, 'eventDispatcher'),\n customEvents = get(this, 'customEvents');\n\n eventDispatcher.setup(customEvents);\n\n this.ready();\n },\n\n /**\n @private\n\n If the application has a router, use it to route to the current URL, and\n trigger a new call to `route` whenever the URL changes.\n */\n startRouting: function(router) {\n var location = get(router, 'location'),\n rootElement = get(this, 'rootElement'),\n applicationController = get(router, 'applicationController');\n\n Ember.assert(\"ApplicationView and ApplicationController must be defined on your application\", (this.ApplicationView && applicationController) );\n\n var applicationView = this.ApplicationView.create({\n controller: applicationController\n });\n this._createdApplicationView = applicationView;\n\n applicationView.appendTo(rootElement);\n\n router.route(location.getURL());\n location.onUpdateURL(function(url) {\n router.route(url);\n });\n },\n\n /**\n Called when the Application has become ready.\n The call will be delayed until the DOM has become ready.\n */\n ready: Ember.K,\n\n /** @private */\n willDestroy: function() {\n get(this, 'eventDispatcher').destroy();\n if (this._createdRouter) { this._createdRouter.destroy(); }\n if (this._createdApplicationView) { this._createdApplicationView.destroy(); }\n },\n\n registerInjection: function(options) {\n this.constructor.registerInjection(options);\n }\n});\n\nEmber.Application.reopenClass({\n concatenatedProperties: ['injections'],\n injections: Ember.A(),\n registerInjection: function(options) {\n var injections = get(this, 'injections'),\n before = options.before,\n name = options.name,\n injection = options.injection,\n location;\n\n if (before) {\n location = injections.find(function(item) {\n if (item[0] === before) { return true; }\n });\n location = injections.indexOf(location);\n } else {\n location = get(injections, 'length');\n }\n\n injections.splice(location, 0, [name, injection]);\n }\n});\n\nEmber.Application.registerInjection({\n name: 'controllers',\n injection: function(app, router, property) {\n if (!/^[A-Z].*Controller$/.test(property)) { return; }\n\n var name = property.charAt(0).toLowerCase() + property.substr(1),\n controller = app[property].create();\n\n router.set(name, controller);\n\n controller.setProperties({\n target: router,\n controllers: router,\n namespace: app\n });\n }\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\n/**\n This file implements the `location` API used by Ember's router.\n\n That API is:\n\n getURL: returns the current URL\n setURL(path): sets the current URL\n onUpdateURL(callback): triggers the callback when the URL changes\n formatURL(url): formats `url` to be placed into `href` attribute\n\n Calling setURL will not trigger onUpdateURL callbacks.\n\n TODO: This, as well as the Ember.Location documentation below, should\n perhaps be moved so that it's visible in the JsDoc output.\n*/\n/**\n Ember.Location returns an instance of the correct implementation of\n the `location` API.\n\n You can pass it a `implementation` ('hash', 'history', 'none') to force a\n particular implementation.\n*/\nEmber.Location = {\n create: function(options) {\n var implementation = options && options.implementation;\n Ember.assert(\"Ember.Location.create: you must specify a 'implementation' option\", !!implementation);\n\n var implementationClass = this.implementations[implementation];\n Ember.assert(\"Ember.Location.create: \" + implementation + \" is not a valid implementation\", !!implementationClass);\n\n return implementationClass.create.apply(implementationClass, arguments);\n },\n\n registerImplementation: function(name, implementation) {\n this.implementations[name] = implementation;\n },\n\n implementations: {}\n};\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\n/**\n Ember.HashLocation implements the location API using the browser's\n hash. At present, it relies on a hashchange event existing in the\n browser.\n*/\nEmber.HashLocation = Ember.Object.extend({\n init: function() {\n set(this, 'location', get(this, 'location') || window.location);\n },\n\n /**\n @private\n\n Returns the current `location.hash`, minus the '#' at the front.\n */\n getURL: function() {\n return get(this, 'location').hash.substr(1);\n },\n\n /**\n @private\n\n Set the `location.hash` and remembers what was set. This prevents\n `onUpdateURL` callbacks from triggering when the hash was set by\n `HashLocation`.\n */\n setURL: function(path) {\n get(this, 'location').hash = path;\n set(this, 'lastSetURL', path);\n },\n\n /**\n @private\n\n Register a callback to be invoked when the hash changes. These\n callbacks will execute when the user presses the back or forward\n button, but not after `setURL` is invoked.\n */\n onUpdateURL: function(callback) {\n var self = this;\n var guid = Ember.guidFor(this);\n\n Ember.$(window).bind('hashchange.ember-location-'+guid, function() {\n var path = location.hash.substr(1);\n if (get(self, 'lastSetURL') === path) { return; }\n\n set(self, 'lastSetURL', null);\n\n callback(location.hash.substr(1));\n });\n },\n\n /**\n @private\n\n Given a URL, formats it to be placed into the page as part\n of an element's `href` attribute.\n\n This is used, for example, when using the {{action}} helper\n to generate a URL based on an event.\n */\n formatURL: function(url) {\n return '#'+url;\n },\n\n willDestroy: function() {\n var guid = Ember.guidFor(this);\n\n Ember.$(window).unbind('hashchange.ember-location-'+guid);\n }\n});\n\nEmber.Location.registerImplementation('hash', Ember.HashLocation);\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\n/**\n Ember.HistoryLocation implements the location API using the browser's\n history.pushState API.\n*/\nEmber.HistoryLocation = Ember.Object.extend({\n init: function() {\n set(this, 'location', get(this, 'location') || window.location);\n set(this, '_initialURL', get(this, 'location').pathname);\n },\n\n /**\n Will be pre-pended to path upon state change\n */\n rootURL: '/',\n\n /**\n @private\n\n Used to give history a starting reference\n */\n _initialURL: null,\n\n /**\n @private\n\n Returns the current `location.pathname`.\n */\n getURL: function() {\n return get(this, 'location').pathname;\n },\n\n /**\n @private\n\n Uses `history.pushState` to update the url without a page reload.\n */\n setURL: function(path) {\n var state = window.history.state,\n initialURL = get(this, '_initialURL');\n\n path = this.formatPath(path);\n\n if ((initialURL && initialURL !== path) || (state && state.path !== path)) {\n set(this, '_initialURL', null);\n window.history.pushState({ path: path }, null, path);\n }\n },\n\n /**\n @private\n\n Register a callback to be invoked whenever the browser\n history changes, including using forward and back buttons.\n */\n onUpdateURL: function(callback) {\n var guid = Ember.guidFor(this);\n\n Ember.$(window).bind('popstate.ember-location-'+guid, function(e) {\n callback(location.pathname);\n });\n },\n\n /**\n @private\n\n returns the given path appended to rootURL\n */\n formatPath: function(path) {\n var rootURL = get(this, 'rootURL');\n\n if (path !== '') {\n rootURL = rootURL.replace(/\\/$/, '');\n }\n\n return rootURL + path;\n },\n\n /**\n @private\n\n Used when using {{action}} helper. Since no formatting\n is required we just return the url given.\n */\n formatURL: function(url) {\n return url;\n },\n\n willDestroy: function() {\n var guid = Ember.guidFor(this);\n\n Ember.$(window).unbind('popstate.ember-location-'+guid);\n }\n});\n\nEmber.Location.registerImplementation('history', Ember.HistoryLocation);\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\n/**\n Ember.NoneLocation does not interact with the browser. It is useful for\n testing, or when you need to manage state with your Router, but temporarily\n don't want it to muck with the URL (for example when you embed your\n application in a larger page).\n*/\nEmber.NoneLocation = Ember.Object.extend({\n path: '',\n\n getURL: function() {\n return get(this, 'path');\n },\n\n setURL: function(path) {\n set(this, 'path', path);\n },\n\n onUpdateURL: function(callback) {\n // We are not wired up to the browser, so we'll never trigger the callback.\n },\n\n formatURL: function(url) {\n // The return value is not overly meaningful, but we do not want to throw\n // errors when test code renders templates containing {{action href=true}}\n // helpers.\n return url;\n }\n});\n\nEmber.Location.registerImplementation('none', Ember.NoneLocation);\n\n})();\n\n\n\n(function() {\n\n})();\n\n\n\n(function() {\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nEmber.assert(\"Ember Views require jQuery 1.7\", window.jQuery && (window.jQuery().jquery.match(/^1\\.7(\\.\\d+)?(pre|rc\\d?)?/) || Ember.ENV.FORCE_JQUERY));\nEmber.$ = window.jQuery;\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n// http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dndevents\nvar dragEvents = Ember.String.w('dragstart drag dragenter dragleave dragover drop dragend');\n\n// Copies the `dataTransfer` property from a browser event object onto the\n// jQuery event object for the specified events\nEmber.EnumerableUtils.forEach(dragEvents, function(eventName) {\n Ember.$.event.fixHooks[eventName] = { props: ['dataTransfer'] };\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set;\nvar indexOf = Ember.ArrayPolyfills.indexOf;\n\n/** @private */\nvar ClassSet = function() {\n this.seen = {};\n this.list = [];\n};\n\nClassSet.prototype = {\n add: function(string) {\n if (string in this.seen) { return; }\n this.seen[string] = true;\n\n this.list.push(string);\n },\n\n toDOM: function() {\n return this.list.join(\" \");\n }\n};\n\n/**\n @class\n\n Ember.RenderBuffer gathers information regarding the a view and generates the\n final representation. Ember.RenderBuffer will generate HTML which can be pushed\n to the DOM.\n\n @extends Ember.Object\n*/\nEmber.RenderBuffer = function(tagName) {\n return new Ember._RenderBuffer(tagName);\n};\n\nEmber._RenderBuffer = function(tagName) {\n this.elementTag = tagName;\n this.childBuffers = [];\n};\n\nEmber._RenderBuffer.prototype =\n/** @scope Ember.RenderBuffer.prototype */ {\n\n /**\n Array of class-names which will be applied in the class=\"\" attribute\n\n You should not maintain this array yourself, rather, you should use\n the addClass() method of Ember.RenderBuffer.\n\n @type Array\n @default []\n */\n elementClasses: null,\n\n /**\n The id in of the element, to be applied in the id=\"\" attribute\n\n You should not set this property yourself, rather, you should use\n the id() method of Ember.RenderBuffer.\n\n @type String\n @default null\n */\n elementId: null,\n\n /**\n A hash keyed on the name of the attribute and whose value will be\n applied to that attribute. For example, if you wanted to apply a\n data-view=\"Foo.bar\" property to an element, you would set the\n elementAttributes hash to {'data-view':'Foo.bar'}\n\n You should not maintain this hash yourself, rather, you should use\n the attr() method of Ember.RenderBuffer.\n\n @type Hash\n @default {}\n */\n elementAttributes: null,\n\n /**\n The tagname of the element an instance of Ember.RenderBuffer represents.\n\n Usually, this gets set as the first parameter to Ember.RenderBuffer. For\n example, if you wanted to create a `p` tag, then you would call\n\n Ember.RenderBuffer('p')\n\n @type String\n @default null\n */\n elementTag: null,\n\n /**\n A hash keyed on the name of the style attribute and whose value will\n be applied to that attribute. For example, if you wanted to apply a\n background-color:black;\" style to an element, you would set the\n elementStyle hash to {'background-color':'black'}\n\n You should not maintain this hash yourself, rather, you should use\n the style() method of Ember.RenderBuffer.\n\n @type Hash\n @default {}\n */\n elementStyle: null,\n\n /**\n Nested RenderBuffers will set this to their parent RenderBuffer\n instance.\n\n @type Ember._RenderBuffer\n */\n parentBuffer: null,\n\n /**\n Adds a string of HTML to the RenderBuffer.\n\n @param {String} string HTML to push into the buffer\n @returns {Ember.RenderBuffer} this\n */\n push: function(string) {\n this.childBuffers.push(String(string));\n return this;\n },\n\n /**\n Adds a class to the buffer, which will be rendered to the class attribute.\n\n @param {String} className Class name to add to the buffer\n @returns {Ember.RenderBuffer} this\n */\n addClass: function(className) {\n // lazily create elementClasses\n var elementClasses = this.elementClasses = (this.elementClasses || new ClassSet());\n this.elementClasses.add(className);\n\n return this;\n },\n\n /**\n Sets the elementID to be used for the element.\n\n @param {String} id\n @returns {Ember.RenderBuffer} this\n */\n id: function(id) {\n this.elementId = id;\n return this;\n },\n\n // duck type attribute functionality like jQuery so a render buffer\n // can be used like a jQuery object in attribute binding scenarios.\n\n /**\n Adds an attribute which will be rendered to the element.\n\n @param {String} name The name of the attribute\n @param {String} value The value to add to the attribute\n @returns {Ember.RenderBuffer|String} this or the current attribute value\n */\n attr: function(name, value) {\n var attributes = this.elementAttributes = (this.elementAttributes || {});\n\n if (arguments.length === 1) {\n return attributes[name];\n } else {\n attributes[name] = value;\n }\n\n return this;\n },\n\n /**\n Remove an attribute from the list of attributes to render.\n\n @param {String} name The name of the attribute\n @returns {Ember.RenderBuffer} this\n */\n removeAttr: function(name) {\n var attributes = this.elementAttributes;\n if (attributes) { delete attributes[name]; }\n\n return this;\n },\n\n /**\n Adds a style to the style attribute which will be rendered to the element.\n\n @param {String} name Name of the style\n @param {String} value\n @returns {Ember.RenderBuffer} this\n */\n style: function(name, value) {\n var style = this.elementStyle = (this.elementStyle || {});\n\n this.elementStyle[name] = value;\n return this;\n },\n\n /**\n Create a new child render buffer from a parent buffer. Optionally set\n additional properties on the buffer. Optionally invoke a callback\n with the newly created buffer.\n\n This is a primitive method used by other public methods: `begin`,\n `prepend`, `replaceWith`, `insertAfter`.\n\n @private\n @param {String} tagName Tag name to use for the child buffer's element\n @param {Ember._RenderBuffer} parent The parent render buffer that this\n buffer should be appended to.\n @param {Function} fn A callback to invoke with the newly created buffer.\n @param {Object} other Additional properties to add to the newly created\n buffer.\n */\n newBuffer: function(tagName, parent, fn, other) {\n var buffer = new Ember._RenderBuffer(tagName);\n buffer.parentBuffer = parent;\n\n if (other) { Ember.$.extend(buffer, other); }\n if (fn) { fn.call(this, buffer); }\n\n return buffer;\n },\n\n /**\n Replace the current buffer with a new buffer. This is a primitive\n used by `remove`, which passes `null` for `newBuffer`, and `replaceWith`,\n which passes the new buffer it created.\n\n @private\n @param {Ember._RenderBuffer} buffer The buffer to insert in place of\n the existing buffer.\n */\n replaceWithBuffer: function(newBuffer) {\n var parent = this.parentBuffer;\n if (!parent) { return; }\n\n var childBuffers = parent.childBuffers;\n\n var index = indexOf.call(childBuffers, this);\n\n if (newBuffer) {\n childBuffers.splice(index, 1, newBuffer);\n } else {\n childBuffers.splice(index, 1);\n }\n },\n\n /**\n Creates a new Ember.RenderBuffer object with the provided tagName as\n the element tag and with its parentBuffer property set to the current\n Ember.RenderBuffer.\n\n @param {String} tagName Tag name to use for the child buffer's element\n @returns {Ember.RenderBuffer} A new RenderBuffer object\n */\n begin: function(tagName) {\n return this.newBuffer(tagName, this, function(buffer) {\n this.childBuffers.push(buffer);\n });\n },\n\n /**\n Prepend a new child buffer to the current render buffer.\n\n @param {String} tagName Tag name to use for the child buffer's element\n */\n prepend: function(tagName) {\n return this.newBuffer(tagName, this, function(buffer) {\n this.childBuffers.splice(0, 0, buffer);\n });\n },\n\n /**\n Replace the current buffer with a new render buffer.\n\n @param {String} tagName Tag name to use for the new buffer's element\n */\n replaceWith: function(tagName) {\n var parentBuffer = this.parentBuffer;\n\n return this.newBuffer(tagName, parentBuffer, function(buffer) {\n this.replaceWithBuffer(buffer);\n });\n },\n\n /**\n Insert a new render buffer after the current render buffer.\n\n @param {String} tagName Tag name to use for the new buffer's element\n */\n insertAfter: function(tagName) {\n var parentBuffer = get(this, 'parentBuffer');\n\n return this.newBuffer(tagName, parentBuffer, function(buffer) {\n var siblings = parentBuffer.childBuffers;\n var index = indexOf.call(siblings, this);\n siblings.splice(index + 1, 0, buffer);\n });\n },\n\n /**\n Closes the current buffer and adds its content to the parentBuffer.\n\n @returns {Ember.RenderBuffer} The parentBuffer, if one exists. Otherwise, this\n */\n end: function() {\n var parent = this.parentBuffer;\n return parent || this;\n },\n\n remove: function() {\n this.replaceWithBuffer(null);\n },\n\n /**\n @returns {DOMElement} The element corresponding to the generated HTML\n of this buffer\n */\n element: function() {\n return Ember.$(this.string())[0];\n },\n\n /**\n Generates the HTML content for this buffer.\n\n @returns {String} The generated HTMl\n */\n string: function() {\n var content = '', tag = this.elementTag, openTag;\n\n if (tag) {\n var id = this.elementId,\n classes = this.elementClasses,\n attrs = this.elementAttributes,\n style = this.elementStyle,\n styleBuffer = '', prop;\n\n openTag = [\"<\" + tag];\n\n if (id) { openTag.push('id=\"' + this._escapeAttribute(id) + '\"'); }\n if (classes) { openTag.push('class=\"' + this._escapeAttribute(classes.toDOM()) + '\"'); }\n\n if (style) {\n for (prop in style) {\n if (style.hasOwnProperty(prop)) {\n styleBuffer += (prop + ':' + this._escapeAttribute(style[prop]) + ';');\n }\n }\n\n openTag.push('style=\"' + styleBuffer + '\"');\n }\n\n if (attrs) {\n for (prop in attrs) {\n if (attrs.hasOwnProperty(prop)) {\n openTag.push(prop + '=\"' + this._escapeAttribute(attrs[prop]) + '\"');\n }\n }\n }\n\n openTag = openTag.join(\" \") + '>';\n }\n\n var childBuffers = this.childBuffers;\n\n Ember.ArrayPolyfills.forEach.call(childBuffers, function(buffer) {\n var stringy = typeof buffer === 'string';\n content += (stringy ? buffer : buffer.string());\n });\n\n if (tag) {\n return openTag + content + \"\";\n } else {\n return content;\n }\n },\n\n _escapeAttribute: function(value) {\n // Stolen shamelessly from Handlebars\n\n var escape = {\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n \"`\": \"`\"\n };\n\n var badChars = /&(?!\\w+;)|[<>\"'`]/g;\n var possible = /[&<>\"'`]/;\n\n var escapeChar = function(chr) {\n return escape[chr] || \"&\";\n };\n\n var string = value.toString();\n\n if(!possible.test(string)) { return string; }\n return string.replace(badChars, escapeChar);\n }\n\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\n\n/**\n @ignore\n\n Ember.EventDispatcher handles delegating browser events to their corresponding\n Ember.Views. For example, when you click on a view, Ember.EventDispatcher ensures\n that that view's `mouseDown` method gets called.\n*/\nEmber.EventDispatcher = Ember.Object.extend(\n/** @scope Ember.EventDispatcher.prototype */{\n\n /**\n @private\n\n The root DOM element to which event listeners should be attached. Event\n listeners will be attached to the document unless this is overridden.\n\n Can be specified as a DOMElement or a selector string.\n\n The default body is a string since this may be evaluated before document.body\n exists in the DOM.\n\n @type DOMElement\n @default 'body'\n */\n rootElement: 'body',\n\n /**\n @private\n\n Sets up event listeners for standard browser events.\n\n This will be called after the browser sends a DOMContentReady event. By\n default, it will set up all of the listeners on the document body. If you\n would like to register the listeners on a different element, set the event\n dispatcher's `root` property.\n */\n setup: function(addedEvents) {\n var event, events = {\n touchstart : 'touchStart',\n touchmove : 'touchMove',\n touchend : 'touchEnd',\n touchcancel : 'touchCancel',\n keydown : 'keyDown',\n keyup : 'keyUp',\n keypress : 'keyPress',\n mousedown : 'mouseDown',\n mouseup : 'mouseUp',\n contextmenu : 'contextMenu',\n click : 'click',\n dblclick : 'doubleClick',\n mousemove : 'mouseMove',\n focusin : 'focusIn',\n focusout : 'focusOut',\n mouseenter : 'mouseEnter',\n mouseleave : 'mouseLeave',\n submit : 'submit',\n input : 'input',\n change : 'change',\n dragstart : 'dragStart',\n drag : 'drag',\n dragenter : 'dragEnter',\n dragleave : 'dragLeave',\n dragover : 'dragOver',\n drop : 'drop',\n dragend : 'dragEnd'\n };\n\n Ember.$.extend(events, addedEvents || {});\n\n var rootElement = Ember.$(get(this, 'rootElement'));\n\n Ember.assert(fmt('You cannot use the same root element (%@) multiple times in an Ember.Application', [rootElement.selector || rootElement[0].tagName]), !rootElement.is('.ember-application'));\n Ember.assert('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest('.ember-application').length);\n Ember.assert('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.find('.ember-application').length);\n\n rootElement.addClass('ember-application');\n\n Ember.assert('Unable to add \"ember-application\" class to rootElement. Make sure you set rootElement to the body or an element in the body.', rootElement.is('.ember-application'));\n\n for (event in events) {\n if (events.hasOwnProperty(event)) {\n this.setupHandler(rootElement, event, events[event]);\n }\n }\n },\n\n /**\n @private\n\n Registers an event listener on the document. If the given event is\n triggered, the provided event handler will be triggered on the target\n view.\n\n If the target view does not implement the event handler, or if the handler\n returns false, the parent view will be called. The event will continue to\n bubble to each successive parent view until it reaches the top.\n\n For example, to have the `mouseDown` method called on the target view when\n a `mousedown` event is received from the browser, do the following:\n\n setupHandler('mousedown', 'mouseDown');\n\n @param {String} event the browser-originated event to listen to\n @param {String} eventName the name of the method to call on the view\n */\n setupHandler: function(rootElement, event, eventName) {\n var self = this;\n\n rootElement.delegate('.ember-view', event + '.ember', function(evt, triggeringManager) {\n\n var view = Ember.View.views[this.id],\n result = true, manager = null;\n\n manager = self._findNearestEventManager(view,eventName);\n\n if (manager && manager !== triggeringManager) {\n result = self._dispatchEvent(manager, evt, eventName, view);\n } else if (view) {\n result = self._bubbleEvent(view,evt,eventName);\n } else {\n evt.stopPropagation();\n }\n\n return result;\n });\n\n rootElement.delegate('[data-ember-action]', event + '.ember', function(evt) {\n var actionId = Ember.$(evt.currentTarget).attr('data-ember-action'),\n action = Ember.Handlebars.ActionHelper.registeredActions[actionId],\n handler = action.handler;\n\n if (action.eventName === eventName) {\n return handler(evt);\n }\n });\n },\n\n /** @private */\n _findNearestEventManager: function(view, eventName) {\n var manager = null;\n\n while (view) {\n manager = get(view, 'eventManager');\n if (manager && manager[eventName]) { break; }\n\n view = get(view, 'parentView');\n }\n\n return manager;\n },\n\n /** @private */\n _dispatchEvent: function(object, evt, eventName, view) {\n var result = true;\n\n var handler = object[eventName];\n if (Ember.typeOf(handler) === 'function') {\n result = handler.call(object, evt, view);\n // Do not preventDefault in eventManagers.\n evt.stopPropagation();\n }\n else {\n result = this._bubbleEvent(view, evt, eventName);\n }\n\n return result;\n },\n\n /** @private */\n _bubbleEvent: function(view, evt, eventName) {\n return Ember.run(function() {\n return view.handleEvent(eventName, evt);\n });\n },\n\n /** @private */\n destroy: function() {\n var rootElement = get(this, 'rootElement');\n Ember.$(rootElement).undelegate('.ember').removeClass('ember-application');\n return this._super();\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n// Add a new named queue for rendering views that happens\n// after bindings have synced.\nvar queues = Ember.run.queues;\nqueues.splice(Ember.$.inArray('actions', queues)+1, 0, 'render');\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\nEmber.ControllerMixin.reopen({\n\n target: null,\n controllers: null,\n namespace: null,\n view: null,\n\n /**\n `connectOutlet` creates a new instance of a provided view\n class, wires it up to its associated controller, and\n assigns the new view to a property on the current controller.\n\n The purpose of this method is to enable views that use\n outlets to quickly assign new views for a given outlet.\n\n For example, an application view's template may look like\n this:\n\n

My Blog

\n {{outlet}}\n\n The view for this outlet is specified by assigning a\n `view` property to the application's controller. The\n following code will assign a new `App.PostsView` to\n that outlet:\n\n applicationController.connectOutlet('posts');\n\n In general, you will also want to assign a controller\n to the newly created view. By convention, a controller\n named `postsController` will be assigned as the view's\n controller.\n\n In an application initialized using `app.initialize(router)`,\n `connectOutlet` will look for `postsController` on the\n router. The initialization process will automatically\n create an instance of `App.PostsController` called\n `postsController`, so you don't need to do anything\n beyond `connectOutlet` to assign your view and wire it\n up to its associated controller.\n\n You can supply a `content` for the controller by supplying\n a final argument after the view class:\n\n applicationController.connectOutlet('posts', App.Post.find());\n\n You can specify a particular outlet to use. For example, if your main\n template looks like:\n\n

My Blog

\n {{outlet master}}\n {{outlet detail}}\n\n You can assign an `App.PostsView` to the master outlet:\n\n applicationController.connectOutlet({\n name: 'posts',\n outletName: 'master',\n context: App.Post.find()\n });\n\n You can write this as:\n\n applicationController.connectOutlet('master', 'posts', App.Post.find());\n\n @param {String} outletName a name for the outlet to set\n @param {String} name a view/controller pair name\n @param {Object} context a context object to assign to the\n controller's `content` property, if a controller can be\n found (optional)\n */\n connectOutlet: function(name, context) {\n // Normalize arguments. Supported arguments:\n //\n // name\n // name, context\n // outletName, name\n // outletName, name, context\n // options\n //\n // The options hash has the following keys:\n //\n // name: the name of the controller and view\n // to use. If this is passed, the name\n // determines the view and controller.\n // outletName: the name of the outlet to\n // fill in. default: 'view'\n // viewClass: the class of the view to instantiate\n // controller: the controller instance to pass\n // to the view\n // context: an object that should become the\n // controller's `content` and thus the\n // template's context.\n\n var outletName, viewClass, view, controller, options;\n\n if (Ember.typeOf(context) === 'string') {\n outletName = name;\n name = context;\n context = arguments[2];\n }\n\n if (arguments.length === 1) {\n if (Ember.typeOf(name) === 'object') {\n options = name;\n outletName = options.outletName;\n name = options.name;\n viewClass = options.viewClass;\n controller = options.controller;\n context = options.context;\n }\n } else {\n options = {};\n }\n\n outletName = outletName || 'view';\n\n Ember.assert(\"You must supply a name or a view class to connectOutlets, but not both\", (!!name && !viewClass && !controller) || (!name && !!viewClass));\n\n if (name) {\n var namespace = get(this, 'namespace'),\n controllers = get(this, 'controllers');\n\n var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + \"View\";\n viewClass = get(namespace, viewClassName);\n controller = get(controllers, name + 'Controller');\n\n Ember.assert(\"The name you supplied \" + name + \" did not resolve to a view \" + viewClassName, !!viewClass);\n Ember.assert(\"The name you supplied \" + name + \" did not resolve to a controller \" + name + 'Controller', (!!controller && !!context) || !context);\n }\n\n if (controller && context) { controller.set('content', context); }\n view = viewClass.create();\n if (controller) { set(view, 'controller', controller); }\n set(this, outletName, view);\n\n return view;\n },\n\n /**\n Convenience method to connect controllers. This method makes other controllers\n available on the controller the method was invoked on.\n\n For example, to make the `personController` and the `postController` available\n on the `overviewController`, you would call:\n\n overviewController.connectControllers('person', 'post');\n\n @param {String...} controllerNames the controllers to make available\n */\n connectControllers: function() {\n var controllers = get(this, 'controllers'),\n controllerNames = Array.prototype.slice.apply(arguments),\n controllerName;\n\n for (var i=0, l=controllerNames.length; i\n\n ## HTML `class` Attribute\n The HTML `class` attribute of a view's tag can be set by providing a `classNames` property\n that is set to an array of strings:\n\n MyView = Ember.View.extend({\n classNames: ['my-class', 'my-other-class']\n })\n\n Will result in view instances with an HTML representation of:\n\n
\n\n `class` attribute values can also be set by providing a `classNameBindings` property\n set to an array of properties names for the view. The return value of these properties \n will be added as part of the value for the view's `class` attribute. These properties\n can be computed properties:\n\n MyView = Ember.View.extend({\n classNameBindings: ['propertyA', 'propertyB'],\n propertyA: 'from-a',\n propertyB: function(){\n if(someLogic){ return 'from-b'; }\n }.property()\n })\n\n Will result in view instances with an HTML representation of:\n\n
\n\n If the value of a class name binding returns a boolean the property name itself\n will be used as the class name if the property is true. The class name will\n not be added if the value is `false` or `undefined`.\n\n MyView = Ember.View.extend({\n classNameBindings: ['hovered'],\n hovered: true\n })\n\n Will result in view instances with an HTML representation of:\n\n
\n\n When using boolean class name bindings you can supply a string value other than the \n property name for use as the `class` HTML attribute by appending the preferred value after\n a \":\" character when defining the binding:\n\n MyView = Ember.View.extend({\n classNameBindings: ['awesome:so-very-cool'],\n awesome: true\n })\n\n Will result in view instances with an HTML representation of:\n\n
\n\n\n Boolean value class name bindings whose property names are in a camelCase-style\n format will be converted to a dasherized format:\n\n MyView = Ember.View.extend({\n classNameBindings: ['isUrgent'],\n isUrgent: true\n })\n\n Will result in view instances with an HTML representation of:\n\n
\n\n\n Class name bindings can also refer to object values that are found by\n traversing a path relative to the view itself:\n\n MyView = Ember.View.extend({\n classNameBindings: ['messages.empty']\n messages: Ember.Object.create({\n empty: true\n })\n })\n\n Will result in view instances with an HTML representation of:\n\n
\n\n\n If you want to add a class name for a property which evaluates to true and\n and a different class name if it evaluates to false, you can pass a binding\n like this:\n\n // Applies 'enabled' class when isEnabled is true and 'disabled' when isEnabled is false\n Ember.View.create({\n classNameBindings: ['isEnabled:enabled:disabled']\n isEnabled: true\n });\n\n Will result in view instances with an HTML representation of:\n\n
\n\n When isEnabled is `false`, the resulting HTML reprensentation looks like this:\n\n
\n\n This syntax offers the convenience to add a class if a property is `false`:\n\n // Applies no class when isEnabled is true and class 'disabled' when isEnabled is false\n Ember.View.create({\n classNameBindings: ['isEnabled::disabled']\n isEnabled: true\n });\n\n Will result in view instances with an HTML representation of:\n\n
\n\n When the `isEnabled` property on the view is set to `false`, it will result\n in view instances with an HTML representation of:\n\n
\n\n\n Updates to the the value of a class name binding will result in automatic update \n of the HTML `class` attribute in the view's rendered HTML representation.\n If the value becomes `false` or `undefined` the class name will be removed.\n\n Both `classNames` and `classNameBindings` are concatenated properties. \n See `Ember.Object` documentation for more information about concatenated properties.\n\n ## HTML Attributes\n The HTML attribute section of a view's tag can be set by providing an `attributeBindings`\n property set to an array of property names on the view. The return value of these properties\n will be used as the value of the view's HTML associated attribute:\n\n AnchorView = Ember.View.extend({\n tagName: 'a',\n attributeBindings: ['href'],\n href: 'http://google.com'\n })\n\n Will result in view instances with an HTML representation of:\n\n \n\n If the return value of an `attributeBindings` monitored property is a boolean\n the property will follow HTML's pattern of repeating the attribute's name as\n its value:\n\n MyTextInput = Ember.View.extend({\n tagName: 'input',\n attributeBindings: ['disabled'],\n disabled: true\n })\n\n Will result in view instances with an HTML representation of:\n\n \n\n `attributeBindings` can refer to computed properties:\n\n MyTextInput = Ember.View.extend({\n tagName: 'input',\n attributeBindings: ['disabled'],\n disabled: function(){\n if (someLogic) {\n return true;\n } else {\n return false;\n }\n }.property()\n })\n\n Updates to the the property of an attribute binding will result in automatic update \n of the HTML attribute in the view's rendered HTML representation.\n\n `attributeBindings` is a concatenated property. See `Ember.Object` documentation\n for more information about concatenated properties.\n\n ## Templates\n The HTML contents of a view's rendered representation are determined by its template.\n Templates can be any function that accepts an optional context parameter and returns\n a string of HTML that will be inserted within the view's tag. Most\n typically in Ember this function will be a compiled Ember.Handlebars template.\n\n AView = Ember.View.extend({\n template: Ember.Handlebars.compile('I am the template')\n })\n\n Will result in view instances with an HTML representation of:\n\n
I am the template
\n\n The default context of the compiled template will be the view instance itself:\n\n AView = Ember.View.extend({\n template: Ember.Handlebars.compile('Hello {{excitedGreeting}}')\n })\n\n aView = AView.create({\n content: Ember.Object.create({\n firstName: 'Barry'\n })\n excitedGreeting: function(){\n return this.get(\"content.firstName\") + \"!!!\"\n }\n })\n\n Will result in an HTML representation of:\n\n
Hello Barry!!!
\n\n Within an Ember application is more common to define a Handlebars templates as\n part of a page:\n\n \n\n And associate it by name using a view's `templateName` property:\n\n AView = Ember.View.extend({\n templateName: 'some-template'\n })\n\n Using a value for `templateName` that does not have a Handlebars template with a\n matching `data-template-name` attribute will throw an error.\n\n Assigning a value to both `template` and `templateName` properties will throw an error.\n\n For views classes that may have a template later defined (e.g. as the block portion of a `{{view}}`\n Handlebars helper call in another template or in a subclass), you can provide a `defaultTemplate`\n property set to compiled template function. If a template is not later provided for the view\n instance the `defaultTemplate` value will be used:\n\n AView = Ember.View.extend({\n defaultTemplate: Ember.Handlebars.compile('I was the default'),\n template: null,\n templateName: null\n })\n\n Will result in instances with an HTML representation of:\n\n
I was the default
\n\n If a `template` or `templateName` is provided it will take precedence over `defaultTemplate`:\n\n AView = Ember.View.extend({\n defaultTemplate: Ember.Handlebars.compile('I was the default')\n })\n\n aView = AView.create({\n template: Ember.Handlebars.compile('I was the template, not default')\n })\n\n Will result in the following HTML representation when rendered:\n\n
I was the template, not default
\n\n ## Layouts\n Views can have a secondary template that wraps their main template. Like\n primary templates, layouts can be any function that accepts an optional context\n parameter and returns a string of HTML that will be inserted inside view's tag. Views whose HTML\n element is self closing (e.g. ``) cannot have a layout and this property will be ignored.\n \n Most typically in Ember a layout will be a compiled Ember.Handlebars template.\n\n A view's layout can be set directly with the `layout` property or reference an\n existing Handlebars template by name with the `layoutName` property.\n\n A template used as a layout must contain a single use of the Handlebars `{{yield}}`\n helper. The HTML contents of a view's rendered `template` will be inserted at this location:\n\n AViewWithLayout = Ember.View.extend({\n layout: Ember.Handlebars.compile(\"
{{yield}}
\")\n template: Ember.Handlebars.compile(\"I got wrapped\"),\n })\n\n Will result in view instances with an HTML representation of:\n\n
\n
\n I got wrapped\n
\n
\n\n See `Handlebars.helpers.yield` for more information.\n\n ## Responding to Browser Events\n Views can respond to user-initiated events in one of three ways: method implementation, \n through an event manager, and through `{{action}}` helper use in their template or layout.\n\n ### Method Implementation\n Views can respond to user-initiated events by implementing a method that matches the\n event name. A `jQuery.Event` object will be passed as the argument to this method.\n\n AView = Ember.View.extend({\n click: function(event){\n // will be called when when an instance's\n // rendered element is clicked\n }\n })\n\n ### Event Managers\n Views can define an object as their `eventManager` property. This object can then\n implement methods that match the desired event names. Matching events that occur\n on the view's rendered HTML or the rendered HTML of any of its DOM descendants \n will trigger this method. A `jQuery.Event` object will be passed as the first \n argument to the method and an `Ember.View` object as the second. The `Ember.View`\n will be the view whose rendered HTML was interacted with. This may be the view with\n the `eventManager` property or one of its descendent views.\n\n AView = Ember.View.extend({\n eventManager: Ember.Object.create({\n doubleClick: function(event, view){\n // will be called when when an instance's\n // rendered element or any rendering\n // of this views's descendent\n // elements is clicked\n }\n })\n })\n\n\n An event defined for an event manager takes precedence over events of the same\n name handled through methods on the view.\n\n\n AView = Ember.View.extend({\n mouseEnter: function(event){\n // will never trigger.\n },\n eventManager: Ember.Object.create({\n mouseEnter: function(event, view){\n // takes presedence over AView#mouseEnter\n }\n })\n })\n\n Similarly a view's event manager will take precedence for events of any views\n rendered as a descendent. A method name that matches an event name will not be called\n if the view instance was rendered inside the HTML representation of a view that has \n an `eventManager` property defined that handles events of the name. Events not handled\n by the event manager will still trigger method calls on the descendent.\n\n OuterView = Ember.View.extend({\n template: Ember.Handlebars.compile(\"outer {{#view InnerView}}inner{{/view}} outer\"),\n eventManager: Ember.Object.create({\n mouseEnter: function(event, view){\n // view might be instance of either\n // OutsideView or InnerView depending on\n // where on the page the user interaction occured\n }\n })\n })\n\n InnerView = Ember.View.extend({\n click: function(event){\n // will be called if rendered inside\n // an OuterView because OuterView's\n // eventManager doesn't handle click events\n },\n mouseEnter: function(event){\n // will never be called if rendered inside \n // an OuterView.\n }\n })\n\n ### Handlebars `{{action}}` Helper\n See `Handlebars.helpers.action`.\n\n ### Event Names\n Possible events names for any of the responding approaches described above are:\n\n Touch events: 'touchStart', 'touchMove', 'touchEnd', 'touchCancel'\n\n Keyboard events: 'keyDown', 'keyUp', 'keyPress'\n\n Mouse events: 'mouseDown', 'mouseUp', 'contextMenu', 'click', 'doubleClick', 'mouseMove',\n 'focusIn', 'focusOut', 'mouseEnter', 'mouseLeave'\n\n Form events: 'submit', 'change', 'focusIn', 'focusOut', 'input'\n\n HTML5 drag and drop events: 'dragStart', 'drag', 'dragEnter', 'dragLeave', 'drop', 'dragEnd'\n \n ## Handlebars `{{view}}` Helper\n Other `Ember.View` instances can be included as part of a view's template by using the `{{view}}`\n Handlebars helper. See `Handlebars.helpers.view` for additional information.\n\n @extends Ember.Object\n @extends Ember.Evented\n*/\nEmber.View = Ember.Object.extend(Ember.Evented,\n/** @scope Ember.View.prototype */ {\n\n /** @private */\n concatenatedProperties: ['classNames', 'classNameBindings', 'attributeBindings'],\n\n /**\n @type Boolean\n @default true\n @constant\n */\n isView: true,\n\n // ..........................................................\n // TEMPLATE SUPPORT\n //\n\n /**\n The name of the template to lookup if no template is provided.\n\n Ember.View will look for a template with this name in this view's\n `templates` object. By default, this will be a global object\n shared in `Ember.TEMPLATES`.\n\n @type String\n @default null\n */\n templateName: null,\n\n /**\n The name of the layout to lookup if no layout is provided.\n\n Ember.View will look for a template with this name in this view's\n `templates` object. By default, this will be a global object\n shared in `Ember.TEMPLATES`.\n\n @type String\n @default null\n */\n layoutName: null,\n\n /**\n The hash in which to look for `templateName`.\n\n @type Ember.Object\n @default Ember.TEMPLATES\n */\n templates: Ember.TEMPLATES,\n\n /**\n The template used to render the view. This should be a function that\n accepts an optional context parameter and returns a string of HTML that\n will be inserted into the DOM relative to its parent view.\n\n In general, you should set the `templateName` property instead of setting\n the template yourself.\n\n @field\n @type Function\n */\n template: Ember.computed(function(key, value) {\n if (value !== undefined) { return value; }\n\n var templateName = get(this, 'templateName'),\n template = this.templateForName(templateName, 'template');\n\n return template || get(this, 'defaultTemplate');\n }).property('templateName').cacheable(),\n\n /**\n The controller managing this view. If this property is set, it will be\n made available for use by the template.\n\n @type Object\n */\n controller: Ember.computed(function(key, value) {\n var parentView;\n\n if (arguments.length === 2) {\n return value;\n } else {\n parentView = get(this, 'parentView');\n return parentView ? get(parentView, 'controller') : null;\n }\n }).property().cacheable(),\n\n /**\n A view may contain a layout. A layout is a regular template but\n supersedes the `template` property during rendering. It is the\n responsibility of the layout template to retrieve the `template`\n property from the view (or alternatively, call `Handlebars.helpers.yield`,\n `{{yield}}`) to render it in the correct location.\n\n This is useful for a view that has a shared wrapper, but which delegates\n the rendering of the contents of the wrapper to the `template` property\n on a subclass.\n\n @field\n @type Function\n */\n layout: Ember.computed(function(key, value) {\n if (arguments.length === 2) { return value; }\n\n var layoutName = get(this, 'layoutName'),\n layout = this.templateForName(layoutName, 'layout');\n\n return layout || get(this, 'defaultLayout');\n }).property('layoutName').cacheable(),\n\n templateForName: function(name, type) {\n if (!name) { return; }\n\n var templates = get(this, 'templates'),\n template = get(templates, name);\n\n if (!template) {\n throw new Ember.Error(fmt('%@ - Unable to find %@ \"%@\".', [this, type, name]));\n }\n\n return template;\n },\n\n /**\n The object from which templates should access properties.\n\n This object will be passed to the template function each time the render\n method is called, but it is up to the individual function to decide what\n to do with it.\n\n By default, this will be the view itself.\n\n @type Object\n */\n context: Ember.computed(function(key, value) {\n if (arguments.length === 2) {\n set(this, '_context', value);\n return value;\n } else {\n return get(this, '_context');\n }\n }).cacheable(),\n\n /**\n @private\n\n Private copy of the view's template context. This can be set directly\n by Handlebars without triggering the observer that causes the view\n to be re-rendered.\n\n The context of a view is looked up as follows:\n\n 1. Specified controller\n 2. Supplied context (usually by Handlebars)\n 3. `parentView`'s context (for a child of a ContainerView)\n\n The code in Handlebars that overrides the `_context` property first\n checks to see whether the view has a specified controller. This is\n something of a hack and should be revisited.\n */\n _context: Ember.computed(function(key, value) {\n var parentView, controller, context;\n\n if (arguments.length === 2) {\n return value;\n }\n\n if (VIEW_PRESERVES_CONTEXT) {\n if (controller = get(this, 'controller')) {\n return controller;\n }\n\n parentView = get(this, '_parentView');\n if (parentView) {\n return get(parentView, '_context');\n }\n }\n\n return this;\n }).cacheable(),\n\n /**\n If a value that affects template rendering changes, the view should be\n re-rendered to reflect the new value.\n\n @private\n */\n _displayPropertyDidChange: Ember.observer(function() {\n this.rerender();\n }, 'context', 'controller'),\n\n /**\n If the view is currently inserted into the DOM of a parent view, this\n property will point to the parent of the view.\n\n @type Ember.View\n @default null\n */\n parentView: Ember.computed(function() {\n var parent = get(this, '_parentView');\n\n if (parent && parent.isVirtual) {\n return get(parent, 'parentView');\n } else {\n return parent;\n }\n }).property('_parentView').volatile(),\n\n _parentView: null,\n\n // return the current view, not including virtual views\n concreteView: Ember.computed(function() {\n if (!this.isVirtual) { return this; }\n else { return get(this, 'parentView'); }\n }).property('_parentView').volatile(),\n\n /**\n If false, the view will appear hidden in DOM.\n\n @type Boolean\n @default null\n */\n isVisible: true,\n\n /**\n Array of child views. You should never edit this array directly.\n Instead, use appendChild and removeFromParent.\n\n @private\n @type Array\n @default []\n */\n childViews: childViewsProperty,\n\n _childViews: [],\n\n /**\n When it's a virtual view, we need to notify the parent that their\n childViews will change.\n */\n _childViewsWillChange: Ember.beforeObserver(function() {\n if (this.isVirtual) {\n var parentView = get(this, 'parentView');\n if (parentView) { Ember.propertyWillChange(parentView, 'childViews'); }\n }\n }, 'childViews'),\n\n /**\n When it's a virtual view, we need to notify the parent that their\n childViews did change.\n */\n _childViewsDidChange: Ember.observer(function() {\n if (this.isVirtual) {\n var parentView = get(this, 'parentView');\n if (parentView) { Ember.propertyDidChange(parentView, 'childViews'); }\n }\n }, 'childViews'),\n\n /**\n Return the nearest ancestor that is an instance of the provided\n class.\n\n @param {Class} klass Subclass of Ember.View (or Ember.View itself)\n @returns Ember.View\n */\n nearestInstanceOf: function(klass) {\n var view = get(this, 'parentView');\n\n while (view) {\n if(view instanceof klass) { return view; }\n view = get(view, 'parentView');\n }\n },\n\n /**\n Return the nearest ancestor that has a given property.\n\n @param {String} property A property name\n @returns Ember.View\n */\n nearestWithProperty: function(property) {\n var view = get(this, 'parentView');\n\n while (view) {\n if (property in view) { return view; }\n view = get(view, 'parentView');\n }\n },\n\n /**\n Return the nearest ancestor whose parent is an instance of\n `klass`.\n\n @param {Class} klass Subclass of Ember.View (or Ember.View itself)\n @returns Ember.View\n */\n nearestChildOf: function(klass) {\n var view = get(this, 'parentView');\n\n while (view) {\n if(get(view, 'parentView') instanceof klass) { return view; }\n view = get(view, 'parentView');\n }\n },\n\n /**\n Return the nearest ancestor that is an Ember.CollectionView\n\n @returns Ember.CollectionView\n */\n collectionView: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.CollectionView);\n }).cacheable(),\n\n /**\n Return the nearest ancestor that is a direct child of\n an Ember.CollectionView\n\n @returns Ember.View\n */\n itemView: Ember.computed(function() {\n return this.nearestChildOf(Ember.CollectionView);\n }).cacheable(),\n\n /**\n Return the nearest ancestor that has the property\n `content`.\n\n @returns Ember.View\n */\n contentView: Ember.computed(function() {\n return this.nearestWithProperty('content');\n }).cacheable(),\n\n /**\n @private\n\n When the parent view changes, recursively invalidate\n collectionView, itemView, and contentView\n */\n _parentViewDidChange: Ember.observer(function() {\n if (this.isDestroying) { return; }\n\n this.invokeRecursively(function(view) {\n view.propertyDidChange('collectionView');\n view.propertyDidChange('itemView');\n view.propertyDidChange('contentView');\n });\n\n if (get(this, 'parentView.controller') && !get(this, 'controller')) {\n this.notifyPropertyChange('controller');\n }\n }, '_parentView'),\n\n _controllerDidChange: Ember.observer(function() {\n if (this.isDestroying) { return; }\n\n this.forEachChildView(function(view) {\n view.propertyDidChange('controller');\n });\n }, 'controller'),\n\n cloneKeywords: function() {\n var templateData = get(this, 'templateData');\n\n var keywords = templateData ? Ember.copy(templateData.keywords) : {};\n set(keywords, 'view', get(this, 'concreteView'));\n set(keywords, 'controller', get(this, 'controller'));\n\n return keywords;\n },\n\n /**\n Called on your view when it should push strings of HTML into a\n Ember.RenderBuffer. Most users will want to override the `template`\n or `templateName` properties instead of this method.\n\n By default, Ember.View will look for a function in the `template`\n property and invoke it with the value of `context`. The value of\n `context` will be the view's controller unless you override it.\n\n @param {Ember.RenderBuffer} buffer The render buffer\n */\n render: function(buffer) {\n // If this view has a layout, it is the responsibility of the\n // the layout to render the view's template. Otherwise, render the template\n // directly.\n var template = get(this, 'layout') || get(this, 'template');\n\n if (template) {\n var context = get(this, '_context');\n var keywords = this.cloneKeywords();\n\n var data = {\n view: this,\n buffer: buffer,\n isRenderData: true,\n keywords: keywords\n };\n\n // Invoke the template with the provided template context, which\n // is the view by default. A hash of data is also passed that provides\n // the template with access to the view and render buffer.\n\n Ember.assert('template must be a function. Did you mean to call Ember.Handlebars.compile(\"...\") or specify templateName instead?', typeof template === 'function');\n // The template should write directly to the render buffer instead\n // of returning a string.\n var output = template(context, { data: data });\n\n // If the template returned a string instead of writing to the buffer,\n // push the string onto the buffer.\n if (output !== undefined) { buffer.push(output); }\n }\n },\n\n invokeForState: function(name) {\n var stateName = this.state, args, fn;\n\n // try to find the function for the state in the cache\n if (fn = invokeForState[stateName][name]) {\n args = a_slice.call(arguments);\n args[0] = this;\n\n return fn.apply(this, args);\n }\n\n // otherwise, find and cache the function for this state\n var parent = this, states = parent.states, state;\n\n while (states) {\n state = states[stateName];\n\n while (state) {\n fn = state[name];\n\n if (fn) {\n invokeForState[stateName][name] = fn;\n\n args = a_slice.call(arguments, 1);\n args.unshift(this);\n\n return fn.apply(this, args);\n }\n\n state = state.parentState;\n }\n\n states = states.parent;\n }\n },\n\n /**\n Renders the view again. This will work regardless of whether the\n view is already in the DOM or not. If the view is in the DOM, the\n rendering process will be deferred to give bindings a chance\n to synchronize.\n\n If children were added during the rendering process using `appendChild`,\n `rerender` will remove them, because they will be added again\n if needed by the next `render`.\n\n In general, if the display of your view changes, you should modify\n the DOM element directly instead of manually calling `rerender`, which can\n be slow.\n */\n rerender: function() {\n return this.invokeForState('rerender');\n },\n\n clearRenderedChildren: function() {\n var lengthBefore = this.lengthBeforeRender,\n lengthAfter = this.lengthAfterRender;\n\n // If there were child views created during the last call to render(),\n // remove them under the assumption that they will be re-created when\n // we re-render.\n\n // VIEW-TODO: Unit test this path.\n var childViews = this._childViews;\n for (var i=lengthAfter-1; i>=lengthBefore; i--) {\n if (childViews[i]) { childViews[i].destroy(); }\n }\n },\n\n /**\n @private\n\n Iterates over the view's `classNameBindings` array, inserts the value\n of the specified property into the `classNames` array, then creates an\n observer to update the view's element if the bound property ever changes\n in the future.\n */\n _applyClassNameBindings: function() {\n var classBindings = get(this, 'classNameBindings'),\n classNames = get(this, 'classNames'),\n elem, newClass, dasherizedClass;\n\n if (!classBindings) { return; }\n\n // Loop through all of the configured bindings. These will be either\n // property names ('isUrgent') or property paths relative to the view\n // ('content.isUrgent')\n a_forEach(classBindings, function(binding) {\n\n // Variable in which the old class value is saved. The observer function\n // closes over this variable, so it knows which string to remove when\n // the property changes.\n var oldClass;\n\n // Set up an observer on the context. If the property changes, toggle the\n // class name.\n var observer = function() {\n // Get the current value of the property\n newClass = this._classStringForProperty(binding);\n elem = this.$();\n\n // If we had previously added a class to the element, remove it.\n if (oldClass) {\n elem.removeClass(oldClass);\n // Also remove from classNames so that if the view gets rerendered,\n // the class doesn't get added back to the DOM.\n classNames.removeObject(oldClass);\n }\n\n // If necessary, add a new class. Make sure we keep track of it so\n // it can be removed in the future.\n if (newClass) {\n elem.addClass(newClass);\n oldClass = newClass;\n } else {\n oldClass = null;\n }\n };\n\n // Get the class name for the property at its current value\n dasherizedClass = this._classStringForProperty(binding);\n\n if (dasherizedClass) {\n // Ensure that it gets into the classNames array\n // so it is displayed when we render.\n classNames.push(dasherizedClass);\n\n // Save a reference to the class name so we can remove it\n // if the observer fires. Remember that this variable has\n // been closed over by the observer.\n oldClass = dasherizedClass;\n }\n\n // Extract just the property name from bindings like 'foo:bar'\n var parsedPath = Ember.View._parsePropertyPath(binding);\n addObserver(this, parsedPath.path, observer);\n }, this);\n },\n\n /**\n Iterates through the view's attribute bindings, sets up observers for each,\n then applies the current value of the attributes to the passed render buffer.\n\n @param {Ember.RenderBuffer} buffer\n */\n _applyAttributeBindings: function(buffer) {\n var attributeBindings = get(this, 'attributeBindings'),\n attributeValue, elem, type;\n\n if (!attributeBindings) { return; }\n\n a_forEach(attributeBindings, function(binding) {\n var split = binding.split(':'),\n property = split[0],\n attributeName = split[1] || property;\n\n // Create an observer to add/remove/change the attribute if the\n // JavaScript property changes.\n var observer = function() {\n elem = this.$();\n attributeValue = get(this, property);\n\n Ember.View.applyAttributeBindings(elem, attributeName, attributeValue);\n };\n\n addObserver(this, property, observer);\n\n // Determine the current value and add it to the render buffer\n // if necessary.\n attributeValue = get(this, property);\n Ember.View.applyAttributeBindings(buffer, attributeName, attributeValue);\n }, this);\n },\n\n /**\n @private\n\n Given a property name, returns a dasherized version of that\n property name if the property evaluates to a non-falsy value.\n\n For example, if the view has property `isUrgent` that evaluates to true,\n passing `isUrgent` to this method will return `\"is-urgent\"`.\n */\n _classStringForProperty: function(property) {\n var parsedPath = Ember.View._parsePropertyPath(property);\n var path = parsedPath.path;\n\n var val = get(this, path);\n if (val === undefined && Ember.isGlobalPath(path)) {\n val = get(window, path);\n }\n\n return Ember.View._classStringForValue(path, val, parsedPath.className, parsedPath.falsyClassName);\n },\n\n // ..........................................................\n // ELEMENT SUPPORT\n //\n\n /**\n Returns the current DOM element for the view.\n\n @field\n @type DOMElement\n */\n element: Ember.computed(function(key, value) {\n if (value !== undefined) {\n return this.invokeForState('setElement', value);\n } else {\n return this.invokeForState('getElement');\n }\n }).property('_parentView').cacheable(),\n\n /**\n Returns a jQuery object for this view's element. If you pass in a selector\n string, this method will return a jQuery object, using the current element\n as its buffer.\n\n For example, calling `view.$('li')` will return a jQuery object containing\n all of the `li` elements inside the DOM element of this view.\n\n @param {String} [selector] a jQuery-compatible selector string\n @returns {Ember.CoreQuery} the CoreQuery object for the DOM node\n */\n $: function(sel) {\n return this.invokeForState('$', sel);\n },\n\n /** @private */\n mutateChildViews: function(callback) {\n var childViews = this._childViews,\n idx = childViews.length,\n view;\n\n while(--idx >= 0) {\n view = childViews[idx];\n callback.call(this, view, idx);\n }\n\n return this;\n },\n\n /** @private */\n forEachChildView: function(callback) {\n var childViews = this._childViews;\n\n if (!childViews) { return this; }\n\n var len = childViews.length,\n view, idx;\n\n for(idx = 0; idx < len; idx++) {\n view = childViews[idx];\n callback.call(this, view);\n }\n\n return this;\n },\n\n /**\n Appends the view's element to the specified parent element.\n\n If the view does not have an HTML representation yet, `createElement()`\n will be called automatically.\n\n Note that this method just schedules the view to be appended; the DOM\n element will not be appended to the given element until all bindings have\n finished synchronizing.\n\n This is not typically a function that you will need to call directly\n when building your application. You might consider using Ember.ContainerView\n instead. If you do need to use appendTo, be sure that the target element you\n are providing is associated with an Ember.Application and does not have an\n ancestor element that is associated with an Ember view.\n\n @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object\n @returns {Ember.View} receiver\n */\n appendTo: function(target) {\n // Schedule the DOM element to be created and appended to the given\n // element after bindings have synchronized.\n this._insertElementLater(function() {\n Ember.assert(\"You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead.\", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));\n this.$().appendTo(target);\n });\n\n return this;\n },\n\n /**\n Replaces the content of the specified parent element with this view's element.\n If the view does not have an HTML representation yet, `createElement()`\n will be called automatically.\n\n Note that this method just schedules the view to be appended; the DOM\n element will not be appended to the given element until all bindings have\n finished synchronizing\n\n @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object\n @returns {Ember.View} received\n */\n replaceIn: function(target) {\n Ember.assert(\"You cannot replace an existing Ember.View. Consider using Ember.ContainerView instead.\", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));\n\n this._insertElementLater(function() {\n Ember.$(target).empty();\n this.$().appendTo(target);\n });\n\n return this;\n },\n\n /**\n @private\n\n Schedules a DOM operation to occur during the next render phase. This\n ensures that all bindings have finished synchronizing before the view is\n rendered.\n\n To use, pass a function that performs a DOM operation..\n\n Before your function is called, this view and all child views will receive\n the `willInsertElement` event. After your function is invoked, this view\n and all of its child views will receive the `didInsertElement` event.\n\n view._insertElementLater(function() {\n this.createElement();\n this.$().appendTo('body');\n });\n\n @param {Function} fn the function that inserts the element into the DOM\n */\n _insertElementLater: function(fn) {\n this._lastInsert = Ember.guidFor(fn);\n Ember.run.schedule('render', this, this.invokeForState, 'insertElement', fn);\n },\n\n /**\n Appends the view's element to the document body. If the view does\n not have an HTML representation yet, `createElement()` will be called\n automatically.\n\n Note that this method just schedules the view to be appended; the DOM\n element will not be appended to the document body until all bindings have\n finished synchronizing.\n\n @returns {Ember.View} receiver\n */\n append: function() {\n return this.appendTo(document.body);\n },\n\n /**\n Removes the view's element from the element to which it is attached.\n\n @returns {Ember.View} receiver\n */\n remove: function() {\n // What we should really do here is wait until the end of the run loop\n // to determine if the element has been re-appended to a different\n // element.\n // In the interim, we will just re-render if that happens. It is more\n // important than elements get garbage collected.\n this.destroyElement();\n this.invokeRecursively(function(view) {\n view.clearRenderedChildren();\n });\n },\n\n /**\n The ID to use when trying to locate the element in the DOM. If you do not\n set the elementId explicitly, then the view's GUID will be used instead.\n This ID must be set at the time the view is created.\n\n @type String\n @readOnly\n */\n elementId: Ember.computed(function(key, value) {\n return value !== undefined ? value : Ember.guidFor(this);\n }).cacheable(),\n\n /**\n @private\n\n TODO: Perhaps this should be removed from the production build somehow.\n */\n _elementIdDidChange: Ember.beforeObserver(function() {\n throw \"Changing a view's elementId after creation is not allowed.\";\n }, 'elementId'),\n\n /**\n Attempts to discover the element in the parent element. The default\n implementation looks for an element with an ID of elementId (or the view's\n guid if elementId is null). You can override this method to provide your\n own form of lookup. For example, if you want to discover your element\n using a CSS class name instead of an ID.\n\n @param {DOMElement} parentElement The parent's DOM element\n @returns {DOMElement} The discovered element\n */\n findElementInParentElement: function(parentElem) {\n var id = \"#\" + get(this, 'elementId');\n return Ember.$(id)[0] || Ember.$(id, parentElem)[0];\n },\n\n /**\n Creates a new renderBuffer with the passed tagName. You can override this\n method to provide further customization to the buffer if needed. Normally\n you will not need to call or override this method.\n\n @returns {Ember.RenderBuffer}\n */\n renderBuffer: function(tagName) {\n tagName = tagName || get(this, 'tagName');\n\n // Explicitly check for null or undefined, as tagName\n // may be an empty string, which would evaluate to false.\n if (tagName === null || tagName === undefined) {\n tagName = 'div';\n }\n\n return Ember.RenderBuffer(tagName);\n },\n\n /**\n Creates a DOM representation of the view and all of its\n child views by recursively calling the `render()` method.\n\n After the element has been created, `didInsertElement` will\n be called on this view and all of its child views.\n\n @returns {Ember.View} receiver\n */\n createElement: function() {\n if (get(this, 'element')) { return this; }\n\n var buffer = this.renderToBuffer();\n set(this, 'element', buffer.element());\n\n return this;\n },\n\n /**\n Called when a view is going to insert an element into the DOM.\n */\n willInsertElement: Ember.K,\n\n /**\n Called when the element of the view has been inserted into the DOM.\n Override this function to do any set up that requires an element in the\n document body.\n */\n didInsertElement: Ember.K,\n\n /**\n Called when the view is about to rerender, but before anything has\n been torn down. This is a good opportunity to tear down any manual\n observers you have installed based on the DOM state\n */\n willRerender: Ember.K,\n\n /**\n Run this callback on the current view and recursively on child views.\n\n @private\n */\n invokeRecursively: function(fn) {\n fn.call(this, this);\n\n this.forEachChildView(function(view) {\n view.invokeRecursively(fn);\n });\n },\n\n /**\n Invalidates the cache for a property on all child views.\n */\n invalidateRecursively: function(key) {\n this.forEachChildView(function(view) {\n view.propertyDidChange(key);\n });\n },\n\n /**\n @private\n\n Invokes the receiver's willInsertElement() method if it exists and then\n invokes the same on all child views.\n\n NOTE: In some cases this was called when the element existed. This no longer\n works so we let people know. We can remove this warning code later.\n */\n _notifyWillInsertElement: function() {\n this.invokeRecursively(function(view) {\n view.trigger('willInsertElement');\n });\n },\n\n /**\n @private\n\n Invokes the receiver's didInsertElement() method if it exists and then\n invokes the same on all child views.\n */\n _notifyDidInsertElement: function() {\n this.invokeRecursively(function(view) {\n view.trigger('didInsertElement');\n });\n },\n\n /**\n @private\n\n Invokes the receiver's willRerender() method if it exists and then\n invokes the same on all child views.\n */\n _notifyWillRerender: function() {\n this.invokeRecursively(function(view) {\n view.trigger('willRerender');\n });\n },\n\n /**\n Destroys any existing element along with the element for any child views\n as well. If the view does not currently have a element, then this method\n will do nothing.\n\n If you implement willDestroyElement() on your view, then this method will\n be invoked on your view before your element is destroyed to give you a\n chance to clean up any event handlers, etc.\n\n If you write a willDestroyElement() handler, you can assume that your\n didInsertElement() handler was called earlier for the same element.\n\n Normally you will not call or override this method yourself, but you may\n want to implement the above callbacks when it is run.\n\n @returns {Ember.View} receiver\n */\n destroyElement: function() {\n return this.invokeForState('destroyElement');\n },\n\n /**\n Called when the element of the view is going to be destroyed. Override\n this function to do any teardown that requires an element, like removing\n event listeners.\n */\n willDestroyElement: function() {},\n\n /**\n @private\n\n Invokes the `willDestroyElement` callback on the view and child views.\n */\n _notifyWillDestroyElement: function() {\n this.invokeRecursively(function(view) {\n view.trigger('willDestroyElement');\n });\n },\n\n /** @private (nodoc) */\n _elementWillChange: Ember.beforeObserver(function() {\n this.forEachChildView(function(view) {\n Ember.propertyWillChange(view, 'element');\n });\n }, 'element'),\n\n /**\n @private\n\n If this view's element changes, we need to invalidate the caches of our\n child views so that we do not retain references to DOM elements that are\n no longer needed.\n\n @observes element\n */\n _elementDidChange: Ember.observer(function() {\n this.forEachChildView(function(view) {\n Ember.propertyDidChange(view, 'element');\n });\n }, 'element'),\n\n /**\n Called when the parentView property has changed.\n\n @function\n */\n parentViewDidChange: Ember.K,\n\n /**\n @private\n\n Invoked by the view system when this view needs to produce an HTML\n representation. This method will create a new render buffer, if needed,\n then apply any default attributes, such as class names and visibility.\n Finally, the `render()` method is invoked, which is responsible for\n doing the bulk of the rendering.\n\n You should not need to override this method; instead, implement the\n `template` property, or if you need more control, override the `render`\n method.\n\n @param {Ember.RenderBuffer} buffer the render buffer. If no buffer is\n passed, a default buffer, using the current view's `tagName`, will\n be used.\n */\n renderToBuffer: function(parentBuffer, bufferOperation) {\n var buffer;\n\n Ember.run.sync();\n\n // Determine where in the parent buffer to start the new buffer.\n // By default, a new buffer will be appended to the parent buffer.\n // The buffer operation may be changed if the child views array is\n // mutated by Ember.ContainerView.\n bufferOperation = bufferOperation || 'begin';\n\n // If this is the top-most view, start a new buffer. Otherwise,\n // create a new buffer relative to the original using the\n // provided buffer operation (for example, `insertAfter` will\n // insert a new buffer after the \"parent buffer\").\n if (parentBuffer) {\n var tagName = get(this, 'tagName');\n if (tagName === null || tagName === undefined) {\n tagName = 'div';\n }\n\n buffer = parentBuffer[bufferOperation](tagName);\n } else {\n buffer = this.renderBuffer();\n }\n\n this.buffer = buffer;\n this.transitionTo('inBuffer', false);\n\n this.lengthBeforeRender = this._childViews.length;\n\n this.beforeRender(buffer);\n this.render(buffer);\n this.afterRender(buffer);\n\n this.lengthAfterRender = this._childViews.length;\n\n return buffer;\n },\n\n beforeRender: function(buffer) {\n this.applyAttributesToBuffer(buffer);\n },\n\n afterRender: Ember.K,\n\n /**\n @private\n */\n applyAttributesToBuffer: function(buffer) {\n // Creates observers for all registered class name and attribute bindings,\n // then adds them to the element.\n this._applyClassNameBindings();\n\n // Pass the render buffer so the method can apply attributes directly.\n // This isn't needed for class name bindings because they use the\n // existing classNames infrastructure.\n this._applyAttributeBindings(buffer);\n\n\n a_forEach(get(this, 'classNames'), function(name){ buffer.addClass(name); });\n buffer.id(get(this, 'elementId'));\n\n var role = get(this, 'ariaRole');\n if (role) {\n buffer.attr('role', role);\n }\n\n if (get(this, 'isVisible') === false) {\n buffer.style('display', 'none');\n }\n },\n\n // ..........................................................\n // STANDARD RENDER PROPERTIES\n //\n\n /**\n Tag name for the view's outer element. The tag name is only used when\n an element is first created. If you change the tagName for an element, you\n must destroy and recreate the view element.\n\n By default, the render buffer will use a `
` tag for views.\n\n @type String\n @default null\n */\n\n // We leave this null by default so we can tell the difference between\n // the default case and a user-specified tag.\n tagName: null,\n\n /**\n The WAI-ARIA role of the control represented by this view. For example, a\n button may have a role of type 'button', or a pane may have a role of\n type 'alertdialog'. This property is used by assistive software to help\n visually challenged users navigate rich web applications.\n\n The full list of valid WAI-ARIA roles is available at:\n http://www.w3.org/TR/wai-aria/roles#roles_categorization\n\n @type String\n @default null\n */\n ariaRole: null,\n\n /**\n Standard CSS class names to apply to the view's outer element. This\n property automatically inherits any class names defined by the view's\n superclasses as well.\n\n @type Array\n @default ['ember-view']\n */\n classNames: ['ember-view'],\n\n /**\n A list of properties of the view to apply as class names. If the property\n is a string value, the value of that string will be applied as a class\n name.\n\n // Applies the 'high' class to the view element\n Ember.View.create({\n classNameBindings: ['priority']\n priority: 'high'\n });\n\n If the value of the property is a Boolean, the name of that property is\n added as a dasherized class name.\n\n // Applies the 'is-urgent' class to the view element\n Ember.View.create({\n classNameBindings: ['isUrgent']\n isUrgent: true\n });\n\n If you would prefer to use a custom value instead of the dasherized\n property name, you can pass a binding like this:\n\n // Applies the 'urgent' class to the view element\n Ember.View.create({\n classNameBindings: ['isUrgent:urgent']\n isUrgent: true\n });\n\n This list of properties is inherited from the view's superclasses as well.\n\n @type Array\n @default []\n */\n classNameBindings: [],\n\n /**\n A list of properties of the view to apply as attributes. If the property is\n a string value, the value of that string will be applied as the attribute.\n\n // Applies the type attribute to the element\n // with the value \"button\", like
\n Ember.View.create({\n attributeBindings: ['type'],\n type: 'button'\n });\n\n If the value of the property is a Boolean, the name of that property is\n added as an attribute.\n\n // Renders something like
\n Ember.View.create({\n attributeBindings: ['enabled'],\n enabled: true\n });\n */\n attributeBindings: [],\n\n state: 'preRender',\n\n // .......................................................\n // CORE DISPLAY METHODS\n //\n\n /**\n @private\n\n Setup a view, but do not finish waking it up.\n - configure childViews\n - register the view with the global views hash, which is used for event\n dispatch\n */\n init: function() {\n this._super();\n\n // Register the view for event handling. This hash is used by\n // Ember.EventDispatcher to dispatch incoming events.\n if (!this.isVirtual) Ember.View.views[get(this, 'elementId')] = this;\n\n // setup child views. be sure to clone the child views array first\n this._childViews = this._childViews.slice();\n\n Ember.assert(\"Only arrays are allowed for 'classNameBindings'\", Ember.typeOf(this.classNameBindings) === 'array');\n this.classNameBindings = Ember.A(this.classNameBindings.slice());\n\n Ember.assert(\"Only arrays are allowed for 'classNames'\", Ember.typeOf(this.classNames) === 'array');\n this.classNames = Ember.A(this.classNames.slice());\n\n var viewController = get(this, 'viewController');\n if (viewController) {\n viewController = get(viewController);\n if (viewController) {\n set(viewController, 'view', this);\n }\n }\n },\n\n appendChild: function(view, options) {\n return this.invokeForState('appendChild', view, options);\n },\n\n /**\n Removes the child view from the parent view.\n\n @param {Ember.View} view\n @returns {Ember.View} receiver\n */\n removeChild: function(view) {\n // If we're destroying, the entire subtree will be\n // freed, and the DOM will be handled separately,\n // so no need to mess with childViews.\n if (this.isDestroying) { return; }\n\n // update parent node\n set(view, '_parentView', null);\n\n // remove view from childViews array.\n var childViews = this._childViews;\n\n Ember.EnumerableUtils.removeObject(childViews, view);\n\n this.propertyDidChange('childViews'); // HUH?! what happened to will change?\n\n return this;\n },\n\n /**\n Removes all children from the parentView.\n\n @returns {Ember.View} receiver\n */\n removeAllChildren: function() {\n return this.mutateChildViews(function(view) {\n this.removeChild(view);\n });\n },\n\n destroyAllChildren: function() {\n return this.mutateChildViews(function(view) {\n view.destroy();\n });\n },\n\n /**\n Removes the view from its parentView, if one is found. Otherwise\n does nothing.\n\n @returns {Ember.View} receiver\n */\n removeFromParent: function() {\n var parent = get(this, '_parentView');\n\n // Remove DOM element from parent\n this.remove();\n\n if (parent) { parent.removeChild(this); }\n return this;\n },\n\n /**\n You must call `destroy` on a view to destroy the view (and all of its\n child views). This will remove the view from any parent node, then make\n sure that the DOM element managed by the view can be released by the\n memory manager.\n */\n willDestroy: function() {\n // calling this._super() will nuke computed properties and observers,\n // so collect any information we need before calling super.\n var childViews = this._childViews,\n parent = get(this, '_parentView'),\n childLen;\n\n // destroy the element -- this will avoid each child view destroying\n // the element over and over again...\n if (!this.removedFromDOM) { this.destroyElement(); }\n\n // remove from non-virtual parent view if viewName was specified\n if (this.viewName) {\n var nonVirtualParentView = get(this, 'parentView');\n if (nonVirtualParentView) {\n set(nonVirtualParentView, this.viewName, null);\n }\n }\n\n // remove from parent if found. Don't call removeFromParent,\n // as removeFromParent will try to remove the element from\n // the DOM again.\n if (parent) { parent.removeChild(this); }\n\n this.state = 'destroyed';\n\n childLen = childViews.length;\n for (var i=childLen-1; i>=0; i--) {\n childViews[i].removedFromDOM = true;\n childViews[i].destroy();\n }\n\n // next remove view from global hash\n if (!this.isVirtual) delete Ember.View.views[get(this, 'elementId')];\n },\n\n /**\n Instantiates a view to be added to the childViews array during view\n initialization. You generally will not call this method directly unless\n you are overriding createChildViews(). Note that this method will\n automatically configure the correct settings on the new view instance to\n act as a child of the parent.\n\n @param {Class} viewClass\n @param {Hash} [attrs] Attributes to add\n @returns {Ember.View} new instance\n @test in createChildViews\n */\n createChildView: function(view, attrs) {\n if (Ember.View.detect(view)) {\n attrs = attrs || {};\n attrs._parentView = this;\n attrs.templateData = attrs.templateData || get(this, 'templateData');\n\n view = view.create(attrs);\n\n // don't set the property on a virtual view, as they are invisible to\n // consumers of the view API\n if (view.viewName) { set(get(this, 'concreteView'), view.viewName, view); }\n } else {\n Ember.assert('You must pass instance or subclass of View', view instanceof Ember.View);\n Ember.assert(\"You can only pass attributes when a class is provided\", !attrs);\n\n if (!get(view, 'templateData')) {\n set(view, 'templateData', get(this, 'templateData'));\n }\n\n set(view, '_parentView', this);\n }\n\n return view;\n },\n\n becameVisible: Ember.K,\n becameHidden: Ember.K,\n\n /**\n @private\n\n When the view's `isVisible` property changes, toggle the visibility\n element of the actual DOM element.\n */\n _isVisibleDidChange: Ember.observer(function() {\n var isVisible = get(this, 'isVisible');\n\n this.$().toggle(isVisible);\n\n if (this._isAncestorHidden()) { return; }\n\n if (isVisible) {\n this._notifyBecameVisible();\n } else {\n this._notifyBecameHidden();\n }\n }, 'isVisible'),\n\n _notifyBecameVisible: function() {\n this.trigger('becameVisible');\n\n this.forEachChildView(function(view) {\n var isVisible = get(view, 'isVisible');\n\n if (isVisible || isVisible === null) {\n view._notifyBecameVisible();\n }\n });\n },\n\n _notifyBecameHidden: function() {\n this.trigger('becameHidden');\n this.forEachChildView(function(view) {\n var isVisible = get(view, 'isVisible');\n\n if (isVisible || isVisible === null) {\n view._notifyBecameHidden();\n }\n });\n },\n\n _isAncestorHidden: function() {\n var parent = get(this, 'parentView');\n\n while (parent) {\n if (get(parent, 'isVisible') === false) { return true; }\n\n parent = get(parent, 'parentView');\n }\n\n return false;\n },\n\n clearBuffer: function() {\n this.invokeRecursively(function(view) {\n this.buffer = null;\n });\n },\n\n transitionTo: function(state, children) {\n this.state = state;\n\n if (children !== false) {\n this.forEachChildView(function(view) {\n view.transitionTo(state);\n });\n }\n },\n\n /**\n @private\n\n Override the default event firing from Ember.Evented to\n also call methods with the given name.\n */\n trigger: function(name) {\n this._super.apply(this, arguments);\n var method = this[name];\n if (method) {\n var args = [], i, l;\n for (i = 1, l = arguments.length; i < l; i++) {\n args.push(arguments[i]);\n }\n return method.apply(this, args);\n }\n },\n\n has: function(name) {\n return Ember.typeOf(this[name]) === 'function' || this._super(name);\n },\n\n // .......................................................\n // EVENT HANDLING\n //\n\n /**\n @private\n\n Handle events from `Ember.EventDispatcher`\n */\n handleEvent: function(eventName, evt) {\n return this.invokeForState('handleEvent', eventName, evt);\n }\n\n});\n\n/**\n Describe how the specified actions should behave in the various\n states that a view can exist in. Possible states:\n\n * preRender: when a view is first instantiated, and after its\n element was destroyed, it is in the preRender state\n * inBuffer: once a view has been rendered, but before it has\n been inserted into the DOM, it is in the inBuffer state\n * inDOM: once a view has been inserted into the DOM it is in\n the inDOM state. A view spends the vast majority of its\n existence in this state.\n * destroyed: once a view has been destroyed (using the destroy\n method), it is in this state. No further actions can be invoked\n on a destroyed view.\n*/\n\n // in the destroyed state, everything is illegal\n\n // before rendering has begun, all legal manipulations are noops.\n\n // inside the buffer, legal manipulations are done on the buffer\n\n // once the view has been inserted into the DOM, legal manipulations\n // are done on the DOM element.\n\n/** @private */\nvar DOMManager = {\n prepend: function(view, childView) {\n childView._insertElementLater(function() {\n var element = view.$();\n element.prepend(childView.$());\n });\n },\n\n after: function(view, nextView) {\n nextView._insertElementLater(function() {\n var element = view.$();\n element.after(nextView.$());\n });\n },\n\n replace: function(view) {\n var element = get(view, 'element');\n\n set(view, 'element', null);\n\n view._insertElementLater(function() {\n Ember.$(element).replaceWith(get(view, 'element'));\n });\n },\n\n remove: function(view) {\n var elem = get(view, 'element');\n\n set(view, 'element', null);\n view._lastInsert = null;\n\n Ember.$(elem).remove();\n },\n\n empty: function(view) {\n view.$().empty();\n }\n};\n\nEmber.View.reopen({\n states: Ember.View.states,\n domManager: DOMManager\n});\n\nEmber.View.reopenClass({\n\n /**\n @private\n\n Parse a path and return an object which holds the parsed properties.\n\n For example a path like \"content.isEnabled:enabled:disabled\" wil return the\n following object:\n\n {\n path: \"content.isEnabled\",\n className: \"enabled\",\n falsyClassName: \"disabled\",\n classNames: \":enabled:disabled\"\n }\n\n */\n _parsePropertyPath: function(path) {\n var split = path.split(/:/),\n propertyPath = split[0],\n classNames = \"\",\n className,\n falsyClassName;\n\n // check if the property is defined as prop:class or prop:trueClass:falseClass\n if (split.length > 1) {\n className = split[1];\n if (split.length === 3) { falsyClassName = split[2]; }\n\n classNames = ':' + className;\n if (falsyClassName) { classNames += \":\" + falsyClassName; }\n }\n\n return {\n path: propertyPath,\n classNames: classNames,\n className: (className === '') ? undefined : className,\n falsyClassName: falsyClassName\n };\n },\n\n /**\n @private\n\n Get the class name for a given value, based on the path, optional className\n and optional falsyClassName.\n\n - if the value is truthy and a className is defined, the className is returned\n - if the value is true, the dasherized last part of the supplied path is returned\n - if the value is false and a falsyClassName is supplied, the falsyClassName is returned\n - if the value is truthy, the value is returned\n - if none of the above rules apply, null is returned\n\n */\n _classStringForValue: function(path, val, className, falsyClassName) {\n // If the value is truthy and we're using the colon syntax,\n // we should return the className directly\n if (!!val && className) {\n return className;\n\n // If value is a Boolean and true, return the dasherized property\n // name.\n } else if (val === true) {\n // catch syntax like isEnabled::not-enabled\n if (val === true && !className && falsyClassName) { return null; }\n\n // Normalize property path to be suitable for use\n // as a class name. For exaple, content.foo.barBaz\n // becomes bar-baz.\n var parts = path.split('.');\n return Ember.String.dasherize(parts[parts.length-1]);\n\n // If the value is false and a falsyClassName is specified, return it\n } else if (val === false && falsyClassName) {\n return falsyClassName;\n\n // If the value is not false, undefined, or null, return the current\n // value of the property.\n } else if (val !== false && val !== undefined && val !== null) {\n return val;\n\n // Nothing to display. Return null so that the old class is removed\n // but no new class is added.\n } else {\n return null;\n }\n }\n});\n\n// Create a global view hash.\nEmber.View.views = {};\n\n// If someone overrides the child views computed property when\n// defining their class, we want to be able to process the user's\n// supplied childViews and then restore the original computed property\n// at view initialization time. This happens in Ember.ContainerView's init\n// method.\nEmber.View.childViewsProperty = childViewsProperty;\n\nEmber.View.applyAttributeBindings = function(elem, name, value) {\n var type = Ember.typeOf(value);\n var currentValue = elem.attr(name);\n\n // if this changes, also change the logic in ember-handlebars/lib/helpers/binding.js\n if ((type === 'string' || (type === 'number' && !isNaN(value))) && value !== currentValue) {\n elem.attr(name, value);\n } else if (value && type === 'boolean') {\n elem.attr(name, name);\n } else if (!value) {\n elem.removeAttr(name);\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\nEmber.View.states = {\n _default: {\n // appendChild is only legal while rendering the buffer.\n appendChild: function() {\n throw \"You can't use appendChild outside of the rendering process\";\n },\n\n $: function() {\n return Ember.$();\n },\n\n getElement: function() {\n return null;\n },\n\n // Handle events from `Ember.EventDispatcher`\n handleEvent: function() {\n return true; // continue event propagation\n },\n\n destroyElement: function(view) {\n set(view, 'element', null);\n view._lastInsert = null;\n return view;\n }\n }\n};\n\nEmber.View.reopen({\n states: Ember.View.states\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nEmber.View.states.preRender = {\n parentState: Ember.View.states._default,\n\n // a view leaves the preRender state once its element has been\n // created (createElement).\n insertElement: function(view, fn) {\n if (view._lastInsert !== Ember.guidFor(fn)){\n return;\n }\n view.createElement();\n view._notifyWillInsertElement();\n // after createElement, the view will be in the hasElement state.\n fn.call(view);\n view.transitionTo('inDOM');\n view._notifyDidInsertElement();\n },\n\n empty: Ember.K,\n\n setElement: function(view, value) {\n if (value !== null) {\n view.transitionTo('hasElement');\n }\n return value;\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\n\nEmber.View.states.inBuffer = {\n parentState: Ember.View.states._default,\n\n $: function(view, sel) {\n // if we don't have an element yet, someone calling this.$() is\n // trying to update an element that isn't in the DOM. Instead,\n // rerender the view to allow the render method to reflect the\n // changes.\n view.rerender();\n return Ember.$();\n },\n\n // when a view is rendered in a buffer, rerendering it simply\n // replaces the existing buffer with a new one\n rerender: function(view) {\n Ember.deprecate(\"Something you did caused a view to re-render after it rendered but before it was inserted into the DOM. Because this is avoidable and the cause of significant performance issues in applications, this behavior is deprecated. If you want to use the debugger to find out what caused this, you can set ENV.RAISE_ON_DEPRECATION to true.\");\n\n view._notifyWillRerender();\n\n view.clearRenderedChildren();\n view.renderToBuffer(view.buffer, 'replaceWith');\n },\n\n // when a view is rendered in a buffer, appending a child\n // view will render that view and append the resulting\n // buffer into its buffer.\n appendChild: function(view, childView, options) {\n var buffer = view.buffer;\n\n childView = this.createChildView(childView, options);\n view._childViews.push(childView);\n\n childView.renderToBuffer(buffer);\n\n view.propertyDidChange('childViews');\n\n return childView;\n },\n\n // when a view is rendered in a buffer, destroying the\n // element will simply destroy the buffer and put the\n // state back into the preRender state.\n destroyElement: function(view) {\n view.clearBuffer();\n view._notifyWillDestroyElement();\n view.transitionTo('preRender');\n\n return view;\n },\n\n empty: function() {\n Ember.assert(\"Emptying a view in the inBuffer state is not allowed and should not happen under normal circumstances. Most likely there is a bug in your application. This may be due to excessive property change notifications.\");\n },\n\n // It should be impossible for a rendered view to be scheduled for\n // insertion.\n insertElement: function() {\n throw \"You can't insert an element that has already been rendered\";\n },\n\n setElement: function(view, value) {\n if (value === null) {\n view.transitionTo('preRender');\n } else {\n view.clearBuffer();\n view.transitionTo('hasElement');\n }\n\n return value;\n }\n};\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\n\nEmber.View.states.hasElement = {\n parentState: Ember.View.states._default,\n\n $: function(view, sel) {\n var elem = get(view, 'element');\n return sel ? Ember.$(sel, elem) : Ember.$(elem);\n },\n\n getElement: function(view) {\n var parent = get(view, 'parentView');\n if (parent) { parent = get(parent, 'element'); }\n if (parent) { return view.findElementInParentElement(parent); }\n return Ember.$(\"#\" + get(view, 'elementId'))[0];\n },\n\n setElement: function(view, value) {\n if (value === null) {\n view.transitionTo('preRender');\n } else {\n throw \"You cannot set an element to a non-null value when the element is already in the DOM.\";\n }\n\n return value;\n },\n\n // once the view has been inserted into the DOM, rerendering is\n // deferred to allow bindings to synchronize.\n rerender: function(view) {\n view._notifyWillRerender();\n\n view.clearRenderedChildren();\n\n view.domManager.replace(view);\n return view;\n },\n\n // once the view is already in the DOM, destroying it removes it\n // from the DOM, nukes its element, and puts it back into the\n // preRender state if inDOM.\n\n destroyElement: function(view) {\n view._notifyWillDestroyElement();\n view.domManager.remove(view);\n return view;\n },\n\n empty: function(view) {\n var _childViews = view._childViews, len, idx;\n if (_childViews) {\n len = _childViews.length;\n for (idx = 0; idx < len; idx++) {\n _childViews[idx]._notifyWillDestroyElement();\n }\n }\n view.domManager.empty(view);\n },\n\n // Handle events from `Ember.EventDispatcher`\n handleEvent: function(view, eventName, evt) {\n if (view.has(eventName)) {\n // Handler should be able to re-dispatch events, so we don't\n // preventDefault or stopPropagation.\n return view.trigger(eventName, evt);\n } else {\n return true; // continue event propagation\n }\n }\n};\n\nEmber.View.states.inDOM = {\n parentState: Ember.View.states.hasElement,\n\n insertElement: function(view, fn) {\n if (view._lastInsert !== Ember.guidFor(fn)){\n return;\n }\n throw \"You can't insert an element into the DOM that has already been inserted\";\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar destroyedError = \"You can't call %@ on a destroyed view\", fmt = Ember.String.fmt;\n\nEmber.View.states.destroyed = {\n parentState: Ember.View.states._default,\n\n appendChild: function() {\n throw fmt(destroyedError, ['appendChild']);\n },\n rerender: function() {\n throw fmt(destroyedError, ['rerender']);\n },\n destroyElement: function() {\n throw fmt(destroyedError, ['destroyElement']);\n },\n empty: function() {\n throw fmt(destroyedError, ['empty']);\n },\n\n setElement: function() {\n throw fmt(destroyedError, [\"set('element', ...)\"]);\n },\n\n // Since element insertion is scheduled, don't do anything if\n // the view has been destroyed between scheduling and execution\n insertElement: Ember.K\n};\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\nvar forEach = Ember.EnumerableUtils.forEach;\n\nvar childViewsProperty = Ember.computed(function() {\n return get(this, '_childViews');\n}).property('_childViews').cacheable();\n\n/**\n @class\n\n A `ContainerView` is an `Ember.View` subclass that allows for manual or programatic\n management of a view's `childViews` array that will correctly update the `ContainerView`\n instance's rendered DOM representation.\n\n ## Setting Initial Child Views\n The initial array of child views can be set in one of two ways. You can provide\n a `childViews` property at creation time that contains instance of `Ember.View`:\n\n\n aContainer = Ember.ContainerView.create({\n childViews: [Ember.View.create(), Ember.View.create()]\n })\n\n You can also provide a list of property names whose values are instances of `Ember.View`:\n\n aContainer = Ember.ContainerView.create({\n childViews: ['aView', 'bView', 'cView'],\n aView: Ember.View.create(),\n bView: Ember.View.create()\n cView: Ember.View.create()\n })\n\n The two strategies can be combined:\n\n aContainer = Ember.ContainerView.create({\n childViews: ['aView', Ember.View.create()],\n aView: Ember.View.create()\n })\n\n Each child view's rendering will be inserted into the container's rendered HTML in the same\n order as its position in the `childViews` property.\n\n ## Adding and Removing Child Views\n The views in a container's `childViews` array should be added and removed by manipulating\n the `childViews` property directly.\n\n To remove a view pass that view into a `removeObject` call on the container's `childViews` property.\n\n Given an empty `` the following code\n\n aContainer = Ember.ContainerView.create({\n classNames: ['the-container'],\n childViews: ['aView', 'bView'],\n aView: Ember.View.create({\n template: Ember.Handlebars.compile(\"A\")\n }),\n bView: Ember.View.create({\n template: Ember.Handlebars.compile(\"B\")\n })\n })\n\n aContainer.appendTo('body')\n\n Results in the HTML\n\n
\n
A
\n
B
\n
\n\n Removing a view\n\n aContainer.get('childViews') // [aContainer.aView, aContainer.bView]\n aContainer.get('childViews').removeObject(aContainer.get('bView'))\n aContainer.get('childViews') // [aContainer.aView]\n\n Will result in the following HTML\n\n
\n
A
\n
\n\n\n Similarly, adding a child view is accomplished by adding `Ember.View` instances to the\n container's `childViews` property.\n\n Given an empty `` the following code\n\n aContainer = Ember.ContainerView.create({\n classNames: ['the-container'],\n childViews: ['aView', 'bView'],\n aView: Ember.View.create({\n template: Ember.Handlebars.compile(\"A\")\n }),\n bView: Ember.View.create({\n template: Ember.Handlebars.compile(\"B\")\n })\n })\n\n aContainer.appendTo('body')\n\n Results in the HTML\n\n
\n
A
\n
B
\n
\n\n Adding a view\n\n AnotherViewClass = Ember.View.extend({\n template: Ember.Handlebars.compile(\"Another view\")\n })\n\n aContainer.get('childViews') // [aContainer.aView, aContainer.bView]\n aContainer.get('childViews').pushObject(AnotherViewClass.create())\n aContainer.get('childViews') // [aContainer.aView, aContainer.bView, ]\n\n Will result in the following HTML\n\n
\n
A
\n
B
\n
Another view
\n
\n\n\n Direct manipulation of childViews presence or absence in the DOM via calls to\n `remove` or `removeFromParent` or calls to a container's `removeChild` may not behave\n correctly.\n\n Calling `remove()` on a child view will remove the view's HTML, but it will remain as part of its\n container's `childView`s property.\n\n Calling `removeChild()` on the container will remove the passed view instance from the container's\n `childView`s but keep its HTML within the container's rendered view.\n\n Calling `removeFromParent()` behaves as expected but should be avoided in favor of direct\n manipulation of a container's `childViews` property.\n\n aContainer = Ember.ContainerView.create({\n classNames: ['the-container'],\n childViews: ['aView', 'bView'],\n aView: Ember.View.create({\n template: Ember.Handlebars.compile(\"A\")\n }),\n bView: Ember.View.create({\n template: Ember.Handlebars.compile(\"B\")\n })\n })\n\n aContainer.appendTo('body')\n\n Results in the HTML\n\n
\n
A
\n
B
\n
\n\n Calling `aContainer.get('aView').removeFromParent()` will result in the following HTML\n\n
\n
B
\n
\n\n And the `Ember.View` instance stored in `aContainer.aView` will be removed from `aContainer`'s\n `childViews` array.\n\n ## Templates and Layout\n A `template`, `templateName`, `defaultTemplate`, `layout`, `layoutName` or `defaultLayout`\n property on a container view will not result in the template or layout being rendered.\n The HTML contents of a `Ember.ContainerView`'s DOM representation will only be the rendered HTML\n of its child views.\n\n ## Binding a View to Display\n\n If you would like to display a single view in your ContainerView, you can set its `currentView`\n property. When the `currentView` property is set to a view instance, it will be added to the\n ContainerView's `childViews` array. If the `currentView` property is later changed to a\n different view, the new view will replace the old view. If `currentView` is set to `null`, the\n last `currentView` will be removed.\n\n This functionality is useful for cases where you want to bind the display of a ContainerView to\n a controller or state manager. For example, you can bind the `currentView` of a container to\n a controller like this:\n\n // Controller\n App.appController = Ember.Object.create({\n view: Ember.View.create({\n templateName: 'person_template'\n })\n });\n\n // Handlebars template\n {{view Ember.ContainerView currentViewBinding=\"App.appController.view\"}}\n\n @extends Ember.View\n*/\n\nEmber.ContainerView = Ember.View.extend({\n\n init: function() {\n this._super();\n\n var childViews = get(this, 'childViews');\n Ember.defineProperty(this, 'childViews', childViewsProperty);\n\n var _childViews = this._childViews;\n\n forEach(childViews, function(viewName, idx) {\n var view;\n\n if ('string' === typeof viewName) {\n view = get(this, viewName);\n view = this.createChildView(view);\n set(this, viewName, view);\n } else {\n view = this.createChildView(viewName);\n }\n\n _childViews[idx] = view;\n }, this);\n\n var currentView = get(this, 'currentView');\n if (currentView) _childViews.push(this.createChildView(currentView));\n\n // Make the _childViews array observable\n Ember.A(_childViews);\n\n // Sets up an array observer on the child views array. This\n // observer will detect when child views are added or removed\n // and update the DOM to reflect the mutation.\n get(this, 'childViews').addArrayObserver(this, {\n willChange: 'childViewsWillChange',\n didChange: 'childViewsDidChange'\n });\n },\n\n /**\n Instructs each child view to render to the passed render buffer.\n\n @param {Ember.RenderBuffer} buffer the buffer to render to\n @private\n */\n render: function(buffer) {\n this.forEachChildView(function(view) {\n view.renderToBuffer(buffer);\n });\n },\n\n /**\n When the container view is destroyed, tear down the child views\n array observer.\n\n @private\n */\n willDestroy: function() {\n get(this, 'childViews').removeArrayObserver(this, {\n willChange: 'childViewsWillChange',\n didChange: 'childViewsDidChange'\n });\n\n this._super();\n },\n\n /**\n When a child view is removed, destroy its element so that\n it is removed from the DOM.\n\n The array observer that triggers this action is set up in the\n `renderToBuffer` method.\n\n @private\n @param {Ember.Array} views the child views array before mutation\n @param {Number} start the start position of the mutation\n @param {Number} removed the number of child views removed\n **/\n childViewsWillChange: function(views, start, removed) {\n if (removed === 0) { return; }\n\n var changedViews = views.slice(start, start+removed);\n this.initializeViews(changedViews, null, null);\n\n this.invokeForState('childViewsWillChange', views, start, removed);\n },\n\n /**\n When a child view is added, make sure the DOM gets updated appropriately.\n\n If the view has already rendered an element, we tell the child view to\n create an element and insert it into the DOM. If the enclosing container view\n has already written to a buffer, but not yet converted that buffer into an\n element, we insert the string representation of the child into the appropriate\n place in the buffer.\n\n @private\n @param {Ember.Array} views the array of child views afte the mutation has occurred\n @param {Number} start the start position of the mutation\n @param {Number} removed the number of child views removed\n @param {Number} the number of child views added\n */\n childViewsDidChange: function(views, start, removed, added) {\n var len = get(views, 'length');\n\n // No new child views were added; bail out.\n if (added === 0) return;\n\n var changedViews = views.slice(start, start+added);\n this.initializeViews(changedViews, this, get(this, 'templateData'));\n\n // Let the current state handle the changes\n this.invokeForState('childViewsDidChange', views, start, added);\n },\n\n initializeViews: function(views, parentView, templateData) {\n forEach(views, function(view) {\n set(view, '_parentView', parentView);\n\n if (!get(view, 'templateData')) {\n set(view, 'templateData', templateData);\n }\n });\n },\n\n /**\n Schedules a child view to be inserted into the DOM after bindings have\n finished syncing for this run loop.\n\n @param {Ember.View} view the child view to insert\n @param {Ember.View} prev the child view after which the specified view should\n be inserted\n @private\n */\n _scheduleInsertion: function(view, prev) {\n if (prev) {\n prev.domManager.after(prev, view);\n } else {\n this.domManager.prepend(this, view);\n }\n },\n\n currentView: null,\n\n _currentViewWillChange: Ember.beforeObserver(function() {\n var childViews = get(this, 'childViews'),\n currentView = get(this, 'currentView');\n\n if (currentView) {\n childViews.removeObject(currentView);\n }\n }, 'currentView'),\n\n _currentViewDidChange: Ember.observer(function() {\n var childViews = get(this, 'childViews'),\n currentView = get(this, 'currentView');\n\n if (currentView) {\n childViews.pushObject(currentView);\n }\n }, 'currentView')\n});\n\n// Ember.ContainerView extends the default view states to provide different\n// behavior for childViewsWillChange and childViewsDidChange.\nEmber.ContainerView.states = {\n parent: Ember.View.states,\n\n inBuffer: {\n childViewsDidChange: function(parentView, views, start, added) {\n var buffer = parentView.buffer,\n startWith, prev, prevBuffer, view;\n\n // Determine where to begin inserting the child view(s) in the\n // render buffer.\n if (start === 0) {\n // If views were inserted at the beginning, prepend the first\n // view to the render buffer, then begin inserting any\n // additional views at the beginning.\n view = views[start];\n startWith = start + 1;\n view.renderToBuffer(buffer, 'prepend');\n } else {\n // Otherwise, just insert them at the same place as the child\n // views mutation.\n view = views[start - 1];\n startWith = start;\n }\n\n for (var i=startWith; i` and the following code:\n\n\n someItemsView = Ember.CollectionView.create({\n classNames: ['a-collection'],\n content: ['A','B','C'],\n itemViewClass: Ember.View.extend({\n template: Ember.Handlebars.compile(\"the letter: {{view.content}}\")\n })\n })\n\n someItemsView.appendTo('body')\n\n Will result in the following HTML structure\n\n
\n
the letter: A
\n
the letter: B
\n
the letter: C
\n
\n\n ## Automatic matching of parent/child tagNames\n\n Setting the `tagName` property of a `CollectionView` to any of \n \"ul\", \"ol\", \"table\", \"thead\", \"tbody\", \"tfoot\", \"tr\", or \"select\" will result\n in the item views receiving an appropriately matched `tagName` property.\n\n\n Given an empty `` and the following code:\n\n anUndorderedListView = Ember.CollectionView.create({\n tagName: 'ul',\n content: ['A','B','C'],\n itemViewClass: Ember.View.extend({\n template: Ember.Handlebars.compile(\"the letter: {{view.content}}\")\n })\n })\n\n anUndorderedListView.appendTo('body')\n\n Will result in the following HTML structure\n\n
    \n
  • the letter: A
  • \n
  • the letter: B
  • \n
  • the letter: C
  • \n
\n\n Additional tagName pairs can be provided by adding to `Ember.CollectionView.CONTAINER_MAP `\n\n Ember.CollectionView.CONTAINER_MAP['article'] = 'section'\n\n\n ## Empty View\n You can provide an `Ember.View` subclass to the `Ember.CollectionView` instance as its\n `emptyView` property. If the `content` property of a `CollectionView` is set to `null`\n or an empty array, an instance of this view will be the `CollectionView`s only child.\n\n aListWithNothing = Ember.CollectionView.create({\n classNames: ['nothing']\n content: null,\n emptyView: Ember.View.extend({\n template: Ember.Handlebars.compile(\"The collection is empty\")\n })\n })\n\n aListWithNothing.appendTo('body')\n\n Will result in the following HTML structure\n\n
\n
\n The collection is empty\n
\n
\n\n ## Adding and Removing items\n The `childViews` property of a `CollectionView` should not be directly manipulated. Instead,\n add, remove, replace items from its `content` property. This will trigger\n appropriate changes to its rendered HTML.\n\n ## Use in templates via the `{{collection}}` Ember.Handlebars helper\n Ember.Handlebars provides a helper specifically for adding `CollectionView`s to templates.\n See `Ember.Handlebars.collection` for more details\n\n @since Ember 0.9\n @extends Ember.ContainerView\n*/\nEmber.CollectionView = Ember.ContainerView.extend(\n/** @scope Ember.CollectionView.prototype */ {\n\n /**\n A list of items to be displayed by the Ember.CollectionView.\n\n @type Ember.Array\n @default null\n */\n content: null,\n\n /**\n @private\n\n This provides metadata about what kind of empty view class this\n collection would like if it is being instantiated from another\n system (like Handlebars)\n */\n emptyViewClass: Ember.View,\n\n /**\n An optional view to display if content is set to an empty array.\n\n @type Ember.View\n @default null\n */\n emptyView: null,\n\n /**\n @type Ember.View\n @default Ember.View\n */\n itemViewClass: Ember.View,\n\n /** @private */\n init: function() {\n var ret = this._super();\n this._contentDidChange();\n return ret;\n },\n\n _contentWillChange: Ember.beforeObserver(function() {\n var content = this.get('content');\n\n if (content) { content.removeArrayObserver(this); }\n var len = content ? get(content, 'length') : 0;\n this.arrayWillChange(content, 0, len);\n }, 'content'),\n\n /**\n @private\n\n Check to make sure that the content has changed, and if so,\n update the children directly. This is always scheduled\n asynchronously, to allow the element to be created before\n bindings have synchronized and vice versa.\n */\n _contentDidChange: Ember.observer(function() {\n var content = get(this, 'content');\n\n if (content) {\n Ember.assert(fmt(\"an Ember.CollectionView's content must implement Ember.Array. You passed %@\", [content]), Ember.Array.detect(content));\n content.addArrayObserver(this);\n }\n\n var len = content ? get(content, 'length') : 0;\n this.arrayDidChange(content, 0, null, len);\n }, 'content'),\n\n willDestroy: function() {\n var content = get(this, 'content');\n if (content) { content.removeArrayObserver(this); }\n\n this._super();\n },\n\n arrayWillChange: function(content, start, removedCount) {\n // If the contents were empty before and this template collection has an\n // empty view remove it now.\n var emptyView = get(this, 'emptyView');\n if (emptyView && emptyView instanceof Ember.View) {\n emptyView.removeFromParent();\n }\n\n // Loop through child views that correspond with the removed items.\n // Note that we loop from the end of the array to the beginning because\n // we are mutating it as we go.\n var childViews = get(this, 'childViews'), childView, idx, len;\n\n len = get(childViews, 'length');\n\n var removingAll = removedCount === len;\n\n if (removingAll) {\n this.invokeForState('empty');\n }\n\n for (idx = start + removedCount - 1; idx >= start; idx--) {\n childView = childViews[idx];\n if (removingAll) { childView.removedFromDOM = true; }\n childView.destroy();\n }\n },\n\n /**\n Called when a mutation to the underlying content array occurs.\n\n This method will replay that mutation against the views that compose the\n Ember.CollectionView, ensuring that the view reflects the model.\n\n This array observer is added in contentDidChange.\n\n @param {Array} addedObjects\n the objects that were added to the content\n\n @param {Array} removedObjects\n the objects that were removed from the content\n\n @param {Number} changeIndex\n the index at which the changes occurred\n */\n arrayDidChange: function(content, start, removed, added) {\n var itemViewClass = get(this, 'itemViewClass'),\n childViews = get(this, 'childViews'),\n addedViews = [], view, item, idx, len, itemTagName;\n\n if ('string' === typeof itemViewClass) {\n itemViewClass = get(itemViewClass);\n }\n\n Ember.assert(fmt(\"itemViewClass must be a subclass of Ember.View, not %@\", [itemViewClass]), Ember.View.detect(itemViewClass));\n\n len = content ? get(content, 'length') : 0;\n if (len) {\n for (idx = start; idx < start+added; idx++) {\n item = content.objectAt(idx);\n\n view = this.createChildView(itemViewClass, {\n content: item,\n contentIndex: idx\n });\n\n addedViews.push(view);\n }\n } else {\n var emptyView = get(this, 'emptyView');\n if (!emptyView) { return; }\n\n emptyView = this.createChildView(emptyView);\n addedViews.push(emptyView);\n set(this, 'emptyView', emptyView);\n }\n childViews.replace(start, 0, addedViews);\n },\n\n createChildView: function(view, attrs) {\n view = this._super(view, attrs);\n\n var itemTagName = get(view, 'tagName');\n var tagName = (itemTagName === null || itemTagName === undefined) ? Ember.CollectionView.CONTAINER_MAP[get(this, 'tagName')] : itemTagName;\n\n set(view, 'tagName', tagName);\n\n return view;\n }\n});\n\n/**\n @static\n\n A map of parent tags to their default child tags. You can add\n additional parent tags if you want collection views that use\n a particular parent tag to default to a child tag.\n\n @type Hash\n @constant\n*/\nEmber.CollectionView.CONTAINER_MAP = {\n ul: 'li',\n ol: 'li',\n table: 'tr',\n thead: 'tr',\n tbody: 'tr',\n tfoot: 'tr',\n tr: 'td',\n select: 'option'\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/*globals jQuery*/\n\n})();\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n @extends Ember.Object\n*/\nEmber.State = Ember.Object.extend(Ember.Evented,\n/** @scope Ember.State.prototype */{\n isState: true,\n\n /**\n A reference to the parent state.\n\n @type Ember.State\n */\n parentState: null,\n start: null,\n\n /**\n The name of this state.\n\n @type String\n */\n name: null,\n\n /**\n The full path to this state.\n\n @type String\n @readOnly\n */\n path: Ember.computed(function() {\n var parentPath = get(this, 'parentState.path'),\n path = get(this, 'name');\n\n if (parentPath) {\n path = parentPath + '.' + path;\n }\n\n return path;\n }).property().cacheable(),\n\n /**\n @private\n\n Override the default event firing from Ember.Evented to\n also call methods with the given name.\n */\n trigger: function(name) {\n if (this[name]) {\n this[name].apply(this, [].slice.call(arguments, 1));\n }\n this._super.apply(this, arguments);\n },\n\n /** @private */\n init: function() {\n var states = get(this, 'states'), foundStates;\n set(this, 'childStates', Ember.A());\n set(this, 'eventTransitions', get(this, 'eventTransitions') || {});\n\n var name, value, transitionTarget;\n\n // As a convenience, loop over the properties\n // of this state and look for any that are other\n // Ember.State instances or classes, and move them\n // to the `states` hash. This avoids having to\n // create an explicit separate hash.\n\n if (!states) {\n states = {};\n\n for (name in this) {\n if (name === \"constructor\") { continue; }\n\n if (value = this[name]) {\n if (transitionTarget = value.transitionTarget) {\n this.eventTransitions[name] = transitionTarget;\n }\n\n this.setupChild(states, name, value);\n }\n }\n\n set(this, 'states', states);\n } else {\n for (name in states) {\n this.setupChild(states, name, states[name]);\n }\n }\n\n set(this, 'pathsCache', {});\n set(this, 'pathsCacheNoContext', {});\n },\n\n /** @private */\n setupChild: function(states, name, value) {\n if (!value) { return false; }\n\n if (value.isState) {\n set(value, 'name', name);\n } else if (Ember.State.detect(value)) {\n value = value.create({\n name: name\n });\n }\n\n if (value.isState) {\n set(value, 'parentState', this);\n get(this, 'childStates').pushObject(value);\n states[name] = value;\n }\n },\n\n lookupEventTransition: function(name) {\n var path, state = this;\n\n while(state && !path) {\n path = state.eventTransitions[name];\n state = state.get('parentState');\n }\n\n return path;\n },\n\n /**\n A Boolean value indicating whether the state is a leaf state\n in the state hierarchy. This is false if the state has child\n states; otherwise it is true.\n\n @type Boolean\n */\n isLeaf: Ember.computed(function() {\n return !get(this, 'childStates').length;\n }).cacheable(),\n\n /**\n A boolean value indicating whether the state takes a context.\n By default we assume all states take contexts.\n */\n hasContext: true,\n\n /**\n This is the default transition event.\n\n @event\n @param {Ember.StateManager} manager\n @param context\n @see Ember.StateManager#transitionEvent\n */\n setup: Ember.K,\n\n /**\n This event fires when the state is entered.\n\n @event\n @param {Ember.StateManager} manager\n */\n enter: Ember.K,\n\n /**\n This event fires when the state is exited.\n\n @event\n @param {Ember.StateManager} manager\n */\n exit: Ember.K\n});\n\nvar Event = Ember.$ && Ember.$.Event;\n\nEmber.State.reopenClass(\n/** @scope Ember.State */{\n\n /**\n @static\n\n Creates an action function for transitioning to the named state while preserving context.\n\n The following example StateManagers are equivalent:\n\n aManager = Ember.StateManager.create({\n stateOne: Ember.State.create({\n changeToStateTwo: Ember.State.transitionTo('stateTwo')\n }),\n stateTwo: Ember.State.create({})\n })\n\n bManager = Ember.StateManager.create({\n stateOne: Ember.State.create({\n changeToStateTwo: function(manager, context){\n manager.transitionTo('stateTwo', context)\n }\n }),\n stateTwo: Ember.State.create({})\n })\n\n @param {String} target\n */\n transitionTo: function(target) {\n var event = function(stateManager, context) {\n if (Event && context instanceof Event) {\n context = context.context;\n }\n\n stateManager.transitionTo(target, context);\n };\n\n event.transitionTarget = target;\n\n return event;\n }\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\nvar arrayForEach = Ember.ArrayPolyfills.forEach;\n/**\n @class\n\n StateManager is part of Ember's implementation of a finite state machine. A StateManager\n instance manages a number of properties that are instances of `Ember.State`,\n tracks the current active state, and triggers callbacks when states have changed.\n\n ## Defining States\n\n The states of StateManager can be declared in one of two ways. First, you can define\n a `states` property that contains all the states:\n\n managerA = Ember.StateManager.create({\n states: {\n stateOne: Ember.State.create(),\n stateTwo: Ember.State.create()\n }\n })\n\n managerA.get('states')\n // {\n // stateOne: Ember.State.create(),\n // stateTwo: Ember.State.create()\n // }\n\n You can also add instances of `Ember.State` (or an `Ember.State` subclass) directly as properties\n of a StateManager. These states will be collected into the `states` property for you.\n\n managerA = Ember.StateManager.create({\n stateOne: Ember.State.create(),\n stateTwo: Ember.State.create()\n })\n\n managerA.get('states')\n // {\n // stateOne: Ember.State.create(),\n // stateTwo: Ember.State.create()\n // }\n\n ## The Initial State\n When created a StateManager instance will immediately enter into the state\n defined as its `start` property or the state referenced by name in its\n `initialState` property:\n\n managerA = Ember.StateManager.create({\n start: Ember.State.create({})\n })\n\n managerA.get('currentState.name') // 'start'\n\n managerB = Ember.StateManager.create({\n initialState: 'beginHere',\n beginHere: Ember.State.create({})\n })\n\n managerB.get('currentState.name') // 'beginHere'\n\n Because it is a property you may also provide a computed function if you wish to derive\n an `initialState` programmatically:\n\n managerC = Ember.StateManager.create({\n initialState: function(){\n if (someLogic) {\n return 'active';\n } else {\n return 'passive';\n }\n }.property(),\n active: Ember.State.create({}),\n passive: Ember.State.create({})\n })\n\n ## Moving Between States\n A StateManager can have any number of Ember.State objects as properties\n and can have a single one of these states as its current state.\n\n Calling `transitionTo` transitions between states:\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({}),\n poweredUp: Ember.State.create({})\n })\n\n robotManager.get('currentState.name') // 'poweredDown'\n robotManager.transitionTo('poweredUp')\n robotManager.get('currentState.name') // 'poweredUp'\n\n Before transitioning into a new state the existing `currentState` will have its\n `exit` method called with the StateManager instance as its first argument and\n an object representing the transition as its second argument.\n\n After transitioning into a new state the new `currentState` will have its\n `enter` method called with the StateManager instance as its first argument and\n an object representing the transition as its second argument.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n exit: function(stateManager){\n console.log(\"exiting the poweredDown state\")\n }\n }),\n poweredUp: Ember.State.create({\n enter: function(stateManager){\n console.log(\"entering the poweredUp state. Destroy all humans.\")\n }\n })\n })\n\n robotManager.get('currentState.name') // 'poweredDown'\n robotManager.transitionTo('poweredUp')\n // will log\n // 'exiting the poweredDown state'\n // 'entering the poweredUp state. Destroy all humans.'\n\n\n Once a StateManager is already in a state, subsequent attempts to enter that state will\n not trigger enter or exit method calls. Attempts to transition into a state that the\n manager does not have will result in no changes in the StateManager's current state:\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n exit: function(stateManager){\n console.log(\"exiting the poweredDown state\")\n }\n }),\n poweredUp: Ember.State.create({\n enter: function(stateManager){\n console.log(\"entering the poweredUp state. Destroy all humans.\")\n }\n })\n })\n\n robotManager.get('currentState.name') // 'poweredDown'\n robotManager.transitionTo('poweredUp')\n // will log\n // 'exiting the poweredDown state'\n // 'entering the poweredUp state. Destroy all humans.'\n robotManager.transitionTo('poweredUp') // no logging, no state change\n\n robotManager.transitionTo('someUnknownState') // silently fails\n robotManager.get('currentState.name') // 'poweredUp'\n\n\n Each state property may itself contain properties that are instances of Ember.State.\n The StateManager can transition to specific sub-states in a series of transitionTo method calls or\n via a single transitionTo with the full path to the specific state. The StateManager will also\n keep track of the full path to its currentState\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n charging: Ember.State.create(),\n charged: Ember.State.create()\n }),\n poweredUp: Ember.State.create({\n mobile: Ember.State.create(),\n stationary: Ember.State.create()\n })\n })\n\n robotManager.get('currentState.name') // 'poweredDown'\n\n robotManager.transitionTo('poweredUp')\n robotManager.get('currentState.name') // 'poweredUp'\n\n robotManager.transitionTo('mobile')\n robotManager.get('currentState.name') // 'mobile'\n\n // transition via a state path\n robotManager.transitionTo('poweredDown.charging')\n robotManager.get('currentState.name') // 'charging'\n\n robotManager.get('currentState.path') // 'poweredDown.charging'\n\n Enter transition methods will be called for each state and nested child state in their\n hierarchical order. Exit methods will be called for each state and its nested states in\n reverse hierarchical order.\n\n Exit transitions for a parent state are not called when entering into one of its child states,\n only when transitioning to a new section of possible states in the hierarchy.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n enter: function(){},\n exit: function(){\n console.log(\"exited poweredDown state\")\n },\n charging: Ember.State.create({\n enter: function(){},\n exit: function(){}\n }),\n charged: Ember.State.create({\n enter: function(){\n console.log(\"entered charged state\")\n },\n exit: function(){\n console.log(\"exited charged state\")\n }\n })\n }),\n poweredUp: Ember.State.create({\n enter: function(){\n console.log(\"entered poweredUp state\")\n },\n exit: function(){},\n mobile: Ember.State.create({\n enter: function(){\n console.log(\"entered mobile state\")\n },\n exit: function(){}\n }),\n stationary: Ember.State.create({\n enter: function(){},\n exit: function(){}\n })\n })\n })\n\n\n robotManager.get('currentState.path') // 'poweredDown'\n robotManager.transitionTo('charged')\n // logs 'entered charged state'\n // but does *not* log 'exited poweredDown state'\n robotManager.get('currentState.name') // 'charged\n\n robotManager.transitionTo('poweredUp.mobile')\n // logs\n // 'exited charged state'\n // 'exited poweredDown state'\n // 'entered poweredUp state'\n // 'entered mobile state'\n\n During development you can set a StateManager's `enableLogging` property to `true` to\n receive console messages of state transitions.\n\n robotManager = Ember.StateManager.create({\n enableLogging: true\n })\n\n ## Managing currentState with Actions\n To control which transitions between states are possible for a given state, StateManager\n can receive and route action messages to its states via the `send` method. Calling to `send` with\n an action name will begin searching for a method with the same name starting at the current state\n and moving up through the parent states in a state hierarchy until an appropriate method is found\n or the StateManager instance itself is reached.\n\n If an appropriately named method is found it will be called with the state manager as the first\n argument and an optional `context` object as the second argument.\n\n managerA = Ember.StateManager.create({\n initialState: 'stateOne.substateOne.subsubstateOne',\n stateOne: Ember.State.create({\n substateOne: Ember.State.create({\n anAction: function(manager, context){\n console.log(\"an action was called\")\n },\n subsubstateOne: Ember.State.create({})\n })\n })\n })\n\n managerA.get('currentState.name') // 'subsubstateOne'\n managerA.send('anAction')\n // 'stateOne.substateOne.subsubstateOne' has no anAction method\n // so the 'anAction' method of 'stateOne.substateOne' is called\n // and logs \"an action was called\"\n // with managerA as the first argument\n // and no second argument\n\n someObject = {}\n managerA.send('anAction', someObject)\n // the 'anAction' method of 'stateOne.substateOne' is called again\n // with managerA as the first argument and\n // someObject as the second argument.\n\n\n If the StateManager attempts to send an action but does not find an appropriately named\n method in the current state or while moving upwards through the state hierarchy\n it will throw a new Ember.Error. Action detection only moves upwards through the state hierarchy\n from the current state. It does not search in other portions of the hierarchy.\n\n managerB = Ember.StateManager.create({\n initialState: 'stateOne.substateOne.subsubstateOne',\n stateOne: Ember.State.create({\n substateOne: Ember.State.create({\n subsubstateOne: Ember.State.create({})\n })\n }),\n stateTwo: Ember.State.create({\n anAction: function(manager, context){\n // will not be called below because it is\n // not a parent of the current state\n }\n })\n })\n\n managerB.get('currentState.name') // 'subsubstateOne'\n managerB.send('anAction')\n // Error: could not\n // respond to event anAction in state stateOne.substateOne.subsubstateOne.\n\n Inside of an action method the given state should delegate `transitionTo` calls on its\n StateManager.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown.charging',\n poweredDown: Ember.State.create({\n charging: Ember.State.create({\n chargeComplete: function(manager, context){\n manager.transitionTo('charged')\n }\n }),\n charged: Ember.State.create({\n boot: function(manager, context){\n manager.transitionTo('poweredUp')\n }\n })\n }),\n poweredUp: Ember.State.create({\n beginExtermination: function(manager, context){\n manager.transitionTo('rampaging')\n },\n rampaging: Ember.State.create()\n })\n })\n\n robotManager.get('currentState.name') // 'charging'\n robotManager.send('boot') // throws error, no boot action\n // in current hierarchy\n robotManager.get('currentState.name') // remains 'charging'\n\n robotManager.send('beginExtermination') // throws error, no beginExtermination\n // action in current hierarchy\n robotManager.get('currentState.name') // remains 'charging'\n\n robotManager.send('chargeComplete')\n robotManager.get('currentState.name') // 'charged'\n\n robotManager.send('boot')\n robotManager.get('currentState.name') // 'poweredUp'\n\n robotManager.send('beginExtermination', allHumans)\n robotManager.get('currentState.name') // 'rampaging'\n\n Transition actions can also be created using the `transitionTo` method of the Ember.State class. The\n following example StateManagers are equivalent: \n \n aManager = Ember.StateManager.create({\n stateOne: Ember.State.create({\n changeToStateTwo: Ember.State.transitionTo('stateTwo')\n }),\n stateTwo: Ember.State.create({})\n })\n \n bManager = Ember.StateManager.create({\n stateOne: Ember.State.create({\n changeToStateTwo: function(manager, context){\n manager.transitionTo('stateTwo', context)\n }\n }),\n stateTwo: Ember.State.create({})\n })\n**/\nEmber.StateManager = Ember.State.extend(\n/** @scope Ember.StateManager.prototype */ {\n\n /**\n When creating a new statemanager, look for a default state to transition\n into. This state can either be named `start`, or can be specified using the\n `initialState` property.\n */\n init: function() {\n this._super();\n\n set(this, 'stateMeta', Ember.Map.create());\n\n var initialState = get(this, 'initialState');\n\n if (!initialState && get(this, 'states.start')) {\n initialState = 'start';\n }\n\n if (initialState) {\n this.transitionTo(initialState);\n Ember.assert('Failed to transition to initial state \"' + initialState + '\"', !!get(this, 'currentState'));\n }\n },\n\n stateMetaFor: function(state) {\n var meta = get(this, 'stateMeta'),\n stateMeta = meta.get(state);\n\n if (!stateMeta) {\n stateMeta = {};\n meta.set(state, stateMeta);\n }\n\n return stateMeta;\n },\n\n setStateMeta: function(state, key, value) {\n return set(this.stateMetaFor(state), key, value);\n },\n\n getStateMeta: function(state, key) {\n return get(this.stateMetaFor(state), key);\n },\n\n /**\n The current state from among the manager's possible states. This property should\n not be set directly. Use `transitionTo` to move between states by name.\n\n @type Ember.State\n @readOnly\n */\n currentState: null,\n\n /**\n The name of transitionEvent that this stateManager will dispatch\n\n @property {String}\n @default 'setup'\n */\n transitionEvent: 'setup',\n\n /**\n If set to true, `errorOnUnhandledEvents` will cause an exception to be\n raised if you attempt to send an event to a state manager that is not\n handled by the current state or any of its parent states.\n\n @type Boolean\n @default true\n */\n errorOnUnhandledEvent: true,\n \n send: function(event, context) {\n Ember.assert('Cannot send event \"' + event + '\" while currentState is ' + get(this, 'currentState'), get(this, 'currentState'));\n return this.sendRecursively(event, get(this, 'currentState'), context);\n },\n\n sendRecursively: function(event, currentState, context) {\n var log = this.enableLogging,\n action = currentState[event];\n\n // Test to see if the action is a method that\n // can be invoked. Don't blindly check just for\n // existence, because it is possible the state\n // manager has a child state of the given name,\n // and we should still raise an exception in that\n // case.\n if (typeof action === 'function') {\n if (log) { Ember.Logger.log(fmt(\"STATEMANAGER: Sending event '%@' to state %@.\", [event, get(currentState, 'path')])); }\n return action.call(currentState, this, context);\n } else {\n var parentState = get(currentState, 'parentState');\n if (parentState) {\n return this.sendRecursively(event, parentState, context);\n } else if (get(this, 'errorOnUnhandledEvent')) {\n throw new Ember.Error(this.toString() + \" could not respond to event \" + event + \" in state \" + get(this, 'currentState.path') + \".\");\n }\n }\n },\n\n /**\n Finds a state by its state path.\n\n Example:\n\n manager = Ember.StateManager.create({\n root: Ember.State.create({\n dashboard: Ember.State.create()\n })\n });\n\n manager.getStateByPath(manager, \"root.dashboard\")\n\n // returns the dashboard state\n\n @param {Ember.State} root the state to start searching from\n @param {String} path the state path to follow\n @returns {Ember.State} the state at the end of the path\n */\n getStateByPath: function(root, path) {\n var parts = path.split('.'),\n state = root;\n\n for (var i=0, l=parts.length; i 0 && enterStates[0] === exitStates[0]) {\n resolveState = enterStates.shift();\n exitStates.shift();\n }\n\n currentState.pathsCache[path] = {\n exitStates: exitStates,\n enterStates: enterStates,\n resolveState: resolveState\n };\n }\n\n // Don't modify the cached versions\n enterStates = enterStates.slice();\n exitStates = exitStates.slice();\n\n stateIdx = enterStates.length-1;\n while (contexts.length > 0) {\n if (stateIdx >= 0) {\n state = enterStates[stateIdx--];\n } else {\n state = enterStates[0] ? get(enterStates[0], 'parentState') : resolveState;\n if (!state) { throw \"Cannot match all contexts to states\"; }\n enterStates.unshift(state);\n exitStates.unshift(state);\n }\n\n useContext = context && get(state, 'hasContext');\n matchedContexts.unshift(useContext ? contexts.pop() : null);\n }\n\n state = enterStates[enterStates.length - 1] || resolveState;\n while(true) {\n initialState = get(state, 'initialState') || 'start';\n state = get(state, 'states.'+initialState);\n if (!state) { break; }\n enterStates.push(state);\n matchedContexts.push(undefined);\n }\n\n while (enterStates.length > 0) {\n if (enterStates[0] !== exitStates[0]) { break; }\n\n if (enterStates.length === matchedContexts.length) {\n if (this.getStateMeta(enterStates[0], 'context') !== matchedContexts[0]) { break; }\n matchedContexts.shift();\n }\n\n resolveState = enterStates.shift();\n exitStates.shift();\n }\n }\n\n this.enterState(exitStates, enterStates, enterStates[enterStates.length-1] || resolveState);\n this.triggerSetupContext(enterStates, matchedContexts);\n },\n\n triggerSetupContext: function(enterStates, contexts) {\n var offset = enterStates.length - contexts.length;\n Ember.assert(\"More contexts provided than states\", offset >= 0);\n\n arrayForEach.call(enterStates, function(state, idx) {\n state.trigger(get(this, 'transitionEvent'), this, contexts[idx-offset]);\n }, this);\n },\n\n getState: function(name) {\n var state = get(this, name),\n parentState = get(this, 'parentState');\n\n if (state) {\n return state;\n } else if (parentState) {\n return parentState.getState(name);\n }\n },\n\n enterState: function(exitStates, enterStates, state) {\n var log = this.enableLogging,\n stateManager = this;\n\n exitStates = exitStates.slice(0).reverse();\n arrayForEach.call(exitStates, function(state) {\n state.trigger('exit', stateManager);\n });\n\n arrayForEach.call(enterStates, function(state) {\n if (log) { Ember.Logger.log(\"STATEMANAGER: Entering \" + get(state, 'path')); }\n state.trigger('enter', stateManager);\n });\n\n set(this, 'currentState', state);\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Statecharts\n// Copyright: ©2011 Living Social Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\nvar get = Ember.get;\n\nEmber._ResolvedState = Ember.Object.extend({\n manager: null,\n state: null,\n match: null,\n\n object: Ember.computed(function(key, value) {\n if (arguments.length === 2) {\n this._object = value;\n return value;\n } else {\n if (this._object) {\n return this._object;\n } else {\n var state = get(this, 'state'),\n match = get(this, 'match'),\n manager = get(this, 'manager');\n return state.deserialize(manager, match.hash);\n }\n }\n }).property(),\n\n hasPromise: Ember.computed(function() {\n return Ember.canInvoke(get(this, 'object'), 'then');\n }).property('object'),\n\n promise: Ember.computed(function() {\n var object = get(this, 'object');\n if (Ember.canInvoke(object, 'then')) {\n return object;\n } else {\n return {\n then: function(success) { success(object); }\n };\n }\n }).property('object'),\n\n transition: function() {\n var manager = get(this, 'manager'),\n path = get(this, 'state.path'),\n object = get(this, 'object');\n manager.transitionTo(path, object);\n }\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get;\n\n// The Ember Routable mixin assumes the existance of a simple\n// routing shim that supports the following three behaviors:\n//\n// * .getURL() - this is called when the page loads\n// * .setURL(newURL) - this is called from within the state\n// manager when the state changes to a routable state\n// * .onURLChange(callback) - this happens when the user presses\n// the back or forward button\n\nvar paramForClass = function(classObject) {\n var className = classObject.toString(),\n parts = className.split(\".\"),\n last = parts[parts.length - 1];\n\n return Ember.String.underscore(last) + \"_id\";\n};\n\nvar merge = function(original, hash) {\n for (var prop in hash) {\n if (!hash.hasOwnProperty(prop)) { continue; }\n if (original.hasOwnProperty(prop)) { continue; }\n\n original[prop] = hash[prop];\n }\n};\n\nEmber.Routable = Ember.Mixin.create({\n init: function() {\n var redirection;\n this.on('connectOutlets', this, this.stashContext);\n\n if (redirection = get(this, 'redirectsTo')) {\n Ember.assert(\"You cannot use `redirectsTo` if you already have a `connectOutlets` method\", this.connectOutlets === Ember.K);\n\n this.connectOutlets = function(router) {\n router.transitionTo(redirection);\n };\n }\n\n // normalize empty route to '/'\n var route = get(this, 'route');\n if (route === '') {\n route = '/';\n }\n\n this._super();\n\n Ember.assert(\"You cannot use `redirectsTo` on a state that has child states\", !redirection || (!!redirection && !!get(this, 'isLeaf')));\n },\n\n /**\n @private\n\n Whenever a routable state is entered, the context it was entered with\n is stashed so that we can regenerate the state's `absoluteURL` on\n demand.\n */\n stashContext: function(manager, context) {\n var serialized = this.serialize(manager, context);\n Ember.assert('serialize must return a hash', !serialized || typeof serialized === 'object');\n\n manager.setStateMeta(this, 'context', context);\n manager.setStateMeta(this, 'serialized', serialized);\n\n if (get(this, 'isRoutable') && !get(manager, 'isRouting')) {\n this.updateRoute(manager, get(manager, 'location'));\n }\n },\n\n /**\n @private\n\n Whenever a routable state is entered, the router's location object\n is notified to set the URL to the current absolute path.\n\n In general, this will update the browser's URL.\n */\n updateRoute: function(manager, location) {\n if (get(this, 'isLeafRoute')) {\n var path = this.absoluteRoute(manager);\n location.setURL(path);\n }\n },\n\n /**\n @private\n\n Get the absolute route for the current state and a given\n hash.\n\n This method is private, as it expects a serialized hash,\n not the original context object.\n */\n absoluteRoute: function(manager, hash) {\n var parentState = get(this, 'parentState');\n var path = '', generated;\n\n // If the parent state is routable, use its current path\n // as this route's prefix.\n if (get(parentState, 'isRoutable')) {\n path = parentState.absoluteRoute(manager, hash);\n }\n\n var matcher = get(this, 'routeMatcher'),\n serialized = manager.getStateMeta(this, 'serialized');\n\n // merge the existing serialized object in with the passed\n // in hash.\n hash = hash || {};\n merge(hash, serialized);\n\n generated = matcher && matcher.generate(hash);\n\n if (generated) {\n path = path + '/' + generated;\n }\n\n return path;\n },\n\n /**\n @private\n\n At the moment, a state is routable if it has a string `route`\n property. This heuristic may change.\n */\n isRoutable: Ember.computed(function() {\n return typeof get(this, 'route') === 'string';\n }).cacheable(),\n\n /**\n @private\n\n Determine if this is the last routeable state\n */\n isLeafRoute: Ember.computed(function() {\n if (get(this, 'isLeaf')) { return true; }\n return !get(this, 'childStates').findProperty('isRoutable');\n }).cacheable(),\n\n /**\n @private\n\n A _RouteMatcher object generated from the current route's `route`\n string property.\n */\n routeMatcher: Ember.computed(function() {\n var route = get(this, 'route');\n if (route) {\n return Ember._RouteMatcher.create({ route: route });\n }\n }).cacheable(),\n\n /**\n @private\n\n Check whether the route has dynamic segments and therefore takes\n a context.\n */\n hasContext: Ember.computed(function() {\n var routeMatcher = get(this, 'routeMatcher');\n if (routeMatcher) {\n return routeMatcher.identifiers.length > 0;\n }\n }).cacheable(),\n\n /**\n @private\n\n The model class associated with the current state. This property\n uses the `modelType` property, in order to allow it to be\n specified as a String.\n */\n modelClass: Ember.computed(function() {\n var modelType = get(this, 'modelType');\n\n if (typeof modelType === 'string') {\n return Ember.get(window, modelType);\n } else {\n return modelType;\n }\n }).cacheable(),\n\n /**\n @private\n\n Get the model class for the state. The heuristic is:\n\n * The state must have a single dynamic segment\n * The dynamic segment must end in `_id`\n * A dynamic segment like `blog_post_id` is converted into `BlogPost`\n * The name is then looked up on the passed in namespace\n\n The process of initializing an application with a router will\n pass the application's namespace into the router, which will be\n used here.\n */\n modelClassFor: function(namespace) {\n var modelClass, routeMatcher, identifiers, match, className;\n\n // if an explicit modelType was specified, use that\n if (modelClass = get(this, 'modelClass')) { return modelClass; }\n\n // if the router has no lookup namespace, we won't be able to guess\n // the modelType\n if (!namespace) { return; }\n\n // make sure this state is actually a routable state\n routeMatcher = get(this, 'routeMatcher');\n if (!routeMatcher) { return; }\n\n // only guess modelType for states with a single dynamic segment\n // (no more, no fewer)\n identifiers = routeMatcher.identifiers;\n if (identifiers.length !== 2) { return; }\n\n // extract the `_id` from the end of the dynamic segment; if the\n // dynamic segment does not end in `_id`, we can't guess the\n // modelType\n match = identifiers[1].match(/^(.*)_id$/);\n if (!match) { return; }\n\n // convert the underscored type into a class form and look it up\n // on the router's namespace\n className = Ember.String.classify(match[1]);\n return get(namespace, className);\n },\n\n /**\n The default method that takes a `params` object and converts\n it into an object.\n\n By default, a params hash that looks like `{ post_id: 1 }`\n will be looked up as `namespace.Post.find(1)`. This is\n designed to work seamlessly with Ember Data, but will work\n fine with any class that has a `find` method.\n */\n deserialize: function(manager, params) {\n var modelClass, routeMatcher, param;\n\n if (modelClass = this.modelClassFor(get(manager, 'namespace'))) {\n Ember.assert(\"Expected \"+modelClass.toString()+\" to implement `find` for use in '\"+this.get('path')+\"' `deserialize`. Please implement the `find` method or overwrite `deserialize`.\", modelClass.find);\n return modelClass.find(params[paramForClass(modelClass)]);\n }\n\n return params;\n },\n\n /**\n The default method that takes an object and converts it into\n a params hash.\n\n By default, if there is a single dynamic segment named\n `blog_post_id` and the object is a `BlogPost` with an\n `id` of `12`, the serialize method will produce:\n\n { blog_post_id: 12 }\n */\n serialize: function(manager, context) {\n var modelClass, routeMatcher, namespace, param, id;\n\n if (Ember.empty(context)) { return ''; }\n\n if (modelClass = this.modelClassFor(get(manager, 'namespace'))) {\n param = paramForClass(modelClass);\n id = get(context, 'id');\n context = {};\n context[param] = id;\n }\n\n return context;\n },\n\n /**\n @private\n */\n resolvePath: function(manager, path) {\n if (get(this, 'isLeafRoute')) { return Ember.A(); }\n\n var childStates = get(this, 'childStates'), match;\n\n childStates = Ember.A(childStates.filterProperty('isRoutable'));\n\n childStates = childStates.sort(function(a, b) {\n var aDynamicSegments = get(a, 'routeMatcher.identifiers.length'),\n bDynamicSegments = get(b, 'routeMatcher.identifiers.length'),\n aRoute = get(a, 'route'),\n bRoute = get(b, 'route');\n\n if (aRoute.indexOf(bRoute) === 0) {\n return -1;\n } else if (bRoute.indexOf(aRoute) === 0) {\n return 1;\n }\n\n if (aDynamicSegments !== bDynamicSegments) {\n return aDynamicSegments - bDynamicSegments;\n }\n\n return get(b, 'route.length') - get(a, 'route.length');\n });\n\n var state = childStates.find(function(state) {\n var matcher = get(state, 'routeMatcher');\n if (match = matcher.match(path)) { return true; }\n });\n\n Ember.assert(\"Could not find state for path \" + path, !!state);\n\n var resolvedState = Ember._ResolvedState.create({\n manager: manager,\n state: state,\n match: match\n });\n\n var states = state.resolvePath(manager, match.remaining);\n\n return Ember.A([resolvedState]).pushObjects(states);\n },\n\n /**\n @private\n\n Once `unroute` has finished unwinding, `routePath` will be called\n with the remainder of the route.\n\n For example, if you were in the /posts/1/comments state, and you\n moved into the /posts/2/comments state, `routePath` will be called\n on the state whose path is `/posts` with the path `/2/comments`.\n */\n routePath: function(manager, path) {\n if (get(this, 'isLeafRoute')) { return; }\n\n var resolvedStates = this.resolvePath(manager, path),\n hasPromises = resolvedStates.some(function(s) { return get(s, 'hasPromise'); });\n\n function runTransition() {\n resolvedStates.forEach(function(rs) { rs.transition(); });\n }\n\n if (hasPromises) {\n manager.transitionTo('loading');\n\n Ember.assert('Loading state should be the child of a route', Ember.Routable.detect(get(manager, 'currentState.parentState')));\n Ember.assert('Loading state should not be a route', !Ember.Routable.detect(get(manager, 'currentState')));\n\n manager.handleStatePromises(resolvedStates, runTransition);\n } else {\n runTransition();\n }\n },\n\n /**\n @private\n\n When you move to a new route by pressing the back\n or forward button, this method is called first.\n\n Its job is to move the state manager into a parent\n state of the state it will eventually move into.\n */\n unroutePath: function(router, path) {\n // If we're at the root state, we're done\n if (get(this, 'parentState') === router) {\n return;\n }\n\n path = path.replace(/^(?=[^\\/])/, \"/\");\n var absolutePath = this.absoluteRoute(router);\n\n var route = get(this, 'route');\n\n // If the current path is empty, move up one state,\n // because the index ('/') state must be a leaf node.\n if (route !== '/') {\n // If the current path is a prefix of the path we're trying\n // to go to, we're done.\n var index = path.indexOf(absolutePath),\n next = path.charAt(absolutePath.length);\n\n if (index === 0 && (next === \"/\" || next === \"\")) {\n return;\n }\n }\n\n // Transition to the parent and call unroute again.\n var parentPath = get(get(this, 'parentState'), 'path');\n router.transitionTo(parentPath);\n router.send('unroutePath', path);\n },\n\n /**\n The `connectOutlets` event will be triggered once a\n state has been entered. It will be called with the\n route's context.\n */\n connectOutlets: Ember.K,\n\n /**\n The `navigateAway` event will be triggered when the\n URL changes due to the back/forward button\n */\n navigateAway: Ember.K\n});\n\n})();\n\n\n\n(function() {\n/**\n @class\n*/\nEmber.Route = Ember.State.extend(Ember.Routable);\n\n})();\n\n\n\n(function() {\nvar escapeForRegex = function(text) {\n return text.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^\\$|#\\s]/g, \"\\\\$&\");\n};\n\nEmber._RouteMatcher = Ember.Object.extend({\n state: null,\n\n init: function() {\n var route = this.route,\n identifiers = [],\n count = 1,\n escaped;\n\n // Strip off leading slash if present\n if (route.charAt(0) === '/') {\n route = this.route = route.substr(1);\n }\n\n escaped = escapeForRegex(route);\n\n var regex = escaped.replace(/:([a-z_]+)(?=$|\\/)/gi, function(match, id) {\n identifiers[count++] = id;\n return \"([^/]+)\";\n });\n\n this.identifiers = identifiers;\n this.regex = new RegExp(\"^/?\" + regex);\n },\n\n match: function(path) {\n var match = path.match(this.regex);\n\n if (match) {\n var identifiers = this.identifiers,\n hash = {};\n\n for (var i=1, l=identifiers.length; i 0 ? hash : null\n };\n }\n },\n\n generate: function(hash) {\n var identifiers = this.identifiers, route = this.route, id;\n for (var i=1, l=identifiers.length; i\n

{{title}}

\n \n\n Will delegate `click` events on the rendered `h1` to the application's router instance. In this case the\n `anActionOnTheRouter` method of the state at 'root.aRoute' will be called with the view's controller\n as the context argument. This context will be passed to the `connectOutlets` as its second argument.\n\n Different `context` can be supplied from within the `{{action}}` helper, allowing specific context passing\n between application states:\n\n \n\n See Handlebars.helpers.action for additional usage examples.\n\n\n ## Changing View Hierarchy in Response To State Change\n Changes in application state that change the URL should be accompanied by associated changes in view\n hierarchy. This can be accomplished by calling 'connectOutlet' on the injected controller singletons from\n within the 'connectOutlets' event of an Ember.Route:\n\n App = Ember.Application.create({\n OneController: Ember.ObjectController.extend(),\n OneView: Ember.View.extend(),\n\n AnotherController: Ember.ObjectController.extend(),\n AnotherView: Ember.View.extend(),\n\n Router: Ember.Router.extend({\n root: Ember.Route.extend({\n aRoute: Ember.Route.extend({\n route: '/',\n connectOutlets: function(router, context) {\n router.get('oneController').connectOutlet('another');\n },\n })\n })\n })\n });\n App.initialize();\n\n\n This will detect the '{{outlet}}' portion of `oneController`'s view (an instance of `App.OneView`) and\n fill it with a rendered instance of `App.AnotherView` whose `context` will be the single instance of\n `App.AnotherController` stored on the router in the `anotherController` property.\n\n For more information about Outlets, see `Ember.Handlebars.helpers.outlet`. For additional information on\n the `connectOutlet` method, see `Ember.Controller.connectOutlet`. For more information on\n controller injections, see `Ember.Application#initialize()`. For additional information about view context,\n see `Ember.View`.\n\n @extends Ember.StateManager\n*/\nEmber.Router = Ember.StateManager.extend(\n/** @scope Ember.Router.prototype */ {\n\n /**\n @property {String}\n @default 'root'\n */\n initialState: 'root',\n\n /**\n The `Ember.Location` implementation to be used to manage the application\n URL state. The following values are supported:\n\n * 'hash': Uses URL fragment identifiers (like #/blog/1) for routing.\n * 'none': Does not read or set the browser URL, but still allows for\n routing to happen. Useful for testing.\n\n @type String\n @default 'hash'\n */\n location: 'hash',\n\n /**\n This is only used when a history location is used so that applications that\n don't live at the root of the domain can append paths to their root.\n\n @type String\n @default '/'\n */\n\n rootURL: '/',\n\n /**\n On router, transitionEvent should be called connectOutlets\n\n @property {String}\n @default 'connectOutlets'\n */\n transitionEvent: 'connectOutlets',\n\n transitionTo: function() {\n this.abortRoutingPromises();\n this._super.apply(this, arguments);\n },\n\n route: function(path) {\n this.abortRoutingPromises();\n\n set(this, 'isRouting', true);\n\n var routableState;\n\n try {\n path = path.replace(/^(?=[^\\/])/, \"/\");\n\n this.send('navigateAway');\n this.send('unroutePath', path);\n\n routableState = get(this, 'currentState');\n while (routableState && !routableState.get('isRoutable')) {\n routableState = get(routableState, 'parentState');\n }\n var currentURL = routableState ? routableState.absoluteRoute(this) : '';\n var rest = path.substr(currentURL.length);\n\n this.send('routePath', rest);\n } finally {\n set(this, 'isRouting', false);\n }\n\n routableState = get(this, 'currentState');\n while (routableState && !routableState.get('isRoutable')) {\n routableState = get(routableState, 'parentState');\n }\n\n if (routableState) {\n routableState.updateRoute(this, get(this, 'location'));\n }\n },\n\n urlFor: function(path, hash) {\n var currentState = get(this, 'currentState') || this,\n state = this.findStateByPath(currentState, path);\n\n Ember.assert(Ember.String.fmt(\"Could not find route with path '%@'\", [path]), !!state);\n Ember.assert(\"To get a URL for a state, it must have a `route` property.\", !!get(state, 'routeMatcher'));\n\n var location = get(this, 'location'),\n absoluteRoute = state.absoluteRoute(this, hash);\n\n return location.formatURL(absoluteRoute);\n },\n\n urlForEvent: function(eventName, context) {\n var currentState = get(this, 'currentState');\n var targetStateName = currentState.lookupEventTransition(eventName);\n\n Ember.assert(Ember.String.fmt(\"You must specify a target state for event '%@' in order to link to it in the current state '%@'.\", [eventName, get(currentState, 'path')]), !!targetStateName);\n\n var targetState = this.findStateByPath(currentState, targetStateName);\n\n Ember.assert(\"Your target state name \" + targetStateName + \" for event \" + eventName + \" did not resolve to a state\", !!targetState);\n\n var hash = this.serializeRecursively(targetState, context);\n\n return this.urlFor(targetStateName, hash);\n },\n\n /** @private */\n serializeRecursively: function(state, hash) {\n hash = state.serialize(this, hash);\n var parentState = state.get(\"parentState\");\n if (parentState && parentState instanceof Ember.Route) {\n return this.serializeRecursively(parentState, hash);\n } else {\n return hash;\n }\n },\n\n abortRoutingPromises: function() {\n if (this._routingPromises) {\n this._routingPromises.abort();\n this._routingPromises = null;\n }\n },\n\n /**\n @private\n */\n handleStatePromises: function(states, complete) {\n this.abortRoutingPromises();\n\n this.set('isLocked', true);\n\n var manager = this;\n\n this._routingPromises = Ember._PromiseChain.create({\n promises: states.slice(),\n\n successCallback: function() {\n manager.set('isLocked', false);\n complete();\n },\n\n failureCallback: function() {\n throw \"Unable to load object\";\n },\n\n promiseSuccessCallback: function(item, args) {\n set(item, 'object', args[0]);\n },\n\n abortCallback: function() {\n manager.set('isLocked', false);\n }\n }).start();\n },\n\n /** @private */\n init: function() {\n this._super();\n\n var location = get(this, 'location'),\n rootURL = get(this, 'rootURL');\n\n if ('string' === typeof location) {\n set(this, 'location', Ember.Location.create({\n implementation: location,\n rootURL: rootURL\n }));\n }\n },\n\n /** @private */\n willDestroy: function() {\n get(this, 'location').destroy();\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Routing\n// Copyright: ©2012 Tilde Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\nvar get = Ember.get;\n\nEmber.StateManager.reopen(\n/** @scope Ember.StateManager.prototype */ {\n\n /**\n If the current state is a view state or the descendent of a view state,\n this property will be the view associated with it. If there is no\n view state active in this state manager, this value will be null.\n\n @type Ember.View\n */\n currentView: Ember.computed(function() {\n var currentState = get(this, 'currentState'),\n view;\n\n while (currentState) {\n // TODO: Remove this when view state is removed\n if (get(currentState, 'isViewState')) {\n view = get(currentState, 'view');\n if (view) { return view; }\n }\n\n currentState = get(currentState, 'parentState');\n }\n\n return null;\n }).property('currentState').cacheable()\n\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n/**\n @class\n\n Ember.ViewState extends Ember.State to control the presence of a childView within a\n container based on the current state of the ViewState's StateManager.\n\n ## Interactions with Ember's View System.\n When combined with instances of `Ember.StateManager`, ViewState is designed to\n interact with Ember's view system to control which views are added to\n and removed from the DOM based on the manager's current state.\n\n By default, a StateManager will manage views inside the 'body' element. This can be\n customized by setting the `rootElement` property to a CSS selector of an existing\n HTML element you would prefer to receive view rendering.\n\n\n viewStates = Ember.StateManager.create({\n rootElement: '#some-other-element'\n })\n\n You can also specify a particular instance of `Ember.ContainerView` you would like to receive\n view rendering by setting the `rootView` property. You will be responsible for placing\n this element into the DOM yourself.\n\n aLayoutView = Ember.ContainerView.create()\n\n // make sure this view instance is added to the browser\n aLayoutView.appendTo('body')\n\n App.viewStates = Ember.StateManager.create({\n rootView: aLayoutView\n })\n\n\n Once you have an instance of StateManager controlling a view, you can provide states\n that are instances of `Ember.ViewState`. When the StateManager enters a state\n that is an instance of `Ember.ViewState` that `ViewState`'s `view` property will be\n instantiated and inserted into the StateManager's `rootView` or `rootElement`.\n When a state is exited, the `ViewState`'s view will be removed from the StateManager's\n view.\n\n ContactListView = Ember.View.extend({\n classNames: ['my-contacts-css-class'],\n template: Ember.Handlebars.compile('

People

')\n })\n\n PhotoListView = Ember.View.extend({\n classNames: ['my-photos-css-class'],\n template: Ember.Handlebars.compile('

Photos

')\n })\n\n viewStates = Ember.StateManager.create({\n showingPeople: Ember.ViewState.create({\n view: ContactListView\n }),\n showingPhotos: Ember.ViewState.create({\n view: PhotoListView\n })\n })\n\n viewStates.transitionTo('showingPeople')\n\n The above code will change the rendered HTML from\n\n \n\n to\n\n \n
\n

People

\n
\n \n\n Changing the current state via `transitionTo` from `showingPeople` to\n `showingPhotos` will remove the `showingPeople` view and add the `showingPhotos` view:\n\n viewStates.transitionTo('showingPhotos')\n\n will change the rendered HTML to\n\n \n
\n

Photos

\n
\n \n\n\n When entering nested `ViewState`s, each state's view will be draw into the the StateManager's\n `rootView` or `rootElement` as siblings.\n\n\n ContactListView = Ember.View.extend({\n classNames: ['my-contacts-css-class'],\n template: Ember.Handlebars.compile('

People

')\n })\n\n EditAContactView = Ember.View.extend({\n classNames: ['editing-a-contact-css-class'],\n template: Ember.Handlebars.compile('Editing...')\n })\n\n viewStates = Ember.StateManager.create({\n showingPeople: Ember.ViewState.create({\n view: ContactListView,\n\n withEditingPanel: Ember.ViewState.create({\n view: EditAContactView\n })\n })\n })\n\n\n viewStates.transitionTo('showingPeople.withEditingPanel')\n\n\n Will result in the following rendered HTML:\n\n \n
\n

People

\n
\n\n
\n Editing...\n
\n \n\n\n ViewState views are added and removed from their StateManager's view via their\n `enter` and `exit` methods. If you need to override these methods, be sure to call\n `_super` to maintain the adding and removing behavior:\n\n viewStates = Ember.StateManager.create({\n aState: Ember.ViewState.create({\n view: Ember.View.extend({}),\n enter: function(manager){\n // calling _super ensures this view will be\n // properly inserted\n this._super(manager);\n\n // now you can do other things\n }\n })\n })\n\n ## Managing Multiple Sections of A Page With States\n Multiple StateManagers can be combined to control multiple areas of an application's rendered views.\n Given the following HTML body:\n\n \n \n
\n
\n \n\n You could separately manage view state for each section with two StateManagers\n\n navigationStates = Ember.StateManager.create({\n rootElement: '#sidebar-nav',\n userAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n userNotAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n contentStates = Ember.StateManager.create({\n rootElement: '#content-area',\n books: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n music: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n\n If you prefer to start with an empty body and manage state programmatically you\n can also take advantage of StateManager's `rootView` property and the ability of\n `Ember.ContainerView`s to manually manage their child views.\n\n\n dashboard = Ember.ContainerView.create({\n childViews: ['navigationAreaView', 'contentAreaView'],\n navigationAreaView: Ember.ContainerView.create({}),\n contentAreaView: Ember.ContainerView.create({})\n })\n\n navigationStates = Ember.StateManager.create({\n rootView: dashboard.get('navigationAreaView'),\n userAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n userNotAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n contentStates = Ember.StateManager.create({\n rootView: dashboard.get('contentAreaView'),\n books: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n music: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n dashboard.appendTo('body')\n\n ## User Manipulation of State via `{{action}}` Helpers\n The Handlebars `{{action}}` helper is StateManager-aware and will use StateManager action sending\n to connect user interaction to action-based state transitions.\n\n Given the following body and handlebars template\n\n \n \n \n\n And application code\n\n App = Ember.Application.create()\n App.appStates = Ember.StateManager.create({\n initialState: 'aState',\n aState: Ember.State.create({\n anAction: function(manager, context){}\n }),\n bState: Ember.State.create({})\n })\n\n A user initiated click or touch event on \"Go\" will trigger the 'anAction' method of\n `App.appStates.aState` with `App.appStates` as the first argument and a\n `jQuery.Event` object as the second object. The `jQuery.Event` will include a property\n `view` that references the `Ember.View` object that was interacted with.\n\n**/\nEmber.ViewState = Ember.State.extend(\n/** @scope Ember.ViewState.prototype */ {\n isViewState: true,\n\n init: function() {\n Ember.deprecate(\"Ember.ViewState is deprecated and will be removed from future releases. Consider using the outlet pattern to display nested views instead. For more information, see http://emberjs.com/guides/outlets/.\");\n return this._super();\n },\n\n enter: function(stateManager) {\n var view = get(this, 'view'), root, childViews;\n\n if (view) {\n if (Ember.View.detect(view)) {\n view = view.create();\n set(this, 'view', view);\n }\n\n Ember.assert('view must be an Ember.View', view instanceof Ember.View);\n\n root = stateManager.get('rootView');\n\n if (root) {\n childViews = get(root, 'childViews');\n childViews.pushObject(view);\n } else {\n root = stateManager.get('rootElement') || 'body';\n view.appendTo(root);\n }\n }\n },\n\n exit: function(stateManager) {\n var view = get(this, 'view');\n\n if (view) {\n // If the view has a parent view, then it is\n // part of a view hierarchy and should be removed\n // from its parent.\n if (get(view, 'parentView')) {\n view.removeFromParent();\n } else {\n\n // Otherwise, the view is a \"root view\" and\n // was appended directly to the DOM.\n view.remove();\n }\n }\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Statecharts\n// Copyright: ©2011 Living Social Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: metamorph\n// Copyright: ©2011 My Company Inc. All rights reserved.\n// ==========================================================================\n\n(function(window) {\n\n var K = function(){},\n guid = 0,\n document = window.document,\n\n // Feature-detect the W3C range API, the extended check is for IE9 which only partially supports ranges\n supportsRange = ('createRange' in document) && (typeof Range !== 'undefined') && Range.prototype.createContextualFragment,\n\n // Internet Explorer prior to 9 does not allow setting innerHTML if the first element\n // is a \"zero-scope\" element. This problem can be worked around by making\n // the first node an invisible text node. We, like Modernizr, use ­\n needsShy = (function(){\n var testEl = document.createElement('div');\n testEl.innerHTML = \"
\";\n testEl.firstChild.innerHTML = \"\";\n return testEl.firstChild.innerHTML === '';\n })();\n\n // Constructor that supports either Metamorph('foo') or new\n // Metamorph('foo');\n //\n // Takes a string of HTML as the argument.\n\n var Metamorph = function(html) {\n var self;\n\n if (this instanceof Metamorph) {\n self = this;\n } else {\n self = new K();\n }\n\n self.innerHTML = html;\n var myGuid = 'metamorph-'+(guid++);\n self.start = myGuid + '-start';\n self.end = myGuid + '-end';\n\n return self;\n };\n\n K.prototype = Metamorph.prototype;\n\n var rangeFor, htmlFunc, removeFunc, outerHTMLFunc, appendToFunc, afterFunc, prependFunc, startTagFunc, endTagFunc;\n\n outerHTMLFunc = function() {\n return this.startTag() + this.innerHTML + this.endTag();\n };\n\n startTagFunc = function() {\n return \"\";\n };\n\n endTagFunc = function() {\n return \"\";\n };\n\n // If we have the W3C range API, this process is relatively straight forward.\n if (supportsRange) {\n\n // Get a range for the current morph. Optionally include the starting and\n // ending placeholders.\n rangeFor = function(morph, outerToo) {\n var range = document.createRange();\n var before = document.getElementById(morph.start);\n var after = document.getElementById(morph.end);\n\n if (outerToo) {\n range.setStartBefore(before);\n range.setEndAfter(after);\n } else {\n range.setStartAfter(before);\n range.setEndBefore(after);\n }\n\n return range;\n };\n\n htmlFunc = function(html, outerToo) {\n // get a range for the current metamorph object\n var range = rangeFor(this, outerToo);\n\n // delete the contents of the range, which will be the\n // nodes between the starting and ending placeholder.\n range.deleteContents();\n\n // create a new document fragment for the HTML\n var fragment = range.createContextualFragment(html);\n\n // insert the fragment into the range\n range.insertNode(fragment);\n };\n\n removeFunc = function() {\n // get a range for the current metamorph object including\n // the starting and ending placeholders.\n var range = rangeFor(this, true);\n\n // delete the entire range.\n range.deleteContents();\n };\n\n appendToFunc = function(node) {\n var range = document.createRange();\n range.setStart(node);\n range.collapse(false);\n var frag = range.createContextualFragment(this.outerHTML());\n node.appendChild(frag);\n };\n\n afterFunc = function(html) {\n var range = document.createRange();\n var after = document.getElementById(this.end);\n\n range.setStartAfter(after);\n range.setEndAfter(after);\n\n var fragment = range.createContextualFragment(html);\n range.insertNode(fragment);\n };\n\n prependFunc = function(html) {\n var range = document.createRange();\n var start = document.getElementById(this.start);\n\n range.setStartAfter(start);\n range.setEndAfter(start);\n\n var fragment = range.createContextualFragment(html);\n range.insertNode(fragment);\n };\n\n } else {\n /**\n * This code is mostly taken from jQuery, with one exception. In jQuery's case, we\n * have some HTML and we need to figure out how to convert it into some nodes.\n *\n * In this case, jQuery needs to scan the HTML looking for an opening tag and use\n * that as the key for the wrap map. In our case, we know the parent node, and\n * can use its type as the key for the wrap map.\n **/\n var wrapMap = {\n select: [ 1, \"\" ],\n fieldset: [ 1, \"
\", \"
\" ],\n table: [ 1, \"\", \"
\" ],\n tbody: [ 2, \"\", \"
\" ],\n tr: [ 3, \"\", \"
\" ],\n colgroup: [ 2, \"\", \"
\" ],\n map: [ 1, \"\", \"\" ],\n _default: [ 0, \"\", \"\" ]\n };\n\n /**\n * Given a parent node and some HTML, generate a set of nodes. Return the first\n * node, which will allow us to traverse the rest using nextSibling.\n *\n * We need to do this because innerHTML in IE does not really parse the nodes.\n **/\n var firstNodeFor = function(parentNode, html) {\n var arr = wrapMap[parentNode.tagName.toLowerCase()] || wrapMap._default;\n var depth = arr[0], start = arr[1], end = arr[2];\n\n if (needsShy) { html = '­'+html; }\n\n var element = document.createElement('div');\n element.innerHTML = start + html + end;\n\n for (var i=0; i<=depth; i++) {\n element = element.firstChild;\n }\n\n // Look for ­ to remove it.\n if (needsShy) {\n var shyElement = element;\n\n // Sometimes we get nameless elements with the shy inside\n while (shyElement.nodeType === 1 && !shyElement.nodeName) {\n shyElement = shyElement.firstChild;\n }\n\n // At this point it's the actual unicode character.\n if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === \"\\u00AD\") {\n shyElement.nodeValue = shyElement.nodeValue.slice(1);\n }\n }\n\n return element;\n };\n\n /**\n * In some cases, Internet Explorer can create an anonymous node in\n * the hierarchy with no tagName. You can create this scenario via:\n *\n * div = document.createElement(\"div\");\n * div.innerHTML = \"­
hi
\";\n * div.firstChild.firstChild.tagName //=> \"\"\n *\n * If our script markers are inside such a node, we need to find that\n * node and use *it* as the marker.\n **/\n var realNode = function(start) {\n while (start.parentNode.tagName === \"\") {\n start = start.parentNode;\n }\n\n return start;\n };\n\n /**\n * When automatically adding a tbody, Internet Explorer inserts the\n * tbody immediately before the first . Other browsers create it\n * before the first node, no matter what.\n *\n * This means the the following code:\n *\n * div = document.createElement(\"div\");\n * div.innerHTML = \"
hi
\n *\n * Generates the following DOM in IE:\n *\n * + div\n * + table\n * - script id='first'\n * + tbody\n * + tr\n * + td\n * - \"hi\"\n * - script id='last'\n *\n * Which means that the two script tags, even though they were\n * inserted at the same point in the hierarchy in the original\n * HTML, now have different parents.\n *\n * This code reparents the first script tag by making it the tbody's\n * first child.\n **/\n var fixParentage = function(start, end) {\n if (start.parentNode !== end.parentNode) {\n end.parentNode.insertBefore(start, end.parentNode.firstChild);\n }\n };\n\n htmlFunc = function(html, outerToo) {\n // get the real starting node. see realNode for details.\n var start = realNode(document.getElementById(this.start));\n var end = document.getElementById(this.end);\n var parentNode = end.parentNode;\n var node, nextSibling, last;\n\n // make sure that the start and end nodes share the same\n // parent. If not, fix it.\n fixParentage(start, end);\n\n // remove all of the nodes after the starting placeholder and\n // before the ending placeholder.\n node = start.nextSibling;\n while (node) {\n nextSibling = node.nextSibling;\n last = node === end;\n\n // if this is the last node, and we want to remove it as well,\n // set the `end` node to the next sibling. This is because\n // for the rest of the function, we insert the new nodes\n // before the end (note that insertBefore(node, null) is\n // the same as appendChild(node)).\n //\n // if we do not want to remove it, just break.\n if (last) {\n if (outerToo) { end = node.nextSibling; } else { break; }\n }\n\n node.parentNode.removeChild(node);\n\n // if this is the last node and we didn't break before\n // (because we wanted to remove the outer nodes), break\n // now.\n if (last) { break; }\n\n node = nextSibling;\n }\n\n // get the first node for the HTML string, even in cases like\n // tables and lists where a simple innerHTML on a div would\n // swallow some of the content.\n node = firstNodeFor(start.parentNode, html);\n\n // copy the nodes for the HTML between the starting and ending\n // placeholder.\n while (node) {\n nextSibling = node.nextSibling;\n parentNode.insertBefore(node, end);\n node = nextSibling;\n }\n };\n\n // remove the nodes in the DOM representing this metamorph.\n //\n // this includes the starting and ending placeholders.\n removeFunc = function() {\n var start = realNode(document.getElementById(this.start));\n var end = document.getElementById(this.end);\n\n this.html('');\n start.parentNode.removeChild(start);\n end.parentNode.removeChild(end);\n };\n\n appendToFunc = function(parentNode) {\n var node = firstNodeFor(parentNode, this.outerHTML());\n\n while (node) {\n nextSibling = node.nextSibling;\n parentNode.appendChild(node);\n node = nextSibling;\n }\n };\n\n afterFunc = function(html) {\n // get the real starting node. see realNode for details.\n var end = document.getElementById(this.end);\n var insertBefore = end.nextSibling;\n var parentNode = end.parentNode;\n var nextSibling;\n var node;\n\n // get the first node for the HTML string, even in cases like\n // tables and lists where a simple innerHTML on a div would\n // swallow some of the content.\n node = firstNodeFor(parentNode, html);\n\n // copy the nodes for the HTML between the starting and ending\n // placeholder.\n while (node) {\n nextSibling = node.nextSibling;\n parentNode.insertBefore(node, insertBefore);\n node = nextSibling;\n }\n };\n\n prependFunc = function(html) {\n var start = document.getElementById(this.start);\n var parentNode = start.parentNode;\n var nextSibling;\n var node;\n\n node = firstNodeFor(parentNode, html);\n var insertBefore = start.nextSibling;\n\n while (node) {\n nextSibling = node.nextSibling;\n parentNode.insertBefore(node, insertBefore);\n node = nextSibling;\n }\n }\n }\n\n Metamorph.prototype.html = function(html) {\n this.checkRemoved();\n if (html === undefined) { return this.innerHTML; }\n\n htmlFunc.call(this, html);\n\n this.innerHTML = html;\n };\n\n Metamorph.prototype.replaceWith = function(html) {\n this.checkRemoved();\n htmlFunc.call(this, html, true);\n };\n\n Metamorph.prototype.remove = removeFunc;\n Metamorph.prototype.outerHTML = outerHTMLFunc;\n Metamorph.prototype.appendTo = appendToFunc;\n Metamorph.prototype.after = afterFunc;\n Metamorph.prototype.prepend = prependFunc;\n Metamorph.prototype.startTag = startTagFunc;\n Metamorph.prototype.endTag = endTagFunc;\n\n Metamorph.prototype.isRemoved = function() {\n var before = document.getElementById(this.start);\n var after = document.getElementById(this.end);\n\n return !before || !after;\n };\n\n Metamorph.prototype.checkRemoved = function() {\n if (this.isRemoved()) {\n throw new Error(\"Cannot perform operations on a Metamorph that is not in the DOM.\");\n }\n };\n\n window.Metamorph = Metamorph;\n})(this);\n\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\nvar objectCreate = Ember.create;\n\n/**\n @namespace\n @name Handlebars\n @private\n*/\n\n/**\n @namespace\n @name Handlebars.helpers\n @description Helpers for Handlebars templates\n*/\n\nEmber.assert(\"Ember Handlebars requires Handlebars 1.0.beta.5 or greater\", window.Handlebars && window.Handlebars.VERSION.match(/^1\\.0\\.beta\\.[56789]$|^1\\.0\\.rc\\.[123456789]+/));\n\n/**\n @class\n\n Prepares the Handlebars templating library for use inside Ember's view\n system.\n\n The Ember.Handlebars object is the standard Handlebars library, extended to use\n Ember's get() method instead of direct property access, which allows\n computed properties to be used inside templates.\n\n To create an Ember.Handlebars template, call Ember.Handlebars.compile(). This will\n return a function that can be used by Ember.View for rendering.\n*/\nEmber.Handlebars = objectCreate(Handlebars);\n\nEmber.Handlebars.helpers = objectCreate(Handlebars.helpers);\n\n/**\n Override the the opcode compiler and JavaScript compiler for Handlebars.\n*/\nEmber.Handlebars.Compiler = function() {};\nEmber.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);\nEmber.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;\n\nEmber.Handlebars.JavaScriptCompiler = function() {};\nEmber.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);\nEmber.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;\nEmber.Handlebars.JavaScriptCompiler.prototype.namespace = \"Ember.Handlebars\";\n\n\nEmber.Handlebars.JavaScriptCompiler.prototype.initializeBuffer = function() {\n return \"''\";\n};\n\n/**\n Override the default buffer for Ember Handlebars. By default, Handlebars creates\n an empty String at the beginning of each invocation and appends to it. Ember's\n Handlebars overrides this to append to a single shared buffer.\n\n @private\n*/\nEmber.Handlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {\n return \"data.buffer.push(\"+string+\");\";\n};\n\n/**\n Rewrite simple mustaches from {{foo}} to {{bind \"foo\"}}. This means that all simple\n mustaches in Ember's Handlebars will also set up an observer to keep the DOM\n up to date when the underlying property changes.\n\n @private\n*/\nEmber.Handlebars.Compiler.prototype.mustache = function(mustache) {\n if (mustache.params.length || mustache.hash) {\n return Handlebars.Compiler.prototype.mustache.call(this, mustache);\n } else {\n var id = new Handlebars.AST.IdNode(['_triageMustache']);\n\n // Update the mustache node to include a hash value indicating whether the original node\n // was escaped. This will allow us to properly escape values when the underlying value\n // changes and we need to re-render the value.\n if(!mustache.escaped) {\n mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);\n mustache.hash.pairs.push([\"unescaped\", new Handlebars.AST.StringNode(\"true\")]);\n }\n mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);\n return Handlebars.Compiler.prototype.mustache.call(this, mustache);\n }\n};\n\n/**\n Used for precompilation of Ember Handlebars templates. This will not be used during normal\n app execution.\n\n @param {String} string The template to precompile\n*/\nEmber.Handlebars.precompile = function(string) {\n var ast = Handlebars.parse(string);\n\n var options = {\n knownHelpers: {\n action: true,\n unbound: true,\n bindAttr: true,\n template: true,\n view: true,\n _triageMustache: true\n },\n data: true,\n stringParams: true\n };\n\n var environment = new Ember.Handlebars.Compiler().compile(ast, options);\n return new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n};\n\n/**\n The entry point for Ember Handlebars. This replaces the default Handlebars.compile and turns on\n template-local data and String parameters.\n\n @param {String} string The template to compile\n*/\nEmber.Handlebars.compile = function(string) {\n var ast = Handlebars.parse(string);\n var options = { data: true, stringParams: true };\n var environment = new Ember.Handlebars.Compiler().compile(ast, options);\n var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n\n return Handlebars.template(templateSpec);\n};\n\n/**\n If a path starts with a reserved keyword, returns the root\n that should be used.\n\n @private\n*/\nvar normalizePath = Ember.Handlebars.normalizePath = function(root, path, data) {\n var keywords = (data && data.keywords) || {},\n keyword, isKeyword;\n\n // Get the first segment of the path. For example, if the\n // path is \"foo.bar.baz\", returns \"foo\".\n keyword = path.split('.', 1)[0];\n\n // Test to see if the first path is a keyword that has been\n // passed along in the view's data hash. If so, we will treat\n // that object as the new root.\n if (keywords.hasOwnProperty(keyword)) {\n // Look up the value in the template's data hash.\n root = keywords[keyword];\n isKeyword = true;\n\n // Handle cases where the entire path is the reserved\n // word. In that case, return the object itself.\n if (path === keyword) {\n path = '';\n } else {\n // Strip the keyword from the path and look up\n // the remainder from the newly found root.\n path = path.substr(keyword.length+1);\n }\n }\n\n return { root: root, path: path, isKeyword: isKeyword };\n};\n/**\n Lookup both on root and on window. If the path starts with\n a keyword, the corresponding object will be looked up in the\n template's data hash and used to resolve the path.\n\n @param {Object} root The object to look up the property on\n @param {String} path The path to be lookedup\n @param {Object} options The template's option hash\n*/\n\nEmber.Handlebars.getPath = function(root, path, options) {\n var data = options && options.data,\n normalizedPath = normalizePath(root, path, data),\n value;\n\n // In cases where the path begins with a keyword, change the\n // root to the value represented by that keyword, and ensure\n // the path is relative to it.\n root = normalizedPath.root;\n path = normalizedPath.path;\n\n value = Ember.get(root, path);\n\n if (value === undefined && root !== window && Ember.isGlobalPath(path)) {\n value = Ember.get(window, path);\n }\n return value;\n};\n\n/**\n Registers a helper in Handlebars that will be called if no property with the\n given name can be found on the current context object, and no helper with\n that name is registered.\n\n This throws an exception with a more helpful error message so the user can\n track down where the problem is happening.\n\n @name Handlebars.helpers.helperMissing\n @param {String} path\n @param {Hash} options\n*/\nEmber.Handlebars.registerHelper('helperMissing', function(path, options) {\n var error, view = \"\";\n\n error = \"%@ Handlebars error: Could not find property '%@' on object %@.\";\n if (options.data){\n view = options.data.view;\n }\n throw new Ember.Error(Ember.String.fmt(error, [view, path, this]));\n});\n\n\n})();\n\n\n\n(function() {\n\nEmber.String.htmlSafe = function(str) {\n return new Handlebars.SafeString(str);\n};\n\nvar htmlSafe = Ember.String.htmlSafe;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n @see Ember.String.htmlSafe\n */\n String.prototype.htmlSafe = function() {\n return htmlSafe(this);\n };\n\n}\n\n})();\n\n\n\n(function() {\n/*jshint newcap:false*/\nvar set = Ember.set, get = Ember.get;\n\nvar DOMManager = {\n remove: function(view) {\n var morph = view.morph;\n if (morph.isRemoved()) { return; }\n set(view, 'element', null);\n view._lastInsert = null;\n morph.remove();\n },\n\n prepend: function(view, childView) {\n childView._insertElementLater(function() {\n var morph = view.morph;\n morph.prepend(childView.outerHTML);\n childView.outerHTML = null;\n });\n },\n\n after: function(view, nextView) {\n nextView._insertElementLater(function() {\n var morph = view.morph;\n morph.after(nextView.outerHTML);\n nextView.outerHTML = null;\n });\n },\n\n replace: function(view) {\n var morph = view.morph;\n\n view.transitionTo('preRender');\n view.clearRenderedChildren();\n var buffer = view.renderToBuffer();\n\n Ember.run.schedule('render', this, function() {\n if (get(view, 'isDestroyed')) { return; }\n view.invalidateRecursively('element');\n view._notifyWillInsertElement();\n morph.replaceWith(buffer.string());\n view.transitionTo('inDOM');\n view._notifyDidInsertElement();\n });\n },\n\n empty: function(view) {\n view.morph.html(\"\");\n }\n};\n\n// The `morph` and `outerHTML` properties are internal only\n// and not observable.\n\nEmber._Metamorph = Ember.Mixin.create({\n isVirtual: true,\n tagName: '',\n\n init: function() {\n this._super();\n this.morph = Metamorph();\n },\n\n beforeRender: function(buffer) {\n buffer.push(this.morph.startTag());\n },\n\n afterRender: function(buffer) {\n buffer.push(this.morph.endTag());\n },\n\n createElement: function() {\n var buffer = this.renderToBuffer();\n this.outerHTML = buffer.string();\n this.clearBuffer();\n },\n\n domManager: DOMManager\n});\n\nEmber._MetamorphView = Ember.View.extend(Ember._Metamorph);\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\nvar get = Ember.get, set = Ember.set, getPath = Ember.Handlebars.getPath;\n/**\n @ignore\n @private\n @class\n\n Ember._HandlebarsBoundView is a private view created by the Handlebars `{{bind}}`\n helpers that is used to keep track of bound properties.\n\n Every time a property is bound using a `{{mustache}}`, an anonymous subclass\n of Ember._HandlebarsBoundView is created with the appropriate sub-template and\n context set up. When the associated property changes, just the template for\n this view will re-render.\n*/\nEmber._HandlebarsBoundView = Ember._MetamorphView.extend({\n/** @scope Ember._HandlebarsBoundView.prototype */\n\n /**\n The function used to determine if the `displayTemplate` or\n `inverseTemplate` should be rendered. This should be a function that takes\n a value and returns a Boolean.\n\n @type Function\n @default null\n */\n shouldDisplayFunc: null,\n\n /**\n Whether the template rendered by this view gets passed the context object\n of its parent template, or gets passed the value of retrieving `path`\n from the `pathRoot`.\n\n For example, this is true when using the `{{#if}}` helper, because the\n template inside the helper should look up properties relative to the same\n object as outside the block. This would be false when used with `{{#with\n foo}}` because the template should receive the object found by evaluating\n `foo`.\n\n @type Boolean\n @default false\n */\n preserveContext: false,\n\n /**\n If `preserveContext` is true, this is the object that will be used\n to render the template.\n\n @type Object\n */\n previousContext: null,\n\n /**\n The template to render when `shouldDisplayFunc` evaluates to true.\n\n @type Function\n @default null\n */\n displayTemplate: null,\n\n /**\n The template to render when `shouldDisplayFunc` evaluates to false.\n\n @type Function\n @default null\n */\n inverseTemplate: null,\n\n\n /**\n The path to look up on `pathRoot` that is passed to\n `shouldDisplayFunc` to determine which template to render.\n\n In addition, if `preserveContext` is false, the object at this path will\n be passed to the template when rendering.\n\n @type String\n @default null\n */\n path: null,\n\n /**\n The object from which the `path` will be looked up. Sometimes this is the\n same as the `previousContext`, but in cases where this view has been generated\n for paths that start with a keyword such as `view` or `controller`, the\n path root will be that resolved object.\n\n @type Object\n */\n pathRoot: null,\n\n normalizedValue: Ember.computed(function() {\n var path = get(this, 'path'),\n pathRoot = get(this, 'pathRoot'),\n valueNormalizer = get(this, 'valueNormalizerFunc'),\n result, templateData;\n\n // Use the pathRoot as the result if no path is provided. This\n // happens if the path is `this`, which gets normalized into\n // a `pathRoot` of the current Handlebars context and a path\n // of `''`.\n if (path === '') {\n result = pathRoot;\n } else {\n templateData = get(this, 'templateData');\n result = getPath(pathRoot, path, { data: templateData });\n }\n\n return valueNormalizer ? valueNormalizer(result) : result;\n }).property('path', 'pathRoot', 'valueNormalizerFunc').volatile(),\n\n rerenderIfNeeded: function() {\n if (!get(this, 'isDestroyed') && get(this, 'normalizedValue') !== this._lastNormalizedValue) {\n this.rerender();\n }\n },\n\n /**\n Determines which template to invoke, sets up the correct state based on\n that logic, then invokes the default Ember.View `render` implementation.\n\n This method will first look up the `path` key on `pathRoot`,\n then pass that value to the `shouldDisplayFunc` function. If that returns\n true, the `displayTemplate` function will be rendered to DOM. Otherwise,\n `inverseTemplate`, if specified, will be rendered.\n\n For example, if this Ember._HandlebarsBoundView represented the {{#with foo}}\n helper, it would look up the `foo` property of its context, and\n `shouldDisplayFunc` would always return true. The object found by looking\n up `foo` would be passed to `displayTemplate`.\n\n @param {Ember.RenderBuffer} buffer\n */\n render: function(buffer) {\n // If not invoked via a triple-mustache ({{{foo}}}), escape\n // the content of the template.\n var escape = get(this, 'isEscaped');\n\n var shouldDisplay = get(this, 'shouldDisplayFunc'),\n preserveContext = get(this, 'preserveContext'),\n context = get(this, 'previousContext');\n\n var inverseTemplate = get(this, 'inverseTemplate'),\n displayTemplate = get(this, 'displayTemplate');\n\n var result = get(this, 'normalizedValue');\n this._lastNormalizedValue = result;\n\n // First, test the conditional to see if we should\n // render the template or not.\n if (shouldDisplay(result)) {\n set(this, 'template', displayTemplate);\n\n // If we are preserving the context (for example, if this\n // is an #if block, call the template with the same object.\n if (preserveContext) {\n set(this, '_context', context);\n } else {\n // Otherwise, determine if this is a block bind or not.\n // If so, pass the specified object to the template\n if (displayTemplate) {\n set(this, '_context', result);\n } else {\n // This is not a bind block, just push the result of the\n // expression to the render context and return.\n if (result === null || result === undefined) {\n result = \"\";\n } else if (!(result instanceof Handlebars.SafeString)) {\n result = String(result);\n }\n\n if (escape) { result = Handlebars.Utils.escapeExpression(result); }\n buffer.push(result);\n return;\n }\n }\n } else if (inverseTemplate) {\n set(this, 'template', inverseTemplate);\n\n if (preserveContext) {\n set(this, '_context', context);\n } else {\n set(this, '_context', result);\n }\n } else {\n set(this, 'template', function() { return ''; });\n }\n\n return this._super(buffer);\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\nvar getPath = Ember.Handlebars.getPath, normalizePath = Ember.Handlebars.normalizePath;\nvar forEach = Ember.ArrayPolyfills.forEach;\n\nvar EmberHandlebars = Ember.Handlebars, helpers = EmberHandlebars.helpers;\n\n// Binds a property into the DOM. This will create a hook in DOM that the\n// KVO system will look for and update if the property changes.\n/** @private */\nfunction bind(property, options, preserveContext, shouldDisplay, valueNormalizer) {\n var data = options.data,\n fn = options.fn,\n inverse = options.inverse,\n view = data.view,\n currentContext = this,\n pathRoot, path, normalized;\n\n normalized = normalizePath(currentContext, property, data);\n\n pathRoot = normalized.root;\n path = normalized.path;\n\n // Set up observers for observable objects\n if ('object' === typeof this) {\n // Create the view that will wrap the output of this template/property\n // and add it to the nearest view's childViews array.\n // See the documentation of Ember._HandlebarsBoundView for more.\n var bindView = view.createChildView(Ember._HandlebarsBoundView, {\n preserveContext: preserveContext,\n shouldDisplayFunc: shouldDisplay,\n valueNormalizerFunc: valueNormalizer,\n displayTemplate: fn,\n inverseTemplate: inverse,\n path: path,\n pathRoot: pathRoot,\n previousContext: currentContext,\n isEscaped: !options.hash.unescaped,\n templateData: options.data\n });\n\n view.appendChild(bindView);\n\n /** @private */\n var observer = function() {\n Ember.run.once(bindView, 'rerenderIfNeeded');\n };\n\n // Observes the given property on the context and\n // tells the Ember._HandlebarsBoundView to re-render. If property\n // is an empty string, we are printing the current context\n // object ({{this}}) so updating it is not our responsibility.\n if (path !== '') {\n Ember.addObserver(pathRoot, path, observer);\n }\n } else {\n // The object is not observable, so just render it out and\n // be done with it.\n data.buffer.push(getPath(pathRoot, path, options));\n }\n}\n\n/**\n '_triageMustache' is used internally select between a binding and helper for\n the given context. Until this point, it would be hard to determine if the\n mustache is a property reference or a regular helper reference. This triage\n helper resolves that.\n\n This would not be typically invoked by directly.\n\n @private\n @name Handlebars.helpers._triageMustache\n @param {String} property Property/helperID to triage\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('_triageMustache', function(property, fn) {\n Ember.assert(\"You cannot pass more than one argument to the _triageMustache helper\", arguments.length <= 2);\n if (helpers[property]) {\n return helpers[property].call(this, fn);\n }\n else {\n return helpers.bind.apply(this, arguments);\n }\n});\n\n/**\n `bind` can be used to display a value, then update that value if it\n changes. For example, if you wanted to print the `title` property of\n `content`:\n\n {{bind \"content.title\"}}\n\n This will return the `title` property as a string, then create a new\n observer at the specified path. If it changes, it will update the value in\n DOM. Note that if you need to support IE7 and IE8 you must modify the\n model objects properties using Ember.get() and Ember.set() for this to work as\n it relies on Ember's KVO system. For all other browsers this will be handled\n for you automatically.\n\n @private\n @name Handlebars.helpers.bind\n @param {String} property Property to bind\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('bind', function(property, fn) {\n Ember.assert(\"You cannot pass more than one argument to the bind helper\", arguments.length <= 2);\n\n var context = (fn.contexts && fn.contexts[0]) || this;\n\n return bind.call(context, property, fn, false, function(result) {\n return !Ember.none(result);\n });\n});\n\n/**\n Use the `boundIf` helper to create a conditional that re-evaluates\n whenever the bound value changes.\n\n {{#boundIf \"content.shouldDisplayTitle\"}}\n {{content.title}}\n {{/boundIf}}\n\n @private\n @name Handlebars.helpers.boundIf\n @param {String} property Property to bind\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('boundIf', function(property, fn) {\n var context = (fn.contexts && fn.contexts[0]) || this;\n var func = function(result) {\n if (Ember.typeOf(result) === 'array') {\n return get(result, 'length') !== 0;\n } else {\n return !!result;\n }\n };\n\n return bind.call(context, property, fn, true, func, func);\n});\n\n/**\n @name Handlebars.helpers.with\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('with', function(context, options) {\n if (arguments.length === 4) {\n var keywordName, path, rootPath, normalized;\n\n Ember.assert(\"If you pass more than one argument to the with helper, it must be in the form #with foo as bar\", arguments[1] === \"as\");\n options = arguments[3];\n keywordName = arguments[2];\n path = arguments[0];\n\n Ember.assert(\"You must pass a block to the with helper\", options.fn && options.fn !== Handlebars.VM.noop);\n\n if (Ember.isGlobalPath(path)) {\n Ember.bind(options.data.keywords, keywordName, path);\n } else {\n normalized = normalizePath(this, path, options.data);\n path = normalized.path;\n rootPath = normalized.root;\n\n // This is a workaround for the fact that you cannot bind separate objects\n // together. When we implement that functionality, we should use it here.\n var contextKey = Ember.$.expando + Ember.guidFor(rootPath);\n options.data.keywords[contextKey] = rootPath;\n\n // if the path is '' (\"this\"), just bind directly to the current context\n var contextPath = path ? contextKey + '.' + path : contextKey;\n Ember.bind(options.data.keywords, keywordName, contextPath);\n }\n\n return bind.call(this, path, options.fn, true, function(result) {\n return !Ember.none(result);\n });\n } else {\n Ember.assert(\"You must pass exactly one argument to the with helper\", arguments.length === 2);\n Ember.assert(\"You must pass a block to the with helper\", options.fn && options.fn !== Handlebars.VM.noop);\n return helpers.bind.call(options.contexts[0], context, options);\n }\n});\n\n\n/**\n @name Handlebars.helpers.if\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('if', function(context, options) {\n Ember.assert(\"You must pass exactly one argument to the if helper\", arguments.length === 2);\n Ember.assert(\"You must pass a block to the if helper\", options.fn && options.fn !== Handlebars.VM.noop);\n\n return helpers.boundIf.call(options.contexts[0], context, options);\n});\n\n/**\n @name Handlebars.helpers.unless\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('unless', function(context, options) {\n Ember.assert(\"You must pass exactly one argument to the unless helper\", arguments.length === 2);\n Ember.assert(\"You must pass a block to the unless helper\", options.fn && options.fn !== Handlebars.VM.noop);\n\n var fn = options.fn, inverse = options.inverse;\n\n options.fn = inverse;\n options.inverse = fn;\n\n return helpers.boundIf.call(options.contexts[0], context, options);\n});\n\n/**\n `bindAttr` allows you to create a binding between DOM element attributes and\n Ember objects. For example:\n\n \"imageTitle\"}}\n\n @name Handlebars.helpers.bindAttr\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('bindAttr', function(options) {\n\n var attrs = options.hash;\n\n Ember.assert(\"You must specify at least one hash argument to bindAttr\", !!Ember.keys(attrs).length);\n\n var view = options.data.view;\n var ret = [];\n var ctx = this;\n\n // Generate a unique id for this element. This will be added as a\n // data attribute to the element so it can be looked up when\n // the bound property changes.\n var dataId = ++Ember.$.uuid;\n\n // Handle classes differently, as we can bind multiple classes\n var classBindings = attrs['class'];\n if (classBindings !== null && classBindings !== undefined) {\n var classResults = EmberHandlebars.bindClasses(this, classBindings, view, dataId, options);\n ret.push('class=\"' + Handlebars.Utils.escapeExpression(classResults.join(' ')) + '\"');\n delete attrs['class'];\n }\n\n var attrKeys = Ember.keys(attrs);\n\n // For each attribute passed, create an observer and emit the\n // current value of the property as an attribute.\n forEach.call(attrKeys, function(attr) {\n var path = attrs[attr],\n pathRoot, normalized;\n\n Ember.assert(fmt(\"You must provide a String for a bound attribute, not %@\", [path]), typeof path === 'string');\n\n normalized = normalizePath(ctx, path, options.data);\n\n pathRoot = normalized.root;\n path = normalized.path;\n\n var value = (path === 'this') ? pathRoot : getPath(pathRoot, path, options),\n type = Ember.typeOf(value);\n\n Ember.assert(fmt(\"Attributes must be numbers, strings or booleans, not %@\", [value]), value === null || value === undefined || type === 'number' || type === 'string' || type === 'boolean');\n\n var observer, invoker;\n\n /** @private */\n observer = function observer() {\n var result = getPath(pathRoot, path, options);\n\n Ember.assert(fmt(\"Attributes must be numbers, strings or booleans, not %@\", [result]), result === null || result === undefined || typeof result === 'number' || typeof result === 'string' || typeof result === 'boolean');\n\n var elem = view.$(\"[data-bindattr-\" + dataId + \"='\" + dataId + \"']\");\n\n // If we aren't able to find the element, it means the element\n // to which we were bound has been removed from the view.\n // In that case, we can assume the template has been re-rendered\n // and we need to clean up the observer.\n if (elem.length === 0) {\n Ember.removeObserver(pathRoot, path, invoker);\n return;\n }\n\n Ember.View.applyAttributeBindings(elem, attr, result);\n };\n\n /** @private */\n invoker = function() {\n Ember.run.once(observer);\n };\n\n // Add an observer to the view for when the property changes.\n // When the observer fires, find the element using the\n // unique data id and update the attribute to the new value.\n if (path !== 'this') {\n Ember.addObserver(pathRoot, path, invoker);\n }\n\n // if this changes, also change the logic in ember-views/lib/views/view.js\n if ((type === 'string' || (type === 'number' && !isNaN(value)))) {\n ret.push(attr + '=\"' + Handlebars.Utils.escapeExpression(value) + '\"');\n } else if (value && type === 'boolean') {\n // The developer controls the attr name, so it should always be safe\n ret.push(attr + '=\"' + attr + '\"');\n }\n }, this);\n\n // Add the unique identifier\n // NOTE: We use all lower-case since Firefox has problems with mixed case in SVG\n ret.push('data-bindattr-' + dataId + '=\"' + dataId + '\"');\n return new EmberHandlebars.SafeString(ret.join(' '));\n});\n\n/**\n Helper that, given a space-separated string of property paths and a context,\n returns an array of class names. Calling this method also has the side\n effect of setting up observers at those property paths, such that if they\n change, the correct class name will be reapplied to the DOM element.\n\n For example, if you pass the string \"fooBar\", it will first look up the\n \"fooBar\" value of the context. If that value is true, it will add the\n \"foo-bar\" class to the current element (i.e., the dasherized form of\n \"fooBar\"). If the value is a string, it will add that string as the class.\n Otherwise, it will not add any new class name.\n\n @param {Ember.Object} context\n The context from which to lookup properties\n\n @param {String} classBindings\n A string, space-separated, of class bindings to use\n\n @param {Ember.View} view\n The view in which observers should look for the element to update\n\n @param {Srting} bindAttrId\n Optional bindAttr id used to lookup elements\n\n @returns {Array} An array of class names to add\n*/\nEmberHandlebars.bindClasses = function(context, classBindings, view, bindAttrId, options) {\n var ret = [], newClass, value, elem;\n\n // Helper method to retrieve the property from the context and\n // determine which class string to return, based on whether it is\n // a Boolean or not.\n var classStringForPath = function(root, parsedPath, options) {\n var val,\n path = parsedPath.path;\n\n if (path === 'this') {\n val = root;\n } else if (path === '') {\n val = true;\n } else {\n val = getPath(root, path, options);\n }\n\n return Ember.View._classStringForValue(path, val, parsedPath.className, parsedPath.falsyClassName);\n };\n\n // For each property passed, loop through and setup\n // an observer.\n forEach.call(classBindings.split(' '), function(binding) {\n\n // Variable in which the old class value is saved. The observer function\n // closes over this variable, so it knows which string to remove when\n // the property changes.\n var oldClass;\n\n var observer, invoker;\n\n var parsedPath = Ember.View._parsePropertyPath(binding),\n path = parsedPath.path,\n pathRoot = context,\n normalized;\n\n if (path !== '' && path !== 'this') {\n normalized = normalizePath(context, path, options.data);\n\n pathRoot = normalized.root;\n path = normalized.path;\n }\n\n // Set up an observer on the context. If the property changes, toggle the\n // class name.\n /** @private */\n observer = function() {\n // Get the current value of the property\n newClass = classStringForPath(pathRoot, parsedPath, options);\n elem = bindAttrId ? view.$(\"[data-bindattr-\" + bindAttrId + \"='\" + bindAttrId + \"']\") : view.$();\n\n // If we can't find the element anymore, a parent template has been\n // re-rendered and we've been nuked. Remove the observer.\n if (elem.length === 0) {\n Ember.removeObserver(pathRoot, path, invoker);\n } else {\n // If we had previously added a class to the element, remove it.\n if (oldClass) {\n elem.removeClass(oldClass);\n }\n\n // If necessary, add a new class. Make sure we keep track of it so\n // it can be removed in the future.\n if (newClass) {\n elem.addClass(newClass);\n oldClass = newClass;\n } else {\n oldClass = null;\n }\n }\n };\n\n /** @private */\n invoker = function() {\n Ember.run.once(observer);\n };\n\n if (path !== '' && path !== 'this') {\n Ember.addObserver(pathRoot, path, invoker);\n }\n\n // We've already setup the observer; now we just need to figure out the\n // correct behavior right now on the first pass through.\n value = classStringForPath(pathRoot, parsedPath, options);\n\n if (value) {\n ret.push(value);\n\n // Make sure we save the current value so that it can be removed if the\n // observer fires.\n oldClass = value;\n }\n });\n\n return ret;\n};\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\n// TODO: Don't require the entire module\nvar get = Ember.get, set = Ember.set;\nvar PARENT_VIEW_PATH = /^parentView\\./;\nvar EmberHandlebars = Ember.Handlebars;\nvar VIEW_PRESERVES_CONTEXT = Ember.VIEW_PRESERVES_CONTEXT;\n\n/** @private */\nEmberHandlebars.ViewHelper = Ember.Object.create({\n\n propertiesFromHTMLOptions: function(options, thisContext) {\n var hash = options.hash, data = options.data;\n var extensions = {},\n classes = hash['class'],\n dup = false;\n\n if (hash.id) {\n extensions.elementId = hash.id;\n dup = true;\n }\n\n if (classes) {\n classes = classes.split(' ');\n extensions.classNames = classes;\n dup = true;\n }\n\n if (hash.classBinding) {\n extensions.classNameBindings = hash.classBinding.split(' ');\n dup = true;\n }\n\n if (hash.classNameBindings) {\n if (extensions.classNameBindings === undefined) extensions.classNameBindings = [];\n extensions.classNameBindings = extensions.classNameBindings.concat(hash.classNameBindings.split(' '));\n dup = true;\n }\n\n if (hash.attributeBindings) {\n Ember.assert(\"Setting 'attributeBindings' via Handlebars is not allowed. Please subclass Ember.View and set it there instead.\");\n extensions.attributeBindings = null;\n dup = true;\n }\n\n if (dup) {\n hash = Ember.$.extend({}, hash);\n delete hash.id;\n delete hash['class'];\n delete hash.classBinding;\n }\n\n // Set the proper context for all bindings passed to the helper. This applies to regular attribute bindings\n // as well as class name bindings. If the bindings are local, make them relative to the current context\n // instead of the view.\n var path;\n\n // Evaluate the context of regular attribute bindings:\n for (var prop in hash) {\n if (!hash.hasOwnProperty(prop)) { continue; }\n\n // Test if the property ends in \"Binding\"\n if (Ember.IS_BINDING.test(prop) && typeof hash[prop] === 'string') {\n path = this.contextualizeBindingPath(hash[prop], data);\n if (path) { hash[prop] = path; }\n }\n }\n\n // Evaluate the context of class name bindings:\n if (extensions.classNameBindings) {\n for (var b in extensions.classNameBindings) {\n var full = extensions.classNameBindings[b];\n if (typeof full === 'string') {\n // Contextualize the path of classNameBinding so this:\n //\n // classNameBinding=\"isGreen:green\"\n //\n // is converted to this:\n //\n // classNameBinding=\"bindingContext.isGreen:green\"\n var parsedPath = Ember.View._parsePropertyPath(full);\n path = this.contextualizeBindingPath(parsedPath.path, data);\n if (path) { extensions.classNameBindings[b] = path + parsedPath.classNames; }\n }\n }\n }\n\n // Make the current template context available to the view\n // for the bindings set up above.\n extensions.bindingContext = thisContext;\n\n return Ember.$.extend(hash, extensions);\n },\n\n // Transform bindings from the current context to a context that can be evaluated within the view.\n // Returns null if the path shouldn't be changed.\n //\n // TODO: consider the addition of a prefix that would allow this method to return `path`.\n contextualizeBindingPath: function(path, data) {\n var normalized = Ember.Handlebars.normalizePath(null, path, data);\n if (normalized.isKeyword) {\n return 'templateData.keywords.' + path;\n } else if (Ember.isGlobalPath(path)) {\n return null;\n } else if (path === 'this') {\n return 'bindingContext';\n } else {\n return 'bindingContext.' + path;\n }\n },\n\n helper: function(thisContext, path, options) {\n var inverse = options.inverse,\n data = options.data,\n view = data.view,\n fn = options.fn,\n hash = options.hash,\n newView;\n\n if ('string' === typeof path) {\n newView = EmberHandlebars.getPath(thisContext, path, options);\n Ember.assert(\"Unable to find view at path '\" + path + \"'\", !!newView);\n } else {\n newView = path;\n }\n\n Ember.assert(Ember.String.fmt('You must pass a view class to the #view helper, not %@ (%@)', [path, newView]), Ember.View.detect(newView));\n\n var viewOptions = this.propertiesFromHTMLOptions(options, thisContext);\n var currentView = data.view;\n viewOptions.templateData = options.data;\n\n if (fn) {\n Ember.assert(\"You cannot provide a template block if you also specified a templateName\", !get(viewOptions, 'templateName') && !get(newView.proto(), 'templateName'));\n viewOptions.template = fn;\n }\n\n // We only want to override the `_context` computed property if there is\n // no specified controller. See View#_context for more information.\n if (VIEW_PRESERVES_CONTEXT && !newView.proto().controller && !newView.proto().controllerBinding && !viewOptions.controller && !viewOptions.controllerBinding) {\n viewOptions._context = thisContext;\n }\n\n currentView.appendChild(newView, viewOptions);\n }\n});\n\n/**\n `{{view}}` inserts a new instance of `Ember.View` into a template passing its options\n to the `Ember.View`'s `create` method and using the supplied block as the view's own template.\n\n An empty `` and the following template:\n\n \n\n Will result in HTML structure:\n\n \n \n\n
\n A span:\n \n Hello.\n \n
\n \n\n ### parentView setting\n\n The `parentView` property of the new `Ember.View` instance created through `{{view}}`\n will be set to the `Ember.View` instance of the template where `{{view}}` was called.\n\n aView = Ember.View.create({\n template: Ember.Handlebars.compile(\"{{#view}} my parent: {{parentView.elementId}} {{/view}}\")\n })\n\n aView.appendTo('body')\n \n Will result in HTML structure:\n\n
\n
\n my parent: ember1\n
\n
\n\n ### Setting CSS id and class attributes\n\n The HTML `id` attribute can be set on the `{{view}}`'s resulting element with the `id` option.\n This option will _not_ be passed to `Ember.View.create`.\n\n \n\n Results in the following HTML structure:\n\n
\n \n hello.\n \n
\n\n The HTML `class` attribute can be set on the `{{view}}`'s resulting element with\n the `class` or `classNameBindings` options. The `class` option\n will directly set the CSS `class` attribute and will not be passed to\n `Ember.View.create`. `classNameBindings` will be passed to `create` and use\n `Ember.View`'s class name binding functionality:\n\n \n\n Results in the following HTML structure:\n\n
\n \n hello.\n \n
\n\n ### Supplying a different view class\n `{{view}}` can take an optional first argument before its supplied options to specify a\n path to a custom view class.\n\n \n\n The first argument can also be a relative path. Ember will search for the view class\n starting at the `Ember.View` of the template where `{{view}}` was used as the root object:\n\n MyApp = Ember.Application.create({})\n MyApp.OuterView = Ember.View.extend({\n innerViewClass: Ember.View.extend({\n classNames: ['a-custom-view-class-as-property']\n }),\n template: Ember.Handlebars.compile('{{#view \"innerViewClass\"}} hi {{/view}}')\n })\n\n MyApp.OuterView.create().appendTo('body')\n\nWill result in the following HTML:\n\n
\n
\n hi\n
\n
\n\n ### Blockless use\n\n If you supply a custom `Ember.View` subclass that specifies its own template\n or provide a `templateName` option to `{{view}}` it can be used without supplying a block.\n Attempts to use both a `templateName` option and supply a block will throw an error.\n\n \n\n ### viewName property\n\n You can supply a `viewName` option to `{{view}}`. The `Ember.View` instance will\n be referenced as a property of its parent view by this name.\n\n aView = Ember.View.create({\n template: Ember.Handlebars.compile('{{#view viewName=\"aChildByName\"}} hi {{/view}}')\n })\n\n aView.appendTo('body')\n aView.get('aChildByName') // the instance of Ember.View created by {{view}} helper\n\n @name Handlebars.helpers.view\n @param {String} path\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('view', function(path, options) {\n Ember.assert(\"The view helper only takes a single argument\", arguments.length <= 2);\n\n // If no path is provided, treat path param as options.\n if (path && path.data && path.data.isRenderData) {\n options = path;\n path = \"Ember.View\";\n }\n\n return EmberHandlebars.ViewHelper.helper(this, path, options);\n});\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\n// TODO: Don't require all of this module\nvar get = Ember.get, getPath = Ember.Handlebars.getPath, fmt = Ember.String.fmt;\n\n/**\n `{{collection}}` is a `Ember.Handlebars` helper for adding instances of\n `Ember.CollectionView` to a template. See `Ember.CollectionView` for additional\n information on how a `CollectionView` functions.\n\n `{{collection}}`'s primary use is as a block helper with a `contentBinding` option\n pointing towards an `Ember.Array`-compatible object. An `Ember.View` instance will\n be created for each item in its `content` property. Each view will have its own\n `content` property set to the appropriate item in the collection.\n\n The provided block will be applied as the template for each item's view.\n\n Given an empty `` the following template:\n\n \n\n And the following application code\n\n App = Ember.Application.create()\n App.items = [\n Ember.Object.create({name: 'Dave'}),\n Ember.Object.create({name: 'Mary'}),\n Ember.Object.create({name: 'Sara'})\n ]\n\n Will result in the HTML structure below\n\n
\n
Hi Dave
\n
Hi Mary
\n
Hi Sara
\n
\n\n ### Blockless Use\n If you provide an `itemViewClass` option that has its own `template` you can omit\n the block.\n\n The following template:\n\n \n\n And application code\n\n App = Ember.Application.create()\n App.items = [\n Ember.Object.create({name: 'Dave'}),\n Ember.Object.create({name: 'Mary'}),\n Ember.Object.create({name: 'Sara'})\n ]\n\n App.AnItemView = Ember.View.extend({\n template: Ember.Handlebars.compile(\"Greetings {{content.name}}\")\n })\n\n Will result in the HTML structure below\n\n
\n
Greetings Dave
\n
Greetings Mary
\n
Greetings Sara
\n
\n\n ### Specifying a CollectionView subclass\n By default the `{{collection}}` helper will create an instance of `Ember.CollectionView`.\n You can supply a `Ember.CollectionView` subclass to the helper by passing it\n as the first argument:\n\n \n\n\n ### Forwarded `item.*`-named Options\n As with the `{{view}}`, helper options passed to the `{{collection}}` will be set on\n the resulting `Ember.CollectionView` as properties. Additionally, options prefixed with\n `item` will be applied to the views rendered for each item (note the camelcasing):\n\n \n\n Will result in the following HTML structure:\n\n
\n

Howdy Dave

\n

Howdy Mary

\n

Howdy Sara

\n
\n \n @name Handlebars.helpers.collection\n @param {String} path\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmber.Handlebars.registerHelper('collection', function(path, options) {\n // If no path is provided, treat path param as options.\n if (path && path.data && path.data.isRenderData) {\n options = path;\n path = undefined;\n Ember.assert(\"You cannot pass more than one argument to the collection helper\", arguments.length === 1);\n } else {\n Ember.assert(\"You cannot pass more than one argument to the collection helper\", arguments.length === 2);\n }\n\n var fn = options.fn;\n var data = options.data;\n var inverse = options.inverse;\n\n // If passed a path string, convert that into an object.\n // Otherwise, just default to the standard class.\n var collectionClass;\n collectionClass = path ? getPath(this, path, options) : Ember.CollectionView;\n Ember.assert(fmt(\"%@ #collection: Could not find collection class %@\", [data.view, path]), !!collectionClass);\n\n var hash = options.hash, itemHash = {}, match;\n\n // Extract item view class if provided else default to the standard class\n var itemViewClass, itemViewPath = hash.itemViewClass;\n var collectionPrototype = collectionClass.proto();\n delete hash.itemViewClass;\n itemViewClass = itemViewPath ? getPath(collectionPrototype, itemViewPath, options) : collectionPrototype.itemViewClass;\n Ember.assert(fmt(\"%@ #collection: Could not find itemViewClass %@\", [data.view, itemViewPath]), !!itemViewClass);\n\n // Go through options passed to the {{collection}} helper and extract options\n // that configure item views instead of the collection itself.\n for (var prop in hash) {\n if (hash.hasOwnProperty(prop)) {\n match = prop.match(/^item(.)(.*)$/);\n\n if(match) {\n // Convert itemShouldFoo -> shouldFoo\n itemHash[match[1].toLowerCase() + match[2]] = hash[prop];\n // Delete from hash as this will end up getting passed to the\n // {{view}} helper method.\n delete hash[prop];\n }\n }\n }\n\n var tagName = hash.tagName || collectionPrototype.tagName;\n\n if (fn) {\n itemHash.template = fn;\n delete options.fn;\n }\n\n var emptyViewClass;\n if (inverse && inverse !== Handlebars.VM.noop) {\n emptyViewClass = get(collectionPrototype, 'emptyViewClass');\n emptyViewClass = emptyViewClass.extend({\n template: inverse,\n tagName: itemHash.tagName\n });\n } else if (hash.emptyViewClass) {\n emptyViewClass = getPath(this, hash.emptyViewClass, options);\n }\n hash.emptyView = emptyViewClass;\n\n if (hash.eachHelper === 'each') {\n itemHash._context = Ember.computed(function() {\n return get(this, 'content');\n }).property('content');\n delete hash.eachHelper;\n }\n\n var viewOptions = Ember.Handlebars.ViewHelper.propertiesFromHTMLOptions({ data: data, hash: itemHash }, this);\n hash.itemViewClass = itemViewClass.extend(viewOptions);\n\n return Ember.Handlebars.helpers.view.call(this, collectionClass, options);\n});\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\nvar getPath = Ember.Handlebars.getPath;\n\n/**\n `unbound` allows you to output a property without binding. *Important:* The\n output will not be updated if the property changes. Use with caution.\n\n
{{unbound somePropertyThatDoesntChange}}
\n\n @name Handlebars.helpers.unbound\n @param {String} property\n @returns {String} HTML string\n*/\nEmber.Handlebars.registerHelper('unbound', function(property, fn) {\n var context = (fn.contexts && fn.contexts[0]) || this;\n return getPath(context, property, fn);\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/*jshint debug:true*/\nvar getPath = Ember.Handlebars.getPath, normalizePath = Ember.Handlebars.normalizePath;\n\n/**\n `log` allows you to output the value of a value in the current rendering\n context.\n\n {{log myVariable}}\n\n @name Handlebars.helpers.log\n @param {String} property\n*/\nEmber.Handlebars.registerHelper('log', function(property, options) {\n var context = (options.contexts && options.contexts[0]) || this,\n normalized = normalizePath(context, property, options.data),\n pathRoot = normalized.root,\n path = normalized.path,\n value = (path === 'this') ? pathRoot : getPath(pathRoot, path, options);\n Ember.Logger.log(value);\n});\n\n/**\n The `debugger` helper executes the `debugger` statement in the current\n context.\n\n {{debugger}}\n\n @name Handlebars.helpers.debugger\n @param {String} property\n*/\nEmber.Handlebars.registerHelper('debugger', function() {\n debugger;\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\nEmber.Handlebars.EachView = Ember.CollectionView.extend(Ember._Metamorph, {\n itemViewClass: Ember._MetamorphView,\n emptyViewClass: Ember._MetamorphView,\n\n createChildView: function(view, attrs) {\n view = this._super(view, attrs);\n\n // At the moment, if a container view subclass wants\n // to insert keywords, it is responsible for cloning\n // the keywords hash. This will be fixed momentarily.\n var keyword = get(this, 'keyword');\n\n if (keyword) {\n var data = get(view, 'templateData');\n\n data = Ember.copy(data);\n data.keywords = view.cloneKeywords();\n set(view, 'templateData', data);\n\n var content = get(view, 'content');\n\n // In this case, we do not bind, because the `content` of\n // a #each item cannot change.\n data.keywords[keyword] = content;\n }\n\n return view;\n }\n});\n\nEmber.Handlebars.registerHelper('each', function(path, options) {\n if (arguments.length === 4) {\n Ember.assert(\"If you pass more than one argument to the each helper, it must be in the form #each foo in bar\", arguments[1] === \"in\");\n\n var keywordName = arguments[0];\n\n options = arguments[3];\n path = arguments[2];\n if (path === '') { path = \"this\"; }\n\n options.hash.keyword = keywordName;\n } else {\n options.hash.eachHelper = 'each';\n }\n\n Ember.assert(\"You must pass a block to the each helper\", options.fn && options.fn !== Handlebars.VM.noop);\n\n options.hash.contentBinding = path;\n // Set up emptyView as a metamorph with no tag\n //options.hash.emptyViewClass = Ember._MetamorphView;\n\n return Ember.Handlebars.helpers.collection.call(this, 'Ember.Handlebars.EachView', options);\n});\n\n})();\n\n\n\n(function() {\n/**\n `template` allows you to render a template from inside another template.\n This allows you to re-use the same template in multiple places. For example:\n\n \n\n \n\n This helper looks for templates in the global Ember.TEMPLATES hash. If you\n add <script> tags to your page with the `data-template-name` attribute set,\n they will be compiled and placed in this hash automatically.\n\n You can also manually register templates by adding them to the hash:\n\n Ember.TEMPLATES[\"my_cool_template\"] = Ember.Handlebars.compile('{{user}}');\n\n @name Handlebars.helpers.template\n @param {String} templateName the template to render\n*/\n\nEmber.Handlebars.registerHelper('template', function(name, options) {\n var template = Ember.TEMPLATES[name];\n\n Ember.assert(\"Unable to find template with name '\"+name+\"'.\", !!template);\n\n Ember.TEMPLATES[name](this, { data: options.data });\n});\n\n})();\n\n\n\n(function() {\nvar EmberHandlebars = Ember.Handlebars, getPath = EmberHandlebars.getPath, get = Ember.get;\n\nvar ActionHelper = EmberHandlebars.ActionHelper = {\n registeredActions: {}\n};\n\nActionHelper.registerAction = function(actionName, eventName, target, view, context, link) {\n var actionId = (++Ember.$.uuid).toString();\n\n ActionHelper.registeredActions[actionId] = {\n eventName: eventName,\n handler: function(event) {\n if (link && (event.button !== 0 || event.shiftKey || event.metaKey || event.altKey || event.ctrlKey)) {\n // Allow the browser to handle special link clicks normally\n return;\n }\n\n event.preventDefault();\n\n event.view = view;\n event.context = context;\n\n // Check for StateManager (or compatible object)\n if (target.isState && typeof target.send === 'function') {\n return target.send(actionName, event);\n } else {\n Ember.assert(Ember.String.fmt('Target %@ does not have action %@', [target, actionName]), target[actionName]);\n return target[actionName].call(target, event);\n }\n }\n };\n\n view.on('willRerender', function() {\n delete ActionHelper.registeredActions[actionId];\n });\n\n return actionId;\n};\n\n/**\n The `{{action}}` helper registers an HTML element within a template for\n DOM event handling. User interaction with that element will call the method\n on the template's associated `Ember.View` instance that has the same name\n as the first provided argument to `{{action}}`:\n\n Given the following Handlebars template on the page\n\n \n\n And application code\n\n AView = Ember.View.extend({\n templateName; 'a-template',\n anActionName: function(event){}\n });\n\n aView = AView.create();\n aView.appendTo('body');\n\n Will results in the following rendered HTML\n\n
\n
\n click me\n
\n
\n\n Clicking \"click me\" will trigger the `anActionName` method of the `aView`\n object with a `jQuery.Event` object as its argument. The `jQuery.Event`\n object will be extended to include a `view` property that is set to the\n original view interacted with (in this case the `aView` object).\n\n ### Event Propagation\n\n Events triggered through the action helper will automatically have\n `.preventDefault()` called on them. You do not need to do so in your event\n handlers. To stop propagation of the event, simply return `false` from your\n handler.\n\n If you need the default handler to trigger you should either register your\n own event handler, or use event methods on your view class.\n\n ### Specifying an Action Target\n\n A `target` option can be provided to change which object will receive the\n method call. This option must be a string representing a path to an object:\n\n \n\n Clicking \"click me\" in the rendered HTML of the above template will trigger\n the `anActionName` method of the object at `MyApplication.someObject`.\n The first argument to this method will be a `jQuery.Event` extended to\n include a `view` property that is set to the original view interacted with.\n\n A path relative to the template's `Ember.View` instance can also be used as\n a target:\n\n \n\n Clicking \"click me\" in the rendered HTML of the above template will trigger\n the `anActionName` method of the view's parent view.\n\n The `{{action}}` helper is `Ember.StateManager` aware. If the target of the\n action is an `Ember.StateManager` instance `{{action}}` will use the `send`\n functionality of StateManagers. The documentation for `Ember.StateManager`\n has additional information about this use.\n\n If an action's target does not implement a method that matches the supplied\n action name an error will be thrown.\n\n \n\n With the following application code\n\n AView = Ember.View.extend({\n templateName; 'a-template',\n // note: no method 'aMethodNameThatIsMissing'\n anActionName: function(event){}\n });\n\n aView = AView.create();\n aView.appendTo('body');\n\n Will throw `Uncaught TypeError: Cannot call method 'call' of undefined` when\n \"click me\" is clicked.\n\n ### Specifying DOM event type\n\n By default the `{{action}}` helper registers for DOM `click` events. You can\n supply an `on` option to the helper to specify a different DOM event name:\n\n \n\n See `Ember.EventDispatcher` for a list of acceptable DOM event names.\n\n Because `{{action}}` depends on Ember's event dispatch system it will only\n function if an `Ember.EventDispatcher` instance is available. An\n `Ember.EventDispatcher` instance will be created when a new\n `Ember.Application` is created. Having an instance of `Ember.Application`\n will satisfy this requirement.\n\n ### Specifying a context\n\n By default the `{{action}}` helper passes the current Handlebars context\n along in the `jQuery.Event` object. You may specify an alternative object to\n pass as the context by providing a property path:\n\n \n\n @name Handlebars.helpers.action\n @param {String} actionName\n @param {Hash} options\n*/\nEmberHandlebars.registerHelper('action', function(actionName, options) {\n var hash = options.hash,\n eventName = hash.on || \"click\",\n view = options.data.view,\n target, context, controller, link;\n\n view = get(view, 'concreteView');\n\n if (hash.target) {\n target = getPath(this, hash.target, options);\n } else if (controller = options.data.keywords.controller) {\n target = get(controller, 'target');\n }\n\n target = target || view;\n\n context = hash.context ? getPath(this, hash.context, options) : options.contexts[0];\n\n var output = [], url;\n\n if (hash.href && target.urlForEvent) {\n url = target.urlForEvent(actionName, context);\n output.push('href=\"' + url + '\"');\n link = true;\n }\n\n var actionId = ActionHelper.registerAction(actionName, eventName, target, view, context, link);\n output.push('data-ember-action=\"' + actionId + '\"');\n\n return new EmberHandlebars.SafeString(output.join(\" \"));\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\n/**\n\n When used in a Handlebars template that is assigned to an `Ember.View` instance's\n `layout` property Ember will render the layout template first, inserting the view's\n own rendered output at the `{{ yield }}` location.\n\n An empty `` and the following application code:\n\n AView = Ember.View.extend({\n classNames: ['a-view-with-layout'],\n layout: Ember.Handlebars.compile('
{{ yield }}
'),\n template: Ember.Handlebars.compile('I am wrapped')\n })\n\n aView = AView.create()\n aView.appendTo('body')\n\n Will result in the following HTML output:\n\n \n
\n
\n I am wrapped\n
\n
\n \n\n The yield helper cannot be used outside of a template assigned to an `Ember.View`'s `layout` property\n and will throw an error if attempted.\n\n BView = Ember.View.extend({\n classNames: ['a-view-with-layout'],\n template: Ember.Handlebars.compile('{{yield}}')\n })\n\n bView = BView.create()\n bView.appendTo('body')\n\n // throws\n // Uncaught Error: assertion failed: You called yield in a template that was not a layout\n\n @name Handlebars.helpers.yield\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmber.Handlebars.registerHelper('yield', function(options) {\n var view = options.data.view, template;\n\n while (view && !get(view, 'layout')) {\n view = get(view, 'parentView');\n }\n\n Ember.assert(\"You called yield in a template that was not a layout\", !!view);\n\n template = get(view, 'template');\n\n if (template) { template(this, options); }\n});\n\n})();\n\n\n\n(function() {\n/**\n The `outlet` helper allows you to specify that the current\n view's controller will fill in the view for a given area.\n\n {{outlet}}\n\n By default, when the the current controller's `view`\n property changes, the outlet will replace its current\n view with the new view.\n\n controller.set('view', someView);\n\n You can also specify a particular name, other than view:\n\n {{outlet masterView}}\n {{outlet detailView}}\n\n Then, you can control several outlets from a single\n controller:\n\n controller.set('masterView', postsView);\n controller.set('detailView', postView);\n\n @name Handlebars.helpers.outlet\n @param {String} property the property on the controller\n that holds the view for this outlet\n*/\nEmber.Handlebars.registerHelper('outlet', function(property, options) {\n if (property && property.data && property.data.isRenderData) {\n options = property;\n property = 'view';\n }\n\n options.hash.currentViewBinding = \"controller.\" + property;\n\n return Ember.Handlebars.helpers.view.call(this, Ember.ContainerView, options);\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar set = Ember.set, get = Ember.get;\n\n/**\n @class\n\n Creates an HTML input of type 'checkbox' with HTML related properties \n applied directly to the input.\n\n {{view Ember.Checkbox classNames=\"applicaton-specific-checkbox\"}}\n\n \n\n You can add a `label` tag yourself in the template where the Ember.Checkbox is being used.\n\n \n\n\n The `checked` attribute of an Ember.Checkbox object should always be set\n through the Ember object or by interacting with its rendered element representation\n via the mouse, keyboard, or touch. Updating the value of the checkbox via jQuery will\n result in the checked value of the object and its element losing synchronization.\n \n ## Layout and LayoutName properties\n Because HTML `input` elements are self closing `layout` and `layoutName` properties will\n not be applied. See `Ember.View`'s layout section for more information.\n\n*/\nEmber.Checkbox = Ember.View.extend({\n classNames: ['ember-checkbox'],\n\n tagName: 'input',\n\n attributeBindings: ['type', 'checked', 'disabled', 'tabindex'],\n\n type: \"checkbox\",\n checked: false,\n disabled: false,\n\n init: function() {\n this._super();\n this.on(\"change\", this, this._updateElementValue);\n },\n\n /**\n @private\n */\n _updateElementValue: function() {\n set(this, 'checked', this.$().prop('checked'));\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/** @class */\nEmber.TextSupport = Ember.Mixin.create(\n/** @scope Ember.TextSupport.prototype */ {\n\n value: \"\",\n\n attributeBindings: ['placeholder', 'disabled', 'maxlength', 'tabindex'],\n placeholder: null,\n disabled: false,\n maxlength: null,\n\n insertNewline: Ember.K,\n cancel: Ember.K,\n\n init: function() {\n this._super();\n this.on(\"focusOut\", this, this._elementValueDidChange);\n this.on(\"change\", this, this._elementValueDidChange);\n this.on(\"keyUp\", this, this.interpretKeyEvents);\n },\n\n /**\n @private\n */\n interpretKeyEvents: function(event) {\n var map = Ember.TextSupport.KEY_EVENTS;\n var method = map[event.keyCode];\n\n this._elementValueDidChange();\n if (method) { return this[method](event); }\n },\n\n _elementValueDidChange: function() {\n set(this, 'value', this.$().val());\n }\n\n});\n\nEmber.TextSupport.KEY_EVENTS = {\n 13: 'insertNewline',\n 27: 'cancel'\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n The `Ember.TextField` view class renders a text\n [input](https://developer.mozilla.org/en/HTML/Element/Input) element. It\n allows for binding Ember properties to the text field contents (`value`),\n live-updating as the user inputs text.\n\n Example:\n\n {{view Ember.TextField valueBinding=\"firstName\"}}\n\n ## Layout and LayoutName properties\n Because HTML `input` elements are self closing `layout` and `layoutName` properties will\n not be applied. See `Ember.View`'s layout section for more information.\n \n @extends Ember.TextSupport\n*/\nEmber.TextField = Ember.View.extend(Ember.TextSupport,\n /** @scope Ember.TextField.prototype */ {\n\n classNames: ['ember-text-field'],\n tagName: \"input\",\n attributeBindings: ['type', 'value', 'size'],\n\n /**\n The value attribute of the input element. As the user inputs text, this\n property is updated live.\n\n @type String\n @default \"\"\n */\n value: \"\",\n\n /**\n The type attribute of the input element.\n\n @type String\n @default \"text\"\n */\n type: \"text\",\n\n /**\n The size of the text field in characters.\n\n @type String\n @default null\n */\n size: null\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\nEmber.Button = Ember.View.extend(Ember.TargetActionSupport, {\n classNames: ['ember-button'],\n classNameBindings: ['isActive'],\n\n tagName: 'button',\n\n propagateEvents: false,\n\n attributeBindings: ['type', 'disabled', 'href', 'tabindex'],\n\n /** @private\n Overrides TargetActionSupport's targetObject computed\n property to use Handlebars-specific path resolution.\n */\n targetObject: Ember.computed(function() {\n var target = get(this, 'target'),\n root = get(this, 'context'),\n data = get(this, 'templateData');\n\n if (typeof target !== 'string') { return target; }\n\n return Ember.Handlebars.getPath(root, target, { data: data });\n }).property('target').cacheable(),\n\n // Defaults to 'button' if tagName is 'input' or 'button'\n type: Ember.computed(function(key, value) {\n var tagName = this.get('tagName');\n if (value !== undefined) { this._type = value; }\n if (this._type !== undefined) { return this._type; }\n if (tagName === 'input' || tagName === 'button') { return 'button'; }\n }).property('tagName').cacheable(),\n\n disabled: false,\n\n // Allow 'a' tags to act like buttons\n href: Ember.computed(function() {\n return this.get('tagName') === 'a' ? '#' : null;\n }).property('tagName').cacheable(),\n\n mouseDown: function() {\n if (!get(this, 'disabled')) {\n set(this, 'isActive', true);\n this._mouseDown = true;\n this._mouseEntered = true;\n }\n return get(this, 'propagateEvents');\n },\n\n mouseLeave: function() {\n if (this._mouseDown) {\n set(this, 'isActive', false);\n this._mouseEntered = false;\n }\n },\n\n mouseEnter: function() {\n if (this._mouseDown) {\n set(this, 'isActive', true);\n this._mouseEntered = true;\n }\n },\n\n mouseUp: function(event) {\n if (get(this, 'isActive')) {\n // Actually invoke the button's target and action.\n // This method comes from the Ember.TargetActionSupport mixin.\n this.triggerAction();\n set(this, 'isActive', false);\n }\n\n this._mouseDown = false;\n this._mouseEntered = false;\n return get(this, 'propagateEvents');\n },\n\n keyDown: function(event) {\n // Handle space or enter\n if (event.keyCode === 13 || event.keyCode === 32) {\n this.mouseDown();\n }\n },\n\n keyUp: function(event) {\n // Handle space or enter\n if (event.keyCode === 13 || event.keyCode === 32) {\n this.mouseUp();\n }\n },\n\n // TODO: Handle proper touch behavior. Including should make inactive when\n // finger moves more than 20x outside of the edge of the button (vs mouse\n // which goes inactive as soon as mouse goes out of edges.)\n\n touchStart: function(touch) {\n return this.mouseDown(touch);\n },\n\n touchEnd: function(touch) {\n return this.mouseUp(touch);\n },\n\n init: function() {\n Ember.deprecate(\"Ember.Button is deprecated and will be removed from future releases. Consider using the `{{action}}` helper.\");\n this._super();\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n The `Ember.TextArea` view class renders a\n [textarea](https://developer.mozilla.org/en/HTML/Element/textarea) element.\n It allows for binding Ember properties to the text area contents (`value`),\n live-updating as the user inputs text.\n\n ## Layout and LayoutName properties\n\n Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName` \n properties will not be applied. See `Ember.View`'s layout section for more information.\n\n @extends Ember.TextSupport\n*/\nEmber.TextArea = Ember.View.extend(Ember.TextSupport,\n/** @scope Ember.TextArea.prototype */ {\n\n classNames: ['ember-text-area'],\n\n tagName: \"textarea\",\n attributeBindings: ['rows', 'cols'],\n rows: null,\n cols: null,\n\n _updateElementValue: Ember.observer(function() {\n // We do this check so cursor position doesn't get affected in IE\n var value = get(this, 'value');\n if (value !== this.$().val()) {\n this.$().val(value);\n }\n }, 'value'),\n\n init: function() {\n this._super();\n this.on(\"didInsertElement\", this, this._updateElementValue);\n }\n\n});\n\n})();\n\n\n\n(function() {\nEmber.TabContainerView = Ember.View.extend({\n init: function() {\n Ember.deprecate(\"Ember.TabContainerView is deprecated and will be removed from future releases.\");\n this._super();\n }\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get;\n\nEmber.TabPaneView = Ember.View.extend({\n tabsContainer: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.TabContainerView);\n }).property().volatile(),\n\n isVisible: Ember.computed(function() {\n return get(this, 'viewName') === get(this, 'tabsContainer.currentView');\n }).property('tabsContainer.currentView').volatile(),\n\n init: function() {\n Ember.deprecate(\"Ember.TabPaneView is deprecated and will be removed from future releases.\");\n this._super();\n }\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, setPath = Ember.setPath;\n\nEmber.TabView = Ember.View.extend({\n tabsContainer: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.TabContainerView);\n }).property().volatile(),\n\n mouseUp: function() {\n setPath(this, 'tabsContainer.currentView', get(this, 'value'));\n },\n\n init: function() {\n Ember.deprecate(\"Ember.TabView is deprecated and will be removed from future releases.\");\n this._super();\n }\n});\n\n})();\n\n\n\n(function() {\n\n})();\n\n\n\n(function() {\n/*jshint eqeqeq:false */\n\nvar set = Ember.set, get = Ember.get;\nvar indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.indexesOf;\n\n/**\n @class\n\n The Ember.Select view class renders a\n [select](https://developer.mozilla.org/en/HTML/Element/select) HTML element,\n allowing the user to choose from a list of options. The selected option(s)\n are updated live in the `selection` property, while the corresponding value\n is updated in the `value` property.\n\n ### Using Strings\n The simplest version of an Ember.Select takes an array of strings for the options\n of a select box and a valueBinding to set the value.\n\n Example:\n\n App.controller = Ember.Object.create({\n selected: null,\n content: [\n \"Yehuda\",\n \"Tom\"\n ]\n })\n\n {{view Ember.Select\n contentBinding=\"App.controller.content\"\n valueBinding=\"App.controller.selected\"\n }}\n\n Would result in the following HTML:\n\n \n\n Selecting Yehuda from the select box will set `App.controller.selected` to \"Yehuda\"\n\n ### Using Objects\n An Ember.Select can also take an array of JS or Ember objects.\n\n When using objects you need to supply optionLabelPath and optionValuePath parameters\n which will be used to get the label and value for each of the options.\n\n Usually you will bind to either the selection or the value attribute of the select.\n\n Use selectionBinding if you would like to set the whole object as a property on the target.\n Use valueBinding if you would like to set just the value.\n\n Example using selectionBinding:\n\n App.controller = Ember.Object.create({\n selectedPerson: null,\n selectedPersonId: null,\n content: [\n Ember.Object.create({firstName: \"Yehuda\", id: 1}),\n Ember.Object.create({firstName: \"Tom\", id: 2})\n ]\n })\n\n {{view Ember.Select\n contentBinding=\"App.controller.content\"\n optionLabelPath=\"content.firstName\"\n optionValuePath=\"content.id\"\n selectionBinding=\"App.controller.selectedPerson\"\n prompt=\"Please Select\"}}\n\n \n\n Selecting Yehuda here will set `App.controller.selectedPerson` to\n the Yehuda object.\n\n Example using valueBinding:\n\n {{view Ember.Select\n contentBinding=\"App.controller.content\"\n optionLabelPath=\"content.firstName\"\n optionValuePath=\"content.id\"\n valueBinding=\"App.controller.selectedPersonId\"\n prompt=\"Please Select\"}}\n\n Selecting Yehuda in this case will set `App.controller.selectedPersonId` to 1.\n\n @extends Ember.View\n*/\nEmber.Select = Ember.View.extend(\n /** @scope Ember.Select.prototype */ {\n\n tagName: 'select',\n classNames: ['ember-select'],\n defaultTemplate: Ember.Handlebars.compile('{{#if view.prompt}}{{/if}}{{#each view.content}}{{view Ember.SelectOption contentBinding=\"this\"}}{{/each}}'),\n attributeBindings: ['multiple', 'tabindex'],\n\n /**\n The `multiple` attribute of the select element. Indicates whether multiple\n options can be selected.\n\n @type Boolean\n @default false\n */\n multiple: false,\n\n /**\n The list of options.\n\n If `optionLabelPath` and `optionValuePath` are not overridden, this should\n be a list of strings, which will serve simultaneously as labels and values.\n\n Otherwise, this should be a list of objects. For instance:\n\n content: Ember.A([\n { id: 1, firstName: 'Yehuda' },\n { id: 2, firstName: 'Tom' }\n ]),\n optionLabelPath: 'content.firstName',\n optionValuePath: 'content.id'\n\n @type Array\n @default null\n */\n content: null,\n\n /**\n When `multiple` is false, the element of `content` that is currently\n selected, if any.\n\n When `multiple` is true, an array of such elements.\n\n @type Object or Array\n @default null\n */\n selection: null,\n\n /**\n In single selection mode (when `multiple` is false), value can be used to get\n the current selection's value or set the selection by it's value.\n\n It is not currently supported in multiple selection mode.\n\n @type String\n @default null\n */\n value: Ember.computed(function(key, value) {\n if (arguments.length === 2) { return value; }\n\n var valuePath = get(this, 'optionValuePath').replace(/^content\\.?/, '');\n return valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection');\n }).property('selection').cacheable(),\n\n /**\n If given, a top-most dummy option will be rendered to serve as a user\n prompt.\n\n @type String\n @default null\n */\n prompt: null,\n\n /**\n The path of the option labels. See `content`.\n\n @type String\n @default 'content'\n */\n optionLabelPath: 'content',\n\n /**\n The path of the option values. See `content`.\n\n @type String\n @default 'content'\n */\n optionValuePath: 'content',\n\n _change: function() {\n if (get(this, 'multiple')) {\n this._changeMultiple();\n } else {\n this._changeSingle();\n }\n },\n\n selectionDidChange: Ember.observer(function() {\n var selection = get(this, 'selection'),\n isArray = Ember.isArray(selection);\n if (get(this, 'multiple')) {\n if (!isArray) {\n set(this, 'selection', Ember.A([selection]));\n return;\n }\n this._selectionDidChangeMultiple();\n } else {\n this._selectionDidChangeSingle();\n }\n }, 'selection'),\n\n valueDidChange: Ember.observer(function() {\n var content = get(this, 'content'),\n value = get(this, 'value'),\n valuePath = get(this, 'optionValuePath').replace(/^content\\.?/, ''),\n selectedValue = (valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection')),\n selection;\n\n if (value !== selectedValue) {\n selection = content.find(function(obj) {\n return value === (valuePath ? get(obj, valuePath) : obj);\n });\n\n this.set('selection', selection);\n }\n }, 'value'),\n\n\n _triggerChange: function() {\n var selection = get(this, 'selection');\n\n if (selection) { this.selectionDidChange(); }\n\n this._change();\n },\n\n _changeSingle: function() {\n var selectedIndex = this.$()[0].selectedIndex,\n content = get(this, 'content'),\n prompt = get(this, 'prompt');\n\n if (!content) { return; }\n if (prompt && selectedIndex === 0) { set(this, 'selection', null); return; }\n\n if (prompt) { selectedIndex -= 1; }\n set(this, 'selection', content.objectAt(selectedIndex));\n },\n\n _changeMultiple: function() {\n var options = this.$('option:selected'),\n prompt = get(this, 'prompt'),\n offset = prompt ? 1 : 0,\n content = get(this, 'content');\n\n if (!content){ return; }\n if (options) {\n var selectedIndexes = options.map(function(){\n return this.index - offset;\n }).toArray();\n set(this, 'selection', content.objectsAt(selectedIndexes));\n }\n },\n\n _selectionDidChangeSingle: function() {\n var el = this.$()[0],\n content = get(this, 'content'),\n selection = get(this, 'selection'),\n selectionIndex = content ? indexOf(content, selection) : -1,\n prompt = get(this, 'prompt');\n\n if (prompt) { selectionIndex += 1; }\n if (el) { el.selectedIndex = selectionIndex; }\n },\n\n _selectionDidChangeMultiple: function() {\n var content = get(this, 'content'),\n selection = get(this, 'selection'),\n selectedIndexes = content ? indexesOf(content, selection) : [-1],\n prompt = get(this, 'prompt'),\n offset = prompt ? 1 : 0,\n options = this.$('option'),\n adjusted;\n\n if (options) {\n options.each(function() {\n adjusted = this.index > -1 ? this.index + offset : -1;\n this.selected = indexOf(selectedIndexes, adjusted) > -1;\n });\n }\n },\n\n init: function() {\n this._super();\n this.on(\"didInsertElement\", this, this._triggerChange);\n this.on(\"change\", this, this._change);\n }\n});\n\nEmber.SelectOption = Ember.View.extend({\n tagName: 'option',\n attributeBindings: ['value', 'selected'],\n\n defaultTemplate: function(context, options) {\n options = { data: options.data, hash: {} };\n Ember.Handlebars.helpers.bind.call(context, \"view.label\", options);\n },\n\n init: function() {\n this.labelPathDidChange();\n this.valuePathDidChange();\n\n this._super();\n },\n\n selected: Ember.computed(function() {\n var content = get(this, 'content'),\n selection = get(this, 'parentView.selection');\n if (get(this, 'parentView.multiple')) {\n return selection && indexOf(selection, content) > -1;\n } else {\n // Primitives get passed through bindings as objects... since\n // `new Number(4) !== 4`, we use `==` below\n return content == selection;\n }\n }).property('content', 'parentView.selection').volatile(),\n\n labelPathDidChange: Ember.observer(function() {\n var labelPath = get(this, 'parentView.optionLabelPath');\n\n if (!labelPath) { return; }\n\n Ember.defineProperty(this, 'label', Ember.computed(function() {\n return get(this, labelPath);\n }).property(labelPath).cacheable());\n }, 'parentView.optionLabelPath'),\n\n valuePathDidChange: Ember.observer(function() {\n var valuePath = get(this, 'parentView.optionValuePath');\n\n if (!valuePath) { return; }\n\n Ember.defineProperty(this, 'value', Ember.computed(function() {\n return get(this, valuePath);\n }).property(valuePath).cacheable());\n }, 'parentView.optionValuePath')\n});\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n// Find templates stored in the head tag as script tags and make them available\n// to Ember.CoreView in the global Ember.TEMPLATES object. This will be run as as\n// jQuery DOM-ready callback.\n//\n// Script tags with \"text/x-handlebars\" will be compiled\n// with Ember's Handlebars and are suitable for use as a view's template.\n// Those with type=\"text/x-raw-handlebars\" will be compiled with regular\n// Handlebars and are suitable for use in views' computed properties.\nEmber.Handlebars.bootstrap = function(ctx) {\n var selectors = 'script[type=\"text/x-handlebars\"], script[type=\"text/x-raw-handlebars\"]';\n\n Ember.$(selectors, ctx)\n .each(function() {\n // Get a reference to the script tag\n var script = Ember.$(this),\n type = script.attr('type');\n\n var compile = (script.attr('type') === 'text/x-raw-handlebars') ?\n Ember.$.proxy(Handlebars.compile, Handlebars) :\n Ember.$.proxy(Ember.Handlebars.compile, Ember.Handlebars),\n // Get the name of the script, used by Ember.View's templateName property.\n // First look for data-template-name attribute, then fall back to its\n // id if no name is found.\n templateName = script.attr('data-template-name') || script.attr('id'),\n template = compile(script.html()),\n view, viewPath, elementId, options;\n\n if (templateName) {\n // For templates which have a name, we save them and then remove them from the DOM\n Ember.TEMPLATES[templateName] = template;\n\n // Remove script tag from DOM\n script.remove();\n } else {\n if (script.parents('head').length !== 0) {\n // don't allow inline templates in the head\n throw new Ember.Error(\"Template found in without a name specified. \" +\n \"Please provide a data-template-name attribute.\\n\" +\n script.html());\n }\n\n // For templates which will be evaluated inline in the HTML document, instantiates a new\n // view, and replaces the script tag holding the template with the new\n // view's DOM representation.\n //\n // Users can optionally specify a custom view subclass to use by setting the\n // data-view attribute of the script tag.\n viewPath = script.attr('data-view');\n view = viewPath ? Ember.get(viewPath) : Ember.View;\n\n // Get the id of the script, used by Ember.View's elementId property,\n // Look for data-element-id attribute.\n elementId = script.attr('data-element-id');\n\n options = { template: template };\n if (elementId) { options.elementId = elementId; }\n\n view = view.create(options);\n\n view._insertElementLater(function() {\n script.replaceWith(this.$());\n\n // Avoid memory leak in IE\n script = null;\n });\n }\n });\n};\n\nfunction bootstrap() {\n Ember.Handlebars.bootstrap( Ember.$(document) );\n}\n\n/*\n We tie this to application.load to ensure that we've at least\n attempted to bootstrap at the point that the application is loaded.\n\n We also tie this to document ready since we're guaranteed that all\n the inline templates are present at this point.\n\n There's no harm to running this twice, since we remove the templates\n from the DOM after processing.\n*/\n\nEmber.$(document).ready(bootstrap);\nEmber.onLoad('application', bootstrap);\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebars Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n// Version: v0.9.8.1-659-g396c08b\n// Last commit: 396c08b (2012-07-22 10:18:55 -0400)\n\n\n(function() {\n// ==========================================================================\n// Project: Ember\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n})();\n//@ sourceURL=ember");