ember-source 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ember-source might be problematic. Click here for more details.

@@ -8,10 +8,10 @@
8
8
  // ==========================================================================
9
9
 
10
10
 
11
- // Version: v1.0.0-rc.1-275-g9104bf1
12
- // Last commit: 9104bf1 (2013-03-29 13:59:19 -0700)
11
+ // Version: v1.0.0-rc.1-354-g4e75d2b
12
+ // Last commit: 4e75d2b (2013-04-09 16:28:08 -0700)
13
13
 
14
14
 
15
- (function(){var e,t;(function(){var n={},r={};e=function(e,t,r){n[e]={deps:t,callback:r}},t=function(e){if(r[e])return r[e];r[e]={};var i=n[e],s=i.deps,o=i.callback,u=[],a;for(var f=0,l=s.length;f<l;f++)s[f]==="exports"?u.push(a={}):u.push(t(s[f]));var c=o.apply(this,u);return r[e]=a||c}})(),function(){function r(t){if(e.console&&e.console[t])return e.console[t].apply?function(){e.console[t].apply(e.console,arguments)}:function(){var n=Array.prototype.join.call(arguments,", ");e.console[t](n)}}"undefined"==typeof Ember&&(Ember={});var e=Ember.imports=Ember.imports||this,t=Ember.exports=Ember.exports||this,n=Ember.lookup=Ember.lookup||this;t.Em=t.Ember=Em=Ember,Ember.isNamespace=!0,Ember.toString=function(){return"Ember"},Ember.VERSION="1.0.0-rc.2",Ember.ENV=Ember.ENV||("undefined"==typeof ENV?{}:ENV),Ember.config=Ember.config||{},Ember.EXTEND_PROTOTYPES=Ember.ENV.EXTEND_PROTOTYPES,typeof Ember.EXTEND_PROTOTYPES=="undefined"&&(Ember.EXTEND_PROTOTYPES=!0),Ember.LOG_STACKTRACE_ON_DEPRECATION=Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION!==!1,Ember.SHIM_ES5=Ember.ENV.SHIM_ES5===!1?!1:Ember.EXTEND_PROTOTYPES,Ember.LOG_VERSION=Ember.ENV.LOG_VERSION===!1?!1:!0,Ember.K=function(){return this},"undefined"==typeof Ember.assert&&(Ember.assert=Ember.K),"undefined"==typeof Ember.warn&&(Ember.warn=Ember.K),"undefined"==typeof Ember.debug&&(Ember.debug=Ember.K),"undefined"==typeof Ember.deprecate&&(Ember.deprecate=Ember.K),"undefined"==typeof Ember.deprecateFunc&&(Ember.deprecateFunc=function(e,t){return t}),Ember.uuid=0,Ember.Logger={log:r("log")||Ember.K,warn:r("warn")||Ember.K,error:r("error")||Ember.K,info:r("info")||Ember.K,debug:r("debug")||r("info")||Ember.K},Ember.onerror=null,Ember.handleErrors=function(e,t){if("function"!=typeof Ember.onerror)return e.call(t||this);try{return e.call(t||this)}catch(n){Ember.onerror(n)}},Ember.merge=function(e,t){for(var n in t){if(!t.hasOwnProperty(n))continue;e[n]=t[n]}return e},Ember.isNone=function(e){return e===null||e===undefined},Ember.none=Ember.deprecateFunc("Ember.none is deprecated. Please use Ember.isNone instead.",Ember.isNone),Ember.isEmpty=function(e){return e===null||e===undefined||e.length===0&&typeof e!="function"||typeof e=="object"&&Ember.get(e,"length")===0},Ember.empty=Ember.deprecateFunc("Ember.empty is deprecated. Please use Ember.isEmpty instead.",Ember.isEmpty)}(),function(){var e=Ember.platform={};Ember.create=Object.create;if(!Ember.create||Ember.ENV.STUB_OBJECT_CREATE){var t=function(){};Ember.create=function(e,n){t.prototype=e,e=new t;if(n){t.prototype=e;for(var r in n)t.prototype[r]=n[r].value;e=new t}return t.prototype=null,e},Ember.create.isSimulated=!0}var n=Object.defineProperty,r,i;if(n)try{n({},"a",{get:function(){}})}catch(s){n=null}n&&(r=function(){var e={};return n(e,"a",{configurable:!0,enumerable:!0,get:function(){},set:function(){}}),n(e,"a",{configurable:!0,enumerable:!0,writable:!0,value:!0}),e.a===!0}(),i=function(){try{return n(document.createElement("div"),"definePropertyOnDOM",{}),!0}catch(e){}return!1}(),r?i||(n=function(e,t,n){var r;return typeof Node=="object"?r=e instanceof Node:r=typeof e=="object"&&typeof e.nodeType=="number"&&typeof e.nodeName=="string",r?e[t]=n.value:Object.defineProperty(e,t,n)}):n=null),e.defineProperty=n,e.hasPropertyAccessors=!0,e.defineProperty||(e.hasPropertyAccessors=!1,e.defineProperty=function(e,t,n){n.get||(e[t]=n.value)},e.defineProperty.isSimulated=!0),Ember.ENV.MANDATORY_SETTER&&!e.hasPropertyAccessors&&(Ember.ENV.MANDATORY_SETTER=!1)}(),function(){function h(e){this.descs={},this.watching={},this.cache={},this.source=e}function p(e,t){return!!e&&typeof e[t]=="function"}var e=Ember.platform.defineProperty,t=Ember.create,n="__ember"+ +(new Date),r=0,i=[],s={},o=Ember.ENV.MANDATORY_SETTER;Ember.GUID_KEY=n;var u={writable:!1,configurable:!1,enumerable:!1,value:null};Ember.generateGuid=function(i,s){s||(s="ember");var o=s+r++;return i&&(u.value=o,e(i,n,u)),o},Ember.guidFor=function(o){if(o===undefined)return"(undefined)";if(o===null)return"(null)";var a,f,l=typeof o;switch(l){case"number":return f=i[o],f||(f=i[o]="nu"+o),f;case"string":return f=s[o],f||(f=s[o]="st"+r++),f;case"boolean":return o?"(true)":"(false)";default:if(o[n])return o[n];if(o===Object)return"(Object)";if(o===Array)return"(Array)";return f="ember"+r++,u.value=f,e(o,n,u),f}};var a={writable:!0,configurable:!1,enumerable:!1,value:null},f=Ember.GUID_KEY+"_meta";Ember.META_KEY=f;var l={descs:{},watching:{}};o&&(l.values={}),Ember.EMPTY_META=l,Object.freeze&&Object.freeze(l);var c=Ember.platform.defineProperty.isSimulated;c&&(h.prototype.__preventPlainObject__=!0,h.prototype.toJSON=function(){}),Ember.meta=function(r,i){var s=r[f];return i===!1?s||l:(s?s.source!==r&&(c||e(r,f,a),s=t(s),s.descs=t(s.descs),s.watching=t(s.watching),s.cache={},s.source=r,o&&(s.values=t(s.values)),r[f]=s):(c||e(r,f,a),s=new h(r),o&&(s.values={}),r[f]=s,s.descs.constructor=null),s)},Ember.getMeta=function(t,n){var r=Ember.meta(t,!1);return r[n]},Ember.setMeta=function(t,n,r){var i=Ember.meta(t,!0);return i[n]=r,r},Ember.metaPath=function(n,r,i){var s=Ember.meta(n,i),o,u;for(var a=0,f=r.length;a<f;a++){o=r[a],u=s[o];if(!u){if(!i)return undefined;u=s[o]={__ember_source__:n}}else if(u.__ember_source__!==n){if(!i)return undefined;u=s[o]=t(u),u.__ember_source__=n}s=u}return u},Ember.wrap=function(e,t){function n(){}function r(){var r,i=this._super;return this._super=t||n,r=e.apply(this,arguments),this._super=i,r}return r.wrappedFunction=e,r.__ember_observes__=e.__ember_observes__,r.__ember_observesBefore__=e.__ember_observesBefore__,r},Ember.isArray=function(e){return!e||e.setInterval?!1:Array.isArray&&Array.isArray(e)?!0:Ember.Array&&Ember.Array.detect(e)?!0:e.length!==undefined&&"object"==typeof e?!0:!1},Ember.makeArray=function(e){return e===null||e===undefined?[]:Ember.isArray(e)?e:[e]},Ember.canInvoke=p,Ember.tryInvoke=function(e,t,n){if(p(e,t))return e[t].apply(e,n||[])};var d=function(){var e=0;try{try{}finally{throw e++,new Error("needsFinallyFixTest")}}catch(t){}return e!==1}();d?Ember.tryFinally=function(e,t,n){var r,i,s;n=n||this;try{r=e.call(n)}finally{try{i=t.call(n)}catch(o){s=o}}if(s)throw s;return i===undefined?r:i}:Ember.tryFinally=function(e,t,n){var r,i;n=n||this;try{r=e.call(n)}finally{i=t.call(n)}return i===undefined?r:i},d?Ember.tryCatchFinally=function(e,t,n,r){var i,s,o,u;r=r||this;try{i=e.call(r)}catch(a){i=t.call(r,a)}finally{try{s=n.call(r)}catch(f){o=f}}if(o)throw o;return s===undefined?i:s}:Ember.tryCatchFinally=function(e,t,n,r){var i,s;r=r||this;try{i=e.call(r)}catch(o){i=t.call(r,o)}finally{s=n.call(r)}return s===undefined?i:s}}(),function(){Ember.Instrumentation={};var e=[],t={},n=function(n){var r=[],i;for(var s=0,o=e.length;s<o;s++)i=e[s],i.regex.test(n)&&r.push(i.object);return t[n]=r,r},r=function(){var e="undefined"!=typeof window?window.performance||{}:{},t=e.now||e.mozNow||e.webkitNow||e.msNow||e.oNow;return t?t.bind(e):function(){return+(new Date)}}();Ember.Instrumentation.instrument=function(e,i,s,o){function d(){for(h=0,p=u.length;h<p;h++)c=u[h],l[h]=c.before(e,r(),i);return s.call(o)}function v(e){i=i||{},i.exception=e}function m(){for(h=0,p=u.length;h<p;h++)c=u[h],c.after(e,r(),i,l[h]);Ember.STRUCTURED_PROFILE&&console.timeEnd(a)}var u=t[e],a,f;Ember.STRUCTURED_PROFILE&&(a=e+": "+i.object,console.time(a)),u||(u=n(e));if(u.length===0)return f=s.call(o),Ember.STRUCTURED_PROFILE&&console.timeEnd(a),f;var l=[],c,h,p;return Ember.tryCatchFinally(d,v,m)},Ember.Instrumentation.subscribe=function(n,r){var i=n.split("."),s,o=[];for(var u=0,a=i.length;u<a;u++)s=i[u],s==="*"?o.push("[^\\.]*"):o.push(s);o=o.join("\\."),o+="(\\..*)?";var f={pattern:n,regex:new RegExp("^"+o+"$"),object:r};return e.push(f),t={},f},Ember.Instrumentation.unsubscribe=function(n){var r;for(var i=0,s=e.length;i<s;i++)e[i]===n&&(r=i);e.splice(r,1),t={}},Ember.Instrumentation.reset=function(){e=[],t={}},Ember.instrument=Ember.Instrumentation.instrument,Ember.subscribe=Ember.Instrumentation.subscribe}(),function(){var e=Ember.EnumerableUtils={map:function(e,t,n){return e.map?e.map.call(e,t,n):Array.prototype.map.call(e,t,n)},forEach:function(e,t,n){return e.forEach?e.forEach.call(e,t,n):Array.prototype.forEach.call(e,t,n)},indexOf:function(e,t,n){return e.indexOf?e.indexOf.call(e,t,n):Array.prototype.indexOf.call(e,t,n)},indexesOf:function(t,n){return n===undefined?[]:e.map(n,function(n){return e.indexOf(t,n)})},addObject:function(t,n){var r=e.indexOf(t,n);r===-1&&t.push(n)},removeObject:function(t,n){var r=e.indexOf(t,n);r!==-1&&t.splice(r,1)},replace:function(e,t,n,r){if(e.replace)return e.replace(t,n,r);var i=Array.prototype.concat.apply([t,n],r);return e.splice.apply(e,i)},intersection:function(e,t){var n=[];return e.forEach(function(e){t.indexOf(e)>=0&&n.push(e)}),n}}}(),function(){var e=function(e){return e&&Function.prototype.toString.call(e).indexOf("[native code]")>-1},t=e(Array.prototype.map)?Array.prototype.map:function(e){if(this===void 0||this===null)throw new TypeError;var t=Object(this),n=t.length>>>0;if(typeof e!="function")throw new TypeError;var r=new Array(n),i=arguments[1];for(var s=0;s<n;s++)s in t&&(r[s]=e.call(i,t[s],s,t));return r},n=e(Array.prototype.forEach)?Array.prototype.forEach:function(e){if(this===void 0||this===null)throw new TypeError;var t=Object(this),n=t.length>>>0;if(typeof e!="function")throw new TypeError;var r=arguments[1];for(var i=0;i<n;i++)i in t&&e.call(r,t[i],i,t)},r=e(Array.prototype.indexOf)?Array.prototype.indexOf:function(e,t){t===null||t===undefined?t=0:t<0&&(t=Math.max(0,this.length+t));for(var n=t,r=this.length;n<r;n++)if(this[n]===e)return n;return-1};Ember.ArrayPolyfills={map:t,forEach:n,indexOf:r},Ember.SHIM_ES5&&(Array.prototype.map||(Array.prototype.map=t),Array.prototype.forEach||(Array.prototype.forEach=n),Array.prototype.indexOf||(Array.prototype.indexOf=r))}(),function(){var e=Ember.guidFor,t=Ember.ArrayPolyfills.indexOf,n=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},r=function(e,t){var r=e.keys.copy(),i=n(e.values);return t.keys=r,t.values=i,t},i=Ember.OrderedSet=function(){this.clear()};i.create=function(){return new i},i.prototype={clear:function(){this.presenceSet={},this.list=[]},add:function(t){var n=e(t),r=this.presenceSet,i=this.list;if(n in r)return;r[n]=!0,i.push(t)},remove:function(n){var r=e(n),i=this.presenceSet,s=this.list;delete i[r];var o=t.call(s,n);o>-1&&s.splice(o,1)},isEmpty:function(){return this.list.length===0},has:function(t){var n=e(t),r=this.presenceSet;return n in r},forEach:function(e,t){var n=this.list.slice();for(var r=0,i=n.length;r<i;r++)e.call(t,n[r])},toArray:function(){return this.list.slice()},copy:function(){var e=new i;return e.presenceSet=n(this.presenceSet),e.list=this.list.slice(),e}};var s=Ember.Map=function(){this.keys=Ember.OrderedSet.create(),this.values={}};s.create=function(){return new s},s.prototype={get:function(t){var n=this.values,r=e(t);return n[r]},set:function(t,n){var r=this.keys,i=this.values,s=e(t);r.add(t),i[s]=n},remove:function(t){var n=this.keys,r=this.values,i=e(t),s;return r.hasOwnProperty(i)?(n.remove(t),s=r[i],delete r[i],!0):!1},has:function(t){var n=this.values,r=e(t);return n.hasOwnProperty(r)},forEach:function(t,n){var r=this.keys,i=this.values;r.forEach(function(r){var s=e(r);t.call(n,r,i[s])})},copy:function(){return r(this,new s)}};var o=Ember.MapWithDefault=function(e){s.call(this),this.defaultValue=e.defaultValue};o.create=function(e){return e?new o(e):new s},o.prototype=Ember.create(s.prototype),o.prototype.get=function(e){var t=this.has(e);if(t)return s.prototype.get.call(this,e);var n=this.defaultValue(e);return this.set(e,n),n},o.prototype.copy=function(){return r(this,new o({defaultValue:this.defaultValue}))}}(),function(){function a(e){return e.match(u)[0]}function f(e,n){var r=o.test(n),i=!r&&s.test(n),u;if(!e||i)e=Ember.lookup;r&&(n=n.slice(5)),e===Ember.lookup&&(u=a(n),e=t(e,u),n=n.slice(u.length+1));if(!n||n.length===0)throw new Error("Invalid Path");return[e,n]}function l(e,n){var r,i,s,u,a;if(e===null&&n.indexOf(".")===-1)return t(Ember.lookup,n);r=o.test(n);if(!e||r)s=f(e,n),e=s[0],n=s[1],s.length=0;i=n.split("."),a=i.length;for(u=0;e&&u<a;u++){e=t(e,i[u],!0);if(e&&e.isDestroyed)return undefined}return e}function c(e,t,r,i){var s;s=t.slice(t.lastIndexOf(".")+1),t=t.slice(0,t.length-(s.length+1)),t!=="this"&&(e=l(e,t));if(!s||s.length===0)throw new Error("You passed an empty path");if(!e){if(i)return;throw new Error("Object in path "+t+" could not be found or was destroyed.")}return n(e,s,r)}var e=Ember.META_KEY,t,n,r=Ember.ENV.MANDATORY_SETTER,i=/^([A-Z$]|([0-9][A-Z$]))/,s=/^([A-Z$]|([0-9][A-Z$])).*[\.\*]/,o=/^this[\.\*]/,u=/^([^\.\*]+)/;t=function(n,i){if(i==="")return n;!i&&"string"==typeof n&&(i=n,n=null);if(!n||i.indexOf(".")!==-1)return l(n,i);var s=n[e],o=s&&s.descs[i],u;return o?o.get(n,i):(r&&s&&s.watching[i]>0?u=s.values[i]:u=n[i],u!==undefined||"object"!=typeof n||i in n||"function"!=typeof n.unknownProperty?u:n.unknownProperty(i))},n=function(n,i,s,o){typeof n=="string"&&(s=i,i=n,n=null);if(!n||i.indexOf(".")!==-1)return c(n,i,s,o);var u=n[e],a=u&&u.descs[i],f,l;return a?a.set(n,i,s):(f="object"==typeof n&&!(i in n),f&&"function"==typeof n.setUnknownProperty?n.setUnknownProperty(i,s):u&&u.watching[i]>0?(r?l=u.values[i]:l=n[i],s!==l&&(Ember.propertyWillChange(n,i),r?l!==undefined||i in n?u.values[i]=s:Ember.defineProperty(n,i,null,s):n[i]=s,Ember.propertyDidChange(n,i))):n[i]=s),s},Ember.config.overrideAccessors&&(Ember.get=t,Ember.set=n,Ember.config.overrideAccessors(),t=Ember.get,n=Ember.set),Ember.normalizeTuple=function(e,t){return f(e,t)},Ember.getWithDefault=function(e,n,r){var i=t(e,n);return i===undefined?r:i},Ember.get=t,Ember.getPath=Ember.deprecateFunc("getPath is deprecated since get now supports paths",Ember.get),Ember.set=n,Ember.setPath=Ember.deprecateFunc("setPath is deprecated since set now supports paths",Ember.set),Ember.trySet=function(e,t,r){return n(e,t,r,!0)},Ember.trySetPath=Ember.deprecateFunc("trySetPath has been renamed to trySet",Ember.trySet),Ember.isGlobalPath=function(e){return i.test(e)}}(),function(){var e=Ember.META_KEY,t=Ember.meta,n=Ember.platform.defineProperty,r=Ember.ENV.MANDATORY_SETTER,i=Ember.Descriptor=function(){},s=Ember.MANDATORY_SETTER_FUNCTION=function(e){},o=Ember.DEFAULT_GETTER_FUNCTION=function(t){return function(){var n=this[e];return n&&n.values[t]}};Ember.defineProperty=function(e,i,u,a,f){var l,c,h,p;return f||(f=t(e)),l=f.descs,c=f.descs[i],h=f.watching[i]>0,c instanceof Ember.Descriptor&&c.teardown(e,i),u instanceof Ember.Descriptor?(p=u,l[i]=u,r&&h?n(e,i,{configurable:!0,enumerable:!0,writable:!0,value:undefined}):e[i]=undefined,u.setup(e,i)):(l[i]=undefined,u==null?(p=a,r&&h?(f.values[i]=a,n(e,i,{configurable:!0,enumerable:!0,set:s,get:o(i)})):e[i]=a):(p=u,n(e,i,u))),h&&Ember.overrideChains(e,i,f),e.didDefineProperty&&e.didDefineProperty(e,i,p),this}}(),function(){function i(){this.clear()}function u(t){return t+e}function a(e){return e+t}var e=":change",t=":before",n=Ember.guidFor,r=0;i.prototype.add=function(e,t,n){var r=this.observerSet,i=this.observers,s=Ember.guidFor(e),o=r[s],u;return o||(r[s]=o={}),u=o[t],u===undefined&&(u=i.push({sender:e,keyName:t,eventName:n,listeners:[]})-1,o[t]=u),i[u].listeners},i.prototype.flush=function(){var e=this.observers,t,n,r,i;this.clear();for(t=0,n=e.length;t<n;++t){r=e[t],i=r.sender;if(i.isDestroying||i.isDestroyed)continue;Ember.sendEvent(i,r.eventName,[i,r.keyName],r.listeners)}},i.prototype.clear=function(){this.observerSet={},this.observers=[]};var s=new i,o=new i;Ember.beginPropertyChanges=function(){r++},Ember.endPropertyChanges=function(){r--,r<=0&&(s.clear(),o.flush())},Ember.changeProperties=function(e,t){Ember.beginPropertyChanges(),Ember.tryFinally(e,Ember.endPropertyChanges,t)},Ember.setProperties=function(e,t){return Ember.changeProperties(function(){for(var n in t)t.hasOwnProperty(n)&&Ember.set(e,n,t[n])}),e},Ember.addObserver=function(e,t,n,r){return Ember.addListener(e,u(t),n,r),Ember.watch(e,t),this},Ember.observersFor=function(e,t){return Ember.listenersFor(e,u(t))},Ember.removeObserver=function(e,t,n,r){return Ember.unwatch(e,t),Ember.removeListener(e,u(t),n,r),this},Ember.addBeforeObserver=function(e,t,n,r){return Ember.addListener(e,a(t),n,r),Ember.watch(e,t),this},Ember._suspendBeforeObserver=function(e,t,n,r,i){return Ember._suspendListener(e,a(t),n,r,i)},Ember._suspendObserver=function(e,t,n,r,i){return Ember._suspendListener(e,u(t),n,r,i)};var f=Ember.ArrayPolyfills.map;Ember._suspendBeforeObservers=function(e,t,n,r,i){var s=f.call(t,a);return Ember._suspendListeners(e,s,n,r,i)},Ember._suspendObservers=function(e,t,n,r,i){var s=f.call(t,u);return Ember._suspendListeners(e,s,n,r,i)},Ember.beforeObserversFor=function(e,t){return Ember.listenersFor(e,a(t))},Ember.removeBeforeObserver=function(e,t,n,r){return Ember.unwatch(e,t),Ember.removeListener(e,a(t),n,r),this},Ember.notifyBeforeObservers=function(e,t){if(e.isDestroying)return;var n=a(t),i,o;r?(i=s.add(e,t,n),o=Ember.listenersDiff(e,n,i),Ember.sendEvent(e,n,[e,t],o)):Ember.sendEvent(e,n,[e,t])},Ember.notifyObservers=function(e,t){if(e.isDestroying)return;var n=u(t),i;r?(i=o.add(e,t,n),Ember.listenersUnion(e,n,i)):Ember.sendEvent(e,n,[e,t])}}(),function(){function h(e){return e.match(a)[0]}function p(e){return e==="*"||!f.test(e)}function d(t,n,r,i,s){var o=e(n);i[o]||(i[o]={});if(i[o][r])return;i[o][r]=!0;var u=s.deps;u=u&&u[r];if(u)for(var a in u){var f=s.descs[a];if(f&&f._suspended===n)continue;t(n,a)}}function g(e,t,n){if(e.isDestroying)return;var r=v,i=!r;i&&(r=v={}),d(A,e,t,r,n),i&&(v=null)}function y(e,t,n){if(e.isDestroying)return;var r=m,i=!r;i&&(r=m={}),d(O,e,t,r,n),i&&(m=null)}function b(e,n,r){if(!e||"object"!=typeof e)return;var i=t(e),s=i.chainWatchers;i.hasOwnProperty("chainWatchers")||(s=i.chainWatchers={}),s[n]||(s[n]=[]),s[n].push(r),Ember.watch(e,n)}function w(e,n,r){if(!e||"object"!=typeof e)return;var i=t(e,!1);if(!i.hasOwnProperty("chainWatchers"))return;var s=i.chainWatchers;if(s[n]){s=s[n];for(var o=0,u=s.length;o<u;o++)s[o]===r&&s.splice(o,1)}Ember.unwatch(e,n)}function S(){if(E.length===0)return;var e=E;E=[],u.call(e,function(e){e[0].add(e[1])})}function x(e){return t(e,!1).proto===e}function C(e){var n=t(e),r=n.chains;return r?r.value()!==e&&(r=n.chains=r.copy(e)):r=n.chains=new T(null,null,e),r}function k(e,t,n,r){if(!n.hasOwnProperty("chainWatchers"))return;var i=n.chainWatchers;i=i[t];if(!i)return;for(var s=0,o=i.length;s<o;s++)i[s].willChange(r)}function L(e,t,n,r){if(!n.hasOwnProperty("chainWatchers"))return;var i=n.chainWatchers;i=i[t];if(!i)return;for(var s=i.length-1;s>=0;s--)i[s].didChange(r)}function A(e,n){var r=t(e,!1),i=r.watching[n]>0||n==="length",s=r.proto,o=r.descs[n];if(!i)return;if(s===e)return;o&&o.willChange&&o.willChange(e,n),g(e,n,r),k(e,n,r),Ember.notifyBeforeObservers(e,n)}function O(e,n){var r=t(e,!1),i=r.watching[n]>0||n==="length",s=r.proto,o=r.descs[n];if(s===e)return;o&&o.didChange&&o.didChange(e,n);if(!i&&n!=="length")return;y(e,n,r),L(e,n,r),Ember.notifyObservers(e,n)}var e=Ember.guidFor,t=Ember.meta,n=Ember.get,r=Ember.set,i=Ember.normalizeTuple,s=Ember.GUID_KEY,o=Ember.META_KEY,u=Ember.ArrayPolyfills.forEach,a=/^([^\.\*]+)/,f=/[\.\*]/,l=Ember.ENV.MANDATORY_SETTER,c=Ember.platform.defineProperty,v,m,E=[],T=function(e,t,n){var r;this._parent=e,this._key=t,this._watching=n===undefined,this._value=n,this._paths={},this._watching&&(this._object=e.value(),this._object&&b(this._object,this._key,this)),this._parent&&this._parent._key==="@each"&&this.value()},N=T.prototype;N.value=function(){if(this._value===undefined&&this._watching){var e=this._parent.value();this._value=e&&!x(e)?n(e,this._key):undefined}return this._value},N.destroy=function(){if(this._watching){var e=this._object;e&&w(e,this._key,this),this._watching=!1}},N.copy=function(e){var t=new T(null,null,e),n=this._paths,r;for(r in n){if(n[r]<=0)continue;t.add(r)}return t},N.add=function(e){var t,n,r,s,o;o=this._paths,o[e]=(o[e]||0)+1,t=this.value(),n=i(t,e);if(n[0]&&n[0]===t)e=n[1],r=h(e),e=e.slice(r.length+1);else{if(!n[0]){E.push([this,e]),n.length=0;return}s=n[0],r=e.slice(0,0-(n[1].length+1)),e=n[1]}n.length=0,this.chain(r,e,s)},N.remove=function(e){var t,n,r,s,o;o=this._paths,o[e]>0&&o[e]--,t=this.value(),n=i(t,e),n[0]===t?(e=n[1],r=h(e),e=e.slice(r.length+1)):(s=n[0],r=e.slice(0,0-(n[1].length+1)),e=n[1]),n.length=0,this.unchain(r,e)},N.count=0,N.chain=function(e,t,n){var r=this._chains,i;r||(r=this._chains={}),i=r[e],i||(i=r[e]=new T(this,e,n)),i.count++,t&&t.length>0&&(e=h(t),t=t.slice(e.length+1),i.chain(e,t))},N.unchain=function(e,t){var n=this._chains,r=n[e];t&&t.length>1&&(e=h(t),t=t.slice(e.length+1),r.unchain(e,t)),r.count--,r.count<=0&&(delete n[r._key],r.destroy())},N.willChange=function(){var e=this._chains;if(e)for(var t in e){if(!e.hasOwnProperty(t))continue;e[t].willChange()}this._parent&&this._parent.chainWillChange(this,this._key,1)},N.chainWillChange=function(e,t,n){this._key&&(t=this._key+"."+t),this._parent?this._parent.chainWillChange(this,t,n+1):(n>1&&Ember.propertyWillChange(this.value(),t),t="this."+t,this._paths[t]>0&&Ember.propertyWillChange(this.value(),t))},N.chainDidChange=function(e,t,n){this._key&&(t=this._key+"."+t),this._parent?this._parent.chainDidChange(this,t,n+1):(n>1&&Ember.propertyDidChange(this.value(),t),t="this."+t,this._paths[t]>0&&Ember.propertyDidChange(this.value(),t))},N.didChange=function(e){if(this._watching){var t=this._parent.value();t!==this._object&&(w(this._object,this._key,this),this._object=t,b(t,this._key,this)),this._value=undefined,this._parent&&this._parent._key==="@each"&&this.value()}var n=this._chains;if(n)for(var r in n){if(!n.hasOwnProperty(r))continue;n[r].didChange(e)}if(e)return;this._parent&&this._parent.chainDidChange(this,this._key,1)},Ember.overrideChains=function(e,t,n){L(e,t,n,!0)},Ember.watch=function(e,n){if(n==="length"&&Ember.typeOf(e)==="array")return this;var r=t(e),i=r.watching,s;return i[n]?i[n]=(i[n]||0)+1:(i[n]=1,p(n)?(s=r.descs[n],s&&s.willWatch&&s.willWatch(e,n),"function"==typeof e.willWatchProperty&&e.willWatchProperty(n),l&&n in e&&(r.values[n]=e[n],c(e,n,{configurable:!0,enumerable:!0,set:Ember.MANDATORY_SETTER_FUNCTION,get:Ember.DEFAULT_GETTER_FUNCTION(n)}))):C(e).add(n)),this},Ember.isWatching=function(t,n){var r=t[o];return(r&&r.watching[n])>0},Ember.watch.flushPending=S,Ember.unwatch=function(e,n){if(n==="length"&&Ember.typeOf(e)==="array")return this;var r=t(e),i=r.watching,s;return i[n]===1?(i[n]=0,p(n)?(s=r.descs[n],s&&s.didUnwatch&&s.didUnwatch(e,n),"function"==typeof e.didUnwatchProperty&&e.didUnwatchProperty(n),l&&n in e&&(c(e,n,{configurable:!0,enumerable:!0,writable:!0,value:r.values[n]}),delete r.values[n])):C(e).remove(n)):i[n]>1&&i[n]--,this},Ember.rewatch=function(e){var n=t(e,!1),r=n.chains;return s in e&&!e.hasOwnProperty(s)&&Ember.generateGuid(e,"ember"),r&&r.value()!==e&&(n.chains=r.copy(e)),this},Ember.finishChains=function(e){var n=t(e,!1),r=n.chains;r&&(r.value()!==e&&(n.chains=r=r.copy(e)),r.didChange(!0))},Ember.propertyWillChange=A,Ember.propertyDidChange=O;var M=[];Ember.destroy=function(e){var t=e[o],n,r,i,s;if(t){e[o]=null,n=t.chains;if(n){M.push(n);while(M.length>0){n=M.pop(),r=n._chains;if(r)for(i in r)r.hasOwnProperty(i)&&M.push(r[i]);n._watching&&(s=n._object,s&&w(s,n._key,n))}}}}}(),function(){function a(e,t,n){var r=t[n];return r?t.hasOwnProperty(n)||(r=t[n]=i(r)):r=t[n]={},r}function f(e,t){return a(e,t,"deps")}function l(e,t,n,r){var i=e._dependentKeys,s,u,l,c,h;if(!i)return;s=f(t,r);for(u=0,l=i.length;u<l;u++)c=i[u],h=a(t,s,c),h[n]=(h[n]||0)+1,o(t,c)}function c(e,t,n,r){var i=e._dependentKeys,s,o,l,c,h;if(!i)return;s=f(t,r);for(o=0,l=i.length;o<l;o++)c=i[o],h=a(t,s,c),h[n]=(h[n]||0)-1,u(t,c)}function h(e,t){this.func=e,this._cacheable=t&&t.cacheable!==undefined?t.cacheable:!0,this._dependentKeys=t&&t.dependentKeys,this._readOnly=t&&(t.readOnly!==undefined||!!t.readOnly)}function d(t,n){var r={};for(var i=0;i<n.length;i++)r[n[i]]=e(t,n[i]);return r}function v(e,t){Ember.computed[e]=function(e){var n=r.call(arguments);return Ember.computed(e,function(){return t.apply(this,n)})}}function m(e,t){Ember.computed[e]=function(){var e=r.call(arguments),n=Ember.computed(function(){return t.apply(this,[d(this,e)])});return n.property.apply(n,e)}}var e=Ember.get,t=Ember.set,n=Ember.meta,r=[].slice,i=Ember.create,s=Ember.META_KEY,o=Ember.watch,u=Ember.unwatch;Ember.ComputedProperty=h,h.prototype=new Ember.Descriptor;var p=h.prototype;p.cacheable=function(e){return this._cacheable=e!==!1,this},p.volatile=function(){return this.cacheable(!1)},p.readOnly=function(e){return this._readOnly=e===undefined||!!e,this},p.property=function(){var e=[];for(var t=0,n=arguments.length;t<n;t++)e.push(arguments[t]);return this._dependentKeys=e,this},p.meta=function(e){return arguments.length===0?this._meta||{}:(this._meta=e,this)},p.willWatch=function(e,t){var n=e[s];t in n.cache||l(this,e,t,n)},p.didUnwatch=function(e,t){var n=e[s];t in n.cache||c(this,e,t,n)},p.didChange=function(e,t){if(this._cacheable&&this._suspended!==e){var r=n(e);t in r.cache&&(delete r.cache[t],r.watching[t]||c(this,e,t,r))}},p.get=function(e,t){var r,i,s;if(this._cacheable){s=n(e),i=s.cache;if(t in i)return i[t];r=i[t]=this.func.call(e,t),s.watching[t]||l(this,e,t,s)}else r=this.func.call(e,t);return r},p.set=function(e,t,r){var i=this._cacheable,s=this.func,o=n(e,i),u=o.watching[t],a=this._suspended,f=!1,c=o.cache,h,p;if(this._readOnly)throw new Error("Cannot Set: "+t+" on: "+e.toString());this._suspended=e;try{i&&c.hasOwnProperty(t)&&(h=c[t],f=!0),s.wrappedFunction&&(s=s.wrappedFunction);if(s.length===3)p=s.call(e,t,r,h);else{if(s.length!==2){Ember.defineProperty(e,t,null,h),Ember.set(e,t,r);return}p=s.call(e,t,r)}if(f&&h===p)return;u&&Ember.propertyWillChange(e,t),f&&delete c[t],i&&(!u&&!f&&l(this,e,t,o),c[t]=p),u&&Ember.propertyDidChange(e,t)}finally{this._suspended=a}return p},p.setup=function(e,t){var r=e[s];r&&r.watching[t]&&l(this,e,t,n(e))},p.teardown=function(e,t){var r=n(e);return(r.watching[t]||t in r.cache)&&c(this,e,t,r),this._cacheable&&delete r.cache[t],null},Ember.computed=function(e){var t;arguments.length>1&&(t=r.call(arguments,0,-1),e=r.call(arguments,-1)[0]);if(typeof e!="function")throw new Error("Computed Property declared without a property function");var n=new h(e);return t&&n.property.apply(n,t),n},Ember.cacheFor=function(t,r){var i=n(t,!1).cache;if(i&&r in i)return i[r]},v("empty",function(t){return Ember.isEmpty(e(this,t))}),v("notEmpty",function(t){return!Ember.isEmpty(e(this,t))}),v("none",function(t){return Ember.isNone(e(this,t))}),v("not",function(t){return!e(this,t)}),v("bool",function(t){return!!e(this,t)}),v("match",function(t,n){var r=e(this,t);return typeof r=="string"?!!r.match(n):!1}),v("equal",function(t,n){return e(this,t)===n}),v("gt",function(t,n){return e(this,t)>n}),v("gte",function(t,n){return e(this,t)>=n}),v("lt",function(t,n){return e(this,t)<n}),v("lte",function(t,n){return e(this,t)<=n}),m("and",function(e){for(var t in e)if(e.hasOwnProperty(t)&&!e[t])return!1;return!0}),m("or",function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!0;return!1}),m("any",function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return e[t];return null}),m("map",function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&(Ember.isNone(e[n])?t.push(null):t.push(e[n]));return t}),Ember.computed.alias=function(n){return Ember.computed(n,function(r,i){return arguments.length>1?(t(this,n,i),i):e(this,n)})},Ember.computed.defaultTo=function(t){return Ember.computed(function(n,r,i){var s;return arguments.length===1?i!=null?i:e(this,t):r!=null?r:e(this,t)})}}(),function(){function r(e,t,n){var r=-1;for(var i=0,s=e.length;i<s;i++)if(t===e[i][0]&&n===e[i][1]){r=i;break}return r}function i(n,r){var i=t(n,!0),s;return i.listeners||(i.listeners={}),i.hasOwnProperty("listeners")||(i.listeners=e(i.listeners)),s=i.listeners[r],s&&!i.listeners.hasOwnProperty(r)?s=i.listeners[r]=i.listeners[r].slice():s||(s=i.listeners[r]=[]),s}function s(e,t,i){var s=e[n],o=s&&s.listeners&&s.listeners[t];if(!o)return;for(var u=o.length-1;u>=0;u--){var a=o[u][0],f=o[u][1],l=o[u][2],c=o[u][3],h=r(i,a,f);h===-1&&i.push([a,f,l,c])}}function o(e,t,i){var s=e[n],o=s&&s.listeners&&s.listeners[t],u=[];if(!o)return;for(var a=o.length-1;a>=0;a--){var f=o[a][0],l=o[a][1],c=o[a][2],h=o[a][3],p=r(i,f,l);if(p!==-1)continue;i.push([f,l,c,h]),u.push([f,l,c,h])}return u}function u(e,t,n,s,o){!s&&"function"==typeof n&&(s=n,n=null);var u=i(e,t),a=r(u,n,s);if(a!==-1)return;u.push([n,s,o,undefined]),"function"==typeof e.didAddListener&&e.didAddListener(t,n,s)}function a(e,t,s,o){function u(n,s,o){var u=i(e,t),a=r(u,n,s);if(a===-1)return;u.splice(a,1),"function"==typeof e.didRemoveListener&&e.didRemoveListener(t,n,s)}!o&&"function"==typeof s&&(o=s,s=null);if(o)u(s,o);else{var a=e[n],f=a&&a.listeners&&a.listeners[t];if(!f)return;for(var l=f.length-1;l>=0;l--)u(f[l][0],f[l][1])}}function f(e,t,n,s,o){function l(){return o.call(n)}function c(){f&&(f[3]=undefined)}!s&&"function"==typeof n&&(s=n,n=null);var u=i(e,t),a=r(u,n,s),f;return a!==-1&&(f=u[a].slice(),f[3]=!0,u[a]=f),Ember.tryFinally(l,c)}function l(e,t,n,s,o){function d(){return o.call(n)}function v(){for(c=0,h=u.length;c<h;c++)u[c][3]=undefined}!s&&"function"==typeof n&&(s=n,n=null);var u=[],a,f,l,c,h;for(c=0,h=t.length;c<h;c++){a=t[c],f=i(e,a);var p=r(f,n,s);p!==-1&&(l=f[p].slice(),l[3]=!0,f[p]=l,u.push(l))}return Ember.tryFinally(d,v)}function c(e){var t=e[n].listeners,r=[];if(t)for(var i in t)t[i]&&r.push(i);return r}function h(e,t,r,i){e!==Ember&&"function"==typeof e.sendEvent&&e.sendEvent(t,r);if(!i){var s=e[n];i=s&&s.listeners&&s.listeners[t]}if(!i)return;for(var o=i.length-1;o>=0;o--){if(!i[o]||i[o][3]===!0)continue;var u=i[o][0],f=i[o][1],l=i[o][2];l&&a(e,t,u,f),u||(u=e),"string"==typeof f&&(f=u[f]),r?f.apply(u,r):f.call(u)}return!0}function p(e,t){var r=e[n],i=r&&r.listeners&&r.listeners[t];return!!i&&!!i.length}function d(e,t){var r=[],i=e[n],s=i&&i.listeners&&i.listeners[t];if(!s)return r;for(var o=0,u=s.length;o<u;o++){var a=s[o][0],f=s[o][1];r.push([a,f])}return r}var e=Ember.create,t=Ember.meta,n=Ember.META_KEY;Ember.addListener=u,Ember.removeListener=a,Ember._suspendListener=f,Ember._suspendListeners=l,Ember.sendEvent=h,Ember.hasListeners=p,Ember.watchedEvents=c,Ember.listenersFor=d,Ember.listenersDiff=o,Ember.listenersUnion=s}(),function(){function n(t,n,r,i){return n===undefined&&(n=t,t=undefined),"string"==typeof n&&(n=t[n]),r&&i>0&&(r=r.length>i?e.call(r,i):null),Ember.handleErrors(function(){return n.apply(t||this,r||[])},this)}function u(){o=null,s.currentRunLoop&&s.end()}function c(){f=null,s(function(){var e=+(new Date),t=-1;for(var r in a){if(!a.hasOwnProperty(r))continue;var i=a[r];if(i&&i.expires)if(e>=i.expires)delete a[r],n(i.target,i.method,i.args,2);else if(t<0||i.expires<t)t=i.expires}t>0&&(f=setTimeout(c,t-e),l=t)})}function h(e,t){t[this.tguid]&&delete t[this.tguid][this.mguid],a[e]&&n(this.target,this.method,this.args),delete a[e]}function p(e,t,n,r){var i=Ember.guidFor(t),o=Ember.guidFor(n),u=s.autorun().onceTimers,f=u[i]&&u[i][o],l;return f&&a[f]?a[f].args=r:(l={target:t,method:n,args:r,tguid:i,mguid:o},f=Ember.guidFor(l),a[f]=l,u[i]||(u[i]={}),u[i][o]=f,s.schedule(e,l,h,f,u)),f}var e=[].slice,t=Ember.ArrayPolyfills.forEach,r,i=function(e){this._prev=e||null,this.onceTimers={}};i.prototype={end:function(){this.flush()},prev:function(){return this._prev},schedule:function(t,n,r){var i=this._queues,s;i||(i=this._queues={}),s=i[t],s||(s=i[t]=[]);var o=arguments.length>3?e.call(arguments,3):null;return s.push({target:n,method:r,args:o}),this},flush:function(e){function f(e){n(e.target,e.method,e.args)}function l(){t.call(u,f)}var i,s,o,u,a;if(!this._queues)return this;Ember.watch.flushPending();if(e)while(this._queues&&(u=this._queues[e]))this._queues[e]=null,e==="sync"?(a=Ember.LOG_BINDINGS,a&&Ember.Logger.log("Begin: Flush Sync Queue"),Ember.beginPropertyChanges(),Ember.tryFinally(l,Ember.endPropertyChanges),a&&Ember.Logger.log("End: Flush Sync Queue")):t.call(u,f);else{i=Ember.run.queues,o=i.length,s=0;e:while(s<o){e=i[s],u=this._queues&&this._queues[e],delete this._queues[e],u&&(e==="sync"?(a=Ember.LOG_BINDINGS,a&&Ember.Logger.log("Begin: Flush Sync Queue"),Ember.beginPropertyChanges(),Ember.tryFinally(l,Ember.endPropertyChanges),a&&Ember.Logger.log("End: Flush Sync Queue")):t.call(u,f));for(var c=0;c<=s;c++)if(this._queues&&this._queues[i[c]]){s=c;continue e}s++}}return r=null,this}},Ember.RunLoop=i,Ember.run=function(e,t){function i(){if(e||t)return n(e,t,r,2)}var r=arguments;return s.begin(),Ember.tryFinally(i,s.end)};var s=Ember.run;Ember.run.begin=function(){s
16
- .currentRunLoop=new i(s.currentRunLoop)},Ember.run.end=function(){function e(){s.currentRunLoop.end()}function t(){s.currentRunLoop=s.currentRunLoop.prev()}Ember.tryFinally(e,t)},Ember.run.queues=["sync","actions","destroy"],Ember.run.schedule=function(e,t,n){var r=s.autorun();r.schedule.apply(r,arguments)};var o;Ember.run.hasScheduledTimers=function(){return!!o||!!f},Ember.run.cancelTimers=function(){o&&(clearTimeout(o),o=null),f&&(clearTimeout(f),f=null),a={}},Ember.run.autorun=function(){return s.currentRunLoop||(s.begin(),o||(o=setTimeout(u,1))),s.currentRunLoop},Ember.run.sync=function(){s.autorun(),s.currentRunLoop.flush("sync")};var a={},f,l;Ember.run.later=function(t,n){var r,i,s,o,u;return arguments.length===2&&"function"==typeof t?(u=n,n=t,t=undefined,r=[t,n]):(r=e.call(arguments),u=r.pop()),i=+(new Date)+u,s={target:t,method:n,expires:i,args:r},o=Ember.guidFor(s),a[o]=s,f&&i<l&&(clearTimeout(f),f=null),f||(f=setTimeout(c,u),l=i),o},Ember.run.once=function(t,n){return p("actions",t,n,e.call(arguments,2))},Ember.run.scheduleOnce=function(t,n,r,i){return p(t,n,r,e.call(arguments,3))},Ember.run.next=function(){var t=e.call(arguments);return t.push(1),s.later.apply(this,t)},Ember.run.cancel=function(e){delete a[e]}}(),function(){function i(t,n){return e(r(n)?Ember.lookup:t,n)}function o(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}Ember.LOG_BINDINGS=!!Ember.ENV.LOG_BINDINGS;var e=Ember.get,t=Ember.set,n=Ember.guidFor,r=Ember.isGlobalPath,s=function(e,t){this._direction="fwd",this._from=t,this._to=e,this._directionMap=Ember.Map.create()};s.prototype={copy:function(){var e=new s(this._to,this._from);return this._oneWay&&(e._oneWay=!0),e},from:function(e){return this._from=e,this},to:function(e){return this._to=e,this},oneWay:function(){return this._oneWay=!0,this},toString:function(){var e=this._oneWay?"[oneWay]":"";return"Ember.Binding<"+n(this)+">("+this._from+" -> "+this._to+")"+e},connect:function(e){var t=this._from,n=this._to;return Ember.trySet(e,n,i(e,t)),Ember.addObserver(e,t,this,this.fromDidChange),this._oneWay||Ember.addObserver(e,n,this,this.toDidChange),this._readyToSync=!0,this},disconnect:function(e){var t=!this._oneWay;return Ember.removeObserver(e,this._from,this,this.fromDidChange),t&&Ember.removeObserver(e,this._to,this,this.toDidChange),this._readyToSync=!1,this},fromDidChange:function(e){this._scheduleSync(e,"fwd")},toDidChange:function(e){this._scheduleSync(e,"back")},_scheduleSync:function(e,t){var n=this._directionMap,r=n.get(e);r||(Ember.run.schedule("sync",this,this._sync,e),n.set(e,t)),r==="back"&&t==="fwd"&&n.set(e,"fwd")},_sync:function(t){var n=Ember.LOG_BINDINGS;if(t.isDestroyed||!this._readyToSync)return;var r=this._directionMap,s=r.get(t),o=this._from,u=this._to;r.remove(t);if(s==="fwd"){var a=i(t,this._from);n&&Ember.Logger.log(" ",this.toString(),"->",a,t),this._oneWay?Ember.trySet(t,u,a):Ember._suspendObserver(t,u,this,this.toDidChange,function(){Ember.trySet(t,u,a)})}else if(s==="back"){var f=e(t,this._to);n&&Ember.Logger.log(" ",this.toString(),"<-",f,t),Ember._suspendObserver(t,o,this,this.fromDidChange,function(){Ember.trySet(Ember.isGlobalPath(o)?Ember.lookup:t,o,f)})}}},o(s,{from:function(){var e=this,t=new e;return t.from.apply(t,arguments)},to:function(){var e=this,t=new e;return t.to.apply(t,arguments)},oneWay:function(e,t){var n=this,r=new n(null,e);return r.oneWay(t)}}),Ember.Binding=s,Ember.bind=function(e,t,n){return(new Ember.Binding(t,n)).connect(e)},Ember.oneWay=function(e,t,n){return(new Ember.Binding(t,n)).oneWay().connect(e)}}(),function(){function l(e){var t=Ember.meta(e,!0),n=t.mixins;return n?t.hasOwnProperty("mixins")||(n=t.mixins=u(n)):n=t.mixins={},n}function c(t,n){return n&&n.length>0&&(t.mixins=r.call(n,function(t){if(t instanceof e)return t;var n=new e;return n.properties=t,n})),t}function h(e){return"function"==typeof e&&e.isMethod!==!1&&e!==Boolean&&e!==Object&&e!==Number&&e!==Array&&e!==Date&&e!==String}function d(t,n){var r;return n instanceof e?(r=f(n),t[r]?p:(t[r]=n,n.properties)):n}function v(e,t,n){var r;return r=t.concatenatedProperties||n.concatenatedProperties,e.concatenatedProperties&&(r=r?r.concat(e.concatenatedProperties):e.concatenatedProperties),r}function m(e,t,n,r,i){var s;return r[t]===undefined&&(s=i[t]),s=s||e.descs[t],!!s&&s instanceof Ember.ComputedProperty?(n=u(n),n.func=Ember.wrap(n.func,s.func),n):n}function g(e,t,n,r,i){var s;return i[t]===undefined&&(s=r[t]),s=s||e[t],"function"!=typeof s?n:Ember.wrap(n,s)}function y(e,t,n,r){var i=r[t]||e[t];return i?"function"==typeof i.concat?i.concat(n):Ember.makeArray(i).concat(n):Ember.makeArray(n)}function b(e,n,r,s,o,u,a){if(r instanceof Ember.Descriptor){if(r===t&&o[n])return p;r.func&&(r=m(s,n,r,u,o)),o[n]=r,u[n]=undefined}else{if(h(r))r=g(e,n,r,u,o);else if(a&&i.call(a,n)>=0||n==="concatenatedProperties")r=y(e,n,r,u);o[n]=undefined,u[n]=r}}function w(e,t,n,r,i){function c(e){delete n[e],delete r[e]}var o,u,a,f,l;for(var h=0,m=e.length;h<m;h++){o=e[h],u=d(t,o);if(u===p)continue;if(u){l=Ember.meta(i),f=v(u,r,i);for(a in u){if(!u.hasOwnProperty(a))continue;b(i,a,u[a],l,n,r,f)}u.hasOwnProperty("toString")&&(i.toString=u.toString)}else o.mixins&&(w(o.mixins,t,n,r,i),o._without&&s.call(o._without,c))}}function E(e){var t=Ember.meta(e),n=t.required;if(!n||!t.hasOwnProperty("required"))n=t.required=n?u(n):{};return n}function x(e,t,n,r){if(S.test(t)){var i=r.bindings;i?r.hasOwnProperty("bindings")||(i=r.bindings=u(r.bindings)):i=r.bindings={},i[t]=n}}function T(e,t){var n=t.bindings,r,i,s;if(n){for(r in n)i=n[r],i&&(s=r.slice(0,-7),i instanceof Ember.Binding?(i=i.copy(),i.to(s)):i=new Ember.Binding(s,i),i.connect(e),e[r]=i);t.bindings={}}}function N(e,t){return T(e,t||Ember.meta(e)),e}function C(e,t,n,r,i){var s=t.methodName,o;return r[s]||i[s]?(o=i[s],t=r[s]):n.descs[s]?(t=n.descs[s],o=undefined):(t=undefined,o=e[s]),{desc:t,value:o}}function k(e,t,n,r,i){if("function"!=typeof n)return;var s=n[r];if(s)for(var o=0,u=s.length;o<u;o++)Ember[i](e,s[o],null,t)}function L(e,t,n){var r=e[t];k(e,t,r,"__ember_observesBefore__","removeBeforeObserver"),k(e,t,r,"__ember_observes__","removeObserver"),k(e,t,n,"__ember_observesBefore__","addBeforeObserver"),k(e,t,n,"__ember_observes__","addObserver")}function A(e,r,i){var s={},o={},u=Ember.meta(e),f,c,h;w(r,l(e),s,o,e);for(f in o){if(f==="contructor"||!o.hasOwnProperty(f))continue;h=s[f],c=o[f];if(h===t)continue;while(h&&h instanceof n){var p=C(e,h,u,s,o);h=p.desc,c=p.value}if(h===undefined&&c===undefined)continue;L(e,f,c),x(e,f,c,u),a(e,f,h,c,u)}return i||N(e,u),e}function M(e,t,n){var r=f(e);if(n[r])return!1;n[r]=!0;if(e===t)return!0;var i=e.mixins,s=i?i.length:0;while(--s>=0)if(M(i[s],t,n))return!0;return!1}function _(e,t,n){if(n[f(t)])return;n[f(t)]=!0;if(t.properties){var r=t.properties;for(var i in r)r.hasOwnProperty(i)&&(e[i]=!0)}else t.mixins&&s.call(t.mixins,function(t){_(e,t,n)})}var e,t,n,r=Ember.ArrayPolyfills.map,i=Ember.ArrayPolyfills.indexOf,s=Ember.ArrayPolyfills.forEach,o=[].slice,u=Ember.create,a=Ember.defineProperty,f=Ember.guidFor,p={},S=Ember.IS_BINDING=/^.+Binding$/;Ember.mixin=function(e){var t=o.call(arguments,1);return A(e,t,!1),e},Ember.Mixin=function(){return c(this,arguments)},e=Ember.Mixin,e._apply=A,e.applyPartial=function(e){var t=o.call(arguments,1);return A(e,t,!0)},e.finishPartial=N,Ember.anyUnprocessedMixins=!1,e.create=function(){Ember.anyUnprocessedMixins=!0;var e=this;return c(new e,arguments)};var O=e.prototype;O.reopen=function(){var t,n;this.properties?(t=e.create(),t.properties=this.properties,delete this.properties,this.mixins=[t]):this.mixins||(this.mixins=[]);var r=arguments.length,i=this.mixins,s;for(s=0;s<r;s++)t=arguments[s],t instanceof e?i.push(t):(n=e.create(),n.properties=t,i.push(n));return this},O.apply=function(e){return A(e,[this],!1)},O.applyPartial=function(e){return A(e,[this],!0)},O.detect=function(t){if(!t)return!1;if(t instanceof e)return M(t,this,{});var n=Ember.meta(t,!1).mixins;return n?!!n[f(this)]:!1},O.without=function(){var t=new e(this);return t._without=o.call(arguments),t},O.keys=function(){var e={},t={},n=[];_(e,this,t);for(var r in e)e.hasOwnProperty(r)&&n.push(r);return n},e.mixins=function(e){var t=Ember.meta(e,!1).mixins,n=[];if(!t)return n;for(var r in t){var i=t[r];i.properties||n.push(i)}return n},t=new Ember.Descriptor,t.toString=function(){return"(Required Property)"},Ember.required=function(){return t},n=function(e){this.methodName=e},n.prototype=new Ember.Descriptor,Ember.alias=function(e){return new n(e)},Ember.deprecateFunc("Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead.",Ember.alias),Ember.aliasMethod=function(e){return new n(e)},Ember.observer=function(e){var t=o.call(arguments,1);return e.__ember_observes__=t,e},Ember.immediateObserver=function(){for(var e=0,t=arguments.length;e<t;e++)var n=arguments[e];return Ember.observer.apply(this,arguments)},Ember.beforeObserver=function(e){var t=o.call(arguments,1);return e.__ember_observesBefore__=t,e}}(),function(){}(),function(){e("rsvp",[],function(){"use strict";function d(e,t){n.async(function(){e.trigger("promise:resolved",{detail:t}),e.isResolved=!0,e.resolvedValue=t})}function v(e,t){n.async(function(){e.trigger("promise:failed",{detail:t}),e.isRejected=!0,e.rejectedValue=t})}function m(e){var t,n=[],r=new c,i=e.length;i===0&&r.resolve([]);var s=function(e){return function(t){o(e,t)}},o=function(e,t){n[e]=t,--i===0&&r.resolve(n)},u=function(e){r.reject(e)};for(t=0;t<i;t++)e[t].then(s(t),u);return r}var e=typeof window!="undefined"?window:{},t=e.MutationObserver||e.WebKitMutationObserver,n,r;if(typeof process!="undefined"&&{}.toString.call(process)==="[object process]")r=function(e,t){process.nextTick(function(){e.call(t)})};else if(t){var i=[],s=new t(function(){var e=i.slice();i=[],e.forEach(function(e){var t=e[0],n=e[1];t.call(n)})}),o=document.createElement("div");s.observe(o,{attributes:!0}),window.addEventListener("unload",function(){s.disconnect(),s=null}),r=function(e,t){i.push([e,t]),o.setAttribute("drainQueue","drainQueue")}}else r=function(e,t){setTimeout(function(){e.call(t)},1)};var u=function(e,t){this.type=e;for(var n in t){if(!t.hasOwnProperty(n))continue;this[n]=t[n]}},a=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n][0]===t)return n;return-1},f=function(e){var t=e._promiseCallbacks;return t||(t=e._promiseCallbacks={}),t},l={mixin:function(e){return e.on=this.on,e.off=this.off,e.trigger=this.trigger,e},on:function(e,t,n){var r=f(this),i,s;e=e.split(/\s+/),n=n||this;while(s=e.shift())i=r[s],i||(i=r[s]=[]),a(i,t)===-1&&i.push([t,n])},off:function(e,t){var n=f(this),r,i,s;e=e.split(/\s+/);while(i=e.shift()){if(!t){n[i]=[];continue}r=n[i],s=a(r,t),s!==-1&&r.splice(s,1)}},trigger:function(e,t){var n=f(this),r,i,s,o,a;if(r=n[e])for(var l=0;l<r.length;l++)i=r[l],s=i[0],o=i[1],typeof t!="object"&&(t={detail:t}),a=new u(e,t),s.call(o,a)}},c=function(){this.on("promise:resolved",function(e){this.trigger("success",{detail:e.detail})},this),this.on("promise:failed",function(e){this.trigger("error",{detail:e.detail})},this)},h=function(){},p=function(e,t,n,r){var i=typeof n=="function",s,o,u,a;if(i)try{s=n(r.detail),u=!0}catch(f){a=!0,o=f}else s=r.detail,u=!0;s&&typeof s.then=="function"?s.then(function(e){t.resolve(e)},function(e){t.reject(e)}):i&&u?t.resolve(s):a?t.reject(o):t[e](s)};return c.prototype={then:function(e,t){var r=new c;return this.isResolved&&n.async(function(){p("resolve",r,e,{detail:this.resolvedValue})},this),this.isRejected&&n.async(function(){p("reject",r,t,{detail:this.rejectedValue})},this),this.on("promise:resolved",function(t){p("resolve",r,e,t)}),this.on("promise:failed",function(e){p("reject",r,t,e)}),r},resolve:function(e){d(this,e),this.resolve=h,this.reject=h},reject:function(e){v(this,e),this.resolve=h,this.reject=h}},l.mixin(c.prototype),n={async:r,Promise:c,Event:u,EventTarget:l,all:m,raiseOnUncaughtExceptions:!0},n})}(),function(){e("container",[],function(){function e(e){this.parent=e,this.dict={}}function t(t){this.parent=t,this.children=[],this.resolver=t&&t.resolver||function(){},this.registry=new e(t&&t.registry),this.cache=new e(t&&t.cache),this.typeInjections=new e(t&&t.typeInjections),this.injections={},this._options=new e(t&&t._options),this._typeOptions=new e(t&&t._typeOptions)}function n(e){throw new Error(e+" is not currently supported on child containers")}function r(e,t){var n=s(e,t,"singleton");return n!==!1}function i(e,t){var n={};if(!t)return n;var r,i;for(var s=0,o=t.length;s<o;s++)r=t[s],i=e.lookup(r.fullName),n[r.property]=i;return n}function s(e,t,n){var r=e._options.get(t);if(r&&r[n]!==undefined)return r[n];var i=t.split(":")[0];r=e._typeOptions.get(i);if(r)return r[n]}function o(e,t){var n=e.normalize(t);return e.resolve(n)}function u(e,t){var n=o(e,t),r=t.split(":"),u=r[0],a=r[1],f;if(s(e,t,"instantiate")===!1)return n;if(n){var l=[];l=l.concat(e.typeInjections.get(u)||[]),l=l.concat(e.injections[t]||[]);var c=i(e,l);return c.container=e,c._debugContainerKey=t,f=n.create(c),f}}function a(e,t){e.cache.eachLocal(function(n,r){if(s(e,n,"instantiate")===!1)return;t(r)})}function f(e){e.cache.eachLocal(function(t,n){if(s(e,t,"instantiate")===!1)return;n.destroy()}),e.cache.dict={}}return e.prototype={get:function(e){var t=this.dict;if(t.hasOwnProperty(e))return t[e];if(this.parent)return this.parent.get(e)},set:function(e,t){this.dict[e]=t},has:function(e){var t=this.dict;return t.hasOwnProperty(e)?!0:this.parent?this.parent.has(e):!1},eachLocal:function(e,t){var n=this.dict;for(var r in n)n.hasOwnProperty(r)&&e.call(t,r,n[r])}},t.prototype={child:function(){var e=new t(this);return this.children.push(e),e},set:function(e,t,n){e[t]=n},register:function(e,t,n,r){var i;e.indexOf(":")!==-1?(r=n,n=t,i=e):i=e+":"+t;var s=this.normalize(i);this.registry.set(s,n),this._options.set(s,r||{})},resolve:function(e){return this.resolver(e)||this.registry.get(e)},normalize:function(e){return e},lookup:function(e,t){e=this.normalize(e),t=t||{};if(this.cache.has(e)&&t.singleton!==!1)return this.cache.get(e);var n=u(this,e);if(!n)return;return r(this,e)&&t.singleton!==!1&&this.cache.set(e,n),n},has:function(e){return this.cache.has(e)?!0:!!o(this,e)},optionsForType:function(e,t){this.parent&&n("optionsForType"),this._typeOptions.set(e,t)},options:function(e,t){this.optionsForType(e,t)},typeInjection:function(e,t,r){this.parent&&n("typeInjection");var i=this.typeInjections.get(e);i||(i=[],this.typeInjections.set(e,i)),i.push({property:t,fullName:r})},injection:function(e,t,r){this.parent&&n("injection");if(e.indexOf(":")===-1)return this.typeInjection(e,t,r);var i=this.injections[e]=this.injections[e]||[];i.push({property:t,fullName:r})},destroy:function(){this.isDestroyed=!0;for(var e=0,t=this.children.length;e<t;e++)this.children[e].destroy();this.children=[],a(this,function(e){e.isDestroying=!0}),a(this,function(e){e.destroy()}),delete this.parent,this.isDestroyed=!0},reset:function(){for(var e=0,t=this.children.length;e<t;e++)f(this.children[e]);f(this)}},t})}(),function(){function i(t,n,r,s){var o,u,a;if("object"!=typeof t||t===null)return t;if(n&&(u=e(r,t))>=0)return s[u];if(Ember.typeOf(t)==="array"){o=t.slice();if(n){u=o.length;while(--u>=0)o[u]=i(o[u],n,r,s)}}else if(Ember.Copyable&&Ember.Copyable.detect(t))o=t.copy(n,r,s);else{o={};for(a in t){if(!t.hasOwnProperty(a))continue;if(a.substring(0,2)==="__")continue;o[a]=n?i(t[a],n,r,s):t[a]}}return n&&(r.push(t),s.push(o)),o}var e=Ember.EnumerableUtils.indexOf,t={},n="Boolean Number String Function Array Date RegExp Object".split(" ");Ember.ArrayPolyfills.forEach.call(n,function(e){t["[object "+e+"]"]=e.toLowerCase()});var r=Object.prototype.toString;Ember.typeOf=function(e){var n;return n=e===null||e===undefined?String(e):t[r.call(e)]||"object",n==="function"?Ember.Object&&Ember.Object.detect(e)&&(n="class"):n==="object"&&(e instanceof Error?n="error":Ember.Object&&e instanceof Ember.Object?n="instance":n="object"),n},Ember.compare=function o(e,t){if(e===t)return 0;var n=Ember.typeOf(e),r=Ember.typeOf(t),i=Ember.Comparable;if(i){if(n==="instance"&&i.detect(e.constructor))return e.constructor.compare(e,t);if(r==="instance"&&i.detect(t.constructor))return 1-t.constructor.compare(t,e)}var s=Ember.ORDER_DEFINITION_MAPPING;if(!s){var u=Ember.ORDER_DEFINITION;s=Ember.ORDER_DEFINITION_MAPPING={};var a,f;for(a=0,f=u.length;a<f;++a)s[u[a]]=a;delete Ember.ORDER_DEFINITION}var l=s[n],c=s[r];if(l<c)return-1;if(l>c)return 1;switch(n){case"boolean":case"number":if(e<t)return-1;if(e>t)return 1;return 0;case"string":var h=e.localeCompare(t);if(h<0)return-1;if(h>0)return 1;return 0;case"array":var p=e.length,d=t.length,v=Math.min(p,d),m=0,g=0;while(m===0&&g<v)m=o(e[g],t[g]),g++;if(m!==0)return m;if(p<d)return-1;if(p>d)return 1;return 0;case"instance":if(Ember.Comparable&&Ember.Comparable.detect(e))return e.compare(e,t);return 0;case"date":var y=e.getTime(),b=t.getTime();if(y<b)return-1;if(y>b)return 1;return 0;default:return 0}},Ember.copy=function(e,t){return"object"!=typeof e||e===null?e:Ember.Copyable&&Ember.Copyable.detect(e)?e.copy(t):i(e,t,t?[]:null,t?[]:null)},Ember.inspect=function(e){if(typeof e!="object"||e===null)return e+"";var t,n=[];for(var r in e)if(e.hasOwnProperty(r)){t=e[r];if(t==="toString")continue;Ember.typeOf(t)==="function"&&(t="function() { ... }"),n.push(r+": "+t)}return"{"+n.join(", ")+"}"},Ember.isEqual=function(e,t){return e&&"function"==typeof e.isEqual?e.isEqual(t):e===t},Ember.ORDER_DEFINITION=Ember.ENV.ORDER_DEFINITION||["undefined","null","boolean","number","string","array","object","instance","function","class","date"],Ember.keys=Object.keys,Ember.keys||(Ember.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t});var s=["description","fileName","lineNumber","message","name","number","stack"];Ember.Error=function(){var e=Error.prototype.constructor.apply(this,arguments);for(var t=0;t<s.length;t++)this[s[t]]=e[s[t]]},Ember.Error.prototype=Ember.create(Error.prototype)}(),function(){Ember.RSVP=t("rsvp")}(),function(){var e=/[ _]/g,t={},n=/([a-z])([A-Z])/g,r=/(\-|_|\.|\s)+(.)?/g,i=/([a-z\d])([A-Z]+)/g,s=/\-|\s+/g;Ember.STRINGS={},Ember.String={fmt:function(e,t){var n=0;return e.replace(/%@([0-9]+)?/g,function(e,r){return r=r?parseInt(r,0)-1:n++,e=t[r],(e===null?"(null)":e===undefined?"":e).toString()})},loc:function(e,t){return e=Ember.STRINGS[e]||e,Ember.String.fmt(e,t)},w:function(e){return e.split(/\s+/)},decamelize:function(e){return e.replace(n,"$1_$2").toLowerCase()},dasherize:function(n){var r=t,i=r.hasOwnProperty(n),s;return i?r[n]:(s=Ember.String.decamelize(n).replace(e,"-"),r[n]=s,s)},camelize:function(e){return e.replace(r,function(e,t,n){return n?n.toUpperCase():""}).replace(/^([A-Z])/,function(e,t,n){return e.toLowerCase()})},classify:function(e){var t=e.split("."),n=[];for(var r=0,i=t.length;r<i;r++){var s=Ember.String.camelize(t[r]);n.push(s.charAt(0).toUpperCase()+s.substr(1))}return n.join(".")},underscore:function(e){return e.replace(i,"$1_$2").replace(s,"_").toLowerCase()},capitalize:function(e){return e.charAt(0).toUpperCase()+e.substr(1)}}}(),function(){var e=Ember.String.fmt,t=Ember.String.w,n=Ember.String.loc,r=Ember.String.camelize,i=Ember.String.decamelize,s=Ember.String.dasherize,o=Ember.String.underscore,u=Ember.String.capitalize,a=Ember.String.classify;if(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.String)String.prototype.fmt=function(){return e(this,arguments)},String.prototype.w=function(){return t(this)},String.prototype.loc=function(){return n(this,arguments)},String.prototype.camelize=function(){return r(this)},String.prototype.decamelize=function(){return i(this)},String.prototype.dasherize=function(){return s(this)},String.prototype.underscore=function(){return o(this)},String.prototype.classify=function(){return a(this)},String.prototype.capitalize=function(){return u(this)}}(),function(){var e=Array.prototype.slice;if(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Function)Function.prototype.property=function(){var e=Ember.computed(this);return e.property.apply(e,arguments)},Function.prototype.observes=function(){return this.__ember_observes__=e.call(arguments),this},Function.prototype.observesBefore=function(){return this.__ember_observesBefore__=e.call(arguments),this}}(),function(){}(),function(){function s(){return i.length===0?{}:i.pop()}function o(e){return i.push(e),null}function u(t,n){function i(i){var s=e(i,t);return r?n===s:!!s}var r=arguments.length===2;return i}var e=Ember.get,t=Ember.set,n=Array.prototype.slice,r=Ember.EnumerableUtils.indexOf,i=[];Ember.Enumerable=Ember.Mixin.create({isEnumerable:!0,nextObject:Ember.required(Function),firstObject:Ember.computed(function(){if(e(this,"length")===0)return undefined;var t=s(),n;return n=this.nextObject(0,null,t),o(t),n}).property("[]"),lastObject:Ember.computed(function(){var t=e(this,"length");if(t===0)return undefined;var n=s(),r=0,i,u=null;do u=i,i=this.nextObject(r++,u,n);while(i!==undefined);return o(n),u}).property("[]"),contains:function(e){return this.find(function(t){return t===e})!==undefined},forEach:function(t,n){if(typeof t!="function")throw new TypeError;var r=e(this,"length"),i=null,u=s();n===undefined&&(n=null);for(var a=0;a<r;a++){var f=this.nextObject(a,i,u);t.call(n,f,a,this),i=f}return i=null,u=o(u),this},getEach:function(e){return this.mapProperty(e)},setEach:function(e,n){return this.forEach(function(r){t(r,e,n)})},map:function(e,t){var n=Ember.A([]);return this.forEach(function(r,i,s){n[i]=e.call(t,r,i,s)}),n},mapProperty:function(t){return this.map(function(n){return e(n,t)})},filter:function(e,t){var n=Ember.A([]);return this.forEach(function(r,i,s){e.call(t,r,i,s)&&n.push(r)}),n},reject:function(e,t){return this.filter(function(){return!e.apply(t,arguments)})},filterProperty:function(e,t){return this.filter(u.apply(this,arguments))},rejectProperty:function(t,n){var r=function(r){return e(r,t)===n},i=function(n){return!!e(n,t)},s=arguments.length===2?r:i;return this.reject(s)},find:function(t,n){var r=e(this,"length");n===undefined&&(n=null);var i=null,u,a=!1,f,l=s();for(var c=0;c<r&&!a;c++){u=this.nextObject(c,i,l);if(a=t.call(n,u,c,this))f=u;i=u}return u=i=null,l=o(l),f},findProperty:function(e,t){return this.find(u.apply(this,arguments))},every:function(e,t){return!this.find(function(n,r,i){return!e.call(t,n,r,i)})},everyProperty:function(e,t){return this.every(u.apply(this,arguments))},some:function(e,t){return!!this.find(function(n,r,i){return!!e.call(t,n,r,i)})},someProperty:function(e,t){return this.some(u.apply(this,arguments))},reduce:function(e,t,n){if(typeof e!="function")throw new TypeError;var r=t;return this.forEach(function(t,i){r=e.call(null,r,t,i,this,n)},this),r},invoke:function(e){var t,r=Ember.A([]);return arguments.length>1&&(t=n.call(arguments,1)),this.forEach(function(n,i){var s=n&&n[e];"function"==typeof s&&(r[i]=t?s.apply(n,t):s.call(n))},this),r},toArray:function(){var e=Ember.A([]);return this.forEach(function(t,n){e[n]=t}),e},compact:function(){return this.filter(function(e){return e!=null})},without:function(e){if(!this.contains(e))return this;var t=Ember.A([]);return this.forEach(function(n){n!==e&&(t[t.length]=n)}),t},uniq:function(){var e=Ember.A([]);return this.forEach(function(t){r(e,t)<0&&e.push(t)}),e},"[]":Ember.computed(function(e,t){return this}),addEnumerableObserver:function(t,n){var r=n&&n.willChange||"enumerableWillChange",i=n&&n.didChange||"enumerableDidChange",s=e(this,"hasEnumerableObservers");return s||Ember.propertyWillChange(this,"hasEnumerableObservers"),Ember.addListener(this,"@enumerable:before",t,r),Ember.addListener(this,"@enumerable:change",t,i),s||Ember.propertyDidChange(this,"hasEnumerableObservers"),this},removeEnumerableObserver:function(t,n){var r=n&&n.willChange||"enumerableWillChange",i=n&&n.didChange||"enumerableDidChange",s=e(this,"hasEnumerableObservers");return s&&Ember.propertyWillChange(this,"hasEnumerableObservers"),Ember.removeListener(this,"@enumerable:before",t,r),Ember.removeListener(this,"@enumerable:change",t,i),s&&Ember.propertyDidChange(this,"hasEnumerableObservers"),this},hasEnumerableObservers:Ember.computed(function(){return Ember.hasListeners(this,"@enumerable:change")||Ember.hasListeners(this,"@enumerable:before")}),enumerableContentWillChange:function(t,n){var r,i,s;return"number"==typeof t?r=t:t?r=e(t,"length"):r=t=-1,"number"==typeof n?i=n:n?i=e(n,"length"):i=n=-1,s=i<0||r<0||i-r!==0,t===-1&&(t=null),n===-1&&(n=null),Ember.propertyWillChange(this,"[]"),s&&Ember.propertyWillChange(this,"length"),Ember.sendEvent(this,"@enumerable:before",[this,t,n]),this},enumerableContentDidChange:function(t,n){var r,i,s;return"number"==typeof t?r=t:t?r=e(t,"length"):r=t=-1,"number"==typeof n?i=n:n?i=e(n,"length"):i=n=-1,s=i<0||r<0||i-r!==0,t===-1&&(t=null),n===-1&&(n=null),Ember.sendEvent(this,"@enumerable:change",[this,t,n]),s&&Ember.propertyDidChange(this,"length"),Ember.propertyDidChange(this,"[]"),this}})}(),function(){function i(e){return e===null||e===undefined}var e=Ember.get,t=Ember.set,n=Ember.EnumerableUtils.map,r=Ember.cacheFor;Ember.Array=Ember.Mixin.create(Ember.Enumerable,{isSCArray:!0,length:Ember.required(),objectAt:function(t){return t<0||t>=e(this,"length")?undefined:e(this,t)},objectsAt:function(e){var t=this;return n(e,function(e){return t.objectAt(e)})},nextObject:function(e){return this.objectAt(e)},"[]":Ember.computed(function(t,n){return n!==undefined&&this.replace(0,e(this,"length"),n),this}),firstObject:Ember.computed(function(){return this.objectAt(0)}),lastObject:Ember.computed(function(){return this.objectAt(e(this,"length")-1)}),contains:function(e){return this.indexOf(e)>=0},slice:function(t,n){var r=Ember.A([]),s=e(this,"length");i(t)&&(t=0);if(i(n)||n>s)n=s;t<0&&(t=s+t),n<0&&(n=s+n);while(t<n)r[r.length]=this.objectAt(t++);return r},indexOf:function(t,n){var r,i=e(this,"length");n===undefined&&(n=0),n<0&&(n+=i);for(r=n;r<i;r++)if(this.objectAt(r,!0)===t)return r;return-1},lastIndexOf:function(t,n){var r,i=e(this,"length");if(n===undefined||n>=i)n=i-1;n<0&&(n+=i);for(r=n;r>=0;r--)if(this.objectAt(r)===t)return r;return-1},addArrayObserver:function(t,n){var r=n&&n.willChange||"arrayWillChange",i=n&&n.didChange||"arrayDidChange",s=e(this,"hasArrayObservers");return s||Ember.propertyWillChange(this,"hasArrayObservers"),Ember.addListener(this,"@array:before",t,r),Ember.addListener(this,"@array:change",t,i),s||Ember.propertyDidChange(this,"hasArrayObservers"),this},removeArrayObserver:function(t,n){var r=n&&n.willChange||"arrayWillChange",i=n&&n.didChange||"arrayDidChange",s=e(this,"hasArrayObservers");return s&&Ember.propertyWillChange(this,"hasArrayObservers"),Ember.removeListener(this,"@array:before",t,r),Ember.removeListener(this,"@array:change",t,i),s&&Ember.propertyDidChange(this,"hasArrayObservers"),this},hasArrayObservers:Ember.computed(function(){return Ember.hasListeners(this,"@array:change")||Ember.hasListeners(this,"@array:before")}),arrayContentWillChange:function(t,n,r){t===undefined?(t=0,n=r=-1):(n===undefined&&(n=-1),r===undefined&&(r=-1)),Ember.isWatching(this,"@each")&&e(this,"@each"),Ember.sendEvent(this,"@array:before",[this,t,n,r]);var i,s;if(t>=0&&n>=0&&e(this,"hasEnumerableObservers")){i=[],s=t+n;for(var o=t;o<s;o++)i.push(this.objectAt(o))}else i=n;return this.enumerableContentWillChange(i,r),this},arrayContentDidChange:function(t,n,i){t===undefined?(t=0,n=i=-1):(n===undefined&&(n=-1),i===undefined&&(i=-1));var s,o;if(t>=0&&i>=0&&e(this,"hasEnumerableObservers")){s=[],o=t+i;for(var u=t;u<o;u++)s.push(this.objectAt(u))}else s=i;this.enumerableContentDidChange(n,s),Ember.sendEvent(this,"@array:change",[this,t,n,i]);var a=e(this,"length"),f=r(this,"firstObject"),l=r(this,"lastObject");return this.objectAt(0)!==f&&(Ember.propertyWillChange(this,"firstObject"),Ember.propertyDidChange(this,"firstObject")),this.objectAt(a-1)!==l&&(Ember.propertyWillChange(this,"lastObject"),Ember.propertyDidChange(this,"lastObject")),this},"@each":Ember.computed(function(){return this.__each||(this.__each=new Ember.EachProxy(this)),this.__each})})}(),function(){Ember.Comparable=Ember.Mixin.create({isComparable:!0,compare:Ember.required(Function)})}(),function(){var e=Ember.get,t=Ember.set;Ember.Copyable=Ember.Mixin.create({copy:Ember.required(Function),frozenCopy:function(){if(Ember.Freezable&&Ember.Freezable.detect(this))return e(this,"isFrozen")?this:this.copy().freeze();throw new Error(Ember.String.fmt("%@ does not support freezing",[this]))}})}(),function(){var e=Ember.get,t=Ember.set;Ember.Freezable=Ember.Mixin.create({isFrozen:!1,freeze:function(){return e(this,"isFrozen")?this:(t(this,"isFrozen",!0),this)}}),Ember.FROZEN_ERROR="Frozen object cannot be modified."}(),function(){var e=Ember.EnumerableUtils.forEach;Ember.MutableEnumerable=Ember.Mixin.create(Ember.Enumerable,{addObject:Ember.required(Function),addObjects:function(t){return Ember.beginPropertyChanges(this),e(t,function(e){this.addObject(e)},this),Ember.endPropertyChanges(this),this},removeObject:Ember.required(Function),removeObjects:function(t){return Ember.beginPropertyChanges(this),e(t,function(e){this.removeObject(e)},this),Ember.endPropertyChanges(this),this}})}(),function(){var e="Index out of range",t=[],n=Ember.get,r=Ember.set;Ember.MutableArray=Ember.Mixin.create(Ember.Array,Ember.MutableEnumerable,{replace:Ember.required(),clear:function(){var e=n(this,"length");return e===0?this:(this.replace(0,e,t),this)},insertAt:function(t,r){if(t>n(this,"length"))throw new Error(e);return this.replace(t,0,[r]),this},removeAt:function(r,i){if("number"==typeof r){if(r<0||r>=n(this,"length"))throw new Error(e);i===undefined&&(i=1),this.replace(r,i,t)}return this},pushObject:function(e){return this.insertAt(n(this,"length"),e),e},pushObjects:function(e){return this.replace(n(this,"length"),0,e),this},popObject:function(){var e=n(this,"length");if(e===0)return null;var t=this.objectAt(e-1);return this.removeAt(e-1,1),t},shiftObject:function(){if(n(this,"length")===0)return null;var e=this.objectAt(0);return this.removeAt(0),e},unshiftObject:function(e){return this.insertAt(0,e),e},unshiftObjects:function(e){return this.replace(0,0,e),this},reverseObjects:function(){var e=n(this,"length");if(e===0)return this;var t=this.toArray().reverse();return this.replace(0,e,t),this},setObjects:function(e){if(e.length===0)return this.clear();var t=n(this,"length");return this.replace(0,t,e),this},removeObject:function(e){var t=n(this,"length")||0;while(--t>=0){var r=this.objectAt(t);r===e&&this.removeAt(t)}return this},addObject:function(e){return this.contains(e)||this.pushObject(e),this}})}(),function(){var e=Ember.get,t=Ember.set;Ember.Observable=Ember.Mixin.create({get:function(t){return e(this,t)},getProperties:function(){var t={},n=arguments;arguments.length===1&&Ember.typeOf(arguments[0])==="array"&&(n=arguments[0]);for(var r=0;r<n.length;r++)t[n[r]]=e(this,n[r]);return t},set:function(e,n){return t(this,e,n),this},setProperties:function(e){return Ember.setProperties(this,e)},beginPropertyChanges:function(){return Ember.beginPropertyChanges(),this},endPropertyChanges:function(){return Ember.endPropertyChanges(),this},propertyWillChange:function(e){return Ember.propertyWillChange(this,e),this},propertyDidChange:function(e){return Ember.propertyDidChange(this,e),this},notifyPropertyChange:function(e){return this.propertyWillChange(e),this.propertyDidChange(e),this},addBeforeObserver:function(e,t,n){Ember.addBeforeObserver(this,e,t,n)},addObserver:function(e,t,n){Ember.addObserver(this,e,t,n)},removeObserver:function(e,t,n){Ember.removeObserver(this,e,t,n)},hasObserverFor:function(e){return Ember.hasListeners(this,e+":change")},getPath:function(e){return this.get(e)},setPath:function(e,t){return this.set(e,t)},getWithDefault:function(e,t){return Ember.getWithDefault(this,e,t)},incrementProperty:function(n,r){return r||(r=1),t(this,n,(e(this,n)||0)+r),e(this,n)},decrementProperty:function(n,r){return r||(r=1),t(this,n,(e(this,n)||0)-r),e(this,n)},toggleProperty:function(n){return t(this,n,!e(this,n)),e(this,n)},cacheFor:function(e){return Ember.cacheFor(this,e)},observersForKey:function(e){return Ember.observersFor(this,e)}})}(),function(){var e=Ember.get,t=Ember.set;Ember.TargetActionSupport=Ember.Mixin.create({target:null,action:null,targetObject:Ember.computed(function(){var t=e(this,"target");if(Ember.typeOf(t)==="string"){var n=e(this,t);return n===undefined&&(n=e(Ember.lookup,t)),n}return t}).property("target"),triggerAction:function(){var t=e(this,"action"),n=e(this,"targetObject");if(n&&t){var r;return typeof n.send=="function"?r=n.send(t,this):(typeof t=="string"&&(t=n[t]),r=t.call(n,this)),r!==!1&&(r=!0),r}return!1}})}(),function(){Ember.Evented=
17
- Ember.Mixin.create({on:function(e,t,n){return Ember.addListener(this,e,t,n),this},one:function(e,t,n){return n||(n=t,t=null),Ember.addListener(this,e,t,n,!0),this},trigger:function(e){var t=[],n,r;for(n=1,r=arguments.length;n<r;n++)t.push(arguments[n]);Ember.sendEvent(this,e,t)},fire:function(e){this.trigger.apply(this,arguments)},off:function(e,t,n){return Ember.removeListener(this,e,t,n),this},has:function(e){return Ember.hasListeners(this,e)}})}(),function(){var e=t("rsvp");e.async=function(e,t){Ember.run.schedule("actions",t,e)};var n=Ember.get;Ember.DeferredMixin=Ember.Mixin.create({then:function(e,t){var r=n(this,"promise");return r.then.apply(r,arguments)},resolve:function(e){n(this,"promise").resolve(e)},reject:function(e){n(this,"promise").reject(e)},promise:Ember.computed(function(){return new e.Promise})})}(),function(){}(),function(){Ember.Container=t("container"),Ember.Container.set=Ember.set}(),function(){function b(){var e=!1,t,s,o=function(){e||o.proto(),r(this,i,y),r(this,"_super",y);var a=u(this);a.proto=this;if(t){var l=t;t=null,this.reopen.apply(this,l)}if(s){var c=s;s=null;var h=this.concatenatedProperties;for(var p=0,v=c.length;p<v;p++){var b=c[p];for(var w in b){if(!b.hasOwnProperty(w))continue;var E=b[w],S=Ember.IS_BINDING;if(S.test(w)){var x=a.bindings;x?a.hasOwnProperty("bindings")||(x=a.bindings=n(a.bindings)):x=a.bindings={},x[w]=E}var T=a.descs[w];if(h&&g(h,w)>=0){var N=this[w];N?"function"==typeof N.concat?E=N.concat(E):E=Ember.makeArray(N).concat(E):E=Ember.makeArray(E)}T?T.set(this,w,E):typeof this.setUnknownProperty!="function"||w in this?m?Ember.defineProperty(this,w,null,E):this[w]=E:this.setUnknownProperty(w,E)}}}d(this,a),delete a.proto,f(this),this.init.apply(this,arguments)};return o.toString=h.prototype.toString,o.willReopen=function(){e&&(o.PrototypeMixin=h.create(o.PrototypeMixin)),e=!1},o._initMixins=function(e){t=e},o._initProperties=function(e){s=e},o.proto=function(){var t=o.superclass;return t&&t.proto(),e||(e=!0,o.PrototypeMixin.applyPartial(o.prototype),a(o.prototype)),this.prototype},o}function E(e){return function(){return e}}var e=Ember.set,t=Ember.get,n=Ember.create,r=Ember.platform.defineProperty,i=Ember.GUID_KEY,s=Ember.guidFor,o=Ember.generateGuid,u=Ember.meta,a=Ember.rewatch,f=Ember.finishChains,l=Ember.destroy,c=Ember.run.schedule,h=Ember.Mixin,p=h._apply,d=h.finishPartial,v=h.prototype.reopen,m=Ember.ENV.MANDATORY_SETTER,g=Ember.EnumerableUtils.indexOf,y={configurable:!0,writable:!0,enumerable:!1,value:undefined},w=b();w.toString=function(){return"Ember.CoreObject"},w.PrototypeMixin=h.create({reopen:function(){return p(this,arguments,!0),this},isInstance:!0,init:function(){},concatenatedProperties:null,isDestroyed:!1,isDestroying:!1,destroy:function(){if(this._didCallDestroy)return;return this.isDestroying=!0,this._didCallDestroy=!0,this.willDestroy&&this.willDestroy(),c("destroy",this,this._scheduledDestroy),this},_scheduledDestroy:function(){l(this),e(this,"isDestroyed",!0),this.didDestroy&&this.didDestroy()},bind:function(e,t){return t instanceof Ember.Binding||(t=Ember.Binding.from(t)),t.to(e).connect(this),t},toString:function x(){var e=typeof this.toStringExtension=="function",t=e?":"+this.toStringExtension():"",n="<"+this.constructor.toString()+":"+s(this)+t+">";return this.toString=E(n),n}}),w.PrototypeMixin.ownerConstructor=w,Ember.config.overridePrototypeMixin&&Ember.config.overridePrototypeMixin(w.PrototypeMixin),w.__super__=null;var S=h.create({ClassMixin:Ember.required(),PrototypeMixin:Ember.required(),isClass:!0,isMethod:!1,extend:function(){var e=b(),t;return e.ClassMixin=h.create(this.ClassMixin),e.PrototypeMixin=h.create(this.PrototypeMixin),e.ClassMixin.ownerConstructor=e,e.PrototypeMixin.ownerConstructor=e,v.apply(e.PrototypeMixin,arguments),e.superclass=this,e.__super__=this.prototype,t=e.prototype=n(this.prototype),t.constructor=e,o(t,"ember"),u(t).proto=t,e.ClassMixin.apply(e),e},createWithMixins:function(){var e=this;return arguments.length>0&&this._initMixins(arguments),new e},create:function(){var e=this;return arguments.length>0&&this._initProperties(arguments),new e},reopen:function(){return this.willReopen(),v.apply(this.PrototypeMixin,arguments),this},reopenClass:function(){return v.apply(this.ClassMixin,arguments),p(this,arguments,!1),this},detect:function(e){if("function"!=typeof e)return!1;while(e){if(e===this)return!0;e=e.superclass}return!1},detectInstance:function(e){return e instanceof this},metaForProperty:function(e){var t=u(this.proto(),!1).descs[e];return t._meta||{}},eachComputedProperty:function(e,t){var n=this.proto(),r=u(n).descs,i={},s;for(var o in r)s=r[o],s instanceof Ember.ComputedProperty&&e.call(t||this,o,s._meta||i)}});S.ownerConstructor=w,Ember.config.overrideClassMixin&&Ember.config.overrideClassMixin(S),w.ClassMixin=S,S.apply(w),Ember.CoreObject=w}(),function(){Ember.Object=Ember.CoreObject.extend(Ember.Observable),Ember.Object.toString=function(){return"Ember.Object"}}(),function(){function o(e,t,n){var u=e.length;r[e.join(".")]=t;for(var f in t){if(!i.call(t,f))continue;var c=t[f];e[u]=f;if(c&&c.toString===l)c.toString=h(e.join(".")),c[a]=e.join(".");else if(c&&c.isNamespace){if(n[s(c)])continue;n[s(c)]=!0,o(e,c,n)}}e.length=u}function u(){var e=Ember.Namespace,t=Ember.lookup,n,r;if(e.PROCESSED)return;for(var i in t){if(i==="parent"||i==="top"||i==="frameElement")continue;if(i==="globalStorage"&&t.StorageList&&t.globalStorage instanceof t.StorageList)continue;if(t.hasOwnProperty&&!t.hasOwnProperty(i))continue;try{n=Ember.lookup[i],r=n&&n.isNamespace}catch(s){continue}r&&(n[a]=i)}}function f(e){var t=e.superclass;if(t)return t[a]?t[a]:f(t);return}function l(){!Ember.BOOTED&&!this[a]&&c();var e;if(this[a])e=this[a];else{var t=f(this);t?e="(subclass of "+t+")":e="(unknown mixin)",this.toString=h(e)}return e}function c(){var e=!n.PROCESSED,t=Ember.anyUnprocessedMixins;e&&(u(),n.PROCESSED=!0);if(e||t){var r=n.NAMESPACES,i;for(var s=0,a=r.length;s<a;s++)i=r[s],o([i.toString()],i,{});Ember.anyUnprocessedMixins=!1}}function h(e){return function(){return e}}var e=Ember.get,t=Ember.ArrayPolyfills.indexOf,n=Ember.Namespace=Ember.Object.extend({isNamespace:!0,init:function(){Ember.Namespace.NAMESPACES.push(this),Ember.Namespace.PROCESSED=!1},toString:function(){var t=e(this,"name");return t?t:(u(),this[Ember.GUID_KEY+"_name"])},nameClasses:function(){o([this.toString()],this,{})},destroy:function(){var e=Ember.Namespace.NAMESPACES;Ember.lookup[this.toString()]=undefined,e.splice(t.call(e,this),1),this._super()}});n.reopenClass({NAMESPACES:[Ember],NAMESPACES_BY_ID:{},PROCESSED:!1,processAll:c,byName:function(e){return Ember.BOOTED||c(),r[e]}});var r=n.NAMESPACES_BY_ID,i={}.hasOwnProperty,s=Ember.guidFor,a=Ember.NAME_KEY=Ember.GUID_KEY+"_name";Ember.Mixin.prototype.toString=l}(),function(){Ember.Application=Ember.Namespace.extend()}(),function(){var e="Index out of range",t=[],n=Ember.get,r=Ember.set;Ember.ArrayProxy=Ember.Object.extend(Ember.MutableArray,{content:null,arrangedContent:Ember.computed.alias("content"),objectAtContent:function(e){return n(this,"arrangedContent").objectAt(e)},replaceContent:function(e,t,r){n(this,"content").replace(e,t,r)},_contentWillChange:Ember.beforeObserver(function(){this._teardownContent()},"content"),_teardownContent:function(){var e=n(this,"content");e&&e.removeArrayObserver(this,{willChange:"contentArrayWillChange",didChange:"contentArrayDidChange"})},contentArrayWillChange:Ember.K,contentArrayDidChange:Ember.K,_contentDidChange:Ember.observer(function(){var e=n(this,"content");this._setupContent()},"content"),_setupContent:function(){var e=n(this,"content");e&&e.addArrayObserver(this,{willChange:"contentArrayWillChange",didChange:"contentArrayDidChange"})},_arrangedContentWillChange:Ember.beforeObserver(function(){var e=n(this,"arrangedContent"),t=e?n(e,"length"):0;this.arrangedContentArrayWillChange(this,0,t,undefined),this.arrangedContentWillChange(this),this._teardownArrangedContent(e)},"arrangedContent"),_arrangedContentDidChange:Ember.observer(function(){var e=n(this,"arrangedContent"),t=e?n(e,"length"):0;this._setupArrangedContent(),this.arrangedContentDidChange(this),this.arrangedContentArrayDidChange(this,0,undefined,t)},"arrangedContent"),_setupArrangedContent:function(){var e=n(this,"arrangedContent");e&&e.addArrayObserver(this,{willChange:"arrangedContentArrayWillChange",didChange:"arrangedContentArrayDidChange"})},_teardownArrangedContent:function(){var e=n(this,"arrangedContent");e&&e.removeArrayObserver(this,{willChange:"arrangedContentArrayWillChange",didChange:"arrangedContentArrayDidChange"})},arrangedContentWillChange:Ember.K,arrangedContentDidChange:Ember.K,objectAt:function(e){return n(this,"content")&&this.objectAtContent(e)},length:Ember.computed(function(){var e=n(this,"arrangedContent");return e?n(e,"length"):0}),_replace:function(e,t,r){var i=n(this,"content");return i&&this.replaceContent(e,t,r),this},replace:function(){if(n(this,"arrangedContent")!==n(this,"content"))throw new Ember.Error("Using replace on an arranged ArrayProxy is not allowed.");this._replace.apply(this,arguments)},_insertAt:function(t,r){if(t>n(this,"content.length"))throw new Error(e);return this._replace(t,0,[r]),this},insertAt:function(e,t){if(n(this,"arrangedContent")===n(this,"content"))return this._insertAt(e,t);throw new Ember.Error("Using insertAt on an arranged ArrayProxy is not allowed.")},removeAt:function(r,i){if("number"==typeof r){var s=n(this,"content"),o=n(this,"arrangedContent"),u=[],a;if(r<0||r>=n(this,"length"))throw new Error(e);i===undefined&&(i=1);for(a=r;a<r+i;a++)u.push(s.indexOf(o.objectAt(a)));u.sort(function(e,t){return t-e}),Ember.beginPropertyChanges();for(a=0;a<u.length;a++)this._replace(u[a],1,t);Ember.endPropertyChanges()}return this},pushObject:function(e){return this._insertAt(n(this,"content.length"),e),e},pushObjects:function(e){return this._replace(n(this,"length"),0,e),this},setObjects:function(e){if(e.length===0)return this.clear();var t=n(this,"length");return this._replace(0,t,e),this},unshiftObject:function(e){return this._insertAt(0,e),e},unshiftObjects:function(e){return this._replace(0,0,e),this},slice:function(){var e=this.toArray();return e.slice.apply(e,arguments)},arrangedContentArrayWillChange:function(e,t,n,r){this.arrayContentWillChange(t,n,r)},arrangedContentArrayDidChange:function(e,t,n,r){this.arrayContentDidChange(t,n,r)},init:function(){this._super(),this._setupContent(),this._setupArrangedContent()},willDestroy:function(){this._teardownArrangedContent(),this._teardownContent()}})}(),function(){function f(e,t){var n=t.slice(8);if(n in this)return;u(this,n)}function l(e,t){var n=t.slice(8);if(n in this)return;a(this,n)}var e=Ember.get,t=Ember.set,n=Ember.String.fmt,r=Ember.addBeforeObserver,i=Ember.addObserver,s=Ember.removeBeforeObserver,o=Ember.removeObserver,u=Ember.propertyWillChange,a=Ember.propertyDidChange;Ember.ObjectProxy=Ember.Object.extend({content:null,_contentDidChange:Ember.observer(function(){},"content"),isTruthy:Ember.computed.bool("content"),_debugContainerKey:null,willWatchProperty:function(e){var t="content."+e;r(this,t,null,f),i(this,t,null,l)},didUnwatchProperty:function(e){var t="content."+e;s(this,t,null,f),o(this,t,null,l)},unknownProperty:function(t){var n=e(this,"content");if(n)return e(n,t)},setUnknownProperty:function(n,r){var i=e(this,"content");return t(i,n,r)}}),Ember.ObjectProxy.reopenClass({create:function(){var e,t,n,r,i,s;if(arguments.length){t=this.proto();for(n=0,r=arguments.length;n<r;n++){i=arguments[n];for(s in i){if(!i.hasOwnProperty(s)||s in t)continue;e||(e={}),e[s]=null}}e&&this._initMixins([e])}return this._super.apply(this,arguments)}})}(),function(){function o(e,t,r,i,s){var o=r._objects,u;o||(o=r._objects={});while(--s>=i){var a=e.objectAt(s);a&&(Ember.addBeforeObserver(a,t,r,"contentKeyWillChange"),Ember.addObserver(a,t,r,"contentKeyDidChange"),u=n(a),o[u]||(o[u]=[]),o[u].push(s))}}function u(e,t,r,i,s){var o=r._objects;o||(o=r._objects={});var u,a;while(--s>=i){var f=e.objectAt(s);f&&(Ember.removeBeforeObserver(f,t,r,"contentKeyWillChange"),Ember.removeObserver(f,t,r,"contentKeyDidChange"),a=n(f),u=o[a],u[u.indexOf(s)]=null)}}var e=Ember.set,t=Ember.get,n=Ember.guidFor,r=Ember.EnumerableUtils.forEach,i=Ember.Object.extend(Ember.Array,{init:function(e,t,n){this._super(),this._keyName=t,this._owner=n,this._content=e},objectAt:function(e){var n=this._content.objectAt(e);return n&&t(n,this._keyName)},length:Ember.computed(function(){var e=this._content;return e?t(e,"length"):0})}),s=/^.+:(before|change)$/;Ember.EachProxy=Ember.Object.extend({init:function(e){this._super(),this._content=e,e.addArrayObserver(this),r(Ember.watchedEvents(this),function(e){this.didAddListener(e)},this)},unknownProperty:function(e,t){var n;return n=new i(this._content,e,this),Ember.defineProperty(this,e,null,n),this.beginObservingContentKey(e),n},arrayWillChange:function(e,t,n,r){var i=this._keys,s,o;o=n>0?t+n:-1,Ember.beginPropertyChanges(this);for(s in i){if(!i.hasOwnProperty(s))continue;o>0&&u(e,s,this,t,o),Ember.propertyWillChange(this,s)}Ember.propertyWillChange(this._content,"@each"),Ember.endPropertyChanges(this)},arrayDidChange:function(e,t,n,r){var i=this._keys,s,u;u=r>0?t+r:-1,Ember.beginPropertyChanges(this);for(s in i){if(!i.hasOwnProperty(s))continue;u>0&&o(e,s,this,t,u),Ember.propertyDidChange(this,s)}Ember.propertyDidChange(this._content,"@each"),Ember.endPropertyChanges(this)},didAddListener:function(e){s.test(e)&&this.beginObservingContentKey(e.slice(0,-7))},didRemoveListener:function(e){s.test(e)&&this.stopObservingContentKey(e.slice(0,-7))},beginObservingContentKey:function(e){var n=this._keys;n||(n=this._keys={});if(!n[e]){n[e]=1;var r=this._content,i=t(r,"length");o(r,e,this,0,i)}else n[e]++},stopObservingContentKey:function(e){var n=this._keys;if(n&&n[e]>0&&--n[e]<=0){var r=this._content,i=t(r,"length");u(r,e,this,0,i)}},contentKeyWillChange:function(e,t){Ember.propertyWillChange(this,t)},contentKeyDidChange:function(e,t){Ember.propertyDidChange(this,t)}})}(),function(){var e=Ember.get,t=Ember.set,n=Ember.Mixin.create(Ember.MutableArray,Ember.Observable,Ember.Copyable,{get:function(e){return e==="length"?this.length:"number"==typeof e?this[e]:this._super(e)},objectAt:function(e){return this[e]},replace:function(t,n,r){if(this.isFrozen)throw Ember.FROZEN_ERROR;var i=r?e(r,"length"):0;this.arrayContentWillChange(t,n,i);if(!r||r.length===0)this.splice(t,n);else{var s=[t,n].concat(r);this.splice.apply(this,s)}return this.arrayContentDidChange(t,n,i),this},unknownProperty:function(e,t){var n;return t!==undefined&&n===undefined&&(n=this[e]=t),n},indexOf:function(e,t){var n,r=this.length;t===undefined?t=0:t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=r);for(n=t;n<r;n++)if(this[n]===e)return n;return-1},lastIndexOf:function(e,t){var n,r=this.length;t===undefined?t=r-1:t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=r);for(n=t;n>=0;n--)if(this[n]===e)return n;return-1},copy:function(e){return e?this.map(function(e){return Ember.copy(e,!0)}):this.slice()}}),r=["length"];Ember.EnumerableUtils.forEach(n.keys(),function(e){Array.prototype[e]&&r.push(e)}),r.length>0&&(n=n.without.apply(n,r)),Ember.NativeArray=n,Ember.A=function(e){return e===undefined&&(e=[]),Ember.Array.detect(e)?e:Ember.NativeArray.apply(e)},Ember.NativeArray.activate=function(){n.apply(Array.prototype),Ember.A=function(e){return e||[]}},(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Array)&&Ember.NativeArray.activate()}(),function(){var e=Ember.get,t=Ember.set,n=Ember.guidFor,r=Ember.isNone,i=Ember.String.fmt;Ember.Set=Ember.CoreObject.extend(Ember.MutableEnumerable,Ember.Copyable,Ember.Freezable,{length:0,clear:function(){if(this.isFrozen)throw new Error(Ember.FROZEN_ERROR);var r=e(this,"length");if(r===0)return this;var i;this.enumerableContentWillChange(r,0),Ember.propertyWillChange(this,"firstObject"),Ember.propertyWillChange(this,"lastObject");for(var s=0;s<r;s++)i=n(this[s]),delete this[i],delete this[s];return t(this,"length",0),Ember.propertyDidChange(this,"firstObject"),Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(r,0),this},isEqual:function(t){if(!Ember.Enumerable.detect(t))return!1;var n=e(this,"length");if(e(t,"length")!==n)return!1;while(--n>=0)if(!t.contains(this[n]))return!1;return!0},add:Ember.aliasMethod("addObject"),remove:Ember.aliasMethod("removeObject"),pop:function(){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);var t=this.length>0?this[this.length-1]:null;return this.remove(t),t},push:Ember.aliasMethod("addObject"),shift:Ember.aliasMethod("pop"),unshift:Ember.aliasMethod("push"),addEach:Ember.aliasMethod("addObjects"),removeEach:Ember.aliasMethod("removeObjects"),init:function(e){this._super(),e&&this.addObjects(e)},nextObject:function(e){return this[e]},firstObject:Ember.computed(function(){return this.length>0?this[0]:undefined}),lastObject:Ember.computed(function(){return this.length>0?this[this.length-1]:undefined}),addObject:function(i){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);if(r(i))return this;var s=n(i),o=this[s],u=e(this,"length"),a;return o>=0&&o<u&&this[o]===i?this:(a=[i],this.enumerableContentWillChange(null,a),Ember.propertyWillChange(this,"lastObject"),u=e(this,"length"),this[s]=u,this[u]=i,t(this,"length",u+1),Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(null,a),this)},removeObject:function(i){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);if(r(i))return this;var s=n(i),o=this[s],u=e(this,"length"),a=o===0,f=o===u-1,l,c;return o>=0&&o<u&&this[o]===i&&(c=[i],this.enumerableContentWillChange(c,null),a&&Ember.propertyWillChange(this,"firstObject"),f&&Ember.propertyWillChange(this,"lastObject"),o<u-1&&(l=this[u-1],this[o]=l,this[n(l)]=o),delete this[s],delete this[u-1],t(this,"length",u-1),a&&Ember.propertyDidChange(this,"firstObject"),f&&Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(c,null)),this},contains:function(e){return this[n(e)]>=0},copy:function(){var r=this.constructor,i=new r,s=e(this,"length");t(i,"length",s);while(--s>=0)i[s]=this[s],i[n(this[s])]=s;return i},toString:function(){var e=this.length,t,n=[];for(t=0;t<e;t++)n[t]=this[t];return i("Ember.Set<%@>",[n.join(",")])}})}(),function(){var e=Ember.DeferredMixin,t=Ember.get,n=Ember.Object.extend(e);n.reopenClass({promise:function(e,r){var i=n.create();return e.call(r,i),t(i,"promise")}}),Ember.Deferred=n}(),function(){var e=Ember.ENV.EMBER_LOAD_HOOKS||{},t={};Ember.onLoad=function(n,r){var i;e[n]=e[n]||Ember.A(),e[n].pushObject(r),(i=t[n])&&r(i)},Ember.runLoadHooks=function(n,r){var i;t[n]=r,(i=e[n])&&e[n].forEach(function(e){e(r)})}}(),function(){}(),function(){var e=Ember.get;Ember.ControllerMixin=Ember.Mixin.create({isController:!0,target:null,container:null,store:null,model:Ember.computed.alias("content"),send:function(t){var n=[].slice.call(arguments,1),r;this[t]?this[t].apply(this,n):(r=e(this,"target"))&&r.send.apply(r,arguments)}}),Ember.Controller=Ember.Object.extend(Ember.ControllerMixin)}(),function(){var e=Ember.get,t=Ember.set,n=Ember.EnumerableUtils.forEach;Ember.SortableMixin=Ember.Mixin.create(Ember.MutableEnumerable,{sortProperties:null,sortAscending:!0,orderBy:function(t,r){var i=0,s=e(this,"sortProperties"),o=e(this,"sortAscending");return n(s,function(n){i===0&&(i=Ember.compare(e(t,n),e(r,n)),i!==0&&!o&&(i=-1*i))}),i},destroy:function(){var t=e(this,"content"),r=e(this,"sortProperties");return t&&r&&n(t,function(e){n(r,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),this._super()},isSorted:Ember.computed.bool("sortProperties"),arrangedContent:Ember.computed("content","sortProperties.@each",function(t,r){var i=e(this,"content"),s=e(this,"isSorted"),o=e(this,"sortProperties"),u=this;return i&&s?(i=i.slice(),i.sort(function(e,t){return u.orderBy(e,t)}),n(i,function(e){n(o,function(t){Ember.addObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),Ember.A(i)):i}),_contentWillChange:Ember.beforeObserver(function(){var t=e(this,"content"),r=e(this,"sortProperties");t&&r&&n(t,function(e){n(r,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),this._super()},"content"),sortAscendingWillChange:Ember.beforeObserver(function(){this._lastSortAscending=e(this,"sortAscending")},"sortAscending"),sortAscendingDidChange:Ember.observer(function(){if(e(this,"sortAscending")!==this._lastSortAscending){var t=e(this,"arrangedContent");t.reverseObjects()}},"sortAscending"),contentArrayWillChange:function(t,r,i,s){var o=e(this,"isSorted");if(o){var u=e(this,"arrangedContent"),a=t.slice(r,r+i),f=e(this,"sortProperties");n(a,function(e){u.removeObject(e),n(f,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this)}return this._super(t,r,i,s)},contentArrayDidChange:function(t,r,i,s){var o=e(this,"isSorted"),u=e(this,"sortProperties");if(o){var a=t.slice(r,r+s);n(a,function(e){this.insertItemSorted(e),n(u,function(t){Ember.addObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this)}return this._super(t,r,i,s)},insertItemSorted:function(t){var n=e(this,"arrangedContent"),r=e(n,"length"),i=this._binarySearch(t,0,r);n.insertAt(i,t)},contentItemSortPropertyDidChange:function(t){var n=e(this,"arrangedContent"),r=n.indexOf(t),i=n.objectAt(r-1),s=n.objectAt(r+1),o=i&&this.orderBy(t,i),u=s&&this.orderBy(t,s);if(o<0||u>0)n.removeObject(t),this.insertItemSorted(t)},_binarySearch:function(t,n,r){var i,s,o,u;return n===r?n:(u=e(this,"arrangedContent"),i=n+Math.floor((r-n)/2),s=u.objectAt(i),o=this.orderBy(s,t),o<0?this._binarySearch(t,i+1,r):o>0?this._binarySearch(t,n,i):i)}})}(),function(){var e=Ember.get,t=Ember.set,n=Ember.EnumerableUtils.forEach,r=Ember.EnumerableUtils.replace;Ember.ArrayController=Ember.ArrayProxy.extend(Ember.ControllerMixin,Ember.SortableMixin,{itemController:null,lookupItemController:function(t){return e(this,"itemController")},objectAtContent:function(t){var n=e(this,"length"),r=e(this,"arrangedContent"),i=r&&r.objectAt(t);if(t>=0&&t<n){var s=this.lookupItemController(i);if(s)return this.controllerAt(t,i,s)}return i},arrangedContentDidChange:function(){this._super(),this._resetSubControllers()},arrayContentDidChange:function(t,i,s){var o=e(this,"_subControllers"),u=o.slice(t,t+i);n(u,function(e){e&&e.destroy()}),r(o,t,i,new Array(s)),this._super(t,i,s)},init:function(){this._super(),this.get("content")||Ember.defineProperty(this,"content",undefined,Ember.A()),this.set("_subControllers",Ember.A())},controllerAt:function(t,n,r){var i=e(this,"container"),s=e(this,"_subControllers"),o=s[t];o||(o=i.lookup("controller:"+r,{singleton:!1}),s[t]=o);if(!o)throw new Error('Could not resolve itemController: "'+r+'"');return o.set("target",this),o.set("content",n),o},_subControllers:null,_resetSubControllers:function(){var t=e(this,"_subControllers");n(t,function(e){e&&e.destroy()}),this.set("_subControllers",Ember.A())}})}(),function(){Ember.ObjectController=Ember.ObjectProxy.extend(Ember.ControllerMixin)}(),function(){}(),function(){}(),function(){var e=Ember.get,t=Ember.set;Ember.State=Ember.Object.extend(Ember.Evented,{isState:!0,parentState:null,start:null,name:null,path:Ember.computed(function(){var t=e(this,"parentState.path"),n=e(this,"name");return t&&(n=t+"."+n),n}),trigger:function(e){this[e]&&this[e].apply(this,[].slice.call(arguments,1)),this._super.apply(this,arguments)},init:function(){var n=e(this,"states");t(this,"childStates",Ember.A()),t(this,"eventTransitions",e(this,"eventTransitions")||{});var r,i,s;if(!n){n={};for(r in this){if(r==="constructor")continue;if(i=this[r]){if(s=i.transitionTarget)this.eventTransitions[r]=s;this.setupChild(n,r,i)}}t(this,"states",n)}else for(r in n)this.setupChild(n,r,n[r]);t(this,"pathsCache",{}),t(this,"pathsCacheNoContext",{})},setupChild:function(n,r,i){if(!i)return!1;i.isState?t(i,"name",r):Ember.State.detect(i)&&(i=i.create({name:r}));if(i.isState)return t(i,"parentState",this),e(this,"childStates").pushObject(i),n[r]=i,i},lookupEventTransition:function(e){var t,n=this;while(n&&!t)t=n.eventTransitions[e],n=n.get("parentState");return t},isLeaf:Ember.computed(function(){return!e(this,"childStates").length}),hasContext:!0,setup:Ember.K,enter:Ember.K,exit:Ember.K}),Ember.State.reopenClass({transitionTo:function(e){var t=function(t,n){var r=[],i=Ember.$&&Ember.$.Event;n&&i&&n instanceof i?n.hasOwnProperty("contexts")&&(r=n.contexts.slice()):r=[].slice.call(arguments,1),r.unshift(e),t.transitionTo.apply(t,r)};return t.transitionTarget=e,t}})}(),function(){var e=Ember.get,t=Ember.set,n=Ember.String.fmt,r=Ember.ArrayPolyfills.forEach,i=function(e){this.enterStates=e.enterStates.slice(),this.exitStates=e.exitStates.slice(),this.resolveState=e.resolveState,this.finalState=e.enterStates[e.enterStates.length-1]||e.resolveState};i.prototype={normalize:function(e,t){return this.matchContextsToStates(t),this.addInitialStates(),this.removeUnchangedContexts(e),this},matchContextsToStates:function(t){var n=this.enterStates.length-1,r=[],i,s;while(t.length>0){if(n>=0)i=this.enterStates[n--];else{if(this.enterStates.length){i=e(this.enterStates[0],"parentState");if(!i)throw"Cannot match all contexts to states"}else i=this.resolveState;this.enterStates.unshift(i),this.exitStates.unshift(i)}e(i,"hasContext")?s=t.pop():s=null,r.unshift(s)}this.contexts=r},addInitialStates:function(){var t=this.finalState,n;for(;;){n=e(t,"initialState")||"start",t=e(t,"states."+n);if(!t)break;this.finalState=t,this.enterStates.push(t),this.contexts.push(undefined)}},removeUnchangedContexts:function(e){while(this.enterStates.length>0){if(this.enterStates[0]!==this.exitStates[0])break;if(this.enterStates.length===this.contexts.length){if(e.getStateMeta(this.enterStates[0],"context")!==this.contexts[0])break;this.contexts.shift()}this.resolveState=this.enterStates.shift(),this.exitStates.shift()}}};var s=function(t,r,i){var u=this.enableLogging,a=i?"unhandledEvent":t,f=r[a],l,c,h;l=[].slice.call(arguments,3);if(typeof f=="function")return u&&(i?Ember.Logger.log(n("STATEMANAGER: Unhandled event '%@' being sent to state %@.",[t,e(r,"path")])):Ember.Logger.log(n("STATEMANAGER: Sending event '%@' to state %@.",[t,e(r,"path")]))),h=l,i&&h.unshift(t),h.unshift(this),f.apply(r,h);var p=e(r,"parentState");if(p)return c=l,c.unshift(t,p,i),s.apply(this,c);if(!i)return o.call(this,t,l,!0)},o=function(t,n,r){return n.unshift(t,e(this,"currentState"),r),s.apply(this,n)};Ember.StateManager=Ember.State.extend({init:function(){this._super(),t(this,"stateMeta",Ember.Map.create());var n=e(this,"initialState");!n&&e(this,"states.start")&&(n="start"),n&&this.transitionTo(n)},stateMetaFor:function(t){var n=e(this,"stateMeta"),r=n.get(t);return r||(r={},n.set(t,r)),r},setStateMeta:function(e,n,r){return t(this.stateMetaFor(e),n,r)},getStateMeta:function(t,n){return e(this.stateMetaFor(t),n)},currentState:null,currentPath:Ember.computed.alias("currentState.path"),transitionEvent:"setup",errorOnUnhandledEvent:!0,send:function(e){var t=[].slice.call(arguments,1);return o.call(this,e,t,!1)},unhandledEvent:function(t,n){if(e(this,"errorOnUnhandledEvent"))throw new Ember.Error(this.toString()+" could not respond to event "+n+" in state "+e(this,"currentState.path")+".")},getStateByPath:function(t,n){var r=n.split("."),i=t;for(var s=0,o=r.length;s<o;s++){i=e(e(i,"states"),r[s]);if(!i)break}return i},findStateByPath:function(t,n){var r;while(!r&&t)r=this.getStateByPath(t,n),t=e(t,"parentState");return r},getStatesInPath:function(t,n){if(!n||n==="")return undefined;var r=n.split("."),i=[],s,o;for(var u=0,a=r.length;u<a;u++){s=e(t,"states");if(!s)return undefined;o=e(s,r[u]);if(!o)return undefined;t=o,i.push(o)}return i},goToState:function(){return this.transitionTo.apply(this,arguments)},transitionTo:function(t,n){if(Ember.isEmpty(t))return;var r=n?Array.prototype.slice.call(arguments,1):[],s=e(this,"currentState")||this,o=this.contextFreeTransition(s,t),u=(new i(o)).normalize(this,r);this.enterState(u),this.triggerSetupContext(u)},contextFreeTransition:function(t,n){var r=t.pathsCache[n];if(r)return r;var i=this.getStatesInPath(t,n),s=[],o=t;while(o&&!i){s.unshift(o),o=e(o,"parentState");if(!o){i=this.getStatesInPath(this,n);if(!i)return}i=this.getStatesInPath(o,n)}while(i.length>0&&i[0]===s[0])o=i.shift(),s.shift();var u=t.pathsCache[n]={exitStates:s,enterStates:i,resolveState:o};return u},triggerSetupContext:function(t){var n=t.contexts,i=t.enterStates.length-n.length,s=t.enterStates,o=e(this,"transitionEvent");r.call(s,function(e,t){e.trigger(o,this,n[t-i])},this)},getState:function(t){var n=e(this,t),r=e(this,"parentState");if(n)return n;if(r)return r.getState(t)},enterState:function(n){var i=this.enableLogging,s=n.exitStates.slice(0).reverse();r.call(s,function(e){e.trigger("exit",this)},this),r.call(n.enterStates,function(t){i&&Ember.Logger.log("STATEMANAGER: Entering "+e(t,"path")),t.trigger("enter",this)},this),t(this,"currentState",n.finalState)}})}(),function(){}()})(),typeof location!="undefined"&&(location.hostname==="localhost"||location.hostname==="127.0.0.1")&&console.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. If you want full error messages please use the non-minified build provided on the Ember website.");
15
+ (function(){var e,t;(function(){var n={},r={};e=function(e,t,r){n[e]={deps:t,callback:r}},t=function(e){if(r[e])return r[e];r[e]={};var i=n[e],s=i.deps,o=i.callback,u=[],a;for(var f=0,l=s.length;f<l;f++)s[f]==="exports"?u.push(a={}):u.push(t(s[f]));var c=o.apply(this,u);return r[e]=a||c}})(),function(){function r(t){if(e.console&&e.console[t])return e.console[t].apply?function(){e.console[t].apply(e.console,arguments)}:function(){var n=Array.prototype.join.call(arguments,", ");e.console[t](n)}}"undefined"==typeof Ember&&(Ember={});var e=Ember.imports=Ember.imports||this,t=Ember.exports=Ember.exports||this,n=Ember.lookup=Ember.lookup||this;t.Em=t.Ember=Em=Ember,Ember.isNamespace=!0,Ember.toString=function(){return"Ember"},Ember.VERSION="1.0.0-rc.2",Ember.ENV=Ember.ENV||("undefined"==typeof ENV?{}:ENV),Ember.config=Ember.config||{},Ember.EXTEND_PROTOTYPES=Ember.ENV.EXTEND_PROTOTYPES,typeof Ember.EXTEND_PROTOTYPES=="undefined"&&(Ember.EXTEND_PROTOTYPES=!0),Ember.LOG_STACKTRACE_ON_DEPRECATION=Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION!==!1,Ember.SHIM_ES5=Ember.ENV.SHIM_ES5===!1?!1:Ember.EXTEND_PROTOTYPES,Ember.LOG_VERSION=Ember.ENV.LOG_VERSION===!1?!1:!0,Ember.K=function(){return this},"undefined"==typeof Ember.assert&&(Ember.assert=Ember.K),"undefined"==typeof Ember.warn&&(Ember.warn=Ember.K),"undefined"==typeof Ember.debug&&(Ember.debug=Ember.K),"undefined"==typeof Ember.deprecate&&(Ember.deprecate=Ember.K),"undefined"==typeof Ember.deprecateFunc&&(Ember.deprecateFunc=function(e,t){return t}),Ember.uuid=0,Ember.Logger={log:r("log")||Ember.K,warn:r("warn")||Ember.K,error:r("error")||Ember.K,info:r("info")||Ember.K,debug:r("debug")||r("info")||Ember.K},Ember.onerror=null,Ember.handleErrors=function(e,t){if("function"!=typeof Ember.onerror)return e.call(t||this);try{return e.call(t||this)}catch(n){Ember.onerror(n)}},Ember.merge=function(e,t){for(var n in t){if(!t.hasOwnProperty(n))continue;e[n]=t[n]}return e},Ember.isNone=function(e){return e===null||e===undefined},Ember.none=Ember.deprecateFunc("Ember.none is deprecated. Please use Ember.isNone instead.",Ember.isNone),Ember.isEmpty=function(e){return e===null||e===undefined||e.length===0&&typeof e!="function"||typeof e=="object"&&Ember.get(e,"length")===0},Ember.empty=Ember.deprecateFunc("Ember.empty is deprecated. Please use Ember.isEmpty instead.",Ember.isEmpty)}(),function(){var e=Ember.platform={};Ember.create=Object.create;if(!Ember.create||Ember.ENV.STUB_OBJECT_CREATE){var t=function(){};Ember.create=function(e,n){t.prototype=e,e=new t;if(n){t.prototype=e;for(var r in n)t.prototype[r]=n[r].value;e=new t}return t.prototype=null,e},Ember.create.isSimulated=!0}var n=Object.defineProperty,r,i;if(n)try{n({},"a",{get:function(){}})}catch(s){n=null}n&&(r=function(){var e={};return n(e,"a",{configurable:!0,enumerable:!0,get:function(){},set:function(){}}),n(e,"a",{configurable:!0,enumerable:!0,writable:!0,value:!0}),e.a===!0}(),i=function(){try{return n(document.createElement("div"),"definePropertyOnDOM",{}),!0}catch(e){}return!1}(),r?i||(n=function(e,t,n){var r;return typeof Node=="object"?r=e instanceof Node:r=typeof e=="object"&&typeof e.nodeType=="number"&&typeof e.nodeName=="string",r?e[t]=n.value:Object.defineProperty(e,t,n)}):n=null),e.defineProperty=n,e.hasPropertyAccessors=!0,e.defineProperty||(e.hasPropertyAccessors=!1,e.defineProperty=function(e,t,n){n.get||(e[t]=n.value)},e.defineProperty.isSimulated=!0),Ember.ENV.MANDATORY_SETTER&&!e.hasPropertyAccessors&&(Ember.ENV.MANDATORY_SETTER=!1)}(),function(){var e=Ember.EnumerableUtils={map:function(e,t,n){return e.map?e.map.call(e,t,n):Array.prototype.map.call(e,t,n)},forEach:function(e,t,n){return e.forEach?e.forEach.call(e,t,n):Array.prototype.forEach.call(e,t,n)},indexOf:function(e,t,n){return e.indexOf?e.indexOf.call(e,t,n):Array.prototype.indexOf.call(e,t,n)},indexesOf:function(t,n){return n===undefined?[]:e.map(n,function(n){return e.indexOf(t,n)})},addObject:function(t,n){var r=e.indexOf(t,n);r===-1&&t.push(n)},removeObject:function(t,n){var r=e.indexOf(t,n);r!==-1&&t.splice(r,1)},replace:function(e,t,n,r){if(e.replace)return e.replace(t,n,r);var i=Array.prototype.concat.apply([t,n],r);return e.splice.apply(e,i)},intersection:function(e,t){var n=[];return e.forEach(function(e){t.indexOf(e)>=0&&n.push(e)}),n}}}(),function(){var e=function(e){return e&&Function.prototype.toString.call(e).indexOf("[native code]")>-1},t=e(Array.prototype.map)?Array.prototype.map:function(e){if(this===void 0||this===null)throw new TypeError;var t=Object(this),n=t.length>>>0;if(typeof e!="function")throw new TypeError;var r=new Array(n),i=arguments[1];for(var s=0;s<n;s++)s in t&&(r[s]=e.call(i,t[s],s,t));return r},n=e(Array.prototype.forEach)?Array.prototype.forEach:function(e){if(this===void 0||this===null)throw new TypeError;var t=Object(this),n=t.length>>>0;if(typeof e!="function")throw new TypeError;var r=arguments[1];for(var i=0;i<n;i++)i in t&&e.call(r,t[i],i,t)},r=e(Array.prototype.indexOf)?Array.prototype.indexOf:function(e,t){t===null||t===undefined?t=0:t<0&&(t=Math.max(0,this.length+t));for(var n=t,r=this.length;n<r;n++)if(this[n]===e)return n;return-1};Ember.ArrayPolyfills={map:t,forEach:n,indexOf:r},Ember.SHIM_ES5&&(Array.prototype.map||(Array.prototype.map=t),Array.prototype.forEach||(Array.prototype.forEach=n),Array.prototype.indexOf||(Array.prototype.indexOf=r))}(),function(){function h(e){this.descs={},this.watching={},this.cache={},this.source=e}function p(e,t){return!!e&&typeof e[t]=="function"}var e=Ember.platform.defineProperty,t=Ember.create,n="__ember"+ +(new Date),r=0,i=[],s={},o=Ember.ENV.MANDATORY_SETTER;Ember.GUID_KEY=n;var u={writable:!1,configurable:!1,enumerable:!1,value:null};Ember.generateGuid=function(i,s){s||(s="ember");var o=s+r++;return i&&(u.value=o,e(i,n,u)),o},Ember.guidFor=function(o){if(o===undefined)return"(undefined)";if(o===null)return"(null)";var a,f,l=typeof o;switch(l){case"number":return f=i[o],f||(f=i[o]="nu"+o),f;case"string":return f=s[o],f||(f=s[o]="st"+r++),f;case"boolean":return o?"(true)":"(false)";default:if(o[n])return o[n];if(o===Object)return"(Object)";if(o===Array)return"(Array)";return f="ember"+r++,u.value=f,e(o,n,u),f}};var a={writable:!0,configurable:!1,enumerable:!1,value:null},f=Ember.GUID_KEY+"_meta";Ember.META_KEY=f;var l={descs:{},watching:{}};o&&(l.values={}),Ember.EMPTY_META=l,Object.freeze&&Object.freeze(l);var c=Ember.platform.defineProperty.isSimulated;c&&(h.prototype.__preventPlainObject__=!0,h.prototype.toJSON=function(){}),Ember.meta=function(r,i){var s=r[f];return i===!1?s||l:(s?s.source!==r&&(c||e(r,f,a),s=t(s),s.descs=t(s.descs),s.watching=t(s.watching),s.cache={},s.source=r,o&&(s.values=t(s.values)),r[f]=s):(c||e(r,f,a),s=new h(r),o&&(s.values={}),r[f]=s,s.descs.constructor=null),s)},Ember.getMeta=function(t,n){var r=Ember.meta(t,!1);return r[n]},Ember.setMeta=function(t,n,r){var i=Ember.meta(t,!0);return i[n]=r,r},Ember.metaPath=function(n,r,i){var s=Ember.meta(n,i),o,u;for(var a=0,f=r.length;a<f;a++){o=r[a],u=s[o];if(!u){if(!i)return undefined;u=s[o]={__ember_source__:n}}else if(u.__ember_source__!==n){if(!i)return undefined;u=s[o]=t(u),u.__ember_source__=n}s=u}return u},Ember.wrap=function(e,t){function n(){}function r(){var r,i=this._super;return this._super=t||n,r=e.apply(this,arguments),this._super=i,r}return r.wrappedFunction=e,r.__ember_observes__=e.__ember_observes__,r.__ember_observesBefore__=e.__ember_observesBefore__,r},Ember.isArray=function(e){return!e||e.setInterval?!1:Array.isArray&&Array.isArray(e)?!0:Ember.Array&&Ember.Array.detect(e)?!0:e.length!==undefined&&"object"==typeof e?!0:!1},Ember.makeArray=function(e){return e===null||e===undefined?[]:Ember.isArray(e)?e:[e]},Ember.canInvoke=p,Ember.tryInvoke=function(e,t,n){if(p(e,t))return e[t].apply(e,n||[])};var d=function(){var e=0;try{try{}finally{throw e++,new Error("needsFinallyFixTest")}}catch(t){}return e!==1}();d?Ember.tryFinally=function(e,t,n){var r,i,s;n=n||this;try{r=e.call(n)}finally{try{i=t.call(n)}catch(o){s=o}}if(s)throw s;return i===undefined?r:i}:Ember.tryFinally=function(e,t,n){var r,i;n=n||this;try{r=e.call(n)}finally{i=t.call(n)}return i===undefined?r:i},d?Ember.tryCatchFinally=function(e,t,n,r){var i,s,o,u;r=r||this;try{i=e.call(r)}catch(a){i=t.call(r,a)}finally{try{s=n.call(r)}catch(f){o=f}}if(o)throw o;return s===undefined?i:s}:Ember.tryCatchFinally=function(e,t,n,r){var i,s;r=r||this;try{i=e.call(r)}catch(o){i=t.call(r,o)}finally{s=n.call(r)}return s===undefined?i:s};var v={},m="Boolean Number String Function Array Date RegExp Object".split(" ");Ember.ArrayPolyfills.forEach.call(m,function(e){v["[object "+e+"]"]=e.toLowerCase()});var g=Object.prototype.toString;Ember.typeOf=function(e){var t;return t=e===null||e===undefined?String(e):v[g.call(e)]||"object",t==="function"?Ember.Object&&Ember.Object.detect(e)&&(t="class"):t==="object"&&(e instanceof Error?t="error":Ember.Object&&e instanceof Ember.Object?t="instance":t="object"),t}}(),function(){Ember.Instrumentation={};var e=[],t={},n=function(n){var r=[],i;for(var s=0,o=e.length;s<o;s++)i=e[s],i.regex.test(n)&&r.push(i.object);return t[n]=r,r},r=function(){var e="undefined"!=typeof window?window.performance||{}:{},t=e.now||e.mozNow||e.webkitNow||e.msNow||e.oNow;return t?t.bind(e):function(){return+(new Date)}}();Ember.Instrumentation.instrument=function(e,i,s,o){function d(){for(h=0,p=u.length;h<p;h++)c=u[h],l[h]=c.before(e,r(),i);return s.call(o)}function v(e){i=i||{},i.exception=e}function m(){for(h=0,p=u.length;h<p;h++)c=u[h],c.after(e,r(),i,l[h]);Ember.STRUCTURED_PROFILE&&console.timeEnd(a)}var u=t[e],a,f;Ember.STRUCTURED_PROFILE&&(a=e+": "+i.object,console.time(a)),u||(u=n(e));if(u.length===0)return f=s.call(o),Ember.STRUCTURED_PROFILE&&console.timeEnd(a),f;var l=[],c,h,p;return Ember.tryCatchFinally(d,v,m)},Ember.Instrumentation.subscribe=function(n,r){var i=n.split("."),s,o=[];for(var u=0,a=i.length;u<a;u++)s=i[u],s==="*"?o.push("[^\\.]*"):o.push(s);o=o.join("\\."),o+="(\\..*)?";var f={pattern:n,regex:new RegExp("^"+o+"$"),object:r};return e.push(f),t={},f},Ember.Instrumentation.unsubscribe=function(n){var r;for(var i=0,s=e.length;i<s;i++)e[i]===n&&(r=i);e.splice(r,1),t={}},Ember.Instrumentation.reset=function(){e=[],t={}},Ember.instrument=Ember.Instrumentation.instrument,Ember.subscribe=Ember.Instrumentation.subscribe}(),function(){var e=Ember.guidFor,t=Ember.ArrayPolyfills.indexOf,n=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},r=function(e,t){var r=e.keys.copy(),i=n(e.values);return t.keys=r,t.values=i,t},i=Ember.OrderedSet=function(){this.clear()};i.create=function(){return new i},i.prototype={clear:function(){this.presenceSet={},this.list=[]},add:function(t){var n=e(t),r=this.presenceSet,i=this.list;if(n in r)return;r[n]=!0,i.push(t)},remove:function(n){var r=e(n),i=this.presenceSet,s=this.list;delete i[r];var o=t.call(s,n);o>-1&&s.splice(o,1)},isEmpty:function(){return this.list.length===0},has:function(t){var n=e(t),r=this.presenceSet;return n in r},forEach:function(e,t){var n=this.list.slice();for(var r=0,i=n.length;r<i;r++)e.call(t,n[r])},toArray:function(){return this.list.slice()},copy:function(){var e=new i;return e.presenceSet=n(this.presenceSet),e.list=this.list.slice(),e}};var s=Ember.Map=function(){this.keys=Ember.OrderedSet.create(),this.values={}};s.create=function(){return new s},s.prototype={get:function(t){var n=this.values,r=e(t);return n[r]},set:function(t,n){var r=this.keys,i=this.values,s=e(t);r.add(t),i[s]=n},remove:function(t){var n=this.keys,r=this.values,i=e(t),s;return r.hasOwnProperty(i)?(n.remove(t),s=r[i],delete r[i],!0):!1},has:function(t){var n=this.values,r=e(t);return n.hasOwnProperty(r)},forEach:function(t,n){var r=this.keys,i=this.values;r.forEach(function(r){var s=e(r);t.call(n,r,i[s])})},copy:function(){return r(this,new s)}};var o=Ember.MapWithDefault=function(e){s.call(this),this.defaultValue=e.defaultValue};o.create=function(e){return e?new o(e):new s},o.prototype=Ember.create(s.prototype),o.prototype.get=function(e){var t=this.has(e);if(t)return s.prototype.get.call(this,e);var n=this.defaultValue(e);return this.set(e,n),n},o.prototype.copy=function(){return r(this,new o({defaultValue:this.defaultValue}))}}(),function(){function o(e){return e.match(s)[0]}function u(e,n){var s=i.test(n),u=!s&&r.test(n),a;if(!e||u)e=Ember.lookup;s&&(n=n.slice(5)),e===Ember.lookup&&(a=o(n),e=t(e,a),n=n.slice(a.length+1));if(!n||n.length===0)throw new Error("Invalid Path");return[e,n]}var e=Ember.META_KEY,t,n=Ember.ENV.MANDATORY_SETTER,r=/^([A-Z$]|([0-9][A-Z$])).*[\.\*]/,i=/^this[\.\*]/,s=/^([^\.\*]+)/;t=function(r,i){if(i==="")return r;!i&&"string"==typeof r&&(i=r,r=null);if(!r||i.indexOf(".")!==-1)return a(r,i);var s=r[e],o=s&&s.descs[i],u;return o?o.get(r,i):(n&&s&&s.watching[i]>0?u=s.values[i]:u=r[i],u!==undefined||"object"!=typeof r||i in r||"function"!=typeof r.unknownProperty?u:r.unknownProperty(i))},Ember.config.overrideAccessors&&(Ember.get=t,Ember.config.overrideAccessors(),t=Ember.get);var a=Ember._getPath=function(e,n){var r,s,o,a,f;if(e===null&&n.indexOf(".")===-1)return t(Ember.lookup,n);r=i.test(n);if(!e||r)o=u(e,n),e=o[0],n=o[1],o.length=0;s=n.split("."),f=s.length;for(a=0;e&&a<f;a++){e=t(e,s[a],!0);if(e&&e.isDestroyed)return undefined}return e};Ember.normalizeTuple=function(e,t){return u(e,t)},Ember.getWithDefault=function(e,n,r){var i=t(e,n);return i===undefined?r:i},Ember.get=t,Ember.getPath=Ember.deprecateFunc("getPath is deprecated since get now supports paths",Ember.get)}(),function(){function r(e,t,n){var r=-1;for(var i=0,s=e.length;i<s;i++)if(t===e[i][0]&&n===e[i][1]){r=i;break}return r}function i(n,r){var i=t(n,!0),s;return i.listeners||(i.listeners={}),i.hasOwnProperty("listeners")||(i.listeners=e(i.listeners)),s=i.listeners[r],s&&!i.listeners.hasOwnProperty(r)?s=i.listeners[r]=i.listeners[r].slice():s||(s=i.listeners[r]=[]),s}function s(e,t,i){var s=e[n],o=s&&s.listeners&&s.listeners[t];if(!o)return;for(var u=o.length-1;u>=0;u--){var a=o[u][0],f=o[u][1],l=o[u][2],c=o[u][3],h=r(i,a,f);h===-1&&i.push([a,f,l,c])}}function o(e,t,i){var s=e[n],o=s&&s.listeners&&s.listeners[t],u=[];if(!o)return;for(var a=o.length-1;a>=0;a--){var f=o[a][0],l=o[a][1],c=o[a][2],h=o[a][3],p=r(i,f,l);if(p!==-1)continue;i.push([f,l,c,h]),u.push([f,l,c,h])}return u}function u(e,t,n,s,o){!s&&"function"==typeof n&&(s=n,n=null);var u=i(e,t),a=r(u,n,s);if(a!==-1)return;u.push([n,s,o,undefined]),"function"==typeof e.didAddListener&&e.didAddListener(t,n,s)}function a(e,t,s,o){function u(n,s,o){var u=i(e,t),a=r(u,n,s);if(a===-1)return;u.splice(a,1),"function"==typeof e.didRemoveListener&&e.didRemoveListener(t,n,s)}!o&&"function"==typeof s&&(o=s,s=null);if(o)u(s,o);else{var a=e[n],f=a&&a.listeners&&a.listeners[t];if(!f)return;for(var l=f.length-1;l>=0;l--)u(f[l][0],f[l][1])}}function f(e,t,n,s,o){function l(){return o.call(n)}function c(){f&&(f[3]=undefined)}!s&&"function"==typeof n&&(s=n,n=null);var u=i(e,t),a=r(u,n,s),f;return a!==-1&&(f=u[a].slice(),f[3]=!0,u[a]=f),Ember.tryFinally(l,c)}function l(e,t,n,s,o){function d(){return o.call(n)}function v(){for(c=0,h=u.length;c<h;c++)u[c][3]=undefined}!s&&"function"==typeof n&&(s=n,n=null);var u=[],a,f,l,c,h;for(c=0,h=t.length;c<h;c++){a=t[c],f=i(e,a);var p=r(f,n,s);p!==-1&&(l=f[p].slice(),l[3]=!0,f[p]=l,u.push(l))}return Ember.tryFinally(d,v)}function c(e){var t=e[n].listeners,r=[];if(t)for(var i in t)t[i]&&r.push(i);return r}function h(e,t,r,i){e!==Ember&&"function"==typeof e.sendEvent&&e.sendEvent(t,r);if(!i){var s=e[n];i=s&&s.listeners&&s.listeners[t]}if(!i)return;for(var o=i.length-1;o>=0;o--){if(!i[o]||i[o][3]===!0)continue;var u=i[o][0],f=i[o][1],l=i[o][2];l&&a(e,t,u,f),u||(u=e),"string"==typeof f&&(f=u[f]),r?f.apply(u,r):f.call(u)}return!0}function p(e,t){var r=e[n],i=r&&r.listeners&&r.listeners[t];return!!i&&!!i.length}function d(e,t){var r=[],i=e[n],s=i&&i.listeners&&i.listeners[t];if(!s)return r;for(var o=0,u=s.length;o<u;o++){var a=s[o][0],f=s[o][1];r.push([a,f])}return r}var e=Ember.create,t=Ember.meta,n=Ember.META_KEY;Ember.addListener=u,Ember.removeListener=a,Ember._suspendListener=f,Ember._suspendListeners=l,Ember.sendEvent=h,Ember.hasListeners=p,Ember.watchedEvents=c,Ember.listenersFor=d,Ember.listenersDiff=o,Ember.listenersUnion=s}(),function(){var e=Ember.guidFor,t=Ember.sendEvent,n=Ember._ObserverSet=function(){this.clear()};n.prototype.add=function(t,n,r){var i=this.observerSet,s=this.observers,o=e(t),u=i[o],a;return u||(i[o]=u={}),a=u[n],a===undefined&&(a=s.push({sender:t,keyName:n,eventName:r,listeners:[]})-1,u[n]=a),s[a].listeners},n.prototype.flush=function(){var e=this.observers,n,r,i,s;this.clear();for(n=0,r=e.length;n<r;++n){i=e[n],s=i.sender;if(s.isDestroying||s.isDestroyed)continue;t(s,i.eventName,[s,i.keyName],i.listeners)}},n.prototype.clear=function(){this.observerSet={},this.observers=[]}}(),function(){function d(e,t,n){if(e.isDestroying)return;var r=h,i=!r;i&&(r=h={}),m(l,e,t,r,n),i&&(h=null)}function v(e,t,n){if(e.isDestroying)return;var r=p,i=!r;i&&(r=p={}),m(c,e,t,r,n),i&&(p=null)}function m(e,n,r,i,s){var o=t(n);i[o]||(i[o]={});if(i[o][r])return;i[o][r]=!0;var u=s.deps;u=u&&u[r];if(u)for(var a in u){var f=s.descs[a];if(f&&f._suspended===n)continue;e(n,a)}}var e=Ember.meta,t=Ember.guidFor,n=Ember.tryFinally,r=Ember.sendEvent,i=Ember.listenersUnion,s=Ember.listenersDiff,o=Ember._ObserverSet,u=new o,a=new o,f=0,l=Ember.propertyWillChange=function(t,n){var r=e(t,!1),i=r.watching[n]>0||n==="length",s=r.proto,o=r.descs[n];if(!i)return;if(s===t)return;o&&o.willChange&&o.willChange(t,n),d(t,n,r),g(t,n,r),S(t,n)},c=Ember.propertyDidChange=function(t,n){var r=e(t,!1),i=r.watching[n]>0||n==="length",s=r.proto,o=r.descs[n];if(s===t)return;o&&o.didChange&&o.didChange(t,n);if(!i&&n!=="length")return;v(t,n,r),y(t,n,r),x(t,n)},h,p,g=function(e,t,n,r){if(!n.hasOwnProperty("chainWatchers"))return;var i=n.chainWatchers;i=i[t];if(!i)return;for(var s=0,o=i.length;s<o;s++)i[s].willChange(r)},y=function(e,t,n,r){if(!n.hasOwnProperty("chainWatchers"))return;var i=n.chainWatchers;i=i[t];if(!i)return;for(var s=i.length-1;s>=0;s--)i[s].didChange(r)};Ember.overrideChains=function(e,t,n){y(e,t,n,!0)};var b=Ember.beginPropertyChanges=function(){f++},w=Ember.endPropertyChanges=function(){f--,f<=0&&(u.clear(),a.flush())},E=Ember.changeProperties=function(e,t){b(),n(e,w,t)},S=function(e,t){if(e.isDestroying)return;var n=t+":before",i,o;f?(i=u.add(e,t,n),o=s(e,n,i),r(e,n,[e,t],o)):r(e,n,[e,t])},x=function(e,t){if(e.isDestroying)return;var n=t+":change",s;f?(s=a.add(e,t,n),i(e,n,s)):r(e,n,[e,t])}}(),function(){function u(e,t,n,r){var i;i=t.slice(t.lastIndexOf(".")+1),t=t.slice(0,t.length-(i.length+1)),t!=="this"&&(e=s(e,t));if(!i||i.length===0)throw new Error("You passed an empty path");if(!e){if(r)return;throw new Error("Object in path "+t+" could not be found or was destroyed.")}return o(e,i,n)}var e=Ember.META_KEY,t=Ember.ENV.MANDATORY_SETTER,n=/^([A-Z$]|([0-9][A-Z$]))/,r=Ember.propertyWillChange,i=Ember.propertyDidChange,s=Ember._getPath,o=function(r,i,s,o){typeof r=="string"&&(s=i,i=r,r=null);if(!r||i.indexOf(".")!==-1)return u(r,i,s,o);var a=r[e],f=a&&a.descs[i],l,c;return f?f.set(r,i,s):(l="object"==typeof r&&!(i in r),l&&"function"==typeof r.setUnknownProperty?r.setUnknownProperty(i,s):a&&a.watching[i]>0?(t?c=a.values[i]:c=r[i],s!==c&&(Ember.propertyWillChange(r,i),t?c!==undefined||i in r?a.values[i]=s:Ember.defineProperty(r,i,null,s):r[i]=s,Ember.propertyDidChange(r,i))):r[i]=s),s};Ember.config.overrideAccessors&&(Ember.set=o,Ember.config.overrideAccessors(),o=Ember.set),Ember.set=o,Ember.setPath=Ember.deprecateFunc("setPath is deprecated since set now supports paths",Ember.set),Ember.trySet=function(e,t,n){return o(e,t,n,!0)},Ember.trySetPath=Ember.deprecateFunc("trySetPath has been renamed to trySet",Ember.trySet)}(),function(){var e=Ember.META_KEY,t=Ember.meta,n=Ember.platform.defineProperty,r=Ember.ENV.MANDATORY_SETTER,i=Ember.Descriptor=function(){},s=Ember.MANDATORY_SETTER_FUNCTION=function(e){},o=Ember.DEFAULT_GETTER_FUNCTION=function(t){return function(){var n=this[e];return n&&n.values[t]}};Ember.defineProperty=function(e,i,u,a,f){var l,c,h,p;return f||(f=t(e)),l=f.descs,c=f.descs[i],h=f.watching[i]>0,c instanceof Ember.Descriptor&&c.teardown(e,i),u instanceof Ember.Descriptor?(p=u,l[i]=u,r&&h?n(e,i,{configurable:!0,enumerable:!0,writable:!0,value:undefined}):e[i]=undefined,u.setup(e,i)):(l[i]=undefined,u==null?(p=a,r&&h?(f.values[i]=a,n(e,i,{configurable:!0,enumerable:!0,set:s,get:o(i)})):e[i]=a):(p=u,n(e,i,u))),h&&Ember.overrideChains(e,i,f),e.didDefineProperty&&e.didDefineProperty(e,i,p),this}}(),function(){var e=Ember.changeProperties,t=Ember.set;Ember.setProperties=function(n,r){return e(function(){for(var e in r)r.hasOwnProperty(e)&&t(n,e,r[e])}),n}}(),function(){var e=Ember.meta,t=Ember.typeOf,n=Ember.ENV.MANDATORY_SETTER,r=Ember.platform.defineProperty;Ember.watchKey=function(i,s){if(s==="length"&&t(i)==="array")return;var o=e(i),u=o.watching,a;u[s]?u[s]=(u[s]||0)+1:(u[s]=1,a=o.descs[s],a&&a.willWatch&&a.willWatch(i,s),"function"==typeof i.willWatchProperty&&i.willWatchProperty(s),n&&s in i&&(o.values[s]=i[s],r(i,s,{configurable:!0,enumerable:!0,set:Ember.MANDATORY_SETTER_FUNCTION,get:Ember.DEFAULT_GETTER_FUNCTION(s)})))},Ember.unwatchKey=function(t,i){var s=e(t),o=s.watching,u;o[i]===1?(o[i]=0,u=s.descs[i],u&&u.didUnwatch&&u.didUnwatch(t,i),"function"==typeof t.didUnwatchProperty&&t.didUnwatchProperty(i),n&&i in t&&(r(t,i,{configurable:!0,enumerable:!0,writable:!0,value:s.values[i]}),delete s.values[i])):o[i]>1&&o[i]--}}(),function(){function l(e){return e.match(f)[0]}function h(t,n,r){if(!t||"object"!=typeof t)return;var i=e(t),o=i.chainWatchers;i.hasOwnProperty("chainWatchers")||(o=i.chainWatchers={}),o[n]||(o[n]=[]),o[n].push(r),s(t,n)}function d(t){return e(t,!1).proto===t}var e=Ember.meta,t=Ember.get,n=Ember.normalizeTuple,r=Ember.ArrayPolyfills.forEach,i=Ember.warn,s=Ember.watchKey,o=Ember.unwatchKey,u=Ember.propertyWillChange,a=Ember.propertyDidChange,f=/^([^\.\*]+)/,c=[];Ember.flushPendingChains=function(){if(c.length===0)return;var e=c;c=[],r.call(e,function(e){e[0].add(e[1])}),i("Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos",c.length===0)};var p=Ember.removeChainWatcher=function(t,n,r){if(!t||"object"!=typeof t)return;var i=e(t,!1);if(!i.hasOwnProperty("chainWatchers"))return;var s=i.chainWatchers;if(s[n]){s=s[n];for(var u=0,a=s.length;u<a;u++)s[u]===r&&s.splice(u,1)}o(t,n)},v=Ember._ChainNode=function(e,t,n){var r;this._parent=e,this._key=t,this._watching=n===undefined,this._value=n,this._paths={},this._watching&&(this._object=e.value(),this._object&&h(this._object,this._key,this)),this._parent&&this._parent._key==="@each"&&this.value()},m=v.prototype;m.value=function(){if(this._value===undefined&&this._watching){var e=this._parent.value();this._value=e&&!d(e)?t(e,this._key):undefined}return this._value},m.destroy=function(){if(this._watching){var e=this._object;e&&p(e,this._key,this),this._watching=!1}},m.copy=function(e){var t=new v(null,null,e),n=this._paths,r;for(r in n){if(n[r]<=0)continue;t.add(r)}return t},m.add=function(e){var t,r,i,s,o;o=this._paths,o[e]=(o[e]||0)+1,t=this.value(),r=n(t,e);if(r[0]&&r[0]===t)e=r[1],i=l(e),e=e.slice(i.length+1);else{if(!r[0]){c.push([this,e]),r.length=0;return}s=r[0],i=e.slice(0,0-(r[1].length+1)),e=r[1]}r.length=0,this.chain(i,e,s)},m.remove=function(e){var t,r,i,s,o;o=this._paths,o[e]>0&&o[e]--,t=this.value(),r=n(t,e),r[0]===t?(e=r[1],i=l(e),e=e.slice(i.length+1)):(s=r[0],i=e.slice(0,0-(r[1].length+1)),e=r[1]),r.length=0,this.unchain(i,e)},m.count=0,m.chain=function(e,t,n){var r=this._chains,i;r||(r=this._chains={}),i=r[e],i||(i=r[e]=new v(this,e,n)),i.count++,t&&t.length>0&&(e=l(t),t=t.slice(e.length+1),i.chain(e,t))},m.unchain=function(e,t){var n=this._chains,r=n[e];t&&t.length>1&&(e=l(t),t=t.slice(e.length+1),r.unchain(e,t)),r.count--,r.count<=0&&(delete n[r._key],r.destroy())},m.willChange=function(){var e=this._chains;if(e)for(var t in e){if(!e.hasOwnProperty(t))continue;e[t].willChange()}this._parent&&this._parent.chainWillChange(this,this._key,1)},m.chainWillChange=function(e,t,n){this._key&&(t=this._key+"."+t),this._parent?this._parent.chainWillChange(this,t,n+1):(n>1&&u(this.value(),t),t="this."+t,this._paths[t]>0&&u(this.value(),t))},m.chainDidChange=function(e,t,n){this._key&&(t=this._key+"."+t),this._parent?this._parent.chainDidChange(this,t,n+1):(n>1&&a(this.value(),t),t="this."+t,this._paths[t]>0&&a(this.value(),t))},m.didChange=function(e){if(this._watching){var t=this._parent.value();t!==this._object&&(p(this._object,this._key,this),this._object=t,h(t,this._key,this)),this._value=undefined,this._parent&&this._parent._key==="@each"&&this.value()}var n=this._chains;if(n)for(var r in n){if(!n.hasOwnProperty(r))continue;n[r].didChange(e)}if(e)return;this._parent&&this._parent.chainDidChange(this,this._key,1)},Ember.finishChains=function(t){var n=e(t,!1),r=n.chains;r&&(r.value()!==t&&(n.chains=r=r.copy(t)),r.didChange(!0))}}(),function(){function r(t){var r=e(t),i=r.chains;return i?i.value()!==t&&(i=r.chains=i.copy(t)):i=r.chains=new n(null,null,t),i}var e=Ember.meta,t=Ember.typeOf,n=Ember._ChainNode;Ember.watchPath=function(n,i){if(i==="length"&&t(n)==="array")return;var s=e(n),o=s.watching;o[i]?o[i]=(o[i]||0)+1:(o[i]=1,r(n).add(i))},Ember.unwatchPath=function(t,n){var i=e(t),s=i.watching,o;s[n]===1?(s[n]=0,r(t).remove(n)):s[n]>1&&s[n]--}}(),function(){function c(e){return e==="*"||!l.test(e)}var e=Ember.meta,t=Ember.GUID_KEY,n=Ember.META_KEY,r=Ember.removeChainWatcher,i=Ember.watchKey,s=Ember.unwatchKey,o=Ember.watchPath,u=Ember.unwatchPath,a=Ember.typeOf,f=Ember.generateGuid,l=/[\.\*]/;Ember.watch=function(e,t){if(t==="length"&&a(e)==="array")return;c(t)?i(e,t):o(e,t)},Ember.isWatching=function(t,r){var i=t[n];return(i&&i.watching[r])>0},Ember.watch.flushPending=Ember.flushPendingChains,Ember.unwatch=function(e,t){if(t==="length"&&a(e)==="array")return;c(t)?s(e,t):u(e,t)},Ember.rewatch=function(n){var r=e(n,!1),i=r.chains;t in n&&!n.hasOwnProperty(t)&&f(n,"ember"),i&&i.value()!==n&&(r.chains=i.copy(n))};var h=[];Ember.destroy=function(e){var t=e[n],i,s,o,u;if(t){e[n]=null,i=t.chains;if(i){h.push(i);while(h.length>0){i=h.pop(),s=i._chains;if(s)for(o in s)s.hasOwnProperty(o)&&h.push(s[o]);i._watching&&(u=i._object,u&&r(u,i._key,i))}}}}}(),function(){function a(e,t,n){var r=t[n];return r?t.hasOwnProperty(n)||(r=t[n]=i(r)):r=t[n]={},r}function f(e,t){return a(e,t,"deps")}function l(e,t,n,r){var i=e._dependentKeys,s,u,l,c,h;if(!i)return;s=f(t,r);for(u=0,l=i.length;u<l;u++)c=i[u],h=a(t,s,c),h[n]=(h[n]||0)+1,o(t,c)}function c(e,t,n,r){var i=e._dependentKeys,s,o,l,c,h;if(!i)return;s=f(t,r);for(o=0,l=i.length;o<l;o++)c=i[o],h=a(t,s,c),h[n]=(h[n]||0)-1,u(t,c)}function h(e,t){this.func=e,this._cacheable=t&&t.cacheable!==undefined?t.cacheable:!0,this._dependentKeys=t&&t.dependentKeys,this._readOnly=t&&(t.readOnly!==undefined||!!t.readOnly)}function d(t,n){var r={};for(var i=0;i<n.length;i++)r[n[i]]=e(t,n[i]);return r}function v(e,t){Ember.computed[e]=function(e){var n=r.call(arguments);return Ember.computed(e,function(){return t.apply(this,n)})}}function m(e,t){Ember.computed[e]=function(){var e=r.call(arguments),n=Ember.computed(function(){return t.apply(this,[d(this,e)])});return n.property.apply(n,e)}}var e=Ember.get,t=Ember.set,n=Ember.meta,r=[].slice,i=Ember.create,s=Ember.META_KEY,o=Ember.watch,u=Ember.unwatch;Ember.ComputedProperty=h,h.prototype=new Ember.Descriptor;var p=h.prototype;p.cacheable=function(e){return this._cacheable=e!==!1,this},p.volatile=function(){return this.cacheable(!1)},p.readOnly=function(e){return this._readOnly=e===undefined||!!e,this},p.property=function(){var e=[];for(var t=0,n=arguments.length;t<n;t++)e.push(arguments[t]);return this._dependentKeys=e,this},p.meta=function(e){return arguments.length===0?this._meta||{}:(this._meta=e,this)},p.willWatch=function(e,t){var n=e[s];t in n.cache||l(this,e,t,n)},p.didUnwatch=function(e,t){var n=e[s];t in n.cache||c(this,e,t,n)},p.didChange=function(e,t){if(this._cacheable&&this._suspended!==e){var r=n(e);t in r.cache&&(delete r.cache[t],r.watching[t]||c(this,e,t,r))}},p.get=function(e,t){var r,i,s;if(this._cacheable){s=n(e),i=s.cache;if(t in i)return i[t];r=i[t]=this.func.call(e,t),s.watching[t]||l(this,e,t,s)}else r=this.func.call(e,t);return r},p.set=function(e,t,r){var i=this._cacheable,s=this.func,o=n(e,i),u=o.watching[t],a=this._suspended,f=!1,c=o.cache,h,p;if(this._readOnly)throw new Error("Cannot Set: "+t+" on: "+e.toString());this._suspended=e;try{i&&c.hasOwnProperty(t)&&(h=c[t],f=!0),s.wrappedFunction&&(s=s.wrappedFunction);if(s.length===3)p=s.call(e,t,r,h);else{if(s.length!==2){Ember.defineProperty(e,t,null,h),Ember.set(e,t,r);return}p=s.call(e,t,r)}if(f&&h===p)return;u&&Ember.propertyWillChange(e,t),f&&delete c[t],i&&(!u&&!f&&l(this,e,t,o),c[t]=p),u&&Ember.propertyDidChange(e,t)}finally{this._suspended=a}return p},p.setup=function(e,t){var r=e[s];r&&r.watching[t]&&l(this,e,t,n(e))},p.teardown=function(e,t){var r=n(e);return(r.watching[t]||t in r.cache)&&c(this,e,t,r),this._cacheable&&delete r.cache[t],null},Ember.computed=function(e){var t;arguments.length>1&&(t=r.call(arguments,0,-1),e=r.call(arguments,-1)[0]);if(typeof e!="function")throw new Error("Computed Property declared without a property function");var n=new h(e);return t&&n.property.apply(n,t),n},Ember.cacheFor=function(t,r){var i=n(t,!1).cache;if(i&&r in i)return i[r]},v("empty",function(t){return Ember.isEmpty(e(this,t))}),v("notEmpty",function(t){return!Ember.isEmpty(e(this,t))}),v("none",function(t){return Ember.isNone(e(this,t))}),v("not",function(t){return!e(this,t)}),v("bool",function(t){return!!e(this,t)}),v("match",function(t,n){var r=e(this,t);return typeof r=="string"?!!r.match(n):!1}),v("equal",function(t,n){return e(this,t)===n}),v("gt",function(t,n){return e(this,t)>n}),v("gte",function(t,n){return e(this,t)>=n}),v("lt",function(t,n){return e(this,t)<n}),v("lte",function(t,n){return e(this,t)<=n}),m("and",function(e){for(var t in e)if(e.hasOwnProperty(t)&&!e[t])return!1;return!0}),m("or",function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!0;return!1}),m("any",function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return e[t];return null}),m("map",function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&(Ember.isNone(e[n])?t.push(null):t.push(e[n]));return t}),Ember.computed.alias=function(n){return Ember.computed(n,function(r,i){return arguments.length>1?(t(this,n,i),i):e(this,n)})},Ember.computed.defaultTo=function(t){return Ember.computed(function(n,r,i){var s;return arguments.length===1?i!=null?i:e(this,t):r!=null?r:e(this,t)})}}(),function(){function r(t){return t+e}function i(e){return e+t}var e=":change",t=":before",n=Ember.guidFor;Ember.addObserver=function(e,t,n,i){return Ember.addListener(e,r(t),n,i),Ember.watch(e,t),this},Ember.observersFor=function(e,t){return Ember.listenersFor(e,r(t))},Ember.removeObserver=function(e,t,n,i){return Ember.unwatch(e,t),Ember.removeListener(e,r(t),n,i),this},Ember.addBeforeObserver=function(e,t,n,r){return Ember.addListener(e,i(t),n,r),Ember.watch(e,t),this},Ember._suspendBeforeObserver=function(e,t,n,r,s){return Ember._suspendListener(e,i(t),n,r,s)},Ember._suspendObserver=function(e,t,n,i,s){return Ember._suspendListener(e,r(t),n,i,s)};var s=Ember.ArrayPolyfills.map;Ember._suspendBeforeObservers=function(e,t,n,r,o){var u=s.call(t,i);return Ember._suspendListeners(e,u,n,r,o)},Ember._suspendObservers=function(e,t,n,i,o){var u=s.call(t,r);return Ember._suspendListeners(e,u,n,i,o)},Ember.beforeObserversFor=function(e,t){return Ember.listenersFor(e,i(t))},Ember.removeBeforeObserver=function(e,t,n,r){return Ember.unwatch(e,t),Ember.removeListener(e,i(t),n,r),this}}(),function(){function n(t,n,r,i){return n===undefined&&(n=t,t=undefined),"string"==typeof n&&(n=t[n]),r&&i>0&&(r=r.length>i?e.call(r,i):null),Ember.handleErrors(function(){return n.apply(t||this,r||[])},this)}function u(){o=null,s.currentRunLoop&&s.end()}function c(){f=null,s(function(){var e=+(new Date),t=-1;for(var r in a){if(!a.hasOwnProperty(r))continue;var i=a[r];if(i&&i.expires)if(e>=i.expires)delete a[r],n(i.target,i.method,i.args,2);else if(t<0||i.expires<t)t=i.expires}t>0&&(f=setTimeout(c,t-e),l=t)})}function h(e,t){t[this.tguid]&&delete t[this.tguid][this.mguid],a[e]&&n(this.target,this.method,this.args),delete a[e]}function p(e,t,n,r){var i=Ember.guidFor(t),o=Ember.guidFor(n),u=s.autorun().onceTimers,f=u[i]&&u[i][o],l;return f&&a[f]?a[f].args=r:(l={target:t,method:n,args:r,tguid:i,mguid:o},f=Ember.guidFor(l),a[f]=l,u[i]||(u[i]={}),u[i][o]=f,s.schedule(e,l,h,f,u)),f}var e=[].slice,t=Ember.ArrayPolyfills
16
+ .forEach,r,i=function(e){this._prev=e||null,this.onceTimers={}};i.prototype={end:function(){this.flush()},prev:function(){return this._prev},schedule:function(t,n,r){var i=this._queues,s;i||(i=this._queues={}),s=i[t],s||(s=i[t]=[]);var o=arguments.length>3?e.call(arguments,3):null;return s.push({target:n,method:r,args:o}),this},flush:function(e){function f(e){n(e.target,e.method,e.args)}function l(){t.call(u,f)}var i,s,o,u,a;if(!this._queues)return this;Ember.watch.flushPending();if(e)while(this._queues&&(u=this._queues[e]))this._queues[e]=null,e==="sync"?(a=Ember.LOG_BINDINGS,a&&Ember.Logger.log("Begin: Flush Sync Queue"),Ember.beginPropertyChanges(),Ember.tryFinally(l,Ember.endPropertyChanges),a&&Ember.Logger.log("End: Flush Sync Queue")):t.call(u,f);else{i=Ember.run.queues,o=i.length,s=0;e:while(s<o){e=i[s],u=this._queues&&this._queues[e],delete this._queues[e],u&&(e==="sync"?(a=Ember.LOG_BINDINGS,a&&Ember.Logger.log("Begin: Flush Sync Queue"),Ember.beginPropertyChanges(),Ember.tryFinally(l,Ember.endPropertyChanges),a&&Ember.Logger.log("End: Flush Sync Queue")):t.call(u,f));for(var c=0;c<=s;c++)if(this._queues&&this._queues[i[c]]){s=c;continue e}s++}}return r=null,this}},Ember.RunLoop=i,Ember.run=function(e,t){function i(){if(e||t)return n(e,t,r,2)}var r=arguments;return s.begin(),Ember.tryFinally(i,s.end)};var s=Ember.run;Ember.run.begin=function(){s.currentRunLoop=new i(s.currentRunLoop)},Ember.run.end=function(){function e(){s.currentRunLoop.end()}function t(){s.currentRunLoop=s.currentRunLoop.prev()}Ember.tryFinally(e,t)},Ember.run.queues=["sync","actions","destroy"],Ember.run.schedule=function(e,t,n){var r=s.autorun();r.schedule.apply(r,arguments)};var o;Ember.run.hasScheduledTimers=function(){return!!o||!!f},Ember.run.cancelTimers=function(){o&&(clearTimeout(o),o=null),f&&(clearTimeout(f),f=null),a={}},Ember.run.autorun=function(){return s.currentRunLoop||(s.begin(),o||(o=setTimeout(u,1))),s.currentRunLoop},Ember.run.sync=function(){s.autorun(),s.currentRunLoop.flush("sync")};var a={},f,l;Ember.run.later=function(t,n){var r,i,s,o,u;return arguments.length===2&&"function"==typeof t?(u=n,n=t,t=undefined,r=[t,n]):(r=e.call(arguments),u=r.pop()),i=+(new Date)+u,s={target:t,method:n,expires:i,args:r},o=Ember.guidFor(s),a[o]=s,f&&i<l&&(clearTimeout(f),f=null),f||(f=setTimeout(c,u),l=i),o},Ember.run.once=function(t,n){return p("actions",t,n,e.call(arguments,2))},Ember.run.scheduleOnce=function(t,n,r,i){return p(t,n,r,e.call(arguments,3))},Ember.run.next=function(){var t=e.call(arguments);return t.push(1),s.later.apply(this,t)},Ember.run.cancel=function(e){delete a[e]}}(),function(){function s(t,n){return e(i(n)?Ember.lookup:t,n)}function u(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}Ember.LOG_BINDINGS=!!Ember.ENV.LOG_BINDINGS;var e=Ember.get,t=Ember.set,n=Ember.guidFor,r=/^([A-Z$]|([0-9][A-Z$]))/,i=Ember.isGlobalPath=function(e){return r.test(e)},o=function(e,t){this._direction="fwd",this._from=t,this._to=e,this._directionMap=Ember.Map.create()};o.prototype={copy:function(){var e=new o(this._to,this._from);return this._oneWay&&(e._oneWay=!0),e},from:function(e){return this._from=e,this},to:function(e){return this._to=e,this},oneWay:function(){return this._oneWay=!0,this},toString:function(){var e=this._oneWay?"[oneWay]":"";return"Ember.Binding<"+n(this)+">("+this._from+" -> "+this._to+")"+e},connect:function(e){var t=this._from,n=this._to;return Ember.trySet(e,n,s(e,t)),Ember.addObserver(e,t,this,this.fromDidChange),this._oneWay||Ember.addObserver(e,n,this,this.toDidChange),this._readyToSync=!0,this},disconnect:function(e){var t=!this._oneWay;return Ember.removeObserver(e,this._from,this,this.fromDidChange),t&&Ember.removeObserver(e,this._to,this,this.toDidChange),this._readyToSync=!1,this},fromDidChange:function(e){this._scheduleSync(e,"fwd")},toDidChange:function(e){this._scheduleSync(e,"back")},_scheduleSync:function(e,t){var n=this._directionMap,r=n.get(e);r||(Ember.run.schedule("sync",this,this._sync,e),n.set(e,t)),r==="back"&&t==="fwd"&&n.set(e,"fwd")},_sync:function(t){var n=Ember.LOG_BINDINGS;if(t.isDestroyed||!this._readyToSync)return;var r=this._directionMap,i=r.get(t),o=this._from,u=this._to;r.remove(t);if(i==="fwd"){var a=s(t,this._from);n&&Ember.Logger.log(" ",this.toString(),"->",a,t),this._oneWay?Ember.trySet(t,u,a):Ember._suspendObserver(t,u,this,this.toDidChange,function(){Ember.trySet(t,u,a)})}else if(i==="back"){var f=e(t,this._to);n&&Ember.Logger.log(" ",this.toString(),"<-",f,t),Ember._suspendObserver(t,o,this,this.fromDidChange,function(){Ember.trySet(Ember.isGlobalPath(o)?Ember.lookup:t,o,f)})}}},u(o,{from:function(){var e=this,t=new e;return t.from.apply(t,arguments)},to:function(){var e=this,t=new e;return t.to.apply(t,arguments)},oneWay:function(e,t){var n=this,r=new n(null,e);return r.oneWay(t)}}),Ember.Binding=o,Ember.bind=function(e,t,n){return(new Ember.Binding(t,n)).connect(e)},Ember.oneWay=function(e,t,n){return(new Ember.Binding(t,n)).oneWay().connect(e)}}(),function(){function l(e){var t=Ember.meta(e,!0),n=t.mixins;return n?t.hasOwnProperty("mixins")||(n=t.mixins=u(n)):n=t.mixins={},n}function c(t,n){return n&&n.length>0&&(t.mixins=r.call(n,function(t){if(t instanceof e)return t;var n=new e;return n.properties=t,n})),t}function h(e){return"function"==typeof e&&e.isMethod!==!1&&e!==Boolean&&e!==Object&&e!==Number&&e!==Array&&e!==Date&&e!==String}function d(t,n){var r;return n instanceof e?(r=f(n),t[r]?p:(t[r]=n,n.properties)):n}function v(e,t,n){var r;return r=t.concatenatedProperties||n.concatenatedProperties,e.concatenatedProperties&&(r=r?r.concat(e.concatenatedProperties):e.concatenatedProperties),r}function m(e,t,n,r,i){var s;return r[t]===undefined&&(s=i[t]),s=s||e.descs[t],!!s&&s instanceof Ember.ComputedProperty?(n=u(n),n.func=Ember.wrap(n.func,s.func),n):n}function g(e,t,n,r,i){var s;return i[t]===undefined&&(s=r[t]),s=s||e[t],"function"!=typeof s?n:Ember.wrap(n,s)}function y(e,t,n,r){var i=r[t]||e[t];return i?"function"==typeof i.concat?i.concat(n):Ember.makeArray(i).concat(n):Ember.makeArray(n)}function b(e,n,r,s,o,u,a){if(r instanceof Ember.Descriptor){if(r===t&&o[n])return p;r.func&&(r=m(s,n,r,u,o)),o[n]=r,u[n]=undefined}else{if(h(r))r=g(e,n,r,u,o);else if(a&&i.call(a,n)>=0||n==="concatenatedProperties")r=y(e,n,r,u);o[n]=undefined,u[n]=r}}function w(e,t,n,r,i,o){function h(e){delete n[e],delete r[e]}var u,a,f,l,c;for(var m=0,g=e.length;m<g;m++){u=e[m],a=d(t,u);if(a===p)continue;if(a){c=Ember.meta(i),l=v(a,r,i);for(f in a){if(!a.hasOwnProperty(f))continue;o.push(f),b(i,f,a[f],c,n,r,l)}a.hasOwnProperty("toString")&&(i.toString=a.toString)}else u.mixins&&(w(u.mixins,t,n,r,i,o),u._without&&s.call(u._without,h))}}function E(e){var t=Ember.meta(e),n=t.required;if(!n||!t.hasOwnProperty("required"))n=t.required=n?u(n):{};return n}function x(e,t,n,r){if(S.test(t)){var i=r.bindings;i?r.hasOwnProperty("bindings")||(i=r.bindings=u(r.bindings)):i=r.bindings={},i[t]=n}}function T(e,t){var n=t.bindings,r,i,s;if(n){for(r in n)i=n[r],i&&(s=r.slice(0,-7),i instanceof Ember.Binding?(i=i.copy(),i.to(s)):i=new Ember.Binding(s,i),i.connect(e),e[r]=i);t.bindings={}}}function N(e,t){return T(e,t||Ember.meta(e)),e}function C(e,t,n,r,i){var s=t.methodName,o;return r[s]||i[s]?(o=i[s],t=r[s]):n.descs[s]?(t=n.descs[s],o=undefined):(t=undefined,o=e[s]),{desc:t,value:o}}function k(e,t,n,r,i){if("function"!=typeof n)return;var s=n[r];if(s)for(var o=0,u=s.length;o<u;o++)Ember[i](e,s[o],null,t)}function L(e,t,n){var r=e[t];k(e,t,r,"__ember_observesBefore__","removeBeforeObserver"),k(e,t,r,"__ember_observes__","removeObserver"),k(e,t,n,"__ember_observesBefore__","addBeforeObserver"),k(e,t,n,"__ember_observes__","addObserver")}function A(e,r,i){var s={},o={},u=Ember.meta(e),f,c,h,p=[];w(r,l(e),s,o,e,p);for(var d=0,v=p.length;d<v;d++){f=p[d];if(f==="constructor"||!o.hasOwnProperty(f))continue;h=s[f],c=o[f];if(h===t)continue;while(h&&h instanceof n){var m=C(e,h,u,s,o);h=m.desc,c=m.value}if(h===undefined&&c===undefined)continue;L(e,f,c),x(e,f,c,u),a(e,f,h,c,u)}return i||N(e,u),e}function M(e,t,n){var r=f(e);if(n[r])return!1;n[r]=!0;if(e===t)return!0;var i=e.mixins,s=i?i.length:0;while(--s>=0)if(M(i[s],t,n))return!0;return!1}function _(e,t,n){if(n[f(t)])return;n[f(t)]=!0;if(t.properties){var r=t.properties;for(var i in r)r.hasOwnProperty(i)&&(e[i]=!0)}else t.mixins&&s.call(t.mixins,function(t){_(e,t,n)})}var e,t,n,r=Ember.ArrayPolyfills.map,i=Ember.ArrayPolyfills.indexOf,s=Ember.ArrayPolyfills.forEach,o=[].slice,u=Ember.create,a=Ember.defineProperty,f=Ember.guidFor,p={},S=Ember.IS_BINDING=/^.+Binding$/;Ember.mixin=function(e){var t=o.call(arguments,1);return A(e,t,!1),e},Ember.Mixin=function(){return c(this,arguments)},e=Ember.Mixin,e.prototype={properties:null,mixins:null,ownerConstructor:null},e._apply=A,e.applyPartial=function(e){var t=o.call(arguments,1);return A(e,t,!0)},e.finishPartial=N,Ember.anyUnprocessedMixins=!1,e.create=function(){Ember.anyUnprocessedMixins=!0;var e=this;return c(new e,arguments)};var O=e.prototype;O.reopen=function(){var t,n;this.properties?(t=e.create(),t.properties=this.properties,delete this.properties,this.mixins=[t]):this.mixins||(this.mixins=[]);var r=arguments.length,i=this.mixins,s;for(s=0;s<r;s++)t=arguments[s],t instanceof e?i.push(t):(n=e.create(),n.properties=t,i.push(n));return this},O.apply=function(e){return A(e,[this],!1)},O.applyPartial=function(e){return A(e,[this],!0)},O.detect=function(t){if(!t)return!1;if(t instanceof e)return M(t,this,{});var n=Ember.meta(t,!1).mixins;return n?!!n[f(this)]:!1},O.without=function(){var t=new e(this);return t._without=o.call(arguments),t},O.keys=function(){var e={},t={},n=[];_(e,this,t);for(var r in e)e.hasOwnProperty(r)&&n.push(r);return n},e.mixins=function(e){var t=Ember.meta(e,!1).mixins,n=[];if(!t)return n;for(var r in t){var i=t[r];i.properties||n.push(i)}return n},t=new Ember.Descriptor,t.toString=function(){return"(Required Property)"},Ember.required=function(){return t},n=function(e){this.methodName=e},n.prototype=new Ember.Descriptor,Ember.alias=function(e){return new n(e)},Ember.deprecateFunc("Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead.",Ember.alias),Ember.aliasMethod=function(e){return new n(e)},Ember.observer=function(e){var t=o.call(arguments,1);return e.__ember_observes__=t,e},Ember.immediateObserver=function(){for(var e=0,t=arguments.length;e<t;e++)var n=arguments[e];return Ember.observer.apply(this,arguments)},Ember.beforeObserver=function(e){var t=o.call(arguments,1);return e.__ember_observesBefore__=t,e}}(),function(){}(),function(){e("rsvp",[],function(){"use strict";function d(e,t){n.async(function(){e.trigger("promise:resolved",{detail:t}),e.isResolved=!0,e.resolvedValue=t})}function v(e,t){n.async(function(){e.trigger("promise:failed",{detail:t}),e.isRejected=!0,e.rejectedValue=t})}function m(e){var t,n=[],r=new c,i=e.length;i===0&&r.resolve([]);var s=function(e){return function(t){o(e,t)}},o=function(e,t){n[e]=t,--i===0&&r.resolve(n)},u=function(e){r.reject(e)};for(t=0;t<i;t++)e[t].then(s(t),u);return r}var e=typeof window!="undefined"?window:{},t=e.MutationObserver||e.WebKitMutationObserver,n,r;if(typeof process!="undefined"&&{}.toString.call(process)==="[object process]")r=function(e,t){process.nextTick(function(){e.call(t)})};else if(t){var i=[],s=new t(function(){var e=i.slice();i=[],e.forEach(function(e){var t=e[0],n=e[1];t.call(n)})}),o=document.createElement("div");s.observe(o,{attributes:!0}),window.addEventListener("unload",function(){s.disconnect(),s=null}),r=function(e,t){i.push([e,t]),o.setAttribute("drainQueue","drainQueue")}}else r=function(e,t){setTimeout(function(){e.call(t)},1)};var u=function(e,t){this.type=e;for(var n in t){if(!t.hasOwnProperty(n))continue;this[n]=t[n]}},a=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n][0]===t)return n;return-1},f=function(e){var t=e._promiseCallbacks;return t||(t=e._promiseCallbacks={}),t},l={mixin:function(e){return e.on=this.on,e.off=this.off,e.trigger=this.trigger,e},on:function(e,t,n){var r=f(this),i,s;e=e.split(/\s+/),n=n||this;while(s=e.shift())i=r[s],i||(i=r[s]=[]),a(i,t)===-1&&i.push([t,n])},off:function(e,t){var n=f(this),r,i,s;e=e.split(/\s+/);while(i=e.shift()){if(!t){n[i]=[];continue}r=n[i],s=a(r,t),s!==-1&&r.splice(s,1)}},trigger:function(e,t){var n=f(this),r,i,s,o,a;if(r=n[e])for(var l=0;l<r.length;l++)i=r[l],s=i[0],o=i[1],typeof t!="object"&&(t={detail:t}),a=new u(e,t),s.call(o,a)}},c=function(){this.on("promise:resolved",function(e){this.trigger("success",{detail:e.detail})},this),this.on("promise:failed",function(e){this.trigger("error",{detail:e.detail})},this)},h=function(){},p=function(e,t,n,r){var i=typeof n=="function",s,o,u,a;if(i)try{s=n(r.detail),u=!0}catch(f){a=!0,o=f}else s=r.detail,u=!0;s&&typeof s.then=="function"?s.then(function(e){t.resolve(e)},function(e){t.reject(e)}):i&&u?t.resolve(s):a?t.reject(o):t[e](s)};return c.prototype={then:function(e,t){var r=new c;return this.isResolved&&n.async(function(){p("resolve",r,e,{detail:this.resolvedValue})},this),this.isRejected&&n.async(function(){p("reject",r,t,{detail:this.rejectedValue})},this),this.on("promise:resolved",function(t){p("resolve",r,e,t)}),this.on("promise:failed",function(e){p("reject",r,t,e)}),r},resolve:function(e){d(this,e),this.resolve=h,this.reject=h},reject:function(e){v(this,e),this.resolve=h,this.reject=h}},l.mixin(c.prototype),n={async:r,Promise:c,Event:u,EventTarget:l,all:m,raiseOnUncaughtExceptions:!0},n})}(),function(){e("container",[],function(){function e(e){this.parent=e,this.dict={}}function t(t){this.parent=t,this.children=[],this.resolver=t&&t.resolver||function(){},this.registry=new e(t&&t.registry),this.cache=new e(t&&t.cache),this.typeInjections=new e(t&&t.typeInjections),this.injections={},this._options=new e(t&&t._options),this._typeOptions=new e(t&&t._typeOptions)}function n(e){throw new Error(e+" is not currently supported on child containers")}function r(e,t){var n=s(e,t,"singleton");return n!==!1}function i(e,t){var n={};if(!t)return n;var r,i;for(var s=0,o=t.length;s<o;s++)r=t[s],i=e.lookup(r.fullName),n[r.property]=i;return n}function s(e,t,n){var r=e._options.get(t);if(r&&r[n]!==undefined)return r[n];var i=t.split(":")[0];r=e._typeOptions.get(i);if(r)return r[n]}function o(e,t){var n=e.normalize(t);return e.resolve(n)}function u(e,t){var n=o(e,t),r=t.split(":"),u=r[0],a=r[1],f;if(s(e,t,"instantiate")===!1)return n;if(n){var l=[];l=l.concat(e.typeInjections.get(u)||[]),l=l.concat(e.injections[t]||[]);var c=i(e,l);return c.container=e,c._debugContainerKey=t,f=n.create(c),f}}function a(e,t){e.cache.eachLocal(function(n,r){if(s(e,n,"instantiate")===!1)return;t(r)})}function f(e){e.cache.eachLocal(function(t,n){if(s(e,t,"instantiate")===!1)return;n.destroy()}),e.cache.dict={}}return e.prototype={get:function(e){var t=this.dict;if(t.hasOwnProperty(e))return t[e];if(this.parent)return this.parent.get(e)},set:function(e,t){this.dict[e]=t},has:function(e){var t=this.dict;return t.hasOwnProperty(e)?!0:this.parent?this.parent.has(e):!1},eachLocal:function(e,t){var n=this.dict;for(var r in n)n.hasOwnProperty(r)&&e.call(t,r,n[r])}},t.prototype={child:function(){var e=new t(this);return this.children.push(e),e},set:function(e,t,n){e[t]=n},register:function(e,t,n,r){var i;e.indexOf(":")!==-1?(r=n,n=t,i=e):i=e+":"+t;var s=this.normalize(i);this.registry.set(s,n),this._options.set(s,r||{})},resolve:function(e){return this.resolver(e)||this.registry.get(e)},normalize:function(e){return e},lookup:function(e,t){e=this.normalize(e),t=t||{};if(this.cache.has(e)&&t.singleton!==!1)return this.cache.get(e);var n=u(this,e);if(!n)return;return r(this,e)&&t.singleton!==!1&&this.cache.set(e,n),n},has:function(e){return this.cache.has(e)?!0:!!o(this,e)},optionsForType:function(e,t){this.parent&&n("optionsForType"),this._typeOptions.set(e,t)},options:function(e,t){this.optionsForType(e,t)},typeInjection:function(e,t,r){this.parent&&n("typeInjection");var i=this.typeInjections.get(e);i||(i=[],this.typeInjections.set(e,i)),i.push({property:t,fullName:r})},injection:function(e,t,r){this.parent&&n("injection");if(e.indexOf(":")===-1)return this.typeInjection(e,t,r);var i=this.injections[e]=this.injections[e]||[];i.push({property:t,fullName:r})},destroy:function(){this.isDestroyed=!0;for(var e=0,t=this.children.length;e<t;e++)this.children[e].destroy();this.children=[],a(this,function(e){e.isDestroying=!0}),a(this,function(e){e.destroy()}),delete this.parent,this.isDestroyed=!0},reset:function(){for(var e=0,t=this.children.length;e<t;e++)f(this.children[e]);f(this)}},t})}(),function(){function t(n,r,i,s){var o,u,a;if("object"!=typeof n||n===null)return n;if(r&&(u=e(i,n))>=0)return s[u];if(Ember.typeOf(n)==="array"){o=n.slice();if(r){u=o.length;while(--u>=0)o[u]=t(o[u],r,i,s)}}else if(Ember.Copyable&&Ember.Copyable.detect(n))o=n.copy(r,i,s);else{o={};for(a in n){if(!n.hasOwnProperty(a))continue;if(a.substring(0,2)==="__")continue;o[a]=r?t(n[a],r,i,s):n[a]}}return r&&(i.push(n),s.push(o)),o}var e=Ember.EnumerableUtils.indexOf;Ember.compare=function r(e,t){if(e===t)return 0;var n=Ember.typeOf(e),i=Ember.typeOf(t),s=Ember.Comparable;if(s){if(n==="instance"&&s.detect(e.constructor))return e.constructor.compare(e,t);if(i==="instance"&&s.detect(t.constructor))return 1-t.constructor.compare(t,e)}var o=Ember.ORDER_DEFINITION_MAPPING;if(!o){var u=Ember.ORDER_DEFINITION;o=Ember.ORDER_DEFINITION_MAPPING={};var a,f;for(a=0,f=u.length;a<f;++a)o[u[a]]=a;delete Ember.ORDER_DEFINITION}var l=o[n],c=o[i];if(l<c)return-1;if(l>c)return 1;switch(n){case"boolean":case"number":if(e<t)return-1;if(e>t)return 1;return 0;case"string":var h=e.localeCompare(t);if(h<0)return-1;if(h>0)return 1;return 0;case"array":var p=e.length,d=t.length,v=Math.min(p,d),m=0,g=0;while(m===0&&g<v)m=r(e[g],t[g]),g++;if(m!==0)return m;if(p<d)return-1;if(p>d)return 1;return 0;case"instance":if(Ember.Comparable&&Ember.Comparable.detect(e))return e.compare(e,t);return 0;case"date":var y=e.getTime(),b=t.getTime();if(y<b)return-1;if(y>b)return 1;return 0;default:return 0}},Ember.copy=function(e,n){return"object"!=typeof e||e===null?e:Ember.Copyable&&Ember.Copyable.detect(e)?e.copy(n):t(e,n,n?[]:null,n?[]:null)},Ember.inspect=function(e){if(typeof e!="object"||e===null)return e+"";var t,n=[];for(var r in e)if(e.hasOwnProperty(r)){t=e[r];if(t==="toString")continue;Ember.typeOf(t)==="function"&&(t="function() { ... }"),n.push(r+": "+t)}return"{"+n.join(", ")+"}"},Ember.isEqual=function(e,t){return e&&"function"==typeof e.isEqual?e.isEqual(t):e===t},Ember.ORDER_DEFINITION=Ember.ENV.ORDER_DEFINITION||["undefined","null","boolean","number","string","array","object","instance","function","class","date"],Ember.keys=Object.keys,Ember.keys||(Ember.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t});var n=["description","fileName","lineNumber","message","name","number","stack"];Ember.Error=function(){var e=Error.prototype.constructor.apply(this,arguments);for(var t=0;t<n.length;t++)this[n[t]]=e[n[t]]},Ember.Error.prototype=Ember.create(Error.prototype)}(),function(){Ember.RSVP=t("rsvp")}(),function(){var e=/[ _]/g,t={},n=/([a-z])([A-Z])/g,r=/(\-|_|\.|\s)+(.)?/g,i=/([a-z\d])([A-Z]+)/g,s=/\-|\s+/g;Ember.STRINGS={},Ember.String={fmt:function(e,t){var n=0;return e.replace(/%@([0-9]+)?/g,function(e,r){return r=r?parseInt(r,0)-1:n++,e=t[r],(e===null?"(null)":e===undefined?"":e).toString()})},loc:function(e,t){return e=Ember.STRINGS[e]||e,Ember.String.fmt(e,t)},w:function(e){return e.split(/\s+/)},decamelize:function(e){return e.replace(n,"$1_$2").toLowerCase()},dasherize:function(n){var r=t,i=r.hasOwnProperty(n),s;return i?r[n]:(s=Ember.String.decamelize(n).replace(e,"-"),r[n]=s,s)},camelize:function(e){return e.replace(r,function(e,t,n){return n?n.toUpperCase():""}).replace(/^([A-Z])/,function(e,t,n){return e.toLowerCase()})},classify:function(e){var t=e.split("."),n=[];for(var r=0,i=t.length;r<i;r++){var s=Ember.String.camelize(t[r]);n.push(s.charAt(0).toUpperCase()+s.substr(1))}return n.join(".")},underscore:function(e){return e.replace(i,"$1_$2").replace(s,"_").toLowerCase()},capitalize:function(e){return e.charAt(0).toUpperCase()+e.substr(1)}}}(),function(){var e=Ember.String.fmt,t=Ember.String.w,n=Ember.String.loc,r=Ember.String.camelize,i=Ember.String.decamelize,s=Ember.String.dasherize,o=Ember.String.underscore,u=Ember.String.capitalize,a=Ember.String.classify;if(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.String)String.prototype.fmt=function(){return e(this,arguments)},String.prototype.w=function(){return t(this)},String.prototype.loc=function(){return n(this,arguments)},String.prototype.camelize=function(){return r(this)},String.prototype.decamelize=function(){return i(this)},String.prototype.dasherize=function(){return s(this)},String.prototype.underscore=function(){return o(this)},String.prototype.classify=function(){return a(this)},String.prototype.capitalize=function(){return u(this)}}(),function(){var e=Array.prototype.slice;if(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Function)Function.prototype.property=function(){var e=Ember.computed(this);return e.property.apply(e,arguments)},Function.prototype.observes=function(){return this.__ember_observes__=e.call(arguments),this},Function.prototype.observesBefore=function(){return this.__ember_observesBefore__=e.call(arguments),this}}(),function(){}(),function(){function s(){return i.length===0?{}:i.pop()}function o(e){return i.push(e),null}function u(t,n){function i(i){var s=e(i,t);return r?n===s:!!s}var r=arguments.length===2;return i}var e=Ember.get,t=Ember.set,n=Array.prototype.slice,r=Ember.EnumerableUtils.indexOf,i=[];Ember.Enumerable=Ember.Mixin.create({isEnumerable:!0,nextObject:Ember.required(Function),firstObject:Ember.computed(function(){if(e(this,"length")===0)return undefined;var t=s(),n;return n=this.nextObject(0,null,t),o(t),n}).property("[]"),lastObject:Ember.computed(function(){var t=e(this,"length");if(t===0)return undefined;var n=s(),r=0,i,u=null;do u=i,i=this.nextObject(r++,u,n);while(i!==undefined);return o(n),u}).property("[]"),contains:function(e){return this.find(function(t){return t===e})!==undefined},forEach:function(t,n){if(typeof t!="function")throw new TypeError;var r=e(this,"length"),i=null,u=s();n===undefined&&(n=null);for(var a=0;a<r;a++){var f=this.nextObject(a,i,u);t.call(n,f,a,this),i=f}return i=null,u=o(u),this},getEach:function(e){return this.mapProperty(e)},setEach:function(e,n){return this.forEach(function(r){t(r,e,n)})},map:function(e,t){var n=Ember.A([]);return this.forEach(function(r,i,s){n[i]=e.call(t,r,i,s)}),n},mapProperty:function(t){return this.map(function(n){return e(n,t)})},filter:function(e,t){var n=Ember.A([]);return this.forEach(function(r,i,s){e.call(t,r,i,s)&&n.push(r)}),n},reject:function(e,t){return this.filter(function(){return!e.apply(t,arguments)})},filterProperty:function(e,t){return this.filter(u.apply(this,arguments))},rejectProperty:function(t,n){var r=function(r){return e(r,t)===n},i=function(n){return!!e(n,t)},s=arguments.length===2?r:i;return this.reject(s)},find:function(t,n){var r=e(this,"length");n===undefined&&(n=null);var i=null,u,a=!1,f,l=s();for(var c=0;c<r&&!a;c++){u=this.nextObject(c,i,l);if(a=t.call(n,u,c,this))f=u;i=u}return u=i=null,l=o(l),f},findProperty:function(e,t){return this.find(u.apply(this,arguments))},every:function(e,t){return!this.find(function(n,r,i){return!e.call(t,n,r,i)})},everyProperty:function(e,t){return this.every(u.apply(this,arguments))},some:function(e,t){return!!this.find(function(n,r,i){return!!e.call(t,n,r,i)})},someProperty:function(e,t){return this.some(u.apply(this,arguments))},reduce:function(e,t,n){if(typeof e!="function")throw new TypeError;var r=t;return this.forEach(function(t,i){r=e.call(null,r,t,i,this,n)},this),r},invoke:function(e){var t,r=Ember.A([]);return arguments.length>1&&(t=n.call(arguments,1)),this.forEach(function(n,i){var s=n&&n[e];"function"==typeof s&&(r[i]=t?s.apply(n,t):s.call(n))},this),r},toArray:function(){var e=Ember.A([]);return this.forEach(function(t,n){e[n]=t}),e},compact:function(){return this.filter(function(e){return e!=null})},without:function(e){if(!this.contains(e))return this;var t=Ember.A([]);return this.forEach(function(n){n!==e&&(t[t.length]=n)}),t},uniq:function(){var e=Ember.A([]);return this.forEach(function(t){r(e,t)<0&&e.push(t)}),e},"[]":Ember.computed(function(e,t){return this}),addEnumerableObserver:function(t,n){var r=n&&n.willChange||"enumerableWillChange",i=n&&n.didChange||"enumerableDidChange",s=e(this,"hasEnumerableObservers");return s||Ember.propertyWillChange(this,"hasEnumerableObservers"),Ember.addListener(this,"@enumerable:before",t,r),Ember.addListener(this,"@enumerable:change",t,i),s||Ember.propertyDidChange(this,"hasEnumerableObservers"),this},removeEnumerableObserver:function(t,n){var r=n&&n.willChange||"enumerableWillChange",i=n&&n.didChange||"enumerableDidChange",s=e(this,"hasEnumerableObservers");return s&&Ember.propertyWillChange(this,"hasEnumerableObservers"),Ember.removeListener(this,"@enumerable:before",t,r),Ember.removeListener(this,"@enumerable:change",t,i),s&&Ember.propertyDidChange(this,"hasEnumerableObservers"),this},hasEnumerableObservers:Ember.computed(function(){return Ember.hasListeners(this,"@enumerable:change")||Ember.hasListeners(this,"@enumerable:before")}),enumerableContentWillChange:function(t,n){var r,i,s;return"number"==typeof t?r=t:t?r=e(t,"length"):r=t=-1,"number"==typeof n?i=n:n?i=e(n,"length"):i=n=-1,s=i<0||r<0||i-r!==0,t===-1&&(t=null),n===-1&&(n=null),Ember.propertyWillChange(this,"[]"),s&&Ember.propertyWillChange(this,"length"),Ember.sendEvent(this,"@enumerable:before",[this,t,n]),this},enumerableContentDidChange:function(t,n){var r,i,s;return"number"==typeof t?r=t:t?r=e(t,"length"):r=t=-1,"number"==typeof n?i=n:n?i=e(n,"length"):i=n=-1,s=i<0||r<0||i-r!==0,t===-1&&(t=null),n===-1&&(n=null),Ember.sendEvent(this,"@enumerable:change",[this,t,n]),s&&Ember.propertyDidChange(this,"length"),Ember.propertyDidChange(this,"[]"),this}})}(),function(){function i(e){return e===null||e===undefined}var e=Ember.get,t=Ember.set,n=Ember.EnumerableUtils.map,r=Ember.cacheFor;Ember.Array=Ember.Mixin.create(Ember.Enumerable,{isSCArray:!0,length:Ember.required(),objectAt:function(t){return t<0||t>=e(this,"length")?undefined:e(this,t)},objectsAt:function(e){var t=this;return n(e,function(e){return t.objectAt(e)})},nextObject:function(e){return this.objectAt(e)},"[]":Ember.computed(function(t,n){return n!==undefined&&this.replace(0,e(this,"length"),n),this}),firstObject:Ember.computed(function(){return this.objectAt(0)}),lastObject:Ember.computed(function(){return this.objectAt(e(this,"length")-1)}),contains:function(e){return this.indexOf(e)>=0},slice:function(t,n){var r=Ember.A([]),s=e(this,"length");i(t)&&(t=0);if(i(n)||n>s)n=s;t<0&&(t=s+t),n<0&&(n=s+n);while(t<n)r[r.length]=this.objectAt(t++);return r},indexOf:function(t,n){var r,i=e(this,"length");n===undefined&&(n=0),n<0&&(n+=i);for(r=n;r<i;r++)if(this.objectAt(r,!0)===t)return r;return-1},lastIndexOf:function(t,n){var r,i=e(this,"length");if(n===undefined||n>=i)n=i-1;n<0&&(n+=i);for(r=n;r>=0;r--)if(this.objectAt(r)===t)return r;return-1},addArrayObserver:function(t,n){var r=n&&n.willChange||"arrayWillChange",i=n&&n.didChange||"arrayDidChange",s=e(this,"hasArrayObservers");return s||Ember.propertyWillChange(this,"hasArrayObservers"),Ember.addListener(this,"@array:before",t,r),Ember.addListener(this,"@array:change",t,i),s||Ember.propertyDidChange(this,"hasArrayObservers"),this},removeArrayObserver:function(t,n){var r=n&&n.willChange||"arrayWillChange",i=n&&n.didChange||"arrayDidChange",s=e(this,"hasArrayObservers");return s&&Ember.propertyWillChange(this,"hasArrayObservers"),Ember.removeListener(this,"@array:before",t,r),Ember.removeListener(this,"@array:change",t,i),s&&Ember.propertyDidChange(this,"hasArrayObservers"),this},hasArrayObservers:Ember.computed(function(){return Ember.hasListeners(this,"@array:change")||Ember.hasListeners(this,"@array:before")}),arrayContentWillChange:function(t,n,r){t===undefined?(t=0,n=r=-1):(n===undefined&&(n=-1),r===undefined&&(r=-1)),Ember.isWatching(this,"@each")&&e(this,"@each"),Ember.sendEvent(this,"@array:before",[this,t,n,r]);var i,s;if(t>=0&&n>=0&&e(this,"hasEnumerableObservers")){i=[],s=t+n;for(var o=t;o<s;o++)i.push(this.objectAt(o))}else i=n;return this.enumerableContentWillChange(i,r),this},arrayContentDidChange:function(t,n,i){t===undefined?(t=0,n=i=-1):(n===undefined&&(n=-1),i===undefined&&(i=-1));var s,o;if(t>=0&&i>=0&&e(this,"hasEnumerableObservers")){s=[],o=t+i;for(var u=t;u<o;u++)s.push(this.objectAt(u))}else s=i;this.enumerableContentDidChange(n,s),Ember.sendEvent(this,"@array:change",[this,t,n,i]);var a=e(this,"length"),f=r(this,"firstObject"),l=r(this,"lastObject");return this.objectAt(0)!==f&&(Ember.propertyWillChange(this,"firstObject"),Ember.propertyDidChange(this,"firstObject")),this.objectAt(a-1)!==l&&(Ember.propertyWillChange(this,"lastObject"),Ember.propertyDidChange(this,"lastObject")),this},"@each":Ember.computed(function(){return this.__each||(this.__each=new Ember.EachProxy(this)),this.__each})})}(),function(){Ember.Comparable=Ember.Mixin.create({isComparable:!0,compare:Ember.required(Function)})}(),function(){var e=Ember.get,t=Ember.set;Ember.Copyable=Ember.Mixin.create({copy:Ember.required(Function),frozenCopy:function(){if(Ember.Freezable&&Ember.Freezable.detect(this))return e(this,"isFrozen")?this:this.copy().freeze();throw new Error(Ember.String.fmt("%@ does not support freezing",[this]))}})}(),function(){var e=Ember.get,t=Ember.set;Ember.Freezable=Ember.Mixin.create({isFrozen:!1,freeze:function(){return e(this,"isFrozen")?this:(t(this,"isFrozen",!0),this)}}),Ember.FROZEN_ERROR="Frozen object cannot be modified."}(),function(){var e=Ember.EnumerableUtils.forEach;Ember.MutableEnumerable=Ember.Mixin.create(Ember.Enumerable,{addObject:Ember.required(Function),addObjects:function(t){return Ember.beginPropertyChanges(this),e(t,function(e){this.addObject(e)},this),Ember.endPropertyChanges(this),this},removeObject:Ember.required(Function),removeObjects:function(t){return Ember.beginPropertyChanges(this),e(t,function(e){this.removeObject(e)},this),Ember.endPropertyChanges(this),this}})}(),function(){var e="Index out of range",t=[],n=Ember.get,r=Ember.set;Ember.MutableArray=Ember.Mixin.create(Ember.Array,Ember.MutableEnumerable,{replace:Ember.required(),clear:function(){var e=n(this,"length");return e===0?this:(this.replace(0,e,t),this)},insertAt:function(t,r){if(t>n(this,"length"))throw new Error(e);return this.replace(t,0,[r]),this},removeAt:function(r,i){if("number"==typeof r){if(r<0||r>=n(this,"length"))throw new Error(e);i===undefined&&(i=1),this.replace(r,i,t)}return this},pushObject:function(e){return this.insertAt(n(this,"length"),e),e},pushObjects:function(e){return this.replace(n(this,"length"),0,e),this},popObject:function(){var e=n(this,"length");if(e===0)return null;var t=this.objectAt(e-1);return this.removeAt(e-1,1),t},shiftObject:function(){if(n(this,"length")===0)return null;var e=this.objectAt(0);return this.removeAt(0),e},unshiftObject:function(e){return this.insertAt(0,e),e},unshiftObjects:function(e){return this.replace(0,0,e),this},reverseObjects:function(){var e=n(this,"length");if(e===0)return this;var t=this.toArray().reverse();return this.replace(0,e,t),this},setObjects:function(e){if(e.length===0)return this.clear();var t=n(this,"length");return this.replace(0,t,e),this},removeObject:function(e){var t=n(this,"length")||0;while(--t>=0){var r=this.objectAt(t);r===e&&this.removeAt(t)}return this},addObject:function(e){return this.contains(e)||this.pushObject(e),this}})}(),function(){var e=Ember.get,t=Ember.set;Ember.Observable=Ember.Mixin.create({get:function(t){return e(this,t)},getProperties:function(){var t={},n=arguments;arguments.length===1&&Ember.typeOf(arguments[0])==="array"&&(n=arguments[0]);for(var r=0;r<n.length;r++)t[n[r]]=e(this,n[r]);return t},set:function(e,n){return t(this,e,n),this},setProperties:function(e){return Ember.setProperties(this,e)},beginPropertyChanges:function(){return Ember.beginPropertyChanges(),this},endPropertyChanges:function(){return Ember.endPropertyChanges(),this},propertyWillChange:function(e){return Ember.propertyWillChange(this,e),this},propertyDidChange:function(e){return Ember.propertyDidChange(this,e),this},notifyPropertyChange:function(e){return this.propertyWillChange(e),this.propertyDidChange(e),this},addBeforeObserver:function(e,t,n){Ember.addBeforeObserver(this,e,t,n)},addObserver:function(e,t,n){Ember.addObserver(this,e,t,n)},removeObserver:function(e,t,n){Ember.removeObserver(this,e,t,n)},hasObserverFor:function(e){return Ember
17
+ .hasListeners(this,e+":change")},getPath:function(e){return this.get(e)},setPath:function(e,t){return this.set(e,t)},getWithDefault:function(e,t){return Ember.getWithDefault(this,e,t)},incrementProperty:function(n,r){return r||(r=1),t(this,n,(e(this,n)||0)+r),e(this,n)},decrementProperty:function(n,r){return r||(r=1),t(this,n,(e(this,n)||0)-r),e(this,n)},toggleProperty:function(n){return t(this,n,!e(this,n)),e(this,n)},cacheFor:function(e){return Ember.cacheFor(this,e)},observersForKey:function(e){return Ember.observersFor(this,e)}})}(),function(){var e=Ember.get,t=Ember.set;Ember.TargetActionSupport=Ember.Mixin.create({target:null,action:null,targetObject:Ember.computed(function(){var t=e(this,"target");if(Ember.typeOf(t)==="string"){var n=e(this,t);return n===undefined&&(n=e(Ember.lookup,t)),n}return t}).property("target"),triggerAction:function(){var t=e(this,"action"),n=e(this,"targetObject");if(n&&t){var r;return typeof n.send=="function"?r=n.send(t,this):(typeof t=="string"&&(t=n[t]),r=t.call(n,this)),r!==!1&&(r=!0),r}return!1}})}(),function(){Ember.Evented=Ember.Mixin.create({on:function(e,t,n){return Ember.addListener(this,e,t,n),this},one:function(e,t,n){return n||(n=t,t=null),Ember.addListener(this,e,t,n,!0),this},trigger:function(e){var t=[],n,r;for(n=1,r=arguments.length;n<r;n++)t.push(arguments[n]);Ember.sendEvent(this,e,t)},fire:function(e){this.trigger.apply(this,arguments)},off:function(e,t,n){return Ember.removeListener(this,e,t,n),this},has:function(e){return Ember.hasListeners(this,e)}})}(),function(){var e=t("rsvp");e.async=function(e,t){Ember.run.schedule("actions",t,e)};var n=Ember.get;Ember.DeferredMixin=Ember.Mixin.create({then:function(e,t){var r=n(this,"promise");return r.then.apply(r,arguments)},resolve:function(e){n(this,"promise").resolve(e)},reject:function(e){n(this,"promise").reject(e)},promise:Ember.computed(function(){return new e.Promise})})}(),function(){}(),function(){Ember.Container=t("container"),Ember.Container.set=Ember.set}(),function(){function b(){var e=!1,t,s,o=function(){e||o.proto(),r(this,i,y),r(this,"_super",y);var a=u(this);a.proto=this;if(t){var l=t;t=null,this.reopen.apply(this,l)}if(s){var c=s;s=null;var h=this.concatenatedProperties;for(var p=0,v=c.length;p<v;p++){var b=c[p];for(var w in b){if(!b.hasOwnProperty(w))continue;var E=b[w],S=Ember.IS_BINDING;if(S.test(w)){var x=a.bindings;x?a.hasOwnProperty("bindings")||(x=a.bindings=n(a.bindings)):x=a.bindings={},x[w]=E}var T=a.descs[w];if(h&&g(h,w)>=0){var N=this[w];N?"function"==typeof N.concat?E=N.concat(E):E=Ember.makeArray(N).concat(E):E=Ember.makeArray(E)}T?T.set(this,w,E):typeof this.setUnknownProperty!="function"||w in this?m?Ember.defineProperty(this,w,null,E):this[w]=E:this.setUnknownProperty(w,E)}}}d(this,a),delete a.proto,f(this),this.init.apply(this,arguments)};return o.toString=h.prototype.toString,o.willReopen=function(){e&&(o.PrototypeMixin=h.create(o.PrototypeMixin)),e=!1},o._initMixins=function(e){t=e},o._initProperties=function(e){s=e},o.proto=function(){var t=o.superclass;return t&&t.proto(),e||(e=!0,o.PrototypeMixin.applyPartial(o.prototype),a(o.prototype)),this.prototype},o}function E(e){return function(){return e}}var e=Ember.set,t=Ember.get,n=Ember.create,r=Ember.platform.defineProperty,i=Ember.GUID_KEY,s=Ember.guidFor,o=Ember.generateGuid,u=Ember.meta,a=Ember.rewatch,f=Ember.finishChains,l=Ember.destroy,c=Ember.run.schedule,h=Ember.Mixin,p=h._apply,d=h.finishPartial,v=h.prototype.reopen,m=Ember.ENV.MANDATORY_SETTER,g=Ember.EnumerableUtils.indexOf,y={configurable:!0,writable:!0,enumerable:!1,value:undefined},w=b();w.toString=function(){return"Ember.CoreObject"},w.PrototypeMixin=h.create({reopen:function(){return p(this,arguments,!0),this},isInstance:!0,init:function(){},concatenatedProperties:null,isDestroyed:!1,isDestroying:!1,destroy:function(){if(this._didCallDestroy)return;return this.isDestroying=!0,this._didCallDestroy=!0,c("destroy",this,this._scheduledDestroy),this},willDestroy:Ember.K,_scheduledDestroy:function(){this.willDestroy&&this.willDestroy(),l(this),this.isDestroyed=!0,this.didDestroy&&this.didDestroy()},bind:function(e,t){return t instanceof Ember.Binding||(t=Ember.Binding.from(t)),t.to(e).connect(this),t},toString:function x(){var e=typeof this.toStringExtension=="function",t=e?":"+this.toStringExtension():"",n="<"+this.constructor.toString()+":"+s(this)+t+">";return this.toString=E(n),n}}),w.PrototypeMixin.ownerConstructor=w,Ember.config.overridePrototypeMixin&&Ember.config.overridePrototypeMixin(w.PrototypeMixin),w.__super__=null;var S=h.create({ClassMixin:Ember.required(),PrototypeMixin:Ember.required(),isClass:!0,isMethod:!1,extend:function(){var e=b(),t;return e.ClassMixin=h.create(this.ClassMixin),e.PrototypeMixin=h.create(this.PrototypeMixin),e.ClassMixin.ownerConstructor=e,e.PrototypeMixin.ownerConstructor=e,v.apply(e.PrototypeMixin,arguments),e.superclass=this,e.__super__=this.prototype,t=e.prototype=n(this.prototype),t.constructor=e,o(t,"ember"),u(t).proto=t,e.ClassMixin.apply(e),e},createWithMixins:function(){var e=this;return arguments.length>0&&this._initMixins(arguments),new e},create:function(){var e=this;return arguments.length>0&&this._initProperties(arguments),new e},reopen:function(){return this.willReopen(),v.apply(this.PrototypeMixin,arguments),this},reopenClass:function(){return v.apply(this.ClassMixin,arguments),p(this,arguments,!1),this},detect:function(e){if("function"!=typeof e)return!1;while(e){if(e===this)return!0;e=e.superclass}return!1},detectInstance:function(e){return e instanceof this},metaForProperty:function(e){var t=u(this.proto(),!1).descs[e];return t._meta||{}},eachComputedProperty:function(e,t){var n=this.proto(),r=u(n).descs,i={},s;for(var o in r)s=r[o],s instanceof Ember.ComputedProperty&&e.call(t||this,o,s._meta||i)}});S.ownerConstructor=w,Ember.config.overrideClassMixin&&Ember.config.overrideClassMixin(S),w.ClassMixin=S,S.apply(w),Ember.CoreObject=w}(),function(){Ember.Object=Ember.CoreObject.extend(Ember.Observable),Ember.Object.toString=function(){return"Ember.Object"}}(),function(){function o(e,t,n){var u=e.length;r[e.join(".")]=t;for(var f in t){if(!i.call(t,f))continue;var c=t[f];e[u]=f;if(c&&c.toString===l)c.toString=h(e.join(".")),c[a]=e.join(".");else if(c&&c.isNamespace){if(n[s(c)])continue;n[s(c)]=!0,o(e,c,n)}}e.length=u}function u(){var e=Ember.Namespace,t=Ember.lookup,n,r;if(e.PROCESSED)return;for(var i in t){if(i==="parent"||i==="top"||i==="frameElement")continue;if(i==="globalStorage"&&t.StorageList&&t.globalStorage instanceof t.StorageList)continue;if(t.hasOwnProperty&&!t.hasOwnProperty(i))continue;try{n=Ember.lookup[i],r=n&&n.isNamespace}catch(s){continue}r&&(n[a]=i)}}function f(e){var t=e.superclass;if(t)return t[a]?t[a]:f(t);return}function l(){!Ember.BOOTED&&!this[a]&&c();var e;if(this[a])e=this[a];else{var t=f(this);t?e="(subclass of "+t+")":e="(unknown mixin)",this.toString=h(e)}return e}function c(){var e=!n.PROCESSED,t=Ember.anyUnprocessedMixins;e&&(u(),n.PROCESSED=!0);if(e||t){var r=n.NAMESPACES,i;for(var s=0,a=r.length;s<a;s++)i=r[s],o([i.toString()],i,{});Ember.anyUnprocessedMixins=!1}}function h(e){return function(){return e}}var e=Ember.get,t=Ember.ArrayPolyfills.indexOf,n=Ember.Namespace=Ember.Object.extend({isNamespace:!0,init:function(){Ember.Namespace.NAMESPACES.push(this),Ember.Namespace.PROCESSED=!1},toString:function(){var t=e(this,"name");return t?t:(u(),this[Ember.GUID_KEY+"_name"])},nameClasses:function(){o([this.toString()],this,{})},destroy:function(){var e=Ember.Namespace.NAMESPACES;Ember.lookup[this.toString()]=undefined,e.splice(t.call(e,this),1),this._super()}});n.reopenClass({NAMESPACES:[Ember],NAMESPACES_BY_ID:{},PROCESSED:!1,processAll:c,byName:function(e){return Ember.BOOTED||c(),r[e]}});var r=n.NAMESPACES_BY_ID,i={}.hasOwnProperty,s=Ember.guidFor,a=Ember.NAME_KEY=Ember.GUID_KEY+"_name";Ember.Mixin.prototype.toString=l}(),function(){Ember.Application=Ember.Namespace.extend()}(),function(){var e="Index out of range",t=[],n=Ember.get,r=Ember.set;Ember.ArrayProxy=Ember.Object.extend(Ember.MutableArray,{content:null,arrangedContent:Ember.computed.alias("content"),objectAtContent:function(e){return n(this,"arrangedContent").objectAt(e)},replaceContent:function(e,t,r){n(this,"content").replace(e,t,r)},_contentWillChange:Ember.beforeObserver(function(){this._teardownContent()},"content"),_teardownContent:function(){var e=n(this,"content");e&&e.removeArrayObserver(this,{willChange:"contentArrayWillChange",didChange:"contentArrayDidChange"})},contentArrayWillChange:Ember.K,contentArrayDidChange:Ember.K,_contentDidChange:Ember.observer(function(){var e=n(this,"content");this._setupContent()},"content"),_setupContent:function(){var e=n(this,"content");e&&e.addArrayObserver(this,{willChange:"contentArrayWillChange",didChange:"contentArrayDidChange"})},_arrangedContentWillChange:Ember.beforeObserver(function(){var e=n(this,"arrangedContent"),t=e?n(e,"length"):0;this.arrangedContentArrayWillChange(this,0,t,undefined),this.arrangedContentWillChange(this),this._teardownArrangedContent(e)},"arrangedContent"),_arrangedContentDidChange:Ember.observer(function(){var e=n(this,"arrangedContent"),t=e?n(e,"length"):0;this._setupArrangedContent(),this.arrangedContentDidChange(this),this.arrangedContentArrayDidChange(this,0,undefined,t)},"arrangedContent"),_setupArrangedContent:function(){var e=n(this,"arrangedContent");e&&e.addArrayObserver(this,{willChange:"arrangedContentArrayWillChange",didChange:"arrangedContentArrayDidChange"})},_teardownArrangedContent:function(){var e=n(this,"arrangedContent");e&&e.removeArrayObserver(this,{willChange:"arrangedContentArrayWillChange",didChange:"arrangedContentArrayDidChange"})},arrangedContentWillChange:Ember.K,arrangedContentDidChange:Ember.K,objectAt:function(e){return n(this,"content")&&this.objectAtContent(e)},length:Ember.computed(function(){var e=n(this,"arrangedContent");return e?n(e,"length"):0}),_replace:function(e,t,r){var i=n(this,"content");return i&&this.replaceContent(e,t,r),this},replace:function(){if(n(this,"arrangedContent")!==n(this,"content"))throw new Ember.Error("Using replace on an arranged ArrayProxy is not allowed.");this._replace.apply(this,arguments)},_insertAt:function(t,r){if(t>n(this,"content.length"))throw new Error(e);return this._replace(t,0,[r]),this},insertAt:function(e,t){if(n(this,"arrangedContent")===n(this,"content"))return this._insertAt(e,t);throw new Ember.Error("Using insertAt on an arranged ArrayProxy is not allowed.")},removeAt:function(r,i){if("number"==typeof r){var s=n(this,"content"),o=n(this,"arrangedContent"),u=[],a;if(r<0||r>=n(this,"length"))throw new Error(e);i===undefined&&(i=1);for(a=r;a<r+i;a++)u.push(s.indexOf(o.objectAt(a)));u.sort(function(e,t){return t-e}),Ember.beginPropertyChanges();for(a=0;a<u.length;a++)this._replace(u[a],1,t);Ember.endPropertyChanges()}return this},pushObject:function(e){return this._insertAt(n(this,"content.length"),e),e},pushObjects:function(e){return this._replace(n(this,"length"),0,e),this},setObjects:function(e){if(e.length===0)return this.clear();var t=n(this,"length");return this._replace(0,t,e),this},unshiftObject:function(e){return this._insertAt(0,e),e},unshiftObjects:function(e){return this._replace(0,0,e),this},slice:function(){var e=this.toArray();return e.slice.apply(e,arguments)},arrangedContentArrayWillChange:function(e,t,n,r){this.arrayContentWillChange(t,n,r)},arrangedContentArrayDidChange:function(e,t,n,r){this.arrayContentDidChange(t,n,r)},init:function(){this._super(),this._setupContent(),this._setupArrangedContent()},willDestroy:function(){this._teardownArrangedContent(),this._teardownContent()}})}(),function(){function f(e,t){var n=t.slice(8);if(n in this)return;u(this,n)}function l(e,t){var n=t.slice(8);if(n in this)return;a(this,n)}var e=Ember.get,t=Ember.set,n=Ember.String.fmt,r=Ember.addBeforeObserver,i=Ember.addObserver,s=Ember.removeBeforeObserver,o=Ember.removeObserver,u=Ember.propertyWillChange,a=Ember.propertyDidChange;Ember.ObjectProxy=Ember.Object.extend({content:null,_contentDidChange:Ember.observer(function(){},"content"),isTruthy:Ember.computed.bool("content"),_debugContainerKey:null,willWatchProperty:function(e){var t="content."+e;r(this,t,null,f),i(this,t,null,l)},didUnwatchProperty:function(e){var t="content."+e;s(this,t,null,f),o(this,t,null,l)},unknownProperty:function(t){var n=e(this,"content");if(n)return e(n,t)},setUnknownProperty:function(n,r){var i=e(this,"content");return t(i,n,r)}}),Ember.ObjectProxy.reopenClass({create:function(){var e,t,n,r,i,s;if(arguments.length){t=this.proto();for(n=0,r=arguments.length;n<r;n++){i=arguments[n];for(s in i){if(!i.hasOwnProperty(s)||s in t)continue;e||(e={}),e[s]=null}}e&&this._initMixins([e])}return this._super.apply(this,arguments)}})}(),function(){function o(e,t,r,i,s){var o=r._objects,u;o||(o=r._objects={});while(--s>=i){var a=e.objectAt(s);a&&(Ember.addBeforeObserver(a,t,r,"contentKeyWillChange"),Ember.addObserver(a,t,r,"contentKeyDidChange"),u=n(a),o[u]||(o[u]=[]),o[u].push(s))}}function u(e,t,r,i,s){var o=r._objects;o||(o=r._objects={});var u,a;while(--s>=i){var f=e.objectAt(s);f&&(Ember.removeBeforeObserver(f,t,r,"contentKeyWillChange"),Ember.removeObserver(f,t,r,"contentKeyDidChange"),a=n(f),u=o[a],u[u.indexOf(s)]=null)}}var e=Ember.set,t=Ember.get,n=Ember.guidFor,r=Ember.EnumerableUtils.forEach,i=Ember.Object.extend(Ember.Array,{init:function(e,t,n){this._super(),this._keyName=t,this._owner=n,this._content=e},objectAt:function(e){var n=this._content.objectAt(e);return n&&t(n,this._keyName)},length:Ember.computed(function(){var e=this._content;return e?t(e,"length"):0})}),s=/^.+:(before|change)$/;Ember.EachProxy=Ember.Object.extend({init:function(e){this._super(),this._content=e,e.addArrayObserver(this),r(Ember.watchedEvents(this),function(e){this.didAddListener(e)},this)},unknownProperty:function(e,t){var n;return n=new i(this._content,e,this),Ember.defineProperty(this,e,null,n),this.beginObservingContentKey(e),n},arrayWillChange:function(e,t,n,r){var i=this._keys,s,o;o=n>0?t+n:-1,Ember.beginPropertyChanges(this);for(s in i){if(!i.hasOwnProperty(s))continue;o>0&&u(e,s,this,t,o),Ember.propertyWillChange(this,s)}Ember.propertyWillChange(this._content,"@each"),Ember.endPropertyChanges(this)},arrayDidChange:function(e,t,n,r){var i=this._keys,s,u;u=r>0?t+r:-1,Ember.beginPropertyChanges(this);for(s in i){if(!i.hasOwnProperty(s))continue;u>0&&o(e,s,this,t,u),Ember.propertyDidChange(this,s)}Ember.propertyDidChange(this._content,"@each"),Ember.endPropertyChanges(this)},didAddListener:function(e){s.test(e)&&this.beginObservingContentKey(e.slice(0,-7))},didRemoveListener:function(e){s.test(e)&&this.stopObservingContentKey(e.slice(0,-7))},beginObservingContentKey:function(e){var n=this._keys;n||(n=this._keys={});if(!n[e]){n[e]=1;var r=this._content,i=t(r,"length");o(r,e,this,0,i)}else n[e]++},stopObservingContentKey:function(e){var n=this._keys;if(n&&n[e]>0&&--n[e]<=0){var r=this._content,i=t(r,"length");u(r,e,this,0,i)}},contentKeyWillChange:function(e,t){Ember.propertyWillChange(this,t)},contentKeyDidChange:function(e,t){Ember.propertyDidChange(this,t)}})}(),function(){var e=Ember.get,t=Ember.set,n=Ember.Mixin.create(Ember.MutableArray,Ember.Observable,Ember.Copyable,{get:function(e){return e==="length"?this.length:"number"==typeof e?this[e]:this._super(e)},objectAt:function(e){return this[e]},replace:function(t,n,r){if(this.isFrozen)throw Ember.FROZEN_ERROR;var i=r?e(r,"length"):0;this.arrayContentWillChange(t,n,i);if(!r||r.length===0)this.splice(t,n);else{var s=[t,n].concat(r);this.splice.apply(this,s)}return this.arrayContentDidChange(t,n,i),this},unknownProperty:function(e,t){var n;return t!==undefined&&n===undefined&&(n=this[e]=t),n},indexOf:function(e,t){var n,r=this.length;t===undefined?t=0:t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=r);for(n=t;n<r;n++)if(this[n]===e)return n;return-1},lastIndexOf:function(e,t){var n,r=this.length;t===undefined?t=r-1:t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=r);for(n=t;n>=0;n--)if(this[n]===e)return n;return-1},copy:function(e){return e?this.map(function(e){return Ember.copy(e,!0)}):this.slice()}}),r=["length"];Ember.EnumerableUtils.forEach(n.keys(),function(e){Array.prototype[e]&&r.push(e)}),r.length>0&&(n=n.without.apply(n,r)),Ember.NativeArray=n,Ember.A=function(e){return e===undefined&&(e=[]),Ember.Array.detect(e)?e:Ember.NativeArray.apply(e)},Ember.NativeArray.activate=function(){n.apply(Array.prototype),Ember.A=function(e){return e||[]}},(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Array)&&Ember.NativeArray.activate()}(),function(){var e=Ember.get,t=Ember.set,n=Ember.guidFor,r=Ember.isNone,i=Ember.String.fmt;Ember.Set=Ember.CoreObject.extend(Ember.MutableEnumerable,Ember.Copyable,Ember.Freezable,{length:0,clear:function(){if(this.isFrozen)throw new Error(Ember.FROZEN_ERROR);var r=e(this,"length");if(r===0)return this;var i;this.enumerableContentWillChange(r,0),Ember.propertyWillChange(this,"firstObject"),Ember.propertyWillChange(this,"lastObject");for(var s=0;s<r;s++)i=n(this[s]),delete this[i],delete this[s];return t(this,"length",0),Ember.propertyDidChange(this,"firstObject"),Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(r,0),this},isEqual:function(t){if(!Ember.Enumerable.detect(t))return!1;var n=e(this,"length");if(e(t,"length")!==n)return!1;while(--n>=0)if(!t.contains(this[n]))return!1;return!0},add:Ember.aliasMethod("addObject"),remove:Ember.aliasMethod("removeObject"),pop:function(){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);var t=this.length>0?this[this.length-1]:null;return this.remove(t),t},push:Ember.aliasMethod("addObject"),shift:Ember.aliasMethod("pop"),unshift:Ember.aliasMethod("push"),addEach:Ember.aliasMethod("addObjects"),removeEach:Ember.aliasMethod("removeObjects"),init:function(e){this._super(),e&&this.addObjects(e)},nextObject:function(e){return this[e]},firstObject:Ember.computed(function(){return this.length>0?this[0]:undefined}),lastObject:Ember.computed(function(){return this.length>0?this[this.length-1]:undefined}),addObject:function(i){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);if(r(i))return this;var s=n(i),o=this[s],u=e(this,"length"),a;return o>=0&&o<u&&this[o]===i?this:(a=[i],this.enumerableContentWillChange(null,a),Ember.propertyWillChange(this,"lastObject"),u=e(this,"length"),this[s]=u,this[u]=i,t(this,"length",u+1),Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(null,a),this)},removeObject:function(i){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);if(r(i))return this;var s=n(i),o=this[s],u=e(this,"length"),a=o===0,f=o===u-1,l,c;return o>=0&&o<u&&this[o]===i&&(c=[i],this.enumerableContentWillChange(c,null),a&&Ember.propertyWillChange(this,"firstObject"),f&&Ember.propertyWillChange(this,"lastObject"),o<u-1&&(l=this[u-1],this[o]=l,this[n(l)]=o),delete this[s],delete this[u-1],t(this,"length",u-1),a&&Ember.propertyDidChange(this,"firstObject"),f&&Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(c,null)),this},contains:function(e){return this[n(e)]>=0},copy:function(){var r=this.constructor,i=new r,s=e(this,"length");t(i,"length",s);while(--s>=0)i[s]=this[s],i[n(this[s])]=s;return i},toString:function(){var e=this.length,t,n=[];for(t=0;t<e;t++)n[t]=this[t];return i("Ember.Set<%@>",[n.join(",")])}})}(),function(){var e=Ember.DeferredMixin,t=Ember.get,n=Ember.Object.extend(e);n.reopenClass({promise:function(e,r){var i=n.create();return e.call(r,i),t(i,"promise")}}),Ember.Deferred=n}(),function(){var e=Ember.ENV.EMBER_LOAD_HOOKS||{},t={};Ember.onLoad=function(n,r){var i;e[n]=e[n]||Ember.A(),e[n].pushObject(r),(i=t[n])&&r(i)},Ember.runLoadHooks=function(n,r){var i;t[n]=r,(i=e[n])&&e[n].forEach(function(e){e(r)})}}(),function(){}(),function(){var e=Ember.get;Ember.ControllerMixin=Ember.Mixin.create({isController:!0,target:null,container:null,store:null,model:Ember.computed.alias("content"),send:function(t){var n=[].slice.call(arguments,1),r;this[t]?this[t].apply(this,n):(r=e(this,"target"))&&r.send.apply(r,arguments)}}),Ember.Controller=Ember.Object.extend(Ember.ControllerMixin)}(),function(){var e=Ember.get,t=Ember.set,n=Ember.EnumerableUtils.forEach;Ember.SortableMixin=Ember.Mixin.create(Ember.MutableEnumerable,{sortProperties:null,sortAscending:!0,orderBy:function(t,r){var i=0,s=e(this,"sortProperties"),o=e(this,"sortAscending");return n(s,function(n){i===0&&(i=Ember.compare(e(t,n),e(r,n)),i!==0&&!o&&(i=-1*i))}),i},destroy:function(){var t=e(this,"content"),r=e(this,"sortProperties");return t&&r&&n(t,function(e){n(r,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),this._super()},isSorted:Ember.computed.bool("sortProperties"),arrangedContent:Ember.computed("content","sortProperties.@each",function(t,r){var i=e(this,"content"),s=e(this,"isSorted"),o=e(this,"sortProperties"),u=this;return i&&s?(i=i.slice(),i.sort(function(e,t){return u.orderBy(e,t)}),n(i,function(e){n(o,function(t){Ember.addObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),Ember.A(i)):i}),_contentWillChange:Ember.beforeObserver(function(){var t=e(this,"content"),r=e(this,"sortProperties");t&&r&&n(t,function(e){n(r,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),this._super()},"content"),sortAscendingWillChange:Ember.beforeObserver(function(){this._lastSortAscending=e(this,"sortAscending")},"sortAscending"),sortAscendingDidChange:Ember.observer(function(){if(e(this,"sortAscending")!==this._lastSortAscending){var t=e(this,"arrangedContent");t.reverseObjects()}},"sortAscending"),contentArrayWillChange:function(t,r,i,s){var o=e(this,"isSorted");if(o){var u=e(this,"arrangedContent"),a=t.slice(r,r+i),f=e(this,"sortProperties");n(a,function(e){u.removeObject(e),n(f,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this)}return this._super(t,r,i,s)},contentArrayDidChange:function(t,r,i,s){var o=e(this,"isSorted"),u=e(this,"sortProperties");if(o){var a=t.slice(r,r+s);n(a,function(e){this.insertItemSorted(e),n(u,function(t){Ember.addObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this)}return this._super(t,r,i,s)},insertItemSorted:function(t){var n=e(this,"arrangedContent"),r=e(n,"length"),i=this._binarySearch(t,0,r);n.insertAt(i,t)},contentItemSortPropertyDidChange:function(t){var n=e(this,"arrangedContent"),r=n.indexOf(t),i=n.objectAt(r-1),s=n.objectAt(r+1),o=i&&this.orderBy(t,i),u=s&&this.orderBy(t,s);if(o<0||u>0)n.removeObject(t),this.insertItemSorted(t)},_binarySearch:function(t,n,r){var i,s,o,u;return n===r?n:(u=e(this,"arrangedContent"),i=n+Math.floor((r-n)/2),s=u.objectAt(i),o=this.orderBy(s,t),o<0?this._binarySearch(t,i+1,r):o>0?this._binarySearch(t,n,i):i)}})}(),function(){var e=Ember.get,t=Ember.set,n=Ember.EnumerableUtils.forEach,r=Ember.EnumerableUtils.replace;Ember.ArrayController=Ember.ArrayProxy.extend(Ember.ControllerMixin,Ember.SortableMixin,{itemController:null,lookupItemController:function(t){return e(this,"itemController")},objectAtContent:function(t){var n=e(this,"length"),r=e(this,"arrangedContent"),i=r&&r.objectAt(t);if(t>=0&&t<n){var s=this.lookupItemController(i);if(s)return this.controllerAt(t,i,s)}return i},arrangedContentDidChange:function(){this._super(),this._resetSubControllers()},arrayContentDidChange:function(t,i,s){var o=e(this,"_subControllers"),u=o.slice(t,t+i);n(u,function(e){e&&e.destroy()}),r(o,t,i,new Array(s)),this._super(t,i,s)},init:function(){this.get("content")||Ember.defineProperty(this,"content",undefined,Ember.A()),this._super(),this.set("_subControllers",Ember.A())},controllerAt:function(t,n,r){var i=e(this,"container"),s=e(this,"_subControllers"),o=s[t];o||(o=i.lookup("controller:"+r,{singleton:!1}),s[t]=o);if(!o)throw new Error('Could not resolve itemController: "'+r+'"');return o.set("target",this),o.set("content",n),o},_subControllers:null,_resetSubControllers:function(){var t=e(this,"_subControllers");n(t,function(e){e&&e.destroy()}),this.set("_subControllers",Ember.A())}})}(),function(){Ember.ObjectController=Ember.ObjectProxy.extend(Ember.ControllerMixin)}(),function(){}(),function(){}(),function(){var e=Ember.get,t=Ember.set;Ember.State=Ember.Object.extend(Ember.Evented,{isState:!0,parentState:null,start:null,name:null,path:Ember.computed(function(){var t=e(this,"parentState.path"),n=e(this,"name");return t&&(n=t+"."+n),n}),trigger:function(e){this[e]&&this[e].apply(this,[].slice.call(arguments,1)),this._super.apply(this,arguments)},init:function(){var n=e(this,"states");t(this,"childStates",Ember.A()),t(this,"eventTransitions",e(this,"eventTransitions")||{});var r,i,s;if(!n){n={};for(r in this){if(r==="constructor")continue;if(i=this[r]){if(s=i.transitionTarget)this.eventTransitions[r]=s;this.setupChild(n,r,i)}}t(this,"states",n)}else for(r in n)this.setupChild(n,r,n[r]);t(this,"pathsCache",{}),t(this,"pathsCacheNoContext",{})},setupChild:function(n,r,i){if(!i)return!1;i.isState?t(i,"name",r):Ember.State.detect(i)&&(i=i.create({name:r}));if(i.isState)return t(i,"parentState",this),e(this,"childStates").pushObject(i),n[r]=i,i},lookupEventTransition:function(e){var t,n=this;while(n&&!t)t=n.eventTransitions[e],n=n.get("parentState");return t},isLeaf:Ember.computed(function(){return!e(this,"childStates").length}),hasContext:!0,setup:Ember.K,enter:Ember.K,exit:Ember.K}),Ember.State.reopenClass({transitionTo:function(e){var t=function(t,n){var r=[],i=Ember.$&&Ember.$.Event;n&&i&&n instanceof i?n.hasOwnProperty("contexts")&&(r=n.contexts.slice()):r=[].slice.call(arguments,1),r.unshift(e),t.transitionTo.apply(t,r)};return t.transitionTarget=e,t}})}(),function(){var e=Ember.get,t=Ember.set,n=Ember.String.fmt,r=Ember.ArrayPolyfills.forEach,i=function(e){this.enterStates=e.enterStates.slice(),this.exitStates=e.exitStates.slice(),this.resolveState=e.resolveState,this.finalState=e.enterStates[e.enterStates.length-1]||e.resolveState};i.prototype={normalize:function(e,t){return this.matchContextsToStates(t),this.addInitialStates(),this.removeUnchangedContexts(e),this},matchContextsToStates:function(t){var n=this.enterStates.length-1,r=[],i,s;while(t.length>0){if(n>=0)i=this.enterStates[n--];else{if(this.enterStates.length){i=e(this.enterStates[0],"parentState");if(!i)throw"Cannot match all contexts to states"}else i=this.resolveState;this.enterStates.unshift(i),this.exitStates.unshift(i)}e(i,"hasContext")?s=t.pop():s=null,r.unshift(s)}this.contexts=r},addInitialStates:function(){var t=this.finalState,n;for(;;){n=e(t,"initialState")||"start",t=e(t,"states."+n);if(!t)break;this.finalState=t,this.enterStates.push(t),this.contexts.push(undefined)}},removeUnchangedContexts:function(e){while(this.enterStates.length>0){if(this.enterStates[0]!==this.exitStates[0])break;if(this.enterStates.length===this.contexts.length){if(e.getStateMeta(this.enterStates[0],"context")!==this.contexts[0])break;this.contexts.shift()}this.resolveState=this.enterStates.shift(),this.exitStates.shift()}}};var s=function(t,r,i){var u=this.enableLogging,a=i?"unhandledEvent":t,f=r[a],l,c,h;l=[].slice.call(arguments,3);if(typeof f=="function")return u&&(i?Ember.Logger.log(n("STATEMANAGER: Unhandled event '%@' being sent to state %@.",[t,e(r,"path")])):Ember.Logger.log(n("STATEMANAGER: Sending event '%@' to state %@.",[t,e(r,"path")]))),h=l,i&&h.unshift(t),h.unshift(this),f.apply(r,h);var p=e(r,"parentState");if(p)return c=l,c.unshift(t,p,i),s.apply(this,c);if(!i)return o.call(this,t,l,!0)},o=function(t,n,r){return n.unshift(t,e(this,"currentState"),r),s.apply(this,n)};Ember.StateManager=Ember.State.extend({init:function(){this._super(),t(this,"stateMeta",Ember.Map.create());var n=e(this,"initialState");!n&&e(this,"states.start")&&(n="start"),n&&this.transitionTo(n)},stateMetaFor:function(t){var n=e(this,"stateMeta"),r=n.get(t);return r||(r={},n.set(t,r)),r},setStateMeta:function(e,n,r){return t(this.stateMetaFor(e),n,r)},getStateMeta:function(t,n){return e(this.stateMetaFor(t),n)},currentState:null,currentPath:Ember.computed.alias("currentState.path"),transitionEvent:"setup",errorOnUnhandledEvent:!0,send:function(e){var t=[].slice.call(arguments,1);return o.call(this,e,t,!1)},unhandledEvent:function(t,n){if(e(this,"errorOnUnhandledEvent"))throw new Ember.Error(this.toString()+" could not respond to event "+n+" in state "+e(this,"currentState.path")+".")},getStateByPath:function(t,n){var r=n.split("."),i=t;for(var s=0,o=r.length;s<o;s++){i=e(e(i,"states"),r[s]);if(!i)break}return i},findStateByPath:function(t,n){var r;while(!r&&t)r=this.getStateByPath(t,n),t=e(t,"parentState");return r},getStatesInPath:function(t,n){if(!n||n==="")return undefined;var r=n.split("."),i=[],s,o;for(var u=0,a=r.length;u<a;u++){s=e(t,"states");if(!s)return undefined;o=e(s,r[u]);if(!o)return undefined;t=o,i.push(o)}return i},goToState:function(){return this.transitionTo.apply(this,arguments)},transitionTo:function(t,n){if(Ember.isEmpty(t))return;var r=n?Array.prototype.slice.call(arguments,1):[],s=e(this,"currentState")||this,o=this.contextFreeTransition(s,t),u=(new i(o)).normalize(this,r);this.enterState(u),this.triggerSetupContext(u)},contextFreeTransition:function(t,n){var r=t.pathsCache[n];if(r)return r;var i=this.getStatesInPath(t,n),s=[],o=t;while(o&&!i){s.unshift(o),o=e(o,"parentState");if(!o){i=this.getStatesInPath(this,n);if(!i)return}i=this.getStatesInPath(o,n)}while(i.length>0&&i[0]===s[0])o=i.shift(),s.shift();var u=t.pathsCache[n]={exitStates:s,enterStates:i,resolveState:o};return u},triggerSetupContext:function(t){var n=t.contexts,i=t.enterStates.length-n.length,s=t.enterStates,o=e(this,"transitionEvent");r.call(s,function(e,t){e.trigger(o,this,n[t-i])},this)},getState:function(t){var n=e(this,t),r=e(this,"parentState");if(n)return n;if(r)return r.getState(t)},enterState:function(n){var i=this.enableLogging,s=n.exitStates.slice(0).reverse();r.call(s,function(e){e.trigger("exit",this)},this),r.call(n.enterStates,function(t){i&&Ember.Logger.log("STATEMANAGER: Entering "+e(t,"path")),t.trigger("enter",this)},this),t(this,"currentState",n.finalState)}})}(),function(){}()})(),typeof location!="undefined"&&(location.hostname==="localhost"||location.hostname==="127.0.0.1")&&console.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. If you want full error messages please use the non-minified build provided on the Ember website.");
@@ -477,6 +477,159 @@ if (Ember.ENV.MANDATORY_SETTER && !platform.hasPropertyAccessors) {
477
477
 
478
478
 
479
479
 
480
+ (function() {
481
+ var utils = Ember.EnumerableUtils = {
482
+ map: function(obj, callback, thisArg) {
483
+ return obj.map ? obj.map.call(obj, callback, thisArg) : Array.prototype.map.call(obj, callback, thisArg);
484
+ },
485
+
486
+ forEach: function(obj, callback, thisArg) {
487
+ return obj.forEach ? obj.forEach.call(obj, callback, thisArg) : Array.prototype.forEach.call(obj, callback, thisArg);
488
+ },
489
+
490
+ indexOf: function(obj, element, index) {
491
+ return obj.indexOf ? obj.indexOf.call(obj, element, index) : Array.prototype.indexOf.call(obj, element, index);
492
+ },
493
+
494
+ indexesOf: function(obj, elements) {
495
+ return elements === undefined ? [] : utils.map(elements, function(item) {
496
+ return utils.indexOf(obj, item);
497
+ });
498
+ },
499
+
500
+ addObject: function(array, item) {
501
+ var index = utils.indexOf(array, item);
502
+ if (index === -1) { array.push(item); }
503
+ },
504
+
505
+ removeObject: function(array, item) {
506
+ var index = utils.indexOf(array, item);
507
+ if (index !== -1) { array.splice(index, 1); }
508
+ },
509
+
510
+ replace: function(array, idx, amt, objects) {
511
+ if (array.replace) {
512
+ return array.replace(idx, amt, objects);
513
+ } else {
514
+ var args = Array.prototype.concat.apply([idx, amt], objects);
515
+ return array.splice.apply(array, args);
516
+ }
517
+ },
518
+
519
+ intersection: function(array1, array2) {
520
+ var intersection = [];
521
+
522
+ array1.forEach(function(element) {
523
+ if (array2.indexOf(element) >= 0) {
524
+ intersection.push(element);
525
+ }
526
+ });
527
+
528
+ return intersection;
529
+ }
530
+ };
531
+
532
+ })();
533
+
534
+
535
+
536
+ (function() {
537
+ /*jshint newcap:false*/
538
+ /**
539
+ @module ember-metal
540
+ */
541
+
542
+ // NOTE: There is a bug in jshint that doesn't recognize `Object()` without `new`
543
+ // as being ok unless both `newcap:false` and not `use strict`.
544
+ // https://github.com/jshint/jshint/issues/392
545
+
546
+ // Testing this is not ideal, but we want to use native functions
547
+ // if available, but not to use versions created by libraries like Prototype
548
+ var isNativeFunc = function(func) {
549
+ // This should probably work in all browsers likely to have ES5 array methods
550
+ return func && Function.prototype.toString.call(func).indexOf('[native code]') > -1;
551
+ };
552
+
553
+ // From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/map
554
+ var arrayMap = isNativeFunc(Array.prototype.map) ? Array.prototype.map : function(fun /*, thisp */) {
555
+ //"use strict";
556
+
557
+ if (this === void 0 || this === null) {
558
+ throw new TypeError();
559
+ }
560
+
561
+ var t = Object(this);
562
+ var len = t.length >>> 0;
563
+ if (typeof fun !== "function") {
564
+ throw new TypeError();
565
+ }
566
+
567
+ var res = new Array(len);
568
+ var thisp = arguments[1];
569
+ for (var i = 0; i < len; i++) {
570
+ if (i in t) {
571
+ res[i] = fun.call(thisp, t[i], i, t);
572
+ }
573
+ }
574
+
575
+ return res;
576
+ };
577
+
578
+ // From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach
579
+ var arrayForEach = isNativeFunc(Array.prototype.forEach) ? Array.prototype.forEach : function(fun /*, thisp */) {
580
+ //"use strict";
581
+
582
+ if (this === void 0 || this === null) {
583
+ throw new TypeError();
584
+ }
585
+
586
+ var t = Object(this);
587
+ var len = t.length >>> 0;
588
+ if (typeof fun !== "function") {
589
+ throw new TypeError();
590
+ }
591
+
592
+ var thisp = arguments[1];
593
+ for (var i = 0; i < len; i++) {
594
+ if (i in t) {
595
+ fun.call(thisp, t[i], i, t);
596
+ }
597
+ }
598
+ };
599
+
600
+ var arrayIndexOf = isNativeFunc(Array.prototype.indexOf) ? Array.prototype.indexOf : function (obj, fromIndex) {
601
+ if (fromIndex === null || fromIndex === undefined) { fromIndex = 0; }
602
+ else if (fromIndex < 0) { fromIndex = Math.max(0, this.length + fromIndex); }
603
+ for (var i = fromIndex, j = this.length; i < j; i++) {
604
+ if (this[i] === obj) { return i; }
605
+ }
606
+ return -1;
607
+ };
608
+
609
+ Ember.ArrayPolyfills = {
610
+ map: arrayMap,
611
+ forEach: arrayForEach,
612
+ indexOf: arrayIndexOf
613
+ };
614
+
615
+ if (Ember.SHIM_ES5) {
616
+ if (!Array.prototype.map) {
617
+ Array.prototype.map = arrayMap;
618
+ }
619
+
620
+ if (!Array.prototype.forEach) {
621
+ Array.prototype.forEach = arrayForEach;
622
+ }
623
+
624
+ if (!Array.prototype.indexOf) {
625
+ Array.prototype.indexOf = arrayIndexOf;
626
+ }
627
+ }
628
+
629
+ })();
630
+
631
+
632
+
480
633
  (function() {
481
634
  /**
482
635
  @module ember-metal
@@ -879,7 +1032,7 @@ Ember.canInvoke = canInvoke;
879
1032
  @param {Object} obj The object to check for the method
880
1033
  @param {String} methodName The method name to check for
881
1034
  @param {Array} [args] The arguments to pass to the method
882
- @return {anything} the return value of the invoked method or undefined if it cannot be invoked
1035
+ @return {*} the return value of the invoked method or undefined if it cannot be invoked
883
1036
  */
884
1037
  Ember.tryInvoke = function(obj, methodName, args) {
885
1038
  if (canInvoke(obj, methodName)) {
@@ -910,7 +1063,7 @@ var needsFinallyFix = (function() {
910
1063
  @param {Function} tryable The function to run the try callback
911
1064
  @param {Function} finalizer The function to run the finally callback
912
1065
  @param [binding]
913
- @return {anything} The return value is the that of the finalizer,
1066
+ @return {*} The return value is the that of the finalizer,
914
1067
  unless that valueis undefined, in which case it is the return value
915
1068
  of the tryable
916
1069
  */
@@ -961,7 +1114,7 @@ if (needsFinallyFix) {
961
1114
  @param {Function} catchable The function to run the catchable callback
962
1115
  @param {Function} finalizer The function to run the finally callback
963
1116
  @param [binding]
964
- @return {anything} The return value is the that of the finalizer,
1117
+ @return {*} The return value is the that of the finalizer,
965
1118
  unless that value is undefined, in which case it is the return value
966
1119
  of the tryable.
967
1120
  */
@@ -1005,6 +1158,78 @@ if (needsFinallyFix) {
1005
1158
  };
1006
1159
  }
1007
1160
 
1161
+ // ........................................
1162
+ // TYPING & ARRAY MESSAGING
1163
+ //
1164
+
1165
+ var TYPE_MAP = {};
1166
+ var t = "Boolean Number String Function Array Date RegExp Object".split(" ");
1167
+ Ember.ArrayPolyfills.forEach.call(t, function(name) {
1168
+ TYPE_MAP[ "[object " + name + "]" ] = name.toLowerCase();
1169
+ });
1170
+
1171
+ var toString = Object.prototype.toString;
1172
+
1173
+ /**
1174
+ Returns a consistent type for the passed item.
1175
+
1176
+ Use this instead of the built-in `typeof` to get the type of an item.
1177
+ It will return the same result across all browsers and includes a bit
1178
+ more detail. Here is what will be returned:
1179
+
1180
+ | Return Value | Meaning |
1181
+ |---------------|------------------------------------------------------|
1182
+ | 'string' | String primitive |
1183
+ | 'number' | Number primitive |
1184
+ | 'boolean' | Boolean primitive |
1185
+ | 'null' | Null value |
1186
+ | 'undefined' | Undefined value |
1187
+ | 'function' | A function |
1188
+ | 'array' | An instance of Array |
1189
+ | 'class' | An Ember class (created using Ember.Object.extend()) |
1190
+ | 'instance' | An Ember object instance |
1191
+ | 'error' | An instance of the Error object |
1192
+ | 'object' | A JavaScript object not inheriting from Ember.Object |
1193
+
1194
+ Examples:
1195
+
1196
+ ```javascript
1197
+ Ember.typeOf(); // 'undefined'
1198
+ Ember.typeOf(null); // 'null'
1199
+ Ember.typeOf(undefined); // 'undefined'
1200
+ Ember.typeOf('michael'); // 'string'
1201
+ Ember.typeOf(101); // 'number'
1202
+ Ember.typeOf(true); // 'boolean'
1203
+ Ember.typeOf(Ember.makeArray); // 'function'
1204
+ Ember.typeOf([1,2,90]); // 'array'
1205
+ Ember.typeOf(Ember.Object.extend()); // 'class'
1206
+ Ember.typeOf(Ember.Object.create()); // 'instance'
1207
+ Ember.typeOf(new Error('teamocil')); // 'error'
1208
+
1209
+ // "normal" JavaScript object
1210
+ Ember.typeOf({a: 'b'}); // 'object'
1211
+ ```
1212
+
1213
+ @method typeOf
1214
+ @for Ember
1215
+ @param {Object} item the item to check
1216
+ @return {String} the type
1217
+ */
1218
+ Ember.typeOf = function(item) {
1219
+ var ret;
1220
+
1221
+ ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object';
1222
+
1223
+ if (ret === 'function') {
1224
+ if (Ember.Object && Ember.Object.detect(item)) ret = 'class';
1225
+ } else if (ret === 'object') {
1226
+ if (item instanceof Error) ret = 'error';
1227
+ else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';
1228
+ else ret = 'object';
1229
+ }
1230
+
1231
+ return ret;
1232
+ };
1008
1233
  })();
1009
1234
 
1010
1235
 
@@ -1185,178 +1410,25 @@ Ember.subscribe = Ember.Instrumentation.subscribe;
1185
1410
 
1186
1411
 
1187
1412
  (function() {
1188
- var utils = Ember.EnumerableUtils = {
1189
- map: function(obj, callback, thisArg) {
1190
- return obj.map ? obj.map.call(obj, callback, thisArg) : Array.prototype.map.call(obj, callback, thisArg);
1191
- },
1413
+ /**
1414
+ @module ember-metal
1415
+ */
1192
1416
 
1193
- forEach: function(obj, callback, thisArg) {
1194
- return obj.forEach ? obj.forEach.call(obj, callback, thisArg) : Array.prototype.forEach.call(obj, callback, thisArg);
1195
- },
1417
+ /*
1418
+ JavaScript (before ES6) does not have a Map implementation. Objects,
1419
+ which are often used as dictionaries, may only have Strings as keys.
1196
1420
 
1197
- indexOf: function(obj, element, index) {
1198
- return obj.indexOf ? obj.indexOf.call(obj, element, index) : Array.prototype.indexOf.call(obj, element, index);
1199
- },
1421
+ Because Ember has a way to get a unique identifier for every object
1422
+ via `Ember.guidFor`, we can implement a performant Map with arbitrary
1423
+ keys. Because it is commonly used in low-level bookkeeping, Map is
1424
+ implemented as a pure JavaScript object for performance.
1200
1425
 
1201
- indexesOf: function(obj, elements) {
1202
- return elements === undefined ? [] : utils.map(elements, function(item) {
1203
- return utils.indexOf(obj, item);
1204
- });
1205
- },
1206
-
1207
- addObject: function(array, item) {
1208
- var index = utils.indexOf(array, item);
1209
- if (index === -1) { array.push(item); }
1210
- },
1211
-
1212
- removeObject: function(array, item) {
1213
- var index = utils.indexOf(array, item);
1214
- if (index !== -1) { array.splice(index, 1); }
1215
- },
1216
-
1217
- replace: function(array, idx, amt, objects) {
1218
- if (array.replace) {
1219
- return array.replace(idx, amt, objects);
1220
- } else {
1221
- var args = Array.prototype.concat.apply([idx, amt], objects);
1222
- return array.splice.apply(array, args);
1223
- }
1224
- },
1225
-
1226
- intersection: function(array1, array2) {
1227
- var intersection = [];
1228
-
1229
- array1.forEach(function(element) {
1230
- if (array2.indexOf(element) >= 0) {
1231
- intersection.push(element);
1232
- }
1233
- });
1234
-
1235
- return intersection;
1236
- }
1237
- };
1238
-
1239
- })();
1240
-
1241
-
1242
-
1243
- (function() {
1244
- /*jshint newcap:false*/
1245
- /**
1246
- @module ember-metal
1247
- */
1248
-
1249
- // NOTE: There is a bug in jshint that doesn't recognize `Object()` without `new`
1250
- // as being ok unless both `newcap:false` and not `use strict`.
1251
- // https://github.com/jshint/jshint/issues/392
1252
-
1253
- // Testing this is not ideal, but we want to use native functions
1254
- // if available, but not to use versions created by libraries like Prototype
1255
- var isNativeFunc = function(func) {
1256
- // This should probably work in all browsers likely to have ES5 array methods
1257
- return func && Function.prototype.toString.call(func).indexOf('[native code]') > -1;
1258
- };
1259
-
1260
- // From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/map
1261
- var arrayMap = isNativeFunc(Array.prototype.map) ? Array.prototype.map : function(fun /*, thisp */) {
1262
- //"use strict";
1263
-
1264
- if (this === void 0 || this === null) {
1265
- throw new TypeError();
1266
- }
1267
-
1268
- var t = Object(this);
1269
- var len = t.length >>> 0;
1270
- if (typeof fun !== "function") {
1271
- throw new TypeError();
1272
- }
1273
-
1274
- var res = new Array(len);
1275
- var thisp = arguments[1];
1276
- for (var i = 0; i < len; i++) {
1277
- if (i in t) {
1278
- res[i] = fun.call(thisp, t[i], i, t);
1279
- }
1280
- }
1281
-
1282
- return res;
1283
- };
1284
-
1285
- // From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach
1286
- var arrayForEach = isNativeFunc(Array.prototype.forEach) ? Array.prototype.forEach : function(fun /*, thisp */) {
1287
- //"use strict";
1288
-
1289
- if (this === void 0 || this === null) {
1290
- throw new TypeError();
1291
- }
1292
-
1293
- var t = Object(this);
1294
- var len = t.length >>> 0;
1295
- if (typeof fun !== "function") {
1296
- throw new TypeError();
1297
- }
1298
-
1299
- var thisp = arguments[1];
1300
- for (var i = 0; i < len; i++) {
1301
- if (i in t) {
1302
- fun.call(thisp, t[i], i, t);
1303
- }
1304
- }
1305
- };
1306
-
1307
- var arrayIndexOf = isNativeFunc(Array.prototype.indexOf) ? Array.prototype.indexOf : function (obj, fromIndex) {
1308
- if (fromIndex === null || fromIndex === undefined) { fromIndex = 0; }
1309
- else if (fromIndex < 0) { fromIndex = Math.max(0, this.length + fromIndex); }
1310
- for (var i = fromIndex, j = this.length; i < j; i++) {
1311
- if (this[i] === obj) { return i; }
1312
- }
1313
- return -1;
1314
- };
1315
-
1316
- Ember.ArrayPolyfills = {
1317
- map: arrayMap,
1318
- forEach: arrayForEach,
1319
- indexOf: arrayIndexOf
1320
- };
1321
-
1322
- if (Ember.SHIM_ES5) {
1323
- if (!Array.prototype.map) {
1324
- Array.prototype.map = arrayMap;
1325
- }
1326
-
1327
- if (!Array.prototype.forEach) {
1328
- Array.prototype.forEach = arrayForEach;
1329
- }
1330
-
1331
- if (!Array.prototype.indexOf) {
1332
- Array.prototype.indexOf = arrayIndexOf;
1333
- }
1334
- }
1335
-
1336
- })();
1337
-
1338
-
1339
-
1340
- (function() {
1341
- /**
1342
- @module ember-metal
1343
- */
1344
-
1345
- /*
1346
- JavaScript (before ES6) does not have a Map implementation. Objects,
1347
- which are often used as dictionaries, may only have Strings as keys.
1348
-
1349
- Because Ember has a way to get a unique identifier for every object
1350
- via `Ember.guidFor`, we can implement a performant Map with arbitrary
1351
- keys. Because it is commonly used in low-level bookkeeping, Map is
1352
- implemented as a pure JavaScript object for performance.
1353
-
1354
- This implementation follows the current iteration of the ES6 proposal for
1355
- maps (http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets),
1356
- with two exceptions. First, because we need our implementation to be pleasant
1357
- on older browsers, we do not use the `delete` name (using `remove` instead).
1358
- Second, as we do not have the luxury of in-VM iteration, we implement a
1359
- forEach method for iteration.
1426
+ This implementation follows the current iteration of the ES6 proposal for
1427
+ maps (http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets),
1428
+ with two exceptions. First, because we need our implementation to be pleasant
1429
+ on older browsers, we do not use the `delete` name (using `remove` instead).
1430
+ Second, as we do not have the luxury of in-VM iteration, we implement a
1431
+ forEach method for iteration.
1360
1432
 
1361
1433
  Map is mocked out to look like an Ember object, so you can do
1362
1434
  `Ember.Map.create()` for symmetry with other Ember classes.
@@ -1543,8 +1615,8 @@ Map.prototype = {
1543
1615
  Retrieve the value associated with a given key.
1544
1616
 
1545
1617
  @method get
1546
- @param {anything} key
1547
- @return {anything} the value associated with the key, or `undefined`
1618
+ @param {*} key
1619
+ @return {*} the value associated with the key, or `undefined`
1548
1620
  */
1549
1621
  get: function(key) {
1550
1622
  var values = this.values,
@@ -1558,8 +1630,8 @@ Map.prototype = {
1558
1630
  provided, the new value will replace the old value.
1559
1631
 
1560
1632
  @method set
1561
- @param {anything} key
1562
- @param {anything} value
1633
+ @param {*} key
1634
+ @param {*} value
1563
1635
  */
1564
1636
  set: function(key, value) {
1565
1637
  var keys = this.keys,
@@ -1574,7 +1646,7 @@ Map.prototype = {
1574
1646
  Removes a value from the map for an associated key.
1575
1647
 
1576
1648
  @method remove
1577
- @param {anything} key
1649
+ @param {*} key
1578
1650
  @return {Boolean} true if an item was removed, false otherwise
1579
1651
  */
1580
1652
  remove: function(key) {
@@ -1599,7 +1671,7 @@ Map.prototype = {
1599
1671
  Check whether a key is present.
1600
1672
 
1601
1673
  @method has
1602
- @param {anything} key
1674
+ @param {*} key
1603
1675
  @return {Boolean} true if the item was present, false otherwise
1604
1676
  */
1605
1677
  has: function(key) {
@@ -1617,7 +1689,7 @@ Map.prototype = {
1617
1689
 
1618
1690
  @method forEach
1619
1691
  @param {Function} callback
1620
- @param {anything} self if passed, the `this` value inside the
1692
+ @param {*} self if passed, the `this` value inside the
1621
1693
  callback. By default, `this` is the map.
1622
1694
  */
1623
1695
  forEach: function(callback, self) {
@@ -1646,7 +1718,7 @@ Map.prototype = {
1646
1718
  @private
1647
1719
  @constructor
1648
1720
  @param [options]
1649
- @param {anything} [options.defaultValue]
1721
+ @param {*} [options.defaultValue]
1650
1722
  */
1651
1723
  var MapWithDefault = Ember.MapWithDefault = function(options) {
1652
1724
  Map.call(this);
@@ -1657,7 +1729,7 @@ var MapWithDefault = Ember.MapWithDefault = function(options) {
1657
1729
  @method create
1658
1730
  @static
1659
1731
  @param [options]
1660
- @param {anything} [options.defaultValue]
1732
+ @param {*} [options.defaultValue]
1661
1733
  @return {Ember.MapWithDefault|Ember.Map} If options are passed, returns
1662
1734
  `Ember.MapWithDefault` otherwise returns `Ember.Map`
1663
1735
  */
@@ -1675,8 +1747,8 @@ MapWithDefault.prototype = Ember.create(Map.prototype);
1675
1747
  Retrieve the value associated with a given key.
1676
1748
 
1677
1749
  @method get
1678
- @param {anything} key
1679
- @return {anything} the value associated with the key, or the default value
1750
+ @param {*} key
1751
+ @return {*} the value associated with the key, or the default value
1680
1752
  */
1681
1753
  MapWithDefault.prototype.get = function(key) {
1682
1754
  var hasValue = this.has(key);
@@ -1709,11 +1781,10 @@ MapWithDefault.prototype.copy = function() {
1709
1781
  @module ember-metal
1710
1782
  */
1711
1783
 
1712
- var META_KEY = Ember.META_KEY, get, set;
1784
+ var META_KEY = Ember.META_KEY, get;
1713
1785
 
1714
1786
  var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
1715
1787
 
1716
- var IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/;
1717
1788
  var IS_GLOBAL_PATH = /^([A-Z$]|([0-9][A-Z$])).*[\.\*]/;
1718
1789
  var HAS_THIS = /^this[\.\*]/;
1719
1790
  var FIRST_KEY = /^([^\.\*]+)/;
@@ -1785,89 +1856,11 @@ get = function get(obj, keyName) {
1785
1856
  }
1786
1857
  };
1787
1858
 
1788
- /**
1789
- Sets the value of a property on an object, respecting computed properties
1790
- and notifying observers and other listeners of the change. If the
1791
- property is not defined but the object implements the `unknownProperty`
1792
- method then that will be invoked as well.
1793
-
1794
- If you plan to run on IE8 and older browsers then you should use this
1795
- method anytime you want to set a property on an object that you don't
1796
- know for sure is private. (Properties beginning with an underscore '_'
1797
- are considered private.)
1798
-
1799
- On all newer browsers, you only need to use this method to set
1800
- properties if the property might not be defined on the object and you want
1801
- to respect the `unknownProperty` handler. Otherwise you can ignore this
1802
- method.
1803
-
1804
- @method set
1805
- @for Ember
1806
- @param {Object} obj The object to modify.
1807
- @param {String} keyName The property key to set
1808
- @param {Object} value The value to set
1809
- @return {Object} the passed value.
1810
- */
1811
- set = function set(obj, keyName, value, tolerant) {
1812
- if (typeof obj === 'string') {
1813
-
1814
- value = keyName;
1815
- keyName = obj;
1816
- obj = null;
1817
- }
1818
-
1819
- if (!obj || keyName.indexOf('.') !== -1) {
1820
- return setPath(obj, keyName, value, tolerant);
1821
- }
1822
-
1823
-
1824
-
1825
- var meta = obj[META_KEY], desc = meta && meta.descs[keyName],
1826
- isUnknown, currentValue;
1827
- if (desc) {
1828
- desc.set(obj, keyName, value);
1829
- } else {
1830
- isUnknown = 'object' === typeof obj && !(keyName in obj);
1831
-
1832
- // setUnknownProperty is called if `obj` is an object,
1833
- // the property does not already exist, and the
1834
- // `setUnknownProperty` method exists on the object
1835
- if (isUnknown && 'function' === typeof obj.setUnknownProperty) {
1836
- obj.setUnknownProperty(keyName, value);
1837
- } else if (meta && meta.watching[keyName] > 0) {
1838
- if (MANDATORY_SETTER) {
1839
- currentValue = meta.values[keyName];
1840
- } else {
1841
- currentValue = obj[keyName];
1842
- }
1843
- // only trigger a change if the value has changed
1844
- if (value !== currentValue) {
1845
- Ember.propertyWillChange(obj, keyName);
1846
- if (MANDATORY_SETTER) {
1847
- if (currentValue === undefined && !(keyName in obj)) {
1848
- Ember.defineProperty(obj, keyName, null, value); // setup mandatory setter
1849
- } else {
1850
- meta.values[keyName] = value;
1851
- }
1852
- } else {
1853
- obj[keyName] = value;
1854
- }
1855
- Ember.propertyDidChange(obj, keyName);
1856
- }
1857
- } else {
1858
- obj[keyName] = value;
1859
- }
1860
- }
1861
- return value;
1862
- };
1863
-
1864
1859
  // Currently used only by Ember Data tests
1865
1860
  if (Ember.config.overrideAccessors) {
1866
1861
  Ember.get = get;
1867
- Ember.set = set;
1868
1862
  Ember.config.overrideAccessors();
1869
1863
  get = Ember.get;
1870
- set = Ember.set;
1871
1864
  }
1872
1865
 
1873
1866
  function firstKey(path) {
@@ -1895,7 +1888,7 @@ function normalizeTuple(target, path) {
1895
1888
  return [ target, path ];
1896
1889
  }
1897
1890
 
1898
- function getPath(root, path) {
1891
+ var getPath = Ember._getPath = function(root, path) {
1899
1892
  var hasThis, parts, tuple, idx, len;
1900
1893
 
1901
1894
  // If there is no root and path is a key name, return that
@@ -1920,52 +1913,25 @@ function getPath(root, path) {
1920
1913
  if (root && root.isDestroyed) { return undefined; }
1921
1914
  }
1922
1915
  return root;
1923
- }
1916
+ };
1924
1917
 
1925
- function setPath(root, path, value, tolerant) {
1926
- var keyName;
1918
+ /**
1919
+ @private
1927
1920
 
1928
- // get the last part of the path
1929
- keyName = path.slice(path.lastIndexOf('.') + 1);
1921
+ Normalizes a target/path pair to reflect that actual target/path that should
1922
+ be observed, etc. This takes into account passing in global property
1923
+ paths (i.e. a path beginning with a captial letter not defined on the
1924
+ target) and * separators.
1930
1925
 
1931
- // get the first part of the part
1932
- path = path.slice(0, path.length-(keyName.length+1));
1933
-
1934
- // unless the path is this, look up the first part to
1935
- // get the root
1936
- if (path !== 'this') {
1937
- root = getPath(root, path);
1938
- }
1939
-
1940
- if (!keyName || keyName.length === 0) {
1941
- throw new Error('You passed an empty path');
1942
- }
1943
-
1944
- if (!root) {
1945
- if (tolerant) { return; }
1946
- else { throw new Error('Object in path '+path+' could not be found or was destroyed.'); }
1947
- }
1948
-
1949
- return set(root, keyName, value);
1950
- }
1951
-
1952
- /**
1953
- @private
1954
-
1955
- Normalizes a target/path pair to reflect that actual target/path that should
1956
- be observed, etc. This takes into account passing in global property
1957
- paths (i.e. a path beginning with a captial letter not defined on the
1958
- target) and * separators.
1959
-
1960
- @method normalizeTuple
1961
- @for Ember
1962
- @param {Object} target The current target. May be `null`.
1963
- @param {String} path A path on the target or a global property path.
1964
- @return {Array} a temporary array with the normalized target/path pair.
1965
- */
1966
- Ember.normalizeTuple = function(target, path) {
1967
- return normalizeTuple(target, path);
1968
- };
1926
+ @method normalizeTuple
1927
+ @for Ember
1928
+ @param {Object} target The current target. May be `null`.
1929
+ @param {String} path A path on the target or a global property path.
1930
+ @return {Array} a temporary array with the normalized target/path pair.
1931
+ */
1932
+ Ember.normalizeTuple = function(target, path) {
1933
+ return normalizeTuple(target, path);
1934
+ };
1969
1935
 
1970
1936
  Ember.getWithDefault = function(root, key, defaultValue) {
1971
1937
  var value = get(root, key);
@@ -1977,215 +1943,393 @@ Ember.getWithDefault = function(root, key, defaultValue) {
1977
1943
 
1978
1944
  Ember.get = get;
1979
1945
  Ember.getPath = Ember.deprecateFunc('getPath is deprecated since get now supports paths', Ember.get);
1946
+ })();
1947
+
1980
1948
 
1981
- Ember.set = set;
1982
- Ember.setPath = Ember.deprecateFunc('setPath is deprecated since set now supports paths', Ember.set);
1983
1949
 
1950
+ (function() {
1984
1951
  /**
1985
- Error-tolerant form of `Ember.set`. Will not blow up if any part of the
1986
- chain is `undefined`, `null`, or destroyed.
1952
+ @module ember-metal
1953
+ */
1987
1954
 
1988
- This is primarily used when syncing bindings, which may try to update after
1989
- an object has been destroyed.
1955
+ var o_create = Ember.create,
1956
+ metaFor = Ember.meta,
1957
+ META_KEY = Ember.META_KEY;
1990
1958
 
1991
- @method trySet
1992
- @for Ember
1993
- @param {Object} obj The object to modify.
1994
- @param {String} path The property path to set
1995
- @param {Object} value The value to set
1996
- */
1997
- Ember.trySet = function(root, path, value) {
1998
- return set(root, path, value, true);
1999
- };
2000
- Ember.trySetPath = Ember.deprecateFunc('trySetPath has been renamed to trySet', Ember.trySet);
1959
+ /*
1960
+ The event system uses a series of nested hashes to store listeners on an
1961
+ object. When a listener is registered, or when an event arrives, these
1962
+ hashes are consulted to determine which target and action pair to invoke.
2001
1963
 
2002
- /**
2003
- Returns true if the provided path is global (e.g., `MyApp.fooController.bar`)
2004
- instead of local (`foo.bar.baz`).
1964
+ The hashes are stored in the object's meta hash, and look like this:
1965
+
1966
+ // Object's meta hash
1967
+ {
1968
+ listeners: { // variable name: `listenerSet`
1969
+ "foo:changed": [ // variable name: `actions`
1970
+ [target, method, onceFlag, suspendedFlag]
1971
+ ]
1972
+ }
1973
+ }
2005
1974
 
2006
- @method isGlobalPath
2007
- @for Ember
2008
- @private
2009
- @param {String} path
2010
- @return Boolean
2011
1975
  */
2012
- Ember.isGlobalPath = function(path) {
2013
- return IS_GLOBAL.test(path);
2014
- };
2015
1976
 
1977
+ function indexOf(array, target, method) {
1978
+ var index = -1;
1979
+ for (var i = 0, l = array.length; i < l; i++) {
1980
+ if (target === array[i][0] && method === array[i][1]) { index = i; break; }
1981
+ }
1982
+ return index;
1983
+ }
2016
1984
 
2017
- })();
1985
+ function actionsFor(obj, eventName) {
1986
+ var meta = metaFor(obj, true),
1987
+ actions;
2018
1988
 
1989
+ if (!meta.listeners) { meta.listeners = {}; }
2019
1990
 
1991
+ if (!meta.hasOwnProperty('listeners')) {
1992
+ // setup inherited copy of the listeners object
1993
+ meta.listeners = o_create(meta.listeners);
1994
+ }
2020
1995
 
2021
- (function() {
2022
- /**
2023
- @module ember-metal
2024
- */
1996
+ actions = meta.listeners[eventName];
2025
1997
 
2026
- var META_KEY = Ember.META_KEY,
2027
- metaFor = Ember.meta,
2028
- objectDefineProperty = Ember.platform.defineProperty;
1998
+ // if there are actions, but the eventName doesn't exist in our listeners, then copy them from the prototype
1999
+ if (actions && !meta.listeners.hasOwnProperty(eventName)) {
2000
+ actions = meta.listeners[eventName] = meta.listeners[eventName].slice();
2001
+ } else if (!actions) {
2002
+ actions = meta.listeners[eventName] = [];
2003
+ }
2029
2004
 
2030
- var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
2005
+ return actions;
2006
+ }
2031
2007
 
2032
- // ..........................................................
2033
- // DESCRIPTOR
2034
- //
2008
+ function actionsUnion(obj, eventName, otherActions) {
2009
+ var meta = obj[META_KEY],
2010
+ actions = meta && meta.listeners && meta.listeners[eventName];
2035
2011
 
2036
- /**
2037
- Objects of this type can implement an interface to responds requests to
2038
- get and set. The default implementation handles simple properties.
2012
+ if (!actions) { return; }
2013
+ for (var i = actions.length - 1; i >= 0; i--) {
2014
+ var target = actions[i][0],
2015
+ method = actions[i][1],
2016
+ once = actions[i][2],
2017
+ suspended = actions[i][3],
2018
+ actionIndex = indexOf(otherActions, target, method);
2039
2019
 
2040
- You generally won't need to create or subclass this directly.
2020
+ if (actionIndex === -1) {
2021
+ otherActions.push([target, method, once, suspended]);
2022
+ }
2023
+ }
2024
+ }
2041
2025
 
2042
- @class Descriptor
2043
- @namespace Ember
2044
- @private
2045
- @constructor
2046
- */
2047
- var Descriptor = Ember.Descriptor = function() {};
2026
+ function actionsDiff(obj, eventName, otherActions) {
2027
+ var meta = obj[META_KEY],
2028
+ actions = meta && meta.listeners && meta.listeners[eventName],
2029
+ diffActions = [];
2048
2030
 
2049
- // ..........................................................
2050
- // DEFINING PROPERTIES API
2051
- //
2031
+ if (!actions) { return; }
2032
+ for (var i = actions.length - 1; i >= 0; i--) {
2033
+ var target = actions[i][0],
2034
+ method = actions[i][1],
2035
+ once = actions[i][2],
2036
+ suspended = actions[i][3],
2037
+ actionIndex = indexOf(otherActions, target, method);
2052
2038
 
2053
- var MANDATORY_SETTER_FUNCTION = Ember.MANDATORY_SETTER_FUNCTION = function(value) {
2039
+ if (actionIndex !== -1) { continue; }
2054
2040
 
2055
- };
2041
+ otherActions.push([target, method, once, suspended]);
2042
+ diffActions.push([target, method, once, suspended]);
2043
+ }
2056
2044
 
2057
- var DEFAULT_GETTER_FUNCTION = Ember.DEFAULT_GETTER_FUNCTION = function(name) {
2058
- return function() {
2059
- var meta = this[META_KEY];
2060
- return meta && meta.values[name];
2061
- };
2062
- };
2045
+ return diffActions;
2046
+ }
2063
2047
 
2064
2048
  /**
2065
- @private
2049
+ Add an event listener
2066
2050
 
2067
- NOTE: This is a low-level method used by other parts of the API. You almost
2068
- never want to call this method directly. Instead you should use
2069
- `Ember.mixin()` to define new properties.
2051
+ @method addListener
2052
+ @for Ember
2053
+ @param obj
2054
+ @param {String} eventName
2055
+ @param {Object|Function} targetOrMethod A target object or a function
2056
+ @param {Function|String} method A function or the name of a function to be called on `target`
2057
+ @param {Boolean} once A flag whether a function should only be called once
2058
+ */
2059
+ function addListener(obj, eventName, target, method, once) {
2070
2060
 
2071
- Defines a property on an object. This method works much like the ES5
2072
- `Object.defineProperty()` method except that it can also accept computed
2073
- properties and other special descriptors.
2074
2061
 
2075
- Normally this method takes only three parameters. However if you pass an
2076
- instance of `Ember.Descriptor` as the third param then you can pass an
2077
- optional value as the fourth parameter. This is often more efficient than
2078
- creating new descriptor hashes for each property.
2062
+ if (!method && 'function' === typeof target) {
2063
+ method = target;
2064
+ target = null;
2065
+ }
2079
2066
 
2080
- ## Examples
2067
+ var actions = actionsFor(obj, eventName),
2068
+ actionIndex = indexOf(actions, target, method);
2081
2069
 
2082
- ```javascript
2083
- // ES5 compatible mode
2084
- Ember.defineProperty(contact, 'firstName', {
2085
- writable: true,
2086
- configurable: false,
2087
- enumerable: true,
2088
- value: 'Charles'
2089
- });
2070
+ if (actionIndex !== -1) { return; }
2090
2071
 
2091
- // define a simple property
2092
- Ember.defineProperty(contact, 'lastName', undefined, 'Jolley');
2072
+ actions.push([target, method, once, undefined]);
2093
2073
 
2094
- // define a computed property
2095
- Ember.defineProperty(contact, 'fullName', Ember.computed(function() {
2096
- return this.firstName+' '+this.lastName;
2097
- }).property('firstName', 'lastName'));
2098
- ```
2074
+ if ('function' === typeof obj.didAddListener) {
2075
+ obj.didAddListener(eventName, target, method);
2076
+ }
2077
+ }
2099
2078
 
2100
- @method defineProperty
2079
+ /**
2080
+ Remove an event listener
2081
+
2082
+ Arguments should match those passed to {{#crossLink "Ember/addListener"}}{{/crossLink}}
2083
+
2084
+ @method removeListener
2101
2085
  @for Ember
2102
- @param {Object} obj the object to define this property on. This may be a prototype.
2103
- @param {String} keyName the name of the property
2104
- @param {Ember.Descriptor} [desc] an instance of `Ember.Descriptor` (typically a
2105
- computed property) or an ES5 descriptor.
2106
- You must provide this or `data` but not both.
2107
- @param {anything} [data] something other than a descriptor, that will
2108
- become the explicit value of this property.
2086
+ @param obj
2087
+ @param {String} eventName
2088
+ @param {Object|Function} targetOrMethod A target object or a function
2089
+ @param {Function|String} method A function or the name of a function to be called on `target`
2109
2090
  */
2110
- Ember.defineProperty = function(obj, keyName, desc, data, meta) {
2111
- var descs, existingDesc, watching, value;
2091
+ function removeListener(obj, eventName, target, method) {
2112
2092
 
2113
- if (!meta) meta = metaFor(obj);
2114
- descs = meta.descs;
2115
- existingDesc = meta.descs[keyName];
2116
- watching = meta.watching[keyName] > 0;
2117
2093
 
2118
- if (existingDesc instanceof Ember.Descriptor) {
2119
- existingDesc.teardown(obj, keyName);
2094
+ if (!method && 'function' === typeof target) {
2095
+ method = target;
2096
+ target = null;
2120
2097
  }
2121
2098
 
2122
- if (desc instanceof Ember.Descriptor) {
2123
- value = desc;
2099
+ function _removeListener(target, method, once) {
2100
+ var actions = actionsFor(obj, eventName),
2101
+ actionIndex = indexOf(actions, target, method);
2124
2102
 
2125
- descs[keyName] = desc;
2126
- if (MANDATORY_SETTER && watching) {
2127
- objectDefineProperty(obj, keyName, {
2128
- configurable: true,
2129
- enumerable: true,
2130
- writable: true,
2131
- value: undefined // make enumerable
2132
- });
2133
- } else {
2134
- obj[keyName] = undefined; // make enumerable
2103
+ // action doesn't exist, give up silently
2104
+ if (actionIndex === -1) { return; }
2105
+
2106
+ actions.splice(actionIndex, 1);
2107
+
2108
+ if ('function' === typeof obj.didRemoveListener) {
2109
+ obj.didRemoveListener(eventName, target, method);
2135
2110
  }
2136
- desc.setup(obj, keyName);
2111
+ }
2112
+
2113
+ if (method) {
2114
+ _removeListener(target, method);
2137
2115
  } else {
2138
- descs[keyName] = undefined; // shadow descriptor in proto
2139
- if (desc == null) {
2140
- value = data;
2116
+ var meta = obj[META_KEY],
2117
+ actions = meta && meta.listeners && meta.listeners[eventName];
2141
2118
 
2142
- if (MANDATORY_SETTER && watching) {
2143
- meta.values[keyName] = data;
2144
- objectDefineProperty(obj, keyName, {
2145
- configurable: true,
2146
- enumerable: true,
2147
- set: MANDATORY_SETTER_FUNCTION,
2148
- get: DEFAULT_GETTER_FUNCTION(keyName)
2149
- });
2150
- } else {
2151
- obj[keyName] = data;
2152
- }
2153
- } else {
2154
- value = desc;
2119
+ if (!actions) { return; }
2120
+ for (var i = actions.length - 1; i >= 0; i--) {
2121
+ _removeListener(actions[i][0], actions[i][1]);
2122
+ }
2123
+ }
2124
+ }
2155
2125
 
2156
- // compatibility with ES5
2157
- objectDefineProperty(obj, keyName, desc);
2126
+ /**
2127
+ @private
2128
+
2129
+ Suspend listener during callback.
2130
+
2131
+ This should only be used by the target of the event listener
2132
+ when it is taking an action that would cause the event, e.g.
2133
+ an object might suspend its property change listener while it is
2134
+ setting that property.
2135
+
2136
+ @method suspendListener
2137
+ @for Ember
2138
+ @param obj
2139
+ @param {String} eventName
2140
+ @param {Object|Function} targetOrMethod A target object or a function
2141
+ @param {Function|String} method A function or the name of a function to be called on `target`
2142
+ @param {Function} callback
2143
+ */
2144
+ function suspendListener(obj, eventName, target, method, callback) {
2145
+ if (!method && 'function' === typeof target) {
2146
+ method = target;
2147
+ target = null;
2148
+ }
2149
+
2150
+ var actions = actionsFor(obj, eventName),
2151
+ actionIndex = indexOf(actions, target, method),
2152
+ action;
2153
+
2154
+ if (actionIndex !== -1) {
2155
+ action = actions[actionIndex].slice(); // copy it, otherwise we're modifying a shared object
2156
+ action[3] = true; // mark the action as suspended
2157
+ actions[actionIndex] = action; // replace the shared object with our copy
2158
+ }
2159
+
2160
+ function tryable() { return callback.call(target); }
2161
+ function finalizer() { if (action) { action[3] = undefined; } }
2162
+
2163
+ return Ember.tryFinally(tryable, finalizer);
2164
+ }
2165
+
2166
+ /**
2167
+ @private
2168
+
2169
+ Suspend listener during callback.
2170
+
2171
+ This should only be used by the target of the event listener
2172
+ when it is taking an action that would cause the event, e.g.
2173
+ an object might suspend its property change listener while it is
2174
+ setting that property.
2175
+
2176
+ @method suspendListener
2177
+ @for Ember
2178
+ @param obj
2179
+ @param {Array} eventName Array of event names
2180
+ @param {Object|Function} targetOrMethod A target object or a function
2181
+ @param {Function|String} method A function or the name of a function to be called on `target`
2182
+ @param {Function} callback
2183
+ */
2184
+ function suspendListeners(obj, eventNames, target, method, callback) {
2185
+ if (!method && 'function' === typeof target) {
2186
+ method = target;
2187
+ target = null;
2188
+ }
2189
+
2190
+ var suspendedActions = [],
2191
+ eventName, actions, action, i, l;
2192
+
2193
+ for (i=0, l=eventNames.length; i<l; i++) {
2194
+ eventName = eventNames[i];
2195
+ actions = actionsFor(obj, eventName);
2196
+ var actionIndex = indexOf(actions, target, method);
2197
+
2198
+ if (actionIndex !== -1) {
2199
+ action = actions[actionIndex].slice();
2200
+ action[3] = true;
2201
+ actions[actionIndex] = action;
2202
+ suspendedActions.push(action);
2158
2203
  }
2159
2204
  }
2160
2205
 
2161
- // if key is being watched, override chains that
2162
- // were initialized with the prototype
2163
- if (watching) { Ember.overrideChains(obj, keyName, meta); }
2206
+ function tryable() { return callback.call(target); }
2164
2207
 
2165
- // The `value` passed to the `didDefineProperty` hook is
2166
- // either the descriptor or data, whichever was passed.
2167
- if (obj.didDefineProperty) { obj.didDefineProperty(obj, keyName, value); }
2208
+ function finalizer() {
2209
+ for (i = 0, l = suspendedActions.length; i < l; i++) {
2210
+ suspendedActions[i][3] = undefined;
2211
+ }
2212
+ }
2168
2213
 
2169
- return this;
2170
- };
2214
+ return Ember.tryFinally(tryable, finalizer);
2215
+ }
2171
2216
 
2217
+ /**
2218
+ @private
2172
2219
 
2173
- })();
2220
+ Return a list of currently watched events
2174
2221
 
2222
+ @method watchedEvents
2223
+ @for Ember
2224
+ @param obj
2225
+ */
2226
+ function watchedEvents(obj) {
2227
+ var listeners = obj[META_KEY].listeners, ret = [];
2175
2228
 
2229
+ if (listeners) {
2230
+ for(var eventName in listeners) {
2231
+ if (listeners[eventName]) { ret.push(eventName); }
2232
+ }
2233
+ }
2234
+ return ret;
2235
+ }
2176
2236
 
2177
- (function() {
2178
- // Ember.tryFinally
2179
2237
  /**
2180
- @module ember-metal
2238
+ @method sendEvent
2239
+ @for Ember
2240
+ @param obj
2241
+ @param {String} eventName
2242
+ @param {Array} params
2243
+ @param {Array} actions
2244
+ @return true
2181
2245
  */
2246
+ function sendEvent(obj, eventName, params, actions) {
2247
+ // first give object a chance to handle it
2248
+ if (obj !== Ember && 'function' === typeof obj.sendEvent) {
2249
+ obj.sendEvent(eventName, params);
2250
+ }
2182
2251
 
2183
- var AFTER_OBSERVERS = ':change';
2184
- var BEFORE_OBSERVERS = ':before';
2252
+ if (!actions) {
2253
+ var meta = obj[META_KEY];
2254
+ actions = meta && meta.listeners && meta.listeners[eventName];
2255
+ }
2185
2256
 
2186
- var guidFor = Ember.guidFor;
2257
+ if (!actions) { return; }
2258
+
2259
+ for (var i = actions.length - 1; i >= 0; i--) { // looping in reverse for once listeners
2260
+ if (!actions[i] || actions[i][3] === true) { continue; }
2261
+
2262
+ var target = actions[i][0],
2263
+ method = actions[i][1],
2264
+ once = actions[i][2];
2265
+
2266
+ if (once) { removeListener(obj, eventName, target, method); }
2267
+ if (!target) { target = obj; }
2268
+ if ('string' === typeof method) { method = target[method]; }
2269
+ if (params) {
2270
+ method.apply(target, params);
2271
+ } else {
2272
+ method.call(target);
2273
+ }
2274
+ }
2275
+ return true;
2276
+ }
2277
+
2278
+ /**
2279
+ @private
2280
+ @method hasListeners
2281
+ @for Ember
2282
+ @param obj
2283
+ @param {String} eventName
2284
+ */
2285
+ function hasListeners(obj, eventName) {
2286
+ var meta = obj[META_KEY],
2287
+ actions = meta && meta.listeners && meta.listeners[eventName];
2288
+
2289
+ return !!(actions && actions.length);
2290
+ }
2291
+
2292
+ /**
2293
+ @private
2294
+ @method listenersFor
2295
+ @for Ember
2296
+ @param obj
2297
+ @param {String} eventName
2298
+ */
2299
+ function listenersFor(obj, eventName) {
2300
+ var ret = [];
2301
+ var meta = obj[META_KEY],
2302
+ actions = meta && meta.listeners && meta.listeners[eventName];
2303
+
2304
+ if (!actions) { return ret; }
2305
+
2306
+ for (var i = 0, l = actions.length; i < l; i++) {
2307
+ var target = actions[i][0],
2308
+ method = actions[i][1];
2309
+ ret.push([target, method]);
2310
+ }
2311
+
2312
+ return ret;
2313
+ }
2314
+
2315
+ Ember.addListener = addListener;
2316
+ Ember.removeListener = removeListener;
2317
+ Ember._suspendListener = suspendListener;
2318
+ Ember._suspendListeners = suspendListeners;
2319
+ Ember.sendEvent = sendEvent;
2320
+ Ember.hasListeners = hasListeners;
2321
+ Ember.watchedEvents = watchedEvents;
2322
+ Ember.listenersFor = listenersFor;
2323
+ Ember.listenersDiff = actionsDiff;
2324
+ Ember.listenersUnion = actionsUnion;
2325
+
2326
+ })();
2187
2327
 
2188
- var deferred = 0;
2328
+
2329
+
2330
+ (function() {
2331
+ var guidFor = Ember.guidFor,
2332
+ sendEvent = Ember.sendEvent;
2189
2333
 
2190
2334
  /*
2191
2335
  this.observerSet = {
@@ -2205,14 +2349,14 @@ var deferred = 0;
2205
2349
  ...
2206
2350
  ]
2207
2351
  */
2208
- function ObserverSet() {
2352
+ var ObserverSet = Ember._ObserverSet = function() {
2209
2353
  this.clear();
2210
- }
2354
+ };
2211
2355
 
2212
2356
  ObserverSet.prototype.add = function(sender, keyName, eventName) {
2213
2357
  var observerSet = this.observerSet,
2214
2358
  observers = this.observers,
2215
- senderGuid = Ember.guidFor(sender),
2359
+ senderGuid = guidFor(sender),
2216
2360
  keySet = observerSet[senderGuid],
2217
2361
  index;
2218
2362
 
@@ -2239,7 +2383,7 @@ ObserverSet.prototype.flush = function() {
2239
2383
  observer = observers[i];
2240
2384
  sender = observer.sender;
2241
2385
  if (sender.isDestroying || sender.isDestroyed) { continue; }
2242
- Ember.sendEvent(sender, observer.eventName, [sender, observer.keyName], observer.listeners);
2386
+ sendEvent(sender, observer.eventName, [sender, observer.keyName], observer.listeners);
2243
2387
  }
2244
2388
  };
2245
2389
 
@@ -2247,713 +2391,914 @@ ObserverSet.prototype.clear = function() {
2247
2391
  this.observerSet = {};
2248
2392
  this.observers = [];
2249
2393
  };
2394
+ })();
2250
2395
 
2251
- var beforeObserverSet = new ObserverSet(), observerSet = new ObserverSet();
2252
2396
 
2253
- /**
2254
- @method beginPropertyChanges
2255
- @chainable
2256
- */
2257
- Ember.beginPropertyChanges = function() {
2258
- deferred++;
2259
- };
2260
2397
 
2261
- /**
2262
- @method endPropertyChanges
2263
- */
2264
- Ember.endPropertyChanges = function() {
2265
- deferred--;
2266
- if (deferred<=0) {
2267
- beforeObserverSet.clear();
2268
- observerSet.flush();
2269
- }
2270
- };
2398
+ (function() {
2399
+ var metaFor = Ember.meta,
2400
+ guidFor = Ember.guidFor,
2401
+ tryFinally = Ember.tryFinally,
2402
+ sendEvent = Ember.sendEvent,
2403
+ listenersUnion = Ember.listenersUnion,
2404
+ listenersDiff = Ember.listenersDiff,
2405
+ ObserverSet = Ember._ObserverSet,
2406
+ beforeObserverSet = new ObserverSet(),
2407
+ observerSet = new ObserverSet(),
2408
+ deferred = 0;
2409
+
2410
+ // ..........................................................
2411
+ // PROPERTY CHANGES
2412
+ //
2271
2413
 
2272
2414
  /**
2273
- Make a series of property changes together in an
2274
- exception-safe way.
2415
+ This function is called just before an object property is about to change.
2416
+ It will notify any before observers and prepare caches among other things.
2275
2417
 
2276
- ```javascript
2277
- Ember.changeProperties(function() {
2278
- obj1.set('foo', mayBlowUpWhenSet);
2279
- obj2.set('bar', baz);
2280
- });
2281
- ```
2418
+ Normally you will not need to call this method directly but if for some
2419
+ reason you can't directly watch a property you can invoke this method
2420
+ manually along with `Ember.propertyDidChange()` which you should call just
2421
+ after the property value changes.
2282
2422
 
2283
- @method changeProperties
2284
- @param {Function} callback
2285
- @param [binding]
2423
+ @method propertyWillChange
2424
+ @for Ember
2425
+ @param {Object} obj The object with the property that will change
2426
+ @param {String} keyName The property key (or path) that will change.
2427
+ @return {void}
2286
2428
  */
2287
- Ember.changeProperties = function(cb, binding){
2288
- Ember.beginPropertyChanges();
2289
- Ember.tryFinally(cb, Ember.endPropertyChanges, binding);
2429
+ var propertyWillChange = Ember.propertyWillChange = function(obj, keyName) {
2430
+ var m = metaFor(obj, false),
2431
+ watching = m.watching[keyName] > 0 || keyName === 'length',
2432
+ proto = m.proto,
2433
+ desc = m.descs[keyName];
2434
+
2435
+ if (!watching) { return; }
2436
+ if (proto === obj) { return; }
2437
+ if (desc && desc.willChange) { desc.willChange(obj, keyName); }
2438
+ dependentKeysWillChange(obj, keyName, m);
2439
+ chainsWillChange(obj, keyName, m);
2440
+ notifyBeforeObservers(obj, keyName);
2290
2441
  };
2291
2442
 
2292
2443
  /**
2293
- Set a list of properties on an object. These properties are set inside
2294
- a single `beginPropertyChanges` and `endPropertyChanges` batch, so
2295
- observers will be buffered.
2444
+ This function is called just after an object property has changed.
2445
+ It will notify any observers and clear caches among other things.
2296
2446
 
2297
- @method setProperties
2298
- @param target
2299
- @param {Hash} properties
2300
- @return target
2447
+ Normally you will not need to call this method directly but if for some
2448
+ reason you can't directly watch a property you can invoke this method
2449
+ manually along with `Ember.propertyWilLChange()` which you should call just
2450
+ before the property value changes.
2451
+
2452
+ @method propertyDidChange
2453
+ @for Ember
2454
+ @param {Object} obj The object with the property that will change
2455
+ @param {String} keyName The property key (or path) that will change.
2456
+ @return {void}
2301
2457
  */
2302
- Ember.setProperties = function(self, hash) {
2303
- Ember.changeProperties(function(){
2304
- for(var prop in hash) {
2305
- if (hash.hasOwnProperty(prop)) Ember.set(self, prop, hash[prop]);
2306
- }
2307
- });
2308
- return self;
2458
+ var propertyDidChange = Ember.propertyDidChange = function(obj, keyName) {
2459
+ var m = metaFor(obj, false),
2460
+ watching = m.watching[keyName] > 0 || keyName === 'length',
2461
+ proto = m.proto,
2462
+ desc = m.descs[keyName];
2463
+
2464
+ if (proto === obj) { return; }
2465
+
2466
+ // shouldn't this mean that we're watching this key?
2467
+ if (desc && desc.didChange) { desc.didChange(obj, keyName); }
2468
+ if (!watching && keyName !== 'length') { return; }
2469
+
2470
+ dependentKeysDidChange(obj, keyName, m);
2471
+ chainsDidChange(obj, keyName, m);
2472
+ notifyObservers(obj, keyName);
2309
2473
  };
2310
2474
 
2475
+ var WILL_SEEN, DID_SEEN;
2311
2476
 
2312
- function changeEvent(keyName) {
2313
- return keyName+AFTER_OBSERVERS;
2477
+ // called whenever a property is about to change to clear the cache of any dependent keys (and notify those properties of changes, etc...)
2478
+ function dependentKeysWillChange(obj, depKey, meta) {
2479
+ if (obj.isDestroying) { return; }
2480
+
2481
+ var seen = WILL_SEEN, top = !seen;
2482
+ if (top) { seen = WILL_SEEN = {}; }
2483
+ iterDeps(propertyWillChange, obj, depKey, seen, meta);
2484
+ if (top) { WILL_SEEN = null; }
2314
2485
  }
2315
2486
 
2316
- function beforeEvent(keyName) {
2317
- return keyName+BEFORE_OBSERVERS;
2487
+ // called whenever a property has just changed to update dependent keys
2488
+ function dependentKeysDidChange(obj, depKey, meta) {
2489
+ if (obj.isDestroying) { return; }
2490
+
2491
+ var seen = DID_SEEN, top = !seen;
2492
+ if (top) { seen = DID_SEEN = {}; }
2493
+ iterDeps(propertyDidChange, obj, depKey, seen, meta);
2494
+ if (top) { DID_SEEN = null; }
2318
2495
  }
2319
2496
 
2320
- /**
2321
- @method addObserver
2322
- @param obj
2323
- @param {String} path
2324
- @param {Object|Function} targetOrMethod
2325
- @param {Function|String} [method]
2326
- */
2327
- Ember.addObserver = function(obj, path, target, method) {
2328
- Ember.addListener(obj, changeEvent(path), target, method);
2329
- Ember.watch(obj, path);
2330
- return this;
2331
- };
2497
+ function iterDeps(method, obj, depKey, seen, meta) {
2498
+ var guid = guidFor(obj);
2499
+ if (!seen[guid]) seen[guid] = {};
2500
+ if (seen[guid][depKey]) return;
2501
+ seen[guid][depKey] = true;
2332
2502
 
2333
- Ember.observersFor = function(obj, path) {
2334
- return Ember.listenersFor(obj, changeEvent(path));
2335
- };
2503
+ var deps = meta.deps;
2504
+ deps = deps && deps[depKey];
2505
+ if (deps) {
2506
+ for(var key in deps) {
2507
+ var desc = meta.descs[key];
2508
+ if (desc && desc._suspended === obj) continue;
2509
+ method(obj, key);
2510
+ }
2511
+ }
2512
+ }
2336
2513
 
2337
- /**
2338
- @method removeObserver
2339
- @param obj
2340
- @param {String} path
2341
- @param {Object|Function} targetOrMethod
2342
- @param {Function|String} [method]
2343
- */
2344
- Ember.removeObserver = function(obj, path, target, method) {
2345
- Ember.unwatch(obj, path);
2346
- Ember.removeListener(obj, changeEvent(path), target, method);
2347
- return this;
2348
- };
2514
+ var chainsWillChange = function(obj, keyName, m, arg) {
2515
+ if (!m.hasOwnProperty('chainWatchers')) { return; } // nothing to do
2349
2516
 
2350
- /**
2351
- @method addBeforeObserver
2352
- @param obj
2353
- @param {String} path
2354
- @param {Object|Function} targetOrMethod
2355
- @param {Function|String} [method]
2356
- */
2357
- Ember.addBeforeObserver = function(obj, path, target, method) {
2358
- Ember.addListener(obj, beforeEvent(path), target, method);
2359
- Ember.watch(obj, path);
2360
- return this;
2361
- };
2517
+ var nodes = m.chainWatchers;
2362
2518
 
2363
- // Suspend observer during callback.
2364
- //
2365
- // This should only be used by the target of the observer
2366
- // while it is setting the observed path.
2367
- Ember._suspendBeforeObserver = function(obj, path, target, method, callback) {
2368
- return Ember._suspendListener(obj, beforeEvent(path), target, method, callback);
2369
- };
2519
+ nodes = nodes[keyName];
2520
+ if (!nodes) { return; }
2370
2521
 
2371
- Ember._suspendObserver = function(obj, path, target, method, callback) {
2372
- return Ember._suspendListener(obj, changeEvent(path), target, method, callback);
2522
+ for(var i = 0, l = nodes.length; i < l; i++) {
2523
+ nodes[i].willChange(arg);
2524
+ }
2373
2525
  };
2374
2526
 
2375
- var map = Ember.ArrayPolyfills.map;
2527
+ var chainsDidChange = function(obj, keyName, m, arg) {
2528
+ if (!m.hasOwnProperty('chainWatchers')) { return; } // nothing to do
2376
2529
 
2377
- Ember._suspendBeforeObservers = function(obj, paths, target, method, callback) {
2378
- var events = map.call(paths, beforeEvent);
2379
- return Ember._suspendListeners(obj, events, target, method, callback);
2530
+ var nodes = m.chainWatchers;
2531
+
2532
+ nodes = nodes[keyName];
2533
+ if (!nodes) { return; }
2534
+
2535
+ // looping in reverse because the chainWatchers array can be modified inside didChange
2536
+ for (var i = nodes.length - 1; i >= 0; i--) {
2537
+ nodes[i].didChange(arg);
2538
+ }
2380
2539
  };
2381
2540
 
2382
- Ember._suspendObservers = function(obj, paths, target, method, callback) {
2383
- var events = map.call(paths, changeEvent);
2384
- return Ember._suspendListeners(obj, events, target, method, callback);
2541
+ Ember.overrideChains = function(obj, keyName, m) {
2542
+ chainsDidChange(obj, keyName, m, true);
2385
2543
  };
2386
2544
 
2387
- Ember.beforeObserversFor = function(obj, path) {
2388
- return Ember.listenersFor(obj, beforeEvent(path));
2545
+ /**
2546
+ @method beginPropertyChanges
2547
+ @chainable
2548
+ */
2549
+ var beginPropertyChanges = Ember.beginPropertyChanges = function() {
2550
+ deferred++;
2389
2551
  };
2390
2552
 
2391
2553
  /**
2392
- @method removeBeforeObserver
2393
- @param obj
2394
- @param {String} path
2395
- @param {Object|Function} targetOrMethod
2396
- @param {Function|String} [method]
2554
+ @method endPropertyChanges
2397
2555
  */
2398
- Ember.removeBeforeObserver = function(obj, path, target, method) {
2399
- Ember.unwatch(obj, path);
2400
- Ember.removeListener(obj, beforeEvent(path), target, method);
2401
- return this;
2556
+ var endPropertyChanges = Ember.endPropertyChanges = function() {
2557
+ deferred--;
2558
+ if (deferred<=0) {
2559
+ beforeObserverSet.clear();
2560
+ observerSet.flush();
2561
+ }
2562
+ };
2563
+
2564
+ /**
2565
+ Make a series of property changes together in an
2566
+ exception-safe way.
2567
+
2568
+ ```javascript
2569
+ Ember.changeProperties(function() {
2570
+ obj1.set('foo', mayBlowUpWhenSet);
2571
+ obj2.set('bar', baz);
2572
+ });
2573
+ ```
2574
+
2575
+ @method changePropertiess
2576
+ @param {Function} callback
2577
+ @param [binding]
2578
+ */
2579
+ var changeProperties = Ember.changeProperties = function(cb, binding){
2580
+ beginPropertyChanges();
2581
+ tryFinally(cb, endPropertyChanges, binding);
2402
2582
  };
2403
2583
 
2404
- Ember.notifyBeforeObservers = function(obj, keyName) {
2584
+ var notifyBeforeObservers = function(obj, keyName) {
2405
2585
  if (obj.isDestroying) { return; }
2406
2586
 
2407
- var eventName = beforeEvent(keyName), listeners, listenersDiff;
2587
+ var eventName = keyName + ':before', listeners, diff;
2408
2588
  if (deferred) {
2409
2589
  listeners = beforeObserverSet.add(obj, keyName, eventName);
2410
- listenersDiff = Ember.listenersDiff(obj, eventName, listeners);
2411
- Ember.sendEvent(obj, eventName, [obj, keyName], listenersDiff);
2590
+ diff = listenersDiff(obj, eventName, listeners);
2591
+ sendEvent(obj, eventName, [obj, keyName], diff);
2412
2592
  } else {
2413
- Ember.sendEvent(obj, eventName, [obj, keyName]);
2593
+ sendEvent(obj, eventName, [obj, keyName]);
2414
2594
  }
2415
2595
  };
2416
2596
 
2417
- Ember.notifyObservers = function(obj, keyName) {
2597
+ var notifyObservers = function(obj, keyName) {
2418
2598
  if (obj.isDestroying) { return; }
2419
2599
 
2420
- var eventName = changeEvent(keyName), listeners;
2600
+ var eventName = keyName + ':change', listeners;
2421
2601
  if (deferred) {
2422
2602
  listeners = observerSet.add(obj, keyName, eventName);
2423
- Ember.listenersUnion(obj, eventName, listeners);
2603
+ listenersUnion(obj, eventName, listeners);
2424
2604
  } else {
2425
- Ember.sendEvent(obj, eventName, [obj, keyName]);
2605
+ sendEvent(obj, eventName, [obj, keyName]);
2426
2606
  }
2427
2607
  };
2428
-
2429
2608
  })();
2430
2609
 
2431
2610
 
2432
2611
 
2433
2612
  (function() {
2434
- /**
2435
- @module ember-metal
2436
- */
2613
+ // META_KEY
2614
+ // _getPath
2615
+ // propertyWillChange, propertyDidChange
2437
2616
 
2438
- var guidFor = Ember.guidFor, // utils.js
2439
- metaFor = Ember.meta, // utils.js
2440
- get = Ember.get, // accessors.js
2441
- set = Ember.set, // accessors.js
2442
- normalizeTuple = Ember.normalizeTuple, // accessors.js
2443
- GUID_KEY = Ember.GUID_KEY, // utils.js
2444
- META_KEY = Ember.META_KEY, // utils.js
2445
- // circular reference observer depends on Ember.watch
2446
- // we should move change events to this file or its own property_events.js
2447
- forEach = Ember.ArrayPolyfills.forEach, // array.js
2448
- FIRST_KEY = /^([^\.\*]+)/,
2449
- IS_PATH = /[\.\*]/;
2450
-
2451
- var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER,
2452
- o_defineProperty = Ember.platform.defineProperty;
2617
+ var META_KEY = Ember.META_KEY,
2618
+ MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER,
2619
+ IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/,
2620
+ propertyWillChange = Ember.propertyWillChange,
2621
+ propertyDidChange = Ember.propertyDidChange,
2622
+ getPath = Ember._getPath;
2453
2623
 
2454
- function firstKey(path) {
2455
- return path.match(FIRST_KEY)[0];
2456
- }
2624
+ /**
2625
+ Sets the value of a property on an object, respecting computed properties
2626
+ and notifying observers and other listeners of the change. If the
2627
+ property is not defined but the object implements the `unknownProperty`
2628
+ method then that will be invoked as well.
2457
2629
 
2458
- // returns true if the passed path is just a keyName
2459
- function isKeyName(path) {
2460
- return path==='*' || !IS_PATH.test(path);
2461
- }
2630
+ If you plan to run on IE8 and older browsers then you should use this
2631
+ method anytime you want to set a property on an object that you don't
2632
+ know for sure is private. (Properties beginning with an underscore '_'
2633
+ are considered private.)
2462
2634
 
2463
- // ..........................................................
2464
- // DEPENDENT KEYS
2465
- //
2635
+ On all newer browsers, you only need to use this method to set
2636
+ properties if the property might not be defined on the object and you want
2637
+ to respect the `unknownProperty` handler. Otherwise you can ignore this
2638
+ method.
2466
2639
 
2467
- function iterDeps(method, obj, depKey, seen, meta) {
2640
+ @method set
2641
+ @for Ember
2642
+ @param {Object} obj The object to modify.
2643
+ @param {String} keyName The property key to set
2644
+ @param {Object} value The value to set
2645
+ @return {Object} the passed value.
2646
+ */
2647
+ var set = function set(obj, keyName, value, tolerant) {
2648
+ if (typeof obj === 'string') {
2468
2649
 
2469
- var guid = guidFor(obj);
2470
- if (!seen[guid]) seen[guid] = {};
2471
- if (seen[guid][depKey]) return;
2472
- seen[guid][depKey] = true;
2650
+ value = keyName;
2651
+ keyName = obj;
2652
+ obj = null;
2653
+ }
2473
2654
 
2474
- var deps = meta.deps;
2475
- deps = deps && deps[depKey];
2476
- if (deps) {
2477
- for(var key in deps) {
2478
- var desc = meta.descs[key];
2479
- if (desc && desc._suspended === obj) continue;
2480
- method(obj, key);
2481
- }
2655
+ if (!obj || keyName.indexOf('.') !== -1) {
2656
+ return setPath(obj, keyName, value, tolerant);
2482
2657
  }
2483
- }
2484
2658
 
2485
2659
 
2486
- var WILL_SEEN, DID_SEEN;
2487
2660
 
2488
- // called whenever a property is about to change to clear the cache of any dependent keys (and notify those properties of changes, etc...)
2489
- function dependentKeysWillChange(obj, depKey, meta) {
2490
- if (obj.isDestroying) { return; }
2661
+ var meta = obj[META_KEY], desc = meta && meta.descs[keyName],
2662
+ isUnknown, currentValue;
2663
+ if (desc) {
2664
+ desc.set(obj, keyName, value);
2665
+ } else {
2666
+ isUnknown = 'object' === typeof obj && !(keyName in obj);
2491
2667
 
2492
- var seen = WILL_SEEN, top = !seen;
2493
- if (top) { seen = WILL_SEEN = {}; }
2494
- iterDeps(propertyWillChange, obj, depKey, seen, meta);
2495
- if (top) { WILL_SEEN = null; }
2668
+ // setUnknownProperty is called if `obj` is an object,
2669
+ // the property does not already exist, and the
2670
+ // `setUnknownProperty` method exists on the object
2671
+ if (isUnknown && 'function' === typeof obj.setUnknownProperty) {
2672
+ obj.setUnknownProperty(keyName, value);
2673
+ } else if (meta && meta.watching[keyName] > 0) {
2674
+ if (MANDATORY_SETTER) {
2675
+ currentValue = meta.values[keyName];
2676
+ } else {
2677
+ currentValue = obj[keyName];
2678
+ }
2679
+ // only trigger a change if the value has changed
2680
+ if (value !== currentValue) {
2681
+ Ember.propertyWillChange(obj, keyName);
2682
+ if (MANDATORY_SETTER) {
2683
+ if (currentValue === undefined && !(keyName in obj)) {
2684
+ Ember.defineProperty(obj, keyName, null, value); // setup mandatory setter
2685
+ } else {
2686
+ meta.values[keyName] = value;
2687
+ }
2688
+ } else {
2689
+ obj[keyName] = value;
2690
+ }
2691
+ Ember.propertyDidChange(obj, keyName);
2692
+ }
2693
+ } else {
2694
+ obj[keyName] = value;
2695
+ }
2696
+ }
2697
+ return value;
2698
+ };
2699
+
2700
+ // Currently used only by Ember Data tests
2701
+ if (Ember.config.overrideAccessors) {
2702
+ Ember.set = set;
2703
+ Ember.config.overrideAccessors();
2704
+ set = Ember.set;
2496
2705
  }
2497
2706
 
2498
- // called whenever a property has just changed to update dependent keys
2499
- function dependentKeysDidChange(obj, depKey, meta) {
2500
- if (obj.isDestroying) { return; }
2707
+ function setPath(root, path, value, tolerant) {
2708
+ var keyName;
2501
2709
 
2502
- var seen = DID_SEEN, top = !seen;
2503
- if (top) { seen = DID_SEEN = {}; }
2504
- iterDeps(propertyDidChange, obj, depKey, seen, meta);
2505
- if (top) { DID_SEEN = null; }
2506
- }
2710
+ // get the last part of the path
2711
+ keyName = path.slice(path.lastIndexOf('.') + 1);
2507
2712
 
2508
- // ..........................................................
2509
- // CHAIN
2510
- //
2713
+ // get the first part of the part
2714
+ path = path.slice(0, path.length-(keyName.length+1));
2511
2715
 
2512
- function addChainWatcher(obj, keyName, node) {
2513
- if (!obj || ('object' !== typeof obj)) { return; } // nothing to do
2716
+ // unless the path is this, look up the first part to
2717
+ // get the root
2718
+ if (path !== 'this') {
2719
+ root = getPath(root, path);
2720
+ }
2514
2721
 
2515
- var m = metaFor(obj), nodes = m.chainWatchers;
2722
+ if (!keyName || keyName.length === 0) {
2723
+ throw new Error('You passed an empty path');
2724
+ }
2516
2725
 
2517
- if (!m.hasOwnProperty('chainWatchers')) {
2518
- nodes = m.chainWatchers = {};
2726
+ if (!root) {
2727
+ if (tolerant) { return; }
2728
+ else { throw new Error('Object in path '+path+' could not be found or was destroyed.'); }
2519
2729
  }
2520
2730
 
2521
- if (!nodes[keyName]) { nodes[keyName] = []; }
2522
- nodes[keyName].push(node);
2523
- Ember.watch(obj, keyName);
2731
+ return set(root, keyName, value);
2524
2732
  }
2525
2733
 
2526
- function removeChainWatcher(obj, keyName, node) {
2527
- if (!obj || 'object' !== typeof obj) { return; } // nothing to do
2734
+ Ember.set = set;
2735
+ Ember.setPath = Ember.deprecateFunc('setPath is deprecated since set now supports paths', Ember.set);
2528
2736
 
2529
- var m = metaFor(obj, false);
2530
- if (!m.hasOwnProperty('chainWatchers')) { return; } // nothing to do
2737
+ /**
2738
+ Error-tolerant form of `Ember.set`. Will not blow up if any part of the
2739
+ chain is `undefined`, `null`, or destroyed.
2531
2740
 
2532
- var nodes = m.chainWatchers;
2741
+ This is primarily used when syncing bindings, which may try to update after
2742
+ an object has been destroyed.
2533
2743
 
2534
- if (nodes[keyName]) {
2535
- nodes = nodes[keyName];
2536
- for (var i = 0, l = nodes.length; i < l; i++) {
2537
- if (nodes[i] === node) { nodes.splice(i, 1); }
2538
- }
2539
- }
2540
- Ember.unwatch(obj, keyName);
2541
- }
2744
+ @method trySet
2745
+ @for Ember
2746
+ @param {Object} obj The object to modify.
2747
+ @param {String} path The property path to set
2748
+ @param {Object} value The value to set
2749
+ */
2750
+ Ember.trySet = function(root, path, value) {
2751
+ return set(root, path, value, true);
2752
+ };
2753
+ Ember.trySetPath = Ember.deprecateFunc('trySetPath has been renamed to trySet', Ember.trySet);
2542
2754
 
2543
- var pendingQueue = [];
2755
+ })();
2544
2756
 
2545
- // attempts to add the pendingQueue chains again. If some of them end up
2546
- // back in the queue and reschedule is true, schedules a timeout to try
2547
- // again.
2548
- function flushPendingChains() {
2549
- if (pendingQueue.length === 0) { return; } // nothing to do
2550
2757
 
2551
- var queue = pendingQueue;
2552
- pendingQueue = [];
2553
2758
 
2554
- forEach.call(queue, function(q) { q[0].add(q[1]); });
2759
+ (function() {
2760
+ /**
2761
+ @module ember-metal
2762
+ */
2555
2763
 
2556
- }
2764
+ var META_KEY = Ember.META_KEY,
2765
+ metaFor = Ember.meta,
2766
+ objectDefineProperty = Ember.platform.defineProperty;
2557
2767
 
2558
- function isProto(pvalue) {
2559
- return metaFor(pvalue, false).proto === pvalue;
2560
- }
2768
+ var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
2561
2769
 
2562
- // A ChainNode watches a single key on an object. If you provide a starting
2563
- // value for the key then the node won't actually watch it. For a root node
2564
- // pass null for parent and key and object for value.
2565
- var ChainNode = function(parent, key, value) {
2566
- var obj;
2567
- this._parent = parent;
2568
- this._key = key;
2770
+ // ..........................................................
2771
+ // DESCRIPTOR
2772
+ //
2569
2773
 
2570
- // _watching is true when calling get(this._parent, this._key) will
2571
- // return the value of this node.
2572
- //
2573
- // It is false for the root of a chain (because we have no parent)
2574
- // and for global paths (because the parent node is the object with
2575
- // the observer on it)
2576
- this._watching = value===undefined;
2774
+ /**
2775
+ Objects of this type can implement an interface to responds requests to
2776
+ get and set. The default implementation handles simple properties.
2577
2777
 
2578
- this._value = value;
2579
- this._paths = {};
2580
- if (this._watching) {
2581
- this._object = parent.value();
2582
- if (this._object) { addChainWatcher(this._object, this._key, this); }
2583
- }
2778
+ You generally won't need to create or subclass this directly.
2584
2779
 
2585
- // Special-case: the EachProxy relies on immediate evaluation to
2586
- // establish its observers.
2587
- //
2588
- // TODO: Replace this with an efficient callback that the EachProxy
2589
- // can implement.
2590
- if (this._parent && this._parent._key === '@each') {
2591
- this.value();
2592
- }
2593
- };
2780
+ @class Descriptor
2781
+ @namespace Ember
2782
+ @private
2783
+ @constructor
2784
+ */
2785
+ var Descriptor = Ember.Descriptor = function() {};
2594
2786
 
2595
- var ChainNodePrototype = ChainNode.prototype;
2787
+ // ..........................................................
2788
+ // DEFINING PROPERTIES API
2789
+ //
2596
2790
 
2597
- ChainNodePrototype.value = function() {
2598
- if (this._value === undefined && this._watching) {
2599
- var obj = this._parent.value();
2600
- this._value = (obj && !isProto(obj)) ? get(obj, this._key) : undefined;
2601
- }
2602
- return this._value;
2603
- };
2791
+ var MANDATORY_SETTER_FUNCTION = Ember.MANDATORY_SETTER_FUNCTION = function(value) {
2604
2792
 
2605
- ChainNodePrototype.destroy = function() {
2606
- if (this._watching) {
2607
- var obj = this._object;
2608
- if (obj) { removeChainWatcher(obj, this._key, this); }
2609
- this._watching = false; // so future calls do nothing
2610
- }
2611
2793
  };
2612
2794
 
2613
- // copies a top level object only
2614
- ChainNodePrototype.copy = function(obj) {
2615
- var ret = new ChainNode(null, null, obj),
2616
- paths = this._paths, path;
2617
- for (path in paths) {
2618
- if (paths[path] <= 0) { continue; } // this check will also catch non-number vals.
2619
- ret.add(path);
2620
- }
2621
- return ret;
2795
+ var DEFAULT_GETTER_FUNCTION = Ember.DEFAULT_GETTER_FUNCTION = function(name) {
2796
+ return function() {
2797
+ var meta = this[META_KEY];
2798
+ return meta && meta.values[name];
2799
+ };
2622
2800
  };
2623
2801
 
2624
- // called on the root node of a chain to setup watchers on the specified
2625
- // path.
2626
- ChainNodePrototype.add = function(path) {
2627
- var obj, tuple, key, src, paths;
2628
-
2629
- paths = this._paths;
2630
- paths[path] = (paths[path] || 0) + 1;
2802
+ /**
2803
+ @private
2631
2804
 
2632
- obj = this.value();
2633
- tuple = normalizeTuple(obj, path);
2805
+ NOTE: This is a low-level method used by other parts of the API. You almost
2806
+ never want to call this method directly. Instead you should use
2807
+ `Ember.mixin()` to define new properties.
2634
2808
 
2635
- // the path was a local path
2636
- if (tuple[0] && tuple[0] === obj) {
2637
- path = tuple[1];
2638
- key = firstKey(path);
2639
- path = path.slice(key.length+1);
2809
+ Defines a property on an object. This method works much like the ES5
2810
+ `Object.defineProperty()` method except that it can also accept computed
2811
+ properties and other special descriptors.
2640
2812
 
2641
- // global path, but object does not exist yet.
2642
- // put into a queue and try to connect later.
2643
- } else if (!tuple[0]) {
2644
- pendingQueue.push([this, path]);
2645
- tuple.length = 0;
2646
- return;
2813
+ Normally this method takes only three parameters. However if you pass an
2814
+ instance of `Ember.Descriptor` as the third param then you can pass an
2815
+ optional value as the fourth parameter. This is often more efficient than
2816
+ creating new descriptor hashes for each property.
2647
2817
 
2648
- // global path, and object already exists
2649
- } else {
2650
- src = tuple[0];
2651
- key = path.slice(0, 0-(tuple[1].length+1));
2652
- path = tuple[1];
2653
- }
2818
+ ## Examples
2654
2819
 
2655
- tuple.length = 0;
2656
- this.chain(key, path, src);
2657
- };
2820
+ ```javascript
2821
+ // ES5 compatible mode
2822
+ Ember.defineProperty(contact, 'firstName', {
2823
+ writable: true,
2824
+ configurable: false,
2825
+ enumerable: true,
2826
+ value: 'Charles'
2827
+ });
2658
2828
 
2659
- // called on the root node of a chain to teardown watcher on the specified
2660
- // path
2661
- ChainNodePrototype.remove = function(path) {
2662
- var obj, tuple, key, src, paths;
2829
+ // define a simple property
2830
+ Ember.defineProperty(contact, 'lastName', undefined, 'Jolley');
2663
2831
 
2664
- paths = this._paths;
2665
- if (paths[path] > 0) { paths[path]--; }
2832
+ // define a computed property
2833
+ Ember.defineProperty(contact, 'fullName', Ember.computed(function() {
2834
+ return this.firstName+' '+this.lastName;
2835
+ }).property('firstName', 'lastName'));
2836
+ ```
2666
2837
 
2667
- obj = this.value();
2668
- tuple = normalizeTuple(obj, path);
2669
- if (tuple[0] === obj) {
2670
- path = tuple[1];
2671
- key = firstKey(path);
2672
- path = path.slice(key.length+1);
2838
+ @method defineProperty
2839
+ @for Ember
2840
+ @param {Object} obj the object to define this property on. This may be a prototype.
2841
+ @param {String} keyName the name of the property
2842
+ @param {Ember.Descriptor} [desc] an instance of `Ember.Descriptor` (typically a
2843
+ computed property) or an ES5 descriptor.
2844
+ You must provide this or `data` but not both.
2845
+ @param {*} [data] something other than a descriptor, that will
2846
+ become the explicit value of this property.
2847
+ */
2848
+ Ember.defineProperty = function(obj, keyName, desc, data, meta) {
2849
+ var descs, existingDesc, watching, value;
2850
+
2851
+ if (!meta) meta = metaFor(obj);
2852
+ descs = meta.descs;
2853
+ existingDesc = meta.descs[keyName];
2854
+ watching = meta.watching[keyName] > 0;
2855
+
2856
+ if (existingDesc instanceof Ember.Descriptor) {
2857
+ existingDesc.teardown(obj, keyName);
2858
+ }
2859
+
2860
+ if (desc instanceof Ember.Descriptor) {
2861
+ value = desc;
2862
+
2863
+ descs[keyName] = desc;
2864
+ if (MANDATORY_SETTER && watching) {
2865
+ objectDefineProperty(obj, keyName, {
2866
+ configurable: true,
2867
+ enumerable: true,
2868
+ writable: true,
2869
+ value: undefined // make enumerable
2870
+ });
2871
+ } else {
2872
+ obj[keyName] = undefined; // make enumerable
2873
+ }
2874
+ desc.setup(obj, keyName);
2673
2875
  } else {
2674
- src = tuple[0];
2675
- key = path.slice(0, 0-(tuple[1].length+1));
2676
- path = tuple[1];
2876
+ descs[keyName] = undefined; // shadow descriptor in proto
2877
+ if (desc == null) {
2878
+ value = data;
2879
+
2880
+ if (MANDATORY_SETTER && watching) {
2881
+ meta.values[keyName] = data;
2882
+ objectDefineProperty(obj, keyName, {
2883
+ configurable: true,
2884
+ enumerable: true,
2885
+ set: MANDATORY_SETTER_FUNCTION,
2886
+ get: DEFAULT_GETTER_FUNCTION(keyName)
2887
+ });
2888
+ } else {
2889
+ obj[keyName] = data;
2890
+ }
2891
+ } else {
2892
+ value = desc;
2893
+
2894
+ // compatibility with ES5
2895
+ objectDefineProperty(obj, keyName, desc);
2896
+ }
2677
2897
  }
2678
2898
 
2679
- tuple.length = 0;
2680
- this.unchain(key, path);
2899
+ // if key is being watched, override chains that
2900
+ // were initialized with the prototype
2901
+ if (watching) { Ember.overrideChains(obj, keyName, meta); }
2902
+
2903
+ // The `value` passed to the `didDefineProperty` hook is
2904
+ // either the descriptor or data, whichever was passed.
2905
+ if (obj.didDefineProperty) { obj.didDefineProperty(obj, keyName, value); }
2906
+
2907
+ return this;
2681
2908
  };
2682
2909
 
2683
- ChainNodePrototype.count = 0;
2684
2910
 
2685
- ChainNodePrototype.chain = function(key, path, src) {
2686
- var chains = this._chains, node;
2687
- if (!chains) { chains = this._chains = {}; }
2911
+ })();
2688
2912
 
2689
- node = chains[key];
2690
- if (!node) { node = chains[key] = new ChainNode(this, key, src); }
2691
- node.count++; // count chains...
2692
2913
 
2693
- // chain rest of path if there is one
2694
- if (path && path.length>0) {
2695
- key = firstKey(path);
2696
- path = path.slice(key.length+1);
2697
- node.chain(key, path); // NOTE: no src means it will observe changes...
2698
- }
2914
+
2915
+ (function() {
2916
+ var changeProperties = Ember.changeProperties,
2917
+ set = Ember.set;
2918
+
2919
+ /**
2920
+ Set a list of properties on an object. These properties are set inside
2921
+ a single `beginPropertyChanges` and `endPropertyChanges` batch, so
2922
+ observers will be buffered.
2923
+
2924
+ @method setProperties
2925
+ @param target
2926
+ @param {Hash} properties
2927
+ @return target
2928
+ */
2929
+ Ember.setProperties = function(self, hash) {
2930
+ changeProperties(function(){
2931
+ for(var prop in hash) {
2932
+ if (hash.hasOwnProperty(prop)) { set(self, prop, hash[prop]); }
2933
+ }
2934
+ });
2935
+ return self;
2699
2936
  };
2937
+ })();
2700
2938
 
2701
- ChainNodePrototype.unchain = function(key, path) {
2702
- var chains = this._chains, node = chains[key];
2703
2939
 
2704
- // unchain rest of path first...
2705
- if (path && path.length>1) {
2706
- key = firstKey(path);
2707
- path = path.slice(key.length+1);
2708
- node.unchain(key, path);
2709
- }
2710
2940
 
2711
- // delete node if needed.
2712
- node.count--;
2713
- if (node.count<=0) {
2714
- delete chains[node._key];
2715
- node.destroy();
2716
- }
2941
+ (function() {
2942
+ var metaFor = Ember.meta, // utils.js
2943
+ typeOf = Ember.typeOf, // utils.js
2944
+ MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER,
2945
+ o_defineProperty = Ember.platform.defineProperty;
2717
2946
 
2718
- };
2947
+ Ember.watchKey = function(obj, keyName) {
2948
+ // can't watch length on Array - it is special...
2949
+ if (keyName === 'length' && typeOf(obj) === 'array') { return; }
2719
2950
 
2720
- ChainNodePrototype.willChange = function() {
2721
- var chains = this._chains;
2722
- if (chains) {
2723
- for(var key in chains) {
2724
- if (!chains.hasOwnProperty(key)) { continue; }
2725
- chains[key].willChange();
2726
- }
2727
- }
2951
+ var m = metaFor(obj), watching = m.watching, desc;
2728
2952
 
2729
- if (this._parent) { this._parent.chainWillChange(this, this._key, 1); }
2730
- };
2953
+ // activate watching first time
2954
+ if (!watching[keyName]) {
2955
+ watching[keyName] = 1;
2956
+ desc = m.descs[keyName];
2957
+ if (desc && desc.willWatch) { desc.willWatch(obj, keyName); }
2731
2958
 
2732
- ChainNodePrototype.chainWillChange = function(chain, path, depth) {
2733
- if (this._key) { path = this._key + '.' + path; }
2959
+ if ('function' === typeof obj.willWatchProperty) {
2960
+ obj.willWatchProperty(keyName);
2961
+ }
2734
2962
 
2735
- if (this._parent) {
2736
- this._parent.chainWillChange(this, path, depth+1);
2963
+ if (MANDATORY_SETTER && keyName in obj) {
2964
+ m.values[keyName] = obj[keyName];
2965
+ o_defineProperty(obj, keyName, {
2966
+ configurable: true,
2967
+ enumerable: true,
2968
+ set: Ember.MANDATORY_SETTER_FUNCTION,
2969
+ get: Ember.DEFAULT_GETTER_FUNCTION(keyName)
2970
+ });
2971
+ }
2737
2972
  } else {
2738
- if (depth > 1) { Ember.propertyWillChange(this.value(), path); }
2739
- path = 'this.' + path;
2740
- if (this._paths[path] > 0) { Ember.propertyWillChange(this.value(), path); }
2973
+ watching[keyName] = (watching[keyName] || 0) + 1;
2741
2974
  }
2742
2975
  };
2743
2976
 
2744
- ChainNodePrototype.chainDidChange = function(chain, path, depth) {
2745
- if (this._key) { path = this._key + '.' + path; }
2746
- if (this._parent) {
2747
- this._parent.chainDidChange(this, path, depth+1);
2748
- } else {
2749
- if (depth > 1) { Ember.propertyDidChange(this.value(), path); }
2750
- path = 'this.' + path;
2751
- if (this._paths[path] > 0) { Ember.propertyDidChange(this.value(), path); }
2752
- }
2753
- };
2754
2977
 
2755
- ChainNodePrototype.didChange = function(suppressEvent) {
2756
- // invalidate my own value first.
2757
- if (this._watching) {
2758
- var obj = this._parent.value();
2759
- if (obj !== this._object) {
2760
- removeChainWatcher(this._object, this._key, this);
2761
- this._object = obj;
2762
- addChainWatcher(obj, this._key, this);
2763
- }
2764
- this._value = undefined;
2978
+ Ember.unwatchKey = function(obj, keyName) {
2979
+ var m = metaFor(obj), watching = m.watching, desc;
2765
2980
 
2766
- // Special-case: the EachProxy relies on immediate evaluation to
2767
- // establish its observers.
2768
- if (this._parent && this._parent._key === '@each')
2769
- this.value();
2770
- }
2981
+ if (watching[keyName] === 1) {
2982
+ watching[keyName] = 0;
2983
+ desc = m.descs[keyName];
2771
2984
 
2772
- // then notify chains...
2773
- var chains = this._chains;
2774
- if (chains) {
2775
- for(var key in chains) {
2776
- if (!chains.hasOwnProperty(key)) { continue; }
2777
- chains[key].didChange(suppressEvent);
2985
+ if (desc && desc.didUnwatch) { desc.didUnwatch(obj, keyName); }
2986
+
2987
+ if ('function' === typeof obj.didUnwatchProperty) {
2988
+ obj.didUnwatchProperty(keyName);
2989
+ }
2990
+
2991
+ if (MANDATORY_SETTER && keyName in obj) {
2992
+ o_defineProperty(obj, keyName, {
2993
+ configurable: true,
2994
+ enumerable: true,
2995
+ writable: true,
2996
+ value: m.values[keyName]
2997
+ });
2998
+ delete m.values[keyName];
2778
2999
  }
3000
+ } else if (watching[keyName] > 1) {
3001
+ watching[keyName]--;
2779
3002
  }
3003
+ };
3004
+ })();
2780
3005
 
2781
- if (suppressEvent) { return; }
2782
3006
 
2783
- // and finally tell parent about my path changing...
2784
- if (this._parent) { this._parent.chainDidChange(this, this._key, 1); }
2785
- };
2786
3007
 
2787
- // get the chains for the current object. If the current object has
2788
- // chains inherited from the proto they will be cloned and reconfigured for
2789
- // the current object.
2790
- function chainsFor(obj) {
2791
- var m = metaFor(obj), ret = m.chains;
2792
- if (!ret) {
2793
- ret = m.chains = new ChainNode(null, null, obj);
2794
- } else if (ret.value() !== obj) {
2795
- ret = m.chains = ret.copy(obj);
2796
- }
2797
- return ret;
3008
+ (function() {
3009
+ var metaFor = Ember.meta, // utils.js
3010
+ get = Ember.get, // property_get.js
3011
+ normalizeTuple = Ember.normalizeTuple, // property_get.js
3012
+ forEach = Ember.ArrayPolyfills.forEach, // array.js
3013
+ warn = Ember.warn,
3014
+ watchKey = Ember.watchKey,
3015
+ unwatchKey = Ember.unwatchKey,
3016
+ propertyWillChange = Ember.propertyWillChange,
3017
+ propertyDidChange = Ember.propertyDidChange,
3018
+ FIRST_KEY = /^([^\.\*]+)/;
3019
+
3020
+ function firstKey(path) {
3021
+ return path.match(FIRST_KEY)[0];
2798
3022
  }
2799
3023
 
2800
- Ember.overrideChains = function(obj, keyName, m) {
2801
- chainsDidChange(obj, keyName, m, true);
3024
+ var pendingQueue = [];
3025
+
3026
+ // attempts to add the pendingQueue chains again. If some of them end up
3027
+ // back in the queue and reschedule is true, schedules a timeout to try
3028
+ // again.
3029
+ Ember.flushPendingChains = function() {
3030
+ if (pendingQueue.length === 0) { return; } // nothing to do
3031
+
3032
+ var queue = pendingQueue;
3033
+ pendingQueue = [];
3034
+
3035
+ forEach.call(queue, function(q) { q[0].add(q[1]); });
3036
+
3037
+ 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);
2802
3038
  };
2803
3039
 
2804
- function chainsWillChange(obj, keyName, m, arg) {
2805
- if (!m.hasOwnProperty('chainWatchers')) { return; } // nothing to do
2806
3040
 
2807
- var nodes = m.chainWatchers;
3041
+ function addChainWatcher(obj, keyName, node) {
3042
+ if (!obj || ('object' !== typeof obj)) { return; } // nothing to do
2808
3043
 
2809
- nodes = nodes[keyName];
2810
- if (!nodes) { return; }
3044
+ var m = metaFor(obj), nodes = m.chainWatchers;
2811
3045
 
2812
- for(var i = 0, l = nodes.length; i < l; i++) {
2813
- nodes[i].willChange(arg);
3046
+ if (!m.hasOwnProperty('chainWatchers')) {
3047
+ nodes = m.chainWatchers = {};
2814
3048
  }
3049
+
3050
+ if (!nodes[keyName]) { nodes[keyName] = []; }
3051
+ nodes[keyName].push(node);
3052
+ watchKey(obj, keyName);
2815
3053
  }
2816
3054
 
2817
- function chainsDidChange(obj, keyName, m, arg) {
3055
+ var removeChainWatcher = Ember.removeChainWatcher = function(obj, keyName, node) {
3056
+ if (!obj || 'object' !== typeof obj) { return; } // nothing to do
3057
+
3058
+ var m = metaFor(obj, false);
2818
3059
  if (!m.hasOwnProperty('chainWatchers')) { return; } // nothing to do
2819
3060
 
2820
3061
  var nodes = m.chainWatchers;
2821
3062
 
2822
- nodes = nodes[keyName];
2823
- if (!nodes) { return; }
2824
-
2825
- // looping in reverse because the chainWatchers array can be modified inside didChange
2826
- for (var i = nodes.length - 1; i >= 0; i--) {
2827
- nodes[i].didChange(arg);
3063
+ if (nodes[keyName]) {
3064
+ nodes = nodes[keyName];
3065
+ for (var i = 0, l = nodes.length; i < l; i++) {
3066
+ if (nodes[i] === node) { nodes.splice(i, 1); }
3067
+ }
2828
3068
  }
2829
- }
2830
-
2831
- // ..........................................................
2832
- // WATCH
2833
- //
3069
+ unwatchKey(obj, keyName);
3070
+ };
2834
3071
 
2835
- /**
2836
- @private
3072
+ function isProto(pvalue) {
3073
+ return metaFor(pvalue, false).proto === pvalue;
3074
+ }
2837
3075
 
2838
- Starts watching a property on an object. Whenever the property changes,
2839
- invokes `Ember.propertyWillChange` and `Ember.propertyDidChange`. This is the
2840
- primitive used by observers and dependent keys; usually you will never call
2841
- this method directly but instead use higher level methods like
2842
- `Ember.addObserver()`
3076
+ // A ChainNode watches a single key on an object. If you provide a starting
3077
+ // value for the key then the node won't actually watch it. For a root node
3078
+ // pass null for parent and key and object for value.
3079
+ var ChainNode = Ember._ChainNode = function(parent, key, value) {
3080
+ var obj;
3081
+ this._parent = parent;
3082
+ this._key = key;
2843
3083
 
2844
- @method watch
2845
- @for Ember
2846
- @param obj
2847
- @param {String} keyName
2848
- */
2849
- Ember.watch = function(obj, keyName) {
2850
- // can't watch length on Array - it is special...
2851
- if (keyName === 'length' && Ember.typeOf(obj) === 'array') { return this; }
3084
+ // _watching is true when calling get(this._parent, this._key) will
3085
+ // return the value of this node.
3086
+ //
3087
+ // It is false for the root of a chain (because we have no parent)
3088
+ // and for global paths (because the parent node is the object with
3089
+ // the observer on it)
3090
+ this._watching = value===undefined;
2852
3091
 
2853
- var m = metaFor(obj), watching = m.watching, desc;
3092
+ this._value = value;
3093
+ this._paths = {};
3094
+ if (this._watching) {
3095
+ this._object = parent.value();
3096
+ if (this._object) { addChainWatcher(this._object, this._key, this); }
3097
+ }
2854
3098
 
2855
- // activate watching first time
2856
- if (!watching[keyName]) {
2857
- watching[keyName] = 1;
2858
- if (isKeyName(keyName)) {
2859
- desc = m.descs[keyName];
2860
- if (desc && desc.willWatch) { desc.willWatch(obj, keyName); }
3099
+ // Special-case: the EachProxy relies on immediate evaluation to
3100
+ // establish its observers.
3101
+ //
3102
+ // TODO: Replace this with an efficient callback that the EachProxy
3103
+ // can implement.
3104
+ if (this._parent && this._parent._key === '@each') {
3105
+ this.value();
3106
+ }
3107
+ };
2861
3108
 
2862
- if ('function' === typeof obj.willWatchProperty) {
2863
- obj.willWatchProperty(keyName);
2864
- }
3109
+ var ChainNodePrototype = ChainNode.prototype;
2865
3110
 
2866
- if (MANDATORY_SETTER && keyName in obj) {
2867
- m.values[keyName] = obj[keyName];
2868
- o_defineProperty(obj, keyName, {
2869
- configurable: true,
2870
- enumerable: true,
2871
- set: Ember.MANDATORY_SETTER_FUNCTION,
2872
- get: Ember.DEFAULT_GETTER_FUNCTION(keyName)
2873
- });
2874
- }
2875
- } else {
2876
- chainsFor(obj).add(keyName);
2877
- }
3111
+ ChainNodePrototype.value = function() {
3112
+ if (this._value === undefined && this._watching) {
3113
+ var obj = this._parent.value();
3114
+ this._value = (obj && !isProto(obj)) ? get(obj, this._key) : undefined;
3115
+ }
3116
+ return this._value;
3117
+ };
2878
3118
 
2879
- } else {
2880
- watching[keyName] = (watching[keyName] || 0) + 1;
3119
+ ChainNodePrototype.destroy = function() {
3120
+ if (this._watching) {
3121
+ var obj = this._object;
3122
+ if (obj) { removeChainWatcher(obj, this._key, this); }
3123
+ this._watching = false; // so future calls do nothing
2881
3124
  }
2882
- return this;
2883
3125
  };
2884
3126
 
2885
- Ember.isWatching = function isWatching(obj, key) {
2886
- var meta = obj[META_KEY];
2887
- return (meta && meta.watching[key]) > 0;
3127
+ // copies a top level object only
3128
+ ChainNodePrototype.copy = function(obj) {
3129
+ var ret = new ChainNode(null, null, obj),
3130
+ paths = this._paths, path;
3131
+ for (path in paths) {
3132
+ if (paths[path] <= 0) { continue; } // this check will also catch non-number vals.
3133
+ ret.add(path);
3134
+ }
3135
+ return ret;
2888
3136
  };
2889
3137
 
2890
- Ember.watch.flushPending = flushPendingChains;
3138
+ // called on the root node of a chain to setup watchers on the specified
3139
+ // path.
3140
+ ChainNodePrototype.add = function(path) {
3141
+ var obj, tuple, key, src, paths;
2891
3142
 
2892
- Ember.unwatch = function(obj, keyName) {
2893
- // can't watch length on Array - it is special...
2894
- if (keyName === 'length' && Ember.typeOf(obj) === 'array') { return this; }
3143
+ paths = this._paths;
3144
+ paths[path] = (paths[path] || 0) + 1;
2895
3145
 
2896
- var m = metaFor(obj), watching = m.watching, desc;
3146
+ obj = this.value();
3147
+ tuple = normalizeTuple(obj, path);
2897
3148
 
2898
- if (watching[keyName] === 1) {
2899
- watching[keyName] = 0;
3149
+ // the path was a local path
3150
+ if (tuple[0] && tuple[0] === obj) {
3151
+ path = tuple[1];
3152
+ key = firstKey(path);
3153
+ path = path.slice(key.length+1);
2900
3154
 
2901
- if (isKeyName(keyName)) {
2902
- desc = m.descs[keyName];
2903
- if (desc && desc.didUnwatch) { desc.didUnwatch(obj, keyName); }
3155
+ // global path, but object does not exist yet.
3156
+ // put into a queue and try to connect later.
3157
+ } else if (!tuple[0]) {
3158
+ pendingQueue.push([this, path]);
3159
+ tuple.length = 0;
3160
+ return;
2904
3161
 
2905
- if ('function' === typeof obj.didUnwatchProperty) {
2906
- obj.didUnwatchProperty(keyName);
2907
- }
3162
+ // global path, and object already exists
3163
+ } else {
3164
+ src = tuple[0];
3165
+ key = path.slice(0, 0-(tuple[1].length+1));
3166
+ path = tuple[1];
3167
+ }
2908
3168
 
2909
- if (MANDATORY_SETTER && keyName in obj) {
2910
- o_defineProperty(obj, keyName, {
2911
- configurable: true,
2912
- enumerable: true,
2913
- writable: true,
2914
- value: m.values[keyName]
2915
- });
2916
- delete m.values[keyName];
2917
- }
2918
- } else {
2919
- chainsFor(obj).remove(keyName);
2920
- }
3169
+ tuple.length = 0;
3170
+ this.chain(key, path, src);
3171
+ };
2921
3172
 
2922
- } else if (watching[keyName]>1) {
2923
- watching[keyName]--;
3173
+ // called on the root node of a chain to teardown watcher on the specified
3174
+ // path
3175
+ ChainNodePrototype.remove = function(path) {
3176
+ var obj, tuple, key, src, paths;
3177
+
3178
+ paths = this._paths;
3179
+ if (paths[path] > 0) { paths[path]--; }
3180
+
3181
+ obj = this.value();
3182
+ tuple = normalizeTuple(obj, path);
3183
+ if (tuple[0] === obj) {
3184
+ path = tuple[1];
3185
+ key = firstKey(path);
3186
+ path = path.slice(key.length+1);
3187
+ } else {
3188
+ src = tuple[0];
3189
+ key = path.slice(0, 0-(tuple[1].length+1));
3190
+ path = tuple[1];
2924
3191
  }
2925
3192
 
2926
- return this;
3193
+ tuple.length = 0;
3194
+ this.unchain(key, path);
2927
3195
  };
2928
3196
 
2929
- /**
2930
- @private
3197
+ ChainNodePrototype.count = 0;
2931
3198
 
2932
- Call on an object when you first beget it from another object. This will
2933
- setup any chained watchers on the object instance as needed. This method is
2934
- safe to call multiple times.
3199
+ ChainNodePrototype.chain = function(key, path, src) {
3200
+ var chains = this._chains, node;
3201
+ if (!chains) { chains = this._chains = {}; }
2935
3202
 
2936
- @method rewatch
2937
- @for Ember
2938
- @param obj
2939
- */
2940
- Ember.rewatch = function(obj) {
2941
- var m = metaFor(obj, false), chains = m.chains;
3203
+ node = chains[key];
3204
+ if (!node) { node = chains[key] = new ChainNode(this, key, src); }
3205
+ node.count++; // count chains...
2942
3206
 
2943
- // make sure the object has its own guid.
2944
- if (GUID_KEY in obj && !obj.hasOwnProperty(GUID_KEY)) {
2945
- Ember.generateGuid(obj, 'ember');
3207
+ // chain rest of path if there is one
3208
+ if (path && path.length>0) {
3209
+ key = firstKey(path);
3210
+ path = path.slice(key.length+1);
3211
+ node.chain(key, path); // NOTE: no src means it will observe changes...
2946
3212
  }
3213
+ };
2947
3214
 
2948
- // make sure any chained watchers update.
2949
- if (chains && chains.value() !== obj) {
2950
- m.chains = chains.copy(obj);
3215
+ ChainNodePrototype.unchain = function(key, path) {
3216
+ var chains = this._chains, node = chains[key];
3217
+
3218
+ // unchain rest of path first...
3219
+ if (path && path.length>1) {
3220
+ key = firstKey(path);
3221
+ path = path.slice(key.length+1);
3222
+ node.unchain(key, path);
3223
+ }
3224
+
3225
+ // delete node if needed.
3226
+ node.count--;
3227
+ if (node.count<=0) {
3228
+ delete chains[node._key];
3229
+ node.destroy();
2951
3230
  }
2952
3231
 
2953
- return this;
2954
3232
  };
2955
3233
 
2956
- Ember.finishChains = function(obj) {
3234
+ ChainNodePrototype.willChange = function() {
3235
+ var chains = this._chains;
3236
+ if (chains) {
3237
+ for(var key in chains) {
3238
+ if (!chains.hasOwnProperty(key)) { continue; }
3239
+ chains[key].willChange();
3240
+ }
3241
+ }
3242
+
3243
+ if (this._parent) { this._parent.chainWillChange(this, this._key, 1); }
3244
+ };
3245
+
3246
+ ChainNodePrototype.chainWillChange = function(chain, path, depth) {
3247
+ if (this._key) { path = this._key + '.' + path; }
3248
+
3249
+ if (this._parent) {
3250
+ this._parent.chainWillChange(this, path, depth+1);
3251
+ } else {
3252
+ if (depth > 1) { propertyWillChange(this.value(), path); }
3253
+ path = 'this.' + path;
3254
+ if (this._paths[path] > 0) { propertyWillChange(this.value(), path); }
3255
+ }
3256
+ };
3257
+
3258
+ ChainNodePrototype.chainDidChange = function(chain, path, depth) {
3259
+ if (this._key) { path = this._key + '.' + path; }
3260
+ if (this._parent) {
3261
+ this._parent.chainDidChange(this, path, depth+1);
3262
+ } else {
3263
+ if (depth > 1) { propertyDidChange(this.value(), path); }
3264
+ path = 'this.' + path;
3265
+ if (this._paths[path] > 0) { propertyDidChange(this.value(), path); }
3266
+ }
3267
+ };
3268
+
3269
+ ChainNodePrototype.didChange = function(suppressEvent) {
3270
+ // invalidate my own value first.
3271
+ if (this._watching) {
3272
+ var obj = this._parent.value();
3273
+ if (obj !== this._object) {
3274
+ removeChainWatcher(this._object, this._key, this);
3275
+ this._object = obj;
3276
+ addChainWatcher(obj, this._key, this);
3277
+ }
3278
+ this._value = undefined;
3279
+
3280
+ // Special-case: the EachProxy relies on immediate evaluation to
3281
+ // establish its observers.
3282
+ if (this._parent && this._parent._key === '@each')
3283
+ this.value();
3284
+ }
3285
+
3286
+ // then notify chains...
3287
+ var chains = this._chains;
3288
+ if (chains) {
3289
+ for(var key in chains) {
3290
+ if (!chains.hasOwnProperty(key)) { continue; }
3291
+ chains[key].didChange(suppressEvent);
3292
+ }
3293
+ }
3294
+
3295
+ if (suppressEvent) { return; }
3296
+
3297
+ // and finally tell parent about my path changing...
3298
+ if (this._parent) { this._parent.chainDidChange(this, this._key, 1); }
3299
+ };
3300
+
3301
+ Ember.finishChains = function(obj) {
2957
3302
  var m = metaFor(obj, false), chains = m.chains;
2958
3303
  if (chains) {
2959
3304
  if (chains.value() !== obj) {
@@ -2962,75 +3307,145 @@ Ember.finishChains = function(obj) {
2962
3307
  chains.didChange(true);
2963
3308
  }
2964
3309
  };
3310
+ })();
2965
3311
 
2966
- // ..........................................................
2967
- // PROPERTY CHANGES
2968
- //
2969
3312
 
2970
- /**
2971
- This function is called just before an object property is about to change.
2972
- It will notify any before observers and prepare caches among other things.
2973
3313
 
2974
- Normally you will not need to call this method directly but if for some
2975
- reason you can't directly watch a property you can invoke this method
2976
- manually along with `Ember.propertyDidChange()` which you should call just
2977
- after the property value changes.
3314
+ (function() {
3315
+ var metaFor = Ember.meta, // utils.js
3316
+ typeOf = Ember.typeOf, // utils.js
3317
+ ChainNode = Ember._ChainNode; // chains.js
2978
3318
 
2979
- @method propertyWillChange
2980
- @for Ember
2981
- @param {Object} obj The object with the property that will change
2982
- @param {String} keyName The property key (or path) that will change.
2983
- @return {void}
3319
+ // get the chains for the current object. If the current object has
3320
+ // chains inherited from the proto they will be cloned and reconfigured for
3321
+ // the current object.
3322
+ function chainsFor(obj) {
3323
+ var m = metaFor(obj), ret = m.chains;
3324
+ if (!ret) {
3325
+ ret = m.chains = new ChainNode(null, null, obj);
3326
+ } else if (ret.value() !== obj) {
3327
+ ret = m.chains = ret.copy(obj);
3328
+ }
3329
+ return ret;
3330
+ }
3331
+
3332
+ Ember.watchPath = function(obj, keyPath) {
3333
+ // can't watch length on Array - it is special...
3334
+ if (keyPath === 'length' && typeOf(obj) === 'array') { return; }
3335
+
3336
+ var m = metaFor(obj), watching = m.watching;
3337
+
3338
+ if (!watching[keyPath]) { // activate watching first time
3339
+ watching[keyPath] = 1;
3340
+ chainsFor(obj).add(keyPath);
3341
+ } else {
3342
+ watching[keyPath] = (watching[keyPath] || 0) + 1;
3343
+ }
3344
+ };
3345
+
3346
+ Ember.unwatchPath = function(obj, keyPath) {
3347
+ var m = metaFor(obj), watching = m.watching, desc;
3348
+
3349
+ if (watching[keyPath] === 1) {
3350
+ watching[keyPath] = 0;
3351
+ chainsFor(obj).remove(keyPath);
3352
+ } else if (watching[keyPath] > 1) {
3353
+ watching[keyPath]--;
3354
+ }
3355
+ };
3356
+ })();
3357
+
3358
+
3359
+
3360
+ (function() {
3361
+ /**
3362
+ @module ember-metal
2984
3363
  */
2985
- function propertyWillChange(obj, keyName) {
2986
- var m = metaFor(obj, false),
2987
- watching = m.watching[keyName] > 0 || keyName === 'length',
2988
- proto = m.proto,
2989
- desc = m.descs[keyName];
2990
3364
 
2991
- if (!watching) { return; }
2992
- if (proto === obj) { return; }
2993
- if (desc && desc.willChange) { desc.willChange(obj, keyName); }
2994
- dependentKeysWillChange(obj, keyName, m);
2995
- chainsWillChange(obj, keyName, m);
2996
- Ember.notifyBeforeObservers(obj, keyName);
2997
- }
3365
+ var metaFor = Ember.meta, // utils.js
3366
+ GUID_KEY = Ember.GUID_KEY, // utils.js
3367
+ META_KEY = Ember.META_KEY, // utils.js
3368
+ removeChainWatcher = Ember.removeChainWatcher,
3369
+ watchKey = Ember.watchKey, // watch_key.js
3370
+ unwatchKey = Ember.unwatchKey,
3371
+ watchPath = Ember.watchPath, // watch_path.js
3372
+ unwatchPath = Ember.unwatchPath,
3373
+ typeOf = Ember.typeOf, // utils.js
3374
+ generateGuid = Ember.generateGuid,
3375
+ IS_PATH = /[\.\*]/;
2998
3376
 
2999
- Ember.propertyWillChange = propertyWillChange;
3377
+ // returns true if the passed path is just a keyName
3378
+ function isKeyName(path) {
3379
+ return path==='*' || !IS_PATH.test(path);
3380
+ }
3000
3381
 
3001
3382
  /**
3002
- This function is called just after an object property has changed.
3003
- It will notify any observers and clear caches among other things.
3383
+ @private
3004
3384
 
3005
- Normally you will not need to call this method directly but if for some
3006
- reason you can't directly watch a property you can invoke this method
3007
- manually along with `Ember.propertyWilLChange()` which you should call just
3008
- before the property value changes.
3385
+ Starts watching a property on an object. Whenever the property changes,
3386
+ invokes `Ember.propertyWillChange` and `Ember.propertyDidChange`. This is the
3387
+ primitive used by observers and dependent keys; usually you will never call
3388
+ this method directly but instead use higher level methods like
3389
+ `Ember.addObserver()`
3009
3390
 
3010
- @method propertyDidChange
3391
+ @method watch
3011
3392
  @for Ember
3012
- @param {Object} obj The object with the property that will change
3013
- @param {String} keyName The property key (or path) that will change.
3014
- @return {void}
3393
+ @param obj
3394
+ @param {String} keyName
3015
3395
  */
3016
- function propertyDidChange(obj, keyName) {
3017
- var m = metaFor(obj, false),
3018
- watching = m.watching[keyName] > 0 || keyName === 'length',
3019
- proto = m.proto,
3020
- desc = m.descs[keyName];
3396
+ Ember.watch = function(obj, keyPath) {
3397
+ // can't watch length on Array - it is special...
3398
+ if (keyPath === 'length' && typeOf(obj) === 'array') { return; }
3021
3399
 
3022
- if (proto === obj) { return; }
3400
+ if (isKeyName(keyPath)) {
3401
+ watchKey(obj, keyPath);
3402
+ } else {
3403
+ watchPath(obj, keyPath);
3404
+ }
3405
+ };
3023
3406
 
3024
- // shouldn't this mean that we're watching this key?
3025
- if (desc && desc.didChange) { desc.didChange(obj, keyName); }
3026
- if (!watching && keyName !== 'length') { return; }
3407
+ Ember.isWatching = function isWatching(obj, key) {
3408
+ var meta = obj[META_KEY];
3409
+ return (meta && meta.watching[key]) > 0;
3410
+ };
3027
3411
 
3028
- dependentKeysDidChange(obj, keyName, m);
3029
- chainsDidChange(obj, keyName, m);
3030
- Ember.notifyObservers(obj, keyName);
3031
- }
3412
+ Ember.watch.flushPending = Ember.flushPendingChains;
3413
+
3414
+ Ember.unwatch = function(obj, keyPath) {
3415
+ // can't watch length on Array - it is special...
3416
+ if (keyPath === 'length' && typeOf(obj) === 'array') { return; }
3417
+
3418
+ if (isKeyName(keyPath)) {
3419
+ unwatchKey(obj, keyPath);
3420
+ } else {
3421
+ unwatchPath(obj, keyPath);
3422
+ }
3423
+ };
3424
+
3425
+ /**
3426
+ @private
3427
+
3428
+ Call on an object when you first beget it from another object. This will
3429
+ setup any chained watchers on the object instance as needed. This method is
3430
+ safe to call multiple times.
3431
+
3432
+ @method rewatch
3433
+ @for Ember
3434
+ @param obj
3435
+ */
3436
+ Ember.rewatch = function(obj) {
3437
+ var m = metaFor(obj, false), chains = m.chains;
3032
3438
 
3033
- Ember.propertyDidChange = propertyDidChange;
3439
+ // make sure the object has its own guid.
3440
+ if (GUID_KEY in obj && !obj.hasOwnProperty(GUID_KEY)) {
3441
+ generateGuid(obj, 'ember');
3442
+ }
3443
+
3444
+ // make sure any chained watchers update.
3445
+ if (chains && chains.value() !== obj) {
3446
+ m.chains = chains.copy(obj);
3447
+ }
3448
+ };
3034
3449
 
3035
3450
  var NODE_STACK = [];
3036
3451
 
@@ -3508,7 +3923,7 @@ Ember.computed = function(func) {
3508
3923
  @param {Object} obj the object whose property you want to check
3509
3924
  @param {String} key the name of the property whose cached value you want
3510
3925
  to return
3511
- @return {any} the cached value
3926
+ @return {*} the cached value
3512
3927
  */
3513
3928
  Ember.cacheFor = function cacheFor(obj, key) {
3514
3929
  var cache = metaFor(obj, false).cache;
@@ -3779,386 +4194,112 @@ Ember.computed.defaultTo = function(defaultPath) {
3779
4194
  });
3780
4195
  };
3781
4196
 
3782
- })();
3783
-
3784
-
3785
-
3786
- (function() {
3787
- /**
3788
- @module ember-metal
3789
- */
3790
-
3791
- var o_create = Ember.create,
3792
- metaFor = Ember.meta,
3793
- META_KEY = Ember.META_KEY;
3794
-
3795
- /*
3796
- The event system uses a series of nested hashes to store listeners on an
3797
- object. When a listener is registered, or when an event arrives, these
3798
- hashes are consulted to determine which target and action pair to invoke.
3799
-
3800
- The hashes are stored in the object's meta hash, and look like this:
3801
-
3802
- // Object's meta hash
3803
- {
3804
- listeners: { // variable name: `listenerSet`
3805
- "foo:changed": [ // variable name: `actions`
3806
- [target, method, onceFlag, suspendedFlag]
3807
- ]
3808
- }
3809
- }
3810
-
3811
- */
3812
-
3813
- function indexOf(array, target, method) {
3814
- var index = -1;
3815
- for (var i = 0, l = array.length; i < l; i++) {
3816
- if (target === array[i][0] && method === array[i][1]) { index = i; break; }
3817
- }
3818
- return index;
3819
- }
3820
-
3821
- function actionsFor(obj, eventName) {
3822
- var meta = metaFor(obj, true),
3823
- actions;
3824
-
3825
- if (!meta.listeners) { meta.listeners = {}; }
3826
-
3827
- if (!meta.hasOwnProperty('listeners')) {
3828
- // setup inherited copy of the listeners object
3829
- meta.listeners = o_create(meta.listeners);
3830
- }
3831
-
3832
- actions = meta.listeners[eventName];
3833
-
3834
- // if there are actions, but the eventName doesn't exist in our listeners, then copy them from the prototype
3835
- if (actions && !meta.listeners.hasOwnProperty(eventName)) {
3836
- actions = meta.listeners[eventName] = meta.listeners[eventName].slice();
3837
- } else if (!actions) {
3838
- actions = meta.listeners[eventName] = [];
3839
- }
3840
-
3841
- return actions;
3842
- }
3843
-
3844
- function actionsUnion(obj, eventName, otherActions) {
3845
- var meta = obj[META_KEY],
3846
- actions = meta && meta.listeners && meta.listeners[eventName];
3847
-
3848
- if (!actions) { return; }
3849
- for (var i = actions.length - 1; i >= 0; i--) {
3850
- var target = actions[i][0],
3851
- method = actions[i][1],
3852
- once = actions[i][2],
3853
- suspended = actions[i][3],
3854
- actionIndex = indexOf(otherActions, target, method);
3855
-
3856
- if (actionIndex === -1) {
3857
- otherActions.push([target, method, once, suspended]);
3858
- }
3859
- }
3860
- }
3861
-
3862
- function actionsDiff(obj, eventName, otherActions) {
3863
- var meta = obj[META_KEY],
3864
- actions = meta && meta.listeners && meta.listeners[eventName],
3865
- diffActions = [];
3866
-
3867
- if (!actions) { return; }
3868
- for (var i = actions.length - 1; i >= 0; i--) {
3869
- var target = actions[i][0],
3870
- method = actions[i][1],
3871
- once = actions[i][2],
3872
- suspended = actions[i][3],
3873
- actionIndex = indexOf(otherActions, target, method);
3874
-
3875
- if (actionIndex !== -1) { continue; }
3876
-
3877
- otherActions.push([target, method, once, suspended]);
3878
- diffActions.push([target, method, once, suspended]);
3879
- }
3880
-
3881
- return diffActions;
3882
- }
3883
-
3884
- /**
3885
- Add an event listener
3886
-
3887
- @method addListener
3888
- @for Ember
3889
- @param obj
3890
- @param {String} eventName
3891
- @param {Object|Function} targetOrMethod A target object or a function
3892
- @param {Function|String} method A function or the name of a function to be called on `target`
3893
- @param {Boolean} once A flag whether a function should only be called once
3894
- */
3895
- function addListener(obj, eventName, target, method, once) {
3896
-
3897
-
3898
- if (!method && 'function' === typeof target) {
3899
- method = target;
3900
- target = null;
3901
- }
3902
-
3903
- var actions = actionsFor(obj, eventName),
3904
- actionIndex = indexOf(actions, target, method);
3905
-
3906
- if (actionIndex !== -1) { return; }
3907
-
3908
- actions.push([target, method, once, undefined]);
3909
-
3910
- if ('function' === typeof obj.didAddListener) {
3911
- obj.didAddListener(eventName, target, method);
3912
- }
3913
- }
3914
-
3915
- /**
3916
- Remove an event listener
3917
-
3918
- Arguments should match those passed to {{#crossLink "Ember/addListener"}}{{/crossLink}}
3919
-
3920
- @method removeListener
3921
- @for Ember
3922
- @param obj
3923
- @param {String} eventName
3924
- @param {Object|Function} targetOrMethod A target object or a function
3925
- @param {Function|String} method A function or the name of a function to be called on `target`
3926
- */
3927
- function removeListener(obj, eventName, target, method) {
3928
-
3929
-
3930
- if (!method && 'function' === typeof target) {
3931
- method = target;
3932
- target = null;
3933
- }
3934
-
3935
- function _removeListener(target, method, once) {
3936
- var actions = actionsFor(obj, eventName),
3937
- actionIndex = indexOf(actions, target, method);
3938
-
3939
- // action doesn't exist, give up silently
3940
- if (actionIndex === -1) { return; }
3941
-
3942
- actions.splice(actionIndex, 1);
3943
-
3944
- if ('function' === typeof obj.didRemoveListener) {
3945
- obj.didRemoveListener(eventName, target, method);
3946
- }
3947
- }
3948
-
3949
- if (method) {
3950
- _removeListener(target, method);
3951
- } else {
3952
- var meta = obj[META_KEY],
3953
- actions = meta && meta.listeners && meta.listeners[eventName];
3954
-
3955
- if (!actions) { return; }
3956
- for (var i = actions.length - 1; i >= 0; i--) {
3957
- _removeListener(actions[i][0], actions[i][1]);
3958
- }
3959
- }
3960
- }
3961
-
3962
- /**
3963
- @private
3964
-
3965
- Suspend listener during callback.
3966
-
3967
- This should only be used by the target of the event listener
3968
- when it is taking an action that would cause the event, e.g.
3969
- an object might suspend its property change listener while it is
3970
- setting that property.
3971
-
3972
- @method suspendListener
3973
- @for Ember
3974
- @param obj
3975
- @param {String} eventName
3976
- @param {Object|Function} targetOrMethod A target object or a function
3977
- @param {Function|String} method A function or the name of a function to be called on `target`
3978
- @param {Function} callback
3979
- */
3980
- function suspendListener(obj, eventName, target, method, callback) {
3981
- if (!method && 'function' === typeof target) {
3982
- method = target;
3983
- target = null;
3984
- }
3985
-
3986
- var actions = actionsFor(obj, eventName),
3987
- actionIndex = indexOf(actions, target, method),
3988
- action;
3989
-
3990
- if (actionIndex !== -1) {
3991
- action = actions[actionIndex].slice(); // copy it, otherwise we're modifying a shared object
3992
- action[3] = true; // mark the action as suspended
3993
- actions[actionIndex] = action; // replace the shared object with our copy
3994
- }
3995
-
3996
- function tryable() { return callback.call(target); }
3997
- function finalizer() { if (action) { action[3] = undefined; } }
3998
-
3999
- return Ember.tryFinally(tryable, finalizer);
4000
- }
4001
-
4002
- /**
4003
- @private
4004
-
4005
- Suspend listener during callback.
4006
-
4007
- This should only be used by the target of the event listener
4008
- when it is taking an action that would cause the event, e.g.
4009
- an object might suspend its property change listener while it is
4010
- setting that property.
4011
-
4012
- @method suspendListener
4013
- @for Ember
4014
- @param obj
4015
- @param {Array} eventName Array of event names
4016
- @param {Object|Function} targetOrMethod A target object or a function
4017
- @param {Function|String} method A function or the name of a function to be called on `target`
4018
- @param {Function} callback
4019
- */
4020
- function suspendListeners(obj, eventNames, target, method, callback) {
4021
- if (!method && 'function' === typeof target) {
4022
- method = target;
4023
- target = null;
4024
- }
4025
-
4026
- var suspendedActions = [],
4027
- eventName, actions, action, i, l;
4028
-
4029
- for (i=0, l=eventNames.length; i<l; i++) {
4030
- eventName = eventNames[i];
4031
- actions = actionsFor(obj, eventName);
4032
- var actionIndex = indexOf(actions, target, method);
4033
-
4034
- if (actionIndex !== -1) {
4035
- action = actions[actionIndex].slice();
4036
- action[3] = true;
4037
- actions[actionIndex] = action;
4038
- suspendedActions.push(action);
4039
- }
4040
- }
4041
-
4042
- function tryable() { return callback.call(target); }
4043
-
4044
- function finalizer() {
4045
- for (i = 0, l = suspendedActions.length; i < l; i++) {
4046
- suspendedActions[i][3] = undefined;
4047
- }
4048
- }
4049
-
4050
- return Ember.tryFinally(tryable, finalizer);
4051
- }
4052
-
4053
- /**
4054
- @private
4055
-
4056
- Return a list of currently watched events
4057
-
4058
- @method watchedEvents
4059
- @for Ember
4060
- @param obj
4061
- */
4062
- function watchedEvents(obj) {
4063
- var listeners = obj[META_KEY].listeners, ret = [];
4197
+ })();
4064
4198
 
4065
- if (listeners) {
4066
- for(var eventName in listeners) {
4067
- if (listeners[eventName]) { ret.push(eventName); }
4068
- }
4069
- }
4070
- return ret;
4071
- }
4072
4199
 
4200
+
4201
+ (function() {
4202
+ // Ember.tryFinally
4073
4203
  /**
4074
- @method sendEvent
4075
- @for Ember
4076
- @param obj
4077
- @param {String} eventName
4078
- @param {Array} params
4079
- @param {Array} actions
4080
- @return true
4204
+ @module ember-metal
4081
4205
  */
4082
- function sendEvent(obj, eventName, params, actions) {
4083
- // first give object a chance to handle it
4084
- if (obj !== Ember && 'function' === typeof obj.sendEvent) {
4085
- obj.sendEvent(eventName, params);
4086
- }
4087
4206
 
4088
- if (!actions) {
4089
- var meta = obj[META_KEY];
4090
- actions = meta && meta.listeners && meta.listeners[eventName];
4091
- }
4092
-
4093
- if (!actions) { return; }
4207
+ var AFTER_OBSERVERS = ':change';
4208
+ var BEFORE_OBSERVERS = ':before';
4094
4209
 
4095
- for (var i = actions.length - 1; i >= 0; i--) { // looping in reverse for once listeners
4096
- if (!actions[i] || actions[i][3] === true) { continue; }
4210
+ var guidFor = Ember.guidFor;
4097
4211
 
4098
- var target = actions[i][0],
4099
- method = actions[i][1],
4100
- once = actions[i][2];
4212
+ function changeEvent(keyName) {
4213
+ return keyName+AFTER_OBSERVERS;
4214
+ }
4101
4215
 
4102
- if (once) { removeListener(obj, eventName, target, method); }
4103
- if (!target) { target = obj; }
4104
- if ('string' === typeof method) { method = target[method]; }
4105
- if (params) {
4106
- method.apply(target, params);
4107
- } else {
4108
- method.call(target);
4109
- }
4110
- }
4111
- return true;
4216
+ function beforeEvent(keyName) {
4217
+ return keyName+BEFORE_OBSERVERS;
4112
4218
  }
4113
4219
 
4114
4220
  /**
4115
- @private
4116
- @method hasListeners
4117
- @for Ember
4221
+ @method addObserver
4118
4222
  @param obj
4119
- @param {String} eventName
4223
+ @param {String} path
4224
+ @param {Object|Function} targetOrMethod
4225
+ @param {Function|String} [method]
4120
4226
  */
4121
- function hasListeners(obj, eventName) {
4122
- var meta = obj[META_KEY],
4123
- actions = meta && meta.listeners && meta.listeners[eventName];
4227
+ Ember.addObserver = function(obj, path, target, method) {
4228
+ Ember.addListener(obj, changeEvent(path), target, method);
4229
+ Ember.watch(obj, path);
4230
+ return this;
4231
+ };
4124
4232
 
4125
- return !!(actions && actions.length);
4126
- }
4233
+ Ember.observersFor = function(obj, path) {
4234
+ return Ember.listenersFor(obj, changeEvent(path));
4235
+ };
4127
4236
 
4128
4237
  /**
4129
- @private
4130
- @method listenersFor
4131
- @for Ember
4238
+ @method removeObserver
4132
4239
  @param obj
4133
- @param {String} eventName
4240
+ @param {String} path
4241
+ @param {Object|Function} targetOrMethod
4242
+ @param {Function|String} [method]
4134
4243
  */
4135
- function listenersFor(obj, eventName) {
4136
- var ret = [];
4137
- var meta = obj[META_KEY],
4138
- actions = meta && meta.listeners && meta.listeners[eventName];
4244
+ Ember.removeObserver = function(obj, path, target, method) {
4245
+ Ember.unwatch(obj, path);
4246
+ Ember.removeListener(obj, changeEvent(path), target, method);
4247
+ return this;
4248
+ };
4139
4249
 
4140
- if (!actions) { return ret; }
4250
+ /**
4251
+ @method addBeforeObserver
4252
+ @param obj
4253
+ @param {String} path
4254
+ @param {Object|Function} targetOrMethod
4255
+ @param {Function|String} [method]
4256
+ */
4257
+ Ember.addBeforeObserver = function(obj, path, target, method) {
4258
+ Ember.addListener(obj, beforeEvent(path), target, method);
4259
+ Ember.watch(obj, path);
4260
+ return this;
4261
+ };
4141
4262
 
4142
- for (var i = 0, l = actions.length; i < l; i++) {
4143
- var target = actions[i][0],
4144
- method = actions[i][1];
4145
- ret.push([target, method]);
4146
- }
4263
+ // Suspend observer during callback.
4264
+ //
4265
+ // This should only be used by the target of the observer
4266
+ // while it is setting the observed path.
4267
+ Ember._suspendBeforeObserver = function(obj, path, target, method, callback) {
4268
+ return Ember._suspendListener(obj, beforeEvent(path), target, method, callback);
4269
+ };
4147
4270
 
4148
- return ret;
4149
- }
4271
+ Ember._suspendObserver = function(obj, path, target, method, callback) {
4272
+ return Ember._suspendListener(obj, changeEvent(path), target, method, callback);
4273
+ };
4150
4274
 
4151
- Ember.addListener = addListener;
4152
- Ember.removeListener = removeListener;
4153
- Ember._suspendListener = suspendListener;
4154
- Ember._suspendListeners = suspendListeners;
4155
- Ember.sendEvent = sendEvent;
4156
- Ember.hasListeners = hasListeners;
4157
- Ember.watchedEvents = watchedEvents;
4158
- Ember.listenersFor = listenersFor;
4159
- Ember.listenersDiff = actionsDiff;
4160
- Ember.listenersUnion = actionsUnion;
4275
+ var map = Ember.ArrayPolyfills.map;
4276
+
4277
+ Ember._suspendBeforeObservers = function(obj, paths, target, method, callback) {
4278
+ var events = map.call(paths, beforeEvent);
4279
+ return Ember._suspendListeners(obj, events, target, method, callback);
4280
+ };
4281
+
4282
+ Ember._suspendObservers = function(obj, paths, target, method, callback) {
4283
+ var events = map.call(paths, changeEvent);
4284
+ return Ember._suspendListeners(obj, events, target, method, callback);
4285
+ };
4286
+
4287
+ Ember.beforeObserversFor = function(obj, path) {
4288
+ return Ember.listenersFor(obj, beforeEvent(path));
4289
+ };
4161
4290
 
4291
+ /**
4292
+ @method removeBeforeObserver
4293
+ @param obj
4294
+ @param {String} path
4295
+ @param {Object|Function} targetOrMethod
4296
+ @param {Function|String} [method]
4297
+ */
4298
+ Ember.removeBeforeObserver = function(obj, path, target, method) {
4299
+ Ember.unwatch(obj, path);
4300
+ Ember.removeListener(obj, beforeEvent(path), target, method);
4301
+ return this;
4302
+ };
4162
4303
  })();
4163
4304
 
4164
4305
 
@@ -4830,8 +4971,9 @@ Ember.run.cancel = function(timer) {
4830
4971
 
4831
4972
  (function() {
4832
4973
  // Ember.Logger
4833
- // get, set, trySet
4834
- // guidFor, isArray, meta
4974
+ // get
4975
+ // set
4976
+ // guidFor, meta
4835
4977
  // addObserver, removeObserver
4836
4978
  // Ember.run.schedule
4837
4979
  /**
@@ -4857,8 +4999,21 @@ Ember.LOG_BINDINGS = false || !!Ember.ENV.LOG_BINDINGS;
4857
4999
  var get = Ember.get,
4858
5000
  set = Ember.set,
4859
5001
  guidFor = Ember.guidFor,
4860
- isGlobalPath = Ember.isGlobalPath;
5002
+ IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/;
5003
+
5004
+ /**
5005
+ Returns true if the provided path is global (e.g., `MyApp.fooController.bar`)
5006
+ instead of local (`foo.bar.baz`).
4861
5007
 
5008
+ @method isGlobalPath
5009
+ @for Ember
5010
+ @private
5011
+ @param {String} path
5012
+ @return Boolean
5013
+ */
5014
+ var isGlobalPath = Ember.isGlobalPath = function(path) {
5015
+ return IS_GLOBAL.test(path);
5016
+ };
4862
5017
 
4863
5018
  function getWithGlobals(obj, path) {
4864
5019
  return get(isGlobalPath(path) ? Ember.lookup : obj, path);
@@ -5450,7 +5605,7 @@ function addNormalizedProperty(base, key, value, meta, descs, values, concats) {
5450
5605
  }
5451
5606
  }
5452
5607
 
5453
- function mergeMixins(mixins, m, descs, values, base) {
5608
+ function mergeMixins(mixins, m, descs, values, base, keys) {
5454
5609
  var mixin, props, key, concats, meta;
5455
5610
 
5456
5611
  function removeKeys(keyName) {
@@ -5471,13 +5626,14 @@ function mergeMixins(mixins, m, descs, values, base) {
5471
5626
 
5472
5627
  for (key in props) {
5473
5628
  if (!props.hasOwnProperty(key)) { continue; }
5629
+ keys.push(key);
5474
5630
  addNormalizedProperty(base, key, props[key], meta, descs, values, concats);
5475
5631
  }
5476
5632
 
5477
5633
  // manually copy toString() because some JS engines do not enumerate it
5478
5634
  if (props.hasOwnProperty('toString')) { base.toString = props.toString; }
5479
5635
  } else if (mixin.mixins) {
5480
- mergeMixins(mixin.mixins, m, descs, values, base);
5636
+ mergeMixins(mixin.mixins, m, descs, values, base, keys);
5481
5637
  if (mixin._without) { a_forEach.call(mixin._without, removeKeys); }
5482
5638
  }
5483
5639
  }
@@ -5573,7 +5729,7 @@ function replaceObservers(obj, key, observer) {
5573
5729
 
5574
5730
  function applyMixin(obj, mixins, partial) {
5575
5731
  var descs = {}, values = {}, m = Ember.meta(obj),
5576
- key, value, desc;
5732
+ key, value, desc, keys = [];
5577
5733
 
5578
5734
  // Go through all mixins and hashes passed in, and:
5579
5735
  //
@@ -5581,10 +5737,11 @@ function applyMixin(obj, mixins, partial) {
5581
5737
  // * Set up _super wrapping if necessary
5582
5738
  // * Set up computed property descriptors
5583
5739
  // * Copying `toString` in broken browsers
5584
- mergeMixins(mixins, mixinsMeta(obj), descs, values, obj);
5740
+ mergeMixins(mixins, mixinsMeta(obj), descs, values, obj, keys);
5585
5741
 
5586
- for(key in values) {
5587
- if (key === 'contructor' || !values.hasOwnProperty(key)) { continue; }
5742
+ for(var i = 0, l = keys.length; i < l; i++) {
5743
+ key = keys[i];
5744
+ if (key === 'constructor' || !values.hasOwnProperty(key)) { continue; }
5588
5745
 
5589
5746
  desc = descs[key];
5590
5747
  value = values[key];
@@ -5638,7 +5795,7 @@ Ember.mixin = function(obj) {
5638
5795
  });
5639
5796
 
5640
5797
  // Mix mixins into classes by passing them as the first arguments to
5641
- // .extend or .create.
5798
+ // .extend.
5642
5799
  App.CommentView = Ember.View.extend(App.Editable, {
5643
5800
  template: Ember.Handlebars.compile('{{#if isEditing}}...{{else}}...{{/if}}')
5644
5801
  });
@@ -5657,6 +5814,12 @@ Ember.Mixin = function() { return initMixin(this, arguments); };
5657
5814
 
5658
5815
  Mixin = Ember.Mixin;
5659
5816
 
5817
+ Mixin.prototype = {
5818
+ properties: null,
5819
+ mixins: null,
5820
+ ownerConstructor: null
5821
+ };
5822
+
5660
5823
  Mixin._apply = applyMixin;
5661
5824
 
5662
5825
  Mixin.applyPartial = function(obj) {
@@ -6547,79 +6710,6 @@ define("container",
6547
6710
 
6548
6711
  var indexOf = Ember.EnumerableUtils.indexOf;
6549
6712
 
6550
- // ........................................
6551
- // TYPING & ARRAY MESSAGING
6552
- //
6553
-
6554
- var TYPE_MAP = {};
6555
- var t = "Boolean Number String Function Array Date RegExp Object".split(" ");
6556
- Ember.ArrayPolyfills.forEach.call(t, function(name) {
6557
- TYPE_MAP[ "[object " + name + "]" ] = name.toLowerCase();
6558
- });
6559
-
6560
- var toString = Object.prototype.toString;
6561
-
6562
- /**
6563
- Returns a consistent type for the passed item.
6564
-
6565
- Use this instead of the built-in `typeof` to get the type of an item.
6566
- It will return the same result across all browsers and includes a bit
6567
- more detail. Here is what will be returned:
6568
-
6569
- | Return Value | Meaning |
6570
- |---------------|------------------------------------------------------|
6571
- | 'string' | String primitive |
6572
- | 'number' | Number primitive |
6573
- | 'boolean' | Boolean primitive |
6574
- | 'null' | Null value |
6575
- | 'undefined' | Undefined value |
6576
- | 'function' | A function |
6577
- | 'array' | An instance of Array |
6578
- | 'class' | An Ember class (created using Ember.Object.extend()) |
6579
- | 'instance' | An Ember object instance |
6580
- | 'error' | An instance of the Error object |
6581
- | 'object' | A JavaScript object not inheriting from Ember.Object |
6582
-
6583
- Examples:
6584
-
6585
- ```javascript
6586
- Ember.typeOf(); // 'undefined'
6587
- Ember.typeOf(null); // 'null'
6588
- Ember.typeOf(undefined); // 'undefined'
6589
- Ember.typeOf('michael'); // 'string'
6590
- Ember.typeOf(101); // 'number'
6591
- Ember.typeOf(true); // 'boolean'
6592
- Ember.typeOf(Ember.makeArray); // 'function'
6593
- Ember.typeOf([1,2,90]); // 'array'
6594
- Ember.typeOf(Ember.Object.extend()); // 'class'
6595
- Ember.typeOf(Ember.Object.create()); // 'instance'
6596
- Ember.typeOf(new Error('teamocil')); // 'error'
6597
-
6598
- // "normal" JavaScript object
6599
- Ember.typeOf({a: 'b'}); // 'object'
6600
- ```
6601
-
6602
- @method typeOf
6603
- @for Ember
6604
- @param {Object} item the item to check
6605
- @return {String} the type
6606
- */
6607
- Ember.typeOf = function(item) {
6608
- var ret;
6609
-
6610
- ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object';
6611
-
6612
- if (ret === 'function') {
6613
- if (Ember.Object && Ember.Object.detect(item)) ret = 'class';
6614
- } else if (ret === 'object') {
6615
- if (item instanceof Error) ret = 'error';
6616
- else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';
6617
- else ret = 'object';
6618
- }
6619
-
6620
- return ret;
6621
- };
6622
-
6623
6713
  /**
6624
6714
  This will compare two javascript values of possibly different types.
6625
6715
  It will tell you which one is greater than the other by returning:
@@ -8380,7 +8470,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
8380
8470
 
8381
8471
  @method objectAt
8382
8472
  @param {Number} idx The index of the item to return.
8383
- @return {any} item at index or undefined
8473
+ @return {*} item at index or undefined
8384
8474
  */
8385
8475
  objectAt: function(idx) {
8386
8476
  if ((idx < 0) || (idx>=get(this, 'length'))) return undefined ;
@@ -9189,8 +9279,8 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
9189
9279
  ```
9190
9280
 
9191
9281
  @method pushObject
9192
- @param {anything} obj object to push
9193
- @return {any} the same obj passed as param
9282
+ @param {*} obj object to push
9283
+ @return {*} the same obj passed as param
9194
9284
  */
9195
9285
  pushObject: function(obj) {
9196
9286
  this.insertAt(get(this, 'length'), obj) ;
@@ -9269,8 +9359,8 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
9269
9359
  ```
9270
9360
 
9271
9361
  @method unshiftObject
9272
- @param {anything} obj object to unshift
9273
- @return {any} the same obj passed as param
9362
+ @param {*} obj object to unshift
9363
+ @return {*} the same obj passed as param
9274
9364
  */
9275
9365
  unshiftObject: function(obj) {
9276
9366
  this.insertAt(0, obj) ;
@@ -10231,6 +10321,8 @@ function makeCtor() {
10231
10321
 
10232
10322
  for (var i = 0, l = props.length; i < l; i++) {
10233
10323
  var properties = props[i];
10324
+
10325
+
10234
10326
  for (var keyName in properties) {
10235
10327
  if (!properties.hasOwnProperty(keyName)) { continue; }
10236
10328
 
@@ -10351,8 +10443,6 @@ CoreObject.PrototypeMixin = Mixin.create({
10351
10443
  do important setup work, and you'll see strange behavior in your
10352
10444
  application.
10353
10445
 
10354
- ```
10355
-
10356
10446
  @method init
10357
10447
  */
10358
10448
  init: function() {},
@@ -10463,12 +10553,12 @@ CoreObject.PrototypeMixin = Mixin.create({
10463
10553
  this.isDestroying = true;
10464
10554
  this._didCallDestroy = true;
10465
10555
 
10466
- if (this.willDestroy) { this.willDestroy(); }
10467
-
10468
10556
  schedule('destroy', this, this._scheduledDestroy);
10469
10557
  return this;
10470
10558
  },
10471
10559
 
10560
+ willDestroy: Ember.K,
10561
+
10472
10562
  /**
10473
10563
  @private
10474
10564
 
@@ -10478,9 +10568,9 @@ CoreObject.PrototypeMixin = Mixin.create({
10478
10568
  @method _scheduledDestroy
10479
10569
  */
10480
10570
  _scheduledDestroy: function() {
10571
+ if (this.willDestroy) { this.willDestroy(); }
10481
10572
  destroy(this);
10482
- set(this, 'isDestroyed', true);
10483
-
10573
+ this.isDestroyed = true;
10484
10574
  if (this.didDestroy) { this.didDestroy(); }
10485
10575
  },
10486
10576
 
@@ -11513,7 +11603,7 @@ Ember.EachProxy = Ember.Object.extend({
11513
11603
 
11514
11604
  @method unknownProperty
11515
11605
  @param keyName {String}
11516
- @param value {anything}
11606
+ @param value {*}
11517
11607
  */
11518
11608
  unknownProperty: function(keyName, value) {
11519
11609
  var ret;
@@ -12800,8 +12890,8 @@ Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
12800
12890
  },
12801
12891
 
12802
12892
  init: function() {
12803
- this._super();
12804
12893
  if (!this.get('content')) { Ember.defineProperty(this, 'content', undefined, Ember.A()); }
12894
+ this._super();
12805
12895
  this.set('_subControllers', Ember.A());
12806
12896
  },
12807
12897