(function() {
/*!
* @overview Ember - JavaScript Application Framework
* @copyright Copyright 2011-2018 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 3.5.1
*/
/*globals process */
var enifed, requireModule, Ember;
// Used in ember-environment/lib/global.js
mainContext = this; // eslint-disable-line no-undef
(function() {
function missingModule(name, referrerName) {
if (referrerName) {
throw new Error('Could not find module ' + name + ' required by: ' + referrerName);
} else {
throw new Error('Could not find module ' + name);
}
}
function internalRequire(_name, referrerName) {
var name = _name;
var mod = registry[name];
if (!mod) {
name = name + '/index';
mod = registry[name];
}
var exports = seen[name];
if (exports !== undefined) {
return exports;
}
exports = seen[name] = {};
if (!mod) {
missingModule(_name, referrerName);
}
var deps = mod.deps;
var callback = mod.callback;
var reified = new Array(deps.length);
for (var i = 0; i < deps.length; i++) {
if (deps[i] === 'exports') {
reified[i] = exports;
} else if (deps[i] === 'require') {
reified[i] = requireModule;
} else {
reified[i] = internalRequire(deps[i], name);
}
}
callback.apply(this, reified);
return exports;
}
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;
};
requireModule = function(name) {
return internalRequire(name, null);
};
// setup `require` module
requireModule['default'] = requireModule;
requireModule.has = function registryHas(moduleName) {
return !!registry[moduleName] || !!registry[moduleName + '/index'];
};
requireModule._eak_seen = registry;
Ember.__loader = {
define: enifed,
require: requireModule,
registry: registry,
};
} else {
enifed = Ember.__loader.define;
requireModule = Ember.__loader.require;
}
})();
enifed('@ember/canary-features/index', ['exports', '@ember/polyfills', 'ember-environment'], function (exports, _polyfills, _emberEnvironment) {
'use strict';
exports.EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION = exports.EMBER_TEMPLATE_BLOCK_LET_HELPER = exports.GLIMMER_CUSTOM_COMPONENT_MANAGER = exports.EMBER_METAL_TRACKED_PROPERTIES = exports.EMBER_MODULE_UNIFICATION = exports.EMBER_ENGINES_MOUNT_PARAMS = exports.EMBER_ROUTING_ROUTER_SERVICE = exports.EMBER_GLIMMER_NAMED_ARGUMENTS = exports.EMBER_IMPROVED_INSTRUMENTATION = exports.EMBER_LIBRARIES_ISREGISTERED = exports.FEATURES = exports.DEFAULT_FEATURES = undefined;
exports.isEnabled =
/**
Determine whether the specified `feature` is enabled. Used by Ember's
build tools to exclude experimental features from beta/stable builds.
You can define the following configuration options:
* `EmberENV.ENABLE_OPTIONAL_FEATURES` - enable any features that have not been explicitly
enabled/disabled.
@method isEnabled
@param {String} feature The feature to check
@return {Boolean}
@for Ember.FEATURES
@since 1.1.0
@public
*/
function (feature) {
var featureValue = FEATURES[feature];
if (featureValue === true || featureValue === false) {
return featureValue;
} else if (_emberEnvironment.ENV.ENABLE_OPTIONAL_FEATURES) {
return true;
} else {
return false;
}
};
/**
@module ember/canary-features
@private
*/
var DEFAULT_FEATURES = exports.DEFAULT_FEATURES = {
EMBER_LIBRARIES_ISREGISTERED: false,
EMBER_IMPROVED_INSTRUMENTATION: false,
EMBER_GLIMMER_NAMED_ARGUMENTS: true,
EMBER_ROUTING_ROUTER_SERVICE: true,
EMBER_ENGINES_MOUNT_PARAMS: true,
EMBER_MODULE_UNIFICATION: false,
GLIMMER_CUSTOM_COMPONENT_MANAGER: true,
EMBER_TEMPLATE_BLOCK_LET_HELPER: true,
EMBER_METAL_TRACKED_PROPERTIES: false,
EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION: true
};
/**
The hash of enabled Canary features. Add to this, any canary features
before creating your application.
Alternatively (and recommended), you can also define `EmberENV.FEATURES`
if you need to enable features flagged at runtime.
@class FEATURES
@namespace Ember
@static
@since 1.1.0
@public
*/
var FEATURES = exports.FEATURES = (0, _polyfills.assign)(DEFAULT_FEATURES, _emberEnvironment.ENV.FEATURES);
function featureValue(value) {
if (_emberEnvironment.ENV.ENABLE_OPTIONAL_FEATURES && value === null) {
return true;
}
return value;
}
exports.EMBER_LIBRARIES_ISREGISTERED = featureValue(FEATURES.EMBER_LIBRARIES_ISREGISTERED);
exports.EMBER_IMPROVED_INSTRUMENTATION = featureValue(FEATURES.EMBER_IMPROVED_INSTRUMENTATION);
exports.EMBER_GLIMMER_NAMED_ARGUMENTS = featureValue(FEATURES.EMBER_GLIMMER_NAMED_ARGUMENTS);
exports.EMBER_ROUTING_ROUTER_SERVICE = featureValue(FEATURES.EMBER_ROUTING_ROUTER_SERVICE);
exports.EMBER_ENGINES_MOUNT_PARAMS = featureValue(FEATURES.EMBER_ENGINES_MOUNT_PARAMS);
exports.EMBER_MODULE_UNIFICATION = featureValue(FEATURES.EMBER_MODULE_UNIFICATION);
exports.EMBER_METAL_TRACKED_PROPERTIES = featureValue(FEATURES.EMBER_METAL_TRACKED_PROPERTIES);
exports.GLIMMER_CUSTOM_COMPONENT_MANAGER = featureValue(FEATURES.GLIMMER_CUSTOM_COMPONENT_MANAGER);
exports.EMBER_TEMPLATE_BLOCK_LET_HELPER = featureValue(FEATURES.EMBER_TEMPLATE_BLOCK_LET_HELPER);
exports.EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION = featureValue(FEATURES.EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION);
});
enifed('@ember/debug/index', ['exports', '@ember/debug/lib/warn', '@ember/debug/lib/deprecate', '@ember/debug/lib/testing', '@ember/error', 'ember-browser-environment'], function (exports, _warn2, _deprecate2, _testing, _error, _emberBrowserEnvironment) {
'use strict';
exports._warnIfUsingStrippedFeatureFlags = exports.getDebugFunction = exports.setDebugFunction = exports.deprecateFunc = exports.runInDebug = exports.debugFreeze = exports.debugSeal = exports.deprecate = exports.debug = exports.warn = exports.info = exports.assert = exports.setTesting = exports.isTesting = exports.registerDeprecationHandler = exports.registerWarnHandler = undefined;
Object.defineProperty(exports, 'registerWarnHandler', {
enumerable: true,
get: function () {
return _warn2.registerHandler;
}
});
Object.defineProperty(exports, 'registerDeprecationHandler', {
enumerable: true,
get: function () {
return _deprecate2.registerHandler;
}
});
Object.defineProperty(exports, 'isTesting', {
enumerable: true,
get: function () {
return _testing.isTesting;
}
});
Object.defineProperty(exports, 'setTesting', {
enumerable: true,
get: function () {
return _testing.setTesting;
}
});
// These are the default production build versions:
var noop = function () {};
var assert = noop;
var info = noop;
var warn = noop;
var debug = noop;
var deprecate = noop;
var debugSeal = noop;
var debugFreeze = noop;
var runInDebug = noop;
var setDebugFunction = noop;
var getDebugFunction = noop;
var deprecateFunc = function () {
return arguments[arguments.length - 1];
};
exports.setDebugFunction = setDebugFunction = function (type, callback) {
switch (type) {
case 'assert':
return exports.assert = assert = callback;
case 'info':
return exports.info = info = callback;
case 'warn':
return exports.warn = warn = callback;
case 'debug':
return exports.debug = debug = callback;
case 'deprecate':
return exports.deprecate = deprecate = callback;
case 'debugSeal':
return exports.debugSeal = debugSeal = callback;
case 'debugFreeze':
return exports.debugFreeze = debugFreeze = callback;
case 'runInDebug':
return exports.runInDebug = runInDebug = callback;
case 'deprecateFunc':
return exports.deprecateFunc = deprecateFunc = callback;
}
};
exports.getDebugFunction = getDebugFunction = function (type) {
switch (type) {
case 'assert':
return assert;
case 'info':
return info;
case 'warn':
return warn;
case 'debug':
return debug;
case 'deprecate':
return deprecate;
case 'debugSeal':
return debugSeal;
case 'debugFreeze':
return debugFreeze;
case 'runInDebug':
return runInDebug;
case 'deprecateFunc':
return deprecateFunc;
}
};
/**
@module @ember/debug
*/
/**
Verify that a certain expectation is met, or throw a exception otherwise.
This is useful for communicating assumptions in the code to other human
readers as well as catching bugs that accidentally violates these
expectations.
Assertions are removed from production builds, so they can be freely added
for documentation and debugging purposes without worries of incuring any
performance penalty. However, because of that, they should not be used for
checks that could reasonably fail during normal usage. Furthermore, care
should be taken to avoid accidentally relying on side-effects produced from
evaluating the condition itself, since the code will not run in production.
```javascript
import { assert } from '@ember/debug';
// Test for truthiness
assert('Must pass a string', typeof str === 'string');
// Fail unconditionally
assert('This code path should never be run');
```
@method assert
@static
@for @ember/debug
@param {String} description Describes the expectation. This will become the
text of the Error thrown if the assertion fails.
@param {Boolean} condition Must be truthy for the assertion to pass. If
falsy, an exception will be thrown.
@public
@since 1.0.0
*/
setDebugFunction('assert', function (desc, test) {
if (!test) {
throw new _error.default('Assertion Failed: ' + desc);
}
});
/**
Display a debug notice.
Calls to this function are removed from production builds, so they can be
freely added for documentation and debugging purposes without worries of
incuring any performance penalty.
```javascript
import { debug } from '@ember/debug';
debug('I\'m a debug notice!');
```
@method debug
@for @ember/debug
@static
@param {String} message A debug message to display.
@public
*/
setDebugFunction('debug', function (message) {
/* eslint-disable no-console */
if (console.debug) {
console.debug('DEBUG: ' + message);
} else {
console.log('DEBUG: ' + message);
}
/* eslint-ensable no-console */
});
/**
Display an info notice.
Calls to this function are removed from production builds, so they can be
freely added for documentation and debugging purposes without worries of
incuring any performance penalty.
@method info
@private
*/
setDebugFunction('info', function () {
var _console;
(_console = console).info.apply(_console, arguments); /* eslint-disable-line no-console */
});
/**
@module @ember/application
@public
*/
/**
Alias an old, deprecated method with its new counterpart.
Display a deprecation warning with the provided message and a stack trace
(Chrome and Firefox only) when the assigned method is called.
Calls to this function are removed from production builds, so they can be
freely added for documentation and debugging purposes without worries of
incuring any performance penalty.
```javascript
import { deprecateFunc } from '@ember/application/deprecations';
Ember.oldMethod = deprecateFunc('Please use the new, updated method', options, Ember.newMethod);
```
@method deprecateFunc
@static
@for @ember/application/deprecations
@param {String} message A description of the deprecation.
@param {Object} [options] The options object for `deprecate`.
@param {Function} func The new function called to replace its deprecated counterpart.
@return {Function} A new function that wraps the original function with a deprecation warning
@private
*/
setDebugFunction('deprecateFunc', function () {
var _len, args, _key, message, options, func, _message, _func;
for (_len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 3) {
message = args[0], options = args[1], func = args[2];
return function () {
deprecate(message, false, options);
return func.apply(this, arguments);
};
} else {
_message = args[0], _func = args[1];
return function () {
deprecate(_message);
return _func.apply(this, arguments);
};
}
});
/**
@module @ember/debug
@public
*/
/**
Run a function meant for debugging.
Calls to this function are removed from production builds, so they can be
freely added for documentation and debugging purposes without worries of
incuring any performance penalty.
```javascript
import Component from '@ember/component';
import { runInDebug } from '@ember/debug';
runInDebug(() => {
Component.reopen({
didInsertElement() {
console.log("I'm happy");
}
});
});
```
@method runInDebug
@for @ember/debug
@static
@param {Function} func The function to be executed.
@since 1.5.0
@public
*/
setDebugFunction('runInDebug', function (func) {
func();
});
setDebugFunction('debugSeal', function (obj) {
Object.seal(obj);
});
setDebugFunction('debugFreeze', function (obj) {
Object.freeze(obj);
});
setDebugFunction('deprecate', _deprecate2.default);
setDebugFunction('warn', _warn2.default);
if (true && !(0, _testing.isTesting)()) {
if (typeof window !== 'undefined' && (_emberBrowserEnvironment.isFirefox || _emberBrowserEnvironment.isChrome) && window.addEventListener) {
window.addEventListener('load', function () {
var downloadURL;
if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset.emberExtension) {
downloadURL = void 0;
if (_emberBrowserEnvironment.isChrome) {
downloadURL = 'https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi';
} else if (_emberBrowserEnvironment.isFirefox) {
downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/';
}
debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
}
}, false);
}
}
exports.assert = assert;
exports.info = info;
exports.warn = warn;
exports.debug = debug;
exports.deprecate = deprecate;
exports.debugSeal = debugSeal;
exports.debugFreeze = debugFreeze;
exports.runInDebug = runInDebug;
exports.deprecateFunc = deprecateFunc;
exports.setDebugFunction = setDebugFunction;
exports.getDebugFunction = getDebugFunction;
exports._warnIfUsingStrippedFeatureFlags = void 0;
});
enifed('@ember/debug/lib/deprecate', ['exports', '@ember/deprecated-features', 'ember-environment', '@ember/debug/index', '@ember/debug/lib/handlers'], function (exports, _deprecatedFeatures, _emberEnvironment, _index, _handlers) {
'use strict';
exports.missingOptionsUntilDeprecation = exports.missingOptionsIdDeprecation = exports.missingOptionsDeprecation = exports.registerHandler = undefined;
/**
@module @ember/debug
@public
*/
/**
Allows for runtime registration of handler functions that override the default deprecation behavior.
Deprecations are invoked by calls to [@ember/application/deprecations/deprecate](https://emberjs.com/api/ember/release/classes/@ember%2Fapplication%2Fdeprecations/methods/deprecate?anchor=deprecate).
The following example demonstrates its usage by registering a handler that throws an error if the
message contains the word "should", otherwise defers to the default handler.
```javascript
import { registerDeprecationHandler } from '@ember/debug';
registerDeprecationHandler((message, options, next) => {
if (message.indexOf('should') !== -1) {
throw new Error(`Deprecation message with should: ${message}`);
} else {
// defer to whatever handler was registered before this one
next(message, options);
}
});
```
The handler function takes the following arguments:
message - The message received from the deprecation call.
options - An object passed in with the deprecation call containing additional information including:
id - An id of the deprecation in the form of package-name.specific-deprecation.
until - The Ember version number the feature and deprecation will be removed in.
next - A function that calls into the previously registered handler.
@public
@static
@method registerDeprecationHandler
@for @ember/debug
@param handler {Function} A function to handle deprecation calls.
@since 2.1.0
*/
var registerHandler = function () {};
var missingOptionsDeprecation = void 0;
var missingOptionsIdDeprecation = void 0;
var missingOptionsUntilDeprecation = void 0;
var deprecate = function () {};
exports.registerHandler = registerHandler = function (handler) {
(0, _handlers.registerHandler)('deprecate', handler);
};
var formatMessage = function (_message, options) {
var message = _message;
if (options && options.id) {
message = message + (' [deprecation id: ' + options.id + ']');
}
if (options && options.url) {
message += ' See ' + options.url + ' for more details.';
}
return message;
};
registerHandler(function (message, options) {
var updatedMessage = formatMessage(message, options);
console.warn('DEPRECATION: ' + updatedMessage); // eslint-disable-line no-console
});
var captureErrorForStack = void 0;
if (new Error().stack) {
captureErrorForStack = function () {
return new Error();
};
} else {
captureErrorForStack = function () {
try {
__fail__.fail();
} catch (e) {
return e;
}
};
}
registerHandler(function (message, options, next) {
var stackStr, error, stack, updatedMessage;
if (_emberEnvironment.ENV.LOG_STACKTRACE_ON_DEPRECATION) {
stackStr = '';
error = captureErrorForStack();
stack = void 0;
if (error.stack) {
if (error['arguments']) {
// Chrome
stack = error.stack.replace(/^\s+at\s+/gm, '').replace(/^([^\(]+?)([\n$])/gm, '{anonymous}($1)$2').replace(/^Object.\s*\(([^\)]+)\)/gm, '{anonymous}($1)').split('\n');
stack.shift();
} else {
// Firefox
stack = error.stack.replace(/(?:\n@:0)?\s+$/m, '').replace(/^\(/gm, '{anonymous}(').split('\n');
}
stackStr = '\n ' + stack.slice(2).join('\n ');
}
updatedMessage = formatMessage(message, options);
console.warn('DEPRECATION: ' + updatedMessage + stackStr); // eslint-disable-line no-console
} else {
next(message, options);
}
});
registerHandler(function (message, options, next) {
var updatedMessage;
if (_emberEnvironment.ENV.RAISE_ON_DEPRECATION) {
updatedMessage = formatMessage(message);
throw new Error(updatedMessage);
} else {
next(message, options);
}
});
exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `deprecate` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include `id` and `until` properties.';
exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `deprecate` you must provide `id` in options.';
exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation = 'When calling `deprecate` you must provide `until` in options.';
/**
@module @ember/application
@public
*/
/**
Display a deprecation warning with the provided message and a stack trace
(Chrome and Firefox only).
* In a production build, this method is defined as an empty function (NOP).
Uses of this method in Ember itself are stripped from the ember.prod.js build.
@method deprecate
@for @ember/application/deprecations
@param {String} message A description of the deprecation.
@param {Boolean} test A boolean. If falsy, the deprecation will be displayed.
@param {Object} options
@param {String} options.id A unique id for this deprecation. The id can be
used by Ember debugging tools to change the behavior (raise, log or silence)
for that specific deprecation. The id should be namespaced by dots, e.g.
"view.helper.select".
@param {string} options.until The version of Ember when this deprecation
warning will be removed.
@param {String} [options.url] An optional url to the transition guide on the
emberjs.com website.
@static
@public
@since 1.0.0
*/
deprecate = function deprecate(message, test, options) {
if (_emberEnvironment.ENV._ENABLE_DEPRECATION_OPTIONS_SUPPORT !== true) {
(0, _index.assert)(missingOptionsDeprecation, !!(options && (options.id || options.until)));
(0, _index.assert)(missingOptionsIdDeprecation, !!options.id);
(0, _index.assert)(missingOptionsUntilDeprecation, !!options.until);
}
if (_deprecatedFeatures.DEPRECATE_OPTIONS_MISSING && (!options || !options.id && !options.until) && _emberEnvironment.ENV._ENABLE_DEPRECATION_OPTIONS_SUPPORT === true) {
deprecate(missingOptionsDeprecation, false, {
id: 'ember-debug.deprecate-options-missing',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
});
}
if (_deprecatedFeatures.DEPRECATE_ID_MISSING && options && !options.id && _emberEnvironment.ENV._ENABLE_DEPRECATION_OPTIONS_SUPPORT === true) {
deprecate(missingOptionsIdDeprecation, false, {
id: 'ember-debug.deprecate-id-missing',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
});
}
if (_deprecatedFeatures.DEPRECATE_UNTIL_MISSING && options && !options.until && _emberEnvironment.ENV._ENABLE_DEPRECATION_OPTIONS_SUPPORT === true) {
deprecate(missingOptionsUntilDeprecation, !!(options && options.until), {
id: 'ember-debug.deprecate-until-missing',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
});
}
(0, _handlers.invoke)('deprecate', message, test, options);
};
exports.default = deprecate;
exports.registerHandler = registerHandler;
exports.missingOptionsDeprecation = missingOptionsDeprecation;
exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation;
exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation;
});
enifed('@ember/debug/lib/handlers', ['exports'], function (exports) {
'use strict';
var HANDLERS = exports.HANDLERS = {};
var registerHandler = function () {};
var invoke = function () {};
exports.registerHandler = registerHandler = function (type, callback) {
var nextHandler = HANDLERS[type] || function () {};
HANDLERS[type] = function (message, options) {
callback(message, options, nextHandler);
};
};
exports.invoke = invoke = function (type, message, test, options) {
if (test) {
return;
}
var handlerForType = HANDLERS[type];
if (handlerForType) {
handlerForType(message, options);
}
};
exports.registerHandler = registerHandler;
exports.invoke = invoke;
});
enifed("@ember/debug/lib/testing", ["exports"], function (exports) {
"use strict";
exports.isTesting = isTesting;
exports.setTesting = function (value) {
testing = !!value;
};
var testing = false;
function isTesting() {
return testing;
}
});
enifed('@ember/debug/lib/warn', ['exports', 'ember-environment', '@ember/debug/index', '@ember/debug/lib/deprecate', '@ember/debug/lib/handlers'], function (exports, _emberEnvironment, _index, _deprecate, _handlers) {
'use strict';
exports.missingOptionsDeprecation = exports.missingOptionsIdDeprecation = exports.registerHandler = undefined;
var registerHandler = function () {};
var warn = function () {};
var missingOptionsDeprecation = void 0;
var missingOptionsIdDeprecation = void 0;
/**
@module @ember/debug
*/
/**
Allows for runtime registration of handler functions that override the default warning behavior.
Warnings are invoked by calls made to [@ember/debug/warn](https://emberjs.com/api/ember/release/classes/@ember%2Fdebug/methods/warn?anchor=warn).
The following example demonstrates its usage by registering a handler that does nothing overriding Ember's
default warning behavior.
```javascript
import { registerWarnHandler } from '@ember/debug';
// next is not called, so no warnings get the default behavior
registerWarnHandler(() => {});
```
The handler function takes the following arguments:
message - The message received from the warn call.
options - An object passed in with the warn call containing additional information including:
id - An id of the warning in the form of package-name.specific-warning.
next - A function that calls into the previously registered handler.
@public
@static
@method registerWarnHandler
@for @ember/debug
@param handler {Function} A function to handle warnings.
@since 2.1.0
*/
exports.registerHandler = registerHandler = function (handler) {
(0, _handlers.registerHandler)('warn', handler);
};
registerHandler(function (message) {
/* eslint-disable no-console */
console.warn('WARNING: ' + message);
if (console.trace) {
console.trace();
}
/* eslint-enable no-console */
});
exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.';
exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `warn` you must provide `id` in options.';
/**
Display a warning with the provided message.
* In a production build, this method is defined as an empty function (NOP).
Uses of this method in Ember itself are stripped from the ember.prod.js build.
@method warn
@for @ember/debug
@static
@param {String} message A warning to display.
@param {Boolean} test An optional boolean. If falsy, the warning
will be displayed.
@param {Object} options An object that can be used to pass a unique
`id` for this warning. The `id` can be used by Ember debugging tools
to change the behavior (raise, log, or silence) for that specific warning.
The `id` should be namespaced by dots, e.g. "ember-debug.feature-flag-with-features-stripped"
@public
@since 1.0.0
*/
warn = function (message, test, options) {
if (arguments.length === 2 && typeof test === 'object') {
options = test;
test = false;
}
if (_emberEnvironment.ENV._ENABLE_WARN_OPTIONS_SUPPORT !== true) {
(0, _index.assert)(missingOptionsDeprecation, !!options);
(0, _index.assert)(missingOptionsIdDeprecation, !!(options && options.id));
}
if (!options && _emberEnvironment.ENV._ENABLE_WARN_OPTIONS_SUPPORT === true) {
(0, _deprecate.default)(missingOptionsDeprecation, false, {
id: 'ember-debug.warn-options-missing',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
});
}
if (options && !options.id && _emberEnvironment.ENV._ENABLE_WARN_OPTIONS_SUPPORT === true) {
(0, _deprecate.default)(missingOptionsIdDeprecation, false, {
id: 'ember-debug.warn-id-missing',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
});
}
(0, _handlers.invoke)('warn', message, test, options);
};
exports.default = warn;
exports.registerHandler = registerHandler;
exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation;
exports.missingOptionsDeprecation = missingOptionsDeprecation;
});
enifed('@ember/deprecated-features/index', ['exports'], function (exports) {
'use strict';
exports.SEND_ACTION = !!'3.4.0';
exports.PROPERTY_BASED_DESCRIPTORS = !!'3.2.0';
exports.EMBER_EXTEND_PROTOTYPES = !!'3.2.0-beta.5';
exports.DEPRECATE_OPTIONS_MISSING = !!'2.1.0-beta.1';
exports.DEPRECATE_ID_MISSING = !!'2.1.0-beta.1';
exports.DEPRECATE_UNTIL_MISSING = !!'2.1.0-beta.1';
exports.RUN_SYNC = !!'3.0.0-beta.4';
exports.REGISTRY_RESOLVER_AS_FUNCTION = !!'2.3.0-beta.3';
exports.LOGGER = !!'3.2.0-beta.1';
exports.POSITIONAL_PARAM_CONFLICT = !!'3.1.0-beta.1';
exports.DID_INIT_ATTRS = !!'2.6.0-beta.1';
exports.PROPERTY_WILL_CHANGE = !!'3.1.0-beta.1';
exports.PROPERTY_DID_CHANGE = !!'3.1.0-beta.1';
exports.ROUTER_ROUTER = !!'3.2.0-beta.1';
exports.ORPHAN_OUTLET_RENDER = !!'2.11.0-beta.1';
exports.ARRAY_AT_EACH = !!'3.1.0-beta.1';
exports.TARGET_OBJECT = !!'2.18.0-beta.1';
exports.RENDER_HELPER = !!'2.11.0-beta.1';
exports.BINDING_SUPPORT = !!'2.7.0-beta.1';
exports.MAP = !!'3.3.0-beta.1';
exports.ORDERED_SET = !!'3.3.0-beta.1';
});
enifed("@ember/error/index", ["exports", "ember-babel"], function (exports, _emberBabel) {
"use strict";
/**
@module @ember/error
*/
/**
A subclass of the JavaScript Error object for use in Ember.
@class EmberError
@extends Error
@constructor
@public
*/
var EmberError = function (_ExtendBuiltin) {
(0, _emberBabel.inherits)(EmberError, _ExtendBuiltin);
function EmberError(message) {
var _this = (0, _emberBabel.possibleConstructorReturn)(this, _ExtendBuiltin.call(this)),
_ret;
if (!(_this instanceof EmberError)) {
return _ret = new EmberError(message), (0, _emberBabel.possibleConstructorReturn)(_this, _ret);
}
var error = Error.call(_this, message);
_this.stack = error.stack;
_this.description = error.description;
_this.fileName = error.fileName;
_this.lineNumber = error.lineNumber;
_this.message = error.message;
_this.name = error.name;
_this.number = error.number;
_this.code = error.code;
return _this;
}
return EmberError;
}(function (klass) {
function ExtendableBuiltin() {
klass.apply(this, arguments);
}
ExtendableBuiltin.prototype = Object.create(klass.prototype);
ExtendableBuiltin.prototype.constructor = ExtendableBuiltin;
return ExtendableBuiltin;
}(Error));
exports.default = EmberError;
});
enifed('@ember/polyfills/index', ['exports', '@ember/polyfills/lib/assign', '@ember/polyfills/lib/merge'], function (exports, _assign, _merge) {
'use strict';
Object.defineProperty(exports, 'assign', {
enumerable: true,
get: function () {
return _assign.default;
}
});
Object.defineProperty(exports, 'assignPolyfill', {
enumerable: true,
get: function () {
return _assign.assign;
}
});
Object.defineProperty(exports, 'merge', {
enumerable: true,
get: function () {
return _merge.default;
}
});
});
enifed("@ember/polyfills/lib/assign", ["exports"], function (exports) {
"use strict";
exports.assign = assign;
/**
@module @ember/polyfills
*/
/**
Copy properties from a source object to a target object.
```javascript
import { assign } from '@ember/polyfills';
var a = { first: 'Yehuda' };
var b = { last: 'Katz' };
var c = { company: 'Tilde Inc.' };
assign(a, b, c); // a === { first: 'Yehuda', last: 'Katz', company: 'Tilde Inc.' }, b === { last: 'Katz' }, c === { company: 'Tilde Inc.' }
```
@method assign
@for @ember/polyfills
@param {Object} target The object to assign into
@param {Object} ...args The objects to copy properties from
@return {Object}
@public
@static
*/
function assign(target) {
var i, arg, updates, _i, prop;
for (i = 1; i < arguments.length; i++) {
arg = arguments[i];
if (!arg) {
continue;
}
updates = Object.keys(arg);
for (_i = 0; _i < updates.length; _i++) {
prop = updates[_i];
target[prop] = arg[prop];
}
}
return target;
}
// Note: We use the bracket notation so
// that the babel plugin does not
// transform it.
// https://www.npmjs.com/package/babel-plugin-transform-object-assign
var _assign = Object.assign;
exports.default = _assign || assign;
});
enifed('@ember/polyfills/lib/merge', ['exports'], function (exports) {
'use strict';
exports.default =
/**
@module @ember/polyfills
*/
/**
Merge the contents of two objects together into the first object.
```javascript
import { merge } from '@ember/polyfills';
merge({ first: 'Tom' }, { last: 'Dale' }); // { first: 'Tom', last: 'Dale' }
var a = { first: 'Yehuda' };
var b = { last: 'Katz' };
merge(a, b); // a == { first: 'Yehuda', last: 'Katz' }, b == { last: 'Katz' }
```
@method merge
@static
@for @ember/polyfills
@param {Object} original The object to merge into
@param {Object} updates The object to copy properties from
@return {Object}
@public
*/
function (original, updates) {
if (updates === null || typeof updates !== 'object') {
return original;
}
var props = Object.keys(updates),
i;
var prop = void 0;
for (i = 0; i < props.length; i++) {
prop = props[i];
original[prop] = updates[prop];
}
return original;
};
});
enifed('@glimmer/compiler', ['exports', 'ember-babel', 'node-module', '@glimmer/util', '@glimmer/wire-format', '@glimmer/syntax'], function (exports, _emberBabel, _nodeModule, _util, _wireFormat, _syntax) {
'use strict';
exports.TemplateVisitor = exports.TemplateCompiler = exports.precompile = exports.defaultId = undefined;
var SymbolTable = function () {
function SymbolTable() {}
SymbolTable.top = function () {
return new ProgramSymbolTable();
};
SymbolTable.prototype.child = function (locals) {
var _this = this;
var symbols = locals.map(function (name) {
return _this.allocate(name);
});
return new BlockSymbolTable(this, locals, symbols);
};
return SymbolTable;
}();
var ProgramSymbolTable = function (_SymbolTable) {
(0, _emberBabel.inherits)(ProgramSymbolTable, _SymbolTable);
function ProgramSymbolTable() {
var _this2 = (0, _emberBabel.possibleConstructorReturn)(this, _SymbolTable.apply(this, arguments));
_this2.symbols = [];
_this2.size = 1;
_this2.named = (0, _util.dict)();
_this2.blocks = (0, _util.dict)();
return _this2;
}
ProgramSymbolTable.prototype.has = function () {
return false;
};
ProgramSymbolTable.prototype.get = function () {
throw (0, _util.unreachable)();
};
ProgramSymbolTable.prototype.getLocalsMap = function () {
return {};
};
ProgramSymbolTable.prototype.getEvalInfo = function () {
return [];
};
ProgramSymbolTable.prototype.allocateNamed = function (name) {
var named = this.named[name];
if (!named) {
named = this.named[name] = this.allocate(name);
}
return named;
};
ProgramSymbolTable.prototype.allocateBlock = function (name) {
var block = this.blocks[name];
if (!block) {
block = this.blocks[name] = this.allocate('&' + name);
}
return block;
};
ProgramSymbolTable.prototype.allocate = function (identifier) {
this.symbols.push(identifier);
return this.size++;
};
return ProgramSymbolTable;
}(SymbolTable);
var BlockSymbolTable = function (_SymbolTable2) {
(0, _emberBabel.inherits)(BlockSymbolTable, _SymbolTable2);
function BlockSymbolTable(parent, symbols, slots) {
var _this3 = (0, _emberBabel.possibleConstructorReturn)(this, _SymbolTable2.call(this));
_this3.parent = parent;
_this3.symbols = symbols;
_this3.slots = slots;
return _this3;
}
BlockSymbolTable.prototype.has = function (name) {
return this.symbols.indexOf(name) !== -1 || this.parent.has(name);
};
BlockSymbolTable.prototype.get = function (name) {
var slot = this.symbols.indexOf(name);
return slot === -1 ? this.parent.get(name) : this.slots[slot];
};
BlockSymbolTable.prototype.getLocalsMap = function () {
var _this4 = this;
var dict$$1 = this.parent.getLocalsMap();
this.symbols.forEach(function (symbol) {
return dict$$1[symbol] = _this4.get(symbol);
});
return dict$$1;
};
BlockSymbolTable.prototype.getEvalInfo = function () {
var locals = this.getLocalsMap();
return Object.keys(locals).map(function (symbol) {
return locals[symbol];
});
};
BlockSymbolTable.prototype.allocateNamed = function (name) {
return this.parent.allocateNamed(name);
};
BlockSymbolTable.prototype.allocateBlock = function (name) {
return this.parent.allocateBlock(name);
};
BlockSymbolTable.prototype.allocate = function (identifier) {
return this.parent.allocate(identifier);
};
return BlockSymbolTable;
}(SymbolTable);
var Frame = function () {
this.parentNode = null;
this.children = null;
this.childIndex = null;
this.childCount = null;
this.childTemplateCount = 0;
this.mustacheCount = 0;
this.actions = [];
this.blankChildTextNodes = null;
this.symbols = null;
};
var TemplateVisitor = function () {
function TemplateVisitor() {
this.frameStack = [];
this.actions = [];
this.programDepth = -1;
}
TemplateVisitor.prototype.visit = function (node) {
this[node.type](node);
};
TemplateVisitor.prototype.Program = function (program) {
var _actions, i;
this.programDepth++;
var parentFrame = this.getCurrentFrame();
var programFrame = this.pushFrame();
if (!parentFrame) {
program['symbols'] = SymbolTable.top();
} else {
program['symbols'] = parentFrame.symbols.child(program.blockParams);
}
var startType = void 0,
endType = void 0;
if (this.programDepth === 0) {
startType = 'startProgram';
endType = 'endProgram';
} else {
startType = 'startBlock';
endType = 'endBlock';
}
programFrame.parentNode = program;
programFrame.children = program.body;
programFrame.childCount = program.body.length;
programFrame.blankChildTextNodes = [];
programFrame.actions.push([endType, [program, this.programDepth]]);
programFrame.symbols = program['symbols'];
for (i = program.body.length - 1; i >= 0; i--) {
programFrame.childIndex = i;
this.visit(program.body[i]);
}
programFrame.actions.push([startType, [program, programFrame.childTemplateCount, programFrame.blankChildTextNodes.reverse()]]);
this.popFrame();
this.programDepth--;
// Push the completed template into the global actions list
if (parentFrame) {
parentFrame.childTemplateCount++;
}
(_actions = this.actions).push.apply(_actions, programFrame.actions.reverse());
};
TemplateVisitor.prototype.ElementNode = function (element) {
var _parentFrame$actions, i, _i;
var parentFrame = this.currentFrame;
var elementFrame = this.pushFrame();
elementFrame.parentNode = element;
elementFrame.children = element.children;
elementFrame.childCount = element.children.length;
elementFrame.mustacheCount += element.modifiers.length;
elementFrame.blankChildTextNodes = [];
elementFrame.symbols = element['symbols'] = parentFrame.symbols.child(element.blockParams);
var actionArgs = [element, parentFrame.childIndex, parentFrame.childCount];
elementFrame.actions.push(['closeElement', actionArgs]);
for (i = element.attributes.length - 1; i >= 0; i--) {
this.visit(element.attributes[i]);
}
for (_i = element.children.length - 1; _i >= 0; _i--) {
elementFrame.childIndex = _i;
this.visit(element.children[_i]);
}
var open = ['openElement', [].concat(actionArgs, [elementFrame.mustacheCount, elementFrame.blankChildTextNodes.reverse()])];
elementFrame.actions.push(open);
this.popFrame();
// Propagate the element's frame state to the parent frame
if (elementFrame.mustacheCount > 0) {
parentFrame.mustacheCount++;
}
parentFrame.childTemplateCount += elementFrame.childTemplateCount;
(_parentFrame$actions = parentFrame.actions).push.apply(_parentFrame$actions, elementFrame.actions);
};
TemplateVisitor.prototype.AttrNode = function (attr) {
if (attr.value.type !== 'TextNode') {
this.currentFrame.mustacheCount++;
}
};
TemplateVisitor.prototype.TextNode = function (text) {
var frame = this.currentFrame;
if (text.chars === '') {
frame.blankChildTextNodes.push(domIndexOf(frame.children, text));
}
frame.actions.push(['text', [text, frame.childIndex, frame.childCount]]);
};
TemplateVisitor.prototype.BlockStatement = function (node) {
var frame = this.currentFrame;
frame.mustacheCount++;
frame.actions.push(['block', [node, frame.childIndex, frame.childCount]]);
if (node.inverse) {
this.visit(node.inverse);
}
if (node.program) {
this.visit(node.program);
}
};
TemplateVisitor.prototype.PartialStatement = function (node) {
var frame = this.currentFrame;
frame.mustacheCount++;
frame.actions.push(['mustache', [node, frame.childIndex, frame.childCount]]);
};
TemplateVisitor.prototype.CommentStatement = function (text) {
var frame = this.currentFrame;
frame.actions.push(['comment', [text, frame.childIndex, frame.childCount]]);
};
TemplateVisitor.prototype.MustacheCommentStatement = function () {
// Intentional empty: Handlebars comments should not affect output.
};
TemplateVisitor.prototype.MustacheStatement = function (mustache) {
var frame = this.currentFrame;
frame.mustacheCount++;
frame.actions.push(['mustache', [mustache, frame.childIndex, frame.childCount]]);
};
TemplateVisitor.prototype.getCurrentFrame = function () {
return this.frameStack[this.frameStack.length - 1];
};
TemplateVisitor.prototype.pushFrame = function () {
var frame = new Frame();
this.frameStack.push(frame);
return frame;
};
TemplateVisitor.prototype.popFrame = function () {
return this.frameStack.pop();
};
(0, _emberBabel.createClass)(TemplateVisitor, [{
key: 'currentFrame',
get: function () {
return this.getCurrentFrame();
}
}]);
return TemplateVisitor;
}();
// Returns the index of `domNode` in the `nodes` array, skipping
// over any nodes which do not represent DOM nodes.
function domIndexOf(nodes, domNode) {
var index = -1,
i,
node;
for (i = 0; i < nodes.length; i++) {
node = nodes[i];
if (node.type !== 'TextNode' && node.type !== 'ElementNode') {
continue;
} else {
index++;
}
if (node === domNode) {
return index;
}
}
return -1;
}
var Block = function () {
function Block() {
this.statements = [];
}
Block.prototype.push = function (statement) {
this.statements.push(statement);
};
return Block;
}();
var InlineBlock = function (_Block) {
(0, _emberBabel.inherits)(InlineBlock, _Block);
function InlineBlock(table) {
var _this5 = (0, _emberBabel.possibleConstructorReturn)(this, _Block.call(this));
_this5.table = table;
return _this5;
}
InlineBlock.prototype.toJSON = function () {
return {
statements: this.statements,
parameters: this.table.slots
};
};
return InlineBlock;
}(Block);
var TemplateBlock = function (_Block2) {
(0, _emberBabel.inherits)(TemplateBlock, _Block2);
function TemplateBlock(symbolTable) {
var _this6 = (0, _emberBabel.possibleConstructorReturn)(this, _Block2.call(this));
_this6.symbolTable = symbolTable;
_this6.type = 'template';
_this6.yields = new _util.DictSet();
_this6.named = new _util.DictSet();
_this6.blocks = [];
_this6.hasEval = false;
return _this6;
}
TemplateBlock.prototype.push = function (statement) {
this.statements.push(statement);
};
TemplateBlock.prototype.toJSON = function () {
return {
symbols: this.symbolTable.symbols,
statements: this.statements,
hasEval: this.hasEval
};
};
return TemplateBlock;
}(Block);
var ComponentBlock = function (_Block3) {
(0, _emberBabel.inherits)(ComponentBlock, _Block3);
function ComponentBlock(tag, table, selfClosing) {
var _this7 = (0, _emberBabel.possibleConstructorReturn)(this, _Block3.call(this));
_this7.tag = tag;
_this7.table = table;
_this7.selfClosing = selfClosing;
_this7.attributes = [];
_this7.arguments = [];
_this7.inParams = true;
_this7.positionals = [];
return _this7;
}
ComponentBlock.prototype.push = function (statement) {
if (this.inParams) {
if ((0, _wireFormat.isModifier)(statement)) {
throw new Error('Compile Error: Element modifiers are not allowed in components');
} else if ((0, _wireFormat.isFlushElement)(statement)) {
this.inParams = false;
} else if ((0, _wireFormat.isArgument)(statement)) {
this.arguments.push(statement);
} else if ((0, _wireFormat.isAttribute)(statement)) {
this.attributes.push(statement);
} else if ((0, _wireFormat.isAttrSplat)(statement)) {
this.attributes.push(statement);
} else {
throw new Error('Compile Error: only parameters allowed before flush-element');
}
} else {
this.statements.push(statement);
}
};
ComponentBlock.prototype.toJSON = function () {
var args = this.arguments;
var keys = args.map(function (arg) {
return arg[1];
});
var values = args.map(function (arg) {
return arg[2];
});
var block = this.selfClosing ? null : {
statements: this.statements,
parameters: this.table.slots
};
return [this.tag, this.attributes, [keys, values], block];
};
return ComponentBlock;
}(Block);
var Template = function () {
function Template(symbols) {
this.block = new TemplateBlock(symbols);
}
Template.prototype.toJSON = function () {
return this.block.toJSON();
};
return Template;
}();
var JavaScriptCompiler = function () {
function JavaScriptCompiler(opcodes, symbols, options) {
this.blocks = new _util.Stack();
this.values = [];
this.opcodes = opcodes;
this.template = new Template(symbols);
this.options = options;
}
JavaScriptCompiler.process = function (opcodes, symbols, options) {
var compiler = new JavaScriptCompiler(opcodes, symbols, options);
return compiler.process();
};
JavaScriptCompiler.prototype.process = function () {
var _this8 = this;
this.opcodes.forEach(function (op) {
var opcode = op[0];
var arg = op[1];
if (!_this8[opcode]) {
throw new Error('unimplemented ' + opcode + ' on JavaScriptCompiler');
}
_this8[opcode](arg);
});
return this.template;
};
JavaScriptCompiler.prototype.startBlock = function (program) {
var block = new InlineBlock(program['symbols']);
this.blocks.push(block);
};
JavaScriptCompiler.prototype.endBlock = function () {
var template = this.template,
blocks = this.blocks;
var block = blocks.pop();
template.block.blocks.push(block.toJSON());
};
JavaScriptCompiler.prototype.startProgram = function () {
this.blocks.push(this.template.block);
};
JavaScriptCompiler.prototype.endProgram = function () {};
JavaScriptCompiler.prototype.text = function (content) {
this.push([_wireFormat.Ops.Text, content]);
};
JavaScriptCompiler.prototype.append = function (trusted) {
this.push([_wireFormat.Ops.Append, this.popValue(), trusted]);
};
JavaScriptCompiler.prototype.comment = function (value) {
this.push([_wireFormat.Ops.Comment, value]);
};
JavaScriptCompiler.prototype.modifier = function (name) {
var params = this.popValue();
var hash = this.popValue();
this.push([_wireFormat.Ops.Modifier, name, params, hash]);
};
JavaScriptCompiler.prototype.block = function (_ref) {
var name = _ref[0],
template = _ref[1],
inverse = _ref[2];
var params = this.popValue();
var hash = this.popValue();
var blocks = this.template.block.blocks;
this.push([_wireFormat.Ops.Block, name, params, hash, blocks[template], blocks[inverse]]);
};
JavaScriptCompiler.prototype.openComponent = function (element) {
var tag = this.options && this.options.customizeComponentName ? this.options.customizeComponentName(element.tag) : element.tag;
var component = new ComponentBlock(tag, element['symbols'], element.selfClosing);
this.blocks.push(component);
};
JavaScriptCompiler.prototype.openSplattedElement = function (element) {
var tag = element.tag;
if (element.blockParams.length > 0) {
throw new Error('Compile Error: <' + element.tag + '> is not a component and doesn\'t support block parameters');
} else {
this.push([_wireFormat.Ops.OpenSplattedElement, tag]);
}
};
JavaScriptCompiler.prototype.openElement = function (element) {
var tag = element.tag;
if (element.blockParams.length > 0) {
throw new Error('Compile Error: <' + element.tag + '> is not a component and doesn\'t support block parameters');
} else {
this.push([_wireFormat.Ops.OpenElement, tag]);
}
};
JavaScriptCompiler.prototype.flushElement = function () {
this.push([_wireFormat.Ops.FlushElement]);
};
JavaScriptCompiler.prototype.closeComponent = function () {
var _endComponent = this.endComponent(),
tag = _endComponent[0],
attrs = _endComponent[1],
args = _endComponent[2],
block = _endComponent[3];
this.push([_wireFormat.Ops.Component, tag, attrs, args, block]);
};
JavaScriptCompiler.prototype.closeDynamicComponent = function () {
var _endComponent2 = this.endComponent(),
attrs = _endComponent2[1],
args = _endComponent2[2],
block = _endComponent2[3];
this.push([_wireFormat.Ops.DynamicComponent, this.popValue(), attrs, args, block]);
};
JavaScriptCompiler.prototype.closeElement = function () {
this.push([_wireFormat.Ops.CloseElement]);
};
JavaScriptCompiler.prototype.staticAttr = function (_ref2) {
var name = _ref2[0],
namespace = _ref2[1];
var value = this.popValue();
this.push([_wireFormat.Ops.StaticAttr, name, value, namespace]);
};
JavaScriptCompiler.prototype.dynamicAttr = function (_ref3) {
var name = _ref3[0],
namespace = _ref3[1];
var value = this.popValue();
this.push([_wireFormat.Ops.DynamicAttr, name, value, namespace]);
};
JavaScriptCompiler.prototype.trustingAttr = function (_ref4) {
var name = _ref4[0],
namespace = _ref4[1];
var value = this.popValue();
this.push([_wireFormat.Ops.TrustingAttr, name, value, namespace]);
};
JavaScriptCompiler.prototype.staticArg = function (name) {
var value = this.popValue();
this.push([_wireFormat.Ops.StaticArg, name, value]);
};
JavaScriptCompiler.prototype.dynamicArg = function (name) {
var value = this.popValue();
this.push([_wireFormat.Ops.DynamicArg, name, value]);
};
JavaScriptCompiler.prototype.yield = function (to) {
var params = this.popValue();
this.push([_wireFormat.Ops.Yield, to, params]);
};
JavaScriptCompiler.prototype.attrSplat = function (to) {
this.push([_wireFormat.Ops.AttrSplat, to]);
};
JavaScriptCompiler.prototype.debugger = function (evalInfo) {
this.push([_wireFormat.Ops.Debugger, evalInfo]);
this.template.block.hasEval = true;
};
JavaScriptCompiler.prototype.hasBlock = function (name) {
this.pushValue([_wireFormat.Ops.HasBlock, name]);
};
JavaScriptCompiler.prototype.hasBlockParams = function (name) {
this.pushValue([_wireFormat.Ops.HasBlockParams, name]);
};
JavaScriptCompiler.prototype.partial = function (evalInfo) {
var params = this.popValue();
this.push([_wireFormat.Ops.Partial, params[0], evalInfo]);
this.template.block.hasEval = true;
};
JavaScriptCompiler.prototype.literal = function (value) {
if (value === undefined) {
this.pushValue([_wireFormat.Ops.Undefined]);
} else {
this.pushValue(value);
}
};
JavaScriptCompiler.prototype.unknown = function (name) {
this.pushValue([_wireFormat.Ops.Unknown, name]);
};
JavaScriptCompiler.prototype.get = function (_ref5) {
var head = _ref5[0],
path = _ref5[1];
this.pushValue([_wireFormat.Ops.Get, head, path]);
};
JavaScriptCompiler.prototype.maybeLocal = function (path) {
this.pushValue([_wireFormat.Ops.MaybeLocal, path]);
};
JavaScriptCompiler.prototype.concat = function () {
this.pushValue([_wireFormat.Ops.Concat, this.popValue()]);
};
JavaScriptCompiler.prototype.helper = function (name) {
var params = this.popValue();
var hash = this.popValue();
this.pushValue([_wireFormat.Ops.Helper, name, params, hash]);
};
JavaScriptCompiler.prototype.prepareArray = function (size) {
var values = [],
i;
for (i = 0; i < size; i++) {
values.push(this.popValue());
}
this.pushValue(values);
};
JavaScriptCompiler.prototype.prepareObject = function (size) {
var keys = new Array(size),
i;
var values = new Array(size);
for (i = 0; i < size; i++) {
keys[i] = this.popValue();
values[i] = this.popValue();
}
this.pushValue([keys, values]);
};
JavaScriptCompiler.prototype.endComponent = function () {
var component = this.blocks.pop();
return component.toJSON();
};
JavaScriptCompiler.prototype.push = function (args) {
while (args[args.length - 1] === null) {
args.pop();
}
this.currentBlock.push(args);
};
JavaScriptCompiler.prototype.pushValue = function (val) {
this.values.push(val);
};
JavaScriptCompiler.prototype.popValue = function () {
return this.values.pop();
};
(0, _emberBabel.createClass)(JavaScriptCompiler, [{
key: 'currentBlock',
get: function () {
return this.blocks.current;
}
}]);
return JavaScriptCompiler;
}();
// There is a small whitelist of namespaced attributes specially
// enumerated in
// https://www.w3.org/TR/html/syntax.html#attributes-0
//
// > When a foreign element has one of the namespaced attributes given by
// > the local name and namespace of the first and second cells of a row
// > from the following table, it must be written using the name given by
// > the third cell from the same row.
//
// In all other cases, colons are interpreted as a regular character
// with no special meaning:
//
// > No other namespaced attribute can be expressed in the HTML syntax.
var XLINK = 'http://www.w3.org/1999/xlink';
var XML = 'http://www.w3.org/XML/1998/namespace';
var XMLNS = 'http://www.w3.org/2000/xmlns/';
var WHITELIST = {
'xlink:actuate': XLINK,
'xlink:arcrole': XLINK,
'xlink:href': XLINK,
'xlink:role': XLINK,
'xlink:show': XLINK,
'xlink:title': XLINK,
'xlink:type': XLINK,
'xml:base': XML,
'xml:lang': XML,
'xml:space': XML,
xmlns: XMLNS,
'xmlns:xlink': XMLNS
};
function getAttrNamespace(attrName) {
return WHITELIST[attrName] || null;
}
var SymbolAllocator = function () {
function SymbolAllocator(ops) {
this.ops = ops;
this.symbolStack = new _util.Stack();
}
SymbolAllocator.prototype.process = function () {
var out = [],
i,
op,
result;
var ops = this.ops;
for (i = 0; i < ops.length; i++) {
op = ops[i];
result = this.dispatch(op);
if (result === undefined) {
out.push(op);
} else {
out.push(result);
}
}
return out;
};
SymbolAllocator.prototype.dispatch = function (op) {
var name = op[0];
var operand = op[1];
return this[name](operand);
};
SymbolAllocator.prototype.startProgram = function (op) {
this.symbolStack.push(op['symbols']);
};
SymbolAllocator.prototype.endProgram = function () {
this.symbolStack.pop();
};
SymbolAllocator.prototype.startBlock = function (op) {
this.symbolStack.push(op['symbols']);
};
SymbolAllocator.prototype.endBlock = function () {
this.symbolStack.pop();
};
SymbolAllocator.prototype.flushElement = function (op) {
this.symbolStack.push(op['symbols']);
};
SymbolAllocator.prototype.closeElement = function () {
this.symbolStack.pop();
};
SymbolAllocator.prototype.closeComponent = function () {
this.symbolStack.pop();
};
SymbolAllocator.prototype.closeDynamicComponent = function () {
this.symbolStack.pop();
};
SymbolAllocator.prototype.attrSplat = function () {
return ['attrSplat', this.symbols.allocateBlock('attrs')];
};
SymbolAllocator.prototype.get = function (op) {
var name = op[0],
rest = op[1],
head,
_head;
if (name === 0) {
return ['get', [0, rest]];
}
if (isLocal(name, this.symbols)) {
head = this.symbols.get(name);
return ['get', [head, rest]];
} else if (name[0] === '@') {
_head = this.symbols.allocateNamed(name);
return ['get', [_head, rest]];
} else {
return ['maybeLocal', [name].concat(rest)];
}
};
SymbolAllocator.prototype.maybeGet = function (op) {
var name = op[0],
rest = op[1],
head,
_head2;
if (name === 0) {
return ['get', [0, rest]];
}
if (isLocal(name, this.symbols)) {
head = this.symbols.get(name);
return ['get', [head, rest]];
} else if (name[0] === '@') {
_head2 = this.symbols.allocateNamed(name);
return ['get', [_head2, rest]];
} else if (rest.length === 0) {
return ['unknown', name];
} else {
return ['maybeLocal', [name].concat(rest)];
}
};
SymbolAllocator.prototype.yield = function (op) {
if (op === 0) {
throw new Error('Cannot yield to this');
}
return ['yield', this.symbols.allocateBlock(op)];
};
SymbolAllocator.prototype.debugger = function () {
return ['debugger', this.symbols.getEvalInfo()];
};
SymbolAllocator.prototype.hasBlock = function (op) {
if (op === 0) {
throw new Error('Cannot hasBlock this');
}
return ['hasBlock', this.symbols.allocateBlock(op)];
};
SymbolAllocator.prototype.hasBlockParams = function (op) {
if (op === 0) {
throw new Error('Cannot hasBlockParams this');
}
return ['hasBlockParams', this.symbols.allocateBlock(op)];
};
SymbolAllocator.prototype.partial = function () {
return ['partial', this.symbols.getEvalInfo()];
};
SymbolAllocator.prototype.text = function () {};
SymbolAllocator.prototype.comment = function () {};
SymbolAllocator.prototype.openComponent = function () {};
SymbolAllocator.prototype.openElement = function () {};
SymbolAllocator.prototype.openSplattedElement = function () {};
SymbolAllocator.prototype.staticArg = function () {};
SymbolAllocator.prototype.dynamicArg = function () {};
SymbolAllocator.prototype.staticAttr = function () {};
SymbolAllocator.prototype.trustingAttr = function () {};
SymbolAllocator.prototype.dynamicAttr = function () {};
SymbolAllocator.prototype.modifier = function () {};
SymbolAllocator.prototype.append = function () {};
SymbolAllocator.prototype.block = function () {};
SymbolAllocator.prototype.literal = function () {};
SymbolAllocator.prototype.helper = function () {};
SymbolAllocator.prototype.unknown = function () {};
SymbolAllocator.prototype.maybeLocal = function () {};
SymbolAllocator.prototype.prepareArray = function () {};
SymbolAllocator.prototype.prepareObject = function () {};
SymbolAllocator.prototype.concat = function () {};
(0, _emberBabel.createClass)(SymbolAllocator, [{
key: 'symbols',
get: function () {
return this.symbolStack.current;
}
}]);
return SymbolAllocator;
}();
function isLocal(name, symbols) {
return symbols && symbols.has(name);
}
function isTrustedValue(value) {
return value.escaped !== undefined && !value.escaped;
}
var TemplateCompiler = function () {
function TemplateCompiler() {
this.templateId = 0;
this.templateIds = [];
this.opcodes = [];
this.includeMeta = false;
}
TemplateCompiler.compile = function (ast, options) {
var templateVisitor = new TemplateVisitor();
templateVisitor.visit(ast);
var compiler = new TemplateCompiler();
var opcodes = compiler.process(templateVisitor.actions);
var symbols = new SymbolAllocator(opcodes).process();
return JavaScriptCompiler.process(symbols, ast['symbols'], options);
};
TemplateCompiler.prototype.process = function (actions) {
var _this9 = this;
actions.forEach(function (_ref6) {
var name = _ref6[0],
args = _ref6.slice(1);
if (!_this9[name]) {
throw new Error('Unimplemented ' + name + ' on TemplateCompiler');
}
_this9[name].apply(_this9, args);
});
return this.opcodes;
};
TemplateCompiler.prototype.startProgram = function (_ref7) {
var program = _ref7[0];
this.opcode(['startProgram', program], program);
};
TemplateCompiler.prototype.endProgram = function () {
this.opcode(['endProgram', null], null);
};
TemplateCompiler.prototype.startBlock = function (_ref8) {
var program = _ref8[0];
this.templateId++;
this.opcode(['startBlock', program], program);
};
TemplateCompiler.prototype.endBlock = function () {
this.templateIds.push(this.templateId - 1);
this.opcode(['endBlock', null], null);
};
TemplateCompiler.prototype.text = function (_ref9) {
var action = _ref9[0];
this.opcode(['text', action.chars], action);
};
TemplateCompiler.prototype.comment = function (_ref10) {
var action = _ref10[0];
this.opcode(['comment', action.value], action);
};
TemplateCompiler.prototype.openElement = function (_ref11) {
var action = _ref11[0],
i,
attr,
head,
rest,
_action$tag$split,
_i2,
_i3;
var attributes = action.attributes;
var hasSplat = void 0;
for (i = 0; i < attributes.length; i++) {
attr = attributes[i];
if (attr.name === '...attributes') {
hasSplat = attr;
break;
}
}
if (isDynamicComponent(action)) {
head = void 0, rest = void 0;
_action$tag$split = action.tag.split('.');
head = _action$tag$split[0];
rest = _action$tag$split.slice(1);
if (head === 'this') {
head = 0;
}
this.opcode(['get', [head, rest]]);
this.opcode(['openComponent', action], action);
} else if (isComponent(action)) {
this.opcode(['openComponent', action], action);
} else if (hasSplat) {
this.opcode(['openSplattedElement', action], action);
} else {
this.opcode(['openElement', action], action);
}
var typeAttr = null;
var attrs = action.attributes;
for (_i2 = 0; _i2 < attrs.length; _i2++) {
if (attrs[_i2].name === 'type') {
typeAttr = attrs[_i2];
continue;
}
this.attribute([attrs[_i2]]);
}
if (typeAttr) {
this.attribute([typeAttr]);
}
for (_i3 = 0; _i3 < action.modifiers.length; _i3++) {
this.modifier([action.modifiers[_i3]]);
}
this.opcode(['flushElement', action], null);
};
TemplateCompiler.prototype.closeElement = function (_ref12) {
var action = _ref12[0];
if (isDynamicComponent(action)) {
this.opcode(['closeDynamicComponent', action], action);
} else if (isComponent(action)) {
this.opcode(['closeComponent', action], action);
} else {
this.opcode(['closeElement', action], action);
}
};
TemplateCompiler.prototype.attribute = function (_ref13) {
var action = _ref13[0],
isTrusting;
var name = action.name,
value = action.value;
var namespace = getAttrNamespace(name);
var isStatic = this.prepareAttributeValue(value);
if (name.charAt(0) === '@') {
// Arguments
if (isStatic) {
this.opcode(['staticArg', name], action);
} else if (action.value.type === 'MustacheStatement') {
this.opcode(['dynamicArg', name], action);
} else {
this.opcode(['dynamicArg', name], action);
}
} else {
isTrusting = isTrustedValue(value);
if (isStatic && name === '...attributes') {
this.opcode(['attrSplat', null], action);
} else if (isStatic) {
this.opcode(['staticAttr', [name, namespace]], action);
} else if (isTrusting) {
this.opcode(['trustingAttr', [name, namespace]], action);
} else if (action.value.type === 'MustacheStatement') {
this.opcode(['dynamicAttr', [name, null]], action);
} else {
this.opcode(['dynamicAttr', [name, namespace]], action);
}
}
};
TemplateCompiler.prototype.modifier = function (_ref14) {
var action = _ref14[0];
assertIsSimplePath(action.path, action.loc, 'modifier');
var parts = action.path.parts;
this.prepareHelper(action);
this.opcode(['modifier', parts[0]], action);
};
TemplateCompiler.prototype.mustache = function (_ref15) {
var action = _ref15[0],
to,
params;
var path = action.path;
if ((0, _syntax.isLiteral)(path)) {
this.mustacheExpression(action);
this.opcode(['append', !action.escaped], action);
} else if (isYield(path)) {
to = assertValidYield(action);
this.yield(to, action);
} else if (isPartial(path)) {
params = assertValidPartial(action);
this.partial(params, action);
} else if (isDebugger(path)) {
assertValidDebuggerUsage(action);
this.debugger('debugger', action);
} else {
this.mustacheExpression(action);
this.opcode(['append', !action.escaped], action);
}
};
TemplateCompiler.prototype.block = function (_ref16) {
var action /*, index, count*/ = _ref16[0];
this.prepareHelper(action);
var templateId = this.templateIds.pop();
var inverseId = action.inverse === null ? null : this.templateIds.pop();
this.opcode(['block', [action.path.parts[0], templateId, inverseId]], action);
};
TemplateCompiler.prototype.arg = function (_ref17) {
var path = _ref17[0];
var _path$parts = path.parts,
head = _path$parts[0],
rest = _path$parts.slice(1);
this.opcode(['get', ['@' + head, rest]], path);
};
TemplateCompiler.prototype.mustacheExpression = function (expr) {
var path = expr.path,
_path$parts2,
head,
parts;
if ((0, _syntax.isLiteral)(path)) {
this.opcode(['literal', path.value], expr);
} else if (isBuiltInHelper(path)) {
this.builtInHelper(expr);
} else if (isArg(path)) {
this.arg([path]);
} else if (isHelperInvocation(expr)) {
this.prepareHelper(expr);
this.opcode(['helper', path.parts[0]], expr);
} else if (path.this) {
this.opcode(['get', [0, path.parts]], expr);
} else {
_path$parts2 = path.parts, head = _path$parts2[0], parts = _path$parts2.slice(1);
this.opcode(['maybeGet', [head, parts]], expr);
}
// } else if (isLocal(path, this.symbols)) {
// let [head, ...parts] = path.parts;
// this.opcode(['get', [head, parts]], expr);
// } else if (isSimplePath(path)) {
// this.opcode(['unknown', path.parts[0]], expr);
// } else {
// this.opcode(['maybeLocal', path.parts], expr);
// }
};
TemplateCompiler.prototype.yield = function (to, action) {
this.prepareParams(action.params);
this.opcode(['yield', to], action);
};
TemplateCompiler.prototype.debugger = function (_name, action) {
this.opcode(['debugger', null], action);
};
TemplateCompiler.prototype.hasBlock = function (name, action) {
this.opcode(['hasBlock', name], action);
};
TemplateCompiler.prototype.hasBlockParams = function (name, action) {
this.opcode(['hasBlockParams', name], action);
};
TemplateCompiler.prototype.partial = function (_params, action) {
this.prepareParams(action.params);
this.opcode(['partial', null], action);
};
TemplateCompiler.prototype.builtInHelper = function (expr) {
var path = expr.path,
name,
_name2;
if (isHasBlock(path)) {
name = assertValidHasBlockUsage(expr.path.original, expr);
this.hasBlock(name, expr);
} else if (isHasBlockParams(path)) {
_name2 = assertValidHasBlockUsage(expr.path.original, expr);
this.hasBlockParams(_name2, expr);
}
};
TemplateCompiler.prototype.SubExpression = function (expr) {
if (isBuiltInHelper(expr.path)) {
this.builtInHelper(expr);
} else {
this.prepareHelper(expr);
this.opcode(['helper', expr.path.parts[0]], expr);
}
};
TemplateCompiler.prototype.PathExpression = function (expr) {
var _expr$parts, head, rest;
if (expr.data) {
this.arg([expr]);
} else {
_expr$parts = expr.parts, head = _expr$parts[0], rest = _expr$parts.slice(1);
if (expr.this) {
this.opcode(['get', [0, expr.parts]], expr);
} else {
this.opcode(['get', [head, rest]], expr);
}
}
};
TemplateCompiler.prototype.StringLiteral = function (action) {
this.opcode(['literal', action.value], action);
};
TemplateCompiler.prototype.BooleanLiteral = function (action) {
this.opcode(['literal', action.value], action);
};
TemplateCompiler.prototype.NumberLiteral = function (action) {
this.opcode(['literal', action.value], action);
};
TemplateCompiler.prototype.NullLiteral = function (action) {
this.opcode(['literal', action.value], action);
};
TemplateCompiler.prototype.UndefinedLiteral = function (action) {
this.opcode(['literal', action.value], action);
};
TemplateCompiler.prototype.opcode = function (_opcode) {
var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
// TODO: This doesn't really work
if (this.includeMeta && action) {
_opcode.push(this.meta(action));
}
this.opcodes.push(_opcode);
};
TemplateCompiler.prototype.prepareHelper = function (expr) {
assertIsSimplePath(expr.path, expr.loc, 'helper');
var params = expr.params,
hash = expr.hash;
this.prepareHash(hash);
this.prepareParams(params);
};
TemplateCompiler.prototype.prepareParams = function (params) {
var i, param;
if (!params.length) {
this.opcode(['literal', null], null);
return;
}
for (i = params.length - 1; i >= 0; i--) {
param = params[i];
this[param.type](param);
}
this.opcode(['prepareArray', params.length], null);
};
TemplateCompiler.prototype.prepareHash = function (hash) {
var pairs = hash.pairs,
i,
_pairs$i,
key,
value;
if (!pairs.length) {
this.opcode(['literal', null], null);
return;
}
for (i = pairs.length - 1; i >= 0; i--) {
_pairs$i = pairs[i], key = _pairs$i.key, value = _pairs$i.value;
this[value.type](value);
this.opcode(['literal', key], null);
}
this.opcode(['prepareObject', pairs.length], null);
};
TemplateCompiler.prototype.prepareAttributeValue = function (value) {
// returns the static value if the value is static
switch (value.type) {
case 'TextNode':
this.opcode(['literal', value.chars], value);
return true;
case 'MustacheStatement':
this.attributeMustache([value]);
return false;
case 'ConcatStatement':
this.prepareConcatParts(value.parts);
this.opcode(['concat', null], value);
return false;
}
};
TemplateCompiler.prototype.prepareConcatParts = function (parts) {
var i, part;
for (i = parts.length - 1; i >= 0; i--) {
part = parts[i];
if (part.type === 'MustacheStatement') {
this.attributeMustache([part]);
} else if (part.type === 'TextNode') {
this.opcode(['literal', part.chars], null);
}
}
this.opcode(['prepareArray', parts.length], null);
};
TemplateCompiler.prototype.attributeMustache = function (_ref18) {
var action = _ref18[0];
this.mustacheExpression(action);
};
TemplateCompiler.prototype.meta = function (node) {
var loc = node.loc;
if (!loc) {
return [];
}
var source = loc.source,
start = loc.start,
end = loc.end;
return ['loc', [source || null, [start.line, start.column], [end.line, end.column]]];
};
return TemplateCompiler;
}();
function isHelperInvocation(mustache) {
return mustache.params && mustache.params.length > 0 || mustache.hash && mustache.hash.pairs.length > 0;
}
function isSimplePath(_ref19) {
var parts = _ref19.parts;
return parts.length === 1;
}
function isYield(path) {
return path.original === 'yield';
}
function isPartial(path) {
return path.original === 'partial';
}
function isDebugger(path) {
return path.original === 'debugger';
}
function isHasBlock(path) {
return path.original === 'has-block';
}
function isHasBlockParams(path) {
return path.original === 'has-block-params';
}
function isBuiltInHelper(path) {
return isHasBlock(path) || isHasBlockParams(path);
}
function isArg(path) {
return !!path['data'];
}
function isDynamicComponent(element) {
var open = element.tag.charAt(0);
var _element$tag$split = element.tag.split('.'),
maybeLocal = _element$tag$split[0];
var isLocal = element['symbols'].has(maybeLocal);
var isThisPath = element.tag.indexOf('this.') === 0;
return isLocal || open === '@' || isThisPath;
}
function isComponent(element) {
var open = element.tag.charAt(0);
var isPath = element.tag.indexOf('.') > -1;
var isUpperCase = open === open.toUpperCase() && open !== open.toLowerCase();
return isUpperCase && !isPath || isDynamicComponent(element);
}
function assertIsSimplePath(path, loc, context) {
if (!isSimplePath(path)) {
throw new _syntax.SyntaxError('`' + path.original + '` is not a valid name for a ' + context + ' on line ' + loc.start.line + '.', path.loc);
}
}
function assertValidYield(statement) {
var pairs = statement.hash.pairs;
if (pairs.length === 1 && pairs[0].key !== 'to' || pairs.length > 1) {
throw new _syntax.SyntaxError('yield only takes a single named argument: \'to\'', statement.loc);
} else if (pairs.length === 1 && pairs[0].value.type !== 'StringLiteral') {
throw new _syntax.SyntaxError('you can only yield to a literal value', statement.loc);
} else if (pairs.length === 0) {
return 'default';
} else {
return pairs[0].value.value;
}
}
function assertValidPartial(statement) {
var params = statement.params,
hash = statement.hash,
escaped = statement.escaped,
loc = statement.loc;
if (params && params.length !== 1) {
throw new _syntax.SyntaxError('Partial found with no arguments. You must specify a template name. (on line ' + loc.start.line + ')', statement.loc);
} else if (hash && hash.pairs.length > 0) {
throw new _syntax.SyntaxError('partial does not take any named arguments (on line ' + loc.start.line + ')', statement.loc);
} else if (!escaped) {
throw new _syntax.SyntaxError('{{{partial ...}}} is not supported, please use {{partial ...}} instead (on line ' + loc.start.line + ')', statement.loc);
}
return params;
}
function assertValidHasBlockUsage(type, call) {
var params = call.params,
hash = call.hash,
loc = call.loc,
param;
if (hash && hash.pairs.length > 0) {
throw new _syntax.SyntaxError(type + ' does not take any named arguments', call.loc);
}
if (params.length === 0) {
return 'default';
} else if (params.length === 1) {
param = params[0];
if (param.type === 'StringLiteral') {
return param.value;
} else {
throw new _syntax.SyntaxError('you can only yield to a literal value (on line ' + loc.start.line + ')', call.loc);
}
} else {
throw new _syntax.SyntaxError(type + ' only takes a single positional argument (on line ' + loc.start.line + ')', call.loc);
}
}
function assertValidDebuggerUsage(statement) {
var params = statement.params,
hash = statement.hash;
if (hash && hash.pairs.length > 0) {
throw new _syntax.SyntaxError('debugger does not take any named arguments', statement.loc);
}
if (params.length === 0) {
return 'default';
} else {
throw new _syntax.SyntaxError('debugger does not take any positional arguments', statement.loc);
}
}
var defaultId = function () {
var crypto, idFn;
if (typeof _nodeModule.require === 'function') {
try {
/* tslint:disable:no-require-imports */
crypto = (0, _nodeModule.require)('crypto');
/* tslint:enable:no-require-imports */
idFn = function (src) {
var hash = crypto.createHash('sha1');
hash.update(src, 'utf8');
// trim to 6 bytes of data (2^48 - 1)
return hash.digest('base64').substring(0, 8);
};
idFn('test');
return idFn;
} catch (e) {}
}
return function () {
return null;
};
}();
var defaultOptions = {
id: defaultId,
meta: {}
};
exports.defaultId = defaultId;
exports.precompile = function (string) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
var ast = (0, _syntax.preprocess)(string, options);
var meta = options.meta;
var _TemplateCompiler$com = TemplateCompiler.compile(ast, options),
block = _TemplateCompiler$com.block;
var idFn = options.id || defaultId;
var blockJSON = JSON.stringify(block.toJSON());
var templateJSONObject = {
id: idFn(JSON.stringify(meta) + blockJSON),
block: blockJSON,
meta: meta
};
// JSON is javascript
return JSON.stringify(templateJSONObject);
};
exports.TemplateCompiler = TemplateCompiler;
exports.TemplateVisitor = TemplateVisitor;
});
enifed('@glimmer/syntax', ['exports', 'ember-babel', 'simple-html-tokenizer', '@glimmer/util', 'handlebars'], function (exports, _emberBabel, _simpleHtmlTokenizer, _util, _handlebars) {
'use strict';
exports.printLiteral = exports.isLiteral = exports.SyntaxError = exports.print = exports.Walker = exports.traverse = exports.cannotReplaceOrRemoveInKeyHandlerYet = exports.cannotReplaceNode = exports.cannotRemoveNode = exports.TraversalError = exports.builders = exports.preprocess = exports.AST = undefined;
function isLiteral(input) {
return !!(typeof input === 'object' && input.type.match(/Literal$/));
}
var nodes = /*#__PURE__*/Object.freeze({
isCall: function (node) {
return node.type === 'SubExpression' || node.type === 'MustacheStatement' && node.path.type === 'PathExpression';
},
isLiteral: isLiteral
});
// Expressions
function buildPath(original, loc) {
if (typeof original !== 'string') return original;
var parts = original.split('.');
var thisHead = false;
if (parts[0] === 'this') {
thisHead = true;
parts = parts.slice(1);
}
return {
type: 'PathExpression',
original: original,
this: thisHead,
parts: parts,
data: false,
loc: buildLoc(loc || null)
};
}
function buildLiteral(type, value, loc) {
return {
type: type,
value: value,
original: value,
loc: buildLoc(loc || null)
};
}
// Miscellaneous
function buildHash(pairs, loc) {
return {
type: 'Hash',
pairs: pairs || [],
loc: buildLoc(loc || null)
};
}
function buildSource(source) {
return source || null;
}
function buildPosition(line, column) {
return {
line: line,
column: column
};
}
var SYNTHETIC = {
source: '(synthetic)',
start: { line: 1, column: 0 },
end: { line: 1, column: 0 }
};
function buildLoc() {
var _len, args, _key, loc, startLine, startColumn, endLine, endColumn, source;
for (_len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 1) {
loc = args[0];
if (loc && typeof loc === 'object') {
return {
source: buildSource(loc.source),
start: buildPosition(loc.start.line, loc.start.column),
end: buildPosition(loc.end.line, loc.end.column)
};
} else {
return SYNTHETIC;
}
} else {
startLine = args[0], startColumn = args[1], endLine = args[2], endColumn = args[3], source = args[4];
return {
source: buildSource(source),
start: buildPosition(startLine, startColumn),
end: buildPosition(endLine, endColumn)
};
}
}
function isBlockParms(arr) {
return arr[0] === 'string';
}
function isLoc(item) {
return !Array.isArray(item);
}
var b = {
mustache: function (path, params, hash, raw, loc) {
if (!isLiteral(path)) {
path = buildPath(path);
}
return {
type: 'MustacheStatement',
path: path,
params: params || [],
hash: hash || buildHash([]),
escaped: !raw,
loc: buildLoc(loc || null)
};
},
block: function (path, params, hash, program, inverse, loc) {
return {
type: 'BlockStatement',
path: buildPath(path),
params: params || [],
hash: hash || buildHash([]),
program: program || null,
inverse: inverse || null,
loc: buildLoc(loc || null)
};
},
partial: function (name, params, hash, indent, loc) {
return {
type: 'PartialStatement',
name: name,
params: params || [],
hash: hash || buildHash([]),
indent: indent || '',
strip: { open: false, close: false },
loc: buildLoc(loc || null)
};
},
comment: function (value, loc) {
return {
type: 'CommentStatement',
value: value,
loc: buildLoc(loc || null)
};
},
mustacheComment: function (value, loc) {
return {
type: 'MustacheCommentStatement',
value: value,
loc: buildLoc(loc || null)
};
},
element: function (tag, attributes, modifiers, children, comments, blockParams, loc) {
// this is used for backwards compat prior to `blockParams` being added to the AST
if (Array.isArray(comments)) {
if (isBlockParms(comments)) {
blockParams = comments;
comments = [];
} else if (isLoc(blockParams)) {
loc = blockParams;
blockParams = [];
}
} else if (isLoc(comments)) {
// this is used for backwards compat prior to `comments` being added to the AST
loc = comments;
comments = [];
} else if (isLoc(blockParams)) {
loc = blockParams;
blockParams = [];
}
// this is used for backwards compat, prior to `selfClosing` being part of the ElementNode AST
var selfClosing = false;
if (typeof tag === 'object') {
selfClosing = tag.selfClosing;
tag = tag.name;
}
return {
type: 'ElementNode',
tag: tag || '',
selfClosing: selfClosing,
attributes: attributes || [],
blockParams: blockParams || [],
modifiers: modifiers || [],
comments: comments || [],
children: children || [],
loc: buildLoc(loc || null)
};
},
elementModifier: function (path, params, hash, loc) {
return {
type: 'ElementModifierStatement',
path: buildPath(path),
params: params || [],
hash: hash || buildHash([]),
loc: buildLoc(loc || null)
};
},
attr: function (name, value, loc) {
return {
type: 'AttrNode',
name: name,
value: value,
loc: buildLoc(loc || null)
};
},
text: function (chars, loc) {
return {
type: 'TextNode',
chars: chars || '',
loc: buildLoc(loc || null)
};
},
sexpr: function (path, params, hash, loc) {
return {
type: 'SubExpression',
path: buildPath(path),
params: params || [],
hash: hash || buildHash([]),
loc: buildLoc(loc || null)
};
},
path: buildPath,
concat: function (parts, loc) {
return {
type: 'ConcatStatement',
parts: parts || [],
loc: buildLoc(loc || null)
};
},
hash: buildHash,
pair: function (key, value, loc) {
return {
type: 'HashPair',
key: key,
value: value,
loc: buildLoc(loc || null)
};
},
literal: buildLiteral,
program: function (body, blockParams, loc) {
return {
type: 'Program',
body: body || [],
blockParams: blockParams || [],
loc: buildLoc(loc || null)
};
},
loc: buildLoc,
pos: buildPosition,
string: literal('StringLiteral'),
boolean: literal('BooleanLiteral'),
number: literal('NumberLiteral'),
undefined: function () {
return buildLiteral('UndefinedLiteral', undefined);
},
null: function () {
return buildLiteral('NullLiteral', null);
}
};
function literal(type) {
return function (value) {
return buildLiteral(type, value);
};
}
/**
* Subclass of `Error` with additional information
* about location of incorrect markup.
*/
var SyntaxError = function () {
SyntaxError.prototype = Object.create(Error.prototype);
SyntaxError.prototype.constructor = SyntaxError;
function SyntaxError(message, location) {
var error = Error.call(this, message);
this.message = message;
this.stack = error.stack;
this.location = location;
}
return SyntaxError;
}();
// Regex to validate the identifier for block parameters.
// Based on the ID validation regex in Handlebars.
var ID_INVERSE_PATTERN = /[!"#%-,\.\/;->@\[-\^`\{-~]/;
// Checks the element's attributes to see if it uses block params.
// If it does, registers the block params with the program and
// removes the corresponding attributes from the element.
function parseElementBlockParams(element) {
var params = parseBlockParams(element);
if (params) element.blockParams = params;
}
function parseBlockParams(element) {
var l = element.attributes.length,
i,
paramsString,
params,
_i,
param;
var attrNames = [];
for (i = 0; i < l; i++) {
attrNames.push(element.attributes[i].name);
}
var asIndex = attrNames.indexOf('as');
if (asIndex !== -1 && l > asIndex && attrNames[asIndex + 1].charAt(0) === '|') {
// Some basic validation, since we're doing the parsing ourselves
paramsString = attrNames.slice(asIndex).join(' ');
if (paramsString.charAt(paramsString.length - 1) !== '|' || paramsString.match(/\|/g).length !== 2) {
throw new SyntaxError("Invalid block parameters syntax: '" + paramsString + "'", element.loc);
}
params = [];
for (_i = asIndex + 1; _i < l; _i++) {
param = attrNames[_i].replace(/\|/g, '');
if (param !== '') {
if (ID_INVERSE_PATTERN.test(param)) {
throw new SyntaxError("Invalid identifier for block parameters: '" + param + "' in '" + paramsString + "'", element.loc);
}
params.push(param);
}
}
if (params.length === 0) {
throw new SyntaxError("Cannot use zero block parameters: '" + paramsString + "'", element.loc);
}
element.attributes = element.attributes.slice(0, asIndex);
return params;
}
return null;
}
function childrenFor(node) {
switch (node.type) {
case 'Program':
return node.body;
case 'ElementNode':
return node.children;
}
}
function appendChild(parent, node) {
childrenFor(parent).push(node);
}
function isLiteral$1(path) {
return path.type === 'StringLiteral' || path.type === 'BooleanLiteral' || path.type === 'NumberLiteral' || path.type === 'NullLiteral' || path.type === 'UndefinedLiteral';
}
function printLiteral(literal) {
if (literal.type === 'UndefinedLiteral') {
return 'undefined';
} else {
return JSON.stringify(literal.value);
}
}
var entityParser = new _simpleHtmlTokenizer.EntityParser(_simpleHtmlTokenizer.HTML5NamedCharRefs);
var Parser = function () {
function Parser(source) {
this.elementStack = [];
this.currentAttribute = null;
this.currentNode = null;
this.tokenizer = new _simpleHtmlTokenizer.EventedTokenizer(this, entityParser);
this.source = source.split(/(?:\r\n?|\n)/g);
}
Parser.prototype.acceptNode = function (node) {
return this[node.type](node);
};
Parser.prototype.currentElement = function () {
return this.elementStack[this.elementStack.length - 1];
};
Parser.prototype.sourceForNode = function (node, endNode) {
var firstLine = node.loc.start.line - 1;
var currentLine = firstLine - 1;
var firstColumn = node.loc.start.column;
var string = [];
var line = void 0;
var lastLine = void 0;
var lastColumn = void 0;
if (endNode) {
lastLine = endNode.loc.end.line - 1;
lastColumn = endNode.loc.end.column;
} else {
lastLine = node.loc.end.line - 1;
lastColumn = node.loc.end.column;
}
while (currentLine < lastLine) {
currentLine++;
line = this.source[currentLine];
if (currentLine === firstLine) {
if (firstLine === lastLine) {
string.push(line.slice(firstColumn, lastColumn));
} else {
string.push(line.slice(firstColumn));
}
} else if (currentLine === lastLine) {
string.push(line.slice(0, lastColumn));
} else {
string.push(line);
}
}
return string.join('\n');
};
(0, _emberBabel.createClass)(Parser, [{
key: 'currentAttr',
get: function () {
return this.currentAttribute;
}
}, {
key: 'currentTag',
get: function () {
var node = this.currentNode;
return node;
}
}, {
key: 'currentStartTag',
get: function () {
var node = this.currentNode;
return node;
}
}, {
key: 'currentEndTag',
get: function () {
var node = this.currentNode;
return node;
}
}, {
key: 'currentComment',
get: function () {
var node = this.currentNode;
return node;
}
}, {
key: 'currentData',
get: function () {
var node = this.currentNode;
return node;
}
}]);
return Parser;
}();
var HandlebarsNodeVisitors = function (_Parser) {
(0, _emberBabel.inherits)(HandlebarsNodeVisitors, _Parser);
function HandlebarsNodeVisitors() {
var _this = (0, _emberBabel.possibleConstructorReturn)(this, _Parser.apply(this, arguments));
_this.cursorCount = 0;
return _this;
}
HandlebarsNodeVisitors.prototype.cursor = function () {
return '%cursor:' + this.cursorCount++ + '%';
};
HandlebarsNodeVisitors.prototype.Program = function (program) {
this.cursorCount = 0;
var node = b.program([], program.blockParams, program.loc),
elementNode;
var i = void 0,
l = program.body.length;
this.elementStack.push(node);
if (l === 0) {
return this.elementStack.pop();
}
for (i = 0; i < l; i++) {
this.acceptNode(program.body[i]);
}
// Ensure that that the element stack is balanced properly.
var poppedNode = this.elementStack.pop();
if (poppedNode !== node) {
elementNode = poppedNode;
throw new SyntaxError('Unclosed element `' + elementNode.tag + '` (on line ' + elementNode.loc.start.line + ').', elementNode.loc);
}
return node;
};
HandlebarsNodeVisitors.prototype.BlockStatement = function (block) {
if (this.tokenizer['state'] === 'comment') {
this.appendToCommentData(this.sourceForNode(block));
return;
}
if (this.tokenizer['state'] !== 'comment' && this.tokenizer['state'] !== 'data' && this.tokenizer['state'] !== 'beforeData') {
throw new SyntaxError('A block may only be used inside an HTML element or another block.', block.loc);
}
var _acceptCallNodes = acceptCallNodes(this, block),
path = _acceptCallNodes.path,
params = _acceptCallNodes.params,
hash = _acceptCallNodes.hash;
var program = this.Program(block.program);
var inverse = block.inverse ? this.Program(block.inverse) : null;
if (path.original === 'in-element') {
hash = addInElementHash(this.cursor(), hash, block.loc);
}
var node = b.block(path, params, hash, program, inverse, block.loc);
var parentProgram = this.currentElement();
appendChild(parentProgram, node);
};
HandlebarsNodeVisitors.prototype.MustacheStatement = function (rawMustache) {
var tokenizer = this.tokenizer,
_acceptCallNodes2,
path,
params,
hash;
if (tokenizer.state === 'comment') {
this.appendToCommentData(this.sourceForNode(rawMustache));
return;
}
var mustache = void 0;
var escaped = rawMustache.escaped,
loc = rawMustache.loc;
if (rawMustache.path.type.match(/Literal$/)) {
mustache = {
type: 'MustacheStatement',
path: this.acceptNode(rawMustache.path),
params: [],
hash: b.hash(),
escaped: escaped,
loc: loc
};
} else {
_acceptCallNodes2 = acceptCallNodes(this, rawMustache), path = _acceptCallNodes2.path, params = _acceptCallNodes2.params, hash = _acceptCallNodes2.hash;
mustache = b.mustache(path, params, hash, !escaped, loc);
}
switch (tokenizer.state) {
// Tag helpers
case "tagOpen" /* tagOpen */:
case "tagName" /* tagName */:
throw new SyntaxError('Cannot use mustaches in an elements tagname: `' + this.sourceForNode(rawMustache, rawMustache.path) + '` at L' + loc.start.line + ':C' + loc.start.column, mustache.loc);
case "beforeAttributeName" /* beforeAttributeName */:
addElementModifier(this.currentStartTag, mustache);
break;
case "attributeName" /* attributeName */:
case "afterAttributeName" /* afterAttributeName */:
this.beginAttributeValue(false);
this.finishAttributeValue();
addElementModifier(this.currentStartTag, mustache);
tokenizer.transitionTo("beforeAttributeName" /* beforeAttributeName */);
break;
case "afterAttributeValueQuoted" /* afterAttributeValueQuoted */:
addElementModifier(this.currentStartTag, mustache);
tokenizer.transitionTo("beforeAttributeName" /* beforeAttributeName */);
break;
// Attribute values
case "beforeAttributeValue" /* beforeAttributeValue */:
this.beginAttributeValue(false);
appendDynamicAttributeValuePart(this.currentAttribute, mustache);
tokenizer.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */);
break;
case "attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */:
case "attributeValueSingleQuoted" /* attributeValueSingleQuoted */:
case "attributeValueUnquoted" /* attributeValueUnquoted */:
appendDynamicAttributeValuePart(this.currentAttribute, mustache);
break;
// TODO: Only append child when the tokenizer state makes
// sense to do so, otherwise throw an error.
default:
appendChild(this.currentElement(), mustache);
}
return mustache;
};
HandlebarsNodeVisitors.prototype.ContentStatement = function (content) {
updateTokenizerLocation(this.tokenizer, content);
this.tokenizer.tokenizePart(content.value);
this.tokenizer.flushData();
};
HandlebarsNodeVisitors.prototype.CommentStatement = function (rawComment) {
var tokenizer = this.tokenizer;
if (tokenizer.state === "comment" /* comment */) {
this.appendToCommentData(this.sourceForNode(rawComment));
return null;
}
var value = rawComment.value,
loc = rawComment.loc;
var comment = b.mustacheComment(value, loc);
switch (tokenizer.state) {
case "beforeAttributeName" /* beforeAttributeName */:
this.currentStartTag.comments.push(comment);
break;
case "beforeData" /* beforeData */:
case "data" /* data */:
appendChild(this.currentElement(), comment);
break;
default:
throw new SyntaxError('Using a Handlebars comment when in the `' + tokenizer['state'] + '` state is not supported: "' + comment.value + '" on line ' + loc.start.line + ':' + loc.start.column, rawComment.loc);
}
return comment;
};
HandlebarsNodeVisitors.prototype.PartialStatement = function (partial) {
var loc = partial.loc;
throw new SyntaxError('Handlebars partials are not supported: "' + this.sourceForNode(partial, partial.name) + '" at L' + loc.start.line + ':C' + loc.start.column, partial.loc);
};
HandlebarsNodeVisitors.prototype.PartialBlockStatement = function (partialBlock) {
var loc = partialBlock.loc;
throw new SyntaxError('Handlebars partial blocks are not supported: "' + this.sourceForNode(partialBlock, partialBlock.name) + '" at L' + loc.start.line + ':C' + loc.start.column, partialBlock.loc);
};
HandlebarsNodeVisitors.prototype.Decorator = function (decorator) {
var loc = decorator.loc;
throw new SyntaxError('Handlebars decorators are not supported: "' + this.sourceForNode(decorator, decorator.path) + '" at L' + loc.start.line + ':C' + loc.start.column, decorator.loc);
};
HandlebarsNodeVisitors.prototype.DecoratorBlock = function (decoratorBlock) {
var loc = decoratorBlock.loc;
throw new SyntaxError('Handlebars decorator blocks are not supported: "' + this.sourceForNode(decoratorBlock, decoratorBlock.path) + '" at L' + loc.start.line + ':C' + loc.start.column, decoratorBlock.loc);
};
HandlebarsNodeVisitors.prototype.SubExpression = function (sexpr) {
var _acceptCallNodes3 = acceptCallNodes(this, sexpr),
path = _acceptCallNodes3.path,
params = _acceptCallNodes3.params,
hash = _acceptCallNodes3.hash;
return b.sexpr(path, params, hash, sexpr.loc);
};
HandlebarsNodeVisitors.prototype.PathExpression = function (path) {
var original = path.original,
loc = path.loc,
locationInfo;
var parts = void 0;
if (original.indexOf('/') !== -1) {
if (original.slice(0, 2) === './') {
throw new SyntaxError('Using "./" is not supported in Glimmer and unnecessary: "' + path.original + '" on line ' + loc.start.line + '.', path.loc);
}
if (original.slice(0, 3) === '../') {
throw new SyntaxError('Changing context using "../" is not supported in Glimmer: "' + path.original + '" on line ' + loc.start.line + '.', path.loc);
}
if (original.indexOf('.') !== -1) {
throw new SyntaxError('Mixing \'.\' and \'/\' in paths is not supported in Glimmer; use only \'.\' to separate property paths: "' + path.original + '" on line ' + loc.start.line + '.', path.loc);
}
parts = [path.parts.join('/')];
} else if (original === '.') {
locationInfo = 'L' + loc.start.line + ':C' + loc.start.column;
throw new SyntaxError('\'.\' is not a supported path in Glimmer; check for a path with a trailing \'.\' at ' + locationInfo + '.', path.loc);
} else {
parts = path.parts;
}
var thisHead = false;
// This is to fix a bug in the Handlebars AST where the path expressions in
// `{{this.foo}}` (and similarly `{{foo-bar this.foo named=this.foo}}` etc)
// are simply turned into `{{foo}}`. The fix is to push it back onto the
// parts array and let the runtime see the difference. However, we cannot
// simply use the string `this` as it means literally the property called
// "this" in the current context (it can be expressed in the syntax as
// `{{[this]}}`, where the square bracket are generally for this kind of
// escaping – such as `{{foo.["bar.baz"]}}` would mean lookup a property
// named literally "bar.baz" on `this.foo`). By convention, we use `null`
// for this purpose.
if (original.match(/^this(\..+)?$/)) {
thisHead = true;
}
return {
type: 'PathExpression',
original: path.original,
this: thisHead,
parts: parts,
data: path.data,
loc: path.loc
};
};
HandlebarsNodeVisitors.prototype.Hash = function (hash) {
var pairs = [],
i,
pair;
for (i = 0; i < hash.pairs.length; i++) {
pair = hash.pairs[i];
pairs.push(b.pair(pair.key, this.acceptNode(pair.value), pair.loc));
}
return b.hash(pairs, hash.loc);
};
HandlebarsNodeVisitors.prototype.StringLiteral = function (string) {
return b.literal('StringLiteral', string.value, string.loc);
};
HandlebarsNodeVisitors.prototype.BooleanLiteral = function (boolean) {
return b.literal('BooleanLiteral', boolean.value, boolean.loc);
};
HandlebarsNodeVisitors.prototype.NumberLiteral = function (number) {
return b.literal('NumberLiteral', number.value, number.loc);
};
HandlebarsNodeVisitors.prototype.UndefinedLiteral = function (undef) {
return b.literal('UndefinedLiteral', undefined, undef.loc);
};
HandlebarsNodeVisitors.prototype.NullLiteral = function (nul) {
return b.literal('NullLiteral', null, nul.loc);
};
return HandlebarsNodeVisitors;
}(Parser);
function calculateRightStrippedOffsets(original, value) {
if (value === '') {
// if it is empty, just return the count of newlines
// in original
return {
lines: original.split('\n').length - 1,
columns: 0
};
}
// otherwise, return the number of newlines prior to
// `value`
var difference = original.split(value)[0];
var lines = difference.split(/\n/);
var lineCount = lines.length - 1;
return {
lines: lineCount,
columns: lines[lineCount].length
};
}
function updateTokenizerLocation(tokenizer, content) {
var line = content.loc.start.line;
var column = content.loc.start.column;
var offsets = calculateRightStrippedOffsets(content.original, content.value);
line = line + offsets.lines;
if (offsets.lines) {
column = offsets.columns;
} else {
column = column + offsets.columns;
}
tokenizer.line = line;
tokenizer.column = column;
}
function acceptCallNodes(compiler, node) {
var path = compiler.PathExpression(node.path);
var params = node.params ? node.params.map(function (e) {
return compiler.acceptNode(e);
}) : [];
var hash = node.hash ? compiler.Hash(node.hash) : b.hash();
return { path: path, params: params, hash: hash };
}
function addElementModifier(element, mustache) {
var path = mustache.path,
params = mustache.params,
hash = mustache.hash,
loc = mustache.loc,
_modifier,
tag;
if (isLiteral$1(path)) {
_modifier = '{{' + printLiteral(path) + '}}';
tag = '<' + element.name + ' ... ' + _modifier + ' ...';
throw new SyntaxError('In ' + tag + ', ' + _modifier + ' is not a valid modifier: "' + path.original + '" on line ' + (loc && loc.start.line) + '.', mustache.loc);
}
var modifier = b.elementModifier(path, params, hash, loc);
element.modifiers.push(modifier);
}
function addInElementHash(cursor, hash, loc) {
var hasNextSibling = false,
nullLiteral,
nextSibling;
hash.pairs.forEach(function (pair) {
if (pair.key === 'guid') {
throw new SyntaxError('Cannot pass `guid` from user space', loc);
}
if (pair.key === 'nextSibling') {
hasNextSibling = true;
}
});
var guid = b.literal('StringLiteral', cursor);
var guidPair = b.pair('guid', guid);
hash.pairs.unshift(guidPair);
if (!hasNextSibling) {
nullLiteral = b.literal('NullLiteral', null);
nextSibling = b.pair('nextSibling', nullLiteral);
hash.pairs.push(nextSibling);
}
return hash;
}
function appendDynamicAttributeValuePart(attribute, part) {
attribute.isDynamic = true;
attribute.parts.push(part);
}
var visitorKeys = {
Program: ['body'],
MustacheStatement: ['path', 'params', 'hash'],
BlockStatement: ['path', 'params', 'hash', 'program', 'inverse'],
ElementModifierStatement: ['path', 'params', 'hash'],
PartialStatement: ['name', 'params', 'hash'],
CommentStatement: [],
MustacheCommentStatement: [],
ElementNode: ['attributes', 'modifiers', 'children', 'comments'],
AttrNode: ['value'],
TextNode: [],
ConcatStatement: ['parts'],
SubExpression: ['path', 'params', 'hash'],
PathExpression: [],
StringLiteral: [],
BooleanLiteral: [],
NumberLiteral: [],
NullLiteral: [],
UndefinedLiteral: [],
Hash: ['pairs'],
HashPair: ['value']
};
var TraversalError = function () {
TraversalError.prototype = Object.create(Error.prototype);
TraversalError.prototype.constructor = TraversalError;
function TraversalError(message, node, parent, key) {
var error = Error.call(this, message);
this.key = key;
this.message = message;
this.node = node;
this.parent = parent;
this.stack = error.stack;
}
return TraversalError;
}();
function cannotRemoveNode(node, parent, key) {
return new TraversalError('Cannot remove a node unless it is part of an array', node, parent, key);
}
function cannotReplaceNode(node, parent, key) {
return new TraversalError('Cannot replace a node with multiple nodes unless it is part of an array', node, parent, key);
}
function cannotReplaceOrRemoveInKeyHandlerYet(node, key) {
return new TraversalError('Replacing and removing in key handlers is not yet supported.', node, null, key);
}
function visitNode(visitor, node) {
var handler = visitor[node.type] || visitor.All || null,
keys,
i;
var result = void 0;
if (handler && handler['enter']) {
result = handler['enter'].call(null, node);
}
if (result !== undefined && result !== null) {
if (JSON.stringify(node) === JSON.stringify(result)) {
result = undefined;
} else if (Array.isArray(result)) {
return visitArray(visitor, result) || result;
} else {
return visitNode(visitor, result) || result;
}
}
if (result === undefined) {
keys = visitorKeys[node.type];
for (i = 0; i < keys.length; i++) {
visitKey(visitor, handler, node, keys[i]);
}
if (handler && handler['exit']) {
result = handler['exit'].call(null, node);
}
}
return result;
}
function visitKey(visitor, handler, node, key) {
var value = node[key],
_result;
if (!value) {
return;
}
var keyHandler = handler && (handler.keys[key] || handler.keys.All);
var result = void 0;
if (keyHandler && keyHandler.enter) {
result = keyHandler.enter.call(null, node, key);
if (result !== undefined) {
throw cannotReplaceOrRemoveInKeyHandlerYet(node, key);
}
}
if (Array.isArray(value)) {
visitArray(visitor, value);
} else {
_result = visitNode(visitor, value);
if (_result !== undefined) {
assignKey(node, key, _result);
}
}
if (keyHandler && keyHandler.exit) {
result = keyHandler.exit.call(null, node, key);
if (result !== undefined) {
throw cannotReplaceOrRemoveInKeyHandlerYet(node, key);
}
}
}
function visitArray(visitor, array) {
var i, result;
for (i = 0; i < array.length; i++) {
result = visitNode(visitor, array[i]);
if (result !== undefined) {
i += spliceArray(array, i, result) - 1;
}
}
}
function assignKey(node, key, result) {
if (result === null) {
throw cannotRemoveNode(node[key], node, key);
} else if (Array.isArray(result)) {
if (result.length === 1) {
node[key] = result[0];
} else {
if (result.length === 0) {
throw cannotRemoveNode(node[key], node, key);
} else {
throw cannotReplaceNode(node[key], node, key);
}
}
} else {
node[key] = result;
}
}
function spliceArray(array, index, result) {
if (result === null) {
array.splice(index, 1);
return 0;
} else if (Array.isArray(result)) {
array.splice.apply(array, [index, 1].concat(result));
return result.length;
} else {
array.splice(index, 1, result);
return 1;
}
}
function traverse(node, visitor) {
visitNode(normalizeVisitor(visitor), node);
}
function normalizeVisitor(visitor) {
var normalizedVisitor = {},
handler,
normalizedKeys,
keys,
keyHandler;
for (var type in visitor) {
handler = visitor[type] || visitor.All;
normalizedKeys = {};
if (typeof handler === 'object') {
keys = handler.keys;
if (keys) {
for (var key in keys) {
keyHandler = keys[key];
if (typeof keyHandler === 'object') {
normalizedKeys[key] = {
enter: typeof keyHandler.enter === 'function' ? keyHandler.enter : null,
exit: typeof keyHandler.exit === 'function' ? keyHandler.exit : null
};
} else if (typeof keyHandler === 'function') {
normalizedKeys[key] = {
enter: keyHandler,
exit: null
};
}
}
}
normalizedVisitor[type] = {
enter: typeof handler.enter === 'function' ? handler.enter : null,
exit: typeof handler.exit === 'function' ? handler.exit : null,
keys: normalizedKeys
};
} else if (typeof handler === 'function') {
normalizedVisitor[type] = {
enter: handler,
exit: null,
keys: normalizedKeys
};
}
}
return normalizedVisitor;
}
var ATTR_VALUE_REGEX_TEST = /[\xA0"&]/;
var ATTR_VALUE_REGEX_REPLACE = new RegExp(ATTR_VALUE_REGEX_TEST.source, 'g');
var TEXT_REGEX_TEST = /[\xA0&<>]/;
var TEXT_REGEX_REPLACE = new RegExp(TEXT_REGEX_TEST.source, 'g');
function attrValueReplacer(char) {
switch (char.charCodeAt(0)) {
case 160 /* NBSP */:
return ' ';
case 34 /* QUOT */:
return '"';
case 38 /* AMP */:
return '&';
default:
return char;
}
}
function textReplacer(char) {
switch (char.charCodeAt(0)) {
case 160 /* NBSP */:
return ' ';
case 38 /* AMP */:
return '&';
case 60 /* LT */:
return '<';
case 62 /* GT */:
return '>';
default:
return char;
}
}
function escapeAttrValue(attrValue) {
if (ATTR_VALUE_REGEX_TEST.test(attrValue)) {
return attrValue.replace(ATTR_VALUE_REGEX_REPLACE, attrValueReplacer);
}
return attrValue;
}
function escapeText(text) {
if (TEXT_REGEX_TEST.test(text)) {
return text.replace(TEXT_REGEX_REPLACE, textReplacer);
}
return text;
}
function unreachable() {
throw new Error('unreachable');
}
function build(ast) {
if (!ast) {
return '';
}
var output = [],
chainBlock,
body,
lines;
switch (ast.type) {
case 'Program':
{
chainBlock = ast['chained'] && ast.body[0];
if (chainBlock) {
chainBlock['chained'] = true;
}
body = buildEach(ast.body).join('');
output.push(body);
}
break;
case 'ElementNode':
output.push('<', ast.tag);
if (ast.attributes.length) {
output.push(' ', buildEach(ast.attributes).join(' '));
}
if (ast.modifiers.length) {
output.push(' ', buildEach(ast.modifiers).join(' '));
}
if (ast.comments.length) {
output.push(' ', buildEach(ast.comments).join(' '));
}
if (ast.blockParams.length) {
output.push(' ', 'as', ' ', '|' + ast.blockParams.join(' ') + '|');
}
if (voidMap[ast.tag]) {
if (ast.selfClosing) {
output.push(' /');
}
output.push('>');
} else {
output.push('>');
output.push.apply(output, buildEach(ast.children));
output.push('', ast.tag, '>');
}
break;
case 'AttrNode':
if (ast.value.type === 'TextNode') {
if (ast.value.chars !== '') {
output.push(ast.name, '=');
output.push('"', escapeAttrValue(ast.value.chars), '"');
} else {
output.push(ast.name);
}
} else {
output.push(ast.name, '=');
// ast.value is mustache or concat
output.push(build(ast.value));
}
break;
case 'ConcatStatement':
output.push('"');
ast.parts.forEach(function (node) {
if (node.type === 'TextNode') {
output.push(escapeAttrValue(node.chars));
} else {
output.push(build(node));
}
});
output.push('"');
break;
case 'TextNode':
output.push(escapeText(ast.chars));
break;
case 'MustacheStatement':
{
output.push(compactJoin(['{{', pathParams(ast), '}}']));
}
break;
case 'MustacheCommentStatement':
{
output.push(compactJoin(['{{!--', ast.value, '--}}']));
}
break;
case 'ElementModifierStatement':
{
output.push(compactJoin(['{{', pathParams(ast), '}}']));
}
break;
case 'PathExpression':
output.push(ast.original);
break;
case 'SubExpression':
{
output.push('(', pathParams(ast), ')');
}
break;
case 'BooleanLiteral':
output.push(ast.value ? 'true' : 'false');
break;
case 'BlockStatement':
{
lines = [];
if (ast['chained']) {
lines.push(['{{else ', pathParams(ast), '}}'].join(''));
} else {
lines.push(openBlock(ast));
}
lines.push(build(ast.program));
if (ast.inverse) {
if (!ast.inverse['chained']) {
lines.push('{{else}}');
}
lines.push(build(ast.inverse));
}
if (!ast['chained']) {
lines.push(closeBlock(ast));
}
output.push(lines.join(''));
}
break;
case 'PartialStatement':
{
output.push(compactJoin(['{{>', pathParams(ast), '}}']));
}
break;
case 'CommentStatement':
{
output.push(compactJoin(['']));
}
break;
case 'StringLiteral':
{
output.push('"' + ast.value + '"');
}
break;
case 'NumberLiteral':
{
output.push(String(ast.value));
}
break;
case 'UndefinedLiteral':
{
output.push('undefined');
}
break;
case 'NullLiteral':
{
output.push('null');
}
break;
case 'Hash':
{
output.push(ast.pairs.map(function (pair) {
return build(pair);
}).join(' '));
}
break;
case 'HashPair':
{
output.push(ast.key + '=' + build(ast.value));
}
break;
}
return output.join('');
}
function compact(array) {
var newArray = [];
array.forEach(function (a) {
if (typeof a !== 'undefined' && a !== null && a !== '') {
newArray.push(a);
}
});
return newArray;
}
function buildEach(asts) {
return asts.map(build);
}
function pathParams(ast) {
var path = void 0;
switch (ast.type) {
case 'MustacheStatement':
case 'SubExpression':
case 'ElementModifierStatement':
case 'BlockStatement':
if (isLiteral(ast.path)) {
return String(ast.path.value);
}
path = build(ast.path);
break;
case 'PartialStatement':
path = build(ast.name);
break;
default:
return unreachable();
}
return compactJoin([path, buildEach(ast.params).join(' '), build(ast.hash)], ' ');
}
function compactJoin(array, delimiter) {
return compact(array).join(delimiter || '');
}
function blockParams(block) {
var params = block.program.blockParams;
if (params.length) {
return ' as |' + params.join(' ') + '|';
}
return null;
}
function openBlock(block) {
return ['{{#', pathParams(block), blockParams(block), '}}'].join('');
}
function closeBlock(block) {
return ['{{/', build(block.path), '}}'].join('');
}
var Walker = function () {
function Walker(order) {
this.order = order;
this.stack = [];
}
Walker.prototype.visit = function (node, callback) {
if (!node) {
return;
}
this.stack.push(node);
if (this.order === 'post') {
this.children(node, callback);
callback(node, this);
} else {
callback(node, this);
this.children(node, callback);
}
this.stack.pop();
};
Walker.prototype.children = function (node, callback) {
var visitor = visitors[node.type];
if (visitor) {
visitor(this, node, callback);
}
};
return Walker;
}();
var visitors = {
Program: function (walker, node, callback) {
var i;
for (i = 0; i < node.body.length; i++) {
walker.visit(node.body[i], callback);
}
},
ElementNode: function (walker, node, callback) {
var i;
for (i = 0; i < node.children.length; i++) {
walker.visit(node.children[i], callback);
}
},
BlockStatement: function (walker, node, callback) {
walker.visit(node.program, callback);
walker.visit(node.inverse || null, callback);
}
};
var voidMap = Object.create(null);
'area base br col command embed hr img input keygen link meta param source track wbr'.split(' ').forEach(function (tagName) {
voidMap[tagName] = true;
});
var TokenizerEventHandlers = function (_HandlebarsNodeVisito) {
(0, _emberBabel.inherits)(TokenizerEventHandlers, _HandlebarsNodeVisito);
function TokenizerEventHandlers() {
var _this2 = (0, _emberBabel.possibleConstructorReturn)(this, _HandlebarsNodeVisito.apply(this, arguments));
_this2.tagOpenLine = 0;
_this2.tagOpenColumn = 0;
return _this2;
}
TokenizerEventHandlers.prototype.reset = function () {
this.currentNode = null;
};
TokenizerEventHandlers.prototype.beginComment = function () {
this.currentNode = b.comment('');
this.currentNode.loc = {
source: null,
start: b.pos(this.tagOpenLine, this.tagOpenColumn),
end: null
};
};
TokenizerEventHandlers.prototype.appendToCommentData = function (char) {
this.currentComment.value += char;
};
TokenizerEventHandlers.prototype.finishComment = function () {
this.currentComment.loc.end = b.pos(this.tokenizer.line, this.tokenizer.column);
appendChild(this.currentElement(), this.currentComment);
};
TokenizerEventHandlers.prototype.beginData = function () {
this.currentNode = b.text();
this.currentNode.loc = {
source: null,
start: b.pos(this.tokenizer.line, this.tokenizer.column),
end: null
};
};
TokenizerEventHandlers.prototype.appendToData = function (char) {
this.currentData.chars += char;
};
TokenizerEventHandlers.prototype.finishData = function () {
this.currentData.loc.end = b.pos(this.tokenizer.line, this.tokenizer.column);
appendChild(this.currentElement(), this.currentData);
};
TokenizerEventHandlers.prototype.tagOpen = function () {
this.tagOpenLine = this.tokenizer.line;
this.tagOpenColumn = this.tokenizer.column;
};
TokenizerEventHandlers.prototype.beginStartTag = function () {
this.currentNode = {
type: 'StartTag',
name: '',
attributes: [],
modifiers: [],
comments: [],
selfClosing: false,
loc: SYNTHETIC
};
};
TokenizerEventHandlers.prototype.beginEndTag = function () {
this.currentNode = {
type: 'EndTag',
name: '',
attributes: [],
modifiers: [],
comments: [],
selfClosing: false,
loc: SYNTHETIC
};
};
TokenizerEventHandlers.prototype.finishTag = function () {
var _tokenizer = this.tokenizer,
line = _tokenizer.line,
column = _tokenizer.column;
var tag = this.currentTag;
tag.loc = b.loc(this.tagOpenLine, this.tagOpenColumn, line, column);
if (tag.type === 'StartTag') {
this.finishStartTag();
if (voidMap[tag.name] || tag.selfClosing) {
this.finishEndTag(true);
}
} else if (tag.type === 'EndTag') {
this.finishEndTag(false);
}
};
TokenizerEventHandlers.prototype.finishStartTag = function () {
var _currentStartTag = this.currentStartTag,
name = _currentStartTag.name,
attributes = _currentStartTag.attributes,
modifiers = _currentStartTag.modifiers,
comments = _currentStartTag.comments,
selfClosing = _currentStartTag.selfClosing;
var loc = b.loc(this.tagOpenLine, this.tagOpenColumn);
var element = b.element({ name: name, selfClosing: selfClosing }, attributes, modifiers, [], comments, [], loc);
this.elementStack.push(element);
};
TokenizerEventHandlers.prototype.finishEndTag = function (isVoid) {
var tag = this.currentTag;
var element = this.elementStack.pop();
var parent = this.currentElement();
validateEndTag(tag, element, isVoid);
element.loc.end.line = this.tokenizer.line;
element.loc.end.column = this.tokenizer.column;
parseElementBlockParams(element);
appendChild(parent, element);
};
TokenizerEventHandlers.prototype.markTagAsSelfClosing = function () {
this.currentTag.selfClosing = true;
};
TokenizerEventHandlers.prototype.appendToTagName = function (char) {
this.currentTag.name += char;
};
TokenizerEventHandlers.prototype.beginAttribute = function () {
var tag = this.currentTag;
if (tag.type === 'EndTag') {
throw new SyntaxError('Invalid end tag: closing tag must not have attributes, ' + ('in `' + tag.name + '` (on line ' + this.tokenizer.line + ').'), tag.loc);
}
this.currentAttribute = {
name: '',
parts: [],
isQuoted: false,
isDynamic: false,
start: b.pos(this.tokenizer.line, this.tokenizer.column),
valueStartLine: 0,
valueStartColumn: 0
};
};
TokenizerEventHandlers.prototype.appendToAttributeName = function (char) {
this.currentAttr.name += char;
};
TokenizerEventHandlers.prototype.beginAttributeValue = function (isQuoted) {
this.currentAttr.isQuoted = isQuoted;
this.currentAttr.valueStartLine = this.tokenizer.line;
this.currentAttr.valueStartColumn = this.tokenizer.column;
};
TokenizerEventHandlers.prototype.appendToAttributeValue = function (char) {
var parts = this.currentAttr.parts,
loc,
text;
var lastPart = parts[parts.length - 1];
if (lastPart && lastPart.type === 'TextNode') {
lastPart.chars += char;
// update end location for each added char
lastPart.loc.end.line = this.tokenizer.line;
lastPart.loc.end.column = this.tokenizer.column;
} else {
// initially assume the text node is a single char
loc = b.loc(this.tokenizer.line, this.tokenizer.column, this.tokenizer.line, this.tokenizer.column);
// correct for `\n` as first char
if (char === '\n') {
loc.start.line -= 1;
loc.start.column = lastPart ? lastPart.loc.end.column : this.currentAttr.valueStartColumn;
}
text = b.text(char, loc);
parts.push(text);
}
};
TokenizerEventHandlers.prototype.finishAttributeValue = function () {
var _currentAttr = this.currentAttr,
name = _currentAttr.name,
parts = _currentAttr.parts,
isQuoted = _currentAttr.isQuoted,
isDynamic = _currentAttr.isDynamic,
valueStartLine = _currentAttr.valueStartLine,
valueStartColumn = _currentAttr.valueStartColumn;
var value = assembleAttributeValue(parts, isQuoted, isDynamic, this.tokenizer.line);
value.loc = b.loc(valueStartLine, valueStartColumn, this.tokenizer.line, this.tokenizer.column);
var loc = b.loc(this.currentAttr.start.line, this.currentAttr.start.column, this.tokenizer.line, this.tokenizer.column);
var attribute = b.attr(name, value, loc);
this.currentStartTag.attributes.push(attribute);
};
TokenizerEventHandlers.prototype.reportSyntaxError = function (message) {
throw new SyntaxError('Syntax error at line ' + this.tokenizer.line + ' col ' + this.tokenizer.column + ': ' + message, b.loc(this.tokenizer.line, this.tokenizer.column));
};
return TokenizerEventHandlers;
}(HandlebarsNodeVisitors);
function assembleAttributeValue(parts, isQuoted, isDynamic, line) {
if (isDynamic) {
if (isQuoted) {
return assembleConcatenatedValue(parts);
} else {
if (parts.length === 1 || parts.length === 2 && parts[1].type === 'TextNode' && parts[1].chars === '/') {
return parts[0];
} else {
throw new SyntaxError('An unquoted attribute value must be a string or a mustache, ' + 'preceeded by whitespace or a \'=\' character, and ' + ('followed by whitespace, a \'>\' character, or \'/>\' (on line ' + line + ')'), b.loc(line, 0));
}
}
} else {
return parts.length > 0 ? parts[0] : b.text('');
}
}
function assembleConcatenatedValue(parts) {
var i, part;
for (i = 0; i < parts.length; i++) {
part = parts[i];
if (part.type !== 'MustacheStatement' && part.type !== 'TextNode') {
throw new SyntaxError('Unsupported node in quoted attribute value: ' + part['type'], part.loc);
}
}
return b.concat(parts);
}
function validateEndTag(tag, element, selfClosing) {
var error = void 0;
if (voidMap[tag.name] && !selfClosing) {
// EngTag is also called by StartTag for void and self-closing tags (i.e.
// or , so we need to check for that here. Otherwise, we would
// throw an error for those cases.
error = 'Invalid end tag ' + formatEndTagInfo(tag) + ' (void elements cannot have end tags).';
} else if (element.tag === undefined) {
error = 'Closing tag ' + formatEndTagInfo(tag) + ' without an open tag.';
} else if (element.tag !== tag.name) {
error = 'Closing tag ' + formatEndTagInfo(tag) + ' did not match last open tag `' + element.tag + '` (on line ' + element.loc.start.line + ').';
}
if (error) {
throw new SyntaxError(error, element.loc);
}
}
function formatEndTagInfo(tag) {
return '`' + tag.name + '` (on line ' + tag.loc.end.line + ')';
}
var syntax = {
parse: preprocess,
builders: b,
print: build,
traverse: traverse,
Walker: Walker
};
function preprocess(html, options) {
var ast = typeof html === 'object' ? html : (0, _handlebars.parse)(html),
i,
l,
transform,
env,
pluginResult;
var program = new TokenizerEventHandlers(html).acceptNode(ast);
if (options && options.plugins && options.plugins.ast) {
for (i = 0, l = options.plugins.ast.length; i < l; i++) {
transform = options.plugins.ast[i];
env = (0, _util.assign)({}, options, { syntax: syntax }, { plugins: undefined });
pluginResult = transform(env);
traverse(program, pluginResult.visitor);
}
}
return program;
}
// used by ember-compiler
exports.AST = nodes;
exports.preprocess = preprocess;
exports.builders = b;
exports.TraversalError = TraversalError;
exports.cannotRemoveNode = cannotRemoveNode;
exports.cannotReplaceNode = cannotReplaceNode;
exports.cannotReplaceOrRemoveInKeyHandlerYet = cannotReplaceOrRemoveInKeyHandlerYet;
exports.traverse = traverse;
exports.Walker = Walker;
exports.print = build;
exports.SyntaxError = SyntaxError;
exports.isLiteral = isLiteral$1;
exports.printLiteral = printLiteral;
});
enifed('@glimmer/util', ['exports', 'ember-babel'], function (exports, _emberBabel) {
'use strict';
exports.unreachable = exports.expect = exports.unwrap = exports.EMPTY_ARRAY = exports.ListSlice = exports.ListNode = exports.LinkedList = exports.EMPTY_SLICE = exports.dict = exports.DictSet = exports.Stack = exports.SERIALIZATION_FIRST_NODE_STRING = exports.isSerializationFirstNode = exports.initializeGuid = exports.ensureGuid = exports.fillNulls = exports.assign = exports.assert = undefined;
// import Logger from './logger';
// let alreadyWarned = false;
var objKeys = Object.keys;
var GUID = 0;
function initializeGuid(object) {
return object._guid = ++GUID;
}
function ensureGuid(object) {
return object._guid || initializeGuid(object);
}
var SERIALIZATION_FIRST_NODE_STRING = '%+b:0%';
function dict() {
return Object.create(null);
}
var DictSet = function () {
function DictSet() {
this.dict = dict();
}
DictSet.prototype.add = function (obj) {
if (typeof obj === 'string') this.dict[obj] = obj;else this.dict[ensureGuid(obj)] = obj;
return this;
};
DictSet.prototype.delete = function (obj) {
if (typeof obj === 'string') delete this.dict[obj];else if (obj._guid) delete this.dict[obj._guid];
};
return DictSet;
}();
var Stack = function () {
function Stack() {
this.stack = [];
this.current = null;
}
Stack.prototype.push = function (item) {
this.current = item;
this.stack.push(item);
};
Stack.prototype.pop = function () {
var item = this.stack.pop();
var len = this.stack.length;
this.current = len === 0 ? null : this.stack[len - 1];
return item === undefined ? null : item;
};
Stack.prototype.isEmpty = function () {
return this.stack.length === 0;
};
(0, _emberBabel.createClass)(Stack, [{
key: 'size',
get: function () {
return this.stack.length;
}
}]);
return Stack;
}();
var LinkedList = function () {
function LinkedList() {
this.clear();
}
LinkedList.prototype.head = function () {
return this._head;
};
LinkedList.prototype.tail = function () {
return this._tail;
};
LinkedList.prototype.clear = function () {
this._head = this._tail = null;
};
LinkedList.prototype.toArray = function () {
var out = [];
this.forEachNode(function (n) {
return out.push(n);
});
return out;
};
LinkedList.prototype.nextNode = function (node) {
return node.next;
};
LinkedList.prototype.forEachNode = function (callback) {
var node = this._head;
while (node !== null) {
callback(node);
node = node.next;
}
};
LinkedList.prototype.insertBefore = function (node) {
var reference = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
if (reference === null) return this.append(node);
if (reference.prev) reference.prev.next = node;else this._head = node;
node.prev = reference.prev;
node.next = reference;
reference.prev = node;
return node;
};
LinkedList.prototype.append = function (node) {
var tail = this._tail;
if (tail) {
tail.next = node;
node.prev = tail;
node.next = null;
} else {
this._head = node;
}
return this._tail = node;
};
LinkedList.prototype.remove = function (node) {
if (node.prev) node.prev.next = node.next;else this._head = node.next;
if (node.next) node.next.prev = node.prev;else this._tail = node.prev;
return node;
};
return LinkedList;
}();
var ListSlice = function () {
function ListSlice(head, tail) {
this._head = head;
this._tail = tail;
}
ListSlice.prototype.forEachNode = function (callback) {
var node = this._head;
while (node !== null) {
callback(node);
node = this.nextNode(node);
}
};
ListSlice.prototype.head = function () {
return this._head;
};
ListSlice.prototype.tail = function () {
return this._tail;
};
ListSlice.prototype.toArray = function () {
var out = [];
this.forEachNode(function (n) {
return out.push(n);
});
return out;
};
ListSlice.prototype.nextNode = function (node) {
if (node === this._tail) return null;
return node.next;
};
return ListSlice;
}();
var EMPTY_SLICE = new ListSlice(null, null);
var EMPTY_ARRAY = Object.freeze([]);
exports.assert = function (test, msg) {
// if (!alreadyWarned) {
// alreadyWarned = true;
// Logger.warn("Don't leave debug assertions on in public builds");
// }
if (!test) {
throw new Error(msg || 'assertion failure');
}
};
exports.assign = function (obj) {
var i, assignment, keys, j, key;
for (i = 1; i < arguments.length; i++) {
assignment = arguments[i];
if (assignment === null || typeof assignment !== 'object') continue;
keys = objKeys(assignment);
for (j = 0; j < keys.length; j++) {
key = keys[j];
obj[key] = assignment[key];
}
}
return obj;
};
exports.fillNulls = function (count) {
var arr = new Array(count),
i;
for (i = 0; i < count; i++) {
arr[i] = null;
}
return arr;
};
exports.ensureGuid = ensureGuid;
exports.initializeGuid = initializeGuid;
exports.isSerializationFirstNode = function (node) {
return node.nodeValue === SERIALIZATION_FIRST_NODE_STRING;
};
exports.SERIALIZATION_FIRST_NODE_STRING = SERIALIZATION_FIRST_NODE_STRING;
exports.Stack = Stack;
exports.DictSet = DictSet;
exports.dict = dict;
exports.EMPTY_SLICE = EMPTY_SLICE;
exports.LinkedList = LinkedList;
exports.ListNode = function (value) {
this.next = null;
this.prev = null;
this.value = value;
};
exports.ListSlice = ListSlice;
exports.EMPTY_ARRAY = EMPTY_ARRAY;
exports.unwrap = function (val) {
if (val === null || val === undefined) throw new Error('Expected value to be present');
return val;
};
exports.expect = function (val, message) {
if (val === null || val === undefined) throw new Error(message);
return val;
};
exports.unreachable = function () {
var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'unreachable';
return new Error(message);
};
});
enifed("@glimmer/wire-format", ["exports"], function (exports) {
"use strict";
var Opcodes;
(function (Opcodes) {
// Statements
Opcodes[Opcodes["Text"] = 0] = "Text";
Opcodes[Opcodes["Append"] = 1] = "Append";
Opcodes[Opcodes["Comment"] = 2] = "Comment";
Opcodes[Opcodes["Modifier"] = 3] = "Modifier";
Opcodes[Opcodes["Block"] = 4] = "Block";
Opcodes[Opcodes["Component"] = 5] = "Component";
Opcodes[Opcodes["DynamicComponent"] = 6] = "DynamicComponent";
Opcodes[Opcodes["OpenElement"] = 7] = "OpenElement";
Opcodes[Opcodes["OpenSplattedElement"] = 8] = "OpenSplattedElement";
Opcodes[Opcodes["FlushElement"] = 9] = "FlushElement";
Opcodes[Opcodes["CloseElement"] = 10] = "CloseElement";
Opcodes[Opcodes["StaticAttr"] = 11] = "StaticAttr";
Opcodes[Opcodes["DynamicAttr"] = 12] = "DynamicAttr";
Opcodes[Opcodes["AttrSplat"] = 13] = "AttrSplat";
Opcodes[Opcodes["Yield"] = 14] = "Yield";
Opcodes[Opcodes["Partial"] = 15] = "Partial";
Opcodes[Opcodes["DynamicArg"] = 16] = "DynamicArg";
Opcodes[Opcodes["StaticArg"] = 17] = "StaticArg";
Opcodes[Opcodes["TrustingAttr"] = 18] = "TrustingAttr";
Opcodes[Opcodes["Debugger"] = 19] = "Debugger";
Opcodes[Opcodes["ClientSideStatement"] = 20] = "ClientSideStatement";
// Expressions
Opcodes[Opcodes["Unknown"] = 21] = "Unknown";
Opcodes[Opcodes["Get"] = 22] = "Get";
Opcodes[Opcodes["MaybeLocal"] = 23] = "MaybeLocal";
Opcodes[Opcodes["HasBlock"] = 24] = "HasBlock";
Opcodes[Opcodes["HasBlockParams"] = 25] = "HasBlockParams";
Opcodes[Opcodes["Undefined"] = 26] = "Undefined";
Opcodes[Opcodes["Helper"] = 27] = "Helper";
Opcodes[Opcodes["Concat"] = 28] = "Concat";
Opcodes[Opcodes["ClientSideExpression"] = 29] = "ClientSideExpression";
})(Opcodes || (exports.Ops = Opcodes = {}));
function is(variant) {
return function (value) {
return Array.isArray(value) && value[0] === variant;
};
}
// Statements
var isModifier = is(Opcodes.Modifier);
var isFlushElement = is(Opcodes.FlushElement);
var isAttrSplat = is(Opcodes.AttrSplat);
function isAttribute(val) {
return val[0] === Opcodes.StaticAttr || val[0] === Opcodes.DynamicAttr || val[0] === Opcodes.TrustingAttr;
}
function isArgument(val) {
return val[0] === Opcodes.StaticArg || val[0] === Opcodes.DynamicArg;
}
// Expressions
var isGet = is(Opcodes.Get);
var isMaybeLocal = is(Opcodes.MaybeLocal);
exports.is = is;
exports.isModifier = isModifier;
exports.isFlushElement = isFlushElement;
exports.isAttrSplat = isAttrSplat;
exports.isAttribute = isAttribute;
exports.isArgument = isArgument;
exports.isGet = isGet;
exports.isMaybeLocal = isMaybeLocal;
exports.Ops = Opcodes;
});
enifed('ember-babel', ['exports'], function (exports) {
'use strict';
exports.classCallCheck = classCallCheck;
exports.inherits = inherits;
exports.taggedTemplateLiteralLoose = taggedTemplateLiteralLoose;
exports.createClass = createClass;
exports.possibleConstructorReturn = possibleConstructorReturn;
var create = Object.create;
var setPrototypeOf = Object.setPrototypeOf;
var defineProperty = Object.defineProperty;
function classCallCheck() {}
function inherits(subClass, superClass) {
subClass.prototype = create(superClass === null ? null : superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass !== null) setPrototypeOf(subClass, superClass);
}
function taggedTemplateLiteralLoose(strings, raw) {
strings.raw = raw;
return strings;
}
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
defineProperty(target, descriptor.key, descriptor);
}
}
function createClass(Constructor, protoProps, staticProps) {
if (protoProps !== undefined) defineProperties(Constructor.prototype, protoProps);
if (staticProps !== undefined) defineProperties(Constructor, staticProps);
return Constructor;
}
function possibleConstructorReturn(self, call) {
return call !== null && typeof call === 'object' || typeof call === 'function' ? call : self;
}
});
enifed('ember-browser-environment', ['exports'], function (exports) {
'use strict';
// check if window exists and actually is the global
var hasDom = typeof self === 'object' && self !== null && self.Object === Object && typeof Window !== 'undefined' && self.constructor === Window && typeof document === 'object' && document !== null && self.document === document && typeof location === 'object' && location !== null && self.location === location && typeof history === 'object' && history !== null && self.history === history && typeof navigator === 'object' && navigator !== null && self.navigator === navigator && typeof navigator.userAgent === 'string';
var window = hasDom ? self : null;
var location$1 = hasDom ? self.location : null;
var history$1 = hasDom ? self.history : null;
var userAgent = hasDom ? self.navigator.userAgent : 'Lynx (textmode)';
var isChrome = hasDom ? !!window.chrome && !window.opera : false;
var isFirefox = hasDom ? typeof InstallTrigger !== 'undefined' : false;
exports.window = window;
exports.location = location$1;
exports.history = history$1;
exports.userAgent = userAgent;
exports.isChrome = isChrome;
exports.isFirefox = isFirefox;
exports.hasDOM = hasDom;
});
enifed('ember-environment', ['exports'], function (exports) {
'use strict';
// from lodash to catch fake globals
function checkGlobal(value) {
return value && value.Object === Object ? value : undefined;
}
// element ids can ruin global miss checks
// export real global
var global$1 = checkGlobal(function (value) {
return value && value.nodeType === undefined ? value : undefined;
}(typeof global === 'object' && global)) || checkGlobal(typeof self === 'object' && self) || checkGlobal(typeof window === 'object' && window) || typeof mainContext !== 'undefined' && mainContext || // set before strict mode in Ember loader/wrapper
new Function('return this')(); // eval outside of strict mode
// legacy imports/exports/lookup stuff (should we keep this??)
var context = function (global, Ember) {
return Ember === undefined ? { imports: global, exports: global, lookup: global } : {
// import jQuery
imports: Ember.imports || global,
// export Ember
exports: Ember.exports || global,
// search for Namespaces
lookup: Ember.lookup || global
};
}(global$1, global$1.Ember);
/**
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
backwards compatibility with earlier versions of Ember). The `EmberENV`
hash must be created before loading Ember.
@class EmberENV
@type Object
@public
*/
var ENV = {
ENABLE_OPTIONAL_FEATURES: false,
/**
Determines whether Ember should add to `Array`, `Function`, and `String`
native object prototypes, a few extra methods in order to provide a more
friendly API.
We generally recommend leaving this option set to true however, if you need
to turn it off, you can add the configuration property
`EXTEND_PROTOTYPES` to `EmberENV` and set it to `false`.
Note, when disabled (the default configuration for Ember Addons), you will
instead have to access all methods and functions from the Ember
namespace.
@property EXTEND_PROTOTYPES
@type Boolean
@default true
@for EmberENV
@public
*/
EXTEND_PROTOTYPES: {
Array: true,
Function: true,
String: true
},
/**
The `LOG_STACKTRACE_ON_DEPRECATION` property, when true, tells Ember to log
a full stack trace during deprecation warnings.
@property LOG_STACKTRACE_ON_DEPRECATION
@type Boolean
@default true
@for EmberENV
@public
*/
LOG_STACKTRACE_ON_DEPRECATION: true,
/**
The `LOG_VERSION` property, when true, tells Ember to log versions of all
dependent libraries in use.
@property LOG_VERSION
@type Boolean
@default true
@for EmberENV
@public
*/
LOG_VERSION: true,
RAISE_ON_DEPRECATION: false,
STRUCTURED_PROFILE: false,
/**
Whether to insert a `` wrapper around the
application template. See RFC #280.
This is not intended to be set directly, as the implementation may change in
the future. Use `@ember/optional-features` instead.
@property _APPLICATION_TEMPLATE_WRAPPER
@for EmberENV
@type Boolean
@default true
@private
*/
_APPLICATION_TEMPLATE_WRAPPER: true,
/**
Whether to use Glimmer Component semantics (as opposed to the classic "Curly"
components semantics) for template-only components. See RFC #278.
This is not intended to be set directly, as the implementation may change in
the future. Use `@ember/optional-features` instead.
@property _TEMPLATE_ONLY_GLIMMER_COMPONENTS
@for EmberENV
@type Boolean
@default false
@private
*/
_TEMPLATE_ONLY_GLIMMER_COMPONENTS: false,
/**
Whether the app is using jQuery. See RFC #294.
This is not intended to be set directly, as the implementation may change in
the future. Use `@ember/optional-features` instead.
@property _JQUERY_INTEGRATION
@for EmberENV
@type Boolean
@default true
@private
*/
_JQUERY_INTEGRATION: true,
// the following for addon support
_ENABLE_EMBER_K_SUPPORT: false,
_ENABLE_SAFE_STRING_SUPPORT: false,
_ENABLE_ENUMERABLE_CONTAINS_SUPPORT: false,
_ENABLE_UNDERSCORE_ACTIONS_SUPPORT: false,
_ENABLE_REVERSED_OBSERVER_SUPPORT: false,
_ENABLE_INITIALIZER_ARGUMENTS_SUPPORT: false,
_ENABLE_ROUTER_RESOURCE: false,
_ENABLE_CURRENT_WHEN_SUPPORT: false,
_ENABLE_CONTROLLER_WRAPPED_SUPPORT: false,
_ENABLE_DEPRECATED_REGISTRY_SUPPORT: false,
_ENABLE_IMMEDIATE_OBSERVER_SUPPORT: false,
_ENABLE_STRING_FMT_SUPPORT: false,
_ENABLE_FREEZABLE_SUPPORT: false,
_ENABLE_COMPONENT_DEFAULTLAYOUT_SUPPORT: false,
_ENABLE_BINDING_SUPPORT: false,
_ENABLE_INPUT_TRANSFORM_SUPPORT: false,
_ENABLE_DEPRECATION_OPTIONS_SUPPORT: false,
_ENABLE_ORPHANED_OUTLETS_SUPPORT: false,
_ENABLE_WARN_OPTIONS_SUPPORT: false,
_ENABLE_RESOLVER_FUNCTION_SUPPORT: false,
_ENABLE_DID_INIT_ATTRS_SUPPORT: false,
_ENABLE_RENDER_SUPPORT: false,
_ENABLE_PROPERTY_REQUIRED_SUPPORT: false,
EMBER_LOAD_HOOKS: {},
FEATURES: {}
};
(function (EmberENV) {
if (typeof EmberENV !== 'object' || EmberENV === null) return;
for (var flag in EmberENV) {
if (!EmberENV.hasOwnProperty(flag) || flag === 'EXTEND_PROTOTYPES' || flag === 'EMBER_LOAD_HOOKS') continue;
defaultValue = ENV[flag];
if (defaultValue === true) {
ENV[flag] = EmberENV[flag] !== false;
} else if (defaultValue === false) {
ENV[flag] = EmberENV[flag] === true;
}
}
var EXTEND_PROTOTYPES = EmberENV.EXTEND_PROTOTYPES,
defaultValue,
isEnabled,
hooks;
if (EXTEND_PROTOTYPES !== undefined) {
if (typeof EXTEND_PROTOTYPES === 'object' && EXTEND_PROTOTYPES !== null) {
ENV.EXTEND_PROTOTYPES.String = EXTEND_PROTOTYPES.String !== false;
ENV.EXTEND_PROTOTYPES.Function = EXTEND_PROTOTYPES.Function !== false;
ENV.EXTEND_PROTOTYPES.Array = EXTEND_PROTOTYPES.Array !== false;
} else {
isEnabled = EXTEND_PROTOTYPES !== false;
ENV.EXTEND_PROTOTYPES.String = isEnabled;
ENV.EXTEND_PROTOTYPES.Function = isEnabled;
ENV.EXTEND_PROTOTYPES.Array = isEnabled;
}
}
// TODO this does not seem to be used by anything,
// can we remove it? do we need to deprecate it?
var EMBER_LOAD_HOOKS = EmberENV.EMBER_LOAD_HOOKS;
if (typeof EMBER_LOAD_HOOKS === 'object' && EMBER_LOAD_HOOKS !== null) {
for (var hookName in EMBER_LOAD_HOOKS) {
if (!EMBER_LOAD_HOOKS.hasOwnProperty(hookName)) continue;
hooks = EMBER_LOAD_HOOKS[hookName];
if (Array.isArray(hooks)) {
ENV.EMBER_LOAD_HOOKS[hookName] = hooks.filter(function (hook) {
return typeof hook === 'function';
});
}
}
}
var FEATURES = EmberENV.FEATURES;
if (typeof FEATURES === 'object' && FEATURES !== null) {
for (var feature in FEATURES) {
if (!FEATURES.hasOwnProperty(feature)) continue;
ENV.FEATURES[feature] = FEATURES[feature] === true;
}
}
})(global$1.EmberENV || global$1.ENV);
exports.global = global$1;
exports.context = context;
exports.getLookup = function () {
return context.lookup;
};
exports.setLookup = function (value) {
context.lookup = value;
};
exports.ENV = ENV;
exports.getENV = function () {
return ENV;
};
});
enifed('ember-template-compiler/index', ['exports', 'ember-template-compiler/lib/system/precompile', 'ember-template-compiler/lib/system/compile', 'ember-template-compiler/lib/system/compile-options', 'ember-template-compiler/lib/plugins/index', '@ember/canary-features', 'ember-environment', 'ember/version', 'ember-template-compiler/lib/compat', 'ember-template-compiler/lib/system/bootstrap', 'ember-template-compiler/lib/system/initializer'], function (exports, _precompile, _compile, _compileOptions, _index, _canaryFeatures, _emberEnvironment, _version, _compat) {
'use strict';
exports.defaultPlugins = exports.unregisterPlugin = exports.registerPlugin = exports.compileOptions = exports.compile = exports.precompile = exports._Ember = undefined;
Object.defineProperty(exports, 'precompile', {
enumerable: true,
get: function () {
return _precompile.default;
}
});
Object.defineProperty(exports, 'compile', {
enumerable: true,
get: function () {
return _compile.default;
}
});
Object.defineProperty(exports, 'compileOptions', {
enumerable: true,
get: function () {
return _compileOptions.default;
}
});
Object.defineProperty(exports, 'registerPlugin', {
enumerable: true,
get: function () {
return _compileOptions.registerPlugin;
}
});
Object.defineProperty(exports, 'unregisterPlugin', {
enumerable: true,
get: function () {
return _compileOptions.unregisterPlugin;
}
});
Object.defineProperty(exports, 'defaultPlugins', {
enumerable: true,
get: function () {
return _index.default;
}
});
var _Ember = exports._Ember = typeof _emberEnvironment.context.imports.Ember === 'object' && _emberEnvironment.context.imports.Ember || {};
// private API used by ember-cli-htmlbars to setup ENV and FEATURES
if (!_Ember.ENV) {
_Ember.ENV = _emberEnvironment.ENV;
}
if (!_Ember.FEATURES) {
_Ember.FEATURES = _canaryFeatures.FEATURES;
}
if (!_Ember.VERSION) {
_Ember.VERSION = _version.default;
}
// used for adding Ember.Handlebars.compile for backwards compat
(0, _compat.default)(_Ember);
// used to bootstrap templates
// add domTemplates initializer (only does something if `ember-template-compiler`
// is loaded already)
});
enifed('ember-template-compiler/lib/compat', ['exports', 'ember-template-compiler/lib/system/compile', 'ember-template-compiler/lib/system/compile-options', 'ember-template-compiler/lib/system/precompile'], function (exports, _compile, _compileOptions, _precompile) {
'use strict';
exports.default = function (Ember) {
var EmberHandlebars = Ember.Handlebars;
if (!EmberHandlebars) {
Ember.Handlebars = EmberHandlebars = {};
}
var EmberHTMLBars = Ember.HTMLBars;
if (!EmberHTMLBars) {
Ember.HTMLBars = EmberHTMLBars = {};
}
EmberHTMLBars.precompile = EmberHandlebars.precompile = _precompile.default;
EmberHTMLBars.compile = EmberHandlebars.compile = _compile.default;
EmberHTMLBars.registerPlugin = _compileOptions.registerPlugin;
};
});
enifed('ember-template-compiler/lib/plugins/assert-if-helper-without-arguments', ['exports', '@ember/debug', 'ember-template-compiler/lib/system/calculate-location-display'], function (exports, _debug, _calculateLocationDisplay) {
'use strict';
exports.default = function (env) {
var moduleName = env.meta.moduleName;
return {
name: 'assert-if-helper-without-arguments',
visitor: {
BlockStatement: function (node) {
if (isInvalidBlockIf(node)) {
true && !false && (0, _debug.assert)(blockAssertMessage(node.path.original) + ' ' + (0, _calculateLocationDisplay.default)(moduleName, node.loc));
}
},
MustacheStatement: function (node) {
if (isInvalidInlineIf(node)) {
true && !false && (0, _debug.assert)(inlineAssertMessage(node.path.original) + ' ' + (0, _calculateLocationDisplay.default)(moduleName, node.loc));
}
},
SubExpression: function (node) {
if (isInvalidInlineIf(node)) {
true && !false && (0, _debug.assert)(inlineAssertMessage(node.path.original) + ' ' + (0, _calculateLocationDisplay.default)(moduleName, node.loc));
}
}
}
};
};
function blockAssertMessage(original) {
return '#' + original + ' requires a single argument.';
}
function inlineAssertMessage(original) {
return 'The inline form of the \'' + original + '\' helper expects two or three arguments.';
}
function isInvalidInlineIf(node) {
return node.path.original === 'if' && (!node.params || node.params.length < 2 || node.params.length > 3);
}
function isInvalidBlockIf(node) {
return node.path.original === 'if' && (!node.params || node.params.length !== 1);
}
});
enifed('ember-template-compiler/lib/plugins/assert-input-helper-without-block', ['exports', '@ember/debug', 'ember-template-compiler/lib/system/calculate-location-display'], function (exports, _debug, _calculateLocationDisplay) {
'use strict';
exports.default = function (env) {
var moduleName = env.meta.moduleName;
return {
name: 'assert-input-helper-without-block',
visitor: {
BlockStatement: function (node) {
if (node.path.original !== 'input') {
return;
}
true && !false && (0, _debug.assert)(assertMessage(moduleName, node));
}
}
};
};
function assertMessage(moduleName, node) {
var sourceInformation = (0, _calculateLocationDisplay.default)(moduleName, node.loc);
return 'The {{input}} helper cannot be used in block form. ' + sourceInformation;
}
});
enifed('ember-template-compiler/lib/plugins/assert-reserved-named-arguments', ['exports', '@ember/debug', 'ember-template-compiler/lib/system/calculate-location-display'], function (exports, _debug, _calculateLocationDisplay) {
'use strict';
exports.default = function (env) {
var moduleName = env.meta.moduleName;
return {
name: 'assert-reserved-named-arguments',
visitor: {
PathExpression: function (_ref) {
var original = _ref.original,
loc = _ref.loc;
if (isReserved(original)) {
true && !false && (0, _debug.assert)(assertMessage(original) + ' ' + (0, _calculateLocationDisplay.default)(moduleName, loc));
}
}
}
};
};
var RESERVED = ['@arguments', '@args', '@block', '@else'];
var isReserved = void 0,
assertMessage = void 0;
isReserved = function (name) {
return RESERVED.indexOf(name) !== -1 || !!name.match(/^@[^a-z]/);
};
assertMessage = function (name) {
return '\'' + name + '\' is reserved.';
};
});
enifed('ember-template-compiler/lib/plugins/assert-splattribute-expression', ['exports', '@ember/debug', 'ember-template-compiler/lib/system/calculate-location-display'], function (exports, _debug, _calculateLocationDisplay) {
'use strict';
exports.default = function (env) {
var moduleName = env.meta.moduleName;
return {
name: 'assert-splattribute-expressions',
visitor: {
AttrNode: function (_ref) {
var name = _ref.name,
loc = _ref.loc;
},
PathExpression: function (_ref2) {
var original = _ref2.original,
loc = _ref2.loc;
if (original === '...attributes') {
true && !false && (0, _debug.assert)(errorMessage() + ' ' + (0, _calculateLocationDisplay.default)(moduleName, loc));
}
}
}
};
};
function errorMessage() {
return 'Using "...attributes" can only be used in the element position e.g. . It cannot be used as a path.';
}
});
enifed('ember-template-compiler/lib/plugins/deprecate-render-model', ['exports', '@ember/debug', '@ember/deprecated-features', 'ember-template-compiler/lib/system/calculate-location-display'], function (exports, _debug, _deprecatedFeatures, _calculateLocationDisplay) {
'use strict';
exports.default =
// Remove after 3.4 once _ENABLE_RENDER_SUPPORT flag is no longer needed.
function (env) {
var moduleName, deprecationMessage;
if (_deprecatedFeatures.RENDER_HELPER) {
moduleName = env.meta.moduleName;
deprecationMessage = function (node, param) {
var sourceInformation = (0, _calculateLocationDisplay.default)(moduleName, node.loc);
var componentName = node.params[0].original;
var modelName = param.original;
return 'Please refactor `' + ('{{render "' + componentName + '" ' + modelName + '}}') + '` to a component and invoke via' + (' `' + ('{{' + componentName + ' model=' + modelName + '}}') + '`. ' + sourceInformation);
};
return {
name: 'deprecate-render-model',
visitor: {
MustacheStatement: function (node) {
if (node.path.original === 'render' && node.params.length > 1) {
node.params.forEach(function (param) {
if (param.type !== 'PathExpression') {
return;
}
true && !false && (0, _debug.deprecate)(deprecationMessage(node, param), false, {
id: 'ember-template-compiler.deprecate-render-model',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x#toc_model-param-in-code-render-code-helper'
});
});
}
}
}
};
}
return undefined;
};
});
enifed('ember-template-compiler/lib/plugins/deprecate-render', ['exports', '@ember/debug', '@ember/deprecated-features', 'ember-template-compiler/lib/system/calculate-location-display'], function (exports, _debug, _deprecatedFeatures, _calculateLocationDisplay) {
'use strict';
exports.default =
// Remove after 3.4 once _ENABLE_RENDER_SUPPORT flag is no longer needed.
function (env) {
var moduleName, deprecationMessage;
if (_deprecatedFeatures.RENDER_HELPER) {
moduleName = env.meta.moduleName;
deprecationMessage = function (node) {
var sourceInformation = (0, _calculateLocationDisplay.default)(moduleName, node.loc);
var componentName = node.params[0].original;
return 'Please refactor `' + ('{{render "' + componentName + '"}}') + '` to a component and invoke via' + (' `' + ('{{' + componentName + '}}') + '`. ' + sourceInformation);
};
return {
name: 'deprecate-render',
visitor: {
MustacheStatement: function (node) {
if (node.path.original !== 'render') {
return;
}
if (node.params.length !== 1) {
return;
}
node.params.forEach(function (param) {
if (param.type !== 'StringLiteral') {
return;
}
true && !false && (0, _debug.deprecate)(deprecationMessage(node), false, {
id: 'ember-template-compiler.deprecate-render',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x#toc_code-render-code-helper'
});
});
}
}
};
}
return undefined;
};
});
enifed('ember-template-compiler/lib/plugins/deprecate-send-action', ['exports', '@ember/debug', '@ember/deprecated-features', 'ember-template-compiler/lib/system/calculate-location-display'], function (exports, _debug, _deprecatedFeatures, _calculateLocationDisplay) {
'use strict';
exports.default = function (env) {
var moduleName, deprecationMessage;
if (_deprecatedFeatures.SEND_ACTION) {
moduleName = env.meta.moduleName;
deprecationMessage = function (node, evName, action) {
var sourceInformation = (0, _calculateLocationDisplay.default)(moduleName, node.loc);
return 'Please refactor `{{input ' + evName + '="' + action + '"}}` to `{{input ' + evName + '=(action "' + action + '")}}. ' + sourceInformation;
};
return {
name: 'deprecate-send-action',
visitor: {
MustacheStatement: function (node) {
if (node.path.original !== 'input') {
return;
}
node.hash.pairs.forEach(function (pair) {
if (EVENTS.indexOf(pair.key) > -1 && pair.value.type === 'StringLiteral') {
true && !false && (0, _debug.deprecate)(deprecationMessage(node, pair.key, pair.value.original), false, {
id: 'ember-component.send-action',
until: '4.0.0',
url: 'https://emberjs.com/deprecations/v3.x#toc_ember-component-send-action'
});
}
});
}
}
};
}
};
var EVENTS = ['insert-newline', 'enter', 'escape-press', 'focus-in', 'focus-out', 'key-press', 'key-up', 'key-down'];
});
enifed('ember-template-compiler/lib/plugins/index', ['exports', 'ember-template-compiler/lib/plugins/assert-if-helper-without-arguments', 'ember-template-compiler/lib/plugins/assert-input-helper-without-block', 'ember-template-compiler/lib/plugins/assert-reserved-named-arguments', 'ember-template-compiler/lib/plugins/assert-splattribute-expression', 'ember-template-compiler/lib/plugins/deprecate-render', 'ember-template-compiler/lib/plugins/deprecate-render-model', 'ember-template-compiler/lib/plugins/deprecate-send-action', 'ember-template-compiler/lib/plugins/transform-action-syntax', 'ember-template-compiler/lib/plugins/transform-angle-bracket-components', 'ember-template-compiler/lib/plugins/transform-attrs-into-args', 'ember-template-compiler/lib/plugins/transform-dot-component-invocation', 'ember-template-compiler/lib/plugins/transform-each-in-into-each', 'ember-template-compiler/lib/plugins/transform-has-block-syntax', 'ember-template-compiler/lib/plugins/transform-in-element', 'ember-template-compiler/lib/plugins/transform-inline-link-to', 'ember-template-compiler/lib/plugins/transform-input-type-syntax', 'ember-template-compiler/lib/plugins/transform-old-binding-syntax', 'ember-template-compiler/lib/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings', 'ember-template-compiler/lib/plugins/transform-top-level-components', '@ember/deprecated-features'], function (exports, _assertIfHelperWithoutArguments, _assertInputHelperWithoutBlock, _assertReservedNamedArguments, _assertSplattributeExpression, _deprecateRender, _deprecateRenderModel, _deprecateSendAction, _transformActionSyntax, _transformAngleBracketComponents, _transformAttrsIntoArgs, _transformDotComponentInvocation, _transformEachInIntoEach, _transformHasBlockSyntax, _transformInElement, _transformInlineLinkTo, _transformInputTypeSyntax, _transformOldBindingSyntax, _transformOldClassBindingSyntax, _transformQuotedBindingsIntoJustBindings, _transformTopLevelComponents, _deprecatedFeatures) {
'use strict';
var transforms = [_transformDotComponentInvocation.default, _transformAngleBracketComponents.default, _transformTopLevelComponents.default, _transformInlineLinkTo.default, _transformOldClassBindingSyntax.default, _transformQuotedBindingsIntoJustBindings.default, _assertReservedNamedArguments.default, _transformActionSyntax.default, _transformInputTypeSyntax.default, _transformAttrsIntoArgs.default, _transformEachInIntoEach.default, _transformHasBlockSyntax.default, _assertInputHelperWithoutBlock.default, _transformInElement.default, _assertIfHelperWithoutArguments.default, _assertSplattributeExpression.default];
if (_deprecatedFeatures.RENDER_HELPER) {
transforms.push(_deprecateRenderModel.default);
transforms.push(_deprecateRender.default);
}
if (_deprecatedFeatures.BINDING_SUPPORT) {
transforms.push(_transformOldBindingSyntax.default);
}
if (_deprecatedFeatures.SEND_ACTION) {
transforms.push(_deprecateSendAction.default);
}
exports.default = Object.freeze(transforms);
});
enifed('ember-template-compiler/lib/plugins/transform-action-syntax', ['exports'], function (exports) {
'use strict';
exports.default =
/**
@module ember
*/
/**
A Glimmer2 AST transformation that replaces all instances of
```handlebars