2017-07-05 14:14:30 -04:00
|
|
|
var define, requirejs;
|
2014-04-29 20:59:57 -04:00
|
|
|
|
|
|
|
(function() {
|
2019-10-22 09:47:27 -04:00
|
|
|
// In future versions of ember we don't need this
|
|
|
|
var EMBER_MODULES = {};
|
2019-11-07 16:38:28 -05:00
|
|
|
var ALIASES = {
|
|
|
|
"ember-addons/ember-computed-decorators":
|
|
|
|
"discourse-common/utils/decorators"
|
|
|
|
};
|
2019-10-22 09:47:27 -04:00
|
|
|
if (typeof Ember !== "undefined") {
|
|
|
|
EMBER_MODULES = {
|
2019-10-23 13:25:25 -04:00
|
|
|
jquery: { default: $ },
|
2019-10-22 09:47:27 -04:00
|
|
|
"@ember/component": { default: Ember.Component },
|
2019-10-29 13:13:31 -04:00
|
|
|
"@ember/controller": {
|
|
|
|
default: Ember.Controller,
|
|
|
|
inject: Ember.inject.controller
|
|
|
|
},
|
2019-10-31 16:28:10 -04:00
|
|
|
"@ember/object": {
|
|
|
|
default: Ember.Object,
|
2019-11-04 10:56:16 -05:00
|
|
|
get: Ember.get,
|
2019-11-05 13:43:49 -05:00
|
|
|
getProperties: Ember.getProperties,
|
|
|
|
set: Ember.set,
|
2019-11-13 11:57:42 -05:00
|
|
|
setProperties: Ember.setProperties,
|
2019-11-20 04:21:33 -05:00
|
|
|
computed: Ember.computed,
|
|
|
|
defineProperty: Ember.defineProperty
|
2019-10-31 16:28:10 -04:00
|
|
|
},
|
2019-10-30 16:28:29 -04:00
|
|
|
"@ember/object/computed": {
|
|
|
|
alias: Ember.computed.alias,
|
|
|
|
and: Ember.computed.and,
|
|
|
|
bool: Ember.computed.bool,
|
|
|
|
collect: Ember.computed.collect,
|
|
|
|
deprecatingAlias: Ember.computed.deprecatingAlias,
|
|
|
|
empty: Ember.computed.empty,
|
|
|
|
equal: Ember.computed.equal,
|
|
|
|
filter: Ember.computed.filter,
|
|
|
|
filterBy: Ember.computed.filterBy,
|
|
|
|
gt: Ember.computed.gt,
|
|
|
|
gte: Ember.computed.gte,
|
|
|
|
intersect: Ember.computed.intersect,
|
|
|
|
lt: Ember.computed.lt,
|
|
|
|
lte: Ember.computed.lte,
|
|
|
|
map: Ember.computed.map,
|
|
|
|
mapBy: Ember.computed.mapBy,
|
|
|
|
match: Ember.computed.match,
|
|
|
|
max: Ember.computed.max,
|
|
|
|
min: Ember.computed.min,
|
|
|
|
none: Ember.computed.none,
|
|
|
|
not: Ember.computed.not,
|
|
|
|
notEmpty: Ember.computed.notEmpty,
|
|
|
|
oneWay: Ember.computed.oneWay,
|
|
|
|
or: Ember.computed.or,
|
|
|
|
readOnly: Ember.computed.readOnly,
|
|
|
|
reads: Ember.computed.reads,
|
|
|
|
setDiff: Ember.computed.setDiff,
|
|
|
|
sort: Ember.computed.sort,
|
|
|
|
sum: Ember.computed.sum,
|
|
|
|
union: Ember.computed.union,
|
|
|
|
uniq: Ember.computed.uniq,
|
|
|
|
uniqBy: Ember.computed.uniqBy
|
|
|
|
},
|
2019-10-30 15:03:08 -04:00
|
|
|
"@ember/object/mixin": { default: Ember.Mixin },
|
2019-10-29 15:23:50 -04:00
|
|
|
"@ember/object/proxy": { default: Ember.ObjectProxy },
|
2019-10-30 18:05:27 -04:00
|
|
|
"@ember/object/evented": { on: Ember.on },
|
2019-10-29 13:29:08 -04:00
|
|
|
"@ember/routing/route": { default: Ember.Route },
|
2019-10-30 09:48:24 -04:00
|
|
|
"@ember/runloop": {
|
|
|
|
bind: Ember.run.bind,
|
|
|
|
cancel: Ember.run.cancel,
|
|
|
|
debounce: Ember.testing ? Ember.run : Ember.run.debounce,
|
|
|
|
later: Ember.run.later,
|
|
|
|
next: Ember.run.next,
|
|
|
|
once: Ember.run.once,
|
|
|
|
run: Ember.run,
|
|
|
|
schedule: Ember.run.schedule,
|
|
|
|
scheduleOnce: Ember.run.scheduleOnce,
|
|
|
|
throttle: Ember.run.throttle
|
|
|
|
},
|
2019-10-29 13:29:08 -04:00
|
|
|
"@ember/service": {
|
|
|
|
default: Ember.Service,
|
|
|
|
inject: Ember.inject.service
|
2019-10-31 13:37:24 -04:00
|
|
|
},
|
|
|
|
"@ember/utils": {
|
2019-11-08 14:03:22 -05:00
|
|
|
isEmpty: Ember.isEmpty,
|
|
|
|
isNone: Ember.isNone
|
2019-11-05 11:37:32 -05:00
|
|
|
},
|
2019-11-07 16:38:28 -05:00
|
|
|
rsvp: {
|
2019-11-08 13:28:11 -05:00
|
|
|
default: Ember.RSVP,
|
2019-11-20 15:51:42 -05:00
|
|
|
EventTarget: Ember.RSVP.EventTarget,
|
2019-11-05 11:37:32 -05:00
|
|
|
Promise: Ember.RSVP.Promise,
|
|
|
|
hash: Ember.RSVP.hash,
|
|
|
|
all: Ember.RSVP.all
|
2019-11-05 13:43:49 -05:00
|
|
|
},
|
|
|
|
"@ember/string": {
|
|
|
|
dasherize: Ember.String.dasherize,
|
|
|
|
classify: Ember.String.classify,
|
|
|
|
underscore: Ember.String.underscore,
|
|
|
|
camelize: Ember.String.camelize
|
|
|
|
},
|
|
|
|
"@ember/template": {
|
|
|
|
htmlSafe: Ember.String.htmlSafe
|
|
|
|
},
|
|
|
|
"@ember/application": {
|
|
|
|
setOwner: Ember.setOwner,
|
|
|
|
getOwner: Ember.getOwner
|
|
|
|
},
|
|
|
|
"@ember/component/helper": {
|
|
|
|
default: Ember.Helper
|
2019-11-07 12:20:35 -05:00
|
|
|
},
|
|
|
|
"@ember/error": {
|
|
|
|
default: Ember.error
|
2019-10-29 13:29:08 -04:00
|
|
|
}
|
2019-10-22 09:47:27 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-05-11 13:16:44 -04:00
|
|
|
var _isArray;
|
|
|
|
if (!Array.isArray) {
|
2019-10-21 11:56:15 -04:00
|
|
|
_isArray = function(x) {
|
2015-05-11 13:16:44 -04:00
|
|
|
return Object.prototype.toString.call(x) === "[object Array]";
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
_isArray = Array.isArray;
|
|
|
|
}
|
|
|
|
|
|
|
|
var registry = {};
|
|
|
|
var seen = {};
|
2014-04-29 20:59:57 -04:00
|
|
|
var FAILED = false;
|
|
|
|
|
2015-05-11 13:16:44 -04:00
|
|
|
var uuid = 0;
|
|
|
|
|
|
|
|
function tryFinally(tryable, finalizer) {
|
|
|
|
try {
|
|
|
|
return tryable();
|
|
|
|
} finally {
|
|
|
|
finalizer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function unsupportedModule(length) {
|
2019-10-21 11:56:15 -04:00
|
|
|
throw new Error(
|
|
|
|
"an unsupported module was defined, expected `define(name, deps, module)` instead got: `" +
|
|
|
|
length +
|
|
|
|
"` arguments to define`"
|
|
|
|
);
|
2015-05-11 13:16:44 -04:00
|
|
|
}
|
|
|
|
|
2019-11-12 11:20:14 -05:00
|
|
|
function deprecatedModule(depricated, useInstead) {
|
2019-11-12 12:58:16 -05:00
|
|
|
var warning = "[DEPRECATION] `" + depricated + "` is deprecated.";
|
2019-11-12 11:20:14 -05:00
|
|
|
if (useInstead) {
|
|
|
|
warning += " Please use `" + useInstead + "` instead.";
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.warn(warning);
|
|
|
|
}
|
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
var defaultDeps = ["require", "exports", "module"];
|
2015-05-11 13:16:44 -04:00
|
|
|
|
|
|
|
function Module(name, deps, callback, exports) {
|
2019-10-21 11:56:15 -04:00
|
|
|
this.id = uuid++;
|
|
|
|
this.name = name;
|
|
|
|
this.deps = !deps.length && callback.length ? defaultDeps : deps;
|
|
|
|
this.exports = exports || {};
|
2015-05-11 13:16:44 -04:00
|
|
|
this.callback = callback;
|
2019-10-21 11:56:15 -04:00
|
|
|
this.state = undefined;
|
|
|
|
this._require = undefined;
|
2015-05-11 13:16:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Module.prototype.makeRequire = function() {
|
2019-11-08 10:48:02 -05:00
|
|
|
var name = transformForAliases(this.name);
|
2015-05-11 13:16:44 -04:00
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
return (
|
|
|
|
this._require ||
|
|
|
|
(this._require = function(dep) {
|
|
|
|
return requirejs(resolve(dep, name));
|
|
|
|
})
|
|
|
|
);
|
2016-11-15 11:41:16 -05:00
|
|
|
};
|
2015-05-11 13:16:44 -04:00
|
|
|
|
2014-04-29 20:59:57 -04:00
|
|
|
define = function(name, deps, callback) {
|
2015-05-11 13:16:44 -04:00
|
|
|
if (arguments.length < 2) {
|
|
|
|
unsupportedModule(arguments.length);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_isArray(deps)) {
|
|
|
|
callback = deps;
|
2019-10-21 11:56:15 -04:00
|
|
|
deps = [];
|
2015-05-11 13:16:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
registry[name] = new Module(name, deps, callback);
|
|
|
|
};
|
|
|
|
|
|
|
|
// we don't support all of AMD
|
|
|
|
// define.amd = {};
|
|
|
|
// we will support petals...
|
2019-10-21 11:56:15 -04:00
|
|
|
define.petal = {};
|
2015-05-11 13:16:44 -04:00
|
|
|
|
|
|
|
function Alias(path) {
|
|
|
|
this.name = path;
|
|
|
|
}
|
|
|
|
|
|
|
|
define.alias = function(path) {
|
|
|
|
return new Alias(path);
|
2014-04-29 20:59:57 -04:00
|
|
|
};
|
|
|
|
|
2016-11-15 11:41:16 -05:00
|
|
|
function reify(mod, name, rseen) {
|
2015-05-11 13:16:44 -04:00
|
|
|
var deps = mod.deps;
|
2014-04-29 20:59:57 -04:00
|
|
|
var length = deps.length;
|
|
|
|
var reified = new Array(length);
|
|
|
|
var dep;
|
2015-05-11 13:16:44 -04:00
|
|
|
// TODO: new Module
|
|
|
|
// TODO: seen refactor
|
2019-10-21 11:56:15 -04:00
|
|
|
var module = {};
|
2014-04-29 20:59:57 -04:00
|
|
|
|
|
|
|
for (var i = 0, l = length; i < l; i++) {
|
|
|
|
dep = deps[i];
|
2019-10-21 11:56:15 -04:00
|
|
|
if (dep === "exports") {
|
2016-11-15 11:41:16 -05:00
|
|
|
module.exports = reified[i] = rseen;
|
2019-10-21 11:56:15 -04:00
|
|
|
} else if (dep === "require") {
|
2015-05-11 13:16:44 -04:00
|
|
|
reified[i] = mod.makeRequire();
|
2019-10-21 11:56:15 -04:00
|
|
|
} else if (dep === "module") {
|
2016-11-15 11:41:16 -05:00
|
|
|
mod.exports = rseen;
|
2015-05-11 13:16:44 -04:00
|
|
|
module = reified[i] = mod;
|
2014-04-29 20:59:57 -04:00
|
|
|
} else {
|
2015-05-11 13:16:44 -04:00
|
|
|
reified[i] = requireFrom(resolve(dep, name), name);
|
2014-04-29 20:59:57 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
deps: reified,
|
2015-05-11 13:16:44 -04:00
|
|
|
module: module
|
2014-04-29 20:59:57 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-05-11 13:16:44 -04:00
|
|
|
function requireFrom(name, origin) {
|
2019-11-08 10:48:02 -05:00
|
|
|
name = transformForAliases(name);
|
2019-11-11 15:48:33 -05:00
|
|
|
|
|
|
|
if (name === "discourse/models/input-validation") {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.log(
|
|
|
|
"input-validation has been removed and should be replaced with `@ember/object`"
|
|
|
|
);
|
2019-11-11 15:56:58 -05:00
|
|
|
name = "@ember/object";
|
2019-11-11 15:48:33 -05:00
|
|
|
}
|
|
|
|
|
2019-10-22 09:47:27 -04:00
|
|
|
var mod = EMBER_MODULES[name] || registry[name];
|
2015-05-11 13:16:44 -04:00
|
|
|
if (!mod) {
|
2019-10-21 11:56:15 -04:00
|
|
|
throw new Error(
|
|
|
|
"Could not find module `" + name + "` imported from `" + origin + "`"
|
|
|
|
);
|
2015-05-11 13:16:44 -04:00
|
|
|
}
|
2017-07-05 14:14:30 -04:00
|
|
|
return requirejs(name);
|
2015-05-11 13:16:44 -04:00
|
|
|
}
|
2014-12-30 20:29:18 -05:00
|
|
|
|
2015-05-11 13:16:44 -04:00
|
|
|
function missingModule(name) {
|
2019-10-21 11:56:15 -04:00
|
|
|
throw new Error("Could not find module " + name);
|
2015-05-11 13:16:44 -04:00
|
|
|
}
|
2016-11-15 11:41:16 -05:00
|
|
|
|
2019-11-08 10:48:02 -05:00
|
|
|
function transformForAliases(name) {
|
2019-11-12 12:58:16 -05:00
|
|
|
var alias = ALIASES[name];
|
2019-11-12 11:20:14 -05:00
|
|
|
if (!alias) return name;
|
|
|
|
|
|
|
|
deprecatedModule(name, alias);
|
|
|
|
return alias;
|
2019-11-07 16:38:28 -05:00
|
|
|
}
|
|
|
|
|
2016-11-15 12:10:18 -05:00
|
|
|
requirejs = require = function(name) {
|
2019-10-22 09:47:27 -04:00
|
|
|
if (EMBER_MODULES[name]) {
|
|
|
|
return EMBER_MODULES[name];
|
|
|
|
}
|
|
|
|
|
2016-11-21 16:18:41 -05:00
|
|
|
var mod = registry[name];
|
2015-05-11 13:16:44 -04:00
|
|
|
|
|
|
|
if (mod && mod.callback instanceof Alias) {
|
|
|
|
mod = registry[mod.callback.name];
|
2014-04-29 20:59:57 -04:00
|
|
|
}
|
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
if (!mod) {
|
|
|
|
missingModule(name);
|
|
|
|
}
|
2015-05-11 13:16:44 -04:00
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
if (mod.state !== FAILED && seen.hasOwnProperty(name)) {
|
2015-05-11 13:16:44 -04:00
|
|
|
return seen[name];
|
2014-04-29 20:59:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
var reified;
|
|
|
|
var module;
|
|
|
|
var loaded = false;
|
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
seen[name] = {}; // placeholder for run-time cycles
|
|
|
|
|
|
|
|
tryFinally(
|
|
|
|
function() {
|
|
|
|
reified = reify(mod, name, seen[name]);
|
|
|
|
module = mod.callback.apply(this, reified.deps);
|
|
|
|
loaded = true;
|
|
|
|
},
|
|
|
|
function() {
|
|
|
|
if (!loaded) {
|
|
|
|
mod.state = FAILED;
|
|
|
|
}
|
2014-04-29 20:59:57 -04:00
|
|
|
}
|
2019-10-21 11:56:15 -04:00
|
|
|
);
|
2015-05-11 13:16:44 -04:00
|
|
|
|
|
|
|
var obj;
|
|
|
|
if (module === undefined && reified.module.exports) {
|
|
|
|
obj = reified.module.exports;
|
|
|
|
} else {
|
|
|
|
obj = seen[name] = module;
|
|
|
|
}
|
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
if (
|
|
|
|
obj !== null &&
|
|
|
|
(typeof obj === "object" || typeof obj === "function") &&
|
|
|
|
obj["default"] === undefined
|
|
|
|
) {
|
|
|
|
obj["default"] = obj;
|
2014-04-29 20:59:57 -04:00
|
|
|
}
|
|
|
|
|
2015-05-11 13:16:44 -04:00
|
|
|
return (seen[name] = obj);
|
2014-04-29 20:59:57 -04:00
|
|
|
};
|
2016-11-15 12:10:18 -05:00
|
|
|
window.requireModule = requirejs;
|
2014-04-29 20:59:57 -04:00
|
|
|
|
|
|
|
function resolve(child, name) {
|
2019-10-21 11:56:15 -04:00
|
|
|
if (child.charAt(0) !== ".") {
|
|
|
|
return child;
|
|
|
|
}
|
2014-04-29 20:59:57 -04:00
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
var parts = child.split("/");
|
|
|
|
var nameParts = name.split("/");
|
2015-05-11 13:16:44 -04:00
|
|
|
var parentBase = nameParts.slice(0, -1);
|
2014-04-29 20:59:57 -04:00
|
|
|
|
|
|
|
for (var i = 0, l = parts.length; i < l; i++) {
|
|
|
|
var part = parts[i];
|
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
if (part === "..") {
|
2015-05-11 13:16:44 -04:00
|
|
|
if (parentBase.length === 0) {
|
2019-10-21 11:56:15 -04:00
|
|
|
throw new Error("Cannot access parent module of root");
|
2015-05-11 13:16:44 -04:00
|
|
|
}
|
|
|
|
parentBase.pop();
|
2019-10-21 11:56:15 -04:00
|
|
|
} else if (part === ".") {
|
2015-05-11 13:16:44 -04:00
|
|
|
continue;
|
2019-10-21 11:56:15 -04:00
|
|
|
} else {
|
|
|
|
parentBase.push(part);
|
|
|
|
}
|
2014-04-29 20:59:57 -04:00
|
|
|
}
|
|
|
|
|
2019-10-21 11:56:15 -04:00
|
|
|
return parentBase.join("/");
|
2014-04-29 20:59:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
requirejs.entries = requirejs._eak_seen = registry;
|
2015-05-11 13:16:44 -04:00
|
|
|
requirejs.clear = function() {
|
2014-04-29 20:59:57 -04:00
|
|
|
requirejs.entries = requirejs._eak_seen = registry = {};
|
2016-11-15 11:41:16 -05:00
|
|
|
seen = {};
|
2014-04-29 20:59:57 -04:00
|
|
|
};
|
|
|
|
})();
|