dist/ember.js in ember-source-2.0.2 vs dist/ember.js in ember-source-2.0.3

- old
+ new

@@ -1,122 +1,420 @@ -/*! - * @overview Ember - JavaScript Application Framework - * @copyright Copyright 2011-2015 Tilde Inc. and contributors - * Portions Copyright 2006-2011 Strobe Inc. - * Portions Copyright 2008-2011 Apple Inc. All rights reserved. - * @license Licensed under MIT license - * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 2.0.2 - */ +enifed("backburner/binary-search", ["exports"], function (exports) { + "use strict"; -(function() { -var enifed, requireModule, eriuqer, requirejs, Ember; -var mainContext = this; + exports.default = binarySearch; -(function() { - var isNode = typeof window === 'undefined' && - typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + function binarySearch(time, timers) { + var start = 0; + var end = timers.length - 2; + var middle, l; - if (!isNode) { - Ember = this.Ember = this.Ember || {}; + while (start < end) { + // since timers is an array of pairs 'l' will always + // be an integer + l = (end - start) / 2; + + // compensate for the index in case even number + // of pairs inside timers + middle = start + l - l % 2; + + if (time >= timers[middle]) { + start = middle + 2; + } else { + end = middle; + } + } + + return time >= timers[start] ? start + 2 : start; } +}); +enifed('backburner/deferred-action-queues', ['exports', './utils', './queue'], function (exports, _utils, _queue) { + 'use strict'; - if (typeof Ember === 'undefined') { Ember = {}; }; + exports.default = DeferredActionQueues; - if (typeof Ember.__loader === 'undefined') { - var registry = {}; - var seen = {}; + function DeferredActionQueues(queueNames, options) { + var queues = this.queues = {}; + this.queueNames = queueNames = queueNames || []; - enifed = function(name, deps, callback) { - var value = { }; + this.options = options; - if (!callback) { - value.deps = []; - value.callback = deps; + _utils.each(queueNames, function (queueName) { + queues[queueName] = new _queue.default(queueName, options[queueName], options); + }); + } + + function noSuchQueue(name) { + throw new Error('You attempted to schedule an action in a queue (' + name + ') that doesn\'t exist'); + } + + function noSuchMethod(name) { + throw new Error('You attempted to schedule an action in a queue (' + name + ') for a method that doesn\'t exist'); + } + + DeferredActionQueues.prototype = { + schedule: function (name, target, method, args, onceFlag, stack) { + var queues = this.queues; + var queue = queues[name]; + + if (!queue) { + noSuchQueue(name); + } + + if (!method) { + noSuchMethod(name); + } + + if (onceFlag) { + return queue.pushUnique(target, method, args, stack); } else { - value.deps = deps; - value.callback = callback; + return queue.push(target, method, args, stack); } + }, - registry[name] = value; - }; + flush: function () { + var queues = this.queues; + var queueNames = this.queueNames; + var queueName, queue, queueItems, priorQueueNameIndex; + var queueNameIndex = 0; + var numberOfQueues = queueNames.length; + var options = this.options; - requirejs = eriuqer = requireModule = function(name) { - return internalRequire(name, null); + while (queueNameIndex < numberOfQueues) { + queueName = queueNames[queueNameIndex]; + queue = queues[queueName]; + + var numberOfQueueItems = queue._queue.length; + + if (numberOfQueueItems === 0) { + queueNameIndex++; + } else { + queue.flush(false /* async */); + queueNameIndex = 0; + } + } } + }; +}); +enifed('backburner/platform', ['exports'], function (exports) { + // In IE 6-8, try/finally doesn't work without a catch. + // Unfortunately, this is impossible to test for since wrapping it in a parent try/catch doesn't trigger the bug. + // This tests for another broken try/catch behavior that only exhibits in the same versions of IE. + 'use strict'; - function internalRequire(name, referrerName) { - var exports = seen[name]; + var needsIETryCatchFix = (function (e, x) { + try { + x(); + } catch (e) {} // jshint ignore:line + return !!e; + })(); - if (exports !== undefined) { - return exports; + exports.needsIETryCatchFix = needsIETryCatchFix; + var platform; + + /* global self */ + if (typeof self === 'object') { + platform = self; + + /* global global */ + } else if (typeof global === 'object') { + platform = global; + } else { + throw new Error('no global: `self` or `global` found'); + } + + exports.default = platform; +}); +enifed('backburner/queue', ['exports', './utils'], function (exports, _utils) { + 'use strict'; + + exports.default = Queue; + + function Queue(name, options, globalOptions) { + this.name = name; + this.globalOptions = globalOptions || {}; + this.options = options; + this._queue = []; + this.targetQueues = {}; + this._queueBeingFlushed = undefined; + } + + Queue.prototype = { + push: function (target, method, args, stack) { + var queue = this._queue; + queue.push(target, method, args, stack); + + return { + queue: this, + target: target, + method: method + }; + }, + + pushUniqueWithoutGuid: function (target, method, args, stack) { + var queue = this._queue; + + for (var i = 0, l = queue.length; i < l; i += 4) { + var currentTarget = queue[i]; + var currentMethod = queue[i + 1]; + + if (currentTarget === target && currentMethod === method) { + queue[i + 2] = args; // replace args + queue[i + 3] = stack; // replace stack + return; + } } - exports = seen[name] = {}; + queue.push(target, method, args, stack); + }, - if (!registry[name]) { - if (referrerName) { - throw new Error('Could not find module ' + name + ' required by: ' + referrerName); - } else { - throw new Error('Could not find module ' + name); + targetQueue: function (targetQueue, target, method, args, stack) { + var queue = this._queue; + + for (var i = 0, l = targetQueue.length; i < l; i += 2) { + var currentMethod = targetQueue[i]; + var currentIndex = targetQueue[i + 1]; + + if (currentMethod === method) { + queue[currentIndex + 2] = args; // replace args + queue[currentIndex + 3] = stack; // replace stack + return; } } - var mod = registry[name]; - var deps = mod.deps; - var callback = mod.callback; - var reified = []; - var length = deps.length; + targetQueue.push(method, queue.push(target, method, args, stack) - 4); + }, - for (var i=0; i<length; i++) { - if (deps[i] === 'exports') { - reified.push(exports); + pushUniqueWithGuid: function (guid, target, method, args, stack) { + var hasLocalQueue = this.targetQueues[guid]; + + if (hasLocalQueue) { + this.targetQueue(hasLocalQueue, target, method, args, stack); + } else { + this.targetQueues[guid] = [method, this._queue.push(target, method, args, stack) - 4]; + } + + return { + queue: this, + target: target, + method: method + }; + }, + + pushUnique: function (target, method, args, stack) { + var queue = this._queue, + currentTarget, + currentMethod, + i, + l; + var KEY = this.globalOptions.GUID_KEY; + + if (target && KEY) { + var guid = target[KEY]; + if (guid) { + return this.pushUniqueWithGuid(guid, target, method, args, stack); + } + } + + this.pushUniqueWithoutGuid(target, method, args, stack); + + return { + queue: this, + target: target, + method: method + }; + }, + + invoke: function (target, method, args, _, _errorRecordedForStack) { + if (args && args.length > 0) { + method.apply(target, args); + } else { + method.call(target); + } + }, + + invokeWithOnError: function (target, method, args, onError, errorRecordedForStack) { + try { + if (args && args.length > 0) { + method.apply(target, args); } else { - reified.push(internalRequire(resolve(deps[i], name), name)); + method.call(target); } + } catch (error) { + onError(error, errorRecordedForStack); } + }, - callback.apply(this, reified); + flush: function (sync) { + var queue = this._queue; + var length = queue.length; - return exports; - }; + if (length === 0) { + return; + } - function resolve(child, name) { - if (child.charAt(0) !== '.') { - return child; + var globalOptions = this.globalOptions; + var options = this.options; + var before = options && options.before; + var after = options && options.after; + var onError = globalOptions.onError || globalOptions.onErrorTarget && globalOptions.onErrorTarget[globalOptions.onErrorMethod]; + var target, method, args, errorRecordedForStack; + var invoke = onError ? this.invokeWithOnError : this.invoke; + + this.targetQueues = Object.create(null); + var queueItems = this._queueBeingFlushed = this._queue.slice(); + this._queue = []; + + if (before) { + before(); } - var parts = child.split('/'); - var parentBase = name.split('/').slice(0, -1); - for (var i=0, l=parts.length; i<l; i++) { - var part = parts[i]; + for (var i = 0; i < length; i += 4) { + target = queueItems[i]; + method = queueItems[i + 1]; + args = queueItems[i + 2]; + errorRecordedForStack = queueItems[i + 3]; // Debugging assistance - if (part === '..') { - parentBase.pop(); - } else if (part === '.') { - continue; - } else { - parentBase.push(part); + if (_utils.isString(method)) { + method = target[method]; } + + // method could have been nullified / canceled during flush + if (method) { + // + // ** Attention intrepid developer ** + // + // To find out the stack of this task when it was scheduled onto + // the run loop, add the following to your app.js: + // + // Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production. + // + // Once that is in place, when you are at a breakpoint and navigate + // here in the stack explorer, you can look at `errorRecordedForStack.stack`, + // which will be the captured stack when this job was scheduled. + // + invoke(target, method, args, onError, errorRecordedForStack); + } } - return parentBase.join('/'); + if (after) { + after(); + } + + this._queueBeingFlushed = undefined; + + if (sync !== false && this._queue.length > 0) { + // check if new items have been added + this.flush(true); + } + }, + + cancel: function (actionToCancel) { + var queue = this._queue, + currentTarget, + currentMethod, + i, + l; + var target = actionToCancel.target; + var method = actionToCancel.method; + var GUID_KEY = this.globalOptions.GUID_KEY; + + if (GUID_KEY && this.targetQueues && target) { + var targetQueue = this.targetQueues[target[GUID_KEY]]; + + if (targetQueue) { + for (i = 0, l = targetQueue.length; i < l; i++) { + if (targetQueue[i] === method) { + targetQueue.splice(i, 1); + } + } + } + } + + for (i = 0, l = queue.length; i < l; i += 4) { + currentTarget = queue[i]; + currentMethod = queue[i + 1]; + + if (currentTarget === target && currentMethod === method) { + queue.splice(i, 4); + return true; + } + } + + // if not found in current queue + // could be in the queue that is being flushed + queue = this._queueBeingFlushed; + + if (!queue) { + return; + } + + for (i = 0, l = queue.length; i < l; i += 4) { + currentTarget = queue[i]; + currentMethod = queue[i + 1]; + + if (currentTarget === target && currentMethod === method) { + // don't mess with array during flush + // just nullify the method + queue[i + 1] = null; + return true; + } + } } + }; +}); +enifed('backburner/utils', ['exports'], function (exports) { + 'use strict'; - requirejs._eak_seen = registry; + exports.each = each; + exports.isString = isString; + exports.isFunction = isFunction; + exports.isNumber = isNumber; + exports.isCoercableNumber = isCoercableNumber; + exports.wrapInTryCatch = wrapInTryCatch; + var NUMBER = /\d+/; - Ember.__loader = { - define: enifed, - require: eriuqer, - registry: registry - }; - } else { - enifed = Ember.__loader.define; - requirejs = eriuqer = requireModule = Ember.__loader.require; + function each(collection, callback) { + for (var i = 0; i < collection.length; i++) { + callback(collection[i]); + } } -})(); + // Date.now is not available in browsers < IE9 + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility + var now = Date.now || function () { + return new Date().getTime(); + }; + + exports.now = now; + + function isString(suspect) { + return typeof suspect === 'string'; + } + + function isFunction(suspect) { + return typeof suspect === 'function'; + } + + function isNumber(suspect) { + return typeof suspect === 'number'; + } + + function isCoercableNumber(number) { + return isNumber(number) || NUMBER.test(number); + } + + function wrapInTryCatch(func) { + return function () { + try { + return func.apply(this, arguments); + } catch (e) { + throw e; + } + }; + } +}); enifed('backburner', ['exports', './backburner/utils', './backburner/platform', './backburner/binary-search', './backburner/deferred-action-queues'], function (exports, _backburnerUtils, _backburnerPlatform, _backburnerBinarySearch, _backburnerDeferredActionQueues) { 'use strict'; exports.default = Backburner; @@ -743,449 +1041,12 @@ } return index; } }); -enifed("backburner/binary-search", ["exports"], function (exports) { - "use strict"; +requireModule("ember"); - exports.default = binarySearch; - - function binarySearch(time, timers) { - var start = 0; - var end = timers.length - 2; - var middle, l; - - while (start < end) { - // since timers is an array of pairs 'l' will always - // be an integer - l = (end - start) / 2; - - // compensate for the index in case even number - // of pairs inside timers - middle = start + l - l % 2; - - if (time >= timers[middle]) { - start = middle + 2; - } else { - end = middle; - } - } - - return time >= timers[start] ? start + 2 : start; - } -}); -enifed('backburner/deferred-action-queues', ['exports', './utils', './queue'], function (exports, _utils, _queue) { - 'use strict'; - - exports.default = DeferredActionQueues; - - function DeferredActionQueues(queueNames, options) { - var queues = this.queues = {}; - this.queueNames = queueNames = queueNames || []; - - this.options = options; - - _utils.each(queueNames, function (queueName) { - queues[queueName] = new _queue.default(queueName, options[queueName], options); - }); - } - - function noSuchQueue(name) { - throw new Error('You attempted to schedule an action in a queue (' + name + ') that doesn\'t exist'); - } - - function noSuchMethod(name) { - throw new Error('You attempted to schedule an action in a queue (' + name + ') for a method that doesn\'t exist'); - } - - DeferredActionQueues.prototype = { - schedule: function (name, target, method, args, onceFlag, stack) { - var queues = this.queues; - var queue = queues[name]; - - if (!queue) { - noSuchQueue(name); - } - - if (!method) { - noSuchMethod(name); - } - - if (onceFlag) { - return queue.pushUnique(target, method, args, stack); - } else { - return queue.push(target, method, args, stack); - } - }, - - flush: function () { - var queues = this.queues; - var queueNames = this.queueNames; - var queueName, queue, queueItems, priorQueueNameIndex; - var queueNameIndex = 0; - var numberOfQueues = queueNames.length; - var options = this.options; - - while (queueNameIndex < numberOfQueues) { - queueName = queueNames[queueNameIndex]; - queue = queues[queueName]; - - var numberOfQueueItems = queue._queue.length; - - if (numberOfQueueItems === 0) { - queueNameIndex++; - } else { - queue.flush(false /* async */); - queueNameIndex = 0; - } - } - } - }; -}); -enifed('backburner/platform', ['exports'], function (exports) { - // In IE 6-8, try/finally doesn't work without a catch. - // Unfortunately, this is impossible to test for since wrapping it in a parent try/catch doesn't trigger the bug. - // This tests for another broken try/catch behavior that only exhibits in the same versions of IE. - 'use strict'; - - var needsIETryCatchFix = (function (e, x) { - try { - x(); - } catch (e) {} // jshint ignore:line - return !!e; - })(); - - exports.needsIETryCatchFix = needsIETryCatchFix; - var platform; - - /* global self */ - if (typeof self === 'object') { - platform = self; - - /* global global */ - } else if (typeof global === 'object') { - platform = global; - } else { - throw new Error('no global: `self` or `global` found'); - } - - exports.default = platform; -}); -enifed('backburner/queue', ['exports', './utils'], function (exports, _utils) { - 'use strict'; - - exports.default = Queue; - - function Queue(name, options, globalOptions) { - this.name = name; - this.globalOptions = globalOptions || {}; - this.options = options; - this._queue = []; - this.targetQueues = {}; - this._queueBeingFlushed = undefined; - } - - Queue.prototype = { - push: function (target, method, args, stack) { - var queue = this._queue; - queue.push(target, method, args, stack); - - return { - queue: this, - target: target, - method: method - }; - }, - - pushUniqueWithoutGuid: function (target, method, args, stack) { - var queue = this._queue; - - for (var i = 0, l = queue.length; i < l; i += 4) { - var currentTarget = queue[i]; - var currentMethod = queue[i + 1]; - - if (currentTarget === target && currentMethod === method) { - queue[i + 2] = args; // replace args - queue[i + 3] = stack; // replace stack - return; - } - } - - queue.push(target, method, args, stack); - }, - - targetQueue: function (targetQueue, target, method, args, stack) { - var queue = this._queue; - - for (var i = 0, l = targetQueue.length; i < l; i += 2) { - var currentMethod = targetQueue[i]; - var currentIndex = targetQueue[i + 1]; - - if (currentMethod === method) { - queue[currentIndex + 2] = args; // replace args - queue[currentIndex + 3] = stack; // replace stack - return; - } - } - - targetQueue.push(method, queue.push(target, method, args, stack) - 4); - }, - - pushUniqueWithGuid: function (guid, target, method, args, stack) { - var hasLocalQueue = this.targetQueues[guid]; - - if (hasLocalQueue) { - this.targetQueue(hasLocalQueue, target, method, args, stack); - } else { - this.targetQueues[guid] = [method, this._queue.push(target, method, args, stack) - 4]; - } - - return { - queue: this, - target: target, - method: method - }; - }, - - pushUnique: function (target, method, args, stack) { - var queue = this._queue, - currentTarget, - currentMethod, - i, - l; - var KEY = this.globalOptions.GUID_KEY; - - if (target && KEY) { - var guid = target[KEY]; - if (guid) { - return this.pushUniqueWithGuid(guid, target, method, args, stack); - } - } - - this.pushUniqueWithoutGuid(target, method, args, stack); - - return { - queue: this, - target: target, - method: method - }; - }, - - invoke: function (target, method, args, _, _errorRecordedForStack) { - if (args && args.length > 0) { - method.apply(target, args); - } else { - method.call(target); - } - }, - - invokeWithOnError: function (target, method, args, onError, errorRecordedForStack) { - try { - if (args && args.length > 0) { - method.apply(target, args); - } else { - method.call(target); - } - } catch (error) { - onError(error, errorRecordedForStack); - } - }, - - flush: function (sync) { - var queue = this._queue; - var length = queue.length; - - if (length === 0) { - return; - } - - var globalOptions = this.globalOptions; - var options = this.options; - var before = options && options.before; - var after = options && options.after; - var onError = globalOptions.onError || globalOptions.onErrorTarget && globalOptions.onErrorTarget[globalOptions.onErrorMethod]; - var target, method, args, errorRecordedForStack; - var invoke = onError ? this.invokeWithOnError : this.invoke; - - this.targetQueues = Object.create(null); - var queueItems = this._queueBeingFlushed = this._queue.slice(); - this._queue = []; - - if (before) { - before(); - } - - for (var i = 0; i < length; i += 4) { - target = queueItems[i]; - method = queueItems[i + 1]; - args = queueItems[i + 2]; - errorRecordedForStack = queueItems[i + 3]; // Debugging assistance - - if (_utils.isString(method)) { - method = target[method]; - } - - // method could have been nullified / canceled during flush - if (method) { - // - // ** Attention intrepid developer ** - // - // To find out the stack of this task when it was scheduled onto - // the run loop, add the following to your app.js: - // - // Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production. - // - // Once that is in place, when you are at a breakpoint and navigate - // here in the stack explorer, you can look at `errorRecordedForStack.stack`, - // which will be the captured stack when this job was scheduled. - // - invoke(target, method, args, onError, errorRecordedForStack); - } - } - - if (after) { - after(); - } - - this._queueBeingFlushed = undefined; - - if (sync !== false && this._queue.length > 0) { - // check if new items have been added - this.flush(true); - } - }, - - cancel: function (actionToCancel) { - var queue = this._queue, - currentTarget, - currentMethod, - i, - l; - var target = actionToCancel.target; - var method = actionToCancel.method; - var GUID_KEY = this.globalOptions.GUID_KEY; - - if (GUID_KEY && this.targetQueues && target) { - var targetQueue = this.targetQueues[target[GUID_KEY]]; - - if (targetQueue) { - for (i = 0, l = targetQueue.length; i < l; i++) { - if (targetQueue[i] === method) { - targetQueue.splice(i, 1); - } - } - } - } - - for (i = 0, l = queue.length; i < l; i += 4) { - currentTarget = queue[i]; - currentMethod = queue[i + 1]; - - if (currentTarget === target && currentMethod === method) { - queue.splice(i, 4); - return true; - } - } - - // if not found in current queue - // could be in the queue that is being flushed - queue = this._queueBeingFlushed; - - if (!queue) { - return; - } - - for (i = 0, l = queue.length; i < l; i += 4) { - currentTarget = queue[i]; - currentMethod = queue[i + 1]; - - if (currentTarget === target && currentMethod === method) { - // don't mess with array during flush - // just nullify the method - queue[i + 1] = null; - return true; - } - } - } - }; -}); -enifed('backburner/utils', ['exports'], function (exports) { - 'use strict'; - - exports.each = each; - exports.isString = isString; - exports.isFunction = isFunction; - exports.isNumber = isNumber; - exports.isCoercableNumber = isCoercableNumber; - exports.wrapInTryCatch = wrapInTryCatch; - var NUMBER = /\d+/; - - function each(collection, callback) { - for (var i = 0; i < collection.length; i++) { - callback(collection[i]); - } - } - - // Date.now is not available in browsers < IE9 - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility - var now = Date.now || function () { - return new Date().getTime(); - }; - - exports.now = now; - - function isString(suspect) { - return typeof suspect === 'string'; - } - - function isFunction(suspect) { - return typeof suspect === 'function'; - } - - function isNumber(suspect) { - return typeof suspect === 'number'; - } - - function isCoercableNumber(number) { - return isNumber(number) || NUMBER.test(number); - } - - function wrapInTryCatch(func) { - return function () { - try { - return func.apply(this, arguments); - } catch (e) { - throw e; - } - }; - } -}); -enifed('container', ['exports', 'ember-metal/core', 'container/registry', 'container/container'], function (exports, _emberMetalCore, _containerRegistry, _containerContainer) { - 'use strict'; - - /* - Public api for the container is still in flux. - The public api, specified on the application namespace should be considered the stable api. - // @module container - @private - */ - - /* - Flag to enable/disable model factory injections (disabled by default) - If model factory injections are enabled, models should not be - accessed globally (only through `container.lookupFactory('model:modelName'))`); - */ - _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = false; - - if (_emberMetalCore.default.ENV && typeof _emberMetalCore.default.ENV.MODEL_FACTORY_INJECTIONS !== 'undefined') { - _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = !!_emberMetalCore.default.ENV.MODEL_FACTORY_INJECTIONS; - } - - exports.Registry = _containerRegistry.default; - exports.Container = _containerContainer.default; -}); enifed('container/container', ['exports', 'ember-metal/core', 'ember-metal/dictionary'], function (exports, _emberMetalCore, _emberMetalDictionary) { 'use strict'; /** A container used to instantiate and cache objects. @@ -2165,10 +2026,34 @@ } exports.default = Registry; }); // Ember.assert +enifed('container', ['exports', 'ember-metal/core', 'container/registry', 'container/container'], function (exports, _emberMetalCore, _containerRegistry, _containerContainer) { + 'use strict'; + + /* + Public api for the container is still in flux. + The public api, specified on the application namespace should be considered the stable api. + // @module container + @private + */ + + /* + Flag to enable/disable model factory injections (disabled by default) + If model factory injections are enabled, models should not be + accessed globally (only through `container.lookupFactory('model:modelName'))`); + */ + _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = false; + + if (_emberMetalCore.default.ENV && typeof _emberMetalCore.default.ENV.MODEL_FACTORY_INJECTIONS !== 'undefined') { + _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = !!_emberMetalCore.default.ENV.MODEL_FACTORY_INJECTIONS; + } + + exports.Registry = _containerRegistry.default; + exports.Container = _containerContainer.default; +}); enifed("dag-map", ["exports"], function (exports) { "use strict"; function visit(vertex, fn, visited, path) { var name = vertex.name; @@ -2361,10 +2246,465 @@ module.exports = _dagMap.default; } else if (typeof undefined !== 'undefined') { undefined['DAG'] = _dagMap.default; } }); +enifed('dom-helper/build-html-dom', ['exports'], function (exports) { + /* global XMLSerializer:false */ + 'use strict'; + + var svgHTMLIntegrationPoints = { foreignObject: 1, desc: 1, title: 1 }; + exports.svgHTMLIntegrationPoints = svgHTMLIntegrationPoints; + var svgNamespace = 'http://www.w3.org/2000/svg'; + + exports.svgNamespace = svgNamespace; + var doc = typeof document === 'undefined' ? false : document; + + // Safari does not like using innerHTML on SVG HTML integration + // points (desc/title/foreignObject). + var needsIntegrationPointFix = doc && (function (document) { + if (document.createElementNS === undefined) { + return; + } + // In FF title will not accept innerHTML. + var testEl = document.createElementNS(svgNamespace, 'title'); + testEl.innerHTML = "<div></div>"; + return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1; + })(doc); + + // Internet Explorer prior to 9 does not allow setting innerHTML if the first element + // is a "zero-scope" element. This problem can be worked around by making + // the first node an invisible text node. We, like Modernizr, use &shy; + var needsShy = doc && (function (document) { + var testEl = document.createElement('div'); + testEl.innerHTML = "<div></div>"; + testEl.firstChild.innerHTML = "<script><\/script>"; + return testEl.firstChild.innerHTML === ''; + })(doc); + + // IE 8 (and likely earlier) likes to move whitespace preceeding + // a script tag to appear after it. This means that we can + // accidentally remove whitespace when updating a morph. + var movesWhitespace = doc && (function (document) { + var testEl = document.createElement('div'); + testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value"; + return testEl.childNodes[0].nodeValue === 'Test:' && testEl.childNodes[2].nodeValue === ' Value'; + })(doc); + + var tagNamesRequiringInnerHTMLFix = doc && (function (document) { + var tagNamesRequiringInnerHTMLFix; + // IE 9 and earlier don't allow us to set innerHTML on col, colgroup, frameset, + // html, style, table, tbody, tfoot, thead, title, tr. Detect this and add + // them to an initial list of corrected tags. + // + // Here we are only dealing with the ones which can have child nodes. + // + var tableNeedsInnerHTMLFix; + var tableInnerHTMLTestElement = document.createElement('table'); + try { + tableInnerHTMLTestElement.innerHTML = '<tbody></tbody>'; + } catch (e) {} finally { + tableNeedsInnerHTMLFix = tableInnerHTMLTestElement.childNodes.length === 0; + } + if (tableNeedsInnerHTMLFix) { + tagNamesRequiringInnerHTMLFix = { + colgroup: ['table'], + table: [], + tbody: ['table'], + tfoot: ['table'], + thead: ['table'], + tr: ['table', 'tbody'] + }; + } + + // IE 8 doesn't allow setting innerHTML on a select tag. Detect this and + // add it to the list of corrected tags. + // + var selectInnerHTMLTestElement = document.createElement('select'); + selectInnerHTMLTestElement.innerHTML = '<option></option>'; + if (!selectInnerHTMLTestElement.childNodes[0]) { + tagNamesRequiringInnerHTMLFix = tagNamesRequiringInnerHTMLFix || {}; + tagNamesRequiringInnerHTMLFix.select = []; + } + return tagNamesRequiringInnerHTMLFix; + })(doc); + + function scriptSafeInnerHTML(element, html) { + // without a leading text node, IE will drop a leading script tag. + html = '&shy;' + html; + + element.innerHTML = html; + + var nodes = element.childNodes; + + // Look for &shy; to remove it. + var shyElement = nodes[0]; + while (shyElement.nodeType === 1 && !shyElement.nodeName) { + shyElement = shyElement.firstChild; + } + // At this point it's the actual unicode character. + if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") { + var newValue = shyElement.nodeValue.slice(1); + if (newValue.length) { + shyElement.nodeValue = shyElement.nodeValue.slice(1); + } else { + shyElement.parentNode.removeChild(shyElement); + } + } + + return nodes; + } + + function buildDOMWithFix(html, contextualElement) { + var tagName = contextualElement.tagName; + + // Firefox versions < 11 do not have support for element.outerHTML. + var outerHTML = contextualElement.outerHTML || new XMLSerializer().serializeToString(contextualElement); + if (!outerHTML) { + throw "Can't set innerHTML on " + tagName + " in this browser"; + } + + html = fixSelect(html, contextualElement); + + var wrappingTags = tagNamesRequiringInnerHTMLFix[tagName.toLowerCase()]; + + var startTag = outerHTML.match(new RegExp("<" + tagName + "([^>]*)>", 'i'))[0]; + var endTag = '</' + tagName + '>'; + + var wrappedHTML = [startTag, html, endTag]; + + var i = wrappingTags.length; + var wrappedDepth = 1 + i; + while (i--) { + wrappedHTML.unshift('<' + wrappingTags[i] + '>'); + wrappedHTML.push('</' + wrappingTags[i] + '>'); + } + + var wrapper = document.createElement('div'); + scriptSafeInnerHTML(wrapper, wrappedHTML.join('')); + var element = wrapper; + while (wrappedDepth--) { + element = element.firstChild; + while (element && element.nodeType !== 1) { + element = element.nextSibling; + } + } + while (element && element.tagName !== tagName) { + element = element.nextSibling; + } + return element ? element.childNodes : []; + } + + var buildDOM; + if (needsShy) { + buildDOM = function buildDOM(html, contextualElement, dom) { + html = fixSelect(html, contextualElement); + + contextualElement = dom.cloneNode(contextualElement, false); + scriptSafeInnerHTML(contextualElement, html); + return contextualElement.childNodes; + }; + } else { + buildDOM = function buildDOM(html, contextualElement, dom) { + html = fixSelect(html, contextualElement); + + contextualElement = dom.cloneNode(contextualElement, false); + contextualElement.innerHTML = html; + return contextualElement.childNodes; + }; + } + + function fixSelect(html, contextualElement) { + if (contextualElement.tagName === 'SELECT') { + html = "<option></option>" + html; + } + + return html; + } + + var buildIESafeDOM; + if (tagNamesRequiringInnerHTMLFix || movesWhitespace) { + buildIESafeDOM = function buildIESafeDOM(html, contextualElement, dom) { + // Make a list of the leading text on script nodes. Include + // script tags without any whitespace for easier processing later. + var spacesBefore = []; + var spacesAfter = []; + if (typeof html === 'string') { + html = html.replace(/(\s*)(<script)/g, function (match, spaces, tag) { + spacesBefore.push(spaces); + return tag; + }); + + html = html.replace(/(<\/script>)(\s*)/g, function (match, tag, spaces) { + spacesAfter.push(spaces); + return tag; + }); + } + + // Fetch nodes + var nodes; + if (tagNamesRequiringInnerHTMLFix[contextualElement.tagName.toLowerCase()]) { + // buildDOMWithFix uses string wrappers for problematic innerHTML. + nodes = buildDOMWithFix(html, contextualElement); + } else { + nodes = buildDOM(html, contextualElement, dom); + } + + // Build a list of script tags, the nodes themselves will be + // mutated as we add test nodes. + var i, j, node, nodeScriptNodes; + var scriptNodes = []; + for (i = 0; i < nodes.length; i++) { + node = nodes[i]; + if (node.nodeType !== 1) { + continue; + } + if (node.tagName === 'SCRIPT') { + scriptNodes.push(node); + } else { + nodeScriptNodes = node.getElementsByTagName('script'); + for (j = 0; j < nodeScriptNodes.length; j++) { + scriptNodes.push(nodeScriptNodes[j]); + } + } + } + + // Walk the script tags and put back their leading text nodes. + var scriptNode, textNode, spaceBefore, spaceAfter; + for (i = 0; i < scriptNodes.length; i++) { + scriptNode = scriptNodes[i]; + spaceBefore = spacesBefore[i]; + if (spaceBefore && spaceBefore.length > 0) { + textNode = dom.document.createTextNode(spaceBefore); + scriptNode.parentNode.insertBefore(textNode, scriptNode); + } + + spaceAfter = spacesAfter[i]; + if (spaceAfter && spaceAfter.length > 0) { + textNode = dom.document.createTextNode(spaceAfter); + scriptNode.parentNode.insertBefore(textNode, scriptNode.nextSibling); + } + } + + return nodes; + }; + } else { + buildIESafeDOM = buildDOM; + } + + var buildHTMLDOM; + if (needsIntegrationPointFix) { + exports.buildHTMLDOM = buildHTMLDOM = function buildHTMLDOM(html, contextualElement, dom) { + if (svgHTMLIntegrationPoints[contextualElement.tagName]) { + return buildIESafeDOM(html, document.createElement('div'), dom); + } else { + return buildIESafeDOM(html, contextualElement, dom); + } + }; + } else { + exports.buildHTMLDOM = buildHTMLDOM = buildIESafeDOM; + } + + exports.buildHTMLDOM = buildHTMLDOM; +}); +enifed('dom-helper/classes', ['exports'], function (exports) { + 'use strict'; + + var doc = typeof document === 'undefined' ? false : document; + + // PhantomJS has a broken classList. See https://github.com/ariya/phantomjs/issues/12782 + var canClassList = doc && (function () { + var d = document.createElement('div'); + if (!d.classList) { + return false; + } + d.classList.add('boo'); + d.classList.add('boo', 'baz'); + return d.className === 'boo baz'; + })(); + + function buildClassList(element) { + var classString = element.getAttribute('class') || ''; + return classString !== '' && classString !== ' ' ? classString.split(' ') : []; + } + + function intersect(containingArray, valuesArray) { + var containingIndex = 0; + var containingLength = containingArray.length; + var valuesIndex = 0; + var valuesLength = valuesArray.length; + + var intersection = new Array(valuesLength); + + // TODO: rewrite this loop in an optimal manner + for (; containingIndex < containingLength; containingIndex++) { + valuesIndex = 0; + for (; valuesIndex < valuesLength; valuesIndex++) { + if (valuesArray[valuesIndex] === containingArray[containingIndex]) { + intersection[valuesIndex] = containingIndex; + break; + } + } + } + + return intersection; + } + + function addClassesViaAttribute(element, classNames) { + var existingClasses = buildClassList(element); + + var indexes = intersect(existingClasses, classNames); + var didChange = false; + + for (var i = 0, l = classNames.length; i < l; i++) { + if (indexes[i] === undefined) { + didChange = true; + existingClasses.push(classNames[i]); + } + } + + if (didChange) { + element.setAttribute('class', existingClasses.length > 0 ? existingClasses.join(' ') : ''); + } + } + + function removeClassesViaAttribute(element, classNames) { + var existingClasses = buildClassList(element); + + var indexes = intersect(classNames, existingClasses); + var didChange = false; + var newClasses = []; + + for (var i = 0, l = existingClasses.length; i < l; i++) { + if (indexes[i] === undefined) { + newClasses.push(existingClasses[i]); + } else { + didChange = true; + } + } + + if (didChange) { + element.setAttribute('class', newClasses.length > 0 ? newClasses.join(' ') : ''); + } + } + + var addClasses, removeClasses; + if (canClassList) { + exports.addClasses = addClasses = function addClasses(element, classNames) { + if (element.classList) { + if (classNames.length === 1) { + element.classList.add(classNames[0]); + } else if (classNames.length === 2) { + element.classList.add(classNames[0], classNames[1]); + } else { + element.classList.add.apply(element.classList, classNames); + } + } else { + addClassesViaAttribute(element, classNames); + } + }; + exports.removeClasses = removeClasses = function removeClasses(element, classNames) { + if (element.classList) { + if (classNames.length === 1) { + element.classList.remove(classNames[0]); + } else if (classNames.length === 2) { + element.classList.remove(classNames[0], classNames[1]); + } else { + element.classList.remove.apply(element.classList, classNames); + } + } else { + removeClassesViaAttribute(element, classNames); + } + }; + } else { + exports.addClasses = addClasses = addClassesViaAttribute; + exports.removeClasses = removeClasses = removeClassesViaAttribute; + } + + exports.addClasses = addClasses; + exports.removeClasses = removeClasses; +}); +enifed('dom-helper/prop', ['exports'], function (exports) { + 'use strict'; + + exports.isAttrRemovalValue = isAttrRemovalValue; + exports.normalizeProperty = normalizeProperty; + + function isAttrRemovalValue(value) { + return value === null || value === undefined; + } + + /* + * + * @method normalizeProperty + * @param element {HTMLElement} + * @param slotName {String} + * @returns {Object} { name, type } + */ + + function normalizeProperty(element, slotName) { + var type, normalized; + + if (slotName in element) { + normalized = slotName; + type = 'prop'; + } else { + var lower = slotName.toLowerCase(); + if (lower in element) { + type = 'prop'; + normalized = lower; + } else { + type = 'attr'; + normalized = slotName; + } + } + + if (type === 'prop' && (normalized.toLowerCase() === 'style' || preferAttr(element.tagName, normalized))) { + type = 'attr'; + } + + return { normalized: normalized, type: type }; + } + + // properties that MUST be set as attributes, due to: + // * browser bug + // * strange spec outlier + var ATTR_OVERRIDES = { + + // phantomjs < 2.0 lets you set it as a prop but won't reflect it + // back to the attribute. button.getAttribute('type') === null + BUTTON: { type: true, form: true }, + + INPUT: { + // TODO: remove when IE8 is droped + // Some versions of IE (IE8) throw an exception when setting + // `input.list = 'somestring'`: + // https://github.com/emberjs/ember.js/issues/10908 + // https://github.com/emberjs/ember.js/issues/11364 + list: true, + // Some version of IE (like IE9) actually throw an exception + // if you set input.type = 'something-unknown' + type: true, + form: true + }, + + // element.form is actually a legitimate readOnly property, that is to be + // mutated, but must be mutated by setAttribute... + SELECT: { form: true }, + OPTION: { form: true }, + TEXTAREA: { form: true }, + LABEL: { form: true }, + FIELDSET: { form: true }, + LEGEND: { form: true }, + OBJECT: { form: true } + }; + + function preferAttr(tagName, propName) { + var tag = ATTR_OVERRIDES[tagName.toUpperCase()]; + return tag && tag[propName.toLowerCase()] || false; + } +}); enifed("dom-helper", ["exports", "./htmlbars-runtime/morph", "./morph-attr", "./dom-helper/build-html-dom", "./dom-helper/classes", "./dom-helper/prop"], function (exports, _htmlbarsRuntimeMorph, _morphAttr, _domHelperBuildHtmlDom, _domHelperClasses, _domHelperProp) { "use strict"; var doc = typeof document === 'undefined' ? false : document; @@ -2911,479 +3251,10 @@ return parsingNode.protocol; }; exports.default = DOMHelper; }); -enifed('dom-helper/build-html-dom', ['exports'], function (exports) { - /* global XMLSerializer:false */ - 'use strict'; - - var svgHTMLIntegrationPoints = { foreignObject: 1, desc: 1, title: 1 }; - exports.svgHTMLIntegrationPoints = svgHTMLIntegrationPoints; - var svgNamespace = 'http://www.w3.org/2000/svg'; - - exports.svgNamespace = svgNamespace; - var doc = typeof document === 'undefined' ? false : document; - - // Safari does not like using innerHTML on SVG HTML integration - // points (desc/title/foreignObject). - var needsIntegrationPointFix = doc && (function (document) { - if (document.createElementNS === undefined) { - return; - } - // In FF title will not accept innerHTML. - var testEl = document.createElementNS(svgNamespace, 'title'); - testEl.innerHTML = "<div></div>"; - return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1; - })(doc); - - // Internet Explorer prior to 9 does not allow setting innerHTML if the first element - // is a "zero-scope" element. This problem can be worked around by making - // the first node an invisible text node. We, like Modernizr, use &shy; - var needsShy = doc && (function (document) { - var testEl = document.createElement('div'); - testEl.innerHTML = "<div></div>"; - testEl.firstChild.innerHTML = "<script><\/script>"; - return testEl.firstChild.innerHTML === ''; - })(doc); - - // IE 8 (and likely earlier) likes to move whitespace preceeding - // a script tag to appear after it. This means that we can - // accidentally remove whitespace when updating a morph. - var movesWhitespace = doc && (function (document) { - var testEl = document.createElement('div'); - testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value"; - return testEl.childNodes[0].nodeValue === 'Test:' && testEl.childNodes[2].nodeValue === ' Value'; - })(doc); - - var tagNamesRequiringInnerHTMLFix = doc && (function (document) { - var tagNamesRequiringInnerHTMLFix; - // IE 9 and earlier don't allow us to set innerHTML on col, colgroup, frameset, - // html, style, table, tbody, tfoot, thead, title, tr. Detect this and add - // them to an initial list of corrected tags. - // - // Here we are only dealing with the ones which can have child nodes. - // - var tableNeedsInnerHTMLFix; - var tableInnerHTMLTestElement = document.createElement('table'); - try { - tableInnerHTMLTestElement.innerHTML = '<tbody></tbody>'; - } catch (e) {} finally { - tableNeedsInnerHTMLFix = tableInnerHTMLTestElement.childNodes.length === 0; - } - if (tableNeedsInnerHTMLFix) { - tagNamesRequiringInnerHTMLFix = { - colgroup: ['table'], - table: [], - tbody: ['table'], - tfoot: ['table'], - thead: ['table'], - tr: ['table', 'tbody'] - }; - } - - // IE 8 doesn't allow setting innerHTML on a select tag. Detect this and - // add it to the list of corrected tags. - // - var selectInnerHTMLTestElement = document.createElement('select'); - selectInnerHTMLTestElement.innerHTML = '<option></option>'; - if (!selectInnerHTMLTestElement.childNodes[0]) { - tagNamesRequiringInnerHTMLFix = tagNamesRequiringInnerHTMLFix || {}; - tagNamesRequiringInnerHTMLFix.select = []; - } - return tagNamesRequiringInnerHTMLFix; - })(doc); - - function scriptSafeInnerHTML(element, html) { - // without a leading text node, IE will drop a leading script tag. - html = '&shy;' + html; - - element.innerHTML = html; - - var nodes = element.childNodes; - - // Look for &shy; to remove it. - var shyElement = nodes[0]; - while (shyElement.nodeType === 1 && !shyElement.nodeName) { - shyElement = shyElement.firstChild; - } - // At this point it's the actual unicode character. - if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") { - var newValue = shyElement.nodeValue.slice(1); - if (newValue.length) { - shyElement.nodeValue = shyElement.nodeValue.slice(1); - } else { - shyElement.parentNode.removeChild(shyElement); - } - } - - return nodes; - } - - function buildDOMWithFix(html, contextualElement) { - var tagName = contextualElement.tagName; - - // Firefox versions < 11 do not have support for element.outerHTML. - var outerHTML = contextualElement.outerHTML || new XMLSerializer().serializeToString(contextualElement); - if (!outerHTML) { - throw "Can't set innerHTML on " + tagName + " in this browser"; - } - - html = fixSelect(html, contextualElement); - - var wrappingTags = tagNamesRequiringInnerHTMLFix[tagName.toLowerCase()]; - - var startTag = outerHTML.match(new RegExp("<" + tagName + "([^>]*)>", 'i'))[0]; - var endTag = '</' + tagName + '>'; - - var wrappedHTML = [startTag, html, endTag]; - - var i = wrappingTags.length; - var wrappedDepth = 1 + i; - while (i--) { - wrappedHTML.unshift('<' + wrappingTags[i] + '>'); - wrappedHTML.push('</' + wrappingTags[i] + '>'); - } - - var wrapper = document.createElement('div'); - scriptSafeInnerHTML(wrapper, wrappedHTML.join('')); - var element = wrapper; - while (wrappedDepth--) { - element = element.firstChild; - while (element && element.nodeType !== 1) { - element = element.nextSibling; - } - } - while (element && element.tagName !== tagName) { - element = element.nextSibling; - } - return element ? element.childNodes : []; - } - - var buildDOM; - if (needsShy) { - buildDOM = function buildDOM(html, contextualElement, dom) { - html = fixSelect(html, contextualElement); - - contextualElement = dom.cloneNode(contextualElement, false); - scriptSafeInnerHTML(contextualElement, html); - return contextualElement.childNodes; - }; - } else { - buildDOM = function buildDOM(html, contextualElement, dom) { - html = fixSelect(html, contextualElement); - - contextualElement = dom.cloneNode(contextualElement, false); - contextualElement.innerHTML = html; - return contextualElement.childNodes; - }; - } - - function fixSelect(html, contextualElement) { - if (contextualElement.tagName === 'SELECT') { - html = "<option></option>" + html; - } - - return html; - } - - var buildIESafeDOM; - if (tagNamesRequiringInnerHTMLFix || movesWhitespace) { - buildIESafeDOM = function buildIESafeDOM(html, contextualElement, dom) { - // Make a list of the leading text on script nodes. Include - // script tags without any whitespace for easier processing later. - var spacesBefore = []; - var spacesAfter = []; - if (typeof html === 'string') { - html = html.replace(/(\s*)(<script)/g, function (match, spaces, tag) { - spacesBefore.push(spaces); - return tag; - }); - - html = html.replace(/(<\/script>)(\s*)/g, function (match, tag, spaces) { - spacesAfter.push(spaces); - return tag; - }); - } - - // Fetch nodes - var nodes; - if (tagNamesRequiringInnerHTMLFix[contextualElement.tagName.toLowerCase()]) { - // buildDOMWithFix uses string wrappers for problematic innerHTML. - nodes = buildDOMWithFix(html, contextualElement); - } else { - nodes = buildDOM(html, contextualElement, dom); - } - - // Build a list of script tags, the nodes themselves will be - // mutated as we add test nodes. - var i, j, node, nodeScriptNodes; - var scriptNodes = []; - for (i = 0; i < nodes.length; i++) { - node = nodes[i]; - if (node.nodeType !== 1) { - continue; - } - if (node.tagName === 'SCRIPT') { - scriptNodes.push(node); - } else { - nodeScriptNodes = node.getElementsByTagName('script'); - for (j = 0; j < nodeScriptNodes.length; j++) { - scriptNodes.push(nodeScriptNodes[j]); - } - } - } - - // Walk the script tags and put back their leading text nodes. - var scriptNode, textNode, spaceBefore, spaceAfter; - for (i = 0; i < scriptNodes.length; i++) { - scriptNode = scriptNodes[i]; - spaceBefore = spacesBefore[i]; - if (spaceBefore && spaceBefore.length > 0) { - textNode = dom.document.createTextNode(spaceBefore); - scriptNode.parentNode.insertBefore(textNode, scriptNode); - } - - spaceAfter = spacesAfter[i]; - if (spaceAfter && spaceAfter.length > 0) { - textNode = dom.document.createTextNode(spaceAfter); - scriptNode.parentNode.insertBefore(textNode, scriptNode.nextSibling); - } - } - - return nodes; - }; - } else { - buildIESafeDOM = buildDOM; - } - - var buildHTMLDOM; - if (needsIntegrationPointFix) { - exports.buildHTMLDOM = buildHTMLDOM = function buildHTMLDOM(html, contextualElement, dom) { - if (svgHTMLIntegrationPoints[contextualElement.tagName]) { - return buildIESafeDOM(html, document.createElement('div'), dom); - } else { - return buildIESafeDOM(html, contextualElement, dom); - } - }; - } else { - exports.buildHTMLDOM = buildHTMLDOM = buildIESafeDOM; - } - - exports.buildHTMLDOM = buildHTMLDOM; -}); -enifed('dom-helper/classes', ['exports'], function (exports) { - 'use strict'; - - var doc = typeof document === 'undefined' ? false : document; - - // PhantomJS has a broken classList. See https://github.com/ariya/phantomjs/issues/12782 - var canClassList = doc && (function () { - var d = document.createElement('div'); - if (!d.classList) { - return false; - } - d.classList.add('boo'); - d.classList.add('boo', 'baz'); - return d.className === 'boo baz'; - })(); - - function buildClassList(element) { - var classString = element.getAttribute('class') || ''; - return classString !== '' && classString !== ' ' ? classString.split(' ') : []; - } - - function intersect(containingArray, valuesArray) { - var containingIndex = 0; - var containingLength = containingArray.length; - var valuesIndex = 0; - var valuesLength = valuesArray.length; - - var intersection = new Array(valuesLength); - - // TODO: rewrite this loop in an optimal manner - for (; containingIndex < containingLength; containingIndex++) { - valuesIndex = 0; - for (; valuesIndex < valuesLength; valuesIndex++) { - if (valuesArray[valuesIndex] === containingArray[containingIndex]) { - intersection[valuesIndex] = containingIndex; - break; - } - } - } - - return intersection; - } - - function addClassesViaAttribute(element, classNames) { - var existingClasses = buildClassList(element); - - var indexes = intersect(existingClasses, classNames); - var didChange = false; - - for (var i = 0, l = classNames.length; i < l; i++) { - if (indexes[i] === undefined) { - didChange = true; - existingClasses.push(classNames[i]); - } - } - - if (didChange) { - element.setAttribute('class', existingClasses.length > 0 ? existingClasses.join(' ') : ''); - } - } - - function removeClassesViaAttribute(element, classNames) { - var existingClasses = buildClassList(element); - - var indexes = intersect(classNames, existingClasses); - var didChange = false; - var newClasses = []; - - for (var i = 0, l = existingClasses.length; i < l; i++) { - if (indexes[i] === undefined) { - newClasses.push(existingClasses[i]); - } else { - didChange = true; - } - } - - if (didChange) { - element.setAttribute('class', newClasses.length > 0 ? newClasses.join(' ') : ''); - } - } - - var addClasses, removeClasses; - if (canClassList) { - exports.addClasses = addClasses = function addClasses(element, classNames) { - if (element.classList) { - if (classNames.length === 1) { - element.classList.add(classNames[0]); - } else if (classNames.length === 2) { - element.classList.add(classNames[0], classNames[1]); - } else { - element.classList.add.apply(element.classList, classNames); - } - } else { - addClassesViaAttribute(element, classNames); - } - }; - exports.removeClasses = removeClasses = function removeClasses(element, classNames) { - if (element.classList) { - if (classNames.length === 1) { - element.classList.remove(classNames[0]); - } else if (classNames.length === 2) { - element.classList.remove(classNames[0], classNames[1]); - } else { - element.classList.remove.apply(element.classList, classNames); - } - } else { - removeClassesViaAttribute(element, classNames); - } - }; - } else { - exports.addClasses = addClasses = addClassesViaAttribute; - exports.removeClasses = removeClasses = removeClassesViaAttribute; - } - - exports.addClasses = addClasses; - exports.removeClasses = removeClasses; -}); -enifed('dom-helper/prop', ['exports'], function (exports) { - 'use strict'; - - exports.isAttrRemovalValue = isAttrRemovalValue; - exports.normalizeProperty = normalizeProperty; - - function isAttrRemovalValue(value) { - return value === null || value === undefined; - } - - /* - * - * @method normalizeProperty - * @param element {HTMLElement} - * @param slotName {String} - * @returns {Object} { name, type } - */ - - function normalizeProperty(element, slotName) { - var type, normalized; - - if (slotName in element) { - normalized = slotName; - type = 'prop'; - } else { - var lower = slotName.toLowerCase(); - if (lower in element) { - type = 'prop'; - normalized = lower; - } else { - type = 'attr'; - normalized = slotName; - } - } - - if (type === 'prop' && (normalized.toLowerCase() === 'style' || preferAttr(element.tagName, normalized))) { - type = 'attr'; - } - - return { normalized: normalized, type: type }; - } - - // properties that MUST be set as attributes, due to: - // * browser bug - // * strange spec outlier - var ATTR_OVERRIDES = { - - // phantomjs < 2.0 lets you set it as a prop but won't reflect it - // back to the attribute. button.getAttribute('type') === null - BUTTON: { type: true, form: true }, - - INPUT: { - // TODO: remove when IE8 is droped - // Some versions of IE (IE8) throw an exception when setting - // `input.list = 'somestring'`: - // https://github.com/emberjs/ember.js/issues/10908 - // https://github.com/emberjs/ember.js/issues/11364 - list: true, - // Some version of IE (like IE9) actually throw an exception - // if you set input.type = 'something-unknown' - type: true, - form: true - }, - - // element.form is actually a legitimate readOnly property, that is to be - // mutated, but must be mutated by setAttribute... - SELECT: { form: true }, - OPTION: { form: true }, - TEXTAREA: { form: true }, - LABEL: { form: true }, - FIELDSET: { form: true }, - LEGEND: { form: true }, - OBJECT: { form: true } - }; - - function preferAttr(tagName, propName) { - var tag = ATTR_OVERRIDES[tagName.toUpperCase()]; - return tag && tag[propName.toLowerCase()] || false; - } -}); -enifed('ember-application', ['exports', 'ember-metal/core', 'ember-runtime/system/lazy_load', 'ember-application/system/resolver', 'ember-application/system/application'], function (exports, _emberMetalCore, _emberRuntimeSystemLazy_load, _emberApplicationSystemResolver, _emberApplicationSystemApplication) { - 'use strict'; - - _emberMetalCore.default.Application = _emberApplicationSystemApplication.default; - _emberMetalCore.default.Resolver = _emberApplicationSystemResolver.Resolver; - _emberMetalCore.default.DefaultResolver = _emberApplicationSystemResolver.default; - - _emberRuntimeSystemLazy_load.runLoadHooks('Ember.Application', _emberApplicationSystemApplication.default); -}); - -/** -@module ember -@submodule ember-application -*/ enifed('ember-application/system/application-instance', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-runtime/system/object', 'ember-metal/run_loop', 'ember-metal/computed', 'container/registry'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberRuntimeSystemObject, _emberMetalRun_loop, _emberMetalComputed, _containerRegistry) { /** @module ember @submodule ember-application @private @@ -5134,10 +5005,52 @@ return resolvedType[factoryFlag]; }); } } }); +enifed('ember-application', ['exports', 'ember-metal/core', 'ember-runtime/system/lazy_load', 'ember-application/system/resolver', 'ember-application/system/application'], function (exports, _emberMetalCore, _emberRuntimeSystemLazy_load, _emberApplicationSystemResolver, _emberApplicationSystemApplication) { + 'use strict'; + + _emberMetalCore.default.Application = _emberApplicationSystemApplication.default; + _emberMetalCore.default.Resolver = _emberApplicationSystemResolver.Resolver; + _emberMetalCore.default.DefaultResolver = _emberApplicationSystemResolver.default; + + _emberRuntimeSystemLazy_load.runLoadHooks('Ember.Application', _emberApplicationSystemApplication.default); +}); + +/** +@module ember +@submodule ember-application +*/ +enifed('ember-debug/deprecation-manager', ['exports', 'ember-metal/dictionary', 'ember-metal/utils'], function (exports, _emberMetalDictionary, _emberMetalUtils) { + 'use strict'; + + var deprecationLevels = { + RAISE: _emberMetalUtils.symbol('RAISE'), + LOG: _emberMetalUtils.symbol('LOG'), + SILENCE: _emberMetalUtils.symbol('SILENCE') + }; + + exports.deprecationLevels = deprecationLevels; + exports.default = { + defaultLevel: deprecationLevels.LOG, + individualLevels: _emberMetalDictionary.default(null), + setDefaultLevel: function (level) { + this.defaultLevel = level; + }, + setLevel: function (id, level) { + this.individualLevels[id] = level; + }, + getLevel: function (id) { + var level = this.individualLevels[id]; + if (!level) { + level = this.defaultLevel; + } + return level; + } + }; +}); enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/error', 'ember-metal/logger', 'ember-debug/deprecation-manager', 'ember-metal/environment'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalError, _emberMetalLogger, _emberDebugDeprecationManager, _emberMetalEnvironment) { /*global __fail__*/ 'use strict'; @@ -5460,49 +5373,10 @@ exports.runningNonEmberDebugJS = runningNonEmberDebugJS; if (runningNonEmberDebugJS) { _emberMetalCore.default.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.'); } }); -enifed('ember-debug/deprecation-manager', ['exports', 'ember-metal/dictionary', 'ember-metal/utils'], function (exports, _emberMetalDictionary, _emberMetalUtils) { - 'use strict'; - - var deprecationLevels = { - RAISE: _emberMetalUtils.symbol('RAISE'), - LOG: _emberMetalUtils.symbol('LOG'), - SILENCE: _emberMetalUtils.symbol('SILENCE') - }; - - exports.deprecationLevels = deprecationLevels; - exports.default = { - defaultLevel: deprecationLevels.LOG, - individualLevels: _emberMetalDictionary.default(null), - setDefaultLevel: function (level) { - this.defaultLevel = level; - }, - setLevel: function (id, level) { - this.individualLevels[id] = level; - }, - getLevel: function (id) { - var level = this.individualLevels[id]; - if (!level) { - level = this.defaultLevel; - } - return level; - } - }; -}); -enifed('ember-extension-support', ['exports', 'ember-metal/core', 'ember-extension-support/data_adapter', 'ember-extension-support/container_debug_adapter'], function (exports, _emberMetalCore, _emberExtensionSupportData_adapter, _emberExtensionSupportContainer_debug_adapter) { - /** - @module ember - @submodule ember-extension-support - */ - - 'use strict'; - - _emberMetalCore.default.DataAdapter = _emberExtensionSupportData_adapter.default; - _emberMetalCore.default.ContainerDebugAdapter = _emberExtensionSupportContainer_debug_adapter.default; -}); enifed('ember-extension-support/container_debug_adapter', ['exports', 'ember-metal/core', 'ember-runtime/system/native_array', 'ember-runtime/utils', 'ember-runtime/system/string', 'ember-runtime/system/namespace', 'ember-runtime/system/object'], function (exports, _emberMetalCore, _emberRuntimeSystemNative_array, _emberRuntimeUtils, _emberRuntimeSystemString, _emberRuntimeSystemNamespace, _emberRuntimeSystemObject) { 'use strict'; /** @module ember @@ -6102,146 +5976,21 @@ observeRecord: function (record, recordUpdated) { return function () {}; } }); }); -enifed('ember-htmlbars', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-template-compiler', 'ember-htmlbars/system/make_bound_helper', 'ember-htmlbars/helpers', 'ember-htmlbars/helpers/if_unless', 'ember-htmlbars/helpers/with', 'ember-htmlbars/helpers/loc', 'ember-htmlbars/helpers/log', 'ember-htmlbars/helpers/each', 'ember-htmlbars/helpers/each-in', 'ember-htmlbars/helpers/-normalize-class', 'ember-htmlbars/helpers/-concat', 'ember-htmlbars/helpers/-join-classes', 'ember-htmlbars/helpers/-legacy-each-with-controller', 'ember-htmlbars/helpers/-legacy-each-with-keyword', 'ember-htmlbars/helpers/-html-safe', 'ember-htmlbars/system/dom-helper', 'ember-htmlbars/helper', 'ember-htmlbars/system/bootstrap', 'ember-htmlbars/compat'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberTemplateCompiler, _emberHtmlbarsSystemMake_bound_helper, _emberHtmlbarsHelpers, _emberHtmlbarsHelpersIf_unless, _emberHtmlbarsHelpersWith, _emberHtmlbarsHelpersLoc, _emberHtmlbarsHelpersLog, _emberHtmlbarsHelpersEach, _emberHtmlbarsHelpersEachIn, _emberHtmlbarsHelpersNormalizeClass, _emberHtmlbarsHelpersConcat, _emberHtmlbarsHelpersJoinClasses, _emberHtmlbarsHelpersLegacyEachWithController, _emberHtmlbarsHelpersLegacyEachWithKeyword, _emberHtmlbarsHelpersHtmlSafe, _emberHtmlbarsSystemDomHelper, _emberHtmlbarsHelper, _emberHtmlbarsSystemBootstrap, _emberHtmlbarsCompat) { +enifed('ember-extension-support', ['exports', 'ember-metal/core', 'ember-extension-support/data_adapter', 'ember-extension-support/container_debug_adapter'], function (exports, _emberMetalCore, _emberExtensionSupportData_adapter, _emberExtensionSupportContainer_debug_adapter) { /** - Ember templates are executed by [HTMLBars](https://github.com/tildeio/htmlbars), - an HTML-friendly version of [Handlebars](http://handlebarsjs.com/). Any valid Handlebars syntax is valid in an Ember template. - - ### Showing a property - - Templates manage the flow of an application's UI, and display state (through - the DOM) to a user. For example, given a component with the property "name", - that component's template can use the name in several ways: - - ```javascript - // app/components/person.js - export default Ember.Component.extend({ - name: 'Jill' - }); - ``` - - ```handlebars - {{! app/components/person.hbs }} - {{name}} - <div>{{name}}</div> - <span data-name={{name}}></span> - ``` - - Any time the "name" property on the component changes, the DOM will be - updated. - - Properties can be chained as well: - - ```handlebars - {{aUserModel.name}} - <div>{{listOfUsers.firstObject.name}}</div> - ``` - - ### Using Ember helpers - - When content is passed in mustaches `{{}}`, Ember will first try to find a helper - or component with that name. For example, the `if` helper: - - ```handlebars - {{if name "I have a name" "I have no name"}} - <span data-has-name={{if name true}}></span> - ``` - - The returned value is placed where the `{{}}` is called. The above style is - called "inline". A second style of helper usage is called "block". For example: - - ```handlebars - {{#if name}} - I have a name - {{else}} - I have no name - {{/if}} - ``` - - The block form of helpers allows you to control how the UI is created based - on the values of properties. - - A third form of helper is called "nested". For example here the concat - helper will add " Doe" to a displayed name if the person has no last name: - - ```handlebars - <span data-name={{concat firstName ( - if lastName (concat " " lastName) "Doe" - )}}></span> - ``` - - Ember's built-in helpers are described under the [Ember.Templates.helpers](/api/classes/Ember.Templates.helpers.html) - namespace. Documentation on creating custom helpers can be found under - [Ember.Helper](/api/classes/Ember.Helper.html). - - ### Invoking a Component - - Ember components represent state to the UI of an application. Further - reading on components can be found under [Ember.Component](/api/classes/Ember.Component.html). - - @module ember - @submodule ember-templates - @main ember-templates - @public + @module ember + @submodule ember-extension-support */ - /** - - [HTMLBars](https://github.com/tildeio/htmlbars) is a [Handlebars](http://handlebarsjs.com/) - compatible templating engine used by Ember.js. The classes and namespaces - covered by this documentation attempt to focus on APIs for interacting - with HTMLBars itself. For more general guidance on Ember.js templates and - helpers, please see the [ember-templates](/api/modules/ember-templates.html) - package. - - @module ember - @submodule ember-htmlbars - @main ember-htmlbars - @public - */ 'use strict'; - _emberHtmlbarsHelpers.registerHelper('if', _emberHtmlbarsHelpersIf_unless.ifHelper); - _emberHtmlbarsHelpers.registerHelper('unless', _emberHtmlbarsHelpersIf_unless.unlessHelper); - _emberHtmlbarsHelpers.registerHelper('with', _emberHtmlbarsHelpersWith.default); - _emberHtmlbarsHelpers.registerHelper('loc', _emberHtmlbarsHelpersLoc.default); - _emberHtmlbarsHelpers.registerHelper('log', _emberHtmlbarsHelpersLog.default); - _emberHtmlbarsHelpers.registerHelper('each', _emberHtmlbarsHelpersEach.default); - - _emberHtmlbarsHelpers.registerHelper('each-in', _emberHtmlbarsHelpersEachIn.default); - - _emberHtmlbarsHelpers.registerHelper('-normalize-class', _emberHtmlbarsHelpersNormalizeClass.default); - _emberHtmlbarsHelpers.registerHelper('concat', _emberHtmlbarsHelpersConcat.default); - _emberHtmlbarsHelpers.registerHelper('-join-classes', _emberHtmlbarsHelpersJoinClasses.default); - _emberHtmlbarsHelpers.registerHelper('-html-safe', _emberHtmlbarsHelpersHtmlSafe.default); - - if (_emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { - _emberHtmlbarsHelpers.registerHelper('-legacy-each-with-controller', _emberHtmlbarsHelpersLegacyEachWithController.default); - _emberHtmlbarsHelpers.registerHelper('-legacy-each-with-keyword', _emberHtmlbarsHelpersLegacyEachWithKeyword.default); - } - - _emberMetalCore.default.HTMLBars = { - template: _emberTemplateCompiler.template, - compile: _emberTemplateCompiler.compile, - precompile: _emberTemplateCompiler.precompile, - makeBoundHelper: _emberHtmlbarsSystemMake_bound_helper.default, - registerPlugin: _emberTemplateCompiler.registerPlugin, - DOMHelper: _emberHtmlbarsSystemDomHelper.default - }; - - _emberHtmlbarsHelper.default.helper = _emberHtmlbarsHelper.helper; - _emberMetalCore.default.Helper = _emberHtmlbarsHelper.default; + _emberMetalCore.default.DataAdapter = _emberExtensionSupportData_adapter.default; + _emberMetalCore.default.ContainerDebugAdapter = _emberExtensionSupportContainer_debug_adapter.default; }); - -// importing adds template bootstrapping -// initializer to enable embedded templates - -// importing ember-htmlbars/compat updates the -// Ember.Handlebars global if htmlbars is enabled enifed('ember-htmlbars/compat', ['exports', 'ember-metal/core', 'ember-htmlbars/utils/string'], function (exports, _emberMetalCore, _emberHtmlbarsUtilsString) { 'use strict'; var EmberHandlebars = _emberMetalCore.default.Handlebars = _emberMetalCore.default.Handlebars || {}; @@ -6431,44 +6180,10 @@ }; } exports.default = Helper; }); -enifed("ember-htmlbars/helpers", ["exports"], function (exports) { - /** - @module ember - @submodule ember-htmlbars - */ - - /** - @private - @property helpers - */ - "use strict"; - - exports.registerHelper = registerHelper; - var helpers = Object.create(null); - - /** - @module ember - @submodule ember-htmlbars - */ - - /** - @private - @method _registerHelper - @for Ember.HTMLBars - @param {String} name - @param {Object|Function} helperFunc the helper function to add - */ - - function registerHelper(name, helperFunc) { - helpers[name] = helperFunc; - } - - exports.default = helpers; -}); enifed('ember-htmlbars/helpers/-concat', ['exports'], function (exports) { /** @module ember @submodule ember-templates */ @@ -6606,13 +6321,13 @@ } function bindKeyword(self, keyword, item) { var _ref; - return (_ref = { + return _ref = { self: self - }, _ref[keyword] = item, _ref); + }, _ref[keyword] = item, _ref; } var deprecation = 'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each items as |item|}}`) instead.'; exports.deprecation = deprecation; }); @@ -7044,10 +6759,44 @@ } else if (options.inverse && options.inverse.yield) { options.inverse.yield([]); } } }); +enifed("ember-htmlbars/helpers", ["exports"], function (exports) { + /** + @module ember + @submodule ember-htmlbars + */ + + /** + @private + @property helpers + */ + "use strict"; + + exports.registerHelper = registerHelper; + var helpers = Object.create(null); + + /** + @module ember + @submodule ember-htmlbars + */ + + /** + @private + @method _registerHelper + @for Ember.HTMLBars + @param {String} name + @param {Object|Function} helperFunc the helper function to add + */ + + function registerHelper(name, helperFunc) { + helpers[name] = helperFunc; + } + + exports.default = helpers; +}); enifed('ember-htmlbars/hooks/bind-local', ['exports', 'ember-metal/streams/stream', 'ember-metal/streams/proxy-stream'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsProxyStream) { /** @module ember @submodule ember-htmlbars */ @@ -7797,45 +7546,10 @@ // untouched. This view is then cleared once cleanup is complete in // `didCleanupTree`. view.ownerView._destroyingSubtreeForView = view; } }); -enifed('ember-htmlbars/keywords', ['exports', 'htmlbars-runtime'], function (exports, _htmlbarsRuntime) { - /** - @module ember - @submodule ember-htmlbars - */ - - 'use strict'; - - exports.registerKeyword = registerKeyword; - - /** - @private - @property helpers - */ - var keywords = Object.create(_htmlbarsRuntime.hooks.keywords); - - /** - @module ember - @submodule ember-htmlbars - */ - - /** - @private - @method _registerHelper - @for Ember.HTMLBars - @param {String} name - @param {Object|Function} keyword the keyword to add - */ - - function registerKeyword(name, keyword) { - keywords[name] = keyword; - } - - exports.default = keywords; -}); enifed('ember-htmlbars/keywords/collection', ['exports', 'ember-views/streams/utils', 'ember-views/views/collection_view', 'ember-htmlbars/node-managers/view-node-manager', 'ember-metal/merge'], function (exports, _emberViewsStreamsUtils, _emberViewsViewsCollection_view, _emberHtmlbarsNodeManagersViewNodeManager, _emberMetalMerge) { /** @module ember @submodule ember-templates */ @@ -8707,11 +8421,11 @@ @submodule ember-templates */ 'use strict'; - _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.0.2'; + _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.0.3'; /** The `{{outlet}}` helper lets you specify where a child routes will render in your template. An important use of the `{{outlet}}` helper is in your application's `application.hbs` file: @@ -9554,10 +9268,45 @@ rerender: function (morph, env, scope, params, hash, template, inverse, visitor) { _htmlbarsRuntime.internal.continueBlock(morph, env, scope, 'with', params, hash, template, inverse, visitor); } }; }); +enifed('ember-htmlbars/keywords', ['exports', 'htmlbars-runtime'], function (exports, _htmlbarsRuntime) { + /** + @module ember + @submodule ember-htmlbars + */ + + 'use strict'; + + exports.registerKeyword = registerKeyword; + + /** + @private + @property helpers + */ + var keywords = Object.create(_htmlbarsRuntime.hooks.keywords); + + /** + @module ember + @submodule ember-htmlbars + */ + + /** + @private + @method _registerHelper + @for Ember.HTMLBars + @param {String} name + @param {Object|Function} keyword the keyword to add + */ + + function registerKeyword(name, keyword) { + keywords[name] = keyword; + } + + exports.default = keywords; +}); enifed('ember-htmlbars/morphs/attr-morph', ['exports', 'ember-metal/core', 'dom-helper'], function (exports, _emberMetalCore, _domHelper) { 'use strict'; var HTMLBarsAttrMorph = _domHelper.default.prototype.AttrMorphClass; @@ -10538,12 +10287,12 @@ 'use strict'; exports.buildHelperStream = buildHelperStream; function buildHelperStream(helper, params, hash, templates, env, scope, label) { - _emberMetalCore.default.assert('Helpers may not be used in the block form, for example {{#my-helper}}{{/my-helper}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (my-helper)}}{{/if}}.', !(helper.isHelperInstance && !helper.isHelperFactory) || (!templates || !templates.template || !templates.template.meta)); - _emberMetalCore.default.assert('Helpers may not be used in the element form, for example <div {{my-helper}}>.', !(helper.isHelperInstance && !helper.isHelperFactory) || (!templates || !templates.element)); + _emberMetalCore.default.assert('Helpers may not be used in the block form, for example {{#my-helper}}{{/my-helper}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (my-helper)}}{{/if}}.', !(helper.isHelperInstance && !helper.isHelperFactory) || !templates || !templates.template || !templates.template.meta); + _emberMetalCore.default.assert('Helpers may not be used in the element form, for example <div {{my-helper}}>.', !(helper.isHelperInstance && !helper.isHelperFactory) || !templates || !templates.element); if (helper.isHelperFactory) { return new _emberHtmlbarsStreamsHelperFactory.default(helper, params, hash, label); } else if (helper.isHelperInstance) { return new _emberHtmlbarsStreamsHelperInstance.default(helper, params, hash, label); } else { @@ -11833,475 +11582,146 @@ } scope[key] = stream; } } }); -enifed('ember-metal-views', ['exports', 'ember-metal-views/renderer'], function (exports, _emberMetalViewsRenderer) { - 'use strict'; - - exports.Renderer = _emberMetalViewsRenderer.default; -}); -enifed('ember-metal-views/renderer', ['exports', 'ember-metal/run_loop', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/merge', 'ember-metal/set_properties', 'ember-views/system/build-component-template'], function (exports, _emberMetalRun_loop, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMerge, _emberMetalSet_properties, _emberViewsSystemBuildComponentTemplate) { - 'use strict'; - - function Renderer(_helper) { - this._dom = _helper; - } - - Renderer.prototype.prerenderTopLevelView = function Renderer_prerenderTopLevelView(view, renderNode) { - if (view._state === 'inDOM') { - throw new Error('You cannot insert a View that has already been rendered'); - } - view.ownerView = renderNode.emberView = view; - view._renderNode = renderNode; - - var layout = _emberMetalProperty_get.get(view, 'layout'); - var template = _emberMetalProperty_get.get(view, 'template'); - - var componentInfo = { component: view, layout: layout }; - - var block = _emberViewsSystemBuildComponentTemplate.default(componentInfo, {}, { - self: view, - templates: template ? { default: template.raw } : undefined - }).block; - - view.renderBlock(block, renderNode); - view.lastResult = renderNode.lastResult; - this.clearRenderedViews(view.env); - }; - - Renderer.prototype.renderTopLevelView = function Renderer_renderTopLevelView(view, renderNode) { - // Check to see if insertion has been canceled - if (view._willInsert) { - view._willInsert = false; - this.prerenderTopLevelView(view, renderNode); - this.dispatchLifecycleHooks(view.env); - } - }; - - Renderer.prototype.revalidateTopLevelView = function Renderer_revalidateTopLevelView(view) { - // This guard prevents revalidation on an already-destroyed view. - if (view._renderNode.lastResult) { - view._renderNode.lastResult.revalidate(view.env); - // supports createElement, which operates without moving the view into - // the inDOM state. - if (view._state === 'inDOM') { - this.dispatchLifecycleHooks(view.env); - } - this.clearRenderedViews(view.env); - } - }; - - Renderer.prototype.dispatchLifecycleHooks = function Renderer_dispatchLifecycleHooks(env) { - var ownerView = env.view; - - var lifecycleHooks = env.lifecycleHooks; - var i, hook; - - for (i = 0; i < lifecycleHooks.length; i++) { - hook = lifecycleHooks[i]; - ownerView._dispatching = hook.type; - - switch (hook.type) { - case 'didInsertElement': - this.didInsertElement(hook.view);break; - case 'didUpdate': - this.didUpdate(hook.view);break; - } - - this.didRender(hook.view); - } - - ownerView._dispatching = null; - env.lifecycleHooks.length = 0; - }; - - Renderer.prototype.ensureViewNotRendering = function Renderer_ensureViewNotRendering(view) { - var env = view.ownerView.env; - if (env && env.renderedViews.indexOf(view.elementId) !== -1) { - throw new Error('Something you did caused a view to re-render after it rendered but before it was inserted into the DOM.'); - } - }; - - Renderer.prototype.clearRenderedViews = function Renderer_clearRenderedViews(env) { - env.renderedNodes = {}; - env.renderedViews.length = 0; - }; - - // This entry point is called from top-level `view.appendTo` - Renderer.prototype.appendTo = function Renderer_appendTo(view, target) { - var morph = this._dom.appendMorph(target); - morph.ownerNode = morph; - view._willInsert = true; - _emberMetalRun_loop.default.schedule('render', this, this.renderTopLevelView, view, morph); - }; - - Renderer.prototype.replaceIn = function Renderer_replaceIn(view, target) { - var morph = this._dom.replaceContentWithMorph(target); - morph.ownerNode = morph; - view._willInsert = true; - _emberMetalRun_loop.default.scheduleOnce('render', this, this.renderTopLevelView, view, morph); - }; - - Renderer.prototype.createElement = function Renderer_createElement(view) { - var morph = this._dom.createFragmentMorph(); - morph.ownerNode = morph; - this.prerenderTopLevelView(view, morph); - }; - - Renderer.prototype.didCreateElement = function (view, element) { - if (element) { - view.element = element; - } - - if (view._transitionTo) { - view._transitionTo('hasElement'); - } - }; // hasElement - - Renderer.prototype.willInsertElement = function (view) { - if (view.trigger) { - view.trigger('willInsertElement'); - } - }; // will place into DOM - - Renderer.prototype.setAttrs = function (view, attrs) { - _emberMetalProperty_set.set(view, 'attrs', attrs); - }; // set attrs the first time - - Renderer.prototype.componentInitAttrs = function (component, attrs) { - // for attrs-proxy support - component.trigger('_internalDidReceiveAttrs'); - component.trigger('didInitAttrs', { attrs: attrs }); - component.trigger('didReceiveAttrs', { newAttrs: attrs }); - }; // set attrs the first time - - Renderer.prototype.didInsertElement = function (view) { - if (view._transitionTo) { - view._transitionTo('inDOM'); - } - - if (view.trigger) { - view.trigger('didInsertElement'); - } - }; // inDOM // placed into DOM - - Renderer.prototype.didUpdate = function (view) { - if (view.trigger) { - view.trigger('didUpdate'); - } - }; - - Renderer.prototype.didRender = function (view) { - if (view.trigger) { - view.trigger('didRender'); - } - }; - - Renderer.prototype.updateAttrs = function (view, attrs) { - this.setAttrs(view, attrs); - }; // setting new attrs - - Renderer.prototype.componentUpdateAttrs = function (component, newAttrs) { - var oldAttrs = null; - - if (component.attrs) { - oldAttrs = _emberMetalMerge.assign({}, component.attrs); - _emberMetalSet_properties.default(component.attrs, newAttrs); - } else { - _emberMetalProperty_set.set(component, 'attrs', newAttrs); - } - - // for attrs-proxy support - component.trigger('_internalDidReceiveAttrs'); - component.trigger('didUpdateAttrs', { oldAttrs: oldAttrs, newAttrs: newAttrs }); - component.trigger('didReceiveAttrs', { oldAttrs: oldAttrs, newAttrs: newAttrs }); - }; - - Renderer.prototype.willUpdate = function (view, attrs) { - if (view._willUpdate) { - view._willUpdate(attrs); - } - }; - - Renderer.prototype.componentWillUpdate = function (component) { - component.trigger('willUpdate'); - }; - - Renderer.prototype.willRender = function (view) { - if (view._willRender) { - view._willRender(); - } - }; - - Renderer.prototype.componentWillRender = function (component) { - component.trigger('willRender'); - }; - - Renderer.prototype.remove = function (view, shouldDestroy) { - this.willDestroyElement(view); - - view._willRemoveElement = true; - _emberMetalRun_loop.default.schedule('render', this, this.renderElementRemoval, view); - }; - - Renderer.prototype.renderElementRemoval = function Renderer_renderElementRemoval(view) { - // Use the _willRemoveElement flag to avoid mulitple removal attempts in - // case many have been scheduled. This should be more performant than using - // `scheduleOnce`. - if (view._willRemoveElement) { - view._willRemoveElement = false; - - if (view._renderNode && view.element && view.element.parentNode) { - view._renderNode.clear(); - } - this.didDestroyElement(view); - } - }; - - Renderer.prototype.willRemoveElement = function () /*view*/{}; - - Renderer.prototype.willDestroyElement = function (view) { - if (view._willDestroyElement) { - view._willDestroyElement(); - } - if (view.trigger) { - view.trigger('willDestroyElement'); - view.trigger('willClearRender'); - } - - if (view._transitionTo) { - view._transitionTo('destroying'); - } - }; - - Renderer.prototype.didDestroyElement = function (view) { - view.element = null; - - // Views that are being destroyed should never go back to the preRender state. - // However if we're just destroying an element on a view (as is the case when - // using View#remove) then the view should go to a preRender state so that - // it can be rendered again later. - if (view._state !== 'destroying' && view._transitionTo) { - view._transitionTo('preRender'); - } - - if (view.trigger) { - view.trigger('didDestroyElement'); - } - }; // element destroyed so view.destroy shouldn't try to remove it removedFromDOM - - exports.default = Renderer; -}); -enifed('ember-metal', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/merge', 'ember-metal/instrumentation', 'ember-metal/utils', 'ember-metal/error', 'ember-metal/cache', 'ember-metal/logger', 'ember-metal/property_get', 'ember-metal/events', 'ember-metal/observer_set', 'ember-metal/property_events', 'ember-metal/properties', 'ember-metal/property_set', 'ember-metal/map', 'ember-metal/get_properties', 'ember-metal/set_properties', 'ember-metal/watch_key', 'ember-metal/chains', 'ember-metal/watch_path', 'ember-metal/watching', 'ember-metal/expand_properties', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/computed_macros', 'ember-metal/observer', 'ember-metal/mixin', 'ember-metal/binding', 'ember-metal/run_loop', 'ember-metal/libraries', 'ember-metal/is_none', 'ember-metal/is_empty', 'ember-metal/is_blank', 'ember-metal/is_present', 'backburner', 'ember-metal/streams/utils', 'ember-metal/streams/stream'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalMerge, _emberMetalInstrumentation, _emberMetalUtils, _emberMetalError, _emberMetalCache, _emberMetalLogger, _emberMetalProperty_get, _emberMetalEvents, _emberMetalObserver_set, _emberMetalProperty_events, _emberMetalProperties, _emberMetalProperty_set, _emberMetalMap, _emberMetalGet_properties, _emberMetalSet_properties, _emberMetalWatch_key, _emberMetalChains, _emberMetalWatch_path, _emberMetalWatching, _emberMetalExpand_properties, _emberMetalComputed, _emberMetalAlias, _emberMetalComputed_macros, _emberMetalObserver, _emberMetalMixin, _emberMetalBinding, _emberMetalRun_loop, _emberMetalLibraries, _emberMetalIs_none, _emberMetalIs_empty, _emberMetalIs_blank, _emberMetalIs_present, _backburner, _emberMetalStreamsUtils, _emberMetalStreamsStream) { +enifed('ember-htmlbars', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-template-compiler', 'ember-htmlbars/system/make_bound_helper', 'ember-htmlbars/helpers', 'ember-htmlbars/helpers/if_unless', 'ember-htmlbars/helpers/with', 'ember-htmlbars/helpers/loc', 'ember-htmlbars/helpers/log', 'ember-htmlbars/helpers/each', 'ember-htmlbars/helpers/each-in', 'ember-htmlbars/helpers/-normalize-class', 'ember-htmlbars/helpers/-concat', 'ember-htmlbars/helpers/-join-classes', 'ember-htmlbars/helpers/-legacy-each-with-controller', 'ember-htmlbars/helpers/-legacy-each-with-keyword', 'ember-htmlbars/helpers/-html-safe', 'ember-htmlbars/system/dom-helper', 'ember-htmlbars/helper', 'ember-htmlbars/system/bootstrap', 'ember-htmlbars/compat'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberTemplateCompiler, _emberHtmlbarsSystemMake_bound_helper, _emberHtmlbarsHelpers, _emberHtmlbarsHelpersIf_unless, _emberHtmlbarsHelpersWith, _emberHtmlbarsHelpersLoc, _emberHtmlbarsHelpersLog, _emberHtmlbarsHelpersEach, _emberHtmlbarsHelpersEachIn, _emberHtmlbarsHelpersNormalizeClass, _emberHtmlbarsHelpersConcat, _emberHtmlbarsHelpersJoinClasses, _emberHtmlbarsHelpersLegacyEachWithController, _emberHtmlbarsHelpersLegacyEachWithKeyword, _emberHtmlbarsHelpersHtmlSafe, _emberHtmlbarsSystemDomHelper, _emberHtmlbarsHelper, _emberHtmlbarsSystemBootstrap, _emberHtmlbarsCompat) { /** - @module ember - @submodule ember-metal - */ - - // BEGIN IMPORTS - 'use strict'; - - _emberMetalComputed.computed.empty = _emberMetalComputed_macros.empty; - _emberMetalComputed.computed.notEmpty = _emberMetalComputed_macros.notEmpty; - _emberMetalComputed.computed.none = _emberMetalComputed_macros.none; - _emberMetalComputed.computed.not = _emberMetalComputed_macros.not; - _emberMetalComputed.computed.bool = _emberMetalComputed_macros.bool; - _emberMetalComputed.computed.match = _emberMetalComputed_macros.match; - _emberMetalComputed.computed.equal = _emberMetalComputed_macros.equal; - _emberMetalComputed.computed.gt = _emberMetalComputed_macros.gt; - _emberMetalComputed.computed.gte = _emberMetalComputed_macros.gte; - _emberMetalComputed.computed.lt = _emberMetalComputed_macros.lt; - _emberMetalComputed.computed.lte = _emberMetalComputed_macros.lte; - _emberMetalComputed.computed.alias = _emberMetalAlias.default; - _emberMetalComputed.computed.oneWay = _emberMetalComputed_macros.oneWay; - _emberMetalComputed.computed.reads = _emberMetalComputed_macros.oneWay; - _emberMetalComputed.computed.readOnly = _emberMetalComputed_macros.readOnly; - _emberMetalComputed.computed.defaultTo = _emberMetalComputed_macros.defaultTo; - _emberMetalComputed.computed.deprecatingAlias = _emberMetalComputed_macros.deprecatingAlias; - _emberMetalComputed.computed.and = _emberMetalComputed_macros.and; - _emberMetalComputed.computed.or = _emberMetalComputed_macros.or; - _emberMetalComputed.computed.any = _emberMetalComputed_macros.any; - _emberMetalComputed.computed.collect = _emberMetalComputed_macros.collect; - - // END IMPORTS - - // BEGIN EXPORTS - var EmberInstrumentation = _emberMetalCore.default.Instrumentation = {}; - EmberInstrumentation.instrument = _emberMetalInstrumentation.instrument; - EmberInstrumentation.subscribe = _emberMetalInstrumentation.subscribe; - EmberInstrumentation.unsubscribe = _emberMetalInstrumentation.unsubscribe; - EmberInstrumentation.reset = _emberMetalInstrumentation.reset; - - _emberMetalCore.default.instrument = _emberMetalInstrumentation.instrument; - _emberMetalCore.default.subscribe = _emberMetalInstrumentation.subscribe; - - _emberMetalCore.default._Cache = _emberMetalCache.default; - - _emberMetalCore.default.generateGuid = _emberMetalUtils.generateGuid; - _emberMetalCore.default.GUID_KEY = _emberMetalUtils.GUID_KEY; - _emberMetalCore.default.platform = { - defineProperty: true, - hasPropertyAccessors: true - }; - - _emberMetalCore.default.Error = _emberMetalError.default; - _emberMetalCore.default.guidFor = _emberMetalUtils.guidFor; - _emberMetalCore.default.META_DESC = _emberMetalUtils.META_DESC; - _emberMetalCore.default.EMPTY_META = _emberMetalUtils.EMPTY_META; - _emberMetalCore.default.meta = _emberMetalUtils.meta; - _emberMetalCore.default.inspect = _emberMetalUtils.inspect; - _emberMetalCore.default.tryCatchFinally = _emberMetalUtils.deprecatedTryCatchFinally; - _emberMetalCore.default.makeArray = _emberMetalUtils.makeArray; - _emberMetalCore.default.canInvoke = _emberMetalUtils.canInvoke; - _emberMetalCore.default.tryInvoke = _emberMetalUtils.tryInvoke; - _emberMetalCore.default.wrap = _emberMetalUtils.wrap; - _emberMetalCore.default.apply = _emberMetalUtils.apply; - _emberMetalCore.default.applyStr = _emberMetalUtils.applyStr; - _emberMetalCore.default.uuid = _emberMetalUtils.uuid; - - _emberMetalCore.default.Logger = _emberMetalLogger.default; - - _emberMetalCore.default.get = _emberMetalProperty_get.get; - _emberMetalCore.default.getWithDefault = _emberMetalProperty_get.getWithDefault; - _emberMetalCore.default.normalizeTuple = _emberMetalProperty_get.normalizeTuple; - _emberMetalCore.default._getPath = _emberMetalProperty_get._getPath; - - _emberMetalCore.default.on = _emberMetalEvents.on; - _emberMetalCore.default.addListener = _emberMetalEvents.addListener; - _emberMetalCore.default.removeListener = _emberMetalEvents.removeListener; - _emberMetalCore.default._suspendListener = _emberMetalEvents.suspendListener; - _emberMetalCore.default._suspendListeners = _emberMetalEvents.suspendListeners; - _emberMetalCore.default.sendEvent = _emberMetalEvents.sendEvent; - _emberMetalCore.default.hasListeners = _emberMetalEvents.hasListeners; - _emberMetalCore.default.watchedEvents = _emberMetalEvents.watchedEvents; - _emberMetalCore.default.listenersFor = _emberMetalEvents.listenersFor; - _emberMetalCore.default.accumulateListeners = _emberMetalEvents.accumulateListeners; - - _emberMetalCore.default._ObserverSet = _emberMetalObserver_set.default; - - _emberMetalCore.default.propertyWillChange = _emberMetalProperty_events.propertyWillChange; - _emberMetalCore.default.propertyDidChange = _emberMetalProperty_events.propertyDidChange; - _emberMetalCore.default.overrideChains = _emberMetalProperty_events.overrideChains; - _emberMetalCore.default.beginPropertyChanges = _emberMetalProperty_events.beginPropertyChanges; - _emberMetalCore.default.endPropertyChanges = _emberMetalProperty_events.endPropertyChanges; - _emberMetalCore.default.changeProperties = _emberMetalProperty_events.changeProperties; - - _emberMetalCore.default.defineProperty = _emberMetalProperties.defineProperty; - - _emberMetalCore.default.set = _emberMetalProperty_set.set; - _emberMetalCore.default.trySet = _emberMetalProperty_set.trySet; - - _emberMetalCore.default.OrderedSet = _emberMetalMap.OrderedSet; - _emberMetalCore.default.Map = _emberMetalMap.Map; - _emberMetalCore.default.MapWithDefault = _emberMetalMap.MapWithDefault; - - _emberMetalCore.default.getProperties = _emberMetalGet_properties.default; - _emberMetalCore.default.setProperties = _emberMetalSet_properties.default; - - _emberMetalCore.default.watchKey = _emberMetalWatch_key.watchKey; - _emberMetalCore.default.unwatchKey = _emberMetalWatch_key.unwatchKey; - - _emberMetalCore.default.flushPendingChains = _emberMetalChains.flushPendingChains; - _emberMetalCore.default.removeChainWatcher = _emberMetalChains.removeChainWatcher; - _emberMetalCore.default._ChainNode = _emberMetalChains.ChainNode; - _emberMetalCore.default.finishChains = _emberMetalChains.finishChains; - - _emberMetalCore.default.watchPath = _emberMetalWatch_path.watchPath; - _emberMetalCore.default.unwatchPath = _emberMetalWatch_path.unwatchPath; - - _emberMetalCore.default.watch = _emberMetalWatching.watch; - _emberMetalCore.default.isWatching = _emberMetalWatching.isWatching; - _emberMetalCore.default.unwatch = _emberMetalWatching.unwatch; - _emberMetalCore.default.rewatch = _emberMetalWatching.rewatch; - _emberMetalCore.default.destroy = _emberMetalWatching.destroy; - - _emberMetalCore.default.expandProperties = _emberMetalExpand_properties.default; - - _emberMetalCore.default.ComputedProperty = _emberMetalComputed.ComputedProperty; - _emberMetalCore.default.computed = _emberMetalComputed.computed; - _emberMetalCore.default.cacheFor = _emberMetalComputed.cacheFor; - - _emberMetalCore.default.addObserver = _emberMetalObserver.addObserver; - _emberMetalCore.default.observersFor = _emberMetalObserver.observersFor; - _emberMetalCore.default.removeObserver = _emberMetalObserver.removeObserver; - _emberMetalCore.default._suspendObserver = _emberMetalObserver._suspendObserver; - _emberMetalCore.default._suspendObservers = _emberMetalObserver._suspendObservers; - - _emberMetalCore.default.IS_BINDING = _emberMetalMixin.IS_BINDING; - _emberMetalCore.default.required = _emberMetalMixin.required; - _emberMetalCore.default.aliasMethod = _emberMetalMixin.aliasMethod; - _emberMetalCore.default.observer = _emberMetalMixin.observer; - _emberMetalCore.default.immediateObserver = _emberMetalMixin._immediateObserver; - _emberMetalCore.default.mixin = _emberMetalMixin.mixin; - _emberMetalCore.default.Mixin = _emberMetalMixin.Mixin; - - _emberMetalCore.default.bind = _emberMetalBinding.bind; - _emberMetalCore.default.Binding = _emberMetalBinding.Binding; - _emberMetalCore.default.isGlobalPath = _emberMetalBinding.isGlobalPath; - - _emberMetalCore.default.run = _emberMetalRun_loop.default; - - /** - @class Backburner - @for Ember - @private - */ - _emberMetalCore.default.Backburner = _backburner.default; - // this is the new go forward, once Ember Data updates to using `_Backburner` we - // can remove the non-underscored version. - _emberMetalCore.default._Backburner = _backburner.default; - - _emberMetalCore.default.libraries = new _emberMetalLibraries.default(); - _emberMetalCore.default.libraries.registerCoreLibrary('Ember', _emberMetalCore.default.VERSION); - - _emberMetalCore.default.isNone = _emberMetalIs_none.default; - _emberMetalCore.default.isEmpty = _emberMetalIs_empty.default; - _emberMetalCore.default.isBlank = _emberMetalIs_blank.default; - _emberMetalCore.default.isPresent = _emberMetalIs_present.default; - - _emberMetalCore.default.merge = _emberMetalMerge.default; - - _emberMetalCore.default.FEATURES = _emberMetalFeatures.FEATURES; - _emberMetalCore.default.FEATURES.isEnabled = _emberMetalFeatures.default; - - /** - A function may be assigned to `Ember.onerror` to be called when Ember - internals encounter an error. This is useful for specialized error handling - and reporting code. + Ember templates are executed by [HTMLBars](https://github.com/tildeio/htmlbars), + an HTML-friendly version of [Handlebars](http://handlebarsjs.com/). Any valid Handlebars syntax is valid in an Ember template. + ### Showing a property + + Templates manage the flow of an application's UI, and display state (through + the DOM) to a user. For example, given a component with the property "name", + that component's template can use the name in several ways: + ```javascript - Ember.onerror = function(error) { - Em.$.ajax('/report-error', 'POST', { - stack: error.stack, - otherInformation: 'whatever app state you want to provide' - }); - }; + // app/components/person.js + export default Ember.Component.extend({ + name: 'Jill' + }); ``` - Internally, `Ember.onerror` is used as Backburner's error handler. + ```handlebars + {{! app/components/person.hbs }} + {{name}} + <div>{{name}}</div> + <span data-name={{name}}></span> + ``` - @event onerror - @for Ember - @param {Exception} error the error object + Any time the "name" property on the component changes, the DOM will be + updated. + + Properties can be chained as well: + + ```handlebars + {{aUserModel.name}} + <div>{{listOfUsers.firstObject.name}}</div> + ``` + + ### Using Ember helpers + + When content is passed in mustaches `{{}}`, Ember will first try to find a helper + or component with that name. For example, the `if` helper: + + ```handlebars + {{if name "I have a name" "I have no name"}} + <span data-has-name={{if name true}}></span> + ``` + + The returned value is placed where the `{{}}` is called. The above style is + called "inline". A second style of helper usage is called "block". For example: + + ```handlebars + {{#if name}} + I have a name + {{else}} + I have no name + {{/if}} + ``` + + The block form of helpers allows you to control how the UI is created based + on the values of properties. + + A third form of helper is called "nested". For example here the concat + helper will add " Doe" to a displayed name if the person has no last name: + + ```handlebars + <span data-name={{concat firstName ( + if lastName (concat " " lastName) "Doe" + )}}></span> + ``` + + Ember's built-in helpers are described under the [Ember.Templates.helpers](/api/classes/Ember.Templates.helpers.html) + namespace. Documentation on creating custom helpers can be found under + [Ember.Helper](/api/classes/Ember.Helper.html). + + ### Invoking a Component + + Ember components represent state to the UI of an application. Further + reading on components can be found under [Ember.Component](/api/classes/Ember.Component.html). + + @module ember + @submodule ember-templates + @main ember-templates @public */ - _emberMetalCore.default.onerror = null; - // END EXPORTS - // do this for side-effects of updating Ember.assert, warn, etc when - // ember-debug is present - // This needs to be called before any deprecateFunc - if (_emberMetalCore.default.__loader.registry['ember-debug']) { - requireModule('ember-debug'); + /** + + [HTMLBars](https://github.com/tildeio/htmlbars) is a [Handlebars](http://handlebarsjs.com/) + compatible templating engine used by Ember.js. The classes and namespaces + covered by this documentation attempt to focus on APIs for interacting + with HTMLBars itself. For more general guidance on Ember.js templates and + helpers, please see the [ember-templates](/api/modules/ember-templates.html) + package. + + @module ember + @submodule ember-htmlbars + @main ember-htmlbars + @public + */ + 'use strict'; + + _emberHtmlbarsHelpers.registerHelper('if', _emberHtmlbarsHelpersIf_unless.ifHelper); + _emberHtmlbarsHelpers.registerHelper('unless', _emberHtmlbarsHelpersIf_unless.unlessHelper); + _emberHtmlbarsHelpers.registerHelper('with', _emberHtmlbarsHelpersWith.default); + _emberHtmlbarsHelpers.registerHelper('loc', _emberHtmlbarsHelpersLoc.default); + _emberHtmlbarsHelpers.registerHelper('log', _emberHtmlbarsHelpersLog.default); + _emberHtmlbarsHelpers.registerHelper('each', _emberHtmlbarsHelpersEach.default); + + _emberHtmlbarsHelpers.registerHelper('each-in', _emberHtmlbarsHelpersEachIn.default); + + _emberHtmlbarsHelpers.registerHelper('-normalize-class', _emberHtmlbarsHelpersNormalizeClass.default); + _emberHtmlbarsHelpers.registerHelper('concat', _emberHtmlbarsHelpersConcat.default); + _emberHtmlbarsHelpers.registerHelper('-join-classes', _emberHtmlbarsHelpersJoinClasses.default); + _emberHtmlbarsHelpers.registerHelper('-html-safe', _emberHtmlbarsHelpersHtmlSafe.default); + + if (_emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { + _emberHtmlbarsHelpers.registerHelper('-legacy-each-with-controller', _emberHtmlbarsHelpersLegacyEachWithController.default); + _emberHtmlbarsHelpers.registerHelper('-legacy-each-with-keyword', _emberHtmlbarsHelpersLegacyEachWithKeyword.default); } - _emberMetalCore.default.create = _emberMetalCore.default.deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create); - _emberMetalCore.default.keys = _emberMetalCore.default.deprecateFunc('Ember.keys is deprecated in favor of Object.keys', { id: 'ember-metal.ember.keys', until: '3.0.0' }, Object.keys); + _emberMetalCore.default.HTMLBars = { + template: _emberTemplateCompiler.template, + compile: _emberTemplateCompiler.compile, + precompile: _emberTemplateCompiler.precompile, + makeBoundHelper: _emberHtmlbarsSystemMake_bound_helper.default, + registerPlugin: _emberTemplateCompiler.registerPlugin, + DOMHelper: _emberHtmlbarsSystemDomHelper.default + }; - exports.default = _emberMetalCore.default; + _emberHtmlbarsHelper.default.helper = _emberHtmlbarsHelper.helper; + _emberMetalCore.default.Helper = _emberHtmlbarsHelper.default; }); + +// importing adds template bootstrapping +// initializer to enable embedded templates + +// importing ember-htmlbars/compat updates the +// Ember.Handlebars global if htmlbars is enabled enifed('ember-metal/alias', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/core', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/utils', 'ember-metal/dependent_keys'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalCore, _emberMetalError, _emberMetalProperties, _emberMetalComputed, _emberMetalUtils, _emberMetalDependent_keys) { 'use strict'; exports.default = alias; exports.AliasedProperty = AliasedProperty; @@ -14635,11 +14055,11 @@ cross-platform libraries such as jQuery. For more details, see [Ember-Runtime](http://emberjs.com/api/modules/ember-runtime.html). @class Ember @static - @version 2.0.2 + @version 2.0.3 @public */ 'use strict'; @@ -14669,15 +14089,15 @@ /** The semantic version. @property VERSION @type String - @default '2.0.2' + @default '2.0.3' @static @public */ - Ember.VERSION = '2.0.2'; + Ember.VERSION = '2.0.3'; /** The hash of environment variables used to control various configuration settings. To specify your own or override default settings, add the desired properties to a global hash named `EmberENV` (or `ENV` for @@ -21645,1764 +21065,475 @@ } } } } }); -enifed('ember-routing-htmlbars', ['exports', 'ember-metal/core', 'ember-htmlbars/helpers', 'ember-htmlbars/keywords', 'ember-routing-htmlbars/helpers/query-params', 'ember-routing-htmlbars/keywords/action', 'ember-routing-htmlbars/keywords/element-action', 'ember-routing-htmlbars/keywords/link-to', 'ember-routing-htmlbars/keywords/render'], function (exports, _emberMetalCore, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberRoutingHtmlbarsHelpersQueryParams, _emberRoutingHtmlbarsKeywordsAction, _emberRoutingHtmlbarsKeywordsElementAction, _emberRoutingHtmlbarsKeywordsLinkTo, _emberRoutingHtmlbarsKeywordsRender) { - /** - @module ember - @submodule ember-routing-htmlbars - */ - +enifed('ember-metal-views/renderer', ['exports', 'ember-metal/run_loop', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/merge', 'ember-metal/set_properties', 'ember-views/system/build-component-template'], function (exports, _emberMetalRun_loop, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMerge, _emberMetalSet_properties, _emberViewsSystemBuildComponentTemplate) { 'use strict'; - _emberHtmlbarsHelpers.registerHelper('query-params', _emberRoutingHtmlbarsHelpersQueryParams.queryParamsHelper); + function Renderer(_helper) { + this._dom = _helper; + } - _emberHtmlbarsKeywords.registerKeyword('action', _emberRoutingHtmlbarsKeywordsAction.default); - _emberHtmlbarsKeywords.registerKeyword('@element_action', _emberRoutingHtmlbarsKeywordsElementAction.default); - _emberHtmlbarsKeywords.registerKeyword('link-to', _emberRoutingHtmlbarsKeywordsLinkTo.default); - _emberHtmlbarsKeywords.registerKeyword('render', _emberRoutingHtmlbarsKeywordsRender.default); + Renderer.prototype.prerenderTopLevelView = function Renderer_prerenderTopLevelView(view, renderNode) { + if (view._state === 'inDOM') { + throw new Error('You cannot insert a View that has already been rendered'); + } + view.ownerView = renderNode.emberView = view; + view._renderNode = renderNode; - exports.default = _emberMetalCore.default; -}); -enifed('ember-routing-htmlbars/helpers/query-params', ['exports', 'ember-metal/core', 'ember-routing/system/query_params'], function (exports, _emberMetalCore, _emberRoutingSystemQuery_params) { - /** - @module ember - @submodule ember-routing-htmlbars - */ + var layout = _emberMetalProperty_get.get(view, 'layout'); + var template = _emberMetalProperty_get.get(view, 'template'); - 'use strict'; + var componentInfo = { component: view, layout: layout }; - exports.queryParamsHelper = queryParamsHelper; + var block = _emberViewsSystemBuildComponentTemplate.default(componentInfo, {}, { + self: view, + templates: template ? { default: template.raw } : undefined + }).block; - /** - This is a helper to be used in conjunction with the link-to helper. - It will supply url query parameters to the target route. - - Example - - ```handlebars - {{#link-to 'posts' (query-params direction="asc")}}Sort{{/link-to}} - ``` - - @method query-params - @for Ember.Templates.helpers - @param {Object} hash takes a hash of query parameters - @return {Object} A `QueryParams` object for `{{link-to}}` - @public - */ + view.renderBlock(block, renderNode); + view.lastResult = renderNode.lastResult; + this.clearRenderedViews(view.env); + }; - function queryParamsHelper(params, hash) { - _emberMetalCore.default.assert('The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName=\'foo\') as opposed to just (query-params \'foo\')', params.length === 0); + Renderer.prototype.renderTopLevelView = function Renderer_renderTopLevelView(view, renderNode) { + // Check to see if insertion has been canceled + if (view._willInsert) { + view._willInsert = false; + this.prerenderTopLevelView(view, renderNode); + this.dispatchLifecycleHooks(view.env); + } + }; - return _emberRoutingSystemQuery_params.default.create({ - values: hash - }); - } -}); -// assert -enifed('ember-routing-htmlbars/keywords/action', ['exports', 'ember-metal/features', 'htmlbars-runtime/hooks', 'ember-routing-htmlbars/keywords/closure-action'], function (exports, _emberMetalFeatures, _htmlbarsRuntimeHooks, _emberRoutingHtmlbarsKeywordsClosureAction) { - /** - @module ember - @submodule ember-templates - */ - - 'use strict'; - - /** - The `{{action}}` helper provides a way to pass triggers for behavior (usually - just a function) between components, and into components from controllers. - - ### Passing functions with the action helper - - There are three contexts an action helper can be used in. The first two - contexts to discuss are attribute context, and Handlebars value context. - - ```handlebars - {{! An example of attribute context }} - <div onclick={{action "save"}}></div> - {{! Examples of Handlebars value context }} - {{input on-input=(action "save")}} - {{yield (action "refreshData") andAnotherParam}} - ``` - - In these contexts, - the helper is called a "closure action" helper. It's behavior is simple: - If passed a function name, read that function off the `actions` property - of the current context. Once that function is read (or if a function was - passed), create a closure over that function and any arguments. - - The resulting value of an action helper used this way is simply a function. - For example with this attribute context example: - - ```handlebars - {{! An example of attribute context }} - <div onclick={{action "save"}}></div> - ``` - - The resulting template render logic would be: - - ```js - var div = document.createElement('div'); - var actionFunction = (function(context){ - return function() { - return context.actions.save.apply(context, arguments); - }; - })(context); - div.onclick = actionFunction; - ``` - - Thus when the div is clicked, the action on that context is called. - Because the `actionFunction` is just a function, closure actions can be - passed between components the still execute in the correct context. - - Here is an example action handler on a component: - - ```js - export default Ember.Component.extend({ - actions: { - save(/* event *\/) { - this.get('model').save(); - } + Renderer.prototype.revalidateTopLevelView = function Renderer_revalidateTopLevelView(view) { + // This guard prevents revalidation on an already-destroyed view. + if (view._renderNode.lastResult) { + view._renderNode.lastResult.revalidate(view.env); + // supports createElement, which operates without moving the view into + // the inDOM state. + if (view._state === 'inDOM') { + this.dispatchLifecycleHooks(view.env); } - }); - ``` - - Actions are always looked up on the `actions` property of the current context. - This avoids collisions in the naming of common actions, such as `destroy`. - - Two options can be passed to the `action` helper when it is used in this way. - - * `target=someProperty` will look to `someProperty` instead of the current - context for the `actions` hash. This can be useful when targetting a - service for actions. - * `value="target.value"` will read the path `target.value` off the first - argument to the action when it is called and rewrite the first argument - to be that value. This is useful when attaching actions to event listeners. - - ### Invoking an action - - Closure actions curry both their scope and any arguments. When invoked, any - additional arguments are added to the already curried list. - - Actions should be invoked using the [sendAction](/api/classes/Ember.Component.html#method_sendAction) - method. The first argument to `sendAction` is the action to be called, and - additional arguments are passed to the action function. This has interesting - properties combined with currying of arguments. For example: - - ```js - export default Ember.Component.extend({ - actions: { - // Usage {{input on-input=(action (action 'setName' model) value="target.value")}} - setName(model, name) { - model.set('name', name); - } - } - }); - ``` - - The first argument (`model`) was curried over, and the run-time argument (`event`) - becomes a second argument. Action calls be nested this way because each simply - returns a function. Any function can be passed to the `{{action` helper, including - other actions. - - Actions invoked with `sendAction` have the same currying behavior as demonstrated - with `on-input` above. For example: - - ```js - export default Ember.Component.extend({ - actions: { - setName(model, name) { - model.set('name', name); - } - } - }); - ``` - - ```handlebars - {{my-input submit=(action 'setName' model)}} - ``` - - ```js - // app/components/my-component.js - export default Ember.Component.extend({ - click() { - // Note that model is not passed, it was curried in the template - this.sendAction('submit', 'bob'); - } - }); - ``` - - ### Attaching actions to DOM - - The third context the `{{action` helper can be used in we call "element space". - For example: - - ```handlebars - {{! An example of element space }} - <div {{action "save"}}></div> - ``` - - Used this way, the `{{action}}` helper provides a useful shortcut for - registering an HTML element within a template for a single DOM event and - forwarding that interaction to the template's context (controller or component). - - If the context of a template is a controller, actions used this way will - bubble to routes when the controller does not implement the specified action. - Once an action hits a route, it will bubble through the route hierarchy. - - ### Event Propagation - - `{{action` helpers called in element space can control event bubbling. - - Events triggered through the action helper will automatically have - `.preventDefault()` called on them. You do not need to do so in your event - handlers. If you need to allow event propagation (to handle file inputs for - example) you can supply the `preventDefault=false` option to the `{{action}}` helper: - - ```handlebars - <div {{action "sayHello" preventDefault=false}}> - <input type="file" /> - <input type="checkbox" /> - </div> - ``` - - To disable bubbling, pass `bubbles=false` to the helper: - - ```handlebars - <button {{action 'edit' post bubbles=false}}>Edit</button> - ``` - - If you need the default handler to trigger you should either register your - own event handler, or use event methods on your view class. See [Ember.View](/api/classes/Ember.View.html) - 'Responding to Browser Events' for more information. - - ### Specifying DOM event type - - `{{action` helpers called in element space can specify an event type. - - By default the `{{action}}` helper registers for DOM `click` events. You can - supply an `on` option to the helper to specify a different DOM event name: - - ```handlebars - <div {{action "anActionName" on="double-click"}}> - click me - </div> - ``` - - See [Event Names](/api/classes/Ember.View.html#toc_event-names) for a list of - acceptable DOM event names. - - ### Specifying whitelisted modifier keys - - `{{action` helpers called in element space can specify modifier keys. - - By default the `{{action}}` helper will ignore click event with pressed modifier - keys. You can supply an `allowedKeys` option to specify which keys should not be ignored. - - ```handlebars - <div {{action "anActionName" allowedKeys="alt"}}> - click me - </div> - ``` - - This way the `{{action}}` will fire when clicking with the alt key pressed down. - - Alternatively, supply "any" to the `allowedKeys` option to accept any combination of modifier keys. - - ```handlebars - <div {{action "anActionName" allowedKeys="any"}}> - click me with any key pressed - </div> - ``` - - ### Specifying a Target - - A `target` option can be provided to the helper to change - which object will receive the method call. This option must be a path - to an object, accessible in the current context: - - ```handlebars - {{! app/templates/application.hbs }} - <div {{action "anActionName" target=someService}}> - click me - </div> - ``` - - ```javascript - // app/controllers/application.js - export default Ember.Controller.extend({ - someService: Ember.inject.service() - }); - ``` - - @method action - @for Ember.Templates.helpers - @public - */ - - exports.default = function (morph, env, scope, params, hash, template, inverse, visitor) { - if (morph) { - _htmlbarsRuntimeHooks.keyword('@element_action', morph, env, scope, params, hash, template, inverse, visitor); - return true; + this.clearRenderedViews(view.env); } - - return _emberRoutingHtmlbarsKeywordsClosureAction.default(morph, env, scope, params, hash, template, inverse, visitor); }; -}); -enifed('ember-routing-htmlbars/keywords/closure-action', ['exports', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-metal/utils', 'ember-metal/property_get', 'ember-metal/error'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberMetalUtils, _emberMetalProperty_get, _emberMetalError) { - 'use strict'; - exports.default = closureAction; - var INVOKE = _emberMetalUtils.symbol('INVOKE'); - exports.INVOKE = INVOKE; - var ACTION = _emberMetalUtils.symbol('ACTION'); + Renderer.prototype.dispatchLifecycleHooks = function Renderer_dispatchLifecycleHooks(env) { + var ownerView = env.view; - exports.ACTION = ACTION; + var lifecycleHooks = env.lifecycleHooks; + var i, hook; - function closureAction(morph, env, scope, params, hash, template, inverse, visitor) { - return new _emberMetalStreamsStream.default(function () { - var _this = this; + for (i = 0; i < lifecycleHooks.length; i++) { + hook = lifecycleHooks[i]; + ownerView._dispatching = hook.type; - params.map(this.addDependency, this); - Object.keys(hash).map(function (item) { - return _this.addDependency(item); - }); - - var rawAction = params[0]; - var actionArguments = _emberMetalStreamsUtils.readArray(params.slice(1, params.length)); - - var target, action, valuePath; - if (rawAction[INVOKE]) { - // on-change={{action (mut name)}} - target = rawAction; - action = rawAction[INVOKE]; - } else { - // on-change={{action setName}} - // element-space actions look to "controller" then target. Here we only - // look to "target". - target = _emberMetalStreamsUtils.read(scope.self); - action = _emberMetalStreamsUtils.read(rawAction); - if (typeof action === 'string') { - var actionName = action; - action = null; - // on-change={{action 'setName'}} - if (hash.target) { - // on-change={{action 'setName' target=alternativeComponent}} - target = _emberMetalStreamsUtils.read(hash.target); - } - if (target.actions) { - action = target.actions[actionName]; - } - - if (!action) { - throw new _emberMetalError.default('An action named \'' + actionName + '\' was not found in ' + target + '.'); - } - } + switch (hook.type) { + case 'didInsertElement': + this.didInsertElement(hook.view);break; + case 'didUpdate': + this.didUpdate(hook.view);break; } - if (hash.value) { - // <button on-keypress={{action (mut name) value="which"}} - // on-keypress is not even an Ember feature yet - valuePath = _emberMetalStreamsUtils.read(hash.value); - } - - return createClosureAction(target, action, valuePath, actionArguments); - }); - } - - function createClosureAction(target, action, valuePath, actionArguments) { - var closureAction; - - if (actionArguments.length > 0) { - closureAction = function () { - var args = actionArguments; - if (arguments.length > 0) { - var passedArguments = Array.prototype.slice.apply(arguments); - args = actionArguments.concat(passedArguments); - } - if (valuePath && args.length > 0) { - args[0] = _emberMetalProperty_get.get(args[0], valuePath); - } - return action.apply(target, args); - }; - } else { - closureAction = function () { - var args = arguments; - if (valuePath && args.length > 0) { - args = Array.prototype.slice.apply(args); - args[0] = _emberMetalProperty_get.get(args[0], valuePath); - } - return action.apply(target, args); - }; + this.didRender(hook.view); } - closureAction[ACTION] = true; + ownerView._dispatching = null; + env.lifecycleHooks.length = 0; + }; - return closureAction; - } -}); -enifed('ember-routing-htmlbars/keywords/element-action', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/utils', 'ember-metal/run_loop', 'ember-views/streams/utils', 'ember-views/system/utils', 'ember-views/system/action_manager'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalUtils, _emberMetalRun_loop, _emberViewsStreamsUtils, _emberViewsSystemUtils, _emberViewsSystemAction_manager) { - 'use strict'; - - function assert(message, test) { - // This only exists to prevent defeatureify from error when attempting - // to transform the same source twice (tldr; you can't nest stripped statements) - _emberMetalCore.default.assert(message, test); - } - - exports.default = { - setupState: function (state, env, scope, params, hash) { - var getStream = env.hooks.get; - var read = env.hooks.getValue; - - var actionName = read(params[0]); - - assert('You specified a quoteless path to the {{action}} helper ' + 'which did not resolve to an action name (a string). ' + 'Perhaps you meant to use a quoted actionName? (e.g. {{action \'save\'}}).', typeof actionName === 'string' || typeof actionName === 'function'); - - var actionArgs = []; - for (var i = 1, l = params.length; i < l; i++) { - actionArgs.push(_emberViewsStreamsUtils.readUnwrappedModel(params[i])); - } - - var target; - if (hash.target) { - if (typeof hash.target === 'string') { - target = read(getStream(env, scope, hash.target)); - } else { - target = read(hash.target); - } - } else { - target = read(scope.locals.controller) || read(scope.self); - } - - return { actionName: actionName, actionArgs: actionArgs, target: target }; - }, - - isStable: function (state, env, scope, params, hash) { - return true; - }, - - render: function (node, env, scope, params, hash, template, inverse, visitor) { - var actionId = env.dom.getAttribute(node.element, 'data-ember-action') || _emberMetalUtils.uuid(); - - ActionHelper.registerAction({ - actionId: actionId, - node: node, - eventName: hash.on || 'click', - bubbles: hash.bubbles, - preventDefault: hash.preventDefault, - withKeyCode: hash.withKeyCode, - allowedKeys: hash.allowedKeys - }); - - node.cleanup = function () { - ActionHelper.unregisterAction(actionId); - }; - - env.dom.setAttribute(node.element, 'data-ember-action', actionId); + Renderer.prototype.ensureViewNotRendering = function Renderer_ensureViewNotRendering(view) { + var env = view.ownerView.env; + if (env && env.renderedViews.indexOf(view.elementId) !== -1) { + throw new Error('Something you did caused a view to re-render after it rendered but before it was inserted into the DOM.'); } }; - var ActionHelper = {}; - exports.ActionHelper = ActionHelper; - // registeredActions is re-exported for compatibility with older plugins - // that were using this undocumented API. - ActionHelper.registeredActions = _emberViewsSystemAction_manager.default.registeredActions; + Renderer.prototype.clearRenderedViews = function Renderer_clearRenderedViews(env) { + env.renderedNodes = {}; + env.renderedViews.length = 0; + }; - ActionHelper.registerAction = function (_ref) { - var actionId = _ref.actionId; - var node = _ref.node; - var eventName = _ref.eventName; - var preventDefault = _ref.preventDefault; - var bubbles = _ref.bubbles; - var allowedKeys = _ref.allowedKeys; + // This entry point is called from top-level `view.appendTo` + Renderer.prototype.appendTo = function Renderer_appendTo(view, target) { + var morph = this._dom.appendMorph(target); + morph.ownerNode = morph; + view._willInsert = true; + _emberMetalRun_loop.default.schedule('render', this, this.renderTopLevelView, view, morph); + }; - var actions = _emberViewsSystemAction_manager.default.registeredActions[actionId]; - - if (!actions) { - actions = _emberViewsSystemAction_manager.default.registeredActions[actionId] = []; - } - - actions.push({ - eventName: eventName, - handler: function (event) { - if (!isAllowedEvent(event, allowedKeys)) { - return true; - } - - if (preventDefault !== false) { - event.preventDefault(); - } - - if (bubbles === false) { - event.stopPropagation(); - } - - var _node$state = node.state; - var target = _node$state.target; - var actionName = _node$state.actionName; - var actionArgs = _node$state.actionArgs; - - _emberMetalRun_loop.default(function runRegisteredAction() { - if (typeof actionName === 'function') { - actionName.apply(target, actionArgs); - return; - } - - if (target.send) { - target.send.apply(target, [actionName].concat(actionArgs)); - } else { - _emberMetalCore.default.assert('The action \'' + actionName + '\' did not exist on ' + target, typeof target[actionName] === 'function'); - - target[actionName].apply(target, actionArgs); - } - }); - } - }); - - return actionId; + Renderer.prototype.replaceIn = function Renderer_replaceIn(view, target) { + var morph = this._dom.replaceContentWithMorph(target); + morph.ownerNode = morph; + view._willInsert = true; + _emberMetalRun_loop.default.scheduleOnce('render', this, this.renderTopLevelView, view, morph); }; - ActionHelper.unregisterAction = function (actionId) { - delete _emberViewsSystemAction_manager.default.registeredActions[actionId]; + Renderer.prototype.createElement = function Renderer_createElement(view) { + var morph = this._dom.createFragmentMorph(); + morph.ownerNode = morph; + this.prerenderTopLevelView(view, morph); }; - var MODIFIERS = ['alt', 'shift', 'meta', 'ctrl']; - var POINTER_EVENT_TYPE_REGEX = /^click|mouse|touch/; - - function isAllowedEvent(event, allowedKeys) { - if (typeof allowedKeys === 'undefined') { - if (POINTER_EVENT_TYPE_REGEX.test(event.type)) { - return _emberViewsSystemUtils.isSimpleClick(event); - } else { - allowedKeys = ''; - } + Renderer.prototype.didCreateElement = function (view, element) { + if (element) { + view.element = element; } - if (allowedKeys.indexOf('any') >= 0) { - return true; + if (view._transitionTo) { + view._transitionTo('hasElement'); } + }; // hasElement - for (var i = 0, l = MODIFIERS.length; i < l; i++) { - if (event[MODIFIERS[i] + 'Key'] && allowedKeys.indexOf(MODIFIERS[i]) === -1) { - return false; - } + Renderer.prototype.willInsertElement = function (view) { + if (view.trigger) { + view.trigger('willInsertElement'); } + }; // will place into DOM - return true; - } -}); -// assert -enifed('ember-routing-htmlbars/keywords/link-to', ['exports', 'ember-metal/streams/utils', 'ember-metal/core', 'ember-metal/merge'], function (exports, _emberMetalStreamsUtils, _emberMetalCore, _emberMetalMerge) { - /** - @module ember - @submodule ember-routing-htmlbars - */ + Renderer.prototype.setAttrs = function (view, attrs) { + _emberMetalProperty_set.set(view, 'attrs', attrs); + }; // set attrs the first time - 'use strict'; + Renderer.prototype.componentInitAttrs = function (component, attrs) { + // for attrs-proxy support + component.trigger('_internalDidReceiveAttrs'); + component.trigger('didInitAttrs', { attrs: attrs }); + component.trigger('didReceiveAttrs', { newAttrs: attrs }); + }; // set attrs the first time - /** - The `{{link-to}}` helper renders a link to the supplied - `routeName` passing an optionally supplied model to the - route as its `model` context of the route. The block - for `{{link-to}}` becomes the innerHTML of the rendered - element: - - ```handlebars - {{#link-to 'photoGallery'}} - Great Hamster Photos - {{/link-to}} - ``` - - You can also use an inline form of `{{link-to}}` helper by - passing the link text as the first argument - to the helper: - - ```handlebars - {{link-to 'Great Hamster Photos' 'photoGallery'}} - ``` - - Both will result in: - - ```html - <a href="/hamster-photos"> - Great Hamster Photos - </a> - ``` - - ### Supplying a tagName - By default `{{link-to}}` renders an `<a>` element. This can - be overridden for a single use of `{{link-to}}` by supplying - a `tagName` option: - - ```handlebars - {{#link-to 'photoGallery' tagName="li"}} - Great Hamster Photos - {{/link-to}} - ``` - - ```html - <li> - Great Hamster Photos - </li> - ``` - - To override this option for your entire application, see - "Overriding Application-wide Defaults". - - ### Disabling the `link-to` helper - By default `{{link-to}}` is enabled. - any passed value to `disabled` helper property will disable the `link-to` helper. - - static use: the `disabled` option: - - ```handlebars - {{#link-to 'photoGallery' disabled=true}} - Great Hamster Photos - {{/link-to}} - ``` - - dynamic use: the `disabledWhen` option: - - ```handlebars - {{#link-to 'photoGallery' disabledWhen=controller.someProperty}} - Great Hamster Photos - {{/link-to}} - ``` - - any passed value to `disabled` will disable it except `undefined`. - to ensure that only `true` disable the `link-to` helper you can - override the global behaviour of `Ember.LinkComponent`. - - ```javascript - Ember.LinkComponent.reopen({ - disabled: Ember.computed(function(key, value) { - if (value !== undefined) { - this.set('_isDisabled', value === true); - } - return value === true ? get(this, 'disabledClass') : false; - }) - }); - ``` - - see "Overriding Application-wide Defaults" for more. - - ### Handling `href` - `{{link-to}}` will use your application's Router to - fill the element's `href` property with a url that - matches the path to the supplied `routeName` for your - router's configured `Location` scheme, which defaults - to Ember.HashLocation. - - ### Handling current route - `{{link-to}}` will apply a CSS class name of 'active' - when the application's current route matches - the supplied routeName. For example, if the application's - current route is 'photoGallery.recent' the following - use of `{{link-to}}`: - - ```handlebars - {{#link-to 'photoGallery.recent'}} - Great Hamster Photos - {{/link-to}} - ``` - - will result in - - ```html - <a href="/hamster-photos/this-week" class="active"> - Great Hamster Photos - </a> - ``` - - The CSS class name used for active classes can be customized - for a single use of `{{link-to}}` by passing an `activeClass` - option: - - ```handlebars - {{#link-to 'photoGallery.recent' activeClass="current-url"}} - Great Hamster Photos - {{/link-to}} - ``` - - ```html - <a href="/hamster-photos/this-week" class="current-url"> - Great Hamster Photos - </a> - ``` - - To override this option for your entire application, see - "Overriding Application-wide Defaults". - - ### Keeping a link active for other routes - - If you need a link to be 'active' even when it doesn't match - the current route, you can use the the `current-when` - argument. - - ```handlebars - {{#link-to 'photoGallery' current-when='photos'}} - Photo Gallery - {{/link-to}} - ``` - - This may be helpful for keeping links active for: - - * non-nested routes that are logically related - * some secondary menu approaches - * 'top navigation' with 'sub navigation' scenarios - - A link will be active if `current-when` is `true` or the current - route is the route this link would transition to. - - To match multiple routes 'space-separate' the routes: - - ```handlebars - {{#link-to 'gallery' current-when='photos drawings paintings'}} - Art Gallery - {{/link-to}} - ``` - - ### Supplying a model - An optional model argument can be used for routes whose - paths contain dynamic segments. This argument will become - the model context of the linked route: - - ```javascript - App.Router.map(function() { - this.route("photoGallery", {path: "hamster-photos/:photo_id"}); - }); - ``` - - ```handlebars - {{#link-to 'photoGallery' aPhoto}} - {{aPhoto.title}} - {{/link-to}} - ``` - - ```html - <a href="/hamster-photos/42"> - Tomster - </a> - ``` - - ### Supplying multiple models - For deep-linking to route paths that contain multiple - dynamic segments, multiple model arguments can be used. - As the router transitions through the route path, each - supplied model argument will become the context for the - route with the dynamic segments: - - ```javascript - App.Router.map(function() { - this.route("photoGallery", { path: "hamster-photos/:photo_id" }, function() { - this.route("comment", {path: "comments/:comment_id"}); - }); - }); - ``` - This argument will become the model context of the linked route: - - ```handlebars - {{#link-to 'photoGallery.comment' aPhoto comment}} - {{comment.body}} - {{/link-to}} - ``` - - ```html - <a href="/hamster-photos/42/comments/718"> - A+++ would snuggle again. - </a> - ``` - - ### Supplying an explicit dynamic segment value - If you don't have a model object available to pass to `{{link-to}}`, - an optional string or integer argument can be passed for routes whose - paths contain dynamic segments. This argument will become the value - of the dynamic segment: - - ```javascript - App.Router.map(function() { - this.route("photoGallery", { path: "hamster-photos/:photo_id" }); - }); - ``` - - ```handlebars - {{#link-to 'photoGallery' aPhotoId}} - {{aPhoto.title}} - {{/link-to}} - ``` - - ```html - <a href="/hamster-photos/42"> - Tomster - </a> - ``` - - When transitioning into the linked route, the `model` hook will - be triggered with parameters including this passed identifier. - - ### Allowing Default Action - - By default the `{{link-to}}` helper prevents the default browser action - by calling `preventDefault()` as this sort of action bubbling is normally - handled internally and we do not want to take the browser to a new URL (for - example). - - If you need to override this behavior specify `preventDefault=false` in - your template: - - ```handlebars - {{#link-to 'photoGallery' aPhotoId preventDefault=false}} - {{aPhotoId.title}} - {{/link-to}} - ``` - - ### Overriding attributes - You can override any given property of the Ember.LinkComponent - that is generated by the `{{link-to}}` helper by passing - key/value pairs, like so: - - ```handlebars - {{#link-to aPhoto tagName='li' title='Following this link will change your life' classNames='pic sweet'}} - Uh-mazing! - {{/link-to}} - ``` - - See [Ember.LinkComponent](/api/classes/Ember.LinkComponent.html) for a - complete list of overrideable properties. Be sure to also - check out inherited properties of `LinkComponent`. - - ### Overriding Application-wide Defaults - ``{{link-to}}`` creates an instance of Ember.LinkComponent - for rendering. To override options for your entire - application, reopen Ember.LinkComponent and supply the - desired values: - - ``` javascript - Ember.LinkComponent.reopen({ - activeClass: "is-active", - tagName: 'li' - }) - ``` - - It is also possible to override the default event in - this manner: - - ``` javascript - Ember.LinkComponent.reopen({ - eventName: 'customEventName' - }); - ``` - - @method link-to - @for Ember.Templates.helpers - @param {String} routeName - @param {Object} [context]* - @param [options] {Object} Handlebars key/value pairs of options, you can override any property of Ember.LinkComponent - @return {String} HTML string - @see {Ember.LinkComponent} - @public - */ - exports.default = { - link: function (state, params, hash) { - _emberMetalCore.default.assert('You must provide one or more parameters to the link-to helper.', params.length); - }, + Renderer.prototype.didInsertElement = function (view) { + if (view._transitionTo) { + view._transitionTo('inDOM'); + } - render: function (morph, env, scope, params, hash, template, inverse, visitor) { - var attrs = _emberMetalMerge.default({}, hash); + if (view.trigger) { + view.trigger('didInsertElement'); + } + }; // inDOM // placed into DOM - // TODO: Rewrite link-to to use arbitrary length positional params. - attrs.params = _emberMetalStreamsUtils.readArray(params); + Renderer.prototype.didUpdate = function (view) { + if (view.trigger) { + view.trigger('didUpdate'); + } + }; - // Used for deprecations (to tell the user what view the deprecated syntax - // was used in). - attrs.view = env.view; - - // TODO: Remove once `hasBlock` is working again - attrs.hasBlock = !!template; - - attrs.escaped = !morph.parseTextAsHTML; - - env.hooks.component(morph, env, scope, '-link-to', params, attrs, { default: template }, visitor); - }, - - rerender: function (morph, env, scope, params, hash, template, inverse, visitor) { - this.render(morph, env, scope, params, hash, template, inverse, visitor); + Renderer.prototype.didRender = function (view) { + if (view.trigger) { + view.trigger('didRender'); } }; -}); -// assert -enifed('ember-routing-htmlbars/keywords/render', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/error', 'ember-metal/streams/utils', 'ember-runtime/system/string', 'ember-routing/system/generate_controller', 'ember-htmlbars/node-managers/view-node-manager'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalError, _emberMetalStreamsUtils, _emberRuntimeSystemString, _emberRoutingSystemGenerate_controller, _emberHtmlbarsNodeManagersViewNodeManager) { - /** - @module ember - @submodule ember-templates - */ - 'use strict'; + Renderer.prototype.updateAttrs = function (view, attrs) { + this.setAttrs(view, attrs); + }; // setting new attrs - /** - Calling ``{{render}}`` from within a template will insert another - template that matches the provided name. The inserted template will - access its properties on its own controller (rather than the controller - of the parent template). - If a view class with the same name exists, the view class also will be used. - Note: A given controller may only be used *once* in your app in this manner. - A singleton instance of the controller will be created for you. - Example: - - ```javascript - App.NavigationController = Ember.Controller.extend({ - who: "world" - }); - ``` - - ```handlebars - <!-- navigation.hbs --> - Hello, {{who}}. - ``` - - ```handlebars - <!-- application.hbs --> - <h1>My great app</h1> - {{render "navigation"}} - ``` - - ```html - <h1>My great app</h1> - <div class='ember-view'> - Hello, world. - </div> - ``` - - Optionally you may provide a second argument: a property path - that will be bound to the `model` property of the controller. - If a `model` property path is specified, then a new instance of the - controller will be created and `{{render}}` can be used multiple times - with the same name. - - For example if you had this `author` template. - - ```handlebars - <div class="author"> - Written by {{firstName}} {{lastName}}. - Total Posts: {{postCount}} - </div> - ``` - - You could render it inside the `post` template using the `render` helper. - - ```handlebars - <div class="post"> - <h1>{{title}}</h1> - <div>{{body}}</div> - {{render "author" author}} - </div> - ``` - - @method render - @for Ember.Templates.helpers - @param {String} name - @param {Object?} context - @param {Hash} options - @return {String} HTML string - @public - */ - exports.default = { - willRender: function (renderNode, env) { - if (env.view.ownerView._outlets) { - // We make sure we will get dirtied when outlet state changes. - env.view.ownerView._outlets.push(renderNode); - } - }, + Renderer.prototype.componentUpdateAttrs = function (component, newAttrs) { + var oldAttrs = null; - setupState: function (prevState, env, scope, params, hash) { - var name = params[0]; + if (component.attrs) { + oldAttrs = _emberMetalMerge.assign({}, component.attrs); + _emberMetalSet_properties.default(component.attrs, newAttrs); + } else { + _emberMetalProperty_set.set(component, 'attrs', newAttrs); + } - _emberMetalCore.default.assert('The first argument of {{render}} must be quoted, e.g. {{render "sidebar"}}.', typeof name === 'string'); + // for attrs-proxy support + component.trigger('_internalDidReceiveAttrs'); + component.trigger('didUpdateAttrs', { oldAttrs: oldAttrs, newAttrs: newAttrs }); + component.trigger('didReceiveAttrs', { oldAttrs: oldAttrs, newAttrs: newAttrs }); + }; - return { - parentView: env.view, - manager: prevState.manager, - controller: prevState.controller, - childOutletState: childOutletState(name, env) - }; - }, + Renderer.prototype.willUpdate = function (view, attrs) { + if (view._willUpdate) { + view._willUpdate(attrs); + } + }; - childEnv: function (state, env) { - return env.childWithOutletState(state.childOutletState); - }, + Renderer.prototype.componentWillUpdate = function (component) { + component.trigger('willUpdate'); + }; - isStable: function (lastState, nextState) { - return isStable(lastState.childOutletState, nextState.childOutletState); - }, + Renderer.prototype.willRender = function (view) { + if (view._willRender) { + view._willRender(); + } + }; - isEmpty: function (state) { - return false; - }, + Renderer.prototype.componentWillRender = function (component) { + component.trigger('willRender'); + }; - render: function (node, env, scope, params, hash, template, inverse, visitor) { - var state = node.state; - var name = params[0]; - var context = params[1]; + Renderer.prototype.remove = function (view, shouldDestroy) { + this.willDestroyElement(view); - var container = env.container; + view._willRemoveElement = true; + _emberMetalRun_loop.default.schedule('render', this, this.renderElementRemoval, view); + }; - // The render keyword presumes it can work without a router. This is really - // only to satisfy the test: - // - // {{view}} should not override class bindings defined on a child view" - // - var router = container.lookup('router:main'); + Renderer.prototype.renderElementRemoval = function Renderer_renderElementRemoval(view) { + // Use the _willRemoveElement flag to avoid mulitple removal attempts in + // case many have been scheduled. This should be more performant than using + // `scheduleOnce`. + if (view._willRemoveElement) { + view._willRemoveElement = false; - _emberMetalCore.default.assert('The second argument of {{render}} must be a path, e.g. {{render "post" post}}.', params.length < 2 || _emberMetalStreamsUtils.isStream(params[1])); - - if (params.length === 1) { - // use the singleton controller - _emberMetalCore.default.assert('You can only use the {{render}} helper once without a model object as ' + 'its second argument, as in {{render "post" post}}.', !router || !router._lookupActiveComponentNode(name)); - } else if (params.length !== 2) { - throw new _emberMetalError.default('You must pass a templateName to render'); + if (view._renderNode && view.element && view.element.parentNode) { + view._renderNode.clear(); } - - var templateName = 'template:' + name; - _emberMetalCore.default.assert('You used `{{render \'' + name + '\'}}`, but \'' + name + '\' can not be ' + 'found as either a template or a view.', container._registry.has('view:' + name) || container._registry.has(templateName) || !!template); - - var view = container.lookup('view:' + name); - if (!view) { - view = container.lookup('view:default'); - } - var viewHasTemplateSpecified = view && !!_emberMetalProperty_get.get(view, 'template'); - if (!template && !viewHasTemplateSpecified) { - template = container.lookup(templateName); - } - - if (view) { - view.ownerView = env.view.ownerView; - } - - // provide controller override - var controllerName; - var controllerFullName; - - if (hash.controller) { - controllerName = hash.controller; - controllerFullName = 'controller:' + controllerName; - delete hash.controller; - - _emberMetalCore.default.assert('The controller name you supplied \'' + controllerName + '\' ' + 'did not resolve to a controller.', container._registry.has(controllerFullName)); - } else { - controllerName = name; - controllerFullName = 'controller:' + controllerName; - } - - var parentController = _emberMetalStreamsUtils.read(scope.locals.controller); - var controller; - - // choose name - if (params.length > 1) { - var factory = container.lookupFactory(controllerFullName) || _emberRoutingSystemGenerate_controller.generateControllerFactory(container, controllerName); - - controller = factory.create({ - model: _emberMetalStreamsUtils.read(context), - parentController: parentController, - target: parentController - }); - - node.addDestruction(controller); - } else { - controller = container.lookup(controllerFullName) || _emberRoutingSystemGenerate_controller.default(container, controllerName); - - controller.setProperties({ - target: parentController, - parentController: parentController - }); - } - - if (view) { - view.set('controller', controller); - } - state.controller = controller; - - hash.viewName = _emberRuntimeSystemString.camelize(name); - - // var state = node.state; - // var parentView = scope.view; - if (template && template.raw) { - template = template.raw; - } - - var options = { - layout: null, - self: controller - }; - - if (view) { - options.component = view; - } - - var nodeManager = _emberHtmlbarsNodeManagersViewNodeManager.default.create(node, env, hash, options, state.parentView, null, null, template); - state.manager = nodeManager; - - if (router && params.length === 1) { - router._connectActiveComponentNode(name, nodeManager); - } - - nodeManager.render(env, hash, visitor); - }, - - rerender: function (node, env, scope, params, hash, template, inverse, visitor) { - var model = _emberMetalStreamsUtils.read(params[1]); - node.state.controller.set('model', model); + this.didDestroyElement(view); } }; - function childOutletState(name, env) { - var topLevel = env.view.ownerView; - if (!topLevel || !topLevel.outletState) { - return; - } + Renderer.prototype.willRemoveElement = function () /*view*/{}; - var outletState = topLevel.outletState; - if (!outletState.main) { - return; + Renderer.prototype.willDestroyElement = function (view) { + if (view._willDestroyElement) { + view._willDestroyElement(); } + if (view.trigger) { + view.trigger('willDestroyElement'); + view.trigger('willClearRender'); + } - var selectedOutletState = outletState.main.outlets['__ember_orphans__']; - if (!selectedOutletState) { - return; + if (view._transitionTo) { + view._transitionTo('destroying'); } - var matched = selectedOutletState.outlets[name]; - if (matched) { - var childState = Object.create(null); - childState[matched.render.outlet] = matched; - matched.wasUsed = true; - return childState; - } - } + }; - function isStable(a, b) { - if (!a && !b) { - return true; + Renderer.prototype.didDestroyElement = function (view) { + view.element = null; + + // Views that are being destroyed should never go back to the preRender state. + // However if we're just destroying an element on a view (as is the case when + // using View#remove) then the view should go to a preRender state so that + // it can be rendered again later. + if (view._state !== 'destroying' && view._transitionTo) { + view._transitionTo('preRender'); } - if (!a || !b) { - return false; - } - for (var outletName in a) { - if (!isStableOutlet(a[outletName], b[outletName])) { - return false; - } - } - return true; - } - function isStableOutlet(a, b) { - if (!a && !b) { - return true; + if (view.trigger) { + view.trigger('didDestroyElement'); } - if (!a || !b) { - return false; - } - a = a.render; - b = b.render; - for (var key in a) { - if (a.hasOwnProperty(key)) { - // name is only here for logging & debugging. If two different - // names result in otherwise identical states, they're still - // identical. - if (a[key] !== b[key] && key !== 'name') { - return false; - } - } - } - return true; - } -}); -// assert -enifed('ember-routing-views', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-routing-views/views/link', 'ember-routing-views/views/outlet'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberRoutingViewsViewsLink, _emberRoutingViewsViewsOutlet) { - /** - @module ember - @submodule ember-routing-views - */ + }; // element destroyed so view.destroy shouldn't try to remove it removedFromDOM + exports.default = Renderer; +}); +enifed('ember-metal-views', ['exports', 'ember-metal-views/renderer'], function (exports, _emberMetalViewsRenderer) { 'use strict'; - _emberMetalCore.default.LinkComponent = _emberRoutingViewsViewsLink.default; - _emberMetalCore.default.OutletView = _emberRoutingViewsViewsOutlet.OutletView; - exports.default = _emberMetalCore.default; + exports.Renderer = _emberMetalViewsRenderer.default; }); -enifed('ember-routing-views/views/link', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/computed', 'ember-metal/computed_macros', 'ember-views/system/utils', 'ember-views/views/component', 'ember-runtime/inject', 'ember-runtime/system/service', 'ember-runtime/mixins/controller', 'ember-htmlbars/templates/link-to'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalComputed_macros, _emberViewsSystemUtils, _emberViewsViewsComponent, _emberRuntimeInject, _emberRuntimeSystemService, _emberRuntimeMixinsController, _emberHtmlbarsTemplatesLinkTo) { +enifed('ember-metal', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/merge', 'ember-metal/instrumentation', 'ember-metal/utils', 'ember-metal/error', 'ember-metal/cache', 'ember-metal/logger', 'ember-metal/property_get', 'ember-metal/events', 'ember-metal/observer_set', 'ember-metal/property_events', 'ember-metal/properties', 'ember-metal/property_set', 'ember-metal/map', 'ember-metal/get_properties', 'ember-metal/set_properties', 'ember-metal/watch_key', 'ember-metal/chains', 'ember-metal/watch_path', 'ember-metal/watching', 'ember-metal/expand_properties', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/computed_macros', 'ember-metal/observer', 'ember-metal/mixin', 'ember-metal/binding', 'ember-metal/run_loop', 'ember-metal/libraries', 'ember-metal/is_none', 'ember-metal/is_empty', 'ember-metal/is_blank', 'ember-metal/is_present', 'backburner', 'ember-metal/streams/utils', 'ember-metal/streams/stream'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalMerge, _emberMetalInstrumentation, _emberMetalUtils, _emberMetalError, _emberMetalCache, _emberMetalLogger, _emberMetalProperty_get, _emberMetalEvents, _emberMetalObserver_set, _emberMetalProperty_events, _emberMetalProperties, _emberMetalProperty_set, _emberMetalMap, _emberMetalGet_properties, _emberMetalSet_properties, _emberMetalWatch_key, _emberMetalChains, _emberMetalWatch_path, _emberMetalWatching, _emberMetalExpand_properties, _emberMetalComputed, _emberMetalAlias, _emberMetalComputed_macros, _emberMetalObserver, _emberMetalMixin, _emberMetalBinding, _emberMetalRun_loop, _emberMetalLibraries, _emberMetalIs_none, _emberMetalIs_empty, _emberMetalIs_blank, _emberMetalIs_present, _backburner, _emberMetalStreamsUtils, _emberMetalStreamsStream) { /** @module ember - @submodule ember-routing-views + @submodule ember-metal */ + // BEGIN IMPORTS 'use strict'; - _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.0.2'; + _emberMetalComputed.computed.empty = _emberMetalComputed_macros.empty; + _emberMetalComputed.computed.notEmpty = _emberMetalComputed_macros.notEmpty; + _emberMetalComputed.computed.none = _emberMetalComputed_macros.none; + _emberMetalComputed.computed.not = _emberMetalComputed_macros.not; + _emberMetalComputed.computed.bool = _emberMetalComputed_macros.bool; + _emberMetalComputed.computed.match = _emberMetalComputed_macros.match; + _emberMetalComputed.computed.equal = _emberMetalComputed_macros.equal; + _emberMetalComputed.computed.gt = _emberMetalComputed_macros.gt; + _emberMetalComputed.computed.gte = _emberMetalComputed_macros.gte; + _emberMetalComputed.computed.lt = _emberMetalComputed_macros.lt; + _emberMetalComputed.computed.lte = _emberMetalComputed_macros.lte; + _emberMetalComputed.computed.alias = _emberMetalAlias.default; + _emberMetalComputed.computed.oneWay = _emberMetalComputed_macros.oneWay; + _emberMetalComputed.computed.reads = _emberMetalComputed_macros.oneWay; + _emberMetalComputed.computed.readOnly = _emberMetalComputed_macros.readOnly; + _emberMetalComputed.computed.defaultTo = _emberMetalComputed_macros.defaultTo; + _emberMetalComputed.computed.deprecatingAlias = _emberMetalComputed_macros.deprecatingAlias; + _emberMetalComputed.computed.and = _emberMetalComputed_macros.and; + _emberMetalComputed.computed.or = _emberMetalComputed_macros.or; + _emberMetalComputed.computed.any = _emberMetalComputed_macros.any; + _emberMetalComputed.computed.collect = _emberMetalComputed_macros.collect; - var linkComponentClassNameBindings = ['active', 'loading', 'disabled']; + // END IMPORTS - linkComponentClassNameBindings = ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut']; + // BEGIN EXPORTS + var EmberInstrumentation = _emberMetalCore.default.Instrumentation = {}; + EmberInstrumentation.instrument = _emberMetalInstrumentation.instrument; + EmberInstrumentation.subscribe = _emberMetalInstrumentation.subscribe; + EmberInstrumentation.unsubscribe = _emberMetalInstrumentation.unsubscribe; + EmberInstrumentation.reset = _emberMetalInstrumentation.reset; - /** - `Ember.LinkComponent` renders an element whose `click` event triggers a - transition of the application's instance of `Ember.Router` to - a supplied route by name. - - Instances of `LinkComponent` will most likely be created through - the `link-to` Handlebars helper, but properties of this class - can be overridden to customize application-wide behavior. - - @class LinkComponent - @namespace Ember - @extends Ember.Component - @see {Handlebars.helpers.link-to} - @private - **/ - var LinkComponent = _emberViewsViewsComponent.default.extend({ - defaultLayout: _emberHtmlbarsTemplatesLinkTo.default, + _emberMetalCore.default.instrument = _emberMetalInstrumentation.instrument; + _emberMetalCore.default.subscribe = _emberMetalInstrumentation.subscribe; - tagName: 'a', + _emberMetalCore.default._Cache = _emberMetalCache.default; - /** - @deprecated Use current-when instead. - @property currentWhen - @private - */ - currentWhen: _emberMetalComputed_macros.deprecatingAlias('current-when', { id: 'ember-routing-view.deprecated-current-when', until: '3.0.0' }), + _emberMetalCore.default.generateGuid = _emberMetalUtils.generateGuid; + _emberMetalCore.default.GUID_KEY = _emberMetalUtils.GUID_KEY; + _emberMetalCore.default.platform = { + defineProperty: true, + hasPropertyAccessors: true + }; - /** - Used to determine when this LinkComponent is active. - @property currentWhen - @public - */ - 'current-when': null, + _emberMetalCore.default.Error = _emberMetalError.default; + _emberMetalCore.default.guidFor = _emberMetalUtils.guidFor; + _emberMetalCore.default.META_DESC = _emberMetalUtils.META_DESC; + _emberMetalCore.default.EMPTY_META = _emberMetalUtils.EMPTY_META; + _emberMetalCore.default.meta = _emberMetalUtils.meta; + _emberMetalCore.default.inspect = _emberMetalUtils.inspect; + _emberMetalCore.default.tryCatchFinally = _emberMetalUtils.deprecatedTryCatchFinally; + _emberMetalCore.default.makeArray = _emberMetalUtils.makeArray; + _emberMetalCore.default.canInvoke = _emberMetalUtils.canInvoke; + _emberMetalCore.default.tryInvoke = _emberMetalUtils.tryInvoke; + _emberMetalCore.default.wrap = _emberMetalUtils.wrap; + _emberMetalCore.default.apply = _emberMetalUtils.apply; + _emberMetalCore.default.applyStr = _emberMetalUtils.applyStr; + _emberMetalCore.default.uuid = _emberMetalUtils.uuid; - /** - Sets the `title` attribute of the `LinkComponent`'s HTML element. - @property title - @default null - @public - **/ - title: null, + _emberMetalCore.default.Logger = _emberMetalLogger.default; - /** - Sets the `rel` attribute of the `LinkComponent`'s HTML element. - @property rel - @default null - @public - **/ - rel: null, + _emberMetalCore.default.get = _emberMetalProperty_get.get; + _emberMetalCore.default.getWithDefault = _emberMetalProperty_get.getWithDefault; + _emberMetalCore.default.normalizeTuple = _emberMetalProperty_get.normalizeTuple; + _emberMetalCore.default._getPath = _emberMetalProperty_get._getPath; - /** - Sets the `tabindex` attribute of the `LinkComponent`'s HTML element. - @property tabindex - @default null - @public - **/ - tabindex: null, + _emberMetalCore.default.on = _emberMetalEvents.on; + _emberMetalCore.default.addListener = _emberMetalEvents.addListener; + _emberMetalCore.default.removeListener = _emberMetalEvents.removeListener; + _emberMetalCore.default._suspendListener = _emberMetalEvents.suspendListener; + _emberMetalCore.default._suspendListeners = _emberMetalEvents.suspendListeners; + _emberMetalCore.default.sendEvent = _emberMetalEvents.sendEvent; + _emberMetalCore.default.hasListeners = _emberMetalEvents.hasListeners; + _emberMetalCore.default.watchedEvents = _emberMetalEvents.watchedEvents; + _emberMetalCore.default.listenersFor = _emberMetalEvents.listenersFor; + _emberMetalCore.default.accumulateListeners = _emberMetalEvents.accumulateListeners; - /** - Sets the `target` attribute of the `LinkComponent`'s HTML element. - @since 1.8.0 - @property target - @default null - @public - **/ - target: null, + _emberMetalCore.default._ObserverSet = _emberMetalObserver_set.default; - /** - The CSS class to apply to `LinkComponent`'s element when its `active` - property is `true`. - @property activeClass - @type String - @default active - @private - **/ - activeClass: 'active', + _emberMetalCore.default.propertyWillChange = _emberMetalProperty_events.propertyWillChange; + _emberMetalCore.default.propertyDidChange = _emberMetalProperty_events.propertyDidChange; + _emberMetalCore.default.overrideChains = _emberMetalProperty_events.overrideChains; + _emberMetalCore.default.beginPropertyChanges = _emberMetalProperty_events.beginPropertyChanges; + _emberMetalCore.default.endPropertyChanges = _emberMetalProperty_events.endPropertyChanges; + _emberMetalCore.default.changeProperties = _emberMetalProperty_events.changeProperties; - /** - The CSS class to apply to `LinkComponent`'s element when its `loading` - property is `true`. - @property loadingClass - @type String - @default loading - @private - **/ - loadingClass: 'loading', + _emberMetalCore.default.defineProperty = _emberMetalProperties.defineProperty; - /** - The CSS class to apply to a `LinkComponent`'s element when its `disabled` - property is `true`. - @property disabledClass - @type String - @default disabled - @private - **/ - disabledClass: 'disabled', - _isDisabled: false, + _emberMetalCore.default.set = _emberMetalProperty_set.set; + _emberMetalCore.default.trySet = _emberMetalProperty_set.trySet; - /** - Determines whether the `LinkComponent` will trigger routing via - the `replaceWith` routing strategy. - @property replace - @type Boolean - @default false - @public - **/ - replace: false, + _emberMetalCore.default.OrderedSet = _emberMetalMap.OrderedSet; + _emberMetalCore.default.Map = _emberMetalMap.Map; + _emberMetalCore.default.MapWithDefault = _emberMetalMap.MapWithDefault; - /** - By default the `{{link-to}}` helper will bind to the `href` and - `title` attributes. It's discouraged that you override these defaults, - however you can push onto the array if needed. - @property attributeBindings - @type Array | String - @default ['title', 'rel', 'tabindex', 'target'] - @public - */ - attributeBindings: ['href', 'title', 'rel', 'tabindex', 'target'], + _emberMetalCore.default.getProperties = _emberMetalGet_properties.default; + _emberMetalCore.default.setProperties = _emberMetalSet_properties.default; - /** - By default the `{{link-to}}` helper will bind to the `active`, `loading`, and - `disabled` classes. It is discouraged to override these directly. - @property classNameBindings - @type Array - @default ['active', 'loading', 'disabled'] - @public - */ - classNameBindings: linkComponentClassNameBindings, + _emberMetalCore.default.watchKey = _emberMetalWatch_key.watchKey; + _emberMetalCore.default.unwatchKey = _emberMetalWatch_key.unwatchKey; - /** - By default the `{{link-to}}` helper responds to the `click` event. You - can override this globally by setting this property to your custom - event name. - This is particularly useful on mobile when one wants to avoid the 300ms - click delay using some sort of custom `tap` event. - @property eventName - @type String - @default click - @private - */ - eventName: 'click', + _emberMetalCore.default.flushPendingChains = _emberMetalChains.flushPendingChains; + _emberMetalCore.default.removeChainWatcher = _emberMetalChains.removeChainWatcher; + _emberMetalCore.default._ChainNode = _emberMetalChains.ChainNode; + _emberMetalCore.default.finishChains = _emberMetalChains.finishChains; - // this is doc'ed here so it shows up in the events - // section of the API documentation, which is where - // people will likely go looking for it. - /** - Triggers the `LinkComponent`'s routing behavior. If - `eventName` is changed to a value other than `click` - the routing behavior will trigger on that custom event - instead. - @event click - @private - */ + _emberMetalCore.default.watchPath = _emberMetalWatch_path.watchPath; + _emberMetalCore.default.unwatchPath = _emberMetalWatch_path.unwatchPath; - /** - An overridable method called when LinkComponent objects are instantiated. - Example: - ```javascript - App.MyLinkComponent = Ember.LinkComponent.extend({ - init: function() { - this._super.apply(this, arguments); - Ember.Logger.log('Event is ' + this.get('eventName')); - } - }); - ``` - NOTE: If you do override `init` for a framework class like `Ember.View`, - be sure to call `this._super.apply(this, arguments)` in your - `init` declaration! If you don't, Ember may not have an opportunity to - do important setup work, and you'll see strange behavior in your - application. - @method init - @private - */ - init: function () { - this._super.apply(this, arguments); + _emberMetalCore.default.watch = _emberMetalWatching.watch; + _emberMetalCore.default.isWatching = _emberMetalWatching.isWatching; + _emberMetalCore.default.unwatch = _emberMetalWatching.unwatch; + _emberMetalCore.default.rewatch = _emberMetalWatching.rewatch; + _emberMetalCore.default.destroy = _emberMetalWatching.destroy; - // Map desired event name to invoke function - var eventName = _emberMetalProperty_get.get(this, 'eventName'); - this.on(eventName, this, this._invoke); - }, + _emberMetalCore.default.expandProperties = _emberMetalExpand_properties.default; - _routing: _emberRuntimeInject.default.service('-routing'), + _emberMetalCore.default.ComputedProperty = _emberMetalComputed.ComputedProperty; + _emberMetalCore.default.computed = _emberMetalComputed.computed; + _emberMetalCore.default.cacheFor = _emberMetalComputed.cacheFor; - /** - Accessed as a classname binding to apply the `LinkComponent`'s `disabledClass` - CSS `class` to the element when the link is disabled. - When `true` interactions with the element will not trigger route changes. - @property disabled - @private - */ - disabled: _emberMetalComputed.computed({ - get: function (key, value) { - return false; - }, - set: function (key, value) { - if (value !== undefined) { - this.set('_isDisabled', value); - } + _emberMetalCore.default.addObserver = _emberMetalObserver.addObserver; + _emberMetalCore.default.observersFor = _emberMetalObserver.observersFor; + _emberMetalCore.default.removeObserver = _emberMetalObserver.removeObserver; + _emberMetalCore.default._suspendObserver = _emberMetalObserver._suspendObserver; + _emberMetalCore.default._suspendObservers = _emberMetalObserver._suspendObservers; - return value ? _emberMetalProperty_get.get(this, 'disabledClass') : false; - } - }), + _emberMetalCore.default.IS_BINDING = _emberMetalMixin.IS_BINDING; + _emberMetalCore.default.required = _emberMetalMixin.required; + _emberMetalCore.default.aliasMethod = _emberMetalMixin.aliasMethod; + _emberMetalCore.default.observer = _emberMetalMixin.observer; + _emberMetalCore.default.immediateObserver = _emberMetalMixin._immediateObserver; + _emberMetalCore.default.mixin = _emberMetalMixin.mixin; + _emberMetalCore.default.Mixin = _emberMetalMixin.Mixin; - /** - Accessed as a classname binding to apply the `LinkComponent`'s `activeClass` - CSS `class` to the element when the link is active. - A `LinkComponent` is considered active when its `currentWhen` property is `true` - or the application's current route is the route the `LinkComponent` would trigger - transitions into. - The `currentWhen` property can match against multiple routes by separating - route names using the ` ` (space) character. - @property active - @private - */ - active: _emberMetalComputed.computed('attrs.params', '_routing.currentState', function computeLinkComponentActive() { - var currentState = _emberMetalProperty_get.get(this, '_routing.currentState'); - if (!currentState) { - return false; - } + _emberMetalCore.default.bind = _emberMetalBinding.bind; + _emberMetalCore.default.Binding = _emberMetalBinding.Binding; + _emberMetalCore.default.isGlobalPath = _emberMetalBinding.isGlobalPath; - return computeActive(this, currentState); - }), + _emberMetalCore.default.run = _emberMetalRun_loop.default; - willBeActive: _emberMetalComputed.computed('_routing.targetState', function () { - var routing = _emberMetalProperty_get.get(this, '_routing'); - var targetState = _emberMetalProperty_get.get(routing, 'targetState'); - if (_emberMetalProperty_get.get(routing, 'currentState') === targetState) { - return; - } - - return !!computeActive(this, targetState); - }), - - transitioningIn: _emberMetalComputed.computed('active', 'willBeActive', function () { - var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive'); - if (typeof willBeActive === 'undefined') { - return false; - } - - return !_emberMetalProperty_get.get(this, 'active') && willBeActive && 'ember-transitioning-in'; - }), - - transitioningOut: _emberMetalComputed.computed('active', 'willBeActive', function () { - var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive'); - if (typeof willBeActive === 'undefined') { - return false; - } - - return _emberMetalProperty_get.get(this, 'active') && !willBeActive && 'ember-transitioning-out'; - }), - - /** - Event handler that invokes the link, activating the associated route. - @private - @method _invoke - @param {Event} event - @private - */ - _invoke: function (event) { - if (!_emberViewsSystemUtils.isSimpleClick(event)) { - return true; - } - - if (this.attrs.preventDefault !== false) { - var targetAttribute = this.attrs.target; - if (!targetAttribute || targetAttribute === '_self') { - event.preventDefault(); - } - } - - if (this.attrs.bubbles === false) { - event.stopPropagation(); - } - - if (_emberMetalProperty_get.get(this, '_isDisabled')) { - return false; - } - - if (_emberMetalProperty_get.get(this, 'loading')) { - _emberMetalCore.default.Logger.warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.'); - return false; - } - - var targetAttribute2 = this.attrs.target; - if (targetAttribute2 && targetAttribute2 !== '_self') { - return false; - } - - var routing = _emberMetalProperty_get.get(this, '_routing'); - var targetRouteName = this._handleOnlyQueryParamsSupplied(_emberMetalProperty_get.get(this, 'targetRouteName')); - var models = _emberMetalProperty_get.get(this, 'models'); - var queryParamValues = _emberMetalProperty_get.get(this, 'queryParams.values'); - var shouldReplace = _emberMetalProperty_get.get(this, 'attrs.replace'); - - routing.transitionTo(targetRouteName, models, queryParamValues, shouldReplace); - }, - - queryParams: null, - - /** - Sets the element's `href` attribute to the url for - the `LinkComponent`'s targeted route. - If the `LinkComponent`'s `tagName` is changed to a value other - than `a`, this property will be ignored. - @property href - @private - */ - href: _emberMetalComputed.computed('models', 'targetRouteName', '_routing.currentState', function computeLinkComponentHref() { - - if (_emberMetalProperty_get.get(this, 'tagName') !== 'a') { - return; - } - - var targetRouteName = _emberMetalProperty_get.get(this, 'targetRouteName'); - var models = _emberMetalProperty_get.get(this, 'models'); - - if (_emberMetalProperty_get.get(this, 'loading')) { - return _emberMetalProperty_get.get(this, 'loadingHref'); - } - - targetRouteName = this._handleOnlyQueryParamsSupplied(targetRouteName); - - var routing = _emberMetalProperty_get.get(this, '_routing'); - var queryParams = _emberMetalProperty_get.get(this, 'queryParams.values'); - return routing.generateURL(targetRouteName, models, queryParams); - }), - - loading: _emberMetalComputed.computed('models', 'targetRouteName', function () { - var targetRouteName = _emberMetalProperty_get.get(this, 'targetRouteName'); - var models = _emberMetalProperty_get.get(this, 'models'); - - if (!modelsAreLoaded(models) || targetRouteName == null) { - return _emberMetalProperty_get.get(this, 'loadingClass'); - } - }), - - _handleOnlyQueryParamsSupplied: function (route) { - var params = this.attrs.params.slice(); - var lastParam = params[params.length - 1]; - if (lastParam && lastParam.isQueryParams) { - params.pop(); - } - var onlyQueryParamsSupplied = this.attrs.hasBlock ? params.length === 0 : params.length === 1; - if (onlyQueryParamsSupplied) { - var appController = this.container.lookup('controller:application'); - if (appController) { - return _emberMetalProperty_get.get(appController, 'currentRouteName'); - } - } - return route; - }, - - /** - The default href value to use while a link-to is loading. - Only applies when tagName is 'a' - @property loadingHref - @type String - @default # - @private - */ - loadingHref: '#', - - willRender: function () { - var queryParams; - - var attrs = this.attrs; - - // Do not mutate params in place - var params = attrs.params.slice(); - - _emberMetalCore.default.assert('You must provide one or more parameters to the link-to helper.', params.length); - - var lastParam = params[params.length - 1]; - - if (lastParam && lastParam.isQueryParams) { - queryParams = params.pop(); - } else { - queryParams = {}; - } - - if (attrs.disabledClass) { - this.set('disabledClass', attrs.disabledClass); - } - - if (attrs.activeClass) { - this.set('activeClass', attrs.activeClass); - } - - if (attrs.disabledWhen) { - this.set('disabled', attrs.disabledWhen); - } - - // TODO: Change to built-in hasBlock once it's available - if (!attrs.hasBlock) { - this.set('linkTitle', params.shift()); - } - - if (attrs.loadingClass) { - _emberMetalProperty_set.set(this, 'loadingClass', attrs.loadingClass); - } - - for (var i = 0; i < params.length; i++) { - var value = params[i]; - - while (_emberRuntimeMixinsController.default.detect(value)) { - _emberMetalCore.default.deprecate('Providing `{{link-to}}` with a param that is wrapped in a controller is deprecated. ' + 'Please update `' + attrs.view + '` to use `{{link-to "post" someController.model}}` instead.', false, { id: 'ember-routing-views.controller-wrapped-param', until: '3.0.0' }); - value = value.get('model'); - } - - params[i] = value; - } - - var targetRouteName = undefined; - var models = []; - targetRouteName = this._handleOnlyQueryParamsSupplied(params[0]); - - for (var i = 1; i < params.length; i++) { - models.push(params[i]); - } - - var resolvedQueryParams = getResolvedQueryParams(queryParams, targetRouteName); - - this.set('targetRouteName', targetRouteName); - this.set('models', models); - this.set('queryParams', queryParams); - this.set('resolvedQueryParams', resolvedQueryParams); - } - }); - - LinkComponent.toString = function () { - return 'LinkComponent'; - }; - - function computeActive(view, routerState) { - if (_emberMetalProperty_get.get(view, 'loading')) { - return false; - } - - var currentWhen = _emberMetalProperty_get.get(view, 'current-when'); - var isCurrentWhenSpecified = !!currentWhen; - currentWhen = currentWhen || _emberMetalProperty_get.get(view, 'targetRouteName'); - currentWhen = currentWhen.split(' '); - for (var i = 0, len = currentWhen.length; i < len; i++) { - if (isActiveForRoute(view, currentWhen[i], isCurrentWhenSpecified, routerState)) { - return _emberMetalProperty_get.get(view, 'activeClass'); - } - } - - return false; - } - - function modelsAreLoaded(models) { - for (var i = 0, l = models.length; i < l; i++) { - if (models[i] == null) { - return false; - } - } - - return true; - } - - function isActiveForRoute(view, routeName, isCurrentWhenSpecified, routerState) { - var service = _emberMetalProperty_get.get(view, '_routing'); - return service.isActiveForRoute(_emberMetalProperty_get.get(view, 'models'), _emberMetalProperty_get.get(view, 'resolvedQueryParams'), routeName, routerState, isCurrentWhenSpecified); - } - - function getResolvedQueryParams(queryParamsObject, targetRouteName) { - var resolvedQueryParams = {}; - - if (!queryParamsObject) { - return resolvedQueryParams; - } - - var values = queryParamsObject.values; - for (var key in values) { - if (!values.hasOwnProperty(key)) { - continue; - } - resolvedQueryParams[key] = values[key]; - } - - return resolvedQueryParams; - } - - exports.default = LinkComponent; -}); -// FEATURES, Logger, assert -// creates inject.service -enifed('ember-routing-views/views/outlet', ['exports', 'ember-views/views/view', 'ember-htmlbars/templates/top-level-view'], function (exports, _emberViewsViewsView, _emberHtmlbarsTemplatesTopLevelView) { /** - @module ember - @submodule ember-routing-views + @class Backburner + @for Ember + @private */ + _emberMetalCore.default.Backburner = _backburner.default; + // this is the new go forward, once Ember Data updates to using `_Backburner` we + // can remove the non-underscored version. + _emberMetalCore.default._Backburner = _backburner.default; - 'use strict'; + _emberMetalCore.default.libraries = new _emberMetalLibraries.default(); + _emberMetalCore.default.libraries.registerCoreLibrary('Ember', _emberMetalCore.default.VERSION); - _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.0.2'; + _emberMetalCore.default.isNone = _emberMetalIs_none.default; + _emberMetalCore.default.isEmpty = _emberMetalIs_empty.default; + _emberMetalCore.default.isBlank = _emberMetalIs_blank.default; + _emberMetalCore.default.isPresent = _emberMetalIs_present.default; - var CoreOutletView = _emberViewsViewsView.default.extend({ - defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default, + _emberMetalCore.default.merge = _emberMetalMerge.default; - init: function () { - this._super(); - this._outlets = []; - }, + _emberMetalCore.default.FEATURES = _emberMetalFeatures.FEATURES; + _emberMetalCore.default.FEATURES.isEnabled = _emberMetalFeatures.default; - setOutletState: function (state) { - this.outletState = { main: state }; - - if (this.env) { - this.env.outletState = this.outletState; - } - - if (this.lastResult) { - this.dirtyOutlets(); - this._outlets = []; - - this.scheduleRevalidate(null, null); - } - }, - - dirtyOutlets: function () { - // Dirty any render nodes that correspond to outlets - for (var i = 0; i < this._outlets.length; i++) { - this._outlets[i].isDirty = true; - } - } - }); - - exports.CoreOutletView = CoreOutletView; - var OutletView = CoreOutletView.extend({ tagName: '' }); - exports.OutletView = OutletView; -}); -enifed('ember-routing', ['exports', 'ember-metal/core', 'ember-routing/ext/run_loop', 'ember-routing/ext/controller', 'ember-routing/location/api', 'ember-routing/location/none_location', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/system/generate_controller', 'ember-routing/system/controller_for', 'ember-routing/system/dsl', 'ember-routing/system/router', 'ember-routing/system/route', 'ember-routing/initializers/routing-service'], function (exports, _emberMetalCore, _emberRoutingExtRun_loop, _emberRoutingExtController, _emberRoutingLocationApi, _emberRoutingLocationNone_location, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingSystemGenerate_controller, _emberRoutingSystemController_for, _emberRoutingSystemDsl, _emberRoutingSystemRouter, _emberRoutingSystemRoute, _emberRoutingInitializersRoutingService) { /** - @module ember - @submodule ember-routing + A function may be assigned to `Ember.onerror` to be called when Ember + internals encounter an error. This is useful for specialized error handling + and reporting code. + + ```javascript + Ember.onerror = function(error) { + Em.$.ajax('/report-error', 'POST', { + stack: error.stack, + otherInformation: 'whatever app state you want to provide' + }); + }; + ``` + + Internally, `Ember.onerror` is used as Backburner's error handler. + + @event onerror + @for Ember + @param {Exception} error the error object + @public */ + _emberMetalCore.default.onerror = null; + // END EXPORTS - 'use strict'; + // do this for side-effects of updating Ember.assert, warn, etc when + // ember-debug is present + // This needs to be called before any deprecateFunc + if (_emberMetalCore.default.__loader.registry['ember-debug']) { + requireModule('ember-debug'); + } - _emberMetalCore.default.Location = _emberRoutingLocationApi.default; - _emberMetalCore.default.AutoLocation = _emberRoutingLocationAuto_location.default; - _emberMetalCore.default.HashLocation = _emberRoutingLocationHash_location.default; - _emberMetalCore.default.HistoryLocation = _emberRoutingLocationHistory_location.default; - _emberMetalCore.default.NoneLocation = _emberRoutingLocationNone_location.default; + _emberMetalCore.default.create = _emberMetalCore.default.deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create); + _emberMetalCore.default.keys = _emberMetalCore.default.deprecateFunc('Ember.keys is deprecated in favor of Object.keys', { id: 'ember-metal.ember.keys', until: '3.0.0' }, Object.keys); - _emberMetalCore.default.controllerFor = _emberRoutingSystemController_for.default; - _emberMetalCore.default.generateControllerFactory = _emberRoutingSystemGenerate_controller.generateControllerFactory; - _emberMetalCore.default.generateController = _emberRoutingSystemGenerate_controller.default; - _emberMetalCore.default.RouterDSL = _emberRoutingSystemDsl.default; - _emberMetalCore.default.Router = _emberRoutingSystemRouter.default; - _emberMetalCore.default.Route = _emberRoutingSystemRoute.default; - exports.default = _emberMetalCore.default; }); - -// ES6TODO: Cleanup modules with side-effects below enifed('ember-routing/ext/controller', ['exports', 'ember-metal/property_get', 'ember-runtime/mixins/controller'], function (exports, _emberMetalProperty_get, _emberRuntimeMixinsController) { 'use strict'; /** @module ember @@ -28356,96 +26487,1764 @@ accum[key] = tmp; } } }); -enifed('ember-runtime', ['exports', 'ember-metal', 'ember-runtime/core', 'ember-runtime/compare', 'ember-runtime/copy', 'ember-runtime/inject', 'ember-runtime/system/namespace', 'ember-runtime/system/object', 'ember-runtime/system/container', 'ember-runtime/system/array_proxy', 'ember-runtime/system/object_proxy', 'ember-runtime/system/core_object', 'ember-runtime/system/native_array', 'ember-runtime/system/string', 'ember-runtime/system/lazy_load', 'ember-runtime/mixins/array', 'ember-runtime/mixins/comparable', 'ember-runtime/mixins/copyable', 'ember-runtime/mixins/enumerable', 'ember-runtime/mixins/freezable', 'ember-runtime/mixins/-proxy', 'ember-runtime/mixins/observable', 'ember-runtime/mixins/action_handler', 'ember-runtime/mixins/mutable_enumerable', 'ember-runtime/mixins/mutable_array', 'ember-runtime/mixins/target_action_support', 'ember-runtime/mixins/evented', 'ember-runtime/mixins/promise_proxy', 'ember-runtime/computed/reduce_computed_macros', 'ember-runtime/controllers/controller', 'ember-runtime/mixins/controller', 'ember-runtime/system/service', 'ember-runtime/ext/rsvp', 'ember-runtime/ext/string', 'ember-runtime/ext/function', 'ember-runtime/utils'], function (exports, _emberMetal, _emberRuntimeCore, _emberRuntimeCompare, _emberRuntimeCopy, _emberRuntimeInject, _emberRuntimeSystemNamespace, _emberRuntimeSystemObject, _emberRuntimeSystemContainer, _emberRuntimeSystemArray_proxy, _emberRuntimeSystemObject_proxy, _emberRuntimeSystemCore_object, _emberRuntimeSystemNative_array, _emberRuntimeSystemString, _emberRuntimeSystemLazy_load, _emberRuntimeMixinsArray, _emberRuntimeMixinsComparable, _emberRuntimeMixinsCopyable, _emberRuntimeMixinsEnumerable, _emberRuntimeMixinsFreezable, _emberRuntimeMixinsProxy, _emberRuntimeMixinsObservable, _emberRuntimeMixinsAction_handler, _emberRuntimeMixinsMutable_enumerable, _emberRuntimeMixinsMutable_array, _emberRuntimeMixinsTarget_action_support, _emberRuntimeMixinsEvented, _emberRuntimeMixinsPromise_proxy, _emberRuntimeComputedReduce_computed_macros, _emberRuntimeControllersController, _emberRuntimeMixinsController, _emberRuntimeSystemService, _emberRuntimeExtRsvp, _emberRuntimeExtString, _emberRuntimeExtFunction, _emberRuntimeUtils) { +enifed('ember-routing-htmlbars/helpers/query-params', ['exports', 'ember-metal/core', 'ember-routing/system/query_params'], function (exports, _emberMetalCore, _emberRoutingSystemQuery_params) { /** @module ember - @submodule ember-runtime + @submodule ember-routing-htmlbars */ - // BEGIN IMPORTS 'use strict'; - // END IMPORTS + exports.queryParamsHelper = queryParamsHelper; - // BEGIN EXPORTS - _emberMetal.default.compare = _emberRuntimeCompare.default; - _emberMetal.default.copy = _emberRuntimeCopy.default; - _emberMetal.default.isEqual = _emberRuntimeCore.isEqual; + /** + This is a helper to be used in conjunction with the link-to helper. + It will supply url query parameters to the target route. + + Example + + ```handlebars + {{#link-to 'posts' (query-params direction="asc")}}Sort{{/link-to}} + ``` + + @method query-params + @for Ember.Templates.helpers + @param {Object} hash takes a hash of query parameters + @return {Object} A `QueryParams` object for `{{link-to}}` + @public + */ - _emberMetal.default.inject = _emberRuntimeInject.default; + function queryParamsHelper(params, hash) { + _emberMetalCore.default.assert('The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName=\'foo\') as opposed to just (query-params \'foo\')', params.length === 0); - _emberMetal.default.Array = _emberRuntimeMixinsArray.default; + return _emberRoutingSystemQuery_params.default.create({ + values: hash + }); + } +}); +// assert +enifed('ember-routing-htmlbars/keywords/action', ['exports', 'ember-metal/features', 'htmlbars-runtime/hooks', 'ember-routing-htmlbars/keywords/closure-action'], function (exports, _emberMetalFeatures, _htmlbarsRuntimeHooks, _emberRoutingHtmlbarsKeywordsClosureAction) { + /** + @module ember + @submodule ember-templates + */ - _emberMetal.default.Comparable = _emberRuntimeMixinsComparable.default; - _emberMetal.default.Copyable = _emberRuntimeMixinsCopyable.default; + 'use strict'; - _emberMetal.default.Freezable = _emberRuntimeMixinsFreezable.Freezable; - _emberMetal.default.FROZEN_ERROR = _emberRuntimeMixinsFreezable.FROZEN_ERROR; + /** + The `{{action}}` helper provides a way to pass triggers for behavior (usually + just a function) between components, and into components from controllers. + + ### Passing functions with the action helper + + There are three contexts an action helper can be used in. The first two + contexts to discuss are attribute context, and Handlebars value context. + + ```handlebars + {{! An example of attribute context }} + <div onclick={{action "save"}}></div> + {{! Examples of Handlebars value context }} + {{input on-input=(action "save")}} + {{yield (action "refreshData") andAnotherParam}} + ``` + + In these contexts, + the helper is called a "closure action" helper. It's behavior is simple: + If passed a function name, read that function off the `actions` property + of the current context. Once that function is read (or if a function was + passed), create a closure over that function and any arguments. + + The resulting value of an action helper used this way is simply a function. + For example with this attribute context example: + + ```handlebars + {{! An example of attribute context }} + <div onclick={{action "save"}}></div> + ``` + + The resulting template render logic would be: + + ```js + var div = document.createElement('div'); + var actionFunction = (function(context){ + return function() { + return context.actions.save.apply(context, arguments); + }; + })(context); + div.onclick = actionFunction; + ``` + + Thus when the div is clicked, the action on that context is called. + Because the `actionFunction` is just a function, closure actions can be + passed between components the still execute in the correct context. + + Here is an example action handler on a component: + + ```js + export default Ember.Component.extend({ + actions: { + save(/* event *\/) { + this.get('model').save(); + } + } + }); + ``` + + Actions are always looked up on the `actions` property of the current context. + This avoids collisions in the naming of common actions, such as `destroy`. + + Two options can be passed to the `action` helper when it is used in this way. + + * `target=someProperty` will look to `someProperty` instead of the current + context for the `actions` hash. This can be useful when targetting a + service for actions. + * `value="target.value"` will read the path `target.value` off the first + argument to the action when it is called and rewrite the first argument + to be that value. This is useful when attaching actions to event listeners. + + ### Invoking an action + + Closure actions curry both their scope and any arguments. When invoked, any + additional arguments are added to the already curried list. + + Actions should be invoked using the [sendAction](/api/classes/Ember.Component.html#method_sendAction) + method. The first argument to `sendAction` is the action to be called, and + additional arguments are passed to the action function. This has interesting + properties combined with currying of arguments. For example: + + ```js + export default Ember.Component.extend({ + actions: { + // Usage {{input on-input=(action (action 'setName' model) value="target.value")}} + setName(model, name) { + model.set('name', name); + } + } + }); + ``` + + The first argument (`model`) was curried over, and the run-time argument (`event`) + becomes a second argument. Action calls be nested this way because each simply + returns a function. Any function can be passed to the `{{action` helper, including + other actions. + + Actions invoked with `sendAction` have the same currying behavior as demonstrated + with `on-input` above. For example: + + ```js + export default Ember.Component.extend({ + actions: { + setName(model, name) { + model.set('name', name); + } + } + }); + ``` + + ```handlebars + {{my-input submit=(action 'setName' model)}} + ``` + + ```js + // app/components/my-component.js + export default Ember.Component.extend({ + click() { + // Note that model is not passed, it was curried in the template + this.sendAction('submit', 'bob'); + } + }); + ``` + + ### Attaching actions to DOM + + The third context the `{{action` helper can be used in we call "element space". + For example: + + ```handlebars + {{! An example of element space }} + <div {{action "save"}}></div> + ``` + + Used this way, the `{{action}}` helper provides a useful shortcut for + registering an HTML element within a template for a single DOM event and + forwarding that interaction to the template's context (controller or component). + + If the context of a template is a controller, actions used this way will + bubble to routes when the controller does not implement the specified action. + Once an action hits a route, it will bubble through the route hierarchy. + + ### Event Propagation + + `{{action` helpers called in element space can control event bubbling. + + Events triggered through the action helper will automatically have + `.preventDefault()` called on them. You do not need to do so in your event + handlers. If you need to allow event propagation (to handle file inputs for + example) you can supply the `preventDefault=false` option to the `{{action}}` helper: + + ```handlebars + <div {{action "sayHello" preventDefault=false}}> + <input type="file" /> + <input type="checkbox" /> + </div> + ``` + + To disable bubbling, pass `bubbles=false` to the helper: + + ```handlebars + <button {{action 'edit' post bubbles=false}}>Edit</button> + ``` + + If you need the default handler to trigger you should either register your + own event handler, or use event methods on your view class. See [Ember.View](/api/classes/Ember.View.html) + 'Responding to Browser Events' for more information. + + ### Specifying DOM event type + + `{{action` helpers called in element space can specify an event type. + + By default the `{{action}}` helper registers for DOM `click` events. You can + supply an `on` option to the helper to specify a different DOM event name: + + ```handlebars + <div {{action "anActionName" on="double-click"}}> + click me + </div> + ``` + + See [Event Names](/api/classes/Ember.View.html#toc_event-names) for a list of + acceptable DOM event names. + + ### Specifying whitelisted modifier keys + + `{{action` helpers called in element space can specify modifier keys. + + By default the `{{action}}` helper will ignore click event with pressed modifier + keys. You can supply an `allowedKeys` option to specify which keys should not be ignored. + + ```handlebars + <div {{action "anActionName" allowedKeys="alt"}}> + click me + </div> + ``` + + This way the `{{action}}` will fire when clicking with the alt key pressed down. + + Alternatively, supply "any" to the `allowedKeys` option to accept any combination of modifier keys. + + ```handlebars + <div {{action "anActionName" allowedKeys="any"}}> + click me with any key pressed + </div> + ``` + + ### Specifying a Target + + A `target` option can be provided to the helper to change + which object will receive the method call. This option must be a path + to an object, accessible in the current context: + + ```handlebars + {{! app/templates/application.hbs }} + <div {{action "anActionName" target=someService}}> + click me + </div> + ``` + + ```javascript + // app/controllers/application.js + export default Ember.Controller.extend({ + someService: Ember.inject.service() + }); + ``` + + @method action + @for Ember.Templates.helpers + @public + */ - _emberMetal.default.MutableEnumerable = _emberRuntimeMixinsMutable_enumerable.default; - _emberMetal.default.MutableArray = _emberRuntimeMixinsMutable_array.default; + exports.default = function (morph, env, scope, params, hash, template, inverse, visitor) { + if (morph) { + _htmlbarsRuntimeHooks.keyword('@element_action', morph, env, scope, params, hash, template, inverse, visitor); + return true; + } - _emberMetal.default.TargetActionSupport = _emberRuntimeMixinsTarget_action_support.default; - _emberMetal.default.Evented = _emberRuntimeMixinsEvented.default; + return _emberRoutingHtmlbarsKeywordsClosureAction.default(morph, env, scope, params, hash, template, inverse, visitor); + }; +}); +enifed('ember-routing-htmlbars/keywords/closure-action', ['exports', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-metal/utils', 'ember-metal/property_get', 'ember-metal/error'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberMetalUtils, _emberMetalProperty_get, _emberMetalError) { + 'use strict'; - _emberMetal.default.PromiseProxyMixin = _emberRuntimeMixinsPromise_proxy.default; + exports.default = closureAction; + var INVOKE = _emberMetalUtils.symbol('INVOKE'); + exports.INVOKE = INVOKE; + var ACTION = _emberMetalUtils.symbol('ACTION'); - _emberMetal.default.Observable = _emberRuntimeMixinsObservable.default; + exports.ACTION = ACTION; - _emberMetal.default.typeOf = _emberRuntimeUtils.typeOf; - _emberMetal.default.isArray = _emberRuntimeUtils.isArray; + function closureAction(morph, env, scope, params, hash, template, inverse, visitor) { + return new _emberMetalStreamsStream.default(function () { + var _this = this; - // ES6TODO: this seems a less than ideal way/place to add properties to Ember.computed - var EmComputed = _emberMetal.default.computed; + params.map(this.addDependency, this); + Object.keys(hash).map(function (item) { + return _this.addDependency(item); + }); - EmComputed.sum = _emberRuntimeComputedReduce_computed_macros.sum; - EmComputed.min = _emberRuntimeComputedReduce_computed_macros.min; - EmComputed.max = _emberRuntimeComputedReduce_computed_macros.max; - EmComputed.map = _emberRuntimeComputedReduce_computed_macros.map; - EmComputed.sort = _emberRuntimeComputedReduce_computed_macros.sort; - EmComputed.setDiff = _emberRuntimeComputedReduce_computed_macros.setDiff; - EmComputed.mapBy = _emberRuntimeComputedReduce_computed_macros.mapBy; - EmComputed.filter = _emberRuntimeComputedReduce_computed_macros.filter; - EmComputed.filterBy = _emberRuntimeComputedReduce_computed_macros.filterBy; - EmComputed.uniq = _emberRuntimeComputedReduce_computed_macros.uniq; - EmComputed.union = _emberRuntimeComputedReduce_computed_macros.union; - EmComputed.intersect = _emberRuntimeComputedReduce_computed_macros.intersect; + var rawAction = params[0]; + var actionArguments = _emberMetalStreamsUtils.readArray(params.slice(1, params.length)); - _emberMetal.default.String = _emberRuntimeSystemString.default; - _emberMetal.default.Object = _emberRuntimeSystemObject.default; - _emberMetal.default.Container = _emberRuntimeSystemContainer.Container; - _emberMetal.default.Registry = _emberRuntimeSystemContainer.Registry; - _emberMetal.default.Namespace = _emberRuntimeSystemNamespace.default; - _emberMetal.default.Enumerable = _emberRuntimeMixinsEnumerable.default; - _emberMetal.default.ArrayProxy = _emberRuntimeSystemArray_proxy.default; - _emberMetal.default.ObjectProxy = _emberRuntimeSystemObject_proxy.default; - _emberMetal.default.ActionHandler = _emberRuntimeMixinsAction_handler.default; - _emberMetal.default.CoreObject = _emberRuntimeSystemCore_object.default; - _emberMetal.default.NativeArray = _emberRuntimeSystemNative_array.default; - // ES6TODO: Currently we must rely on the global from ember-metal/core to avoid circular deps - // Ember.A = A; - _emberMetal.default.onLoad = _emberRuntimeSystemLazy_load.onLoad; - _emberMetal.default.runLoadHooks = _emberRuntimeSystemLazy_load.runLoadHooks; + var target, action, valuePath; + if (rawAction[INVOKE]) { + // on-change={{action (mut name)}} + target = rawAction; + action = rawAction[INVOKE]; + } else { + // on-change={{action setName}} + // element-space actions look to "controller" then target. Here we only + // look to "target". + target = _emberMetalStreamsUtils.read(scope.self); + action = _emberMetalStreamsUtils.read(rawAction); + if (typeof action === 'string') { + var actionName = action; + action = null; + // on-change={{action 'setName'}} + if (hash.target) { + // on-change={{action 'setName' target=alternativeComponent}} + target = _emberMetalStreamsUtils.read(hash.target); + } + if (target.actions) { + action = target.actions[actionName]; + } - _emberMetal.default.Controller = _emberRuntimeControllersController.default; - _emberMetal.default.ControllerMixin = _emberRuntimeMixinsController.default; + if (!action) { + throw new _emberMetalError.default('An action named \'' + actionName + '\' was not found in ' + target + '.'); + } + } + } - _emberMetal.default.Service = _emberRuntimeSystemService.default; + if (hash.value) { + // <button on-keypress={{action (mut name) value="which"}} + // on-keypress is not even an Ember feature yet + valuePath = _emberMetalStreamsUtils.read(hash.value); + } - _emberMetal.default._ProxyMixin = _emberRuntimeMixinsProxy.default; + return createClosureAction(target, action, valuePath, actionArguments); + }); + } - _emberMetal.default.RSVP = _emberRuntimeExtRsvp.default; - // END EXPORTS + function createClosureAction(target, action, valuePath, actionArguments) { + var closureAction; - exports.default = _emberMetal.default; + if (actionArguments.length > 0) { + closureAction = function () { + var args = actionArguments; + if (arguments.length > 0) { + var passedArguments = Array.prototype.slice.apply(arguments); + args = actionArguments.concat(passedArguments); + } + if (valuePath && args.length > 0) { + args[0] = _emberMetalProperty_get.get(args[0], valuePath); + } + return action.apply(target, args); + }; + } else { + closureAction = function () { + var args = arguments; + if (valuePath && args.length > 0) { + args = Array.prototype.slice.apply(args); + args[0] = _emberMetalProperty_get.get(args[0], valuePath); + } + return action.apply(target, args); + }; + } + + closureAction[ACTION] = true; + + return closureAction; + } }); -// just for side effect of extending Ember.RSVP -// just for side effect of extending String.prototype -// just for side effect of extending Function.prototype +enifed('ember-routing-htmlbars/keywords/element-action', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/utils', 'ember-metal/run_loop', 'ember-views/streams/utils', 'ember-views/system/utils', 'ember-views/system/action_manager'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalUtils, _emberMetalRun_loop, _emberViewsStreamsUtils, _emberViewsSystemUtils, _emberViewsSystemAction_manager) { + 'use strict'; + + function assert(message, test) { + // This only exists to prevent defeatureify from error when attempting + // to transform the same source twice (tldr; you can't nest stripped statements) + _emberMetalCore.default.assert(message, test); + } + + exports.default = { + setupState: function (state, env, scope, params, hash) { + var getStream = env.hooks.get; + var read = env.hooks.getValue; + + var actionName = read(params[0]); + + assert('You specified a quoteless path to the {{action}} helper ' + 'which did not resolve to an action name (a string). ' + 'Perhaps you meant to use a quoted actionName? (e.g. {{action \'save\'}}).', typeof actionName === 'string' || typeof actionName === 'function'); + + var actionArgs = []; + for (var i = 1, l = params.length; i < l; i++) { + actionArgs.push(_emberViewsStreamsUtils.readUnwrappedModel(params[i])); + } + + var target; + if (hash.target) { + if (typeof hash.target === 'string') { + target = read(getStream(env, scope, hash.target)); + } else { + target = read(hash.target); + } + } else { + target = read(scope.locals.controller) || read(scope.self); + } + + return { actionName: actionName, actionArgs: actionArgs, target: target }; + }, + + isStable: function (state, env, scope, params, hash) { + return true; + }, + + render: function (node, env, scope, params, hash, template, inverse, visitor) { + var actionId = env.dom.getAttribute(node.element, 'data-ember-action') || _emberMetalUtils.uuid(); + + ActionHelper.registerAction({ + actionId: actionId, + node: node, + eventName: hash.on || 'click', + bubbles: hash.bubbles, + preventDefault: hash.preventDefault, + withKeyCode: hash.withKeyCode, + allowedKeys: hash.allowedKeys + }); + + node.cleanup = function () { + ActionHelper.unregisterAction(actionId); + }; + + env.dom.setAttribute(node.element, 'data-ember-action', actionId); + } + }; + var ActionHelper = {}; + + exports.ActionHelper = ActionHelper; + // registeredActions is re-exported for compatibility with older plugins + // that were using this undocumented API. + ActionHelper.registeredActions = _emberViewsSystemAction_manager.default.registeredActions; + + ActionHelper.registerAction = function (_ref) { + var actionId = _ref.actionId; + var node = _ref.node; + var eventName = _ref.eventName; + var preventDefault = _ref.preventDefault; + var bubbles = _ref.bubbles; + var allowedKeys = _ref.allowedKeys; + + var actions = _emberViewsSystemAction_manager.default.registeredActions[actionId]; + + if (!actions) { + actions = _emberViewsSystemAction_manager.default.registeredActions[actionId] = []; + } + + actions.push({ + eventName: eventName, + handler: function (event) { + if (!isAllowedEvent(event, allowedKeys)) { + return true; + } + + if (preventDefault !== false) { + event.preventDefault(); + } + + if (bubbles === false) { + event.stopPropagation(); + } + + var _node$state = node.state; + var target = _node$state.target; + var actionName = _node$state.actionName; + var actionArgs = _node$state.actionArgs; + + _emberMetalRun_loop.default(function runRegisteredAction() { + if (typeof actionName === 'function') { + actionName.apply(target, actionArgs); + return; + } + + if (target.send) { + target.send.apply(target, [actionName].concat(actionArgs)); + } else { + _emberMetalCore.default.assert('The action \'' + actionName + '\' did not exist on ' + target, typeof target[actionName] === 'function'); + + target[actionName].apply(target, actionArgs); + } + }); + } + }); + + return actionId; + }; + + ActionHelper.unregisterAction = function (actionId) { + delete _emberViewsSystemAction_manager.default.registeredActions[actionId]; + }; + + var MODIFIERS = ['alt', 'shift', 'meta', 'ctrl']; + var POINTER_EVENT_TYPE_REGEX = /^click|mouse|touch/; + + function isAllowedEvent(event, allowedKeys) { + if (typeof allowedKeys === 'undefined') { + if (POINTER_EVENT_TYPE_REGEX.test(event.type)) { + return _emberViewsSystemUtils.isSimpleClick(event); + } else { + allowedKeys = ''; + } + } + + if (allowedKeys.indexOf('any') >= 0) { + return true; + } + + for (var i = 0, l = MODIFIERS.length; i < l; i++) { + if (event[MODIFIERS[i] + 'Key'] && allowedKeys.indexOf(MODIFIERS[i]) === -1) { + return false; + } + } + + return true; + } +}); +// assert +enifed('ember-routing-htmlbars/keywords/link-to', ['exports', 'ember-metal/streams/utils', 'ember-metal/core', 'ember-metal/merge'], function (exports, _emberMetalStreamsUtils, _emberMetalCore, _emberMetalMerge) { + /** + @module ember + @submodule ember-routing-htmlbars + */ + + 'use strict'; + + /** + The `{{link-to}}` helper renders a link to the supplied + `routeName` passing an optionally supplied model to the + route as its `model` context of the route. The block + for `{{link-to}}` becomes the innerHTML of the rendered + element: + + ```handlebars + {{#link-to 'photoGallery'}} + Great Hamster Photos + {{/link-to}} + ``` + + You can also use an inline form of `{{link-to}}` helper by + passing the link text as the first argument + to the helper: + + ```handlebars + {{link-to 'Great Hamster Photos' 'photoGallery'}} + ``` + + Both will result in: + + ```html + <a href="/hamster-photos"> + Great Hamster Photos + </a> + ``` + + ### Supplying a tagName + By default `{{link-to}}` renders an `<a>` element. This can + be overridden for a single use of `{{link-to}}` by supplying + a `tagName` option: + + ```handlebars + {{#link-to 'photoGallery' tagName="li"}} + Great Hamster Photos + {{/link-to}} + ``` + + ```html + <li> + Great Hamster Photos + </li> + ``` + + To override this option for your entire application, see + "Overriding Application-wide Defaults". + + ### Disabling the `link-to` helper + By default `{{link-to}}` is enabled. + any passed value to `disabled` helper property will disable the `link-to` helper. + + static use: the `disabled` option: + + ```handlebars + {{#link-to 'photoGallery' disabled=true}} + Great Hamster Photos + {{/link-to}} + ``` + + dynamic use: the `disabledWhen` option: + + ```handlebars + {{#link-to 'photoGallery' disabledWhen=controller.someProperty}} + Great Hamster Photos + {{/link-to}} + ``` + + any passed value to `disabled` will disable it except `undefined`. + to ensure that only `true` disable the `link-to` helper you can + override the global behaviour of `Ember.LinkComponent`. + + ```javascript + Ember.LinkComponent.reopen({ + disabled: Ember.computed(function(key, value) { + if (value !== undefined) { + this.set('_isDisabled', value === true); + } + return value === true ? get(this, 'disabledClass') : false; + }) + }); + ``` + + see "Overriding Application-wide Defaults" for more. + + ### Handling `href` + `{{link-to}}` will use your application's Router to + fill the element's `href` property with a url that + matches the path to the supplied `routeName` for your + router's configured `Location` scheme, which defaults + to Ember.HashLocation. + + ### Handling current route + `{{link-to}}` will apply a CSS class name of 'active' + when the application's current route matches + the supplied routeName. For example, if the application's + current route is 'photoGallery.recent' the following + use of `{{link-to}}`: + + ```handlebars + {{#link-to 'photoGallery.recent'}} + Great Hamster Photos + {{/link-to}} + ``` + + will result in + + ```html + <a href="/hamster-photos/this-week" class="active"> + Great Hamster Photos + </a> + ``` + + The CSS class name used for active classes can be customized + for a single use of `{{link-to}}` by passing an `activeClass` + option: + + ```handlebars + {{#link-to 'photoGallery.recent' activeClass="current-url"}} + Great Hamster Photos + {{/link-to}} + ``` + + ```html + <a href="/hamster-photos/this-week" class="current-url"> + Great Hamster Photos + </a> + ``` + + To override this option for your entire application, see + "Overriding Application-wide Defaults". + + ### Keeping a link active for other routes + + If you need a link to be 'active' even when it doesn't match + the current route, you can use the the `current-when` + argument. + + ```handlebars + {{#link-to 'photoGallery' current-when='photos'}} + Photo Gallery + {{/link-to}} + ``` + + This may be helpful for keeping links active for: + + * non-nested routes that are logically related + * some secondary menu approaches + * 'top navigation' with 'sub navigation' scenarios + + A link will be active if `current-when` is `true` or the current + route is the route this link would transition to. + + To match multiple routes 'space-separate' the routes: + + ```handlebars + {{#link-to 'gallery' current-when='photos drawings paintings'}} + Art Gallery + {{/link-to}} + ``` + + ### Supplying a model + An optional model argument can be used for routes whose + paths contain dynamic segments. This argument will become + the model context of the linked route: + + ```javascript + App.Router.map(function() { + this.route("photoGallery", {path: "hamster-photos/:photo_id"}); + }); + ``` + + ```handlebars + {{#link-to 'photoGallery' aPhoto}} + {{aPhoto.title}} + {{/link-to}} + ``` + + ```html + <a href="/hamster-photos/42"> + Tomster + </a> + ``` + + ### Supplying multiple models + For deep-linking to route paths that contain multiple + dynamic segments, multiple model arguments can be used. + As the router transitions through the route path, each + supplied model argument will become the context for the + route with the dynamic segments: + + ```javascript + App.Router.map(function() { + this.route("photoGallery", { path: "hamster-photos/:photo_id" }, function() { + this.route("comment", {path: "comments/:comment_id"}); + }); + }); + ``` + This argument will become the model context of the linked route: + + ```handlebars + {{#link-to 'photoGallery.comment' aPhoto comment}} + {{comment.body}} + {{/link-to}} + ``` + + ```html + <a href="/hamster-photos/42/comments/718"> + A+++ would snuggle again. + </a> + ``` + + ### Supplying an explicit dynamic segment value + If you don't have a model object available to pass to `{{link-to}}`, + an optional string or integer argument can be passed for routes whose + paths contain dynamic segments. This argument will become the value + of the dynamic segment: + + ```javascript + App.Router.map(function() { + this.route("photoGallery", { path: "hamster-photos/:photo_id" }); + }); + ``` + + ```handlebars + {{#link-to 'photoGallery' aPhotoId}} + {{aPhoto.title}} + {{/link-to}} + ``` + + ```html + <a href="/hamster-photos/42"> + Tomster + </a> + ``` + + When transitioning into the linked route, the `model` hook will + be triggered with parameters including this passed identifier. + + ### Allowing Default Action + + By default the `{{link-to}}` helper prevents the default browser action + by calling `preventDefault()` as this sort of action bubbling is normally + handled internally and we do not want to take the browser to a new URL (for + example). + + If you need to override this behavior specify `preventDefault=false` in + your template: + + ```handlebars + {{#link-to 'photoGallery' aPhotoId preventDefault=false}} + {{aPhotoId.title}} + {{/link-to}} + ``` + + ### Overriding attributes + You can override any given property of the Ember.LinkComponent + that is generated by the `{{link-to}}` helper by passing + key/value pairs, like so: + + ```handlebars + {{#link-to aPhoto tagName='li' title='Following this link will change your life' classNames='pic sweet'}} + Uh-mazing! + {{/link-to}} + ``` + + See [Ember.LinkComponent](/api/classes/Ember.LinkComponent.html) for a + complete list of overrideable properties. Be sure to also + check out inherited properties of `LinkComponent`. + + ### Overriding Application-wide Defaults + ``{{link-to}}`` creates an instance of Ember.LinkComponent + for rendering. To override options for your entire + application, reopen Ember.LinkComponent and supply the + desired values: + + ``` javascript + Ember.LinkComponent.reopen({ + activeClass: "is-active", + tagName: 'li' + }) + ``` + + It is also possible to override the default event in + this manner: + + ``` javascript + Ember.LinkComponent.reopen({ + eventName: 'customEventName' + }); + ``` + + @method link-to + @for Ember.Templates.helpers + @param {String} routeName + @param {Object} [context]* + @param [options] {Object} Handlebars key/value pairs of options, you can override any property of Ember.LinkComponent + @return {String} HTML string + @see {Ember.LinkComponent} + @public + */ + exports.default = { + link: function (state, params, hash) { + _emberMetalCore.default.assert('You must provide one or more parameters to the link-to helper.', params.length); + }, + + render: function (morph, env, scope, params, hash, template, inverse, visitor) { + var attrs = _emberMetalMerge.default({}, hash); + + // TODO: Rewrite link-to to use arbitrary length positional params. + attrs.params = _emberMetalStreamsUtils.readArray(params); + + // Used for deprecations (to tell the user what view the deprecated syntax + // was used in). + attrs.view = env.view; + + // TODO: Remove once `hasBlock` is working again + attrs.hasBlock = !!template; + + attrs.escaped = !morph.parseTextAsHTML; + + env.hooks.component(morph, env, scope, '-link-to', params, attrs, { default: template }, visitor); + }, + + rerender: function (morph, env, scope, params, hash, template, inverse, visitor) { + this.render(morph, env, scope, params, hash, template, inverse, visitor); + } + }; +}); +// assert +enifed('ember-routing-htmlbars/keywords/render', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/error', 'ember-metal/streams/utils', 'ember-runtime/system/string', 'ember-routing/system/generate_controller', 'ember-htmlbars/node-managers/view-node-manager'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalError, _emberMetalStreamsUtils, _emberRuntimeSystemString, _emberRoutingSystemGenerate_controller, _emberHtmlbarsNodeManagersViewNodeManager) { + /** + @module ember + @submodule ember-templates + */ + + 'use strict'; + + /** + Calling ``{{render}}`` from within a template will insert another + template that matches the provided name. The inserted template will + access its properties on its own controller (rather than the controller + of the parent template). + If a view class with the same name exists, the view class also will be used. + Note: A given controller may only be used *once* in your app in this manner. + A singleton instance of the controller will be created for you. + Example: + + ```javascript + App.NavigationController = Ember.Controller.extend({ + who: "world" + }); + ``` + + ```handlebars + <!-- navigation.hbs --> + Hello, {{who}}. + ``` + + ```handlebars + <!-- application.hbs --> + <h1>My great app</h1> + {{render "navigation"}} + ``` + + ```html + <h1>My great app</h1> + <div class='ember-view'> + Hello, world. + </div> + ``` + + Optionally you may provide a second argument: a property path + that will be bound to the `model` property of the controller. + If a `model` property path is specified, then a new instance of the + controller will be created and `{{render}}` can be used multiple times + with the same name. + + For example if you had this `author` template. + + ```handlebars + <div class="author"> + Written by {{firstName}} {{lastName}}. + Total Posts: {{postCount}} + </div> + ``` + + You could render it inside the `post` template using the `render` helper. + + ```handlebars + <div class="post"> + <h1>{{title}}</h1> + <div>{{body}}</div> + {{render "author" author}} + </div> + ``` + + @method render + @for Ember.Templates.helpers + @param {String} name + @param {Object?} context + @param {Hash} options + @return {String} HTML string + @public + */ + exports.default = { + willRender: function (renderNode, env) { + if (env.view.ownerView._outlets) { + // We make sure we will get dirtied when outlet state changes. + env.view.ownerView._outlets.push(renderNode); + } + }, + + setupState: function (prevState, env, scope, params, hash) { + var name = params[0]; + + _emberMetalCore.default.assert('The first argument of {{render}} must be quoted, e.g. {{render "sidebar"}}.', typeof name === 'string'); + + return { + parentView: env.view, + manager: prevState.manager, + controller: prevState.controller, + childOutletState: childOutletState(name, env) + }; + }, + + childEnv: function (state, env) { + return env.childWithOutletState(state.childOutletState); + }, + + isStable: function (lastState, nextState) { + return isStable(lastState.childOutletState, nextState.childOutletState); + }, + + isEmpty: function (state) { + return false; + }, + + render: function (node, env, scope, params, hash, template, inverse, visitor) { + var state = node.state; + var name = params[0]; + var context = params[1]; + + var container = env.container; + + // The render keyword presumes it can work without a router. This is really + // only to satisfy the test: + // + // {{view}} should not override class bindings defined on a child view" + // + var router = container.lookup('router:main'); + + _emberMetalCore.default.assert('The second argument of {{render}} must be a path, e.g. {{render "post" post}}.', params.length < 2 || _emberMetalStreamsUtils.isStream(params[1])); + + if (params.length === 1) { + // use the singleton controller + _emberMetalCore.default.assert('You can only use the {{render}} helper once without a model object as ' + 'its second argument, as in {{render "post" post}}.', !router || !router._lookupActiveComponentNode(name)); + } else if (params.length !== 2) { + throw new _emberMetalError.default('You must pass a templateName to render'); + } + + var templateName = 'template:' + name; + _emberMetalCore.default.assert('You used `{{render \'' + name + '\'}}`, but \'' + name + '\' can not be ' + 'found as either a template or a view.', container._registry.has('view:' + name) || container._registry.has(templateName) || !!template); + + var view = container.lookup('view:' + name); + if (!view) { + view = container.lookup('view:default'); + } + var viewHasTemplateSpecified = view && !!_emberMetalProperty_get.get(view, 'template'); + if (!template && !viewHasTemplateSpecified) { + template = container.lookup(templateName); + } + + if (view) { + view.ownerView = env.view.ownerView; + } + + // provide controller override + var controllerName; + var controllerFullName; + + if (hash.controller) { + controllerName = hash.controller; + controllerFullName = 'controller:' + controllerName; + delete hash.controller; + + _emberMetalCore.default.assert('The controller name you supplied \'' + controllerName + '\' ' + 'did not resolve to a controller.', container._registry.has(controllerFullName)); + } else { + controllerName = name; + controllerFullName = 'controller:' + controllerName; + } + + var parentController = _emberMetalStreamsUtils.read(scope.locals.controller); + var controller; + + // choose name + if (params.length > 1) { + var factory = container.lookupFactory(controllerFullName) || _emberRoutingSystemGenerate_controller.generateControllerFactory(container, controllerName); + + controller = factory.create({ + model: _emberMetalStreamsUtils.read(context), + parentController: parentController, + target: parentController + }); + + node.addDestruction(controller); + } else { + controller = container.lookup(controllerFullName) || _emberRoutingSystemGenerate_controller.default(container, controllerName); + + controller.setProperties({ + target: parentController, + parentController: parentController + }); + } + + if (view) { + view.set('controller', controller); + } + state.controller = controller; + + hash.viewName = _emberRuntimeSystemString.camelize(name); + + // var state = node.state; + // var parentView = scope.view; + if (template && template.raw) { + template = template.raw; + } + + var options = { + layout: null, + self: controller + }; + + if (view) { + options.component = view; + } + + var nodeManager = _emberHtmlbarsNodeManagersViewNodeManager.default.create(node, env, hash, options, state.parentView, null, null, template); + state.manager = nodeManager; + + if (router && params.length === 1) { + router._connectActiveComponentNode(name, nodeManager); + } + + nodeManager.render(env, hash, visitor); + }, + + rerender: function (node, env, scope, params, hash, template, inverse, visitor) { + var model = _emberMetalStreamsUtils.read(params[1]); + node.state.controller.set('model', model); + } + }; + + function childOutletState(name, env) { + var topLevel = env.view.ownerView; + if (!topLevel || !topLevel.outletState) { + return; + } + + var outletState = topLevel.outletState; + if (!outletState.main) { + return; + } + + var selectedOutletState = outletState.main.outlets['__ember_orphans__']; + if (!selectedOutletState) { + return; + } + var matched = selectedOutletState.outlets[name]; + if (matched) { + var childState = Object.create(null); + childState[matched.render.outlet] = matched; + matched.wasUsed = true; + return childState; + } + } + + function isStable(a, b) { + if (!a && !b) { + return true; + } + if (!a || !b) { + return false; + } + for (var outletName in a) { + if (!isStableOutlet(a[outletName], b[outletName])) { + return false; + } + } + return true; + } + + function isStableOutlet(a, b) { + if (!a && !b) { + return true; + } + if (!a || !b) { + return false; + } + a = a.render; + b = b.render; + for (var key in a) { + if (a.hasOwnProperty(key)) { + // name is only here for logging & debugging. If two different + // names result in otherwise identical states, they're still + // identical. + if (a[key] !== b[key] && key !== 'name') { + return false; + } + } + } + return true; + } +}); +// assert +enifed('ember-routing-htmlbars', ['exports', 'ember-metal/core', 'ember-htmlbars/helpers', 'ember-htmlbars/keywords', 'ember-routing-htmlbars/helpers/query-params', 'ember-routing-htmlbars/keywords/action', 'ember-routing-htmlbars/keywords/element-action', 'ember-routing-htmlbars/keywords/link-to', 'ember-routing-htmlbars/keywords/render'], function (exports, _emberMetalCore, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberRoutingHtmlbarsHelpersQueryParams, _emberRoutingHtmlbarsKeywordsAction, _emberRoutingHtmlbarsKeywordsElementAction, _emberRoutingHtmlbarsKeywordsLinkTo, _emberRoutingHtmlbarsKeywordsRender) { + /** + @module ember + @submodule ember-routing-htmlbars + */ + + 'use strict'; + + _emberHtmlbarsHelpers.registerHelper('query-params', _emberRoutingHtmlbarsHelpersQueryParams.queryParamsHelper); + + _emberHtmlbarsKeywords.registerKeyword('action', _emberRoutingHtmlbarsKeywordsAction.default); + _emberHtmlbarsKeywords.registerKeyword('@element_action', _emberRoutingHtmlbarsKeywordsElementAction.default); + _emberHtmlbarsKeywords.registerKeyword('link-to', _emberRoutingHtmlbarsKeywordsLinkTo.default); + _emberHtmlbarsKeywords.registerKeyword('render', _emberRoutingHtmlbarsKeywordsRender.default); + + exports.default = _emberMetalCore.default; +}); +enifed('ember-routing-views/views/link', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/computed', 'ember-metal/computed_macros', 'ember-views/system/utils', 'ember-views/views/component', 'ember-runtime/inject', 'ember-runtime/system/service', 'ember-runtime/mixins/controller', 'ember-htmlbars/templates/link-to'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalComputed_macros, _emberViewsSystemUtils, _emberViewsViewsComponent, _emberRuntimeInject, _emberRuntimeSystemService, _emberRuntimeMixinsController, _emberHtmlbarsTemplatesLinkTo) { + /** + @module ember + @submodule ember-routing-views + */ + + 'use strict'; + + _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.0.3'; + + var linkComponentClassNameBindings = ['active', 'loading', 'disabled']; + + linkComponentClassNameBindings = ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut']; + + /** + `Ember.LinkComponent` renders an element whose `click` event triggers a + transition of the application's instance of `Ember.Router` to + a supplied route by name. + + Instances of `LinkComponent` will most likely be created through + the `link-to` Handlebars helper, but properties of this class + can be overridden to customize application-wide behavior. + + @class LinkComponent + @namespace Ember + @extends Ember.Component + @see {Handlebars.helpers.link-to} + @private + **/ + var LinkComponent = _emberViewsViewsComponent.default.extend({ + defaultLayout: _emberHtmlbarsTemplatesLinkTo.default, + + tagName: 'a', + + /** + @deprecated Use current-when instead. + @property currentWhen + @private + */ + currentWhen: _emberMetalComputed_macros.deprecatingAlias('current-when', { id: 'ember-routing-view.deprecated-current-when', until: '3.0.0' }), + + /** + Used to determine when this LinkComponent is active. + @property currentWhen + @public + */ + 'current-when': null, + + /** + Sets the `title` attribute of the `LinkComponent`'s HTML element. + @property title + @default null + @public + **/ + title: null, + + /** + Sets the `rel` attribute of the `LinkComponent`'s HTML element. + @property rel + @default null + @public + **/ + rel: null, + + /** + Sets the `tabindex` attribute of the `LinkComponent`'s HTML element. + @property tabindex + @default null + @public + **/ + tabindex: null, + + /** + Sets the `target` attribute of the `LinkComponent`'s HTML element. + @since 1.8.0 + @property target + @default null + @public + **/ + target: null, + + /** + The CSS class to apply to `LinkComponent`'s element when its `active` + property is `true`. + @property activeClass + @type String + @default active + @private + **/ + activeClass: 'active', + + /** + The CSS class to apply to `LinkComponent`'s element when its `loading` + property is `true`. + @property loadingClass + @type String + @default loading + @private + **/ + loadingClass: 'loading', + + /** + The CSS class to apply to a `LinkComponent`'s element when its `disabled` + property is `true`. + @property disabledClass + @type String + @default disabled + @private + **/ + disabledClass: 'disabled', + _isDisabled: false, + + /** + Determines whether the `LinkComponent` will trigger routing via + the `replaceWith` routing strategy. + @property replace + @type Boolean + @default false + @public + **/ + replace: false, + + /** + By default the `{{link-to}}` helper will bind to the `href` and + `title` attributes. It's discouraged that you override these defaults, + however you can push onto the array if needed. + @property attributeBindings + @type Array | String + @default ['title', 'rel', 'tabindex', 'target'] + @public + */ + attributeBindings: ['href', 'title', 'rel', 'tabindex', 'target'], + + /** + By default the `{{link-to}}` helper will bind to the `active`, `loading`, and + `disabled` classes. It is discouraged to override these directly. + @property classNameBindings + @type Array + @default ['active', 'loading', 'disabled'] + @public + */ + classNameBindings: linkComponentClassNameBindings, + + /** + By default the `{{link-to}}` helper responds to the `click` event. You + can override this globally by setting this property to your custom + event name. + This is particularly useful on mobile when one wants to avoid the 300ms + click delay using some sort of custom `tap` event. + @property eventName + @type String + @default click + @private + */ + eventName: 'click', + + // this is doc'ed here so it shows up in the events + // section of the API documentation, which is where + // people will likely go looking for it. + /** + Triggers the `LinkComponent`'s routing behavior. If + `eventName` is changed to a value other than `click` + the routing behavior will trigger on that custom event + instead. + @event click + @private + */ + + /** + An overridable method called when LinkComponent objects are instantiated. + Example: + ```javascript + App.MyLinkComponent = Ember.LinkComponent.extend({ + init: function() { + this._super.apply(this, arguments); + Ember.Logger.log('Event is ' + this.get('eventName')); + } + }); + ``` + NOTE: If you do override `init` for a framework class like `Ember.View`, + be sure to call `this._super.apply(this, arguments)` in your + `init` declaration! If you don't, Ember may not have an opportunity to + do important setup work, and you'll see strange behavior in your + application. + @method init + @private + */ + init: function () { + this._super.apply(this, arguments); + + // Map desired event name to invoke function + var eventName = _emberMetalProperty_get.get(this, 'eventName'); + this.on(eventName, this, this._invoke); + }, + + _routing: _emberRuntimeInject.default.service('-routing'), + + /** + Accessed as a classname binding to apply the `LinkComponent`'s `disabledClass` + CSS `class` to the element when the link is disabled. + When `true` interactions with the element will not trigger route changes. + @property disabled + @private + */ + disabled: _emberMetalComputed.computed({ + get: function (key, value) { + return false; + }, + set: function (key, value) { + if (value !== undefined) { + this.set('_isDisabled', value); + } + + return value ? _emberMetalProperty_get.get(this, 'disabledClass') : false; + } + }), + + /** + Accessed as a classname binding to apply the `LinkComponent`'s `activeClass` + CSS `class` to the element when the link is active. + A `LinkComponent` is considered active when its `currentWhen` property is `true` + or the application's current route is the route the `LinkComponent` would trigger + transitions into. + The `currentWhen` property can match against multiple routes by separating + route names using the ` ` (space) character. + @property active + @private + */ + active: _emberMetalComputed.computed('attrs.params', '_routing.currentState', function computeLinkComponentActive() { + var currentState = _emberMetalProperty_get.get(this, '_routing.currentState'); + if (!currentState) { + return false; + } + + return computeActive(this, currentState); + }), + + willBeActive: _emberMetalComputed.computed('_routing.targetState', function () { + var routing = _emberMetalProperty_get.get(this, '_routing'); + var targetState = _emberMetalProperty_get.get(routing, 'targetState'); + if (_emberMetalProperty_get.get(routing, 'currentState') === targetState) { + return; + } + + return !!computeActive(this, targetState); + }), + + transitioningIn: _emberMetalComputed.computed('active', 'willBeActive', function () { + var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive'); + if (typeof willBeActive === 'undefined') { + return false; + } + + return !_emberMetalProperty_get.get(this, 'active') && willBeActive && 'ember-transitioning-in'; + }), + + transitioningOut: _emberMetalComputed.computed('active', 'willBeActive', function () { + var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive'); + if (typeof willBeActive === 'undefined') { + return false; + } + + return _emberMetalProperty_get.get(this, 'active') && !willBeActive && 'ember-transitioning-out'; + }), + + /** + Event handler that invokes the link, activating the associated route. + @private + @method _invoke + @param {Event} event + @private + */ + _invoke: function (event) { + if (!_emberViewsSystemUtils.isSimpleClick(event)) { + return true; + } + + if (this.attrs.preventDefault !== false) { + var targetAttribute = this.attrs.target; + if (!targetAttribute || targetAttribute === '_self') { + event.preventDefault(); + } + } + + if (this.attrs.bubbles === false) { + event.stopPropagation(); + } + + if (_emberMetalProperty_get.get(this, '_isDisabled')) { + return false; + } + + if (_emberMetalProperty_get.get(this, 'loading')) { + _emberMetalCore.default.Logger.warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.'); + return false; + } + + var targetAttribute2 = this.attrs.target; + if (targetAttribute2 && targetAttribute2 !== '_self') { + return false; + } + + var routing = _emberMetalProperty_get.get(this, '_routing'); + var targetRouteName = this._handleOnlyQueryParamsSupplied(_emberMetalProperty_get.get(this, 'targetRouteName')); + var models = _emberMetalProperty_get.get(this, 'models'); + var queryParamValues = _emberMetalProperty_get.get(this, 'queryParams.values'); + var shouldReplace = _emberMetalProperty_get.get(this, 'attrs.replace'); + + routing.transitionTo(targetRouteName, models, queryParamValues, shouldReplace); + }, + + queryParams: null, + + /** + Sets the element's `href` attribute to the url for + the `LinkComponent`'s targeted route. + If the `LinkComponent`'s `tagName` is changed to a value other + than `a`, this property will be ignored. + @property href + @private + */ + href: _emberMetalComputed.computed('models', 'targetRouteName', '_routing.currentState', function computeLinkComponentHref() { + + if (_emberMetalProperty_get.get(this, 'tagName') !== 'a') { + return; + } + + var targetRouteName = _emberMetalProperty_get.get(this, 'targetRouteName'); + var models = _emberMetalProperty_get.get(this, 'models'); + + if (_emberMetalProperty_get.get(this, 'loading')) { + return _emberMetalProperty_get.get(this, 'loadingHref'); + } + + targetRouteName = this._handleOnlyQueryParamsSupplied(targetRouteName); + + var routing = _emberMetalProperty_get.get(this, '_routing'); + var queryParams = _emberMetalProperty_get.get(this, 'queryParams.values'); + return routing.generateURL(targetRouteName, models, queryParams); + }), + + loading: _emberMetalComputed.computed('models', 'targetRouteName', function () { + var targetRouteName = _emberMetalProperty_get.get(this, 'targetRouteName'); + var models = _emberMetalProperty_get.get(this, 'models'); + + if (!modelsAreLoaded(models) || targetRouteName == null) { + return _emberMetalProperty_get.get(this, 'loadingClass'); + } + }), + + _handleOnlyQueryParamsSupplied: function (route) { + var params = this.attrs.params.slice(); + var lastParam = params[params.length - 1]; + if (lastParam && lastParam.isQueryParams) { + params.pop(); + } + var onlyQueryParamsSupplied = this.attrs.hasBlock ? params.length === 0 : params.length === 1; + if (onlyQueryParamsSupplied) { + var appController = this.container.lookup('controller:application'); + if (appController) { + return _emberMetalProperty_get.get(appController, 'currentRouteName'); + } + } + return route; + }, + + /** + The default href value to use while a link-to is loading. + Only applies when tagName is 'a' + @property loadingHref + @type String + @default # + @private + */ + loadingHref: '#', + + willRender: function () { + var queryParams; + + var attrs = this.attrs; + + // Do not mutate params in place + var params = attrs.params.slice(); + + _emberMetalCore.default.assert('You must provide one or more parameters to the link-to helper.', params.length); + + var lastParam = params[params.length - 1]; + + if (lastParam && lastParam.isQueryParams) { + queryParams = params.pop(); + } else { + queryParams = {}; + } + + if (attrs.disabledClass) { + this.set('disabledClass', attrs.disabledClass); + } + + if (attrs.activeClass) { + this.set('activeClass', attrs.activeClass); + } + + if (attrs.disabledWhen) { + this.set('disabled', attrs.disabledWhen); + } + + // TODO: Change to built-in hasBlock once it's available + if (!attrs.hasBlock) { + this.set('linkTitle', params.shift()); + } + + if (attrs.loadingClass) { + _emberMetalProperty_set.set(this, 'loadingClass', attrs.loadingClass); + } + + for (var i = 0; i < params.length; i++) { + var value = params[i]; + + while (_emberRuntimeMixinsController.default.detect(value)) { + _emberMetalCore.default.deprecate('Providing `{{link-to}}` with a param that is wrapped in a controller is deprecated. ' + 'Please update `' + attrs.view + '` to use `{{link-to "post" someController.model}}` instead.', false, { id: 'ember-routing-views.controller-wrapped-param', until: '3.0.0' }); + value = value.get('model'); + } + + params[i] = value; + } + + var targetRouteName = undefined; + var models = []; + targetRouteName = this._handleOnlyQueryParamsSupplied(params[0]); + + for (var i = 1; i < params.length; i++) { + models.push(params[i]); + } + + var resolvedQueryParams = getResolvedQueryParams(queryParams, targetRouteName); + + this.set('targetRouteName', targetRouteName); + this.set('models', models); + this.set('queryParams', queryParams); + this.set('resolvedQueryParams', resolvedQueryParams); + } + }); + + LinkComponent.toString = function () { + return 'LinkComponent'; + }; + + function computeActive(view, routerState) { + if (_emberMetalProperty_get.get(view, 'loading')) { + return false; + } + + var currentWhen = _emberMetalProperty_get.get(view, 'current-when'); + var isCurrentWhenSpecified = !!currentWhen; + currentWhen = currentWhen || _emberMetalProperty_get.get(view, 'targetRouteName'); + currentWhen = currentWhen.split(' '); + for (var i = 0, len = currentWhen.length; i < len; i++) { + if (isActiveForRoute(view, currentWhen[i], isCurrentWhenSpecified, routerState)) { + return _emberMetalProperty_get.get(view, 'activeClass'); + } + } + + return false; + } + + function modelsAreLoaded(models) { + for (var i = 0, l = models.length; i < l; i++) { + if (models[i] == null) { + return false; + } + } + + return true; + } + + function isActiveForRoute(view, routeName, isCurrentWhenSpecified, routerState) { + var service = _emberMetalProperty_get.get(view, '_routing'); + return service.isActiveForRoute(_emberMetalProperty_get.get(view, 'models'), _emberMetalProperty_get.get(view, 'resolvedQueryParams'), routeName, routerState, isCurrentWhenSpecified); + } + + function getResolvedQueryParams(queryParamsObject, targetRouteName) { + var resolvedQueryParams = {}; + + if (!queryParamsObject) { + return resolvedQueryParams; + } + + var values = queryParamsObject.values; + for (var key in values) { + if (!values.hasOwnProperty(key)) { + continue; + } + resolvedQueryParams[key] = values[key]; + } + + return resolvedQueryParams; + } + + exports.default = LinkComponent; +}); +// FEATURES, Logger, assert +// creates inject.service +enifed('ember-routing-views/views/outlet', ['exports', 'ember-views/views/view', 'ember-htmlbars/templates/top-level-view'], function (exports, _emberViewsViewsView, _emberHtmlbarsTemplatesTopLevelView) { + /** + @module ember + @submodule ember-routing-views + */ + + 'use strict'; + + _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.0.3'; + + var CoreOutletView = _emberViewsViewsView.default.extend({ + defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default, + + init: function () { + this._super(); + this._outlets = []; + }, + + setOutletState: function (state) { + this.outletState = { main: state }; + + if (this.env) { + this.env.outletState = this.outletState; + } + + if (this.lastResult) { + this.dirtyOutlets(); + this._outlets = []; + + this.scheduleRevalidate(null, null); + } + }, + + dirtyOutlets: function () { + // Dirty any render nodes that correspond to outlets + for (var i = 0; i < this._outlets.length; i++) { + this._outlets[i].isDirty = true; + } + } + }); + + exports.CoreOutletView = CoreOutletView; + var OutletView = CoreOutletView.extend({ tagName: '' }); + exports.OutletView = OutletView; +}); +enifed('ember-routing-views', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-routing-views/views/link', 'ember-routing-views/views/outlet'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberRoutingViewsViewsLink, _emberRoutingViewsViewsOutlet) { + /** + @module ember + @submodule ember-routing-views + */ + + 'use strict'; + + _emberMetalCore.default.LinkComponent = _emberRoutingViewsViewsLink.default; + _emberMetalCore.default.OutletView = _emberRoutingViewsViewsOutlet.OutletView; + exports.default = _emberMetalCore.default; +}); +enifed('ember-routing', ['exports', 'ember-metal/core', 'ember-routing/ext/run_loop', 'ember-routing/ext/controller', 'ember-routing/location/api', 'ember-routing/location/none_location', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/system/generate_controller', 'ember-routing/system/controller_for', 'ember-routing/system/dsl', 'ember-routing/system/router', 'ember-routing/system/route', 'ember-routing/initializers/routing-service'], function (exports, _emberMetalCore, _emberRoutingExtRun_loop, _emberRoutingExtController, _emberRoutingLocationApi, _emberRoutingLocationNone_location, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingSystemGenerate_controller, _emberRoutingSystemController_for, _emberRoutingSystemDsl, _emberRoutingSystemRouter, _emberRoutingSystemRoute, _emberRoutingInitializersRoutingService) { + /** + @module ember + @submodule ember-routing + */ + + 'use strict'; + + _emberMetalCore.default.Location = _emberRoutingLocationApi.default; + _emberMetalCore.default.AutoLocation = _emberRoutingLocationAuto_location.default; + _emberMetalCore.default.HashLocation = _emberRoutingLocationHash_location.default; + _emberMetalCore.default.HistoryLocation = _emberRoutingLocationHistory_location.default; + _emberMetalCore.default.NoneLocation = _emberRoutingLocationNone_location.default; + + _emberMetalCore.default.controllerFor = _emberRoutingSystemController_for.default; + _emberMetalCore.default.generateControllerFactory = _emberRoutingSystemGenerate_controller.generateControllerFactory; + _emberMetalCore.default.generateController = _emberRoutingSystemGenerate_controller.default; + _emberMetalCore.default.RouterDSL = _emberRoutingSystemDsl.default; + _emberMetalCore.default.Router = _emberRoutingSystemRouter.default; + _emberMetalCore.default.Route = _emberRoutingSystemRoute.default; + + exports.default = _emberMetalCore.default; +}); + +// ES6TODO: Cleanup modules with side-effects below enifed('ember-runtime/compare', ['exports', 'ember-runtime/utils', 'ember-runtime/mixins/comparable'], function (exports, _emberRuntimeUtils, _emberRuntimeMixinsComparable) { 'use strict'; exports.default = compare; @@ -35680,45 +35479,96 @@ } return ret; } }); -enifed('ember-template-compiler', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerCompat) { +enifed('ember-runtime', ['exports', 'ember-metal', 'ember-runtime/core', 'ember-runtime/compare', 'ember-runtime/copy', 'ember-runtime/inject', 'ember-runtime/system/namespace', 'ember-runtime/system/object', 'ember-runtime/system/container', 'ember-runtime/system/array_proxy', 'ember-runtime/system/object_proxy', 'ember-runtime/system/core_object', 'ember-runtime/system/native_array', 'ember-runtime/system/string', 'ember-runtime/system/lazy_load', 'ember-runtime/mixins/array', 'ember-runtime/mixins/comparable', 'ember-runtime/mixins/copyable', 'ember-runtime/mixins/enumerable', 'ember-runtime/mixins/freezable', 'ember-runtime/mixins/-proxy', 'ember-runtime/mixins/observable', 'ember-runtime/mixins/action_handler', 'ember-runtime/mixins/mutable_enumerable', 'ember-runtime/mixins/mutable_array', 'ember-runtime/mixins/target_action_support', 'ember-runtime/mixins/evented', 'ember-runtime/mixins/promise_proxy', 'ember-runtime/computed/reduce_computed_macros', 'ember-runtime/controllers/controller', 'ember-runtime/mixins/controller', 'ember-runtime/system/service', 'ember-runtime/ext/rsvp', 'ember-runtime/ext/string', 'ember-runtime/ext/function', 'ember-runtime/utils'], function (exports, _emberMetal, _emberRuntimeCore, _emberRuntimeCompare, _emberRuntimeCopy, _emberRuntimeInject, _emberRuntimeSystemNamespace, _emberRuntimeSystemObject, _emberRuntimeSystemContainer, _emberRuntimeSystemArray_proxy, _emberRuntimeSystemObject_proxy, _emberRuntimeSystemCore_object, _emberRuntimeSystemNative_array, _emberRuntimeSystemString, _emberRuntimeSystemLazy_load, _emberRuntimeMixinsArray, _emberRuntimeMixinsComparable, _emberRuntimeMixinsCopyable, _emberRuntimeMixinsEnumerable, _emberRuntimeMixinsFreezable, _emberRuntimeMixinsProxy, _emberRuntimeMixinsObservable, _emberRuntimeMixinsAction_handler, _emberRuntimeMixinsMutable_enumerable, _emberRuntimeMixinsMutable_array, _emberRuntimeMixinsTarget_action_support, _emberRuntimeMixinsEvented, _emberRuntimeMixinsPromise_proxy, _emberRuntimeComputedReduce_computed_macros, _emberRuntimeControllersController, _emberRuntimeMixinsController, _emberRuntimeSystemService, _emberRuntimeExtRsvp, _emberRuntimeExtString, _emberRuntimeExtFunction, _emberRuntimeUtils) { + /** + @module ember + @submodule ember-runtime + */ + + // BEGIN IMPORTS 'use strict'; - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldBindingSyntax.default); - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldClassBindingSyntax.default); - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformItemClass.default); - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut.default); - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly.default); - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformAngleBracketComponents.default); - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformInputOnToOnEvent.default); + // END IMPORTS - if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformEachIntoCollection.default); - } else { - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default); - _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewHelper.default); - } + // BEGIN EXPORTS + _emberMetal.default.compare = _emberRuntimeCompare.default; + _emberMetal.default.copy = _emberRuntimeCopy.default; + _emberMetal.default.isEqual = _emberRuntimeCore.isEqual; - exports._Ember = _emberMetal.default; - exports.precompile = _emberTemplateCompilerSystemPrecompile.default; - exports.compile = _emberTemplateCompilerSystemCompile.default; - exports.template = _emberTemplateCompilerSystemTemplate.default; - exports.registerPlugin = _emberTemplateCompilerPlugins.registerPlugin; -}); + _emberMetal.default.inject = _emberRuntimeInject.default; -// used for adding Ember.Handlebars.compile for backwards compat -enifed('ember-template-compiler/compat', ['exports', 'ember-metal/core', 'ember-template-compiler/compat/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template'], function (exports, _emberMetalCore, _emberTemplateCompilerCompatPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate) { - 'use strict'; + _emberMetal.default.Array = _emberRuntimeMixinsArray.default; - var EmberHandlebars = _emberMetalCore.default.Handlebars = _emberMetalCore.default.Handlebars || {}; + _emberMetal.default.Comparable = _emberRuntimeMixinsComparable.default; + _emberMetal.default.Copyable = _emberRuntimeMixinsCopyable.default; - EmberHandlebars.precompile = _emberTemplateCompilerCompatPrecompile.default; - EmberHandlebars.compile = _emberTemplateCompilerSystemCompile.default; - EmberHandlebars.template = _emberTemplateCompilerSystemTemplate.default; + _emberMetal.default.Freezable = _emberRuntimeMixinsFreezable.Freezable; + _emberMetal.default.FROZEN_ERROR = _emberRuntimeMixinsFreezable.FROZEN_ERROR; + + _emberMetal.default.MutableEnumerable = _emberRuntimeMixinsMutable_enumerable.default; + _emberMetal.default.MutableArray = _emberRuntimeMixinsMutable_array.default; + + _emberMetal.default.TargetActionSupport = _emberRuntimeMixinsTarget_action_support.default; + _emberMetal.default.Evented = _emberRuntimeMixinsEvented.default; + + _emberMetal.default.PromiseProxyMixin = _emberRuntimeMixinsPromise_proxy.default; + + _emberMetal.default.Observable = _emberRuntimeMixinsObservable.default; + + _emberMetal.default.typeOf = _emberRuntimeUtils.typeOf; + _emberMetal.default.isArray = _emberRuntimeUtils.isArray; + + // ES6TODO: this seems a less than ideal way/place to add properties to Ember.computed + var EmComputed = _emberMetal.default.computed; + + EmComputed.sum = _emberRuntimeComputedReduce_computed_macros.sum; + EmComputed.min = _emberRuntimeComputedReduce_computed_macros.min; + EmComputed.max = _emberRuntimeComputedReduce_computed_macros.max; + EmComputed.map = _emberRuntimeComputedReduce_computed_macros.map; + EmComputed.sort = _emberRuntimeComputedReduce_computed_macros.sort; + EmComputed.setDiff = _emberRuntimeComputedReduce_computed_macros.setDiff; + EmComputed.mapBy = _emberRuntimeComputedReduce_computed_macros.mapBy; + EmComputed.filter = _emberRuntimeComputedReduce_computed_macros.filter; + EmComputed.filterBy = _emberRuntimeComputedReduce_computed_macros.filterBy; + EmComputed.uniq = _emberRuntimeComputedReduce_computed_macros.uniq; + EmComputed.union = _emberRuntimeComputedReduce_computed_macros.union; + EmComputed.intersect = _emberRuntimeComputedReduce_computed_macros.intersect; + + _emberMetal.default.String = _emberRuntimeSystemString.default; + _emberMetal.default.Object = _emberRuntimeSystemObject.default; + _emberMetal.default.Container = _emberRuntimeSystemContainer.Container; + _emberMetal.default.Registry = _emberRuntimeSystemContainer.Registry; + _emberMetal.default.Namespace = _emberRuntimeSystemNamespace.default; + _emberMetal.default.Enumerable = _emberRuntimeMixinsEnumerable.default; + _emberMetal.default.ArrayProxy = _emberRuntimeSystemArray_proxy.default; + _emberMetal.default.ObjectProxy = _emberRuntimeSystemObject_proxy.default; + _emberMetal.default.ActionHandler = _emberRuntimeMixinsAction_handler.default; + _emberMetal.default.CoreObject = _emberRuntimeSystemCore_object.default; + _emberMetal.default.NativeArray = _emberRuntimeSystemNative_array.default; + // ES6TODO: Currently we must rely on the global from ember-metal/core to avoid circular deps + // Ember.A = A; + _emberMetal.default.onLoad = _emberRuntimeSystemLazy_load.onLoad; + _emberMetal.default.runLoadHooks = _emberRuntimeSystemLazy_load.runLoadHooks; + + _emberMetal.default.Controller = _emberRuntimeControllersController.default; + _emberMetal.default.ControllerMixin = _emberRuntimeMixinsController.default; + + _emberMetal.default.Service = _emberRuntimeSystemService.default; + + _emberMetal.default._ProxyMixin = _emberRuntimeMixinsProxy.default; + + _emberMetal.default.RSVP = _emberRuntimeExtRsvp.default; + // END EXPORTS + + exports.default = _emberMetal.default; }); +// just for side effect of extending Ember.RSVP +// just for side effect of extending String.prototype +// just for side effect of extending Function.prototype enifed('ember-template-compiler/compat/precompile', ['exports', 'ember-metal/core', 'ember-template-compiler/system/compile_options'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCompile_options) { /** @module ember @submodule ember-template-compiler */ @@ -35742,43 +35592,18 @@ var compileFunc = asObject ? compile : compileSpec; return compileFunc(string, _emberTemplateCompilerSystemCompile_options.default()); }; }); -enifed('ember-template-compiler/plugins', ['exports'], function (exports) { - /** - @module ember - @submodule ember-template-compiler - */ - - /** - @private - @property helpers - */ +enifed('ember-template-compiler/compat', ['exports', 'ember-metal/core', 'ember-template-compiler/compat/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template'], function (exports, _emberMetalCore, _emberTemplateCompilerCompatPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate) { 'use strict'; - exports.registerPlugin = registerPlugin; - var plugins = { - ast: [] - }; + var EmberHandlebars = _emberMetalCore.default.Handlebars = _emberMetalCore.default.Handlebars || {}; - /** - Adds an AST plugin to be used by Ember.HTMLBars.compile. - - @private - @method registerASTPlugin - */ - - function registerPlugin(type, Plugin) { - if (!plugins[type]) { - throw new Error('Attempting to register "' + Plugin + '" as "' + type + '" which is not a valid HTMLBars plugin type.'); - } - - plugins[type].push(Plugin); - } - - exports.default = plugins; + EmberHandlebars.precompile = _emberTemplateCompilerCompatPrecompile.default; + EmberHandlebars.compile = _emberTemplateCompilerSystemCompile.default; + EmberHandlebars.template = _emberTemplateCompilerSystemTemplate.default; }); enifed('ember-template-compiler/plugins/assert-no-view-and-controller-paths', ['exports', 'ember-metal/core', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCalculateLocationDisplay) { 'use strict'; function AssertNoViewAndControllerPaths(options) { @@ -36542,10 +36367,44 @@ } return segments; } }); +enifed('ember-template-compiler/plugins', ['exports'], function (exports) { + /** + @module ember + @submodule ember-template-compiler + */ + + /** + @private + @property helpers + */ + 'use strict'; + + exports.registerPlugin = registerPlugin; + var plugins = { + ast: [] + }; + + /** + Adds an AST plugin to be used by Ember.HTMLBars.compile. + + @private + @method registerASTPlugin + */ + + function registerPlugin(type, Plugin) { + if (!plugins[type]) { + throw new Error('Attempting to register "' + Plugin + '" as "' + type + '" which is not a valid HTMLBars plugin type.'); + } + + plugins[type].push(Plugin); + } + + exports.default = plugins; +}); enifed('ember-template-compiler/system/calculate-location-display', ['exports'], function (exports) { 'use strict'; exports.default = calculateLocationDisplay; @@ -36649,11 +36508,11 @@ } options.plugins = plugins; options.buildMeta = function buildMeta(program) { return { - revision: 'Ember@2.0.2', + revision: 'Ember@2.0.3', loc: program.loc, moduleName: options.moduleName }; }; @@ -36718,27 +36577,36 @@ templateSpec.isMethod = false; return templateSpec; }; }); -enifed('ember-testing', ['exports', 'ember-metal/core', 'ember-testing/initializers', 'ember-testing/support', 'ember-testing/setup_for_testing', 'ember-testing/test', 'ember-testing/adapters/adapter', 'ember-testing/adapters/qunit', 'ember-testing/helpers'], function (exports, _emberMetalCore, _emberTestingInitializers, _emberTestingSupport, _emberTestingSetup_for_testing, _emberTestingTest, _emberTestingAdaptersAdapter, _emberTestingAdaptersQunit, _emberTestingHelpers) { +enifed('ember-template-compiler', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerCompat) { 'use strict'; - // adds helpers to helpers object in Test + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldBindingSyntax.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldClassBindingSyntax.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformItemClass.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformAngleBracketComponents.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformInputOnToOnEvent.default); - /** - @module ember - @submodule ember-testing - */ + if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformEachIntoCollection.default); + } else { + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewHelper.default); + } - _emberMetalCore.default.Test = _emberTestingTest.default; - _emberMetalCore.default.Test.Adapter = _emberTestingAdaptersAdapter.default; - _emberMetalCore.default.Test.QUnitAdapter = _emberTestingAdaptersQunit.default; - _emberMetalCore.default.setupForTesting = _emberTestingSetup_for_testing.default; + exports._Ember = _emberMetal.default; + exports.precompile = _emberTemplateCompilerSystemPrecompile.default; + exports.compile = _emberTemplateCompilerSystemCompile.default; + exports.template = _emberTemplateCompilerSystemTemplate.default; + exports.registerPlugin = _emberTemplateCompilerPlugins.registerPlugin; }); -// to setup initializer -// to handle various edge cases + +// used for adding Ember.Handlebars.compile for backwards compat enifed('ember-testing/adapters/adapter', ['exports', 'ember-runtime/system/object'], function (exports, _emberRuntimeSystemObject) { 'use strict'; function K() { return this; @@ -37957,79 +37825,27 @@ } } exports.default = Test; }); -enifed('ember-views', ['exports', 'ember-runtime', 'ember-views/system/jquery', 'ember-views/system/utils', 'ember-views/system/ext', 'ember-views/views/states', 'ember-metal-views/renderer', 'ember-views/views/core_view', 'ember-views/views/view', 'ember-views/views/container_view', 'ember-views/views/collection_view', 'ember-views/views/component', 'ember-views/system/event_dispatcher', 'ember-views/mixins/view_target_action_support', 'ember-views/component_lookup', 'ember-views/views/checkbox', 'ember-views/mixins/text_support', 'ember-views/views/text_field', 'ember-views/views/text_area', 'ember-views/views/select', 'ember-views/compat/metamorph_view', 'ember-views/views/legacy_each_view'], function (exports, _emberRuntime, _emberViewsSystemJquery, _emberViewsSystemUtils, _emberViewsSystemExt, _emberViewsViewsStates, _emberMetalViewsRenderer, _emberViewsViewsCore_view, _emberViewsViewsView, _emberViewsViewsContainer_view, _emberViewsViewsCollection_view, _emberViewsViewsComponent, _emberViewsSystemEvent_dispatcher, _emberViewsMixinsView_target_action_support, _emberViewsComponent_lookup, _emberViewsViewsCheckbox, _emberViewsMixinsText_support, _emberViewsViewsText_field, _emberViewsViewsText_area, _emberViewsViewsSelect, _emberViewsCompatMetamorph_view, _emberViewsViewsLegacy_each_view) { - /** - @module ember - @submodule ember-views - */ - - // BEGIN IMPORTS +enifed('ember-testing', ['exports', 'ember-metal/core', 'ember-testing/initializers', 'ember-testing/support', 'ember-testing/setup_for_testing', 'ember-testing/test', 'ember-testing/adapters/adapter', 'ember-testing/adapters/qunit', 'ember-testing/helpers'], function (exports, _emberMetalCore, _emberTestingInitializers, _emberTestingSupport, _emberTestingSetup_for_testing, _emberTestingTest, _emberTestingAdaptersAdapter, _emberTestingAdaptersQunit, _emberTestingHelpers) { 'use strict'; - // END IMPORTS + // adds helpers to helpers object in Test /** - Alias for jQuery - - @method $ - @for Ember - @public + @module ember + @submodule ember-testing */ - // BEGIN EXPORTS - _emberRuntime.default.$ = _emberViewsSystemJquery.default; - - _emberRuntime.default.ViewTargetActionSupport = _emberViewsMixinsView_target_action_support.default; - - var ViewUtils = _emberRuntime.default.ViewUtils = {}; - ViewUtils.isSimpleClick = _emberViewsSystemUtils.isSimpleClick; - ViewUtils.getViewClientRects = _emberViewsSystemUtils.getViewClientRects; - ViewUtils.getViewBoundingClientRect = _emberViewsSystemUtils.getViewBoundingClientRect; - - if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { - _emberRuntime.default.CoreView = _emberViewsViewsCore_view.DeprecatedCoreView; - _emberRuntime.default.View = _emberViewsViewsView.DeprecatedView; - _emberRuntime.default.View.states = _emberViewsViewsStates.states; - _emberRuntime.default.View.cloneStates = _emberViewsViewsStates.cloneStates; - _emberRuntime.default.View._Renderer = _emberMetalViewsRenderer.default; - _emberRuntime.default.ContainerView = _emberViewsViewsContainer_view.DeprecatedContainerView; - _emberRuntime.default.CollectionView = _emberViewsViewsCollection_view.DeprecatedCollectionView; - } - - _emberRuntime.default._Renderer = _emberMetalViewsRenderer.default; - - _emberRuntime.default.Checkbox = _emberViewsViewsCheckbox.default; - _emberRuntime.default.TextField = _emberViewsViewsText_field.default; - _emberRuntime.default.TextArea = _emberViewsViewsText_area.default; - - if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { - _emberRuntime.default.Select = _emberViewsViewsSelect.Select; - } - - _emberRuntime.default.SelectOption = _emberViewsViewsSelect.SelectOption; - _emberRuntime.default.SelectOptgroup = _emberViewsViewsSelect.SelectOptgroup; - - _emberRuntime.default.TextSupport = _emberViewsMixinsText_support.default; - _emberRuntime.default.ComponentLookup = _emberViewsComponent_lookup.default; - _emberRuntime.default.Component = _emberViewsViewsComponent.default; - _emberRuntime.default.EventDispatcher = _emberViewsSystemEvent_dispatcher.default; - - // Deprecated: - if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { - _emberRuntime.default._Metamorph = _emberViewsCompatMetamorph_view._Metamorph; - _emberRuntime.default._MetamorphView = _emberViewsCompatMetamorph_view.default; - _emberRuntime.default._LegacyEachView = _emberViewsViewsLegacy_each_view.default; - } - - // END EXPORTS - - exports.default = _emberRuntime.default; + _emberMetalCore.default.Test = _emberTestingTest.default; + _emberMetalCore.default.Test.Adapter = _emberTestingAdaptersAdapter.default; + _emberMetalCore.default.Test.QUnitAdapter = _emberTestingAdaptersQunit.default; + _emberMetalCore.default.setupForTesting = _emberTestingSetup_for_testing.default; }); -// for the side effect of extending Ember.run.queues +// to setup initializer +// to handle various edge cases enifed('ember-views/compat/attrs-proxy', ['exports', 'ember-metal/mixin', 'ember-metal/utils', 'ember-metal/property_events', 'ember-metal/events', 'ember-metal/empty_object'], function (exports, _emberMetalMixin, _emberMetalUtils, _emberMetalProperty_events, _emberMetalEvents, _emberMetalEmpty_object) { 'use strict'; exports.deprecation = deprecation; @@ -41244,11 +41060,11 @@ }); // Ember.assert, Ember.Handlebars enifed('ember-views/views/container_view', ['exports', 'ember-metal/core', 'ember-runtime/mixins/mutable_array', 'ember-views/views/view', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/mixin', 'ember-metal/events', 'ember-htmlbars/templates/container-view'], function (exports, _emberMetalCore, _emberRuntimeMixinsMutable_array, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMixin, _emberMetalEvents, _emberHtmlbarsTemplatesContainerView) { 'use strict'; - _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.0.2'; + _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.0.3'; /** @module ember @submodule ember-views */ @@ -42403,43 +42219,10 @@ exports.default = Select; exports.Select = Select; exports.SelectOption = SelectOption; exports.SelectOptgroup = SelectOptgroup; }); -enifed('ember-views/views/states', ['exports', 'ember-metal/merge', 'ember-views/views/states/default', 'ember-views/views/states/pre_render', 'ember-views/views/states/has_element', 'ember-views/views/states/in_dom', 'ember-views/views/states/destroying'], function (exports, _emberMetalMerge, _emberViewsViewsStatesDefault, _emberViewsViewsStatesPre_render, _emberViewsViewsStatesHas_element, _emberViewsViewsStatesIn_dom, _emberViewsViewsStatesDestroying) { - 'use strict'; - - exports.cloneStates = cloneStates; - - function cloneStates(from) { - var into = {}; - - into._default = {}; - into.preRender = Object.create(into._default); - into.destroying = Object.create(into._default); - into.hasElement = Object.create(into._default); - into.inDOM = Object.create(into.hasElement); - - for (var stateName in from) { - if (!from.hasOwnProperty(stateName)) { - continue; - } - _emberMetalMerge.default(into[stateName], from[stateName]); - } - - return into; - } - - var states = { - _default: _emberViewsViewsStatesDefault.default, - preRender: _emberViewsViewsStatesPre_render.default, - inDOM: _emberViewsViewsStatesIn_dom.default, - hasElement: _emberViewsViewsStatesHas_element.default, - destroying: _emberViewsViewsStatesDestroying.default - }; - exports.states = states; -}); enifed('ember-views/views/states/default', ['exports', 'ember-metal/error', 'ember-metal/property_get', 'ember-views/compat/attrs-proxy'], function (exports, _emberMetalError, _emberMetalProperty_get, _emberViewsCompatAttrsProxy) { 'use strict'; /** @module ember @@ -42651,10 +42434,43 @@ legacyPropertyDidChange: function (view, key) {} }); exports.default = preRender; }); +enifed('ember-views/views/states', ['exports', 'ember-metal/merge', 'ember-views/views/states/default', 'ember-views/views/states/pre_render', 'ember-views/views/states/has_element', 'ember-views/views/states/in_dom', 'ember-views/views/states/destroying'], function (exports, _emberMetalMerge, _emberViewsViewsStatesDefault, _emberViewsViewsStatesPre_render, _emberViewsViewsStatesHas_element, _emberViewsViewsStatesIn_dom, _emberViewsViewsStatesDestroying) { + 'use strict'; + + exports.cloneStates = cloneStates; + + function cloneStates(from) { + var into = {}; + + into._default = {}; + into.preRender = Object.create(into._default); + into.destroying = Object.create(into._default); + into.hasElement = Object.create(into._default); + into.inDOM = Object.create(into.hasElement); + + for (var stateName in from) { + if (!from.hasOwnProperty(stateName)) { + continue; + } + _emberMetalMerge.default(into[stateName], from[stateName]); + } + + return into; + } + + var states = { + _default: _emberViewsViewsStatesDefault.default, + preRender: _emberViewsViewsStatesPre_render.default, + inDOM: _emberViewsViewsStatesIn_dom.default, + hasElement: _emberViewsViewsStatesHas_element.default, + destroying: _emberViewsViewsStatesDestroying.default + }; + exports.states = states; +}); enifed('ember-views/views/text_area', ['exports', 'ember-views/views/component', 'ember-views/mixins/text_support'], function (exports, _emberViewsViewsComponent, _emberViewsMixinsText_support) { /** @module ember @submodule ember-views */ @@ -44278,10 +44094,79 @@ exports.TemplateRenderingSupport = _emberViewsMixinsTemplate_rendering_support.default; exports.ClassNamesSupport = _emberViewsMixinsClass_names_support.default; exports.DeprecatedView = DeprecatedView; }); // for the side effect of extending Ember.run.queues +enifed('ember-views', ['exports', 'ember-runtime', 'ember-views/system/jquery', 'ember-views/system/utils', 'ember-views/system/ext', 'ember-views/views/states', 'ember-metal-views/renderer', 'ember-views/views/core_view', 'ember-views/views/view', 'ember-views/views/container_view', 'ember-views/views/collection_view', 'ember-views/views/component', 'ember-views/system/event_dispatcher', 'ember-views/mixins/view_target_action_support', 'ember-views/component_lookup', 'ember-views/views/checkbox', 'ember-views/mixins/text_support', 'ember-views/views/text_field', 'ember-views/views/text_area', 'ember-views/views/select', 'ember-views/compat/metamorph_view', 'ember-views/views/legacy_each_view'], function (exports, _emberRuntime, _emberViewsSystemJquery, _emberViewsSystemUtils, _emberViewsSystemExt, _emberViewsViewsStates, _emberMetalViewsRenderer, _emberViewsViewsCore_view, _emberViewsViewsView, _emberViewsViewsContainer_view, _emberViewsViewsCollection_view, _emberViewsViewsComponent, _emberViewsSystemEvent_dispatcher, _emberViewsMixinsView_target_action_support, _emberViewsComponent_lookup, _emberViewsViewsCheckbox, _emberViewsMixinsText_support, _emberViewsViewsText_field, _emberViewsViewsText_area, _emberViewsViewsSelect, _emberViewsCompatMetamorph_view, _emberViewsViewsLegacy_each_view) { + /** + @module ember + @submodule ember-views + */ + + // BEGIN IMPORTS + 'use strict'; + + // END IMPORTS + + /** + Alias for jQuery + + @method $ + @for Ember + @public + */ + + // BEGIN EXPORTS + _emberRuntime.default.$ = _emberViewsSystemJquery.default; + + _emberRuntime.default.ViewTargetActionSupport = _emberViewsMixinsView_target_action_support.default; + + var ViewUtils = _emberRuntime.default.ViewUtils = {}; + ViewUtils.isSimpleClick = _emberViewsSystemUtils.isSimpleClick; + ViewUtils.getViewClientRects = _emberViewsSystemUtils.getViewClientRects; + ViewUtils.getViewBoundingClientRect = _emberViewsSystemUtils.getViewBoundingClientRect; + + if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { + _emberRuntime.default.CoreView = _emberViewsViewsCore_view.DeprecatedCoreView; + _emberRuntime.default.View = _emberViewsViewsView.DeprecatedView; + _emberRuntime.default.View.states = _emberViewsViewsStates.states; + _emberRuntime.default.View.cloneStates = _emberViewsViewsStates.cloneStates; + _emberRuntime.default.View._Renderer = _emberMetalViewsRenderer.default; + _emberRuntime.default.ContainerView = _emberViewsViewsContainer_view.DeprecatedContainerView; + _emberRuntime.default.CollectionView = _emberViewsViewsCollection_view.DeprecatedCollectionView; + } + + _emberRuntime.default._Renderer = _emberMetalViewsRenderer.default; + + _emberRuntime.default.Checkbox = _emberViewsViewsCheckbox.default; + _emberRuntime.default.TextField = _emberViewsViewsText_field.default; + _emberRuntime.default.TextArea = _emberViewsViewsText_area.default; + + if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { + _emberRuntime.default.Select = _emberViewsViewsSelect.Select; + } + + _emberRuntime.default.SelectOption = _emberViewsViewsSelect.SelectOption; + _emberRuntime.default.SelectOptgroup = _emberViewsViewsSelect.SelectOptgroup; + + _emberRuntime.default.TextSupport = _emberViewsMixinsText_support.default; + _emberRuntime.default.ComponentLookup = _emberViewsComponent_lookup.default; + _emberRuntime.default.Component = _emberViewsViewsComponent.default; + _emberRuntime.default.EventDispatcher = _emberViewsSystemEvent_dispatcher.default; + + // Deprecated: + if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { + _emberRuntime.default._Metamorph = _emberViewsCompatMetamorph_view._Metamorph; + _emberRuntime.default._MetamorphView = _emberViewsCompatMetamorph_view.default; + _emberRuntime.default._LegacyEachView = _emberViewsViewsLegacy_each_view.default; + } + + // END EXPORTS + + exports.default = _emberRuntime.default; +}); +// for the side effect of extending Ember.run.queues enifed('ember', ['exports', 'ember-metal', 'ember-runtime', 'ember-views', 'ember-routing', 'ember-application', 'ember-extension-support', 'ember-htmlbars', 'ember-routing-htmlbars', 'ember-routing-views', 'ember-metal/core', 'ember-runtime/system/lazy_load'], function (exports, _emberMetal, _emberRuntime, _emberViews, _emberRouting, _emberApplication, _emberExtensionSupport, _emberHtmlbars, _emberRoutingHtmlbars, _emberRoutingViews, _emberMetalCore, _emberRuntimeSystemLazy_load) { // require the main entry points for each of these packages // this is so that the global exports occur properly 'use strict'; @@ -44299,28 +44184,10 @@ /** @module ember */ }); -enifed('htmlbars-runtime', ['exports', './htmlbars-runtime/hooks', './htmlbars-runtime/render', '../htmlbars-util/morph-utils', '../htmlbars-util/template-utils', './htmlbars-runtime/expression-visitor', 'htmlbars-runtime/hooks'], function (exports, _htmlbarsRuntimeHooks, _htmlbarsRuntimeRender, _htmlbarsUtilMorphUtils, _htmlbarsUtilTemplateUtils, _htmlbarsRuntimeExpressionVisitor, _htmlbarsRuntimeHooks2) { - 'use strict'; - - var internal = { - blockFor: _htmlbarsUtilTemplateUtils.blockFor, - manualElement: _htmlbarsRuntimeRender.manualElement, - hostBlock: _htmlbarsRuntimeHooks2.hostBlock, - continueBlock: _htmlbarsRuntimeHooks2.continueBlock, - hostYieldWithShadowTemplate: _htmlbarsRuntimeHooks2.hostYieldWithShadowTemplate, - visitChildren: _htmlbarsUtilMorphUtils.visitChildren, - validateChildMorphs: _htmlbarsRuntimeExpressionVisitor.validateChildMorphs, - clearMorph: _htmlbarsUtilTemplateUtils.clearMorph - }; - - exports.hooks = _htmlbarsRuntimeHooks.default; - exports.render = _htmlbarsRuntimeRender.default; - exports.internal = internal; -}); enifed("htmlbars-runtime/expression-visitor", ["exports", "../htmlbars-util/object-utils", "../htmlbars-util/morph-utils"], function (exports, _htmlbarsUtilObjectUtils, _htmlbarsUtilMorphUtils) { "use strict"; /** Node classification: @@ -46188,19 +46055,27 @@ } return fragment; } }); -enifed('htmlbars-util', ['exports', './htmlbars-util/safe-string', './htmlbars-util/handlebars/utils', './htmlbars-util/namespaces', './htmlbars-util/morph-utils'], function (exports, _htmlbarsUtilSafeString, _htmlbarsUtilHandlebarsUtils, _htmlbarsUtilNamespaces, _htmlbarsUtilMorphUtils) { +enifed('htmlbars-runtime', ['exports', './htmlbars-runtime/hooks', './htmlbars-runtime/render', '../htmlbars-util/morph-utils', '../htmlbars-util/template-utils', './htmlbars-runtime/expression-visitor', 'htmlbars-runtime/hooks'], function (exports, _htmlbarsRuntimeHooks, _htmlbarsRuntimeRender, _htmlbarsUtilMorphUtils, _htmlbarsUtilTemplateUtils, _htmlbarsRuntimeExpressionVisitor, _htmlbarsRuntimeHooks2) { 'use strict'; - exports.SafeString = _htmlbarsUtilSafeString.default; - exports.escapeExpression = _htmlbarsUtilHandlebarsUtils.escapeExpression; - exports.getAttrNamespace = _htmlbarsUtilNamespaces.getAttrNamespace; - exports.validateChildMorphs = _htmlbarsUtilMorphUtils.validateChildMorphs; - exports.linkParams = _htmlbarsUtilMorphUtils.linkParams; - exports.dump = _htmlbarsUtilMorphUtils.dump; + var internal = { + blockFor: _htmlbarsUtilTemplateUtils.blockFor, + manualElement: _htmlbarsRuntimeRender.manualElement, + hostBlock: _htmlbarsRuntimeHooks2.hostBlock, + continueBlock: _htmlbarsRuntimeHooks2.continueBlock, + hostYieldWithShadowTemplate: _htmlbarsRuntimeHooks2.hostYieldWithShadowTemplate, + visitChildren: _htmlbarsUtilMorphUtils.visitChildren, + validateChildMorphs: _htmlbarsRuntimeExpressionVisitor.validateChildMorphs, + clearMorph: _htmlbarsUtilTemplateUtils.clearMorph + }; + + exports.hooks = _htmlbarsRuntimeHooks.default; + exports.render = _htmlbarsRuntimeRender.default; + exports.internal = internal; }); enifed('htmlbars-util/array-utils', ['exports'], function (exports) { 'use strict'; exports.forEach = forEach; @@ -46804,10 +46679,202 @@ voidMap[tagName] = true; }); exports.default = voidMap; }); +enifed('htmlbars-util', ['exports', './htmlbars-util/safe-string', './htmlbars-util/handlebars/utils', './htmlbars-util/namespaces', './htmlbars-util/morph-utils'], function (exports, _htmlbarsUtilSafeString, _htmlbarsUtilHandlebarsUtils, _htmlbarsUtilNamespaces, _htmlbarsUtilMorphUtils) { + 'use strict'; + + exports.SafeString = _htmlbarsUtilSafeString.default; + exports.escapeExpression = _htmlbarsUtilHandlebarsUtils.escapeExpression; + exports.getAttrNamespace = _htmlbarsUtilNamespaces.getAttrNamespace; + exports.validateChildMorphs = _htmlbarsUtilMorphUtils.validateChildMorphs; + exports.linkParams = _htmlbarsUtilMorphUtils.linkParams; + exports.dump = _htmlbarsUtilMorphUtils.dump; +}); +(function() { +})(); +/*! + * @overview Ember - JavaScript Application Framework + * @copyright Copyright 2011-2015 Tilde Inc. and contributors + * Portions Copyright 2006-2011 Strobe Inc. + * Portions Copyright 2008-2011 Apple Inc. All rights reserved. + * @license Licensed under MIT license + * See https://raw.github.com/emberjs/ember.js/master/LICENSE + * @version 2.0.3 + */ + +var enifed, requireModule, eriuqer, requirejs, Ember; +var mainContext = this; + +(function() { + var isNode = typeof window === 'undefined' && + typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + if (!isNode) { + Ember = this.Ember = this.Ember || {}; + } + + if (typeof Ember === 'undefined') { Ember = {}; }; + + if (typeof Ember.__loader === 'undefined') { + var registry = {}; + var seen = {}; + + enifed = function(name, deps, callback) { + var value = { }; + + if (!callback) { + value.deps = []; + value.callback = deps; + } else { + value.deps = deps; + value.callback = callback; + } + + registry[name] = value; + }; + + requirejs = eriuqer = requireModule = function(name) { + return internalRequire(name, null); + } + + function internalRequire(name, referrerName) { + var exports = seen[name]; + + if (exports !== undefined) { + return exports; + } + + exports = seen[name] = {}; + + if (!registry[name]) { + if (referrerName) { + throw new Error('Could not find module ' + name + ' required by: ' + referrerName); + } else { + throw new Error('Could not find module ' + name); + } + } + + var mod = registry[name]; + var deps = mod.deps; + var callback = mod.callback; + var reified = []; + var length = deps.length; + + for (var i=0; i<length; i++) { + if (deps[i] === 'exports') { + reified.push(exports); + } else { + reified.push(internalRequire(resolve(deps[i], name), name)); + } + } + + callback.apply(this, reified); + + return exports; + }; + + function resolve(child, name) { + if (child.charAt(0) !== '.') { + return child; + } + var parts = child.split('/'); + var parentBase = name.split('/').slice(0, -1); + + for (var i=0, l=parts.length; i<l; i++) { + var part = parts[i]; + + if (part === '..') { + parentBase.pop(); + } else if (part === '.') { + continue; + } else { + parentBase.push(part); + } + } + + return parentBase.join('/'); + } + + requirejs._eak_seen = registry; + + Ember.__loader = { + define: enifed, + require: eriuqer, + registry: registry + }; + } else { + enifed = Ember.__loader.define; + requirejs = eriuqer = requireModule = Ember.__loader.require; + } +})(); + +enifed('morph-attr/sanitize-attribute-value', ['exports'], function (exports) { + /* jshint scripturl:true */ + + 'use strict'; + + exports.sanitizeAttributeValue = sanitizeAttributeValue; + var badProtocols = { + 'javascript:': true, + 'vbscript:': true + }; + + var badTags = { + 'A': true, + 'BODY': true, + 'LINK': true, + 'IMG': true, + 'IFRAME': true, + 'BASE': true, + 'FORM': true + }; + + var badTagsForDataURI = { + 'EMBED': true + }; + + var badAttributes = { + 'href': true, + 'src': true, + 'background': true, + 'action': true + }; + + exports.badAttributes = badAttributes; + var badAttributesForDataURI = { + 'src': true + }; + + function sanitizeAttributeValue(dom, element, attribute, value) { + var tagName; + + if (!element) { + tagName = null; + } else { + tagName = element.tagName.toUpperCase(); + } + + if (value && value.toHTML) { + return value.toHTML(); + } + + if ((tagName === null || badTags[tagName]) && badAttributes[attribute]) { + var protocol = dom.protocolForURL(value); + if (badProtocols[protocol] === true) { + return 'unsafe:' + value; + } + } + + if (badTagsForDataURI[tagName] && badAttributesForDataURI[attribute]) { + return 'unsafe:' + value; + } + + return value; + } +}); enifed("morph-attr", ["exports", "./morph-attr/sanitize-attribute-value", "./dom-helper/prop", "./dom-helper/build-html-dom", "./htmlbars-util"], function (exports, _morphAttrSanitizeAttributeValue, _domHelperProp, _domHelperBuildHtmlDom, _htmlbarsUtil) { "use strict"; function getProperty() { return this.domHelper.getPropertyStrict(this.element, this.attrName); @@ -46923,73 +46990,148 @@ }; exports.default = AttrMorph; exports.sanitizeAttributeValue = _morphAttrSanitizeAttributeValue.sanitizeAttributeValue; }); -enifed('morph-attr/sanitize-attribute-value', ['exports'], function (exports) { - /* jshint scripturl:true */ - +enifed('morph-range/morph-list', ['exports', './utils'], function (exports, _utils) { 'use strict'; - exports.sanitizeAttributeValue = sanitizeAttributeValue; - var badProtocols = { - 'javascript:': true, - 'vbscript:': true - }; + function MorphList() { + // morph graph + this.firstChildMorph = null; + this.lastChildMorph = null; - var badTags = { - 'A': true, - 'BODY': true, - 'LINK': true, - 'IMG': true, - 'IFRAME': true, - 'BASE': true, - 'FORM': true - }; + this.mountedMorph = null; + } - var badTagsForDataURI = { - 'EMBED': true - }; + var prototype = MorphList.prototype; - var badAttributes = { - 'href': true, - 'src': true, - 'background': true, - 'action': true + prototype.clear = function MorphList$clear() { + var current = this.firstChildMorph; + + while (current) { + var next = current.nextMorph; + current.previousMorph = null; + current.nextMorph = null; + current.parentMorphList = null; + current = next; + } + + this.firstChildMorph = this.lastChildMorph = null; }; - exports.badAttributes = badAttributes; - var badAttributesForDataURI = { - 'src': true + prototype.destroy = function MorphList$destroy() {}; + + prototype.appendMorph = function MorphList$appendMorph(morph) { + this.insertBeforeMorph(morph, null); }; - function sanitizeAttributeValue(dom, element, attribute, value) { - var tagName; + prototype.insertBeforeMorph = function MorphList$insertBeforeMorph(morph, referenceMorph) { + if (morph.parentMorphList !== null) { + morph.unlink(); + } + if (referenceMorph && referenceMorph.parentMorphList !== this) { + throw new Error('The morph before which the new morph is to be inserted is not a child of this morph.'); + } - if (!element) { - tagName = null; + var mountedMorph = this.mountedMorph; + + if (mountedMorph) { + + var parentNode = mountedMorph.firstNode.parentNode; + var referenceNode = referenceMorph ? referenceMorph.firstNode : mountedMorph.lastNode.nextSibling; + + _utils.insertBefore(parentNode, morph.firstNode, morph.lastNode, referenceNode); + + // was not in list mode replace current content + if (!this.firstChildMorph) { + _utils.clear(this.mountedMorph.firstNode.parentNode, this.mountedMorph.firstNode, this.mountedMorph.lastNode); + } + } + + morph.parentMorphList = this; + + var previousMorph = referenceMorph ? referenceMorph.previousMorph : this.lastChildMorph; + if (previousMorph) { + previousMorph.nextMorph = morph; + morph.previousMorph = previousMorph; } else { - tagName = element.tagName.toUpperCase(); + this.firstChildMorph = morph; } - if (value && value.toHTML) { - return value.toHTML(); + if (referenceMorph) { + referenceMorph.previousMorph = morph; + morph.nextMorph = referenceMorph; + } else { + this.lastChildMorph = morph; } - if ((tagName === null || badTags[tagName]) && badAttributes[attribute]) { - var protocol = dom.protocolForURL(value); - if (badProtocols[protocol] === true) { - return 'unsafe:' + value; - } + this.firstChildMorph._syncFirstNode(); + this.lastChildMorph._syncLastNode(); + }; + + prototype.removeChildMorph = function MorphList$removeChildMorph(morph) { + if (morph.parentMorphList !== this) { + throw new Error("Cannot remove a morph from a parent it is not inside of"); } - if (badTagsForDataURI[tagName] && badAttributesForDataURI[attribute]) { - return 'unsafe:' + value; + morph.destroy(); + }; + + exports.default = MorphList; +}); +enifed('morph-range/morph-list.umd', ['exports', './morph-list'], function (exports, _morphList) { + 'use strict'; + + (function (root, factory) { + if (typeof enifed === 'function' && enifed.amd) { + enifed([], factory); + } else if (typeof exports === 'object') { + module.exports = factory(); + } else { + root.MorphList = factory(); } + })(undefined, function () { + return _morphList.default; + }); +}); +enifed("morph-range/utils", ["exports"], function (exports) { + // inclusive of both nodes + "use strict"; - return value; + exports.clear = clear; + exports.insertBefore = insertBefore; + + function clear(parentNode, firstNode, lastNode) { + if (!parentNode) { + return; + } + + var node = firstNode; + var nextNode; + do { + nextNode = node.nextSibling; + parentNode.removeChild(node); + if (node === lastNode) { + break; + } + node = nextNode; + } while (node); } + + function insertBefore(parentNode, firstNode, lastNode, refNode) { + var node = firstNode; + var nextNode; + do { + nextNode = node.nextSibling; + parentNode.insertBefore(node, refNode); + if (node === lastNode) { + break; + } + node = nextNode; + } while (node); + } }); enifed('morph-range', ['exports', './morph-range/utils'], function (exports, _morphRangeUtils) { 'use strict'; // constructor just initializes the fields @@ -47045,12 +47187,12 @@ case 'object': if (typeof content.nodeType === 'number') { return this.setNode(content); } /* Handlebars.SafeString */ - if (typeof content.string === 'string') { - return this.setHTML(content.string); + if (typeof content.toHTML === 'function') { + return this.setHTML(content.toHTML()); } if (this.parseTextAsHTML) { return this.setHTML(content.toString()); } /* falls through */ @@ -47251,148 +47393,117 @@ _morphRangeUtils.insertBefore(parentNode, this.firstNode, this.lastNode, null); }; exports.default = Morph; }); -enifed('morph-range/morph-list', ['exports', './utils'], function (exports, _utils) { - 'use strict'; +enifed("route-recognizer/dsl", ["exports"], function (exports) { + "use strict"; - function MorphList() { - // morph graph - this.firstChildMorph = null; - this.lastChildMorph = null; - - this.mountedMorph = null; + function Target(path, matcher, delegate) { + this.path = path; + this.matcher = matcher; + this.delegate = delegate; } - var prototype = MorphList.prototype; + Target.prototype = { + to: function (target, callback) { + var delegate = this.delegate; - prototype.clear = function MorphList$clear() { - var current = this.firstChildMorph; + if (delegate && delegate.willAddRoute) { + target = delegate.willAddRoute(this.matcher.target, target); + } - while (current) { - var next = current.nextMorph; - current.previousMorph = null; - current.nextMorph = null; - current.parentMorphList = null; - current = next; - } + this.matcher.add(this.path, target); - this.firstChildMorph = this.lastChildMorph = null; + if (callback) { + if (callback.length === 0) { + throw new Error("You must have an argument in the function passed to `to`"); + } + this.matcher.addChild(this.path, target, callback, this.delegate); + } + return this; + } }; - prototype.destroy = function MorphList$destroy() {}; + function Matcher(target) { + this.routes = {}; + this.children = {}; + this.target = target; + } - prototype.appendMorph = function MorphList$appendMorph(morph) { - this.insertBeforeMorph(morph, null); - }; + Matcher.prototype = { + add: function (path, handler) { + this.routes[path] = handler; + }, - prototype.insertBeforeMorph = function MorphList$insertBeforeMorph(morph, referenceMorph) { - if (morph.parentMorphList !== null) { - morph.unlink(); - } - if (referenceMorph && referenceMorph.parentMorphList !== this) { - throw new Error('The morph before which the new morph is to be inserted is not a child of this morph.'); - } + addChild: function (path, target, callback, delegate) { + var matcher = new Matcher(target); + this.children[path] = matcher; - var mountedMorph = this.mountedMorph; + var match = generateMatch(path, matcher, delegate); - if (mountedMorph) { - - var parentNode = mountedMorph.firstNode.parentNode; - var referenceNode = referenceMorph ? referenceMorph.firstNode : mountedMorph.lastNode.nextSibling; - - _utils.insertBefore(parentNode, morph.firstNode, morph.lastNode, referenceNode); - - // was not in list mode replace current content - if (!this.firstChildMorph) { - _utils.clear(this.mountedMorph.firstNode.parentNode, this.mountedMorph.firstNode, this.mountedMorph.lastNode); + if (delegate && delegate.contextEntered) { + delegate.contextEntered(target, match); } - } - morph.parentMorphList = this; - - var previousMorph = referenceMorph ? referenceMorph.previousMorph : this.lastChildMorph; - if (previousMorph) { - previousMorph.nextMorph = morph; - morph.previousMorph = previousMorph; - } else { - this.firstChildMorph = morph; + callback(match); } + }; - if (referenceMorph) { - referenceMorph.previousMorph = morph; - morph.nextMorph = referenceMorph; - } else { - this.lastChildMorph = morph; - } + function generateMatch(startingPath, matcher, delegate) { + return function (path, nestedCallback) { + var fullPath = startingPath + path; - this.firstChildMorph._syncFirstNode(); - this.lastChildMorph._syncLastNode(); - }; + if (nestedCallback) { + nestedCallback(generateMatch(fullPath, matcher, delegate)); + } else { + return new Target(startingPath + path, matcher, delegate); + } + }; + } - prototype.removeChildMorph = function MorphList$removeChildMorph(morph) { - if (morph.parentMorphList !== this) { - throw new Error("Cannot remove a morph from a parent it is not inside of"); + function addRoute(routeArray, path, handler) { + var len = 0; + for (var i = 0, l = routeArray.length; i < l; i++) { + len += routeArray[i].path.length; } - morph.destroy(); - }; + path = path.substr(len); + var route = { path: path, handler: handler }; + routeArray.push(route); + } - exports.default = MorphList; -}); -enifed('morph-range/morph-list.umd', ['exports', './morph-list'], function (exports, _morphList) { - 'use strict'; + function eachRoute(baseRoute, matcher, callback, binding) { + var routes = matcher.routes; - (function (root, factory) { - if (typeof enifed === 'function' && enifed.amd) { - enifed([], factory); - } else if (typeof exports === 'object') { - module.exports = factory(); - } else { - root.MorphList = factory(); + for (var path in routes) { + if (routes.hasOwnProperty(path)) { + var routeArray = baseRoute.slice(); + addRoute(routeArray, path, routes[path]); + + if (matcher.children[path]) { + eachRoute(routeArray, matcher.children[path], callback, binding); + } else { + callback.call(binding, routeArray); + } + } } - })(undefined, function () { - return _morphList.default; - }); -}); -enifed("morph-range/utils", ["exports"], function (exports) { - // inclusive of both nodes - "use strict"; + } - exports.clear = clear; - exports.insertBefore = insertBefore; + exports.default = function (callback, addRouteCallback) { + var matcher = new Matcher(); - function clear(parentNode, firstNode, lastNode) { - if (!parentNode) { - return; - } + callback(generateMatch("", matcher, this.delegate)); - var node = firstNode; - var nextNode; - do { - nextNode = node.nextSibling; - parentNode.removeChild(node); - if (node === lastNode) { - break; + eachRoute([], matcher, function (route) { + if (addRouteCallback) { + addRouteCallback(this, route); + } else { + this.add(route); } - node = nextNode; - } while (node); - } - - function insertBefore(parentNode, firstNode, lastNode, refNode) { - var node = firstNode; - var nextNode; - do { - nextNode = node.nextSibling; - parentNode.insertBefore(node, refNode); - if (node === lastNode) { - break; - } - node = nextNode; - } while (node); - } + }, this); + }; }); enifed('route-recognizer', ['exports', './route-recognizer/dsl'], function (exports, _routeRecognizerDsl) { 'use strict'; var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\']; @@ -47989,123 +48100,133 @@ RouteRecognizer.VERSION = '0.1.5'; exports.default = RouteRecognizer; }); -enifed("route-recognizer/dsl", ["exports"], function (exports) { - "use strict"; +enifed('router/handler-info/factory', ['exports', 'router/handler-info/resolved-handler-info', 'router/handler-info/unresolved-handler-info-by-object', 'router/handler-info/unresolved-handler-info-by-param'], function (exports, _routerHandlerInfoResolvedHandlerInfo, _routerHandlerInfoUnresolvedHandlerInfoByObject, _routerHandlerInfoUnresolvedHandlerInfoByParam) { + 'use strict'; - function Target(path, matcher, delegate) { - this.path = path; - this.matcher = matcher; - this.delegate = delegate; + handlerInfoFactory.klasses = { + resolved: _routerHandlerInfoResolvedHandlerInfo.default, + param: _routerHandlerInfoUnresolvedHandlerInfoByParam.default, + object: _routerHandlerInfoUnresolvedHandlerInfoByObject.default + }; + + function handlerInfoFactory(name, props) { + var Ctor = handlerInfoFactory.klasses[name], + handlerInfo = new Ctor(props || {}); + handlerInfo.factory = handlerInfoFactory; + return handlerInfo; } - Target.prototype = { - to: function (target, callback) { - var delegate = this.delegate; + exports.default = handlerInfoFactory; +}); +enifed('router/handler-info/resolved-handler-info', ['exports', '../handler-info', 'router/utils', 'rsvp/promise'], function (exports, _handlerInfo, _routerUtils, _rsvpPromise) { + 'use strict'; - if (delegate && delegate.willAddRoute) { - target = delegate.willAddRoute(this.matcher.target, target); + var ResolvedHandlerInfo = _routerUtils.subclass(_handlerInfo.default, { + resolve: function (shouldContinue, payload) { + // A ResolvedHandlerInfo just resolved with itself. + if (payload && payload.resolvedModels) { + payload.resolvedModels[this.name] = this.context; } + return _rsvpPromise.default.resolve(this, this.promiseLabel("Resolve")); + }, - this.matcher.add(this.path, target); + getUnresolved: function () { + return this.factory('param', { + name: this.name, + handler: this.handler, + params: this.params + }); + }, - if (callback) { - if (callback.length === 0) { - throw new Error("You must have an argument in the function passed to `to`"); - } - this.matcher.addChild(this.path, target, callback, this.delegate); - } - return this; - } - }; + isResolved: true + }); - function Matcher(target) { - this.routes = {}; - this.children = {}; - this.target = target; - } + exports.default = ResolvedHandlerInfo; +}); +enifed('router/handler-info/unresolved-handler-info-by-object', ['exports', '../handler-info', 'router/utils', 'rsvp/promise'], function (exports, _handlerInfo, _routerUtils, _rsvpPromise) { + 'use strict'; - Matcher.prototype = { - add: function (path, handler) { - this.routes[path] = handler; + var UnresolvedHandlerInfoByObject = _routerUtils.subclass(_handlerInfo.default, { + getModel: function (payload) { + this.log(payload, this.name + ": resolving provided model"); + return _rsvpPromise.default.resolve(this.context); }, - addChild: function (path, target, callback, delegate) { - var matcher = new Matcher(target); - this.children[path] = matcher; + initialize: function (props) { + this.names = props.names || []; + this.context = props.context; + }, - var match = generateMatch(path, matcher, delegate); + /** + @private + Serializes a handler using its custom `serialize` method or + by a default that looks up the expected property name from + the dynamic segment. + @param {Object} model the model to be serialized for this handler + */ + serialize: function (_model) { + var model = _model || this.context, + names = this.names, + handler = this.handler; - if (delegate && delegate.contextEntered) { - delegate.contextEntered(target, match); + var object = {}; + if (_routerUtils.isParam(model)) { + object[names[0]] = model; + return object; } - callback(match); - } - }; + // Use custom serialize if it exists. + if (handler.serialize) { + return handler.serialize(model, names); + } - function generateMatch(startingPath, matcher, delegate) { - return function (path, nestedCallback) { - var fullPath = startingPath + path; + if (names.length !== 1) { + return; + } - if (nestedCallback) { - nestedCallback(generateMatch(fullPath, matcher, delegate)); + var name = names[0]; + + if (/_id$/.test(name)) { + object[name] = model.id; } else { - return new Target(startingPath + path, matcher, delegate); + object[name] = model; } - }; - } - - function addRoute(routeArray, path, handler) { - var len = 0; - for (var i = 0, l = routeArray.length; i < l; i++) { - len += routeArray[i].path.length; + return object; } + }); - path = path.substr(len); - var route = { path: path, handler: handler }; - routeArray.push(route); - } + exports.default = UnresolvedHandlerInfoByObject; +}); +enifed('router/handler-info/unresolved-handler-info-by-param', ['exports', '../handler-info', 'router/utils'], function (exports, _handlerInfo, _routerUtils) { + 'use strict'; - function eachRoute(baseRoute, matcher, callback, binding) { - var routes = matcher.routes; + // Generated by URL transitions and non-dynamic route segments in named Transitions. + var UnresolvedHandlerInfoByParam = _routerUtils.subclass(_handlerInfo.default, { + initialize: function (props) { + this.params = props.params || {}; + }, - for (var path in routes) { - if (routes.hasOwnProperty(path)) { - var routeArray = baseRoute.slice(); - addRoute(routeArray, path, routes[path]); - - if (matcher.children[path]) { - eachRoute(routeArray, matcher.children[path], callback, binding); - } else { - callback.call(binding, routeArray); - } + getModel: function (payload) { + var fullParams = this.params; + if (payload && payload.queryParams) { + fullParams = {}; + _routerUtils.merge(fullParams, this.params); + fullParams.queryParams = payload.queryParams; } - } - } - exports.default = function (callback, addRouteCallback) { - var matcher = new Matcher(); + var handler = this.handler; + var hookName = _routerUtils.resolveHook(handler, 'deserialize') || _routerUtils.resolveHook(handler, 'model'); - callback(generateMatch("", matcher, this.delegate)); + return this.runSharedModelHook(payload, hookName, [fullParams]); + } + }); - eachRoute([], matcher, function (route) { - if (addRouteCallback) { - addRouteCallback(this, route); - } else { - this.add(route); - } - }, this); - }; + exports.default = UnresolvedHandlerInfoByParam; }); -enifed('router', ['exports', './router/router'], function (exports, _routerRouter) { - 'use strict'; - - exports.default = _routerRouter.default; -}); enifed('router/handler-info', ['exports', './utils', 'rsvp/promise'], function (exports, _utils, _rsvpPromise) { 'use strict'; function HandlerInfo(_props) { var props = _props || {}; @@ -48262,133 +48383,10 @@ return true; } exports.default = HandlerInfo; }); -enifed('router/handler-info/factory', ['exports', 'router/handler-info/resolved-handler-info', 'router/handler-info/unresolved-handler-info-by-object', 'router/handler-info/unresolved-handler-info-by-param'], function (exports, _routerHandlerInfoResolvedHandlerInfo, _routerHandlerInfoUnresolvedHandlerInfoByObject, _routerHandlerInfoUnresolvedHandlerInfoByParam) { - 'use strict'; - - handlerInfoFactory.klasses = { - resolved: _routerHandlerInfoResolvedHandlerInfo.default, - param: _routerHandlerInfoUnresolvedHandlerInfoByParam.default, - object: _routerHandlerInfoUnresolvedHandlerInfoByObject.default - }; - - function handlerInfoFactory(name, props) { - var Ctor = handlerInfoFactory.klasses[name], - handlerInfo = new Ctor(props || {}); - handlerInfo.factory = handlerInfoFactory; - return handlerInfo; - } - - exports.default = handlerInfoFactory; -}); -enifed('router/handler-info/resolved-handler-info', ['exports', '../handler-info', 'router/utils', 'rsvp/promise'], function (exports, _handlerInfo, _routerUtils, _rsvpPromise) { - 'use strict'; - - var ResolvedHandlerInfo = _routerUtils.subclass(_handlerInfo.default, { - resolve: function (shouldContinue, payload) { - // A ResolvedHandlerInfo just resolved with itself. - if (payload && payload.resolvedModels) { - payload.resolvedModels[this.name] = this.context; - } - return _rsvpPromise.default.resolve(this, this.promiseLabel("Resolve")); - }, - - getUnresolved: function () { - return this.factory('param', { - name: this.name, - handler: this.handler, - params: this.params - }); - }, - - isResolved: true - }); - - exports.default = ResolvedHandlerInfo; -}); -enifed('router/handler-info/unresolved-handler-info-by-object', ['exports', '../handler-info', 'router/utils', 'rsvp/promise'], function (exports, _handlerInfo, _routerUtils, _rsvpPromise) { - 'use strict'; - - var UnresolvedHandlerInfoByObject = _routerUtils.subclass(_handlerInfo.default, { - getModel: function (payload) { - this.log(payload, this.name + ": resolving provided model"); - return _rsvpPromise.default.resolve(this.context); - }, - - initialize: function (props) { - this.names = props.names || []; - this.context = props.context; - }, - - /** - @private - Serializes a handler using its custom `serialize` method or - by a default that looks up the expected property name from - the dynamic segment. - @param {Object} model the model to be serialized for this handler - */ - serialize: function (_model) { - var model = _model || this.context, - names = this.names, - handler = this.handler; - - var object = {}; - if (_routerUtils.isParam(model)) { - object[names[0]] = model; - return object; - } - - // Use custom serialize if it exists. - if (handler.serialize) { - return handler.serialize(model, names); - } - - if (names.length !== 1) { - return; - } - - var name = names[0]; - - if (/_id$/.test(name)) { - object[name] = model.id; - } else { - object[name] = model; - } - return object; - } - }); - - exports.default = UnresolvedHandlerInfoByObject; -}); -enifed('router/handler-info/unresolved-handler-info-by-param', ['exports', '../handler-info', 'router/utils'], function (exports, _handlerInfo, _routerUtils) { - 'use strict'; - - // Generated by URL transitions and non-dynamic route segments in named Transitions. - var UnresolvedHandlerInfoByParam = _routerUtils.subclass(_handlerInfo.default, { - initialize: function (props) { - this.params = props.params || {}; - }, - - getModel: function (payload) { - var fullParams = this.params; - if (payload && payload.queryParams) { - fullParams = {}; - _routerUtils.merge(fullParams, this.params); - fullParams.queryParams = payload.queryParams; - } - - var handler = this.handler; - var hookName = _routerUtils.resolveHook(handler, 'deserialize') || _routerUtils.resolveHook(handler, 'model'); - - return this.runSharedModelHook(payload, hookName, [fullParams]); - } - }); - - exports.default = UnresolvedHandlerInfoByParam; -}); enifed('router/router', ['exports', 'route-recognizer', 'rsvp/promise', './utils', './transition-state', './transition', './transition-intent/named-transition-intent', './transition-intent/url-transition-intent', './handler-info'], function (exports, _routeRecognizer, _rsvpPromise, _utils, _transitionState, _transition, _transitionIntentNamedTransitionIntent, _transitionIntentUrlTransitionIntent, _handlerInfo) { 'use strict'; var pop = Array.prototype.pop; @@ -49190,27 +49188,10 @@ } } exports.default = Router; }); -enifed('router/transition-intent', ['exports', './utils'], function (exports, _utils) { - 'use strict'; - - function TransitionIntent(props) { - this.initialize(props); - - // TODO: wat - this.data = this.data || {}; - } - - TransitionIntent.prototype = { - initialize: null, - applyToState: null - }; - - exports.default = TransitionIntent; -}); enifed('router/transition-intent/named-transition-intent', ['exports', '../transition-intent', '../transition-state', '../handler-info/factory', '../utils'], function (exports, _transitionIntent, _transitionState, _handlerInfoFactory, _utils) { 'use strict'; exports.default = _utils.subclass(_transitionIntent.default, { name: null, @@ -49453,10 +49434,27 @@ return newState; } }); }); +enifed('router/transition-intent', ['exports', './utils'], function (exports, _utils) { + 'use strict'; + + function TransitionIntent(props) { + this.initialize(props); + + // TODO: wat + this.data = this.data || {}; + } + + TransitionIntent.prototype = { + initialize: null, + applyToState: null + }; + + exports.default = TransitionIntent; +}); enifed('router/transition-state', ['exports', './handler-info', './utils', 'rsvp/promise'], function (exports, _handlerInfo, _utils, _rsvpPromise) { 'use strict'; function TransitionState(other) { this.handlerInfos = []; @@ -50110,97 +50108,15 @@ exports.coerceQueryParamsToString = coerceQueryParamsToString; exports.callHook = callHook; exports.resolveHook = resolveHook; exports.applyHook = applyHook; }); -enifed('rsvp', ['exports', './rsvp/promise', './rsvp/events', './rsvp/node', './rsvp/all', './rsvp/all-settled', './rsvp/race', './rsvp/hash', './rsvp/hash-settled', './rsvp/rethrow', './rsvp/defer', './rsvp/config', './rsvp/map', './rsvp/resolve', './rsvp/reject', './rsvp/filter', './rsvp/asap'], function (exports, _rsvpPromise, _rsvpEvents, _rsvpNode, _rsvpAll, _rsvpAllSettled, _rsvpRace, _rsvpHash, _rsvpHashSettled, _rsvpRethrow, _rsvpDefer, _rsvpConfig, _rsvpMap, _rsvpResolve, _rsvpReject, _rsvpFilter, _rsvpAsap) { +enifed('router', ['exports', './router/router'], function (exports, _routerRouter) { 'use strict'; - // defaults - _rsvpConfig.config.async = _rsvpAsap.default; - _rsvpConfig.config.after = function (cb) { - setTimeout(cb, 0); - }; - var cast = _rsvpResolve.default; - function async(callback, arg) { - _rsvpConfig.config.async(callback, arg); - } - - function on() { - _rsvpConfig.config['on'].apply(_rsvpConfig.config, arguments); - } - - function off() { - _rsvpConfig.config['off'].apply(_rsvpConfig.config, arguments); - } - - // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__` - if (typeof window !== 'undefined' && typeof window['__PROMISE_INSTRUMENTATION__'] === 'object') { - var callbacks = window['__PROMISE_INSTRUMENTATION__']; - _rsvpConfig.configure('instrument', true); - for (var eventName in callbacks) { - if (callbacks.hasOwnProperty(eventName)) { - on(eventName, callbacks[eventName]); - } - } - } - - exports.cast = cast; - exports.Promise = _rsvpPromise.default; - exports.EventTarget = _rsvpEvents.default; - exports.all = _rsvpAll.default; - exports.allSettled = _rsvpAllSettled.default; - exports.race = _rsvpRace.default; - exports.hash = _rsvpHash.default; - exports.hashSettled = _rsvpHashSettled.default; - exports.rethrow = _rsvpRethrow.default; - exports.defer = _rsvpDefer.default; - exports.denodeify = _rsvpNode.default; - exports.configure = _rsvpConfig.configure; - exports.on = on; - exports.off = off; - exports.resolve = _rsvpResolve.default; - exports.reject = _rsvpReject.default; - exports.async = async; - exports.map = _rsvpMap.default; - exports.filter = _rsvpFilter.default; + exports.default = _routerRouter.default; }); -enifed('rsvp.umd', ['exports', './rsvp/platform', './rsvp'], function (exports, _rsvpPlatform, _rsvp) { - 'use strict'; - - var RSVP = { - 'race': _rsvp.race, - 'Promise': _rsvp.Promise, - 'allSettled': _rsvp.allSettled, - 'hash': _rsvp.hash, - 'hashSettled': _rsvp.hashSettled, - 'denodeify': _rsvp.denodeify, - 'on': _rsvp.on, - 'off': _rsvp.off, - 'map': _rsvp.map, - 'filter': _rsvp.filter, - 'resolve': _rsvp.resolve, - 'reject': _rsvp.reject, - 'all': _rsvp.all, - 'rethrow': _rsvp.rethrow, - 'defer': _rsvp.defer, - 'EventTarget': _rsvp.EventTarget, - 'configure': _rsvp.configure, - 'async': _rsvp.async - }; - - /* global define:true module:true window: true */ - if (typeof enifed === 'function' && enifed['amd']) { - enifed(function () { - return RSVP; - }); - } else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = RSVP; - } else if (typeof _rsvpPlatform.default !== 'undefined') { - _rsvpPlatform.default['RSVP'] = RSVP; - } -}); enifed('rsvp/-internal', ['exports', './utils', './instrument', './config'], function (exports, _utils, _instrument, _config) { 'use strict'; function withOwnPromise() { return new TypeError('A promises callback cannot return that same promise.'); @@ -51844,10 +51760,267 @@ throw new Error('no global: `self` or `global` found'); } exports.default = platform; }); +enifed('rsvp/promise/all', ['exports', '../enumerator'], function (exports, _enumerator) { + 'use strict'; + + exports.default = all; + + /** + `RSVP.Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + var promise1 = RSVP.resolve(1); + var promise2 = RSVP.resolve(2); + var promise3 = RSVP.resolve(3); + var promises = [ promise1, promise2, promise3 ]; + + RSVP.Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `RSVP.all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + var promise1 = RSVP.resolve(1); + var promise2 = RSVP.reject(new Error("2")); + var promise3 = RSVP.reject(new Error("3")); + var promises = [ promise1, promise2, promise3 ]; + + RSVP.Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static + */ + + function all(entries, label) { + return new _enumerator.default(this, entries, true, /* abort on reject */label).promise; + } +}); +enifed('rsvp/promise/race', ['exports', '../utils', '../-internal'], function (exports, _utils, _internal) { + 'use strict'; + + exports.default = race; + + /** + `RSVP.Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + var promise1 = new RSVP.Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + var promise2 = new RSVP.Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + RSVP.Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `RSVP.Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + var promise1 = new RSVP.Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + var promise2 = new RSVP.Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + RSVP.Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + RSVP.Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} entries array of promises to observe + @param {String} label optional string for describing the promise returned. + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. + */ + + function race(entries, label) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(_internal.noop, label); + + if (!_utils.isArray(entries)) { + _internal.reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + _internal.resolve(promise, value); + } + + function onRejection(reason) { + _internal.reject(promise, reason); + } + + for (var i = 0; promise._state === _internal.PENDING && i < length; i++) { + _internal.subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } +}); +enifed('rsvp/promise/reject', ['exports', '../-internal'], function (exports, _internal) { + 'use strict'; + + exports.default = reject; + + /** + `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + var promise = new RSVP.Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + var promise = RSVP.Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {*} reason value that the returned promise will be rejected with. + @param {String} label optional string for identifying the returned promise. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. + */ + + function reject(reason, label) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(_internal.noop, label); + _internal.reject(promise, reason); + return promise; + } +}); +enifed('rsvp/promise/resolve', ['exports', '../-internal'], function (exports, _internal) { + 'use strict'; + + exports.default = resolve; + + /** + `RSVP.Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + var promise = new RSVP.Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + var promise = RSVP.Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {*} object value that the returned promise will be resolved with + @param {String} label optional string for identifying the returned promise. + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + + function resolve(object, label) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(_internal.noop, label); + _internal.resolve(promise, object); + return promise; + } +}); enifed('rsvp/promise-hash', ['exports', './enumerator', './-internal', './utils'], function (exports, _enumerator, _internal, _utils) { 'use strict'; function PromiseHash(Constructor, object, label) { this._superConstructor(Constructor, object, true, label); @@ -52373,267 +52546,10 @@ }); }, label); } }; }); -enifed('rsvp/promise/all', ['exports', '../enumerator'], function (exports, _enumerator) { - 'use strict'; - - exports.default = all; - - /** - `RSVP.Promise.all` accepts an array of promises, and returns a new promise which - is fulfilled with an array of fulfillment values for the passed promises, or - rejected with the reason of the first passed promise to be rejected. It casts all - elements of the passed iterable to promises as it runs this algorithm. - - Example: - - ```javascript - var promise1 = RSVP.resolve(1); - var promise2 = RSVP.resolve(2); - var promise3 = RSVP.resolve(3); - var promises = [ promise1, promise2, promise3 ]; - - RSVP.Promise.all(promises).then(function(array){ - // The array here would be [ 1, 2, 3 ]; - }); - ``` - - If any of the `promises` given to `RSVP.all` are rejected, the first promise - that is rejected will be given as an argument to the returned promises's - rejection handler. For example: - - Example: - - ```javascript - var promise1 = RSVP.resolve(1); - var promise2 = RSVP.reject(new Error("2")); - var promise3 = RSVP.reject(new Error("3")); - var promises = [ promise1, promise2, promise3 ]; - - RSVP.Promise.all(promises).then(function(array){ - // Code here never runs because there are rejected promises! - }, function(error) { - // error.message === "2" - }); - ``` - - @method all - @static - @param {Array} entries array of promises - @param {String} label optional string for labeling the promise. - Useful for tooling. - @return {Promise} promise that is fulfilled when all `promises` have been - fulfilled, or rejected if any of them become rejected. - @static - */ - - function all(entries, label) { - return new _enumerator.default(this, entries, true, /* abort on reject */label).promise; - } -}); -enifed('rsvp/promise/race', ['exports', '../utils', '../-internal'], function (exports, _utils, _internal) { - 'use strict'; - - exports.default = race; - - /** - `RSVP.Promise.race` returns a new promise which is settled in the same way as the - first passed promise to settle. - - Example: - - ```javascript - var promise1 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - var promise2 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 2'); - }, 100); - }); - - RSVP.Promise.race([promise1, promise2]).then(function(result){ - // result === 'promise 2' because it was resolved before promise1 - // was resolved. - }); - ``` - - `RSVP.Promise.race` is deterministic in that only the state of the first - settled promise matters. For example, even if other promises given to the - `promises` array argument are resolved, but the first settled promise has - become rejected before the other promises became fulfilled, the returned - promise will become rejected: - - ```javascript - var promise1 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - var promise2 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - reject(new Error('promise 2')); - }, 100); - }); - - RSVP.Promise.race([promise1, promise2]).then(function(result){ - // Code here never runs - }, function(reason){ - // reason.message === 'promise 2' because promise 2 became rejected before - // promise 1 became fulfilled - }); - ``` - - An example real-world use case is implementing timeouts: - - ```javascript - RSVP.Promise.race([ajax('foo.json'), timeout(5000)]) - ``` - - @method race - @static - @param {Array} entries array of promises to observe - @param {String} label optional string for describing the promise returned. - Useful for tooling. - @return {Promise} a promise which settles in the same way as the first passed - promise to settle. - */ - - function race(entries, label) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(_internal.noop, label); - - if (!_utils.isArray(entries)) { - _internal.reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - _internal.resolve(promise, value); - } - - function onRejection(reason) { - _internal.reject(promise, reason); - } - - for (var i = 0; promise._state === _internal.PENDING && i < length; i++) { - _internal.subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; - } -}); -enifed('rsvp/promise/reject', ['exports', '../-internal'], function (exports, _internal) { - 'use strict'; - - exports.default = reject; - - /** - `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. - It is shorthand for the following: - - ```javascript - var promise = new RSVP.Promise(function(resolve, reject){ - reject(new Error('WHOOPS')); - }); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - var promise = RSVP.Promise.reject(new Error('WHOOPS')); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - @method reject - @static - @param {*} reason value that the returned promise will be rejected with. - @param {String} label optional string for identifying the returned promise. - Useful for tooling. - @return {Promise} a promise rejected with the given `reason`. - */ - - function reject(reason, label) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(_internal.noop, label); - _internal.reject(promise, reason); - return promise; - } -}); -enifed('rsvp/promise/resolve', ['exports', '../-internal'], function (exports, _internal) { - 'use strict'; - - exports.default = resolve; - - /** - `RSVP.Promise.resolve` returns a promise that will become resolved with the - passed `value`. It is shorthand for the following: - - ```javascript - var promise = new RSVP.Promise(function(resolve, reject){ - resolve(1); - }); - - promise.then(function(value){ - // value === 1 - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - var promise = RSVP.Promise.resolve(1); - - promise.then(function(value){ - // value === 1 - }); - ``` - - @method resolve - @static - @param {*} object value that the returned promise will be resolved with - @param {String} label optional string for identifying the returned promise. - Useful for tooling. - @return {Promise} a promise that will become fulfilled with the given - `value` - */ - - function resolve(object, label) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(_internal.noop, label); - _internal.resolve(promise, object); - return promise; - } -}); enifed('rsvp/race', ['exports', './promise'], function (exports, _promise) { 'use strict'; exports.default = race; @@ -52797,8 +52713,92 @@ F.prototype = o; return new F(); }; exports.o_create = o_create; }); -requireModule("ember"); +enifed('rsvp', ['exports', './rsvp/promise', './rsvp/events', './rsvp/node', './rsvp/all', './rsvp/all-settled', './rsvp/race', './rsvp/hash', './rsvp/hash-settled', './rsvp/rethrow', './rsvp/defer', './rsvp/config', './rsvp/map', './rsvp/resolve', './rsvp/reject', './rsvp/filter', './rsvp/asap'], function (exports, _rsvpPromise, _rsvpEvents, _rsvpNode, _rsvpAll, _rsvpAllSettled, _rsvpRace, _rsvpHash, _rsvpHashSettled, _rsvpRethrow, _rsvpDefer, _rsvpConfig, _rsvpMap, _rsvpResolve, _rsvpReject, _rsvpFilter, _rsvpAsap) { + 'use strict'; -})();//# sourceMappingURL=ember.map + // defaults + _rsvpConfig.config.async = _rsvpAsap.default; + _rsvpConfig.config.after = function (cb) { + setTimeout(cb, 0); + }; + var cast = _rsvpResolve.default; + function async(callback, arg) { + _rsvpConfig.config.async(callback, arg); + } + + function on() { + _rsvpConfig.config['on'].apply(_rsvpConfig.config, arguments); + } + + function off() { + _rsvpConfig.config['off'].apply(_rsvpConfig.config, arguments); + } + + // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__` + if (typeof window !== 'undefined' && typeof window['__PROMISE_INSTRUMENTATION__'] === 'object') { + var callbacks = window['__PROMISE_INSTRUMENTATION__']; + _rsvpConfig.configure('instrument', true); + for (var eventName in callbacks) { + if (callbacks.hasOwnProperty(eventName)) { + on(eventName, callbacks[eventName]); + } + } + } + + exports.cast = cast; + exports.Promise = _rsvpPromise.default; + exports.EventTarget = _rsvpEvents.default; + exports.all = _rsvpAll.default; + exports.allSettled = _rsvpAllSettled.default; + exports.race = _rsvpRace.default; + exports.hash = _rsvpHash.default; + exports.hashSettled = _rsvpHashSettled.default; + exports.rethrow = _rsvpRethrow.default; + exports.defer = _rsvpDefer.default; + exports.denodeify = _rsvpNode.default; + exports.configure = _rsvpConfig.configure; + exports.on = on; + exports.off = off; + exports.resolve = _rsvpResolve.default; + exports.reject = _rsvpReject.default; + exports.async = async; + exports.map = _rsvpMap.default; + exports.filter = _rsvpFilter.default; +}); +enifed('rsvp.umd', ['exports', './rsvp/platform', './rsvp'], function (exports, _rsvpPlatform, _rsvp) { + 'use strict'; + + var RSVP = { + 'race': _rsvp.race, + 'Promise': _rsvp.Promise, + 'allSettled': _rsvp.allSettled, + 'hash': _rsvp.hash, + 'hashSettled': _rsvp.hashSettled, + 'denodeify': _rsvp.denodeify, + 'on': _rsvp.on, + 'off': _rsvp.off, + 'map': _rsvp.map, + 'filter': _rsvp.filter, + 'resolve': _rsvp.resolve, + 'reject': _rsvp.reject, + 'all': _rsvp.all, + 'rethrow': _rsvp.rethrow, + 'defer': _rsvp.defer, + 'EventTarget': _rsvp.EventTarget, + 'configure': _rsvp.configure, + 'async': _rsvp.async + }; + + /* global define:true module:true window: true */ + if (typeof enifed === 'function' && enifed['amd']) { + enifed(function () { + return RSVP; + }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = RSVP; + } else if (typeof _rsvpPlatform.default !== 'undefined') { + _rsvpPlatform.default['RSVP'] = RSVP; + } +});//# sourceMappingURL=ember.map \ No newline at end of file