***************
modules/modules.js
***************
429043
function (events) {
        "use strict";
    
        var loaded = {};
        this.loaded = loaded;
    
        var items = {};
        var keys = [];
        Object.defineProperty(this, 'items', {
            'get': function () {
                return items;
            }
        });
        Object.defineProperty(this, 'keys', {
            'get': function () {
                return keys;
            }
        });
        Object.defineProperty(this, 'length', {
            'get': function () {
                return keys.length;
            }
        });
    
        // List of modules that are multilanguage
        var multilanguage = new Map();
        Object.defineProperty(this, 'multilanguage', {
            'get': function () {
                return multilanguage;
            }
        });
    
        this.get = function (moduleID, extendedID) {
    
            var done = function () {
    
                events.trigger(moduleID + ':done');
                events.trigger('done', moduleID);
    
                loaded[moduleID] = true;
    
            };
    
            var extended;
            if (extendedID) {
                extended = items[extendedID];
                if (!extended) {
                    extended = new Module(moduleID, events);
                    items[extendedID] = extended;
                    keys.push(extendedID);
                }
            }
    
            var module = items[moduleID];
            if (!module) {
                module = new Module(moduleID, events);
                items[moduleID] = module;
                keys.push(moduleID);
            }
    
    
            if (extended) return [module, extended];
            else return [module, done];
    
        };
    
    }
1013738
function loadModules(dir, container, args) {
  var files = fs.readdirSync(dir);
  for (var i = 0; i < files.length; i++) {
    var file = files[i];
    var filePath = path.join(dir, file);
    if (fs.statSync(filePath).isDirectory()) {
      container[file] = {};
      loadModules(filePath, container[file], args);
      continue;
    }
    if (/.+\.js$/.test(file)) {
      var name = file.replace(/\.js$/, '') 
      container[name] = require(filePath)(args, container);
    }
  }
}
35540
def modules(self, value):
        """"""

        modules = [module.__name__ for module in self.loadmodules(value)]

        self._modules = [
            module for module in self._modules + modules
            if module not in self._modules
        ]
252747
async function _compileAssets(wwwDir, tmpDir) {
  const nodeDir = resolve(wwwDir, '../node_modules');
  const moduleDirs = (function _moduleDirs() {
    const dirs = [wwwDir];
    if (fs.existsSync(nodeDir)) dirs.push(nodeDir);
    return dirs;
  }());

  const config = webPackConfig('production', tmpDir, moduleDirs, tmpDir);
  if (Utils.isEmpty(config.entry)) return;

  const compiler = Webpack(config);
  await new Promise((_resolve, _reject) => {
    compiler.run((err, stats) => {
      if (stats.hasErrors()) {
        _reject(new Error('Failed to compile assets'));
      }

      _resolve();
    });
  });
}
496111
function hotCreateRequire(moduleId) {
/******/ 		var me = installedModules[moduleId];
/******/ 		if (!me) return __webpack_require__;
/******/ 		var fn = function(request) {
/******/ 			if (me.hot.active) {
/******/ 				if (installedModules[request]) {
/******/ 					if (installedModules[request].parents.indexOf(moduleId) === -1) {
/******/ 						installedModules[request].parents.push(moduleId);
/******/ 					}
/******/ 				} else {
/******/ 					hotCurrentParents = [moduleId];
/******/ 					hotCurrentChildModule = request;
/******/ 				}
/******/ 				if (me.children.indexOf(request) === -1) {
/******/ 					me.children.push(request);
/******/ 				}
/******/ 			} else {
/******/ 				console.warn(
/******/ 					"[HMR] unexpected require(" +
/******/ 						request +
/******/ 						") from disposed module " +
/******/ 						moduleId
/******/ 				);
/******/ 				hotCurrentParents = [];
/******/ 			}
/******/ 			return __webpack_require__(request);
/******/ 		};
/******/ 		var ObjectFactory = function ObjectFactory(name) {
/******/ 			return {
/******/ 				configurable: true,
/******/ 				enumerable: true,
/******/ 				get: function() {
/******/ 					return __webpack_require__[name];
/******/ 				},
/******/ 				set: function(value) {
/******/ 					__webpack_require__[name] = value;
/******/ 				}
/******/ 			};
/******/ 		};
/******/ 		for (var name in __webpack_require__) {
/******/ 			if (
/******/ 				Object.prototype.hasOwnProperty.call(__webpack_require__, name) &&
/******/ 				name !== "e" &&
/******/ 				name !== "t"
/******/ 			) {
/******/ 				Object.defineProperty(fn, name, ObjectFactory(name));
/******/ 			}
/******/ 		}
/******/ 		fn.e = function(chunkId) {
/******/ 			if (hotStatus === "ready") hotSetStatus("prepare");
/******/ 			hotChunksLoading++;
/******/ 			return __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) {
/******/ 				finishChunkLoading();
/******/ 				throw err;
/******/ 			});
/******/
/******/ 			function finishChunkLoading() {
/******/ 				hotChunksLoading--;
/******/ 				if (hotStatus === "prepare") {
/******/ 					if (!hotWaitingFilesMap[chunkId]) {
/******/ 						hotEnsureUpdateChunk(chunkId);
/******/ 					}
/******/ 					if (hotChunksLoading === 0 && hotWaitingFiles === 0) {
/******/ 						hotUpdateDownloaded();
/******/ 					}
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 		fn.t = function(value, mode) {
/******/ 			if (mode & 1) value = fn(value);
/******/ 			return __webpack_require__.t(value, mode & ~1);
/******/ 		};
/******/ 		return fn;
/******/ 	}
728940
function getModules(app) {
	var results = [];

	if (extensions && extensions.hasOwnProperty('modules')
		&& extensions.modules.hasOwnProperty(app)
	) {
		var sourceArray = extensions.modules[app];

		for (index = 0; index < sourceArray.length; ++index) {
		    results.push(app + '.' + sourceArray[index]);
		}
	}

	return results;
}
1238401
function installModule(nodeModules, dep, opts, cb) {
    var where = path.join(nodeModules, '..');

    console.log('installing ', where, dep.resolved);
    var cmd = 'npm install ' + dep.resolved;

    if (opts.registry) {
        cmd += ' --registry=' + opts.registry;
    }

    exec(cmd, {
        cwd: where
    }, cb);
}
1170895
function(exists, cb) {
          if(!exists) {
            fs.mkdir(rootDir + '/node_modules', function(error) {
              cb(error);
            });
          } else {
            cb(null);
          }
        }
767840
function bootstrap(bootstrapModules) {

  var modules = [],
      components = [];

  function hasModule(m) {
    return modules.indexOf(m) >= 0;
  }

  function addModule(m) {
    modules.push(m);
  }

  function visit(m) {
    if (hasModule(m)) {
      return;
    }

    (m.__depends__ || []).forEach(visit);

    if (hasModule(m)) {
      return;
    }

    addModule(m);

    (m.__init__ || []).forEach(function(c) {
      components.push(c);
    });
  }

  bootstrapModules.forEach(visit);

  var injector = new Injector(modules);

  components.forEach(function(c) {

    try {
      // eagerly resolve component (fn or string)
      injector[typeof c === 'string' ? 'get' : 'invoke'](c);
    } catch (e) {
      console.error('Failed to instantiate component');
      console.error(e.stack);

      throw e;
    }
  });

  return injector;
}
1255624
function() {

        /* Find all modules to import */
        var server = this;
        return utils.resolve(arguments).then(function(modules) {

          /* Prune modules already injected in the worker */
          var injectables = [];
          for (var moduleName in modules) {
            if (injectedModules[moduleName]) continue;
            injectables.push(modules[moduleName]);
          }

          /* Inject each module in the worker */
          var promises = [];
          for (var i in injectables) {

            /* Message id, deferred, and (derived) promise */
            promises.push(server.send({module: injectables[i]})
              .then(function(moduleName) {
                injectedModules[moduleName] = true;
                return moduleName;
              })
            );
          }

          /* Return a promise combining all imports */
          return Promise.all(promises);
        });
      }
315008
function createJsModule(source) {
    var compilerOptions = {
        compilerOptions: {
            target: ts.ScriptTarget.ES5,
            module: ts.ModuleKind.CommonJS,
            alwaysStrict: false
        }
    };
    var transpiled = ts.transpileModule(source, compilerOptions);
    return transpiled.outputText;
}
96008
function loadModule(modulePath) {
    // Setup environment
    if (loadedModule === undefined || loadedModulePath != modulePath) {
        loadedModule = require(modulePath);
        loadedModulePath = modulePath;
        
        return Q(loadedModule);        
    } else {
        return Q(loadedModule);
    }
}
1199276
function watchModule (module, modulesDir) {

    const pathToModule = resolve(modulesDir, module);
    const pathToHandlers = resolve(HANDLER_BASE, module);


    modules[module] = {
        handlers: []
    };
    fs.readdir(pathToHandlers, (err, files) => {

        if (err) {
            return console.log(new Error('Failed to get handler files for module: ' + module));
        }

        files.forEach(file => {

            if (file.length < 3 || file.indexOf('bundle.') === 0 || file.substr(file.length - 3) !== '.js') {
                return;
            }

            modules[module].handlers.push(pathToHandlers + '/' + file);
        });

        let watchList = modules[module].handlers.concat([pathToModule]);
        let watcher = chokidar.watch(watchList, {
            ignored: /(^|[\/\\])\../,
            persistent: true
        });
        watcher.on('change', (path, stats) => {

            // rebundle based on the type of the file
            if (modules[module].handlers.indexOf(path) < 0) {
                modules[module].handlers.forEach(handler => bundleHandler(pathToHandlers, module, handler.substr(handler.lastIndexOf('/') + 1)));
            } else {
                bundleHandler(pathToHandlers, module, path.substr(path.lastIndexOf('/') + 1));
            }
        });
    });
}
706507
function(moduleId) {
		var scriptEl = document.createElement('script');
		scriptEl.type = 'text/javascript';
		scriptEl.src = resolveModuleUri(moduleId);

		var useStandard = !!scriptEl.addEventListener,
			timeoutHandle;

		var errorFunc = function() {
			postLoadFunc(false);
		};

		var loadFunc = function() {
			if (useStandard || (scriptEl.readyState == 'complete' || scriptEl.readyState == 'loaded')) {
				postLoadFunc(getModule(moduleId).defined);
			}
		};

		var postLoadFunc = function(loaded) {
			clearTimeout(timeoutHandle);

			if (useStandard) {
				scriptEl.removeEventListener('load', loadFunc, false);
				scriptEl.removeEventListener('error', errorFunc, false);
			}
			else {
				scriptEl.detachEvent('onreadystatechange', loadFunc);
			}

			if (!loaded) {
				var module = getModule(moduleId);
				if (!module.defined) {
					module.defined = module.error = true;
					fireCallbacks();
				}
			}
		};

		if (useStandard) {
			scriptEl.addEventListener('load', loadFunc, false);
			scriptEl.addEventListener('error', errorFunc, false);
		}
		else {
			scriptEl.attachEvent('onreadystatechange', loadFunc);
		}

		timeoutHandle = setTimeout(errorFunc, _timeoutLength);

		head.appendChild(scriptEl);
	}
624940
function (moduleName) {
            var requiresModule = createModule(moduleName);
            var mods = requiresModule.getNormalizedModules();
            Utils.each(mods, function (m) {
                m.undef();
            });
        }
128515
function(modules){
		return function(System){
			if(!Array.isArray(modules)) {
				return [System.main];
			} else if(typeof modules === "function") {
				return modules.apply(this, arguments);
			} else {
				return modules;
			}
		};
	}
124060
function loadModule(moduleName, moduleFileName, oxModulesDirPath, options) {
    var Module;
    try {
        Module = require(path.join(oxModulesDirPath, moduleFileName));
    } catch (e) {
        if (e instanceof ModuleUnavailableError) {
            logger.warn('Loading module: ' + moduleName + '. Failed to load - ' + e.message);
            return;
        } else {
            throw e;
        }
    }

    var mod = new Module(options, ctx, resultStore, logger);

    // load external commands
    var cmdDir = path.join(oxModulesDirPath, 'module-' + moduleName, 'commands');
    if (fs.existsSync(cmdDir)) {
        var commandName = null;
        try {
            var files = fs.readdirSync(cmdDir);
            for (var fileName of files) {
                commandName = fileName.slice(0, -3);
                if (commandName.indexOf('.') !== 0) {   // ignore possible hidden files (i.e. starting with '.')
                    var cmdFunc = require(path.join(cmdDir, commandName));
                    // bind function's "this" to module's "this"
                    var fnc = cmdFunc.bind(mod._this || mod);
                    mod[commandName] = fnc;
                    // since commands have access only to _this, reference all
                    // commands on it, so commands could have access to each other.
                    // note that command defined in the main module won't be referenced.
                    mod._this[commandName] = fnc;
                }
            }
        } catch (e) {
            logger.error("Can't load command '" + commandName + ': ' + e.message);
            logger.debug(e.stack);
        }
    }

    // apply this for functions inside 'helpers' methods collection if found
    if (mod.helpers || (mod._this && mod._this.helpers)) {
        var helpers = mod.helpers || mod._this.helpers;
        for (var funcName in helpers) {
            if (typeof helpers[funcName] === 'function') {
                helpers[funcName] = helpers[funcName].bind(mod._this || mod);
            }
        }
    }

    logger.debug('Loading module: ' + moduleName);
    modules[moduleName] = sandbox[moduleName] = global.ox[moduleName] = moduleWrapper(moduleName, mod, resultStore);
}