summaryrefslogtreecommitdiff
path: root/html/content/lib/require/Require.js
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:16:23 +0200
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:16:23 +0200
commit7076343338ae3439f3c86f01144818abe8c31978 (patch)
tree794abb1e6b8f821091fd095341885496b6dad51d /html/content/lib/require/Require.js
parent47cbb529f5723b246125ae083a193e11481b89ef (diff)
downloadclassroom-7076343338ae3439f3c86f01144818abe8c31978.tar.gz
classroom-7076343338ae3439f3c86f01144818abe8c31978.tar.bz2
classroom-7076343338ae3439f3c86f01144818abe8c31978.zip
add container helpers; constuct public directory-tree
Diffstat (limited to 'html/content/lib/require/Require.js')
-rw-r--r--html/content/lib/require/Require.js848
1 files changed, 848 insertions, 0 deletions
diff --git a/html/content/lib/require/Require.js b/html/content/lib/require/Require.js
new file mode 100644
index 0000000..df3f536
--- /dev/null
+++ b/html/content/lib/require/Require.js
@@ -0,0 +1,848 @@
+(function (requireFiles) {
+ var require, _helpers;
+ if (typeof (window.require) != 'undefined') {
+ return;
+ }
+
+ function isArraylike(obj) {
+ return Array.isArray(obj);
+ }
+ _helpers = {
+ isFunction: function (obj) {
+ return typeof (obj) == 'function';
+ },
+ isArray: isArraylike,
+ grep: function (elems, callback, inv) {
+ var retVal,
+ ret = [],
+ i = 0,
+ length = elems.length;
+ inv = !!inv;
+
+ for (; i < length; i++) {
+ retVal = !!callback(elems[i], i);
+ if (inv !== retVal) {
+ ret.push(elems[i]);
+ }
+ }
+
+ return ret;
+ },
+ map: function (elems, callback, arg) {
+ var value,
+ i = 0,
+ length = elems.length,
+ isArray = isArraylike(elems),
+ ret = [];
+
+ // Go through the array, translating each of the items to their
+ if (isArray) {
+ for (; i < length; i++) {
+ value = callback(elems[i], i, arg);
+
+ if (value != null) {
+ ret[ret.length] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for (i in elems) {
+ value = callback(elems[i], i, arg);
+
+ if (value != null) {
+ ret[ret.length] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return [].concat(ret);
+ }
+ };
+
+ function configuration(versions, speculativeDependencies, modules) {
+ this.modules = modules || {};
+ this.modulePaths = {};
+ this.bundles = [];
+ this.bundlesByName = {};
+
+ for (var i = 0; i < versions.length; i++) {
+ var v = versions[i];
+ for (var k in v) {
+ var moduleName = k;
+ var url = v[k];
+ if (typeof (url) == 'object') {
+ this.modulePaths[moduleName] = url.Url;
+ var bundle = {
+ name: moduleName,
+ url: url.Url,
+ modules: url.Contents,
+ usages: []
+ };
+
+ this.bundles.push(bundle);
+ this.bundlesByName[bundle.name] = bundle;
+ continue;
+ }
+ this.modulePaths[moduleName] = url;
+
+ }
+ }
+
+ this.getSpeculativeDependencies = function (moduleNames) {
+ var result = [];
+ if (!isArraylike(moduleNames)) {
+ result.push(moduleNames);
+ for (var i = 0; i < speculativeDependencies.length; i++) {
+ var deps = speculativeDependencies[i][moduleNames];
+ if (deps) {
+ for (var j = 0; j < deps.length; j++) {
+ if (result.indexOf(deps[j]) == -1)
+ result.push(deps[j]);
+ }
+ }
+ }
+ }
+ else {
+ for (var i = 0; i < moduleNames.length; i++) {
+ var deps = this.getSpeculativeDependencies(moduleNames[i]);
+ for (var j = 0; j < deps.length; j++) {
+ if (result.indexOf(deps[j]) === -1)
+ result.push(deps[j]);
+ }
+ }
+ }
+ return result;
+ }
+
+
+ this.updateState = function (state, moduleDependencies, callback) {
+ var config = this;
+ state.moduleDependencies = moduleDependencies;
+ state.dependencies = _helpers.map(_helpers.grep(
+ moduleDependencies,
+ function (x) {
+ return x && x.indexOf('exports') == -1 && x.indexOf('require') == -1;
+ }
+ ), function (x) {
+ return config.getOrCreateState(x);
+ });
+ state.loaded = true;
+ state.readyCallback = function () {
+ state.ready = true;
+ if (callback) {
+ state.object = invokeCallback(callback, state.moduleDependencies, state.name);
+ document.dispatchEvent(new CustomEvent("require.moduleLoaded", { detail: state }));
+ }
+
+ };
+ if (state.readyCheck) {
+ state.readyCheck();
+ }
+
+
+ if (state.dependencies.length) {
+ for (var i = 0; i < state.dependencies.length; i++) {
+ state.dependencies[i].callbacks.push(function () {
+ if (state.readyCheck) {
+ state.readyCheck();
+ }
+ });
+ }
+ var dependendentModuleNames = _helpers.map(state.dependencies, function (x) { return x.name });
+
+ require(
+ dependendentModuleNames,
+ function () {
+ if (state.readyCheck) {
+ state.readyCheck();
+ }
+ }
+ );
+ }
+ }
+
+ this.getOrCreateState = function (moduleName) {
+ var state = window.define.amd.getProp(moduleName);
+ if (!state) {
+ window.define.amd[moduleName] = state = this.createState(moduleName);
+ }
+
+ return state;
+ }
+ this.createState = function (moduleName) {
+ var bundle = this.bundlesByName[moduleName];
+ return {
+ isBundle: typeof (bundle) !== 'undefined',
+ url: this.modulePaths.getProp(this.modules[moduleName] || moduleName),
+ name: moduleName,
+ loaded: false,
+ callbacks: [],
+ ready: false,
+ dependencies: [],
+ doCallBacks: function () {
+ for (var i = 0; i < this.callbacks.length; i++) {
+ this.callbacks[i].apply(this, []);
+ }
+ this.callbacks = [];
+ },
+ removeReadyDependencies: function () {
+ this.dependencies = _helpers.grep(this.dependencies, function (x) { return !x.ready; });
+ },
+ readyCheck: function () {
+ this.removeReadyDependencies();
+ if (!this.dependencies.length && this.loaded) {
+ if (!this.ready) {
+ if (this.readyCallback) {
+ var rc = this.readyCallback;
+ rc.apply(this, []);
+ }
+ else {
+ this.ready = true;
+ }
+ this.doCallBacks();
+ }
+ }
+ },
+ hasUrl: function () {
+ if (!this.url) {
+ if (debug)
+ console.warn('could not resolve ' + moduleName + ' into a url');
+ return false;
+ }
+ return true;
+ },
+ callPending: function () {
+ this.pending = true;
+ if (bundle) {
+ for (var i = 0; i < bundle.modules.length; i++) {
+ var state = config.getOrCreateState(bundle.modules[i]);
+ state.callPending();
+ }
+ }
+ },
+ callDone: function () {
+ if (this.isBundle) {
+
+ if (!this.loaded) {
+ define(this.name, [], function () { });
+ if (!this.loaded) {
+ console.warn('should be loaded');
+ }
+ for (var i = 0; i < bundle.modules.length; i++) {
+ var state = config.getOrCreateState(bundle.modules[i]);
+ state.callDone();
+ }
+ }
+ return;
+ }
+ if (!this.loaded) {
+ completeDefine(this.name);
+ if (!this.loaded) {
+ console.warn('should be loaded');
+ }
+ }
+ }
+ };
+ }
+ this.bundle = function (moduleNames, noLoadedBias, ignoredBundles) {
+ var self = this;
+
+ var scoredBundles = _helpers.map(_helpers.grep(this.bundles, function (x) { return typeof (ignoredBundles) === 'undefined' || ignoredBundles.indexOf(x.name) == -1; }), function (bundle) {
+ return {
+ bundle: bundle,
+ state: self.getOrCreateState(bundle.name),
+ hits: _helpers.grep(bundle.modules, function (f) {
+ return moduleNames.indexOf(f) >= 0;
+ }),
+ waste: _helpers.grep(bundle.modules, function (f) {
+ return moduleNames.indexOf(f) === -1;
+ }),
+ wasteAmount: function () {
+ if (noLoadedBias) {
+ return this.waste.length;
+ }
+ if (this.state.pending) {
+ return 0;
+ }
+ return this.waste.length;
+ },
+ score: function () {
+ return this.hits.length - this.wasteAmount();
+ }
+ }
+ });
+ scoredBundles.sort(function (a, b) {
+ return (b.score()) - (a.score());
+ });
+ var matchingBundles = _helpers.grep(scoredBundles, function (x) {
+ if (noLoadedBias) {
+ return x.hits.length > 1;
+ }
+ if (x.state.pending) {
+ return x.hits.length > 0;
+ }
+ return x.hits.length > 1;
+ });
+ if (!matchingBundles.length) {
+ if (debug)
+ console.log('no bundles available', moduleNames, scoredBundles);
+ return moduleNames;
+ }
+
+
+ var moduleStack = moduleNames.slice();
+ var bundleStack = matchingBundles.slice();
+ var candidates = matchingBundles.slice();
+ var rewrittenModuleNames = [];
+ var usedBundles = [];
+
+ var iteration = 0;
+ while (moduleStack.length > 0 && bundleStack.length > 0) {
+ iteration++;
+ var bundle = bundleStack.shift();
+ var considerationState = {
+ hits: bundle.hits.length,
+ pending: bundle.state.pending,
+ noLoadedBias: noLoadedBias,
+ hitModules: bundle.hits.slice()
+ }
+ if (considerationState.pending && !considerationState.noLoadedBias) {
+ if (considerationState.hits === 0) {
+ if (debug)
+ console.log('skipping bundle', bundle, bundle.hits, moduleStack, moduleNames);
+ considerationState.rejected = true;
+ continue;
+ }
+ }
+ else {
+ if (considerationState.hits <= 1) {
+ if (debug)
+ console.log('skipping bundle because it is not pending and only has one hit', bundle, bundle.hits);
+ considerationState.rejected = true;
+ continue;
+ }
+ }
+
+ bundle.bundle.usages.push({
+ considerationState: considerationState,
+ moduleStack: moduleStack.slice(),
+ hits: bundle.hits.slice(),
+ hitCount: bundle.hits.length,
+ waste: bundle.waste.slice(),
+ wasteAmount: bundle.wasteAmount(),
+ wasPending: bundle.state.pending,
+ score: bundle.score(),
+ candidates: _helpers.map(candidates, function (bundle) { return { hits: bundle.hits.slice(), waste: bundle.waste, wasteAmount: bundle.wasteAmount(), wasPending: bundle.state.pending, score: bundle.score() }; }), remainingCandidates: _helpers.map(bundleStack, function (bundle) { return { hits: bundle.hits.slice(), waste: bundle.waste, wasteAmount: bundle.wasteAmount(), wasPending: bundle.state.pending, score: bundle.score() }; })
+ });
+
+ for (var i = 0; i < bundle.hits.length; i++) {
+ var moduleName = bundle.hits[i];
+
+ var index = moduleStack.indexOf(moduleName);
+ moduleStack.splice(index, 1);
+ }
+ rewrittenModuleNames.push(bundle.bundle.name);
+ usedBundles.push(bundle);
+
+ for (var i = 0; i < bundleStack.length; i++) {
+ (function (bundle) {
+ bundle.hits = _helpers.grep(bundle.hits, function (f) {
+ return (moduleStack.indexOf(f) >= 0);
+ });
+ bundle.waste = _helpers.grep(bundle.bundle.modules, function (f) {
+ return bundle.hits.indexOf(f) == -1;
+ });
+ })(bundleStack[i]);
+ }
+ bundleStack.sort(function (a, b) {
+ return (b.score()) - (a.score());
+ });
+ }
+ for (var i = 0; i < moduleStack.length; i++) {
+ rewrittenModuleNames.push(moduleStack[i]);
+ }
+
+ if (!usedBundles.length) {
+ if (debug)
+ console.log('no bundles found', moduleNames, matchingBundles, moduleStack, bundleStack);
+ return moduleNames;
+ }
+ return rewrittenModuleNames;
+ }
+
+ }
+ var debug = false;
+ var config = new configuration(
+ requireFiles || [],
+ []
+ );
+
+ Object.defineProperty(Object.prototype, "getProp", {
+ value: function (prop) {
+ if (!prop || (typeof (prop) !== typeof ('') && !(prop instanceof String))) {
+ console.warn('invalid property access', prop, this);
+ return null;
+ }
+ var key, self = this;
+ for (key in self) {
+ if (key.toLowerCase() === prop.toLowerCase()) {
+ return self[key];
+ }
+ }
+ },
+ //this keeps jquery happy
+ enumerable: false
+ });
+
+
+
+ function invokeCallback(callback, moduleNames, exportsName) {
+ var callbackArguments = [];
+ var resultFactory = function (r) { return r; }
+ for (var i = 0; i < moduleNames.length; i++) {
+ switch (moduleNames[i]) {
+ case 'exports':
+ if (!window.exports) {
+ window.exports = {};
+ }
+ var e = window.exports[exportsName];
+ if (!e) {
+ e = window.exports[exportsName] = {};
+ }
+ resultFactory = function () { return e; };
+ callbackArguments.push(e);
+ break;
+ case 'require':
+ callbackArguments.push(require);
+ break;
+ default:
+ var state = config.getOrCreateState(moduleNames[i]);
+ callbackArguments.push(state.object);
+ }
+
+
+
+ }
+ var result = callback.apply(window, callbackArguments);
+ return resultFactory(result);
+ }
+
+ function taskCompletionChecker(callback, moduleNames) {
+ this.pendingStates = getPendingStates(moduleNames);
+ moduleNames = config.bundle(moduleNames);
+ var self = this;
+
+ this.pendingModules = getPendingStates(moduleNames);
+
+ function getPendingStates(moduleNames) {
+ var pendingStates = [];
+ for (var i = 0; i < moduleNames.length; i++) {
+ var script = moduleNames[i];
+ var state = config.getOrCreateState(script);
+ if (!state.ready) {
+ state.callbacks.push(function () {
+ self.check();
+ });
+ pendingStates.push(state);
+ }
+ }
+ return pendingStates;
+ }
+
+ this.check = function () {
+ if (this.finished) {
+ return true;
+ }
+
+ this.pendingStates = _helpers.grep(this.pendingStates, function (x) { return !x.ready; });
+
+ if (!this.pendingStates.length) {
+ this.done();
+ return true;
+ } else {
+ notDone();
+ return false;
+ }
+ };
+ this.done = function () {
+ this.finished = true;
+ var s = _helpers.map(moduleNames, function (x) { return config.getOrCreateState(x); });
+ for (var i = 0; i < s.length; i++) {
+ var state = s[i];
+ if (state.readyCheck) {
+ state.readyCheck();
+ }
+ }
+ callback();
+ if (debug)
+ console.log('done', moduleNames);
+ }
+ function notDone() {
+ if (debug)
+ console.log('not done', _helpers.grep(self.pendingStates, function (x) { return !x.ready; }));
+ }
+
+ }
+
+
+ function getScriptCached (url, callback) {
+ var d = document, t = 'script',
+ o = d.createElement(t),
+ s = d.getElementsByTagName(t)[0];
+ o.src = url;
+ o.defer = true;
+ if (callback) {
+
+ o.addEventListener('load', function (e) {
+ if (debug)
+ console.log('loaded script', url, e);
+ callback(null, e);
+ }, false);
+ } else {
+ console.warn('loading script without callback', url);
+ }
+
+ s.parentNode.insertBefore(o, s);
+ }
+
+ window.require = require = function require (moduleNames, callback, log) {
+ if (typeof (moduleNames) === typeof ('') || moduleNames instanceof String) {
+ moduleNames = [moduleNames];
+ }
+ callback = (function (callback, moduleNames) {
+ return function () {
+ invokeCallback(callback, moduleNames);
+ }
+ })(callback, moduleNames);
+ moduleNames = config.getSpeculativeDependencies(moduleNames);
+ var taskChecker = new taskCompletionChecker(callback, moduleNames);
+ if (taskChecker.check()) {
+ return;
+ }
+
+ var pendingStates = _helpers.grep(taskChecker.pendingModules, function (x) { return x.hasUrl() && !x.pending });
+ if (!pendingStates.length) {
+ return;
+ }
+
+ for (var i = 0; i < pendingStates.length; i++) {
+ (function (state) {
+ if (state.loaded && !state.ready) {
+ state.callbacks.push(function () {
+ taskChecker.check();
+ });
+ } else {
+ state.callPending();
+ getScriptCached(state.url, function () {
+ state.callDone();
+ });
+ }
+ })(pendingStates[i]);
+ }
+
+ };
+
+ require.getScriptCached = getScriptCached;
+
+ require.getStyleSheet = function (path, fn, scope) {
+ var head = document.getElementsByTagName('head')[0], // reference to document.head for appending/ removing link nodes
+ link = document.createElement('link'); // create the link node
+ link.setAttribute('href', path);
+ link.setAttribute('rel', 'stylesheet');
+ link.setAttribute('type', 'text/css');
+
+ var sheet, cssRules;
+ // get the correct properties to check for depending on the browser
+ if ('sheet' in link) {
+ sheet = 'sheet'; cssRules = 'cssRules';
+ }
+ else {
+ sheet = 'styleSheet'; cssRules = 'rules';
+ }
+
+ var interval_id = setInterval(function () { // start checking whether the style sheet has successfully loaded
+ try {
+ if (link[sheet] && link[sheet][cssRules].length) { // SUCCESS! our style sheet has loaded
+ clearInterval(interval_id); // clear the counters
+ clearTimeout(timeout_id);
+ fn.call(scope || window, true, link); // fire the callback with success == true
+ }
+ } catch (e) { } finally { }
+ }, 10), // how often to check if the stylesheet is loaded
+ timeout_id = setTimeout(function () { // start counting down till fail
+ clearInterval(interval_id); // clear the counters
+ clearTimeout(timeout_id);
+ head.removeChild(link); // since the style sheet didn't load, remove the link node from the DOM
+ fn.call(scope || window, false, link); // fire the callback with success == false
+ }, 15000); // how long to wait before failing
+
+ head.appendChild(link); // insert the link node into the DOM and start loading the style sheet
+
+ return link; // return the link node;
+ }
+
+ require.resource = function (scripts, callback) {
+ function flattenArray(arr) {
+ if (!_helpers.isArray(arr)) {
+ return arr;
+ }
+
+ return _helpers.map(arr, function (n) {
+ return flattenArray(n)
+ });
+ }
+ scripts = flattenArray(scripts).reverse();
+ if (typeof (scripts) == 'undefined') {
+ console.error('$.require called without scripts', arguments);
+ return;
+ }
+ function next() {
+ if (!scripts.length) {
+ callback();
+ return;
+ }
+
+ if (!window.loadedScripts) {
+ window.loadedScripts = [];
+ }
+ if (!window.loadingScriptCallbacks) {
+ window.loadingScriptCallbacks = {};
+ }
+
+ var script = scripts.pop();
+ var css = script.indexOf('.css') != -1;
+
+ var originalScript = script;
+ if (script.indexOf('~/') == 0) {
+ script = script.replace('~/', $siteRoot());
+ }
+
+ if (window.loadingScriptCallbacks[script]) {
+ window.loadingScriptCallbacks[script].push(function () {
+ next();
+ });
+ return;
+ }
+
+ if (!css) {
+ if (document.querySelector('script[src="' + script + '"]') || window.loadedScripts.indexOf(script) != -1) {
+ next();
+ return;
+ }
+ } else {
+ if (document.querySelector('link[href="' + script + '"]') || window.loadedScripts.indexOf(script) != -1) {
+ next();
+ return;
+ }
+ }
+
+ window.loadingScriptCallbacks[script] = [function () {
+ next();
+ }];
+
+ function done() {
+ window.loadedScripts.push(script);
+ document.dispatchEvent(new CustomEvent("require.scriptLoaded", { detail: originalScript }));
+ for (var i = 0; i < window.loadingScriptCallbacks[script].length; i++) {
+ window.loadingScriptCallbacks[script][i]();
+ }
+ delete window.loadingScriptCallbacks[script];
+ }
+
+ if (css) {
+ require.getStyleSheet(script, function () {
+ done();
+ });
+ }
+ else {
+ require.getScriptCached(script, function () {
+ done();
+ });
+ }
+ }
+ next();
+ };
+
+ _helpers.getOnce = function (options) {
+ if (!window.getOnceCallbacks) {
+ window.getOnceCallbacks = {};
+ }
+ if (options.data) {
+ var s = _helpers.param(options.data, options.traditional);
+ if (options.url.indexOf('?') == -1) {
+ options.url += '?' + s;
+ }
+ else {
+ options.url += '&' + s;
+ }
+ delete options.data;
+ }
+ if (window.getOnceCallbacks[options.url]) {
+ window.getOnceCallbacks[options.url].push({
+ success: options.success,
+ error: options.error
+ });
+ return;
+ }
+
+ window.getOnceCallbacks[options.url] = [{
+ success: options.success,
+ error: options.error
+ }];
+ function done(m, a) {
+ var callbacks = window.getOnceCallbacks[options.url];
+ for (var i = 0; i < callbacks.length; i++) {
+ callbacks[i][m].apply(this, a);
+ }
+ delete window.getOnceCallbacks[options.url];
+ }
+
+ options.success = function () {
+ done.apply(this, ['success', arguments]);
+
+ };
+ options.error = function () {
+ done.apply(this, ['error', arguments]);
+ };
+ _helpers.ajax(options);
+ }
+
+ function getModuleName(url) {
+ var u = url;
+ u = u.substring(u.lastIndexOf('/') + 1);
+ u = u.substring(0, u.lastIndexOf('.'));
+ return u;
+ }
+
+ function completeDefine(moduleName) {
+ if (typeof (window._pendingDefine) === 'undefined') {
+ define(moduleName, [], function () { });
+ return;
+ }
+ var moduleDependencies = window._pendingDefine.moduleDependencies;
+ var callback = window._pendingDefine.callback;
+ delete window._pendingDefine;
+ var state = config.getOrCreateState(moduleName);
+
+ config.updateState(state, moduleDependencies, callback);
+ }
+
+ var amd = window.define && window.define.amd ? window.define.amd : {};
+
+ window.define = function (moduleName, moduleDependencies, callback) {
+ if (typeof (moduleName) === "string") {
+ if (_helpers.isFunction(moduleDependencies)) {
+ callback = moduleDependencies;
+ }
+ } else if (_helpers.isArray(moduleName)) {
+ callback = moduleDependencies;
+ moduleDependencies = moduleName;
+ moduleName = null;
+ } else if (_helpers.isFunction(moduleName)) {
+ callback = moduleName;
+ moduleDependencies = [];
+ moduleName = null;
+ }
+ if (debug)
+ console.log('define', moduleName, moduleDependencies);
+
+ window._pendingDefine = {
+ moduleDependencies: moduleDependencies,
+ callback: callback
+ };
+ // if (moduleName == null && document.currentScript){
+ // try {
+ // moduleName = getModuleName(document.currentScript.src);
+ // if (moduleName.indexOf(".min") === moduleName.length - 4){
+ // moduleName = moduleName.substring(0, moduleName.length - 4);
+ // }
+ // } catch (e) {
+ // console && console.warn("Could not resolve current script");
+ // }
+ //
+ // }
+ if (moduleName != null) {
+ completeDefine(moduleName);
+ }
+
+
+ }
+ window.define.amd = amd;
+
+
+ function getFlatDependencies(moduleName) {
+ var state = window.define.amd[moduleName];
+ var dependencies = [];
+ if (!state || !state.moduleDependencies) {
+ return dependencies;
+ }
+ for (var i = 0; i < state.moduleDependencies.length; i++) {
+ if (state.moduleDependencies[i].indexOf('/') != -1) {
+ continue;
+ }
+ dependencies.push(state.moduleDependencies[i]);
+ var deps = getFlatDependencies(state.moduleDependencies[i]);
+ for (var j = 0; j < deps.length; j++) {
+ if (dependencies.indexOf(deps[j]) === -1)
+ dependencies.push(deps[j]);
+ }
+ }
+ return dependencies;
+ }
+
+ window.flatDependencies = function (moduleName, ignoredBundles) {
+ var r = {};
+ for (var k in window.define.amd) {
+ if (k.indexOf('anonymous') === -1) {
+ var deps = getFlatDependencies(k);
+ if (deps.length)
+ r[k] = deps;
+ }
+ }
+ if (typeof (moduleName) != 'undefined') {
+ var deps = r[moduleName];
+ if (typeof (deps) == 'undefined') {
+ console.warn('no dependencies for', moduleName, r);
+ return;
+ }
+ deps = deps.slice();
+ deps.push(moduleName);
+ deps = config.bundle(deps, true, ignoredBundles);
+ var s = '\n';
+ for (var i = 0; i < deps.length; i++) {
+ var state = config.getOrCreateState(deps[i]);
+ if (state.isBundle) {
+ continue;
+ }
+ if (state.url)
+ s += '///' + ' <reference path="' + state.url.split('?')[0] + '" />\n';
+ }
+ console.log(s);
+ }
+ return r;
+ };
+ window.pendingModules = function () {
+ var states = [];
+ for (var k in window.define.amd) {
+ states.push(window.define.amd[k]);
+ }
+
+ return {
+ blocked: _helpers.grep(states, function (x) {
+ return (x.pending && !x.ready) || _helpers.grep(x.dependencies || [], function (d) { return !x.ready; }).length;
+ }),
+ missing: _helpers.grep(states, function (x) {
+ return !x.isBundle && !x.loaded;
+ })
+ };
+ }
+ window.explainBundle = function (name) {
+ var bundle = config.bundlesByName[name];
+ if (!bundle) {
+ console.warn('no bundle named', name);
+ }
+ console.log(bundle.usages);
+ };
+})(window.__requireFiles); \ No newline at end of file